@salesforce/design-system-react 11.0.0-alpha.5 → 11.0.0-alpha.7
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/panel.cjs +1 -1
- package/dist/cjs/components/accordion/panel.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/badge/index.cjs +1 -1
- package/dist/cjs/components/badge/index.cjs.map +1 -1
- package/dist/cjs/components/breadcrumb/index.cjs +1 -1
- package/dist/cjs/components/breadcrumb/index.cjs.map +1 -1
- package/dist/cjs/components/builder-header/check-props.cjs +2 -0
- package/dist/cjs/components/builder-header/check-props.cjs.map +1 -0
- package/dist/cjs/components/builder-header/component.cjs +2 -0
- package/dist/cjs/components/builder-header/component.cjs.map +1 -0
- package/dist/cjs/components/builder-header/toolbar.cjs +1 -1
- package/dist/cjs/components/builder-header/toolbar.cjs.map +1 -1
- package/dist/cjs/components/button/index.cjs +1 -1
- package/dist/cjs/components/button/index.cjs.map +1 -1
- 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/check-props.cjs +2 -0
- package/dist/cjs/components/carousel/check-props.cjs.map +1 -0
- package/dist/cjs/components/carousel/component.cjs +2 -0
- package/dist/cjs/components/carousel/component.cjs.map +1 -0
- package/dist/cjs/components/carousel/index.cjs +1 -1
- package/dist/cjs/components/carousel/index.cjs.map +1 -1
- package/dist/cjs/components/carousel/private/carousel-item.cjs +1 -1
- package/dist/cjs/components/carousel/private/carousel-item.cjs.map +1 -1
- package/dist/cjs/components/checkbox/check-props.cjs +2 -0
- package/dist/cjs/components/checkbox/check-props.cjs.map +1 -0
- package/dist/cjs/components/checkbox/component.cjs +2 -0
- package/dist/cjs/components/checkbox/component.cjs.map +1 -0
- 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/color-picker.cjs.map +1 -1
- package/dist/cjs/components/combobox/add-subheadings.cjs +1 -1
- package/dist/cjs/components/combobox/add-subheadings.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/filter.cjs +1 -1
- package/dist/cjs/components/combobox/filter.cjs.map +1 -1
- package/dist/cjs/components/combobox/index.cjs.map +1 -1
- package/dist/cjs/components/combobox/private/menu.cjs +1 -1
- package/dist/cjs/components/combobox/private/menu.cjs.map +1 -1
- package/dist/cjs/components/date-picker/check-props.cjs +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/dynamic-icon/index.cjs +1 -1
- package/dist/cjs/components/dynamic-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/search.cjs +1 -1
- package/dist/cjs/components/input/search.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/button-trigger.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/check-props.cjs +1 -1
- package/dist/cjs/components/menu-dropdown/check-props.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/page-header/check-props.cjs +2 -0
- package/dist/cjs/components/page-header/check-props.cjs.map +1 -0
- package/dist/cjs/components/page-header/component.cjs +2 -0
- package/dist/cjs/components/page-header/component.cjs.map +1 -0
- package/dist/cjs/components/page-header/index.cjs +1 -1
- package/dist/cjs/components/page-header/index.cjs.map +1 -1
- package/dist/cjs/components/page-header/private/base/index.cjs +1 -1
- package/dist/cjs/components/page-header/private/base/index.cjs.map +1 -1
- package/dist/cjs/components/page-header/private/controls.cjs +1 -1
- package/dist/cjs/components/page-header/private/controls.cjs.map +1 -1
- package/dist/cjs/components/page-header/private/object-home/index.cjs +1 -1
- package/dist/cjs/components/page-header/private/object-home/index.cjs.map +1 -1
- package/dist/cjs/components/page-header/private/record-home/index.cjs +1 -1
- package/dist/cjs/components/page-header/private/record-home/index.cjs.map +1 -1
- package/dist/cjs/components/page-header/private/related-list/index.cjs +1 -1
- package/dist/cjs/components/page-header/private/related-list/index.cjs.map +1 -1
- package/dist/cjs/components/pill-container/check-props.cjs +2 -0
- package/dist/cjs/components/pill-container/check-props.cjs.map +1 -0
- package/dist/cjs/components/pill-container/component.cjs +2 -0
- package/dist/cjs/components/pill-container/component.cjs.map +1 -0
- package/dist/cjs/components/pill-container/index.cjs +1 -1
- package/dist/cjs/components/pill-container/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/progress-indicator/check-props.cjs +1 -1
- package/dist/cjs/components/progress-indicator/check-props.cjs.map +1 -1
- package/dist/cjs/components/progress-indicator/component.cjs +2 -0
- package/dist/cjs/components/progress-indicator/component.cjs.map +1 -0
- package/dist/cjs/components/progress-indicator/index.cjs +1 -1
- package/dist/cjs/components/progress-indicator/index.cjs.map +1 -1
- package/dist/cjs/components/progress-indicator/private/step-vertical.cjs +1 -1
- package/dist/cjs/components/progress-indicator/private/step-vertical.cjs.map +1 -1
- package/dist/cjs/components/radio/check-props.cjs +2 -0
- package/dist/cjs/components/radio/check-props.cjs.map +1 -0
- package/dist/cjs/components/radio/component.cjs +2 -0
- package/dist/cjs/components/radio/component.cjs.map +1 -0
- package/dist/cjs/components/radio/index.cjs +1 -1
- package/dist/cjs/components/radio/index.cjs.map +1 -1
- package/dist/cjs/components/setup-assistant/check-props.cjs +1 -1
- package/dist/cjs/components/setup-assistant/check-props.cjs.map +1 -1
- package/dist/cjs/components/setup-assistant/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/index.cjs +1 -1
- package/dist/cjs/components/simple-data-table/index.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/row-actions.cjs +1 -1
- package/dist/cjs/components/simple-data-table/row-actions.cjs.map +1 -1
- package/dist/cjs/components/slider/check-props.cjs +2 -0
- package/dist/cjs/components/slider/check-props.cjs.map +1 -0
- package/dist/cjs/components/slider/component.cjs +2 -0
- package/dist/cjs/components/slider/component.cjs.map +1 -0
- package/dist/cjs/components/slider/index.cjs +1 -1
- package/dist/cjs/components/slider/index.cjs.map +1 -1
- package/dist/cjs/components/spinner/index.cjs +1 -1
- package/dist/cjs/components/spinner/index.cjs.map +1 -1
- package/dist/cjs/components/split-view/check-props.cjs +2 -0
- package/dist/cjs/components/split-view/check-props.cjs.map +1 -0
- package/dist/cjs/components/split-view/component.cjs +2 -0
- package/dist/cjs/components/split-view/component.cjs.map +1 -0
- package/dist/cjs/components/split-view/header.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 +2 -0
- package/dist/cjs/components/split-view/listbox-check-props.cjs.map +1 -0
- 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/split-view/private/list-item-content.cjs +1 -1
- package/dist/cjs/components/split-view/private/list-item-content.cjs.map +1 -1
- package/dist/cjs/components/split-view/private/list-item-with-content.cjs +1 -1
- package/dist/cjs/components/split-view/private/list-item-with-content.cjs.map +1 -1
- package/dist/cjs/components/split-view/private/toggle-button.cjs +1 -1
- package/dist/cjs/components/split-view/private/toggle-button.cjs.map +1 -1
- 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 +2 -0
- package/dist/cjs/components/textarea/check-props.cjs.map +1 -0
- package/dist/cjs/components/textarea/component.cjs +2 -0
- package/dist/cjs/components/textarea/component.cjs.map +1 -0
- package/dist/cjs/components/textarea/index.cjs +1 -1
- package/dist/cjs/components/textarea/index.cjs.map +1 -1
- package/dist/cjs/components/toast/index.cjs +1 -1
- package/dist/cjs/components/toast/index.cjs.map +1 -1
- package/dist/cjs/components/tooltip/check-props.cjs +1 -1
- package/dist/cjs/components/tooltip/check-props.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/component.cjs +2 -0
- package/dist/cjs/components/tree/component.cjs.map +1 -0
- package/dist/cjs/components/tree/private/branch.cjs.map +1 -1
- package/dist/cjs/components/tree/private/item.cjs.map +1 -1
- package/dist/cjs/components/tree/private/render-branch.cjs.map +1 -1
- package/dist/cjs/components/tree/private/render-initial-branch.cjs +1 -1
- package/dist/cjs/components/tree/private/render-initial-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/trial-bar/check-props.cjs +2 -0
- package/dist/cjs/components/trial-bar/check-props.cjs.map +1 -0
- package/dist/cjs/components/trial-bar/component.cjs +2 -0
- package/dist/cjs/components/trial-bar/component.cjs.map +1 -0
- package/dist/cjs/components/trial-bar/index.cjs +1 -1
- package/dist/cjs/components/trial-bar/index.cjs.map +1 -1
- package/dist/cjs/components/utilities/menu-list/index.cjs +1 -1
- package/dist/cjs/components/utilities/menu-list/index.cjs.map +1 -1
- package/dist/cjs/components/utilities/menu-list/item.cjs +1 -1
- package/dist/cjs/components/utilities/menu-list/item.cjs.map +1 -1
- package/dist/cjs/components/utilities/utility-icon/index.cjs +1 -1
- package/dist/cjs/components/utilities/utility-icon/index.cjs.map +1 -1
- package/dist/cjs/components/vertical-navigation/index.cjs.map +1 -1
- package/dist/cjs/components/vertical-navigation/private/item.cjs +1 -1
- package/dist/cjs/components/vertical-navigation/private/item.cjs.map +1 -1
- package/dist/cjs/components/welcome-mat/check-props.cjs +2 -0
- package/dist/cjs/components/welcome-mat/check-props.cjs.map +1 -0
- package/dist/cjs/components/welcome-mat/component.cjs +2 -0
- package/dist/cjs/components/welcome-mat/component.cjs.map +1 -0
- package/dist/cjs/components/welcome-mat/index.cjs +1 -1
- package/dist/cjs/components/welcome-mat/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/constants.cjs +1 -1
- package/dist/cjs/utilities/constants.cjs.map +1 -1
- package/dist/es/components/accordion/panel.js +1 -1
- package/dist/es/components/accordion/panel.js.map +1 -1
- package/dist/es/components/avatar/index.js +1 -1
- package/dist/es/components/avatar/index.js.map +1 -1
- package/dist/es/components/badge/index.js +6 -5
- package/dist/es/components/badge/index.js.map +1 -1
- package/dist/es/components/breadcrumb/index.js +1 -1
- package/dist/es/components/breadcrumb/index.js.map +1 -1
- package/dist/es/components/builder-header/check-props.js +13 -0
- package/dist/es/components/builder-header/check-props.js.map +1 -0
- package/dist/es/components/builder-header/component.js +65 -0
- package/dist/es/components/builder-header/component.js.map +1 -0
- package/dist/es/components/builder-header/toolbar.js +18 -13
- package/dist/es/components/builder-header/toolbar.js.map +1 -1
- package/dist/es/components/button/index.js +1 -1
- package/dist/es/components/button/index.js.map +1 -1
- package/dist/es/components/button-stateful/index.js +1 -1
- package/dist/es/components/button-stateful/index.js.map +1 -1
- package/dist/es/components/carousel/check-props.js +13 -0
- package/dist/es/components/carousel/check-props.js.map +1 -0
- package/dist/es/components/carousel/component.js +27 -0
- package/dist/es/components/carousel/component.js.map +1 -0
- package/dist/es/components/carousel/index.js +121 -113
- package/dist/es/components/carousel/index.js.map +1 -1
- package/dist/es/components/carousel/private/carousel-item.js +1 -2
- package/dist/es/components/carousel/private/carousel-item.js.map +1 -1
- package/dist/es/components/checkbox/check-props.js +14 -0
- package/dist/es/components/checkbox/check-props.js.map +1 -0
- package/dist/es/components/checkbox/component.js +35 -0
- package/dist/es/components/checkbox/component.js.map +1 -0
- package/dist/es/components/checkbox/index.js +125 -113
- package/dist/es/components/checkbox/index.js.map +1 -1
- package/dist/es/components/color-picker/color-picker.js.map +1 -1
- package/dist/es/components/combobox/add-subheadings.js +2 -1
- package/dist/es/components/combobox/add-subheadings.js.map +1 -1
- package/dist/es/components/combobox/check-props.js +15 -5
- package/dist/es/components/combobox/check-props.js.map +1 -1
- package/dist/es/components/combobox/combobox.js +292 -277
- package/dist/es/components/combobox/combobox.js.map +1 -1
- package/dist/es/components/combobox/filter.js +1 -1
- package/dist/es/components/combobox/filter.js.map +1 -1
- package/dist/es/components/combobox/index.js.map +1 -1
- package/dist/es/components/combobox/private/menu.js +7 -7
- package/dist/es/components/combobox/private/menu.js.map +1 -1
- package/dist/es/components/date-picker/check-props.js +4 -4
- package/dist/es/components/date-picker/date-picker.js +149 -142
- 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/dynamic-icon/index.js +1 -1
- package/dist/es/components/dynamic-icon/index.js.map +1 -1
- package/dist/es/components/index.js +41 -43
- package/dist/es/components/input/check-props.js +17 -18
- package/dist/es/components/input/check-props.js.map +1 -1
- package/dist/es/components/input/index.js +138 -136
- package/dist/es/components/input/index.js.map +1 -1
- package/dist/es/components/input/search.js +1 -1
- package/dist/es/components/input/search.js.map +1 -1
- package/dist/es/components/menu-dropdown/button-trigger.js.map +1 -1
- package/dist/es/components/menu-dropdown/check-props.js +6 -6
- package/dist/es/components/menu-dropdown/check-props.js.map +1 -1
- package/dist/es/components/menu-dropdown/index.js.map +1 -1
- package/dist/es/components/menu-dropdown/menu-dropdown.js +236 -232
- package/dist/es/components/menu-dropdown/menu-dropdown.js.map +1 -1
- package/dist/es/components/modal/index.js +104 -132
- package/dist/es/components/modal/index.js.map +1 -1
- package/dist/es/components/page-header/check-props.js +31 -0
- package/dist/es/components/page-header/check-props.js.map +1 -0
- package/dist/es/components/page-header/component.js +35 -0
- package/dist/es/components/page-header/component.js.map +1 -0
- package/dist/es/components/page-header/index.js +56 -38
- package/dist/es/components/page-header/index.js.map +1 -1
- package/dist/es/components/page-header/private/base/index.js +1 -1
- package/dist/es/components/page-header/private/base/index.js.map +1 -1
- package/dist/es/components/page-header/private/controls.js +1 -1
- package/dist/es/components/page-header/private/controls.js.map +1 -1
- package/dist/es/components/page-header/private/object-home/index.js +4 -4
- package/dist/es/components/page-header/private/object-home/index.js.map +1 -1
- package/dist/es/components/page-header/private/record-home/index.js +1 -1
- package/dist/es/components/page-header/private/record-home/index.js.map +1 -1
- package/dist/es/components/page-header/private/related-list/index.js +2 -2
- package/dist/es/components/page-header/private/related-list/index.js.map +1 -1
- package/dist/es/components/pill-container/check-props.js +13 -0
- package/dist/es/components/pill-container/check-props.js.map +1 -0
- package/dist/es/components/pill-container/component.js +31 -0
- package/dist/es/components/pill-container/component.js.map +1 -0
- package/dist/es/components/pill-container/index.js +65 -56
- package/dist/es/components/pill-container/index.js.map +1 -1
- package/dist/es/components/popover/index.js.map +1 -1
- package/dist/es/components/popover/popover.js +147 -146
- package/dist/es/components/popover/popover.js.map +1 -1
- package/dist/es/components/progress-indicator/check-props.js +11 -8
- package/dist/es/components/progress-indicator/check-props.js.map +1 -1
- package/dist/es/components/progress-indicator/component.js +35 -0
- package/dist/es/components/progress-indicator/component.js.map +1 -0
- package/dist/es/components/progress-indicator/index.js +74 -71
- package/dist/es/components/progress-indicator/index.js.map +1 -1
- package/dist/es/components/progress-indicator/private/step-vertical.js +23 -20
- package/dist/es/components/progress-indicator/private/step-vertical.js.map +1 -1
- package/dist/es/components/radio/check-props.js +13 -0
- package/dist/es/components/radio/check-props.js.map +1 -0
- package/dist/es/components/radio/component.js +24 -0
- package/dist/es/components/radio/component.js.map +1 -0
- package/dist/es/components/radio/index.js +94 -80
- package/dist/es/components/radio/index.js.map +1 -1
- package/dist/es/components/setup-assistant/check-props.js +12 -7
- package/dist/es/components/setup-assistant/check-props.js.map +1 -1
- package/dist/es/components/setup-assistant/index.js.map +1 -1
- package/dist/es/components/setup-assistant/step.js +8 -8
- package/dist/es/components/setup-assistant/step.js.map +1 -1
- package/dist/es/components/simple-data-table/check-props.js +4 -4
- package/dist/es/components/simple-data-table/check-props.js.map +1 -1
- package/dist/es/components/simple-data-table/index.js +17 -10
- package/dist/es/components/simple-data-table/index.js.map +1 -1
- package/dist/es/components/simple-data-table/row-actions.js +2 -2
- package/dist/es/components/simple-data-table/row-actions.js.map +1 -1
- package/dist/es/components/slider/check-props.js +17 -0
- package/dist/es/components/slider/check-props.js.map +1 -0
- package/dist/es/components/slider/component.js +35 -0
- package/dist/es/components/slider/component.js.map +1 -0
- package/dist/es/components/slider/index.js +69 -53
- package/dist/es/components/slider/index.js.map +1 -1
- package/dist/es/components/spinner/index.js +1 -1
- package/dist/es/components/spinner/index.js.map +1 -1
- package/dist/es/components/split-view/check-props.js +13 -0
- package/dist/es/components/split-view/check-props.js.map +1 -0
- package/dist/es/components/split-view/component.js +46 -0
- package/dist/es/components/split-view/component.js.map +1 -0
- package/dist/es/components/split-view/header.js.map +1 -1
- package/dist/es/components/split-view/index.js +45 -36
- package/dist/es/components/split-view/index.js.map +1 -1
- package/dist/es/components/split-view/listbox-check-props.js +13 -0
- package/dist/es/components/split-view/listbox-check-props.js.map +1 -0
- package/dist/es/components/split-view/listbox.js +41 -35
- package/dist/es/components/split-view/listbox.js.map +1 -1
- package/dist/es/components/split-view/private/list-item-content.js +1 -1
- package/dist/es/components/split-view/private/list-item-content.js.map +1 -1
- package/dist/es/components/split-view/private/list-item-with-content.js +6 -1
- package/dist/es/components/split-view/private/list-item-with-content.js.map +1 -1
- package/dist/es/components/split-view/private/toggle-button.js +2 -2
- package/dist/es/components/split-view/private/toggle-button.js.map +1 -1
- package/dist/es/components/tabs/index.js +64 -64
- 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 +18 -0
- package/dist/es/components/textarea/check-props.js.map +1 -0
- package/dist/es/components/textarea/component.js +27 -0
- package/dist/es/components/textarea/component.js.map +1 -0
- package/dist/es/components/textarea/index.js +62 -46
- package/dist/es/components/textarea/index.js.map +1 -1
- package/dist/es/components/toast/index.js +18 -12
- package/dist/es/components/toast/index.js.map +1 -1
- package/dist/es/components/tooltip/check-props.js +9 -23
- package/dist/es/components/tooltip/check-props.js.map +1 -1
- package/dist/es/components/tooltip/index.js +70 -70
- package/dist/es/components/tooltip/index.js.map +1 -1
- package/dist/es/components/tree/check-props.js +13 -12
- package/dist/es/components/tree/check-props.js.map +1 -1
- package/dist/es/components/tree/component.js +25 -0
- package/dist/es/components/tree/component.js.map +1 -0
- package/dist/es/components/tree/private/branch.js.map +1 -1
- package/dist/es/components/tree/private/item.js.map +1 -1
- package/dist/es/components/tree/private/render-branch.js.map +1 -1
- package/dist/es/components/tree/private/render-initial-branch.js +5 -2
- package/dist/es/components/tree/private/render-initial-branch.js.map +1 -1
- package/dist/es/components/tree/tree.js +92 -65
- package/dist/es/components/tree/tree.js.map +1 -1
- package/dist/es/components/trial-bar/check-props.js +13 -0
- package/dist/es/components/trial-bar/check-props.js.map +1 -0
- package/dist/es/components/trial-bar/component.js +24 -0
- package/dist/es/components/trial-bar/component.js.map +1 -0
- package/dist/es/components/trial-bar/index.js +27 -21
- package/dist/es/components/trial-bar/index.js.map +1 -1
- package/dist/es/components/utilities/menu-list/index.js +1 -0
- package/dist/es/components/utilities/menu-list/index.js.map +1 -1
- package/dist/es/components/utilities/menu-list/item.js +6 -4
- package/dist/es/components/utilities/menu-list/item.js.map +1 -1
- package/dist/es/components/utilities/utility-icon/index.js +2 -1
- package/dist/es/components/utilities/utility-icon/index.js.map +1 -1
- package/dist/es/components/vertical-navigation/index.js.map +1 -1
- package/dist/es/components/vertical-navigation/private/item.js +1 -1
- package/dist/es/components/vertical-navigation/private/item.js.map +1 -1
- package/dist/es/components/welcome-mat/check-props.js +13 -0
- package/dist/es/components/welcome-mat/check-props.js.map +1 -0
- package/dist/es/components/welcome-mat/component.js +46 -0
- package/dist/es/components/welcome-mat/component.js.map +1 -0
- package/dist/es/components/welcome-mat/index.js +61 -55
- package/dist/es/components/welcome-mat/index.js.map +1 -1
- package/dist/es/components/welcome-mat/info-badge.js +19 -11
- package/dist/es/components/welcome-mat/info-badge.js.map +1 -1
- package/dist/es/utilities/constants.js +2 -2
- package/dist/es/utilities/constants.js.map +1 -1
- package/dist/types/components/accordion/panel.d.ts.map +1 -1
- package/dist/types/components/avatar/index.d.ts +1 -1
- package/dist/types/components/avatar/index.d.ts.map +1 -1
- package/dist/types/components/badge/index.d.ts +4 -2
- package/dist/types/components/badge/index.d.ts.map +1 -1
- package/dist/types/components/breadcrumb/index.d.ts +1 -1
- package/dist/types/components/breadcrumb/index.d.ts.map +1 -1
- package/dist/types/components/builder-header/check-props.d.ts.map +1 -0
- package/dist/types/components/builder-header/toolbar.d.ts +6 -4
- package/dist/types/components/builder-header/toolbar.d.ts.map +1 -1
- package/dist/types/components/button/check-props.d.ts.map +1 -1
- package/dist/types/components/button/index.d.ts +1 -1
- package/dist/types/components/button/index.d.ts.map +1 -1
- package/dist/types/components/button-stateful/index.d.ts +1 -1
- package/dist/types/components/button-stateful/index.d.ts.map +1 -1
- package/dist/types/components/carousel/check-props.d.ts.map +1 -0
- package/dist/types/components/carousel/index.d.ts +38 -9
- package/dist/types/components/carousel/index.d.ts.map +1 -1
- package/dist/types/components/carousel/private/carousel-item.d.ts +5 -5
- package/dist/types/components/carousel/private/carousel-item.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 +10 -9
- package/dist/types/components/checkbox/index.d.ts.map +1 -1
- package/dist/types/components/color-picker/color-picker.d.ts +25 -7
- package/dist/types/components/color-picker/color-picker.d.ts.map +1 -1
- package/dist/types/components/color-picker/index.d.ts +1 -1
- package/dist/types/components/color-picker/index.d.ts.map +1 -1
- package/dist/types/components/combobox/add-subheadings.d.ts +1 -1
- package/dist/types/components/combobox/add-subheadings.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 +80 -33
- package/dist/types/components/combobox/combobox.d.ts.map +1 -1
- package/dist/types/components/combobox/filter.d.ts.map +1 -1
- package/dist/types/components/combobox/index.d.ts +2 -2
- package/dist/types/components/combobox/index.d.ts.map +1 -1
- package/dist/types/components/combobox/private/menu.d.ts +75 -9
- package/dist/types/components/combobox/private/menu.d.ts.map +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts +52 -6
- 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/dynamic-icon/index.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +0 -4
- package/dist/types/components/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.map +1 -1
- package/dist/types/components/input/search.d.ts +1 -1
- package/dist/types/components/input/search.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/button-trigger.d.ts +1 -1
- package/dist/types/components/menu-dropdown/button-trigger.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/check-props.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/index.d.ts +2 -2
- package/dist/types/components/menu-dropdown/index.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/menu-dropdown.d.ts +117 -27
- package/dist/types/components/menu-dropdown/menu-dropdown.d.ts.map +1 -1
- package/dist/types/components/modal/index.d.ts +26 -3
- package/dist/types/components/modal/index.d.ts.map +1 -1
- package/dist/types/components/page-header/check-props.d.ts.map +1 -1
- package/dist/types/components/page-header/index.d.ts +15 -4
- package/dist/types/components/page-header/index.d.ts.map +1 -1
- package/dist/types/components/page-header/private/base/index.d.ts.map +1 -1
- package/dist/types/components/page-header/private/controls.d.ts +4 -4
- package/dist/types/components/page-header/private/controls.d.ts.map +1 -1
- package/dist/types/components/page-header/private/object-home/index.d.ts.map +1 -1
- package/dist/types/components/page-header/private/record-home/index.d.ts.map +1 -1
- package/dist/types/components/page-header/private/types.d.ts +6 -6
- package/dist/types/components/page-header/private/types.d.ts.map +1 -1
- package/dist/types/components/pill-container/check-props.d.ts.map +1 -0
- package/dist/types/components/pill-container/index.d.ts +24 -3
- package/dist/types/components/pill-container/index.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 +41 -12
- package/dist/types/components/popover/popover.d.ts.map +1 -1
- package/dist/types/components/progress-indicator/check-props.d.ts.map +1 -1
- package/dist/types/components/progress-indicator/index.d.ts +7 -1
- package/dist/types/components/progress-indicator/index.d.ts.map +1 -1
- package/dist/types/components/progress-indicator/private/step-vertical.d.ts +4 -7
- package/dist/types/components/progress-indicator/private/step-vertical.d.ts.map +1 -1
- package/dist/types/components/radio/check-props.d.ts +1 -0
- package/dist/types/components/radio/check-props.d.ts.map +1 -1
- package/dist/types/components/radio/index.d.ts +10 -4
- package/dist/types/components/radio/index.d.ts.map +1 -1
- package/dist/types/components/setup-assistant/check-props.d.ts.map +1 -1
- package/dist/types/components/setup-assistant/index.d.ts +7 -3
- package/dist/types/components/setup-assistant/index.d.ts.map +1 -1
- package/dist/types/components/setup-assistant/step.d.ts +19 -7
- 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/index.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/row-actions.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/types.d.ts +21 -8
- package/dist/types/components/simple-data-table/types.d.ts.map +1 -1
- package/dist/types/components/slider/check-props.d.ts.map +1 -0
- package/dist/types/components/slider/index.d.ts +26 -5
- package/dist/types/components/slider/index.d.ts.map +1 -1
- package/dist/types/components/spinner/index.d.ts +1 -1
- package/dist/types/components/spinner/index.d.ts.map +1 -1
- package/dist/types/components/split-view/check-props.d.ts.map +1 -0
- package/dist/types/components/split-view/header.d.ts +3 -3
- package/dist/types/components/split-view/header.d.ts.map +1 -1
- package/dist/types/components/split-view/index.d.ts +34 -8
- package/dist/types/components/split-view/index.d.ts.map +1 -1
- package/dist/types/components/{forms/input/inline-check-props.d.ts → split-view/listbox-check-props.d.ts} +1 -1
- package/dist/types/components/split-view/listbox-check-props.d.ts.map +1 -0
- package/dist/types/components/split-view/listbox.d.ts +45 -26
- package/dist/types/components/split-view/listbox.d.ts.map +1 -1
- package/dist/types/components/split-view/private/list-item-with-content.d.ts +10 -1
- package/dist/types/components/split-view/private/list-item-with-content.d.ts.map +1 -1
- package/dist/types/components/split-view/private/toggle-button.d.ts +3 -3
- package/dist/types/components/split-view/private/toggle-button.d.ts.map +1 -1
- package/dist/types/components/tabs/index.d.ts +16 -3
- package/dist/types/components/tabs/index.d.ts.map +1 -1
- package/dist/types/components/tabs/panel.d.ts +5 -1
- 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 +25 -5
- package/dist/types/components/textarea/index.d.ts.map +1 -1
- package/dist/types/components/toast/index.d.ts +17 -2
- package/dist/types/components/toast/index.d.ts.map +1 -1
- package/dist/types/components/tooltip/check-props.d.ts.map +1 -1
- package/dist/types/components/tooltip/index.d.ts +1 -5
- package/dist/types/components/tooltip/index.d.ts.map +1 -1
- package/dist/types/components/tree/check-props.d.ts.map +1 -1
- package/dist/types/components/tree/index.d.ts +1 -1
- package/dist/types/components/tree/index.d.ts.map +1 -1
- package/dist/types/components/tree/private/branch.d.ts +2 -4
- package/dist/types/components/tree/private/branch.d.ts.map +1 -1
- package/dist/types/components/tree/private/item.d.ts.map +1 -1
- package/dist/types/components/tree/private/render-branch.d.ts.map +1 -1
- package/dist/types/components/tree/private/render-initial-branch.d.ts +2 -3
- package/dist/types/components/tree/private/render-initial-branch.d.ts.map +1 -1
- package/dist/types/components/tree/tree.d.ts +38 -9
- package/dist/types/components/tree/tree.d.ts.map +1 -1
- package/dist/types/components/tree/types.d.ts +62 -9
- package/dist/types/components/tree/types.d.ts.map +1 -1
- package/dist/types/components/trial-bar/check-props.d.ts +3 -0
- package/dist/types/components/trial-bar/check-props.d.ts.map +1 -0
- package/dist/types/components/trial-bar/index.d.ts +15 -7
- package/dist/types/components/trial-bar/index.d.ts.map +1 -1
- package/dist/types/components/utilities/menu-list/index.d.ts +6 -2
- package/dist/types/components/utilities/menu-list/index.d.ts.map +1 -1
- package/dist/types/components/utilities/menu-list/item.d.ts +4 -2
- package/dist/types/components/utilities/menu-list/item.d.ts.map +1 -1
- package/dist/types/components/utilities/utility-icon/index.d.ts.map +1 -1
- package/dist/types/components/vertical-navigation/index.d.ts +7 -3
- package/dist/types/components/vertical-navigation/index.d.ts.map +1 -1
- package/dist/types/components/vertical-navigation/private/item.d.ts +1 -1
- package/dist/types/components/vertical-navigation/private/item.d.ts.map +1 -1
- package/dist/types/components/welcome-mat/check-props.d.ts +3 -0
- package/dist/types/components/welcome-mat/check-props.d.ts.map +1 -0
- package/dist/types/components/welcome-mat/index.d.ts +70 -15
- package/dist/types/components/welcome-mat/index.d.ts.map +1 -1
- package/dist/types/components/welcome-mat/info-badge.d.ts +7 -3
- package/dist/types/components/welcome-mat/info-badge.d.ts.map +1 -1
- package/dist/types/utilities/constants.d.ts +0 -1
- package/dist/types/utilities/constants.d.ts.map +1 -1
- package/package.json +5 -3
- package/dist/cjs/components/forms/input/inline-check-props.cjs +0 -2
- package/dist/cjs/components/forms/input/inline-check-props.cjs.map +0 -1
- package/dist/cjs/components/forms/input/inline.cjs +0 -2
- package/dist/cjs/components/forms/input/inline.cjs.map +0 -1
- package/dist/cjs/components/modal/check-props.cjs +0 -2
- package/dist/cjs/components/modal/check-props.cjs.map +0 -1
- package/dist/cjs/components/modal/component.cjs +0 -2
- package/dist/cjs/components/modal/component.cjs.map +0 -1
- package/dist/cjs/components/modal/trigger.cjs +0 -2
- package/dist/cjs/components/modal/trigger.cjs.map +0 -1
- package/dist/es/components/forms/input/inline-check-props.js +0 -11
- package/dist/es/components/forms/input/inline-check-props.js.map +0 -1
- package/dist/es/components/forms/input/inline.js +0 -95
- package/dist/es/components/forms/input/inline.js.map +0 -1
- package/dist/es/components/modal/check-props.js +0 -13
- package/dist/es/components/modal/check-props.js.map +0 -1
- package/dist/es/components/modal/component.js +0 -35
- package/dist/es/components/modal/component.js.map +0 -1
- package/dist/es/components/modal/trigger.js +0 -22
- package/dist/es/components/modal/trigger.js.map +0 -1
- package/dist/types/components/avatar/check-props.d.ts.map +0 -1
- package/dist/types/components/breadcrumb/check-props.d.ts.map +0 -1
- package/dist/types/components/button-stateful/check-props.d.ts.map +0 -1
- package/dist/types/components/forms/checkbox/index.d.ts +0 -4
- package/dist/types/components/forms/checkbox/index.d.ts.map +0 -1
- package/dist/types/components/forms/checkbox.d.ts +0 -2
- package/dist/types/components/forms/input/inline-check-props.d.ts.map +0 -1
- package/dist/types/components/forms/input/inline.d.ts +0 -88
- package/dist/types/components/forms/input/inline.d.ts.map +0 -1
- package/dist/types/components/modal/check-props.d.ts.map +0 -1
- package/dist/types/components/modal/trigger.d.ts +0 -14
- package/dist/types/components/modal/trigger.d.ts.map +0 -1
- package/dist/types/components/spinner/check-props.d.ts.map +0 -1
- package/dist/types/components/tabs/pane.d.ts +0 -3
- package/dist/types/components/tabs/pane.d.ts.map +0 -1
- package/dist/types/utilities/warning/deprecated-event-parameter.d.ts +0 -3
- package/dist/types/utilities/warning/deprecated-event-parameter.d.ts.map +0 -1
- /package/dist/types/components/{avatar → builder-header}/check-props.d.ts +0 -0
- /package/dist/types/components/{breadcrumb → carousel}/check-props.d.ts +0 -0
- /package/dist/types/components/{button-stateful → pill-container}/check-props.d.ts +0 -0
- /package/dist/types/components/{modal → slider}/check-props.d.ts +0 -0
- /package/dist/types/components/{spinner → split-view}/check-props.d.ts +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../../../utilities/constants.cjs"),t=require("../../button/index.cjs");let n=require("react/jsx-runtime");var r=({buttonLabel:e,carouselId:r,description:i,heading:a,href:o=`#`,id:s,imageAssistiveText:c,isInCurrentPanel:l,itemWidth:u,onFocus:d,
|
|
1
|
+
const e=require("../../../utilities/constants.cjs"),t=require("../../button/index.cjs");let n=require("react/jsx-runtime");var r=({buttonLabel:e,carouselId:r,description:i,heading:a,href:o=`#`,id:s,imageAssistiveText:c,isInCurrentPanel:l,itemWidth:u,onFocus:d,renderItem:f,panelIndex:p,src:m,getPanelId:h,className:g,onClick:_})=>{function v(e){o===`#`&&e.preventDefault(),_&&_(e)}return(0,n.jsx)(`div`,{id:h?.({carouselId:r,itemId:s}),className:`slds-carousel__panel slds-m-horizontal_xx-small slds-list_horizontal`,role:`tabpanel`,"aria-hidden":`false`,"aria-labelledby":`indicator-id-${r}-${p}`,style:{margin:0,maxWidth:`${u}px`,padding:`0 6px`},children:f?f({item:{buttonLabel:e,carouselId:r,className:g,description:i,heading:a,href:o,id:s,imageAssistiveText:c,isInCurrentPanel:l,itemWidth:u,onFocus:d,panelIndex:p,src:m,getPanelId:h}}):(0,n.jsxs)(`a`,{className:`slds-carousel__panel-action slds-text-link_reset`,href:o,onClick:v,onFocus:d,style:{backgroundColor:`white`,width:`100%`},tabIndex:l?0:-1,children:[(0,n.jsx)(`div`,{className:`slds-carousel__image`,children:(0,n.jsx)(`img`,{src:m,alt:c||a})}),(0,n.jsxs)(`div`,{className:`slds-carousel__content`,style:{height:`auto`},children:[(0,n.jsx)(`h2`,{className:`slds-carousel__content-title`,children:a}),(0,n.jsx)(`div`,{className:`slds-p-bottom_x-small slds-text-body_small`,style:{minHeight:`40px`},children:i}),e&&(0,n.jsx)(t.default,{label:e,tabIndex:l?0:-1,variant:`neutral`})]})]})})};r.displayName=e.CAROUSEL_ITEM,exports.default=r;
|
|
2
2
|
//# sourceMappingURL=carousel-item.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel-item.cjs","names":[],"sources":["../../../../../components/carousel/private/carousel-item.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\n// # CarouselItem Component\n\n// Implements the [CarouselItem design pattern](https://www.lightningdesignsystem.com/components/carousel/) in React.\n\nimport {
|
|
1
|
+
{"version":3,"file":"carousel-item.cjs","names":[],"sources":["../../../../../components/carousel/private/carousel-item.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\n// # CarouselItem Component\n\n// Implements the [CarouselItem design pattern](https://www.lightningdesignsystem.com/components/carousel/) in React.\n\nimport { type FocusEvent, type MouseEvent, type ReactNode } from 'react';\n\nimport Button from '../../button';\n\nimport { CAROUSEL_ITEM } from '../../../utilities/constants';\nimport { type CarouselRenderItemData } from '../index';\n\nexport interface CarouselItemProps {\n\t/**\n\t * Label of the button to be displayed. If not provided, no button will be rendered.\n\t */\n\tbuttonLabel?: string;\n\t/**\n\t * Carousel HTML ID\n\t */\n\tcarouselId?: string;\n\t/**\n\t * CSS classes that are applied to the component\n\t */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/**\n\t * Visible paragraph text to be displayed on the carousel item\n\t */\n\tdescription?: string | ReactNode;\n\t/**\n\t * Function to generate the panel HTML `id`.\n\t */\n\tgetPanelId?: (params: { carouselId: string; itemId: string }) => string;\n\t/**\n\t * Carousel Item's visible heading\n\t */\n\theading?: string | Record<string, unknown>;\n\t/**\n\t * Link URL\n\t */\n\thref?: string;\n\t/**\n\t * Id of the item component.\n\t */\n\tid?: string;\n\t/**\n\t * Image alt text\n\t */\n\timageAssistiveText?: string;\n\t/**\n\t * Boolean indicating whether this item is currently visible in the active parent carousel panel\n\t */\n\tisInCurrentPanel?: boolean;\n\t/**\n\t * Width of the carousel item\n\t */\n\titemWidth?: number;\n\t/**\n\t * Triggered when the item is clicked.\n\t */\n\tonClick?: (event: MouseEvent) => void;\n\t/**\n\t * Accepts a callback to handle when the a tag is focused on\n\t */\n\tonFocus?: (event: FocusEvent) => void;\n\t/**\n\t * Renders the item's content in place of the default image, heading and description. Called with `{ item }`.\n\t */\n\trenderItem?: (data: CarouselRenderItemData) => ReactNode;\n\t/**\n\t * Index of the panel this item belongs to, to be used when associating it to an indicator\n\t */\n\tpanelIndex?: number;\n\t/**\n\t * Path of the image to be used\n\t */\n\tsrc?: string;\n}\n\n/**\n * A carousel allows multiple pieces of featured content to occupy an allocated amount of space.\n */\nconst CarouselItem = ({\n\tbuttonLabel,\n\tcarouselId,\n\tdescription,\n\theading,\n\thref = '#',\n\tid,\n\timageAssistiveText,\n\tisInCurrentPanel,\n\titemWidth,\n\tonFocus,\n\trenderItem,\n\tpanelIndex,\n\tsrc,\n\tgetPanelId,\n\tclassName,\n\tonClick,\n}: CarouselItemProps) => {\n\tfunction handleOnClick(event: MouseEvent) {\n\t\tif (href === '#') {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tif (onClick) {\n\t\t\tonClick(event);\n\t\t}\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tid={getPanelId?.({ carouselId, itemId: id } as {\n\t\t\t\tcarouselId: string;\n\t\t\t\titemId: string;\n\t\t\t})}\n\t\t\tclassName=\"slds-carousel__panel slds-m-horizontal_xx-small slds-list_horizontal\"\n\t\t\trole=\"tabpanel\"\n\t\t\taria-hidden=\"false\"\n\t\t\taria-labelledby={`indicator-id-${carouselId}-${panelIndex}`}\n\t\t\tstyle={{\n\t\t\t\tmargin: 0,\n\t\t\t\tmaxWidth: `${itemWidth}px`,\n\t\t\t\tpadding: '0 6px',\n\t\t\t}}\n\t\t>\n\t\t\t{renderItem ? (\n\t\t\t\trenderItem({\n\t\t\t\t\titem: {\n\t\t\t\t\t\tbuttonLabel,\n\t\t\t\t\t\tcarouselId,\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\tdescription,\n\t\t\t\t\t\theading,\n\t\t\t\t\t\thref,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\timageAssistiveText,\n\t\t\t\t\t\tisInCurrentPanel,\n\t\t\t\t\t\titemWidth,\n\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\tpanelIndex,\n\t\t\t\t\t\tsrc,\n\t\t\t\t\t\tgetPanelId,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t) : (\n\t\t\t\t<a\n\t\t\t\t\tclassName=\"slds-carousel__panel-action slds-text-link_reset\"\n\t\t\t\t\thref={href}\n\t\t\t\t\tonClick={handleOnClick}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tbackgroundColor: 'white',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t}}\n\t\t\t\t\ttabIndex={isInCurrentPanel ? 0 : -1}\n\t\t\t\t>\n\t\t\t\t\t<div className=\"slds-carousel__image\">\n\t\t\t\t\t\t<img src={src} alt={imageAssistiveText || (heading as string)} />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"slds-carousel__content\" style={{ height: 'auto' }}>\n\t\t\t\t\t\t<h2 className=\"slds-carousel__content-title\">\n\t\t\t\t\t\t\t{heading as ReactNode}\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"slds-p-bottom_x-small slds-text-body_small\"\n\t\t\t\t\t\t\tstyle={{ minHeight: '40px' }}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{description}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{buttonLabel && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tlabel={buttonLabel}\n\t\t\t\t\t\t\t\ttabIndex={isInCurrentPanel ? 0 : -1}\n\t\t\t\t\t\t\t\tvariant=\"neutral\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</a>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nCarouselItem.displayName = CAROUSEL_ITEM;\n\nexport default CarouselItem;\n"],"mappings":"2HAoFA,IAAM,GAAgB,CACrB,cACA,aACA,cACA,UACA,OAAO,IACP,KACA,qBACA,mBACA,YACA,UACA,aACA,aACA,MACA,aACA,YACA,aACwB,CACxB,SAAS,EAAc,EAAmB,CACrC,IAAS,KACZ,EAAM,eAAe,EAGlB,GACH,EAAQ,CAAK,CAEf,CAEA,OACC,EAAA,EAAA,IAAA,CAAC,MAAD,CACC,GAAI,IAAa,CAAE,aAAY,OAAQ,CAAG,CAGzC,EACD,UAAU,uEACV,KAAK,WACL,cAAY,QACZ,kBAAiB,gBAAgB,EAAW,GAAG,IAC/C,MAAO,CACN,OAAQ,EACR,SAAU,GAAG,EAAU,IACvB,QAAS,OACV,EAEC,SAAA,EACA,EAAW,CACV,KAAM,CACL,cACA,aACA,YACA,cACA,UACA,OACA,KACA,qBACA,mBACA,YACA,UACA,aACA,MACA,YACD,CACD,CAAC,GAED,EAAA,EAAA,KAAA,CAAC,IAAD,CACC,UAAU,mDACJ,OACN,QAAS,EACA,UACT,MAAO,CACN,gBAAiB,QACjB,MAAO,MACR,EACA,SAAU,EAAmB,EAAI,GATlC,SAAA,EAWC,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,uBACd,UAAA,EAAA,EAAA,IAAA,CAAC,MAAD,CAAU,MAAK,IAAK,GAAuB,CAAqB,CAAA,CAC5D,CAAA,GACL,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,yBAAyB,MAAO,CAAE,OAAQ,MAAO,EAAhE,SAAA,EACC,EAAA,EAAA,IAAA,CAAC,KAAD,CAAI,UAAU,+BACZ,SAAA,CACE,CAAA,GACJ,EAAA,EAAA,IAAA,CAAC,MAAD,CACC,UAAU,6CACV,MAAO,CAAE,UAAW,MAAO,EAE1B,SAAA,CACG,CAAA,EACJ,IACA,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACC,MAAO,EACP,SAAU,EAAmB,EAAI,GACjC,QAAQ,SACR,CAAA,CAEE,CACH,CAAA,CAAA,GAEA,CAAA,CAEP,EAEA,EAAa,YAAc,EAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
require("../../utilities/warning/sunset-property.cjs");const e=require("../../utilities/get-component-doc.cjs"),t=require("../../utilities/warning/deprecated-property.cjs");require("../../utilities/warning/only-one-of-properties.cjs"),process.env.NODE_ENV;var n=function(){};process.env.NODE_ENV!==`production`&&(n=function(n,r,i){let a=e.default(i);t.default(n,r.onRenderVisualPicker,`onRenderVisualPicker`,`visualPickerFigure`,a(`visualPickerFigure`)),t.default(n,r.onRenderVisualPickerSelected,`onRenderVisualPickerSelected`,`visualPickerFigureSelected`,a(`visualPickerFigureSelected`)),t.default(n,r.onRenderVisualPickerNotSelected,`onRenderVisualPickerNotSelected`,`visualPickerFigureNotSelected`,a(`visualPickerFigureNotSelected`))}),Object.defineProperty(exports,"checkDeprecatedProps",{enumerable:!0,get:function(){return n}});
|
|
2
|
+
//# sourceMappingURL=check-props.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-props.cjs","names":[],"sources":["../../../../components/checkbox/check-props.js"],"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/* eslint-disable import/no-mutable-exports */\n/* eslint-disable max-len */\n\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport getComponentDocFn from '../../utilities/get-component-doc';\nimport onlyOneOfProperties from '../../utilities/warning/only-one-of-properties';\nimport sunsetProperty from '../../utilities/warning/sunset-property';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\n\t\tsunsetProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.label,\n\t\t\t'label',\n\t\t\t`Use \\`labels.label\\` instead.${createDocUrl('labels')}`\n\t\t);\n\n\t\tif (props.variant === 'toggle' && props.indeterminate === true) {\n\t\t\tonlyOneOfProperties(\n\t\t\t\tCOMPONENT,\n\t\t\t\t{\n\t\t\t\t\tvariant: props.variant,\n\t\t\t\t\tindeterminate: props.indeterminate,\n\t\t\t\t},\n\t\t\t\t`Currently SLDS does not support the \\`indeterminate\\` state in Checkbox Toggle. See SLDS documentation about [Checkbox Toggle](https://lightningdesignsystem.com/components/forms/#flavor-checkbox-toggle-checkbox-toggle) for more information. ${createDocUrl(\n\t\t\t\t\t'variant'\n\t\t\t\t)}`\n\t\t\t);\n\t\t}\n\t};\n}\n\n// Deprecated visual-picker render props. Exported separately so the component\n// can run these checks without enabling the pre-existing `checkProps` warnings.\nexport let checkDeprecatedProps = function checkDeprecatedPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckDeprecatedProps = function checkDeprecatedPropsFunction(\n\t\tCOMPONENT,\n\t\tprops,\n\t\tjsonDoc\n\t) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onRenderVisualPicker,\n\t\t\t'onRenderVisualPicker',\n\t\t\t'visualPickerFigure',\n\t\t\tcreateDocUrl('visualPickerFigure')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onRenderVisualPickerSelected,\n\t\t\t'onRenderVisualPickerSelected',\n\t\t\t'visualPickerFigureSelected',\n\t\t\tcreateDocUrl('visualPickerFigureSelected')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onRenderVisualPickerNotSelected,\n\t\t\t'onRenderVisualPickerNotSelected',\n\t\t\t'visualPickerFigureNotSelected',\n\t\t\tcreateDocUrl('visualPickerFigureNotSelected')\n\t\t);\n\t};\n}\n\nexport default checkProps;\n"],"mappings":"2OAYA,QAAA,IAAA,SA4BA,IAAW,EAAuB,UAAwC,CAAC,EAE3E,QAAA,IAAA,WAA6B,eAC5B,EAAuB,SACtB,EACA,EACA,EACC,CACD,IAAM,EAAe,EAAA,QAAkB,CAAO,EAE9C,EAAA,QACC,EACA,EAAM,qBACN,uBACA,qBACA,EAAa,oBAAoB,CAClC,EACA,EAAA,QACC,EACA,EAAM,6BACN,+BACA,6BACA,EAAa,4BAA4B,CAC1C,EACA,EAAA,QACC,EACA,EAAM,gCACN,kCACA,gCACA,EAAa,+BAA+B,CAC7C,CACD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=`checkbox`,t=`prod`,n=`Checkbox`,r={component:e,status:t,"display-name":`Checkboxes`,classKey:n,"last-accessibility-review":{"date-iso-8601":`2018/01/18`,"commit-sha":`ad6b6c6523ee21cada11be5f7ea4d99abc530726`},"SLDS-component-path":`/components/checkbox`,"site-stories":[{heading:`Default`,path:`/__examples__/default.jsx`},{heading:`Error State`,path:`/__examples__/error.jsx`},{heading:`Toggle`,path:`/__examples__/toggle.jsx`},{heading:`Grouped with Tri-State`,path:`/__examples__/grouped-with-tristate.jsx`}],"url-slug":`checkboxes`};exports.classKey=n,exports.component=e,exports.default=r,exports.status=t;
|
|
2
|
+
//# sourceMappingURL=component.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.cjs","names":[],"sources":["../../../../components/checkbox/component.json"],"sourcesContent":["{\n\t\"component\": \"checkbox\",\n\t\"status\": \"prod\",\n\t\"display-name\": \"Checkboxes\",\n\t\"classKey\": \"Checkbox\",\n\t\"last-accessibility-review\": {\n\t\t\"date-iso-8601\": \"2018/01/18\",\n\t\t\"commit-sha\": \"ad6b6c6523ee21cada11be5f7ea4d99abc530726\"\n\t},\n\t\"SLDS-component-path\": \"/components/checkbox\",\n\t\"site-stories\": [\n\t\t{\n\t\t\t\"heading\": \"Default\",\n\t\t\t\"path\": \"/__examples__/default.jsx\"\n\t\t},\n\t\t{\n\t\t\t\"heading\": \"Error State\",\n\t\t\t\"path\": \"/__examples__/error.jsx\"\n\t\t},\n\t\t{\n\t\t\t\"heading\": \"Toggle\",\n\t\t\t\"path\": \"/__examples__/toggle.jsx\"\n\t\t},\n\t\t{\n\t\t\t\"heading\": \"Grouped with Tri-State\",\n\t\t\t\"path\": \"/__examples__/grouped-with-tristate.jsx\"\n\t\t}\n\t],\n\t\"url-slug\": \"checkboxes\"\n}\n"],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../../utilities/event.cjs"),r=require("../../utilities/key-code.cjs"),i=require("../icon/index.cjs"),a=require("../../utilities/get-aria-props.cjs");let
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../../utilities/event.cjs"),r=require("../../utilities/key-code.cjs"),i=require("../icon/index.cjs"),a=require("../../utilities/get-aria-props.cjs"),o=require("./check-props.cjs"),s=require("./component.cjs");let c=require("react"),l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime");var d={toggleDisabled:`Disabled`,toggleEnabled:`Enabled`},f=(0,c.forwardRef)((e,f)=>{let{assistiveText:p,checked:m,defaultChecked:h,className:g,disabled:_,errorText:v,id:y,indeterminate:b,labels:x,name:ee,onBlur:te,onChange:S,onFocus:C,onKeyDown:w,onKeyPress:T,onKeyUp:E,onRequestFocus:D,readOnly:ne,requestFocus:O,required:k,role:A,tabIndex:j,variant:M=`base`,coverable:N,vertical:P,visualPickerFigure:F,visualPickerFigureSelected:I,visualPickerFigureNotSelected:L,onRenderVisualPicker:R,onRenderVisualPickerSelected:z,onRenderVisualPickerNotSelected:B,size:V=`medium`,labelId:H,...U}=e,W=(0,c.useId)(),G=(0,c.useRef)(null),K=()=>y||W,q=()=>v?`${K()}-error-text`:void 0,J={...p},Y={...d,...x};(0,c.useEffect)(()=>{o.checkDeprecatedProps(t.CHECKBOX,{onRenderVisualPicker:R,onRenderVisualPickerSelected:z,onRenderVisualPickerNotSelected:B},s.default)},[R,z,B]),(0,c.useEffect)(()=>{G.current&&b!==void 0&&(G.current.indeterminate=b)},[b]),(0,c.useEffect)(()=>{O&&D&&G.current&&D(G.current)},[O,D]);let X=(e=[])=>e.concat(U[`aria-describedby`]||``,q()||``).filter(Boolean).join(` `)||void 0,Z=e=>{S&&S(e,{checked:b?!0:!m,indeterminate:!1})},re=e=>{(e.keyCode===r.default.ENTER||e.keyCode===r.default.SPACE)&&(n.default.trapImmediate(e),Z(e)),w?.(e)},ie=a.default(U),Q={disabled:_,...m===void 0?{defaultChecked:h}:{checked:m},id:K(),name:ee,onBlur:te,onChange:Z,onFocus:C,onKeyDown:re,onKeyPress:T,onKeyUp:E,role:A,required:k,type:`checkbox`,...ie},$=e=>{G.current=e,typeof f==`function`?f(e):f&&(f.current=e)};return M===`button-group`?(0,u.jsxs)(`span`,{className:`slds-button slds-checkbox_button`,children:[(0,u.jsx)(`input`,{...Q,ref:$,"aria-describedby":X()}),(0,u.jsxs)(`label`,{className:`slds-checkbox_button__label`,htmlFor:K(),children:[(0,u.jsx)(`span`,{className:`slds-checkbox_faux`,children:Y.label}),J.label&&(0,u.jsx)(`span`,{className:`slds-assistive-text`,children:J.label})]})]}):M===`toggle`?(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-form-element`,{"is-required":k,"slds-has-error":v},g),children:[(0,u.jsxs)(`label`,{className:`slds-checkbox_toggle slds-grid`,htmlFor:K(),children:[k&&(0,u.jsx)(`abbr`,{className:`slds-required`,title:`required`,children:`*`}),Y.label&&(0,u.jsx)(`span`,{className:`slds-form-element__label slds-m-bottom_none`,children:Y.label}),J.label&&(0,u.jsx)(`span`,{className:`slds-assistive-text`,children:J.label}),(0,u.jsx)(`input`,{...Q,ref:$,"aria-describedby":X([`${K()}-desc`])}),(0,u.jsxs)(`span`,{id:`${K()}-desc`,className:`slds-checkbox_faux_container`,"aria-live":`assertive`,children:[(0,u.jsx)(`span`,{className:`slds-checkbox_faux`}),(0,u.jsx)(`span`,{className:`slds-checkbox_on`,children:Y.toggleEnabled}),(0,u.jsx)(`span`,{className:`slds-checkbox_off`,children:Y.toggleDisabled})]})]}),v&&(0,u.jsx)(`div`,{className:`slds-form-element__help`,id:q(),children:v})]}):M===`visual-picker`?(0,u.jsxs)(`span`,{className:(0,l.default)(`slds-visual-picker`,`slds-visual-picker_${V}`,P&&`slds-visual-picker_vertical`),children:[(0,u.jsx)(`input`,{...Q,ref:$,"aria-describedby":X()}),(0,u.jsxs)(`label`,{className:`slds-checkbox_button__label`,htmlFor:K(),children:[N?(0,u.jsxs)(`div`,{className:`slds-visual-picker__figure slds-visual-picker__icon slds-align_absolute-center`,children:[(0,u.jsx)(`span`,{className:`slds-is-selected`,children:I??z?.()}),(0,u.jsx)(`span`,{className:`slds-is-not-selected`,children:L??B?.()})]}):(0,u.jsx)(`span`,{className:`slds-visual-picker__figure slds-visual-picker__text slds-align_absolute-center`,children:F??R?.()}),!P&&(0,u.jsxs)(`span`,{className:`slds-visual-picker__body`,children:[Y.heading&&(0,u.jsx)(`span`,{className:`slds-text-heading_small`,children:Y.heading}),(0,u.jsx)(`span`,{className:`slds-text-title`,children:Y.label}),(J.label||J.heading)&&(0,u.jsx)(`span`,{className:`slds-assistive-text`,children:J.label||J.heading})]}),!N&&(0,u.jsx)(`span`,{className:`slds-icon_container slds-visual-picker__text-check`,children:(0,u.jsx)(i.default,{assistiveText:J,category:`utility`,name:`check`,colorVariant:`base`,size:`x-small`})})]})]}):(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-form-element`,{"is-required":k,"slds-has-error":v},g),children:[(0,u.jsx)(`div`,{className:`slds-form-element__control`,children:(0,u.jsxs)(`span`,{className:`slds-checkbox`,children:[k&&(0,u.jsx)(`abbr`,{className:`slds-required`,title:`required`,children:`*`}),(0,u.jsx)(`input`,{...Q,ref:$,tabIndex:j?parseInt(j,10):void 0,"aria-describedby":X()}),(0,u.jsxs)(`label`,{className:`slds-checkbox__label`,htmlFor:K(),id:H,children:[(0,u.jsx)(`span`,{className:`slds-checkbox_faux`}),Y.label&&(0,u.jsx)(`span`,{className:`slds-form-element__label`,children:Y.label}),J.label&&(0,u.jsx)(`span`,{className:`slds-assistive-text`,children:J.label})]})]})}),v&&(0,u.jsx)(`div`,{className:`slds-form-element__help`,id:q(),children:v})]})});f.displayName=t.CHECKBOX,exports.default=f;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/checkbox/index.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 {\n\tuseId,\n\tuseRef,\n\tuseEffect,\n\tforwardRef,\n\ttype ChangeEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype ReactNode,\n} from 'react';\nimport classNames from 'classnames';\nimport KEYS from '../../utilities/key-code';\nimport EventUtil from '../../utilities/event';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport { CHECKBOX } from '../../utilities/constants';\nimport Icon from '../icon/index';\n\n/**\n * Checkbox variant types\n */\nexport type CheckboxVariant = 'base' | 'toggle' | 'button-group' | 'visual-picker';\n\n/**\n * Checkbox size for visual picker\n */\nexport type CheckboxSize = 'medium' | 'large';\n\n/**\n * Assistive text for Checkbox\n */\nexport interface CheckboxAssistiveText {\n\theading?: string;\n\tlabel?: string;\n}\n\n/**\n * Labels for Checkbox\n */\nexport interface CheckboxLabels {\n\theading?: string;\n\tlabel?: string;\n\ttoggleDisabled?: string;\n\ttoggleEnabled?: string;\n}\n\n/**\n * Change event data\n */\nexport interface CheckboxChangeData {\n\tchecked: boolean;\n\tindeterminate: boolean;\n}\n\n/**\n * Props for the Checkbox component\n */\nexport interface CheckboxProps {\n\t/** aria-controls for related regions */\n\t'aria-controls'?: string;\n\t/** aria-describedby for descriptions */\n\t'aria-describedby'?: string;\n\t/** aria-labelledby for labels */\n\t'aria-labelledby'?: string;\n\t/** aria-owns for owned elements */\n\t'aria-owns'?: string;\n\t/** aria-required for validation */\n\t'aria-required'?: boolean;\n\t/** Assistive text for accessibility */\n\tassistiveText?: CheckboxAssistiveText | string;\n\t/** Controlled checked state */\n\tchecked?: boolean;\n\t/**\n\t * Preserves the legacy `onChange(event, { checked })` parameter order used\n\t * by the deprecated `components/forms/checkbox` alias. Not for new code.\n\t */\n\toldEventParameterOrder?: boolean;\n\t/** Initial uncontrolled checked state */\n\tdefaultChecked?: boolean;\n\t/** CSS class for container */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Disable the checkbox */\n\tdisabled?: boolean;\n\t/** Error message */\n\terrorText?: string;\n\t/** Unique ID */\n\tid?: string;\n\t/** Indeterminate state (partial selection) */\n\tindeterminate?: boolean;\n\t/** Text labels */\n\tlabels?: CheckboxLabels;\n\t/** Form parameter name */\n\tname?: string;\n\t/** Blur event handler */\n\tonBlur?: (event: FocusEvent<HTMLInputElement>) => void;\n\t/** Change event handler */\n\tonChange?: (event: ChangeEvent<HTMLInputElement>, data: CheckboxChangeData) => void;\n\t/** Focus event handler */\n\tonFocus?: (event: FocusEvent<HTMLInputElement>) => void;\n\t/** Key down event handler */\n\tonKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;\n\t/** Key press event handler */\n\tonKeyPress?: (event: KeyboardEvent<HTMLInputElement>) => void;\n\t/** Key up event handler */\n\tonKeyUp?: (event: KeyboardEvent<HTMLInputElement>) => void;\n\t/** Request focus callback */\n\tonRequestFocus?: (element: HTMLInputElement) => void;\n\t/** Read-only mode */\n\treadOnly?: boolean;\n\t/** Trigger onRequestFocus */\n\trequestFocus?: boolean;\n\t/** Mark as required */\n\trequired?: boolean;\n\t/** ARIA role */\n\trole?: string;\n\t/** Tab index */\n\ttabIndex?: string;\n\t/** Checkbox variant */\n\tvariant?: CheckboxVariant;\n\t/** Coverable visual picker */\n\tcoverable?: boolean;\n\t/** Vertical visual picker */\n\tvertical?: boolean;\n\t/** Render function for visual picker */\n\tonRenderVisualPicker?: () => ReactNode;\n\t/** Render function for selected visual picker */\n\tonRenderVisualPickerSelected?: () => ReactNode;\n\t/** Render function for not selected visual picker */\n\tonRenderVisualPickerNotSelected?: () => ReactNode;\n\t/** Size for visual picker */\n\tsize?: CheckboxSize;\n\t/** Label ID for label element */\n\tlabelId?: string;\n}\n\nconst defaultLabels: CheckboxLabels = {\n\ttoggleDisabled: 'Disabled',\n\ttoggleEnabled: 'Enabled',\n};\n\n/**\n * The ability to style checkboxes with CSS varies across browsers.\n * Using this component ensures checkboxes look the same everywhere.\n */\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {\n\tconst {\n\t\tassistiveText: assistiveTextProp,\n\t\tchecked,\n\t\tdefaultChecked,\n\t\tclassName,\n\t\tdisabled,\n\t\terrorText,\n\t\tid: propId,\n\t\tindeterminate,\n\t\tlabels: labelsProp,\n\t\tname,\n\t\tonBlur,\n\t\tonChange,\n\t\tonFocus,\n\t\tonKeyDown,\n\t\tonKeyPress,\n\t\tonKeyUp,\n\t\tonRequestFocus,\n\t\treadOnly,\n\t\trequestFocus,\n\t\trequired,\n\t\trole,\n\t\ttabIndex,\n\t\tvariant = 'base',\n\t\tcoverable,\n\t\tvertical,\n\t\tonRenderVisualPicker,\n\t\tonRenderVisualPickerSelected,\n\t\tonRenderVisualPickerNotSelected,\n\t\tsize = 'medium',\n\t\tlabelId,\n\t\t...restProps\n\t} = props;\n\n\tconst generatedId = useId();\n\tconst internalRef = useRef<HTMLInputElement | null>(null);\n\n\tconst getId = () => propId || generatedId;\n\tconst getErrorId = () => (errorText ? `${getId()}-error-text` : undefined);\n\n\t// Merge assistive text\n\tconst assistiveText: CheckboxAssistiveText =\n\t\ttypeof assistiveTextProp === 'string'\n\t\t\t? { label: assistiveTextProp }\n\t\t\t: { ...assistiveTextProp };\n\n\t// Merge labels\n\tconst labels: CheckboxLabels = {\n\t\t...defaultLabels,\n\t\t...labelsProp,\n\t};\n\n\t// Handle indeterminate state\n\tuseEffect(() => {\n\t\tif (internalRef.current && indeterminate !== undefined) {\n\t\t\tinternalRef.current.indeterminate = indeterminate;\n\t\t}\n\t}, [indeterminate]);\n\n\t// Handle request focus\n\tuseEffect(() => {\n\t\tif (requestFocus && onRequestFocus && internalRef.current) {\n\t\t\tonRequestFocus(internalRef.current);\n\t\t}\n\t}, [requestFocus, onRequestFocus]);\n\n\tconst getAriaDescribedBy = (idArray: string[] = []): string | undefined => {\n\t\tconst describedBy = idArray\n\t\t\t.concat(restProps['aria-describedby'] || '', getErrorId() || '')\n\t\t\t.filter(Boolean)\n\t\t\t.join(' ');\n\t\treturn describedBy || undefined;\n\t};\n\n\tconst handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n\t\tif (onChange) {\n\t\t\tonChange(event, {\n\t\t\t\tchecked: indeterminate ? true : !checked,\n\t\t\t\tindeterminate: false,\n\t\t\t});\n\t\t}\n\t};\n\n\tconst handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n\t\tif (event.keyCode === KEYS.ENTER || event.keyCode === KEYS.SPACE) {\n\t\t\tEventUtil.trapImmediate(event);\n\t\t\thandleChange(event as unknown as ChangeEvent<HTMLInputElement>);\n\t\t}\n\t\tonKeyDown?.(event);\n\t};\n\n\tconst ariaProps = getAriaProps(restProps);\n\n\t// Common input props\n\tconst inputProps = {\n\t\tdisabled,\n\t\t...(checked !== undefined ? { checked } : { defaultChecked }),\n\t\tid: getId(),\n\t\tname,\n\t\tonBlur,\n\t\tonChange: handleChange,\n\t\tonFocus,\n\t\tonKeyDown: handleKeyDown,\n\t\tonKeyPress,\n\t\tonKeyUp,\n\t\trole,\n\t\trequired,\n\t\ttype: 'checkbox' as const,\n\t\t...ariaProps,\n\t};\n\n\t// Set ref\n\tconst setRef = (node: HTMLInputElement | null) => {\n\t\tinternalRef.current = node;\n\t\tif (typeof ref === 'function') {\n\t\t\tref(node);\n\t\t} else if (ref) {\n\t\t\tref.current = node;\n\t\t}\n\t};\n\n\t// Button Group Variant\n\tif (variant === 'button-group') {\n\t\treturn (\n\t\t\t<span className=\"slds-button slds-checkbox_button\">\n\t\t\t\t<input\n\t\t\t\t\t{...inputProps}\n\t\t\t\t\tref={setRef}\n\t\t\t\t\taria-describedby={getAriaDescribedBy()}\n\t\t\t\t/>\n\t\t\t\t<label className=\"slds-checkbox_button__label\" htmlFor={getId()}>\n\t\t\t\t\t<span className=\"slds-checkbox_faux\">{labels.label}</span>\n\t\t\t\t\t{assistiveText.label && (\n\t\t\t\t\t\t<span className=\"slds-assistive-text\">{assistiveText.label}</span>\n\t\t\t\t\t)}\n\t\t\t\t</label>\n\t\t\t</span>\n\t\t);\n\t}\n\n\t// Toggle Variant\n\tif (variant === 'toggle') {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-form-element',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-required': required,\n\t\t\t\t\t\t'slds-has-error': errorText,\n\t\t\t\t\t},\n\t\t\t\t\tclassName as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<label className=\"slds-checkbox_toggle slds-grid\" htmlFor={getId()}>\n\t\t\t\t\t{required && (\n\t\t\t\t\t\t<abbr className=\"slds-required\" title=\"required\">\n\t\t\t\t\t\t\t*\n\t\t\t\t\t\t</abbr>\n\t\t\t\t\t)}\n\t\t\t\t\t{labels.label && (\n\t\t\t\t\t\t<span className=\"slds-form-element__label slds-m-bottom_none\">\n\t\t\t\t\t\t\t{labels.label}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t{assistiveText.label && (\n\t\t\t\t\t\t<span className=\"slds-assistive-text\">{assistiveText.label}</span>\n\t\t\t\t\t)}\n\t\t\t\t\t<input\n\t\t\t\t\t\t{...inputProps}\n\t\t\t\t\t\tref={setRef}\n\t\t\t\t\t\taria-describedby={getAriaDescribedBy([`${getId()}-desc`])}\n\t\t\t\t\t/>\n\t\t\t\t\t<span\n\t\t\t\t\t\tid={`${getId()}-desc`}\n\t\t\t\t\t\tclassName=\"slds-checkbox_faux_container\"\n\t\t\t\t\t\taria-live=\"assertive\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"slds-checkbox_faux\" />\n\t\t\t\t\t\t<span className=\"slds-checkbox_on\">{labels.toggleEnabled}</span>\n\t\t\t\t\t\t<span className=\"slds-checkbox_off\">{labels.toggleDisabled}</span>\n\t\t\t\t\t</span>\n\t\t\t\t</label>\n\t\t\t\t{errorText && (\n\t\t\t\t\t<div className=\"slds-form-element__help\" id={getErrorId()}>\n\t\t\t\t\t\t{errorText}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Visual Picker Variant\n\tif (variant === 'visual-picker') {\n\t\treturn (\n\t\t\t<span\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-visual-picker',\n\t\t\t\t\t`slds-visual-picker_${size}`,\n\t\t\t\t\tvertical && 'slds-visual-picker_vertical'\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<input\n\t\t\t\t\t{...inputProps}\n\t\t\t\t\tref={setRef}\n\t\t\t\t\taria-describedby={getAriaDescribedBy()}\n\t\t\t\t/>\n\t\t\t\t<label className=\"slds-checkbox_button__label\" htmlFor={getId()}>\n\t\t\t\t\t{coverable ? (\n\t\t\t\t\t\t<div className=\"slds-visual-picker__figure slds-visual-picker__icon slds-align_absolute-center\">\n\t\t\t\t\t\t\t<span className=\"slds-is-selected\">\n\t\t\t\t\t\t\t\t{onRenderVisualPickerSelected?.()}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"slds-is-not-selected\">\n\t\t\t\t\t\t\t\t{onRenderVisualPickerNotSelected?.()}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<span className=\"slds-visual-picker__figure slds-visual-picker__text slds-align_absolute-center\">\n\t\t\t\t\t\t\t{onRenderVisualPicker?.()}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t{!vertical && (\n\t\t\t\t\t\t<span className=\"slds-visual-picker__body\">\n\t\t\t\t\t\t\t{labels.heading && (\n\t\t\t\t\t\t\t\t<span className=\"slds-text-heading_small\">\n\t\t\t\t\t\t\t\t\t{labels.heading}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<span className=\"slds-text-title\">{labels.label}</span>\n\t\t\t\t\t\t\t{(assistiveText.label || assistiveText.heading) && (\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.heading}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t{!coverable && (\n\t\t\t\t\t\t<span className=\"slds-icon_container slds-visual-picker__text-check\">\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\tassistiveText={assistiveText}\n\t\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\t\tname=\"check\"\n\t\t\t\t\t\t\t\tcolorVariant=\"base\"\n\t\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t</label>\n\t\t\t</span>\n\t\t);\n\t}\n\n\t// Base Variant (default)\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames(\n\t\t\t\t'slds-form-element',\n\t\t\t\t{\n\t\t\t\t\t'is-required': required,\n\t\t\t\t\t'slds-has-error': errorText,\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t)}\n\t\t>\n\t\t\t<div className=\"slds-form-element__control\">\n\t\t\t\t<span className=\"slds-checkbox\">\n\t\t\t\t\t{required && (\n\t\t\t\t\t\t<abbr className=\"slds-required\" title=\"required\">\n\t\t\t\t\t\t\t*\n\t\t\t\t\t\t</abbr>\n\t\t\t\t\t)}\n\t\t\t\t\t<input\n\t\t\t\t\t\t{...inputProps}\n\t\t\t\t\t\tref={setRef}\n\t\t\t\t\t\ttabIndex={tabIndex ? parseInt(tabIndex, 10) : undefined}\n\t\t\t\t\t\taria-describedby={getAriaDescribedBy()}\n\t\t\t\t\t/>\n\t\t\t\t\t<label\n\t\t\t\t\t\tclassName=\"slds-checkbox__label\"\n\t\t\t\t\t\thtmlFor={getId()}\n\t\t\t\t\t\tid={labelId}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"slds-checkbox_faux\" />\n\t\t\t\t\t\t{labels.label && (\n\t\t\t\t\t\t\t<span className=\"slds-form-element__label\">{labels.label}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{assistiveText.label && (\n\t\t\t\t\t\t\t<span className=\"slds-assistive-text\">{assistiveText.label}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</label>\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t\t{errorText && (\n\t\t\t\t<div className=\"slds-form-element__help\" id={getErrorId()}>\n\t\t\t\t\t{errorText}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n});\n\nCheckbox.displayName = CHECKBOX;\n\nexport default Checkbox;\n\n"],"mappings":"qcAyIA,IAAM,EAAgC,CACrC,eAAgB,WAChB,cAAe,SAChB,EAMM,GAAA,EAAW,EAAA,WAAA,EAA6C,EAAO,IAAQ,CAC5E,GAAM,CACL,cAAe,EACf,UACA,iBACA,YACA,WACA,YACA,GAAI,EACJ,gBACA,OAAQ,EACR,OACA,SACA,WACA,UACA,YACA,aACA,UACA,iBACA,WACA,eACA,WACA,OACA,WACA,UAAU,OACV,YACA,WACA,uBACA,+BACA,kCACA,OAAO,SACP,UACA,GAAG,GACA,EAEE,GAAA,EAAc,EAAA,MAAA,CAAM,EACpB,GAAA,EAAc,EAAA,OAAA,CAAgC,IAAI,EAElD,MAAc,GAAU,EACxB,MAAoB,EAAY,GAAG,EAAM,EAAE,aAAe,IAAA,GAG1D,EACL,OAAO,GAAsB,SAC1B,CAAE,MAAO,CAAkB,EAC3B,CAAE,GAAG,CAAkB,EAGrB,EAAyB,CAC9B,GAAG,EACH,GAAG,CACJ,GAGA,EAAA,EAAA,UAAA,KAAgB,CACX,EAAY,SAAW,IAAkB,IAAA,KAC5C,EAAY,QAAQ,cAAgB,EAEtC,EAAG,CAAC,CAAa,CAAC,GAGlB,EAAA,EAAA,UAAA,KAAgB,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ACd,UAAA,EAAA,EAAA,KAAA,CAAC,OAAD,CAAM,UAAU,gBAAhB,SAAA,CACE,IACA,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,gBAAgB,MAAM,WAAW,SAAA,GAE3C,CAAA,GAEP,EAAA,EAAA,IAAA,CAAC,QAAD,CACC,GAAI,EACJ,IAAK,EACL,SAAU,EAAW,SAAS,EAAU,EAAE,EAAI,IAAA,GAC9C,mBAAkB,EAAmB,CACrC,CAAA,GACD,EAAA,EAAA,KAAA,CAAC,QAAD,CACC,UAAU,uBACV,QAAS,EAAM,EACf,GAAI,EAHL,SAAA,EAKC,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,oBAAsB,CAAA,EACrC,EAAO,QACP,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,2BAA4B,SAAA,EAAO,KAAY,CAAA,EAE/D,EAAc,QACd,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,sBAAuB,SAAA,EAAc,KAAY,CAAA,CAE5D,GACF,GACF,CAAA,EACJ,IACA,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,0BAA0B,GAAI,EAAW,EACtD,SAAA,CACG,CAAA,CAEF,GAEP,CAAC,EAED,EAAS,YAAc,EAAA"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/checkbox/index.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 {\n\tuseId,\n\tuseRef,\n\tuseEffect,\n\tforwardRef,\n\ttype ChangeEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype ReactNode,\n} from 'react';\nimport classNames from 'classnames';\nimport KEYS from '../../utilities/key-code';\nimport EventUtil from '../../utilities/event';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport { CHECKBOX } from '../../utilities/constants';\nimport Icon from '../icon/index';\nimport { checkDeprecatedProps } from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Checkbox variant types\n */\nexport type CheckboxVariant =\n\t'base' | 'toggle' | 'button-group' | 'visual-picker';\n\n/**\n * Checkbox size for visual picker\n */\nexport type CheckboxSize = 'medium' | 'large';\n\n/**\n * Assistive text for Checkbox\n */\nexport interface CheckboxAssistiveText {\n\theading?: string;\n\tlabel?: string;\n}\n\n/**\n * Labels for Checkbox\n */\nexport interface CheckboxLabels {\n\theading?: string;\n\tlabel?: string;\n\ttoggleDisabled?: string;\n\ttoggleEnabled?: string;\n}\n\n/**\n * Change event data\n */\nexport interface CheckboxChangeData {\n\tchecked: boolean;\n\tindeterminate: boolean;\n}\n\n/**\n * Props for the Checkbox component\n */\nexport interface CheckboxProps {\n\t/** aria-controls for related regions */\n\t'aria-controls'?: string;\n\t/** aria-describedby for descriptions */\n\t'aria-describedby'?: string;\n\t/** aria-labelledby for labels */\n\t'aria-labelledby'?: string;\n\t/** aria-owns for owned elements */\n\t'aria-owns'?: string;\n\t/** aria-required for validation */\n\t'aria-required'?: boolean;\n\t/** Assistive text for accessibility */\n\tassistiveText?: CheckboxAssistiveText;\n\t/** Controlled checked state */\n\tchecked?: boolean;\n\t/** Initial uncontrolled checked state */\n\tdefaultChecked?: boolean;\n\t/** CSS class for container */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Disable the checkbox */\n\tdisabled?: boolean;\n\t/** Error message */\n\terrorText?: string;\n\t/** Unique ID */\n\tid?: string;\n\t/** Indeterminate state (partial selection) */\n\tindeterminate?: boolean;\n\t/** Text labels */\n\tlabels?: CheckboxLabels;\n\t/** Form parameter name */\n\tname?: string;\n\t/** Blur event handler */\n\tonBlur?: (event: FocusEvent<HTMLInputElement>) => void;\n\t/** Change event handler */\n\tonChange?: (\n\t\tevent: ChangeEvent<HTMLInputElement>,\n\t\tdata: CheckboxChangeData\n\t) => void;\n\t/** Focus event handler */\n\tonFocus?: (event: FocusEvent<HTMLInputElement>) => void;\n\t/** Key down event handler */\n\tonKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;\n\t/** Key press event handler */\n\tonKeyPress?: (event: KeyboardEvent<HTMLInputElement>) => void;\n\t/** Key up event handler */\n\tonKeyUp?: (event: KeyboardEvent<HTMLInputElement>) => void;\n\t/** Request focus callback */\n\tonRequestFocus?: (element: HTMLInputElement) => void;\n\t/** Read-only mode */\n\treadOnly?: boolean;\n\t/** Trigger onRequestFocus */\n\trequestFocus?: boolean;\n\t/** Mark as required */\n\trequired?: boolean;\n\t/** ARIA role */\n\trole?: string;\n\t/** Tab index */\n\ttabIndex?: string;\n\t/** Checkbox variant */\n\tvariant?: CheckboxVariant;\n\t/** Coverable visual picker */\n\tcoverable?: boolean;\n\t/** Vertical visual picker */\n\tvertical?: boolean;\n\t/** Visual picker figure content, rendered inside `.slds-visual-picker__figure` when not `coverable` */\n\tvisualPickerFigure?: ReactNode;\n\t/** Coverable visual picker figure content shown when selected */\n\tvisualPickerFigureSelected?: ReactNode;\n\t/** Coverable visual picker figure content shown when not selected */\n\tvisualPickerFigureNotSelected?: ReactNode;\n\t/** @deprecated Use `visualPickerFigure` instead. */\n\tonRenderVisualPicker?: () => ReactNode;\n\t/** @deprecated Use `visualPickerFigureSelected` instead. */\n\tonRenderVisualPickerSelected?: () => ReactNode;\n\t/** @deprecated Use `visualPickerFigureNotSelected` instead. */\n\tonRenderVisualPickerNotSelected?: () => ReactNode;\n\t/** Size for visual picker */\n\tsize?: CheckboxSize;\n\t/** Label ID for label element */\n\tlabelId?: string;\n}\n\nconst defaultLabels: CheckboxLabels = {\n\ttoggleDisabled: 'Disabled',\n\ttoggleEnabled: 'Enabled',\n};\n\n/**\n * The ability to style checkboxes with CSS varies across browsers.\n * Using this component ensures checkboxes look the same everywhere.\n */\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {\n\tconst {\n\t\tassistiveText: assistiveTextProp,\n\t\tchecked,\n\t\tdefaultChecked,\n\t\tclassName,\n\t\tdisabled,\n\t\terrorText,\n\t\tid: propId,\n\t\tindeterminate,\n\t\tlabels: labelsProp,\n\t\tname,\n\t\tonBlur,\n\t\tonChange,\n\t\tonFocus,\n\t\tonKeyDown,\n\t\tonKeyPress,\n\t\tonKeyUp,\n\t\tonRequestFocus,\n\t\treadOnly,\n\t\trequestFocus,\n\t\trequired,\n\t\trole,\n\t\ttabIndex,\n\t\tvariant = 'base',\n\t\tcoverable,\n\t\tvertical,\n\t\tvisualPickerFigure,\n\t\tvisualPickerFigureSelected,\n\t\tvisualPickerFigureNotSelected,\n\t\tonRenderVisualPicker,\n\t\tonRenderVisualPickerSelected,\n\t\tonRenderVisualPickerNotSelected,\n\t\tsize = 'medium',\n\t\tlabelId,\n\t\t...restProps\n\t} = props;\n\n\tconst generatedId = useId();\n\tconst internalRef = useRef<HTMLInputElement | null>(null);\n\n\tconst getId = () => propId || generatedId;\n\tconst getErrorId = () => (errorText ? `${getId()}-error-text` : undefined);\n\n\t// Merge assistive text\n\tconst assistiveText: CheckboxAssistiveText = { ...assistiveTextProp };\n\n\t// Merge labels\n\tconst labels: CheckboxLabels = {\n\t\t...defaultLabels,\n\t\t...labelsProp,\n\t};\n\n\tuseEffect(() => {\n\t\tcheckDeprecatedProps(\n\t\t\tCHECKBOX,\n\t\t\t{\n\t\t\t\tonRenderVisualPicker,\n\t\t\t\tonRenderVisualPickerSelected,\n\t\t\t\tonRenderVisualPickerNotSelected,\n\t\t\t},\n\t\t\tcomponentDoc\n\t\t);\n\t}, [\n\t\tonRenderVisualPicker,\n\t\tonRenderVisualPickerSelected,\n\t\tonRenderVisualPickerNotSelected,\n\t]);\n\n\t// Handle indeterminate state\n\tuseEffect(() => {\n\t\tif (internalRef.current && indeterminate !== undefined) {\n\t\t\tinternalRef.current.indeterminate = indeterminate;\n\t\t}\n\t}, [indeterminate]);\n\n\t// Handle request focus\n\tuseEffect(() => {\n\t\tif (requestFocus && onRequestFocus && internalRef.current) {\n\t\t\tonRequestFocus(internalRef.current);\n\t\t}\n\t}, [requestFocus, onRequestFocus]);\n\n\tconst getAriaDescribedBy = (idArray: string[] = []): string | undefined => {\n\t\tconst describedBy = idArray\n\t\t\t.concat(restProps['aria-describedby'] || '', getErrorId() || '')\n\t\t\t.filter(Boolean)\n\t\t\t.join(' ');\n\t\treturn describedBy || undefined;\n\t};\n\n\tconst handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n\t\tif (onChange) {\n\t\t\tonChange(event, {\n\t\t\t\tchecked: indeterminate ? true : !checked,\n\t\t\t\tindeterminate: false,\n\t\t\t});\n\t\t}\n\t};\n\n\tconst handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n\t\tif (event.keyCode === KEYS.ENTER || event.keyCode === KEYS.SPACE) {\n\t\t\tEventUtil.trapImmediate(event);\n\t\t\thandleChange(event as unknown as ChangeEvent<HTMLInputElement>);\n\t\t}\n\t\tonKeyDown?.(event);\n\t};\n\n\tconst ariaProps = getAriaProps(restProps);\n\n\t// Common input props\n\tconst inputProps = {\n\t\tdisabled,\n\t\t...(checked !== undefined ? { checked } : { defaultChecked }),\n\t\tid: getId(),\n\t\tname,\n\t\tonBlur,\n\t\tonChange: handleChange,\n\t\tonFocus,\n\t\tonKeyDown: handleKeyDown,\n\t\tonKeyPress,\n\t\tonKeyUp,\n\t\trole,\n\t\trequired,\n\t\ttype: 'checkbox' as const,\n\t\t...ariaProps,\n\t};\n\n\t// Set ref\n\tconst setRef = (node: HTMLInputElement | null) => {\n\t\tinternalRef.current = node;\n\t\tif (typeof ref === 'function') {\n\t\t\tref(node);\n\t\t} else if (ref) {\n\t\t\tref.current = node;\n\t\t}\n\t};\n\n\t// Button Group Variant\n\tif (variant === 'button-group') {\n\t\treturn (\n\t\t\t<span className=\"slds-button slds-checkbox_button\">\n\t\t\t\t<input\n\t\t\t\t\t{...inputProps}\n\t\t\t\t\tref={setRef}\n\t\t\t\t\taria-describedby={getAriaDescribedBy()}\n\t\t\t\t/>\n\t\t\t\t<label className=\"slds-checkbox_button__label\" htmlFor={getId()}>\n\t\t\t\t\t<span className=\"slds-checkbox_faux\">{labels.label}</span>\n\t\t\t\t\t{assistiveText.label && (\n\t\t\t\t\t\t<span className=\"slds-assistive-text\">{assistiveText.label}</span>\n\t\t\t\t\t)}\n\t\t\t\t</label>\n\t\t\t</span>\n\t\t);\n\t}\n\n\t// Toggle Variant\n\tif (variant === 'toggle') {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-form-element',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-required': required,\n\t\t\t\t\t\t'slds-has-error': errorText,\n\t\t\t\t\t},\n\t\t\t\t\tclassName as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<label className=\"slds-checkbox_toggle slds-grid\" htmlFor={getId()}>\n\t\t\t\t\t{required && (\n\t\t\t\t\t\t<abbr className=\"slds-required\" title=\"required\">\n\t\t\t\t\t\t\t*\n\t\t\t\t\t\t</abbr>\n\t\t\t\t\t)}\n\t\t\t\t\t{labels.label && (\n\t\t\t\t\t\t<span className=\"slds-form-element__label slds-m-bottom_none\">\n\t\t\t\t\t\t\t{labels.label}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t{assistiveText.label && (\n\t\t\t\t\t\t<span className=\"slds-assistive-text\">{assistiveText.label}</span>\n\t\t\t\t\t)}\n\t\t\t\t\t<input\n\t\t\t\t\t\t{...inputProps}\n\t\t\t\t\t\tref={setRef}\n\t\t\t\t\t\taria-describedby={getAriaDescribedBy([`${getId()}-desc`])}\n\t\t\t\t\t/>\n\t\t\t\t\t<span\n\t\t\t\t\t\tid={`${getId()}-desc`}\n\t\t\t\t\t\tclassName=\"slds-checkbox_faux_container\"\n\t\t\t\t\t\taria-live=\"assertive\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"slds-checkbox_faux\" />\n\t\t\t\t\t\t<span className=\"slds-checkbox_on\">{labels.toggleEnabled}</span>\n\t\t\t\t\t\t<span className=\"slds-checkbox_off\">{labels.toggleDisabled}</span>\n\t\t\t\t\t</span>\n\t\t\t\t</label>\n\t\t\t\t{errorText && (\n\t\t\t\t\t<div className=\"slds-form-element__help\" id={getErrorId()}>\n\t\t\t\t\t\t{errorText}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Visual Picker Variant\n\tif (variant === 'visual-picker') {\n\t\treturn (\n\t\t\t<span\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-visual-picker',\n\t\t\t\t\t`slds-visual-picker_${size}`,\n\t\t\t\t\tvertical && 'slds-visual-picker_vertical'\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<input\n\t\t\t\t\t{...inputProps}\n\t\t\t\t\tref={setRef}\n\t\t\t\t\taria-describedby={getAriaDescribedBy()}\n\t\t\t\t/>\n\t\t\t\t<label className=\"slds-checkbox_button__label\" htmlFor={getId()}>\n\t\t\t\t\t{coverable ? (\n\t\t\t\t\t\t<div className=\"slds-visual-picker__figure slds-visual-picker__icon slds-align_absolute-center\">\n\t\t\t\t\t\t\t<span className=\"slds-is-selected\">\n\t\t\t\t\t\t\t\t{visualPickerFigureSelected ?? onRenderVisualPickerSelected?.()}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"slds-is-not-selected\">\n\t\t\t\t\t\t\t\t{visualPickerFigureNotSelected ??\n\t\t\t\t\t\t\t\t\tonRenderVisualPickerNotSelected?.()}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<span className=\"slds-visual-picker__figure slds-visual-picker__text slds-align_absolute-center\">\n\t\t\t\t\t\t\t{visualPickerFigure ?? onRenderVisualPicker?.()}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t{!vertical && (\n\t\t\t\t\t\t<span className=\"slds-visual-picker__body\">\n\t\t\t\t\t\t\t{labels.heading && (\n\t\t\t\t\t\t\t\t<span className=\"slds-text-heading_small\">\n\t\t\t\t\t\t\t\t\t{labels.heading}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<span className=\"slds-text-title\">{labels.label}</span>\n\t\t\t\t\t\t\t{(assistiveText.label || assistiveText.heading) && (\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.heading}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t{!coverable && (\n\t\t\t\t\t\t<span className=\"slds-icon_container slds-visual-picker__text-check\">\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\tassistiveText={assistiveText}\n\t\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\t\tname=\"check\"\n\t\t\t\t\t\t\t\tcolorVariant=\"base\"\n\t\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t</label>\n\t\t\t</span>\n\t\t);\n\t}\n\n\t// Base Variant (default)\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames(\n\t\t\t\t'slds-form-element',\n\t\t\t\t{\n\t\t\t\t\t'is-required': required,\n\t\t\t\t\t'slds-has-error': errorText,\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t)}\n\t\t>\n\t\t\t<div className=\"slds-form-element__control\">\n\t\t\t\t<span className=\"slds-checkbox\">\n\t\t\t\t\t{required && (\n\t\t\t\t\t\t<abbr className=\"slds-required\" title=\"required\">\n\t\t\t\t\t\t\t*\n\t\t\t\t\t\t</abbr>\n\t\t\t\t\t)}\n\t\t\t\t\t<input\n\t\t\t\t\t\t{...inputProps}\n\t\t\t\t\t\tref={setRef}\n\t\t\t\t\t\ttabIndex={tabIndex ? parseInt(tabIndex, 10) : undefined}\n\t\t\t\t\t\taria-describedby={getAriaDescribedBy()}\n\t\t\t\t\t/>\n\t\t\t\t\t<label\n\t\t\t\t\t\tclassName=\"slds-checkbox__label\"\n\t\t\t\t\t\thtmlFor={getId()}\n\t\t\t\t\t\tid={labelId}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"slds-checkbox_faux\" />\n\t\t\t\t\t\t{labels.label && (\n\t\t\t\t\t\t\t<span className=\"slds-form-element__label\">{labels.label}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{assistiveText.label && (\n\t\t\t\t\t\t\t<span className=\"slds-assistive-text\">{assistiveText.label}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</label>\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t\t{errorText && (\n\t\t\t\t<div className=\"slds-form-element__help\" id={getErrorId()}>\n\t\t\t\t\t{errorText}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n});\n\nCheckbox.displayName = CHECKBOX;\n\nexport default Checkbox;\n"],"mappings":"igBAgJA,IAAM,EAAgC,CACrC,eAAgB,WAChB,cAAe,SAChB,EAMM,GAAA,EAAW,EAAA,WAAA,EAA6C,EAAO,IAAQ,CAC5E,GAAM,CACL,cAAe,EACf,UACA,iBACA,YACA,WACA,YACA,GAAI,EACJ,gBACA,OAAQ,EACR,QACA,UACA,WACA,UACA,YACA,aACA,UACA,iBACA,YACA,eACA,WACA,OACA,WACA,UAAU,OACV,YACA,WACA,qBACA,6BACA,gCACA,uBACA,+BACA,kCACA,OAAO,SACP,UACA,GAAG,GACA,EAEE,GAAA,EAAc,EAAA,MAAA,CAAM,EACpB,GAAA,EAAc,EAAA,OAAA,CAAgC,IAAI,EAElD,MAAc,GAAU,EACxB,MAAoB,EAAY,GAAG,EAAM,EAAE,aAAe,IAAA,GAG1D,EAAuC,CAAE,GAAG,CAAkB,EAG9D,EAAyB,CAC9B,GAAG,EACH,GAAG,CACJ,GAEA,EAAA,EAAA,UAAA,K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,QAAD,CACgB,gBACf,SAAS,UACT,KAAK,QACL,aAAa,OACb,KAAK,SACL,CAAA,CACI,CAAA,CAED,CACF,CAAA,CAAA,KAMP,EAAA,EAAA,KAAA,CAAC,MAAD,CACC,WAAA,EAAW,EAAA,QAAA,CACV,oBACA,CACC,cAAe,EACf,iBAAkB,CACnB,EACA,CACD,EARD,SAAA,EAUC,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,6BACd,UAAA,EAAA,EAAA,KAAA,CAAC,OAAD,CAAM,UAAU,gBAAhB,SAAA,CACE,IACA,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,gBAAgB,MAAM,WAAW,SAAA,GAE3C,CAAA,GAEP,EAAA,EAAA,IAAA,CAAC,QAAD,CACC,GAAI,EACJ,IAAK,EACL,SAAU,EAAW,SAAS,EAAU,EAAE,EAAI,IAAA,GAC9C,mBAAkB,EAAmB,CACrC,CAAA,GACD,EAAA,EAAA,KAAA,CAAC,QAAD,CACC,UAAU,uBACV,QAAS,EAAM,EACf,GAAI,EAHL,SAAA,EAKC,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,oBAAsB,CAAA,EACrC,EAAO,QACP,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,2BAA4B,SAAA,EAAO,KAAY,CAAA,EAE/D,EAAc,QACd,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,sBAAuB,SAAA,EAAc,KAAY,CAAA,CAE5D,GACF,GACF,CAAA,EACJ,IACA,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,0BAA0B,GAAI,EAAW,EACtD,SAAA,CACG,CAAA,CAEF,GAEP,CAAC,EAED,EAAS,YAAc,EAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.cjs","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\nexport interface ColorPickerProps {\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/** Array of hex color values for swatch options */\n\tswatchColors?: string[];\n\t/** Which tab is visible when dialog opens (base variant only) */\n\tdefaultSelectedTab?: 'swatches' | 'custom';\n\t/** Which tabs are present */\n\tvariant?: 'base' | 'swatches' | 'custom';\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\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] = useState<WorkingColor>(\n\t\tgetInitialWorkingColor\n\t);\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)(COLOR_PICKER, {\n\t\t\tassistiveText: assistiveTextProp,\n\t\t\tclassName,\n\t\t\tclassNameMenu,\n\t\t\tid: idProp,\n\t\t\tdisabled,\n\t\t\terrorText: errorTextProp,\n\t\t\terrorTextWorkingColor,\n\t\t\tevents,\n\t\t\thasStaticAlignment,\n\t\t\thideInput,\n\t\t\tisOpen: isOpenProp,\n\t\t\tlabels: labelsProp,\n\t\t\tmenuPosition,\n\t\t\tswatchColors,\n\t\t\tdefaultSelectedTab,\n\t\t\tvariant,\n\t\t\tvalue: valueProp,\n\t\t\tvalueWorking: valueWorkingProp,\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: { hex?: string; red?: string | number; green?: string | number; blue?: string | number; hue?: number | string; saturation?: number; value?: number }\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\n\t\t\t\t\t? true\n\t\t\t\t\t: ColorUtils.isValidHex(newCurrentColor);\n\t\t\t}\n\n\t\tsetCurrentColor(newCurrentColor);\n\t\tsetWorkingColor(\n\t\t\tColorUtils.getNewColor(\n\t\t\t\t{\n\t\t\t\t\thex: namedColorHex || newCurrentColor,\n\t\t\t\t\tname: namedColorHex ? newCurrentColor.toLowerCase() : null,\n\t\t\t\t} as { hex: string; name?: string | null },\n\t\t\t\tevents.onValidateWorkingColor\n\t\t\t) as WorkingColor\n\t\t);\n\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\n\t\t\t\t\t\t\t? `color-picker-summary-input-${componentId}`\n\t\t\t\t\t\t\t: 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\tclassName={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={onClose as unknown as ((event?: unknown, data?: { componentWillUnmount?: boolean }) => void) | undefined}\n\t\t\t\t\tonOpen={onOpen as unknown as ((event?: unknown, data?: { portal?: HTMLElement }) => void) | undefined}\n\t\t\t\t\tonRequestClose={handleOnRequestClose as unknown as ((event?: unknown, data?: { trigger?: string }) => void) | undefined}\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\n\t\t\t\t\t\t\t\t\t\t? assistiveText.label\n\t\t\t\t\t\t\t\t\t\t: 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\n"],"mappings":"omBAyFA,IAAM,EAAmC,CACxC,gBAAiB,IACjB,aAAc,SACd,UAAW,SACX,kCAAmC,gBACnC,2BAA4B,qBAC5B,iBAAkB,IAClB,SAAU,MACV,aAAc,+BACd,iBAAkB,8CAClB,eAAgB,IAChB,aAAc,OACd,UAAW,UACX,2BAA4B,oBAC7B,EAEM,EAAiD,CACtD,oBACC,4EACD,UAAW,YACZ,EAEM,EAAsB,4OA8B5B,EAQM,GAA2C,CAChD,cAAe,EACf,YACA,gBACA,GAAI,EACJ,WAAW,GACX,UAAW,EACX,wBACA,SAAS,CAAC,EACV,qBACA,YAAY,GACZ,OAAQ,EACR,OAAQ,EACR,eAAe,WACf,eAAe,EACf,qBAAqB,WACrB,UAAU,OACV,MAAO,EACP,aAAc,EACd,WACA,UACA,iBACA,mBACK,CAEL,IAAM,GAAA,EAAS,EAAA,QAAA,MACP,CAAE,GAAG,EAAe,GAAG,CAAW,GACzC,CAAC,CAAU,CACZ,EACM,GAAA,EAAgB,EAAA,QAAA,MACd,CAAE,GAAG,EAAsB,GAAG,CAAkB,GACvD,CAAC,CAAiB,CACnB,EAGM,IAAA,EAAc,EAAA,OAAA,CAAO,GAAU,EAAA,QAAW,CAAC,EAC3C,EAAc,GAAU,GAAY,QAGpC,IAAA,EAAa,EAAA,OAAA,CAAuB,IAAI,EAGxC,GAAA,EAAy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AQ,MACR,CAAA,CACO,CAAA,EACR,GAAY,EACZ,CAAC,GAAU,IACX,EAAA,EAAA,IAAA,CAAC,IAAD,CACC,UAAU,kBACV,GAAI,8BAA8B,IAEjC,SAAA,CACC,CAAA,CAEA,GACD,CAAA,CAEP,EAEA,EAAY,YAAc,EAAA"}
|
|
1
|
+
{"version":3,"file":"color-picker.cjs","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\tclassName={classNames('slds-color-picker__selector', classNameMenu)}\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":"omBAgHA,IAAM,EAAmC,CACxC,gBAAiB,IACjB,aAAc,SACd,UAAW,SACX,kCAAmC,gBACnC,2BAA4B,qBAC5B,iBAAkB,IAClB,SAAU,MACV,aAAc,+BACd,iBAAkB,8CAClB,eAAgB,IAChB,aAAc,OACd,UAAW,UACX,2BAA4B,oBAC7B,EAEM,EAAiD,CACtD,oBACC,4EACD,UAAW,YACZ,EAEM,EAAsB,4OA8B5B,EAQM,GAA2C,CAChD,cAAe,EACf,YACA,gBACA,GAAI,EACJ,WAAW,GACX,UAAW,EACX,wBACA,SAAS,CAAC,EACV,qBACA,YAAY,GACZ,OAAQ,EACR,OAAQ,EACR,eAAe,WACf,eAAe,EACf,qBAAqB,WACrB,UAAU,OACV,MAAO,EACP,aAAc,EACd,WACA,UACA,iBACA,mBACK,CAEL,IAAM,GAAA,EAAS,EAAA,QAAA,MACP,CAAE,GAAG,EAAe,GAAG,CAAW,GACzC,CAAC,CAAU,CACZ,EACM,GAAA,EAAgB,EAAA,QAAA,MACd,CAAE,GAAG,EAAsB,GAAG,CAAkB,GACvD,CAAC,CAAiB,CACnB,EAGM,IAAA,EAAc,EAAA,OAAA,CAAO,GAAU,EAAA,QAAW,CAAC,EAC3C,EAAc,GAAU,GAAY,QAGpC,IAAA,EAAa,EAAA,OAAA,CAAuB,IAAI,EAGxC,GAAA,EAAyB,EAAA,YAAA,KACvB,EAAA,QAAW,YACjB,CAAE,IAAK,GAAoB,CAAU,EACrC,EAAO,sBACR,EACE,CAAC,EAAkB,EAAW,EAAO,sBAAsB,CAAC,EAGzD,CAAC,EAAc,IAAA,EAAmB,EAAA,SAAA,CACv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AA,CAEP,EAEA,EAAY,YAAc,EAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=({subheadings:e,filteredOptions:t})=>{let n=[...e],r={noSubHeaderType:[]};return n.forEach(e=>{e.id&&(r[e.id]=[e])}),t.forEach(e=>{
|
|
1
|
+
var e=({subheadings:e,filteredOptions:t})=>{let n=[...e],r={noSubHeaderType:[]};return n.forEach(e=>{e.id&&(r[e.id]=[e])}),t.forEach(e=>{let t=e.category??e.type;r[t]?r[t].push(e):r.noSubHeaderType.push(e)}),[].concat(...Object.values(r))};exports.default=e;
|
|
2
2
|
//# sourceMappingURL=add-subheadings.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-subheadings.cjs","names":[],"sources":["../../../../components/combobox/add-subheadings.js"],"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\n/**\n * This is a UX pattern recommendation for auto-complete search results that can contain multiple subheadings within the results. It inserts a subheading object based on `option.
|
|
1
|
+
{"version":3,"file":"add-subheadings.cjs","names":[],"sources":["../../../../components/combobox/add-subheadings.js"],"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\n/**\n * This is a UX pattern recommendation for auto-complete search results that can contain multiple subheadings within the results. It inserts a subheading object based on `option.category === subheading.id` directly before a found option object and only inserts the subheading at the first occurence of that type of option.\n */\n\nconst addSubheadings = ({ subheadings, filteredOptions }) => {\n\t// Let's not mutate things we don't own.\n\tconst subheadingsCopy = [...subheadings];\n\tconst sortedOptions = { noSubHeaderType: [] };\n\n\t// populate an object with subheader ID as the keys\n\tsubheadingsCopy.forEach((subH) => {\n\t\tif (subH.id) {\n\t\t\tsortedOptions[subH.id] = [subH];\n\t\t}\n\t});\n\n\t// sort options into arrays using option category\n\t// if option category and subheader ID are equal, add to array, if no option category, add to noSubHeaderType array\n\tfilteredOptions.forEach((option) => {\n\t\t// `type` held the category before v11; Combobox warns about it in development.\n\t\tconst category = option.category ?? option.type;\n\t\tif (sortedOptions[category]) {\n\t\t\tsortedOptions[category].push(option);\n\t\t} else {\n\t\t\tsortedOptions.noSubHeaderType.push(option);\n\t\t}\n\t});\n\n\t// get object values by dropping keys\n\t// flatten and remove child arrays, so that we have one array\n\t// `...` operates on each array item, not the array\n\treturn [].concat(...Object.values(sortedOptions));\n};\n\nexport default addSubheadings;\n"],"mappings":"AAOA,IAAM,GAAkB,CAAE,cAAa,qBAAsB,CAE5D,IAAM,EAAkB,CAAC,GAAG,CAAW,EACjC,EAAgB,CAAE,gBAAiB,CAAC,CAAE,EAwB5C,OArBA,EAAgB,QAAS,GAAS,CAC7B,EAAK,KACR,EAAc,EAAK,IAAM,CAAC,CAAI,EAEhC,CAAC,EAID,EAAgB,QAAS,GAAW,CAEnC,IAAM,EAAW,EAAO,UAAY,EAAO,KACvC,EAAc,GACjB,EAAc,EAAS,CAAC,KAAK,CAAM,EAEnC,EAAc,gBAAgB,KAAK,CAAM,CAE3C,CAAC,EAKM,CAAC,CAAC,CAAC,OAAO,GAAG,OAAO,OAAO,CAAa,CAAC,CACjD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../../utilities/
|
|
1
|
+
const e=require("../../utilities/get-component-doc.cjs"),t=require("../../utilities/warning/one-of-required-property.cjs"),n=require("../../utilities/warning/deprecated-property.cjs");var r=function(){};process.env.NODE_ENV!==`production`&&(r=function(r,i,a){let o=e.default(a);n.default(r,i.isInline,`isInline`,`menuPosition="relative"`,o(`menuPosition`)),n.default(r,i.menuItem,`menuItem`,`renderMenuItem`,o(`renderMenuItem`)),n.default(r,i.onRenderMenuItem,`onRenderMenuItem`,`renderMenuItem`,`\`renderMenuItem\` is a function called with \`{ assistiveText, isSelected, option }\`, not a component. ${o(`renderMenuItem`)}`),n.default(r,i.readOnlyMenuItemVisibleLength,`readOnlyMenuItemVisibleLength`,`menuItemVisibleLength`,o(`menuItemVisibleLength`)),[`optionsSearchEntity`,`optionsAddItem`].forEach(e=>{let t=(i[e]||[]).find(e=>e&&e.onClick);n.default(r,t&&t.onClick,`${e}[].onClick`,`events.onSelectActionItem`,`Until then, if both are set, both are called. ${o(`events`)}`)});let s=[`separator`,`header`,`footer`,`deselect`],c=(i.options||[]).find(e=>e?.type&&!s.includes(e.type));n.default(r,c?.type,`options[].type`,`options[].category`,`\`type\` only accepts ${s.map(e=>`'${e}'`).join(`, `)}. ${o(`options`)}`),i.variant===`popover`?t.default(r,{"assistiveText['popoverLabel']":i.assistiveText.popoverLabel},o(`assistiveText`)):t.default(r,{options:i.options},o(`options`))});var i=r;exports.default=i;
|
|
2
2
|
//# sourceMappingURL=check-props.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-props.cjs","names":[],"sources":["../../../../components/combobox/check-props.js"],"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/* eslint-disable import/no-mutable-exports */\n\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport oneOfRequiredProperty from '../../utilities/warning/one-of-required-property';\nimport getComponentDocFn from '../../utilities/get-component-doc';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\t\t/* eslint-disable max-len */\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.isInline,\n\t\t\t'isInline',\n\t\t\t'menuPosition=\"relative\"',\n\t\t\tcreateDocUrl('menuPosition')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.menuItem,\n\t\t\t'menuItem',\n\t\t\t'
|
|
1
|
+
{"version":3,"file":"check-props.cjs","names":[],"sources":["../../../../components/combobox/check-props.js"],"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/* eslint-disable import/no-mutable-exports */\n\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport oneOfRequiredProperty from '../../utilities/warning/one-of-required-property';\nimport getComponentDocFn from '../../utilities/get-component-doc';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\t\t/* eslint-disable max-len */\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.isInline,\n\t\t\t'isInline',\n\t\t\t'menuPosition=\"relative\"',\n\t\t\tcreateDocUrl('menuPosition')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.menuItem,\n\t\t\t'menuItem',\n\t\t\t'renderMenuItem',\n\t\t\tcreateDocUrl('renderMenuItem')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onRenderMenuItem,\n\t\t\t'onRenderMenuItem',\n\t\t\t'renderMenuItem',\n\t\t\t`\\`renderMenuItem\\` is a function called with \\`{ assistiveText, isSelected, option }\\`, not a component. ${createDocUrl('renderMenuItem')}`\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.readOnlyMenuItemVisibleLength,\n\t\t\t'readOnlyMenuItemVisibleLength',\n\t\t\t'menuItemVisibleLength',\n\t\t\tcreateDocUrl('menuItemVisibleLength')\n\t\t);\n\t\t['optionsSearchEntity', 'optionsAddItem'].forEach((propName) => {\n\t\t\tconst itemWithOnClick = (props[propName] || []).find(\n\t\t\t\t(item) => item && item.onClick\n\t\t\t);\n\t\t\tdeprecatedProperty(\n\t\t\t\tCOMPONENT,\n\t\t\t\titemWithOnClick && itemWithOnClick.onClick,\n\t\t\t\t`${propName}[].onClick`,\n\t\t\t\t'events.onSelectActionItem',\n\t\t\t\t`Until then, if both are set, both are called. ${createDocUrl('events')}`\n\t\t\t);\n\t\t});\n\t\t/* eslint-enable max-len */\n\n\t\t// `type` is reserved for structural rows. Item options used it to\n\t\t// group under `comboboxAddSubheadings`, which now reads `category`.\n\t\tconst structuralTypes = ['separator', 'header', 'footer', 'deselect'];\n\t\tconst itemWithType = (props.options || []).find(\n\t\t\t(option) => option?.type && !structuralTypes.includes(option.type)\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\titemWithType?.type,\n\t\t\t'options[].type',\n\t\t\t'options[].category',\n\t\t\t`\\`type\\` only accepts ${structuralTypes.map((type) => `'${type}'`).join(', ')}. ${createDocUrl('options')}`\n\t\t);\n\n\t\tif (props.variant !== 'popover') {\n\t\t\toneOfRequiredProperty(\n\t\t\t\tCOMPONENT,\n\t\t\t\t{\n\t\t\t\t\toptions: props.options,\n\t\t\t\t},\n\t\t\t\tcreateDocUrl('options')\n\t\t\t);\n\t\t} else {\n\t\t\toneOfRequiredProperty(\n\t\t\t\tCOMPONENT,\n\t\t\t\t{\n\t\t\t\t\t\"assistiveText['popoverLabel']\": props.assistiveText.popoverLabel,\n\t\t\t\t},\n\t\t\t\tcreateDocUrl('assistiveText')\n\t\t\t);\n\t\t}\n\t};\n}\n\nexport default checkProps;\n"],"mappings":"wLAQA,IAAI,EAAa,UAA8B,CAAC,EAEhD,QAAA,IAAA,WAA6B,eAC5B,EAAa,SAA4B,EAAW,EAAO,EAAS,CACnE,IAAM,EAAe,EAAA,QAAkB,CAAO,EAE9C,EAAA,QACC,EACA,EAAM,SACN,WACA,0BACA,EAAa,cAAc,CAC5B,EACA,EAAA,QACC,EACA,EAAM,SACN,WACA,iBACA,EAAa,gBAAgB,CAC9B,EACA,EAAA,QACC,EACA,EAAM,iBACN,mBACA,iBACA,4GAA4G,EAAa,gBAAgB,GAC1I,EACA,EAAA,QACC,EACA,EAAM,8BACN,gCACA,wBACA,EAAa,uBAAuB,CACrC,EACA,CAAC,sBAAuB,gBAAgB,CAAC,CAAC,QAAS,GAAa,CAC/D,IAAM,GAAmB,EAAM,IAAa,CAAC,EAAA,CAAG,KAC9C,GAAS,GAAQ,EAAK,OACxB,EACA,EAAA,QACC,EACA,GAAmB,EAAgB,QACnC,GAAG,EAAS,YACZ,4BACA,iDAAiD,EAAa,QAAQ,GACvE,CACD,CAAC,EAKD,IAAM,EAAkB,CAAC,YAAa,SAAU,SAAU,UAAU,EAC9D,GAAgB,EAAM,SAAW,CAAC,EAAA,CAAG,KACzC,GAAW,GAAQ,MAAQ,CAAC,EAAgB,SAAS,EAAO,IAAI,CAClE,EACA,EAAA,QACC,EACA,GAAc,KACd,iBACA,qBACA,yBAAyB,EAAgB,IAAK,GAAS,IAAI,EAAK,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,IAAI,EAAa,SAAS,GAC1G,EAEI,EAAM,UAAY,UASrB,EAAA,QACC,EACA,CACC,gCAAiC,EAAM,cAAc,YACtD,EACA,EAAa,eAAe,CAC7B,EAdA,EAAA,QACC,EACA,CACC,QAAS,EAAM,OAChB,EACA,EAAa,SAAS,CACvB,CAUF,GAGD,IAAA,EAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../icon-settings/index.cjs"),r=require("../../utilities/generate-id.cjs"),i=require("../../utilities/key-code.cjs"),a=require("../utilities/dialog/index.cjs"),ee=require("../button/index.cjs"),te=require("../../utilities/key-buffer.cjs"),o=require("../input/private/inner-input.cjs"),ne=require("../tooltip/private/field-level-help-tooltip.cjs"),s=require("../icon/input-icon/index.cjs"),re=require("../popover/index.cjs"),ie=require("./private/menu.cjs"),ae=require("../forms/private/label.cjs"),oe=require("../../utilities/key-callbacks.cjs"),se=require("../pill-container/private/selected-listbox.cjs"),ce=require("../../utilities/key-letter-menu-item-select.cjs"),le=require("../../utilities/menu-item-select-scroll.cjs"),ue=require("./check-props.cjs"),de=require("./component.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime"),fe=require("dequal"),pe=require("lodash.isfunction");pe=e.__toESM(pe,1);let d=require("lodash.assign");d=e.__toESM(d,1);let me=require("lodash.findindex");me=e.__toESM(me,1);let he=require("lodash.find");he=e.__toESM(he,1);let ge=require("lodash.reject");ge=e.__toESM(ge,1);var f,_e=typeof document<`u`,ve={label:``,loadingMenuItems:`Loading`,optionSelectedInMenu:`Current Selection:`,popoverLabel:``,removeSingleSelectedOption:`Remove selected option`,removePill:`, Press delete or backspace to remove`,selectedListboxLabel:`Selected Options:`},ye={deselectOption:`None`,label:``,cancelButton:`Cancel`,doneButton:`Done`,multipleOptionsSelected:``,noOptionsFound:`No matches found.`,placeholder:``,placeholderReadOnly:`Select an Option`,removePillTitle:`Remove`,optionDisabledTooltipLabel:`This option is disabled.`,inputIconTitle:``},be={},xe=e=>{let{assistiveText:xe={},"aria-describedby":Se,className:p,classNameContainer:Ce,classNameMenu:we,classNameMenuSubHeader:Te,defaultValue:m,disabled:Ee,entityCombobox:De,errorText:h,events:Oe={},fieldLevelHelpTooltip:ke,hasDeselect:Ae,hasInputSpinner:je,hasMenuSpinner:Me,hasStaticAlignment:Ne,id:Pe,inheritWidthOf:Fe=`target`,input:Ie,inputRef:Le,isOpen:g,labels:Re={},menuItemVisibleLength:ze,menuMaxWidth:Be,menuPosition:Ve=`absolute`,multiple:_,onRenderMenuItem:He,options:v=[],optionsAddItem:Ue=[],optionsSearchEntity:We=[],popover:y,predefinedOptionsOnly:b,required:x=!1,selection:S=[],selectedListboxRef:Ge,singleInputDisabled:Ke=!1,tooltipMenuItemDisabled:qe,value:C,variant:w=`base`,menuItem:Je}=e,T=(0,d.default)({},ve,xe),E=(0,d.default)({},ye,Re),D=(0,d.default)({},be,Oe),Ye=(0,c.useContext)(n.IconSettingsContext),O=(0,c.useRef)(null),k=(0,c.useRef)(null),Xe=(0,c.useRef)(null),Ze=(0,c.useRef)(null),Qe=(0,c.useRef)(null),$e=(0,c.useRef)(new te.default),et=(0,c.useRef)(r.default()),tt=(0,c.useRef)(r.default()),A=(0,c.useCallback)(()=>Pe||et.current,[Pe]),nt=`${A()}-deselect`,[j,M]=(0,c.useState)(void 0),[N,P]=(0,c.useState)(-1),[F,I]=(0,c.useState)(S?.[0]),[L,R]=(0,c.useState)(0),[rt,z]=(0,c.useState)(!1),[B,it]=(0,c.useState)(typeof g==`boolean`&&g),[at,ot]=(0,c.useState)(!1);(0,c.useEffect)(()=>{ue.default(t.COMBOBOX,e,de.default)},[]);let V=(0,c.useCallback)(()=>!!(typeof g==`boolean`?g:B),[g,B]),st=(0,c.useCallback)(()=>j&&N!==-1,[j,N]),H=(0,c.useCallback)(()=>Se||h&&tt.current,[Se,h]),U=(0,c.useCallback)(()=>{let e={id:nt,label:E.deselectOption,value:``,type:`deselect`},t=We.map(e=>({...e,type:`header`,id:e.id||``})),n=Ue.map(e=>({...e,type:`footer`,id:e.id||``}));return[...t.length>0?t:[],...Ae?[e]:[],...v&&v.length>0?v:[],...n.length>0?n:[]]},[nt,E.deselectOption,We,Ue,Ae,v]),ct=(0,c.useCallback)(({selection:e,option:t})=>!!(0,he.default)(e,t),[]),lt=(0,c.useCallback)(({activeOptionIndex:e,offset:t,options:n})=>{let r=e+t,i=n.length>r&&r>=0&&n[r].type===`separator`?r+t:r;return n.length>r&&r>=0?i:e},[]),W=(0,c.useCallback)((e,{trigger:t}={})=>{if(V()){if(f&&f.handleClose===W&&(f=void 0),M(void 0),P(-1),it(!1),w===`popover`&&t===`cancel`){let n=y?.props;n?.onClose&&n.onClose(e,{trigger:t})}D.onClose&&D.onClose(e,{})}},[V,w,y,D]),ut=(0,c.useCallback)((e,t)=>{if(!V())f&&(0,pe.default)(f.handleClose)&&f.handleClose();else if(f={handleClose:W},it(!0),D.onOpen&&D.onOpen(e,t||{}),w===`readonly`){let e=U(),t=(0,me.default)(e,e=>(0,fe.dequal)(e,S[0]));P(t),M(S[0]),k.current!==null&&le.default({container:k.current,focusedIndex:t})}},[V,W,D,w,U,S]),dt=(0,c.useCallback)((e,t)=>{D.onRequestClose&&D.onRequestClose(e,t),V()&&W(e,{trigger:`cancel`})},[D,V,W]),G=(0,c.useCallback)(()=>{D.onRequestOpen?D.onRequestOpen():it(!0)},[D]),K=(0,c.useCallback)(()=>{(!_&&S.length===0&&w===`inline-listbox`||_||w===`readonly`)&&G()},[_,S.length,w,G]);(0,c.useCallback)(e=>{dt(e,{})},[dt]);let ft=(0,c.useCallback)((e,{selection:t,option:n})=>{let r,i=ct({selection:t,option:n}),a=!_&&!i,ee=_&&!i;r=n.id===nt?[]:a?[n]:ee?[...S,n]:(0,ge.default)(S,n),D.onSelect&&D.onSelect(e,{selection:r}),W()},[ct,_,nt,S,D,W]),q=(0,c.useCallback)(e=>{setTimeout(()=>{let t=_e?document.activeElement:null;t&&t.tagName===`DIV`&&t.id===`${A()}-listbox`?O.current&&O.current.focus():y||W(e)},200),D.onBlur&&D.onBlur(e)},[A,y,W,D]),J=(0,c.useCallback)(e=>{K(),D.onChange&&D.onChange(e,{value:e.target.value})},[K,D]),Y=(0,c.useCallback)(e=>{D.onFocus&&D.onFocus(e,{})},[D]),pt=(0,c.useCallback)(e=>{if(j===void 0&&N===-1&&(B?dt(e,{}):e.shiftKey||G()),!j?.disabled){if(j&&(j.type===`header`||j.type===`footer`)){j.onClick?.(e);return}st()?ft(e,{option:j,selection:S}):!b&&e.target.value!==``&&D.onSubmit&&D.onSubmit(e,{value:e.target.value})}},[j,N,B,G,dt,st,ft,S,b,D]),mt=(0,c.useCallback)((e,{direction:t})=>{let n={next:1,previous:-1},r=U(),i=lt({activeOptionIndex:N,offset:n[t],options:r});V()&&k.current&&le.default({container:k.current,focusedIndex:i}),M(r[i]),P(i)},[U,lt,N,V]),X=(0,c.useCallback)((e,{direction:t})=>{let n={next:1,previous:-1},r=L+1===S.length&&t===`next`,i=L===0&&t===`previous`;if(r)I(S[0]),R(0),z(!0);else if(i)I(S[S.length-1]),R(S.length-1),z(!0);else{let e=lt({activeOptionIndex:L,offset:n[t],options:S});I(S[e]),R(e),z(!0)}},[L,S,lt]),ht=(0,c.useCallback)(e=>{e.shiftKey||G(),w!==`popover`&&mt(e,{direction:`next`})},[G,w,mt]),gt=(0,c.useCallback)(e=>{!e.shiftKey&&V()&&mt(e,{direction:`previous`})},[V,mt]),_t=(0,c.useCallback)(()=>{Xe.current&&z(!0)},[]),vt=(0,c.useCallback)(e=>{let t=U(),n=ce.default({key:e.key,keyBuffer:$e.current,keyCode:e.keyCode,options:t});n!==void 0&&(V()&&k.current&&le.default({container:k.current,focusedIndex:n}),M(t[n]),P(n))},[U,V]),Z=(0,c.useCallback)(e=>{let t={[i.default.DOWN]:{callback:ht},[i.default.ENTER]:{callback:pt},[i.default.ESCAPE]:{callback:W},[i.default.UP]:{callback:gt}};w===`readonly`&&(S.length>2?t[i.default.TAB]={callback:_t}:t[i.default.TAB]=void 0,t.other={callback:vt,stopPropagation:!1});let n=V();oe.default(e,{callbacks:t,stopPropagation:n})},[ht,pt,W,gt,w,S.length,_t,vt,V]),yt=(0,c.useCallback)(()=>{z(!1)},[]),bt=(0,c.useCallback)((e,{option:t,index:n})=>{rt||(I(t),R(n),z(!0))},[rt]),xt=(0,c.useCallback)((e,{option:t,index:n})=>{e.preventDefault();let r=S.length===1,i=S.length===2&&w===`readonly`&&_,a=n!==void 0&&n+1===S.length;(r||i)&&O.current?O.current.focus():a&&n!==void 0?(I(S[n-1]),R(n-1),z(!0)):n!==void 0&&(I(S[n+1]),R(n),z(!0)),D.onRequestRemoveSelectedOption&&D.onRequestRemoveSelectedOption(e,{selection:(0,ge.default)(S,t)})},[S,w,_,D]),St=(0,c.useCallback)((e,{ref:t})=>{t&&(Ze.current=t,Ze.current.focus())},[]),Q=(0,c.useCallback)(e=>{O.current=e,at||ot(!0),Le&&Le(e)},[at,Le]),Ct=(0,c.useCallback)(e=>{Xe.current=e,Ge&&Ge(e)},[Ge]),wt=(0,c.useCallback)(e=>{k.current=e},[]),Tt=(0,c.useCallback)(()=>O.current,[]);(0,c.useEffect)(()=>{typeof g==`boolean`&&(it(g),g||(M(void 0),P(-1)))},[g]),(0,c.useEffect)(()=>{let e=U();if(j){let t=(0,me.default)(e,e=>(0,fe.dequal)(e,j));t===-1?(M(void 0),P(-1)):P(t)}},[v,U,j]),(0,c.useEffect)(()=>{if(S.length===0){F!==void 0&&(I(void 0),R(0));return}if(!F||!S[L]){let e=L>=S.length?S.length-1:L;I(S[e]),R(e)}},[S,F,L]),(0,c.useEffect)(()=>()=>{f&&f.handleClose===W&&(f=void 0)},[W]);let Et=(0,c.useCallback)(e=>{let t=(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`div`,{className:`slds-assistive-text`,id:`${A()}-label`,children:T.popoverLabel}),e]}),n=(0,u.jsxs)(`div`,{children:[(0,u.jsx)(ee.default,{label:E.cancelButton,onClick:e=>{W(e,{trigger:`cancel`})}}),(0,u.jsx)(ee.default,{label:E.doneButton,variant:`brand`,onClick:W})]}),r={ariaLabelledby:`${A()}-label`,align:`bottom`,body:t,className:`slds-popover_full-width`,footer:n,footerClassName:`slds-popover__footer_form`,hasNoNubbin:!0,id:A(),isOpen:B,hasNoTriggerStyles:!0,onOpen:ut,onClose:W,onRequestClose:W},i=y?.props,a=(0,d.default)(r,i||{});return a.body=t,delete a.children,a},[A,T.popoverLabel,E.cancelButton,E.doneButton,W,B,ut,y]),Dt=(0,c.useCallback)(({menuRenderer:e})=>{let t=Ve;if(!Ee&&V()){let n={align:`bottom left`,context:Ye,hasStaticAlignment:Ne,inheritWidthOf:Fe,onClose:W,onMouseDown:e=>{e.preventDefault()},onOpen:ut,onRequestTargetElement:Tt,position:t,containerProps:{id:`${A()}-listbox`,role:`listbox`}};return(0,u.jsx)(a.default,{...n,children:e})}return null},[Ve,Ee,V,Ye,Ne,Fe,W,ut,Tt,A]),Ot=(0,c.useCallback)(()=>{let e={base:`icon-title-subtitle`,"inline-listbox":`icon-title-subtitle`,readonly:`checkbox`},t=w===`readonly`?5:null;return(0,u.jsx)(ie.default,{assistiveText:T,activeOption:j,activeOptionIndex:N,classNameMenu:we,classNameMenuSubHeader:Te,inheritWidthOf:Fe,inputId:A(),inputValue:C,isSelected:ct,itemVisibleLength:ze||t,labels:{noOptionsFound:E.noOptionsFound||``},hasMenuSpinner:Me,menuPosition:Ve,menuRef:wt,maxWidth:Be,options:U(),onSelect:ft,onRenderMenuItem:He||Je,selection:S,tooltipMenuItemDisabled:qe,variant:e[w]})},[w,T,j,N,we,Te,Fe,A,C,ct,ze,E.noOptionsFound,Me,Ve,wt,Be,U,ft,He,Je,S,qe]),$=Ie?.props||{},kt=()=>(0,u.jsxs)(`div`,{className:`slds-form-element__control`,children:[(0,u.jsx)(`div`,{className:`slds-combobox_container`,children:(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-combobox`,`slds-dropdown-trigger`,`slds-dropdown-trigger_click`,`ignore-react-onclickoutside`,{"slds-is-open":V(),"slds-has-error":h},p),role:`combobox`,"aria-expanded":V(),"aria-haspopup":`listbox`,"aria-owns":V()?`${A()}-listbox`:void 0,children:[(0,u.jsx)(o.default,{"aria-autocomplete":`list`,"aria-controls":V()?`${A()}-listbox`:void 0,"aria-activedescendant":j?`${A()}-listbox-option-${j.id}`:void 0,"aria-describedby":H(),autoComplete:`off`,className:`slds-combobox__input`,containerProps:{className:`slds-combobox__form-element`,role:`none`},hasSpinner:je,iconRight:(0,u.jsx)(s.default,{category:`utility`,name:`search`,title:E.inputIconTitle}),id:A(),onFocus:Y,onBlur:q,onKeyDown:Z,inputRef:Q,onClick:()=>G(),onChange:J,placeholder:E.placeholder,defaultValue:m,readOnly:!!(b&&j),required:x,role:`textbox`,value:b&&j?.label||C,...$}),Dt({menuRenderer:Ot()})]})}),(0,u.jsx)(se.default,{activeOption:F,activeOptionIndex:L,assistiveText:T,events:{onBlurPill:yt,onPillFocus:bt,onRequestFocus:St,onRequestFocusOnNextPill:X,onRequestFocusOnPreviousPill:X,onRequestRemove:xt},id:`${A()}-selected-listbox`,labels:E,selectedListboxRef:Ct,selection:S,listboxHasFocus:rt,multiselectable:_}),h&&(0,u.jsx)(`div`,{className:`slds-has-error`,children:(0,u.jsx)(`div`,{id:H(),className:`slds-form-element__help slds-has-error`,children:h})})]}),At=()=>(0,u.jsx)(`div`,{className:`slds-form-element__control`,children:(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-combobox_container`,{"slds-has-inline-listbox":S.length}),children:[S.length?(0,u.jsx)(se.default,{activeOption:F,activeOptionIndex:L,assistiveText:T,containerRole:`listbox`,containerAriaOrientation:`horizontal`,listboxRole:`group`,listboxAriaOrientation:null,events:{onBlurPill:yt,onPillFocus:bt,onRequestFocus:St,onRequestFocusOnNextPill:X,onRequestFocusOnPreviousPill:X,onRequestRemove:xt},id:`${A()}-selected-listbox`,labels:E,selectedListboxRef:Ct,selection:S,listboxHasFocus:rt,multiselectable:_}):null,(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-combobox`,`slds-dropdown-trigger`,`slds-dropdown-trigger_click`,`ignore-react-onclickoutside`,{"slds-is-open":V(),"slds-has-error":h},p),role:`combobox`,"aria-expanded":V(),"aria-haspopup":`listbox`,children:[(0,u.jsx)(o.default,{"aria-autocomplete":`list`,"aria-controls":V()?`${A()}-listbox`:void 0,"aria-activedescendant":j?`${A()}-listbox-option-${j.id}`:void 0,"aria-describedby":H(),defaultValue:m,autoComplete:`off`,className:`slds-combobox__input`,containerProps:{className:`slds-combobox__form-element`,role:`none`},hasSpinner:je,iconRight:(0,u.jsx)(s.default,{category:`utility`,name:`search`,title:E.inputIconTitle}),id:A(),onFocus:Y,onBlur:q,onKeyDown:Z,inputRef:Q,onClick:()=>G(),onChange:J,placeholder:E.placeholder,readOnly:!!(b&&j),required:x,role:`textbox`,value:b&&j?.label||C,...$}),Dt({menuRenderer:Ot()}),h&&(0,u.jsx)(`div`,{id:H(),className:`slds-form-element__help`,children:h})]})]})}),jt=()=>{let e=S[0]?.icon,t=e&&c.default.isValidElement(e)?c.default.cloneElement(e,{containerClassName:`slds-combobox__input-entity-icon`}):null,n=S[0]?.label?S[0].label:C;return(0,u.jsxs)(`div`,{className:`slds-form-element__control`,children:[(0,u.jsx)(`div`,{className:(0,l.default)(`slds-combobox_container`,{"slds-has-inline-listbox":S.length}),children:(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-combobox`,`slds-dropdown-trigger`,`slds-dropdown-trigger_click`,`ignore-react-onclickoutside`,{"slds-is-open":V(),"slds-has-error":h},p),role:`combobox`,"aria-expanded":V(),"aria-haspopup":`listbox`,children:[(0,u.jsx)(o.default,{defaultValue:m,"aria-autocomplete":`list`,"aria-controls":V()?`${A()}-listbox`:void 0,"aria-activedescendant":j?`${A()}-listbox-option-${j.id}`:void 0,"aria-describedby":H(),autoComplete:`off`,className:`slds-combobox__input`,containerProps:{className:`slds-combobox__form-element`,role:`none`},disabled:Ke,hasSpinner:je,iconRight:S.length?(0,u.jsx)(s.default,{assistiveText:{icon:T.removeSingleSelectedOption},buttonRef:e=>{Qe.current=e},category:`utility`,iconPosition:`right`,name:`close`,onClick:e=>{xt(e,{option:S[0]})}}):(0,u.jsx)(s.default,{category:`utility`,name:`search`}),iconLeft:t,id:A(),onFocus:Y,onBlur:q,onKeyDown:Z,inputRef:Q,onClick:()=>K(),onChange:e=>{S.length||J(e)},placeholder:E.placeholder,readOnly:!!(b&&j)||!!S.length,required:x,role:`textbox`,value:b?j?.label||C:n,...$}),Dt({menuRenderer:Ot()})]})}),h&&(0,u.jsx)(`div`,{className:`slds-has-error`,children:(0,u.jsx)(`div`,{id:H(),className:`slds-form-element__help`,children:h})})]})},Mt=()=>{let e=y?.props,t=Et(e?.body);return(0,u.jsxs)(`div`,{className:`slds-form-element__control`,children:[(0,u.jsx)(`div`,{className:`slds-combobox_container`,children:(0,u.jsx)(`div`,{className:(0,l.default)(`slds-combobox`,`slds-dropdown-trigger`,`slds-dropdown-trigger_click`,`ignore-react-onclickoutside`,{"slds-is-open":V(),"slds-has-error":h},p),role:`combobox`,"aria-expanded":V(),"aria-haspopup":`dialog`,children:(0,u.jsx)(re.default,{...t,children:(0,u.jsx)(o.default,{"aria-autocomplete":`none`,"aria-controls":V()?`${A()}-popover`:void 0,"aria-describedby":H(),autoComplete:`off`,className:`slds-combobox__input`,containerProps:{className:`slds-combobox__form-element`,role:`none`},iconRight:(0,u.jsx)(s.default,{category:`utility`,name:`down`,variant:`combobox`}),id:A(),onFocus:Y,onBlur:q,onKeyDown:Z,inputRef:Q,onClick:()=>G(),onChange:J,placeholder:E.placeholder,readOnly:!0,required:x,role:`textbox`,value:C})})})}),h&&(0,u.jsx)(`div`,{className:`slds-has-error`,children:(0,u.jsx)(`div`,{id:H(),className:`slds-form-element__help slds-has-error`,children:h})})]})},Nt=()=>{let e=S.length>1?E.multipleOptionsSelected||`${S.length} options selected`:S[0]?.label||``;return(0,u.jsxs)(`div`,{className:`slds-form-element__control`,children:[(0,u.jsx)(`div`,{className:`slds-combobox_container`,children:(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-combobox`,`slds-dropdown-trigger`,`slds-dropdown-trigger_click`,`ignore-react-onclickoutside`,{"slds-is-open":V(),"slds-has-error":h},p),role:`combobox`,"aria-expanded":V(),"aria-haspopup":`listbox`,children:[(0,u.jsx)(o.default,{defaultValue:m,"aria-autocomplete":`list`,"aria-controls":V()?`${A()}-listbox`:void 0,"aria-activedescendant":j?`${A()}-listbox-option-${j.id}`:void 0,"aria-describedby":H(),autoComplete:`off`,className:`slds-combobox__input`,containerProps:{className:`slds-combobox__form-element`,role:`none`},iconRight:(0,u.jsx)(s.default,{category:`utility`,name:`down`,variant:`combobox`}),id:A(),onFocus:Y,onBlur:q,onKeyDown:Z,inputRef:Q,onClick:()=>K(),onChange:e=>{S.length||J(e)},placeholder:E.placeholderReadOnly,readOnly:!0,required:x,role:`textbox`,value:e,...$}),Dt({menuRenderer:Ot()})]})}),(0,u.jsx)(se.default,{activeOption:F,activeOptionIndex:L,assistiveText:T,events:{onBlurPill:yt,onPillFocus:bt,onRequestFocus:St,onRequestFocusOnNextPill:X,onRequestFocusOnPreviousPill:X,onRequestRemove:xt},id:`${A()}-selected-listbox`,labels:E,selectedListboxRef:Ct,selection:S,listboxHasFocus:rt,variant:w,renderAtSelectionLength:2,multiselectable:_}),h&&(0,u.jsx)(`div`,{className:`slds-has-error`,children:(0,u.jsx)(`div`,{id:H(),className:`slds-form-element__help slds-has-error`,children:h})})]})},Pt=()=>{let e=j?.label,t=S[0]?.label,n=e||t||``;return S[0]?.value===``&&(n=``),(0,u.jsx)(`div`,{className:`slds-form-element__control`,children:(0,u.jsx)(`div`,{className:`slds-combobox_container`,children:(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-combobox`,`slds-dropdown-trigger`,`slds-dropdown-trigger_click`,`ignore-react-onclickoutside`,{"slds-is-open":V(),"slds-has-error":h},p),role:`combobox`,"aria-expanded":V(),"aria-haspopup":`listbox`,children:[(0,u.jsx)(o.default,{defaultValue:m,"aria-autocomplete":`list`,"aria-controls":V()?`${A()}-listbox`:void 0,"aria-activedescendant":j?`${A()}-listbox-option-${j.id}`:void 0,"aria-describedby":H(),autoComplete:`off`,className:`slds-combobox__input`,containerProps:{className:`slds-combobox__form-element`,role:`none`},disabled:Ke,iconRight:(0,u.jsx)(s.default,{category:`utility`,name:`down`,variant:`combobox`}),id:A(),onFocus:Y,onBlur:q,onKeyDown:Z,inputRef:Q,onClick:()=>K(),onChange:e=>{S.length||J(e)},placeholder:E.placeholderReadOnly,readOnly:!0,required:x,role:`textbox`,value:n,...$}),Dt({menuRenderer:Ot()}),h&&(0,u.jsx)(`div`,{id:H(),className:`slds-form-element__help`,children:h})]})})})},Ft=E.label||T?.label,It={base:{multiple:kt,single:kt},"inline-listbox":{multiple:At,single:jt},popover:{multiple:Mt,single:Mt},readonly:{multiple:Nt,single:Pt}},Lt=_?`multiple`:`single`,Rt=It[w]?.[Lt],zt=(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-form-element`,Ce),children:[De?null:(0,u.jsx)(ae.default,{assistiveText:T,htmlFor:A(),label:E.label,required:x}),ke&&Ft?(0,u.jsx)(ne.default,{fieldLevelHelpTooltip:ke}):null,Rt?Rt():It.base.multiple()]});return De?(0,u.jsxs)(`div`,{className:`slds-form-element`,children:[(0,u.jsx)(ae.default,{assistiveText:T,htmlFor:A(),label:E.label,required:x}),(0,u.jsx)(`div`,{className:`slds-form-element__control`,children:(0,u.jsxs)(`div`,{className:`slds-combobox-group`,children:[(0,u.jsx)(`div`,{className:`slds-combobox_object-switcher slds-combobox-addon_start`,children:De}),(0,u.jsx)(`div`,{className:`slds-combobox_container slds-combobox-addon_end`,children:zt})]})})]}):zt};xe.displayName=t.COMBOBOX,exports.default=xe;
|
|
1
|
+
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../icon-settings/index.cjs"),r=require("../../utilities/generate-id.cjs"),i=require("../../utilities/key-code.cjs"),a=require("../utilities/dialog/index.cjs"),ee=require("../button/index.cjs"),te=require("../../utilities/key-buffer.cjs"),o=require("../input/private/inner-input.cjs"),ne=require("../tooltip/private/field-level-help-tooltip.cjs"),s=require("../icon/input-icon/index.cjs"),re=require("../popover/index.cjs"),ie=require("./private/menu.cjs"),ae=require("../forms/private/label.cjs"),oe=require("../../utilities/key-callbacks.cjs"),se=require("../pill-container/private/selected-listbox.cjs"),ce=require("../../utilities/key-letter-menu-item-select.cjs"),le=require("../../utilities/menu-item-select-scroll.cjs"),ue=require("./check-props.cjs"),de=require("./component.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime"),fe=require("dequal"),pe=require("lodash.isfunction");pe=e.__toESM(pe,1);let d=require("lodash.assign");d=e.__toESM(d,1);let me=require("lodash.findindex");me=e.__toESM(me,1);let he=require("lodash.find");he=e.__toESM(he,1);let ge=require("lodash.reject");ge=e.__toESM(ge,1);var f,_e=typeof document<`u`,ve=Symbol(`actionItem`),ye=e=>ve in e,be=(e,t)=>({id:e.id||``,icon:e.icon,label:e.label,disabled:e.disabled,type:t,[ve]:e}),xe={label:``,loadingMenuItems:`Loading`,optionSelectedInMenu:`Current Selection:`,popoverLabel:``,removeSingleSelectedOption:`Remove selected option`,removePill:`, Press delete or backspace to remove`,selectedListboxLabel:`Selected Options:`},Se={deselectOption:`None`,label:``,cancelButton:`Cancel`,doneButton:`Done`,multipleOptionsSelected:``,noOptionsFound:`No matches found.`,placeholder:``,placeholderReadOnly:`Select an Option`,removePillTitle:`Remove`,optionDisabledTooltipLabel:`This option is disabled.`,inputIconTitle:``},Ce={},we=e=>{let{assistiveText:we={},"aria-describedby":Te,className:p,classNameContainer:Ee,classNameMenu:De,classNameMenuSubHeader:Oe,defaultValue:m,disabled:ke,entityCombobox:Ae,errorText:h,events:je={},fieldLevelHelpTooltip:Me,hasDeselect:Ne,hasInputSpinner:Pe,hasMenuSpinner:Fe,hasStaticAlignment:Ie,id:Le,inheritWidthOf:Re=`target`,input:ze,inputRef:Be,isOpen:g,labels:Ve={},menuItemVisibleLength:He,menuMaxWidth:Ue,menuPosition:We=`absolute`,multiple:_,onRenderMenuItem:Ge,options:v=[],optionsAddItem:Ke=[],optionsSearchEntity:qe=[],popover:y,predefinedOptionsOnly:b,required:x=!1,selection:S=[],selectedListboxRef:Je,singleInputDisabled:Ye=!1,tooltipMenuItemDisabled:Xe,value:C,variant:w=`base`,renderMenuItem:Ze,menuItem:Qe}=e,T=(0,d.default)({},xe,we),E=(0,d.default)({},Se,Ve),D=(0,d.default)({},Ce,je),$e=(0,c.useContext)(n.IconSettingsContext),O=(0,c.useRef)(null),k=(0,c.useRef)(null),et=(0,c.useRef)(null),tt=(0,c.useRef)(null),nt=(0,c.useRef)(null),rt=(0,c.useRef)(new te.default),it=(0,c.useRef)(r.default()),at=(0,c.useRef)(r.default()),A=(0,c.useCallback)(()=>Le||it.current,[Le]),ot=`${A()}-deselect`,[j,M]=(0,c.useState)(void 0),[N,P]=(0,c.useState)(-1),[F,I]=(0,c.useState)(S?.[0]),[L,R]=(0,c.useState)(0),[z,B]=(0,c.useState)(!1),[V,st]=(0,c.useState)(typeof g==`boolean`&&g),[ct,lt]=(0,c.useState)(!1);(0,c.useEffect)(()=>{ue.default(t.COMBOBOX,e,de.default)},[]);let H=(0,c.useCallback)(()=>!!(typeof g==`boolean`?g:V),[g,V]),ut=(0,c.useCallback)(()=>j&&N!==-1,[j,N]),U=(0,c.useCallback)(()=>Te||h&&at.current,[Te,h]),W=(0,c.useCallback)(()=>{let e={id:ot,label:E.deselectOption,value:``,type:`deselect`},t=qe.map(e=>be(e,`header`)),n=Ke.map(e=>be(e,`footer`));return[...t.length>0?t:[],...Ne?[e]:[],...v&&v.length>0?v:[],...n.length>0?n:[]]},[ot,E.deselectOption,qe,Ke,Ne,v]),dt=(0,c.useCallback)(({selection:e,option:t})=>!!(0,he.default)(e,t),[]),ft=(0,c.useCallback)(({activeOptionIndex:e,offset:t,options:n})=>{let r=e+t,i=n.length>r&&r>=0&&n[r].type===`separator`?r+t:r;return n.length>r&&r>=0?i:e},[]),G=(0,c.useCallback)((e,{trigger:t}={})=>{if(H()){if(f&&f.handleClose===G&&(f=void 0),M(void 0),P(-1),st(!1),w===`popover`&&t===`cancel`){let n=y?.props;n?.onClose&&n.onClose(e,{trigger:t})}D.onClose&&D.onClose(e,{})}},[H,w,y,D]),pt=(0,c.useCallback)((e,t)=>{if(!H())f&&(0,pe.default)(f.handleClose)&&f.handleClose();else if(f={handleClose:G},st(!0),D.onOpen&&D.onOpen(e,t||{}),w===`readonly`){let e=W(),t=(0,me.default)(e,e=>(0,fe.dequal)(e,S[0]));P(t),M(S[0]),k.current!==null&&le.default({container:k.current,focusedIndex:t})}},[H,G,D,w,W,S]),mt=(0,c.useCallback)((e,t)=>{D.onRequestClose&&D.onRequestClose(e,t),H()&&G(e,{trigger:`cancel`})},[D,H,G]),K=(0,c.useCallback)(()=>{D.onRequestOpen?D.onRequestOpen():st(!0)},[D]),ht=(0,c.useCallback)(()=>{(!_&&S.length===0&&w===`inline-listbox`||_||w===`readonly`)&&K()},[_,S.length,w,K]);(0,c.useCallback)(e=>{mt(e,{})},[mt]);let gt=(0,c.useCallback)((e,{selection:t,option:n})=>{if(ye(n)){let t=n[ve],r=e;t.onClick?.(r,{option:t}),D.onSelectActionItem?.(r,{option:t,value:O.current?.value??``}),G();return}let r,i=dt({selection:t,option:n}),a=!_&&!i,ee=_&&!i;r=n.id===ot?[]:a?[n]:ee?[...S,n]:(0,ge.default)(S,n),D.onSelect&&D.onSelect(e,{selection:r}),G()},[dt,_,ot,S,D,G]),q=(0,c.useCallback)(e=>{setTimeout(()=>{let t=_e?document.activeElement:null;t&&t.tagName===`DIV`&&t.id===`${A()}-listbox`?O.current&&O.current.focus():y||G(e)},200),D.onBlur&&D.onBlur(e)},[A,y,G,D]),J=(0,c.useCallback)(e=>{ht(),D.onChange&&D.onChange(e,{value:e.target.value})},[ht,D]),Y=(0,c.useCallback)(e=>{D.onFocus&&D.onFocus(e,{})},[D]),_t=(0,c.useCallback)(e=>{if(j===void 0&&N===-1&&(V?mt(e,{}):e.shiftKey||K()),!j?.disabled){if(j&&!ye(j)&&(j.type===`header`||j.type===`footer`)){j.onClick?.(e);return}ut()?gt(e,{option:j,selection:S}):!b&&e.target.value!==``&&D.onSubmit&&D.onSubmit(e,{value:e.target.value})}},[j,N,V,K,mt,ut,gt,S,b,D]),vt=(0,c.useCallback)((e,{direction:t})=>{let n={next:1,previous:-1},r=W(),i=ft({activeOptionIndex:N,offset:n[t],options:r});H()&&k.current&&le.default({container:k.current,focusedIndex:i}),M(r[i]),P(i)},[W,ft,N,H]),X=(0,c.useCallback)((e,{direction:t})=>{let n={next:1,previous:-1},r=L+1===S.length&&t===`next`,i=L===0&&t===`previous`;if(r)I(S[0]),R(0),B(!0);else if(i)I(S[S.length-1]),R(S.length-1),B(!0);else{let e=ft({activeOptionIndex:L,offset:n[t],options:S});I(S[e]),R(e),B(!0)}},[L,S,ft]),yt=(0,c.useCallback)(e=>{e.shiftKey||K(),w!==`popover`&&vt(e,{direction:`next`})},[K,w,vt]),bt=(0,c.useCallback)(e=>{!e.shiftKey&&H()&&vt(e,{direction:`previous`})},[H,vt]),xt=(0,c.useCallback)(()=>{et.current&&B(!0)},[]),St=(0,c.useCallback)(e=>{let t=W(),n=ce.default({key:e.key,keyBuffer:rt.current,keyCode:e.keyCode,options:t});n!==void 0&&(H()&&k.current&&le.default({container:k.current,focusedIndex:n}),M(t[n]),P(n))},[W,H]),Z=(0,c.useCallback)(e=>{let t={[i.default.DOWN]:{callback:yt},[i.default.ENTER]:{callback:_t},[i.default.ESCAPE]:{callback:G},[i.default.UP]:{callback:bt}};w===`readonly`&&(S.length>2?t[i.default.TAB]={callback:xt}:t[i.default.TAB]=void 0,t.other={callback:St,stopPropagation:!1});let n=H();oe.default(e,{callbacks:t,stopPropagation:n})},[yt,_t,G,bt,w,S.length,xt,St,H]),Ct=(0,c.useCallback)(()=>{B(!1)},[]),wt=(0,c.useCallback)((e,{option:t,index:n})=>{z||(I(t),R(n),B(!0))},[z]),Tt=(0,c.useCallback)((e,{option:t,index:n})=>{e.preventDefault();let r=S.length===1,i=S.length===2&&w===`readonly`&&_,a=n!==void 0&&n+1===S.length;(r||i)&&O.current?O.current.focus():a&&n!==void 0?(I(S[n-1]),R(n-1),B(!0)):n!==void 0&&(I(S[n+1]),R(n),B(!0)),D.onRequestRemoveSelectedOption&&D.onRequestRemoveSelectedOption(e,{selection:(0,ge.default)(S,t)})},[S,w,_,D]),Et=(0,c.useCallback)((e,{ref:t})=>{t&&(tt.current=t,tt.current.focus())},[]),Q=(0,c.useCallback)(e=>{O.current=e,ct||lt(!0),Be&&Be(e)},[ct,Be]),Dt=(0,c.useCallback)(e=>{et.current=e,Je&&Je(e)},[Je]),Ot=(0,c.useCallback)(e=>{k.current=e},[]),kt=(0,c.useCallback)(()=>O.current,[]);(0,c.useEffect)(()=>{typeof g==`boolean`&&(st(g),g||(M(void 0),P(-1)))},[g]),(0,c.useEffect)(()=>{let e=W();if(j){let t=(0,me.default)(e,e=>(0,fe.dequal)(e,j));t===-1?(M(void 0),P(-1)):P(t)}},[v,W,j]),(0,c.useEffect)(()=>{if(S.length===0){F!==void 0&&(I(void 0),R(0));return}if(!F||!S[L]){let e=L>=S.length?S.length-1:L;I(S[e]),R(e)}},[S,F,L]),(0,c.useEffect)(()=>()=>{f&&f.handleClose===G&&(f=void 0)},[G]);let At=(0,c.useCallback)(e=>{let t=(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`div`,{className:`slds-assistive-text`,id:`${A()}-label`,children:T.popoverLabel}),e]}),n=(0,u.jsxs)(`div`,{children:[(0,u.jsx)(ee.default,{label:E.cancelButton,onClick:e=>{G(e,{trigger:`cancel`})}}),(0,u.jsx)(ee.default,{label:E.doneButton,variant:`brand`,onClick:G})]}),r={ariaLabelledby:`${A()}-label`,align:`bottom`,body:t,className:`slds-popover_full-width`,footer:n,footerClassName:`slds-popover__footer_form`,hasNoNubbin:!0,id:A(),isOpen:V,hasNoTriggerStyles:!0,onOpen:pt,onClose:G,onRequestClose:G},i=y?.props,a=(0,d.default)(r,i||{});return a.body=t,delete a.children,a},[A,T.popoverLabel,E.cancelButton,E.doneButton,G,V,pt,y]),jt=(0,c.useCallback)(({menuRenderer:e})=>{let t=We;if(!ke&&H()){let n={align:`bottom left`,context:$e,hasStaticAlignment:Ie,inheritWidthOf:Re,onClose:G,onMouseDown:e=>{e.preventDefault()},onOpen:pt,onRequestTargetElement:kt,position:t,containerProps:{id:`${A()}-listbox`,role:`listbox`}};return(0,u.jsx)(a.default,{...n,children:e})}return null},[We,ke,H,$e,Ie,Re,G,pt,kt,A]),Mt=Ge||Qe,Nt;Ze?Nt=e=>Ze({...e,assistiveText:T}):Mt&&(Nt=({isSelected:e,option:t})=>(0,u.jsx)(Mt,{assistiveText:T,selected:e,option:t}));let $=(0,c.useCallback)(()=>{let e={base:`icon-title-subtitle`,"inline-listbox":`icon-title-subtitle`,readonly:`checkbox`},t=w===`readonly`?5:null;return(0,u.jsx)(ie.default,{assistiveText:T,activeOption:j,activeOptionIndex:N,classNameMenu:De,classNameMenuSubHeader:Oe,inheritWidthOf:Re,inputId:A(),inputValue:C,isSelected:dt,itemVisibleLength:He||t,labels:{noOptionsFound:E.noOptionsFound||``},hasMenuSpinner:Fe,menuPosition:We,menuRef:Ot,maxWidth:Ue,options:W(),onSelect:gt,renderMenuItem:Nt,selection:S,tooltipMenuItemDisabled:Xe,variant:e[w]})},[w,T,j,N,De,Oe,Re,A,C,dt,He,E.noOptionsFound,Fe,We,Ot,Ue,W,gt,Nt,S,Xe]),Pt=ze?.props||{},Ft=()=>(0,u.jsxs)(`div`,{className:`slds-form-element__control`,children:[(0,u.jsx)(`div`,{className:`slds-combobox_container`,children:(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-combobox`,`slds-dropdown-trigger`,`slds-dropdown-trigger_click`,`ignore-react-onclickoutside`,{"slds-is-open":H(),"slds-has-error":h},p),role:`combobox`,"aria-expanded":H(),"aria-haspopup":`listbox`,"aria-owns":H()?`${A()}-listbox`:void 0,children:[(0,u.jsx)(o.default,{"aria-autocomplete":`list`,"aria-controls":H()?`${A()}-listbox`:void 0,"aria-activedescendant":j?`${A()}-listbox-option-${j.id}`:void 0,"aria-describedby":U(),autoComplete:`off`,className:`slds-combobox__input`,containerProps:{className:`slds-combobox__form-element`,role:`none`},hasSpinner:Pe,iconRight:(0,u.jsx)(s.default,{category:`utility`,name:`search`,title:E.inputIconTitle}),id:A(),onFocus:Y,onBlur:q,onKeyDown:Z,inputRef:Q,onClick:()=>K(),onChange:J,placeholder:E.placeholder,defaultValue:m,readOnly:!!(b&&j),required:x,role:`textbox`,value:b&&j?.label||C,...Pt}),jt({menuRenderer:$()})]})}),(0,u.jsx)(se.default,{activeOption:F,activeOptionIndex:L,assistiveText:T,events:{onBlurPill:Ct,onPillFocus:wt,onRequestFocus:Et,onRequestFocusOnNextPill:X,onRequestFocusOnPreviousPill:X,onRequestRemove:Tt},id:`${A()}-selected-listbox`,labels:E,selectedListboxRef:Dt,selection:S,listboxHasFocus:z,multiselectable:_}),h&&(0,u.jsx)(`div`,{className:`slds-has-error`,children:(0,u.jsx)(`div`,{id:U(),className:`slds-form-element__help slds-has-error`,children:h})})]}),It=()=>(0,u.jsx)(`div`,{className:`slds-form-element__control`,children:(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-combobox_container`,{"slds-has-inline-listbox":S.length}),children:[S.length?(0,u.jsx)(se.default,{activeOption:F,activeOptionIndex:L,assistiveText:T,containerRole:`listbox`,containerAriaOrientation:`horizontal`,listboxRole:`group`,listboxAriaOrientation:null,events:{onBlurPill:Ct,onPillFocus:wt,onRequestFocus:Et,onRequestFocusOnNextPill:X,onRequestFocusOnPreviousPill:X,onRequestRemove:Tt},id:`${A()}-selected-listbox`,labels:E,selectedListboxRef:Dt,selection:S,listboxHasFocus:z,multiselectable:_}):null,(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-combobox`,`slds-dropdown-trigger`,`slds-dropdown-trigger_click`,`ignore-react-onclickoutside`,{"slds-is-open":H(),"slds-has-error":h},p),role:`combobox`,"aria-expanded":H(),"aria-haspopup":`listbox`,children:[(0,u.jsx)(o.default,{"aria-autocomplete":`list`,"aria-controls":H()?`${A()}-listbox`:void 0,"aria-activedescendant":j?`${A()}-listbox-option-${j.id}`:void 0,"aria-describedby":U(),defaultValue:m,autoComplete:`off`,className:`slds-combobox__input`,containerProps:{className:`slds-combobox__form-element`,role:`none`},hasSpinner:Pe,iconRight:(0,u.jsx)(s.default,{category:`utility`,name:`search`,title:E.inputIconTitle}),id:A(),onFocus:Y,onBlur:q,onKeyDown:Z,inputRef:Q,onClick:()=>K(),onChange:J,placeholder:E.placeholder,readOnly:!!(b&&j),required:x,role:`textbox`,value:b&&j?.label||C,...Pt}),jt({menuRenderer:$()}),h&&(0,u.jsx)(`div`,{id:U(),className:`slds-form-element__help`,children:h})]})]})}),Lt=()=>{let e=S[0]?.icon,t=e&&c.default.isValidElement(e)?c.default.cloneElement(e,{containerClassName:`slds-combobox__input-entity-icon`}):null,n=S[0]?.label?S[0].label:C;return(0,u.jsxs)(`div`,{className:`slds-form-element__control`,children:[(0,u.jsx)(`div`,{className:(0,l.default)(`slds-combobox_container`,{"slds-has-inline-listbox":S.length}),children:(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-combobox`,`slds-dropdown-trigger`,`slds-dropdown-trigger_click`,`ignore-react-onclickoutside`,{"slds-is-open":H(),"slds-has-error":h},p),role:`combobox`,"aria-expanded":H(),"aria-haspopup":`listbox`,children:[(0,u.jsx)(o.default,{defaultValue:m,"aria-autocomplete":`list`,"aria-controls":H()?`${A()}-listbox`:void 0,"aria-activedescendant":j?`${A()}-listbox-option-${j.id}`:void 0,"aria-describedby":U(),autoComplete:`off`,className:`slds-combobox__input`,containerProps:{className:`slds-combobox__form-element`,role:`none`},disabled:Ye,hasSpinner:Pe,iconRight:S.length?(0,u.jsx)(s.default,{assistiveText:{icon:T.removeSingleSelectedOption},buttonRef:e=>{nt.current=e},category:`utility`,iconPosition:`right`,name:`close`,onClick:e=>{Tt(e,{option:S[0]})}}):(0,u.jsx)(s.default,{category:`utility`,name:`search`}),iconLeft:t,id:A(),onFocus:Y,onBlur:q,onKeyDown:Z,inputRef:Q,onClick:()=>ht(),onChange:e=>{S.length||J(e)},placeholder:E.placeholder,readOnly:!!(b&&j)||!!S.length,required:x,role:`textbox`,value:b?j?.label||C:n,...Pt}),jt({menuRenderer:$()})]})}),h&&(0,u.jsx)(`div`,{className:`slds-has-error`,children:(0,u.jsx)(`div`,{id:U(),className:`slds-form-element__help`,children:h})})]})},Rt=()=>{let e=y?.props,t=At(e?.body);return(0,u.jsxs)(`div`,{className:`slds-form-element__control`,children:[(0,u.jsx)(`div`,{className:`slds-combobox_container`,children:(0,u.jsx)(`div`,{className:(0,l.default)(`slds-combobox`,`slds-dropdown-trigger`,`slds-dropdown-trigger_click`,`ignore-react-onclickoutside`,{"slds-is-open":H(),"slds-has-error":h},p),role:`combobox`,"aria-expanded":H(),"aria-haspopup":`dialog`,children:(0,u.jsx)(re.default,{...t,children:(0,u.jsx)(o.default,{"aria-autocomplete":`none`,"aria-controls":H()?`${A()}-popover`:void 0,"aria-describedby":U(),autoComplete:`off`,className:`slds-combobox__input`,containerProps:{className:`slds-combobox__form-element`,role:`none`},iconRight:(0,u.jsx)(s.default,{category:`utility`,name:`down`,variant:`combobox`}),id:A(),onFocus:Y,onBlur:q,onKeyDown:Z,inputRef:Q,onClick:()=>K(),onChange:J,placeholder:E.placeholder,readOnly:!0,required:x,role:`textbox`,value:C})})})}),h&&(0,u.jsx)(`div`,{className:`slds-has-error`,children:(0,u.jsx)(`div`,{id:U(),className:`slds-form-element__help slds-has-error`,children:h})})]})},zt=()=>{let e=S.length>1?E.multipleOptionsSelected||`${S.length} options selected`:S[0]?.label||``;return(0,u.jsxs)(`div`,{className:`slds-form-element__control`,children:[(0,u.jsx)(`div`,{className:`slds-combobox_container`,children:(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-combobox`,`slds-dropdown-trigger`,`slds-dropdown-trigger_click`,`ignore-react-onclickoutside`,{"slds-is-open":H(),"slds-has-error":h},p),role:`combobox`,"aria-expanded":H(),"aria-haspopup":`listbox`,children:[(0,u.jsx)(o.default,{defaultValue:m,"aria-autocomplete":`list`,"aria-controls":H()?`${A()}-listbox`:void 0,"aria-activedescendant":j?`${A()}-listbox-option-${j.id}`:void 0,"aria-describedby":U(),autoComplete:`off`,className:`slds-combobox__input`,containerProps:{className:`slds-combobox__form-element`,role:`none`},iconRight:(0,u.jsx)(s.default,{category:`utility`,name:`down`,variant:`combobox`}),id:A(),onFocus:Y,onBlur:q,onKeyDown:Z,inputRef:Q,onClick:()=>ht(),onChange:e=>{S.length||J(e)},placeholder:E.placeholderReadOnly,readOnly:!0,required:x,role:`textbox`,value:e,...Pt}),jt({menuRenderer:$()})]})}),(0,u.jsx)(se.default,{activeOption:F,activeOptionIndex:L,assistiveText:T,events:{onBlurPill:Ct,onPillFocus:wt,onRequestFocus:Et,onRequestFocusOnNextPill:X,onRequestFocusOnPreviousPill:X,onRequestRemove:Tt},id:`${A()}-selected-listbox`,labels:E,selectedListboxRef:Dt,selection:S,listboxHasFocus:z,variant:w,renderAtSelectionLength:2,multiselectable:_}),h&&(0,u.jsx)(`div`,{className:`slds-has-error`,children:(0,u.jsx)(`div`,{id:U(),className:`slds-form-element__help slds-has-error`,children:h})})]})},Bt=()=>{let e=j?.label,t=S[0]?.label,n=e||t||``;return S[0]?.value===``&&(n=``),(0,u.jsx)(`div`,{className:`slds-form-element__control`,children:(0,u.jsx)(`div`,{className:`slds-combobox_container`,children:(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-combobox`,`slds-dropdown-trigger`,`slds-dropdown-trigger_click`,`ignore-react-onclickoutside`,{"slds-is-open":H(),"slds-has-error":h},p),role:`combobox`,"aria-expanded":H(),"aria-haspopup":`listbox`,children:[(0,u.jsx)(o.default,{defaultValue:m,"aria-autocomplete":`list`,"aria-controls":H()?`${A()}-listbox`:void 0,"aria-activedescendant":j?`${A()}-listbox-option-${j.id}`:void 0,"aria-describedby":U(),autoComplete:`off`,className:`slds-combobox__input`,containerProps:{className:`slds-combobox__form-element`,role:`none`},disabled:Ye,iconRight:(0,u.jsx)(s.default,{category:`utility`,name:`down`,variant:`combobox`}),id:A(),onFocus:Y,onBlur:q,onKeyDown:Z,inputRef:Q,onClick:()=>ht(),onChange:e=>{S.length||J(e)},placeholder:E.placeholderReadOnly,readOnly:!0,required:x,role:`textbox`,value:n,...Pt}),jt({menuRenderer:$()}),h&&(0,u.jsx)(`div`,{id:U(),className:`slds-form-element__help`,children:h})]})})})},Vt=E.label||T?.label,Ht={base:{multiple:Ft,single:Ft},"inline-listbox":{multiple:It,single:Lt},popover:{multiple:Rt,single:Rt},readonly:{multiple:zt,single:Bt}},Ut=_?`multiple`:`single`,Wt=Ht[w]?.[Ut],Gt=(0,u.jsxs)(`div`,{className:(0,l.default)(`slds-form-element`,Ee),children:[Ae?null:(0,u.jsx)(ae.default,{assistiveText:T,htmlFor:A(),label:E.label,required:x}),Me&&Vt?(0,u.jsx)(ne.default,{fieldLevelHelpTooltip:Me}):null,Wt?Wt():Ht.base.multiple()]});return Ae?(0,u.jsxs)(`div`,{className:`slds-form-element`,children:[(0,u.jsx)(ae.default,{assistiveText:T,htmlFor:A(),label:E.label,required:x}),(0,u.jsx)(`div`,{className:`slds-form-element__control`,children:(0,u.jsxs)(`div`,{className:`slds-combobox-group`,children:[(0,u.jsx)(`div`,{className:`slds-combobox_object-switcher slds-combobox-addon_start`,children:Ae}),(0,u.jsx)(`div`,{className:`slds-combobox_container slds-combobox-addon_end`,children:Gt})]})})]}):Gt};we.displayName=t.COMBOBOX,exports.default=we;
|
|
2
2
|
//# sourceMappingURL=combobox.cjs.map
|