@qijenchen/design-system 0.1.0-beta.84 → 0.1.0-beta.86
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/AGENTS.md +210 -0
- package/CLAUDE.md +17 -191
- package/cli-init.mjs +30 -2
- package/dist/components/Accordion/accordion.d.ts +2 -2
- package/dist/components/Accordion/accordion.d.ts.map +1 -1
- package/dist/components/Accordion/accordion.js.map +1 -1
- package/dist/components/Avatar/avatar.js +1 -1
- package/dist/components/Avatar/avatar.js.map +1 -1
- package/dist/components/BulkActionBar/bulk-action-bar.d.ts +1 -1
- package/dist/components/BulkActionBar/bulk-action-bar.d.ts.map +1 -1
- package/dist/components/BulkActionBar/bulk-action-bar.js +3 -3
- package/dist/components/BulkActionBar/bulk-action-bar.js.map +1 -1
- package/dist/components/Button/button-group.d.ts +2 -2
- package/dist/components/Button/button-group.d.ts.map +1 -1
- package/dist/components/Button/button-group.js +2 -2
- package/dist/components/Button/button-group.js.map +1 -1
- package/dist/components/Button/button.d.ts +2 -1
- package/dist/components/Button/button.d.ts.map +1 -1
- package/dist/components/Button/button.js +1 -1
- package/dist/components/Button/button.js.map +1 -1
- package/dist/components/Carousel/carousel.d.ts +14 -8
- package/dist/components/Carousel/carousel.d.ts.map +1 -1
- package/dist/components/Carousel/carousel.js +64 -37
- package/dist/components/Carousel/carousel.js.map +1 -1
- package/dist/components/Checkbox/checkbox-group.d.ts.map +1 -1
- package/dist/components/Checkbox/checkbox-group.js +21 -14
- package/dist/components/Checkbox/checkbox-group.js.map +1 -1
- package/dist/components/Checkbox/checkbox.d.ts +2 -2
- package/dist/components/Checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox/checkbox.js +49 -10
- package/dist/components/Checkbox/checkbox.js.map +1 -1
- package/dist/components/Combobox/combobox.d.ts +15 -6
- package/dist/components/Combobox/combobox.d.ts.map +1 -1
- package/dist/components/Combobox/combobox.js +13 -7
- package/dist/components/Combobox/combobox.js.map +1 -1
- package/dist/components/Command/command.d.ts.map +1 -1
- package/dist/components/Command/command.js +11 -2
- package/dist/components/Command/command.js.map +1 -1
- package/dist/components/DataTable/cell-registry.d.ts +5 -5
- package/dist/components/DataTable/cell-registry.d.ts.map +1 -1
- package/dist/components/DataTable/cell-registry.js +41 -38
- package/dist/components/DataTable/cell-registry.js.map +1 -1
- package/dist/components/DataTable/column-types.d.ts +1 -17
- package/dist/components/DataTable/column-types.d.ts.map +1 -1
- package/dist/components/DataTable/column-types.js.map +1 -1
- package/dist/components/DataTable/data-table-column-visibility-panel.d.ts.map +1 -1
- package/dist/components/DataTable/data-table-column-visibility-panel.js +71 -64
- package/dist/components/DataTable/data-table-column-visibility-panel.js.map +1 -1
- package/dist/components/DataTable/data-table-filter-group.d.ts +47 -0
- package/dist/components/DataTable/data-table-filter-group.d.ts.map +1 -0
- package/dist/components/DataTable/data-table-filter-group.js +154 -0
- package/dist/components/DataTable/data-table-filter-group.js.map +1 -0
- package/dist/components/DataTable/data-table-filter-panel.d.ts +0 -2
- package/dist/components/DataTable/data-table-filter-panel.d.ts.map +1 -1
- package/dist/components/DataTable/data-table-filter-panel.js +5 -328
- package/dist/components/DataTable/data-table-filter-panel.js.map +1 -1
- package/dist/components/DataTable/data-table-filter-value-picker.d.ts +29 -0
- package/dist/components/DataTable/data-table-filter-value-picker.d.ts.map +1 -0
- package/dist/components/DataTable/data-table-filter-value-picker.js +187 -0
- package/dist/components/DataTable/data-table-filter-value-picker.js.map +1 -0
- package/dist/components/DataTable/data-table-interaction-layer.d.ts +2 -2
- package/dist/components/DataTable/data-table-interaction-layer.js.map +1 -1
- package/dist/components/DataTable/data-table-sort-manager.js +2 -2
- package/dist/components/DataTable/data-table-sort-manager.js.map +1 -1
- package/dist/components/DataTable/data-table.d.ts +1 -1
- package/dist/components/DataTable/data-table.d.ts.map +1 -1
- package/dist/components/DataTable/data-table.js +44 -32
- package/dist/components/DataTable/data-table.js.map +1 -1
- package/dist/components/DatePicker/date-picker.d.ts +3 -3
- package/dist/components/DatePicker/date-picker.js +4 -4
- package/dist/components/DatePicker/date-picker.js.map +1 -1
- package/dist/components/DescriptionList/description-list.d.ts +3 -3
- package/dist/components/DescriptionList/description-list.d.ts.map +1 -1
- package/dist/components/DescriptionList/description-list.js +6 -6
- package/dist/components/DescriptionList/description-list.js.map +1 -1
- package/dist/components/Dialog/dialog.d.ts +2 -2
- package/dist/components/Dialog/dialog.d.ts.map +1 -1
- package/dist/components/Dialog/dialog.js.map +1 -1
- package/dist/components/DropdownMenu/dropdown-menu.d.ts +8 -3
- package/dist/components/DropdownMenu/dropdown-menu.d.ts.map +1 -1
- package/dist/components/DropdownMenu/dropdown-menu.js +7 -7
- package/dist/components/DropdownMenu/dropdown-menu.js.map +1 -1
- package/dist/components/Field/field-context.d.ts +16 -10
- package/dist/components/Field/field-context.d.ts.map +1 -1
- package/dist/components/Field/field-context.js.map +1 -1
- package/dist/components/Field/field-types.d.ts +2 -2
- package/dist/components/Field/field-types.d.ts.map +1 -1
- package/dist/components/Field/field-types.js.map +1 -1
- package/dist/components/Field/field-wrapper.d.ts +20 -4
- package/dist/components/Field/field-wrapper.d.ts.map +1 -1
- package/dist/components/Field/field-wrapper.js +30 -31
- package/dist/components/Field/field-wrapper.js.map +1 -1
- package/dist/components/Field/field.d.ts +1 -1
- package/dist/components/Field/field.d.ts.map +1 -1
- package/dist/components/Field/field.js +25 -3
- package/dist/components/Field/field.js.map +1 -1
- package/dist/components/Field/index.d.ts +1 -0
- package/dist/components/Field/index.d.ts.map +1 -1
- package/dist/components/Field/index.js +2 -0
- package/dist/components/Field/index.js.map +1 -1
- package/dist/components/Field/use-form-validation.d.ts +1 -1
- package/dist/components/Field/use-form-validation.js.map +1 -1
- package/dist/components/FileItem/file-item.d.ts.map +1 -1
- package/dist/components/FileItem/file-item.js +2 -5
- package/dist/components/FileItem/file-item.js.map +1 -1
- package/dist/components/FileUpload/file-upload.d.ts.map +1 -1
- package/dist/components/FileUpload/file-upload.js +5 -1
- package/dist/components/FileUpload/file-upload.js.map +1 -1
- package/dist/components/FileViewer/file-viewer.d.ts.map +1 -1
- package/dist/components/FileViewer/file-viewer.js +2 -1
- package/dist/components/FileViewer/file-viewer.js.map +1 -1
- package/dist/components/HoverCard/hover-card.d.ts +2 -2
- package/dist/components/HoverCard/hover-card.d.ts.map +1 -1
- package/dist/components/HoverCard/hover-card.js +4 -2
- package/dist/components/HoverCard/hover-card.js.map +1 -1
- package/dist/components/InlineEdit/inline-edit.d.ts +23 -16
- package/dist/components/InlineEdit/inline-edit.d.ts.map +1 -1
- package/dist/components/InlineEdit/inline-edit.js +104 -62
- package/dist/components/InlineEdit/inline-edit.js.map +1 -1
- package/dist/components/Input/input.d.ts +1 -1
- package/dist/components/Input/input.d.ts.map +1 -1
- package/dist/components/Input/input.js +6 -6
- package/dist/components/Input/input.js.map +1 -1
- package/dist/components/LinkInput/link-input.d.ts +5 -5
- package/dist/components/LinkInput/link-input.d.ts.map +1 -1
- package/dist/components/LinkInput/link-input.js +3 -3
- package/dist/components/LinkInput/link-input.js.map +1 -1
- package/dist/components/Notice/notice.d.ts +17 -1
- package/dist/components/Notice/notice.d.ts.map +1 -1
- package/dist/components/Notice/notice.js +7 -1
- package/dist/components/Notice/notice.js.map +1 -1
- package/dist/components/NumberInput/number-input.d.ts +1 -1
- package/dist/components/NumberInput/number-input.d.ts.map +1 -1
- package/dist/components/NumberInput/number-input.js +12 -1
- package/dist/components/NumberInput/number-input.js.map +1 -1
- package/dist/components/PeoplePicker/avatar-stack-overflow.d.ts +1 -1
- package/dist/components/PeoplePicker/avatar-stack-overflow.js.map +1 -1
- package/dist/components/PeoplePicker/people-picker.d.ts +5 -5
- package/dist/components/PeoplePicker/people-picker.d.ts.map +1 -1
- package/dist/components/PeoplePicker/people-picker.js +7 -5
- package/dist/components/PeoplePicker/people-picker.js.map +1 -1
- package/dist/components/PeoplePicker/person-display.d.ts +1 -1
- package/dist/components/PeoplePicker/person-display.js.map +1 -1
- package/dist/components/ProfileCard/profile-card.d.ts +1 -1
- package/dist/components/ProfileCard/profile-card.js.map +1 -1
- package/dist/components/RadioGroup/radio-group.d.ts +3 -3
- package/dist/components/RadioGroup/radio-group.d.ts.map +1 -1
- package/dist/components/RadioGroup/radio-group.js +1 -1
- package/dist/components/RadioGroup/radio-group.js.map +1 -1
- package/dist/components/Rating/rating.d.ts.map +1 -1
- package/dist/components/Rating/rating.js +4 -0
- package/dist/components/Rating/rating.js.map +1 -1
- package/dist/components/ScrollArea/scroll-area.d.ts +3 -2
- package/dist/components/ScrollArea/scroll-area.d.ts.map +1 -1
- package/dist/components/ScrollArea/scroll-area.js.map +1 -1
- package/dist/components/SegmentedControl/segmented-control.d.ts +4 -3
- package/dist/components/SegmentedControl/segmented-control.d.ts.map +1 -1
- package/dist/components/SegmentedControl/segmented-control.js.map +1 -1
- package/dist/components/Select/select.d.ts +16 -6
- package/dist/components/Select/select.d.ts.map +1 -1
- package/dist/components/Select/select.js +17 -5
- package/dist/components/Select/select.js.map +1 -1
- package/dist/components/SelectMenu/select-menu.d.ts +17 -1
- package/dist/components/SelectMenu/select-menu.d.ts.map +1 -1
- package/dist/components/SelectMenu/select-menu.js +17 -3
- package/dist/components/SelectMenu/select-menu.js.map +1 -1
- package/dist/components/SelectionControl/boolean-value.d.ts +1 -1
- package/dist/components/SelectionControl/boolean-value.js.map +1 -1
- package/dist/components/Sheet/sheet.d.ts +2 -2
- package/dist/components/Sheet/sheet.d.ts.map +1 -1
- package/dist/components/Sheet/sheet.js.map +1 -1
- package/dist/components/Sidebar/sidebar.d.ts +1 -1
- package/dist/components/Sidebar/sidebar.js +2 -2
- package/dist/components/Sidebar/sidebar.js.map +1 -1
- package/dist/components/Slider/slider.d.ts.map +1 -1
- package/dist/components/Slider/slider.js +6 -3
- package/dist/components/Slider/slider.js.map +1 -1
- package/dist/components/Steps/steps.d.ts +6 -4
- package/dist/components/Steps/steps.d.ts.map +1 -1
- package/dist/components/Steps/steps.js +19 -5
- package/dist/components/Steps/steps.js.map +1 -1
- package/dist/components/Switch/switch.d.ts +4 -4
- package/dist/components/Switch/switch.d.ts.map +1 -1
- package/dist/components/Switch/switch.js +3 -1
- package/dist/components/Switch/switch.js.map +1 -1
- package/dist/components/Tabs/tabs.d.ts +1 -1
- package/dist/components/Tabs/tabs.d.ts.map +1 -1
- package/dist/components/Tabs/tabs.js +73 -23
- package/dist/components/Tabs/tabs.js.map +1 -1
- package/dist/components/Tag/tag.d.ts +3 -1
- package/dist/components/Tag/tag.d.ts.map +1 -1
- package/dist/components/Tag/tag.js +2 -2
- package/dist/components/Tag/tag.js.map +1 -1
- package/dist/components/Textarea/textarea.d.ts +4 -4
- package/dist/components/Textarea/textarea.d.ts.map +1 -1
- package/dist/components/Textarea/textarea.js +15 -15
- package/dist/components/Textarea/textarea.js.map +1 -1
- package/dist/components/TimePicker/time-picker.d.ts +4 -4
- package/dist/components/TimePicker/time-picker.d.ts.map +1 -1
- package/dist/components/TimePicker/time-picker.js +8 -5
- package/dist/components/TimePicker/time-picker.js.map +1 -1
- package/dist/components/Tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/tooltip.js +27 -23
- package/dist/components/Tooltip/tooltip.js.map +1 -1
- package/dist/components/TreeView/tree-view.d.ts.map +1 -1
- package/dist/components/TreeView/tree-view.js +16 -0
- package/dist/components/TreeView/tree-view.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -11
- package/dist/lib/drag-visual.d.ts +2 -2
- package/dist/lib/drag-visual.js.map +1 -1
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +21 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/patterns/element-anatomy/item-anatomy.d.ts +2 -0
- package/dist/patterns/element-anatomy/item-anatomy.d.ts.map +1 -1
- package/dist/patterns/element-anatomy/item-anatomy.js +2 -2
- package/dist/patterns/element-anatomy/item-anatomy.js.map +1 -1
- package/dist/tokens/categorical-color.d.ts +3 -3
- package/dist/tokens/categorical-color.d.ts.map +1 -1
- package/dist/tokens/categorical-color.js +2 -2
- package/dist/tokens/categorical-color.js.map +1 -1
- package/ds-canonical/fork/AGENTS.md +213 -0
- package/ds-canonical/fork/codex/agents/skills/independent-review/SKILL.md +33 -0
- package/ds-canonical/fork/codex/hooks.json +16 -0
- package/ds-canonical/fork/governance.lock +22 -7
- package/ds-canonical/fork/hooks/check_ds_anchor_preflight.sh +22 -1
- package/ds-canonical/fork/hooks/inject_deploy_url_after_push.sh +14 -2
- package/ds-canonical/fork/manifest.json +10 -1
- package/ds-canonical/fork/preamble.md +3 -2
- package/ds-canonical/fork/skills/product-ui-audit/SKILL.md +7 -7
- package/ds-canonical/fork/skills/ux-audit/SKILL.md +1 -1
- package/ds-canonical/fork/skills/visual-audit/SKILL.md +0 -1
- package/ds-canonical/hooks/check_codex_brief_invariants.sh +9 -3
- package/ds-canonical/hooks/check_datatable_invariants.sh +6 -3
- package/ds-canonical/hooks/check_ds_anchor_preflight.sh +22 -1
- package/ds-canonical/hooks/check_overlay_open_focus_escape_probe.sh +11 -2
- package/ds-canonical/hooks/check_plugin_fork_health.sh +17 -1
- package/ds-canonical/hooks/check_post_main_ssot_propagate.sh +21 -4
- package/ds-canonical/hooks/inject_deploy_url_after_push.sh +14 -2
- package/ds-canonical/hooks/session_start_governance_check.sh +10 -2
- package/ds-canonical/references/certified-surfaces.md +20 -0
- package/ds-canonical/references/preflight-gate-baseline.json +5 -0
- package/ds-canonical/references/principle-dim-map.json +20 -2
- package/ds-canonical/references/props-naming.md +2 -1
- package/ds-canonical/references/ssot-index.md +2 -2
- package/ds-canonical/references/story-baseline-registry.json +2 -2
- package/ds-canonical/rules/story-rules.md +1 -1
- package/ds-canonical/rules/ui-development.md +2 -1
- package/ds-canonical/skills/codex-collab/SKILL.md +7 -7
- package/ds-canonical/skills/codex-collab/references/brief-template.md +5 -1
- package/ds-canonical/skills/component-quality-gate/SKILL.md +1 -1
- package/ds-canonical/skills/deep-audit-cross-codex/SKILL.md +5 -5
- package/ds-canonical/skills/design-system-audit/SKILL.md +5 -5
- package/ds-canonical/skills/product-ui-audit/SKILL.md +7 -7
- package/ds-canonical/skills/ux-audit/SKILL.md +1 -1
- package/ds-canonical/skills/visual-audit/SKILL.md +0 -1
- package/ds-story-manifest.json +21 -21
- package/llms-full.txt +3 -3
- package/llms.txt +1 -1
- package/package.json +2 -1
- package/src/components/Accordion/accordion.anatomy.stories.tsx +11 -11
- package/src/components/Accordion/accordion.principles.stories.tsx +21 -6
- package/src/components/Accordion/accordion.spec.md +10 -1
- package/src/components/Accordion/accordion.stories.tsx +10 -5
- package/src/components/Accordion/accordion.tsx +7 -2
- package/src/components/Alert/alert.principles.stories.tsx +2 -8
- package/src/components/AppShell/app-shell.anatomy.stories.tsx +19 -13
- package/src/components/AppShell/app-shell.principles.stories.tsx +21 -21
- package/src/components/AppShell/app-shell.spec.md +4 -0
- package/src/components/AppShell/app-shell.stories.tsx +4 -5
- package/src/components/Avatar/avatar.tsx +1 -1
- package/src/components/Badge/badge.spec.md +2 -2
- package/src/components/Breadcrumb/breadcrumb.anatomy.stories.tsx +7 -3
- package/src/components/Breadcrumb/breadcrumb.principles.stories.tsx +4 -1
- package/src/components/Breadcrumb/breadcrumb.stories.tsx +1 -1
- package/src/components/BulkActionBar/bulk-action-bar.anatomy.stories.tsx +6 -6
- package/src/components/BulkActionBar/bulk-action-bar.principles.stories.tsx +18 -6
- package/src/components/BulkActionBar/bulk-action-bar.spec.md +15 -5
- package/src/components/BulkActionBar/bulk-action-bar.stories.tsx +8 -24
- package/src/components/BulkActionBar/bulk-action-bar.tsx +4 -4
- package/src/components/Button/button-group.tsx +4 -4
- package/src/components/Button/button.anatomy.stories.tsx +26 -7
- package/src/components/Button/button.principles.stories.tsx +1 -1
- package/src/components/Button/button.spec.md +2 -2
- package/src/components/Button/button.stories.tsx +22 -28
- package/src/components/Button/button.tsx +2 -1
- package/src/components/Calendar/calendar.anatomy.stories.tsx +1 -1
- package/src/components/Calendar/calendar.spec.md +1 -1
- package/src/components/Carousel/carousel.spec.md +17 -1
- package/src/components/Carousel/carousel.tsx +93 -42
- package/src/components/Checkbox/checkbox-group.tsx +26 -15
- package/src/components/Checkbox/checkbox.anatomy.stories.tsx +3 -3
- package/src/components/Checkbox/checkbox.spec.md +14 -3
- package/src/components/Checkbox/checkbox.stories.tsx +4 -4
- package/src/components/Checkbox/checkbox.tsx +79 -19
- package/src/components/Coachmark/coachmark.anatomy.stories.tsx +5 -5
- package/src/components/Coachmark/coachmark.principles.stories.tsx +1 -1
- package/src/components/Combobox/combobox.anatomy.stories.tsx +11 -4
- package/src/components/Combobox/combobox.principles.stories.tsx +10 -11
- package/src/components/Combobox/combobox.spec.md +6 -2
- package/src/components/Combobox/combobox.stories.tsx +9 -36
- package/src/components/Combobox/combobox.tsx +42 -27
- package/src/components/Command/command.spec.md +3 -3
- package/src/components/Command/command.tsx +9 -2
- package/src/components/DataTable/cell-registry.tsx +75 -76
- package/src/components/DataTable/column-types.ts +4 -17
- package/src/components/DataTable/data-table-column-visibility-panel.tsx +20 -7
- package/src/components/DataTable/data-table-filter-group.tsx +231 -0
- package/src/components/DataTable/data-table-filter-panel.tsx +19 -436
- package/src/components/DataTable/data-table-filter-value-picker.tsx +237 -0
- package/src/components/DataTable/data-table-interaction-layer.tsx +3 -3
- package/src/components/DataTable/data-table-sort-manager.tsx +2 -2
- package/src/components/DataTable/data-table.anatomy.stories.tsx +25 -24
- package/src/components/DataTable/data-table.css +2 -3
- package/src/components/DataTable/data-table.principles.stories.tsx +17 -11
- package/src/components/DataTable/data-table.spec.md +8 -8
- package/src/components/DataTable/data-table.stories.tsx +39 -29
- package/src/components/DataTable/data-table.tsx +94 -68
- package/src/components/DataTable/filter-operators.spec.md +5 -3
- package/src/components/DateGrid/date-grid.spec.md +1 -1
- package/src/components/DatePicker/date-picker.anatomy.stories.tsx +9 -9
- package/src/components/DatePicker/date-picker.principles.stories.tsx +4 -4
- package/src/components/DatePicker/date-picker.spec.md +9 -9
- package/src/components/DatePicker/date-picker.stories.tsx +9 -9
- package/src/components/DatePicker/date-picker.tsx +13 -13
- package/src/components/DescriptionList/description-list.anatomy.stories.tsx +5 -5
- package/src/components/DescriptionList/description-list.principles.stories.tsx +2 -2
- package/src/components/DescriptionList/description-list.spec.md +12 -12
- package/src/components/DescriptionList/description-list.stories.tsx +3 -3
- package/src/components/DescriptionList/description-list.tsx +10 -10
- package/src/components/Dialog/dialog.tsx +4 -1
- package/src/components/DropdownMenu/dropdown-menu.tsx +27 -14
- package/src/components/Field/field-context.ts +17 -11
- package/src/components/Field/field-controls.spec.md +44 -37
- package/src/components/Field/field-types.ts +14 -12
- package/src/components/Field/field-wrapper.tsx +59 -43
- package/src/components/Field/field.anatomy.stories.tsx +6 -6
- package/src/components/Field/field.principles.stories.tsx +5 -28
- package/src/components/Field/field.spec.md +4 -4
- package/src/components/Field/field.stories.tsx +103 -72
- package/src/components/Field/field.tsx +36 -4
- package/src/components/Field/form-validation.spec.md +2 -0
- package/src/components/Field/index.ts +1 -0
- package/src/components/Field/use-form-validation.ts +1 -1
- package/src/components/FieldControlGroup/field-control-group.principles.stories.tsx +3 -3
- package/src/components/FieldControlGroup/field-control-group.spec.md +3 -3
- package/src/components/FileItem/file-item.tsx +10 -8
- package/src/components/FileUpload/file-upload.principles.stories.tsx +7 -7
- package/src/components/FileUpload/file-upload.spec.md +3 -2
- package/src/components/FileUpload/file-upload.tsx +5 -1
- package/src/components/FileViewer/file-viewer.anatomy.stories.tsx +1 -1
- package/src/components/FileViewer/file-viewer.principles.stories.tsx +1 -1
- package/src/components/FileViewer/file-viewer.spec.md +1 -1
- package/src/components/FileViewer/file-viewer.stories.tsx +1 -1
- package/src/components/FileViewer/file-viewer.tsx +3 -2
- package/src/components/HoverCard/hover-card.anatomy.stories.tsx +6 -4
- package/src/components/HoverCard/hover-card.principles.stories.tsx +6 -1
- package/src/components/HoverCard/hover-card.spec.md +2 -2
- package/src/components/HoverCard/hover-card.tsx +4 -2
- package/src/components/InlineEdit/inline-edit.anatomy.stories.tsx +184 -0
- package/src/components/InlineEdit/inline-edit.principles.stories.tsx +142 -0
- package/src/components/InlineEdit/inline-edit.spec.md +71 -46
- package/src/components/InlineEdit/inline-edit.stories.tsx +20 -19
- package/src/components/InlineEdit/inline-edit.tsx +211 -125
- package/src/components/Input/input.anatomy.stories.tsx +15 -15
- package/src/components/Input/input.principles.stories.tsx +3 -3
- package/src/components/Input/input.spec.md +4 -4
- package/src/components/Input/input.stories.tsx +3 -3
- package/src/components/Input/input.tsx +13 -13
- package/src/components/LinkInput/link-input.anatomy.stories.tsx +2 -2
- package/src/components/LinkInput/link-input.principles.stories.tsx +1 -1
- package/src/components/LinkInput/link-input.spec.md +6 -2
- package/src/components/LinkInput/link-input.stories.tsx +8 -8
- package/src/components/LinkInput/link-input.tsx +21 -19
- package/src/components/Notice/notice.principles.stories.tsx +1 -1
- package/src/components/Notice/notice.tsx +8 -2
- package/src/components/NumberInput/number-input.anatomy.stories.tsx +6 -6
- package/src/components/NumberInput/number-input.principles.stories.tsx +4 -4
- package/src/components/NumberInput/number-input.spec.md +6 -6
- package/src/components/NumberInput/number-input.stories.tsx +4 -4
- package/src/components/NumberInput/number-input.tsx +17 -5
- package/src/components/OverflowIndicator/overflow-indicator.anatomy.stories.tsx +8 -4
- package/src/components/OverflowIndicator/overflow-indicator.principles.stories.tsx +6 -7
- package/src/components/OverflowIndicator/overflow-indicator.spec.md +1 -1
- package/src/components/OverflowIndicator/overflow-indicator.stories.tsx +6 -30
- package/src/components/PeoplePicker/avatar-stack-overflow.ts +1 -1
- package/src/components/PeoplePicker/people-picker.anatomy.stories.tsx +13 -10
- package/src/components/PeoplePicker/people-picker.principles.stories.tsx +5 -1
- package/src/components/PeoplePicker/people-picker.stories.tsx +5 -5
- package/src/components/PeoplePicker/people-picker.tsx +39 -20
- package/src/components/PeoplePicker/person-display.tsx +3 -3
- package/src/components/Popover/popover.anatomy.stories.tsx +10 -7
- package/src/components/Popover/popover.principles.stories.tsx +49 -28
- package/src/components/Popover/popover.spec.md +4 -2
- package/src/components/ProfileCard/profile-card.anatomy.stories.tsx +1 -1
- package/src/components/ProfileCard/profile-card.tsx +1 -1
- package/src/components/ProgressBar/progress-bar.anatomy.stories.tsx +14 -13
- package/src/components/ProgressBar/progress-bar.principles.stories.tsx +8 -23
- package/src/components/ProgressBar/progress-bar.stories.tsx +8 -2
- package/src/components/README.md +1 -0
- package/src/components/RadioGroup/radio-group.anatomy.stories.tsx +8 -3
- package/src/components/RadioGroup/radio-group.stories.tsx +3 -3
- package/src/components/RadioGroup/radio-group.tsx +19 -14
- package/src/components/Rating/rating.anatomy.stories.tsx +1 -1
- package/src/components/Rating/rating.principles.stories.tsx +3 -3
- package/src/components/Rating/rating.spec.md +2 -2
- package/src/components/Rating/rating.stories.tsx +4 -18
- package/src/components/Rating/rating.tsx +5 -1
- package/src/components/ScrollArea/scroll-area.principles.stories.tsx +1 -1
- package/src/components/ScrollArea/scroll-area.spec.md +1 -1
- package/src/components/ScrollArea/scroll-area.tsx +5 -2
- package/src/components/SegmentedControl/segmented-control.principles.stories.tsx +4 -1
- package/src/components/SegmentedControl/segmented-control.spec.md +5 -10
- package/src/components/SegmentedControl/segmented-control.tsx +6 -3
- package/src/components/Select/select.anatomy.stories.tsx +13 -7
- package/src/components/Select/select.principles.stories.tsx +3 -3
- package/src/components/Select/select.spec.md +11 -1
- package/src/components/Select/select.stories.tsx +41 -27
- package/src/components/Select/select.tsx +44 -26
- package/src/components/SelectMenu/select-menu.anatomy.stories.tsx +44 -26
- package/src/components/SelectMenu/select-menu.principles.stories.tsx +0 -1
- package/src/components/SelectMenu/select-menu.stories.tsx +7 -19
- package/src/components/SelectMenu/select-menu.tsx +38 -5
- package/src/components/SelectionControl/boolean-value.tsx +2 -2
- package/src/components/SelectionControl/selection-item.anatomy.stories.tsx +1 -1
- package/src/components/SelectionControl/selection-item.principles.stories.tsx +4 -4
- package/src/components/Separator/separator.principles.stories.tsx +1 -1
- package/src/components/Sheet/sheet.principles.stories.tsx +5 -3
- package/src/components/Sheet/sheet.tsx +4 -1
- package/src/components/Sidebar/sidebar.tsx +1 -1
- package/src/components/Slider/slider.anatomy.stories.tsx +5 -4
- package/src/components/Slider/slider.principles.stories.tsx +6 -6
- package/src/components/Slider/slider.spec.md +13 -1
- package/src/components/Slider/slider.stories.tsx +44 -32
- package/src/components/Slider/slider.tsx +13 -4
- package/src/components/Steps/steps.anatomy.stories.tsx +7 -7
- package/src/components/Steps/steps.principles.stories.tsx +1 -1
- package/src/components/Steps/steps.spec.md +4 -2
- package/src/components/Steps/steps.stories.tsx +4 -56
- package/src/components/Steps/steps.tsx +31 -7
- package/src/components/Switch/switch.anatomy.stories.tsx +3 -3
- package/src/components/Switch/switch.principles.stories.tsx +1 -1
- package/src/components/Switch/switch.spec.md +4 -4
- package/src/components/Switch/switch.stories.tsx +3 -3
- package/src/components/Switch/switch.tsx +16 -10
- package/src/components/Tabs/tabs.anatomy.stories.tsx +6 -0
- package/src/components/Tabs/tabs.principles.stories.tsx +10 -2
- package/src/components/Tabs/tabs.spec.md +5 -2
- package/src/components/Tabs/tabs.stories.tsx +36 -44
- package/src/components/Tabs/tabs.tsx +101 -36
- package/src/components/Tag/tag.anatomy.stories.tsx +2 -2
- package/src/components/Tag/tag.principles.stories.tsx +4 -4
- package/src/components/Tag/tag.spec.md +3 -1
- package/src/components/Tag/tag.tsx +5 -3
- package/src/components/Textarea/textarea.anatomy.stories.tsx +6 -6
- package/src/components/Textarea/textarea.spec.md +5 -5
- package/src/components/Textarea/textarea.tsx +24 -24
- package/src/components/TimePicker/time-picker.anatomy.stories.tsx +12 -11
- package/src/components/TimePicker/time-picker.principles.stories.tsx +37 -44
- package/src/components/TimePicker/time-picker.spec.md +6 -5
- package/src/components/TimePicker/time-picker.stories.tsx +3 -3
- package/src/components/TimePicker/time-picker.tsx +24 -14
- package/src/components/Toast/toast.principles.stories.tsx +1 -1
- package/src/components/Toast/toast.stories.tsx +1 -1
- package/src/components/Tooltip/tooltip.anatomy.stories.tsx +15 -6
- package/src/components/Tooltip/tooltip.principles.stories.tsx +4 -4
- package/src/components/Tooltip/tooltip.spec.md +9 -3
- package/src/components/Tooltip/tooltip.stories.tsx +1 -1
- package/src/components/Tooltip/tooltip.tsx +12 -2
- package/src/components/TreeView/tree-view.anatomy.stories.tsx +16 -14
- package/src/components/TreeView/tree-view.principles.stories.tsx +44 -11
- package/src/components/TreeView/tree-view.spec.md +8 -6
- package/src/components/TreeView/tree-view.stories.tsx +9 -43
- package/src/components/TreeView/tree-view.tsx +36 -0
- package/src/index.ts +16 -9
- package/src/lib/drag-visual.ts +2 -2
- package/src/lib/utils.ts +19 -0
- package/src/patterns/element-anatomy/inline-action.spec.md +1 -1
- package/src/patterns/element-anatomy/item-anatomy.tsx +4 -2
- package/src/patterns/header-canonical/header-canonical.spec.md +9 -0
- package/src/patterns/header-canonical/header-canonical.stories.tsx +31 -5
- package/src/tokens/categorical-color.ts +5 -5
- package/src/tokens/color/color.spec.md +5 -5
- package/src/tokens/color/primitives.css +9 -2
- package/src/tokens/opacity/opacity.spec.md +1 -1
- package/src/tokens/orphan-tokens.spec.md +1 -1
- package/src/tokens/typography/typography.spec.md +2 -0
- package/src/tokens/uiSize/uiSize.css +6 -1
- package/src/tokens/uiSize/uiSize.spec.md +1 -1
|
@@ -1,33 +1,23 @@
|
|
|
1
1
|
// @benchmark-unverified-blanket: file-level retraction per M22 (d) — claims herein not individually URL-cited; treat as unverified visual/usage rumor unless retrofit per-claim. Hook escape preserved.
|
|
2
2
|
// same-row-mixed-allow: header chrome corner buttons(close)跟 row inline actions(trash)不在同 row
|
|
3
|
-
// code-quality-allow: file-size — 2026-05-03 M21 retract:filter-value-picker.tsx(187 行 / 1 consumer)inline 回本檔(505 → 687 行)。2026-07-14 deep-audit 誠實更新:現 822 行,**已過 800 hard cap** — 非 stale escape 留著;拆檔候選 = filter-value-picker 區段(等第 2 個 consumer 接入)+ nested-group renderer,屬結構 refactor 需獨立 branch 做 + 完整驗證,列入 file-size escalation 追蹤,禁再增量。
|
|
4
3
|
import * as React from 'react'
|
|
5
|
-
import { Plus,
|
|
4
|
+
import { Plus, X as XIcon, RotateCcw } from 'lucide-react'
|
|
6
5
|
import type { ColumnDef } from '@tanstack/react-table'
|
|
7
6
|
import { cn } from '@/lib/utils'
|
|
8
7
|
import { Button } from '@/design-system/components/Button/button'
|
|
9
|
-
import {
|
|
10
|
-
import { Combobox } from '@/design-system/components/Combobox/combobox'
|
|
11
|
-
import { Input } from '@/design-system/components/Input/input'
|
|
12
|
-
import { NumberInput } from '@/design-system/components/NumberInput/number-input'
|
|
13
|
-
import { DatePicker, DatePickerRange } from '@/design-system/components/DatePicker/date-picker'
|
|
14
|
-
import { PeoplePicker } from '@/design-system/components/PeoplePicker/people-picker'
|
|
15
|
-
import type { PersonValue } from '@/design-system/components/PeoplePicker/person-display'
|
|
8
|
+
import type { SelectOption } from '@/design-system/components/Select/select'
|
|
16
9
|
import { SurfaceHeader, SurfaceBody, COMPACT_HEADER_SLOT } from '@/design-system/patterns/overlay-surface/overlay-surface'
|
|
17
10
|
import { PopoverTitle, PopoverClose } from '@/design-system/components/Popover/popover'
|
|
18
11
|
import { ButtonDivider } from '@/design-system/components/Button/button-group'
|
|
19
|
-
import { FieldControlGroup } from '@/design-system/components/FieldControlGroup/field-control-group'
|
|
20
12
|
import type { ColumnType } from './column-types'
|
|
21
13
|
import { getColumnId, getColumnLabel, getColumnMeta } from './lib/column-meta'
|
|
22
14
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
type ValueShape,
|
|
30
|
-
} from './filter-operators'
|
|
15
|
+
FilterRow,
|
|
16
|
+
GroupBlock,
|
|
17
|
+
getDefaultOperator,
|
|
18
|
+
datePrecisionOf,
|
|
19
|
+
type FilterColumn,
|
|
20
|
+
} from './data-table-filter-group'
|
|
31
21
|
import {
|
|
32
22
|
createEmptyFilterTree,
|
|
33
23
|
isFilterTreeActive,
|
|
@@ -64,6 +54,9 @@ export type { Conjunction, FilterCondition, FilterGroup, FilterTree, FilterTreeF
|
|
|
64
54
|
* Source-of-truth:
|
|
65
55
|
* - Operator definitions:`./filter-operators.ts` `OPERATOR_REGISTRY`(SSOT,禁 hardcode op 字串)
|
|
66
56
|
* - Filter state:**FilterTree**(本檔自管;搭配 TanStack `globalFilter` 求值)
|
|
57
|
+
* - Row / nested-group renderer:`./data-table-filter-group.tsx`;value picker:
|
|
58
|
+
* `./data-table-filter-value-picker.tsx`(皆 @internal — 2026-07-14 file-size 拆檔,
|
|
59
|
+
* 本檔只留 orchestration:columns 抽取 / FilterTree mutators / panel chrome)
|
|
67
60
|
*
|
|
68
61
|
* 詳:`./filter-operators.spec.md`
|
|
69
62
|
*/
|
|
@@ -73,17 +66,8 @@ export type { Conjunction, FilterCondition, FilterGroup, FilterTree, FilterTreeF
|
|
|
73
66
|
let _idSeed = 0
|
|
74
67
|
const newId = () => `f${++_idSeed}-${Date.now().toString(36)}`
|
|
75
68
|
|
|
76
|
-
// ── Helpers —
|
|
77
|
-
|
|
78
|
-
interface FilterColumn {
|
|
79
|
-
id: string
|
|
80
|
-
label: string
|
|
81
|
-
type: ColumnType
|
|
82
|
-
options?: Array<{ value: string; label: string }>
|
|
83
|
-
/** People pool for person/multiPerson filter picker(對齊 cell-registry meta.people SSOT)*/
|
|
84
|
-
people?: Array<{ name: string; avatarUrl?: string; description?: string }>
|
|
85
|
-
includeTime?: boolean
|
|
86
|
-
}
|
|
69
|
+
// ── Helpers — column extraction + condition factories ──────────────────
|
|
70
|
+
// (FilterColumn type + operator helpers 住 ./data-table-filter-group.tsx)
|
|
87
71
|
|
|
88
72
|
function extractColumns<TData>(columns: ColumnDef<TData, any>[]): FilterColumn[] {
|
|
89
73
|
const out: FilterColumn[] = []
|
|
@@ -106,20 +90,6 @@ function extractColumns<TData>(columns: ColumnDef<TData, any>[]): FilterColumn[]
|
|
|
106
90
|
return out
|
|
107
91
|
}
|
|
108
92
|
|
|
109
|
-
function getOperatorOptions(type?: ColumnType): SelectOption[] {
|
|
110
|
-
const registry = type && OPERATOR_REGISTRY[type] ? OPERATOR_REGISTRY[type] : OPERATOR_REGISTRY.string
|
|
111
|
-
return registry.map((op) => ({ value: op.op, label: op.label }))
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function getDefaultOperator(type?: ColumnType): string {
|
|
115
|
-
return (type && DEFAULT_OPERATOR[type]) || DEFAULT_OPERATOR.string
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Q6(2026-07-04):date 欄位把比對精度寫進 condition(includeTime=true → ms,否則 day)。
|
|
119
|
-
// 'time' 欄暫不寫(值非完整日期,truncate 語意不成立;見 filter-operators.spec v3 time 註)。
|
|
120
|
-
const datePrecisionOf = (col: FilterColumn | undefined): 'day' | 'ms' | undefined =>
|
|
121
|
-
col?.type === 'date' ? (col.includeTime ? 'ms' : 'day') : undefined
|
|
122
|
-
|
|
123
93
|
const newCondition = (firstCol: FilterColumn | undefined): FilterCondition => ({
|
|
124
94
|
kind: 'cond',
|
|
125
95
|
id: newId(),
|
|
@@ -153,222 +123,12 @@ const newEmptyGroup = (): FilterGroup => ({
|
|
|
153
123
|
children: [newEmptyCondition()],
|
|
154
124
|
})
|
|
155
125
|
|
|
156
|
-
// ── Internal — FilterValuePicker(value-picker switcher per ValueShape)──
|
|
157
|
-
//
|
|
158
|
-
// 2026-05-03 M21 retract:本 helper 原本獨立檔 `filter-value-picker.tsx`,
|
|
159
|
-
// claim「未來 inline filter UI 共用」但只 1 consumer(本 panel)= 違 M21
|
|
160
|
-
// premature abstraction。inline 回 panel,日後若真有第 2 consumer 再抽。
|
|
161
|
-
|
|
162
|
-
interface FilterValuePickerColInfo {
|
|
163
|
-
id: string
|
|
164
|
-
label: string
|
|
165
|
-
options?: Array<{ value: string; label: string }>
|
|
166
|
-
/** Person pool — person/multiPerson filter picker 用(2026-05-07 升級,SSOT 對齊 cell-registry) */
|
|
167
|
-
people?: Array<{ name: string; avatarUrl?: string; description?: string }>
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
interface FilterValuePickerProps {
|
|
171
|
-
shape: ValueShape | null
|
|
172
|
-
value: unknown
|
|
173
|
-
onChange: (v: unknown) => void
|
|
174
|
-
colInfo?: FilterValuePickerColInfo
|
|
175
|
-
disabled?: boolean
|
|
176
|
-
/** 用 column.label 組「{label} 篩選值」(panel 每 row 不顯式 label,a11y 必填) */
|
|
177
|
-
ariaLabel?: string
|
|
178
|
-
/** Forward 給內部 Field control 的 className(2026-05-04 #2 fix)
|
|
179
|
-
* 避免外層包 wrapper div 破壞 FieldControlGroup CSS variants(rounded radii / margin overlap) */
|
|
180
|
-
className?: string
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function FilterValuePicker({
|
|
184
|
-
shape,
|
|
185
|
-
value,
|
|
186
|
-
onChange,
|
|
187
|
-
colInfo,
|
|
188
|
-
disabled,
|
|
189
|
-
ariaLabel,
|
|
190
|
-
className,
|
|
191
|
-
}: FilterValuePickerProps) {
|
|
192
|
-
if (!shape || disabled) {
|
|
193
|
-
return <Input size="sm" value="" onChange={() => {}} placeholder="輸入值…" disabled aria-label={ariaLabel} className={className} />
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
switch (shape) {
|
|
197
|
-
case 'none':
|
|
198
|
-
return null
|
|
199
|
-
|
|
200
|
-
case 'text':
|
|
201
|
-
return (
|
|
202
|
-
<Input
|
|
203
|
-
size="sm"
|
|
204
|
-
value={String(value ?? '')}
|
|
205
|
-
onChange={(e) => onChange(e.target.value)}
|
|
206
|
-
placeholder="輸入值…"
|
|
207
|
-
aria-label={ariaLabel}
|
|
208
|
-
className={className}
|
|
209
|
-
/>
|
|
210
|
-
)
|
|
211
|
-
|
|
212
|
-
case 'number':
|
|
213
|
-
return (
|
|
214
|
-
<NumberInput
|
|
215
|
-
size="sm"
|
|
216
|
-
value={typeof value === 'number' ? value : null}
|
|
217
|
-
onChange={(v) => onChange(v ?? '')}
|
|
218
|
-
placeholder="輸入數字…"
|
|
219
|
-
aria-label={ariaLabel}
|
|
220
|
-
className={className}
|
|
221
|
-
/>
|
|
222
|
-
)
|
|
223
|
-
|
|
224
|
-
case 'date_single':
|
|
225
|
-
return (
|
|
226
|
-
<DatePicker
|
|
227
|
-
size="sm"
|
|
228
|
-
value={typeof value === 'string' ? value : null}
|
|
229
|
-
onChange={(v) => onChange(v ?? '')}
|
|
230
|
-
aria-label={ariaLabel}
|
|
231
|
-
className={className}
|
|
232
|
-
/>
|
|
233
|
-
)
|
|
234
|
-
|
|
235
|
-
case 'date_range':
|
|
236
|
-
return (
|
|
237
|
-
<DatePickerRange
|
|
238
|
-
size="sm"
|
|
239
|
-
value={Array.isArray(value) && value.length === 2
|
|
240
|
-
? (value as [string | null, string | null])
|
|
241
|
-
: null}
|
|
242
|
-
onChange={(v) => onChange(v)}
|
|
243
|
-
aria-label={ariaLabel}
|
|
244
|
-
className={className}
|
|
245
|
-
/>
|
|
246
|
-
)
|
|
247
|
-
|
|
248
|
-
case 'date_relative': {
|
|
249
|
-
// 群組分類:Past / Current / Future(對齊 Linear / Notion idiom),走 Select.groups → SelectMenu
|
|
250
|
-
const opts: SelectOption[] = DATE_RELATIVE_OPTIONS.map((o) => ({
|
|
251
|
-
value: o.value,
|
|
252
|
-
label: o.label,
|
|
253
|
-
group: o.group,
|
|
254
|
-
}))
|
|
255
|
-
return (
|
|
256
|
-
<Select
|
|
257
|
-
size="sm"
|
|
258
|
-
options={opts}
|
|
259
|
-
groups={DATE_RELATIVE_GROUPS as unknown as Array<{ key: string; label: string }>}
|
|
260
|
-
value={String(value ?? '')}
|
|
261
|
-
onChange={(v) => onChange(v)}
|
|
262
|
-
placeholder="選擇相對日期"
|
|
263
|
-
aria-label={ariaLabel}
|
|
264
|
-
className={className}
|
|
265
|
-
/>
|
|
266
|
-
)
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
case 'select_single': {
|
|
270
|
-
const opts: SelectOption[] = (colInfo?.options ?? []).map((o) => ({
|
|
271
|
-
value: o.value,
|
|
272
|
-
label: o.label,
|
|
273
|
-
}))
|
|
274
|
-
return (
|
|
275
|
-
<Select
|
|
276
|
-
size="sm"
|
|
277
|
-
options={opts}
|
|
278
|
-
value={String(value ?? '')}
|
|
279
|
-
onChange={(v) => onChange(v)}
|
|
280
|
-
placeholder="選擇值"
|
|
281
|
-
aria-label={ariaLabel}
|
|
282
|
-
className={className}
|
|
283
|
-
/>
|
|
284
|
-
)
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
case 'select_multi': {
|
|
288
|
-
const opts = (colInfo?.options ?? []).map((o) => ({
|
|
289
|
-
value: o.value,
|
|
290
|
-
label: o.label,
|
|
291
|
-
}))
|
|
292
|
-
const arr = Array.isArray(value) ? (value as string[]) : []
|
|
293
|
-
return (
|
|
294
|
-
<Combobox
|
|
295
|
-
size="sm"
|
|
296
|
-
options={opts}
|
|
297
|
-
value={arr}
|
|
298
|
-
onChange={(v) => onChange(v)}
|
|
299
|
-
placeholder="選擇值…"
|
|
300
|
-
aria-label={ariaLabel}
|
|
301
|
-
className={className}
|
|
302
|
-
/>
|
|
303
|
-
)
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
case 'datetime_single':
|
|
307
|
-
return (
|
|
308
|
-
<DatePicker
|
|
309
|
-
size="sm"
|
|
310
|
-
showTime
|
|
311
|
-
value={typeof value === 'string' ? value : null}
|
|
312
|
-
onChange={(v) => onChange(v ?? '')}
|
|
313
|
-
aria-label={ariaLabel}
|
|
314
|
-
className={className}
|
|
315
|
-
/>
|
|
316
|
-
)
|
|
317
|
-
|
|
318
|
-
case 'datetime_range':
|
|
319
|
-
return (
|
|
320
|
-
<DatePickerRange
|
|
321
|
-
size="sm"
|
|
322
|
-
showTime
|
|
323
|
-
value={Array.isArray(value) && value.length === 2
|
|
324
|
-
? (value as [string | null, string | null])
|
|
325
|
-
: null}
|
|
326
|
-
onChange={(v) => onChange(v)}
|
|
327
|
-
aria-label={ariaLabel}
|
|
328
|
-
className={className}
|
|
329
|
-
/>
|
|
330
|
-
)
|
|
331
|
-
|
|
332
|
-
// person_single / person_multi — 走 PeoplePicker(2026-05-07 升級,對齊 cell-registry SSOT)。
|
|
333
|
-
// colInfo.people 來自 column meta.people。Filter value:
|
|
334
|
-
// - person_single:存 PersonValue | null(picker emit array,我們取 [0])
|
|
335
|
-
// - person_multi:存 PersonValue[]
|
|
336
|
-
case 'person_single': {
|
|
337
|
-
const v = value as PersonValue | null | undefined
|
|
338
|
-
return (
|
|
339
|
-
<PeoplePicker
|
|
340
|
-
size="sm"
|
|
341
|
-
value={v ?? null}
|
|
342
|
-
people={colInfo?.people ?? []}
|
|
343
|
-
onChange={(next) => onChange(next[0] ?? null)}
|
|
344
|
-
aria-label={ariaLabel}
|
|
345
|
-
className={className}
|
|
346
|
-
/>
|
|
347
|
-
)
|
|
348
|
-
}
|
|
349
|
-
case 'person_multi': {
|
|
350
|
-
const v = Array.isArray(value) ? (value as PersonValue[]) : []
|
|
351
|
-
return (
|
|
352
|
-
<PeoplePicker
|
|
353
|
-
size="sm"
|
|
354
|
-
value={v}
|
|
355
|
-
people={colInfo?.people ?? []}
|
|
356
|
-
onChange={(next) => onChange(next)}
|
|
357
|
-
aria-label={ariaLabel}
|
|
358
|
-
className={className}
|
|
359
|
-
/>
|
|
360
|
-
)
|
|
361
|
-
}
|
|
362
|
-
default:
|
|
363
|
-
return null
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
126
|
// ── Component Props ─────────────────────────────────────────────────────
|
|
368
127
|
|
|
369
128
|
export interface DataTableFilterPanelProps<TData> {
|
|
370
|
-
|
|
371
|
-
mode
|
|
129
|
+
// 2026-07-18 決策17:移除獨立 `mode` prop(單一真相源 = `value.mode` discriminant)——
|
|
130
|
+
// 舊設計 mode + value.mode 兩來源型別允許矛盾(mode='nested' 配 flat value → CTA 錯文案 + 死操作);
|
|
131
|
+
// 無外部消費者傳 mode(grep 0),全由 value.mode 推導。對齊 MUI X GridFilterModel / AG Grid 單一 model。
|
|
372
132
|
/** 可被 filter 的 columns */
|
|
373
133
|
columns: ColumnDef<TData, any>[]
|
|
374
134
|
/** 當前 FilterTree(controlled) */
|
|
@@ -392,7 +152,6 @@ export interface DataTableFilterPanelProps<TData> {
|
|
|
392
152
|
|
|
393
153
|
// 內部 fn — generic + ref 轉發。export 走 cast(對齊 DataTable 同 pattern)
|
|
394
154
|
function DataTableFilterPanelInner<TData>({
|
|
395
|
-
mode,
|
|
396
155
|
columns,
|
|
397
156
|
value,
|
|
398
157
|
onChange,
|
|
@@ -555,7 +314,7 @@ function DataTableFilterPanelInner<TData>({
|
|
|
555
314
|
// 必加 `min-h-0` 才能讓 panel 在 PopoverContent max-h cap 下正確 shrink + body scroll。
|
|
556
315
|
<div ref={ref} className={cn(
|
|
557
316
|
'flex flex-col h-full min-h-0',
|
|
558
|
-
mode === 'nested'
|
|
317
|
+
value.mode === 'nested'
|
|
559
318
|
? 'w-[min(760px,calc(100vw-2rem))]'
|
|
560
319
|
: 'w-[min(640px,calc(100vw-2rem))]',
|
|
561
320
|
className,
|
|
@@ -628,9 +387,9 @@ function DataTableFilterPanelInner<TData>({
|
|
|
628
387
|
<div>
|
|
629
388
|
<Button
|
|
630
389
|
variant="tertiary" size="sm" startIcon={Plus}
|
|
631
|
-
onClick={mode === 'flat' ? addFlatCondition : addGroup}
|
|
390
|
+
onClick={value.mode === 'flat' ? addFlatCondition : addGroup}
|
|
632
391
|
>
|
|
633
|
-
{mode === 'nested' ? '加入篩選器' : '加篩選'}
|
|
392
|
+
{value.mode === 'nested' ? '加入篩選器' : '加篩選'}
|
|
634
393
|
</Button>
|
|
635
394
|
</div>
|
|
636
395
|
</SurfaceBody>
|
|
@@ -644,179 +403,3 @@ export const DataTableFilterPanel = React.forwardRef(DataTableFilterPanelInner)
|
|
|
644
403
|
props: DataTableFilterPanelProps<TData> & { ref?: React.ForwardedRef<HTMLDivElement> }
|
|
645
404
|
) => React.ReactElement
|
|
646
405
|
;(DataTableFilterPanel as { displayName?: string }).displayName = 'DataTableFilterPanel'
|
|
647
|
-
|
|
648
|
-
// ── ConjunctionLabel ───────────────────────────────────────────────────
|
|
649
|
-
|
|
650
|
-
const CONJ_OPTIONS: SelectOption[] = [
|
|
651
|
-
{ value: 'and', label: 'And' },
|
|
652
|
-
{ value: 'or', label: 'Or' },
|
|
653
|
-
]
|
|
654
|
-
|
|
655
|
-
function ConjunctionLabel({
|
|
656
|
-
index, conjunction, onChange,
|
|
657
|
-
}: { index: number; conjunction: Conjunction; onChange: (c: Conjunction) => void }) {
|
|
658
|
-
// index === 0:首 row 顯示靜態「Where」label
|
|
659
|
-
// index === 1:**唯一可改**的 AND/OR Select(連動整 group conjunction)
|
|
660
|
-
// index ≥ 2:被連動的 row,read-only 顯示當前 conjunction 文字(同 Where 視覺,A6 canonical)
|
|
661
|
-
// 對齊 Airtable / Notion / Linear 共識 @benchmark-unverified(non-OSS)
|
|
662
|
-
// px-[var(--field-px)] 對齊 Field 內部 padding 12px(Q13)
|
|
663
|
-
if (index === 0) {
|
|
664
|
-
return <div className="w-20 shrink-0 text-body text-fg-muted px-[var(--field-px)] self-center">Where</div>
|
|
665
|
-
}
|
|
666
|
-
if (index >= 2) {
|
|
667
|
-
const label = conjunction === 'and' ? 'And' : 'Or'
|
|
668
|
-
return <div className="w-20 shrink-0 text-body text-fg-muted px-[var(--field-px)] self-center">{label}</div>
|
|
669
|
-
}
|
|
670
|
-
// index === 1:可切換的 AND/OR Select
|
|
671
|
-
// minRows={2} — And/Or 2 選項,顯式縮 menu 高度避免 reserve 3 row 空白(Q5)
|
|
672
|
-
return (
|
|
673
|
-
<div className="w-20 shrink-0">
|
|
674
|
-
<Select
|
|
675
|
-
size="sm"
|
|
676
|
-
options={CONJ_OPTIONS}
|
|
677
|
-
value={conjunction}
|
|
678
|
-
onChange={(v) => onChange(v as Conjunction)}
|
|
679
|
-
minRows={2}
|
|
680
|
-
aria-label="連接詞 — 同 group 共用"
|
|
681
|
-
/>
|
|
682
|
-
</div>
|
|
683
|
-
)
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
// ── FilterRow(flat 用 + group 內共用) ──────────────────────────────
|
|
687
|
-
|
|
688
|
-
function FilterRow({
|
|
689
|
-
index, condition, conjunction, filterableColumns, fieldOptions,
|
|
690
|
-
onChangeConjunction, onChangeField, onChangeOp, onChangeValue, onRemove,
|
|
691
|
-
}: {
|
|
692
|
-
index: number
|
|
693
|
-
condition: FilterCondition
|
|
694
|
-
conjunction: Conjunction
|
|
695
|
-
filterableColumns: FilterColumn[]
|
|
696
|
-
fieldOptions: SelectOption[]
|
|
697
|
-
onChangeConjunction: (c: Conjunction) => void
|
|
698
|
-
onChangeField: (v: string) => void
|
|
699
|
-
onChangeOp: (v: string) => void
|
|
700
|
-
onChangeValue: (v: unknown) => void
|
|
701
|
-
onRemove: () => void
|
|
702
|
-
}) {
|
|
703
|
-
const colInfo = filterableColumns.find((c) => c.id === condition.field)
|
|
704
|
-
const operatorOptions = getOperatorOptions(colInfo?.type)
|
|
705
|
-
const hasField = !!condition.field
|
|
706
|
-
const opSpec = colInfo ? getOperatorSpec(colInfo.type, condition.op) : null
|
|
707
|
-
const valueShape: ValueShape | null = colInfo && opSpec
|
|
708
|
-
? getValueShape(opSpec, colInfo.type, colInfo.includeTime)
|
|
709
|
-
: null
|
|
710
|
-
// op 'is_set' / 'is_not_set' 等 shape='none' → 無 value cell,op 自動 expand 填剩餘寬
|
|
711
|
-
// 對齊 Notion / Airtable / Linear filter row 行為
|
|
712
|
-
// 注意:valueShape=null(初始無 field 選)時仍 render value cell(disabled placeholder)— 只 'none' 才 fold
|
|
713
|
-
const hasValueCell = valueShape !== 'none'
|
|
714
|
-
|
|
715
|
-
// FieldControlGroup 接合 field + op + value 視覺(2026-05-04 E refactor + 多輪 fix):
|
|
716
|
-
// - border collapse 取代 3 顆獨立 Select 並排,對齊 Airtable / Linear / Notion filter row idiom
|
|
717
|
-
// - ConjunctionLabel + Trash 在 group 外層(meta actions,不屬 control 一體)
|
|
718
|
-
// - **#5 fix**:row 內水平 gap = `gap-2` (8px),layoutSpace 規則 5 緊密相關
|
|
719
|
-
// - **#9 fix**:cell 用 `min-w-[]`(field 160 / op 120),value flex-1 min-w-0,讓 long label 可撐寬
|
|
720
|
-
// - **#2 fix**:FilterValuePicker 直接是 FieldControlGroup direct child(無 wrapper div),CSS variants 命中正確
|
|
721
|
-
return (
|
|
722
|
-
<div className="flex items-center gap-2">
|
|
723
|
-
<ConjunctionLabel index={index} conjunction={conjunction} onChange={onChangeConjunction} />
|
|
724
|
-
{/* **#9 fix(2026-05-04 v4)**:Field controls trigger `w-full` override 外 className,改用 Tailwind `!`
|
|
725
|
-
important 強制 override(`!w-[160px]` / `!w-[120px]`),value 用 `!flex-1 !min-w-0`。
|
|
726
|
-
Select 元件本身沒 destructure `style` prop 所以 inline style flex-basis 行不通,只能用 className。 */}
|
|
727
|
-
<FieldControlGroup block className="flex-1 min-w-0">
|
|
728
|
-
{/* 2026-05-23 Phase A.4 Decision 2:`!w-[160px]` / `!w-[120px]` → tokens
|
|
729
|
-
`--data-table-filter-field-width` / `--data-table-filter-op-width`(SSOT in uiSize.css)
|
|
730
|
-
Behavior preserved 完好如初:flat + nested 同 width(token 是 design constant) */}
|
|
731
|
-
<Select
|
|
732
|
-
className="!w-[var(--data-table-filter-field-width)] flex-shrink-0"
|
|
733
|
-
size="sm"
|
|
734
|
-
options={fieldOptions}
|
|
735
|
-
value={condition.field}
|
|
736
|
-
onChange={onChangeField}
|
|
737
|
-
placeholder="選擇欄位"
|
|
738
|
-
aria-label="篩選欄位"
|
|
739
|
-
/>
|
|
740
|
-
<Select
|
|
741
|
-
className={hasValueCell ? '!w-[var(--data-table-filter-op-width)] flex-shrink-0' : '!flex-1 !min-w-0'}
|
|
742
|
-
size="sm"
|
|
743
|
-
options={operatorOptions}
|
|
744
|
-
value={condition.op}
|
|
745
|
-
onChange={onChangeOp}
|
|
746
|
-
disabled={!hasField}
|
|
747
|
-
placeholder="運算子"
|
|
748
|
-
aria-label="篩選運算子"
|
|
749
|
-
/>
|
|
750
|
-
{hasValueCell && (
|
|
751
|
-
<FilterValuePicker
|
|
752
|
-
shape={valueShape}
|
|
753
|
-
value={condition.value}
|
|
754
|
-
onChange={onChangeValue}
|
|
755
|
-
colInfo={colInfo}
|
|
756
|
-
disabled={!hasField}
|
|
757
|
-
ariaLabel={colInfo ? `${colInfo.label} 篩選值` : '篩選值'}
|
|
758
|
-
className="!flex-1 !min-w-0"
|
|
759
|
-
/>
|
|
760
|
-
)}
|
|
761
|
-
</FieldControlGroup>
|
|
762
|
-
{/* Trash 用 text Button — filter row 是 form-control row,Field 同高對齊(28 md) */}
|
|
763
|
-
<Button variant="text" size="sm" iconOnly startIcon={Trash2} aria-label="刪除" onClick={onRemove} />
|
|
764
|
-
</div>
|
|
765
|
-
)
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
// ── GroupBlock(nested 用) ────────────────────────────────────────────
|
|
769
|
-
|
|
770
|
-
function GroupBlock({
|
|
771
|
-
index, group, rootConjunction, filterableColumns, fieldOptions,
|
|
772
|
-
onChangeRootConjunction, onChangeGroupConjunction,
|
|
773
|
-
onChangeCondition, onRemoveCondition, onAddCondition, onRemoveGroup,
|
|
774
|
-
}: {
|
|
775
|
-
index: number
|
|
776
|
-
group: FilterGroup
|
|
777
|
-
rootConjunction: Conjunction
|
|
778
|
-
filterableColumns: FilterColumn[]
|
|
779
|
-
fieldOptions: SelectOption[]
|
|
780
|
-
onChangeRootConjunction: (c: Conjunction) => void
|
|
781
|
-
onChangeGroupConjunction: (c: Conjunction) => void
|
|
782
|
-
onChangeCondition: (condId: string, patch: Partial<FilterCondition>) => void
|
|
783
|
-
onRemoveCondition: (condId: string) => void
|
|
784
|
-
onAddCondition: () => void
|
|
785
|
-
onRemoveGroup: () => void
|
|
786
|
-
}) {
|
|
787
|
-
return (
|
|
788
|
-
<div className="flex items-start gap-2">
|
|
789
|
-
<div className="pt-2">
|
|
790
|
-
<ConjunctionLabel index={index} conjunction={rootConjunction} onChange={onChangeRootConjunction} />
|
|
791
|
-
</div>
|
|
792
|
-
{/* Group container 灰底 — `bg-muted`(`--muted` neutral-2,user 2026-05-09 拍板 Q3 A)。對齊 color.spec.md L651-654 「table header / tab / code block / skeleton」靜態低重要 surface semantic */}
|
|
793
|
-
<div className="flex-1 min-w-0 rounded-md bg-muted p-2 flex flex-col gap-2">
|
|
794
|
-
{group.children.map((cond, cIdx) => (
|
|
795
|
-
<FilterRow
|
|
796
|
-
key={cond.id}
|
|
797
|
-
index={cIdx}
|
|
798
|
-
condition={cond}
|
|
799
|
-
conjunction={group.conjunction}
|
|
800
|
-
filterableColumns={filterableColumns}
|
|
801
|
-
fieldOptions={fieldOptions}
|
|
802
|
-
onChangeConjunction={onChangeGroupConjunction}
|
|
803
|
-
onChangeField={(v) => {
|
|
804
|
-
const newCol = filterableColumns.find((c) => c.id === v)
|
|
805
|
-
onChangeCondition(cond.id, { field: v, op: getDefaultOperator(newCol?.type), value: '', datePrecision: datePrecisionOf(newCol) })
|
|
806
|
-
}}
|
|
807
|
-
onChangeOp={(v) => onChangeCondition(cond.id, { op: v, value: '' })}
|
|
808
|
-
onChangeValue={(v) => onChangeCondition(cond.id, { value: v })}
|
|
809
|
-
onRemove={() => onRemoveCondition(cond.id)}
|
|
810
|
-
/>
|
|
811
|
-
))}
|
|
812
|
-
{/* Q9 — text variant 對齊 inline 派 + 視覺輕量 */}
|
|
813
|
-
<div className="flex items-center justify-between">
|
|
814
|
-
<Button variant="text" size="sm" startIcon={Plus} onClick={onAddCondition}>加入巢狀篩選</Button>
|
|
815
|
-
{group.children.length === 0 && (
|
|
816
|
-
<Button variant="text" size="sm" startIcon={Trash2} danger onClick={onRemoveGroup}>移除空群組</Button>
|
|
817
|
-
)}
|
|
818
|
-
</div>
|
|
819
|
-
</div>
|
|
820
|
-
</div>
|
|
821
|
-
)
|
|
822
|
-
}
|