@unofficialbox/box-open-elements 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -12
- package/dist/components/actions/button-group.d.ts +2 -2
- package/dist/components/actions/button-group.js +3 -9
- package/dist/components/actions/button.d.ts +2 -2
- package/dist/components/actions/button.js +3 -9
- package/dist/components/actions/icon-button.d.ts +2 -2
- package/dist/components/actions/icon-button.js +3 -9
- package/dist/components/actions/link-button.d.ts +11 -2
- package/dist/components/actions/link-button.js +58 -13
- package/dist/components/actions/menu-item.d.ts +2 -2
- package/dist/components/actions/menu-item.js +3 -9
- package/dist/components/actions/menu.d.ts +2 -2
- package/dist/components/actions/menu.js +3 -9
- package/dist/components/actions/segmented-control.d.ts +2 -2
- package/dist/components/actions/segmented-control.js +3 -9
- package/dist/components/collections/card.d.ts +2 -2
- package/dist/components/collections/card.js +3 -9
- package/dist/components/collections/carousel.d.ts +9 -2
- package/dist/components/collections/carousel.js +74 -13
- package/dist/components/collections/datalist-item.d.ts +8 -2
- package/dist/components/collections/datalist-item.js +42 -10
- package/dist/components/collections/draggable-list.d.ts +2 -2
- package/dist/components/collections/draggable-list.js +4 -10
- package/dist/components/collections/grid-view.d.ts +2 -2
- package/dist/components/collections/grid-view.js +10 -12
- package/dist/components/collections/pagination.d.ts +2 -2
- package/dist/components/collections/pagination.js +3 -9
- package/dist/components/collections/table.d.ts +2 -2
- package/dist/components/collections/table.js +3 -9
- package/dist/components/collections/thumbnail-card.d.ts +2 -2
- package/dist/components/collections/thumbnail-card.js +3 -9
- package/dist/components/collections/tree-grid.d.ts +2 -2
- package/dist/components/collections/tree-grid.js +3 -9
- package/dist/components/collections/tree.d.ts +2 -2
- package/dist/components/collections/tree.js +3 -9
- package/dist/components/feedback/alert.d.ts +4 -2
- package/dist/components/feedback/alert.js +33 -10
- package/dist/components/feedback/badge.d.ts +12 -2
- package/dist/components/feedback/badge.js +73 -13
- package/dist/components/feedback/badgeable.d.ts +2 -2
- package/dist/components/feedback/badgeable.js +3 -9
- package/dist/components/feedback/chip.d.ts +7 -2
- package/dist/components/feedback/chip.js +77 -11
- package/dist/components/feedback/empty-state.d.ts +2 -2
- package/dist/components/feedback/empty-state.js +3 -9
- package/dist/components/feedback/error-mask.d.ts +4 -2
- package/dist/components/feedback/error-mask.js +26 -9
- package/dist/components/feedback/help-text.d.ts +2 -2
- package/dist/components/feedback/help-text.js +10 -9
- package/dist/components/feedback/nudge.d.ts +2 -2
- package/dist/components/feedback/nudge.js +3 -9
- package/dist/components/feedback/progress-bar.d.ts +2 -2
- package/dist/components/feedback/progress-bar.js +3 -9
- package/dist/components/feedback/progress-ring.d.ts +2 -2
- package/dist/components/feedback/progress-ring.js +3 -9
- package/dist/components/feedback/progress-steps.d.ts +2 -2
- package/dist/components/feedback/progress-steps.js +3 -9
- package/dist/components/feedback/skeleton.d.ts +2 -2
- package/dist/components/feedback/skeleton.js +3 -9
- package/dist/components/feedback/spinner.d.ts +6 -2
- package/dist/components/feedback/spinner.js +33 -11
- package/dist/components/feedback/toast.d.ts +7 -2
- package/dist/components/feedback/toast.js +62 -20
- package/dist/components/files/drop-zone.d.ts +2 -2
- package/dist/components/files/drop-zone.js +3 -9
- package/dist/components/forms/calendar.d.ts +2 -2
- package/dist/components/forms/calendar.js +3 -9
- package/dist/components/forms/category-selector.d.ts +13 -2
- package/dist/components/forms/category-selector.js +214 -26
- package/dist/components/forms/checkbox-group.d.ts +2 -2
- package/dist/components/forms/checkbox-group.js +3 -9
- package/dist/components/forms/checkbox.d.ts +8 -2
- package/dist/components/forms/checkbox.js +61 -10
- package/dist/components/forms/color-picker.d.ts +2 -2
- package/dist/components/forms/color-picker.js +3 -9
- package/dist/components/forms/combobox.d.ts +32 -3
- package/dist/components/forms/combobox.js +351 -53
- package/dist/components/forms/date-field.d.ts +9 -2
- package/dist/components/forms/date-field.js +76 -10
- package/dist/components/forms/dropdown.d.ts +7 -2
- package/dist/components/forms/dropdown.js +35 -12
- package/dist/components/forms/dual-listbox.d.ts +2 -2
- package/dist/components/forms/dual-listbox.js +3 -9
- package/dist/components/forms/fieldset.d.ts +2 -2
- package/dist/components/forms/fieldset.js +3 -9
- package/dist/components/forms/multi-select.d.ts +2 -2
- package/dist/components/forms/multi-select.js +3 -9
- package/dist/components/forms/number-input.d.ts +2 -2
- package/dist/components/forms/number-input.js +3 -9
- package/dist/components/forms/pill-cloud.d.ts +2 -2
- package/dist/components/forms/pill-cloud.js +3 -9
- package/dist/components/forms/pill-selector-dropdown.d.ts +2 -2
- package/dist/components/forms/pill-selector-dropdown.js +3 -9
- package/dist/components/forms/radio-group.d.ts +11 -10
- package/dist/components/forms/radio-group.js +46 -15
- package/dist/components/forms/range-slider.d.ts +2 -2
- package/dist/components/forms/range-slider.js +3 -9
- package/dist/components/forms/rating.d.ts +2 -2
- package/dist/components/forms/rating.js +3 -9
- package/dist/components/forms/rich-text-input.d.ts +2 -2
- package/dist/components/forms/rich-text-input.js +3 -9
- package/dist/components/forms/search-field.d.ts +10 -2
- package/dist/components/forms/search-field.js +58 -22
- package/dist/components/forms/select.d.ts +20 -10
- package/dist/components/forms/select.js +107 -23
- package/dist/components/forms/slider.d.ts +2 -2
- package/dist/components/forms/slider.js +3 -9
- package/dist/components/forms/spin-button.d.ts +2 -2
- package/dist/components/forms/spin-button.js +3 -9
- package/dist/components/forms/switch.d.ts +2 -2
- package/dist/components/forms/switch.js +3 -9
- package/dist/components/forms/tag-input.d.ts +2 -2
- package/dist/components/forms/tag-input.js +3 -9
- package/dist/components/forms/text-area.d.ts +2 -2
- package/dist/components/forms/text-area.js +3 -9
- package/dist/components/forms/text-field.d.ts +15 -2
- package/dist/components/forms/text-field.js +139 -10
- package/dist/components/forms/time-field.d.ts +13 -2
- package/dist/components/forms/time-field.js +54 -9
- package/dist/components/identity/avatar.d.ts +6 -2
- package/dist/components/identity/avatar.js +68 -10
- package/dist/components/identity/contact-datalist-item.d.ts +10 -2
- package/dist/components/identity/contact-datalist-item.js +74 -11
- package/dist/components/identity/persona.d.ts +2 -2
- package/dist/components/identity/persona.js +3 -9
- package/dist/components/layout/app-shell.d.ts +2 -2
- package/dist/components/layout/app-shell.js +3 -9
- package/dist/components/layout/divider.d.ts +2 -2
- package/dist/components/layout/divider.js +3 -9
- package/dist/components/layout/nav-sidebar.d.ts +2 -2
- package/dist/components/layout/nav-sidebar.js +26 -9
- package/dist/components/layout/section.d.ts +2 -2
- package/dist/components/layout/section.js +3 -9
- package/dist/components/layout/sidebar-toggle-button.d.ts +5 -2
- package/dist/components/layout/sidebar-toggle-button.js +24 -11
- package/dist/components/layout/split-view.d.ts +2 -2
- package/dist/components/layout/split-view.js +3 -9
- package/dist/components/navigation/accordion.d.ts +5 -2
- package/dist/components/navigation/accordion.js +20 -11
- package/dist/components/navigation/breadcrumb.d.ts +2 -2
- package/dist/components/navigation/breadcrumb.js +3 -9
- package/dist/components/navigation/tabs.d.ts +2 -2
- package/dist/components/navigation/tabs.js +3 -9
- package/dist/components/overlays/context-menu.d.ts +2 -2
- package/dist/components/overlays/context-menu.js +3 -9
- package/dist/components/overlays/dialog.d.ts +2 -2
- package/dist/components/overlays/dialog.js +3 -9
- package/dist/components/overlays/drawer.d.ts +2 -2
- package/dist/components/overlays/drawer.js +3 -9
- package/dist/components/overlays/guide-tooltip.d.ts +51 -0
- package/dist/components/overlays/guide-tooltip.js +355 -0
- package/dist/components/overlays/popover.d.ts +2 -2
- package/dist/components/overlays/popover.js +3 -9
- package/dist/components/overlays/tooltip.d.ts +12 -2
- package/dist/components/overlays/tooltip.js +77 -20
- package/dist/components/visuals/illustration.d.ts +2 -2
- package/dist/components/visuals/illustration.js +3 -9
- package/dist/core/element.d.ts +5 -1
- package/dist/core/element.js +29 -1
- package/dist/entries/access-stats.d.ts +1 -0
- package/dist/entries/access-stats.js +1 -0
- package/dist/entries/accordion.d.ts +1 -0
- package/dist/entries/accordion.js +1 -0
- package/dist/entries/alert.d.ts +1 -0
- package/dist/entries/alert.js +1 -0
- package/dist/entries/annotation-inspector.d.ts +1 -0
- package/dist/entries/annotation-inspector.js +1 -0
- package/dist/entries/annotation-thread.d.ts +1 -0
- package/dist/entries/annotation-thread.js +1 -0
- package/dist/entries/annotation-toolbar.d.ts +1 -0
- package/dist/entries/annotation-toolbar.js +1 -0
- package/dist/entries/app-shell.d.ts +1 -0
- package/dist/entries/app-shell.js +1 -0
- package/dist/entries/avatar.d.ts +1 -0
- package/dist/entries/avatar.js +1 -0
- package/dist/entries/badge.d.ts +1 -0
- package/dist/entries/badge.js +1 -0
- package/dist/entries/badgeable.d.ts +1 -0
- package/dist/entries/badgeable.js +1 -0
- package/dist/entries/bar-chart.d.ts +1 -0
- package/dist/entries/bar-chart.js +1 -0
- package/dist/entries/breadcrumb.d.ts +1 -0
- package/dist/entries/breadcrumb.js +1 -0
- package/dist/entries/bulk-action-bar.d.ts +1 -0
- package/dist/entries/bulk-action-bar.js +1 -0
- package/dist/entries/button-group.d.ts +1 -0
- package/dist/entries/button-group.js +1 -0
- package/dist/entries/button.d.ts +1 -0
- package/dist/entries/button.js +1 -0
- package/dist/entries/calendar.d.ts +1 -0
- package/dist/entries/calendar.js +1 -0
- package/dist/entries/card.d.ts +1 -0
- package/dist/entries/card.js +1 -0
- package/dist/entries/carousel.d.ts +1 -0
- package/dist/entries/carousel.js +1 -0
- package/dist/entries/category-selector.d.ts +1 -0
- package/dist/entries/category-selector.js +1 -0
- package/dist/entries/chart-panel.d.ts +1 -0
- package/dist/entries/chart-panel.js +1 -0
- package/dist/entries/checkbox-group.d.ts +1 -0
- package/dist/entries/checkbox-group.js +1 -0
- package/dist/entries/checkbox.d.ts +1 -0
- package/dist/entries/checkbox.js +1 -0
- package/dist/entries/chip.d.ts +1 -0
- package/dist/entries/chip.js +1 -0
- package/dist/entries/collaborator-avatars.d.ts +1 -0
- package/dist/entries/collaborator-avatars.js +1 -0
- package/dist/entries/color-picker.d.ts +1 -0
- package/dist/entries/color-picker.js +1 -0
- package/dist/entries/combobox.d.ts +1 -0
- package/dist/entries/combobox.js +1 -0
- package/dist/entries/contact-datalist-item.d.ts +1 -0
- package/dist/entries/contact-datalist-item.js +1 -0
- package/dist/entries/content-explorer.d.ts +1 -0
- package/dist/entries/content-explorer.js +1 -0
- package/dist/entries/context-menu.d.ts +1 -0
- package/dist/entries/context-menu.js +1 -0
- package/dist/entries/datalist-item.d.ts +1 -0
- package/dist/entries/datalist-item.js +1 -0
- package/dist/entries/date-field.d.ts +1 -0
- package/dist/entries/date-field.js +1 -0
- package/dist/entries/dialog.d.ts +1 -0
- package/dist/entries/dialog.js +1 -0
- package/dist/entries/divider.d.ts +1 -0
- package/dist/entries/divider.js +1 -0
- package/dist/entries/donut-chart.d.ts +1 -0
- package/dist/entries/donut-chart.js +1 -0
- package/dist/entries/draggable-list.d.ts +1 -0
- package/dist/entries/draggable-list.js +1 -0
- package/dist/entries/drawer.d.ts +1 -0
- package/dist/entries/drawer.js +1 -0
- package/dist/entries/drop-zone.d.ts +1 -0
- package/dist/entries/drop-zone.js +1 -0
- package/dist/entries/dropdown.d.ts +1 -0
- package/dist/entries/dropdown.js +1 -0
- package/dist/entries/dual-listbox.d.ts +1 -0
- package/dist/entries/dual-listbox.js +1 -0
- package/dist/entries/empty-state.d.ts +1 -0
- package/dist/entries/empty-state.js +1 -0
- package/dist/entries/error-mask.d.ts +1 -0
- package/dist/entries/error-mask.js +1 -0
- package/dist/entries/explorer-action-menu.d.ts +1 -0
- package/dist/entries/explorer-action-menu.js +1 -0
- package/dist/entries/explorer-breadcrumbs.d.ts +1 -0
- package/dist/entries/explorer-breadcrumbs.js +1 -0
- package/dist/entries/explorer-items.d.ts +1 -0
- package/dist/entries/explorer-items.js +1 -0
- package/dist/entries/explorer-list.d.ts +1 -0
- package/dist/entries/explorer-list.js +1 -0
- package/dist/entries/explorer-table.d.ts +1 -0
- package/dist/entries/explorer-table.js +1 -0
- package/dist/entries/explorer-toolbar.d.ts +1 -0
- package/dist/entries/explorer-toolbar.js +1 -0
- package/dist/entries/fieldset.d.ts +1 -0
- package/dist/entries/fieldset.js +1 -0
- package/dist/entries/file-request-builder.d.ts +1 -0
- package/dist/entries/file-request-builder.js +1 -0
- package/dist/entries/filter-bar.d.ts +1 -0
- package/dist/entries/filter-bar.js +1 -0
- package/dist/entries/governance-panel.d.ts +1 -0
- package/dist/entries/governance-panel.js +1 -0
- package/dist/entries/grid-view.d.ts +1 -0
- package/dist/entries/grid-view.js +1 -0
- package/dist/entries/guide-tooltip.d.ts +1 -0
- package/dist/entries/guide-tooltip.js +1 -0
- package/dist/entries/help-text.d.ts +1 -0
- package/dist/entries/help-text.js +1 -0
- package/dist/entries/icon-button.d.ts +1 -0
- package/dist/entries/icon-button.js +1 -0
- package/dist/entries/illustration.d.ts +1 -0
- package/dist/entries/illustration.js +1 -0
- package/dist/entries/invite-collaborators-modal.d.ts +1 -0
- package/dist/entries/invite-collaborators-modal.js +1 -0
- package/dist/entries/item-details-panel.d.ts +1 -0
- package/dist/entries/item-details-panel.js +1 -0
- package/dist/entries/item-form.d.ts +1 -0
- package/dist/entries/item-form.js +1 -0
- package/dist/entries/line-chart.d.ts +1 -0
- package/dist/entries/line-chart.js +1 -0
- package/dist/entries/link-button.d.ts +1 -0
- package/dist/entries/link-button.js +1 -0
- package/dist/entries/menu-item.d.ts +1 -0
- package/dist/entries/menu-item.js +1 -0
- package/dist/entries/menu.d.ts +1 -0
- package/dist/entries/menu.js +1 -0
- package/dist/entries/metadata-filter-builder.d.ts +1 -0
- package/dist/entries/metadata-filter-builder.js +1 -0
- package/dist/entries/metadata-inspector.d.ts +1 -0
- package/dist/entries/metadata-inspector.js +1 -0
- package/dist/entries/metric-card.d.ts +1 -0
- package/dist/entries/metric-card.js +1 -0
- package/dist/entries/multi-select.d.ts +1 -0
- package/dist/entries/multi-select.js +1 -0
- package/dist/entries/nav-sidebar.d.ts +1 -0
- package/dist/entries/nav-sidebar.js +1 -0
- package/dist/entries/nudge.d.ts +1 -0
- package/dist/entries/nudge.js +1 -0
- package/dist/entries/number-input.d.ts +1 -0
- package/dist/entries/number-input.js +1 -0
- package/dist/entries/pagination.d.ts +1 -0
- package/dist/entries/pagination.js +1 -0
- package/dist/entries/permission-matrix.d.ts +1 -0
- package/dist/entries/permission-matrix.js +1 -0
- package/dist/entries/persona.d.ts +1 -0
- package/dist/entries/persona.js +1 -0
- package/dist/entries/pill-cloud.d.ts +1 -0
- package/dist/entries/pill-cloud.js +1 -0
- package/dist/entries/pill-selector-dropdown.d.ts +1 -0
- package/dist/entries/pill-selector-dropdown.js +1 -0
- package/dist/entries/popover.d.ts +1 -0
- package/dist/entries/popover.js +1 -0
- package/dist/entries/presence.d.ts +1 -0
- package/dist/entries/presence.js +1 -0
- package/dist/entries/preview-header.d.ts +1 -0
- package/dist/entries/preview-header.js +1 -0
- package/dist/entries/preview.d.ts +1 -0
- package/dist/entries/preview.js +1 -0
- package/dist/entries/progress-bar.d.ts +1 -0
- package/dist/entries/progress-bar.js +1 -0
- package/dist/entries/progress-ring.d.ts +1 -0
- package/dist/entries/progress-ring.js +1 -0
- package/dist/entries/progress-steps.d.ts +1 -0
- package/dist/entries/progress-steps.js +1 -0
- package/dist/entries/radio-group.d.ts +1 -0
- package/dist/entries/radio-group.js +1 -0
- package/dist/entries/range-slider.d.ts +1 -0
- package/dist/entries/range-slider.js +1 -0
- package/dist/entries/rating.d.ts +1 -0
- package/dist/entries/rating.js +1 -0
- package/dist/entries/review-queue-item.d.ts +1 -0
- package/dist/entries/review-queue-item.js +1 -0
- package/dist/entries/rich-text-input.d.ts +1 -0
- package/dist/entries/rich-text-input.js +1 -0
- package/dist/entries/saved-view-picker.d.ts +1 -0
- package/dist/entries/saved-view-picker.js +1 -0
- package/dist/entries/search-field.d.ts +1 -0
- package/dist/entries/search-field.js +1 -0
- package/dist/entries/search-results-header.d.ts +1 -0
- package/dist/entries/search-results-header.js +1 -0
- package/dist/entries/section.d.ts +1 -0
- package/dist/entries/section.js +1 -0
- package/dist/entries/segmented-control.d.ts +1 -0
- package/dist/entries/segmented-control.js +1 -0
- package/dist/entries/select.d.ts +1 -0
- package/dist/entries/select.js +1 -0
- package/dist/entries/share-panel.d.ts +1 -0
- package/dist/entries/share-panel.js +1 -0
- package/dist/entries/sidebar-toggle-button.d.ts +1 -0
- package/dist/entries/sidebar-toggle-button.js +1 -0
- package/dist/entries/skeleton.d.ts +1 -0
- package/dist/entries/skeleton.js +1 -0
- package/dist/entries/slider.d.ts +1 -0
- package/dist/entries/slider.js +1 -0
- package/dist/entries/spin-button.d.ts +1 -0
- package/dist/entries/spin-button.js +1 -0
- package/dist/entries/spinner.d.ts +1 -0
- package/dist/entries/spinner.js +1 -0
- package/dist/entries/split-view.d.ts +1 -0
- package/dist/entries/split-view.js +1 -0
- package/dist/entries/switch.d.ts +1 -0
- package/dist/entries/switch.js +1 -0
- package/dist/entries/table.d.ts +1 -0
- package/dist/entries/table.js +1 -0
- package/dist/entries/tabs.d.ts +1 -0
- package/dist/entries/tabs.js +1 -0
- package/dist/entries/tag-input.d.ts +1 -0
- package/dist/entries/tag-input.js +1 -0
- package/dist/entries/task-assignment-panel.d.ts +1 -0
- package/dist/entries/task-assignment-panel.js +1 -0
- package/dist/entries/text-area.d.ts +1 -0
- package/dist/entries/text-area.js +1 -0
- package/dist/entries/text-field.d.ts +1 -0
- package/dist/entries/text-field.js +1 -0
- package/dist/entries/thumbnail-card.d.ts +1 -0
- package/dist/entries/thumbnail-card.js +1 -0
- package/dist/entries/time-field.d.ts +1 -0
- package/dist/entries/time-field.js +1 -0
- package/dist/entries/toast.d.ts +1 -0
- package/dist/entries/toast.js +1 -0
- package/dist/entries/tooltip.d.ts +1 -0
- package/dist/entries/tooltip.js +1 -0
- package/dist/entries/tree-grid.d.ts +1 -0
- package/dist/entries/tree-grid.js +1 -0
- package/dist/entries/tree.d.ts +1 -0
- package/dist/entries/tree.js +1 -0
- package/dist/entries/unified-share-modal.d.ts +1 -0
- package/dist/entries/unified-share-modal.js +1 -0
- package/dist/foundations/geometry/tokens.d.ts +46 -45
- package/dist/foundations/geometry/tokens.js +46 -45
- package/dist/foundations/motion/tokens.d.ts +10 -10
- package/dist/foundations/motion/tokens.js +10 -10
- package/dist/foundations/overlay/positioning.js +5 -1
- package/dist/foundations/profiles/built-ins.d.ts +4 -0
- package/dist/foundations/profiles/built-ins.js +131 -0
- package/dist/foundations/profiles/controller.d.ts +4 -0
- package/dist/foundations/profiles/controller.js +107 -0
- package/dist/foundations/profiles/index.d.ts +4 -0
- package/dist/foundations/profiles/index.js +3 -0
- package/dist/foundations/profiles/registry.d.ts +72 -0
- package/dist/foundations/profiles/registry.js +119 -0
- package/dist/foundations/profiles/types.d.ts +94 -0
- package/dist/foundations/profiles/types.js +1 -0
- package/dist/foundations/theming/controller.d.ts +37 -0
- package/dist/foundations/theming/controller.js +176 -0
- package/dist/foundations/theming/index.d.ts +2 -0
- package/dist/foundations/theming/index.js +1 -0
- package/dist/foundations/tokens/box-dark.d.ts +3 -3
- package/dist/foundations/tokens/box-defaults.d.ts +3 -3
- package/dist/foundations/tokens/index.d.ts +2 -2
- package/dist/foundations/tokens/index.js +1 -1
- package/dist/foundations/tokens/registry.d.ts +37 -7
- package/dist/foundations/tokens/registry.js +55 -5
- package/dist/foundations/tokens/types.d.ts +38 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.js +4 -1
- package/dist/patterns/content-explorer/adapters/action-menu.d.ts +2 -2
- package/dist/patterns/content-explorer/adapters/action-menu.js +3 -9
- package/dist/patterns/content-explorer/adapters/breadcrumbs.d.ts +2 -2
- package/dist/patterns/content-explorer/adapters/breadcrumbs.js +3 -9
- package/dist/patterns/content-explorer/adapters/items.d.ts +3 -3
- package/dist/patterns/content-explorer/adapters/items.js +4 -10
- package/dist/patterns/content-explorer/adapters/list.d.ts +2 -2
- package/dist/patterns/content-explorer/adapters/list.js +3 -9
- package/dist/patterns/content-explorer/adapters/table.d.ts +2 -2
- package/dist/patterns/content-explorer/adapters/table.js +3 -9
- package/dist/patterns/content-explorer/adapters/toolbar.d.ts +2 -2
- package/dist/patterns/content-explorer/adapters/toolbar.js +7 -13
- package/dist/patterns/content-explorer/content-explorer.d.ts +15 -15
- package/dist/patterns/content-explorer/content-explorer.js +5 -11
- package/dist/patterns/file-request/file-request-builder.d.ts +2 -2
- package/dist/patterns/file-request/file-request-builder.js +3 -9
- package/dist/patterns/governance/governance-panel.d.ts +2 -2
- package/dist/patterns/governance/governance-panel.js +3 -6
- package/dist/patterns/insights/bar-chart.d.ts +2 -2
- package/dist/patterns/insights/bar-chart.js +3 -6
- package/dist/patterns/insights/chart-panel.d.ts +2 -2
- package/dist/patterns/insights/chart-panel.js +3 -6
- package/dist/patterns/insights/donut-chart.d.ts +2 -2
- package/dist/patterns/insights/donut-chart.js +3 -6
- package/dist/patterns/insights/line-chart.d.ts +2 -2
- package/dist/patterns/insights/line-chart.js +3 -6
- package/dist/patterns/insights/metric-card.d.ts +2 -2
- package/dist/patterns/insights/metric-card.js +3 -6
- package/dist/patterns/item/bulk-action-bar.d.ts +2 -2
- package/dist/patterns/item/bulk-action-bar.js +3 -6
- package/dist/patterns/item/item-details-panel.d.ts +2 -2
- package/dist/patterns/item/item-details-panel.js +3 -9
- package/dist/patterns/item/item-form.d.ts +2 -2
- package/dist/patterns/item/item-form.js +3 -9
- package/dist/patterns/item/preview-header.d.ts +2 -2
- package/dist/patterns/item/preview-header.js +3 -9
- package/dist/patterns/metadata/metadata-filter-builder.d.ts +2 -2
- package/dist/patterns/metadata/metadata-filter-builder.js +3 -9
- package/dist/patterns/metadata/metadata-inspector.d.ts +2 -2
- package/dist/patterns/metadata/metadata-inspector.js +3 -9
- package/dist/patterns/preview/annotation-inspector.d.ts +2 -2
- package/dist/patterns/preview/annotation-inspector.js +3 -9
- package/dist/patterns/preview/annotation-thread.d.ts +2 -2
- package/dist/patterns/preview/annotation-thread.js +3 -9
- package/dist/patterns/preview/annotation-toolbar.d.ts +2 -2
- package/dist/patterns/preview/annotation-toolbar.js +3 -9
- package/dist/patterns/preview/preview-element.d.ts +2 -2
- package/dist/patterns/preview/preview-element.js +3 -9
- package/dist/patterns/search/filter-bar.d.ts +2 -2
- package/dist/patterns/search/filter-bar.js +3 -9
- package/dist/patterns/search/saved-view-picker.d.ts +2 -2
- package/dist/patterns/search/saved-view-picker.js +3 -9
- package/dist/patterns/search/search-results-header.d.ts +2 -2
- package/dist/patterns/search/search-results-header.js +3 -9
- package/dist/patterns/share/access-stats.d.ts +2 -2
- package/dist/patterns/share/access-stats.js +3 -9
- package/dist/patterns/share/collaborator-avatars.d.ts +2 -2
- package/dist/patterns/share/collaborator-avatars.js +3 -9
- package/dist/patterns/share/invite-collaborators-modal.d.ts +2 -2
- package/dist/patterns/share/invite-collaborators-modal.js +3 -9
- package/dist/patterns/share/permission-matrix.d.ts +2 -2
- package/dist/patterns/share/permission-matrix.js +3 -9
- package/dist/patterns/share/presence.d.ts +2 -2
- package/dist/patterns/share/presence.js +3 -9
- package/dist/patterns/share/share-panel.d.ts +2 -2
- package/dist/patterns/share/share-panel.js +3 -9
- package/dist/patterns/share/unified-share-modal.d.ts +2 -2
- package/dist/patterns/share/unified-share-modal.js +3 -9
- package/dist/patterns/task/review-queue-item.d.ts +2 -2
- package/dist/patterns/task/review-queue-item.js +3 -6
- package/dist/patterns/task/task-assignment-panel.d.ts +2 -2
- package/dist/patterns/task/task-assignment-panel.js +3 -6
- package/package.json +5 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { FormAssociatedElement, boeFormFieldErrorStyles, formErrorMessageMarkup, } from "../../core/index.js";
|
|
2
2
|
import { boeNeutralInteractiveStyles } from "../../foundations/tokens/index.js";
|
|
3
3
|
import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
|
|
4
|
-
import { boeRadius } from "../../foundations/geometry/index.js";
|
|
4
|
+
import { boeOverlay, boeRadius } from "../../foundations/geometry/index.js";
|
|
5
|
+
import { parsePlacement, trackAnchor, } from "../../foundations/overlay/index.js";
|
|
5
6
|
const DEFAULT_TAG_NAME = "box-combobox";
|
|
6
7
|
const escapeHtml = (value) => value
|
|
7
8
|
.replaceAll("&", "&")
|
|
@@ -29,8 +30,15 @@ const comboboxStyles = `
|
|
|
29
30
|
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
[part="control"] {
|
|
34
|
+
position: relative;
|
|
35
|
+
display: block;
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
[part="input"] {
|
|
33
39
|
appearance: none;
|
|
40
|
+
inline-size: 100%;
|
|
41
|
+
box-sizing: border-box;
|
|
34
42
|
font: inherit;
|
|
35
43
|
color: var(--boe-token-text-text, #222222);
|
|
36
44
|
padding: 0.45rem 0.7rem;
|
|
@@ -53,9 +61,80 @@ const comboboxStyles = `
|
|
|
53
61
|
border-color: var(--boe-token-surface-surface-brand, #0061d5);
|
|
54
62
|
}
|
|
55
63
|
|
|
64
|
+
/* Listbox popup — positioned as a viewport-fixed overlay via foundations/overlay. */
|
|
65
|
+
[part="listbox"] {
|
|
66
|
+
position: fixed;
|
|
67
|
+
inset-block-start: 0;
|
|
68
|
+
inset-inline-start: 0;
|
|
69
|
+
z-index: 40;
|
|
70
|
+
margin: 0;
|
|
71
|
+
padding: ${boeOverlay.padding};
|
|
72
|
+
list-style: none;
|
|
73
|
+
min-inline-size: 200px;
|
|
74
|
+
max-block-size: 16rem;
|
|
75
|
+
overflow-y: auto;
|
|
76
|
+
border: ${boeOverlay.border};
|
|
77
|
+
border-radius: ${boeOverlay.radius};
|
|
78
|
+
background: var(--boe-token-surface-surface, #ffffff);
|
|
79
|
+
box-shadow: ${boeOverlay.shadow};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
[part="listbox"][hidden] {
|
|
83
|
+
display: none;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
[part="option"] {
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
gap: 1px;
|
|
90
|
+
min-block-size: ${boeOverlay.itemMinHeight};
|
|
91
|
+
justify-content: center;
|
|
92
|
+
padding: 6px 10px;
|
|
93
|
+
border-radius: ${boeOverlay.itemRadius};
|
|
94
|
+
color: var(--boe-token-text-text, #222222);
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
[part="option"][aria-disabled="true"] {
|
|
99
|
+
opacity: 0.5;
|
|
100
|
+
cursor: not-allowed;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
[part="option"].boe-active:not([aria-disabled="true"]) {
|
|
104
|
+
background: var(--boe-token-surface-surface-hover, #f4f4f4);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
[part="option"][aria-selected="true"] {
|
|
108
|
+
color: var(--boe-token-surface-surface-brand, #0061d5);
|
|
109
|
+
font-weight: 700;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
[part="option-description"] {
|
|
113
|
+
font-size: 0.78rem;
|
|
114
|
+
font-weight: 400;
|
|
115
|
+
line-height: 1.35;
|
|
116
|
+
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
[part="group-label"] {
|
|
120
|
+
padding: 6px 10px 2px;
|
|
121
|
+
font-size: 0.72rem;
|
|
122
|
+
font-weight: 700;
|
|
123
|
+
letter-spacing: 0.06em;
|
|
124
|
+
text-transform: uppercase;
|
|
125
|
+
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
[part="empty"] {
|
|
129
|
+
padding: 8px 10px;
|
|
130
|
+
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
131
|
+
font-size: 0.86rem;
|
|
132
|
+
}
|
|
133
|
+
|
|
56
134
|
${boeFormFieldErrorStyles}
|
|
57
135
|
`;
|
|
58
|
-
export class
|
|
136
|
+
export class Combobox extends FormAssociatedElement {
|
|
137
|
+
static tagName = DEFAULT_TAG_NAME;
|
|
59
138
|
static get observedAttributes() {
|
|
60
139
|
return [
|
|
61
140
|
...FormAssociatedElement.formObservedAttributes,
|
|
@@ -63,14 +142,27 @@ export class BoxComboboxElement extends FormAssociatedElement {
|
|
|
63
142
|
"label",
|
|
64
143
|
"options",
|
|
65
144
|
"placeholder",
|
|
145
|
+
"placement",
|
|
66
146
|
"value",
|
|
67
147
|
];
|
|
68
148
|
}
|
|
69
149
|
valueInternal = "";
|
|
150
|
+
open = false;
|
|
151
|
+
activeId = null;
|
|
152
|
+
filterText = null;
|
|
153
|
+
positionCleanup = null;
|
|
154
|
+
listboxId = `box-combobox-list-${Math.random().toString(36).slice(2, 10)}`;
|
|
70
155
|
inputEl;
|
|
71
156
|
labelEl;
|
|
72
|
-
|
|
157
|
+
controlEl;
|
|
158
|
+
listboxEl;
|
|
73
159
|
errorEl;
|
|
160
|
+
onDocumentPointerDown = (event) => {
|
|
161
|
+
if (event.composedPath().includes(this)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
this.closeListbox();
|
|
165
|
+
};
|
|
74
166
|
findOptionByLabel(label) {
|
|
75
167
|
return this.options.find(option => option.label === label);
|
|
76
168
|
}
|
|
@@ -78,37 +170,35 @@ export class BoxComboboxElement extends FormAssociatedElement {
|
|
|
78
170
|
return this.options.find(option => option.value === value);
|
|
79
171
|
}
|
|
80
172
|
getDisplayValue() {
|
|
81
|
-
|
|
82
|
-
return matched?.label ?? this.valueInternal;
|
|
173
|
+
return this.findOptionByValue(this.valueInternal)?.label ?? this.valueInternal;
|
|
83
174
|
}
|
|
175
|
+
/** Resolve typed text to an option value when it matches a label (free-text otherwise). */
|
|
84
176
|
resolveInputValue(rawValue) {
|
|
85
|
-
|
|
86
|
-
return matched?.value ?? rawValue;
|
|
177
|
+
return this.findOptionByLabel(rawValue)?.value ?? rawValue;
|
|
87
178
|
}
|
|
88
179
|
commitInputValue(rawValue) {
|
|
89
|
-
const
|
|
90
|
-
this.valueInternal
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
this.dispatchEvent(new CustomEvent("value-changed", {
|
|
94
|
-
bubbles: true,
|
|
95
|
-
composed: true,
|
|
96
|
-
detail: { value: resolvedValue },
|
|
97
|
-
}));
|
|
180
|
+
const resolved = this.resolveInputValue(rawValue);
|
|
181
|
+
if (resolved !== this.valueInternal) {
|
|
182
|
+
this.commitValue(resolved);
|
|
183
|
+
}
|
|
98
184
|
if (this.shadowRoot?.activeElement !== this.inputEl) {
|
|
99
185
|
this.inputEl.value = this.getDisplayValue();
|
|
100
186
|
}
|
|
101
187
|
}
|
|
188
|
+
/** Options visible for the current filter text (null = show all). */
|
|
189
|
+
visibleOptions() {
|
|
190
|
+
const filter = this.filterText;
|
|
191
|
+
if (filter == null || filter === "") {
|
|
192
|
+
return this.options;
|
|
193
|
+
}
|
|
194
|
+
const needle = filter.toLowerCase();
|
|
195
|
+
return this.options.filter(option => option.label.toLowerCase().includes(needle));
|
|
196
|
+
}
|
|
102
197
|
get disabled() {
|
|
103
198
|
return this.hasAttribute("disabled");
|
|
104
199
|
}
|
|
105
200
|
set disabled(value) {
|
|
106
|
-
|
|
107
|
-
this.setAttribute("disabled", "");
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
this.removeAttribute("disabled");
|
|
111
|
-
}
|
|
201
|
+
this.toggleAttribute("disabled", Boolean(value));
|
|
112
202
|
}
|
|
113
203
|
get label() {
|
|
114
204
|
return this.getAttribute("label") ?? "Combobox";
|
|
@@ -138,6 +228,15 @@ export class BoxComboboxElement extends FormAssociatedElement {
|
|
|
138
228
|
set placeholder(value) {
|
|
139
229
|
this.setAttribute("placeholder", value);
|
|
140
230
|
}
|
|
231
|
+
get placement() {
|
|
232
|
+
return this.getAttribute("placement") ?? "bottom-start";
|
|
233
|
+
}
|
|
234
|
+
set placement(value) {
|
|
235
|
+
this.setAttribute("placement", value);
|
|
236
|
+
}
|
|
237
|
+
resolvedPlacement() {
|
|
238
|
+
return parsePlacement(this.getAttribute("placement")) ?? { side: "bottom", align: "start" };
|
|
239
|
+
}
|
|
141
240
|
get value() {
|
|
142
241
|
return this.valueInternal;
|
|
143
242
|
}
|
|
@@ -165,54 +264,250 @@ export class BoxComboboxElement extends FormAssociatedElement {
|
|
|
165
264
|
this.update();
|
|
166
265
|
}
|
|
167
266
|
}
|
|
267
|
+
disconnectedCallback() {
|
|
268
|
+
document.removeEventListener("pointerdown", this.onDocumentPointerDown);
|
|
269
|
+
this.stopTracking();
|
|
270
|
+
super.disconnectedCallback();
|
|
271
|
+
}
|
|
272
|
+
stopTracking() {
|
|
273
|
+
this.positionCleanup?.();
|
|
274
|
+
this.positionCleanup = null;
|
|
275
|
+
}
|
|
276
|
+
commitValue(value) {
|
|
277
|
+
this.valueInternal = value;
|
|
278
|
+
this.setAttribute("value", value);
|
|
279
|
+
this.syncFormAssociation();
|
|
280
|
+
this.dispatchEvent(new CustomEvent("value-changed", {
|
|
281
|
+
bubbles: true,
|
|
282
|
+
composed: true,
|
|
283
|
+
detail: { value },
|
|
284
|
+
}));
|
|
285
|
+
}
|
|
286
|
+
optionId(index) {
|
|
287
|
+
return `${this.listboxId}-opt-${index}`;
|
|
288
|
+
}
|
|
289
|
+
openListbox() {
|
|
290
|
+
if (this.disabled || this.open) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
this.open = true;
|
|
294
|
+
document.addEventListener("pointerdown", this.onDocumentPointerDown);
|
|
295
|
+
this.update();
|
|
296
|
+
this.positionCleanup = trackAnchor(this.controlEl, this.listboxEl, {
|
|
297
|
+
placement: this.resolvedPlacement(),
|
|
298
|
+
offset: 4,
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
closeListbox(restoreDisplay = true) {
|
|
302
|
+
if (!this.open) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
this.open = false;
|
|
306
|
+
this.activeId = null;
|
|
307
|
+
this.filterText = null;
|
|
308
|
+
document.removeEventListener("pointerdown", this.onDocumentPointerDown);
|
|
309
|
+
this.stopTracking();
|
|
310
|
+
if (restoreDisplay && this.shadowRoot?.activeElement !== this.inputEl) {
|
|
311
|
+
this.inputEl.value = this.getDisplayValue();
|
|
312
|
+
}
|
|
313
|
+
this.update();
|
|
314
|
+
}
|
|
315
|
+
optionEls() {
|
|
316
|
+
return Array.from(this.listboxEl.querySelectorAll('[part="option"]:not([aria-disabled="true"])'));
|
|
317
|
+
}
|
|
318
|
+
setActive(id) {
|
|
319
|
+
this.activeId = id;
|
|
320
|
+
this.listboxEl.querySelectorAll('[part="option"]').forEach(node => {
|
|
321
|
+
node.classList.toggle("boe-active", node.id === id);
|
|
322
|
+
});
|
|
323
|
+
if (id) {
|
|
324
|
+
this.inputEl.setAttribute("aria-activedescendant", id);
|
|
325
|
+
const activeEl = this.listboxEl.querySelector(`#${id}`);
|
|
326
|
+
// scrollIntoView is absent in jsdom; guard so tests and SSR don't throw.
|
|
327
|
+
activeEl?.scrollIntoView?.({ block: "nearest" });
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
this.inputEl.removeAttribute("aria-activedescendant");
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
moveActive(delta) {
|
|
334
|
+
const options = this.optionEls();
|
|
335
|
+
if (options.length === 0) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
const currentIndex = options.findIndex(node => node.id === this.activeId);
|
|
339
|
+
let nextIndex = currentIndex + delta;
|
|
340
|
+
if (nextIndex < 0) {
|
|
341
|
+
nextIndex = options.length - 1;
|
|
342
|
+
}
|
|
343
|
+
else if (nextIndex >= options.length) {
|
|
344
|
+
nextIndex = 0;
|
|
345
|
+
}
|
|
346
|
+
this.setActive(options[nextIndex].id);
|
|
347
|
+
}
|
|
348
|
+
selectActive() {
|
|
349
|
+
if (!this.activeId) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
const optionEl = this.listboxEl.querySelector(`#${this.activeId}`);
|
|
353
|
+
const value = optionEl?.dataset.value;
|
|
354
|
+
if (value == null) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
this.commitValue(value);
|
|
358
|
+
this.inputEl.value = this.getDisplayValue();
|
|
359
|
+
// Keep focus on the input (Enter already has it; click was prevented from
|
|
360
|
+
// blurring) — do NOT call focus() here, which would retrigger open.
|
|
361
|
+
this.closeListbox(false);
|
|
362
|
+
}
|
|
168
363
|
renderTemplate() {
|
|
169
364
|
if (!this.shadowRoot) {
|
|
170
365
|
return;
|
|
171
366
|
}
|
|
172
367
|
this.shadowRoot.innerHTML = `
|
|
173
368
|
<style>${comboboxStyles}</style>
|
|
174
|
-
<
|
|
175
|
-
<span part="label"></span>
|
|
176
|
-
<
|
|
177
|
-
|
|
369
|
+
<div part="field">
|
|
370
|
+
<span part="label" id="${this.listboxId}-label"></span>
|
|
371
|
+
<div part="control">
|
|
372
|
+
<input
|
|
373
|
+
type="text"
|
|
374
|
+
part="input"
|
|
375
|
+
role="combobox"
|
|
376
|
+
autocomplete="off"
|
|
377
|
+
aria-autocomplete="list"
|
|
378
|
+
aria-expanded="false"
|
|
379
|
+
aria-controls="${this.listboxId}"
|
|
380
|
+
/>
|
|
381
|
+
</div>
|
|
382
|
+
<ul part="listbox" id="${this.listboxId}" role="listbox" aria-labelledby="${this.listboxId}-label" hidden></ul>
|
|
178
383
|
${formErrorMessageMarkup()}
|
|
179
|
-
</
|
|
384
|
+
</div>
|
|
180
385
|
`;
|
|
181
386
|
this.labelEl = this.shadowRoot.querySelector('[part="label"]');
|
|
182
387
|
this.inputEl = this.shadowRoot.querySelector('[part="input"]');
|
|
183
|
-
this.
|
|
388
|
+
this.controlEl = this.shadowRoot.querySelector('[part="control"]');
|
|
389
|
+
this.listboxEl = this.shadowRoot.querySelector('[part="listbox"]');
|
|
184
390
|
this.errorEl = this.shadowRoot.querySelector('[part="error-message"]');
|
|
185
391
|
}
|
|
186
392
|
setupListeners() {
|
|
187
393
|
this.inputEl.addEventListener("input", event => {
|
|
188
|
-
const
|
|
189
|
-
this.
|
|
394
|
+
const raw = event.currentTarget.value;
|
|
395
|
+
this.filterText = raw;
|
|
396
|
+
// Preserve free-text behaviour: typed text commits (resolving label→value).
|
|
397
|
+
this.commitInputValue(raw);
|
|
398
|
+
this.openListbox();
|
|
399
|
+
this.update();
|
|
400
|
+
// Keep the first match active for quick Enter selection.
|
|
401
|
+
const first = this.optionEls()[0];
|
|
402
|
+
this.setActive(first?.id ?? null);
|
|
190
403
|
});
|
|
191
|
-
this.inputEl.addEventListener("
|
|
192
|
-
const
|
|
193
|
-
|
|
404
|
+
this.inputEl.addEventListener("keydown", event => {
|
|
405
|
+
const key = event.key;
|
|
406
|
+
if (key === "ArrowDown") {
|
|
407
|
+
event.preventDefault();
|
|
408
|
+
if (!this.open) {
|
|
409
|
+
this.openListbox();
|
|
410
|
+
const first = this.optionEls()[0];
|
|
411
|
+
this.setActive(first?.id ?? null);
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
this.moveActive(1);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
else if (key === "ArrowUp") {
|
|
418
|
+
event.preventDefault();
|
|
419
|
+
if (this.open) {
|
|
420
|
+
this.moveActive(-1);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
else if (key === "Home" && this.open) {
|
|
424
|
+
event.preventDefault();
|
|
425
|
+
const first = this.optionEls()[0];
|
|
426
|
+
this.setActive(first?.id ?? null);
|
|
427
|
+
}
|
|
428
|
+
else if (key === "End" && this.open) {
|
|
429
|
+
event.preventDefault();
|
|
430
|
+
const options = this.optionEls();
|
|
431
|
+
this.setActive(options[options.length - 1]?.id ?? null);
|
|
432
|
+
}
|
|
433
|
+
else if (key === "Enter") {
|
|
434
|
+
if (this.open && this.activeId) {
|
|
435
|
+
event.preventDefault();
|
|
436
|
+
this.selectActive();
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
else if (key === "Escape") {
|
|
440
|
+
if (this.open) {
|
|
441
|
+
event.preventDefault();
|
|
442
|
+
this.closeListbox();
|
|
443
|
+
}
|
|
444
|
+
}
|
|
194
445
|
});
|
|
195
|
-
this.inputEl.addEventListener("
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
if (resolvedValue !== this.valueInternal) {
|
|
199
|
-
this.commitInputValue(rawValue);
|
|
446
|
+
this.inputEl.addEventListener("focus", () => {
|
|
447
|
+
if (!this.disabled) {
|
|
448
|
+
this.openListbox();
|
|
200
449
|
}
|
|
201
|
-
|
|
202
|
-
|
|
450
|
+
});
|
|
451
|
+
this.listboxEl.addEventListener("pointerdown", event => {
|
|
452
|
+
// Prevent the input blur so selection completes before focus moves.
|
|
453
|
+
event.preventDefault();
|
|
454
|
+
});
|
|
455
|
+
this.listboxEl.addEventListener("click", event => {
|
|
456
|
+
const optionEl = event.target.closest('[part="option"]');
|
|
457
|
+
if (!optionEl || optionEl.getAttribute("aria-disabled") === "true") {
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
this.setActive(optionEl.id);
|
|
461
|
+
this.selectActive();
|
|
462
|
+
});
|
|
463
|
+
this.inputEl.addEventListener("blur", () => {
|
|
464
|
+
// Resolve typed text (label→value) then close (pointerdown-on-option is
|
|
465
|
+
// prevented above so option clicks complete first).
|
|
466
|
+
this.commitInputValue(this.inputEl.value);
|
|
467
|
+
this.closeListbox();
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
renderOptions() {
|
|
471
|
+
const options = this.visibleOptions();
|
|
472
|
+
if (options.length === 0) {
|
|
473
|
+
this.listboxEl.innerHTML = `<li part="empty" role="presentation">No matches</li>`;
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
let markup = "";
|
|
477
|
+
let lastGroup;
|
|
478
|
+
options.forEach((option, index) => {
|
|
479
|
+
if (option.group && option.group !== lastGroup) {
|
|
480
|
+
markup += `<li part="group-label" role="presentation">${escapeHtml(option.group)}</li>`;
|
|
203
481
|
}
|
|
482
|
+
lastGroup = option.group;
|
|
483
|
+
const selected = option.value === this.valueInternal;
|
|
484
|
+
const description = option.description
|
|
485
|
+
? `<span part="option-description">${escapeHtml(option.description)}</span>`
|
|
486
|
+
: "";
|
|
487
|
+
markup += `
|
|
488
|
+
<li
|
|
489
|
+
id="${this.optionId(index)}"
|
|
490
|
+
part="option"
|
|
491
|
+
role="option"
|
|
492
|
+
data-value="${escapeHtml(option.value)}"
|
|
493
|
+
aria-selected="${selected ? "true" : "false"}"
|
|
494
|
+
${option.disabled ? 'aria-disabled="true"' : ""}
|
|
495
|
+
>
|
|
496
|
+
<span part="option-label">${escapeHtml(option.label)}</span>
|
|
497
|
+
${description}
|
|
498
|
+
</li>
|
|
499
|
+
`;
|
|
204
500
|
});
|
|
501
|
+
this.listboxEl.innerHTML = markup;
|
|
205
502
|
}
|
|
206
503
|
update() {
|
|
207
|
-
if (!this.inputEl || !this.labelEl || !this.
|
|
504
|
+
if (!this.inputEl || !this.labelEl || !this.listboxEl || !this.errorEl) {
|
|
208
505
|
return;
|
|
209
506
|
}
|
|
210
507
|
this.labelEl.textContent = this.label;
|
|
211
508
|
this.inputEl.placeholder = this.placeholder;
|
|
212
|
-
this.
|
|
213
|
-
|
|
214
|
-
.join("");
|
|
215
|
-
if (this.shadowRoot?.activeElement !== this.inputEl) {
|
|
509
|
+
this.inputEl.setAttribute("aria-label", this.label);
|
|
510
|
+
if (this.shadowRoot?.activeElement !== this.inputEl && this.filterText == null) {
|
|
216
511
|
this.inputEl.value = this.getDisplayValue();
|
|
217
512
|
}
|
|
218
513
|
if (this.disabled) {
|
|
@@ -221,14 +516,17 @@ export class BoxComboboxElement extends FormAssociatedElement {
|
|
|
221
516
|
else {
|
|
222
517
|
this.inputEl.removeAttribute("disabled");
|
|
223
518
|
}
|
|
519
|
+
this.listboxEl.hidden = !this.open;
|
|
520
|
+
this.inputEl.setAttribute("aria-expanded", this.open ? "true" : "false");
|
|
521
|
+
if (this.open) {
|
|
522
|
+
this.renderOptions();
|
|
523
|
+
// Reassert active highlight after a re-render.
|
|
524
|
+
this.setActive(this.activeId);
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
this.inputEl.removeAttribute("aria-activedescendant");
|
|
528
|
+
}
|
|
224
529
|
this.applyInvalidState(this.inputEl, this.errorEl);
|
|
225
530
|
}
|
|
226
531
|
}
|
|
227
|
-
|
|
228
|
-
const existingElement = customElements.get(tagName);
|
|
229
|
-
if (existingElement) {
|
|
230
|
-
return existingElement;
|
|
231
|
-
}
|
|
232
|
-
customElements.define(tagName, BoxComboboxElement);
|
|
233
|
-
return BoxComboboxElement;
|
|
234
|
-
};
|
|
532
|
+
Combobox.register();
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { FormAssociatedElement } from "../../core/index.js";
|
|
2
2
|
import type { FormValue } from "../../core/index.js";
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class DateField extends FormAssociatedElement {
|
|
4
|
+
static readonly tagName: string;
|
|
4
5
|
static get observedAttributes(): string[];
|
|
5
6
|
private valueInternal;
|
|
6
7
|
private inputEl;
|
|
7
8
|
private labelEl;
|
|
8
9
|
private descriptionEl;
|
|
9
10
|
private errorEl;
|
|
11
|
+
private controlEl;
|
|
12
|
+
private clearEl;
|
|
13
|
+
/** Shows a clear button that resets the value when a date is set. */
|
|
14
|
+
get clearable(): boolean;
|
|
15
|
+
set clearable(value: boolean);
|
|
10
16
|
get disabled(): boolean;
|
|
11
17
|
set disabled(value: boolean);
|
|
12
18
|
get label(): string;
|
|
@@ -23,6 +29,7 @@ export declare class BoxDateFieldElement extends FormAssociatedElement {
|
|
|
23
29
|
private syncValue;
|
|
24
30
|
protected renderTemplate(): void;
|
|
25
31
|
protected setupListeners(): void;
|
|
32
|
+
/** Reset the date to empty and emit value-changed. */
|
|
33
|
+
clear(): void;
|
|
26
34
|
protected update(): void;
|
|
27
35
|
}
|
|
28
|
-
export declare const defineBoxDateFieldElement: (tagName?: string) => typeof BoxDateFieldElement;
|
|
@@ -44,13 +44,57 @@ const dateFieldStyles = `
|
|
|
44
44
|
border-color: var(--boe-token-surface-surface-brand, #0061d5);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/* Control wrapper — layout-neutral until a clear button appears. */
|
|
48
|
+
[part="control"] {
|
|
49
|
+
position: relative;
|
|
50
|
+
display: block;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
[part="control"] [part="input"] {
|
|
54
|
+
inline-size: 100%;
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Clear button sits just left of the native calendar indicator. */
|
|
59
|
+
[part="clear"] {
|
|
60
|
+
position: absolute;
|
|
61
|
+
inset-block-start: 50%;
|
|
62
|
+
inset-inline-end: 2rem;
|
|
63
|
+
transform: translateY(-50%);
|
|
64
|
+
display: none;
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: center;
|
|
67
|
+
inline-size: 1.25rem;
|
|
68
|
+
block-size: 1.25rem;
|
|
69
|
+
padding: 0;
|
|
70
|
+
border: 0;
|
|
71
|
+
border-radius: 999px;
|
|
72
|
+
background: transparent;
|
|
73
|
+
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
transition: background ${boeMotionDuration.interactive} ${boeMotionEasing.standard}, color ${boeMotionDuration.interactive} ${boeMotionEasing.standard};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[part="control"][data-clearable="true"] [part="clear"] {
|
|
79
|
+
display: inline-flex;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
[part="clear"] svg {
|
|
83
|
+
inline-size: 0.7rem;
|
|
84
|
+
block-size: 0.7rem;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
${boeNeutralInteractiveStyles('[part="clear"]')}
|
|
88
|
+
|
|
47
89
|
${boeFormFieldErrorStyles}
|
|
48
90
|
${boeFormFieldSupportStyles}
|
|
49
91
|
`;
|
|
50
|
-
export class
|
|
92
|
+
export class DateField extends FormAssociatedElement {
|
|
93
|
+
static tagName = DEFAULT_TAG_NAME;
|
|
51
94
|
static get observedAttributes() {
|
|
52
95
|
return [
|
|
53
96
|
...FormAssociatedElement.fieldObservedAttributes,
|
|
97
|
+
"clearable",
|
|
54
98
|
"disabled",
|
|
55
99
|
"label",
|
|
56
100
|
"max",
|
|
@@ -63,6 +107,15 @@ export class BoxDateFieldElement extends FormAssociatedElement {
|
|
|
63
107
|
labelEl;
|
|
64
108
|
descriptionEl;
|
|
65
109
|
errorEl;
|
|
110
|
+
controlEl;
|
|
111
|
+
clearEl;
|
|
112
|
+
/** Shows a clear button that resets the value when a date is set. */
|
|
113
|
+
get clearable() {
|
|
114
|
+
return this.hasAttribute("clearable");
|
|
115
|
+
}
|
|
116
|
+
set clearable(value) {
|
|
117
|
+
this.toggleAttribute("clearable", Boolean(value));
|
|
118
|
+
}
|
|
66
119
|
get disabled() {
|
|
67
120
|
return this.hasAttribute("disabled");
|
|
68
121
|
}
|
|
@@ -138,7 +191,12 @@ export class BoxDateFieldElement extends FormAssociatedElement {
|
|
|
138
191
|
<label part="field">
|
|
139
192
|
<span part="label"></span>
|
|
140
193
|
${formDescriptionMarkup()}
|
|
141
|
-
<
|
|
194
|
+
<span part="control">
|
|
195
|
+
<input type="date" part="input" />
|
|
196
|
+
<button type="button" part="clear" aria-label="Clear date" tabindex="-1">
|
|
197
|
+
<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path d="M4 4l8 8M12 4l-8 8" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>
|
|
198
|
+
</button>
|
|
199
|
+
</span>
|
|
142
200
|
${formErrorMessageMarkup()}
|
|
143
201
|
</label>
|
|
144
202
|
`;
|
|
@@ -146,11 +204,23 @@ export class BoxDateFieldElement extends FormAssociatedElement {
|
|
|
146
204
|
this.descriptionEl = this.shadowRoot.querySelector('[part="description"]');
|
|
147
205
|
this.inputEl = this.shadowRoot.querySelector('[part="input"]');
|
|
148
206
|
this.errorEl = this.shadowRoot.querySelector('[part="error-message"]');
|
|
207
|
+
this.controlEl = this.shadowRoot.querySelector('[part="control"]');
|
|
208
|
+
this.clearEl = this.shadowRoot.querySelector('[part="clear"]');
|
|
149
209
|
}
|
|
150
210
|
setupListeners() {
|
|
151
211
|
this.inputEl.addEventListener("input", event => {
|
|
152
212
|
this.syncValue(event.currentTarget.value);
|
|
153
213
|
});
|
|
214
|
+
this.clearEl.addEventListener("click", () => this.clear());
|
|
215
|
+
}
|
|
216
|
+
/** Reset the date to empty and emit value-changed. */
|
|
217
|
+
clear() {
|
|
218
|
+
if (this.disabled || !this.valueInternal) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
this.inputEl.value = "";
|
|
222
|
+
this.syncValue("");
|
|
223
|
+
this.inputEl.focus();
|
|
154
224
|
}
|
|
155
225
|
update() {
|
|
156
226
|
if (!this.inputEl || !this.labelEl || !this.errorEl) {
|
|
@@ -178,15 +248,11 @@ export class BoxDateFieldElement extends FormAssociatedElement {
|
|
|
178
248
|
else {
|
|
179
249
|
this.inputEl.removeAttribute("disabled");
|
|
180
250
|
}
|
|
251
|
+
// Clear button only when clearable, enabled, and a value is present.
|
|
252
|
+
const showClear = this.clearable && !this.disabled && Boolean(this.valueInternal);
|
|
253
|
+
this.controlEl.dataset.clearable = showClear ? "true" : "false";
|
|
181
254
|
this.applyFieldSupport(this.labelEl, this.inputEl, this.descriptionEl);
|
|
182
255
|
this.applyInvalidState(this.inputEl, this.errorEl);
|
|
183
256
|
}
|
|
184
257
|
}
|
|
185
|
-
|
|
186
|
-
const existingElement = customElements.get(tagName);
|
|
187
|
-
if (existingElement) {
|
|
188
|
-
return existingElement;
|
|
189
|
-
}
|
|
190
|
-
customElements.define(tagName, BoxDateFieldElement);
|
|
191
|
-
return BoxDateFieldElement;
|
|
192
|
-
};
|
|
258
|
+
DateField.register();
|