@salesforce/design-system-react 11.0.0-rc.0 → 11.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -1
- package/dist/cjs/components/accordion/index.cjs +1 -1
- package/dist/cjs/components/accordion/index.cjs.map +1 -1
- package/dist/cjs/components/accordion/panel.cjs.map +1 -1
- package/dist/cjs/components/alert/index.cjs +1 -1
- package/dist/cjs/components/alert/index.cjs.map +1 -1
- package/dist/cjs/components/builder-header/nav-dropdown.cjs.map +1 -1
- package/dist/cjs/components/builder-header/nav-link.cjs.map +1 -1
- package/dist/cjs/components/builder-header/toolbar.cjs.map +1 -1
- package/dist/cjs/components/button/check-props.cjs +1 -1
- package/dist/cjs/components/button/check-props.cjs.map +1 -1
- package/dist/cjs/components/button/index.cjs +1 -1
- package/dist/cjs/components/button/index.cjs.map +1 -1
- package/dist/cjs/components/button-stateful/check-props.cjs +1 -1
- package/dist/cjs/components/button-stateful/check-props.cjs.map +1 -1
- package/dist/cjs/components/button-stateful/index.cjs +1 -1
- package/dist/cjs/components/button-stateful/index.cjs.map +1 -1
- package/dist/cjs/components/carousel/index.cjs +1 -1
- package/dist/cjs/components/carousel/index.cjs.map +1 -1
- package/dist/cjs/components/carousel/private/carousel-indicators.cjs.map +1 -1
- package/dist/cjs/components/carousel/private/carousel-item.cjs +1 -1
- package/dist/cjs/components/carousel/private/carousel-item.cjs.map +1 -1
- package/dist/cjs/components/checkbox/check-props.cjs +1 -1
- package/dist/cjs/components/checkbox/check-props.cjs.map +1 -1
- package/dist/cjs/components/checkbox/index.cjs +1 -1
- package/dist/cjs/components/checkbox/index.cjs.map +1 -1
- package/dist/cjs/components/color-picker/color-picker.cjs +1 -1
- package/dist/cjs/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/cjs/components/color-picker/private/custom-color.cjs.map +1 -1
- package/dist/cjs/components/color-picker/private/hsv-color.cjs +1 -1
- package/dist/cjs/components/color-picker/private/hsv-color.cjs.map +1 -1
- package/dist/cjs/components/color-picker/private/swatch-option.cjs +1 -1
- package/dist/cjs/components/color-picker/private/swatch-option.cjs.map +1 -1
- package/dist/cjs/components/color-picker/private/swatch.cjs +1 -1
- package/dist/cjs/components/color-picker/private/swatch.cjs.map +1 -1
- package/dist/cjs/components/combobox/combobox.cjs +1 -1
- package/dist/cjs/components/combobox/combobox.cjs.map +1 -1
- package/dist/cjs/components/combobox/index.cjs +1 -1
- package/dist/cjs/components/combobox/index.cjs.map +1 -1
- package/dist/cjs/components/combobox/private/menu.cjs +1 -1
- package/dist/cjs/components/combobox/private/menu.cjs.map +1 -1
- package/dist/cjs/components/date-picker/date-picker.cjs +1 -1
- package/dist/cjs/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/cjs/components/date-picker/index.cjs.map +1 -1
- package/dist/cjs/components/date-picker/private/calendar.cjs.map +1 -1
- package/dist/cjs/components/date-picker/private/day.cjs +1 -1
- package/dist/cjs/components/date-picker/private/day.cjs.map +1 -1
- package/dist/cjs/components/files/file.cjs +1 -8
- package/dist/cjs/components/files/file.cjs.map +1 -1
- package/dist/cjs/components/files/private/file-actions.cjs +1 -1
- package/dist/cjs/components/files/private/file-actions.cjs.map +1 -1
- package/dist/cjs/components/files/private/file-figure.cjs +1 -1
- package/dist/cjs/components/files/private/file-figure.cjs.map +1 -1
- package/dist/cjs/components/filter/filter.cjs +1 -1
- package/dist/cjs/components/filter/filter.cjs.map +1 -1
- package/dist/cjs/components/icon/check-props.cjs +1 -1
- package/dist/cjs/components/icon/check-props.cjs.map +1 -1
- package/dist/cjs/components/icon/index.cjs +1 -1
- package/dist/cjs/components/icon/index.cjs.map +1 -1
- package/dist/cjs/components/icon/input-icon/index.cjs.map +1 -1
- package/dist/cjs/components/icon-settings/index.cjs.map +1 -1
- package/dist/cjs/components/input/check-props.cjs +1 -1
- package/dist/cjs/components/input/check-props.cjs.map +1 -1
- package/dist/cjs/components/input/index.cjs.map +1 -1
- package/dist/cjs/components/input/private/inner-input.cjs.map +1 -1
- package/dist/cjs/components/input/search.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/button-trigger.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs +1 -1
- package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs.map +1 -1
- package/dist/cjs/components/modal/index.cjs +1 -1
- package/dist/cjs/components/modal/index.cjs.map +1 -1
- package/dist/cjs/components/panel/filtering/group.cjs.map +1 -1
- package/dist/cjs/components/pill/index.cjs.map +1 -1
- package/dist/cjs/components/pill-container/index.cjs +1 -1
- package/dist/cjs/components/pill-container/index.cjs.map +1 -1
- package/dist/cjs/components/popover/edit-dialog.cjs.map +1 -1
- package/dist/cjs/components/popover/index.cjs.map +1 -1
- package/dist/cjs/components/popover/popover.cjs +1 -1
- package/dist/cjs/components/popover/popover.cjs.map +1 -1
- package/dist/cjs/components/progress-indicator/index.cjs.map +1 -1
- package/dist/cjs/components/progress-indicator/private/step.cjs.map +1 -1
- package/dist/cjs/components/progress-ring/index.cjs.map +1 -1
- package/dist/cjs/components/radio/index.cjs +1 -1
- package/dist/cjs/components/radio/index.cjs.map +1 -1
- package/dist/cjs/components/radio-group/check-props.cjs.map +1 -1
- package/dist/cjs/components/radio-group/index.cjs.map +1 -1
- package/dist/cjs/components/scoped-notification/index.cjs.map +1 -1
- package/dist/cjs/components/setup-assistant/step.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/cell.cjs +1 -1
- package/dist/cjs/components/simple-data-table/cell.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/index.cjs +1 -1
- package/dist/cjs/components/simple-data-table/index.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/interactive-element.cjs +1 -1
- package/dist/cjs/components/simple-data-table/interactive-element.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/cell-context.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/corner-style.cjs +2 -0
- package/dist/cjs/components/simple-data-table/private/corner-style.cjs.map +1 -0
- package/dist/cjs/components/simple-data-table/private/head.cjs +1 -1
- package/dist/cjs/components/simple-data-table/private/head.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/header-cell.cjs +1 -1
- package/dist/cjs/components/simple-data-table/private/header-cell.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/link.cjs +1 -1
- package/dist/cjs/components/simple-data-table/private/link.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/private/row.cjs +1 -1
- package/dist/cjs/components/simple-data-table/private/row.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/row-actions.cjs +1 -1
- package/dist/cjs/components/simple-data-table/row-actions.cjs.map +1 -1
- package/dist/cjs/components/slider/index.cjs.map +1 -1
- package/dist/cjs/components/split-view/header.cjs.map +1 -1
- package/dist/cjs/components/split-view/listbox.cjs.map +1 -1
- package/dist/cjs/components/split-view/private/list-item-with-content.cjs.map +1 -1
- package/dist/cjs/components/tabs/index.cjs.map +1 -1
- package/dist/cjs/components/tabs/panel.cjs.map +1 -1
- package/dist/cjs/components/tabs/private/tab.cjs +1 -1
- package/dist/cjs/components/tabs/private/tab.cjs.map +1 -1
- package/dist/cjs/components/textarea/check-props.cjs +1 -1
- package/dist/cjs/components/textarea/check-props.cjs.map +1 -1
- package/dist/cjs/components/textarea/index.cjs +1 -1
- package/dist/cjs/components/textarea/index.cjs.map +1 -1
- package/dist/cjs/components/toast/index.cjs.map +1 -1
- package/dist/cjs/components/tooltip/index.cjs +1 -3
- package/dist/cjs/components/tooltip/index.cjs.map +1 -1
- package/dist/cjs/components/tree/private/branch.cjs.map +1 -1
- package/dist/cjs/components/tree/private/item.cjs.map +1 -1
- package/dist/cjs/components/tree/private/render-branch.cjs +1 -1
- package/dist/cjs/components/tree/private/render-branch.cjs.map +1 -1
- package/dist/cjs/components/tree/tree.cjs.map +1 -1
- package/dist/cjs/components/trial-bar/button.cjs.map +1 -1
- package/dist/cjs/components/trial-bar/dropdown.cjs.map +1 -1
- package/dist/cjs/components/utilities/dialog/index.cjs +1 -1
- package/dist/cjs/components/utilities/dialog/index.cjs.map +1 -1
- package/dist/cjs/components/utilities/dialog/portal.cjs +1 -1
- package/dist/cjs/components/utilities/dialog/portal.cjs.map +1 -1
- package/dist/cjs/components/utilities/menu-list/index.cjs +1 -26
- package/dist/cjs/components/utilities/menu-list/index.cjs.map +1 -1
- package/dist/cjs/components/utilities/menu-list/item-label.cjs.map +1 -1
- package/dist/cjs/components/utilities/menu-list/item.cjs +1 -1
- package/dist/cjs/components/utilities/menu-list/item.cjs.map +1 -1
- package/dist/cjs/components/utilities/utility-icon/index.cjs +1 -1
- package/dist/cjs/components/utilities/utility-icon/index.cjs.map +1 -1
- package/dist/cjs/utilities/color.cjs +1 -1
- package/dist/cjs/utilities/color.cjs.map +1 -1
- package/dist/cjs/utilities/dom-element-focus.cjs.map +1 -1
- package/dist/cjs/utilities/execution-environment.cjs.map +1 -1
- package/dist/cjs/utilities/get-aria-props.cjs +1 -1
- package/dist/cjs/utilities/get-aria-props.cjs.map +1 -1
- package/dist/cjs/utilities/get-component-doc.cjs +1 -1
- package/dist/cjs/utilities/get-component-doc.cjs.map +1 -1
- package/dist/cjs/utilities/get-data-props.cjs +1 -1
- package/dist/cjs/utilities/get-data-props.cjs.map +1 -1
- package/dist/cjs/utilities/keyboard-navigable-dialog.cjs +1 -1
- package/dist/cjs/utilities/keyboard-navigable-dialog.cjs.map +1 -1
- package/dist/cjs/utilities/keyboard-navigate.cjs +1 -1
- package/dist/cjs/utilities/keyboard-navigate.cjs.map +1 -1
- package/dist/cjs/utilities/product-tokens/icon-backgrounds.cjs.map +1 -1
- package/dist/cjs/utilities/warning/children-as-trigger.cjs +1 -1
- package/dist/cjs/utilities/warning/children-as-trigger.cjs.map +1 -1
- package/dist/cjs/utilities/warning/deprecated-property-value.cjs +1 -1
- package/dist/cjs/utilities/warning/deprecated-property-value.cjs.map +1 -1
- package/dist/cjs/utilities/warning/deprecated-property.cjs +1 -1
- package/dist/cjs/utilities/warning/deprecated-property.cjs.map +1 -1
- package/dist/cjs/utilities/warning/has-children-without-display-name-of.cjs +1 -1
- package/dist/cjs/utilities/warning/has-children-without-display-name-of.cjs.map +1 -1
- package/dist/cjs/utilities/warning/if-one-then-both-required-property.cjs +1 -1
- package/dist/cjs/utilities/warning/if-one-then-both-required-property.cjs.map +1 -1
- package/dist/cjs/utilities/warning/is-trigger-tabbable.cjs +1 -1
- package/dist/cjs/utilities/warning/is-trigger-tabbable.cjs.map +1 -1
- package/dist/cjs/utilities/warning/low-priority-warning.cjs.map +1 -1
- package/dist/cjs/utilities/warning/one-of-required-property.cjs +1 -1
- package/dist/cjs/utilities/warning/one-of-required-property.cjs.map +1 -1
- package/dist/cjs/utilities/warning/only-one-of-properties.cjs +1 -1
- package/dist/cjs/utilities/warning/only-one-of-properties.cjs.map +1 -1
- package/dist/cjs/utilities/warning/removal-version.cjs +2 -0
- package/dist/cjs/utilities/warning/removal-version.cjs.map +1 -0
- package/dist/cjs/utilities/warning/render-function-return-contents-lack-display-name.cjs +1 -1
- package/dist/cjs/utilities/warning/render-function-return-contents-lack-display-name.cjs.map +1 -1
- package/dist/cjs/utilities/warning/required-property.cjs +1 -1
- package/dist/cjs/utilities/warning/required-property.cjs.map +1 -1
- package/dist/cjs/utilities/warning/sunset-property.cjs +1 -1
- package/dist/cjs/utilities/warning/sunset-property.cjs.map +1 -1
- package/dist/cjs/utilities/warning/warned-registry.cjs +2 -0
- package/dist/cjs/utilities/warning/warned-registry.cjs.map +1 -0
- package/dist/es/components/accordion/index.js +7 -3
- package/dist/es/components/accordion/index.js.map +1 -1
- package/dist/es/components/accordion/panel.js.map +1 -1
- package/dist/es/components/alert/index.js +4 -5
- package/dist/es/components/alert/index.js.map +1 -1
- package/dist/es/components/builder-header/nav-dropdown.js.map +1 -1
- package/dist/es/components/builder-header/nav-link.js.map +1 -1
- package/dist/es/components/builder-header/toolbar.js.map +1 -1
- package/dist/es/components/button/check-props.js +1 -1
- package/dist/es/components/button/check-props.js.map +1 -1
- package/dist/es/components/button/index.js +50 -50
- package/dist/es/components/button/index.js.map +1 -1
- package/dist/es/components/button-stateful/check-props.js +1 -1
- package/dist/es/components/button-stateful/check-props.js.map +1 -1
- package/dist/es/components/button-stateful/index.js +3 -2
- package/dist/es/components/button-stateful/index.js.map +1 -1
- package/dist/es/components/carousel/index.js +155 -129
- package/dist/es/components/carousel/index.js.map +1 -1
- package/dist/es/components/carousel/private/carousel-indicators.js.map +1 -1
- package/dist/es/components/carousel/private/carousel-item.js +1 -1
- package/dist/es/components/carousel/private/carousel-item.js.map +1 -1
- package/dist/es/components/checkbox/check-props.js +1 -1
- package/dist/es/components/checkbox/check-props.js.map +1 -1
- package/dist/es/components/checkbox/index.js +102 -100
- package/dist/es/components/checkbox/index.js.map +1 -1
- package/dist/es/components/color-picker/color-picker.js +150 -151
- package/dist/es/components/color-picker/color-picker.js.map +1 -1
- package/dist/es/components/color-picker/private/custom-color.js.map +1 -1
- package/dist/es/components/color-picker/private/hsv-color.js +16 -20
- package/dist/es/components/color-picker/private/hsv-color.js.map +1 -1
- package/dist/es/components/color-picker/private/swatch-option.js +2 -2
- package/dist/es/components/color-picker/private/swatch-option.js.map +1 -1
- package/dist/es/components/color-picker/private/swatch.js +1 -1
- package/dist/es/components/color-picker/private/swatch.js.map +1 -1
- package/dist/es/components/combobox/combobox.js +569 -582
- package/dist/es/components/combobox/combobox.js.map +1 -1
- package/dist/es/components/combobox/index.js +6 -19
- package/dist/es/components/combobox/index.js.map +1 -1
- package/dist/es/components/combobox/private/menu.js +3 -3
- package/dist/es/components/combobox/private/menu.js.map +1 -1
- package/dist/es/components/date-picker/date-picker.js +101 -102
- package/dist/es/components/date-picker/date-picker.js.map +1 -1
- package/dist/es/components/date-picker/index.js.map +1 -1
- package/dist/es/components/date-picker/private/calendar.js.map +1 -1
- package/dist/es/components/date-picker/private/day.js +1 -1
- package/dist/es/components/date-picker/private/day.js.map +1 -1
- package/dist/es/components/files/file.js +5 -6
- package/dist/es/components/files/file.js.map +1 -1
- package/dist/es/components/files/private/file-actions.js +2 -2
- package/dist/es/components/files/private/file-actions.js.map +1 -1
- package/dist/es/components/files/private/file-figure.js +1 -1
- package/dist/es/components/files/private/file-figure.js.map +1 -1
- package/dist/es/components/filter/filter.js +5 -1
- package/dist/es/components/filter/filter.js.map +1 -1
- package/dist/es/components/icon/check-props.js +9 -7
- package/dist/es/components/icon/check-props.js.map +1 -1
- package/dist/es/components/icon/index.js +13 -10
- package/dist/es/components/icon/index.js.map +1 -1
- package/dist/es/components/icon/input-icon/index.js.map +1 -1
- package/dist/es/components/icon-settings/index.js.map +1 -1
- package/dist/es/components/input/check-props.js +14 -13
- package/dist/es/components/input/check-props.js.map +1 -1
- package/dist/es/components/input/index.js.map +1 -1
- package/dist/es/components/input/private/inner-input.js.map +1 -1
- package/dist/es/components/input/search.js.map +1 -1
- package/dist/es/components/menu-dropdown/button-trigger.js.map +1 -1
- package/dist/es/components/menu-dropdown/menu-dropdown.js +202 -207
- package/dist/es/components/menu-dropdown/menu-dropdown.js.map +1 -1
- package/dist/es/components/modal/index.js +1 -2
- package/dist/es/components/modal/index.js.map +1 -1
- package/dist/es/components/panel/filtering/group.js.map +1 -1
- package/dist/es/components/pill/index.js.map +1 -1
- package/dist/es/components/pill-container/index.js +10 -6
- package/dist/es/components/pill-container/index.js.map +1 -1
- package/dist/es/components/popover/edit-dialog.js.map +1 -1
- package/dist/es/components/popover/index.js.map +1 -1
- package/dist/es/components/popover/popover.js +181 -177
- package/dist/es/components/popover/popover.js.map +1 -1
- package/dist/es/components/progress-indicator/index.js.map +1 -1
- package/dist/es/components/progress-indicator/private/step.js.map +1 -1
- package/dist/es/components/progress-ring/index.js.map +1 -1
- package/dist/es/components/radio/index.js +1 -1
- package/dist/es/components/radio/index.js.map +1 -1
- package/dist/es/components/radio-group/check-props.js.map +1 -1
- package/dist/es/components/radio-group/index.js.map +1 -1
- package/dist/es/components/scoped-notification/index.js.map +1 -1
- package/dist/es/components/setup-assistant/step.js.map +1 -1
- package/dist/es/components/simple-data-table/cell.js +8 -5
- package/dist/es/components/simple-data-table/cell.js.map +1 -1
- package/dist/es/components/simple-data-table/index.js +97 -91
- package/dist/es/components/simple-data-table/index.js.map +1 -1
- package/dist/es/components/simple-data-table/interactive-element.js +31 -28
- package/dist/es/components/simple-data-table/interactive-element.js.map +1 -1
- package/dist/es/components/simple-data-table/private/cell-context.js.map +1 -1
- package/dist/es/components/simple-data-table/private/corner-style.js +9 -0
- package/dist/es/components/simple-data-table/private/corner-style.js.map +1 -0
- package/dist/es/components/simple-data-table/private/head.js +65 -42
- package/dist/es/components/simple-data-table/private/head.js.map +1 -1
- package/dist/es/components/simple-data-table/private/header-cell.js +2 -1
- package/dist/es/components/simple-data-table/private/header-cell.js.map +1 -1
- package/dist/es/components/simple-data-table/private/link.js.map +1 -1
- package/dist/es/components/simple-data-table/private/row.js +96 -60
- package/dist/es/components/simple-data-table/private/row.js.map +1 -1
- package/dist/es/components/simple-data-table/row-actions.js +4 -1
- package/dist/es/components/simple-data-table/row-actions.js.map +1 -1
- package/dist/es/components/slider/index.js.map +1 -1
- package/dist/es/components/split-view/header.js.map +1 -1
- package/dist/es/components/split-view/listbox.js.map +1 -1
- package/dist/es/components/split-view/private/list-item-with-content.js.map +1 -1
- package/dist/es/components/tabs/index.js.map +1 -1
- package/dist/es/components/tabs/panel.js.map +1 -1
- package/dist/es/components/tabs/private/tab.js +1 -1
- package/dist/es/components/tabs/private/tab.js.map +1 -1
- package/dist/es/components/textarea/check-props.js +1 -1
- package/dist/es/components/textarea/check-props.js.map +1 -1
- package/dist/es/components/textarea/index.js +29 -42
- package/dist/es/components/textarea/index.js.map +1 -1
- package/dist/es/components/toast/index.js.map +1 -1
- package/dist/es/components/tooltip/index.js +107 -88
- package/dist/es/components/tooltip/index.js.map +1 -1
- package/dist/es/components/tree/private/branch.js.map +1 -1
- package/dist/es/components/tree/private/item.js.map +1 -1
- package/dist/es/components/tree/private/render-branch.js +14 -19
- package/dist/es/components/tree/private/render-branch.js.map +1 -1
- package/dist/es/components/tree/tree.js.map +1 -1
- package/dist/es/components/trial-bar/button.js.map +1 -1
- package/dist/es/components/trial-bar/dropdown.js.map +1 -1
- package/dist/es/components/utilities/dialog/index.js +2 -1
- package/dist/es/components/utilities/dialog/index.js.map +1 -1
- package/dist/es/components/utilities/dialog/portal.js +5 -3
- package/dist/es/components/utilities/dialog/portal.js.map +1 -1
- package/dist/es/components/utilities/menu-list/index.js +6 -6
- package/dist/es/components/utilities/menu-list/index.js.map +1 -1
- package/dist/es/components/utilities/menu-list/item-label.js.map +1 -1
- package/dist/es/components/utilities/menu-list/item.js +42 -18
- package/dist/es/components/utilities/menu-list/item.js.map +1 -1
- package/dist/es/components/utilities/utility-icon/index.js +32 -52
- package/dist/es/components/utilities/utility-icon/index.js.map +1 -1
- package/dist/es/utilities/color.js +1 -1
- package/dist/es/utilities/color.js.map +1 -1
- package/dist/es/utilities/dom-element-focus.js.map +1 -1
- package/dist/es/utilities/execution-environment.js.map +1 -1
- package/dist/es/utilities/get-aria-props.js +1 -1
- package/dist/es/utilities/get-aria-props.js.map +1 -1
- package/dist/es/utilities/get-component-doc.js +6 -6
- package/dist/es/utilities/get-component-doc.js.map +1 -1
- package/dist/es/utilities/get-data-props.js +1 -1
- package/dist/es/utilities/get-data-props.js.map +1 -1
- package/dist/es/utilities/keyboard-navigable-dialog.js +7 -7
- package/dist/es/utilities/keyboard-navigable-dialog.js.map +1 -1
- package/dist/es/utilities/keyboard-navigate.js +1 -1
- package/dist/es/utilities/keyboard-navigate.js.map +1 -1
- package/dist/es/utilities/product-tokens/icon-backgrounds.js.map +1 -1
- package/dist/es/utilities/warning/children-as-trigger.js +10 -8
- package/dist/es/utilities/warning/children-as-trigger.js.map +1 -1
- package/dist/es/utilities/warning/deprecated-property-value.js +12 -10
- package/dist/es/utilities/warning/deprecated-property-value.js.map +1 -1
- package/dist/es/utilities/warning/deprecated-property.js +10 -8
- package/dist/es/utilities/warning/deprecated-property.js.map +1 -1
- package/dist/es/utilities/warning/has-children-without-display-name-of.js +11 -10
- package/dist/es/utilities/warning/has-children-without-display-name-of.js.map +1 -1
- package/dist/es/utilities/warning/if-one-then-both-required-property.js +10 -9
- package/dist/es/utilities/warning/if-one-then-both-required-property.js.map +1 -1
- package/dist/es/utilities/warning/is-trigger-tabbable.js +9 -8
- package/dist/es/utilities/warning/is-trigger-tabbable.js.map +1 -1
- package/dist/es/utilities/warning/low-priority-warning.js.map +1 -1
- package/dist/es/utilities/warning/one-of-required-property.js +11 -10
- package/dist/es/utilities/warning/one-of-required-property.js.map +1 -1
- package/dist/es/utilities/warning/only-one-of-properties.js +9 -8
- package/dist/es/utilities/warning/only-one-of-properties.js.map +1 -1
- package/dist/es/utilities/warning/removal-version.js +6 -0
- package/dist/es/utilities/warning/removal-version.js.map +1 -0
- package/dist/es/utilities/warning/render-function-return-contents-lack-display-name.js +14 -13
- package/dist/es/utilities/warning/render-function-return-contents-lack-display-name.js.map +1 -1
- package/dist/es/utilities/warning/required-property.js +8 -7
- package/dist/es/utilities/warning/required-property.js.map +1 -1
- package/dist/es/utilities/warning/sunset-property.js +8 -7
- package/dist/es/utilities/warning/sunset-property.js.map +1 -1
- package/dist/es/utilities/warning/warned-registry.js +10 -0
- package/dist/es/utilities/warning/warned-registry.js.map +1 -0
- package/dist/llms/components/accordion.md +267 -0
- package/dist/llms/components/alert.md +228 -0
- package/dist/llms/components/avatar.md +167 -0
- package/dist/llms/components/badge.md +153 -0
- package/dist/llms/components/breadcrumb.md +148 -0
- package/dist/llms/components/builder-header.examples.md +239 -0
- package/dist/llms/components/builder-header.md +736 -0
- package/dist/llms/components/button-group.md +167 -0
- package/dist/llms/components/button-stateful.md +246 -0
- package/dist/llms/components/button.md +661 -0
- package/dist/llms/components/card.md +368 -0
- package/dist/llms/components/carousel.md +365 -0
- package/dist/llms/components/checkbox.md +887 -0
- package/dist/llms/components/color-picker.md +591 -0
- package/dist/llms/components/combobox.examples.md +802 -0
- package/dist/llms/components/combobox.md +929 -0
- package/dist/llms/components/date-picker.md +546 -0
- package/dist/llms/components/docked-composer.md +173 -0
- package/dist/llms/components/dynamic-icon.md +226 -0
- package/dist/llms/components/expandable-section.md +198 -0
- package/dist/llms/components/files.md +337 -0
- package/dist/llms/components/filter.md +775 -0
- package/dist/llms/components/icon-settings.md +301 -0
- package/dist/llms/components/icon.md +1040 -0
- package/dist/llms/components/input.md +746 -0
- package/dist/llms/components/media-object.md +125 -0
- package/dist/llms/components/menu-dropdown.md +732 -0
- package/dist/llms/components/modal.md +504 -0
- package/dist/llms/components/page-header.md +282 -0
- package/dist/llms/components/panel.md +256 -0
- package/dist/llms/components/pill-container.md +218 -0
- package/dist/llms/components/pill.md +266 -0
- package/dist/llms/components/popover.md +600 -0
- package/dist/llms/components/portal-settings.md +371 -0
- package/dist/llms/components/progress-bar.md +175 -0
- package/dist/llms/components/progress-indicator.md +399 -0
- package/dist/llms/components/progress-ring.md +146 -0
- package/dist/llms/components/radio-button-group.md +285 -0
- package/dist/llms/components/radio-group.md +242 -0
- package/dist/llms/components/radio.md +269 -0
- package/dist/llms/components/scoped-notification.md +156 -0
- package/dist/llms/components/setup-assistant.md +398 -0
- package/dist/llms/components/simple-data-table.examples.md +2773 -0
- package/dist/llms/components/simple-data-table.md +919 -0
- package/dist/llms/components/slider.md +217 -0
- package/dist/llms/components/spinner.md +232 -0
- package/dist/llms/components/split-view.md +350 -0
- package/dist/llms/components/tabs.md +311 -0
- package/dist/llms/components/textarea.md +331 -0
- package/dist/llms/components/toast.md +267 -0
- package/dist/llms/components/tooltip.md +470 -0
- package/dist/llms/components/tree.md +1011 -0
- package/dist/llms/components/trial-bar.md +383 -0
- package/dist/llms/components/vertical-navigation.md +196 -0
- package/dist/llms/components/visual-picker.md +362 -0
- package/dist/llms/components/welcome-mat.md +885 -0
- package/dist/llms/docs/migration-v11.md +471 -0
- package/dist/llms/llms-full.txt +6874 -0
- package/dist/llms/llms.txt +133 -0
- package/dist/llms/rules.md +36 -0
- package/dist/types/components/accordion/index.d.ts.map +1 -1
- package/dist/types/components/accordion/panel.d.ts +7 -7
- package/dist/types/components/builder-header/nav-dropdown.d.ts +1 -0
- package/dist/types/components/builder-header/nav-dropdown.d.ts.map +1 -1
- package/dist/types/components/builder-header/nav-link.d.ts +0 -1
- package/dist/types/components/builder-header/nav-link.d.ts.map +1 -1
- package/dist/types/components/builder-header/toolbar.d.ts +0 -1
- package/dist/types/components/builder-header/toolbar.d.ts.map +1 -1
- package/dist/types/components/button/index.d.ts +19 -6
- package/dist/types/components/button/index.d.ts.map +1 -1
- package/dist/types/components/button-stateful/index.d.ts +8 -2
- package/dist/types/components/button-stateful/index.d.ts.map +1 -1
- package/dist/types/components/carousel/index.d.ts +7 -1
- package/dist/types/components/carousel/index.d.ts.map +1 -1
- package/dist/types/components/checkbox/index.d.ts +22 -5
- package/dist/types/components/checkbox/index.d.ts.map +1 -1
- package/dist/types/components/color-picker/color-picker.d.ts +6 -4
- package/dist/types/components/color-picker/color-picker.d.ts.map +1 -1
- package/dist/types/components/color-picker/types.d.ts +2 -2
- package/dist/types/components/combobox/combobox.d.ts +22 -0
- package/dist/types/components/combobox/combobox.d.ts.map +1 -1
- package/dist/types/components/combobox/index.d.ts +1 -1
- package/dist/types/components/combobox/index.d.ts.map +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts +16 -4
- package/dist/types/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/types/components/date-picker/index.d.ts +2 -6
- package/dist/types/components/date-picker/index.d.ts.map +1 -1
- package/dist/types/components/files/file.d.ts +5 -0
- package/dist/types/components/files/file.d.ts.map +1 -1
- package/dist/types/components/icon/index.d.ts +8 -1
- package/dist/types/components/icon/index.d.ts.map +1 -1
- package/dist/types/components/icon/input-icon/index.d.ts +3 -0
- package/dist/types/components/icon/input-icon/index.d.ts.map +1 -1
- package/dist/types/components/icon-settings/index.d.ts.map +1 -1
- package/dist/types/components/input/index.d.ts +10 -6
- package/dist/types/components/input/index.d.ts.map +1 -1
- package/dist/types/components/input/search.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/button-trigger.d.ts +5 -0
- package/dist/types/components/menu-dropdown/button-trigger.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/menu-dropdown.d.ts +13 -3
- package/dist/types/components/menu-dropdown/menu-dropdown.d.ts.map +1 -1
- package/dist/types/components/modal/index.d.ts +5 -5
- package/dist/types/components/modal/index.d.ts.map +1 -1
- package/dist/types/components/page-header/types.d.ts +3 -0
- package/dist/types/components/page-header/types.d.ts.map +1 -1
- package/dist/types/components/panel/filtering/group.d.ts +2 -0
- package/dist/types/components/panel/filtering/group.d.ts.map +1 -1
- package/dist/types/components/pill/index.d.ts +1 -0
- package/dist/types/components/pill/index.d.ts.map +1 -1
- package/dist/types/components/popover/edit-dialog.d.ts +1 -3
- package/dist/types/components/popover/edit-dialog.d.ts.map +1 -1
- package/dist/types/components/popover/index.d.ts.map +1 -1
- package/dist/types/components/popover/popover.d.ts +1 -0
- package/dist/types/components/popover/popover.d.ts.map +1 -1
- package/dist/types/components/progress-indicator/index.d.ts +1 -0
- package/dist/types/components/progress-indicator/index.d.ts.map +1 -1
- package/dist/types/components/progress-ring/index.d.ts +1 -0
- package/dist/types/components/progress-ring/index.d.ts.map +1 -1
- package/dist/types/components/radio/index.d.ts +11 -4
- package/dist/types/components/radio/index.d.ts.map +1 -1
- package/dist/types/components/radio-group/index.d.ts +5 -3
- package/dist/types/components/radio-group/index.d.ts.map +1 -1
- package/dist/types/components/scoped-notification/index.d.ts +1 -0
- package/dist/types/components/scoped-notification/index.d.ts.map +1 -1
- package/dist/types/components/setup-assistant/step.d.ts +0 -1
- package/dist/types/components/setup-assistant/step.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/cell.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/index.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/interactive-element.d.ts +8 -1
- package/dist/types/components/simple-data-table/interactive-element.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/types.d.ts +11 -2
- package/dist/types/components/simple-data-table/types.d.ts.map +1 -1
- package/dist/types/components/slider/index.d.ts +6 -4
- package/dist/types/components/slider/index.d.ts.map +1 -1
- package/dist/types/components/split-view/listbox.d.ts.map +1 -1
- package/dist/types/components/split-view/private/list-item-with-content.d.ts.map +1 -1
- package/dist/types/components/tabs/index.d.ts +1 -0
- package/dist/types/components/tabs/index.d.ts.map +1 -1
- package/dist/types/components/tabs/panel.d.ts +2 -1
- package/dist/types/components/tabs/panel.d.ts.map +1 -1
- package/dist/types/components/textarea/index.d.ts +12 -40
- package/dist/types/components/textarea/index.d.ts.map +1 -1
- package/dist/types/components/toast/index.d.ts.map +1 -1
- package/dist/types/components/tooltip/index.d.ts +5 -0
- package/dist/types/components/tooltip/index.d.ts.map +1 -1
- package/dist/types/components/tree/tree.d.ts +5 -0
- package/dist/types/components/tree/tree.d.ts.map +1 -1
- package/dist/types/components/utilities/dialog/portal.d.ts.map +1 -1
- package/dist/types/components/utilities/menu-list/index.d.ts +2 -2
- package/dist/types/components/utilities/menu-list/index.d.ts.map +1 -1
- package/dist/types/components/utilities/menu-list/item-label.d.ts +12 -0
- package/dist/types/components/utilities/menu-list/item-label.d.ts.map +1 -1
- package/dist/types/components/utilities/menu-list/item.d.ts +14 -1
- package/dist/types/components/utilities/menu-list/item.d.ts.map +1 -1
- package/dist/types/components/utilities/truncate/index.d.ts.map +1 -1
- package/dist/types/components/utilities/utility-icon/index.d.ts +1 -1
- package/dist/types/components/utilities/utility-icon/index.d.ts.map +1 -1
- package/dist/types/types/common.d.ts.map +1 -1
- package/dist/types/types/components.d.ts.map +1 -1
- package/package.json +9 -7
- package/dist/cjs/icons/action/index.cjs +0 -2
- package/dist/cjs/icons/action/index.cjs.map +0 -1
- package/dist/cjs/icons/custom/index.cjs +0 -2
- package/dist/cjs/icons/custom/index.cjs.map +0 -1
- package/dist/cjs/icons/doctype/index.cjs +0 -2
- package/dist/cjs/icons/doctype/index.cjs.map +0 -1
- package/dist/cjs/icons/standard/index.cjs +0 -2
- package/dist/cjs/icons/standard/index.cjs.map +0 -1
- package/dist/cjs/icons/utility/index.cjs +0 -2
- package/dist/cjs/icons/utility/index.cjs.map +0 -1
- package/dist/es/icons/action/index.js +0 -6
- package/dist/es/icons/action/index.js.map +0 -1
- package/dist/es/icons/custom/index.js +0 -6
- package/dist/es/icons/custom/index.js.map +0 -1
- package/dist/es/icons/doctype/index.js +0 -6
- package/dist/es/icons/doctype/index.js.map +0 -1
- package/dist/es/icons/standard/index.js +0 -6
- package/dist/es/icons/standard/index.js.map +0 -1
- package/dist/es/icons/utility/index.js +0 -6
- package/dist/es/icons/utility/index.js.map +0 -1
- package/dist/types/icons/action/index.d.ts +0 -3
- package/dist/types/icons/action/index.d.ts.map +0 -1
- package/dist/types/icons/custom/index.d.ts +0 -3
- package/dist/types/icons/custom/index.d.ts.map +0 -1
- package/dist/types/icons/doctype/index.d.ts +0 -3
- package/dist/types/icons/doctype/index.d.ts.map +0 -1
- package/dist/types/icons/standard/index.d.ts +0 -3
- package/dist/types/icons/standard/index.d.ts.map +0 -1
- package/dist/types/icons/utility/index.d.ts +0 -3
- package/dist/types/icons/utility/index.d.ts.map +0 -1
|
@@ -7,6 +7,7 @@ import a from "classnames";
|
|
|
7
7
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
8
|
//#region components/utilities/menu-list/item.tsx
|
|
9
9
|
var c = class extends i.Component {
|
|
10
|
+
state = { isTooltipOpen: !1 };
|
|
10
11
|
static displayName = e;
|
|
11
12
|
static defaultProps = {
|
|
12
13
|
data: {},
|
|
@@ -54,6 +55,38 @@ var c = class extends i.Component {
|
|
|
54
55
|
handleMouseDown = (e) => {
|
|
55
56
|
n.trapImmediate(e);
|
|
56
57
|
};
|
|
58
|
+
anchor = null;
|
|
59
|
+
saveAnchor = (e) => {
|
|
60
|
+
this.anchor = e;
|
|
61
|
+
};
|
|
62
|
+
handleTooltipOpen = () => {
|
|
63
|
+
this.setState({ isTooltipOpen: !0 });
|
|
64
|
+
};
|
|
65
|
+
handleTooltipClose = () => {
|
|
66
|
+
this.setState({ isTooltipOpen: !1 });
|
|
67
|
+
};
|
|
68
|
+
getTooltip = () => {
|
|
69
|
+
if (!this.props.tooltipContent || !this.props.tooltipTemplate) return null;
|
|
70
|
+
let e = this.props.tooltipTemplate.props, t = `${this.props.id}-tooltip`, n = e.isOpen ?? this.state.isTooltipOpen, r = e.onRequestClose, a = i.cloneElement(this.props.tooltipTemplate, {
|
|
71
|
+
content: this.props.tooltipContent,
|
|
72
|
+
id: t,
|
|
73
|
+
isOpen: n,
|
|
74
|
+
onRequestClose: (...e) => {
|
|
75
|
+
this.handleTooltipClose(), r?.(...e);
|
|
76
|
+
},
|
|
77
|
+
onRequestTargetElement: () => this.anchor,
|
|
78
|
+
trigger: () => null,
|
|
79
|
+
triggerStyle: {
|
|
80
|
+
position: "absolute",
|
|
81
|
+
width: "100%",
|
|
82
|
+
...e.triggerStyle || {}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return {
|
|
86
|
+
describedBy: n ? t : void 0,
|
|
87
|
+
element: a
|
|
88
|
+
};
|
|
89
|
+
};
|
|
57
90
|
render() {
|
|
58
91
|
switch (this.props.type) {
|
|
59
92
|
case "header": return /* @__PURE__ */ o("li", {
|
|
@@ -73,12 +106,18 @@ var c = class extends i.Component {
|
|
|
73
106
|
role: "separator"
|
|
74
107
|
});
|
|
75
108
|
default: {
|
|
76
|
-
let e = /* @__PURE__ */ s("a", {
|
|
109
|
+
let e = this.getTooltip(), t = /* @__PURE__ */ s("a", {
|
|
77
110
|
"aria-checked": this.props.checkmark && this.props.isSelected ? !0 : void 0,
|
|
111
|
+
"aria-describedby": e?.describedBy,
|
|
78
112
|
"aria-disabled": this.props["aria-disabled"],
|
|
79
113
|
href: this.props.href,
|
|
80
114
|
"data-index": this.props.index,
|
|
115
|
+
onBlur: e ? this.handleTooltipClose : void 0,
|
|
81
116
|
onClick: this.handleClick,
|
|
117
|
+
onFocus: e ? this.handleTooltipOpen : void 0,
|
|
118
|
+
onMouseEnter: e ? this.handleTooltipOpen : void 0,
|
|
119
|
+
onMouseLeave: e ? this.handleTooltipClose : void 0,
|
|
120
|
+
ref: this.saveAnchor,
|
|
82
121
|
role: this.props.checkmark ? "menuitemcheckbox" : "menuitem",
|
|
83
122
|
tabIndex: -1,
|
|
84
123
|
children: [
|
|
@@ -90,29 +129,14 @@ var c = class extends i.Component {
|
|
|
90
129
|
this.getIcon("right")
|
|
91
130
|
]
|
|
92
131
|
});
|
|
93
|
-
|
|
94
|
-
let { ...t } = this.props.tooltipTemplate.props, n = {
|
|
95
|
-
...t,
|
|
96
|
-
content: this.props.tooltipContent,
|
|
97
|
-
id: `${this.props.id}-tooltip`,
|
|
98
|
-
triggerStyle: {
|
|
99
|
-
width: "100%",
|
|
100
|
-
...t.triggerStyle || {}
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
e = i.cloneElement(this.props.tooltipTemplate, {
|
|
104
|
-
...n,
|
|
105
|
-
trigger: e
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
return /* @__PURE__ */ o("li", {
|
|
132
|
+
return /* @__PURE__ */ s("li", {
|
|
109
133
|
ref: this.props.nodeRef,
|
|
110
134
|
"aria-selected": this.props.checkmark === null ? this.props.isSelected : void 0,
|
|
111
135
|
className: a("slds-dropdown__item", { "slds-is-selected": this.props.isSelected }, this.props.className),
|
|
112
136
|
id: this.props.id,
|
|
113
137
|
onMouseDown: this.handleMouseDown,
|
|
114
138
|
role: "presentation",
|
|
115
|
-
children: e
|
|
139
|
+
children: [t, e?.element]
|
|
116
140
|
});
|
|
117
141
|
}
|
|
118
142
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.js","names":[],"sources":["../../../../../components/utilities/menu-list/item.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\n// # List Item Component\n\n// ## Dependencies\n\n// ### React\nimport React, { type ComponentType, type ReactNode } from 'react';\n\n// ### classNames\nimport classNames from 'classnames';\n\n// ### Icon\nimport Icon from '../../icon';\n\n// ## Children\nimport ListItemLabelRenderer, { type ListItemLabelProps } from './item-label';\n\n// ### Event Helpers\nimport EventUtil from '../../../utilities/event';\n\n// ## Constants\nimport { LIST_ITEM } from '../../../utilities/constants';\n\ninterface MenuListIconConfig {\n\tcategory?: string;\n\tname?: string;\n}\n\nexport interface ListItemProps {\n\t'aria-disabled'?: boolean;\n\tclassName?: unknown[] | Record<string, unknown> | string;\n\tcheckmark?: boolean;\n\tdata?: Record<string, unknown>;\n\tdisabled?: boolean;\n\tdivider?: 'top' | 'bottom';\n\tgroupedBy?: string;\n\thref?: string;\n\tid: string;\n\tindex: number;\n\tinverted?: boolean;\n\tisSelected?: boolean;\n\tisCheckmarkVariant?: boolean;\n\tlabel?: string;\n\tlabelRenderer?: ComponentType<ListItemLabelProps>;\n\t/** Called to render the label. Takes precedence over `labelRenderer`. */\n\trenderLabel?: (props: ListItemLabelProps) => ReactNode;\n\tleftIcon?: MenuListIconConfig;\n\t/**\n\t * Callback ref that receives the root `<li>` DOM node (or `null` on\n\t * unmount). Used by parents that need the list item's DOM element for\n\t * keyboard focus/scroll management. A DOM node is forwarded here rather\n\t * than attaching a `ref` to this class component, which would yield the\n\t * component instance instead of an element.\n\t */\n\tnodeRef?: (node: HTMLLIElement | null) => void;\n\tonSelect: (index: number, event: React.MouseEvent) => void;\n\trightIcon?: MenuListIconConfig;\n\ttooltipContent?: ReactNode | string;\n\ttooltipTemplate?: React.ReactElement;\n\ttype?: string;\n\tvalue?: unknown;\n}\n\n/**\n * Component description.\n */\nclass ListItem extends React.Component<ListItemProps> {\n\tstatic displayName = LIST_ITEM;\n\n\tstatic defaultProps: Partial<ListItemProps> = {\n\t\tdata: {},\n\t\thref: '#',\n\t\tinverted: false,\n\t\tisSelected: false,\n\t\tlabel: '',\n\t\tlabelRenderer: ListItemLabelRenderer,\n\t\tvalue: null,\n\t};\n\n\tgetLabel = () => {\n\t\tconst labelProps: ListItemLabelProps = {\n\t\t\tcheckmark: this.props.checkmark,\n\t\t\tdata: this.props.data,\n\t\t\ticon: this.getIcon('left'),\n\t\t\tindex: this.props.index,\n\t\t\tinverted: this.props.inverted,\n\t\t\tisSelected: this.props.isSelected,\n\t\t\tlabel: this.props.label,\n\t\t\tvalue: this.props.value,\n\t\t};\n\t\tif (this.props.renderLabel) {\n\t\t\treturn this.props.renderLabel(labelProps);\n\t\t}\n\t\tconst Label = this.props.labelRenderer ?? ListItemLabelRenderer;\n\t\treturn <Label {...labelProps} />;\n\t};\n\n\tgetIcon = (position: 'left' | 'right') => {\n\t\tconst classnames = ['slds-icon-text-default'];\n\t\tlet iconProps: MenuListIconConfig | undefined =\n\t\t\tposition === 'left' ? this.props.leftIcon : this.props.rightIcon;\n\n\t\tif (position === 'left') {\n\t\t\tif (this.props.isCheckmarkVariant) {\n\t\t\t\tclassnames.push('slds-icon_selected');\n\t\t\t\ticonProps = {\n\t\t\t\t\tcategory: 'utility',\n\t\t\t\t\tname: 'check',\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tclassnames.push('slds-m-right_x-small');\n\t\t} else {\n\t\t\tclassnames.push('slds-m-left_small');\n\t\t}\n\n\t\tif (iconProps) {\n\t\t\t// `position` is not part of Icon's public props but is preserved for\n\t\t\t// backwards-compatible runtime behavior; spread through a permissive cast.\n\t\t\tconst iconElementProps = {\n\t\t\t\tclassName: classNames(classnames),\n\t\t\t\tposition,\n\t\t\t\tsize: 'x-small',\n\t\t\t\t...iconProps,\n\t\t\t} as Record<string, unknown>;\n\t\t\treturn <Icon {...iconElementProps} />;\n\t\t}\n\n\t\treturn null;\n\t};\n\n\thandleClick = (event: React.MouseEvent) => {\n\t\tif (\n\t\t\tthis.props.type !== 'link' ||\n\t\t\tthis.props.href === 'javascript:void(0);' || // eslint-disable-line no-script-url\n\t\t\tthis.props.href === '#'\n\t\t) {\n\t\t\tEventUtil.trapImmediate(event);\n\t\t}\n\n\t\tif (this.props.onSelect && !this.props.disabled) {\n\t\t\tthis.props.onSelect(this.props.index, event);\n\t\t}\n\t};\n\n\thandleMouseDown = (event: React.MouseEvent) => {\n\t\tEventUtil.trapImmediate(event);\n\t};\n\n\trender() {\n\t\tswitch (this.props.type) {\n\t\t\tcase 'header': {\n\t\t\t\treturn (\n\t\t\t\t\t<li\n\t\t\t\t\t\tref={this.props.nodeRef}\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-dropdown__header',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'slds-has-divider_top-space': this.props.divider === 'top',\n\t\t\t\t\t\t\t\t'slds-has-divider_bottom-space':\n\t\t\t\t\t\t\t\t\tthis.props.divider === 'bottom',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tthis.props.className\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tonMouseDown={this.handleMouseDown}\n\t\t\t\t\t\trole=\"separator\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span>{this.props.label}</span>\n\t\t\t\t\t</li>\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase 'divider': {\n\t\t\t\treturn (\n\t\t\t\t\t<li\n\t\t\t\t\t\tref={this.props.nodeRef}\n\t\t\t\t\t\tclassName={classNames('slds-has-divider', this.props.className)}\n\t\t\t\t\t\tonMouseDown={this.handleMouseDown}\n\t\t\t\t\t\trole=\"separator\"\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase 'link':\n\t\t\tcase 'item':\n\t\t\tdefault: {\n\t\t\t\t/* eslint-disable jsx-a11y/role-supports-aria-props */\n\t\t\t\tlet itemContents = (\n\t\t\t\t\t<a\n\t\t\t\t\t\taria-checked={\n\t\t\t\t\t\t\tthis.props.checkmark && this.props.isSelected ? true : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-disabled={this.props['aria-disabled']}\n\t\t\t\t\t\thref={this.props.href}\n\t\t\t\t\t\tdata-index={this.props.index}\n\t\t\t\t\t\tonClick={this.handleClick}\n\t\t\t\t\t\trole={this.props.checkmark ? 'menuitemcheckbox' : 'menuitem'}\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t>\n\t\t\t\t\t\t{this.props.groupedBy && (\n\t\t\t\t\t\t\t<span className=\"slds-assistive-text\">{`-${this.props.groupedBy}`}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{this.getLabel()}\n\t\t\t\t\t\t{this.getIcon('right')}\n\t\t\t\t\t</a>\n\t\t\t\t);\n\n\t\t\t\tif (this.props.tooltipContent && this.props.tooltipTemplate) {\n\t\t\t\t\tconst { ...tooltipTemplateProps } = this.props.tooltipTemplate\n\t\t\t\t\t\t.props as Record<string, unknown>;\n\t\t\t\t\tconst tooltipProps = {\n\t\t\t\t\t\t...tooltipTemplateProps,\n\t\t\t\t\t\tcontent: this.props.tooltipContent,\n\t\t\t\t\t\tid: `${this.props.id}-tooltip`,\n\t\t\t\t\t\ttriggerStyle: {\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t...((tooltipTemplateProps.triggerStyle as Record<\n\t\t\t\t\t\t\t\tstring,\n\t\t\t\t\t\t\t\tunknown\n\t\t\t\t\t\t\t>) || {}),\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\titemContents = React.cloneElement(\n\t\t\t\t\t\tthis.props.tooltipTemplate as React.ReactElement<\n\t\t\t\t\t\t\tRecord<string, unknown>\n\t\t\t\t\t\t>,\n\t\t\t\t\t\t{ ...tooltipProps, trigger: itemContents }\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t/* eslint-disable jsx-a11y/role-supports-aria-props */\n\t\t\t\t\t// disabled eslint, but using aria-selected on presentation role seems suspicious...\n\t\t\t\t\t<li\n\t\t\t\t\t\tref={this.props.nodeRef}\n\t\t\t\t\t\taria-selected={\n\t\t\t\t\t\t\tthis.props.checkmark === null ? this.props.isSelected : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-dropdown__item',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'slds-is-selected': this.props.isSelected,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tthis.props.className\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tid={this.props.id}\n\t\t\t\t\t\tonMouseDown={this.handleMouseDown}\n\t\t\t\t\t\trole=\"presentation\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{itemContents}\n\t\t\t\t\t</li>\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default ListItem;\n"],"mappings":";;;;;;;;AAsEA,IAAM,IAAN,cAAuB,EAAM,UAAyB;CACrD,OAAO,cAAc;CAErB,OAAO,eAAuC;EAC7C,MAAM,CAAC;EACP,MAAM;EACN,UAAU;EACV,YAAY;EACZ,OAAO;EACP,eAAe;EACf,OAAO;CACR;CAEA,iBAAiB;EAChB,IAAM,IAAiC;GACtC,WAAW,KAAK,MAAM;GACtB,MAAM,KAAK,MAAM;GACjB,MAAM,KAAK,QAAQ,MAAM;GACzB,OAAO,KAAK,MAAM;GAClB,UAAU,KAAK,MAAM;GACrB,YAAY,KAAK,MAAM;GACvB,OAAO,KAAK,MAAM;GAClB,OAAO,KAAK,MAAM;EACnB;EACA,IAAI,KAAK,MAAM,aACd,OAAO,KAAK,MAAM,YAAY,CAAU;EAEzC,IAAM,IAAQ,KAAK,MAAM,iBAAiB;EAC1C,OAAO,kBAAC,GAAD,EAAO,GAAI,EAAa,CAAA;CAChC;CAEA,WAAW,MAA+B;EACzC,IAAM,IAAa,CAAC,wBAAwB,GACxC,IACH,MAAa,SAAS,KAAK,MAAM,WAAW,KAAK,MAAM;EAgBxD,IAdI,MAAa,UACZ,KAAK,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KAAK,MAAM,YAAY,qBAAqB;KAClD,UAAU;KATX,UAAA;MAWE,KAAK,MAAM,aACX,kBAAC,QAAD;OAAM,WAAU;OAAuB,UAAA,IAAI,KAAK,MAAM;MAAkB,CAAA;MAExE,KAAK,SAAS;MACd,KAAK,QAAQ,OAAO;KACnB;;IAGJ,IAAI,KAAK,MAAM,kBAAkB,KAAK,MAAM,iBAAiB;KAC5D,IAAM,EAAE,GAAG,MAAyB,KAAK,MAAM,gBAC7C,OACI,IAAe;MACpB,GAAG;MACH,SAAS,KAAK,MAAM;MACpB,IAAI,GAAG,KAAK,MAAM,GAAG;MACrB,cAAc;OACb,OAAO;OACP,GAAK,EAAqB,gBAGpB,CAAC;MACR;KACD;KACA,IAAe,EAAM,aACpB,KAAK,MAAM,iBAGX;MAAE,GAAG;MAAc,SAAS;KAAa,CAC1C;IACD;IAEA,OAGC,kBAAC,MAAD;KACC,KAAK,KAAK,MAAM;KAChB,iBACC,KAAK,MAAM,cAAc,OAAO,KAAK,MAAM,aAAa,KAAA;KAEzD,WAAW,EACV,uBACA,EACC,oBAAoB,KAAK,MAAM,WAChC,GACA,KAAK,MAAM,SACZ;KACA,IAAI,KAAK,MAAM;KACf,aAAa,KAAK;KAClB,MAAK;KAEJ,UAAA;IACE,CAAA;GAEN;EACD;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"item.js","names":[],"sources":["../../../../../components/utilities/menu-list/item.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\n// # List Item Component\n\n// ## Dependencies\n\n// ### React\nimport React, { type ComponentType, type ReactNode } from 'react';\n\n// ### classNames\nimport classNames from 'classnames';\n\n// ### Icon\nimport Icon from '../../icon';\n\n// ## Children\nimport ListItemLabelRenderer, { type ListItemLabelProps } from './item-label';\n\n// ### Event Helpers\nimport EventUtil from '../../../utilities/event';\n\n// ## Constants\nimport { LIST_ITEM } from '../../../utilities/constants';\n\ninterface MenuListIconConfig {\n\tcategory?: string;\n\tname?: string;\n}\n\nexport interface ListItemProps {\n\t'aria-disabled'?: boolean;\n\tclassName?: unknown[] | Record<string, unknown> | string;\n\tcheckmark?: boolean;\n\tdata?: Record<string, unknown>;\n\tdisabled?: boolean;\n\tdivider?: 'top' | 'bottom';\n\tgroupedBy?: string;\n\thref?: string;\n\tid: string;\n\tindex: number;\n\tinverted?: boolean;\n\tisSelected?: boolean;\n\tisCheckmarkVariant?: boolean;\n\tlabel?: string;\n\tlabelRenderer?: ComponentType<ListItemLabelProps>;\n\t/** Called to render the label. Takes precedence over `labelRenderer`. */\n\trenderLabel?: (props: ListItemLabelProps) => ReactNode;\n\tleftIcon?: MenuListIconConfig;\n\t/**\n\t * Callback ref that receives the root `<li>` DOM node (or `null` on\n\t * unmount). Used by parents that need the list item's DOM element for\n\t * keyboard focus/scroll management. A DOM node is forwarded here rather\n\t * than attaching a `ref` to this class component, which would yield the\n\t * component instance instead of an element.\n\t */\n\tnodeRef?: (node: HTMLLIElement | null) => void;\n\tonSelect: (index: number, event: React.MouseEvent) => void;\n\trightIcon?: MenuListIconConfig;\n\ttooltipContent?: ReactNode | string;\n\ttooltipTemplate?: React.ReactElement;\n\ttype?: string;\n\tvalue?: unknown;\n}\n\n/**\n * Component description.\n */\nclass ListItem extends React.Component<\n\tListItemProps,\n\t{ isTooltipOpen: boolean }\n> {\n\tstate = { isTooltipOpen: false };\n\n\tstatic displayName = LIST_ITEM;\n\n\tstatic defaultProps: Partial<ListItemProps> = {\n\t\tdata: {},\n\t\thref: '#',\n\t\tinverted: false,\n\t\tisSelected: false,\n\t\tlabel: '',\n\t\tlabelRenderer: ListItemLabelRenderer,\n\t\tvalue: null,\n\t};\n\n\tgetLabel = () => {\n\t\tconst labelProps: ListItemLabelProps = {\n\t\t\tcheckmark: this.props.checkmark,\n\t\t\tdata: this.props.data,\n\t\t\ticon: this.getIcon('left'),\n\t\t\tindex: this.props.index,\n\t\t\tinverted: this.props.inverted,\n\t\t\tisSelected: this.props.isSelected,\n\t\t\tlabel: this.props.label,\n\t\t\tvalue: this.props.value,\n\t\t};\n\t\tif (this.props.renderLabel) {\n\t\t\treturn this.props.renderLabel(labelProps);\n\t\t}\n\t\tconst Label = this.props.labelRenderer ?? ListItemLabelRenderer;\n\t\treturn <Label {...labelProps} />;\n\t};\n\n\tgetIcon = (position: 'left' | 'right') => {\n\t\tconst classnames = ['slds-icon-text-default'];\n\t\tlet iconProps: MenuListIconConfig | undefined =\n\t\t\tposition === 'left' ? this.props.leftIcon : this.props.rightIcon;\n\n\t\tif (position === 'left') {\n\t\t\tif (this.props.isCheckmarkVariant) {\n\t\t\t\tclassnames.push('slds-icon_selected');\n\t\t\t\ticonProps = {\n\t\t\t\t\tcategory: 'utility',\n\t\t\t\t\tname: 'check',\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tclassnames.push('slds-m-right_x-small');\n\t\t} else {\n\t\t\tclassnames.push('slds-m-left_small');\n\t\t}\n\n\t\tif (iconProps) {\n\t\t\t// `position` is not part of Icon's public props but is preserved for\n\t\t\t// backwards-compatible runtime behavior; spread through a permissive cast.\n\t\t\tconst iconElementProps = {\n\t\t\t\tclassName: classNames(classnames),\n\t\t\t\tposition,\n\t\t\t\tsize: 'x-small',\n\t\t\t\t...iconProps,\n\t\t\t} as Record<string, unknown>;\n\t\t\treturn <Icon {...iconElementProps} />;\n\t\t}\n\n\t\treturn null;\n\t};\n\n\thandleClick = (event: React.MouseEvent) => {\n\t\tif (\n\t\t\tthis.props.type !== 'link' ||\n\t\t\tthis.props.href === 'javascript:void(0);' || // eslint-disable-line no-script-url\n\t\t\tthis.props.href === '#'\n\t\t) {\n\t\t\tEventUtil.trapImmediate(event);\n\t\t}\n\n\t\tif (this.props.onSelect && !this.props.disabled) {\n\t\t\tthis.props.onSelect(this.props.index, event);\n\t\t}\n\t};\n\n\thandleMouseDown = (event: React.MouseEvent) => {\n\t\tEventUtil.trapImmediate(event);\n\t};\n\n\tanchor: HTMLAnchorElement | null = null;\n\n\tsaveAnchor = (node: HTMLAnchorElement | null) => {\n\t\tthis.anchor = node;\n\t};\n\n\thandleTooltipOpen = () => {\n\t\tthis.setState({ isTooltipOpen: true });\n\t};\n\n\thandleTooltipClose = () => {\n\t\tthis.setState({ isTooltipOpen: false });\n\t};\n\n\t// The tooltip renders next to the link, not around it, so the link stays the\n\t// `li`'s direct child and SLDS's `.slds-dropdown__item > a` rules style it.\n\t// The item opens it on hover and focus and points it at the link.\n\tgetTooltip = () => {\n\t\tif (!this.props.tooltipContent || !this.props.tooltipTemplate) {\n\t\t\treturn null;\n\t\t}\n\t\tconst templateProps = this.props.tooltipTemplate.props as Record<\n\t\t\tstring,\n\t\t\tunknown\n\t\t>;\n\t\tconst id = `${this.props.id}-tooltip`;\n\t\tconst isOpen =\n\t\t\t(templateProps.isOpen as boolean | undefined) ?? this.state.isTooltipOpen;\n\t\tconst onRequestClose = templateProps.onRequestClose as\n\t\t\t((...args: unknown[]) => void) | undefined;\n\t\tconst element = React.cloneElement(\n\t\t\tthis.props.tooltipTemplate as React.ReactElement<Record<string, unknown>>,\n\t\t\t{\n\t\t\t\tcontent: this.props.tooltipContent,\n\t\t\t\tid,\n\t\t\t\tisOpen,\n\t\t\t\tonRequestClose: (...args: unknown[]) => {\n\t\t\t\t\tthis.handleTooltipClose();\n\t\t\t\t\tonRequestClose?.(...args);\n\t\t\t\t},\n\t\t\t\tonRequestTargetElement: () => this.anchor,\n\t\t\t\ttrigger: () => null,\n\t\t\t\t// Out of flow, so the empty trigger wrapper adds no line below the link.\n\t\t\t\t// The tooltip renders inside the wrapper and sizes against it, so give\n\t\t\t\t// the wrapper the menu's width; at 0 width the text wraps at every word.\n\t\t\t\t// (`width`, not `left`/`right`: the tooltip sets `right: inherit`.)\n\t\t\t\ttriggerStyle: {\n\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\t...((templateProps.triggerStyle as Record<string, unknown>) || {}),\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t\treturn { describedBy: isOpen ? id : undefined, element };\n\t};\n\n\trender() {\n\t\tswitch (this.props.type) {\n\t\t\tcase 'header': {\n\t\t\t\treturn (\n\t\t\t\t\t<li\n\t\t\t\t\t\tref={this.props.nodeRef}\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-dropdown__header',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'slds-has-divider_top-space': this.props.divider === 'top',\n\t\t\t\t\t\t\t\t'slds-has-divider_bottom-space':\n\t\t\t\t\t\t\t\t\tthis.props.divider === 'bottom',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tthis.props.className\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tonMouseDown={this.handleMouseDown}\n\t\t\t\t\t\trole=\"separator\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span>{this.props.label}</span>\n\t\t\t\t\t</li>\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase 'divider': {\n\t\t\t\treturn (\n\t\t\t\t\t<li\n\t\t\t\t\t\tref={this.props.nodeRef}\n\t\t\t\t\t\tclassName={classNames('slds-has-divider', this.props.className)}\n\t\t\t\t\t\tonMouseDown={this.handleMouseDown}\n\t\t\t\t\t\trole=\"separator\"\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase 'link':\n\t\t\tcase 'item':\n\t\t\tdefault: {\n\t\t\t\tconst tooltip = this.getTooltip();\n\n\t\t\t\t/* eslint-disable jsx-a11y/role-supports-aria-props */\n\t\t\t\tconst itemContents = (\n\t\t\t\t\t<a\n\t\t\t\t\t\taria-checked={\n\t\t\t\t\t\t\tthis.props.checkmark && this.props.isSelected ? true : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-describedby={tooltip?.describedBy}\n\t\t\t\t\t\taria-disabled={this.props['aria-disabled']}\n\t\t\t\t\t\thref={this.props.href}\n\t\t\t\t\t\tdata-index={this.props.index}\n\t\t\t\t\t\tonBlur={tooltip ? this.handleTooltipClose : undefined}\n\t\t\t\t\t\tonClick={this.handleClick}\n\t\t\t\t\t\tonFocus={tooltip ? this.handleTooltipOpen : undefined}\n\t\t\t\t\t\tonMouseEnter={tooltip ? this.handleTooltipOpen : undefined}\n\t\t\t\t\t\tonMouseLeave={tooltip ? this.handleTooltipClose : undefined}\n\t\t\t\t\t\tref={this.saveAnchor}\n\t\t\t\t\t\trole={this.props.checkmark ? 'menuitemcheckbox' : 'menuitem'}\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t>\n\t\t\t\t\t\t{this.props.groupedBy && (\n\t\t\t\t\t\t\t<span className=\"slds-assistive-text\">{`-${this.props.groupedBy}`}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{this.getLabel()}\n\t\t\t\t\t\t{this.getIcon('right')}\n\t\t\t\t\t</a>\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t/* eslint-disable jsx-a11y/role-supports-aria-props */\n\t\t\t\t\t// disabled eslint, but using aria-selected on presentation role seems suspicious...\n\t\t\t\t\t<li\n\t\t\t\t\t\tref={this.props.nodeRef}\n\t\t\t\t\t\taria-selected={\n\t\t\t\t\t\t\tthis.props.checkmark === null ? this.props.isSelected : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t'slds-dropdown__item',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'slds-is-selected': this.props.isSelected,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tthis.props.className\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tid={this.props.id}\n\t\t\t\t\t\tonMouseDown={this.handleMouseDown}\n\t\t\t\t\t\trole=\"presentation\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{itemContents}\n\t\t\t\t\t\t{tooltip?.element}\n\t\t\t\t\t</li>\n\t\t\t\t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K,MAAM;IAChB,WAAW,EAAW,oBAAoB,KAAK,MAAM,SAAS;IAC9D,aAAa,KAAK;IAClB,MAAK;GACL,CAAA;GAKH,SAAS;IACR,IAAM,IAAU,KAAK,WAAW,GAG1B,IACL,kBAAC,KAAD;KACC,gBACC,KAAK,MAAM,aAAa,KAAK,MAAM,aAAa,KAAO,KAAA;KAExD,oBAAkB,GAAS;KAC3B,iBAAe,KAAK,MAAM;KAC1B,MAAM,KAAK,MAAM;KACjB,cAAY,KAAK,MAAM;KACvB,QAAQ,IAAU,KAAK,qBAAqB,KAAA;KAC5C,SAAS,KAAK;KACd,SAAS,IAAU,KAAK,oBAAoB,KAAA;KAC5C,cAAc,IAAU,KAAK,oBAAoB,KAAA;KACjD,cAAc,IAAU,KAAK,qBAAqB,KAAA;KAClD,KAAK,KAAK;KACV,MAAM,KAAK,MAAM,YAAY,qBAAqB;KAClD,UAAU;KAfX,UAAA;MAiBE,KAAK,MAAM,aACX,kBAAC,QAAD;OAAM,WAAU;OAAuB,UAAA,IAAI,KAAK,MAAM;MAAkB,CAAA;MAExE,KAAK,SAAS;MACd,KAAK,QAAQ,OAAO;KACnB;;IAGJ,OAGC,kBAAC,MAAD;KACC,KAAK,KAAK,MAAM;KAChB,iBACC,KAAK,MAAM,cAAc,OAAO,KAAK,MAAM,aAAa,KAAA;KAEzD,WAAW,EACV,uBACA,EACC,oBAAoB,KAAK,MAAM,WAChC,GACA,KAAK,MAAM,SACZ;KACA,IAAI,KAAK,MAAM;KACf,aAAa,KAAK;KAClB,MAAK;KAdN,UAAA,CAgBE,GACA,GAAS,OACP;;GAEN;EACD;CACD;AACD"}
|
|
@@ -1,63 +1,43 @@
|
|
|
1
1
|
import e from "./svg.js";
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "
|
|
4
|
-
import r from "
|
|
5
|
-
import i from "
|
|
6
|
-
import a from "
|
|
7
|
-
import { DIRECTIONS as o } from "../UNSAFE_direction/index.js";
|
|
8
|
-
import s from "../UNSAFE_direction/private/language-direction.js";
|
|
9
|
-
import { IconSettingsContext as c } from "../../icon-settings/index.js";
|
|
10
|
-
import { useContext as l } from "react";
|
|
11
|
-
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { DIRECTIONS as t } from "../UNSAFE_direction/index.js";
|
|
3
|
+
import n from "../UNSAFE_direction/private/language-direction.js";
|
|
4
|
+
import { IconSettingsContext as r } from "../../icon-settings/index.js";
|
|
5
|
+
import { useContext as i } from "react";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
12
7
|
//#region components/utilities/utility-icon/index.tsx
|
|
13
|
-
var
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
utility: t
|
|
20
|
-
}, y;
|
|
21
|
-
if (p) y = p;
|
|
22
|
-
else if (Object.keys(v[f]).length) {
|
|
23
|
-
let e = v[f], t = e[s.toLowerCase()];
|
|
24
|
-
t && (y = {
|
|
25
|
-
...t,
|
|
26
|
-
viewBox: e.viewBox
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
let b;
|
|
30
|
-
if (m) b = m;
|
|
31
|
-
else if (_.onRequestIconPath) b = _.onRequestIconPath({
|
|
32
|
-
category: f,
|
|
33
|
-
name: s
|
|
8
|
+
var o = ({ name: n = "", assistiveText: o, category: s = "utility", icon: c, path: l, direction: u, ...d }) => {
|
|
9
|
+
let f = i(r), p = c, m;
|
|
10
|
+
if (l) m = l;
|
|
11
|
+
else if (f.onRequestIconPath) m = f.onRequestIconPath({
|
|
12
|
+
category: s,
|
|
13
|
+
name: n
|
|
34
14
|
});
|
|
35
|
-
else if (
|
|
36
|
-
else if (
|
|
37
|
-
let e =
|
|
38
|
-
|
|
15
|
+
else if (f[`${s}Sprite`]) m = `${f[`${s}Sprite`]}#${n}`;
|
|
16
|
+
else if (f.iconPath) {
|
|
17
|
+
let e = u === t.RTL ? "symbols-rtl.svg" : "symbols.svg";
|
|
18
|
+
m = `${f.iconPath}/${s}-sprite/svg/${e}#${n}`;
|
|
39
19
|
}
|
|
40
|
-
if (
|
|
41
|
-
let { className: t, style:
|
|
42
|
-
return /* @__PURE__ */
|
|
43
|
-
"aria-hidden":
|
|
44
|
-
data:
|
|
45
|
-
name:
|
|
20
|
+
if (p) {
|
|
21
|
+
let { className: t, style: r, "aria-hidden": i } = d;
|
|
22
|
+
return /* @__PURE__ */ a(e, {
|
|
23
|
+
"aria-hidden": i,
|
|
24
|
+
data: p,
|
|
25
|
+
name: n,
|
|
46
26
|
className: t,
|
|
47
|
-
style:
|
|
27
|
+
style: r
|
|
48
28
|
});
|
|
49
29
|
}
|
|
50
|
-
let { className:
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
className:
|
|
53
|
-
style:
|
|
54
|
-
...
|
|
55
|
-
children: /* @__PURE__ */
|
|
56
|
-
}, `${
|
|
30
|
+
let { className: h, style: g, ..._ } = d;
|
|
31
|
+
return /* @__PURE__ */ a("svg", {
|
|
32
|
+
className: h,
|
|
33
|
+
style: g,
|
|
34
|
+
..._,
|
|
35
|
+
children: /* @__PURE__ */ a("use", { href: m })
|
|
36
|
+
}, `${n}_${s}`);
|
|
57
37
|
};
|
|
58
|
-
|
|
59
|
-
var
|
|
38
|
+
o.displayName = "UtilityIcon";
|
|
39
|
+
var s = n(o);
|
|
60
40
|
//#endregion
|
|
61
|
-
export {
|
|
41
|
+
export { s as default };
|
|
62
42
|
|
|
63
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../components/utilities/utility-icon/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, { useContext, type CSSProperties, type SVGProps } from 'react';\nimport Svg from './svg';\nimport
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../components/utilities/utility-icon/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, { useContext, type CSSProperties, type SVGProps } from 'react';\nimport Svg from './svg';\nimport { DIRECTIONS } from '../UNSAFE_direction';\nimport LanguageDirection from '../UNSAFE_direction/private/language-direction';\nimport {\n\tIconSettingsContext,\n\ttype IconSettingsContextValue,\n} from '../../icon-settings/index';\nimport type { IconCategory } from '../../../types/common';\n\n/**\n * Shape of inline SVG icon data passed to the `icon` prop\n */\nexport interface InlineIconData {\n\tviewBox?: string;\n\tpath?: Record<string, string> | Array<Record<string, string>>;\n\tg?: Record<string, unknown> | Array<Record<string, unknown>>;\n\tcircle?: Record<string, string> | Array<Record<string, string>>;\n\tellipse?: Record<string, string> | Array<Record<string, string>>;\n\t[key: string]: unknown;\n}\n\n/**\n * Props for UtilityIcon component\n */\nexport interface UtilityIconProps extends Omit<\n\tSVGProps<SVGSVGElement>,\n\t'name'\n> {\n\t/** Assistive text for accessibility (not used directly, passed through) */\n\tassistiveText?: Record<string, string>;\n\t/** Icon category */\n\tcategory?: IconCategory;\n\t/** Custom SVG icon data */\n\ticon?: InlineIconData;\n\t/** Name of the icon */\n\tname?: string;\n\t/** Direct path to the icon sprite */\n\tpath?: string;\n\t/** Text direction for RTL support */\n\tdirection?: string;\n\t/** CSS class name */\n\tclassName?: string;\n\t/** Inline styles */\n\tstyle?: CSSProperties;\n}\n\n/**\n * Internal component that renders the `icon` prop's inline SVG data if given,\n * otherwise a sprite `<use>` reference resolved from `path` or `IconSettings`.\n */\nconst UtilityIcon = ({\n\tname = '',\n\tassistiveText, // eslint-disable-line @typescript-eslint/no-unused-vars\n\tcategory = 'utility',\n\ticon,\n\tpath,\n\tdirection,\n\t...rest\n}: UtilityIconProps): React.ReactElement | null => {\n\tconst context = useContext<IconSettingsContextValue>(IconSettingsContext);\n\n\tconst inlineData = icon;\n\n\tlet modifiedPath: string | undefined;\n\n\tif (path) {\n\t\t// Use `path` prop of Icon if present\n\t\tmodifiedPath = path;\n\t} else if (context.onRequestIconPath) {\n\t\tmodifiedPath = context.onRequestIconPath({ category, name });\n\t} else if (context[`${category}Sprite` as keyof IconSettingsContextValue]) {\n\t\t// Use category sprite file from IconSettings if present\n\t\tconst sprite = context[\n\t\t\t`${category}Sprite` as keyof IconSettingsContextValue\n\t\t] as string;\n\t\tmodifiedPath = `${sprite}#${name}`;\n\t} else if (context.iconPath) {\n\t\t// Otherwise, use external URLs for icons\n\t\tconst svgAssetName =\n\t\t\tdirection === DIRECTIONS.RTL ? 'symbols-rtl.svg' : 'symbols.svg';\n\t\tmodifiedPath = `${context.iconPath}/${category}-sprite/svg/${svgAssetName}#${name}`;\n\t}\n\n\tif (inlineData) {\n\t\tconst { className, style, 'aria-hidden': ariaHidden } = rest;\n\t\treturn (\n\t\t\t<Svg\n\t\t\t\taria-hidden={ariaHidden}\n\t\t\t\tdata={inlineData}\n\t\t\t\tname={name}\n\t\t\t\tclassName={className}\n\t\t\t\tstyle={style}\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst { className: svgClassName, style: svgStyle, ...svgRest } = rest;\n\treturn (\n\t\t<svg\n\t\t\tkey={`${name}_${category}`}\n\t\t\tclassName={svgClassName}\n\t\t\tstyle={svgStyle}\n\t\t\t{...svgRest}\n\t\t>\n\t\t\t<use href={modifiedPath} />\n\t\t</svg>\n\t);\n};\n\nUtilityIcon.displayName = 'UtilityIcon';\n\nexport default LanguageDirection(UtilityIcon);\n"],"mappings":";;;;;;;AAsDA,IAAM,KAAe,EACpB,UAAO,IACP,kBACA,cAAW,WACX,SACA,SACA,cACA,GAAG,QAC+C;CAClD,IAAM,IAAU,EAAqC,CAAmB,GAElE,IAAa,GAEf;CAEJ,IAAI,GAEH,IAAe;MACT,IAAI,EAAQ,mBAClB,IAAe,EAAQ,kBAAkB;EAAE;EAAU;CAAK,CAAC;MACrD,IAAI,EAAQ,GAAG,EAAS,UAK9B,IAAe,GAHA,EACd,GAAG,EAAS,SAEY,GAAG;MACtB,IAAI,EAAQ,UAAU;EAE5B,IAAM,IACL,MAAc,EAAW,MAAM,oBAAoB;EACpD,IAAe,GAAG,EAAQ,SAAS,GAAG,EAAS,cAAc,EAAa,GAAG;CAC9E;CAEA,IAAI,GAAY;EACf,IAAM,EAAE,cAAW,UAAO,eAAe,MAAe;EACxD,OACC,kBAAC,GAAD;GACC,eAAa;GACb,MAAM;GACA;GACK;GACJ;EACP,CAAA;CAEH;CAEA,IAAM,EAAE,WAAW,GAAc,OAAO,GAAU,GAAG,MAAY;CACjE,OACC,kBAAC,OAAD;EAEC,WAAW;EACX,OAAO;EACP,GAAI;EAEJ,UAAA,kBAAC,OAAD,EAAK,MAAM,EAAe,CAAA;CACtB,GANC,GAAG,EAAK,GAAG,GAMZ;AAEP;AAEA,EAAY,cAAc;AAE1B,IAAA,IAAe,EAAkB,CAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.js","names":[],"sources":["../../../utilities/color.js"],"sourcesContent":["import assign from 'lodash.assign';\n\nconst COLOR_NAMES = {\n\taliceblue: '#f0f8ff',\n\tantiquewhite: '#faebd7',\n\taqua: '#00ffff',\n\taquamarine: '#7fffd4',\n\tazure: '#f0ffff',\n\tbeige: '#f5f5dc',\n\tbisque: '#ffe4c4',\n\tblack: '#000000',\n\tblanchedalmond: '#ffebcd',\n\tblue: '#0000ff',\n\tblueviolet: '#8a2be2',\n\tbrown: '#a52a2a',\n\tburlywood: '#deb887',\n\tcadetblue: '#5f9ea0',\n\tchartreuse: '#7fff00',\n\tchocolate: '#d2691e',\n\tcoral: '#ff7f50',\n\tcornflowerblue: '#6495ed',\n\tcornsilk: '#fff8dc',\n\tcrimson: '#dc143c',\n\tcyan: '#00ffff',\n\tdarkblue: '#00008b',\n\tdarkcyan: '#008b8b',\n\tdarkgoldenrod: '#b8860b',\n\tdarkgray: '#a9a9a9',\n\tdarkgreen: '#006400',\n\tdarkkhaki: '#bdb76b',\n\tdarkmagenta: '#8b008b',\n\tdarkolivegreen: '#556b2f',\n\tdarkorange: '#ff8c00',\n\tdarkorchid: '#9932cc',\n\tdarkred: '#8b0000',\n\tdarksalmon: '#e9967a',\n\tdarkseagreen: '#8fbc8f',\n\tdarkslateblue: '#483d8b',\n\tdarkslategray: '#2f4f4f',\n\tdarkturquoise: '#00ced1',\n\tdarkviolet: '#9400d3',\n\tdeeppink: '#ff1493',\n\tdeepskyblue: '#00bfff',\n\tdimgray: '#696969',\n\tdodgerblue: '#1e90ff',\n\tfirebrick: '#b22222',\n\tfloralwhite: '#fffaf0',\n\tforestgreen: '#228b22',\n\tfuchsia: '#ff00ff',\n\tgainsboro: '#dcdcdc',\n\tghostwhite: '#f8f8ff',\n\tgold: '#ffd700',\n\tgoldenrod: '#daa520',\n\tgray: '#808080',\n\tgreen: '#008000',\n\tgreenyellow: '#adff2f',\n\thoneydew: '#f0fff0',\n\thotpink: '#ff69b4',\n\tindianred: '#cd5c5c',\n\tindigo: '#4b0082',\n\tivory: '#fffff0',\n\tkhaki: '#f0e68c',\n\tlavender: '#e6e6fa',\n\tlavenderblush: '#fff0f5',\n\tlawngreen: '#7cfc00',\n\tlemonchiffon: '#fffacd',\n\tlightblue: '#add8e6',\n\tlightcoral: '#f08080',\n\tlightcyan: '#e0ffff',\n\tlightgoldenrodyellow: '#fafad2',\n\tlightgrey: '#d3d3d3',\n\tlightgreen: '#90ee90',\n\tlightpink: '#ffb6c1',\n\tlightsalmon: '#ffa07a',\n\tlightseagreen: '#20b2aa',\n\tlightskyblue: '#87cefa',\n\tlightslategray: '#778899',\n\tlightsteelblue: '#b0c4de',\n\tlightyellow: '#ffffe0',\n\tlime: '#00ff00',\n\tlimegreen: '#32cd32',\n\tlinen: '#faf0e6',\n\tmagenta: '#ff00ff',\n\tmaroon: '#800000',\n\tmediumaquamarine: '#66cdaa',\n\tmediumblue: '#0000cd',\n\tmediumorchid: '#ba55d3',\n\tmediumpurple: '#9370d8',\n\tmediumseagreen: '#3cb371',\n\tmediumslateblue: '#7b68ee',\n\tmediumspringgreen: '#00fa9a',\n\tmediumturquoise: '#48d1cc',\n\tmediumvioletred: '#c71585',\n\tmidnightblue: '#191970',\n\tmintcream: '#f5fffa',\n\tmistyrose: '#ffe4e1',\n\tmoccasin: '#ffe4b5',\n\tnavajowhite: '#ffdead',\n\tnavy: '#000080',\n\toldlace: '#fdf5e6',\n\tolive: '#808000',\n\tolivedrab: '#6b8e23',\n\torange: '#ffa500',\n\torangered: '#ff4500',\n\torchid: '#da70d6',\n\tpalegoldenrod: '#eee8aa',\n\tpalegreen: '#98fb98',\n\tpaleturquoise: '#afeeee',\n\tpalevioletred: '#d87093',\n\tpapayawhip: '#ffefd5',\n\tpeachpuff: '#ffdab9',\n\tperu: '#cd853f',\n\tpink: '#ffc0cb',\n\tplum: '#dda0dd',\n\tpowderblue: '#b0e0e6',\n\tpurple: '#800080',\n\trebeccapurple: '#663399',\n\tred: '#ff0000',\n\trosybrown: '#bc8f8f',\n\troyalblue: '#4169e1',\n\tsaddlebrown: '#8b4513',\n\tsalmon: '#fa8072',\n\tsandybrown: '#f4a460',\n\tseagreen: '#2e8b57',\n\tseashell: '#fff5ee',\n\tsienna: '#a0522d',\n\tsilver: '#c0c0c0',\n\tskyblue: '#87ceeb',\n\tslateblue: '#6a5acd',\n\tslategray: '#708090',\n\tsnow: '#fffafa',\n\tspringgreen: '#00ff7f',\n\tsteelblue: '#4682b4',\n\ttan: '#d2b48c',\n\tteal: '#008080',\n\tthistle: '#d8bfd8',\n\ttomato: '#ff6347',\n\tturquoise: '#40e0d0',\n\tviolet: '#ee82ee',\n\twheat: '#f5deb3',\n\twhite: '#ffffff',\n\twhitesmoke: '#f5f5f5',\n\tyellow: '#ffff00',\n\tyellowgreen: '#9acd32',\n};\nconst HEX_REGEX = /^#([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i;\n\nconst ColorUtils = {\n\tgetNewColor(options, customHexValidator, oldColor = {}) {\n\t\tif (options.hex) {\n\t\t\tif (\n\t\t\t\tcustomHexValidator\n\t\t\t\t\t? !customHexValidator(options.hex)\n\t\t\t\t\t: !this.isValidHex(options.hex)\n\t\t\t) {\n\t\t\t\treturn assign({}, oldColor, {\n\t\t\t\t\thex: options.hex,\n\t\t\t\t\terrors: assign({}, oldColor.errors, {\n\t\t\t\t\t\thex: true,\n\t\t\t\t\t}),\n\t\t\t\t\thsv: {\n\t\t\t\t\t\thue: '',\n\t\t\t\t\t\tsaturation: '',\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\n\t\t\t\t\trgb: {\n\t\t\t\t\t\tred: '',\n\t\t\t\t\t\tgreen: '',\n\t\t\t\t\t\tblue: '',\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst returnColor = {\n\t\t\t\thex: options.hex,\n\t\t\t\thsv: this.getHsvFromHex(options.hex),\n\t\t\t\trgb: this.getRgbFromHex(options.hex),\n\t\t\t};\n\n\t\t\tif (options.name) {\n\t\t\t\treturnColor.name = options.name;\n\t\t\t}\n\n\t\t\treturn returnColor;\n\t\t}\n\n\t\tif ('red' in options || 'blue' in options || 'green' in options) {\n\t\t\tconst rgb = assign({}, oldColor.rgb, options);\n\t\t\tconst errors = this.getRgbErrors(rgb);\n\n\t\t\tif (Object.values(errors).includes(true)) {\n\t\t\t\treturn assign({}, oldColor, {\n\t\t\t\t\trgb,\n\t\t\t\t\terrors: assign({}, oldColor.errors, errors),\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\thex: this.getHexFromRgb(rgb),\n\t\t\t\thsv: this.getHsvFromRgb(rgb),\n\t\t\t\trgb,\n\t\t\t};\n\t\t}\n\n\t\tif ('hue' in options || 'saturation' in options || 'value' in options) {\n\t\t\tconst hsv = assign({}, oldColor.hsv, options);\n\t\t\treturn {\n\t\t\t\thex: this.getHexFromHsv(hsv),\n\t\t\t\thsv,\n\t\t\t\trgb: this.getRgbFromHsv(hsv),\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\thex: '',\n\t\t\thsv: {\n\t\t\t\thue: '',\n\t\t\t\tsaturation: '',\n\t\t\t\tvalue: '',\n\t\t\t},\n\t\t\trgb: {\n\t\t\t\tred: '',\n\t\t\t\tgreen: '',\n\t\t\t\tblue: '',\n\t\t\t},\n\t\t};\n\t},\n\n\tgetDeltaColor(options, customHexValidator, oldColor) {\n\t\tconst limitValue = (value) => Math.min(Math.max(value, 0), 100);\n\n\t\treturn this.getNewColor(\n\t\t\t{\n\t\t\t\tsaturation: limitValue(\n\t\t\t\t\toldColor.hsv.saturation + (options.saturation || 0)\n\t\t\t\t),\n\t\t\t\tvalue: limitValue(oldColor.hsv.value + (options.value || 0)),\n\t\t\t},\n\t\t\tcustomHexValidator,\n\t\t\toldColor\n\t\t);\n\t},\n\n\tisValidHex(value) {\n\t\treturn !value || HEX_REGEX.test(this.toSixDigitHex(value));\n\t},\n\n\tgetRgbErrors(rgb) {\n\t\tconst hasError = (value) =>\n\t\t\tisNaN(value) ||\n\t\t\tMath.floor(value) !== Number(value) ||\n\t\t\tvalue < 0 ||\n\t\t\tvalue >= 256;\n\n\t\treturn Object.entries(rgb).reduce((errors, keyValue) => {\n\t\t\t// eslint-disable-next-line no-param-reassign\n\t\t\terrors[keyValue[0]] = hasError(keyValue[1]);\n\t\t\treturn errors;\n\t\t}, {});\n\t},\n\n\tgetHsvFromHex(hex) {\n\t\treturn this.getHsvFromRgb(this.getRgbFromHex(hex));\n\t},\n\n\tgetHexFromHsv({ hue, saturation, value }) {\n\t\treturn this.getHexFromRgb(this.getRgbFromHsv({ hue, saturation, value }));\n\t},\n\n\tgetHexFromNamedColor(name) {\n\t\treturn COLOR_NAMES[name.toLowerCase()] || null;\n\t},\n\n\tgetHsvFromRgb({ red, green, blue }) {\n\t\tconst redRatio = red / 255;\n\t\tconst greenRatio = green / 255;\n\t\tconst blueRatio = blue / 255;\n\n\t\tconst max = Math.max(redRatio, greenRatio, blueRatio);\n\t\tconst min = Math.min(redRatio, greenRatio, blueRatio);\n\n\t\tconst delta = max - min;\n\t\tconst saturation = max === 0 ? 0 : (delta / max) * 100;\n\t\tconst value = max * 100;\n\t\tlet hue;\n\n\t\tif (max === min) {\n\t\t\thue = 0;\n\t\t} else {\n\t\t\tif (redRatio === max) {\n\t\t\t\thue =\n\t\t\t\t\t(greenRatio - blueRatio) / delta + (greenRatio < blueRatio ? 6 : 0);\n\t\t\t} else if (greenRatio === max) {\n\t\t\t\thue = (blueRatio - redRatio) / delta + 2;\n\t\t\t} else {\n\t\t\t\thue = (redRatio - greenRatio) / delta + 4;\n\t\t\t}\n\n\t\t\thue *= 60;\n\t\t}\n\n\t\treturn { hue, saturation, value };\n\t},\n\n\tgetRgbFromHsv({ hue, saturation, value }) {\n\t\tconst hueRatio = hue / 360;\n\t\tconst satRatio = saturation / 100;\n\t\tconst valRatio = value / 100;\n\n\t\tlet red;\n\t\tlet green;\n\t\tlet blue;\n\n\t\tconst i = Math.floor(hueRatio * 6);\n\t\tconst f = hueRatio * 6 - i;\n\t\tconst p = valRatio * (1 - satRatio);\n\t\tconst q = valRatio * (1 - f * satRatio);\n\t\tconst t = valRatio * (1 - (1 - f) * satRatio);\n\n\t\tswitch (i % 6) {\n\t\t\tcase 0:\n\t\t\t\tred = valRatio;\n\t\t\t\tgreen = t;\n\t\t\t\tblue = p;\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tred = q;\n\t\t\t\tgreen = valRatio;\n\t\t\t\tblue = p;\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tred = p;\n\t\t\t\tgreen = valRatio;\n\t\t\t\tblue = t;\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tred = p;\n\t\t\t\tgreen = q;\n\t\t\t\tblue = valRatio;\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tred = t;\n\t\t\t\tgreen = p;\n\t\t\t\tblue = valRatio;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tred = valRatio;\n\t\t\t\tgreen = p;\n\t\t\t\tblue = q;\n\t\t}\n\n\t\treturn {\n\t\t\tred: Math.round(red * 255),\n\t\t\tblue: Math.round(blue * 255),\n\t\t\tgreen: Math.round(green * 255),\n\t\t};\n\t},\n\n\tgetHexFromRgb({ red, green, blue }) {\n\t\tfunction getHex(color) {\n\t\t\treturn `0${Math.round(color).toString(16)}`.substr(-2);\n\t\t}\n\t\treturn `#${getHex(red)}${getHex(green)}${getHex(blue)}`;\n\t},\n\n\tgetRgbFromHex(hex) {\n\t\tconst result = HEX_REGEX.exec(this.toSixDigitHex(hex));\n\t\treturn {\n\t\t\tred: parseInt(result[1], 16),\n\t\t\tgreen: parseInt(result[2], 16),\n\t\t\tblue: parseInt(result[3], 16),\n\t\t};\n\t},\n\n\ttoSixDigitHex(value) {\n\t\tconst shortHandHex = /^#([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n\t\tconst match = shortHandHex.exec(value);\n\t\tif (match) {\n\t\t\treturn `#${match[1]}${match[1]}${match[2]}${match[2]}${match[3]}${match[3]}`;\n\t\t}\n\n\t\treturn value;\n\t},\n};\n\nexport default ColorUtils;\n"],"mappings":";;AAEA,IAAM,IAAc;CACnB,WAAW;CACX,cAAc;CACd,MAAM;CACN,YAAY;CACZ,OAAO;CACP,OAAO;CACP,QAAQ;CACR,OAAO;CACP,gBAAgB;CAChB,MAAM;CACN,YAAY;CACZ,OAAO;CACP,WAAW;CACX,WAAW;CACX,YAAY;CACZ,WAAW;CACX,OAAO;CACP,gBAAgB;CAChB,UAAU;CACV,SAAS;CACT,MAAM;CACN,UAAU;CACV,UAAU;CACV,eAAe;CACf,UAAU;CACV,WAAW;CACX,WAAW;CACX,aAAa;CACb,gBAAgB;CAChB,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,YAAY;CACZ,cAAc;CACd,eAAe;CACf,eAAe;CACf,eAAe;CACf,YAAY;CACZ,UAAU;CACV,aAAa;CACb,SAAS;CACT,Y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7B;CACD;CAEA,cAAc,GAAO;EAEpB,IAAM,IAAQ,kCAAa,KAAK,CAAK;EAKrC,OAJI,IACI,IAAI,EAAM,KAAK,EAAM,KAAK,EAAM,KAAK,EAAM,KAAK,EAAM,KAAK,EAAM,OAGlE;CACR;AACD"}
|
|
1
|
+
{"version":3,"file":"color.js","names":[],"sources":["../../../utilities/color.js"],"sourcesContent":["import assign from 'lodash.assign';\n\nconst COLOR_NAMES = {\n\taliceblue: '#f0f8ff',\n\tantiquewhite: '#faebd7',\n\taqua: '#00ffff',\n\taquamarine: '#7fffd4',\n\tazure: '#f0ffff',\n\tbeige: '#f5f5dc',\n\tbisque: '#ffe4c4',\n\tblack: '#000000',\n\tblanchedalmond: '#ffebcd',\n\tblue: '#0000ff',\n\tblueviolet: '#8a2be2',\n\tbrown: '#a52a2a',\n\tburlywood: '#deb887',\n\tcadetblue: '#5f9ea0',\n\tchartreuse: '#7fff00',\n\tchocolate: '#d2691e',\n\tcoral: '#ff7f50',\n\tcornflowerblue: '#6495ed',\n\tcornsilk: '#fff8dc',\n\tcrimson: '#dc143c',\n\tcyan: '#00ffff',\n\tdarkblue: '#00008b',\n\tdarkcyan: '#008b8b',\n\tdarkgoldenrod: '#b8860b',\n\tdarkgray: '#a9a9a9',\n\tdarkgreen: '#006400',\n\tdarkkhaki: '#bdb76b',\n\tdarkmagenta: '#8b008b',\n\tdarkolivegreen: '#556b2f',\n\tdarkorange: '#ff8c00',\n\tdarkorchid: '#9932cc',\n\tdarkred: '#8b0000',\n\tdarksalmon: '#e9967a',\n\tdarkseagreen: '#8fbc8f',\n\tdarkslateblue: '#483d8b',\n\tdarkslategray: '#2f4f4f',\n\tdarkturquoise: '#00ced1',\n\tdarkviolet: '#9400d3',\n\tdeeppink: '#ff1493',\n\tdeepskyblue: '#00bfff',\n\tdimgray: '#696969',\n\tdodgerblue: '#1e90ff',\n\tfirebrick: '#b22222',\n\tfloralwhite: '#fffaf0',\n\tforestgreen: '#228b22',\n\tfuchsia: '#ff00ff',\n\tgainsboro: '#dcdcdc',\n\tghostwhite: '#f8f8ff',\n\tgold: '#ffd700',\n\tgoldenrod: '#daa520',\n\tgray: '#808080',\n\tgreen: '#008000',\n\tgreenyellow: '#adff2f',\n\thoneydew: '#f0fff0',\n\thotpink: '#ff69b4',\n\tindianred: '#cd5c5c',\n\tindigo: '#4b0082',\n\tivory: '#fffff0',\n\tkhaki: '#f0e68c',\n\tlavender: '#e6e6fa',\n\tlavenderblush: '#fff0f5',\n\tlawngreen: '#7cfc00',\n\tlemonchiffon: '#fffacd',\n\tlightblue: '#add8e6',\n\tlightcoral: '#f08080',\n\tlightcyan: '#e0ffff',\n\tlightgoldenrodyellow: '#fafad2',\n\tlightgrey: '#d3d3d3',\n\tlightgreen: '#90ee90',\n\tlightpink: '#ffb6c1',\n\tlightsalmon: '#ffa07a',\n\tlightseagreen: '#20b2aa',\n\tlightskyblue: '#87cefa',\n\tlightslategray: '#778899',\n\tlightsteelblue: '#b0c4de',\n\tlightyellow: '#ffffe0',\n\tlime: '#00ff00',\n\tlimegreen: '#32cd32',\n\tlinen: '#faf0e6',\n\tmagenta: '#ff00ff',\n\tmaroon: '#800000',\n\tmediumaquamarine: '#66cdaa',\n\tmediumblue: '#0000cd',\n\tmediumorchid: '#ba55d3',\n\tmediumpurple: '#9370d8',\n\tmediumseagreen: '#3cb371',\n\tmediumslateblue: '#7b68ee',\n\tmediumspringgreen: '#00fa9a',\n\tmediumturquoise: '#48d1cc',\n\tmediumvioletred: '#c71585',\n\tmidnightblue: '#191970',\n\tmintcream: '#f5fffa',\n\tmistyrose: '#ffe4e1',\n\tmoccasin: '#ffe4b5',\n\tnavajowhite: '#ffdead',\n\tnavy: '#000080',\n\toldlace: '#fdf5e6',\n\tolive: '#808000',\n\tolivedrab: '#6b8e23',\n\torange: '#ffa500',\n\torangered: '#ff4500',\n\torchid: '#da70d6',\n\tpalegoldenrod: '#eee8aa',\n\tpalegreen: '#98fb98',\n\tpaleturquoise: '#afeeee',\n\tpalevioletred: '#d87093',\n\tpapayawhip: '#ffefd5',\n\tpeachpuff: '#ffdab9',\n\tperu: '#cd853f',\n\tpink: '#ffc0cb',\n\tplum: '#dda0dd',\n\tpowderblue: '#b0e0e6',\n\tpurple: '#800080',\n\trebeccapurple: '#663399',\n\tred: '#ff0000',\n\trosybrown: '#bc8f8f',\n\troyalblue: '#4169e1',\n\tsaddlebrown: '#8b4513',\n\tsalmon: '#fa8072',\n\tsandybrown: '#f4a460',\n\tseagreen: '#2e8b57',\n\tseashell: '#fff5ee',\n\tsienna: '#a0522d',\n\tsilver: '#c0c0c0',\n\tskyblue: '#87ceeb',\n\tslateblue: '#6a5acd',\n\tslategray: '#708090',\n\tsnow: '#fffafa',\n\tspringgreen: '#00ff7f',\n\tsteelblue: '#4682b4',\n\ttan: '#d2b48c',\n\tteal: '#008080',\n\tthistle: '#d8bfd8',\n\ttomato: '#ff6347',\n\tturquoise: '#40e0d0',\n\tviolet: '#ee82ee',\n\twheat: '#f5deb3',\n\twhite: '#ffffff',\n\twhitesmoke: '#f5f5f5',\n\tyellow: '#ffff00',\n\tyellowgreen: '#9acd32',\n};\nconst HEX_REGEX = /^#([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i;\n\nconst ColorUtils = {\n\tgetNewColor(options, customHexValidator, oldColor = {}) {\n\t\tif (options.hex) {\n\t\t\tif (\n\t\t\t\tcustomHexValidator\n\t\t\t\t\t? !customHexValidator(options.hex)\n\t\t\t\t\t: !this.isValidHex(options.hex)\n\t\t\t) {\n\t\t\t\treturn assign({}, oldColor, {\n\t\t\t\t\thex: options.hex,\n\t\t\t\t\terrors: assign({}, oldColor.errors, {\n\t\t\t\t\t\thex: true,\n\t\t\t\t\t}),\n\t\t\t\t\thsv: {\n\t\t\t\t\t\thue: '',\n\t\t\t\t\t\tsaturation: '',\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\n\t\t\t\t\trgb: {\n\t\t\t\t\t\tred: '',\n\t\t\t\t\t\tgreen: '',\n\t\t\t\t\t\tblue: '',\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst returnColor = {\n\t\t\t\thex: options.hex,\n\t\t\t\thsv: this.getHsvFromHex(options.hex),\n\t\t\t\trgb: this.getRgbFromHex(options.hex),\n\t\t\t};\n\n\t\t\tif (options.name) {\n\t\t\t\treturnColor.name = options.name;\n\t\t\t}\n\n\t\t\treturn returnColor;\n\t\t}\n\n\t\tif ('red' in options || 'blue' in options || 'green' in options) {\n\t\t\tconst rgb = assign({}, oldColor.rgb, options);\n\t\t\tconst errors = this.getRgbErrors(rgb);\n\n\t\t\tif (Object.values(errors).includes(true)) {\n\t\t\t\treturn assign({}, oldColor, {\n\t\t\t\t\trgb,\n\t\t\t\t\terrors: assign({}, oldColor.errors, errors),\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\thex: this.getHexFromRgb(rgb),\n\t\t\t\thsv: this.getHsvFromRgb(rgb),\n\t\t\t\trgb,\n\t\t\t};\n\t\t}\n\n\t\tif ('hue' in options || 'saturation' in options || 'value' in options) {\n\t\t\tconst hsv = assign({}, oldColor.hsv, options);\n\t\t\treturn {\n\t\t\t\thex: this.getHexFromHsv(hsv),\n\t\t\t\thsv,\n\t\t\t\trgb: this.getRgbFromHsv(hsv),\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\thex: '',\n\t\t\thsv: {\n\t\t\t\thue: '',\n\t\t\t\tsaturation: '',\n\t\t\t\tvalue: '',\n\t\t\t},\n\t\t\trgb: {\n\t\t\t\tred: '',\n\t\t\t\tgreen: '',\n\t\t\t\tblue: '',\n\t\t\t},\n\t\t};\n\t},\n\n\tgetDeltaColor(options, customHexValidator, oldColor) {\n\t\tconst limitValue = (value) => Math.min(Math.max(value, 0), 100);\n\n\t\treturn this.getNewColor(\n\t\t\t{\n\t\t\t\tsaturation: limitValue(\n\t\t\t\t\toldColor.hsv.saturation + (options.saturation || 0)\n\t\t\t\t),\n\t\t\t\tvalue: limitValue(oldColor.hsv.value + (options.value || 0)),\n\t\t\t},\n\t\t\tcustomHexValidator,\n\t\t\toldColor\n\t\t);\n\t},\n\n\tisValidHex(value) {\n\t\treturn !value || HEX_REGEX.test(this.toSixDigitHex(value));\n\t},\n\n\tgetRgbErrors(rgb) {\n\t\tconst hasError = (value) =>\n\t\t\tisNaN(value) ||\n\t\t\tMath.floor(value) !== Number(value) ||\n\t\t\tvalue < 0 ||\n\t\t\tvalue >= 256;\n\n\t\treturn Object.entries(rgb).reduce((errors, keyValue) => {\n\t\t\t// eslint-disable-next-line no-param-reassign\n\t\t\terrors[keyValue[0]] = hasError(keyValue[1]);\n\t\t\treturn errors;\n\t\t}, {});\n\t},\n\n\tgetHsvFromHex(hex) {\n\t\treturn this.getHsvFromRgb(this.getRgbFromHex(hex));\n\t},\n\n\tgetHexFromHsv({ hue, saturation, value }) {\n\t\treturn this.getHexFromRgb(this.getRgbFromHsv({ hue, saturation, value }));\n\t},\n\n\tgetHexFromNamedColor(name) {\n\t\treturn COLOR_NAMES[name.toLowerCase()] || null;\n\t},\n\n\tgetHsvFromRgb({ red, green, blue }) {\n\t\tconst redRatio = red / 255;\n\t\tconst greenRatio = green / 255;\n\t\tconst blueRatio = blue / 255;\n\n\t\tconst max = Math.max(redRatio, greenRatio, blueRatio);\n\t\tconst min = Math.min(redRatio, greenRatio, blueRatio);\n\n\t\tconst delta = max - min;\n\t\tconst saturation = max === 0 ? 0 : (delta / max) * 100;\n\t\tconst value = max * 100;\n\t\tlet hue;\n\n\t\tif (max === min) {\n\t\t\thue = 0;\n\t\t} else {\n\t\t\tif (redRatio === max) {\n\t\t\t\thue =\n\t\t\t\t\t(greenRatio - blueRatio) / delta + (greenRatio < blueRatio ? 6 : 0);\n\t\t\t} else if (greenRatio === max) {\n\t\t\t\thue = (blueRatio - redRatio) / delta + 2;\n\t\t\t} else {\n\t\t\t\thue = (redRatio - greenRatio) / delta + 4;\n\t\t\t}\n\n\t\t\thue *= 60;\n\t\t}\n\n\t\treturn { hue, saturation, value };\n\t},\n\n\tgetRgbFromHsv({ hue, saturation, value }) {\n\t\tconst hueRatio = hue / 360;\n\t\tconst satRatio = saturation / 100;\n\t\tconst valRatio = value / 100;\n\n\t\tlet red;\n\t\tlet green;\n\t\tlet blue;\n\n\t\tconst i = Math.floor(hueRatio * 6);\n\t\tconst f = hueRatio * 6 - i;\n\t\tconst p = valRatio * (1 - satRatio);\n\t\tconst q = valRatio * (1 - f * satRatio);\n\t\tconst t = valRatio * (1 - (1 - f) * satRatio);\n\n\t\tswitch (i % 6) {\n\t\t\tcase 0:\n\t\t\t\tred = valRatio;\n\t\t\t\tgreen = t;\n\t\t\t\tblue = p;\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tred = q;\n\t\t\t\tgreen = valRatio;\n\t\t\t\tblue = p;\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tred = p;\n\t\t\t\tgreen = valRatio;\n\t\t\t\tblue = t;\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tred = p;\n\t\t\t\tgreen = q;\n\t\t\t\tblue = valRatio;\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tred = t;\n\t\t\t\tgreen = p;\n\t\t\t\tblue = valRatio;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tred = valRatio;\n\t\t\t\tgreen = p;\n\t\t\t\tblue = q;\n\t\t}\n\n\t\treturn {\n\t\t\tred: Math.round(red * 255),\n\t\t\tblue: Math.round(blue * 255),\n\t\t\tgreen: Math.round(green * 255),\n\t\t};\n\t},\n\n\tgetHexFromRgb({ red, green, blue }) {\n\t\tfunction getHex(color) {\n\t\t\treturn `0${Math.round(color).toString(16)}`.slice(-2);\n\t\t}\n\t\treturn `#${getHex(red)}${getHex(green)}${getHex(blue)}`;\n\t},\n\n\tgetRgbFromHex(hex) {\n\t\tconst result = HEX_REGEX.exec(this.toSixDigitHex(hex));\n\t\treturn {\n\t\t\tred: parseInt(result[1], 16),\n\t\t\tgreen: parseInt(result[2], 16),\n\t\t\tblue: parseInt(result[3], 16),\n\t\t};\n\t},\n\n\ttoSixDigitHex(value) {\n\t\tconst shortHandHex = /^#([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n\t\tconst match = shortHandHex.exec(value);\n\t\tif (match) {\n\t\t\treturn `#${match[1]}${match[1]}${match[2]}${match[2]}${match[3]}${match[3]}`;\n\t\t}\n\n\t\treturn value;\n\t},\n};\n\nexport default ColorUtils;\n"],"mappings":";;AAEA,IAAM,IAAc;CACnB,WAAW;CACX,cAAc;CACd,MAAM;CACN,YAAY;CACZ,OAAO;CACP,OAAO;CACP,QAAQ;CACR,OAAO;CACP,gBAAgB;CAChB,MAAM;CACN,YAAY;CACZ,OAAO;CACP,WAAW;CACX,WAAW;CACX,YAAY;CACZ,WAAW;CACX,OAAO;CACP,gBAAgB;CAChB,UAAU;CACV,SAAS;CACT,MAAM;CACN,UAAU;CACV,UAAU;CACV,eAAe;CACf,UAAU;CACV,WAAW;CACX,WAAW;CACX,aAAa;CACb,gBAAgB;CAChB,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,YAAY;CACZ,cAAc;CACd,eAAe;CACf,eAAe;CACf,eAAe;CACf,YAAY;CACZ,UAAU;CACV,aAAa;CACb,SAAS;CACT,YAAY;CACZ,WAAW;CACX,aAAa;CACb,aAAa;CACb,SAAS;CACT,WAAW;CACX,YAAY;CACZ,MAAM;CACN,WAAW;CACX,MAAM;CACN,OAAO;CACP,aAAa;CACb,UAAU;CACV,SAAS;CACT,WAAW;CACX,QAAQ;CACR,OAAO;CACP,OAAO;CACP,UAAU;CACV,eAAe;CACf,WAAW;CACX,cAAc;CACd,WAAW;CACX,YAAY;CACZ,WAAW;CACX,sBAAsB;CACtB,WAAW;CACX,YAAY;CACZ,WAAW;CACX,aAAa;CACb,eAAe;CACf,cAAc;CACd,gBAAgB;CAChB,gBAAgB;CAChB,aAAa;CACb,MAAM;CACN,WAAW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AK;IAGJ,AAFA,IAAM,GACN,IAAQ,GACR,IAAO;IACP;GACD,KAAK;IAGJ,AAFA,IAAM,GACN,IAAQ,GACR,IAAO;IACP;GACD,KAAK;IAGJ,AAFA,IAAM,GACN,IAAQ,GACR,IAAO;IACP;GACD,KAAK;IAGJ,AAFA,IAAM,GACN,IAAQ,GACR,IAAO;IACP;GACD,SAGC,AAFA,IAAM,GACN,IAAQ,GACR,IAAO;EACT;EAEA,OAAO;GACN,KAAK,KAAK,MAAM,IAAM,GAAG;GACzB,MAAM,KAAK,MAAM,IAAO,GAAG;GAC3B,OAAO,KAAK,MAAM,IAAQ,GAAG;EAC9B;CACD;CAEA,cAAc,EAAE,QAAK,UAAO,WAAQ;EACnC,SAAS,EAAO,GAAO;GACtB,OAAO,IAAI,KAAK,MAAM,CAAK,CAAC,CAAC,SAAS,EAAE,IAAI,MAAM,EAAE;EACrD;EACA,OAAO,IAAI,EAAO,CAAG,IAAI,EAAO,CAAK,IAAI,EAAO,CAAI;CACrD;CAEA,cAAc,GAAK;EAClB,IAAM,IAAS,EAAU,KAAK,KAAK,cAAc,CAAG,CAAC;EACrD,OAAO;GACN,KAAK,SAAS,EAAO,IAAI,EAAE;GAC3B,OAAO,SAAS,EAAO,IAAI,EAAE;GAC7B,MAAM,SAAS,EAAO,IAAI,EAAE;EAC7B;CACD;CAEA,cAAc,GAAO;EAEpB,IAAM,IAAQ,kCAAa,KAAK,CAAK;EAKrC,OAJI,IACI,IAAI,EAAM,KAAK,EAAM,KAAK,EAAM,KAAK,EAAM,KAAK,EAAM,KAAK,EAAM,OAGlE;CACR;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom-element-focus.js","names":[],"sources":["../../../utilities/dom-element-focus.js"],"sourcesContent":["import findTabbableElement from './tabbable';\nimport KEYS from './key-code';\nimport { canUseDOM } from './execution-environment';\n\nlet ancestor = null;\nlet focusLaterElement = null;\n\nconst handleScopedKeyDown = (event) => {\n\tif (!canUseDOM || !ancestor || event.key !== KEYS.TAB) {\n\t\treturn;\n\t}\n\tconst tabbableElements = findTabbableElement(ancestor);\n\tconst finalTabbable =\n\t\ttabbableElements[event.shiftKey ? 0 : tabbableElements.length - 1];\n\tconst leavingFinalTabbable =\n\t\tfinalTabbable === document.activeElement ||\n\t\t// handle immediate shift+tab after opening with mouse\n\t\tancestor === document.activeElement;\n\tif (!leavingFinalTabbable) return;\n\tevent.preventDefault();\n\tconst target =\n\t\ttabbableElements[event.shiftKey ? tabbableElements.length - 1 : 0];\n\ttarget.focus();\n};\n\n// PUBLIC methods\n\nconst ElementFocus = {\n\tfocusAncestor: ({ isPortal }) => {\n\t\tif (canUseDOM) {\n\t\t\t// When a portal is used (that is attaching a separate React mount, such as with Popover) programatic focusing within that portal may cause the window to scroll down to the DOM insertion point at the end of `body`. The following prevents the scrolling from occuring.\n\t\t\tif (isPortal) {\n\t\t\t\tconst offset = window.pageYOffset;\n\t\t\t\tancestor.focus({ preventScroll: true });\n\t\t\t\twindow.scrollTo(window.pageXOffset, offset);\n\t\t\t} else {\n\t\t\t\tancestor.focus();\n\t\t\t}\n\t\t}\n\t},\n\thasOrAncestorHasFocus: () =>\n\t\tcanUseDOM &&\n\t\t(document.activeElement === ancestor ||\n\t\t\tancestor.contains(document.activeElement)),\n\treturnFocusToStoredElement: () => {\n\t\tif (canUseDOM) {\n\t\t\t// Only attempt to focus if element exists and is still in the DOM\n\t\t\t// This prevents warnings in environments like Storybook where elements\n\t\t\t// may be unmounted before focus can be restored\n\t\t\tif (\n\t\t\t\tfocusLaterElement &&\n\t\t\t\ttypeof focusLaterElement.focus === 'function' &&\n\t\t\t\tdocument.body.contains(focusLaterElement)\n\t\t\t) {\n\t\t\t\ttry {\n\t\t\t\t\tfocusLaterElement.focus();\n\t\t\t\t} catch
|
|
1
|
+
{"version":3,"file":"dom-element-focus.js","names":[],"sources":["../../../utilities/dom-element-focus.js"],"sourcesContent":["import findTabbableElement from './tabbable';\nimport KEYS from './key-code';\nimport { canUseDOM } from './execution-environment';\n\nlet ancestor = null;\nlet focusLaterElement = null;\n\nconst handleScopedKeyDown = (event) => {\n\tif (!canUseDOM || !ancestor || event.key !== KEYS.TAB) {\n\t\treturn;\n\t}\n\tconst tabbableElements = findTabbableElement(ancestor);\n\tconst finalTabbable =\n\t\ttabbableElements[event.shiftKey ? 0 : tabbableElements.length - 1];\n\tconst leavingFinalTabbable =\n\t\tfinalTabbable === document.activeElement ||\n\t\t// handle immediate shift+tab after opening with mouse\n\t\tancestor === document.activeElement;\n\tif (!leavingFinalTabbable) return;\n\tevent.preventDefault();\n\tconst target =\n\t\ttabbableElements[event.shiftKey ? tabbableElements.length - 1 : 0];\n\ttarget.focus();\n};\n\n// PUBLIC methods\n\nconst ElementFocus = {\n\tfocusAncestor: ({ isPortal }) => {\n\t\tif (canUseDOM) {\n\t\t\t// When a portal is used (that is attaching a separate React mount, such as with Popover) programatic focusing within that portal may cause the window to scroll down to the DOM insertion point at the end of `body`. The following prevents the scrolling from occuring.\n\t\t\tif (isPortal) {\n\t\t\t\tconst offset = window.pageYOffset;\n\t\t\t\tancestor.focus({ preventScroll: true });\n\t\t\t\twindow.scrollTo(window.pageXOffset, offset);\n\t\t\t} else {\n\t\t\t\tancestor.focus();\n\t\t\t}\n\t\t}\n\t},\n\thasOrAncestorHasFocus: () =>\n\t\tcanUseDOM &&\n\t\t(document.activeElement === ancestor ||\n\t\t\tancestor.contains(document.activeElement)),\n\treturnFocusToStoredElement: () => {\n\t\tif (canUseDOM) {\n\t\t\t// Only attempt to focus if element exists and is still in the DOM\n\t\t\t// This prevents warnings in environments like Storybook where elements\n\t\t\t// may be unmounted before focus can be restored\n\t\t\tif (\n\t\t\t\tfocusLaterElement &&\n\t\t\t\ttypeof focusLaterElement.focus === 'function' &&\n\t\t\t\tdocument.body.contains(focusLaterElement)\n\t\t\t) {\n\t\t\t\ttry {\n\t\t\t\t\tfocusLaterElement.focus();\n\t\t\t\t} catch {\n\t\t\t\t\t// Silently ignore - element may have been removed from DOM\n\t\t\t\t}\n\t\t\t}\n\t\t\tfocusLaterElement = null;\n\t\t}\n\t},\n\tsetupScopedFocus: ({ ancestorElement }) => {\n\t\tancestor = ancestorElement;\n\t\twindow.addEventListener('keydown', handleScopedKeyDown, false);\n\t},\n\tstoreActiveElement: () => {\n\t\tfocusLaterElement = canUseDOM ? document.activeElement : null;\n\t},\n\tteardownScopedFocus: () => {\n\t\tancestor = null;\n\t\tif (canUseDOM) {\n\t\t\twindow.removeEventListener('keydown', handleScopedKeyDown);\n\t\t}\n\t},\n};\n\nexport default ElementFocus;\n"],"mappings":";;;;AAIA,IAAI,IAAW,MACX,IAAoB,MAElB,KAAuB,MAAU;CACtC,IAAI,CAAC,KAAa,CAAC,KAAY,EAAM,QAAQ,EAAK,KACjD;CAED,IAAM,IAAmB,EAAoB,CAAQ;CAEpD,GAAiB,EAAM,WAAW,IAAI,EAAiB,SAAS,OAE9C,SAAS,iBAE3B,MAAa,SAAS,mBAEvB,EAAM,eAAe,GAGrB,EADkB,EAAM,WAAW,EAAiB,SAAS,IAAI,EACjE,CAAO,MAAM;AACd,GAIM,IAAe;CACpB,gBAAgB,EAAE,kBAAe;EAChC,IAAI,GAAW;GAEd,IAAI,GAAU;IACb,IAAM,IAAS,OAAO;IAEtB,AADA,EAAS,MAAM,EAAE,eAAe,GAAK,CAAC,GACtC,OAAO,SAAS,OAAO,aAAa,CAAM;GAC3C,OACC,EAAS,MAAM;EAEjB;CACD;CACA,6BACC,MACC,SAAS,kBAAkB,KAC3B,EAAS,SAAS,SAAS,aAAa;CAC1C,kCAAkC;EACjC,IAAI,GAAW;GAId,IACC,KACA,OAAO,EAAkB,SAAU,cACnC,SAAS,KAAK,SAAS,CAAiB,GAExC,IAAI;IACH,EAAkB,MAAM;GACzB,QAAQ,CAER;GAED,IAAoB;EACrB;CACD;CACA,mBAAmB,EAAE,yBAAsB;EAE1C,AADA,IAAW,GACX,OAAO,iBAAiB,WAAW,GAAqB,EAAK;CAC9D;CACA,0BAA0B;EACzB,IAAoB,IAAY,SAAS,gBAAgB;CAC1D;CACA,2BAA2B;EAE1B,AADA,IAAW,MACP,KACH,OAAO,oBAAoB,WAAW,CAAmB;CAE3D;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-environment.js","names":[],"sources":["../../../utilities/execution-environment.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\nconst canUseDOM = !!(\n\ttypeof window !== 'undefined' &&\n\twindow.document &&\n\twindow.document.createElement\n);\nconst canUseEventListeners =\n\tcanUseDOM && Boolean(window.addEventListener || window.attachEvent);\nconst canUseViewport = canUseDOM && Boolean(window.screen);\n\nexport { canUseDOM, canUseEventListeners, canUseViewport };\n"],"mappings":";AAGA,IAAM,IAAY,CAAC,EAClB,OAAO,SAAW,OAClB,OAAO,
|
|
1
|
+
{"version":3,"file":"execution-environment.js","names":[],"sources":["../../../utilities/execution-environment.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\nconst canUseDOM = !!(\n\ttypeof window !== 'undefined' &&\n\twindow.document &&\n\t// A feature check, not a call; one `createElement` overload is deprecated.\n\t// eslint-disable-next-line local/no-deprecated\n\twindow.document.createElement\n);\nconst canUseEventListeners =\n\tcanUseDOM && Boolean(window.addEventListener || window.attachEvent);\nconst canUseViewport = canUseDOM && Boolean(window.screen);\n\nexport { canUseDOM, canUseEventListeners, canUseViewport };\n"],"mappings":";AAGA,IAAM,IAAY,CAAC,EAClB,OAAO,SAAW,OAClB,OAAO,YAGP,OAAO,SAAS,gBAEX,IACL,KAAa,GAAQ,OAAO,oBAAoB,OAAO;AACjC,KAAqB,OAAO"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region utilities/get-aria-props.js
|
|
2
2
|
function e(e) {
|
|
3
|
-
return Object.keys(e).reduce((t, n) => (n.
|
|
3
|
+
return Object.keys(e).reduce((t, n) => (n.slice(0, 5) === "aria-" && (t[n] = e[n]), t), {});
|
|
4
4
|
}
|
|
5
5
|
//#endregion
|
|
6
6
|
export { e as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-aria-props.js","names":[],"sources":["../../../utilities/get-aria-props.js"],"sourcesContent":["export default function getAriaProps(props) {\n\treturn Object.keys(props).reduce((prev, key) => {\n\t\tif (key.
|
|
1
|
+
{"version":3,"file":"get-aria-props.js","names":[],"sources":["../../../utilities/get-aria-props.js"],"sourcesContent":["export default function getAriaProps(props) {\n\treturn Object.keys(props).reduce((prev, key) => {\n\t\tif (key.slice(0, 5) === 'aria-') {\n\t\t\t// eslint-disable-next-line no-param-reassign\n\t\t\tprev[key] = props[key];\n\t\t}\n\t\treturn prev;\n\t}, {});\n}\n"],"mappings":";AAAA,SAAwB,EAAa,GAAO;CAC3C,OAAO,OAAO,KAAK,CAAK,CAAC,CAAC,QAAQ,GAAM,OACnC,EAAI,MAAM,GAAG,CAAC,MAAM,YAEvB,EAAK,KAAO,EAAM,KAEZ,IACL,CAAC,CAAC;AACN"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
//#region utilities/get-component-doc.js
|
|
2
|
-
var e =
|
|
3
|
-
process.env.NODE_ENV !== "production" && (
|
|
4
|
-
let n =
|
|
5
|
-
return (
|
|
2
|
+
var e = "https://opensource.salesforce.com/design-system-react/", t = (t) => t ? `${e}?path=/docs/components-${t.toLowerCase()}--docs` : e, n = function() {};
|
|
3
|
+
process.env.NODE_ENV !== "production" && (n = function(e) {
|
|
4
|
+
let n = t(e && e.classKey);
|
|
5
|
+
return () => `See the documentation: ${n}`;
|
|
6
6
|
});
|
|
7
|
-
var
|
|
7
|
+
var r = n;
|
|
8
8
|
//#endregion
|
|
9
|
-
export {
|
|
9
|
+
export { e as DOCS_SITE, r as default, t as storybookDocsUrl };
|
|
10
10
|
|
|
11
11
|
//# sourceMappingURL=get-component-doc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-component-doc.js","names":[],"sources":["../../../utilities/get-component-doc.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\
|
|
1
|
+
{"version":3,"file":"get-component-doc.js","names":[],"sources":["../../../utilities/get-component-doc.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\n/** The hosted v11 docs: Storybook, with the LLM docs at the root. */\nexport const DOCS_SITE =\n\t'https://opensource.salesforce.com/design-system-react/';\n\n/**\n * The Storybook docs page of a component. A component's stories file has the\n * title `Components/<classKey>` (its `component.json` `classKey`), and\n * Storybook makes the page id from the title: `Components/ButtonGroup` is\n * `components-buttongroup--docs`. `scripts/__tests__/storybook-doc-links.test.mjs`\n * checks every component against Storybook's own `toId`.\n */\nexport const storybookDocsUrl = (classKey) =>\n\tclassKey\n\t\t? `${DOCS_SITE}?path=/docs/components-${classKey.toLowerCase()}--docs`\n\t\t: DOCS_SITE;\n\nlet getComponentDocFn = function getComponentDocFnEmpty() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\t/**\n\t * Returns the link that a component's prop warnings end with. Callers pass\n\t * the prop name, but Storybook has no anchor per prop, so every warning\n\t * links the component's docs page.\n\t */\n\tgetComponentDocFn = function getComponentDocFnInside(jsonDoc) {\n\t\tconst url = storybookDocsUrl(jsonDoc && jsonDoc.classKey);\n\t\treturn () => `See the documentation: ${url}`;\n\t};\n}\n\nexport default getComponentDocFn;\n"],"mappings":";AAKA,IAAa,IACZ,0DASY,KAAoB,MAChC,IACG,GAAG,EAAU,yBAAyB,EAAS,YAAY,EAAE,UAC7D,GAEA,IAAoB,WAAkC,CAAC;AAE3D,QAAA,IAAA,aAA6B,iBAM5B,IAAoB,SAAiC,GAAS;CAC7D,IAAM,IAAM,EAAiB,KAAW,EAAQ,QAAQ;CACxD,aAAa,0BAA0B;AACxC;AAGD,IAAA,IAAe"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region utilities/get-data-props.js
|
|
2
2
|
function e(e) {
|
|
3
|
-
return Object.keys(e).reduce((t, n) => (n.
|
|
3
|
+
return Object.keys(e).reduce((t, n) => (n.slice(0, 5) === "data-" && (t[n] = e[n]), t), {});
|
|
4
4
|
}
|
|
5
5
|
//#endregion
|
|
6
6
|
export { e as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-data-props.js","names":[],"sources":["../../../utilities/get-data-props.js"],"sourcesContent":["export default function getDataProps(props) {\n\treturn Object.keys(props).reduce((prev, key) => {\n\t\tif (key.
|
|
1
|
+
{"version":3,"file":"get-data-props.js","names":[],"sources":["../../../utilities/get-data-props.js"],"sourcesContent":["export default function getDataProps(props) {\n\treturn Object.keys(props).reduce((prev, key) => {\n\t\tif (key.slice(0, 5) === 'data-') {\n\t\t\t// eslint-disable-next-line no-param-reassign\n\t\t\tprev[key] = props[key];\n\t\t}\n\t\treturn prev;\n\t}, {});\n}\n"],"mappings":";AAAA,SAAwB,EAAa,GAAO;CAC3C,OAAO,OAAO,KAAK,CAAK,CAAC,CAAC,QAAQ,GAAM,OACnC,EAAI,MAAM,GAAG,CAAC,MAAM,YAEvB,EAAK,KAAO,EAAM,KAEZ,IACL,CAAC,CAAC;AACN"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import e from "./key-code.js";
|
|
2
2
|
import t from "./event.js";
|
|
3
|
-
import n from "react-dom";
|
|
4
3
|
//#region utilities/keyboard-navigable-dialog.js
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
},
|
|
4
|
+
var n = ({ event: e, trigger: t, eventTarget: n, handleClick: r }) => {
|
|
5
|
+
t && t === n && r(e);
|
|
6
|
+
}, r = ({ event: r, isOpen: i, handleClick: a, key: o, eventTarget: s, trigger: c, toggleOpen: l }) => {
|
|
8
7
|
switch (o) {
|
|
9
8
|
case e.ESCAPE:
|
|
10
|
-
i && (l(), t.trapEvent(
|
|
9
|
+
i && (l(), t.trapEvent(r));
|
|
11
10
|
break;
|
|
12
|
-
case e.ENTER: i ||
|
|
11
|
+
case e.ENTER: i || n({
|
|
12
|
+
event: r,
|
|
13
13
|
trigger: c,
|
|
14
14
|
eventTarget: s,
|
|
15
15
|
handleClick: a
|
|
@@ -17,6 +17,6 @@ var r = ({ trigger: e, eventTarget: t, handleClick: r }) => {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
//#endregion
|
|
20
|
-
export {
|
|
20
|
+
export { r as default };
|
|
21
21
|
|
|
22
22
|
//# sourceMappingURL=keyboard-navigable-dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard-navigable-dialog.js","names":[],"sources":["../../../utilities/keyboard-navigable-dialog.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// # Assistive Technology / Keyboard Navigable Trait for Dialogs with Tabbable content\n\n/*\n * Guidelines for Popover\n *\n * - Focus is trapped. Tabbing to an index outside of the dialog is not allowed. Popover must be closed first via ESC.\n * - There should always be a focusable element inside, to place user focus on such as a close button\n * - Must be dismissible via ESC and a close button\n * - Uses tabIndex in wrapper and has tabbable items within it despite being outside document flow.\n * - Entire popover receives focus when opened and has a aria-labelledby that points to the header id, so it will read the heading,\n * - Must return focus to trigger after closing.\n * - F6 will allow the user to keep popover open and go back to tabbing in “app-context” instead of “dialog-context.” (not implemented, yet)\n */\n\n// ## Dependencies\n\n// ###
|
|
1
|
+
{"version":3,"file":"keyboard-navigable-dialog.js","names":[],"sources":["../../../utilities/keyboard-navigable-dialog.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// # Assistive Technology / Keyboard Navigable Trait for Dialogs with Tabbable content\n\n/*\n * Guidelines for Popover\n *\n * - Focus is trapped. Tabbing to an index outside of the dialog is not allowed. Popover must be closed first via ESC.\n * - There should always be a focusable element inside, to place user focus on such as a close button\n * - Must be dismissible via ESC and a close button\n * - Uses tabIndex in wrapper and has tabbable items within it despite being outside document flow.\n * - Entire popover receives focus when opened and has a aria-labelledby that points to the header id, so it will read the heading,\n * - Must return focus to trigger after closing.\n * - F6 will allow the user to keep popover open and go back to tabbing in “app-context” instead of “dialog-context.” (not implemented, yet)\n */\n\n// ## Dependencies\n\n// ### Event Helpers\nimport KEYS from './key-code';\nimport EventUtil from './event';\n\n// `trigger` is the trigger's DOM element. This read the global `window.event`\n// and called `ReactDOM.findDOMNode`, which React 19 removed.\nconst internalHandleClick = ({ event, trigger, eventTarget, handleClick }) => {\n\tif (trigger && trigger === eventTarget) {\n\t\thandleClick(event);\n\t}\n};\n\nconst KeyboardNavigableDialog = ({\n\tevent,\n\tisOpen,\n\thandleClick,\n\tkey,\n\teventTarget,\n\ttrigger,\n\ttoggleOpen,\n}) => {\n\tswitch (key) {\n\t\tcase KEYS.ESCAPE:\n\t\t\tif (isOpen) {\n\t\t\t\ttoggleOpen();\n\t\t\t\tEventUtil.trapEvent(event);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase KEYS.ENTER:\n\t\t\tif (!isOpen) {\n\t\t\t\tinternalHandleClick({\n\t\t\t\t\tevent,\n\t\t\t\t\ttrigger,\n\t\t\t\t\teventTarget,\n\t\t\t\t\thandleClick,\n\t\t\t\t});\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n};\n\nexport default KeyboardNavigableDialog;\n"],"mappings":";;;AAyBA,IAAM,KAAuB,EAAE,UAAO,YAAS,gBAAa,qBAAkB;CAC7E,AAAI,KAAW,MAAY,KAC1B,EAAY,CAAK;AAEnB,GAEM,KAA2B,EAChC,UACA,WACA,gBACA,QACA,gBACA,YACA,oBACK;CACL,QAAQ,GAAR;EACC,KAAK,EAAK;GACT,AAAI,MACH,EAAW,GACX,EAAU,UAAU,CAAK;GAE1B;EACD,KAAK,EAAK,OACT,AAAK,KACJ,EAAoB;GACnB;GACA;GACA;GACA;EACD,CAAC;CAKJ;AACD"}
|
|
@@ -6,7 +6,7 @@ var n = (e) => e ? (typeof e == "object" && e.nodeType, e) : null, r = ({ compon
|
|
|
6
6
|
g = /^[ -~]$/.test(g) ? g.toLowerCase() : null;
|
|
7
7
|
let _ = s === e.ENTER || s === e.SPACE || s === e.UP || s === e.DOWN;
|
|
8
8
|
if (s === e.ESCAPE) a && f();
|
|
9
|
-
else if (!a) [h] = p, (_ || g) && f(), _ &&
|
|
9
|
+
else if (!a) [h] = p, (_ || g) && f(), _ && n(r.getTrigger()) === d && r.handleClick(o);
|
|
10
10
|
else if (s === e.ENTER || s === e.SPACE) u(i);
|
|
11
11
|
else {
|
|
12
12
|
let n = p.indexOf(i);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard-navigate.js","names":[],"sources":["../../../utilities/keyboard-navigate.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 */\nimport escapeRegExp from 'lodash.escaperegexp';\n\nimport KEYS from './key-code';\n\n/**\n * Resolve a component context's trigger to a DOM node. `componentContext.
|
|
1
|
+
{"version":3,"file":"keyboard-navigate.js","names":[],"sources":["../../../utilities/keyboard-navigate.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 */\nimport escapeRegExp from 'lodash.escaperegexp';\n\nimport KEYS from './key-code';\n\n/**\n * Resolve a component context's trigger to a DOM node. `componentContext.getTrigger()`\n * returns the DOM element stored by a callback ref, so we return it directly. This replaces `ReactDOM.findDOMNode`, which was removed\n * in React 19.\n */\nconst resolveTriggerNode = (trigger) => {\n\tif (!trigger) {\n\t\treturn null;\n\t}\n\t// A DOM node (has nodeType); return as-is.\n\tif (typeof trigger === 'object' && trigger.nodeType) {\n\t\treturn trigger;\n\t}\n\treturn trigger;\n};\n\nconst keyboardNavigate = ({\n\tcomponentContext,\n\tcurrentFocusedIndex,\n\tisOpen,\n\tevent,\n\tkey,\n\tnavigableItems,\n\tonFocus,\n\tonSelect,\n\ttarget,\n\ttoggleOpen,\n}) => {\n\tconst { indexes } = navigableItems;\n\tconst lastIndex = indexes.length - 1;\n\tlet focusedIndex;\n\tlet ch = key;\n\n\tif (/^[ -~]$/.test(ch)) {\n\t\tch = ch.toLowerCase();\n\t} else {\n\t\tch = null;\n\t}\n\n\t// Keys that open a closed menu. Per the WAI-ARIA menu-button pattern, Down\n\t// and Up arrows open the menu (Down moving focus to the first item, Up to\n\t// the last), in addition to Enter and Space.\n\tconst openMenuKeys =\n\t\tkey === KEYS.ENTER ||\n\t\tkey === KEYS.SPACE ||\n\t\tkey === KEYS.UP ||\n\t\tkey === KEYS.DOWN;\n\n\tif (key === KEYS.ESCAPE) {\n\t\tif (isOpen) toggleOpen();\n\t} else if (!isOpen) {\n\t\t[focusedIndex] = indexes;\n\t\tif (openMenuKeys || ch) {\n\t\t\ttoggleOpen();\n\t\t}\n\t\tif (\n\t\t\topenMenuKeys &&\n\t\t\tresolveTriggerNode(componentContext.getTrigger()) === target\n\t\t) {\n\t\t\tcomponentContext.handleClick(event);\n\t\t}\n\t} else if (key === KEYS.ENTER || key === KEYS.SPACE) {\n\t\tonSelect(currentFocusedIndex);\n\t} else {\n\t\tconst navigableIndex = indexes.indexOf(currentFocusedIndex);\n\n\t\tif (key === KEYS.DOWN) {\n\t\t\tif (navigableIndex < lastIndex) {\n\t\t\t\tconst newNavigableIndex = navigableIndex + 1;\n\t\t\t\tfocusedIndex = indexes[newNavigableIndex];\n\t\t\t} else {\n\t\t\t\t[focusedIndex] = indexes;\n\t\t\t}\n\t\t} else if (key === KEYS.UP) {\n\t\t\tif (navigableIndex > 0) {\n\t\t\t\tconst newNavigableIndex = navigableIndex - 1;\n\t\t\t\tfocusedIndex = indexes[newNavigableIndex];\n\t\t\t} else {\n\t\t\t\tfocusedIndex = indexes[lastIndex];\n\t\t\t}\n\t\t} else if (ch) {\n\t\t\t// Combine subsequent keypresses\n\t\t\tconst pattern = navigableItems.keyBuffer(ch);\n\t\t\tlet consecutive = 0;\n\n\t\t\t// Support for navigating to the next option of the same letter with repeated presses of the same key\n\t\t\tif (\n\t\t\t\tpattern.length > 1 &&\n\t\t\t\tnew RegExp(`^[${escapeRegExp(ch)}]+$`).test(pattern)\n\t\t\t) {\n\t\t\t\tconsecutive = pattern.length;\n\t\t\t}\n\n\t\t\tnavigableItems.forEach((item) => {\n\t\t\t\tif (\n\t\t\t\t\t(focusedIndex === undefined &&\n\t\t\t\t\t\titem.text.slice(0, pattern.length) === pattern) ||\n\t\t\t\t\t(consecutive > 0 && item.text.slice(0, 1) === ch)\n\t\t\t\t) {\n\t\t\t\t\tconsecutive -= 1;\n\t\t\t\t\tfocusedIndex = item.index;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tonFocus(focusedIndex);\n\n\treturn focusedIndex;\n};\n\nexport default keyboardNavigate;\n"],"mappings":";;;AAWA,IAAM,KAAsB,MACtB,KAID,OAAO,KAAY,YAAY,EAAQ,UACnC,KAJA,MASH,KAAoB,EACzB,qBACA,wBACA,WACA,UACA,QACA,mBACA,YACA,aACA,WACA,oBACK;CACL,IAAM,EAAE,eAAY,GACd,IAAY,EAAQ,SAAS,GAC/B,GACA,IAAK;CAET,AAGC,IAHG,UAAU,KAAK,CAAE,IACf,EAAG,YAAY,IAEf;CAMN,IAAM,IACL,MAAQ,EAAK,SACb,MAAQ,EAAK,SACb,MAAQ,EAAK,MACb,MAAQ,EAAK;CAEd,IAAI,MAAQ,EAAK,QACZ,AAAA,KAAQ,EAAW;MACjB,IAAI,CAAC,GAKX,AAJA,CAAC,KAAgB,IACb,KAAgB,MACnB,EAAW,GAGX,KACA,EAAmB,EAAiB,WAAW,CAAC,MAAM,KAEtD,EAAiB,YAAY,CAAK;MAE7B,IAAI,MAAQ,EAAK,SAAS,MAAQ,EAAK,OAC7C,EAAS,CAAmB;MACtB;EACN,IAAM,IAAiB,EAAQ,QAAQ,CAAmB;EAE1D,IAAI,MAAQ,EAAK,MAChB,AAAI,IAAiB,IAEpB,IAAe,EADW,IAAiB,KAG3C,CAAC,KAAgB;OAEZ,IAAI,MAAQ,EAAK,IACvB,AAIC,IAJG,IAAiB,IAEL,EADW,IAAiB,KAG5B,EAAQ;OAElB,IAAI,GAAI;GAEd,IAAM,IAAU,EAAe,UAAU,CAAE,GACvC,IAAc;GAUlB,AANC,EAAQ,SAAS,KACb,OAAO,KAAK,EAAa,CAAE,EAAE,IAAI,CAAC,CAAC,KAAK,CAAO,MAEnD,IAAc,EAAQ,SAGvB,EAAe,SAAS,MAAS;IAChC,CACE,MAAiB,KAAA,KACjB,EAAK,KAAK,MAAM,GAAG,EAAQ,MAAM,MAAM,KACvC,IAAc,KAAK,EAAK,KAAK,MAAM,GAAG,CAAC,MAAM,OAE9C,KACA,IAAe,EAAK;GAEtB,CAAC;EACF;CACD;CAIA,OAFA,EAAQ,CAAY,GAEb;AACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-backgrounds.js","names":[],"sources":["../../../../utilities/product-tokens/icon-backgrounds.js"],"sourcesContent":["// The following colors may not be accessible with text color or inverse white on this background color. They do not all pass WCAG AA Color Contrast Ratios.\n// https://webaim.org/resources/contrastchecker/?fcolor=FFFFFF&bcolor=FFC20E\nexport default {\n\t'global-setup': '#2A739E',\n\t'service-cloud': '#7f2443',\n\t'industry-cloud': '#4c2248',\n\t'sales-cloud': '#00857d',\n\t'commerce-cloud': '#41693d',\n\t'community-cloud': '#ffc20e',\n\t'marketing-cloud': '#ea7600',\n\tquip: '#cf451d',\n};\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"icon-backgrounds.js","names":[],"sources":["../../../../utilities/product-tokens/icon-backgrounds.js"],"sourcesContent":["// The following colors may not be accessible with text color or inverse white on this background color. They do not all pass WCAG AA Color Contrast Ratios.\n// https://webaim.org/resources/contrastchecker/?fcolor=FFFFFF&bcolor=FFC20E\n/**\n * @deprecated Used only by Icon's deprecated `productTheme` prop; removed before 11.0.0.\n */\nexport default {\n\t'global-setup': '#2A739E',\n\t'service-cloud': '#7f2443',\n\t'industry-cloud': '#4c2248',\n\t'sales-cloud': '#00857d',\n\t'commerce-cloud': '#41693d',\n\t'community-cloud': '#ffc20e',\n\t'marketing-cloud': '#ea7600',\n\tquip: '#cf451d',\n};\n"],"mappings":";AAKA,IAAA,IAAe;CACd,gBAAgB;CAChB,iBAAiB;CACjB,kBAAkB;CAClB,eAAe;CACf,kBAAkB;CAClB,mBAAmB;CACnB,mBAAmB;CACnB,MAAM;AACP"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import e from "
|
|
1
|
+
import { createWarnedMap as e } from "./warned-registry.js";
|
|
2
|
+
import { REMOVAL_VERSION as t } from "./removal-version.js";
|
|
3
|
+
import n from "warning";
|
|
2
4
|
//#region utilities/warning/children-as-trigger.ts
|
|
3
|
-
var
|
|
5
|
+
var r = function() {};
|
|
4
6
|
if (process.env.NODE_ENV !== "production") {
|
|
5
|
-
let
|
|
6
|
-
|
|
7
|
-
let
|
|
8
|
-
r && !
|
|
7
|
+
let i = e();
|
|
8
|
+
r = function(e, r, a) {
|
|
9
|
+
let o = a ? ` ${a}` : "";
|
|
10
|
+
r && !i[e] && (n(!1, `[Design System React] Passing the trigger of ${e} as \`children\` is deprecated and will be removed in ${t}. Use \`trigger\` instead: an element, whose props ${e} merges with its own, or a function that receives ${e}'s trigger props.${o}`), i[e] = !0);
|
|
9
11
|
};
|
|
10
12
|
}
|
|
11
|
-
var
|
|
13
|
+
var i = r;
|
|
12
14
|
//#endregion
|
|
13
|
-
export {
|
|
15
|
+
export { i as default };
|
|
14
16
|
|
|
15
17
|
//# sourceMappingURL=children-as-trigger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"children-as-trigger.js","names":[],"sources":["../../../../utilities/warning/children-as-trigger.ts"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n/* eslint-disable import/no-mutable-exports */\n\nimport warning from 'warning';\n\n// Warns once per component when its trigger is passed as `children` instead of `trigger`.\nlet childrenAsTrigger: (\n\tcontrol: string,\n\tusesChildrenAsTrigger: boolean,\n\tcomment?: string\n) => void = function childrenAsTriggerFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tconst hasWarned
|
|
1
|
+
{"version":3,"file":"children-as-trigger.js","names":[],"sources":["../../../../utilities/warning/children-as-trigger.ts"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n/* eslint-disable import/no-mutable-exports */\n\nimport warning from 'warning';\nimport { createWarnedMap } from './warned-registry';\nimport { REMOVAL_VERSION } from './removal-version';\n\n// Warns once per component when its trigger is passed as `children` instead of `trigger`.\nlet childrenAsTrigger: (\n\tcontrol: string,\n\tusesChildrenAsTrigger: boolean,\n\tcomment?: string\n) => void = function childrenAsTriggerFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tconst hasWarned = createWarnedMap();\n\n\tchildrenAsTrigger = function childrenAsTriggerFunction(\n\t\tcontrol,\n\t\tusesChildrenAsTrigger,\n\t\tcomment\n\t) {\n\t\tconst additionalComment = comment ? ` ${comment}` : '';\n\t\tif (usesChildrenAsTrigger && !hasWarned[control]) {\n\t\t\t/* eslint-disable max-len */\n\t\t\twarning(\n\t\t\t\tfalse,\n\t\t\t\t`[Design System React] Passing the trigger of ${control} as \\`children\\` is deprecated and will be removed in ${REMOVAL_VERSION}. Use \\`trigger\\` instead: an element, whose props ${control} merges with its own, or a function that receives ${control}'s trigger props.${additionalComment}`\n\t\t\t);\n\t\t\t/* eslint-enable max-len */\n\t\t\thasWarned[control] = true;\n\t\t}\n\t};\n}\n\nexport default childrenAsTrigger;\n"],"mappings":";;;;AAUA,IAAI,IAIQ,WAAqC,CAAC;AAElD,IAAA,QAAA,IAAA,aAA6B,cAAc;CAC1C,IAAM,IAAY,EAAgB;CAElC,IAAoB,SACnB,GACA,GACA,GACC;EACD,IAAM,IAAoB,IAAU,IAAI,MAAY;EACpD,AAAI,KAAyB,CAAC,EAAU,OAEvC,EACC,IACA,gDAAgD,EAAQ,wDAAwD,EAAgB,qDAAqD,EAAQ,oDAAoD,EAAQ,mBAAmB,GAC7Q,GAEA,EAAU,KAAW;CAEvB;AACD;AAEA,IAAA,IAAe"}
|