@itwin/imodel-components-react 4.0.0-dev.9 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +161 -1
- package/README.md +2 -2
- package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts +28 -28
- package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/UiIModelComponents.js +75 -79
- package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts +36 -36
- package/lib/cjs/imodel-components-react/color/AlphaSlider.js +190 -186
- package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/AlphaSlider.scss +63 -63
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +112 -107
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.scss +90 -90
- package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
- package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js +78 -74
- package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js +143 -137
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.scss +62 -63
- package/lib/cjs/imodel-components-react/color/HueSlider.d.ts +22 -22
- package/lib/cjs/imodel-components-react/color/HueSlider.js +203 -199
- package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/HueSlider.scss +61 -61
- package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts +20 -20
- package/lib/cjs/imodel-components-react/color/SaturationPicker.js +217 -213
- package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/SaturationPicker.scss +35 -35
- package/lib/cjs/imodel-components-react/color/Swatch.d.ts +22 -22
- package/lib/cjs/imodel-components-react/color/Swatch.js +64 -60
- package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/Swatch.scss +22 -23
- package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
- package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js +23 -23
- package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
- package/lib/cjs/imodel-components-react/editors/ColorEditor.d.ts +44 -44
- package/lib/cjs/imodel-components-react/editors/ColorEditor.js +155 -151
- package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
- package/lib/cjs/imodel-components-react/editors/ColorEditor.scss +18 -18
- package/lib/cjs/imodel-components-react/editors/WeightEditor.d.ts +47 -47
- package/lib/cjs/imodel-components-react/editors/WeightEditor.js +164 -160
- package/lib/cjs/imodel-components-react/editors/WeightEditor.js.map +1 -1
- package/lib/cjs/imodel-components-react/editors/WeightEditor.scss +16 -16
- package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts +25 -25
- package/lib/cjs/imodel-components-react/inputs/QuantityInput.js +100 -96
- package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +272 -265
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.scss +106 -107
- package/lib/cjs/imodel-components-react/lineweight/Swatch.d.ts +33 -33
- package/lib/cjs/imodel-components-react/lineweight/Swatch.js +89 -85
- package/lib/cjs/imodel-components-react/lineweight/Swatch.js.map +1 -1
- package/lib/cjs/imodel-components-react/lineweight/Swatch.scss +48 -48
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.d.ts +60 -60
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js +163 -159
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +51 -52
- package/lib/cjs/imodel-components-react/navigationaids/Cube.d.ts +45 -45
- package/lib/cjs/imodel-components-react/navigationaids/Cube.js +131 -127
- package/lib/cjs/imodel-components-react/navigationaids/Cube.js.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/Cube.scss +19 -19
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +154 -174
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +626 -634
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.scss +178 -182
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js +657 -647
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.scss +135 -134
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +103 -99
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +59 -63
- package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +56 -53
- package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
- package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +88 -83
- package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +89 -86
- package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +112 -109
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +133 -133
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
- package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +187 -184
- package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js +149 -145
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js +63 -59
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js +51 -47
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
- package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js +58 -54
- package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
- package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js +52 -48
- package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js +54 -50
- package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +62 -58
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js +51 -47
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js +60 -56
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +98 -95
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
- package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js +123 -119
- package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
- package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js +142 -143
- package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
- package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js +69 -69
- package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.js +85 -81
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.scss +26 -26
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.js +99 -91
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +28 -31
- package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts +54 -54
- package/lib/cjs/imodel-components-react/timeline/Scrubber.js +195 -191
- package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +105 -112
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js +432 -424
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +359 -356
- package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
- package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js +58 -54
- package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
- package/lib/cjs/imodel-components-react/timeline/Timeline.scss +164 -164
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +130 -133
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +398 -358
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +178 -164
- package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +145 -174
- package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/interfaces.js +45 -45
- package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +276 -274
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
- package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js +105 -105
- package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
- package/lib/cjs/imodel-components-react.d.ts +81 -82
- package/lib/cjs/imodel-components-react.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react.js +104 -101
- package/lib/cjs/imodel-components-react.js.map +1 -1
- package/lib/esm/imodel-components-react/UiIModelComponents.d.ts +28 -28
- package/lib/esm/imodel-components-react/UiIModelComponents.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/UiIModelComponents.js +72 -75
- package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +36 -36
- package/lib/esm/imodel-components-react/color/AlphaSlider.js +160 -160
- package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
- package/lib/esm/imodel-components-react/color/AlphaSlider.scss +63 -63
- package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
- package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerButton.js +83 -82
- package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerButton.scss +90 -90
- package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
- package/lib/esm/imodel-components-react/color/ColorPickerDialog.js +51 -51
- package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +114 -112
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +62 -63
- package/lib/esm/imodel-components-react/color/HueSlider.d.ts +22 -22
- package/lib/esm/imodel-components-react/color/HueSlider.js +173 -173
- package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
- package/lib/esm/imodel-components-react/color/HueSlider.scss +61 -61
- package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +20 -20
- package/lib/esm/imodel-components-react/color/SaturationPicker.js +187 -187
- package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
- package/lib/esm/imodel-components-react/color/SaturationPicker.scss +35 -35
- package/lib/esm/imodel-components-react/color/Swatch.d.ts +22 -22
- package/lib/esm/imodel-components-react/color/Swatch.js +34 -34
- package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
- package/lib/esm/imodel-components-react/color/Swatch.scss +22 -23
- package/lib/esm/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
- package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js +19 -19
- package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
- package/lib/esm/imodel-components-react/editors/ColorEditor.d.ts +44 -44
- package/lib/esm/imodel-components-react/editors/ColorEditor.js +124 -124
- package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
- package/lib/esm/imodel-components-react/editors/ColorEditor.scss +18 -18
- package/lib/esm/imodel-components-react/editors/WeightEditor.d.ts +47 -47
- package/lib/esm/imodel-components-react/editors/WeightEditor.js +133 -133
- package/lib/esm/imodel-components-react/editors/WeightEditor.js.map +1 -1
- package/lib/esm/imodel-components-react/editors/WeightEditor.scss +16 -16
- package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts +25 -25
- package/lib/esm/imodel-components-react/inputs/QuantityInput.js +70 -70
- package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +243 -240
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.scss +106 -107
- package/lib/esm/imodel-components-react/lineweight/Swatch.d.ts +33 -33
- package/lib/esm/imodel-components-react/lineweight/Swatch.js +59 -59
- package/lib/esm/imodel-components-react/lineweight/Swatch.js.map +1 -1
- package/lib/esm/imodel-components-react/lineweight/Swatch.scss +48 -48
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.d.ts +60 -60
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js +134 -133
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +51 -52
- package/lib/esm/imodel-components-react/navigationaids/Cube.d.ts +45 -45
- package/lib/esm/imodel-components-react/navigationaids/Cube.js +100 -100
- package/lib/esm/imodel-components-react/navigationaids/Cube.js.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/Cube.scss +19 -19
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +154 -174
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +596 -606
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.scss +178 -182
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js +627 -620
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +135 -134
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +76 -76
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +59 -63
- package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +29 -30
- package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
- package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +61 -60
- package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/FormatType.js +62 -63
- package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +82 -83
- package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
- package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +106 -110
- package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
- package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +157 -158
- package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js +122 -122
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js +36 -36
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js +24 -24
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
- package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js +31 -31
- package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
- package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js +25 -25
- package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js +27 -27
- package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +35 -35
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js +24 -24
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js +33 -33
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +68 -69
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
- package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js +96 -96
- package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
- package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js +138 -139
- package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
- package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js +65 -65
- package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
- package/lib/esm/imodel-components-react/timeline/InlineEdit.js +55 -55
- package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/InlineEdit.scss +26 -26
- package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
- package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/PlayerButton.js +68 -64
- package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +28 -31
- package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts +54 -54
- package/lib/esm/imodel-components-react/timeline/Scrubber.js +164 -164
- package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/Scrubber.scss +105 -112
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.js +402 -398
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +359 -356
- package/lib/esm/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
- package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js +28 -28
- package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
- package/lib/esm/imodel-components-react/timeline/Timeline.scss +164 -164
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +130 -133
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +368 -332
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +178 -164
- package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +145 -174
- package/lib/esm/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/interfaces.js +42 -42
- package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +249 -251
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
- package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js +96 -95
- package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
- package/lib/esm/imodel-components-react.d.ts +81 -82
- package/lib/esm/imodel-components-react.d.ts.map +1 -1
- package/lib/esm/imodel-components-react.js +86 -87
- package/lib/esm/imodel-components-react.js.map +1 -1
- package/lib/public/locales/en/UiIModelComponents.json +139 -139
- package/package.json +35 -37
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.d.ts +0 -22
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.d.ts.map +0 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js +0 -146
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js.map +0 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.scss +0 -94
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.d.ts +0 -22
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.d.ts.map +0 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.js +0 -123
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.js.map +0 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.scss +0 -94
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlphaSlider.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/AlphaSlider.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAcnD;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,aAA+B;IAIpE,gBAAgB;IAChB,YAAY,KAAuB;QACjC,KAAK,CAAC,KAAK,CAAC,CAAC;QALP,eAAU,GAA0B,IAAI,CAAC;QACzC,uBAAkB,GAAG,kBAAkB,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;QAOxE,qBAAgB,GAAG,CAAC,CAAsE,EAAE,YAAqB,EAAE,KAAa,EAAE,SAAyB,EAAsB,EAAE;YACzL,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,SAAS,CAAC,qBAAqB,EAAE,CAAC;YAE7F,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,IAAI,OAAO,I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;YAC1C,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;QAE9D,OAAO,CACL,6BAAK,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,iBAAc,iBAAiB;YACtF,4CACc,cAAc,EAC1B,IAAI,EAAC,QAAQ,gBAAa,IAAI,CAAC,kBAAkB,mBAClC,CAAC,mBAAiB,CAAC,mBAAiB,IAAI,CAAC,KAAK,CAAC,KAAK,EACnE,SAAS,EAAC,yBAAyB,EACnC,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,SAAS,EAC/C,WAAW,EAAE,IAAI,CAAC,YAAY,EAC9B,WAAW,EAAE,IAAI,CAAC,SAAS,EAC3B,YAAY,EAAE,IAAI,CAAC,SAAS,EAC5B,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,IAAI,CAAC,UAAU;gBAE1B,6BAAK,KAAK,EAAE,YAAY,EAAE,SAAS,EAAC,0BAA0B,iBAAa,eAAe,GAAG,CACzF,CACF,CACP,CAAC;IACJ,CAAC;CAEF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Color\r\n */\r\n\r\nimport \"./AlphaSlider.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\nimport { SpecialKey } from \"@itwin/appui-abstract\";\r\n\r\n/** Properties for the [[AlphaSlider]] React component\r\n * @beta\r\n */\r\nexport interface AlphaSliderProps extends React.HTMLAttributes<HTMLDivElement>, CommonProps {\r\n /** true if slider is oriented horizontal, else vertical orientation is assumed */\r\n isHorizontal?: boolean;\r\n /** function to run when user selects color swatch */\r\n onAlphaChange?: ((alpha: number) => void) | undefined;\r\n /** Alpha value between 0 (transparent) and 1 (opaque) */\r\n alpha: number;\r\n}\r\n\r\n/** AlphaSlider component used to set the alpha value.\r\n * @beta\r\n */\r\nexport class AlphaSlider extends React.PureComponent<AlphaSliderProps> {\r\n private _container: HTMLDivElement | null = null;\r\n private _transparencyLabel = UiIModelComponents.translate(\"color.transparency\");\r\n\r\n /** @internal */\r\n constructor(props: AlphaSliderProps) {\r\n super(props);\r\n }\r\n\r\n private _calculateChange = (e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>, isHorizontal: boolean, alpha: number, container: HTMLDivElement): number | undefined => {\r\n e.preventDefault();\r\n const { width: containerWidth, height: containerHeight } = container.getBoundingClientRect();\r\n\r\n let x = 0;\r\n if (\"pageX\" in e) {\r\n x = e.pageX;\r\n } else {\r\n // istanbul ignore if\r\n if (undefined === e.touches)\r\n return undefined;\r\n x = e.touches[0].pageX;\r\n }\r\n // istanbul ignore if\r\n if (undefined === x)\r\n return undefined;\r\n\r\n let y = 0;\r\n if (\"pageY\" in e) {\r\n y = e.pageY;\r\n } else {\r\n // istanbul ignore if\r\n if (undefined === e.touches)\r\n return;\r\n y = e.touches[0].pageY;\r\n }\r\n // istanbul ignore if\r\n if (undefined === y)\r\n return undefined;\r\n\r\n const left = x - (container.getBoundingClientRect().left + window.scrollX);\r\n const top = y - (container.getBoundingClientRect().top + window.scrollY);\r\n\r\n let t = 0;\r\n\r\n if (!isHorizontal) {\r\n // istanbul ignore next\r\n if (top < 0) {\r\n t = 1;\r\n } else if (top > containerHeight) {\r\n t = 0;\r\n } else {\r\n t = 1 - (top / containerHeight);\r\n }\r\n } else { // horizontal\r\n // istanbul ignore next\r\n if (left < 0) {\r\n t = 0;\r\n } else if (left > containerWidth) {\r\n t = 1;\r\n } else {\r\n t = left / containerWidth;\r\n }\r\n }\r\n\r\n // istanbul ignore if\r\n if (t < 0) t = 0;\r\n // istanbul ignore if\r\n if (t > 1) t = 1;\r\n // istanbul ignore next\r\n return (alpha !== t) ? t : undefined;\r\n };\r\n\r\n /** @internal */\r\n public override componentWillUnmount() {\r\n this._unbindEventListeners();\r\n }\r\n\r\n private _onChange = (e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>) => {\r\n // istanbul ignore else\r\n if (this._container && this.props.onAlphaChange) {\r\n const change = this._calculateChange(e, this.props.isHorizontal ? this.props.isHorizontal : false, this.props.alpha, this._container);\r\n undefined !== change && typeof this.props.onAlphaChange === \"function\" && this.props.onAlphaChange(change);\r\n }\r\n };\r\n\r\n private _onMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {\r\n this._onChange(e);\r\n // istanbul ignore else\r\n if (this._container)\r\n this._container.focus();\r\n window.addEventListener(\"mousemove\", this._onChange as any);\r\n window.addEventListener(\"mouseup\", this._onMouseUp);\r\n };\r\n\r\n private _onKeyDown = (evt: React.KeyboardEvent<HTMLDivElement>) => {\r\n let newTransparency: number | undefined;\r\n if (evt.key === SpecialKey.ArrowLeft || evt.key === SpecialKey.ArrowDown) {\r\n newTransparency = this.props.alpha - (evt.ctrlKey ? .1 : .05);\r\n } else if (evt.key === SpecialKey.ArrowRight || evt.key === SpecialKey.ArrowUp) {\r\n newTransparency = this.props.alpha + (evt.ctrlKey ? .1 : .05);\r\n } else if (evt.key === SpecialKey.PageDown) {\r\n newTransparency = this.props.alpha - (evt.ctrlKey ? .5 : .25);\r\n } else if (evt.key === SpecialKey.PageUp) {\r\n newTransparency = this.props.alpha + (evt.ctrlKey ? .5 : .25);\r\n } else if (evt.key === SpecialKey.Home) {\r\n newTransparency = 0;\r\n } else {\r\n // istanbul ignore else\r\n if (evt.key === SpecialKey.End) {\r\n newTransparency = 1;\r\n }\r\n }\r\n\r\n // istanbul ignore else\r\n if (undefined !== newTransparency) {\r\n // istanbul ignore if\r\n if (newTransparency > 1) newTransparency = 1;\r\n // istanbul ignore if\r\n if (newTransparency < 0) newTransparency = 0;\r\n // istanbul ignore else\r\n if (this.props.onAlphaChange)\r\n this.props.onAlphaChange(newTransparency);\r\n }\r\n };\r\n\r\n private _onMouseUp = () => {\r\n this._unbindEventListeners();\r\n };\r\n\r\n private _unbindEventListeners() {\r\n window.removeEventListener(\"mousemove\", this._onChange as any);\r\n window.removeEventListener(\"mouseup\", this._onMouseUp);\r\n }\r\n\r\n /** @internal */\r\n public override render(): React.ReactNode {\r\n const containerClasses = classnames(\r\n this.props.isHorizontal ? \"components-alpha-container-horizontal\" : \"components-alpha-container-vertical\",\r\n this.props.className,\r\n );\r\n\r\n const pointerStyle: React.CSSProperties = this.props.isHorizontal ?\r\n { left: `${(this.props.alpha * 100)}%` } :\r\n { left: `0px`, top: `${-(this.props.alpha * 100) + 100}%` };\r\n\r\n return (\r\n <div className={containerClasses} style={this.props.style} data-testid=\"alpha-container\">\r\n <div\r\n data-testid=\"alpha-slider\"\r\n role=\"slider\" aria-label={this._transparencyLabel}\r\n aria-valuemin={0} aria-valuemax={1} aria-valuenow={this.props.alpha}\r\n className=\"components-alpha-slider\"\r\n ref={(container) => this._container = container}\r\n onMouseDown={this._onMouseDown}\r\n onTouchMove={this._onChange}\r\n onTouchStart={this._onChange}\r\n tabIndex={0}\r\n onKeyDown={this._onKeyDown}\r\n >\r\n <div style={pointerStyle} className=\"components-alpha-pointer\" data-testid=\"alpha-pointer\" />\r\n </div>\r\n </div>\r\n );\r\n }\r\n\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"AlphaSlider.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/AlphaSlider.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EA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,SAAS,EAAE,IAAI,CAAC,UAAU;gBAE1B,6BAAK,KAAK,EAAE,YAAY,EAAE,SAAS,EAAC,0BAA0B,iBAAa,eAAe,GAAG,CACzF,CACF,CACP,CAAC;IACJ,CAAC;CAEF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Color\n */\n\nimport \"./AlphaSlider.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\n\n/** Properties for the [[AlphaSlider]] React component\n * @public\n */\nexport interface AlphaSliderProps extends React.HTMLAttributes<HTMLDivElement>, CommonProps {\n /** true if slider is oriented horizontal, else vertical orientation is assumed */\n isHorizontal?: boolean;\n /** function to run when user selects color swatch */\n onAlphaChange?: ((alpha: number) => void) | undefined;\n /** Alpha value between 0 (transparent) and 1 (opaque) */\n alpha: number;\n}\n\n/** AlphaSlider component used to set the alpha value.\n * @public\n */\nexport class AlphaSlider extends React.PureComponent<AlphaSliderProps> {\n private _container: HTMLDivElement | null = null;\n private _transparencyLabel = UiIModelComponents.translate(\"color.transparency\");\n\n /** @internal */\n constructor(props: AlphaSliderProps) {\n super(props);\n }\n\n private _calculateChange = (e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>, isHorizontal: boolean, alpha: number, container: HTMLDivElement): number | undefined => {\n e.preventDefault();\n const { width: containerWidth, height: containerHeight } = container.getBoundingClientRect();\n\n let x = 0;\n if (\"pageX\" in e) {\n x = e.pageX;\n } else {\n // istanbul ignore if\n if (undefined === e.touches)\n return undefined;\n x = e.touches[0].pageX;\n }\n // istanbul ignore if\n if (undefined === x)\n return undefined;\n\n let y = 0;\n if (\"pageY\" in e) {\n y = e.pageY;\n } else {\n // istanbul ignore if\n if (undefined === e.touches)\n return;\n y = e.touches[0].pageY;\n }\n // istanbul ignore if\n if (undefined === y)\n return undefined;\n\n const left = x - (container.getBoundingClientRect().left + window.scrollX);\n const top = y - (container.getBoundingClientRect().top + window.scrollY);\n\n let t = 0;\n\n if (!isHorizontal) {\n // istanbul ignore next\n if (top < 0) {\n t = 1;\n } else if (top > containerHeight) {\n t = 0;\n } else {\n t = 1 - (top / containerHeight);\n }\n } else { // horizontal\n // istanbul ignore next\n if (left < 0) {\n t = 0;\n } else if (left > containerWidth) {\n t = 1;\n } else {\n t = left / containerWidth;\n }\n }\n\n // istanbul ignore if\n if (t < 0) t = 0;\n // istanbul ignore if\n if (t > 1) t = 1;\n // istanbul ignore next\n return (alpha !== t) ? t : undefined;\n };\n\n /** @internal */\n public override componentWillUnmount() {\n this._unbindEventListeners();\n }\n\n private _onChange = (e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>) => {\n // istanbul ignore else\n if (this._container && this.props.onAlphaChange) {\n const change = this._calculateChange(e, this.props.isHorizontal ? this.props.isHorizontal : false, this.props.alpha, this._container);\n undefined !== change && typeof this.props.onAlphaChange === \"function\" && this.props.onAlphaChange(change);\n }\n };\n\n private _onMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {\n this._onChange(e);\n // istanbul ignore else\n if (this._container)\n this._container.focus();\n window.addEventListener(\"mousemove\", this._onChange as any);\n window.addEventListener(\"mouseup\", this._onMouseUp);\n };\n\n private _onKeyDown = (evt: React.KeyboardEvent<HTMLDivElement>) => {\n let newTransparency: number | undefined;\n if (evt.key === SpecialKey.ArrowLeft || evt.key === SpecialKey.ArrowDown) {\n newTransparency = this.props.alpha - (evt.ctrlKey ? .1 : .05);\n } else if (evt.key === SpecialKey.ArrowRight || evt.key === SpecialKey.ArrowUp) {\n newTransparency = this.props.alpha + (evt.ctrlKey ? .1 : .05);\n } else if (evt.key === SpecialKey.PageDown) {\n newTransparency = this.props.alpha - (evt.ctrlKey ? .5 : .25);\n } else if (evt.key === SpecialKey.PageUp) {\n newTransparency = this.props.alpha + (evt.ctrlKey ? .5 : .25);\n } else if (evt.key === SpecialKey.Home) {\n newTransparency = 0;\n } else {\n // istanbul ignore else\n if (evt.key === SpecialKey.End) {\n newTransparency = 1;\n }\n }\n\n // istanbul ignore else\n if (undefined !== newTransparency) {\n // istanbul ignore if\n if (newTransparency > 1) newTransparency = 1;\n // istanbul ignore if\n if (newTransparency < 0) newTransparency = 0;\n // istanbul ignore else\n if (this.props.onAlphaChange)\n this.props.onAlphaChange(newTransparency);\n }\n };\n\n private _onMouseUp = () => {\n this._unbindEventListeners();\n };\n\n private _unbindEventListeners() {\n window.removeEventListener(\"mousemove\", this._onChange as any);\n window.removeEventListener(\"mouseup\", this._onMouseUp);\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const containerClasses = classnames(\n this.props.isHorizontal ? \"components-alpha-container-horizontal\" : \"components-alpha-container-vertical\",\n this.props.className,\n );\n\n const pointerStyle: React.CSSProperties = this.props.isHorizontal ?\n { left: `${(this.props.alpha * 100)}%` } :\n { left: `0px`, top: `${-(this.props.alpha * 100) + 100}%` };\n\n return (\n <div className={containerClasses} style={this.props.style} data-testid=\"alpha-container\">\n <div\n data-testid=\"alpha-slider\"\n role=\"slider\" aria-label={this._transparencyLabel}\n aria-valuemin={0} aria-valuemax={1} aria-valuenow={this.props.alpha}\n className=\"components-alpha-slider\"\n ref={(container) => this._container = container}\n onMouseDown={this._onMouseDown}\n onTouchMove={this._onChange}\n onTouchStart={this._onChange}\n tabIndex={0}\n onKeyDown={this._onKeyDown}\n >\n <div style={pointerStyle} className=\"components-alpha-pointer\" data-testid=\"alpha-pointer\" />\n </div>\n </div>\n );\n }\n\n}\n"]}
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
.components-alpha-pointer {
|
|
6
|
-
position: absolute;
|
|
7
|
-
width: 1.2rem;
|
|
8
|
-
height: 1.2rem;
|
|
9
|
-
border-radius: 50%;
|
|
10
|
-
background-color: rgb(248, 248, 248);
|
|
11
|
-
box-shadow: rgba(0, 0, 0, 0.37) 0px 1px 4px 0px;
|
|
12
|
-
|
|
13
|
-
&:focus {
|
|
14
|
-
outline: none;
|
|
15
|
-
border: none;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.components-alpha-container-horizontal {
|
|
20
|
-
width: 100%;
|
|
21
|
-
height: 1rem;
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
justify-content: center;
|
|
25
|
-
|
|
26
|
-
.components-alpha-slider {
|
|
27
|
-
position: relative;
|
|
28
|
-
width: calc(100% - 1.2rem);
|
|
29
|
-
height: 100%;
|
|
30
|
-
background-color: linear-gradient(to right, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
|
|
31
|
-
background-image: url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" fill-opacity=".15"><rect x="200" width="200" height="200" /> <rect y="200" width="200" height="200" /></svg>'),
|
|
32
|
-
linear-gradient(to right, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
|
|
33
|
-
background-size: 2rem 1rem, cover;
|
|
34
|
-
background-repeat: repeat, no-repeat;
|
|
35
|
-
|
|
36
|
-
.components-alpha-pointer {
|
|
37
|
-
transform: translate(-.6rem, -.1rem);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.components-alpha-container-vertical {
|
|
43
|
-
width: 1rem;
|
|
44
|
-
display: flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
justify-content: center;
|
|
47
|
-
height: 100%;
|
|
48
|
-
|
|
49
|
-
.components-alpha-slider {
|
|
50
|
-
position: relative;
|
|
51
|
-
width: 100%;
|
|
52
|
-
height: calc(100% - 1.2rem);
|
|
53
|
-
background-color: linear-gradient(to bottom, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
|
|
54
|
-
background-image: url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" fill-opacity=".15"><rect x="200" width="200" height="200" /> <rect y="200" width="200" height="200" /></svg>'),
|
|
55
|
-
linear-gradient(to top, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
|
|
56
|
-
background-size: 1rem 2rem, cover;
|
|
57
|
-
background-repeat: repeat, no-repeat;
|
|
58
|
-
|
|
59
|
-
.components-alpha-pointer {
|
|
60
|
-
transform: translate(-.1rem, -.6rem);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
.components-alpha-pointer {
|
|
6
|
+
position: absolute;
|
|
7
|
+
width: 1.2rem;
|
|
8
|
+
height: 1.2rem;
|
|
9
|
+
border-radius: 50%;
|
|
10
|
+
background-color: rgb(248, 248, 248);
|
|
11
|
+
box-shadow: rgba(0, 0, 0, 0.37) 0px 1px 4px 0px;
|
|
12
|
+
|
|
13
|
+
&:focus {
|
|
14
|
+
outline: none;
|
|
15
|
+
border: none;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.components-alpha-container-horizontal {
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 1rem;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
|
|
26
|
+
.components-alpha-slider {
|
|
27
|
+
position: relative;
|
|
28
|
+
width: calc(100% - 1.2rem);
|
|
29
|
+
height: 100%;
|
|
30
|
+
background-color: linear-gradient(to right, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
|
|
31
|
+
background-image: url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" fill-opacity=".15"><rect x="200" width="200" height="200" /> <rect y="200" width="200" height="200" /></svg>'),
|
|
32
|
+
linear-gradient(to right, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
|
|
33
|
+
background-size: 2rem 1rem, cover;
|
|
34
|
+
background-repeat: repeat, no-repeat;
|
|
35
|
+
|
|
36
|
+
.components-alpha-pointer {
|
|
37
|
+
transform: translate(-.6rem, -.1rem);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.components-alpha-container-vertical {
|
|
43
|
+
width: 1rem;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
height: 100%;
|
|
48
|
+
|
|
49
|
+
.components-alpha-slider {
|
|
50
|
+
position: relative;
|
|
51
|
+
width: 100%;
|
|
52
|
+
height: calc(100% - 1.2rem);
|
|
53
|
+
background-color: linear-gradient(to bottom, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
|
|
54
|
+
background-image: url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" fill-opacity=".15"><rect x="200" width="200" height="200" /> <rect y="200" width="200" height="200" /></svg>'),
|
|
55
|
+
linear-gradient(to top, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
|
|
56
|
+
background-size: 1rem 2rem, cover;
|
|
57
|
+
background-repeat: repeat, no-repeat;
|
|
58
|
+
|
|
59
|
+
.components-alpha-pointer {
|
|
60
|
+
transform: translate(-.1rem, -.6rem);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Color
|
|
3
|
-
*/
|
|
4
|
-
import "./ColorPickerButton.scss";
|
|
5
|
-
import * as React from "react";
|
|
6
|
-
import { ColorDef } from "@itwin/core-common";
|
|
7
|
-
import { CommonProps } from "@itwin/core-react";
|
|
8
|
-
/** Properties for the [[ColorPickerButton]] React component
|
|
9
|
-
* @beta
|
|
10
|
-
*/
|
|
11
|
-
export interface ColorPickerProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {
|
|
12
|
-
/** Active color */
|
|
13
|
-
initialColor: ColorDef;
|
|
14
|
-
/** Available colors */
|
|
15
|
-
colorDefs?: ColorDef[];
|
|
16
|
-
/** Function to run when user selects color swatch */
|
|
17
|
-
onColorPick?: ((color: ColorDef) => void) | undefined;
|
|
18
|
-
/** Show swatches as squares unless round is set to true */
|
|
19
|
-
round?: boolean;
|
|
20
|
-
/** Disabled or not */
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
/** Readonly or not */
|
|
23
|
-
readonly?: boolean;
|
|
24
|
-
/** Title to show at top of DropDown */
|
|
25
|
-
dropDownTitle?: string;
|
|
26
|
-
/** Number of columns */
|
|
27
|
-
numColumns?: number;
|
|
28
|
-
/** Provides ability to return reference to HTMLButtonElement */
|
|
29
|
-
ref?: React.Ref<HTMLButtonElement>;
|
|
30
|
-
/** If true show up/down caret next to color */
|
|
31
|
-
showCaret?: boolean;
|
|
32
|
-
}
|
|
33
|
-
/** ColorPickerButton component
|
|
34
|
-
* @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.
|
|
35
|
-
* @beta
|
|
36
|
-
*/
|
|
37
|
-
export declare const ColorPickerButton: (props: ColorPickerProps) => JSX.Element | null;
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Color
|
|
3
|
+
*/
|
|
4
|
+
import "./ColorPickerButton.scss";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { ColorDef } from "@itwin/core-common";
|
|
7
|
+
import { CommonProps } from "@itwin/core-react";
|
|
8
|
+
/** Properties for the [[ColorPickerButton]] React component
|
|
9
|
+
* @beta
|
|
10
|
+
*/
|
|
11
|
+
export interface ColorPickerProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {
|
|
12
|
+
/** Active color */
|
|
13
|
+
initialColor: ColorDef;
|
|
14
|
+
/** Available colors */
|
|
15
|
+
colorDefs?: ColorDef[];
|
|
16
|
+
/** Function to run when user selects color swatch */
|
|
17
|
+
onColorPick?: ((color: ColorDef) => void) | undefined;
|
|
18
|
+
/** Show swatches as squares unless round is set to true */
|
|
19
|
+
round?: boolean;
|
|
20
|
+
/** Disabled or not */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/** Readonly or not */
|
|
23
|
+
readonly?: boolean;
|
|
24
|
+
/** Title to show at top of DropDown */
|
|
25
|
+
dropDownTitle?: string;
|
|
26
|
+
/** Number of columns */
|
|
27
|
+
numColumns?: number;
|
|
28
|
+
/** Provides ability to return reference to HTMLButtonElement */
|
|
29
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
30
|
+
/** If true show up/down caret next to color */
|
|
31
|
+
showCaret?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** ColorPickerButton component
|
|
34
|
+
* @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.
|
|
35
|
+
* @beta
|
|
36
|
+
*/
|
|
37
|
+
export declare const ColorPickerButton: (props: ColorPickerProps) => JSX.Element | null;
|
|
38
38
|
//# sourceMappingURL=ColorPickerButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerButton.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/ColorPickerButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAElC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAe,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"ColorPickerButton.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/ColorPickerButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAElC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAe,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AAoBtE;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,WAAW;IAClG,mBAAmB;IACnB,YAAY,EAAE,QAAQ,CAAC;IACvB,uBAAuB;IACvB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,qDAAqD;IACrD,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACtD,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wBAAwB;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAyFD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,GAAG,CAAC,OAAO,GAAG,IAAkC,CAAC"}
|
|
@@ -1,83 +1,84 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
/** @packageDocumentation
|
|
6
|
-
* @module Color
|
|
7
|
-
*/
|
|
8
|
-
import "./ColorPickerButton.scss";
|
|
9
|
-
import classnames from "classnames";
|
|
10
|
-
import * as React from "react";
|
|
11
|
-
import { ColorByName, ColorDef } from "@itwin/core-common";
|
|
12
|
-
import { RelativePosition } from "@itwin/appui-abstract";
|
|
13
|
-
import { Popup, useRefs
|
|
14
|
-
import { ColorSwatch } from "./Swatch";
|
|
15
|
-
import { getCSSColorFromDef } from "./getCSSColorFromDef";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
ColorDef.create(ColorByName.
|
|
36
|
-
ColorDef.create(ColorByName.
|
|
37
|
-
ColorDef.create(ColorByName.
|
|
38
|
-
ColorDef.create(ColorByName.
|
|
39
|
-
ColorDef.create(ColorByName.
|
|
40
|
-
ColorDef.create(ColorByName.
|
|
41
|
-
ColorDef.create(ColorByName.
|
|
42
|
-
ColorDef.create(ColorByName.
|
|
43
|
-
ColorDef.create(ColorByName.
|
|
44
|
-
ColorDef.create(ColorByName.
|
|
45
|
-
ColorDef.create(ColorByName.
|
|
46
|
-
ColorDef.create(ColorByName.
|
|
47
|
-
ColorDef.create(ColorByName.
|
|
48
|
-
ColorDef.create(ColorByName.
|
|
49
|
-
ColorDef.create(ColorByName.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
* @
|
|
81
|
-
|
|
82
|
-
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Color
|
|
7
|
+
*/
|
|
8
|
+
import "./ColorPickerButton.scss";
|
|
9
|
+
import classnames from "classnames";
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { ColorByName, ColorDef } from "@itwin/core-common";
|
|
12
|
+
import { RelativePosition } from "@itwin/appui-abstract";
|
|
13
|
+
import { Icon, Popup, useRefs } from "@itwin/core-react";
|
|
14
|
+
import { ColorSwatch } from "./Swatch";
|
|
15
|
+
import { getCSSColorFromDef } from "./getCSSColorFromDef";
|
|
16
|
+
import { SvgCaretDownSmall, SvgCaretUpSmall } from "@itwin/itwinui-icons-react";
|
|
17
|
+
// cSpell:ignore colorpicker
|
|
18
|
+
function ColorOptions({ handleColorPicked, options, numColumns, round, title }) {
|
|
19
|
+
const containerStyle = { gridTemplateColumns: `repeat(${numColumns}, 1fr)` };
|
|
20
|
+
return (React.createElement("div", { className: "components-colorpicker-popup-container" },
|
|
21
|
+
title && React.createElement("h4", null, title),
|
|
22
|
+
React.createElement("div", { "data-testid": "components-colorpicker-popup-colors", className: "components-colorpicker-popup-colors", style: containerStyle }, options.map((color, index) => React.createElement(ColorSwatch, { className: "components-colorpicker-swatch", key: index, colorDef: color, onColorPick: handleColorPicked, round: round })))));
|
|
23
|
+
}
|
|
24
|
+
// Defined using following pattern (const ColorPickerButton at bottom) to ensure useful API documentation is extracted
|
|
25
|
+
const ForwardRefColorPickerButton = React.forwardRef(function ForwardRefColorPickerButton({ className, colorDefs, disabled, dropDownTitle, initialColor, numColumns, onColorPick, readonly, round, showCaret, style }, ref) {
|
|
26
|
+
const target = React.useRef(null);
|
|
27
|
+
const refs = useRefs(target, ref); // combine ref needed for target with the forwardRef needed by the Parent when parent is a Type Editor.
|
|
28
|
+
const [showPopup, setShowPopup] = React.useState(false);
|
|
29
|
+
const [colorDef, setColorDef] = React.useState(initialColor);
|
|
30
|
+
// See if new initialColor props have changed since component mounted
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
setColorDef(initialColor);
|
|
33
|
+
}, [initialColor]);
|
|
34
|
+
const defaultColors = React.useRef([
|
|
35
|
+
ColorDef.create(ColorByName.red),
|
|
36
|
+
ColorDef.create(ColorByName.orange),
|
|
37
|
+
ColorDef.create(ColorByName.yellow),
|
|
38
|
+
ColorDef.create(ColorByName.green),
|
|
39
|
+
ColorDef.create(ColorByName.blue),
|
|
40
|
+
ColorDef.create(ColorByName.indigo),
|
|
41
|
+
ColorDef.create(ColorByName.violet),
|
|
42
|
+
ColorDef.create(ColorByName.black),
|
|
43
|
+
ColorDef.create(ColorByName.white),
|
|
44
|
+
ColorDef.create(ColorByName.cyan),
|
|
45
|
+
ColorDef.create(ColorByName.fuchsia),
|
|
46
|
+
ColorDef.create(ColorByName.tan),
|
|
47
|
+
ColorDef.create(ColorByName.gray),
|
|
48
|
+
ColorDef.create(ColorByName.brown),
|
|
49
|
+
ColorDef.create(ColorByName.purple),
|
|
50
|
+
ColorDef.create(ColorByName.olive),
|
|
51
|
+
]);
|
|
52
|
+
const closePopup = React.useCallback(() => {
|
|
53
|
+
setShowPopup(false);
|
|
54
|
+
}, []);
|
|
55
|
+
const togglePopup = React.useCallback(() => {
|
|
56
|
+
setShowPopup(!showPopup);
|
|
57
|
+
}, [showPopup]);
|
|
58
|
+
const handleColorPicked = React.useCallback((color) => {
|
|
59
|
+
closePopup();
|
|
60
|
+
// istanbul ignore else
|
|
61
|
+
if (!color.equals(colorDef)) {
|
|
62
|
+
setColorDef(color);
|
|
63
|
+
onColorPick && onColorPick(color);
|
|
64
|
+
}
|
|
65
|
+
}, [closePopup, colorDef, onColorPick]);
|
|
66
|
+
const rgbaString = getCSSColorFromDef(colorDef);
|
|
67
|
+
const buttonStyle = { ...style };
|
|
68
|
+
const swatchStyle = { backgroundColor: rgbaString };
|
|
69
|
+
const buttonClassNames = classnames("components-colorpicker-button", round && "round", readonly && "readonly", className);
|
|
70
|
+
const colorOptions = colorDefs && colorDefs.length ? colorDefs : defaultColors.current;
|
|
71
|
+
return (React.createElement(React.Fragment, null,
|
|
72
|
+
React.createElement("button", { "data-testid": "components-colorpicker-button", "data-value": rgbaString, onClick: togglePopup, className: buttonClassNames, style: buttonStyle, disabled: disabled, ref: refs },
|
|
73
|
+
React.createElement("div", { className: "components-colorpicker-button-container" },
|
|
74
|
+
React.createElement("div", { className: "components-colorpicker-button-color-swatch", style: swatchStyle, "data-testid": showPopup ? "caret-up" : "caret-down" }),
|
|
75
|
+
showCaret && React.createElement(Icon, { className: "components-caret", iconSpec: showPopup ? React.createElement(SvgCaretUpSmall, null) : React.createElement(SvgCaretDownSmall, null) }))),
|
|
76
|
+
React.createElement(Popup, { className: "components-colorpicker-popup", isOpen: showPopup, position: RelativePosition.BottomLeft, onClose: closePopup, target: target.current, closeOnNestedPopupOutsideClick: true },
|
|
77
|
+
React.createElement(ColorOptions, { handleColorPicked: handleColorPicked, options: colorOptions, numColumns: numColumns ?? 4, round: !!round, title: dropDownTitle }))));
|
|
78
|
+
});
|
|
79
|
+
/** ColorPickerButton component
|
|
80
|
+
* @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.
|
|
81
|
+
* @beta
|
|
82
|
+
*/
|
|
83
|
+
export const ColorPickerButton = ForwardRefColorPickerButton;
|
|
83
84
|
//# sourceMappingURL=ColorPickerButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerButton.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/ColorPickerButton.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAe,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,4BAA4B;AAE5B,SAAS,YAAY,CAAC,EAAE,iBAAiB,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAA+H;IACzM,MAAM,cAAc,GAAwB,EAAE,mBAAmB,EAAE,UAAU,UAAU,QAAQ,EAAE,CAAC;IAClG,OAAO,CACL,6BAAK,SAAS,EAAC,wCAAwC;QACpD,KAAK,IAAI,gCAAK,KAAK,CAAM;QAC1B,4CAAiB,qCAAqC,EAAC,SAAS,EAAC,qCAAqC,EAAC,KAAK,EAAE,cAAc,IACzH,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,oBAAC,WAAW,IAAC,SAAS,EAAC,+BAA+B,EAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAC/G,WAAW,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,GAAI,CAAC,CAC/C,CACF,CACP,CAAC;AACJ,CAAC;AA4BD,sHAAsH;AACtH,MAAM,2BAA2B,GAAG,KAAK,CAAC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ACjE,KAAK,IAAI,OAAO,EAChB,QAAQ,IAAI,UAAU,EACtB,SAAS,CACV,CAAC;IAEF,MAAM,YAAY,GAAG,SAAS,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC;IACvF,OAAO,CACL;QACE,+CAAoB,+BAA+B,gBAAa,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAC3H,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI;YACjD,6BAAK,SAAS,EAAC,yCAAyC;gBACtD,6BAAK,SAAS,EAAC,4CAA4C,EAAC,KAAK,EAAE,WAAW,GAAI;gBACjF,SAAS,IAAI,oBAAC,WAAW,IAAC,SAAS,EAAC,kBAAkB,EAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,iBAAiB,EAAE,QAAQ,EAAC,SAAS,GAAG,CACpI,CACC;QACT,oBAAC,KAAK,IACJ,SAAS,EAAC,8BAA8B,EACxC,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,gBAAgB,CAAC,UAAU,EACrC,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,CAAC,OAAO,EACtB,8BAA8B;YAE9B,oBAAC,YAAY,IAAC,iBAAiB,EAAE,iBAAiB,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,GAAI,CAC1I,CACP,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAoD,2BAA2B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Color\r\n */\r\n\r\nimport \"./ColorPickerButton.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { ColorByName, ColorDef } from \"@itwin/core-common\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { CommonProps, Popup, useRefs, WebFontIcon } from \"@itwin/core-react\";\r\nimport { ColorSwatch } from \"./Swatch\";\r\nimport { getCSSColorFromDef } from \"./getCSSColorFromDef\";\r\n\r\n// cSpell:ignore colorpicker\r\n\r\nfunction ColorOptions({ handleColorPicked, options, numColumns, round, title }: { handleColorPicked: ((color: ColorDef) => void), options: ColorDef[], numColumns: number, round: boolean, title?: string }) {\r\n const containerStyle: React.CSSProperties = { gridTemplateColumns: `repeat(${numColumns}, 1fr)` };\r\n return (\r\n <div className=\"components-colorpicker-popup-container\">\r\n {title && <h4>{title}</h4>}\r\n <div data-testid=\"components-colorpicker-popup-colors\" className=\"components-colorpicker-popup-colors\" style={containerStyle}>\r\n {options.map((color, index) => <ColorSwatch className=\"components-colorpicker-swatch\" key={index} colorDef={color}\r\n onColorPick={handleColorPicked} round={round} />)}\r\n </div>\r\n </div>\r\n );\r\n}\r\n\r\n/** Properties for the [[ColorPickerButton]] React component\r\n * @beta\r\n */\r\nexport interface ColorPickerProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {\r\n /** Active color */\r\n initialColor: ColorDef;\r\n /** Available colors */\r\n colorDefs?: ColorDef[];\r\n /** Function to run when user selects color swatch */\r\n onColorPick?: ((color: ColorDef) => void) | undefined;\r\n /** Show swatches as squares unless round is set to true */\r\n round?: boolean;\r\n /** Disabled or not */\r\n disabled?: boolean;\r\n /** Readonly or not */\r\n readonly?: boolean;\r\n /** Title to show at top of DropDown */\r\n dropDownTitle?: string;\r\n /** Number of columns */\r\n numColumns?: number;\r\n /** Provides ability to return reference to HTMLButtonElement */\r\n ref?: React.Ref<HTMLButtonElement>;\r\n /** If true show up/down caret next to color */\r\n showCaret?: boolean;\r\n}\r\n\r\n// Defined using following pattern (const ColorPickerButton at bottom) to ensure useful API documentation is extracted\r\nconst ForwardRefColorPickerButton = React.forwardRef<HTMLButtonElement, ColorPickerProps>(\r\n function ForwardRefColorPickerButton({ className, colorDefs, disabled, dropDownTitle, initialColor, numColumns, onColorPick, readonly, round, showCaret, style }, ref) {\r\n const target = React.useRef<HTMLButtonElement>(null);\r\n const refs = useRefs(target, ref); // combine ref needed for target with the forwardRef needed by the Parent when parent is a Type Editor.\r\n const [showPopup, setShowPopup] = React.useState(false);\r\n const [colorDef, setColorDef] = React.useState(initialColor);\r\n\r\n // See if new initialColor props have changed since component mounted\r\n React.useEffect(() => {\r\n setColorDef(initialColor);\r\n }, [initialColor]);\r\n\r\n const defaultColors = React.useRef(\r\n [\r\n ColorDef.create(ColorByName.red),\r\n ColorDef.create(ColorByName.orange),\r\n ColorDef.create(ColorByName.yellow),\r\n ColorDef.create(ColorByName.green),\r\n ColorDef.create(ColorByName.blue),\r\n ColorDef.create(ColorByName.indigo),\r\n ColorDef.create(ColorByName.violet),\r\n ColorDef.create(ColorByName.black),\r\n ColorDef.create(ColorByName.white),\r\n ColorDef.create(ColorByName.cyan),\r\n ColorDef.create(ColorByName.fuchsia),\r\n ColorDef.create(ColorByName.tan),\r\n ColorDef.create(ColorByName.gray),\r\n ColorDef.create(ColorByName.brown),\r\n ColorDef.create(ColorByName.purple),\r\n ColorDef.create(ColorByName.olive),\r\n ]);\r\n\r\n const closePopup = React.useCallback(() => {\r\n setShowPopup(false);\r\n }, []);\r\n\r\n const togglePopup = React.useCallback(() => {\r\n setShowPopup(!showPopup);\r\n }, [showPopup]);\r\n\r\n const handleColorPicked = React.useCallback((color: ColorDef) => {\r\n closePopup();\r\n\r\n // istanbul ignore else\r\n if (!color.equals(colorDef)) {\r\n setColorDef(color);\r\n onColorPick && onColorPick(color);\r\n }\r\n }, [closePopup, colorDef, onColorPick]);\r\n\r\n const rgbaString = getCSSColorFromDef(colorDef);\r\n\r\n const buttonStyle = { ...style } as React.CSSProperties;\r\n const swatchStyle = { backgroundColor: rgbaString } as React.CSSProperties;\r\n\r\n const buttonClassNames = classnames(\"components-colorpicker-button\",\r\n round && \"round\",\r\n readonly && \"readonly\",\r\n className,\r\n );\r\n\r\n const colorOptions = colorDefs && colorDefs.length ? colorDefs : defaultColors.current;\r\n return (\r\n <>\r\n <button data-testid=\"components-colorpicker-button\" data-value={rgbaString} onClick={togglePopup} className={buttonClassNames}\r\n style={buttonStyle} disabled={disabled} ref={refs} >\r\n <div className=\"components-colorpicker-button-container\">\r\n <div className=\"components-colorpicker-button-color-swatch\" style={swatchStyle} />\r\n {showCaret && <WebFontIcon className=\"components-caret\" iconName={showPopup ? \"icon-caret-up\" : \"icon-caret-down\"} iconSize=\"x-small\" />}\r\n </div>\r\n </button>\r\n <Popup\r\n className=\"components-colorpicker-popup\"\r\n isOpen={showPopup}\r\n position={RelativePosition.BottomLeft}\r\n onClose={closePopup}\r\n target={target.current}\r\n closeOnNestedPopupOutsideClick\r\n >\r\n <ColorOptions handleColorPicked={handleColorPicked} options={colorOptions} numColumns={numColumns ?? 4} round={!!round} title={dropDownTitle} />\r\n </Popup>\r\n </>\r\n );\r\n }\r\n);\r\n\r\n/** ColorPickerButton component\r\n * @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.\r\n * @beta\r\n */\r\nexport const ColorPickerButton: (props: ColorPickerProps) => JSX.Element | null = ForwardRefColorPickerButton;\r\n\r\n"]}
|
|
1
|
+
{"version":3,"file":"ColorPickerButton.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/ColorPickerButton.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAA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UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAC3H,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI;YACjD,6BAAK,SAAS,EAAC,yCAAyC;gBACtD,6BAAK,SAAS,EAAC,4CAA4C,EAAC,KAAK,EAAE,WAAW,iBAAe,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,GAAI;gBACrI,SAAS,IAAI,oBAAC,IAAI,IAAC,SAAS,EAAC,kBAAkB,EAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,oBAAC,eAAe,OAAG,CAAC,CAAC,CAAC,oBAAC,iBAAiB,OAAG,GAAK,CACnH,CACC;QACT,oBAAC,KAAK,IACJ,SAAS,EAAC,8BAA8B,EACxC,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,gBAAgB,CAAC,UAAU,EACrC,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,CAAC,OAAO,EACtB,8BAA8B;YAE9B,oBAAC,YAAY,IAAC,iBAAiB,EAAE,iBAAiB,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,GAAI,CAC1I,CACP,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAoD,2BAA2B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Color\n */\n\nimport \"./ColorPickerButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { ColorByName, ColorDef } from \"@itwin/core-common\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport { CommonProps, Icon, Popup, useRefs } from \"@itwin/core-react\";\nimport { ColorSwatch } from \"./Swatch\";\nimport { getCSSColorFromDef } from \"./getCSSColorFromDef\";\nimport { SvgCaretDownSmall, SvgCaretUpSmall } from \"@itwin/itwinui-icons-react\";\n\n// cSpell:ignore colorpicker\n\nfunction ColorOptions({ handleColorPicked, options, numColumns, round, title }: { handleColorPicked: ((color: ColorDef) => void), options: ColorDef[], numColumns: number, round: boolean, title?: string }) {\n const containerStyle: React.CSSProperties = { gridTemplateColumns: `repeat(${numColumns}, 1fr)` };\n return (\n <div className=\"components-colorpicker-popup-container\">\n {title && <h4>{title}</h4>}\n <div data-testid=\"components-colorpicker-popup-colors\" className=\"components-colorpicker-popup-colors\" style={containerStyle}>\n {options.map((color, index) => <ColorSwatch className=\"components-colorpicker-swatch\" key={index} colorDef={color}\n onColorPick={handleColorPicked} round={round} />)}\n </div>\n </div>\n );\n}\n\n/** Properties for the [[ColorPickerButton]] React component\n * @beta\n */\nexport interface ColorPickerProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {\n /** Active color */\n initialColor: ColorDef;\n /** Available colors */\n colorDefs?: ColorDef[];\n /** Function to run when user selects color swatch */\n onColorPick?: ((color: ColorDef) => void) | undefined;\n /** Show swatches as squares unless round is set to true */\n round?: boolean;\n /** Disabled or not */\n disabled?: boolean;\n /** Readonly or not */\n readonly?: boolean;\n /** Title to show at top of DropDown */\n dropDownTitle?: string;\n /** Number of columns */\n numColumns?: number;\n /** Provides ability to return reference to HTMLButtonElement */\n ref?: React.Ref<HTMLButtonElement>;\n /** If true show up/down caret next to color */\n showCaret?: boolean;\n}\n\n// Defined using following pattern (const ColorPickerButton at bottom) to ensure useful API documentation is extracted\nconst ForwardRefColorPickerButton = React.forwardRef<HTMLButtonElement, ColorPickerProps>(\n function ForwardRefColorPickerButton({ className, colorDefs, disabled, dropDownTitle, initialColor, numColumns, onColorPick, readonly, round, showCaret, style }, ref) {\n const target = React.useRef<HTMLButtonElement>(null);\n const refs = useRefs(target, ref); // combine ref needed for target with the forwardRef needed by the Parent when parent is a Type Editor.\n const [showPopup, setShowPopup] = React.useState(false);\n const [colorDef, setColorDef] = React.useState(initialColor);\n\n // See if new initialColor props have changed since component mounted\n React.useEffect(() => {\n setColorDef(initialColor);\n }, [initialColor]);\n\n const defaultColors = React.useRef(\n [\n ColorDef.create(ColorByName.red),\n ColorDef.create(ColorByName.orange),\n ColorDef.create(ColorByName.yellow),\n ColorDef.create(ColorByName.green),\n ColorDef.create(ColorByName.blue),\n ColorDef.create(ColorByName.indigo),\n ColorDef.create(ColorByName.violet),\n ColorDef.create(ColorByName.black),\n ColorDef.create(ColorByName.white),\n ColorDef.create(ColorByName.cyan),\n ColorDef.create(ColorByName.fuchsia),\n ColorDef.create(ColorByName.tan),\n ColorDef.create(ColorByName.gray),\n ColorDef.create(ColorByName.brown),\n ColorDef.create(ColorByName.purple),\n ColorDef.create(ColorByName.olive),\n ]);\n\n const closePopup = React.useCallback(() => {\n setShowPopup(false);\n }, []);\n\n const togglePopup = React.useCallback(() => {\n setShowPopup(!showPopup);\n }, [showPopup]);\n\n const handleColorPicked = React.useCallback((color: ColorDef) => {\n closePopup();\n\n // istanbul ignore else\n if (!color.equals(colorDef)) {\n setColorDef(color);\n onColorPick && onColorPick(color);\n }\n }, [closePopup, colorDef, onColorPick]);\n\n const rgbaString = getCSSColorFromDef(colorDef);\n\n const buttonStyle = { ...style } as React.CSSProperties;\n const swatchStyle = { backgroundColor: rgbaString } as React.CSSProperties;\n\n const buttonClassNames = classnames(\"components-colorpicker-button\",\n round && \"round\",\n readonly && \"readonly\",\n className,\n );\n\n const colorOptions = colorDefs && colorDefs.length ? colorDefs : defaultColors.current;\n return (\n <>\n <button data-testid=\"components-colorpicker-button\" data-value={rgbaString} onClick={togglePopup} className={buttonClassNames}\n style={buttonStyle} disabled={disabled} ref={refs} >\n <div className=\"components-colorpicker-button-container\">\n <div className=\"components-colorpicker-button-color-swatch\" style={swatchStyle} data-testid={showPopup ? \"caret-up\" : \"caret-down\"} />\n {showCaret && <Icon className=\"components-caret\" iconSpec={showPopup ? <SvgCaretUpSmall /> : <SvgCaretDownSmall /> } />}\n </div>\n </button>\n <Popup\n className=\"components-colorpicker-popup\"\n isOpen={showPopup}\n position={RelativePosition.BottomLeft}\n onClose={closePopup}\n target={target.current}\n closeOnNestedPopupOutsideClick\n >\n <ColorOptions handleColorPicked={handleColorPicked} options={colorOptions} numColumns={numColumns ?? 4} round={!!round} title={dropDownTitle} />\n </Popup>\n </>\n );\n }\n);\n\n/** ColorPickerButton component\n * @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.\n * @beta\n */\nexport const ColorPickerButton: (props: ColorPickerProps) => JSX.Element | null = ForwardRefColorPickerButton;\n\n"]}
|