@salesforce/design-system-react 11.0.0-alpha.8 → 11.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/accordion/index.cjs +1 -1
- package/dist/cjs/components/accordion/index.cjs.map +1 -1
- package/dist/cjs/components/alert/container.cjs +1 -1
- package/dist/cjs/components/alert/container.cjs.map +1 -1
- package/dist/cjs/components/avatar/index.cjs +1 -1
- package/dist/cjs/components/avatar/index.cjs.map +1 -1
- package/dist/cjs/components/button-stateful/check-props.cjs +2 -0
- package/dist/cjs/components/button-stateful/check-props.cjs.map +1 -0
- package/dist/cjs/components/button-stateful/component.cjs +2 -0
- package/dist/cjs/components/button-stateful/component.cjs.map +1 -0
- package/dist/cjs/components/button-stateful/index.cjs +1 -1
- package/dist/cjs/components/button-stateful/index.cjs.map +1 -1
- package/dist/cjs/components/carousel/index.cjs +1 -1
- package/dist/cjs/components/carousel/index.cjs.map +1 -1
- package/dist/cjs/components/checkbox/check-props.cjs +1 -1
- package/dist/cjs/components/checkbox/check-props.cjs.map +1 -1
- package/dist/cjs/components/checkbox/index.cjs +1 -1
- package/dist/cjs/components/checkbox/index.cjs.map +1 -1
- package/dist/cjs/components/color-picker/check-props.cjs +1 -1
- package/dist/cjs/components/color-picker/check-props.cjs.map +1 -1
- package/dist/cjs/components/color-picker/color-picker.cjs +1 -1
- package/dist/cjs/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/cjs/components/color-picker/private/color-picker-tabs.cjs +2 -0
- package/dist/cjs/components/color-picker/private/color-picker-tabs.cjs.map +1 -0
- package/dist/cjs/components/color-picker/private/hsv-color.cjs +1 -1
- package/dist/cjs/components/color-picker/private/hsv-color.cjs.map +1 -1
- package/dist/cjs/components/combobox/check-props.cjs +1 -1
- package/dist/cjs/components/combobox/check-props.cjs.map +1 -1
- package/dist/cjs/components/combobox/combobox.cjs +1 -1
- package/dist/cjs/components/combobox/combobox.cjs.map +1 -1
- package/dist/cjs/components/combobox/index.cjs +1 -1
- package/dist/cjs/components/date-picker/check-props.cjs +1 -1
- package/dist/cjs/components/date-picker/check-props.cjs.map +1 -1
- package/dist/cjs/components/date-picker/date-picker.cjs +1 -1
- package/dist/cjs/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/cjs/components/date-picker/index.cjs.map +1 -1
- package/dist/cjs/components/date-picker/private/calendar-wrapper.cjs.map +1 -1
- package/dist/cjs/components/expandable-section/index.cjs +1 -1
- package/dist/cjs/components/expandable-section/index.cjs.map +1 -1
- package/dist/cjs/components/icon/input-icon/index.cjs +1 -1
- package/dist/cjs/components/icon/input-icon/index.cjs.map +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/input/check-props.cjs +1 -1
- package/dist/cjs/components/input/check-props.cjs.map +1 -1
- package/dist/cjs/components/input/index.cjs +1 -1
- package/dist/cjs/components/input/index.cjs.map +1 -1
- package/dist/cjs/components/input/private/inner-input.cjs +1 -1
- package/dist/cjs/components/input/private/inner-input.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/button-trigger.cjs +1 -1
- package/dist/cjs/components/menu-dropdown/button-trigger.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/index.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs +1 -1
- package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs.map +1 -1
- package/dist/cjs/components/modal/index.cjs +1 -1
- package/dist/cjs/components/modal/index.cjs.map +1 -1
- package/dist/cjs/components/popover/index.cjs.map +1 -1
- package/dist/cjs/components/popover/popover.cjs +1 -1
- package/dist/cjs/components/popover/popover.cjs.map +1 -1
- package/dist/cjs/components/radio/check-props.cjs +1 -1
- package/dist/cjs/components/radio/check-props.cjs.map +1 -1
- package/dist/cjs/components/radio/index.cjs +1 -1
- package/dist/cjs/components/radio/index.cjs.map +1 -1
- package/dist/cjs/components/radio-button-group/index.cjs.map +1 -1
- package/dist/cjs/components/radio-button-group/radio.cjs.map +1 -1
- package/dist/cjs/components/radio-group/check-props.cjs +2 -0
- package/dist/cjs/components/radio-group/check-props.cjs.map +1 -0
- package/dist/cjs/components/radio-group/component.cjs +2 -0
- package/dist/cjs/components/radio-group/component.cjs.map +1 -0
- package/dist/cjs/components/radio-group/index.cjs +1 -1
- package/dist/cjs/components/radio-group/index.cjs.map +1 -1
- package/dist/cjs/components/setup-assistant/step.cjs +1 -1
- package/dist/cjs/components/setup-assistant/step.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/check-props.cjs +1 -1
- package/dist/cjs/components/simple-data-table/check-props.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/column.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/index.cjs +1 -1
- package/dist/cjs/components/simple-data-table/index.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/head.cjs +1 -1
- package/dist/cjs/components/simple-data-table/private/head.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/header-cell.cjs +1 -1
- package/dist/cjs/components/simple-data-table/private/header-cell.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/row.cjs +1 -1
- package/dist/cjs/components/simple-data-table/private/row.cjs.map +1 -1
- package/dist/cjs/components/slider/check-props.cjs +1 -1
- package/dist/cjs/components/slider/check-props.cjs.map +1 -1
- package/dist/cjs/components/slider/index.cjs +1 -1
- package/dist/cjs/components/slider/index.cjs.map +1 -1
- package/dist/cjs/components/split-view/index.cjs +1 -1
- package/dist/cjs/components/split-view/index.cjs.map +1 -1
- package/dist/cjs/components/split-view/listbox-check-props.cjs +1 -1
- package/dist/cjs/components/split-view/listbox-check-props.cjs.map +1 -1
- package/dist/cjs/components/split-view/listbox.cjs +1 -1
- package/dist/cjs/components/split-view/listbox.cjs.map +1 -1
- package/dist/cjs/components/tabs/check-props.cjs +2 -0
- package/dist/cjs/components/tabs/check-props.cjs.map +1 -0
- package/dist/cjs/components/tabs/component.cjs +2 -0
- package/dist/cjs/components/tabs/component.cjs.map +1 -0
- package/dist/cjs/components/tabs/index.cjs +1 -1
- package/dist/cjs/components/tabs/index.cjs.map +1 -1
- package/dist/cjs/components/tabs/panel.cjs.map +1 -1
- package/dist/cjs/components/textarea/check-props.cjs +1 -1
- package/dist/cjs/components/textarea/check-props.cjs.map +1 -1
- package/dist/cjs/components/textarea/index.cjs +1 -1
- package/dist/cjs/components/textarea/index.cjs.map +1 -1
- package/dist/cjs/components/toast/container.cjs +1 -1
- package/dist/cjs/components/toast/container.cjs.map +1 -1
- package/dist/cjs/components/tooltip/index.cjs +2 -2
- package/dist/cjs/components/tooltip/index.cjs.map +1 -1
- package/dist/cjs/components/tree/check-props.cjs +1 -1
- package/dist/cjs/components/tree/check-props.cjs.map +1 -1
- package/dist/cjs/components/tree/private/branch.cjs +1 -1
- package/dist/cjs/components/tree/private/branch.cjs.map +1 -1
- package/dist/cjs/components/tree/private/item.cjs +1 -1
- package/dist/cjs/components/tree/private/item.cjs.map +1 -1
- package/dist/cjs/components/tree/private/render-branch.cjs +1 -1
- package/dist/cjs/components/tree/private/render-branch.cjs.map +1 -1
- package/dist/cjs/components/tree/tree.cjs +1 -1
- package/dist/cjs/components/tree/tree.cjs.map +1 -1
- package/dist/cjs/components/vertical-navigation/check-props.cjs +2 -0
- package/dist/cjs/components/vertical-navigation/check-props.cjs.map +1 -0
- package/dist/cjs/components/vertical-navigation/component.cjs +2 -0
- package/dist/cjs/components/vertical-navigation/component.cjs.map +1 -0
- package/dist/cjs/components/vertical-navigation/index.cjs +1 -1
- package/dist/cjs/components/vertical-navigation/index.cjs.map +1 -1
- package/dist/cjs/components/welcome-mat/info-badge.cjs +1 -1
- package/dist/cjs/components/welcome-mat/info-badge.cjs.map +1 -1
- package/dist/cjs/utilities/hooks/index.cjs +1 -1
- package/dist/cjs/utilities/hooks/use-controllable-state.cjs +2 -0
- package/dist/cjs/utilities/hooks/use-controllable-state.cjs.map +1 -0
- package/dist/cjs/utilities/warning/required-property.cjs +2 -0
- package/dist/cjs/utilities/warning/required-property.cjs.map +1 -0
- package/dist/es/components/accordion/index.js +10 -8
- package/dist/es/components/accordion/index.js.map +1 -1
- package/dist/es/components/alert/container.js +1 -1
- package/dist/es/components/alert/container.js.map +1 -1
- package/dist/es/components/avatar/index.js +2 -1
- package/dist/es/components/avatar/index.js.map +1 -1
- package/dist/es/components/button-stateful/check-props.js +14 -0
- package/dist/es/components/button-stateful/check-props.js.map +1 -0
- package/dist/es/components/button-stateful/component.js +20 -0
- package/dist/es/components/button-stateful/component.js.map +1 -0
- package/dist/es/components/button-stateful/index.js +102 -94
- package/dist/es/components/button-stateful/index.js.map +1 -1
- package/dist/es/components/carousel/index.js +112 -130
- package/dist/es/components/carousel/index.js.map +1 -1
- package/dist/es/components/checkbox/check-props.js +14 -8
- package/dist/es/components/checkbox/check-props.js.map +1 -1
- package/dist/es/components/checkbox/index.js +40 -33
- package/dist/es/components/checkbox/index.js.map +1 -1
- package/dist/es/components/color-picker/check-props.js +16 -11
- package/dist/es/components/color-picker/check-props.js.map +1 -1
- package/dist/es/components/color-picker/color-picker.js +185 -169
- package/dist/es/components/color-picker/color-picker.js.map +1 -1
- package/dist/es/components/color-picker/private/color-picker-tabs.js +17 -0
- package/dist/es/components/color-picker/private/color-picker-tabs.js.map +1 -0
- package/dist/es/components/color-picker/private/hsv-color.js +1 -0
- package/dist/es/components/color-picker/private/hsv-color.js.map +1 -1
- package/dist/es/components/combobox/check-props.js +15 -14
- package/dist/es/components/combobox/check-props.js.map +1 -1
- package/dist/es/components/combobox/combobox.js +399 -399
- package/dist/es/components/combobox/combobox.js.map +1 -1
- package/dist/es/components/combobox/index.js +4 -4
- package/dist/es/components/date-picker/check-props.js +15 -9
- package/dist/es/components/date-picker/check-props.js.map +1 -1
- package/dist/es/components/date-picker/date-picker.js +144 -138
- package/dist/es/components/date-picker/date-picker.js.map +1 -1
- package/dist/es/components/date-picker/index.js.map +1 -1
- package/dist/es/components/date-picker/private/calendar-wrapper.js.map +1 -1
- package/dist/es/components/expandable-section/index.js +32 -26
- package/dist/es/components/expandable-section/index.js.map +1 -1
- package/dist/es/components/icon/input-icon/index.js +7 -2
- package/dist/es/components/icon/input-icon/index.js.map +1 -1
- package/dist/es/components/index.js +3 -3
- package/dist/es/components/input/check-props.js +19 -17
- package/dist/es/components/input/check-props.js.map +1 -1
- package/dist/es/components/input/index.js +153 -156
- package/dist/es/components/input/index.js.map +1 -1
- package/dist/es/components/input/private/inner-input.js +18 -18
- package/dist/es/components/input/private/inner-input.js.map +1 -1
- package/dist/es/components/menu-dropdown/button-trigger.js +7 -1
- package/dist/es/components/menu-dropdown/button-trigger.js.map +1 -1
- package/dist/es/components/menu-dropdown/index.js.map +1 -1
- package/dist/es/components/menu-dropdown/menu-dropdown.js +294 -269
- package/dist/es/components/menu-dropdown/menu-dropdown.js.map +1 -1
- package/dist/es/components/modal/index.js +1 -1
- package/dist/es/components/modal/index.js.map +1 -1
- package/dist/es/components/popover/index.js.map +1 -1
- package/dist/es/components/popover/popover.js +209 -205
- package/dist/es/components/popover/popover.js.map +1 -1
- package/dist/es/components/radio/check-props.js +8 -8
- package/dist/es/components/radio/check-props.js.map +1 -1
- package/dist/es/components/radio/index.js +15 -13
- package/dist/es/components/radio/index.js.map +1 -1
- package/dist/es/components/radio-button-group/index.js.map +1 -1
- package/dist/es/components/radio-button-group/radio.js.map +1 -1
- package/dist/es/components/radio-group/check-props.js +14 -0
- package/dist/es/components/radio-group/check-props.js.map +1 -0
- package/dist/es/components/radio-group/component.js +21 -0
- package/dist/es/components/radio-group/component.js.map +1 -0
- package/dist/es/components/radio-group/index.js +62 -38
- package/dist/es/components/radio-group/index.js.map +1 -1
- package/dist/es/components/setup-assistant/step.js +5 -4
- package/dist/es/components/setup-assistant/step.js.map +1 -1
- package/dist/es/components/simple-data-table/check-props.js +7 -6
- package/dist/es/components/simple-data-table/check-props.js.map +1 -1
- package/dist/es/components/simple-data-table/column.js.map +1 -1
- package/dist/es/components/simple-data-table/index.js +67 -49
- package/dist/es/components/simple-data-table/index.js.map +1 -1
- package/dist/es/components/simple-data-table/private/head.js +1 -1
- package/dist/es/components/simple-data-table/private/head.js.map +1 -1
- package/dist/es/components/simple-data-table/private/header-cell.js +50 -52
- package/dist/es/components/simple-data-table/private/header-cell.js.map +1 -1
- package/dist/es/components/simple-data-table/private/row.js +43 -57
- package/dist/es/components/simple-data-table/private/row.js.map +1 -1
- package/dist/es/components/slider/check-props.js +14 -12
- package/dist/es/components/slider/check-props.js.map +1 -1
- package/dist/es/components/slider/index.js +54 -48
- package/dist/es/components/slider/index.js.map +1 -1
- package/dist/es/components/split-view/index.js +23 -22
- package/dist/es/components/split-view/index.js.map +1 -1
- package/dist/es/components/split-view/listbox-check-props.js +10 -2
- package/dist/es/components/split-view/listbox-check-props.js.map +1 -1
- package/dist/es/components/split-view/listbox.js +67 -50
- package/dist/es/components/split-view/listbox.js.map +1 -1
- package/dist/es/components/tabs/check-props.js +15 -0
- package/dist/es/components/tabs/check-props.js.map +1 -0
- package/dist/es/components/tabs/component.js +28 -0
- package/dist/es/components/tabs/component.js.map +1 -0
- package/dist/es/components/tabs/index.js +84 -69
- package/dist/es/components/tabs/index.js.map +1 -1
- package/dist/es/components/tabs/panel.js.map +1 -1
- package/dist/es/components/textarea/check-props.js +1 -1
- package/dist/es/components/textarea/check-props.js.map +1 -1
- package/dist/es/components/textarea/index.js +3 -2
- package/dist/es/components/textarea/index.js.map +1 -1
- package/dist/es/components/toast/container.js +1 -1
- package/dist/es/components/toast/container.js.map +1 -1
- package/dist/es/components/tooltip/index.js +120 -109
- package/dist/es/components/tooltip/index.js.map +1 -1
- package/dist/es/components/tree/check-props.js +14 -9
- package/dist/es/components/tree/check-props.js.map +1 -1
- package/dist/es/components/tree/private/branch.js +38 -35
- package/dist/es/components/tree/private/branch.js.map +1 -1
- package/dist/es/components/tree/private/item.js +6 -8
- package/dist/es/components/tree/private/item.js.map +1 -1
- package/dist/es/components/tree/private/render-branch.js +9 -10
- package/dist/es/components/tree/private/render-branch.js.map +1 -1
- package/dist/es/components/tree/tree.js +126 -97
- package/dist/es/components/tree/tree.js.map +1 -1
- package/dist/es/components/vertical-navigation/check-props.js +13 -0
- package/dist/es/components/vertical-navigation/check-props.js.map +1 -0
- package/dist/es/components/vertical-navigation/component.js +27 -0
- package/dist/es/components/vertical-navigation/component.js.map +1 -0
- package/dist/es/components/vertical-navigation/index.js +27 -26
- package/dist/es/components/vertical-navigation/index.js.map +1 -1
- package/dist/es/components/welcome-mat/info-badge.js +14 -4
- package/dist/es/components/welcome-mat/info-badge.js.map +1 -1
- package/dist/es/utilities/hooks/index.js +2 -1
- package/dist/es/utilities/hooks/use-controllable-state.js +20 -0
- package/dist/es/utilities/hooks/use-controllable-state.js.map +1 -0
- package/dist/es/utilities/warning/required-property.js +15 -0
- package/dist/es/utilities/warning/required-property.js.map +1 -0
- package/dist/types/components/accordion/index.d.ts.map +1 -1
- package/dist/types/components/avatar/index.d.ts.map +1 -1
- package/dist/types/components/button-stateful/check-props.d.ts +3 -0
- package/dist/types/components/button-stateful/check-props.d.ts.map +1 -0
- package/dist/types/components/button-stateful/index.d.ts +34 -6
- package/dist/types/components/button-stateful/index.d.ts.map +1 -1
- package/dist/types/components/carousel/index.d.ts +26 -7
- package/dist/types/components/carousel/index.d.ts.map +1 -1
- package/dist/types/components/checkbox/check-props.d.ts +1 -0
- package/dist/types/components/checkbox/check-props.d.ts.map +1 -1
- package/dist/types/components/checkbox/index.d.ts +38 -9
- package/dist/types/components/checkbox/index.d.ts.map +1 -1
- package/dist/types/components/color-picker/check-props.d.ts.map +1 -1
- package/dist/types/components/color-picker/color-picker.d.ts +50 -11
- package/dist/types/components/color-picker/color-picker.d.ts.map +1 -1
- package/dist/types/components/color-picker/index.d.ts +2 -2
- package/dist/types/components/color-picker/index.d.ts.map +1 -1
- package/dist/types/components/color-picker/private/color-picker-tabs.d.ts +14 -0
- package/dist/types/components/color-picker/private/color-picker-tabs.d.ts.map +1 -0
- package/dist/types/components/color-picker/private/hsv-color.d.ts.map +1 -1
- package/dist/types/components/color-picker/types.d.ts +9 -5
- package/dist/types/components/color-picker/types.d.ts.map +1 -1
- package/dist/types/components/combobox/check-props.d.ts.map +1 -1
- package/dist/types/components/combobox/combobox.d.ts +41 -6
- package/dist/types/components/combobox/combobox.d.ts.map +1 -1
- package/dist/types/components/date-picker/check-props.d.ts.map +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts +52 -17
- package/dist/types/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/types/components/date-picker/index.d.ts +1 -1
- package/dist/types/components/date-picker/index.d.ts.map +1 -1
- package/dist/types/components/date-picker/private/calendar-wrapper.d.ts +3 -1
- package/dist/types/components/date-picker/private/calendar-wrapper.d.ts.map +1 -1
- package/dist/types/components/expandable-section/index.d.ts +15 -3
- package/dist/types/components/expandable-section/index.d.ts.map +1 -1
- package/dist/types/components/icon/input-icon/index.d.ts.map +1 -1
- package/dist/types/components/input/check-props.d.ts.map +1 -1
- package/dist/types/components/input/index.d.ts +10 -4
- package/dist/types/components/input/index.d.ts.map +1 -1
- package/dist/types/components/input/private/inner-input.d.ts +2 -4
- package/dist/types/components/input/private/inner-input.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/button-trigger.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/index.d.ts +1 -1
- package/dist/types/components/menu-dropdown/index.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/menu-dropdown.d.ts +78 -15
- package/dist/types/components/menu-dropdown/menu-dropdown.d.ts.map +1 -1
- package/dist/types/components/popover/index.d.ts +1 -1
- package/dist/types/components/popover/index.d.ts.map +1 -1
- package/dist/types/components/popover/popover.d.ts +30 -3
- package/dist/types/components/popover/popover.d.ts.map +1 -1
- package/dist/types/components/radio/check-props.d.ts.map +1 -1
- package/dist/types/components/radio/index.d.ts +42 -9
- package/dist/types/components/radio/index.d.ts.map +1 -1
- package/dist/types/components/radio-button-group/index.d.ts +20 -10
- package/dist/types/components/radio-button-group/index.d.ts.map +1 -1
- package/dist/types/components/radio-button-group/radio.d.ts +7 -2
- package/dist/types/components/radio-button-group/radio.d.ts.map +1 -1
- package/dist/types/components/radio-group/check-props.d.ts +3 -0
- package/dist/types/components/radio-group/check-props.d.ts.map +1 -0
- package/dist/types/components/radio-group/index.d.ts +51 -8
- package/dist/types/components/radio-group/index.d.ts.map +1 -1
- package/dist/types/components/radio-group/radio.d.ts +7 -2
- package/dist/types/components/radio-group/radio.d.ts.map +1 -1
- package/dist/types/components/setup-assistant/step.d.ts +10 -2
- package/dist/types/components/setup-assistant/step.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/check-props.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/column.d.ts +4 -1
- package/dist/types/components/simple-data-table/column.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/index.d.ts +10 -2
- package/dist/types/components/simple-data-table/index.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/private/header-cell.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/private/row.d.ts +4 -2
- package/dist/types/components/simple-data-table/private/row.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/types.d.ts +40 -13
- package/dist/types/components/simple-data-table/types.d.ts.map +1 -1
- package/dist/types/components/slider/check-props.d.ts.map +1 -1
- package/dist/types/components/slider/index.d.ts +23 -10
- package/dist/types/components/slider/index.d.ts.map +1 -1
- package/dist/types/components/split-view/index.d.ts +12 -3
- package/dist/types/components/split-view/index.d.ts.map +1 -1
- package/dist/types/components/split-view/listbox-check-props.d.ts +1 -0
- package/dist/types/components/split-view/listbox-check-props.d.ts.map +1 -1
- package/dist/types/components/split-view/listbox.d.ts +41 -10
- package/dist/types/components/split-view/listbox.d.ts.map +1 -1
- package/dist/types/components/tabs/check-props.d.ts +3 -0
- package/dist/types/components/tabs/check-props.d.ts.map +1 -0
- package/dist/types/components/tabs/index.d.ts +46 -12
- package/dist/types/components/tabs/index.d.ts.map +1 -1
- package/dist/types/components/tabs/panel.d.ts +4 -0
- package/dist/types/components/tabs/panel.d.ts.map +1 -1
- package/dist/types/components/textarea/check-props.d.ts.map +1 -1
- package/dist/types/components/textarea/index.d.ts +14 -6
- package/dist/types/components/textarea/index.d.ts.map +1 -1
- package/dist/types/components/toast/container.d.ts +1 -1
- package/dist/types/components/tooltip/index.d.ts +49 -3
- package/dist/types/components/tooltip/index.d.ts.map +1 -1
- package/dist/types/components/tree/check-props.d.ts +1 -0
- package/dist/types/components/tree/check-props.d.ts.map +1 -1
- package/dist/types/components/tree/private/branch.d.ts +6 -1
- package/dist/types/components/tree/private/branch.d.ts.map +1 -1
- package/dist/types/components/tree/private/item.d.ts +3 -1
- package/dist/types/components/tree/private/item.d.ts.map +1 -1
- package/dist/types/components/tree/private/render-branch.d.ts +3 -1
- package/dist/types/components/tree/private/render-branch.d.ts.map +1 -1
- package/dist/types/components/tree/tree.d.ts +33 -6
- package/dist/types/components/tree/tree.d.ts.map +1 -1
- package/dist/types/components/tree/types.d.ts +23 -4
- package/dist/types/components/tree/types.d.ts.map +1 -1
- package/dist/types/components/vertical-navigation/check-props.d.ts +1 -0
- package/dist/types/components/vertical-navigation/check-props.d.ts.map +1 -1
- package/dist/types/components/vertical-navigation/index.d.ts +9 -4
- package/dist/types/components/vertical-navigation/index.d.ts.map +1 -1
- package/dist/types/components/welcome-mat/info-badge.d.ts.map +1 -1
- package/dist/types/types/components.d.ts +0 -2
- package/dist/types/types/components.d.ts.map +1 -1
- package/dist/types/utilities/hooks/index.d.ts +1 -0
- package/dist/types/utilities/hooks/index.d.ts.map +1 -1
- package/dist/types/utilities/hooks/use-controllable-state.d.ts +23 -0
- package/dist/types/utilities/hooks/use-controllable-state.d.ts.map +1 -0
- package/dist/types/utilities/warning/required-property.d.ts +3 -0
- package/dist/types/utilities/warning/required-property.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/modal/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// Implements the [Modal design pattern](https://lightningdesignsystem.com/components/modals/) in React.\n\nimport {\n\tforwardRef,\n\tuseState,\n\tuseEffect,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n\tCSSProperties,\n\tReactNode,\n\tMouseEvent,\n\tKeyboardEvent,\n} from 'react';\nimport classNames from 'classnames';\nimport ReactModal from 'react-modal';\n\nimport checkAppElementIsSet from '../../utilities/warning/check-app-element-set';\nimport Button from '../button';\nimport { MODAL } from '../../utilities/constants';\nimport generateId from '../../utilities/generate-id';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\nconst documentDefined = typeof document !== 'undefined';\nconst windowDefined = typeof window !== 'undefined';\n\n// Types\nexport type ModalAlign = 'top' | 'center';\nexport type ModalSize = 'small' | 'medium' | 'large';\nexport type ModalPrompt =\n\t'success' | 'warning' | 'error' | 'wrench' | 'offline' | 'info';\n\nexport interface ModalAssistiveText {\n\t/** This is a visually hidden label for the dialog. If not provided, `heading` is used. */\n\tdialogLabel?: string;\n\t/** This describes which node labels the dialog. If not provided and dialogLabel is unavailable, `id` is used. */\n\tdialogLabelledBy?: string;\n\t/** This is a visually hidden label for the close button. */\n\tcloseButton?: string;\n}\n\n/**\n * What caused a Modal close request:\n * - `'close-button'`: the header close button was clicked\n * - `'escape'`: the Escape key was pressed\n * - `'click-outside'`: a click landed outside the modal container (on the backdrop area)\n */\nexport type ModalRequestCloseTrigger =\n\t'close-button' | 'escape' | 'click-outside';\n\n/**\n * Data passed to `onRequestClose`\n */\nexport interface ModalRequestCloseData {\n\t/** What caused the close request */\n\ttrigger: ModalRequestCloseTrigger;\n}\n\n/**\n * Event passed to `onRequestClose`: the click (close button / outside click) or\n * keydown (Escape) that caused the request\n */\nexport type ModalRequestCloseEvent = MouseEvent | KeyboardEvent;\n\nexport interface ModalProps {\n\t/** Vertical alignment of Modal. */\n\talign?: ModalAlign;\n\t/** Boolean indicating if the appElement should be hidden. */\n\tariaHideApp?: boolean;\n\t/** Assistive text for accessibility. */\n\tassistiveText?: ModalAssistiveText;\n\t/** Modal content. */\n\tchildren: ReactNode;\n\t/** Custom CSS classes for the root `section.slds-modal` node. */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the `.slds-modal__container` node. */\n\tclassNameContainer?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the `.slds-modal__content` (body) node. */\n\tclassNameContent?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the `footer.slds-modal__footer` node. */\n\tclassNameFooter?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the `header.slds-modal__header` node. */\n\tclassNameHeader?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the portal DOM node that react-modal appends to `parentSelector()`. */\n\tclassNamePortal?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `classNameContainer`. */\n\tcontainerClassName?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `classNameContent`. */\n\tcontentClassName?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `styleContent`. */\n\tcontentStyle?: CSSProperties;\n\t/** If true, modal footer buttons render left and right. */\n\tdirectional?: boolean;\n\t/** If true, Modals cannot be dismissed by clicking on the close icon or pressing esc key. */\n\tdisableClose?: boolean;\n\t/** If true, Modals can be dismissed by clicking outside of modal. If unspecified, defaults to !disableClose. */\n\tdismissOnClickOutside?: boolean;\n\t/**\n\t * Callback to fire when the Modal requests to be dismissed. Receives the triggering\n\t * click or keydown event and `data.trigger`: `'close-button'`, `'escape'`, or `'click-outside'`.\n\t * Not called when `disableClose` (or `dismissOnClickOutside: false` for outside clicks) prevents it.\n\t */\n\tonRequestClose?: (\n\t\tevent: ModalRequestCloseEvent,\n\t\tdata: ModalRequestCloseData\n\t) => void;\n\t/** Modal footer content, typically buttons. */\n\tfooter?: ReactNode | ReactNode[];\n\t/** @deprecated Use `classNameFooter`. */\n\tfooterClassName?: string | string[] | Record<string, boolean>;\n\t/** Allows for a custom modal header that does not scroll with modal content. */\n\theader?: ReactNode;\n\t/** @deprecated Use `classNameHeader`. */\n\theaderClassName?: string | string[] | Record<string, boolean>;\n\t/** Unique identifier for the modal. The id is automatically generated if not provided. */\n\tid?: string;\n\t/** Forces the modal to be open or closed. */\n\tisOpen: boolean;\n\t/** Function whose return value is the mount node to insert the Modal element into. */\n\tparentSelector?: () => HTMLElement;\n\t/** @deprecated Use `classNamePortal`. */\n\tportalClassName?: string | string[] | Record<string, boolean>;\n\t/** Styles the modal as a prompt. */\n\tprompt?: ModalPrompt;\n\t/** Specifies the modal's width. */\n\tsize?: ModalSize;\n\t/** Custom styles for the `.slds-modal__content` (body) node. */\n\tstyleContent?: CSSProperties;\n\t/** Content underneath the heading in the modal header. */\n\ttagline?: ReactNode;\n\t/** Text heading at the top of a modal. */\n\theading?: ReactNode;\n\t/** Allows adding additional notifications within the modal. */\n\ttoast?: ReactNode;\n}\n\nconst defaultAssistiveText: ModalAssistiveText = {\n\tdialogLabelledBy: '',\n\tcloseButton: 'Close',\n};\n\n/**\n * The Modal component is used for the Lightning Design System Modal and Notification > Prompt components.\n * The Modal opens from a state change outside of the component itself (pass this state to the `isOpen` prop).\n *\n * By default, `Modal` will add `aria-hidden=true` to the `body` tag, but this disables some assistive technologies.\n * To prevent this you can add the following to your application with `#mount` being the root node of your application:\n * ```\n * import settings from 'design-system-react/components/settings';\n * settings.setAppElement('#mount');\n * ```\n */\nconst Modal = forwardRef<HTMLElement, ModalProps>(\n\t(\n\t\t{\n\t\t\talign = 'center',\n\t\t\tariaHideApp = true,\n\t\t\tassistiveText: assistiveTextProp,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tclassNameContainer,\n\t\t\tclassNameContent,\n\t\t\tclassNameFooter,\n\t\t\tclassNameHeader,\n\t\t\tclassNamePortal,\n\t\t\tcontainerClassName,\n\t\t\tcontentClassName,\n\t\t\tcontentStyle,\n\t\t\tdirectional,\n\t\t\tdisableClose,\n\t\t\tdismissOnClickOutside,\n\t\t\tonRequestClose,\n\t\t\tfooter,\n\t\t\tfooterClassName,\n\t\t\theader,\n\t\t\theaderClassName,\n\t\t\tid: idProp,\n\t\t\tisOpen,\n\t\t\tparentSelector,\n\t\t\tportalClassName,\n\t\t\tprompt,\n\t\t\tsize,\n\t\t\tstyleContent,\n\t\t\ttagline,\n\t\t\theading,\n\t\t\ttoast,\n\t\t},\n\t\tref\n\t) => {\n\t\tuseEffect(() => {\n\t\t\tcheckProps(\n\t\t\t\tMODAL,\n\t\t\t\t{\n\t\t\t\t\tcontainerClassName,\n\t\t\t\t\tcontentClassName,\n\t\t\t\t\tcontentStyle,\n\t\t\t\t\tfooterClassName,\n\t\t\t\t\theaderClassName,\n\t\t\t\t\tportalClassName,\n\t\t\t\t},\n\t\t\t\tcomponentDoc\n\t\t\t);\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, []); // Only run on mount\n\n\t\t// State\n\t\tconst [returnFocusTo, setReturnFocusTo] = useState<Element | null>(null);\n\n\t\t// Refs\n\t\tconst generatedId = useRef(generateId());\n\n\t\t// Merged assistive text\n\t\tconst assistiveText = useMemo(\n\t\t\t() => ({\n\t\t\t\t...defaultAssistiveText,\n\t\t\t\t...assistiveTextProp,\n\t\t\t}),\n\t\t\t[assistiveTextProp]\n\t\t);\n\n\t\t// ID getter\n\t\tconst getId = useCallback(() => idProp || generatedId.current, [idProp]);\n\n\t\t// Is this a prompt modal?\n\t\tconst isPrompt = prompt !== undefined;\n\n\t\t// Warn in development if the app element isn't set\n\t\tuseEffect(() => {\n\t\t\tif (ariaHideApp) {\n\t\t\t\tcheckAppElementIsSet();\n\t\t\t}\n\t\t}, []); // Only run on mount\n\n\t\t// Set return focus on mount\n\t\tuseEffect(() => {\n\t\t\tif (documentDefined) {\n\t\t\t\tsetReturnFocusTo(document.activeElement);\n\t\t\t}\n\t\t}, []);\n\n\t\t// Update body scroll when isOpen changes\n\t\tuseEffect(() => {\n\t\t\tif (windowDefined && documentDefined && document.body) {\n\t\t\t\tif (isOpen) {\n\t\t\t\t\tdocument.body.style.overflow = 'hidden';\n\t\t\t\t} else {\n\t\t\t\t\tdocument.body.style.overflow = 'inherit';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn () => {\n\t\t\t\t// Clear body scroll on unmount\n\t\t\t\tif (windowDefined && documentDefined && document.body) {\n\t\t\t\t\tdocument.body.style.overflow = 'inherit';\n\t\t\t\t}\n\t\t\t};\n\t\t}, [isOpen]);\n\n\t\t// Dismiss modal handler\n\t\tconst dismissModal = useCallback(\n\t\t\t(event: ModalRequestCloseEvent, data: ModalRequestCloseData) => {\n\t\t\t\tif (\n\t\t\t\t\treturnFocusTo &&\n\t\t\t\t\t'focus' in returnFocusTo &&\n\t\t\t\t\ttypeof returnFocusTo.focus === 'function'\n\t\t\t\t) {\n\t\t\t\t\treturnFocusTo.focus();\n\t\t\t\t}\n\t\t\t\tif (onRequestClose) {\n\t\t\t\t\tonRequestClose(event, data);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[returnFocusTo, onRequestClose]\n\t\t);\n\n\t\t// Close modal handler (respects disableClose)\n\t\tconst closeModal = useCallback(\n\t\t\t(event: ModalRequestCloseEvent, data: ModalRequestCloseData) => {\n\t\t\t\tif (!disableClose) {\n\t\t\t\t\tdismissModal(event, data);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[disableClose, dismissModal]\n\t\t);\n\n\t\t// Close button click handler\n\t\tconst handleCloseButtonClick = useCallback(\n\t\t\t(event: MouseEvent<HTMLButtonElement>) => {\n\t\t\t\tcloseModal(event, { trigger: 'close-button' });\n\t\t\t},\n\t\t\t[closeModal]\n\t\t);\n\n\t\t// react-modal's own close request: Escape keydown, or a click directly on its overlay\n\t\tconst handleReactModalRequestClose = useCallback(\n\t\t\t(event: ModalRequestCloseEvent) => {\n\t\t\t\tcloseModal(event, {\n\t\t\t\t\ttrigger: event.type === 'keydown' ? 'escape' : 'click-outside',\n\t\t\t\t});\n\t\t\t},\n\t\t\t[closeModal]\n\t\t);\n\n\t\t// Dismiss on click outside handler\n\t\tconst dismissModalOnClickOutside = useCallback(\n\t\t\t(event: MouseEvent<HTMLElement>) => {\n\t\t\t\t// if dismissOnClickOutside is not set, default its value to !disableClose\n\t\t\t\tconst shouldDismiss =\n\t\t\t\t\tdismissOnClickOutside !== undefined\n\t\t\t\t\t\t? dismissOnClickOutside\n\t\t\t\t\t\t: !disableClose;\n\n\t\t\t\tif (shouldDismiss) {\n\t\t\t\t\tdismissModal(event, { trigger: 'click-outside' });\n\t\t\t\t}\n\t\t\t},\n\t\t\t[dismissOnClickOutside, disableClose, dismissModal]\n\t\t);\n\n\t\t// Prevent click propagation inside modal\n\t\tconst handleModalClick = useCallback((event: MouseEvent) => {\n\t\t\tif (event && event.stopPropagation) {\n\t\t\t\tevent.stopPropagation();\n\t\t\t}\n\t\t}, []);\n\n\t\t// Calculate border radius based on header/footer presence\n\t\tconst getBorderRadius = useCallback((): CSSProperties => {\n\t\t\tconst borderRadiusValue = '.25rem';\n\t\t\tconst hasHeader = heading || header;\n\t\t\tconst borderTopRadius = hasHeader\n\t\t\t\t? {}\n\t\t\t\t: {\n\t\t\t\t\t\tborderTopLeftRadius: borderRadiusValue,\n\t\t\t\t\t\tborderTopRightRadius: borderRadiusValue,\n\t\t\t\t\t};\n\t\t\tconst borderBottomRadius = footer\n\t\t\t\t? {}\n\t\t\t\t: {\n\t\t\t\t\t\tborderBottomLeftRadius: borderRadiusValue,\n\t\t\t\t\t\tborderBottomRightRadius: borderRadiusValue,\n\t\t\t\t\t};\n\t\t\treturn {\n\t\t\t\t...borderTopRadius,\n\t\t\t\t...borderBottomRadius,\n\t\t\t};\n\t\t}, [heading, header, footer]);\n\n\t\t// Get ARIA attributes\n\t\tconst getAriaAttributes = useCallback(() => {\n\t\t\tconst modalId = getId();\n\t\t\tconst ariaAttributes: {\n\t\t\t\tdescribedby: string;\n\t\t\t\tmodal: boolean;\n\t\t\t\tlabel?: string;\n\t\t\t\tlabelledby?: string;\n\t\t\t} = {\n\t\t\t\tdescribedby: `${modalId}-modal-content`,\n\t\t\t\tmodal: true,\n\t\t\t};\n\n\t\t\tif (assistiveText.dialogLabel) {\n\t\t\t\tariaAttributes.label = assistiveText.dialogLabel;\n\t\t\t\treturn ariaAttributes;\n\t\t\t}\n\n\t\t\tlet dialogLabelledBy: string | undefined;\n\n\t\t\tif (assistiveText.dialogLabelledBy) {\n\t\t\t\tdialogLabelledBy = assistiveText.dialogLabelledBy;\n\t\t\t} else if (heading) {\n\t\t\t\tdialogLabelledBy = `${modalId}-heading`;\n\t\t\t}\n\n\t\t\tif (dialogLabelledBy) {\n\t\t\t\tariaAttributes.labelledby = dialogLabelledBy;\n\t\t\t}\n\n\t\t\treturn ariaAttributes;\n\t\t}, [getId, assistiveText, heading]);\n\n\t\t// Render header\n\t\tconst renderHeader = () => {\n\t\t\tlet headerContent = header;\n\t\t\tconst headerEmpty = !headerContent && !heading && !tagline;\n\t\t\tconst closeButtonText = assistiveText.closeButton;\n\n\t\t\tconst closeButton = (\n\t\t\t\t<Button\n\t\t\t\t\tassistiveText={{ icon: closeButtonText }}\n\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\ticonName=\"close\"\n\t\t\t\t\ticonSize=\"large\"\n\t\t\t\t\tclassName=\"slds-button_icon slds-modal__close\"\n\t\t\t\t\tonClick={handleCloseButtonClick}\n\t\t\t\t\ttitle={closeButtonText}\n\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t/>\n\t\t\t);\n\n\t\t\tif ((!headerContent && heading) || tagline) {\n\t\t\t\theaderContent = (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{toast}\n\t\t\t\t\t\t<h1\n\t\t\t\t\t\t\tclassName={classNames({\n\t\t\t\t\t\t\t\t'slds-text-heading_small': isPrompt,\n\t\t\t\t\t\t\t\t'slds-text-heading_medium': !isPrompt,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tid={`${getId()}-heading`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{heading}\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t{tagline ? <p className=\"slds-m-top_x-small\">{tagline}</p> : null}\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<header\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t'slds-modal__header',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'slds-modal__header_empty': headerEmpty,\n\t\t\t\t\t\t\t[`slds-theme_${prompt}`]: isPrompt,\n\t\t\t\t\t\t\t'slds-theme_alert-texture': isPrompt,\n\t\t\t\t\t\t},\n\t\t\t\t\t\theaderClassName,\n\t\t\t\t\t\tclassNameHeader\n\t\t\t\t\t)}\n\t\t\t\t\tonClick={handleModalClick}\n\t\t\t\t>\n\t\t\t\t\t{disableClose ? null : closeButton}\n\t\t\t\t\t{headerContent}\n\t\t\t\t</header>\n\t\t\t);\n\t\t};\n\n\t\t// Render footer\n\t\tconst renderFooter = () => {\n\t\t\tif (!footer) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst footerClasses = {\n\t\t\t\t'slds-modal__footer': true,\n\t\t\t\t'slds-modal__footer_directional': directional,\n\t\t\t\t'slds-theme_default': isPrompt,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<footer\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\tfooterClasses,\n\t\t\t\t\t\tfooterClassName,\n\t\t\t\t\t\tclassNameFooter\n\t\t\t\t\t)}\n\t\t\t\t\tonClick={handleModalClick}\n\t\t\t\t>\n\t\t\t\t\t{footer}\n\t\t\t\t</footer>\n\t\t\t);\n\t\t};\n\n\t\t// Render modal content\n\t\tconst renderModal = () => {\n\t\t\tconst modalStyle =\n\t\t\t\talign === 'top' ? { justifyContent: 'flex-start' } : undefined;\n\t\t\tconst borderRadius = getBorderRadius();\n\t\t\tconst mergedStyleContent: CSSProperties = {\n\t\t\t\t...borderRadius,\n\t\t\t\t...contentStyle,\n\t\t\t\t...styleContent,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<section\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t'slds-modal',\n\t\t\t\t\t\t'slds-fade-in-open',\n\t\t\t\t\t\tsize ? `slds-modal_${size}` : null,\n\t\t\t\t\t\t{ 'slds-modal_prompt': isPrompt },\n\t\t\t\t\t\tclassName\n\t\t\t\t\t)}\n\t\t\t\t\tonClick={dismissModalOnClickOutside}\n\t\t\t\t\tref={ref}\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-modal__container',\n\t\t\t\t\t\t\tcontainerClassName,\n\t\t\t\t\t\t\tclassNameContainer\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tstyle={modalStyle}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderHeader()}\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t\t'slds-modal__content',\n\t\t\t\t\t\t\t\tcontentClassName,\n\t\t\t\t\t\t\t\tclassNameContent\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tid={`${getId()}-modal-content`}\n\t\t\t\t\t\t\tstyle={mergedStyleContent}\n\t\t\t\t\t\t\tonClick={handleModalClick}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{renderFooter()}\n\t\t\t\t\t</div>\n\t\t\t\t</section>\n\t\t\t);\n\t\t};\n\n\t\t// Custom styles for ReactModal - using undefined to reset default styles\n\t\tconst customStyles: ReactModal.Styles = {\n\t\t\tcontent: {\n\t\t\t\tposition: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tborder: undefined,\n\t\t\t\tbackground: undefined,\n\t\t\t\toverflow: undefined,\n\t\t\t\tWebkitOverflowScrolling: undefined,\n\t\t\t\tborderRadius: undefined,\n\t\t\t\toutline: undefined,\n\t\t\t\tpadding: undefined,\n\t\t\t},\n\t\t\toverlay: {\n\t\t\t\tzIndex: 8000, // following SLDS guideline for z-index overlay\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t},\n\t\t};\n\n\t\tconst ariaAttributes = getAriaAttributes();\n\n\t\treturn (\n\t\t\t<ReactModal\n\t\t\t\taria={ariaAttributes}\n\t\t\t\tariaHideApp={ariaHideApp}\n\t\t\t\tisOpen={isOpen}\n\t\t\t\tonRequestClose={handleReactModalRequestClose}\n\t\t\t\trole={disableClose ? 'alertdialog' : 'dialog'}\n\t\t\t\tstyle={customStyles}\n\t\t\t\tparentSelector={parentSelector}\n\t\t\t\tportalClassName={classNames(\n\t\t\t\t\t'ReactModalPortal',\n\t\t\t\t\tportalClassName,\n\t\t\t\t\tclassNamePortal\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{renderModal()}\n\t\t\t\t<div className=\"slds-backdrop slds-backdrop_open\" />\n\t\t\t</ReactModal>\n\t\t);\n\t}\n);\n\nModal.displayName = MODAL;\n\nexport default Modal;\n"],"mappings":"whBA2BA,IAAM,EAAkB,OAAO,SAAa,IACtC,EAAgB,OAAO,OAAW,IAgHlC,GAA2C,CAChD,iBAAkB,GAClB,YAAa,OACd,EAaM,GAAA,EAAQ,EAAA,WAAA,EAEZ,CACC,QAAQ,SACR,cAAc,GACd,cAAe,EACf,WACA,YACA,qBACA,mBACA,kBACA,kBACA,kBACA,qBACA,mBACA,eACA,cACA,eACA,wBACA,iBACA,SACA,kBACA,SACA,kBACA,GAAI,EACJ,SACA,iBACA,kBACA,SACA,OACA,eACA,UACA,UACA,SAED,IACI,EACJ,EAAA,EAAA,UAAA,KAAgB,CACf,EAAA,QACC,EAAA,MACA,CACC,qBACA,mBACA,eACA,kBACA,kBACA,iBACD,EACA,EAAA,OACD,CAED,EAAG,CAAC,CAAC,EAGL,GA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,UACG,CAAA,EACJ,GAAa,CACV,GACG,CAAA,CAEX,EAGM,GAAkC,CACvC,QAAS,CACR,SAAU,IAAA,GACV,IAAK,IAAA,GACL,KAAM,IAAA,GACN,MAAO,IAAA,GACP,OAAQ,IAAA,GACR,OAAQ,IAAA,GACR,WAAY,IAAA,GACZ,SAAU,IAAA,GACV,wBAAyB,IAAA,GACzB,aAAc,IAAA,GACd,QAAS,IAAA,GACT,QAAS,IAAA,EACV,EACA,QAAS,CACR,OAAQ,IACR,gBAAiB,IAAA,EAClB,CACD,EAEM,GAAiB,GAAkB,EAEzC,OACC,EAAA,EAAA,KAAA,CAAC,EAAA,QAAD,CACC,KAAM,GACO,cACL,SACR,eAAgB,GAChB,KAAM,EAAe,cAAgB,SACrC,MAAO,GACS,iBAChB,iBAAA,EAAiB,EAAA,QAAA,CAChB,mBACA,EACA,CACD,EAZD,SAAA,CAcE,GAAY,GACb,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,kCAAoC,CAAA,CACxC,GAEd,CACD,EAEA,EAAM,YAAc,EAAA"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/modal/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// Implements the [Modal design pattern](https://lightningdesignsystem.com/components/modals/) in React.\n\nimport {\n\tforwardRef,\n\tuseState,\n\tuseEffect,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n\tCSSProperties,\n\tReactNode,\n\tMouseEvent,\n\tKeyboardEvent,\n} from 'react';\nimport classNames from 'classnames';\nimport ReactModal from 'react-modal';\n\nimport checkAppElementIsSet from '../../utilities/warning/check-app-element-set';\nimport Button from '../button';\nimport { MODAL } from '../../utilities/constants';\nimport generateId from '../../utilities/generate-id';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\nconst documentDefined = typeof document !== 'undefined';\nconst windowDefined = typeof window !== 'undefined';\n\n// Types\nexport type ModalAlign = 'top' | 'center';\nexport type ModalSize = 'small' | 'medium' | 'large';\nexport type ModalPrompt =\n\t'success' | 'warning' | 'error' | 'wrench' | 'offline' | 'info';\n\nexport interface ModalAssistiveText {\n\t/** This is a visually hidden label for the dialog. If not provided, `heading` is used. */\n\tdialogLabel?: string;\n\t/** This describes which node labels the dialog. If not provided and dialogLabel is unavailable, `id` is used. */\n\tdialogLabelledBy?: string;\n\t/** This is a visually hidden label for the close button. */\n\tcloseButton?: string;\n}\n\n/**\n * What caused a Modal close request:\n * - `'close-button'`: the header close button was clicked\n * - `'escape'`: the Escape key was pressed\n * - `'click-outside'`: a click landed outside the modal container (on the backdrop area)\n */\nexport type ModalRequestCloseTrigger =\n\t'close-button' | 'escape' | 'click-outside';\n\n/**\n * Data passed to `onRequestClose`\n */\nexport interface ModalRequestCloseData {\n\t/** What caused the close request */\n\ttrigger: ModalRequestCloseTrigger;\n}\n\n/**\n * Event passed to `onRequestClose`: the click (close button / outside click) or\n * keydown (Escape) that caused the request\n */\nexport type ModalRequestCloseEvent = MouseEvent | KeyboardEvent;\n\nexport interface ModalProps {\n\t/** Vertical alignment of Modal. */\n\talign?: ModalAlign;\n\t/** Boolean indicating if the appElement should be hidden. */\n\tariaHideApp?: boolean;\n\t/** Assistive text for accessibility. */\n\tassistiveText?: ModalAssistiveText;\n\t/** Modal content. */\n\tchildren: ReactNode;\n\t/** Custom CSS classes for the root `section.slds-modal` node. */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the `.slds-modal__container` node. */\n\tclassNameContainer?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the `.slds-modal__content` (body) node. */\n\tclassNameContent?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the `footer.slds-modal__footer` node. */\n\tclassNameFooter?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the `header.slds-modal__header` node. */\n\tclassNameHeader?: string | string[] | Record<string, boolean>;\n\t/** Custom CSS classes for the portal DOM node that react-modal appends to `parentSelector()`. */\n\tclassNamePortal?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `classNameContainer`. */\n\tcontainerClassName?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `classNameContent`. */\n\tcontentClassName?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `styleContent`. */\n\tcontentStyle?: CSSProperties;\n\t/** If true, modal footer buttons render left and right. */\n\tdirectional?: boolean;\n\t/** If true, Modals cannot be dismissed by clicking on the close icon or pressing esc key. */\n\tdisableClose?: boolean;\n\t/** If true, Modals can be dismissed by clicking outside of modal. If unspecified, defaults to !disableClose. */\n\tdismissOnClickOutside?: boolean;\n\t/**\n\t * Callback to fire when the Modal requests to be dismissed. Receives the triggering\n\t * click or keydown event and `data.trigger`: `'close-button'`, `'escape'`, or `'click-outside'`.\n\t * Not called when `disableClose` (or `dismissOnClickOutside: false` for outside clicks) prevents it.\n\t */\n\tonRequestClose?: (\n\t\tevent: ModalRequestCloseEvent,\n\t\tdata: ModalRequestCloseData\n\t) => void;\n\t/** Modal footer content, typically buttons. */\n\tfooter?: ReactNode | ReactNode[];\n\t/** @deprecated Use `classNameFooter`. */\n\tfooterClassName?: string | string[] | Record<string, boolean>;\n\t/** Allows for a custom modal header that does not scroll with modal content. */\n\theader?: ReactNode;\n\t/** @deprecated Use `classNameHeader`. */\n\theaderClassName?: string | string[] | Record<string, boolean>;\n\t/** Unique identifier for the modal. The id is automatically generated if not provided. */\n\tid?: string;\n\t/** Forces the modal to be open or closed. */\n\tisOpen: boolean;\n\t/** Function whose return value is the mount node to insert the Modal element into. */\n\tparentSelector?: () => HTMLElement;\n\t/** @deprecated Use `classNamePortal`. */\n\tportalClassName?: string | string[] | Record<string, boolean>;\n\t/** Styles the modal as a prompt. */\n\tprompt?: ModalPrompt;\n\t/** Specifies the modal's width. */\n\tsize?: ModalSize;\n\t/** Custom styles for the `.slds-modal__content` (body) node. */\n\tstyleContent?: CSSProperties;\n\t/** Content underneath the heading in the modal header. */\n\ttagline?: ReactNode;\n\t/** Text heading at the top of a modal. */\n\theading?: ReactNode;\n\t/** Allows adding additional notifications within the modal. */\n\ttoast?: ReactNode;\n}\n\nconst defaultAssistiveText: ModalAssistiveText = {\n\tdialogLabelledBy: '',\n\tcloseButton: 'Close',\n};\n\n/**\n * The Modal component is used for the Lightning Design System Modal and Notification > Prompt components.\n * The Modal opens from a state change outside of the component itself (pass this state to the `isOpen` prop).\n *\n * By default, `Modal` will add `aria-hidden=true` to the `body` tag, but this disables some assistive technologies.\n * To prevent this you can add the following to your application with `#mount` being the root node of your application:\n * ```\n * import settings from 'design-system-react/components/settings';\n * settings.setAppElement('#mount');\n * ```\n */\nconst Modal = forwardRef<HTMLElement, ModalProps>(\n\t(\n\t\t{\n\t\t\talign = 'center',\n\t\t\tariaHideApp = true,\n\t\t\tassistiveText: assistiveTextProp,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tclassNameContainer,\n\t\t\tclassNameContent,\n\t\t\tclassNameFooter,\n\t\t\tclassNameHeader,\n\t\t\tclassNamePortal,\n\t\t\tcontainerClassName,\n\t\t\tcontentClassName,\n\t\t\tcontentStyle,\n\t\t\tdirectional,\n\t\t\tdisableClose,\n\t\t\tdismissOnClickOutside,\n\t\t\tonRequestClose,\n\t\t\tfooter,\n\t\t\tfooterClassName,\n\t\t\theader,\n\t\t\theaderClassName,\n\t\t\tid: idProp,\n\t\t\tisOpen,\n\t\t\tparentSelector,\n\t\t\tportalClassName,\n\t\t\tprompt,\n\t\t\tsize,\n\t\t\tstyleContent,\n\t\t\ttagline,\n\t\t\theading,\n\t\t\ttoast,\n\t\t},\n\t\tref\n\t) => {\n\t\tuseEffect(() => {\n\t\t\tcheckProps(\n\t\t\t\tMODAL,\n\t\t\t\t{\n\t\t\t\t\tcontainerClassName,\n\t\t\t\t\tcontentClassName,\n\t\t\t\t\tcontentStyle,\n\t\t\t\t\tfooterClassName,\n\t\t\t\t\theaderClassName,\n\t\t\t\t\tportalClassName,\n\t\t\t\t},\n\t\t\t\tcomponentDoc\n\t\t\t);\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, []); // Only run on mount\n\n\t\t// State\n\t\tconst [returnFocusTo, setReturnFocusTo] = useState<Element | null>(null);\n\n\t\t// Refs\n\t\tconst generatedId = useRef(generateId());\n\n\t\t// Merged assistive text\n\t\tconst assistiveText = useMemo(\n\t\t\t() => ({\n\t\t\t\t...defaultAssistiveText,\n\t\t\t\t...assistiveTextProp,\n\t\t\t}),\n\t\t\t[assistiveTextProp]\n\t\t);\n\n\t\t// ID getter\n\t\tconst getId = useCallback(() => idProp || generatedId.current, [idProp]);\n\n\t\t// Is this a prompt modal?\n\t\tconst isPrompt = prompt !== undefined;\n\n\t\t// Warn in development if the app element isn't set\n\t\tuseEffect(() => {\n\t\t\tif (ariaHideApp) {\n\t\t\t\tcheckAppElementIsSet();\n\t\t\t}\n\t\t}, []); // Only run on mount\n\n\t\t// Set return focus on mount\n\t\tuseEffect(() => {\n\t\t\tif (documentDefined) {\n\t\t\t\tsetReturnFocusTo(document.activeElement);\n\t\t\t}\n\t\t}, []);\n\n\t\t// Update body scroll when isOpen changes\n\t\tuseEffect(() => {\n\t\t\tif (windowDefined && documentDefined && document.body) {\n\t\t\t\tif (isOpen) {\n\t\t\t\t\tdocument.body.style.overflow = 'hidden';\n\t\t\t\t} else {\n\t\t\t\t\tdocument.body.style.overflow = 'inherit';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn () => {\n\t\t\t\t// Clear body scroll on unmount\n\t\t\t\tif (windowDefined && documentDefined && document.body) {\n\t\t\t\t\tdocument.body.style.overflow = 'inherit';\n\t\t\t\t}\n\t\t\t};\n\t\t}, [isOpen]);\n\n\t\t// Dismiss modal handler\n\t\tconst dismissModal = useCallback(\n\t\t\t(event: ModalRequestCloseEvent, data: ModalRequestCloseData) => {\n\t\t\t\tif (\n\t\t\t\t\treturnFocusTo &&\n\t\t\t\t\t'focus' in returnFocusTo &&\n\t\t\t\t\ttypeof returnFocusTo.focus === 'function'\n\t\t\t\t) {\n\t\t\t\t\treturnFocusTo.focus();\n\t\t\t\t}\n\t\t\t\tif (onRequestClose) {\n\t\t\t\t\tonRequestClose(event, data);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[returnFocusTo, onRequestClose]\n\t\t);\n\n\t\t// Close modal handler (respects disableClose)\n\t\tconst closeModal = useCallback(\n\t\t\t(event: ModalRequestCloseEvent, data: ModalRequestCloseData) => {\n\t\t\t\tif (!disableClose) {\n\t\t\t\t\tdismissModal(event, data);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[disableClose, dismissModal]\n\t\t);\n\n\t\t// Close button click handler\n\t\tconst handleCloseButtonClick = useCallback(\n\t\t\t(event: MouseEvent<HTMLButtonElement>) => {\n\t\t\t\tcloseModal(event, { trigger: 'close-button' });\n\t\t\t},\n\t\t\t[closeModal]\n\t\t);\n\n\t\t// react-modal's own close request: Escape keydown, or a click directly on its overlay\n\t\tconst handleReactModalRequestClose = useCallback(\n\t\t\t(event: ModalRequestCloseEvent) => {\n\t\t\t\tcloseModal(event, {\n\t\t\t\t\ttrigger: event.type === 'keydown' ? 'escape' : 'click-outside',\n\t\t\t\t});\n\t\t\t},\n\t\t\t[closeModal]\n\t\t);\n\n\t\t// Dismiss on click outside handler\n\t\tconst dismissModalOnClickOutside = useCallback(\n\t\t\t(event: MouseEvent<HTMLElement>) => {\n\t\t\t\t// if dismissOnClickOutside is not set, default its value to !disableClose\n\t\t\t\tconst shouldDismiss =\n\t\t\t\t\tdismissOnClickOutside !== undefined\n\t\t\t\t\t\t? dismissOnClickOutside\n\t\t\t\t\t\t: !disableClose;\n\n\t\t\t\tif (shouldDismiss) {\n\t\t\t\t\tdismissModal(event, { trigger: 'click-outside' });\n\t\t\t\t}\n\t\t\t},\n\t\t\t[dismissOnClickOutside, disableClose, dismissModal]\n\t\t);\n\n\t\t// Prevent click propagation inside modal\n\t\tconst handleModalClick = useCallback((event: MouseEvent) => {\n\t\t\tif (event && event.stopPropagation) {\n\t\t\t\tevent.stopPropagation();\n\t\t\t}\n\t\t}, []);\n\n\t\t// Calculate border radius based on header/footer presence\n\t\tconst getBorderRadius = useCallback((): CSSProperties => {\n\t\t\tconst borderRadiusValue = '.25rem';\n\t\t\tconst hasHeader = heading || header;\n\t\t\tconst borderTopRadius = hasHeader\n\t\t\t\t? {}\n\t\t\t\t: {\n\t\t\t\t\t\tborderTopLeftRadius: borderRadiusValue,\n\t\t\t\t\t\tborderTopRightRadius: borderRadiusValue,\n\t\t\t\t\t};\n\t\t\tconst borderBottomRadius = footer\n\t\t\t\t? {}\n\t\t\t\t: {\n\t\t\t\t\t\tborderBottomLeftRadius: borderRadiusValue,\n\t\t\t\t\t\tborderBottomRightRadius: borderRadiusValue,\n\t\t\t\t\t};\n\t\t\treturn {\n\t\t\t\t...borderTopRadius,\n\t\t\t\t...borderBottomRadius,\n\t\t\t};\n\t\t}, [heading, header, footer]);\n\n\t\t// Get ARIA attributes\n\t\tconst getAriaAttributes = useCallback(() => {\n\t\t\tconst modalId = getId();\n\t\t\tconst ariaAttributes: {\n\t\t\t\tdescribedby: string;\n\t\t\t\tmodal: boolean;\n\t\t\t\tlabel?: string;\n\t\t\t\tlabelledby?: string;\n\t\t\t} = {\n\t\t\t\tdescribedby: `${modalId}-modal-content`,\n\t\t\t\tmodal: true,\n\t\t\t};\n\n\t\t\tif (assistiveText.dialogLabel) {\n\t\t\t\tariaAttributes.label = assistiveText.dialogLabel;\n\t\t\t\treturn ariaAttributes;\n\t\t\t}\n\n\t\t\tlet dialogLabelledBy: string | undefined;\n\n\t\t\tif (assistiveText.dialogLabelledBy) {\n\t\t\t\tdialogLabelledBy = assistiveText.dialogLabelledBy;\n\t\t\t} else if (heading) {\n\t\t\t\tdialogLabelledBy = `${modalId}-heading`;\n\t\t\t}\n\n\t\t\tif (dialogLabelledBy) {\n\t\t\t\tariaAttributes.labelledby = dialogLabelledBy;\n\t\t\t}\n\n\t\t\treturn ariaAttributes;\n\t\t}, [getId, assistiveText, heading]);\n\n\t\t// Render header\n\t\tconst renderHeader = () => {\n\t\t\tlet headerContent = header;\n\t\t\tconst headerEmpty = !headerContent && !heading && !tagline;\n\t\t\tconst closeButtonText = assistiveText.closeButton;\n\n\t\t\tconst closeButton = (\n\t\t\t\t<Button\n\t\t\t\t\tassistiveText={{ icon: closeButtonText }}\n\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\ticonName=\"close\"\n\t\t\t\t\ticonSize=\"large\"\n\t\t\t\t\tclassName=\"slds-button_icon slds-modal__close\"\n\t\t\t\t\tonClick={handleCloseButtonClick}\n\t\t\t\t\ttitle={closeButtonText}\n\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t/>\n\t\t\t);\n\n\t\t\tif ((!headerContent && heading) || tagline) {\n\t\t\t\theaderContent = (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{toast}\n\t\t\t\t\t\t<h1\n\t\t\t\t\t\t\tclassName={classNames({\n\t\t\t\t\t\t\t\t'slds-text-heading_small': isPrompt,\n\t\t\t\t\t\t\t\t'slds-text-heading_medium': !isPrompt,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tid={`${getId()}-heading`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{heading}\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t{tagline ? <p className=\"slds-m-top_x-small\">{tagline}</p> : null}\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<header\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t'slds-modal__header',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'slds-modal__header_empty': headerEmpty,\n\t\t\t\t\t\t\t[`slds-theme_${prompt}`]: isPrompt,\n\t\t\t\t\t\t\t'slds-theme_alert-texture': isPrompt,\n\t\t\t\t\t\t},\n\t\t\t\t\t\theaderClassName,\n\t\t\t\t\t\tclassNameHeader\n\t\t\t\t\t)}\n\t\t\t\t\tonClick={handleModalClick}\n\t\t\t\t>\n\t\t\t\t\t{disableClose || isPrompt ? null : closeButton}\n\t\t\t\t\t{headerContent}\n\t\t\t\t</header>\n\t\t\t);\n\t\t};\n\n\t\t// Render footer\n\t\tconst renderFooter = () => {\n\t\t\tif (!footer) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst footerClasses = {\n\t\t\t\t'slds-modal__footer': true,\n\t\t\t\t'slds-modal__footer_directional': directional,\n\t\t\t\t'slds-theme_default': isPrompt,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<footer\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\tfooterClasses,\n\t\t\t\t\t\tfooterClassName,\n\t\t\t\t\t\tclassNameFooter\n\t\t\t\t\t)}\n\t\t\t\t\tonClick={handleModalClick}\n\t\t\t\t>\n\t\t\t\t\t{footer}\n\t\t\t\t</footer>\n\t\t\t);\n\t\t};\n\n\t\t// Render modal content\n\t\tconst renderModal = () => {\n\t\t\tconst modalStyle =\n\t\t\t\talign === 'top' ? { justifyContent: 'flex-start' } : undefined;\n\t\t\tconst borderRadius = getBorderRadius();\n\t\t\tconst mergedStyleContent: CSSProperties = {\n\t\t\t\t...borderRadius,\n\t\t\t\t...contentStyle,\n\t\t\t\t...styleContent,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<section\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t'slds-modal',\n\t\t\t\t\t\t'slds-fade-in-open',\n\t\t\t\t\t\tsize ? `slds-modal_${size}` : null,\n\t\t\t\t\t\t{ 'slds-modal_prompt': isPrompt },\n\t\t\t\t\t\tclassName\n\t\t\t\t\t)}\n\t\t\t\t\tonClick={dismissModalOnClickOutside}\n\t\t\t\t\tref={ref}\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-modal__container',\n\t\t\t\t\t\t\tcontainerClassName,\n\t\t\t\t\t\t\tclassNameContainer\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tstyle={modalStyle}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderHeader()}\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t\t'slds-modal__content',\n\t\t\t\t\t\t\t\tcontentClassName,\n\t\t\t\t\t\t\t\tclassNameContent\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tid={`${getId()}-modal-content`}\n\t\t\t\t\t\t\tstyle={mergedStyleContent}\n\t\t\t\t\t\t\tonClick={handleModalClick}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{renderFooter()}\n\t\t\t\t\t</div>\n\t\t\t\t</section>\n\t\t\t);\n\t\t};\n\n\t\t// Custom styles for ReactModal - using undefined to reset default styles\n\t\tconst customStyles: ReactModal.Styles = {\n\t\t\tcontent: {\n\t\t\t\tposition: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tborder: undefined,\n\t\t\t\tbackground: undefined,\n\t\t\t\toverflow: undefined,\n\t\t\t\tWebkitOverflowScrolling: undefined,\n\t\t\t\tborderRadius: undefined,\n\t\t\t\toutline: undefined,\n\t\t\t\tpadding: undefined,\n\t\t\t},\n\t\t\toverlay: {\n\t\t\t\tzIndex: 8000, // following SLDS guideline for z-index overlay\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t},\n\t\t};\n\n\t\tconst ariaAttributes = getAriaAttributes();\n\n\t\treturn (\n\t\t\t<ReactModal\n\t\t\t\taria={ariaAttributes}\n\t\t\t\tariaHideApp={ariaHideApp}\n\t\t\t\tisOpen={isOpen}\n\t\t\t\tonRequestClose={handleReactModalRequestClose}\n\t\t\t\trole={disableClose ? 'alertdialog' : 'dialog'}\n\t\t\t\tstyle={customStyles}\n\t\t\t\tparentSelector={parentSelector}\n\t\t\t\tportalClassName={classNames(\n\t\t\t\t\t'ReactModalPortal',\n\t\t\t\t\tportalClassName,\n\t\t\t\t\tclassNamePortal\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{renderModal()}\n\t\t\t\t<div className=\"slds-backdrop slds-backdrop_open\" />\n\t\t\t</ReactModal>\n\t\t);\n\t}\n);\n\nModal.displayName = MODAL;\n\nexport default Modal;\n"],"mappings":"whBA2BA,IAAM,EAAkB,OAAO,SAAa,IACtC,EAAgB,OAAO,OAAW,IAgHlC,GAA2C,CAChD,iBAAkB,GAClB,YAAa,OACd,EAaM,GAAA,EAAQ,EAAA,WAAA,EAEZ,CACC,QAAQ,SACR,cAAc,GACd,cAAe,EACf,WACA,YACA,qBACA,mBACA,kBACA,kBACA,kBACA,qBACA,mBACA,eACA,cACA,eACA,wBACA,iBACA,SACA,kBACA,SACA,kBACA,GAAI,EACJ,SACA,iBACA,kBACA,SACA,OACA,eACA,UACA,UACA,SAED,IACI,EACJ,EAAA,EAAA,UAAA,KAAgB,CACf,EAAA,QACC,EAAA,MACA,CACC,qBACA,mBACA,eACA,kBACA,kBACA,iBACD,EACA,EAAA,OACD,CAED,EAAG,CAAC,CAAC,EAGL,GAAM,CAAC,EAAe,IAAA,EAAoB,EAAA,SAAA,CAAyB,IAAI,EAGjE,GAAA,EAAc,EAAA,OAAA,CAAO,EAAA,QAAW,CAAC,EAGjC,GAAA,EAAgB,EAAA,QAAA,MACd,CACN,GAAG,GACH,GAAG,CACJ,GACA,CAAC,CAAiB,CACnB,EAGM,GAAA,EAAQ,EAAA,YAAA,KAAkB,GAAU,EAAY,QAAS,CAAC,CAAM,CAAC,EAGjE,EAAW,IAAW,IAAA,IAG5B,EAAA,EAAA,UAAA,KAAgB,CACX,GACH,EAAA,QAAqB,CAEvB,EAAG,CAAC,CAAC,GAGL,EAAA,EAAA,UAAA,KAAgB,CACX,GACH,EAAiB,SAAS,aAAa,CAEzC,EAAG,C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AAM,EAAe,cAAgB,SACrC,MAAO,GACS,iBAChB,iBAAA,EAAiB,EAAA,QAAA,CAChB,mBACA,EACA,CACD,EAZD,SAAA,CAcE,GAAY,GACb,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,kCAAoC,CAAA,CACxC,GAEd,CACD,EAEA,EAAM,YAAc,EAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/popover/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// Note: react-onclickoutside HOC has been removed.\n// Click outside detection is handled by the Dialog utility component.\n// Future work: Consider migrating from Popper.js to @floating-ui/react\n\nimport Popover, { PopoverNubbinPositions } from './popover';\n\nexport type {\n\tPopoverProps,\n\tPopoverAlign,\n\tPopoverPosition,\n\tPopoverVariant,\n\tPopoverAssistiveText,\n\tPopoverRequestCloseTrigger,\n\tPopoverRequestCloseData,\n\tPopoverOpenData,\n\tPopoverCloseData,\n} from './popover';\n\nexport { PopoverNubbinPositions };\nexport default Popover;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/popover/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// Note: react-onclickoutside HOC has been removed.\n// Click outside detection is handled by the Dialog utility component.\n// Future work: Consider migrating from Popper.js to @floating-ui/react\n\nimport Popover, { PopoverNubbinPositions } from './popover';\n\nexport type {\n\tPopoverProps,\n\tPopoverAlign,\n\tPopoverPosition,\n\tPopoverVariant,\n\tPopoverAssistiveText,\n\tPopoverRequestCloseTrigger,\n\tPopoverRequestCloseData,\n\tPopoverRequestOpenTrigger,\n\tPopoverRequestOpenData,\n\tPopoverOpenData,\n\tPopoverCloseData,\n} from './popover';\n\nexport { PopoverNubbinPositions };\nexport default Popover;\n"],"mappings":"gIAwBA,IAAA,EAAe,EAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../icon-settings/index.cjs"),r=require("../../utilities/key-code.cjs"),
|
|
1
|
+
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../icon-settings/index.cjs"),r=require("../../utilities/hooks/use-controllable-state.cjs"),i=require("../../utilities/key-code.cjs"),ee=require("../utilities/dialog/index.cjs"),a=require("../icon/index.cjs"),te=require("../../utilities/get-component-doc.cjs"),ne=require("../button/index.cjs"),re=require("../../utilities/warning/deprecated-property.cjs"),ie=require("../media-object/index.cjs"),ae=require("../../utilities/keyboard-navigable-dialog.cjs"),oe=require("./component.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l=typeof document<`u`,u=l?document.createElement(`span`):{style:{}};l&&(u.style.top=`0`,u.style.left=`0`,u.style.width=`100%`,u.style.height=`100%`,u.style.position=`absolute`);var d=null,se=[`top left`,`top`,`top right`,`bottom left`,`bottom`,`bottom right`],ce={closeButton:`Close dialog`},f=(0,o.forwardRef)(({align:e=`right`,assistiveText:se,ariaLabelledby:f,children:le,body:p,classNameBody:m,classNameFooter:ue,footerClassName:h,className:de,classNameDialog:fe,contentsClassName:g,disabled:_=!1,footer:v,footerStyle:y,footerWalkthroughActions:b,hasNoCloseButton:pe=!1,hasNoNubbin:me=!1,hasStaticAlignment:he=!1,hasNoTriggerStyles:ge=!1,heading:x,icon:_e,id:ve,isOpen:ye,defaultIsOpen:be=!1,offset:xe,onClick:S,onClose:C,onFocus:w,onKeyDown:T,onMouseDown:Se,onMouseEnter:E,onMouseLeave:D,onOpen:O,onRequestOpen:k,onRequestClose:A,onRequestTargetElement:j,openOn:M=`click`,overlay:N,position:Ce=`absolute`,stepText:P,style:we,styleDialog:Te,styleFooter:F,triggerClassName:I,variant:L=`base`,hoverCloseDelay:R=300,closeButtonAssistiveText:Ee},z)=>{(0,o.useEffect)(()=>{if(process.env.NODE_ENV!==`production`){let e=te.default(oe.default);[[`contentsClassName`,g,`classNameDialog`],[`footerClassName`,h,`classNameFooter`],[`footerStyle`,y,`styleFooter`],[`triggerClassName`,I,`className`]].forEach(([n,r,i])=>{re.default(t.POPOVER,r,n,i,e(i))})}},[]);let De=(0,o.useId)(),B=ve||De,Oe=(0,o.useContext)(n.IconSettingsContext),ke={...ce,...se},Ae=Ee||ke.closeButton,[je,V]=r.useControllableState(ye,be),[H,Me]=(0,o.useState)(!1),U=(0,o.useRef)(null),Ne=(0,o.useRef)(null),Pe=(0,o.useRef)(!1),W=(0,o.useRef)(null),G=(0,o.useRef)(null),Fe=(0,o.useRef)(!1),K=!_&&je,Ie=(0,o.useCallback)(()=>{if(j){let e=j();if(e)return e}return U.current},[j]),Le=(0,o.useCallback)((e,t)=>{let n=t?.componentWillUnmount||!1;d?.getId()===B&&(d=null),C&&C(void 0,{componentWillUnmount:n})},[B,C]),Re=(0,o.useCallback)((e,t)=>{O&&O(void 0,{portal:t?.portal})},[O]),q=(0,o.useCallback)((e,t)=>{K&&(A&&A(e,t),d?.getId()===B&&(d=null),V(!1),Pe.current=!1)},[K,B,A,V]),ze=(0,o.useRef)(q);(0,o.useEffect)(()=>{ze.current=q},[q]);let J=(0,o.useCallback)((e,t)=>{!K&&!_&&(k?.(e,{trigger:t}),d&&d.getId()!==B&&d.handleClose(void 0,{trigger:`newPopover`,id:d.getId()}),d={handleClose:(e,t)=>ze.current(e,t),getId:()=>B},V(!0))},[K,_,B,k,V]),Y=(0,o.useCallback)(e=>{q(e,{trigger:`cancel`})},[q]);(0,o.useCallback)(e=>{q(e,{trigger:`clickOutside`})},[q]);let Be=(0,o.useCallback)(e=>{Pe.current=!0,!K&&M===`hover`?J(e,`mouseEnter`):W.current&&clearTimeout(W.current),E&&E(e)},[K,M,J,E]),Ve=(0,o.useCallback)(e=>{K&&(W.current=setTimeout(()=>{q(void 0,{trigger:`mouseLeave`})},R)),D&&D(e)},[K,R,q,D]),X=(0,o.useCallback)((e,t)=>{K?q(e,{trigger:`triggerClick`}):J(e,`triggerClick`),S&&S(e),t&&t(e)},[K,J,q,S]),He=(0,o.useCallback)(e=>{K||J(e,`focus`),w&&w(e)},[K,J,w]),Ue=(0,o.useCallback)(e=>{K&&Y(e)},[K,Y]),We=(0,o.useCallback)(e=>{e.keyCode&&(e.keyCode!==i.default.TAB&&ae.default({event:e,isOpen:K,handleClick:e=>X(e),keyCode:e.keyCode,eventTarget:e.target,toggleOpen:()=>Ue(e),trigger:U.current}),T&&T(e))},[K,X,Ue,T]),Z=(0,o.useCallback)(e=>{typeof N==`function`&&l?N(e,u):N&&e&&!G.current&&l?(G.current=u,document.querySelector(`body`)?.appendChild(u)):!e&&G.current?.parentNode&&(G.current.parentNode.removeChild(G.current),G.current=null)},[N]),Ge=(0,o.useCallback)(e=>{U.current=e,typeof z==`function`?z(e):z&&(z.current=e),e&&!H&&Me(!0)},[H,z]),Ke=(0,o.useCallback)(e=>{Ne.current=e},[]);(0,o.useEffect)(()=>()=>{Fe.current=!0,d?.getId()===B&&(d=null),Z(!1)},[B,Z]),(0,o.useEffect)(()=>{Z(K)},[K,Z]);let qe=()=>{let e=L===`error`||L===`warning`;if(!(x||e)||L===`walkthrough-action`||L===`feature`)return null;let t={error:(0,c.jsx)(a.default,{category:`utility`,name:`error`,size:`x-small`,inverse:!0}),warning:(0,c.jsx)(a.default,{category:`utility`,name:`warning`,size:`x-small`,inverse:!0})};return e?(0,c.jsx)(`header`,{className:`slds-popover__header`,children:(0,c.jsx)(ie.default,{body:(0,c.jsx)(`h2`,{id:f||`${B}-dialog-heading`,className:`slds-truncate slds-text-heading_medium`,title:typeof x==`string`?x:void 0,children:x}),figure:t[L],verticalCenter:!0})}):(0,c.jsx)(`header`,{className:(0,s.default)(`slds-popover__header`,{"slds-p-vertical_medium":L===`walkthrough`}),children:(0,c.jsx)(`h2`,{id:f||`${B}-dialog-heading`,className:(0,s.default)({"slds-text-heading_small":L!==`walkthrough`,"slds-text-heading_medium":L===`walkthrough`}),children:x})})},Je=()=>L===`error`||L===`warning`?(0,c.jsx)(`div`,{id:`${B}-dialog-body`,className:(0,s.default)(`slds-popover__body`,m),children:p}):L===`walkthrough-action`||L===`feature`?(0,c.jsx)(`div`,{className:(0,s.default)(`slds-popover__body`,m),id:`${B}-dialog-body`,children:(0,c.jsxs)(`div`,{className:`slds-media`,children:[(0,c.jsx)(`div`,{className:`slds-media__figure`,children:L===`walkthrough-action`?(0,c.jsx)(a.default,{category:`utility`,name:`touch_action`,size:`small`,inverse:!0}):_e}),(0,c.jsxs)(`div`,{className:`slds-media__body`,children:[x&&(0,c.jsx)(`h2`,{id:f||`${B}-dialog-heading`,className:`slds-text-heading_small`,children:x}),p,P&&(0,c.jsx)(`p`,{className:`slds-m-top_medium slds-text-title`,children:P})]})]})}):(0,c.jsx)(`div`,{id:`${B}-dialog-body`,className:(0,s.default)(`slds-popover__body`,m),children:p}),Ye=()=>{let e=(0,s.default)(`slds-popover__footer`,h,ue),t=y||F?{...y,...F}:void 0;return v?(0,c.jsx)(`footer`,{className:e,style:t,children:v}):L!==`walkthrough-action`&&(b||P)?(0,c.jsx)(`footer`,{className:e,style:t,children:(0,c.jsxs)(`div`,{className:`slds-grid slds-grid_vertical-align-center`,children:[P&&(0,c.jsx)(`span`,{className:`slds-text-title`,children:P}),b&&(0,c.jsx)(`div`,{className:`slds-col_bump-left`,style:{display:`inline-block`},children:b})]})}):null},Xe=()=>{if(!K)return null;let t=`ignore-click-${B}`;return(0,c.jsxs)(ee.default,{hasNubbin:!me,align:e,contentsClassName:(0,s.default)(g,`ignore-react-onclickoutside`,`slds-popover`,{"slds-popover_error":L===`error`},{"slds-popover_walkthrough":L===`walkthrough`||L===`walkthrough-action`||L===`feature`},{"slds-popover_walkthrough-alt":L===`walkthrough-action`},{"slds-popover_feature":L===`feature`},{"slds-popover_warning":L===`warning`},fe),context:Oe,hasStaticAlignment:he,offset:xe,onClose:Le,onOpen:Re,onKeyDown:We,onMouseEnter:M===`hover`?Be:void 0,onMouseLeave:M===`hover`?Ve:void 0,outsideClickIgnoreClass:t,onRequestTargetElement:Ie,position:Ce,style:Te,variant:`popover`,ref:Ke,containerProps:{id:`${B}-popover`,"aria-labelledby":f||`${B}-dialog-heading`,"aria-describedby":`${B}-dialog-body`},children:[!pe&&(0,c.jsx)(ne.default,{assistiveText:{icon:Ae},iconCategory:`utility`,iconName:`close`,className:(0,s.default)(`slds-button slds-button_icon-small slds-float_right slds-popover__close slds-button_icon`,{"slds-button_icon-inverse":L===`walkthrough`||L===`walkthrough-action`||L===`feature`}),onClick:Y,variant:`icon`,inverse:L===`error`||L===`warning`}),qe(),Je(),Ye()]})},Q=[],$=null;o.default.Children.forEach(le,(e,t)=>{if(t===0&&o.default.isValidElement(e)){let t=e.props,n={"aria-haspopup":`dialog`,id:B,onClick:M===`click`||M===`hybrid`?e=>{X(e,t.onClick)}:t.onClick,onFocus:M===`hover`?He:void 0,onMouseDown:Se,onMouseEnter:M===`hover`||M===`hybrid`?Be:void 0,onMouseLeave:M===`hover`||M===`hybrid`?Ve:void 0,tabIndex:t.tabIndex||0};$=o.default.cloneElement(e,n)}else e&&Q.push(e)});let Ze={display:ge?void 0:`inline-block`,...we};return(0,c.jsxs)(`div`,{className:(0,s.default)(I,de)||void 0,style:Ze,ref:Ge,children:[$,Q.length>0?Q:null,Xe()]})});f.displayName=t.POPOVER,exports.PopoverNubbinPositions=se,exports.default=f;
|
|
2
2
|
//# sourceMappingURL=popover.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.cjs","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 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 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 * 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 for the Popover component\n */\nexport interface PopoverProps {\n\t/** Alignment relative to trigger */\n\talign?: PopoverAlign;\n\t/** Accessibility labels */\n\tassistiveText?: PopoverAssistiveText;\n\t/** HTML id of heading for aria-labelledby */\n\tariaLabelledby?: string;\n\t/** Trigger element (first child) and optional other children */\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/** Popover heading */\n\theading?: ReactNode;\n\t/** Icon for feature variant */\n\ticon?: ReactNode;\n\t/** HTML id */\n\tid?: string;\n\t/** Controlled open state */\n\tisOpen?: boolean;\n\t/** Offset from target */\n\toffset?: string;\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 close. `data.trigger` says why. `event` is the triggering\n\t * click or key event, or `undefined` when there is none (`mouseLeave` timer, `newPopover`).\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/** Open trigger type */\n\topenOn?: 'click' | 'hover' | 'hybrid';\n\t/** Overlay for click-outside on iframes */\n\toverlay?: boolean | ((isOpen: boolean, overlayElement: HTMLElement) => 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/** Popover variant */\n\tvariant?: PopoverVariant;\n\t/** Delay before closing on hover (ms) */\n\thoverCloseDelay?: number;\n\t/** @deprecated Use assistiveText.closeButton */\n\tcloseButtonAssistiveText?: string;\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>(\n\t(\n\t\t{\n\t\t\talign = 'right',\n\t\t\tassistiveText: propAssistiveText,\n\t\t\tariaLabelledby,\n\t\t\tchildren,\n\t\t\tbody,\n\t\t\tclassNameBody,\n\t\t\tclassNameFooter,\n\t\t\tfooterClassName,\n\t\t\tclassName,\n\t\t\tclassNameDialog,\n\t\t\tcontentsClassName,\n\t\t\tdisabled = false,\n\t\t\tfooter,\n\t\t\tfooterStyle,\n\t\t\tfooterWalkthroughActions,\n\t\t\thasNoCloseButton = false,\n\t\t\thasNoNubbin = false,\n\t\t\thasStaticAlignment = false,\n\t\t\thasNoTriggerStyles = false,\n\t\t\theading,\n\t\t\ticon,\n\t\t\tid: propId,\n\t\t\tisOpen: controlledIsOpen,\n\t\t\toffset,\n\t\t\tonClick,\n\t\t\tonClose,\n\t\t\tonFocus,\n\t\t\tonKeyDown,\n\t\t\tonMouseDown,\n\t\t\tonMouseEnter,\n\t\t\tonMouseLeave,\n\t\t\tonOpen,\n\t\t\tonRequestClose,\n\t\t\tonRequestTargetElement,\n\t\t\topenOn = 'click',\n\t\t\toverlay: overlayProp,\n\t\t\tposition = 'absolute',\n\t\t\tstepText,\n\t\t\tstyle,\n\t\t\tstyleDialog,\n\t\t\tstyleFooter,\n\t\t\ttriggerClassName,\n\t\t\tvariant = 'base',\n\t\t\thoverCloseDelay = 300,\n\t\t\tcloseButtonAssistiveText,\n\t\t},\n\t\tref\n\t) => {\n\t\t// `check-props.js` is not wired up (its trigger and heading checks predate v11), so the\n\t\t// renamed props are checked here.\n\t\tuseEffect(() => {\n\t\t\tif (process.env.NODE_ENV !== 'production') {\n\t\t\t\tconst createDocUrl = getComponentDocFn(componentDoc);\n\t\t\t\tconst renamedProps: [string, unknown, string][] = [\n\t\t\t\t\t['contentsClassName', contentsClassName, 'classNameDialog'],\n\t\t\t\t\t['footerClassName', footerClassName, 'classNameFooter'],\n\t\t\t\t\t['footerStyle', footerStyle, 'styleFooter'],\n\t\t\t\t\t['triggerClassName', triggerClassName, 'className'],\n\t\t\t\t];\n\t\t\t\trenamedProps.forEach(([oldProp, value, newProp]) => {\n\t\t\t\t\tdeprecatedProperty(\n\t\t\t\t\t\tPOPOVER,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\toldProp,\n\t\t\t\t\t\tnewProp,\n\t\t\t\t\t\tcreateDocUrl(newProp)\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t}\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, []); // Only run on mount\n\n\t\tconst generatedId = useId();\n\t\tconst id = propId || generatedId;\n\t\tconst context = useContext(IconSettingsContext);\n\n\t\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\t\tconst finalCloseButtonAssistiveText =\n\t\t\tcloseButtonAssistiveText || assistiveText.closeButton;\n\n\t\t// State\n\t\tconst [internalIsOpen, setInternalIsOpen] = useState(false);\n\t\tconst [inputRendered, setInputRendered] = useState(false);\n\n\t\t// Refs\n\t\tconst triggerRef = useRef<HTMLDivElement>(null);\n\t\tconst dialogRef = useRef<HTMLElement>(null);\n\t\tconst isHoverRef = useRef(false);\n\t\tconst isClosingRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\t\tconst overlayRef = useRef<HTMLSpanElement | null>(null);\n\t\tconst isUnmountingRef = useRef(false);\n\n\t\t// Derived state\n\t\tconst isOpen =\n\t\t\t!disabled &&\n\t\t\t(controlledIsOpen !== undefined ? controlledIsOpen : internalIsOpen);\n\n\t\t// Get target element for positioning\n\t\tconst getTargetElement = useCallback(() => {\n\t\t\tif (onRequestTargetElement) {\n\t\t\t\tconst target = onRequestTargetElement();\n\t\t\t\tif (target) return target;\n\t\t\t}\n\t\t\treturn triggerRef.current;\n\t\t}, [onRequestTargetElement]);\n\n\t\t// Handle dialog close (when unmounted)\n\t\tconst handleDialogClose = useCallback(\n\t\t\t(\n\t\t\t\t_event?: React.SyntheticEvent,\n\t\t\t\tdata?: { componentWillUnmount?: boolean }\n\t\t\t) => {\n\t\t\t\tconst componentWillUnmount = data?.componentWillUnmount || false;\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\tif (onClose) {\n\t\t\t\t\tonClose(undefined, { componentWillUnmount });\n\t\t\t\t}\n\t\t\t},\n\t\t\t[id, onClose]\n\t\t);\n\n\t\t// Handle dialog open (after it has rendered)\n\t\tconst handleDialogOpen = useCallback(\n\t\t\t(_event?: unknown, data?: { portal?: HTMLElement }) => {\n\t\t\t\tif (onOpen) {\n\t\t\t\t\tonOpen(undefined, { portal: data?.portal });\n\t\t\t\t}\n\t\t\t},\n\t\t\t[onOpen]\n\t\t);\n\n\t\t// Handle close\n\t\tconst handleClose = useCallback(\n\t\t\t(\n\t\t\t\tevent: MouseEvent | KeyboardEvent | undefined,\n\t\t\t\tdata: PopoverRequestCloseData\n\t\t\t) => {\n\t\t\t\tif (isOpen) {\n\t\t\t\t\tif (onRequestClose) {\n\t\t\t\t\t\tonRequestClose(event, data);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\t\t\tcurrentOpenPopover = null;\n\t\t\t\t\t}\n\n\t\t\t\t\tsetInternalIsOpen(false);\n\t\t\t\t\tisHoverRef.current = false;\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, id, onRequestClose]\n\t\t);\n\n\t\t// Latest `handleClose`, so the \"close the other open popover\" path does not call a stale\n\t\t// closure from when this popover opened (whose `isOpen` was still `false`).\n\t\tconst handleCloseRef = useRef(handleClose);\n\t\tuseEffect(() => {\n\t\t\thandleCloseRef.current = handleClose;\n\t\t}, [handleClose]);\n\n\t\t// Handle open\n\t\tconst handleOpen = useCallback(() => {\n\t\t\tif (!isOpen) {\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\tsetInternalIsOpen(true);\n\t\t\t}\n\t\t}, [isOpen, id]);\n\n\t\t// Handle cancel (close button or escape)\n\t\tconst handleCancel = useCallback(\n\t\t\t(event: MouseEvent | KeyboardEvent) => {\n\t\t\t\thandleClose(event, { trigger: 'cancel' });\n\t\t\t},\n\t\t\t[handleClose]\n\t\t);\n\n\t\t// Handle click outside\n\t\tconst handleClickOutside = useCallback(\n\t\t\t(event: MouseEvent) => {\n\t\t\t\thandleClose(event, { trigger: 'clickOutside' });\n\t\t\t},\n\t\t\t[handleClose]\n\t\t);\n\n\t\t// Handle mouse enter\n\t\tconst handleMouseEnter = useCallback(\n\t\t\t(event: MouseEvent) => {\n\t\t\t\tisHoverRef.current = true;\n\n\t\t\t\tif (!isOpen && openOn === 'hover') {\n\t\t\t\t\thandleOpen();\n\t\t\t\t} else {\n\t\t\t\t\tif (isClosingRef.current) {\n\t\t\t\t\t\tclearTimeout(isClosingRef.current);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (onMouseEnter) {\n\t\t\t\t\tonMouseEnter(event);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, openOn, handleOpen, onMouseEnter]\n\t\t);\n\n\t\t// Handle mouse leave\n\t\tconst handleMouseLeave = useCallback(\n\t\t\t(event: MouseEvent) => {\n\t\t\t\tif (isOpen) {\n\t\t\t\t\tisClosingRef.current = setTimeout(() => {\n\t\t\t\t\t\thandleClose(undefined, { trigger: 'mouseLeave' });\n\t\t\t\t\t}, hoverCloseDelay);\n\t\t\t\t}\n\n\t\t\t\tif (onMouseLeave) {\n\t\t\t\t\tonMouseLeave(event);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, hoverCloseDelay, handleClose, onMouseLeave]\n\t\t);\n\n\t\t// Handle click\n\t\tconst handleClick = useCallback(\n\t\t\t(event: MouseEvent, triggerOnClickCallback?: (e: MouseEvent) => void) => {\n\t\t\t\tif (!isOpen) {\n\t\t\t\t\thandleOpen();\n\t\t\t\t} else {\n\t\t\t\t\thandleClose(event, { trigger: 'triggerClick' });\n\t\t\t\t}\n\n\t\t\t\tif (onClick) {\n\t\t\t\t\tonClick(event);\n\t\t\t\t}\n\n\t\t\t\tif (triggerOnClickCallback) {\n\t\t\t\t\ttriggerOnClickCallback(event);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, handleOpen, handleClose, onClick]\n\t\t);\n\n\t\t// Handle focus\n\t\tconst handleFocus = useCallback(\n\t\t\t(event: FocusEvent) => {\n\t\t\t\tif (!isOpen) {\n\t\t\t\t\thandleOpen();\n\t\t\t\t}\n\n\t\t\t\tif (onFocus) {\n\t\t\t\t\tonFocus(event);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, handleOpen, onFocus]\n\t\t);\n\n\t\t// Toggle from keyboard\n\t\tconst toggleOpenFromKeyboard = useCallback(\n\t\t\t(event: KeyboardEvent) => {\n\t\t\t\tif (isOpen) {\n\t\t\t\t\thandleCancel(event);\n\t\t\t\t} else {\n\t\t\t\t\thandleOpen();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, handleCancel, handleOpen]\n\t\t);\n\n\t\t// Handle key down\n\t\tconst handleKeyDown = useCallback(\n\t\t\t(event: KeyboardEvent) => {\n\t\t\t\tif (event.keyCode) {\n\t\t\t\t\tif (event.keyCode !== KEYS.TAB) {\n\t\t\t\t\t\tkeyboardNavigableDialog({\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\tisOpen,\n\t\t\t\t\t\t\thandleClick: (e: MouseEvent) => handleClick(e),\n\t\t\t\t\t\t\tkeyCode: event.keyCode,\n\t\t\t\t\t\t\teventTarget: event.target,\n\t\t\t\t\t\t\t// keyboardNavigableDialog calls `toggleOpen()` without the event; pass it through\n\t\t\t\t\t\t\ttoggleOpen: () => toggleOpenFromKeyboard(event),\n\t\t\t\t\t\t\ttrigger: triggerRef.current,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif (onKeyDown) {\n\t\t\t\t\t\tonKeyDown(event);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, handleClick, toggleOpenFromKeyboard, onKeyDown]\n\t\t);\n\n\t\t// Render overlay for click-outside detection\n\t\tconst renderOverlay = useCallback(\n\t\t\t(shouldShow: boolean) => {\n\t\t\t\tif (typeof overlayProp === 'function' && documentDefined) {\n\t\t\t\t\toverlayProp(shouldShow, overlay);\n\t\t\t\t} else if (\n\t\t\t\t\toverlayProp &&\n\t\t\t\t\tshouldShow &&\n\t\t\t\t\t!overlayRef.current &&\n\t\t\t\t\tdocumentDefined\n\t\t\t\t) {\n\t\t\t\t\toverlayRef.current = overlay;\n\t\t\t\t\tdocument.querySelector('body')?.appendChild(overlay);\n\t\t\t\t} else if (!shouldShow && overlayRef.current?.parentNode) {\n\t\t\t\t\toverlayRef.current.parentNode.removeChild(overlayRef.current);\n\t\t\t\t\toverlayRef.current = null;\n\t\t\t\t}\n\t\t\t},\n\t\t\t[overlayProp]\n\t\t);\n\n\t\t// Container ref callback\n\t\tconst setContainerRef = useCallback(\n\t\t\t(component: HTMLDivElement | null) => {\n\t\t\t\t(triggerRef as React.MutableRefObject<HTMLDivElement | null>).current =\n\t\t\t\t\tcomponent;\n\t\t\t\tif (typeof ref === 'function') {\n\t\t\t\t\tref(component);\n\t\t\t\t} else if (ref) {\n\t\t\t\t\tref.current = component;\n\t\t\t\t}\n\t\t\t\tif (component && !inputRendered) {\n\t\t\t\t\tsetInputRendered(true);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[inputRendered, ref]\n\t\t);\n\n\t\t// Dialog ref callback\n\t\tconst setMenuRef = useCallback((component: HTMLElement | null) => {\n\t\t\t(dialogRef as React.MutableRefObject<HTMLElement | null>).current =\n\t\t\t\tcomponent;\n\t\t}, []);\n\n\t\t// Cleanup on unmount\n\t\tuseEffect(() => {\n\t\t\treturn () => {\n\t\t\t\tisUnmountingRef.current = true;\n\t\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\t\tcurrentOpenPopover = null;\n\t\t\t\t}\n\t\t\t\trenderOverlay(false);\n\t\t\t};\n\t\t}, [id, renderOverlay]);\n\n\t\t// Update overlay when isOpen changes\n\t\tuseEffect(() => {\n\t\t\trenderOverlay(isOpen);\n\t\t}, [isOpen, renderOverlay]);\n\n\t\t// Render header\n\t\tconst renderHeader = () => {\n\t\t\tconst hasThemedHeader = variant === 'error' || variant === 'warning';\n\t\t\tconst hasDefinedHeader = heading || hasThemedHeader;\n\n\t\t\tif (\n\t\t\t\t!hasDefinedHeader ||\n\t\t\t\tvariant === 'walkthrough-action' ||\n\t\t\t\tvariant === 'feature'\n\t\t\t) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst headerIcon = {\n\t\t\t\terror: <Icon category=\"utility\" name=\"error\" size=\"x-small\" inverse />,\n\t\t\t\twarning: (\n\t\t\t\t\t<Icon category=\"utility\" name=\"warning\" size=\"x-small\" inverse />\n\t\t\t\t),\n\t\t\t};\n\n\t\t\tif (hasThemedHeader) {\n\t\t\t\treturn (\n\t\t\t\t\t<header className=\"slds-popover__header\">\n\t\t\t\t\t\t<MediaObject\n\t\t\t\t\t\t\tbody={\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-truncate slds-text-heading_medium\"\n\t\t\t\t\t\t\t\t\ttitle={typeof heading === 'string' ? heading : undefined}\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\tfigure={headerIcon[variant as 'error' | 'warning']}\n\t\t\t\t\t\t\tverticalCenter\n\t\t\t\t\t\t/>\n\t\t\t\t\t</header>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<header\n\t\t\t\t\tclassName={classNames('slds-popover__header', {\n\t\t\t\t\t\t'slds-p-vertical_medium': variant === 'walkthrough',\n\t\t\t\t\t})}\n\t\t\t\t>\n\t\t\t\t\t<h2\n\t\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\t\tclassName={classNames({\n\t\t\t\t\t\t\t'slds-text-heading_small': variant !== 'walkthrough',\n\t\t\t\t\t\t\t'slds-text-heading_medium': variant === 'walkthrough',\n\t\t\t\t\t\t})}\n\t\t\t\t\t>\n\t\t\t\t\t\t{heading}\n\t\t\t\t\t</h2>\n\t\t\t\t</header>\n\t\t\t);\n\t\t};\n\n\t\t// Render body\n\t\tconst renderBody = () => {\n\t\t\tif (variant === 'error' || variant === 'warning') {\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-popover__body',\n\t\t\t\t\t\t\tclassNameBody as string\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{body}\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (variant === 'walkthrough-action' || variant === 'feature') {\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-popover__body',\n\t\t\t\t\t\t\tclassNameBody as string\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"slds-media\">\n\t\t\t\t\t\t\t<div className=\"slds-media__figure\">\n\t\t\t\t\t\t\t\t{variant === 'walkthrough-action' ? (\n\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\t\t\t\tname=\"touch_action\"\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tinverse\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\ticon\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"slds-media__body\">\n\t\t\t\t\t\t\t\t{heading && (\n\t\t\t\t\t\t\t\t\t<h2\n\t\t\t\t\t\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\t\t\t\t\t\tclassName=\"slds-text-heading_small\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{heading}\n\t\t\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{body}\n\t\t\t\t\t\t\t\t{stepText && (\n\t\t\t\t\t\t\t\t\t<p className=\"slds-m-top_medium slds-text-title\">\n\t\t\t\t\t\t\t\t\t\t{stepText}\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\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\t// Render footer\n\t\tconst renderFooter = () => {\n\t\t\tconst footerClassNames = classNames(\n\t\t\t\t'slds-popover__footer',\n\t\t\t\tfooterClassName,\n\t\t\t\tclassNameFooter\n\t\t\t);\n\t\t\tconst footerStyles =\n\t\t\t\tfooterStyle || styleFooter\n\t\t\t\t\t? { ...footerStyle, ...styleFooter }\n\t\t\t\t\t: undefined;\n\n\t\t\tif (footer) {\n\t\t\t\treturn (\n\t\t\t\t\t<footer className={footerClassNames} style={footerStyles}>\n\t\t\t\t\t\t{footer}\n\t\t\t\t\t</footer>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tvariant !== 'walkthrough-action' &&\n\t\t\t\t(footerWalkthroughActions || stepText)\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\t<footer className={footerClassNames} style={footerStyles}>\n\t\t\t\t\t\t<div className=\"slds-grid slds-grid_vertical-align-center\">\n\t\t\t\t\t\t\t{stepText && <span className=\"slds-text-title\">{stepText}</span>}\n\t\t\t\t\t\t\t{footerWalkthroughActions && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName=\"slds-col_bump-left\"\n\t\t\t\t\t\t\t\t\tstyle={{ display: 'inline-block' }}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{footerWalkthroughActions}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</footer>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn null;\n\t\t};\n\n\t\t// Render dialog\n\t\tconst renderDialog = () => {\n\t\t\tif (!isOpen) return null;\n\n\t\t\tconst outsideClickIgnoreClass = `ignore-click-${id}`;\n\n\t\t\treturn (\n\t\t\t\t<Dialog\n\t\t\t\t\thasNubbin={!hasNoNubbin}\n\t\t\t\t\talign={align}\n\t\t\t\t\tcontentsClassName={classNames(\n\t\t\t\t\t\tcontentsClassName,\n\t\t\t\t\t\t'ignore-react-onclickoutside',\n\t\t\t\t\t\t'slds-popover',\n\t\t\t\t\t\t{ 'slds-popover_error': variant === 'error' },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'slds-popover_walkthrough':\n\t\t\t\t\t\t\t\tvariant === 'walkthrough' ||\n\t\t\t\t\t\t\t\tvariant === 'walkthrough-action' ||\n\t\t\t\t\t\t\t\tvariant === 'feature',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'slds-popover_walkthrough-alt': variant === 'walkthrough-action',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ 'slds-popover_feature': variant === 'feature' },\n\t\t\t\t\t\t{ 'slds-popover_warning': variant === 'warning' },\n\t\t\t\t\t\tclassNameDialog\n\t\t\t\t\t)}\n\t\t\t\t\tcontext={context}\n\t\t\t\t\thasStaticAlignment={hasStaticAlignment}\n\t\t\t\t\toffset={offset}\n\t\t\t\t\tonClose={handleDialogClose}\n\t\t\t\t\tonOpen={handleDialogOpen}\n\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\tonMouseEnter={openOn === 'hover' ? handleMouseEnter : undefined}\n\t\t\t\t\tonMouseLeave={openOn === 'hover' ? handleMouseLeave : undefined}\n\t\t\t\t\toutsideClickIgnoreClass={outsideClickIgnoreClass}\n\t\t\t\t\tonRequestTargetElement={getTargetElement}\n\t\t\t\t\tposition={position}\n\t\t\t\t\tstyle={styleDialog}\n\t\t\t\t\tvariant=\"popover\"\n\t\t\t\t\tref={setMenuRef}\n\t\t\t\t\tcontainerProps={{\n\t\t\t\t\t\tid: `${id}-popover`,\n\t\t\t\t\t\t'aria-labelledby': ariaLabelledby || `${id}-dialog-heading`,\n\t\t\t\t\t\t'aria-describedby': `${id}-dialog-body`,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{!hasNoCloseButton && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tassistiveText={{ icon: finalCloseButtonAssistiveText }}\n\t\t\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\t\t\ticonName=\"close\"\n\t\t\t\t\t\t\tclassName={classNames(\n\t\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\t{\n\t\t\t\t\t\t\t\t\t'slds-button_icon-inverse':\n\t\t\t\t\t\t\t\t\t\tvariant === 'walkthrough' ||\n\t\t\t\t\t\t\t\t\t\tvariant === 'walkthrough-action' ||\n\t\t\t\t\t\t\t\t\t\tvariant === 'feature',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tonClick={handleCancel}\n\t\t\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t\t\t\tinverse={variant === 'error' || variant === 'warning'}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{renderHeader()}\n\t\t\t\t\t{renderBody()}\n\t\t\t\t\t{renderFooter()}\n\t\t\t\t</Dialog>\n\t\t\t);\n\t\t};\n\n\t\t// Clone trigger element\n\t\tconst otherChildren: ReactNode[] = [];\n\t\tlet clonedTrigger: ReactNode = null;\n\n\t\tReact.Children.forEach(children, (child, index) => {\n\t\t\tif (index === 0 && React.isValidElement(child)) {\n\t\t\t\tconst childProps = child.props as Record<string, unknown>;\n\t\t\t\tconst triggerProps: Record<string, unknown> = {\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(\n\t\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t\t\tchildProps.onClick as (e: MouseEvent) => void\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: childProps.onClick,\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\ttabIndex: (childProps.tabIndex as number) || 0,\n\t\t\t\t};\n\t\t\t\tclonedTrigger = React.cloneElement(child, triggerProps);\n\t\t\t} else if (child) {\n\t\t\t\totherChildren.push(child);\n\t\t\t}\n\t\t});\n\n\t\tconst containerStyles: CSSProperties = {\n\t\t\tdisplay: hasNoTriggerStyles ? undefined : 'inline-block',\n\t\t\t...style,\n\t\t};\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames(triggerClassName, className) || undefined}\n\t\t\t\tstyle={containerStyles}\n\t\t\t\tref={setContainerRef}\n\t\t\t>\n\t\t\t\t{clonedTrigger}\n\t\t\t\t{otherChildren.length > 0 ? otherChildren : null}\n\t\t\t\t{renderDialog()}\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nPopover.displayName = POPOVER;\n\nexport default Popover;\n"],"mappings":"6oBAgCA,IAAM,EAAkB,OAAO,SAAa,IAGtC,EAAU,EACb,SAAS,cAAc,MAAM,EAC5B,CAAE,MAAO,CAAC,CAAE,EACZ,IACH,EAAQ,MAAM,IAAM,IACpB,EAAQ,MAAM,KAAO,IACrB,EAAQ,MAAM,MAAQ,OACtB,EAAQ,MAAM,OAAS,OACvB,EAAQ,MAAM,SAAW,YAI1B,IAAI,EAMO,KA0LE,EAAyB,CACrC,WACA,MACA,YACA,cACA,SACA,cACD,EAEM,GAA6C,CAClD,YAAa,cACd,EAOM,GAAA,EAAU,EAAA,WAAA,EAEd,CACC,QAAQ,QACR,cAAe,EACf,iBACA,YACA,OACA,gBACA,mBACA,kBACA,aACA,mBACA,qBACA,YAAW,GACX,SACA,cACA,2BACA,oBAAmB,GACnB,eAAc,GACd,sBAAqB,GACrB,sBAAqB,GACrB,UACA,QACA,GAAI,GACJ,OAAQ,EACR,UACA,UACA,UACA,UACA,YACA,eACA,eACA,eACA,SACA,iBACA,yBACA,SAAS,QACT,QAAS,EACT,YAAW,WACX,WACA,SACA,eACA,cACA,mBACA,UAAU,OACV,kBAAkB,IAClB,6BAED,IACI,EAGJ,EAAA,EAAA,UAAA,KAAgB,CACf,GAAA,QAAA,IAAA,WAA6B,aAAc,CAC1C,IAAM,EAAe,GAAA,QAAkB,GAAA,OAAY,EAOnD,CALC,CAAC,oBAAqB,GAAmB,iBAAiB,EAC1D,CAAC,kBAAmB,E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{"version":3,"file":"popover.cjs","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 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 for the Popover component\n */\nexport interface PopoverProps {\n\t/** Alignment relative to trigger */\n\talign?: PopoverAlign;\n\t/** Accessibility labels */\n\tassistiveText?: PopoverAssistiveText;\n\t/** HTML id of heading for aria-labelledby */\n\tariaLabelledby?: string;\n\t/** Trigger element (first child) and optional other children */\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/** Popover heading */\n\theading?: ReactNode;\n\t/** Icon for feature variant */\n\ticon?: ReactNode;\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/** Offset from target */\n\toffset?: string;\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/** Open trigger type */\n\topenOn?: 'click' | 'hover' | 'hybrid';\n\t/** Overlay for click-outside on iframes */\n\toverlay?: boolean | ((isOpen: boolean, overlayElement: HTMLElement) => 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/** Popover variant */\n\tvariant?: PopoverVariant;\n\t/** Delay before closing on hover (ms) */\n\thoverCloseDelay?: number;\n\t/** @deprecated Use assistiveText.closeButton */\n\tcloseButtonAssistiveText?: string;\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>(\n\t(\n\t\t{\n\t\t\talign = 'right',\n\t\t\tassistiveText: propAssistiveText,\n\t\t\tariaLabelledby,\n\t\t\tchildren,\n\t\t\tbody,\n\t\t\tclassNameBody,\n\t\t\tclassNameFooter,\n\t\t\tfooterClassName,\n\t\t\tclassName,\n\t\t\tclassNameDialog,\n\t\t\tcontentsClassName,\n\t\t\tdisabled = false,\n\t\t\tfooter,\n\t\t\tfooterStyle,\n\t\t\tfooterWalkthroughActions,\n\t\t\thasNoCloseButton = false,\n\t\t\thasNoNubbin = false,\n\t\t\thasStaticAlignment = false,\n\t\t\thasNoTriggerStyles = false,\n\t\t\theading,\n\t\t\ticon,\n\t\t\tid: propId,\n\t\t\tisOpen: controlledIsOpen,\n\t\t\tdefaultIsOpen = false,\n\t\t\toffset,\n\t\t\tonClick,\n\t\t\tonClose,\n\t\t\tonFocus,\n\t\t\tonKeyDown,\n\t\t\tonMouseDown,\n\t\t\tonMouseEnter,\n\t\t\tonMouseLeave,\n\t\t\tonOpen,\n\t\t\tonRequestOpen,\n\t\t\tonRequestClose,\n\t\t\tonRequestTargetElement,\n\t\t\topenOn = 'click',\n\t\t\toverlay: overlayProp,\n\t\t\tposition = 'absolute',\n\t\t\tstepText,\n\t\t\tstyle,\n\t\t\tstyleDialog,\n\t\t\tstyleFooter,\n\t\t\ttriggerClassName,\n\t\t\tvariant = 'base',\n\t\t\thoverCloseDelay = 300,\n\t\t\tcloseButtonAssistiveText,\n\t\t},\n\t\tref\n\t) => {\n\t\t// `check-props.js` is not wired up (its trigger and heading checks predate v11), so the\n\t\t// renamed props are checked here.\n\t\tuseEffect(() => {\n\t\t\tif (process.env.NODE_ENV !== 'production') {\n\t\t\t\tconst createDocUrl = getComponentDocFn(componentDoc);\n\t\t\t\tconst renamedProps: [string, unknown, string][] = [\n\t\t\t\t\t['contentsClassName', contentsClassName, 'classNameDialog'],\n\t\t\t\t\t['footerClassName', footerClassName, 'classNameFooter'],\n\t\t\t\t\t['footerStyle', footerStyle, 'styleFooter'],\n\t\t\t\t\t['triggerClassName', triggerClassName, 'className'],\n\t\t\t\t];\n\t\t\t\trenamedProps.forEach(([oldProp, value, newProp]) => {\n\t\t\t\t\tdeprecatedProperty(\n\t\t\t\t\t\tPOPOVER,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\toldProp,\n\t\t\t\t\t\tnewProp,\n\t\t\t\t\t\tcreateDocUrl(newProp)\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t}\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, []); // Only run on mount\n\n\t\tconst generatedId = useId();\n\t\tconst id = propId || generatedId;\n\t\tconst context = useContext(IconSettingsContext);\n\n\t\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\t\tconst finalCloseButtonAssistiveText =\n\t\t\tcloseButtonAssistiveText || assistiveText.closeButton;\n\n\t\t// State\n\t\tconst [currentIsOpen, setIsOpen] = useControllableState(\n\t\t\tcontrolledIsOpen,\n\t\t\tdefaultIsOpen\n\t\t);\n\t\tconst [inputRendered, setInputRendered] = useState(false);\n\n\t\t// Refs\n\t\tconst triggerRef = useRef<HTMLDivElement>(null);\n\t\tconst dialogRef = useRef<HTMLElement>(null);\n\t\tconst isHoverRef = useRef(false);\n\t\tconst isClosingRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\t\tconst overlayRef = useRef<HTMLSpanElement | null>(null);\n\t\tconst isUnmountingRef = useRef(false);\n\n\t\t// Derived state\n\t\tconst isOpen = !disabled && currentIsOpen;\n\n\t\t// Get target element for positioning\n\t\tconst getTargetElement = useCallback(() => {\n\t\t\tif (onRequestTargetElement) {\n\t\t\t\tconst target = onRequestTargetElement();\n\t\t\t\tif (target) return target;\n\t\t\t}\n\t\t\treturn triggerRef.current;\n\t\t}, [onRequestTargetElement]);\n\n\t\t// Handle dialog close (when unmounted)\n\t\tconst handleDialogClose = useCallback(\n\t\t\t(\n\t\t\t\t_event?: React.SyntheticEvent,\n\t\t\t\tdata?: { componentWillUnmount?: boolean }\n\t\t\t) => {\n\t\t\t\tconst componentWillUnmount = data?.componentWillUnmount || false;\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\tif (onClose) {\n\t\t\t\t\tonClose(undefined, { componentWillUnmount });\n\t\t\t\t}\n\t\t\t},\n\t\t\t[id, onClose]\n\t\t);\n\n\t\t// Handle dialog open (after it has rendered)\n\t\tconst handleDialogOpen = useCallback(\n\t\t\t(_event?: unknown, data?: { portal?: HTMLElement }) => {\n\t\t\t\tif (onOpen) {\n\t\t\t\t\tonOpen(undefined, { portal: data?.portal });\n\t\t\t\t}\n\t\t\t},\n\t\t\t[onOpen]\n\t\t);\n\n\t\t// Handle close\n\t\tconst handleClose = useCallback(\n\t\t\t(\n\t\t\t\tevent: MouseEvent | KeyboardEvent | undefined,\n\t\t\t\tdata: PopoverRequestCloseData\n\t\t\t) => {\n\t\t\t\tif (isOpen) {\n\t\t\t\t\tif (onRequestClose) {\n\t\t\t\t\t\tonRequestClose(event, data);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\t\t\tcurrentOpenPopover = null;\n\t\t\t\t\t}\n\n\t\t\t\t\tsetIsOpen(false);\n\t\t\t\t\tisHoverRef.current = false;\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, id, onRequestClose, setIsOpen]\n\t\t);\n\n\t\t// Latest `handleClose`, so the \"close the other open popover\" path does not call a stale\n\t\t// closure from when this popover opened (whose `isOpen` was still `false`).\n\t\tconst handleCloseRef = useRef(handleClose);\n\t\tuseEffect(() => {\n\t\t\thandleCloseRef.current = handleClose;\n\t\t}, [handleClose]);\n\n\t\t// Handle open\n\t\tconst handleOpen = useCallback(\n\t\t\t(event: MouseEvent | FocusEvent, trigger: PopoverRequestOpenTrigger) => {\n\t\t\t\tif (!isOpen && !disabled) {\n\t\t\t\t\tonRequestOpen?.(event, { trigger });\n\n\t\t\t\t\t// Close any other open popover\n\t\t\t\t\tif (currentOpenPopover && currentOpenPopover.getId() !== id) {\n\t\t\t\t\t\tcurrentOpenPopover.handleClose(undefined, {\n\t\t\t\t\t\t\ttrigger: 'newPopover',\n\t\t\t\t\t\t\tid: currentOpenPopover.getId(),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrentOpenPopover = {\n\t\t\t\t\t\thandleClose: (event, data) => handleCloseRef.current(event, data),\n\t\t\t\t\t\tgetId: () => id,\n\t\t\t\t\t};\n\n\t\t\t\t\tsetIsOpen(true);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, disabled, id, onRequestOpen, setIsOpen]\n\t\t);\n\n\t\t// Handle cancel (close button or escape)\n\t\tconst handleCancel = useCallback(\n\t\t\t(event: MouseEvent | KeyboardEvent) => {\n\t\t\t\thandleClose(event, { trigger: 'cancel' });\n\t\t\t},\n\t\t\t[handleClose]\n\t\t);\n\n\t\t// Handle click outside\n\t\tconst handleClickOutside = useCallback(\n\t\t\t(event: MouseEvent) => {\n\t\t\t\thandleClose(event, { trigger: 'clickOutside' });\n\t\t\t},\n\t\t\t[handleClose]\n\t\t);\n\n\t\t// Handle mouse enter\n\t\tconst handleMouseEnter = useCallback(\n\t\t\t(event: MouseEvent) => {\n\t\t\t\tisHoverRef.current = true;\n\n\t\t\t\tif (!isOpen && openOn === 'hover') {\n\t\t\t\t\thandleOpen(event, 'mouseEnter');\n\t\t\t\t} else {\n\t\t\t\t\tif (isClosingRef.current) {\n\t\t\t\t\t\tclearTimeout(isClosingRef.current);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (onMouseEnter) {\n\t\t\t\t\tonMouseEnter(event);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, openOn, handleOpen, onMouseEnter]\n\t\t);\n\n\t\t// Handle mouse leave\n\t\tconst handleMouseLeave = useCallback(\n\t\t\t(event: MouseEvent) => {\n\t\t\t\tif (isOpen) {\n\t\t\t\t\tisClosingRef.current = setTimeout(() => {\n\t\t\t\t\t\thandleClose(undefined, { trigger: 'mouseLeave' });\n\t\t\t\t\t}, hoverCloseDelay);\n\t\t\t\t}\n\n\t\t\t\tif (onMouseLeave) {\n\t\t\t\t\tonMouseLeave(event);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, hoverCloseDelay, handleClose, onMouseLeave]\n\t\t);\n\n\t\t// Handle click\n\t\tconst handleClick = useCallback(\n\t\t\t(event: MouseEvent, triggerOnClickCallback?: (e: MouseEvent) => void) => {\n\t\t\t\tif (!isOpen) {\n\t\t\t\t\thandleOpen(event, 'triggerClick');\n\t\t\t\t} else {\n\t\t\t\t\thandleClose(event, { trigger: 'triggerClick' });\n\t\t\t\t}\n\n\t\t\t\tif (onClick) {\n\t\t\t\t\tonClick(event);\n\t\t\t\t}\n\n\t\t\t\tif (triggerOnClickCallback) {\n\t\t\t\t\ttriggerOnClickCallback(event);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, handleOpen, handleClose, onClick]\n\t\t);\n\n\t\t// Handle focus\n\t\tconst handleFocus = useCallback(\n\t\t\t(event: FocusEvent) => {\n\t\t\t\tif (!isOpen) {\n\t\t\t\t\thandleOpen(event, 'focus');\n\t\t\t\t}\n\n\t\t\t\tif (onFocus) {\n\t\t\t\t\tonFocus(event);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, handleOpen, onFocus]\n\t\t);\n\n\t\t// Toggle from keyboard\n\t\t// `handleKeyDown` is only attached to the open dialog, so this only ever closes it (Escape).\n\t\tconst toggleOpenFromKeyboard = useCallback(\n\t\t\t(event: KeyboardEvent) => {\n\t\t\t\tif (isOpen) {\n\t\t\t\t\thandleCancel(event);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, handleCancel]\n\t\t);\n\n\t\t// Handle key down\n\t\tconst handleKeyDown = useCallback(\n\t\t\t(event: KeyboardEvent) => {\n\t\t\t\tif (event.keyCode) {\n\t\t\t\t\tif (event.keyCode !== KEYS.TAB) {\n\t\t\t\t\t\tkeyboardNavigableDialog({\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\tisOpen,\n\t\t\t\t\t\t\thandleClick: (e: MouseEvent) => handleClick(e),\n\t\t\t\t\t\t\tkeyCode: event.keyCode,\n\t\t\t\t\t\t\teventTarget: event.target,\n\t\t\t\t\t\t\t// keyboardNavigableDialog calls `toggleOpen()` without the event; pass it through\n\t\t\t\t\t\t\ttoggleOpen: () => toggleOpenFromKeyboard(event),\n\t\t\t\t\t\t\ttrigger: triggerRef.current,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif (onKeyDown) {\n\t\t\t\t\t\tonKeyDown(event);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isOpen, handleClick, toggleOpenFromKeyboard, onKeyDown]\n\t\t);\n\n\t\t// Render overlay for click-outside detection\n\t\tconst renderOverlay = useCallback(\n\t\t\t(shouldShow: boolean) => {\n\t\t\t\tif (typeof overlayProp === 'function' && documentDefined) {\n\t\t\t\t\toverlayProp(shouldShow, overlay);\n\t\t\t\t} else if (\n\t\t\t\t\toverlayProp &&\n\t\t\t\t\tshouldShow &&\n\t\t\t\t\t!overlayRef.current &&\n\t\t\t\t\tdocumentDefined\n\t\t\t\t) {\n\t\t\t\t\toverlayRef.current = overlay;\n\t\t\t\t\tdocument.querySelector('body')?.appendChild(overlay);\n\t\t\t\t} else if (!shouldShow && overlayRef.current?.parentNode) {\n\t\t\t\t\toverlayRef.current.parentNode.removeChild(overlayRef.current);\n\t\t\t\t\toverlayRef.current = null;\n\t\t\t\t}\n\t\t\t},\n\t\t\t[overlayProp]\n\t\t);\n\n\t\t// Container ref callback\n\t\tconst setContainerRef = useCallback(\n\t\t\t(component: HTMLDivElement | null) => {\n\t\t\t\t(triggerRef as React.MutableRefObject<HTMLDivElement | null>).current =\n\t\t\t\t\tcomponent;\n\t\t\t\tif (typeof ref === 'function') {\n\t\t\t\t\tref(component);\n\t\t\t\t} else if (ref) {\n\t\t\t\t\tref.current = component;\n\t\t\t\t}\n\t\t\t\tif (component && !inputRendered) {\n\t\t\t\t\tsetInputRendered(true);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[inputRendered, ref]\n\t\t);\n\n\t\t// Dialog ref callback\n\t\tconst setMenuRef = useCallback((component: HTMLElement | null) => {\n\t\t\t(dialogRef as React.MutableRefObject<HTMLElement | null>).current =\n\t\t\t\tcomponent;\n\t\t}, []);\n\n\t\t// Cleanup on unmount\n\t\tuseEffect(() => {\n\t\t\treturn () => {\n\t\t\t\tisUnmountingRef.current = true;\n\t\t\t\tif (currentOpenPopover?.getId() === id) {\n\t\t\t\t\tcurrentOpenPopover = null;\n\t\t\t\t}\n\t\t\t\trenderOverlay(false);\n\t\t\t};\n\t\t}, [id, renderOverlay]);\n\n\t\t// Update overlay when isOpen changes\n\t\tuseEffect(() => {\n\t\t\trenderOverlay(isOpen);\n\t\t}, [isOpen, renderOverlay]);\n\n\t\t// Render header\n\t\tconst renderHeader = () => {\n\t\t\tconst hasThemedHeader = variant === 'error' || variant === 'warning';\n\t\t\tconst hasDefinedHeader = heading || hasThemedHeader;\n\n\t\t\tif (\n\t\t\t\t!hasDefinedHeader ||\n\t\t\t\tvariant === 'walkthrough-action' ||\n\t\t\t\tvariant === 'feature'\n\t\t\t) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst headerIcon = {\n\t\t\t\terror: <Icon category=\"utility\" name=\"error\" size=\"x-small\" inverse />,\n\t\t\t\twarning: (\n\t\t\t\t\t<Icon category=\"utility\" name=\"warning\" size=\"x-small\" inverse />\n\t\t\t\t),\n\t\t\t};\n\n\t\t\tif (hasThemedHeader) {\n\t\t\t\treturn (\n\t\t\t\t\t<header className=\"slds-popover__header\">\n\t\t\t\t\t\t<MediaObject\n\t\t\t\t\t\t\tbody={\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-truncate slds-text-heading_medium\"\n\t\t\t\t\t\t\t\t\ttitle={typeof heading === 'string' ? heading : undefined}\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\tfigure={headerIcon[variant as 'error' | 'warning']}\n\t\t\t\t\t\t\tverticalCenter\n\t\t\t\t\t\t/>\n\t\t\t\t\t</header>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<header\n\t\t\t\t\tclassName={classNames('slds-popover__header', {\n\t\t\t\t\t\t'slds-p-vertical_medium': variant === 'walkthrough',\n\t\t\t\t\t})}\n\t\t\t\t>\n\t\t\t\t\t<h2\n\t\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\t\tclassName={classNames({\n\t\t\t\t\t\t\t'slds-text-heading_small': variant !== 'walkthrough',\n\t\t\t\t\t\t\t'slds-text-heading_medium': variant === 'walkthrough',\n\t\t\t\t\t\t})}\n\t\t\t\t\t>\n\t\t\t\t\t\t{heading}\n\t\t\t\t\t</h2>\n\t\t\t\t</header>\n\t\t\t);\n\t\t};\n\n\t\t// Render body\n\t\tconst renderBody = () => {\n\t\t\tif (variant === 'error' || variant === 'warning') {\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-popover__body',\n\t\t\t\t\t\t\tclassNameBody as string\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{body}\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (variant === 'walkthrough-action' || variant === 'feature') {\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-popover__body',\n\t\t\t\t\t\t\tclassNameBody as string\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tid={`${id}-dialog-body`}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"slds-media\">\n\t\t\t\t\t\t\t<div className=\"slds-media__figure\">\n\t\t\t\t\t\t\t\t{variant === 'walkthrough-action' ? (\n\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\t\t\t\tname=\"touch_action\"\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tinverse\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\ticon\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"slds-media__body\">\n\t\t\t\t\t\t\t\t{heading && (\n\t\t\t\t\t\t\t\t\t<h2\n\t\t\t\t\t\t\t\t\t\tid={ariaLabelledby || `${id}-dialog-heading`}\n\t\t\t\t\t\t\t\t\t\tclassName=\"slds-text-heading_small\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{heading}\n\t\t\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{body}\n\t\t\t\t\t\t\t\t{stepText && (\n\t\t\t\t\t\t\t\t\t<p className=\"slds-m-top_medium slds-text-title\">\n\t\t\t\t\t\t\t\t\t\t{stepText}\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\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\t// Render footer\n\t\tconst renderFooter = () => {\n\t\t\tconst footerClassNames = classNames(\n\t\t\t\t'slds-popover__footer',\n\t\t\t\tfooterClassName,\n\t\t\t\tclassNameFooter\n\t\t\t);\n\t\t\tconst footerStyles =\n\t\t\t\tfooterStyle || styleFooter\n\t\t\t\t\t? { ...footerStyle, ...styleFooter }\n\t\t\t\t\t: undefined;\n\n\t\t\tif (footer) {\n\t\t\t\treturn (\n\t\t\t\t\t<footer className={footerClassNames} style={footerStyles}>\n\t\t\t\t\t\t{footer}\n\t\t\t\t\t</footer>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tvariant !== 'walkthrough-action' &&\n\t\t\t\t(footerWalkthroughActions || stepText)\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\t<footer className={footerClassNames} style={footerStyles}>\n\t\t\t\t\t\t<div className=\"slds-grid slds-grid_vertical-align-center\">\n\t\t\t\t\t\t\t{stepText && <span className=\"slds-text-title\">{stepText}</span>}\n\t\t\t\t\t\t\t{footerWalkthroughActions && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName=\"slds-col_bump-left\"\n\t\t\t\t\t\t\t\t\tstyle={{ display: 'inline-block' }}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{footerWalkthroughActions}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</footer>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn null;\n\t\t};\n\n\t\t// Render dialog\n\t\tconst renderDialog = () => {\n\t\t\tif (!isOpen) return null;\n\n\t\t\tconst outsideClickIgnoreClass = `ignore-click-${id}`;\n\n\t\t\treturn (\n\t\t\t\t<Dialog\n\t\t\t\t\thasNubbin={!hasNoNubbin}\n\t\t\t\t\talign={align}\n\t\t\t\t\tcontentsClassName={classNames(\n\t\t\t\t\t\tcontentsClassName,\n\t\t\t\t\t\t'ignore-react-onclickoutside',\n\t\t\t\t\t\t'slds-popover',\n\t\t\t\t\t\t{ 'slds-popover_error': variant === 'error' },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'slds-popover_walkthrough':\n\t\t\t\t\t\t\t\tvariant === 'walkthrough' ||\n\t\t\t\t\t\t\t\tvariant === 'walkthrough-action' ||\n\t\t\t\t\t\t\t\tvariant === 'feature',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'slds-popover_walkthrough-alt': variant === 'walkthrough-action',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ 'slds-popover_feature': variant === 'feature' },\n\t\t\t\t\t\t{ 'slds-popover_warning': variant === 'warning' },\n\t\t\t\t\t\tclassNameDialog\n\t\t\t\t\t)}\n\t\t\t\t\tcontext={context}\n\t\t\t\t\thasStaticAlignment={hasStaticAlignment}\n\t\t\t\t\toffset={offset}\n\t\t\t\t\tonClose={handleDialogClose}\n\t\t\t\t\tonOpen={handleDialogOpen}\n\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\tonMouseEnter={openOn === 'hover' ? handleMouseEnter : undefined}\n\t\t\t\t\tonMouseLeave={openOn === 'hover' ? handleMouseLeave : undefined}\n\t\t\t\t\toutsideClickIgnoreClass={outsideClickIgnoreClass}\n\t\t\t\t\tonRequestTargetElement={getTargetElement}\n\t\t\t\t\tposition={position}\n\t\t\t\t\tstyle={styleDialog}\n\t\t\t\t\tvariant=\"popover\"\n\t\t\t\t\tref={setMenuRef}\n\t\t\t\t\tcontainerProps={{\n\t\t\t\t\t\tid: `${id}-popover`,\n\t\t\t\t\t\t'aria-labelledby': ariaLabelledby || `${id}-dialog-heading`,\n\t\t\t\t\t\t'aria-describedby': `${id}-dialog-body`,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{!hasNoCloseButton && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tassistiveText={{ icon: finalCloseButtonAssistiveText }}\n\t\t\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\t\t\ticonName=\"close\"\n\t\t\t\t\t\t\tclassName={classNames(\n\t\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\t{\n\t\t\t\t\t\t\t\t\t'slds-button_icon-inverse':\n\t\t\t\t\t\t\t\t\t\tvariant === 'walkthrough' ||\n\t\t\t\t\t\t\t\t\t\tvariant === 'walkthrough-action' ||\n\t\t\t\t\t\t\t\t\t\tvariant === 'feature',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tonClick={handleCancel}\n\t\t\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t\t\t\tinverse={variant === 'error' || variant === 'warning'}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{renderHeader()}\n\t\t\t\t\t{renderBody()}\n\t\t\t\t\t{renderFooter()}\n\t\t\t\t</Dialog>\n\t\t\t);\n\t\t};\n\n\t\t// Clone trigger element\n\t\tconst otherChildren: ReactNode[] = [];\n\t\tlet clonedTrigger: ReactNode = null;\n\n\t\tReact.Children.forEach(children, (child, index) => {\n\t\t\tif (index === 0 && React.isValidElement(child)) {\n\t\t\t\tconst childProps = child.props as Record<string, unknown>;\n\t\t\t\tconst triggerProps: Record<string, unknown> = {\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(\n\t\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t\t\tchildProps.onClick as (e: MouseEvent) => void\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: childProps.onClick,\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\ttabIndex: (childProps.tabIndex as number) || 0,\n\t\t\t\t};\n\t\t\t\tclonedTrigger = React.cloneElement(child, triggerProps);\n\t\t\t} else if (child) {\n\t\t\t\totherChildren.push(child);\n\t\t\t}\n\t\t});\n\n\t\tconst containerStyles: CSSProperties = {\n\t\t\tdisplay: hasNoTriggerStyles ? undefined : 'inline-block',\n\t\t\t...style,\n\t\t};\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames(triggerClassName, className) || undefined}\n\t\t\t\tstyle={containerStyles}\n\t\t\t\tref={setContainerRef}\n\t\t\t>\n\t\t\t\t{clonedTrigger}\n\t\t\t\t{otherChildren.length > 0 ? otherChildren : null}\n\t\t\t\t{renderDialog()}\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nPopover.displayName = POPOVER;\n\nexport default Popover;\n"],"mappings":"4sBAiCA,IAAM,EAAkB,OAAO,SAAa,IAGtC,EAAU,EACb,SAAS,cAAc,MAAM,EAC5B,CAAE,MAAO,CAAC,CAAE,EACZ,IACH,EAAQ,MAAM,IAAM,IACpB,EAAQ,MAAM,KAAO,IACrB,EAAQ,MAAM,MAAQ,OACtB,EAAQ,MAAM,OAAS,OACvB,EAAQ,MAAM,SAAW,YAI1B,IAAI,EAMO,KA0NE,GAAyB,CACrC,WACA,MACA,YACA,cACA,SACA,cACD,EAEM,GAA6C,CAClD,YAAa,cACd,EAOM,GAAA,EAAU,EAAA,WAAA,EAEd,CACC,QAAQ,QACR,cAAe,GACf,iBACA,YACA,OACA,gBACA,mBACA,kBACA,aACA,mBACA,oBACA,WAAW,GACX,SACA,cACA,2BACA,oBAAmB,GACnB,eAAc,GACd,sBAAqB,GACrB,sBAAqB,GACrB,UACA,QACA,GAAI,GACJ,OAAQ,GACR,iBAAgB,GAChB,UACA,UACA,UACA,UACA,YACA,eACA,eACA,eACA,SACA,gBACA,iBACA,yBACA,SAAS,QACT,QAAS,EACT,YAAW,WACX,WACA,SACA,eACA,cACA,mBACA,UAAU,OACV,kBAAkB,IAClB,6BAED,IACI,EAGJ,EAAA,EAAA,UAAA,KAAgB,CACf,GAAA,QAAA,IAAA,WAA6B,aAAc,CAC1C,IAAM,EAAe,GAAA,QAAkB,GAAA,OAAY,EAOnD,CALC,CAAC,oBAAqB,EAAmB,iBAAiB,EAC1D,CAAC,kBAAmB,EAAiB,iBAAiB,EACtD,CAAC,cAAe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CACD,EAEA,EAAQ,YAAc,EAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
require("../../utilities/warning/sunset-property.cjs")
|
|
1
|
+
const e=require("../../utilities/warning/sunset-property.cjs"),t=require("../../utilities/get-component-doc.cjs"),n=require("../../utilities/warning/deprecated-property.cjs");process.env.NODE_ENV;var r=function(){};process.env.NODE_ENV!==`production`&&(r=function(r,i,a){let o=t.default(a);e.default(r,i.defaultChecked,`defaultChecked`,"Radio is controlled: pass `checked` and update it in `onChange`, or pass `value` to the RadioGroup/RadioButtonGroup."),n.default(r,i.onRenderVisualPicker,`onRenderVisualPicker`,`visualPickerFigure`,o(`visualPickerFigure`)),n.default(r,i.onRenderVisualPickerSelected,`onRenderVisualPickerSelected`,`visualPickerFigureSelected`,o(`visualPickerFigureSelected`)),n.default(r,i.onRenderVisualPickerNotSelected,`onRenderVisualPickerNotSelected`,`visualPickerFigureNotSelected`,o(`visualPickerFigureNotSelected`))}),Object.defineProperty(exports,"checkDeprecatedProps",{enumerable:!0,get:function(){return r}});
|
|
2
2
|
//# sourceMappingURL=check-props.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-props.cjs","names":[],"sources":["../../../../components/radio/check-props.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n/* eslint-disable import/no-mutable-exports */\n/* eslint-disable max-len */\n\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport getComponentDocFn from '../../utilities/get-component-doc';\nimport sunsetProperty from '../../utilities/warning/sunset-property';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\n\t\tsunsetProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.label,\n\t\t\t'label',\n\t\t\t`Use \\`labels.label\\` instead.${createDocUrl('labels')}`\n\t\t);\n\t};\n}\n\n//
|
|
1
|
+
{"version":3,"file":"check-props.cjs","names":[],"sources":["../../../../components/radio/check-props.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n/* eslint-disable import/no-mutable-exports */\n/* eslint-disable max-len */\n\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport getComponentDocFn from '../../utilities/get-component-doc';\nimport sunsetProperty from '../../utilities/warning/sunset-property';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\n\t\tsunsetProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.label,\n\t\t\t'label',\n\t\t\t`Use \\`labels.label\\` instead.${createDocUrl('labels')}`\n\t\t);\n\t};\n}\n\n// v11 control-model removals and deprecated visual-picker render props.\n// Exported separately so the component can run these checks without enabling\n// the pre-existing `checkProps` warnings.\nexport let checkDeprecatedProps = function checkDeprecatedPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckDeprecatedProps = function checkDeprecatedPropsFunction(\n\t\tCOMPONENT,\n\t\tprops,\n\t\tjsonDoc\n\t) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\n\t\tsunsetProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.defaultChecked,\n\t\t\t'defaultChecked',\n\t\t\t'Radio is controlled: pass `checked` and update it in `onChange`, or pass `value` to the RadioGroup/RadioButtonGroup.'\n\t\t);\n\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onRenderVisualPicker,\n\t\t\t'onRenderVisualPicker',\n\t\t\t'visualPickerFigure',\n\t\t\tcreateDocUrl('visualPickerFigure')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onRenderVisualPickerSelected,\n\t\t\t'onRenderVisualPickerSelected',\n\t\t\t'visualPickerFigureSelected',\n\t\t\tcreateDocUrl('visualPickerFigureSelected')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onRenderVisualPickerNotSelected,\n\t\t\t'onRenderVisualPickerNotSelected',\n\t\t\t'visualPickerFigureNotSelected',\n\t\t\tcreateDocUrl('visualPickerFigureNotSelected')\n\t\t);\n\t};\n}\n\nexport default checkProps;\n"],"mappings":"+KAWA,QAAA,IAAA,SAgBA,IAAW,EAAuB,UAAwC,CAAC,EAE3E,QAAA,IAAA,WAA6B,eAC5B,EAAuB,SACtB,EACA,EACA,EACC,CACD,IAAM,EAAe,EAAA,QAAkB,CAAO,EAE9C,EAAA,QACC,EACA,EAAM,eACN,iBACA,sHACD,EAEA,EAAA,QACC,EACA,EAAM,qBACN,uBACA,qBACA,EAAa,oBAAoB,CAClC,EACA,EAAA,QACC,EACA,EAAM,6BACN,+BACA,6BACA,EAAa,4BAA4B,CAC1C,EACA,EAAA,QACC,EACA,EAAM,gCACN,kCACA,gCACA,EAAa,+BAA+B,CAC7C,CACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../../utilities/key-code.cjs"),r=require("../icon/index.cjs"),i=require("../../utilities/get-aria-props.cjs"),a=require("../../utilities/get-data-props.cjs"),o=require("../color-picker/private/swatch.cjs"),s=require("./check-props.cjs"),c=require("./component.cjs");let l=require("react");l=e.__toESM(l,1);let u=require("classnames");u=e.__toESM(u,1);let d=require("react/jsx-runtime");var f={},p={},m=({assistiveText:e,"aria-describedby":m,"aria-labelledby":h,checked:g,className:_,defaultChecked:v,deselectable:y,disabled:b,id:
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../../utilities/key-code.cjs"),r=require("../icon/index.cjs"),i=require("../../utilities/get-aria-props.cjs"),a=require("../../utilities/get-data-props.cjs"),o=require("../color-picker/private/swatch.cjs"),s=require("./check-props.cjs"),c=require("./component.cjs");let l=require("react");l=e.__toESM(l,1);let u=require("classnames");u=e.__toESM(u,1);let d=require("react/jsx-runtime");var f={},p={},m=({assistiveText:e,"aria-describedby":m,"aria-labelledby":h,checked:g,className:_,defaultChecked:v,deselectable:y,disabled:b,id:x,labelId:S,labels:C,label:w,name:ee,onChange:T,onFocus:E,onRequestFocus:D,requestFocus:O,tabIndex:k,value:A,variant:j=`base`,coverable:M=!1,vertical:N,visualPickerFigure:P,visualPickerFigureSelected:F,visualPickerFigureNotSelected:I,onRenderVisualPicker:L,onRenderVisualPickerSelected:R,onRenderVisualPickerNotSelected:z,size:B,refs:V,style:H,...U})=>{let W=(0,l.useId)(),G=(0,l.useRef)(!1),K=x||W,q={...f,...e},J={...p,...w?{label:w}:{},...C};(0,l.useEffect)(()=>{s.checkDeprecatedProps(t.RADIO,{defaultChecked:v,onRenderVisualPicker:L,onRenderVisualPickerSelected:R,onRenderVisualPickerNotSelected:z},c.default)},[v,L,R,z]);let Y=i.default(U),X=a.default(U),Z=(0,l.useCallback)((e,t)=>{G.current?G.current=!1:(G.current=!!t,T?.(e,{checked:!g}))},[g,T]),Q=(0,l.useCallback)(e=>{V?.input?.(e),e&&O&&D&&D(e)},[V,O,D]),$;return $=j===`swatch`?(0,d.jsx)(`label`,{style:{border:`1px`},className:`slds-radio_button__label`,htmlFor:K,children:(0,d.jsx)(`span`,{children:(0,d.jsx)(o.default,{label:J.label,style:H,color:A??``})})}):j===`button-group`?(0,d.jsx)(`label`,{className:`slds-radio_button__label`,htmlFor:K,children:(0,d.jsx)(`span`,{className:`slds-radio_faux`,children:J.label})}):j===`visual-picker`?(0,d.jsxs)(`label`,{htmlFor:K,children:[M?(0,d.jsxs)(`div`,{className:`slds-visual-picker__figure slds-visual-picker__icon slds-align_absolute-center`,children:[(0,d.jsx)(`span`,{className:`slds-is-selected`,children:F??R?.()}),(0,d.jsx)(`span`,{className:`slds-is-not-selected`,children:I??z?.()})]}):(0,d.jsx)(`span`,{className:`slds-visual-picker__figure slds-visual-picker__text slds-align_absolute-center`,children:P??L?.()}),!N&&(0,d.jsxs)(`span`,{className:`slds-visual-picker__body`,children:[J.heading&&(0,d.jsx)(`span`,{className:`slds-text-heading_small`,children:J.heading}),(0,d.jsx)(`span`,{className:`slds-text-title`,children:J.label})]}),!M&&(0,d.jsx)(`span`,{className:`slds-icon_container slds-visual-picker__text-check`,children:(0,d.jsx)(r.default,{assistiveText:q,category:`utility`,name:`check`,colorVariant:`base`,size:`x-small`})})]}):(0,d.jsxs)(`label`,{className:`slds-radio__label`,htmlFor:K,id:S,children:[(0,d.jsx)(`span`,{className:`slds-radio_faux`}),(0,d.jsx)(`span`,{className:`slds-form-element__label`,children:J.label}),q.label&&(0,d.jsx)(`span`,{className:`slds-assistive-text`,children:q.label})]}),(0,d.jsxs)(`span`,{className:(0,u.default)(j===`visual-picker`?`slds-visual-picker_${B}`:null,{"slds-radio":j===`base`||j===`swatch`,"slds-button slds-radio_button":j===`button-group`,"slds-visual-picker":j===`visual-picker`,"slds-visual-picker_vertical":j===`visual-picker`&&N},_),children:[(0,d.jsx)(`input`,{type:`radio`,id:K,name:ee,value:A,checked:!!g,onFocus:E,onChange:e=>Z(e),onClick:e=>{g&&y&&Z(e)},onKeyPress:e=>{let{charCode:t}=e;t===n.default.SPACE&&g&&y?Z(e,!0):(t===n.default.ENTER&&g&&y||!g)&&Z(e)},disabled:b,tabIndex:k?parseInt(k,10):void 0,"aria-describedby":m,"aria-labelledby":h,...Y,...X,ref:Q}),$]})};m.displayName=t.RADIO,exports.default=m;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","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 * Props for the Radio component\n */\nexport interface RadioProps {\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/** Whether radio is checked (controlled) */\n\tchecked?: boolean;\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Default checked state (uncontrolled) */\n\tdefaultChecked?: 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/** @deprecated Use labels.label instead */\n\tlabel?: string;\n\t/** Input name attribute */\n\tname?: string;\n\t/** Change handler */\n\tonChange?: (\n\t\tevent: ChangeEvent<HTMLInputElement> | KeyboardEvent<HTMLInputElement>,\n\t\tdata: { checked: boolean }\n\t) => void;\n\t/** Focus handler */\n\tonFocus?: (event: FocusEvent<HTMLInputElement>) => void;\n\t/** Request focus callback */\n\tonRequestFocus?: (input: HTMLInputElement) => void;\n\t/** Whether to request focus */\n\trequestFocus?: boolean;\n\t/** Tab index */\n\ttabIndex?: string;\n\t/** Input value */\n\tvalue?: string;\n\t/** Radio variant */\n\tvariant?: RadioVariant;\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: description text */\n\tdescription?: string;\n\t/** Visual picker: size */\n\tsize?: RadioSize;\n\t/** Ref callbacks */\n\trefs?: RadioRefs;\n\t/** Custom styles (for swatch variant) */\n\tstyle?: CSSProperties;\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 = ({\n\tassistiveText: propAssistiveText,\n\t'aria-describedby': ariaDescribedBy,\n\t'aria-labelledby': ariaLabelledBy,\n\tchecked,\n\tclassName,\n\tdefaultChecked,\n\tdeselectable,\n\tdisabled,\n\tid: propId,\n\tlabelId,\n\tlabels: propLabels,\n\tlabel: deprecatedLabel,\n\tname,\n\tonChange,\n\tonFocus,\n\tonRequestFocus,\n\trequestFocus,\n\ttabIndex,\n\tvalue,\n\tvariant = 'base',\n\tcoverable = false,\n\tvertical,\n\tvisualPickerFigure,\n\tvisualPickerFigureSelected,\n\tvisualPickerFigureNotSelected,\n\tonRenderVisualPicker,\n\tonRenderVisualPickerSelected,\n\tonRenderVisualPickerNotSelected,\n\tsize,\n\trefs,\n\tstyle,\n\t...rest\n}: RadioProps): React.ReactElement => {\n\tconst generatedId = useId();\n\tconst preventDuplicateRef = useRef(false);\n\n\tconst id = propId || generatedId;\n\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\tconst labels = {\n\t\t...defaultLabels,\n\t\t...(deprecatedLabel ? { label: deprecatedLabel } : {}),\n\t\t...propLabels,\n\t};\n\n\tuseEffect(() => {\n\t\tcheckDeprecatedProps(\n\t\t\tRADIO,\n\t\t\t{\n\t\t\t\tonRenderVisualPicker,\n\t\t\t\tonRenderVisualPickerSelected,\n\t\t\t\tonRenderVisualPickerNotSelected,\n\t\t\t},\n\t\t\tcomponentDoc\n\t\t);\n\t}, [\n\t\tonRenderVisualPicker,\n\t\tonRenderVisualPickerSelected,\n\t\tonRenderVisualPickerNotSelected,\n\t]);\n\n\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\t{...(checked !== undefined ? { checked } : { defaultChecked })}\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\tonKeyPress={(event) => {\n\t\t\t\t\tconst { charCode } = event;\n\t\t\t\t\tif (charCode === 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(charCode === KEYS.ENTER && checked && deselectable) ||\n\t\t\t\t\t\t!checked\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 ? parseInt(tabIndex, 10) : undefined}\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":"+kBAgIA,IAAM,EAA2C,CAAC,EAC5C,EAA6B,CAAC,EAM9B,GAAS,CACd,cAAe,EACf,mBAAoB,EACpB,kBAAmB,EACnB,UACA,YACA,iBACA,eACA,WACA,GAAI,GACJ,UACA,OAAQ,EACR,MAAO,EACP,OACA,WACA,UACA,iBACA,eACA,WACA,QACA,UAAU,OACV,YAAY,GACZ,WACA,qBACA,6BACA,gCACA,uBACA,+BACA,kCACA,OAC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EAAA,EAAA,KAAA,CAAC,OAAD,CACC,WAAA,EAAW,EAAA,QAAA,CACV,IAAY,gBAAkB,sBAAsB,IAAS,KAC7D,CACC,aAAc,IAAY,QAAU,IAAY,SAChD,gCAAiC,IAAY,eAC7C,qBAAsB,IAAY,gBAClC,8BACC,IAAY,iBAAmB,CACjC,EACA,CACD,EAXD,SAAA,EAaC,EAAA,EAAA,IAAA,CAAC,QAAD,CACC,KAAK,QACD,KACE,OACC,QACP,GAAK,IAAY,IAAA,GAA0B,CAAE,gBAAe,EAA/B,CAAE,SAAQ,EAC9B,UACT,SAAW,GAAU,EAAa,CAAK,EACvC,QAAU,GAAU,CACf,GAAW,GACd,EAAa,CAAiD,CAEhE,EACA,WAAa,GAAU,CACtB,GAAM,CAAE,YAAa,EACjB,IAAa,EAAA,QAAK,OAAS,GAAW,EACzC,EAAa,EAAO,EAAI,GAEvB,IAAa,EAAA,QAAK,OAAS,GAAW,GACvC,CAAC,IAED,EAAa,CAAK,CAEpB,EACU,WACV,SAAU,EAAW,SAAS,EAAU,EAAE,EAAI,IAAA,GAC9C,mBAAkB,EAClB,kBAAiB,EACjB,GAAI,EACJ,GAAI,EACJ,IAAK,CACL,CAAA,EACA,CACI,GAER,EAEA,EAAM,YAAc,EAAA"}
|
|
1
|
+
{"version":3,"file":"index.cjs","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 */\nexport interface RadioProps {\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/** @deprecated Use labels.label instead */\n\tlabel?: string;\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/** Request focus callback */\n\tonRequestFocus?: (input: HTMLInputElement) => void;\n\t/** Whether to request focus */\n\trequestFocus?: boolean;\n\t/** Tab index */\n\ttabIndex?: string;\n\t/** Input value */\n\tvalue?: string;\n\t/** Radio variant */\n\tvariant?: RadioVariant;\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: description text */\n\tdescription?: string;\n\t/** Visual picker: size */\n\tsize?: RadioSize;\n\t/** Ref callbacks */\n\trefs?: RadioRefs;\n\t/** Custom styles (for swatch variant) */\n\tstyle?: CSSProperties;\n}\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 interface RadioGroupItemProps extends Omit<\n\tRadioProps,\n\t'checked' | 'onChange'\n> {\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 = ({\n\tassistiveText: propAssistiveText,\n\t'aria-describedby': ariaDescribedBy,\n\t'aria-labelledby': ariaLabelledBy,\n\tchecked,\n\tclassName,\n\t// Removed in v11 (Radio is controlled). Destructured so it never reaches\n\t// the DOM; `checkDeprecatedProps` warns about it.\n\tdefaultChecked,\n\tdeselectable,\n\tdisabled,\n\tid: propId,\n\tlabelId,\n\tlabels: propLabels,\n\tlabel: deprecatedLabel,\n\tname,\n\tonChange,\n\tonFocus,\n\tonRequestFocus,\n\trequestFocus,\n\ttabIndex,\n\tvalue,\n\tvariant = 'base',\n\tcoverable = false,\n\tvertical,\n\tvisualPickerFigure,\n\tvisualPickerFigureSelected,\n\tvisualPickerFigureNotSelected,\n\tonRenderVisualPicker,\n\tonRenderVisualPickerSelected,\n\tonRenderVisualPickerNotSelected,\n\tsize,\n\trefs,\n\tstyle,\n\t...rest\n}: RadioProps & { defaultChecked?: boolean }): React.ReactElement => {\n\tconst generatedId = useId();\n\tconst preventDuplicateRef = useRef(false);\n\n\tconst id = propId || generatedId;\n\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\tconst labels = {\n\t\t...defaultLabels,\n\t\t...(deprecatedLabel ? { label: deprecatedLabel } : {}),\n\t\t...propLabels,\n\t};\n\n\tuseEffect(() => {\n\t\tcheckDeprecatedProps(\n\t\t\tRADIO,\n\t\t\t{\n\t\t\t\tdefaultChecked,\n\t\t\t\tonRenderVisualPicker,\n\t\t\t\tonRenderVisualPickerSelected,\n\t\t\t\tonRenderVisualPickerNotSelected,\n\t\t\t},\n\t\t\tcomponentDoc\n\t\t);\n\t}, [\n\t\tdefaultChecked,\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\tonKeyPress={(event) => {\n\t\t\t\t\tconst { charCode } = event;\n\t\t\t\t\tif (charCode === 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(charCode === KEYS.ENTER && checked && deselectable) ||\n\t\t\t\t\t\t!checked\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 ? parseInt(tabIndex, 10) : undefined}\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":"+kBAuKA,IAAM,EAA2C,CAAC,EAC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AAA,EACC,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,iBAAmB,CAAA,GACnC,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,2BAA4B,SAAA,EAAO,KAAY,CAAA,EAC9D,EAAc,QACd,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,sBAAuB,SAAA,EAAc,KAAY,CAAA,CAE5D,KAKR,EAAA,EAAA,KAAA,CAAC,OAAD,CACC,WAAA,EAAW,EAAA,QAAA,CACV,IAAY,gBAAkB,sBAAsB,IAAS,KAC7D,CACC,aAAc,IAAY,QAAU,IAAY,SAChD,gCAAiC,IAAY,eAC7C,qBAAsB,IAAY,gBAClC,8BACC,IAAY,iBAAmB,CACjC,EACA,CACD,EAXD,SAAA,EAaC,EAAA,EAAA,IAAA,CAAC,QAAD,CACC,KAAK,QACD,KACE,QACC,QACP,QAAS,CAAC,CAAC,EACF,UACT,SAAW,GAAU,EAAa,CAAK,EACvC,QAAU,GAAU,CACf,GAAW,GACd,EAAa,CAAiD,CAEhE,EACA,WAAa,GAAU,CACtB,GAAM,CAAE,YAAa,EACjB,IAAa,EAAA,QAAK,OAAS,GAAW,EACzC,EAAa,EAAO,EAAI,GAEvB,IAAa,EAAA,QAAK,OAAS,GAAW,GACvC,CAAC,IAED,EAAa,CAAK,CAEpB,EACU,WACV,SAAU,EAAW,SAAS,EAAU,EAAE,EAAI,IAAA,GAC9C,mBAAkB,EAClB,kBAAiB,EACjB,GAAI,EACJ,GAAI,EACJ,IAAK,CACL,CAAA,EACA,CACI,GAER,EAEA,EAAM,YAAc,EAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/radio-button-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, { type ReactNode, type CSSProperties
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/radio-button-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, { type ReactNode, type CSSProperties } from 'react';\nimport RadioGroup, { type RadioGroupChangeProps } from '../radio-group';\nimport { RADIO_BUTTON_GROUP } from '../../utilities/constants';\n\n/**\n * Assistive text for RadioButtonGroup\n */\nexport interface RadioButtonGroupAssistiveText {\n\t/** Label for the group */\n\tlabel?: string;\n\t/** Text for required indicator */\n\trequired?: string;\n}\n\n/**\n * Labels for RadioButtonGroup\n */\nexport interface RadioButtonGroupLabels {\n\t/** Error message to display */\n\terror?: string;\n\t/** Label above the button group */\n\tlabel?: string;\n}\n\ninterface RadioButtonGroupBaseProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: RadioButtonGroupAssistiveText;\n\t/**\n\t * `Radio` components (from `radio-button-group/radio`) as children. The\n\t * group injects `name`, `onChange`, `aria-describedby`, `disabled` and,\n\t * when `value` is set, `checked`.\n\t */\n\tchildren: ReactNode;\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?: RadioButtonGroupLabels;\n\t/** Name attribute for all radios */\n\tname?: string;\n\t/** Whether the field is required */\n\trequired?: boolean;\n\t/** Custom styles */\n\tstyle?: CSSProperties;\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/**\n * Props for the RadioButtonGroup component. The group is controlled, so\n * `onChange` is required unless the group is `disabled`.\n */\nexport type RadioButtonGroupProps = RadioButtonGroupBaseProps &\n\tRadioGroupChangeProps;\n\n/**\n * A styled select list that can have a single entry checked at any one time.\n * The RadioButtonGroup component wraps Radio components, which should be used as children.\n * This is a convenience wrapper around RadioGroup with variant=\"button-group\".\n */\nconst RadioButtonGroup = ({\n\tlabels = {},\n\tassistiveText = {},\n\t...rest\n}: RadioButtonGroupProps): React.ReactElement => {\n\treturn (\n\t\t<RadioGroup\n\t\t\tvariant=\"button-group\"\n\t\t\tlabels={labels}\n\t\t\tassistiveText={assistiveText}\n\t\t\t{...rest}\n\t\t/>\n\t);\n};\n\nRadioButtonGroup.displayName = RADIO_BUTTON_GROUP;\n\nexport default RadioButtonGroup;\n"],"mappings":"mTAuEA,IAAM,GAAoB,CACzB,SAAS,CAAC,EACV,gBAAgB,CAAC,EACjB,GAAG,MAGF,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACC,QAAQ,eACA,SACO,gBACf,GAAI,CACJ,CAAA,EAIH,EAAiB,YAAc,EAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.cjs","names":[],"sources":["../../../../components/radio-button-group/radio.ts"],"sourcesContent":["// Alias\nimport Radio from '../radio/index';\n\nexport default
|
|
1
|
+
{"version":3,"file":"radio.cjs","names":[],"sources":["../../../../components/radio-button-group/radio.ts"],"sourcesContent":["// Alias of `Radio`, typed for use as a group child: the group derives\n// `checked` from its `value` and injects `onChange`.\nimport type { ReactElement } from 'react';\nimport Radio, { type RadioGroupItemProps } from '../radio/index';\n\nconst GroupRadio = Radio as unknown as ((\n\tprops: RadioGroupItemProps\n) => ReactElement) & { displayName?: string };\n\nexport type { RadioGroupItemProps };\n\nexport default GroupRadio;\n"],"mappings":"AAKA,IAAM,8BAAa,CAAA,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("../../utilities/get-component-doc.cjs"),t=require("../../utilities/warning/deprecated-property.cjs"),n=require("../../utilities/warning/required-property.cjs");var r=function(){};process.env.NODE_ENV!==`production`&&(r=function(r,i,a){let o=e.default(a);t.default(r,i.value===void 0||void 0,`checked`,void 0,`Pass \`value\` to RadioGroup or RadioButtonGroup instead of \`checked\` on each Radio, and read \`data.value\` in \`onChange\`. ${o(`value`)}`),n.default(r,i.onChange!==void 0||!!i.disabled,`onChange`,`RadioGroup and RadioButtonGroup are controlled: without \`onChange\`, selecting a radio does nothing. Update \`value\` from \`data.value\` in \`onChange\`, or set \`disabled\`. ${o(`onChange`)}`)});var i=r;exports.default=i;
|
|
2
|
+
//# sourceMappingURL=check-props.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-props.cjs","names":[],"sources":["../../../../components/radio-group/check-props.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n/* eslint-disable import/no-mutable-exports */\n\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport getComponentDocFn from '../../utilities/get-component-doc';\nimport requiredProperty from '../../utilities/warning/required-property';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\n\t\t// Without a group `value`, selection falls back to `checked` on each\n\t\t// child Radio. That still works in v11 but is deprecated.\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.value === undefined ? true : undefined,\n\t\t\t'checked',\n\t\t\tundefined,\n\t\t\t`Pass \\`value\\` to RadioGroup or RadioButtonGroup instead of \\`checked\\` on each Radio, and read \\`data.value\\` in \\`onChange\\`. ${createDocUrl(\n\t\t\t\t'value'\n\t\t\t)}`\n\t\t);\n\n\t\t// React's own \"`checked` without `onChange`\" warning never fires,\n\t\t// because the group always attaches its own change handler.\n\t\trequiredProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onChange !== undefined || !!props.disabled,\n\t\t\t'onChange',\n\t\t\t`RadioGroup and RadioButtonGroup are controlled: without \\`onChange\\`, selecting a radio does nothing. Update \\`value\\` from \\`data.value\\` in \\`onChange\\`, or set \\`disabled\\`. ${createDocUrl(\n\t\t\t\t'onChange'\n\t\t\t)}`\n\t\t);\n\t};\n}\n\nexport default checkProps;\n"],"mappings":"iLAQA,IAAI,EAAa,UAA8B,CAAC,EAEhD,QAAA,IAAA,WAA6B,eAC5B,EAAa,SAA4B,EAAW,EAAO,EAAS,CACnE,IAAM,EAAe,EAAA,QAAkB,CAAO,EAI9C,EAAA,QACC,EACA,EAAM,QAAU,IAAA,IAAmB,IAAA,GACnC,UACA,IAAA,GACA,mIAAmI,EAClI,OACD,GACD,EAIA,EAAA,QACC,EACA,EAAM,WAAa,IAAA,IAAa,CAAC,CAAC,EAAM,SACxC,WACA,oLAAoL,EACnL,UACD,GACD,CACD,GAGD,IAAA,EAAe"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=`radio-group`,t=`prod`,n=`RadioGroup`,r={component:e,status:t,"display-name":`Radio Groups`,classKey:n,"last-accessibility-review":{"date-iso-8601":`2018/01/18`,"commit-sha":`ad6b6c6523ee21cada11be5f7ea4d99abc530726`},"SLDS-component-path":`/components/radio-group`,"site-stories":[{heading:`Base`,path:`/__examples__/base.jsx`}],"url-slug":`radio-groups`};exports.classKey=n,exports.component=e,exports.default=r,exports.status=t;
|
|
2
|
+
//# sourceMappingURL=component.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.cjs","names":[],"sources":["../../../../components/radio-group/component.json"],"sourcesContent":["{\n\t\"component\": \"radio-group\",\n\t\"status\": \"prod\",\n\t\"display-name\": \"Radio Groups\",\n\t\"classKey\": \"RadioGroup\",\n\t\"last-accessibility-review\": {\n\t\t\"date-iso-8601\": \"2018/01/18\",\n\t\t\"commit-sha\": \"ad6b6c6523ee21cada11be5f7ea4d99abc530726\"\n\t},\n\t\"SLDS-component-path\": \"/components/radio-group\",\n\t\"site-stories\": [\n\t\t{\n\t\t\t\"heading\": \"Base\",\n\t\t\t\"path\": \"/__examples__/base.jsx\"\n\t\t}\n\t],\n\t\"url-slug\": \"radio-groups\"\n}\n"],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs");let
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("./check-props.cjs"),r=require("./component.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s={required:`Required`},c={},l=({assistiveText:e,children:l,className:u,disabled:d,errorId:f,labels:p,name:m,onChange:h,required:g,style:_,value:v,variant:y=`base`})=>{let b=(0,i.useId)(),x=(0,i.useId)(),S={...s,...e},C={...c,...p},w=m||b,T=!!C.error,E=T?f||x:void 0,D=v!==void 0;(0,i.useEffect)(()=>{n.default(t.RADIO_GROUP,{disabled:d,onChange:h,value:v},r.default)});let O=(0,i.useMemo)(()=>i.default.Children.map(l,e=>{if(i.default.isValidElement(e)){let t=e.props,n=t.value??null;return i.default.cloneElement(e,{name:w,onChange:(e,t)=>{h?.(e,{checked:t.checked,value:t.checked?n:null})},"aria-describedby":E,disabled:d||t.disabled,...D?{checked:n!==null&&n===v}:{}})}return e}),[l,w,h,E,d,D,v]);return(0,o.jsxs)(`fieldset`,{className:(0,a.default)(`slds-form-element`,{"slds-has-error":T}),children:[(0,o.jsxs)(`legend`,{className:(0,a.default)(`slds-form-element__legend`,`slds-form-element__label`,{"slds-assistive-text":S.label}),children:[g&&(0,o.jsxs)(`abbr`,{className:`slds-required`,title:`required`,children:[`*`,(0,o.jsxs)(`div`,{className:`slds-assistive-text`,children:[S.required,` `]})]}),S.label||C.label]}),(0,o.jsxs)(`div`,{className:(0,a.default)(`slds-form-element__control`,u),children:[y===`button-group`?(0,o.jsx)(`div`,{style:_,className:`slds-radio_button-group`,children:O}):O,C.error&&(0,o.jsx)(`div`,{id:E,className:`slds-form-element__help`,children:C.error})]})]})};l.displayName=t.RADIO_GROUP,exports.default=l;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|