@invoiceonline/ui-react 0.0.0-stage → 0.1.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 +99 -0
- package/CHANGELOG.md +131 -0
- package/LICENSE +9 -0
- package/README.md +78 -2
- 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-field/DateField.d.ts +52 -0
- package/dist/components/date-field/DateField.js +45 -0
- package/dist/components/date-field/index.d.ts +2 -0
- package/dist/components/date-field/index.js +1 -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 +118 -0
- package/dist/components/field/Field.js +327 -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 +194 -0
- package/dist/components/field-pair/FieldPair.js +321 -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 +65 -0
- package/dist/components/text-field/TextField.js +173 -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 +132 -0
- package/dist/index.js +75 -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.js +183 -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 +37 -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 +379 -0
- package/docs/Contributing.mdx +78 -0
- package/docs/ForAgents.mdx +53 -0
- package/docs/Introduction.mdx +54 -0
- package/llms.txt +556 -0
- package/package.json +357 -4
- 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-field/DateField.mdx +340 -0
- package/src/components/date-field/DateField.stories.tsx +221 -0
- package/src/components/date-field/DateField.tsx +176 -0
- package/src/components/date-field/index.ts +1 -0
- package/src/components/date-picker/DatePicker.mdx +436 -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 +765 -0
- package/src/components/field/index.ts +20 -0
- package/src/components/field-pair/FieldPair.mdx +308 -0
- package/src/components/field-pair/FieldPair.stories.tsx +530 -0
- package/src/components/field-pair/FieldPair.tsx +796 -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 +479 -0
- package/src/components/text-field/TextField.stories.tsx +366 -0
- package/src/components/text-field/TextField.tsx +391 -0
- package/src/components/text-field/index.ts +8 -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 +71 -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 +357 -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 +47 -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 +355 -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,1189 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ColumnDef, ColumnVisibilityState, RowData, SortingState } from '@tanstack/react-table';
|
|
3
|
+
import { Badge } from '../badge/Badge';
|
|
4
|
+
import { Chip, type ChipEmotion } from '../chip/Chip';
|
|
5
|
+
import { Icon } from '../icon/Icon';
|
|
6
|
+
import { TextLink } from '../text-link/TextLink';
|
|
7
|
+
import { TableChildRowPrefix } from '../../internal/table/ChildRowPrefix';
|
|
8
|
+
import { createTableColumnHelper, type TableFeatureSet } from '../../internal/table/features';
|
|
9
|
+
import type {
|
|
10
|
+
TableMobileConfig,
|
|
11
|
+
TablePaginationLabels,
|
|
12
|
+
TableRowAction,
|
|
13
|
+
TableColumnVisibility,
|
|
14
|
+
TableMobileLoadMore,
|
|
15
|
+
} from '../../internal/table/types';
|
|
16
|
+
import { useTableLayout } from '../../internal/table/TableLayout';
|
|
17
|
+
|
|
18
|
+
// Money formatting belongs to the consumer; this stand-in only feeds the stories.
|
|
19
|
+
const formatCurrency = (amount: number) =>
|
|
20
|
+
new Intl.NumberFormat('cs-CZ', {
|
|
21
|
+
style: 'currency',
|
|
22
|
+
currency: 'CZK',
|
|
23
|
+
minimumFractionDigits: 2,
|
|
24
|
+
maximumFractionDigits: 2,
|
|
25
|
+
useGrouping: true,
|
|
26
|
+
}).format(amount);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Mock data + column definitions for the three consumer grids of the Table organism
|
|
30
|
+
* (`table.manifest.json` → `chrome.consumer-grids`: an invoice list with child rows, a
|
|
31
|
+
* contact list, an expense list).
|
|
32
|
+
*
|
|
33
|
+
* A `.ts` file on purpose (shared fixtures, no story exports), so cells are built with
|
|
34
|
+
* `React.createElement` (`h`) instead of JSX. Column arrays live at MODULE scope — the
|
|
35
|
+
* organism requires referentially stable `columns`.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
const h = React.createElement;
|
|
39
|
+
|
|
40
|
+
const noop = () => undefined;
|
|
41
|
+
|
|
42
|
+
// ── Formatting ───────────────────────────────────────────────────────────────
|
|
43
|
+
|
|
44
|
+
const DATE_FORMAT = new Intl.DateTimeFormat('cs-CZ', { day: 'numeric', month: 'numeric', year: 'numeric' });
|
|
45
|
+
|
|
46
|
+
/** ISO `YYYY-MM-DD` → Czech `14. 3. 2024`. */
|
|
47
|
+
export const formatDate = (iso: string) => DATE_FORMAT.format(new Date(`${iso}T12:00:00`));
|
|
48
|
+
|
|
49
|
+
export const formatCzk = (amount: number) => formatCurrency(amount);
|
|
50
|
+
|
|
51
|
+
/** Date cell: `null` stays `null` so the organism renders its em dash (`chrome.empty-cell`). */
|
|
52
|
+
const dateCell = (value: string | null) => (value == null ? null : formatDate(value));
|
|
53
|
+
|
|
54
|
+
// ── Shared cell pieces ───────────────────────────────────────────────────────
|
|
55
|
+
|
|
56
|
+
interface RowLinkProps {
|
|
57
|
+
href: string;
|
|
58
|
+
children: string;
|
|
59
|
+
/** The row's own identity link: Strong + underlined on mobile (`chrome.link-cells.underline`). */
|
|
60
|
+
identity?: boolean;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Text Link cell (`chrome.link-cells`): Default · S · Underline Off on desktop. The cell
|
|
65
|
+
* renderer is shared by both layouts, so the mobile identity treatment (Strong,
|
|
66
|
+
* Underline On) is picked here from the layout the Table renders (`useTableLayout`).
|
|
67
|
+
*/
|
|
68
|
+
function RowLink({ href, children, identity = false }: RowLinkProps) {
|
|
69
|
+
const isMobile = useTableLayout() === 'mobile';
|
|
70
|
+
const mobileIdentity = identity && isMobile;
|
|
71
|
+
return h(
|
|
72
|
+
TextLink,
|
|
73
|
+
{
|
|
74
|
+
href,
|
|
75
|
+
size: 'sm',
|
|
76
|
+
variant: mobileIdentity ? 'strong' : 'default',
|
|
77
|
+
underline: mobileIdentity ? 'on' : 'off',
|
|
78
|
+
// A credit note's „Dobropis k faktuře …“ prefix is part of the identity link's name.
|
|
79
|
+
children: identity ? [h(TableChildRowPrefix, { key: 'prefix' }), children] : children,
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Counterparty cell: plain text in the desktop grid (the invoice list's names are not links), a
|
|
86
|
+
* real Text Link in the mobile panel (`chrome.mobile.expanded.panel.entity-reference-rule`).
|
|
87
|
+
*/
|
|
88
|
+
function CounterpartyCell({ href, children }: { href: string; children: string }) {
|
|
89
|
+
const isMobile = useTableLayout() === 'mobile';
|
|
90
|
+
return isMobile ? h(TextLink, { href, size: 'sm', underline: 'on', children }) : h(React.Fragment, null, children);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface StatusCellProps {
|
|
94
|
+
status: StatusDef;
|
|
95
|
+
/** Row-scoped name of the ⓘ trigger. */
|
|
96
|
+
infoLabel: string;
|
|
97
|
+
infoContent: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Stav cell (`slots.status-chip`): Chip Size S, Selectable where the status carries the
|
|
102
|
+
* payment control, Basic otherwise; Info on desktop, off on mobile (touch has no hover).
|
|
103
|
+
*/
|
|
104
|
+
function StatusCell({ status, infoLabel, infoContent }: StatusCellProps) {
|
|
105
|
+
const isMobile = useTableLayout() === 'mobile';
|
|
106
|
+
return h(
|
|
107
|
+
Chip,
|
|
108
|
+
{
|
|
109
|
+
type: status.type,
|
|
110
|
+
emotion: status.emotion,
|
|
111
|
+
size: 'sm',
|
|
112
|
+
defaultChecked: status.type === 'selectable' ? status.paid : undefined,
|
|
113
|
+
info: isMobile ? undefined : { content: infoContent, label: infoLabel },
|
|
114
|
+
children: status.label,
|
|
115
|
+
},
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
interface StatusDef {
|
|
120
|
+
label: string;
|
|
121
|
+
emotion: ChipEmotion;
|
|
122
|
+
type: 'basic' | 'selectable';
|
|
123
|
+
paid: boolean;
|
|
124
|
+
description: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// ── Invoice list (child rows, status edge) ───────────────────────────────────
|
|
128
|
+
|
|
129
|
+
export type InvoiceStatus = 'future' | 'draft' | 'sent' | 'unpaid' | 'overdue' | 'paid';
|
|
130
|
+
|
|
131
|
+
export const INVOICE_STATUS: Record<InvoiceStatus, StatusDef> = {
|
|
132
|
+
future: {
|
|
133
|
+
label: 'Budoucí',
|
|
134
|
+
emotion: 'violet',
|
|
135
|
+
type: 'basic',
|
|
136
|
+
paid: false,
|
|
137
|
+
description: 'Faktura se vystaví až v den vystavení.',
|
|
138
|
+
},
|
|
139
|
+
draft: { label: 'Koncept', emotion: 'neutral', type: 'basic', paid: false, description: 'Faktura je rozpracovaná.' },
|
|
140
|
+
sent: {
|
|
141
|
+
label: 'Odesláno',
|
|
142
|
+
emotion: 'info',
|
|
143
|
+
type: 'selectable',
|
|
144
|
+
paid: false,
|
|
145
|
+
description: 'Faktura odešla odběrateli e‑mailem.',
|
|
146
|
+
},
|
|
147
|
+
unpaid: {
|
|
148
|
+
label: 'Nezaplaceno',
|
|
149
|
+
emotion: 'warning',
|
|
150
|
+
type: 'selectable',
|
|
151
|
+
paid: false,
|
|
152
|
+
description: 'Čeká na úhradu, splatnost zatím neuplynula.',
|
|
153
|
+
},
|
|
154
|
+
overdue: {
|
|
155
|
+
label: 'Po splatnosti',
|
|
156
|
+
emotion: 'danger',
|
|
157
|
+
type: 'selectable',
|
|
158
|
+
paid: false,
|
|
159
|
+
description: 'Splatnost uplynula a platba nedorazila.',
|
|
160
|
+
},
|
|
161
|
+
paid: { label: 'Zaplaceno', emotion: 'success', type: 'selectable', paid: true, description: 'Platba dorazila.' },
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export interface Invoice {
|
|
165
|
+
id: string;
|
|
166
|
+
/** `null` on a Budoucí invoice — it has no number until it is issued. */
|
|
167
|
+
number: string | null;
|
|
168
|
+
supplier: string;
|
|
169
|
+
customer: string;
|
|
170
|
+
customerId: string;
|
|
171
|
+
/** `null` on a Budoucí invoice (FODS renders a dash, `consumer-grids.faktury` → Vystaveno). */
|
|
172
|
+
issuedOn: string | null;
|
|
173
|
+
dueOn: string;
|
|
174
|
+
taxPointOn: string | null;
|
|
175
|
+
paidOn: string | null;
|
|
176
|
+
sentOn: string | null;
|
|
177
|
+
documentType: string;
|
|
178
|
+
paymentType: string;
|
|
179
|
+
amount: number;
|
|
180
|
+
status: InvoiceStatus;
|
|
181
|
+
creditNotes?: Invoice[];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const SUPPLIER = 'Novák Design s.r.o.';
|
|
185
|
+
|
|
186
|
+
type InvoiceSeed = Omit<Invoice, 'supplier' | 'documentType' | 'paymentType' | 'taxPointOn'> &
|
|
187
|
+
Partial<Pick<Invoice, 'documentType' | 'paymentType' | 'taxPointOn'>>;
|
|
188
|
+
|
|
189
|
+
const invoice = (seed: InvoiceSeed): Invoice => ({
|
|
190
|
+
supplier: SUPPLIER,
|
|
191
|
+
documentType: 'Faktura',
|
|
192
|
+
paymentType: 'Převodem',
|
|
193
|
+
taxPointOn: seed.issuedOn,
|
|
194
|
+
...seed,
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
export const INVOICES: Invoice[] = [
|
|
198
|
+
invoice({
|
|
199
|
+
id: 'inv-f2',
|
|
200
|
+
number: null,
|
|
201
|
+
customer: 'Pekárna U Zlatého klasu s.r.o.',
|
|
202
|
+
customerId: 'c-04',
|
|
203
|
+
issuedOn: null,
|
|
204
|
+
dueOn: '2024-11-14',
|
|
205
|
+
paidOn: null,
|
|
206
|
+
sentOn: null,
|
|
207
|
+
amount: 18150,
|
|
208
|
+
status: 'future',
|
|
209
|
+
}),
|
|
210
|
+
invoice({
|
|
211
|
+
id: 'inv-f1',
|
|
212
|
+
number: null,
|
|
213
|
+
customer: 'Alfa Stavby s.r.o.',
|
|
214
|
+
customerId: 'c-01',
|
|
215
|
+
issuedOn: null,
|
|
216
|
+
dueOn: '2024-11-30',
|
|
217
|
+
paidOn: null,
|
|
218
|
+
sentOn: null,
|
|
219
|
+
amount: 60500,
|
|
220
|
+
status: 'future',
|
|
221
|
+
}),
|
|
222
|
+
invoice({
|
|
223
|
+
id: 'inv-142',
|
|
224
|
+
number: '2024-0142',
|
|
225
|
+
customer: 'Alfa Stavby s.r.o.',
|
|
226
|
+
customerId: 'c-01',
|
|
227
|
+
issuedOn: '2024-10-01',
|
|
228
|
+
dueOn: '2024-10-15',
|
|
229
|
+
paidOn: null,
|
|
230
|
+
sentOn: '2024-10-01',
|
|
231
|
+
amount: 48400,
|
|
232
|
+
status: 'overdue',
|
|
233
|
+
}),
|
|
234
|
+
invoice({
|
|
235
|
+
id: 'inv-141',
|
|
236
|
+
number: '2024-0141',
|
|
237
|
+
customer: 'Kavárna Na Rohu',
|
|
238
|
+
customerId: 'c-02',
|
|
239
|
+
issuedOn: '2024-09-28',
|
|
240
|
+
dueOn: '2024-10-28',
|
|
241
|
+
paidOn: null,
|
|
242
|
+
sentOn: '2024-09-28',
|
|
243
|
+
amount: 7260,
|
|
244
|
+
status: 'sent',
|
|
245
|
+
paymentType: 'Kartou',
|
|
246
|
+
}),
|
|
247
|
+
invoice({
|
|
248
|
+
id: 'inv-140',
|
|
249
|
+
number: '2024-0140',
|
|
250
|
+
customer: 'Mezinárodní logistické centrum Brno a.s.',
|
|
251
|
+
customerId: 'c-03',
|
|
252
|
+
issuedOn: '2024-09-25',
|
|
253
|
+
dueOn: '2024-10-25',
|
|
254
|
+
paidOn: null,
|
|
255
|
+
sentOn: '2024-09-26',
|
|
256
|
+
amount: 1234567.89,
|
|
257
|
+
status: 'unpaid',
|
|
258
|
+
}),
|
|
259
|
+
invoice({
|
|
260
|
+
id: 'inv-139',
|
|
261
|
+
number: '2024-0139',
|
|
262
|
+
customer: 'Pekárna U Zlatého klasu s.r.o.',
|
|
263
|
+
customerId: 'c-04',
|
|
264
|
+
issuedOn: '2024-09-20',
|
|
265
|
+
dueOn: '2024-10-04',
|
|
266
|
+
paidOn: '2024-10-02',
|
|
267
|
+
sentOn: '2024-09-20',
|
|
268
|
+
amount: 24200,
|
|
269
|
+
status: 'paid',
|
|
270
|
+
}),
|
|
271
|
+
invoice({
|
|
272
|
+
id: 'inv-138',
|
|
273
|
+
number: '2024-0138',
|
|
274
|
+
customer: 'Zelená zahrada, spolek',
|
|
275
|
+
customerId: 'c-05',
|
|
276
|
+
issuedOn: '2024-09-12',
|
|
277
|
+
dueOn: '2024-09-26',
|
|
278
|
+
paidOn: '2024-09-24',
|
|
279
|
+
sentOn: '2024-09-12',
|
|
280
|
+
amount: 121000,
|
|
281
|
+
status: 'paid',
|
|
282
|
+
creditNotes: [
|
|
283
|
+
invoice({
|
|
284
|
+
id: 'inv-138-d1',
|
|
285
|
+
number: '2024-D007',
|
|
286
|
+
customer: 'Zelená zahrada, spolek',
|
|
287
|
+
customerId: 'c-05',
|
|
288
|
+
issuedOn: '2024-09-30',
|
|
289
|
+
dueOn: '2024-10-14',
|
|
290
|
+
paidOn: null,
|
|
291
|
+
sentOn: '2024-09-30',
|
|
292
|
+
amount: -12100,
|
|
293
|
+
status: 'sent',
|
|
294
|
+
documentType: 'Dobropis',
|
|
295
|
+
}),
|
|
296
|
+
],
|
|
297
|
+
}),
|
|
298
|
+
invoice({
|
|
299
|
+
id: 'inv-137',
|
|
300
|
+
number: '2024-0137',
|
|
301
|
+
customer: 'Ing. Petra Dvořáková',
|
|
302
|
+
customerId: 'c-06',
|
|
303
|
+
issuedOn: '2024-09-10',
|
|
304
|
+
dueOn: '2024-09-24',
|
|
305
|
+
paidOn: '2024-09-23',
|
|
306
|
+
sentOn: '2024-09-10',
|
|
307
|
+
amount: 9680,
|
|
308
|
+
status: 'paid',
|
|
309
|
+
paymentType: 'Hotově',
|
|
310
|
+
}),
|
|
311
|
+
invoice({
|
|
312
|
+
id: 'inv-136',
|
|
313
|
+
number: '2024-0136',
|
|
314
|
+
customer: 'Kavárna Na Rohu',
|
|
315
|
+
customerId: 'c-02',
|
|
316
|
+
issuedOn: '2024-09-02',
|
|
317
|
+
dueOn: '2024-09-16',
|
|
318
|
+
paidOn: null,
|
|
319
|
+
sentOn: null,
|
|
320
|
+
amount: 3630,
|
|
321
|
+
status: 'draft',
|
|
322
|
+
}),
|
|
323
|
+
invoice({
|
|
324
|
+
id: 'inv-135',
|
|
325
|
+
number: '2024-0135',
|
|
326
|
+
customer: 'Alfa Stavby s.r.o.',
|
|
327
|
+
customerId: 'c-01',
|
|
328
|
+
issuedOn: '2024-08-29',
|
|
329
|
+
dueOn: '2024-09-12',
|
|
330
|
+
paidOn: '2024-09-10',
|
|
331
|
+
sentOn: '2024-08-29',
|
|
332
|
+
amount: 96800,
|
|
333
|
+
status: 'paid',
|
|
334
|
+
documentType: 'Zálohová faktura',
|
|
335
|
+
creditNotes: [
|
|
336
|
+
invoice({
|
|
337
|
+
id: 'inv-135-d1',
|
|
338
|
+
number: '2024-D005',
|
|
339
|
+
customer: 'Alfa Stavby s.r.o.',
|
|
340
|
+
customerId: 'c-01',
|
|
341
|
+
issuedOn: '2024-09-05',
|
|
342
|
+
dueOn: '2024-09-19',
|
|
343
|
+
paidOn: '2024-09-15',
|
|
344
|
+
sentOn: '2024-09-05',
|
|
345
|
+
amount: -4840,
|
|
346
|
+
status: 'paid',
|
|
347
|
+
documentType: 'Dobropis',
|
|
348
|
+
}),
|
|
349
|
+
invoice({
|
|
350
|
+
id: 'inv-135-d2',
|
|
351
|
+
number: '2024-D006',
|
|
352
|
+
customer: 'Alfa Stavby s.r.o.',
|
|
353
|
+
customerId: 'c-01',
|
|
354
|
+
issuedOn: '2024-09-18',
|
|
355
|
+
dueOn: '2024-10-02',
|
|
356
|
+
paidOn: null,
|
|
357
|
+
sentOn: '2024-09-18',
|
|
358
|
+
amount: -2420,
|
|
359
|
+
status: 'overdue',
|
|
360
|
+
documentType: 'Dobropis',
|
|
361
|
+
}),
|
|
362
|
+
],
|
|
363
|
+
}),
|
|
364
|
+
invoice({
|
|
365
|
+
id: 'inv-134',
|
|
366
|
+
number: '2024-0134',
|
|
367
|
+
customer: 'Truhlářství Hora & syn',
|
|
368
|
+
customerId: 'c-07',
|
|
369
|
+
issuedOn: '2024-08-20',
|
|
370
|
+
dueOn: '2024-09-03',
|
|
371
|
+
paidOn: null,
|
|
372
|
+
sentOn: '2024-08-20',
|
|
373
|
+
amount: 15730,
|
|
374
|
+
status: 'overdue',
|
|
375
|
+
}),
|
|
376
|
+
invoice({
|
|
377
|
+
id: 'inv-133',
|
|
378
|
+
number: '2024-0133',
|
|
379
|
+
customer: 'Mezinárodní logistické centrum Brno a.s.',
|
|
380
|
+
customerId: 'c-03',
|
|
381
|
+
issuedOn: '2024-08-15',
|
|
382
|
+
dueOn: '2024-08-29',
|
|
383
|
+
paidOn: '2024-08-28',
|
|
384
|
+
sentOn: '2024-08-15',
|
|
385
|
+
amount: 302500,
|
|
386
|
+
status: 'paid',
|
|
387
|
+
}),
|
|
388
|
+
];
|
|
389
|
+
|
|
390
|
+
/** Accusative reference for row-scoped names: "fakturu 2024-0142" / "budoucí fakturu pro …". */
|
|
391
|
+
const invoiceRef = (row: Invoice) =>
|
|
392
|
+
row.number != null ? `fakturu ${row.number}` : `budoucí fakturu pro ${row.customer}`;
|
|
393
|
+
/** Genitive reference: "faktury 2024-0142". */
|
|
394
|
+
const invoiceRefGen = (row: Invoice) =>
|
|
395
|
+
row.number != null ? `faktury ${row.number}` : `budoucí faktury pro ${row.customer}`;
|
|
396
|
+
|
|
397
|
+
const invoiceCol = createTableColumnHelper<Invoice>();
|
|
398
|
+
|
|
399
|
+
export const INVOICE_COLUMNS = invoiceCol.columns([
|
|
400
|
+
invoiceCol.accessor('number', {
|
|
401
|
+
id: 'number',
|
|
402
|
+
header: 'Číslo',
|
|
403
|
+
// A Budoucí invoice has no number: the organism renders its em dash on both layouts
|
|
404
|
+
// (`chrome.empty-cell`, `chrome.link-cells.no-value`) and never calls this renderer.
|
|
405
|
+
cell: ({ row, getValue }) =>
|
|
406
|
+
h(RowLink, { href: '#', identity: true, children: getValue() ?? '' }),
|
|
407
|
+
meta: { width: 150, identity: true, locked: true },
|
|
408
|
+
}),
|
|
409
|
+
invoiceCol.accessor('supplier', {
|
|
410
|
+
id: 'supplier',
|
|
411
|
+
header: 'Dodavatel',
|
|
412
|
+
meta: { width: 119, flex: { min: 117 } },
|
|
413
|
+
}),
|
|
414
|
+
invoiceCol.accessor('customer', {
|
|
415
|
+
id: 'customer',
|
|
416
|
+
header: 'Odběratel',
|
|
417
|
+
cell: ({ row, getValue }) => h(CounterpartyCell, { href: '#', children: getValue() }),
|
|
418
|
+
meta: { width: 119, flex: { min: 115 } },
|
|
419
|
+
}),
|
|
420
|
+
invoiceCol.accessor('issuedOn', {
|
|
421
|
+
id: 'issuedOn',
|
|
422
|
+
header: 'Vystaveno',
|
|
423
|
+
cell: ({ getValue }) => dateCell(getValue()),
|
|
424
|
+
meta: { width: 124 },
|
|
425
|
+
}),
|
|
426
|
+
invoiceCol.accessor('dueOn', {
|
|
427
|
+
id: 'dueOn',
|
|
428
|
+
header: 'Splatnost',
|
|
429
|
+
cell: ({ getValue }) => formatDate(getValue()),
|
|
430
|
+
meta: { width: 116 },
|
|
431
|
+
}),
|
|
432
|
+
invoiceCol.accessor('taxPointOn', {
|
|
433
|
+
id: 'taxPointOn',
|
|
434
|
+
header: 'Zdanitelné plnění',
|
|
435
|
+
cell: ({ getValue }) => dateCell(getValue()),
|
|
436
|
+
meta: { width: 168, defaultVisible: false },
|
|
437
|
+
}),
|
|
438
|
+
invoiceCol.accessor('paidOn', {
|
|
439
|
+
id: 'paidOn',
|
|
440
|
+
header: 'Zaplaceno',
|
|
441
|
+
cell: ({ getValue }) => dateCell(getValue()),
|
|
442
|
+
meta: { width: 124 },
|
|
443
|
+
}),
|
|
444
|
+
invoiceCol.accessor('sentOn', {
|
|
445
|
+
id: 'sentOn',
|
|
446
|
+
header: 'Odesláno',
|
|
447
|
+
cell: ({ getValue }) => dateCell(getValue()),
|
|
448
|
+
meta: { width: 124, defaultVisible: false },
|
|
449
|
+
}),
|
|
450
|
+
invoiceCol.accessor('documentType', {
|
|
451
|
+
id: 'documentType',
|
|
452
|
+
header: 'Typ dokladu',
|
|
453
|
+
meta: { width: 132, defaultVisible: false },
|
|
454
|
+
}),
|
|
455
|
+
invoiceCol.accessor('amount', {
|
|
456
|
+
id: 'amount',
|
|
457
|
+
header: 'Částka',
|
|
458
|
+
cell: ({ getValue }) => formatCzk(getValue()),
|
|
459
|
+
meta: { width: 132, align: 'right', locked: true },
|
|
460
|
+
}),
|
|
461
|
+
invoiceCol.accessor('paymentType', {
|
|
462
|
+
id: 'paymentType',
|
|
463
|
+
header: 'Typ platby',
|
|
464
|
+
meta: { width: 120, defaultVisible: false },
|
|
465
|
+
}),
|
|
466
|
+
invoiceCol.accessor('status', {
|
|
467
|
+
id: 'status',
|
|
468
|
+
header: 'Stav',
|
|
469
|
+
cell: ({ row, getValue }) => {
|
|
470
|
+
const status = INVOICE_STATUS[getValue()];
|
|
471
|
+
const content =
|
|
472
|
+
getValue() === 'paid' && row.original.paidOn != null
|
|
473
|
+
? `Zaplaceno ${formatDate(row.original.paidOn)}`
|
|
474
|
+
: status.description;
|
|
475
|
+
return h(StatusCell, { status, infoContent: content, infoLabel: `Stav ${invoiceRefGen(row.original)}` });
|
|
476
|
+
},
|
|
477
|
+
meta: { width: 140 },
|
|
478
|
+
}),
|
|
479
|
+
]);
|
|
480
|
+
|
|
481
|
+
/** Sort keys per column id; the server would do this — the story stands in for it. */
|
|
482
|
+
export const INVOICE_SORT: Record<string, (row: Invoice) => string | number | null> = {
|
|
483
|
+
number: row => row.number,
|
|
484
|
+
supplier: row => row.supplier,
|
|
485
|
+
customer: row => row.customer,
|
|
486
|
+
issuedOn: row => row.issuedOn,
|
|
487
|
+
dueOn: row => row.dueOn,
|
|
488
|
+
taxPointOn: row => row.taxPointOn,
|
|
489
|
+
paidOn: row => row.paidOn,
|
|
490
|
+
sentOn: row => row.sentOn,
|
|
491
|
+
documentType: row => row.documentType,
|
|
492
|
+
amount: row => row.amount,
|
|
493
|
+
paymentType: row => row.paymentType,
|
|
494
|
+
status: row => INVOICE_STATUS[row.status].label,
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
export const invoiceRowActions = (row: Invoice): TableRowAction[] => {
|
|
498
|
+
const ref = invoiceRef(row);
|
|
499
|
+
return [
|
|
500
|
+
{ label: `Upravit ${ref}`, icon: 'pencil-simple', onClick: noop },
|
|
501
|
+
{ label: `Duplikovat ${ref}`, icon: 'copy', onClick: noop },
|
|
502
|
+
{ label: `Odeslat ${ref}`, icon: 'paper-plane-tilt', onClick: noop },
|
|
503
|
+
{ label: `Stáhnout ${ref}`, icon: 'download-simple', onClick: noop },
|
|
504
|
+
{ label: `Smazat ${ref}`, icon: 'trash', onClick: noop },
|
|
505
|
+
];
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
/** 4px status strip (`chrome.status-edge`) — the invoice list only; Koncept (neutral) carries none. */
|
|
509
|
+
export const invoiceStatusEdge = (row: Invoice): ChipEmotion | undefined => {
|
|
510
|
+
const { emotion } = INVOICE_STATUS[row.status];
|
|
511
|
+
return emotion === 'neutral' ? undefined : emotion;
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
export const invoiceChildPrefix = (_child: Invoice, parent: Invoice) => `Dobropis k faktuře ${parent.number ?? ''}`;
|
|
515
|
+
|
|
516
|
+
export const INVOICE_MOBILE: TableMobileConfig<Invoice> = {
|
|
517
|
+
identityColumnId: 'number',
|
|
518
|
+
secondaryColumnId: 'customer',
|
|
519
|
+
statusColumnId: 'status',
|
|
520
|
+
amountColumnId: 'amount',
|
|
521
|
+
primaryAction: () => ({ label: 'Odeslat', icon: 'paper-plane-tilt', onClick: noop }),
|
|
522
|
+
// Visible menu labels inside the record's own panel block — the record is already named there.
|
|
523
|
+
moreActions: () => [
|
|
524
|
+
{ label: 'Stáhnout PDF', icon: 'download-simple', onClick: noop },
|
|
525
|
+
{ label: 'Upravit', icon: 'pencil-simple', onClick: noop },
|
|
526
|
+
{ label: 'Duplikovat', icon: 'copy', onClick: noop },
|
|
527
|
+
{ label: 'Smazat', icon: 'trash', onClick: noop },
|
|
528
|
+
],
|
|
529
|
+
expandLabel: row => `Zobrazit detail ${invoiceRefGen(row)}`,
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
// ── Contact list (no selection) ──────────────────────────────────────────────
|
|
533
|
+
|
|
534
|
+
export interface Contact {
|
|
535
|
+
id: string;
|
|
536
|
+
name: string;
|
|
537
|
+
ico: string;
|
|
538
|
+
dic: string | null;
|
|
539
|
+
email: string | null;
|
|
540
|
+
phone: string | null;
|
|
541
|
+
city: string;
|
|
542
|
+
invoiceCount: number;
|
|
543
|
+
expenseCount: number;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
export const CONTACTS: Contact[] = [
|
|
547
|
+
{
|
|
548
|
+
id: 'c-01',
|
|
549
|
+
name: 'Alfa Stavby s.r.o.',
|
|
550
|
+
ico: '28765432',
|
|
551
|
+
dic: 'CZ28765432',
|
|
552
|
+
email: 'fakturace@alfastavby.priklad.cz',
|
|
553
|
+
phone: '+420 734 634 566',
|
|
554
|
+
city: 'Praha',
|
|
555
|
+
invoiceCount: 18,
|
|
556
|
+
expenseCount: 2,
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
id: 'c-02',
|
|
560
|
+
name: 'Kavárna Na Rohu',
|
|
561
|
+
ico: '08812345',
|
|
562
|
+
dic: null,
|
|
563
|
+
email: 'ahoj@kavarnanarohu.priklad.cz',
|
|
564
|
+
phone: '+420 602 118 903',
|
|
565
|
+
city: 'Olomouc',
|
|
566
|
+
invoiceCount: 7,
|
|
567
|
+
expenseCount: 0,
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
id: 'c-03',
|
|
571
|
+
name: 'Mezinárodní logistické centrum Brno a.s.',
|
|
572
|
+
ico: '25596642',
|
|
573
|
+
dic: 'CZ25596642',
|
|
574
|
+
email: 'fakturace@mezinarodni-logisticke-centrum-brno.priklad.cz',
|
|
575
|
+
phone: '+420 541 223 900',
|
|
576
|
+
city: 'Brno',
|
|
577
|
+
invoiceCount: 42,
|
|
578
|
+
expenseCount: 5,
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
id: 'c-04',
|
|
582
|
+
name: 'Pekárna U Zlatého klasu s.r.o.',
|
|
583
|
+
ico: '04471551',
|
|
584
|
+
dic: 'CZ04471551',
|
|
585
|
+
email: 'objednavky@zlatyklas.priklad.cz',
|
|
586
|
+
phone: null,
|
|
587
|
+
city: 'Kolín',
|
|
588
|
+
invoiceCount: 11,
|
|
589
|
+
expenseCount: 0,
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
id: 'c-05',
|
|
593
|
+
name: 'Zelená zahrada, spolek',
|
|
594
|
+
ico: '22671910',
|
|
595
|
+
dic: null,
|
|
596
|
+
email: null,
|
|
597
|
+
phone: '+420 777 210 448',
|
|
598
|
+
city: 'Liberec',
|
|
599
|
+
invoiceCount: 3,
|
|
600
|
+
expenseCount: 0,
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
id: 'c-06',
|
|
604
|
+
name: 'Ing. Petra Dvořáková',
|
|
605
|
+
ico: '73526712',
|
|
606
|
+
dic: 'CZ73526712',
|
|
607
|
+
email: 'petra@dvorakova-ucetni.priklad.cz',
|
|
608
|
+
phone: '+420 608 455 120',
|
|
609
|
+
city: 'Plzeň',
|
|
610
|
+
invoiceCount: 9,
|
|
611
|
+
expenseCount: 12,
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
id: 'c-07',
|
|
615
|
+
name: 'Truhlářství Hora & syn',
|
|
616
|
+
ico: '12345678',
|
|
617
|
+
dic: 'CZ12345678',
|
|
618
|
+
email: 'hora@truhlarstvi-hora.priklad.cz',
|
|
619
|
+
phone: '+420 721 300 017',
|
|
620
|
+
city: 'Tábor',
|
|
621
|
+
invoiceCount: 4,
|
|
622
|
+
expenseCount: 1,
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
id: 'c-08',
|
|
626
|
+
name: 'Signál Telekom a.s.',
|
|
627
|
+
ico: '60193330',
|
|
628
|
+
dic: 'CZ60193330',
|
|
629
|
+
email: null,
|
|
630
|
+
phone: null,
|
|
631
|
+
city: 'Praha',
|
|
632
|
+
invoiceCount: 0,
|
|
633
|
+
expenseCount: 24,
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
id: 'c-09',
|
|
637
|
+
name: 'Elektro Kovář s.r.o.',
|
|
638
|
+
ico: '27082441',
|
|
639
|
+
dic: 'CZ27082441',
|
|
640
|
+
email: 'obchod@elektro-kovar.priklad.cz',
|
|
641
|
+
phone: '+420 210 000 000',
|
|
642
|
+
city: 'Praha',
|
|
643
|
+
invoiceCount: 0,
|
|
644
|
+
expenseCount: 9,
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
id: 'c-10',
|
|
648
|
+
name: 'Coworking Hub Karlín',
|
|
649
|
+
ico: '06651382',
|
|
650
|
+
dic: 'CZ06651382',
|
|
651
|
+
email: 'billing@hubkarlin.priklad.cz',
|
|
652
|
+
phone: '+420 739 812 400',
|
|
653
|
+
city: 'Praha',
|
|
654
|
+
invoiceCount: 1,
|
|
655
|
+
expenseCount: 12,
|
|
656
|
+
},
|
|
657
|
+
];
|
|
658
|
+
|
|
659
|
+
const contactCol = createTableColumnHelper<Contact>();
|
|
660
|
+
|
|
661
|
+
export const CONTACT_COLUMNS = contactCol.columns([
|
|
662
|
+
contactCol.accessor('name', {
|
|
663
|
+
id: 'name',
|
|
664
|
+
header: 'Kontakt',
|
|
665
|
+
cell: ({ row, getValue }) => h(RowLink, { href: '#', identity: true, children: getValue() }),
|
|
666
|
+
meta: { width: 355, flex: { min: 101 }, identity: true, locked: true },
|
|
667
|
+
}),
|
|
668
|
+
contactCol.accessor('ico', {
|
|
669
|
+
id: 'ico',
|
|
670
|
+
header: 'IČ',
|
|
671
|
+
meta: { width: 100, locked: true },
|
|
672
|
+
}),
|
|
673
|
+
contactCol.accessor('email', {
|
|
674
|
+
id: 'email',
|
|
675
|
+
header: 'E‑mail',
|
|
676
|
+
// An empty e-mail never reaches the renderer: the organism draws the em dash.
|
|
677
|
+
cell: ({ getValue }) => h(RowLink, { href: `mailto:${getValue() ?? ''}`, children: getValue() ?? '' }),
|
|
678
|
+
meta: { width: 355, flex: { min: 96 } },
|
|
679
|
+
}),
|
|
680
|
+
contactCol.accessor('phone', {
|
|
681
|
+
id: 'phone',
|
|
682
|
+
header: 'Telefon',
|
|
683
|
+
meta: { width: 150 },
|
|
684
|
+
}),
|
|
685
|
+
contactCol.accessor('invoiceCount', {
|
|
686
|
+
id: 'invoiceCount',
|
|
687
|
+
header: 'Počet faktur',
|
|
688
|
+
meta: { width: 140, align: 'right' },
|
|
689
|
+
}),
|
|
690
|
+
contactCol.accessor('expenseCount', {
|
|
691
|
+
id: 'expenseCount',
|
|
692
|
+
header: 'Počet výdajů',
|
|
693
|
+
// Optional on desktop, but the mobile panel always names it
|
|
694
|
+
// (`chrome.mobile.per-consumer.kontakty.panel`).
|
|
695
|
+
meta: { width: 140, align: 'right', defaultVisible: false, mobilePanel: 'always' },
|
|
696
|
+
}),
|
|
697
|
+
]);
|
|
698
|
+
|
|
699
|
+
export const CONTACT_SORT: Record<string, (row: Contact) => string | number | null> = {
|
|
700
|
+
name: row => row.name,
|
|
701
|
+
ico: row => row.ico,
|
|
702
|
+
email: row => row.email,
|
|
703
|
+
phone: row => row.phone,
|
|
704
|
+
invoiceCount: row => row.invoiceCount,
|
|
705
|
+
expenseCount: row => row.expenseCount,
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
export const contactRowActions = (row: Contact): TableRowAction[] => [
|
|
709
|
+
{ label: `Vytvořit fakturu pro kontakt ${row.name}`, icon: 'invoice-new', onClick: noop },
|
|
710
|
+
{ label: `Vytvořit výdaj pro kontakt ${row.name}`, icon: 'expense', onClick: noop },
|
|
711
|
+
{ label: `Upravit kontakt ${row.name}`, icon: 'pencil-simple', onClick: noop },
|
|
712
|
+
{ label: `Smazat kontakt ${row.name}`, icon: 'trash', onClick: noop },
|
|
713
|
+
];
|
|
714
|
+
|
|
715
|
+
export const CONTACT_MOBILE: TableMobileConfig<Contact> = {
|
|
716
|
+
identityColumnId: 'name',
|
|
717
|
+
statusColumnId: 'ico',
|
|
718
|
+
primaryAction: () => ({ label: 'Vytvořit fakturu', icon: 'invoice-new', onClick: noop }),
|
|
719
|
+
moreActions: () => [
|
|
720
|
+
{ label: 'Vytvořit výdaj', icon: 'expense', onClick: noop },
|
|
721
|
+
{ label: 'Upravit', icon: 'pencil-simple', onClick: noop },
|
|
722
|
+
{ label: 'Smazat', icon: 'trash', onClick: noop },
|
|
723
|
+
],
|
|
724
|
+
expandLabel: row => `Zobrazit detail kontaktu ${row.name}`,
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
// ── Expense list (boolean columns) ───────────────────────────────────────────
|
|
728
|
+
|
|
729
|
+
export type ExpenseStatus = 'unpaid' | 'overdue' | 'paid';
|
|
730
|
+
|
|
731
|
+
export const EXPENSE_STATUS: Record<ExpenseStatus, StatusDef> = {
|
|
732
|
+
unpaid: {
|
|
733
|
+
label: 'Nezaplaceno',
|
|
734
|
+
emotion: 'warning',
|
|
735
|
+
type: 'selectable',
|
|
736
|
+
paid: false,
|
|
737
|
+
description: 'Výdaj čeká na úhradu, splatnost zatím neuplynula.',
|
|
738
|
+
},
|
|
739
|
+
overdue: {
|
|
740
|
+
label: 'Po splatnosti',
|
|
741
|
+
emotion: 'danger',
|
|
742
|
+
type: 'selectable',
|
|
743
|
+
paid: false,
|
|
744
|
+
description: 'Splatnost výdaje uplynula a platba zatím neodešla.',
|
|
745
|
+
},
|
|
746
|
+
paid: { label: 'Zaplaceno', emotion: 'success', type: 'selectable', paid: true, description: 'Výdaj je uhrazený.' },
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
export interface Expense {
|
|
750
|
+
id: string;
|
|
751
|
+
number: string;
|
|
752
|
+
supplier: string;
|
|
753
|
+
supplierId: string;
|
|
754
|
+
issuedOn: string;
|
|
755
|
+
dueOn: string;
|
|
756
|
+
/** DUZP. */
|
|
757
|
+
taxPointOn: string | null;
|
|
758
|
+
amountGross: number;
|
|
759
|
+
amountNet: number;
|
|
760
|
+
hasAttachment: boolean;
|
|
761
|
+
taxDeductible: boolean;
|
|
762
|
+
inVatReturn: boolean;
|
|
763
|
+
status: ExpenseStatus;
|
|
764
|
+
paidOn: string | null;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
export const EXPENSES: Expense[] = [
|
|
768
|
+
{
|
|
769
|
+
id: 'exp-87',
|
|
770
|
+
number: 'V2024-0087',
|
|
771
|
+
supplier: 'Signál Telekom a.s.',
|
|
772
|
+
supplierId: 'c-08',
|
|
773
|
+
issuedOn: '2024-10-01',
|
|
774
|
+
dueOn: '2024-10-15',
|
|
775
|
+
taxPointOn: '2024-09-30',
|
|
776
|
+
amountGross: 1149.5,
|
|
777
|
+
amountNet: 950,
|
|
778
|
+
hasAttachment: true,
|
|
779
|
+
taxDeductible: true,
|
|
780
|
+
inVatReturn: true,
|
|
781
|
+
status: 'unpaid',
|
|
782
|
+
paidOn: null,
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
id: 'exp-86',
|
|
786
|
+
number: 'V2024-0086',
|
|
787
|
+
supplier: 'Coworking Hub Karlín',
|
|
788
|
+
supplierId: 'c-10',
|
|
789
|
+
issuedOn: '2024-09-30',
|
|
790
|
+
dueOn: '2024-10-10',
|
|
791
|
+
taxPointOn: '2024-09-30',
|
|
792
|
+
amountGross: 7865,
|
|
793
|
+
amountNet: 6500,
|
|
794
|
+
hasAttachment: true,
|
|
795
|
+
taxDeductible: true,
|
|
796
|
+
inVatReturn: false,
|
|
797
|
+
status: 'overdue',
|
|
798
|
+
paidOn: null,
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
id: 'exp-85',
|
|
802
|
+
number: 'V2024-0085',
|
|
803
|
+
supplier: 'Elektro Kovář s.r.o.',
|
|
804
|
+
supplierId: 'c-09',
|
|
805
|
+
issuedOn: '2024-09-24',
|
|
806
|
+
dueOn: '2024-10-08',
|
|
807
|
+
taxPointOn: '2024-09-24',
|
|
808
|
+
amountGross: 38990,
|
|
809
|
+
amountNet: 32223.14,
|
|
810
|
+
hasAttachment: true,
|
|
811
|
+
taxDeductible: true,
|
|
812
|
+
inVatReturn: true,
|
|
813
|
+
status: 'paid',
|
|
814
|
+
paidOn: '2024-09-25',
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
id: 'exp-84',
|
|
818
|
+
number: 'V2024-0084',
|
|
819
|
+
supplier: 'Ing. Petra Dvořáková',
|
|
820
|
+
supplierId: 'c-06',
|
|
821
|
+
issuedOn: '2024-09-20',
|
|
822
|
+
dueOn: '2024-10-04',
|
|
823
|
+
taxPointOn: null,
|
|
824
|
+
amountGross: 4500,
|
|
825
|
+
amountNet: 4500,
|
|
826
|
+
hasAttachment: false,
|
|
827
|
+
taxDeductible: true,
|
|
828
|
+
inVatReturn: false,
|
|
829
|
+
status: 'paid',
|
|
830
|
+
paidOn: '2024-10-01',
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
id: 'exp-83',
|
|
834
|
+
number: 'V2024-0083',
|
|
835
|
+
supplier: 'Mezinárodní logistické centrum Brno a.s.',
|
|
836
|
+
supplierId: 'c-03',
|
|
837
|
+
issuedOn: '2024-09-18',
|
|
838
|
+
dueOn: '2024-10-18',
|
|
839
|
+
taxPointOn: '2024-09-18',
|
|
840
|
+
amountGross: 15488,
|
|
841
|
+
amountNet: 12800,
|
|
842
|
+
hasAttachment: true,
|
|
843
|
+
taxDeductible: false,
|
|
844
|
+
inVatReturn: true,
|
|
845
|
+
status: 'unpaid',
|
|
846
|
+
paidOn: null,
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
id: 'exp-82',
|
|
850
|
+
number: 'V2024-0082',
|
|
851
|
+
supplier: 'Truhlářství Hora & syn',
|
|
852
|
+
supplierId: 'c-07',
|
|
853
|
+
issuedOn: '2024-09-11',
|
|
854
|
+
dueOn: '2024-09-25',
|
|
855
|
+
taxPointOn: '2024-09-11',
|
|
856
|
+
amountGross: 26620,
|
|
857
|
+
amountNet: 22000,
|
|
858
|
+
hasAttachment: false,
|
|
859
|
+
taxDeductible: false,
|
|
860
|
+
inVatReturn: false,
|
|
861
|
+
status: 'overdue',
|
|
862
|
+
paidOn: null,
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
id: 'exp-81',
|
|
866
|
+
number: 'V2024-0081',
|
|
867
|
+
supplier: 'Signál Telekom a.s.',
|
|
868
|
+
supplierId: 'c-08',
|
|
869
|
+
issuedOn: '2024-09-01',
|
|
870
|
+
dueOn: '2024-09-15',
|
|
871
|
+
taxPointOn: '2024-08-31',
|
|
872
|
+
amountGross: 1149.5,
|
|
873
|
+
amountNet: 950,
|
|
874
|
+
hasAttachment: true,
|
|
875
|
+
taxDeductible: true,
|
|
876
|
+
inVatReturn: true,
|
|
877
|
+
status: 'paid',
|
|
878
|
+
paidOn: '2024-09-12',
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
id: 'exp-80',
|
|
882
|
+
number: 'V2024-0080',
|
|
883
|
+
supplier: 'Coworking Hub Karlín',
|
|
884
|
+
supplierId: 'c-10',
|
|
885
|
+
issuedOn: '2024-08-31',
|
|
886
|
+
dueOn: '2024-09-10',
|
|
887
|
+
taxPointOn: '2024-08-31',
|
|
888
|
+
amountGross: 7865,
|
|
889
|
+
amountNet: 6500,
|
|
890
|
+
hasAttachment: true,
|
|
891
|
+
taxDeductible: true,
|
|
892
|
+
inVatReturn: true,
|
|
893
|
+
status: 'paid',
|
|
894
|
+
paidOn: '2024-09-09',
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
id: 'exp-79',
|
|
898
|
+
number: 'V2024-0079',
|
|
899
|
+
supplier: 'Elektro Kovář s.r.o.',
|
|
900
|
+
supplierId: 'c-09',
|
|
901
|
+
issuedOn: '2024-08-22',
|
|
902
|
+
dueOn: '2024-09-05',
|
|
903
|
+
taxPointOn: '2024-08-22',
|
|
904
|
+
amountGross: 2499,
|
|
905
|
+
amountNet: 2065.29,
|
|
906
|
+
hasAttachment: false,
|
|
907
|
+
taxDeductible: true,
|
|
908
|
+
inVatReturn: false,
|
|
909
|
+
status: 'paid',
|
|
910
|
+
paidOn: '2024-08-23',
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
id: 'exp-78',
|
|
914
|
+
number: 'V2024-0078',
|
|
915
|
+
supplier: 'Ing. Petra Dvořáková',
|
|
916
|
+
supplierId: 'c-06',
|
|
917
|
+
issuedOn: '2024-08-20',
|
|
918
|
+
dueOn: '2024-09-03',
|
|
919
|
+
taxPointOn: null,
|
|
920
|
+
amountGross: 4500,
|
|
921
|
+
amountNet: 4500,
|
|
922
|
+
hasAttachment: true,
|
|
923
|
+
taxDeductible: false,
|
|
924
|
+
inVatReturn: false,
|
|
925
|
+
status: 'paid',
|
|
926
|
+
paidOn: '2024-09-01',
|
|
927
|
+
},
|
|
928
|
+
];
|
|
929
|
+
|
|
930
|
+
/** Boolean column cell (`chrome.boolean-columns`): Badge Soft S, Ano = Info, Ne = Neutral. */
|
|
931
|
+
const booleanBadge = (value: boolean) =>
|
|
932
|
+
h(Badge, { appearance: 'soft', size: 'sm', emotion: value ? 'info' : 'neutral', children: value ? 'Ano' : 'Ne' });
|
|
933
|
+
|
|
934
|
+
const expenseCol = createTableColumnHelper<Expense>();
|
|
935
|
+
|
|
936
|
+
export const EXPENSE_COLUMNS = expenseCol.columns([
|
|
937
|
+
expenseCol.accessor('number', {
|
|
938
|
+
id: 'number',
|
|
939
|
+
header: 'Číslo',
|
|
940
|
+
cell: ({ row, getValue }) => h(RowLink, { href: '#', identity: true, children: getValue() }),
|
|
941
|
+
// `skeletonWidth`: the manifest's loading exhibit (`chrome.loading.width.vydaje`).
|
|
942
|
+
meta: { width: 126, identity: true, locked: true, skeletonWidth: 78 },
|
|
943
|
+
}),
|
|
944
|
+
// A DISPLAY column: presence is the value, so an expense without an attachment renders
|
|
945
|
+
// nothing — an accessor would get the organism's em dash (`chrome.empty-cell` carve-out).
|
|
946
|
+
expenseCol.display({
|
|
947
|
+
id: 'attachment',
|
|
948
|
+
header: 'Příloha',
|
|
949
|
+
cell: ({ row }) =>
|
|
950
|
+
row.original.hasAttachment
|
|
951
|
+
? h(
|
|
952
|
+
'span',
|
|
953
|
+
{ className: 'inline-flex text-icon-muted' },
|
|
954
|
+
h(Icon, { name: 'paperclip', size: 'xsmall' }),
|
|
955
|
+
h('span', { className: 'sr-only' }, 'Má přílohu'),
|
|
956
|
+
)
|
|
957
|
+
: null,
|
|
958
|
+
meta: { width: 76, align: 'center', sortable: false, skeletonWidth: 54 },
|
|
959
|
+
}),
|
|
960
|
+
// Kontakt, Celkem bez DPH and Stav are not sortable: the server ignores them (1.38.0).
|
|
961
|
+
expenseCol.accessor('supplier', {
|
|
962
|
+
id: 'supplier',
|
|
963
|
+
header: 'Kontakt',
|
|
964
|
+
cell: ({ row, getValue }) => h(RowLink, { href: '#', children: getValue() }),
|
|
965
|
+
meta: { width: 428, flex: { min: 101 }, sortable: false, skeletonWidth: 61 },
|
|
966
|
+
}),
|
|
967
|
+
expenseCol.accessor('dueOn', {
|
|
968
|
+
id: 'dueOn',
|
|
969
|
+
header: 'Datum splatnosti',
|
|
970
|
+
cell: ({ getValue }) => formatDate(getValue()),
|
|
971
|
+
meta: { width: 164, skeletonWidth: 98 },
|
|
972
|
+
}),
|
|
973
|
+
expenseCol.accessor('taxPointOn', {
|
|
974
|
+
id: 'taxPointOn',
|
|
975
|
+
header: 'DUZP',
|
|
976
|
+
cell: ({ getValue }) => dateCell(getValue()),
|
|
977
|
+
meta: { width: 139, defaultVisible: false, tooltip: 'Datum zdanitelného plnění' },
|
|
978
|
+
}),
|
|
979
|
+
expenseCol.accessor('amountNet', {
|
|
980
|
+
id: 'amountNet',
|
|
981
|
+
header: 'Celkem bez DPH',
|
|
982
|
+
cell: ({ getValue }) => formatCzk(getValue()),
|
|
983
|
+
meta: { width: 164, align: 'right', defaultVisible: false, sortable: false },
|
|
984
|
+
}),
|
|
985
|
+
// The two boolean headers carry their full terms on one line, 172 / 164 for CZ
|
|
986
|
+
// (`chrome.boolean-columns`, table 1.40.0).
|
|
987
|
+
expenseCol.accessor('taxDeductible', {
|
|
988
|
+
id: 'taxDeductible',
|
|
989
|
+
header: 'Daňově uznatelný',
|
|
990
|
+
cell: ({ getValue }) => booleanBadge(getValue()),
|
|
991
|
+
meta: { width: 172, defaultVisible: false, sortable: false },
|
|
992
|
+
}),
|
|
993
|
+
expenseCol.accessor('inVatReturn', {
|
|
994
|
+
id: 'inVatReturn',
|
|
995
|
+
header: 'V přiznání k DPH',
|
|
996
|
+
cell: ({ getValue }) => booleanBadge(getValue()),
|
|
997
|
+
meta: { width: 164, defaultVisible: false, sortable: false },
|
|
998
|
+
}),
|
|
999
|
+
expenseCol.accessor('amountGross', {
|
|
1000
|
+
id: 'amountGross',
|
|
1001
|
+
header: 'Celkem s DPH',
|
|
1002
|
+
cell: ({ getValue }) => formatCzk(getValue()),
|
|
1003
|
+
meta: { width: 150, align: 'right', skeletonWidth: 84 },
|
|
1004
|
+
}),
|
|
1005
|
+
expenseCol.accessor('status', {
|
|
1006
|
+
id: 'status',
|
|
1007
|
+
header: 'Stav',
|
|
1008
|
+
cell: ({ row, getValue }) => {
|
|
1009
|
+
const status = EXPENSE_STATUS[getValue()];
|
|
1010
|
+
const content =
|
|
1011
|
+
getValue() === 'paid' && row.original.paidOn != null
|
|
1012
|
+
? `Zaplaceno ${formatDate(row.original.paidOn)}`
|
|
1013
|
+
: status.description;
|
|
1014
|
+
return h(StatusCell, { status, infoContent: content, infoLabel: `Stav výdaje ${row.original.number}` });
|
|
1015
|
+
},
|
|
1016
|
+
meta: { width: 140, sortable: false, skeletonWidth: 84 },
|
|
1017
|
+
}),
|
|
1018
|
+
]);
|
|
1019
|
+
|
|
1020
|
+
export const EXPENSE_SORT: Record<string, (row: Expense) => string | number | null> = {
|
|
1021
|
+
number: row => row.number,
|
|
1022
|
+
supplier: row => row.supplier,
|
|
1023
|
+
dueOn: row => row.dueOn,
|
|
1024
|
+
taxPointOn: row => row.taxPointOn,
|
|
1025
|
+
amountNet: row => row.amountNet,
|
|
1026
|
+
amountGross: row => row.amountGross,
|
|
1027
|
+
status: row => EXPENSE_STATUS[row.status].label,
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
// With hover / focus tooltips — the expense grid of `chrome.consumer-grids.vydaje`.
|
|
1031
|
+
export const expenseRowActions = (row: Expense): TableRowAction[] => [
|
|
1032
|
+
{ label: `Upravit výdaj ${row.number}`, tooltip: 'Upravit výdaj', icon: 'pencil-simple', onClick: noop },
|
|
1033
|
+
{ label: `Duplikovat výdaj ${row.number}`, tooltip: 'Duplikovat výdaj', icon: 'copy', onClick: noop },
|
|
1034
|
+
{ label: `Smazat výdaj ${row.number}`, tooltip: 'Smazat výdaj', icon: 'trash', onClick: noop },
|
|
1035
|
+
];
|
|
1036
|
+
|
|
1037
|
+
export const EXPENSE_MOBILE: TableMobileConfig<Expense> = {
|
|
1038
|
+
identityColumnId: 'number',
|
|
1039
|
+
secondaryColumnId: 'supplier',
|
|
1040
|
+
statusColumnId: 'status',
|
|
1041
|
+
amountColumnId: 'amountGross',
|
|
1042
|
+
primaryAction: () => ({ label: 'Upravit', icon: 'pencil-simple', onClick: noop }),
|
|
1043
|
+
moreActions: () => [
|
|
1044
|
+
{ label: 'Duplikovat', icon: 'copy', onClick: noop },
|
|
1045
|
+
{ label: 'Smazat', icon: 'trash', onClick: noop },
|
|
1046
|
+
],
|
|
1047
|
+
expandLabel: row => `Zobrazit detail výdaje ${row.number}`,
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1050
|
+
// ── Shared labels ────────────────────────────────────────────────────────────
|
|
1051
|
+
|
|
1052
|
+
export const PAGINATION_LABELS: TablePaginationLabels = {
|
|
1053
|
+
pageSize: 'Položek na stránku',
|
|
1054
|
+
pageSizeSelect: 'Počet položek na stránku',
|
|
1055
|
+
nav: 'Stránkování',
|
|
1056
|
+
previous: 'Předchozí',
|
|
1057
|
+
next: 'Další',
|
|
1058
|
+
page: 'Stránka',
|
|
1059
|
+
morePages: 'Další stránky',
|
|
1060
|
+
};
|
|
1061
|
+
|
|
1062
|
+
export const COLUMN_VISIBILITY_LABELS: TableColumnVisibility['labels'] = {
|
|
1063
|
+
settings: 'Nastavení sloupců',
|
|
1064
|
+
group: 'Zobrazené sloupce',
|
|
1065
|
+
reset: 'Obnovit výchozí',
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
export const LOAD_MORE_LABELS: TableMobileLoadMore['labels'] = {
|
|
1069
|
+
loadMore: 'Načíst další',
|
|
1070
|
+
shownOf: (shown, total) => `Zobrazeno ${shown} z ${total}`,
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
// ── Consumer configs ─────────────────────────────────────────────────────────
|
|
1074
|
+
|
|
1075
|
+
/** Everything one consumer grid hands the organism, plus what the story needs to fake the server. */
|
|
1076
|
+
export interface TableConsumer<TData extends RowData> {
|
|
1077
|
+
caption: string;
|
|
1078
|
+
scrollRegionLabel: string;
|
|
1079
|
+
columns: ColumnDef<TableFeatureSet, TData, any>[];
|
|
1080
|
+
data: TData[];
|
|
1081
|
+
getRowId: (row: TData) => string;
|
|
1082
|
+
getSubRows?: (row: TData) => TData[] | undefined;
|
|
1083
|
+
childRowPrefix?: (child: TData, parent: TData) => string;
|
|
1084
|
+
statusEdge?: (row: TData) => ChipEmotion | undefined;
|
|
1085
|
+
rowActions: (row: TData) => TableRowAction[];
|
|
1086
|
+
/** Omitted on the contact list — a list without bulk actions declines selection (`chrome.selection.per-consumer`). */
|
|
1087
|
+
selection?: { selectAllLabel: string; rowLabel: (row: TData) => string };
|
|
1088
|
+
mobile: TableMobileConfig<TData>;
|
|
1089
|
+
defaultSorting: SortingState;
|
|
1090
|
+
sortKeys: Record<string, (row: TData) => string | number | null>;
|
|
1091
|
+
/** Rows pinned above the sorted list (the invoice list's Budoucí, `consumer-grids.faktury.row-order`). */
|
|
1092
|
+
pinTop?: (row: TData) => boolean;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
export const INVOICE_LIST: TableConsumer<Invoice> = {
|
|
1096
|
+
caption: 'Vystavené faktury',
|
|
1097
|
+
scrollRegionLabel: 'Vystavené faktury — posuvná oblast',
|
|
1098
|
+
columns: INVOICE_COLUMNS,
|
|
1099
|
+
data: INVOICES,
|
|
1100
|
+
getRowId: row => row.id,
|
|
1101
|
+
getSubRows: row => row.creditNotes,
|
|
1102
|
+
childRowPrefix: invoiceChildPrefix,
|
|
1103
|
+
statusEdge: invoiceStatusEdge,
|
|
1104
|
+
rowActions: invoiceRowActions,
|
|
1105
|
+
selection: {
|
|
1106
|
+
selectAllLabel: 'Vybrat všechny faktury na této stránce',
|
|
1107
|
+
rowLabel: row => `Vybrat ${invoiceRef(row)}`,
|
|
1108
|
+
},
|
|
1109
|
+
mobile: INVOICE_MOBILE,
|
|
1110
|
+
defaultSorting: [{ id: 'number', desc: true }],
|
|
1111
|
+
sortKeys: INVOICE_SORT,
|
|
1112
|
+
pinTop: row => row.status === 'future',
|
|
1113
|
+
};
|
|
1114
|
+
|
|
1115
|
+
export const CONTACT_LIST: TableConsumer<Contact> = {
|
|
1116
|
+
caption: 'Kontakty',
|
|
1117
|
+
scrollRegionLabel: 'Kontakty — posuvná oblast',
|
|
1118
|
+
columns: CONTACT_COLUMNS,
|
|
1119
|
+
data: CONTACTS,
|
|
1120
|
+
getRowId: row => row.id,
|
|
1121
|
+
rowActions: contactRowActions,
|
|
1122
|
+
mobile: CONTACT_MOBILE,
|
|
1123
|
+
defaultSorting: [{ id: 'name', desc: false }],
|
|
1124
|
+
sortKeys: CONTACT_SORT,
|
|
1125
|
+
};
|
|
1126
|
+
|
|
1127
|
+
export const EXPENSE_LIST: TableConsumer<Expense> = {
|
|
1128
|
+
caption: 'Výdaje',
|
|
1129
|
+
scrollRegionLabel: 'Výdaje — posuvná oblast',
|
|
1130
|
+
columns: EXPENSE_COLUMNS,
|
|
1131
|
+
data: EXPENSES,
|
|
1132
|
+
getRowId: row => row.id,
|
|
1133
|
+
rowActions: expenseRowActions,
|
|
1134
|
+
selection: {
|
|
1135
|
+
selectAllLabel: 'Vybrat všechny výdaje na této stránce',
|
|
1136
|
+
rowLabel: row => `Vybrat výdaj ${row.number}`,
|
|
1137
|
+
},
|
|
1138
|
+
mobile: EXPENSE_MOBILE,
|
|
1139
|
+
defaultSorting: [{ id: 'number', desc: true }],
|
|
1140
|
+
sortKeys: EXPENSE_SORT,
|
|
1141
|
+
};
|
|
1142
|
+
|
|
1143
|
+
// ── Helpers the stories share ────────────────────────────────────────────────
|
|
1144
|
+
|
|
1145
|
+
/** The id TanStack resolves for a column definition. */
|
|
1146
|
+
const columnId = <TData extends RowData>(def: ColumnDef<TableFeatureSet, TData, unknown>) =>
|
|
1147
|
+
'id' in def && typeof def.id === 'string' ? def.id : undefined;
|
|
1148
|
+
|
|
1149
|
+
/** The consumer's default column set (`defaultVisible !== false`, locked always on). */
|
|
1150
|
+
export function defaultColumnVisibility<TData extends RowData>(columns: ColumnDef<TableFeatureSet, TData, any>[]): ColumnVisibilityState {
|
|
1151
|
+
const state: ColumnVisibilityState = {};
|
|
1152
|
+
columns.forEach((def) => {
|
|
1153
|
+
const id = columnId(def);
|
|
1154
|
+
if (id != null) state[id] = def.meta?.locked === true || def.meta?.defaultVisible !== false;
|
|
1155
|
+
});
|
|
1156
|
+
return state;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
* Stand-in for the server: orders top-level rows by the active sort (children ride with
|
|
1161
|
+
* their parent, so a cluster never splits) and keeps `pinTop` rows above the sorted list.
|
|
1162
|
+
*/
|
|
1163
|
+
export function sortRows<TData extends RowData>(
|
|
1164
|
+
rows: TData[],
|
|
1165
|
+
sorting: SortingState,
|
|
1166
|
+
keys: Record<string, (row: TData) => string | number | null>,
|
|
1167
|
+
pinTop?: (row: TData) => boolean,
|
|
1168
|
+
): TData[] {
|
|
1169
|
+
const active = sorting[0];
|
|
1170
|
+
const key = active ? keys[active.id] : undefined;
|
|
1171
|
+
const sorted = [...rows];
|
|
1172
|
+
if (active && key) {
|
|
1173
|
+
sorted.sort((a, b) => {
|
|
1174
|
+
const left = key(a);
|
|
1175
|
+
const right = key(b);
|
|
1176
|
+
if (left === right) return 0;
|
|
1177
|
+
// Empty values sink to the end in both directions.
|
|
1178
|
+
if (left == null) return 1;
|
|
1179
|
+
if (right == null) return -1;
|
|
1180
|
+
const order =
|
|
1181
|
+
typeof left === 'number' && typeof right === 'number'
|
|
1182
|
+
? left - right
|
|
1183
|
+
: String(left).localeCompare(String(right), 'cs');
|
|
1184
|
+
return active.desc ? -order : order;
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
if (!pinTop) return sorted;
|
|
1188
|
+
return [...sorted.filter(pinTop), ...sorted.filter(row => !pinTop(row))];
|
|
1189
|
+
}
|