@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,209 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { tv } from "../../internal/tailwind-variants.js";
|
|
3
|
+
import { Icon } from "../icon/Icon.js";
|
|
4
|
+
import { Tooltip } from "../tooltip/Tooltip.js";
|
|
5
|
+
import { cn } from "../../internal/utils.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
// src/components/column-header/ColumnHeader.tsx
|
|
9
|
+
/**
|
|
10
|
+
* ColumnHeader — the header cell that tops every table column (ui-system atom
|
|
11
|
+
* `column-header`, manifest 2.1.1, Figma node 6558-56373). A label, an optional
|
|
12
|
+
* one-line description under it, and a state-driven sort glyph.
|
|
13
|
+
*
|
|
14
|
+
* Token bindings (manifest `families[0]` "header", ghost — no fill in any state):
|
|
15
|
+
* - default: label `--text-secondary`, glyph `--icon-muted`
|
|
16
|
+
* - hover: label `--text-primary`, glyph `--text-secondary` (ink only, no wash)
|
|
17
|
+
* - sorted asc / desc: label and glyph `--text-primary`
|
|
18
|
+
* - description: `--text-secondary` in every state (`parts.description`)
|
|
19
|
+
* - sizes: min-height 44, pad-Y `--space-400`, pad-X `--space-500`, label↔glyph gap
|
|
20
|
+
* `--space-400`, label↔description gap 0, radius `--radius-0`, glyph 16
|
|
21
|
+
* - type: label Body/S Semibold (`typography.runs.label`), description Body/XXS Regular
|
|
22
|
+
* - focus: additive offset ring `--outline-focus` at `--border-width-200`, 2px out,
|
|
23
|
+
* on the sort button only — never a border on the cell
|
|
24
|
+
* - motion (2.1.1 `motion.states`): ink only, on --easing-standard — hover over
|
|
25
|
+
* --duration-hover, the Sorted cross-fade to --text-primary over --duration-toggle.
|
|
26
|
+
* The sort glyph swaps instantly (a sort direction, not a caret — it never rotates).
|
|
27
|
+
*
|
|
28
|
+
* State is NOT a prop (`properties.State.maps`: "driven by interaction + aria-sort").
|
|
29
|
+
* Hover is the CSS `:hover`; the sorted ink is derived from the `aria-sort` the
|
|
30
|
+
* consumer puts on the cell, so the indicator cannot disagree with what assistive
|
|
31
|
+
* tech announces.
|
|
32
|
+
*
|
|
33
|
+
* Layout notes:
|
|
34
|
+
* 1. HIT AREA — the sort button stretches over the whole cell (manifest sizes[].note:
|
|
35
|
+
* "the hit box is the 44px cell itself … must not collapse to the 22px text line").
|
|
36
|
+
* The padding therefore lives on the button, not on the `<th>`; the `<th>` only
|
|
37
|
+
* states the 44px height, which a table cell treats as a MIN-height and which gives
|
|
38
|
+
* the button's `h-full` a definite base to resolve against.
|
|
39
|
+
* 2. ALIGN is layout only — Right moves the whole label+glyph cluster to the trailing
|
|
40
|
+
* edge and right-aligns the text stack; the glyph stays trailing after the label.
|
|
41
|
+
* Center (presence / icon columns) centres the cluster and lets the stack hug; as
|
|
42
|
+
* a shrinkable flex item it caps the label at the cell minus padding, gap and glyph,
|
|
43
|
+
* which is the manifest's `max-width: calc(100% − 48px)` without a magic number.
|
|
44
|
+
* 3. LABEL stays on ONE line and ellipsises (manifest 2.0.0 `text.label`); the full
|
|
45
|
+
* string stays in the DOM, so the button's accessible name is never cut. While it is
|
|
46
|
+
* actually clipped, a Tooltip carries the full text (measured at open time, so a
|
|
47
|
+
* resized column needs no observer) — unless `tooltip` already names the full term.
|
|
48
|
+
*/
|
|
49
|
+
const columnHeaderVariants = tv({
|
|
50
|
+
slots: {
|
|
51
|
+
root: ["p-0 align-middle font-inter", "h-[44px]"],
|
|
52
|
+
sort: [
|
|
53
|
+
"flex h-full w-full items-center gap-400 px-500 py-400 rounded-0",
|
|
54
|
+
"border-0 bg-transparent text-text-secondary",
|
|
55
|
+
"transition-[color] duration-hover ease-standard"
|
|
56
|
+
],
|
|
57
|
+
stack: "flex min-w-0 flex-col",
|
|
58
|
+
label: "max-w-full truncate text-body-sm font-semibold [text-wrap-style:var(--text-wrap-body)]",
|
|
59
|
+
description: "w-full truncate text-body-xxs font-normal text-text-secondary",
|
|
60
|
+
icon: "shrink-0 text-icon-muted transition-[color] duration-hover ease-standard"
|
|
61
|
+
},
|
|
62
|
+
variants: {
|
|
63
|
+
align: {
|
|
64
|
+
left: {
|
|
65
|
+
root: "text-left",
|
|
66
|
+
sort: "justify-start text-left",
|
|
67
|
+
stack: "flex-1 items-start"
|
|
68
|
+
},
|
|
69
|
+
center: {
|
|
70
|
+
root: "text-center",
|
|
71
|
+
sort: "justify-center text-center",
|
|
72
|
+
stack: "flex-initial items-center"
|
|
73
|
+
},
|
|
74
|
+
right: {
|
|
75
|
+
root: "text-right",
|
|
76
|
+
sort: "justify-end text-right",
|
|
77
|
+
stack: "flex-1 items-end"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
sortable: {
|
|
81
|
+
true: { sort: ["group", "focus-visible:outline focus-visible:outline-200 focus-visible:outline-outline-focus focus-visible:outline-offset-2"] },
|
|
82
|
+
false: {}
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* The `disabled` prop: the resting look stays, but the pointer and the hover ink go,
|
|
86
|
+
* so the cell does not promise a sort it will not run. The hover classes therefore
|
|
87
|
+
* live in the `disabled: false` compounds below, not on `sortable`.
|
|
88
|
+
*/
|
|
89
|
+
disabled: {
|
|
90
|
+
true: {},
|
|
91
|
+
false: {}
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* Derived from `aria-sort` — never a prop. Declared after `sortable` so it wins the merge.
|
|
95
|
+
* `duration-toggle` is `motion.states.value`: CSS takes the duration from the state a
|
|
96
|
+
* transition lands in, so the cross-fade INTO Sorted runs on --duration-toggle even
|
|
97
|
+
* under the pointer; leaving Sorted lands in the resting state and runs on
|
|
98
|
+
* --duration-hover.
|
|
99
|
+
*/
|
|
100
|
+
sorted: {
|
|
101
|
+
none: {},
|
|
102
|
+
asc: {
|
|
103
|
+
sort: "text-text-primary duration-toggle",
|
|
104
|
+
icon: "text-text-primary group-hover:text-text-primary duration-toggle"
|
|
105
|
+
},
|
|
106
|
+
desc: {
|
|
107
|
+
sort: "text-text-primary duration-toggle",
|
|
108
|
+
icon: "text-text-primary group-hover:text-text-primary duration-toggle"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
compoundVariants: [
|
|
113
|
+
{
|
|
114
|
+
sortable: true,
|
|
115
|
+
disabled: false,
|
|
116
|
+
class: { sort: "cursor-pointer hover:text-text-primary" }
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
sortable: true,
|
|
120
|
+
disabled: true,
|
|
121
|
+
class: { sort: "cursor-default" }
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
sortable: true,
|
|
125
|
+
disabled: false,
|
|
126
|
+
sorted: "none",
|
|
127
|
+
class: { icon: "group-hover:text-text-secondary" }
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
defaultVariants: {
|
|
131
|
+
align: "left",
|
|
132
|
+
sortable: true,
|
|
133
|
+
disabled: false,
|
|
134
|
+
sorted: "none"
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
const SORT_GLYPH = {
|
|
138
|
+
none: "caret-up-down-small",
|
|
139
|
+
asc: "caret-up-small",
|
|
140
|
+
desc: "caret-down-small"
|
|
141
|
+
};
|
|
142
|
+
const ColumnHeader = React.forwardRef(({ className, align = "left", sortable = true, "aria-sort": ariaSort, onSort, disabled = false, description, tooltip, children, ...props }, ref) => {
|
|
143
|
+
const sorted = !sortable ? "none" : ariaSort === "ascending" ? "asc" : ariaSort === "descending" ? "desc" : "none";
|
|
144
|
+
const slots = columnHeaderVariants({
|
|
145
|
+
align,
|
|
146
|
+
sortable,
|
|
147
|
+
sorted,
|
|
148
|
+
disabled
|
|
149
|
+
});
|
|
150
|
+
const labelRef = React.useRef(null);
|
|
151
|
+
const [truncatedOpen, setTruncatedOpen] = React.useState(false);
|
|
152
|
+
const withTooltip = (trigger) => tooltip != null ? /* @__PURE__ */ jsx(Tooltip, {
|
|
153
|
+
content: tooltip,
|
|
154
|
+
children: trigger
|
|
155
|
+
}) : /* @__PURE__ */ jsx(Tooltip, {
|
|
156
|
+
content: children,
|
|
157
|
+
open: truncatedOpen,
|
|
158
|
+
onOpenChange: (next) => {
|
|
159
|
+
const el = labelRef.current;
|
|
160
|
+
setTruncatedOpen(next && el !== null && el.scrollWidth - el.clientWidth > 1);
|
|
161
|
+
},
|
|
162
|
+
children: trigger
|
|
163
|
+
});
|
|
164
|
+
const label = /* @__PURE__ */ jsx("span", {
|
|
165
|
+
ref: labelRef,
|
|
166
|
+
"data-fods-part": "label",
|
|
167
|
+
className: slots.label(),
|
|
168
|
+
children
|
|
169
|
+
});
|
|
170
|
+
const stack = /* @__PURE__ */ jsxs("span", {
|
|
171
|
+
className: slots.stack(),
|
|
172
|
+
children: [sortable ? label : withTooltip(label), description != null && /* @__PURE__ */ jsx("span", {
|
|
173
|
+
"data-fods-part": "description",
|
|
174
|
+
className: slots.description(),
|
|
175
|
+
children: description
|
|
176
|
+
})]
|
|
177
|
+
});
|
|
178
|
+
let content;
|
|
179
|
+
if (sortable) content = withTooltip(/* @__PURE__ */ jsxs("button", {
|
|
180
|
+
type: "button",
|
|
181
|
+
"data-fods-part": "sort",
|
|
182
|
+
className: slots.sort(),
|
|
183
|
+
"aria-disabled": disabled || void 0,
|
|
184
|
+
onClick: disabled ? void 0 : onSort,
|
|
185
|
+
children: [stack, /* @__PURE__ */ jsx(Icon, {
|
|
186
|
+
name: SORT_GLYPH[sorted],
|
|
187
|
+
size: "xsmall",
|
|
188
|
+
"data-fods-part": "icon",
|
|
189
|
+
className: slots.icon()
|
|
190
|
+
})]
|
|
191
|
+
}));
|
|
192
|
+
else content = /* @__PURE__ */ jsx("div", {
|
|
193
|
+
className: slots.sort(),
|
|
194
|
+
children: stack
|
|
195
|
+
});
|
|
196
|
+
return /* @__PURE__ */ jsx("th", {
|
|
197
|
+
ref,
|
|
198
|
+
"data-fods-component": "column-header",
|
|
199
|
+
"data-fods-part": "root",
|
|
200
|
+
...props,
|
|
201
|
+
scope: "col",
|
|
202
|
+
"aria-sort": sortable ? ariaSort : void 0,
|
|
203
|
+
"data-sorted": sortable ? sorted : void 0,
|
|
204
|
+
className: cn(slots.root(), className),
|
|
205
|
+
children: content
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
ColumnHeader.displayName = "ColumnHeader";
|
|
209
|
+
export { ColumnHeader, columnHeaderVariants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ColumnHeader, columnHeaderVariants } from "./ColumnHeader.js";
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ComboboxItem {
|
|
3
|
+
/** Stable identity of the row. */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Visible label — the row's first line and, once chosen, the trigger's value. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Second line of the row (e.g. `IČO 12345678 · Praha 3`). */
|
|
8
|
+
description?: React.ReactNode | React.ReactNode[];
|
|
9
|
+
/** Present but skipped by ↑/↓ and not selectable. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Forwarded to the row's `data-testid`. */
|
|
12
|
+
testId?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ComboboxProps {
|
|
15
|
+
/**
|
|
16
|
+
* The rows to show — ALREADY filtered. Narrowing is the caller's job: the query
|
|
17
|
+
* that produces them may be a local `String.includes` or a debounced ARES round
|
|
18
|
+
* trip, and the organism must not care which.
|
|
19
|
+
*/
|
|
20
|
+
items: ComboboxItem[];
|
|
21
|
+
/** The text in the input. Controlled, so a remote lookup can debounce off it. */
|
|
22
|
+
query: string;
|
|
23
|
+
onQueryChange: (query: string) => void;
|
|
24
|
+
/**
|
|
25
|
+
* The chosen item, not its id: the selection has to keep rendering its label in
|
|
26
|
+
* the trigger after the query narrowed `items` down to something that no longer
|
|
27
|
+
* contains it, and an id would have nothing left to resolve against.
|
|
28
|
+
*/
|
|
29
|
+
value?: ComboboxItem | null;
|
|
30
|
+
onValueChange?: (item: ComboboxItem | null) => void;
|
|
31
|
+
/** Mid-lookup — spinner in the trigger, `aria-busy`, and an announced status row. */
|
|
32
|
+
loading?: boolean;
|
|
33
|
+
/** Trigger height — Medium (48) / Small (40); rows drop one density step. */
|
|
34
|
+
size?: 'md' | 'sm';
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The manual-entry escape hatch („Zadám vše o subjektu ručně"), pinned below the
|
|
38
|
+
* results as a `link` row. An ACTION, not a value: on the anchored panel it is the
|
|
39
|
+
* last item of the ↑/↓ ring — `role="option"` without `aria-selected`, Enter runs
|
|
40
|
+
* it, it never takes the Selected look and is never committed as the value. On the
|
|
41
|
+
* mobile sheet it is a `ListRow` with `role="button"` in the fixed footer, reached with Tab.
|
|
42
|
+
*/
|
|
43
|
+
manualEntry?: ComboboxManualEntry;
|
|
44
|
+
/**
|
|
45
|
+
* Title of the mobile bottom sheet (combobox-field 1.11.0 `text.sheet-title`). Leave
|
|
46
|
+
* it empty when the field label names the field in full — the sheet then shows the
|
|
47
|
+
* label; set it when the label is abbreviated. Never shown on desktop.
|
|
48
|
+
*/
|
|
49
|
+
sheetTitle?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Accessible name of the visually hidden close button of the mobile bottom sheet.
|
|
52
|
+
* Defaults to «Zavřít» (Czech); an app with more language versions passes it from
|
|
53
|
+
* its translations.
|
|
54
|
+
*/
|
|
55
|
+
sheetCloseLabel?: string;
|
|
56
|
+
/** Empty-result copy — a plain noun phrase, never an apology. */
|
|
57
|
+
emptyLabel: string;
|
|
58
|
+
/** Announced while `loading`. */
|
|
59
|
+
loadingLabel: string;
|
|
60
|
+
/**
|
|
61
|
+
* Id of the visible text that names the panel. The panel is portalled out of
|
|
62
|
+
* the field and inherits no name from the input, so it points at the field's
|
|
63
|
+
* label (overlay-behavior.md § Naming). `Field` injects it — inside a labelled
|
|
64
|
+
* `Field` there is nothing to pass.
|
|
65
|
+
*/
|
|
66
|
+
panelLabelledBy?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Fallback name of the panel, used only when nothing visible names the field
|
|
69
|
+
* (no `Field` label, input named by `aria-label`) — then it has to be a
|
|
70
|
+
* translated string kept in step with that `aria-label`.
|
|
71
|
+
*/
|
|
72
|
+
panelLabel?: string;
|
|
73
|
+
/** Accessible name of the clear ×. Required — the button is icon-only. */
|
|
74
|
+
clearLabel: string;
|
|
75
|
+
/** Id on the input — `Field` reads it for `<label htmlFor>` / helper wiring. */
|
|
76
|
+
id?: string;
|
|
77
|
+
className?: string;
|
|
78
|
+
/** Accessible name when there is no `Field` label. */
|
|
79
|
+
'aria-label'?: string;
|
|
80
|
+
/** Set by `Field` when the field is in error. */
|
|
81
|
+
'aria-invalid'?: boolean;
|
|
82
|
+
/** Set by `Field` to point at the helper/error message. */
|
|
83
|
+
'aria-describedby'?: string;
|
|
84
|
+
/**
|
|
85
|
+
* `Field` injects its own status here. The Combobox trigger has NO error /
|
|
86
|
+
* success / disabled axis (combobox-field.md § States — registry validation
|
|
87
|
+
* lives on the manual-entry fields the escape hatch opens), so it is accepted
|
|
88
|
+
* and dropped; `aria-invalid` still passes through.
|
|
89
|
+
*/
|
|
90
|
+
state?: string;
|
|
91
|
+
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
92
|
+
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
93
|
+
'data-testid'?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface ComboboxManualEntry {
|
|
96
|
+
/** Visible label, which is also the accessible name — it states the action. */
|
|
97
|
+
label: string;
|
|
98
|
+
/** Runs the action; the panel closes first. */
|
|
99
|
+
onSelect: () => void;
|
|
100
|
+
/** Optional leading glyph of the `link` row (e.g. the `pencil-simple` icon). Decorative. */
|
|
101
|
+
icon?: React.ReactNode;
|
|
102
|
+
}
|
|
103
|
+
declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
104
|
+
export { Combobox };
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Icon } from "../icon/Icon.js";
|
|
3
|
+
import { cn } from "../../internal/utils.js";
|
|
4
|
+
import { ComboboxField } from "./ComboboxField.js";
|
|
5
|
+
import { ListRow } from "../list-row/ListRow.js";
|
|
6
|
+
import { AnchoredPanel as AnchoredPanelWithGroup } from "../anchored-panel/AnchoredPanel.js";
|
|
7
|
+
import { useAnchoredPanel } from "../../internal/useAnchoredPanel.js";
|
|
8
|
+
import { comboboxKeyDown, seekEnabled } from "../../internal/comboboxKeys.js";
|
|
9
|
+
import { BottomSheet as BottomSheetWithGroup, BottomSheetSearch, resolveFieldLabel, useSheetPresentation } from "../../internal/BottomSheet.js";
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
// src/components/combobox-field/Combobox.tsx
|
|
13
|
+
const Combobox = React.forwardRef(({ items, query, onQueryChange, value = null, onValueChange, loading = false, size = "md", placeholder, manualEntry, sheetTitle, sheetCloseLabel, emptyLabel, loadingLabel, panelLabelledBy, panelLabel, clearLabel, id, className, onFocus, onBlur, "aria-label": ariaLabel, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, "data-testid": dataTestid }, forwardedRef) => {
|
|
14
|
+
const [open, setOpen] = React.useState(false);
|
|
15
|
+
const [activeIndex, setActiveIndex] = React.useState(null);
|
|
16
|
+
const isSheet = useSheetPresentation();
|
|
17
|
+
const [fieldLabel, setFieldLabel] = React.useState("");
|
|
18
|
+
const panelUnnamed = !panelLabelledBy && !panelLabel;
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
if (process.env.NODE_ENV !== "production" && panelUnnamed) console.warn("Combobox: the result listbox has no accessible name — wrap it in a labelled `Field`, or pass `panelLabel` when nothing visible names the field.");
|
|
21
|
+
}, [panelUnnamed]);
|
|
22
|
+
const reactId = React.useId();
|
|
23
|
+
const optionId = (index) => `${reactId}-option-${index}`;
|
|
24
|
+
const sheetListboxId = `${reactId}-sheet-listbox`;
|
|
25
|
+
const sheetTitleId = `${reactId}-sheet-title`;
|
|
26
|
+
const sheetSearchRef = React.useRef(null);
|
|
27
|
+
const manualIndex = manualEntry && !isSheet ? items.length : null;
|
|
28
|
+
const ringCount = items.length + (manualIndex != null ? 1 : 0);
|
|
29
|
+
const isRingDisabled = React.useCallback((index) => index < items.length && (loading || items[index].disabled === true), [items, loading]);
|
|
30
|
+
const inputRef = React.useRef(null);
|
|
31
|
+
const setInputRef = React.useCallback((node) => {
|
|
32
|
+
inputRef.current = node;
|
|
33
|
+
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
34
|
+
else if (forwardedRef) forwardedRef.current = node;
|
|
35
|
+
}, [forwardedRef]);
|
|
36
|
+
const panel = useAnchoredPanel({
|
|
37
|
+
open: open && !isSheet,
|
|
38
|
+
onOpenChange: setOpen,
|
|
39
|
+
role: "listbox",
|
|
40
|
+
focusModel: "virtual",
|
|
41
|
+
widthPolicy: "trigger",
|
|
42
|
+
navigation: "none",
|
|
43
|
+
itemCount: 0,
|
|
44
|
+
typeahead: false
|
|
45
|
+
});
|
|
46
|
+
const selectedValue = value?.value;
|
|
47
|
+
const manualChosenRef = React.useRef(false);
|
|
48
|
+
const navigate = React.useCallback((action) => {
|
|
49
|
+
const next = typeof action === "function" ? action(activeIndex) : action;
|
|
50
|
+
manualChosenRef.current = next != null && next === manualIndex && items.some((_, index) => !isRingDisabled(index));
|
|
51
|
+
setActiveIndex(next);
|
|
52
|
+
}, [
|
|
53
|
+
activeIndex,
|
|
54
|
+
manualIndex,
|
|
55
|
+
items,
|
|
56
|
+
isRingDisabled
|
|
57
|
+
]);
|
|
58
|
+
const prevManualIndexRef = React.useRef(manualIndex);
|
|
59
|
+
React.useEffect(() => {
|
|
60
|
+
const prevManualIndex = prevManualIndexRef.current;
|
|
61
|
+
prevManualIndexRef.current = manualIndex;
|
|
62
|
+
const keepManual = open && manualChosenRef.current && manualIndex != null;
|
|
63
|
+
if (!keepManual) manualChosenRef.current = false;
|
|
64
|
+
setActiveIndex((current) => {
|
|
65
|
+
if (!open) return null;
|
|
66
|
+
if (keepManual) return manualIndex;
|
|
67
|
+
const seat = current === prevManualIndex || current === manualIndex ? null : current;
|
|
68
|
+
if (seat != null && seat < ringCount && !isRingDisabled(seat)) return seat;
|
|
69
|
+
const selectedIndex = selectedValue == null ? -1 : items.findIndex((item) => item.value === selectedValue);
|
|
70
|
+
if (selectedIndex >= 0 && !isRingDisabled(selectedIndex)) return selectedIndex;
|
|
71
|
+
return seekEnabled(ringCount, isRingDisabled, 0, 1);
|
|
72
|
+
});
|
|
73
|
+
}, [
|
|
74
|
+
items,
|
|
75
|
+
ringCount,
|
|
76
|
+
manualIndex,
|
|
77
|
+
isRingDisabled,
|
|
78
|
+
open,
|
|
79
|
+
selectedValue
|
|
80
|
+
]);
|
|
81
|
+
const closePanel = React.useCallback(() => {
|
|
82
|
+
setOpen(false);
|
|
83
|
+
setActiveIndex(null);
|
|
84
|
+
inputRef.current?.focus();
|
|
85
|
+
}, []);
|
|
86
|
+
const dismiss = React.useCallback(() => {
|
|
87
|
+
if (isSheet) {
|
|
88
|
+
setOpen(false);
|
|
89
|
+
setActiveIndex(null);
|
|
90
|
+
} else closePanel();
|
|
91
|
+
}, [isSheet, closePanel]);
|
|
92
|
+
const runManualEntry = React.useCallback(() => {
|
|
93
|
+
if (!manualEntry) return;
|
|
94
|
+
dismiss();
|
|
95
|
+
manualEntry.onSelect();
|
|
96
|
+
}, [manualEntry, dismiss]);
|
|
97
|
+
const commit = React.useCallback((index) => {
|
|
98
|
+
if (index === manualIndex) {
|
|
99
|
+
runManualEntry();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const item = items[index];
|
|
103
|
+
if (!item || item.disabled || loading) return;
|
|
104
|
+
onValueChange?.(item);
|
|
105
|
+
dismiss();
|
|
106
|
+
}, [
|
|
107
|
+
items,
|
|
108
|
+
loading,
|
|
109
|
+
onValueChange,
|
|
110
|
+
dismiss,
|
|
111
|
+
manualIndex,
|
|
112
|
+
runManualEntry
|
|
113
|
+
]);
|
|
114
|
+
React.useEffect(() => {
|
|
115
|
+
if (!open || activeIndex == null) return;
|
|
116
|
+
panel.listRef.current[activeIndex]?.scrollIntoView({ block: "nearest" });
|
|
117
|
+
}, [
|
|
118
|
+
open,
|
|
119
|
+
activeIndex,
|
|
120
|
+
panel.listRef
|
|
121
|
+
]);
|
|
122
|
+
const openSheet = () => {
|
|
123
|
+
setFieldLabel(resolveFieldLabel(inputRef.current));
|
|
124
|
+
setOpen(true);
|
|
125
|
+
};
|
|
126
|
+
const handleChange = (event) => {
|
|
127
|
+
if (value) onValueChange?.(null);
|
|
128
|
+
manualChosenRef.current = false;
|
|
129
|
+
onQueryChange(event.target.value);
|
|
130
|
+
setOpen(true);
|
|
131
|
+
};
|
|
132
|
+
const handleKeyDown = (event) => {
|
|
133
|
+
if (isSheet) {
|
|
134
|
+
if ([
|
|
135
|
+
"ArrowDown",
|
|
136
|
+
"ArrowUp",
|
|
137
|
+
"Enter",
|
|
138
|
+
" "
|
|
139
|
+
].includes(event.key)) {
|
|
140
|
+
event.preventDefault();
|
|
141
|
+
openSheet();
|
|
142
|
+
}
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (event.key === "Tab") {
|
|
146
|
+
if (open) {
|
|
147
|
+
setOpen(false);
|
|
148
|
+
setActiveIndex(null);
|
|
149
|
+
}
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
comboboxKeyDown(event, {
|
|
153
|
+
open,
|
|
154
|
+
activeIndex,
|
|
155
|
+
count: ringCount,
|
|
156
|
+
isDisabled: isRingDisabled,
|
|
157
|
+
setActiveIndex: navigate,
|
|
158
|
+
onOpen: () => setOpen(true),
|
|
159
|
+
onCommit: commit,
|
|
160
|
+
onEscape: () => {
|
|
161
|
+
onQueryChange("");
|
|
162
|
+
closePanel();
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
const handleSheetKeyDown = (event) => {
|
|
167
|
+
if (event.key === "Escape" || event.key === "Tab") return;
|
|
168
|
+
comboboxKeyDown(event, {
|
|
169
|
+
open,
|
|
170
|
+
activeIndex,
|
|
171
|
+
count: ringCount,
|
|
172
|
+
isDisabled: isRingDisabled,
|
|
173
|
+
setActiveIndex: navigate,
|
|
174
|
+
onOpen: () => setOpen(true),
|
|
175
|
+
onCommit: commit,
|
|
176
|
+
onEscape: dismiss
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
const handleTriggerPointerDown = (event) => {
|
|
180
|
+
if (isSheet || event.target !== inputRef.current) return;
|
|
181
|
+
setOpen(true);
|
|
182
|
+
};
|
|
183
|
+
const handleTriggerMouseDown = (event) => {
|
|
184
|
+
if (isSheet || event.target === inputRef.current) return;
|
|
185
|
+
if (event.target.closest("button")) return;
|
|
186
|
+
event.preventDefault();
|
|
187
|
+
inputRef.current?.focus();
|
|
188
|
+
setOpen(true);
|
|
189
|
+
};
|
|
190
|
+
const handleTriggerClick = (event) => {
|
|
191
|
+
if (!isSheet || event.target.closest("button")) return;
|
|
192
|
+
openSheet();
|
|
193
|
+
};
|
|
194
|
+
const triggerState = isSheet ? value ? "selected" : "default" : loading ? "loading" : value ? "selected" : open ? "open" : "default";
|
|
195
|
+
const clearProps = triggerState === "selected" ? {
|
|
196
|
+
state: "selected",
|
|
197
|
+
clearLabel,
|
|
198
|
+
onClear: () => {
|
|
199
|
+
onValueChange?.(null);
|
|
200
|
+
onQueryChange("");
|
|
201
|
+
inputRef.current?.focus();
|
|
202
|
+
}
|
|
203
|
+
} : { state: triggerState };
|
|
204
|
+
const hasStatusRow = loading || items.length === 0;
|
|
205
|
+
const fieldInteraction = isSheet ? {
|
|
206
|
+
readOnly: true,
|
|
207
|
+
"aria-haspopup": "dialog",
|
|
208
|
+
"aria-expanded": open
|
|
209
|
+
} : {
|
|
210
|
+
onChange: handleChange,
|
|
211
|
+
"aria-expanded": open,
|
|
212
|
+
"aria-controls": panel.isMounted ? panel.context.floatingId : void 0,
|
|
213
|
+
"aria-activedescendant": open && activeIndex != null ? optionId(activeIndex) : void 0
|
|
214
|
+
};
|
|
215
|
+
const renderResults = (rowSize) => hasStatusRow ? /* @__PURE__ */ jsx("div", {
|
|
216
|
+
role: "status",
|
|
217
|
+
"aria-live": "polite",
|
|
218
|
+
children: /* @__PURE__ */ jsx(ListRow, {
|
|
219
|
+
size: rowSize,
|
|
220
|
+
disabled: true,
|
|
221
|
+
children: loading ? loadingLabel : emptyLabel
|
|
222
|
+
})
|
|
223
|
+
}) : items.map((item, index) => {
|
|
224
|
+
const isSelected = value?.value === item.value;
|
|
225
|
+
const isMobileRow = rowSize === "mobile";
|
|
226
|
+
return /* @__PURE__ */ jsx(ListRow, {
|
|
227
|
+
ref: (node) => {
|
|
228
|
+
panel.listRef.current[index] = node;
|
|
229
|
+
},
|
|
230
|
+
id: optionId(index),
|
|
231
|
+
role: "option",
|
|
232
|
+
"data-fods-part": "option",
|
|
233
|
+
size: rowSize,
|
|
234
|
+
description: item.description,
|
|
235
|
+
highlighted: activeIndex === index,
|
|
236
|
+
disabled: item.disabled,
|
|
237
|
+
"aria-selected": isSelected,
|
|
238
|
+
"data-testid": item.testId,
|
|
239
|
+
selected: isSelected,
|
|
240
|
+
...isMobileRow ? { trailing: isSelected ? /* @__PURE__ */ jsx(Icon, {
|
|
241
|
+
name: "check",
|
|
242
|
+
className: "text-secondary"
|
|
243
|
+
}) : void 0 } : { leading: /* @__PURE__ */ jsx(Icon, {
|
|
244
|
+
name: "check",
|
|
245
|
+
className: cn(isSelected ? "text-secondary" : "invisible")
|
|
246
|
+
}) },
|
|
247
|
+
onPointerEnter: () => navigate(index),
|
|
248
|
+
onClick: () => commit(index),
|
|
249
|
+
children: item.label
|
|
250
|
+
}, item.value);
|
|
251
|
+
});
|
|
252
|
+
const sheetTitleText = sheetTitle || fieldLabel || ariaLabel || panelLabel;
|
|
253
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
254
|
+
/* @__PURE__ */ jsx("div", {
|
|
255
|
+
ref: panel.refs.setReference,
|
|
256
|
+
onPointerDown: handleTriggerPointerDown,
|
|
257
|
+
onMouseDown: handleTriggerMouseDown,
|
|
258
|
+
onClick: handleTriggerClick,
|
|
259
|
+
"data-testid": dataTestid,
|
|
260
|
+
children: /* @__PURE__ */ jsx(ComboboxField, {
|
|
261
|
+
...clearProps,
|
|
262
|
+
ref: setInputRef,
|
|
263
|
+
id,
|
|
264
|
+
size,
|
|
265
|
+
className,
|
|
266
|
+
value: value ? value.label : query,
|
|
267
|
+
placeholder,
|
|
268
|
+
onKeyDown: handleKeyDown,
|
|
269
|
+
onFocus,
|
|
270
|
+
onBlur,
|
|
271
|
+
"aria-label": ariaLabel,
|
|
272
|
+
"aria-invalid": ariaInvalid,
|
|
273
|
+
"aria-describedby": ariaDescribedby,
|
|
274
|
+
...fieldInteraction
|
|
275
|
+
})
|
|
276
|
+
}),
|
|
277
|
+
isSheet && /* @__PURE__ */ jsx(BottomSheetWithGroup, {
|
|
278
|
+
open,
|
|
279
|
+
onOpenChange: (next) => {
|
|
280
|
+
setOpen(next);
|
|
281
|
+
if (!next) setActiveIndex(null);
|
|
282
|
+
},
|
|
283
|
+
title: sheetTitleText,
|
|
284
|
+
titleId: sheetTitleId,
|
|
285
|
+
closeLabel: sheetCloseLabel,
|
|
286
|
+
initialFocus: () => sheetSearchRef.current,
|
|
287
|
+
returnFocusRef: inputRef,
|
|
288
|
+
owner: "combobox",
|
|
289
|
+
search: /* @__PURE__ */ jsx(BottomSheetSearch, {
|
|
290
|
+
ref: sheetSearchRef,
|
|
291
|
+
role: "combobox",
|
|
292
|
+
"aria-autocomplete": "list",
|
|
293
|
+
"aria-expanded": open,
|
|
294
|
+
"aria-controls": sheetListboxId,
|
|
295
|
+
"aria-activedescendant": activeIndex != null ? optionId(activeIndex) : void 0,
|
|
296
|
+
"aria-busy": loading || void 0,
|
|
297
|
+
"aria-labelledby": sheetTitleId,
|
|
298
|
+
value: query,
|
|
299
|
+
placeholder,
|
|
300
|
+
onChange: handleChange,
|
|
301
|
+
onKeyDown: handleSheetKeyDown
|
|
302
|
+
}),
|
|
303
|
+
footer: manualEntry ? /* @__PURE__ */ jsx(BottomSheetWithGroup.Group, {
|
|
304
|
+
className: "pb-[calc(var(--space-400)+env(safe-area-inset-bottom))]",
|
|
305
|
+
children: /* @__PURE__ */ jsx(ListRow, {
|
|
306
|
+
variant: "link",
|
|
307
|
+
size: "mobile",
|
|
308
|
+
role: "button",
|
|
309
|
+
tabIndex: 0,
|
|
310
|
+
"data-fods-part": "manual-entry",
|
|
311
|
+
leading: manualEntry.icon,
|
|
312
|
+
className: "outline-none focus-visible:ring-200 focus-visible:ring-inset focus-visible:ring-outline-focus",
|
|
313
|
+
onClick: runManualEntry,
|
|
314
|
+
onKeyDown: (event) => {
|
|
315
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
316
|
+
event.preventDefault();
|
|
317
|
+
runManualEntry();
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
children: manualEntry.label
|
|
321
|
+
})
|
|
322
|
+
}) : void 0,
|
|
323
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
324
|
+
id: sheetListboxId,
|
|
325
|
+
role: "listbox",
|
|
326
|
+
"aria-labelledby": sheetTitleId,
|
|
327
|
+
children: /* @__PURE__ */ jsx(BottomSheetWithGroup.Group, { children: renderResults("mobile") })
|
|
328
|
+
})
|
|
329
|
+
}),
|
|
330
|
+
/* @__PURE__ */ jsx(AnchoredPanelWithGroup, {
|
|
331
|
+
panel,
|
|
332
|
+
size,
|
|
333
|
+
focusModel: "virtual",
|
|
334
|
+
panelProps: panelLabelledBy ? { "aria-labelledby": panelLabelledBy } : { "aria-label": panelLabel },
|
|
335
|
+
footer: manualIndex != null && manualEntry ? /* @__PURE__ */ jsx(AnchoredPanelWithGroup.Group, { children: /* @__PURE__ */ jsx(ListRow, {
|
|
336
|
+
ref: (node) => {
|
|
337
|
+
panel.listRef.current[manualIndex] = node;
|
|
338
|
+
},
|
|
339
|
+
id: optionId(manualIndex),
|
|
340
|
+
role: "option",
|
|
341
|
+
variant: "link",
|
|
342
|
+
size,
|
|
343
|
+
"data-fods-part": "manual-entry",
|
|
344
|
+
leading: manualEntry.icon,
|
|
345
|
+
highlighted: activeIndex === manualIndex,
|
|
346
|
+
onPointerEnter: () => navigate(manualIndex),
|
|
347
|
+
onClick: runManualEntry,
|
|
348
|
+
children: manualEntry.label
|
|
349
|
+
}) }) : void 0,
|
|
350
|
+
children: /* @__PURE__ */ jsx(AnchoredPanelWithGroup.Group, { children: renderResults(size) })
|
|
351
|
+
})
|
|
352
|
+
] });
|
|
353
|
+
});
|
|
354
|
+
Combobox.displayName = "Combobox";
|
|
355
|
+
export { Combobox };
|