@box/blueprint-web 5.31.3
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/LICENSE +379 -0
- package/README.md +191 -0
- package/THIRD_PARTY_LICENSES +2051 -0
- package/lib-esm/accordion/accordion.d.ts +20 -0
- package/lib-esm/accordion/accordion.js +112 -0
- package/lib-esm/accordion/accordion.module.js +4 -0
- package/lib-esm/accordion/index.d.ts +2 -0
- package/lib-esm/accordion/types.d.ts +43 -0
- package/lib-esm/actionable-inline-notice/actionable-inline-notice.d.ts +3 -0
- package/lib-esm/actionable-inline-notice/actionable-inline-notice.js +34 -0
- package/lib-esm/actionable-inline-notice/index.d.ts +60 -0
- package/lib-esm/actionable-inline-notice/index.js +9 -0
- package/lib-esm/actionable-inline-notice/types.d.ts +21 -0
- package/lib-esm/avatar/avatar.d.ts +109 -0
- package/lib-esm/avatar/avatar.js +127 -0
- package/lib-esm/avatar/avatar.module.js +4 -0
- package/lib-esm/avatar/consts.d.ts +5 -0
- package/lib-esm/avatar/consts.js +29 -0
- package/lib-esm/avatar/index.d.ts +2 -0
- package/lib-esm/avatar/types.d.ts +34 -0
- package/lib-esm/avatar/utils.d.ts +3 -0
- package/lib-esm/basics/button/button.d.ts +30 -0
- package/lib-esm/basics/button/button.js +23 -0
- package/lib-esm/basics/button/index.d.ts +2 -0
- package/lib-esm/basics/button/types.d.ts +8 -0
- package/lib-esm/basics/collapsible/collapsible-section.d.ts +15 -0
- package/lib-esm/basics/collapsible/collapsible-section.js +62 -0
- package/lib-esm/basics/collapsible/collapsible-section.module.js +4 -0
- package/lib-esm/basics/collapsible/index.d.ts +2 -0
- package/lib-esm/basics/collapsible/types.d.ts +12 -0
- package/lib-esm/basics/date-picker/date-picker.d.ts +5 -0
- package/lib-esm/basics/date-picker/date-picker.js +200 -0
- package/lib-esm/basics/date-picker/date-picker.module.js +4 -0
- package/lib-esm/basics/date-picker/index.d.ts +2 -0
- package/lib-esm/basics/date-picker/types.d.ts +32 -0
- package/lib-esm/basics/grid-list-item/grid-list.d.ts +3 -0
- package/lib-esm/basics/grid-list-item/grid-list.js +18 -0
- package/lib-esm/basics/grid-list-item/index.d.ts +74 -0
- package/lib-esm/basics/grid-list-item/index.js +73 -0
- package/lib-esm/basics/grid-list-item/types.d.ts +10 -0
- package/lib-esm/basics/large-list-item/index.d.ts +88 -0
- package/lib-esm/basics/large-list-item/index.js +87 -0
- package/lib-esm/basics/large-list-item/large-list-item-description.d.ts +4 -0
- package/lib-esm/basics/large-list-item/large-list-item-description.js +30 -0
- package/lib-esm/basics/large-list-item/large-list-item-snippet.d.ts +3 -0
- package/lib-esm/basics/large-list-item/large-list-item-snippet.js +36 -0
- package/lib-esm/basics/large-list-item/large-list.d.ts +3 -0
- package/lib-esm/basics/large-list-item/large-list.js +18 -0
- package/lib-esm/basics/large-list-item/types.d.ts +15 -0
- package/lib-esm/basics/navigation-menu/index.d.ts +16 -0
- package/lib-esm/basics/navigation-menu/index.js +17 -0
- package/lib-esm/basics/navigation-menu/navigation-menu-content.d.ts +7 -0
- package/lib-esm/basics/navigation-menu/navigation-menu-content.js +21 -0
- package/lib-esm/basics/navigation-menu/navigation-menu-item.d.ts +13 -0
- package/lib-esm/basics/navigation-menu/navigation-menu-item.js +52 -0
- package/lib-esm/basics/navigation-menu/navigation-menu-link.d.ts +5 -0
- package/lib-esm/basics/navigation-menu/navigation-menu-link.js +24 -0
- package/lib-esm/basics/navigation-menu/navigation-menu-root.d.ts +10 -0
- package/lib-esm/basics/navigation-menu/navigation-menu-root.js +19 -0
- package/lib-esm/basics/navigation-menu/navigation-menu-separator.d.ts +2 -0
- package/lib-esm/basics/navigation-menu/navigation-menu-separator.js +12 -0
- package/lib-esm/basics/navigation-menu/navigation-menu-trigger.d.ts +7 -0
- package/lib-esm/basics/navigation-menu/navigation-menu-trigger.js +21 -0
- package/lib-esm/basics/navigation-menu/navigation-menu.module.js +4 -0
- package/lib-esm/basics/small-list-item/index.d.ts +47 -0
- package/lib-esm/basics/small-list-item/index.js +46 -0
- package/lib-esm/basics/small-list-item/small-list.d.ts +3 -0
- package/lib-esm/basics/small-list-item/small-list.js +18 -0
- package/lib-esm/basics/small-list-item/types.d.ts +6 -0
- package/lib-esm/basics/text-input/index.d.ts +2 -0
- package/lib-esm/basics/text-input/text-input.d.ts +48 -0
- package/lib-esm/basics/text-input/text-input.js +77 -0
- package/lib-esm/basics/text-input/text-input.module.js +4 -0
- package/lib-esm/basics/text-input/types.d.ts +23 -0
- package/lib-esm/branding-styles/branding-styles.d.ts +2 -0
- package/lib-esm/branding-styles/branding-styles.js +10 -0
- package/lib-esm/branding-styles/index.d.ts +3 -0
- package/lib-esm/branding-styles/types.d.ts +4 -0
- package/lib-esm/branding-styles/useCustomBranding.d.ts +1 -0
- package/lib-esm/branding-styles/useCustomBranding.js +40 -0
- package/lib-esm/branding-styles/utils/createTheme.d.ts +69 -0
- package/lib-esm/branding-styles/utils/createTheme.js +167 -0
- package/lib-esm/branding-styles/utils/theme.d.ts +41 -0
- package/lib-esm/branding-styles/utils/theme.js +48 -0
- package/lib-esm/branding-styles/utils/variables.d.ts +117 -0
- package/lib-esm/branding-styles/utils/variables.js +18 -0
- package/lib-esm/card/card.d.ts +6 -0
- package/lib-esm/card/card.js +24 -0
- package/lib-esm/card/card.module.js +4 -0
- package/lib-esm/card/index.d.ts +2 -0
- package/lib-esm/card/types.d.ts +10 -0
- package/lib-esm/card-tooltip/card-tooltip.d.ts +13 -0
- package/lib-esm/card-tooltip/card-tooltip.js +66 -0
- package/lib-esm/card-tooltip/card-tooltip.module.js +4 -0
- package/lib-esm/card-tooltip/index.d.ts +2 -0
- package/lib-esm/card-tooltip/types.d.ts +30 -0
- package/lib-esm/checkbox/checkbox-item.d.ts +6 -0
- package/lib-esm/checkbox/checkbox-item.js +78 -0
- package/lib-esm/checkbox/checkbox.module.js +4 -0
- package/lib-esm/checkbox/index.d.ts +8 -0
- package/lib-esm/checkbox/index.js +9 -0
- package/lib-esm/checkbox/types.d.ts +32 -0
- package/lib-esm/combobox/chips-group.d.ts +3 -0
- package/lib-esm/combobox/chips-group.js +100 -0
- package/lib-esm/combobox/chips-group.module.js +4 -0
- package/lib-esm/combobox/chips-group.types.d.ts +5 -0
- package/lib-esm/combobox/combobox.d.ts +14 -0
- package/lib-esm/combobox/combobox.js +422 -0
- package/lib-esm/combobox/combobox.module.js +4 -0
- package/lib-esm/combobox/index.d.ts +2 -0
- package/lib-esm/combobox/types.d.ts +206 -0
- package/lib-esm/content-card/content-card-body.d.ts +4 -0
- package/lib-esm/content-card/content-card-body.js +28 -0
- package/lib-esm/content-card/content-card-footer.d.ts +3 -0
- package/lib-esm/content-card/content-card-footer.js +17 -0
- package/lib-esm/content-card/content-card-image.d.ts +5 -0
- package/lib-esm/content-card/content-card-image.js +41 -0
- package/lib-esm/content-card/content-card-title.d.ts +4 -0
- package/lib-esm/content-card/content-card-title.js +28 -0
- package/lib-esm/content-card/content-card.d.ts +13 -0
- package/lib-esm/content-card/content-card.js +93 -0
- package/lib-esm/content-card/content-card.module.js +4 -0
- package/lib-esm/content-card/index.d.ts +2 -0
- package/lib-esm/content-card/types.d.ts +28 -0
- package/lib-esm/content-field/content-field.d.ts +5 -0
- package/lib-esm/content-field/content-field.js +93 -0
- package/lib-esm/content-field/content-field.module.js +4 -0
- package/lib-esm/content-field/index.d.ts +2 -0
- package/lib-esm/content-field/messages.d.ts +6 -0
- package/lib-esm/content-field/messages.js +8 -0
- package/lib-esm/content-field/types.d.ts +23 -0
- package/lib-esm/data-table/data-table-wrapper.d.ts +6 -0
- package/lib-esm/data-table/index.d.ts +1 -0
- package/lib-esm/empty-state/empty-state.d.ts +44 -0
- package/lib-esm/empty-state/empty-state.js +92 -0
- package/lib-esm/empty-state/empty-state.module.js +4 -0
- package/lib-esm/empty-state/index.d.ts +2 -0
- package/lib-esm/empty-state/types.d.ts +19 -0
- package/lib-esm/ghost/ghost.d.ts +27 -0
- package/lib-esm/ghost/ghost.js +37 -0
- package/lib-esm/ghost/ghost.module.js +4 -0
- package/lib-esm/ghost/index.d.ts +1 -0
- package/lib-esm/guided-tooltip/guided-tooltip-body.d.ts +11 -0
- package/lib-esm/guided-tooltip/guided-tooltip-body.js +49 -0
- package/lib-esm/guided-tooltip/guided-tooltip-footer.d.ts +71 -0
- package/lib-esm/guided-tooltip/guided-tooltip-footer.js +77 -0
- package/lib-esm/guided-tooltip/guided-tooltip-icon.d.ts +7 -0
- package/lib-esm/guided-tooltip/guided-tooltip-icon.js +22 -0
- package/lib-esm/guided-tooltip/guided-tooltip-illustration.d.ts +7 -0
- package/lib-esm/guided-tooltip/guided-tooltip-illustration.js +20 -0
- package/lib-esm/guided-tooltip/guided-tooltip-title.d.ts +6 -0
- package/lib-esm/guided-tooltip/guided-tooltip-title.js +36 -0
- package/lib-esm/guided-tooltip/guided-tooltip.d.ts +69 -0
- package/lib-esm/guided-tooltip/guided-tooltip.js +110 -0
- package/lib-esm/guided-tooltip/guided-tooltip.module.js +4 -0
- package/lib-esm/guided-tooltip/index.d.ts +3 -0
- package/lib-esm/guided-tooltip/types.d.ts +98 -0
- package/lib-esm/guided-tooltip/utils/guided-tooltip-context.d.ts +11 -0
- package/lib-esm/guided-tooltip/utils/guided-tooltip-context.js +12 -0
- package/lib-esm/index.css +5328 -0
- package/lib-esm/index.d.ts +55 -0
- package/lib-esm/index.js +62 -0
- package/lib-esm/inline-notice/inline-notice.d.ts +17 -0
- package/lib-esm/inline-notice/inline-notice.js +64 -0
- package/lib-esm/inline-table/index.d.ts +2 -0
- package/lib-esm/inline-table/inline-table.d.ts +10 -0
- package/lib-esm/inline-table/inline-table.js +53 -0
- package/lib-esm/inline-table/inline-table.module.js +4 -0
- package/lib-esm/inline-table/types.d.ts +14 -0
- package/lib-esm/input-chip/index.d.ts +2 -0
- package/lib-esm/input-chip/input-chip.d.ts +4 -0
- package/lib-esm/input-chip/input-chip.js +58 -0
- package/lib-esm/input-chip/input-chip.module.js +4 -0
- package/lib-esm/input-chip/types.d.ts +21 -0
- package/lib-esm/list-item/cell/action-cell.d.ts +13 -0
- package/lib-esm/list-item/cell/action-cell.js +49 -0
- package/lib-esm/list-item/cell/cell.d.ts +10 -0
- package/lib-esm/list-item/cell/cell.js +30 -0
- package/lib-esm/list-item/drop-indicator.d.ts +3 -0
- package/lib-esm/list-item/drop-indicator.js +19 -0
- package/lib-esm/list-item/drop-indicator.module.js +4 -0
- package/lib-esm/list-item/index.d.ts +25 -0
- package/lib-esm/list-item/list-item.d.ts +25 -0
- package/lib-esm/list-item/list-item.js +19 -0
- package/lib-esm/list-item/main.module.js +4 -0
- package/lib-esm/list-item/row.d.ts +12 -0
- package/lib-esm/list-item/row.js +32 -0
- package/lib-esm/list-item/table-body.d.ts +16 -0
- package/lib-esm/list-item/table-body.js +26 -0
- package/lib-esm/list-item/table-column.d.ts +14 -0
- package/lib-esm/list-item/table-column.js +78 -0
- package/lib-esm/list-item/table-header.d.ts +12 -0
- package/lib-esm/list-item/table-header.js +30 -0
- package/lib-esm/list-item/table.d.ts +8 -0
- package/lib-esm/list-item/table.js +30 -0
- package/lib-esm/loading-indicator/loading-indicator.d.ts +16 -0
- package/lib-esm/loading-indicator/loading-indicator.js +29 -0
- package/lib-esm/loading-indicator/loading-indicator.module.js +4 -0
- package/lib-esm/modal/index.d.ts +2 -0
- package/lib-esm/modal/modal-body.d.ts +7 -0
- package/lib-esm/modal/modal-body.js +20 -0
- package/lib-esm/modal/modal-close.d.ts +7 -0
- package/lib-esm/modal/modal-close.js +47 -0
- package/lib-esm/modal/modal-content.d.ts +7 -0
- package/lib-esm/modal/modal-content.js +28 -0
- package/lib-esm/modal/modal-footer.d.ts +65 -0
- package/lib-esm/modal/modal-footer.js +54 -0
- package/lib-esm/modal/modal-header.d.ts +7 -0
- package/lib-esm/modal/modal-header.js +42 -0
- package/lib-esm/modal/modal-scrollable-container.d.ts +8 -0
- package/lib-esm/modal/modal-scrollable-container.js +21 -0
- package/lib-esm/modal/modal-title.d.ts +7 -0
- package/lib-esm/modal/modal-title.js +29 -0
- package/lib-esm/modal/modal-trigger.d.ts +7 -0
- package/lib-esm/modal/modal-trigger.js +18 -0
- package/lib-esm/modal/modal.d.ts +93 -0
- package/lib-esm/modal/modal.js +55 -0
- package/lib-esm/modal/modal.module.js +4 -0
- package/lib-esm/modal/types.d.ts +48 -0
- package/lib-esm/primitives/base-button/base-button-context.d.ts +4 -0
- package/lib-esm/primitives/base-button/base-button-context.js +10 -0
- package/lib-esm/primitives/base-button/base-button-icon.d.ts +7 -0
- package/lib-esm/primitives/base-button/base-button-icon.js +47 -0
- package/lib-esm/primitives/base-button/base-button-label.d.ts +6 -0
- package/lib-esm/primitives/base-button/base-button-label.js +17 -0
- package/lib-esm/primitives/base-button/base-button.d.ts +24 -0
- package/lib-esm/primitives/base-button/base-button.js +58 -0
- package/lib-esm/primitives/base-button/base-button.module.js +4 -0
- package/lib-esm/primitives/base-button/index.d.ts +36 -0
- package/lib-esm/primitives/base-button/index.js +10 -0
- package/lib-esm/primitives/base-button/types.d.ts +28 -0
- package/lib-esm/primitives/base-button/utils.d.ts +8 -0
- package/lib-esm/primitives/base-button/utils.js +28 -0
- package/lib-esm/primitives/base-inline-notice/base-inline-notice-actions.d.ts +116 -0
- package/lib-esm/primitives/base-inline-notice/base-inline-notice-actions.js +55 -0
- package/lib-esm/primitives/base-inline-notice/base-inline-notice-content-container.d.ts +8 -0
- package/lib-esm/primitives/base-inline-notice/base-inline-notice-content-container.js +21 -0
- package/lib-esm/primitives/base-inline-notice/base-inline-notice-content.d.ts +7 -0
- package/lib-esm/primitives/base-inline-notice/base-inline-notice-content.js +49 -0
- package/lib-esm/primitives/base-inline-notice/base-inline-notice-icon.d.ts +7 -0
- package/lib-esm/primitives/base-inline-notice/base-inline-notice-icon.js +30 -0
- package/lib-esm/primitives/base-inline-notice/base-inline-notice.d.ts +4 -0
- package/lib-esm/primitives/base-inline-notice/base-inline-notice.js +21 -0
- package/lib-esm/primitives/base-inline-notice/base-inline-notice.module.js +4 -0
- package/lib-esm/primitives/base-inline-notice/index.d.ts +73 -0
- package/lib-esm/primitives/base-inline-notice/index.js +14 -0
- package/lib-esm/primitives/base-inline-notice/types.d.ts +39 -0
- package/lib-esm/primitives/calendar/calendar.d.ts +3 -0
- package/lib-esm/primitives/calendar/calendar.js +67 -0
- package/lib-esm/primitives/calendar/calendar.module.js +4 -0
- package/lib-esm/primitives/calendar/index.d.ts +3 -0
- package/lib-esm/primitives/calendar/parse-date.util.d.ts +7 -0
- package/lib-esm/primitives/calendar/parse-date.util.js +10 -0
- package/lib-esm/primitives/calendar/types.d.ts +17 -0
- package/lib-esm/primitives/chips/chip-dropdown-indicator.d.ts +2 -0
- package/lib-esm/primitives/chips/chip-dropdown-indicator.js +15 -0
- package/lib-esm/primitives/chips/chip-icon.d.ts +3 -0
- package/lib-esm/primitives/chips/chip-icon.js +18 -0
- package/lib-esm/primitives/chips/chip-label.d.ts +4 -0
- package/lib-esm/primitives/chips/chip-label.js +21 -0
- package/lib-esm/primitives/chips/chip-status.d.ts +4 -0
- package/lib-esm/primitives/chips/chip-status.js +20 -0
- package/lib-esm/primitives/chips/chip.d.ts +3 -0
- package/lib-esm/primitives/chips/chip.js +21 -0
- package/lib-esm/primitives/chips/chip.module.js +4 -0
- package/lib-esm/primitives/chips/chips-group.d.ts +7 -0
- package/lib-esm/primitives/chips/chips-group.js +22 -0
- package/lib-esm/primitives/chips/filter-chip/filter-chip-button.d.ts +8 -0
- package/lib-esm/primitives/chips/filter-chip/filter-chip-button.js +30 -0
- package/lib-esm/primitives/chips/filter-chip/filter-chip-group-context.d.ts +11 -0
- package/lib-esm/primitives/chips/filter-chip/filter-chip-group-context.js +9 -0
- package/lib-esm/primitives/chips/filter-chip/filter-chip.d.ts +18 -0
- package/lib-esm/primitives/chips/filter-chip/filter-chip.js +85 -0
- package/lib-esm/primitives/chips/filter-chip/filter-combo-chip.d.ts +27 -0
- package/lib-esm/primitives/chips/filter-chip/filter-combo-chip.js +84 -0
- package/lib-esm/primitives/chips/filter-chip/filter-trigger-chip.d.ts +16 -0
- package/lib-esm/primitives/chips/filter-chip/filter-trigger-chip.js +37 -0
- package/lib-esm/primitives/chips/filter-chip/index.d.ts +27 -0
- package/lib-esm/primitives/chips/filter-chip/index.js +23 -0
- package/lib-esm/primitives/chips/types.d.ts +23 -0
- package/lib-esm/primitives/context-menu/context-menu-item.d.ts +17 -0
- package/lib-esm/primitives/context-menu/context-menu-item.js +40 -0
- package/lib-esm/primitives/context-menu/context-menu-items-separator.d.ts +5 -0
- package/lib-esm/primitives/context-menu/context-menu-items-separator.js +16 -0
- package/lib-esm/primitives/context-menu/context-menu-menu-content.d.ts +11 -0
- package/lib-esm/primitives/context-menu/context-menu-menu-content.js +29 -0
- package/lib-esm/primitives/context-menu/context-menu-menu-root.d.ts +8 -0
- package/lib-esm/primitives/context-menu/context-menu-menu-root.js +19 -0
- package/lib-esm/primitives/context-menu/context-menu-menu-trigger.d.ts +8 -0
- package/lib-esm/primitives/context-menu/context-menu-menu-trigger.js +21 -0
- package/lib-esm/primitives/context-menu/context-menu-sub-menu-content.d.ts +12 -0
- package/lib-esm/primitives/context-menu/context-menu-sub-menu-content.js +34 -0
- package/lib-esm/primitives/context-menu/context-menu-sub-menu-root.d.ts +11 -0
- package/lib-esm/primitives/context-menu/context-menu-sub-menu-root.js +20 -0
- package/lib-esm/primitives/context-menu/context-menu-sub-menu-trigger.d.ts +18 -0
- package/lib-esm/primitives/context-menu/context-menu-sub-menu-trigger.js +39 -0
- package/lib-esm/primitives/context-menu/context-menu.module.js +4 -0
- package/lib-esm/primitives/context-menu/index.d.ts +27 -0
- package/lib-esm/primitives/context-menu/index.js +21 -0
- package/lib-esm/primitives/date-i18n-provider/date-i18n-provider.d.ts +15 -0
- package/lib-esm/primitives/date-i18n-provider/date-i18n-provider.js +17 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-checkbox-item.d.ts +8 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-checkbox-item.js +42 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-content.d.ts +12 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-content.js +35 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-item.d.ts +7 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-item.js +29 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-group.d.ts +8 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-group.js +17 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-select-item.d.ts +8 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-select-item.js +43 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-root.d.ts +10 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-root.js +19 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-separator.d.ts +5 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-separator.js +17 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-content.d.ts +12 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-content.js +34 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-root.d.ts +11 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-root.js +20 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-trigger.d.ts +17 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-trigger.js +38 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-trigger.d.ts +8 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu-trigger.js +23 -0
- package/lib-esm/primitives/dropdown-menu/dropdown-menu.module.js +4 -0
- package/lib-esm/primitives/dropdown-menu/index.d.ts +29 -0
- package/lib-esm/primitives/dropdown-menu/index.js +27 -0
- package/lib-esm/primitives/icon-button/icon-button.d.ts +4 -0
- package/lib-esm/primitives/icon-button/icon-button.js +30 -0
- package/lib-esm/primitives/icon-button/icon-button.module.js +4 -0
- package/lib-esm/primitives/icon-button/index.d.ts +2 -0
- package/lib-esm/primitives/icon-button/types.d.ts +9 -0
- package/lib-esm/primitives/icon-button/utils.d.ts +3 -0
- package/lib-esm/primitives/icon-button/utils.js +9 -0
- package/lib-esm/primitives/inline-error/inline-error.d.ts +4 -0
- package/lib-esm/primitives/inline-error/inline-error.js +33 -0
- package/lib-esm/primitives/inline-error/inline-error.module.js +4 -0
- package/lib-esm/primitives/inline-error/types.d.ts +5 -0
- package/lib-esm/primitives/link/index.d.ts +2 -0
- package/lib-esm/primitives/link/link.d.ts +3 -0
- package/lib-esm/primitives/link/link.js +25 -0
- package/lib-esm/primitives/link/link.module.js +4 -0
- package/lib-esm/primitives/link/types.d.ts +21 -0
- package/lib-esm/primitives/notification/index.d.ts +12 -0
- package/lib-esm/primitives/notification/index.js +12 -0
- package/lib-esm/primitives/notification/notification-button.d.ts +9 -0
- package/lib-esm/primitives/notification/notification-button.js +23 -0
- package/lib-esm/primitives/notification/notification-provider.d.ts +37 -0
- package/lib-esm/primitives/notification/notification-provider.js +94 -0
- package/lib-esm/primitives/notification/notification.module.js +4 -0
- package/lib-esm/primitives/notification/notification.viewport.d.ts +9 -0
- package/lib-esm/primitives/notification/notification.viewport.js +35 -0
- package/lib-esm/primitives/notification/private-notification-element.d.ts +33 -0
- package/lib-esm/primitives/notification/private-notification-element.js +91 -0
- package/lib-esm/primitives/page-header/index.d.ts +2 -0
- package/lib-esm/primitives/page-header/page-header.d.ts +12 -0
- package/lib-esm/primitives/page-header/page-header.js +73 -0
- package/lib-esm/primitives/page-header/page-header.module.js +4 -0
- package/lib-esm/primitives/page-header/types.d.ts +8 -0
- package/lib-esm/primitives/popover/index.d.ts +18 -0
- package/lib-esm/primitives/popover/index.js +17 -0
- package/lib-esm/primitives/popover/popover-close.d.ts +8 -0
- package/lib-esm/primitives/popover/popover-close.js +23 -0
- package/lib-esm/primitives/popover/popover-content-container.d.ts +12 -0
- package/lib-esm/primitives/popover/popover-content-container.js +46 -0
- package/lib-esm/primitives/popover/popover-footer.d.ts +7 -0
- package/lib-esm/primitives/popover/popover-footer.js +30 -0
- package/lib-esm/primitives/popover/popover-main-content.d.ts +7 -0
- package/lib-esm/primitives/popover/popover-main-content.js +45 -0
- package/lib-esm/primitives/popover/popover-overflow-context.d.ts +6 -0
- package/lib-esm/primitives/popover/popover-overflow-context.js +8 -0
- package/lib-esm/primitives/popover/popover-root.d.ts +10 -0
- package/lib-esm/primitives/popover/popover-root.js +20 -0
- package/lib-esm/primitives/popover/popover-trigger.d.ts +9 -0
- package/lib-esm/primitives/popover/popover-trigger.js +24 -0
- package/lib-esm/primitives/popover/popover.module.js +4 -0
- package/lib-esm/primitives/select-menu-grid/index.d.ts +12 -0
- package/lib-esm/primitives/select-menu-grid/index.js +11 -0
- package/lib-esm/primitives/select-menu-grid/select-menu-grid-option.d.ts +343 -0
- package/lib-esm/primitives/select-menu-grid/select-menu-grid-option.js +100 -0
- package/lib-esm/primitives/select-menu-grid/select-menu-grid-option.module.js +4 -0
- package/lib-esm/primitives/select-menu-grid/select-menu-grid.d.ts +5 -0
- package/lib-esm/primitives/select-menu-grid/select-menu-grid.js +31 -0
- package/lib-esm/primitives/select-menu-grid/select-menu-grid.module.js +4 -0
- package/lib-esm/primitives/select-menu-grid/types.d.ts +35 -0
- package/lib-esm/primitives/slot.d.ts +5 -0
- package/lib-esm/primitives/slot.js +4 -0
- package/lib-esm/primitives/supplementary-fonts/get-supplementary-font-faces-config.d.ts +5 -0
- package/lib-esm/primitives/supplementary-fonts/get-supplementary-font-faces-config.js +17 -0
- package/lib-esm/primitives/supplementary-fonts/index.d.ts +4 -0
- package/lib-esm/primitives/supplementary-fonts/supplementary-fonts.d.ts +6 -0
- package/lib-esm/primitives/supplementary-fonts/supplementary-fonts.js +12 -0
- package/lib-esm/primitives/supplementary-fonts/types.d.ts +2 -0
- package/lib-esm/primitives/supplementary-fonts/useSupplementaryFonts.hook.d.ts +2 -0
- package/lib-esm/primitives/supplementary-fonts/useSupplementaryFonts.hook.js +36 -0
- package/lib-esm/primitives/tabs/index.d.ts +27 -0
- package/lib-esm/primitives/tabs/index.js +22 -0
- package/lib-esm/primitives/tabs/tab-list.d.ts +4 -0
- package/lib-esm/primitives/tabs/tab-list.js +27 -0
- package/lib-esm/primitives/tabs/tab-panel.d.ts +4 -0
- package/lib-esm/primitives/tabs/tab-panel.js +23 -0
- package/lib-esm/primitives/tabs/tab.d.ts +11 -0
- package/lib-esm/primitives/tabs/tab.js +58 -0
- package/lib-esm/primitives/tabs/tabs.d.ts +6 -0
- package/lib-esm/primitives/tabs/tabs.js +15 -0
- package/lib-esm/primitives/tabs/tabs.module.js +4 -0
- package/lib-esm/primitives/tabs/use-tabs.d.ts +1 -0
- package/lib-esm/primitives/tabs/use-tabs.js +7 -0
- package/lib-esm/primitives/utility/AreaIndicator.d.ts +7 -0
- package/lib-esm/radio-group/index.d.ts +9 -0
- package/lib-esm/radio-group/index.js +11 -0
- package/lib-esm/radio-group/radio-group.d.ts +4 -0
- package/lib-esm/radio-group/radio-group.js +35 -0
- package/lib-esm/radio-group/radio-group.module.js +4 -0
- package/lib-esm/radio-group/radio-item.d.ts +4 -0
- package/lib-esm/radio-group/radio-item.js +50 -0
- package/lib-esm/radio-group/types.d.ts +13 -0
- package/lib-esm/search-input/index.d.ts +22 -0
- package/lib-esm/search-input/index.js +11 -0
- package/lib-esm/search-input/search-input-action-button.d.ts +2 -0
- package/lib-esm/search-input/search-input-action-button.js +26 -0
- package/lib-esm/search-input/search-input.d.ts +16 -0
- package/lib-esm/search-input/search-input.js +95 -0
- package/lib-esm/search-input/search.module.js +4 -0
- package/lib-esm/search-input/types.d.ts +53 -0
- package/lib-esm/select/index.d.ts +2 -0
- package/lib-esm/select/select.d.ts +68 -0
- package/lib-esm/select/select.js +187 -0
- package/lib-esm/select/select.module.js +4 -0
- package/lib-esm/select/types.d.ts +105 -0
- package/lib-esm/side-panel/index.d.ts +2 -0
- package/lib-esm/side-panel/scroll-context.d.ts +11 -0
- package/lib-esm/side-panel/scroll-context.js +43 -0
- package/lib-esm/side-panel/side-panel-close.d.ts +7 -0
- package/lib-esm/side-panel/side-panel-close.js +26 -0
- package/lib-esm/side-panel/side-panel-content.d.ts +13 -0
- package/lib-esm/side-panel/side-panel-content.js +41 -0
- package/lib-esm/side-panel/side-panel-footer.d.ts +65 -0
- package/lib-esm/side-panel/side-panel-footer.js +62 -0
- package/lib-esm/side-panel/side-panel-header.d.ts +7 -0
- package/lib-esm/side-panel/side-panel-header.js +62 -0
- package/lib-esm/side-panel/side-panel-overlay.d.ts +8 -0
- package/lib-esm/side-panel/side-panel-overlay.js +31 -0
- package/lib-esm/side-panel/side-panel-scrollable-container.d.ts +8 -0
- package/lib-esm/side-panel/side-panel-scrollable-container.js +42 -0
- package/lib-esm/side-panel/side-panel.d.ts +70 -0
- package/lib-esm/side-panel/side-panel.js +52 -0
- package/lib-esm/side-panel/side-panel.module.js +4 -0
- package/lib-esm/side-panel/types.d.ts +38 -0
- package/lib-esm/side-panel/variant-context.d.ts +6 -0
- package/lib-esm/side-panel/variant-context.js +22 -0
- package/lib-esm/slider/index.d.ts +2 -0
- package/lib-esm/slider/slider-incrementer.d.ts +6 -0
- package/lib-esm/slider/slider-incrementer.js +57 -0
- package/lib-esm/slider/slider-incrementer.module.js +4 -0
- package/lib-esm/slider/slider-range.d.ts +6 -0
- package/lib-esm/slider/slider-range.js +65 -0
- package/lib-esm/slider/slider-range.module.js +4 -0
- package/lib-esm/slider/slider.d.ts +5 -0
- package/lib-esm/slider/slider.js +51 -0
- package/lib-esm/slider/slider.module.js +4 -0
- package/lib-esm/slider/types.d.ts +181 -0
- package/lib-esm/status/consts.d.ts +4 -0
- package/lib-esm/status/consts.js +25 -0
- package/lib-esm/status/index.d.ts +2 -0
- package/lib-esm/status/status.d.ts +3 -0
- package/lib-esm/status/status.js +82 -0
- package/lib-esm/status/status.module.js +4 -0
- package/lib-esm/status/types.d.ts +31 -0
- package/lib-esm/switch/index.d.ts +9 -0
- package/lib-esm/switch/index.js +9 -0
- package/lib-esm/switch/switch-item.d.ts +5 -0
- package/lib-esm/switch/switch-item.js +71 -0
- package/lib-esm/switch/switch-legend.d.ts +4 -0
- package/lib-esm/switch/switch-legend.js +11 -0
- package/lib-esm/switch/switch.module.js +4 -0
- package/lib-esm/switch/types.d.ts +32 -0
- package/lib-esm/text/index.d.ts +2 -0
- package/lib-esm/text/text.d.ts +4 -0
- package/lib-esm/text/text.js +21 -0
- package/lib-esm/text/text.module.js +4 -0
- package/lib-esm/text/types.d.ts +34 -0
- package/lib-esm/text-area/index.d.ts +2 -0
- package/lib-esm/text-area/text-area-autosize/text-area-autosize.d.ts +10 -0
- package/lib-esm/text-area/text-area-autosize/text-area-autosize.js +322 -0
- package/lib-esm/text-area/text-area-autosize/text-area-autosize.module.js +4 -0
- package/lib-esm/text-area/text-area-autosize/types.d.ts +21 -0
- package/lib-esm/text-area/text-area.d.ts +36 -0
- package/lib-esm/text-area/text-area.js +57 -0
- package/lib-esm/text-area/text-area.module.js +4 -0
- package/lib-esm/text-area/types.d.ts +22 -0
- package/lib-esm/text-button/index.d.ts +2 -0
- package/lib-esm/text-button/text-button.d.ts +24 -0
- package/lib-esm/text-button/text-button.js +54 -0
- package/lib-esm/text-button/text-button.module.js +4 -0
- package/lib-esm/text-button/types.d.ts +25 -0
- package/lib-esm/tooltip/index.d.ts +2 -0
- package/lib-esm/tooltip/tooltip.d.ts +16 -0
- package/lib-esm/tooltip/tooltip.js +128 -0
- package/lib-esm/tooltip/tooltip.module.js +4 -0
- package/lib-esm/tooltip/types.d.ts +41 -0
- package/lib-esm/trigger-button/index.d.ts +1 -0
- package/lib-esm/trigger-button/trigger-button.d.ts +50 -0
- package/lib-esm/trigger-button/trigger-button.js +41 -0
- package/lib-esm/types/modify.d.ts +1 -0
- package/lib-esm/util-components/base-grid-list-item/base-grid-list-item-actions.d.ts +4 -0
- package/lib-esm/util-components/base-grid-list-item/base-grid-list-item-actions.js +132 -0
- package/lib-esm/util-components/base-grid-list-item/base-grid-list-item-header.d.ts +3 -0
- package/lib-esm/util-components/base-grid-list-item/base-grid-list-item-header.js +57 -0
- package/lib-esm/util-components/base-grid-list-item/base-grid-list-item-subtitle.d.ts +4 -0
- package/lib-esm/util-components/base-grid-list-item/base-grid-list-item-subtitle.js +58 -0
- package/lib-esm/util-components/base-grid-list-item/base-grid-list-item-thumbnail.d.ts +4 -0
- package/lib-esm/util-components/base-grid-list-item/base-grid-list-item-thumbnail.js +30 -0
- package/lib-esm/util-components/base-grid-list-item/base-grid-list-item.d.ts +4 -0
- package/lib-esm/util-components/base-grid-list-item/base-grid-list-item.js +70 -0
- package/lib-esm/util-components/base-grid-list-item/base-grid-list-item.module.js +4 -0
- package/lib-esm/util-components/base-grid-list-item/base-grid-list.d.ts +6 -0
- package/lib-esm/util-components/base-grid-list-item/base-grid-list.js +62 -0
- package/lib-esm/util-components/base-grid-list-item/index.d.ts +41 -0
- package/lib-esm/util-components/base-grid-list-item/index.js +42 -0
- package/lib-esm/util-components/base-grid-list-item/types.d.ts +32 -0
- package/lib-esm/util-components/base-grid-list-item/utils/rac-button.d.ts +12 -0
- package/lib-esm/util-components/base-grid-list-item/utils/rac-button.js +34 -0
- package/lib-esm/util-components/base-grid-list-item/utils/rac-tooltip.d.ts +7 -0
- package/lib-esm/util-components/base-grid-list-item/utils/rac-tooltip.js +30 -0
- package/lib-esm/util-components/focus-trap/focus-trap.d.ts +3 -0
- package/lib-esm/util-components/focus-trap/index.d.ts +1 -0
- package/lib-esm/util-components/focus-trap/types.d.ts +8 -0
- package/lib-esm/util-components/interactive-icon/index.d.ts +1 -0
- package/lib-esm/util-components/interactive-icon/interactive-icon.d.ts +4 -0
- package/lib-esm/util-components/interactive-icon/interactive-icon.js +24 -0
- package/lib-esm/util-components/interactive-icon/interactive-icon.module.js +4 -0
- package/lib-esm/util-components/interactive-icon/types.d.ts +9 -0
- package/lib-esm/util-components/legend/index.d.ts +1 -0
- package/lib-esm/util-components/legend/legend.d.ts +4 -0
- package/lib-esm/util-components/legend/legend.js +31 -0
- package/lib-esm/util-components/legend/legend.module.js +4 -0
- package/lib-esm/util-components/legend/types.d.ts +18 -0
- package/lib-esm/util-components/list-checkbox/index.d.ts +1 -0
- package/lib-esm/util-components/list-checkbox/list-checkbox.d.ts +10 -0
- package/lib-esm/util-components/list-checkbox/list-checkbox.js +36 -0
- package/lib-esm/util-components/list-checkbox/list-checkbox.module.js +4 -0
- package/lib-esm/util-components/menu-item-sections/menu-item-sections.d.ts +19 -0
- package/lib-esm/util-components/menu-item-sections/menu-item-sections.js +43 -0
- package/lib-esm/util-components/menu-item-sections/menu-item-sections.module.js +4 -0
- package/lib-esm/util-components/scrollable-container/scrollable-container.d.ts +30 -0
- package/lib-esm/util-components/scrollable-container/scrollable-container.js +65 -0
- package/lib-esm/util-components/scrollable-container/scrollable-container.module.js +4 -0
- package/lib-esm/util-components/search-term-string/index.d.ts +1 -0
- package/lib-esm/util-components/search-term-string/search-term-string.d.ts +5 -0
- package/lib-esm/util-components/search-term-string/search-term-string.js +41 -0
- package/lib-esm/util-components/search-term-string/search-term-string.module.js +4 -0
- package/lib-esm/util-components/search-term-string/types.d.ts +4 -0
- package/lib-esm/util-components/text-with-info-badge/index.d.ts +1 -0
- package/lib-esm/util-components/text-with-info-badge/text-with-info-badge.d.ts +4 -0
- package/lib-esm/util-components/text-with-info-badge/text-with-info-badge.js +36 -0
- package/lib-esm/util-components/text-with-info-badge/text-with-info-badge.module.js +4 -0
- package/lib-esm/util-components/text-with-info-badge/types.d.ts +15 -0
- package/lib-esm/utils/DocsStoryHeightDecorator.d.ts +14 -0
- package/lib-esm/utils/VariantsAggregator.d.ts +15 -0
- package/lib-esm/utils/a11yExceptionsConfig.d.ts +65 -0
- package/lib-esm/utils/commonTypes.d.ts +2 -0
- package/lib-esm/utils/debounce.d.ts +4 -0
- package/lib-esm/utils/debounce.js +13 -0
- package/lib-esm/utils/getButtonOptions.d.ts +7 -0
- package/lib-esm/utils/getButtonOptions.js +15 -0
- package/lib-esm/utils/isDefined.d.ts +1 -0
- package/lib-esm/utils/isDefined.js +8 -0
- package/lib-esm/utils/keyboardUtils.d.ts +5 -0
- package/lib-esm/utils/keyboardUtils.js +14 -0
- package/lib-esm/utils/ownerWindow.d.ts +1 -0
- package/lib-esm/utils/ownerWindow.js +9 -0
- package/lib-esm/utils/processString.d.ts +13 -0
- package/lib-esm/utils/processString.js +27 -0
- package/lib-esm/utils/switchCase.d.ts +1 -0
- package/lib-esm/utils/switchCase.js +5 -0
- package/lib-esm/utils/testStories.utils.d.ts +99 -0
- package/lib-esm/utils/unstableStorybookMessage.utils.d.ts +1 -0
- package/lib-esm/utils/use-debounce.d.ts +1 -0
- package/lib-esm/utils/use-debounce.js +14 -0
- package/lib-esm/utils/useBreakpoint.d.ts +16 -0
- package/lib-esm/utils/useBreakpoint.js +42 -0
- package/lib-esm/utils/useEnhancedEffect.d.ts +7 -0
- package/lib-esm/utils/useEnhancedEffect.js +10 -0
- package/lib-esm/utils/useForkRef.d.ts +12 -0
- package/lib-esm/utils/useForkRef.js +39 -0
- package/lib-esm/utils/useFullTextTooltip.d.ts +15 -0
- package/lib-esm/utils/useFullTextTooltip.js +28 -0
- package/lib-esm/utils/useIsTriggerInteractive.d.ts +5 -0
- package/lib-esm/utils/useIsTriggerInteractive.js +21 -0
- package/lib-esm/utils/useMobile.d.ts +1 -0
- package/lib-esm/utils/useMobile.js +14 -0
- package/lib-esm/utils/useNamedSlots.hook.d.ts +2 -0
- package/lib-esm/utils/useNamedSlots.hook.js +10 -0
- package/lib-esm/utils/useScreenSize.d.ts +4 -0
- package/lib-esm/utils/useScreenSize.js +23 -0
- package/lib-esm/utils/useSubMenuFocus.hook.d.ts +2 -0
- package/lib-esm/utils/useSubMenuFocus.hook.js +39 -0
- package/lib-esm/utils/useUniqueId.d.ts +2 -0
- package/lib-esm/utils/useUniqueId.js +8 -0
- package/lib-esm/utils/waitForAnimation.d.ts +13 -0
- package/package.json +83 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { Minus, Plus } from '@box/blueprint-web-assets/icons/Fill';
|
|
5
|
+
import { IconButton } from '../primitives/icon-button/icon-button.js';
|
|
6
|
+
import { Tooltip } from '../tooltip/tooltip.js';
|
|
7
|
+
import styles from './slider-incrementer.module.js';
|
|
8
|
+
|
|
9
|
+
const SliderIncrementer = ({
|
|
10
|
+
children,
|
|
11
|
+
disabled,
|
|
12
|
+
max = 100,
|
|
13
|
+
min = 0,
|
|
14
|
+
minusButtonLabel,
|
|
15
|
+
minusButtonTooltipContent,
|
|
16
|
+
plusButtonLabel,
|
|
17
|
+
plusButtonTooltipContent,
|
|
18
|
+
setValue,
|
|
19
|
+
step = 1,
|
|
20
|
+
value
|
|
21
|
+
}) => {
|
|
22
|
+
const decrement = useCallback(() => {
|
|
23
|
+
const nextValue = value - step;
|
|
24
|
+
const cappedValue = nextValue < min ? min : nextValue;
|
|
25
|
+
setValue(cappedValue);
|
|
26
|
+
}, [min, setValue, step, value]);
|
|
27
|
+
const increment = useCallback(() => {
|
|
28
|
+
const nextValue = value + step;
|
|
29
|
+
const cappedValue = nextValue > max ? max : nextValue;
|
|
30
|
+
setValue(cappedValue);
|
|
31
|
+
}, [max, setValue, step, value]);
|
|
32
|
+
return jsxs("div", {
|
|
33
|
+
className: clsx(styles.container),
|
|
34
|
+
children: [jsx(Tooltip, {
|
|
35
|
+
content: minusButtonTooltipContent,
|
|
36
|
+
children: jsx(IconButton, {
|
|
37
|
+
"aria-label": minusButtonLabel,
|
|
38
|
+
disabled: disabled,
|
|
39
|
+
icon: Minus,
|
|
40
|
+
onClick: decrement,
|
|
41
|
+
size: "x-small"
|
|
42
|
+
})
|
|
43
|
+
}), children, jsx(Tooltip, {
|
|
44
|
+
content: plusButtonTooltipContent,
|
|
45
|
+
children: jsx(IconButton, {
|
|
46
|
+
"aria-label": plusButtonLabel,
|
|
47
|
+
disabled: disabled,
|
|
48
|
+
icon: Plus,
|
|
49
|
+
onClick: increment,
|
|
50
|
+
size: "x-small"
|
|
51
|
+
})
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
SliderIncrementer.displayName = 'SliderIncrementer';
|
|
56
|
+
|
|
57
|
+
export { SliderIncrementer };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type SliderRangeProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* An input where the user selects a value from within a given range.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SliderRange: import("react").ForwardRefExoticComponent<SliderRangeProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { forwardRef, useState, useCallback } from 'react';
|
|
5
|
+
import { useUniqueId } from '../utils/useUniqueId.js';
|
|
6
|
+
import styles from './slider-range.module.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* An input where the user selects a value from within a given range.
|
|
10
|
+
*/
|
|
11
|
+
const SliderRange = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
12
|
+
const {
|
|
13
|
+
className,
|
|
14
|
+
disabled,
|
|
15
|
+
label,
|
|
16
|
+
max = 2,
|
|
17
|
+
min = 0,
|
|
18
|
+
name,
|
|
19
|
+
onValueChange,
|
|
20
|
+
onValueCommit,
|
|
21
|
+
step,
|
|
22
|
+
value
|
|
23
|
+
} = props;
|
|
24
|
+
const sliderId = useUniqueId('slider-');
|
|
25
|
+
const sliderRootProps = {
|
|
26
|
+
disabled,
|
|
27
|
+
max,
|
|
28
|
+
min,
|
|
29
|
+
name,
|
|
30
|
+
onValueChange: newValue => onValueChange(newValue[0]),
|
|
31
|
+
onValueCommit: newValue => onValueCommit?.(newValue[0]),
|
|
32
|
+
step,
|
|
33
|
+
value: [value]
|
|
34
|
+
};
|
|
35
|
+
const [hasFocus, setHasFocus] = useState(false);
|
|
36
|
+
return jsx("div", {
|
|
37
|
+
className: clsx(styles.container, {
|
|
38
|
+
[styles.hasFocus]: hasFocus
|
|
39
|
+
}),
|
|
40
|
+
children: jsxs(SliderPrimitive.Root, {
|
|
41
|
+
className: clsx(styles.root, className, {
|
|
42
|
+
[styles.disabled]: disabled
|
|
43
|
+
}),
|
|
44
|
+
"data-testid": "Slider--root",
|
|
45
|
+
...sliderRootProps,
|
|
46
|
+
children: [jsx(SliderPrimitive.Track, {
|
|
47
|
+
className: styles.track,
|
|
48
|
+
children: jsx(SliderPrimitive.Range, {
|
|
49
|
+
id: sliderId
|
|
50
|
+
})
|
|
51
|
+
}), jsx(SliderPrimitive.Thumb, {
|
|
52
|
+
ref: forwardedRef,
|
|
53
|
+
"aria-label": label,
|
|
54
|
+
"aria-valuenow": value,
|
|
55
|
+
className: styles.thumb,
|
|
56
|
+
onBlur: useCallback(() => setHasFocus(false), []),
|
|
57
|
+
onFocus: useCallback(() => setHasFocus(true), []),
|
|
58
|
+
role: "slider"
|
|
59
|
+
})]
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
SliderRange.displayName = 'SliderRange';
|
|
64
|
+
|
|
65
|
+
export { SliderRange };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import '../index.css';
|
|
2
|
+
var styles = {"container":"slider-range-module_container__vpHaT","hasFocus":"slider-range-module_hasFocus__BuoDb","thumb":"slider-range-module_thumb__6P7XB","root":"slider-range-module_root__CfzE-","disabled":"slider-range-module_disabled__0RK6c","track":"slider-range-module_track__uvMjY"};
|
|
3
|
+
|
|
4
|
+
export { styles as default };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type SliderProps } from './types';
|
|
3
|
+
export declare const Slider: ((props: SliderProps) => JSX.Element) & {
|
|
4
|
+
Slider: import("react").ForwardRefExoticComponent<import("./types").SliderRangeProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { SliderIncrementer } from './slider-incrementer.js';
|
|
4
|
+
import { SliderRange } from './slider-range.js';
|
|
5
|
+
import styles from './slider.module.js';
|
|
6
|
+
|
|
7
|
+
const SliderRoot = props => {
|
|
8
|
+
const {
|
|
9
|
+
className,
|
|
10
|
+
disabled,
|
|
11
|
+
max,
|
|
12
|
+
min,
|
|
13
|
+
minusButtonLabel,
|
|
14
|
+
minusButtonTooltipContent,
|
|
15
|
+
onValueChange,
|
|
16
|
+
plusButtonLabel,
|
|
17
|
+
plusButtonTooltipContent,
|
|
18
|
+
sliderLabel,
|
|
19
|
+
step,
|
|
20
|
+
value
|
|
21
|
+
} = props;
|
|
22
|
+
return jsx("div", {
|
|
23
|
+
className: clsx(styles.container, className, {}),
|
|
24
|
+
children: jsx(SliderIncrementer, {
|
|
25
|
+
disabled: disabled,
|
|
26
|
+
max: max,
|
|
27
|
+
min: min,
|
|
28
|
+
minusButtonLabel: minusButtonLabel,
|
|
29
|
+
minusButtonTooltipContent: minusButtonTooltipContent ?? minusButtonLabel,
|
|
30
|
+
plusButtonLabel: plusButtonLabel,
|
|
31
|
+
plusButtonTooltipContent: plusButtonTooltipContent ?? plusButtonLabel,
|
|
32
|
+
setValue: onValueChange,
|
|
33
|
+
step: step,
|
|
34
|
+
value: value,
|
|
35
|
+
children: jsx(SliderRange, {
|
|
36
|
+
disabled: disabled,
|
|
37
|
+
label: sliderLabel,
|
|
38
|
+
max: max,
|
|
39
|
+
min: min,
|
|
40
|
+
onValueChange: onValueChange,
|
|
41
|
+
step: step,
|
|
42
|
+
value: value
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const Slider = Object.assign(SliderRoot, {
|
|
48
|
+
Slider: SliderRange
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export { Slider };
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { type SliderProps as RadixSliderProps } from '@radix-ui/react-slider';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
export interface SliderProps {
|
|
4
|
+
/**
|
|
5
|
+
* Extend the styles applied to the component.
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Localized (i.e. i18n) string used for aria-label and, if no minusButtonTooltipContent prop is provided, tooltip content
|
|
10
|
+
*/
|
|
11
|
+
minusButtonLabel: string;
|
|
12
|
+
/**
|
|
13
|
+
* Localized (i.e. i18n) string used to override minusButtonLabel for tooltip content
|
|
14
|
+
*
|
|
15
|
+
* @default minusButtonLabel
|
|
16
|
+
*/
|
|
17
|
+
minusButtonTooltipContent?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Localized (i.e. i18n) string used for aria-label and, if no plusButtonTooltipContent prop is provided, tooltip content
|
|
20
|
+
*/
|
|
21
|
+
plusButtonLabel: string;
|
|
22
|
+
/**
|
|
23
|
+
* Localized (i.e. i18n) string used to override minusButtonLabel for tooltip content
|
|
24
|
+
*
|
|
25
|
+
* @default plusButtonLabel
|
|
26
|
+
*/
|
|
27
|
+
plusButtonTooltipContent?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The label for the slider.
|
|
30
|
+
* Currently, only used for aria-label
|
|
31
|
+
*/
|
|
32
|
+
sliderLabel: string;
|
|
33
|
+
/**
|
|
34
|
+
* Change the component to the HTML tag or custom component of the only child. This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.
|
|
35
|
+
*
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
sliderAsChild?: RadixSliderProps['asChild'];
|
|
39
|
+
/**
|
|
40
|
+
* The name of the slider. Submitted with its owning form as part of a name/value pair.
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
sliderName?: RadixSliderProps['name'];
|
|
44
|
+
/**
|
|
45
|
+
* When true, prevents the user from interacting with the increment-stepper.
|
|
46
|
+
*
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The orientation of the slider.
|
|
52
|
+
*
|
|
53
|
+
* @default "horizontal"
|
|
54
|
+
*/
|
|
55
|
+
min?: number;
|
|
56
|
+
/**
|
|
57
|
+
* The maximum value for the range.
|
|
58
|
+
*
|
|
59
|
+
* @default 100
|
|
60
|
+
*/
|
|
61
|
+
max?: number;
|
|
62
|
+
/**
|
|
63
|
+
* The stepping interval.
|
|
64
|
+
*
|
|
65
|
+
* @default 1
|
|
66
|
+
*/
|
|
67
|
+
step?: number;
|
|
68
|
+
/**
|
|
69
|
+
* The controlled value of the increment-stepper. Must be used in conjunction with onValueChange.
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
value: number;
|
|
73
|
+
/**
|
|
74
|
+
* Event handler called when the value changes.
|
|
75
|
+
*/
|
|
76
|
+
onValueChange: (newValue: number) => void;
|
|
77
|
+
}
|
|
78
|
+
export interface SliderIncrementerProps {
|
|
79
|
+
children?: ReactNode;
|
|
80
|
+
/**
|
|
81
|
+
* When true, prevents the user from interacting with the incrementer.
|
|
82
|
+
*
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
disabled?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Localized (i.e. i18n) string used for aria-label and, if no minusButtonTooltipContent prop is provided, tooltip content
|
|
88
|
+
*/
|
|
89
|
+
minusButtonLabel: string;
|
|
90
|
+
/**
|
|
91
|
+
* Localized (i.e. i18n) string used for tooltip content
|
|
92
|
+
*/
|
|
93
|
+
minusButtonTooltipContent: string;
|
|
94
|
+
/**
|
|
95
|
+
* Localized (i.e. i18n) string used for aria-label and, if no plusButtonTooltipContent prop is provided, tooltip content
|
|
96
|
+
*/
|
|
97
|
+
plusButtonLabel: string;
|
|
98
|
+
/**
|
|
99
|
+
* Localized (i.e. i18n) string used for tooltip content
|
|
100
|
+
*/
|
|
101
|
+
plusButtonTooltipContent: string;
|
|
102
|
+
/**
|
|
103
|
+
* The minimum value for the range.
|
|
104
|
+
*
|
|
105
|
+
* @default "horizontal"
|
|
106
|
+
*/
|
|
107
|
+
min?: number;
|
|
108
|
+
/**
|
|
109
|
+
* The maximum value for the range.
|
|
110
|
+
*
|
|
111
|
+
* @default 100
|
|
112
|
+
*/
|
|
113
|
+
max?: number;
|
|
114
|
+
/**
|
|
115
|
+
* A function to update the state of values
|
|
116
|
+
*/
|
|
117
|
+
setValue: (val: number) => void;
|
|
118
|
+
/**
|
|
119
|
+
* The stepping interval.
|
|
120
|
+
*
|
|
121
|
+
* @default 1
|
|
122
|
+
*/
|
|
123
|
+
step?: number;
|
|
124
|
+
/**
|
|
125
|
+
* The controlled values of the slider. Must be used in conjunction with onValueChange.
|
|
126
|
+
*/
|
|
127
|
+
value: number;
|
|
128
|
+
}
|
|
129
|
+
export interface SliderRangeProps {
|
|
130
|
+
/**
|
|
131
|
+
* Extend the styles applied to the component.
|
|
132
|
+
*/
|
|
133
|
+
className?: string;
|
|
134
|
+
/**
|
|
135
|
+
* The name of the slider. Submitted with its owning form as part of a name/value pair.
|
|
136
|
+
*
|
|
137
|
+
*/
|
|
138
|
+
name?: RadixSliderProps['name'];
|
|
139
|
+
/**
|
|
140
|
+
* When true, prevents the user from interacting with the slider.
|
|
141
|
+
*
|
|
142
|
+
* @default false
|
|
143
|
+
*/
|
|
144
|
+
disabled?: RadixSliderProps['disabled'];
|
|
145
|
+
/**
|
|
146
|
+
* Localized (i.e. i18n) string used for aria-labe
|
|
147
|
+
*/
|
|
148
|
+
label: string;
|
|
149
|
+
/**
|
|
150
|
+
* The minimum value for the range.
|
|
151
|
+
*
|
|
152
|
+
* @default 0
|
|
153
|
+
*/
|
|
154
|
+
min?: RadixSliderProps['min'];
|
|
155
|
+
/**
|
|
156
|
+
* The maximum value for the range.
|
|
157
|
+
*
|
|
158
|
+
* @default 2
|
|
159
|
+
*/
|
|
160
|
+
max?: RadixSliderProps['max'];
|
|
161
|
+
/**
|
|
162
|
+
* The stepping interval.
|
|
163
|
+
*
|
|
164
|
+
* @default 1
|
|
165
|
+
*/
|
|
166
|
+
step?: RadixSliderProps['step'];
|
|
167
|
+
/**
|
|
168
|
+
* The controlled value of the slider. Must be used in conjunction with onValueChange.
|
|
169
|
+
* WARNING: it is not possible to prevent via types value from being set to a value outside of the min/max range.
|
|
170
|
+
* The component will adhere to min/max, but value could be initialized or updated externally to be out-of-bounds.
|
|
171
|
+
*/
|
|
172
|
+
value: number;
|
|
173
|
+
/**
|
|
174
|
+
* Event handler called when the value changes.
|
|
175
|
+
*/
|
|
176
|
+
onValueChange: (value: SliderRangeProps['value']) => void;
|
|
177
|
+
/**
|
|
178
|
+
* Event handler called when the value changes at the end of an interaction. Useful when you only need to capture a final value e.g. to update a backend service.
|
|
179
|
+
*/
|
|
180
|
+
onValueCommit?: (value: SliderRangeProps['value']) => void;
|
|
181
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SurfaceStatusSurfaceGray, SurfaceStatusSurfaceYellow, SurfaceStatusSurfaceOrange, SurfaceStatusSurfaceRed, SurfaceStatusSurfacePurple, SurfaceStatusSurfaceLightBlue, SurfaceStatusSurfaceDarkBlue, SurfaceStatusSurfaceGreen } from '@box/blueprint-web-assets/tokens/tokens';
|
|
2
|
+
|
|
3
|
+
const colorsMap = {
|
|
4
|
+
SurfaceStatusSurfaceGray,
|
|
5
|
+
SurfaceStatusSurfaceYellow,
|
|
6
|
+
SurfaceStatusSurfaceOrange,
|
|
7
|
+
SurfaceStatusSurfaceRed,
|
|
8
|
+
SurfaceStatusSurfacePurple,
|
|
9
|
+
SurfaceStatusSurfaceLightBlue,
|
|
10
|
+
SurfaceStatusSurfaceDarkBlue,
|
|
11
|
+
SurfaceStatusSurfaceGreen
|
|
12
|
+
};
|
|
13
|
+
const colorToTokenMap = {
|
|
14
|
+
[SurfaceStatusSurfaceGray]: 'SurfaceStatusSurfaceGray',
|
|
15
|
+
[SurfaceStatusSurfaceYellow]: 'SurfaceStatusSurfaceYellow',
|
|
16
|
+
[SurfaceStatusSurfaceOrange]: 'SurfaceStatusSurfaceOrange',
|
|
17
|
+
[SurfaceStatusSurfaceRed]: 'SurfaceStatusSurfaceRed',
|
|
18
|
+
[SurfaceStatusSurfacePurple]: 'SurfaceStatusSurfacePurple',
|
|
19
|
+
[SurfaceStatusSurfaceLightBlue]: 'SurfaceStatusSurfaceLightBlue',
|
|
20
|
+
[SurfaceStatusSurfaceDarkBlue]: 'SurfaceStatusSurfaceDarkBlue',
|
|
21
|
+
[SurfaceStatusSurfaceGreen]: 'SurfaceStatusSurfaceGreen'
|
|
22
|
+
};
|
|
23
|
+
const colors = Object.values(colorsMap);
|
|
24
|
+
|
|
25
|
+
export { colorToTokenMap, colors, colorsMap };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { IconIconOnLight } from '@box/blueprint-web-assets/tokens/tokens';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { forwardRef, useMemo, createElement } from 'react';
|
|
5
|
+
import { colorToTokenMap, colors, colorsMap } from './consts.js';
|
|
6
|
+
import styles from './status.module.js';
|
|
7
|
+
|
|
8
|
+
const getColorFromColorsMap = index => {
|
|
9
|
+
const colorIndex = (index || 0) % colors.length;
|
|
10
|
+
return Object.values(colorsMap)[colorIndex];
|
|
11
|
+
};
|
|
12
|
+
const Status = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
13
|
+
const {
|
|
14
|
+
text,
|
|
15
|
+
hideText,
|
|
16
|
+
interactive,
|
|
17
|
+
iconPosition = 'right',
|
|
18
|
+
icon,
|
|
19
|
+
color,
|
|
20
|
+
colorIndex,
|
|
21
|
+
className,
|
|
22
|
+
'aria-label': ariaLabel,
|
|
23
|
+
...rest
|
|
24
|
+
} = props;
|
|
25
|
+
const backgroundColor = useMemo(() => {
|
|
26
|
+
const bgColor = color || getColorFromColorsMap(colorIndex);
|
|
27
|
+
return colorToTokenMap[bgColor] || 'SurfaceStatusSurfaceGray';
|
|
28
|
+
}, [color, colorIndex]);
|
|
29
|
+
const iconElement = useMemo(() => {
|
|
30
|
+
if (!icon) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const iconProps = {
|
|
34
|
+
width: '0.875rem',
|
|
35
|
+
height: '0.875rem',
|
|
36
|
+
color: IconIconOnLight
|
|
37
|
+
};
|
|
38
|
+
// If Status is interactive we put aria-label on the button
|
|
39
|
+
if (interactive || !interactive && !hideText && text) {
|
|
40
|
+
return /*#__PURE__*/createElement(icon, {
|
|
41
|
+
...iconProps,
|
|
42
|
+
role: 'presentation'
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
// Not interactive, icon-only Status
|
|
46
|
+
return /*#__PURE__*/createElement(icon, {
|
|
47
|
+
...iconProps,
|
|
48
|
+
role: 'img',
|
|
49
|
+
'aria-label': ariaLabel || text
|
|
50
|
+
});
|
|
51
|
+
}, [icon, hideText, interactive, text, ariaLabel]);
|
|
52
|
+
const contents = jsxs(Fragment, {
|
|
53
|
+
children: [text && !hideText && jsx("span", {
|
|
54
|
+
className: styles.text,
|
|
55
|
+
children: text
|
|
56
|
+
}), iconElement]
|
|
57
|
+
});
|
|
58
|
+
const commonClassName = clsx(styles.status, styles[`color${backgroundColor}`], {
|
|
59
|
+
[styles.reverse]: icon && iconPosition === 'left',
|
|
60
|
+
[styles.circle]: hideText
|
|
61
|
+
});
|
|
62
|
+
const innerElement = interactive ? jsx("button", {
|
|
63
|
+
...rest,
|
|
64
|
+
ref: forwardedRef,
|
|
65
|
+
"aria-label": props['aria-label'] || text,
|
|
66
|
+
className: clsx(styles.interactiveStatus, commonClassName),
|
|
67
|
+
type: "button",
|
|
68
|
+
children: contents
|
|
69
|
+
}) : jsx("span", {
|
|
70
|
+
...rest,
|
|
71
|
+
ref: forwardedRef,
|
|
72
|
+
className: commonClassName,
|
|
73
|
+
children: contents
|
|
74
|
+
});
|
|
75
|
+
return jsx("span", {
|
|
76
|
+
className: clsx(styles.maxContainer, className),
|
|
77
|
+
children: innerElement
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
Status.displayName = 'Status';
|
|
81
|
+
|
|
82
|
+
export { Status };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import '../index.css';
|
|
2
|
+
var styles = {"interactiveStatus":"status-module_interactiveStatus__JVpMC","status":"status-module_status__ovaDk","reverse":"status-module_reverse__uEGPj","circle":"status-module_circle__amoA6","text":"status-module_text__ZNwzN","maxContainer":"status-module_maxContainer__v4jJW","colorSurfaceStatusSurfaceGray":"status-module_colorSurfaceStatusSurfaceGray__YmSqS","colorSurfaceStatusSurfaceYellow":"status-module_colorSurfaceStatusSurfaceYellow__hBUjh","colorSurfaceStatusSurfaceOrange":"status-module_colorSurfaceStatusSurfaceOrange__Q9ixI","colorSurfaceStatusSurfaceRed":"status-module_colorSurfaceStatusSurfaceRed__wdgd3","colorSurfaceStatusSurfacePurple":"status-module_colorSurfaceStatusSurfacePurple__1Uq6u","colorSurfaceStatusSurfaceLightBlue":"status-module_colorSurfaceStatusSurfaceLightBlue__HftTU","colorSurfaceStatusSurfaceDarkBlue":"status-module_colorSurfaceStatusSurfaceDarkBlue__J7PvX","colorSurfaceStatusSurfaceGreen":"status-module_colorSurfaceStatusSurfaceGreen__ibLGb"};
|
|
3
|
+
|
|
4
|
+
export { styles as default };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type SurfaceStatusSurfaceDarkBlue, type SurfaceStatusSurfaceGray, type SurfaceStatusSurfaceGreen, type SurfaceStatusSurfaceLightBlue, type SurfaceStatusSurfaceOrange, type SurfaceStatusSurfacePurple, type SurfaceStatusSurfaceRed, type SurfaceStatusSurfaceYellow } from '@box/blueprint-web-assets/tokens/tokens';
|
|
2
|
+
import { type FunctionComponent, type HTMLAttributes, type PropsWithChildren, type SVGProps } from 'react';
|
|
3
|
+
import { type RequireExactlyOne } from 'type-fest';
|
|
4
|
+
export type Color = typeof SurfaceStatusSurfaceGray | typeof SurfaceStatusSurfaceYellow | typeof SurfaceStatusSurfaceOrange | typeof SurfaceStatusSurfaceRed | typeof SurfaceStatusSurfacePurple | typeof SurfaceStatusSurfaceLightBlue | typeof SurfaceStatusSurfaceDarkBlue | typeof SurfaceStatusSurfaceGreen;
|
|
5
|
+
type ColorProps = {
|
|
6
|
+
/** The color of the background. Takes precedence over colorIndex. */
|
|
7
|
+
color?: Color;
|
|
8
|
+
/** The index of the color of the status background. It will cycle through all the colors in the table.
|
|
9
|
+
* A convenience replacement for the color prop, when the color itself does not matter,
|
|
10
|
+
* and what matters is that the subsequent status-backgrounds are different
|
|
11
|
+
* It is ignored when the color prop is provided. */
|
|
12
|
+
colorIndex?: number;
|
|
13
|
+
};
|
|
14
|
+
type CommonProps = {
|
|
15
|
+
/** Text inside the Status. Needs to be an UPPERCASED string. */
|
|
16
|
+
text: string;
|
|
17
|
+
/** Hide the text, it is still visible to screen readers */
|
|
18
|
+
hideText?: boolean;
|
|
19
|
+
/** Should the component be interactive (button without onClick) */
|
|
20
|
+
interactive?: boolean;
|
|
21
|
+
/** Position of the icon */
|
|
22
|
+
iconPosition?: 'right' | 'left';
|
|
23
|
+
/** Icon Component to display */
|
|
24
|
+
icon?: FunctionComponent<PropsWithChildren<SVGProps<SVGSVGElement>>>;
|
|
25
|
+
} & RequireExactlyOne<ColorProps>;
|
|
26
|
+
export type StatusProps = (CommonProps & {
|
|
27
|
+
interactive?: false;
|
|
28
|
+
} & HTMLAttributes<HTMLSpanElement>) | (CommonProps & {
|
|
29
|
+
interactive: true;
|
|
30
|
+
} & HTMLAttributes<HTMLButtonElement>);
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Legend } from './switch-legend';
|
|
3
|
+
export { type LegendProps } from '../util-components/legend/types';
|
|
4
|
+
export { type SwitchProps } from './types';
|
|
5
|
+
export declare const Switch: {
|
|
6
|
+
Item: import("react").ForwardRefExoticComponent<import("./types").SwitchProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
Legend: typeof Legend;
|
|
8
|
+
};
|
|
9
|
+
export default Switch;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type SwitchProps } from './types';
|
|
3
|
+
/** Switch.Item needs to be wrapped with TooltipElement.Provider -
|
|
4
|
+
or ideally you should have your App wrapped with it. */
|
|
5
|
+
export declare const Switch: import("react").ForwardRefExoticComponent<SwitchProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import * as RadixSwitch from '@radix-ui/react-switch';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { TextWithInfoBadge } from '../util-components/text-with-info-badge/text-with-info-badge.js';
|
|
6
|
+
import { useUniqueId } from '../utils/useUniqueId.js';
|
|
7
|
+
import styles from './switch.module.js';
|
|
8
|
+
|
|
9
|
+
/** Switch.Item needs to be wrapped with TooltipElement.Provider -
|
|
10
|
+
or ideally you should have your App wrapped with it. */
|
|
11
|
+
const Switch = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
12
|
+
const {
|
|
13
|
+
checked,
|
|
14
|
+
className,
|
|
15
|
+
description,
|
|
16
|
+
descriptionInfoBadgeAriaLabel,
|
|
17
|
+
descriptionInfoText,
|
|
18
|
+
disabled,
|
|
19
|
+
label,
|
|
20
|
+
labelInfoText,
|
|
21
|
+
labelInfoBadgeAriaLabel,
|
|
22
|
+
onCheckedChange,
|
|
23
|
+
rightAligned: isRightAligned,
|
|
24
|
+
...rest
|
|
25
|
+
} = props;
|
|
26
|
+
const descriptionId = useUniqueId('description-', !!description);
|
|
27
|
+
return jsxs("div", {
|
|
28
|
+
className: clsx([styles.option], {
|
|
29
|
+
[styles.disabled]: disabled
|
|
30
|
+
}, className),
|
|
31
|
+
children: [jsxs("label", {
|
|
32
|
+
className: clsx(styles.label, {
|
|
33
|
+
[styles.rightAlign]: isRightAligned
|
|
34
|
+
}),
|
|
35
|
+
children: [jsx(RadixSwitch.Root, {
|
|
36
|
+
...rest,
|
|
37
|
+
ref: forwardedRef,
|
|
38
|
+
"aria-describedby": descriptionId,
|
|
39
|
+
"aria-label": label,
|
|
40
|
+
checked: checked,
|
|
41
|
+
className: clsx(styles.switch, {
|
|
42
|
+
[styles.rightAlign]: isRightAligned
|
|
43
|
+
}),
|
|
44
|
+
disabled: disabled,
|
|
45
|
+
onCheckedChange: onCheckedChange,
|
|
46
|
+
title: label,
|
|
47
|
+
children: jsx(RadixSwitch.Thumb, {
|
|
48
|
+
className: styles.thumb
|
|
49
|
+
})
|
|
50
|
+
}), jsx(TextWithInfoBadge, {
|
|
51
|
+
infoBadgeAriaLabel: labelInfoBadgeAriaLabel,
|
|
52
|
+
infoText: labelInfoText,
|
|
53
|
+
variant: disabled ? 'muted' : 'default',
|
|
54
|
+
children: label
|
|
55
|
+
})]
|
|
56
|
+
}), description ? jsx("div", {
|
|
57
|
+
className: clsx(styles.description, {
|
|
58
|
+
[styles.rightAlign]: isRightAligned
|
|
59
|
+
}),
|
|
60
|
+
children: jsx(TextWithInfoBadge, {
|
|
61
|
+
id: descriptionId,
|
|
62
|
+
infoBadgeAriaLabel: descriptionInfoBadgeAriaLabel,
|
|
63
|
+
infoText: descriptionInfoText,
|
|
64
|
+
variant: "muted",
|
|
65
|
+
children: description
|
|
66
|
+
})
|
|
67
|
+
}) : null]
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export { Switch };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import '../index.css';
|
|
2
|
+
var styles = {"option":"switch-module_option__dAwWj","label":"switch-module_label__Vbkvx","rightAlign":"switch-module_rightAlign__nZ5d0","description":"switch-module_description__I2U2u","switch":"switch-module_switch__Kd2d5","thumb":"switch-module_thumb__g-8Q4","disabled":"switch-module_disabled__4MlGg"};
|
|
3
|
+
|
|
4
|
+
export { styles as default };
|