@erxes/ui 4.0.0-v2.2 → 4.0.0-v2.20
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 +63 -0
- package/CATALOG.md +276 -0
- package/README.md +20 -0
- package/dist/components/accordion.d.ts +1 -0
- package/dist/components/accordion.js +1 -0
- package/dist/components/alert-dialog.d.ts +4 -0
- package/dist/components/alert-dialog.js +4 -0
- package/dist/components/alert.d.ts +1 -0
- package/dist/components/alert.js +1 -0
- package/dist/components/avatar.d.ts +2 -0
- package/dist/components/avatar.js +1 -0
- package/dist/components/background-gradient-animation.d.ts +4 -1
- package/dist/components/background-gradient-animation.js +4 -1
- package/dist/components/badge.d.ts +3 -0
- package/dist/components/badge.js +2 -0
- package/dist/components/breadcrumb.d.ts +1 -0
- package/dist/components/breadcrumb.js +1 -0
- package/dist/components/button.d.ts +6 -1
- package/dist/components/button.js +5 -1
- package/dist/components/calendar.d.ts +5 -0
- package/dist/components/calendar.js +4 -0
- package/dist/components/card.d.ts +1 -0
- package/dist/components/card.js +1 -0
- package/dist/components/chart-config.d.ts +4 -1
- package/dist/components/charts.d.ts +8 -1
- package/dist/components/charts.js +16 -6
- package/dist/components/checkbox.d.ts +1 -0
- package/dist/components/checkbox.js +1 -0
- package/dist/components/choicebox-group.d.ts +1 -0
- package/dist/components/choicebox-group.js +1 -0
- package/dist/components/collapsible.d.ts +1 -0
- package/dist/components/collapsible.js +1 -0
- package/dist/components/color-picker.d.ts +1 -0
- package/dist/components/color-picker.js +15 -8
- package/dist/components/combobox.d.ts +6 -1
- package/dist/components/combobox.js +13 -2
- package/dist/components/command-bar.d.ts +4 -0
- package/dist/components/command-bar.js +7 -0
- package/dist/components/command.d.ts +4 -0
- package/dist/components/command.js +4 -0
- package/dist/components/context-menu.d.ts +1 -0
- package/dist/components/context-menu.js +1 -0
- package/dist/components/copy-text.d.ts +1 -0
- package/dist/components/copy-text.js +1 -0
- package/dist/components/date-picker-value.d.ts +5 -9
- package/dist/components/date-picker-value.js +15 -34
- package/dist/components/date-picker.d.ts +4 -4
- package/dist/components/date-picker.js +9 -7
- package/dist/components/date-text-input.d.ts +2 -4
- package/dist/components/date-text-input.js +11 -9
- package/dist/components/dialog.d.ts +9 -2
- package/dist/components/dialog.js +24 -11
- package/dist/components/drag-handle.d.ts +1 -0
- package/dist/components/drag-handle.js +1 -0
- package/dist/components/dropdown-menu.d.ts +1 -0
- package/dist/components/dropdown-menu.js +1 -0
- package/dist/components/empty.d.ts +6 -1
- package/dist/components/empty.js +25 -2
- package/dist/components/field-control.d.ts +16 -0
- package/dist/components/field-control.js +19 -0
- package/dist/components/form-layout.d.ts +21 -0
- package/dist/components/form-layout.js +57 -0
- package/dist/components/form.d.ts +14 -3
- package/dist/components/form.js +24 -8
- package/dist/components/hover-card.d.ts +1 -0
- package/dist/components/hover-card.js +1 -0
- package/dist/components/icon-tip.d.ts +7 -0
- package/dist/components/icon-tip.js +16 -0
- package/dist/components/info-card.d.ts +4 -0
- package/dist/components/info-card.js +4 -0
- package/dist/components/input-group.d.ts +5 -4
- package/dist/components/input-group.js +6 -5
- package/dist/components/input.d.ts +2 -1
- package/dist/components/input.js +10 -4
- package/dist/components/kbd.d.ts +2 -1
- package/dist/components/kbd.js +2 -1
- package/dist/components/label.d.ts +1 -1
- package/dist/components/label.js +1 -1
- package/dist/components/multiselect.d.ts +1 -0
- package/dist/components/multiselect.js +7 -3
- package/dist/components/on-demand.d.ts +15 -2
- package/dist/components/on-demand.js +21 -1
- package/dist/components/popover.d.ts +4 -0
- package/dist/components/popover.js +21 -13
- package/dist/components/radio-group.d.ts +1 -0
- package/dist/components/radio-group.js +1 -0
- package/dist/components/scroll-area.d.ts +1 -0
- package/dist/components/scroll-area.js +1 -0
- package/dist/components/select.d.ts +5 -1
- package/dist/components/select.js +21 -10
- package/dist/components/separator.d.ts +4 -0
- package/dist/components/separator.js +4 -0
- package/dist/components/sheet.d.ts +9 -2
- package/dist/components/sheet.js +23 -10
- package/dist/components/sidebar/panel.js +1 -1
- package/dist/components/sidebar.d.ts +1 -0
- package/dist/components/sidebar.js +1 -0
- package/dist/components/skeleton.d.ts +1 -0
- package/dist/components/skeleton.js +1 -0
- package/dist/components/spinner.d.ts +1 -0
- package/dist/components/spinner.js +1 -0
- package/dist/components/string-array.js +1 -0
- package/dist/components/switch.d.ts +1 -0
- package/dist/components/switch.js +1 -0
- package/dist/components/table.d.ts +4 -0
- package/dist/components/table.js +4 -0
- package/dist/components/tabs.d.ts +8 -1
- package/dist/components/tabs.js +8 -1
- package/dist/components/text-overflow.d.ts +4 -1
- package/dist/components/text-overflow.js +4 -1
- package/dist/components/textarea.d.ts +1 -0
- package/dist/components/textarea.js +5 -1
- package/dist/components/toaster.d.ts +4 -1
- package/dist/components/toaster.js +5 -2
- package/dist/components/toggle-group.d.ts +5 -0
- package/dist/components/toggle-group.js +19 -11
- package/dist/components/toggle.d.ts +1 -0
- package/dist/components/toggle.js +1 -0
- package/dist/components/tooltip.d.ts +4 -0
- package/dist/components/tooltip.js +4 -0
- package/dist/components/upload.d.ts +4 -0
- package/dist/components/upload.js +20 -11
- package/dist/federation.d.ts +4 -0
- package/dist/federation.js +7 -1
- package/dist/hooks/use-focus-first-field.d.ts +8 -0
- package/dist/hooks/use-focus-first-field.js +15 -0
- package/dist/hooks/use-item-keys.d.ts +11 -0
- package/dist/hooks/use-item-keys.js +24 -0
- package/dist/hooks/use-page-hotkey.d.ts +14 -0
- package/dist/hooks/use-page-hotkey.js +24 -0
- package/dist/hooks/use-toast.d.ts +5 -0
- package/dist/hooks/use-toast.js +5 -0
- package/dist/index.d.ts +34 -7
- package/dist/index.js +32 -4
- package/dist/lib/format.d.ts +60 -0
- package/dist/lib/format.js +86 -0
- package/dist/lib/money.d.ts +13 -0
- package/dist/lib/money.js +21 -0
- package/dist/lib/render-in-dom.d.ts +6 -0
- package/dist/lib/render-in-dom.js +26 -0
- package/dist/lib/stored.d.ts +13 -0
- package/dist/lib/stored.js +41 -0
- package/dist/lib/text.d.ts +11 -0
- package/dist/lib/text.js +18 -0
- package/dist/modules/attachments/use-carousel.js +5 -10
- package/dist/modules/blocks/components/BlockEditor.js +2 -2
- package/dist/modules/blocks/components/Editor.d.ts +1 -1
- package/dist/modules/blocks/components/Editor.js +5 -2
- package/dist/modules/blocks/hooks/useBarcodeSizeForm.d.ts +1 -1
- package/dist/modules/blocks/hooks/useBlockEditor.d.ts +3 -0
- package/dist/modules/blocks/hooks/useBlockEditor.js +21 -2
- package/dist/modules/blocks/types/TextEditor.d.ts +3 -1
- package/dist/modules/blocks/utils/parseBlocks.d.ts +1 -1
- package/dist/modules/blocks/utils/parseBlocks.js +1 -1
- package/dist/modules/conditions/ConditionsEditor.d.ts +13 -0
- package/dist/modules/conditions/ConditionsEditor.js +171 -0
- package/dist/modules/conditions/DateEditors.d.ts +8 -0
- package/dist/modules/conditions/DateEditors.js +188 -0
- package/dist/modules/conditions/FieldPicker.d.ts +17 -0
- package/dist/modules/conditions/FieldPicker.js +99 -0
- package/dist/modules/conditions/LazyConditionsEditor.d.ts +10 -0
- package/dist/modules/conditions/LazyConditionsEditor.js +11 -0
- package/dist/modules/conditions/RuleParts.d.ts +30 -0
- package/dist/modules/conditions/RuleParts.js +78 -0
- package/dist/modules/conditions/RuleRow.d.ts +27 -0
- package/dist/modules/conditions/RuleRow.js +156 -0
- package/dist/modules/conditions/TypedInput.d.ts +13 -0
- package/dist/modules/conditions/TypedInput.js +36 -0
- package/dist/modules/conditions/ValueEditor.d.ts +18 -0
- package/dist/modules/conditions/ValueEditor.js +169 -0
- package/dist/modules/conditions/conditions.d.ts +77 -0
- package/dist/modules/conditions/conditions.js +69 -0
- package/dist/modules/conditions/fieldIcons.d.ts +6 -0
- package/dist/modules/conditions/fieldIcons.js +21 -0
- package/dist/modules/conditions/fieldOptions.d.ts +15 -0
- package/dist/modules/conditions/fieldOptions.js +38 -0
- package/dist/modules/conditions/filterRule.d.ts +45 -0
- package/dist/modules/conditions/filterRule.js +171 -0
- package/dist/modules/conditions/filterText.d.ts +16 -0
- package/dist/modules/conditions/filterText.js +156 -0
- package/dist/modules/display/components/EmailDisplay.d.ts +4 -0
- package/dist/modules/display/components/EmailDisplay.js +6 -3
- package/dist/modules/display/components/PhoneDisplay.d.ts +4 -0
- package/dist/modules/display/components/PhoneDisplay.js +4 -0
- package/dist/modules/display/components/RelativeDateDisplay.d.ts +7 -5
- package/dist/modules/display/components/RelativeDateDisplay.js +10 -8
- package/dist/modules/display/components/SexDisplay.d.ts +1 -0
- package/dist/modules/display/components/SexDisplay.js +1 -0
- package/dist/modules/filter/components/Filter.d.ts +4 -0
- package/dist/modules/filter/components/Filter.js +4 -0
- package/dist/modules/filter/components/FilterBar.js +8 -7
- package/dist/modules/filter/components/FilterDialog.js +4 -5
- package/dist/modules/filter/components/FilterPopover.js +1 -1
- package/dist/modules/filter/components/FilterProvider.d.ts +1 -2
- package/dist/modules/filter/components/FilterProvider.js +22 -16
- package/dist/modules/filter/hooks/useFilterContext.d.ts +1 -0
- package/dist/modules/filter/hooks/useFilterContext.js +1 -0
- package/dist/modules/filter/types/filter.d.ts +0 -1
- package/dist/modules/hotkey/components/PopoverScoped.d.ts +5 -0
- package/dist/modules/hotkey/components/PopoverScoped.js +5 -0
- package/dist/modules/hotkey/hooks/usePreviousHotkeyScope.d.ts +1 -0
- package/dist/modules/hotkey/hooks/usePreviousHotkeyScope.js +1 -0
- package/dist/modules/hotkey/hooks/useScopedHotkeys.d.ts +5 -1
- package/dist/modules/hotkey/hooks/useScopedHotkeys.js +5 -1
- package/dist/modules/icons/components/IconComponent.d.ts +4 -0
- package/dist/modules/icons/components/IconComponent.js +4 -0
- package/dist/modules/icons/components/IconPicker.d.ts +4 -0
- package/dist/modules/icons/components/IconPicker.js +7 -5
- package/dist/modules/icons/providers/IconsProvider.d.ts +1 -0
- package/dist/modules/icons/providers/IconsProvider.js +1 -0
- package/dist/modules/inputs/components/EmailField.d.ts +4 -1
- package/dist/modules/inputs/components/EmailField.js +4 -1
- package/dist/modules/inputs/components/FullNameField.d.ts +6 -0
- package/dist/modules/inputs/components/FullNameField.js +20 -8
- package/dist/modules/inputs/components/PhoneField.d.ts +4 -1
- package/dist/modules/inputs/components/PhoneField.js +4 -1
- package/dist/modules/inputs/components/SexField.d.ts +1 -0
- package/dist/modules/inputs/components/SexField.js +1 -0
- package/dist/modules/layout/components/AppLayout.d.ts +6 -6
- package/dist/modules/layout/components/AppLayout.js +12 -13
- package/dist/modules/layout/components/AppLayoutResizeHandle.d.ts +5 -12
- package/dist/modules/layout/components/AppLayoutResizeHandle.js +15 -18
- package/dist/modules/layout/components/Page.d.ts +5 -0
- package/dist/modules/layout/components/Page.js +5 -0
- package/dist/modules/layout/components/PageHeader.d.ts +4 -1
- package/dist/modules/layout/components/PageHeader.js +4 -1
- package/dist/modules/list/DisplayMenu.d.ts +37 -0
- package/dist/modules/list/DisplayMenu.js +92 -0
- package/dist/modules/list/ListFilter.d.ts +83 -0
- package/dist/modules/list/ListFilter.js +83 -0
- package/dist/modules/list/ViewBar.d.ts +47 -0
- package/dist/modules/list/ViewBar.js +65 -0
- package/dist/modules/list/filter/AddFilter.d.ts +10 -0
- package/dist/modules/list/filter/AddFilter.js +140 -0
- package/dist/modules/list/filter/AdvancedPopover.d.ts +8 -0
- package/dist/modules/list/filter/AdvancedPopover.js +103 -0
- package/dist/modules/list/filter/ListFilterBar.d.ts +6 -0
- package/dist/modules/list/filter/ListFilterBar.js +157 -0
- package/dist/modules/list/filter/RecordCount.d.ts +7 -0
- package/dist/modules/list/filter/RecordCount.js +22 -0
- package/dist/modules/list/filter/RuleChips.d.ts +12 -0
- package/dist/modules/list/filter/RuleChips.js +151 -0
- package/dist/modules/list/filter/SearchChip.d.ts +6 -0
- package/dist/modules/list/filter/SearchChip.js +69 -0
- package/dist/modules/list/filter/filterRules.d.ts +21 -0
- package/dist/modules/list/filter/filterRules.js +37 -0
- package/dist/modules/list/filter/listFilterContext.d.ts +36 -0
- package/dist/modules/list/filter/listFilterContext.js +18 -0
- package/dist/modules/list/filter/listFilterQuery.d.ts +20 -0
- package/dist/modules/list/filter/listFilterQuery.js +30 -0
- package/dist/modules/navigation-menu/components/NavigationMenu.d.ts +4 -3
- package/dist/modules/navigation-menu/components/NavigationMenu.js +7 -7
- package/dist/modules/pickers/EntityPicker.d.ts +7 -0
- package/dist/modules/pickers/EntityPicker.js +7 -0
- package/dist/modules/pickers/LookupPicker.d.ts +57 -0
- package/dist/modules/pickers/LookupPicker.js +115 -0
- package/dist/modules/pickers/SelectMember.d.ts +17 -2
- package/dist/modules/pickers/SelectMember.js +58 -4
- package/dist/modules/pickers/members.d.ts +3 -2
- package/dist/modules/pickers/members.js +1 -1
- package/dist/modules/record-field/components/NumberField.d.ts +5 -0
- package/dist/modules/record-field/components/NumberField.js +14 -7
- package/dist/modules/record-field/components/TextField.d.ts +4 -0
- package/dist/modules/record-field/components/TextField.js +10 -2
- package/dist/modules/record-field/meta-inputs/components/PhoneInput.d.ts +5 -0
- package/dist/modules/record-field/meta-inputs/components/PhoneInput.js +5 -0
- package/dist/modules/record-list/RecordList.d.ts +19 -0
- package/dist/modules/record-list/RecordList.js +24 -0
- package/dist/modules/record-list/RecordListProvider.d.ts +30 -0
- package/dist/modules/record-list/RecordListProvider.js +57 -0
- package/dist/modules/record-list/RecordListRoot.d.ts +30 -0
- package/dist/modules/record-list/RecordListRoot.js +140 -0
- package/dist/modules/record-list/selection.d.ts +22 -0
- package/dist/modules/record-list/selection.js +54 -0
- package/dist/modules/record-panel/PanelDescriptionEditor.d.ts +9 -0
- package/dist/modules/record-panel/PanelDescriptionEditor.js +39 -0
- package/dist/modules/record-panel/PanelDescriptionField.d.ts +13 -0
- package/dist/modules/record-panel/PanelDescriptionField.js +39 -0
- package/dist/modules/record-panel/PanelField.d.ts +17 -0
- package/dist/modules/record-panel/PanelField.js +47 -0
- package/dist/modules/record-panel/PanelForm.d.ts +30 -0
- package/dist/modules/record-panel/PanelForm.js +154 -0
- package/dist/modules/record-panel/PanelLabel.d.ts +10 -0
- package/dist/modules/record-panel/PanelLabel.js +55 -0
- package/dist/modules/record-panel/PanelSection.d.ts +12 -0
- package/dist/modules/record-panel/PanelSection.js +24 -0
- package/dist/modules/record-panel/panelExpansion.d.ts +10 -0
- package/dist/modules/record-panel/panelExpansion.js +7 -0
- package/dist/modules/record-panel/useSaveOnLeave.d.ts +14 -0
- package/dist/modules/record-panel/useSaveOnLeave.js +42 -0
- package/dist/modules/record-table/components/RecordTable.d.ts +6 -0
- package/dist/modules/record-table/components/RecordTable.js +6 -0
- package/dist/modules/record-table/components/RecordTableCell.d.ts +9 -0
- package/dist/modules/record-table/components/RecordTableCell.js +16 -2
- package/dist/modules/record-table/components/RecordTableCellInline.d.ts +5 -0
- package/dist/modules/record-table/components/RecordTableCellInline.js +8 -7
- package/dist/modules/record-table/components/RecordTableCursor.js +30 -28
- package/dist/modules/record-table/components/RecordTableHead.d.ts +7 -2
- package/dist/modules/record-table/components/RecordTableHead.js +73 -6
- package/dist/modules/record-table/components/RecordTableProvider.d.ts +22 -1
- package/dist/modules/record-table/components/RecordTableProvider.js +24 -8
- package/dist/modules/record-table/hooks/useTablePreferences.d.ts +1 -1
- package/dist/modules/record-table/hooks/useTablePreferences.js +18 -31
- package/dist/modules/record-table/states/RecordTableCursorState.d.ts +21 -1
- package/dist/modules/record-table/states/RecordTableCursorState.js +21 -3
- package/dist/modules/record-table/types/RecordTableCursorTypes.d.ts +1 -0
- package/dist/modules/record-table/types/RecordTableCursorTypes.js +1 -0
- package/dist/modules/records/ContactLink.d.ts +13 -0
- package/dist/modules/records/ContactLink.js +49 -0
- package/dist/modules/records/ContactPicker.d.ts +36 -0
- package/dist/modules/records/ContactPicker.js +173 -0
- package/dist/modules/records/MemberLink.d.ts +12 -0
- package/dist/modules/records/MemberLink.js +25 -0
- package/dist/modules/records/RecordChip.d.ts +13 -0
- package/dist/modules/records/RecordChip.js +46 -0
- package/dist/modules/records/contacts.d.ts +53 -0
- package/dist/modules/records/contacts.js +10 -0
- package/dist/modules/records/openRecord.d.ts +94 -0
- package/dist/modules/records/openRecord.js +72 -0
- package/dist/node_modules/.pnpm/vitest@5.1.0_@opentelemetry_api@1.10.0_@types_node@26.6.6_@vitest_browser-preview@5.1.0_d78d0f63d2a6b1c4a51a56547b330411/node_modules/vitest/dist/chunks/display.BlTmubjj.js +181 -0
- package/dist/node_modules/.pnpm/vitest@5.1.0_@opentelemetry_api@1.10.0_@types_node@26.6.6_@vitest_browser-preview@5.1.0_d78d0f63d2a6b1c4a51a56547b330411/node_modules/vitest/dist/chunks/index.D0heQG4v.js +987 -0
- package/dist/node_modules/.pnpm/vitest@5.1.0_@opentelemetry_api@1.10.0_@types_node@26.6.6_@vitest_browser-preview@5.1.0_d78d0f63d2a6b1c4a51a56547b330411/node_modules/vitest/dist/chunks/pathe.M-eThtNZ.zq3TM4NT.js +176 -0
- package/dist/node_modules/.pnpm/vitest@5.1.0_@opentelemetry_api@1.10.0_@types_node@26.6.6_@vitest_browser-preview@5.1.0_d78d0f63d2a6b1c4a51a56547b330411/node_modules/vitest/dist/chunks/run.CjdgFZiW.js +1509 -0
- package/dist/node_modules/.pnpm/vitest@5.1.0_@opentelemetry_api@1.10.0_@types_node@26.6.6_@vitest_browser-preview@5.1.0_d78d0f63d2a6b1c4a51a56547b330411/node_modules/vitest/dist/chunks/source-map.DakdQc29.js +687 -0
- package/dist/node_modules/.pnpm/vitest@5.1.0_@opentelemetry_api@1.10.0_@types_node@26.6.6_@vitest_browser-preview@5.1.0_d78d0f63d2a6b1c4a51a56547b330411/node_modules/vitest/dist/chunks/tinyrainbow.Do8I1XRG.js +85 -0
- package/dist/node_modules/.pnpm/vitest@5.1.0_@opentelemetry_api@1.10.0_@types_node@26.6.6_@vitest_browser-preview@5.1.0_d78d0f63d2a6b1c4a51a56547b330411/node_modules/vitest/dist/task-utils.js +6 -0
- package/dist/state/sidebarPanelState.js +7 -2
- package/dist/state/themeState.d.ts +13 -2
- package/dist/state/themeState.js +18 -4
- package/dist/theme.css +3 -0
- package/dist/types/SexCode.d.ts +1 -0
- package/dist/types/SexCode.js +1 -0
- package/dist/types/UIConfig.d.ts +182 -86
- package/dist/types/UIConfig.js +14 -0
- package/dist/utils/IsUndefinedOrNull.d.ts +1 -0
- package/dist/utils/IsUndefinedOrNull.js +1 -0
- package/dist/utils/file-storage.d.ts +1 -0
- package/dist/utils/file-storage.js +1 -0
- package/dist/utils/format/formatPhoneNumber.d.ts +4 -0
- package/dist/utils/format/formatPhoneNumber.js +4 -0
- package/dist/utils/getPluginAssetsUrl.d.ts +5 -0
- package/dist/utils/getPluginAssetsUrl.js +5 -0
- package/dist/utils/host-component.d.ts +10 -0
- package/dist/utils/host-component.js +34 -0
- package/dist/utils/json.d.ts +3 -2
- package/dist/utils/json.js +3 -2
- package/dist/utils/plugin-runtime.d.ts +21 -17
- package/dist/utils/plugin-runtime.js +59 -12
- package/dist/utils/plugin-styles.d.ts +10 -3
- package/dist/utils/plugin-styles.js +44 -12
- package/dist/utils/record-timeline.d.ts +10 -9
- package/dist/utils/record-timeline.js +12 -17
- package/exports.txt +249 -0
- package/package.json +14 -3
- package/dist/constants/IntlLanguages.d.ts +0 -74
- package/dist/constants/IntlLanguages.js +0 -76
- package/dist/hooks/use-query-state.d.ts +0 -16
- package/dist/hooks/use-query-state.js +0 -122
- package/dist/modules/filter/hooks/useFilterQueryState.d.ts +0 -4
- package/dist/modules/filter/hooks/useFilterQueryState.js +0 -14
- package/dist/types/Theme.d.ts +0 -1
- package/dist/types/Theme.js +0 -0
- package/dist/utils/localization/formatDateISOStringToRelativeDate.d.ts +0 -2
- package/dist/utils/localization/formatDateISOStringToRelativeDate.js +0 -16
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Each series' label, icon and colour by data key, for `ChartContainer`.
|
|
4
|
+
* A series' colour is a theme colour, such as `var(--chart-1)`, so it follows light and dark.
|
|
5
|
+
*/
|
|
3
6
|
export type ChartConfig = { [k in string]: {
|
|
4
7
|
label?: React.ReactNode;
|
|
5
8
|
icon?: React.ComponentType;
|
|
@@ -3,9 +3,14 @@ import React from "react";
|
|
|
3
3
|
import * as RechartsPrimitive from "recharts";
|
|
4
4
|
import { LegendPayload } from "recharts/types/component/DefaultLegendContent";
|
|
5
5
|
import { Payload } from "recharts/types/component/DefaultTooltipContent";
|
|
6
|
+
/**
|
|
7
|
+
* The frame for a `responsive` recharts chart: size, theme and colours.
|
|
8
|
+
* The chart (`<BarChart responsive …>`) fills the frame and follows its size. Each `config`
|
|
9
|
+
* colour becomes a `--color-<key>` variable the chart's parts can use. The frame needs nothing
|
|
10
|
+
* from recharts, so a plugin's chart from its own recharts sizes the same.
|
|
11
|
+
*/
|
|
6
12
|
declare const ChartContainer: ({ ref, className, children, config, style, ...props }: React.ComponentProps<'div'> & {
|
|
7
13
|
config: ChartConfig;
|
|
8
|
-
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
|
|
9
14
|
}) => React.JSX.Element;
|
|
10
15
|
type TooltipItem = Payload;
|
|
11
16
|
type ChartTooltipContentProps = React.ComponentProps<typeof RechartsPrimitive.Tooltip> & React.ComponentProps<'div'> & {
|
|
@@ -17,7 +22,9 @@ type ChartTooltipContentProps = React.ComponentProps<typeof RechartsPrimitive.To
|
|
|
17
22
|
payload?: TooltipItem[];
|
|
18
23
|
label?: React.ReactNode;
|
|
19
24
|
};
|
|
25
|
+
/** The themed body for a recharts `Tooltip`, labelled from the config. */
|
|
20
26
|
declare const ChartTooltipContent: ({ ref, ...props }: ChartTooltipContentProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element | null;
|
|
27
|
+
/** The themed body for a recharts `Legend`: each series' icon and label. */
|
|
21
28
|
declare const ChartLegendContent: ({ ref, className, hideIcon, payload, verticalAlign, nameKey }: React.ComponentProps<'div'> & {
|
|
22
29
|
verticalAlign?: 'top' | 'middle' | 'bottom';
|
|
23
30
|
payload?: readonly LegendPayload[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { useFormat } from "../lib/format.js";
|
|
1
2
|
import { cn } from "../lib/utils.js";
|
|
2
3
|
import { ChartContext, configFor, fillOf, keyOf, useChart } from "./chart-config.js";
|
|
3
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import "react";
|
|
5
|
-
import * as RechartsPrimitive from "recharts";
|
|
5
|
+
import React from "react";
|
|
6
6
|
// src/components/charts.tsx
|
|
7
7
|
/** The series colours as `--color-<key>` variables. */
|
|
8
8
|
const colorVariables = (config) => {
|
|
@@ -10,19 +10,26 @@ const colorVariables = (config) => {
|
|
|
10
10
|
for (const [key, { color }] of Object.entries(config)) if (color) variables[`--color-${key}`] = color;
|
|
11
11
|
return variables;
|
|
12
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* The frame for a `responsive` recharts chart: size, theme and colours.
|
|
15
|
+
* The chart (`<BarChart responsive …>`) fills the frame and follows its size. Each `config`
|
|
16
|
+
* colour becomes a `--color-<key>` variable the chart's parts can use. The frame needs nothing
|
|
17
|
+
* from recharts, so a plugin's chart from its own recharts sizes the same.
|
|
18
|
+
*/
|
|
13
19
|
const ChartContainer = ({ ref, className, children, config, style, ...props }) => {
|
|
14
20
|
const cssVariables = colorVariables(config);
|
|
21
|
+
const chart = React.useMemo(() => ({ config }), [config]);
|
|
15
22
|
return /* @__PURE__ */ jsx(ChartContext.Provider, {
|
|
16
|
-
value:
|
|
23
|
+
value: chart,
|
|
17
24
|
children: /* @__PURE__ */ jsx("div", {
|
|
18
25
|
ref,
|
|
19
26
|
style: {
|
|
20
27
|
...cssVariables,
|
|
21
28
|
...style
|
|
22
29
|
},
|
|
23
|
-
className: cn("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-hidden [&_.recharts-surface]:outline-hidden", className),
|
|
30
|
+
className: cn("flex aspect-video justify-center text-xs [&>.recharts-wrapper]:size-full [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-hidden [&_.recharts-surface]:outline-hidden", className),
|
|
24
31
|
...props,
|
|
25
|
-
children
|
|
32
|
+
children
|
|
26
33
|
})
|
|
27
34
|
});
|
|
28
35
|
};
|
|
@@ -48,6 +55,7 @@ const TooltipIndicator = ({ indicator, color, nested }) => /* @__PURE__ */ jsx("
|
|
|
48
55
|
});
|
|
49
56
|
const TooltipRow = ({ item, index, payload, props, label }) => {
|
|
50
57
|
const { config } = useChart();
|
|
58
|
+
const fmt = useFormat();
|
|
51
59
|
const { indicator = "dot", formatter } = props;
|
|
52
60
|
const nested = label !== null;
|
|
53
61
|
const itemConfig = configFor(config, item, keyOf(props.nameKey, item.name, item.dataKey));
|
|
@@ -66,10 +74,11 @@ const TooltipRow = ({ item, index, payload, props, label }) => {
|
|
|
66
74
|
})]
|
|
67
75
|
}), item.value !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
68
76
|
className: "font-mono font-medium tabular-nums text-foreground",
|
|
69
|
-
children: item.value.
|
|
77
|
+
children: typeof item.value === "number" ? fmt.number(item.value) : String(item.value)
|
|
70
78
|
})]
|
|
71
79
|
})] });
|
|
72
80
|
};
|
|
81
|
+
/** The themed body for a recharts `Tooltip`, labelled from the config. */
|
|
73
82
|
const ChartTooltipContent = ({ ref, ...props }) => {
|
|
74
83
|
const { active, payload, className, indicator = "dot", hideLabel = false } = props;
|
|
75
84
|
if (!active || !payload?.length) return null;
|
|
@@ -96,6 +105,7 @@ const ChartTooltipContent = ({ ref, ...props }) => {
|
|
|
96
105
|
})]
|
|
97
106
|
});
|
|
98
107
|
};
|
|
108
|
+
/** The themed body for a recharts `Legend`: each series' icon and label. */
|
|
99
109
|
const ChartLegendContent = ({ ref, className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }) => {
|
|
100
110
|
const { config } = useChart();
|
|
101
111
|
if (!payload?.length) return null;
|
|
@@ -2,6 +2,7 @@ import { cn } from "../lib/utils.js";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
|
|
4
4
|
// src/components/checkbox.tsx
|
|
5
|
+
/** A themed checkbox; pass `indeterminate` for a partial selection. */
|
|
5
6
|
const Checkbox = ({ className, ...props }) => /* @__PURE__ */ jsx(Checkbox$1.Root, {
|
|
6
7
|
className: cn("peer inline-flex items-center justify-center size-4 shrink-0 rounded border border-scroll outline-offset-2 focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-ring/70 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-checked:border-primary data-indeterminate:border-primary data-checked:bg-primary data-indeterminate:bg-primary data-checked:text-primary-foreground data-indeterminate:text-primary-foreground bg-background", className),
|
|
7
8
|
...props,
|
|
@@ -13,6 +13,7 @@ interface ChoiceboxItemProps extends Omit<ComponentPropsWithoutRef<'div'>, 'titl
|
|
|
13
13
|
children: ReactNode;
|
|
14
14
|
}
|
|
15
15
|
declare const ChoiceboxItem: ({ ref, className, value, title, disabled, children }: ChoiceboxItemProps & React.RefAttributes<HTMLLabelElement>) => import("react").JSX.Element;
|
|
16
|
+
/** Radio choices drawn as large tiles with a title and text. */
|
|
16
17
|
export declare const ChoiceboxGroup: typeof ChoiceboxGroupRoot & {
|
|
17
18
|
Item: typeof ChoiceboxItem;
|
|
18
19
|
};
|
|
@@ -38,5 +38,6 @@ const ChoiceboxItem = ({ ref, className, value, title, disabled, children }) =>
|
|
|
38
38
|
})]
|
|
39
39
|
}, `${id}-${value}`);
|
|
40
40
|
};
|
|
41
|
+
/** Radio choices drawn as large tiles with a title and text. */
|
|
41
42
|
const ChoiceboxGroup = Object.assign(ChoiceboxGroupRoot, { Item: ChoiceboxItem });
|
|
42
43
|
export { ChoiceboxGroup };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IconCaretDownFilled } from "@tabler/icons-react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
declare const TriggerIcon: ({ className, ...props }: React.ComponentProps<typeof IconCaretDownFilled>) => React.JSX.Element;
|
|
4
|
+
/** One section that folds open and shut, with a caret icon for its trigger. */
|
|
4
5
|
export declare const Collapsible: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").CollapsibleRootProps, "ref"> & React.RefAttributes<HTMLDivElement>> & {
|
|
5
6
|
Trigger: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").CollapsibleTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
6
7
|
TriggerIcon: typeof TriggerIcon;
|
|
@@ -8,6 +8,7 @@ const TriggerIcon = ({ className, ...props }) => /* @__PURE__ */ jsx(IconCaretDo
|
|
|
8
8
|
className: cn("transition-transform duration-100 group-data-closed:-rotate-90", className),
|
|
9
9
|
...props
|
|
10
10
|
});
|
|
11
|
+
/** One section that folds open and shut, with a caret icon for its trigger. */
|
|
11
12
|
const Collapsible = Object.assign(Collapsible$1.Root, {
|
|
12
13
|
Trigger: Collapsible$1.Trigger,
|
|
13
14
|
TriggerIcon,
|
|
@@ -19,6 +19,7 @@ declare const ColorPickerRoot: ({ ref, value, onValueChange, colors, scope, clas
|
|
|
19
19
|
colors?: Record<string, string>;
|
|
20
20
|
scope?: string;
|
|
21
21
|
} & React.RefAttributes<React.ComponentRef<typeof Combobox.TriggerBase>>) => React.JSX.Element;
|
|
22
|
+
/** A swatch button that opens preset colours and a hex input in a popover. */
|
|
22
23
|
export declare const ColorPicker: typeof ColorPickerRoot & {
|
|
23
24
|
Provider: typeof ColorPickerProvider;
|
|
24
25
|
Trigger: typeof ColorPickerTrigger;
|
|
@@ -3,10 +3,10 @@ import { Popover } from "./popover.js";
|
|
|
3
3
|
import { inputVariants } from "./input.js";
|
|
4
4
|
import { cn } from "../lib/utils.js";
|
|
5
5
|
import { PopoverScoped } from "../modules/hotkey/components/PopoverScoped.js";
|
|
6
|
+
import { MaskInput } from "./on-demand.js";
|
|
6
7
|
import { IconCheck, IconChevronDown } from "@tabler/icons-react";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { createContext, useContext, useState } from "react";
|
|
9
|
-
import { IMaskInput } from "react-imask";
|
|
9
|
+
import { createContext, useContext, useMemo, useState } from "react";
|
|
10
10
|
// src/components/color-picker.tsx
|
|
11
11
|
const DEFAULT_COLORS = {
|
|
12
12
|
red: "#dc2626",
|
|
@@ -33,12 +33,17 @@ const useColorPickerContext = () => {
|
|
|
33
33
|
return context;
|
|
34
34
|
};
|
|
35
35
|
const ColorPickerProvider = ({ children, value, onValueChange, colors = DEFAULT_COLORS, open, onOpenChange, scope }) => {
|
|
36
|
+
const picker = useMemo(() => ({
|
|
37
|
+
value,
|
|
38
|
+
onValueChange,
|
|
39
|
+
colors
|
|
40
|
+
}), [
|
|
41
|
+
value,
|
|
42
|
+
onValueChange,
|
|
43
|
+
colors
|
|
44
|
+
]);
|
|
36
45
|
return /* @__PURE__ */ jsx(ColorPickerContext.Provider, {
|
|
37
|
-
value:
|
|
38
|
-
value,
|
|
39
|
-
onValueChange,
|
|
40
|
-
colors
|
|
41
|
-
},
|
|
46
|
+
value: picker,
|
|
42
47
|
children: /* @__PURE__ */ jsx(PopoverScoped, {
|
|
43
48
|
scope,
|
|
44
49
|
open,
|
|
@@ -83,11 +88,12 @@ const ColorPickerContent = ({ setOpen }) => {
|
|
|
83
88
|
style: { "--swatch": value },
|
|
84
89
|
children: [/* @__PURE__ */ jsx("input", {
|
|
85
90
|
type: "color",
|
|
91
|
+
"aria-label": "Custom color",
|
|
86
92
|
value: value || "#000000",
|
|
87
93
|
className: "absolute inset-0 w-full h-full opacity-0 cursor-pointer",
|
|
88
94
|
onChange: (e) => onValueChange?.(e.target.value)
|
|
89
95
|
}), "#"]
|
|
90
|
-
}), /* @__PURE__ */ jsx(
|
|
96
|
+
}), /* @__PURE__ */ jsx(MaskInput, {
|
|
91
97
|
mask: /^[0-9A-Fa-f]+$/,
|
|
92
98
|
className: cn(inputVariants(), "pl-9"),
|
|
93
99
|
value: (value || "").replace("#", ""),
|
|
@@ -122,6 +128,7 @@ const ColorPickerRoot = ({ ref, value, onValueChange, colors, scope, className,
|
|
|
122
128
|
}), /* @__PURE__ */ jsx(ColorPickerContent, { setOpen })]
|
|
123
129
|
});
|
|
124
130
|
};
|
|
131
|
+
/** A swatch button that opens preset colours and a hex input in a popover. */
|
|
125
132
|
const ColorPicker = Object.assign(ColorPickerRoot, {
|
|
126
133
|
Provider: ColorPickerProvider,
|
|
127
134
|
Trigger: ColorPickerTrigger,
|
|
@@ -7,7 +7,7 @@ type ComboboxTriggerProps = Omit<React.ComponentProps<typeof Button>, 'variant'>
|
|
|
7
7
|
variant?: React.ComponentProps<typeof Button>['variant'] | 'bordered';
|
|
8
8
|
hideChevron?: boolean;
|
|
9
9
|
};
|
|
10
|
-
declare const ComboboxTriggerBase: ({ ref, className, children, hideChevron, variant, ...props }: ComboboxTriggerProps) => React.JSX.Element;
|
|
10
|
+
declare const ComboboxTriggerBase: ({ ref, className, children, hideChevron, variant, id, ...props }: ComboboxTriggerProps) => React.JSX.Element;
|
|
11
11
|
declare const ComboboxTrigger: ({ ref, children, hideChevron, ...props }: ComboboxTriggerProps) => React.JSX.Element;
|
|
12
12
|
declare const ComboboxValue: ({ ref, value, className, placeholder, loading, ...props }: React.HTMLAttributes<HTMLSpanElement> & {
|
|
13
13
|
placeholder?: string;
|
|
@@ -35,6 +35,11 @@ declare const ComboboxEmpty: ({ ref, className, loading, error, ...props }: Reac
|
|
|
35
35
|
loading?: boolean;
|
|
36
36
|
error?: Pick<Error, 'message'> | null;
|
|
37
37
|
}) => React.JSX.Element;
|
|
38
|
+
/**
|
|
39
|
+
* Parts of a popover picker: trigger, value, content, check, load-more.
|
|
40
|
+
* Put a `Command` inside `Combobox.Content` for the searchable list. `ChipTrigger` is the
|
|
41
|
+
* labelled chip a filter bar uses.
|
|
42
|
+
*/
|
|
38
43
|
export declare const Combobox: {
|
|
39
44
|
TriggerBase: typeof ComboboxTriggerBase;
|
|
40
45
|
Trigger: typeof ComboboxTrigger;
|
|
@@ -4,19 +4,25 @@ import { Popover } from "./popover.js";
|
|
|
4
4
|
import { Command } from "./command.js";
|
|
5
5
|
import { Skeleton } from "./skeleton.js";
|
|
6
6
|
import { Spinner } from "./spinner.js";
|
|
7
|
+
import { useCellLabel } from "../modules/record-table/components/RecordTableCell.js";
|
|
8
|
+
import { useFieldState } from "./field-control.js";
|
|
7
9
|
import { IconCheck, IconChevronDown, IconX } from "@tabler/icons-react";
|
|
8
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
11
|
import "react";
|
|
10
12
|
import { useOnInView } from "react-intersection-observer";
|
|
11
13
|
// src/components/combobox.tsx
|
|
12
|
-
const ComboboxTriggerBase = ({ ref, className, children, hideChevron = false, variant = "outline", ...props }) => {
|
|
14
|
+
const ComboboxTriggerBase = ({ ref, className, children, hideChevron = false, variant = "outline", id, ...props }) => {
|
|
15
|
+
const label = useCellLabel(id);
|
|
16
|
+
const field = useFieldState();
|
|
13
17
|
return /* @__PURE__ */ jsx(Popover.Trigger, {
|
|
14
18
|
render: /* @__PURE__ */ jsx(Button, {
|
|
19
|
+
...field,
|
|
20
|
+
...label,
|
|
15
21
|
ref,
|
|
16
22
|
variant: variant === "bordered" ? "outline" : variant,
|
|
17
23
|
...props,
|
|
18
24
|
type: "button",
|
|
19
|
-
className: cn("flex truncate h-7 rounded pl-3 transition focus-visible:shadow-focus outline-hidden focus-visible:outline-hidden focus-visible:outline-offset-0 focus-visible:outline-transparent justify-start overflow-hidden font-normal text-left w-full gap-1", variant === "outline" && "shadow-xs", variant === "bordered" && "border border-input shadow-none", variant === "ghost" && "px-2", props.size === "lg" && "gap-2", props.size === "icon" && "justify-center px-0", className)
|
|
25
|
+
className: cn("flex truncate h-7 rounded pl-3 transition focus-visible:shadow-focus outline-hidden focus-visible:outline-hidden focus-visible:outline-offset-0 focus-visible:outline-transparent justify-start overflow-hidden font-normal text-left w-full gap-1", variant === "outline" && "shadow-xs", variant === "bordered" && "border border-input shadow-none aria-invalid:border-destructive", variant === "ghost" && "px-2", props.size === "lg" && "gap-2", props.size === "icon" && "justify-center px-0", className)
|
|
20
26
|
}),
|
|
21
27
|
children
|
|
22
28
|
});
|
|
@@ -128,6 +134,11 @@ const ComboboxEmpty = ({ ref, className, loading, error, ...props }) => {
|
|
|
128
134
|
})
|
|
129
135
|
});
|
|
130
136
|
};
|
|
137
|
+
/**
|
|
138
|
+
* Parts of a popover picker: trigger, value, content, check, load-more.
|
|
139
|
+
* Put a `Command` inside `Combobox.Content` for the searchable list. `ChipTrigger` is the
|
|
140
|
+
* labelled chip a filter bar uses.
|
|
141
|
+
*/
|
|
131
142
|
const Combobox = {
|
|
132
143
|
TriggerBase: ComboboxTriggerBase,
|
|
133
144
|
Trigger: ComboboxTrigger,
|
|
@@ -10,6 +10,10 @@ declare const Value: ({ ref, className, onClose, children, ...props }: React.Com
|
|
|
10
10
|
onClose?: () => void;
|
|
11
11
|
}) => React.JSX.Element;
|
|
12
12
|
declare const Bar: ({ ref, className, ...props }: React.ComponentProps<'div'>) => React.JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* A bar floating at the page bottom with bulk actions for a selection.
|
|
15
|
+
* The page opens it through `open`, so it has no trigger.
|
|
16
|
+
*/
|
|
13
17
|
export declare const CommandBar: typeof Root & {
|
|
14
18
|
Value: typeof Value;
|
|
15
19
|
Bar: typeof Bar;
|
|
@@ -3,6 +3,7 @@ import { Button, buttonVariants } from "./button.js";
|
|
|
3
3
|
import { IconX } from "@tabler/icons-react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useRef } from "react";
|
|
6
|
+
import { useTranslation } from "react-i18next";
|
|
6
7
|
import { Popover } from "@base-ui/react/popover";
|
|
7
8
|
// src/components/command-bar.tsx
|
|
8
9
|
const Root = ({ open = false, onOpenChange, defaultOpen = false, disableAutoFocus = true, children }) => {
|
|
@@ -29,6 +30,7 @@ const Root = ({ open = false, onOpenChange, defaultOpen = false, disableAutoFocu
|
|
|
29
30
|
});
|
|
30
31
|
};
|
|
31
32
|
const Value = ({ ref, className, onClose, children, ...props }) => {
|
|
33
|
+
const { t } = useTranslation();
|
|
32
34
|
return /* @__PURE__ */ jsxs("div", {
|
|
33
35
|
className: "flex items-center -space-x-px",
|
|
34
36
|
children: [/* @__PURE__ */ jsx("div", {
|
|
@@ -40,6 +42,7 @@ const Value = ({ ref, className, onClose, children, ...props }) => {
|
|
|
40
42
|
variant: "outline",
|
|
41
43
|
className: "shadow-none border-dashed border rounded-l-none",
|
|
42
44
|
size: "icon",
|
|
45
|
+
"aria-label": t("close", "Close"),
|
|
43
46
|
onClick: onClose,
|
|
44
47
|
children: /* @__PURE__ */ jsx(IconX, {})
|
|
45
48
|
})]
|
|
@@ -52,6 +55,10 @@ const Bar = ({ ref, className, ...props }) => {
|
|
|
52
55
|
...props
|
|
53
56
|
});
|
|
54
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* A bar floating at the page bottom with bulk actions for a selection.
|
|
60
|
+
* The page opens it through `open`, so it has no trigger.
|
|
61
|
+
*/
|
|
55
62
|
const CommandBar = Object.assign(Root, {
|
|
56
63
|
Value,
|
|
57
64
|
Bar
|
|
@@ -37,6 +37,10 @@ declare const CommandActionItem: ({ icon: Icon, label, onSelect, disabled, trail
|
|
|
37
37
|
className?: string;
|
|
38
38
|
}) => React.JSX.Element;
|
|
39
39
|
declare const CommandShortcut: ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => React.JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* A searchable list of items to pick or run, built on cmdk.
|
|
42
|
+
* `Command.Dialog` puts it in a palette; inside `Combobox.Content` it is a picker's list.
|
|
43
|
+
*/
|
|
40
44
|
export declare const Command: typeof CommandRoot & {
|
|
41
45
|
Dialog: typeof CommandDialog;
|
|
42
46
|
Input: typeof CommandInput;
|
|
@@ -131,6 +131,10 @@ const CommandShortcut = ({ className, ...props }) => {
|
|
|
131
131
|
...props
|
|
132
132
|
});
|
|
133
133
|
};
|
|
134
|
+
/**
|
|
135
|
+
* A searchable list of items to pick or run, built on cmdk.
|
|
136
|
+
* `Command.Dialog` puts it in a palette; inside `Combobox.Content` it is a picker's list.
|
|
137
|
+
*/
|
|
134
138
|
const Command = Object.assign(CommandRoot, {
|
|
135
139
|
Dialog: CommandDialog,
|
|
136
140
|
Input: CommandInput,
|
|
@@ -8,6 +8,7 @@ declare const ContextMenuContent: ({ className, side, sideOffset, align, ...prop
|
|
|
8
8
|
declare const ContextMenuItem: ({ className, inset, ...props }: Menu.Item.Props & {
|
|
9
9
|
inset?: boolean;
|
|
10
10
|
}) => import("react").JSX.Element;
|
|
11
|
+
/** A menu that opens on right-click, beside the pointer. */
|
|
11
12
|
export declare const ContextMenu: typeof ContextMenuRoot & {
|
|
12
13
|
Trigger: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").ContextMenuTriggerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
14
|
Content: typeof ContextMenuContent;
|
|
@@ -21,6 +21,7 @@ const ContextMenuItem = ({ className, inset, ...props }) => /* @__PURE__ */ jsx(
|
|
|
21
21
|
className: cn("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 font-medium text-sm outline-hidden transition-colors data-highlighted:bg-accent data-disabled:pointer-events-none data-disabled:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0", inset && "pl-8", className),
|
|
22
22
|
...props
|
|
23
23
|
});
|
|
24
|
+
/** A menu that opens on right-click, beside the pointer. */
|
|
24
25
|
const ContextMenu = Object.assign(ContextMenuRoot, {
|
|
25
26
|
Trigger: ContextMenu$1.Trigger,
|
|
26
27
|
Content: ContextMenuContent,
|
|
@@ -3,5 +3,6 @@ interface CopyTextProps {
|
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
className?: string;
|
|
5
5
|
}
|
|
6
|
+
/** Text that copies `value` to the clipboard on click and shows "Copied!". */
|
|
6
7
|
export declare const CopyText: ({ value, children, className }: CopyTextProps) => import("react").JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -4,6 +4,7 @@ import { IconCheck } from "@tabler/icons-react";
|
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
// src/components/copy-text.tsx
|
|
7
|
+
/** Text that copies `value` to the clipboard on click and shows "Copied!". */
|
|
7
8
|
const CopyText = ({ value, children, className }) => {
|
|
8
9
|
const [copied, setCopied] = useState(false);
|
|
9
10
|
const handleCopy = async (e) => {
|
|
@@ -6,27 +6,23 @@ export type DatePickerValue = DateInput | DateInput[] | DateRange | {
|
|
|
6
6
|
} | null | undefined;
|
|
7
7
|
export type DatePickerMode = 'single' | 'multiple' | 'range';
|
|
8
8
|
export type NormalizedValue = Date | Date[] | DateRange | undefined;
|
|
9
|
-
/** Formats are written with Day.js tokens (`YYYY-MM-DD`, `MMM D, YYYY`), the picker's public API. */
|
|
10
|
-
export declare const DEFAULT_FORMAT = "YYYY-MM-DD";
|
|
11
|
-
export declare const DEFAULT_DISPLAY_FORMAT = "MMM D, YYYY";
|
|
12
|
-
export declare const formatWith: (date: Date, dayjsFormat: string) => string;
|
|
13
9
|
/** ISO strings without an offset are local time, like the Day.js parser this replaced. */
|
|
14
10
|
export declare const toDate: (value: unknown) => Date | undefined;
|
|
15
11
|
export declare const normalizeValue: (value: DatePickerValue, mode: DatePickerMode) => NormalizedValue;
|
|
16
12
|
export declare const getAnchorDate: (value: NormalizedValue) => Date | undefined;
|
|
17
|
-
/** Masks typed text as `
|
|
18
|
-
export declare const maskInputText: (
|
|
13
|
+
/** Masks typed text as `yyyy-MM-dd`, clamping the month and day. */
|
|
14
|
+
export declare const maskInputText: (value: string) => string;
|
|
19
15
|
export declare const getDateBounds: (withPresent: boolean, minDate?: Date, maxDate?: Date) => {
|
|
20
16
|
minBound: Date | undefined;
|
|
21
17
|
maxBound: Date | undefined;
|
|
22
18
|
};
|
|
23
19
|
export declare const getCalendarDisabled: (disabled: Matcher | Matcher[] | undefined, minBound?: Date, maxBound?: Date) => Matcher[];
|
|
24
|
-
/** Parses typed text strictly;
|
|
25
|
-
export declare const parseInputDate: (text: string,
|
|
20
|
+
/** Parses typed text strictly; `loose` also accepts unpadded months and days. */
|
|
21
|
+
export declare const parseInputDate: (text: string, { minBound, maxBound, loose }: {
|
|
26
22
|
minBound?: Date;
|
|
27
23
|
maxBound?: Date;
|
|
28
24
|
loose?: boolean;
|
|
29
25
|
}) => Date | undefined;
|
|
30
26
|
export declare const isDateRange: (value: NormalizedValue) => value is DateRange;
|
|
31
|
-
export declare const describeValue: (value: NormalizedValue,
|
|
27
|
+
export declare const describeValue: (value: NormalizedValue, formatDay: (date: Date) => string, formatMultiple: (count: number) => string) => string | undefined;
|
|
32
28
|
export {};
|
|
@@ -1,30 +1,12 @@
|
|
|
1
1
|
import { endOfDay, format, getDaysInMonth, isAfter, isBefore, isValid, parse, parseISO, startOfDay } from "date-fns";
|
|
2
2
|
// src/components/date-picker-value.ts
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"YYYY-MM-D",
|
|
10
|
-
"YYYY-M-DD"
|
|
3
|
+
const INPUT_PATTERN = "yyyy-MM-dd";
|
|
4
|
+
const LOOSE_INPUT_PATTERNS = [
|
|
5
|
+
INPUT_PATTERN,
|
|
6
|
+
"yyyy-M-d",
|
|
7
|
+
"yyyy-MM-d",
|
|
8
|
+
"yyyy-M-dd"
|
|
11
9
|
];
|
|
12
|
-
const DAYJS_TOKEN = /\[([^\]]*)]|YYYY|YY|DD|D|dddd|ddd|A|a|ZZ|Z/g;
|
|
13
|
-
const DATE_FNS_TOKEN = {
|
|
14
|
-
YYYY: "yyyy",
|
|
15
|
-
YY: "yy",
|
|
16
|
-
DD: "dd",
|
|
17
|
-
D: "d",
|
|
18
|
-
dddd: "EEEE",
|
|
19
|
-
ddd: "EEE",
|
|
20
|
-
A: "a",
|
|
21
|
-
a: "aaa",
|
|
22
|
-
ZZ: "xx",
|
|
23
|
-
Z: "xxx"
|
|
24
|
-
};
|
|
25
|
-
/** Turns a Day.js format string into the date-fns pattern with the same output. */
|
|
26
|
-
const toDateFnsPattern = (dayjsFormat) => dayjsFormat.replace(DAYJS_TOKEN, (token, escaped) => escaped === void 0 ? DATE_FNS_TOKEN[token] ?? token : `'${escaped.replaceAll("'", "''")}'`);
|
|
27
|
-
const formatWith = (date, dayjsFormat) => format(date, toDateFnsPattern(dayjsFormat));
|
|
28
10
|
const isDateInput = (value) => value instanceof Date || typeof value === "string" || typeof value === "number";
|
|
29
11
|
/** ISO strings without an offset are local time, like the Day.js parser this replaced. */
|
|
30
12
|
const toDate = (value) => {
|
|
@@ -80,7 +62,8 @@ const daysInMonth = (year, month) => {
|
|
|
80
62
|
if (year?.length !== 4 || !(monthNumber >= 1 && monthNumber <= 12)) return void 0;
|
|
81
63
|
return getDaysInMonth(new Date(Number(year), monthNumber - 1, 1));
|
|
82
64
|
};
|
|
83
|
-
|
|
65
|
+
/** Masks typed text as `yyyy-MM-dd`, clamping the month and day. */
|
|
66
|
+
const maskInputText = (value) => {
|
|
84
67
|
const [year, month, day] = splitDateSegments(value);
|
|
85
68
|
const normalizedMonth = month?.length === 2 ? String(Math.min(Number(month), 12)).padStart(2, "0") : month;
|
|
86
69
|
const maxDay = daysInMonth(year, normalizedMonth);
|
|
@@ -90,8 +73,6 @@ const formatDateMask = (value) => {
|
|
|
90
73
|
day?.length === 2 && maxDay ? String(Math.min(Number(day), maxDay)).padStart(2, "0") : day
|
|
91
74
|
].filter((segment) => segment !== void 0).join("-");
|
|
92
75
|
};
|
|
93
|
-
/** Masks typed text as `YYYY-MM-DD` when the picker uses the default format. */
|
|
94
|
-
const maskInputText = (rawValue, format) => format === "YYYY-MM-DD" ? formatDateMask(rawValue) : rawValue;
|
|
95
76
|
const getDateBounds = (withPresent, minDate, maxDate) => ({
|
|
96
77
|
minBound: minDate ?? (withPresent ? /* @__PURE__ */ new Date("1900-01-01") : void 0),
|
|
97
78
|
maxBound: maxDate ?? (withPresent ? /* @__PURE__ */ new Date() : void 0)
|
|
@@ -102,19 +83,19 @@ const getCalendarDisabled = (disabled, minBound, maxBound) => [
|
|
|
102
83
|
...maxBound ? [{ after: maxBound }] : []
|
|
103
84
|
];
|
|
104
85
|
const isWithinBounds = (date, minBound, maxBound) => !(minBound && isBefore(date, startOfDay(minBound))) && !(maxBound && isAfter(date, endOfDay(maxBound)));
|
|
105
|
-
/** Parses typed text strictly;
|
|
106
|
-
const parseInputDate = (text,
|
|
107
|
-
const parsed = (loose
|
|
86
|
+
/** Parses typed text strictly; `loose` also accepts unpadded months and days. */
|
|
87
|
+
const parseInputDate = (text, { minBound, maxBound, loose }) => {
|
|
88
|
+
const parsed = (loose ? LOOSE_INPUT_PATTERNS : [INPUT_PATTERN]).map((pattern) => ({
|
|
108
89
|
pattern,
|
|
109
90
|
date: parse(text, pattern, /* @__PURE__ */ new Date())
|
|
110
91
|
})).find(({ pattern, date }) => isValid(date) && format(date, pattern) === text)?.date;
|
|
111
92
|
return parsed && isWithinBounds(parsed, minBound, maxBound) ? parsed : void 0;
|
|
112
93
|
};
|
|
113
94
|
const isDateRange = (value) => value !== void 0 && !(value instanceof Date) && !Array.isArray(value);
|
|
114
|
-
const describeValue = (value,
|
|
95
|
+
const describeValue = (value, formatDay, formatMultiple) => {
|
|
115
96
|
if (Array.isArray(value)) return value.length ? formatMultiple(value.length) : void 0;
|
|
116
97
|
if (!isDateRange(value) || !value.from) return void 0;
|
|
117
|
-
const from =
|
|
118
|
-
return value.to ?
|
|
98
|
+
const from = formatDay(value.from);
|
|
99
|
+
return value.to ? [from, formatDay(value.to)].join(" - ") : from;
|
|
119
100
|
};
|
|
120
|
-
export {
|
|
101
|
+
export { describeValue, getAnchorDate, getCalendarDisabled, getDateBounds, isDateRange, maskInputText, normalizeValue, parseInputDate, toDate };
|
|
@@ -11,10 +11,6 @@ export type DatePickerProps = {
|
|
|
11
11
|
minDate?: Date;
|
|
12
12
|
maxDate?: Date;
|
|
13
13
|
mode?: DatePickerMode;
|
|
14
|
-
/** Day.js tokens, e.g. `YYYY-MM-DD`. */
|
|
15
|
-
format?: string;
|
|
16
|
-
/** Day.js tokens, e.g. `DD.MM.YYYY`. */
|
|
17
|
-
displayFormat?: string;
|
|
18
14
|
formatMultiple?: (count: number) => string;
|
|
19
15
|
variant?: 'outline' | 'default' | 'ghost';
|
|
20
16
|
allowNull?: boolean;
|
|
@@ -25,5 +21,9 @@ export type DatePickerProps = {
|
|
|
25
21
|
inline?: boolean;
|
|
26
22
|
disabled?: Matcher | Matcher[];
|
|
27
23
|
} & Omit<PropsBase, 'mode' | 'required' | 'disabled'>;
|
|
24
|
+
/**
|
|
25
|
+
* A date field with a calendar popover, for one day, several or a range.
|
|
26
|
+
* `mode` picks which; `inline` shows the calendar without the popover.
|
|
27
|
+
*/
|
|
28
28
|
export declare const DatePicker: (props: DatePickerProps) => import("react").JSX.Element;
|
|
29
29
|
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Calendar } from "./calendar.js";
|
|
2
2
|
import { Button } from "./button.js";
|
|
3
3
|
import { Popover } from "./popover.js";
|
|
4
|
+
import { useFormat } from "../lib/format.js";
|
|
4
5
|
import { cn } from "../lib/utils.js";
|
|
5
|
-
import {
|
|
6
|
+
import { describeValue, getAnchorDate, getCalendarDisabled, getDateBounds, isDateRange, normalizeValue, toDate } from "./date-picker-value.js";
|
|
6
7
|
import { DateTextInput } from "./date-text-input.js";
|
|
7
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
import { useRef, useState } from "react";
|
|
@@ -88,7 +89,7 @@ const useDatePicker = ({ value, onChange, mode, withPresent, minDate, maxDate, d
|
|
|
88
89
|
};
|
|
89
90
|
};
|
|
90
91
|
/** The props with their defaults; what is left goes to the calendar. */
|
|
91
|
-
const resolveProps = ({ value, onChange, placeholder = "Pick a date", withPresent = false, minDate, maxDate, disabled, className, mode = "single",
|
|
92
|
+
const resolveProps = ({ value, onChange, placeholder = "Pick a date", withPresent = false, minDate, maxDate, disabled, className, mode = "single", formatMultiple = defaultFormatMultiple, variant = "outline", allowNull, clearable = allowNull ?? true, clearLabel = "Clear", calendarClassName, popoverContentProps, inline = false, defaultMonth, ...calendarProps }) => ({
|
|
92
93
|
value,
|
|
93
94
|
onChange,
|
|
94
95
|
placeholder,
|
|
@@ -98,8 +99,6 @@ const resolveProps = ({ value, onChange, placeholder = "Pick a date", withPresen
|
|
|
98
99
|
disabled,
|
|
99
100
|
className,
|
|
100
101
|
mode,
|
|
101
|
-
format,
|
|
102
|
-
displayFormat,
|
|
103
102
|
formatMultiple,
|
|
104
103
|
variant,
|
|
105
104
|
clearable,
|
|
@@ -110,15 +109,18 @@ const resolveProps = ({ value, onChange, placeholder = "Pick a date", withPresen
|
|
|
110
109
|
defaultMonth,
|
|
111
110
|
calendarProps
|
|
112
111
|
});
|
|
112
|
+
/**
|
|
113
|
+
* A date field with a calendar popover, for one day, several or a range.
|
|
114
|
+
* `mode` picks which; `inline` shows the calendar without the popover.
|
|
115
|
+
*/
|
|
113
116
|
const DatePicker = (props) => {
|
|
114
117
|
const { calendarProps, ...o } = resolveProps(props);
|
|
115
118
|
const picker = useDatePicker(o);
|
|
119
|
+
const fmt = useFormat();
|
|
116
120
|
const { normalizedValue, isDisabled, hasValue, setIsOpen } = picker;
|
|
117
121
|
const singleInput = /* @__PURE__ */ jsx(DateTextInput, {
|
|
118
122
|
singleDate: normalizedValue instanceof Date ? normalizedValue : void 0,
|
|
119
123
|
onChange: o.onChange,
|
|
120
|
-
format: o.format,
|
|
121
|
-
displayFormat: o.displayFormat,
|
|
122
124
|
bounds: picker.bounds,
|
|
123
125
|
calendarDisabled: picker.calendarDisabled,
|
|
124
126
|
clearable: o.clearable,
|
|
@@ -158,7 +160,7 @@ const DatePicker = (props) => {
|
|
|
158
160
|
render: /* @__PURE__ */ jsx(Button, { variant: o.variant }),
|
|
159
161
|
disabled: isDisabled,
|
|
160
162
|
className: cn("w-full justify-start text-left font-normal", o.className),
|
|
161
|
-
children: describeValue(normalizedValue,
|
|
163
|
+
children: describeValue(normalizedValue, fmt.date, o.formatMultiple) ?? o.placeholder
|
|
162
164
|
}),
|
|
163
165
|
contentProps: o.popoverContentProps,
|
|
164
166
|
children: calendar
|
|
@@ -3,7 +3,6 @@ import { Matcher } from "react-day-picker";
|
|
|
3
3
|
type DateDraftOptions = {
|
|
4
4
|
singleDate?: Date;
|
|
5
5
|
onChange: (date: Date | null) => void;
|
|
6
|
-
format: string;
|
|
7
6
|
bounds: {
|
|
8
7
|
minBound?: Date;
|
|
9
8
|
maxBound?: Date;
|
|
@@ -13,7 +12,6 @@ type DateDraftOptions = {
|
|
|
13
12
|
onOpen?: () => void;
|
|
14
13
|
};
|
|
15
14
|
type DateTextInputProps = DateDraftOptions & {
|
|
16
|
-
displayFormat: string;
|
|
17
15
|
clearLabel: string;
|
|
18
16
|
isDisabled: boolean;
|
|
19
17
|
placeholder: string;
|
|
@@ -21,6 +19,6 @@ type DateTextInputProps = DateDraftOptions & {
|
|
|
21
19
|
inputRef: RefObject<HTMLInputElement | null>;
|
|
22
20
|
onClear: () => void;
|
|
23
21
|
};
|
|
24
|
-
/** Typed date entry for single mode: the
|
|
25
|
-
export declare const DateTextInput: ({
|
|
22
|
+
/** Typed date entry for single mode: the date in the UI's language at rest, `yyyy-MM-dd` while typing. */
|
|
23
|
+
export declare const DateTextInput: ({ clearLabel, isDisabled, placeholder, className, inputRef, onClear, ...options }: DateTextInputProps) => import("react").JSX.Element;
|
|
26
24
|
export {};
|