@salesforce/design-system-react 11.0.0-alpha.4 → 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/README.md +112 -70
- package/dist/cjs/components/accordion/index.cjs +1 -1
- package/dist/cjs/components/accordion/index.cjs.map +1 -1
- package/dist/cjs/components/alert/index.cjs +1 -1
- package/dist/cjs/components/alert/index.cjs.map +1 -1
- package/dist/cjs/components/avatar/index.cjs +1 -1
- package/dist/cjs/components/avatar/index.cjs.map +1 -1
- package/dist/cjs/components/badge/index.cjs +1 -1
- package/dist/cjs/components/badge/index.cjs.map +1 -1
- package/dist/cjs/components/breadcrumb/index.cjs +1 -1
- package/dist/cjs/components/breadcrumb/index.cjs.map +1 -1
- package/dist/cjs/components/builder-header/index.cjs +1 -1
- package/dist/cjs/components/builder-header/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-group/index.cjs +1 -1
- package/dist/cjs/components/button-group/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/card/index.cjs +1 -1
- package/dist/cjs/components/card/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/color-picker/index.cjs +1 -0
- package/dist/cjs/components/color-picker.cjs +1 -0
- 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 +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 +1 -1
- package/dist/cjs/components/date-picker/index.cjs.map +1 -1
- package/dist/cjs/components/docked-composer/index.cjs +1 -1
- package/dist/cjs/components/docked-composer/index.cjs.map +1 -1
- package/dist/cjs/components/dynamic-icon/index.cjs +1 -1
- package/dist/cjs/components/dynamic-icon/index.cjs.map +1 -1
- package/dist/cjs/components/expandable-section/index.cjs +1 -1
- package/dist/cjs/components/expandable-section/index.cjs.map +1 -1
- package/dist/cjs/components/files/index.cjs +1 -1
- package/dist/cjs/components/files/index.cjs.map +1 -1
- package/dist/cjs/components/filter/index.cjs +1 -0
- package/dist/cjs/components/filter.cjs +1 -0
- package/dist/cjs/components/grid/index.cjs +2 -0
- package/dist/cjs/components/grid/index.cjs.map +1 -0
- package/dist/cjs/components/grid.cjs +1 -0
- package/dist/cjs/components/icon/index.cjs +1 -1
- package/dist/cjs/components/icon/index.cjs.map +1 -1
- package/dist/cjs/components/icon-settings/index.cjs +1 -1
- package/dist/cjs/components/icon-settings/index.cjs.map +1 -1
- package/dist/cjs/components/illustration/index.cjs +1 -1
- package/dist/cjs/components/illustration/index.cjs.map +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/input/check-props.cjs +1 -1
- package/dist/cjs/components/input/check-props.cjs.map +1 -1
- package/dist/cjs/components/input/index.cjs +1 -1
- package/dist/cjs/components/input/index.cjs.map +1 -1
- package/dist/cjs/components/input/search.cjs +1 -1
- package/dist/cjs/components/input/search.cjs.map +1 -1
- package/dist/cjs/components/media-object/index.cjs +1 -1
- package/dist/cjs/components/media-object/index.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 +1 -1
- package/dist/cjs/components/menu-dropdown/index.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs +1 -1
- package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs.map +1 -1
- package/dist/cjs/components/modal/index.cjs +1 -1
- package/dist/cjs/components/modal/index.cjs.map +1 -1
- package/dist/cjs/components/page-header/index.cjs +1 -1
- package/dist/cjs/components/page-header/index.cjs.map +1 -1
- package/dist/cjs/components/panel/index.cjs +1 -1
- package/dist/cjs/components/panel/index.cjs.map +1 -1
- package/dist/cjs/components/pill/index.cjs +1 -1
- package/dist/cjs/components/pill/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 +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/portal-settings/index.cjs +1 -1
- package/dist/cjs/components/portal-settings/index.cjs.map +1 -1
- package/dist/cjs/components/progress-bar/index.cjs +1 -1
- package/dist/cjs/components/progress-bar/index.cjs.map +1 -1
- package/dist/cjs/components/progress-indicator/check-props.cjs +2 -0
- package/dist/cjs/components/progress-indicator/check-props.cjs.map +1 -0
- package/dist/cjs/components/progress-indicator/index.cjs +1 -1
- package/dist/cjs/components/progress-indicator/index.cjs.map +1 -1
- package/dist/cjs/components/progress-indicator/private/path.cjs +2 -0
- package/dist/cjs/components/progress-indicator/private/path.cjs.map +1 -0
- package/dist/cjs/components/progress-indicator/private/progress.cjs +1 -1
- package/dist/cjs/components/progress-indicator/private/progress.cjs.map +1 -1
- package/dist/cjs/components/progress-indicator/private/use-roving-tab-index.cjs +2 -0
- package/dist/cjs/components/progress-indicator/private/use-roving-tab-index.cjs.map +1 -0
- package/dist/cjs/components/progress-ring/index.cjs +1 -1
- package/dist/cjs/components/progress-ring/index.cjs.map +1 -1
- package/dist/cjs/components/radio/index.cjs +1 -1
- package/dist/cjs/components/radio/index.cjs.map +1 -1
- package/dist/cjs/components/radio-button-group/index.cjs +1 -1
- package/dist/cjs/components/radio-button-group/index.cjs.map +1 -1
- package/dist/cjs/components/radio-group/index.cjs +1 -1
- package/dist/cjs/components/radio-group/index.cjs.map +1 -1
- package/dist/cjs/components/scoped-notification/index.cjs +1 -1
- package/dist/cjs/components/scoped-notification/index.cjs.map +1 -1
- package/dist/cjs/components/setup-assistant/index.cjs +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/index.cjs +1 -1
- package/dist/cjs/components/simple-data-table/index.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/row-actions.cjs +1 -1
- package/dist/cjs/components/simple-data-table/row-actions.cjs.map +1 -1
- package/dist/cjs/components/slider/index.cjs +1 -1
- package/dist/cjs/components/slider/index.cjs.map +1 -1
- package/dist/cjs/components/spinner/index.cjs +1 -1
- package/dist/cjs/components/spinner/index.cjs.map +1 -1
- package/dist/cjs/components/split-view/check-props.cjs +2 -0
- package/dist/cjs/components/split-view/check-props.cjs.map +1 -0
- package/dist/cjs/components/split-view/component.cjs +2 -0
- package/dist/cjs/components/split-view/component.cjs.map +1 -0
- package/dist/cjs/components/split-view/header.cjs.map +1 -1
- package/dist/cjs/components/split-view/index.cjs +1 -1
- package/dist/cjs/components/split-view/index.cjs.map +1 -1
- package/dist/cjs/components/split-view/listbox.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/index.cjs +1 -0
- package/dist/cjs/components/tree/private/branch.cjs.map +1 -1
- package/dist/cjs/components/tree/private/item.cjs.map +1 -1
- package/dist/cjs/components/tree/private/render-branch.cjs.map +1 -1
- package/dist/cjs/components/tree/private/render-initial-branch.cjs +1 -1
- package/dist/cjs/components/tree/private/render-initial-branch.cjs.map +1 -1
- package/dist/cjs/components/tree/tree.cjs +1 -1
- package/dist/cjs/components/tree/tree.cjs.map +1 -1
- package/dist/cjs/components/tree.cjs +1 -0
- package/dist/cjs/components/trial-bar/index.cjs +1 -1
- package/dist/cjs/components/trial-bar/index.cjs.map +1 -1
- package/dist/cjs/components/utilities/menu-list/index.cjs.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 +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/visual-picker/index.cjs +1 -1
- package/dist/cjs/components/visual-picker/index.cjs.map +1 -1
- package/dist/cjs/components/welcome-mat/index.cjs +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/cjs/utilities/hooks/index.cjs +1 -0
- package/dist/cjs/utilities/hooks.cjs +1 -0
- package/dist/cjs/utilities/warning/incompatible-props.cjs +2 -0
- package/dist/cjs/utilities/warning/incompatible-props.cjs.map +1 -0
- package/dist/es/components/accordion/index.js +28 -24
- package/dist/es/components/accordion/index.js.map +1 -1
- package/dist/es/components/alert/index.js +14 -14
- package/dist/es/components/alert/index.js.map +1 -1
- package/dist/es/components/avatar/index.js +1 -1
- package/dist/es/components/avatar/index.js.map +1 -1
- package/dist/es/components/badge/index.js +1 -0
- package/dist/es/components/badge/index.js.map +1 -1
- package/dist/es/components/breadcrumb/index.js +1 -1
- package/dist/es/components/breadcrumb/index.js.map +1 -1
- package/dist/es/components/button/index.js +2 -2
- package/dist/es/components/button/index.js.map +1 -1
- package/dist/es/components/button-stateful/index.js +4 -3
- 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/color-picker/index.js +2 -0
- package/dist/es/components/color-picker.js +2 -0
- 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/filter/index.js +2 -0
- package/dist/es/components/filter.js +2 -0
- package/dist/es/components/grid/index.js +31 -0
- package/dist/es/components/grid/index.js.map +1 -0
- package/dist/es/components/grid.js +2 -0
- 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 +5 -5
- package/dist/es/components/menu-dropdown/index.js.map +1 -1
- package/dist/es/components/menu-dropdown/menu-dropdown.js +262 -258
- package/dist/es/components/menu-dropdown/menu-dropdown.js.map +1 -1
- package/dist/es/components/modal/index.js +104 -132
- package/dist/es/components/modal/index.js.map +1 -1
- package/dist/es/components/page-header/index.js +24 -24
- 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 +3 -3
- package/dist/es/components/popover/index.js.map +1 -1
- package/dist/es/components/popover/popover.js +72 -64
- package/dist/es/components/popover/popover.js.map +1 -1
- package/dist/es/components/progress-indicator/check-props.js +24 -0
- package/dist/es/components/progress-indicator/check-props.js.map +1 -0
- package/dist/es/components/progress-indicator/index.js +80 -38
- package/dist/es/components/progress-indicator/index.js.map +1 -1
- package/dist/es/components/progress-indicator/private/path.js +95 -0
- package/dist/es/components/progress-indicator/private/path.js.map +1 -0
- package/dist/es/components/progress-indicator/private/progress.js +1 -1
- package/dist/es/components/progress-indicator/private/progress.js.map +1 -1
- package/dist/es/components/progress-indicator/private/use-roving-tab-index.js +29 -0
- package/dist/es/components/progress-indicator/private/use-roving-tab-index.js.map +1 -0
- package/dist/es/components/progress-ring/index.js +8 -8
- package/dist/es/components/progress-ring/index.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/index.js +67 -69
- package/dist/es/components/simple-data-table/index.js.map +1 -1
- package/dist/es/components/simple-data-table/row-actions.js +2 -2
- package/dist/es/components/simple-data-table/row-actions.js.map +1 -1
- package/dist/es/components/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 +81 -75
- 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/index.js +2 -0
- package/dist/es/components/tree/private/branch.js.map +1 -1
- package/dist/es/components/tree/private/item.js.map +1 -1
- package/dist/es/components/tree/private/render-branch.js.map +1 -1
- package/dist/es/components/tree/private/render-initial-branch.js +5 -2
- package/dist/es/components/tree/private/render-initial-branch.js.map +1 -1
- package/dist/es/components/tree/tree.js +60 -35
- package/dist/es/components/tree/tree.js.map +1 -1
- package/dist/es/components/tree.js +2 -0
- 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/es/utilities/hooks/index.js +2 -0
- package/dist/es/utilities/hooks.js +1 -0
- package/dist/es/utilities/warning/incompatible-props.js +19 -0
- package/dist/es/utilities/warning/incompatible-props.js.map +1 -0
- package/dist/types/components/accordion/index.d.ts.map +1 -1
- package/dist/types/components/alert/index.d.ts.map +1 -1
- package/dist/types/components/avatar/index.d.ts +1 -1
- package/dist/types/components/avatar/index.d.ts.map +1 -1
- package/dist/types/components/badge/index.d.ts +1 -1
- package/dist/types/components/badge/index.d.ts.map +1 -1
- package/dist/types/components/breadcrumb/index.d.ts +1 -1
- package/dist/types/components/breadcrumb/index.d.ts.map +1 -1
- package/dist/types/components/button/check-props.d.ts.map +1 -1
- package/dist/types/components/button/index.d.ts +6 -3
- package/dist/types/components/button/index.d.ts.map +1 -1
- package/dist/types/components/button-stateful/index.d.ts +3 -3
- 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/progress-indicator/check-props.d.ts.map +1 -0
- package/dist/types/components/progress-indicator/index.d.ts +39 -8
- package/dist/types/components/progress-indicator/index.d.ts.map +1 -1
- package/dist/types/components/progress-indicator/private/path.d.ts +48 -0
- package/dist/types/components/progress-indicator/private/path.d.ts.map +1 -0
- package/dist/types/components/progress-indicator/private/progress.d.ts.map +1 -1
- package/dist/types/components/progress-indicator/private/use-roving-tab-index.d.ts +41 -0
- package/dist/types/components/progress-indicator/private/use-roving-tab-index.d.ts.map +1 -0
- 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/index.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 +10 -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 +1 -1
- package/dist/types/utilities/constants.d.ts.map +1 -1
- package/dist/types/utilities/hooks/index.d.ts +1 -1
- package/dist/types/utilities/hooks/index.d.ts.map +1 -1
- package/dist/types/utilities/hooks.d.ts +0 -1
- package/dist/types/utilities/sample-data/global-navigation-bar.d.ts +0 -1
- package/dist/types/utilities/sample-data/vertical-navigation.d.ts +0 -1
- package/dist/types/utilities/warning/incompatible-props.d.ts.map +1 -1
- package/package.json +5 -4
- 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/design-tokens/dist/palette-colors.common.cjs +0 -2
- package/dist/cjs/utilities/design-tokens/dist/palette-colors.common.cjs.map +0 -1
- package/dist/cjs/utilities/design-tokens/dist/salesforce-skin.common.cjs +0 -2
- package/dist/cjs/utilities/design-tokens/dist/salesforce-skin.common.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/design-tokens/dist/palette-colors.common.js +0 -6
- package/dist/es/utilities/design-tokens/dist/palette-colors.common.js.map +0 -1
- package/dist/es/utilities/design-tokens/dist/salesforce-skin.common.js +0 -286
- package/dist/es/utilities/design-tokens/dist/salesforce-skin.common.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.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/design-tokens/dist/analytics-cloud.common.d.ts +0 -81
- package/dist/types/utilities/design-tokens/dist/analytics-cloud.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/bg-actions.common.d.ts +0 -201
- package/dist/types/utilities/design-tokens/dist/bg-actions.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/bg-custom.common.d.ts +0 -117
- package/dist/types/utilities/design-tokens/dist/bg-custom.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/bg-icons.common.d.ts +0 -5
- package/dist/types/utilities/design-tokens/dist/bg-icons.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/bg-standard.common.d.ts +0 -204
- package/dist/types/utilities/design-tokens/dist/bg-standard.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/color-palettes.common.d.ts +0 -3
- package/dist/types/utilities/design-tokens/dist/color-palettes.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/components.common.d.ts +0 -249
- package/dist/types/utilities/design-tokens/dist/components.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/console-base.common.d.ts +0 -9
- package/dist/types/utilities/design-tokens/dist/console-base.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/force-base.common.d.ts +0 -647
- package/dist/types/utilities/design-tokens/dist/force-base.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/force-font-commons.common.d.ts +0 -14
- package/dist/types/utilities/design-tokens/dist/force-font-commons.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/force-mq-commons.common.d.ts +0 -10
- package/dist/types/utilities/design-tokens/dist/force-mq-commons.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/icon-paths.common.d.ts +0 -9
- package/dist/types/utilities/design-tokens/dist/icon-paths.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/illustrations.common.d.ts +0 -7
- package/dist/types/utilities/design-tokens/dist/illustrations.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/image-paths.common.d.ts +0 -12
- package/dist/types/utilities/design-tokens/dist/image-paths.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/marketing-cloud.common.d.ts +0 -35
- package/dist/types/utilities/design-tokens/dist/marketing-cloud.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/palette-colors.common.d.ts +0 -98
- package/dist/types/utilities/design-tokens/dist/palette-colors.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/s1-base-large.common.d.ts +0 -15
- package/dist/types/utilities/design-tokens/dist/s1-base-large.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/s1-base-medium.common.d.ts +0 -5
- package/dist/types/utilities/design-tokens/dist/s1-base-medium.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/s1-base-small.common.d.ts +0 -11
- package/dist/types/utilities/design-tokens/dist/s1-base-small.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/s1-base.common.d.ts +0 -21
- package/dist/types/utilities/design-tokens/dist/s1-base.common.d.ts.map +0 -1
- package/dist/types/utilities/design-tokens/dist/salesforce-skin.common.d.ts +0 -283
- package/dist/types/utilities/design-tokens/dist/salesforce-skin.common.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 → progress-indicator}/check-props.d.ts +0 -0
- /package/dist/types/components/{button-stateful → split-view}/check-props.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./hooks/index.cjs');
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("../../_virtual/_rolldown/runtime.cjs");let t=require("warning");t=e.__toESM(t,1);var n=function(){};process.env.NODE_ENV!==`production`&&(n=function(e,n,r,i,a,o,s){let c=!0;if(n[r]&&n[a]){let e=!i||i.includes(n[r]),t=!o||o.includes(n[a]);c=!(e&&t)}if(!c){let c=s?` ${s}`:``,l=i?` of value \`${n[r]}\``:``,u=o?` of value \`${n[a]}\``:``;(0,t.default)(!1,`[Design System React] ${e} should not be passed prop \`${r}\`${l} along with prop \`${a}\`${u} as they are incompatible.${c}`)}});var r=n;exports.default=r;
|
|
2
|
+
//# sourceMappingURL=incompatible-props.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incompatible-props.cjs","names":[],"sources":["../../../../utilities/warning/incompatible-props.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n/* eslint-disable import/no-mutable-exports */\n\n// This function will deliver an error message to the browser console when all of the props passed in are undefined (falsey).\nimport warning from 'warning';\n\nlet incompatibleProps = function incompatiblePropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tincompatibleProps = function incompatiblePropsFunction(\n\t\tcontrol,\n\t\tprops,\n\t\tpropOneName,\n\t\tpropOneValues,\n\t\tpropTwoName,\n\t\tpropTwoValues,\n\t\tcomment\n\t) {\n\t\tlet checkPassed = true;\n\n\t\tif (props[propOneName] && props[propTwoName]) {\n\t\t\tconst propOneConditionMet = propOneValues\n\t\t\t\t? propOneValues.includes(props[propOneName])\n\t\t\t\t: true;\n\t\t\tconst propTwoConditionMet = propTwoValues\n\t\t\t\t? propTwoValues.includes(props[propTwoName])\n\t\t\t\t: true;\n\n\t\t\tcheckPassed = !(propOneConditionMet && propTwoConditionMet);\n\t\t}\n\n\t\tif (!checkPassed) {\n\t\t\tconst additionalComment = comment ? ` ${comment}` : '';\n\t\t\tconst incompatibleValueOne = propOneValues\n\t\t\t\t? ` of value \\`${props[propOneName]}\\``\n\t\t\t\t: '';\n\t\t\tconst incompatibleValueTwo = propTwoValues\n\t\t\t\t? ` of value \\`${props[propTwoName]}\\``\n\t\t\t\t: '';\n\n\t\t\t/* eslint-disable max-len */\n\t\t\twarning(\n\t\t\t\tfalse,\n\t\t\t\t`[Design System React] ${control} should not be passed prop \\`${propOneName}\\`${incompatibleValueOne} along with prop \\`${propTwoName}\\`${incompatibleValueTwo} as they are incompatible.${additionalComment}`\n\t\t\t);\n\t\t\t/* eslint-enable max-len */\n\t\t}\n\t};\n}\n\nexport default incompatibleProps;\n"],"mappings":"kGAQA,IAAI,EAAoB,UAAqC,CAAC,EAE9D,QAAA,IAAA,WAA6B,eAC5B,EAAoB,SACnB,EACA,EACA,EACA,EACA,EACA,EACA,EACC,CACD,IAAI,EAAc,GAElB,GAAI,EAAM,IAAgB,EAAM,GAAc,CAC7C,IAAM,EAAsB,IACzB,EAAc,SAAS,EAAM,EAAY,EAEtC,EAAsB,IACzB,EAAc,SAAS,EAAM,EAAY,EAG5C,EAAc,EAAE,GAAuB,EACxC,CAEA,GAAI,CAAC,EAAa,CACjB,IAAM,EAAoB,EAAU,IAAI,IAAY,GAC9C,EAAuB,EAC1B,eAAe,EAAM,GAAa,IAClC,GACG,EAAuB,EAC1B,eAAe,EAAM,GAAa,IAClC,IAGH,EAAA,EAAA,QAAA,CACC,GACA,yBAAyB,EAAQ,+BAA+B,EAAY,IAAI,EAAqB,qBAAqB,EAAY,IAAI,EAAqB,4BAA4B,GAC5L,CAED,CACD,GAGD,IAAA,EAAe"}
|
|
@@ -1,33 +1,37 @@
|
|
|
1
1
|
import { ACCORDION as e } from "../../utilities/constants.js";
|
|
2
|
-
import t, { useCallback as n, useEffect as r, useId as i,
|
|
3
|
-
import
|
|
4
|
-
import { jsx as
|
|
2
|
+
import t, { useCallback as n, useEffect as r, useId as i, useLayoutEffect as a, useRef as o, useState as s } from "react";
|
|
3
|
+
import c from "classnames";
|
|
4
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
5
5
|
//#region components/accordion/index.tsx
|
|
6
|
-
var
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
var u = ({ children: e, className: u, id: d }) => {
|
|
7
|
+
let f = i(), p = d || f, [m, h] = s(0), g = o([]), _ = t.Children.count(e), v = o(_);
|
|
8
|
+
a(() => {
|
|
9
|
+
if (v.current === _ || (v.current = _, m === null)) return;
|
|
10
|
+
let e = g.current.findIndex((e) => e === document.activeElement);
|
|
11
|
+
e === -1 ? m > _ - 1 && h(_ > 0 ? _ - 1 : null) : e !== m && h(e);
|
|
12
|
+
}, [_, m]), r(() => {
|
|
13
|
+
m !== null && g.current[m] && g.current[m].focus();
|
|
14
|
+
}, [m]);
|
|
15
|
+
let y = n(() => {
|
|
16
|
+
h(null);
|
|
17
|
+
}, []), b = n((e) => {
|
|
18
|
+
let t = m;
|
|
19
|
+
t === null && (t = g.current.findIndex((t) => t && t.id === e.target.id)), e.key === "ArrowDown" ? (e.preventDefault(), t < _ - 1 ? h(t + 1) : h(0)) : e.key === "ArrowUp" && (e.preventDefault(), h(t > 0 ? t - 1 : _ - 1));
|
|
20
|
+
}, [m, _]), x = n((e, t) => {
|
|
21
|
+
t === null ? delete g.current[e] : g.current[e] = t;
|
|
18
22
|
}, []);
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
name:
|
|
21
|
-
className:
|
|
22
|
-
children: t.Children.map(e, (e) => t.isValidElement(e) ? t.cloneElement(e, {
|
|
23
|
-
refs: { summaryButton:
|
|
24
|
-
onClickSummary:
|
|
25
|
-
onKeyDownSummary:
|
|
23
|
+
return /* @__PURE__ */ l("ul", {
|
|
24
|
+
name: p,
|
|
25
|
+
className: c("slds-accordion", u),
|
|
26
|
+
children: t.Children.map(e, (e, n) => t.isValidElement(e) ? t.cloneElement(e, {
|
|
27
|
+
refs: { summaryButton: (e) => x(n, e) },
|
|
28
|
+
onClickSummary: y,
|
|
29
|
+
onKeyDownSummary: b
|
|
26
30
|
}) : e)
|
|
27
31
|
});
|
|
28
32
|
};
|
|
29
|
-
|
|
33
|
+
u.displayName = e;
|
|
30
34
|
//#endregion
|
|
31
|
-
export {
|
|
35
|
+
export { u as default };
|
|
32
36
|
|
|
33
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../components/accordion/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\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tuseId,\n\ttype ReactNode,\n\ttype ReactElement,\n\ttype KeyboardEvent,\n} from 'react';\nimport classNames from 'classnames';\nimport { ACCORDION } from '../../utilities/constants';\n\n/**\n * Props for the Accordion component\n */\nexport interface AccordionProps {\n\t/** Accordion panel children */\n\tchildren: ReactNode;\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** HTML id */\n\tid?: string | number;\n}\n\n/**\n * An accordion allows a user to toggle the display of sections of content.\n * The accordion component wraps accordion panels that can be selected and expanded.\n */\nconst Accordion = ({\n\tchildren,\n\tclassName,\n\tid: propId,\n}: AccordionProps): React.ReactElement => {\n\tconst generatedId = useId();\n\tconst id = propId || generatedId;\n\n\tconst [currButtonIndex, setCurrButtonIndex] = useState<number | null>(0);\n\tconst summaryButtonsRef = useRef<HTMLButtonElement[]>([]);\n\tconst childCount = React.Children.count(children);\n\n\t// Focus management\n\tuseEffect(() => {\n\t\tif (
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../components/accordion/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\tuseRef,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseCallback,\n\tuseId,\n\ttype ReactNode,\n\ttype ReactElement,\n\ttype KeyboardEvent,\n} from 'react';\nimport classNames from 'classnames';\nimport { ACCORDION } from '../../utilities/constants';\n\n/**\n * Props for the Accordion component\n */\nexport interface AccordionProps {\n\t/** Accordion panel children */\n\tchildren: ReactNode;\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** HTML id */\n\tid?: string | number;\n}\n\n/**\n * An accordion allows a user to toggle the display of sections of content.\n * The accordion component wraps accordion panels that can be selected and expanded.\n */\nconst Accordion = ({\n\tchildren,\n\tclassName,\n\tid: propId,\n}: AccordionProps): React.ReactElement => {\n\tconst generatedId = useId();\n\tconst id = propId || generatedId;\n\n\tconst [currButtonIndex, setCurrButtonIndex] = useState<number | null>(0);\n\tconst summaryButtonsRef = useRef<HTMLButtonElement[]>([]);\n\tconst childCount = React.Children.count(children);\n\n\t// Resync the tracked index whenever the panel count changes (e.g. a panel\n\t// is removed). Removing a panel before the focused one shifts the focused\n\t// button to an earlier index without moving DOM focus off of it, so\n\t// currButtonIndex can end up in range but pointing at the wrong button.\n\t// This has to run in a layout effect rather than during render: refs are\n\t// only reattached to their new positions during the commit that follows\n\t// this render, so summaryButtonsRef.current isn't resynced yet while the\n\t// component function is running.\n\tconst prevChildCountRef = useRef(childCount);\n\tuseLayoutEffect(() => {\n\t\tif (prevChildCountRef.current === childCount) {\n\t\t\treturn;\n\t\t}\n\t\tprevChildCountRef.current = childCount;\n\n\t\tif (currButtonIndex === null) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst focusedIndex = summaryButtonsRef.current.findIndex(\n\t\t\t(button) => button === document.activeElement\n\t\t);\n\n\t\tif (focusedIndex !== -1) {\n\t\t\tif (focusedIndex !== currButtonIndex) {\n\t\t\t\tsetCurrButtonIndex(focusedIndex);\n\t\t\t}\n\t\t} else if (currButtonIndex > childCount - 1) {\n\t\t\tsetCurrButtonIndex(childCount > 0 ? childCount - 1 : null);\n\t\t}\n\t}, [childCount, currButtonIndex]);\n\n\t// Focus management\n\tuseEffect(() => {\n\t\tif (\n\t\t\tcurrButtonIndex !== null &&\n\t\t\tsummaryButtonsRef.current[currButtonIndex]\n\t\t) {\n\t\t\tsummaryButtonsRef.current[currButtonIndex].focus();\n\t\t}\n\t}, [currButtonIndex]);\n\n\tconst handleClickSummary = useCallback(() => {\n\t\tsetCurrButtonIndex(null);\n\t}, []);\n\n\tconst handleKeyDownSummary = useCallback(\n\t\t(e: KeyboardEvent<HTMLButtonElement>) => {\n\t\t\tlet buttonIndex = currButtonIndex;\n\n\t\t\tif (buttonIndex === null) {\n\t\t\t\tbuttonIndex = summaryButtonsRef.current.findIndex(\n\t\t\t\t\t(el) => el && el.id === (e.target as HTMLElement).id\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (e.key === 'ArrowDown') {\n\t\t\t\te.preventDefault();\n\t\t\t\tif (buttonIndex < childCount - 1) {\n\t\t\t\t\tsetCurrButtonIndex(buttonIndex + 1);\n\t\t\t\t} else {\n\t\t\t\t\tsetCurrButtonIndex(0);\n\t\t\t\t}\n\t\t\t} else if (e.key === 'ArrowUp') {\n\t\t\t\te.preventDefault();\n\t\t\t\tif (buttonIndex > 0) {\n\t\t\t\t\tsetCurrButtonIndex(buttonIndex - 1);\n\t\t\t\t} else {\n\t\t\t\t\tsetCurrButtonIndex(childCount - 1);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[currButtonIndex, childCount]\n\t);\n\n\tconst addSummaryButton = useCallback(\n\t\t(index: number, button: HTMLButtonElement | null) => {\n\t\t\tif (button === null) {\n\t\t\t\tdelete summaryButtonsRef.current[index];\n\t\t\t} else {\n\t\t\t\tsummaryButtonsRef.current[index] = button;\n\t\t\t}\n\t\t},\n\t\t[]\n\t);\n\n\treturn (\n\t\t<ul\n\t\t\t// @ts-expect-error name attribute on ul is non-standard but kept for compatibility\n\t\t\tname={id}\n\t\t\tclassName={classNames('slds-accordion', className as string)}\n\t\t>\n\t\t\t{React.Children.map(children, (child, index) => {\n\t\t\t\tif (React.isValidElement(child)) {\n\t\t\t\t\treturn React.cloneElement(\n\t\t\t\t\t\tchild as ReactElement<{\n\t\t\t\t\t\t\trefs?: {\n\t\t\t\t\t\t\t\tsummaryButton: (button: HTMLButtonElement | null) => void;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tonClickSummary?: () => void;\n\t\t\t\t\t\t\tonKeyDownSummary?: (e: KeyboardEvent<HTMLButtonElement>) => void;\n\t\t\t\t\t\t}>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\trefs: {\n\t\t\t\t\t\t\t\tsummaryButton: (button: HTMLButtonElement | null) =>\n\t\t\t\t\t\t\t\t\taddSummaryButton(index, button),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonClickSummary: handleClickSummary,\n\t\t\t\t\t\t\tonKeyDownSummary: handleKeyDownSummary,\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn child;\n\t\t\t})}\n\t\t</ul>\n\t);\n};\n\nAccordion.displayName = ACCORDION;\n\nexport default Accordion;\n"],"mappings":";;;;;AAiCA,IAAM,KAAa,EAClB,aACA,cACA,IAAI,QACqC;CACzC,IAAM,IAAc,EAAM,GACpB,IAAK,KAAU,GAEf,CAAC,GAAiB,KAAsB,EAAwB,CAAC,GACjE,IAAoB,EAA4B,CAAC,CAAC,GAClD,IAAa,EAAM,SAAS,MAAM,CAAQ,GAU1C,IAAoB,EAAO,CAAU;CAyB3C,AAxBA,QAAsB;EAMrB,IALI,EAAkB,YAAY,MAGlC,EAAkB,UAAU,GAExB,MAAoB,OACvB;EAGD,IAAM,IAAe,EAAkB,QAAQ,WAC7C,MAAW,MAAW,SAAS,aACjC;EAEA,AAAI,MAAiB,KAIV,IAAkB,IAAa,KACzC,EAAmB,IAAa,IAAI,IAAa,IAAI,IAAI,IAJrD,MAAiB,KACpB,EAAmB,CAAY;CAKlC,GAAG,CAAC,GAAY,CAAe,CAAC,GAGhC,QAAgB;EACf,AACC,MAAoB,QACpB,EAAkB,QAAQ,MAE1B,EAAkB,QAAQ,EAAgB,CAAC,MAAM;CAEnD,GAAG,CAAC,CAAe,CAAC;CAEpB,IAAM,IAAqB,QAAkB;EAC5C,EAAmB,IAAI;CACxB,GAAG,CAAC,CAAC,GAEC,IAAuB,GAC3B,MAAwC;EACxC,IAAI,IAAc;EAQlB,AANI,MAAgB,SACnB,IAAc,EAAkB,QAAQ,WACtC,MAAO,KAAM,EAAG,OAAQ,EAAE,OAAuB,EACnD,IAGG,EAAE,QAAQ,eACb,EAAE,eAAe,GACb,IAAc,IAAa,IAC9B,EAAmB,IAAc,CAAC,IAElC,EAAmB,CAAC,KAEX,EAAE,QAAQ,cACpB,EAAE,eAAe,GAEhB,EADG,IAAc,IACE,IAAc,IAEd,IAAa,CAAC;CAGpC,GACA,CAAC,GAAiB,CAAU,CAC7B,GAEM,IAAmB,GACvB,GAAe,MAAqC;EACpD,AAAI,MAAW,OACd,OAAO,EAAkB,QAAQ,KAEjC,EAAkB,QAAQ,KAAS;CAErC,GACA,CAAC,CACF;CAEA,OACC,kBAAC,MAAD;EAEC,MAAM;EACN,WAAW,EAAW,kBAAkB,CAAmB;EAE1D,UAAA,EAAM,SAAS,IAAI,IAAW,GAAO,MACjC,EAAM,eAAe,CAAK,IACtB,EAAM,aACZ,GAOA;GACC,MAAM,EACL,gBAAgB,MACf,EAAiB,GAAO,CAAM,EAChC;GACA,gBAAgB;GAChB,kBAAkB;EACnB,CACD,IAEM,CACP;CACE,CAAA;AAEN;AAEA,EAAU,cAAc"}
|
|
@@ -30,23 +30,23 @@ var p = { closeButton: "Close" }, m = {}, h = {
|
|
|
30
30
|
name: "error"
|
|
31
31
|
})
|
|
32
32
|
}, _ = ({ assistiveText: e, className: i, dismissible: _, icon: v, labels: y, onClickHeadingLink: b, onRequestClose: x, style: S, variant: C = "info" }) => {
|
|
33
|
-
let [w, T] = u(!0), E = l(null), D = {
|
|
33
|
+
let [w, T] = u(!0), E = l(null), D = l(!1), O = {
|
|
34
34
|
...p,
|
|
35
35
|
...e
|
|
36
|
-
},
|
|
36
|
+
}, k = {
|
|
37
37
|
...m,
|
|
38
38
|
...y
|
|
39
39
|
};
|
|
40
40
|
c(() => () => {
|
|
41
|
-
n.returnFocusToStoredElement();
|
|
41
|
+
D.current && n.returnFocusToStoredElement();
|
|
42
42
|
}, []);
|
|
43
|
-
let
|
|
44
|
-
E.current = e, w && e && (n.storeActiveElement(), e.focus(), T(!1));
|
|
45
|
-
}, [w]),
|
|
43
|
+
let A = s((e) => {
|
|
44
|
+
E.current = e, w && e && (n.storeActiveElement(), D.current = !0, e.focus(), T(!1));
|
|
45
|
+
}, [w]), j = v || g[C], M = o.isValidElement(j) ? o.cloneElement(j, {
|
|
46
46
|
containerClassName: "slds-m-right_x-small",
|
|
47
47
|
inverse: !0,
|
|
48
48
|
size: "x-small"
|
|
49
|
-
}) :
|
|
49
|
+
}) : j;
|
|
50
50
|
return /* @__PURE__ */ f("div", {
|
|
51
51
|
className: r("slds-notify slds-notify_alert slds-theme_alert-texture", {
|
|
52
52
|
"slds-theme_info": C === "info",
|
|
@@ -61,26 +61,26 @@ var p = { closeButton: "Close" }, m = {}, h = {
|
|
|
61
61
|
className: "slds-assistive-text",
|
|
62
62
|
children: h[C]
|
|
63
63
|
}),
|
|
64
|
-
|
|
64
|
+
M,
|
|
65
65
|
/* @__PURE__ */ f("h2", { children: [
|
|
66
|
-
|
|
66
|
+
k.heading,
|
|
67
67
|
" ",
|
|
68
|
-
|
|
68
|
+
k.headingLink && /* @__PURE__ */ d("a", {
|
|
69
69
|
onClick: t.trappedHandler(b),
|
|
70
70
|
href: "#",
|
|
71
|
-
children:
|
|
71
|
+
children: k.headingLink
|
|
72
72
|
})
|
|
73
73
|
] }),
|
|
74
74
|
_ && /* @__PURE__ */ d(a, {
|
|
75
|
-
assistiveText: { icon:
|
|
76
|
-
buttonRef:
|
|
75
|
+
assistiveText: { icon: O.closeButton },
|
|
76
|
+
buttonRef: A,
|
|
77
77
|
className: "slds-notify__close",
|
|
78
78
|
iconCategory: "utility",
|
|
79
79
|
iconName: "close",
|
|
80
80
|
iconSize: "medium",
|
|
81
81
|
inverse: !0,
|
|
82
82
|
onClick: x,
|
|
83
|
-
title:
|
|
83
|
+
title: O.closeButton,
|
|
84
84
|
variant: "icon"
|
|
85
85
|
})
|
|
86
86
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../components/alert/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, useRef, useEffect, useCallback, type ReactNode, type CSSProperties } from 'react';\nimport classNames from '../../utilities/class-names';\nimport Button from '../button';\nimport Icon from '../icon';\nimport { ALERT } from '../../utilities/constants';\nimport DOMElementFocus from '../../utilities/dom-element-focus';\nimport EventUtil from '../../utilities/event';\n\n/**\n * Alert variant types\n */\nexport type AlertVariant = 'error' | 'info' | 'offline' | 'warning';\n\n/**\n * Assistive text for Alert\n */\nexport interface AlertAssistiveText {\n\t/** Close button assistive text */\n\tcloseButton?: ReactNode;\n}\n\n/**\n * Labels for Alert\n */\nexport interface AlertLabels {\n\t/** Main heading content */\n\theading?: ReactNode;\n\t/** Link text in heading */\n\theadingLink?: ReactNode;\n}\n\n/**\n * Props for the Alert component\n */\nexport interface AlertProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: AlertAssistiveText;\n\t/** CSS classes for the alert container */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Show close button */\n\tdismissible?: boolean;\n\t/** Custom icon (defaults to variant-specific icon) */\n\ticon?: ReactNode;\n\t/** Text labels */\n\tlabels?: AlertLabels;\n\t/** Callback when heading link is clicked */\n\tonClickHeadingLink?: (event: React.MouseEvent) => void;\n\t/** Callback when close button is clicked */\n\tonRequestClose?: (event: React.MouseEvent) => void;\n\t/** Custom styles */\n\tstyle?: CSSProperties;\n\t/** Alert type/severity */\n\tvariant: AlertVariant;\n}\n\nconst defaultAssistiveText: AlertAssistiveText = {\n\tcloseButton: 'Close',\n};\n\nconst defaultLabels: AlertLabels = {};\n\nconst assistiveTextVariant: Record<AlertVariant, string> = {\n\tinfo: 'info',\n\twarning: 'warning',\n\terror: 'error',\n\toffline: 'offline',\n};\n\nconst defaultIcons: Record<AlertVariant, ReactNode> = {\n\tinfo: <Icon category=\"utility\" name=\"info\" />,\n\toffline: <Icon category=\"utility\" name=\"offline\" />,\n\twarning: <Icon category=\"utility\" name=\"warning\" />,\n\terror: <Icon category=\"utility\" name=\"error\" />,\n};\n\n/**\n * Alert banners communicate a state that affects the entire system, not just a feature or page.\n * It persists over a session and appears without the user initiating the action.\n */\nconst Alert = ({\n\tassistiveText: propAssistiveText,\n\tclassName,\n\tdismissible,\n\ticon: propIcon,\n\tlabels: propLabels,\n\tonClickHeadingLink,\n\tonRequestClose,\n\tstyle,\n\tvariant = 'info',\n}: AlertProps): React.ReactElement => {\n\tconst [isInitialRender, setIsInitialRender] = useState(true);\n\tconst closeButtonRef = useRef<HTMLButtonElement | null>(null);\n\n\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\tconst labels = { ...defaultLabels, ...propLabels };\n\n\t//
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../components/alert/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, useRef, useEffect, useCallback, type ReactNode, type CSSProperties } from 'react';\nimport classNames from '../../utilities/class-names';\nimport Button from '../button';\nimport Icon from '../icon';\nimport { ALERT } from '../../utilities/constants';\nimport DOMElementFocus from '../../utilities/dom-element-focus';\nimport EventUtil from '../../utilities/event';\n\n/**\n * Alert variant types\n */\nexport type AlertVariant = 'error' | 'info' | 'offline' | 'warning';\n\n/**\n * Assistive text for Alert\n */\nexport interface AlertAssistiveText {\n\t/** Close button assistive text */\n\tcloseButton?: ReactNode;\n}\n\n/**\n * Labels for Alert\n */\nexport interface AlertLabels {\n\t/** Main heading content */\n\theading?: ReactNode;\n\t/** Link text in heading */\n\theadingLink?: ReactNode;\n}\n\n/**\n * Props for the Alert component\n */\nexport interface AlertProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: AlertAssistiveText;\n\t/** CSS classes for the alert container */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Show close button */\n\tdismissible?: boolean;\n\t/** Custom icon (defaults to variant-specific icon) */\n\ticon?: ReactNode;\n\t/** Text labels */\n\tlabels?: AlertLabels;\n\t/** Callback when heading link is clicked */\n\tonClickHeadingLink?: (event: React.MouseEvent) => void;\n\t/** Callback when close button is clicked */\n\tonRequestClose?: (event: React.MouseEvent) => void;\n\t/** Custom styles */\n\tstyle?: CSSProperties;\n\t/** Alert type/severity */\n\tvariant: AlertVariant;\n}\n\nconst defaultAssistiveText: AlertAssistiveText = {\n\tcloseButton: 'Close',\n};\n\nconst defaultLabels: AlertLabels = {};\n\nconst assistiveTextVariant: Record<AlertVariant, string> = {\n\tinfo: 'info',\n\twarning: 'warning',\n\terror: 'error',\n\toffline: 'offline',\n};\n\nconst defaultIcons: Record<AlertVariant, ReactNode> = {\n\tinfo: <Icon category=\"utility\" name=\"info\" />,\n\toffline: <Icon category=\"utility\" name=\"offline\" />,\n\twarning: <Icon category=\"utility\" name=\"warning\" />,\n\terror: <Icon category=\"utility\" name=\"error\" />,\n};\n\n/**\n * Alert banners communicate a state that affects the entire system, not just a feature or page.\n * It persists over a session and appears without the user initiating the action.\n */\nconst Alert = ({\n\tassistiveText: propAssistiveText,\n\tclassName,\n\tdismissible,\n\ticon: propIcon,\n\tlabels: propLabels,\n\tonClickHeadingLink,\n\tonRequestClose,\n\tstyle,\n\tvariant = 'info',\n}: AlertProps): React.ReactElement => {\n\tconst [isInitialRender, setIsInitialRender] = useState(true);\n\tconst closeButtonRef = useRef<HTMLButtonElement | null>(null);\n\tconst hasStoredFocusRef = useRef(false);\n\n\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\tconst labels = { ...defaultLabels, ...propLabels };\n\n\t// Restore focus on unmount, but only if this Alert stored it. The stored\n\t// element is shared with other components (Popover, Toast), so restoring\n\t// unconditionally would take focus they stored.\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tif (hasStoredFocusRef.current) {\n\t\t\t\tDOMElementFocus.returnFocusToStoredElement();\n\t\t\t}\n\t\t};\n\t}, []);\n\n\tconst saveButtonRef = useCallback((component: HTMLButtonElement | null) => {\n\t\tcloseButtonRef.current = component;\n\t\tif (isInitialRender && component) {\n\t\t\tDOMElementFocus.storeActiveElement();\n\t\t\thasStoredFocusRef.current = true;\n\t\t\tcomponent.focus();\n\t\t\tsetIsInitialRender(false);\n\t\t}\n\t}, [isInitialRender]);\n\n\t// Get the icon to display\n\tconst icon = propIcon || defaultIcons[variant];\n\n\tconst clonedIcon = React.isValidElement(icon)\n\t\t? React.cloneElement(icon as React.ReactElement<{ containerClassName?: string; inverse?: boolean; size?: string }>, {\n\t\t\t\tcontainerClassName: 'slds-m-right_x-small',\n\t\t\t\tinverse: true,\n\t\t\t\tsize: 'x-small',\n\t\t })\n\t\t: icon;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames(\n\t\t\t\t'slds-notify slds-notify_alert slds-theme_alert-texture',\n\t\t\t\t{\n\t\t\t\t\t'slds-theme_info': variant === 'info',\n\t\t\t\t\t'slds-theme_warning': variant === 'warning',\n\t\t\t\t\t'slds-theme_error': variant === 'error',\n\t\t\t\t\t'slds-theme_offline': variant === 'offline',\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t)}\n\t\t\trole=\"alert\"\n\t\t\tstyle={style}\n\t\t>\n\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t{assistiveTextVariant[variant]}\n\t\t\t</span>\n\t\t\t{clonedIcon}\n\t\t\t<h2>\n\t\t\t\t{labels.heading}{' '}\n\t\t\t\t{labels.headingLink && (\n\t\t\t\t\t<a\n\t\t\t\t\t\tonClick={EventUtil.trappedHandler(onClickHeadingLink)}\n\t\t\t\t\t\thref=\"#\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{labels.headingLink}\n\t\t\t\t\t</a>\n\t\t\t\t)}\n\t\t\t</h2>\n\t\t\t{dismissible && (\n\t\t\t\t<Button\n\t\t\t\t\tassistiveText={{ icon: assistiveText.closeButton as string }}\n\t\t\t\t\tbuttonRef={saveButtonRef}\n\t\t\t\t\tclassName=\"slds-notify__close\"\n\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\ticonName=\"close\"\n\t\t\t\t\ticonSize=\"medium\"\n\t\t\t\t\tinverse\n\t\t\t\t\tonClick={onRequestClose}\n\t\t\t\t\ttitle={assistiveText.closeButton as string}\n\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nAlert.displayName = ALERT;\n\nexport default Alert;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],"mappings":";;;;;;;;;AA0DA,IAAM,IAA2C,EAChD,aAAa,QACd,GAEM,IAA6B,CAAC,GAE9B,IAAqD;CAC1D,MAAM;CACN,SAAS;CACT,OAAO;CACP,SAAS;AACV,GAEM,IAAgD;CACrD,MAAM,kBAAC,GAAD;EAAM,UAAS;EAAU,MAAK;CAAQ,CAAA;CAC5C,SAAS,kBAAC,GAAD;EAAM,UAAS;EAAU,MAAK;CAAW,CAAA;CAClD,SAAS,kBAAC,GAAD;EAAM,UAAS;EAAU,MAAK;CAAW,CAAA;CAClD,OAAO,kBAAC,GAAD;EAAM,UAAS;EAAU,MAAK;CAAS,CAAA;AAC/C,GAMM,KAAS,EACd,eAAe,GACf,cACA,gBACA,MAAM,GACN,QAAQ,GACR,uBACA,mBACA,UACA,aAAU,aAC2B;CACrC,IAAM,CAAC,GAAiB,KAAsB,EAAS,EAAI,GACrD,IAAiB,EAAiC,IAAI,GACtD,IAAoB,EAAO,EAAK,GAEhC,IAAgB;EAAE,GAAG;EAAsB,GAAG;CAAkB,GAChE,IAAS;EAAE,GAAG;EAAe,GAAG;CAAW;CAKjD,cACc;EACZ,AAAI,EAAkB,WACrB,EAAgB,2BAA2B;CAE7C,GACE,CAAC,CAAC;CAEL,IAAM,IAAgB,GAAa,MAAwC;EAE1E,AADA,EAAe,UAAU,GACrB,KAAmB,MACtB,EAAgB,mBAAmB,GACnC,EAAkB,UAAU,IAC5B,EAAU,MAAM,GAChB,EAAmB,EAAK;CAE1B,GAAG,CAAC,CAAe,CAAC,GAGd,IAAO,KAAY,EAAa,IAEhC,IAAa,EAAM,eAAe,CAAI,IACzC,EAAM,aAAa,GAA+F;EAClH,oBAAoB;EACpB,SAAS;EACT,MAAM;CACN,CAAC,IACD;CAEH,OACC,kBAAC,OAAD;EACC,WAAW,EACV,0DACA;GACC,mBAAmB,MAAY;GAC/B,sBAAsB,MAAY;GAClC,oBAAoB,MAAY;GAChC,sBAAsB,MAAY;EACnC,GACA,CACD;EACA,MAAK;EACE;EAZR,UAAA;GAcC,kBAAC,QAAD;IAAM,WAAU;IACd,UAAA,EAAqB;GACjB,CAAA;GACL;GACD,kBAAC,MAAD,EAAA,UAAA;IACE,EAAO;IAAS;IAChB,EAAO,eACP,kBAAC,KAAD;KACC,SAAS,EAAU,eAAe,CAAkB;KACpD,MAAK;KAEJ,UAAA,EAAO;IACN,CAAA;GAED,EAAA,CAAA;GACH,KACA,kBAAC,GAAD;IACC,eAAe,EAAE,MAAM,EAAc,YAAsB;IAC3D,WAAW;IACX,WAAU;IACV,cAAa;IACb,UAAS;IACT,UAAS;IACT,SAAA;IACA,SAAS;IACT,OAAO,EAAc;IACrB,SAAQ;GACR,CAAA;EAEE;;AAEP;AAEA,EAAM,cAAc"}
|
|
@@ -10,7 +10,7 @@ var o = { icon: "User or Account Icon" }, s = (e) => {
|
|
|
10
10
|
}, c = ({ assistiveText: e, imgAlt: c = "", imgSrc: l, initials: u, inverse: d, label: f, size: p = "medium", title: m = "user avatar", variant: h = "user" }) => {
|
|
11
11
|
let [g, _] = i(!1), v = r(() => {
|
|
12
12
|
_(!0);
|
|
13
|
-
}, []), y =
|
|
13
|
+
}, []), y = {
|
|
14
14
|
...o,
|
|
15
15
|
...e
|
|
16
16
|
}.icon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","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.js","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":";;;;;;AAkDA,IAAM,IAA4C,EACjD,MAAM,uBACP,GAQM,KAAiB,MAA0B;CAChD,IAAM,IAAO,EAAM,KAAK,GAClB,IAAY,EAAK,MAAM,GAAG;CAOhC,OANI,EAAU,SAAS,IAErB,EAAU,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,IACnC,EAAU,EAAU,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,KAGhD,EAAK,MAAM,GAAA,CAAI,YAAY,KAAK,EAAK,MAAM,GAAA,CAAI,YAAY;AACpE,GAQM,KAAU,EACf,eAAe,GACf,YAAS,IACT,WACA,aACA,YACA,UACA,UAAO,UACP,WAAQ,eACR,aAAU,aAC4B;CACtC,IAAM,CAAC,GAAc,KAAmB,EAAS,EAAK,GAEhD,IAAmB,QAAkB;EAC1C,EAAgB,EAAI;CACrB,GAAG,CAAC,CAAC,GAGC,IAAoB;EACzB,GAAG;EACH,GAAG;CACJ,EAAE;CAuCF,OACC,kBAAC,OAAD,EAAA,UACC,kBAAC,QAAD;EACC,WAAW,EAAW,eAAe;GACpC,sBAAsB,MAAY;GAClC,uBAAuB,MAAS;GAChC,qBAAqB,MAAS;GAC9B,sBAAsB,MAAS;GAC/B,qBAAqB,MAAS;EAC/B,CAAC;EAEA,UApBC,CAAC,KAAgB,IA1BrB,kBAAC,OAAD;GAAK,KAAK;GAAQ,KAAK;GAAQ,SAAS;GAAyB;EAAQ,CAAA,IA6BrE,KAAa,KAAS,EAAM,KAAK,IAjBrC,kBAAC,QAAD;GACC,WAAW,EAAW,yBAAyB;IAC9C,iCAAiC;IACjC,8BAA8B,MAAY;IAC1C,2BAA2B,MAAY;GACxC,CAAC;GACD,OAAO;GAEN,UAAA,MAAa,IAAQ,EAAc,CAAK,IAAI;EACxC,CAAA,IAjBN,kBAAC,GAAD;GACC,eAAe,EAAE,OAAO,EAAkB;GAC1C,UAAS;GACT,MAAM,MAAY,WAAW,YAAY;EACzC,CAAA;CAuCM,CAAA,EACF,CAAA;AAEP;AAEA,EAAO,cAAc"}
|
|
@@ -14,6 +14,7 @@ var o = ({ className: e, color: o = "default", content: s, icon: c, iconAlignmen
|
|
|
14
14
|
className: n("slds-badge", {
|
|
15
15
|
"slds-badge_inverse": o === "inverse",
|
|
16
16
|
"slds-badge_lightest": o === "light",
|
|
17
|
+
"slds-theme_info": o === "info",
|
|
17
18
|
"slds-theme_success": o === "success",
|
|
18
19
|
"slds-theme_warning": o === "warning",
|
|
19
20
|
"slds-theme_error": o === "error"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../components/badge/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, { useId, type ReactNode, type CSSProperties } from 'react';\nimport classNames from 'classnames';\nimport { BADGE } from '../../utilities/constants';\n\n/**\n * Badge color variants\n */\nexport type BadgeColor
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../components/badge/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, { useId, type ReactNode, type CSSProperties } from 'react';\nimport classNames from 'classnames';\nimport { BADGE } from '../../utilities/constants';\n\n/**\n * Badge color variants\n */\nexport type BadgeColor =\n\t'default' | 'inverse' | 'light' | 'info' | 'success' | 'warning' | 'error';\n\n/**\n * Badge icon alignment\n */\nexport type BadgeIconAlignment = 'left' | 'right';\n\n/**\n * Props for the Badge component\n */\nexport interface BadgeProps {\n\t/** CSS classes for the badge */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Color variant */\n\tcolor?: BadgeColor;\n\t/** Content inside the badge */\n\tcontent?: ReactNode;\n\t/** Icon to display */\n\ticon?: ReactNode;\n\t/** Icon alignment relative to content */\n\ticonAlignment?: BadgeIconAlignment;\n\t/** Unique identifier */\n\tid?: string;\n\t/** Custom styles */\n\tstyle?: CSSProperties;\n}\n\n/**\n * Badges are labels which hold small amounts of information.\n */\nconst Badge = ({\n\tclassName,\n\tcolor = 'default',\n\tcontent,\n\ticon,\n\ticonAlignment = 'left',\n\tid: propId,\n\tstyle,\n}: BadgeProps): React.ReactElement => {\n\tconst generatedId = useId();\n\tconst id = propId || generatedId;\n\n\tconst iconElement = icon && (\n\t\t<span\n\t\t\tclassName={classNames(\n\t\t\t\t'slds-badge__icon',\n\t\t\t\t`slds-badge__icon_${iconAlignment}`\n\t\t\t)}\n\t\t\tstyle={style}\n\t\t>\n\t\t\t{icon}\n\t\t</span>\n\t);\n\n\treturn (\n\t\t<span\n\t\t\tid={id}\n\t\t\tclassName={classNames(\n\t\t\t\t'slds-badge',\n\t\t\t\t{\n\t\t\t\t\t'slds-badge_inverse': color === 'inverse',\n\t\t\t\t\t'slds-badge_lightest': color === 'light',\n\t\t\t\t\t'slds-theme_info': color === 'info',\n\t\t\t\t\t'slds-theme_success': color === 'success',\n\t\t\t\t\t'slds-theme_warning': color === 'warning',\n\t\t\t\t\t'slds-theme_error': color === 'error',\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t)}\n\t\t>\n\t\t\t{iconAlignment === 'left' ? (\n\t\t\t\t<>\n\t\t\t\t\t{iconElement}\n\t\t\t\t\t{content}\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{content}\n\t\t\t\t\t{iconElement}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</span>\n\t);\n};\n\nBadge.displayName = BADGE;\n\nexport default Badge;\n"],"mappings":";;;;;AAyCA,IAAM,KAAS,EACd,cACA,WAAQ,WACR,YACA,SACA,mBAAgB,QAChB,IAAI,GACJ,eACqC;CACrC,IAAM,IAAc,EAAM,GACpB,IAAK,KAAU,GAEf,IAAc,KACnB,kBAAC,QAAD;EACC,WAAW,EACV,oBACA,oBAAoB,GACrB;EACO;EAEN,UAAA;CACI,CAAA;CAGP,OACC,kBAAC,QAAD;EACK;EACJ,WAAW,EACV,cACA;GACC,sBAAsB,MAAU;GAChC,uBAAuB,MAAU;GACjC,mBAAmB,MAAU;GAC7B,sBAAsB,MAAU;GAChC,sBAAsB,MAAU;GAChC,oBAAoB,MAAU;EAC/B,GACA,CACD;EAEC,UAAA,MAAkB,SAClB,kBAAA,GAAA,EAAA,UAAA,CACE,GACA,CACA,EAAA,CAAA,IAEF,kBAAA,GAAA,EAAA,UAAA,CACE,GACA,CACA,EAAA,CAAA;CAEE,CAAA;AAER;AAEA,EAAM,cAAc"}
|
|
@@ -17,7 +17,7 @@ var i = { label: "Breadcrumbs" }, a = (e, r) => {
|
|
|
17
17
|
children: /* @__PURE__ */ n(t, { ...i })
|
|
18
18
|
});
|
|
19
19
|
}, o = ({ assistiveText: e, id: t, overflowDropdownMenu: o, styleContainer: s, trail: c }) => {
|
|
20
|
-
let l =
|
|
20
|
+
let l = {
|
|
21
21
|
...i,
|
|
22
22
|
...e
|
|
23
23
|
}.label;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","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.js","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":";;;;;AAmCA,IAAM,IAAgD,EACrD,OAAO,cACR,GAKM,KACL,GACA,MACI;CAEJ,IAAM,IAA4B;EACjC,GAFiB,EAAqB;EAGtC,IAAI,GAAG,EAAM,GAAG;EAChB,cAAc;EACd,UAAU;EACV,aAAa;EACb,WAAW;CACZ;CACA,OACC,kBAAC,MAAD;EAAI,WAAU;EACb,UAAA,kBAAC,GAAD,EAAU,GAAI,EAA4B,CAAA;CACvC,CAAA;AAEN,GAKM,KAAc,EACnB,eAAe,GACf,OACA,yBACA,mBACA,eAC0C;CAC1C,IAAM,IAAqB;EAC1B,GAAG;EACH,GAAG;CACJ,EAAE;CAEF,OACC,kBAAC,OAAD;EACC,MAAK;EACL,cAAY;EACZ,OAAO;EAEP,UAAA,kBAAC,MAAD;GAAI,WAAU;GAAd,UAAA,CACE,KACA,EAAsB,GAAsB,EAAE,MAAG,CAAC,GAClD,EAAM,KAAK,GAAO,MAClB,kBAAC,MAAD;IAAgB,WAAU;IACxB,UAAA;GACE,GAFK,CAEL,CACJ,CACE;;CACA,CAAA;AAEP;AAEA,EAAW,cAAc"}
|
|
@@ -30,7 +30,7 @@ var f = { icon: "" }, p = o((e, o) => {
|
|
|
30
30
|
}, X = (e) => {
|
|
31
31
|
A && A(e, { id: E });
|
|
32
32
|
}, Z = (e) => {
|
|
33
|
-
let n = !w || T ? void 0 : w;
|
|
33
|
+
let n = !w || T || w === "xx-small" ? void 0 : w;
|
|
34
34
|
return /* @__PURE__ */ u(t, {
|
|
35
35
|
category: y || "utility",
|
|
36
36
|
className: l({ "slds-global-header__icon": T === "global-header" }, b),
|
|
@@ -42,7 +42,7 @@ var f = { icon: "" }, p = o((e, o) => {
|
|
|
42
42
|
size: n
|
|
43
43
|
});
|
|
44
44
|
}, Q = () => {
|
|
45
|
-
let e = x || S, t =
|
|
45
|
+
let e = x || S, t = {
|
|
46
46
|
...f,
|
|
47
47
|
...p
|
|
48
48
|
}.icon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","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 = '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/** Icon size */\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?: (event: MouseEvent<HTMLButtonElement>, data?: { id?: string }) => 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 =\n\t\t\t\tinverse && 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\tconst computedIconSize =\n\t\t\t\t!iconSize || iconVariant ? undefined : 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 }.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={typeof tabIndex === 'string' ? parseInt(tabIndex, 10) : tabIndex}\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":"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"}
|
|
1
|
+
{"version":3,"file":"index.js","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":"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"}
|
|
@@ -17,8 +17,9 @@ var u = { icon: "" }, d = {
|
|
|
17
17
|
label: "Unfollow"
|
|
18
18
|
}, m = ({ active: e, assistiveText: m, className: h, disabled: g = !1, icon: _, iconName: v, iconSize: y = "medium", id: b, onBlur: x, onClick: S, onFocus: C, onKeyDown: w, onKeyPress: T, onKeyUp: E, onMouseDown: D, onMouseEnter: O, responsive: k = !1, stateOne: A = d, stateTwo: j = f, stateThree: M = p, tabIndex: N, variant: P, ...F }) => {
|
|
19
19
|
let [I, L] = a(!1), R = typeof e == "boolean" ? e : I, z = i((e) => o(h, "slds-button", "slds-button_stateful", {
|
|
20
|
-
"slds-button_neutral": P !== "icon" && P !== "icon-filled",
|
|
20
|
+
"slds-button_neutral": P !== "icon" && P !== "icon-filled" && P !== "success" && P !== "text",
|
|
21
21
|
"slds-button_inverse": P === "inverse",
|
|
22
|
+
"slds-button_success": P === "success",
|
|
22
23
|
"slds-not-selected": !e,
|
|
23
24
|
"slds-is-selected": e,
|
|
24
25
|
"slds-max-small-button_stretch": k,
|
|
@@ -29,14 +30,14 @@ var u = { icon: "" }, d = {
|
|
|
29
30
|
P,
|
|
30
31
|
k
|
|
31
32
|
]), B = i((e) => {
|
|
32
|
-
x &&
|
|
33
|
+
x && x(e), e.currentTarget.matches(":focus-visible") || e.currentTarget.blur();
|
|
33
34
|
}, [x]), V = i((t) => {
|
|
34
35
|
l(S) && S(t), typeof e != "boolean" && L((e) => !e);
|
|
35
36
|
}, [S, e]), H = {
|
|
36
37
|
disabled: g,
|
|
37
38
|
size: "small",
|
|
38
39
|
className: "slds-button__icon_stateful"
|
|
39
|
-
}, U =
|
|
40
|
+
}, U = {
|
|
40
41
|
...u,
|
|
41
42
|
...m
|
|
42
43
|
}.icon, W = n(F);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","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 = 'base' | 'neutral' | 'brand' | 'destructive' | 'icon' | 'icon-filled' | 'inverse';\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 */\n\tvariant?: ButtonStatefulVariant;\n}\n\nconst defaultAssistiveText: ButtonStatefulAssistiveText = { icon: '' };\n\nconst defaultStateOne: ButtonStatefulState = { iconName: 'add', label: 'Follow' };\nconst defaultStateTwo: ButtonStatefulState = { iconName: 'check', label: 'Following' };\nconst defaultStateThree: ButtonStatefulState = { iconName: 'close', label: 'Unfollow' };\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 = typeof 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': variant !== 'icon' && variant !== 'icon-filled',\n\t\t\t\t'slds-button_inverse': variant === 'inverse',\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 && 'relatedTarget' in e) onBlur(e as FocusEvent<HTMLButtonElement>);\n\t\t\te.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(icon as React.ReactElement<Record<string, unknown>>, {\n\t\t\t\t\t\t...defaultIconProps,\n\t\t\t\t\t\t...((icon as React.ReactElement<Record<string, unknown>>).props || {}),\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 = { ...defaultIconProps, position: 'left' as const };\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(stateOne.icon as React.ReactElement<Record<string, unknown>>, {\n\t\t\t\t\t\t...defaultIconPropsWithPosition,\n\t\t\t\t\t\t...((stateOne.icon as React.ReactElement<Record<string, unknown>>).props || {}),\n\t\t\t\t\t\tsize: 'small',\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(stateTwo.icon as React.ReactElement<Record<string, unknown>>, {\n\t\t\t\t\t\t...defaultIconPropsWithPosition,\n\t\t\t\t\t\t...((stateTwo.icon as React.ReactElement<Record<string, unknown>>).props || {}),\n\t\t\t\t\t\tsize: 'small',\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(stateThree.icon as React.ReactElement<Record<string, unknown>>, {\n\t\t\t\t\t\t...defaultIconPropsWithPosition,\n\t\t\t\t\t\t...((stateThree.icon as React.ReactElement<Record<string, unknown>>).props || {}),\n\t\t\t\t\t\tsize: 'small',\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\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"index.js","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":"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"}
|
|
@@ -27,13 +27,13 @@ var ne = {
|
|
|
27
27
|
requestedPanel: t
|
|
28
28
|
}) : (oe(t), n && setTimeout(n, 0));
|
|
29
29
|
}, [H, D]), Y = c((e, t = !1) => {
|
|
30
|
-
B.current &&= (clearInterval(B.current), null), t || (E ? E(e, { isAutoplayOn:
|
|
31
|
-
}, [
|
|
30
|
+
B.current &&= (clearInterval(B.current), null), t || (E ? E(e, { isAutoplayOn: !1 }) : N(!1));
|
|
31
|
+
}, [E]), X = c(() => {
|
|
32
32
|
B.current = setInterval(() => {
|
|
33
33
|
if (H < A - 1) {
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
} else S ? J(
|
|
34
|
+
let e = H + 1;
|
|
35
|
+
e > A - 1 && (e = 0), J(void 0, e, q);
|
|
36
|
+
} else S ? J(void 0, 0, q) : Y(void 0);
|
|
37
37
|
}, g);
|
|
38
38
|
}, [
|
|
39
39
|
g,
|
|
@@ -71,11 +71,7 @@ var ne = {
|
|
|
71
71
|
]), ue = c((e) => {
|
|
72
72
|
F(!0), U && Y(e);
|
|
73
73
|
}, [U, Y]), de = c((e) => {
|
|
74
|
-
|
|
75
|
-
else {
|
|
76
|
-
let t = U ? Y : X;
|
|
77
|
-
N(!U), t(e);
|
|
78
|
-
}
|
|
74
|
+
E ? E(e, { isAutoplayOn: !U }) : (N(!U), U ? Y(e) : X());
|
|
79
75
|
}, [
|
|
80
76
|
U,
|
|
81
77
|
E,
|
|
@@ -107,13 +103,13 @@ var ne = {
|
|
|
107
103
|
}), [$]), l(() => {
|
|
108
104
|
q();
|
|
109
105
|
}, [q]), l(() => {
|
|
110
|
-
x !== void 0 && (x && !B.current ? X(
|
|
106
|
+
x !== void 0 && (x && !B.current ? X() : !x && B.current && Y(void 0, !0));
|
|
111
107
|
}, [
|
|
112
108
|
x,
|
|
113
109
|
X,
|
|
114
110
|
Y
|
|
115
111
|
]), l(() => {
|
|
116
|
-
U && !B.current && X(
|
|
112
|
+
U && !B.current && X();
|
|
117
113
|
}, []);
|
|
118
114
|
let pe = !(S || G()), me = !(S || W()), he = (I || V.current) / w, ge = y ? {
|
|
119
115
|
marginLeft: "44px",
|