@qijenchen/design-system 0.1.0-beta.10
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 +163 -0
- package/dist/components/Accordion/accordion.d.ts +37 -0
- package/dist/components/Accordion/accordion.d.ts.map +1 -0
- package/dist/components/Accordion/accordion.js +78 -0
- package/dist/components/Accordion/accordion.js.map +1 -0
- package/dist/components/Alert/alert.d.ts +47 -0
- package/dist/components/Alert/alert.d.ts.map +1 -0
- package/dist/components/Alert/alert.js +132 -0
- package/dist/components/Alert/alert.js.map +1 -0
- package/dist/components/AppShell/_demo-helpers.d.ts +49 -0
- package/dist/components/AppShell/_demo-helpers.d.ts.map +1 -0
- package/dist/components/AppShell/app-shell.d.ts +76 -0
- package/dist/components/AppShell/app-shell.d.ts.map +1 -0
- package/dist/components/AppShell/app-shell.js +214 -0
- package/dist/components/AppShell/app-shell.js.map +1 -0
- package/dist/components/AspectRatio/aspect-ratio.d.ts +40 -0
- package/dist/components/AspectRatio/aspect-ratio.d.ts.map +1 -0
- package/dist/components/AspectRatio/aspect-ratio.js +23 -0
- package/dist/components/AspectRatio/aspect-ratio.js.map +1 -0
- package/dist/components/Avatar/avatar.d.ts +85 -0
- package/dist/components/Avatar/avatar.d.ts.map +1 -0
- package/dist/components/Avatar/avatar.js +195 -0
- package/dist/components/Avatar/avatar.js.map +1 -0
- package/dist/components/Badge/badge.d.ts +43 -0
- package/dist/components/Badge/badge.d.ts.map +1 -0
- package/dist/components/Badge/badge.js +69 -0
- package/dist/components/Badge/badge.js.map +1 -0
- package/dist/components/Breadcrumb/breadcrumb.d.ts +163 -0
- package/dist/components/Breadcrumb/breadcrumb.d.ts.map +1 -0
- package/dist/components/Breadcrumb/breadcrumb.js +300 -0
- package/dist/components/Breadcrumb/breadcrumb.js.map +1 -0
- package/dist/components/BulkActionBar/bulk-action-bar.d.ts +46 -0
- package/dist/components/BulkActionBar/bulk-action-bar.d.ts.map +1 -0
- package/dist/components/BulkActionBar/bulk-action-bar.js +78 -0
- package/dist/components/BulkActionBar/bulk-action-bar.js.map +1 -0
- package/dist/components/Button/button-group.d.ts +49 -0
- package/dist/components/Button/button-group.d.ts.map +1 -0
- package/dist/components/Button/button-group.js +46 -0
- package/dist/components/Button/button-group.js.map +1 -0
- package/dist/components/Button/button.d.ts +203 -0
- package/dist/components/Button/button.d.ts.map +1 -0
- package/dist/components/Button/button.js +309 -0
- package/dist/components/Button/button.js.map +1 -0
- package/dist/components/Calendar/calendar.d.ts +81 -0
- package/dist/components/Calendar/calendar.d.ts.map +1 -0
- package/dist/components/Calendar/calendar.js +282 -0
- package/dist/components/Calendar/calendar.js.map +1 -0
- package/dist/components/Carousel/carousel.d.ts +61 -0
- package/dist/components/Carousel/carousel.d.ts.map +1 -0
- package/dist/components/Carousel/carousel.js +276 -0
- package/dist/components/Carousel/carousel.js.map +1 -0
- package/dist/components/Chart/chart.d.ts +94 -0
- package/dist/components/Chart/chart.d.ts.map +1 -0
- package/dist/components/Chart/chart.js +233 -0
- package/dist/components/Chart/chart.js.map +1 -0
- package/dist/components/Checkbox/checkbox-group.d.ts +58 -0
- package/dist/components/Checkbox/checkbox-group.d.ts.map +1 -0
- package/dist/components/Checkbox/checkbox-group.js +28 -0
- package/dist/components/Checkbox/checkbox-group.js.map +1 -0
- package/dist/components/Checkbox/checkbox.d.ts +73 -0
- package/dist/components/Checkbox/checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox/checkbox.js +125 -0
- package/dist/components/Checkbox/checkbox.js.map +1 -0
- package/dist/components/Chip/chip.d.ts +54 -0
- package/dist/components/Chip/chip.d.ts.map +1 -0
- package/dist/components/Chip/chip.js +224 -0
- package/dist/components/Chip/chip.js.map +1 -0
- package/dist/components/CircularProgress/circular-progress.d.ts +40 -0
- package/dist/components/CircularProgress/circular-progress.d.ts.map +1 -0
- package/dist/components/CircularProgress/circular-progress.js +118 -0
- package/dist/components/CircularProgress/circular-progress.js.map +1 -0
- package/dist/components/Coachmark/coachmark.d.ts +100 -0
- package/dist/components/Coachmark/coachmark.d.ts.map +1 -0
- package/dist/components/Coachmark/coachmark.js +107 -0
- package/dist/components/Coachmark/coachmark.js.map +1 -0
- package/dist/components/Combobox/combobox.d.ts +150 -0
- package/dist/components/Combobox/combobox.d.ts.map +1 -0
- package/dist/components/Combobox/combobox.js +595 -0
- package/dist/components/Combobox/combobox.js.map +1 -0
- package/dist/components/Command/command.d.ts +106 -0
- package/dist/components/Command/command.d.ts.map +1 -0
- package/dist/components/Command/command.js +123 -0
- package/dist/components/Command/command.js.map +1 -0
- package/dist/components/DataTable/active-editor-controller.d.ts +66 -0
- package/dist/components/DataTable/active-editor-controller.d.ts.map +1 -0
- package/dist/components/DataTable/cell-registry.d.ts +37 -0
- package/dist/components/DataTable/cell-registry.d.ts.map +1 -0
- package/dist/components/DataTable/cell-registry.js +377 -0
- package/dist/components/DataTable/cell-registry.js.map +1 -0
- package/dist/components/DataTable/column-types.d.ts +145 -0
- package/dist/components/DataTable/column-types.d.ts.map +1 -0
- package/dist/components/DataTable/column-types.js +17 -0
- package/dist/components/DataTable/column-types.js.map +1 -0
- package/dist/components/DataTable/data-table-column-visibility-panel.d.ts +49 -0
- package/dist/components/DataTable/data-table-column-visibility-panel.d.ts.map +1 -0
- package/dist/components/DataTable/data-table-filter-panel.d.ts +30 -0
- package/dist/components/DataTable/data-table-filter-panel.d.ts.map +1 -0
- package/dist/components/DataTable/data-table-interaction-layer.d.ts +78 -0
- package/dist/components/DataTable/data-table-interaction-layer.d.ts.map +1 -0
- package/dist/components/DataTable/data-table-interaction-layer.js +220 -0
- package/dist/components/DataTable/data-table-interaction-layer.js.map +1 -0
- package/dist/components/DataTable/data-table-sort-manager.d.ts +19 -0
- package/dist/components/DataTable/data-table-sort-manager.d.ts.map +1 -0
- package/dist/components/DataTable/data-table.d.ts +181 -0
- package/dist/components/DataTable/data-table.d.ts.map +1 -0
- package/dist/components/DataTable/data-table.js +1851 -0
- package/dist/components/DataTable/data-table.js.map +1 -0
- package/dist/components/DataTable/filter-operators.d.ts +116 -0
- package/dist/components/DataTable/filter-operators.d.ts.map +1 -0
- package/dist/components/DataTable/filter-tree.d.ts +66 -0
- package/dist/components/DataTable/filter-tree.d.ts.map +1 -0
- package/dist/components/DataTable/lib/column-meta.d.ts +49 -0
- package/dist/components/DataTable/lib/column-meta.d.ts.map +1 -0
- package/dist/components/DateGrid/date-grid.d.ts +61 -0
- package/dist/components/DateGrid/date-grid.d.ts.map +1 -0
- package/dist/components/DateGrid/date-grid.js +168 -0
- package/dist/components/DateGrid/date-grid.js.map +1 -0
- package/dist/components/DatePicker/date-picker.d.ts +119 -0
- package/dist/components/DatePicker/date-picker.d.ts.map +1 -0
- package/dist/components/DatePicker/date-picker.js +743 -0
- package/dist/components/DatePicker/date-picker.js.map +1 -0
- package/dist/components/DescriptionList/description-list.d.ts +60 -0
- package/dist/components/DescriptionList/description-list.d.ts.map +1 -0
- package/dist/components/DescriptionList/description-list.js +77 -0
- package/dist/components/DescriptionList/description-list.js.map +1 -0
- package/dist/components/Dialog/dialog.d.ts +54 -0
- package/dist/components/Dialog/dialog.d.ts.map +1 -0
- package/dist/components/Dialog/dialog.js +151 -0
- package/dist/components/Dialog/dialog.js.map +1 -0
- package/dist/components/DropdownMenu/dropdown-menu.d.ts +111 -0
- package/dist/components/DropdownMenu/dropdown-menu.d.ts.map +1 -0
- package/dist/components/DropdownMenu/dropdown-menu.js +288 -0
- package/dist/components/DropdownMenu/dropdown-menu.js.map +1 -0
- package/dist/components/Empty/empty.d.ts +40 -0
- package/dist/components/Empty/empty.d.ts.map +1 -0
- package/dist/components/Empty/empty.js +66 -0
- package/dist/components/Empty/empty.js.map +1 -0
- package/dist/components/Field/field-context.d.ts +77 -0
- package/dist/components/Field/field-context.d.ts.map +1 -0
- package/dist/components/Field/field-context.js +37 -0
- package/dist/components/Field/field-context.js.map +1 -0
- package/dist/components/Field/field-types.d.ts +5 -0
- package/dist/components/Field/field-types.d.ts.map +1 -0
- package/dist/components/Field/field-types.js +13 -0
- package/dist/components/Field/field-types.js.map +1 -0
- package/dist/components/Field/field-wrapper.d.ts +17 -0
- package/dist/components/Field/field-wrapper.d.ts.map +1 -0
- package/dist/components/Field/field-wrapper.js +252 -0
- package/dist/components/Field/field-wrapper.js.map +1 -0
- package/dist/components/Field/field.d.ts +127 -0
- package/dist/components/Field/field.d.ts.map +1 -0
- package/dist/components/Field/field.js +295 -0
- package/dist/components/Field/field.js.map +1 -0
- package/dist/components/FieldControlGroup/field-control-group.d.ts +74 -0
- package/dist/components/FieldControlGroup/field-control-group.d.ts.map +1 -0
- package/dist/components/FieldControlGroup/field-control-group.js +62 -0
- package/dist/components/FieldControlGroup/field-control-group.js.map +1 -0
- package/dist/components/FileItem/file-item.d.ts +44 -0
- package/dist/components/FileItem/file-item.d.ts.map +1 -0
- package/dist/components/FileItem/file-item.js +202 -0
- package/dist/components/FileItem/file-item.js.map +1 -0
- package/dist/components/FileUpload/file-upload.d.ts +97 -0
- package/dist/components/FileUpload/file-upload.d.ts.map +1 -0
- package/dist/components/FileUpload/file-upload.js +231 -0
- package/dist/components/FileUpload/file-upload.js.map +1 -0
- package/dist/components/FileViewer/file-viewer-types.d.ts +73 -0
- package/dist/components/FileViewer/file-viewer-types.d.ts.map +1 -0
- package/dist/components/FileViewer/file-viewer.d.ts +82 -0
- package/dist/components/FileViewer/file-viewer.d.ts.map +1 -0
- package/dist/components/FileViewer/file-viewer.js +752 -0
- package/dist/components/FileViewer/file-viewer.js.map +1 -0
- package/dist/components/FileViewer/image-renderer.d.ts +9 -0
- package/dist/components/FileViewer/image-renderer.d.ts.map +1 -0
- package/dist/components/FileViewer/image-renderer.js +165 -0
- package/dist/components/FileViewer/image-renderer.js.map +1 -0
- package/dist/components/HoverCard/hover-card.d.ts +30 -0
- package/dist/components/HoverCard/hover-card.d.ts.map +1 -0
- package/dist/components/HoverCard/hover-card.js +61 -0
- package/dist/components/HoverCard/hover-card.js.map +1 -0
- package/dist/components/Input/input.d.ts +72 -0
- package/dist/components/Input/input.d.ts.map +1 -0
- package/dist/components/Input/input.js +148 -0
- package/dist/components/Input/input.js.map +1 -0
- package/dist/components/LinkInput/link-input.d.ts +46 -0
- package/dist/components/LinkInput/link-input.d.ts.map +1 -0
- package/dist/components/LinkInput/link-input.js +215 -0
- package/dist/components/LinkInput/link-input.js.map +1 -0
- package/dist/components/Menu/menu-item.d.ts +83 -0
- package/dist/components/Menu/menu-item.d.ts.map +1 -0
- package/dist/components/Menu/menu-item.js +209 -0
- package/dist/components/Menu/menu-item.js.map +1 -0
- package/dist/components/NameCard/name-card.d.ts +85 -0
- package/dist/components/NameCard/name-card.d.ts.map +1 -0
- package/dist/components/NameCard/name-card.js +153 -0
- package/dist/components/NameCard/name-card.js.map +1 -0
- package/dist/components/Notice/notice.d.ts +69 -0
- package/dist/components/Notice/notice.d.ts.map +1 -0
- package/dist/components/Notice/notice.js +121 -0
- package/dist/components/Notice/notice.js.map +1 -0
- package/dist/components/NumberInput/number-input.d.ts +57 -0
- package/dist/components/NumberInput/number-input.d.ts.map +1 -0
- package/dist/components/NumberInput/number-input.js +131 -0
- package/dist/components/NumberInput/number-input.js.map +1 -0
- package/dist/components/OverflowIndicator/overflow-indicator.d.ts +23 -0
- package/dist/components/OverflowIndicator/overflow-indicator.d.ts.map +1 -0
- package/dist/components/OverflowIndicator/overflow-indicator.js +111 -0
- package/dist/components/OverflowIndicator/overflow-indicator.js.map +1 -0
- package/dist/components/PeoplePicker/avatar-stack-overflow.d.ts +57 -0
- package/dist/components/PeoplePicker/avatar-stack-overflow.d.ts.map +1 -0
- package/dist/components/PeoplePicker/avatar-stack-overflow.js +35 -0
- package/dist/components/PeoplePicker/avatar-stack-overflow.js.map +1 -0
- package/dist/components/PeoplePicker/people-picker-helpers.d.ts +7 -0
- package/dist/components/PeoplePicker/people-picker-helpers.d.ts.map +1 -0
- package/dist/components/PeoplePicker/people-picker-helpers.js +25 -0
- package/dist/components/PeoplePicker/people-picker-helpers.js.map +1 -0
- package/dist/components/PeoplePicker/people-picker.d.ts +77 -0
- package/dist/components/PeoplePicker/people-picker.d.ts.map +1 -0
- package/dist/components/PeoplePicker/people-picker.js +263 -0
- package/dist/components/PeoplePicker/people-picker.js.map +1 -0
- package/dist/components/PeoplePicker/person-display.d.ts +66 -0
- package/dist/components/PeoplePicker/person-display.d.ts.map +1 -0
- package/dist/components/PeoplePicker/person-display.js +203 -0
- package/dist/components/PeoplePicker/person-display.js.map +1 -0
- package/dist/components/Popover/popover.d.ts +50 -0
- package/dist/components/Popover/popover.d.ts.map +1 -0
- package/dist/components/Popover/popover.js +113 -0
- package/dist/components/Popover/popover.js.map +1 -0
- package/dist/components/ProgressBar/progress-bar.d.ts +37 -0
- package/dist/components/ProgressBar/progress-bar.d.ts.map +1 -0
- package/dist/components/ProgressBar/progress-bar.js +86 -0
- package/dist/components/ProgressBar/progress-bar.js.map +1 -0
- package/dist/components/RadioGroup/radio-group.d.ts +78 -0
- package/dist/components/RadioGroup/radio-group.d.ts.map +1 -0
- package/dist/components/RadioGroup/radio-group.js +153 -0
- package/dist/components/RadioGroup/radio-group.js.map +1 -0
- package/dist/components/Rating/rating.d.ts +46 -0
- package/dist/components/Rating/rating.d.ts.map +1 -0
- package/dist/components/Rating/rating.js +179 -0
- package/dist/components/Rating/rating.js.map +1 -0
- package/dist/components/ScrollArea/scroll-area.d.ts +45 -0
- package/dist/components/ScrollArea/scroll-area.d.ts.map +1 -0
- package/dist/components/ScrollArea/scroll-area.js +65 -0
- package/dist/components/ScrollArea/scroll-area.js.map +1 -0
- package/dist/components/SegmentedControl/segmented-control.d.ts +102 -0
- package/dist/components/SegmentedControl/segmented-control.d.ts.map +1 -0
- package/dist/components/SegmentedControl/segmented-control.js +171 -0
- package/dist/components/SegmentedControl/segmented-control.js.map +1 -0
- package/dist/components/Select/select.d.ts +102 -0
- package/dist/components/Select/select.d.ts.map +1 -0
- package/dist/components/Select/select.js +435 -0
- package/dist/components/Select/select.js.map +1 -0
- package/dist/components/SelectMenu/select-menu.d.ts +103 -0
- package/dist/components/SelectMenu/select-menu.d.ts.map +1 -0
- package/dist/components/SelectMenu/select-menu.js +239 -0
- package/dist/components/SelectMenu/select-menu.js.map +1 -0
- package/dist/components/SelectionControl/selection-item.d.ts +69 -0
- package/dist/components/SelectionControl/selection-item.d.ts.map +1 -0
- package/dist/components/SelectionControl/selection-item.js +142 -0
- package/dist/components/SelectionControl/selection-item.js.map +1 -0
- package/dist/components/Separator/separator.d.ts +17 -0
- package/dist/components/Separator/separator.d.ts.map +1 -0
- package/dist/components/Separator/separator.js +39 -0
- package/dist/components/Separator/separator.js.map +1 -0
- package/dist/components/Sheet/sheet.d.ts +56 -0
- package/dist/components/Sheet/sheet.d.ts.map +1 -0
- package/dist/components/Sheet/sheet.js +145 -0
- package/dist/components/Sheet/sheet.js.map +1 -0
- package/dist/components/Sidebar/sidebar.d.ts +195 -0
- package/dist/components/Sidebar/sidebar.d.ts.map +1 -0
- package/dist/components/Sidebar/sidebar.js +826 -0
- package/dist/components/Sidebar/sidebar.js.map +1 -0
- package/dist/components/Skeleton/skeleton.d.ts +16 -0
- package/dist/components/Skeleton/skeleton.d.ts.map +1 -0
- package/dist/components/Skeleton/skeleton.js +30 -0
- package/dist/components/Skeleton/skeleton.js.map +1 -0
- package/dist/components/Slider/slider.d.ts +48 -0
- package/dist/components/Slider/slider.d.ts.map +1 -0
- package/dist/components/Slider/slider.js +108 -0
- package/dist/components/Slider/slider.js.map +1 -0
- package/dist/components/Steps/steps.d.ts +71 -0
- package/dist/components/Steps/steps.d.ts.map +1 -0
- package/dist/components/Steps/steps.js +583 -0
- package/dist/components/Steps/steps.js.map +1 -0
- package/dist/components/Switch/switch.d.ts +112 -0
- package/dist/components/Switch/switch.d.ts.map +1 -0
- package/dist/components/Switch/switch.js +179 -0
- package/dist/components/Switch/switch.js.map +1 -0
- package/dist/components/Tabs/tabs.d.ts +104 -0
- package/dist/components/Tabs/tabs.d.ts.map +1 -0
- package/dist/components/Tabs/tabs.js +316 -0
- package/dist/components/Tabs/tabs.js.map +1 -0
- package/dist/components/Tag/tag.d.ts +86 -0
- package/dist/components/Tag/tag.d.ts.map +1 -0
- package/dist/components/Tag/tag.js +172 -0
- package/dist/components/Tag/tag.js.map +1 -0
- package/dist/components/Textarea/textarea.d.ts +74 -0
- package/dist/components/Textarea/textarea.d.ts.map +1 -0
- package/dist/components/Textarea/textarea.js +224 -0
- package/dist/components/Textarea/textarea.js.map +1 -0
- package/dist/components/TimePicker/time-columns.d.ts +46 -0
- package/dist/components/TimePicker/time-columns.d.ts.map +1 -0
- package/dist/components/TimePicker/time-columns.js +173 -0
- package/dist/components/TimePicker/time-columns.js.map +1 -0
- package/dist/components/TimePicker/time-picker.d.ts +94 -0
- package/dist/components/TimePicker/time-picker.d.ts.map +1 -0
- package/dist/components/TimePicker/time-picker.js +253 -0
- package/dist/components/TimePicker/time-picker.js.map +1 -0
- package/dist/components/Toast/toast.d.ts +61 -0
- package/dist/components/Toast/toast.d.ts.map +1 -0
- package/dist/components/Toast/toast.js +76 -0
- package/dist/components/Toast/toast.js.map +1 -0
- package/dist/components/Tooltip/tooltip.d.ts +20 -0
- package/dist/components/Tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip/tooltip.js +53 -0
- package/dist/components/Tooltip/tooltip.js.map +1 -0
- package/dist/components/TreeView/tree-view.d.ts +166 -0
- package/dist/components/TreeView/tree-view.d.ts.map +1 -0
- package/dist/components/TreeView/tree-view.js +617 -0
- package/dist/components/TreeView/tree-view.js.map +1 -0
- package/dist/hooks/use-controllable.d.ts +16 -0
- package/dist/hooks/use-controllable.d.ts.map +1 -0
- package/dist/hooks/use-controllable.js +26 -0
- package/dist/hooks/use-controllable.js.map +1 -0
- package/dist/hooks/use-is-narrow-viewport.d.ts +2 -0
- package/dist/hooks/use-is-narrow-viewport.d.ts.map +1 -0
- package/dist/hooks/use-is-narrow-viewport.js +19 -0
- package/dist/hooks/use-is-narrow-viewport.js.map +1 -0
- package/dist/hooks/use-is-touch-device.d.ts +8 -0
- package/dist/hooks/use-is-touch-device.d.ts.map +1 -0
- package/dist/hooks/use-is-touch-device.js +16 -0
- package/dist/hooks/use-is-touch-device.js.map +1 -0
- package/dist/hooks/use-overflow-items.d.ts +124 -0
- package/dist/hooks/use-overflow-items.d.ts.map +1 -0
- package/dist/hooks/use-overflow-items.js +97 -0
- package/dist/hooks/use-overflow-items.js.map +1 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +371 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/drag-visual.d.ts +158 -0
- package/dist/lib/drag-visual.d.ts.map +1 -0
- package/dist/lib/drag-visual.js +96 -0
- package/dist/lib/drag-visual.js.map +1 -0
- package/dist/lib/i18n/i18n-context.d.ts +105 -0
- package/dist/lib/i18n/i18n-context.d.ts.map +1 -0
- package/dist/lib/multi-select-ordering.d.ts +54 -0
- package/dist/lib/multi-select-ordering.d.ts.map +1 -0
- package/dist/lib/multi-select-ordering.js +13 -0
- package/dist/lib/multi-select-ordering.js.map +1 -0
- package/dist/lib/utils.d.ts +12 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +79 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/patterns/element-anatomy/item-anatomy.d.ts +370 -0
- package/dist/patterns/element-anatomy/item-anatomy.d.ts.map +1 -0
- package/dist/patterns/element-anatomy/item-anatomy.js +272 -0
- package/dist/patterns/element-anatomy/item-anatomy.js.map +1 -0
- package/dist/patterns/header-canonical/chrome-header.d.ts +80 -0
- package/dist/patterns/header-canonical/chrome-header.d.ts.map +1 -0
- package/dist/patterns/header-canonical/chrome-header.js +75 -0
- package/dist/patterns/header-canonical/chrome-header.js.map +1 -0
- package/dist/patterns/horizontal-overflow/horizontal-overflow.d.ts +101 -0
- package/dist/patterns/horizontal-overflow/horizontal-overflow.d.ts.map +1 -0
- package/dist/patterns/horizontal-overflow/horizontal-overflow.js +105 -0
- package/dist/patterns/horizontal-overflow/horizontal-overflow.js.map +1 -0
- package/dist/patterns/overlay-surface/overlay-surface.d.ts +28 -0
- package/dist/patterns/overlay-surface/overlay-surface.d.ts.map +1 -0
- package/dist/patterns/overlay-surface/overlay-surface.js +85 -0
- package/dist/patterns/overlay-surface/overlay-surface.js.map +1 -0
- package/dist/patterns/resize-handle/resize-handle.d.ts +102 -0
- package/dist/patterns/resize-handle/resize-handle.d.ts.map +1 -0
- package/dist/patterns/resize-handle/resize-handle.js +74 -0
- package/dist/patterns/resize-handle/resize-handle.js.map +1 -0
- package/dist/react-day-picker.css +457 -0
- package/dist/stories-helpers/anatomy/anatomy-utils.d.ts +40 -0
- package/dist/stories-helpers/anatomy/anatomy-utils.d.ts.map +1 -0
- package/dist/tokens/elevation/overlay-geometry.d.ts +12 -0
- package/dist/tokens/elevation/overlay-geometry.d.ts.map +1 -0
- package/dist/tokens/elevation/overlay-geometry.js +7 -0
- package/dist/tokens/elevation/overlay-geometry.js.map +1 -0
- package/dist/tokens/motion/motion.d.ts +15 -0
- package/dist/tokens/motion/motion.d.ts.map +1 -0
- package/dist/tokens/motion/motion.js +9 -0
- package/dist/tokens/motion/motion.js.map +1 -0
- package/dist/tokens/uiSize/icon-size.d.ts +53 -0
- package/dist/tokens/uiSize/icon-size.d.ts.map +1 -0
- package/package.json +92 -0
- package/src/README.md +32 -0
- package/src/components/Accordion/accordion.tsx +104 -0
- package/src/components/Alert/alert.tsx +188 -0
- package/src/components/AppShell/_demo-helpers.tsx +198 -0
- package/src/components/AppShell/app-shell.tsx +364 -0
- package/src/components/AspectRatio/aspect-ratio.tsx +58 -0
- package/src/components/Avatar/avatar.tsx +368 -0
- package/src/components/Badge/badge.tsx +104 -0
- package/src/components/Breadcrumb/breadcrumb.tsx +619 -0
- package/src/components/BulkActionBar/bulk-action-bar.tsx +156 -0
- package/src/components/Button/button-group.tsx +96 -0
- package/src/components/Button/button.tsx +539 -0
- package/src/components/Calendar/calendar.tsx +411 -0
- package/src/components/Carousel/carousel.tsx +371 -0
- package/src/components/Chart/chart.tsx +376 -0
- package/src/components/Checkbox/checkbox-group.tsx +94 -0
- package/src/components/Checkbox/checkbox.tsx +237 -0
- package/src/components/Chip/chip.tsx +359 -0
- package/src/components/CircularProgress/circular-progress.tsx +204 -0
- package/src/components/Coachmark/coachmark.tsx +255 -0
- package/src/components/Combobox/combobox.tsx +826 -0
- package/src/components/Command/command.tsx +187 -0
- package/src/components/DataTable/active-editor-controller.ts +72 -0
- package/src/components/DataTable/cell-registry.tsx +520 -0
- package/src/components/DataTable/column-types.ts +180 -0
- package/src/components/DataTable/data-table-column-visibility-panel.tsx +261 -0
- package/src/components/DataTable/data-table-filter-panel.tsx +813 -0
- package/src/components/DataTable/data-table-interaction-layer.tsx +483 -0
- package/src/components/DataTable/data-table-sort-manager.tsx +210 -0
- package/src/components/DataTable/data-table.css +165 -0
- package/src/components/DataTable/data-table.tsx +2924 -0
- package/src/components/DataTable/filter-operators.ts +225 -0
- package/src/components/DataTable/filter-tree.ts +313 -0
- package/src/components/DataTable/lib/column-meta.ts +79 -0
- package/src/components/DateGrid/date-grid.tsx +209 -0
- package/src/components/DatePicker/date-picker.tsx +1114 -0
- package/src/components/DescriptionList/description-list.tsx +141 -0
- package/src/components/Dialog/dialog.tsx +267 -0
- package/src/components/DropdownMenu/dropdown-menu.tsx +475 -0
- package/src/components/Empty/empty.tsx +108 -0
- package/src/components/Field/field-context.ts +136 -0
- package/src/components/Field/field-types.ts +52 -0
- package/src/components/Field/field-wrapper.tsx +348 -0
- package/src/components/Field/field.tsx +535 -0
- package/src/components/FieldControlGroup/field-control-group.tsx +136 -0
- package/src/components/FileItem/file-item.tsx +322 -0
- package/src/components/FileUpload/file-upload.tsx +326 -0
- package/src/components/FileViewer/file-viewer-types.ts +76 -0
- package/src/components/FileViewer/file-viewer.tsx +1065 -0
- package/src/components/FileViewer/image-renderer.tsx +256 -0
- package/src/components/HoverCard/hover-card.tsx +79 -0
- package/src/components/Input/input.tsx +233 -0
- package/src/components/LinkInput/link-input.tsx +304 -0
- package/src/components/Menu/menu-item.tsx +334 -0
- package/src/components/NameCard/name-card.tsx +319 -0
- package/src/components/Notice/notice.tsx +196 -0
- package/src/components/NumberInput/number-input.tsx +203 -0
- package/src/components/OverflowIndicator/overflow-indicator.tsx +156 -0
- package/src/components/PeoplePicker/avatar-stack-overflow.ts +100 -0
- package/src/components/PeoplePicker/people-picker-helpers.ts +76 -0
- package/src/components/PeoplePicker/people-picker.tsx +455 -0
- package/src/components/PeoplePicker/person-display.tsx +358 -0
- package/src/components/Popover/popover.tsx +183 -0
- package/src/components/ProgressBar/progress-bar.tsx +157 -0
- package/src/components/README.md +58 -0
- package/src/components/RadioGroup/radio-group.tsx +261 -0
- package/src/components/Rating/rating.tsx +295 -0
- package/src/components/ScrollArea/scroll-area.tsx +110 -0
- package/src/components/SegmentedControl/segmented-control.tsx +304 -0
- package/src/components/Select/select.tsx +658 -0
- package/src/components/SelectMenu/select-menu.tsx +430 -0
- package/src/components/SelectionControl/selection-item.tsx +261 -0
- package/src/components/Separator/separator.tsx +48 -0
- package/src/components/Sheet/sheet.tsx +240 -0
- package/src/components/Sidebar/sidebar.tsx +1280 -0
- package/src/components/Skeleton/skeleton.tsx +35 -0
- package/src/components/Slider/slider.tsx +158 -0
- package/src/components/Steps/steps.tsx +850 -0
- package/src/components/Switch/switch.tsx +285 -0
- package/src/components/Tabs/tabs.tsx +515 -0
- package/src/components/Tag/tag.tsx +246 -0
- package/src/components/Textarea/textarea.tsx +280 -0
- package/src/components/TimePicker/time-columns.tsx +260 -0
- package/src/components/TimePicker/time-picker.tsx +419 -0
- package/src/components/Toast/toast.tsx +129 -0
- package/src/components/Tooltip/tooltip.tsx +68 -0
- package/src/components/TreeView/tree-view.tsx +1031 -0
- package/src/hooks/use-controllable.ts +40 -0
- package/src/hooks/use-is-narrow-viewport.ts +19 -0
- package/src/hooks/use-is-touch-device.ts +21 -0
- package/src/hooks/use-overflow-items.ts +256 -0
- package/src/index.ts +85 -0
- package/src/lib/README.md +82 -0
- package/src/lib/drag-visual.ts +272 -0
- package/src/lib/i18n/README.md +60 -0
- package/src/lib/i18n/i18n-context.tsx +129 -0
- package/src/lib/multi-select-ordering.ts +61 -0
- package/src/lib/utils.ts +93 -0
- package/src/patterns/README.md +67 -0
- package/src/patterns/element-anatomy/item-anatomy.tsx +744 -0
- package/src/patterns/header-canonical/chrome-header.tsx +175 -0
- package/src/patterns/header-canonical/header-canonical.css +27 -0
- package/src/patterns/horizontal-overflow/horizontal-overflow.tsx +217 -0
- package/src/patterns/overlay-surface/overlay-surface.tsx +191 -0
- package/src/patterns/resize-handle/resize-handle.tsx +188 -0
- package/src/stories-helpers/anatomy/anatomy-utils.tsx +64 -0
- package/src/styles/preset.css +31 -0
- package/src/styles/tokens.css +35 -0
- package/src/tokens/README.md +53 -0
- package/src/tokens/color/primitives.css +429 -0
- package/src/tokens/color/semantic.css +539 -0
- package/src/tokens/elevation/overlay-geometry.ts +13 -0
- package/src/tokens/layoutSpace/layoutSpace.css +36 -0
- package/src/tokens/motion/motion.css +30 -0
- package/src/tokens/motion/motion.ts +17 -0
- package/src/tokens/opacity/opacity.css +23 -0
- package/src/tokens/radius/radius.css +19 -0
- package/src/tokens/typography/typography.css +118 -0
- package/src/tokens/uiSize/icon-size.ts +52 -0
- package/src/tokens/uiSize/uiSize.css +125 -0
|
@@ -0,0 +1,743 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ArrowRight, Calendar, X } from "lucide-react";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { EMPTY_DISPLAY, fieldWrapperStyles, fieldDisplayTextClass, bareInputStyles, nakedCellRowModeAlign } from "../Field/field-wrapper.js";
|
|
6
|
+
import { ICON_SIZE, ItemSuffix, ItemInlineAction } from "../../patterns/element-anatomy/item-anatomy.js";
|
|
7
|
+
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../Popover/popover.js";
|
|
8
|
+
import { DateGrid } from "../DateGrid/date-grid.js";
|
|
9
|
+
import { Button } from "../Button/button.js";
|
|
10
|
+
import { SurfaceFooter } from "../../patterns/overlay-surface/overlay-surface.js";
|
|
11
|
+
import { useFieldContext } from "../Field/field-context.js";
|
|
12
|
+
import { isoToTimeParts, timePartsToString, TimeColumns } from "../TimePicker/time-columns.js";
|
|
13
|
+
function formatDate(value, options = {}) {
|
|
14
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
15
|
+
if (Number.isNaN(date.getTime())) return String(value);
|
|
16
|
+
if (options.formatOptions || options.locale) {
|
|
17
|
+
return new Intl.DateTimeFormat(options.locale ?? "en-US", options.formatOptions ?? { year: "numeric", month: "2-digit", day: "2-digit" }).format(date);
|
|
18
|
+
}
|
|
19
|
+
const y = date.getFullYear();
|
|
20
|
+
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
21
|
+
const d = String(date.getDate()).padStart(2, "0");
|
|
22
|
+
return `${y}/${m}/${d}`;
|
|
23
|
+
}
|
|
24
|
+
function formatDateOrDateTime(iso, showTime, showSeconds, options = {}) {
|
|
25
|
+
if (!iso) return "";
|
|
26
|
+
const dateText = formatDate(iso, options);
|
|
27
|
+
if (!showTime) return dateText;
|
|
28
|
+
const time = isoToTimeParts(iso);
|
|
29
|
+
if (!time) return dateText;
|
|
30
|
+
return `${dateText} ${timePartsToString(time, showSeconds)}`;
|
|
31
|
+
}
|
|
32
|
+
function isoToDate(iso) {
|
|
33
|
+
if (!iso) return void 0;
|
|
34
|
+
const datePart = iso.slice(0, 10);
|
|
35
|
+
const [y, m, d] = datePart.split("-").map(Number);
|
|
36
|
+
if (!y || !m || !d) return void 0;
|
|
37
|
+
const date = new Date(y, m - 1, d);
|
|
38
|
+
const time = isoToTimeParts(iso);
|
|
39
|
+
if (time) {
|
|
40
|
+
date.setHours(time.hours, time.minutes, time.seconds);
|
|
41
|
+
}
|
|
42
|
+
return date;
|
|
43
|
+
}
|
|
44
|
+
function parseDateInput(input, opts) {
|
|
45
|
+
const trimmed = input.trim();
|
|
46
|
+
if (trimmed === "") return { iso: null, valid: true };
|
|
47
|
+
const isoDateMatch = trimmed.match(/^(\d{4})[-/.](\d{1,2})[-/.](\d{1,2})(?:[T\s](\d{1,2}):(\d{1,2})(?::(\d{1,2}))?)?$/);
|
|
48
|
+
if (isoDateMatch) {
|
|
49
|
+
const [, y, m, d, hh, mm, ss] = isoDateMatch;
|
|
50
|
+
const date = new Date(Number(y), Number(m) - 1, Number(d), Number(hh ?? 0), Number(mm ?? 0), Number(ss ?? 0));
|
|
51
|
+
if (isNaN(date.getTime()) || date.getMonth() !== Number(m) - 1) return { iso: null, valid: false };
|
|
52
|
+
const datePart = dateToIso(date);
|
|
53
|
+
if (hh != null && opts.allowTime) {
|
|
54
|
+
const h2 = String(Number(hh)).padStart(2, "0");
|
|
55
|
+
const m2 = String(Number(mm)).padStart(2, "0");
|
|
56
|
+
const s2 = String(Number(ss ?? 0)).padStart(2, "0");
|
|
57
|
+
return { iso: `${datePart}T${h2}:${m2}:${s2}`, valid: true };
|
|
58
|
+
}
|
|
59
|
+
return { iso: datePart, valid: true };
|
|
60
|
+
}
|
|
61
|
+
const parsed = new Date(trimmed);
|
|
62
|
+
if (!isNaN(parsed.getTime())) {
|
|
63
|
+
const datePart = dateToIso(parsed);
|
|
64
|
+
if (opts.allowTime && (trimmed.includes(":") || trimmed.includes("T"))) {
|
|
65
|
+
const h2 = String(parsed.getHours()).padStart(2, "0");
|
|
66
|
+
const m2 = String(parsed.getMinutes()).padStart(2, "0");
|
|
67
|
+
const s2 = String(parsed.getSeconds()).padStart(2, "0");
|
|
68
|
+
return { iso: `${datePart}T${h2}:${m2}:${s2}`, valid: true };
|
|
69
|
+
}
|
|
70
|
+
return { iso: datePart, valid: true };
|
|
71
|
+
}
|
|
72
|
+
return { iso: null, valid: false };
|
|
73
|
+
}
|
|
74
|
+
function dateToIso(date) {
|
|
75
|
+
if (!date) return "";
|
|
76
|
+
const y = date.getFullYear();
|
|
77
|
+
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
78
|
+
const d = String(date.getDate()).padStart(2, "0");
|
|
79
|
+
return `${y}-${m}-${d}`;
|
|
80
|
+
}
|
|
81
|
+
function combineDateAndTime(date, time) {
|
|
82
|
+
const datePart = dateToIso(date);
|
|
83
|
+
const hh = String(time.hours).padStart(2, "0");
|
|
84
|
+
const mi = String(time.minutes).padStart(2, "0");
|
|
85
|
+
const ss = String(time.seconds).padStart(2, "0");
|
|
86
|
+
return `${datePart}T${hh}:${mi}:${ss}`;
|
|
87
|
+
}
|
|
88
|
+
function nowIsoDateTime() {
|
|
89
|
+
const d = /* @__PURE__ */ new Date();
|
|
90
|
+
return combineDateAndTime(d, {
|
|
91
|
+
hours: d.getHours(),
|
|
92
|
+
minutes: d.getMinutes(),
|
|
93
|
+
seconds: d.getSeconds()
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function addDays(date, n) {
|
|
97
|
+
const next = new Date(date);
|
|
98
|
+
next.setDate(next.getDate() + n);
|
|
99
|
+
return next;
|
|
100
|
+
}
|
|
101
|
+
function TimePickerSidePanel({
|
|
102
|
+
value,
|
|
103
|
+
onChange,
|
|
104
|
+
showSeconds = false,
|
|
105
|
+
minuteStep = 1,
|
|
106
|
+
secondStep = 1,
|
|
107
|
+
className
|
|
108
|
+
}) {
|
|
109
|
+
const headerText = value ? timePartsToString(value, showSeconds) : showSeconds ? "--:--:--" : "--:--";
|
|
110
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col h-full pt-3", className), children: [
|
|
111
|
+
/* @__PURE__ */ jsx("div", { className: "h-field-xs flex items-center justify-center mb-3", children: /* @__PURE__ */ jsx("span", { className: "text-body font-medium tabular-nums", children: headerText }) }),
|
|
112
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 flex", children: /* @__PURE__ */ jsx(
|
|
113
|
+
TimeColumns,
|
|
114
|
+
{
|
|
115
|
+
value,
|
|
116
|
+
onChange,
|
|
117
|
+
showSeconds,
|
|
118
|
+
minuteStep,
|
|
119
|
+
secondStep
|
|
120
|
+
}
|
|
121
|
+
) })
|
|
122
|
+
] });
|
|
123
|
+
}
|
|
124
|
+
const TIME_PANEL_WIDTH = (showSeconds) => showSeconds ? "w-60" : "w-40";
|
|
125
|
+
function CalendarTimeContainer({ showTime, showSeconds, calendar, timePanel }) {
|
|
126
|
+
if (!showTime) return /* @__PURE__ */ jsx(Fragment, { children: calendar });
|
|
127
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
128
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-row", children: [
|
|
129
|
+
calendar,
|
|
130
|
+
/* @__PURE__ */ jsx("div", { className: cn("shrink-0 border-l border-divider", TIME_PANEL_WIDTH(showSeconds)) })
|
|
131
|
+
] }),
|
|
132
|
+
/* @__PURE__ */ jsx("div", { className: cn("absolute top-0 right-0 bottom-0", TIME_PANEL_WIDTH(showSeconds)), children: timePanel })
|
|
133
|
+
] });
|
|
134
|
+
}
|
|
135
|
+
const DatePicker = React.forwardRef(
|
|
136
|
+
({
|
|
137
|
+
mode = "edit",
|
|
138
|
+
variant: variantProp,
|
|
139
|
+
error: errorProp = false,
|
|
140
|
+
size = "md",
|
|
141
|
+
value,
|
|
142
|
+
onChange,
|
|
143
|
+
placeholder,
|
|
144
|
+
className,
|
|
145
|
+
disabled: disabledProp,
|
|
146
|
+
clearable = false,
|
|
147
|
+
formatOptions,
|
|
148
|
+
locale,
|
|
149
|
+
showTime = false,
|
|
150
|
+
showSeconds = false,
|
|
151
|
+
minuteStep = 1,
|
|
152
|
+
secondStep = 1,
|
|
153
|
+
needConfirm: needConfirmProp,
|
|
154
|
+
showDisplayEndIcon = false,
|
|
155
|
+
defaultOpen = false,
|
|
156
|
+
onOpenChange,
|
|
157
|
+
typeable = false,
|
|
158
|
+
id: idProp,
|
|
159
|
+
"aria-label": ariaLabelProp,
|
|
160
|
+
"aria-labelledby": ariaLabelledByProp,
|
|
161
|
+
"aria-describedby": ariaDescribedByProp,
|
|
162
|
+
"aria-errormessage": ariaErrorMessageProp,
|
|
163
|
+
...props
|
|
164
|
+
}, ref) => {
|
|
165
|
+
const fieldCtx = useFieldContext();
|
|
166
|
+
const error = errorProp || ((fieldCtx == null ? void 0 : fieldCtx.invalid) ?? false);
|
|
167
|
+
const disabled = disabledProp ?? (fieldCtx == null ? void 0 : fieldCtx.disabled);
|
|
168
|
+
const resolvedMode = disabled ? "disabled" : mode;
|
|
169
|
+
const variant = variantProp ?? (fieldCtx == null ? void 0 : fieldCtx.variant) ?? "default";
|
|
170
|
+
const isEditable = resolvedMode === "edit";
|
|
171
|
+
const iconSize = ICON_SIZE[size];
|
|
172
|
+
const needConfirm = needConfirmProp ?? showTime;
|
|
173
|
+
const [open, setOpenState] = React.useState(defaultOpen);
|
|
174
|
+
const setOpen = React.useCallback((next) => {
|
|
175
|
+
setOpenState(next);
|
|
176
|
+
onOpenChange == null ? void 0 : onOpenChange(next);
|
|
177
|
+
}, [onOpenChange]);
|
|
178
|
+
const [draft, setDraft] = React.useState(value ?? null);
|
|
179
|
+
const resolvedPlaceholder = placeholder ?? (showTime ? "YYYY/MM/DD HH:MM" : "YYYY/MM/DD");
|
|
180
|
+
const accessibleName = ariaLabelProp ?? (ariaLabelledByProp ? void 0 : (fieldCtx == null ? void 0 : fieldCtx.id) ? void 0 : resolvedPlaceholder);
|
|
181
|
+
const lastOpenRef = React.useRef(open);
|
|
182
|
+
React.useEffect(() => {
|
|
183
|
+
if (!lastOpenRef.current && open) setDraft(value ?? null);
|
|
184
|
+
lastOpenRef.current = open;
|
|
185
|
+
}, [open, value]);
|
|
186
|
+
const displayValue = needConfirm ? draft : value ?? null;
|
|
187
|
+
const displayDate = React.useMemo(() => isoToDate(displayValue), [displayValue]);
|
|
188
|
+
const draftDate = React.useMemo(() => isoToDate(draft), [draft]);
|
|
189
|
+
const draftTime = isoToTimeParts(draft) ?? { hours: 0, minutes: 0, seconds: 0 };
|
|
190
|
+
const showClear = clearable && (needConfirm ? draft : value) && isEditable;
|
|
191
|
+
const displayCommitted = formatDateOrDateTime(value, showTime, showSeconds, { formatOptions, locale });
|
|
192
|
+
const displayLive = formatDateOrDateTime(displayValue, showTime, showSeconds, { formatOptions, locale });
|
|
193
|
+
const [inputDraft, setInputDraft] = React.useState(displayLive);
|
|
194
|
+
const [inputInvalid, setInputInvalid] = React.useState(false);
|
|
195
|
+
const composingRef = React.useRef(false);
|
|
196
|
+
const lastDisplayLiveRef = React.useRef(displayLive);
|
|
197
|
+
React.useEffect(() => {
|
|
198
|
+
if (lastDisplayLiveRef.current !== displayLive) {
|
|
199
|
+
setInputDraft(displayLive);
|
|
200
|
+
setInputInvalid(false);
|
|
201
|
+
lastDisplayLiveRef.current = displayLive;
|
|
202
|
+
}
|
|
203
|
+
}, [displayLive]);
|
|
204
|
+
const handleInputCommit = React.useCallback((raw) => {
|
|
205
|
+
const { iso, valid } = parseDateInput(raw, { allowTime: showTime });
|
|
206
|
+
if (!valid) {
|
|
207
|
+
setInputInvalid(true);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
setInputInvalid(false);
|
|
211
|
+
if (iso === null) {
|
|
212
|
+
onChange == null ? void 0 : onChange("");
|
|
213
|
+
setDraft(null);
|
|
214
|
+
} else {
|
|
215
|
+
onChange == null ? void 0 : onChange(iso);
|
|
216
|
+
setDraft(iso);
|
|
217
|
+
}
|
|
218
|
+
}, [onChange, showTime]);
|
|
219
|
+
if (resolvedMode === "display") {
|
|
220
|
+
if (!showDisplayEndIcon) {
|
|
221
|
+
if (!value) return /* @__PURE__ */ jsx("span", { className: cn(fieldDisplayTextClass(size), "text-fg-muted", className), children: EMPTY_DISPLAY });
|
|
222
|
+
return /* @__PURE__ */ jsx("span", { className: cn(fieldDisplayTextClass(size), "truncate", className), children: displayCommitted });
|
|
223
|
+
}
|
|
224
|
+
return /* @__PURE__ */ jsxs(
|
|
225
|
+
"div",
|
|
226
|
+
{
|
|
227
|
+
className: cn(fieldWrapperStyles({ mode: "display", variant, size }), className),
|
|
228
|
+
"data-field-mode": "display",
|
|
229
|
+
children: [
|
|
230
|
+
/* @__PURE__ */ jsx("span", { className: cn(bareInputStyles, "flex-1 min-w-0 truncate", !value && "text-fg-muted"), children: value ? displayCommitted : EMPTY_DISPLAY }),
|
|
231
|
+
/* @__PURE__ */ jsx(ItemSuffix, { className: "pointer-events-none", children: /* @__PURE__ */ jsx(Calendar, { size: iconSize, className: "text-fg-muted", "aria-hidden": true }) })
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
if (!isEditable) {
|
|
237
|
+
return /* @__PURE__ */ jsxs(
|
|
238
|
+
"div",
|
|
239
|
+
{
|
|
240
|
+
className: cn(fieldWrapperStyles({ mode: resolvedMode, variant, size }), className),
|
|
241
|
+
"data-field-mode": resolvedMode,
|
|
242
|
+
...props,
|
|
243
|
+
children: [
|
|
244
|
+
/* @__PURE__ */ jsx("span", { className: cn("flex-1 min-w-0", resolvedMode === "disabled" && "text-fg-disabled"), children: value ? displayCommitted : /* @__PURE__ */ jsx("span", { className: "text-fg-muted", children: EMPTY_DISPLAY }) }),
|
|
245
|
+
/* @__PURE__ */ jsx(ItemSuffix, { className: "pointer-events-none", children: /* @__PURE__ */ jsx(Calendar, { size: iconSize, className: "text-fg-muted", "aria-hidden": true }) })
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
const triggerText = displayValue ? displayLive : /* @__PURE__ */ jsx("span", { className: "text-fg-muted", children: resolvedPlaceholder });
|
|
251
|
+
const commitDraft = (next) => {
|
|
252
|
+
if (needConfirm) setDraft(next);
|
|
253
|
+
else onChange == null ? void 0 : onChange(next ?? "");
|
|
254
|
+
};
|
|
255
|
+
const handleConfirm = () => {
|
|
256
|
+
onChange == null ? void 0 : onChange(draft ?? "");
|
|
257
|
+
setOpen(false);
|
|
258
|
+
};
|
|
259
|
+
const handleNow = () => {
|
|
260
|
+
const now = showTime ? nowIsoDateTime() : dateToIso(/* @__PURE__ */ new Date());
|
|
261
|
+
commitDraft(now);
|
|
262
|
+
};
|
|
263
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
264
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
265
|
+
"div",
|
|
266
|
+
{
|
|
267
|
+
ref,
|
|
268
|
+
id: idProp ?? (fieldCtx == null ? void 0 : fieldCtx.id),
|
|
269
|
+
role: "combobox",
|
|
270
|
+
tabIndex: disabled ? -1 : 0,
|
|
271
|
+
"aria-disabled": disabled || void 0,
|
|
272
|
+
"aria-label": accessibleName,
|
|
273
|
+
"aria-labelledby": ariaLabelledByProp ?? (fieldCtx == null ? void 0 : fieldCtx.labelId),
|
|
274
|
+
"aria-invalid": error || void 0,
|
|
275
|
+
"aria-required": (fieldCtx == null ? void 0 : fieldCtx.required) || void 0,
|
|
276
|
+
"aria-describedby": ariaDescribedByProp ?? (fieldCtx == null ? void 0 : fieldCtx.descriptionId),
|
|
277
|
+
"aria-errormessage": ariaErrorMessageProp ?? (error ? fieldCtx == null ? void 0 : fieldCtx.errorId : void 0),
|
|
278
|
+
"aria-haspopup": "dialog",
|
|
279
|
+
"aria-expanded": open,
|
|
280
|
+
"data-field-mode": "edit",
|
|
281
|
+
"data-error": error ? "" : void 0,
|
|
282
|
+
className: cn(
|
|
283
|
+
fieldWrapperStyles({ mode: "edit", variant, size }),
|
|
284
|
+
"text-left cursor-pointer",
|
|
285
|
+
"focus-visible:outline-none",
|
|
286
|
+
error && [
|
|
287
|
+
"border-error hover:border-error-hover",
|
|
288
|
+
"focus-within:border-error focus-within:hover:border-error"
|
|
289
|
+
],
|
|
290
|
+
className
|
|
291
|
+
),
|
|
292
|
+
...props,
|
|
293
|
+
children: [
|
|
294
|
+
typeable ? (
|
|
295
|
+
// Issue 10 typed input(2026-05-10):real `<input>` 接 user 鍵盤打字。
|
|
296
|
+
// Click 在 input 上不 propagate 給外層 popover trigger(避免每次打字都開 popover)。
|
|
297
|
+
// Calendar icon `<ItemSuffix>` 點才開 popover(Material/Ant typed-date idiom)。
|
|
298
|
+
/* @__PURE__ */ jsx(
|
|
299
|
+
"input",
|
|
300
|
+
{
|
|
301
|
+
type: "text",
|
|
302
|
+
className: cn(bareInputStyles, "truncate", !inputDraft && "placeholder:text-fg-muted"),
|
|
303
|
+
value: inputDraft,
|
|
304
|
+
placeholder: resolvedPlaceholder,
|
|
305
|
+
"aria-invalid": inputInvalid || error || void 0,
|
|
306
|
+
onChange: (e) => {
|
|
307
|
+
setInputDraft(e.target.value);
|
|
308
|
+
setInputInvalid(false);
|
|
309
|
+
},
|
|
310
|
+
onCompositionStart: () => {
|
|
311
|
+
composingRef.current = true;
|
|
312
|
+
},
|
|
313
|
+
onCompositionEnd: () => {
|
|
314
|
+
composingRef.current = false;
|
|
315
|
+
},
|
|
316
|
+
onKeyDown: (e) => {
|
|
317
|
+
if (composingRef.current) return;
|
|
318
|
+
if (e.key === "Enter") {
|
|
319
|
+
e.preventDefault();
|
|
320
|
+
handleInputCommit(inputDraft);
|
|
321
|
+
}
|
|
322
|
+
if (e.key === "Escape") {
|
|
323
|
+
setInputDraft(displayLive);
|
|
324
|
+
setInputInvalid(false);
|
|
325
|
+
e.preventDefault();
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
onBlur: () => {
|
|
329
|
+
if (!composingRef.current) handleInputCommit(inputDraft);
|
|
330
|
+
},
|
|
331
|
+
onClick: (e) => e.stopPropagation()
|
|
332
|
+
}
|
|
333
|
+
)
|
|
334
|
+
) : /* @__PURE__ */ jsx("span", { className: cn(bareInputStyles, "truncate", !displayValue && "text-fg-muted"), children: triggerText }),
|
|
335
|
+
showClear && /* @__PURE__ */ jsx(
|
|
336
|
+
ItemInlineAction,
|
|
337
|
+
{
|
|
338
|
+
size: size ?? "md",
|
|
339
|
+
action: {
|
|
340
|
+
icon: X,
|
|
341
|
+
label: "清除日期",
|
|
342
|
+
// i18n-allow: DS default inline-action label
|
|
343
|
+
// Clear = 立刻 commit + 同步 draft(對齊 user 體感 / Ant trigger X 慣例)
|
|
344
|
+
// 不走 needConfirm「等確定」語義 — X 在 trigger 上是 standard clear affordance,
|
|
345
|
+
// 應立刻清空。dual-state 必同步:value('') + draft(null),否則 popover 開
|
|
346
|
+
// 著時 displayValue=draft 仍顯示舊值(see line 318: displayValue = needConfirm ? draft : value)。
|
|
347
|
+
onClick: (e) => {
|
|
348
|
+
e == null ? void 0 : e.stopPropagation();
|
|
349
|
+
onChange == null ? void 0 : onChange("");
|
|
350
|
+
setDraft(null);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
),
|
|
355
|
+
/* @__PURE__ */ jsx(ItemSuffix, { className: "pointer-events-none", children: /* @__PURE__ */ jsx(Calendar, { size: iconSize, className: "text-fg-muted", "aria-hidden": true }) })
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
) }),
|
|
359
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsxs("div", { role: "dialog", className: "flex flex-col flex-1 min-h-0", children: [
|
|
360
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
361
|
+
CalendarTimeContainer,
|
|
362
|
+
{
|
|
363
|
+
showTime,
|
|
364
|
+
showSeconds,
|
|
365
|
+
calendar: /* @__PURE__ */ jsx(
|
|
366
|
+
DateGrid,
|
|
367
|
+
{
|
|
368
|
+
mode: "single",
|
|
369
|
+
selected: displayDate,
|
|
370
|
+
onSelect: (date) => {
|
|
371
|
+
if (!date) return;
|
|
372
|
+
if (showTime) {
|
|
373
|
+
commitDraft(combineDateAndTime(date, draftTime));
|
|
374
|
+
} else {
|
|
375
|
+
commitDraft(dateToIso(date));
|
|
376
|
+
if (!needConfirm) setOpen(false);
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
defaultMonth: displayDate ?? void 0,
|
|
380
|
+
autoFocus: true
|
|
381
|
+
}
|
|
382
|
+
),
|
|
383
|
+
timePanel: /* @__PURE__ */ jsx(
|
|
384
|
+
TimePickerSidePanel,
|
|
385
|
+
{
|
|
386
|
+
value: draftTime,
|
|
387
|
+
onChange: (time) => {
|
|
388
|
+
const target = draftDate ?? /* @__PURE__ */ new Date();
|
|
389
|
+
commitDraft(combineDateAndTime(target, time));
|
|
390
|
+
},
|
|
391
|
+
showSeconds,
|
|
392
|
+
minuteStep,
|
|
393
|
+
secondStep
|
|
394
|
+
}
|
|
395
|
+
)
|
|
396
|
+
}
|
|
397
|
+
) }),
|
|
398
|
+
showTime && // Footer:消費 SurfaceFooter SSOT(border-t + canonical px-loose py-tight padding,
|
|
399
|
+
// 不再 hand-coded p-2 / Separator / ml-auto wrapper 三層垃圾)。
|
|
400
|
+
// 「此刻」加 mr-auto 把後面 button 推右(對齊 Ant `marginInlineStart: auto` on OK)。
|
|
401
|
+
/* @__PURE__ */ jsxs(SurfaceFooter, { children: [
|
|
402
|
+
/* @__PURE__ */ jsx(Button, { variant: "tertiary", size: "sm", onClick: handleNow, className: "mr-auto", children: "此刻" }),
|
|
403
|
+
needConfirm ? /* @__PURE__ */ jsx(Button, { variant: "primary", size: "sm", onClick: handleConfirm, disabled: !draft, children: "確定" }) : /* @__PURE__ */ jsx(Button, { variant: "tertiary", size: "sm", onClick: () => setOpen(false), children: "關閉" })
|
|
404
|
+
] })
|
|
405
|
+
] }) })
|
|
406
|
+
] });
|
|
407
|
+
}
|
|
408
|
+
);
|
|
409
|
+
DatePicker.displayName = "DatePicker";
|
|
410
|
+
const DatePickerRange = React.forwardRef(
|
|
411
|
+
({
|
|
412
|
+
mode = "edit",
|
|
413
|
+
variant: variantProp,
|
|
414
|
+
error: errorProp = false,
|
|
415
|
+
size = "md",
|
|
416
|
+
value,
|
|
417
|
+
onChange,
|
|
418
|
+
placeholder,
|
|
419
|
+
className,
|
|
420
|
+
disabled: disabledProp,
|
|
421
|
+
clearable = false,
|
|
422
|
+
formatOptions,
|
|
423
|
+
locale,
|
|
424
|
+
showTime = false,
|
|
425
|
+
showSeconds = false,
|
|
426
|
+
minuteStep = 1,
|
|
427
|
+
secondStep = 1,
|
|
428
|
+
needConfirm: needConfirmProp,
|
|
429
|
+
id: idProp,
|
|
430
|
+
"aria-describedby": ariaDescribedByProp,
|
|
431
|
+
"aria-errormessage": ariaErrorMessageProp,
|
|
432
|
+
...props
|
|
433
|
+
}, ref) => {
|
|
434
|
+
const fieldCtx = useFieldContext();
|
|
435
|
+
const error = errorProp || ((fieldCtx == null ? void 0 : fieldCtx.invalid) ?? false);
|
|
436
|
+
const disabled = disabledProp ?? (fieldCtx == null ? void 0 : fieldCtx.disabled);
|
|
437
|
+
const resolvedMode = disabled ? "disabled" : mode;
|
|
438
|
+
const variant = variantProp ?? (fieldCtx == null ? void 0 : fieldCtx.variant) ?? "default";
|
|
439
|
+
const isEditable = resolvedMode === "edit";
|
|
440
|
+
const iconSize = ICON_SIZE[size];
|
|
441
|
+
const needConfirm = needConfirmProp ?? showTime;
|
|
442
|
+
const resolvedPlaceholder = placeholder ?? (showTime ? ["Start date time", "End date time"] : ["Start date", "End date"]);
|
|
443
|
+
const [open, setOpen] = React.useState(false);
|
|
444
|
+
const [draft, setDraft] = React.useState(value ?? [null, null]);
|
|
445
|
+
const [activeEnd, setActiveEnd] = React.useState("start");
|
|
446
|
+
const lastOpenRef = React.useRef(open);
|
|
447
|
+
React.useEffect(() => {
|
|
448
|
+
if (!lastOpenRef.current && open) setDraft(value ?? [null, null]);
|
|
449
|
+
lastOpenRef.current = open;
|
|
450
|
+
}, [open, value]);
|
|
451
|
+
const startIso = (needConfirm ? draft[0] : value == null ? void 0 : value[0]) ?? null;
|
|
452
|
+
const endIso = (needConfirm ? draft[1] : value == null ? void 0 : value[1]) ?? null;
|
|
453
|
+
const startDate = React.useMemo(() => isoToDate(startIso), [startIso]);
|
|
454
|
+
const endDate = React.useMemo(() => isoToDate(endIso), [endIso]);
|
|
455
|
+
const hasValue = !!((value == null ? void 0 : value[0]) || (value == null ? void 0 : value[1]));
|
|
456
|
+
const showClear = clearable && hasValue && isEditable;
|
|
457
|
+
const startText = startIso ? formatDateOrDateTime(startIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[0];
|
|
458
|
+
const endText = endIso ? formatDateOrDateTime(endIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[1];
|
|
459
|
+
const activeIso = activeEnd === "start" ? startIso : endIso;
|
|
460
|
+
const activeDate = activeEnd === "start" ? startDate : endDate;
|
|
461
|
+
const activeTime = isoToTimeParts(activeIso) ?? { hours: 0, minutes: 0, seconds: 0 };
|
|
462
|
+
const rangeModifiers = React.useMemo(() => {
|
|
463
|
+
const mods = {};
|
|
464
|
+
if (startDate) mods.rangeStart = startDate;
|
|
465
|
+
if (endDate) mods.rangeEnd = endDate;
|
|
466
|
+
if (startDate && endDate) {
|
|
467
|
+
const middleStart = addDays(startDate, 1);
|
|
468
|
+
const middleEnd = addDays(endDate, -1);
|
|
469
|
+
if (middleEnd >= middleStart) {
|
|
470
|
+
mods.rangeMiddle = { from: middleStart, to: middleEnd };
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
return mods;
|
|
474
|
+
}, [startDate, endDate]);
|
|
475
|
+
const commitRange = (next) => {
|
|
476
|
+
if (needConfirm) setDraft(next);
|
|
477
|
+
else {
|
|
478
|
+
onChange == null ? void 0 : onChange(next);
|
|
479
|
+
setDraft(next);
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
const setActive = (iso) => {
|
|
483
|
+
const nextDraft = activeEnd === "start" ? [iso, draft[1]] : [draft[0], iso];
|
|
484
|
+
commitRange(nextDraft);
|
|
485
|
+
};
|
|
486
|
+
const handleConfirm = () => {
|
|
487
|
+
if (showTime && activeEnd === "start" && draft[0]) {
|
|
488
|
+
setActiveEnd("end");
|
|
489
|
+
} else {
|
|
490
|
+
onChange == null ? void 0 : onChange(draft);
|
|
491
|
+
setOpen(false);
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
const handleNow = () => {
|
|
495
|
+
setActive(showTime ? nowIsoDateTime() : dateToIso(/* @__PURE__ */ new Date()));
|
|
496
|
+
};
|
|
497
|
+
const handleClearRange = (e) => {
|
|
498
|
+
e == null ? void 0 : e.stopPropagation();
|
|
499
|
+
onChange == null ? void 0 : onChange([null, null]);
|
|
500
|
+
setDraft([null, null]);
|
|
501
|
+
};
|
|
502
|
+
const openWithActive = (which) => {
|
|
503
|
+
setActiveEnd(which);
|
|
504
|
+
setOpen(true);
|
|
505
|
+
};
|
|
506
|
+
const isOutOfRangeOrder = React.useCallback((date) => {
|
|
507
|
+
if (activeEnd === "end" && startDate) {
|
|
508
|
+
const startMidnight = new Date(startDate.getTime());
|
|
509
|
+
startMidnight.setHours(0, 0, 0, 0);
|
|
510
|
+
return date.getTime() < startMidnight.getTime();
|
|
511
|
+
}
|
|
512
|
+
if (activeEnd === "start" && endDate) {
|
|
513
|
+
const endEndOfDay = new Date(endDate.getTime());
|
|
514
|
+
endEndOfDay.setHours(23, 59, 59, 999);
|
|
515
|
+
return date.getTime() > endEndOfDay.getTime();
|
|
516
|
+
}
|
|
517
|
+
return false;
|
|
518
|
+
}, [activeEnd, startDate, endDate]);
|
|
519
|
+
if (resolvedMode === "display") {
|
|
520
|
+
const hasAny = !!(startIso || endIso);
|
|
521
|
+
if (!hasAny) return /* @__PURE__ */ jsx("span", { className: cn("text-fg-muted", className), children: EMPTY_DISPLAY });
|
|
522
|
+
return /* @__PURE__ */ jsxs("span", { className: cn("inline-flex items-center min-w-0", nakedCellRowModeAlign, className), children: [
|
|
523
|
+
/* @__PURE__ */ jsx("span", { className: cn("truncate", !startIso && "text-fg-muted"), children: startIso ? formatDateOrDateTime(startIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[0] }),
|
|
524
|
+
/* @__PURE__ */ jsx(ArrowRight, { size: iconSize, className: "shrink-0 text-fg-muted mx-2", "aria-hidden": true }),
|
|
525
|
+
/* @__PURE__ */ jsx("span", { className: cn("truncate", !endIso && "text-fg-muted"), children: endIso ? formatDateOrDateTime(endIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[1] })
|
|
526
|
+
] });
|
|
527
|
+
}
|
|
528
|
+
if (!isEditable) {
|
|
529
|
+
return /* @__PURE__ */ jsxs(
|
|
530
|
+
"div",
|
|
531
|
+
{
|
|
532
|
+
ref,
|
|
533
|
+
className: cn(fieldWrapperStyles({ mode: resolvedMode, variant, size }), className),
|
|
534
|
+
"data-field-mode": resolvedMode,
|
|
535
|
+
...props,
|
|
536
|
+
children: [
|
|
537
|
+
/* @__PURE__ */ jsx("span", { className: cn("flex-1 min-w-0 truncate", !startIso && "text-fg-muted", resolvedMode === "disabled" && "text-fg-disabled"), children: startIso ? formatDateOrDateTime(startIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[0] }),
|
|
538
|
+
/* @__PURE__ */ jsx(ArrowRight, { size: iconSize, className: "shrink-0 text-fg-muted mx-2", "aria-hidden": true }),
|
|
539
|
+
/* @__PURE__ */ jsx("span", { className: cn("flex-1 min-w-0 truncate", !endIso && "text-fg-muted", resolvedMode === "disabled" && "text-fg-disabled"), children: endIso ? formatDateOrDateTime(endIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[1] }),
|
|
540
|
+
/* @__PURE__ */ jsx(ItemSuffix, { className: "pointer-events-none", children: /* @__PURE__ */ jsx(Calendar, { size: iconSize, className: "text-fg-muted", "aria-hidden": true }) })
|
|
541
|
+
]
|
|
542
|
+
}
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
546
|
+
/* @__PURE__ */ jsx(PopoverAnchor, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
547
|
+
"div",
|
|
548
|
+
{
|
|
549
|
+
ref,
|
|
550
|
+
id: idProp ?? (fieldCtx == null ? void 0 : fieldCtx.id),
|
|
551
|
+
"aria-invalid": error || void 0,
|
|
552
|
+
"aria-required": (fieldCtx == null ? void 0 : fieldCtx.required) || void 0,
|
|
553
|
+
"aria-describedby": ariaDescribedByProp ?? (fieldCtx == null ? void 0 : fieldCtx.descriptionId),
|
|
554
|
+
"aria-errormessage": ariaErrorMessageProp ?? (error ? fieldCtx == null ? void 0 : fieldCtx.errorId : void 0),
|
|
555
|
+
"data-field-mode": "edit",
|
|
556
|
+
"data-error": error ? "" : void 0,
|
|
557
|
+
"data-state": open ? "open" : "closed",
|
|
558
|
+
className: cn(
|
|
559
|
+
fieldWrapperStyles({ mode: "edit", size }),
|
|
560
|
+
"cursor-text",
|
|
561
|
+
error && [
|
|
562
|
+
"border-error hover:border-error-hover",
|
|
563
|
+
"focus-within:border-error focus-within:hover:border-error"
|
|
564
|
+
],
|
|
565
|
+
className
|
|
566
|
+
),
|
|
567
|
+
...props,
|
|
568
|
+
children: [
|
|
569
|
+
/* @__PURE__ */ jsx(
|
|
570
|
+
"button",
|
|
571
|
+
{
|
|
572
|
+
type: "button",
|
|
573
|
+
onClick: () => openWithActive("start"),
|
|
574
|
+
"data-active-end": open && activeEnd === "start" ? "true" : void 0,
|
|
575
|
+
"aria-label": resolvedPlaceholder[0],
|
|
576
|
+
"aria-haspopup": "dialog",
|
|
577
|
+
"aria-expanded": open && activeEnd === "start",
|
|
578
|
+
className: cn(
|
|
579
|
+
bareInputStyles,
|
|
580
|
+
"truncate text-left cursor-pointer focus-visible:outline-none",
|
|
581
|
+
"data-[active-end=true]:underline decoration-primary underline-offset-4 decoration-2",
|
|
582
|
+
!startIso && "text-fg-muted"
|
|
583
|
+
),
|
|
584
|
+
children: startText
|
|
585
|
+
}
|
|
586
|
+
),
|
|
587
|
+
/* @__PURE__ */ jsx(ArrowRight, { size: iconSize, className: "shrink-0 text-fg-muted mx-2", "aria-hidden": true }),
|
|
588
|
+
/* @__PURE__ */ jsx(
|
|
589
|
+
"button",
|
|
590
|
+
{
|
|
591
|
+
type: "button",
|
|
592
|
+
onClick: () => openWithActive("end"),
|
|
593
|
+
"data-active-end": open && activeEnd === "end" ? "true" : void 0,
|
|
594
|
+
"aria-label": resolvedPlaceholder[1],
|
|
595
|
+
"aria-haspopup": "dialog",
|
|
596
|
+
"aria-expanded": open && activeEnd === "end",
|
|
597
|
+
className: cn(
|
|
598
|
+
bareInputStyles,
|
|
599
|
+
"truncate text-left cursor-pointer focus-visible:outline-none",
|
|
600
|
+
"data-[active-end=true]:underline decoration-primary underline-offset-4 decoration-2",
|
|
601
|
+
!endIso && "text-fg-muted"
|
|
602
|
+
),
|
|
603
|
+
children: endText
|
|
604
|
+
}
|
|
605
|
+
),
|
|
606
|
+
showClear && /* @__PURE__ */ jsx(
|
|
607
|
+
ItemInlineAction,
|
|
608
|
+
{
|
|
609
|
+
size: size ?? "md",
|
|
610
|
+
action: {
|
|
611
|
+
icon: X,
|
|
612
|
+
label: "清除日期區間",
|
|
613
|
+
// i18n-allow: DS default inline-action label
|
|
614
|
+
onClick: handleClearRange
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
),
|
|
618
|
+
/* @__PURE__ */ jsx(ItemSuffix, { className: "pointer-events-none", children: /* @__PURE__ */ jsx(Calendar, { size: iconSize, className: "text-fg-muted", "aria-hidden": true }) })
|
|
619
|
+
]
|
|
620
|
+
}
|
|
621
|
+
) }),
|
|
622
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsxs("div", { role: "dialog", "aria-label": "日期區間選擇", className: "flex flex-col flex-1 min-h-0", children: [
|
|
623
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
624
|
+
CalendarTimeContainer,
|
|
625
|
+
{
|
|
626
|
+
showTime,
|
|
627
|
+
showSeconds,
|
|
628
|
+
calendar: /* @__PURE__ */ jsx(
|
|
629
|
+
DateGrid,
|
|
630
|
+
{
|
|
631
|
+
mode: "single",
|
|
632
|
+
selected: activeDate,
|
|
633
|
+
onSelect: (date) => {
|
|
634
|
+
if (!date) return;
|
|
635
|
+
if (isOutOfRangeOrder(date)) return;
|
|
636
|
+
const preservedTime = isoToTimeParts(activeEnd === "start" ? draft[0] : draft[1]) ?? activeTime;
|
|
637
|
+
const nextIso = showTime ? combineDateAndTime(date, preservedTime) : dateToIso(date);
|
|
638
|
+
const nextDraft = activeEnd === "start" ? [nextIso, draft[1]] : [draft[0], nextIso];
|
|
639
|
+
commitRange(nextDraft);
|
|
640
|
+
if (!showTime) {
|
|
641
|
+
if (activeEnd === "start") {
|
|
642
|
+
setActiveEnd("end");
|
|
643
|
+
if (!needConfirm && nextDraft[0] && nextDraft[1]) setOpen(false);
|
|
644
|
+
} else if (!needConfirm && nextDraft[0] && nextDraft[1]) {
|
|
645
|
+
setOpen(false);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
modifiers: showTime ? {} : rangeModifiers,
|
|
650
|
+
modifiersClassNames: {
|
|
651
|
+
// ── Range visual canonical(2026-05-03 v8 stadium pattern)──
|
|
652
|
+
// v5 修「白色破圖」用 pseudo 蓋全 cell 矩形,但新副作用:button 圓比矩形小,
|
|
653
|
+
// 4 corner triangle 區域 grey 凸出圓外(user 2026-05-03 抓到「凸出去」)。
|
|
654
|
+
// v8 對齊 Ant `cell-range-start::before { border-radius: 9999px 0 0 9999px }`:
|
|
655
|
+
// rangeStart pseudo 加 `rounded-l-full` → pseudo 變「左半圓 + 右矩形」stadium
|
|
656
|
+
// 左半圓 EXACTLY OVERLAY button 圓的左半弧(同 center 同 radius 14)→ 無縫
|
|
657
|
+
// 右側矩形 bridge 2px to middle → 跟 middle pseudo 連續
|
|
658
|
+
// Cell 的 top-left + bottom-left corner triangle:pseudo 不蓋 + button 不蓋 →
|
|
659
|
+
// popover white 顯露(乾淨 breathing)
|
|
660
|
+
rangeStart: cn(
|
|
661
|
+
"[&>button]:!bg-primary [&>button]:!text-on-emphasis [&>button]:hover:!ring-0",
|
|
662
|
+
"before:content-[''] before:absolute before:inset-y-0",
|
|
663
|
+
"before:left-0 before:-right-[2px]",
|
|
664
|
+
"before:bg-neutral-selected before:pointer-events-none",
|
|
665
|
+
"before:rounded-l-full"
|
|
666
|
+
// ← stadium 左半圓 matches button 圓的左半弧
|
|
667
|
+
),
|
|
668
|
+
rangeEnd: cn(
|
|
669
|
+
"[&>button]:!bg-primary [&>button]:!text-on-emphasis [&>button]:hover:!ring-0",
|
|
670
|
+
"before:content-[''] before:absolute before:inset-y-0",
|
|
671
|
+
"before:-left-[2px] before:right-0",
|
|
672
|
+
"before:bg-neutral-selected before:pointer-events-none",
|
|
673
|
+
"before:rounded-r-full"
|
|
674
|
+
// ← 鏡像
|
|
675
|
+
),
|
|
676
|
+
rangeMiddle: cn(
|
|
677
|
+
"before:content-[''] before:absolute before:inset-y-0 before:-inset-x-[2px]",
|
|
678
|
+
"before:bg-neutral-selected before:pointer-events-none",
|
|
679
|
+
"[&>button]:!bg-transparent [&>button]:!text-foreground"
|
|
680
|
+
)
|
|
681
|
+
},
|
|
682
|
+
disabled: isOutOfRangeOrder,
|
|
683
|
+
numberOfMonths: showTime ? 1 : 2,
|
|
684
|
+
defaultMonth: activeDate ?? startDate ?? endDate ?? void 0,
|
|
685
|
+
autoFocus: true
|
|
686
|
+
}
|
|
687
|
+
),
|
|
688
|
+
timePanel: /* @__PURE__ */ jsx(
|
|
689
|
+
TimePickerSidePanel,
|
|
690
|
+
{
|
|
691
|
+
value: activeTime,
|
|
692
|
+
onChange: (time) => {
|
|
693
|
+
const target = activeDate ?? /* @__PURE__ */ new Date();
|
|
694
|
+
setActive(combineDateAndTime(target, time));
|
|
695
|
+
},
|
|
696
|
+
showSeconds,
|
|
697
|
+
minuteStep,
|
|
698
|
+
secondStep
|
|
699
|
+
}
|
|
700
|
+
)
|
|
701
|
+
}
|
|
702
|
+
) }),
|
|
703
|
+
(showTime || needConfirm) && // Footer 消費 SurfaceFooter SSOT(border-t + canonical px-loose py-tight)。
|
|
704
|
+
// showTime Range 無「此刻」(對齊 Ant `showNow={multiple ? false : showNow}`)→ 只有 確定 走 justify-end。
|
|
705
|
+
// date-only Range needConfirm:左 此刻(mr-auto)+ 右 確定。
|
|
706
|
+
/* @__PURE__ */ jsxs(SurfaceFooter, { children: [
|
|
707
|
+
!showTime && /* @__PURE__ */ jsx(Button, { variant: "tertiary", size: "sm", onClick: handleNow, className: "mr-auto", children: "此刻" }),
|
|
708
|
+
needConfirm ? /* @__PURE__ */ jsx(
|
|
709
|
+
Button,
|
|
710
|
+
{
|
|
711
|
+
variant: "primary",
|
|
712
|
+
size: "sm",
|
|
713
|
+
onClick: handleConfirm,
|
|
714
|
+
disabled: showTime ? activeEnd === "start" ? !draft[0] : !draft[0] || !draft[1] : !draft[0] || !draft[1],
|
|
715
|
+
children: "確定"
|
|
716
|
+
}
|
|
717
|
+
) : /* @__PURE__ */ jsx(Button, { variant: "tertiary", size: "sm", onClick: () => setOpen(false), children: "關閉" })
|
|
718
|
+
] })
|
|
719
|
+
] }) })
|
|
720
|
+
] });
|
|
721
|
+
}
|
|
722
|
+
);
|
|
723
|
+
DatePickerRange.displayName = "DatePickerRange";
|
|
724
|
+
const DatePickerWithRange = Object.assign(DatePicker, { Range: DatePickerRange });
|
|
725
|
+
const datePickerMeta = {
|
|
726
|
+
component: "DatePicker",
|
|
727
|
+
family: 4,
|
|
728
|
+
variants: {},
|
|
729
|
+
sizes: {},
|
|
730
|
+
states: ["default", "hover", "active", "focus-visible", "disabled"],
|
|
731
|
+
tokens: {
|
|
732
|
+
bg: [],
|
|
733
|
+
fg: ["text-fg-disabled", "text-fg-muted"],
|
|
734
|
+
ring: []
|
|
735
|
+
}
|
|
736
|
+
};
|
|
737
|
+
export {
|
|
738
|
+
DatePickerWithRange as DatePicker,
|
|
739
|
+
DatePickerRange,
|
|
740
|
+
datePickerMeta,
|
|
741
|
+
formatDate
|
|
742
|
+
};
|
|
743
|
+
//# sourceMappingURL=date-picker.js.map
|