@salesforce/design-system-react 11.0.0-alpha.8 → 11.0.0-alpha.9
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/dist/cjs/components/accordion/index.cjs +1 -1
- package/dist/cjs/components/accordion/index.cjs.map +1 -1
- package/dist/cjs/components/alert/container.cjs +1 -1
- package/dist/cjs/components/alert/container.cjs.map +1 -1
- package/dist/cjs/components/avatar/index.cjs +1 -1
- package/dist/cjs/components/avatar/index.cjs.map +1 -1
- package/dist/cjs/components/button-stateful/check-props.cjs +2 -0
- package/dist/cjs/components/button-stateful/check-props.cjs.map +1 -0
- package/dist/cjs/components/button-stateful/component.cjs +2 -0
- package/dist/cjs/components/button-stateful/component.cjs.map +1 -0
- package/dist/cjs/components/button-stateful/index.cjs +1 -1
- package/dist/cjs/components/button-stateful/index.cjs.map +1 -1
- package/dist/cjs/components/carousel/index.cjs +1 -1
- package/dist/cjs/components/carousel/index.cjs.map +1 -1
- package/dist/cjs/components/checkbox/check-props.cjs +1 -1
- package/dist/cjs/components/checkbox/check-props.cjs.map +1 -1
- package/dist/cjs/components/checkbox/index.cjs +1 -1
- package/dist/cjs/components/checkbox/index.cjs.map +1 -1
- package/dist/cjs/components/color-picker/check-props.cjs +1 -1
- package/dist/cjs/components/color-picker/check-props.cjs.map +1 -1
- package/dist/cjs/components/color-picker/color-picker.cjs +1 -1
- package/dist/cjs/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/cjs/components/color-picker/private/color-picker-tabs.cjs +2 -0
- package/dist/cjs/components/color-picker/private/color-picker-tabs.cjs.map +1 -0
- package/dist/cjs/components/color-picker/private/hsv-color.cjs +1 -1
- package/dist/cjs/components/color-picker/private/hsv-color.cjs.map +1 -1
- package/dist/cjs/components/combobox/check-props.cjs +1 -1
- package/dist/cjs/components/combobox/check-props.cjs.map +1 -1
- package/dist/cjs/components/combobox/combobox.cjs +1 -1
- package/dist/cjs/components/combobox/combobox.cjs.map +1 -1
- package/dist/cjs/components/combobox/index.cjs +1 -1
- package/dist/cjs/components/date-picker/check-props.cjs +1 -1
- package/dist/cjs/components/date-picker/check-props.cjs.map +1 -1
- package/dist/cjs/components/date-picker/date-picker.cjs +1 -1
- package/dist/cjs/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/cjs/components/date-picker/index.cjs.map +1 -1
- package/dist/cjs/components/date-picker/private/calendar-wrapper.cjs.map +1 -1
- package/dist/cjs/components/expandable-section/index.cjs +1 -1
- package/dist/cjs/components/expandable-section/index.cjs.map +1 -1
- package/dist/cjs/components/icon/input-icon/index.cjs +1 -1
- package/dist/cjs/components/icon/input-icon/index.cjs.map +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/input/check-props.cjs +1 -1
- package/dist/cjs/components/input/check-props.cjs.map +1 -1
- package/dist/cjs/components/input/index.cjs +1 -1
- package/dist/cjs/components/input/index.cjs.map +1 -1
- package/dist/cjs/components/input/private/inner-input.cjs +1 -1
- package/dist/cjs/components/input/private/inner-input.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/button-trigger.cjs +1 -1
- package/dist/cjs/components/menu-dropdown/button-trigger.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/index.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs +1 -1
- package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs.map +1 -1
- package/dist/cjs/components/modal/index.cjs +1 -1
- package/dist/cjs/components/modal/index.cjs.map +1 -1
- package/dist/cjs/components/popover/index.cjs.map +1 -1
- package/dist/cjs/components/popover/popover.cjs +1 -1
- package/dist/cjs/components/popover/popover.cjs.map +1 -1
- package/dist/cjs/components/radio/check-props.cjs +1 -1
- package/dist/cjs/components/radio/check-props.cjs.map +1 -1
- package/dist/cjs/components/radio/index.cjs +1 -1
- package/dist/cjs/components/radio/index.cjs.map +1 -1
- package/dist/cjs/components/radio-button-group/index.cjs.map +1 -1
- package/dist/cjs/components/radio-button-group/radio.cjs.map +1 -1
- package/dist/cjs/components/radio-group/check-props.cjs +2 -0
- package/dist/cjs/components/radio-group/check-props.cjs.map +1 -0
- package/dist/cjs/components/radio-group/component.cjs +2 -0
- package/dist/cjs/components/radio-group/component.cjs.map +1 -0
- package/dist/cjs/components/radio-group/index.cjs +1 -1
- package/dist/cjs/components/radio-group/index.cjs.map +1 -1
- package/dist/cjs/components/setup-assistant/step.cjs +1 -1
- package/dist/cjs/components/setup-assistant/step.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/check-props.cjs +1 -1
- package/dist/cjs/components/simple-data-table/check-props.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/column.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/index.cjs +1 -1
- package/dist/cjs/components/simple-data-table/index.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/head.cjs +1 -1
- package/dist/cjs/components/simple-data-table/private/head.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/header-cell.cjs +1 -1
- package/dist/cjs/components/simple-data-table/private/header-cell.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/row.cjs +1 -1
- package/dist/cjs/components/simple-data-table/private/row.cjs.map +1 -1
- package/dist/cjs/components/slider/check-props.cjs +1 -1
- package/dist/cjs/components/slider/check-props.cjs.map +1 -1
- package/dist/cjs/components/slider/index.cjs +1 -1
- package/dist/cjs/components/slider/index.cjs.map +1 -1
- package/dist/cjs/components/split-view/index.cjs +1 -1
- package/dist/cjs/components/split-view/index.cjs.map +1 -1
- package/dist/cjs/components/split-view/listbox-check-props.cjs +1 -1
- package/dist/cjs/components/split-view/listbox-check-props.cjs.map +1 -1
- package/dist/cjs/components/split-view/listbox.cjs +1 -1
- package/dist/cjs/components/split-view/listbox.cjs.map +1 -1
- package/dist/cjs/components/tabs/check-props.cjs +2 -0
- package/dist/cjs/components/tabs/check-props.cjs.map +1 -0
- package/dist/cjs/components/tabs/component.cjs +2 -0
- package/dist/cjs/components/tabs/component.cjs.map +1 -0
- package/dist/cjs/components/tabs/index.cjs +1 -1
- package/dist/cjs/components/tabs/index.cjs.map +1 -1
- package/dist/cjs/components/tabs/panel.cjs.map +1 -1
- package/dist/cjs/components/textarea/check-props.cjs +1 -1
- package/dist/cjs/components/textarea/check-props.cjs.map +1 -1
- package/dist/cjs/components/textarea/index.cjs +1 -1
- package/dist/cjs/components/textarea/index.cjs.map +1 -1
- package/dist/cjs/components/toast/container.cjs +1 -1
- package/dist/cjs/components/toast/container.cjs.map +1 -1
- package/dist/cjs/components/tooltip/index.cjs +2 -2
- package/dist/cjs/components/tooltip/index.cjs.map +1 -1
- package/dist/cjs/components/tree/check-props.cjs +1 -1
- package/dist/cjs/components/tree/check-props.cjs.map +1 -1
- package/dist/cjs/components/tree/private/branch.cjs +1 -1
- package/dist/cjs/components/tree/private/branch.cjs.map +1 -1
- package/dist/cjs/components/tree/private/item.cjs +1 -1
- package/dist/cjs/components/tree/private/item.cjs.map +1 -1
- package/dist/cjs/components/tree/private/render-branch.cjs +1 -1
- package/dist/cjs/components/tree/private/render-branch.cjs.map +1 -1
- package/dist/cjs/components/tree/tree.cjs +1 -1
- package/dist/cjs/components/tree/tree.cjs.map +1 -1
- package/dist/cjs/components/vertical-navigation/check-props.cjs +2 -0
- package/dist/cjs/components/vertical-navigation/check-props.cjs.map +1 -0
- package/dist/cjs/components/vertical-navigation/component.cjs +2 -0
- package/dist/cjs/components/vertical-navigation/component.cjs.map +1 -0
- package/dist/cjs/components/vertical-navigation/index.cjs +1 -1
- package/dist/cjs/components/vertical-navigation/index.cjs.map +1 -1
- package/dist/cjs/components/welcome-mat/info-badge.cjs +1 -1
- package/dist/cjs/components/welcome-mat/info-badge.cjs.map +1 -1
- package/dist/cjs/utilities/hooks/index.cjs +1 -1
- package/dist/cjs/utilities/hooks/use-controllable-state.cjs +2 -0
- package/dist/cjs/utilities/hooks/use-controllable-state.cjs.map +1 -0
- package/dist/cjs/utilities/warning/required-property.cjs +2 -0
- package/dist/cjs/utilities/warning/required-property.cjs.map +1 -0
- package/dist/es/components/accordion/index.js +10 -8
- package/dist/es/components/accordion/index.js.map +1 -1
- package/dist/es/components/alert/container.js +1 -1
- package/dist/es/components/alert/container.js.map +1 -1
- package/dist/es/components/avatar/index.js +2 -1
- package/dist/es/components/avatar/index.js.map +1 -1
- package/dist/es/components/button-stateful/check-props.js +14 -0
- package/dist/es/components/button-stateful/check-props.js.map +1 -0
- package/dist/es/components/button-stateful/component.js +20 -0
- package/dist/es/components/button-stateful/component.js.map +1 -0
- package/dist/es/components/button-stateful/index.js +102 -94
- package/dist/es/components/button-stateful/index.js.map +1 -1
- package/dist/es/components/carousel/index.js +112 -130
- package/dist/es/components/carousel/index.js.map +1 -1
- package/dist/es/components/checkbox/check-props.js +14 -8
- package/dist/es/components/checkbox/check-props.js.map +1 -1
- package/dist/es/components/checkbox/index.js +40 -33
- package/dist/es/components/checkbox/index.js.map +1 -1
- package/dist/es/components/color-picker/check-props.js +16 -11
- package/dist/es/components/color-picker/check-props.js.map +1 -1
- package/dist/es/components/color-picker/color-picker.js +185 -169
- package/dist/es/components/color-picker/color-picker.js.map +1 -1
- package/dist/es/components/color-picker/private/color-picker-tabs.js +17 -0
- package/dist/es/components/color-picker/private/color-picker-tabs.js.map +1 -0
- package/dist/es/components/color-picker/private/hsv-color.js +1 -0
- package/dist/es/components/color-picker/private/hsv-color.js.map +1 -1
- package/dist/es/components/combobox/check-props.js +15 -14
- package/dist/es/components/combobox/check-props.js.map +1 -1
- package/dist/es/components/combobox/combobox.js +399 -399
- package/dist/es/components/combobox/combobox.js.map +1 -1
- package/dist/es/components/combobox/index.js +4 -4
- package/dist/es/components/date-picker/check-props.js +15 -9
- package/dist/es/components/date-picker/check-props.js.map +1 -1
- package/dist/es/components/date-picker/date-picker.js +144 -138
- package/dist/es/components/date-picker/date-picker.js.map +1 -1
- package/dist/es/components/date-picker/index.js.map +1 -1
- package/dist/es/components/date-picker/private/calendar-wrapper.js.map +1 -1
- package/dist/es/components/expandable-section/index.js +32 -26
- package/dist/es/components/expandable-section/index.js.map +1 -1
- package/dist/es/components/icon/input-icon/index.js +7 -2
- package/dist/es/components/icon/input-icon/index.js.map +1 -1
- package/dist/es/components/index.js +3 -3
- package/dist/es/components/input/check-props.js +19 -17
- package/dist/es/components/input/check-props.js.map +1 -1
- package/dist/es/components/input/index.js +153 -156
- package/dist/es/components/input/index.js.map +1 -1
- package/dist/es/components/input/private/inner-input.js +18 -18
- package/dist/es/components/input/private/inner-input.js.map +1 -1
- package/dist/es/components/menu-dropdown/button-trigger.js +7 -1
- package/dist/es/components/menu-dropdown/button-trigger.js.map +1 -1
- package/dist/es/components/menu-dropdown/index.js.map +1 -1
- package/dist/es/components/menu-dropdown/menu-dropdown.js +294 -269
- package/dist/es/components/menu-dropdown/menu-dropdown.js.map +1 -1
- package/dist/es/components/modal/index.js +1 -1
- package/dist/es/components/modal/index.js.map +1 -1
- package/dist/es/components/popover/index.js.map +1 -1
- package/dist/es/components/popover/popover.js +209 -205
- package/dist/es/components/popover/popover.js.map +1 -1
- package/dist/es/components/radio/check-props.js +8 -8
- package/dist/es/components/radio/check-props.js.map +1 -1
- package/dist/es/components/radio/index.js +15 -13
- package/dist/es/components/radio/index.js.map +1 -1
- package/dist/es/components/radio-button-group/index.js.map +1 -1
- package/dist/es/components/radio-button-group/radio.js.map +1 -1
- package/dist/es/components/radio-group/check-props.js +14 -0
- package/dist/es/components/radio-group/check-props.js.map +1 -0
- package/dist/es/components/radio-group/component.js +21 -0
- package/dist/es/components/radio-group/component.js.map +1 -0
- package/dist/es/components/radio-group/index.js +62 -38
- package/dist/es/components/radio-group/index.js.map +1 -1
- package/dist/es/components/setup-assistant/step.js +5 -4
- package/dist/es/components/setup-assistant/step.js.map +1 -1
- package/dist/es/components/simple-data-table/check-props.js +7 -6
- package/dist/es/components/simple-data-table/check-props.js.map +1 -1
- package/dist/es/components/simple-data-table/column.js.map +1 -1
- package/dist/es/components/simple-data-table/index.js +67 -49
- package/dist/es/components/simple-data-table/index.js.map +1 -1
- package/dist/es/components/simple-data-table/private/head.js +1 -1
- package/dist/es/components/simple-data-table/private/head.js.map +1 -1
- package/dist/es/components/simple-data-table/private/header-cell.js +50 -52
- package/dist/es/components/simple-data-table/private/header-cell.js.map +1 -1
- package/dist/es/components/simple-data-table/private/row.js +43 -57
- package/dist/es/components/simple-data-table/private/row.js.map +1 -1
- package/dist/es/components/slider/check-props.js +14 -12
- package/dist/es/components/slider/check-props.js.map +1 -1
- package/dist/es/components/slider/index.js +54 -48
- package/dist/es/components/slider/index.js.map +1 -1
- package/dist/es/components/split-view/index.js +23 -22
- package/dist/es/components/split-view/index.js.map +1 -1
- package/dist/es/components/split-view/listbox-check-props.js +10 -2
- package/dist/es/components/split-view/listbox-check-props.js.map +1 -1
- package/dist/es/components/split-view/listbox.js +67 -50
- package/dist/es/components/split-view/listbox.js.map +1 -1
- package/dist/es/components/tabs/check-props.js +15 -0
- package/dist/es/components/tabs/check-props.js.map +1 -0
- package/dist/es/components/tabs/component.js +28 -0
- package/dist/es/components/tabs/component.js.map +1 -0
- package/dist/es/components/tabs/index.js +84 -69
- package/dist/es/components/tabs/index.js.map +1 -1
- package/dist/es/components/tabs/panel.js.map +1 -1
- package/dist/es/components/textarea/check-props.js +1 -1
- package/dist/es/components/textarea/check-props.js.map +1 -1
- package/dist/es/components/textarea/index.js +3 -2
- package/dist/es/components/textarea/index.js.map +1 -1
- package/dist/es/components/toast/container.js +1 -1
- package/dist/es/components/toast/container.js.map +1 -1
- package/dist/es/components/tooltip/index.js +120 -109
- package/dist/es/components/tooltip/index.js.map +1 -1
- package/dist/es/components/tree/check-props.js +14 -9
- package/dist/es/components/tree/check-props.js.map +1 -1
- package/dist/es/components/tree/private/branch.js +38 -35
- package/dist/es/components/tree/private/branch.js.map +1 -1
- package/dist/es/components/tree/private/item.js +6 -8
- package/dist/es/components/tree/private/item.js.map +1 -1
- package/dist/es/components/tree/private/render-branch.js +9 -10
- package/dist/es/components/tree/private/render-branch.js.map +1 -1
- package/dist/es/components/tree/tree.js +126 -97
- package/dist/es/components/tree/tree.js.map +1 -1
- package/dist/es/components/vertical-navigation/check-props.js +13 -0
- package/dist/es/components/vertical-navigation/check-props.js.map +1 -0
- package/dist/es/components/vertical-navigation/component.js +27 -0
- package/dist/es/components/vertical-navigation/component.js.map +1 -0
- package/dist/es/components/vertical-navigation/index.js +27 -26
- package/dist/es/components/vertical-navigation/index.js.map +1 -1
- package/dist/es/components/welcome-mat/info-badge.js +14 -4
- package/dist/es/components/welcome-mat/info-badge.js.map +1 -1
- package/dist/es/utilities/hooks/index.js +2 -1
- package/dist/es/utilities/hooks/use-controllable-state.js +20 -0
- package/dist/es/utilities/hooks/use-controllable-state.js.map +1 -0
- package/dist/es/utilities/warning/required-property.js +15 -0
- package/dist/es/utilities/warning/required-property.js.map +1 -0
- package/dist/types/components/accordion/index.d.ts.map +1 -1
- package/dist/types/components/avatar/index.d.ts.map +1 -1
- package/dist/types/components/button-stateful/check-props.d.ts +3 -0
- package/dist/types/components/button-stateful/check-props.d.ts.map +1 -0
- package/dist/types/components/button-stateful/index.d.ts +34 -6
- package/dist/types/components/button-stateful/index.d.ts.map +1 -1
- package/dist/types/components/carousel/index.d.ts +26 -7
- package/dist/types/components/carousel/index.d.ts.map +1 -1
- package/dist/types/components/checkbox/check-props.d.ts +1 -0
- package/dist/types/components/checkbox/check-props.d.ts.map +1 -1
- package/dist/types/components/checkbox/index.d.ts +38 -9
- package/dist/types/components/checkbox/index.d.ts.map +1 -1
- package/dist/types/components/color-picker/check-props.d.ts.map +1 -1
- package/dist/types/components/color-picker/color-picker.d.ts +50 -11
- package/dist/types/components/color-picker/color-picker.d.ts.map +1 -1
- package/dist/types/components/color-picker/index.d.ts +2 -2
- package/dist/types/components/color-picker/index.d.ts.map +1 -1
- package/dist/types/components/color-picker/private/color-picker-tabs.d.ts +14 -0
- package/dist/types/components/color-picker/private/color-picker-tabs.d.ts.map +1 -0
- package/dist/types/components/color-picker/private/hsv-color.d.ts.map +1 -1
- package/dist/types/components/color-picker/types.d.ts +9 -5
- package/dist/types/components/color-picker/types.d.ts.map +1 -1
- package/dist/types/components/combobox/check-props.d.ts.map +1 -1
- package/dist/types/components/combobox/combobox.d.ts +41 -6
- package/dist/types/components/combobox/combobox.d.ts.map +1 -1
- package/dist/types/components/date-picker/check-props.d.ts.map +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts +52 -17
- package/dist/types/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/types/components/date-picker/index.d.ts +1 -1
- package/dist/types/components/date-picker/index.d.ts.map +1 -1
- package/dist/types/components/date-picker/private/calendar-wrapper.d.ts +3 -1
- package/dist/types/components/date-picker/private/calendar-wrapper.d.ts.map +1 -1
- package/dist/types/components/expandable-section/index.d.ts +15 -3
- package/dist/types/components/expandable-section/index.d.ts.map +1 -1
- package/dist/types/components/icon/input-icon/index.d.ts.map +1 -1
- package/dist/types/components/input/check-props.d.ts.map +1 -1
- package/dist/types/components/input/index.d.ts +10 -4
- package/dist/types/components/input/index.d.ts.map +1 -1
- package/dist/types/components/input/private/inner-input.d.ts +2 -4
- package/dist/types/components/input/private/inner-input.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/button-trigger.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/index.d.ts +1 -1
- package/dist/types/components/menu-dropdown/index.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/menu-dropdown.d.ts +78 -15
- package/dist/types/components/menu-dropdown/menu-dropdown.d.ts.map +1 -1
- package/dist/types/components/popover/index.d.ts +1 -1
- package/dist/types/components/popover/index.d.ts.map +1 -1
- package/dist/types/components/popover/popover.d.ts +30 -3
- package/dist/types/components/popover/popover.d.ts.map +1 -1
- package/dist/types/components/radio/check-props.d.ts.map +1 -1
- package/dist/types/components/radio/index.d.ts +42 -9
- package/dist/types/components/radio/index.d.ts.map +1 -1
- package/dist/types/components/radio-button-group/index.d.ts +20 -10
- package/dist/types/components/radio-button-group/index.d.ts.map +1 -1
- package/dist/types/components/radio-button-group/radio.d.ts +7 -2
- package/dist/types/components/radio-button-group/radio.d.ts.map +1 -1
- package/dist/types/components/radio-group/check-props.d.ts +3 -0
- package/dist/types/components/radio-group/check-props.d.ts.map +1 -0
- package/dist/types/components/radio-group/index.d.ts +51 -8
- package/dist/types/components/radio-group/index.d.ts.map +1 -1
- package/dist/types/components/radio-group/radio.d.ts +7 -2
- package/dist/types/components/radio-group/radio.d.ts.map +1 -1
- package/dist/types/components/setup-assistant/step.d.ts +10 -2
- package/dist/types/components/setup-assistant/step.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/check-props.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/column.d.ts +4 -1
- package/dist/types/components/simple-data-table/column.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/index.d.ts +10 -2
- package/dist/types/components/simple-data-table/index.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/private/header-cell.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/private/row.d.ts +4 -2
- package/dist/types/components/simple-data-table/private/row.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/types.d.ts +40 -13
- package/dist/types/components/simple-data-table/types.d.ts.map +1 -1
- package/dist/types/components/slider/check-props.d.ts.map +1 -1
- package/dist/types/components/slider/index.d.ts +23 -10
- package/dist/types/components/slider/index.d.ts.map +1 -1
- package/dist/types/components/split-view/index.d.ts +12 -3
- package/dist/types/components/split-view/index.d.ts.map +1 -1
- package/dist/types/components/split-view/listbox-check-props.d.ts +1 -0
- package/dist/types/components/split-view/listbox-check-props.d.ts.map +1 -1
- package/dist/types/components/split-view/listbox.d.ts +41 -10
- package/dist/types/components/split-view/listbox.d.ts.map +1 -1
- package/dist/types/components/tabs/check-props.d.ts +3 -0
- package/dist/types/components/tabs/check-props.d.ts.map +1 -0
- package/dist/types/components/tabs/index.d.ts +46 -12
- package/dist/types/components/tabs/index.d.ts.map +1 -1
- package/dist/types/components/tabs/panel.d.ts +4 -0
- package/dist/types/components/tabs/panel.d.ts.map +1 -1
- package/dist/types/components/textarea/check-props.d.ts.map +1 -1
- package/dist/types/components/textarea/index.d.ts +14 -6
- package/dist/types/components/textarea/index.d.ts.map +1 -1
- package/dist/types/components/toast/container.d.ts +1 -1
- package/dist/types/components/tooltip/index.d.ts +49 -3
- package/dist/types/components/tooltip/index.d.ts.map +1 -1
- package/dist/types/components/tree/check-props.d.ts +1 -0
- package/dist/types/components/tree/check-props.d.ts.map +1 -1
- package/dist/types/components/tree/private/branch.d.ts +6 -1
- package/dist/types/components/tree/private/branch.d.ts.map +1 -1
- package/dist/types/components/tree/private/item.d.ts +3 -1
- package/dist/types/components/tree/private/item.d.ts.map +1 -1
- package/dist/types/components/tree/private/render-branch.d.ts +3 -1
- package/dist/types/components/tree/private/render-branch.d.ts.map +1 -1
- package/dist/types/components/tree/tree.d.ts +33 -6
- package/dist/types/components/tree/tree.d.ts.map +1 -1
- package/dist/types/components/tree/types.d.ts +23 -4
- package/dist/types/components/tree/types.d.ts.map +1 -1
- package/dist/types/components/vertical-navigation/check-props.d.ts +1 -0
- package/dist/types/components/vertical-navigation/check-props.d.ts.map +1 -1
- package/dist/types/components/vertical-navigation/index.d.ts +9 -4
- package/dist/types/components/vertical-navigation/index.d.ts.map +1 -1
- package/dist/types/components/welcome-mat/info-badge.d.ts.map +1 -1
- package/dist/types/types/components.d.ts +0 -2
- package/dist/types/types/components.d.ts.map +1 -1
- package/dist/types/utilities/hooks/index.d.ts +1 -0
- package/dist/types/utilities/hooks/index.d.ts.map +1 -1
- package/dist/types/utilities/hooks/use-controllable-state.d.ts +23 -0
- package/dist/types/utilities/hooks/use-controllable-state.d.ts.map +1 -0
- package/dist/types/utilities/warning/required-property.d.ts +3 -0
- package/dist/types/utilities/warning/required-property.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { COLOR_PICKER as e } from "../../utilities/constants.js";
|
|
2
|
-
import t from "../../utilities/
|
|
3
|
-
import n from "
|
|
4
|
-
import r from "../
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
2
|
+
import { useControllableState as t } from "../../utilities/hooks/use-controllable-state.js";
|
|
3
|
+
import n from "../../utilities/generate-id.js";
|
|
4
|
+
import r from "../button/index.js";
|
|
5
|
+
import ee from "../input/index.js";
|
|
6
|
+
import te from "./check-props.js";
|
|
7
|
+
import ne from "./private/swatch.js";
|
|
8
|
+
import i from "../../utilities/color.js";
|
|
9
|
+
import re from "./private/custom-color.js";
|
|
10
|
+
import ie from "./private/swatch-picker.js";
|
|
11
|
+
import a from "../tabs/panel.js";
|
|
12
|
+
import ae from "./private/color-picker-tabs.js";
|
|
13
|
+
import oe from "../popover/index.js";
|
|
14
|
+
import { useCallback as o, useEffect as se, useMemo as s, useRef as c, useState as l } from "react";
|
|
15
|
+
import u from "classnames";
|
|
16
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
16
17
|
//#region components/color-picker/color-picker.tsx
|
|
17
|
-
var
|
|
18
|
+
var ce = {
|
|
18
19
|
blueAbbreviated: "B",
|
|
19
20
|
cancelButton: "Cancel",
|
|
20
21
|
customTab: "Custom",
|
|
@@ -28,211 +29,226 @@ var h = {
|
|
|
28
29
|
submitButton: "Done",
|
|
29
30
|
swatchTab: "Default",
|
|
30
31
|
swatchTabTransparentSwatch: "Transparent Swatch"
|
|
31
|
-
},
|
|
32
|
+
}, le = {
|
|
32
33
|
saturationValueGrid: "Use arrow keys to select a saturation and brightness, on an x and y axis.",
|
|
33
34
|
hueSlider: "Select Hue"
|
|
34
|
-
},
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
}, ue = /* @__PURE__ */ "#e3abec.#c2dbf7.#9fd6ff.#9de7da.#9df0c0.#fff099.#fed49a.#d073e0.#86baf3.#5ebbff.#44d8be.#3be282.#ffe654.#ffb758.#bd35bd.#5779c1.#5679c0.#00aea9.#3cba4c.#f5bc25.#f99221.#580d8c.#001970.#0a2399.#0b7477.#0b6b50.#b67e11.#b85d0d.".split("."), p = (e, t) => {
|
|
36
|
+
let n = i.getHexFromNamedColor(e);
|
|
37
|
+
return i.getNewColor({
|
|
38
|
+
hex: n || e,
|
|
39
|
+
name: n ? e.toLowerCase() : null
|
|
40
|
+
}, t);
|
|
41
|
+
}, m = (e, t) => t ? !!t(e) : i.getHexFromNamedColor(e) ? !0 : i.isValidHex(e), h = ({ assistiveText: h, className: g, classNameMenu: _, id: v, defaultIsOpen: de = !1, disabled: y = !1, errorText: b, errorTextWorkingColor: x, events: S = {}, hasStaticAlignment: C, hideInput: w = !1, isOpen: T, labels: E, menuPosition: D = "absolute", swatchColors: O = ue, defaultSelectedTab: k = "swatches", variant: A = "base", value: j, valueWorking: M, onClose: fe, onOpen: pe, onRequestClose: N, onRequestOpen: P }) => {
|
|
42
|
+
let F = s(() => ({
|
|
43
|
+
...ce,
|
|
44
|
+
...E
|
|
45
|
+
}), [E]), I = s(() => ({
|
|
46
|
+
...le,
|
|
47
|
+
...h
|
|
48
|
+
}), [h]), me = c(v || n()), L = v || me.current, he = c(null), R = j ?? "", z = S.onValidateWorkingColor, [B, V] = t(T, de), [H, U] = l(() => p(R, z)), [ge, W] = l(H), [G, _e] = l({
|
|
49
|
+
value: R,
|
|
50
|
+
isOpen: B
|
|
51
|
+
});
|
|
52
|
+
if ((G.value !== R || G.isOpen !== B) && (_e({
|
|
53
|
+
value: R,
|
|
54
|
+
isOpen: B
|
|
55
|
+
}), G.value !== R || B)) {
|
|
56
|
+
let e = p(R, z);
|
|
57
|
+
U(e), W(e);
|
|
58
|
+
}
|
|
59
|
+
let K = s(() => M !== void 0 && H.hex !== M ? i.getNewColor({ hex: M }, z) : H, [
|
|
43
60
|
M,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
H,
|
|
62
|
+
z
|
|
63
|
+
]), ve = s(() => m(R, S.onValidateColor), [R, S.onValidateColor]), q = b || (ve ? "" : F.invalidColor || "");
|
|
64
|
+
se(() => {
|
|
65
|
+
te(e, {
|
|
66
|
+
assistiveText: h,
|
|
67
|
+
className: g,
|
|
68
|
+
classNameMenu: _,
|
|
69
|
+
id: v,
|
|
70
|
+
disabled: y,
|
|
71
|
+
errorText: b,
|
|
72
|
+
errorTextWorkingColor: x,
|
|
73
|
+
events: S,
|
|
74
|
+
hasStaticAlignment: C,
|
|
75
|
+
hideInput: w,
|
|
76
|
+
isOpen: T,
|
|
77
|
+
labels: E,
|
|
78
|
+
menuPosition: D,
|
|
79
|
+
swatchColors: O,
|
|
80
|
+
defaultSelectedTab: k,
|
|
81
|
+
variant: A,
|
|
82
|
+
value: j,
|
|
83
|
+
valueWorking: M
|
|
66
84
|
}, {});
|
|
67
|
-
}, [])
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}, [C, W]), fe = s((e) => {
|
|
85
|
+
}, []);
|
|
86
|
+
let J = o((e, t) => {
|
|
87
|
+
W(K), U(t), S.onWorkingColorChange && S.onWorkingColorChange(e, { color: t });
|
|
88
|
+
}, [S, K]), Y = o((e, t) => {
|
|
89
|
+
J(e, i.getNewColor(t, z, K));
|
|
90
|
+
}, [
|
|
91
|
+
J,
|
|
92
|
+
z,
|
|
93
|
+
K
|
|
94
|
+
]), ye = o((e) => {
|
|
78
95
|
Y(e, { hex: e.target.value });
|
|
79
|
-
}, [Y]), X =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}, [X, P]), me = s((e) => {
|
|
85
|
-
X(), P && P(e, { trigger: "cancel" });
|
|
86
|
-
}, [X, P]), Z = s((e) => (t, n) => {
|
|
96
|
+
}, [Y]), X = o((e, t) => {
|
|
97
|
+
V(!1), N && N(e, t);
|
|
98
|
+
}, [V, N]), Z = o((e) => {
|
|
99
|
+
X(e, { trigger: "cancel" });
|
|
100
|
+
}, [X]), Q = o((e) => (t, n) => {
|
|
87
101
|
let r = {};
|
|
88
102
|
r[e] = n.value, Y(t, r);
|
|
89
|
-
}, [Y]),
|
|
103
|
+
}, [Y]), be = o((e) => {
|
|
90
104
|
Y(e, { hue: e.target.value });
|
|
91
|
-
}, [Y]),
|
|
92
|
-
let n = t.value,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}, C.onValidateWorkingColor)), J(i ? "" : I.invalidColor || ""), C.onChange && C.onChange(e, {
|
|
97
|
-
color: n,
|
|
98
|
-
isValid: i
|
|
105
|
+
}, [Y]), xe = o((e, t) => {
|
|
106
|
+
let n = m(t.value, S.onValidateColor);
|
|
107
|
+
S.onChange && S.onChange(e, {
|
|
108
|
+
color: t.value,
|
|
109
|
+
isValid: n
|
|
99
110
|
});
|
|
100
|
-
}, [
|
|
111
|
+
}, [S]), $ = o((e) => (t, n) => {
|
|
101
112
|
let r = {};
|
|
102
|
-
r[e] = n.delta;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
113
|
+
r[e] = n.delta, J(t, i.getDeltaColor(r, z, K));
|
|
114
|
+
}, [
|
|
115
|
+
J,
|
|
116
|
+
z,
|
|
117
|
+
K
|
|
118
|
+
]), Se = o((e, t) => {
|
|
106
119
|
Y(e, {
|
|
107
120
|
saturation: t.saturation,
|
|
108
121
|
value: t.value
|
|
109
122
|
});
|
|
110
|
-
}, [Y]),
|
|
111
|
-
|
|
112
|
-
color:
|
|
123
|
+
}, [Y]), Ce = o((e) => {
|
|
124
|
+
S.onChange && S.onChange(e, {
|
|
125
|
+
color: K.hex,
|
|
113
126
|
isValid: !0
|
|
114
|
-
});
|
|
115
|
-
}, [
|
|
116
|
-
|
|
117
|
-
|
|
127
|
+
}), X(e, { trigger: "submit" });
|
|
128
|
+
}, [
|
|
129
|
+
S,
|
|
130
|
+
X,
|
|
131
|
+
K.hex
|
|
132
|
+
]), we = o(() => {
|
|
133
|
+
B || (V(!0), P && P());
|
|
118
134
|
}, [
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
]),
|
|
135
|
+
B,
|
|
136
|
+
V,
|
|
137
|
+
P
|
|
138
|
+
]), Te = o((e, t) => {
|
|
123
139
|
Y(e, { hex: t.hex });
|
|
124
|
-
}, [Y]),
|
|
125
|
-
"aria-describedby": !
|
|
126
|
-
className:
|
|
127
|
-
disabled:
|
|
128
|
-
id: `color-picker-summary-input-${
|
|
129
|
-
onChange:
|
|
130
|
-
value:
|
|
131
|
-
}),
|
|
132
|
-
id: `color-picker-tabs-${
|
|
133
|
-
|
|
134
|
-
children: [
|
|
135
|
-
label:
|
|
136
|
-
children: /* @__PURE__ */
|
|
137
|
-
color:
|
|
138
|
-
labels:
|
|
139
|
-
onSelect:
|
|
140
|
-
swatchColors:
|
|
140
|
+
}, [Y]), Ee = () => w ? null : /* @__PURE__ */ d(ee, {
|
|
141
|
+
"aria-describedby": !B && q ? `color-picker-summary-error-${L}` : void 0,
|
|
142
|
+
className: u("slds-color-picker__summary-input", "slds-align-top", { "slds-has-error": !!q }),
|
|
143
|
+
disabled: y,
|
|
144
|
+
id: `color-picker-summary-input-${L}`,
|
|
145
|
+
onChange: xe,
|
|
146
|
+
value: R
|
|
147
|
+
}), De = /* @__PURE__ */ f(ae, {
|
|
148
|
+
id: `color-picker-tabs-${L}`,
|
|
149
|
+
defaultValue: k === "custom" ? "1" : "0",
|
|
150
|
+
children: [A !== "base" && A !== "swatches" ? null : /* @__PURE__ */ d(a, {
|
|
151
|
+
label: F.swatchTab ?? "",
|
|
152
|
+
children: /* @__PURE__ */ d(ie, {
|
|
153
|
+
color: K,
|
|
154
|
+
labels: F,
|
|
155
|
+
onSelect: Te,
|
|
156
|
+
swatchColors: O
|
|
141
157
|
})
|
|
142
|
-
}),
|
|
143
|
-
label:
|
|
144
|
-
children: /* @__PURE__ */
|
|
145
|
-
assistiveText:
|
|
146
|
-
id:
|
|
147
|
-
color:
|
|
148
|
-
errorTextWorkingColor:
|
|
149
|
-
previousColor:
|
|
150
|
-
labels:
|
|
151
|
-
onBlueChange:
|
|
152
|
-
onGreenChange:
|
|
153
|
-
onHexChange:
|
|
154
|
-
onHueChange:
|
|
155
|
-
onRedChange:
|
|
156
|
-
onSwatchChange:
|
|
157
|
-
onSaturationValueChange:
|
|
158
|
+
}), A !== "base" && A !== "custom" ? null : /* @__PURE__ */ d(a, {
|
|
159
|
+
label: F.customTab ?? "",
|
|
160
|
+
children: /* @__PURE__ */ d(re, {
|
|
161
|
+
assistiveText: I,
|
|
162
|
+
id: L,
|
|
163
|
+
color: K,
|
|
164
|
+
errorTextWorkingColor: x,
|
|
165
|
+
previousColor: ge,
|
|
166
|
+
labels: F,
|
|
167
|
+
onBlueChange: Q("blue"),
|
|
168
|
+
onGreenChange: Q("green"),
|
|
169
|
+
onHexChange: Q("hex"),
|
|
170
|
+
onHueChange: be,
|
|
171
|
+
onRedChange: Q("red"),
|
|
172
|
+
onSwatchChange: ye,
|
|
173
|
+
onSaturationValueChange: Se,
|
|
158
174
|
onSaturationNavigate: $("saturation"),
|
|
159
175
|
onValueNavigate: $("value")
|
|
160
176
|
})
|
|
161
177
|
})]
|
|
162
|
-
}),
|
|
178
|
+
}), Oe = /* @__PURE__ */ f("div", {
|
|
163
179
|
className: "slds-color-picker__selector-footer",
|
|
164
|
-
children: [/* @__PURE__ */
|
|
180
|
+
children: [/* @__PURE__ */ d(r, {
|
|
165
181
|
className: "slds-color-picker__selector-cancel",
|
|
166
|
-
id: `color-picker-footer-cancel-${
|
|
167
|
-
label:
|
|
168
|
-
onClick:
|
|
182
|
+
id: `color-picker-footer-cancel-${L}`,
|
|
183
|
+
label: F.cancelButton,
|
|
184
|
+
onClick: Z,
|
|
169
185
|
variant: "neutral"
|
|
170
|
-
}), /* @__PURE__ */
|
|
186
|
+
}), /* @__PURE__ */ d(r, {
|
|
171
187
|
className: "slds-color-picker__selector-submit",
|
|
172
|
-
disabled: Object.keys(
|
|
173
|
-
id: `color-picker-footer-submit-${
|
|
174
|
-
label:
|
|
175
|
-
onClick:
|
|
188
|
+
disabled: Object.keys(K.errors || {}).length > 0,
|
|
189
|
+
id: `color-picker-footer-submit-${L}`,
|
|
190
|
+
label: F.submitButton,
|
|
191
|
+
onClick: Ce,
|
|
176
192
|
variant: "brand"
|
|
177
193
|
})]
|
|
178
194
|
});
|
|
179
|
-
return /* @__PURE__ */
|
|
180
|
-
className:
|
|
181
|
-
ref:
|
|
182
|
-
children: /* @__PURE__ */
|
|
195
|
+
return /* @__PURE__ */ d("div", {
|
|
196
|
+
className: u("slds-color-picker", g),
|
|
197
|
+
ref: he,
|
|
198
|
+
children: /* @__PURE__ */ f("div", {
|
|
183
199
|
className: "slds-color-picker__summary",
|
|
184
200
|
children: [
|
|
185
|
-
/* @__PURE__ */
|
|
186
|
-
className:
|
|
187
|
-
htmlFor:
|
|
188
|
-
id: `color-picker-label-${
|
|
189
|
-
children:
|
|
201
|
+
/* @__PURE__ */ d("label", {
|
|
202
|
+
className: u("slds-color-picker__summary-label", I.label ? "slds-assistive-text" : ""),
|
|
203
|
+
htmlFor: w ? void 0 : `color-picker-summary-input-${L}`,
|
|
204
|
+
id: `color-picker-label-${L}`,
|
|
205
|
+
children: I.label ? I.label : F.label
|
|
190
206
|
}),
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
ariaLabelledby: `color-picker-label-${
|
|
207
|
+
/* @__PURE__ */ d(oe, {
|
|
208
|
+
ariaLabelledby: `color-picker-label-${L}`,
|
|
193
209
|
align: "bottom left",
|
|
194
|
-
body:
|
|
195
|
-
classNameDialog:
|
|
196
|
-
footer:
|
|
210
|
+
body: De,
|
|
211
|
+
classNameDialog: u("slds-color-picker__selector", _),
|
|
212
|
+
footer: Oe,
|
|
197
213
|
hasNoCloseButton: !0,
|
|
198
214
|
hasNoNubbin: !0,
|
|
199
|
-
hasStaticAlignment:
|
|
200
|
-
id: `slds-color-picker__selector-${
|
|
201
|
-
isOpen:
|
|
202
|
-
onClose:
|
|
203
|
-
onOpen:
|
|
204
|
-
onRequestClose:
|
|
205
|
-
position:
|
|
206
|
-
children: /* @__PURE__ */
|
|
215
|
+
hasStaticAlignment: C,
|
|
216
|
+
id: `slds-color-picker__selector-${L}`,
|
|
217
|
+
isOpen: B,
|
|
218
|
+
onClose: fe,
|
|
219
|
+
onOpen: pe,
|
|
220
|
+
onRequestClose: X,
|
|
221
|
+
position: D,
|
|
222
|
+
children: /* @__PURE__ */ d(r, {
|
|
207
223
|
className: "slds-color-picker__summary-button",
|
|
208
|
-
disabled:
|
|
224
|
+
disabled: y,
|
|
209
225
|
iconClassName: "slds-m-left_xx-small",
|
|
210
226
|
iconPosition: "right",
|
|
211
227
|
iconVariant: "more",
|
|
212
|
-
id: `slds-color-picker__summary-button-${
|
|
213
|
-
label: /* @__PURE__ */
|
|
228
|
+
id: `slds-color-picker__summary-button-${L}`,
|
|
229
|
+
label: /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("span", {
|
|
214
230
|
className: "slds-assistive-text",
|
|
215
|
-
children:
|
|
216
|
-
}), /* @__PURE__ */
|
|
217
|
-
color:
|
|
218
|
-
labels:
|
|
231
|
+
children: I.label ? I.label : F.label
|
|
232
|
+
}), /* @__PURE__ */ d(ne, {
|
|
233
|
+
color: R,
|
|
234
|
+
labels: F
|
|
219
235
|
})] }),
|
|
220
|
-
onClick:
|
|
236
|
+
onClick: we,
|
|
221
237
|
variant: "icon"
|
|
222
238
|
})
|
|
223
239
|
}),
|
|
224
|
-
|
|
225
|
-
!
|
|
240
|
+
Ee(),
|
|
241
|
+
!B && q && /* @__PURE__ */ d("p", {
|
|
226
242
|
className: "slds-form-error",
|
|
227
|
-
id: `color-picker-summary-error-${
|
|
243
|
+
id: `color-picker-summary-error-${L}`,
|
|
228
244
|
children: q
|
|
229
245
|
})
|
|
230
246
|
]
|
|
231
247
|
})
|
|
232
248
|
});
|
|
233
249
|
};
|
|
234
|
-
|
|
250
|
+
h.displayName = e;
|
|
235
251
|
//#endregion
|
|
236
|
-
export {
|
|
252
|
+
export { h as default };
|
|
237
253
|
|
|
238
254
|
//# sourceMappingURL=color-picker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.js","names":[],"sources":["../../../../components/color-picker/color-picker.tsx"],"sourcesContent":["/* eslint-disable max-lines */\nimport React, {\n\tuseState,\n\tuseCallback,\n\tuseRef,\n\tuseEffect,\n\tuseMemo,\n} from 'react';\nimport classNames from 'classnames';\n\nimport checkProps from './check-props';\n\nimport CustomColor from './private/custom-color';\nimport Swatch from './private/swatch';\nimport SwatchPicker from './private/swatch-picker';\n\nimport Button from '../button';\nimport Input, { type InputChangeData } from '../input';\nimport Tabs from '../tabs';\nimport TabsPanel from '../tabs/panel';\nimport Popover from '../popover';\n\nimport ColorUtils from '../../utilities/color';\nimport { COLOR_PICKER } from '../../utilities/constants';\nimport generateId from '../../utilities/generate-id';\n\nimport {\n\tWorkingColor,\n\tColorPickerAssistiveText,\n\tColorPickerLabels,\n\tColorPickerEvents,\n} from './types';\n\ninterface ColorPickerBaseProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: ColorPickerAssistiveText;\n\t/** CSS classes for the color-picker container */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** CSS classes for the popover menu */\n\tclassNameMenu?: string | string[] | Record<string, boolean>;\n\t/** Unique ID for the component */\n\tid?: string;\n\t/** Disables the input and button */\n\tdisabled?: boolean;\n\t/** Error message for the outer input */\n\terrorText?: string;\n\t/** Error message for the custom tab working color input */\n\terrorTextWorkingColor?: string;\n\t/** Event callbacks */\n\tevents?: ColorPickerEvents;\n\t/** Disable flip behavior for popover alignment */\n\thasStaticAlignment?: boolean;\n\t/** Hides the text input */\n\thideInput?: boolean;\n\t/** Controlled popover open state */\n\tisOpen?: boolean;\n\t/** Text labels for internationalization */\n\tlabels?: ColorPickerLabels;\n\t/** Popover position strategy */\n\tmenuPosition?: 'absolute' | 'overflowBoundaryElement' | 'relative';\n\t/** Current color in hexadecimal string */\n\tvalue?: string;\n\t/** Current working color in hexadecimal string */\n\tvalueWorking?: string;\n\t/** Callback when popover closes */\n\tonClose?: (\n\t\tevent: React.SyntheticEvent,\n\t\tdata: { trigger?: string; componentWillUnmount?: boolean }\n\t) => void;\n\t/** Callback when popover opens */\n\tonOpen?: (\n\t\tevent: React.SyntheticEvent,\n\t\tdata: { portal?: HTMLElement }\n\t) => void;\n\t/** Callback when user requests close */\n\tonRequestClose?: (\n\t\tevent: React.SyntheticEvent,\n\t\tdata: { trigger: string }\n\t) => void;\n\t/** Callback when popover requests to open */\n\tonRequestOpen?: () => void;\n}\n\n/**\n * `variant` sets which tabs are present. `swatchColors` needs the swatch tab\n * and `defaultSelectedTab` only applies when both tabs are present.\n */\nexport type ColorPickerVariantProps =\n\t| {\n\t\t\t/** Both the swatch and custom tabs */\n\t\t\tvariant?: 'base';\n\t\t\t/** Array of hex color values for swatch options */\n\t\t\tswatchColors?: string[];\n\t\t\t/** Which tab is visible when dialog opens */\n\t\t\tdefaultSelectedTab?: 'swatches' | 'custom';\n\t }\n\t| {\n\t\t\t/** Only the swatch tab */\n\t\t\tvariant: 'swatches';\n\t\t\t/** Array of hex color values for swatch options */\n\t\t\tswatchColors?: string[];\n\t\t\tdefaultSelectedTab?: never;\n\t }\n\t| {\n\t\t\t/** Only the custom tab */\n\t\t\tvariant: 'custom';\n\t\t\tswatchColors?: never;\n\t\t\tdefaultSelectedTab?: never;\n\t };\n\nexport type ColorPickerProps = ColorPickerBaseProps & ColorPickerVariantProps;\n\nconst defaultLabels: ColorPickerLabels = {\n\tblueAbbreviated: 'B',\n\tcancelButton: 'Cancel',\n\tcustomTab: 'Custom',\n\tcustomTabActiveWorkingColorSwatch: 'Working Color',\n\tcustomTabTransparentSwatch: 'Transparent Swatch',\n\tgreenAbbreviated: 'G',\n\thexLabel: 'Hex',\n\tinvalidColor: 'The color entered is invalid',\n\tinvalidComponent: 'The value needs to be an integer from 0-255',\n\tredAbbreviated: 'R',\n\tsubmitButton: 'Done',\n\tswatchTab: 'Default',\n\tswatchTabTransparentSwatch: 'Transparent Swatch',\n};\n\nconst defaultAssistiveText: ColorPickerAssistiveText = {\n\tsaturationValueGrid:\n\t\t'Use arrow keys to select a saturation and brightness, on an x and y axis.',\n\thueSlider: 'Select Hue',\n};\n\nconst defaultSwatchColors = [\n\t'#e3abec',\n\t'#c2dbf7',\n\t'#9fd6ff',\n\t'#9de7da',\n\t'#9df0c0',\n\t'#fff099',\n\t'#fed49a',\n\t'#d073e0',\n\t'#86baf3',\n\t'#5ebbff',\n\t'#44d8be',\n\t'#3be282',\n\t'#ffe654',\n\t'#ffb758',\n\t'#bd35bd',\n\t'#5779c1',\n\t'#5679c0',\n\t'#00aea9',\n\t'#3cba4c',\n\t'#f5bc25',\n\t'#f99221',\n\t'#580d8c',\n\t'#001970',\n\t'#0a2399',\n\t'#0b7477',\n\t'#0b6b50',\n\t'#b67e11',\n\t'#b85d0d',\n\t'',\n];\n\n/**\n * The Unified Color Picker component allows for a fully accessible and\n * configurable color picker, allowing the user to pick from a set of\n * predefined colors (swatches), or to pick a custom color using a HSB\n * selection interface.\n */\nconst ColorPicker: React.FC<ColorPickerProps> = ({\n\tassistiveText: assistiveTextProp,\n\tclassName,\n\tclassNameMenu,\n\tid: idProp,\n\tdisabled = false,\n\terrorText: errorTextProp,\n\terrorTextWorkingColor,\n\tevents = {},\n\thasStaticAlignment,\n\thideInput = false,\n\tisOpen: isOpenProp,\n\tlabels: labelsProp,\n\tmenuPosition = 'absolute',\n\tswatchColors = defaultSwatchColors,\n\tdefaultSelectedTab = 'swatches',\n\tvariant = 'base',\n\tvalue: valueProp,\n\tvalueWorking: valueWorkingProp,\n\tonClose,\n\tonOpen,\n\tonRequestClose,\n\tonRequestOpen,\n}) => {\n\t// Merge labels and assistive text with defaults\n\tconst labels = useMemo(\n\t\t() => ({ ...defaultLabels, ...labelsProp }),\n\t\t[labelsProp]\n\t);\n\tconst assistiveText = useMemo(\n\t\t() => ({ ...defaultAssistiveText, ...assistiveTextProp }),\n\t\t[assistiveTextProp]\n\t);\n\n\t// Generate stable ID\n\tconst generatedId = useRef(idProp || generateId());\n\tconst componentId = idProp || generatedId.current;\n\n\t// Refs\n\tconst wrapperRef = useRef<HTMLDivElement>(null);\n\n\t// Initialize working color from props\n\tconst getInitialWorkingColor = useCallback((): WorkingColor => {\n\t\treturn ColorUtils.getNewColor(\n\t\t\t{ hex: valueWorkingProp || valueProp },\n\t\t\tevents.onValidateWorkingColor\n\t\t) as WorkingColor;\n\t}, [valueWorkingProp, valueProp, events.onValidateWorkingColor]);\n\n\t// State\n\tconst [currentColor, setCurrentColor] = useState<string>(\n\t\tvalueProp != null ? valueProp : ''\n\t);\n\tconst [isOpen, setIsOpen] = useState<boolean>(isOpenProp || false);\n\tconst [workingColor, setWorkingColor] = useState<WorkingColor>(\n\t\tgetInitialWorkingColor\n\t);\n\tconst [previousWorkingColor, setPreviousWorkingColor] =\n\t\tuseState<WorkingColor>(getInitialWorkingColor);\n\tconst [colorErrorMessage, setColorErrorMessage] = useState<string>(\n\t\terrorTextProp || ''\n\t);\n\n\t// Check props on mount (development only)\n\tuseEffect(() => {\n\t\t// checkProps is a no-op in production\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t(checkProps as any)(\n\t\t\tCOLOR_PICKER,\n\t\t\t{\n\t\t\t\tassistiveText: assistiveTextProp,\n\t\t\t\tclassName,\n\t\t\t\tclassNameMenu,\n\t\t\t\tid: idProp,\n\t\t\t\tdisabled,\n\t\t\t\terrorText: errorTextProp,\n\t\t\t\terrorTextWorkingColor,\n\t\t\t\tevents,\n\t\t\t\thasStaticAlignment,\n\t\t\t\thideInput,\n\t\t\t\tisOpen: isOpenProp,\n\t\t\t\tlabels: labelsProp,\n\t\t\t\tmenuPosition,\n\t\t\t\tswatchColors,\n\t\t\t\tdefaultSelectedTab,\n\t\t\t\tvariant,\n\t\t\t\tvalue: valueProp,\n\t\t\t\tvalueWorking: valueWorkingProp,\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\t// Sync props to state when they change externally\n\tuseEffect(() => {\n\t\tif (valueProp !== undefined) {\n\t\t\tsetCurrentColor(valueProp);\n\t\t}\n\t}, [valueProp]);\n\n\tuseEffect(() => {\n\t\tif (valueWorkingProp !== undefined) {\n\t\t\tsetWorkingColor(\n\t\t\t\tColorUtils.getNewColor(\n\t\t\t\t\t{ hex: valueWorkingProp },\n\t\t\t\t\tevents.onValidateWorkingColor\n\t\t\t\t) as WorkingColor\n\t\t\t);\n\t\t}\n\t}, [valueWorkingProp, events.onValidateWorkingColor]);\n\n\tuseEffect(() => {\n\t\tif (isOpenProp !== undefined) {\n\t\t\tsetIsOpen(isOpenProp);\n\t\t}\n\t}, [isOpenProp]);\n\n\t// Helper to update working color\n\tconst updateWorkingColor = useCallback(\n\t\t(\n\t\t\tevent: React.SyntheticEvent,\n\t\t\tcolorOptions: {\n\t\t\t\thex?: string;\n\t\t\t\tred?: string | number;\n\t\t\t\tgreen?: string | number;\n\t\t\t\tblue?: string | number;\n\t\t\t\thue?: number | string;\n\t\t\t\tsaturation?: number;\n\t\t\t\tvalue?: number;\n\t\t\t}\n\t\t) => {\n\t\t\tconst newColor = ColorUtils.getNewColor(\n\t\t\t\tcolorOptions,\n\t\t\t\tevents.onValidateWorkingColor,\n\t\t\t\tworkingColor\n\t\t\t) as WorkingColor;\n\t\t\tsetPreviousWorkingColor(workingColor);\n\t\t\tsetWorkingColor(newColor);\n\n\t\t\tif (events.onWorkingColorChange) {\n\t\t\t\tevents.onWorkingColorChange(event, { color: newColor });\n\t\t\t}\n\t\t},\n\t\t[events, workingColor]\n\t);\n\n\t// Event handlers\n\tconst handleSwatchChange = useCallback(\n\t\t(event: React.ChangeEvent<HTMLInputElement>) => {\n\t\t\tupdateWorkingColor(event, { hex: event.target.value });\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\tconst handleCancelState = useCallback(() => {\n\t\tconst resetColor = ColorUtils.getNewColor(\n\t\t\t{ hex: currentColor },\n\t\t\tevents.onValidateWorkingColor\n\t\t) as WorkingColor;\n\t\tsetIsOpen(false);\n\t\tsetWorkingColor(resetColor);\n\t\tsetPreviousWorkingColor(resetColor);\n\t}, [currentColor, events.onValidateWorkingColor]);\n\n\tconst handleOnRequestClose = useCallback(\n\t\t(event: React.SyntheticEvent, data: { trigger: string }) => {\n\t\t\tif (data.trigger === 'clickOutside' || data.trigger === 'cancel') {\n\t\t\t\thandleCancelState();\n\t\t\t}\n\n\t\t\tif (onRequestClose) {\n\t\t\t\tonRequestClose(event, data);\n\t\t\t}\n\t\t},\n\t\t[handleCancelState, onRequestClose]\n\t);\n\n\tconst handleCancel = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\thandleCancelState();\n\n\t\t\tif (onRequestClose) {\n\t\t\t\tonRequestClose(event, { trigger: 'cancel' });\n\t\t\t}\n\t\t},\n\t\t[handleCancelState, onRequestClose]\n\t);\n\n\tconst handleColorChange = useCallback(\n\t\t(property: 'hex' | 'red' | 'green' | 'blue') =>\n\t\t\t(event: React.SyntheticEvent, data: InputChangeData) => {\n\t\t\t\tconst colorProperties: Record<string, string | number> = {};\n\t\t\t\tcolorProperties[property] = data.value;\n\t\t\t\tupdateWorkingColor(event, colorProperties);\n\t\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\tconst handleHueChange = useCallback(\n\t\t(event: React.ChangeEvent<HTMLInputElement>) => {\n\t\t\tupdateWorkingColor(event, { hue: event.target.value });\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\tconst handleHexInputChange = useCallback(\n\t\t(event: React.SyntheticEvent, data: InputChangeData) => {\n\t\t\tconst newCurrentColor = data.value;\n\t\t\tconst namedColorHex = ColorUtils.getHexFromNamedColor(newCurrentColor);\n\t\t\tlet isValid = false;\n\n\t\t\tif (events.onValidateColor) {\n\t\t\t\tisValid = events.onValidateColor(newCurrentColor);\n\t\t\t} else {\n\t\t\t\tisValid = namedColorHex ? true : ColorUtils.isValidHex(newCurrentColor);\n\t\t\t}\n\n\t\t\tsetCurrentColor(newCurrentColor);\n\t\t\tsetWorkingColor(\n\t\t\t\tColorUtils.getNewColor(\n\t\t\t\t\t{\n\t\t\t\t\t\thex: namedColorHex || newCurrentColor,\n\t\t\t\t\t\tname: namedColorHex ? newCurrentColor.toLowerCase() : null,\n\t\t\t\t\t} as { hex: string; name?: string | null },\n\t\t\t\t\tevents.onValidateWorkingColor\n\t\t\t\t) as WorkingColor\n\t\t\t);\n\t\t\tsetColorErrorMessage(isValid ? '' : labels.invalidColor || '');\n\n\t\t\tif (events.onChange) {\n\t\t\t\tevents.onChange(event, {\n\t\t\t\t\tcolor: newCurrentColor,\n\t\t\t\t\tisValid,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t[events, labels.invalidColor]\n\t);\n\n\tconst handleNavigate = useCallback(\n\t\t(property: 'saturation' | 'value') =>\n\t\t\t(event: React.KeyboardEvent, data: { delta: number }) => {\n\t\t\t\tconst colorProperties: Record<string, number> = {};\n\t\t\t\tcolorProperties[property] = data.delta;\n\t\t\t\tconst newColor = ColorUtils.getDeltaColor(\n\t\t\t\t\tcolorProperties,\n\t\t\t\t\tevents.onValidateWorkingColor,\n\t\t\t\t\tworkingColor\n\t\t\t\t) as WorkingColor;\n\t\t\t\tsetPreviousWorkingColor(workingColor);\n\t\t\t\tsetWorkingColor(newColor);\n\n\t\t\t\tif (events.onWorkingColorChange) {\n\t\t\t\t\tevents.onWorkingColorChange(event, { color: newColor });\n\t\t\t\t}\n\t\t\t},\n\t\t[events, workingColor]\n\t);\n\n\tconst handleSaturationValueChange = useCallback(\n\t\t(\n\t\t\tevent: React.MouseEvent | React.KeyboardEvent,\n\t\t\tdata: { saturation: number; value: number }\n\t\t) => {\n\t\t\tupdateWorkingColor(event, {\n\t\t\t\tsaturation: data.saturation,\n\t\t\t\tvalue: data.value,\n\t\t\t});\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\tconst handleSubmitButtonClick = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tsetIsOpen(false);\n\t\t\tsetCurrentColor(workingColor.hex);\n\t\t\tsetColorErrorMessage('');\n\n\t\t\tif (events.onChange) {\n\t\t\t\tevents.onChange(event, {\n\t\t\t\t\tcolor: workingColor.hex,\n\t\t\t\t\tisValid: true,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t[events, workingColor.hex]\n\t);\n\n\tconst handleSwatchButtonClick = useCallback(() => {\n\t\tconst newWorkingColor = ColorUtils.getNewColor(\n\t\t\t{ hex: workingColor.hex },\n\t\t\tevents.onValidateWorkingColor\n\t\t) as WorkingColor;\n\t\tsetIsOpen((prev) => !prev);\n\t\tsetWorkingColor(newWorkingColor);\n\n\t\tif (onRequestOpen) {\n\t\t\tonRequestOpen();\n\t\t}\n\t}, [events.onValidateWorkingColor, onRequestOpen, workingColor.hex]);\n\n\tconst handleSwatchSelect = useCallback(\n\t\t(event: React.MouseEvent | React.KeyboardEvent, data: { hex: string }) => {\n\t\t\tupdateWorkingColor(event, { hex: data.hex });\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\t// Render helpers\n\tconst renderInput = () => {\n\t\tif (hideInput) return null;\n\n\t\treturn (\n\t\t\t<Input\n\t\t\t\taria-describedby={\n\t\t\t\t\t!isOpen && colorErrorMessage\n\t\t\t\t\t\t? `color-picker-summary-error-${componentId}`\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-color-picker__summary-input',\n\t\t\t\t\t'slds-align-top',\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-has-error': !!colorErrorMessage,\n\t\t\t\t\t}\n\t\t\t\t)}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tid={`color-picker-summary-input-${componentId}`}\n\t\t\t\tonChange={handleHexInputChange}\n\t\t\t\tvalue={currentColor}\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderDefaultTab = () => {\n\t\tif (variant !== 'base' && variant !== 'swatches') return null;\n\n\t\treturn (\n\t\t\t<TabsPanel label={labels.swatchTab ?? ''}>\n\t\t\t\t<SwatchPicker\n\t\t\t\t\tcolor={workingColor}\n\t\t\t\t\tlabels={labels}\n\t\t\t\t\tonSelect={handleSwatchSelect}\n\t\t\t\t\tswatchColors={swatchColors}\n\t\t\t\t/>\n\t\t\t</TabsPanel>\n\t\t);\n\t};\n\n\tconst renderCustomTab = () => {\n\t\tif (variant !== 'base' && variant !== 'custom') return null;\n\n\t\treturn (\n\t\t\t<TabsPanel label={labels.customTab ?? ''}>\n\t\t\t\t<CustomColor\n\t\t\t\t\tassistiveText={assistiveText}\n\t\t\t\t\tid={componentId}\n\t\t\t\t\tcolor={workingColor}\n\t\t\t\t\terrorTextWorkingColor={errorTextWorkingColor}\n\t\t\t\t\tpreviousColor={previousWorkingColor}\n\t\t\t\t\tlabels={labels}\n\t\t\t\t\tonBlueChange={handleColorChange('blue')}\n\t\t\t\t\tonGreenChange={handleColorChange('green')}\n\t\t\t\t\tonHexChange={handleColorChange('hex')}\n\t\t\t\t\tonHueChange={handleHueChange}\n\t\t\t\t\tonRedChange={handleColorChange('red')}\n\t\t\t\t\tonSwatchChange={handleSwatchChange}\n\t\t\t\t\tonSaturationValueChange={handleSaturationValueChange}\n\t\t\t\t\tonSaturationNavigate={handleNavigate('saturation')}\n\t\t\t\t\tonValueNavigate={handleNavigate('value')}\n\t\t\t\t/>\n\t\t\t</TabsPanel>\n\t\t);\n\t};\n\n\tconst popoverBody = (\n\t\t<Tabs\n\t\t\tid={`color-picker-tabs-${componentId}`}\n\t\t\tdefaultSelectedIndex={defaultSelectedTab === 'custom' ? 1 : 0}\n\t\t>\n\t\t\t{renderDefaultTab()}\n\t\t\t{renderCustomTab()}\n\t\t</Tabs>\n\t);\n\n\tconst popoverFooter = (\n\t\t<div className=\"slds-color-picker__selector-footer\">\n\t\t\t<Button\n\t\t\t\tclassName=\"slds-color-picker__selector-cancel\"\n\t\t\t\tid={`color-picker-footer-cancel-${componentId}`}\n\t\t\t\tlabel={labels.cancelButton}\n\t\t\t\tonClick={handleCancel}\n\t\t\t\tvariant=\"neutral\"\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\tclassName=\"slds-color-picker__selector-submit\"\n\t\t\t\tdisabled={Object.keys(workingColor.errors || {}).length > 0}\n\t\t\t\tid={`color-picker-footer-submit-${componentId}`}\n\t\t\t\tlabel={labels.submitButton}\n\t\t\t\tonClick={handleSubmitButtonClick}\n\t\t\t\tvariant=\"brand\"\n\t\t\t/>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames('slds-color-picker', className)}\n\t\t\tref={wrapperRef}\n\t\t>\n\t\t\t<div className=\"slds-color-picker__summary\">\n\t\t\t\t<label\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t'slds-color-picker__summary-label',\n\t\t\t\t\t\tassistiveText.label ? 'slds-assistive-text' : ''\n\t\t\t\t\t)}\n\t\t\t\t\thtmlFor={\n\t\t\t\t\t\t!hideInput ? `color-picker-summary-input-${componentId}` : undefined\n\t\t\t\t\t}\n\t\t\t\t\tid={`color-picker-label-${componentId}`}\n\t\t\t\t>\n\t\t\t\t\t{assistiveText.label ? assistiveText.label : labels.label}\n\t\t\t\t</label>\n\t\t\t\t<Popover\n\t\t\t\t\tariaLabelledby={`color-picker-label-${componentId}`}\n\t\t\t\t\talign=\"bottom left\"\n\t\t\t\t\tbody={popoverBody}\n\t\t\t\t\tclassNameDialog={classNames(\n\t\t\t\t\t\t'slds-color-picker__selector',\n\t\t\t\t\t\tclassNameMenu\n\t\t\t\t\t)}\n\t\t\t\t\tfooter={popoverFooter}\n\t\t\t\t\thasNoCloseButton\n\t\t\t\t\thasNoNubbin\n\t\t\t\t\thasStaticAlignment={hasStaticAlignment}\n\t\t\t\t\tid={`slds-color-picker__selector-${componentId}`}\n\t\t\t\t\tisOpen={isOpen}\n\t\t\t\t\tonClose={\n\t\t\t\t\t\tonClose as unknown as\n\t\t\t\t\t\t\t| ((\n\t\t\t\t\t\t\t\t\tevent?: unknown,\n\t\t\t\t\t\t\t\t\tdata?: { componentWillUnmount?: boolean }\n\t\t\t\t\t\t\t ) => void)\n\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t}\n\t\t\t\t\tonOpen={\n\t\t\t\t\t\tonOpen as unknown as\n\t\t\t\t\t\t\t| ((event?: unknown, data?: { portal?: HTMLElement }) => void)\n\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t}\n\t\t\t\t\tonRequestClose={\n\t\t\t\t\t\thandleOnRequestClose as unknown as\n\t\t\t\t\t\t\t| ((event?: unknown, data?: { trigger?: string }) => void)\n\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t}\n\t\t\t\t\tposition={menuPosition}\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"slds-color-picker__summary-button\"\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\ticonClassName=\"slds-m-left_xx-small\"\n\t\t\t\t\t\ticonPosition=\"right\"\n\t\t\t\t\t\ticonVariant=\"more\"\n\t\t\t\t\t\tid={`slds-color-picker__summary-button-${componentId}`}\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t\t\t\t\t{assistiveText.label ? assistiveText.label : labels.label}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<Swatch color={currentColor} labels={labels} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={handleSwatchButtonClick}\n\t\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t\t/>\n\t\t\t\t</Popover>\n\t\t\t\t{renderInput()}\n\t\t\t\t{!isOpen && colorErrorMessage && (\n\t\t\t\t\t<p\n\t\t\t\t\t\tclassName=\"slds-form-error\"\n\t\t\t\t\t\tid={`color-picker-summary-error-${componentId}`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{colorErrorMessage}\n\t\t\t\t\t</p>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nColorPicker.displayName = COLOR_PICKER;\n\nexport default ColorPicker;\n"],"mappings":";;;;;;;;;;;;;;;;AAgHA,IAAM,IAAmC;CACxC,iBAAiB;CACjB,cAAc;CACd,WAAW;CACX,mCAAmC;CACnC,4BAA4B;CAC5B,kBAAkB;CAClB,UAAU;CACV,cAAc;CACd,kBAAkB;CAClB,gBAAgB;CAChB,cAAc;CACd,WAAW;CACX,4BAA4B;AAC7B,GAEM,KAAiD;CACtD,qBACC;CACD,WAAW;AACZ,GAEM,KAAsB,4PA8B5B,GAQM,KAA2C,EAChD,eAAe,GACf,cACA,kBACA,IAAI,GACJ,cAAW,IACX,WAAW,GACX,0BACA,YAAS,CAAC,GACV,uBACA,eAAY,IACZ,QAAQ,GACR,QAAQ,GACR,kBAAe,YACf,kBAAe,IACf,wBAAqB,YACrB,aAAU,QACV,OAAO,GACP,cAAc,GACd,aACA,YACA,mBACA,uBACK;CAEL,IAAM,IAAS,SACP;EAAE,GAAG;EAAe,GAAG;CAAW,IACzC,CAAC,CAAU,CACZ,GACM,IAAgB,SACd;EAAE,GAAG;EAAsB,GAAG;CAAkB,IACvD,CAAC,CAAiB,CACnB,GAGM,KA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C9C,CAAA;IACP,kBAAC,IAAD;KACC,gBAAgB,sBAAsB;KACtC,OAAM;KACN,MAAM;KACN,iBAAiB,EAChB,+BACA,CACD;KACA,QAAQ;KACR,kBAAA;KACA,aAAA;KACoB;KACpB,IAAI,+BAA+B;KAC3B;KAEP;KAQA;KAID,gBACC;KAID,UAAU;KAEV,UAAA,kBAAC,GAAD;MACC,WAAU;MACA;MACV,eAAc;MACd,cAAa;MACb,aAAY;MACZ,IAAI,qCAAqC;MACzC,OACC,kBAAC,OAAD,EAAA,UAAA,CACC,kBAAC,QAAD;OAAM,WAAU;OACd,UAAA,EAAc,QAAQ,EAAc,QAAQ,EAAO;MAC/C,CAAA,GACN,kBAAC,IAAD;OAAQ,OAAO;OAAsB;MAAS,CAAA,CAC1C,EAAA,CAAA;MAEN,SAAS;MACT,SAAQ;KACR,CAAA;IACO,CAAA;IACR,GAAY;IACZ,CAAC,KAAU,KACX,kBAAC,KAAD;KACC,WAAU;KACV,IAAI,8BAA8B;KAEjC,UAAA;IACC,CAAA;GAEA;;CACD,CAAA;AAEP;AAEA,EAAY,cAAc"}
|
|
1
|
+
{"version":3,"file":"color-picker.js","names":[],"sources":["../../../../components/color-picker/color-picker.tsx"],"sourcesContent":["/* eslint-disable max-lines */\nimport React, {\n\tuseState,\n\tuseCallback,\n\tuseRef,\n\tuseEffect,\n\tuseMemo,\n} from 'react';\nimport classNames from 'classnames';\n\nimport checkProps from './check-props';\n\nimport CustomColor from './private/custom-color';\nimport Swatch from './private/swatch';\nimport SwatchPicker from './private/swatch-picker';\n\nimport Button from '../button';\nimport Input, { type InputChangeData } from '../input';\nimport TabsPanel from '../tabs/panel';\nimport ColorPickerTabs from './private/color-picker-tabs';\nimport Popover from '../popover';\n\nimport ColorUtils from '../../utilities/color';\nimport { COLOR_PICKER } from '../../utilities/constants';\nimport generateId from '../../utilities/generate-id';\nimport { useControllableState } from '../../utilities/hooks';\n\nimport {\n\tWorkingColor,\n\tColorPickerAssistiveText,\n\tColorPickerLabels,\n\tColorPickerChangeHandler,\n\tColorPickerEvents,\n} from './types';\n\ninterface ColorPickerBaseProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: ColorPickerAssistiveText;\n\t/** CSS classes for the color-picker container */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** CSS classes for the popover menu */\n\tclassNameMenu?: string | string[] | Record<string, boolean>;\n\t/** Unique ID for the component */\n\tid?: string;\n\t/** Disables the input and button */\n\tdisabled?: boolean;\n\t/**\n\t * Error message for the outer input. When empty, the message is derived from `value`:\n\t * `labels.invalidColor` is shown while `value` fails validation (`events.onValidateColor`,\n\t * or the built-in hex/named-color check).\n\t */\n\terrorText?: string;\n\t/** Error message for the custom tab working color input */\n\terrorTextWorkingColor?: string;\n\t/** Disable flip behavior for popover alignment */\n\thasStaticAlignment?: boolean;\n\t/** Hides the text input */\n\thideInput?: boolean;\n\t/**\n\t * Initial open state of the popover when `isOpen` is not set (uncontrolled). Defaults to `false`.\n\t */\n\tdefaultIsOpen?: boolean;\n\t/**\n\t * Whether the popover is open. When set, the popover is controlled: it only opens or closes\n\t * when this prop changes, so update it from `onRequestOpen` and `onRequestClose`. When\n\t * `undefined`, the popover manages its own open state (see `defaultIsOpen`).\n\t */\n\tisOpen?: boolean;\n\t/** Text labels for internationalization */\n\tlabels?: ColorPickerLabels;\n\t/** Popover position strategy */\n\tmenuPosition?: 'absolute' | 'overflowBoundaryElement' | 'relative';\n\t/**\n\t * Current color as a hexadecimal string (or a CSS color name); `''` for no color. Required and\n\t * controlled: the summary input and swatch always render this value. Update it from\n\t * `events.onChange`, which fires when the user types in the input (`isValid` says whether the\n\t * text is a valid color) and when Done is clicked.\n\t */\n\tvalue: string;\n\t/**\n\t * Working color (the in-popover draft) as a hexadecimal string. When set, the working color\n\t * is controlled: update it from `events.onWorkingColorChange`. When `undefined`, the working\n\t * color is internal and is reset from `value` each time the popover opens.\n\t */\n\tvalueWorking?: string;\n\t/** Callback when popover closes */\n\tonClose?: (\n\t\tevent: React.SyntheticEvent,\n\t\tdata: { trigger?: string; componentWillUnmount?: boolean }\n\t) => void;\n\t/** Callback when popover opens */\n\tonOpen?: (\n\t\tevent: React.SyntheticEvent,\n\t\tdata: { portal?: HTMLElement }\n\t) => void;\n\t/**\n\t * Called when the popover requests to close. `data.trigger` says why: `cancel` (Cancel button\n\t * or Escape), `submit` (Done button), `clickOutside`, `triggerClick`, or `newPopover`. When\n\t * `isOpen` is controlled, set it to `false` here.\n\t */\n\tonRequestClose?: (\n\t\tevent: React.SyntheticEvent,\n\t\tdata: { trigger: string }\n\t) => void;\n\t/**\n\t * Called when the swatch button is clicked while the popover is closed. When `isOpen` is\n\t * controlled, set it to `true` here.\n\t */\n\tonRequestOpen?: () => void;\n}\n\n/**\n * `variant` sets which tabs are present. `swatchColors` needs the swatch tab\n * and `defaultSelectedTab` only applies when both tabs are present.\n */\nexport type ColorPickerVariantProps =\n\t| {\n\t\t\t/** Both the swatch and custom tabs */\n\t\t\tvariant?: 'base';\n\t\t\t/** Array of hex color values for swatch options */\n\t\t\tswatchColors?: string[];\n\t\t\t/** Which tab is visible when dialog opens */\n\t\t\tdefaultSelectedTab?: 'swatches' | 'custom';\n\t }\n\t| {\n\t\t\t/** Only the swatch tab */\n\t\t\tvariant: 'swatches';\n\t\t\t/** Array of hex color values for swatch options */\n\t\t\tswatchColors?: string[];\n\t\t\tdefaultSelectedTab?: never;\n\t }\n\t| {\n\t\t\t/** Only the custom tab */\n\t\t\tvariant: 'custom';\n\t\t\tswatchColors?: never;\n\t\t\tdefaultSelectedTab?: never;\n\t };\n\n/**\n * `events.onChange` is required unless the color picker is `disabled`:\n * ColorPicker is controlled, so without it choosing a color does nothing.\n */\nexport type ColorPickerEventsProps =\n\t| {\n\t\t\t/** Event callbacks. `events.onChange` is required unless `disabled` is set. */\n\t\t\tevents: ColorPickerEvents & { onChange: ColorPickerChangeHandler };\n\t }\n\t| { disabled: true; events?: ColorPickerEvents };\n\nexport type ColorPickerProps = ColorPickerBaseProps &\n\tColorPickerVariantProps &\n\tColorPickerEventsProps;\n\nconst defaultLabels: ColorPickerLabels = {\n\tblueAbbreviated: 'B',\n\tcancelButton: 'Cancel',\n\tcustomTab: 'Custom',\n\tcustomTabActiveWorkingColorSwatch: 'Working Color',\n\tcustomTabTransparentSwatch: 'Transparent Swatch',\n\tgreenAbbreviated: 'G',\n\thexLabel: 'Hex',\n\tinvalidColor: 'The color entered is invalid',\n\tinvalidComponent: 'The value needs to be an integer from 0-255',\n\tredAbbreviated: 'R',\n\tsubmitButton: 'Done',\n\tswatchTab: 'Default',\n\tswatchTabTransparentSwatch: 'Transparent Swatch',\n};\n\nconst defaultAssistiveText: ColorPickerAssistiveText = {\n\tsaturationValueGrid:\n\t\t'Use arrow keys to select a saturation and brightness, on an x and y axis.',\n\thueSlider: 'Select Hue',\n};\n\nconst defaultSwatchColors = [\n\t'#e3abec',\n\t'#c2dbf7',\n\t'#9fd6ff',\n\t'#9de7da',\n\t'#9df0c0',\n\t'#fff099',\n\t'#fed49a',\n\t'#d073e0',\n\t'#86baf3',\n\t'#5ebbff',\n\t'#44d8be',\n\t'#3be282',\n\t'#ffe654',\n\t'#ffb758',\n\t'#bd35bd',\n\t'#5779c1',\n\t'#5679c0',\n\t'#00aea9',\n\t'#3cba4c',\n\t'#f5bc25',\n\t'#f99221',\n\t'#580d8c',\n\t'#001970',\n\t'#0a2399',\n\t'#0b7477',\n\t'#0b6b50',\n\t'#b67e11',\n\t'#b85d0d',\n\t'',\n];\n\ntype HexValidator = ((hex: string) => boolean) | undefined;\n\n/** Builds a working color from a color value, resolving CSS color names to hex. */\nconst getWorkingColorFromValue = (\n\tcolor: string,\n\tvalidator: HexValidator\n): WorkingColor => {\n\tconst namedColorHex = ColorUtils.getHexFromNamedColor(color);\n\treturn ColorUtils.getNewColor(\n\t\t{\n\t\t\thex: namedColorHex || color,\n\t\t\tname: namedColorHex ? color.toLowerCase() : null,\n\t\t} as { hex: string; name?: string | null },\n\t\tvalidator\n\t) as WorkingColor;\n};\n\n/** Whether `color` is valid for the summary input. */\nconst isValidColor = (color: string, validator: HexValidator): boolean => {\n\tif (validator) {\n\t\treturn !!validator(color);\n\t}\n\treturn ColorUtils.getHexFromNamedColor(color)\n\t\t? true\n\t\t: ColorUtils.isValidHex(color);\n};\n\n/**\n * The Unified Color Picker component allows for a fully accessible and\n * configurable color picker, allowing the user to pick from a set of\n * predefined colors (swatches), or to pick a custom color using a HSB\n * selection interface.\n */\nconst ColorPicker: React.FC<ColorPickerProps> = ({\n\tassistiveText: assistiveTextProp,\n\tclassName,\n\tclassNameMenu,\n\tid: idProp,\n\tdefaultIsOpen = false,\n\tdisabled = false,\n\terrorText: errorTextProp,\n\terrorTextWorkingColor,\n\tevents = {},\n\thasStaticAlignment,\n\thideInput = false,\n\tisOpen: isOpenProp,\n\tlabels: labelsProp,\n\tmenuPosition = 'absolute',\n\tswatchColors = defaultSwatchColors,\n\tdefaultSelectedTab = 'swatches',\n\tvariant = 'base',\n\tvalue: valueProp,\n\tvalueWorking: valueWorkingProp,\n\tonClose,\n\tonOpen,\n\tonRequestClose,\n\tonRequestOpen,\n}) => {\n\t// Merge labels and assistive text with defaults\n\tconst labels = useMemo(\n\t\t() => ({ ...defaultLabels, ...labelsProp }),\n\t\t[labelsProp]\n\t);\n\tconst assistiveText = useMemo(\n\t\t() => ({ ...defaultAssistiveText, ...assistiveTextProp }),\n\t\t[assistiveTextProp]\n\t);\n\n\t// Generate stable ID\n\tconst generatedId = useRef(idProp || generateId());\n\tconst componentId = idProp || generatedId.current;\n\n\t// Refs\n\tconst wrapperRef = useRef<HTMLDivElement>(null);\n\n\t// `value` is controlled data. A missing `value` (warned in `checkProps`) renders as no color.\n\tconst value = valueProp ?? '';\n\tconst validateWorkingColor = events.onValidateWorkingColor;\n\n\t// Popover open state is ephemeral UI: controlled when `isOpen` is set, internal otherwise\n\tconst [isOpen, setIsOpen] = useControllableState(isOpenProp, defaultIsOpen);\n\n\t// The in-popover working color is a draft of `value`. It is reset from `value` when the\n\t// popover opens and when `value` changes.\n\tconst [draftColor, setDraftColor] = useState<WorkingColor>(() =>\n\t\tgetWorkingColorFromValue(value, validateWorkingColor)\n\t);\n\tconst [previousWorkingColor, setPreviousWorkingColor] =\n\t\tuseState<WorkingColor>(draftColor);\n\tconst [syncedFrom, setSyncedFrom] = useState({ value, isOpen });\n\tif (syncedFrom.value !== value || syncedFrom.isOpen !== isOpen) {\n\t\t// Adjusting state while rendering, so the popover never shows a stale draft\n\t\tsetSyncedFrom({ value, isOpen });\n\t\tif (syncedFrom.value !== value || isOpen) {\n\t\t\tconst resetColor = getWorkingColorFromValue(value, validateWorkingColor);\n\t\t\tsetDraftColor(resetColor);\n\t\t\tsetPreviousWorkingColor(resetColor);\n\t\t}\n\t}\n\n\t// A controlled `valueWorking` always wins. The draft is only used for it while it describes\n\t// the same hex, so partial RGB input and hue are kept while the parent accepts each change.\n\tconst workingColor = useMemo(\n\t\t() =>\n\t\t\tvalueWorkingProp !== undefined && draftColor.hex !== valueWorkingProp\n\t\t\t\t? (ColorUtils.getNewColor(\n\t\t\t\t\t\t{ hex: valueWorkingProp },\n\t\t\t\t\t\tvalidateWorkingColor\n\t\t\t\t\t) as WorkingColor)\n\t\t\t\t: draftColor,\n\t\t[valueWorkingProp, draftColor, validateWorkingColor]\n\t);\n\n\t// Derived from `value` on every render rather than seeded once\n\tconst isValueValid = useMemo(\n\t\t() => isValidColor(value, events.onValidateColor),\n\t\t[value, events.onValidateColor]\n\t);\n\tconst colorErrorMessage =\n\t\terrorTextProp || (isValueValid ? '' : labels.invalidColor || '');\n\n\t// Check props on mount (development only)\n\tuseEffect(() => {\n\t\t// checkProps is a no-op in production\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t(checkProps as any)(\n\t\t\tCOLOR_PICKER,\n\t\t\t{\n\t\t\t\tassistiveText: assistiveTextProp,\n\t\t\t\tclassName,\n\t\t\t\tclassNameMenu,\n\t\t\t\tid: idProp,\n\t\t\t\tdisabled,\n\t\t\t\terrorText: errorTextProp,\n\t\t\t\terrorTextWorkingColor,\n\t\t\t\tevents,\n\t\t\t\thasStaticAlignment,\n\t\t\t\thideInput,\n\t\t\t\tisOpen: isOpenProp,\n\t\t\t\tlabels: labelsProp,\n\t\t\t\tmenuPosition,\n\t\t\t\tswatchColors,\n\t\t\t\tdefaultSelectedTab,\n\t\t\t\tvariant,\n\t\t\t\tvalue: valueProp,\n\t\t\t\tvalueWorking: valueWorkingProp,\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\t// Report a new working color. The draft updates, but a controlled `valueWorking` still wins.\n\tconst setNextWorkingColor = useCallback(\n\t\t(event: React.SyntheticEvent, newColor: WorkingColor) => {\n\t\t\tsetPreviousWorkingColor(workingColor);\n\t\t\tsetDraftColor(newColor);\n\n\t\t\tif (events.onWorkingColorChange) {\n\t\t\t\tevents.onWorkingColorChange(event, { color: newColor });\n\t\t\t}\n\t\t},\n\t\t[events, workingColor]\n\t);\n\n\t// Helper to update working color\n\tconst updateWorkingColor = useCallback(\n\t\t(\n\t\t\tevent: React.SyntheticEvent,\n\t\t\tcolorOptions: {\n\t\t\t\thex?: string;\n\t\t\t\tred?: string | number;\n\t\t\t\tgreen?: string | number;\n\t\t\t\tblue?: string | number;\n\t\t\t\thue?: number | string;\n\t\t\t\tsaturation?: number;\n\t\t\t\tvalue?: number;\n\t\t\t}\n\t\t) => {\n\t\t\tsetNextWorkingColor(\n\t\t\t\tevent,\n\t\t\t\tColorUtils.getNewColor(\n\t\t\t\t\tcolorOptions,\n\t\t\t\t\tvalidateWorkingColor,\n\t\t\t\t\tworkingColor\n\t\t\t\t) as WorkingColor\n\t\t\t);\n\t\t},\n\t\t[setNextWorkingColor, validateWorkingColor, workingColor]\n\t);\n\n\t// Event handlers\n\tconst handleSwatchChange = useCallback(\n\t\t(event: React.ChangeEvent<HTMLInputElement>) => {\n\t\t\tupdateWorkingColor(event, { hex: event.target.value });\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\t// Request a close. Uncontrolled, the popover closes itself; controlled, the parent decides.\n\tconst requestClose = useCallback(\n\t\t(event: React.SyntheticEvent, data: { trigger: string }) => {\n\t\t\tsetIsOpen(false);\n\n\t\t\tif (onRequestClose) {\n\t\t\t\tonRequestClose(event, data);\n\t\t\t}\n\t\t},\n\t\t[setIsOpen, onRequestClose]\n\t);\n\n\tconst handleCancel = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\trequestClose(event, { trigger: 'cancel' });\n\t\t},\n\t\t[requestClose]\n\t);\n\n\tconst handleColorChange = useCallback(\n\t\t(property: 'hex' | 'red' | 'green' | 'blue') =>\n\t\t\t(event: React.SyntheticEvent, data: InputChangeData) => {\n\t\t\t\tconst colorProperties: Record<string, string | number> = {};\n\t\t\t\tcolorProperties[property] = data.value;\n\t\t\t\tupdateWorkingColor(event, colorProperties);\n\t\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\tconst handleHueChange = useCallback(\n\t\t(event: React.ChangeEvent<HTMLInputElement>) => {\n\t\t\tupdateWorkingColor(event, { hue: event.target.value });\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\t// The summary input is controlled by `value`: report the typed text and let the parent decide\n\tconst handleHexInputChange = useCallback(\n\t\t(event: React.SyntheticEvent, data: InputChangeData) => {\n\t\t\tconst isValid = isValidColor(data.value, events.onValidateColor);\n\n\t\t\tif (events.onChange) {\n\t\t\t\tevents.onChange(event, { color: data.value, isValid });\n\t\t\t}\n\t\t},\n\t\t[events]\n\t);\n\n\tconst handleNavigate = useCallback(\n\t\t(property: 'saturation' | 'value') =>\n\t\t\t(event: React.KeyboardEvent, data: { delta: number }) => {\n\t\t\t\tconst colorProperties: Record<string, number> = {};\n\t\t\t\tcolorProperties[property] = data.delta;\n\t\t\t\tsetNextWorkingColor(\n\t\t\t\t\tevent,\n\t\t\t\t\tColorUtils.getDeltaColor(\n\t\t\t\t\t\tcolorProperties,\n\t\t\t\t\t\tvalidateWorkingColor,\n\t\t\t\t\t\tworkingColor\n\t\t\t\t\t) as WorkingColor\n\t\t\t\t);\n\t\t\t},\n\t\t[setNextWorkingColor, validateWorkingColor, workingColor]\n\t);\n\n\tconst handleSaturationValueChange = useCallback(\n\t\t(\n\t\t\tevent: React.MouseEvent | React.KeyboardEvent,\n\t\t\tdata: { saturation: number; value: number }\n\t\t) => {\n\t\t\tupdateWorkingColor(event, {\n\t\t\t\tsaturation: data.saturation,\n\t\t\t\tvalue: data.value,\n\t\t\t});\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\tconst handleSubmitButtonClick = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tif (events.onChange) {\n\t\t\t\tevents.onChange(event, {\n\t\t\t\t\tcolor: workingColor.hex,\n\t\t\t\t\tisValid: true,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\trequestClose(event, { trigger: 'submit' });\n\t\t},\n\t\t[events, requestClose, workingColor.hex]\n\t);\n\n\t// While open, Popover has already requested a close (`triggerClick`) for this click\n\tconst handleSwatchButtonClick = useCallback(() => {\n\t\tif (!isOpen) {\n\t\t\tsetIsOpen(true);\n\n\t\t\tif (onRequestOpen) {\n\t\t\t\tonRequestOpen();\n\t\t\t}\n\t\t}\n\t}, [isOpen, setIsOpen, onRequestOpen]);\n\n\tconst handleSwatchSelect = useCallback(\n\t\t(event: React.MouseEvent | React.KeyboardEvent, data: { hex: string }) => {\n\t\t\tupdateWorkingColor(event, { hex: data.hex });\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\t// Render helpers\n\tconst renderInput = () => {\n\t\tif (hideInput) return null;\n\n\t\treturn (\n\t\t\t<Input\n\t\t\t\taria-describedby={\n\t\t\t\t\t!isOpen && colorErrorMessage\n\t\t\t\t\t\t? `color-picker-summary-error-${componentId}`\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-color-picker__summary-input',\n\t\t\t\t\t'slds-align-top',\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-has-error': !!colorErrorMessage,\n\t\t\t\t\t}\n\t\t\t\t)}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tid={`color-picker-summary-input-${componentId}`}\n\t\t\t\tonChange={handleHexInputChange}\n\t\t\t\tvalue={value}\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderDefaultTab = () => {\n\t\tif (variant !== 'base' && variant !== 'swatches') return null;\n\n\t\treturn (\n\t\t\t<TabsPanel label={labels.swatchTab ?? ''}>\n\t\t\t\t<SwatchPicker\n\t\t\t\t\tcolor={workingColor}\n\t\t\t\t\tlabels={labels}\n\t\t\t\t\tonSelect={handleSwatchSelect}\n\t\t\t\t\tswatchColors={swatchColors}\n\t\t\t\t/>\n\t\t\t</TabsPanel>\n\t\t);\n\t};\n\n\tconst renderCustomTab = () => {\n\t\tif (variant !== 'base' && variant !== 'custom') return null;\n\n\t\treturn (\n\t\t\t<TabsPanel label={labels.customTab ?? ''}>\n\t\t\t\t<CustomColor\n\t\t\t\t\tassistiveText={assistiveText}\n\t\t\t\t\tid={componentId}\n\t\t\t\t\tcolor={workingColor}\n\t\t\t\t\terrorTextWorkingColor={errorTextWorkingColor}\n\t\t\t\t\tpreviousColor={previousWorkingColor}\n\t\t\t\t\tlabels={labels}\n\t\t\t\t\tonBlueChange={handleColorChange('blue')}\n\t\t\t\t\tonGreenChange={handleColorChange('green')}\n\t\t\t\t\tonHexChange={handleColorChange('hex')}\n\t\t\t\t\tonHueChange={handleHueChange}\n\t\t\t\t\tonRedChange={handleColorChange('red')}\n\t\t\t\t\tonSwatchChange={handleSwatchChange}\n\t\t\t\t\tonSaturationValueChange={handleSaturationValueChange}\n\t\t\t\t\tonSaturationNavigate={handleNavigate('saturation')}\n\t\t\t\t\tonValueNavigate={handleNavigate('value')}\n\t\t\t\t/>\n\t\t\t</TabsPanel>\n\t\t);\n\t};\n\n\tconst popoverBody = (\n\t\t<ColorPickerTabs\n\t\t\tid={`color-picker-tabs-${componentId}`}\n\t\t\tdefaultValue={defaultSelectedTab === 'custom' ? '1' : '0'}\n\t\t>\n\t\t\t{renderDefaultTab()}\n\t\t\t{renderCustomTab()}\n\t\t</ColorPickerTabs>\n\t);\n\n\tconst popoverFooter = (\n\t\t<div className=\"slds-color-picker__selector-footer\">\n\t\t\t<Button\n\t\t\t\tclassName=\"slds-color-picker__selector-cancel\"\n\t\t\t\tid={`color-picker-footer-cancel-${componentId}`}\n\t\t\t\tlabel={labels.cancelButton}\n\t\t\t\tonClick={handleCancel}\n\t\t\t\tvariant=\"neutral\"\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\tclassName=\"slds-color-picker__selector-submit\"\n\t\t\t\tdisabled={Object.keys(workingColor.errors || {}).length > 0}\n\t\t\t\tid={`color-picker-footer-submit-${componentId}`}\n\t\t\t\tlabel={labels.submitButton}\n\t\t\t\tonClick={handleSubmitButtonClick}\n\t\t\t\tvariant=\"brand\"\n\t\t\t/>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames('slds-color-picker', className)}\n\t\t\tref={wrapperRef}\n\t\t>\n\t\t\t<div className=\"slds-color-picker__summary\">\n\t\t\t\t<label\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t'slds-color-picker__summary-label',\n\t\t\t\t\t\tassistiveText.label ? 'slds-assistive-text' : ''\n\t\t\t\t\t)}\n\t\t\t\t\thtmlFor={\n\t\t\t\t\t\t!hideInput ? `color-picker-summary-input-${componentId}` : undefined\n\t\t\t\t\t}\n\t\t\t\t\tid={`color-picker-label-${componentId}`}\n\t\t\t\t>\n\t\t\t\t\t{assistiveText.label ? assistiveText.label : labels.label}\n\t\t\t\t</label>\n\t\t\t\t<Popover\n\t\t\t\t\tariaLabelledby={`color-picker-label-${componentId}`}\n\t\t\t\t\talign=\"bottom left\"\n\t\t\t\t\tbody={popoverBody}\n\t\t\t\t\tclassNameDialog={classNames(\n\t\t\t\t\t\t'slds-color-picker__selector',\n\t\t\t\t\t\tclassNameMenu\n\t\t\t\t\t)}\n\t\t\t\t\tfooter={popoverFooter}\n\t\t\t\t\thasNoCloseButton\n\t\t\t\t\thasNoNubbin\n\t\t\t\t\thasStaticAlignment={hasStaticAlignment}\n\t\t\t\t\tid={`slds-color-picker__selector-${componentId}`}\n\t\t\t\t\tisOpen={isOpen}\n\t\t\t\t\tonClose={\n\t\t\t\t\t\tonClose as unknown as\n\t\t\t\t\t\t\t| ((\n\t\t\t\t\t\t\t\t\tevent?: unknown,\n\t\t\t\t\t\t\t\t\tdata?: { componentWillUnmount?: boolean }\n\t\t\t\t\t\t\t ) => void)\n\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t}\n\t\t\t\t\tonOpen={\n\t\t\t\t\t\tonOpen as unknown as\n\t\t\t\t\t\t\t| ((event?: unknown, data?: { portal?: HTMLElement }) => void)\n\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t}\n\t\t\t\t\tonRequestClose={\n\t\t\t\t\t\trequestClose as unknown as\n\t\t\t\t\t\t\t| ((event?: unknown, data?: { trigger?: string }) => void)\n\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t}\n\t\t\t\t\tposition={menuPosition}\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"slds-color-picker__summary-button\"\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\ticonClassName=\"slds-m-left_xx-small\"\n\t\t\t\t\t\ticonPosition=\"right\"\n\t\t\t\t\t\ticonVariant=\"more\"\n\t\t\t\t\t\tid={`slds-color-picker__summary-button-${componentId}`}\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t\t\t\t\t{assistiveText.label ? assistiveText.label : labels.label}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<Swatch color={value} labels={labels} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={handleSwatchButtonClick}\n\t\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t\t/>\n\t\t\t\t</Popover>\n\t\t\t\t{renderInput()}\n\t\t\t\t{!isOpen && colorErrorMessage && (\n\t\t\t\t\t<p\n\t\t\t\t\t\tclassName=\"slds-form-error\"\n\t\t\t\t\t\tid={`color-picker-summary-error-${componentId}`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{colorErrorMessage}\n\t\t\t\t\t</p>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nColorPicker.displayName = COLOR_PICKER;\n\nexport default ColorPicker;\n"],"mappings":";;;;;;;;;;;;;;;;;AAyJA,IAAM,KAAmC;CACxC,iBAAiB;CACjB,cAAc;CACd,WAAW;CACX,mCAAmC;CACnC,4BAA4B;CAC5B,kBAAkB;CAClB,UAAU;CACV,cAAc;CACd,kBAAkB;CAClB,gBAAgB;CAChB,cAAc;CACd,WAAW;CACX,4BAA4B;AAC7B,GAEM,KAAiD;CACtD,qBACC;CACD,WAAW;AACZ,GAEM,KAAsB,4PA8B5B,GAKM,KACL,GACA,MACkB;CAClB,IAAM,IAAgB,EAAW,qBAAqB,CAAK;CAC3D,OAAO,EAAW,YACjB;EACC,KAAK,KAAiB;EACtB,MAAM,IAAgB,EAAM,YAAY,IAAI;CAC7C,GACA,CACD;AACD,GAGM,KAAgB,GAAe,MAChC,IACI,CAAC,CAAC,EAAU,CAAK,IAElB,EAAW,qBAAqB,CAAK,IACzC,KACA,EAAW,WAAW,CAAK,GASzB,KAA2C,EAChD,eAAe,GACf,cACA,kBACA,IAAI,GACJ,oBAAgB,IAChB,cAAW,IACX,WAAW,GACX,0BACA,YAAS,CAAC,GACV,uBACA,eAAY,IACZ,QAAQ,GACR,QAAQ,GACR,kBAAe,YACf,kBAAe,IACf,wBAAqB,YACrB,aAAU,QACV,OAAO,GACP,cAAc,GACd,aACA,YACA,mBACA,uBACK;CAEL,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,SAAQ;KACR,CAAA;IACO,CAAA;IACR,GAAY;IACZ,CAAC,KAAU,KACX,kBAAC,KAAD;KACC,WAAU;KACV,IAAI,8BAA8B;KAEjC,UAAA;IACC,CAAA;GAEA;;CACD,CAAA;AAEP;AAEA,EAAY,cAAc"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import e from "../../tabs/index.js";
|
|
2
|
+
import { useState as t } from "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region components/color-picker/private/color-picker-tabs.tsx
|
|
5
|
+
var r = ({ children: r, defaultValue: i, id: a }) => {
|
|
6
|
+
let [o, s] = t(i);
|
|
7
|
+
return /* @__PURE__ */ n(e, {
|
|
8
|
+
id: a,
|
|
9
|
+
onSelect: (e, t) => s(t.value),
|
|
10
|
+
value: o,
|
|
11
|
+
children: r
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { r as default };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=color-picker-tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-picker-tabs.js","names":[],"sources":["../../../../../components/color-picker/private/color-picker-tabs.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport { useState, type ReactNode } from 'react';\n\nimport Tabs from '../../tabs';\n\ninterface ColorPickerTabsProps {\n\tchildren: ReactNode;\n\t/** `value` of the tab shown when the popover opens */\n\tdefaultValue: string;\n\tid: string;\n}\n\n/**\n * `Tabs` is controlled, so the selected tab lives here. The popover body\n * remounts on every open, so each open starts at `defaultValue`.\n */\nconst ColorPickerTabs = ({\n\tchildren,\n\tdefaultValue,\n\tid,\n}: ColorPickerTabsProps) => {\n\tconst [value, setValue] = useState(defaultValue);\n\treturn (\n\t\t<Tabs\n\t\t\tid={id}\n\t\t\tonSelect={(event, data) => setValue(data.value)}\n\t\t\tvalue={value}\n\t\t>\n\t\t\t{children}\n\t\t</Tabs>\n\t);\n};\n\nexport default ColorPickerTabs;\n"],"mappings":";;;;AAkBA,IAAM,KAAmB,EACxB,aACA,iBACA,YAC2B;CAC3B,IAAM,CAAC,GAAO,KAAY,EAAS,CAAY;CAC/C,OACC,kBAAC,GAAD;EACK;EACJ,WAAW,GAAO,MAAS,EAAS,EAAK,KAAK;EACvC;EAEN;CACI,CAAA;AAER"}
|