@salesforce/design-system-react 11.0.0-alpha.5 → 11.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/accordion/panel.cjs +1 -1
- package/dist/cjs/components/accordion/panel.cjs.map +1 -1
- package/dist/cjs/components/avatar/index.cjs +1 -1
- package/dist/cjs/components/avatar/index.cjs.map +1 -1
- package/dist/cjs/components/badge/index.cjs +1 -1
- package/dist/cjs/components/badge/index.cjs.map +1 -1
- package/dist/cjs/components/breadcrumb/index.cjs +1 -1
- package/dist/cjs/components/breadcrumb/index.cjs.map +1 -1
- package/dist/cjs/components/builder-header/check-props.cjs +2 -0
- package/dist/cjs/components/builder-header/check-props.cjs.map +1 -0
- package/dist/cjs/components/builder-header/component.cjs +2 -0
- package/dist/cjs/components/builder-header/component.cjs.map +1 -0
- package/dist/cjs/components/builder-header/toolbar.cjs +1 -1
- package/dist/cjs/components/builder-header/toolbar.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/index.cjs +1 -1
- package/dist/cjs/components/button-stateful/index.cjs.map +1 -1
- package/dist/cjs/components/carousel/check-props.cjs +2 -0
- package/dist/cjs/components/carousel/check-props.cjs.map +1 -0
- package/dist/cjs/components/carousel/component.cjs +2 -0
- package/dist/cjs/components/carousel/component.cjs.map +1 -0
- package/dist/cjs/components/carousel/index.cjs +1 -1
- package/dist/cjs/components/carousel/index.cjs.map +1 -1
- package/dist/cjs/components/carousel/private/carousel-item.cjs +1 -1
- package/dist/cjs/components/carousel/private/carousel-item.cjs.map +1 -1
- package/dist/cjs/components/checkbox/check-props.cjs +2 -0
- package/dist/cjs/components/checkbox/check-props.cjs.map +1 -0
- package/dist/cjs/components/checkbox/component.cjs +2 -0
- package/dist/cjs/components/checkbox/component.cjs.map +1 -0
- package/dist/cjs/components/checkbox/index.cjs +1 -1
- package/dist/cjs/components/checkbox/index.cjs.map +1 -1
- package/dist/cjs/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/cjs/components/combobox/add-subheadings.cjs +1 -1
- package/dist/cjs/components/combobox/add-subheadings.cjs.map +1 -1
- package/dist/cjs/components/combobox/check-props.cjs +1 -1
- package/dist/cjs/components/combobox/check-props.cjs.map +1 -1
- package/dist/cjs/components/combobox/combobox.cjs +1 -1
- package/dist/cjs/components/combobox/combobox.cjs.map +1 -1
- package/dist/cjs/components/combobox/filter.cjs +1 -1
- package/dist/cjs/components/combobox/filter.cjs.map +1 -1
- package/dist/cjs/components/combobox/index.cjs.map +1 -1
- package/dist/cjs/components/combobox/private/menu.cjs +1 -1
- package/dist/cjs/components/combobox/private/menu.cjs.map +1 -1
- package/dist/cjs/components/date-picker/check-props.cjs +1 -1
- package/dist/cjs/components/date-picker/date-picker.cjs +1 -1
- package/dist/cjs/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/cjs/components/date-picker/index.cjs.map +1 -1
- package/dist/cjs/components/dynamic-icon/index.cjs +1 -1
- package/dist/cjs/components/dynamic-icon/index.cjs.map +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/input/check-props.cjs +1 -1
- package/dist/cjs/components/input/check-props.cjs.map +1 -1
- package/dist/cjs/components/input/index.cjs +1 -1
- package/dist/cjs/components/input/index.cjs.map +1 -1
- package/dist/cjs/components/input/search.cjs +1 -1
- package/dist/cjs/components/input/search.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/button-trigger.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/check-props.cjs +1 -1
- package/dist/cjs/components/menu-dropdown/check-props.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/index.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs +1 -1
- package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs.map +1 -1
- package/dist/cjs/components/modal/index.cjs +1 -1
- package/dist/cjs/components/modal/index.cjs.map +1 -1
- package/dist/cjs/components/page-header/check-props.cjs +2 -0
- package/dist/cjs/components/page-header/check-props.cjs.map +1 -0
- package/dist/cjs/components/page-header/component.cjs +2 -0
- package/dist/cjs/components/page-header/component.cjs.map +1 -0
- package/dist/cjs/components/page-header/index.cjs +1 -1
- package/dist/cjs/components/page-header/index.cjs.map +1 -1
- package/dist/cjs/components/page-header/private/base/index.cjs +1 -1
- package/dist/cjs/components/page-header/private/base/index.cjs.map +1 -1
- package/dist/cjs/components/page-header/private/controls.cjs +1 -1
- package/dist/cjs/components/page-header/private/controls.cjs.map +1 -1
- package/dist/cjs/components/page-header/private/object-home/index.cjs +1 -1
- package/dist/cjs/components/page-header/private/object-home/index.cjs.map +1 -1
- package/dist/cjs/components/page-header/private/record-home/index.cjs +1 -1
- package/dist/cjs/components/page-header/private/record-home/index.cjs.map +1 -1
- package/dist/cjs/components/page-header/private/related-list/index.cjs +1 -1
- package/dist/cjs/components/page-header/private/related-list/index.cjs.map +1 -1
- package/dist/cjs/components/pill-container/check-props.cjs +2 -0
- package/dist/cjs/components/pill-container/check-props.cjs.map +1 -0
- package/dist/cjs/components/pill-container/component.cjs +2 -0
- package/dist/cjs/components/pill-container/component.cjs.map +1 -0
- package/dist/cjs/components/pill-container/index.cjs +1 -1
- package/dist/cjs/components/pill-container/index.cjs.map +1 -1
- package/dist/cjs/components/popover/index.cjs.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/check-props.cjs +1 -1
- package/dist/cjs/components/progress-indicator/check-props.cjs.map +1 -1
- package/dist/cjs/components/progress-indicator/component.cjs +2 -0
- package/dist/cjs/components/progress-indicator/component.cjs.map +1 -0
- package/dist/cjs/components/progress-indicator/index.cjs +1 -1
- package/dist/cjs/components/progress-indicator/index.cjs.map +1 -1
- package/dist/cjs/components/progress-indicator/private/step-vertical.cjs +1 -1
- package/dist/cjs/components/progress-indicator/private/step-vertical.cjs.map +1 -1
- package/dist/cjs/components/radio/check-props.cjs +2 -0
- package/dist/cjs/components/radio/check-props.cjs.map +1 -0
- package/dist/cjs/components/radio/component.cjs +2 -0
- package/dist/cjs/components/radio/component.cjs.map +1 -0
- package/dist/cjs/components/radio/index.cjs +1 -1
- package/dist/cjs/components/radio/index.cjs.map +1 -1
- package/dist/cjs/components/setup-assistant/check-props.cjs +1 -1
- package/dist/cjs/components/setup-assistant/check-props.cjs.map +1 -1
- package/dist/cjs/components/setup-assistant/index.cjs.map +1 -1
- package/dist/cjs/components/setup-assistant/step.cjs +1 -1
- package/dist/cjs/components/setup-assistant/step.cjs.map +1 -1
- package/dist/cjs/components/simple-data-table/check-props.cjs +1 -1
- package/dist/cjs/components/simple-data-table/check-props.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/row-actions.cjs +1 -1
- package/dist/cjs/components/simple-data-table/row-actions.cjs.map +1 -1
- package/dist/cjs/components/slider/check-props.cjs +2 -0
- package/dist/cjs/components/slider/check-props.cjs.map +1 -0
- package/dist/cjs/components/slider/component.cjs +2 -0
- package/dist/cjs/components/slider/component.cjs.map +1 -0
- package/dist/cjs/components/slider/index.cjs +1 -1
- package/dist/cjs/components/slider/index.cjs.map +1 -1
- package/dist/cjs/components/spinner/index.cjs +1 -1
- package/dist/cjs/components/spinner/index.cjs.map +1 -1
- package/dist/cjs/components/split-view/check-props.cjs +2 -0
- package/dist/cjs/components/split-view/check-props.cjs.map +1 -0
- package/dist/cjs/components/split-view/component.cjs +2 -0
- package/dist/cjs/components/split-view/component.cjs.map +1 -0
- package/dist/cjs/components/split-view/header.cjs.map +1 -1
- package/dist/cjs/components/split-view/index.cjs +1 -1
- package/dist/cjs/components/split-view/index.cjs.map +1 -1
- package/dist/cjs/components/split-view/listbox-check-props.cjs +2 -0
- package/dist/cjs/components/split-view/listbox-check-props.cjs.map +1 -0
- package/dist/cjs/components/split-view/listbox.cjs +1 -1
- package/dist/cjs/components/split-view/listbox.cjs.map +1 -1
- package/dist/cjs/components/split-view/private/list-item-content.cjs +1 -1
- package/dist/cjs/components/split-view/private/list-item-content.cjs.map +1 -1
- package/dist/cjs/components/split-view/private/list-item-with-content.cjs +1 -1
- package/dist/cjs/components/split-view/private/list-item-with-content.cjs.map +1 -1
- package/dist/cjs/components/split-view/private/toggle-button.cjs +1 -1
- package/dist/cjs/components/split-view/private/toggle-button.cjs.map +1 -1
- package/dist/cjs/components/tabs/index.cjs +1 -1
- package/dist/cjs/components/tabs/index.cjs.map +1 -1
- package/dist/cjs/components/tabs/panel.cjs.map +1 -1
- package/dist/cjs/components/textarea/check-props.cjs +2 -0
- package/dist/cjs/components/textarea/check-props.cjs.map +1 -0
- package/dist/cjs/components/textarea/component.cjs +2 -0
- package/dist/cjs/components/textarea/component.cjs.map +1 -0
- package/dist/cjs/components/textarea/index.cjs +1 -1
- package/dist/cjs/components/textarea/index.cjs.map +1 -1
- package/dist/cjs/components/toast/index.cjs +1 -1
- package/dist/cjs/components/toast/index.cjs.map +1 -1
- package/dist/cjs/components/tooltip/check-props.cjs +1 -1
- package/dist/cjs/components/tooltip/check-props.cjs.map +1 -1
- package/dist/cjs/components/tooltip/index.cjs +2 -2
- package/dist/cjs/components/tooltip/index.cjs.map +1 -1
- package/dist/cjs/components/tree/check-props.cjs +1 -1
- package/dist/cjs/components/tree/check-props.cjs.map +1 -1
- package/dist/cjs/components/tree/component.cjs +2 -0
- package/dist/cjs/components/tree/component.cjs.map +1 -0
- package/dist/cjs/components/tree/private/branch.cjs.map +1 -1
- package/dist/cjs/components/tree/private/item.cjs.map +1 -1
- package/dist/cjs/components/tree/private/render-branch.cjs.map +1 -1
- package/dist/cjs/components/tree/private/render-initial-branch.cjs +1 -1
- package/dist/cjs/components/tree/private/render-initial-branch.cjs.map +1 -1
- package/dist/cjs/components/tree/tree.cjs +1 -1
- package/dist/cjs/components/tree/tree.cjs.map +1 -1
- package/dist/cjs/components/trial-bar/check-props.cjs +2 -0
- package/dist/cjs/components/trial-bar/check-props.cjs.map +1 -0
- package/dist/cjs/components/trial-bar/component.cjs +2 -0
- package/dist/cjs/components/trial-bar/component.cjs.map +1 -0
- package/dist/cjs/components/trial-bar/index.cjs +1 -1
- package/dist/cjs/components/trial-bar/index.cjs.map +1 -1
- package/dist/cjs/components/utilities/menu-list/index.cjs +1 -1
- package/dist/cjs/components/utilities/menu-list/index.cjs.map +1 -1
- package/dist/cjs/components/utilities/menu-list/item.cjs +1 -1
- package/dist/cjs/components/utilities/menu-list/item.cjs.map +1 -1
- package/dist/cjs/components/utilities/utility-icon/index.cjs +1 -1
- package/dist/cjs/components/utilities/utility-icon/index.cjs.map +1 -1
- package/dist/cjs/components/vertical-navigation/index.cjs.map +1 -1
- package/dist/cjs/components/vertical-navigation/private/item.cjs +1 -1
- package/dist/cjs/components/vertical-navigation/private/item.cjs.map +1 -1
- package/dist/cjs/components/welcome-mat/check-props.cjs +2 -0
- package/dist/cjs/components/welcome-mat/check-props.cjs.map +1 -0
- package/dist/cjs/components/welcome-mat/component.cjs +2 -0
- package/dist/cjs/components/welcome-mat/component.cjs.map +1 -0
- package/dist/cjs/components/welcome-mat/index.cjs +1 -1
- package/dist/cjs/components/welcome-mat/index.cjs.map +1 -1
- package/dist/cjs/components/welcome-mat/info-badge.cjs +1 -1
- package/dist/cjs/components/welcome-mat/info-badge.cjs.map +1 -1
- package/dist/cjs/utilities/constants.cjs +1 -1
- package/dist/cjs/utilities/constants.cjs.map +1 -1
- package/dist/es/components/accordion/panel.js +1 -1
- package/dist/es/components/accordion/panel.js.map +1 -1
- package/dist/es/components/avatar/index.js +1 -1
- package/dist/es/components/avatar/index.js.map +1 -1
- package/dist/es/components/badge/index.js +6 -5
- package/dist/es/components/badge/index.js.map +1 -1
- package/dist/es/components/breadcrumb/index.js +1 -1
- package/dist/es/components/breadcrumb/index.js.map +1 -1
- package/dist/es/components/builder-header/check-props.js +13 -0
- package/dist/es/components/builder-header/check-props.js.map +1 -0
- package/dist/es/components/builder-header/component.js +65 -0
- package/dist/es/components/builder-header/component.js.map +1 -0
- package/dist/es/components/builder-header/toolbar.js +18 -13
- package/dist/es/components/builder-header/toolbar.js.map +1 -1
- package/dist/es/components/button/index.js +1 -1
- package/dist/es/components/button/index.js.map +1 -1
- package/dist/es/components/button-stateful/index.js +1 -1
- package/dist/es/components/button-stateful/index.js.map +1 -1
- package/dist/es/components/carousel/check-props.js +13 -0
- package/dist/es/components/carousel/check-props.js.map +1 -0
- package/dist/es/components/carousel/component.js +27 -0
- package/dist/es/components/carousel/component.js.map +1 -0
- package/dist/es/components/carousel/index.js +121 -113
- package/dist/es/components/carousel/index.js.map +1 -1
- package/dist/es/components/carousel/private/carousel-item.js +1 -2
- package/dist/es/components/carousel/private/carousel-item.js.map +1 -1
- package/dist/es/components/checkbox/check-props.js +14 -0
- package/dist/es/components/checkbox/check-props.js.map +1 -0
- package/dist/es/components/checkbox/component.js +35 -0
- package/dist/es/components/checkbox/component.js.map +1 -0
- package/dist/es/components/checkbox/index.js +125 -113
- package/dist/es/components/checkbox/index.js.map +1 -1
- package/dist/es/components/color-picker/color-picker.js.map +1 -1
- package/dist/es/components/combobox/add-subheadings.js +2 -1
- package/dist/es/components/combobox/add-subheadings.js.map +1 -1
- package/dist/es/components/combobox/check-props.js +15 -5
- package/dist/es/components/combobox/check-props.js.map +1 -1
- package/dist/es/components/combobox/combobox.js +292 -277
- package/dist/es/components/combobox/combobox.js.map +1 -1
- package/dist/es/components/combobox/filter.js +1 -1
- package/dist/es/components/combobox/filter.js.map +1 -1
- package/dist/es/components/combobox/index.js.map +1 -1
- package/dist/es/components/combobox/private/menu.js +7 -7
- package/dist/es/components/combobox/private/menu.js.map +1 -1
- package/dist/es/components/date-picker/check-props.js +4 -4
- package/dist/es/components/date-picker/date-picker.js +149 -142
- package/dist/es/components/date-picker/date-picker.js.map +1 -1
- package/dist/es/components/date-picker/index.js.map +1 -1
- package/dist/es/components/dynamic-icon/index.js +1 -1
- package/dist/es/components/dynamic-icon/index.js.map +1 -1
- package/dist/es/components/index.js +41 -43
- package/dist/es/components/input/check-props.js +17 -18
- package/dist/es/components/input/check-props.js.map +1 -1
- package/dist/es/components/input/index.js +138 -136
- package/dist/es/components/input/index.js.map +1 -1
- package/dist/es/components/input/search.js +1 -1
- package/dist/es/components/input/search.js.map +1 -1
- package/dist/es/components/menu-dropdown/button-trigger.js.map +1 -1
- package/dist/es/components/menu-dropdown/check-props.js +6 -6
- package/dist/es/components/menu-dropdown/check-props.js.map +1 -1
- package/dist/es/components/menu-dropdown/index.js.map +1 -1
- package/dist/es/components/menu-dropdown/menu-dropdown.js +236 -232
- package/dist/es/components/menu-dropdown/menu-dropdown.js.map +1 -1
- package/dist/es/components/modal/index.js +104 -132
- package/dist/es/components/modal/index.js.map +1 -1
- package/dist/es/components/page-header/check-props.js +31 -0
- package/dist/es/components/page-header/check-props.js.map +1 -0
- package/dist/es/components/page-header/component.js +35 -0
- package/dist/es/components/page-header/component.js.map +1 -0
- package/dist/es/components/page-header/index.js +56 -38
- package/dist/es/components/page-header/index.js.map +1 -1
- package/dist/es/components/page-header/private/base/index.js +1 -1
- package/dist/es/components/page-header/private/base/index.js.map +1 -1
- package/dist/es/components/page-header/private/controls.js +1 -1
- package/dist/es/components/page-header/private/controls.js.map +1 -1
- package/dist/es/components/page-header/private/object-home/index.js +4 -4
- package/dist/es/components/page-header/private/object-home/index.js.map +1 -1
- package/dist/es/components/page-header/private/record-home/index.js +1 -1
- package/dist/es/components/page-header/private/record-home/index.js.map +1 -1
- package/dist/es/components/page-header/private/related-list/index.js +2 -2
- package/dist/es/components/page-header/private/related-list/index.js.map +1 -1
- package/dist/es/components/pill-container/check-props.js +13 -0
- package/dist/es/components/pill-container/check-props.js.map +1 -0
- package/dist/es/components/pill-container/component.js +31 -0
- package/dist/es/components/pill-container/component.js.map +1 -0
- package/dist/es/components/pill-container/index.js +65 -56
- package/dist/es/components/pill-container/index.js.map +1 -1
- package/dist/es/components/popover/index.js.map +1 -1
- package/dist/es/components/popover/popover.js +147 -146
- package/dist/es/components/popover/popover.js.map +1 -1
- package/dist/es/components/progress-indicator/check-props.js +11 -8
- package/dist/es/components/progress-indicator/check-props.js.map +1 -1
- package/dist/es/components/progress-indicator/component.js +35 -0
- package/dist/es/components/progress-indicator/component.js.map +1 -0
- package/dist/es/components/progress-indicator/index.js +74 -71
- package/dist/es/components/progress-indicator/index.js.map +1 -1
- package/dist/es/components/progress-indicator/private/step-vertical.js +23 -20
- package/dist/es/components/progress-indicator/private/step-vertical.js.map +1 -1
- package/dist/es/components/radio/check-props.js +13 -0
- package/dist/es/components/radio/check-props.js.map +1 -0
- package/dist/es/components/radio/component.js +24 -0
- package/dist/es/components/radio/component.js.map +1 -0
- package/dist/es/components/radio/index.js +94 -80
- package/dist/es/components/radio/index.js.map +1 -1
- package/dist/es/components/setup-assistant/check-props.js +12 -7
- package/dist/es/components/setup-assistant/check-props.js.map +1 -1
- package/dist/es/components/setup-assistant/index.js.map +1 -1
- package/dist/es/components/setup-assistant/step.js +8 -8
- package/dist/es/components/setup-assistant/step.js.map +1 -1
- package/dist/es/components/simple-data-table/check-props.js +4 -4
- package/dist/es/components/simple-data-table/check-props.js.map +1 -1
- package/dist/es/components/simple-data-table/index.js +17 -10
- package/dist/es/components/simple-data-table/index.js.map +1 -1
- package/dist/es/components/simple-data-table/row-actions.js +2 -2
- package/dist/es/components/simple-data-table/row-actions.js.map +1 -1
- package/dist/es/components/slider/check-props.js +17 -0
- package/dist/es/components/slider/check-props.js.map +1 -0
- package/dist/es/components/slider/component.js +35 -0
- package/dist/es/components/slider/component.js.map +1 -0
- package/dist/es/components/slider/index.js +69 -53
- package/dist/es/components/slider/index.js.map +1 -1
- package/dist/es/components/spinner/index.js +1 -1
- package/dist/es/components/spinner/index.js.map +1 -1
- package/dist/es/components/split-view/check-props.js +13 -0
- package/dist/es/components/split-view/check-props.js.map +1 -0
- package/dist/es/components/split-view/component.js +46 -0
- package/dist/es/components/split-view/component.js.map +1 -0
- package/dist/es/components/split-view/header.js.map +1 -1
- package/dist/es/components/split-view/index.js +45 -36
- package/dist/es/components/split-view/index.js.map +1 -1
- package/dist/es/components/split-view/listbox-check-props.js +13 -0
- package/dist/es/components/split-view/listbox-check-props.js.map +1 -0
- package/dist/es/components/split-view/listbox.js +41 -35
- package/dist/es/components/split-view/listbox.js.map +1 -1
- package/dist/es/components/split-view/private/list-item-content.js +1 -1
- package/dist/es/components/split-view/private/list-item-content.js.map +1 -1
- package/dist/es/components/split-view/private/list-item-with-content.js +6 -1
- package/dist/es/components/split-view/private/list-item-with-content.js.map +1 -1
- package/dist/es/components/split-view/private/toggle-button.js +2 -2
- package/dist/es/components/split-view/private/toggle-button.js.map +1 -1
- package/dist/es/components/tabs/index.js +64 -64
- package/dist/es/components/tabs/index.js.map +1 -1
- package/dist/es/components/tabs/panel.js.map +1 -1
- package/dist/es/components/textarea/check-props.js +18 -0
- package/dist/es/components/textarea/check-props.js.map +1 -0
- package/dist/es/components/textarea/component.js +27 -0
- package/dist/es/components/textarea/component.js.map +1 -0
- package/dist/es/components/textarea/index.js +62 -46
- package/dist/es/components/textarea/index.js.map +1 -1
- package/dist/es/components/toast/index.js +18 -12
- package/dist/es/components/toast/index.js.map +1 -1
- package/dist/es/components/tooltip/check-props.js +9 -23
- package/dist/es/components/tooltip/check-props.js.map +1 -1
- package/dist/es/components/tooltip/index.js +70 -70
- package/dist/es/components/tooltip/index.js.map +1 -1
- package/dist/es/components/tree/check-props.js +13 -12
- package/dist/es/components/tree/check-props.js.map +1 -1
- package/dist/es/components/tree/component.js +25 -0
- package/dist/es/components/tree/component.js.map +1 -0
- package/dist/es/components/tree/private/branch.js.map +1 -1
- package/dist/es/components/tree/private/item.js.map +1 -1
- package/dist/es/components/tree/private/render-branch.js.map +1 -1
- package/dist/es/components/tree/private/render-initial-branch.js +5 -2
- package/dist/es/components/tree/private/render-initial-branch.js.map +1 -1
- package/dist/es/components/tree/tree.js +92 -65
- package/dist/es/components/tree/tree.js.map +1 -1
- package/dist/es/components/trial-bar/check-props.js +13 -0
- package/dist/es/components/trial-bar/check-props.js.map +1 -0
- package/dist/es/components/trial-bar/component.js +24 -0
- package/dist/es/components/trial-bar/component.js.map +1 -0
- package/dist/es/components/trial-bar/index.js +27 -21
- package/dist/es/components/trial-bar/index.js.map +1 -1
- package/dist/es/components/utilities/menu-list/index.js +1 -0
- package/dist/es/components/utilities/menu-list/index.js.map +1 -1
- package/dist/es/components/utilities/menu-list/item.js +6 -4
- package/dist/es/components/utilities/menu-list/item.js.map +1 -1
- package/dist/es/components/utilities/utility-icon/index.js +2 -1
- package/dist/es/components/utilities/utility-icon/index.js.map +1 -1
- package/dist/es/components/vertical-navigation/index.js.map +1 -1
- package/dist/es/components/vertical-navigation/private/item.js +1 -1
- package/dist/es/components/vertical-navigation/private/item.js.map +1 -1
- package/dist/es/components/welcome-mat/check-props.js +13 -0
- package/dist/es/components/welcome-mat/check-props.js.map +1 -0
- package/dist/es/components/welcome-mat/component.js +46 -0
- package/dist/es/components/welcome-mat/component.js.map +1 -0
- package/dist/es/components/welcome-mat/index.js +61 -55
- package/dist/es/components/welcome-mat/index.js.map +1 -1
- package/dist/es/components/welcome-mat/info-badge.js +19 -11
- package/dist/es/components/welcome-mat/info-badge.js.map +1 -1
- package/dist/es/utilities/constants.js +2 -2
- package/dist/es/utilities/constants.js.map +1 -1
- package/dist/types/components/accordion/panel.d.ts.map +1 -1
- package/dist/types/components/avatar/index.d.ts +1 -1
- package/dist/types/components/avatar/index.d.ts.map +1 -1
- package/dist/types/components/badge/index.d.ts +4 -2
- package/dist/types/components/badge/index.d.ts.map +1 -1
- package/dist/types/components/breadcrumb/index.d.ts +1 -1
- package/dist/types/components/breadcrumb/index.d.ts.map +1 -1
- package/dist/types/components/builder-header/check-props.d.ts.map +1 -0
- package/dist/types/components/builder-header/toolbar.d.ts +6 -4
- package/dist/types/components/builder-header/toolbar.d.ts.map +1 -1
- package/dist/types/components/button/check-props.d.ts.map +1 -1
- package/dist/types/components/button/index.d.ts +1 -1
- package/dist/types/components/button/index.d.ts.map +1 -1
- package/dist/types/components/button-stateful/index.d.ts +1 -1
- package/dist/types/components/button-stateful/index.d.ts.map +1 -1
- package/dist/types/components/carousel/check-props.d.ts.map +1 -0
- package/dist/types/components/carousel/index.d.ts +38 -9
- package/dist/types/components/carousel/index.d.ts.map +1 -1
- package/dist/types/components/carousel/private/carousel-item.d.ts +5 -5
- package/dist/types/components/carousel/private/carousel-item.d.ts.map +1 -1
- package/dist/types/components/checkbox/check-props.d.ts +1 -0
- package/dist/types/components/checkbox/check-props.d.ts.map +1 -1
- package/dist/types/components/checkbox/index.d.ts +10 -9
- package/dist/types/components/checkbox/index.d.ts.map +1 -1
- package/dist/types/components/color-picker/color-picker.d.ts +25 -7
- package/dist/types/components/color-picker/color-picker.d.ts.map +1 -1
- package/dist/types/components/color-picker/index.d.ts +1 -1
- package/dist/types/components/color-picker/index.d.ts.map +1 -1
- package/dist/types/components/combobox/add-subheadings.d.ts +1 -1
- package/dist/types/components/combobox/add-subheadings.d.ts.map +1 -1
- package/dist/types/components/combobox/check-props.d.ts.map +1 -1
- package/dist/types/components/combobox/combobox.d.ts +80 -33
- package/dist/types/components/combobox/combobox.d.ts.map +1 -1
- package/dist/types/components/combobox/filter.d.ts.map +1 -1
- package/dist/types/components/combobox/index.d.ts +2 -2
- package/dist/types/components/combobox/index.d.ts.map +1 -1
- package/dist/types/components/combobox/private/menu.d.ts +75 -9
- package/dist/types/components/combobox/private/menu.d.ts.map +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts +52 -6
- package/dist/types/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/types/components/date-picker/index.d.ts +1 -1
- package/dist/types/components/date-picker/index.d.ts.map +1 -1
- package/dist/types/components/dynamic-icon/index.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +0 -4
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/components/input/check-props.d.ts.map +1 -1
- package/dist/types/components/input/index.d.ts.map +1 -1
- package/dist/types/components/input/search.d.ts +1 -1
- package/dist/types/components/input/search.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/button-trigger.d.ts +1 -1
- package/dist/types/components/menu-dropdown/button-trigger.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/check-props.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/index.d.ts +2 -2
- package/dist/types/components/menu-dropdown/index.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/menu-dropdown.d.ts +117 -27
- package/dist/types/components/menu-dropdown/menu-dropdown.d.ts.map +1 -1
- package/dist/types/components/modal/index.d.ts +26 -3
- package/dist/types/components/modal/index.d.ts.map +1 -1
- package/dist/types/components/page-header/check-props.d.ts.map +1 -1
- package/dist/types/components/page-header/index.d.ts +15 -4
- package/dist/types/components/page-header/index.d.ts.map +1 -1
- package/dist/types/components/page-header/private/base/index.d.ts.map +1 -1
- package/dist/types/components/page-header/private/controls.d.ts +4 -4
- package/dist/types/components/page-header/private/controls.d.ts.map +1 -1
- package/dist/types/components/page-header/private/object-home/index.d.ts.map +1 -1
- package/dist/types/components/page-header/private/record-home/index.d.ts.map +1 -1
- package/dist/types/components/page-header/private/types.d.ts +6 -6
- package/dist/types/components/page-header/private/types.d.ts.map +1 -1
- package/dist/types/components/pill-container/check-props.d.ts.map +1 -0
- package/dist/types/components/pill-container/index.d.ts +24 -3
- package/dist/types/components/pill-container/index.d.ts.map +1 -1
- package/dist/types/components/popover/index.d.ts +1 -1
- package/dist/types/components/popover/index.d.ts.map +1 -1
- package/dist/types/components/popover/popover.d.ts +41 -12
- package/dist/types/components/popover/popover.d.ts.map +1 -1
- package/dist/types/components/progress-indicator/check-props.d.ts.map +1 -1
- package/dist/types/components/progress-indicator/index.d.ts +7 -1
- package/dist/types/components/progress-indicator/index.d.ts.map +1 -1
- package/dist/types/components/progress-indicator/private/step-vertical.d.ts +4 -7
- package/dist/types/components/progress-indicator/private/step-vertical.d.ts.map +1 -1
- package/dist/types/components/radio/check-props.d.ts +1 -0
- package/dist/types/components/radio/check-props.d.ts.map +1 -1
- package/dist/types/components/radio/index.d.ts +10 -4
- package/dist/types/components/radio/index.d.ts.map +1 -1
- package/dist/types/components/setup-assistant/check-props.d.ts.map +1 -1
- package/dist/types/components/setup-assistant/index.d.ts +7 -3
- package/dist/types/components/setup-assistant/index.d.ts.map +1 -1
- package/dist/types/components/setup-assistant/step.d.ts +19 -7
- package/dist/types/components/setup-assistant/step.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/check-props.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/index.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/row-actions.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/types.d.ts +21 -8
- package/dist/types/components/simple-data-table/types.d.ts.map +1 -1
- package/dist/types/components/slider/check-props.d.ts.map +1 -0
- package/dist/types/components/slider/index.d.ts +26 -5
- package/dist/types/components/slider/index.d.ts.map +1 -1
- package/dist/types/components/spinner/index.d.ts +1 -1
- package/dist/types/components/spinner/index.d.ts.map +1 -1
- package/dist/types/components/split-view/check-props.d.ts.map +1 -0
- package/dist/types/components/split-view/header.d.ts +3 -3
- package/dist/types/components/split-view/header.d.ts.map +1 -1
- package/dist/types/components/split-view/index.d.ts +34 -8
- package/dist/types/components/split-view/index.d.ts.map +1 -1
- package/dist/types/components/{forms/input/inline-check-props.d.ts → split-view/listbox-check-props.d.ts} +1 -1
- package/dist/types/components/split-view/listbox-check-props.d.ts.map +1 -0
- package/dist/types/components/split-view/listbox.d.ts +45 -26
- 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 +10 -1
- package/dist/types/components/split-view/private/list-item-with-content.d.ts.map +1 -1
- package/dist/types/components/split-view/private/toggle-button.d.ts +3 -3
- package/dist/types/components/split-view/private/toggle-button.d.ts.map +1 -1
- package/dist/types/components/tabs/index.d.ts +16 -3
- package/dist/types/components/tabs/index.d.ts.map +1 -1
- package/dist/types/components/tabs/panel.d.ts +5 -1
- package/dist/types/components/tabs/panel.d.ts.map +1 -1
- package/dist/types/components/textarea/check-props.d.ts.map +1 -1
- package/dist/types/components/textarea/index.d.ts +25 -5
- package/dist/types/components/textarea/index.d.ts.map +1 -1
- package/dist/types/components/toast/index.d.ts +17 -2
- package/dist/types/components/toast/index.d.ts.map +1 -1
- package/dist/types/components/tooltip/check-props.d.ts.map +1 -1
- package/dist/types/components/tooltip/index.d.ts +1 -5
- package/dist/types/components/tooltip/index.d.ts.map +1 -1
- package/dist/types/components/tree/check-props.d.ts.map +1 -1
- package/dist/types/components/tree/index.d.ts +1 -1
- package/dist/types/components/tree/index.d.ts.map +1 -1
- package/dist/types/components/tree/private/branch.d.ts +2 -4
- package/dist/types/components/tree/private/branch.d.ts.map +1 -1
- package/dist/types/components/tree/private/item.d.ts.map +1 -1
- package/dist/types/components/tree/private/render-branch.d.ts.map +1 -1
- package/dist/types/components/tree/private/render-initial-branch.d.ts +2 -3
- package/dist/types/components/tree/private/render-initial-branch.d.ts.map +1 -1
- package/dist/types/components/tree/tree.d.ts +38 -9
- package/dist/types/components/tree/tree.d.ts.map +1 -1
- package/dist/types/components/tree/types.d.ts +62 -9
- package/dist/types/components/tree/types.d.ts.map +1 -1
- package/dist/types/components/trial-bar/check-props.d.ts +3 -0
- package/dist/types/components/trial-bar/check-props.d.ts.map +1 -0
- package/dist/types/components/trial-bar/index.d.ts +15 -7
- package/dist/types/components/trial-bar/index.d.ts.map +1 -1
- package/dist/types/components/utilities/menu-list/index.d.ts +6 -2
- package/dist/types/components/utilities/menu-list/index.d.ts.map +1 -1
- package/dist/types/components/utilities/menu-list/item.d.ts +4 -2
- package/dist/types/components/utilities/menu-list/item.d.ts.map +1 -1
- package/dist/types/components/utilities/utility-icon/index.d.ts.map +1 -1
- package/dist/types/components/vertical-navigation/index.d.ts +7 -3
- package/dist/types/components/vertical-navigation/index.d.ts.map +1 -1
- package/dist/types/components/vertical-navigation/private/item.d.ts +1 -1
- package/dist/types/components/vertical-navigation/private/item.d.ts.map +1 -1
- package/dist/types/components/welcome-mat/check-props.d.ts +3 -0
- package/dist/types/components/welcome-mat/check-props.d.ts.map +1 -0
- package/dist/types/components/welcome-mat/index.d.ts +70 -15
- package/dist/types/components/welcome-mat/index.d.ts.map +1 -1
- package/dist/types/components/welcome-mat/info-badge.d.ts +7 -3
- package/dist/types/components/welcome-mat/info-badge.d.ts.map +1 -1
- package/dist/types/utilities/constants.d.ts +0 -1
- package/dist/types/utilities/constants.d.ts.map +1 -1
- package/package.json +5 -3
- package/dist/cjs/components/forms/input/inline-check-props.cjs +0 -2
- package/dist/cjs/components/forms/input/inline-check-props.cjs.map +0 -1
- package/dist/cjs/components/forms/input/inline.cjs +0 -2
- package/dist/cjs/components/forms/input/inline.cjs.map +0 -1
- package/dist/cjs/components/modal/check-props.cjs +0 -2
- package/dist/cjs/components/modal/check-props.cjs.map +0 -1
- package/dist/cjs/components/modal/component.cjs +0 -2
- package/dist/cjs/components/modal/component.cjs.map +0 -1
- package/dist/cjs/components/modal/trigger.cjs +0 -2
- package/dist/cjs/components/modal/trigger.cjs.map +0 -1
- package/dist/es/components/forms/input/inline-check-props.js +0 -11
- package/dist/es/components/forms/input/inline-check-props.js.map +0 -1
- package/dist/es/components/forms/input/inline.js +0 -95
- package/dist/es/components/forms/input/inline.js.map +0 -1
- package/dist/es/components/modal/check-props.js +0 -13
- package/dist/es/components/modal/check-props.js.map +0 -1
- package/dist/es/components/modal/component.js +0 -35
- package/dist/es/components/modal/component.js.map +0 -1
- package/dist/es/components/modal/trigger.js +0 -22
- package/dist/es/components/modal/trigger.js.map +0 -1
- package/dist/types/components/avatar/check-props.d.ts.map +0 -1
- package/dist/types/components/breadcrumb/check-props.d.ts.map +0 -1
- package/dist/types/components/button-stateful/check-props.d.ts.map +0 -1
- package/dist/types/components/forms/checkbox/index.d.ts +0 -4
- package/dist/types/components/forms/checkbox/index.d.ts.map +0 -1
- package/dist/types/components/forms/checkbox.d.ts +0 -2
- package/dist/types/components/forms/input/inline-check-props.d.ts.map +0 -1
- package/dist/types/components/forms/input/inline.d.ts +0 -88
- package/dist/types/components/forms/input/inline.d.ts.map +0 -1
- package/dist/types/components/modal/check-props.d.ts.map +0 -1
- package/dist/types/components/modal/trigger.d.ts +0 -14
- package/dist/types/components/modal/trigger.d.ts.map +0 -1
- package/dist/types/components/spinner/check-props.d.ts.map +0 -1
- package/dist/types/components/tabs/pane.d.ts +0 -3
- package/dist/types/components/tabs/pane.d.ts.map +0 -1
- package/dist/types/utilities/warning/deprecated-event-parameter.d.ts +0 -3
- package/dist/types/utilities/warning/deprecated-event-parameter.d.ts.map +0 -1
- /package/dist/types/components/{avatar → builder-header}/check-props.d.ts +0 -0
- /package/dist/types/components/{breadcrumb → carousel}/check-props.d.ts +0 -0
- /package/dist/types/components/{button-stateful → pill-container}/check-props.d.ts +0 -0
- /package/dist/types/components/{modal → slider}/check-props.d.ts +0 -0
- /package/dist/types/components/{spinner → split-view}/check-props.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/tooltip/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// # Tooltip\n\nimport React, {\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseCallback,\n\tuseContext,\n\ttype ReactNode,\n\ttype CSSProperties,\n\ttype KeyboardEvent,\n\ttype FocusEvent,\n\ttype MouseEvent,\n} from 'react';\nimport classNames from 'classnames';\n\nimport EventUtil from '../../utilities/event';\nimport { POPOVER_TOOLTIP } from '../../utilities/constants';\nimport generateId from '../../utilities/generate-id';\n\nimport Dialog from '../utilities/dialog';\nimport Icon from '../icon';\n// eslint-disable-next-line import/no-cycle\nimport Button from '../button';\n\n// This component's `checkProps` which issues warnings to developers about properties when in development mode\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\nimport { IconSettingsContext } from '../icon-settings';\n\n// ### Types\n\nexport type TooltipAlign =\n\t| 'top'\n\t| 'top left'\n\t| 'top right'\n\t| 'right'\n\t| 'right top'\n\t| 'right bottom'\n\t| 'bottom'\n\t| 'bottom left'\n\t| 'bottom right'\n\t| 'left'\n\t| 'left top'\n\t| 'left bottom';\n\nexport type TooltipPosition =\n\t'absolute' | 'overflowBoundaryElement' | 'relative';\n\nexport type TooltipTheme = 'info' | 'error';\n\nexport type TooltipIconVariant = 'bare' | 'error' | 'inverse' | 'warning';\n\nexport type TooltipVariant = 'base' | 'learnMore' | 'list-item';\n\nexport interface TooltipAssistiveText {\n\t/** This text is inside the info icon within the tooltip content and exists to \"complete the sentence\" for assistive tech users. */\n\ttooltipTipLearnMoreIcon?: string;\n\t/** This text is inside the info icon that triggers the tooltip in order to have text within the link. */\n\ttriggerLearnMoreIcon?: string;\n}\n\nexport interface TooltipLabels {\n\t/** This label appears in the tooltip after the info icon. */\n\tlearnMoreAfter?: string;\n\t/** This label appears in the tooltip before the info icon. */\n\tlearnMoreBefore?: string;\n}\n\nexport interface TooltipProps {\n\t/**\n\t * Alignment of the Tooltip relative to the element that triggers it.\n\t */\n\talign?: TooltipAlign;\n\t/**\n\t * **Assistive text for accessibility**\n\t * This object is merged with the default props object on every render.\n\t */\n\tassistiveText?: TooltipAssistiveText;\n\t/**\n\t * Pass the one element that triggers the Tooltip as a child. It must be an element with `tabIndex` or an element that already has a `tabIndex` set such as an anchor or a button.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * Content inside Tooltip.\n\t */\n\tcontent?: ReactNode;\n\t/**\n\t * CSS classes to be added to the popover dialog. That is the element with `.slds-popover` on it.\n\t */\n\tdialogClassName?: string | string[] | Record<string, boolean>;\n\t/**\n\t * Enabling this hides the default nubbin, replacing it with one attached directly to the tooltip trigger.\n\t */\n\thasAnchoredNubbin?: boolean;\n\t/**\n\t * By default, dialogs will flip their alignment if they extend beyond a boundary element.\n\t * `hasStaticAlignment` disables this behavior.\n\t */\n\thasStaticAlignment?: boolean;\n\t/**\n\t * Styles the default info icon trigger that renders when no children are passed. Matches `icon-variant` on `lightning-helptext`.\n\t * * `bare` - (default) Default icon color.\n\t * * `error` - Red icon, to call out an error.\n\t * * `inverse` - White icon, for dark backgrounds.\n\t * * `warning` - Yellow icon, to advise caution.\n\t */\n\ticonVariant?: TooltipIconVariant;\n\t/**\n\t * Delay on Tooltip closing in milliseconds. Defaults to 50\n\t */\n\thoverCloseDelay?: number;\n\t/**\n\t * Delay on Tooltip opening in milliseconds. Defaults to 0\n\t */\n\thoverOpenDelay?: number;\n\t/**\n\t * A unique ID is needed in order to support keyboard navigation, ARIA support, and connect the popover to the triggering element.\n\t */\n\tid?: string;\n\t/**\n\t * **Text labels for internationalization**\n\t */\n\tlabels?: TooltipLabels;\n\t/**\n\t * Forces tooltip to be open. A value of `false` will disable any interaction with the tooltip.\n\t */\n\tisOpen?: boolean;\n\t/**\n\t * Callback that returns an element or React `ref` to align the Tooltip with.\n\t */\n\tonRequestTargetElement?: () => HTMLElement | null;\n\t/**\n\t * Callback when the info icon in learn more variant is clicked\n\t */\n\tonClickTrigger?: (event: MouseEvent<HTMLAnchorElement>) => void;\n\t/**\n\t * CSS classes to be added to tag with `slds-tooltip-trigger`.\n\t */\n\ttriggerClassName?: string | string[] | Record<string, boolean>;\n\t/**\n\t * Please select one of the following:\n\t * * `absolute` - (default) The dialog will use `position: absolute` and style attributes to position itself.\n\t * * `overflowBoundaryElement` - The dialog will overflow scrolling parents.\n\t * * `relative` - No styling or portals will be used.\n\t */\n\tposition?: TooltipPosition;\n\t/**\n\t * Custom styles to be added to wrapping triggering `div`.\n\t */\n\ttriggerStyle?: CSSProperties;\n\t/**\n\t * Determines the theme of tooltip: for informative purpose (blue background) or warning purpose (red background).\n\t */\n\ttheme?: TooltipTheme;\n\t/**\n\t * @deprecated Use onRequestTargetElement instead\n\t */\n\ttarget?: HTMLElement | null;\n\t/**\n\t * Determines the type of the tooltip.\n\t */\n\tvariant?: TooltipVariant;\n}\n\nconst defaultAssistiveText: TooltipAssistiveText = {\n\ttooltipTipLearnMoreIcon: 'this link',\n\ttriggerLearnMoreIcon: 'Help',\n};\n\nconst defaultLabels: TooltipLabels = {\n\tlearnMoreAfter: 'to learn more.',\n\tlearnMoreBefore: 'Click',\n};\n\n/**\n * The PopoverTooltip component is variant of the Lightning Design System Popover component.\n * This component wraps an element that triggers it to open. It must be a focusable child element\n * (either a button or an anchor), so that keyboard users can navigate to it.\n */\nconst Tooltip = ({\n\talign = 'top',\n\tassistiveText: assistiveTextProp,\n\tchildren,\n\tcontent = <span>Tooltip</span>,\n\tdialogClassName,\n\thasAnchoredNubbin = false,\n\thasStaticAlignment = false,\n\thoverCloseDelay = 50,\n\thoverOpenDelay = 0,\n\ticonVariant = 'bare',\n\tid: idProp,\n\tlabels: labelsProp,\n\tisOpen: isOpenProp,\n\tonRequestTargetElement,\n\tonClickTrigger,\n\ttriggerClassName,\n\tposition = 'absolute',\n\ttriggerStyle,\n\ttheme = 'info',\n\ttarget: deprecatedTarget,\n\tvariant = 'base',\n}: TooltipProps): React.ReactElement => {\n\t// Merge assistive text and labels with defaults\n\tconst assistiveText = { ...defaultAssistiveText, ...assistiveTextProp };\n\tconst labels = { ...defaultLabels, ...labelsProp };\n\n\t// Context\n\tconst iconSettings = useContext(IconSettingsContext);\n\n\t// State\n\tconst [isOpenState, setIsOpenState] = useState(false);\n\tconst [triggerRendered, setTriggerRendered] = useState(false);\n\n\t// Refs\n\tconst triggerRef = useRef<HTMLDivElement>(null);\n\tconst tooltipTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\tconst generatedIdRef = useRef(generateId());\n\tconst isUnmountingRef = useRef(false);\n\n\t// Check props in development\n\tuseEffect(() => {\n\t\tcheckProps(\n\t\t\tPOPOVER_TOOLTIP,\n\t\t\t{\n\t\t\t\talign,\n\t\t\t\tassistiveText,\n\t\t\t\tchildren,\n\t\t\t\tcontent,\n\t\t\t\tdialogClassName,\n\t\t\t\thasAnchoredNubbin,\n\t\t\t\thasStaticAlignment,\n\t\t\t\thoverCloseDelay,\n\t\t\t\thoverOpenDelay,\n\t\t\t\ticonVariant,\n\t\t\t\tid: idProp,\n\t\t\t\tlabels,\n\t\t\t\tisOpen: isOpenProp,\n\t\t\t\tonRequestTargetElement,\n\t\t\t\tonClickTrigger,\n\t\t\t\ttriggerClassName,\n\t\t\t\tposition,\n\t\t\t\ttriggerStyle,\n\t\t\t\ttheme,\n\t\t\t\tvariant,\n\t\t\t},\n\t\t\tcomponentDoc\n\t\t);\n\t}, []);\n\n\t// Cleanup on unmount\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tisUnmountingRef.current = true;\n\t\t\tif (tooltipTimeoutRef.current) {\n\t\t\t\tclearTimeout(tooltipTimeoutRef.current);\n\t\t\t}\n\t\t};\n\t}, []);\n\n\t// Get computed values\n\tconst getId = useCallback(() => {\n\t\treturn idProp || generatedIdRef.current;\n\t}, [idProp]);\n\n\tconst getIsOpen = useCallback(() => {\n\t\treturn isOpenProp === undefined ? isOpenState : isOpenProp;\n\t}, [isOpenProp, isOpenState]);\n\n\tconst getTooltipTarget = useCallback(() => {\n\t\tif (onRequestTargetElement) {\n\t\t\treturn onRequestTargetElement();\n\t\t}\n\n\t\t// for backwards compatibility\n\t\tif (deprecatedTarget) {\n\t\t\treturn deprecatedTarget;\n\t\t}\n\n\t\treturn triggerRef.current;\n\t}, [onRequestTargetElement, deprecatedTarget]);\n\n\t// Event handlers\n\tconst handleCancel = useCallback(() => {\n\t\tif (tooltipTimeoutRef.current) {\n\t\t\tclearTimeout(tooltipTimeoutRef.current);\n\t\t}\n\n\t\tsetIsOpenState(false);\n\t}, []);\n\n\tconst handleMouseEnter = useCallback(() => {\n\t\tif (tooltipTimeoutRef.current) {\n\t\t\tclearTimeout(tooltipTimeoutRef.current);\n\t\t}\n\n\t\ttooltipTimeoutRef.current = setTimeout(() => {\n\t\t\tif (!isUnmountingRef.current) {\n\t\t\t\tsetIsOpenState(true);\n\t\t\t}\n\t\t}, hoverOpenDelay);\n\t}, [hoverOpenDelay]);\n\n\tconst handleMouseLeave = useCallback(\n\t\t(e: MouseEvent<HTMLElement> | FocusEvent<HTMLElement>) => {\n\t\t\te.stopPropagation();\n\t\t\tif (tooltipTimeoutRef.current) {\n\t\t\t\tclearTimeout(tooltipTimeoutRef.current);\n\t\t\t}\n\n\t\t\ttooltipTimeoutRef.current = setTimeout(() => {\n\t\t\t\tconst relatedTarget = (e as MouseEvent<HTMLElement>)\n\t\t\t\t\t.relatedTarget as HTMLElement | null;\n\t\t\t\tconst isHoveringTooltip =\n\t\t\t\t\trelatedTarget?.classList?.contains('slds-popover_tooltip') ||\n\t\t\t\t\trelatedTarget?.classList?.contains('slds-popover__body');\n\n\t\t\t\tif (!isUnmountingRef.current && !isHoveringTooltip) {\n\t\t\t\t\tsetIsOpenState(false);\n\t\t\t\t}\n\t\t\t}, hoverCloseDelay);\n\t\t},\n\t\t[hoverCloseDelay]\n\t);\n\n\tconst handleKeyDown = useCallback(\n\t\t(e: KeyboardEvent<HTMLElement>) => {\n\t\t\te.stopPropagation();\n\n\t\t\ttooltipTimeoutRef.current = setTimeout(() => {\n\t\t\t\tif (!isUnmountingRef.current && e.key === 'Escape') {\n\t\t\t\t\tsetIsOpenState(false);\n\t\t\t\t}\n\t\t\t}, hoverCloseDelay);\n\t\t},\n\t\t[hoverCloseDelay]\n\t);\n\n\t// Save trigger ref and trigger re-render once mounted\n\tconst saveTriggerRef = useCallback(\n\t\t(component: HTMLDivElement | null) => {\n\t\t\tif (component && triggerRef.current !== component) {\n\t\t\t\t(triggerRef as React.MutableRefObject<HTMLDivElement | null>).current =\n\t\t\t\t\tcomponent;\n\t\t\t\t// Dialog/Popper.js cannot place the popover until\n\t\t\t\t// the trigger/target DOM node is mounted.\n\t\t\t\tif (!triggerRendered) {\n\t\t\t\t\tsetTriggerRendered(true);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[triggerRendered]\n\t);\n\n\t// Render helpers\n\tconst getAnchoredNubbinStyles = () => {\n\t\tif (!hasAnchoredNubbin) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst alignment = align.split(' ')[0] as\n\t\t\t'top' | 'bottom' | 'left' | 'right';\n\t\tconst nubbinContainerStyles: CSSProperties = {\n\t\t\theight: '0',\n\t\t\tposition: 'relative',\n\t\t\twidth: '0',\n\t\t};\n\t\tconst nubbinStyles: CSSProperties = {\n\t\t\tbackgroundColor: '#16325c',\n\t\t\tcontent: '\"\"',\n\t\t\theight: '1rem',\n\t\t\tposition: 'absolute',\n\t\t\ttransform: 'rotate(45deg)',\n\t\t\twidth: '1rem',\n\t\t};\n\t\tconst triggerDimensions = {\n\t\t\theight: triggerRef.current\n\t\t\t\t? triggerRef.current.getBoundingClientRect().height\n\t\t\t\t: 0,\n\t\t\twidth: triggerRef.current\n\t\t\t\t? triggerRef.current.getBoundingClientRect().width\n\t\t\t\t: 0,\n\t\t};\n\n\t\tswitch (alignment) {\n\t\t\tcase 'bottom': {\n\t\t\t\tnubbinContainerStyles.left = `${triggerDimensions.width / 2}px`;\n\t\t\t\tnubbinContainerStyles.top = `${triggerDimensions.height}px`;\n\t\t\t\tnubbinStyles.left = '-8px';\n\t\t\t\tnubbinStyles.top = '3px';\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'left': {\n\t\t\t\tnubbinContainerStyles.left = '0';\n\t\t\t\tnubbinContainerStyles.top = `${triggerDimensions.height / 2}px`;\n\t\t\t\tnubbinStyles.left = '-19px';\n\t\t\t\tnubbinStyles.top = '-9px';\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'right': {\n\t\t\t\tnubbinContainerStyles.left = `${triggerDimensions.width}px`;\n\t\t\t\tnubbinContainerStyles.top = `${triggerDimensions.height / 2}px`;\n\t\t\t\tnubbinStyles.left = '3px';\n\t\t\t\tnubbinStyles.top = '-9px';\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\t// top\n\t\t\t\tnubbinContainerStyles.left = `${triggerDimensions.width / 2}px`;\n\t\t\t\tnubbinContainerStyles.top = '0';\n\t\t\t\tnubbinStyles.left = '-8px';\n\t\t\t\tnubbinStyles.top = '-19px';\n\t\t\t}\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<style>{`#${getId()}:after, #${getId()}:before {\n\tdisplay: none;\n}`}</style>\n\t\t\t\t{getIsOpen() ? (\n\t\t\t\t\t<div style={nubbinContainerStyles}>\n\t\t\t\t\t\t<div style={nubbinStyles} />\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t</>\n\t\t);\n\t};\n\n\tconst getContent = () => {\n\t\tlet childrenToRender: ReactNode;\n\t\tconst noChildrenProvided = React.Children.count(children) === 0;\n\t\tconst isInverseIcon = iconVariant === 'inverse';\n\t\tconst iconColorVariant =\n\t\t\ticonVariant === 'error' || iconVariant === 'warning'\n\t\t\t\t? iconVariant\n\t\t\t\t: undefined;\n\n\t\tif (noChildrenProvided && onClickTrigger) {\n\t\t\tchildrenToRender = (\n\t\t\t\t<a\n\t\t\t\t\thref=\"#\"\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tEventUtil.trappedHandler(\n\t\t\t\t\t\t\tonClickTrigger\n\t\t\t\t\t\t) as React.MouseEventHandler<HTMLAnchorElement>\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\tcolorVariant={iconColorVariant}\n\t\t\t\t\t\tinverse={isInverseIcon}\n\t\t\t\t\t\tname=\"info\"\n\t\t\t\t\t\tassistiveText={{\n\t\t\t\t\t\t\tlabel: assistiveText.triggerLearnMoreIcon,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t/>\n\t\t\t\t</a>\n\t\t\t);\n\t\t} else if (noChildrenProvided) {\n\t\t\tchildrenToRender = (\n\t\t\t\t<Button\n\t\t\t\t\taria-disabled\n\t\t\t\t\tassistiveText={{\n\t\t\t\t\t\ticon: assistiveText.triggerLearnMoreIcon,\n\t\t\t\t\t}}\n\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\ticonClassName={\n\t\t\t\t\t\ticonColorVariant && `slds-icon-text-${iconColorVariant}`\n\t\t\t\t\t}\n\t\t\t\t\ticonName=\"info\"\n\t\t\t\t\t// `bare` keeps `slds-button_icon`, which Button drops for `inverse` alone\n\t\t\t\t\ticonVariant={isInverseIcon ? 'bare' : undefined}\n\t\t\t\t\tinverse={isInverseIcon}\n\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t/>\n\t\t\t);\n\t\t} else {\n\t\t\tchildrenToRender = children;\n\t\t}\n\n\t\treturn React.Children.map(childrenToRender, (child, i) => {\n\t\t\tif (!React.isValidElement(child)) {\n\t\t\t\treturn child;\n\t\t\t}\n\n\t\t\treturn React.cloneElement(\n\t\t\t\tchild as React.ReactElement<{\n\t\t\t\t\tkey?: React.Key;\n\t\t\t\t\t'aria-describedby'?: string;\n\t\t\t\t\tonBlur?: (e: FocusEvent<HTMLElement>) => void;\n\t\t\t\t\tonFocus?: () => void;\n\t\t\t\t\tonMouseEnter?: () => void;\n\t\t\t\t\tonMouseLeave?: (e: MouseEvent<HTMLElement>) => void;\n\t\t\t\t\tonKeyDown?: (e: KeyboardEvent<HTMLElement>) => void;\n\t\t\t\t}>,\n\t\t\t\t{\n\t\t\t\t\tkey: i,\n\t\t\t\t\t'aria-describedby': getIsOpen() ? getId() : undefined,\n\t\t\t\t\tonBlur: handleMouseLeave,\n\t\t\t\t\tonFocus: handleMouseEnter,\n\t\t\t\t\tonMouseEnter: handleMouseEnter,\n\t\t\t\t\tonMouseLeave: handleMouseLeave,\n\t\t\t\t\tonKeyDown: handleKeyDown,\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\t};\n\n\tconst getTooltipContent = () => {\n\t\t// REMOVE AT NEXT BREAKING CHANGE (v1.0 or v0.9)\n\t\t// Support deprecated 'error' variant value (now use theme='error')\n\t\tconst isErrorTheme = theme === 'error' || (variant as string) === 'error';\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames('slds-popover__body', {\n\t\t\t\t\t// Ensure text contrast on error theme (red background needs white text)\n\t\t\t\t\t'slds-text-color_inverse': isErrorTheme,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t{content}\n\t\t\t\t{variant === 'learnMore' && onClickTrigger ? (\n\t\t\t\t\t<div className=\"slds-m-top_x-small\" aria-hidden=\"true\">\n\t\t\t\t\t\t{labels.learnMoreBefore}{' '}\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tassistiveText={{\n\t\t\t\t\t\t\t\tlabel: assistiveText.tooltipTipLearnMoreIcon,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\tinverse\n\t\t\t\t\t\t\tname=\"info\"\n\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t/>{' '}\n\t\t\t\t\t\t{labels.learnMoreAfter}{' '}\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t);\n\t};\n\n\tconst getTooltip = () => {\n\t\tconst isOpen = getIsOpen();\n\n\t\t// REMOVE AT NEXT BREAKING CHANGE (v1.0 or v0.9)\n\t\t// Support deprecated 'error' variant value (now use theme='error')\n\t\tconst deprecatedWay = (variant as string) === 'error';\n\n\t\treturn isOpen ? (\n\t\t\t<Dialog\n\t\t\t\tcloseOnTabKey\n\t\t\t\thasNubbin\n\t\t\t\tcontentsClassName={classNames(\n\t\t\t\t\t'slds-popover',\n\t\t\t\t\t'slds-popover_tooltip',\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-theme_error': theme === 'error' || deprecatedWay,\n\t\t\t\t\t},\n\t\t\t\t\tdialogClassName\n\t\t\t\t)}\n\t\t\t\talign={align}\n\t\t\t\tcontext={iconSettings}\n\t\t\t\thasStaticAlignment={hasStaticAlignment}\n\t\t\t\tonClose={handleCancel}\n\t\t\t\tonRequestTargetElement={getTooltipTarget}\n\t\t\t\tonMouseLeave={handleCancel}\n\t\t\t\tposition={position}\n\t\t\t\tvariant=\"tooltip\"\n\t\t\t\tcontainerProps={{\n\t\t\t\t\tid: getId(),\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{getTooltipContent()}\n\t\t\t</Dialog>\n\t\t) : (\n\t\t\t<span />\n\t\t);\n\t};\n\n\tconst containerStyles: CSSProperties = {\n\t\tdisplay: 'inline-block',\n\t\tlineHeight: '1',\n\t\t...triggerStyle,\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames('slds-tooltip-trigger', triggerClassName)}\n\t\t\tstyle={containerStyles}\n\t\t\tref={saveTriggerRef}\n\t\t>\n\t\t\t{getAnchoredNubbinStyles()}\n\t\t\t{getContent()}\n\t\t\t{getTooltip()}\n\t\t</div>\n\t);\n};\n\nTooltip.displayName = POPOVER_TOOLTIP;\n\nexport default Tooltip;\n"],"mappings":"6lBAwKA,IAAM,EAA6C,CAClD,wBAAyB,YACzB,qBAAsB,MACvB,EAEM,EAA+B,CACpC,eAAgB,iBAChB,gBAAiB,OAClB,EAOM,GAAW,CAChB,QAAQ,MACR,cAAe,EACf,WACA,WAAU,EAAA,EAAA,IAAA,CAAC,OAAD,CAAA,SAAM,SAAa,CAAA,EAC7B,kBACA,oBAAoB,GACpB,qBAAqB,GACrB,kBAAkB,GAClB,iBAAiB,EACjB,cAAc,OACd,GAAI,EACJ,OAAQ,EACR,OAAQ,EACR,yBACA,iBACA,mBACA,WAAW,WACX,eACA,QAAQ,OACR,OAAQ,EACR,UAAU,UAC6B,CAEvC,IAAM,EAAgB,CAAE,GAAG,EAAsB,GAAG,CAAkB,EAChE,EAAS,CAAE,GAAG,EAAe,GAAG,CAAW,EAG3C,GAAA,EAAe,EAAA,WAAA,CAAW,EAAA,mBAAmB,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W,uBAAwB,CAAgB,EAC9D,MAAO,GACP,IAAK,EAHN,SAAA,CAKE,GAAwB,EACxB,GAAW,EACX,GAAW,CACR,GAEP,EAEA,EAAQ,YAAc,EAAA"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/tooltip/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// # Tooltip\n\nimport React, {\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseCallback,\n\tuseContext,\n\ttype ReactNode,\n\ttype CSSProperties,\n\ttype KeyboardEvent,\n\ttype FocusEvent,\n\ttype MouseEvent,\n} from 'react';\nimport classNames from 'classnames';\n\nimport EventUtil from '../../utilities/event';\nimport { POPOVER_TOOLTIP } from '../../utilities/constants';\nimport generateId from '../../utilities/generate-id';\n\nimport Dialog from '../utilities/dialog';\nimport Icon from '../icon';\n// eslint-disable-next-line import/no-cycle\nimport Button from '../button';\n\n// This component's `checkProps` which issues warnings to developers about properties when in development mode\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\nimport { IconSettingsContext } from '../icon-settings';\n\n// ### Types\n\nexport type TooltipAlign =\n\t| 'top'\n\t| 'top left'\n\t| 'top right'\n\t| 'right'\n\t| 'right top'\n\t| 'right bottom'\n\t| 'bottom'\n\t| 'bottom left'\n\t| 'bottom right'\n\t| 'left'\n\t| 'left top'\n\t| 'left bottom';\n\nexport type TooltipPosition =\n\t'absolute' | 'overflowBoundaryElement' | 'relative';\n\nexport type TooltipTheme = 'info' | 'error';\n\nexport type TooltipIconVariant = 'bare' | 'error' | 'inverse' | 'warning';\n\nexport type TooltipVariant = 'base' | 'learnMore' | 'list-item';\n\nexport interface TooltipAssistiveText {\n\t/** This text is inside the info icon within the tooltip content and exists to \"complete the sentence\" for assistive tech users. */\n\ttooltipTipLearnMoreIcon?: string;\n\t/** This text is inside the info icon that triggers the tooltip in order to have text within the link. */\n\ttriggerLearnMoreIcon?: string;\n}\n\nexport interface TooltipLabels {\n\t/** This label appears in the tooltip after the info icon. */\n\tlearnMoreAfter?: string;\n\t/** This label appears in the tooltip before the info icon. */\n\tlearnMoreBefore?: string;\n}\n\nexport interface TooltipProps {\n\t/**\n\t * Alignment of the Tooltip relative to the element that triggers it.\n\t */\n\talign?: TooltipAlign;\n\t/**\n\t * **Assistive text for accessibility**\n\t * This object is merged with the default props object on every render.\n\t */\n\tassistiveText?: TooltipAssistiveText;\n\t/**\n\t * Pass the one element that triggers the Tooltip as a child. It must be an element with `tabIndex` or an element that already has a `tabIndex` set such as an anchor or a button.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * Content inside Tooltip.\n\t */\n\tcontent?: ReactNode;\n\t/**\n\t * CSS classes to be added to the popover dialog. That is the element with `.slds-popover` on it.\n\t */\n\tdialogClassName?: string | string[] | Record<string, boolean>;\n\t/**\n\t * Enabling this hides the default nubbin, replacing it with one attached directly to the tooltip trigger.\n\t */\n\thasAnchoredNubbin?: boolean;\n\t/**\n\t * By default, dialogs will flip their alignment if they extend beyond a boundary element.\n\t * `hasStaticAlignment` disables this behavior.\n\t */\n\thasStaticAlignment?: boolean;\n\t/**\n\t * Styles the default info icon trigger that renders when no children are passed. Matches `icon-variant` on `lightning-helptext`.\n\t * * `bare` - (default) Default icon color.\n\t * * `error` - Red icon, to call out an error.\n\t * * `inverse` - White icon, for dark backgrounds.\n\t * * `warning` - Yellow icon, to advise caution.\n\t */\n\ticonVariant?: TooltipIconVariant;\n\t/**\n\t * Delay on Tooltip closing in milliseconds. Defaults to 50\n\t */\n\thoverCloseDelay?: number;\n\t/**\n\t * Delay on Tooltip opening in milliseconds. Defaults to 0\n\t */\n\thoverOpenDelay?: number;\n\t/**\n\t * A unique ID is needed in order to support keyboard navigation, ARIA support, and connect the popover to the triggering element.\n\t */\n\tid?: string;\n\t/**\n\t * **Text labels for internationalization**\n\t */\n\tlabels?: TooltipLabels;\n\t/**\n\t * Forces tooltip to be open. A value of `false` will disable any interaction with the tooltip.\n\t */\n\tisOpen?: boolean;\n\t/**\n\t * Callback that returns an element or React `ref` to align the Tooltip with.\n\t */\n\tonRequestTargetElement?: () => HTMLElement | null;\n\t/**\n\t * Callback when the info icon in learn more variant is clicked\n\t */\n\tonClickTrigger?: (event: MouseEvent<HTMLAnchorElement>) => void;\n\t/**\n\t * CSS classes to be added to tag with `slds-tooltip-trigger`.\n\t */\n\ttriggerClassName?: string | string[] | Record<string, boolean>;\n\t/**\n\t * Please select one of the following:\n\t * * `absolute` - (default) The dialog will use `position: absolute` and style attributes to position itself.\n\t * * `overflowBoundaryElement` - The dialog will overflow scrolling parents.\n\t * * `relative` - No styling or portals will be used.\n\t */\n\tposition?: TooltipPosition;\n\t/**\n\t * Custom styles to be added to wrapping triggering `div`.\n\t */\n\ttriggerStyle?: CSSProperties;\n\t/**\n\t * Determines the theme of tooltip: for informative purpose (blue background) or warning purpose (red background).\n\t */\n\ttheme?: TooltipTheme;\n\t/**\n\t * Determines the type of the tooltip.\n\t */\n\tvariant?: TooltipVariant;\n}\n\nconst defaultAssistiveText: TooltipAssistiveText = {\n\ttooltipTipLearnMoreIcon: 'this link',\n\ttriggerLearnMoreIcon: 'Help',\n};\n\nconst defaultLabels: TooltipLabels = {\n\tlearnMoreAfter: 'to learn more.',\n\tlearnMoreBefore: 'Click',\n};\n\n/**\n * The PopoverTooltip component is variant of the Lightning Design System Popover component.\n * This component wraps an element that triggers it to open. It must be a focusable child element\n * (either a button or an anchor), so that keyboard users can navigate to it.\n */\nconst Tooltip = ({\n\talign = 'top',\n\tassistiveText: assistiveTextProp,\n\tchildren,\n\tcontent = <span>Tooltip</span>,\n\tdialogClassName,\n\thasAnchoredNubbin = false,\n\thasStaticAlignment = false,\n\thoverCloseDelay = 50,\n\thoverOpenDelay = 0,\n\ticonVariant = 'bare',\n\tid: idProp,\n\tlabels: labelsProp,\n\tisOpen: isOpenProp,\n\tonRequestTargetElement,\n\tonClickTrigger,\n\ttriggerClassName,\n\tposition = 'absolute',\n\ttriggerStyle,\n\ttheme = 'info',\n\tvariant = 'base',\n}: TooltipProps): React.ReactElement => {\n\t// Merge assistive text and labels with defaults\n\tconst assistiveText = { ...defaultAssistiveText, ...assistiveTextProp };\n\tconst labels = { ...defaultLabels, ...labelsProp };\n\n\t// Context\n\tconst iconSettings = useContext(IconSettingsContext);\n\n\t// State\n\tconst [isOpenState, setIsOpenState] = useState(false);\n\tconst [triggerRendered, setTriggerRendered] = useState(false);\n\n\t// Refs\n\tconst triggerRef = useRef<HTMLDivElement>(null);\n\tconst tooltipTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\tconst generatedIdRef = useRef(generateId());\n\tconst isUnmountingRef = useRef(false);\n\n\t// Check props in development\n\tuseEffect(() => {\n\t\tcheckProps(\n\t\t\tPOPOVER_TOOLTIP,\n\t\t\t{\n\t\t\t\talign,\n\t\t\t\tassistiveText,\n\t\t\t\tchildren,\n\t\t\t\tcontent,\n\t\t\t\tdialogClassName,\n\t\t\t\thasAnchoredNubbin,\n\t\t\t\thasStaticAlignment,\n\t\t\t\thoverCloseDelay,\n\t\t\t\thoverOpenDelay,\n\t\t\t\ticonVariant,\n\t\t\t\tid: idProp,\n\t\t\t\tlabels,\n\t\t\t\tisOpen: isOpenProp,\n\t\t\t\tonRequestTargetElement,\n\t\t\t\tonClickTrigger,\n\t\t\t\ttriggerClassName,\n\t\t\t\tposition,\n\t\t\t\ttriggerStyle,\n\t\t\t\ttheme,\n\t\t\t\tvariant,\n\t\t\t},\n\t\t\tcomponentDoc\n\t\t);\n\t}, []);\n\n\t// Cleanup on unmount\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tisUnmountingRef.current = true;\n\t\t\tif (tooltipTimeoutRef.current) {\n\t\t\t\tclearTimeout(tooltipTimeoutRef.current);\n\t\t\t}\n\t\t};\n\t}, []);\n\n\t// Get computed values\n\tconst getId = useCallback(() => {\n\t\treturn idProp || generatedIdRef.current;\n\t}, [idProp]);\n\n\tconst getIsOpen = useCallback(() => {\n\t\treturn isOpenProp === undefined ? isOpenState : isOpenProp;\n\t}, [isOpenProp, isOpenState]);\n\n\tconst getTooltipTarget = useCallback(() => {\n\t\tif (onRequestTargetElement) {\n\t\t\treturn onRequestTargetElement();\n\t\t}\n\n\t\treturn triggerRef.current;\n\t}, [onRequestTargetElement]);\n\n\t// Event handlers\n\tconst handleCancel = useCallback(() => {\n\t\tif (tooltipTimeoutRef.current) {\n\t\t\tclearTimeout(tooltipTimeoutRef.current);\n\t\t}\n\n\t\tsetIsOpenState(false);\n\t}, []);\n\n\tconst handleMouseEnter = useCallback(() => {\n\t\tif (tooltipTimeoutRef.current) {\n\t\t\tclearTimeout(tooltipTimeoutRef.current);\n\t\t}\n\n\t\ttooltipTimeoutRef.current = setTimeout(() => {\n\t\t\tif (!isUnmountingRef.current) {\n\t\t\t\tsetIsOpenState(true);\n\t\t\t}\n\t\t}, hoverOpenDelay);\n\t}, [hoverOpenDelay]);\n\n\tconst handleMouseLeave = useCallback(\n\t\t(e: MouseEvent<HTMLElement> | FocusEvent<HTMLElement>) => {\n\t\t\te.stopPropagation();\n\t\t\tif (tooltipTimeoutRef.current) {\n\t\t\t\tclearTimeout(tooltipTimeoutRef.current);\n\t\t\t}\n\n\t\t\ttooltipTimeoutRef.current = setTimeout(() => {\n\t\t\t\tconst relatedTarget = (e as MouseEvent<HTMLElement>)\n\t\t\t\t\t.relatedTarget as HTMLElement | null;\n\t\t\t\tconst isHoveringTooltip =\n\t\t\t\t\trelatedTarget?.classList?.contains('slds-popover_tooltip') ||\n\t\t\t\t\trelatedTarget?.classList?.contains('slds-popover__body');\n\n\t\t\t\tif (!isUnmountingRef.current && !isHoveringTooltip) {\n\t\t\t\t\tsetIsOpenState(false);\n\t\t\t\t}\n\t\t\t}, hoverCloseDelay);\n\t\t},\n\t\t[hoverCloseDelay]\n\t);\n\n\tconst handleKeyDown = useCallback(\n\t\t(e: KeyboardEvent<HTMLElement>) => {\n\t\t\te.stopPropagation();\n\n\t\t\ttooltipTimeoutRef.current = setTimeout(() => {\n\t\t\t\tif (!isUnmountingRef.current && e.key === 'Escape') {\n\t\t\t\t\tsetIsOpenState(false);\n\t\t\t\t}\n\t\t\t}, hoverCloseDelay);\n\t\t},\n\t\t[hoverCloseDelay]\n\t);\n\n\t// Save trigger ref and trigger re-render once mounted\n\tconst saveTriggerRef = useCallback(\n\t\t(component: HTMLDivElement | null) => {\n\t\t\tif (component && triggerRef.current !== component) {\n\t\t\t\t(triggerRef as React.MutableRefObject<HTMLDivElement | null>).current =\n\t\t\t\t\tcomponent;\n\t\t\t\t// Dialog/Popper.js cannot place the popover until\n\t\t\t\t// the trigger/target DOM node is mounted.\n\t\t\t\tif (!triggerRendered) {\n\t\t\t\t\tsetTriggerRendered(true);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[triggerRendered]\n\t);\n\n\t// Render helpers\n\tconst getAnchoredNubbinStyles = () => {\n\t\tif (!hasAnchoredNubbin) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst alignment = align.split(' ')[0] as\n\t\t\t'top' | 'bottom' | 'left' | 'right';\n\t\tconst nubbinContainerStyles: CSSProperties = {\n\t\t\theight: '0',\n\t\t\tposition: 'relative',\n\t\t\twidth: '0',\n\t\t};\n\t\tconst nubbinStyles: CSSProperties = {\n\t\t\tbackgroundColor: '#16325c',\n\t\t\tcontent: '\"\"',\n\t\t\theight: '1rem',\n\t\t\tposition: 'absolute',\n\t\t\ttransform: 'rotate(45deg)',\n\t\t\twidth: '1rem',\n\t\t};\n\t\tconst triggerDimensions = {\n\t\t\theight: triggerRef.current\n\t\t\t\t? triggerRef.current.getBoundingClientRect().height\n\t\t\t\t: 0,\n\t\t\twidth: triggerRef.current\n\t\t\t\t? triggerRef.current.getBoundingClientRect().width\n\t\t\t\t: 0,\n\t\t};\n\n\t\tswitch (alignment) {\n\t\t\tcase 'bottom': {\n\t\t\t\tnubbinContainerStyles.left = `${triggerDimensions.width / 2}px`;\n\t\t\t\tnubbinContainerStyles.top = `${triggerDimensions.height}px`;\n\t\t\t\tnubbinStyles.left = '-8px';\n\t\t\t\tnubbinStyles.top = '3px';\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'left': {\n\t\t\t\tnubbinContainerStyles.left = '0';\n\t\t\t\tnubbinContainerStyles.top = `${triggerDimensions.height / 2}px`;\n\t\t\t\tnubbinStyles.left = '-19px';\n\t\t\t\tnubbinStyles.top = '-9px';\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'right': {\n\t\t\t\tnubbinContainerStyles.left = `${triggerDimensions.width}px`;\n\t\t\t\tnubbinContainerStyles.top = `${triggerDimensions.height / 2}px`;\n\t\t\t\tnubbinStyles.left = '3px';\n\t\t\t\tnubbinStyles.top = '-9px';\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\t// top\n\t\t\t\tnubbinContainerStyles.left = `${triggerDimensions.width / 2}px`;\n\t\t\t\tnubbinContainerStyles.top = '0';\n\t\t\t\tnubbinStyles.left = '-8px';\n\t\t\t\tnubbinStyles.top = '-19px';\n\t\t\t}\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<style>{`#${getId()}:after, #${getId()}:before {\n\tdisplay: none;\n}`}</style>\n\t\t\t\t{getIsOpen() ? (\n\t\t\t\t\t<div style={nubbinContainerStyles}>\n\t\t\t\t\t\t<div style={nubbinStyles} />\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t</>\n\t\t);\n\t};\n\n\tconst getContent = () => {\n\t\tlet childrenToRender: ReactNode;\n\t\tconst noChildrenProvided = React.Children.count(children) === 0;\n\t\tconst isInverseIcon = iconVariant === 'inverse';\n\t\tconst iconColorVariant =\n\t\t\ticonVariant === 'error' || iconVariant === 'warning'\n\t\t\t\t? iconVariant\n\t\t\t\t: undefined;\n\n\t\tif (noChildrenProvided && onClickTrigger) {\n\t\t\tchildrenToRender = (\n\t\t\t\t<a\n\t\t\t\t\thref=\"#\"\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tEventUtil.trappedHandler(\n\t\t\t\t\t\t\tonClickTrigger\n\t\t\t\t\t\t) as React.MouseEventHandler<HTMLAnchorElement>\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\tcolorVariant={iconColorVariant}\n\t\t\t\t\t\tinverse={isInverseIcon}\n\t\t\t\t\t\tname=\"info\"\n\t\t\t\t\t\tassistiveText={{\n\t\t\t\t\t\t\tlabel: assistiveText.triggerLearnMoreIcon,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t/>\n\t\t\t\t</a>\n\t\t\t);\n\t\t} else if (noChildrenProvided) {\n\t\t\tchildrenToRender = (\n\t\t\t\t<Button\n\t\t\t\t\taria-disabled\n\t\t\t\t\tassistiveText={{\n\t\t\t\t\t\ticon: assistiveText.triggerLearnMoreIcon,\n\t\t\t\t\t}}\n\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\ticonClassName={\n\t\t\t\t\t\ticonColorVariant && `slds-icon-text-${iconColorVariant}`\n\t\t\t\t\t}\n\t\t\t\t\ticonName=\"info\"\n\t\t\t\t\t// `bare` keeps `slds-button_icon`, which Button drops for `inverse` alone\n\t\t\t\t\ticonVariant={isInverseIcon ? 'bare' : undefined}\n\t\t\t\t\tinverse={isInverseIcon}\n\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t/>\n\t\t\t);\n\t\t} else {\n\t\t\tchildrenToRender = children;\n\t\t}\n\n\t\treturn React.Children.map(childrenToRender, (child, i) => {\n\t\t\tif (!React.isValidElement(child)) {\n\t\t\t\treturn child;\n\t\t\t}\n\n\t\t\treturn React.cloneElement(\n\t\t\t\tchild as React.ReactElement<{\n\t\t\t\t\tkey?: React.Key;\n\t\t\t\t\t'aria-describedby'?: string;\n\t\t\t\t\tonBlur?: (e: FocusEvent<HTMLElement>) => void;\n\t\t\t\t\tonFocus?: () => void;\n\t\t\t\t\tonMouseEnter?: () => void;\n\t\t\t\t\tonMouseLeave?: (e: MouseEvent<HTMLElement>) => void;\n\t\t\t\t\tonKeyDown?: (e: KeyboardEvent<HTMLElement>) => void;\n\t\t\t\t}>,\n\t\t\t\t{\n\t\t\t\t\tkey: i,\n\t\t\t\t\t'aria-describedby': getIsOpen() ? getId() : undefined,\n\t\t\t\t\tonBlur: handleMouseLeave,\n\t\t\t\t\tonFocus: handleMouseEnter,\n\t\t\t\t\tonMouseEnter: handleMouseEnter,\n\t\t\t\t\tonMouseLeave: handleMouseLeave,\n\t\t\t\t\tonKeyDown: handleKeyDown,\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\t};\n\n\tconst getTooltipContent = () => {\n\t\tconst isErrorTheme = theme === 'error';\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames('slds-popover__body', {\n\t\t\t\t\t// Ensure text contrast on error theme (red background needs white text)\n\t\t\t\t\t'slds-text-color_inverse': isErrorTheme,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t{content}\n\t\t\t\t{variant === 'learnMore' && onClickTrigger ? (\n\t\t\t\t\t<div className=\"slds-m-top_x-small\" aria-hidden=\"true\">\n\t\t\t\t\t\t{labels.learnMoreBefore}{' '}\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tassistiveText={{\n\t\t\t\t\t\t\t\tlabel: assistiveText.tooltipTipLearnMoreIcon,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\tinverse\n\t\t\t\t\t\t\tname=\"info\"\n\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t/>{' '}\n\t\t\t\t\t\t{labels.learnMoreAfter}{' '}\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t);\n\t};\n\n\tconst getTooltip = () => {\n\t\tconst isOpen = getIsOpen();\n\n\t\treturn isOpen ? (\n\t\t\t<Dialog\n\t\t\t\tcloseOnTabKey\n\t\t\t\thasNubbin\n\t\t\t\tcontentsClassName={classNames(\n\t\t\t\t\t'slds-popover',\n\t\t\t\t\t'slds-popover_tooltip',\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-theme_error': theme === 'error',\n\t\t\t\t\t},\n\t\t\t\t\tdialogClassName\n\t\t\t\t)}\n\t\t\t\talign={align}\n\t\t\t\tcontext={iconSettings}\n\t\t\t\thasStaticAlignment={hasStaticAlignment}\n\t\t\t\tonClose={handleCancel}\n\t\t\t\tonRequestTargetElement={getTooltipTarget}\n\t\t\t\tonMouseLeave={handleCancel}\n\t\t\t\tposition={position}\n\t\t\t\tvariant=\"tooltip\"\n\t\t\t\tcontainerProps={{\n\t\t\t\t\tid: getId(),\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{getTooltipContent()}\n\t\t\t</Dialog>\n\t\t) : (\n\t\t\t<span />\n\t\t);\n\t};\n\n\tconst containerStyles: CSSProperties = {\n\t\tdisplay: 'inline-block',\n\t\tlineHeight: '1',\n\t\t...triggerStyle,\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames('slds-tooltip-trigger', triggerClassName)}\n\t\t\tstyle={containerStyles}\n\t\t\tref={saveTriggerRef}\n\t\t>\n\t\t\t{getAnchoredNubbinStyles()}\n\t\t\t{getContent()}\n\t\t\t{getTooltip()}\n\t\t</div>\n\t);\n};\n\nTooltip.displayName = POPOVER_TOOLTIP;\n\nexport default Tooltip;\n"],"mappings":"6lBAoKA,IAAM,EAA6C,CAClD,wBAAyB,YACzB,qBAAsB,MACvB,EAEM,EAA+B,CACpC,eAAgB,iBAChB,gBAAiB,OAClB,EAOM,GAAW,CAChB,QAAQ,MACR,cAAe,EACf,WACA,WAAU,EAAA,EAAA,IAAA,CAAC,OAAD,CAAA,SAAM,SAAa,CAAA,EAC7B,kBACA,oBAAoB,GACpB,qBAAqB,GACrB,kBAAkB,GACl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,CACf,GAAI,EAAM,CACX,EAEC,SAAA,GAAkB,CACZ,CAAA,GAER,EAAA,EAAA,IAAA,CAAC,OAAD,CAAO,CAAA,EAIH,GAAiC,CACtC,QAAS,eACT,WAAY,IACZ,GAAG,CACJ,EAEA,OACC,EAAA,EAAA,KAAA,CAAC,MAAD,CACC,WAAA,EAAW,EAAA,QAAA,CAAW,uBAAwB,CAAgB,EAC9D,MAAO,GACP,IAAK,EAHN,SAAA,CAKE,EAAwB,EACxB,GAAW,EACX,GAAW,CACR,GAEP,EAEA,EAAQ,YAAc,EAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../../utilities/
|
|
1
|
+
const e=require("../../utilities/get-component-doc.cjs"),t=require("../../utilities/warning/one-of-required-property.cjs"),n=require("../../utilities/warning/deprecated-property.cjs"),r=require("../../utilities/warning/only-one-of-properties.cjs");var i=function(){};process.env.NODE_ENV!==`production`&&(i=function(i,a,o){let s=e.default(o),c=a.assistiveText||{},l={"labels.heading":a.labels?.heading??a.heading,"assistiveText.heading":c.heading??c.label};t.default(i,l,s()),r.default(i,l,s()),n.default(i,a.heading,`heading`,`labels.heading`,s(`labels`)),n.default(i,c.label,`assistiveText.label`,`assistiveText.heading`,s(`assistiveText`)),n.default(i,a.onClick,`onClick`,`onSelect`,"`onSelect` receives `(event, { node, isSelected })`, where `isSelected` is the requested selection state."),n.default(i,a.onExpandClick,`onExpandClick`,`onRequestToggle`,"`onRequestToggle` receives `(event, { node, isExpanded })`, where `isExpanded` is the requested expansion state. Left arrow on a collapsed branch or item selects the parent through `onSelect` instead.")});var a=i;exports.default=a;
|
|
2
2
|
//# sourceMappingURL=check-props.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-props.cjs","names":[],"sources":["../../../../components/tree/check-props.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n/* eslint-disable import/no-mutable-exports */\n\nimport oneOfRequiredProperty from '../../utilities/warning/one-of-required-property';\nimport
|
|
1
|
+
{"version":3,"file":"check-props.cjs","names":[],"sources":["../../../../components/tree/check-props.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n/* eslint-disable import/no-mutable-exports */\n\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport oneOfRequiredProperty from '../../utilities/warning/one-of-required-property';\nimport onlyOneOfProperties from '../../utilities/warning/only-one-of-properties';\nimport getComponentDocFn from '../../utilities/get-component-doc';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\t\tconst assistiveText = props.assistiveText || {};\n\n\t\tconst headingProps = {\n\t\t\t'labels.heading': props.labels?.heading ?? props.heading,\n\t\t\t'assistiveText.heading': assistiveText.heading ?? assistiveText.label,\n\t\t};\n\t\toneOfRequiredProperty(COMPONENT, headingProps, createDocUrl());\n\t\tonlyOneOfProperties(COMPONENT, headingProps, createDocUrl());\n\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.heading,\n\t\t\t'heading',\n\t\t\t'labels.heading',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tassistiveText.label,\n\t\t\t'assistiveText.label',\n\t\t\t'assistiveText.heading',\n\t\t\tcreateDocUrl('assistiveText')\n\t\t);\n\n\t\t/* eslint-disable max-len */\n\t\t// Deprecated and changed to another property\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onClick,\n\t\t\t'onClick',\n\t\t\t'onSelect',\n\t\t\t'`onSelect` receives `(event, { node, isSelected })`, where `isSelected` is the requested selection state.'\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onExpandClick,\n\t\t\t'onExpandClick',\n\t\t\t'onRequestToggle',\n\t\t\t'`onRequestToggle` receives `(event, { node, isExpanded })`, where `isExpanded` is the requested expansion state. Left arrow on a collapsed branch or item selects the parent through `onSelect` instead.'\n\t\t);\n\t\t/* eslint-enable max-len */\n\t};\n}\n\nexport default checkProps;\n"],"mappings":"wPASA,IAAI,EAAa,UAA8B,CAAC,EAEhD,QAAA,IAAA,WAA6B,eAC5B,EAAa,SAA4B,EAAW,EAAO,EAAS,CACnE,IAAM,EAAe,EAAA,QAAkB,CAAO,EACxC,EAAgB,EAAM,eAAiB,CAAC,EAExC,EAAe,CACpB,iBAAkB,EAAM,QAAQ,SAAW,EAAM,QACjD,wBAAyB,EAAc,SAAW,EAAc,KACjE,EACA,EAAA,QAAsB,EAAW,EAAc,EAAa,CAAC,EAC7D,EAAA,QAAoB,EAAW,EAAc,EAAa,CAAC,EAE3D,EAAA,QACC,EACA,EAAM,QACN,UACA,iBACA,EAAa,QAAQ,CACtB,EACA,EAAA,QACC,EACA,EAAc,MACd,sBACA,wBACA,EAAa,eAAe,CAC7B,EAIA,EAAA,QACC,EACA,EAAM,QACN,UACA,WACA,2GACD,EACA,EAAA,QACC,EACA,EAAM,cACN,gBACA,kBACA,0MACD,CAED,GAGD,IAAA,EAAe"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=`tree`,t=`prod`,n=`Tree`,r={component:e,status:t,"display-name":`Tree`,classKey:n,"last-accessibility-review":{"date-iso-8601":`2018/05/04`,"commit-sha":`5fdeb31982a42cbd37a70d96d6257142cd7eec72`},"last-slds-markup-review":{"date-iso-8601":`2018/05/04`,"commit-sha":`5fdeb31982a42cbd37a70d96d6257142cd7eec72`},"SLDS-component-path":`/components/trees`,"site-stories":[{heading:`Default`,path:`/__examples__/default.jsx`}],"url-slug":`tree`};exports.classKey=n,exports.component=e,exports.default=r,exports.status=t;
|
|
2
|
+
//# sourceMappingURL=component.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.cjs","names":[],"sources":["../../../../components/tree/component.json"],"sourcesContent":["{\n\t\"component\": \"tree\",\n\t\"status\": \"prod\",\n\t\"display-name\": \"Tree\",\n\t\"classKey\": \"Tree\",\n\t\"last-accessibility-review\": {\n\t\t\"date-iso-8601\": \"2018/05/04\",\n\t\t\"commit-sha\": \"5fdeb31982a42cbd37a70d96d6257142cd7eec72\"\n\t},\n\t\"last-slds-markup-review\": {\n\t\t\"date-iso-8601\": \"2018/05/04\",\n\t\t\"commit-sha\": \"5fdeb31982a42cbd37a70d96d6257142cd7eec72\"\n\t},\n\t\"SLDS-component-path\": \"/components/trees\",\n\t\"site-stories\": [\n\t\t{\n\t\t\t\"heading\": \"Default\",\n\t\t\t\"path\": \"/__examples__/default.jsx\"\n\t\t}\n\t],\n\t\"url-slug\": \"tree\"\n}\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.cjs","names":[],"sources":["../../../../../components/tree/private/branch.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, { ReactNode } from 'react';\n\nimport Item from './item';\nimport RenderInitialBranch from './render-initial-branch';\nimport RenderBranch from './render-branch';\n\nimport { TREE_BRANCH } from '../../../utilities/constants';\nimport generateId from '../../../utilities/generate-id';\nimport { TreeNode, FlattenedNode } from '../types';\n\nexport interface BranchProps {\n\tgetNodes?: (node: { nodes?: TreeNode[] }) => TreeNode[] | undefined;\n\thtmlId: string | number;\n\tindex?: number;\n\tinitial?: boolean;\n\tinitalClassName?: string | string[] | Record<string, boolean>;\n\tinitialStyle?: React.CSSProperties;\n\tlabel?: ReactNode | string;\n\tlevel: number;\n\tnode: TreeNode | { nodes?: TreeNode[] };\n\tonSelect?: (params: {\n\t\tevent: React.SyntheticEvent;\n\t\tdata: {\n\t\t\tnode: TreeNode;\n\t\t\tselect: boolean;\n\t\t\ttreeIndex: string;\n\t\t};\n\t\tfromFocus?: boolean;\n\t\tclearSelectedNodes?: boolean;\n\t}) => void;\n\tonExpand: (params: {\n\t\tevent: React.SyntheticEvent;\n\t\tdata: {\n\t\t\tnode: TreeNode;\n\t\t\texpand: boolean;\n\t\t\ttreeIndex: string;\n\t\t\tselect?: boolean;\n\t\t};\n\t}) => void;\n\tonScroll?: (\n\t\tevent: React.UIEvent<HTMLUListElement>,\n\t\tdata:
|
|
1
|
+
{"version":3,"file":"branch.cjs","names":[],"sources":["../../../../../components/tree/private/branch.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, { ReactNode } from 'react';\n\nimport Item from './item';\nimport RenderInitialBranch from './render-initial-branch';\nimport RenderBranch from './render-branch';\n\nimport { TREE_BRANCH } from '../../../utilities/constants';\nimport generateId from '../../../utilities/generate-id';\nimport { TreeNode, FlattenedNode, TreeScrollData } from '../types';\n\nexport interface BranchProps {\n\tgetNodes?: (node: { nodes?: TreeNode[] }) => TreeNode[] | undefined;\n\thtmlId: string | number;\n\tindex?: number;\n\tinitial?: boolean;\n\tinitalClassName?: string | string[] | Record<string, boolean>;\n\tinitialStyle?: React.CSSProperties;\n\tlabel?: ReactNode | string;\n\tlevel: number;\n\tnode: TreeNode | { nodes?: TreeNode[] };\n\tonSelect?: (params: {\n\t\tevent: React.SyntheticEvent;\n\t\tdata: {\n\t\t\tnode: TreeNode;\n\t\t\tselect: boolean;\n\t\t\ttreeIndex: string;\n\t\t};\n\t\tfromFocus?: boolean;\n\t\tclearSelectedNodes?: boolean;\n\t}) => void;\n\tonExpand: (params: {\n\t\tevent: React.SyntheticEvent;\n\t\tdata: {\n\t\t\tnode: TreeNode;\n\t\t\texpand: boolean;\n\t\t\ttreeIndex: string;\n\t\t\tselect?: boolean;\n\t\t};\n\t}) => void;\n\tonScroll?: (\n\t\tevent: React.UIEvent<HTMLUListElement>,\n\t\tdata: TreeScrollData\n\t) => void;\n\tsearchTerm?: string;\n\ttreeId: string;\n\ttreeIndex?: string;\n\tflattenedNodes: FlattenedNode[];\n\tselectedNodeIndexes: string[];\n\tfocusedNodeIndex?: string;\n\tonNodeBlur?: () => void;\n\ttreeHasFocus?: boolean;\n\tparent?: TreeNode | { nodes?: TreeNode[] };\n\tnodes?: TreeNode[];\n}\n\nconst defaultGetNodes = (node: { nodes?: TreeNode[] }) => node.nodes;\n\n/**\n * A Tree Branch is an expandable node in a hierarchical list.\n */\nconst Branch: React.FC<BranchProps> = ({\n\tlevel = 0,\n\tlabel = '',\n\ttreeIndex = '',\n\tselectedNodeIndexes = [],\n\tgetNodes = defaultGetNodes,\n\t...rest\n}) => {\n\tconst props = {\n\t\tlevel,\n\t\tlabel,\n\t\ttreeIndex,\n\t\tselectedNodeIndexes,\n\t\tgetNodes,\n\t\t...rest,\n\t};\n\n\tconst { treeId, onExpand, searchTerm, node } = props;\n\tlet resolvedTreeIndex = '';\n\tlet children: ReactNode = null;\n\n\tconst nodeChildren = getNodes(node);\n\tif (Array.isArray(nodeChildren)) {\n\t\tchildren = nodeChildren.map((childNode, index) => {\n\t\t\tlet child: ReactNode;\n\t\t\tconst htmlId = `${treeId}-${childNode.id}`;\n\t\t\tresolvedTreeIndex = `${index}`;\n\t\t\tif (treeIndex) {\n\t\t\t\tresolvedTreeIndex = `${treeIndex}-${resolvedTreeIndex}`;\n\t\t\t}\n\n\t\t\tif (childNode.type === 'branch') {\n\t\t\t\tchild = (\n\t\t\t\t\t<Branch\n\t\t\t\t\t\tgetNodes={getNodes}\n\t\t\t\t\t\thtmlId={htmlId}\n\t\t\t\t\t\tkey={childNode.id}\n\t\t\t\t\t\tlabel={childNode.label}\n\t\t\t\t\t\tlevel={level + 1}\n\t\t\t\t\t\tnode={childNode}\n\t\t\t\t\t\tflattenedNodes={props.flattenedNodes}\n\t\t\t\t\t\tselectedNodeIndexes={selectedNodeIndexes}\n\t\t\t\t\t\tfocusedNodeIndex={props.focusedNodeIndex}\n\t\t\t\t\t\ttreeHasFocus={props.treeHasFocus}\n\t\t\t\t\t\tonNodeBlur={props.onNodeBlur}\n\t\t\t\t\t\tnodes={childNode.nodes}\n\t\t\t\t\t\tonSelect={props.onSelect}\n\t\t\t\t\t\tonExpand={onExpand}\n\t\t\t\t\t\tsearchTerm={searchTerm}\n\t\t\t\t\t\ttreeId={treeId}\n\t\t\t\t\t\ttreeIndex={resolvedTreeIndex}\n\t\t\t\t\t\tparent={node}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tchild = (\n\t\t\t\t\t<Item\n\t\t\t\t\t\tlabel={childNode.label}\n\t\t\t\t\t\thtmlId={htmlId}\n\t\t\t\t\t\tkey={generateId()}\n\t\t\t\t\t\tlevel={level + 1}\n\t\t\t\t\t\tnode={childNode}\n\t\t\t\t\t\tflattenedNodes={props.flattenedNodes}\n\t\t\t\t\t\tselectedNodeIndexes={selectedNodeIndexes}\n\t\t\t\t\t\tfocusedNodeIndex={props.focusedNodeIndex}\n\t\t\t\t\t\ttreeHasFocus={props.treeHasFocus}\n\t\t\t\t\t\tonNodeBlur={props.onNodeBlur}\n\t\t\t\t\t\tonSelect={props.onSelect}\n\t\t\t\t\t\tonExpand={onExpand}\n\t\t\t\t\t\tsearchTerm={searchTerm}\n\t\t\t\t\t\ttreeIndex={resolvedTreeIndex}\n\t\t\t\t\t\ttreeId={treeId}\n\t\t\t\t\t\tparent={node}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn child;\n\t\t});\n\t}\n\n\tconst branch =\n\t\tlevel === 0\n\t\t\t? RenderInitialBranch(children, props)\n\t\t\t: RenderBranch(children, {\n\t\t\t\t\t...props,\n\t\t\t\t\tnode: node as TreeNode,\n\t\t\t\t\ttreeIndex,\n\t\t\t\t});\n\n\treturn branch;\n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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.cjs","names":[],"sources":["../../../../../components/tree/private/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\nimport React, { ReactNode } from 'react';\nimport classNames from 'classnames';\nimport findIndex from 'lodash.findindex';\nimport isFunction from 'lodash.isfunction';\n\nimport Button from '../../button';\nimport Highlighter from '../../utilities/highlighter';\n\nimport EventUtil from '../../../utilities/event';\nimport KEYS from '../../../utilities/key-code';\nimport mapKeyEventCallbacks from '../../../utilities/key-callbacks';\nimport { TREE_ITEM } from '../../../utilities/constants';\nimport { TreeNode, FlattenedNode } from '../types';\n\nexport interface ItemProps {\n\thtmlId: string;\n\tlabel: ReactNode | string;\n\tlevel: number;\n\tnode: TreeNode;\n\tonExpand: (params: {\n\t\tevent: React.SyntheticEvent;\n\t\tdata: {\n\t\t\tnode: TreeNode;\n\t\t\tselect?: boolean;\n\t\t\texpand: boolean;\n\t\t\ttreeIndex: string;\n\t\t};\n\t}) => void;\n\tonSelect?: (params: {\n\t\tevent: React.SyntheticEvent;\n\t\tdata: {\n\t\t\tnode: TreeNode;\n\t\t\tselect: boolean;\n\t\t\ttreeIndex: string;\n\t\t};\n\t\tfromFocus?: boolean;\n\t\tclearSelectedNodes?: boolean;\n\t}) => void;\n\tsearchTerm?: string;\n\ttreeId?: string;\n\ttreeIndex: string;\n\tflattenedNodes: FlattenedNode[];\n\tselectedNodeIndexes: string[];\n\tfocusedNodeIndex?: string;\n\tonNodeBlur?: () => void;\n\ttreeHasFocus?: boolean;\n\tparent?: TreeNode | { nodes?: TreeNode[] };\n}\n\nconst handleSelect = ({\n\tevent,\n\tprops,\n\tfromFocus,\n}: {\n\tevent: React.SyntheticEvent;\n\tprops: ItemProps;\n\tfromFocus?: boolean;\n}) => {\n\tEventUtil.trap(event);\n\tif (isFunction(props.onSelect)) {\n\t\tprops.onSelect({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: props.node,\n\t\t\t\tselect: !props.node.selected,\n\t\t\t\ttreeIndex: props.treeIndex,\n\t\t\t},\n\t\t\tfromFocus,\n\t\t});\n\t}\n};\n\nconst findNextNode = (flattenedNodes: FlattenedNode[], node: TreeNode) => {\n\tconst nodes = flattenedNodes.map((flattenedNode) => flattenedNode.node);\n\tconst index = findIndex(nodes, { id: node.id });\n\treturn flattenedNodes[(index + 1) % flattenedNodes.length];\n};\n\nconst findPreviousNode = (flattenedNodes: FlattenedNode[], node: TreeNode) => {\n\tconst nodes = flattenedNodes.map((flattenedNode) => flattenedNode.node);\n\tlet index = findIndex(nodes, { id: node.id }) - 1;\n\tif (index < 0) {\n\t\tindex += flattenedNodes.length;\n\t}\n\treturn flattenedNodes[index];\n};\n\nconst handleKeyDownDown = (event: React.KeyboardEvent, props: ItemProps) => {\n\tif (props.focusedNodeIndex === props.treeIndex) {\n\t\tconst flattenedNode = findNextNode(props.flattenedNodes, props.node);\n\t\tprops.onSelect?.({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: flattenedNode.node,\n\t\t\t\tselect: true,\n\t\t\t\ttreeIndex: flattenedNode.treeIndex,\n\t\t\t},\n\t\t\tclearSelectedNodes: true,\n\t\t});\n\t}\n};\n\nconst handleKeyDownUp = (event: React.KeyboardEvent, props: ItemProps) => {\n\tif (props.focusedNodeIndex === props.treeIndex) {\n\t\tconst flattenedNode = findPreviousNode(props.flattenedNodes, props.node);\n\t\tprops.onSelect?.({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: flattenedNode.node,\n\t\t\t\tselect: true,\n\t\t\t\ttreeIndex: flattenedNode.treeIndex,\n\t\t\t},\n\t\t\tclearSelectedNodes: true,\n\t\t});\n\t}\n};\n\nconst handleKeyDownLeft = (event: React.KeyboardEvent, props: ItemProps) => {\n\tconst nodes = props.flattenedNodes.map((flattenedNode) => flattenedNode.node);\n\tconst parent = props.parent as TreeNode;\n\tconst index = findIndex(nodes, { id: parent?.id });\n\tif (index !== -1) {\n\t\tprops.onExpand({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: parent,\n\t\t\t\tselect: true,\n\t\t\t\texpand: !parent.expanded,\n\t\t\t\ttreeIndex: props.flattenedNodes[index].treeIndex,\n\t\t\t},\n\t\t});\n\t}\n};\n\nconst handleKeyDownEnter = (event: React.KeyboardEvent, props: ItemProps) => {\n\thandleSelect({ event, props });\n};\n\nconst handleKeyDown = (event: React.KeyboardEvent, props: ItemProps) => {\n\tmapKeyEventCallbacks(event, {\n\t\tcallbacks: {\n\t\t\t[KEYS.DOWN]: {
|
|
1
|
+
{"version":3,"file":"item.cjs","names":[],"sources":["../../../../../components/tree/private/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\nimport React, { ReactNode } from 'react';\nimport classNames from 'classnames';\nimport findIndex from 'lodash.findindex';\nimport isFunction from 'lodash.isfunction';\n\nimport Button from '../../button';\nimport Highlighter from '../../utilities/highlighter';\n\nimport EventUtil from '../../../utilities/event';\nimport KEYS from '../../../utilities/key-code';\nimport mapKeyEventCallbacks from '../../../utilities/key-callbacks';\nimport { TREE_ITEM } from '../../../utilities/constants';\nimport { TreeNode, FlattenedNode } from '../types';\n\nexport interface ItemProps {\n\thtmlId: string;\n\tlabel: ReactNode | string;\n\tlevel: number;\n\tnode: TreeNode;\n\tonExpand: (params: {\n\t\tevent: React.SyntheticEvent;\n\t\tdata: {\n\t\t\tnode: TreeNode;\n\t\t\tselect?: boolean;\n\t\t\texpand: boolean;\n\t\t\ttreeIndex: string;\n\t\t};\n\t}) => void;\n\tonSelect?: (params: {\n\t\tevent: React.SyntheticEvent;\n\t\tdata: {\n\t\t\tnode: TreeNode;\n\t\t\tselect: boolean;\n\t\t\ttreeIndex: string;\n\t\t};\n\t\tfromFocus?: boolean;\n\t\tclearSelectedNodes?: boolean;\n\t}) => void;\n\tsearchTerm?: string;\n\ttreeId?: string;\n\ttreeIndex: string;\n\tflattenedNodes: FlattenedNode[];\n\tselectedNodeIndexes: string[];\n\tfocusedNodeIndex?: string;\n\tonNodeBlur?: () => void;\n\ttreeHasFocus?: boolean;\n\tparent?: TreeNode | { nodes?: TreeNode[] };\n}\n\nconst handleSelect = ({\n\tevent,\n\tprops,\n\tfromFocus,\n}: {\n\tevent: React.SyntheticEvent;\n\tprops: ItemProps;\n\tfromFocus?: boolean;\n}) => {\n\tEventUtil.trap(event);\n\tif (isFunction(props.onSelect)) {\n\t\tprops.onSelect({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: props.node,\n\t\t\t\tselect: !props.node.selected,\n\t\t\t\ttreeIndex: props.treeIndex,\n\t\t\t},\n\t\t\tfromFocus,\n\t\t});\n\t}\n};\n\nconst findNextNode = (flattenedNodes: FlattenedNode[], node: TreeNode) => {\n\tconst nodes = flattenedNodes.map((flattenedNode) => flattenedNode.node);\n\tconst index = findIndex(nodes, { id: node.id });\n\treturn flattenedNodes[(index + 1) % flattenedNodes.length];\n};\n\nconst findPreviousNode = (flattenedNodes: FlattenedNode[], node: TreeNode) => {\n\tconst nodes = flattenedNodes.map((flattenedNode) => flattenedNode.node);\n\tlet index = findIndex(nodes, { id: node.id }) - 1;\n\tif (index < 0) {\n\t\tindex += flattenedNodes.length;\n\t}\n\treturn flattenedNodes[index];\n};\n\nconst handleKeyDownDown = (event: React.KeyboardEvent, props: ItemProps) => {\n\tif (props.focusedNodeIndex === props.treeIndex) {\n\t\tconst flattenedNode = findNextNode(props.flattenedNodes, props.node);\n\t\tprops.onSelect?.({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: flattenedNode.node,\n\t\t\t\tselect: true,\n\t\t\t\ttreeIndex: flattenedNode.treeIndex,\n\t\t\t},\n\t\t\tclearSelectedNodes: true,\n\t\t});\n\t}\n};\n\nconst handleKeyDownUp = (event: React.KeyboardEvent, props: ItemProps) => {\n\tif (props.focusedNodeIndex === props.treeIndex) {\n\t\tconst flattenedNode = findPreviousNode(props.flattenedNodes, props.node);\n\t\tprops.onSelect?.({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: flattenedNode.node,\n\t\t\t\tselect: true,\n\t\t\t\ttreeIndex: flattenedNode.treeIndex,\n\t\t\t},\n\t\t\tclearSelectedNodes: true,\n\t\t});\n\t}\n};\n\nconst handleKeyDownLeft = (event: React.KeyboardEvent, props: ItemProps) => {\n\tconst nodes = props.flattenedNodes.map((flattenedNode) => flattenedNode.node);\n\tconst parent = props.parent as TreeNode;\n\tconst index = findIndex(nodes, { id: parent?.id });\n\tif (index !== -1) {\n\t\t// `select: true` marks a move to the parent node, not an expand/collapse request.\n\t\t// Tree routes it to `onSelect` (or to the deprecated `onExpandClick`).\n\t\tprops.onExpand({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: parent,\n\t\t\t\tselect: true,\n\t\t\t\texpand: !parent.expanded,\n\t\t\t\ttreeIndex: props.flattenedNodes[index].treeIndex,\n\t\t\t},\n\t\t});\n\t}\n};\n\nconst handleKeyDownEnter = (event: React.KeyboardEvent, props: ItemProps) => {\n\thandleSelect({ event, props });\n};\n\nconst handleKeyDown = (event: React.KeyboardEvent, props: ItemProps) => {\n\tmapKeyEventCallbacks(event, {\n\t\tcallbacks: {\n\t\t\t[KEYS.DOWN]: {\n\t\t\t\tcallback: (evt: React.KeyboardEvent) => handleKeyDownDown(evt, props),\n\t\t\t},\n\t\t\t[KEYS.UP]: {\n\t\t\t\tcallback: (evt: React.KeyboardEvent) => handleKeyDownUp(evt, props),\n\t\t\t},\n\t\t\t[KEYS.LEFT]: {\n\t\t\t\tcallback: (evt: React.KeyboardEvent) => handleKeyDownLeft(evt, props),\n\t\t\t},\n\t\t\t[KEYS.ENTER]: {\n\t\t\t\tcallback: (evt: React.KeyboardEvent) => handleKeyDownEnter(evt, props),\n\t\t\t},\n\t\t},\n\t});\n};\n\nconst handleFocus = (event: React.FocusEvent, props: ItemProps) => {\n\tif (\n\t\t!props.treeHasFocus &&\n\t\t!props.focusedNodeIndex &&\n\t\tevent.target === event.currentTarget\n\t) {\n\t\thandleSelect({ event, props });\n\t}\n};\n\nconst getTabIndex = (props: ItemProps): number => {\n\tconst initialFocus =\n\t\tprops.selectedNodeIndexes.length === 0 &&\n\t\tprops.treeIndex === props.flattenedNodes[0]?.treeIndex;\n\treturn props.treeIndex === props.focusedNodeIndex || initialFocus ? 0 : -1;\n};\n\n/**\n * A Tree Item is a non-branching node in a hierarchical list.\n */\nconst Item: React.FC<ItemProps> = (props) => {\n\tconst isSelected = props.node.selected;\n\tconst isFocused = props.treeIndex === props.focusedNodeIndex;\n\n\treturn (\n\t\t<li\n\t\t\tid={`${props.treeId}-${props.node.id}`}\n\t\t\trole=\"treeitem\"\n\t\t\taria-level={props.level}\n\t\t\taria-selected={isSelected ? 'true' : 'false'}\n\t\t\ttabIndex={getTabIndex(props)}\n\t\t\tonKeyDown={(event) => handleKeyDown(event, props)}\n\t\t\tonFocus={(event) => handleFocus(event, props)}\n\t\t\tonBlur={props.onNodeBlur}\n\t\t\tref={(component) => {\n\t\t\t\tif (props.treeHasFocus && component && isFocused) {\n\t\t\t\t\tcomponent.focus();\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={classNames('slds-tree__item', {\n\t\t\t\t\t'slds-is-selected': isSelected,\n\t\t\t\t})}\n\t\t\t\tonClick={(event) => handleSelect({ event, props })}\n\t\t\t>\n\t\t\t\t<Button\n\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\tassistiveText={{ icon: '' }}\n\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\ticonName=\"chevronright\"\n\t\t\t\t\ticonSize=\"small\"\n\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t\tclassName=\"slds-m-right_small slds-is-disabled\"\n\t\t\t\t\tdisabled\n\t\t\t\t/>\n\t\t\t\t<span className=\"slds-size_1-of-1\">\n\t\t\t\t\t<Highlighter\n\t\t\t\t\t\tsearch={props.searchTerm}\n\t\t\t\t\t\tclassName=\"slds-tree__item-label slds-truncate\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{props.label}\n\t\t\t\t\t</Highlighter>\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t</li>\n\t);\n};\n\nItem.displayName = TREE_ITEM;\n\nexport default Item;\n"],"mappings":"oiBAoDA,IAAM,GAAgB,CACrB,QACA,QACA,eAKK,CACL,EAAA,QAAU,KAAK,CAAK,GACpB,EAAI,EAAA,QAAA,CAAW,EAAM,QAAQ,GAC5B,EAAM,SAAS,CACd,QACA,KAAM,CACL,KAAM,EAAM,KACZ,OAAQ,CAAC,EAAM,KAAK,SACpB,UAAW,EAAM,SAClB,EACA,WACD,CAAC,CAEH,EAEM,GAAgB,EAAiC,IAAmB,CACzE,IAAM,EAAQ,EAAe,IAAK,GAAkB,EAAc,IAAI,EAEtE,OAAO,IAAA,EADO,EAAA,QAAA,CAAU,EAAO,CAAE,GAAI,EAAK,EAAG,CACtB,EAAQ,GAAK,EAAe,OACpD,EAEM,GAAoB,EAAiC,IAAmB,CAC7E,IAAM,EAAQ,EAAe,IAAK,GAAkB,EAAc,IAAI,EAClE,GAAA,EAAQ,EAAA,QAAA,CAAU,EAAO,CAAE,GAAI,EAAK,EAAG,CAAC,EAAI,EAIhD,OAHI,EAAQ,IACX,GAAS,EAAe,QAElB,EAAe,EACvB,EAEM,GAAqB,EAA4B,IAAqB,CAC3E,GAAI,EAAM,mBAAqB,EAAM,UAAW,CAC/C,IAAM,EAAgB,EAAa,EAAM,eAAgB,EAAM,IAAI,EACnE,EAAM,WAAW,CAChB,QACA,KAAM,CACL,KAAM,EAAc,KACpB,OAAQ,GACR,UAAW,EAAc,SAC1B,EACA,mBAAoB,EACrB,CAAC,CACF,CACD,EAEM,GAAmB,EAA4B,IAAqB,CACzE,GAAI,EAAM,mBAA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ACzE,EAKM,EAA6B,GAAU,CAC5C,IAAM,EAAa,EAAM,KAAK,SACxB,EAAY,EAAM,YAAc,EAAM,iBAE5C,OACC,EAAA,EAAA,IAAA,CAAC,KAAD,CACC,GAAI,GAAG,EAAM,OAAO,GAAG,EAAM,KAAK,KAClC,KAAK,WACL,aAAY,EAAM,MAClB,gBAAe,EAAa,OAAS,QACrC,SAAU,EAAY,CAAK,EAC3B,UAAY,GAAU,EAAc,EAAO,CAAK,EAChD,QAAU,GAAU,EAAY,EAAO,CAAK,EAC5C,OAAQ,EAAM,WACd,IAAM,GAAc,CACf,EAAM,cAAgB,GAAa,GACtC,EAAU,MAAM,CAElB,EAEA,UAAA,EAAA,EAAA,KAAA,CAAC,MAAD,CACC,WAAA,EAAW,EAAA,QAAA,CAAW,kBAAmB,CACxC,mBAAoB,CACrB,CAAC,EACD,QAAU,GAAU,EAAa,CAAE,QAAO,OAAM,CAAC,EAJlD,SAAA,EAMC,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACC,SAAU,GACV,cAAe,CAAE,KAAM,EAAG,EAC1B,aAAa,UACb,SAAS,eACT,SAAS,QACT,QAAQ,OACR,UAAU,sCACV,SAAA,EACA,CAAA,GACD,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,mBACf,UAAA,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACC,OAAQ,EAAM,WACd,UAAU,sCAET,SAAA,EAAM,KACK,CAAA,CACR,CAAA,CACF,GACF,CAAA,CAEN,EAEA,EAAK,YAAc,EAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-branch.cjs","names":[],"sources":["../../../../../components/tree/private/render-branch.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, { ReactNode } from 'react';\nimport findIndex from 'lodash.findindex';\nimport isFunction from 'lodash.isfunction';\nimport classNames from 'classnames';\n\nimport Button from '../../button';\nimport Highlighter from '../../utilities/highlighter';\n\nimport EventUtil from '../../../utilities/event';\nimport KEYS from '../../../utilities/key-code';\nimport mapKeyEventCallbacks from '../../../utilities/key-callbacks';\nimport { TreeNode, FlattenedNode } from '../types';\n\nexport interface RenderBranchProps {\n\thtmlId: string | number;\n\tlabel?: ReactNode | string;\n\tlevel: number;\n\tnode: TreeNode;\n\tonExpand: (params: {\n\t\tevent: React.SyntheticEvent;\n\t\tdata: {\n\t\t\tnode: TreeNode;\n\t\t\texpand: boolean;\n\t\t\ttreeIndex: string;\n\t\t\tselect?: boolean;\n\t\t};\n\t}) => void;\n\tonSelect?: (params: {\n\t\tevent: React.SyntheticEvent;\n\t\tdata: {\n\t\t\tnode: TreeNode;\n\t\t\tselect: boolean;\n\t\t\ttreeIndex: string;\n\t\t};\n\t\tfromFocus?: boolean;\n\t\tclearSelectedNodes?: boolean;\n\t}) => void;\n\tsearchTerm?: string;\n\ttreeIndex: string;\n\tflattenedNodes: FlattenedNode[];\n\tselectedNodeIndexes: string[];\n\tfocusedNodeIndex?: string;\n\tonNodeBlur?: () => void;\n\ttreeHasFocus?: boolean;\n\tparent?: TreeNode | { nodes?: TreeNode[] };\n\tgetNodes?: (node: { nodes?: TreeNode[] }) => TreeNode[] | undefined;\n}\n\nconst handleExpand = (event: React.SyntheticEvent, props: RenderBranchProps) => {\n\tEventUtil.trap(event);\n\tif (isFunction(props.onExpand)) {\n\t\tprops.onExpand({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: props.node,\n\t\t\t\texpand: !props.node.expanded,\n\t\t\t\ttreeIndex: props.treeIndex,\n\t\t\t},\n\t\t});\n\t}\n};\n\nconst handleSelect = ({\n\tevent,\n\tprops,\n\tfromFocus,\n}: {\n\tevent: React.SyntheticEvent;\n\tprops: RenderBranchProps;\n\tfromFocus?: boolean;\n}) => {\n\tEventUtil.trap(event);\n\tif (isFunction(props.onSelect)) {\n\t\tprops.onSelect({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: props.node,\n\t\t\t\tselect: !props.node.selected,\n\t\t\t\ttreeIndex: props.treeIndex,\n\t\t\t},\n\t\t\tfromFocus,\n\t\t});\n\t}\n};\n\nconst findNextNode = (flattenedNodes: FlattenedNode[], node: TreeNode) => {\n\tconst nodes = flattenedNodes.map((flattenedNode) => flattenedNode.node);\n\tconst index = findIndex(nodes, { id: node.id });\n\treturn flattenedNodes[(index + 1) % flattenedNodes.length];\n};\n\nconst findPreviousNode = (flattenedNodes: FlattenedNode[], node: TreeNode) => {\n\tconst nodes = flattenedNodes.map((flattenedNode) => flattenedNode.node);\n\tlet index = findIndex(nodes, { id: node.id }) - 1;\n\tif (index < 0) {\n\t\tindex += flattenedNodes.length;\n\t}\n\treturn flattenedNodes[index];\n};\n\nconst handleKeyDownDown = (event: React.KeyboardEvent, props: RenderBranchProps) => {\n\tif (props.focusedNodeIndex === props.treeIndex) {\n\t\tconst flattenedNode = findNextNode(props.flattenedNodes, props.node);\n\t\tprops.onSelect?.({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: flattenedNode.node,\n\t\t\t\tselect: true,\n\t\t\t\ttreeIndex: flattenedNode.treeIndex,\n\t\t\t},\n\t\t\tclearSelectedNodes: true,\n\t\t});\n\t}\n};\n\nconst handleKeyDownUp = (event: React.KeyboardEvent, props: RenderBranchProps) => {\n\tif (props.focusedNodeIndex === props.treeIndex) {\n\t\tconst flattenedNode = findPreviousNode(props.flattenedNodes, props.node);\n\t\tprops.onSelect?.({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: flattenedNode.node,\n\t\t\t\tselect: true,\n\t\t\t\ttreeIndex: flattenedNode.treeIndex,\n\t\t\t},\n\t\t\tclearSelectedNodes: true,\n\t\t});\n\t}\n};\n\nconst handleKeyDownRight = (event: React.KeyboardEvent, props: RenderBranchProps) => {\n\tif (props.node.expanded) {\n\t\tconst childNodes = props.getNodes?.(props.node);\n\t\tif (childNodes && childNodes.length > 0) {\n\t\t\thandleKeyDownDown(event, props);\n\t\t}\n\t} else {\n\t\thandleExpand(event, props);\n\t}\n};\n\nconst handleKeyDownLeft = (event: React.KeyboardEvent, props: RenderBranchProps) => {\n\tif (props.node.expanded) {\n\t\thandleExpand(event, props);\n\t} else {\n\t\tconst nodes = props.flattenedNodes.map((flattenedNode) => flattenedNode.node);\n\t\tconst parent = props.parent as TreeNode;\n\t\tconst index = findIndex(nodes, { id: parent?.id });\n\t\tif (index !== -1) {\n\t\t\tprops.onExpand({\n\t\t\t\tevent,\n\t\t\t\tdata: {\n\t\t\t\t\tnode: parent,\n\t\t\t\t\tselect: true,\n\t\t\t\t\texpand: !parent.expanded,\n\t\t\t\t\ttreeIndex: props.flattenedNodes[index].treeIndex,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n};\n\nconst handleKeyDownEnter = (event: React.KeyboardEvent, props: RenderBranchProps) => {\n\thandleSelect({ event, props });\n};\n\nconst handleKeyDown = (event: React.KeyboardEvent, props: RenderBranchProps) => {\n\tmapKeyEventCallbacks(event, {\n\t\tcallbacks: {\n\t\t\t[KEYS.DOWN]: { callback: (evt: React.KeyboardEvent) => handleKeyDownDown(evt, props) },\n\t\t\t[KEYS.UP]: { callback: (evt: React.KeyboardEvent) => handleKeyDownUp(evt, props) },\n\t\t\t[KEYS.RIGHT]: { callback: (evt: React.KeyboardEvent) => handleKeyDownRight(evt, props) },\n\t\t\t[KEYS.LEFT]: { callback: (evt: React.KeyboardEvent) => handleKeyDownLeft(evt, props) },\n\t\t\t[KEYS.ENTER]: { callback: (evt: React.KeyboardEvent) => handleKeyDownEnter(evt, props) },\n\t\t},\n\t});\n};\n\nconst handleFocus = (event: React.FocusEvent, props: RenderBranchProps) => {\n\tif (\n\t\t!props.treeHasFocus &&\n\t\t!props.focusedNodeIndex &&\n\t\tevent.target === event.currentTarget\n\t) {\n\t\thandleSelect({ event, props, fromFocus: true });\n\t}\n};\n\nconst getTabIndex = (props: RenderBranchProps): number => {\n\tconst initialFocus =\n\t\tprops.selectedNodeIndexes.length === 0 &&\n\t\tprops.treeIndex === props.flattenedNodes[0]?.treeIndex;\n\treturn props.treeIndex === props.focusedNodeIndex || initialFocus ? 0 : -1;\n};\n\n/**\n * Renders a branch node in the tree.\n */\nconst RenderBranch = (children: ReactNode, props: RenderBranchProps): React.ReactElement => {\n\tconst isExpanded = props.node.expanded;\n\tconst isSelected = props.node.selected;\n\tconst isFocused = props.treeIndex === props.focusedNodeIndex;\n\tconst isLoading = props.node.loading;\n\n\tconst loader = (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tdisplay: 'block',\n\t\t\t\tpaddingLeft: `${1.5 * props.level + 1.5}rem`,\n\t\t\t\tmarginTop: '.5rem',\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tborderRadius: '15rem',\n\t\t\t\t\tdisplay: 'block',\n\t\t\t\t\tmarginBottom: '.75rem',\n\t\t\t\t\theight: '.5rem',\n\t\t\t\t\tbackgroundColor: 'rgb(224, 229, 238)',\n\t\t\t\t\twidth: '40%',\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tborderRadius: '15rem',\n\t\t\t\t\tdisplay: 'block',\n\t\t\t\t\tmarginBottom: '.75rem',\n\t\t\t\t\theight: '.5rem',\n\t\t\t\t\tbackgroundColor: 'rgb(224, 229, 238)',\n\t\t\t\t\twidth: '80%',\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tborderRadius: '15rem',\n\t\t\t\t\tdisplay: 'block',\n\t\t\t\t\tmarginBottom: '.75rem',\n\t\t\t\t\theight: '.5rem',\n\t\t\t\t\tbackgroundColor: 'rgb(224, 229, 238)',\n\t\t\t\t\twidth: '60%',\n\t\t\t\t}}\n\t\t\t/>\n\t\t</div>\n\t);\n\n\tconst label =\n\t\tprops.node.assistiveText ||\n\t\t(typeof props.node.label === 'string' ? props.node.label : null);\n\n\t// aria-level and aria-expanded are valid for elements with role=\"treeitem\"\n\tconst ariaProps = {\n\t\t'aria-level': props.level,\n\t\t'aria-expanded': isExpanded ? 'true' as const : 'false' as const,\n\t\t'aria-label': props.node.nodes && props.node.nodes.length > 0 ? label : undefined,\n\t};\n\n\treturn (\n\t\t// @ts-expect-error - aria-level is valid for treeitem role but not in React types\n\t\t<li\n\t\t\tid={String(props.htmlId)}\n\t\t\trole=\"treeitem\"\n\t\t\t{...ariaProps}\n\t\t\ttabIndex={getTabIndex(props)}\n\t\t\tonKeyDown={(event) => handleKeyDown(event, props)}\n\t\t\tonFocus={(event) => handleFocus(event, props)}\n\t\t\tonBlur={props.onNodeBlur}\n\t\t\tref={(component) => {\n\t\t\t\tif (props.treeHasFocus && component && isFocused) {\n\t\t\t\t\tcomponent.focus();\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={classNames('slds-tree__item', {\n\t\t\t\t\t'slds-is-selected': isSelected,\n\t\t\t\t})}\n\t\t\t\tonClick={(event) => handleSelect({ event, props })}\n\t\t\t>\n\t\t\t\t<Button\n\t\t\t\t\tassistiveText={{ icon: 'Expand Tree Branch' }}\n\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\ticonName=\"chevronright\"\n\t\t\t\t\ticonSize=\"small\"\n\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t\tclassName=\"slds-m-right_small\"\n\t\t\t\t\tonClick={(event) => handleExpand(event, props)}\n\t\t\t\t\ttabIndex={-1}\n\t\t\t\t/>\n\t\t\t\t<span className=\"slds-size_1-of-1\" id={`${props.htmlId}__label`}>\n\t\t\t\t\t<Highlighter\n\t\t\t\t\t\tsearch={props.searchTerm}\n\t\t\t\t\t\tclassName=\"slds-tree__item-label slds-truncate\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{props.label}\n\t\t\t\t\t</Highlighter>\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t\t{isLoading ? loader : null}\n\t\t\t<ul\n\t\t\t\tclassName={classNames({\n\t\t\t\t\t'slds-is-expanded': isExpanded,\n\t\t\t\t\t'slds-is-collapsed': !isExpanded,\n\t\t\t\t})}\n\t\t\t\trole=\"group\"\n\t\t\t\taria-labelledby={`${props.htmlId}__label`}\n\t\t\t>\n\t\t\t\t{isExpanded && !isLoading ? children : null}\n\t\t\t</ul>\n\t\t</li>\n\t);\n};\n\nRenderBranch.displayName = 'Branch';\n\nexport default RenderBranch;\n\n"],"mappings":"sfAmDA,IAAM,GAAgB,EAA6B,IAA6B,CAC/E,EAAA,QAAU,KAAK,CAAK,GACpB,EAAI,EAAA,QAAA,CAAW,EAAM,QAAQ,GAC5B,EAAM,SAAS,CACd,QACA,KAAM,CACL,KAAM,EAAM,KACZ,OAAQ,CAAC,EAAM,KAAK,SACpB,UAAW,EAAM,SAClB,CACD,CAAC,CAEH,EAEM,GAAgB,CACrB,QACA,QACA,eAKK,CACL,EAAA,QAAU,KAAK,CAAK,GACpB,EAAI,EAAA,QAAA,CAAW,EAAM,QAAQ,GAC5B,EAAM,SAAS,CACd,QACA,KAAM,CACL,KAAM,EAAM,KACZ,OAAQ,CAAC,EAAM,KAAK,SACpB,UAAW,EAAM,SAClB,EACA,WACD,CAAC,CAEH,EAEM,GAAgB,EAAiC,IAAmB,CACzE,IAAM,EAAQ,EAAe,IAAK,GAAkB,EAAc,IAAI,EAEtE,OAAO,IAAA,EADO,EAAA,QAAA,CAAU,EAAO,CAAE,GAAI,EAAK,EAAG,CACtB,EAAQ,GAAK,EAAe,OACpD,EAEM,GAAoB,EAAiC,IAAmB,CAC7E,IAAM,EAAQ,EAAe,IAAK,GAAkB,EAAc,IAAI,EAClE,GAAA,EAAQ,EAAA,QAAA,CAAU,EAAO,CAAE,GAAI,EAAK,EAAG,CAAC,EAAI,EAIhD,OAHI,EAAQ,IACX,GAAS,EAAe,QAElB,EAAe,EACvB,EAEM,GAAqB,EAA4B,IAA6B,CACnF,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CAAC,EACD,KAAK,QACL,kBAAiB,GAAG,EAAM,OAAO,SAEhC,SAAA,GAAc,CAAC,EAAY,EAAW,IACpC,CAAA,CACD,GAEN,EAEA,EAAa,YAAc"}
|
|
1
|
+
{"version":3,"file":"render-branch.cjs","names":[],"sources":["../../../../../components/tree/private/render-branch.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, { ReactNode } from 'react';\nimport findIndex from 'lodash.findindex';\nimport isFunction from 'lodash.isfunction';\nimport classNames from 'classnames';\n\nimport Button from '../../button';\nimport Highlighter from '../../utilities/highlighter';\n\nimport EventUtil from '../../../utilities/event';\nimport KEYS from '../../../utilities/key-code';\nimport mapKeyEventCallbacks from '../../../utilities/key-callbacks';\nimport { TreeNode, FlattenedNode } from '../types';\n\nexport interface RenderBranchProps {\n\thtmlId: string | number;\n\tlabel?: ReactNode | string;\n\tlevel: number;\n\tnode: TreeNode;\n\tonExpand: (params: {\n\t\tevent: React.SyntheticEvent;\n\t\tdata: {\n\t\t\tnode: TreeNode;\n\t\t\texpand: boolean;\n\t\t\ttreeIndex: string;\n\t\t\tselect?: boolean;\n\t\t};\n\t}) => void;\n\tonSelect?: (params: {\n\t\tevent: React.SyntheticEvent;\n\t\tdata: {\n\t\t\tnode: TreeNode;\n\t\t\tselect: boolean;\n\t\t\ttreeIndex: string;\n\t\t};\n\t\tfromFocus?: boolean;\n\t\tclearSelectedNodes?: boolean;\n\t}) => void;\n\tsearchTerm?: string;\n\ttreeIndex: string;\n\tflattenedNodes: FlattenedNode[];\n\tselectedNodeIndexes: string[];\n\tfocusedNodeIndex?: string;\n\tonNodeBlur?: () => void;\n\ttreeHasFocus?: boolean;\n\tparent?: TreeNode | { nodes?: TreeNode[] };\n\tgetNodes?: (node: { nodes?: TreeNode[] }) => TreeNode[] | undefined;\n}\n\nconst handleExpand = (\n\tevent: React.SyntheticEvent,\n\tprops: RenderBranchProps\n) => {\n\tEventUtil.trap(event);\n\tif (isFunction(props.onExpand)) {\n\t\tprops.onExpand({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: props.node,\n\t\t\t\texpand: !props.node.expanded,\n\t\t\t\ttreeIndex: props.treeIndex,\n\t\t\t},\n\t\t});\n\t}\n};\n\nconst handleSelect = ({\n\tevent,\n\tprops,\n\tfromFocus,\n}: {\n\tevent: React.SyntheticEvent;\n\tprops: RenderBranchProps;\n\tfromFocus?: boolean;\n}) => {\n\tEventUtil.trap(event);\n\tif (isFunction(props.onSelect)) {\n\t\tprops.onSelect({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: props.node,\n\t\t\t\tselect: !props.node.selected,\n\t\t\t\ttreeIndex: props.treeIndex,\n\t\t\t},\n\t\t\tfromFocus,\n\t\t});\n\t}\n};\n\nconst findNextNode = (flattenedNodes: FlattenedNode[], node: TreeNode) => {\n\tconst nodes = flattenedNodes.map((flattenedNode) => flattenedNode.node);\n\tconst index = findIndex(nodes, { id: node.id });\n\treturn flattenedNodes[(index + 1) % flattenedNodes.length];\n};\n\nconst findPreviousNode = (flattenedNodes: FlattenedNode[], node: TreeNode) => {\n\tconst nodes = flattenedNodes.map((flattenedNode) => flattenedNode.node);\n\tlet index = findIndex(nodes, { id: node.id }) - 1;\n\tif (index < 0) {\n\t\tindex += flattenedNodes.length;\n\t}\n\treturn flattenedNodes[index];\n};\n\nconst handleKeyDownDown = (\n\tevent: React.KeyboardEvent,\n\tprops: RenderBranchProps\n) => {\n\tif (props.focusedNodeIndex === props.treeIndex) {\n\t\tconst flattenedNode = findNextNode(props.flattenedNodes, props.node);\n\t\tprops.onSelect?.({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: flattenedNode.node,\n\t\t\t\tselect: true,\n\t\t\t\ttreeIndex: flattenedNode.treeIndex,\n\t\t\t},\n\t\t\tclearSelectedNodes: true,\n\t\t});\n\t}\n};\n\nconst handleKeyDownUp = (\n\tevent: React.KeyboardEvent,\n\tprops: RenderBranchProps\n) => {\n\tif (props.focusedNodeIndex === props.treeIndex) {\n\t\tconst flattenedNode = findPreviousNode(props.flattenedNodes, props.node);\n\t\tprops.onSelect?.({\n\t\t\tevent,\n\t\t\tdata: {\n\t\t\t\tnode: flattenedNode.node,\n\t\t\t\tselect: true,\n\t\t\t\ttreeIndex: flattenedNode.treeIndex,\n\t\t\t},\n\t\t\tclearSelectedNodes: true,\n\t\t});\n\t}\n};\n\nconst handleKeyDownRight = (\n\tevent: React.KeyboardEvent,\n\tprops: RenderBranchProps\n) => {\n\tif (props.node.expanded) {\n\t\tconst childNodes = props.getNodes?.(props.node);\n\t\tif (childNodes && childNodes.length > 0) {\n\t\t\thandleKeyDownDown(event, props);\n\t\t}\n\t} else {\n\t\thandleExpand(event, props);\n\t}\n};\n\nconst handleKeyDownLeft = (\n\tevent: React.KeyboardEvent,\n\tprops: RenderBranchProps\n) => {\n\tif (props.node.expanded) {\n\t\thandleExpand(event, props);\n\t} else {\n\t\tconst nodes = props.flattenedNodes.map(\n\t\t\t(flattenedNode) => flattenedNode.node\n\t\t);\n\t\tconst parent = props.parent as TreeNode;\n\t\tconst index = findIndex(nodes, { id: parent?.id });\n\t\tif (index !== -1) {\n\t\t\t// `select: true` marks a move to the parent node, not an expand/collapse request.\n\t\t\t// Tree routes it to `onSelect` (or to the deprecated `onExpandClick`).\n\t\t\tprops.onExpand({\n\t\t\t\tevent,\n\t\t\t\tdata: {\n\t\t\t\t\tnode: parent,\n\t\t\t\t\tselect: true,\n\t\t\t\t\texpand: !parent.expanded,\n\t\t\t\t\ttreeIndex: props.flattenedNodes[index].treeIndex,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n};\n\nconst handleKeyDownEnter = (\n\tevent: React.KeyboardEvent,\n\tprops: RenderBranchProps\n) => {\n\thandleSelect({ event, props });\n};\n\nconst handleKeyDown = (\n\tevent: React.KeyboardEvent,\n\tprops: RenderBranchProps\n) => {\n\tmapKeyEventCallbacks(event, {\n\t\tcallbacks: {\n\t\t\t[KEYS.DOWN]: {\n\t\t\t\tcallback: (evt: React.KeyboardEvent) => handleKeyDownDown(evt, props),\n\t\t\t},\n\t\t\t[KEYS.UP]: {\n\t\t\t\tcallback: (evt: React.KeyboardEvent) => handleKeyDownUp(evt, props),\n\t\t\t},\n\t\t\t[KEYS.RIGHT]: {\n\t\t\t\tcallback: (evt: React.KeyboardEvent) => handleKeyDownRight(evt, props),\n\t\t\t},\n\t\t\t[KEYS.LEFT]: {\n\t\t\t\tcallback: (evt: React.KeyboardEvent) => handleKeyDownLeft(evt, props),\n\t\t\t},\n\t\t\t[KEYS.ENTER]: {\n\t\t\t\tcallback: (evt: React.KeyboardEvent) => handleKeyDownEnter(evt, props),\n\t\t\t},\n\t\t},\n\t});\n};\n\nconst handleFocus = (event: React.FocusEvent, props: RenderBranchProps) => {\n\tif (\n\t\t!props.treeHasFocus &&\n\t\t!props.focusedNodeIndex &&\n\t\tevent.target === event.currentTarget\n\t) {\n\t\thandleSelect({ event, props, fromFocus: true });\n\t}\n};\n\nconst getTabIndex = (props: RenderBranchProps): number => {\n\tconst initialFocus =\n\t\tprops.selectedNodeIndexes.length === 0 &&\n\t\tprops.treeIndex === props.flattenedNodes[0]?.treeIndex;\n\treturn props.treeIndex === props.focusedNodeIndex || initialFocus ? 0 : -1;\n};\n\n/**\n * Renders a branch node in the tree.\n */\nconst RenderBranch = (\n\tchildren: ReactNode,\n\tprops: RenderBranchProps\n): React.ReactElement => {\n\tconst isExpanded = props.node.expanded;\n\tconst isSelected = props.node.selected;\n\tconst isFocused = props.treeIndex === props.focusedNodeIndex;\n\tconst isLoading = props.node.loading;\n\n\tconst loader = (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tdisplay: 'block',\n\t\t\t\tpaddingLeft: `${1.5 * props.level + 1.5}rem`,\n\t\t\t\tmarginTop: '.5rem',\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tborderRadius: '15rem',\n\t\t\t\t\tdisplay: 'block',\n\t\t\t\t\tmarginBottom: '.75rem',\n\t\t\t\t\theight: '.5rem',\n\t\t\t\t\tbackgroundColor: 'rgb(224, 229, 238)',\n\t\t\t\t\twidth: '40%',\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tborderRadius: '15rem',\n\t\t\t\t\tdisplay: 'block',\n\t\t\t\t\tmarginBottom: '.75rem',\n\t\t\t\t\theight: '.5rem',\n\t\t\t\t\tbackgroundColor: 'rgb(224, 229, 238)',\n\t\t\t\t\twidth: '80%',\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tborderRadius: '15rem',\n\t\t\t\t\tdisplay: 'block',\n\t\t\t\t\tmarginBottom: '.75rem',\n\t\t\t\t\theight: '.5rem',\n\t\t\t\t\tbackgroundColor: 'rgb(224, 229, 238)',\n\t\t\t\t\twidth: '60%',\n\t\t\t\t}}\n\t\t\t/>\n\t\t</div>\n\t);\n\n\tconst label =\n\t\tprops.node.assistiveText ||\n\t\t(typeof props.node.label === 'string' ? props.node.label : null);\n\n\t// aria-level and aria-expanded are valid for elements with role=\"treeitem\"\n\tconst ariaProps = {\n\t\t'aria-level': props.level,\n\t\t'aria-expanded': isExpanded ? ('true' as const) : ('false' as const),\n\t\t'aria-label':\n\t\t\tprops.node.nodes && props.node.nodes.length > 0 ? label : undefined,\n\t};\n\n\treturn (\n\t\t// @ts-expect-error - aria-level is valid for treeitem role but not in React types\n\t\t<li\n\t\t\tid={String(props.htmlId)}\n\t\t\trole=\"treeitem\"\n\t\t\t{...ariaProps}\n\t\t\ttabIndex={getTabIndex(props)}\n\t\t\tonKeyDown={(event) => handleKeyDown(event, props)}\n\t\t\tonFocus={(event) => handleFocus(event, props)}\n\t\t\tonBlur={props.onNodeBlur}\n\t\t\tref={(component) => {\n\t\t\t\tif (props.treeHasFocus && component && isFocused) {\n\t\t\t\t\tcomponent.focus();\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={classNames('slds-tree__item', {\n\t\t\t\t\t'slds-is-selected': isSelected,\n\t\t\t\t})}\n\t\t\t\tonClick={(event) => handleSelect({ event, props })}\n\t\t\t>\n\t\t\t\t<Button\n\t\t\t\t\tassistiveText={{ icon: 'Expand Tree Branch' }}\n\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\ticonName=\"chevronright\"\n\t\t\t\t\ticonSize=\"small\"\n\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t\tclassName=\"slds-m-right_small\"\n\t\t\t\t\tonClick={(event) => handleExpand(event, props)}\n\t\t\t\t\ttabIndex={-1}\n\t\t\t\t/>\n\t\t\t\t<span className=\"slds-size_1-of-1\" id={`${props.htmlId}__label`}>\n\t\t\t\t\t<Highlighter\n\t\t\t\t\t\tsearch={props.searchTerm}\n\t\t\t\t\t\tclassName=\"slds-tree__item-label slds-truncate\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{props.label}\n\t\t\t\t\t</Highlighter>\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t\t{isLoading ? loader : null}\n\t\t\t<ul\n\t\t\t\tclassName={classNames({\n\t\t\t\t\t'slds-is-expanded': isExpanded,\n\t\t\t\t\t'slds-is-collapsed': !isExpanded,\n\t\t\t\t})}\n\t\t\t\trole=\"group\"\n\t\t\t\taria-labelledby={`${props.htmlId}__label`}\n\t\t\t>\n\t\t\t\t{isExpanded && !isLoading ? children : null}\n\t\t\t</ul>\n\t\t</li>\n\t);\n};\n\nRenderBranch.displayName = 'Branch';\n\nexport default RenderBranch;\n"],"mappings":"sfAmDA,IAAM,GACL,EACA,IACI,CACJ,EAAA,QAAU,KAAK,CAAK,GACpB,EAAI,EAAA,QAAA,CAAW,EAAM,QAAQ,GAC5B,EAAM,SAAS,CACd,QACA,KAAM,CACL,KAAM,EAAM,KACZ,OAAQ,CAAC,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AAD,CACC,WAAA,EAAW,EAAA,QAAA,CAAW,kBAAmB,CACxC,mBAAoB,CACrB,CAAC,EACD,QAAU,GAAU,EAAa,CAAE,QAAO,OAAM,CAAC,EAJlD,SAAA,EAMC,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACC,cAAe,CAAE,KAAM,oBAAqB,EAC5C,aAAa,UACb,SAAS,eACT,SAAS,QACT,QAAQ,OACR,UAAU,qBACV,QAAU,GAAU,EAAa,EAAO,CAAK,EAC7C,SAAU,EACV,CAAA,GACD,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,mBAAmB,GAAI,GAAG,EAAM,OAAO,SACtD,UAAA,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACC,OAAQ,EAAM,WACd,UAAU,sCAET,SAAA,EAAM,KACK,CAAA,CACR,CAAA,CACF,IACJ,EAAY,EAAS,MACtB,EAAA,EAAA,IAAA,CAAC,KAAD,CACC,WAAA,EAAW,EAAA,QAAA,CAAW,CACrB,mBAAoB,EACpB,oBAAqB,CAAC,CACvB,CAAC,EACD,KAAK,QACL,kBAAiB,GAAG,EAAM,OAAO,SAEhC,SAAA,GAAc,CAAC,EAAY,EAAW,IACpC,CAAA,CACD,GAEN,EAEA,EAAa,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs");let t=require("react");t=e.__toESM(t,1);let n=require("classnames");n=e.__toESM(n,1);let r=require("react/jsx-runtime"),i=require("lodash.isfunction");i=e.__toESM(i,1);var a=(e,t)=>{let n=e.
|
|
1
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs");let t=require("react");t=e.__toESM(t,1);let n=require("classnames");n=e.__toESM(n,1);let r=require("react/jsx-runtime"),i=require("lodash.isfunction");i=e.__toESM(i,1);var a=(e,t)=>{let n=e.currentTarget,r=n.scrollHeight-n.clientHeight,a=r>0?Math.min(Math.max(n.scrollTop/r,0),1):0;(0,i.default)(t.onScroll)&&t.onScroll(e,{ratio:a,percentage:a*100})},o=(e,t)=>(0,r.jsx)(`ul`,{"aria-labelledby":`${t.htmlId}__heading`,className:(0,n.default)(`slds-tree`,t.initalClassName),onScroll:e=>a(e,t),role:`tree`,style:t.initialStyle,children:e});o.displayName=`TreeInitialNode`,exports.default=o;
|
|
2
2
|
//# sourceMappingURL=render-initial-branch.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-initial-branch.cjs","names":[],"sources":["../../../../../components/tree/private/render-initial-branch.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, { ReactNode } from 'react';\nimport classNames from 'classnames';\nimport isFunction from 'lodash.isfunction';\n\nexport interface RenderInitialBranchProps {\n\thtmlId: string | number;\n\tinitalClassName?: string | string[] | Record<string, boolean>;\n\tinitialStyle?: React.CSSProperties;\n\tonScroll?: (\n\t\tevent: React.UIEvent<HTMLUListElement>,\n\t\tdata:
|
|
1
|
+
{"version":3,"file":"render-initial-branch.cjs","names":[],"sources":["../../../../../components/tree/private/render-initial-branch.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, { ReactNode } from 'react';\nimport classNames from 'classnames';\nimport isFunction from 'lodash.isfunction';\n\nimport { TreeScrollData } from '../types';\n\nexport interface RenderInitialBranchProps {\n\thtmlId: string | number;\n\tinitalClassName?: string | string[] | Record<string, boolean>;\n\tinitialStyle?: React.CSSProperties;\n\tonScroll?: (\n\t\tevent: React.UIEvent<HTMLUListElement>,\n\t\tdata: TreeScrollData\n\t) => void;\n}\n\nconst handleScroll = (\n\tevent: React.UIEvent<HTMLUListElement>,\n\tprops: RenderInitialBranchProps\n) => {\n\tconst target = event.currentTarget;\n\tconst maxScrollTop = target.scrollHeight - target.clientHeight;\n\t// 0 when not scrollable, otherwise clamped to 0–1 (overscroll can exceed the range)\n\tconst ratio =\n\t\tmaxScrollTop > 0\n\t\t\t? Math.min(Math.max(target.scrollTop / maxScrollTop, 0), 1)\n\t\t\t: 0;\n\n\tif (isFunction(props.onScroll)) {\n\t\tprops.onScroll(event, { ratio, percentage: ratio * 100 });\n\t}\n};\n\nconst RenderInitialBranch = (\n\tchildren: ReactNode,\n\tprops: RenderInitialBranchProps\n): React.ReactElement => (\n\t<ul\n\t\taria-labelledby={`${props.htmlId}__heading`}\n\t\tclassName={classNames('slds-tree', props.initalClassName)}\n\t\tonScroll={(event) => handleScroll(event, props)}\n\t\trole=\"tree\"\n\t\tstyle={props.initialStyle}\n\t>\n\t\t{children}\n\t</ul>\n);\n\nRenderInitialBranch.displayName = 'TreeInitialNode';\n\nexport default RenderInitialBranch;\n"],"mappings":"mOAmBA,IAAM,GACL,EACA,IACI,CACJ,IAAM,EAAS,EAAM,cACf,EAAe,EAAO,aAAe,EAAO,aAE5C,EACL,EAAe,EACZ,KAAK,IAAI,KAAK,IAAI,EAAO,UAAY,EAAc,CAAC,EAAG,CAAC,EACxD,GAEJ,EAAI,EAAA,QAAA,CAAW,EAAM,QAAQ,GAC5B,EAAM,SAAS,EAAO,CAAE,QAAO,WAAY,EAAQ,GAAI,CAAC,CAE1D,EAEM,GACL,EACA,KAEA,EAAA,EAAA,IAAA,CAAC,KAAD,CACC,kBAAiB,GAAG,EAAM,OAAO,WACjC,WAAA,EAAW,EAAA,QAAA,CAAW,YAAa,EAAM,eAAe,EACxD,SAAW,GAAU,EAAa,EAAO,CAAK,EAC9C,KAAK,OACL,MAAO,EAAM,aAEZ,UACE,CAAA,EAGL,EAAoB,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("./private/branch.cjs"),r=require("./check-props.cjs");let
|
|
1
|
+
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("./private/branch.cjs"),r=require("./check-props.cjs"),i=require("./component.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=(e,t,n=``,r=!0)=>{if(!e.nodes)return[{node:e,treeIndex:n}];let i=[{node:e,treeIndex:n}];if(e.expanded)for(let a=0;a<e.nodes.length;a+=1){let o=r?e.nodes[a]:t(e)?.[a];o&&(i=i.concat(c(o,t,n?`${n}-${a}`:`${a}`,!1)))}return i},l=e=>e.nodes,u=({assistiveText:e,className:u,listClassName:d,getNodes:f=l,heading:p,id:m,labels:h,nodes:g,onSelect:_,onClick:v,onRequestToggle:y,onExpandClick:b,onScroll:x,searchTerm:S,listStyle:C})=>{let w=e?.heading??e?.label,T=h?.heading??p,E=(0,a.useRef)(!1),D=(0,a.useCallback)(()=>c({nodes:f({nodes:g}),expanded:!0},f).slice(1),[f,g]),[O,k]=(0,a.useState)(D),[A,j]=(0,a.useState)(()=>{let e=D().find(e=>e.node.selected);return e?[e.treeIndex]:[]}),[M,N]=(0,a.useState)(()=>D().find(e=>e.node.selected)?.treeIndex);(0,a.useEffect)(()=>{r.default(t.TREE,{assistiveText:e,className:u,listClassName:d,getNodes:f,heading:p,id:m,labels:h,nodes:g,onSelect:_,onClick:v,onRequestToggle:y,onExpandClick:b,onScroll:x,searchTerm:S,listStyle:C},i.default)},[]),(0,a.useEffect)(()=>{k(D())},[D,g]);let P=(0,a.useCallback)(({event:e,data:t,clearSelectedNodes:n,fromFocus:r})=>{n&&O.forEach(e=>{e.node.selected&&(e.node.selected=!1)}),r||(_?_(e,{node:t.node,isSelected:t.select}):v&&v(e,t));let i;i=t.select?[...A,t.treeIndex]:A.filter(e=>e!==t.treeIndex),E.current=!0,N(t.treeIndex),j(i)},[O,_,v,A]),F=(0,a.useCallback)(()=>{E.current=!1},[]),I=(0,a.useCallback)(({event:e,data:t})=>{if(t.select){!y&&b?(E.current=!0,b(e,t),N(t.treeIndex)):P({event:e,data:{node:t.node,select:!0,treeIndex:t.treeIndex},clearSelectedNodes:!0});return}E.current=!0,y?y(e,{node:t.node,isExpanded:t.expand}):b&&b(e,t)},[P,y,b]),L=w||T;return(0,s.jsxs)(`div`,{id:m,className:(0,o.default)(`slds-tree_container`,u),children:[(0,s.jsx)(`h4`,{className:(0,o.default)(`slds-tree__group-header`,{"slds-assistive-text":!!w}),id:`${m}__heading`,children:L}),(0,s.jsx)(n.default,{getNodes:f,initalClassName:d,htmlId:m,initialStyle:C,level:0,node:{nodes:g},flattenedNodes:O,selectedNodeIndexes:A,focusedNodeIndex:M,treeHasFocus:E.current,onNodeBlur:F,onSelect:P,onExpand:I,onScroll:x,searchTerm:S,treeId:m})]})};u.displayName=t.TREE,exports.default=u;
|
|
2
2
|
//# sourceMappingURL=tree.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.cjs","names":[],"sources":["../../../../components/tree/tree.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, { useState, useCallback, useEffect, useRef } from 'react';\nimport classNames from 'classnames';\n// Using native Array.find instead of lodash for better TypeScript support\n\n// Child components\nimport Branch from './private/branch';\n\n// Similar to React's PropTypes check\nimport checkProps from './check-props';\n\n// Constants\nimport { TREE } from '../../utilities/constants';\n\nimport {\n\tTreeNode,\n\tFlattenedNode,\n\tTreeAssistiveText,\n\tTreeSelectData,\n\tTreeExpandData,\n\tTreeScrollData,\n} from './types';\n\nexport interface TreeProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: TreeAssistiveText;\n\t/** Class names for the container element */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Class names for the top-level ul element */\n\tlistClassName?: string | string[] | Record<string, boolean>;\n\t/** Function to get child nodes from a parent node */\n\tgetNodes?: (node: { nodes?: TreeNode[] }) => TreeNode[] | undefined;\n\t/** Tree heading that describes its contents */\n\theading?: ReactNode | string;\n\t/** HTML id of the tree container (required) */\n\tid: string;\n\t/** Array of tree nodes */\n\tnodes: TreeNode[];\n\t/** Callback when an item or branch is selected */\n\tonClick: (event: React.SyntheticEvent, data: TreeSelectData) => void;\n\t/** Callback when expand/collapse icon is clicked */\n\tonExpandClick: (event: React.SyntheticEvent, data: TreeExpandData) => void;\n\t/** Callback when the tree list scrolls */\n\tonScroll?: (event: React.UIEvent<HTMLUListElement>, data: TreeScrollData) => void;\n\t/** Search term to highlight in node labels */\n\tsearchTerm?: string;\n\t/** Styles for the top-level ul element */\n\tlistStyle?: React.CSSProperties;\n}\n\ntype ReactNode = React.ReactNode;\n\n/**\n * Flattens hierarchical tree structure into a flat array.\n * The first item is the whole tree and should be removed with slice(1).\n */\nconst flattenTree = (\n\troot: { nodes?: TreeNode[]; expanded?: boolean },\n\tgetNodes: (node: { nodes?: TreeNode[] }) => TreeNode[] | undefined,\n\ttreeIndex = '',\n\tfirstLevel = true\n): FlattenedNode[] => {\n\tif (!root.nodes) {\n\t\treturn [{ node: root as TreeNode, treeIndex }];\n\t}\n\tlet nodes: FlattenedNode[] = [{ node: root as TreeNode, treeIndex }];\n\tif (root.expanded) {\n\t\tfor (let index = 0; index < root.nodes.length; index += 1) {\n\t\t\tconst curNode = firstLevel ? root.nodes[index] : getNodes(root)?.[index];\n\t\t\tif (curNode) {\n\t\t\t\tnodes = nodes.concat(\n\t\t\t\t\tflattenTree(\n\t\t\t\t\t\tcurNode,\n\t\t\t\t\t\tgetNodes,\n\t\t\t\t\t\ttreeIndex ? `${treeIndex}-${index}` : `${index}`,\n\t\t\t\t\t\tfalse\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\treturn nodes;\n};\n\nconst defaultGetNodes = (node: { nodes?: TreeNode[] }) => node.nodes;\n\n/**\n * A tree is visualization of a structure hierarchy.\n * A branch can be expanded or collapsed.\n * This is a controlled component, since visual state is present in the nodes data.\n */\nconst Tree: React.FC<TreeProps> = ({\n\tassistiveText: assistiveTextProp,\n\tclassName,\n\tlistClassName,\n\tgetNodes = defaultGetNodes,\n\theading,\n\tid,\n\tnodes,\n\tonClick,\n\tonExpandClick,\n\tonScroll,\n\tsearchTerm,\n\tlistStyle,\n}) => {\n\t// Merge assistive text with defaults\n\tconst assistiveText =\n\t\ttypeof assistiveTextProp === 'string'\n\t\t\t? assistiveTextProp\n\t\t\t: assistiveTextProp?.label;\n\n\t// Track if tree has focus\n\tconst treeHasFocusRef = useRef(false);\n\n\t// Compute flattened nodes\n\tconst computeFlattenedNodes = useCallback(() => {\n\t\treturn flattenTree(\n\t\t\t{\n\t\t\t\tnodes: getNodes({ nodes }),\n\t\t\t\texpanded: true,\n\t\t\t},\n\t\t\tgetNodes\n\t\t).slice(1);\n\t}, [getNodes, nodes]);\n\n\t// Initialize state\n\tconst [flattenedNodes, setFlattenedNodes] = useState<FlattenedNode[]>(\n\t\tcomputeFlattenedNodes\n\t);\n\tconst [selectedNodeIndexes, setSelectedNodeIndexes] = useState<string[]>(() => {\n\t\tconst flattened = computeFlattenedNodes();\n\t\tconst selectedNode = flattened.find((curNode) => curNode.node.selected);\n\t\treturn selectedNode ? [selectedNode.treeIndex] : [];\n\t});\n\tconst [focusedNodeIndex, setFocusedNodeIndex] = useState<string | undefined>(\n\t\t() => {\n\t\t\tconst flattened = computeFlattenedNodes();\n\t\t\tconst selectedNode = flattened.find((curNode) => curNode.node.selected);\n\t\t\treturn selectedNode?.treeIndex;\n\t\t}\n\t);\n\n\t// Check props on mount\n\tuseEffect(() => {\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t(checkProps as any)(TREE, {\n\t\t\tassistiveText: assistiveTextProp,\n\t\t\tclassName,\n\t\t\tlistClassName,\n\t\t\tgetNodes,\n\t\t\theading,\n\t\t\tid,\n\t\t\tnodes,\n\t\t\tonClick,\n\t\t\tonExpandClick,\n\t\t\tonScroll,\n\t\t\tsearchTerm,\n\t\t\tlistStyle,\n\t\t}, {});\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\t// Update flattened nodes when nodes prop changes\n\tuseEffect(() => {\n\t\tsetFlattenedNodes(computeFlattenedNodes());\n\t}, [computeFlattenedNodes, nodes]);\n\n\t// Handle node selection\n\tconst handleSelect = useCallback(\n\t\t({\n\t\t\tevent,\n\t\t\tdata,\n\t\t\tclearSelectedNodes,\n\t\t\tfromFocus,\n\t\t}: {\n\t\t\tevent: React.SyntheticEvent;\n\t\t\tdata: TreeSelectData;\n\t\t\tclearSelectedNodes?: boolean;\n\t\t\tfromFocus?: boolean;\n\t\t}) => {\n\t\t\t// When triggered by a key event, other nodes should be deselected\n\t\t\tif (clearSelectedNodes) {\n\t\t\t\tflattenedNodes.forEach((flattenedNode) => {\n\t\t\t\t\tif (flattenedNode.node.selected) {\n\t\t\t\t\t\tflattenedNode.node.selected = false;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Prevent firing twice on first click due to focus event\n\t\t\tif (!fromFocus) {\n\t\t\t\tonClick(event, data);\n\t\t\t}\n\n\t\t\t// Update selected and focused nodes\n\t\t\tlet newSelectedNodeIndexes: string[];\n\t\t\tif (data.select) {\n\t\t\t\tnewSelectedNodeIndexes = [...selectedNodeIndexes, data.treeIndex];\n\t\t\t} else {\n\t\t\t\tnewSelectedNodeIndexes = selectedNodeIndexes.filter(\n\t\t\t\t\t(treeIndex) => treeIndex !== data.treeIndex\n\t\t\t\t);\n\t\t\t}\n\n\t\t\ttreeHasFocusRef.current = true;\n\t\t\tsetFocusedNodeIndex(data.treeIndex);\n\t\t\tsetSelectedNodeIndexes(newSelectedNodeIndexes);\n\t\t},\n\t\t[flattenedNodes, onClick, selectedNodeIndexes]\n\t);\n\n\t// Handle node blur\n\tconst handleNodeBlur = useCallback(() => {\n\t\ttreeHasFocusRef.current = false;\n\t}, []);\n\n\t// Handle expand/collapse\n\tconst handleExpand = useCallback(\n\t\t({ event, data }: { event: React.SyntheticEvent; data: TreeExpandData }) => {\n\t\t\ttreeHasFocusRef.current = true;\n\t\t\tonExpandClick(event, data);\n\n\t\t\tif (data.select) {\n\t\t\t\tsetFocusedNodeIndex(data.treeIndex);\n\t\t\t}\n\t\t},\n\t\t[onExpandClick]\n\t);\n\n\t// Determine heading text\n\tconst headingText = assistiveText || heading;\n\n\treturn (\n\t\t<div\n\t\t\tid={id}\n\t\t\tclassName={classNames('slds-tree_container', className)}\n\t\t>\n\t\t\t<h4\n\t\t\t\tclassName={classNames('slds-tree__group-header', {\n\t\t\t\t\t'slds-assistive-text': !!assistiveText,\n\t\t\t\t})}\n\t\t\t\tid={`${id}__heading`}\n\t\t\t>\n\t\t\t\t{headingText}\n\t\t\t</h4>\n\t\t\t<Branch\n\t\t\t\tgetNodes={getNodes}\n\t\t\t\tinitalClassName={listClassName}\n\t\t\t\thtmlId={id}\n\t\t\t\tinitialStyle={listStyle}\n\t\t\t\tlevel={0}\n\t\t\t\tnode={{ nodes }}\n\t\t\t\tflattenedNodes={flattenedNodes}\n\t\t\t\tselectedNodeIndexes={selectedNodeIndexes}\n\t\t\t\tfocusedNodeIndex={focusedNodeIndex}\n\t\t\t\ttreeHasFocus={treeHasFocusRef.current}\n\t\t\t\tonNodeBlur={handleNodeBlur}\n\t\t\t\tonSelect={handleSelect}\n\t\t\t\tonExpand={handleExpand}\n\t\t\t\tonScroll={onScroll}\n\t\t\t\tsearchTerm={searchTerm}\n\t\t\t\ttreeId={id}\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\nTree.displayName = TREE;\n\nexport default Tree;\n\n"],"mappings":"4RA0DA,IAAM,GACL,EACA,EACA,EAAY,GACZ,EAAa,KACQ,CACrB,GAAI,CAAC,EAAK,MACT,MAAO,CAAC,CAAE,KAAM,EAAkB,WAAU,CAAC,EAE9C,IAAI,EAAyB,CAAC,CAAE,KAAM,EAAkB,WAAU,CAAC,EACnE,GAAI,EAAK,SACR,IAAK,IAAI,EAAQ,EAAG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"tree.cjs","names":[],"sources":["../../../../components/tree/tree.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, { useState, useCallback, useEffect, useRef } from 'react';\nimport classNames from 'classnames';\n// Using native Array.find instead of lodash for better TypeScript support\n\n// Child components\nimport Branch from './private/branch';\n\n// Similar to React's PropTypes check\nimport checkProps from './check-props';\n\n// Constants\nimport { TREE } from '../../utilities/constants';\nimport componentDoc from './component.json';\n\nimport {\n\tTreeNode,\n\tFlattenedNode,\n\tTreeAssistiveText,\n\tTreeLabels,\n\tTreeNodeSelectData,\n\tTreeRequestToggleData,\n\tTreeSelectData,\n\tTreeExpandData,\n\tTreeScrollData,\n} from './types';\n\nexport interface TreeProps {\n\t/**\n\t * **Assistive text for accessibility**\n\t * * `heading`: Visually hidden tree heading. Set this or `labels.heading`.\n\t */\n\tassistiveText?: TreeAssistiveText;\n\t/** Class names for the container element */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Class names for the top-level ul element */\n\tlistClassName?: string | string[] | Record<string, boolean>;\n\t/** Function to get child nodes from a parent node */\n\tgetNodes?: (node: { nodes?: TreeNode[] }) => TreeNode[] | undefined;\n\t/** @deprecated Use `labels.heading` instead. */\n\theading?: ReactNode;\n\t/** HTML id of the tree container (required) */\n\tid: string;\n\t/**\n\t * **Text labels for internationalization**\n\t * * `heading`: Visible tree heading that describes its contents. Set this or `assistiveText.heading`.\n\t */\n\tlabels?: TreeLabels;\n\t/** Array of tree nodes */\n\tnodes: TreeNode[];\n\t/**\n\t * Called when an item or branch is selected or deselected: by click, by focus, or by keyboard\n\t * (Enter, Up/Down arrows, Right arrow into an expanded branch, Left arrow to the parent node).\n\t * `data.isSelected` is the requested selection state. Update `node.selected` in `nodes` to apply it.\n\t */\n\tonSelect?: (event: React.SyntheticEvent, data: TreeNodeSelectData) => void;\n\t/**\n\t * Called when an item or branch is selected.\n\t * @deprecated Use `onSelect`, which receives `{ node, isSelected }`. Ignored when `onSelect` is passed.\n\t */\n\tonClick?: (event: React.SyntheticEvent, data: TreeSelectData) => void;\n\t/**\n\t * Called when a branch is asked to expand or collapse: by clicking its toggle button, by Right\n\t * arrow on a collapsed branch, or by Left arrow on an expanded branch. `data.isExpanded` is the\n\t * requested expansion state. Update `node.expanded` in `nodes` to apply it.\n\t */\n\tonRequestToggle?: (\n\t\tevent: React.SyntheticEvent,\n\t\tdata: TreeRequestToggleData\n\t) => void;\n\t/**\n\t * Called when a branch's expand/collapse button is clicked, or when the Left arrow is pressed\n\t * on a collapsed branch or item (with `data.select: true` and `data.node` set to the parent).\n\t * @deprecated Use `onRequestToggle`, which receives `{ node, isExpanded }`. With\n\t * `onRequestToggle`, Left arrow on a collapsed branch or item selects the parent via\n\t * `onSelect` instead. Ignored when `onRequestToggle` is passed.\n\t */\n\tonExpandClick?: (event: React.SyntheticEvent, data: TreeExpandData) => void;\n\t/** Callback when the tree list scrolls. `data.ratio` is the scroll position from `0` to `1`. */\n\tonScroll?: (\n\t\tevent: React.UIEvent<HTMLUListElement>,\n\t\tdata: TreeScrollData\n\t) => void;\n\t/** Search term to highlight in node labels */\n\tsearchTerm?: string;\n\t/** Styles for the top-level ul element */\n\tlistStyle?: React.CSSProperties;\n}\n\ntype ReactNode = React.ReactNode;\n\n/**\n * Flattens hierarchical tree structure into a flat array.\n * The first item is the whole tree and should be removed with slice(1).\n */\nconst flattenTree = (\n\troot: { nodes?: TreeNode[]; expanded?: boolean },\n\tgetNodes: (node: { nodes?: TreeNode[] }) => TreeNode[] | undefined,\n\ttreeIndex = '',\n\tfirstLevel = true\n): FlattenedNode[] => {\n\tif (!root.nodes) {\n\t\treturn [{ node: root as TreeNode, treeIndex }];\n\t}\n\tlet nodes: FlattenedNode[] = [{ node: root as TreeNode, treeIndex }];\n\tif (root.expanded) {\n\t\tfor (let index = 0; index < root.nodes.length; index += 1) {\n\t\t\tconst curNode = firstLevel ? root.nodes[index] : getNodes(root)?.[index];\n\t\t\tif (curNode) {\n\t\t\t\tnodes = nodes.concat(\n\t\t\t\t\tflattenTree(\n\t\t\t\t\t\tcurNode,\n\t\t\t\t\t\tgetNodes,\n\t\t\t\t\t\ttreeIndex ? `${treeIndex}-${index}` : `${index}`,\n\t\t\t\t\t\tfalse\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\treturn nodes;\n};\n\nconst defaultGetNodes = (node: { nodes?: TreeNode[] }) => node.nodes;\n\n/**\n * A tree is visualization of a structure hierarchy.\n * A branch can be expanded or collapsed.\n * This is a controlled component, since visual state is present in the nodes data.\n */\nconst Tree: React.FC<TreeProps> = ({\n\tassistiveText: assistiveTextProp,\n\tclassName,\n\tlistClassName,\n\tgetNodes = defaultGetNodes,\n\theading: headingProp,\n\tid,\n\tlabels,\n\tnodes,\n\tonSelect,\n\tonClick,\n\tonRequestToggle,\n\tonExpandClick,\n\tonScroll,\n\tsearchTerm,\n\tlistStyle,\n}) => {\n\t// `assistiveText.label` is deprecated\n\tconst assistiveHeading =\n\t\tassistiveTextProp?.heading ?? assistiveTextProp?.label;\n\t// `heading` is deprecated\n\tconst visibleHeading = labels?.heading ?? headingProp;\n\n\t// Track if tree has focus\n\tconst treeHasFocusRef = useRef(false);\n\n\t// Compute flattened nodes\n\tconst computeFlattenedNodes = useCallback(() => {\n\t\treturn flattenTree(\n\t\t\t{\n\t\t\t\tnodes: getNodes({ nodes }),\n\t\t\t\texpanded: true,\n\t\t\t},\n\t\t\tgetNodes\n\t\t).slice(1);\n\t}, [getNodes, nodes]);\n\n\t// Initialize state\n\tconst [flattenedNodes, setFlattenedNodes] = useState<FlattenedNode[]>(\n\t\tcomputeFlattenedNodes\n\t);\n\tconst [selectedNodeIndexes, setSelectedNodeIndexes] = useState<string[]>(\n\t\t() => {\n\t\t\tconst flattened = computeFlattenedNodes();\n\t\t\tconst selectedNode = flattened.find((curNode) => curNode.node.selected);\n\t\t\treturn selectedNode ? [selectedNode.treeIndex] : [];\n\t\t}\n\t);\n\tconst [focusedNodeIndex, setFocusedNodeIndex] = useState<string | undefined>(\n\t\t() => {\n\t\t\tconst flattened = computeFlattenedNodes();\n\t\t\tconst selectedNode = flattened.find((curNode) => curNode.node.selected);\n\t\t\treturn selectedNode?.treeIndex;\n\t\t}\n\t);\n\n\t// Check props on mount\n\tuseEffect(() => {\n\t\tcheckProps(\n\t\t\tTREE,\n\t\t\t{\n\t\t\t\tassistiveText: assistiveTextProp,\n\t\t\t\tclassName,\n\t\t\t\tlistClassName,\n\t\t\t\tgetNodes,\n\t\t\t\theading: headingProp,\n\t\t\t\tid,\n\t\t\t\tlabels,\n\t\t\t\tnodes,\n\t\t\t\tonSelect,\n\t\t\t\tonClick,\n\t\t\t\tonRequestToggle,\n\t\t\t\tonExpandClick,\n\t\t\t\tonScroll,\n\t\t\t\tsearchTerm,\n\t\t\t\tlistStyle,\n\t\t\t},\n\t\t\tcomponentDoc\n\t\t);\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\t// Update flattened nodes when nodes prop changes\n\tuseEffect(() => {\n\t\tsetFlattenedNodes(computeFlattenedNodes());\n\t}, [computeFlattenedNodes, nodes]);\n\n\t// Handle node selection\n\tconst handleSelect = useCallback(\n\t\t({\n\t\t\tevent,\n\t\t\tdata,\n\t\t\tclearSelectedNodes,\n\t\t\tfromFocus,\n\t\t}: {\n\t\t\tevent: React.SyntheticEvent;\n\t\t\tdata: TreeSelectData;\n\t\t\tclearSelectedNodes?: boolean;\n\t\t\tfromFocus?: boolean;\n\t\t}) => {\n\t\t\t// When triggered by a key event, other nodes should be deselected\n\t\t\tif (clearSelectedNodes) {\n\t\t\t\tflattenedNodes.forEach((flattenedNode) => {\n\t\t\t\t\tif (flattenedNode.node.selected) {\n\t\t\t\t\t\tflattenedNode.node.selected = false;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Prevent firing twice on first click due to focus event\n\t\t\tif (!fromFocus) {\n\t\t\t\tif (onSelect) {\n\t\t\t\t\tonSelect(event, { node: data.node, isSelected: data.select });\n\t\t\t\t} else if (onClick) {\n\t\t\t\t\tonClick(event, data);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Update selected and focused nodes\n\t\t\tlet newSelectedNodeIndexes: string[];\n\t\t\tif (data.select) {\n\t\t\t\tnewSelectedNodeIndexes = [...selectedNodeIndexes, data.treeIndex];\n\t\t\t} else {\n\t\t\t\tnewSelectedNodeIndexes = selectedNodeIndexes.filter(\n\t\t\t\t\t(treeIndex) => treeIndex !== data.treeIndex\n\t\t\t\t);\n\t\t\t}\n\n\t\t\ttreeHasFocusRef.current = true;\n\t\t\tsetFocusedNodeIndex(data.treeIndex);\n\t\t\tsetSelectedNodeIndexes(newSelectedNodeIndexes);\n\t\t},\n\t\t[flattenedNodes, onSelect, onClick, selectedNodeIndexes]\n\t);\n\n\t// Handle node blur\n\tconst handleNodeBlur = useCallback(() => {\n\t\ttreeHasFocusRef.current = false;\n\t}, []);\n\n\t// Handle expand/collapse\n\tconst handleExpand = useCallback(\n\t\t({\n\t\t\tevent,\n\t\t\tdata,\n\t\t}: {\n\t\t\tevent: React.SyntheticEvent;\n\t\t\tdata: TreeExpandData;\n\t\t}) => {\n\t\t\t// `data.select` marks Left arrow on a collapsed branch or item: move to the parent node.\n\t\t\tif (data.select) {\n\t\t\t\tif (!onRequestToggle && onExpandClick) {\n\t\t\t\t\t// Deprecated behavior: report it to `onExpandClick` with the parent node\n\t\t\t\t\ttreeHasFocusRef.current = true;\n\t\t\t\t\tonExpandClick(event, data);\n\t\t\t\t\tsetFocusedNodeIndex(data.treeIndex);\n\t\t\t\t} else {\n\t\t\t\t\t// Not an expand/collapse request: select the parent, like Up/Down arrows do\n\t\t\t\t\thandleSelect({\n\t\t\t\t\t\tevent,\n\t\t\t\t\t\tdata: { node: data.node, select: true, treeIndex: data.treeIndex },\n\t\t\t\t\t\tclearSelectedNodes: true,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ttreeHasFocusRef.current = true;\n\t\t\tif (onRequestToggle) {\n\t\t\t\tonRequestToggle(event, { node: data.node, isExpanded: data.expand });\n\t\t\t} else if (onExpandClick) {\n\t\t\t\tonExpandClick(event, data);\n\t\t\t}\n\t\t},\n\t\t[handleSelect, onRequestToggle, onExpandClick]\n\t);\n\n\t// Determine heading text\n\tconst headingText = assistiveHeading || visibleHeading;\n\n\treturn (\n\t\t<div id={id} className={classNames('slds-tree_container', className)}>\n\t\t\t<h4\n\t\t\t\tclassName={classNames('slds-tree__group-header', {\n\t\t\t\t\t'slds-assistive-text': !!assistiveHeading,\n\t\t\t\t})}\n\t\t\t\tid={`${id}__heading`}\n\t\t\t>\n\t\t\t\t{headingText}\n\t\t\t</h4>\n\t\t\t<Branch\n\t\t\t\tgetNodes={getNodes}\n\t\t\t\tinitalClassName={listClassName}\n\t\t\t\thtmlId={id}\n\t\t\t\tinitialStyle={listStyle}\n\t\t\t\tlevel={0}\n\t\t\t\tnode={{ nodes }}\n\t\t\t\tflattenedNodes={flattenedNodes}\n\t\t\t\tselectedNodeIndexes={selectedNodeIndexes}\n\t\t\t\tfocusedNodeIndex={focusedNodeIndex}\n\t\t\t\ttreeHasFocus={treeHasFocusRef.current}\n\t\t\t\tonNodeBlur={handleNodeBlur}\n\t\t\t\tonSelect={handleSelect}\n\t\t\t\tonExpand={handleExpand}\n\t\t\t\tonScroll={onScroll}\n\t\t\t\tsearchTerm={searchTerm}\n\t\t\t\ttreeId={id}\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\nTree.displayName = TREE;\n\nexport default Tree;\n"],"mappings":"yTAiGA,IAAM,GACL,EACA,EACA,EAAY,GACZ,EAAa,KACQ,CACrB,GAAI,CAAC,EAAK,MACT,MAAO,CAAC,CAAE,KAAM,EAAkB,WAAU,CAAC,EAE9C,IAAI,EAAyB,CAAC,CAAE,KAAM,EAAkB,WAAU,CAAC,EACnE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nE,SAAA,EACC,EAAA,EAAA,IAAA,CAAC,KAAD,CACC,WAAA,EAAW,EAAA,QAAA,CAAW,0BAA2B,CAChD,sBAAuB,CAAC,CAAC,CAC1B,CAAC,EACD,GAAI,GAAG,EAAG,WAET,SAAA,CACE,CAAA,GACJ,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACW,WACV,gBAAiB,EACjB,OAAQ,EACR,aAAc,EACd,MAAO,EACP,KAAM,CAAE,OAAM,EACE,iBACK,sBACH,mBAClB,aAAc,EAAgB,QAC9B,WAAY,EACZ,SAAU,EACV,SAAU,EACA,WACE,aACZ,OAAQ,CACR,CAAA,CACG,GAEP,EAEA,EAAK,YAAc,EAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("../../utilities/get-component-doc.cjs"),t=require("../../utilities/warning/deprecated-property.cjs");var n=function(){};process.env.NODE_ENV!==`production`&&(n=function(n,r,i){let a=e.default(i),o=r.labels||{};t.default(n,o.timeLeftUnit,`labels.timeLeftUnit`,`labels.timeLeftAfter`,`Pass the complete text after the amount, including the unit (e.g. \`days left in trial\`). ${a(`labels`)}`),t.default(n,o.timeLeftUnitAfter,`labels.timeLeftUnitAfter`,`labels.timeLeftAfter`,a(`labels`)),t.default(n,r.onRenderActions,`onRenderActions`,`actions`,a(`actions`))});var r=n;exports.default=r;
|
|
2
|
+
//# sourceMappingURL=check-props.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-props.cjs","names":[],"sources":["../../../../components/trial-bar/check-props.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n/* eslint-disable import/no-mutable-exports */\n\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport getComponentDocFn from '../../utilities/get-component-doc';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\t\tconst labels = props.labels || {};\n\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tlabels.timeLeftUnit,\n\t\t\t'labels.timeLeftUnit',\n\t\t\t'labels.timeLeftAfter',\n\t\t\t`Pass the complete text after the amount, including the unit (e.g. \\`days left in trial\\`). ${createDocUrl('labels')}`\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tlabels.timeLeftUnitAfter,\n\t\t\t'labels.timeLeftUnitAfter',\n\t\t\t'labels.timeLeftAfter',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onRenderActions,\n\t\t\t'onRenderActions',\n\t\t\t'actions',\n\t\t\tcreateDocUrl('actions')\n\t\t);\n\t};\n}\n\nexport default checkProps;\n"],"mappings":"sHAOA,IAAI,EAAa,UAA8B,CAAC,EAEhD,QAAA,IAAA,WAA6B,eAC5B,EAAa,SAA4B,EAAW,EAAO,EAAS,CACnE,IAAM,EAAe,EAAA,QAAkB,CAAO,EACxC,EAAS,EAAM,QAAU,CAAC,EAEhC,EAAA,QACC,EACA,EAAO,aACP,sBACA,uBACA,8FAA8F,EAAa,QAAQ,GACpH,EACA,EAAA,QACC,EACA,EAAO,kBACP,2BACA,uBACA,EAAa,QAAQ,CACtB,EACA,EAAA,QACC,EACA,EAAM,gBACN,kBACA,UACA,EAAa,SAAS,CACvB,CACD,GAGD,IAAA,EAAe"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=`trial-bar`,t=`prod`,n=`TrialBar`,r=[{component:`button`,classKey:`TrialBarButton`},{component:`dropdown`,classKey:`TrialBarDropdown`}],i={component:e,status:t,"display-name":`Trial Bars`,classKey:n,"SLDS-component-path":`/components/trial-bar`,dependencies:r,"site-stories":[{heading:`Base`,path:`/__examples__/default.jsx`}],"url-slug":`trial-bars`};exports.classKey=n,exports.component=e,exports.default=i,exports.dependencies=r,exports.status=t;
|
|
2
|
+
//# sourceMappingURL=component.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.cjs","names":[],"sources":["../../../../components/trial-bar/component.json"],"sourcesContent":["{\n\t\"component\": \"trial-bar\",\n\t\"status\": \"prod\",\n\t\"display-name\": \"Trial Bars\",\n\t\"classKey\": \"TrialBar\",\n\t\"SLDS-component-path\": \"/components/trial-bar\",\n\t\"dependencies\": [\n\t\t{\n\t\t\t\"component\": \"button\",\n\t\t\t\"classKey\": \"TrialBarButton\"\n\t\t},\n\t\t{\n\t\t\t\"component\": \"dropdown\",\n\t\t\t\"classKey\": \"TrialBarDropdown\"\n\t\t}\n\t],\n\t\"site-stories\": [\n\t\t{\n\t\t\t\"heading\": \"Base\",\n\t\t\t\"path\": \"/__examples__/default.jsx\"\n\t\t}\n\t],\n\t\"url-slug\": \"trial-bars\"\n}\n"],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs");let
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("./check-props.cjs"),r=require("./component.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s=`left in trial`,c=({timeLeftUnit:e,timeLeftUnitAfter:t})=>{if(e!==void 0||t!==void 0)return[e,t??s].filter(Boolean).join(` `)},l=({actions:e,children:l,className:u,labels:d,onRenderActions:f,style:p})=>{let m=d??{},h=m.timeLeftAfter??c(m)??s;return(0,i.useEffect)(()=>{n.default(t.TRIAL_BAR,{labels:d,onRenderActions:f},r.default)},[d,f]),(0,o.jsxs)(`div`,{className:(0,a.default)(`slds-trial-header slds-grid`,u),style:p,children:[(0,o.jsx)(`div`,{className:`slds-grid`,children:l}),(0,o.jsxs)(`div`,{className:`slds-grid slds-grid_vertical-align-center slds-col_bump-left`,children:[(0,o.jsx)(`span`,{className:`slds-box slds-box_xx-small slds-theme_default`,children:m.timeLeft}),(0,o.jsx)(`span`,{className:`slds-m-horizontal_x-small`,children:h}),e??f?.()]})]})};l.displayName=t.TRIAL_BAR,exports.default=l;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/trial-bar/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, { type ReactNode, type CSSProperties } from 'react';\nimport classNames from 'classnames';\nimport { TRIAL_BAR } from '../../utilities/constants';\n\n/**\n * Labels for TrialBar\n */\nexport interface TrialBarLabels {\n\t/** Amount of time left */\n\ttimeLeft?:
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/trial-bar/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, { useEffect, type ReactNode, type CSSProperties } from 'react';\nimport classNames from 'classnames';\nimport { TRIAL_BAR } from '../../utilities/constants';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Labels for TrialBar\n */\nexport interface TrialBarLabels {\n\t/** Amount of time left, rendered in a box (e.g. `30`) */\n\ttimeLeft?: ReactNode;\n\t/** Complete text after the amount, including any unit (e.g. `days left in trial`) */\n\ttimeLeftAfter?: ReactNode;\n\t/** @deprecated Include the unit in `timeLeftAfter` instead. */\n\ttimeLeftUnit?: string;\n\t/** @deprecated Use `timeLeftAfter` instead. */\n\ttimeLeftUnitAfter?: string;\n}\n\n/**\n * Props for the TrialBar component\n */\nexport interface TrialBarProps {\n\t/** Actions shown after the time left, such as a subscribe button */\n\tactions?: ReactNode;\n\t/** TrialBarButton or TrialBarDropdown children */\n\tchildren?: ReactNode;\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/**\n\t * **Text labels for internationalization**\n\t * * `timeLeft`: Amount of time left, rendered in a box\n\t * * `timeLeftAfter`: Complete text after the amount, including any unit. Defaults to `left in trial`.\n\t */\n\tlabels?: TrialBarLabels;\n\t/** @deprecated Use `actions` instead. */\n\tonRenderActions?: () => ReactNode;\n\t/** Custom styles */\n\tstyle?: CSSProperties;\n}\n\nconst defaultTimeLeftAfter = 'left in trial';\n\n// Joins the deprecated `timeLeftUnit` and `timeLeftUnitAfter` the way they were rendered before\nconst getLegacyTimeLeftAfter = ({\n\ttimeLeftUnit,\n\ttimeLeftUnitAfter,\n}: TrialBarLabels) => {\n\tif (timeLeftUnit === undefined && timeLeftUnitAfter === undefined)\n\t\treturn undefined;\n\treturn [timeLeftUnit, timeLeftUnitAfter ?? defaultTimeLeftAfter]\n\t\t.filter(Boolean)\n\t\t.join(' ');\n};\n\n/**\n * Trial bar components are used to provide an interactive and educational\n * prospect experience for setup.\n */\nconst TrialBar = ({\n\tactions,\n\tchildren,\n\tclassName,\n\tlabels: propLabels,\n\tonRenderActions,\n\tstyle,\n}: TrialBarProps): React.ReactElement => {\n\tconst labels = propLabels ?? {};\n\tconst timeLeftAfter =\n\t\tlabels.timeLeftAfter ??\n\t\tgetLegacyTimeLeftAfter(labels) ??\n\t\tdefaultTimeLeftAfter;\n\n\tuseEffect(() => {\n\t\tcheckProps(\n\t\t\tTRIAL_BAR,\n\t\t\t{ labels: propLabels, onRenderActions },\n\t\t\tcomponentDoc\n\t\t);\n\t}, [propLabels, onRenderActions]);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames('slds-trial-header slds-grid', className as string)}\n\t\t\tstyle={style}\n\t\t>\n\t\t\t<div className=\"slds-grid\">{children}</div>\n\t\t\t<div className=\"slds-grid slds-grid_vertical-align-center slds-col_bump-left\">\n\t\t\t\t<span className=\"slds-box slds-box_xx-small slds-theme_default\">\n\t\t\t\t\t{labels.timeLeft}\n\t\t\t\t</span>\n\t\t\t\t<span className=\"slds-m-horizontal_x-small\">{timeLeftAfter}</span>\n\t\t\t\t{actions ?? onRenderActions?.()}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nTrialBar.displayName = TRIAL_BAR;\n\nexport default TrialBar;\n"],"mappings":"sXA6CA,IAAM,EAAuB,gBAGvB,GAA0B,CAC/B,eACA,uBACqB,CACjB,OAAiB,IAAA,IAAa,IAAsB,IAAA,GAExD,MAAO,CAAC,EAAc,GAAqB,CAAoB,CAAC,CAC9D,OAAO,OAAO,CAAC,CACf,KAAK,GAAG,CACX,EAMM,GAAY,CACjB,UACA,WACA,YACA,OAAQ,EACR,kBACA,WACwC,CACxC,IAAM,EAAS,GAAc,CAAC,EACxB,EACL,EAAO,eACP,EAAuB,CAAM,GAC7B,EAUD,OARA,EAAA,EAAA,UAAA,KAAgB,CACf,EAAA,QACC,EAAA,UACA,CAAE,OAAQ,EAAY,iBAAgB,EACtC,EAAA,OACD,CACD,EAAG,CAAC,EAAY,CAAe,CAAC,GAG/B,EAAA,EAAA,KAAA,CAAC,MAAD,CACC,WAAA,EAAW,EAAA,QAAA,CAAW,8BAA+B,CAAmB,EACjE,QAFR,SAAA,EAIC,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,YAAa,UAAc,CAAA,GAC1C,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,+DAAf,SAAA,EACC,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,gDACd,SAAA,EAAO,QACH,CAAA,GACN,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,4BAA6B,SAAA,CAAoB,CAAA,EAChE,GAAW,IAAkB,CAC1B,CACD,CAAA,CAAA,GAEP,EAEA,EAAS,YAAc,EAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../utilities/constants.cjs"),n=require("./item.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("classnames");i=e.__toESM(i,1);let a=require("react/jsx-runtime");var o=class extends r.default.Component{static displayName=t.LIST;static defaultProps={length:`5`,options:[],selectedIndex:-1};render(){let e,t;return this.props.length&&(e=`slds-dropdown_length-${this.props.length}`),t=(0,a.jsx)(`ul`,{"aria-labelledby":this.props.triggerId,className:(0,i.default)(`dropdown__list`,e,this.props.className),role:`menu`,children:(this.props.options??[]).map((e,t)=>{let i=this.props.getListItemId?.(t)??`${t}`,a=t===this.props.selectedIndex,o=!!this.props.selectedIndices&&this.props.selectedIndices.indexOf(t)!==-1;return(0,r.createElement)(n.default,{...e,"aria-disabled":e.disabled,checkmark:this.props.checkmark&&(a||o),isCheckmarkVariant:this.props.checkmark,data:e,id:i,index:t,isSelected:a||o,key:`${i}-${e.value}`,labelRenderer:this.props.itemRenderer,onSelect:this.props.onSelect??(()=>{}),nodeRef:e=>this.props.itemRefs?.(e,t),tooltipTemplate:this.props.tooltipMenuItem})})}),this.props.tooltipMenuItem&&(t=(0,a.jsxs)(r.default.Fragment,{children:[(0,a.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`.slds-dropdown__item > .slds-tooltip-trigger > a {
|
|
1
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../utilities/constants.cjs"),n=require("./item.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("classnames");i=e.__toESM(i,1);let a=require("react/jsx-runtime");var o=class extends r.default.Component{static displayName=t.LIST;static defaultProps={length:`5`,options:[],selectedIndex:-1};render(){let e,t;return this.props.length&&(e=`slds-dropdown_length-${this.props.length}`),t=(0,a.jsx)(`ul`,{"aria-labelledby":this.props.triggerId,className:(0,i.default)(`dropdown__list`,e,this.props.className),role:`menu`,children:(this.props.options??[]).map((e,t)=>{let i=this.props.getListItemId?.(t)??`${t}`,a=t===this.props.selectedIndex,o=!!this.props.selectedIndices&&this.props.selectedIndices.indexOf(t)!==-1;return(0,r.createElement)(n.default,{...e,"aria-disabled":e.disabled,checkmark:this.props.checkmark&&(a||o),isCheckmarkVariant:this.props.checkmark,data:e,id:i,index:t,isSelected:a||o,key:`${i}-${e.value}`,labelRenderer:this.props.itemRenderer,renderLabel:this.props.renderItemLabel,onSelect:this.props.onSelect??(()=>{}),nodeRef:e=>this.props.itemRefs?.(e,t),tooltipTemplate:this.props.tooltipMenuItem})})}),this.props.tooltipMenuItem&&(t=(0,a.jsxs)(r.default.Fragment,{children:[(0,a.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`.slds-dropdown__item > .slds-tooltip-trigger > a {
|
|
2
2
|
position: relative;
|
|
3
3
|
display: -ms-flexbox;
|
|
4
4
|
display: flex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../../components/utilities/menu-list/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// # List Component\n\n// ## Dependencies\n\n// ### React\nimport React, {
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../../components/utilities/menu-list/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// # List Component\n\n// ## Dependencies\n\n// ### React\nimport React, {\n\ttype ComponentType,\n\ttype ReactElement,\n\ttype ReactNode,\n} from 'react';\n\n// ### classNames\nimport classNames from 'classnames';\n\n// ## Children\nimport ListItem, { type ListItemProps } from './item';\nimport { type ListItemLabelProps } from './item-label';\n\n// ## Constants\nimport { LIST } from '../../../utilities/constants';\n\ntype ListOption = { disabled?: boolean; value?: unknown } & Record<\n\tstring,\n\tunknown\n>;\n\nexport interface MenuListProps {\n\t/**\n\t * Determines whether or not to show a checkmark for selected items.\n\t */\n\tcheckmark?: boolean;\n\t/**\n\t * CSS classes to be added to `<ul />`.\n\t */\n\tclassName?: string;\n\t/**\n\t * Used internally to determine the id that will be used for list items.\n\t */\n\tgetListItemId?: (index: number) => string;\n\t/**\n\t * Used internally to pass references to the individual menu items back up for focusing / scrolling.\n\t */\n\titemRefs?: (listItem: HTMLLIElement | null, index: number) => void;\n\t/**\n\t * If provided, this function will be used to render the contents of each menu item.\n\t */\n\titemRenderer?: ComponentType<ListItemLabelProps>;\n\t/**\n\t * If provided, called to render the contents of each menu item. Takes precedence over `itemRenderer`.\n\t */\n\trenderItemLabel?: (props: ListItemLabelProps) => ReactNode;\n\t/**\n\t * Sets the height of the list based on the numeber of items.\n\t */\n\tlength?: null | '5' | '7' | '10' | 5 | 7 | 10;\n\t/**\n\t * Triggered when a list item is selected (via mouse or keyboard).\n\t */\n\tonSelect?: (index: number, event?: React.MouseEvent) => void;\n\t/**\n\t * An array of items to render in the list.\n\t */\n\toptions?: ListOption[];\n\t/**\n\t * The index of the currently selected item in the list.\n\t */\n\tselectedIndex?: number;\n\t/**\n\t * The indices of the currently selected items in the list (multi-select).\n\t */\n\tselectedIndices?: number[];\n\t/**\n\t * Accepts a `Tooltip` component to be used as the template for menu item tooltips that appear via the `tooltipContent` options object attribute\n\t */\n\ttooltipMenuItem?: ReactElement;\n\t/**\n\t * The id of the element which triggered this list (in a menu context).\n\t */\n\ttriggerId?: string;\n}\n\n/**\n * Component description.\n */\nclass List extends React.Component<MenuListProps> {\n\tstatic displayName = LIST;\n\n\tstatic defaultProps: Partial<MenuListProps> = {\n\t\tlength: '5',\n\t\toptions: [],\n\t\tselectedIndex: -1,\n\t};\n\n\trender() {\n\t\tlet lengthClassName;\n\t\tlet list;\n\n\t\tif (this.props.length) {\n\t\t\tlengthClassName = `slds-dropdown_length-${this.props.length}`;\n\t\t}\n\n\t\tlist = (\n\t\t\t<ul\n\t\t\t\taria-labelledby={this.props.triggerId}\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'dropdown__list',\n\t\t\t\t\tlengthClassName,\n\t\t\t\t\tthis.props.className\n\t\t\t\t)}\n\t\t\t\trole=\"menu\"\n\t\t\t>\n\t\t\t\t{(this.props.options ?? []).map((option, index) => {\n\t\t\t\t\tconst id = this.props.getListItemId?.(index) ?? `${index}`;\n\t\t\t\t\tconst isSingleSelected = index === this.props.selectedIndex;\n\t\t\t\t\tconst isMultipleSelected =\n\t\t\t\t\t\t!!this.props.selectedIndices &&\n\t\t\t\t\t\tthis.props.selectedIndices.indexOf(index) !== -1;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ListItem\n\t\t\t\t\t\t\t{...(option as Partial<ListItemProps>)}\n\t\t\t\t\t\t\taria-disabled={option.disabled}\n\t\t\t\t\t\t\t// show checkmark\n\t\t\t\t\t\t\tcheckmark={\n\t\t\t\t\t\t\t\tthis.props.checkmark && (isSingleSelected || isMultipleSelected)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// show checkmark OR invisible placeholder icon\n\t\t\t\t\t\t\tisCheckmarkVariant={this.props.checkmark}\n\t\t\t\t\t\t\tdata={option}\n\t\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\t\tisSelected={isSingleSelected || isMultipleSelected}\n\t\t\t\t\t\t\tkey={`${id}-${option.value}`}\n\t\t\t\t\t\t\tlabelRenderer={this.props.itemRenderer}\n\t\t\t\t\t\t\trenderLabel={this.props.renderItemLabel}\n\t\t\t\t\t\t\tonSelect={this.props.onSelect ?? (() => {})}\n\t\t\t\t\t\t\tnodeRef={(listItem) => this.props.itemRefs?.(listItem, index)}\n\t\t\t\t\t\t\ttooltipTemplate={this.props.tooltipMenuItem}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</ul>\n\t\t);\n\n\t\tif (this.props.tooltipMenuItem) {\n\t\t\t/* eslint-disable react/no-danger */\n\t\t\tlist = (\n\t\t\t\t<React.Fragment>\n\t\t\t\t\t<style\n\t\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t\t__html: `.slds-dropdown__item > .slds-tooltip-trigger > a {\n\tposition: relative;\n\tdisplay: -ms-flexbox;\n\tdisplay: flex;\n\t-ms-flex-pack: justify;\n\tjustify-content: space-between;\n\t-ms-flex-align: center;\n\talign-items: center;\n\tpadding: 0.5rem 0.75rem;\n\tcolor: #080707;\n\twhite-space: nowrap;\n\tcursor: pointer;\n}\n\n.slds-dropdown__item > .slds-tooltip-trigger > a:active {\n text-decoration: none;\n background-color: #ecebea;\n}\n\n.slds-dropdown__item > .slds-tooltip-trigger > a:hover,\n.slds-dropdown__item > .slds-tooltip-trigger > a:focus {\n outline: 0;\n text-decoration: none;\n background-color: #f3f2f2;\n}\n`,\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t{list}\n\t\t\t\t</React.Fragment>\n\t\t\t);\n\t\t\t/* eslint-enable react/no-danger */\n\t\t}\n\n\t\treturn list;\n\t}\n}\n\nexport default List;\n"],"mappings":"yPAuFA,IAAM,EAAN,cAAmB,EAAA,QAAM,SAAyB,CACjD,OAAO,YAAc,EAAA,KAErB,OAAO,aAAuC,CAC7C,OAAQ,IACR,QAAS,CAAC,EACV,cAAe,EAChB,EAEA,QAAS,CACR,IAAI,EACA,EAwFJ,OAtFI,KAAK,MAAM,SACd,EAAkB,wBAAwB,KAAK,MAAM,UAGtD,GACC,EAAA,EAAA,IAAA,CAAC,KAAD,CACC,kBAAiB,KAAK,MAAM,UAC5B,WAAA,EAAW,EAAA,QAAA,CACV,iBACA,EACA,KAAK,MAAM,SACZ,EACA,KAAK,OAEH,UAAA,KAAK,MAAM,SAAW,CAAC,EAAA,CAAG,KAAK,EAAQ,IAAU,CAClD,IAAM,EAAK,KAAK,MAAM,gBAAgB,CAAK,GAAK,GAAG,IAC7C,EAAmB,IAAU,KAAK,MAAM,cACxC,EACL,CAAC,CAAC,KAAK,MAAM,iBACb,KAAK,MAAM,gBAAgB,QAAQ,CAAK,IAAM,GAC/C,OACC,EAAA,EAAA,cAAA,CAAC,EAAA,QAAD,CACC,GAAK,EACL,gBAAe,EAAO,SAEtB,UACC,KAAK,MAAM,YAAc,GAAoB,GAG9C,mBAAoB,KAAK,MAAM,UAC/B,KAAM,EACF,KACG,QACP,WAAY,GAAoB,EAChC,IAAK,GAAG,EAAG,GAAG,EAAO,QACrB,cAAe,KAAK,MAAM,aAC1B,YAAa,KAAK,MAAM,gBACxB,SAAU,KAAK,MAAM,eAAmB,CAAC,GACzC,QAAU,GAAa,KAAK,MAAM,WAAW,EAAU,CAAK,EAC5D,gBAAiB,KAAK,MAAM,eAC5B,CAAA,CAEH,CAAC,CACE,CAAA,EAGD,KAAK,MAAM,kBAEd,GACC,EAAA,EAAA,KAAA,CAAC,EAAA,QAAM,SAAP,CAAA,SAAA,EACC,EAAA,EAAA,IAAA,CAAC,QAAD,CACC,wBAAyB,CACxB,OAAQ;;;;;;;;;;;;;;;;;;;;;;;;;CA0BT,CACA,CAAA,EACA,CACc,CAAA,CAAA,GAKX,CACR,CACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../utilities/constants.cjs"),n=require("../../../utilities/event.cjs"),r=require("../../icon/index.cjs"),i=require("./item-label.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=class extends a.default.Component{static displayName=t.LIST_ITEM;static defaultProps={data:{},href:`#`,inverted:!1,isSelected:!1,label:``,labelRenderer:i.default,value:null};getLabel=()=>{let e=
|
|
1
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../utilities/constants.cjs"),n=require("../../../utilities/event.cjs"),r=require("../../icon/index.cjs"),i=require("./item-label.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=class extends a.default.Component{static displayName=t.LIST_ITEM;static defaultProps={data:{},href:`#`,inverted:!1,isSelected:!1,label:``,labelRenderer:i.default,value:null};getLabel=()=>{let e={checkmark:this.props.checkmark,data:this.props.data,icon:this.getIcon(`left`),index:this.props.index,inverted:this.props.inverted,isSelected:this.props.isSelected,label:this.props.label,value:this.props.value};if(this.props.renderLabel)return this.props.renderLabel(e);let t=this.props.labelRenderer??i.default;return(0,s.jsx)(t,{...e})};getIcon=e=>{let t=[`slds-icon-text-default`],n=e===`left`?this.props.leftIcon:this.props.rightIcon;if(e===`left`?(this.props.isCheckmarkVariant&&(t.push(`slds-icon_selected`),n={category:`utility`,name:`check`}),t.push(`slds-m-right_x-small`)):t.push(`slds-m-left_small`),n){let i={className:(0,o.default)(t),position:e,size:`x-small`,...n};return(0,s.jsx)(r.default,{...i})}return null};handleClick=e=>{(this.props.type!==`link`||this.props.href===`javascript:void(0);`||this.props.href===`#`)&&n.default.trapImmediate(e),this.props.onSelect&&!this.props.disabled&&this.props.onSelect(this.props.index,e)};handleMouseDown=e=>{n.default.trapImmediate(e)};render(){switch(this.props.type){case`header`:return(0,s.jsx)(`li`,{ref:this.props.nodeRef,className:(0,o.default)(`slds-dropdown__header`,{"slds-has-divider_top-space":this.props.divider===`top`,"slds-has-divider_bottom-space":this.props.divider===`bottom`},this.props.className),onMouseDown:this.handleMouseDown,role:`separator`,children:(0,s.jsx)(`span`,{children:this.props.label})});case`divider`:return(0,s.jsx)(`li`,{ref:this.props.nodeRef,className:(0,o.default)(`slds-has-divider`,this.props.className),onMouseDown:this.handleMouseDown,role:`separator`});default:{let e=(0,s.jsxs)(`a`,{"aria-checked":this.props.checkmark&&this.props.isSelected?!0:void 0,"aria-disabled":this.props[`aria-disabled`],href:this.props.href,"data-index":this.props.index,onClick:this.handleClick,role:this.props.checkmark?`menuitemcheckbox`:`menuitem`,tabIndex:-1,children:[this.props.groupedBy&&(0,s.jsx)(`span`,{className:`slds-assistive-text`,children:`-${this.props.groupedBy}`}),this.getLabel(),this.getIcon(`right`)]});if(this.props.tooltipContent&&this.props.tooltipTemplate){let{...t}=this.props.tooltipTemplate.props,n={...t,content:this.props.tooltipContent,id:`${this.props.id}-tooltip`,triggerStyle:{width:`100%`,...t.triggerStyle||{}}};e=a.default.cloneElement(this.props.tooltipTemplate,n,e)}return(0,s.jsx)(`li`,{ref:this.props.nodeRef,"aria-selected":this.props.checkmark===null?this.props.isSelected:void 0,className:(0,o.default)(`slds-dropdown__item`,{"slds-is-selected":this.props.isSelected},this.props.className),id:this.props.id,onMouseDown:this.handleMouseDown,role:`presentation`,children:e})}}}};exports.default=c;
|
|
2
2
|
//# sourceMappingURL=item.cjs.map
|