@salesforce/design-system-react 11.0.0-alpha.5 → 11.0.0-alpha.6
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/avatar/index.cjs +1 -1
- package/dist/cjs/components/avatar/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/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/index.cjs +1 -1
- package/dist/cjs/components/carousel/index.cjs.map +1 -1
- package/dist/cjs/components/carousel/private/carousel-item.cjs.map +1 -1
- package/dist/cjs/components/checkbox/index.cjs +1 -1
- package/dist/cjs/components/checkbox/index.cjs.map +1 -1
- package/dist/cjs/components/color-picker/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/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/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/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/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/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/row-actions.cjs +1 -1
- package/dist/cjs/components/simple-data-table/row-actions.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.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/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/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/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/vertical-navigation/index.cjs.map +1 -1
- package/dist/cjs/components/vertical-navigation/private/item.cjs.map +1 -1
- package/dist/cjs/components/welcome-mat/index.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/avatar/index.js +1 -1
- package/dist/es/components/avatar/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/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/index.js +8 -12
- package/dist/es/components/carousel/index.js.map +1 -1
- package/dist/es/components/carousel/private/carousel-item.js.map +1 -1
- package/dist/es/components/checkbox/index.js +17 -17
- 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 +193 -186
- 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 +2 -0
- 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/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/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/index.js.map +1 -1
- package/dist/es/components/menu-dropdown/menu-dropdown.js +247 -250
- 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/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 +63 -62
- package/dist/es/components/popover/popover.js.map +1 -1
- package/dist/es/components/setup-assistant/index.js.map +1 -1
- package/dist/es/components/setup-assistant/step.js +1 -1
- 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/row-actions.js +2 -2
- package/dist/es/components/simple-data-table/row-actions.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 +40 -34
- package/dist/es/components/split-view/index.js.map +1 -1
- package/dist/es/components/split-view/listbox.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/textarea/check-props.js +17 -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 +50 -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 +6 -6
- package/dist/es/components/tree/check-props.js.map +1 -1
- 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 +60 -35
- package/dist/es/components/tree/tree.js.map +1 -1
- package/dist/es/components/utilities/menu-list/index.js.map +1 -1
- package/dist/es/components/utilities/menu-list/item.js +1 -1
- package/dist/es/components/utilities/menu-list/item.js.map +1 -1
- package/dist/es/components/vertical-navigation/index.js.map +1 -1
- package/dist/es/components/vertical-navigation/private/item.js.map +1 -1
- package/dist/es/components/welcome-mat/index.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/avatar/index.d.ts +1 -1
- package/dist/types/components/avatar/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/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/index.d.ts +34 -7
- package/dist/types/components/carousel/index.d.ts.map +1 -1
- package/dist/types/components/carousel/private/carousel-item.d.ts +3 -3
- package/dist/types/components/carousel/private/carousel-item.d.ts.map +1 -1
- package/dist/types/components/checkbox/check-props.d.ts.map +1 -1
- package/dist/types/components/checkbox/index.d.ts +1 -6
- 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 +57 -24
- 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 +65 -4
- 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/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/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/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 +95 -24
- 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/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/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 +7 -1
- package/dist/types/components/setup-assistant/step.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/row-actions.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 +25 -3
- package/dist/types/components/split-view/index.d.ts.map +1 -1
- package/dist/types/components/split-view/listbox.d.ts +27 -24
- package/dist/types/components/split-view/listbox.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/textarea/index.d.ts +2 -2
- 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 +27 -6
- package/dist/types/components/tree/tree.d.ts.map +1 -1
- package/dist/types/components/tree/types.d.ts +55 -8
- package/dist/types/components/tree/types.d.ts.map +1 -1
- package/dist/types/components/utilities/menu-list/index.d.ts +1 -1
- package/dist/types/components/utilities/menu-list/index.d.ts.map +1 -1
- package/dist/types/components/utilities/menu-list/item.d.ts +1 -1
- package/dist/types/components/utilities/menu-list/item.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/index.d.ts +62 -13
- package/dist/types/components/welcome-mat/index.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 +2 -2
- 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/cjs/utilities/warning/deprecated-property-value.cjs +0 -2
- package/dist/cjs/utilities/warning/deprecated-property-value.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/es/utilities/warning/deprecated-property-value.js +0 -18
- package/dist/es/utilities/warning/deprecated-property-value.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 +0 -3
- 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 +0 -3
- 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 +0 -3
- 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 +0 -3
- 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 → pill-container}/check-props.d.ts +0 -0
- /package/dist/types/components/{breadcrumb → split-view}/check-props.d.ts +0 -0
|
@@ -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/class-names.cjs"),r=require("../icon/index.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime");var o={icon:`User or Account Icon`},s=e=>{let t=e.trim(),n=t.split(` `);return n.length>1?n[0].charAt(0).toUpperCase()+n[n.length-1].charAt(0).toUpperCase():(t[0]||``).toUpperCase()+(t[1]||``).toLowerCase()},c=({assistiveText:e,imgAlt:t=``,imgSrc:c,initials:l,inverse:u,label:d,size:f=`medium`,title:p=`user avatar`,variant:m=`user`})=>{let[h,g]=(0,i.useState)(!1),_=(0,i.useCallback)(()=>{g(!0)},[]),v=
|
|
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/class-names.cjs"),r=require("../icon/index.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime");var o={icon:`User or Account Icon`},s=e=>{let t=e.trim(),n=t.split(` `);return n.length>1?n[0].charAt(0).toUpperCase()+n[n.length-1].charAt(0).toUpperCase():(t[0]||``).toUpperCase()+(t[1]||``).toLowerCase()},c=({assistiveText:e,imgAlt:t=``,imgSrc:c,initials:l,inverse:u,label:d,size:f=`medium`,title:p=`user avatar`,variant:m=`user`})=>{let[h,g]=(0,i.useState)(!1),_=(0,i.useCallback)(()=>{g(!0)},[]),v={...o,...e}.icon;return(0,a.jsx)(`div`,{children:(0,a.jsx)(`span`,{className:n.default(`slds-avatar`,{"slds-avatar_circle":m===`user`,"slds-avatar_x-small":f===`x-small`,"slds-avatar_small":f===`small`,"slds-avatar_medium":f===`medium`,"slds-avatar_large":f===`large`}),children:!h&&c?(0,a.jsx)(`img`,{alt:t,src:c,onError:_,title:p}):l||d&&d.trim()?(0,a.jsx)(`abbr`,{className:n.default(`slds-avatar__initials`,{"slds-avatar__initials_inverse":u,"slds-icon-standard-account":m===`entity`,"slds-icon-standard-user":m===`user`}),title:d,children:l||(d?s(d):``)}):(0,a.jsx)(r.default,{assistiveText:{label:v},category:`standard`,name:m===`entity`?`account`:`user`})})})};c.displayName=t.AVATAR,exports.default=c;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/avatar/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 React, { useState, useCallback } from 'react';\nimport classNames from '../../utilities/class-names';\nimport { AVATAR } from '../../utilities/constants';\nimport Icon from '../icon';\n\n/**\n * Avatar size options\n */\nexport type AvatarSize = 'x-small' | 'small' | 'medium' | 'large';\n\n/**\n * Avatar variant - determines shape and default icon\n */\nexport type AvatarVariant = 'entity' | 'user';\n\n/**\n * Assistive text for Avatar\n */\nexport interface AvatarAssistiveText {\n\t/** Assistive text for the fallback icon */\n\ticon?: string;\n}\n\n/**\n * Props for the Avatar component\n */\nexport interface AvatarProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: AvatarAssistiveText
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/avatar/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 React, { useState, useCallback } from 'react';\nimport classNames from '../../utilities/class-names';\nimport { AVATAR } from '../../utilities/constants';\nimport Icon from '../icon';\n\n/**\n * Avatar size options\n */\nexport type AvatarSize = 'x-small' | 'small' | 'medium' | 'large';\n\n/**\n * Avatar variant - determines shape and default icon\n */\nexport type AvatarVariant = 'entity' | 'user';\n\n/**\n * Assistive text for Avatar\n */\nexport interface AvatarAssistiveText {\n\t/** Assistive text for the fallback icon */\n\ticon?: string;\n}\n\n/**\n * Props for the Avatar component\n */\nexport interface AvatarProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: AvatarAssistiveText;\n\t/** Alt text for the image */\n\timgAlt?: string;\n\t/** Source URL for the image */\n\timgSrc?: string;\n\t/** Initials to display (overrides built initials from label) */\n\tinitials?: string;\n\t/** Use dark text on light background for initials */\n\tinverse?: boolean;\n\t/** Label used to build initials and as title for abbr element */\n\tlabel?: string;\n\t/** Size of the avatar */\n\tsize?: AvatarSize;\n\t/** Title attribute for the avatar container */\n\ttitle?: string;\n\t/** Variant determines shape (circle for user, square for entity) */\n\tvariant?: AvatarVariant;\n}\n\nconst defaultAssistiveText: AvatarAssistiveText = {\n\ticon: 'User or Account Icon',\n};\n\n/**\n * Build initials from a label/name string.\n * - Two words: first letter of each, capitalized\n * - One word: first two letters (first capitalized, second lowercase)\n * - Three+ words: first letter of first and last words, capitalized\n */\nconst buildInitials = (label: string): string => {\n\tconst name = label.trim();\n\tconst nameParts = name.split(' ');\n\tif (nameParts.length > 1) {\n\t\treturn (\n\t\t\tnameParts[0].charAt(0).toUpperCase() +\n\t\t\tnameParts[nameParts.length - 1].charAt(0).toUpperCase()\n\t\t);\n\t}\n\treturn (name[0] || '').toUpperCase() + (name[1] || '').toLowerCase();\n};\n\n/**\n * The Avatar component represents an object or entity.\n *\n * An image is the preferred format. If `imgSrc` is undefined and `label` or `initials`\n * is available, initials will be shown. Otherwise, a default icon is displayed.\n */\nconst Avatar = ({\n\tassistiveText: propAssistiveText,\n\timgAlt = '',\n\timgSrc,\n\tinitials,\n\tinverse,\n\tlabel,\n\tsize = 'medium',\n\ttitle = 'user avatar',\n\tvariant = 'user',\n}: AvatarProps): React.ReactElement => {\n\tconst [imgLoadError, setImgLoadError] = useState(false);\n\n\tconst handleImageError = useCallback(() => {\n\t\tsetImgLoadError(true);\n\t}, []);\n\n\t// Merge assistive text\n\tconst iconAssistiveText = {\n\t\t...defaultAssistiveText,\n\t\t...propAssistiveText,\n\t}.icon;\n\n\t// Render functions for different avatar states\n\tconst renderBaseAvatar = () => (\n\t\t<img alt={imgAlt} src={imgSrc} onError={handleImageError} title={title} />\n\t);\n\n\tconst renderIconAvatar = () => (\n\t\t<Icon\n\t\t\tassistiveText={{ label: iconAssistiveText }}\n\t\t\tcategory=\"standard\"\n\t\t\tname={variant === 'entity' ? 'account' : 'user'}\n\t\t/>\n\t);\n\n\tconst renderInitialsAvatar = () => (\n\t\t<abbr\n\t\t\tclassName={classNames('slds-avatar__initials', {\n\t\t\t\t'slds-avatar__initials_inverse': inverse,\n\t\t\t\t'slds-icon-standard-account': variant === 'entity',\n\t\t\t\t'slds-icon-standard-user': variant === 'user',\n\t\t\t})}\n\t\t\ttitle={label}\n\t\t>\n\t\t\t{initials || (label ? buildInitials(label) : '')}\n\t\t</abbr>\n\t);\n\n\t// Determine which avatar to render\n\tconst renderAvatar = () => {\n\t\tif (!imgLoadError && imgSrc) {\n\t\t\treturn renderBaseAvatar();\n\t\t}\n\t\tif (initials || (label && label.trim())) {\n\t\t\treturn renderInitialsAvatar();\n\t\t}\n\t\treturn renderIconAvatar();\n\t};\n\n\treturn (\n\t\t<div>\n\t\t\t<span\n\t\t\t\tclassName={classNames('slds-avatar', {\n\t\t\t\t\t'slds-avatar_circle': variant === 'user',\n\t\t\t\t\t'slds-avatar_x-small': size === 'x-small',\n\t\t\t\t\t'slds-avatar_small': size === 'small',\n\t\t\t\t\t'slds-avatar_medium': size === 'medium',\n\t\t\t\t\t'slds-avatar_large': size === 'large',\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t{renderAvatar()}\n\t\t\t</span>\n\t\t</div>\n\t);\n};\n\nAvatar.displayName = AVATAR;\n\nexport default Avatar;\n"],"mappings":"yVAkDA,IAAM,EAA4C,CACjD,KAAM,sBACP,EAQM,EAAiB,GAA0B,CAChD,IAAM,EAAO,EAAM,KAAK,EAClB,EAAY,EAAK,MAAM,GAAG,EAOhC,OANI,EAAU,OAAS,EAErB,EAAU,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,EACnC,EAAU,EAAU,OAAS,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,GAGhD,EAAK,IAAM,GAAA,CAAI,YAAY,GAAK,EAAK,IAAM,GAAA,CAAI,YAAY,CACpE,EAQM,GAAU,CACf,cAAe,EACf,SAAS,GACT,SACA,WACA,UACA,QACA,OAAO,SACP,QAAQ,cACR,UAAU,UAC4B,CACtC,GAAM,CAAC,EAAc,IAAA,EAAmB,EAAA,SAAA,CAAS,EAAK,EAEhD,GAAA,EAAmB,EAAA,YAAA,KAAkB,CAC1C,EAAgB,EAAI,CACrB,EAAG,CAAC,CAAC,EAGC,EAAoB,CACzB,GAAG,EACH,GAAG,CACJ,EAAE,KAuCF,OACC,EAAA,EAAA,IAAA,CAAC,MAAD,CAAA,UACC,EAAA,EAAA,IAAA,CAAC,OAAD,CACC,UAAW,EAAA,QAAW,cAAe,CACpC,qBAAsB,IAAY,OAClC,sBAAuB,IAAS,UAChC,oBAAqB,IAAS,QAC9B,qBAAsB,IAAS,SAC/B,oBAAqB,IAAS,OAC/B,CAAC,EAEA,SApBC,CAAC,GAAgB,GA1BrB,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,IAAK,EAAQ,IAAK,EAAQ,QAAS,EAAyB,OAAQ,CAAA,EA6BrE,GAAa,GAAS,EAAM,KAAK,GAjBrC,EAAA,EAAA,IAAA,CAAC,OAAD,CACC,UAAW,EAAA,QAAW,wBAAyB,CAC9C,gCAAiC,EACjC,6BAA8B,IAAY,SAC1C,0BAA2B,IAAY,MACxC,CAAC,EACD,MAAO,EAEN,SAAA,IAAa,EAAQ,EAAc,CAAK,EAAI,GACxC,CAAA,GAjBN,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACC,cAAe,CAAE,MAAO,CAAkB,EAC1C,SAAS,WACT,KAAM,IAAY,SAAW,UAAY,MACzC,CAAA,CAuCM,CAAA,CACF,CAAA,CAEP,EAEA,EAAO,YAAc,EAAA"}
|
|
@@ -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("../menu-dropdown/index.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("react/jsx-runtime");var a={label:`Breadcrumbs`},o=(e,t)=>{let r={...e.props,id:`${t.id}-dropdown`,iconCategory:`utility`,iconName:`threedots`,iconVariant:`bare`,threedots:!0};return(0,i.jsx)(`li`,{className:`slds-breadcrumb__item`,children:(0,i.jsx)(n.default,{...r})})},s=({assistiveText:e,id:t,overflowDropdownMenu:n,styleContainer:r,trail:s})=>{let c=
|
|
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("../menu-dropdown/index.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("react/jsx-runtime");var a={label:`Breadcrumbs`},o=(e,t)=>{let r={...e.props,id:`${t.id}-dropdown`,iconCategory:`utility`,iconName:`threedots`,iconVariant:`bare`,threedots:!0};return(0,i.jsx)(`li`,{className:`slds-breadcrumb__item`,children:(0,i.jsx)(n.default,{...r})})},s=({assistiveText:e,id:t,overflowDropdownMenu:n,styleContainer:r,trail:s})=>{let c={...a,...e}.label;return(0,i.jsx)(`nav`,{role:`navigation`,"aria-label":c,style:r,children:(0,i.jsxs)(`ol`,{className:`slds-breadcrumb slds-list_horizontal`,children:[n&&o(n,{id:t}),s.map((e,t)=>(0,i.jsx)(`li`,{className:`slds-breadcrumb__item`,children:e},t))]})})};s.displayName=t.BREADCRUMB,exports.default=s;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/breadcrumb/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 React, {
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/breadcrumb/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 React, {\n\ttype ReactNode,\n\ttype ReactElement,\n\ttype CSSProperties,\n} from 'react';\nimport { BREADCRUMB } from '../../utilities/constants';\nimport Dropdown from '../menu-dropdown';\n\n/**\n * Assistive text for Breadcrumb\n */\nexport interface BreadcrumbAssistiveText {\n\t/** Label for the breadcrumb navigation */\n\tlabel?: string;\n}\n\n/**\n * Props for the Breadcrumb component\n */\nexport interface BreadcrumbProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: BreadcrumbAssistiveText;\n\t/** Unique identifier for the breadcrumb */\n\tid?: string;\n\t/** Overflow dropdown menu for condensed breadcrumbs */\n\toverflowDropdownMenu?: ReactElement;\n\t/** Custom styles for the nav container */\n\tstyleContainer?: CSSProperties;\n\t/** Array of anchor elements defining the breadcrumb path */\n\ttrail: ReactNode[];\n}\n\nconst defaultAssistiveText: BreadcrumbAssistiveText = {\n\tlabel: 'Breadcrumbs',\n};\n\n/**\n * Renders the overflow dropdown menu\n */\nconst getBreadcrumbDropdown = (\n\toverflowDropdownMenu: ReactElement,\n\tprops: { id?: string }\n) => {\n\tconst baseProps = overflowDropdownMenu.props as Record<string, unknown>;\n\tconst overflowDropdownMenuProps = {\n\t\t...baseProps,\n\t\tid: `${props.id}-dropdown`,\n\t\ticonCategory: 'utility' as const,\n\t\ticonName: 'threedots',\n\t\ticonVariant: 'bare' as const,\n\t\tthreedots: true,\n\t};\n\treturn (\n\t\t<li className=\"slds-breadcrumb__item\">\n\t\t\t<Dropdown {...overflowDropdownMenuProps} />\n\t\t</li>\n\t);\n};\n\n/**\n * Use breadcrumbs to note the path of a record and help the user navigate back to the parent.\n */\nconst Breadcrumb = ({\n\tassistiveText: propAssistiveText,\n\tid,\n\toverflowDropdownMenu,\n\tstyleContainer,\n\ttrail,\n}: BreadcrumbProps): React.ReactElement => {\n\tconst assistiveTextLabel = {\n\t\t...defaultAssistiveText,\n\t\t...propAssistiveText,\n\t}.label;\n\n\treturn (\n\t\t<nav\n\t\t\trole=\"navigation\"\n\t\t\taria-label={assistiveTextLabel}\n\t\t\tstyle={styleContainer}\n\t\t>\n\t\t\t<ol className=\"slds-breadcrumb slds-list_horizontal\">\n\t\t\t\t{overflowDropdownMenu &&\n\t\t\t\t\tgetBreadcrumbDropdown(overflowDropdownMenu, { id })}\n\t\t\t\t{trail.map((crumb, index) => (\n\t\t\t\t\t<li key={index} className=\"slds-breadcrumb__item\">\n\t\t\t\t\t\t{crumb}\n\t\t\t\t\t</li>\n\t\t\t\t))}\n\t\t\t</ol>\n\t\t</nav>\n\t);\n};\n\nBreadcrumb.displayName = BREADCRUMB;\n\nexport default Breadcrumb;\n"],"mappings":"qTAmCA,IAAM,EAAgD,CACrD,MAAO,aACR,EAKM,GACL,EACA,IACI,CAEJ,IAAM,EAA4B,CACjC,GAFiB,EAAqB,MAGtC,GAAI,GAAG,EAAM,GAAG,WAChB,aAAc,UACd,SAAU,YACV,YAAa,OACb,UAAW,EACZ,EACA,OACC,EAAA,EAAA,IAAA,CAAC,KAAD,CAAI,UAAU,wBACb,UAAA,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CAAU,GAAI,CAA4B,CAAA,CACvC,CAAA,CAEN,EAKM,GAAc,CACnB,cAAe,EACf,KACA,uBACA,iBACA,WAC0C,CAC1C,IAAM,EAAqB,CAC1B,GAAG,EACH,GAAG,CACJ,EAAE,MAEF,OACC,EAAA,EAAA,IAAA,CAAC,MAAD,CACC,KAAK,aACL,aAAY,EACZ,MAAO,EAEP,UAAA,EAAA,EAAA,KAAA,CAAC,KAAD,CAAI,UAAU,uCAAd,SAAA,CACE,GACA,EAAsB,EAAsB,CAAE,IAAG,CAAC,EAClD,EAAM,KAAK,EAAO,KAClB,EAAA,EAAA,IAAA,CAAC,KAAD,CAAgB,UAAU,wBACxB,SAAA,CACE,EAFK,CAEL,CACJ,CACE,GACA,CAAA,CAEP,EAEA,EAAW,YAAc,EAAA"}
|
|
@@ -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("../icon/button-icon/index.cjs"),r=require("../tooltip/index.cjs"),i=require("../../utilities/get-aria-props.cjs"),a=require("../../utilities/get-data-props.cjs"),o=require("../../utilities/get-form-props.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("classnames");c=e.__toESM(c,1);let l=require("react/jsx-runtime");var u={icon:``},d=(0,s.forwardRef)((e,t)=>{let{assistiveText:d=u,buttonRef:f,children:p,className:m,disabled:h=!1,hint:g=!1,iconCategory:_,iconClassName:v,iconName:y,iconPath:b,iconPosition:x,iconSize:S=`medium`,iconVariant:C,id:w,inverse:T,label:E,onBlur:D,onClick:O,onFocus:k,onKeyDown:A,onKeyPress:j,onKeyUp:M,onMouseDown:N,onMouseEnter:P,onMouseLeave:F,onMouseUp:I,onRequestFocus:L,requestFocus:R,style:z,tabIndex:B,title:V,tooltip:H,type:U=`button`,variant:W=`neutral`,...G}=e,K=(0,s.useRef)(null);(0,s.useEffect)(()=>{R&&L&&K.current&&L(K.current)},[R,L]);let q=()=>{let e=W===`icon`,t=C,n=C===`more`,r=C===`border`,i=C===`global-header`,a=W!==`base`&&!C&&!T&&W!==`link`||C===`bare`,o=T&&!e,s=T&&e&&!n&&!r,l=T&&n,u=T&&r;return C===`global-header`&&(t=`container`),(0,c.default)({"slds-button":W!==`link`,[`slds-button_${W}`]:a,"slds-button_inverse":o,"slds-button_icon-inverse":s||l,"slds-button_icon-border-inverse":u,[`slds-button_icon-${t}`]:t&&!u,"slds-global-header__button_icon":i,[`slds-button_icon-${S}`]:C&&S!==`medium`,"slds-button_reset":W===`link`,"slds-text-link":W===`link`},m)},J=e=>{O&&O(e,{id:w})},Y=e=>{let t=!S||C||S===`xx-small`?void 0:S;return(0,l.jsx)(n.default,{category:_||`utility`,className:(0,c.default)({"slds-global-header__icon":C===`global-header`},v),hint:g,inverse:T,name:e,path:b,position:x,size:t})},X=()=>{let e=y||b,t=
|
|
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("../icon/button-icon/index.cjs"),r=require("../tooltip/index.cjs"),i=require("../../utilities/get-aria-props.cjs"),a=require("../../utilities/get-data-props.cjs"),o=require("../../utilities/get-form-props.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("classnames");c=e.__toESM(c,1);let l=require("react/jsx-runtime");var u={icon:``},d=(0,s.forwardRef)((e,t)=>{let{assistiveText:d=u,buttonRef:f,children:p,className:m,disabled:h=!1,hint:g=!1,iconCategory:_,iconClassName:v,iconName:y,iconPath:b,iconPosition:x,iconSize:S=`medium`,iconVariant:C,id:w,inverse:T,label:E,onBlur:D,onClick:O,onFocus:k,onKeyDown:A,onKeyPress:j,onKeyUp:M,onMouseDown:N,onMouseEnter:P,onMouseLeave:F,onMouseUp:I,onRequestFocus:L,requestFocus:R,style:z,tabIndex:B,title:V,tooltip:H,type:U=`button`,variant:W=`neutral`,...G}=e,K=(0,s.useRef)(null);(0,s.useEffect)(()=>{R&&L&&K.current&&L(K.current)},[R,L]);let q=()=>{let e=W===`icon`,t=C,n=C===`more`,r=C===`border`,i=C===`global-header`,a=W!==`base`&&!C&&!T&&W!==`link`||C===`bare`,o=T&&!e,s=T&&e&&!n&&!r,l=T&&n,u=T&&r;return C===`global-header`&&(t=`container`),(0,c.default)({"slds-button":W!==`link`,[`slds-button_${W}`]:a,"slds-button_inverse":o,"slds-button_icon-inverse":s||l,"slds-button_icon-border-inverse":u,[`slds-button_icon-${t}`]:t&&!u,"slds-global-header__button_icon":i,[`slds-button_icon-${S}`]:C&&S!==`medium`,"slds-button_reset":W===`link`,"slds-text-link":W===`link`},m)},J=e=>{O&&O(e,{id:w})},Y=e=>{let t=!S||C||S===`xx-small`?void 0:S;return(0,l.jsx)(n.default,{category:_||`utility`,className:(0,c.default)({"slds-global-header__icon":C===`global-header`},v),hint:g,inverse:T,name:e,path:b,position:x,size:t})},X=()=>{let e=y||b,t={...u,...d}.icon;return e&&t?(0,l.jsx)(`span`,{className:`slds-assistive-text`,children:t}):E},Z=()=>{let e=i.default(G),r=a.default(G),s=o.default(G);return(0,l.jsxs)(`button`,{className:q(),disabled:h,id:w,onBlur:D,onClick:J,onFocus:k,onKeyDown:A,onKeyPress:j,onKeyUp:M,onMouseDown:N,onMouseEnter:P,onMouseLeave:F,onMouseUp:I,ref:e=>{K.current=e,typeof t==`function`?t(e):t&&(t.current=e),f&&f(e)},tabIndex:typeof B==`string`?parseInt(B,10):B,title:V,type:U,style:z,...e,...r,...s,children:[x===`right`?X():null,y||b?Y(y):null,C===`more`?(0,l.jsx)(n.default,{category:`utility`,name:`down`,size:`x-small`,className:v}):null,x===`left`||!x?X():null,p]})};return H?(0,l.jsx)(r.default,{content:H,children:Z()}):Z()});d.displayName=t.BUTTON,exports.default=d;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/button/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\n// Implements the [Button design pattern](https://lightningdesignsystem.com/components/buttons/) in React.\n\nimport React, {\n\tuseEffect,\n\tuseRef,\n\tforwardRef,\n\ttype MouseEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype CSSProperties,\n\ttype ReactNode,\n\ttype ForwardedRef,\n} from 'react';\nimport classNames from 'classnames';\n// These imports use the old JSX files for now until they're converted\nimport ButtonIcon from '../icon/button-icon/index.jsx';\nimport Tooltip from '../tooltip/index.jsx';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport getDataProps from '../../utilities/get-data-props';\nimport getFormProps from '../../utilities/get-form-props';\nimport { BUTTON } from '../../utilities/constants';\nimport type { IconCategory } from '../../types/common';\n\n/**\n * Button variant types\n */\nexport type ButtonVariant =\n\t| 'base'\n\t| 'link'\n\t| 'neutral'\n\t| 'brand'\n\t| 'outline-brand'\n\t| 'destructive'\n\t| 'success'\n\t| 'text-destructive'\n\t| 'icon';\n\n/**\n * Button icon variant types\n */\nexport type ButtonIconVariant =\n\t| 'bare'\n\t| 'container'\n\t| 'border'\n\t| 'border-filled'\n\t| 'brand'\n\t| 'more'\n\t| 'global-header';\n\n/**\n * Button icon size types\n */\nexport type ButtonIconSize =\n\t'xx-small' | 'x-small' | 'small' | 'medium' | 'large';\n\n/**\n * Button type attribute\n */\nexport type ButtonType = 'button' | 'submit' | 'reset';\n\n/**\n * Icon position relative to label\n */\nexport type IconPosition = 'left' | 'right';\n\n/**\n * Assistive text for button\n */\nexport interface ButtonAssistiveText {\n\ticon?: string;\n}\n\n/**\n * Props for the Button component\n */\nexport interface ButtonProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: ButtonAssistiveText | string;\n\t/** Callback for DOM reference */\n\tbuttonRef?: (ref: HTMLButtonElement | null) => void;\n\t/** Additional CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Child elements */\n\tchildren?: ReactNode;\n\t/** Disabled state */\n\tdisabled?: boolean;\n\t/** Hint styling for icon buttons */\n\thint?: boolean;\n\t/** Icon category */\n\ticonCategory?: IconCategory;\n\t/** CSS classes for icon */\n\ticonClassName?: string | string[] | Record<string, boolean>;\n\t/** Icon name */\n\ticonName?: string;\n\t/** Direct path to icon sprite */\n\ticonPath?: string;\n\t/** Icon position */\n\ticonPosition?: IconPosition;\n\t/**\n\t * Icon size. With `iconVariant`, sizes the button container (`slds-button_icon-*`); otherwise sizes the SVG (`slds-button__icon_*`).\n\t * `xx-small` requires `iconVariant`, since SLDS only defines it for the button container (matches `lightning-button-icon`).\n\t */\n\ticonSize?: ButtonIconSize;\n\t/** Icon variant */\n\ticonVariant?: ButtonIconVariant;\n\t/** Unique identifier */\n\tid?: string;\n\t/** Inverse colors for dark backgrounds */\n\tinverse?: boolean;\n\t/** Visible button label */\n\tlabel?: ReactNode;\n\t/** Blur event handler */\n\tonBlur?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Click event handler */\n\tonClick?: (\n\t\tevent: MouseEvent<HTMLButtonElement>,\n\t\tdata?: { id?: string }\n\t) => void;\n\t/** Focus event handler */\n\tonFocus?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Key down event handler */\n\tonKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Key press event handler */\n\tonKeyPress?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Key up event handler */\n\tonKeyUp?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Mouse down event handler */\n\tonMouseDown?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse enter event handler */\n\tonMouseEnter?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse leave event handler */\n\tonMouseLeave?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse up event handler */\n\tonMouseUp?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Request focus callback */\n\tonRequestFocus?: (element: HTMLButtonElement) => void;\n\t/** Trigger onRequestFocus */\n\trequestFocus?: boolean;\n\t/** Responsive width on small screens */\n\tresponsive?: boolean;\n\t/** Custom inline styles */\n\tstyle?: CSSProperties;\n\t/** Tab index */\n\ttabIndex?: number | string;\n\t/** HTML title attribute */\n\ttitle?: string;\n\t/** Tooltip content (deprecated) */\n\ttooltip?: ReactNode;\n\t/** Button type attribute */\n\ttype?: ButtonType;\n\t/** Button variant */\n\tvariant?: ButtonVariant;\n\t/** Allow any additional props for aria-*, data-*, form* */\n\t[key: `aria-${string}`]: string | boolean | undefined;\n\t[key: `data-${string}`]: string | number | boolean | undefined;\n\t[key: `form${string}`]: string | undefined;\n}\n\nconst defaultAssistiveText: ButtonAssistiveText = { icon: '' };\n\n/**\n * The Button component is the Lightning Design System Button component.\n * Use for label buttons, icon buttons, or buttons with both labels and icons.\n *\n * Either a `label` or `assistiveText.icon` is required for accessibility.\n * For buttons that maintain selected/unselected states, use ButtonStateful.\n */\nconst Button = forwardRef<HTMLButtonElement, ButtonProps>(\n\t(props: ButtonProps, ref: ForwardedRef<HTMLButtonElement>) => {\n\t\tconst {\n\t\t\tassistiveText = defaultAssistiveText,\n\t\t\tbuttonRef,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tdisabled = false,\n\t\t\thint = false,\n\t\t\ticonCategory,\n\t\t\ticonClassName,\n\t\t\ticonName,\n\t\t\ticonPath,\n\t\t\ticonPosition,\n\t\t\ticonSize = 'medium',\n\t\t\ticonVariant,\n\t\t\tid,\n\t\t\tinverse,\n\t\t\tlabel,\n\t\t\tonBlur,\n\t\t\tonClick,\n\t\t\tonFocus,\n\t\t\tonKeyDown,\n\t\t\tonKeyPress,\n\t\t\tonKeyUp,\n\t\t\tonMouseDown,\n\t\t\tonMouseEnter,\n\t\t\tonMouseLeave,\n\t\t\tonMouseUp,\n\t\t\tonRequestFocus,\n\t\t\trequestFocus,\n\t\t\tstyle,\n\t\t\ttabIndex,\n\t\t\ttitle,\n\t\t\ttooltip,\n\t\t\ttype = 'button',\n\t\t\tvariant = 'neutral',\n\t\t\t...restProps\n\t\t} = props;\n\n\t\tconst internalRef = useRef<HTMLButtonElement | null>(null);\n\n\t\tuseEffect(() => {\n\t\t\tif (requestFocus && onRequestFocus && internalRef.current) {\n\t\t\t\tonRequestFocus(internalRef.current);\n\t\t\t}\n\t\t}, [requestFocus, onRequestFocus]);\n\n\t\tconst getClassName = (): string => {\n\t\t\tconst isIcon = variant === 'icon';\n\t\t\tlet computedIconVariant = iconVariant;\n\t\t\tconst iconMore = iconVariant === 'more';\n\t\t\tconst iconBorder = iconVariant === 'border';\n\t\t\tconst iconGlobalHeader = iconVariant === 'global-header';\n\n\t\t\tconst showButtonVariant =\n\t\t\t\t(variant !== 'base' &&\n\t\t\t\t\t!iconVariant &&\n\t\t\t\t\t!inverse &&\n\t\t\t\t\tvariant !== 'link') ||\n\t\t\t\ticonVariant === 'bare';\n\t\t\tconst plainInverseBtn = inverse && !isIcon;\n\t\t\tconst plainInverseIcon = inverse && isIcon && !iconMore && !iconBorder;\n\t\t\tconst moreInverseIcon = inverse && iconMore;\n\t\t\tconst borderInverseIcon = inverse && iconBorder;\n\n\t\t\t// Reset to container style for the actual button CSS\n\t\t\tif (iconVariant === 'global-header') {\n\t\t\t\tcomputedIconVariant = 'container';\n\t\t\t}\n\n\t\t\treturn classNames(\n\t\t\t\t{\n\t\t\t\t\t'slds-button': variant !== 'link',\n\t\t\t\t\t[`slds-button_${variant}`]: showButtonVariant,\n\t\t\t\t\t'slds-button_inverse': plainInverseBtn,\n\t\t\t\t\t'slds-button_icon-inverse': plainInverseIcon || moreInverseIcon,\n\t\t\t\t\t'slds-button_icon-border-inverse': borderInverseIcon,\n\t\t\t\t\t[`slds-button_icon-${computedIconVariant}`]:\n\t\t\t\t\t\tcomputedIconVariant && !borderInverseIcon,\n\t\t\t\t\t'slds-global-header__button_icon': iconGlobalHeader,\n\t\t\t\t\t[`slds-button_icon-${iconSize}`]:\n\t\t\t\t\t\ticonVariant && iconSize !== 'medium',\n\t\t\t\t\t'slds-button_reset': variant === 'link',\n\t\t\t\t\t'slds-text-link': variant === 'link',\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t);\n\t\t};\n\n\t\tconst handleClick = (event: MouseEvent<HTMLButtonElement>): void => {\n\t\t\tif (onClick) {\n\t\t\t\tonClick(event, { id });\n\t\t\t}\n\t\t};\n\n\t\tconst renderIcon = (name?: string): React.ReactElement => {\n\t\t\t// SLDS has no `slds-button__icon_xx-small`; xx-small only sizes the container.\n\t\t\tconst computedIconSize =\n\t\t\t\t!iconSize || iconVariant || iconSize === 'xx-small'\n\t\t\t\t\t? undefined\n\t\t\t\t\t: iconSize;\n\t\t\treturn (\n\t\t\t\t<ButtonIcon\n\t\t\t\t\tcategory={iconCategory || 'utility'}\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'slds-global-header__icon': iconVariant === 'global-header',\n\t\t\t\t\t\t},\n\t\t\t\t\t\ticonClassName as string\n\t\t\t\t\t)}\n\t\t\t\t\thint={hint}\n\t\t\t\t\tinverse={inverse}\n\t\t\t\t\tname={name}\n\t\t\t\t\tpath={iconPath}\n\t\t\t\t\tposition={iconPosition}\n\t\t\t\t\tsize={computedIconSize}\n\t\t\t\t/>\n\t\t\t);\n\t\t};\n\n\t\tconst renderLabel = (): ReactNode => {\n\t\t\tconst iconOnly = iconName || iconPath;\n\t\t\tconst assistiveTextIcon =\n\t\t\t\ttypeof assistiveText === 'string'\n\t\t\t\t\t? assistiveText\n\t\t\t\t\t: {\n\t\t\t\t\t\t\t...defaultAssistiveText,\n\t\t\t\t\t\t\t...(assistiveText as ButtonAssistiveText),\n\t\t\t\t\t\t}.icon;\n\n\t\t\treturn iconOnly && assistiveTextIcon ? (\n\t\t\t\t<span className=\"slds-assistive-text\">{assistiveTextIcon}</span>\n\t\t\t) : (\n\t\t\t\tlabel\n\t\t\t);\n\t\t};\n\n\t\tconst renderButton = (): React.ReactElement => {\n\t\t\tconst ariaProps = getAriaProps(restProps);\n\t\t\tconst dataProps = getDataProps(restProps);\n\t\t\tconst formProps = getFormProps(restProps);\n\n\t\t\treturn (\n\t\t\t\t<button\n\t\t\t\t\tclassName={getClassName()}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tid={id}\n\t\t\t\t\tonBlur={onBlur}\n\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\t\tonKeyPress={onKeyPress}\n\t\t\t\t\tonKeyUp={onKeyUp}\n\t\t\t\t\tonMouseDown={onMouseDown}\n\t\t\t\t\tonMouseEnter={onMouseEnter}\n\t\t\t\t\tonMouseLeave={onMouseLeave}\n\t\t\t\t\tonMouseUp={onMouseUp}\n\t\t\t\t\tref={(node) => {\n\t\t\t\t\t\tinternalRef.current = node;\n\t\t\t\t\t\tif (typeof ref === 'function') {\n\t\t\t\t\t\t\tref(node);\n\t\t\t\t\t\t} else if (ref) {\n\t\t\t\t\t\t\tref.current = node;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (buttonRef) {\n\t\t\t\t\t\t\tbuttonRef(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\ttabIndex={\n\t\t\t\t\t\ttypeof tabIndex === 'string' ? parseInt(tabIndex, 10) : tabIndex\n\t\t\t\t\t}\n\t\t\t\t\ttitle={title}\n\t\t\t\t\ttype={type}\n\t\t\t\t\tstyle={style}\n\t\t\t\t\t{...ariaProps}\n\t\t\t\t\t{...dataProps}\n\t\t\t\t\t{...formProps}\n\t\t\t\t>\n\t\t\t\t\t{iconPosition === 'right' ? renderLabel() : null}\n\t\t\t\t\t{iconName || iconPath ? renderIcon(iconName) : null}\n\t\t\t\t\t{iconVariant === 'more' ? (\n\t\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\tname=\"down\"\n\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t\tclassName={iconClassName as string}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null}\n\t\t\t\t\t{iconPosition === 'left' || !iconPosition ? renderLabel() : null}\n\t\t\t\t\t{children}\n\t\t\t\t</button>\n\t\t\t);\n\t\t};\n\n\t\t// Deprecated: wrap button in tooltip if tooltip prop is provided\n\t\tif (tooltip) {\n\t\t\treturn <Tooltip content={tooltip}>{renderButton()}</Tooltip>;\n\t\t}\n\n\t\treturn renderButton();\n\t}\n);\n\nButton.displayName = BUTTON;\n\nexport default Button;\n"],"mappings":"uhBAiKA,IAAM,EAA4C,CAAE,KAAM,EAAG,EASvD,GAAA,EAAS,EAAA,WAAA,EACb,EAAoB,IAAyC,CAC7D,GAAM,CACL,gBAAgB,EAChB,YACA,WACA,YACA,WAAW,GACX,OAAO,GACP,eACA,gBACA,WACA,WACA,eAC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N,CAAA,CAEH,EAEM,MAA+B,CACpC,IAAM,EAAW,GAAY,EACvB,EACL,OAAO,GAAkB,SACtB,EACA,CACA,GAAG,EACH,GAAI,CACL,EAAE,KAEL,OAAO,GAAY,GAClB,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,sBAAuB,SAAA,CAAwB,CAAA,EAE/D,CAEF,EAEM,MAAyC,CAC9C,IAAM,EAAY,EAAA,QAAa,CAAS,EAClC,EAAY,EAAA,QAAa,CAAS,EAClC,EAAY,EAAA,QAAa,CAAS,EAExC,OACC,EAAA,EAAA,KAAA,CAAC,SAAD,CACC,UAAW,EAAa,EACd,WACN,KACI,SACR,QAAS,EACA,UACE,YACC,aACH,UACI,cACC,eACA,eACH,YACX,IAAM,GAAS,CACd,EAAY,QAAU,EAClB,OAAO,GAAQ,WAClB,EAAI,CAAI,EACE,IACV,EAAI,QAAU,GAEX,GACH,EAAU,CAAI,CAEhB,EACA,SACC,OAAO,GAAa,SAAW,SAAS,EAAU,EAAE,EAAI,EAElD,QACD,OACC,QACP,GAAI,EACJ,GAAI,EACJ,GAAI,EAjCL,SAAA,CAmCE,IAAiB,QAAU,EAAY,EAAI,KAC3C,GAAY,EAAW,EAAW,CAAQ,EAAI,KAC9C,IAAgB,QAChB,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACC,SAAS,UACT,KAAK,OACL,KAAK,UACL,UAAW,CACX,CAAA,EACE,KACH,IAAiB,QAAU,CAAC,EAAe,EAAY,EAAI,KAC3D,CACM,GAEV,EAOA,OAJI,GACI,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CAAS,QAAS,EAAU,SAAA,EAAa,CAAW,CAAA,EAGrD,EAAa,CACrB,CACD,EAEA,EAAO,YAAc,EAAA"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/button/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\n// Implements the [Button design pattern](https://lightningdesignsystem.com/components/buttons/) in React.\n\nimport React, {\n\tuseEffect,\n\tuseRef,\n\tforwardRef,\n\ttype MouseEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype CSSProperties,\n\ttype ReactNode,\n\ttype ForwardedRef,\n} from 'react';\nimport classNames from 'classnames';\n// These imports use the old JSX files for now until they're converted\nimport ButtonIcon from '../icon/button-icon/index.jsx';\nimport Tooltip from '../tooltip/index.jsx';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport getDataProps from '../../utilities/get-data-props';\nimport getFormProps from '../../utilities/get-form-props';\nimport { BUTTON } from '../../utilities/constants';\nimport type { IconCategory } from '../../types/common';\n\n/**\n * Button variant types\n */\nexport type ButtonVariant =\n\t| 'base'\n\t| 'link'\n\t| 'neutral'\n\t| 'brand'\n\t| 'outline-brand'\n\t| 'destructive'\n\t| 'success'\n\t| 'text-destructive'\n\t| 'icon';\n\n/**\n * Button icon variant types\n */\nexport type ButtonIconVariant =\n\t| 'bare'\n\t| 'container'\n\t| 'border'\n\t| 'border-filled'\n\t| 'brand'\n\t| 'more'\n\t| 'global-header';\n\n/**\n * Button icon size types\n */\nexport type ButtonIconSize =\n\t'xx-small' | 'x-small' | 'small' | 'medium' | 'large';\n\n/**\n * Button type attribute\n */\nexport type ButtonType = 'button' | 'submit' | 'reset';\n\n/**\n * Icon position relative to label\n */\nexport type IconPosition = 'left' | 'right';\n\n/**\n * Assistive text for button\n */\nexport interface ButtonAssistiveText {\n\ticon?: string;\n}\n\n/**\n * Props for the Button component\n */\nexport interface ButtonProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: ButtonAssistiveText;\n\t/** Callback for DOM reference */\n\tbuttonRef?: (ref: HTMLButtonElement | null) => void;\n\t/** Additional CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Child elements */\n\tchildren?: ReactNode;\n\t/** Disabled state */\n\tdisabled?: boolean;\n\t/** Hint styling for icon buttons */\n\thint?: boolean;\n\t/** Icon category */\n\ticonCategory?: IconCategory;\n\t/** CSS classes for icon */\n\ticonClassName?: string | string[] | Record<string, boolean>;\n\t/** Icon name */\n\ticonName?: string;\n\t/** Direct path to icon sprite */\n\ticonPath?: string;\n\t/** Icon position */\n\ticonPosition?: IconPosition;\n\t/**\n\t * Icon size. With `iconVariant`, sizes the button container (`slds-button_icon-*`); otherwise sizes the SVG (`slds-button__icon_*`).\n\t * `xx-small` requires `iconVariant`, since SLDS only defines it for the button container (matches `lightning-button-icon`).\n\t */\n\ticonSize?: ButtonIconSize;\n\t/** Icon variant */\n\ticonVariant?: ButtonIconVariant;\n\t/** Unique identifier */\n\tid?: string;\n\t/** Inverse colors for dark backgrounds */\n\tinverse?: boolean;\n\t/** Visible button label */\n\tlabel?: ReactNode;\n\t/** Blur event handler */\n\tonBlur?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Click event handler */\n\tonClick?: (\n\t\tevent: MouseEvent<HTMLButtonElement>,\n\t\tdata?: { id?: string }\n\t) => void;\n\t/** Focus event handler */\n\tonFocus?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Key down event handler */\n\tonKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Key press event handler */\n\tonKeyPress?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Key up event handler */\n\tonKeyUp?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Mouse down event handler */\n\tonMouseDown?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse enter event handler */\n\tonMouseEnter?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse leave event handler */\n\tonMouseLeave?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse up event handler */\n\tonMouseUp?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Request focus callback */\n\tonRequestFocus?: (element: HTMLButtonElement) => void;\n\t/** Trigger onRequestFocus */\n\trequestFocus?: boolean;\n\t/** Responsive width on small screens */\n\tresponsive?: boolean;\n\t/** Custom inline styles */\n\tstyle?: CSSProperties;\n\t/** Tab index */\n\ttabIndex?: number | string;\n\t/** HTML title attribute */\n\ttitle?: string;\n\t/** Tooltip content (deprecated) */\n\ttooltip?: ReactNode;\n\t/** Button type attribute */\n\ttype?: ButtonType;\n\t/** Button variant */\n\tvariant?: ButtonVariant;\n\t/** Allow any additional props for aria-*, data-*, form* */\n\t[key: `aria-${string}`]: string | boolean | undefined;\n\t[key: `data-${string}`]: string | number | boolean | undefined;\n\t[key: `form${string}`]: string | undefined;\n}\n\nconst defaultAssistiveText: ButtonAssistiveText = { icon: '' };\n\n/**\n * The Button component is the Lightning Design System Button component.\n * Use for label buttons, icon buttons, or buttons with both labels and icons.\n *\n * Either a `label` or `assistiveText.icon` is required for accessibility.\n * For buttons that maintain selected/unselected states, use ButtonStateful.\n */\nconst Button = forwardRef<HTMLButtonElement, ButtonProps>(\n\t(props: ButtonProps, ref: ForwardedRef<HTMLButtonElement>) => {\n\t\tconst {\n\t\t\tassistiveText = defaultAssistiveText,\n\t\t\tbuttonRef,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tdisabled = false,\n\t\t\thint = false,\n\t\t\ticonCategory,\n\t\t\ticonClassName,\n\t\t\ticonName,\n\t\t\ticonPath,\n\t\t\ticonPosition,\n\t\t\ticonSize = 'medium',\n\t\t\ticonVariant,\n\t\t\tid,\n\t\t\tinverse,\n\t\t\tlabel,\n\t\t\tonBlur,\n\t\t\tonClick,\n\t\t\tonFocus,\n\t\t\tonKeyDown,\n\t\t\tonKeyPress,\n\t\t\tonKeyUp,\n\t\t\tonMouseDown,\n\t\t\tonMouseEnter,\n\t\t\tonMouseLeave,\n\t\t\tonMouseUp,\n\t\t\tonRequestFocus,\n\t\t\trequestFocus,\n\t\t\tstyle,\n\t\t\ttabIndex,\n\t\t\ttitle,\n\t\t\ttooltip,\n\t\t\ttype = 'button',\n\t\t\tvariant = 'neutral',\n\t\t\t...restProps\n\t\t} = props;\n\n\t\tconst internalRef = useRef<HTMLButtonElement | null>(null);\n\n\t\tuseEffect(() => {\n\t\t\tif (requestFocus && onRequestFocus && internalRef.current) {\n\t\t\t\tonRequestFocus(internalRef.current);\n\t\t\t}\n\t\t}, [requestFocus, onRequestFocus]);\n\n\t\tconst getClassName = (): string => {\n\t\t\tconst isIcon = variant === 'icon';\n\t\t\tlet computedIconVariant = iconVariant;\n\t\t\tconst iconMore = iconVariant === 'more';\n\t\t\tconst iconBorder = iconVariant === 'border';\n\t\t\tconst iconGlobalHeader = iconVariant === 'global-header';\n\n\t\t\tconst showButtonVariant =\n\t\t\t\t(variant !== 'base' &&\n\t\t\t\t\t!iconVariant &&\n\t\t\t\t\t!inverse &&\n\t\t\t\t\tvariant !== 'link') ||\n\t\t\t\ticonVariant === 'bare';\n\t\t\tconst plainInverseBtn = inverse && !isIcon;\n\t\t\tconst plainInverseIcon = inverse && isIcon && !iconMore && !iconBorder;\n\t\t\tconst moreInverseIcon = inverse && iconMore;\n\t\t\tconst borderInverseIcon = inverse && iconBorder;\n\n\t\t\t// Reset to container style for the actual button CSS\n\t\t\tif (iconVariant === 'global-header') {\n\t\t\t\tcomputedIconVariant = 'container';\n\t\t\t}\n\n\t\t\treturn classNames(\n\t\t\t\t{\n\t\t\t\t\t'slds-button': variant !== 'link',\n\t\t\t\t\t[`slds-button_${variant}`]: showButtonVariant,\n\t\t\t\t\t'slds-button_inverse': plainInverseBtn,\n\t\t\t\t\t'slds-button_icon-inverse': plainInverseIcon || moreInverseIcon,\n\t\t\t\t\t'slds-button_icon-border-inverse': borderInverseIcon,\n\t\t\t\t\t[`slds-button_icon-${computedIconVariant}`]:\n\t\t\t\t\t\tcomputedIconVariant && !borderInverseIcon,\n\t\t\t\t\t'slds-global-header__button_icon': iconGlobalHeader,\n\t\t\t\t\t[`slds-button_icon-${iconSize}`]:\n\t\t\t\t\t\ticonVariant && iconSize !== 'medium',\n\t\t\t\t\t'slds-button_reset': variant === 'link',\n\t\t\t\t\t'slds-text-link': variant === 'link',\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t);\n\t\t};\n\n\t\tconst handleClick = (event: MouseEvent<HTMLButtonElement>): void => {\n\t\t\tif (onClick) {\n\t\t\t\tonClick(event, { id });\n\t\t\t}\n\t\t};\n\n\t\tconst renderIcon = (name?: string): React.ReactElement => {\n\t\t\t// SLDS has no `slds-button__icon_xx-small`; xx-small only sizes the container.\n\t\t\tconst computedIconSize =\n\t\t\t\t!iconSize || iconVariant || iconSize === 'xx-small'\n\t\t\t\t\t? undefined\n\t\t\t\t\t: iconSize;\n\t\t\treturn (\n\t\t\t\t<ButtonIcon\n\t\t\t\t\tcategory={iconCategory || 'utility'}\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'slds-global-header__icon': iconVariant === 'global-header',\n\t\t\t\t\t\t},\n\t\t\t\t\t\ticonClassName as string\n\t\t\t\t\t)}\n\t\t\t\t\thint={hint}\n\t\t\t\t\tinverse={inverse}\n\t\t\t\t\tname={name}\n\t\t\t\t\tpath={iconPath}\n\t\t\t\t\tposition={iconPosition}\n\t\t\t\t\tsize={computedIconSize}\n\t\t\t\t/>\n\t\t\t);\n\t\t};\n\n\t\tconst renderLabel = (): ReactNode => {\n\t\t\tconst iconOnly = iconName || iconPath;\n\t\t\tconst assistiveTextIcon = {\n\t\t\t\t...defaultAssistiveText,\n\t\t\t\t...assistiveText,\n\t\t\t}.icon;\n\n\t\t\treturn iconOnly && assistiveTextIcon ? (\n\t\t\t\t<span className=\"slds-assistive-text\">{assistiveTextIcon}</span>\n\t\t\t) : (\n\t\t\t\tlabel\n\t\t\t);\n\t\t};\n\n\t\tconst renderButton = (): React.ReactElement => {\n\t\t\tconst ariaProps = getAriaProps(restProps);\n\t\t\tconst dataProps = getDataProps(restProps);\n\t\t\tconst formProps = getFormProps(restProps);\n\n\t\t\treturn (\n\t\t\t\t<button\n\t\t\t\t\tclassName={getClassName()}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tid={id}\n\t\t\t\t\tonBlur={onBlur}\n\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\t\tonKeyPress={onKeyPress}\n\t\t\t\t\tonKeyUp={onKeyUp}\n\t\t\t\t\tonMouseDown={onMouseDown}\n\t\t\t\t\tonMouseEnter={onMouseEnter}\n\t\t\t\t\tonMouseLeave={onMouseLeave}\n\t\t\t\t\tonMouseUp={onMouseUp}\n\t\t\t\t\tref={(node) => {\n\t\t\t\t\t\tinternalRef.current = node;\n\t\t\t\t\t\tif (typeof ref === 'function') {\n\t\t\t\t\t\t\tref(node);\n\t\t\t\t\t\t} else if (ref) {\n\t\t\t\t\t\t\tref.current = node;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (buttonRef) {\n\t\t\t\t\t\t\tbuttonRef(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\ttabIndex={\n\t\t\t\t\t\ttypeof tabIndex === 'string' ? parseInt(tabIndex, 10) : tabIndex\n\t\t\t\t\t}\n\t\t\t\t\ttitle={title}\n\t\t\t\t\ttype={type}\n\t\t\t\t\tstyle={style}\n\t\t\t\t\t{...ariaProps}\n\t\t\t\t\t{...dataProps}\n\t\t\t\t\t{...formProps}\n\t\t\t\t>\n\t\t\t\t\t{iconPosition === 'right' ? renderLabel() : null}\n\t\t\t\t\t{iconName || iconPath ? renderIcon(iconName) : null}\n\t\t\t\t\t{iconVariant === 'more' ? (\n\t\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\tname=\"down\"\n\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t\tclassName={iconClassName as string}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null}\n\t\t\t\t\t{iconPosition === 'left' || !iconPosition ? renderLabel() : null}\n\t\t\t\t\t{children}\n\t\t\t\t</button>\n\t\t\t);\n\t\t};\n\n\t\t// Deprecated: wrap button in tooltip if tooltip prop is provided\n\t\tif (tooltip) {\n\t\t\treturn <Tooltip content={tooltip}>{renderButton()}</Tooltip>;\n\t\t}\n\n\t\treturn renderButton();\n\t}\n);\n\nButton.displayName = BUTTON;\n\nexport default Button;\n"],"mappings":"uhBAiKA,IAAM,EAA4C,CAAE,KAAM,EAAG,EASvD,GAAA,EAAS,EAAA,WAAA,EACb,EAAoB,IAAyC,CAC7D,GAAM,CACL,gBAAgB,EAChB,YACA,WACA,YACA,WAAW,GACX,OAAO,GACP,eACA,gBACA,WACA,WACA,eACA,WAAW,SACX,cACA,KACA,UACA,QACA,SACA,UACA,UACA,YACA,aACA,UACA,cACA,eACA,eACA,YACA,iBACA,eACA,QACA,WACA,QACA,UACA,OAAO,SACP,UAAU,UACV,GAAG,GACA,EAEE,GAAA,EAAc,EAAA,OAAA,CAAiC,IAAI,GAEzD,EAAA,EAAA,UAAA,KAAgB,CACX,GAAgB,GAAkB,EAAY,SACjD,EAAe,EAAY,OAAO,CAEpC,EAAG,CAAC,EAAc,CAAc,CAAC,EAEjC,IAAM,MAA6B,CAClC,IAAM,EAAS,IAAY,OACvB,EAAsB,EACpB,EAAW,IAAgB,OAC3B,EAAa,IAAgB,SAC7B,EAAmB,IAAgB,gBAEnC,EACJ,IAAY,QACZ,CAAC,GACD,CAAC,GACD,IAAY,QACb,IAAgB,OACX,EAAkB,GAAW,CAAC,EAC9B,EAAmB,GAAW,GAAU,CAAC,GAAY,CAAC,EACtD,EAAkB,GAAW,EAC7B,EAAoB,GAAW,EAOrC,OAJI,IAAgB,kBACnB,EAAsB,cAGvB,EAAO,EAAA,QAAA,CACN,CACC,cAAe,IAAY,QAC1B,eAAe,KAAY,EAC5B,sBAAuB,EACvB,2BAA4B,GAAoB,EAChD,kCAAmC,GAClC,oBAAoB,KACpB,GAAuB,CAAC,EACzB,kCAAmC,GAClC,oBAAoB,KACpB,GAA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K,OACL,KAAK,UACL,UAAW,CACX,CAAA,EACE,KACH,IAAiB,QAAU,CAAC,EAAe,EAAY,EAAI,KAC3D,CACM,GAEV,EAOA,OAJI,GACI,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CAAS,QAAS,EAAU,SAAA,EAAa,CAAW,CAAA,EAGrD,EAAa,CACrB,CACD,EAEA,EAAO,YAAc,EAAA"}
|
|
@@ -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("../icon/button-icon/index.cjs"),r=require("../../utilities/get-aria-props.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime"),s=require("lodash.isfunction");s=e.__toESM(s,1);var c={icon:``},l={iconName:`add`,label:`Follow`},u={iconName:`check`,label:`Following`},d={iconName:`close`,label:`Unfollow`},f=({active:e,assistiveText:t,className:f,disabled:p=!1,icon:m,iconName:h,iconSize:g=`medium`,id:_,onBlur:v,onClick:y,onFocus:b,onKeyDown:x,onKeyPress:S,onKeyUp:C,onMouseDown:w,onMouseEnter:T,responsive:E=!1,stateOne:D=l,stateTwo:O=u,stateThree:k=d,tabIndex:A,variant:j,...M})=>{let[N,P]=(0,i.useState)(!1),F=typeof e==`boolean`?e:N,I=(0,i.useCallback)(e=>(0,a.default)(f,`slds-button`,`slds-button_stateful`,{"slds-button_neutral":j!==`icon`&&j!==`icon-filled`&&j!==`success`&&j!==`text`,"slds-button_inverse":j===`inverse`,"slds-button_success":j===`success`,"slds-not-selected":!e,"slds-is-selected":e,"slds-max-small-button_stretch":E,"slds-button_icon-border":j===`icon`,"slds-button_icon-border-filled":j===`icon-filled`}),[f,j,E]),L=(0,i.useCallback)(e=>{v&&v(e),e.currentTarget.matches(`:focus-visible`)||e.currentTarget.blur()},[v]),R=(0,i.useCallback)(t=>{(0,s.default)(y)&&y(t),typeof e!=`boolean`&&P(e=>!e)},[y,e]),z={disabled:p,size:`small`,className:`slds-button__icon_stateful`},B=
|
|
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("../icon/button-icon/index.cjs"),r=require("../../utilities/get-aria-props.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime"),s=require("lodash.isfunction");s=e.__toESM(s,1);var c={icon:``},l={iconName:`add`,label:`Follow`},u={iconName:`check`,label:`Following`},d={iconName:`close`,label:`Unfollow`},f=({active:e,assistiveText:t,className:f,disabled:p=!1,icon:m,iconName:h,iconSize:g=`medium`,id:_,onBlur:v,onClick:y,onFocus:b,onKeyDown:x,onKeyPress:S,onKeyUp:C,onMouseDown:w,onMouseEnter:T,responsive:E=!1,stateOne:D=l,stateTwo:O=u,stateThree:k=d,tabIndex:A,variant:j,...M})=>{let[N,P]=(0,i.useState)(!1),F=typeof e==`boolean`?e:N,I=(0,i.useCallback)(e=>(0,a.default)(f,`slds-button`,`slds-button_stateful`,{"slds-button_neutral":j!==`icon`&&j!==`icon-filled`&&j!==`success`&&j!==`text`,"slds-button_inverse":j===`inverse`,"slds-button_success":j===`success`,"slds-not-selected":!e,"slds-is-selected":e,"slds-max-small-button_stretch":E,"slds-button_icon-border":j===`icon`,"slds-button_icon-border-filled":j===`icon-filled`}),[f,j,E]),L=(0,i.useCallback)(e=>{v&&v(e),e.currentTarget.matches(`:focus-visible`)||e.currentTarget.blur()},[v]),R=(0,i.useCallback)(t=>{(0,s.default)(y)&&y(t),typeof e!=`boolean`&&P(e=>!e)},[y,e]),z={disabled:p,size:`small`,className:`slds-button__icon_stateful`},B={...c,...t}.icon,V=r.default(M);if(j===`icon`||j===`icon-filled`)return Object.keys(V).length===0&&(V={"aria-live":`polite`}),(0,o.jsxs)(`button`,{...V,className:I(F),disabled:p,id:_,onBlur:L,onClick:R,onFocus:b,onKeyDown:x,onKeyPress:S,onKeyUp:C,onMouseDown:w,onMouseEnter:T,onMouseLeave:L,tabIndex:A?parseInt(A,10):void 0,type:`button`,children:[m?i.default.cloneElement(m,{...z,...m.props||{}}):(0,o.jsx)(n.default,{disabled:p,name:h,size:g,className:`slds-button__icon_stateful`}),B?(0,o.jsx)(`span`,{className:`slds-assistive-text`,children:B}):null]});let H={...z,position:`left`};return Object.keys(V).length===0&&(V={"aria-live":`assertive`}),(0,o.jsxs)(`button`,{...V,className:I(F),disabled:p,id:_,onBlur:L,onClick:R,onFocus:b,onKeyDown:x,onKeyPress:S,onKeyUp:C,onMouseEnter:T,onMouseLeave:L,tabIndex:A?parseInt(A,10):void 0,type:`button`,children:[(0,o.jsxs)(`span`,{className:`slds-text-not-selected`,children:[D.icon?i.default.cloneElement(D.icon,{...H,...D.icon.props||{},size:`small`}):(0,o.jsx)(n.default,{disabled:p,name:D.iconName,size:`small`,position:`left`,className:`slds-button__icon_stateful`}),D.label]}),(0,o.jsxs)(`span`,{className:`slds-text-selected`,children:[O.icon?i.default.cloneElement(O.icon,{...H,...O.icon.props||{},size:`small`}):(0,o.jsx)(n.default,{disabled:p,name:O.iconName,size:`small`,position:`left`,className:`slds-button__icon_stateful`}),O.label]}),(0,o.jsxs)(`span`,{className:`slds-text-selected-focus`,children:[k.icon?i.default.cloneElement(k.icon,{...H,...k.icon.props||{},size:`small`}):(0,o.jsx)(n.default,{disabled:p,name:k.iconName,size:`small`,position:`left`,className:`slds-button__icon_stateful`}),k.label]})]})};f.displayName=t.BUTTON_STATEFUL,exports.default=f;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/button-stateful/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 React, {\n\tuseState,\n\tuseCallback,\n\ttype ReactNode,\n\ttype MouseEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n} from 'react';\nimport classNames from 'classnames';\nimport isFunction from 'lodash.isfunction';\n\nimport ButtonIcon from '../icon/button-icon';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport { BUTTON_STATEFUL } from '../../utilities/constants';\n\n/**\n * Button stateful variant types\n */\nexport type ButtonStatefulVariant =\n\t| 'base'\n\t| 'neutral'\n\t| 'brand'\n\t| 'destructive'\n\t| 'icon'\n\t| 'icon-filled'\n\t| 'inverse'\n\t| 'success'\n\t| 'text';\n\n/**\n * State configuration for stateful button\n */\nexport interface ButtonStatefulState {\n\t/** Icon component or icon name */\n\ticon?: ReactNode;\n\t/** Icon name (if not using icon prop) */\n\ticonName?: string;\n\t/** Button label */\n\tlabel?: string;\n}\n\n/**\n * Assistive text for ButtonStateful\n */\nexport interface ButtonStatefulAssistiveText {\n\t/** Text for icon */\n\ticon?: string;\n}\n\n/**\n * Props for the ButtonStateful component\n */\nexport interface ButtonStatefulProps {\n\t/** Controlled active state */\n\tactive?: boolean;\n\t/** Assistive text */\n\tassistiveText?: ButtonStatefulAssistiveText | string;\n\t/** CSS classes */\n\tclassName?: string;\n\t/** Disabled state */\n\tdisabled?: boolean;\n\t/** Icon component */\n\ticon?: ReactNode;\n\t/** Icon name */\n\ticonName?: string;\n\t/** Icon size */\n\ticonSize?: string;\n\t/** HTML id */\n\tid?: string;\n\t/** Blur handler */\n\tonBlur?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Click handler */\n\tonClick?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Focus handler */\n\tonFocus?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Key down handler */\n\tonKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Key press handler */\n\tonKeyPress?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Key up handler */\n\tonKeyUp?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Mouse down handler */\n\tonMouseDown?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse enter handler */\n\tonMouseEnter?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Scale to full width on small screens */\n\tresponsive?: boolean;\n\t/** Initial/unselected state */\n\tstateOne?: ButtonStatefulState;\n\t/** Selected state */\n\tstateTwo?: ButtonStatefulState;\n\t/** Deselect/hover state */\n\tstateThree?: ButtonStatefulState;\n\t/** Tab index */\n\ttabIndex?: string;\n\t/** Button variant. `text` renders a stateful button with no border or background. */\n\tvariant?: ButtonStatefulVariant;\n}\n\nconst defaultAssistiveText: ButtonStatefulAssistiveText = { icon: '' };\n\nconst defaultStateOne: ButtonStatefulState = {\n\ticonName: 'add',\n\tlabel: 'Follow',\n};\nconst defaultStateTwo: ButtonStatefulState = {\n\ticonName: 'check',\n\tlabel: 'Following',\n};\nconst defaultStateThree: ButtonStatefulState = {\n\ticonName: 'close',\n\tlabel: 'Unfollow',\n};\n\n/**\n * The ButtonStateful component is a variant of the Lightning Design System Button component.\n * It is used for buttons that have a state of unselected or selected.\n */\nconst ButtonStateful = ({\n\tactive: controlledActive,\n\tassistiveText: propAssistiveText,\n\tclassName,\n\tdisabled = false,\n\ticon,\n\ticonName,\n\ticonSize = 'medium',\n\tid,\n\tonBlur,\n\tonClick,\n\tonFocus,\n\tonKeyDown,\n\tonKeyPress,\n\tonKeyUp,\n\tonMouseDown,\n\tonMouseEnter,\n\tresponsive = false,\n\tstateOne = defaultStateOne,\n\tstateTwo = defaultStateTwo,\n\tstateThree = defaultStateThree,\n\ttabIndex,\n\tvariant,\n\t...rest\n}: ButtonStatefulProps): React.ReactElement => {\n\tconst [internalActive, setInternalActive] = useState(false);\n\n\tconst isActive =\n\t\ttypeof controlledActive === 'boolean' ? controlledActive : internalActive;\n\n\tconst getClassName = useCallback(\n\t\t(active: boolean) =>\n\t\t\tclassNames(className, 'slds-button', 'slds-button_stateful', {\n\t\t\t\t'slds-button_neutral':\n\t\t\t\t\tvariant !== 'icon' &&\n\t\t\t\t\tvariant !== 'icon-filled' &&\n\t\t\t\t\tvariant !== 'success' &&\n\t\t\t\t\tvariant !== 'text',\n\t\t\t\t'slds-button_inverse': variant === 'inverse',\n\t\t\t\t'slds-button_success': variant === 'success',\n\t\t\t\t'slds-not-selected': !active,\n\t\t\t\t'slds-is-selected': active,\n\t\t\t\t'slds-max-small-button_stretch': responsive,\n\t\t\t\t'slds-button_icon-border': variant === 'icon',\n\t\t\t\t'slds-button_icon-border-filled': variant === 'icon-filled',\n\t\t\t}),\n\t\t[className, variant, responsive]\n\t);\n\n\tconst handleBlur = useCallback(\n\t\t(e: FocusEvent<HTMLButtonElement> | MouseEvent<HTMLButtonElement>) => {\n\t\t\tif (onBlur) onBlur(e as FocusEvent<HTMLButtonElement>);\n\t\t\t// SLDS shows `slds-text-selected-focus` on `.slds-is-selected:focus`, so\n\t\t\t// drop focus left behind by a mouse click. Keyboard focus is\n\t\t\t// `:focus-visible` and stays put.\n\t\t\tif (!e.currentTarget.matches(':focus-visible')) e.currentTarget.blur();\n\t\t},\n\t\t[onBlur]\n\t);\n\n\tconst handleClick = useCallback(\n\t\t(e: MouseEvent<HTMLButtonElement>) => {\n\t\t\tif (isFunction(onClick)) onClick(e);\n\t\t\tif (typeof controlledActive !== 'boolean') {\n\t\t\t\tsetInternalActive((prev) => !prev);\n\t\t\t}\n\t\t},\n\t\t[onClick, controlledActive]\n\t);\n\n\tconst defaultIconProps = {\n\t\tdisabled,\n\t\tsize: 'small' as const,\n\t\tclassName: 'slds-button__icon_stateful',\n\t};\n\n\tconst iconAssistiveText =\n\t\ttypeof propAssistiveText === 'string'\n\t\t\t? propAssistiveText\n\t\t\t: { ...defaultAssistiveText, ...propAssistiveText }.icon;\n\n\t// Accept aria-* props\n\tlet ariaProps = getAriaProps(rest);\n\n\tif (variant === 'icon' || variant === 'icon-filled') {\n\t\tif (Object.keys(ariaProps).length === 0) {\n\t\t\tariaProps = { 'aria-live': 'polite' as const };\n\t\t}\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\t{...ariaProps}\n\t\t\t\tclassName={getClassName(isActive)}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tid={id}\n\t\t\t\tonBlur={handleBlur}\n\t\t\t\tonClick={handleClick}\n\t\t\t\tonFocus={onFocus}\n\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\tonKeyPress={onKeyPress}\n\t\t\t\tonKeyUp={onKeyUp}\n\t\t\t\tonMouseDown={onMouseDown}\n\t\t\t\tonMouseEnter={onMouseEnter}\n\t\t\t\tonMouseLeave={handleBlur}\n\t\t\t\ttabIndex={tabIndex ? parseInt(tabIndex, 10) : undefined}\n\t\t\t\ttype=\"button\"\n\t\t\t>\n\t\t\t\t{icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\ticon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconProps,\n\t\t\t\t\t\t\t...((icon as React.ReactElement<Record<string, unknown>>).props ||\n\t\t\t\t\t\t\t\t{}),\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tname={iconName}\n\t\t\t\t\t\tsize={iconSize as 'x-small' | 'small' | 'medium' | 'large'}\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{iconAssistiveText ? (\n\t\t\t\t\t<span className=\"slds-assistive-text\">{iconAssistiveText}</span>\n\t\t\t\t) : null}\n\t\t\t</button>\n\t\t);\n\t}\n\n\tconst defaultIconPropsWithPosition = {\n\t\t...defaultIconProps,\n\t\tposition: 'left' as const,\n\t};\n\n\tif (Object.keys(ariaProps).length === 0) {\n\t\tariaProps = { 'aria-live': 'assertive' as const };\n\t}\n\n\treturn (\n\t\t<button\n\t\t\t{...ariaProps}\n\t\t\tclassName={getClassName(isActive)}\n\t\t\tdisabled={disabled}\n\t\t\tid={id}\n\t\t\tonBlur={handleBlur}\n\t\t\tonClick={handleClick}\n\t\t\tonFocus={onFocus}\n\t\t\tonKeyDown={onKeyDown}\n\t\t\tonKeyPress={onKeyPress}\n\t\t\tonKeyUp={onKeyUp}\n\t\t\tonMouseEnter={onMouseEnter}\n\t\t\tonMouseLeave={handleBlur}\n\t\t\ttabIndex={tabIndex ? parseInt(tabIndex, 10) : undefined}\n\t\t\ttype=\"button\"\n\t\t>\n\t\t\t<span className=\"slds-text-not-selected\">\n\t\t\t\t{stateOne.icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\tstateOne.icon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconPropsWithPosition,\n\t\t\t\t\t\t\t...((stateOne.icon as React.ReactElement<Record<string, unknown>>)\n\t\t\t\t\t\t\t\t.props || {}),\n\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tname={stateOne.iconName}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tposition=\"left\"\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{stateOne.label}\n\t\t\t</span>\n\t\t\t<span className=\"slds-text-selected\">\n\t\t\t\t{stateTwo.icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\tstateTwo.icon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconPropsWithPosition,\n\t\t\t\t\t\t\t...((stateTwo.icon as React.ReactElement<Record<string, unknown>>)\n\t\t\t\t\t\t\t\t.props || {}),\n\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tname={stateTwo.iconName}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tposition=\"left\"\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{stateTwo.label}\n\t\t\t</span>\n\t\t\t<span className=\"slds-text-selected-focus\">\n\t\t\t\t{stateThree.icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\tstateThree.icon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconPropsWithPosition,\n\t\t\t\t\t\t\t...((\n\t\t\t\t\t\t\t\tstateThree.icon as React.ReactElement<Record<string, unknown>>\n\t\t\t\t\t\t\t).props || {}),\n\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tname={stateThree.iconName}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tposition=\"left\"\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{stateThree.label}\n\t\t\t</span>\n\t\t</button>\n\t);\n};\n\nButtonStateful.displayName = BUTTON_STATEFUL;\n\nexport default ButtonStateful;\n"],"mappings":"qcAsGA,IAAM,EAAoD,CAAE,KAAM,EAAG,EAE/D,EAAuC,CAC5C,SAAU,MACV,MAAO,QACR,EACM,EAAuC,CAC5C,SAAU,QACV,MAAO,WACR,EACM,EAAyC,CAC9C,SAAU,QACV,MAAO,UACR,EAMM,GAAkB,CACvB,OAAQ,EACR,cAAe,EACf,YACA,WAAW,GAC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D,GAEA,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACW,WACV,KAAM,EAAS,SACf,KAAK,QACL,SAAS,OACT,UAAU,4BACV,CAAA,EAED,EAAS,KACL,KACN,EAAA,EAAA,KAAA,CAAC,OAAD,CAAM,UAAU,2BAAhB,SAAA,CACE,EAAW,KACX,EAAA,QAAM,aACL,EAAW,KACX,CACC,GAAG,EACH,GACC,EAAW,KACV,OAAS,CAAC,EACZ,KAAM,OACP,CACD,GAEA,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACW,WACV,KAAM,EAAW,SACjB,KAAK,QACL,SAAS,OACT,UAAU,4BACV,CAAA,EAED,EAAW,KACP,GACC,GAEV,EAEA,EAAe,YAAc,EAAA"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/button-stateful/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 React, {\n\tuseState,\n\tuseCallback,\n\ttype ReactNode,\n\ttype MouseEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n} from 'react';\nimport classNames from 'classnames';\nimport isFunction from 'lodash.isfunction';\n\nimport ButtonIcon from '../icon/button-icon';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport { BUTTON_STATEFUL } from '../../utilities/constants';\n\n/**\n * Button stateful variant types\n */\nexport type ButtonStatefulVariant =\n\t| 'base'\n\t| 'neutral'\n\t| 'brand'\n\t| 'destructive'\n\t| 'icon'\n\t| 'icon-filled'\n\t| 'inverse'\n\t| 'success'\n\t| 'text';\n\n/**\n * State configuration for stateful button\n */\nexport interface ButtonStatefulState {\n\t/** Icon component or icon name */\n\ticon?: ReactNode;\n\t/** Icon name (if not using icon prop) */\n\ticonName?: string;\n\t/** Button label */\n\tlabel?: string;\n}\n\n/**\n * Assistive text for ButtonStateful\n */\nexport interface ButtonStatefulAssistiveText {\n\t/** Text for icon */\n\ticon?: string;\n}\n\n/**\n * Props for the ButtonStateful component\n */\nexport interface ButtonStatefulProps {\n\t/** Controlled active state */\n\tactive?: boolean;\n\t/** Assistive text */\n\tassistiveText?: ButtonStatefulAssistiveText;\n\t/** CSS classes */\n\tclassName?: string;\n\t/** Disabled state */\n\tdisabled?: boolean;\n\t/** Icon component */\n\ticon?: ReactNode;\n\t/** Icon name */\n\ticonName?: string;\n\t/** Icon size */\n\ticonSize?: string;\n\t/** HTML id */\n\tid?: string;\n\t/** Blur handler */\n\tonBlur?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Click handler */\n\tonClick?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Focus handler */\n\tonFocus?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Key down handler */\n\tonKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Key press handler */\n\tonKeyPress?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Key up handler */\n\tonKeyUp?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Mouse down handler */\n\tonMouseDown?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse enter handler */\n\tonMouseEnter?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Scale to full width on small screens */\n\tresponsive?: boolean;\n\t/** Initial/unselected state */\n\tstateOne?: ButtonStatefulState;\n\t/** Selected state */\n\tstateTwo?: ButtonStatefulState;\n\t/** Deselect/hover state */\n\tstateThree?: ButtonStatefulState;\n\t/** Tab index */\n\ttabIndex?: string;\n\t/** Button variant. `text` renders a stateful button with no border or background. */\n\tvariant?: ButtonStatefulVariant;\n}\n\nconst defaultAssistiveText: ButtonStatefulAssistiveText = { icon: '' };\n\nconst defaultStateOne: ButtonStatefulState = {\n\ticonName: 'add',\n\tlabel: 'Follow',\n};\nconst defaultStateTwo: ButtonStatefulState = {\n\ticonName: 'check',\n\tlabel: 'Following',\n};\nconst defaultStateThree: ButtonStatefulState = {\n\ticonName: 'close',\n\tlabel: 'Unfollow',\n};\n\n/**\n * The ButtonStateful component is a variant of the Lightning Design System Button component.\n * It is used for buttons that have a state of unselected or selected.\n */\nconst ButtonStateful = ({\n\tactive: controlledActive,\n\tassistiveText: propAssistiveText,\n\tclassName,\n\tdisabled = false,\n\ticon,\n\ticonName,\n\ticonSize = 'medium',\n\tid,\n\tonBlur,\n\tonClick,\n\tonFocus,\n\tonKeyDown,\n\tonKeyPress,\n\tonKeyUp,\n\tonMouseDown,\n\tonMouseEnter,\n\tresponsive = false,\n\tstateOne = defaultStateOne,\n\tstateTwo = defaultStateTwo,\n\tstateThree = defaultStateThree,\n\ttabIndex,\n\tvariant,\n\t...rest\n}: ButtonStatefulProps): React.ReactElement => {\n\tconst [internalActive, setInternalActive] = useState(false);\n\n\tconst isActive =\n\t\ttypeof controlledActive === 'boolean' ? controlledActive : internalActive;\n\n\tconst getClassName = useCallback(\n\t\t(active: boolean) =>\n\t\t\tclassNames(className, 'slds-button', 'slds-button_stateful', {\n\t\t\t\t'slds-button_neutral':\n\t\t\t\t\tvariant !== 'icon' &&\n\t\t\t\t\tvariant !== 'icon-filled' &&\n\t\t\t\t\tvariant !== 'success' &&\n\t\t\t\t\tvariant !== 'text',\n\t\t\t\t'slds-button_inverse': variant === 'inverse',\n\t\t\t\t'slds-button_success': variant === 'success',\n\t\t\t\t'slds-not-selected': !active,\n\t\t\t\t'slds-is-selected': active,\n\t\t\t\t'slds-max-small-button_stretch': responsive,\n\t\t\t\t'slds-button_icon-border': variant === 'icon',\n\t\t\t\t'slds-button_icon-border-filled': variant === 'icon-filled',\n\t\t\t}),\n\t\t[className, variant, responsive]\n\t);\n\n\tconst handleBlur = useCallback(\n\t\t(e: FocusEvent<HTMLButtonElement> | MouseEvent<HTMLButtonElement>) => {\n\t\t\tif (onBlur) onBlur(e as FocusEvent<HTMLButtonElement>);\n\t\t\t// SLDS shows `slds-text-selected-focus` on `.slds-is-selected:focus`, so\n\t\t\t// drop focus left behind by a mouse click. Keyboard focus is\n\t\t\t// `:focus-visible` and stays put.\n\t\t\tif (!e.currentTarget.matches(':focus-visible')) e.currentTarget.blur();\n\t\t},\n\t\t[onBlur]\n\t);\n\n\tconst handleClick = useCallback(\n\t\t(e: MouseEvent<HTMLButtonElement>) => {\n\t\t\tif (isFunction(onClick)) onClick(e);\n\t\t\tif (typeof controlledActive !== 'boolean') {\n\t\t\t\tsetInternalActive((prev) => !prev);\n\t\t\t}\n\t\t},\n\t\t[onClick, controlledActive]\n\t);\n\n\tconst defaultIconProps = {\n\t\tdisabled,\n\t\tsize: 'small' as const,\n\t\tclassName: 'slds-button__icon_stateful',\n\t};\n\n\tconst iconAssistiveText = { ...defaultAssistiveText, ...propAssistiveText }\n\t\t.icon;\n\n\t// Accept aria-* props\n\tlet ariaProps = getAriaProps(rest);\n\n\tif (variant === 'icon' || variant === 'icon-filled') {\n\t\tif (Object.keys(ariaProps).length === 0) {\n\t\t\tariaProps = { 'aria-live': 'polite' as const };\n\t\t}\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\t{...ariaProps}\n\t\t\t\tclassName={getClassName(isActive)}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tid={id}\n\t\t\t\tonBlur={handleBlur}\n\t\t\t\tonClick={handleClick}\n\t\t\t\tonFocus={onFocus}\n\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\tonKeyPress={onKeyPress}\n\t\t\t\tonKeyUp={onKeyUp}\n\t\t\t\tonMouseDown={onMouseDown}\n\t\t\t\tonMouseEnter={onMouseEnter}\n\t\t\t\tonMouseLeave={handleBlur}\n\t\t\t\ttabIndex={tabIndex ? parseInt(tabIndex, 10) : undefined}\n\t\t\t\ttype=\"button\"\n\t\t\t>\n\t\t\t\t{icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\ticon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconProps,\n\t\t\t\t\t\t\t...((icon as React.ReactElement<Record<string, unknown>>).props ||\n\t\t\t\t\t\t\t\t{}),\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tname={iconName}\n\t\t\t\t\t\tsize={iconSize as 'x-small' | 'small' | 'medium' | 'large'}\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{iconAssistiveText ? (\n\t\t\t\t\t<span className=\"slds-assistive-text\">{iconAssistiveText}</span>\n\t\t\t\t) : null}\n\t\t\t</button>\n\t\t);\n\t}\n\n\tconst defaultIconPropsWithPosition = {\n\t\t...defaultIconProps,\n\t\tposition: 'left' as const,\n\t};\n\n\tif (Object.keys(ariaProps).length === 0) {\n\t\tariaProps = { 'aria-live': 'assertive' as const };\n\t}\n\n\treturn (\n\t\t<button\n\t\t\t{...ariaProps}\n\t\t\tclassName={getClassName(isActive)}\n\t\t\tdisabled={disabled}\n\t\t\tid={id}\n\t\t\tonBlur={handleBlur}\n\t\t\tonClick={handleClick}\n\t\t\tonFocus={onFocus}\n\t\t\tonKeyDown={onKeyDown}\n\t\t\tonKeyPress={onKeyPress}\n\t\t\tonKeyUp={onKeyUp}\n\t\t\tonMouseEnter={onMouseEnter}\n\t\t\tonMouseLeave={handleBlur}\n\t\t\ttabIndex={tabIndex ? parseInt(tabIndex, 10) : undefined}\n\t\t\ttype=\"button\"\n\t\t>\n\t\t\t<span className=\"slds-text-not-selected\">\n\t\t\t\t{stateOne.icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\tstateOne.icon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconPropsWithPosition,\n\t\t\t\t\t\t\t...((stateOne.icon as React.ReactElement<Record<string, unknown>>)\n\t\t\t\t\t\t\t\t.props || {}),\n\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tname={stateOne.iconName}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tposition=\"left\"\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{stateOne.label}\n\t\t\t</span>\n\t\t\t<span className=\"slds-text-selected\">\n\t\t\t\t{stateTwo.icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\tstateTwo.icon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconPropsWithPosition,\n\t\t\t\t\t\t\t...((stateTwo.icon as React.ReactElement<Record<string, unknown>>)\n\t\t\t\t\t\t\t\t.props || {}),\n\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tname={stateTwo.iconName}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tposition=\"left\"\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{stateTwo.label}\n\t\t\t</span>\n\t\t\t<span className=\"slds-text-selected-focus\">\n\t\t\t\t{stateThree.icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\tstateThree.icon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconPropsWithPosition,\n\t\t\t\t\t\t\t...((\n\t\t\t\t\t\t\t\tstateThree.icon as React.ReactElement<Record<string, unknown>>\n\t\t\t\t\t\t\t).props || {}),\n\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tname={stateThree.iconName}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tposition=\"left\"\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{stateThree.label}\n\t\t\t</span>\n\t\t</button>\n\t);\n};\n\nButtonStateful.displayName = BUTTON_STATEFUL;\n\nexport default ButtonStateful;\n"],"mappings":"qcAsGA,IAAM,EAAoD,CAAE,KAAM,EAAG,EAE/D,EAAuC,CAC5C,SAAU,MACV,MAAO,QACR,EACM,EAAuC,CAC5C,SAAU,QACV,MAAO,WACR,EACM,EAAyC,CAC9C,SAAU,QACV,MAAO,UACR,EAMM,GAAkB,CACvB,OAAQ,EACR,cAAe,EACf,YACA,WAAW,GACX,OACA,WACA,WAAW,SACX,KACA,SACA,UACA,UACA,YACA,aACA,UACA,cACA,eACA,aAAa,GACb,WAAW,EACX,WAAW,EACX,aAAa,EACb,WACA,UACA,GAAG,KAC2C,CAC9C,GAAM,CAAC,EAAgB,IAAA,EAAqB,EAAA,SAAA,CAAS,EAAK,EAEpD,EACL,OAAO,GAAqB,UAAY,EAAmB,EAEtD,GAAA,EAAe,EAAA,YAAA,CACnB,IAAA,EACA,EAAA,QAAA,CAAW,EAAW,cAAe,uBAAwB,CAC5D,sBACC,IAAY,QACZ,IAAY,eACZ,IAAY,WACZ,IAAY,OACb,sBAAuB,IAAY,UACnC,sBAAuB,IAAY,UACnC,oBAAqB,CAAC,EACtB,mBAAoB,EACpB,gCAAiC,EACjC,0BAA2B,IAAY,OACvC,iCAAkC,IAAY,aAC/C,CAAC,EACF,CAAC,EAAW,EAAS,CAAU,CAChC,EAEM,GAAA,EAAa,EAAA,YAAA,CACjB,GAAqE,CACjE,GAAQ,EAAO,CAAkC,EAIhD,EAAE,cAAc,QAAQ,gBAAgB,GAAG,EAAE,cAAc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U,EAAW,SAAS,EAAU,EAAE,EAAI,IAAA,GAC9C,KAAK,SAdN,SAAA,EAgBC,EAAA,EAAA,KAAA,CAAC,OAAD,CAAM,UAAU,yBAAhB,SAAA,CACE,EAAS,KACT,EAAA,QAAM,aACL,EAAS,KACT,CACC,GAAG,EACH,GAAK,EAAS,KACZ,OAAS,CAAC,EACZ,KAAM,OACP,CACD,GAEA,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACW,WACV,KAAM,EAAS,SACf,KAAK,QACL,SAAS,OACT,UAAU,4BACV,CAAA,EAED,EAAS,KACL,KACN,EAAA,EAAA,KAAA,CAAC,OAAD,CAAM,UAAU,qBAAhB,SAAA,CACE,EAAS,KACT,EAAA,QAAM,aACL,EAAS,KACT,CACC,GAAG,EACH,GAAK,EAAS,KACZ,OAAS,CAAC,EACZ,KAAM,OACP,CACD,GAEA,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACW,WACV,KAAM,EAAS,SACf,KAAK,QACL,SAAS,OACT,UAAU,4BACV,CAAA,EAED,EAAS,KACL,KACN,EAAA,EAAA,KAAA,CAAC,OAAD,CAAM,UAAU,2BAAhB,SAAA,CACE,EAAW,KACX,EAAA,QAAM,aACL,EAAW,KACX,CACC,GAAG,EACH,GACC,EAAW,KACV,OAAS,CAAC,EACZ,KAAM,OACP,CACD,GAEA,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACW,WACV,KAAM,EAAW,SACjB,KAAK,QACL,SAAS,OACT,UAAU,4BACV,CAAA,EAED,EAAW,KACP,GACC,GAEV,EAEA,EAAe,YAAc,EAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../utilities/constants.cjs"),t=require("../../utilities/event.cjs"),n=require("../../utilities/key-code.cjs"),r=require("../../utilities/execution-environment.cjs"),ee=require("../../utilities/class-names.cjs"),i=require("./private/carousel-indicators.cjs"),a=require("./private/previous-next-carousel-navigator.cjs"),o=require("./private/carousel-item.cjs"),s=require("./private/auto-play-button.cjs");let c=require("react"),l=require("react/jsx-runtime");var u={autoplayButton:`Start / Stop auto-play`,nextPanel:`Next Panel`,previousPanel:`Previous Panel`},d=({assistiveText:e,autoplayInterval:d=4e3,className:f,currentPanel:p,hasAutoplay:m=!1,hasPreviousNextPanelNavigation:h=!1,id:g,isAutoplayOn:_,isInfinite:v=!1,items:y,itemsPerPanel:b=1,onRenderItem:x,onRequestAutoplayToggle:S,onRequestPanelChange:C,onItemClick:w})=>{let T=(0,c.useId)(),E=g||T,D={...u,...e},O=(0,c.useMemo)(()=>Math.ceil(y.length/b),[y.length,b]),[k,A]=(0,c.useState)(p??0),[j,M]=(0,c.useState)(_??m),[N,P]=(0,c.useState)(!1),[F,I]=(0,c.useState)(0),[L,R]=(0,c.useState)(-1e6),z=(0,c.useRef)(null),B=(0,c.useRef)(null),V=(0,c.useRef)(0),H=p===void 0?k:p,U=_===void 0?j:_,W=(0,c.useCallback)(()=>H<O-1,[H,O]),G=(0,c.useCallback)(()=>H>0,[H]),K=(0,c.useCallback)(({carouselId:e,itemId:t})=>`content-id-${e}-${t}`,[]),q=(0,c.useCallback)(()=>{let e=F||V.current;R(-(e*H))},[F,H]),J=(0,c.useCallback)((e,t,n)=>{C?C(e,{currentPanel:H,requestedPanel:t}):(A(t),n&&setTimeout(n,0))},[H,C]),Y=(0,c.useCallback)((e,t=!1)=>{B.current&&=(clearInterval(B.current),null),t||(S?S(e,{isAutoplayOn
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../utilities/constants.cjs"),t=require("../../utilities/event.cjs"),n=require("../../utilities/key-code.cjs"),r=require("../../utilities/execution-environment.cjs"),ee=require("../../utilities/class-names.cjs"),i=require("./private/carousel-indicators.cjs"),a=require("./private/previous-next-carousel-navigator.cjs"),o=require("./private/carousel-item.cjs"),s=require("./private/auto-play-button.cjs");let c=require("react"),l=require("react/jsx-runtime");var u={autoplayButton:`Start / Stop auto-play`,nextPanel:`Next Panel`,previousPanel:`Previous Panel`},d=({assistiveText:e,autoplayInterval:d=4e3,className:f,currentPanel:p,hasAutoplay:m=!1,hasPreviousNextPanelNavigation:h=!1,id:g,isAutoplayOn:_,isInfinite:v=!1,items:y,itemsPerPanel:b=1,onRenderItem:x,onRequestAutoplayToggle:S,onRequestPanelChange:C,onItemClick:w})=>{let T=(0,c.useId)(),E=g||T,D={...u,...e},O=(0,c.useMemo)(()=>Math.ceil(y.length/b),[y.length,b]),[k,A]=(0,c.useState)(p??0),[j,M]=(0,c.useState)(_??m),[N,P]=(0,c.useState)(!1),[F,I]=(0,c.useState)(0),[L,R]=(0,c.useState)(-1e6),z=(0,c.useRef)(null),B=(0,c.useRef)(null),V=(0,c.useRef)(0),H=p===void 0?k:p,U=_===void 0?j:_,W=(0,c.useCallback)(()=>H<O-1,[H,O]),G=(0,c.useCallback)(()=>H>0,[H]),K=(0,c.useCallback)(({carouselId:e,itemId:t})=>`content-id-${e}-${t}`,[]),q=(0,c.useCallback)(()=>{let e=F||V.current;R(-(e*H))},[F,H]),J=(0,c.useCallback)((e,t,n)=>{C?C(e,{currentPanel:H,requestedPanel:t}):(A(t),n&&setTimeout(n,0))},[H,C]),Y=(0,c.useCallback)((e,t=!1)=>{B.current&&=(clearInterval(B.current),null),t||(S?S(e,{isAutoplayOn:!1}):M(!1))},[S]),X=(0,c.useCallback)(()=>{B.current=setInterval(()=>{if(H<O-1){let e=H+1;e>O-1&&(e=0),J(void 0,e,q)}else v?J(void 0,0,q):Y(void 0)},d)},[d,H,O,v,J,q,Y]),Z=(0,c.useCallback)(e=>{let t=H+1;t>O-1&&(t=0),J(e,t,q)},[H,O,J,q]),Q=(0,c.useCallback)(e=>{let t=H-1;t<0&&(t=O-1),J(e,t,q)},[H,O,J,q]),te=(0,c.useCallback)(()=>{P(!1)},[]),ne=(0,c.useCallback)((e,t)=>{J(e,t,q),P(!0),U&&Y(e)},[J,q,U,Y]),re=(0,c.useCallback)(e=>{P(!0),U&&Y(e)},[U,Y]),ie=(0,c.useCallback)(e=>{S?S(e,{isAutoplayOn:!U}):(M(!U),U?Y(e):X())},[U,S,Y,X]),ae=(0,c.useCallback)(e=>{let r={[n.default.LEFT]:()=>{(v||G())&&(Q(e),P(!0),U&&Y(e))},[n.default.RIGHT]:()=>{(v||W())&&(Z(e),P(!0),U&&Y(e))}};r[e.keyCode]&&(t.default.trapImmediate(e),r[e.keyCode]())},[v,G,W,Q,Z,U,Y]),$=(0,c.useCallback)(()=>{r.canUseDOM&&z.current?.offsetWidth!==void 0&&I(z.current.offsetWidth)},[]);(0,c.useEffect)(()=>(r.canUseDOM&&z.current?.offsetWidth!==void 0&&(V.current=z.current.offsetWidth,I(z.current.offsetWidth)),r.canUseEventListeners&&window.addEventListener(`resize`,$,!1),()=>{r.canUseEventListeners&&window.removeEventListener(`resize`,$,!1),B.current&&clearInterval(B.current)}),[$]),(0,c.useEffect)(()=>{q()},[q]),(0,c.useEffect)(()=>{_!==void 0&&(_&&!B.current?X():!_&&B.current&&Y(void 0,!0))},[_,X,Y]),(0,c.useEffect)(()=>{U&&!B.current&&X()},[]);let oe=!(v||G()),se=!(v||W()),ce=(F||V.current)/b,le=h?{marginLeft:`44px`,marginRight:`44px`}:{};return(0,l.jsx)(`div`,{className:ee.default(`slds-carousel`,f),id:E,onKeyDown:ae,children:(0,l.jsxs)(`div`,{className:`slds-grid_vertical slds-col slds-path__scroller`,children:[m&&(0,l.jsx)(s.default,{assistiveText:D.autoplayButton,isAutoplayOn:U,onClick:ie}),(0,l.jsxs)(`div`,{className:`slds-is-relative`,style:le,children:[h&&(0,l.jsx)(a.default,{assistiveText:D.previousPanel,iconName:`chevronleft`,isDisabled:oe,onClick:e=>{U&&Y(e),Q(e)},inlineStyle:{left:`-38px`}}),(0,l.jsx)(`div`,{ref:z,className:`slds-carousel__stage slds-show`,children:(0,l.jsx)(`div`,{className:`slds-carousel__panels slds-is-relative`,style:{transform:`translateX(${L}px)`},children:y.map((e,t)=>(0,l.jsx)(o.default,{carouselId:E,getPanelId:K,onClick:t=>{w?.(t,{item:e})},onFocus:e=>{U&&Y(e)},onRenderItem:x,...e,isInCurrentPanel:t>=H*b&&t<H*b+b,itemWidth:ce,panelIndex:Math.ceil((t+1)/b)-1},e.id))})}),h&&(0,l.jsx)(a.default,{assistiveText:D.nextPanel,iconName:`chevronright`,isDisabled:se,onClick:e=>{U&&Y(e),Z(e)},inlineStyle:{right:`-38px`}})]}),(0,l.jsx)(i.default,{noOfIndicators:O,carouselId:E,currentIndex:H,getPanelId:K,hasFocus:N,onBlur:te,onClick:ne,onFocus:re,items:y,itemsPerPanel:b})]})})};d.displayName=e.CAROUSEL,exports.default=d;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/carousel/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\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseCallback,\n\tuseId,\n\tuseMemo,\n\ttype KeyboardEvent,\n\ttype MouseEvent,\n\ttype FocusEvent,\n\ttype ReactElement,\n} from 'react';\nimport classNames from '../../utilities/class-names';\nimport { CAROUSEL } from '../../utilities/constants';\nimport {\n\tcanUseDOM,\n\tcanUseEventListeners,\n} from '../../utilities/execution-environment';\n\nimport CarouselIndicators from './private/carousel-indicators';\nimport PreviousNextCarouselNavigator from './private/previous-next-carousel-navigator';\nimport CarouselItem from './private/carousel-item';\nimport AutoplayButton from './private/auto-play-button';\n\nimport KEYS from '../../utilities/key-code';\nimport EventUtil from '../../utilities/event';\n\n/**\n * Carousel item data structure\n */\nexport interface CarouselItemData {\n\t/** Unique identifier for the item */\n\tid: string;\n\t/** Primary heading text */\n\theading?: string;\n\t/** Description text */\n\tdescription?: string;\n\t/** Button label for call to action */\n\tbuttonLabel?: string;\n\t/** Image alt text */\n\timageAssistiveText?: string;\n\t/** Link URL */\n\thref?: string;\n\t/** Image source URL */\n\tsrc?: string;\n}\n\n/**\n * Assistive text for Carousel\n */\nexport interface CarouselAssistiveText {\n\t/** Autoplay button assistive text */\n\tautoplayButton?: string;\n\t/** Next panel button assistive text */\n\tnextPanel?: string;\n\t/** Previous panel button assistive text */\n\tpreviousPanel?: string;\n}\n\n/**\n * Panel change event data\n */\nexport interface CarouselPanelChangeData {\n\t/** Current panel index */\n\tcurrentPanel: number;\n\t/** Requested panel index */\n\trequestedPanel: number;\n}\n\n/**\n * Autoplay toggle event data\n */\nexport interface CarouselAutoplayData {\n\t/** Current autoplay state */\n\tisAutoplayOn: boolean;\n}\n\n/**\n * Item click event data\n */\nexport interface CarouselItemClickData {\n\t/** The clicked item */\n\titem: CarouselItemData;\n}\n\n/**\n * Props for the Carousel component\n */\nexport interface CarouselProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: CarouselAssistiveText;\n\t/** Autoplay interval in milliseconds */\n\tautoplayInterval?: number;\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Controlled current panel index */\n\tcurrentPanel?: number;\n\t/** Show autoplay button */\n\thasAutoplay?: boolean;\n\t/** Show previous/next navigation buttons */\n\thasPreviousNextPanelNavigation?: boolean;\n\t/** HTML id */\n\tid?: string;\n\t/** Controlled autoplay state */\n\tisAutoplayOn?: boolean;\n\t/** Enable infinite loop navigation */\n\tisInfinite?: boolean;\n\t/** Array of carousel items */\n\titems: CarouselItemData[];\n\t/** Number of items per panel */\n\titemsPerPanel?: number;\n\t/** Custom item renderer */\n\tonRenderItem?: (item: CarouselItemData) => ReactElement;\n\t/** Called when autoplay toggle is requested */\n\tonRequestAutoplayToggle?: (\n\t\tevent: MouseEvent | KeyboardEvent | FocusEvent | Record<string, unknown>,\n\t\tdata: CarouselAutoplayData\n\t) => void;\n\t/** Called when panel change is requested */\n\tonRequestPanelChange?: (\n\t\tevent: MouseEvent | KeyboardEvent | FocusEvent | Record<string, unknown>,\n\t\tdata: CarouselPanelChangeData\n\t) => void;\n\t/** Called when an item is clicked */\n\tonItemClick?: (event: MouseEvent, data: CarouselItemClickData) => void;\n}\n\nconst defaultAssistiveText: CarouselAssistiveText = {\n\tautoplayButton: 'Start / Stop auto-play',\n\tnextPanel: 'Next Panel',\n\tpreviousPanel: 'Previous Panel',\n};\n\n/**\n * A carousel allows multiple pieces of featured content to occupy an allocated amount of space.\n */\nconst Carousel = ({\n\tassistiveText: propAssistiveText,\n\tautoplayInterval = 4000,\n\tclassName,\n\tcurrentPanel: controlledCurrentPanel,\n\thasAutoplay = false,\n\thasPreviousNextPanelNavigation = false,\n\tid: propId,\n\tisAutoplayOn: controlledIsAutoplayOn,\n\tisInfinite = false,\n\titems,\n\titemsPerPanel = 1,\n\tonRenderItem,\n\tonRequestAutoplayToggle,\n\tonRequestPanelChange,\n\tonItemClick,\n}: CarouselProps): ReactElement => {\n\tconst generatedId = useId();\n\tconst id = propId || generatedId;\n\n\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\n\t// Calculate number of panels\n\tconst nrOfPanels = useMemo(\n\t\t() => Math.ceil(items.length / itemsPerPanel),\n\t\t[items.length, itemsPerPanel]\n\t);\n\n\t// Internal state (for uncontrolled mode)\n\tconst [internalCurrentPanel, setInternalCurrentPanel] = useState(\n\t\tcontrolledCurrentPanel ?? 0\n\t);\n\tconst [internalIsAutoplayOn, setInternalIsAutoplayOn] = useState(\n\t\tcontrolledIsAutoplayOn ?? hasAutoplay\n\t);\n\tconst [indicatorsHaveFocus, setIndicatorsHaveFocus] = useState(false);\n\tconst [stageWidth, setStageWidth] = useState(0);\n\tconst [translateX, setTranslateX] = useState(-1000000);\n\n\t// Refs\n\tconst stageRef = useRef<HTMLDivElement>(null);\n\tconst autoplayIdRef = useRef<ReturnType<typeof setInterval> | null>(null);\n\tconst initialStageWidthRef = useRef<number>(0);\n\n\t// Derived state - use controlled values if provided\n\tconst currentPanel =\n\t\tcontrolledCurrentPanel !== undefined\n\t\t\t? controlledCurrentPanel\n\t\t\t: internalCurrentPanel;\n\tconst isAutoplayOn =\n\t\tcontrolledIsAutoplayOn !== undefined\n\t\t\t? controlledIsAutoplayOn\n\t\t\t: internalIsAutoplayOn;\n\n\t// Helper functions\n\tconst canGoToNext = useCallback(\n\t\t() => currentPanel < nrOfPanels - 1,\n\t\t[currentPanel, nrOfPanels]\n\t);\n\n\tconst canGoToPrevious = useCallback(() => currentPanel > 0, [currentPanel]);\n\n\tconst getPanelId = useCallback(\n\t\t({ carouselId, itemId }: { carouselId: string; itemId: string }) =>\n\t\t\t`content-id-${carouselId}-${itemId}`,\n\t\t[]\n\t);\n\n\t// Update translation based on current panel\n\tconst changeTranslationAutomatically = useCallback(() => {\n\t\tconst width = stageWidth || initialStageWidthRef.current;\n\t\tsetTranslateX(-(width * currentPanel));\n\t}, [stageWidth, currentPanel]);\n\n\t// Set current panel (internal or via callback)\n\tconst setCurrentPanel = useCallback(\n\t\t(\n\t\t\tevent: MouseEvent | KeyboardEvent | FocusEvent | Record<string, unknown>,\n\t\t\tpanel: number,\n\t\t\tcallback?: () => void\n\t\t) => {\n\t\t\tif (onRequestPanelChange) {\n\t\t\t\tonRequestPanelChange(event, {\n\t\t\t\t\tcurrentPanel,\n\t\t\t\t\trequestedPanel: panel,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tsetInternalCurrentPanel(panel);\n\t\t\t\t// Use setTimeout to ensure state is updated before callback\n\t\t\t\tif (callback) {\n\t\t\t\t\tsetTimeout(callback, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[currentPanel, onRequestPanelChange]\n\t);\n\n\t// Stop autoplay\n\tconst stopAutoplay = useCallback(\n\t\t(\n\t\t\tevent: MouseEvent | KeyboardEvent | FocusEvent | Record<string, unknown>,\n\t\t\tignoreCallbacksAndStateUpdates = false\n\t\t) => {\n\t\t\tif (autoplayIdRef.current) {\n\t\t\t\tclearInterval(autoplayIdRef.current);\n\t\t\t\tautoplayIdRef.current = null;\n\t\t\t}\n\n\t\t\tif (!ignoreCallbacksAndStateUpdates) {\n\t\t\t\tif (onRequestAutoplayToggle) {\n\t\t\t\t\tonRequestAutoplayToggle(event, { isAutoplayOn });\n\t\t\t\t} else {\n\t\t\t\t\tsetInternalIsAutoplayOn(false);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[isAutoplayOn, onRequestAutoplayToggle]\n\t);\n\n\t// Start autoplay\n\tconst startAutoplay = useCallback(\n\t\t(event: MouseEvent | KeyboardEvent | FocusEvent | Record<string, unknown>) => {\n\t\t\tautoplayIdRef.current = setInterval(() => {\n\t\t\t\tif (currentPanel < nrOfPanels - 1) {\n\t\t\t\t\t// Go to next panel\n\t\t\t\t\tlet next = currentPanel + 1;\n\t\t\t\t\tif (next > nrOfPanels - 1) {\n\t\t\t\t\t\tnext = 0;\n\t\t\t\t\t}\n\t\t\t\t\tsetCurrentPanel(event, next, changeTranslationAutomatically);\n\t\t\t\t} else if (isInfinite) {\n\t\t\t\t\t// Loop back to start\n\t\t\t\t\tsetCurrentPanel(event, 0, changeTranslationAutomatically);\n\t\t\t\t} else {\n\t\t\t\t\t// Stop at end\n\t\t\t\t\tstopAutoplay(event);\n\t\t\t\t}\n\t\t\t}, autoplayInterval);\n\t\t},\n\t\t[\n\t\t\tautoplayInterval,\n\t\t\tcurrentPanel,\n\t\t\tnrOfPanels,\n\t\t\tisInfinite,\n\t\t\tsetCurrentPanel,\n\t\t\tchangeTranslationAutomatically,\n\t\t\tstopAutoplay,\n\t\t]\n\t);\n\n\t// Panel navigation handlers\n\tconst onNextPanelHandler = useCallback(\n\t\t(event: MouseEvent | KeyboardEvent) => {\n\t\t\tlet next = currentPanel + 1;\n\t\t\tif (next > nrOfPanels - 1) {\n\t\t\t\tnext = 0;\n\t\t\t}\n\t\t\tsetCurrentPanel(event, next, changeTranslationAutomatically);\n\t\t},\n\t\t[currentPanel, nrOfPanels, setCurrentPanel, changeTranslationAutomatically]\n\t);\n\n\tconst onPreviousPanelHandler = useCallback(\n\t\t(event: MouseEvent | KeyboardEvent) => {\n\t\t\tlet prev = currentPanel - 1;\n\t\t\tif (prev < 0) {\n\t\t\t\tprev = nrOfPanels - 1;\n\t\t\t}\n\t\t\tsetCurrentPanel(event, prev, changeTranslationAutomatically);\n\t\t},\n\t\t[currentPanel, nrOfPanels, setCurrentPanel, changeTranslationAutomatically]\n\t);\n\n\t// Indicator handlers\n\tconst onIndicatorBlur = useCallback(() => {\n\t\tsetIndicatorsHaveFocus(false);\n\t}, []);\n\n\tconst onIndicatorClickHandler = useCallback(\n\t\t(event: MouseEvent, panel: number) => {\n\t\t\tsetCurrentPanel(event, panel, changeTranslationAutomatically);\n\t\t\tsetIndicatorsHaveFocus(true);\n\t\t\tif (isAutoplayOn) {\n\t\t\t\tstopAutoplay(event);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tsetCurrentPanel,\n\t\t\tchangeTranslationAutomatically,\n\t\t\tisAutoplayOn,\n\t\t\tstopAutoplay,\n\t\t]\n\t);\n\n\tconst onIndicatorFocus = useCallback(\n\t\t(event: FocusEvent) => {\n\t\t\tsetIndicatorsHaveFocus(true);\n\t\t\tif (isAutoplayOn) {\n\t\t\t\tstopAutoplay(event);\n\t\t\t}\n\t\t},\n\t\t[isAutoplayOn, stopAutoplay]\n\t);\n\n\t// Autoplay button handler\n\tconst onAutoplayBtnClick = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tif (onRequestAutoplayToggle) {\n\t\t\t\tonRequestAutoplayToggle(event, { isAutoplayOn });\n\t\t\t} else {\n\t\t\t\tconst actionToTake = isAutoplayOn ? stopAutoplay : startAutoplay;\n\t\t\t\tsetInternalIsAutoplayOn(!isAutoplayOn);\n\t\t\t\tactionToTake(event);\n\t\t\t}\n\t\t},\n\t\t[isAutoplayOn, onRequestAutoplayToggle, stopAutoplay, startAutoplay]\n\t);\n\n\t// Keyboard handler\n\tconst handleKeyDown = useCallback(\n\t\t(event: KeyboardEvent<HTMLDivElement>) => {\n\t\t\tconst keyDownCallbacks: Record<number, () => void> = {\n\t\t\t\t[KEYS.LEFT]: () => {\n\t\t\t\t\tif (isInfinite || canGoToPrevious()) {\n\t\t\t\t\t\tonPreviousPanelHandler(event);\n\t\t\t\t\t\tsetIndicatorsHaveFocus(true);\n\t\t\t\t\t\tif (isAutoplayOn) {\n\t\t\t\t\t\t\tstopAutoplay(event);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t[KEYS.RIGHT]: () => {\n\t\t\t\t\tif (isInfinite || canGoToNext()) {\n\t\t\t\t\t\tonNextPanelHandler(event);\n\t\t\t\t\t\tsetIndicatorsHaveFocus(true);\n\t\t\t\t\t\tif (isAutoplayOn) {\n\t\t\t\t\t\t\tstopAutoplay(event);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tif (keyDownCallbacks[event.keyCode]) {\n\t\t\t\tEventUtil.trapImmediate(event);\n\t\t\t\tkeyDownCallbacks[event.keyCode]();\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tisInfinite,\n\t\t\tcanGoToPrevious,\n\t\t\tcanGoToNext,\n\t\t\tonPreviousPanelHandler,\n\t\t\tonNextPanelHandler,\n\t\t\tisAutoplayOn,\n\t\t\tstopAutoplay,\n\t\t]\n\t);\n\n\t// Set dimensions on resize\n\tconst setDimensions = useCallback(() => {\n\t\tif (canUseDOM && stageRef.current?.offsetWidth !== undefined) {\n\t\t\tsetStageWidth(stageRef.current.offsetWidth);\n\t\t}\n\t}, []);\n\n\t// Effect: Mount - measure stage width and set up resize listener\n\tuseEffect(() => {\n\t\tif (canUseDOM && stageRef.current?.offsetWidth !== undefined) {\n\t\t\tinitialStageWidthRef.current = stageRef.current.offsetWidth;\n\t\t\tsetStageWidth(stageRef.current.offsetWidth);\n\t\t}\n\n\t\tif (canUseEventListeners) {\n\t\t\twindow.addEventListener('resize', setDimensions, false);\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (canUseEventListeners) {\n\t\t\t\twindow.removeEventListener('resize', setDimensions, false);\n\t\t\t}\n\t\t\t// Clean up autoplay on unmount\n\t\t\tif (autoplayIdRef.current) {\n\t\t\t\tclearInterval(autoplayIdRef.current);\n\t\t\t}\n\t\t};\n\t}, [setDimensions]);\n\n\t// Effect: Update translation when currentPanel or stageWidth changes\n\tuseEffect(() => {\n\t\tchangeTranslationAutomatically();\n\t}, [changeTranslationAutomatically]);\n\n\t// Effect: Handle autoplay state changes (controlled mode)\n\tuseEffect(() => {\n\t\tif (controlledIsAutoplayOn !== undefined) {\n\t\t\tif (controlledIsAutoplayOn && !autoplayIdRef.current) {\n\t\t\t\tstartAutoplay({});\n\t\t\t} else if (!controlledIsAutoplayOn && autoplayIdRef.current) {\n\t\t\t\tstopAutoplay({}, true);\n\t\t\t}\n\t\t}\n\t}, [controlledIsAutoplayOn, startAutoplay, stopAutoplay]);\n\n\t// Effect: Start autoplay on mount if enabled\n\tuseEffect(() => {\n\t\tif (isAutoplayOn && !autoplayIdRef.current) {\n\t\t\tstartAutoplay({});\n\t\t}\n\t\t// Only run on mount\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\t// Computed values\n\tconst isPreviousBtnDisabled = !(isInfinite || canGoToPrevious());\n\tconst isNextBtnDisabled = !(isInfinite || canGoToNext());\n\tconst itemWidth = (stageWidth || initialStageWidthRef.current) / itemsPerPanel;\n\tconst carouselMargins = hasPreviousNextPanelNavigation\n\t\t? { marginLeft: '44px', marginRight: '44px' }\n\t\t: {};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames('slds-carousel', className as string)}\n\t\t\tid={id}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t>\n\t\t\t<div className=\"slds-grid_vertical slds-col slds-path__scroller\">\n\t\t\t\t{hasAutoplay && (\n\t\t\t\t\t<AutoplayButton\n\t\t\t\t\t\tassistiveText={assistiveText.autoplayButton}\n\t\t\t\t\t\tisAutoplayOn={isAutoplayOn}\n\t\t\t\t\t\tonClick={onAutoplayBtnClick}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<div className=\"slds-is-relative\" style={carouselMargins}>\n\t\t\t\t\t{hasPreviousNextPanelNavigation && (\n\t\t\t\t\t\t<PreviousNextCarouselNavigator\n\t\t\t\t\t\t\tassistiveText={assistiveText.previousPanel}\n\t\t\t\t\t\t\ticonName=\"chevronleft\"\n\t\t\t\t\t\t\tisDisabled={isPreviousBtnDisabled}\n\t\t\t\t\t\t\tonClick={(event: MouseEvent) => {\n\t\t\t\t\t\t\t\tif (isAutoplayOn) {\n\t\t\t\t\t\t\t\t\tstopAutoplay(event);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonPreviousPanelHandler(event);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tinlineStyle={{ left: '-38px' }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t<div ref={stageRef} className=\"slds-carousel__stage slds-show\">\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"slds-carousel__panels slds-is-relative\"\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\ttransform: `translateX(${translateX}px)`,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{items.map((item, index) => (\n\t\t\t\t\t\t\t\t<CarouselItem\n\t\t\t\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\t\t\t\tcarouselId={id}\n\t\t\t\t\t\t\t\t\tgetPanelId={getPanelId}\n\t\t\t\t\t\t\t\t\tonClick={(event: MouseEvent) => {\n\t\t\t\t\t\t\t\t\t\tonItemClick?.(event, { item });\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonFocus={(event: FocusEvent) => {\n\t\t\t\t\t\t\t\t\t\tif (isAutoplayOn) {\n\t\t\t\t\t\t\t\t\t\t\tstopAutoplay(event);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonRenderItem={onRenderItem}\n\t\t\t\t\t\t\t\t\t{...item}\n\t\t\t\t\t\t\t\t\tisInCurrentPanel={\n\t\t\t\t\t\t\t\t\t\tindex >= currentPanel * itemsPerPanel &&\n\t\t\t\t\t\t\t\t\t\tindex < currentPanel * itemsPerPanel + itemsPerPanel\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\titemWidth={itemWidth}\n\t\t\t\t\t\t\t\t\tpanelIndex={Math.ceil((index + 1) / itemsPerPanel) - 1}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t{hasPreviousNextPanelNavigation && (\n\t\t\t\t\t\t<PreviousNextCarouselNavigator\n\t\t\t\t\t\t\tassistiveText={assistiveText.nextPanel}\n\t\t\t\t\t\t\ticonName=\"chevronright\"\n\t\t\t\t\t\t\tisDisabled={isNextBtnDisabled}\n\t\t\t\t\t\t\tonClick={(event: MouseEvent) => {\n\t\t\t\t\t\t\t\tif (isAutoplayOn) {\n\t\t\t\t\t\t\t\t\tstopAutoplay(event);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonNextPanelHandler(event);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tinlineStyle={{ right: '-38px' }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t<CarouselIndicators\n\t\t\t\t\tnoOfIndicators={nrOfPanels}\n\t\t\t\t\tcarouselId={id}\n\t\t\t\t\tcurrentIndex={currentPanel}\n\t\t\t\t\tgetPanelId={getPanelId}\n\t\t\t\t\thasFocus={indicatorsHaveFocus}\n\t\t\t\t\tonBlur={onIndicatorBlur}\n\t\t\t\t\tonClick={onIndicatorClickHandler}\n\t\t\t\t\tonFocus={onIndicatorFocus}\n\t\t\t\t\titems={items}\n\t\t\t\t\titemsPerPanel={itemsPerPanel}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nCarousel.displayName = CAROUSEL;\n\nexport default Carousel;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],"mappings":"4jBAkIA,IAAM,EAA8C,CACnD,eAAgB,yBAChB,UAAW,aACX,cAAe,gBAChB,EAKM,GAAY,CACjB,cAAe,EACf,mBAAmB,IACnB,YACA,aAAc,EACd,cAAc,GACd,iCAAiC,GACjC,GAAI,EACJ,aAAc,EACd,aAAa,GACb,QACA,gBAAgB,EAChB,eACA,0BACA,uBACA,iBACkC,CAClC,IAAM,GAAA,EAAc,EAAA,MAAA,CAAM,EACpB,EAAK,GAAU,EAEf,EAAgB,CAAE,GAAG,EAAsB,GAAG,CAAkB,EAGhE,GAAA,EAAa,EAAA,QAAA,KACZ,KAAK,KAAK,EAAM,OAAS,CAAa,EAC5C,CAAC,EAAM,OAAQ,CAAa,CAC7B,EAGM,CAAC,EAAsB,IAAA,EAA2B,EAAA,SAAA,CACvD,GAA0B,CAC3B,EACM,CAAC,EAAsB,IAAA,EAA2B,EAAA,SAAA,CACvD,GAA0B,CAC3B,EACM,CAAC,EAAqB,IAAA,EAA0B,EAAA,SAAA,CAAS,EAAK,EAC9D,CAAC,EAAY,IAAA,EAAiB,EAAA,SAAA,CAAS,CAAC,EACxC,CAAC,EAAY,IAAA,EAAiB,EAAA,SAAA,CAAS,IAAQ,EAG/C,GAAA,EAAW,EAAA,OAAA,CAAuB,IAAI,EACtC,GAAA,EAAgB,EAAA,OAAA,CAA8C,IAAI,EAClE,GAAA,EAAuB,EAAA,OAAA,CAAe,CAAC,EAGvC,EACL,IAA2B,IAAA,GAExB,EADA,EAEE,EACL,IAA2B,IAAA,GAExB,EADA,EAIE,GAAA,EAAc,EAAA,YAAA,KACb,EAAe,EAAa,EACl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file":"index.cjs","names":[],"sources":["../../../../components/carousel/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\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseCallback,\n\tuseId,\n\tuseMemo,\n\ttype KeyboardEvent,\n\ttype MouseEvent,\n\ttype FocusEvent,\n\ttype ReactElement,\n} from 'react';\nimport classNames from '../../utilities/class-names';\nimport { CAROUSEL } from '../../utilities/constants';\nimport {\n\tcanUseDOM,\n\tcanUseEventListeners,\n} from '../../utilities/execution-environment';\n\nimport CarouselIndicators from './private/carousel-indicators';\nimport PreviousNextCarouselNavigator from './private/previous-next-carousel-navigator';\nimport CarouselItem, { type CarouselItemProps } from './private/carousel-item';\nimport AutoplayButton from './private/auto-play-button';\n\nimport KEYS from '../../utilities/key-code';\nimport EventUtil from '../../utilities/event';\n\n/**\n * Carousel item data structure\n */\nexport interface CarouselItemData {\n\t/** Unique identifier for the item */\n\tid: string;\n\t/** Primary heading text */\n\theading?: string;\n\t/** Description text */\n\tdescription?: string;\n\t/** Button label for call to action */\n\tbuttonLabel?: string;\n\t/** Image alt text */\n\timageAssistiveText?: string;\n\t/** Link URL */\n\thref?: string;\n\t/** Image source URL */\n\tsrc?: string;\n}\n\n/**\n * Assistive text for Carousel\n */\nexport interface CarouselAssistiveText {\n\t/** Autoplay button assistive text */\n\tautoplayButton?: string;\n\t/** Next panel button assistive text */\n\tnextPanel?: string;\n\t/** Previous panel button assistive text */\n\tpreviousPanel?: string;\n}\n\n/**\n * Panel change event data\n */\nexport interface CarouselPanelChangeData {\n\t/** Current panel index */\n\tcurrentPanel: number;\n\t/** Requested panel index */\n\trequestedPanel: number;\n}\n\n/**\n * Autoplay toggle event data\n */\nexport interface CarouselAutoplayData {\n\t/** Requested (next) autoplay state: `true` to start autoplay, `false` to stop it */\n\tisAutoplayOn: boolean;\n}\n\n/**\n * Event passed to `onRequestPanelChange`: the click or key event that caused the request,\n * or `undefined` when autoplay advanced the panel.\n */\nexport type CarouselPanelChangeEvent = MouseEvent | KeyboardEvent | undefined;\n\n/**\n * Event passed to `onRequestAutoplayToggle`: the click, key or focus event that caused the\n * request, or `undefined` when autoplay stopped itself at the last panel.\n */\nexport type CarouselAutoplayToggleEvent =\n\tMouseEvent | KeyboardEvent | FocusEvent | undefined;\n\n/**\n * Item passed to `onRenderItem`: the item's fields plus the layout values the Carousel computed for it\n */\nexport type CarouselRenderItem = Omit<CarouselItemProps, 'onClick'>;\n\n/**\n * Argument passed to `onRenderItem`\n */\nexport interface CarouselRenderItemData {\n\t/** The item to render */\n\titem: CarouselRenderItem;\n}\n\n/**\n * Item click event data\n */\nexport interface CarouselItemClickData {\n\t/** The clicked item */\n\titem: CarouselItemData;\n}\n\n/**\n * Props for the Carousel component\n */\nexport interface CarouselProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: CarouselAssistiveText;\n\t/** Autoplay interval in milliseconds */\n\tautoplayInterval?: number;\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Controlled current panel index */\n\tcurrentPanel?: number;\n\t/** Show autoplay button */\n\thasAutoplay?: boolean;\n\t/** Show previous/next navigation buttons */\n\thasPreviousNextPanelNavigation?: boolean;\n\t/** HTML id */\n\tid?: string;\n\t/** Controlled autoplay state */\n\tisAutoplayOn?: boolean;\n\t/** Enable infinite loop navigation */\n\tisInfinite?: boolean;\n\t/** Array of carousel items */\n\titems: CarouselItemData[];\n\t/** Number of items per panel */\n\titemsPerPanel?: number;\n\t/** Custom item renderer. Receives `{ item }` and returns the item's content. */\n\tonRenderItem?: (data: CarouselRenderItemData) => ReactElement;\n\t/**\n\t * Called when autoplay toggle is requested. `data.isAutoplayOn` is the requested (next) state.\n\t * `event` is `undefined` when autoplay stops itself at the last panel.\n\t */\n\tonRequestAutoplayToggle?: (\n\t\tevent: CarouselAutoplayToggleEvent,\n\t\tdata: CarouselAutoplayData\n\t) => void;\n\t/**\n\t * Called when panel change is requested. `event` is `undefined` when autoplay advanced the panel.\n\t */\n\tonRequestPanelChange?: (\n\t\tevent: CarouselPanelChangeEvent,\n\t\tdata: CarouselPanelChangeData\n\t) => void;\n\t/** Called when an item is clicked */\n\tonItemClick?: (event: MouseEvent, data: CarouselItemClickData) => void;\n}\n\nconst defaultAssistiveText: CarouselAssistiveText = {\n\tautoplayButton: 'Start / Stop auto-play',\n\tnextPanel: 'Next Panel',\n\tpreviousPanel: 'Previous Panel',\n};\n\n/**\n * A carousel allows multiple pieces of featured content to occupy an allocated amount of space.\n */\nconst Carousel = ({\n\tassistiveText: propAssistiveText,\n\tautoplayInterval = 4000,\n\tclassName,\n\tcurrentPanel: controlledCurrentPanel,\n\thasAutoplay = false,\n\thasPreviousNextPanelNavigation = false,\n\tid: propId,\n\tisAutoplayOn: controlledIsAutoplayOn,\n\tisInfinite = false,\n\titems,\n\titemsPerPanel = 1,\n\tonRenderItem,\n\tonRequestAutoplayToggle,\n\tonRequestPanelChange,\n\tonItemClick,\n}: CarouselProps): ReactElement => {\n\tconst generatedId = useId();\n\tconst id = propId || generatedId;\n\n\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\n\t// Calculate number of panels\n\tconst nrOfPanels = useMemo(\n\t\t() => Math.ceil(items.length / itemsPerPanel),\n\t\t[items.length, itemsPerPanel]\n\t);\n\n\t// Internal state (for uncontrolled mode)\n\tconst [internalCurrentPanel, setInternalCurrentPanel] = useState(\n\t\tcontrolledCurrentPanel ?? 0\n\t);\n\tconst [internalIsAutoplayOn, setInternalIsAutoplayOn] = useState(\n\t\tcontrolledIsAutoplayOn ?? hasAutoplay\n\t);\n\tconst [indicatorsHaveFocus, setIndicatorsHaveFocus] = useState(false);\n\tconst [stageWidth, setStageWidth] = useState(0);\n\tconst [translateX, setTranslateX] = useState(-1000000);\n\n\t// Refs\n\tconst stageRef = useRef<HTMLDivElement>(null);\n\tconst autoplayIdRef = useRef<ReturnType<typeof setInterval> | null>(null);\n\tconst initialStageWidthRef = useRef<number>(0);\n\n\t// Derived state - use controlled values if provided\n\tconst currentPanel =\n\t\tcontrolledCurrentPanel !== undefined\n\t\t\t? controlledCurrentPanel\n\t\t\t: internalCurrentPanel;\n\tconst isAutoplayOn =\n\t\tcontrolledIsAutoplayOn !== undefined\n\t\t\t? controlledIsAutoplayOn\n\t\t\t: internalIsAutoplayOn;\n\n\t// Helper functions\n\tconst canGoToNext = useCallback(\n\t\t() => currentPanel < nrOfPanels - 1,\n\t\t[currentPanel, nrOfPanels]\n\t);\n\n\tconst canGoToPrevious = useCallback(() => currentPanel > 0, [currentPanel]);\n\n\tconst getPanelId = useCallback(\n\t\t({ carouselId, itemId }: { carouselId: string; itemId: string }) =>\n\t\t\t`content-id-${carouselId}-${itemId}`,\n\t\t[]\n\t);\n\n\t// Update translation based on current panel\n\tconst changeTranslationAutomatically = useCallback(() => {\n\t\tconst width = stageWidth || initialStageWidthRef.current;\n\t\tsetTranslateX(-(width * currentPanel));\n\t}, [stageWidth, currentPanel]);\n\n\t// Set current panel (internal or via callback)\n\tconst setCurrentPanel = useCallback(\n\t\t(event: CarouselPanelChangeEvent, panel: number, callback?: () => void) => {\n\t\t\tif (onRequestPanelChange) {\n\t\t\t\tonRequestPanelChange(event, {\n\t\t\t\t\tcurrentPanel,\n\t\t\t\t\trequestedPanel: panel,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tsetInternalCurrentPanel(panel);\n\t\t\t\t// Use setTimeout to ensure state is updated before callback\n\t\t\t\tif (callback) {\n\t\t\t\t\tsetTimeout(callback, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[currentPanel, onRequestPanelChange]\n\t);\n\n\t// Stop autoplay\n\tconst stopAutoplay = useCallback(\n\t\t(\n\t\t\tevent: CarouselAutoplayToggleEvent,\n\t\t\tignoreCallbacksAndStateUpdates = false\n\t\t) => {\n\t\t\tif (autoplayIdRef.current) {\n\t\t\t\tclearInterval(autoplayIdRef.current);\n\t\t\t\tautoplayIdRef.current = null;\n\t\t\t}\n\n\t\t\tif (!ignoreCallbacksAndStateUpdates) {\n\t\t\t\tif (onRequestAutoplayToggle) {\n\t\t\t\t\tonRequestAutoplayToggle(event, { isAutoplayOn: false });\n\t\t\t\t} else {\n\t\t\t\t\tsetInternalIsAutoplayOn(false);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[onRequestAutoplayToggle]\n\t);\n\n\t// Start autoplay. Panel changes and the final stop come from the timer, so they carry no event.\n\tconst startAutoplay = useCallback(() => {\n\t\tautoplayIdRef.current = setInterval(() => {\n\t\t\tif (currentPanel < nrOfPanels - 1) {\n\t\t\t\t// Go to next panel\n\t\t\t\tlet next = currentPanel + 1;\n\t\t\t\tif (next > nrOfPanels - 1) {\n\t\t\t\t\tnext = 0;\n\t\t\t\t}\n\t\t\t\tsetCurrentPanel(undefined, next, changeTranslationAutomatically);\n\t\t\t} else if (isInfinite) {\n\t\t\t\t// Loop back to start\n\t\t\t\tsetCurrentPanel(undefined, 0, changeTranslationAutomatically);\n\t\t\t} else {\n\t\t\t\t// Stop at end\n\t\t\t\tstopAutoplay(undefined);\n\t\t\t}\n\t\t}, autoplayInterval);\n\t}, [\n\t\tautoplayInterval,\n\t\tcurrentPanel,\n\t\tnrOfPanels,\n\t\tisInfinite,\n\t\tsetCurrentPanel,\n\t\tchangeTranslationAutomatically,\n\t\tstopAutoplay,\n\t]);\n\n\t// Panel navigation handlers\n\tconst onNextPanelHandler = useCallback(\n\t\t(event: MouseEvent | KeyboardEvent) => {\n\t\t\tlet next = currentPanel + 1;\n\t\t\tif (next > nrOfPanels - 1) {\n\t\t\t\tnext = 0;\n\t\t\t}\n\t\t\tsetCurrentPanel(event, next, changeTranslationAutomatically);\n\t\t},\n\t\t[currentPanel, nrOfPanels, setCurrentPanel, changeTranslationAutomatically]\n\t);\n\n\tconst onPreviousPanelHandler = useCallback(\n\t\t(event: MouseEvent | KeyboardEvent) => {\n\t\t\tlet prev = currentPanel - 1;\n\t\t\tif (prev < 0) {\n\t\t\t\tprev = nrOfPanels - 1;\n\t\t\t}\n\t\t\tsetCurrentPanel(event, prev, changeTranslationAutomatically);\n\t\t},\n\t\t[currentPanel, nrOfPanels, setCurrentPanel, changeTranslationAutomatically]\n\t);\n\n\t// Indicator handlers\n\tconst onIndicatorBlur = useCallback(() => {\n\t\tsetIndicatorsHaveFocus(false);\n\t}, []);\n\n\tconst onIndicatorClickHandler = useCallback(\n\t\t(event: MouseEvent, panel: number) => {\n\t\t\tsetCurrentPanel(event, panel, changeTranslationAutomatically);\n\t\t\tsetIndicatorsHaveFocus(true);\n\t\t\tif (isAutoplayOn) {\n\t\t\t\tstopAutoplay(event);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tsetCurrentPanel,\n\t\t\tchangeTranslationAutomatically,\n\t\t\tisAutoplayOn,\n\t\t\tstopAutoplay,\n\t\t]\n\t);\n\n\tconst onIndicatorFocus = useCallback(\n\t\t(event: FocusEvent) => {\n\t\t\tsetIndicatorsHaveFocus(true);\n\t\t\tif (isAutoplayOn) {\n\t\t\t\tstopAutoplay(event);\n\t\t\t}\n\t\t},\n\t\t[isAutoplayOn, stopAutoplay]\n\t);\n\n\t// Autoplay button handler\n\tconst onAutoplayBtnClick = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tif (onRequestAutoplayToggle) {\n\t\t\t\tonRequestAutoplayToggle(event, { isAutoplayOn: !isAutoplayOn });\n\t\t\t} else {\n\t\t\t\tsetInternalIsAutoplayOn(!isAutoplayOn);\n\t\t\t\tif (isAutoplayOn) {\n\t\t\t\t\tstopAutoplay(event);\n\t\t\t\t} else {\n\t\t\t\t\tstartAutoplay();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[isAutoplayOn, onRequestAutoplayToggle, stopAutoplay, startAutoplay]\n\t);\n\n\t// Keyboard handler\n\tconst handleKeyDown = useCallback(\n\t\t(event: KeyboardEvent<HTMLDivElement>) => {\n\t\t\tconst keyDownCallbacks: Record<number, () => void> = {\n\t\t\t\t[KEYS.LEFT]: () => {\n\t\t\t\t\tif (isInfinite || canGoToPrevious()) {\n\t\t\t\t\t\tonPreviousPanelHandler(event);\n\t\t\t\t\t\tsetIndicatorsHaveFocus(true);\n\t\t\t\t\t\tif (isAutoplayOn) {\n\t\t\t\t\t\t\tstopAutoplay(event);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t[KEYS.RIGHT]: () => {\n\t\t\t\t\tif (isInfinite || canGoToNext()) {\n\t\t\t\t\t\tonNextPanelHandler(event);\n\t\t\t\t\t\tsetIndicatorsHaveFocus(true);\n\t\t\t\t\t\tif (isAutoplayOn) {\n\t\t\t\t\t\t\tstopAutoplay(event);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tif (keyDownCallbacks[event.keyCode]) {\n\t\t\t\tEventUtil.trapImmediate(event);\n\t\t\t\tkeyDownCallbacks[event.keyCode]();\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tisInfinite,\n\t\t\tcanGoToPrevious,\n\t\t\tcanGoToNext,\n\t\t\tonPreviousPanelHandler,\n\t\t\tonNextPanelHandler,\n\t\t\tisAutoplayOn,\n\t\t\tstopAutoplay,\n\t\t]\n\t);\n\n\t// Set dimensions on resize\n\tconst setDimensions = useCallback(() => {\n\t\tif (canUseDOM && stageRef.current?.offsetWidth !== undefined) {\n\t\t\tsetStageWidth(stageRef.current.offsetWidth);\n\t\t}\n\t}, []);\n\n\t// Effect: Mount - measure stage width and set up resize listener\n\tuseEffect(() => {\n\t\tif (canUseDOM && stageRef.current?.offsetWidth !== undefined) {\n\t\t\tinitialStageWidthRef.current = stageRef.current.offsetWidth;\n\t\t\tsetStageWidth(stageRef.current.offsetWidth);\n\t\t}\n\n\t\tif (canUseEventListeners) {\n\t\t\twindow.addEventListener('resize', setDimensions, false);\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (canUseEventListeners) {\n\t\t\t\twindow.removeEventListener('resize', setDimensions, false);\n\t\t\t}\n\t\t\t// Clean up autoplay on unmount\n\t\t\tif (autoplayIdRef.current) {\n\t\t\t\tclearInterval(autoplayIdRef.current);\n\t\t\t}\n\t\t};\n\t}, [setDimensions]);\n\n\t// Effect: Update translation when currentPanel or stageWidth changes\n\tuseEffect(() => {\n\t\tchangeTranslationAutomatically();\n\t}, [changeTranslationAutomatically]);\n\n\t// Effect: Handle autoplay state changes (controlled mode)\n\tuseEffect(() => {\n\t\tif (controlledIsAutoplayOn !== undefined) {\n\t\t\tif (controlledIsAutoplayOn && !autoplayIdRef.current) {\n\t\t\t\tstartAutoplay();\n\t\t\t} else if (!controlledIsAutoplayOn && autoplayIdRef.current) {\n\t\t\t\tstopAutoplay(undefined, true);\n\t\t\t}\n\t\t}\n\t}, [controlledIsAutoplayOn, startAutoplay, stopAutoplay]);\n\n\t// Effect: Start autoplay on mount if enabled\n\tuseEffect(() => {\n\t\tif (isAutoplayOn && !autoplayIdRef.current) {\n\t\t\tstartAutoplay();\n\t\t}\n\t\t// Only run on mount\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\t// Computed values\n\tconst isPreviousBtnDisabled = !(isInfinite || canGoToPrevious());\n\tconst isNextBtnDisabled = !(isInfinite || canGoToNext());\n\tconst itemWidth =\n\t\t(stageWidth || initialStageWidthRef.current) / itemsPerPanel;\n\tconst carouselMargins = hasPreviousNextPanelNavigation\n\t\t? { marginLeft: '44px', marginRight: '44px' }\n\t\t: {};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames('slds-carousel', className as string)}\n\t\t\tid={id}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t>\n\t\t\t<div className=\"slds-grid_vertical slds-col slds-path__scroller\">\n\t\t\t\t{hasAutoplay && (\n\t\t\t\t\t<AutoplayButton\n\t\t\t\t\t\tassistiveText={assistiveText.autoplayButton}\n\t\t\t\t\t\tisAutoplayOn={isAutoplayOn}\n\t\t\t\t\t\tonClick={onAutoplayBtnClick}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<div className=\"slds-is-relative\" style={carouselMargins}>\n\t\t\t\t\t{hasPreviousNextPanelNavigation && (\n\t\t\t\t\t\t<PreviousNextCarouselNavigator\n\t\t\t\t\t\t\tassistiveText={assistiveText.previousPanel}\n\t\t\t\t\t\t\ticonName=\"chevronleft\"\n\t\t\t\t\t\t\tisDisabled={isPreviousBtnDisabled}\n\t\t\t\t\t\t\tonClick={(event: MouseEvent) => {\n\t\t\t\t\t\t\t\tif (isAutoplayOn) {\n\t\t\t\t\t\t\t\t\tstopAutoplay(event);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonPreviousPanelHandler(event);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tinlineStyle={{ left: '-38px' }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t<div ref={stageRef} className=\"slds-carousel__stage slds-show\">\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"slds-carousel__panels slds-is-relative\"\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\ttransform: `translateX(${translateX}px)`,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{items.map((item, index) => (\n\t\t\t\t\t\t\t\t<CarouselItem\n\t\t\t\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\t\t\t\tcarouselId={id}\n\t\t\t\t\t\t\t\t\tgetPanelId={getPanelId}\n\t\t\t\t\t\t\t\t\tonClick={(event: MouseEvent) => {\n\t\t\t\t\t\t\t\t\t\tonItemClick?.(event, { item });\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonFocus={(event: FocusEvent) => {\n\t\t\t\t\t\t\t\t\t\tif (isAutoplayOn) {\n\t\t\t\t\t\t\t\t\t\t\tstopAutoplay(event);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonRenderItem={onRenderItem}\n\t\t\t\t\t\t\t\t\t{...item}\n\t\t\t\t\t\t\t\t\tisInCurrentPanel={\n\t\t\t\t\t\t\t\t\t\tindex >= currentPanel * itemsPerPanel &&\n\t\t\t\t\t\t\t\t\t\tindex < currentPanel * itemsPerPanel + itemsPerPanel\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\titemWidth={itemWidth}\n\t\t\t\t\t\t\t\t\tpanelIndex={Math.ceil((index + 1) / itemsPerPanel) - 1}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t{hasPreviousNextPanelNavigation && (\n\t\t\t\t\t\t<PreviousNextCarouselNavigator\n\t\t\t\t\t\t\tassistiveText={assistiveText.nextPanel}\n\t\t\t\t\t\t\ticonName=\"chevronright\"\n\t\t\t\t\t\t\tisDisabled={isNextBtnDisabled}\n\t\t\t\t\t\t\tonClick={(event: MouseEvent) => {\n\t\t\t\t\t\t\t\tif (isAutoplayOn) {\n\t\t\t\t\t\t\t\t\tstopAutoplay(event);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonNextPanelHandler(event);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tinlineStyle={{ right: '-38px' }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t<CarouselIndicators\n\t\t\t\t\tnoOfIndicators={nrOfPanels}\n\t\t\t\t\tcarouselId={id}\n\t\t\t\t\tcurrentIndex={currentPanel}\n\t\t\t\t\tgetPanelId={getPanelId}\n\t\t\t\t\thasFocus={indicatorsHaveFocus}\n\t\t\t\t\tonBlur={onIndicatorBlur}\n\t\t\t\t\tonClick={onIndicatorClickHandler}\n\t\t\t\t\tonFocus={onIndicatorFocus}\n\t\t\t\t\titems={items}\n\t\t\t\t\titems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,SAAS,cACT,WAAY,GACZ,QAAU,GAAsB,CAC3B,GACH,EAAa,CAAK,EAEnB,EAAuB,CAAK,CAC7B,EACA,YAAa,CAAE,KAAM,OAAQ,CAC7B,CAAA,GAEF,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,IAAK,EAAU,UAAU,iCAC7B,UAAA,EAAA,EAAA,IAAA,CAAC,MAAD,CACC,UAAU,yCACV,MAAO,CACN,UAAW,cAAc,EAAW,IACrC,EAEC,SAAA,EAAM,KAAK,EAAM,KACjB,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CAEC,WAAY,EACA,aACZ,QAAU,GAAsB,CAC/B,IAAc,EAAO,CAAE,MAAK,CAAC,CAC9B,EACA,QAAU,GAAsB,CAC3B,GACH,EAAa,CAAK,CAEpB,EACc,eACd,GAAI,EACJ,iBACC,GAAS,EAAe,GACxB,EAAQ,EAAe,EAAgB,EAE7B,aACX,WAAY,KAAK,MAAM,EAAQ,GAAK,CAAa,EAAI,CACrD,EAnBK,EAAK,EAmBV,CACD,CACG,CAAA,CACD,CAAA,EACJ,IACA,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACC,cAAe,EAAc,UAC7B,SAAS,eACT,WAAY,GACZ,QAAU,GAAsB,CAC3B,GACH,EAAa,CAAK,EAEnB,EAAmB,CAAK,CACzB,EACA,YAAa,CAAE,MAAO,OAAQ,CAC9B,CAAA,CAEE,KACL,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACC,eAAgB,EAChB,WAAY,EACZ,aAAc,EACF,aACZ,SAAU,EACV,OAAQ,GACR,QAAS,GACT,QAAS,GACF,QACQ,eACf,CAAA,CACG,GACD,CAAA,CAEP,EAEA,EAAS,YAAc,EAAA"}
|
|
@@ -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 {\n\ttype FocusEvent,\n\ttype MouseEvent,\n\ttype ReactElement,\n\ttype ReactNode,\n} from 'react';\n\nimport Button from '../../button';\n\nimport { CAROUSEL_ITEM } from '../../../utilities/constants';\nimport { type
|
|
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 {\n\ttype FocusEvent,\n\ttype MouseEvent,\n\ttype ReactElement,\n\ttype ReactNode,\n} 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 * Accepts a custom carousel item rendering function. Called with `{ item }`.\n\t */\n\tonRenderItem?: (data: CarouselRenderItemData) => ReactElement;\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\tonRenderItem,\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{onRenderItem ? (\n\t\t\t\tonRenderItem({\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\tonRenderItem,\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":"2HAyFA,IAAM,GAAgB,CACrB,cACA,aACA,cACA,UACA,OAAO,IACP,KACA,qBACA,mBACA,YACA,UACA,eACA,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,EAAa,CACZ,KAAM,CACL,cACA,aACA,YACA,cACA,UACA,OACA,KACA,qBACA,mBACA,YACA,UACA,eACA,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"}
|
|
@@ -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 o=require("react"),s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l={toggleDisabled:`Disabled`,toggleEnabled:`Enabled`},u=(0,o.forwardRef)((e,t)=>{let{assistiveText:u,checked:d,defaultChecked:f,className:p,disabled:m,errorText:h,id:g,indeterminate:_,labels:v,name:y,onBlur:b,onChange:x,onFocus:S,onKeyDown:C,onKeyPress:w,onKeyUp:T,onRequestFocus:E,readOnly:D,requestFocus:O,required:k,role:A,tabIndex:j,variant:M=`base`,coverable:N,vertical:P,onRenderVisualPicker:F,onRenderVisualPickerSelected:I,onRenderVisualPickerNotSelected:L,size:R=`medium`,labelId:z,...B}=e,V=(0,o.useId)(),H=(0,o.useRef)(null),U=()=>g||V,W=()=>h?`${U()}-error-text`:void 0,G=
|
|
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 o=require("react"),s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l={toggleDisabled:`Disabled`,toggleEnabled:`Enabled`},u=(0,o.forwardRef)((e,t)=>{let{assistiveText:u,checked:d,defaultChecked:f,className:p,disabled:m,errorText:h,id:g,indeterminate:_,labels:v,name:y,onBlur:b,onChange:x,onFocus:S,onKeyDown:C,onKeyPress:w,onKeyUp:T,onRequestFocus:E,readOnly:D,requestFocus:O,required:k,role:A,tabIndex:j,variant:M=`base`,coverable:N,vertical:P,onRenderVisualPicker:F,onRenderVisualPickerSelected:I,onRenderVisualPickerNotSelected:L,size:R=`medium`,labelId:z,...B}=e,V=(0,o.useId)(),H=(0,o.useRef)(null),U=()=>g||V,W=()=>h?`${U()}-error-text`:void 0,G={...u},K={...l,...v};(0,o.useEffect)(()=>{H.current&&_!==void 0&&(H.current.indeterminate=_)},[_]),(0,o.useEffect)(()=>{O&&E&&H.current&&E(H.current)},[O,E]);let q=(e=[])=>e.concat(B[`aria-describedby`]||``,W()||``).filter(Boolean).join(` `)||void 0,J=e=>{x&&x(e,{checked:_?!0:!d,indeterminate:!1})},Y=e=>{(e.keyCode===r.default.ENTER||e.keyCode===r.default.SPACE)&&(n.default.trapImmediate(e),J(e)),C?.(e)},X=a.default(B),Z={disabled:m,...d===void 0?{defaultChecked:f}:{checked:d},id:U(),name:y,onBlur:b,onChange:J,onFocus:S,onKeyDown:Y,onKeyPress:w,onKeyUp:T,role:A,required:k,type:`checkbox`,...X},Q=e=>{H.current=e,typeof t==`function`?t(e):t&&(t.current=e)};return M===`button-group`?(0,c.jsxs)(`span`,{className:`slds-button slds-checkbox_button`,children:[(0,c.jsx)(`input`,{...Z,ref:Q,"aria-describedby":q()}),(0,c.jsxs)(`label`,{className:`slds-checkbox_button__label`,htmlFor:U(),children:[(0,c.jsx)(`span`,{className:`slds-checkbox_faux`,children:K.label}),G.label&&(0,c.jsx)(`span`,{className:`slds-assistive-text`,children:G.label})]})]}):M===`toggle`?(0,c.jsxs)(`div`,{className:(0,s.default)(`slds-form-element`,{"is-required":k,"slds-has-error":h},p),children:[(0,c.jsxs)(`label`,{className:`slds-checkbox_toggle slds-grid`,htmlFor:U(),children:[k&&(0,c.jsx)(`abbr`,{className:`slds-required`,title:`required`,children:`*`}),K.label&&(0,c.jsx)(`span`,{className:`slds-form-element__label slds-m-bottom_none`,children:K.label}),G.label&&(0,c.jsx)(`span`,{className:`slds-assistive-text`,children:G.label}),(0,c.jsx)(`input`,{...Z,ref:Q,"aria-describedby":q([`${U()}-desc`])}),(0,c.jsxs)(`span`,{id:`${U()}-desc`,className:`slds-checkbox_faux_container`,"aria-live":`assertive`,children:[(0,c.jsx)(`span`,{className:`slds-checkbox_faux`}),(0,c.jsx)(`span`,{className:`slds-checkbox_on`,children:K.toggleEnabled}),(0,c.jsx)(`span`,{className:`slds-checkbox_off`,children:K.toggleDisabled})]})]}),h&&(0,c.jsx)(`div`,{className:`slds-form-element__help`,id:W(),children:h})]}):M===`visual-picker`?(0,c.jsxs)(`span`,{className:(0,s.default)(`slds-visual-picker`,`slds-visual-picker_${R}`,P&&`slds-visual-picker_vertical`),children:[(0,c.jsx)(`input`,{...Z,ref:Q,"aria-describedby":q()}),(0,c.jsxs)(`label`,{className:`slds-checkbox_button__label`,htmlFor:U(),children:[N?(0,c.jsxs)(`div`,{className:`slds-visual-picker__figure slds-visual-picker__icon slds-align_absolute-center`,children:[(0,c.jsx)(`span`,{className:`slds-is-selected`,children:I?.()}),(0,c.jsx)(`span`,{className:`slds-is-not-selected`,children:L?.()})]}):(0,c.jsx)(`span`,{className:`slds-visual-picker__figure slds-visual-picker__text slds-align_absolute-center`,children:F?.()}),!P&&(0,c.jsxs)(`span`,{className:`slds-visual-picker__body`,children:[K.heading&&(0,c.jsx)(`span`,{className:`slds-text-heading_small`,children:K.heading}),(0,c.jsx)(`span`,{className:`slds-text-title`,children:K.label}),(G.label||G.heading)&&(0,c.jsx)(`span`,{className:`slds-assistive-text`,children:G.label||G.heading})]}),!N&&(0,c.jsx)(`span`,{className:`slds-icon_container slds-visual-picker__text-check`,children:(0,c.jsx)(i.default,{assistiveText:G,category:`utility`,name:`check`,colorVariant:`base`,size:`x-small`})})]})]}):(0,c.jsxs)(`div`,{className:(0,s.default)(`slds-form-element`,{"is-required":k,"slds-has-error":h},p),children:[(0,c.jsx)(`div`,{className:`slds-form-element__control`,children:(0,c.jsxs)(`span`,{className:`slds-checkbox`,children:[k&&(0,c.jsx)(`abbr`,{className:`slds-required`,title:`required`,children:`*`}),(0,c.jsx)(`input`,{...Z,ref:Q,tabIndex:j?parseInt(j,10):void 0,"aria-describedby":q()}),(0,c.jsxs)(`label`,{className:`slds-checkbox__label`,htmlFor:U(),id:z,children:[(0,c.jsx)(`span`,{className:`slds-checkbox_faux`}),K.label&&(0,c.jsx)(`span`,{className:`slds-form-element__label`,children:K.label}),G.label&&(0,c.jsx)(`span`,{className:`slds-assistive-text`,children:G.label})]})]})}),h&&(0,c.jsx)(`div`,{className:`slds-form-element__help`,id:W(),children:h})]})});u.displayName=t.CHECKBOX,exports.default=u;
|
|
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,EA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A,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';\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/** 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 = { ...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"],"mappings":"qcAwIA,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,EAAuC,CAAE,GAAG,CAAkB,EAG9D,EAAyB,CAC9B,GAAG,EACH,GAAG,CACJ,GAGA,EAAA,EAAA,UAAA,KAAgB,CACX,EAAY,SAAW,IAAkB,IAAA,KAC5C,EAAY,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