@qijenchen/design-system 0.1.0-beta.82 → 0.1.0-beta.84
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/CLAUDE.md +8 -8
- package/README.md +3 -2
- package/dist/components/Alert/alert.js.map +1 -1
- package/dist/components/AppShell/_demo-helpers.d.ts.map +1 -1
- package/dist/components/AppShell/app-shell.d.ts +1 -1
- package/dist/components/AppShell/app-shell.d.ts.map +1 -1
- package/dist/components/AppShell/app-shell.js +22 -2
- package/dist/components/AppShell/app-shell.js.map +1 -1
- package/dist/components/Avatar/avatar.d.ts.map +1 -1
- package/dist/components/Avatar/avatar.js +4 -4
- package/dist/components/Avatar/avatar.js.map +1 -1
- package/dist/components/Breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/Breadcrumb/breadcrumb.js +1 -1
- package/dist/components/Breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/Button/button.d.ts +2 -2
- package/dist/components/Button/button.d.ts.map +1 -1
- package/dist/components/Button/button.js +12 -3
- package/dist/components/Button/button.js.map +1 -1
- package/dist/components/Calendar/calendar.d.ts +13 -5
- package/dist/components/Calendar/calendar.d.ts.map +1 -1
- package/dist/components/Calendar/calendar.js +7 -1
- package/dist/components/Calendar/calendar.js.map +1 -1
- package/dist/components/Carousel/carousel.d.ts.map +1 -1
- package/dist/components/Carousel/carousel.js +8 -3
- package/dist/components/Carousel/carousel.js.map +1 -1
- package/dist/components/Chart/chart.d.ts.map +1 -1
- package/dist/components/Chart/chart.js +1 -0
- package/dist/components/Chart/chart.js.map +1 -1
- package/dist/components/Checkbox/checkbox.d.ts +1 -1
- package/dist/components/Checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox/checkbox.js +8 -4
- package/dist/components/Checkbox/checkbox.js.map +1 -1
- package/dist/components/Chip/chip.d.ts +1 -1
- package/dist/components/Chip/chip.d.ts.map +1 -1
- package/dist/components/Chip/chip.js.map +1 -1
- package/dist/components/Coachmark/coachmark.d.ts +10 -3
- package/dist/components/Coachmark/coachmark.d.ts.map +1 -1
- package/dist/components/Coachmark/coachmark.js.map +1 -1
- package/dist/components/Combobox/combobox.d.ts +5 -1
- package/dist/components/Combobox/combobox.d.ts.map +1 -1
- package/dist/components/Combobox/combobox.js +30 -13
- package/dist/components/Combobox/combobox.js.map +1 -1
- package/dist/components/DataTable/cell-registry.d.ts.map +1 -1
- package/dist/components/DataTable/cell-registry.js +53 -62
- package/dist/components/DataTable/cell-registry.js.map +1 -1
- package/dist/components/DataTable/column-types.d.ts +10 -4
- 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 +1 -1
- package/dist/components/DataTable/data-table-column-visibility-panel.js +183 -0
- package/dist/components/DataTable/data-table-column-visibility-panel.js.map +1 -0
- package/dist/components/DataTable/data-table-filter-panel.d.ts.map +1 -1
- package/dist/components/DataTable/data-table-filter-panel.js +607 -0
- package/dist/components/DataTable/data-table-filter-panel.js.map +1 -0
- package/dist/components/DataTable/data-table-interaction-layer.d.ts +11 -15
- package/dist/components/DataTable/data-table-interaction-layer.d.ts.map +1 -1
- package/dist/components/DataTable/data-table-interaction-layer.js +1 -3
- package/dist/components/DataTable/data-table-interaction-layer.js.map +1 -1
- package/dist/components/DataTable/data-table-sort-manager.js +140 -0
- package/dist/components/DataTable/data-table-sort-manager.js.map +1 -0
- package/dist/components/DataTable/data-table.d.ts +5 -6
- package/dist/components/DataTable/data-table.d.ts.map +1 -1
- package/dist/components/DataTable/data-table.js +36 -15
- package/dist/components/DataTable/data-table.js.map +1 -1
- package/dist/components/DataTable/filter-operators.js +140 -0
- package/dist/components/DataTable/filter-operators.js.map +1 -0
- package/dist/components/DataTable/filter-tree.js +312 -0
- package/dist/components/DataTable/filter-tree.js.map +1 -0
- package/dist/components/DataTable/index.d.ts +3 -0
- package/dist/components/DataTable/index.d.ts.map +1 -1
- package/dist/components/DataTable/index.js +12 -1
- package/dist/components/DataTable/index.js.map +1 -1
- package/dist/components/DataTable/lib/column-meta.js +25 -0
- package/dist/components/DataTable/lib/column-meta.js.map +1 -0
- package/dist/components/DateGrid/date-grid.d.ts.map +1 -1
- package/dist/components/DateGrid/date-grid.js +3 -1
- package/dist/components/DateGrid/date-grid.js.map +1 -1
- package/dist/components/DatePicker/date-picker.d.ts +7 -1
- package/dist/components/DatePicker/date-picker.d.ts.map +1 -1
- package/dist/components/DatePicker/date-picker.js +105 -74
- package/dist/components/DatePicker/date-picker.js.map +1 -1
- package/dist/components/Dialog/dialog.d.ts +20 -3
- package/dist/components/Dialog/dialog.d.ts.map +1 -1
- package/dist/components/Dialog/dialog.js +38 -20
- package/dist/components/Dialog/dialog.js.map +1 -1
- package/dist/components/DropdownMenu/dropdown-menu.d.ts.map +1 -1
- package/dist/components/DropdownMenu/dropdown-menu.js +3 -1
- package/dist/components/DropdownMenu/dropdown-menu.js.map +1 -1
- package/dist/components/Field/field-context.d.ts +45 -5
- package/dist/components/Field/field-context.d.ts.map +1 -1
- package/dist/components/Field/field-context.js +19 -0
- package/dist/components/Field/field-context.js.map +1 -1
- package/dist/components/Field/field-edit-keys.d.ts +21 -0
- package/dist/components/Field/field-edit-keys.d.ts.map +1 -0
- package/dist/components/Field/field-edit-keys.js +19 -0
- package/dist/components/Field/field-edit-keys.js.map +1 -0
- package/dist/components/Field/field-types.d.ts +20 -1
- 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 +3 -2
- package/dist/components/Field/field-wrapper.d.ts.map +1 -1
- package/dist/components/Field/field-wrapper.js +38 -39
- package/dist/components/Field/field-wrapper.js.map +1 -1
- package/dist/components/Field/field.d.ts +2 -1
- package/dist/components/Field/field.d.ts.map +1 -1
- package/dist/components/Field/field.js.map +1 -1
- package/dist/components/FieldControlGroup/field-control-group.d.ts +1 -1
- package/dist/components/FieldControlGroup/field-control-group.js.map +1 -1
- package/dist/components/FileItem/file-item.d.ts.map +1 -1
- package/dist/components/FileItem/file-item.js +1 -1
- package/dist/components/FileItem/file-item.js.map +1 -1
- package/dist/components/FileUpload/file-upload.d.ts +1 -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 +7 -2
- package/dist/components/FileViewer/file-viewer.js.map +1 -1
- package/dist/components/FileViewer/image-renderer.d.ts.map +1 -1
- package/dist/components/FileViewer/image-renderer.js +22 -1
- package/dist/components/FileViewer/image-renderer.js.map +1 -1
- package/dist/components/HoverCard/hover-card.d.ts.map +1 -1
- package/dist/components/HoverCard/hover-card.js +5 -3
- package/dist/components/HoverCard/hover-card.js.map +1 -1
- package/dist/components/InlineEdit/index.d.ts +2 -0
- package/dist/components/InlineEdit/index.d.ts.map +1 -0
- package/dist/components/InlineEdit/index.js +5 -0
- package/dist/components/InlineEdit/index.js.map +1 -0
- package/dist/components/InlineEdit/inline-edit.d.ts +59 -0
- package/dist/components/InlineEdit/inline-edit.d.ts.map +1 -0
- package/dist/components/InlineEdit/inline-edit.js +164 -0
- package/dist/components/InlineEdit/inline-edit.js.map +1 -0
- package/dist/components/Input/input.d.ts +6 -11
- package/dist/components/Input/input.d.ts.map +1 -1
- package/dist/components/Input/input.js +43 -13
- package/dist/components/Input/input.js.map +1 -1
- package/dist/components/LinkInput/link-input.d.ts +2 -2
- package/dist/components/LinkInput/link-input.d.ts.map +1 -1
- package/dist/components/LinkInput/link-input.js +6 -5
- package/dist/components/LinkInput/link-input.js.map +1 -1
- package/dist/components/Menu/menu-item.d.ts +14 -2
- package/dist/components/Menu/menu-item.d.ts.map +1 -1
- package/dist/components/Menu/menu-item.js +25 -3
- package/dist/components/Menu/menu-item.js.map +1 -1
- package/dist/components/NumberInput/number-input.d.ts +3 -3
- package/dist/components/NumberInput/number-input.d.ts.map +1 -1
- package/dist/components/NumberInput/number-input.js +6 -5
- package/dist/components/NumberInput/number-input.js.map +1 -1
- package/dist/components/OverflowIndicator/overflow-indicator.d.ts.map +1 -1
- package/dist/components/OverflowIndicator/overflow-indicator.js +2 -6
- package/dist/components/OverflowIndicator/overflow-indicator.js.map +1 -1
- package/dist/components/Pagination/pagination.js +1 -1
- package/dist/components/Pagination/pagination.js.map +1 -1
- package/dist/components/PeoplePicker/index.js +7 -1
- package/dist/components/PeoplePicker/index.js.map +1 -1
- package/dist/components/PeoplePicker/people-picker.d.ts +9 -2
- package/dist/components/PeoplePicker/people-picker.d.ts.map +1 -1
- package/dist/components/PeoplePicker/people-picker.js +23 -10
- package/dist/components/PeoplePicker/people-picker.js.map +1 -1
- package/dist/components/PeoplePicker/person-display.d.ts +6 -3
- package/dist/components/PeoplePicker/person-display.d.ts.map +1 -1
- package/dist/components/PeoplePicker/person-display.js +19 -14
- package/dist/components/PeoplePicker/person-display.js.map +1 -1
- package/dist/components/Popover/popover.d.ts.map +1 -1
- package/dist/components/Popover/popover.js +3 -1
- package/dist/components/Popover/popover.js.map +1 -1
- package/dist/components/ProfileCard/profile-card.d.ts +2 -2
- package/dist/components/ProfileCard/profile-card.js +3 -3
- package/dist/components/ProfileCard/profile-card.js.map +1 -1
- package/dist/components/RadioGroup/radio-group.d.ts.map +1 -1
- package/dist/components/RadioGroup/radio-group.js +15 -9
- package/dist/components/RadioGroup/radio-group.js.map +1 -1
- package/dist/components/ScrollArea/scroll-area.d.ts +11 -1
- package/dist/components/ScrollArea/scroll-area.d.ts.map +1 -1
- package/dist/components/ScrollArea/scroll-area.js +6 -3
- package/dist/components/ScrollArea/scroll-area.js.map +1 -1
- package/dist/components/Select/select.d.ts +46 -5
- package/dist/components/Select/select.d.ts.map +1 -1
- package/dist/components/Select/select.js +109 -28
- package/dist/components/Select/select.js.map +1 -1
- package/dist/components/SelectMenu/select-menu.d.ts +3 -1
- package/dist/components/SelectMenu/select-menu.d.ts.map +1 -1
- package/dist/components/SelectMenu/select-menu.js +8 -1
- package/dist/components/SelectMenu/select-menu.js.map +1 -1
- package/dist/components/SelectionControl/boolean-value.d.ts +11 -0
- package/dist/components/SelectionControl/boolean-value.d.ts.map +1 -0
- package/dist/components/SelectionControl/boolean-value.js +23 -0
- package/dist/components/SelectionControl/boolean-value.js.map +1 -0
- package/dist/components/SelectionControl/index.d.ts +1 -0
- package/dist/components/SelectionControl/index.d.ts.map +1 -1
- package/dist/components/SelectionControl/index.js +2 -0
- package/dist/components/SelectionControl/index.js.map +1 -1
- package/dist/components/Sheet/index.js +2 -1
- package/dist/components/Sheet/sheet.d.ts +7 -1
- package/dist/components/Sheet/sheet.d.ts.map +1 -1
- package/dist/components/Sheet/sheet.js +5 -2
- package/dist/components/Sheet/sheet.js.map +1 -1
- package/dist/components/Sidebar/sidebar.d.ts +9 -4
- package/dist/components/Sidebar/sidebar.d.ts.map +1 -1
- package/dist/components/Sidebar/sidebar.js +8 -10
- 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.map +1 -1
- package/dist/components/Switch/switch.d.ts +6 -6
- package/dist/components/Switch/switch.d.ts.map +1 -1
- package/dist/components/Switch/switch.js +3 -2
- package/dist/components/Switch/switch.js.map +1 -1
- package/dist/components/Tabs/tabs.d.ts.map +1 -1
- package/dist/components/Tabs/tabs.js +15 -1
- package/dist/components/Tabs/tabs.js.map +1 -1
- package/dist/components/Textarea/textarea.d.ts +2 -2
- package/dist/components/Textarea/textarea.d.ts.map +1 -1
- package/dist/components/Textarea/textarea.js +50 -42
- package/dist/components/Textarea/textarea.js.map +1 -1
- package/dist/components/TimePicker/time-columns.d.ts.map +1 -1
- package/dist/components/TimePicker/time-columns.js +42 -38
- package/dist/components/TimePicker/time-columns.js.map +1 -1
- package/dist/components/TimePicker/time-picker.d.ts.map +1 -1
- package/dist/components/TimePicker/time-picker.js +8 -6
- 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 +7 -5
- package/dist/components/Tooltip/tooltip.js.map +1 -1
- package/dist/components/TreeView/tree-view.d.ts +56 -1
- package/dist/components/TreeView/tree-view.d.ts.map +1 -1
- package/dist/components/TreeView/tree-view.js +211 -12
- package/dist/components/TreeView/tree-view.js.map +1 -1
- package/dist/index.d.ts +115 -58
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +93 -108
- package/dist/index.js.map +1 -1
- package/dist/patterns/element-anatomy/item-anatomy.d.ts +7 -6
- package/dist/patterns/element-anatomy/item-anatomy.d.ts.map +1 -1
- package/dist/patterns/element-anatomy/item-anatomy.js.map +1 -1
- package/dist/tokens/categorical-color.js +15 -0
- package/dist/tokens/categorical-color.js.map +1 -1
- package/dist/tokens/motion/motion.d.ts +7 -6
- package/dist/tokens/motion/motion.d.ts.map +1 -1
- package/dist/tokens/motion/motion.js +6 -6
- package/dist/tokens/motion/motion.js.map +1 -1
- package/dist/tokens/motion/overlay-motion.d.ts +19 -0
- package/dist/tokens/motion/overlay-motion.d.ts.map +1 -0
- package/dist/tokens/motion/overlay-motion.js +9 -0
- package/dist/tokens/motion/overlay-motion.js.map +1 -0
- package/dist/tokens/uiSize/icon-size.js +5 -0
- package/dist/tokens/uiSize/icon-size.js.map +1 -0
- package/ds-canonical/fork/governance.lock +37 -19
- package/ds-canonical/fork/hooks/_log-fire.sh +46 -0
- package/ds-canonical/fork/hooks/block_prototype_imports.py +15 -4
- package/ds-canonical/fork/hooks/check_consumer_app_invariants.sh +145 -13
- package/ds-canonical/fork/hooks/check_ds_anchor_preflight.sh +17 -5
- package/ds-canonical/fork/hooks/check_dynamic_tailwind_class.sh +47 -0
- package/ds-canonical/fork/hooks/check_escape_marker_abuse.sh +27 -0
- package/ds-canonical/fork/hooks/check_field_family_invariants.sh +61 -1
- package/ds-canonical/fork/hooks/check_layout_space_magic_numbers.sh +28 -4
- package/ds-canonical/fork/hooks/check_opacity_token_usage.sh +36 -0
- package/ds-canonical/fork/hooks/check_story_determinism.sh +39 -0
- package/ds-canonical/fork/hooks/check_story_invariants.sh +119 -0
- package/ds-canonical/fork/hooks/check_tabs_content_chrome_body_double_gap.sh +29 -0
- package/ds-canonical/fork/manifest.json +20 -0
- package/ds-canonical/fork/preamble.md +22 -18
- package/ds-canonical/fork/skills/bug-fix-rhythm/SKILL.md +9 -3
- package/ds-canonical/fork/skills/code-quality-audit/SKILL.md +3 -3
- package/ds-canonical/fork/skills/delivery-handoff/SKILL.md +7 -0
- package/ds-canonical/fork/skills/performance-audit/SKILL.md +4 -2
- package/ds-canonical/fork/skills/product-ui-audit/SKILL.md +3 -3
- package/ds-canonical/fork/skills/propose-options/SKILL.md +3 -3
- package/ds-canonical/fork/skills/prototype/SKILL.md +1 -1
- package/ds-canonical/fork/skills/scan-similar-bugs/SKILL.md +2 -2
- package/ds-canonical/fork/skills/visual-audit/SKILL.md +10 -2
- package/ds-canonical/hooks/README.md +1 -1
- package/ds-canonical/hooks/block_prototype_imports.py +15 -4
- package/ds-canonical/hooks/check_audit_post_report_validator.sh +65 -7
- package/ds-canonical/hooks/check_benchmark_citation.sh +5 -3
- package/ds-canonical/hooks/check_codex_brief_invariants.sh +28 -1
- package/ds-canonical/hooks/check_consumer_app_invariants.sh +145 -13
- package/ds-canonical/hooks/check_ds_anchor_preflight.sh +17 -5
- package/ds-canonical/hooks/check_dynamic_tailwind_class.sh +47 -0
- package/ds-canonical/hooks/check_escape_marker_abuse.sh +27 -0
- package/ds-canonical/hooks/check_field_family_invariants.sh +61 -1
- package/ds-canonical/hooks/check_layout_space_magic_numbers.sh +28 -4
- package/ds-canonical/hooks/check_naming_and_abstraction.sh +1 -1
- package/ds-canonical/hooks/check_opacity_token_usage.sh +36 -0
- package/ds-canonical/hooks/check_pixel_quantified_audit.sh +3 -2
- package/ds-canonical/hooks/check_post_main_ssot_propagate.sh +6 -1
- package/ds-canonical/hooks/check_propose_without_benchmark.sh +6 -2
- package/ds-canonical/hooks/check_ssot_header_declaration.sh +55 -0
- package/ds-canonical/hooks/check_story_determinism.sh +39 -0
- package/ds-canonical/hooks/check_substantive_edit_approval_preflight.sh +8 -7
- package/ds-canonical/hooks/check_tabs_content_chrome_body_double_gap.sh +29 -0
- package/ds-canonical/hooks/lib/_story_compile_drift.sh +1 -1
- package/ds-canonical/hooks/lib/_token_hygiene.sh +10 -1
- package/ds-canonical/hooks/stop_self_audit.sh +31 -0
- package/ds-canonical/hooks/tests/test_block_prototype_imports.sh +24 -0
- package/ds-canonical/hooks/tests/test_check_audit_post_report_validator.sh +44 -0
- package/ds-canonical/hooks/tests/test_check_benchmark_citation.sh +3 -3
- package/ds-canonical/hooks/tests/test_check_codex_brief_invariants.sh +43 -2
- package/ds-canonical/hooks/tests/test_check_consumer_ds_primitive_misuse.sh +112 -0
- package/ds-canonical/hooks/tests/test_check_consumer_story_baseline.sh +9 -2
- package/ds-canonical/hooks/tests/test_check_dynamic_tailwind_class.sh +76 -0
- package/ds-canonical/hooks/tests/test_check_escape_marker_abuse.sh +24 -0
- package/ds-canonical/hooks/tests/test_check_field_family_invariants.sh +27 -2
- package/ds-canonical/hooks/tests/test_check_fork_user_plugin_install.sh +3 -1
- package/ds-canonical/hooks/tests/test_check_opacity_token_usage.sh +41 -2
- package/ds-canonical/hooks/tests/test_check_ssot_header_declaration.sh +72 -0
- package/ds-canonical/hooks/tests/test_check_tabs_content_chrome_body_double_gap.sh +76 -0
- package/ds-canonical/references/audit-coverage-vs-24-checklist.md +1 -1
- package/ds-canonical/references/build-ui-canonicals.md +2 -1
- package/ds-canonical/references/failure-class-registry.json +145 -0
- package/ds-canonical/references/governance-audit-coverage.md +33 -0
- package/ds-canonical/references/item-anatomy-recipe.md +2 -2
- package/ds-canonical/references/scenario-definition.md +6 -9
- package/ds-canonical/references/ssot-consultation.md +2 -2
- package/ds-canonical/references/ssot-index.md +5 -4
- package/ds-canonical/references/story-baseline-registry.json +8 -2
- package/ds-canonical/references/structural-token-retention.md +6 -9
- package/ds-canonical/rules/meta-patterns.md +8 -8
- package/ds-canonical/rules/self-verify.md +4 -3
- package/ds-canonical/rules/spec-rules.md +1 -1
- package/ds-canonical/rules/story-rules.md +2 -2
- package/ds-canonical/rules/ui-development.md +4 -2
- package/ds-canonical/skills/bug-fix-rhythm/SKILL.md +9 -3
- package/ds-canonical/skills/code-quality-audit/SKILL.md +3 -3
- package/ds-canonical/skills/codex-collab/SKILL.md +9 -7
- package/ds-canonical/skills/codex-collab/references/brief-template.md +1 -1
- package/ds-canonical/skills/codify-principle/SKILL.md +2 -2
- package/ds-canonical/skills/component-quality-gate/SKILL.md +1 -1
- package/ds-canonical/skills/component-quality-gate/references/checklist.md +2 -2
- package/ds-canonical/skills/deep-audit-cross-codex/SKILL.md +57 -68
- package/ds-canonical/skills/deep-audit-cross-codex/references/phase-a-workflow.md +29 -0
- package/ds-canonical/skills/deep-audit-cross-codex/references/phase-b-codex-brief.md +29 -10
- package/ds-canonical/skills/deep-audit-cross-codex/references/triage-rubric.md +21 -0
- package/ds-canonical/skills/delivery-handoff/SKILL.md +5 -0
- package/ds-canonical/skills/design-system-audit/SKILL.md +27 -26
- package/ds-canonical/skills/design-system-audit/references/audit-prompts.md +13 -1
- package/ds-canonical/skills/design-system-audit/references/rule-placement.md +1 -1
- package/ds-canonical/skills/governance-health/SKILL.md +2 -1
- package/ds-canonical/skills/knowledge-prune/SKILL.md +3 -0
- package/ds-canonical/skills/knowledge-prune/references/prune-dimensions-d5-d10.md +1 -0
- package/ds-canonical/skills/new-component/SKILL.md +7 -5
- package/ds-canonical/skills/new-component/references/new-component-checklist.md +1 -1
- package/ds-canonical/skills/performance-audit/SKILL.md +2 -2
- package/ds-canonical/skills/product-ui-audit/SKILL.md +3 -3
- package/ds-canonical/skills/propose-options/SKILL.md +3 -3
- package/ds-canonical/skills/prototype/SKILL.md +1 -1
- package/ds-canonical/skills/scan-similar-bugs/SKILL.md +2 -2
- package/ds-canonical/skills/story-auto-compile-migrate/SKILL.md +3 -3
- package/ds-canonical/skills/story-writing/SKILL.md +3 -3
- package/ds-canonical/skills/visual-audit/SKILL.md +10 -2
- package/ds-story-manifest.json +29 -20
- package/llms-full.txt +22 -1
- package/llms.txt +5 -4
- package/package.json +7 -3
- package/src/components/Accordion/accordion.principles.stories.tsx +1 -1
- package/src/components/Accordion/accordion.stories.tsx +16 -1
- package/src/components/Alert/alert.principles.stories.tsx +1 -1
- package/src/components/Alert/alert.spec.md +8 -10
- package/src/components/Alert/alert.stories.tsx +28 -28
- package/src/components/Alert/alert.tsx +1 -1
- package/src/components/AppShell/_demo-helpers.tsx +6 -3
- package/src/components/AppShell/app-shell.spec.md +4 -4
- package/src/components/AppShell/app-shell.tsx +28 -2
- package/src/components/AspectRatio/aspect-ratio.spec.md +1 -1
- package/src/components/AspectRatio/aspect-ratio.stories.tsx +7 -89
- package/src/components/Avatar/avatar.anatomy.stories.tsx +7 -3
- package/src/components/Avatar/avatar.principles.stories.tsx +19 -15
- package/src/components/Avatar/avatar.spec.md +2 -2
- package/src/components/Avatar/avatar.stories.tsx +8 -6
- package/src/components/Avatar/avatar.tsx +13 -5
- package/src/components/Badge/badge.principles.stories.tsx +1 -1
- package/src/components/Badge/badge.spec.md +2 -0
- package/src/components/Badge/badge.stories.tsx +4 -2
- package/src/components/Breadcrumb/breadcrumb.principles.stories.tsx +6 -4
- package/src/components/Breadcrumb/breadcrumb.stories.tsx +6 -5
- package/src/components/Breadcrumb/breadcrumb.tsx +3 -2
- package/src/components/BulkActionBar/bulk-action-bar.spec.md +4 -2
- package/src/components/Button/button.principles.stories.tsx +1 -1
- package/src/components/Button/button.spec.md +2 -2
- package/src/components/Button/button.tsx +18 -3
- package/src/components/Calendar/calendar.anatomy.stories.tsx +12 -10
- package/src/components/Calendar/calendar.principles.stories.tsx +14 -6
- package/src/components/Calendar/calendar.spec.md +5 -4
- package/src/components/Calendar/calendar.stories.tsx +7 -4
- package/src/components/Calendar/calendar.tsx +26 -7
- package/src/components/Carousel/carousel.anatomy.stories.tsx +5 -4
- package/src/components/Carousel/carousel.spec.md +2 -2
- package/src/components/Carousel/carousel.tsx +11 -3
- package/src/components/Chart/chart.anatomy.stories.tsx +7 -4
- package/src/components/Chart/chart.principles.stories.tsx +1 -1
- package/src/components/Chart/chart.stories.tsx +2 -8
- package/src/components/Chart/chart.tsx +3 -0
- package/src/components/Checkbox/checkbox.anatomy.stories.tsx +28 -49
- package/src/components/Checkbox/checkbox.principles.stories.tsx +1 -1
- package/src/components/Checkbox/checkbox.spec.md +11 -26
- package/src/components/Checkbox/checkbox.stories.tsx +11 -8
- package/src/components/Checkbox/checkbox.tsx +18 -13
- package/src/components/Chip/chip.anatomy.stories.tsx +44 -24
- package/src/components/Chip/chip.principles.stories.tsx +1 -1
- package/src/components/Chip/chip.spec.md +5 -4
- package/src/components/Chip/chip.tsx +5 -1
- package/src/components/CircularProgress/circular-progress.principles.stories.tsx +7 -4
- package/src/components/CircularProgress/circular-progress.spec.md +3 -3
- package/src/components/CircularProgress/circular-progress.stories.tsx +2 -2
- package/src/components/Coachmark/coachmark.anatomy.stories.tsx +2 -2
- package/src/components/Coachmark/coachmark.principles.stories.tsx +2 -1
- package/src/components/Coachmark/coachmark.spec.md +5 -5
- package/src/components/Coachmark/coachmark.stories.tsx +3 -1
- package/src/components/Coachmark/coachmark.tsx +10 -3
- package/src/components/Combobox/combobox.anatomy.stories.tsx +2 -2
- package/src/components/Combobox/combobox.tsx +53 -19
- package/src/components/Command/command.anatomy.stories.tsx +2 -2
- package/src/components/Command/command.principles.stories.tsx +1 -1
- package/src/components/Command/command.stories.tsx +42 -10
- package/src/components/DataTable/cell-registry.tsx +86 -63
- package/src/components/DataTable/column-types.ts +10 -1
- package/src/components/DataTable/data-table-column-visibility-panel.tsx +1 -1
- package/src/components/DataTable/data-table-filter-panel.tsx +4 -1
- package/src/components/DataTable/data-table-interaction-layer.tsx +15 -19
- package/src/components/DataTable/data-table.anatomy.stories.tsx +15 -13
- package/src/components/DataTable/data-table.principles.stories.tsx +9 -9
- package/src/components/DataTable/data-table.spec.md +32 -12
- package/src/components/DataTable/data-table.stories.tsx +16 -17
- package/src/components/DataTable/data-table.tsx +103 -60
- package/src/components/DataTable/index.ts +3 -0
- package/src/components/DateGrid/date-grid.anatomy.stories.tsx +4 -4
- package/src/components/DateGrid/date-grid.principles.stories.tsx +1 -1
- package/src/components/DateGrid/date-grid.spec.md +1 -1
- package/src/components/DateGrid/date-grid.tsx +3 -1
- package/src/components/DatePicker/date-picker.anatomy.stories.tsx +8 -8
- package/src/components/DatePicker/date-picker.principles.stories.tsx +3 -3
- package/src/components/DatePicker/date-picker.spec.md +3 -3
- package/src/components/DatePicker/date-picker.stories.tsx +4 -5
- package/src/components/DatePicker/date-picker.tsx +99 -45
- package/src/components/DescriptionList/description-list.anatomy.stories.tsx +12 -10
- package/src/components/DescriptionList/description-list.principles.stories.tsx +2 -2
- package/src/components/DescriptionList/description-list.spec.md +3 -3
- package/src/components/DescriptionList/description-list.stories.tsx +7 -6
- package/src/components/Dialog/dialog.anatomy.stories.tsx +1 -0
- package/src/components/Dialog/dialog.spec.md +9 -0
- package/src/components/Dialog/dialog.stories.tsx +66 -5
- package/src/components/Dialog/dialog.tsx +60 -25
- package/src/components/DropdownMenu/dropdown-menu.anatomy.stories.tsx +1 -1
- package/src/components/DropdownMenu/dropdown-menu.principles.stories.tsx +8 -6
- package/src/components/DropdownMenu/dropdown-menu.spec.md +5 -5
- package/src/components/DropdownMenu/dropdown-menu.tsx +18 -9
- package/src/components/Empty/empty.anatomy.stories.tsx +1 -1
- package/src/components/Empty/empty.spec.md +2 -2
- package/src/components/Field/field-context.ts +69 -5
- package/src/components/Field/field-controls.spec.md +62 -8
- package/src/components/Field/field-edit-keys.ts +66 -0
- package/src/components/Field/field-types.ts +58 -9
- package/src/components/Field/field-wrapper.tsx +50 -42
- package/src/components/Field/field.anatomy.stories.tsx +9 -6
- package/src/components/Field/field.spec.md +1 -1
- package/src/components/Field/field.stories.tsx +1 -1
- package/src/components/Field/field.tsx +2 -1
- package/src/components/Field/form-validation.spec.md +3 -3
- package/src/components/FieldControlGroup/field-control-group.principles.stories.tsx +6 -6
- package/src/components/FieldControlGroup/field-control-group.spec.md +9 -4
- package/src/components/FieldControlGroup/field-control-group.tsx +1 -1
- package/src/components/FileItem/file-item.anatomy.stories.tsx +1 -1
- package/src/components/FileItem/file-item.spec.md +14 -8
- package/src/components/FileItem/file-item.stories.tsx +36 -25
- package/src/components/FileItem/file-item.tsx +8 -6
- package/src/components/FileUpload/file-upload.anatomy.stories.tsx +6 -6
- package/src/components/FileUpload/file-upload.principles.stories.tsx +5 -5
- package/src/components/FileUpload/file-upload.spec.md +1 -1
- package/src/components/FileUpload/file-upload.tsx +1 -1
- package/src/components/FileViewer/file-viewer.anatomy.stories.tsx +4 -3
- package/src/components/FileViewer/file-viewer.principles.stories.tsx +3 -3
- package/src/components/FileViewer/file-viewer.spec.md +30 -12
- package/src/components/FileViewer/file-viewer.stories.tsx +1 -2
- package/src/components/FileViewer/file-viewer.tsx +12 -4
- package/src/components/FileViewer/image-renderer.tsx +35 -7
- package/src/components/HoverCard/hover-card.anatomy.stories.tsx +6 -2
- package/src/components/HoverCard/hover-card.principles.stories.tsx +6 -3
- package/src/components/HoverCard/hover-card.spec.md +5 -5
- package/src/components/HoverCard/hover-card.stories.tsx +16 -16
- package/src/components/HoverCard/hover-card.tsx +5 -3
- package/src/components/InlineEdit/index.ts +5 -0
- package/src/components/InlineEdit/inline-edit.spec.md +149 -0
- package/src/components/InlineEdit/inline-edit.stories.tsx +246 -0
- package/src/components/InlineEdit/inline-edit.tsx +287 -0
- package/src/components/Input/input.anatomy.stories.tsx +8 -7
- package/src/components/Input/input.principles.stories.tsx +2 -12
- package/src/components/Input/input.spec.md +13 -18
- package/src/components/Input/input.tsx +69 -22
- package/src/components/LinkInput/link-input.anatomy.stories.tsx +1 -1
- package/src/components/LinkInput/link-input.principles.stories.tsx +2 -2
- package/src/components/LinkInput/link-input.tsx +11 -10
- package/src/components/Menu/menu-item.anatomy.stories.tsx +3 -3
- package/src/components/Menu/menu-item.principles.stories.tsx +1 -1
- package/src/components/Menu/menu-item.spec.md +22 -15
- package/src/components/Menu/menu-item.stories.tsx +39 -11
- package/src/components/Menu/menu-item.tsx +38 -4
- package/src/components/Notice/notice.principles.stories.tsx +1 -1
- package/src/components/Notice/notice.spec.md +16 -3
- package/src/components/NumberInput/number-input.anatomy.stories.tsx +3 -3
- package/src/components/NumberInput/number-input.principles.stories.tsx +1 -1
- package/src/components/NumberInput/number-input.spec.md +4 -4
- package/src/components/NumberInput/number-input.tsx +19 -12
- package/src/components/OverflowIndicator/overflow-indicator.anatomy.stories.tsx +10 -8
- package/src/components/OverflowIndicator/overflow-indicator.principles.stories.tsx +3 -3
- package/src/components/OverflowIndicator/overflow-indicator.spec.md +4 -2
- package/src/components/OverflowIndicator/overflow-indicator.stories.tsx +71 -63
- package/src/components/OverflowIndicator/overflow-indicator.tsx +9 -8
- package/src/components/Pagination/pagination.spec.md +1 -1
- package/src/components/Pagination/pagination.stories.tsx +2 -6
- package/src/components/Pagination/pagination.tsx +1 -1
- package/src/components/PeoplePicker/people-picker.anatomy.stories.tsx +4 -4
- package/src/components/PeoplePicker/people-picker.principles.stories.tsx +2 -2
- package/src/components/PeoplePicker/people-picker.spec.md +6 -6
- package/src/components/PeoplePicker/people-picker.tsx +56 -16
- package/src/components/PeoplePicker/person-display.tsx +32 -16
- package/src/components/Popover/popover.anatomy.stories.tsx +2 -2
- package/src/components/Popover/popover.tsx +3 -1
- package/src/components/ProfileCard/profile-card.anatomy.stories.tsx +12 -23
- package/src/components/ProfileCard/profile-card.spec.md +3 -3
- package/src/components/ProfileCard/profile-card.tsx +6 -6
- package/src/components/ProgressBar/progress-bar.anatomy.stories.tsx +3 -1
- package/src/components/ProgressBar/progress-bar.principles.stories.tsx +1 -1
- package/src/components/ProgressBar/progress-bar.stories.tsx +50 -42
- package/src/components/RadioGroup/radio-group.anatomy.stories.tsx +10 -28
- package/src/components/RadioGroup/radio-group.stories.tsx +29 -32
- package/src/components/RadioGroup/radio-group.tsx +41 -15
- package/src/components/Rating/rating.spec.md +11 -3
- package/src/components/ScrollArea/scroll-area.anatomy.stories.tsx +1 -1
- package/src/components/ScrollArea/scroll-area.principles.stories.tsx +1 -1
- package/src/components/ScrollArea/scroll-area.spec.md +7 -3
- package/src/components/ScrollArea/scroll-area.stories.tsx +1 -1
- package/src/components/ScrollArea/scroll-area.tsx +17 -4
- package/src/components/Select/select.anatomy.stories.tsx +3 -3
- package/src/components/Select/select.spec.md +27 -17
- package/src/components/Select/select.stories.tsx +33 -0
- package/src/components/Select/select.tsx +190 -36
- package/src/components/SelectMenu/select-menu.anatomy.stories.tsx +4 -4
- package/src/components/SelectMenu/select-menu.spec.md +15 -7
- package/src/components/SelectMenu/select-menu.tsx +16 -3
- package/src/components/SelectionControl/boolean-value.tsx +39 -0
- package/src/components/SelectionControl/index.ts +1 -0
- package/src/components/SelectionControl/selection-item.anatomy.stories.tsx +2 -2
- package/src/components/SelectionControl/selection-item.principles.stories.tsx +2 -2
- package/src/components/SelectionControl/selection-item.spec.md +3 -3
- package/src/components/SelectionControl/selection-item.stories.tsx +3 -3
- package/src/components/Separator/separator.spec.md +2 -2
- package/src/components/Separator/separator.stories.tsx +6 -27
- package/src/components/Sheet/sheet.anatomy.stories.tsx +1 -1
- package/src/components/Sheet/sheet.principles.stories.tsx +1 -1
- package/src/components/Sheet/sheet.spec.md +2 -2
- package/src/components/Sheet/sheet.tsx +9 -5
- package/src/components/Sidebar/sidebar.anatomy.stories.tsx +16 -12
- package/src/components/Sidebar/sidebar.principles.stories.tsx +10 -8
- package/src/components/Sidebar/sidebar.spec.md +13 -15
- package/src/components/Sidebar/sidebar.stories.tsx +8 -7
- package/src/components/Sidebar/sidebar.tsx +37 -25
- package/src/components/Skeleton/skeleton.stories.tsx +4 -11
- package/src/components/Slider/slider.anatomy.stories.tsx +3 -3
- package/src/components/Slider/slider.principles.stories.tsx +2 -2
- package/src/components/Slider/slider.spec.md +5 -5
- package/src/components/Slider/slider.tsx +3 -1
- package/src/components/Steps/steps.anatomy.stories.tsx +4 -4
- package/src/components/Steps/steps.principles.stories.tsx +1 -1
- package/src/components/Steps/steps.spec.md +1 -1
- package/src/components/Switch/switch.anatomy.stories.tsx +7 -7
- package/src/components/Switch/switch.principles.stories.tsx +4 -4
- package/src/components/Switch/switch.spec.md +8 -8
- package/src/components/Switch/switch.stories.tsx +9 -24
- package/src/components/Switch/switch.tsx +17 -13
- package/src/components/Tabs/tabs.anatomy.stories.tsx +10 -7
- package/src/components/Tabs/tabs.spec.md +1 -1
- package/src/components/Tabs/tabs.tsx +21 -1
- package/src/components/Textarea/textarea.anatomy.stories.tsx +1 -1
- package/src/components/Textarea/textarea.principles.stories.tsx +1 -1
- package/src/components/Textarea/textarea.spec.md +4 -4
- package/src/components/Textarea/textarea.tsx +72 -46
- package/src/components/TimePicker/time-columns.tsx +6 -2
- package/src/components/TimePicker/time-picker.principles.stories.tsx +1 -1
- package/src/components/TimePicker/time-picker.spec.md +3 -3
- package/src/components/TimePicker/time-picker.tsx +16 -10
- package/src/components/Toast/toast.stories.tsx +7 -4
- package/src/components/Tooltip/tooltip.anatomy.stories.tsx +4 -4
- package/src/components/Tooltip/tooltip.principles.stories.tsx +3 -3
- package/src/components/Tooltip/tooltip.spec.md +1 -1
- package/src/components/Tooltip/tooltip.stories.tsx +4 -39
- package/src/components/Tooltip/tooltip.tsx +8 -6
- package/src/components/TreeView/tree-view.anatomy.stories.tsx +6 -3
- package/src/components/TreeView/tree-view.spec.md +42 -11
- package/src/components/TreeView/tree-view.stories.tsx +1 -0
- package/src/components/TreeView/tree-view.tsx +322 -17
- package/src/index.ts +584 -60
- package/src/patterns/action-bar/action-bar.spec.md +9 -0
- package/src/patterns/action-bar/action-bar.stories.tsx +6 -3
- package/src/patterns/element-anatomy/inline-action.spec.md +2 -0
- package/src/patterns/element-anatomy/item-anatomy.spec.md +14 -5
- package/src/patterns/element-anatomy/item-anatomy.stories.tsx +6 -4
- package/src/patterns/element-anatomy/item-anatomy.tsx +7 -6
- package/src/patterns/header-canonical/header-canonical.spec.md +5 -4
- package/src/patterns/overlay-surface/overlay-surface.spec.md +22 -1
- package/src/styles/tokens.css +3 -0
- package/src/tokens/README.md +1 -1
- package/src/tokens/color/color.spec.md +3 -3
- package/src/tokens/color/color.stories.tsx +3 -3
- package/src/tokens/density/density.stories.tsx +16 -3
- package/src/tokens/layoutSpace/layoutSpace.spec.md +3 -1
- package/src/tokens/motion/motion.css +33 -21
- package/src/tokens/motion/motion.spec.md +32 -15
- package/src/tokens/motion/motion.stories.tsx +58 -5
- package/src/tokens/motion/motion.ts +7 -6
- package/src/tokens/motion/overlay-motion.ts +26 -0
- package/src/tokens/orphan-tokens.spec.md +4 -4
- package/src/tokens/token-system.spec.md +1 -0
- package/src/tokens/uiSize/uiSize.spec.md +1 -1
- package/src/tokens/uiSize/uiSize.stories.tsx +4 -2
- package/src/tokens/utility-registry.json +160 -23
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { RotateCcw, X, Plus, Trash2 } from "lucide-react";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { Button } from "../Button/button.js";
|
|
6
|
+
import { Select } from "../Select/select.js";
|
|
7
|
+
import { Combobox } from "../Combobox/combobox.js";
|
|
8
|
+
import { Input } from "../Input/input.js";
|
|
9
|
+
import { NumberInput } from "../NumberInput/number-input.js";
|
|
10
|
+
import { DatePickerRange, DatePicker as DatePickerWithRange } from "../DatePicker/date-picker.js";
|
|
11
|
+
import { PeoplePicker } from "../PeoplePicker/people-picker.js";
|
|
12
|
+
import { SurfaceHeader, COMPACT_HEADER_SLOT, SurfaceBody } from "../../patterns/overlay-surface/overlay-surface.js";
|
|
13
|
+
import { PopoverTitle, PopoverClose } from "../Popover/popover.js";
|
|
14
|
+
import { ButtonDivider } from "../Button/button-group.js";
|
|
15
|
+
import { FieldControlGroup } from "../FieldControlGroup/field-control-group.js";
|
|
16
|
+
import { getColumnId, getColumnMeta, getColumnLabel } from "./lib/column-meta.js";
|
|
17
|
+
import { DEFAULT_OPERATOR, getOperatorSpec, getValueShape, OPERATOR_REGISTRY, DATE_RELATIVE_OPTIONS, DATE_RELATIVE_GROUPS } from "./filter-operators.js";
|
|
18
|
+
import { isFilterTreeEqual } from "./filter-tree.js";
|
|
19
|
+
import { createEmptyFilterTree, dataTableFilterMatch, evaluateTree, isFilterTreeActive } from "./filter-tree.js";
|
|
20
|
+
let _idSeed = 0;
|
|
21
|
+
const newId = () => `f${++_idSeed}-${Date.now().toString(36)}`;
|
|
22
|
+
function extractColumns(columns) {
|
|
23
|
+
const out = [];
|
|
24
|
+
for (const col of columns) {
|
|
25
|
+
const id = getColumnId(col);
|
|
26
|
+
if (!id || id === "__select__") continue;
|
|
27
|
+
const meta = getColumnMeta(col);
|
|
28
|
+
const type = meta == null ? void 0 : meta.type;
|
|
29
|
+
if (!type) continue;
|
|
30
|
+
if ((meta == null ? void 0 : meta.filterable) === false) continue;
|
|
31
|
+
out.push({
|
|
32
|
+
id,
|
|
33
|
+
label: getColumnLabel(col, id),
|
|
34
|
+
type,
|
|
35
|
+
options: meta == null ? void 0 : meta.options,
|
|
36
|
+
people: meta == null ? void 0 : meta.people,
|
|
37
|
+
includeTime: meta == null ? void 0 : meta.includeTime
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
function getOperatorOptions(type) {
|
|
43
|
+
const registry = type && OPERATOR_REGISTRY[type] ? OPERATOR_REGISTRY[type] : OPERATOR_REGISTRY.string;
|
|
44
|
+
return registry.map((op) => ({ value: op.op, label: op.label }));
|
|
45
|
+
}
|
|
46
|
+
function getDefaultOperator(type) {
|
|
47
|
+
return type && DEFAULT_OPERATOR[type] || DEFAULT_OPERATOR.string;
|
|
48
|
+
}
|
|
49
|
+
const datePrecisionOf = (col) => (col == null ? void 0 : col.type) === "date" ? col.includeTime ? "ms" : "day" : void 0;
|
|
50
|
+
const newCondition = (firstCol) => ({
|
|
51
|
+
kind: "cond",
|
|
52
|
+
id: newId(),
|
|
53
|
+
field: (firstCol == null ? void 0 : firstCol.id) ?? "",
|
|
54
|
+
op: firstCol ? getDefaultOperator(firstCol.type) : "",
|
|
55
|
+
value: "",
|
|
56
|
+
datePrecision: datePrecisionOf(firstCol)
|
|
57
|
+
});
|
|
58
|
+
const newEmptyCondition = () => ({
|
|
59
|
+
kind: "cond",
|
|
60
|
+
id: newId(),
|
|
61
|
+
field: "",
|
|
62
|
+
op: "",
|
|
63
|
+
value: ""
|
|
64
|
+
});
|
|
65
|
+
const newGroup = (firstCol) => ({
|
|
66
|
+
kind: "group",
|
|
67
|
+
id: newId(),
|
|
68
|
+
conjunction: "or",
|
|
69
|
+
// group 內 default OR(對齊 ref 圖)
|
|
70
|
+
children: [newCondition(firstCol)]
|
|
71
|
+
});
|
|
72
|
+
const newEmptyGroup = () => ({
|
|
73
|
+
kind: "group",
|
|
74
|
+
id: newId(),
|
|
75
|
+
conjunction: "or",
|
|
76
|
+
children: [newEmptyCondition()]
|
|
77
|
+
});
|
|
78
|
+
function FilterValuePicker({
|
|
79
|
+
shape,
|
|
80
|
+
value,
|
|
81
|
+
onChange,
|
|
82
|
+
colInfo,
|
|
83
|
+
disabled,
|
|
84
|
+
ariaLabel,
|
|
85
|
+
className
|
|
86
|
+
}) {
|
|
87
|
+
if (!shape || disabled) {
|
|
88
|
+
return /* @__PURE__ */ jsx(Input, { size: "sm", value: "", onChange: () => {
|
|
89
|
+
}, placeholder: "輸入值…", disabled: true, "aria-label": ariaLabel, className });
|
|
90
|
+
}
|
|
91
|
+
switch (shape) {
|
|
92
|
+
case "none":
|
|
93
|
+
return null;
|
|
94
|
+
case "text":
|
|
95
|
+
return /* @__PURE__ */ jsx(
|
|
96
|
+
Input,
|
|
97
|
+
{
|
|
98
|
+
size: "sm",
|
|
99
|
+
value: String(value ?? ""),
|
|
100
|
+
onChange: (e) => onChange(e.target.value),
|
|
101
|
+
placeholder: "輸入值…",
|
|
102
|
+
"aria-label": ariaLabel,
|
|
103
|
+
className
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
case "number":
|
|
107
|
+
return /* @__PURE__ */ jsx(
|
|
108
|
+
NumberInput,
|
|
109
|
+
{
|
|
110
|
+
size: "sm",
|
|
111
|
+
value: typeof value === "number" ? value : null,
|
|
112
|
+
onChange: (v) => onChange(v ?? ""),
|
|
113
|
+
placeholder: "輸入數字…",
|
|
114
|
+
"aria-label": ariaLabel,
|
|
115
|
+
className
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
case "date_single":
|
|
119
|
+
return /* @__PURE__ */ jsx(
|
|
120
|
+
DatePickerWithRange,
|
|
121
|
+
{
|
|
122
|
+
size: "sm",
|
|
123
|
+
value: typeof value === "string" ? value : null,
|
|
124
|
+
onChange: (v) => onChange(v ?? ""),
|
|
125
|
+
"aria-label": ariaLabel,
|
|
126
|
+
className
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
case "date_range":
|
|
130
|
+
return /* @__PURE__ */ jsx(
|
|
131
|
+
DatePickerRange,
|
|
132
|
+
{
|
|
133
|
+
size: "sm",
|
|
134
|
+
value: Array.isArray(value) && value.length === 2 ? value : null,
|
|
135
|
+
onChange: (v) => onChange(v),
|
|
136
|
+
"aria-label": ariaLabel,
|
|
137
|
+
className
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
case "date_relative": {
|
|
141
|
+
const opts = DATE_RELATIVE_OPTIONS.map((o) => ({
|
|
142
|
+
value: o.value,
|
|
143
|
+
label: o.label,
|
|
144
|
+
group: o.group
|
|
145
|
+
}));
|
|
146
|
+
return /* @__PURE__ */ jsx(
|
|
147
|
+
Select,
|
|
148
|
+
{
|
|
149
|
+
size: "sm",
|
|
150
|
+
options: opts,
|
|
151
|
+
groups: DATE_RELATIVE_GROUPS,
|
|
152
|
+
value: String(value ?? ""),
|
|
153
|
+
onChange: (v) => onChange(v),
|
|
154
|
+
placeholder: "選擇相對日期",
|
|
155
|
+
"aria-label": ariaLabel,
|
|
156
|
+
className
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
case "select_single": {
|
|
161
|
+
const opts = ((colInfo == null ? void 0 : colInfo.options) ?? []).map((o) => ({
|
|
162
|
+
value: o.value,
|
|
163
|
+
label: o.label
|
|
164
|
+
}));
|
|
165
|
+
return /* @__PURE__ */ jsx(
|
|
166
|
+
Select,
|
|
167
|
+
{
|
|
168
|
+
size: "sm",
|
|
169
|
+
options: opts,
|
|
170
|
+
value: String(value ?? ""),
|
|
171
|
+
onChange: (v) => onChange(v),
|
|
172
|
+
placeholder: "選擇值",
|
|
173
|
+
"aria-label": ariaLabel,
|
|
174
|
+
className
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
case "select_multi": {
|
|
179
|
+
const opts = ((colInfo == null ? void 0 : colInfo.options) ?? []).map((o) => ({
|
|
180
|
+
value: o.value,
|
|
181
|
+
label: o.label
|
|
182
|
+
}));
|
|
183
|
+
const arr = Array.isArray(value) ? value : [];
|
|
184
|
+
return /* @__PURE__ */ jsx(
|
|
185
|
+
Combobox,
|
|
186
|
+
{
|
|
187
|
+
size: "sm",
|
|
188
|
+
options: opts,
|
|
189
|
+
value: arr,
|
|
190
|
+
onChange: (v) => onChange(v),
|
|
191
|
+
placeholder: "選擇值…",
|
|
192
|
+
"aria-label": ariaLabel,
|
|
193
|
+
className
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
case "datetime_single":
|
|
198
|
+
return /* @__PURE__ */ jsx(
|
|
199
|
+
DatePickerWithRange,
|
|
200
|
+
{
|
|
201
|
+
size: "sm",
|
|
202
|
+
showTime: true,
|
|
203
|
+
value: typeof value === "string" ? value : null,
|
|
204
|
+
onChange: (v) => onChange(v ?? ""),
|
|
205
|
+
"aria-label": ariaLabel,
|
|
206
|
+
className
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
case "datetime_range":
|
|
210
|
+
return /* @__PURE__ */ jsx(
|
|
211
|
+
DatePickerRange,
|
|
212
|
+
{
|
|
213
|
+
size: "sm",
|
|
214
|
+
showTime: true,
|
|
215
|
+
value: Array.isArray(value) && value.length === 2 ? value : null,
|
|
216
|
+
onChange: (v) => onChange(v),
|
|
217
|
+
"aria-label": ariaLabel,
|
|
218
|
+
className
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
case "person_single": {
|
|
222
|
+
const v = value;
|
|
223
|
+
return /* @__PURE__ */ jsx(
|
|
224
|
+
PeoplePicker,
|
|
225
|
+
{
|
|
226
|
+
size: "sm",
|
|
227
|
+
value: v ?? null,
|
|
228
|
+
people: (colInfo == null ? void 0 : colInfo.people) ?? [],
|
|
229
|
+
onChange: (next) => onChange(next[0] ?? null),
|
|
230
|
+
"aria-label": ariaLabel,
|
|
231
|
+
className
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
case "person_multi": {
|
|
236
|
+
const v = Array.isArray(value) ? value : [];
|
|
237
|
+
return /* @__PURE__ */ jsx(
|
|
238
|
+
PeoplePicker,
|
|
239
|
+
{
|
|
240
|
+
size: "sm",
|
|
241
|
+
value: v,
|
|
242
|
+
people: (colInfo == null ? void 0 : colInfo.people) ?? [],
|
|
243
|
+
onChange: (next) => onChange(next),
|
|
244
|
+
"aria-label": ariaLabel,
|
|
245
|
+
className
|
|
246
|
+
}
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
default:
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
function DataTableFilterPanelInner({
|
|
254
|
+
mode,
|
|
255
|
+
columns,
|
|
256
|
+
value,
|
|
257
|
+
onChange,
|
|
258
|
+
defaultValue,
|
|
259
|
+
prefilledColumnId,
|
|
260
|
+
onPrefillConsumed,
|
|
261
|
+
onClose,
|
|
262
|
+
className
|
|
263
|
+
}, ref) {
|
|
264
|
+
const filterableColumns = React.useMemo(() => extractColumns(columns), [columns]);
|
|
265
|
+
const fieldOptions = React.useMemo(
|
|
266
|
+
() => filterableColumns.map((c) => ({ value: c.id, label: c.label })),
|
|
267
|
+
[filterableColumns]
|
|
268
|
+
);
|
|
269
|
+
const initialMountDoneRef = React.useRef(false);
|
|
270
|
+
React.useEffect(() => {
|
|
271
|
+
if (initialMountDoneRef.current) return;
|
|
272
|
+
initialMountDoneRef.current = true;
|
|
273
|
+
if (filterableColumns.length === 0) return;
|
|
274
|
+
if (value.children.length > 0) return;
|
|
275
|
+
if (value.mode === "flat") {
|
|
276
|
+
onChange({ ...value, children: [newEmptyCondition()] });
|
|
277
|
+
} else {
|
|
278
|
+
onChange({ ...value, children: [newEmptyGroup()] });
|
|
279
|
+
}
|
|
280
|
+
}, [filterableColumns.length]);
|
|
281
|
+
React.useEffect(() => {
|
|
282
|
+
if (!prefilledColumnId) return;
|
|
283
|
+
const colInfo = filterableColumns.find((c) => c.id === prefilledColumnId);
|
|
284
|
+
if (colInfo) {
|
|
285
|
+
const cond = {
|
|
286
|
+
kind: "cond",
|
|
287
|
+
id: newId(),
|
|
288
|
+
field: prefilledColumnId,
|
|
289
|
+
op: getDefaultOperator(colInfo.type),
|
|
290
|
+
value: "",
|
|
291
|
+
// 2026-07-14 deep-audit fix:補 datePrecision(原漏 → datetime(includeTime=true)欄
|
|
292
|
+
// prefill 掉到 undefined=day 精度忽略 ms;對齊初始 add / changeField 路徑的 datePrecisionOf)
|
|
293
|
+
datePrecision: datePrecisionOf(colInfo)
|
|
294
|
+
};
|
|
295
|
+
if (value.mode === "flat") {
|
|
296
|
+
onChange({ ...value, children: [...value.children, cond] });
|
|
297
|
+
} else {
|
|
298
|
+
if (value.children.length === 0) {
|
|
299
|
+
onChange({ ...value, children: [{ ...newGroup(colInfo), children: [cond] }] });
|
|
300
|
+
} else {
|
|
301
|
+
const updatedGroups = value.children.map(
|
|
302
|
+
(g, i) => i === 0 ? { ...g, children: [...g.children, cond] } : g
|
|
303
|
+
);
|
|
304
|
+
onChange({ ...value, children: updatedGroups });
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
onPrefillConsumed == null ? void 0 : onPrefillConsumed();
|
|
309
|
+
}, [prefilledColumnId]);
|
|
310
|
+
const flatTree = value.mode === "flat" ? value : null;
|
|
311
|
+
const updateFlatCondition = (id, patch) => {
|
|
312
|
+
if (!flatTree) return;
|
|
313
|
+
onChange({
|
|
314
|
+
...flatTree,
|
|
315
|
+
children: flatTree.children.map((c) => c.id === id ? { ...c, ...patch } : c)
|
|
316
|
+
});
|
|
317
|
+
};
|
|
318
|
+
const removeFlatCondition = (id) => {
|
|
319
|
+
if (!flatTree) return;
|
|
320
|
+
onChange({ ...flatTree, children: flatTree.children.filter((c) => c.id !== id) });
|
|
321
|
+
};
|
|
322
|
+
const addFlatCondition = () => {
|
|
323
|
+
if (!flatTree) return;
|
|
324
|
+
onChange({ ...flatTree, children: [...flatTree.children, newEmptyCondition()] });
|
|
325
|
+
};
|
|
326
|
+
const setFlatConjunction = (conj) => {
|
|
327
|
+
if (!flatTree) return;
|
|
328
|
+
onChange({ ...flatTree, conjunction: conj });
|
|
329
|
+
};
|
|
330
|
+
const nestedTree = value.mode === "nested" ? value : null;
|
|
331
|
+
const updateGroup = (groupId, patch) => {
|
|
332
|
+
if (!nestedTree) return;
|
|
333
|
+
onChange({
|
|
334
|
+
...nestedTree,
|
|
335
|
+
children: nestedTree.children.map((g) => g.id === groupId ? { ...g, ...patch } : g)
|
|
336
|
+
});
|
|
337
|
+
};
|
|
338
|
+
const updateGroupCondition = (groupId, condId, patch) => {
|
|
339
|
+
if (!nestedTree) return;
|
|
340
|
+
onChange({
|
|
341
|
+
...nestedTree,
|
|
342
|
+
children: nestedTree.children.map(
|
|
343
|
+
(g) => g.id === groupId ? { ...g, children: g.children.map((c) => c.id === condId ? { ...c, ...patch } : c) } : g
|
|
344
|
+
)
|
|
345
|
+
});
|
|
346
|
+
};
|
|
347
|
+
const removeGroupCondition = (groupId, condId) => {
|
|
348
|
+
if (!nestedTree) return;
|
|
349
|
+
onChange({
|
|
350
|
+
...nestedTree,
|
|
351
|
+
children: nestedTree.children.map(
|
|
352
|
+
(g) => g.id === groupId ? { ...g, children: g.children.filter((c) => c.id !== condId) } : g
|
|
353
|
+
)
|
|
354
|
+
});
|
|
355
|
+
};
|
|
356
|
+
const addConditionToGroup = (groupId) => {
|
|
357
|
+
if (!nestedTree) return;
|
|
358
|
+
onChange({
|
|
359
|
+
...nestedTree,
|
|
360
|
+
children: nestedTree.children.map(
|
|
361
|
+
(g) => g.id === groupId ? { ...g, children: [...g.children, newEmptyCondition()] } : g
|
|
362
|
+
)
|
|
363
|
+
});
|
|
364
|
+
};
|
|
365
|
+
const removeGroup = (groupId) => {
|
|
366
|
+
if (!nestedTree) return;
|
|
367
|
+
onChange({ ...nestedTree, children: nestedTree.children.filter((g) => g.id !== groupId) });
|
|
368
|
+
};
|
|
369
|
+
const addGroup = () => {
|
|
370
|
+
if (!nestedTree) return;
|
|
371
|
+
onChange({ ...nestedTree, children: [...nestedTree.children, newEmptyGroup()] });
|
|
372
|
+
};
|
|
373
|
+
const setRootConjunction = (conj) => {
|
|
374
|
+
if (!nestedTree) return;
|
|
375
|
+
onChange({ ...nestedTree, conjunction: conj });
|
|
376
|
+
};
|
|
377
|
+
return (
|
|
378
|
+
// 寬度策略:desktop 680px;mobile 縮到 viewport 內留 32px 邊(避溢出 popover 切右半)。
|
|
379
|
+
// 對齊 Notion / Airtable 的 advanced filter 在 mobile 走 full-width 邊處理。
|
|
380
|
+
// **#8 fix(2026-05-04)**:popover width by mode(由 cell min-w 與 group nested chrome 反推)
|
|
381
|
+
// flat:cell ConjunctionLabel(80) + gap-2(8) + FCG(field-min 160 + op-min 120 + value 200) +
|
|
382
|
+
// gap-2(8) + trash(28) + 2×loose padding(32) = ~636 → 640px
|
|
383
|
+
// nested:再加 group p-2 (16) + outer ConjunctionLabel (80) + outer gap (8) → ~740 → 760px
|
|
384
|
+
// 對齊 Airtable / Notion / Linear filter row 視覺密度 @benchmark-unverified(non-OSS)
|
|
385
|
+
// **K11 fix(2026-05-04)**:viewport-aware scroll chain invariant
|
|
386
|
+
// parent PopoverContent 是 flex flex-col + max-h + overflow-hidden,
|
|
387
|
+
// panel root 必 forward `flex flex-col h-full` 才能讓 SurfaceBody flex-1 min-h-0 overflow-y-auto 生效
|
|
388
|
+
// 無此 forward → 中間 wrapper 斷鏈 → body 不 scroll(ProfileCard 因為自身設 max-h flex-col 才繞過)
|
|
389
|
+
// 詳 overlay-surface.spec.md「viewport-aware scroll chain invariant」段
|
|
390
|
+
// K11 v2 fix(2026-05-04):flex item 預設 min-h:auto 讓 content 撐 height,h-full 失效。
|
|
391
|
+
// 必加 `min-h-0` 才能讓 panel 在 PopoverContent max-h cap 下正確 shrink + body scroll。
|
|
392
|
+
/* @__PURE__ */ jsxs("div", { ref, className: cn(
|
|
393
|
+
"flex flex-col h-full min-h-0",
|
|
394
|
+
mode === "nested" ? "w-[min(760px,calc(100vw-2rem))]" : "w-[min(640px,calc(100vw-2rem))]",
|
|
395
|
+
className
|
|
396
|
+
), children: [
|
|
397
|
+
/* @__PURE__ */ jsxs(SurfaceHeader, { className: COMPACT_HEADER_SLOT, children: [
|
|
398
|
+
/* @__PURE__ */ jsx(PopoverTitle, { className: "flex-1", children: "篩選" }),
|
|
399
|
+
defaultValue && !isFilterTreeEqual(value, defaultValue) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
400
|
+
/* @__PURE__ */ jsx(
|
|
401
|
+
Button,
|
|
402
|
+
{
|
|
403
|
+
variant: "text",
|
|
404
|
+
size: "sm",
|
|
405
|
+
iconOnly: true,
|
|
406
|
+
startIcon: RotateCcw,
|
|
407
|
+
"aria-label": "恢復預設",
|
|
408
|
+
onClick: () => onChange(defaultValue)
|
|
409
|
+
}
|
|
410
|
+
),
|
|
411
|
+
onClose && /* @__PURE__ */ jsx(ButtonDivider, {})
|
|
412
|
+
] }),
|
|
413
|
+
onClose && /* @__PURE__ */ jsx(PopoverClose, { asChild: true, children: /* @__PURE__ */ jsx(Button, { "data-dismiss": true, iconOnly: true, dismiss: true, size: "sm", startIcon: X, "aria-label": "關閉", onClick: onClose }) })
|
|
414
|
+
] }),
|
|
415
|
+
/* @__PURE__ */ jsxs(SurfaceBody, { className: "flex flex-col gap-[var(--layout-space-tight)]", children: [
|
|
416
|
+
flatTree && flatTree.children.map((cond, idx) => /* @__PURE__ */ jsx(
|
|
417
|
+
FilterRow,
|
|
418
|
+
{
|
|
419
|
+
index: idx,
|
|
420
|
+
condition: cond,
|
|
421
|
+
conjunction: flatTree.conjunction,
|
|
422
|
+
filterableColumns,
|
|
423
|
+
fieldOptions,
|
|
424
|
+
onChangeConjunction: setFlatConjunction,
|
|
425
|
+
onChangeField: (v) => {
|
|
426
|
+
const newCol = filterableColumns.find((c) => c.id === v);
|
|
427
|
+
updateFlatCondition(cond.id, { field: v, op: getDefaultOperator(newCol == null ? void 0 : newCol.type), value: "", datePrecision: datePrecisionOf(newCol) });
|
|
428
|
+
},
|
|
429
|
+
onChangeOp: (v) => updateFlatCondition(cond.id, { op: v, value: "" }),
|
|
430
|
+
onChangeValue: (v) => updateFlatCondition(cond.id, { value: v }),
|
|
431
|
+
onRemove: () => removeFlatCondition(cond.id)
|
|
432
|
+
},
|
|
433
|
+
cond.id
|
|
434
|
+
)),
|
|
435
|
+
nestedTree && nestedTree.children.map((group, gIdx) => /* @__PURE__ */ jsx(
|
|
436
|
+
GroupBlock,
|
|
437
|
+
{
|
|
438
|
+
index: gIdx,
|
|
439
|
+
group,
|
|
440
|
+
rootConjunction: nestedTree.conjunction,
|
|
441
|
+
filterableColumns,
|
|
442
|
+
fieldOptions,
|
|
443
|
+
onChangeRootConjunction: setRootConjunction,
|
|
444
|
+
onChangeGroupConjunction: (c) => updateGroup(group.id, { conjunction: c }),
|
|
445
|
+
onChangeCondition: (condId, patch) => updateGroupCondition(group.id, condId, patch),
|
|
446
|
+
onRemoveCondition: (condId) => removeGroupCondition(group.id, condId),
|
|
447
|
+
onAddCondition: () => addConditionToGroup(group.id),
|
|
448
|
+
onRemoveGroup: () => removeGroup(group.id)
|
|
449
|
+
},
|
|
450
|
+
group.id
|
|
451
|
+
)),
|
|
452
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
453
|
+
Button,
|
|
454
|
+
{
|
|
455
|
+
variant: "tertiary",
|
|
456
|
+
size: "sm",
|
|
457
|
+
startIcon: Plus,
|
|
458
|
+
onClick: mode === "flat" ? addFlatCondition : addGroup,
|
|
459
|
+
children: mode === "nested" ? "加入篩選器" : "加篩選"
|
|
460
|
+
}
|
|
461
|
+
) })
|
|
462
|
+
] })
|
|
463
|
+
] })
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
const DataTableFilterPanel = React.forwardRef(DataTableFilterPanelInner);
|
|
467
|
+
DataTableFilterPanel.displayName = "DataTableFilterPanel";
|
|
468
|
+
const CONJ_OPTIONS = [
|
|
469
|
+
{ value: "and", label: "And" },
|
|
470
|
+
{ value: "or", label: "Or" }
|
|
471
|
+
];
|
|
472
|
+
function ConjunctionLabel({
|
|
473
|
+
index,
|
|
474
|
+
conjunction,
|
|
475
|
+
onChange
|
|
476
|
+
}) {
|
|
477
|
+
if (index === 0) {
|
|
478
|
+
return /* @__PURE__ */ jsx("div", { className: "w-20 shrink-0 text-body text-fg-muted px-[var(--field-px)] self-center", children: "Where" });
|
|
479
|
+
}
|
|
480
|
+
if (index >= 2) {
|
|
481
|
+
const label = conjunction === "and" ? "And" : "Or";
|
|
482
|
+
return /* @__PURE__ */ jsx("div", { className: "w-20 shrink-0 text-body text-fg-muted px-[var(--field-px)] self-center", children: label });
|
|
483
|
+
}
|
|
484
|
+
return /* @__PURE__ */ jsx("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ jsx(
|
|
485
|
+
Select,
|
|
486
|
+
{
|
|
487
|
+
size: "sm",
|
|
488
|
+
options: CONJ_OPTIONS,
|
|
489
|
+
value: conjunction,
|
|
490
|
+
onChange: (v) => onChange(v),
|
|
491
|
+
minRows: 2,
|
|
492
|
+
"aria-label": "連接詞 — 同 group 共用"
|
|
493
|
+
}
|
|
494
|
+
) });
|
|
495
|
+
}
|
|
496
|
+
function FilterRow({
|
|
497
|
+
index,
|
|
498
|
+
condition,
|
|
499
|
+
conjunction,
|
|
500
|
+
filterableColumns,
|
|
501
|
+
fieldOptions,
|
|
502
|
+
onChangeConjunction,
|
|
503
|
+
onChangeField,
|
|
504
|
+
onChangeOp,
|
|
505
|
+
onChangeValue,
|
|
506
|
+
onRemove
|
|
507
|
+
}) {
|
|
508
|
+
const colInfo = filterableColumns.find((c) => c.id === condition.field);
|
|
509
|
+
const operatorOptions = getOperatorOptions(colInfo == null ? void 0 : colInfo.type);
|
|
510
|
+
const hasField = !!condition.field;
|
|
511
|
+
const opSpec = colInfo ? getOperatorSpec(colInfo.type, condition.op) : null;
|
|
512
|
+
const valueShape = colInfo && opSpec ? getValueShape(opSpec, colInfo.type, colInfo.includeTime) : null;
|
|
513
|
+
const hasValueCell = valueShape !== "none";
|
|
514
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
515
|
+
/* @__PURE__ */ jsx(ConjunctionLabel, { index, conjunction, onChange: onChangeConjunction }),
|
|
516
|
+
/* @__PURE__ */ jsxs(FieldControlGroup, { block: true, className: "flex-1 min-w-0", children: [
|
|
517
|
+
/* @__PURE__ */ jsx(
|
|
518
|
+
Select,
|
|
519
|
+
{
|
|
520
|
+
className: "!w-[var(--data-table-filter-field-width)] flex-shrink-0",
|
|
521
|
+
size: "sm",
|
|
522
|
+
options: fieldOptions,
|
|
523
|
+
value: condition.field,
|
|
524
|
+
onChange: onChangeField,
|
|
525
|
+
placeholder: "選擇欄位",
|
|
526
|
+
"aria-label": "篩選欄位"
|
|
527
|
+
}
|
|
528
|
+
),
|
|
529
|
+
/* @__PURE__ */ jsx(
|
|
530
|
+
Select,
|
|
531
|
+
{
|
|
532
|
+
className: hasValueCell ? "!w-[var(--data-table-filter-op-width)] flex-shrink-0" : "!flex-1 !min-w-0",
|
|
533
|
+
size: "sm",
|
|
534
|
+
options: operatorOptions,
|
|
535
|
+
value: condition.op,
|
|
536
|
+
onChange: onChangeOp,
|
|
537
|
+
disabled: !hasField,
|
|
538
|
+
placeholder: "運算子",
|
|
539
|
+
"aria-label": "篩選運算子"
|
|
540
|
+
}
|
|
541
|
+
),
|
|
542
|
+
hasValueCell && /* @__PURE__ */ jsx(
|
|
543
|
+
FilterValuePicker,
|
|
544
|
+
{
|
|
545
|
+
shape: valueShape,
|
|
546
|
+
value: condition.value,
|
|
547
|
+
onChange: onChangeValue,
|
|
548
|
+
colInfo,
|
|
549
|
+
disabled: !hasField,
|
|
550
|
+
ariaLabel: colInfo ? `${colInfo.label} 篩選值` : "篩選值",
|
|
551
|
+
className: "!flex-1 !min-w-0"
|
|
552
|
+
}
|
|
553
|
+
)
|
|
554
|
+
] }),
|
|
555
|
+
/* @__PURE__ */ jsx(Button, { variant: "text", size: "sm", iconOnly: true, startIcon: Trash2, "aria-label": "刪除", onClick: onRemove })
|
|
556
|
+
] });
|
|
557
|
+
}
|
|
558
|
+
function GroupBlock({
|
|
559
|
+
index,
|
|
560
|
+
group,
|
|
561
|
+
rootConjunction,
|
|
562
|
+
filterableColumns,
|
|
563
|
+
fieldOptions,
|
|
564
|
+
onChangeRootConjunction,
|
|
565
|
+
onChangeGroupConjunction,
|
|
566
|
+
onChangeCondition,
|
|
567
|
+
onRemoveCondition,
|
|
568
|
+
onAddCondition,
|
|
569
|
+
onRemoveGroup
|
|
570
|
+
}) {
|
|
571
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
572
|
+
/* @__PURE__ */ jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsx(ConjunctionLabel, { index, conjunction: rootConjunction, onChange: onChangeRootConjunction }) }),
|
|
573
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0 rounded-md bg-muted p-2 flex flex-col gap-2", children: [
|
|
574
|
+
group.children.map((cond, cIdx) => /* @__PURE__ */ jsx(
|
|
575
|
+
FilterRow,
|
|
576
|
+
{
|
|
577
|
+
index: cIdx,
|
|
578
|
+
condition: cond,
|
|
579
|
+
conjunction: group.conjunction,
|
|
580
|
+
filterableColumns,
|
|
581
|
+
fieldOptions,
|
|
582
|
+
onChangeConjunction: onChangeGroupConjunction,
|
|
583
|
+
onChangeField: (v) => {
|
|
584
|
+
const newCol = filterableColumns.find((c) => c.id === v);
|
|
585
|
+
onChangeCondition(cond.id, { field: v, op: getDefaultOperator(newCol == null ? void 0 : newCol.type), value: "", datePrecision: datePrecisionOf(newCol) });
|
|
586
|
+
},
|
|
587
|
+
onChangeOp: (v) => onChangeCondition(cond.id, { op: v, value: "" }),
|
|
588
|
+
onChangeValue: (v) => onChangeCondition(cond.id, { value: v }),
|
|
589
|
+
onRemove: () => onRemoveCondition(cond.id)
|
|
590
|
+
},
|
|
591
|
+
cond.id
|
|
592
|
+
)),
|
|
593
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
594
|
+
/* @__PURE__ */ jsx(Button, { variant: "text", size: "sm", startIcon: Plus, onClick: onAddCondition, children: "加入巢狀篩選" }),
|
|
595
|
+
group.children.length === 0 && /* @__PURE__ */ jsx(Button, { variant: "text", size: "sm", startIcon: Trash2, danger: true, onClick: onRemoveGroup, children: "移除空群組" })
|
|
596
|
+
] })
|
|
597
|
+
] })
|
|
598
|
+
] });
|
|
599
|
+
}
|
|
600
|
+
export {
|
|
601
|
+
DataTableFilterPanel,
|
|
602
|
+
createEmptyFilterTree,
|
|
603
|
+
dataTableFilterMatch,
|
|
604
|
+
evaluateTree,
|
|
605
|
+
isFilterTreeActive
|
|
606
|
+
};
|
|
607
|
+
//# sourceMappingURL=data-table-filter-panel.js.map
|