@invoiceonline/ui-react 0.0.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +100 -0
- package/CHANGELOG.md +149 -0
- package/LICENSE +9 -0
- package/README.md +77 -1
- package/dist/assets/label-brush-1.svg +6 -0
- package/dist/assets/pattern-dark.svg +113 -0
- package/dist/components/action-row/ActionRow.d.ts +178 -0
- package/dist/components/action-row/ActionRow.js +340 -0
- package/dist/components/action-row/index.d.ts +2 -0
- package/dist/components/action-row/index.js +1 -0
- package/dist/components/alert/Alert.d.ts +314 -0
- package/dist/components/alert/Alert.js +446 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +1 -0
- package/dist/components/anchored-panel/AnchoredPanel.d.ts +41 -0
- package/dist/components/anchored-panel/AnchoredPanel.js +72 -0
- package/dist/components/anchored-panel/index.d.ts +3 -0
- package/dist/components/anchored-panel/index.js +3 -0
- package/dist/components/badge/Badge.d.ts +146 -0
- package/dist/components/badge/Badge.js +258 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/banner/Banner.d.ts +209 -0
- package/dist/components/banner/Banner.js +339 -0
- package/dist/components/banner/index.d.ts +2 -0
- package/dist/components/banner/index.js +1 -0
- package/dist/components/button/Button.d.ts +54 -0
- package/dist/components/button/Button.js +312 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/button-group/ButtonGroup.d.ts +187 -0
- package/dist/components/button-group/ButtonGroup.js +217 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.js +1 -0
- package/dist/components/card-select/CardSelect.d.ts +274 -0
- package/dist/components/card-select/CardSelect.js +561 -0
- package/dist/components/card-select/CardSelectGroup.d.ts +92 -0
- package/dist/components/card-select/CardSelectGroup.js +72 -0
- package/dist/components/card-select/index.d.ts +3 -0
- package/dist/components/card-select/index.js +3 -0
- package/dist/components/checkbox/Checkbox.d.ts +104 -0
- package/dist/components/checkbox/Checkbox.js +194 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/chip/Chip.d.ts +250 -0
- package/dist/components/chip/Chip.js +441 -0
- package/dist/components/chip/index.d.ts +2 -0
- package/dist/components/chip/index.js +1 -0
- package/dist/components/column-header/ColumnHeader.d.ts +144 -0
- package/dist/components/column-header/ColumnHeader.js +209 -0
- package/dist/components/column-header/index.d.ts +2 -0
- package/dist/components/column-header/index.js +1 -0
- package/dist/components/combobox-field/Combobox.d.ts +104 -0
- package/dist/components/combobox-field/Combobox.js +355 -0
- package/dist/components/combobox-field/ComboboxField.d.ts +76 -0
- package/dist/components/combobox-field/ComboboxField.js +98 -0
- package/dist/components/combobox-field/index.d.ts +3 -0
- package/dist/components/combobox-field/index.js +3 -0
- package/dist/components/date-picker/DatePicker.d.ts +53 -0
- package/dist/components/date-picker/DatePicker.js +329 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/divider/Divider.d.ts +81 -0
- package/dist/components/divider/Divider.js +93 -0
- package/dist/components/divider/index.d.ts +2 -0
- package/dist/components/divider/index.js +1 -0
- package/dist/components/drawer/Drawer.d.ts +128 -0
- package/dist/components/drawer/Drawer.js +367 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/dropdown-button/DropdownButton.d.ts +72 -0
- package/dist/components/dropdown-button/DropdownButton.js +122 -0
- package/dist/components/dropdown-button/index.d.ts +2 -0
- package/dist/components/dropdown-button/index.js +1 -0
- package/dist/components/faq/FAQ.d.ts +135 -0
- package/dist/components/faq/FAQ.js +258 -0
- package/dist/components/faq/index.d.ts +2 -0
- package/dist/components/faq/index.js +1 -0
- package/dist/components/field/Field.d.ts +119 -0
- package/dist/components/field/Field.js +332 -0
- package/dist/components/field/index.d.ts +2 -0
- package/dist/components/field/index.js +1 -0
- package/dist/components/field-pair/FieldPair.d.ts +210 -0
- package/dist/components/field-pair/FieldPair.js +335 -0
- package/dist/components/field-pair/index.d.ts +2 -0
- package/dist/components/field-pair/index.js +1 -0
- package/dist/components/file-upload/FileUpload.d.ts +137 -0
- package/dist/components/file-upload/FileUpload.js +434 -0
- package/dist/components/file-upload/index.d.ts +2 -0
- package/dist/components/file-upload/index.js +1 -0
- package/dist/components/filter-chip/FilterChip.d.ts +373 -0
- package/dist/components/filter-chip/FilterChip.js +517 -0
- package/dist/components/filter-chip/index.d.ts +2 -0
- package/dist/components/filter-chip/index.js +1 -0
- package/dist/components/filter-facet/FilterFacet.d.ts +116 -0
- package/dist/components/filter-facet/FilterFacet.js +632 -0
- package/dist/components/filter-facet/index.d.ts +2 -0
- package/dist/components/filter-facet/index.js +1 -0
- package/dist/components/firm-avatar/FirmAvatar.d.ts +75 -0
- package/dist/components/firm-avatar/FirmAvatar.js +119 -0
- package/dist/components/firm-avatar/index.d.ts +2 -0
- package/dist/components/firm-avatar/index.js +1 -0
- package/dist/components/form-actions/FormActions.d.ts +123 -0
- package/dist/components/form-actions/FormActions.js +195 -0
- package/dist/components/form-actions/index.d.ts +2 -0
- package/dist/components/form-actions/index.js +1 -0
- package/dist/components/form-block/FormBlock.d.ts +252 -0
- package/dist/components/form-block/FormBlock.js +420 -0
- package/dist/components/form-block/index.d.ts +3 -0
- package/dist/components/form-block/index.js +3 -0
- package/dist/components/form-section/FormSection.d.ts +130 -0
- package/dist/components/form-section/FormSection.js +206 -0
- package/dist/components/form-section/index.d.ts +2 -0
- package/dist/components/form-section/index.js +1 -0
- package/dist/components/heading/Heading.d.ts +69 -0
- package/dist/components/heading/Heading.js +79 -0
- package/dist/components/heading/index.d.ts +2 -0
- package/dist/components/heading/index.js +1 -0
- package/dist/components/heading-group/HeadingGroup.d.ts +258 -0
- package/dist/components/heading-group/HeadingGroup.js +255 -0
- package/dist/components/heading-group/index.d.ts +2 -0
- package/dist/components/heading-group/index.js +1 -0
- package/dist/components/hero/Hero.d.ts +268 -0
- package/dist/components/hero/Hero.js +316 -0
- package/dist/components/hero/index.d.ts +2 -0
- package/dist/components/hero/index.js +1 -0
- package/dist/components/icon/Icon.d.ts +27 -0
- package/dist/components/icon/Icon.js +30 -0
- package/dist/components/icon/index.d.ts +3 -0
- package/dist/components/icon/index.js +3 -0
- package/dist/components/icon-button/IconButton.d.ts +75 -0
- package/dist/components/icon-button/IconButton.js +151 -0
- package/dist/components/icon-button/index.d.ts +2 -0
- package/dist/components/icon-button/index.js +1 -0
- package/dist/components/item-row/ItemRow.d.ts +253 -0
- package/dist/components/item-row/ItemRow.js +496 -0
- package/dist/components/item-row/index.d.ts +2 -0
- package/dist/components/item-row/index.js +1 -0
- package/dist/components/list-row/ListRow.d.ts +165 -0
- package/dist/components/list-row/ListRow.js +233 -0
- package/dist/components/list-row/index.d.ts +2 -0
- package/dist/components/list-row/index.js +1 -0
- package/dist/components/menu/Menu.d.ts +64 -0
- package/dist/components/menu/Menu.js +186 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/index.js +1 -0
- package/dist/components/modal/Modal.d.ts +272 -0
- package/dist/components/modal/Modal.js +788 -0
- package/dist/components/modal/index.d.ts +2 -0
- package/dist/components/modal/index.js +1 -0
- package/dist/components/nav-link/NavLink.d.ts +123 -0
- package/dist/components/nav-link/NavLink.js +157 -0
- package/dist/components/nav-link/index.d.ts +2 -0
- package/dist/components/nav-link/index.js +1 -0
- package/dist/components/number-field/NumberField.d.ts +62 -0
- package/dist/components/number-field/NumberField.js +210 -0
- package/dist/components/number-field/index.d.ts +2 -0
- package/dist/components/number-field/index.js +1 -0
- package/dist/components/pagination/Pagination.d.ts +133 -0
- package/dist/components/pagination/Pagination.js +217 -0
- package/dist/components/pagination/index.d.ts +3 -0
- package/dist/components/pagination/index.js +3 -0
- package/dist/components/popover-surface/index.d.ts +2 -0
- package/dist/components/popover-surface/index.js +1 -0
- package/dist/components/progress-bar/ProgressBar.d.ts +260 -0
- package/dist/components/progress-bar/ProgressBar.js +470 -0
- package/dist/components/progress-bar/index.d.ts +2 -0
- package/dist/components/progress-bar/index.js +1 -0
- package/dist/components/promo-sticker/PromoSticker.d.ts +204 -0
- package/dist/components/promo-sticker/PromoSticker.js +177 -0
- package/dist/components/promo-sticker/index.d.ts +2 -0
- package/dist/components/promo-sticker/index.js +1 -0
- package/dist/components/promo-surface/PromoSurface.d.ts +94 -0
- package/dist/components/promo-surface/PromoSurface.js +119 -0
- package/dist/components/promo-surface/index.d.ts +2 -0
- package/dist/components/promo-surface/index.js +1 -0
- package/dist/components/radio/Radio.d.ts +92 -0
- package/dist/components/radio/Radio.js +171 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/radio/index.js +1 -0
- package/dist/components/radio-group/RadioGroup.d.ts +61 -0
- package/dist/components/radio-group/RadioGroup.js +51 -0
- package/dist/components/radio-group/index.d.ts +2 -0
- package/dist/components/radio-group/index.js +1 -0
- package/dist/components/select/Select.d.ts +65 -0
- package/dist/components/select/Select.js +176 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/select-field/SelectField.d.ts +16 -0
- package/dist/components/select-field/SelectField.js +55 -0
- package/dist/components/select-field/index.d.ts +2 -0
- package/dist/components/select-field/index.js +1 -0
- package/dist/components/skeleton/Skeleton.d.ts +64 -0
- package/dist/components/skeleton/Skeleton.js +65 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/split-button/SplitButton.d.ts +80 -0
- package/dist/components/split-button/SplitButton.js +182 -0
- package/dist/components/split-button/index.d.ts +2 -0
- package/dist/components/split-button/index.js +1 -0
- package/dist/components/status-summary-bar/StatusSummaryBar.d.ts +118 -0
- package/dist/components/status-summary-bar/StatusSummaryBar.js +278 -0
- package/dist/components/status-summary-bar/index.d.ts +2 -0
- package/dist/components/status-summary-bar/index.js +1 -0
- package/dist/components/subject-lookup-field/SubjectLookupField.d.ts +157 -0
- package/dist/components/subject-lookup-field/SubjectLookupField.js +663 -0
- package/dist/components/subject-lookup-field/index.d.ts +2 -0
- package/dist/components/subject-lookup-field/index.js +1 -0
- package/dist/components/switch/Switch.d.ts +152 -0
- package/dist/components/switch/Switch.js +307 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +1 -0
- package/dist/components/table/Table.d.ts +5 -0
- package/dist/components/table/Table.js +601 -0
- package/dist/components/table/index.d.ts +6 -0
- package/dist/components/table/index.js +6 -0
- package/dist/components/text-field/TextField.d.ts +160 -0
- package/dist/components/text-field/TextField.js +244 -0
- package/dist/components/text-field/index.d.ts +2 -0
- package/dist/components/text-field/index.js +1 -0
- package/dist/components/text-link/TextLink.d.ts +260 -0
- package/dist/components/text-link/TextLink.js +303 -0
- package/dist/components/text-link/index.d.ts +2 -0
- package/dist/components/text-link/index.js +1 -0
- package/dist/components/textarea/Textarea.d.ts +93 -0
- package/dist/components/textarea/Textarea.js +256 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/tooltip/Tooltip.d.ts +129 -0
- package/dist/components/tooltip/Tooltip.js +457 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/unit-field/UnitField.d.ts +46 -0
- package/dist/components/unit-field/UnitField.js +133 -0
- package/dist/components/unit-field/index.d.ts +2 -0
- package/dist/components/unit-field/index.js +1 -0
- package/dist/icons/icon-registry.generated.js +500 -0
- package/dist/icons/icon-types.generated.d.ts +2 -0
- package/dist/icons/icon-types.generated.js +126 -0
- package/dist/index.d.ts +130 -0
- package/dist/index.js +74 -0
- package/dist/internal/BottomSheet.js +496 -0
- package/dist/internal/FodsProvider.d.ts +25 -0
- package/dist/internal/FodsProvider.js +32 -0
- package/dist/internal/MotionCaret.js +35 -0
- package/dist/internal/NumberFormatInput.d.ts +21 -0
- package/dist/internal/NumberFormatInput.js +126 -0
- package/dist/internal/SummaryDonut.d.ts +3 -0
- package/dist/internal/SummaryDonut.js +300 -0
- package/dist/internal/buttonSegment.d.ts +44 -0
- package/dist/internal/buttonSegment.js +126 -0
- package/dist/internal/collapseRoom.js +128 -0
- package/dist/internal/comboboxKeys.js +44 -0
- package/dist/internal/contentPresence.js +46 -0
- package/dist/internal/dayCell.js +95 -0
- package/dist/internal/dialogPortal.d.ts +2 -0
- package/dist/internal/dialogPortal.js +21 -0
- package/dist/internal/donutSweeps.js +65 -0
- package/dist/internal/enterOnViewGeometry.js +46 -0
- package/dist/internal/faqItem.js +80 -0
- package/dist/internal/floatingLabelMotion.js +68 -0
- package/dist/internal/formBlockContext.d.ts +22 -0
- package/dist/internal/formBlockContext.js +20 -0
- package/dist/internal/heightRoom.js +87 -0
- package/dist/internal/numberSeparators.js +62 -0
- package/dist/internal/overlayMotion.js +48 -0
- package/dist/internal/paginationItem.d.ts +8 -0
- package/dist/internal/paginationItem.js +22 -0
- package/dist/internal/popoverSurface.d.ts +8 -0
- package/dist/internal/popoverSurface.js +23 -0
- package/dist/internal/portalContainer.d.ts +1 -0
- package/dist/internal/portalContainer.js +6 -0
- package/dist/internal/progressBarItem.d.ts +207 -0
- package/dist/internal/progressBarItem.js +264 -0
- package/dist/internal/selectionControlText.js +12 -0
- package/dist/internal/statusSummaryParts.js +371 -0
- package/dist/internal/summaryMotion.js +75 -0
- package/dist/internal/table/ChildConnector.js +62 -0
- package/dist/internal/table/ChildRowPrefix.d.ts +9 -0
- package/dist/internal/table/ChildRowPrefix.js +27 -0
- package/dist/internal/table/ColumnSettings.js +135 -0
- package/dist/internal/table/ScrollRegion.js +114 -0
- package/dist/internal/table/TableEmpty.js +93 -0
- package/dist/internal/table/TableLayout.d.ts +17 -0
- package/dist/internal/table/TableLayout.js +29 -0
- package/dist/internal/table/TableLoadStatus.js +56 -0
- package/dist/internal/table/TableMobile.js +488 -0
- package/dist/internal/table/TruncatedCell.js +33 -0
- package/dist/internal/table/emptyValue.js +10 -0
- package/dist/internal/table/features.d.ts +41 -0
- package/dist/internal/table/features.js +31 -0
- package/dist/internal/table/recipes.js +227 -0
- package/dist/internal/table/rowClick.js +9 -0
- package/dist/internal/table/types.d.ts +325 -0
- package/dist/internal/table/types.js +13 -0
- package/dist/internal/tailwind-variants.d.ts +3 -0
- package/dist/internal/tailwind-variants.js +37 -0
- package/dist/internal/tooltipContext.js +5 -0
- package/dist/internal/tw-merge-config.generated.js +314 -0
- package/dist/internal/useAnchoredPanel.d.ts +87 -0
- package/dist/internal/useAnchoredPanel.js +108 -0
- package/dist/internal/useCountUp.js +53 -0
- package/dist/internal/useDateFieldTrigger.d.ts +60 -0
- package/dist/internal/useDateFieldTrigger.js +235 -0
- package/dist/internal/useEChart.js +59 -0
- package/dist/internal/useEnterOnView.js +42 -0
- package/dist/internal/useFloatingBar.js +100 -0
- package/dist/internal/useFormReset.js +44 -0
- package/dist/internal/useIsMobile.js +44 -0
- package/dist/internal/useOneRowOverflow.js +88 -0
- package/dist/internal/usePrefersReducedMotion.js +25 -0
- package/dist/internal/useReturnFocus.js +26 -0
- package/dist/internal/utils.d.ts +7 -0
- package/dist/internal/utils.js +58 -0
- package/dist/node_modules/@tanstack/store/dist/store.d.ts +29 -0
- package/dist/node_modules/@tanstack/store/dist/types.d.ts +38 -0
- package/dist/node_modules/@tanstack/table-core/dist/core/cells/coreCellsFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/core/cells/coreCellsFeature.types.d.ts +53 -0
- package/dist/node_modules/@tanstack/table-core/dist/core/columns/coreColumnsFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/core/columns/coreColumnsFeature.types.d.ts +90 -0
- package/dist/node_modules/@tanstack/table-core/dist/core/coreFeatures.d.ts +17 -0
- package/dist/node_modules/@tanstack/table-core/dist/core/headers/coreHeadersFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/core/headers/coreHeadersFeature.types.d.ts +114 -0
- package/dist/node_modules/@tanstack/table-core/dist/core/reactivity/coreReactivityFeature.types.d.ts +51 -0
- package/dist/node_modules/@tanstack/table-core/dist/core/row-models/coreRowModelsFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/core/row-models/coreRowModelsFeature.types.d.ts +29 -0
- package/dist/node_modules/@tanstack/table-core/dist/core/rows/coreRowsFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/core/rows/coreRowsFeature.types.d.ts +129 -0
- package/dist/node_modules/@tanstack/table-core/dist/core/table/coreTablesFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/core/table/coreTablesFeature.types.d.ts +203 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/cell-selection/cellSelectionFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/cell-selection/cellSelectionFeature.types.d.ts +294 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/cell-spanning/cellSpanningFeature.d.ts +11 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/cell-spanning/cellSpanningFeature.types.d.ts +148 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-faceting/columnFacetingFeature.d.ts +12 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-faceting/columnFacetingFeature.types.d.ts +63 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-filtering/columnFilteringFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-filtering/columnFilteringFeature.types.d.ts +209 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-filtering/filterFns.d.ts +35 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-grouping/columnGroupingFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-grouping/columnGroupingFeature.types.d.ts +128 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-ordering/columnOrderingFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-ordering/columnOrderingFeature.types.d.ts +82 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-pinning/columnPinningFeature.d.ts +11 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-pinning/columnPinningFeature.types.d.ts +195 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-resizing/columnResizingFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-resizing/columnResizingFeature.types.d.ts +73 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-sizing/columnSizingFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-sizing/columnSizingFeature.types.d.ts +134 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-visibility/columnVisibilityFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +92 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/global-filtering/globalFilteringFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/global-filtering/globalFilteringFeature.types.d.ts +67 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/row-aggregation/aggregationFns.d.ts +23 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/row-aggregation/rowAggregationFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/row-aggregation/rowAggregationFeature.types.d.ts +183 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/row-aggregation/rowAggregationFeature.utils.d.ts +18 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/row-expanding/rowExpandingFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/row-expanding/rowExpandingFeature.types.d.ts +125 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/row-pagination/rowPaginationFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/row-pagination/rowPaginationFeature.types.d.ts +135 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/row-pinning/rowPinningFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/row-pinning/rowPinningFeature.types.d.ts +76 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/row-selection/rowSelectionFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/row-selection/rowSelectionFeature.types.d.ts +187 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/row-sorting/rowSortingFeature.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/row-sorting/rowSortingFeature.types.d.ts +236 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/row-sorting/sortFns.d.ts +23 -0
- package/dist/node_modules/@tanstack/table-core/dist/features/stockFeatures.d.ts +37 -0
- package/dist/node_modules/@tanstack/table-core/dist/helpers/columnHelper.d.ts +47 -0
- package/dist/node_modules/@tanstack/table-core/dist/types/Cell.d.ts +16 -0
- package/dist/node_modules/@tanstack/table-core/dist/types/Column.d.ts +30 -0
- package/dist/node_modules/@tanstack/table-core/dist/types/ColumnDef.d.ts +123 -0
- package/dist/node_modules/@tanstack/table-core/dist/types/Header.d.ts +12 -0
- package/dist/node_modules/@tanstack/table-core/dist/types/HeaderGroup.d.ts +6 -0
- package/dist/node_modules/@tanstack/table-core/dist/types/Row.d.ts +24 -0
- package/dist/node_modules/@tanstack/table-core/dist/types/RowModel.d.ts +19 -0
- package/dist/node_modules/@tanstack/table-core/dist/types/RowModelFns.d.ts +11 -0
- package/dist/node_modules/@tanstack/table-core/dist/types/Table.d.ts +53 -0
- package/dist/node_modules/@tanstack/table-core/dist/types/TableFeatures.d.ts +416 -0
- package/dist/node_modules/@tanstack/table-core/dist/types/TableOptions.d.ts +78 -0
- package/dist/node_modules/@tanstack/table-core/dist/types/TableState.d.ts +46 -0
- package/dist/node_modules/@tanstack/table-core/dist/types/type-utils.d.ts +25 -0
- package/dist/shared.css +179 -0
- package/dist/styles.css +5467 -0
- package/dist/theme.css +314 -0
- package/dist/theme.map.json +278 -0
- package/dist/tokens/index.d.ts +2 -0
- package/dist/tokens/index.js +1 -0
- package/dist/tokens/tokens.generated.d.ts +2040 -0
- package/dist/tokens/tokens.generated.js +2053 -0
- package/dist/tokens.css +484 -0
- package/dist/tokens.flat.json +429 -0
- package/docs/Consuming.mdx +396 -0
- package/docs/Contributing.mdx +78 -0
- package/docs/ForAgents.mdx +53 -0
- package/docs/Introduction.mdx +54 -0
- package/llms.txt +550 -0
- package/package.json +347 -3
- package/src/components/action-row/ActionRow.mdx +686 -0
- package/src/components/action-row/ActionRow.stories.tsx +669 -0
- package/src/components/action-row/ActionRow.tsx +632 -0
- package/src/components/action-row/index.ts +9 -0
- package/src/components/alert/Alert.mdx +377 -0
- package/src/components/alert/Alert.stories.tsx +674 -0
- package/src/components/alert/Alert.tsx +579 -0
- package/src/components/alert/index.ts +13 -0
- package/src/components/anchored-panel/AnchoredPanel.mdx +381 -0
- package/src/components/anchored-panel/AnchoredPanel.stories.tsx +593 -0
- package/src/components/anchored-panel/AnchoredPanel.tsx +176 -0
- package/src/components/anchored-panel/index.ts +15 -0
- package/src/components/badge/Badge.mdx +487 -0
- package/src/components/badge/Badge.stories.tsx +375 -0
- package/src/components/badge/Badge.tsx +360 -0
- package/src/components/badge/index.ts +10 -0
- package/src/components/banner/Banner.mdx +704 -0
- package/src/components/banner/Banner.stories.tsx +448 -0
- package/src/components/banner/Banner.tsx +602 -0
- package/src/components/banner/index.ts +14 -0
- package/src/components/button/Button.mdx +286 -0
- package/src/components/button/Button.stories.tsx +381 -0
- package/src/components/button/Button.tsx +384 -0
- package/src/components/button/index.ts +1 -0
- package/src/components/button-group/ButtonGroup.mdx +512 -0
- package/src/components/button-group/ButtonGroup.stories.tsx +714 -0
- package/src/components/button-group/ButtonGroup.tsx +491 -0
- package/src/components/button-group/index.ts +10 -0
- package/src/components/card-select/CardSelect.mdx +662 -0
- package/src/components/card-select/CardSelect.stories.tsx +784 -0
- package/src/components/card-select/CardSelect.tsx +783 -0
- package/src/components/card-select/CardSelectGroup.tsx +169 -0
- package/src/components/card-select/index.ts +18 -0
- package/src/components/checkbox/Checkbox.mdx +269 -0
- package/src/components/checkbox/Checkbox.stories.tsx +306 -0
- package/src/components/checkbox/Checkbox.tsx +343 -0
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/chip/Chip.mdx +683 -0
- package/src/components/chip/Chip.stories.tsx +734 -0
- package/src/components/chip/Chip.tsx +732 -0
- package/src/components/chip/index.ts +9 -0
- package/src/components/column-header/ColumnHeader.mdx +301 -0
- package/src/components/column-header/ColumnHeader.stories.tsx +319 -0
- package/src/components/column-header/ColumnHeader.tsx +287 -0
- package/src/components/column-header/index.ts +7 -0
- package/src/components/combobox-field/Combobox.tsx +693 -0
- package/src/components/combobox-field/ComboboxField.mdx +525 -0
- package/src/components/combobox-field/ComboboxField.stories.tsx +502 -0
- package/src/components/combobox-field/ComboboxField.tsx +259 -0
- package/src/components/combobox-field/index.ts +12 -0
- package/src/components/date-picker/DatePicker.mdx +440 -0
- package/src/components/date-picker/DatePicker.stories.tsx +458 -0
- package/src/components/date-picker/DatePicker.tsx +688 -0
- package/src/components/date-picker/index.ts +9 -0
- package/src/components/divider/Divider.mdx +256 -0
- package/src/components/divider/Divider.stories.tsx +177 -0
- package/src/components/divider/Divider.tsx +193 -0
- package/src/components/divider/index.ts +1 -0
- package/src/components/drawer/Drawer.mdx +518 -0
- package/src/components/drawer/Drawer.stories.tsx +392 -0
- package/src/components/drawer/Drawer.tsx +683 -0
- package/src/components/drawer/index.ts +1 -0
- package/src/components/dropdown-button/DropdownButton.mdx +285 -0
- package/src/components/dropdown-button/DropdownButton.stories.tsx +398 -0
- package/src/components/dropdown-button/DropdownButton.tsx +198 -0
- package/src/components/dropdown-button/index.ts +7 -0
- package/src/components/faq/FAQ.mdx +364 -0
- package/src/components/faq/FAQ.stories.tsx +343 -0
- package/src/components/faq/FAQ.tsx +337 -0
- package/src/components/faq/index.ts +1 -0
- package/src/components/field/Field.mdx +129 -0
- package/src/components/field/Field.stories.tsx +461 -0
- package/src/components/field/Field.tsx +787 -0
- package/src/components/field/index.ts +20 -0
- package/src/components/field-pair/FieldPair.mdx +312 -0
- package/src/components/field-pair/FieldPair.stories.tsx +539 -0
- package/src/components/field-pair/FieldPair.tsx +845 -0
- package/src/components/field-pair/index.ts +9 -0
- package/src/components/file-upload/FileUpload.mdx +345 -0
- package/src/components/file-upload/FileUpload.stories.tsx +698 -0
- package/src/components/file-upload/FileUpload.tsx +802 -0
- package/src/components/file-upload/index.ts +6 -0
- package/src/components/filter-chip/FilterChip.mdx +778 -0
- package/src/components/filter-chip/FilterChip.stories.tsx +827 -0
- package/src/components/filter-chip/FilterChip.tsx +881 -0
- package/src/components/filter-chip/index.ts +11 -0
- package/src/components/filter-facet/FilterFacet.mdx +536 -0
- package/src/components/filter-facet/FilterFacet.stories.tsx +506 -0
- package/src/components/filter-facet/FilterFacet.tsx +1160 -0
- package/src/components/filter-facet/index.ts +7 -0
- package/src/components/firm-avatar/FirmAvatar.mdx +280 -0
- package/src/components/firm-avatar/FirmAvatar.stories.tsx +147 -0
- package/src/components/firm-avatar/FirmAvatar.tsx +172 -0
- package/src/components/firm-avatar/index.ts +7 -0
- package/src/components/form-actions/FormActions.mdx +518 -0
- package/src/components/form-actions/FormActions.stories.tsx +621 -0
- package/src/components/form-actions/FormActions.tsx +273 -0
- package/src/components/form-actions/index.ts +6 -0
- package/src/components/form-block/FormBlock.mdx +728 -0
- package/src/components/form-block/FormBlock.stories.tsx +813 -0
- package/src/components/form-block/FormBlock.tsx +679 -0
- package/src/components/form-block/index.ts +13 -0
- package/src/components/form-section/FormSection.mdx +436 -0
- package/src/components/form-section/FormSection.stories.tsx +407 -0
- package/src/components/form-section/FormSection.tsx +290 -0
- package/src/components/form-section/index.ts +17 -0
- package/src/components/heading/Heading.mdx +206 -0
- package/src/components/heading/Heading.stories.tsx +169 -0
- package/src/components/heading/Heading.tsx +124 -0
- package/src/components/heading/index.ts +8 -0
- package/src/components/heading-group/HeadingGroup.mdx +521 -0
- package/src/components/heading-group/HeadingGroup.stories.tsx +353 -0
- package/src/components/heading-group/HeadingGroup.tsx +396 -0
- package/src/components/heading-group/index.ts +7 -0
- package/src/components/hero/Hero.mdx +742 -0
- package/src/components/hero/Hero.stories.tsx +527 -0
- package/src/components/hero/Hero.tsx +807 -0
- package/src/components/hero/index.ts +1 -0
- package/src/components/icon/Icon.mdx +329 -0
- package/src/components/icon/Icon.stories.tsx +398 -0
- package/src/components/icon/Icon.tsx +97 -0
- package/src/components/icon/index.ts +2 -0
- package/src/components/icon-button/IconButton.mdx +206 -0
- package/src/components/icon-button/IconButton.stories.tsx +341 -0
- package/src/components/icon-button/IconButton.tsx +273 -0
- package/src/components/icon-button/index.ts +1 -0
- package/src/components/item-row/ItemRow.mdx +533 -0
- package/src/components/item-row/ItemRow.stories.tsx +434 -0
- package/src/components/item-row/ItemRow.tsx +676 -0
- package/src/components/item-row/index.ts +9 -0
- package/src/components/list-row/ListRow.mdx +404 -0
- package/src/components/list-row/ListRow.stories.tsx +404 -0
- package/src/components/list-row/ListRow.tsx +424 -0
- package/src/components/list-row/index.ts +1 -0
- package/src/components/menu/Menu.mdx +268 -0
- package/src/components/menu/Menu.stories.tsx +455 -0
- package/src/components/menu/Menu.tsx +452 -0
- package/src/components/menu/index.ts +1 -0
- package/src/components/modal/Modal.mdx +854 -0
- package/src/components/modal/Modal.stories.tsx +881 -0
- package/src/components/modal/Modal.tsx +1434 -0
- package/src/components/modal/index.ts +1 -0
- package/src/components/nav-link/NavLink.mdx +196 -0
- package/src/components/nav-link/NavLink.stories.tsx +243 -0
- package/src/components/nav-link/NavLink.tsx +222 -0
- package/src/components/nav-link/index.ts +1 -0
- package/src/components/number-field/NumberField.mdx +223 -0
- package/src/components/number-field/NumberField.stories.tsx +291 -0
- package/src/components/number-field/NumberField.tsx +388 -0
- package/src/components/number-field/index.ts +6 -0
- package/src/components/pagination/Pagination.mdx +305 -0
- package/src/components/pagination/Pagination.stories.tsx +333 -0
- package/src/components/pagination/Pagination.tsx +343 -0
- package/src/components/pagination/index.ts +8 -0
- package/src/components/popover-surface/PopoverSurface.mdx +158 -0
- package/src/components/popover-surface/PopoverSurface.stories.tsx +421 -0
- package/src/components/popover-surface/index.ts +1 -0
- package/src/components/progress-bar/ProgressBar.mdx +802 -0
- package/src/components/progress-bar/ProgressBar.stories.tsx +533 -0
- package/src/components/progress-bar/ProgressBar.tsx +654 -0
- package/src/components/progress-bar/index.ts +9 -0
- package/src/components/promo-sticker/PromoSticker.mdx +436 -0
- package/src/components/promo-sticker/PromoSticker.stories.tsx +363 -0
- package/src/components/promo-sticker/PromoSticker.tsx +313 -0
- package/src/components/promo-sticker/index.ts +7 -0
- package/src/components/promo-surface/PromoSurface.mdx +399 -0
- package/src/components/promo-surface/PromoSurface.stories.tsx +270 -0
- package/src/components/promo-surface/PromoSurface.tsx +305 -0
- package/src/components/promo-surface/index.ts +7 -0
- package/src/components/radio/Radio.mdx +243 -0
- package/src/components/radio/Radio.stories.tsx +307 -0
- package/src/components/radio/Radio.tsx +288 -0
- package/src/components/radio/index.ts +1 -0
- package/src/components/radio-group/RadioGroup.mdx +119 -0
- package/src/components/radio-group/RadioGroup.stories.tsx +225 -0
- package/src/components/radio-group/RadioGroup.tsx +139 -0
- package/src/components/radio-group/index.ts +1 -0
- package/src/components/select/Select.mdx +241 -0
- package/src/components/select/Select.stories.tsx +404 -0
- package/src/components/select/Select.tsx +381 -0
- package/src/components/select/index.ts +1 -0
- package/src/components/select-field/SelectField.mdx +324 -0
- package/src/components/select-field/SelectField.stories.tsx +460 -0
- package/src/components/select-field/SelectField.tsx +138 -0
- package/src/components/select-field/index.ts +1 -0
- package/src/components/skeleton/Skeleton.mdx +194 -0
- package/src/components/skeleton/Skeleton.stories.tsx +260 -0
- package/src/components/skeleton/Skeleton.tsx +107 -0
- package/src/components/skeleton/index.ts +1 -0
- package/src/components/split-button/SplitButton.mdx +445 -0
- package/src/components/split-button/SplitButton.stories.tsx +465 -0
- package/src/components/split-button/SplitButton.tsx +361 -0
- package/src/components/split-button/index.ts +7 -0
- package/src/components/status-summary-bar/StatusSummaryBar.mdx +338 -0
- package/src/components/status-summary-bar/StatusSummaryBar.stories.tsx +408 -0
- package/src/components/status-summary-bar/StatusSummaryBar.tsx +428 -0
- package/src/components/status-summary-bar/index.ts +8 -0
- package/src/components/subject-lookup-field/SubjectLookupField.mdx +378 -0
- package/src/components/subject-lookup-field/SubjectLookupField.stories.tsx +393 -0
- package/src/components/subject-lookup-field/SubjectLookupField.tsx +1079 -0
- package/src/components/subject-lookup-field/index.ts +11 -0
- package/src/components/switch/Switch.mdx +376 -0
- package/src/components/switch/Switch.stories.tsx +296 -0
- package/src/components/switch/Switch.tsx +483 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/table/Table.mdx +575 -0
- package/src/components/table/Table.stories.tsx +1049 -0
- package/src/components/table/Table.tsx +745 -0
- package/src/components/table/TableConsumers.stories.tsx +195 -0
- package/src/components/table/_tableFixtures.ts +1189 -0
- package/src/components/table/index.ts +22 -0
- package/src/components/text-field/TextField.mdx +699 -0
- package/src/components/text-field/TextField.stories.tsx +674 -0
- package/src/components/text-field/TextField.tsx +645 -0
- package/src/components/text-field/index.ts +11 -0
- package/src/components/text-link/TextLink.mdx +353 -0
- package/src/components/text-link/TextLink.stories.tsx +458 -0
- package/src/components/text-link/TextLink.tsx +504 -0
- package/src/components/text-link/index.ts +10 -0
- package/src/components/textarea/Textarea.mdx +244 -0
- package/src/components/textarea/Textarea.stories.tsx +371 -0
- package/src/components/textarea/Textarea.tsx +489 -0
- package/src/components/textarea/index.ts +9 -0
- package/src/components/tooltip/Tooltip.mdx +462 -0
- package/src/components/tooltip/Tooltip.stories.tsx +500 -0
- package/src/components/tooltip/Tooltip.tsx +756 -0
- package/src/components/tooltip/index.ts +13 -0
- package/src/components/unit-field/UnitField.mdx +215 -0
- package/src/components/unit-field/UnitField.stories.tsx +291 -0
- package/src/components/unit-field/UnitField.tsx +255 -0
- package/src/components/unit-field/index.ts +7 -0
- package/src/icons/icon-registry.generated.ts +510 -0
- package/src/icons/icon-types.generated.ts +256 -0
- package/src/index.ts +70 -0
- package/src/internal/BottomSheet.tsx +714 -0
- package/src/internal/FodsProvider.tsx +36 -0
- package/src/internal/MotionCaret.tsx +53 -0
- package/src/internal/NumberFormatInput.tsx +276 -0
- package/src/internal/SummaryDonut.tsx +359 -0
- package/src/internal/buttonSegment.ts +241 -0
- package/src/internal/collapseRoom.ts +130 -0
- package/src/internal/comboboxKeys.ts +90 -0
- package/src/internal/contentPresence.ts +46 -0
- package/src/internal/dayCell.ts +274 -0
- package/src/internal/dialogPortal.ts +50 -0
- package/src/internal/donutSweeps.ts +77 -0
- package/src/internal/enterOnViewGeometry.ts +53 -0
- package/src/internal/faqItem.ts +104 -0
- package/src/internal/floatingLabelMotion.tsx +109 -0
- package/src/internal/formBlockContext.ts +27 -0
- package/src/internal/heightRoom.ts +135 -0
- package/src/internal/numberSeparators.ts +93 -0
- package/src/internal/overlayMotion.tsx +32 -0
- package/src/internal/paginationItem.ts +106 -0
- package/src/internal/popoverSurface.ts +78 -0
- package/src/internal/portalContainer.ts +11 -0
- package/src/internal/progressBarItem.ts +356 -0
- package/src/internal/selectionControlText.ts +42 -0
- package/src/internal/statusSummaryParts.tsx +475 -0
- package/src/internal/summaryMotion.ts +111 -0
- package/src/internal/table/ChildConnector.tsx +57 -0
- package/src/internal/table/ChildRowPrefix.tsx +21 -0
- package/src/internal/table/ColumnSettings.tsx +194 -0
- package/src/internal/table/ScrollRegion.tsx +176 -0
- package/src/internal/table/TableEmpty.tsx +99 -0
- package/src/internal/table/TableLayout.tsx +29 -0
- package/src/internal/table/TableLoadStatus.tsx +60 -0
- package/src/internal/table/TableMobile.tsx +582 -0
- package/src/internal/table/TruncatedCell.tsx +35 -0
- package/src/internal/table/emptyValue.ts +11 -0
- package/src/internal/table/features.ts +44 -0
- package/src/internal/table/recipes.ts +263 -0
- package/src/internal/table/rowClick.ts +8 -0
- package/src/internal/table/types.ts +342 -0
- package/src/internal/tailwind-variants.ts +65 -0
- package/src/internal/tooltipContext.ts +15 -0
- package/src/internal/tw-merge-config.generated.ts +275 -0
- package/src/internal/useAnchoredPanel.ts +340 -0
- package/src/internal/useCountUp.ts +65 -0
- package/src/internal/useDateFieldTrigger.tsx +497 -0
- package/src/internal/useEChart.ts +88 -0
- package/src/internal/useEnterOnView.ts +80 -0
- package/src/internal/useFloatingBar.ts +125 -0
- package/src/internal/useFormReset.ts +57 -0
- package/src/internal/useIsMobile.ts +64 -0
- package/src/internal/useNoImplicitSubmit.ts +41 -0
- package/src/internal/useOneRowOverflow.ts +103 -0
- package/src/internal/usePrefersReducedMotion.ts +27 -0
- package/src/internal/useReturnFocus.ts +34 -0
- package/src/internal/utils.ts +58 -0
- package/src/recipes/EmptyState.stories.tsx +105 -0
- package/src/recipes/Form.stories.tsx +360 -0
- package/src/recipes/ModalWithForm.stories.tsx +219 -0
- package/src/recipes/Recipes.mdx +61 -0
- package/src/recipes/TableWithFilters.stories.tsx +278 -0
- package/src/storybook/FodsFamily.tsx +39 -0
- package/src/storybook/Section.tsx +36 -0
- package/src/storybook/a11y.ts +24 -0
- package/src/storybook/assets/banner-character-bartender.webp +0 -0
- package/src/storybook/assets/banner-invoice-sheet-left.webp +0 -0
- package/src/storybook/assets/banner-invoice-sheet-right.webp +0 -0
- package/src/storybook/assets/invoice-hero.webp +0 -0
- package/src/storybook/assets/invoice.webp +0 -0
- package/src/storybook/assets/section-document-info.svg +21 -0
- package/src/storybook/assets/section-gear-checklist.svg +11 -0
- package/src/storybook/assets/section-person-arrow-in.svg +15 -0
- package/src/storybook/assets/section-person-arrow-out.svg +22 -0
- package/src/storybook/assets/section-receipt-dollar.svg +23 -0
- package/src/storybook/assets/table-empty-folder-empty.png +0 -0
- package/src/storybook/assets/table-empty-folder-magnifying-glass.png +0 -0
- package/src/storybook/assets/table-empty-funnel.png +0 -0
- package/src/storybook/assets/table-empty-load-failed.png +0 -0
- package/src/storybook/assets/wallet-spot.png +0 -0
- package/src/storybook/assets.d.ts +17 -0
- package/src/storybook/componentDoc.ts +41 -0
- package/src/storybook/fitFrame.tsx +70 -0
- package/src/storybook/forceStates.tsx +647 -0
- package/src/storybook/illustrations.tsx +66 -0
- package/src/storybook/viewportFrame.tsx +58 -0
- package/src/styles/assets/label-brush-1.svg +6 -0
- package/src/styles/assets/pattern-dark.svg +113 -0
- package/src/styles/base.css +106 -0
- package/src/styles/index.css +15 -0
- package/src/styles/motion.css +157 -0
- package/src/styles/promo-sticker.css +27 -0
- package/src/styles/promo-surface.css +49 -0
- package/src/styles/shared.css +11 -0
- package/src/styles/theme.generated.css +314 -0
- package/src/styles/theme.map.json +278 -0
- package/src/styles/tracking.generated.css +12 -0
- package/src/tokens/index.ts +4 -0
- package/src/tokens/tokens.generated.ts +542 -0
|
@@ -0,0 +1,881 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { tv, type VariantProps } from '../../internal/tailwind-variants';
|
|
4
|
+
import { Icon, type IconName, type IconSize } from '../icon/Icon';
|
|
5
|
+
import { Tooltip } from '../tooltip/Tooltip';
|
|
6
|
+
import { MotionCaret } from '../../internal/MotionCaret';
|
|
7
|
+
import { cn } from '../../internal/utils';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* FilterChip — the FILTER-BAR control (upstream spec `03-atoms/filter-chip.md`,
|
|
11
|
+
* manifest **1.14.1**). A chip whose own state IS the applied filter, at the 32/40
|
|
12
|
+
* control tier. Two types:
|
|
13
|
+
*
|
|
14
|
+
* - **Facet** — opens an options panel, then morphs IN PLACE into the chosen value:
|
|
15
|
+
* the category noun (`Kraj`) becomes the applied value (`Praha`) and the caret
|
|
16
|
+
* becomes a clearing ×. The × returns the chip to its bare trigger; it never
|
|
17
|
+
* removes the control. Facet exists in **Neutral only** — it is the app's
|
|
18
|
+
* selection accent, not a risk flag (dev-warned below).
|
|
19
|
+
* - **Toggle** — a binary flag switched directly, no panel (`Plátce DPH`,
|
|
20
|
+
* `Nespolehlivý DPH`, `Insolvence`). Warning / Danger belong here.
|
|
21
|
+
*
|
|
22
|
+
* **FilterChip is not Chip.** Selection recolours the whole pill (outline → family
|
|
23
|
+
* solid), the deliberate boundary against `Chip`, whose pill never recolours (its
|
|
24
|
+
* selection lives in a leading checkbox) and which sits at the 22/30 tag tier. For
|
|
25
|
+
* read-only status use `Badge`; for a fixed menu noun ("Akce") use `DropdownButton`.
|
|
26
|
+
*
|
|
27
|
+
* Anatomy — ONE DOM shape for both types, in this order:
|
|
28
|
+
* `leading glyph → label → count → caret (Facet+Unselected) | × (Facet+Selected)`.
|
|
29
|
+
*
|
|
30
|
+
* - **Pill** (`root`) — chrome, height, radius, hairline and focus ring. The shared
|
|
31
|
+
* `06-patterns/pill.md` recipe extended to the control tier on Button metrics:
|
|
32
|
+
* 32 (`sm`) / 40 (`md`), radius tracking the size (`--radius-300` / `--radius-400`).
|
|
33
|
+
* - **Trigger** — the interactive button. It carries the INLINE PADDING, except the
|
|
34
|
+
* right padding of a Selected Facet, which sits on the root after the ×: the × box
|
|
35
|
+
* stays glyph-tight so its ring centres on the glyph, and its 32×32 hit area is
|
|
36
|
+
* anchored to the pill's edge, so the padding is not a dead zone. Manifest 1.5.1 states the
|
|
37
|
+
* rule per side (the Button optical-padding rule): a side that ends in an ICON —
|
|
38
|
+
* leading glyph, caret, × — is `--space-400` (8), a side that ends in TEXT — label
|
|
39
|
+
* or count — keeps `--space-500` (12). So the left side steps down only while the
|
|
40
|
+
* glyph is rendered; on the right the caret and the × step it down, and a Toggle's
|
|
41
|
+
* trailing label or count does not.
|
|
42
|
+
* - **Leading glyph** — a scanning cue, not decoration: the facet's category
|
|
43
|
+
* (`map-pin` / `briefcase` / `buildings`) or the flag's risk class from Badge's
|
|
44
|
+
* emotion→glyph map. The `funnel-simple` default is
|
|
45
|
+
* generic-but-never-wrong; swap it per instance, `null` hides it.
|
|
46
|
+
* - **Label** — `Body/S/Semibold` (`sm`) / `Body/M/Semibold` (`md`), one line,
|
|
47
|
+
* truncated on overflow.
|
|
48
|
+
* - **Count** — the live RESULT count under the current query, same size at Regular
|
|
49
|
+
* weight. **Zero renders** — it is an answer, not an absence. Structurally absent
|
|
50
|
+
* on a Facet ENTIRELY (no node at all, not a hidden one — manifest 1.3.0): Selected
|
|
51
|
+
* because the applied value has replaced the option list, Unselected because a count
|
|
52
|
+
* answers "how many rows if I apply THIS" and a category is not appliable. Toggle
|
|
53
|
+
* keeps it — the flag IS the thing being applied.
|
|
54
|
+
* - **Caret** — Facet+Unselected only, the open affordance, `aria-hidden` (the
|
|
55
|
+
* affordance is announced through `aria-haspopup`).
|
|
56
|
+
* - **×** — Facet+Selected only, a real SIBLING `<button>` (never nested in the
|
|
57
|
+
* trigger — manifest 1.3.0 (a)) with a 32×32 dense-control hit area.
|
|
58
|
+
*
|
|
59
|
+
* **Why the root is a `<span>` even for Toggle.** (1) A Selected Facet needs TWO
|
|
60
|
+
* sibling buttons (trigger + ×), and a `<button>` may not contain interactive
|
|
61
|
+
* content. (2) The morph animates the CONTAINER; a root that switched
|
|
62
|
+
* `<button>` ↔ `<span>` with the selection would be unmounted by React and the
|
|
63
|
+
* transition would never play. (3) One DOM shape = one place for the padding, one
|
|
64
|
+
* for the ring, one for runtime part measurement.
|
|
65
|
+
*
|
|
66
|
+
* **Edge outline × focus ring — the FOCUS RING is the one on `::before`.** Both want
|
|
67
|
+
* the root's single `outline`: the Unselected hairline is `strokeMode:
|
|
68
|
+
* "inset-outline"` (an `outline` at a −1px offset, never a `border`, which would grow
|
|
69
|
+
* the box the manifest pins and make the in-place morph nudge the bar), and the focus
|
|
70
|
+
* ring is an additive offset `outline` too. FilterChip is the first component in the
|
|
71
|
+
* system to collide these two, and the collision is resolved the other way round from
|
|
72
|
+
* `06-patterns/edge-outline.md` § *Interaction with the focus ring*, which suggests
|
|
73
|
+
* moving the EDGE outline to a pseudo-element. Two reasons: the hairline's mechanism
|
|
74
|
+
* is a structured manifest fact that the FODS verifier reads and enforces per family
|
|
75
|
+
* and state (18 findings when it was on `::before`), whereas the ring's mechanism is a
|
|
76
|
+
* free choice among the five `focus-ring.md` § Styles — one of which is exactly this
|
|
77
|
+
* `::before` offset ring, already shipped on Field Pair and `_field-segment`. And the
|
|
78
|
+
* rendering is identical either way: a 2px `--outline-focus` band 2px outside the box.
|
|
79
|
+
* So the hairline keeps the `outline` the manifest names, and the ring is a `::before`
|
|
80
|
+
* at `-inset-200` (4px out, 2px border → a 2px gap) whose radius is one step up the
|
|
81
|
+
* ladder, per size. Both can show at once, which is what "additive" means. That
|
|
82
|
+
* pattern doc's clause is still untested ("No current component reaches it") and is
|
|
83
|
+
* what should record this precedent.
|
|
84
|
+
*
|
|
85
|
+
* The ring is driven by the TRIGGER's focus (`has-[[data-fods-part=trigger]:focus-visible]`)
|
|
86
|
+
* and the × rings itself, so the ring always sits on whichever control holds DOM
|
|
87
|
+
* focus — never both. The band is present but transparent at rest, so only its colour
|
|
88
|
+
* changes on focus and the geometry is declared once.
|
|
89
|
+
*
|
|
90
|
+
* The manifest's transparent 1px stroke on Selected variants (width parity, so
|
|
91
|
+
* activating a chip cannot nudge the bar) is a Figma-only device: an `outline` takes
|
|
92
|
+
* no layout, so Selected and Unselected already measure the same box.
|
|
93
|
+
*
|
|
94
|
+
* **Selection is derived, never a variant.** `selected = type === 'facet' ? value !=
|
|
95
|
+
* null : checked`. A "Selected Facet without a value" is therefore unrepresentable.
|
|
96
|
+
* `axes.state` is not a prop either — Hover is `:hover`, and only `disabled` is one.
|
|
97
|
+
*
|
|
98
|
+
* **`disabled` reaches every sub-control**: the `trigger` through the native
|
|
99
|
+
* `disabled` attribute + `aria-disabled`, and the × through the native `disabled`
|
|
100
|
+
* attribute + `aria-disabled` — no tab stop, no hover, no action, exactly as the spec
|
|
101
|
+
* demands for a disabled applied facet (clearing it happens through the bar's
|
|
102
|
+
* `Vymazat`). Greying uses `--disabled-control` / `--disabled-foreground`, never `opacity`.
|
|
103
|
+
*
|
|
104
|
+
* **`clearLabel` is required at the TYPE level for Facet.** The × is icon-only, so it
|
|
105
|
+
* needs an accessible name (WCAG 4.1.2), and this atom has no locale of its own —
|
|
106
|
+
* it ships on nine markets, so a `?? 'Zrušit filtr'` fallback would announce Czech on
|
|
107
|
+
* the PL / SK / EN sites. The requirement is carried by ONE `type`-keyed union (the
|
|
108
|
+
* `Chip.removeLabel` trick); a second union would break `<FilterChip type={type}>` in
|
|
109
|
+
* the docs matrices.
|
|
110
|
+
*
|
|
111
|
+
* **Motion.** The morph transitions the container's colours ONLY — fill and border
|
|
112
|
+
* colour — over `--duration-toggle` with `--easing-standard` (Tailwind `duration-toggle`
|
|
113
|
+
* and `ease-standard`). The content
|
|
114
|
+
* swap is instant and `prefers-reduced-motion` makes the whole thing instant. Width
|
|
115
|
+
* snaps, and that is not a shortfall: manifest 1.4.0 corrected the earlier note and
|
|
116
|
+
* states width was never meant to animate.
|
|
117
|
+
*
|
|
118
|
+
* **Two spec conflicts, resolved:**
|
|
119
|
+
* 1. `slots.leading.note` says the glyph tracks "the variant's label foreground", but
|
|
120
|
+
* `families[].states[].icon` binds `--icon-muted` on Unselected. `families` wins
|
|
121
|
+
* (authority order: manifest structured fields first) and the Figma set agrees —
|
|
122
|
+
* grey glyph, black label. On Selected both meet at the family foreground, so
|
|
123
|
+
* there is no conflict there.
|
|
124
|
+
* 2. The count's ink on **disabled outline chrome** is an open manifest `backlog`
|
|
125
|
+
* item (status `blocked`). It is bound here to `--disabled-foreground`, following
|
|
126
|
+
* the family's `disabled.text` — **derived, not specified.**
|
|
127
|
+
*
|
|
128
|
+
* Colour tokens are mapped 1:1 from the design system — no hardcoded values.
|
|
129
|
+
*/
|
|
130
|
+
const filterChipVariants = tv({
|
|
131
|
+
slots: {
|
|
132
|
+
root: [
|
|
133
|
+
'relative inline-flex h-fit w-fit max-w-full items-center font-inter',
|
|
134
|
+
// Every published Body style binds `--text-wrap-body` (_text-styles.json
|
|
135
|
+
// $textWrapRule). On `root`, where the per-size font lives; an arbitrary
|
|
136
|
+
// property because Tailwind has no textWrap namespace. The pill stays
|
|
137
|
+
// single-line — `truncate` on `label` is a direct declaration and outranks
|
|
138
|
+
// anything inherited from here.
|
|
139
|
+
'[text-wrap:var(--text-wrap-body)]',
|
|
140
|
+
// Morph motion: the container's colours only. outline-color is the hairline
|
|
141
|
+
// here (the focus ring is the `::before` band below), so it is listed on
|
|
142
|
+
// purpose. Instant under reduced motion.
|
|
143
|
+
'transition-[background-color,color,outline-color] duration-toggle ease-standard motion-reduce:transition-none',
|
|
144
|
+
// The focus ring: a `::before` offset band, declared once and transparent at
|
|
145
|
+
// rest so only its colour changes. It sits 4px outside the box with a 2px
|
|
146
|
+
// border, i.e. a 2px gap — the `focus-ring.md` offset geometry. Its radius is
|
|
147
|
+
// one step up the ladder and comes from the size variant.
|
|
148
|
+
"before:pointer-events-none before:absolute before:-inset-200 before:content-['']",
|
|
149
|
+
'before:border-200 before:border-transparent',
|
|
150
|
+
// Driven by the TRIGGER's focus, so a focused × (which rings itself) never
|
|
151
|
+
// lights the pill as well.
|
|
152
|
+
'has-[[data-fods-part=trigger]:focus-visible]:before:border-outline-focus',
|
|
153
|
+
],
|
|
154
|
+
trigger: [
|
|
155
|
+
'flex min-w-0 items-center self-stretch cursor-pointer',
|
|
156
|
+
// The ring is drawn on the root instead — see the root slot.
|
|
157
|
+
'focus-visible:outline-none',
|
|
158
|
+
'disabled:cursor-not-allowed',
|
|
159
|
+
],
|
|
160
|
+
leading: 'shrink-0',
|
|
161
|
+
label: 'min-w-0 truncate font-semibold',
|
|
162
|
+
count: 'shrink-0 font-normal',
|
|
163
|
+
caret: 'shrink-0',
|
|
164
|
+
clear: [
|
|
165
|
+
'relative inline-flex shrink-0 items-center justify-center rounded-200 cursor-pointer',
|
|
166
|
+
// 32×32 hit area — the dense-control tier accessibility.md names for toolbar
|
|
167
|
+
// controls (manifest 1.3.0 (b), which lifted the × off the 24×24 floor). The box
|
|
168
|
+
// is glyph-tight; the band is centred vertically, but horizontally it is anchored
|
|
169
|
+
// `--space-400` past the box's right edge, i.e. on the pill's edge (the root's
|
|
170
|
+
// `pr-400` on a Selected Facet), so the trailing padding is part of the target
|
|
171
|
+
// at both sizes. The root carries no `overflow-hidden`, since a clip there would
|
|
172
|
+
// crop the tap area back to the pill and silently undo the tier.
|
|
173
|
+
"before:absolute before:-right-400 before:top-1/2 before:size-900 before:content-['']",
|
|
174
|
+
'before:-translate-y-1/2',
|
|
175
|
+
// The × only exists on a Selected Facet, i.e. on the family SOLID fill, where
|
|
176
|
+
// --outline-focus is invisible (1.00:1 on --secondary-solid) — manifest 1.5.1
|
|
177
|
+
// `focus.note` binds the inverse ring here.
|
|
178
|
+
'focus-visible:outline focus-visible:outline-200 focus-visible:outline-outline-focus-inverse focus-visible:outline-offset-2',
|
|
179
|
+
'disabled:cursor-not-allowed',
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
variants: {
|
|
183
|
+
type: {
|
|
184
|
+
facet: {},
|
|
185
|
+
toggle: {},
|
|
186
|
+
},
|
|
187
|
+
/**
|
|
188
|
+
* ONE variant per manifest family — `kind: matrix`, `families` = Emotion ×
|
|
189
|
+
* Selection (the Checkbox precedent: selection is a family split, the states stay
|
|
190
|
+
* Default / Hover / Disabled). Derived in the component from `emotion` + the
|
|
191
|
+
* selection, never a public prop.
|
|
192
|
+
*
|
|
193
|
+
* Why a single combined axis rather than `emotion` × `selected` compounds: a
|
|
194
|
+
* family that takes TWO recipe selectors cannot be written into
|
|
195
|
+
* `data-fods-family`, which carries one value — the FODS verifier's
|
|
196
|
+
* `familyKeyOf` returns null for a multi-key selector and the
|
|
197
|
+
* runtime pass then reports every family as interaction-UNVERIFIED. Hover is the
|
|
198
|
+
* ENTIRE difference between Default and Hover here (the hairline swap on
|
|
199
|
+
* Unselected, the one-step-deeper fill on Selected), so leaving it ungraded would
|
|
200
|
+
* strip the only mechanical support DoD (b) has. One axis keeps it measurable.
|
|
201
|
+
*/
|
|
202
|
+
family: {
|
|
203
|
+
'neutral-unselected': {},
|
|
204
|
+
'neutral-selected': {},
|
|
205
|
+
'warning-unselected': {},
|
|
206
|
+
'warning-selected': {},
|
|
207
|
+
'danger-unselected': {},
|
|
208
|
+
'danger-selected': {},
|
|
209
|
+
},
|
|
210
|
+
/**
|
|
211
|
+
* The same selection, as a boolean — it drives STRUCTURE (which affordance
|
|
212
|
+
* renders, where the padding lands), not colour, and the two are deliberately
|
|
213
|
+
* separate: `disabled` collapses colour to one emotion-independent pair per
|
|
214
|
+
* selection, which is one compound on `selected` instead of six on `family`.
|
|
215
|
+
*/
|
|
216
|
+
selected: {
|
|
217
|
+
true: {},
|
|
218
|
+
false: {},
|
|
219
|
+
},
|
|
220
|
+
size: {
|
|
221
|
+
// No leading spelled out: `text-body-sm` carries the published Body/S
|
|
222
|
+
// `--leading-loose`, the same way `text-body-base` carries Body/M's
|
|
223
|
+
// `--leading-relaxed`.
|
|
224
|
+
sm: {
|
|
225
|
+
root: 'min-h-900 gap-300 rounded-300 text-body-sm before:rounded-400',
|
|
226
|
+
trigger: 'gap-300',
|
|
227
|
+
},
|
|
228
|
+
md: {
|
|
229
|
+
root: 'min-h-1000 gap-400 rounded-400 text-body-base before:rounded-500',
|
|
230
|
+
trigger: 'gap-400',
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
disabled: {
|
|
234
|
+
true: {
|
|
235
|
+
trigger: 'cursor-not-allowed',
|
|
236
|
+
clear: 'cursor-not-allowed',
|
|
237
|
+
},
|
|
238
|
+
false: {},
|
|
239
|
+
},
|
|
240
|
+
/**
|
|
241
|
+
* Derived from `leadingIcon != null`, never a public prop. The Pill law steps the
|
|
242
|
+
* padding down one step on an AFFORDANCE side, and `pill.md` counts a leading
|
|
243
|
+
* status glyph as one — so the left side is 12 on a label-only chip and 8 as soon
|
|
244
|
+
* as the glyph is there. Chip can hardcode this per type because its affordances
|
|
245
|
+
* are fixed per type; here the glyph is optional, so it needs its own axis (the
|
|
246
|
+
* `hasLeading` / `hasTrailing` shape `Button` uses).
|
|
247
|
+
*/
|
|
248
|
+
hasLeading: {
|
|
249
|
+
true: {},
|
|
250
|
+
false: {},
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
compoundVariants: [
|
|
254
|
+
// ——— Colour: ONE compound per manifest family × disabled ———
|
|
255
|
+
// Every colour class is keyed on `family` — including the greys, which are
|
|
256
|
+
// emotion-independent and would be one shared compound if legibility were the only
|
|
257
|
+
// concern. They are written per family so the FODS verifier can attribute each
|
|
258
|
+
// binding to the family it belongs to: its static pass filters the recipe by the
|
|
259
|
+
// family selector, and a class parked under `selected` alone reaches no family at
|
|
260
|
+
// all and goes unchecked. Twelve short blocks, one per row of the manifest.
|
|
261
|
+
|
|
262
|
+
// Unselected — outline chrome. `--bg-primary` fill plus the `--outline-default`
|
|
263
|
+
// hairline on the ::before overlay; hover swaps that hairline to the family solid
|
|
264
|
+
// and leaves the fill alone.
|
|
265
|
+
{
|
|
266
|
+
family: 'neutral-unselected',
|
|
267
|
+
disabled: false,
|
|
268
|
+
class: {
|
|
269
|
+
root: [
|
|
270
|
+
'bg-background-primary text-text-primary',
|
|
271
|
+
'outline outline-100 outline-outline-default -outline-offset-1',
|
|
272
|
+
'hover:outline-secondary-solid',
|
|
273
|
+
],
|
|
274
|
+
leading: 'text-icon-muted',
|
|
275
|
+
caret: 'text-icon-muted',
|
|
276
|
+
count: 'text-text-secondary',
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
family: 'warning-unselected',
|
|
281
|
+
disabled: false,
|
|
282
|
+
class: {
|
|
283
|
+
root: [
|
|
284
|
+
'bg-background-primary text-text-primary',
|
|
285
|
+
'outline outline-100 outline-outline-default -outline-offset-1',
|
|
286
|
+
'hover:outline-status-warning-solid',
|
|
287
|
+
],
|
|
288
|
+
leading: 'text-icon-muted',
|
|
289
|
+
caret: 'text-icon-muted',
|
|
290
|
+
count: 'text-text-secondary',
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
family: 'danger-unselected',
|
|
295
|
+
disabled: false,
|
|
296
|
+
class: {
|
|
297
|
+
root: [
|
|
298
|
+
'bg-background-primary text-text-primary',
|
|
299
|
+
'outline outline-100 outline-outline-default -outline-offset-1',
|
|
300
|
+
'hover:outline-status-danger-solid',
|
|
301
|
+
],
|
|
302
|
+
leading: 'text-icon-muted',
|
|
303
|
+
caret: 'text-icon-muted',
|
|
304
|
+
count: 'text-text-secondary',
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
|
|
308
|
+
// Selected — the family solid fill, hover one step deeper. No hairline: the
|
|
309
|
+
// Selected families carry no stroke, which is the whole reason the Unselected one
|
|
310
|
+
// is an overlay rather than a border (it would make the box 2px wider and the
|
|
311
|
+
// in-place morph would nudge the bar).
|
|
312
|
+
{
|
|
313
|
+
family: 'neutral-selected',
|
|
314
|
+
disabled: false,
|
|
315
|
+
class: {
|
|
316
|
+
root: 'bg-secondary-solid text-secondary-foreground hover:bg-secondary-hover',
|
|
317
|
+
leading: 'text-secondary-foreground',
|
|
318
|
+
count: 'text-secondary-foreground',
|
|
319
|
+
clear: 'text-secondary-foreground',
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
family: 'warning-selected',
|
|
324
|
+
disabled: false,
|
|
325
|
+
class: {
|
|
326
|
+
root: 'bg-status-warning-solid text-status-warning-foreground hover:bg-status-warning-hover',
|
|
327
|
+
leading: 'text-status-warning-foreground',
|
|
328
|
+
count: 'text-status-warning-foreground',
|
|
329
|
+
clear: 'text-status-warning-foreground',
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
family: 'danger-selected',
|
|
334
|
+
disabled: false,
|
|
335
|
+
class: {
|
|
336
|
+
root: 'bg-status-danger-solid text-status-danger-foreground hover:bg-status-danger-hover',
|
|
337
|
+
leading: 'text-status-danger-foreground',
|
|
338
|
+
count: 'text-status-danger-foreground',
|
|
339
|
+
clear: 'text-status-danger-foreground',
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
|
|
343
|
+
// Disabled — the selection survives structurally, not chromatically: Unselected
|
|
344
|
+
// keeps the outline chrome with grey content, Selected keeps a solid fill but in
|
|
345
|
+
// `--disabled-control` grey. Grey is emotion-independent, so a disabled Danger Toggle is
|
|
346
|
+
// indistinguishable from a disabled Neutral Facet — that is the spec, not a bug.
|
|
347
|
+
{
|
|
348
|
+
family: 'neutral-unselected',
|
|
349
|
+
disabled: true,
|
|
350
|
+
class: {
|
|
351
|
+
root: [
|
|
352
|
+
'bg-background-primary text-disabled-foreground',
|
|
353
|
+
'outline outline-100 outline-outline-default -outline-offset-1',
|
|
354
|
+
],
|
|
355
|
+
leading: 'text-disabled-foreground',
|
|
356
|
+
caret: 'text-disabled-foreground',
|
|
357
|
+
count: 'text-disabled-foreground',
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
family: 'warning-unselected',
|
|
362
|
+
disabled: true,
|
|
363
|
+
class: {
|
|
364
|
+
root: [
|
|
365
|
+
'bg-background-primary text-disabled-foreground',
|
|
366
|
+
'outline outline-100 outline-outline-default -outline-offset-1',
|
|
367
|
+
],
|
|
368
|
+
leading: 'text-disabled-foreground',
|
|
369
|
+
caret: 'text-disabled-foreground',
|
|
370
|
+
count: 'text-disabled-foreground',
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
family: 'danger-unselected',
|
|
375
|
+
disabled: true,
|
|
376
|
+
class: {
|
|
377
|
+
root: [
|
|
378
|
+
'bg-background-primary text-disabled-foreground',
|
|
379
|
+
'outline outline-100 outline-outline-default -outline-offset-1',
|
|
380
|
+
],
|
|
381
|
+
leading: 'text-disabled-foreground',
|
|
382
|
+
caret: 'text-disabled-foreground',
|
|
383
|
+
count: 'text-disabled-foreground',
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
family: 'neutral-selected',
|
|
388
|
+
disabled: true,
|
|
389
|
+
class: {
|
|
390
|
+
root: 'bg-disabled-control text-disabled-foreground',
|
|
391
|
+
leading: 'text-disabled-foreground',
|
|
392
|
+
count: 'text-disabled-foreground',
|
|
393
|
+
clear: 'text-disabled-foreground',
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
family: 'warning-selected',
|
|
398
|
+
disabled: true,
|
|
399
|
+
class: {
|
|
400
|
+
root: 'bg-disabled-control text-disabled-foreground',
|
|
401
|
+
leading: 'text-disabled-foreground',
|
|
402
|
+
count: 'text-disabled-foreground',
|
|
403
|
+
clear: 'text-disabled-foreground',
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
family: 'danger-selected',
|
|
408
|
+
disabled: true,
|
|
409
|
+
class: {
|
|
410
|
+
root: 'bg-disabled-control text-disabled-foreground',
|
|
411
|
+
leading: 'text-disabled-foreground',
|
|
412
|
+
count: 'text-disabled-foreground',
|
|
413
|
+
clear: 'text-disabled-foreground',
|
|
414
|
+
},
|
|
415
|
+
},
|
|
416
|
+
|
|
417
|
+
// ——— Inline padding, per side (manifest 1.5.1): icon side 8, text side 12 ———
|
|
418
|
+
// Always emitted as an explicit `pl-*` / `pr-*` pair rather than `px-*` plus an
|
|
419
|
+
// override — the reason `Button` gives for the same shape: no fragile merging.
|
|
420
|
+
// Left = the leading glyph's side, so it is the `hasLeading` axis. Right = the
|
|
421
|
+
// caret (Facet Unselected) or the × (Facet Selected); a Toggle ends in its label
|
|
422
|
+
// or count, a text run, so it keeps the base 12.
|
|
423
|
+
{ hasLeading: true, class: { trigger: 'pl-400' } },
|
|
424
|
+
{ hasLeading: false, class: { trigger: 'pl-500' } },
|
|
425
|
+
{ type: 'toggle', class: { trigger: 'pr-500' } },
|
|
426
|
+
{ type: 'facet', selected: false, class: { trigger: 'pr-400' } },
|
|
427
|
+
// A Selected Facet's right padding sits on the ROOT, not on the ×: padding on the ×
|
|
428
|
+
// made its box lopsided around the glyph, and the outline ring is derived from that
|
|
429
|
+
// box, so it slid off the glyph and past the pill's edge. The ×'s hit area is
|
|
430
|
+
// anchored to the end of this padding (`before:-right-400` on the clear slot), so
|
|
431
|
+
// it is no dead zone — keep the two in step.
|
|
432
|
+
// The trigger keeps no right padding — the gap between the two buttons is the
|
|
433
|
+
// root's own `gap-*`.
|
|
434
|
+
{ type: 'facet', selected: true, class: { root: 'pr-400' } },
|
|
435
|
+
],
|
|
436
|
+
defaultVariants: {
|
|
437
|
+
type: 'facet',
|
|
438
|
+
family: 'neutral-unselected',
|
|
439
|
+
selected: false,
|
|
440
|
+
size: 'md',
|
|
441
|
+
disabled: false,
|
|
442
|
+
hasLeading: true,
|
|
443
|
+
},
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
export type FilterChipType = 'facet' | 'toggle';
|
|
447
|
+
export type FilterChipEmotion = 'neutral' | 'warning' | 'danger';
|
|
448
|
+
export type FilterChipSize = 'sm' | 'md';
|
|
449
|
+
/** What a Facet's panel is — it decides the trigger's ARIA contract (manifest 1.7.0). */
|
|
450
|
+
export type FilterChipPopup = 'listbox' | 'dialog';
|
|
451
|
+
/**
|
|
452
|
+
* `emotion`-`selection` — the recipe's colour axis and one key per manifest family.
|
|
453
|
+
* Not a prop: the component derives it, so the two halves cannot drift apart.
|
|
454
|
+
*/
|
|
455
|
+
export type FilterChipFamily = `${FilterChipEmotion}-${'selected' | 'unselected'}`;
|
|
456
|
+
|
|
457
|
+
/** Glyph size per tier (manifest `sizes[].icon`): 16 → `xsmall`, 20 → `small`. */
|
|
458
|
+
const ICON_SIZE: Record<FilterChipSize, IconSize> = { sm: 'xsmall', md: 'small' };
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* The permissive base: every prop the chip accepts, with the accessible name of the
|
|
462
|
+
* × still optional. `FilterChipProps` below tightens it per type — but CSF's `Args`
|
|
463
|
+
* machinery cannot resolve a union prop type (the wall `Chip` and `RadioGroup` hit),
|
|
464
|
+
* so stories type themselves against THIS shape and the union does its work at the
|
|
465
|
+
* real callsites.
|
|
466
|
+
*/
|
|
467
|
+
export interface FilterChipBaseProps
|
|
468
|
+
extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children' | 'defaultChecked' | 'onClick'>,
|
|
469
|
+
Omit<
|
|
470
|
+
VariantProps<typeof filterChipVariants>,
|
|
471
|
+
'type' | 'family' | 'size' | 'disabled' | 'selected' | 'hasLeading'
|
|
472
|
+
> {
|
|
473
|
+
/**
|
|
474
|
+
* Composition:
|
|
475
|
+
* - `facet` (the default) — a trigger that opens an options panel and morphs into the
|
|
476
|
+
* applied value; its ARIA contract follows the panel, see `popup`;
|
|
477
|
+
* - `toggle` — a binary flag, `aria-pressed`, no panel.
|
|
478
|
+
*/
|
|
479
|
+
type?: FilterChipType;
|
|
480
|
+
/**
|
|
481
|
+
* Facet only: what kind of panel the trigger opens (`delivery.react`, manifest 1.7.0).
|
|
482
|
+
* - `listbox` (the default) — a single-value facet: `role="combobox"` +
|
|
483
|
+
* `aria-haspopup="listbox"`, focus stays on the trigger and the composition points
|
|
484
|
+
* at the current option through `aria-activedescendant`;
|
|
485
|
+
* - `dialog` — a multi-value facet whose panel is a Multi-select filter `role="group"`
|
|
486
|
+
* that focus moves INTO: a plain button with `aria-haspopup="dialog"`, never a
|
|
487
|
+
* combobox, and an `aria-activedescendant` arriving via `triggerProps` is dropped.
|
|
488
|
+
* A numeric range facet (Field Pair panel with a commit action, focus moves into the
|
|
489
|
+
* first field) takes `dialog` too — its panel holds no list (manifest 1.11.0).
|
|
490
|
+
*/
|
|
491
|
+
popup?: FilterChipPopup;
|
|
492
|
+
/**
|
|
493
|
+
* Facet only, `popup="listbox"`: the panel carries the search header (manifest 1.9.0
|
|
494
|
+
* `delivery.react`). The facet then follows the Combobox (search) pattern — the search
|
|
495
|
+
* input is the `role="combobox"` that owns ↑/↓ and `aria-activedescendant`, so the
|
|
496
|
+
* trigger drops both and stays a plain `<button aria-haspopup="listbox" aria-expanded>`.
|
|
497
|
+
*/
|
|
498
|
+
searchable?: boolean;
|
|
499
|
+
/**
|
|
500
|
+
* Colour family. `neutral` is the app's selection accent (`--secondary`).
|
|
501
|
+
* Warning / Danger are Toggle's risk flags — a Facet stays Neutral.
|
|
502
|
+
*/
|
|
503
|
+
emotion?: FilterChipEmotion;
|
|
504
|
+
/** `md` (40px, the default filter-bar density) or `sm` (32px) for dense bars. */
|
|
505
|
+
size?: FilterChipSize;
|
|
506
|
+
/**
|
|
507
|
+
* `--disabled-control` / `--disabled-foreground` greying — never `opacity`. Propagates to
|
|
508
|
+
* the trigger AND to the ×, both as a native `disabled` button.
|
|
509
|
+
*/
|
|
510
|
+
disabled?: boolean;
|
|
511
|
+
/**
|
|
512
|
+
* The chip's CATEGORY: the facet's category noun (Kraj, Dodavatel) or the flag's
|
|
513
|
+
* name (Nespolehlivý DPH). Sentence case, no terminal period, ≤ ~28 chars; it
|
|
514
|
+
* truncates rather than wraps.
|
|
515
|
+
*
|
|
516
|
+
* A Selected Facet renders `value` in its place — the morph is the component's job,
|
|
517
|
+
* not the caller's, so this prop does **not** switch to the applied value. It stays
|
|
518
|
+
* the category because the accessible name needs it in front of the value(s)
|
|
519
|
+
* ("Dodavatel: Čistota Plus, Datacentrum Sever, Pekárna Růžička") and because `clearLabel` names
|
|
520
|
+
* the same category on the ×.
|
|
521
|
+
*/
|
|
522
|
+
children: string;
|
|
523
|
+
className?: string;
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* The live result count under the current query. **Zero renders** — pass `0`, do
|
|
527
|
+
* not omit it (the check is `count != null`, never truthiness), and a Toggle at
|
|
528
|
+
* zero stays enabled. A bare locale-formatted integer: no parentheses, no unit noun.
|
|
529
|
+
*/
|
|
530
|
+
count?: number;
|
|
531
|
+
/** Locale grouping the digits of `count` (default `cs` → `1 284`) */
|
|
532
|
+
locale?: string;
|
|
533
|
+
/**
|
|
534
|
+
* Whether the count run renders at all (default `true`). Structurally inert on a
|
|
535
|
+
* **Facet**, which carries no count node in either selection state by design
|
|
536
|
+
* (manifest 1.3.0) — it only has an effect on `type="toggle"`.
|
|
537
|
+
*/
|
|
538
|
+
showCount?: boolean;
|
|
539
|
+
/**
|
|
540
|
+
* The leading glyph — the facet's category (`map-pin`, `briefcase`, `buildings`) or
|
|
541
|
+
* the flag's risk class from Badge's emotion→glyph map. `null` hides it. The Figma
|
|
542
|
+
* `Show leading` boolean and the `Leading` instance-swap collapse into this one
|
|
543
|
+
* slot prop, so an icon can never be asked for without a name to render.
|
|
544
|
+
*/
|
|
545
|
+
leadingIcon?: IconName | null;
|
|
546
|
+
|
|
547
|
+
/** Facet: whether the options panel is open — drives `aria-expanded`. */
|
|
548
|
+
open?: boolean;
|
|
549
|
+
/**
|
|
550
|
+
* Facet: the applied value(s). **Its presence is the selection** — the pill recolours
|
|
551
|
+
* and the caret becomes a ×; `undefined` (or an empty array) is the bare Unselected
|
|
552
|
+
* trigger.
|
|
553
|
+
*
|
|
554
|
+
* The chip renders it IN PLACE of `children`, which is why `children` stays the
|
|
555
|
+
* category noun in both directions (`intent.rules[1]`: the Facet morphs in place,
|
|
556
|
+
* one node each way). Several values OR together within the facet and the label
|
|
557
|
+
* collapses to `value +N` — `Čistota Plus +2` — never to "Dodavatel: 3", which would
|
|
558
|
+
* lose the concrete value the morph exists to show and would drag Czech numeral
|
|
559
|
+
* agreement into the atom (manifest 1.3.0, `text.label`).
|
|
560
|
+
*
|
|
561
|
+
* A collapsed label is never the sole carrier: the remainder is listed in a Tooltip
|
|
562
|
+
* and the full list goes into the accessible name (`intent.rules[6]`). Because of
|
|
563
|
+
* the Tooltip this case needs a `TooltipProvider` ancestor, the same requirement
|
|
564
|
+
* `Chip`'s info slot carries.
|
|
565
|
+
*/
|
|
566
|
+
value?: string | string[];
|
|
567
|
+
/** Facet: clears the applied value, returning the chip to its bare trigger. */
|
|
568
|
+
onClear?: () => void;
|
|
569
|
+
/**
|
|
570
|
+
* Accessible name of the icon-only × — REQUIRED for `type="facet"` and translated
|
|
571
|
+
* by the caller. An action naming the facet: `Zrušit filtr Kraj`, so a bar of chips
|
|
572
|
+
* does not announce the same name over and over.
|
|
573
|
+
*/
|
|
574
|
+
clearLabel?: string;
|
|
575
|
+
|
|
576
|
+
/** Toggle: controlled on/off state. */
|
|
577
|
+
checked?: boolean;
|
|
578
|
+
/** Toggle: uncontrolled initial state — the component owns it from there on. */
|
|
579
|
+
defaultChecked?: boolean;
|
|
580
|
+
/** Toggle: state change. Receives the new boolean, not the DOM event. */
|
|
581
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Activation of the chip body. It lands on the TRIGGER, not on the root: the root
|
|
585
|
+
* is a plain `<span>` and a click handler there would be neither keyboard-reachable
|
|
586
|
+
* nor disabled-aware. Every other rest prop still goes to the root.
|
|
587
|
+
*/
|
|
588
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Escape hatch for a COMPOSITION that owns the panel this Facet opens (`FilterFacet`).
|
|
592
|
+
* Spread onto the trigger `<button>` before the atom's own attributes, so the wiring a
|
|
593
|
+
* popover needs — `aria-controls`, `aria-activedescendant`, the list keyboard handler —
|
|
594
|
+
* lands on the element that actually holds focus. The root `<span>` cannot carry it:
|
|
595
|
+
* `aria-activedescendant` is only read on the focused node.
|
|
596
|
+
*
|
|
597
|
+
* The atom's own contract wins on collision. `type`, `disabled`, `aria-label`, `role`,
|
|
598
|
+
* `aria-haspopup`, `aria-expanded`, `aria-pressed` and `className` are written after
|
|
599
|
+
* the spread and cannot be overridden from here; route activation through `onClick`.
|
|
600
|
+
* With `popup="dialog"` `aria-activedescendant` is dropped as well — focus lives in
|
|
601
|
+
* that panel, so there is no active descendant to point at.
|
|
602
|
+
*/
|
|
603
|
+
triggerProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
604
|
+
/**
|
|
605
|
+
* Ref to the trigger `<button>` — the element that holds focus. The forwarded `ref`
|
|
606
|
+
* lands on the root `<span>`, which is not focusable, so a composition that has to
|
|
607
|
+
* return focus to the chip (a panel's dismissal) registers this one instead.
|
|
608
|
+
*/
|
|
609
|
+
triggerRef?: React.Ref<HTMLButtonElement>;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* The enforcing contract for the ×'s name. The × is icon-only, so it needs a name
|
|
614
|
+
* (WCAG 4.1.2) and may not fall back to a hardcoded Czech string on a ten-market
|
|
615
|
+
* atom — so the requirement is carried by the TYPE, not by a runtime default.
|
|
616
|
+
* `FilterChipBaseProps` keeps `clearLabel` optional and the intersection lets the
|
|
617
|
+
* required member win, so each branch only ever TIGHTENS the base.
|
|
618
|
+
*
|
|
619
|
+
* Exactly ONE union, keyed on `type`. TypeScript only distributes a source object
|
|
620
|
+
* over a discriminated target when there is a single such axis: intersect a second
|
|
621
|
+
* union and every `<FilterChip type={type}>` in the docs matrices stops compiling,
|
|
622
|
+
* because the union-typed `type` then matches no constituent (measured on `Chip`).
|
|
623
|
+
*/
|
|
624
|
+
export type FilterChipProps = FilterChipBaseProps &
|
|
625
|
+
({ type: 'toggle'; clearLabel?: string } | { type?: 'facet'; clearLabel: string });
|
|
626
|
+
|
|
627
|
+
const FilterChip = React.forwardRef<HTMLSpanElement, FilterChipProps>(
|
|
628
|
+
(
|
|
629
|
+
{
|
|
630
|
+
className,
|
|
631
|
+
triggerProps,
|
|
632
|
+
triggerRef,
|
|
633
|
+
type = 'facet',
|
|
634
|
+
popup = 'listbox',
|
|
635
|
+
searchable = false,
|
|
636
|
+
emotion = 'neutral',
|
|
637
|
+
size = 'md',
|
|
638
|
+
disabled = false,
|
|
639
|
+
children,
|
|
640
|
+
count,
|
|
641
|
+
locale = 'cs',
|
|
642
|
+
showCount = true,
|
|
643
|
+
leadingIcon = 'funnel-simple',
|
|
644
|
+
open = false,
|
|
645
|
+
value,
|
|
646
|
+
onClear,
|
|
647
|
+
clearLabel,
|
|
648
|
+
checked,
|
|
649
|
+
defaultChecked,
|
|
650
|
+
onCheckedChange,
|
|
651
|
+
onClick,
|
|
652
|
+
...props
|
|
653
|
+
},
|
|
654
|
+
ref,
|
|
655
|
+
) => {
|
|
656
|
+
const isFacet = type === 'facet';
|
|
657
|
+
const [uncontrolledChecked, setUncontrolledChecked] = React.useState(defaultChecked ?? false);
|
|
658
|
+
const isChecked = checked ?? uncontrolledChecked;
|
|
659
|
+
|
|
660
|
+
// One shape downstream, whether the caller applied one value or several. An empty
|
|
661
|
+
// array is the same statement as `undefined` — nothing is applied — so it must not
|
|
662
|
+
// recolour the pill into a Selected chip with no value in it.
|
|
663
|
+
const appliedValues = isFacet && value != null ? (Array.isArray(value) ? value : [value]) : [];
|
|
664
|
+
// Selection is DERIVED, so "Selected without a value" cannot be expressed.
|
|
665
|
+
const selected = isFacet ? appliedValues.length > 0 : isChecked;
|
|
666
|
+
// One key per manifest family, so the runtime pass can write it into
|
|
667
|
+
// `data-fods-family` and grade hover per family — see the `family` variant.
|
|
668
|
+
const family = `${emotion}-${selected ? 'selected' : 'unselected'}` as FilterChipFamily;
|
|
669
|
+
|
|
670
|
+
const slots = filterChipVariants({
|
|
671
|
+
type,
|
|
672
|
+
family,
|
|
673
|
+
selected,
|
|
674
|
+
size,
|
|
675
|
+
disabled,
|
|
676
|
+
hasLeading: leadingIcon != null,
|
|
677
|
+
});
|
|
678
|
+
const glyphSize = ICON_SIZE[size];
|
|
679
|
+
|
|
680
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
681
|
+
if (isFacet && emotion !== 'neutral') {
|
|
682
|
+
console.warn(
|
|
683
|
+
'FilterChip: Facet exists in Neutral only — Warning / Danger are Toggle\'s risk flags (emotion="' +
|
|
684
|
+
emotion +
|
|
685
|
+
'").',
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
if (isFacet && (checked != null || defaultChecked != null || onCheckedChange != null)) {
|
|
689
|
+
console.warn(
|
|
690
|
+
'FilterChip: `checked` / `defaultChecked` / `onCheckedChange` are Toggle-only; a Facet takes its selection from `value`.',
|
|
691
|
+
);
|
|
692
|
+
}
|
|
693
|
+
if (!isFacet && popup !== 'listbox') {
|
|
694
|
+
console.warn('FilterChip: `popup` is Facet-only — a Toggle opens no panel (type="toggle").');
|
|
695
|
+
}
|
|
696
|
+
if (!isFacet && (value != null || onClear != null)) {
|
|
697
|
+
console.warn(
|
|
698
|
+
'FilterChip: `value` / `onClear` are Facet-only affordances and are dropped for type="toggle".',
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
const innerTriggerRef = React.useRef<HTMLButtonElement | null>(null);
|
|
704
|
+
const setTriggerRef = React.useCallback(
|
|
705
|
+
(node: HTMLButtonElement | null) => {
|
|
706
|
+
innerTriggerRef.current = node;
|
|
707
|
+
if (typeof triggerRef === 'function') triggerRef(node);
|
|
708
|
+
else if (triggerRef) (triggerRef as React.MutableRefObject<HTMLButtonElement | null>).current = node;
|
|
709
|
+
},
|
|
710
|
+
[triggerRef],
|
|
711
|
+
);
|
|
712
|
+
|
|
713
|
+
// After the × clears, focus lands on this chip's own trigger (manifest 1.8.0). It
|
|
714
|
+
// cannot be moved inside the click handler: the × unmounts with the selection, and a
|
|
715
|
+
// collapsed chip's trigger is REMOUNTED as the remainder Tooltip unwraps it — so the
|
|
716
|
+
// move waits for the commit that drops the selection, when the new button exists.
|
|
717
|
+
const refocusAfterClearRef = React.useRef(false);
|
|
718
|
+
const handleClear = () => {
|
|
719
|
+
refocusAfterClearRef.current = true;
|
|
720
|
+
onClear?.();
|
|
721
|
+
};
|
|
722
|
+
React.useLayoutEffect(() => {
|
|
723
|
+
if (!refocusAfterClearRef.current || selected) return;
|
|
724
|
+
refocusAfterClearRef.current = false;
|
|
725
|
+
// Only when the × took focus down with it — a consumer that cleared from
|
|
726
|
+
// somewhere else (a "clear all" button) keeps the focus it has.
|
|
727
|
+
const active = document.activeElement;
|
|
728
|
+
if (active === null || active === document.body) innerTriggerRef.current?.focus();
|
|
729
|
+
}, [selected]);
|
|
730
|
+
|
|
731
|
+
const handleTriggerClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
732
|
+
onClick?.(event);
|
|
733
|
+
if (isFacet) return;
|
|
734
|
+
const next = !isChecked;
|
|
735
|
+
if (checked === undefined) setUncontrolledChecked(next);
|
|
736
|
+
onCheckedChange?.(next);
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
// Absent on a Facet ENTIRELY (manifest 1.3.0 / intent.rules[4]): Selected because
|
|
740
|
+
// those variants carry no count node, Unselected because a count answers "how many
|
|
741
|
+
// rows if I apply THIS" and a category is not appliable — the number it would show
|
|
742
|
+
// is the unfiltered total. The per-option counts live on the panel rows instead. A
|
|
743
|
+
// Toggle keeps its count, because the flag IS the thing being applied.
|
|
744
|
+
// Grouped in the `locale` prop ("1 284" in cs), not the browser's.
|
|
745
|
+
const countText = showCount && count != null && !isFacet ? count.toLocaleString(locale) : null;
|
|
746
|
+
|
|
747
|
+
// The elided remainder. `+N` is an elision, so it may never be the only carrier:
|
|
748
|
+
// the hidden values go into a Tooltip on the trigger AND into the accessible name.
|
|
749
|
+
const hiddenValues = appliedValues.slice(1);
|
|
750
|
+
const collapsed = hiddenValues.length > 0;
|
|
751
|
+
const labelText = selected && isFacet
|
|
752
|
+
? collapsed
|
|
753
|
+
? `${appliedValues[0]} +${hiddenValues.length}`
|
|
754
|
+
: appliedValues[0]
|
|
755
|
+
: children;
|
|
756
|
+
// The count is part of the ACCESSIBLE NAME, and the spec is exact about the string:
|
|
757
|
+
// "Plátce DPH, 18". Composing it here rather than leaving it to the name calculation
|
|
758
|
+
// over the label + count nodes is not belt-and-braces — those two nodes join with a
|
|
759
|
+
// SPACE, so the name came out "Plátce DPH , 18", and how much whitespace an
|
|
760
|
+
// implementation inserts between inline children is exactly the kind of thing that
|
|
761
|
+
// differs between engines. It cannot drift from what is on screen either: both come
|
|
762
|
+
// from the same two values in the same render. Absent when there is no count, so the
|
|
763
|
+
// name then falls back to the label (or to a Facet's applied value) on its own.
|
|
764
|
+
//
|
|
765
|
+
// A Facet trigger always gets an author name — the combobox (`popup="listbox"`)
|
|
766
|
+
// takes NO name from its content, and the dialog button follows suit so both
|
|
767
|
+
// facets announce the same string: the category, followed on a Selected Facet by every
|
|
768
|
+
// applied value — "Dodavatel: Čistota Plus, Datacentrum Sever, Pekárna Růžička". The visible
|
|
769
|
+
// `+2` says nothing to a screen reader, and spelling the value out keeps it in the
|
|
770
|
+
// name whether or not the platform exposes the content as the combobox's value.
|
|
771
|
+
// That is also why `children` stays the category on a Selected Facet.
|
|
772
|
+
const accessibleName = isFacet
|
|
773
|
+
? selected
|
|
774
|
+
? `${children}: ${appliedValues.join(', ')}`
|
|
775
|
+
: children
|
|
776
|
+
: countText !== null
|
|
777
|
+
? `${children}, ${countText}`
|
|
778
|
+
: undefined;
|
|
779
|
+
|
|
780
|
+
// A collapsed label is never the sole carrier of what is applied: the elided values
|
|
781
|
+
// are listed in a Tooltip as well (intent.rules[6]). The bubble attaches to the
|
|
782
|
+
// TRIGGER rather than to an inner span because Radix renders its own <button> unless
|
|
783
|
+
// it adopts the child as one — and a button inside a button is exactly the invalid
|
|
784
|
+
// nesting manifest 1.3.0 (a) had to undo for the ×. Hovering the pill is also what a
|
|
785
|
+
// reader does to ask "which ones?". Only this one case adds the `TooltipProvider`
|
|
786
|
+
// requirement; an uncollapsed chip renders the bare trigger as before.
|
|
787
|
+
const withRemainderTooltip = (trigger: React.ReactElement) =>
|
|
788
|
+
collapsed ? <Tooltip content={hiddenValues.join(', ')}>{trigger}</Tooltip> : trigger;
|
|
789
|
+
|
|
790
|
+
const isDialogFacet = isFacet && popup === 'dialog';
|
|
791
|
+
// Only a single-value facet without search is a combobox; the other two are plain
|
|
792
|
+
// buttons (manifest 1.9.0 `delivery.react`).
|
|
793
|
+
const isComboboxTrigger = isFacet && !isDialogFacet && !searchable;
|
|
794
|
+
// The atom owns the trigger's ARIA contract. A plain-button facet's focus moves into
|
|
795
|
+
// its panel, so an `aria-activedescendant` a composition forwards has nothing to
|
|
796
|
+
// point at — and it is not valid on a plain `button` anyway.
|
|
797
|
+
const {
|
|
798
|
+
'aria-activedescendant': activeDescendant,
|
|
799
|
+
...restTriggerProps
|
|
800
|
+
} = triggerProps ?? {};
|
|
801
|
+
|
|
802
|
+
return (
|
|
803
|
+
<span
|
|
804
|
+
ref={ref}
|
|
805
|
+
data-fods-component="filter-chip"
|
|
806
|
+
data-fods-part="root"
|
|
807
|
+
className={cn(slots.root(), className)}
|
|
808
|
+
{...props}
|
|
809
|
+
>
|
|
810
|
+
{withRemainderTooltip(
|
|
811
|
+
<button
|
|
812
|
+
{...restTriggerProps}
|
|
813
|
+
{...(isComboboxTrigger ? { 'aria-activedescendant': activeDescendant } : null)}
|
|
814
|
+
ref={setTriggerRef}
|
|
815
|
+
type="button"
|
|
816
|
+
data-fods-part="trigger"
|
|
817
|
+
disabled={disabled}
|
|
818
|
+
aria-disabled={disabled || undefined}
|
|
819
|
+
aria-label={accessibleName}
|
|
820
|
+
// The role follows the panel (manifest 1.6.0 / 1.7.0 `delivery.react`): a
|
|
821
|
+
// single-value Facet is a select-only combobox, because the
|
|
822
|
+
// `aria-activedescendant` its composition points at the current option is
|
|
823
|
+
// invalid on `button`; a multi-value Facet stays a plain button that opens a
|
|
824
|
+
// `group` panel focus moves into. A searchable single-value Facet hands the
|
|
825
|
+
// combobox role to its search input (manifest 1.9.0).
|
|
826
|
+
role={isComboboxTrigger ? 'combobox' : undefined}
|
|
827
|
+
aria-haspopup={isFacet ? popup : undefined}
|
|
828
|
+
// Explicitly "false" when closed — never undefined (a11y floor).
|
|
829
|
+
aria-expanded={isFacet ? open : undefined}
|
|
830
|
+
aria-pressed={isFacet ? undefined : isChecked}
|
|
831
|
+
onClick={handleTriggerClick}
|
|
832
|
+
className={slots.trigger()}
|
|
833
|
+
>
|
|
834
|
+
{leadingIcon && (
|
|
835
|
+
<Icon
|
|
836
|
+
name={leadingIcon}
|
|
837
|
+
size={glyphSize}
|
|
838
|
+
data-fods-part="leading"
|
|
839
|
+
className={slots.leading()}
|
|
840
|
+
/>
|
|
841
|
+
)}
|
|
842
|
+
<span data-fods-part="label" className={slots.label()}>
|
|
843
|
+
{labelText}
|
|
844
|
+
</span>
|
|
845
|
+
{countText !== null && (
|
|
846
|
+
<span data-fods-part="count" className={slots.count()}>
|
|
847
|
+
{countText}
|
|
848
|
+
</span>
|
|
849
|
+
)}
|
|
850
|
+
{isFacet && !selected && (
|
|
851
|
+
<MotionCaret open={open}>
|
|
852
|
+
<Icon
|
|
853
|
+
name="caret-down-small"
|
|
854
|
+
size={glyphSize}
|
|
855
|
+
data-fods-part="caret"
|
|
856
|
+
className={slots.caret()}
|
|
857
|
+
/>
|
|
858
|
+
</MotionCaret>
|
|
859
|
+
)}
|
|
860
|
+
</button>,
|
|
861
|
+
)}
|
|
862
|
+
{isFacet && selected && (
|
|
863
|
+
<button
|
|
864
|
+
type="button"
|
|
865
|
+
data-fods-part="clear"
|
|
866
|
+
aria-label={clearLabel}
|
|
867
|
+
disabled={disabled}
|
|
868
|
+
aria-disabled={disabled || undefined}
|
|
869
|
+
onClick={handleClear}
|
|
870
|
+
className={slots.clear()}
|
|
871
|
+
>
|
|
872
|
+
<Icon name="x" size={glyphSize} />
|
|
873
|
+
</button>
|
|
874
|
+
)}
|
|
875
|
+
</span>
|
|
876
|
+
);
|
|
877
|
+
},
|
|
878
|
+
);
|
|
879
|
+
FilterChip.displayName = 'FilterChip';
|
|
880
|
+
|
|
881
|
+
export { FilterChip, filterChipVariants };
|