@salesforce/design-system-react 11.0.0-rc.0 → 11.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/cjs/components/alert/index.cjs +1 -1
- package/dist/cjs/components/alert/index.cjs.map +1 -1
- package/dist/cjs/components/builder-header/nav-link.cjs.map +1 -1
- package/dist/cjs/components/button/check-props.cjs +1 -1
- package/dist/cjs/components/button/check-props.cjs.map +1 -1
- package/dist/cjs/components/button/index.cjs +1 -1
- package/dist/cjs/components/button/index.cjs.map +1 -1
- package/dist/cjs/components/button-stateful/check-props.cjs +1 -1
- package/dist/cjs/components/button-stateful/check-props.cjs.map +1 -1
- package/dist/cjs/components/button-stateful/index.cjs +1 -1
- package/dist/cjs/components/button-stateful/index.cjs.map +1 -1
- package/dist/cjs/components/carousel/index.cjs +1 -1
- package/dist/cjs/components/carousel/index.cjs.map +1 -1
- package/dist/cjs/components/carousel/private/carousel-indicators.cjs.map +1 -1
- package/dist/cjs/components/carousel/private/carousel-item.cjs +1 -1
- package/dist/cjs/components/carousel/private/carousel-item.cjs.map +1 -1
- package/dist/cjs/components/checkbox/check-props.cjs +1 -1
- package/dist/cjs/components/checkbox/check-props.cjs.map +1 -1
- package/dist/cjs/components/checkbox/index.cjs +1 -1
- package/dist/cjs/components/checkbox/index.cjs.map +1 -1
- package/dist/cjs/components/color-picker/color-picker.cjs +1 -1
- package/dist/cjs/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/cjs/components/color-picker/private/custom-color.cjs.map +1 -1
- package/dist/cjs/components/color-picker/private/hsv-color.cjs +1 -1
- package/dist/cjs/components/color-picker/private/hsv-color.cjs.map +1 -1
- package/dist/cjs/components/color-picker/private/swatch-option.cjs +1 -1
- package/dist/cjs/components/color-picker/private/swatch-option.cjs.map +1 -1
- package/dist/cjs/components/color-picker/private/swatch.cjs +1 -1
- package/dist/cjs/components/color-picker/private/swatch.cjs.map +1 -1
- package/dist/cjs/components/combobox/combobox.cjs +1 -1
- package/dist/cjs/components/combobox/combobox.cjs.map +1 -1
- package/dist/cjs/components/combobox/index.cjs +1 -1
- package/dist/cjs/components/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/date-picker.cjs +1 -1
- package/dist/cjs/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/cjs/components/date-picker/private/calendar.cjs.map +1 -1
- package/dist/cjs/components/date-picker/private/day.cjs +1 -1
- package/dist/cjs/components/date-picker/private/day.cjs.map +1 -1
- package/dist/cjs/components/files/file.cjs +1 -8
- package/dist/cjs/components/files/file.cjs.map +1 -1
- package/dist/cjs/components/files/private/file-actions.cjs +1 -1
- package/dist/cjs/components/files/private/file-actions.cjs.map +1 -1
- package/dist/cjs/components/files/private/file-figure.cjs +1 -1
- package/dist/cjs/components/files/private/file-figure.cjs.map +1 -1
- package/dist/cjs/components/filter/filter.cjs +1 -1
- package/dist/cjs/components/filter/filter.cjs.map +1 -1
- package/dist/cjs/components/icon/check-props.cjs +1 -1
- package/dist/cjs/components/icon/check-props.cjs.map +1 -1
- package/dist/cjs/components/icon/index.cjs +1 -1
- package/dist/cjs/components/icon/index.cjs.map +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.map +1 -1
- package/dist/cjs/components/input/private/inner-input.cjs.map +1 -1
- package/dist/cjs/components/input/search.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/button-trigger.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs +1 -1
- package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs.map +1 -1
- package/dist/cjs/components/modal/index.cjs +1 -1
- package/dist/cjs/components/modal/index.cjs.map +1 -1
- package/dist/cjs/components/pill/index.cjs.map +1 -1
- package/dist/cjs/components/pill-container/index.cjs +1 -1
- package/dist/cjs/components/pill-container/index.cjs.map +1 -1
- package/dist/cjs/components/popover/index.cjs.map +1 -1
- package/dist/cjs/components/popover/popover.cjs +1 -1
- package/dist/cjs/components/popover/popover.cjs.map +1 -1
- package/dist/cjs/components/progress-indicator/private/step.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-group/index.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/cell.cjs +1 -1
- package/dist/cjs/components/simple-data-table/cell.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/index.cjs +1 -1
- package/dist/cjs/components/simple-data-table/index.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/interactive-element.cjs +1 -1
- package/dist/cjs/components/simple-data-table/interactive-element.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/cell-context.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/corner-style.cjs +2 -0
- package/dist/cjs/components/simple-data-table/private/corner-style.cjs.map +1 -0
- package/dist/cjs/components/simple-data-table/private/head.cjs +1 -1
- package/dist/cjs/components/simple-data-table/private/head.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/header-cell.cjs +1 -1
- package/dist/cjs/components/simple-data-table/private/header-cell.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/link.cjs +1 -1
- package/dist/cjs/components/simple-data-table/private/link.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/row.cjs +1 -1
- package/dist/cjs/components/simple-data-table/private/row.cjs.map +1 -1
- package/dist/cjs/components/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.map +1 -1
- package/dist/cjs/components/split-view/listbox.cjs.map +1 -1
- package/dist/cjs/components/split-view/private/list-item-with-content.cjs.map +1 -1
- package/dist/cjs/components/tabs/index.cjs.map +1 -1
- package/dist/cjs/components/tabs/private/tab.cjs +1 -1
- package/dist/cjs/components/tabs/private/tab.cjs.map +1 -1
- package/dist/cjs/components/textarea/check-props.cjs +1 -1
- package/dist/cjs/components/textarea/check-props.cjs.map +1 -1
- package/dist/cjs/components/textarea/index.cjs +1 -1
- package/dist/cjs/components/textarea/index.cjs.map +1 -1
- package/dist/cjs/components/toast/index.cjs.map +1 -1
- package/dist/cjs/components/tooltip/index.cjs +1 -3
- package/dist/cjs/components/tooltip/index.cjs.map +1 -1
- package/dist/cjs/components/tree/private/branch.cjs.map +1 -1
- package/dist/cjs/components/tree/private/item.cjs.map +1 -1
- package/dist/cjs/components/tree/private/render-branch.cjs +1 -1
- package/dist/cjs/components/tree/private/render-branch.cjs.map +1 -1
- package/dist/cjs/components/utilities/dialog/index.cjs +1 -1
- package/dist/cjs/components/utilities/dialog/index.cjs.map +1 -1
- package/dist/cjs/components/utilities/dialog/portal.cjs +1 -1
- package/dist/cjs/components/utilities/dialog/portal.cjs.map +1 -1
- package/dist/cjs/components/utilities/menu-list/index.cjs +1 -26
- package/dist/cjs/components/utilities/menu-list/index.cjs.map +1 -1
- package/dist/cjs/components/utilities/menu-list/item.cjs +1 -1
- package/dist/cjs/components/utilities/menu-list/item.cjs.map +1 -1
- package/dist/cjs/components/utilities/utility-icon/index.cjs +1 -1
- package/dist/cjs/components/utilities/utility-icon/index.cjs.map +1 -1
- package/dist/cjs/utilities/color.cjs +1 -1
- package/dist/cjs/utilities/color.cjs.map +1 -1
- package/dist/cjs/utilities/dom-element-focus.cjs.map +1 -1
- package/dist/cjs/utilities/execution-environment.cjs.map +1 -1
- package/dist/cjs/utilities/get-aria-props.cjs +1 -1
- package/dist/cjs/utilities/get-aria-props.cjs.map +1 -1
- package/dist/cjs/utilities/get-data-props.cjs +1 -1
- package/dist/cjs/utilities/get-data-props.cjs.map +1 -1
- package/dist/cjs/utilities/keyboard-navigable-dialog.cjs +1 -1
- package/dist/cjs/utilities/keyboard-navigable-dialog.cjs.map +1 -1
- package/dist/cjs/utilities/keyboard-navigate.cjs +1 -1
- package/dist/cjs/utilities/keyboard-navigate.cjs.map +1 -1
- package/dist/cjs/utilities/product-tokens/icon-backgrounds.cjs.map +1 -1
- package/dist/cjs/utilities/warning/children-as-trigger.cjs +1 -1
- package/dist/cjs/utilities/warning/children-as-trigger.cjs.map +1 -1
- package/dist/cjs/utilities/warning/deprecated-property-value.cjs +1 -1
- package/dist/cjs/utilities/warning/deprecated-property-value.cjs.map +1 -1
- package/dist/cjs/utilities/warning/deprecated-property.cjs +1 -1
- package/dist/cjs/utilities/warning/deprecated-property.cjs.map +1 -1
- package/dist/cjs/utilities/warning/has-children-without-display-name-of.cjs +1 -1
- package/dist/cjs/utilities/warning/has-children-without-display-name-of.cjs.map +1 -1
- package/dist/cjs/utilities/warning/if-one-then-both-required-property.cjs +1 -1
- package/dist/cjs/utilities/warning/if-one-then-both-required-property.cjs.map +1 -1
- package/dist/cjs/utilities/warning/is-trigger-tabbable.cjs +1 -1
- package/dist/cjs/utilities/warning/is-trigger-tabbable.cjs.map +1 -1
- package/dist/cjs/utilities/warning/low-priority-warning.cjs.map +1 -1
- package/dist/cjs/utilities/warning/one-of-required-property.cjs +1 -1
- package/dist/cjs/utilities/warning/one-of-required-property.cjs.map +1 -1
- package/dist/cjs/utilities/warning/only-one-of-properties.cjs +1 -1
- package/dist/cjs/utilities/warning/only-one-of-properties.cjs.map +1 -1
- package/dist/cjs/utilities/warning/render-function-return-contents-lack-display-name.cjs +1 -1
- package/dist/cjs/utilities/warning/render-function-return-contents-lack-display-name.cjs.map +1 -1
- package/dist/cjs/utilities/warning/required-property.cjs +1 -1
- package/dist/cjs/utilities/warning/required-property.cjs.map +1 -1
- package/dist/cjs/utilities/warning/sunset-property.cjs +1 -1
- package/dist/cjs/utilities/warning/sunset-property.cjs.map +1 -1
- package/dist/cjs/utilities/warning/warned-registry.cjs +2 -0
- package/dist/cjs/utilities/warning/warned-registry.cjs.map +1 -0
- package/dist/es/components/alert/index.js +4 -5
- package/dist/es/components/alert/index.js.map +1 -1
- package/dist/es/components/builder-header/nav-link.js.map +1 -1
- package/dist/es/components/button/check-props.js +1 -1
- package/dist/es/components/button/check-props.js.map +1 -1
- package/dist/es/components/button/index.js +50 -50
- package/dist/es/components/button/index.js.map +1 -1
- package/dist/es/components/button-stateful/check-props.js +1 -1
- package/dist/es/components/button-stateful/check-props.js.map +1 -1
- package/dist/es/components/button-stateful/index.js +3 -2
- package/dist/es/components/button-stateful/index.js.map +1 -1
- package/dist/es/components/carousel/index.js +155 -129
- package/dist/es/components/carousel/index.js.map +1 -1
- package/dist/es/components/carousel/private/carousel-indicators.js.map +1 -1
- package/dist/es/components/carousel/private/carousel-item.js +1 -1
- package/dist/es/components/carousel/private/carousel-item.js.map +1 -1
- package/dist/es/components/checkbox/check-props.js +1 -1
- package/dist/es/components/checkbox/check-props.js.map +1 -1
- package/dist/es/components/checkbox/index.js +102 -100
- package/dist/es/components/checkbox/index.js.map +1 -1
- package/dist/es/components/color-picker/color-picker.js +150 -151
- package/dist/es/components/color-picker/color-picker.js.map +1 -1
- package/dist/es/components/color-picker/private/custom-color.js.map +1 -1
- package/dist/es/components/color-picker/private/hsv-color.js +16 -20
- package/dist/es/components/color-picker/private/hsv-color.js.map +1 -1
- package/dist/es/components/color-picker/private/swatch-option.js +2 -2
- package/dist/es/components/color-picker/private/swatch-option.js.map +1 -1
- package/dist/es/components/color-picker/private/swatch.js +1 -1
- package/dist/es/components/color-picker/private/swatch.js.map +1 -1
- package/dist/es/components/combobox/combobox.js +565 -580
- package/dist/es/components/combobox/combobox.js.map +1 -1
- package/dist/es/components/combobox/index.js +6 -19
- package/dist/es/components/combobox/index.js.map +1 -1
- package/dist/es/components/combobox/private/menu.js +3 -3
- package/dist/es/components/combobox/private/menu.js.map +1 -1
- package/dist/es/components/date-picker/date-picker.js +101 -102
- package/dist/es/components/date-picker/date-picker.js.map +1 -1
- package/dist/es/components/date-picker/private/calendar.js.map +1 -1
- package/dist/es/components/date-picker/private/day.js +1 -1
- package/dist/es/components/date-picker/private/day.js.map +1 -1
- package/dist/es/components/files/file.js +5 -6
- package/dist/es/components/files/file.js.map +1 -1
- package/dist/es/components/files/private/file-actions.js +2 -2
- package/dist/es/components/files/private/file-actions.js.map +1 -1
- package/dist/es/components/files/private/file-figure.js +1 -1
- package/dist/es/components/files/private/file-figure.js.map +1 -1
- package/dist/es/components/filter/filter.js +5 -1
- package/dist/es/components/filter/filter.js.map +1 -1
- package/dist/es/components/icon/check-props.js +9 -7
- package/dist/es/components/icon/check-props.js.map +1 -1
- package/dist/es/components/icon/index.js +13 -10
- package/dist/es/components/icon/index.js.map +1 -1
- package/dist/es/components/input/check-props.js +14 -13
- package/dist/es/components/input/check-props.js.map +1 -1
- package/dist/es/components/input/index.js.map +1 -1
- package/dist/es/components/input/private/inner-input.js.map +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/menu-dropdown.js +202 -207
- package/dist/es/components/menu-dropdown/menu-dropdown.js.map +1 -1
- package/dist/es/components/modal/index.js +1 -2
- package/dist/es/components/modal/index.js.map +1 -1
- package/dist/es/components/pill/index.js.map +1 -1
- package/dist/es/components/pill-container/index.js +10 -6
- package/dist/es/components/pill-container/index.js.map +1 -1
- package/dist/es/components/popover/index.js.map +1 -1
- package/dist/es/components/popover/popover.js +181 -177
- package/dist/es/components/popover/popover.js.map +1 -1
- package/dist/es/components/progress-indicator/private/step.js.map +1 -1
- package/dist/es/components/radio/index.js +1 -1
- package/dist/es/components/radio/index.js.map +1 -1
- package/dist/es/components/radio-group/index.js.map +1 -1
- package/dist/es/components/simple-data-table/cell.js +8 -5
- package/dist/es/components/simple-data-table/cell.js.map +1 -1
- package/dist/es/components/simple-data-table/index.js +97 -91
- package/dist/es/components/simple-data-table/index.js.map +1 -1
- package/dist/es/components/simple-data-table/interactive-element.js +31 -28
- package/dist/es/components/simple-data-table/interactive-element.js.map +1 -1
- package/dist/es/components/simple-data-table/private/cell-context.js.map +1 -1
- package/dist/es/components/simple-data-table/private/corner-style.js +9 -0
- package/dist/es/components/simple-data-table/private/corner-style.js.map +1 -0
- package/dist/es/components/simple-data-table/private/head.js +65 -42
- package/dist/es/components/simple-data-table/private/head.js.map +1 -1
- package/dist/es/components/simple-data-table/private/header-cell.js +2 -1
- package/dist/es/components/simple-data-table/private/header-cell.js.map +1 -1
- package/dist/es/components/simple-data-table/private/link.js.map +1 -1
- package/dist/es/components/simple-data-table/private/row.js +96 -60
- package/dist/es/components/simple-data-table/private/row.js.map +1 -1
- package/dist/es/components/simple-data-table/row-actions.js +4 -1
- package/dist/es/components/simple-data-table/row-actions.js.map +1 -1
- package/dist/es/components/slider/index.js.map +1 -1
- package/dist/es/components/split-view/listbox.js.map +1 -1
- package/dist/es/components/split-view/private/list-item-with-content.js.map +1 -1
- package/dist/es/components/tabs/index.js.map +1 -1
- package/dist/es/components/tabs/private/tab.js +1 -1
- package/dist/es/components/tabs/private/tab.js.map +1 -1
- package/dist/es/components/textarea/check-props.js +1 -1
- package/dist/es/components/textarea/check-props.js.map +1 -1
- package/dist/es/components/textarea/index.js +4 -2
- package/dist/es/components/textarea/index.js.map +1 -1
- package/dist/es/components/toast/index.js.map +1 -1
- package/dist/es/components/tooltip/index.js +107 -88
- package/dist/es/components/tooltip/index.js.map +1 -1
- package/dist/es/components/tree/private/branch.js.map +1 -1
- package/dist/es/components/tree/private/item.js.map +1 -1
- package/dist/es/components/tree/private/render-branch.js +14 -19
- package/dist/es/components/tree/private/render-branch.js.map +1 -1
- package/dist/es/components/utilities/dialog/index.js +2 -1
- package/dist/es/components/utilities/dialog/index.js.map +1 -1
- package/dist/es/components/utilities/dialog/portal.js +5 -3
- package/dist/es/components/utilities/dialog/portal.js.map +1 -1
- package/dist/es/components/utilities/menu-list/index.js +6 -6
- package/dist/es/components/utilities/menu-list/index.js.map +1 -1
- package/dist/es/components/utilities/menu-list/item.js +42 -18
- package/dist/es/components/utilities/menu-list/item.js.map +1 -1
- package/dist/es/components/utilities/utility-icon/index.js +32 -52
- package/dist/es/components/utilities/utility-icon/index.js.map +1 -1
- package/dist/es/utilities/color.js +1 -1
- package/dist/es/utilities/color.js.map +1 -1
- package/dist/es/utilities/dom-element-focus.js.map +1 -1
- package/dist/es/utilities/execution-environment.js.map +1 -1
- package/dist/es/utilities/get-aria-props.js +1 -1
- package/dist/es/utilities/get-aria-props.js.map +1 -1
- package/dist/es/utilities/get-data-props.js +1 -1
- package/dist/es/utilities/get-data-props.js.map +1 -1
- package/dist/es/utilities/keyboard-navigable-dialog.js +7 -7
- package/dist/es/utilities/keyboard-navigable-dialog.js.map +1 -1
- package/dist/es/utilities/keyboard-navigate.js +1 -1
- package/dist/es/utilities/keyboard-navigate.js.map +1 -1
- package/dist/es/utilities/product-tokens/icon-backgrounds.js.map +1 -1
- package/dist/es/utilities/warning/children-as-trigger.js +8 -7
- package/dist/es/utilities/warning/children-as-trigger.js.map +1 -1
- package/dist/es/utilities/warning/deprecated-property-value.js +11 -10
- package/dist/es/utilities/warning/deprecated-property-value.js.map +1 -1
- package/dist/es/utilities/warning/deprecated-property.js +8 -7
- package/dist/es/utilities/warning/deprecated-property.js.map +1 -1
- package/dist/es/utilities/warning/has-children-without-display-name-of.js +11 -10
- package/dist/es/utilities/warning/has-children-without-display-name-of.js.map +1 -1
- package/dist/es/utilities/warning/if-one-then-both-required-property.js +10 -9
- package/dist/es/utilities/warning/if-one-then-both-required-property.js.map +1 -1
- package/dist/es/utilities/warning/is-trigger-tabbable.js +9 -8
- package/dist/es/utilities/warning/is-trigger-tabbable.js.map +1 -1
- package/dist/es/utilities/warning/low-priority-warning.js.map +1 -1
- package/dist/es/utilities/warning/one-of-required-property.js +11 -10
- package/dist/es/utilities/warning/one-of-required-property.js.map +1 -1
- package/dist/es/utilities/warning/only-one-of-properties.js +9 -8
- package/dist/es/utilities/warning/only-one-of-properties.js.map +1 -1
- package/dist/es/utilities/warning/render-function-return-contents-lack-display-name.js +14 -13
- package/dist/es/utilities/warning/render-function-return-contents-lack-display-name.js.map +1 -1
- package/dist/es/utilities/warning/required-property.js +8 -7
- package/dist/es/utilities/warning/required-property.js.map +1 -1
- package/dist/es/utilities/warning/sunset-property.js +8 -7
- package/dist/es/utilities/warning/sunset-property.js.map +1 -1
- package/dist/es/utilities/warning/warned-registry.js +10 -0
- package/dist/es/utilities/warning/warned-registry.js.map +1 -0
- package/dist/types/components/builder-header/nav-link.d.ts.map +1 -1
- package/dist/types/components/button/index.d.ts +14 -4
- package/dist/types/components/button/index.d.ts.map +1 -1
- package/dist/types/components/button-stateful/index.d.ts +5 -2
- package/dist/types/components/button-stateful/index.d.ts.map +1 -1
- package/dist/types/components/carousel/index.d.ts +7 -1
- package/dist/types/components/carousel/index.d.ts.map +1 -1
- package/dist/types/components/checkbox/index.d.ts +4 -1
- package/dist/types/components/checkbox/index.d.ts.map +1 -1
- package/dist/types/components/color-picker/color-picker.d.ts.map +1 -1
- package/dist/types/components/combobox/combobox.d.ts.map +1 -1
- package/dist/types/components/combobox/index.d.ts +1 -1
- package/dist/types/components/combobox/index.d.ts.map +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/types/components/files/file.d.ts +5 -0
- package/dist/types/components/files/file.d.ts.map +1 -1
- package/dist/types/components/icon/index.d.ts +7 -1
- package/dist/types/components/icon/index.d.ts.map +1 -1
- package/dist/types/components/input/index.d.ts +9 -6
- package/dist/types/components/input/index.d.ts.map +1 -1
- package/dist/types/components/input/search.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/button-trigger.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/menu-dropdown.d.ts +9 -3
- package/dist/types/components/menu-dropdown/menu-dropdown.d.ts.map +1 -1
- package/dist/types/components/modal/index.d.ts.map +1 -1
- package/dist/types/components/pill/index.d.ts.map +1 -1
- package/dist/types/components/popover/index.d.ts.map +1 -1
- package/dist/types/components/popover/popover.d.ts.map +1 -1
- package/dist/types/components/radio/index.d.ts +9 -2
- package/dist/types/components/radio/index.d.ts.map +1 -1
- package/dist/types/components/radio-group/index.d.ts +3 -3
- package/dist/types/components/radio-group/index.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/cell.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/interactive-element.d.ts +8 -1
- package/dist/types/components/simple-data-table/interactive-element.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/types.d.ts +10 -2
- package/dist/types/components/simple-data-table/types.d.ts.map +1 -1
- package/dist/types/components/slider/index.d.ts +2 -2
- package/dist/types/components/slider/index.d.ts.map +1 -1
- package/dist/types/components/split-view/listbox.d.ts.map +1 -1
- package/dist/types/components/split-view/private/list-item-with-content.d.ts.map +1 -1
- package/dist/types/components/tabs/index.d.ts.map +1 -1
- package/dist/types/components/textarea/index.d.ts +9 -6
- package/dist/types/components/textarea/index.d.ts.map +1 -1
- package/dist/types/components/toast/index.d.ts.map +1 -1
- package/dist/types/components/tooltip/index.d.ts.map +1 -1
- package/dist/types/components/utilities/dialog/portal.d.ts.map +1 -1
- package/dist/types/components/utilities/menu-list/index.d.ts +2 -2
- package/dist/types/components/utilities/menu-list/index.d.ts.map +1 -1
- package/dist/types/components/utilities/menu-list/item.d.ts +14 -1
- package/dist/types/components/utilities/menu-list/item.d.ts.map +1 -1
- package/dist/types/components/utilities/truncate/index.d.ts.map +1 -1
- package/dist/types/components/utilities/utility-icon/index.d.ts +1 -1
- package/dist/types/components/utilities/utility-icon/index.d.ts.map +1 -1
- package/dist/types/types/common.d.ts.map +1 -1
- package/dist/types/types/components.d.ts.map +1 -1
- package/package.json +2 -3
- package/dist/cjs/icons/action/index.cjs +0 -2
- package/dist/cjs/icons/action/index.cjs.map +0 -1
- package/dist/cjs/icons/custom/index.cjs +0 -2
- package/dist/cjs/icons/custom/index.cjs.map +0 -1
- package/dist/cjs/icons/doctype/index.cjs +0 -2
- package/dist/cjs/icons/doctype/index.cjs.map +0 -1
- package/dist/cjs/icons/standard/index.cjs +0 -2
- package/dist/cjs/icons/standard/index.cjs.map +0 -1
- package/dist/cjs/icons/utility/index.cjs +0 -2
- package/dist/cjs/icons/utility/index.cjs.map +0 -1
- package/dist/es/icons/action/index.js +0 -6
- package/dist/es/icons/action/index.js.map +0 -1
- package/dist/es/icons/custom/index.js +0 -6
- package/dist/es/icons/custom/index.js.map +0 -1
- package/dist/es/icons/doctype/index.js +0 -6
- package/dist/es/icons/doctype/index.js.map +0 -1
- package/dist/es/icons/standard/index.js +0 -6
- package/dist/es/icons/standard/index.js.map +0 -1
- package/dist/es/icons/utility/index.js +0 -6
- package/dist/es/icons/utility/index.js.map +0 -1
- package/dist/types/icons/action/index.d.ts +0 -3
- package/dist/types/icons/action/index.d.ts.map +0 -1
- package/dist/types/icons/custom/index.d.ts +0 -3
- package/dist/types/icons/custom/index.d.ts.map +0 -1
- package/dist/types/icons/doctype/index.d.ts +0 -3
- package/dist/types/icons/doctype/index.d.ts.map +0 -1
- package/dist/types/icons/standard/index.d.ts +0 -3
- package/dist/types/icons/standard/index.d.ts.map +0 -1
- package/dist/types/icons/utility/index.d.ts +0 -3
- package/dist/types/icons/utility/index.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","names":[],"sources":["../../../../components/popover/popover.tsx"],"sourcesContent":["/* eslint-disable max-lines */\n/* 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\tforwardRef,\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseCallback,\n\tuseId,\n\tuseContext,\n\ttype ReactNode,\n\ttype MouseEvent,\n\ttype KeyboardEvent,\n\ttype FocusEvent,\n\ttype CSSProperties,\n} from 'react';\nimport classNames from 'classnames';\n\nimport Button from '../button';\nimport MediaObject from '../media-object';\nimport Icon from '../icon';\nimport Dialog from '../utilities/dialog';\nimport { useControllableState } from '../../utilities/hooks';\nimport keyboardNavigableDialog from '../../utilities/keyboard-navigable-dialog';\nimport KEYS from '../../utilities/key-code';\nimport { POPOVER } from '../../utilities/constants';\nimport { IconSettingsContext } from '../icon-settings';\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport sunsetProperty from '../../utilities/warning/sunset-property';\nimport mergeProps from '../../utilities/merge-props';\nimport getComponentDocFn from '../../utilities/get-component-doc';\nimport componentDoc from './component.json';\n\nconst documentDefined = typeof document !== 'undefined';\n\n// Shared overlay element for click-outside detection over iframes\nconst overlay = documentDefined\n\t? document.createElement('span')\n\t: ({ style: {} } as HTMLSpanElement);\nif (documentDefined) {\n\toverlay.style.top = '0';\n\toverlay.style.left = '0';\n\toverlay.style.width = '100%';\n\toverlay.style.height = '100%';\n\toverlay.style.position = 'absolute';\n}\n\n// Track currently open popover for single-popover-at-a-time behavior\nlet currentOpenPopover: {\n\thandleClose: (\n\t\tevent: MouseEvent | KeyboardEvent | undefined,\n\t\tdata: PopoverRequestCloseData\n\t) => void;\n\tgetId: () => string;\n} | null = null;\n\n/**\n * Popover alignment options\n */\nexport type PopoverAlign =\n\t| 'top'\n\t| 'top left'\n\t| 'top right'\n\t| 'right'\n\t| 'right top'\n\t| 'right bottom'\n\t| 'bottom'\n\t| 'bottom left'\n\t| 'bottom right'\n\t| 'left'\n\t| 'left top'\n\t| 'left bottom';\n\n/**\n * Popover position options\n */\nexport type PopoverPosition =\n\t'absolute' | 'overflowBoundaryElement' | 'relative';\n\n/**\n * Popover variant options\n */\nexport type PopoverVariant =\n\t| 'base'\n\t| 'error'\n\t| 'feature'\n\t| 'walkthrough'\n\t| 'walkthrough-action'\n\t| 'warning';\n\n/**\n * Assistive text for Popover\n */\nexport interface PopoverAssistiveText {\n\tcloseButton?: string;\n}\n\n/**\n * What caused `onRequestClose` to fire:\n * * `cancel`: the close button was clicked or Escape was pressed\n * * `clickOutside`: a click landed outside the popover\n * * `mouseLeave`: the mouse left the trigger/popover (`openOn` `hover`/`hybrid`) and `hoverCloseDelay` elapsed\n * * `newPopover`: another Popover opened (only one can be open at a time)\n * * `triggerClick`: the trigger was clicked while the popover was open\n */\nexport type PopoverRequestCloseTrigger =\n\t'cancel' | 'clickOutside' | 'mouseLeave' | 'newPopover' | 'triggerClick';\n\n/**\n * Data passed to `onRequestClose`\n */\nexport interface PopoverRequestCloseData {\n\t/** What caused the close request */\n\ttrigger: PopoverRequestCloseTrigger;\n\t/** HTML id of the popover being closed. Only present when `trigger` is `newPopover`. */\n\tid?: string;\n}\n\n/**\n * What caused `onRequestOpen` to fire:\n * * `focus`: the trigger received focus (`openOn` `hover`)\n * * `mouseEnter`: the mouse entered the trigger (`openOn` `hover`)\n * * `triggerClick`: the trigger was clicked while the popover was closed\n */\nexport type PopoverRequestOpenTrigger = 'focus' | 'mouseEnter' | 'triggerClick';\n\n/**\n * Data passed to `onRequestOpen`\n */\nexport interface PopoverRequestOpenData {\n\t/** What caused the open request */\n\ttrigger: PopoverRequestOpenTrigger;\n}\n\n/**\n * Data passed to `onOpen`\n */\nexport interface PopoverOpenData {\n\t/** The rendered popover dialog element */\n\tportal?: HTMLElement;\n}\n\n/**\n * Data passed to `onClose`\n */\nexport interface PopoverCloseData {\n\t/** `true` when the popover dialog is closing because it is being unmounted */\n\tcomponentWillUnmount: boolean;\n}\n\n/**\n * Props every Popover takes\n */\nexport interface PopoverBaseProps {\n\t/** Alignment relative to trigger */\n\talign?: PopoverAlign;\n\t/** Accessibility labels */\n\tassistiveText?: PopoverAssistiveText;\n\t/**\n\t * The element the popover attaches to (the first child), and optional other children rendered\n\t * beside it. The first child is the trigger: Popover adds `id`, `aria-haspopup`, `tabIndex` and\n\t * its open handlers to it, unless `openOn` is `'none'`, which leaves it as it is.\n\t */\n\tchildren: ReactNode;\n\t/** Popover body content */\n\tbody: ReactNode;\n\t/** CSS classes for the `.slds-popover__body` element */\n\tclassNameBody?: string | string[] | Record<string, boolean>;\n\t/** CSS classes for the `.slds-popover__footer` element */\n\tclassNameFooter?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `classNameFooter`. */\n\tfooterClassName?: string | string[] | Record<string, boolean>;\n\t/**\n\t * CSS classes for the root element: the `div` that wraps the trigger. To style the\n\t * `.slds-popover` dialog (for example `slds-popover_large`), use `classNameDialog`.\n\t */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** CSS classes for the `.slds-popover` dialog element */\n\tclassNameDialog?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `classNameDialog`, which lands on the same element. */\n\tcontentsClassName?: string | string[] | Record<string, boolean>;\n\t/** Disable the popover */\n\tdisabled?: boolean;\n\t/** Footer content */\n\tfooter?: ReactNode;\n\t/** @deprecated Use `styleFooter`. */\n\tfooterStyle?: CSSProperties;\n\t/** Walkthrough footer actions */\n\tfooterWalkthroughActions?: ReactNode | ReactNode[];\n\t/** Hide close button */\n\thasNoCloseButton?: boolean;\n\t/** Hide nubbin/arrow */\n\thasNoNubbin?: boolean;\n\t/** Prevent position flipping */\n\thasStaticAlignment?: boolean;\n\t/** Remove trigger inline-block style */\n\thasNoTriggerStyles?: boolean;\n\t/** HTML id */\n\tid?: string;\n\t/**\n\t * Open state when the popover is controlled. When `isOpen` is set, the popover only opens and closes\n\t * when this prop changes: handle `onRequestOpen` and `onRequestClose` to update it. Leave it\n\t * `undefined` for an uncontrolled popover (see `defaultIsOpen`).\n\t */\n\tisOpen?: boolean;\n\t/** Initial open state of an uncontrolled popover (`isOpen` is `undefined`). Defaults to `false`. */\n\tdefaultIsOpen?: boolean;\n\t/** Click handler */\n\tonClick?: (event: MouseEvent) => void;\n\t/** Called after the popover dialog has closed (unmounted). There is no triggering event, so `event` is `undefined`. */\n\tonClose?: (event: undefined, data: PopoverCloseData) => void;\n\t/** Focus handler */\n\tonFocus?: (event: FocusEvent) => void;\n\t/** Key down handler */\n\tonKeyDown?: (event: KeyboardEvent) => void;\n\t/** Mouse down handler */\n\tonMouseDown?: (event: MouseEvent) => void;\n\t/** Mouse enter handler */\n\tonMouseEnter?: (event: MouseEvent) => void;\n\t/** Mouse leave handler */\n\tonMouseLeave?: (event: MouseEvent) => void;\n\t/** Called after the popover dialog has opened and rendered. There is no triggering event, so `event` is `undefined`. */\n\tonOpen?: (event: undefined, data: PopoverOpenData) => void;\n\t/**\n\t * Called when the popover requests to open (trigger click, or hover/focus with `openOn` `hover`),\n\t * controlled or not. `data.trigger` says why. A controlled popover opens only if the parent sets\n\t * `isOpen` to `true`.\n\t */\n\tonRequestOpen?: (\n\t\tevent: MouseEvent | FocusEvent,\n\t\tdata: PopoverRequestOpenData\n\t) => void;\n\t/**\n\t * Called when the popover requests to close, controlled or not. `data.trigger` says why. `event` is\n\t * the triggering click or key event, or `undefined` when there is none (`mouseLeave` timer,\n\t * `newPopover`). A controlled popover closes only if the parent sets `isOpen` to `false`.\n\t */\n\tonRequestClose?: (\n\t\tevent: MouseEvent | KeyboardEvent | undefined,\n\t\tdata: PopoverRequestCloseData\n\t) => void;\n\t/** Custom target element getter */\n\tonRequestTargetElement?: () => HTMLElement | null;\n\t/**\n\t * What on the first child opens the popover: `click` (the default), `hover`, or `hybrid` (click\n\t * or hover). `none` makes the first child only an anchor that the popover points at, such as\n\t * the target of a walkthrough step: Popover leaves its markup and handlers alone, and the\n\t * parent opens and closes the popover through `isOpen`.\n\t */\n\topenOn?: 'click' | 'hover' | 'hybrid' | 'none';\n\t/** Overlay for click-outside on iframes */\n\toverlay?:\n\t\tboolean | ((isOpen: boolean, overlayElement: HTMLSpanElement) => void);\n\t/** Positioning strategy */\n\tposition?: PopoverPosition;\n\t/** Walkthrough step text */\n\tstepText?: string;\n\t/** Styles for the root element: the `div` that wraps the trigger. To style the dialog, use `styleDialog`. */\n\tstyle?: CSSProperties;\n\t/** Styles for the `.slds-popover` dialog element */\n\tstyleDialog?: CSSProperties;\n\t/** Styles for the `.slds-popover__footer` element */\n\tstyleFooter?: CSSProperties;\n\t/** @deprecated Use `className`, which lands on the same element. */\n\ttriggerClassName?: string | string[] | Record<string, boolean>;\n\t/** Delay before closing on hover (ms) */\n\thoverCloseDelay?: number;\n}\n\n/** The `feature` variant, the only one with an `icon`. */\ninterface PopoverFeatureVariantProps {\n\t/** Popover variant */\n\tvariant: 'feature';\n\t/** Icon for the feature variant */\n\ticon?: ReactNode;\n}\n\n/** Every other variant. */\ninterface PopoverOtherVariantProps {\n\t/** Popover variant */\n\tvariant?: Exclude<PopoverVariant, 'feature'>;\n\ticon?: never;\n}\n\n/**\n * The dialog is named by `heading`, or by the `id` of another element in\n * `ariaLabelledby`, not both.\n */\nexport type PopoverLabelProps =\n\t| {\n\t\t\t/** Popover heading */\n\t\t\theading?: ReactNode;\n\t\t\tariaLabelledby?: never;\n\t }\n\t| {\n\t\t\theading?: never;\n\t\t\t/** HTML id of the heading element that labels the dialog. Use instead of `heading`. */\n\t\t\tariaLabelledby: string;\n\t };\n\n/**\n * Props for the Popover component: `icon` is feature-only, and `heading`\n * and `ariaLabelledby` are exclusive.\n */\nexport type PopoverProps = PopoverBaseProps &\n\t(PopoverFeatureVariantProps | PopoverOtherVariantProps) &\n\tPopoverLabelProps;\n\n/**\n * Props removed from the public API. Still destructured so they never reach\n * the DOM, and reported on mount.\n */\ninterface PopoverRemovedProps {\n\tcloseButtonAssistiveText?: unknown;\n\toffset?: unknown;\n}\n\n// Nubbin positions for export (legacy)\nexport const PopoverNubbinPositions = [\n\t'top left',\n\t'top',\n\t'top right',\n\t'bottom left',\n\t'bottom',\n\t'bottom right',\n];\n\nconst defaultAssistiveText: PopoverAssistiveText = {\n\tcloseButton: 'Close dialog',\n};\n\n/**\n * The Popover component is a non-modal dialog. It should be paired with a clickable\n * trigger such as a Button. It traps focus from the page and must be exited if focus\n * needs to be outside the Popover.\n */\nconst Popover = forwardRef<HTMLDivElement, PopoverProps>((props, ref) => {\n\tconst {\n\t\talign = 'right',\n\t\tassistiveText: propAssistiveText,\n\t\tariaLabelledby,\n\t\tchildren,\n\t\tbody,\n\t\tclassNameBody,\n\t\tclassNameFooter,\n\t\tfooterClassName,\n\t\tclassName,\n\t\tclassNameDialog,\n\t\tcontentsClassName,\n\t\tdisabled = false,\n\t\tfooter,\n\t\tfooterStyle,\n\t\tfooterWalkthroughActions,\n\t\thasNoCloseButton = false,\n\t\thasNoNubbin = false,\n\t\thasStaticAlignment = false,\n\t\thasNoTriggerStyles = false,\n\t\theading,\n\t\ticon,\n\t\tid: propId,\n\t\tisOpen: controlledIsOpen,\n\t\tdefaultIsOpen = false,\n\t\toffset,\n\t\tonClick,\n\t\tonClose,\n\t\tonFocus,\n\t\tonKeyDown,\n\t\tonMouseDown,\n\t\tonMouseEnter,\n\t\tonMouseLeave,\n\t\tonOpen,\n\t\tonRequestOpen,\n\t\tonRequestClose,\n\t\tonRequestTargetElement,\n\t\topenOn = 'click',\n\t\toverlay: overlayProp,\n\t\tposition = 'absolute',\n\t\tstepText,\n\t\tstyle,\n\t\tstyleDialog,\n\t\tstyleFooter,\n\t\ttriggerClassName,\n\t\tvariant = 'base',\n\t\thoverCloseDelay = 300,\n\t\tcloseButtonAssistiveText,\n\t} = props as PopoverBaseProps &\n\t\tPopoverRemovedProps & {\n\t\t\tariaLabelledby?: string;\n\t\t\theading?: ReactNode;\n\t\t\ticon?: ReactNode;\n\t\t\tvariant?: PopoverVariant;\n\t\t};\n\n\t// `check-props.js` is not wired up (its trigger and heading checks predate v11), so the\n\t// renamed and removed props are checked here.\n\tuseEffect(() => {\n\t\tif (process.env.NODE_ENV !== 'production') {\n\t\t\tconst createDocUrl = getComponentDocFn(componentDoc);\n\t\t\tconst renamedProps: [string, unknown, string][] = [\n\t\t\t\t['contentsClassName', contentsClassName, 'classNameDialog'],\n\t\t\t\t['footerClassName', footerClassName, 'classNameFooter'],\n\t\t\t\t['footerStyle', footerStyle, 'styleFooter'],\n\t\t\t\t['triggerClassName', triggerClassName, 'className'],\n\t\t\t];\n\t\t\trenamedProps.forEach(([oldProp, value, newProp]) => {\n\t\t\t\tdeprecatedProperty(\n\t\t\t\t\tPOPOVER,\n\t\t\t\t\tvalue,\n\t\t\t\t\toldProp,\n\t\t\t\t\tnewProp,\n\t\t\t\t\tcreateDocUrl(newProp)\n\t\t\t\t);\n\t\t\t});\n\t\t\tconst removedProps: [string, unknown, string | undefined][] = [\n\t\t\t\t[\n\t\t\t\t\t'closeButtonAssistiveText',\n\t\t\t\t\tcloseButtonAssistiveText,\n\t\t\t\t\t\"Use `assistiveText={{ closeButton: '...' }}` instead.\",\n\t\t\t\t],\n\t\t\t\t['offset', offset, undefined],\n\t\t\t];\n\t\t\tremovedProps.forEach(([oldProp, value, comment]) => {\n\t\t\t\tsunsetProperty(POPOVER, value, oldProp, comment);\n\t\t\t});\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []); // Only run on mount\n\n\tconst generatedId = useId();\n\tconst id = propId || generatedId;\n\tconst context = useContext(IconSettingsContext);\n\n\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\n\t// State\n\tconst [currentIsOpen, setIsOpen] = useControllableState(\n\t\tcontrolledIsOpen,\n\t\tdefaultIsOpen\n\t);\n\tconst [inputRendered, setInputRendered] = useState(false);\n\n\t// Refs\n\tconst triggerRef = useRef<HTMLDivElement>(null);\n\tconst dialogRef = useRef<HTMLElement>(null);\n\tconst isHoverRef = useRef(false);\n\tconst isClosingRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\tconst overlayRef = useRef<HTMLSpanElement | null>(null);\n\tconst isUnmountingRef = useRef(false);\n\n\t// Derived state\n\tconst isOpen = !disabled && currentIsOpen;\n\n\t// Get target element for positioning\n\tconst getTargetElement = useCallback(() => {\n\t\tif (onRequestTargetElement) {\n\t\t\tconst target = onRequestTargetElement();\n\t\t\tif (target) return target;\n\t\t}\n\t\treturn triggerRef.current;\n\t}, [onRequestTargetElement]);\n\n\t// Handle dialog close (when unmounted)\n\tconst handleDialogClose = useCallback(\n\t\t(\n\t\t\t_event?: React.SyntheticEvent,\n\t\t\tdata?: { componentWillUnmount?: boolean }\n\t\t) => {\n\t\t\tconst componentWillUnmount = data?.componentWillUnmount || false;\n\n\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\tcurrentOpenPopover = null;\n\t\t\t}\n\n\t\t\tif (onClose) {\n\t\t\t\tonClose(undefined, { componentWillUnmount });\n\t\t\t}\n\t\t},\n\t\t[id, onClose]\n\t);\n\n\t// Handle dialog open (after it has rendered)\n\tconst handleDialogOpen = useCallback(\n\t\t(_event?: unknown, data?: { portal?: HTMLElement }) => {\n\t\t\tif (onOpen) {\n\t\t\t\tonOpen(undefined, { portal: data?.portal });\n\t\t\t}\n\t\t},\n\t\t[onOpen]\n\t);\n\n\t// Handle close\n\tconst handleClose = useCallback(\n\t\t(\n\t\t\tevent: MouseEvent | KeyboardEvent | undefined,\n\t\t\tdata: PopoverRequestCloseData\n\t\t) => {\n\t\t\tif (isOpen) {\n\t\t\t\tif (onRequestClose) {\n\t\t\t\t\tonRequestClose(event, data);\n\t\t\t\t}\n\n\t\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\t\tcurrentOpenPopover = null;\n\t\t\t\t}\n\n\t\t\t\tsetIsOpen(false);\n\t\t\t\tisHoverRef.current = false;\n\t\t\t}\n\t\t},\n\t\t[isOpen, id, onRequestClose, setIsOpen]\n\t);\n\n\t// Latest `handleClose`, so the \"close the other open popover\" path does not call a stale\n\t// closure from when this popover opened (whose `isOpen` was still `false`).\n\tconst handleCloseRef = useRef(handleClose);\n\tuseEffect(() => {\n\t\thandleCloseRef.current = handleClose;\n\t}, [handleClose]);\n\n\t// Handle open\n\tconst handleOpen = useCallback(\n\t\t(event: MouseEvent | FocusEvent, trigger: PopoverRequestOpenTrigger) => {\n\t\t\tif (!isOpen && !disabled) {\n\t\t\t\tonRequestOpen?.(event, { trigger });\n\n\t\t\t\t// Close any other open popover\n\t\t\t\tif (currentOpenPopover && currentOpenPopover.getId() !== id) {\n\t\t\t\t\tcurrentOpenPopover.handleClose(undefined, {\n\t\t\t\t\t\ttrigger: 'newPopover',\n\t\t\t\t\t\tid: currentOpenPopover.getId(),\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tcurrentOpenPopover = {\n\t\t\t\t\thandleClose: (event, data) => handleCloseRef.current(event, data),\n\t\t\t\t\tgetId: () => id,\n\t\t\t\t};\n\n\t\t\t\tsetIsOpen(true);\n\t\t\t}\n\t\t},\n\t\t[isOpen, disabled, id, onRequestOpen, setIsOpen]\n\t);\n\n\t// Handle cancel (close button or escape)\n\tconst handleCancel = useCallback(\n\t\t(event: MouseEvent | KeyboardEvent) => {\n\t\t\thandleClose(event, { trigger: 'cancel' });\n\t\t},\n\t\t[handleClose]\n\t);\n\n\t// Handle click outside\n\tconst handleClickOutside = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\thandleClose(event, { trigger: 'clickOutside' });\n\t\t},\n\t\t[handleClose]\n\t);\n\n\t// Handle mouse enter\n\tconst handleMouseEnter = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tisHoverRef.current = true;\n\n\t\t\tif (!isOpen && openOn === 'hover') {\n\t\t\t\thandleOpen(event, 'mouseEnter');\n\t\t\t} else {\n\t\t\t\tif (isClosingRef.current) {\n\t\t\t\t\tclearTimeout(isClosingRef.current);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (onMouseEnter) {\n\t\t\t\tonMouseEnter(event);\n\t\t\t}\n\t\t},\n\t\t[isOpen, openOn, handleOpen, onMouseEnter]\n\t);\n\n\t// Handle mouse leave\n\tconst handleMouseLeave = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tif (isOpen) {\n\t\t\t\tisClosingRef.current = setTimeout(() => {\n\t\t\t\t\thandleClose(undefined, { trigger: 'mouseLeave' });\n\t\t\t\t}, hoverCloseDelay);\n\t\t\t}\n\n\t\t\tif (onMouseLeave) {\n\t\t\t\tonMouseLeave(event);\n\t\t\t}\n\t\t},\n\t\t[isOpen, hoverCloseDelay, handleClose, onMouseLeave]\n\t);\n\n\t// Handle click\n\tconst handleClick = useCallback(\n\t\t(event: MouseEvent, triggerOnClickCallback?: (e: MouseEvent) => void) => {\n\t\t\tif (!isOpen) {\n\t\t\t\thandleOpen(event, 'triggerClick');\n\t\t\t} else {\n\t\t\t\thandleClose(event, { trigger: 'triggerClick' });\n\t\t\t}\n\n\t\t\tif (onClick) {\n\t\t\t\tonClick(event);\n\t\t\t}\n\n\t\t\tif (triggerOnClickCallback) {\n\t\t\t\ttriggerOnClickCallback(event);\n\t\t\t}\n\t\t},\n\t\t[isOpen, handleOpen, handleClose, onClick]\n\t);\n\n\t// Handle focus\n\tconst handleFocus = useCallback(\n\t\t(event: FocusEvent) => {\n\t\t\tif (!isOpen) {\n\t\t\t\thandleOpen(event, 'focus');\n\t\t\t}\n\n\t\t\tif (onFocus) {\n\t\t\t\tonFocus(event);\n\t\t\t}\n\t\t},\n\t\t[isOpen, handleOpen, onFocus]\n\t);\n\n\t// Toggle from keyboard\n\t// `handleKeyDown` is only attached to the open dialog, so this only ever closes it (Escape).\n\tconst toggleOpenFromKeyboard = useCallback(\n\t\t(event: KeyboardEvent) => {\n\t\t\tif (isOpen) {\n\t\t\t\thandleCancel(event);\n\t\t\t}\n\t\t},\n\t\t[isOpen, handleCancel]\n\t);\n\n\t// Handle key down\n\tconst handleKeyDown = useCallback(\n\t\t(event: KeyboardEvent) => {\n\t\t\tif (event.key) {\n\t\t\t\tif (event.key !== KEYS.TAB) {\n\t\t\t\t\tkeyboardNavigableDialog({\n\t\t\t\t\t\tevent,\n\t\t\t\t\t\tisOpen,\n\t\t\t\t\t\thandleClick: (e: MouseEvent) => handleClick(e),\n\t\t\t\t\t\tkey: event.key,\n\t\t\t\t\t\teventTarget: event.target,\n\t\t\t\t\t\t// keyboardNavigableDialog calls `toggleOpen()` without the event; pass it through\n\t\t\t\t\t\ttoggleOpen: () => toggleOpenFromKeyboard(event),\n\t\t\t\t\t\ttrigger: triggerRef.current,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (onKeyDown) {\n\t\t\t\t\tonKeyDown(event);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[isOpen, handleClick, toggleOpenFromKeyboard, onKeyDown]\n\t);\n\n\t// Render overlay for click-outside detection\n\tconst renderOverlay = useCallback(\n\t\t(shouldShow: boolean) => {\n\t\t\tif (typeof overlayProp === 'function' && documentDefined) {\n\t\t\t\toverlayProp(shouldShow, overlay);\n\t\t\t} else if (\n\t\t\t\toverlayProp &&\n\t\t\t\tshouldShow &&\n\t\t\t\t!overlayRef.current &&\n\t\t\t\tdocumentDefined\n\t\t\t) {\n\t\t\t\toverlayRef.current = overlay;\n\t\t\t\tdocument.querySelector('body')?.appendChild(overlay);\n\t\t\t} else if (!shouldShow && overlayRef.current?.parentNode) {\n\t\t\t\toverlayRef.current.parentNode.removeChild(overlayRef.current);\n\t\t\t\toverlayRef.current = null;\n\t\t\t}\n\t\t},\n\t\t[overlayProp]\n\t);\n\n\t// Container ref callback\n\tconst setContainerRef = useCallback(\n\t\t(component: HTMLDivElement | null) => {\n\t\t\t(triggerRef as React.MutableRefObject<HTMLDivElement | null>).current =\n\t\t\t\tcomponent;\n\t\t\tif (typeof ref === 'function') {\n\t\t\t\tref(component);\n\t\t\t} else if (ref) {\n\t\t\t\tref.current = component;\n\t\t\t}\n\t\t\tif (component && !inputRendered) {\n\t\t\t\tsetInputRendered(true);\n\t\t\t}\n\t\t},\n\t\t[inputRendered, ref]\n\t);\n\n\t// Dialog ref callback\n\tconst setMenuRef = useCallback((component: HTMLElement | null) => {\n\t\t(dialogRef as React.MutableRefObject<HTMLElement | null>).current =\n\t\t\tcomponent;\n\t}, []);\n\n\t// Cleanup on unmount\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tisUnmountingRef.current = true;\n\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\tcurrentOpenPopover = null;\n\t\t\t}\n\t\t\trenderOverlay(false);\n\t\t};\n\t}, [id, renderOverlay]);\n\n\t// Update overlay when isOpen changes\n\tuseEffect(() => {\n\t\trenderOverlay(isOpen);\n\t}, [isOpen, renderOverlay]);\n\n\t// Render header\n\tconst renderHeader = () => {\n\t\tconst hasThemedHeader = variant === 'error' || variant === 'warning';\n\t\tconst hasDefinedHeader = heading || hasThemedHeader;\n\n\t\tif (\n\t\t\t!hasDefinedHeader ||\n\t\t\tvariant === 'walkthrough-action' ||\n\t\t\tvariant === 'feature'\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst headerIcon = {\n\t\t\terror: <Icon category=\"utility\" name=\"error\" size=\"x-small\" inverse />,\n\t\t\twarning: (\n\t\t\t\t<Icon category=\"utility\" name=\"warning\" size=\"x-small\" inverse />\n\t\t\t),\n\t\t};\n\n\t\tif (hasThemedHeader) {\n\t\t\treturn (\n\t\t\t\t<header className=\"slds-popover__header\">\n\t\t\t\t\t<MediaObject\n\t\t\t\t\t\tbody={\n\t\t\t\t\t\t\t<h2\n\t\t\t\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\t\t\t\tclassName=\"slds-truncate slds-text-heading_medium\"\n\t\t\t\t\t\t\t\ttitle={typeof heading === 'string' ? heading : undefined}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{heading}\n\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfigure={headerIcon[variant as 'error' | 'warning']}\n\t\t\t\t\t\tverticalCenter\n\t\t\t\t\t/>\n\t\t\t\t</header>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<header\n\t\t\t\tclassName={classNames('slds-popover__header', {\n\t\t\t\t\t'slds-p-vertical_medium': variant === 'walkthrough',\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t<h2\n\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\tclassName={classNames({\n\t\t\t\t\t\t'slds-text-heading_small': variant !== 'walkthrough',\n\t\t\t\t\t\t'slds-text-heading_medium': variant === 'walkthrough',\n\t\t\t\t\t})}\n\t\t\t\t>\n\t\t\t\t\t{heading}\n\t\t\t\t</h2>\n\t\t\t</header>\n\t\t);\n\t};\n\n\t// Render body\n\tconst renderBody = () => {\n\t\tif (variant === 'error' || variant === 'warning') {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\t\tclassName={classNames('slds-popover__body', classNameBody as string)}\n\t\t\t\t>\n\t\t\t\t\t{body}\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\tif (variant === 'walkthrough-action' || variant === 'feature') {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tclassName={classNames('slds-popover__body', classNameBody as string)}\n\t\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\t>\n\t\t\t\t\t<div className=\"slds-media\">\n\t\t\t\t\t\t<div className=\"slds-media__figure\">\n\t\t\t\t\t\t\t{variant === 'walkthrough-action' ? (\n\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\t\t\tname=\"touch_action\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tinverse\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\ticon\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"slds-media__body\">\n\t\t\t\t\t\t\t{heading && (\n\t\t\t\t\t\t\t\t<h2\n\t\t\t\t\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\t\t\t\t\tclassName=\"slds-text-heading_small\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{heading}\n\t\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{body}\n\t\t\t\t\t\t\t{stepText && (\n\t\t\t\t\t\t\t\t<p className=\"slds-m-top_medium slds-text-title\">{stepText}</p>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\tclassName={classNames('slds-popover__body', classNameBody as string)}\n\t\t\t>\n\t\t\t\t{body}\n\t\t\t</div>\n\t\t);\n\t};\n\n\t// Render footer\n\tconst renderFooter = () => {\n\t\tconst footerClassNames = classNames(\n\t\t\t'slds-popover__footer',\n\t\t\tfooterClassName,\n\t\t\tclassNameFooter\n\t\t);\n\t\tconst footerStyles =\n\t\t\tfooterStyle || styleFooter\n\t\t\t\t? { ...footerStyle, ...styleFooter }\n\t\t\t\t: undefined;\n\n\t\tif (footer) {\n\t\t\treturn (\n\t\t\t\t<footer className={footerClassNames} style={footerStyles}>\n\t\t\t\t\t{footer}\n\t\t\t\t</footer>\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\tvariant !== 'walkthrough-action' &&\n\t\t\t(footerWalkthroughActions || stepText)\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<footer className={footerClassNames} style={footerStyles}>\n\t\t\t\t\t<div className=\"slds-grid slds-grid_vertical-align-center\">\n\t\t\t\t\t\t{stepText && <span className=\"slds-text-title\">{stepText}</span>}\n\t\t\t\t\t\t{footerWalkthroughActions && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"slds-col_bump-left\"\n\t\t\t\t\t\t\t\tstyle={{ display: 'inline-block' }}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{footerWalkthroughActions}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</footer>\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t};\n\n\t// Render dialog\n\tconst renderDialog = () => {\n\t\tif (!isOpen) return null;\n\n\t\tconst outsideClickIgnoreClass = `ignore-click-${id}`;\n\n\t\treturn (\n\t\t\t<Dialog\n\t\t\t\thasNubbin={!hasNoNubbin}\n\t\t\t\talign={align}\n\t\t\t\tcontentsClassName={classNames(\n\t\t\t\t\tcontentsClassName,\n\t\t\t\t\t'ignore-react-onclickoutside',\n\t\t\t\t\t'slds-popover',\n\t\t\t\t\t{ 'slds-popover_error': variant === 'error' },\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-popover_walkthrough':\n\t\t\t\t\t\t\tvariant === 'walkthrough' ||\n\t\t\t\t\t\t\tvariant === 'walkthrough-action' ||\n\t\t\t\t\t\t\tvariant === 'feature',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-popover_walkthrough-alt': variant === 'walkthrough-action',\n\t\t\t\t\t},\n\t\t\t\t\t{ 'slds-popover_feature': variant === 'feature' },\n\t\t\t\t\t{ 'slds-popover_warning': variant === 'warning' },\n\t\t\t\t\tclassNameDialog\n\t\t\t\t)}\n\t\t\t\tcontext={context}\n\t\t\t\thasStaticAlignment={hasStaticAlignment}\n\t\t\t\tonClose={handleDialogClose}\n\t\t\t\tonOpen={handleDialogOpen}\n\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\tonMouseEnter={openOn === 'hover' ? handleMouseEnter : undefined}\n\t\t\t\tonMouseLeave={openOn === 'hover' ? handleMouseLeave : undefined}\n\t\t\t\toutsideClickIgnoreClass={outsideClickIgnoreClass}\n\t\t\t\tonRequestTargetElement={getTargetElement}\n\t\t\t\tposition={position}\n\t\t\t\tstyle={styleDialog}\n\t\t\t\tvariant=\"popover\"\n\t\t\t\tref={setMenuRef}\n\t\t\t\tcontainerProps={{\n\t\t\t\t\tid: `${id}-popover`,\n\t\t\t\t\t'aria-labelledby': ariaLabelledby || `${id}-dialog-heading`,\n\t\t\t\t\t'aria-describedby': `${id}-dialog-body`,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{!hasNoCloseButton && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tassistiveText={{ icon: assistiveText.closeButton }}\n\t\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\t\ticonName=\"close\"\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-button slds-button_icon-small slds-float_right slds-popover__close slds-button_icon',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'slds-button_icon-inverse':\n\t\t\t\t\t\t\t\t\tvariant === 'walkthrough' ||\n\t\t\t\t\t\t\t\t\tvariant === 'walkthrough-action' ||\n\t\t\t\t\t\t\t\t\tvariant === 'feature',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tonClick={handleCancel}\n\t\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t\t\tinverse={variant === 'error' || variant === 'warning'}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{renderHeader()}\n\t\t\t\t{renderBody()}\n\t\t\t\t{renderFooter()}\n\t\t\t</Dialog>\n\t\t);\n\t};\n\n\t// Clone trigger element\n\tconst otherChildren: ReactNode[] = [];\n\tlet clonedTrigger: ReactNode = null;\n\n\tReact.Children.forEach(children, (child, index) => {\n\t\tif (index === 0 && openOn === 'none') {\n\t\t\t// An anchor only: the popover is positioned against it, nothing more\n\t\t\tclonedTrigger = child;\n\t\t} else if (index === 0 && React.isValidElement(child)) {\n\t\t\tconst childProps = child.props as Record<string, unknown>;\n\t\t\t// The trigger's own handlers run alongside the popover's instead of being replaced.\n\t\t\t// `onClick` already calls the trigger's after the popover's (see `handleClick`).\n\t\t\tconst childOnClick = childProps.onClick;\n\t\t\tconst triggerProps = mergeProps(\n\t\t\t\t{\n\t\t\t\t\t'aria-haspopup': 'dialog',\n\t\t\t\t\tid,\n\t\t\t\t\tonClick:\n\t\t\t\t\t\topenOn === 'click' || openOn === 'hybrid'\n\t\t\t\t\t\t\t? (event: MouseEvent) => {\n\t\t\t\t\t\t\t\t\thandleClick(event, childOnClick as (e: MouseEvent) => void);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: childOnClick,\n\t\t\t\t\tonFocus: openOn === 'hover' ? handleFocus : undefined,\n\t\t\t\t\tonMouseDown,\n\t\t\t\t\tonMouseEnter:\n\t\t\t\t\t\topenOn === 'hover' || openOn === 'hybrid'\n\t\t\t\t\t\t\t? handleMouseEnter\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\tonMouseLeave:\n\t\t\t\t\t\topenOn === 'hover' || openOn === 'hybrid'\n\t\t\t\t\t\t\t? handleMouseLeave\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t// `??` so a trigger can opt out of the tab order with -1 (or 0 as a string)\n\t\t\t\t\ttabIndex: childProps.tabIndex ?? 0,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tonFocus: childProps.onFocus,\n\t\t\t\t\tonMouseDown: childProps.onMouseDown,\n\t\t\t\t\tonMouseEnter: childProps.onMouseEnter,\n\t\t\t\t\tonMouseLeave: childProps.onMouseLeave,\n\t\t\t\t}\n\t\t\t);\n\t\t\tclonedTrigger = React.cloneElement(child, triggerProps);\n\t\t} else if (child) {\n\t\t\totherChildren.push(child);\n\t\t}\n\t});\n\n\tconst containerStyles: CSSProperties = {\n\t\tdisplay: hasNoTriggerStyles ? undefined : 'inline-block',\n\t\t...style,\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames(triggerClassName, className) || undefined}\n\t\t\tstyle={containerStyles}\n\t\t\tref={setContainerRef}\n\t\t>\n\t\t\t{clonedTrigger}\n\t\t\t{otherChildren.length > 0 ? otherChildren : null}\n\t\t\t{renderDialog()}\n\t\t</div>\n\t);\n});\n\nPopover.displayName = POPOVER;\n\nexport default Popover;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,IAAM,IAAkB,OAAO,WAAa,KAGtC,IAAU,IACb,SAAS,cAAc,MAAM,IAC5B,EAAE,OAAO,CAAC,EAAE;AACZ,MACH,EAAQ,MAAM,MAAM,KACpB,EAAQ,MAAM,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AAQ,cAAc"}
|
|
1
|
+
{"version":3,"file":"popover.js","names":[],"sources":["../../../../components/popover/popover.tsx"],"sourcesContent":["/* eslint-disable max-lines */\n/* 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\tforwardRef,\n\tuseEffect,\n\tuseRef,\n\tuseCallback,\n\tuseId,\n\tuseContext,\n\ttype ReactNode,\n\ttype MouseEvent,\n\ttype KeyboardEvent,\n\ttype FocusEvent,\n\ttype CSSProperties,\n} from 'react';\nimport classNames from 'classnames';\n\nimport Button from '../button';\nimport MediaObject from '../media-object';\nimport Icon from '../icon';\nimport Dialog from '../utilities/dialog';\nimport { useClickOutside, useControllableState } from '../../utilities/hooks';\nimport keyboardNavigableDialog from '../../utilities/keyboard-navigable-dialog';\nimport KEYS from '../../utilities/key-code';\nimport { POPOVER } from '../../utilities/constants';\nimport { IconSettingsContext } from '../icon-settings';\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport sunsetProperty from '../../utilities/warning/sunset-property';\nimport mergeProps from '../../utilities/merge-props';\nimport getComponentDocFn from '../../utilities/get-component-doc';\nimport componentDoc from './component.json';\n\nconst documentDefined = typeof document !== 'undefined';\n\n// Shared overlay element for click-outside detection over iframes\nconst overlay = documentDefined\n\t? document.createElement('span')\n\t: ({ style: {} } as HTMLSpanElement);\nif (documentDefined) {\n\toverlay.style.top = '0';\n\toverlay.style.left = '0';\n\toverlay.style.width = '100%';\n\toverlay.style.height = '100%';\n\toverlay.style.position = 'absolute';\n}\n\n// Track currently open popover for single-popover-at-a-time behavior\nlet currentOpenPopover: {\n\thandleClose: (\n\t\tevent: MouseEvent | KeyboardEvent | undefined,\n\t\tdata: PopoverRequestCloseData\n\t) => void;\n\tgetId: () => string;\n} | null = null;\n\n/**\n * Popover alignment options\n */\nexport type PopoverAlign =\n\t| 'top'\n\t| 'top left'\n\t| 'top right'\n\t| 'right'\n\t| 'right top'\n\t| 'right bottom'\n\t| 'bottom'\n\t| 'bottom left'\n\t| 'bottom right'\n\t| 'left'\n\t| 'left top'\n\t| 'left bottom';\n\n/**\n * Popover position options\n */\nexport type PopoverPosition =\n\t'absolute' | 'overflowBoundaryElement' | 'relative';\n\n/**\n * Popover variant options\n */\nexport type PopoverVariant =\n\t| 'base'\n\t| 'error'\n\t| 'feature'\n\t| 'walkthrough'\n\t| 'walkthrough-action'\n\t| 'warning';\n\n/**\n * Assistive text for Popover\n */\nexport interface PopoverAssistiveText {\n\tcloseButton?: string;\n}\n\n/**\n * What caused `onRequestClose` to fire:\n * * `cancel`: the close button was clicked or Escape was pressed\n * * `clickOutside`: a click landed outside the popover\n * * `mouseLeave`: the mouse left the trigger/popover (`openOn` `hover`/`hybrid`) and `hoverCloseDelay` elapsed\n * * `newPopover`: another Popover opened (only one can be open at a time)\n * * `triggerClick`: the trigger was clicked while the popover was open\n */\nexport type PopoverRequestCloseTrigger =\n\t'cancel' | 'clickOutside' | 'mouseLeave' | 'newPopover' | 'triggerClick';\n\n/**\n * Data passed to `onRequestClose`\n */\nexport interface PopoverRequestCloseData {\n\t/** What caused the close request */\n\ttrigger: PopoverRequestCloseTrigger;\n\t/** HTML id of the popover being closed. Only present when `trigger` is `newPopover`. */\n\tid?: string;\n}\n\n/**\n * What caused `onRequestOpen` to fire:\n * * `focus`: the trigger received focus (`openOn` `hover`)\n * * `mouseEnter`: the mouse entered the trigger (`openOn` `hover`)\n * * `triggerClick`: the trigger was clicked while the popover was closed\n */\nexport type PopoverRequestOpenTrigger = 'focus' | 'mouseEnter' | 'triggerClick';\n\n/**\n * Data passed to `onRequestOpen`\n */\nexport interface PopoverRequestOpenData {\n\t/** What caused the open request */\n\ttrigger: PopoverRequestOpenTrigger;\n}\n\n/**\n * Data passed to `onOpen`\n */\nexport interface PopoverOpenData {\n\t/** The rendered popover dialog element */\n\tportal?: HTMLElement;\n}\n\n/**\n * Data passed to `onClose`\n */\nexport interface PopoverCloseData {\n\t/** `true` when the popover dialog is closing because it is being unmounted */\n\tcomponentWillUnmount: boolean;\n}\n\n/**\n * Props every Popover takes\n */\nexport interface PopoverBaseProps {\n\t/** Alignment relative to trigger */\n\talign?: PopoverAlign;\n\t/** Accessibility labels */\n\tassistiveText?: PopoverAssistiveText;\n\t/**\n\t * The element the popover attaches to (the first child), and optional other children rendered\n\t * beside it. The first child is the trigger: Popover adds `id`, `aria-haspopup`, `tabIndex` and\n\t * its open handlers to it, unless `openOn` is `'none'`, which leaves it as it is.\n\t */\n\tchildren: ReactNode;\n\t/** Popover body content */\n\tbody: ReactNode;\n\t/** CSS classes for the `.slds-popover__body` element */\n\tclassNameBody?: string | string[] | Record<string, boolean>;\n\t/** CSS classes for the `.slds-popover__footer` element */\n\tclassNameFooter?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `classNameFooter`. */\n\tfooterClassName?: string | string[] | Record<string, boolean>;\n\t/**\n\t * CSS classes for the root element: the `div` that wraps the trigger. To style the\n\t * `.slds-popover` dialog (for example `slds-popover_large`), use `classNameDialog`.\n\t */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** CSS classes for the `.slds-popover` dialog element */\n\tclassNameDialog?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `classNameDialog`, which lands on the same element. */\n\tcontentsClassName?: string | string[] | Record<string, boolean>;\n\t/** Disable the popover */\n\tdisabled?: boolean;\n\t/** Footer content */\n\tfooter?: ReactNode;\n\t/** @deprecated Use `styleFooter`. */\n\tfooterStyle?: CSSProperties;\n\t/** Walkthrough footer actions */\n\tfooterWalkthroughActions?: ReactNode | ReactNode[];\n\t/** Hide close button */\n\thasNoCloseButton?: boolean;\n\t/** Hide nubbin/arrow */\n\thasNoNubbin?: boolean;\n\t/** Prevent position flipping */\n\thasStaticAlignment?: boolean;\n\t/** Remove trigger inline-block style */\n\thasNoTriggerStyles?: boolean;\n\t/** HTML id */\n\tid?: string;\n\t/**\n\t * Open state when the popover is controlled. When `isOpen` is set, the popover only opens and closes\n\t * when this prop changes: handle `onRequestOpen` and `onRequestClose` to update it. Leave it\n\t * `undefined` for an uncontrolled popover (see `defaultIsOpen`).\n\t */\n\tisOpen?: boolean;\n\t/** Initial open state of an uncontrolled popover (`isOpen` is `undefined`). Defaults to `false`. */\n\tdefaultIsOpen?: boolean;\n\t/** Click handler */\n\tonClick?: (event: MouseEvent) => void;\n\t/** Called after the popover dialog has closed (unmounted). There is no triggering event, so `event` is `undefined`. */\n\tonClose?: (event: undefined, data: PopoverCloseData) => void;\n\t/** Focus handler */\n\tonFocus?: (event: FocusEvent) => void;\n\t/** Key down handler */\n\tonKeyDown?: (event: KeyboardEvent) => void;\n\t/** Mouse down handler */\n\tonMouseDown?: (event: MouseEvent) => void;\n\t/** Mouse enter handler */\n\tonMouseEnter?: (event: MouseEvent) => void;\n\t/** Mouse leave handler */\n\tonMouseLeave?: (event: MouseEvent) => void;\n\t/** Called after the popover dialog has opened and rendered. There is no triggering event, so `event` is `undefined`. */\n\tonOpen?: (event: undefined, data: PopoverOpenData) => void;\n\t/**\n\t * Called when the popover requests to open (trigger click, or hover/focus with `openOn` `hover`),\n\t * controlled or not. `data.trigger` says why. A controlled popover opens only if the parent sets\n\t * `isOpen` to `true`.\n\t */\n\tonRequestOpen?: (\n\t\tevent: MouseEvent | FocusEvent,\n\t\tdata: PopoverRequestOpenData\n\t) => void;\n\t/**\n\t * Called when the popover requests to close, controlled or not. `data.trigger` says why. `event` is\n\t * the triggering click or key event, or `undefined` when there is none (`mouseLeave` timer,\n\t * `newPopover`). A controlled popover closes only if the parent sets `isOpen` to `false`.\n\t */\n\tonRequestClose?: (\n\t\tevent: MouseEvent | KeyboardEvent | undefined,\n\t\tdata: PopoverRequestCloseData\n\t) => void;\n\t/** Custom target element getter */\n\tonRequestTargetElement?: () => HTMLElement | null;\n\t/**\n\t * What on the first child opens the popover: `click` (the default), `hover`, or `hybrid` (click\n\t * or hover). `none` makes the first child only an anchor that the popover points at, such as\n\t * the target of a walkthrough step: Popover leaves its markup and handlers alone, and the\n\t * parent opens and closes the popover through `isOpen`.\n\t */\n\topenOn?: 'click' | 'hover' | 'hybrid' | 'none';\n\t/** Overlay for click-outside on iframes */\n\toverlay?:\n\t\tboolean | ((isOpen: boolean, overlayElement: HTMLSpanElement) => void);\n\t/** Positioning strategy */\n\tposition?: PopoverPosition;\n\t/** Walkthrough step text */\n\tstepText?: string;\n\t/** Styles for the root element: the `div` that wraps the trigger. To style the dialog, use `styleDialog`. */\n\tstyle?: CSSProperties;\n\t/** Styles for the `.slds-popover` dialog element */\n\tstyleDialog?: CSSProperties;\n\t/** Styles for the `.slds-popover__footer` element */\n\tstyleFooter?: CSSProperties;\n\t/** @deprecated Use `className`, which lands on the same element. */\n\ttriggerClassName?: string | string[] | Record<string, boolean>;\n\t/** Delay before closing on hover (ms) */\n\thoverCloseDelay?: number;\n}\n\n/** The `feature` variant, the only one with an `icon`. */\ninterface PopoverFeatureVariantProps {\n\t/** Popover variant */\n\tvariant: 'feature';\n\t/** Icon for the feature variant */\n\ticon?: ReactNode;\n}\n\n/** Every other variant. */\ninterface PopoverOtherVariantProps {\n\t/** Popover variant */\n\tvariant?: Exclude<PopoverVariant, 'feature'>;\n\ticon?: never;\n}\n\n/**\n * The dialog is named by `heading`, or by the `id` of another element in\n * `ariaLabelledby`, not both.\n */\nexport type PopoverLabelProps =\n\t| {\n\t\t\t/** Popover heading */\n\t\t\theading?: ReactNode;\n\t\t\tariaLabelledby?: never;\n\t }\n\t| {\n\t\t\theading?: never;\n\t\t\t/** HTML id of the heading element that labels the dialog. Use instead of `heading`. */\n\t\t\tariaLabelledby: string;\n\t };\n\n/**\n * Props for the Popover component: `icon` is feature-only, and `heading`\n * and `ariaLabelledby` are exclusive.\n */\nexport type PopoverProps = PopoverBaseProps &\n\t(PopoverFeatureVariantProps | PopoverOtherVariantProps) &\n\tPopoverLabelProps;\n\n/**\n * Props removed from the public API. Still destructured so they never reach\n * the DOM, and reported on mount.\n */\ninterface PopoverRemovedProps {\n\tcloseButtonAssistiveText?: unknown;\n\toffset?: unknown;\n}\n\n// Nubbin positions for export (legacy)\nexport const PopoverNubbinPositions = [\n\t'top left',\n\t'top',\n\t'top right',\n\t'bottom left',\n\t'bottom',\n\t'bottom right',\n];\n\nconst defaultAssistiveText: PopoverAssistiveText = {\n\tcloseButton: 'Close dialog',\n};\n\n/**\n * The Popover component is a non-modal dialog. It should be paired with a clickable\n * trigger such as a Button. It traps focus from the page and must be exited if focus\n * needs to be outside the Popover.\n */\nconst Popover = forwardRef<HTMLDivElement, PopoverProps>((props, ref) => {\n\tconst {\n\t\talign = 'right',\n\t\tassistiveText: propAssistiveText,\n\t\tariaLabelledby,\n\t\tchildren,\n\t\tbody,\n\t\tclassNameBody,\n\t\tclassNameFooter,\n\t\tfooterClassName,\n\t\tclassName,\n\t\tclassNameDialog,\n\t\tcontentsClassName,\n\t\tdisabled = false,\n\t\tfooter,\n\t\tfooterStyle,\n\t\tfooterWalkthroughActions,\n\t\thasNoCloseButton = false,\n\t\thasNoNubbin = false,\n\t\thasStaticAlignment = false,\n\t\thasNoTriggerStyles = false,\n\t\theading,\n\t\ticon,\n\t\tid: propId,\n\t\tisOpen: controlledIsOpen,\n\t\tdefaultIsOpen = false,\n\t\toffset,\n\t\tonClick,\n\t\tonClose,\n\t\tonFocus,\n\t\tonKeyDown,\n\t\tonMouseDown,\n\t\tonMouseEnter,\n\t\tonMouseLeave,\n\t\tonOpen,\n\t\tonRequestOpen,\n\t\tonRequestClose,\n\t\tonRequestTargetElement,\n\t\topenOn = 'click',\n\t\toverlay: overlayProp,\n\t\tposition = 'absolute',\n\t\tstepText,\n\t\tstyle,\n\t\tstyleDialog,\n\t\tstyleFooter,\n\t\ttriggerClassName,\n\t\tvariant = 'base',\n\t\thoverCloseDelay = 300,\n\t\tcloseButtonAssistiveText,\n\t} = props as PopoverBaseProps &\n\t\tPopoverRemovedProps & {\n\t\t\tariaLabelledby?: string;\n\t\t\theading?: ReactNode;\n\t\t\ticon?: ReactNode;\n\t\t\tvariant?: PopoverVariant;\n\t\t};\n\n\t// `check-props.js` is not wired up (its trigger and heading checks predate v11), so the\n\t// renamed and removed props are checked here.\n\tuseEffect(() => {\n\t\tif (process.env.NODE_ENV !== 'production') {\n\t\t\tconst createDocUrl = getComponentDocFn(componentDoc);\n\t\t\tconst renamedProps: [string, unknown, string][] = [\n\t\t\t\t['contentsClassName', contentsClassName, 'classNameDialog'],\n\t\t\t\t['footerClassName', footerClassName, 'classNameFooter'],\n\t\t\t\t['footerStyle', footerStyle, 'styleFooter'],\n\t\t\t\t['triggerClassName', triggerClassName, 'className'],\n\t\t\t];\n\t\t\trenamedProps.forEach(([oldProp, value, newProp]) => {\n\t\t\t\tdeprecatedProperty(\n\t\t\t\t\tPOPOVER,\n\t\t\t\t\tvalue,\n\t\t\t\t\toldProp,\n\t\t\t\t\tnewProp,\n\t\t\t\t\tcreateDocUrl(newProp)\n\t\t\t\t);\n\t\t\t});\n\t\t\tconst removedProps: [string, unknown, string | undefined][] = [\n\t\t\t\t[\n\t\t\t\t\t'closeButtonAssistiveText',\n\t\t\t\t\tcloseButtonAssistiveText,\n\t\t\t\t\t\"Use `assistiveText={{ closeButton: '...' }}` instead.\",\n\t\t\t\t],\n\t\t\t\t['offset', offset, undefined],\n\t\t\t];\n\t\t\tremovedProps.forEach(([oldProp, value, comment]) => {\n\t\t\t\tsunsetProperty(POPOVER, value, oldProp, comment);\n\t\t\t});\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []); // Only run on mount\n\n\tconst generatedId = useId();\n\tconst id = propId || generatedId;\n\tconst context = useContext(IconSettingsContext);\n\n\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\n\t// State\n\tconst [currentIsOpen, setIsOpen] = useControllableState(\n\t\tcontrolledIsOpen,\n\t\tdefaultIsOpen\n\t);\n\n\t// Refs\n\tconst triggerRef = useRef<HTMLDivElement>(null);\n\tconst dialogRef = useRef<HTMLElement>(null);\n\tconst isHoverRef = useRef(false);\n\tconst isClosingRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\tconst overlayRef = useRef<HTMLSpanElement | null>(null);\n\tconst isUnmountingRef = useRef(false);\n\n\t// Derived state\n\tconst isOpen = !disabled && currentIsOpen;\n\n\t// Get target element for positioning\n\tconst getTargetElement = useCallback(() => {\n\t\tif (onRequestTargetElement) {\n\t\t\tconst target = onRequestTargetElement();\n\t\t\tif (target) return target;\n\t\t}\n\t\treturn triggerRef.current;\n\t}, [onRequestTargetElement]);\n\n\t// Handle dialog close (when unmounted)\n\tconst handleDialogClose = useCallback(\n\t\t(\n\t\t\t_event?: React.SyntheticEvent,\n\t\t\tdata?: { componentWillUnmount?: boolean }\n\t\t) => {\n\t\t\tconst componentWillUnmount = data?.componentWillUnmount || false;\n\n\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\tcurrentOpenPopover = null;\n\t\t\t}\n\n\t\t\tif (onClose) {\n\t\t\t\tonClose(undefined, { componentWillUnmount });\n\t\t\t}\n\t\t},\n\t\t[id, onClose]\n\t);\n\n\t// Handle dialog open (after it has rendered)\n\tconst handleDialogOpen = useCallback(\n\t\t(_event?: unknown, data?: { portal?: HTMLElement }) => {\n\t\t\tif (onOpen) {\n\t\t\t\tonOpen(undefined, { portal: data?.portal });\n\t\t\t}\n\t\t},\n\t\t[onOpen]\n\t);\n\n\t// Handle close\n\tconst handleClose = useCallback(\n\t\t(\n\t\t\tevent: MouseEvent | KeyboardEvent | undefined,\n\t\t\tdata: PopoverRequestCloseData\n\t\t) => {\n\t\t\tif (isOpen) {\n\t\t\t\tif (onRequestClose) {\n\t\t\t\t\tonRequestClose(event, data);\n\t\t\t\t}\n\n\t\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\t\tcurrentOpenPopover = null;\n\t\t\t\t}\n\n\t\t\t\tsetIsOpen(false);\n\t\t\t\tisHoverRef.current = false;\n\t\t\t}\n\t\t},\n\t\t[isOpen, id, onRequestClose, setIsOpen]\n\t);\n\n\t// Latest `handleClose`, so the \"close the other open popover\" path does not call a stale\n\t// closure from when this popover opened (whose `isOpen` was still `false`).\n\tconst handleCloseRef = useRef(handleClose);\n\tuseEffect(() => {\n\t\thandleCloseRef.current = handleClose;\n\t}, [handleClose]);\n\n\t// Handle open\n\tconst handleOpen = useCallback(\n\t\t(event: MouseEvent | FocusEvent, trigger: PopoverRequestOpenTrigger) => {\n\t\t\tif (!isOpen && !disabled) {\n\t\t\t\tonRequestOpen?.(event, { trigger });\n\n\t\t\t\t// Close any other open popover\n\t\t\t\tif (currentOpenPopover && currentOpenPopover.getId() !== id) {\n\t\t\t\t\tcurrentOpenPopover.handleClose(undefined, {\n\t\t\t\t\t\ttrigger: 'newPopover',\n\t\t\t\t\t\tid: currentOpenPopover.getId(),\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tcurrentOpenPopover = {\n\t\t\t\t\thandleClose: (event, data) => handleCloseRef.current(event, data),\n\t\t\t\t\tgetId: () => id,\n\t\t\t\t};\n\n\t\t\t\tsetIsOpen(true);\n\t\t\t}\n\t\t},\n\t\t[isOpen, disabled, id, onRequestOpen, setIsOpen]\n\t);\n\n\t// Handle cancel (close button or escape)\n\tconst handleCancel = useCallback(\n\t\t(event: MouseEvent | KeyboardEvent) => {\n\t\t\thandleClose(event, { trigger: 'cancel' });\n\t\t},\n\t\t[handleClose]\n\t);\n\n\t// Request a close on a mousedown outside the popover. The container holds the trigger\n\t// and an inline dialog; a dialog in a portal carries the ignore class instead.\n\tconst handleClickOutside = useCallback(\n\t\t(event: globalThis.MouseEvent | TouchEvent) => {\n\t\t\thandleClose(event as unknown as MouseEvent, { trigger: 'clickOutside' });\n\t\t},\n\t\t[handleClose]\n\t);\n\tuseClickOutside(triggerRef, handleClickOutside, {\n\t\tenabled: isOpen,\n\t\tignoreClass: `ignore-click-${id}`,\n\t});\n\n\t// Handle mouse enter\n\tconst handleMouseEnter = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tisHoverRef.current = true;\n\n\t\t\tif (!isOpen && openOn === 'hover') {\n\t\t\t\thandleOpen(event, 'mouseEnter');\n\t\t\t} else {\n\t\t\t\tif (isClosingRef.current) {\n\t\t\t\t\tclearTimeout(isClosingRef.current);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (onMouseEnter) {\n\t\t\t\tonMouseEnter(event);\n\t\t\t}\n\t\t},\n\t\t[isOpen, openOn, handleOpen, onMouseEnter]\n\t);\n\n\t// Handle mouse leave\n\tconst handleMouseLeave = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tif (isOpen) {\n\t\t\t\tisClosingRef.current = setTimeout(() => {\n\t\t\t\t\thandleClose(undefined, { trigger: 'mouseLeave' });\n\t\t\t\t}, hoverCloseDelay);\n\t\t\t}\n\n\t\t\tif (onMouseLeave) {\n\t\t\t\tonMouseLeave(event);\n\t\t\t}\n\t\t},\n\t\t[isOpen, hoverCloseDelay, handleClose, onMouseLeave]\n\t);\n\n\t// Handle click\n\tconst handleClick = useCallback(\n\t\t(event: MouseEvent, triggerOnClickCallback?: (e: MouseEvent) => void) => {\n\t\t\tif (!isOpen) {\n\t\t\t\thandleOpen(event, 'triggerClick');\n\t\t\t} else {\n\t\t\t\thandleClose(event, { trigger: 'triggerClick' });\n\t\t\t}\n\n\t\t\tif (onClick) {\n\t\t\t\tonClick(event);\n\t\t\t}\n\n\t\t\tif (triggerOnClickCallback) {\n\t\t\t\ttriggerOnClickCallback(event);\n\t\t\t}\n\t\t},\n\t\t[isOpen, handleOpen, handleClose, onClick]\n\t);\n\n\t// Handle focus\n\tconst handleFocus = useCallback(\n\t\t(event: FocusEvent) => {\n\t\t\tif (!isOpen) {\n\t\t\t\thandleOpen(event, 'focus');\n\t\t\t}\n\n\t\t\tif (onFocus) {\n\t\t\t\tonFocus(event);\n\t\t\t}\n\t\t},\n\t\t[isOpen, handleOpen, onFocus]\n\t);\n\n\t// Toggle from keyboard\n\t// `handleKeyDown` is only attached to the open dialog, so this only ever closes it (Escape).\n\tconst toggleOpenFromKeyboard = useCallback(\n\t\t(event: KeyboardEvent) => {\n\t\t\tif (isOpen) {\n\t\t\t\thandleCancel(event);\n\t\t\t}\n\t\t},\n\t\t[isOpen, handleCancel]\n\t);\n\n\t// Handle key down\n\tconst handleKeyDown = useCallback(\n\t\t(event: KeyboardEvent) => {\n\t\t\tif (event.key) {\n\t\t\t\tif (event.key !== KEYS.TAB) {\n\t\t\t\t\tkeyboardNavigableDialog({\n\t\t\t\t\t\tevent,\n\t\t\t\t\t\tisOpen,\n\t\t\t\t\t\thandleClick: (e: MouseEvent) => handleClick(e),\n\t\t\t\t\t\tkey: event.key,\n\t\t\t\t\t\teventTarget: event.target,\n\t\t\t\t\t\t// keyboardNavigableDialog calls `toggleOpen()` without the event; pass it through\n\t\t\t\t\t\ttoggleOpen: () => toggleOpenFromKeyboard(event),\n\t\t\t\t\t\ttrigger: triggerRef.current,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (onKeyDown) {\n\t\t\t\t\tonKeyDown(event);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[isOpen, handleClick, toggleOpenFromKeyboard, onKeyDown]\n\t);\n\n\t// Render overlay for click-outside detection\n\tconst renderOverlay = useCallback(\n\t\t(shouldShow: boolean) => {\n\t\t\tif (typeof overlayProp === 'function' && documentDefined) {\n\t\t\t\toverlayProp(shouldShow, overlay);\n\t\t\t} else if (\n\t\t\t\toverlayProp &&\n\t\t\t\tshouldShow &&\n\t\t\t\t!overlayRef.current &&\n\t\t\t\tdocumentDefined\n\t\t\t) {\n\t\t\t\toverlayRef.current = overlay;\n\t\t\t\tdocument.querySelector('body')?.appendChild(overlay);\n\t\t\t} else if (!shouldShow && overlayRef.current?.parentNode) {\n\t\t\t\toverlayRef.current.parentNode.removeChild(overlayRef.current);\n\t\t\t\toverlayRef.current = null;\n\t\t\t}\n\t\t},\n\t\t[overlayProp]\n\t);\n\n\t// Container ref callback\n\tconst setContainerRef = useCallback(\n\t\t(component: HTMLDivElement | null) => {\n\t\t\t(triggerRef as React.RefObject<HTMLDivElement | null>).current =\n\t\t\t\tcomponent;\n\t\t\tif (typeof ref === 'function') {\n\t\t\t\tref(component);\n\t\t\t} else if (ref) {\n\t\t\t\tref.current = component;\n\t\t\t}\n\t\t},\n\t\t[ref]\n\t);\n\n\t// Dialog ref callback\n\tconst setMenuRef = useCallback((component: HTMLElement | null) => {\n\t\t(dialogRef as React.RefObject<HTMLElement | null>).current = component;\n\t}, []);\n\n\t// Cleanup on unmount\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tisUnmountingRef.current = true;\n\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\tcurrentOpenPopover = null;\n\t\t\t}\n\t\t\trenderOverlay(false);\n\t\t};\n\t}, [id, renderOverlay]);\n\n\t// Update overlay when isOpen changes\n\tuseEffect(() => {\n\t\trenderOverlay(isOpen);\n\t}, [isOpen, renderOverlay]);\n\n\t// Render header\n\tconst renderHeader = () => {\n\t\tconst hasThemedHeader = variant === 'error' || variant === 'warning';\n\t\tconst hasDefinedHeader = heading || hasThemedHeader;\n\n\t\tif (\n\t\t\t!hasDefinedHeader ||\n\t\t\tvariant === 'walkthrough-action' ||\n\t\t\tvariant === 'feature'\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst headerIcon = {\n\t\t\terror: <Icon category=\"utility\" name=\"error\" size=\"x-small\" inverse />,\n\t\t\twarning: (\n\t\t\t\t<Icon category=\"utility\" name=\"warning\" size=\"x-small\" inverse />\n\t\t\t),\n\t\t};\n\n\t\tif (hasThemedHeader) {\n\t\t\treturn (\n\t\t\t\t<header className=\"slds-popover__header\">\n\t\t\t\t\t<MediaObject\n\t\t\t\t\t\tbody={\n\t\t\t\t\t\t\t<h2\n\t\t\t\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\t\t\t\tclassName=\"slds-truncate slds-text-heading_medium\"\n\t\t\t\t\t\t\t\ttitle={typeof heading === 'string' ? heading : undefined}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{heading}\n\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfigure={headerIcon[variant as 'error' | 'warning']}\n\t\t\t\t\t\tverticalCenter\n\t\t\t\t\t/>\n\t\t\t\t</header>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<header\n\t\t\t\tclassName={classNames('slds-popover__header', {\n\t\t\t\t\t'slds-p-vertical_medium': variant === 'walkthrough',\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t<h2\n\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\tclassName={classNames({\n\t\t\t\t\t\t'slds-text-heading_small': variant !== 'walkthrough',\n\t\t\t\t\t\t'slds-text-heading_medium': variant === 'walkthrough',\n\t\t\t\t\t})}\n\t\t\t\t>\n\t\t\t\t\t{heading}\n\t\t\t\t</h2>\n\t\t\t</header>\n\t\t);\n\t};\n\n\t// Render body\n\tconst renderBody = () => {\n\t\tif (variant === 'error' || variant === 'warning') {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\t\tclassName={classNames('slds-popover__body', classNameBody as string)}\n\t\t\t\t>\n\t\t\t\t\t{body}\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\tif (variant === 'walkthrough-action' || variant === 'feature') {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tclassName={classNames('slds-popover__body', classNameBody as string)}\n\t\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\t>\n\t\t\t\t\t<div className=\"slds-media\">\n\t\t\t\t\t\t<div className=\"slds-media__figure\">\n\t\t\t\t\t\t\t{variant === 'walkthrough-action' ? (\n\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\t\t\tname=\"touch_action\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tinverse\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\ticon\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"slds-media__body\">\n\t\t\t\t\t\t\t{heading && (\n\t\t\t\t\t\t\t\t<h2\n\t\t\t\t\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\t\t\t\t\tclassName=\"slds-text-heading_small\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{heading}\n\t\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{body}\n\t\t\t\t\t\t\t{stepText && (\n\t\t\t\t\t\t\t\t<p className=\"slds-m-top_medium slds-text-title\">{stepText}</p>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\tclassName={classNames('slds-popover__body', classNameBody as string)}\n\t\t\t>\n\t\t\t\t{body}\n\t\t\t</div>\n\t\t);\n\t};\n\n\t// Render footer\n\tconst renderFooter = () => {\n\t\tconst footerClassNames = classNames(\n\t\t\t'slds-popover__footer',\n\t\t\tfooterClassName,\n\t\t\tclassNameFooter\n\t\t);\n\t\tconst footerStyles =\n\t\t\tfooterStyle || styleFooter\n\t\t\t\t? { ...footerStyle, ...styleFooter }\n\t\t\t\t: undefined;\n\n\t\tif (footer) {\n\t\t\treturn (\n\t\t\t\t<footer className={footerClassNames} style={footerStyles}>\n\t\t\t\t\t{footer}\n\t\t\t\t</footer>\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\tvariant !== 'walkthrough-action' &&\n\t\t\t(footerWalkthroughActions || stepText)\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<footer className={footerClassNames} style={footerStyles}>\n\t\t\t\t\t<div className=\"slds-grid slds-grid_vertical-align-center\">\n\t\t\t\t\t\t{stepText && <span className=\"slds-text-title\">{stepText}</span>}\n\t\t\t\t\t\t{footerWalkthroughActions && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"slds-col_bump-left\"\n\t\t\t\t\t\t\t\tstyle={{ display: 'inline-block' }}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{footerWalkthroughActions}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</footer>\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t};\n\n\t// Render dialog\n\tconst renderDialog = () => {\n\t\tif (!isOpen) return null;\n\n\t\tconst outsideClickIgnoreClass = `ignore-click-${id}`;\n\n\t\treturn (\n\t\t\t<Dialog\n\t\t\t\thasNubbin={!hasNoNubbin}\n\t\t\t\talign={align}\n\t\t\t\tcontentsClassName={classNames(\n\t\t\t\t\tcontentsClassName,\n\t\t\t\t\t'ignore-react-onclickoutside',\n\t\t\t\t\t'slds-popover',\n\t\t\t\t\t{ 'slds-popover_error': variant === 'error' },\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-popover_walkthrough':\n\t\t\t\t\t\t\tvariant === 'walkthrough' ||\n\t\t\t\t\t\t\tvariant === 'walkthrough-action' ||\n\t\t\t\t\t\t\tvariant === 'feature',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-popover_walkthrough-alt': variant === 'walkthrough-action',\n\t\t\t\t\t},\n\t\t\t\t\t{ 'slds-popover_feature': variant === 'feature' },\n\t\t\t\t\t{ 'slds-popover_warning': variant === 'warning' },\n\t\t\t\t\tclassNameDialog\n\t\t\t\t)}\n\t\t\t\tcontext={context}\n\t\t\t\thasStaticAlignment={hasStaticAlignment}\n\t\t\t\tonClose={handleDialogClose}\n\t\t\t\tonOpen={handleDialogOpen}\n\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\tonMouseEnter={openOn === 'hover' ? handleMouseEnter : undefined}\n\t\t\t\tonMouseLeave={openOn === 'hover' ? handleMouseLeave : undefined}\n\t\t\t\toutsideClickIgnoreClass={outsideClickIgnoreClass}\n\t\t\t\tonRequestTargetElement={getTargetElement}\n\t\t\t\tposition={position}\n\t\t\t\tstyle={styleDialog}\n\t\t\t\tvariant=\"popover\"\n\t\t\t\tref={setMenuRef}\n\t\t\t\tcontainerProps={{\n\t\t\t\t\tid: `${id}-popover`,\n\t\t\t\t\t'aria-labelledby': ariaLabelledby || `${id}-dialog-heading`,\n\t\t\t\t\t'aria-describedby': `${id}-dialog-body`,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{!hasNoCloseButton && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tassistiveText={{ icon: assistiveText.closeButton }}\n\t\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\t\ticonName=\"close\"\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-button slds-button_icon-small slds-float_right slds-popover__close slds-button_icon',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'slds-button_icon-inverse':\n\t\t\t\t\t\t\t\t\tvariant === 'walkthrough' ||\n\t\t\t\t\t\t\t\t\tvariant === 'walkthrough-action' ||\n\t\t\t\t\t\t\t\t\tvariant === 'feature',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tonClick={handleCancel}\n\t\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t\t\tinverse={variant === 'error' || variant === 'warning'}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{renderHeader()}\n\t\t\t\t{renderBody()}\n\t\t\t\t{renderFooter()}\n\t\t\t</Dialog>\n\t\t);\n\t};\n\n\t// Clone trigger element\n\tconst otherChildren: ReactNode[] = [];\n\tlet clonedTrigger: ReactNode = null;\n\n\tReact.Children.forEach(children, (child, index) => {\n\t\tif (index === 0 && openOn === 'none') {\n\t\t\t// An anchor only: the popover is positioned against it, nothing more\n\t\t\tclonedTrigger = child;\n\t\t} else if (index === 0 && React.isValidElement(child)) {\n\t\t\tconst childProps = child.props as Record<string, unknown>;\n\t\t\t// The trigger's own handlers run alongside the popover's instead of being replaced.\n\t\t\t// `onClick` already calls the trigger's after the popover's (see `handleClick`).\n\t\t\tconst childOnClick = childProps.onClick;\n\t\t\tconst triggerProps = mergeProps(\n\t\t\t\t{\n\t\t\t\t\t'aria-haspopup': 'dialog',\n\t\t\t\t\tid,\n\t\t\t\t\tonClick:\n\t\t\t\t\t\topenOn === 'click' || openOn === 'hybrid'\n\t\t\t\t\t\t\t? (event: MouseEvent) => {\n\t\t\t\t\t\t\t\t\thandleClick(event, childOnClick as (e: MouseEvent) => void);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: childOnClick,\n\t\t\t\t\tonFocus: openOn === 'hover' ? handleFocus : undefined,\n\t\t\t\t\tonMouseDown,\n\t\t\t\t\tonMouseEnter:\n\t\t\t\t\t\topenOn === 'hover' || openOn === 'hybrid'\n\t\t\t\t\t\t\t? handleMouseEnter\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\tonMouseLeave:\n\t\t\t\t\t\topenOn === 'hover' || openOn === 'hybrid'\n\t\t\t\t\t\t\t? handleMouseLeave\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t// `??` so a trigger can opt out of the tab order with -1 (or 0 as a string)\n\t\t\t\t\ttabIndex: childProps.tabIndex ?? 0,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tonFocus: childProps.onFocus,\n\t\t\t\t\tonMouseDown: childProps.onMouseDown,\n\t\t\t\t\tonMouseEnter: childProps.onMouseEnter,\n\t\t\t\t\tonMouseLeave: childProps.onMouseLeave,\n\t\t\t\t}\n\t\t\t);\n\t\t\tclonedTrigger = React.cloneElement(child, triggerProps);\n\t\t} else if (child) {\n\t\t\totherChildren.push(child);\n\t\t}\n\t});\n\n\tconst containerStyles: CSSProperties = {\n\t\tdisplay: hasNoTriggerStyles ? undefined : 'inline-block',\n\t\t...style,\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames(triggerClassName, className) || undefined}\n\t\t\tstyle={containerStyles}\n\t\t\tref={setContainerRef}\n\t\t>\n\t\t\t{clonedTrigger}\n\t\t\t{otherChildren.length > 0 ? otherChildren : null}\n\t\t\t{renderDialog()}\n\t\t</div>\n\t);\n});\n\nPopover.displayName = POPOVER;\n\nexport default Popover;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkCA,IAAM,IAAkB,OAAO,WAAa,KAGtC,IAAU,IACb,SAAS,cAAc,MAAM,IAC5B,EAAE,OAAO,CAAC,EAAE;AACZ,MACH,EAAQ,MAAM,MAAM,KACpB,EAAQ,MAAM,OAAO,KACrB,EAAQ,MAAM,QAAQ,QACtB,EAAQ,MAAM,SAAS,QACvB,EAAQ,MAAM,WAAW;AAI1B,IAAI,IAMO,MAwQE,IAAyB;CACrC;CACA;CACA;CACA;CACA;CACA;AACD,GAEM,KAA6C,EAClD,aAAa,eACd,GAOM,IAAU,IAA0C,IAAO,MAAQ;CACxE,IAAM,EACL,WAAQ,SACR,eAAe,IACf,mBACA,cACA,SACA,kBACA,qBACA,qBACA,eACA,qBACA,uBACA,cAAW,IACX,YACA,gBACA,6BACA,uBAAmB,IACnB,kBAAc,IACd,yBAAqB,IACrB,yBAAqB,IACrB,YACA,UACA,IAAI,IACJ,QAAQ,IACR,oBAAgB,IAChB,YACA,YACA,YACA,YACA,cACA,iBACA,iBACA,iBACA,WACA,mBACA,mBACA,2BACA,YAAS,SACT,SAAS,GACT,eAAW,YACX,aACA,WACA,iBACA,iBACA,sBACA,aAAU,QACV,sBAAkB,KAClB,iCACG;CAUJ,QAAgB;EACf,IAAA,QAAA,IAAA,aAA6B,cAAc;GAC1C,IAAM,IAAe,EAAkB,EAAY;GAwBnD,AAjBA;IALC;KAAC;KAAqB;KAAmB;IA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,IACA,KAAA;IACJ,cACC,MAAW,WAAW,MAAW,WAC9B,KACA,KAAA;IAEJ,UAAU,EAAW,YAAY;GAClC,GACA;IACC,SAAS,EAAW;IACpB,aAAa,EAAW;IACxB,cAAc,EAAW;IACzB,cAAc,EAAW;GAC1B,CACD;GACA,IAAgB,EAAM,aAAa,GAAO,CAAY;EACvD,OAAO,AAAI,KACV,EAAc,KAAK,CAAK;CAE1B,CAAC;CAED,IAAM,KAAiC;EACtC,SAAS,KAAqB,KAAA,IAAY;EAC1C,GAAG;CACJ;CAEA,OACC,kBAAC,OAAD;EACC,WAAW,EAAW,IAAkB,EAAS,KAAK,KAAA;EACtD,OAAO;EACP,KAAK;EAHN,UAAA;GAKE;GACA,EAAc,SAAS,IAAI,IAAgB;GAC3C,GAAa;EACV;;AAEP,CAAC;AAED,EAAQ,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.js","names":[],"sources":["../../../../../components/progress-indicator/private/step.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 */\nimport React from 'react';\n\n// ### classNames\n// [github.com/JedWatson/classnames](https://github.com/JedWatson/classnames)\n// This project uses `classnames`, 'a simple javascript utility for conditionally\n// joining classNames together.'\nimport classNames from 'classnames';\n\n// Child component\nimport Tooltip, { type TooltipAlign, type TooltipTheme } from '../../tooltip';\nimport { PROGRESS_INDICATOR_STEP } from '../../../utilities/constants';\nimport ButtonIcon from '../../icon/button-icon';\nimport {\n\ttype ProgressStep,\n\ttype ProgressIndicatorAssistiveText,\n\ttype ProgressIndicatorVariant,\n\ttype TooltipPosition,\n\ttype StepEventData,\n} from '../index';\n\n// ### Display Name\nconst displayName = PROGRESS_INDICATOR_STEP;\n\nexport interface StepProps {\n\t/**\n\t * **Assistive text for accessibility**\n\t * This object is merged with the default props object on every render.\n\t * * `completedStep`: Label for a completed step. The default is `Completed Step`\n\t * * `disabledStep`: Label for disabled step. The default is `Disabled Step`\n\t * * `errorStep`: Label for a step with an error. The default is `Error Step`\n\t * * `percentage`: Label for Progress Bar. The default is `Progress: [this.props.value]%`.\n\t * * `step`: Label for a step. It will be typically followed by the number of the step such as \"Step 1\".\n\t */\n\tassistiveText?: ProgressIndicatorAssistiveText;\n\t/**\n\t * Id for Steps, ranging in [0, steps.length).\n\t */\n\tid?: number | string;\n\t/**\n\t * Index of step. Used for id's if no step ID exists\n\t */\n\tindex: number;\n\t/**\n\t * Determines if the step has been completed\n\t */\n\tisCompleted?: boolean;\n\t/**\n\t * Determines if the step has been disabled\n\t */\n\tisDisabled?: boolean;\n\t/**\n\t * Determines if the step contains an error\n\t */\n\tisError?: boolean;\n\t/**\n\t * Determines if the step is currently selected (active)\n\t */\n\tisSelected?: boolean;\n\t/**\n\t * Triggered when click on individual steps.\n\t */\n\tonClick?: (\n\t\tevent: React.MouseEvent | React.KeyboardEvent,\n\t\tdata: StepEventData\n\t) => void;\n\t/**\n\t * Triggered when focus on individual steps.\n\t */\n\tonFocus?: (event: React.FocusEvent, data: StepEventData) => void;\n\t/**\n\t * Step object. This is passed into event callbacks.\n\t */\n\tstep: ProgressStep;\n\t/**\n\t * Determines if the tooltip attached to step is always open.\n\t */\n\ttooltipIsOpen?: boolean;\n\t/**\n\t * Position strategy for the step's tooltip.\n\t */\n\ttooltipPosition?: TooltipPosition;\n\t/**\n\t * The variant of the parent progress indicator\n\t */\n\tvariant?: ProgressIndicatorVariant;\n}\n\n/**\n * Step renders a button icon and its tooltip if applied.\n * The button is applied with different css classes under different conditions.\n * Button icons have 4 types of status: completed (success), active (in progress), error (warning) and uncompleted (not approached)\n */\nclass Step extends React.Component<StepProps> {\n\tstatic displayName = displayName;\n\n\t/**\n\t * buttonIcon represents the button icon used for each step.\n\t * the button is applied with different css classes under different conditions.\n\t */\n\tbuttonIcon(renderIcon: boolean, status: string, props: StepProps) {\n\t\tconst data: StepEventData = {\n\t\t\tisSelected: !!props.isSelected,\n\t\t\tisError: !!props.isError,\n\t\t\tisCompleted: !!props.isCompleted,\n\t\t\tisDisabled: !!props.isDisabled,\n\t\t\tstep: props.step,\n\t\t};\n\n\t\tconst icon = renderIcon ? (\n\t\t\t<ButtonIcon\n\t\t\t\tcategory=\"utility\"\n\t\t\t\tname={this.props.isError ? 'error' : 'success'}\n\t\t\t/>\n\t\t) : null;\n\n\t\tconst handleClick = (event: React.MouseEvent) =>\n\t\t\tprops.onClick?.(event, data);\n\t\tconst handleFocus = (event: React.FocusEvent) =>\n\t\t\tprops.onFocus?.(event, data);\n\n\t\tconst stepButton = props.isDisabled ? (\n\t\t\t<a\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-button',\n\t\t\t\t\t{ 'slds-button_icon': renderIcon },\n\t\t\t\t\t'slds-progress__marker',\n\t\t\t\t\t{ 'slds-progress__marker_icon': renderIcon },\n\t\t\t\t\t'slds-is-disabled'\n\t\t\t\t)}\n\t\t\t\taria-disabled\n\t\t\t\tstyle={{ cursor: 'not-allowed' }}\n\t\t\t\ttabIndex={0}\n\t\t\t\trole=\"button\"\n\t\t\t>\n\t\t\t\t{icon}\n\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t{this.props.step.assistiveText || (\n\t\t\t\t\t\t<React.Fragment>\n\t\t\t\t\t\t\t{`${props.assistiveText?.step} ${props.index + 1}: `}\n\t\t\t\t\t\t\t{props.step.label}\n\t\t\t\t\t\t\t{`- ${status}`}\n\t\t\t\t\t\t</React.Fragment>\n\t\t\t\t\t)}\n\t\t\t\t</span>\n\t\t\t</a>\n\t\t) : (\n\t\t\t<button\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-button',\n\t\t\t\t\t{ 'slds-button_icon': renderIcon },\n\t\t\t\t\t'slds-progress__marker',\n\t\t\t\t\t{ 'slds-progress__marker_icon': renderIcon }\n\t\t\t\t)}\n\t\t\t\tonClick={handleClick}\n\t\t\t\tonFocus={handleFocus}\n\t\t\t\taria-current={this.props.isSelected ? 'step' : undefined}\n\t\t\t\ttype=\"button\"\n\t\t\t>\n\t\t\t\t{icon}\n\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t{this.props.step.assistiveText || (\n\t\t\t\t\t\t<React.Fragment>\n\t\t\t\t\t\t\t{`${props.assistiveText?.step} ${props.index + 1}: `}\n\t\t\t\t\t\t\t{props.step.label}\n\t\t\t\t\t\t\t{status ? ` - ${status}` : ''}\n\t\t\t\t\t\t</React.Fragment>\n\t\t\t\t\t)}\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t);\n\n\t\treturn stepButton;\n\t}\n\n\trender() {\n\t\tconst renderIcon = this.props.isCompleted || this.props.isError;\n\t\tlet status = '';\n\t\tif (this.props.isError) {\n\t\t\tstatus = this.props.assistiveText?.errorStep || '';\n\t\t} else if (this.props.isCompleted) {\n\t\t\tstatus = this.props.assistiveText?.completedStep || '';\n\t\t} else if (this.props.isDisabled) {\n\t\t\tstatus = this.props.assistiveText?.disabledStep || '';\n\t\t}\n\n\t\tconst tooltipProps: {\n\t\t\talign: TooltipAlign;\n\t\t\tid: string;\n\t\t\tcontent: React.ReactNode;\n\t\t\ttheme: TooltipTheme;\n\t\t\tposition?: TooltipPosition;\n\t\t\ttriggerStyle: React.CSSProperties;\n\t\t\tisOpen?: boolean;\n\t\t} = {\n\t\t\talign: 'top',\n\t\t\tid: `progress-indicator-tooltip-${\n\t\t\t\tthis.props.step.id ?? this.props.index\n\t\t\t}`,\n\t\t\tcontent: this.props.step.label,\n\t\t\ttheme: 'info',\n\t\t\tposition: this.props.tooltipPosition,\n\t\t\ttriggerStyle: { display: !renderIcon ? 'flex' : '' },\n\t\t};\n\n\t\t// This is mainly for dev test purpose.\n\t\t// `isOpen` is only set to true if tooltip is specified to be open\n\t\t// Do not set isOpen to false or undefined otherwise, because that will\n\t\t// disable any interaction with tooltips\n\t\tif (this.props.tooltipIsOpen) {\n\t\t\ttooltipProps.isOpen = true;\n\t\t}\n\n\t\treturn (\n\t\t\t<li\n\t\t\t\tclassName={classNames('slds-progress__item', {\n\t\t\t\t\t'slds-is-completed': this.props.isCompleted,\n\t\t\t\t\t'slds-is-active': this.props.isSelected && !this.props.isError,\n\t\t\t\t\t'slds-has-error': this.props.isError,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t<Tooltip\n\t\t\t\t\t{...tooltipProps}\n\t\t\t\t\ttrigger={this.buttonIcon(!!renderIcon, status, this.props)}\n\t\t\t\t/>\n\t\t\t</li>\n\t\t);\n\t}\n}\n\nexport default Step;\n"],"mappings":";;;;;;;AAuBA,IAAM,IAAc,GAuEd,IAAN,cAAmB,EAAM,UAAqB;CAC7C,OAAO,cAAc;CAMrB,WAAW,GAAqB,GAAgB,GAAkB;EACjE,IAAM,IAAsB;GAC3B,YAAY,CAAC,CAAC,EAAM;GACpB,SAAS,CAAC,CAAC,EAAM;GACjB,aAAa,CAAC,CAAC,EAAM;GACrB,YAAY,CAAC,CAAC,EAAM;GACpB,MAAM,EAAM;EACb,GAEM,IAAO,IACZ,kBAAC,GAAD;GACC,UAAS;GACT,MAAM,KAAK,MAAM,UAAU,UAAU;EACrC,CAAA,IACE;
|
|
1
|
+
{"version":3,"file":"step.js","names":[],"sources":["../../../../../components/progress-indicator/private/step.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 */\nimport React from 'react';\n\n// ### classNames\n// [github.com/JedWatson/classnames](https://github.com/JedWatson/classnames)\n// This project uses `classnames`, 'a simple javascript utility for conditionally\n// joining classNames together.'\nimport classNames from 'classnames';\n\n// Child component\nimport Tooltip, { type TooltipAlign, type TooltipTheme } from '../../tooltip';\nimport { PROGRESS_INDICATOR_STEP } from '../../../utilities/constants';\nimport ButtonIcon from '../../icon/button-icon';\nimport {\n\ttype ProgressStep,\n\ttype ProgressIndicatorAssistiveText,\n\ttype ProgressIndicatorVariant,\n\ttype TooltipPosition,\n\ttype StepEventData,\n} from '../index';\n\n// ### Display Name\nconst displayName = PROGRESS_INDICATOR_STEP;\n\nexport interface StepProps {\n\t/**\n\t * **Assistive text for accessibility**\n\t * This object is merged with the default props object on every render.\n\t * * `completedStep`: Label for a completed step. The default is `Completed Step`\n\t * * `disabledStep`: Label for disabled step. The default is `Disabled Step`\n\t * * `errorStep`: Label for a step with an error. The default is `Error Step`\n\t * * `percentage`: Label for Progress Bar. The default is `Progress: [this.props.value]%`.\n\t * * `step`: Label for a step. It will be typically followed by the number of the step such as \"Step 1\".\n\t */\n\tassistiveText?: ProgressIndicatorAssistiveText;\n\t/**\n\t * Id for Steps, ranging in [0, steps.length).\n\t */\n\tid?: number | string;\n\t/**\n\t * Index of step. Used for id's if no step ID exists\n\t */\n\tindex: number;\n\t/**\n\t * Determines if the step has been completed\n\t */\n\tisCompleted?: boolean;\n\t/**\n\t * Determines if the step has been disabled\n\t */\n\tisDisabled?: boolean;\n\t/**\n\t * Determines if the step contains an error\n\t */\n\tisError?: boolean;\n\t/**\n\t * Determines if the step is currently selected (active)\n\t */\n\tisSelected?: boolean;\n\t/**\n\t * Triggered when click on individual steps.\n\t */\n\tonClick?: (\n\t\tevent: React.MouseEvent | React.KeyboardEvent,\n\t\tdata: StepEventData\n\t) => void;\n\t/**\n\t * Triggered when focus on individual steps.\n\t */\n\tonFocus?: (event: React.FocusEvent, data: StepEventData) => void;\n\t/**\n\t * Step object. This is passed into event callbacks.\n\t */\n\tstep: ProgressStep;\n\t/**\n\t * Determines if the tooltip attached to step is always open.\n\t */\n\ttooltipIsOpen?: boolean;\n\t/**\n\t * Position strategy for the step's tooltip.\n\t */\n\ttooltipPosition?: TooltipPosition;\n\t/**\n\t * The variant of the parent progress indicator\n\t */\n\tvariant?: ProgressIndicatorVariant;\n}\n\n/**\n * Step renders a button icon and its tooltip if applied.\n * The button is applied with different css classes under different conditions.\n * Button icons have 4 types of status: completed (success), active (in progress), error (warning) and uncompleted (not approached)\n */\nclass Step extends React.Component<StepProps> {\n\tstatic displayName = displayName;\n\n\t/**\n\t * buttonIcon represents the button icon used for each step.\n\t * the button is applied with different css classes under different conditions.\n\t */\n\tbuttonIcon(renderIcon: boolean, status: string, props: StepProps) {\n\t\tconst data: StepEventData = {\n\t\t\tisSelected: !!props.isSelected,\n\t\t\tisError: !!props.isError,\n\t\t\tisCompleted: !!props.isCompleted,\n\t\t\tisDisabled: !!props.isDisabled,\n\t\t\tstep: props.step,\n\t\t};\n\n\t\tconst icon = renderIcon ? (\n\t\t\t<ButtonIcon\n\t\t\t\tcategory=\"utility\"\n\t\t\t\tname={this.props.isError ? 'error' : 'success'}\n\t\t\t/>\n\t\t) : null;\n\n\t\tconst handleClick = (event: React.MouseEvent) =>\n\t\t\tprops.onClick?.(event, data);\n\t\tconst handleFocus = (event: React.FocusEvent) =>\n\t\t\tprops.onFocus?.(event, data);\n\n\t\tconst stepButton = props.isDisabled ? (\n\t\t\t// eslint-disable-next-line jsx-a11y/anchor-is-valid -- SLDS disabled step marker markup uses an anchor\n\t\t\t<a\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-button',\n\t\t\t\t\t{ 'slds-button_icon': renderIcon },\n\t\t\t\t\t'slds-progress__marker',\n\t\t\t\t\t{ 'slds-progress__marker_icon': renderIcon },\n\t\t\t\t\t'slds-is-disabled'\n\t\t\t\t)}\n\t\t\t\taria-disabled\n\t\t\t\tstyle={{ cursor: 'not-allowed' }}\n\t\t\t\ttabIndex={0}\n\t\t\t\trole=\"button\"\n\t\t\t>\n\t\t\t\t{icon}\n\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t{this.props.step.assistiveText || (\n\t\t\t\t\t\t<React.Fragment>\n\t\t\t\t\t\t\t{`${props.assistiveText?.step} ${props.index + 1}: `}\n\t\t\t\t\t\t\t{props.step.label}\n\t\t\t\t\t\t\t{`- ${status}`}\n\t\t\t\t\t\t</React.Fragment>\n\t\t\t\t\t)}\n\t\t\t\t</span>\n\t\t\t</a>\n\t\t) : (\n\t\t\t<button\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-button',\n\t\t\t\t\t{ 'slds-button_icon': renderIcon },\n\t\t\t\t\t'slds-progress__marker',\n\t\t\t\t\t{ 'slds-progress__marker_icon': renderIcon }\n\t\t\t\t)}\n\t\t\t\tonClick={handleClick}\n\t\t\t\tonFocus={handleFocus}\n\t\t\t\taria-current={this.props.isSelected ? 'step' : undefined}\n\t\t\t\ttype=\"button\"\n\t\t\t>\n\t\t\t\t{icon}\n\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t{this.props.step.assistiveText || (\n\t\t\t\t\t\t<React.Fragment>\n\t\t\t\t\t\t\t{`${props.assistiveText?.step} ${props.index + 1}: `}\n\t\t\t\t\t\t\t{props.step.label}\n\t\t\t\t\t\t\t{status ? ` - ${status}` : ''}\n\t\t\t\t\t\t</React.Fragment>\n\t\t\t\t\t)}\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t);\n\n\t\treturn stepButton;\n\t}\n\n\trender() {\n\t\tconst renderIcon = this.props.isCompleted || this.props.isError;\n\t\tlet status = '';\n\t\tif (this.props.isError) {\n\t\t\tstatus = this.props.assistiveText?.errorStep || '';\n\t\t} else if (this.props.isCompleted) {\n\t\t\tstatus = this.props.assistiveText?.completedStep || '';\n\t\t} else if (this.props.isDisabled) {\n\t\t\tstatus = this.props.assistiveText?.disabledStep || '';\n\t\t}\n\n\t\tconst tooltipProps: {\n\t\t\talign: TooltipAlign;\n\t\t\tid: string;\n\t\t\tcontent: React.ReactNode;\n\t\t\ttheme: TooltipTheme;\n\t\t\tposition?: TooltipPosition;\n\t\t\ttriggerStyle: React.CSSProperties;\n\t\t\tisOpen?: boolean;\n\t\t} = {\n\t\t\talign: 'top',\n\t\t\tid: `progress-indicator-tooltip-${\n\t\t\t\tthis.props.step.id ?? this.props.index\n\t\t\t}`,\n\t\t\tcontent: this.props.step.label,\n\t\t\ttheme: 'info',\n\t\t\tposition: this.props.tooltipPosition,\n\t\t\ttriggerStyle: { display: !renderIcon ? 'flex' : '' },\n\t\t};\n\n\t\t// This is mainly for dev test purpose.\n\t\t// `isOpen` is only set to true if tooltip is specified to be open\n\t\t// Do not set isOpen to false or undefined otherwise, because that will\n\t\t// disable any interaction with tooltips\n\t\tif (this.props.tooltipIsOpen) {\n\t\t\ttooltipProps.isOpen = true;\n\t\t}\n\n\t\treturn (\n\t\t\t<li\n\t\t\t\tclassName={classNames('slds-progress__item', {\n\t\t\t\t\t'slds-is-completed': this.props.isCompleted,\n\t\t\t\t\t'slds-is-active': this.props.isSelected && !this.props.isError,\n\t\t\t\t\t'slds-has-error': this.props.isError,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t<Tooltip\n\t\t\t\t\t{...tooltipProps}\n\t\t\t\t\ttrigger={this.buttonIcon(!!renderIcon, status, this.props)}\n\t\t\t\t/>\n\t\t\t</li>\n\t\t);\n\t}\n}\n\nexport default Step;\n"],"mappings":";;;;;;;AAuBA,IAAM,IAAc,GAuEd,IAAN,cAAmB,EAAM,UAAqB;CAC7C,OAAO,cAAc;CAMrB,WAAW,GAAqB,GAAgB,GAAkB;EACjE,IAAM,IAAsB;GAC3B,YAAY,CAAC,CAAC,EAAM;GACpB,SAAS,CAAC,CAAC,EAAM;GACjB,aAAa,CAAC,CAAC,EAAM;GACrB,YAAY,CAAC,CAAC,EAAM;GACpB,MAAM,EAAM;EACb,GAEM,IAAO,IACZ,kBAAC,GAAD;GACC,UAAS;GACT,MAAM,KAAK,MAAM,UAAU,UAAU;EACrC,CAAA,IACE;EA2DJ,OApDmB,EAAM,aAExB,kBAAC,KAAD;GACC,WAAW,EACV,eACA,EAAE,oBAAoB,EAAW,GACjC,yBACA,EAAE,8BAA8B,EAAW,GAC3C,kBACD;GACA,iBAAA;GACA,OAAO,EAAE,QAAQ,cAAc;GAC/B,UAAU;GACV,MAAK;GAXN,UAAA,CAaE,GACD,kBAAC,QAAD;IAAM,WAAU;IACd,UAAA,KAAK,MAAM,KAAK,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,kBAAkB,KAAK,MAAM,cAAc,CAAC,KAAK,MAAM;IACvD,kBAAkB,KAAK,MAAM;GAC9B,CAAC;GAED,UAAA,kBAAC,GAAD;IACC,GAAI;IACJ,SAAS,KAAK,WAAW,CAAC,CAAC,GAAY,GAAQ,KAAK,KAAK;GACzD,CAAA;EACE,CAAA;CAEN;AACD"}
|
|
@@ -47,7 +47,7 @@ var h = {}, g = {}, _ = (_) => {
|
|
|
47
47
|
A
|
|
48
48
|
]), $;
|
|
49
49
|
return $ = P === "swatch" ? /* @__PURE__ */ p("label", {
|
|
50
|
-
style: { border: "1px" },
|
|
50
|
+
style: { border: "var(--slds-g-sizing-border-1, 1px)" },
|
|
51
51
|
className: "slds-radio_button__label",
|
|
52
52
|
htmlFor: Y,
|
|
53
53
|
children: /* @__PURE__ */ p("span", { children: /* @__PURE__ */ p(a, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../components/radio/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\tuseRef,\n\tuseId,\n\tuseCallback,\n\tuseEffect,\n\ttype ChangeEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype CSSProperties,\n} from 'react';\nimport classNames from 'classnames';\nimport KEYS from '../../utilities/key-code';\nimport { RADIO } from '../../utilities/constants';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport getDataProps from '../../utilities/get-data-props';\nimport Swatch from '../../components/color-picker/private/swatch';\nimport Icon from '../icon';\nimport { checkDeprecatedProps } from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Radio variant types\n */\nexport type RadioVariant = 'base' | 'button-group' | 'swatch' | 'visual-picker';\nexport type RadioSize = 'medium' | 'large';\n\n/**\n * Assistive text for Radio\n */\nexport interface RadioAssistiveText {\n\t/** Visually hidden label */\n\tlabel?: string;\n}\n\n/**\n * Labels for Radio\n */\nexport interface RadioLabels {\n\t/** Heading for visual picker variant */\n\theading?: string;\n\t/** Label for the radio input */\n\tlabel?: string;\n}\n\n/**\n * Refs for Radio\n */\nexport interface RadioRefs {\n\t/** Ref callback for input element */\n\tinput?: (input: HTMLInputElement | null) => void;\n}\n\n/**\n * Change event data for Radio\n */\nexport interface RadioChangeData {\n\t/**\n\t * The requested checked state: `true` when the user selects the radio,\n\t * `false` when a `deselectable` radio that is checked is clicked again.\n\t */\n\tchecked: boolean;\n}\n\n/**\n * Change handler for Radio\n */\nexport type RadioChangeHandler = (\n\tevent: ChangeEvent<HTMLInputElement> | KeyboardEvent<HTMLInputElement>,\n\tdata: RadioChangeData\n) => void;\n\n/**\n * Props for the Radio component\n */\ninterface RadioBaseProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: RadioAssistiveText;\n\t/** ARIA describedby attribute */\n\t'aria-describedby'?: string;\n\t/** ARIA labelledby attribute */\n\t'aria-labelledby'?: string;\n\t/**\n\t * Whether the radio is checked. Radio is controlled: update this prop from\n\t * `onChange`. Inside a `RadioGroup`/`RadioButtonGroup`, pass `value` to the\n\t * group instead and the group derives `checked` for each radio.\n\t */\n\tchecked: boolean;\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Whether radio can be deselected */\n\tdeselectable?: boolean;\n\t/** Whether radio is disabled */\n\tdisabled?: boolean;\n\t/** Unique ID for the input */\n\tid?: string;\n\t/** ID for the label element */\n\tlabelId?: string;\n\t/** Text labels */\n\tlabels?: RadioLabels;\n\t/** Input name attribute */\n\tname?: string;\n\t/**\n\t * Called with the requested checked state in `data.checked`. The rendered\n\t * state only changes when `checked` is updated.\n\t */\n\tonChange: RadioChangeHandler;\n\t/** Focus handler */\n\tonFocus?: (event: FocusEvent<HTMLInputElement>) => void;\n\t/**\n\t * @deprecated Focus the radio through `refs.input` instead. Called with the `<input>`\n\t * when `requestFocus` is set. Still works, and warns.\n\t */\n\tonRequestFocus?: (input: HTMLInputElement) => void;\n\t/** @deprecated Focus the radio through `refs.input` instead. Still works, and warns. */\n\trequestFocus?: boolean;\n\t/** Tab index */\n\ttabIndex?: number;\n\t/** Input value */\n\tvalue?: string;\n\t/** Ref callbacks */\n\trefs?: RadioRefs;\n}\n\n/** Props only the visual picker takes. */\ninterface RadioVisualPickerOnlyProps {\n\t/** Visual picker: coverable when selected */\n\tcoverable?: boolean;\n\t/** Visual picker: vertical layout */\n\tvertical?: boolean;\n\t/** Visual picker: figure content, rendered inside `.slds-visual-picker__figure` when not `coverable` */\n\tvisualPickerFigure?: React.ReactNode;\n\t/** Visual picker: coverable figure content shown when selected */\n\tvisualPickerFigureSelected?: React.ReactNode;\n\t/** Visual picker: coverable figure content shown when not selected */\n\tvisualPickerFigureNotSelected?: React.ReactNode;\n\t/** @deprecated Use `visualPickerFigure` instead. */\n\tonRenderVisualPicker?: () => React.ReactNode;\n\t/** @deprecated Use `visualPickerFigureSelected` instead. */\n\tonRenderVisualPickerSelected?: () => React.ReactNode;\n\t/** @deprecated Use `visualPickerFigureNotSelected` instead. */\n\tonRenderVisualPickerNotSelected?: () => React.ReactNode;\n\t/** Visual picker: size. Defaults to `medium`. */\n\tsize?: RadioSize;\n}\n\n/** Visual-picker-only props, rejected by the other variants. */\ntype RadioVisualPickerOnlyNever = {\n\t[K in keyof RadioVisualPickerOnlyProps]?: never;\n};\n\n/** A plain radio, or a button inside a `RadioButtonGroup`. */\ninterface RadioPlainVariantProps extends RadioVisualPickerOnlyNever {\n\t/** Radio variant */\n\tvariant?: 'base' | 'button-group';\n\tstyle?: never;\n}\n\n/** A color swatch button. `value` is the color. */\ninterface RadioSwatchVariantProps extends RadioVisualPickerOnlyNever {\n\t/** Radio variant */\n\tvariant: 'swatch';\n\t/** Custom styles for the swatch */\n\tstyle?: CSSProperties;\n}\n\n/** An option inside a `VisualPicker`. */\ninterface RadioVisualPickerVariantProps extends RadioVisualPickerOnlyProps {\n\t/** Radio variant */\n\tvariant: 'visual-picker';\n\tstyle?: never;\n}\n\ntype RadioVariantProps =\n\t| RadioPlainVariantProps\n\t| RadioSwatchVariantProps\n\t| RadioVisualPickerVariantProps;\n\n/**\n * Props for the Radio component: a union on `variant`, so a prop that a\n * variant ignores is a compile error.\n */\nexport type RadioProps = RadioBaseProps & RadioVariantProps;\n\n/**\n * Props for a `Radio` rendered as a child of `RadioGroup` or\n * `RadioButtonGroup`. The group injects `checked` (derived from its `value`)\n * and `onChange`, so neither is required here.\n */\nexport type RadioGroupItemProps = Omit<RadioBaseProps, 'checked' | 'onChange'> &\n\tRadioVariantProps &\n\tRadioGroupItemOwnProps;\n\ninterface RadioGroupItemOwnProps {\n\t/**\n\t * @deprecated Pass `value` to the `RadioGroup`/`RadioButtonGroup` instead.\n\t * Only used when the group has no `value`.\n\t */\n\tchecked?: boolean;\n\t/** Ignored inside a group: the group's `onChange` is called instead. */\n\tonChange?: RadioChangeHandler;\n}\n\nconst defaultAssistiveText: RadioAssistiveText = {};\nconst defaultLabels: RadioLabels = {};\n\n/**\n * A radio input that can have a single input checked at any one time.\n * Radios should be wrapped with a RadioGroup or RadioButtonGroup.\n */\nconst Radio = (props: RadioProps): React.ReactElement => {\n\tconst {\n\t\tassistiveText: propAssistiveText,\n\t\t'aria-describedby': ariaDescribedBy,\n\t\t'aria-labelledby': ariaLabelledBy,\n\t\tchecked,\n\t\tclassName,\n\t\t// Removed in v11. Destructured so they never reach the DOM;\n\t\t// `checkDeprecatedProps` warns about them.\n\t\tdefaultChecked,\n\t\tdeselectable,\n\t\tdisabled,\n\t\tid: propId,\n\t\tlabelId,\n\t\tlabels: propLabels,\n\t\tlabel,\n\t\tname,\n\t\tonChange,\n\t\tonFocus,\n\t\tonRequestFocus,\n\t\trequestFocus,\n\t\ttabIndex,\n\t\tvalue,\n\t\tvariant = 'base',\n\t\tcoverable = false,\n\t\tvertical,\n\t\tvisualPickerFigure,\n\t\tvisualPickerFigureSelected,\n\t\tvisualPickerFigureNotSelected,\n\t\tonRenderVisualPicker,\n\t\tonRenderVisualPickerSelected,\n\t\tonRenderVisualPickerNotSelected,\n\t\tsize = 'medium',\n\t\trefs,\n\t\tstyle,\n\t\t...rest\n\t} = props as RadioBaseProps &\n\t\tPartial<RadioVisualPickerOnlyProps> & {\n\t\t\tvariant?: RadioVariant;\n\t\t\tstyle?: CSSProperties;\n\t\t} & {\n\t\t\tdefaultChecked?: boolean;\n\t\t\tlabel?: unknown;\n\t\t};\n\tconst generatedId = useId();\n\tconst preventDuplicateRef = useRef(false);\n\n\tconst id = propId || generatedId;\n\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\tconst labels = { ...defaultLabels, ...propLabels };\n\n\tuseEffect(() => {\n\t\tcheckDeprecatedProps(\n\t\t\tRADIO,\n\t\t\t{\n\t\t\t\tdefaultChecked,\n\t\t\t\tlabel,\n\t\t\t\tonRenderVisualPicker,\n\t\t\t\tonRenderVisualPickerSelected,\n\t\t\t\tonRenderVisualPickerNotSelected,\n\t\t\t\tonRequestFocus,\n\t\t\t\trequestFocus,\n\t\t\t},\n\t\t\tcomponentDoc\n\t\t);\n\t}, [\n\t\tdefaultChecked,\n\t\tlabel,\n\t\tonRequestFocus,\n\t\trequestFocus,\n\t\tonRenderVisualPicker,\n\t\tonRenderVisualPickerSelected,\n\t\tonRenderVisualPickerNotSelected,\n\t]);\n\n\tconst ariaProps = getAriaProps(rest);\n\tconst dataProps = getDataProps(rest);\n\n\tconst handleChange = useCallback(\n\t\t(\n\t\t\tevent: ChangeEvent<HTMLInputElement> | KeyboardEvent<HTMLInputElement>,\n\t\t\tpreventDuplicate?: boolean\n\t\t) => {\n\t\t\tif (!preventDuplicateRef.current) {\n\t\t\t\tpreventDuplicateRef.current = Boolean(preventDuplicate);\n\t\t\t\tonChange?.(event, { checked: !checked });\n\t\t\t} else {\n\t\t\t\tpreventDuplicateRef.current = false;\n\t\t\t}\n\t\t},\n\t\t[checked, onChange]\n\t);\n\n\tconst handleInputRef = useCallback(\n\t\t(input: HTMLInputElement | null) => {\n\t\t\trefs?.input?.(input);\n\t\t\tif (input && requestFocus && onRequestFocus) {\n\t\t\t\tonRequestFocus(input);\n\t\t\t}\n\t\t},\n\t\t[refs, requestFocus, onRequestFocus]\n\t);\n\n\t// Render the label based on variant\n\tlet radioLabel: React.ReactNode;\n\n\tif (variant === 'swatch') {\n\t\tradioLabel = (\n\t\t\t<label\n\t\t\t\tstyle={{ border: '1px' }}\n\t\t\t\tclassName=\"slds-radio_button__label\"\n\t\t\t\thtmlFor={id}\n\t\t\t>\n\t\t\t\t<span>\n\t\t\t\t\t<Swatch label={labels.label} style={style} color={value ?? ''} />\n\t\t\t\t</span>\n\t\t\t</label>\n\t\t);\n\t} else if (variant === 'button-group') {\n\t\tradioLabel = (\n\t\t\t<label className=\"slds-radio_button__label\" htmlFor={id}>\n\t\t\t\t<span className=\"slds-radio_faux\">{labels.label}</span>\n\t\t\t</label>\n\t\t);\n\t} else if (variant === 'visual-picker') {\n\t\tradioLabel = (\n\t\t\t<label htmlFor={id}>\n\t\t\t\t{coverable ? (\n\t\t\t\t\t<div className=\"slds-visual-picker__figure slds-visual-picker__icon slds-align_absolute-center\">\n\t\t\t\t\t\t<span className=\"slds-is-selected\">\n\t\t\t\t\t\t\t{visualPickerFigureSelected ?? onRenderVisualPickerSelected?.()}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span className=\"slds-is-not-selected\">\n\t\t\t\t\t\t\t{visualPickerFigureNotSelected ??\n\t\t\t\t\t\t\t\tonRenderVisualPickerNotSelected?.()}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<span className=\"slds-visual-picker__figure slds-visual-picker__text slds-align_absolute-center\">\n\t\t\t\t\t\t{visualPickerFigure ?? onRenderVisualPicker?.()}\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t\t{!vertical && (\n\t\t\t\t\t<span className=\"slds-visual-picker__body\">\n\t\t\t\t\t\t{labels.heading && (\n\t\t\t\t\t\t\t<span className=\"slds-text-heading_small\">{labels.heading}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<span className=\"slds-text-title\">{labels.label}</span>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t\t{!coverable && (\n\t\t\t\t\t<span className=\"slds-icon_container slds-visual-picker__text-check\">\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tassistiveText={assistiveText}\n\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\tname=\"check\"\n\t\t\t\t\t\t\tcolorVariant=\"base\"\n\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</label>\n\t\t);\n\t} else {\n\t\t// Base variant\n\t\tradioLabel = (\n\t\t\t<label className=\"slds-radio__label\" htmlFor={id} id={labelId}>\n\t\t\t\t<span className=\"slds-radio_faux\" />\n\t\t\t\t<span className=\"slds-form-element__label\">{labels.label}</span>\n\t\t\t\t{assistiveText.label && (\n\t\t\t\t\t<span className=\"slds-assistive-text\">{assistiveText.label}</span>\n\t\t\t\t)}\n\t\t\t</label>\n\t\t);\n\t}\n\n\treturn (\n\t\t<span\n\t\t\tclassName={classNames(\n\t\t\t\tvariant === 'visual-picker' ? `slds-visual-picker_${size}` : null,\n\t\t\t\t{\n\t\t\t\t\t'slds-radio': variant === 'base' || variant === 'swatch',\n\t\t\t\t\t'slds-button slds-radio_button': variant === 'button-group',\n\t\t\t\t\t'slds-visual-picker': variant === 'visual-picker',\n\t\t\t\t\t'slds-visual-picker_vertical':\n\t\t\t\t\t\tvariant === 'visual-picker' && vertical,\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t)}\n\t\t>\n\t\t\t<input\n\t\t\t\ttype=\"radio\"\n\t\t\t\tid={id}\n\t\t\t\tname={name}\n\t\t\t\tvalue={value}\n\t\t\t\tchecked={!!checked}\n\t\t\t\tonFocus={onFocus}\n\t\t\t\tonChange={(event) => handleChange(event)}\n\t\t\t\tonClick={(event) => {\n\t\t\t\t\tif (checked && deselectable) {\n\t\t\t\t\t\thandleChange(event as unknown as ChangeEvent<HTMLInputElement>);\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tonKeyDown={(event) => {\n\t\t\t\t\tconst { key } = event;\n\t\t\t\t\tif (key === KEYS.SPACE && checked && deselectable) {\n\t\t\t\t\t\thandleChange(event, true);\n\t\t\t\t\t} else if (\n\t\t\t\t\t\t(key === KEYS.ENTER && checked && deselectable) ||\n\t\t\t\t\t\t(!checked && (key === KEYS.SPACE || key === KEYS.ENTER))\n\t\t\t\t\t) {\n\t\t\t\t\t\thandleChange(event);\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tdisabled={disabled}\n\t\t\t\ttabIndex={tabIndex}\n\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\t\t{...ariaProps}\n\t\t\t\t{...dataProps}\n\t\t\t\tref={handleInputRef}\n\t\t\t/>\n\t\t\t{radioLabel}\n\t\t</span>\n\t);\n};\n\nRadio.displayName = RADIO;\n\nexport default Radio;\n"],"mappings":";;;;;;;;;;;;AA6MA,IAAM,IAA2C,CAAC,GAC5C,IAA6B,CAAC,GAM9B,KAAS,MAA0C;CACxD,IAAM,EACL,eAAe,IACf,oBAAoB,IACpB,mBAAmB,GACnB,YACA,cAGA,mBACA,iBACA,aACA,IAAI,GACJ,YACA,QAAQ,GACR,UACA,UACA,aACA,YACA,mBACA,iBACA,aACA,UACA,aAAU,QACV,eAAY,IACZ,aACA,uBACA,+BACA,kCACA,yBACA,iCACA,oCACA,UAAO,UACP,SACA,UACA,GAAG,MACA,GAQE,IAAc,EAAM,GACpB,IAAsB,EAAO,EAAK,GAElC,IAAK,KAAU,GACf,IAAgB;EAAE,GAAG;EAAsB,GAAG;CAAkB,GAChE,IAAS;EAAE,GAAG;EAAe,GAAG;CAAW;CAEjD,QAAgB;EACf,EACC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,EAAM,cAAc"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../components/radio/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\tuseRef,\n\tuseId,\n\tuseCallback,\n\tuseEffect,\n\ttype ChangeEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype MouseEvent,\n\ttype CSSProperties,\n} from 'react';\nimport classNames from 'classnames';\nimport KEYS from '../../utilities/key-code';\nimport { RADIO } from '../../utilities/constants';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport getDataProps from '../../utilities/get-data-props';\nimport Swatch from '../../components/color-picker/private/swatch';\nimport Icon from '../icon';\nimport { checkDeprecatedProps } from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Radio variant types\n */\nexport type RadioVariant = 'base' | 'button-group' | 'swatch' | 'visual-picker';\nexport type RadioSize = 'medium' | 'large';\n\n/**\n * Assistive text for Radio\n */\nexport interface RadioAssistiveText {\n\t/** Visually hidden label */\n\tlabel?: string;\n}\n\n/**\n * Labels for Radio\n */\nexport interface RadioLabels {\n\t/** Heading for visual picker variant */\n\theading?: string;\n\t/** Label for the radio input */\n\tlabel?: string;\n}\n\n/**\n * Refs for Radio\n */\nexport interface RadioRefs {\n\t/** Ref callback for input element */\n\tinput?: (input: HTMLInputElement | null) => void;\n}\n\n/**\n * Change event data for Radio\n */\nexport interface RadioChangeData {\n\t/**\n\t * The requested checked state: `true` when the user selects the radio,\n\t * `false` when a `deselectable` radio that is checked is clicked again.\n\t */\n\tchecked: boolean;\n}\n\n/**\n * Event passed to a Radio's `onChange`: the input's `change` event when a\n * click selects it, the `click` event when a click deselects a checked\n * `deselectable` radio (a checked radio fires no `change`), or the `keydown`\n * event when Enter or Space selects or deselects it.\n */\nexport type RadioChangeEvent =\n\t| ChangeEvent<HTMLInputElement>\n\t| MouseEvent<HTMLInputElement>\n\t| KeyboardEvent<HTMLInputElement>;\n\n/**\n * Change handler for Radio\n */\nexport type RadioChangeHandler = (\n\tevent: RadioChangeEvent,\n\tdata: RadioChangeData\n) => void;\n\n/**\n * Props for the Radio component\n */\ninterface RadioBaseProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: RadioAssistiveText;\n\t/** ARIA describedby attribute */\n\t'aria-describedby'?: string;\n\t/** ARIA labelledby attribute */\n\t'aria-labelledby'?: string;\n\t/**\n\t * Whether the radio is checked. Radio is controlled: update this prop from\n\t * `onChange`. Inside a `RadioGroup`/`RadioButtonGroup`, pass `value` to the\n\t * group instead and the group derives `checked` for each radio.\n\t */\n\tchecked: boolean;\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Whether radio can be deselected */\n\tdeselectable?: boolean;\n\t/** Whether radio is disabled */\n\tdisabled?: boolean;\n\t/** Unique ID for the input */\n\tid?: string;\n\t/** ID for the label element */\n\tlabelId?: string;\n\t/** Text labels */\n\tlabels?: RadioLabels;\n\t/** Input name attribute */\n\tname?: string;\n\t/**\n\t * Called with the requested checked state in `data.checked`. The rendered\n\t * state only changes when `checked` is updated.\n\t */\n\tonChange: RadioChangeHandler;\n\t/** Focus handler */\n\tonFocus?: (event: FocusEvent<HTMLInputElement>) => void;\n\t/**\n\t * @deprecated Focus the radio through `refs.input` instead. Called with the `<input>`\n\t * when `requestFocus` is set. Still works, and warns.\n\t */\n\tonRequestFocus?: (input: HTMLInputElement) => void;\n\t/** @deprecated Focus the radio through `refs.input` instead. Still works, and warns. */\n\trequestFocus?: boolean;\n\t/** Tab index */\n\ttabIndex?: number;\n\t/** Input value */\n\tvalue?: string;\n\t/** Ref callbacks */\n\trefs?: RadioRefs;\n}\n\n/** Props only the visual picker takes. */\ninterface RadioVisualPickerOnlyProps {\n\t/** Visual picker: coverable when selected */\n\tcoverable?: boolean;\n\t/** Visual picker: vertical layout */\n\tvertical?: boolean;\n\t/** Visual picker: figure content, rendered inside `.slds-visual-picker__figure` when not `coverable` */\n\tvisualPickerFigure?: React.ReactNode;\n\t/** Visual picker: coverable figure content shown when selected */\n\tvisualPickerFigureSelected?: React.ReactNode;\n\t/** Visual picker: coverable figure content shown when not selected */\n\tvisualPickerFigureNotSelected?: React.ReactNode;\n\t/** @deprecated Use `visualPickerFigure` instead. */\n\tonRenderVisualPicker?: () => React.ReactNode;\n\t/** @deprecated Use `visualPickerFigureSelected` instead. */\n\tonRenderVisualPickerSelected?: () => React.ReactNode;\n\t/** @deprecated Use `visualPickerFigureNotSelected` instead. */\n\tonRenderVisualPickerNotSelected?: () => React.ReactNode;\n\t/** Visual picker: size. Defaults to `medium`. */\n\tsize?: RadioSize;\n}\n\n/** Visual-picker-only props, rejected by the other variants. */\ntype RadioVisualPickerOnlyNever = {\n\t[K in keyof RadioVisualPickerOnlyProps]?: never;\n};\n\n/** A plain radio, or a button inside a `RadioButtonGroup`. */\ninterface RadioPlainVariantProps extends RadioVisualPickerOnlyNever {\n\t/** Radio variant */\n\tvariant?: 'base' | 'button-group';\n\tstyle?: never;\n}\n\n/** A color swatch button. `value` is the color. */\ninterface RadioSwatchVariantProps extends RadioVisualPickerOnlyNever {\n\t/** Radio variant */\n\tvariant: 'swatch';\n\t/** Custom styles for the swatch */\n\tstyle?: CSSProperties;\n}\n\n/** An option inside a `VisualPicker`. */\ninterface RadioVisualPickerVariantProps extends RadioVisualPickerOnlyProps {\n\t/** Radio variant */\n\tvariant: 'visual-picker';\n\tstyle?: never;\n}\n\ntype RadioVariantProps =\n\t| RadioPlainVariantProps\n\t| RadioSwatchVariantProps\n\t| RadioVisualPickerVariantProps;\n\n/**\n * Props for the Radio component: a union on `variant`, so a prop that a\n * variant ignores is a compile error.\n */\nexport type RadioProps = RadioBaseProps & RadioVariantProps;\n\n/**\n * Props for a `Radio` rendered as a child of `RadioGroup` or\n * `RadioButtonGroup`. The group injects `checked` (derived from its `value`)\n * and `onChange`, so neither is required here.\n */\nexport type RadioGroupItemProps = Omit<RadioBaseProps, 'checked' | 'onChange'> &\n\tRadioVariantProps &\n\tRadioGroupItemOwnProps;\n\ninterface RadioGroupItemOwnProps {\n\t/**\n\t * @deprecated Pass `value` to the `RadioGroup`/`RadioButtonGroup` instead.\n\t * Only used when the group has no `value`.\n\t */\n\tchecked?: boolean;\n\t/** Ignored inside a group: the group's `onChange` is called instead. */\n\tonChange?: RadioChangeHandler;\n}\n\nconst defaultAssistiveText: RadioAssistiveText = {};\nconst defaultLabels: RadioLabels = {};\n\n/**\n * A radio input that can have a single input checked at any one time.\n * Radios should be wrapped with a RadioGroup or RadioButtonGroup.\n */\nconst Radio = (props: RadioProps): React.ReactElement => {\n\tconst {\n\t\tassistiveText: propAssistiveText,\n\t\t'aria-describedby': ariaDescribedBy,\n\t\t'aria-labelledby': ariaLabelledBy,\n\t\tchecked,\n\t\tclassName,\n\t\t// Removed in v11. Destructured so they never reach the DOM;\n\t\t// `checkDeprecatedProps` warns about them.\n\t\tdefaultChecked,\n\t\tdeselectable,\n\t\tdisabled,\n\t\tid: propId,\n\t\tlabelId,\n\t\tlabels: propLabels,\n\t\tlabel,\n\t\tname,\n\t\tonChange,\n\t\tonFocus,\n\t\tonRequestFocus,\n\t\trequestFocus,\n\t\ttabIndex,\n\t\tvalue,\n\t\tvariant = 'base',\n\t\tcoverable = false,\n\t\tvertical,\n\t\tvisualPickerFigure,\n\t\tvisualPickerFigureSelected,\n\t\tvisualPickerFigureNotSelected,\n\t\tonRenderVisualPicker,\n\t\tonRenderVisualPickerSelected,\n\t\tonRenderVisualPickerNotSelected,\n\t\tsize = 'medium',\n\t\trefs,\n\t\tstyle,\n\t\t...rest\n\t} = props as RadioBaseProps &\n\t\tPartial<RadioVisualPickerOnlyProps> & {\n\t\t\tvariant?: RadioVariant;\n\t\t\tstyle?: CSSProperties;\n\t\t} & {\n\t\t\tdefaultChecked?: boolean;\n\t\t\tlabel?: unknown;\n\t\t};\n\tconst generatedId = useId();\n\tconst preventDuplicateRef = useRef(false);\n\n\tconst id = propId || generatedId;\n\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\tconst labels = { ...defaultLabels, ...propLabels };\n\n\tuseEffect(() => {\n\t\tcheckDeprecatedProps(\n\t\t\tRADIO,\n\t\t\t{\n\t\t\t\tdefaultChecked,\n\t\t\t\tlabel,\n\t\t\t\tonRenderVisualPicker,\n\t\t\t\tonRenderVisualPickerSelected,\n\t\t\t\tonRenderVisualPickerNotSelected,\n\t\t\t\tonRequestFocus,\n\t\t\t\trequestFocus,\n\t\t\t},\n\t\t\tcomponentDoc\n\t\t);\n\t}, [\n\t\tdefaultChecked,\n\t\tlabel,\n\t\tonRequestFocus,\n\t\trequestFocus,\n\t\tonRenderVisualPicker,\n\t\tonRenderVisualPickerSelected,\n\t\tonRenderVisualPickerNotSelected,\n\t]);\n\n\tconst ariaProps = getAriaProps(rest);\n\tconst dataProps = getDataProps(rest);\n\n\tconst handleChange = useCallback(\n\t\t(event: RadioChangeEvent, preventDuplicate?: boolean) => {\n\t\t\tif (!preventDuplicateRef.current) {\n\t\t\t\tpreventDuplicateRef.current = Boolean(preventDuplicate);\n\t\t\t\tonChange?.(event, { checked: !checked });\n\t\t\t} else {\n\t\t\t\tpreventDuplicateRef.current = false;\n\t\t\t}\n\t\t},\n\t\t[checked, onChange]\n\t);\n\n\tconst handleInputRef = useCallback(\n\t\t(input: HTMLInputElement | null) => {\n\t\t\trefs?.input?.(input);\n\t\t\tif (input && requestFocus && onRequestFocus) {\n\t\t\t\tonRequestFocus(input);\n\t\t\t}\n\t\t},\n\t\t[refs, requestFocus, onRequestFocus]\n\t);\n\n\t// Render the label based on variant\n\tlet radioLabel: React.ReactNode;\n\n\tif (variant === 'swatch') {\n\t\tradioLabel = (\n\t\t\t<label\n\t\t\t\tstyle={{ border: 'var(--slds-g-sizing-border-1, 1px)' }}\n\t\t\t\tclassName=\"slds-radio_button__label\"\n\t\t\t\thtmlFor={id}\n\t\t\t>\n\t\t\t\t<span>\n\t\t\t\t\t<Swatch label={labels.label} style={style} color={value ?? ''} />\n\t\t\t\t</span>\n\t\t\t</label>\n\t\t);\n\t} else if (variant === 'button-group') {\n\t\tradioLabel = (\n\t\t\t<label className=\"slds-radio_button__label\" htmlFor={id}>\n\t\t\t\t<span className=\"slds-radio_faux\">{labels.label}</span>\n\t\t\t</label>\n\t\t);\n\t} else if (variant === 'visual-picker') {\n\t\tradioLabel = (\n\t\t\t<label htmlFor={id}>\n\t\t\t\t{coverable ? (\n\t\t\t\t\t<div className=\"slds-visual-picker__figure slds-visual-picker__icon slds-align_absolute-center\">\n\t\t\t\t\t\t<span className=\"slds-is-selected\">\n\t\t\t\t\t\t\t{visualPickerFigureSelected ?? onRenderVisualPickerSelected?.()}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span className=\"slds-is-not-selected\">\n\t\t\t\t\t\t\t{visualPickerFigureNotSelected ??\n\t\t\t\t\t\t\t\tonRenderVisualPickerNotSelected?.()}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<span className=\"slds-visual-picker__figure slds-visual-picker__text slds-align_absolute-center\">\n\t\t\t\t\t\t{visualPickerFigure ?? onRenderVisualPicker?.()}\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t\t{!vertical && (\n\t\t\t\t\t<span className=\"slds-visual-picker__body\">\n\t\t\t\t\t\t{labels.heading && (\n\t\t\t\t\t\t\t<span className=\"slds-text-heading_small\">{labels.heading}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<span className=\"slds-text-title\">{labels.label}</span>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t\t{!coverable && (\n\t\t\t\t\t<span className=\"slds-icon_container slds-visual-picker__text-check\">\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tassistiveText={assistiveText}\n\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\tname=\"check\"\n\t\t\t\t\t\t\tcolorVariant=\"base\"\n\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</label>\n\t\t);\n\t} else {\n\t\t// Base variant\n\t\tradioLabel = (\n\t\t\t<label className=\"slds-radio__label\" htmlFor={id} id={labelId}>\n\t\t\t\t<span className=\"slds-radio_faux\" />\n\t\t\t\t<span className=\"slds-form-element__label\">{labels.label}</span>\n\t\t\t\t{assistiveText.label && (\n\t\t\t\t\t<span className=\"slds-assistive-text\">{assistiveText.label}</span>\n\t\t\t\t)}\n\t\t\t</label>\n\t\t);\n\t}\n\n\treturn (\n\t\t<span\n\t\t\tclassName={classNames(\n\t\t\t\tvariant === 'visual-picker' ? `slds-visual-picker_${size}` : null,\n\t\t\t\t{\n\t\t\t\t\t'slds-radio': variant === 'base' || variant === 'swatch',\n\t\t\t\t\t'slds-button slds-radio_button': variant === 'button-group',\n\t\t\t\t\t'slds-visual-picker': variant === 'visual-picker',\n\t\t\t\t\t'slds-visual-picker_vertical':\n\t\t\t\t\t\tvariant === 'visual-picker' && vertical,\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t)}\n\t\t>\n\t\t\t<input\n\t\t\t\ttype=\"radio\"\n\t\t\t\tid={id}\n\t\t\t\tname={name}\n\t\t\t\tvalue={value}\n\t\t\t\tchecked={!!checked}\n\t\t\t\tonFocus={onFocus}\n\t\t\t\tonChange={(event) => handleChange(event)}\n\t\t\t\tonClick={(event) => {\n\t\t\t\t\tif (checked && deselectable) {\n\t\t\t\t\t\thandleChange(event);\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tonKeyDown={(event) => {\n\t\t\t\t\tconst { key } = event;\n\t\t\t\t\tif (key === KEYS.SPACE && checked && deselectable) {\n\t\t\t\t\t\thandleChange(event, true);\n\t\t\t\t\t} else if (\n\t\t\t\t\t\t(key === KEYS.ENTER && checked && deselectable) ||\n\t\t\t\t\t\t(!checked && (key === KEYS.SPACE || key === KEYS.ENTER))\n\t\t\t\t\t) {\n\t\t\t\t\t\thandleChange(event);\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tdisabled={disabled}\n\t\t\t\ttabIndex={tabIndex}\n\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\t\t{...ariaProps}\n\t\t\t\t{...dataProps}\n\t\t\t\tref={handleInputRef}\n\t\t\t/>\n\t\t\t{radioLabel}\n\t\t</span>\n\t);\n};\n\nRadio.displayName = RADIO;\n\nexport default Radio;\n"],"mappings":";;;;;;;;;;;;AAyNA,IAAM,IAA2C,CAAC,GAC5C,IAA6B,CAAC,GAM9B,KAAS,MAA0C;CACxD,IAAM,EACL,eAAe,IACf,oBAAoB,IACpB,mBAAmB,GACnB,YACA,cAGA,mBACA,iBACA,aACA,IAAI,GACJ,YACA,QAAQ,GACR,UACA,UACA,aACA,YACA,mBACA,iBACA,aACA,UACA,aAAU,QACV,eAAY,IACZ,aACA,uBACA,+BACA,kCACA,yBACA,iCACA,oCACA,UAAO,UACP,SACA,UACA,GAAG,MACA,GAQE,IAAc,EAAM,GACpB,IAAsB,EAAO,EAAK,GAElC,IAAK,KAAU,GACf,IAAgB;EAAE,GAAG;EAAsB,GAAG;CAAkB,GAChE,IAAS;EAAE,GAAG;EAAe,GAAG;CAAW;CAEjD,QAAgB;EACf,EACC,GACA;GACC;GACA;GACA;GACA;GACA;GACA;GACA;EACD,GACA,CACD;CACD,GAAG;EACF;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;CAED,IAAM,KAAY,EAAa,CAAI,GAC7B,KAAY,EAAa,CAAI,GAE7B,IAAe,GACnB,GAAyB,MAA+B;EACxD,AAAK,EAAoB,UAIxB,EAAoB,UAAU,MAH9B,EAAoB,UAAU,EAAQ,GACtC,IAAW,GAAO,EAAE,SAAS,CAAC,EAAQ,CAAC;CAIzC,GACA,CAAC,GAAS,CAAQ,CACnB,GAEM,KAAiB,GACrB,MAAmC;EAEnC,AADA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D,EAAM,WAAU,kBAAmB,CAAA;GACnC,kBAAC,QAAD;IAAM,WAAU;IAA4B,UAAA,EAAO;GAAY,CAAA;GAC9D,EAAc,SACd,kBAAC,QAAD;IAAM,WAAU;IAAuB,UAAA,EAAc;GAAY,CAAA;EAE5D;KAKR,kBAAC,QAAD;EACC,WAAW,EACV,MAAY,kBAAkB,sBAAsB,MAAS,MAC7D;GACC,cAAc,MAAY,UAAU,MAAY;GAChD,iCAAiC,MAAY;GAC7C,sBAAsB,MAAY;GAClC,+BACC,MAAY,mBAAmB;EACjC,GACA,CACD;EAXD,UAAA,CAaC,kBAAC,SAAD;GACC,MAAK;GACD;GACE;GACC;GACP,SAAS,CAAC,CAAC;GACF;GACT,WAAW,MAAU,EAAa,CAAK;GACvC,UAAU,MAAU;IACnB,AAAI,KAAW,KACd,EAAa,CAAK;GAEpB;GACA,YAAY,MAAU;IACrB,IAAM,EAAE,WAAQ;IAChB,AAAI,MAAQ,EAAK,SAAS,KAAW,IACpC,EAAa,GAAO,EAAI,KAEvB,MAAQ,EAAK,SAAS,KAAW,KACjC,CAAC,MAAY,MAAQ,EAAK,SAAS,MAAQ,EAAK,WAEjD,EAAa,CAAK;GAEpB;GACU;GACA;GACV,oBAAkB;GAClB,mBAAiB;GACjB,GAAI;GACJ,GAAI;GACJ,KAAK;EACL,CAAA,GACA,CACI;;AAER;AAEA,EAAM,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../components/radio-group/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\tuseEffect,\n\tuseId,\n\tuseMemo,\n\ttype ReactElement,\n\ttype CSSProperties,\n
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../components/radio-group/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\tuseEffect,\n\tuseId,\n\tuseMemo,\n\ttype ReactElement,\n\ttype CSSProperties,\n} from 'react';\nimport classNames from 'classnames';\nimport { RADIO_GROUP } from '../../utilities/constants';\nimport type {\n\tRadioChangeData,\n\tRadioChangeEvent,\n\tRadioChangeHandler,\n\tRadioGroupItemProps,\n} from '../radio/index';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\nimport type { ChildrenOf } from '../../types/common';\n\n/**\n * Radio group variant types\n */\nexport type RadioGroupVariant = 'base' | 'button-group';\n\n/**\n * Assistive text for RadioGroup\n */\nexport interface RadioGroupAssistiveText {\n\t/** Label for the group (shown in legend) */\n\tlabel?: string;\n\t/** Text for required indicator */\n\trequired?: string;\n}\n\n/**\n * Labels for RadioGroup\n */\nexport interface RadioGroupLabels {\n\t/** Error message to display */\n\terror?: string;\n\t/** Label above the radio group */\n\tlabel?: string;\n}\n\n/**\n * Change event data for RadioGroup\n */\nexport interface RadioGroupChangeData {\n\t/**\n\t * The requested selection: the `value` of the radio the user selected, or\n\t * `null` when a `deselectable` radio is deselected.\n\t */\n\tvalue: string | null;\n\t/**\n\t * Requested checked state of the radio that changed.\n\t * @deprecated Read `value` instead.\n\t */\n\tchecked: boolean;\n}\n\n/**\n * Called when the user selects a radio, with the requested selection in\n * `data.value`. The rendered selection only changes when `value` is updated.\n */\nexport type RadioGroupChangeHandler = (\n\tevent: RadioChangeEvent,\n\tdata: RadioGroupChangeData\n) => void;\n\n/**\n * The group is controlled, so `onChange` is required unless the group is\n * `disabled`: without it, selecting a radio does nothing.\n */\nexport type RadioGroupChangeProps =\n\t| {\n\t\t\t/**\n\t\t\t * Called when the user selects a radio, with the requested selection in\n\t\t\t * `data.value`. The rendered selection only changes when `value` is\n\t\t\t * updated. Required unless `disabled` is set.\n\t\t\t */\n\t\t\tonChange: RadioGroupChangeHandler;\n\t }\n\t| { disabled: true; onChange?: RadioGroupChangeHandler };\n\ninterface RadioGroupBaseProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: RadioGroupAssistiveText;\n\t/**\n\t * `Radio` elements (from `radio-group/radio`). The group passes each one\n\t * `name`, `onChange`, `aria-describedby`, `disabled` and, when `value` is\n\t * set, `checked`. A `Radio`'s own `name` wins, and its `aria-describedby`\n\t * is joined with the group's error id.\n\t */\n\tchildren: ChildrenOf<RadioGroupItemProps>;\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Disable all radio inputs */\n\tdisabled?: boolean;\n\t/** ID for error message element */\n\terrorId?: string;\n\t/** Text labels */\n\tlabels?: RadioGroupLabels;\n\t/** Name attribute for all radios */\n\tname?: string;\n\t/** Whether the field is required */\n\trequired?: boolean;\n\t/**\n\t * The `value` of the selected radio, or `null` for no selection. The group\n\t * is controlled: each child radio is checked when its `value` equals this.\n\t * Leaving it `undefined` falls back to each `Radio`'s own `checked`\n\t * (deprecated).\n\t */\n\tvalue: string | null;\n}\n\n/** Radios stacked in a list. Has no wrapper element to style. */\ninterface RadioGroupBaseVariantProps {\n\t/** Group variant */\n\tvariant?: 'base';\n\tstyle?: never;\n}\n\n/** Radios rendered as a button group. */\ninterface RadioGroupButtonGroupVariantProps {\n\t/** Group variant */\n\tvariant: 'button-group';\n\t/** Custom styles for the button group */\n\tstyle?: CSSProperties;\n}\n\n/**\n * Props for the RadioGroup component: `style` styles the button-group wrapper,\n * so only `variant=\"button-group\"` accepts it.\n */\nexport type RadioGroupProps = RadioGroupBaseProps &\n\tRadioGroupChangeProps &\n\t(RadioGroupBaseVariantProps | RadioGroupButtonGroupVariantProps);\n\nconst defaultAssistiveText: RadioGroupAssistiveText = {\n\trequired: 'Required',\n};\n\nconst defaultLabels: RadioGroupLabels = {};\n\n/**\n * A styled select list that can have a single entry checked at any one time.\n * The RadioGroup component wraps Radio components, which should be used as children.\n */\nconst RadioGroup = ({\n\tassistiveText: propAssistiveText,\n\tchildren,\n\tclassName,\n\tdisabled,\n\terrorId: propErrorId,\n\tlabels: propLabels,\n\tname: propName,\n\tonChange,\n\trequired,\n\tstyle,\n\tvalue,\n\tvariant = 'base',\n}: RadioGroupProps): React.ReactElement => {\n\tconst generatedName = useId();\n\tconst generatedErrorId = useId();\n\n\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\tconst labels = { ...defaultLabels, ...propLabels };\n\n\tconst name = propName || generatedName;\n\tconst hasError = Boolean(labels.error);\n\tconst errorId = hasError ? propErrorId || generatedErrorId : undefined;\n\n\tconst isControlled = value !== undefined;\n\n\tuseEffect(() => {\n\t\tcheckProps(RADIO_GROUP, { disabled, onChange, value }, componentDoc);\n\t});\n\n\t// Clone children with group props. With a group `value`, each radio's\n\t// `checked` is derived from it; without one (deprecated), the radio keeps\n\t// the `checked` it was given.\n\tconst enhancedChildren = useMemo(() => {\n\t\treturn React.Children.map(children, (child) => {\n\t\t\tif (React.isValidElement<RadioGroupItemProps>(child)) {\n\t\t\t\tconst childProps = child.props;\n\t\t\t\tconst childValue = childProps.value ?? null;\n\t\t\t\tconst handleChange: RadioChangeHandler = (\n\t\t\t\t\tevent,\n\t\t\t\t\tdata: RadioChangeData\n\t\t\t\t) => {\n\t\t\t\t\tonChange?.(event, {\n\t\t\t\t\t\tchecked: data.checked,\n\t\t\t\t\t\tvalue: data.checked ? childValue : null,\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t\treturn React.cloneElement(child as ReactElement<RadioGroupItemProps>, {\n\t\t\t\t\tname: childProps.name ?? name,\n\t\t\t\t\tonChange: handleChange,\n\t\t\t\t\t'aria-describedby':\n\t\t\t\t\t\tclassNames(childProps['aria-describedby'], errorId) || undefined,\n\t\t\t\t\tdisabled: disabled || childProps.disabled,\n\t\t\t\t\t...(isControlled\n\t\t\t\t\t\t? { checked: childValue !== null && childValue === value }\n\t\t\t\t\t\t: {}),\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn child;\n\t\t});\n\t}, [children, name, onChange, errorId, disabled, isControlled, value]);\n\n\treturn (\n\t\t<fieldset\n\t\t\tclassName={classNames('slds-form-element', {\n\t\t\t\t'slds-has-error': hasError,\n\t\t\t})}\n\t\t>\n\t\t\t<legend\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-form-element__legend',\n\t\t\t\t\t'slds-form-element__label',\n\t\t\t\t\t{ 'slds-assistive-text': assistiveText.label }\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{required && (\n\t\t\t\t\t<abbr className=\"slds-required\" title=\"required\">\n\t\t\t\t\t\t*\n\t\t\t\t\t\t<div className=\"slds-assistive-text\">{assistiveText.required} </div>\n\t\t\t\t\t</abbr>\n\t\t\t\t)}\n\t\t\t\t{assistiveText.label || labels.label}\n\t\t\t</legend>\n\t\t\t<div\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-form-element__control',\n\t\t\t\t\tclassName as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{variant === 'button-group' ? (\n\t\t\t\t\t<div style={style} className=\"slds-radio_button-group\">\n\t\t\t\t\t\t{enhancedChildren}\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\tenhancedChildren\n\t\t\t\t)}\n\n\t\t\t\t{labels.error && (\n\t\t\t\t\t<div id={errorId} className=\"slds-form-element__help\">\n\t\t\t\t\t\t{labels.error}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n};\n\nRadioGroup.displayName = RADIO_GROUP;\n\nexport default RadioGroup;\n"],"mappings":";;;;;;;AA6IA,IAAM,IAAgD,EACrD,UAAU,WACX,GAEM,IAAkC,CAAC,GAMnC,KAAc,EACnB,eAAe,GACf,aACA,cACA,aACA,SAAS,GACT,QAAQ,GACR,MAAM,GACN,aACA,aACA,UACA,UACA,aAAU,aACgC;CAC1C,IAAM,IAAgB,EAAM,GACtB,IAAmB,EAAM,GAEzB,IAAgB;EAAE,GAAG;EAAsB,GAAG;CAAkB,GAChE,IAA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AC,OAAD;IAAY;IAAO,WAAU;IAC3B,UAAA;GACG,CAAA,IAEL,GAGA,EAAO,SACP,kBAAC,OAAD;IAAK,IAAI;IAAS,WAAU;IAC1B,UAAA,EAAO;GACJ,CAAA,CAEF;EACI,CAAA,CAAA;;AAEZ;AAEA,EAAW,cAAc"}
|
|
@@ -11,16 +11,19 @@ var c = (e) => {
|
|
|
11
11
|
className: o({ "slds-truncate": e.fixedLayout }),
|
|
12
12
|
title: e.title || (typeof m == "string" ? m : void 0),
|
|
13
13
|
children: e.children
|
|
14
|
-
}), g = o(e.className, { "slds-has-focus": d }), _ =
|
|
14
|
+
}), g = o(e.className, { "slds-has-focus": d }), _ = e.width || l.cornerStyle ? {
|
|
15
|
+
...l.cornerStyle,
|
|
16
|
+
width: e.width
|
|
17
|
+
} : void 0, v = (e) => {
|
|
15
18
|
e && d && e.focus();
|
|
16
19
|
};
|
|
17
20
|
return e.primaryColumn ? /* @__PURE__ */ s("th", {
|
|
18
21
|
className: g,
|
|
19
|
-
ref:
|
|
22
|
+
ref: v,
|
|
20
23
|
"data-label": e.label,
|
|
21
24
|
role: c.isGrid ? "gridcell" : void 0,
|
|
22
25
|
tabIndex: u,
|
|
23
|
-
style:
|
|
26
|
+
style: _,
|
|
24
27
|
onFocus: f,
|
|
25
28
|
onKeyDown: p,
|
|
26
29
|
children: h
|
|
@@ -29,9 +32,9 @@ var c = (e) => {
|
|
|
29
32
|
"data-label": e.label,
|
|
30
33
|
onFocus: f,
|
|
31
34
|
onKeyDown: p,
|
|
32
|
-
ref:
|
|
35
|
+
ref: v,
|
|
33
36
|
role: c.isGrid ? "gridcell" : void 0,
|
|
34
|
-
style:
|
|
37
|
+
style: _,
|
|
35
38
|
tabIndex: u,
|
|
36
39
|
headers: e.headerId,
|
|
37
40
|
children: h
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell.js","names":[],"sources":["../../../../components/simple-data-table/cell.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, { useContext, ReactNode } from 'react';\nimport classNames from 'classnames';\n\nimport CellContext from './private/cell-context';\nimport TableContext from './private/table-context';\nimport useContextHelper from './private/context-helper';\n\nimport { SIMPLE_DATA_TABLE_CELL } from '../../utilities/constants';\n\nexport interface SimpleDataTableCellProps {\n\t/** The contents of the cell */\n\tchildren?: ReactNode;\n\t/** Class names to be added to the cell */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Use this for advanced table (selectable or sortable rows) */\n\tfixedLayout?: boolean;\n\t/** The item from the items which represents this row */\n\titem?: Record<string, unknown>;\n\t/** The primary column for a row. This is almost always the first column. */\n\tprimaryColumn?: boolean;\n\t/** The property of this item to display */\n\tproperty?: string;\n\t/** Shows on hover. Useful for truncated cells. */\n\ttitle?: string;\n\t/** Width of column. Required for advanced/fixed layout tables. */\n\twidth?: string;\n\t/** Data label for stacked layout */\n\tlabel?: string;\n\t/** Header ID for accessibility */\n\theaderId?: string;\n}\n\n/**\n * The default Cell renderer for the SimpleDataTable. To customize a column's cells,\n * pass an element of any component that takes these props as the column's child.\n */\nconst SimpleDataTableCell: React.FC<SimpleDataTableCellProps> = (props) => {\n\tconst tableContext = useContext(TableContext);\n\tconst cellContext = useContext(CellContext);\n\tconst { tabIndex, hasFocus, handleFocus, handleKeyDown } = useContextHelper(\n\t\ttableContext,\n\t\tcellContext,\n\t\tprops.fixedLayout\n\t);\n\n\tconst childText = React.isValidElement(props.children)\n\t\t? (props.children.props as { children?: string }).children\n\t\t: props.children;\n\n\tconst contents = (\n\t\t<div\n\t\t\tclassName={classNames({\n\t\t\t\t'slds-truncate': props.fixedLayout,\n\t\t\t})}\n\t\t\ttitle={\n\t\t\t\tprops.title || (typeof childText === 'string' ? childText : undefined)\n\t\t\t}\n\t\t>\n\t\t\t{props.children}\n\t\t</div>\n\t);\n\n\tconst className = classNames(props.className, {\n\t\t'slds-has-focus': hasFocus,\n\t});\n\n\tconst ref = (node: HTMLTableCellElement | null) => {\n\t\tif (node && hasFocus) {\n\t\t\tnode.focus();\n\t\t}\n\t};\n\n\tif (props.primaryColumn) {\n\t\treturn (\n\t\t\t<th\n\t\t\t\tclassName={className}\n\t\t\t\tref={ref}\n\t\t\t\tdata-label={props.label}\n\t\t\t\trole={tableContext.isGrid ? 'gridcell' : undefined}\n\t\t\t\ttabIndex={tabIndex}\n\t\t\t\tstyle={
|
|
1
|
+
{"version":3,"file":"cell.js","names":[],"sources":["../../../../components/simple-data-table/cell.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, { useContext, ReactNode } from 'react';\nimport classNames from 'classnames';\n\nimport CellContext from './private/cell-context';\nimport TableContext from './private/table-context';\nimport useContextHelper from './private/context-helper';\n\nimport { SIMPLE_DATA_TABLE_CELL } from '../../utilities/constants';\n\nexport interface SimpleDataTableCellProps {\n\t/** The contents of the cell */\n\tchildren?: ReactNode;\n\t/** Class names to be added to the cell */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Use this for advanced table (selectable or sortable rows) */\n\tfixedLayout?: boolean;\n\t/** The item from the items which represents this row */\n\titem?: Record<string, unknown>;\n\t/** The primary column for a row. This is almost always the first column. */\n\tprimaryColumn?: boolean;\n\t/** The property of this item to display */\n\tproperty?: string;\n\t/** Shows on hover. Useful for truncated cells. */\n\ttitle?: string;\n\t/** Width of column. Required for advanced/fixed layout tables. */\n\twidth?: string;\n\t/** Data label for stacked layout */\n\tlabel?: string;\n\t/** Header ID for accessibility */\n\theaderId?: string;\n}\n\n/**\n * The default Cell renderer for the SimpleDataTable. To customize a column's cells,\n * pass an element of any component that takes these props as the column's child.\n */\nconst SimpleDataTableCell: React.FC<SimpleDataTableCellProps> = (props) => {\n\tconst tableContext = useContext(TableContext);\n\tconst cellContext = useContext(CellContext);\n\tconst { tabIndex, hasFocus, handleFocus, handleKeyDown } = useContextHelper(\n\t\ttableContext,\n\t\tcellContext,\n\t\tprops.fixedLayout\n\t);\n\n\tconst childText = React.isValidElement(props.children)\n\t\t? (props.children.props as { children?: string }).children\n\t\t: props.children;\n\n\tconst contents = (\n\t\t<div\n\t\t\tclassName={classNames({\n\t\t\t\t'slds-truncate': props.fixedLayout,\n\t\t\t})}\n\t\t\ttitle={\n\t\t\t\tprops.title || (typeof childText === 'string' ? childText : undefined)\n\t\t\t}\n\t\t>\n\t\t\t{props.children}\n\t\t</div>\n\t);\n\n\tconst className = classNames(props.className, {\n\t\t'slds-has-focus': hasFocus,\n\t});\n\n\tconst style =\n\t\tprops.width || cellContext.cornerStyle\n\t\t\t? { ...cellContext.cornerStyle, width: props.width }\n\t\t\t: undefined;\n\n\tconst ref = (node: HTMLTableCellElement | null) => {\n\t\tif (node && hasFocus) {\n\t\t\tnode.focus();\n\t\t}\n\t};\n\n\tif (props.primaryColumn) {\n\t\treturn (\n\t\t\t<th\n\t\t\t\tclassName={className}\n\t\t\t\tref={ref}\n\t\t\t\tdata-label={props.label}\n\t\t\t\trole={tableContext.isGrid ? 'gridcell' : undefined}\n\t\t\t\ttabIndex={tabIndex}\n\t\t\t\tstyle={style}\n\t\t\t\tonFocus={handleFocus}\n\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t>\n\t\t\t\t{contents}\n\t\t\t</th>\n\t\t);\n\t}\n\n\treturn (\n\t\t<td\n\t\t\tclassName={className}\n\t\t\tdata-label={props.label}\n\t\t\tonFocus={handleFocus}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tref={ref}\n\t\t\trole={tableContext.isGrid ? 'gridcell' : undefined}\n\t\t\tstyle={style}\n\t\t\ttabIndex={tabIndex}\n\t\t\theaders={props.headerId}\n\t\t>\n\t\t\t{contents}\n\t\t</td>\n\t);\n};\n\nSimpleDataTableCell.displayName = SIMPLE_DATA_TABLE_CELL;\n\nexport default SimpleDataTableCell;\n"],"mappings":";;;;;;;;AAuCA,IAAM,KAA2D,MAAU;CAC1E,IAAM,IAAe,EAAW,CAAY,GACtC,IAAc,EAAW,CAAW,GACpC,EAAE,aAAU,aAAU,gBAAa,qBAAkB,EAC1D,GACA,GACA,EAAM,WACP,GAEM,IAAY,EAAM,eAAe,EAAM,QAAQ,IACjD,EAAM,SAAS,MAAgC,WAChD,EAAM,UAEH,IACL,kBAAC,OAAD;EACC,WAAW,EAAW,EACrB,iBAAiB,EAAM,YACxB,CAAC;EACD,OACC,EAAM,UAAU,OAAO,KAAc,WAAW,IAAY,KAAA;EAG5D,UAAA,EAAM;CACH,CAAA,GAGA,IAAY,EAAW,EAAM,WAAW,EAC7C,kBAAkB,EACnB,CAAC,GAEK,IACL,EAAM,SAAS,EAAY,cACxB;EAAE,GAAG,EAAY;EAAa,OAAO,EAAM;CAAM,IACjD,KAAA,GAEE,KAAO,MAAsC;EAClD,AAAI,KAAQ,KACX,EAAK,MAAM;CAEb;CAmBA,OAjBI,EAAM,gBAER,kBAAC,MAAD;EACY;EACN;EACL,cAAY,EAAM;EAClB,MAAM,EAAa,SAAS,aAAa,KAAA;EAC/B;EACH;EACP,SAAS;EACT,WAAW;EAEV,UAAA;CACE,CAAA,IAKL,kBAAC,MAAD;EACY;EACX,cAAY,EAAM;EAClB,SAAS;EACT,WAAW;EACN;EACL,MAAM,EAAa,SAAS,aAAa,KAAA;EAClC;EACG;EACV,SAAS,EAAM;EAEd,UAAA;CACE,CAAA;AAEN;AAEA,EAAoB,cAAc"}
|