@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.js","names":[],"sources":["../../../../components/tabs/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, {\n\tuseState,\n\tuseRef,\n\tuseCallback,\n\tuseId,\n\ttype ReactNode,\n\ttype MouseEvent,\n\ttype KeyboardEvent,\n} from 'react';\nimport classNames from 'classnames';\n\n// Child components\nimport TabsList from './private/tabs-list';\nimport Tab from './private/tab';\nimport TabPanel from './private/tab-panel';\n\nimport { TABS } from '../../utilities/constants';\nimport KEYS from '../../utilities/key-code';\nimport EventUtil from '../../utilities/event';\n\n/**\n * Tabs variant types\n */\nexport type TabsVariant = 'default' | 'scoped' | 'vertical';\n\n/**\n * Tab child props (TabsPanel)\n */\nexport interface TabChildProps {\n\tlabel: ReactNode;\n\tdisabled?: boolean;\n\thasError?: boolean;\n\tassistiveText?: {\n\t\twithErrorIcon?: string;\n\t};\n\tchildren?: ReactNode;\n\tkey?: string | number;\n}\n\n/**\n * Data passed to the Tabs `onSelect` callback\n */\nexport interface TabsSelectData {\n\t/** Index of the tab being selected */\n\tselectedIndex: number;\n\t/** Index of the tab that was selected before this selection */\n\tpreviousIndex: number;\n}\n\n/**\n * Props for the Tabs component\n */\nexport interface TabsProps {\n\t/** TabsPanel children */\n\tchildren: ReactNode;\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Default selected tab index */\n\tdefaultSelectedIndex?: number;\n\t/** HTML id */\n\tid?: string;\n\t/**\n\t * Called when a tab is selected by click or keyboard. Receives the triggering event and\n\t * `{ selectedIndex, previousIndex }`. When `selectedIndex` is not passed, the selection always\n\t * changes; when it is passed (controlled), update it from this callback to change tabs.\n\t */\n\tonSelect?: (\n\t\tevent: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>,\n\t\tdata: TabsSelectData\n\t) => void;\n\t/** Currently selected tab index (controlled) */\n\tselectedIndex?: number;\n\t/** Tab style variant */\n\tvariant?: TabsVariant;\n}\n\n// Determine if a node from event.target is a Tab element\nfunction isTabNode(node: HTMLElement): boolean {\n\treturn (\n\t\t(node.nodeName === 'A' && node.getAttribute('role') === 'tab') ||\n\t\t(node.nodeName === 'LI' &&\n\t\t\t(node.classList.contains('slds-tabs_default__item') ||\n\t\t\t\tnode.classList.contains('slds-tabs_scoped__item') ||\n\t\t\t\tnode.classList.contains('slds-vertical-tabs__nav-item')))\n\t);\n}\n\n// Determine if a tab node is disabled (from DOM)\nfunction isTabNodeDisabled(node: HTMLElement): boolean {\n\tif (node.classList?.contains('slds-disabled')) {\n\t\treturn true;\n\t}\n\tif (node.getAttribute?.('aria-disabled') === 'true') {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n// Determine if a tab React element is disabled\nfunction isTabDisabled(tab: React.ReactElement<TabChildProps>): boolean {\n\treturn Boolean(tab.props?.disabled);\n}\n\n/**\n * Tabs keeps related content in a single container that is shown and hidden through navigation.\n */\nconst Tabs = ({\n\tchildren,\n\tclassName,\n\tdefaultSelectedIndex = 0,\n\tid: propId,\n\tonSelect,\n\tselectedIndex: controlledSelectedIndex,\n\tvariant = 'default',\n}: TabsProps): React.ReactElement => {\n\tconst generatedId = useId();\n\tconst id = propId || generatedId;\n\n\tconst [internalSelectedIndex, setInternalSelectedIndex] =\n\t\tuseState(defaultSelectedIndex);\n\tconst [focus, setFocus] = useState(false);\n\tconst tabsRef = useRef<\n\t\tArray<{ tab: React.ReactElement<TabChildProps>; node: HTMLElement | null }>\n\t>([]);\n\tconst tabsNodeRef = useRef<HTMLDivElement>(null);\n\n\tconst childArray = React.Children.toArray(\n\t\tchildren\n\t) as React.ReactElement<TabChildProps>[];\n\tconst tabsCount = childArray.length;\n\n\t// Use controlled or internal state\n\tconst selectedIndex = Number.isInteger(controlledSelectedIndex)\n\t\t? controlledSelectedIndex!\n\t\t: internalSelectedIndex;\n\n\tconst getNextTab = useCallback(\n\t\t(index: number): number => {\n\t\t\t// Look for non-disabled tab from index to the last tab\n\t\t\tfor (let i = index + 1; i < tabsCount; i++) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Continue from first tab\n\t\t\tfor (let i = 0; i < index; i++) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn index;\n\t\t},\n\t\t[tabsCount]\n\t);\n\n\tconst getPrevTab = useCallback(\n\t\t(index: number): number => {\n\t\t\t// Look for non-disabled tab backwards\n\t\t\tfor (let i = index - 1; i >= 0; i--) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Continue from last tab\n\t\t\tfor (let i = tabsCount - 1; i > index; i--) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn index;\n\t\t},\n\t\t[tabsCount]\n\t);\n\n\tconst setSelected = useCallback(\n\t\t(\n\t\t\tevent: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>,\n\t\t\tindex: number,\n\t\t\tshouldFocus?: boolean\n\t\t) => {\n\t\t\tif (index < 0 || index >= tabsCount) return;\n\n\t\t\tonSelect?.(event, { selectedIndex: index, previousIndex: selectedIndex });\n\n\t\t\tif (index !== internalSelectedIndex) {\n\t\t\t\tsetInternalSelectedIndex(index);\n\t\t\t\tsetFocus(shouldFocus === true);\n\t\t\t}\n\t\t},\n\t\t[tabsCount, onSelect, selectedIndex, internalSelectedIndex]\n\t);\n\n\tconst isTabFromContainer = useCallback((node: HTMLElement): boolean => {\n\t\tif (!isTabNode(node)) return false;\n\n\t\tlet nodeAncestor: HTMLElement | null = node.parentElement;\n\t\twhile (nodeAncestor) {\n\t\t\tif (nodeAncestor === tabsNodeRef.current) return true;\n\t\t\tif (nodeAncestor.getAttribute('data-tabs')) break;\n\t\t\tnodeAncestor = nodeAncestor.parentElement;\n\t\t}\n\t\treturn false;\n\t}, []);\n\n\tconst handleClick = useCallback(\n\t\t(e: MouseEvent<HTMLDivElement>) => {\n\t\t\tlet node = e.target as HTMLElement;\n\t\t\tdo {\n\t\t\t\tif (isTabFromContainer(node)) {\n\t\t\t\t\tif (isTabNodeDisabled(node)) return;\n\n\t\t\t\t\tlet parentNode = node.parentNode as HTMLElement;\n\t\t\t\t\tif (parentNode?.nodeName === 'LI') {\n\t\t\t\t\t\tnode = parentNode;\n\t\t\t\t\t\tparentNode = node.parentNode as HTMLElement;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst index = Array.from(parentNode.children).indexOf(node);\n\t\t\t\t\tsetSelected(e, index);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tnode = node.parentNode as HTMLElement;\n\t\t\t} while (node !== null);\n\t\t},\n\t\t[isTabFromContainer, setSelected]\n\t);\n\n\tconst handleKeyDown = useCallback(\n\t\t(event: KeyboardEvent<HTMLDivElement>) => {\n\t\t\tif (isTabFromContainer(event.target as HTMLElement)) {\n\t\t\t\tlet index = selectedIndex;\n\t\t\t\tlet preventDefault = false;\n\n\t\t\t\tif (event.keyCode === KEYS.LEFT || event.keyCode === KEYS.UP) {\n\t\t\t\t\tindex = getPrevTab(index);\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t} else if (\n\t\t\t\t\tevent.keyCode === KEYS.RIGHT ||\n\t\t\t\t\tevent.keyCode === KEYS.DOWN\n\t\t\t\t) {\n\t\t\t\t\tindex = getNextTab(index);\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t}\n\n\t\t\t\tif (preventDefault) {\n\t\t\t\t\tEventUtil.trap(event);\n\t\t\t\t}\n\n\t\t\t\tsetSelected(event, index, true);\n\t\t\t}\n\t\t},\n\t\t[isTabFromContainer, selectedIndex, getPrevTab, getNextTab, setSelected]\n\t);\n\n\tconst renderTabsList = () => (\n\t\t<TabsList id={id} variant={variant}>\n\t\t\t{childArray.map((child, index) => {\n\t\t\t\tconst tabId = `${id}-slds-tabs_tab-${index}`;\n\t\t\t\tconst panelId = `${id}-slds-tabs_panel-${index}`;\n\t\t\t\tconst isSelected = selectedIndex === index;\n\t\t\t\tconst shouldFocus = isSelected && focus;\n\n\t\t\t\treturn (\n\t\t\t\t\t<Tab\n\t\t\t\t\t\tkey={child.key ?? index}\n\t\t\t\t\t\tref={(node: HTMLElement | null) => {\n\t\t\t\t\t\t\ttabsRef.current[index] = { tab: child, node };\n\t\t\t\t\t\t\tif (focus) {\n\t\t\t\t\t\t\t\tsetFocus(false);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tfocus={shouldFocus}\n\t\t\t\t\t\tselected={isSelected}\n\t\t\t\t\t\tid={tabId}\n\t\t\t\t\t\tpanelId={panelId}\n\t\t\t\t\t\tdisabled={child.props.disabled}\n\t\t\t\t\t\tvariant={variant}\n\t\t\t\t\t\thasError={child.props.hasError}\n\t\t\t\t\t\tassistiveText={child.props.assistiveText}\n\t\t\t\t\t>\n\t\t\t\t\t\t{child.props.label}\n\t\t\t\t\t</Tab>\n\t\t\t\t);\n\t\t\t})}\n\t\t</TabsList>\n\t);\n\n\tconst renderTabPanels = () =>\n\t\tchildArray.map((child, index) => {\n\t\t\tconst tabId = `${id}-slds-tabs_tab-${index}`;\n\t\t\tconst panelId = `${id}-slds-tabs_panel-${index}`;\n\t\t\tconst isSelected = selectedIndex === index;\n\n\t\t\treturn (\n\t\t\t\t<TabPanel\n\t\t\t\t\tkey={child.key ?? index}\n\t\t\t\t\tselected={isSelected}\n\t\t\t\t\tid={panelId}\n\t\t\t\t\ttabId={tabId}\n\t\t\t\t\tvariant={variant}\n\t\t\t\t>\n\t\t\t\t\t{child}\n\t\t\t\t</TabPanel>\n\t\t\t);\n\t\t});\n\n\treturn (\n\t\t<div\n\t\t\tid={id}\n\t\t\tclassName={classNames(\n\t\t\t\t{\n\t\t\t\t\t'slds-tabs_default': variant === 'default',\n\t\t\t\t\t'slds-tabs_scoped': variant === 'scoped',\n\t\t\t\t\t'slds-vertical-tabs': variant === 'vertical',\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t)}\n\t\t\tonClick={handleClick}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tdata-tabs\n\t\t\tref={tabsNodeRef}\n\t\t>\n\t\t\t{renderTabsList()}\n\t\t\t{renderTabPanels()}\n\t\t</div>\n\t);\n};\n\nTabs.displayName = TABS;\n\nexport default Tabs;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../components/tabs/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, {\n\tuseState,\n\tuseRef,\n\tuseCallback,\n\tuseEffect,\n\tuseId,\n\ttype ReactNode,\n\ttype MouseEvent,\n\ttype KeyboardEvent,\n} from 'react';\nimport classNames from 'classnames';\n\n// Child components\nimport TabsList from './private/tabs-list';\nimport Tab from './private/tab';\nimport TabPanel from './private/tab-panel';\n\nimport { TABS } from '../../utilities/constants';\nimport KEYS from '../../utilities/key-code';\nimport EventUtil from '../../utilities/event';\n\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Tabs variant types\n */\nexport type TabsVariant = 'default' | 'scoped' | 'vertical';\n\n/**\n * Tab child props (TabsPanel)\n */\nexport interface TabChildProps {\n\tlabel: ReactNode;\n\tvalue?: string;\n\tdisabled?: boolean;\n\thasError?: boolean;\n\tassistiveText?: {\n\t\twithErrorIcon?: string;\n\t};\n\tchildren?: ReactNode;\n\tkey?: string | number;\n}\n\n/**\n * Data passed to the Tabs `onSelect` callback\n */\nexport interface TabsSelectData {\n\t/**\n\t * `value` of the tab being selected: the panel's `value`, or its index as a\n\t * string (`'0'`, `'1'`, ...) when the panel has no `value`.\n\t */\n\tvalue: string;\n\t/**\n\t * `value` of the tab that was selected before this selection, or `undefined`\n\t * when no tab was selected.\n\t */\n\tpreviousValue: string | undefined;\n\t/** Index of the tab being selected */\n\tselectedIndex: number;\n\t/** Index of the tab that was selected before this selection, or `-1` when no tab was selected */\n\tpreviousIndex: number;\n}\n\n/**\n * Props shared by both ways of controlling the selected tab\n */\ninterface TabsBaseProps {\n\t/** TabsPanel children */\n\tchildren: ReactNode;\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** HTML id */\n\tid?: string;\n\t/**\n\t * Called when a tab is requested by click or arrow key. Receives the triggering event and\n\t * `{ value, previousValue, selectedIndex, previousIndex }`. Tabs is controlled: update `value`\n\t * from this callback to change tabs. It is not called for a disabled tab or for the tab that is\n\t * already selected.\n\t */\n\tonSelect: (\n\t\tevent: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>,\n\t\tdata: TabsSelectData\n\t) => void;\n\t/** Tab style variant */\n\tvariant?: TabsVariant;\n}\n\n/**\n * Select the tab by the `value` of its `TabsPanel`.\n */\ninterface TabsValueProps {\n\t/**\n\t * `value` of the selected `TabsPanel` (required, controlled). A panel without a `value` is\n\t * matched by its index as a string (`'0'`, `'1'`, ...). When no panel matches, no tab is selected.\n\t */\n\tvalue: string;\n\tselectedIndex?: never;\n}\n\n/**\n * Select the tab by index (deprecated).\n */\ninterface TabsSelectedIndexProps {\n\tvalue?: undefined;\n\t/**\n\t * @deprecated Use `value` instead (set `value` on each `TabsPanel`, or use the index as a\n\t * string). Index of the selected tab, controlled. Used only when `value` is not passed.\n\t */\n\tselectedIndex: number;\n}\n\n/**\n * Props for the Tabs component\n */\nexport type TabsProps = TabsBaseProps &\n\t(TabsValueProps | TabsSelectedIndexProps);\n\n// The value a panel is matched by: its `value`, or its index as a string.\nconst getPanelValue = (\n\tchild: React.ReactElement<TabChildProps>,\n\tindex: number\n): string => child.props.value ?? String(index);\n\n// Determine if a node from event.target is a Tab element\nfunction isTabNode(node: HTMLElement): boolean {\n\treturn (\n\t\t(node.nodeName === 'A' && node.getAttribute('role') === 'tab') ||\n\t\t(node.nodeName === 'LI' &&\n\t\t\t(node.classList.contains('slds-tabs_default__item') ||\n\t\t\t\tnode.classList.contains('slds-tabs_scoped__item') ||\n\t\t\t\tnode.classList.contains('slds-vertical-tabs__nav-item')))\n\t);\n}\n\n// Determine if a tab node is disabled (from DOM)\nfunction isTabNodeDisabled(node: HTMLElement): boolean {\n\tif (node.classList?.contains('slds-disabled')) {\n\t\treturn true;\n\t}\n\tif (node.getAttribute?.('aria-disabled') === 'true') {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n// Determine if a tab React element is disabled\nfunction isTabDisabled(tab: React.ReactElement<TabChildProps>): boolean {\n\treturn Boolean(tab.props?.disabled);\n}\n\n/**\n * Tabs keeps related content in a single container that is shown and hidden through navigation.\n */\nconst Tabs = (props: TabsProps): React.ReactElement => {\n\tconst {\n\t\tchildren,\n\t\tclassName,\n\t\tid: propId,\n\t\tonSelect,\n\t\tselectedIndex: selectedIndexProp,\n\t\tvalue,\n\t\tvariant = 'default',\n\t} = props;\n\tconst generatedId = useId();\n\tconst id = propId || generatedId;\n\n\tuseEffect(() => {\n\t\tcheckProps(\n\t\t\tTABS,\n\t\t\t{\n\t\t\t\tdefaultSelectedIndex: (props as { defaultSelectedIndex?: number })\n\t\t\t\t\t.defaultSelectedIndex,\n\t\t\t\tselectedIndex: selectedIndexProp,\n\t\t\t\tvalue,\n\t\t\t},\n\t\t\tcomponentDoc\n\t\t);\n\t});\n\n\tconst [focus, setFocus] = useState(false);\n\tconst tabsRef = useRef<\n\t\tArray<{ tab: React.ReactElement<TabChildProps>; node: HTMLElement | null }>\n\t>([]);\n\tconst tabsNodeRef = useRef<HTMLDivElement>(null);\n\n\tconst childArray = React.Children.toArray(\n\t\tchildren\n\t) as React.ReactElement<TabChildProps>[];\n\tconst tabsCount = childArray.length;\n\n\t// Selection is controlled: derived from `value`, or from the deprecated\n\t// `selectedIndex` when `value` is not passed. There is no internal copy.\n\tconst selectedIndex =\n\t\tvalue !== undefined\n\t\t\t? childArray.findIndex(\n\t\t\t\t\t(child, index) => getPanelValue(child, index) === value\n\t\t\t\t)\n\t\t\t: Number.isInteger(selectedIndexProp)\n\t\t\t\t? (selectedIndexProp as number)\n\t\t\t\t: -1;\n\n\tconst getNextTab = useCallback(\n\t\t(index: number): number => {\n\t\t\t// Look for non-disabled tab from index to the last tab\n\t\t\tfor (let i = index + 1; i < tabsCount; i++) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Continue from first tab\n\t\t\tfor (let i = 0; i < index; i++) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn index;\n\t\t},\n\t\t[tabsCount]\n\t);\n\n\tconst getPrevTab = useCallback(\n\t\t(index: number): number => {\n\t\t\t// Look for non-disabled tab backwards\n\t\t\tfor (let i = index - 1; i >= 0; i--) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Continue from last tab\n\t\t\tfor (let i = tabsCount - 1; i > index; i--) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn index;\n\t\t},\n\t\t[tabsCount]\n\t);\n\n\tconst setSelected = useCallback(\n\t\t(\n\t\t\tevent: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>,\n\t\t\tindex: number,\n\t\t\tshouldFocus?: boolean\n\t\t) => {\n\t\t\tif (index < 0 || index >= tabsCount || index === selectedIndex) return;\n\n\t\t\tconst previous =\n\t\t\t\tselectedIndex >= 0 ? childArray[selectedIndex] : undefined;\n\t\t\tonSelect?.(event, {\n\t\t\t\tvalue: getPanelValue(childArray[index], index),\n\t\t\t\tpreviousValue: previous\n\t\t\t\t\t? getPanelValue(previous, selectedIndex)\n\t\t\t\t\t: undefined,\n\t\t\t\tselectedIndex: index,\n\t\t\t\tpreviousIndex: selectedIndex,\n\t\t\t});\n\t\t\t// Focus follows the selection once the parent updates `value`.\n\t\t\tsetFocus(shouldFocus === true);\n\t\t},\n\t\t[tabsCount, onSelect, selectedIndex, childArray]\n\t);\n\n\tconst isTabFromContainer = useCallback((node: HTMLElement): boolean => {\n\t\tif (!isTabNode(node)) return false;\n\n\t\tlet nodeAncestor: HTMLElement | null = node.parentElement;\n\t\twhile (nodeAncestor) {\n\t\t\tif (nodeAncestor === tabsNodeRef.current) return true;\n\t\t\tif (nodeAncestor.getAttribute('data-tabs')) break;\n\t\t\tnodeAncestor = nodeAncestor.parentElement;\n\t\t}\n\t\treturn false;\n\t}, []);\n\n\tconst handleClick = useCallback(\n\t\t(e: MouseEvent<HTMLDivElement>) => {\n\t\t\tlet node = e.target as HTMLElement;\n\t\t\tdo {\n\t\t\t\tif (isTabFromContainer(node)) {\n\t\t\t\t\tif (isTabNodeDisabled(node)) return;\n\n\t\t\t\t\tlet parentNode = node.parentNode as HTMLElement;\n\t\t\t\t\tif (parentNode?.nodeName === 'LI') {\n\t\t\t\t\t\tnode = parentNode;\n\t\t\t\t\t\tparentNode = node.parentNode as HTMLElement;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst index = Array.from(parentNode.children).indexOf(node);\n\t\t\t\t\tsetSelected(e, index);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tnode = node.parentNode as HTMLElement;\n\t\t\t} while (node !== null);\n\t\t},\n\t\t[isTabFromContainer, setSelected]\n\t);\n\n\tconst handleKeyDown = useCallback(\n\t\t(event: KeyboardEvent<HTMLDivElement>) => {\n\t\t\tif (isTabFromContainer(event.target as HTMLElement)) {\n\t\t\t\tlet index = selectedIndex;\n\t\t\t\tlet preventDefault = false;\n\n\t\t\t\tif (event.keyCode === KEYS.LEFT || event.keyCode === KEYS.UP) {\n\t\t\t\t\tindex = getPrevTab(index);\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t} else if (\n\t\t\t\t\tevent.keyCode === KEYS.RIGHT ||\n\t\t\t\t\tevent.keyCode === KEYS.DOWN\n\t\t\t\t) {\n\t\t\t\t\tindex = getNextTab(index);\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t}\n\n\t\t\t\tif (preventDefault) {\n\t\t\t\t\tEventUtil.trap(event);\n\t\t\t\t}\n\n\t\t\t\tsetSelected(event, index, true);\n\t\t\t}\n\t\t},\n\t\t[isTabFromContainer, selectedIndex, getPrevTab, getNextTab, setSelected]\n\t);\n\n\tconst renderTabsList = () => (\n\t\t<TabsList id={id} variant={variant}>\n\t\t\t{childArray.map((child, index) => {\n\t\t\t\tconst tabId = `${id}-slds-tabs_tab-${index}`;\n\t\t\t\tconst panelId = `${id}-slds-tabs_panel-${index}`;\n\t\t\t\tconst isSelected = selectedIndex === index;\n\t\t\t\tconst shouldFocus = isSelected && focus;\n\n\t\t\t\treturn (\n\t\t\t\t\t<Tab\n\t\t\t\t\t\tkey={child.key ?? index}\n\t\t\t\t\t\tref={(node: HTMLElement | null) => {\n\t\t\t\t\t\t\ttabsRef.current[index] = { tab: child, node };\n\t\t\t\t\t\t\tif (focus) {\n\t\t\t\t\t\t\t\tsetFocus(false);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tfocus={shouldFocus}\n\t\t\t\t\t\tselected={isSelected}\n\t\t\t\t\t\tid={tabId}\n\t\t\t\t\t\tpanelId={panelId}\n\t\t\t\t\t\tdisabled={child.props.disabled}\n\t\t\t\t\t\tvariant={variant}\n\t\t\t\t\t\thasError={child.props.hasError}\n\t\t\t\t\t\tassistiveText={child.props.assistiveText}\n\t\t\t\t\t>\n\t\t\t\t\t\t{child.props.label}\n\t\t\t\t\t</Tab>\n\t\t\t\t);\n\t\t\t})}\n\t\t</TabsList>\n\t);\n\n\tconst renderTabPanels = () =>\n\t\tchildArray.map((child, index) => {\n\t\t\tconst tabId = `${id}-slds-tabs_tab-${index}`;\n\t\t\tconst panelId = `${id}-slds-tabs_panel-${index}`;\n\t\t\tconst isSelected = selectedIndex === index;\n\n\t\t\treturn (\n\t\t\t\t<TabPanel\n\t\t\t\t\tkey={child.key ?? index}\n\t\t\t\t\tselected={isSelected}\n\t\t\t\t\tid={panelId}\n\t\t\t\t\ttabId={tabId}\n\t\t\t\t\tvariant={variant}\n\t\t\t\t>\n\t\t\t\t\t{child}\n\t\t\t\t</TabPanel>\n\t\t\t);\n\t\t});\n\n\treturn (\n\t\t<div\n\t\t\tid={id}\n\t\t\tclassName={classNames(\n\t\t\t\t{\n\t\t\t\t\t'slds-tabs_default': variant === 'default',\n\t\t\t\t\t'slds-tabs_scoped': variant === 'scoped',\n\t\t\t\t\t'slds-vertical-tabs': variant === 'vertical',\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t)}\n\t\t\tonClick={handleClick}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tdata-tabs\n\t\t\tref={tabsNodeRef}\n\t\t>\n\t\t\t{renderTabsList()}\n\t\t\t{renderTabPanels()}\n\t\t</div>\n\t);\n};\n\nTabs.displayName = TABS;\n\nexport default Tabs;\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panel.js","names":[],"sources":["../../../../components/tabs/panel.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 } from 'react';\n\nimport { TABS_PANEL } from '../../utilities/constants';\n\nexport interface TabsPanelProps {\n\t/**\n\t * The string or element that is handed off to the `<Tab />` component, ends up being the title and the label for the tab associated with its tab panel.\n\t */\n\tlabel: ReactNode;\n\t/**\n\t * The `children` are the actual tab panels to be rendered. They get created by [tabs/index.jsx](./index.jsx) in the `renderTabPanels` function.\n\t *\n\t * Note that the `<TabsPanel />` component inserts a `div` element around the children, because React requires exactly one \"parent\" element returned. The `<TabPanel />` component simply dips down into `children` to get the children of this wrapping `div` so that it does not get rendered in the DOM.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * Disables the `<Tab />` associated with this panel so it cannot be selected.\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Show an icon on the `<Tab />` next to the title that can be used to communicate when a tab contains a validation error that needs attention\n\t */\n\thasError?: boolean;\n\t/**\n\t * **Assistive text for accessibility**\n\t * This object is merged with the default props object on every render.\n\t * * `withErrorIcon`: This text is for the error icon that will be placed next to the `<Tab />` title\n\t */\n\tassistiveText?: {\n\t\twithErrorIcon?: string;\n\t};\n}\n\n/**\n * The `<TabsPanel />` component allows us to simplify the structure of the `<Tabs />` component.\n\n * Rather than require different (deeply nested) children for tabslist, with its tab(s) as well as tabpanel(s), we provide this `TabsPanel` component which takes a `label` property that will become what is shown on the `<Tab />` that will be associated with it.\n\n * The `children` of the Panel will be fed to the `<TabPanel />` component, while its `label` is handled in `<Tab />`, via `<TabsList />`.\n *\n * ```\n * <TabsPanel label=\"Tab 1\">\n * \t<div>\n * \t\t<h2 className=\"slds-text-heading_medium\">This is my tab 1 contents!</h2>\n * \t\t<p>They show when you click the first tab.</p>\n * \t</div>\n * </TabsPanel>\n * ```\n */\nconst Panel = ({ children }: TabsPanelProps) => (\n\t<div>{React.Children.toArray(children)}</div>\n);\n\nPanel.displayName = TABS_PANEL;\n\nexport default Panel;\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"panel.js","names":[],"sources":["../../../../components/tabs/panel.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 } from 'react';\n\nimport { TABS_PANEL } from '../../utilities/constants';\n\nexport interface TabsPanelProps {\n\t/**\n\t * The string or element that is handed off to the `<Tab />` component, ends up being the title and the label for the tab associated with its tab panel.\n\t */\n\tlabel: ReactNode;\n\t/**\n\t * Identifies this panel for the `value` prop of `<Tabs />` and the `value`/`previousValue` reported by its `onSelect`. When omitted, the panel is identified by its index as a string (`'0'`, `'1'`, ...). Rendered `id`s are always index-based.\n\t */\n\tvalue?: string;\n\t/**\n\t * The `children` are the actual tab panels to be rendered. They get created by [tabs/index.jsx](./index.jsx) in the `renderTabPanels` function.\n\t *\n\t * Note that the `<TabsPanel />` component inserts a `div` element around the children, because React requires exactly one \"parent\" element returned. The `<TabPanel />` component simply dips down into `children` to get the children of this wrapping `div` so that it does not get rendered in the DOM.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * Disables the `<Tab />` associated with this panel so it cannot be selected.\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Show an icon on the `<Tab />` next to the title that can be used to communicate when a tab contains a validation error that needs attention\n\t */\n\thasError?: boolean;\n\t/**\n\t * **Assistive text for accessibility**\n\t * This object is merged with the default props object on every render.\n\t * * `withErrorIcon`: This text is for the error icon that will be placed next to the `<Tab />` title\n\t */\n\tassistiveText?: {\n\t\twithErrorIcon?: string;\n\t};\n}\n\n/**\n * The `<TabsPanel />` component allows us to simplify the structure of the `<Tabs />` component.\n\n * Rather than require different (deeply nested) children for tabslist, with its tab(s) as well as tabpanel(s), we provide this `TabsPanel` component which takes a `label` property that will become what is shown on the `<Tab />` that will be associated with it.\n\n * The `children` of the Panel will be fed to the `<TabPanel />` component, while its `label` is handled in `<Tab />`, via `<TabsList />`.\n *\n * ```\n * <TabsPanel label=\"Tab 1\" value=\"tab-1\">\n * \t<div>\n * \t\t<h2 className=\"slds-text-heading_medium\">This is my tab 1 contents!</h2>\n * \t\t<p>They show when you click the first tab.</p>\n * \t</div>\n * </TabsPanel>\n * ```\n */\nconst Panel = ({ children }: TabsPanelProps) => (\n\t<div>{React.Children.toArray(children)}</div>\n);\n\nPanel.displayName = TABS_PANEL;\n\nexport default Panel;\n"],"mappings":";;;;AAwDA,IAAM,KAAS,EAAE,kBAChB,kBAAC,OAAD,EAAA,UAAM,EAAM,SAAS,QAAQ,CAAQ,EAAO,CAAA;AAG7C,EAAM,cAAc"}
|
|
@@ -9,7 +9,7 @@ process.env.NODE_ENV !== "production" && (i = function(i, a, o) {
|
|
|
9
9
|
r(i, {
|
|
10
10
|
"labels.label": a.labels?.label ?? a.label,
|
|
11
11
|
"assistiveText.label": a.assistiveText?.label
|
|
12
|
-
}, s()), typeof a.maxLength == "string" && e(i, a.maxLength, "maxLength", `\`maxLength\` as a string has been deprecated. Please pass a number instead. ${s("maxLength")}`), n(i, a.errorText, "errorText", "labels.error` and `hasError", s("labels")), n(i, a.label, "label", "labels.label", s("labels"));
|
|
12
|
+
}, s()), e(i, a.defaultValue !== void 0, "defaultValue", "Textarea is controlled: pass `value` and update it in `onChange`."), typeof a.maxLength == "string" && e(i, a.maxLength, "maxLength", `\`maxLength\` as a string has been deprecated. Please pass a number instead. ${s("maxLength")}`), n(i, a.errorText, "errorText", "labels.error` and `hasError", s("labels")), n(i, a.label, "label", "labels.label", s("labels"));
|
|
13
13
|
});
|
|
14
14
|
var a = i;
|
|
15
15
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-props.js","names":[],"sources":["../../../../components/textarea/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 onlyOneOfProperties from '../../utilities/warning/only-one-of-properties';\nimport sunsetProperty from '../../utilities/warning/sunset-property';\nimport getComponentDocFn from '../../utilities/get-component-doc';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\n\t\tonlyOneOfProperties(\n\t\t\tCOMPONENT,\n\t\t\t{\n\t\t\t\t'labels.label': props.labels?.label ?? props.label,\n\t\t\t\t'assistiveText.label': props.assistiveText?.label,\n\t\t\t},\n\t\t\tcreateDocUrl()\n\t\t);\n\n\t\tif (typeof props.maxLength === 'string') {\n\t\t\tsunsetProperty(\n\t\t\t\tCOMPONENT,\n\t\t\t\tprops.maxLength,\n\t\t\t\t'maxLength',\n\t\t\t\t`\\`maxLength\\` as a string has been deprecated. Please pass a number instead. ${createDocUrl(\n\t\t\t\t\t'maxLength'\n\t\t\t\t)}`\n\t\t\t);\n\t\t}\n\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.errorText,\n\t\t\t'errorText',\n\t\t\t'labels.error` and `hasError',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.label,\n\t\t\t'label',\n\t\t\t'labels.label',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t};\n}\n\nexport default checkProps;\n"],"mappings":";;;;;AAUA,IAAI,IAAa,WAA8B,CAAC;AAEhD,QAAA,IAAA,aAA6B,iBAC5B,IAAa,SAA4B,GAAW,GAAO,GAAS;CACnE,IAAM,IAAe,EAAkB,CAAO;
|
|
1
|
+
{"version":3,"file":"check-props.js","names":[],"sources":["../../../../components/textarea/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 onlyOneOfProperties from '../../utilities/warning/only-one-of-properties';\nimport sunsetProperty from '../../utilities/warning/sunset-property';\nimport getComponentDocFn from '../../utilities/get-component-doc';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\n\t\tonlyOneOfProperties(\n\t\t\tCOMPONENT,\n\t\t\t{\n\t\t\t\t'labels.label': props.labels?.label ?? props.label,\n\t\t\t\t'assistiveText.label': props.assistiveText?.label,\n\t\t\t},\n\t\t\tcreateDocUrl()\n\t\t);\n\n\t\tsunsetProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.defaultValue !== undefined,\n\t\t\t'defaultValue',\n\t\t\t'Textarea is controlled: pass `value` and update it in `onChange`.'\n\t\t);\n\n\t\tif (typeof props.maxLength === 'string') {\n\t\t\tsunsetProperty(\n\t\t\t\tCOMPONENT,\n\t\t\t\tprops.maxLength,\n\t\t\t\t'maxLength',\n\t\t\t\t`\\`maxLength\\` as a string has been deprecated. Please pass a number instead. ${createDocUrl(\n\t\t\t\t\t'maxLength'\n\t\t\t\t)}`\n\t\t\t);\n\t\t}\n\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.errorText,\n\t\t\t'errorText',\n\t\t\t'labels.error` and `hasError',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.label,\n\t\t\t'label',\n\t\t\t'labels.label',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t};\n}\n\nexport default checkProps;\n"],"mappings":";;;;;AAUA,IAAI,IAAa,WAA8B,CAAC;AAEhD,QAAA,IAAA,aAA6B,iBAC5B,IAAa,SAA4B,GAAW,GAAO,GAAS;CACnE,IAAM,IAAe,EAAkB,CAAO;CAoC9C,AAlCA,EACC,GACA;EACC,gBAAgB,EAAM,QAAQ,SAAS,EAAM;EAC7C,uBAAuB,EAAM,eAAe;CAC7C,GACA,EAAa,CACd,GAEA,EACC,GACA,EAAM,iBAAiB,KAAA,GACvB,gBACA,mEACD,GAEI,OAAO,EAAM,aAAc,YAC9B,EACC,GACA,EAAM,WACN,aACA,gFAAgF,EAC/E,WACD,GACD,GAGD,EACC,GACA,EAAM,WACN,aACA,+BACA,EAAa,QAAQ,CACtB,GACA,EACC,GACA,EAAM,OACN,SACA,gBACA,EAAa,QAAQ,CACtB;AACD;AAGD,IAAA,IAAe"}
|
|
@@ -44,7 +44,9 @@ var u = i((i, u) => {
|
|
|
44
44
|
maxLength: typeof S == "string" ? parseInt(S, 10) : S,
|
|
45
45
|
name: C,
|
|
46
46
|
onBlur: w,
|
|
47
|
-
onChange:
|
|
47
|
+
onChange: (e) => {
|
|
48
|
+
T?.(e, { value: e.target.value });
|
|
49
|
+
},
|
|
48
50
|
onClick: E,
|
|
49
51
|
onFocus: D,
|
|
50
52
|
onInput: O,
|
|
@@ -60,7 +62,6 @@ var u = i((i, u) => {
|
|
|
60
62
|
required: I,
|
|
61
63
|
wrap: B,
|
|
62
64
|
value: R,
|
|
63
|
-
defaultValue: z,
|
|
64
65
|
"aria-describedby": Z ? G() : K["aria-describedby"],
|
|
65
66
|
...K
|
|
66
67
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../components/textarea/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport {\n\tuseId,\n\tuseEffect,\n\tforwardRef,\n\ttype ChangeEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype MouseEvent,\n\ttype FormEvent,\n\ttype CSSProperties,\n\ttype ReactNode,\n} from 'react';\nimport classNames from 'classnames';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport { TEXTAREA } from '../../utilities/constants';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Assistive text for Textarea\n */\nexport interface TextareaAssistiveText {\n\t/** Visually hidden label for screen readers */\n\tlabel?: string;\n}\n\n/**\n * Labels for Textarea\n */\nexport interface TextareaLabels {\n\t/** Error message shown below the textarea while `hasError` is true */\n\terror?: ReactNode;\n\t/** Visible label above the textarea */\n\tlabel?: ReactNode;\n}\n\n/**\n * Props for the Textarea component\n */\nexport interface TextareaProps {\n\t/**\n\t * **Assistive text for accessibility**\n\t * * `label`: Visually hidden label. Use instead of `labels.label`.\n\t */\n\tassistiveText?: TextareaAssistiveText;\n\t/** aria-activedescendant for composite widgets */\n\t'aria-activedescendant'?: string;\n\t/** aria-autocomplete for suggestions */\n\t'aria-autocomplete'?: string;\n\t/** aria-controls to relate with another region */\n\t'aria-controls'?: string;\n\t/** aria-describedby for descriptions */\n\t'aria-describedby'?: string;\n\t/** aria-expanded for collapsible content */\n\t'aria-expanded'?: boolean;\n\t/** aria-haspopup for popup menus */\n\t'aria-haspopup'?: boolean;\n\t/** aria-labelledby for labels */\n\t'aria-labelledby'?: string;\n\t/** aria-owns for related elements */\n\t'aria-owns'?: string;\n\t/** aria-required for form validation */\n\t'aria-required'?: boolean;\n\t/** Autofocus on load (poor UX) */\n\tautoFocus?: boolean;\n\t/** Elements added after textarea */\n\tchildren?: ReactNode;\n\t/** CSS class for textarea element */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** CSS class for container */\n\tclassNameContainer?: string | string[] | Record<string, boolean>;\n\t/** Disable the textarea */\n\tdisabled?: boolean;\n\t/** @deprecated Use `labels.error` and `hasError` instead. */\n\terrorText?: string;\n\t/** Puts the textarea in an error state and shows `labels.error` */\n\thasError?: boolean;\n\t/** Unique ID */\n\tid?: string;\n\t/** @deprecated Use `labels.label` instead. */\n\tlabel?: string;\n\t/**\n\t * **Text labels for internationalization**\n\t * * `error`: Error message shown below the textarea while `hasError` is true\n\t * * `label`: Visible label. Use `assistiveText.label` for a visually hidden label.\n\t */\n\tlabels?: TextareaLabels;\n\t/** Maximum character count */\n\tmaxLength?: number;\n\t/** Form parameter name */\n\tname?: string;\n\t/** Blur event handler */\n\tonBlur?: (event: FocusEvent<HTMLTextAreaElement>) => void;\n\t/** Change event handler */\n\tonChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void;\n\t/** Click event handler */\n\tonClick?: (event: MouseEvent<HTMLTextAreaElement>) => void;\n\t/** Focus event handler */\n\tonFocus?: (event: FocusEvent<HTMLTextAreaElement>) => void;\n\t/** Input event handler */\n\tonInput?: (event: FormEvent<HTMLTextAreaElement>) => void;\n\t/** Invalid event handler */\n\tonInvalid?: (event: FormEvent<HTMLTextAreaElement>) => void;\n\t/** Key down event handler */\n\tonKeyDown?: (event: KeyboardEvent<HTMLTextAreaElement>) => void;\n\t/** Key press event handler */\n\tonKeyPress?: (event: KeyboardEvent<HTMLTextAreaElement>) => void;\n\t/** Key up event handler */\n\tonKeyUp?: (event: KeyboardEvent<HTMLTextAreaElement>) => void;\n\t/** Select event handler */\n\tonSelect?: (event: FormEvent<HTMLTextAreaElement>) => void;\n\t/** Submit event handler */\n\tonSubmit?: (event: FormEvent<HTMLTextAreaElement>) => void;\n\t/** Placeholder text */\n\tplaceholder?: string;\n\t/** Mark as required field */\n\trequired?: boolean;\n\t/** ARIA role */\n\trole?: string;\n\t/** Controlled value */\n\tvalue?: string;\n\t/** Initial uncontrolled value */\n\tdefaultValue?: string;\n\t/** Text wrapping mode */\n\twrap?: 'soft' | 'hard';\n\t/** Custom styles */\n\tstyle?: CSSProperties;\n}\n\n/**\n * A multi-line plain-text editing control.\n */\nconst Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n\t(props, ref) => {\n\t\tconst {\n\t\t\tassistiveText,\n\t\t\tautoFocus,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tclassNameContainer,\n\t\t\tdisabled,\n\t\t\terrorText,\n\t\t\thasError: hasErrorProp,\n\t\t\tid: propId,\n\t\t\tlabel: labelProp,\n\t\t\tlabels,\n\t\t\tmaxLength,\n\t\t\tname,\n\t\t\tonBlur,\n\t\t\tonChange,\n\t\t\tonClick,\n\t\t\tonFocus,\n\t\t\tonInput,\n\t\t\tonInvalid,\n\t\t\tonKeyDown,\n\t\t\tonKeyPress,\n\t\t\tonKeyUp,\n\t\t\tonSelect,\n\t\t\tonSubmit,\n\t\t\tplaceholder,\n\t\t\trequired,\n\t\t\trole,\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\twrap,\n\t\t\t...restProps\n\t\t} = props;\n\n\t\tcheckProps(TEXTAREA, { ...props }, componentDoc);\n\n\t\tconst generatedId = useId();\n\t\tconst generatedErrorId = useId();\n\n\t\tconst getId = () => propId || generatedId;\n\t\tconst getErrorId = () => restProps['aria-describedby'] || generatedErrorId;\n\n\t\tconst ariaProps = getAriaProps(restProps);\n\n\t\tconst assistiveTextLabel = assistiveText?.label;\n\n\t\t// `label` is deprecated\n\t\tconst label = labels?.label ?? labelProp;\n\t\tconst labelText = label || assistiveTextLabel;\n\n\t\t// `errorText` is deprecated: it sets both the error state and the message\n\t\tconst hasError = hasErrorProp ?? !!errorText;\n\t\tconst errorMessage = hasError ? (labels?.error ?? errorText) : undefined;\n\n\t\tuseEffect(() => {\n\t\t\tcheckProps(\n\t\t\t\tTEXTAREA,\n\t\t\t\t{ assistiveText, errorText, label: labelProp, labels },\n\t\t\t\tcomponentDoc\n\t\t\t);\n\t\t}, [assistiveText, errorText, labelProp, labels]);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-form-element',\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-has-error': hasError,\n\t\t\t\t\t},\n\t\t\t\t\tclassNameContainer as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{labelText && (\n\t\t\t\t\t<label\n\t\t\t\t\t\tclassName={classNames('slds-form-element__label', {\n\t\t\t\t\t\t\t'slds-assistive-text': assistiveTextLabel && !label,\n\t\t\t\t\t\t})}\n\t\t\t\t\t\thtmlFor={getId()}\n\t\t\t\t\t>\n\t\t\t\t\t\t{required && (\n\t\t\t\t\t\t\t<abbr className=\"slds-required\" title=\"required\">\n\t\t\t\t\t\t\t\t*\n\t\t\t\t\t\t\t</abbr>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{labelText}\n\t\t\t\t\t</label>\n\t\t\t\t)}\n\t\t\t\t<div className=\"slds-form-element__control\">\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tclassName={classNames('slds-textarea', className as string)}\n\t\t\t\t\t\tautoFocus={autoFocus}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tid={getId()}\n\t\t\t\t\t\tmaxLength={\n\t\t\t\t\t\t\t// Strings are still accepted at runtime for untyped callers; check-props warns.\n\t\t\t\t\t\t\ttypeof maxLength === 'string'\n\t\t\t\t\t\t\t\t? parseInt(maxLength, 10)\n\t\t\t\t\t\t\t\t: maxLength\n\t\t\t\t\t\t}\n\t\t\t\t\t\tname={name}\n\t\t\t\t\t\tonBlur={onBlur}\n\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\tonClick={onClick}\n\t\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\t\tonInput={onInput}\n\t\t\t\t\t\tonInvalid={onInvalid}\n\t\t\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\t\t\tonKeyPress={onKeyPress}\n\t\t\t\t\t\tonKeyUp={onKeyUp}\n\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t\tonSubmit={onSubmit}\n\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\trole={role}\n\t\t\t\t\t\trequired={required}\n\t\t\t\t\t\twrap={wrap}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\terrorMessage\n\t\t\t\t\t\t\t\t? getErrorId()\n\t\t\t\t\t\t\t\t: ((ariaProps as Record<string, unknown>)[\n\t\t\t\t\t\t\t\t\t\t'aria-describedby'\n\t\t\t\t\t\t\t\t\t] as string | undefined)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{...ariaProps}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{errorMessage && (\n\t\t\t\t\t<div id={getErrorId()} className=\"slds-form-element__help\">\n\t\t\t\t\t\t{errorMessage}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nTextarea.displayName = TEXTAREA;\n\nexport default Textarea;\n"],"mappings":";;;;;;;;AAuIA,IAAM,IAAW,GACf,GAAO,MAAQ;CACf,IAAM,EACL,kBACA,cACA,aACA,cACA,uBACA,aACA,cACA,UAAU,GACV,IAAI,GACJ,OAAO,GACP,WACA,cACA,SACA,WACA,aACA,YACA,YACA,YACA,cACA,cACA,eACA,YACA,aACA,aACA,gBACA,aACA,SACA,UACA,iBACA,SACA,GAAG,MACA;CAEJ,EAAW,GAAU,EAAE,GAAG,EAAM,GAAG,CAAY;CAE/C,IAAM,IAAc,EAAM,GACpB,IAAmB,EAAM,GAEzB,UAAc,KAAU,GACxB,UAAmB,EAAU,uBAAuB,GAEpD,IAAY,EAAa,CAAS,GAElC,IAAqB,GAAe,OAGpC,IAAQ,GAAQ,SAAS,GACzB,IAAY,KAAS,GAGrB,IAAW,KAAgB,CAAC,CAAC,GAC7B,IAAe,IAAY,GAAQ,SAAS,IAAa,KAAA;CAU/D,OARA,QAAgB;EACf,EACC,GACA;GAAE;GAAe;GAAW,OAAO;GAAW;EAAO,GACrD,CACD;CACD,GAAG;EAAC;EAAe;EAAW;EAAW;CAAM,CAAC,GAG/C,kBAAC,OAAD;EACC,WAAW,EACV,qBACA,EACC,kBAAkB,EACnB,GACA,CACD;EAPD,UAAA;GASE,KACA,kBAAC,SAAD;IACC,WAAW,EAAW,4BAA4B,EACjD,uBAAuB,KAAsB,CAAC,EAC/C,CAAC;IACD,SAAS,EAAM;IAJhB,UAAA,CAME,KACA,kBAAC,QAAD;KAAM,WAAU;KAAgB,OAAM;KAAW,UAAA;IAE3C,CAAA,GAEN,CACK;;GAER,kBAAC,OAAD;IAAK,WAAU;IACd,UAAA,kBAAC,YAAD;KACC,WAAW,EAAW,iBAAiB,CAAmB;KAC/C;KACD;KACV,IAAI,EAAM;KACV,WAEC,OAAO,KAAc,WAClB,SAAS,GAAW,EAAE,IACtB;KAEE;KACE;KACE;KACD;KACA;KACA;KACE;KACA;KACC;KACH;KACC;KACA;KACG;KACR;KACC;KACI;KACJ;KACC;KACO;KACd,oBACC,IACG,EAAW,IACT,EACF;KAGJ,GAAI;IACJ,CAAA;GACG,CAAA;GACJ,KACA,kBAAC,OAAD;IAAK,IAAI,EAAW;IAAG,WAAU;IAC/B,UAAA;GACG,CAAA;GAEL;EACG;;AAEP,CACD;AAEA,EAAS,cAAc"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../components/textarea/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport {\n\tuseId,\n\tuseEffect,\n\tforwardRef,\n\ttype ChangeEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype MouseEvent,\n\ttype FormEvent,\n\ttype CSSProperties,\n\ttype ReactNode,\n} from 'react';\nimport classNames from 'classnames';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport { TEXTAREA } from '../../utilities/constants';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Assistive text for Textarea\n */\nexport interface TextareaAssistiveText {\n\t/** Visually hidden label for screen readers */\n\tlabel?: string;\n}\n\n/**\n * Labels for Textarea\n */\nexport interface TextareaLabels {\n\t/** Error message shown below the textarea while `hasError` is true */\n\terror?: ReactNode;\n\t/** Visible label above the textarea */\n\tlabel?: ReactNode;\n}\n\n/**\n * Data passed to `onChange`\n */\nexport interface TextareaChangeData {\n\t/** The new text */\n\tvalue: string;\n}\n\n/**\n * Props removed in v11. They are ignored at runtime and warn in development.\n */\ninterface TextareaRemovedProps {\n\t/** @removed Textarea is controlled: pass `value` and update it in `onChange`. */\n\tdefaultValue?: unknown;\n}\n\n/**\n * Props for the Textarea component\n */\nexport interface TextareaProps {\n\t/**\n\t * **Assistive text for accessibility**\n\t * * `label`: Visually hidden label. Use instead of `labels.label`.\n\t */\n\tassistiveText?: TextareaAssistiveText;\n\t/** aria-activedescendant for composite widgets */\n\t'aria-activedescendant'?: string;\n\t/** aria-autocomplete for suggestions */\n\t'aria-autocomplete'?: string;\n\t/** aria-controls to relate with another region */\n\t'aria-controls'?: string;\n\t/** aria-describedby for descriptions */\n\t'aria-describedby'?: string;\n\t/** aria-expanded for collapsible content */\n\t'aria-expanded'?: boolean;\n\t/** aria-haspopup for popup menus */\n\t'aria-haspopup'?: boolean;\n\t/** aria-labelledby for labels */\n\t'aria-labelledby'?: string;\n\t/** aria-owns for related elements */\n\t'aria-owns'?: string;\n\t/** aria-required for form validation */\n\t'aria-required'?: boolean;\n\t/** Autofocus on load (poor UX) */\n\tautoFocus?: boolean;\n\t/** Elements added after textarea */\n\tchildren?: ReactNode;\n\t/** CSS class for textarea element */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** CSS class for container */\n\tclassNameContainer?: string | string[] | Record<string, boolean>;\n\t/** Disable the textarea */\n\tdisabled?: boolean;\n\t/** @deprecated Use `labels.error` and `hasError` instead. */\n\terrorText?: string;\n\t/** Puts the textarea in an error state and shows `labels.error` */\n\thasError?: boolean;\n\t/** Unique ID */\n\tid?: string;\n\t/** @deprecated Use `labels.label` instead. */\n\tlabel?: string;\n\t/**\n\t * **Text labels for internationalization**\n\t * * `error`: Error message shown below the textarea while `hasError` is true\n\t * * `label`: Visible label. Use `assistiveText.label` for a visually hidden label.\n\t */\n\tlabels?: TextareaLabels;\n\t/** Maximum character count */\n\tmaxLength?: number;\n\t/** Form parameter name */\n\tname?: string;\n\t/** Blur event handler */\n\tonBlur?: (event: FocusEvent<HTMLTextAreaElement>) => void;\n\t/**\n\t * Called when the text changes. Textarea is controlled: update `value` from\n\t * `data.value`, or the text won't change.\n\t */\n\tonChange: (\n\t\tevent: ChangeEvent<HTMLTextAreaElement>,\n\t\tdata: TextareaChangeData\n\t) => void;\n\t/** Click event handler */\n\tonClick?: (event: MouseEvent<HTMLTextAreaElement>) => void;\n\t/** Focus event handler */\n\tonFocus?: (event: FocusEvent<HTMLTextAreaElement>) => void;\n\t/** Input event handler */\n\tonInput?: (event: FormEvent<HTMLTextAreaElement>) => void;\n\t/** Invalid event handler */\n\tonInvalid?: (event: FormEvent<HTMLTextAreaElement>) => void;\n\t/** Key down event handler */\n\tonKeyDown?: (event: KeyboardEvent<HTMLTextAreaElement>) => void;\n\t/** Key press event handler */\n\tonKeyPress?: (event: KeyboardEvent<HTMLTextAreaElement>) => void;\n\t/** Key up event handler */\n\tonKeyUp?: (event: KeyboardEvent<HTMLTextAreaElement>) => void;\n\t/** Select event handler */\n\tonSelect?: (event: FormEvent<HTMLTextAreaElement>) => void;\n\t/** Submit event handler */\n\tonSubmit?: (event: FormEvent<HTMLTextAreaElement>) => void;\n\t/** Placeholder text */\n\tplaceholder?: string;\n\t/** Mark as required field */\n\trequired?: boolean;\n\t/** ARIA role */\n\trole?: string;\n\t/** The text in the textarea. Required: Textarea is controlled. */\n\tvalue: string;\n\t/** Text wrapping mode */\n\twrap?: 'soft' | 'hard';\n\t/** Custom styles */\n\tstyle?: CSSProperties;\n}\n\n/**\n * A multi-line plain-text editing control.\n */\nconst Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n\t(props, ref) => {\n\t\tconst {\n\t\t\tassistiveText,\n\t\t\tautoFocus,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tclassNameContainer,\n\t\t\tdisabled,\n\t\t\terrorText,\n\t\t\thasError: hasErrorProp,\n\t\t\tid: propId,\n\t\t\tlabel: labelProp,\n\t\t\tlabels,\n\t\t\tmaxLength,\n\t\t\tname,\n\t\t\tonBlur,\n\t\t\tonChange,\n\t\t\tonClick,\n\t\t\tonFocus,\n\t\t\tonInput,\n\t\t\tonInvalid,\n\t\t\tonKeyDown,\n\t\t\tonKeyPress,\n\t\t\tonKeyUp,\n\t\t\tonSelect,\n\t\t\tonSubmit,\n\t\t\tplaceholder,\n\t\t\trequired,\n\t\t\trole,\n\t\t\tvalue,\n\t\t\t// Removed in v11: destructured so it doesn't reach the DOM. check-props warns.\n\t\t\tdefaultValue: _defaultValue,\n\t\t\twrap,\n\t\t\t...restProps\n\t\t} = props as TextareaProps & TextareaRemovedProps;\n\n\t\tcheckProps(TEXTAREA, { ...props }, componentDoc);\n\n\t\tconst generatedId = useId();\n\t\tconst generatedErrorId = useId();\n\n\t\tconst getId = () => propId || generatedId;\n\t\tconst getErrorId = () => restProps['aria-describedby'] || generatedErrorId;\n\n\t\tconst ariaProps = getAriaProps(restProps);\n\n\t\tconst assistiveTextLabel = assistiveText?.label;\n\n\t\t// `label` is deprecated\n\t\tconst label = labels?.label ?? labelProp;\n\t\tconst labelText = label || assistiveTextLabel;\n\n\t\t// `errorText` is deprecated: it sets both the error state and the message\n\t\tconst hasError = hasErrorProp ?? !!errorText;\n\t\tconst errorMessage = hasError ? (labels?.error ?? errorText) : undefined;\n\n\t\tuseEffect(() => {\n\t\t\tcheckProps(\n\t\t\t\tTEXTAREA,\n\t\t\t\t{ assistiveText, errorText, label: labelProp, labels },\n\t\t\t\tcomponentDoc\n\t\t\t);\n\t\t}, [assistiveText, errorText, labelProp, labels]);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-form-element',\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-has-error': hasError,\n\t\t\t\t\t},\n\t\t\t\t\tclassNameContainer as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{labelText && (\n\t\t\t\t\t<label\n\t\t\t\t\t\tclassName={classNames('slds-form-element__label', {\n\t\t\t\t\t\t\t'slds-assistive-text': assistiveTextLabel && !label,\n\t\t\t\t\t\t})}\n\t\t\t\t\t\thtmlFor={getId()}\n\t\t\t\t\t>\n\t\t\t\t\t\t{required && (\n\t\t\t\t\t\t\t<abbr className=\"slds-required\" title=\"required\">\n\t\t\t\t\t\t\t\t*\n\t\t\t\t\t\t\t</abbr>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{labelText}\n\t\t\t\t\t</label>\n\t\t\t\t)}\n\t\t\t\t<div className=\"slds-form-element__control\">\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tclassName={classNames('slds-textarea', className as string)}\n\t\t\t\t\t\tautoFocus={autoFocus}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tid={getId()}\n\t\t\t\t\t\tmaxLength={\n\t\t\t\t\t\t\t// Strings are still accepted at runtime for untyped callers; check-props warns.\n\t\t\t\t\t\t\ttypeof maxLength === 'string'\n\t\t\t\t\t\t\t\t? parseInt(maxLength, 10)\n\t\t\t\t\t\t\t\t: maxLength\n\t\t\t\t\t\t}\n\t\t\t\t\t\tname={name}\n\t\t\t\t\t\tonBlur={onBlur}\n\t\t\t\t\t\tonChange={(event) => {\n\t\t\t\t\t\t\tonChange?.(event, { value: event.target.value });\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonClick={onClick}\n\t\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\t\tonInput={onInput}\n\t\t\t\t\t\tonInvalid={onInvalid}\n\t\t\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\t\t\tonKeyPress={onKeyPress}\n\t\t\t\t\t\tonKeyUp={onKeyUp}\n\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t\tonSubmit={onSubmit}\n\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\trole={role}\n\t\t\t\t\t\trequired={required}\n\t\t\t\t\t\twrap={wrap}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\terrorMessage\n\t\t\t\t\t\t\t\t? getErrorId()\n\t\t\t\t\t\t\t\t: ((ariaProps as Record<string, unknown>)[\n\t\t\t\t\t\t\t\t\t\t'aria-describedby'\n\t\t\t\t\t\t\t\t\t] as string | undefined)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{...ariaProps}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{errorMessage && (\n\t\t\t\t\t<div id={getErrorId()} className=\"slds-form-element__help\">\n\t\t\t\t\t\t{errorMessage}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nTextarea.displayName = TEXTAREA;\n\nexport default Textarea;\n"],"mappings":";;;;;;;;AA2JA,IAAM,IAAW,GACf,GAAO,MAAQ;CACf,IAAM,EACL,kBACA,cACA,aACA,cACA,uBACA,aACA,cACA,UAAU,GACV,IAAI,GACJ,OAAO,GACP,WACA,cACA,SACA,WACA,aACA,YACA,YACA,YACA,cACA,cACA,eACA,YACA,aACA,aACA,gBACA,aACA,SACA,UAEA,cAAc,GACd,SACA,GAAG,MACA;CAEJ,EAAW,GAAU,EAAE,GAAG,EAAM,GAAG,CAAY;CAE/C,IAAM,IAAc,EAAM,GACpB,IAAmB,EAAM,GAEzB,UAAc,KAAU,GACxB,UAAmB,EAAU,uBAAuB,GAEpD,IAAY,EAAa,CAAS,GAElC,IAAqB,GAAe,OAGpC,IAAQ,GAAQ,SAAS,GACzB,IAAY,KAAS,GAGrB,IAAW,KAAgB,CAAC,CAAC,GAC7B,IAAe,IAAY,GAAQ,SAAS,IAAa,KAAA;CAU/D,OARA,QAAgB;EACf,EACC,GACA;GAAE;GAAe;GAAW,OAAO;GAAW;EAAO,GACrD,CACD;CACD,GAAG;EAAC;EAAe;EAAW;EAAW;CAAM,CAAC,GAG/C,kBAAC,OAAD;EACC,WAAW,EACV,qBACA,EACC,kBAAkB,EACnB,GACA,CACD;EAPD,UAAA;GASE,KACA,kBAAC,SAAD;IACC,WAAW,EAAW,4BAA4B,EACjD,uBAAuB,KAAsB,CAAC,EAC/C,CAAC;IACD,SAAS,EAAM;IAJhB,UAAA,CAME,KACA,kBAAC,QAAD;KAAM,WAAU;KAAgB,OAAM;KAAW,UAAA;IAE3C,CAAA,GAEN,CACK;;GAER,kBAAC,OAAD;IAAK,WAAU;IACd,UAAA,kBAAC,YAAD;KACC,WAAW,EAAW,iBAAiB,CAAmB;KAC/C;KACD;KACV,IAAI,EAAM;KACV,WAEC,OAAO,KAAc,WAClB,SAAS,GAAW,EAAE,IACtB;KAEE;KACE;KACR,WAAW,MAAU;MACpB,IAAW,GAAO,EAAE,OAAO,EAAM,OAAO,MAAM,CAAC;KAChD;KACS;KACA;KACA;KACE;KACA;KACC;KACH;KACC;KACA;KACG;KACR;KACC;KACI;KACJ;KACC;KACP,oBACC,IACG,EAAW,IACT,EACF;KAGJ,GAAI;IACJ,CAAA;GACG,CAAA;GACJ,KACA,kBAAC,OAAD;IAAK,IAAI,EAAW;IAAG,WAAU;IAC/B,UAAA;GACG,CAAA;GAEL;EACG;;AAEP,CACD;AAEA,EAAS,cAAc"}
|
|
@@ -7,7 +7,7 @@ var i = class extends n.Component {
|
|
|
7
7
|
static displayName = e;
|
|
8
8
|
render() {
|
|
9
9
|
return /* @__PURE__ */ r("div", {
|
|
10
|
-
className: t("slds-
|
|
10
|
+
className: t("slds-notify_container", this.props.className),
|
|
11
11
|
children: this.props.children
|
|
12
12
|
});
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.js","names":[],"sources":["../../../../components/toast/container.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// # Toast Container Component\n\nimport React, { type ReactNode } from 'react';\nimport classNames from '../../utilities/class-names';\nimport { TOAST_CONTAINER } from '../../utilities/constants';\n\nexport interface ToastContainerProps {\n\t/**\n\t * CSS classes to be added to tag with `.slds-
|
|
1
|
+
{"version":3,"file":"container.js","names":[],"sources":["../../../../components/toast/container.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// # Toast Container Component\n\nimport React, { type ReactNode } from 'react';\nimport classNames from '../../utilities/class-names';\nimport { TOAST_CONTAINER } from '../../utilities/constants';\n\nexport interface ToastContainerProps {\n\t/**\n\t * CSS classes to be added to tag with `.slds-notify_container`. Uses `classNames` [API](https://github.com/JedWatson/classnames).\n\t */\n\tclassName?: unknown[] | Record<string, unknown> | string;\n\t/**\n\t * Toast components\n\t */\n\tchildren?: ReactNode;\n}\n\n/**\n * A fixed container for toast banners.\n */\n\nclass ToastContainer extends React.Component<ToastContainerProps> {\n\tstatic displayName = TOAST_CONTAINER;\n\n\trender() {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-notify_container',\n\t\t\t\t\tthis.props.className as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{this.props.children}\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default ToastContainer;\n"],"mappings":";;;;;AAwBA,IAAM,IAAN,cAA6B,EAAM,UAA+B;CACjE,OAAO,cAAc;CAErB,SAAS;EACR,OACC,kBAAC,OAAD;GACC,WAAW,EACV,yBACA,KAAK,MAAM,SACZ;GAEC,UAAA,KAAK,MAAM;EACR,CAAA;CAEP;AACD"}
|
|
@@ -1,76 +1,87 @@
|
|
|
1
1
|
import { POPOVER_TOOLTIP as e } from "../../utilities/constants.js";
|
|
2
2
|
import { IconSettingsContext as t } from "../icon-settings/index.js";
|
|
3
3
|
import n from "../../utilities/event.js";
|
|
4
|
-
import r from "../../utilities/
|
|
5
|
-
import i from "
|
|
6
|
-
import a from "../
|
|
4
|
+
import { useControllableState as r } from "../../utilities/hooks/use-controllable-state.js";
|
|
5
|
+
import i from "../../utilities/generate-id.js";
|
|
6
|
+
import a from "../utilities/dialog/index.js";
|
|
7
|
+
import o from "../icon/index.js";
|
|
7
8
|
import ee from "./check-props.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import s, { useCallback as c, useContext as
|
|
9
|
+
import te from "./component.js";
|
|
10
|
+
import ne from "../button/index.js";
|
|
11
|
+
import s, { useCallback as c, useContext as l, useEffect as u, useRef as d, useState as re } from "react";
|
|
11
12
|
import f from "classnames";
|
|
12
|
-
import { Fragment as
|
|
13
|
+
import { Fragment as ie, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
13
14
|
//#region components/tooltip/index.tsx
|
|
14
|
-
var
|
|
15
|
+
var ae = {
|
|
15
16
|
tooltipTipLearnMoreIcon: "this link",
|
|
16
17
|
triggerLearnMoreIcon: "Help"
|
|
17
|
-
},
|
|
18
|
+
}, h = {
|
|
18
19
|
learnMoreAfter: "to learn more.",
|
|
19
20
|
learnMoreBefore: "Click"
|
|
20
|
-
},
|
|
21
|
-
let
|
|
22
|
-
...
|
|
23
|
-
...
|
|
24
|
-
},
|
|
25
|
-
...
|
|
26
|
-
...
|
|
27
|
-
},
|
|
28
|
-
|
|
21
|
+
}, g = ({ align: g = "top", assistiveText: oe, children: _, content: v = /* @__PURE__ */ p("span", { children: "Tooltip" }), dialogClassName: y, hasAnchoredNubbin: b = !1, hasStaticAlignment: x = !1, hoverCloseDelay: S = 50, hoverOpenDelay: C = 0, iconVariant: w = "bare", id: T, labels: se, isOpen: E, defaultIsOpen: ce = !1, onRequestOpen: D, onRequestClose: O, onRequestTargetElement: k, onClickTrigger: A, triggerClassName: j, position: M = "absolute", triggerStyle: N, theme: P = "info", variant: F = "base" }) => {
|
|
22
|
+
let I = {
|
|
23
|
+
...ae,
|
|
24
|
+
...oe
|
|
25
|
+
}, L = {
|
|
26
|
+
...h,
|
|
27
|
+
...se
|
|
28
|
+
}, le = l(t), [R, z] = r(E, ce), [B, V] = re(!1), H = d(null), U = d(null), ue = d(i()), W = d(!1), G = d(R);
|
|
29
|
+
u(() => {
|
|
30
|
+
G.current = R;
|
|
31
|
+
}, [R]), u(() => {
|
|
29
32
|
ee(e, {
|
|
30
|
-
align:
|
|
31
|
-
assistiveText:
|
|
32
|
-
children:
|
|
33
|
-
content:
|
|
34
|
-
dialogClassName:
|
|
35
|
-
hasAnchoredNubbin:
|
|
36
|
-
hasStaticAlignment:
|
|
37
|
-
hoverCloseDelay:
|
|
38
|
-
hoverOpenDelay:
|
|
39
|
-
iconVariant:
|
|
40
|
-
id:
|
|
41
|
-
labels:
|
|
42
|
-
isOpen:
|
|
43
|
-
onRequestTargetElement:
|
|
44
|
-
onClickTrigger:
|
|
45
|
-
triggerClassName:
|
|
46
|
-
position:
|
|
47
|
-
triggerStyle:
|
|
48
|
-
theme:
|
|
49
|
-
variant:
|
|
50
|
-
},
|
|
51
|
-
}, []),
|
|
52
|
-
|
|
33
|
+
align: g,
|
|
34
|
+
assistiveText: I,
|
|
35
|
+
children: _,
|
|
36
|
+
content: v,
|
|
37
|
+
dialogClassName: y,
|
|
38
|
+
hasAnchoredNubbin: b,
|
|
39
|
+
hasStaticAlignment: x,
|
|
40
|
+
hoverCloseDelay: S,
|
|
41
|
+
hoverOpenDelay: C,
|
|
42
|
+
iconVariant: w,
|
|
43
|
+
id: T,
|
|
44
|
+
labels: L,
|
|
45
|
+
isOpen: E,
|
|
46
|
+
onRequestTargetElement: k,
|
|
47
|
+
onClickTrigger: A,
|
|
48
|
+
triggerClassName: j,
|
|
49
|
+
position: M,
|
|
50
|
+
triggerStyle: N,
|
|
51
|
+
theme: P,
|
|
52
|
+
variant: F
|
|
53
|
+
}, te);
|
|
54
|
+
}, []), u(() => () => {
|
|
55
|
+
W.current = !0, U.current && clearTimeout(U.current);
|
|
53
56
|
}, []);
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
}, [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
57
|
+
let K = c(() => T || ue.current, [T]), q = c(() => R, [R]), de = c(() => k ? k() : H.current, [k]), J = () => {
|
|
58
|
+
U.current && clearTimeout(U.current);
|
|
59
|
+
}, Y = c((e, t) => {
|
|
60
|
+
W.current || G.current || (D?.(e, { trigger: t }), z(!0));
|
|
61
|
+
}, [D, z]), X = c((e, t) => {
|
|
62
|
+
W.current || !G.current || (O?.(e, { trigger: t }), z(!1));
|
|
63
|
+
}, [O, z]), fe = c((e, t) => {
|
|
64
|
+
J(), !t?.componentWillUnmount && X(e, e ? "blur" : "clickOutside");
|
|
65
|
+
}, [X]), pe = c((e) => {
|
|
66
|
+
J(), X(e, "mouseLeave");
|
|
67
|
+
}, [X]), Z = c((e, t) => {
|
|
68
|
+
J(), U.current = setTimeout(() => {
|
|
69
|
+
Y(e, t);
|
|
70
|
+
}, C);
|
|
71
|
+
}, [C, Y]), me = c((e) => Z(e, "mouseEnter"), [Z]), he = c((e) => Z(e, "focus"), [Z]), Q = c((e, t) => {
|
|
72
|
+
e.stopPropagation(), J(), U.current = setTimeout(() => {
|
|
73
|
+
let n = e.relatedTarget;
|
|
74
|
+
n?.classList?.contains("slds-popover_tooltip") || n?.classList?.contains("slds-popover__body") || X(e, t);
|
|
75
|
+
}, S);
|
|
76
|
+
}, [S, X]), ge = c((e) => Q(e, "mouseLeave"), [Q]), _e = c((e) => Q(e, "blur"), [Q]), $ = c((e) => {
|
|
77
|
+
e.stopPropagation(), U.current = setTimeout(() => {
|
|
78
|
+
e.key === "Escape" && X(e, "cancel");
|
|
79
|
+
}, S);
|
|
80
|
+
}, [S, X]), ve = c((e) => {
|
|
81
|
+
e && H.current !== e && (H.current = e, B || V(!0));
|
|
82
|
+
}, [B]), ye = () => {
|
|
83
|
+
if (!b) return null;
|
|
84
|
+
let e = g.split(" ")[0], t = {
|
|
74
85
|
height: "0",
|
|
75
86
|
position: "relative",
|
|
76
87
|
width: "0"
|
|
@@ -82,8 +93,8 @@ var g = {
|
|
|
82
93
|
transform: "rotate(45deg)",
|
|
83
94
|
width: "1rem"
|
|
84
95
|
}, r = {
|
|
85
|
-
height:
|
|
86
|
-
width:
|
|
96
|
+
height: H.current ? H.current.getBoundingClientRect().height : 0,
|
|
97
|
+
width: H.current ? H.current.getBoundingClientRect().width : 0
|
|
87
98
|
};
|
|
88
99
|
switch (e) {
|
|
89
100
|
case "bottom":
|
|
@@ -97,95 +108,95 @@ var g = {
|
|
|
97
108
|
break;
|
|
98
109
|
default: t.left = `${r.width / 2}px`, t.top = "0", n.left = "-8px", n.top = "-19px";
|
|
99
110
|
}
|
|
100
|
-
return /* @__PURE__ */
|
|
111
|
+
return /* @__PURE__ */ m(ie, { children: [/* @__PURE__ */ p("style", { children: `#${K()}:after, #${K()}:before {
|
|
101
112
|
display: none;
|
|
102
|
-
}` }),
|
|
113
|
+
}` }), q() ? /* @__PURE__ */ p("div", {
|
|
103
114
|
style: t,
|
|
104
|
-
children: /* @__PURE__ */
|
|
115
|
+
children: /* @__PURE__ */ p("div", { style: n })
|
|
105
116
|
}) : null] });
|
|
106
|
-
},
|
|
107
|
-
let e, t = s.Children.count(
|
|
108
|
-
return e = t &&
|
|
117
|
+
}, be = () => {
|
|
118
|
+
let e, t = s.Children.count(_) === 0, r = w === "inverse", i = w === "error" || w === "warning" ? w : void 0;
|
|
119
|
+
return e = t && A ? /* @__PURE__ */ p("a", {
|
|
109
120
|
href: "#",
|
|
110
|
-
onClick: n.trappedHandler(
|
|
111
|
-
children: /* @__PURE__ */
|
|
121
|
+
onClick: n.trappedHandler(A),
|
|
122
|
+
children: /* @__PURE__ */ p(o, {
|
|
112
123
|
category: "utility",
|
|
113
124
|
colorVariant: i,
|
|
114
125
|
inverse: r,
|
|
115
126
|
name: "info",
|
|
116
|
-
assistiveText: { label:
|
|
127
|
+
assistiveText: { label: I.triggerLearnMoreIcon },
|
|
117
128
|
size: "x-small"
|
|
118
129
|
})
|
|
119
|
-
}) : t ? /* @__PURE__ */
|
|
130
|
+
}) : t ? /* @__PURE__ */ p(ne, {
|
|
120
131
|
"aria-disabled": !0,
|
|
121
|
-
assistiveText: { icon:
|
|
132
|
+
assistiveText: { icon: I.triggerLearnMoreIcon },
|
|
122
133
|
iconCategory: "utility",
|
|
123
134
|
iconClassName: i && `slds-icon-text-${i}`,
|
|
124
135
|
iconName: "info",
|
|
125
136
|
iconVariant: r ? "bare" : void 0,
|
|
126
137
|
inverse: r,
|
|
127
138
|
variant: "icon"
|
|
128
|
-
}) :
|
|
139
|
+
}) : _, s.Children.map(e, (e, t) => s.isValidElement(e) ? s.cloneElement(e, {
|
|
129
140
|
key: t,
|
|
130
|
-
"aria-describedby":
|
|
131
|
-
onBlur:
|
|
132
|
-
onFocus:
|
|
133
|
-
onMouseEnter:
|
|
134
|
-
onMouseLeave:
|
|
141
|
+
"aria-describedby": q() ? K() : void 0,
|
|
142
|
+
onBlur: _e,
|
|
143
|
+
onFocus: he,
|
|
144
|
+
onMouseEnter: me,
|
|
145
|
+
onMouseLeave: ge,
|
|
135
146
|
onKeyDown: $
|
|
136
147
|
}) : e);
|
|
137
|
-
},
|
|
138
|
-
className: f("slds-popover__body", { "slds-text-color_inverse":
|
|
139
|
-
children: [
|
|
148
|
+
}, xe = () => /* @__PURE__ */ m("div", {
|
|
149
|
+
className: f("slds-popover__body", { "slds-text-color_inverse": P === "error" }),
|
|
150
|
+
children: [v, F === "learnMore" && A ? /* @__PURE__ */ m("div", {
|
|
140
151
|
className: "slds-m-top_x-small",
|
|
141
152
|
"aria-hidden": "true",
|
|
142
153
|
children: [
|
|
143
|
-
|
|
154
|
+
L.learnMoreBefore,
|
|
144
155
|
" ",
|
|
145
|
-
/* @__PURE__ */
|
|
146
|
-
assistiveText: { label:
|
|
156
|
+
/* @__PURE__ */ p(o, {
|
|
157
|
+
assistiveText: { label: I.tooltipTipLearnMoreIcon },
|
|
147
158
|
category: "utility",
|
|
148
159
|
inverse: !0,
|
|
149
160
|
name: "info",
|
|
150
161
|
size: "x-small"
|
|
151
162
|
}),
|
|
152
163
|
" ",
|
|
153
|
-
|
|
164
|
+
L.learnMoreAfter,
|
|
154
165
|
" "
|
|
155
166
|
]
|
|
156
167
|
}) : null]
|
|
157
|
-
}),
|
|
168
|
+
}), Se = () => q() ? /* @__PURE__ */ p(a, {
|
|
158
169
|
closeOnTabKey: !0,
|
|
159
170
|
hasNubbin: !0,
|
|
160
|
-
contentsClassName: f("slds-popover", "slds-popover_tooltip", { "slds-theme_error":
|
|
161
|
-
align:
|
|
162
|
-
context:
|
|
163
|
-
hasStaticAlignment:
|
|
164
|
-
onClose:
|
|
165
|
-
onRequestTargetElement:
|
|
166
|
-
onMouseLeave:
|
|
167
|
-
position:
|
|
171
|
+
contentsClassName: f("slds-popover", "slds-popover_tooltip", { "slds-theme_error": P === "error" }, y),
|
|
172
|
+
align: g,
|
|
173
|
+
context: le,
|
|
174
|
+
hasStaticAlignment: x,
|
|
175
|
+
onClose: fe,
|
|
176
|
+
onRequestTargetElement: de,
|
|
177
|
+
onMouseLeave: pe,
|
|
178
|
+
position: M,
|
|
168
179
|
variant: "tooltip",
|
|
169
|
-
containerProps: { id:
|
|
170
|
-
children:
|
|
171
|
-
}) : /* @__PURE__ */
|
|
180
|
+
containerProps: { id: K() },
|
|
181
|
+
children: xe()
|
|
182
|
+
}) : /* @__PURE__ */ p("span", {}), Ce = {
|
|
172
183
|
display: "inline-block",
|
|
173
184
|
lineHeight: "1",
|
|
174
|
-
...
|
|
185
|
+
...N
|
|
175
186
|
};
|
|
176
|
-
return /* @__PURE__ */
|
|
177
|
-
className: f("slds-tooltip-trigger",
|
|
178
|
-
style:
|
|
179
|
-
ref:
|
|
187
|
+
return /* @__PURE__ */ m("div", {
|
|
188
|
+
className: f("slds-tooltip-trigger", j),
|
|
189
|
+
style: Ce,
|
|
190
|
+
ref: ve,
|
|
180
191
|
children: [
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
192
|
+
ye(),
|
|
193
|
+
be(),
|
|
194
|
+
Se()
|
|
184
195
|
]
|
|
185
196
|
});
|
|
186
197
|
};
|
|
187
|
-
|
|
198
|
+
g.displayName = e;
|
|
188
199
|
//#endregion
|
|
189
|
-
export {
|
|
200
|
+
export { g as default };
|
|
190
201
|
|
|
191
202
|
//# sourceMappingURL=index.js.map
|