@comitor/ui 2.0.0 → 3.0.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/LICENSE +35 -0
- package/README.md +67 -24
- package/dist/chart/chart.d.ts +6 -1
- package/dist/chart/chart.js +3 -1
- package/dist/chart/chart.js.map +1 -1
- package/dist/chart/comitor-chart.d.ts +4 -1
- package/dist/chart/comitor-chart.js +3 -1
- package/dist/chart/comitor-chart.js.map +1 -1
- package/dist/components/composite/avatar-group.d.ts +9 -6
- package/dist/components/composite/avatar-group.js +6 -2
- package/dist/components/composite/avatar-group.js.map +1 -1
- package/dist/components/composite/combobox.d.ts +11 -11
- package/dist/components/composite/combobox.js +25 -11
- package/dist/components/composite/combobox.js.map +1 -1
- package/dist/components/composite/command-palette-constants.d.ts +15 -5
- package/dist/components/composite/command-palette-constants.js +3 -2
- package/dist/components/composite/command-palette-constants.js.map +1 -1
- package/dist/components/composite/command-palette.d.ts +2 -2
- package/dist/components/composite/command-palette.js +8 -5
- package/dist/components/composite/command-palette.js.map +1 -1
- package/dist/components/composite/confirm-dialog.d.ts +8 -8
- package/dist/components/composite/confirm-dialog.js +8 -3
- package/dist/components/composite/confirm-dialog.js.map +1 -1
- package/dist/components/composite/copy-button.d.ts +7 -3
- package/dist/components/composite/copy-button.js +7 -3
- package/dist/components/composite/copy-button.js.map +1 -1
- package/dist/components/composite/data-table-constants.d.ts +7 -3
- package/dist/components/composite/data-table-constants.js +2 -9
- package/dist/components/composite/data-table-constants.js.map +1 -1
- package/dist/components/composite/data-table.js +3 -3
- package/dist/components/composite/data-table.js.map +1 -1
- package/dist/components/composite/date-picker-constants.d.ts +32 -9
- package/dist/components/composite/date-picker-constants.js +16 -11
- package/dist/components/composite/date-picker-constants.js.map +1 -1
- package/dist/components/composite/date-picker.d.ts +19 -10
- package/dist/components/composite/date-picker.js +33 -9
- package/dist/components/composite/date-picker.js.map +1 -1
- package/dist/components/composite/filter-chips.d.ts +4 -3
- package/dist/components/composite/filter-chips.js +6 -2
- package/dist/components/composite/filter-chips.js.map +1 -1
- package/dist/components/composite/inline-edit.d.ts +14 -3
- package/dist/components/composite/inline-edit.js +8 -4
- package/dist/components/composite/inline-edit.js.map +1 -1
- package/dist/components/composite/relative-time.d.ts +4 -4
- package/dist/components/composite/relative-time.js +4 -2
- package/dist/components/composite/relative-time.js.map +1 -1
- package/dist/components/composite/route-tabs-nav.d.ts +9 -0
- package/dist/components/composite/route-tabs-nav.js +11 -0
- package/dist/components/composite/route-tabs-nav.js.map +1 -0
- package/dist/components/composite/route-tabs.d.ts +4 -1
- package/dist/components/composite/route-tabs.js +3 -2
- package/dist/components/composite/route-tabs.js.map +1 -1
- package/dist/components/composite/search-filter-bar-constants.d.ts +18 -8
- package/dist/components/composite/search-filter-bar-constants.js +2 -14
- package/dist/components/composite/search-filter-bar-constants.js.map +1 -1
- package/dist/components/composite/search-filter-bar.d.ts +5 -2
- package/dist/components/composite/search-filter-bar.js +2 -2
- package/dist/components/composite/search-filter-bar.js.map +1 -1
- package/dist/components/composite/stat-card.d.ts +1 -1
- package/dist/components/composite/table-pagination-constants.d.ts +16 -11
- package/dist/components/composite/table-pagination-constants.js +2 -12
- package/dist/components/composite/table-pagination-constants.js.map +1 -1
- package/dist/components/composite/table-pagination.d.ts +6 -3
- package/dist/components/composite/table-pagination.js +3 -5
- package/dist/components/composite/table-pagination.js.map +1 -1
- package/dist/components/composite/toast.d.ts +4 -2
- package/dist/components/composite/toast.js +9 -1
- package/dist/components/composite/toast.js.map +1 -1
- package/dist/components/ui/action-bar-constants.d.ts +35 -0
- package/dist/components/ui/action-bar-constants.js +6 -0
- package/dist/components/ui/action-bar-constants.js.map +1 -0
- package/dist/components/ui/action-bar.d.ts +68 -0
- package/dist/components/ui/action-bar.js +522 -0
- package/dist/components/ui/action-bar.js.map +1 -0
- package/dist/components/ui/alert.d.ts +1 -1
- package/dist/components/ui/badge-overflow.d.ts +30 -0
- package/dist/components/ui/badge-overflow.js +181 -0
- package/dist/components/ui/badge-overflow.js.map +1 -0
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/banner.d.ts +80 -0
- package/dist/components/ui/banner.js +520 -0
- package/dist/components/ui/banner.js.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +11 -4
- package/dist/components/ui/breadcrumb.js +7 -2
- package/dist/components/ui/breadcrumb.js.map +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/calendar.d.ts +12 -5
- package/dist/components/ui/calendar.js +38 -3
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/carousel.d.ts +4 -3
- package/dist/components/ui/carousel.js +11 -4
- package/dist/components/ui/carousel.js.map +1 -1
- package/dist/components/ui/circular-progress.d.ts +50 -0
- package/dist/components/ui/circular-progress.js +266 -0
- package/dist/components/ui/circular-progress.js.map +1 -0
- package/dist/components/ui/command.d.ts +5 -4
- package/dist/components/ui/command.js +6 -2
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/cropper-constants.d.ts +39 -0
- package/dist/components/ui/cropper-constants.js +6 -0
- package/dist/components/ui/cropper-constants.js.map +1 -0
- package/dist/components/ui/cropper.d.ts +107 -0
- package/dist/components/ui/cropper.js +1269 -0
- package/dist/components/ui/cropper.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +2 -2
- package/dist/components/ui/dialog.js +4 -1
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/drawer.d.ts +1 -1
- package/dist/components/ui/drawer.js +2 -2
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/item.d.ts +2 -2
- package/dist/components/ui/kanban-constants.d.ts +67 -0
- package/dist/components/ui/kanban-constants.js +6 -0
- package/dist/components/ui/kanban-constants.js.map +1 -0
- package/dist/components/ui/kanban.d.ts +72 -0
- package/dist/components/ui/kanban.js +787 -0
- package/dist/components/ui/kanban.js.map +1 -0
- package/dist/components/ui/key-value-constants.d.ts +37 -0
- package/dist/components/ui/key-value-constants.js +6 -0
- package/dist/components/ui/key-value-constants.js.map +1 -0
- package/dist/components/ui/key-value.d.ts +96 -0
- package/dist/components/ui/key-value.js +641 -0
- package/dist/components/ui/key-value.js.map +1 -0
- package/dist/components/ui/mask-input-constants.d.ts +98 -0
- package/dist/components/ui/mask-input-constants.js +600 -0
- package/dist/components/ui/mask-input-constants.js.map +1 -0
- package/dist/components/ui/mask-input.d.ts +39 -0
- package/dist/components/ui/mask-input.js +560 -0
- package/dist/components/ui/mask-input.js.map +1 -0
- package/dist/components/ui/mention.d.ts +32 -0
- package/dist/components/ui/mention.js +126 -0
- package/dist/components/ui/mention.js.map +1 -0
- package/dist/components/ui/pagination.d.ts +13 -9
- package/dist/components/ui/pagination.js +15 -6
- package/dist/components/ui/pagination.js.map +1 -1
- package/dist/components/ui/phone-input-constants.d.ts +65 -0
- package/dist/components/ui/phone-input-constants.js +6 -0
- package/dist/components/ui/phone-input-constants.js.map +1 -0
- package/dist/components/ui/phone-input.d.ts +92 -0
- package/dist/components/ui/phone-input.js +742 -0
- package/dist/components/ui/phone-input.js.map +1 -0
- package/dist/components/ui/progress.d.ts +2 -2
- package/dist/components/ui/rating.d.ts +57 -0
- package/dist/components/ui/rating.js +648 -0
- package/dist/components/ui/rating.js.map +1 -0
- package/dist/components/ui/responsive-dialog.d.ts +35 -0
- package/dist/components/ui/responsive-dialog.js +193 -0
- package/dist/components/ui/responsive-dialog.js.map +1 -0
- package/dist/components/ui/scroll-spy.d.ts +42 -0
- package/dist/components/ui/scroll-spy.js +336 -0
- package/dist/components/ui/scroll-spy.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +2 -2
- package/dist/components/ui/sheet.js +10 -1
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/spinner.js +4 -1
- package/dist/components/ui/spinner.js.map +1 -1
- package/dist/components/ui/stepper-constants.d.ts +34 -0
- package/dist/components/ui/stepper-constants.js +6 -0
- package/dist/components/ui/stepper-constants.js.map +1 -0
- package/dist/components/ui/stepper.d.ts +81 -0
- package/dist/components/ui/stepper.js +902 -0
- package/dist/components/ui/stepper.js.map +1 -0
- package/dist/components/ui/tags-input.d.ts +42 -0
- package/dist/components/ui/tags-input.js +129 -0
- package/dist/components/ui/tags-input.js.map +1 -0
- package/dist/components/ui/time-picker-constants.d.ts +51 -0
- package/dist/components/ui/time-picker-constants.js +6 -0
- package/dist/components/ui/time-picker-constants.js.map +1 -0
- package/dist/components/ui/time-picker.d.ts +120 -0
- package/dist/components/ui/time-picker.js +1618 -0
- package/dist/components/ui/time-picker.js.map +1 -0
- package/dist/components/ui/timeline.d.ts +32 -0
- package/dist/components/ui/timeline.js +559 -0
- package/dist/components/ui/timeline.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/components/ui/tour-constants.d.ts +44 -0
- package/dist/components/ui/tour-constants.js +6 -0
- package/dist/components/ui/tour-constants.js.map +1 -0
- package/dist/components/ui/tour.d.ts +125 -0
- package/dist/components/ui/tour.js +1207 -0
- package/dist/components/ui/tour.js.map +1 -0
- package/dist/data-grid/data-grid-cell-variants.js +4 -4
- package/dist/data-grid/data-grid-cell-variants.js.map +1 -1
- package/dist/data-grid/data-grid-cell-wrapper.js +1 -1
- package/dist/data-grid/data-grid-cell-wrapper.js.map +1 -1
- package/dist/data-grid/data-grid-column-header.js +1 -1
- package/dist/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/data-grid/data-grid-context-menu.js +1 -1
- package/dist/data-grid/data-grid-context-menu.js.map +1 -1
- package/dist/data-grid/data-grid-filter-menu.d.ts +5 -4
- package/dist/data-grid/data-grid-filter-menu.js +13 -8
- package/dist/data-grid/data-grid-filter-menu.js.map +1 -1
- package/dist/data-grid/data-grid-keyboard-shortcuts.d.ts +4 -4
- package/dist/data-grid/data-grid-keyboard-shortcuts.js.map +1 -1
- package/dist/data-grid/data-grid-locale.d.ts +58 -6
- package/dist/data-grid/data-grid-locale.js +41 -9
- package/dist/data-grid/data-grid-locale.js.map +1 -1
- package/dist/data-grid/data-grid-paste-dialog.js +1 -1
- package/dist/data-grid/data-grid-paste-dialog.js.map +1 -1
- package/dist/data-grid/data-grid-row-height-menu.d.ts +4 -3
- package/dist/data-grid/data-grid-row-height-menu.js.map +1 -1
- package/dist/data-grid/data-grid-row.js +1 -1
- package/dist/data-grid/data-grid-row.js.map +1 -1
- package/dist/data-grid/data-grid-search.js +1 -1
- package/dist/data-grid/data-grid-search.js.map +1 -1
- package/dist/data-grid/data-grid-sort-menu.d.ts +4 -4
- package/dist/data-grid/data-grid-sort-menu.js +1 -1
- package/dist/data-grid/data-grid-sort-menu.js.map +1 -1
- package/dist/data-grid/data-grid-view-menu.d.ts +4 -4
- package/dist/data-grid/data-grid-view-menu.js.map +1 -1
- package/dist/data-grid/data-grid.d.ts +4 -3
- package/dist/data-grid/data-grid.js +3 -4
- package/dist/data-grid/data-grid.js.map +1 -1
- package/dist/data-grid/index.d.ts +1 -0
- package/dist/data-grid/index.js.map +1 -1
- package/dist/data-grid/messages-en.d.ts +23 -4
- package/dist/data-grid/messages-en.js +20 -0
- package/dist/data-grid/messages-en.js.map +1 -1
- package/dist/data-grid/messages-vi.d.ts +3 -1
- package/dist/data-grid/messages-vi.js +14 -0
- package/dist/data-grid/messages-vi.js.map +1 -1
- package/dist/data-grid/messages.d.ts +29 -3
- package/dist/data-grid/messages.js.map +1 -1
- package/dist/data-grid/sortable.js +17 -20
- package/dist/data-grid/sortable.js.map +1 -1
- package/dist/data-grid/types.d.ts +1 -1
- package/dist/data-grid/use-data-grid-undo-redo.d.ts +5 -4
- package/dist/data-grid/use-data-grid-undo-redo.js +4 -4
- package/dist/data-grid/use-data-grid-undo-redo.js.map +1 -1
- package/dist/data-grid/use-data-grid.d.ts +21 -6
- package/dist/data-grid/use-data-grid.js +11 -9
- package/dist/data-grid/use-data-grid.js.map +1 -1
- package/dist/data-grid/utils.d.ts +24 -4
- package/dist/data-grid/utils.js +15 -5
- package/dist/data-grid/utils.js.map +1 -1
- package/dist/i18n/locale-provider.d.ts +109 -0
- package/dist/i18n/locale-provider.js +47 -0
- package/dist/i18n/locale-provider.js.map +1 -0
- package/dist/i18n/locale.d.ts +27 -0
- package/dist/i18n/locale.js +10 -0
- package/dist/i18n/locale.js.map +1 -0
- package/dist/i18n/messages.d.ts +116 -0
- package/dist/i18n/messages.js +149 -0
- package/dist/i18n/messages.js.map +1 -0
- package/dist/i18n/namespaces/action-bar.d.ts +7 -0
- package/dist/i18n/namespaces/action-bar.js +15 -0
- package/dist/i18n/namespaces/action-bar.js.map +1 -0
- package/dist/i18n/namespaces/avatar-group.d.ts +14 -0
- package/dist/i18n/namespaces/avatar-group.js +13 -0
- package/dist/i18n/namespaces/avatar-group.js.map +1 -0
- package/dist/i18n/namespaces/badge-overflow.d.ts +12 -0
- package/dist/i18n/namespaces/badge-overflow.js +11 -0
- package/dist/i18n/namespaces/badge-overflow.js.map +1 -0
- package/dist/i18n/namespaces/banner.d.ts +9 -0
- package/dist/i18n/namespaces/banner.js +7 -0
- package/dist/i18n/namespaces/banner.js.map +1 -0
- package/dist/i18n/namespaces/breadcrumb.d.ts +11 -0
- package/dist/i18n/namespaces/breadcrumb.js +13 -0
- package/dist/i18n/namespaces/breadcrumb.js.map +1 -0
- package/dist/i18n/namespaces/calendar.d.ts +40 -0
- package/dist/i18n/namespaces/calendar.js +25 -0
- package/dist/i18n/namespaces/calendar.js.map +1 -0
- package/dist/i18n/namespaces/carousel.d.ts +15 -0
- package/dist/i18n/namespaces/carousel.js +17 -0
- package/dist/i18n/namespaces/carousel.js.map +1 -0
- package/dist/i18n/namespaces/combobox.d.ts +21 -0
- package/dist/i18n/namespaces/combobox.js +23 -0
- package/dist/i18n/namespaces/combobox.js.map +1 -0
- package/dist/i18n/namespaces/command-palette.d.ts +20 -0
- package/dist/i18n/namespaces/command-palette.js +19 -0
- package/dist/i18n/namespaces/command-palette.js.map +1 -0
- package/dist/i18n/namespaces/command.d.ts +11 -0
- package/dist/i18n/namespaces/command.js +13 -0
- package/dist/i18n/namespaces/command.js.map +1 -0
- package/dist/i18n/namespaces/confirm-dialog.d.ts +13 -0
- package/dist/i18n/namespaces/confirm-dialog.js +15 -0
- package/dist/i18n/namespaces/confirm-dialog.js.map +1 -0
- package/dist/i18n/namespaces/contrast.d.ts +7 -0
- package/dist/i18n/namespaces/contrast.js +13 -0
- package/dist/i18n/namespaces/contrast.js.map +1 -0
- package/dist/i18n/namespaces/copy-button.d.ts +11 -0
- package/dist/i18n/namespaces/copy-button.js +13 -0
- package/dist/i18n/namespaces/copy-button.js.map +1 -0
- package/dist/i18n/namespaces/cropper.d.ts +7 -0
- package/dist/i18n/namespaces/cropper.js +17 -0
- package/dist/i18n/namespaces/cropper.js.map +1 -0
- package/dist/i18n/namespaces/data-table.d.ts +7 -0
- package/dist/i18n/namespaces/data-table.js +23 -0
- package/dist/i18n/namespaces/data-table.js.map +1 -0
- package/dist/i18n/namespaces/date-picker.d.ts +42 -0
- package/dist/i18n/namespaces/date-picker.js +35 -0
- package/dist/i18n/namespaces/date-picker.js.map +1 -0
- package/dist/i18n/namespaces/dialog.d.ts +9 -0
- package/dist/i18n/namespaces/dialog.js +7 -0
- package/dist/i18n/namespaces/dialog.js.map +1 -0
- package/dist/i18n/namespaces/display-axis.d.ts +25 -0
- package/dist/i18n/namespaces/display-axis.js +21 -0
- package/dist/i18n/namespaces/display-axis.js.map +1 -0
- package/dist/i18n/namespaces/file-upload.d.ts +11 -0
- package/dist/i18n/namespaces/file-upload.js +19 -0
- package/dist/i18n/namespaces/file-upload.js.map +1 -0
- package/dist/i18n/namespaces/filter-chips.d.ts +11 -0
- package/dist/i18n/namespaces/filter-chips.js +13 -0
- package/dist/i18n/namespaces/filter-chips.js.map +1 -0
- package/dist/i18n/namespaces/image-upload-field.d.ts +12 -0
- package/dist/i18n/namespaces/image-upload-field.js +23 -0
- package/dist/i18n/namespaces/image-upload-field.js.map +1 -0
- package/dist/i18n/namespaces/inline-edit.d.ts +15 -0
- package/dist/i18n/namespaces/inline-edit.js +17 -0
- package/dist/i18n/namespaces/inline-edit.js.map +1 -0
- package/dist/i18n/namespaces/kanban.d.ts +11 -0
- package/dist/i18n/namespaces/kanban.js +39 -0
- package/dist/i18n/namespaces/kanban.js.map +1 -0
- package/dist/i18n/namespaces/key-value.d.ts +10 -0
- package/dist/i18n/namespaces/key-value.js +19 -0
- package/dist/i18n/namespaces/key-value.js.map +1 -0
- package/dist/i18n/namespaces/mention.d.ts +9 -0
- package/dist/i18n/namespaces/mention.js +7 -0
- package/dist/i18n/namespaces/mention.js.map +1 -0
- package/dist/i18n/namespaces/pagination.d.ts +19 -0
- package/dist/i18n/namespaces/pagination.js +21 -0
- package/dist/i18n/namespaces/pagination.js.map +1 -0
- package/dist/i18n/namespaces/phone-input.d.ts +10 -0
- package/dist/i18n/namespaces/phone-input.js +17 -0
- package/dist/i18n/namespaces/phone-input.js.map +1 -0
- package/dist/i18n/namespaces/rating.d.ts +12 -0
- package/dist/i18n/namespaces/rating.js +11 -0
- package/dist/i18n/namespaces/rating.js.map +1 -0
- package/dist/i18n/namespaces/route-tabs.d.ts +9 -0
- package/dist/i18n/namespaces/route-tabs.js +7 -0
- package/dist/i18n/namespaces/route-tabs.js.map +1 -0
- package/dist/i18n/namespaces/scroll-spy.d.ts +9 -0
- package/dist/i18n/namespaces/scroll-spy.js +7 -0
- package/dist/i18n/namespaces/scroll-spy.js.map +1 -0
- package/dist/i18n/namespaces/search-filter-bar.d.ts +15 -0
- package/dist/i18n/namespaces/search-filter-bar.js +32 -0
- package/dist/i18n/namespaces/search-filter-bar.js.map +1 -0
- package/dist/i18n/namespaces/sheet.d.ts +9 -0
- package/dist/i18n/namespaces/sheet.js +7 -0
- package/dist/i18n/namespaces/sheet.js.map +1 -0
- package/dist/i18n/namespaces/shell.d.ts +17 -0
- package/dist/i18n/namespaces/shell.js +75 -0
- package/dist/i18n/namespaces/shell.js.map +1 -0
- package/dist/i18n/namespaces/spinner.d.ts +9 -0
- package/dist/i18n/namespaces/spinner.js +7 -0
- package/dist/i18n/namespaces/spinner.js.map +1 -0
- package/dist/i18n/namespaces/stepper.d.ts +7 -0
- package/dist/i18n/namespaces/stepper.js +15 -0
- package/dist/i18n/namespaces/stepper.js.map +1 -0
- package/dist/i18n/namespaces/table-pagination.d.ts +7 -0
- package/dist/i18n/namespaces/table-pagination.js +29 -0
- package/dist/i18n/namespaces/table-pagination.js.map +1 -0
- package/dist/i18n/namespaces/tags-input.d.ts +12 -0
- package/dist/i18n/namespaces/tags-input.js +11 -0
- package/dist/i18n/namespaces/tags-input.js.map +1 -0
- package/dist/i18n/namespaces/time-picker.d.ts +15 -0
- package/dist/i18n/namespaces/time-picker.js +25 -0
- package/dist/i18n/namespaces/time-picker.js.map +1 -0
- package/dist/i18n/namespaces/toast.d.ts +15 -0
- package/dist/i18n/namespaces/toast.js +7 -0
- package/dist/i18n/namespaces/toast.js.map +1 -0
- package/dist/i18n/namespaces/tour.d.ts +7 -0
- package/dist/i18n/namespaces/tour.js +21 -0
- package/dist/i18n/namespaces/tour.js.map +1 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.js +66 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/compose-refs.js.map +1 -0
- package/dist/lib/use-as-ref.js.map +1 -0
- package/dist/lib/use-is-mobile.d.ts +10 -0
- package/dist/lib/use-is-mobile.js +21 -0
- package/dist/lib/use-is-mobile.js.map +1 -0
- package/dist/lib/use-isomorphic-layout-effect.js.map +1 -0
- package/dist/lib/use-lazy-ref.js.map +1 -0
- package/dist/lib/visually-hidden-input.d.ts +12 -0
- package/dist/lib/visually-hidden-input.js +105 -0
- package/dist/lib/visually-hidden-input.js.map +1 -0
- package/dist/shell/app-header.js.map +1 -1
- package/dist/shell/app-shell.d.ts +20 -2
- package/dist/shell/app-shell.js +4 -1
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/contrast-constants.d.ts +9 -1
- package/dist/shell/contrast-constants.js +2 -4
- package/dist/shell/contrast-constants.js.map +1 -1
- package/dist/shell/contrast-toggle.d.ts +4 -1
- package/dist/shell/contrast-toggle.js +2 -2
- package/dist/shell/contrast-toggle.js.map +1 -1
- package/dist/shell/display-axis-constants.d.ts +2 -1
- package/dist/shell/display-axis-constants.js.map +1 -1
- package/dist/shell/display-axis-controls.d.ts +15 -6
- package/dist/shell/display-axis-controls.js +11 -9
- package/dist/shell/display-axis-controls.js.map +1 -1
- package/dist/shell/mobile-menu.js.map +1 -1
- package/dist/shell/notifications-button.d.ts +1 -1
- package/dist/shell/notifications-button.js +3 -2
- package/dist/shell/notifications-button.js.map +1 -1
- package/dist/shell/shell-context.d.ts +4 -1
- package/dist/shell/shell-context.js +2 -4
- package/dist/shell/shell-context.js.map +1 -1
- package/dist/shell/sidebar.d.ts +1 -1
- package/dist/shell/sidebar.js.map +1 -1
- package/dist/shell/theme-toggle.d.ts +6 -3
- package/dist/shell/theme-toggle.js +2 -2
- package/dist/shell/theme-toggle.js.map +1 -1
- package/dist/shell/types.d.ts +14 -8
- package/dist/shell/types.js +2 -35
- package/dist/shell/types.js.map +1 -1
- package/dist/shell/user-menu.d.ts +6 -6
- package/dist/shell/user-menu.js.map +1 -1
- package/dist/shell/utils.d.ts +1 -1
- package/dist/shell/utils.js.map +1 -1
- package/dist/shell/workspace-switcher.js +1 -1
- package/dist/shell/workspace-switcher.js.map +1 -1
- package/dist/uploader/file-upload-constants.d.ts +13 -0
- package/dist/uploader/file-upload-constants.js +4 -16
- package/dist/uploader/file-upload-constants.js.map +1 -1
- package/dist/uploader/file-upload.d.ts +4 -1
- package/dist/uploader/file-upload.js +2 -2
- package/dist/uploader/file-upload.js.map +1 -1
- package/dist/uploader/image-upload-field.d.ts +5 -1
- package/dist/uploader/image-upload-field.js +2 -2
- package/dist/uploader/image-upload-field.js.map +1 -1
- package/dist/uploader/use-file-upload.d.ts +4 -0
- package/dist/uploader/use-file-upload.js +6 -2
- package/dist/uploader/use-file-upload.js.map +1 -1
- package/package.json +8 -3
- package/styles.css +19 -0
- package/dist/data-grid/compose-refs.js.map +0 -1
- package/dist/data-grid/use-as-ref.js.map +0 -1
- package/dist/data-grid/use-isomorphic-layout-effect.js.map +0 -1
- package/dist/data-grid/use-lazy-ref.js.map +0 -1
- /package/dist/{data-grid → lib}/compose-refs.d.ts +0 -0
- /package/dist/{data-grid → lib}/compose-refs.js +0 -0
- /package/dist/{data-grid → lib}/use-as-ref.d.ts +0 -0
- /package/dist/{data-grid → lib}/use-as-ref.js +0 -0
- /package/dist/{data-grid → lib}/use-isomorphic-layout-effect.d.ts +0 -0
- /package/dist/{data-grid → lib}/use-isomorphic-layout-effect.js +0 -0
- /package/dist/{data-grid → lib}/use-lazy-ref.d.ts +0 -0
- /package/dist/{data-grid → lib}/use-lazy-ref.js +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nhãn mặc định của `ActionBar`.
|
|
3
|
+
*
|
|
4
|
+
* Module **CỐ Ý không có `"use client"`** — xem `src/chart/chart-colors.ts` để biết lý do đầy đủ:
|
|
5
|
+
* mọi export của một file `"use client"` đến tay Server Component dưới dạng client-reference
|
|
6
|
+
* proxy, đọc ra `undefined` mà KHÔNG throw, KHÔNG warning.
|
|
7
|
+
*
|
|
8
|
+
* ⚠ Barrel `src/index.ts` xuất module này TRỰC TIẾP. `action-bar.tsx` chỉ được `import`, KHÔNG
|
|
9
|
+
* được `export` lại (re-export qua file client là vô hiệu, và đụng tên với `export *`).
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Toàn bộ chuỗi hiển thị và chuỗi a11y của `ActionBar`. Theo `ComitorLocaleProvider` (mặc định
|
|
13
|
+
* tiếng Anh, bảng tiếng Việt dựng sẵn); truyền một phần qua prop `labels` của `ActionBar` để đè.
|
|
14
|
+
*
|
|
15
|
+
* Khoá có số chèn vào là HÀM: nối chuỗi ở phía app là cách chắc chắn sai trật tự từ ở ngôn ngữ khác.
|
|
16
|
+
*/
|
|
17
|
+
interface ActionBarLabels {
|
|
18
|
+
/** `aria-label` của thanh (`role="toolbar"`) — prop `aria-label` của `ActionBar` vẫn thắng. */
|
|
19
|
+
toolbar: string;
|
|
20
|
+
/** Dòng đếm `ActionBarSelection` hiện khi có prop `count` ("3 selected" / "Đã chọn 3"). */
|
|
21
|
+
selected: (count: number) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Tên cho trình đọc màn hình của `ActionBarClose` — nút chỉ có icon X. Đóng thanh ở khuôn dùng
|
|
24
|
+
* chuẩn là BỎ CHỌN (app xoá vùng chọn trong `onOpenChange(false)`), nên tên nói đúng việc đó.
|
|
25
|
+
*/
|
|
26
|
+
close: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Nhãn TIẾNG ANH mặc định (từ `3.0.0`; trước đó là tiếng Việt). Bảng tiếng Việt:
|
|
30
|
+
* `comitorMessagesVi.actionBar`. Component không đọc thẳng hằng này — nó đọc bảng của
|
|
31
|
+
* `ComitorLocaleProvider`; hằng ở đây để app trải ra khi tự dựng nhãn.
|
|
32
|
+
*/
|
|
33
|
+
declare const DEFAULT_ACTION_BAR_LABELS: ActionBarLabels;
|
|
34
|
+
|
|
35
|
+
export { type ActionBarLabels, DEFAULT_ACTION_BAR_LABELS };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/action-bar-constants.ts"],"sourcesContent":["/**\n * Nhãn mặc định của `ActionBar`.\n *\n * Module **CỐ Ý không có `\"use client\"`** — xem `src/chart/chart-colors.ts` để biết lý do đầy đủ:\n * mọi export của một file `\"use client\"` đến tay Server Component dưới dạng client-reference\n * proxy, đọc ra `undefined` mà KHÔNG throw, KHÔNG warning.\n *\n * ⚠ Barrel `src/index.ts` xuất module này TRỰC TIẾP. `action-bar.tsx` chỉ được `import`, KHÔNG\n * được `export` lại (re-export qua file client là vô hiệu, và đụng tên với `export *`).\n */\n\nimport { actionBarEn } from \"../../i18n/namespaces/action-bar.js\";\n\n/**\n * Toàn bộ chuỗi hiển thị và chuỗi a11y của `ActionBar`. Theo `ComitorLocaleProvider` (mặc định\n * tiếng Anh, bảng tiếng Việt dựng sẵn); truyền một phần qua prop `labels` của `ActionBar` để đè.\n *\n * Khoá có số chèn vào là HÀM: nối chuỗi ở phía app là cách chắc chắn sai trật tự từ ở ngôn ngữ khác.\n */\nexport interface ActionBarLabels {\n /** `aria-label` của thanh (`role=\"toolbar\"`) — prop `aria-label` của `ActionBar` vẫn thắng. */\n toolbar: string;\n /** Dòng đếm `ActionBarSelection` hiện khi có prop `count` (\"3 selected\" / \"Đã chọn 3\"). */\n selected: (count: number) => string;\n /**\n * Tên cho trình đọc màn hình của `ActionBarClose` — nút chỉ có icon X. Đóng thanh ở khuôn dùng\n * chuẩn là BỎ CHỌN (app xoá vùng chọn trong `onOpenChange(false)`), nên tên nói đúng việc đó.\n */\n close: string;\n}\n\n/**\n * Nhãn TIẾNG ANH mặc định (từ `3.0.0`; trước đó là tiếng Việt). Bảng tiếng Việt:\n * `comitorMessagesVi.actionBar`. Component không đọc thẳng hằng này — nó đọc bảng của\n * `ComitorLocaleProvider`; hằng ở đây để app trải ra khi tự dựng nhãn.\n */\nexport const DEFAULT_ACTION_BAR_LABELS: ActionBarLabels = { ...actionBarEn };\n"],"mappings":"AAWA,SAAS,mBAAmB;AAyBrB,MAAM,4BAA6C,EAAE,GAAG,YAAY;","names":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ActionBarLabels } from './action-bar-constants.js';
|
|
3
|
+
import { Button } from './button.js';
|
|
4
|
+
import 'class-variance-authority/types';
|
|
5
|
+
import 'class-variance-authority';
|
|
6
|
+
|
|
7
|
+
type Direction = "ltr" | "rtl";
|
|
8
|
+
type Orientation = "horizontal" | "vertical";
|
|
9
|
+
interface DivProps extends React.ComponentProps<"div"> {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface ActionBarProps extends DivProps {
|
|
13
|
+
open?: boolean;
|
|
14
|
+
onOpenChange?: (open: boolean) => void;
|
|
15
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
16
|
+
align?: "start" | "center" | "end";
|
|
17
|
+
alignOffset?: number;
|
|
18
|
+
side?: "top" | "bottom";
|
|
19
|
+
sideOffset?: number;
|
|
20
|
+
portalContainer?: Element | DocumentFragment | null;
|
|
21
|
+
dir?: Direction;
|
|
22
|
+
orientation?: Orientation;
|
|
23
|
+
loop?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Chuỗi hiển thị và chuỗi a11y (tên thanh, dòng "N selected", tên nút đóng). Không truyền thì
|
|
26
|
+
* theo namespace `actionBar` của `ComitorLocaleProvider` (mặc định tiếng Anh); truyền một phần
|
|
27
|
+
* là đủ.
|
|
28
|
+
*
|
|
29
|
+
* ⚠ Thêm so với thượng nguồn: bản gốc không có chuỗi nào — thanh `role="toolbar"` không tên và
|
|
30
|
+
* nút đóng chỉ chứa `<X />` là một nút KHÔNG TÊN với trình đọc màn hình.
|
|
31
|
+
*/
|
|
32
|
+
labels?: Partial<ActionBarLabels>;
|
|
33
|
+
}
|
|
34
|
+
declare function ActionBar(props: ActionBarProps): React.JSX.Element | null;
|
|
35
|
+
interface ActionBarSelectionProps extends DivProps {
|
|
36
|
+
/**
|
|
37
|
+
* Số mục đang chọn. Có giá trị thì phần tử tự in `labels.selected(count)` ("3 selected") TRƯỚC
|
|
38
|
+
* `children` — nên `children` chỉ còn là dấu ngăn + nút đóng.
|
|
39
|
+
*
|
|
40
|
+
* ⚠ Thêm so với thượng nguồn: bản gốc để app tự viết chữ ("{n} selected"), tức chuỗi hiển thị
|
|
41
|
+
* không đi qua `labels`. Bỏ qua khi `asChild` (Slot chỉ nhận đúng MỘT phần tử con).
|
|
42
|
+
*/
|
|
43
|
+
count?: number;
|
|
44
|
+
}
|
|
45
|
+
declare function ActionBarSelection(props: ActionBarSelectionProps): React.JSX.Element;
|
|
46
|
+
declare function ActionBarGroup(props: DivProps): React.JSX.Element;
|
|
47
|
+
interface ActionBarItemProps extends Omit<React.ComponentProps<typeof Button>, "onSelect"> {
|
|
48
|
+
onSelect?: (event: Event) => void;
|
|
49
|
+
}
|
|
50
|
+
declare function ActionBarItem(props: ActionBarItemProps): React.JSX.Element;
|
|
51
|
+
interface ActionBarCloseProps extends React.ComponentProps<"button"> {
|
|
52
|
+
asChild?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Nút đóng thanh (thường là "bỏ chọn"). Không truyền `children` thì vẽ icon X.
|
|
56
|
+
*
|
|
57
|
+
* ⚠ Khác thượng nguồn: có tên cho trình đọc màn hình — `aria-label` mặc định `labels.close`
|
|
58
|
+
* ("Clear selection"). Bản gốc chỉ render `children`, và khuôn dùng của chính thượng nguồn là
|
|
59
|
+
* `<ActionBarClose><X /></ActionBarClose>`: một nút KHÔNG TÊN. Nếu `children` là CHỮ nhìn thấy
|
|
60
|
+
* được thì truyền `aria-label` trùng với chữ đó (WCAG 2.5.3), hoặc `aria-label={undefined}`.
|
|
61
|
+
*/
|
|
62
|
+
declare function ActionBarClose(props: ActionBarCloseProps): React.JSX.Element;
|
|
63
|
+
interface ActionBarSeparatorProps extends DivProps {
|
|
64
|
+
orientation?: Orientation;
|
|
65
|
+
}
|
|
66
|
+
declare function ActionBarSeparator(props: ActionBarSeparatorProps): React.JSX.Element;
|
|
67
|
+
|
|
68
|
+
export { ActionBar, ActionBarClose, type ActionBarCloseProps, ActionBarGroup, ActionBarItem, type ActionBarItemProps, type ActionBarProps, ActionBarSelection, type ActionBarSelectionProps, ActionBarSeparator, type ActionBarSeparatorProps };
|
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useDirection } from "@radix-ui/react-direction";
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
+
import { X } from "lucide-react";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import * as ReactDOM from "react-dom";
|
|
8
|
+
import { useComitorLabels } from "../../i18n/locale-provider.js";
|
|
9
|
+
import { cn } from "../../lib/cn.js";
|
|
10
|
+
import { useComposedRefs } from "../../lib/compose-refs.js";
|
|
11
|
+
import { useAsRef } from "../../lib/use-as-ref.js";
|
|
12
|
+
import { useIsomorphicLayoutEffect } from "../../lib/use-isomorphic-layout-effect.js";
|
|
13
|
+
import { Button } from "./button.js";
|
|
14
|
+
const ROOT_NAME = "ActionBar";
|
|
15
|
+
const GROUP_NAME = "ActionBarGroup";
|
|
16
|
+
const ITEM_NAME = "ActionBarItem";
|
|
17
|
+
const CLOSE_NAME = "ActionBarClose";
|
|
18
|
+
const SELECTION_NAME = "ActionBarSelection";
|
|
19
|
+
const SEPARATOR_NAME = "ActionBarSeparator";
|
|
20
|
+
const ITEM_SELECT = "actionbar.itemSelect";
|
|
21
|
+
const ENTRY_FOCUS = "actionbarFocusGroup.onEntryFocus";
|
|
22
|
+
const EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
23
|
+
function focusFirst(candidates, preventScroll = false) {
|
|
24
|
+
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
25
|
+
for (const candidateRef of candidates) {
|
|
26
|
+
const candidate = candidateRef.current;
|
|
27
|
+
if (!candidate) continue;
|
|
28
|
+
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
29
|
+
candidate.focus({ preventScroll });
|
|
30
|
+
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function wrapArray(array, startIndex) {
|
|
34
|
+
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
35
|
+
}
|
|
36
|
+
function getDirectionAwareKey(key, dir) {
|
|
37
|
+
if (dir !== "rtl") return key;
|
|
38
|
+
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
39
|
+
}
|
|
40
|
+
const ActionBarContext = React.createContext(null);
|
|
41
|
+
function useActionBarContext(consumerName) {
|
|
42
|
+
const context = React.useContext(ActionBarContext);
|
|
43
|
+
if (!context) {
|
|
44
|
+
throw new Error(`\`${consumerName}\` ph\u1EA3i n\u1EB1m b\xEAn trong \`${ROOT_NAME}\``);
|
|
45
|
+
}
|
|
46
|
+
return context;
|
|
47
|
+
}
|
|
48
|
+
const FocusContext = React.createContext(null);
|
|
49
|
+
function useFocusContext(consumerName) {
|
|
50
|
+
const context = React.useContext(FocusContext);
|
|
51
|
+
if (!context) {
|
|
52
|
+
throw new Error(`\`${consumerName}\` ph\u1EA3i n\u1EB1m b\xEAn trong \`FocusProvider\``);
|
|
53
|
+
}
|
|
54
|
+
return context;
|
|
55
|
+
}
|
|
56
|
+
function ActionBar(props) {
|
|
57
|
+
const {
|
|
58
|
+
open = false,
|
|
59
|
+
onOpenChange,
|
|
60
|
+
onEscapeKeyDown,
|
|
61
|
+
side = "bottom",
|
|
62
|
+
alignOffset = 0,
|
|
63
|
+
align = "center",
|
|
64
|
+
sideOffset = 16,
|
|
65
|
+
portalContainer: portalContainerProp,
|
|
66
|
+
dir: dirProp,
|
|
67
|
+
orientation = "horizontal",
|
|
68
|
+
loop = true,
|
|
69
|
+
labels: labelsProp,
|
|
70
|
+
className,
|
|
71
|
+
style,
|
|
72
|
+
ref,
|
|
73
|
+
asChild,
|
|
74
|
+
...rootProps
|
|
75
|
+
} = props;
|
|
76
|
+
const [mounted, setMounted] = React.useState(false);
|
|
77
|
+
const rootRef = React.useRef(null);
|
|
78
|
+
const composedRef = useComposedRefs(ref, rootRef);
|
|
79
|
+
const propsRef = useAsRef({
|
|
80
|
+
onEscapeKeyDown,
|
|
81
|
+
onOpenChange
|
|
82
|
+
});
|
|
83
|
+
const dir = useDirection(dirProp);
|
|
84
|
+
const labels = useComitorLabels("actionBar", labelsProp);
|
|
85
|
+
useIsomorphicLayoutEffect(() => {
|
|
86
|
+
setMounted(true);
|
|
87
|
+
}, []);
|
|
88
|
+
React.useEffect(() => {
|
|
89
|
+
if (!open) return;
|
|
90
|
+
const ownerDocument = rootRef.current?.ownerDocument ?? document;
|
|
91
|
+
function onKeyDown(event) {
|
|
92
|
+
if (event.key !== "Escape" || event.defaultPrevented || event.isComposing) return;
|
|
93
|
+
propsRef.current.onEscapeKeyDown?.(event);
|
|
94
|
+
if (!event.defaultPrevented) {
|
|
95
|
+
propsRef.current.onOpenChange?.(false);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
ownerDocument.addEventListener("keydown", onKeyDown);
|
|
99
|
+
return () => ownerDocument.removeEventListener("keydown", onKeyDown);
|
|
100
|
+
}, [open, propsRef]);
|
|
101
|
+
const contextValue = React.useMemo(
|
|
102
|
+
() => ({
|
|
103
|
+
onOpenChange,
|
|
104
|
+
dir,
|
|
105
|
+
orientation,
|
|
106
|
+
loop,
|
|
107
|
+
labels
|
|
108
|
+
}),
|
|
109
|
+
[onOpenChange, dir, orientation, loop, labels]
|
|
110
|
+
);
|
|
111
|
+
const portalContainer = portalContainerProp ?? (mounted ? globalThis.document?.body : null);
|
|
112
|
+
if (!portalContainer || !open) return null;
|
|
113
|
+
const RootPrimitive = asChild ? Slot : "div";
|
|
114
|
+
return /* @__PURE__ */ jsx(ActionBarContext.Provider, { value: contextValue, children: ReactDOM.createPortal(
|
|
115
|
+
/* @__PURE__ */ jsx(
|
|
116
|
+
RootPrimitive,
|
|
117
|
+
{
|
|
118
|
+
role: "toolbar",
|
|
119
|
+
"aria-label": labels.toolbar,
|
|
120
|
+
"aria-orientation": orientation,
|
|
121
|
+
"data-slot": "action-bar",
|
|
122
|
+
"data-side": side,
|
|
123
|
+
"data-align": align,
|
|
124
|
+
"data-orientation": orientation,
|
|
125
|
+
dir,
|
|
126
|
+
...rootProps,
|
|
127
|
+
ref: composedRef,
|
|
128
|
+
className: cn(
|
|
129
|
+
/*
|
|
130
|
+
* ⚠ Khác thượng nguồn: mặt nổi đi qua bộ token `popover` + `shadow-overlay` như mọi lớp
|
|
131
|
+
* nổi của gói (Popover, DropdownMenu). Bản gốc `bg-card shadow-lg` — `shadow-lg` là
|
|
132
|
+
* bóng mặc định của Tailwind, không có bản dark của gói (xem CLAUDE.md "Bóng").
|
|
133
|
+
*/
|
|
134
|
+
"fixed z-50 rounded-lg border bg-popover text-popover-foreground shadow-overlay outline-none",
|
|
135
|
+
"animate-in duration-250 fade-in-0 zoom-in-95 [animation-timing-function:cubic-bezier(0.16,1,0.3,1)]",
|
|
136
|
+
"data-[side=bottom]:slide-in-from-bottom-4 data-[side=top]:slide-in-from-top-4",
|
|
137
|
+
"motion-reduce:animate-none motion-reduce:transition-none",
|
|
138
|
+
/*
|
|
139
|
+
* ⚠ Khác thượng nguồn: chặn bề rộng theo khung nhìn và cho hàng ngang XUỐNG DÒNG. Bản gốc
|
|
140
|
+
* không có giới hạn nào — đo ở 375px: thanh rộng 413px, bắt đầu ở x = −19px, hai mép bị
|
|
141
|
+
* cắt và "Đã chọn 3" vỡ thành 3 dòng. Xuống dòng chứ không cuộn ngang: vùng cuộn sẽ cắt
|
|
142
|
+
* mất vòng focus của các nút ở mép.
|
|
143
|
+
*/
|
|
144
|
+
"max-w-[calc(100vw-1rem)]",
|
|
145
|
+
orientation === "horizontal" ? "flex flex-row flex-wrap items-center gap-2 px-2 py-1.5" : "flex flex-col items-start gap-2 px-1.5 py-2",
|
|
146
|
+
className
|
|
147
|
+
),
|
|
148
|
+
style: {
|
|
149
|
+
[side]: `${sideOffset}px`,
|
|
150
|
+
...align === "center" && {
|
|
151
|
+
left: "50%",
|
|
152
|
+
translate: "-50% 0"
|
|
153
|
+
},
|
|
154
|
+
...align === "start" && { left: `${alignOffset}px` },
|
|
155
|
+
...align === "end" && { right: `${alignOffset}px` },
|
|
156
|
+
...style
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
portalContainer
|
|
161
|
+
) });
|
|
162
|
+
}
|
|
163
|
+
function ActionBarSelection(props) {
|
|
164
|
+
const { className, asChild, count, children, ...selectionProps } = props;
|
|
165
|
+
const { labels } = useActionBarContext(SELECTION_NAME);
|
|
166
|
+
const SelectionPrimitive = asChild ? Slot : "div";
|
|
167
|
+
return /* @__PURE__ */ jsx(
|
|
168
|
+
SelectionPrimitive,
|
|
169
|
+
{
|
|
170
|
+
"data-slot": "action-bar-selection",
|
|
171
|
+
...selectionProps,
|
|
172
|
+
className: cn(
|
|
173
|
+
"flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border px-2 py-1 text-sm font-medium tabular-nums",
|
|
174
|
+
className
|
|
175
|
+
),
|
|
176
|
+
children: asChild ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
177
|
+
count !== void 0 && labels.selected(count),
|
|
178
|
+
children
|
|
179
|
+
] })
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
function ActionBarGroup(props) {
|
|
184
|
+
const {
|
|
185
|
+
onBlur: onBlurProp,
|
|
186
|
+
onFocus: onFocusProp,
|
|
187
|
+
onMouseDown: onMouseDownProp,
|
|
188
|
+
className,
|
|
189
|
+
asChild,
|
|
190
|
+
ref,
|
|
191
|
+
...groupProps
|
|
192
|
+
} = props;
|
|
193
|
+
const [tabStopId, setTabStopId] = React.useState(null);
|
|
194
|
+
const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);
|
|
195
|
+
const [focusableItemCount, setFocusableItemCount] = React.useState(0);
|
|
196
|
+
const groupRef = React.useRef(null);
|
|
197
|
+
const composedRef = useComposedRefs(ref, groupRef);
|
|
198
|
+
const isClickFocusRef = React.useRef(false);
|
|
199
|
+
const itemsRef = React.useRef(/* @__PURE__ */ new Map());
|
|
200
|
+
const { dir, orientation } = useActionBarContext(GROUP_NAME);
|
|
201
|
+
const onItemFocus = React.useCallback((tabStopId2) => {
|
|
202
|
+
setTabStopId(tabStopId2);
|
|
203
|
+
}, []);
|
|
204
|
+
const onItemShiftTab = React.useCallback(() => {
|
|
205
|
+
setIsTabbingBackOut(true);
|
|
206
|
+
}, []);
|
|
207
|
+
const onFocusableItemAdd = React.useCallback(() => {
|
|
208
|
+
setFocusableItemCount((prevCount) => prevCount + 1);
|
|
209
|
+
}, []);
|
|
210
|
+
const onFocusableItemRemove = React.useCallback(() => {
|
|
211
|
+
setFocusableItemCount((prevCount) => prevCount - 1);
|
|
212
|
+
}, []);
|
|
213
|
+
const onItemRegister = React.useCallback((item) => {
|
|
214
|
+
itemsRef.current.set(item.id, item);
|
|
215
|
+
}, []);
|
|
216
|
+
const onItemUnregister = React.useCallback((id) => {
|
|
217
|
+
itemsRef.current.delete(id);
|
|
218
|
+
}, []);
|
|
219
|
+
const getItems = React.useCallback(() => {
|
|
220
|
+
return Array.from(itemsRef.current.values()).filter((item) => item.ref.current).sort((a, b) => {
|
|
221
|
+
const elementA = a.ref.current;
|
|
222
|
+
const elementB = b.ref.current;
|
|
223
|
+
if (!elementA || !elementB) return 0;
|
|
224
|
+
const position = elementA.compareDocumentPosition(elementB);
|
|
225
|
+
if (position & Node.DOCUMENT_POSITION_FOLLOWING) {
|
|
226
|
+
return -1;
|
|
227
|
+
}
|
|
228
|
+
if (position & Node.DOCUMENT_POSITION_PRECEDING) {
|
|
229
|
+
return 1;
|
|
230
|
+
}
|
|
231
|
+
return 0;
|
|
232
|
+
});
|
|
233
|
+
}, []);
|
|
234
|
+
const onBlur = React.useCallback(
|
|
235
|
+
(event) => {
|
|
236
|
+
onBlurProp?.(event);
|
|
237
|
+
if (event.defaultPrevented) return;
|
|
238
|
+
setIsTabbingBackOut(false);
|
|
239
|
+
},
|
|
240
|
+
[onBlurProp]
|
|
241
|
+
);
|
|
242
|
+
const onFocus = React.useCallback(
|
|
243
|
+
(event) => {
|
|
244
|
+
onFocusProp?.(event);
|
|
245
|
+
if (event.defaultPrevented) return;
|
|
246
|
+
const isKeyboardFocus = !isClickFocusRef.current;
|
|
247
|
+
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
248
|
+
const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
249
|
+
event.currentTarget.dispatchEvent(entryFocusEvent);
|
|
250
|
+
if (!entryFocusEvent.defaultPrevented) {
|
|
251
|
+
const items = Array.from(itemsRef.current.values()).filter((item) => !item.disabled);
|
|
252
|
+
const currentItem = items.find((item) => item.id === tabStopId);
|
|
253
|
+
const candidateItems = [currentItem, ...items].filter(Boolean);
|
|
254
|
+
const candidateRefs = candidateItems.map((item) => item.ref);
|
|
255
|
+
focusFirst(candidateRefs, false);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
isClickFocusRef.current = false;
|
|
259
|
+
},
|
|
260
|
+
[onFocusProp, isTabbingBackOut, tabStopId]
|
|
261
|
+
);
|
|
262
|
+
const onMouseDown = React.useCallback(
|
|
263
|
+
(event) => {
|
|
264
|
+
onMouseDownProp?.(event);
|
|
265
|
+
if (event.defaultPrevented) return;
|
|
266
|
+
isClickFocusRef.current = true;
|
|
267
|
+
},
|
|
268
|
+
[onMouseDownProp]
|
|
269
|
+
);
|
|
270
|
+
const focusContextValue = React.useMemo(
|
|
271
|
+
() => ({
|
|
272
|
+
tabStopId,
|
|
273
|
+
onItemFocus,
|
|
274
|
+
onItemShiftTab,
|
|
275
|
+
onFocusableItemAdd,
|
|
276
|
+
onFocusableItemRemove,
|
|
277
|
+
onItemRegister,
|
|
278
|
+
onItemUnregister,
|
|
279
|
+
getItems
|
|
280
|
+
}),
|
|
281
|
+
[
|
|
282
|
+
tabStopId,
|
|
283
|
+
onItemFocus,
|
|
284
|
+
onItemShiftTab,
|
|
285
|
+
onFocusableItemAdd,
|
|
286
|
+
onFocusableItemRemove,
|
|
287
|
+
onItemRegister,
|
|
288
|
+
onItemUnregister,
|
|
289
|
+
getItems
|
|
290
|
+
]
|
|
291
|
+
);
|
|
292
|
+
const GroupPrimitive = asChild ? Slot : "div";
|
|
293
|
+
return /* @__PURE__ */ jsx(FocusContext.Provider, { value: focusContextValue, children: /* @__PURE__ */ jsx(
|
|
294
|
+
GroupPrimitive,
|
|
295
|
+
{
|
|
296
|
+
role: "group",
|
|
297
|
+
"data-slot": "action-bar-group",
|
|
298
|
+
"data-orientation": orientation,
|
|
299
|
+
dir,
|
|
300
|
+
tabIndex: isTabbingBackOut || focusableItemCount === 0 ? -1 : 0,
|
|
301
|
+
...groupProps,
|
|
302
|
+
ref: composedRef,
|
|
303
|
+
className: cn(
|
|
304
|
+
"flex gap-2 outline-none",
|
|
305
|
+
orientation === "horizontal" ? "items-center" : "w-full flex-col items-start",
|
|
306
|
+
className
|
|
307
|
+
),
|
|
308
|
+
onBlur,
|
|
309
|
+
onFocus,
|
|
310
|
+
onMouseDown
|
|
311
|
+
}
|
|
312
|
+
) });
|
|
313
|
+
}
|
|
314
|
+
function ActionBarItem(props) {
|
|
315
|
+
const {
|
|
316
|
+
onSelect,
|
|
317
|
+
onClick: onClickProp,
|
|
318
|
+
onFocus: onFocusProp,
|
|
319
|
+
onKeyDown: onKeyDownProp,
|
|
320
|
+
onMouseDown: onMouseDownProp,
|
|
321
|
+
className,
|
|
322
|
+
disabled,
|
|
323
|
+
ref,
|
|
324
|
+
...itemProps
|
|
325
|
+
} = props;
|
|
326
|
+
const itemRef = React.useRef(null);
|
|
327
|
+
const composedRef = useComposedRefs(ref, itemRef);
|
|
328
|
+
const isMouseClickRef = React.useRef(false);
|
|
329
|
+
const { onOpenChange, dir, orientation, loop } = useActionBarContext(ITEM_NAME);
|
|
330
|
+
const focusContext = useFocusContext(ITEM_NAME);
|
|
331
|
+
const itemId = React.useId();
|
|
332
|
+
const isTabStop = focusContext.tabStopId === itemId;
|
|
333
|
+
useIsomorphicLayoutEffect(() => {
|
|
334
|
+
focusContext.onItemRegister({
|
|
335
|
+
id: itemId,
|
|
336
|
+
ref: itemRef,
|
|
337
|
+
disabled: !!disabled
|
|
338
|
+
});
|
|
339
|
+
if (!disabled) {
|
|
340
|
+
focusContext.onFocusableItemAdd();
|
|
341
|
+
}
|
|
342
|
+
return () => {
|
|
343
|
+
focusContext.onItemUnregister(itemId);
|
|
344
|
+
if (!disabled) {
|
|
345
|
+
focusContext.onFocusableItemRemove();
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
}, [focusContext, itemId, disabled]);
|
|
349
|
+
const onClick = React.useCallback(
|
|
350
|
+
(event) => {
|
|
351
|
+
onClickProp?.(event);
|
|
352
|
+
if (event.defaultPrevented) return;
|
|
353
|
+
const item = itemRef.current;
|
|
354
|
+
if (!item) return;
|
|
355
|
+
const itemSelectEvent = new CustomEvent(ITEM_SELECT, {
|
|
356
|
+
bubbles: true,
|
|
357
|
+
cancelable: true
|
|
358
|
+
});
|
|
359
|
+
item.addEventListener(ITEM_SELECT, (event2) => onSelect?.(event2), {
|
|
360
|
+
once: true
|
|
361
|
+
});
|
|
362
|
+
item.dispatchEvent(itemSelectEvent);
|
|
363
|
+
if (!itemSelectEvent.defaultPrevented) {
|
|
364
|
+
onOpenChange?.(false);
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
[onClickProp, onOpenChange, onSelect]
|
|
368
|
+
);
|
|
369
|
+
const onFocus = React.useCallback(
|
|
370
|
+
(event) => {
|
|
371
|
+
onFocusProp?.(event);
|
|
372
|
+
if (event.defaultPrevented) return;
|
|
373
|
+
focusContext.onItemFocus(itemId);
|
|
374
|
+
isMouseClickRef.current = false;
|
|
375
|
+
},
|
|
376
|
+
[onFocusProp, focusContext, itemId]
|
|
377
|
+
);
|
|
378
|
+
const onKeyDown = React.useCallback(
|
|
379
|
+
(event) => {
|
|
380
|
+
onKeyDownProp?.(event);
|
|
381
|
+
if (event.defaultPrevented) return;
|
|
382
|
+
if (event.key === "Tab" && event.shiftKey) {
|
|
383
|
+
focusContext.onItemShiftTab();
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (event.target !== event.currentTarget) return;
|
|
387
|
+
const key = getDirectionAwareKey(event.key, dir);
|
|
388
|
+
let focusIntent;
|
|
389
|
+
if (orientation === "horizontal") {
|
|
390
|
+
if (key === "ArrowLeft") focusIntent = "prev";
|
|
391
|
+
else if (key === "ArrowRight") focusIntent = "next";
|
|
392
|
+
else if (key === "Home") focusIntent = "first";
|
|
393
|
+
else if (key === "End") focusIntent = "last";
|
|
394
|
+
} else {
|
|
395
|
+
if (key === "ArrowUp") focusIntent = "prev";
|
|
396
|
+
else if (key === "ArrowDown") focusIntent = "next";
|
|
397
|
+
else if (key === "Home") focusIntent = "first";
|
|
398
|
+
else if (key === "End") focusIntent = "last";
|
|
399
|
+
}
|
|
400
|
+
if (focusIntent !== void 0) {
|
|
401
|
+
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
|
|
402
|
+
event.preventDefault();
|
|
403
|
+
const items = focusContext.getItems().filter((item) => !item.disabled);
|
|
404
|
+
let candidateRefs = items.map((item) => item.ref);
|
|
405
|
+
if (focusIntent === "last") {
|
|
406
|
+
candidateRefs.reverse();
|
|
407
|
+
} else if (focusIntent === "prev" || focusIntent === "next") {
|
|
408
|
+
if (focusIntent === "prev") candidateRefs.reverse();
|
|
409
|
+
const currentIndex = candidateRefs.findIndex((ref2) => ref2.current === event.currentTarget);
|
|
410
|
+
candidateRefs = loop ? wrapArray(candidateRefs, currentIndex + 1) : candidateRefs.slice(currentIndex + 1);
|
|
411
|
+
}
|
|
412
|
+
queueMicrotask(() => focusFirst(candidateRefs));
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
[onKeyDownProp, focusContext, dir, orientation, loop]
|
|
416
|
+
);
|
|
417
|
+
const onMouseDown = React.useCallback(
|
|
418
|
+
(event) => {
|
|
419
|
+
onMouseDownProp?.(event);
|
|
420
|
+
if (event.defaultPrevented) return;
|
|
421
|
+
isMouseClickRef.current = true;
|
|
422
|
+
if (disabled) {
|
|
423
|
+
event.preventDefault();
|
|
424
|
+
} else {
|
|
425
|
+
focusContext.onItemFocus(itemId);
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
[onMouseDownProp, focusContext, itemId, disabled]
|
|
429
|
+
);
|
|
430
|
+
return /* @__PURE__ */ jsx(
|
|
431
|
+
Button,
|
|
432
|
+
{
|
|
433
|
+
type: "button",
|
|
434
|
+
"data-slot": "action-bar-item",
|
|
435
|
+
variant: "secondary",
|
|
436
|
+
size: "sm",
|
|
437
|
+
disabled,
|
|
438
|
+
tabIndex: isTabStop ? 0 : -1,
|
|
439
|
+
...itemProps,
|
|
440
|
+
className: cn(
|
|
441
|
+
/*
|
|
442
|
+
* ⚠ Khác thượng nguồn: `Button` của gói KHÔNG tự đặt cỡ `svg` con (khác shadcn gốc), nên
|
|
443
|
+
* `<Copy />` trần trong mục ra 24px giữa một nút cao 32px. Đặt cỡ ở đây, đúng như
|
|
444
|
+
* `DropdownMenuItem`/`CommandItem` của gói — không thêm luật đó vào `Button` (CHANGELOG 2.0.0).
|
|
445
|
+
*/
|
|
446
|
+
"[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
447
|
+
orientation === "vertical" && "w-full",
|
|
448
|
+
className
|
|
449
|
+
),
|
|
450
|
+
ref: composedRef,
|
|
451
|
+
onClick,
|
|
452
|
+
onFocus,
|
|
453
|
+
onKeyDown,
|
|
454
|
+
onMouseDown
|
|
455
|
+
}
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
function ActionBarClose(props) {
|
|
459
|
+
const { asChild, className, onClick, children, ...closeProps } = props;
|
|
460
|
+
const { onOpenChange, labels } = useActionBarContext(CLOSE_NAME);
|
|
461
|
+
const onCloseClick = React.useCallback(
|
|
462
|
+
(event) => {
|
|
463
|
+
onClick?.(event);
|
|
464
|
+
if (event.defaultPrevented) return;
|
|
465
|
+
onOpenChange?.(false);
|
|
466
|
+
},
|
|
467
|
+
[onOpenChange, onClick]
|
|
468
|
+
);
|
|
469
|
+
const ClosePrimitive = asChild ? Slot : "button";
|
|
470
|
+
return /* @__PURE__ */ jsx(
|
|
471
|
+
ClosePrimitive,
|
|
472
|
+
{
|
|
473
|
+
type: "button",
|
|
474
|
+
"aria-label": labels.close,
|
|
475
|
+
"data-slot": "action-bar-close",
|
|
476
|
+
...closeProps,
|
|
477
|
+
className: cn(
|
|
478
|
+
/*
|
|
479
|
+
* ⚠ Khác thượng nguồn: cùng khuôn với nút đóng của `Dialog` — `text-muted-foreground` →
|
|
480
|
+
* `hover:text-foreground`, vòng focus `ring-ring/50` có `ring-offset`. Bản gốc
|
|
481
|
+
* `opacity-70 hover:opacity-100` và `focus-visible:border-ring` (nút không có viền nên
|
|
482
|
+
* dòng đó không vẽ gì).
|
|
483
|
+
* ⚠ Và vùng bấm: icon 14px trần là 14×14px, dưới mức 24×24 của WCAG 2.5.8. `p-[5px]` nâng
|
|
484
|
+
* vùng bấm lên 24px, `-m-[5px]` trả lại đúng chừng đó để chip chứa nó không phình ra.
|
|
485
|
+
*/
|
|
486
|
+
"-m-[5px] rounded-xs p-[5px] text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
|
|
487
|
+
className
|
|
488
|
+
),
|
|
489
|
+
onClick: onCloseClick,
|
|
490
|
+
children: children ?? (asChild ? null : /* @__PURE__ */ jsx(X, { "aria-hidden": "true" }))
|
|
491
|
+
}
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
function ActionBarSeparator(props) {
|
|
495
|
+
const { orientation: orientationProp, asChild, className, ...separatorProps } = props;
|
|
496
|
+
const context = useActionBarContext(SEPARATOR_NAME);
|
|
497
|
+
const orientation = orientationProp ?? context.orientation;
|
|
498
|
+
const SeparatorPrimitive = asChild ? Slot : "div";
|
|
499
|
+
return /* @__PURE__ */ jsx(
|
|
500
|
+
SeparatorPrimitive,
|
|
501
|
+
{
|
|
502
|
+
"aria-hidden": "true",
|
|
503
|
+
"data-orientation": orientation,
|
|
504
|
+
"data-slot": "action-bar-separator",
|
|
505
|
+
...separatorProps,
|
|
506
|
+
className: cn(
|
|
507
|
+
"bg-border in-data-[slot=action-bar-selection]:ml-0.5 in-data-[slot=action-bar-selection]:h-4 in-data-[slot=action-bar-selection]:w-px",
|
|
508
|
+
orientation === "horizontal" ? "h-6 w-px" : "h-px w-full",
|
|
509
|
+
className
|
|
510
|
+
)
|
|
511
|
+
}
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
export {
|
|
515
|
+
ActionBar,
|
|
516
|
+
ActionBarClose,
|
|
517
|
+
ActionBarGroup,
|
|
518
|
+
ActionBarItem,
|
|
519
|
+
ActionBarSelection,
|
|
520
|
+
ActionBarSeparator
|
|
521
|
+
};
|
|
522
|
+
//# sourceMappingURL=action-bar.js.map
|