@erxes/ui 4.0.0-v2.0 → 4.0.0-v2.1
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/README.md +6 -6
- package/dist/base.css +17 -4
- package/dist/components/accordion.d.ts +6 -7
- package/dist/components/accordion.js +8 -13
- package/dist/components/alert-dialog.d.ts +12 -11
- package/dist/components/alert-dialog.js +26 -29
- package/dist/components/alert.js +2 -2
- package/dist/components/avatar.d.ts +7 -5
- package/dist/components/avatar.js +30 -19
- package/dist/components/background-gradient-animation.d.ts +2 -11
- package/dist/components/background-gradient-animation.js +21 -50
- package/dist/components/badge.d.ts +3 -2
- package/dist/components/badge.js +36 -21
- package/dist/components/breadcrumb.d.ts +6 -4
- package/dist/components/breadcrumb.js +18 -14
- package/dist/components/button.d.ts +15 -7
- package/dist/components/button.js +46 -23
- package/dist/components/calendar.js +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/chart-config.d.ts +4 -18
- package/dist/components/chart-config.js +1 -6
- package/dist/components/charts.d.ts +1 -1
- package/dist/components/charts.js +20 -28
- package/dist/components/checkbox.d.ts +2 -3
- package/dist/components/checkbox.js +4 -6
- package/dist/components/choicebox-group.d.ts +1 -1
- package/dist/components/choicebox-group.js +5 -9
- package/dist/components/collapsible.d.ts +5 -9
- package/dist/components/collapsible.js +8 -25
- package/dist/components/color-picker.js +9 -8
- package/dist/components/combobox.d.ts +6 -6
- package/dist/components/combobox.js +19 -18
- package/dist/components/command-bar.js +22 -19
- package/dist/components/command.d.ts +18 -8
- package/dist/components/command.js +62 -26
- package/dist/components/context-menu.d.ts +17 -29
- package/dist/components/context-menu.js +20 -66
- package/dist/components/copy-text.js +7 -11
- package/dist/components/date-picker.js +21 -18
- package/dist/components/date-text-input.js +3 -3
- package/dist/components/date-time-input.d.ts +12 -0
- package/dist/components/date-time-input.js +21 -0
- package/dist/components/dialog.d.ts +17 -12
- package/dist/components/dialog.js +36 -32
- package/dist/components/drag-handle.d.ts +2 -2
- package/dist/components/drag-handle.js +0 -1
- package/dist/components/dropdown-menu.d.ts +35 -16
- package/dist/components/dropdown-menu.js +78 -37
- package/dist/components/empty.js +2 -2
- package/dist/components/form.d.ts +15 -6
- package/dist/components/form.js +34 -17
- package/dist/components/hover-card.d.ts +6 -5
- package/dist/components/hover-card.js +18 -9
- package/dist/components/info-card.js +5 -6
- package/dist/components/input-group.d.ts +22 -0
- package/dist/components/input-group.js +42 -0
- package/dist/components/input.d.ts +11 -2
- package/dist/components/input.js +21 -8
- package/dist/components/kbd.js +2 -2
- package/dist/components/label.d.ts +3 -3
- package/dist/components/label.js +9 -6
- package/dist/components/multiselect.d.ts +21 -6
- package/dist/components/multiselect.js +81 -127
- package/dist/components/on-demand.d.ts +17 -0
- package/dist/components/on-demand.js +42 -0
- package/dist/components/popover.d.ts +18 -9
- package/dist/components/popover.js +38 -13
- package/dist/components/radio-group.d.ts +5 -5
- package/dist/components/radio-group.js +23 -29
- package/dist/components/resizable.d.ts +8 -21
- package/dist/components/resizable.js +5 -10
- package/dist/components/scroll-area.d.ts +12 -7
- package/dist/components/scroll-area.js +18 -18
- package/dist/components/select.d.ts +22 -14
- package/dist/components/select.js +90 -51
- package/dist/components/separator.d.ts +3 -3
- package/dist/components/separator.js +8 -12
- package/dist/components/sheet.d.ts +15 -11
- package/dist/components/sheet.js +63 -47
- package/dist/components/sidebar/context.js +4 -4
- package/dist/components/sidebar/group.d.ts +9 -8
- package/dist/components/sidebar/group.js +18 -13
- package/dist/components/sidebar/layout.d.ts +7 -2
- package/dist/components/sidebar/layout.js +11 -3
- package/dist/components/sidebar/menu-sub.d.ts +4 -3
- package/dist/components/sidebar/menu-sub.js +13 -13
- package/dist/components/sidebar/menu.d.ts +6 -6
- package/dist/components/sidebar/menu.js +28 -40
- package/dist/components/sidebar/panel.js +10 -15
- package/dist/components/sidebar/root.d.ts +1 -2
- package/dist/components/sidebar/root.js +7 -8
- package/dist/components/sidebar/trigger.js +1 -1
- package/dist/components/sidebar-tree-indicator.js +4 -4
- package/dist/components/skeleton.d.ts +7 -1
- package/dist/components/skeleton.js +18 -2
- package/dist/components/slider.d.ts +5 -5
- package/dist/components/slider.js +20 -11
- package/dist/components/spinner.d.ts +2 -2
- package/dist/components/spinner.js +24 -188
- package/dist/components/string-array.js +2 -2
- package/dist/components/switch.d.ts +2 -3
- package/dist/components/switch.js +6 -8
- package/dist/components/table.d.ts +14 -3
- package/dist/components/table.js +33 -9
- package/dist/components/tabs.d.ts +34 -8
- package/dist/components/tabs.js +96 -23
- package/dist/components/text-overflow.d.ts +8 -10
- package/dist/components/text-overflow.js +33 -39
- package/dist/components/textarea.d.ts +8 -1
- package/dist/components/textarea.js +24 -3
- package/dist/components/toaster.d.ts +1 -0
- package/dist/components/toaster.js +41 -20
- package/dist/components/toggle-group.d.ts +5 -3
- package/dist/components/toggle-group.js +11 -12
- package/dist/components/toggle.d.ts +3 -4
- package/dist/components/toggle.js +6 -6
- package/dist/components/tooltip.d.ts +7 -6
- package/dist/components/tooltip.js +18 -8
- package/dist/components/upload.d.ts +7 -2
- package/dist/components/upload.js +28 -7
- package/dist/components.css +325 -0
- package/dist/constants/CountryPhoneCodes.d.ts +1 -1
- package/dist/constants/CountryPhoneCodes.js +2 -2
- package/dist/federation.d.ts +10 -0
- package/dist/federation.js +24 -0
- package/dist/fonts.css +1 -1
- package/dist/hooks/use-confirm.js +17 -19
- package/dist/hooks/use-toast.d.ts +14 -16
- package/dist/hooks/use-toast.js +13 -108
- package/dist/index.d.ts +9 -8
- package/dist/index.js +7 -7
- package/dist/lib/cn-tables.d.ts +27 -0
- package/dist/lib/cn-tables.js +128 -0
- package/dist/lib/utils.d.ts +14 -2
- package/dist/lib/utils.js +14 -6
- package/dist/modules/attachments/attachment-media.js +56 -56
- package/dist/modules/blocks/components/BarcodeAttribute.js +11 -8
- package/dist/modules/blocks/components/BarcodeSizeSettings.js +5 -6
- package/dist/modules/blocks/components/BlockEditor.js +14 -4
- package/dist/modules/blocks/components/BlockEditorInlineContent.d.ts +26 -36
- package/dist/modules/blocks/components/BlockEditorInlineContent.js +2 -2
- package/dist/modules/blocks/components/BlockToolbar.d.ts +6 -0
- package/dist/modules/blocks/components/BlockToolbar.js +19 -4
- package/dist/modules/blocks/components/CustomFileBlock.d.ts +13 -39
- package/dist/modules/blocks/components/CustomFileBlock.js +8 -9
- package/dist/modules/blocks/components/CustomImageBlock.d.ts +28 -78
- package/dist/modules/blocks/components/CustomImageBlock.js +20 -99
- package/dist/modules/blocks/components/CustomVideoBlock.d.ts +26 -63
- package/dist/modules/blocks/components/CustomVideoBlock.js +10 -8
- package/dist/modules/blocks/components/DocumentPlaceholderBlock.d.ts +13 -39
- package/dist/modules/blocks/components/DocumentPlaceholderBlock.js +1 -2
- package/dist/modules/blocks/components/Editor.d.ts +1 -1
- package/dist/modules/blocks/components/Editor.js +5 -4
- package/dist/modules/blocks/components/FontFamilyButton.js +25 -21
- package/dist/modules/blocks/components/FontSizeButton.js +26 -22
- package/dist/modules/blocks/components/GalleryBlock.d.ts +7 -25
- package/dist/modules/blocks/components/GalleryBlock.js +2 -35
- package/dist/modules/blocks/components/GalleryBlockContent.js +8 -3
- package/dist/modules/blocks/components/GalleryBlockParts.js +23 -21
- package/dist/modules/blocks/components/GalleryExternalHtml.d.ts +2 -0
- package/dist/modules/blocks/components/GalleryExternalHtml.js +36 -0
- package/dist/modules/blocks/components/ImageExternalHtml.d.ts +2 -0
- package/dist/modules/blocks/components/ImageExternalHtml.js +51 -0
- package/dist/modules/blocks/components/ImageStyleButton.js +22 -18
- package/dist/modules/blocks/components/LazyEditor.d.ts +9 -0
- package/dist/modules/blocks/components/LazyEditor.js +14 -0
- package/dist/modules/blocks/components/MediaBlockWrapper.d.ts +24 -0
- package/dist/modules/blocks/components/MediaBlockWrapper.js +98 -0
- package/dist/modules/blocks/components/SlashMenu.js +2 -2
- package/dist/modules/blocks/components/SuggestionMenu.js +5 -6
- package/dist/modules/blocks/components/TableColorPicker.d.ts +1 -1
- package/dist/modules/blocks/components/TableColorPicker.js +20 -27
- package/dist/modules/blocks/components/TableHandleWithRemove.js +34 -50
- package/dist/modules/blocks/components/toolbar/buttons/ToolbarButton.d.ts +2 -2
- package/dist/modules/blocks/components/toolbar/buttons/ToolbarButton.js +3 -4
- package/dist/modules/blocks/components/toolbar/buttons/ToolbarToggle.d.ts +2 -2
- package/dist/modules/blocks/components/toolbar/buttons/ToolbarToggle.js +3 -4
- package/dist/modules/blocks/components/toolbar/menus/MenuCheckboxItem.d.ts +3 -0
- package/dist/modules/blocks/components/toolbar/menus/MenuCheckboxItem.js +8 -0
- package/dist/modules/blocks/components/toolbar/menus/ToolbarMenuDropdown.js +1 -1
- package/dist/modules/blocks/components/toolbar/menus/ToolbarMenuItem.d.ts +2 -2
- package/dist/modules/blocks/components/toolbar/menus/ToolbarMenuItem.js +5 -16
- package/dist/modules/blocks/components/toolbar/menus/ToolbarSelect.d.ts +1 -1
- package/dist/modules/blocks/components/toolbar/menus/ToolbarSelect.js +24 -20
- package/dist/modules/blocks/constant/blockEditorSchema.d.ts +268 -653
- package/dist/modules/blocks/constant/blockEditorSchema.js +33 -41
- package/dist/modules/blocks/constant/galleryBlockConfig.d.ts +1 -2
- package/dist/modules/blocks/constant/imageBlockConfig.d.ts +46 -0
- package/dist/modules/blocks/constant/imageBlockConfig.js +39 -0
- package/dist/modules/blocks/constant/toolbar/editorUIComponents.d.ts +2 -3
- package/dist/modules/blocks/constant/toolbar/editorUIComponents.js +7 -9
- package/dist/modules/blocks/hooks/toolbar/useCodeActive.js +5 -7
- package/dist/modules/blocks/hooks/toolbar/useStringStyle.d.ts +9 -0
- package/dist/modules/blocks/hooks/toolbar/useStringStyle.js +27 -0
- package/dist/modules/blocks/hooks/useBlockEditor.d.ts +2 -0
- package/dist/modules/blocks/hooks/useBlockEditor.js +9 -3
- package/dist/modules/blocks/hooks/useEditorValue.d.ts +2 -1
- package/dist/modules/blocks/hooks/useEditorValue.js +8 -19
- package/dist/modules/blocks/types/TextEditor.d.ts +3 -1
- package/dist/modules/blocks/types/toolbar/ImageStyleOption.d.ts +1 -1
- package/dist/modules/blocks/utils/getSlashMenuItems.js +0 -15
- package/dist/modules/blocks/utils/parseBlocks.d.ts +3 -1
- package/dist/modules/blocks/utils/parseBlocks.js +14 -1
- package/dist/modules/display/components/EmailDisplay.js +26 -27
- package/dist/modules/display/components/PhoneDisplay.js +2 -2
- package/dist/modules/display/components/RelativeDateDisplay.d.ts +2 -2
- package/dist/modules/display/components/RelativeDateDisplay.js +7 -10
- package/dist/modules/filter/components/FilterBar.js +6 -6
- package/dist/modules/filter/components/FilterDialog.js +13 -20
- package/dist/modules/filter/components/FilterPopover.js +20 -28
- package/dist/modules/hotkey/components/PopoverScoped.d.ts +5 -4
- package/dist/modules/hotkey/components/PopoverScoped.js +5 -5
- package/dist/modules/hotkey/hooks/useScopedHotkeys.d.ts +3 -3
- package/dist/modules/hotkey/hooks/useScopedHotkeys.js +15 -24
- package/dist/modules/icons/components/IconComponent.d.ts +1 -1
- package/dist/modules/icons/components/IconPicker.js +15 -14
- package/dist/modules/inputs/components/ContactFieldParts.js +13 -14
- package/dist/modules/inputs/components/EmailFieldForm.js +2 -3
- package/dist/modules/inputs/components/FullNameField.js +6 -4
- package/dist/modules/inputs/components/PhoneFieldForm.js +2 -1
- package/dist/modules/layout/components/AppLayout.js +18 -20
- package/dist/modules/layout/components/AppLayoutPageSlot.js +1 -1
- package/dist/modules/layout/components/AppLayoutResizeHandle.js +1 -1
- package/dist/modules/layout/components/Page.d.ts +6 -1
- package/dist/modules/layout/components/Page.js +11 -3
- package/dist/modules/layout/components/PageHeader.d.ts +10 -3
- package/dist/modules/layout/components/PageHeader.js +19 -4
- package/dist/modules/navigation-menu/components/NavigationMenu.js +12 -15
- package/dist/modules/record-field/components/NumberField.d.ts +2 -2
- package/dist/modules/record-field/components/NumberField.js +22 -25
- package/dist/modules/record-field/components/TextField.d.ts +3 -3
- package/dist/modules/record-field/components/TextField.js +25 -28
- package/dist/modules/record-field/meta-inputs/components/PhoneInput.d.ts +3 -1
- package/dist/modules/record-field/meta-inputs/components/PhoneInput.js +18 -12
- package/dist/modules/record-table/components/CheckboxColumn.d.ts +4 -3
- package/dist/modules/record-table/components/CheckboxColumn.js +52 -35
- package/dist/modules/record-table/components/MoreColumn.js +4 -3
- package/dist/modules/record-table/components/RecordTable.d.ts +3 -2
- package/dist/modules/record-table/components/RecordTable.js +2 -1
- package/dist/modules/record-table/components/RecordTableCell.d.ts +6 -3
- package/dist/modules/record-table/components/RecordTableCell.js +17 -11
- package/dist/modules/record-table/components/RecordTableCellInline.d.ts +15 -4
- package/dist/modules/record-table/components/RecordTableCellInline.js +48 -24
- package/dist/modules/record-table/components/RecordTableColumnSelector.d.ts +1 -2
- package/dist/modules/record-table/components/RecordTableColumnSelector.js +48 -45
- package/dist/modules/record-table/components/RecordTableContainer.d.ts +8 -3
- package/dist/modules/record-table/components/RecordTableContainer.js +28 -16
- package/dist/modules/record-table/components/RecordTableCursor.js +4 -4
- package/dist/modules/record-table/components/RecordTableHead.d.ts +9 -4
- package/dist/modules/record-table/components/RecordTableHead.js +40 -34
- package/dist/modules/record-table/components/RecordTableHeader.js +24 -15
- package/dist/modules/record-table/components/RecordTableProvider.d.ts +30 -7
- package/dist/modules/record-table/components/RecordTableProvider.js +32 -22
- package/dist/modules/record-table/components/RecordTableRoot.d.ts +2 -1
- package/dist/modules/record-table/components/RecordTableRoot.js +7 -12
- package/dist/modules/record-table/components/RecordTableRow.d.ts +8 -1
- package/dist/modules/record-table/components/RecordTableRow.js +13 -12
- package/dist/modules/record-table/components/RecordTableRowList.d.ts +6 -1
- package/dist/modules/record-table/components/RecordTableRowList.js +28 -20
- package/dist/modules/record-table/components/RecordTableRowSkeleton.js +8 -12
- package/dist/modules/record-table/hooks/useColumnLayout.d.ts +2 -2
- package/dist/modules/record-table/hooks/useColumnLayout.js +8 -5
- package/dist/modules/record-table/hooks/useTablePreferences.d.ts +5 -5
- package/dist/modules/record-table/hooks/useTablePreferences.js +3 -3
- package/dist/modules/record-table/utils/columnLayout.d.ts +4 -4
- package/dist/modules/record-table/utils/columnLayout.js +7 -7
- package/dist/modules/record-table/utils/columnUtils.d.ts +3 -2
- package/dist/modules/record-table/utils/rowFields.d.ts +1 -0
- package/dist/modules/record-table/utils/rowFields.js +10 -9
- package/dist/styles.css +3 -0
- package/dist/theme.css +102 -69
- package/dist/utils/file-storage.d.ts +1 -1
- package/dist/utils/plugin-runtime.d.ts +1 -1
- package/dist/utils/record-timeline.d.ts +1 -1
- package/dist/utils/record-timeline.js +1 -1
- package/package.json +25 -22
- package/dist/components/multiselect-options.d.ts +0 -16
- package/dist/components/multiselect-options.js +0 -13
- package/dist/components/multiselect-parts.d.ts +0 -23
- package/dist/components/multiselect-parts.js +0 -62
- package/dist/components/multiselect-state.d.ts +0 -66
- package/dist/components/multiselect-state.js +0 -131
- package/dist/components/time-picker.d.ts +0 -10
- package/dist/components/time-picker.js +0 -33
- package/dist/components/toasts.d.ts +0 -21
- package/dist/components/toasts.js +0 -69
- package/dist/modules/blocks/hooks/toolbar/useFontFamily.d.ts +0 -2
- package/dist/modules/blocks/hooks/toolbar/useFontFamily.js +0 -24
- package/dist/modules/blocks/hooks/toolbar/useFontSize.d.ts +0 -2
- package/dist/modules/blocks/hooks/toolbar/useFontSize.js +0 -24
- package/dist/modules/blocks/types/toolbar/EditorVisibleBounds.d.ts +0 -6
- package/dist/modules/blocks/types/toolbar/EditorVisibleBounds.js +0 -0
- package/dist/modules/blocks/types/toolbar/FontFamily.d.ts +0 -5
- package/dist/modules/blocks/types/toolbar/FontFamily.js +0 -0
- package/dist/modules/blocks/types/toolbar/FontSize.d.ts +0 -5
- package/dist/modules/blocks/types/toolbar/FontSize.js +0 -0
- package/dist/modules/blocks/types/toolbar/ToolbarMenuItemProps.d.ts +0 -4
- package/dist/modules/blocks/types/toolbar/ToolbarMenuItemProps.js +0 -0
- package/dist/modules/blocks/types/toolbar/ToolbarPositioningOptions.d.ts +0 -3
- package/dist/modules/blocks/types/toolbar/ToolbarPositioningOptions.js +0 -0
- package/dist/modules/blocks/utils/toolbar/getEditorVisibleBounds.d.ts +0 -2
- package/dist/modules/blocks/utils/toolbar/getEditorVisibleBounds.js +0 -30
- package/dist/modules/blocks/utils/toolbar/getToolbarPositioning.d.ts +0 -2
- package/dist/modules/blocks/utils/toolbar/getToolbarPositioning.js +0 -41
- package/dist/modules/hotkey/hooks/useScopedHotKeysCallback.d.ts +0 -9
- package/dist/modules/hotkey/hooks/useScopedHotKeysCallback.js +0 -15
- package/dist/modules/hotkey/states/internal/pendingHotkeyState.d.ts +0 -4
- package/dist/modules/hotkey/states/internal/pendingHotkeyState.js +0 -4
package/dist/theme.css
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Tailwind theme contract shared by the
|
|
2
|
+
Tailwind theme contract shared by the web host and plugin remotes.
|
|
3
3
|
|
|
4
4
|
Maps utilities to design tokens. Token values live on the host's :root and
|
|
5
5
|
.dark (base.css, imported once by the host page), so this file must not
|
|
6
6
|
declare them. A plugin imports it next to its own prefixed Tailwind
|
|
7
|
-
utilities; see
|
|
7
|
+
utilities; see web/src/styles.css for the host.
|
|
8
8
|
*/
|
|
9
9
|
@custom-variant dark (&:is(.dark *));
|
|
10
|
+
/* Inside an app layout whose navigation panel is closed, where its toggle button floats at the
|
|
11
|
+
top left; AppLayout sets the attribute. */
|
|
12
|
+
@custom-variant navigation-collapsed (&:is([data-navigation-collapsed] *));
|
|
10
13
|
|
|
11
14
|
@utility container {
|
|
12
15
|
margin-inline: auto;
|
|
@@ -26,6 +29,10 @@
|
|
|
26
29
|
'Courier New', monospace;
|
|
27
30
|
|
|
28
31
|
--text-*: initial;
|
|
32
|
+
/* Counters, keyboard hints and initials in small avatars. They keep the surrounding line height. */
|
|
33
|
+
--text-4xs: 0.5rem;
|
|
34
|
+
--text-3xs: 0.625rem;
|
|
35
|
+
--text-2xs: 0.6875rem;
|
|
29
36
|
--text-xs: 0.75rem;
|
|
30
37
|
--text-xs--line-height: 0.875rem;
|
|
31
38
|
--text-sm: 0.8125rem;
|
|
@@ -45,8 +52,16 @@
|
|
|
45
52
|
--color-background: var(--background);
|
|
46
53
|
--color-foreground: var(--foreground);
|
|
47
54
|
|
|
55
|
+
/* Cards and floating surfaces (BlockNote's toolbar, menus and panels) sit on the page background. */
|
|
56
|
+
--color-popover: var(--background);
|
|
57
|
+
--color-popover-foreground: var(--foreground);
|
|
58
|
+
--color-card: var(--background);
|
|
59
|
+
--color-card-foreground: var(--foreground);
|
|
60
|
+
--color-input: var(--input);
|
|
61
|
+
|
|
48
62
|
--color-primary: var(--primary);
|
|
49
63
|
--color-primary-foreground: var(--primary-foreground);
|
|
64
|
+
--color-primary-text: var(--primary-text);
|
|
50
65
|
|
|
51
66
|
--color-secondary: var(--secondary);
|
|
52
67
|
--color-secondary-foreground: var(--secondary-foreground);
|
|
@@ -54,6 +69,11 @@
|
|
|
54
69
|
--color-success: var(--success);
|
|
55
70
|
--color-warning: var(--warning);
|
|
56
71
|
--color-info: var(--info);
|
|
72
|
+
/* Status colours as text, readable on their own 10% tint. */
|
|
73
|
+
--color-success-text: var(--success-text);
|
|
74
|
+
--color-warning-text: var(--warning-text);
|
|
75
|
+
--color-destructive-text: var(--destructive-text);
|
|
76
|
+
--color-info-text: var(--info-text);
|
|
57
77
|
|
|
58
78
|
--color-destructive: var(--destructive);
|
|
59
79
|
--color-destructive-foreground: var(--destructive-foreground);
|
|
@@ -90,16 +110,32 @@
|
|
|
90
110
|
|
|
91
111
|
--spacing-cell: 33px;
|
|
92
112
|
|
|
113
|
+
/* An image or video opened full size over the page. */
|
|
114
|
+
--max-width-lightbox: 90vw;
|
|
115
|
+
--max-height-lightbox: 90vh;
|
|
116
|
+
/* A record table's rows fill the page below its header bars. */
|
|
117
|
+
--min-height-table: calc(100vh - 8rem);
|
|
118
|
+
|
|
119
|
+
/* A content-sized first track and the rest: label and value, icon and text. */
|
|
120
|
+
--grid-template-columns-leading: auto minmax(0, 1fr);
|
|
121
|
+
--grid-template-rows-leading: auto minmax(0, 1fr);
|
|
122
|
+
/* Two scrolling halves around a bar. */
|
|
123
|
+
--grid-template-rows-split: minmax(0, 1fr) auto minmax(0, 1fr);
|
|
124
|
+
/* A side panel's field labels. */
|
|
125
|
+
--grid-template-columns-field: 6.5rem minmax(0, 1fr);
|
|
126
|
+
/* A side column of 18 to 24rem beside the content. */
|
|
127
|
+
--grid-template-columns-aside: minmax(18rem, 24rem) minmax(0, 1fr);
|
|
128
|
+
|
|
129
|
+
/* Panels and sidebars sliding open or shut. */
|
|
130
|
+
--ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
|
|
131
|
+
--ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
132
|
+
/* Overshoots a little, then settles. */
|
|
133
|
+
--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
134
|
+
/* What changes when a panel or control grows, shrinks or slides in, fading as it goes. */
|
|
135
|
+
--transition-property-layout: width, height, margin, padding, left, right, opacity;
|
|
136
|
+
|
|
93
137
|
--animate-accordion-down: accordion-down 0.2s ease-out;
|
|
94
138
|
--animate-accordion-up: accordion-up 0.2s ease-out;
|
|
95
|
-
--animate-spinner: spinner 0.96s linear infinite;
|
|
96
|
-
--animate-bot-appear: bot-appear 0.3s ease-out 0.25s backwards;
|
|
97
|
-
--animate-bot-rock: bot-rock 2.6s ease-in-out infinite;
|
|
98
|
-
--animate-bot-glance: bot-glance 4.5s ease-in-out infinite;
|
|
99
|
-
--animate-bot-blink: bot-blink 4.5s infinite;
|
|
100
|
-
--animate-bot-dots: bot-dots 1.2s infinite;
|
|
101
|
-
--animate-text-shimmer: text-shimmer 1.8s linear infinite;
|
|
102
|
-
|
|
103
139
|
--animate-first: move-vertical 30s ease infinite;
|
|
104
140
|
--animate-second: move-in-circle 20s reverse infinite;
|
|
105
141
|
--animate-third: move-in-circle 40s linear infinite;
|
|
@@ -129,12 +165,12 @@
|
|
|
129
165
|
height: 0;
|
|
130
166
|
}
|
|
131
167
|
to {
|
|
132
|
-
height: var(--
|
|
168
|
+
height: var(--accordion-panel-height);
|
|
133
169
|
}
|
|
134
170
|
}
|
|
135
171
|
@keyframes accordion-up {
|
|
136
172
|
from {
|
|
137
|
-
height: var(--
|
|
173
|
+
height: var(--accordion-panel-height);
|
|
138
174
|
}
|
|
139
175
|
to {
|
|
140
176
|
height: 0;
|
|
@@ -148,65 +184,11 @@
|
|
|
148
184
|
opacity: 0.15;
|
|
149
185
|
}
|
|
150
186
|
}
|
|
151
|
-
|
|
152
|
-
@keyframes bot-appear {
|
|
187
|
+
@keyframes appear {
|
|
153
188
|
from {
|
|
154
189
|
opacity: 0;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
@keyframes bot-rock {
|
|
158
|
-
0%,
|
|
159
|
-
100% {
|
|
160
|
-
transform: rotate(-5deg);
|
|
161
|
-
}
|
|
162
|
-
50% {
|
|
163
|
-
transform: rotate(5deg);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
@keyframes bot-glance {
|
|
167
|
-
0%,
|
|
168
|
-
20%,
|
|
169
|
-
80%,
|
|
170
|
-
100% {
|
|
171
|
-
transform: translateX(0);
|
|
172
|
-
}
|
|
173
|
-
30%,
|
|
174
|
-
45% {
|
|
175
|
-
transform: translateX(-5px);
|
|
176
|
-
}
|
|
177
|
-
55%,
|
|
178
|
-
70% {
|
|
179
|
-
transform: translateX(5px);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
@keyframes bot-blink {
|
|
183
|
-
0%,
|
|
184
|
-
46%,
|
|
185
|
-
50%,
|
|
186
|
-
96%,
|
|
187
|
-
100% {
|
|
188
|
-
transform: scaleY(1);
|
|
189
|
-
}
|
|
190
|
-
48%,
|
|
191
|
-
98% {
|
|
192
|
-
transform: scaleY(0.1);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
@keyframes bot-dots {
|
|
196
|
-
0%,
|
|
197
|
-
100% {
|
|
198
|
-
opacity: 0.25;
|
|
199
|
-
}
|
|
200
|
-
40% {
|
|
201
|
-
opacity: 1;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
@keyframes text-shimmer {
|
|
205
|
-
from {
|
|
206
|
-
background-position: 100% 0;
|
|
207
|
-
}
|
|
208
|
-
to {
|
|
209
|
-
background-position: 0% 0;
|
|
190
|
+
transform: translate3d(var(--appear-x, 0), var(--appear-y, 0), 0)
|
|
191
|
+
scale(var(--appear-scale, 1));
|
|
210
192
|
}
|
|
211
193
|
}
|
|
212
194
|
|
|
@@ -245,6 +227,49 @@
|
|
|
245
227
|
}
|
|
246
228
|
}
|
|
247
229
|
|
|
230
|
+
/* Inline, because the variable resolves on the popup, not on :root. A popup is at most 24rem
|
|
231
|
+
tall, or the room Base UI measures beside its anchor; BlockNote's menus, which don't measure,
|
|
232
|
+
get half the viewport. */
|
|
233
|
+
@theme inline {
|
|
234
|
+
--max-height-popup: min(24rem, var(--available-height, 50dvh));
|
|
235
|
+
/* An entrance from an offset and scale the element sets as --appear-x, --appear-y and
|
|
236
|
+
--appear-scale, timed by --appear-duration, --appear-easing and --appear-delay. Inline,
|
|
237
|
+
so those resolve on the element rather than on :root. */
|
|
238
|
+
--animate-appear: appear var(--appear-duration, 500ms) var(--appear-easing, ease-out)
|
|
239
|
+
var(--appear-delay, 0ms) both;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* Spoke --spoke (0 to 9) of Spinner's ten: a bar left of the centre, turned about a point one
|
|
243
|
+
bar length further left, its fade a tenth of a turn behind the one before. */
|
|
244
|
+
@utility spinner-spoke {
|
|
245
|
+
position: absolute;
|
|
246
|
+
top: -3.9%;
|
|
247
|
+
left: -10%;
|
|
248
|
+
width: 24%;
|
|
249
|
+
height: 8%;
|
|
250
|
+
transform-origin: -100%;
|
|
251
|
+
transform: translate(146%) rotate(calc(var(--spoke) * 36deg + 0.001deg));
|
|
252
|
+
animation: spinner 0.96s linear calc((var(--spoke) - 10) * 0.096s) infinite;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/* A scroll viewport or list takes its popup's corners and height limit; a button inside
|
|
256
|
+
BlockNote's markup takes the editor's font. */
|
|
257
|
+
/* Base UI keeps a closing popup mounted until its exit animation ends; this holds the last
|
|
258
|
+
frame so it doesn't flash back first. */
|
|
259
|
+
@utility animation-forwards {
|
|
260
|
+
animation-fill-mode: forwards;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
@utility rounded-inherit {
|
|
264
|
+
border-radius: inherit;
|
|
265
|
+
}
|
|
266
|
+
@utility max-h-inherit {
|
|
267
|
+
max-height: inherit;
|
|
268
|
+
}
|
|
269
|
+
@utility font-inherit {
|
|
270
|
+
font: inherit;
|
|
271
|
+
}
|
|
272
|
+
|
|
248
273
|
@utility hide-scroll {
|
|
249
274
|
/* Hide scrollbar for Chrome, Safari and Opera */
|
|
250
275
|
&::-webkit-scrollbar {
|
|
@@ -278,3 +303,11 @@
|
|
|
278
303
|
@apply block!;
|
|
279
304
|
}
|
|
280
305
|
}
|
|
306
|
+
|
|
307
|
+
/* A dnd-kit sortable item. useSortable's transform and transition reach it as
|
|
308
|
+
--sortable-transform and --sortable-transition. The element's own transition-* classes
|
|
309
|
+
come after this rule, so an element that has them sets them only while no drag runs. */
|
|
310
|
+
@utility sortable {
|
|
311
|
+
transform: var(--sortable-transform);
|
|
312
|
+
transition: var(--sortable-transition);
|
|
313
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Where erxes-ui's upload hooks and components send files. The host app
|
|
3
|
-
* (
|
|
3
|
+
* (web) sets an adapter for its file service at start-up. erxes-ui is a
|
|
4
4
|
* Module Federation singleton, so plugin UIs get the host's adapter too.
|
|
5
5
|
*/
|
|
6
6
|
export interface FileStorageAdapter {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
/**
|
|
3
3
|
* How plugin UIs reach their own API and hear about changes. The host app
|
|
4
|
-
* (
|
|
4
|
+
* (web) provides the runtime; erxes-ui is a Module Federation singleton,
|
|
5
5
|
* so every plugin UI gets the host's.
|
|
6
6
|
*
|
|
7
7
|
* - `pluginFetch('hr', '/leaves')` calls the plugin's API (its address comes
|
|
@@ -3,7 +3,7 @@ import { ComponentType } from "react";
|
|
|
3
3
|
* Core's timeline, for plugin UIs: `<RecordTimeline type="hr.employee" id={employee.id} />`
|
|
4
4
|
* shows notes, mentions, pins, reactions, logged calls and the plugin's own
|
|
5
5
|
* entries for one of its records (the type must be in the plugin's manifest
|
|
6
|
-
* `timelines`). The host app (
|
|
6
|
+
* `timelines`). The host app (web) registers the component; erxes-ui is a
|
|
7
7
|
* Module Federation singleton, so every plugin gets the host's.
|
|
8
8
|
*/
|
|
9
9
|
export type RecordTimelineProps = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@erxes/ui",
|
|
3
|
-
"version": "4.0.0-v2.
|
|
3
|
+
"version": "4.0.0-v2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "erxes design system: UI primitives, layout, hooks and shared frontend state",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"./fonts.css": "./dist/fonts.css",
|
|
24
24
|
"./theme.css": "./dist/theme.css",
|
|
25
25
|
"./base.css": "./dist/base.css",
|
|
26
|
+
"./components.css": "./dist/components.css",
|
|
26
27
|
"./*": {
|
|
27
28
|
"types": "./dist/*.d.ts",
|
|
28
29
|
"default": "./dist/*.js"
|
|
@@ -34,38 +35,37 @@
|
|
|
34
35
|
"tag": "v2-next"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@
|
|
38
|
-
"@blocknote/
|
|
39
|
-
"@blocknote/
|
|
38
|
+
"@base-ui/react": "1.9.0",
|
|
39
|
+
"@blocknote/core": "0.57.0",
|
|
40
|
+
"@blocknote/react": "0.57.0",
|
|
41
|
+
"@blocknote/shadcn": "0.57.0",
|
|
40
42
|
"@dnd-kit/core": "6.3.1",
|
|
41
|
-
"@dnd-kit/modifiers": "
|
|
42
|
-
"@dnd-kit/sortable": "
|
|
43
|
+
"@dnd-kit/modifiers": "9.0.0",
|
|
44
|
+
"@dnd-kit/sortable": "10.0.0",
|
|
43
45
|
"@dnd-kit/utilities": "3.2.2",
|
|
44
|
-
"@
|
|
46
|
+
"@floating-ui/react": "^0.27.20",
|
|
47
|
+
"@formkit/auto-animate": "0.10.2",
|
|
45
48
|
"@hookform/resolvers": "7.0.6",
|
|
46
49
|
"@module-federation/enhanced": "2.9.3",
|
|
47
50
|
"@tabler/icons-react": "3.34.0",
|
|
48
|
-
"@tanstack/react-
|
|
49
|
-
"@
|
|
51
|
+
"@tanstack/react-store": "0.11.2",
|
|
52
|
+
"@tanstack/react-table": "9.3.1",
|
|
50
53
|
"class-variance-authority": "0.7.1",
|
|
51
|
-
"clsx": "2.1.1",
|
|
52
54
|
"cmdk": "1.1.1",
|
|
55
|
+
"cn": "0.5.2",
|
|
53
56
|
"date-fns": "4.1.0",
|
|
54
57
|
"jotai-family": "1.1.0",
|
|
55
58
|
"libphonenumber-js": "1.12.6",
|
|
56
|
-
"
|
|
57
|
-
"react-aria-components": "1.10.1",
|
|
58
|
-
"react-day-picker": "9.11.1",
|
|
59
|
+
"react-day-picker": "10.0.2",
|
|
59
60
|
"react-hook-form": "7.55.0",
|
|
60
|
-
"react-hotkeys-hook": "4.
|
|
61
|
+
"react-hotkeys-hook": "5.4.0",
|
|
61
62
|
"react-imask": "7.6.1",
|
|
62
|
-
"react-intersection-observer": "
|
|
63
|
-
"react-resizable-panels": "
|
|
63
|
+
"react-intersection-observer": "11.0.1",
|
|
64
|
+
"react-resizable-panels": "4.21.0",
|
|
64
65
|
"recharts": "3.10.1",
|
|
65
|
-
"tailwind-merge": "3.7.0",
|
|
66
66
|
"tailwindcss": "^4.0.0",
|
|
67
67
|
"tailwindcss-animate": "1.0.7",
|
|
68
|
-
"type-fest": "
|
|
68
|
+
"type-fest": "5.10.0",
|
|
69
69
|
"use-debounce": "^10.1.1",
|
|
70
70
|
"zod": "4.6.7"
|
|
71
71
|
},
|
|
@@ -73,17 +73,20 @@
|
|
|
73
73
|
"@types/node": "^26.6.6",
|
|
74
74
|
"@types/react": "19.3.0",
|
|
75
75
|
"@types/react-dom": "19.3.0",
|
|
76
|
+
"jotai": "^3.0.2",
|
|
76
77
|
"react": "^19.3.1",
|
|
77
|
-
"react-dom": "^19.3.1"
|
|
78
|
+
"react-dom": "^19.3.1",
|
|
79
|
+
"react-i18next": "^18.0.1"
|
|
78
80
|
},
|
|
79
81
|
"peerDependencies": {
|
|
80
|
-
"jotai": "^
|
|
82
|
+
"jotai": "^3.0.2",
|
|
81
83
|
"react": "^19.3.1",
|
|
82
84
|
"react-dom": "^19.3.1",
|
|
83
|
-
"react-i18next": "^
|
|
85
|
+
"react-i18next": "^18.0.1",
|
|
84
86
|
"react-router-dom": "^7.1.1"
|
|
85
87
|
},
|
|
86
88
|
"scripts": {
|
|
87
|
-
"build": "tsdown"
|
|
89
|
+
"build": "tsdown",
|
|
90
|
+
"cn:tables": "cn build --full --css src/styles.css --out src/lib/cn-tables.ts --quiet"
|
|
88
91
|
}
|
|
89
92
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface MultiSelectOption {
|
|
2
|
-
value: string;
|
|
3
|
-
label: string;
|
|
4
|
-
disable?: boolean;
|
|
5
|
-
/** fixed option that can't be removed. */
|
|
6
|
-
fixed?: boolean;
|
|
7
|
-
/** Group the options by providing key. */
|
|
8
|
-
[key: string]: string | boolean | undefined;
|
|
9
|
-
}
|
|
10
|
-
/** Options by group heading; '' holds the ungrouped ones. */
|
|
11
|
-
export type GroupedOptions = Record<string, MultiSelectOption[]>;
|
|
12
|
-
export declare const groupOptions: (options: MultiSelectOption[], groupBy?: string) => GroupedOptions;
|
|
13
|
-
export declare const withoutPicked: (groups: GroupedOptions, picked: MultiSelectOption[]) => {
|
|
14
|
-
[k: string]: MultiSelectOption[];
|
|
15
|
-
};
|
|
16
|
-
export declare const hasOptionValue: (groups: GroupedOptions, value: string) => boolean;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// src/components/multiselect-options.ts
|
|
2
|
-
const groupOptions = (options, groupBy) => {
|
|
3
|
-
if (!groupBy) return options.length > 0 ? { "": options } : {};
|
|
4
|
-
const groups = {};
|
|
5
|
-
for (const option of options) {
|
|
6
|
-
const key = option[groupBy];
|
|
7
|
-
(groups[typeof key === "string" ? key : ""] ??= []).push(option);
|
|
8
|
-
}
|
|
9
|
-
return groups;
|
|
10
|
-
};
|
|
11
|
-
const withoutPicked = (groups, picked) => Object.fromEntries(Object.entries(groups).map(([key, options]) => [key, options.filter((option) => !picked.some((item) => item.value === option.value))]));
|
|
12
|
-
const hasOptionValue = (groups, value) => Object.values(groups).some((options) => options.some((option) => option.value === value));
|
|
13
|
-
export { groupOptions, hasOptionValue, withoutPicked };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { GroupedOptions, MultiSelectOption } from "./multiselect-options.js";
|
|
2
|
-
/**
|
|
3
|
-
* The `CommandEmpty` of shadcn/ui does not render cmdk's empty state correctly here,
|
|
4
|
-
* so this copies cmdk's `Empty`.
|
|
5
|
-
* @see https://github.com/hsuanyi-chou/shadcn-ui-expansions/issues/34#issuecomment-1949561607
|
|
6
|
-
*/
|
|
7
|
-
export declare const MultiSelectEmpty: ({ children }: {
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
}) => import("react").JSX.Element | null;
|
|
10
|
-
export declare const SelectedBadge: ({ option, disabled, className, onRemove }: {
|
|
11
|
-
option: MultiSelectOption;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
className?: string;
|
|
14
|
-
onRemove: () => void;
|
|
15
|
-
}) => import("react").JSX.Element;
|
|
16
|
-
export declare const CreatableItem: ({ inputValue, onCreate }: {
|
|
17
|
-
inputValue: string;
|
|
18
|
-
onCreate: (value: string) => void;
|
|
19
|
-
}) => import("react").JSX.Element;
|
|
20
|
-
export declare const OptionGroups: ({ groups, onSelect }: {
|
|
21
|
-
groups: GroupedOptions;
|
|
22
|
-
onSelect: (option: MultiSelectOption) => void;
|
|
23
|
-
}) => import("react").JSX.Element[];
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Command as Command$1 } from "./command.js";
|
|
2
|
-
import { cn } from "../lib/utils.js";
|
|
3
|
-
import { IconX } from "@tabler/icons-react";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { useCommandState } from "cmdk";
|
|
6
|
-
// src/components/multiselect-parts.tsx
|
|
7
|
-
/**
|
|
8
|
-
* The `CommandEmpty` of shadcn/ui does not render cmdk's empty state correctly here,
|
|
9
|
-
* so this copies cmdk's `Empty`.
|
|
10
|
-
* @see https://github.com/hsuanyi-chou/shadcn-ui-expansions/issues/34#issuecomment-1949561607
|
|
11
|
-
*/
|
|
12
|
-
const MultiSelectEmpty = ({ children }) => {
|
|
13
|
-
if (!useCommandState((state) => state.filtered.count === 0)) return null;
|
|
14
|
-
return /* @__PURE__ */ jsx("div", {
|
|
15
|
-
className: "px-2 py-4 text-center text-sm",
|
|
16
|
-
"cmdk-empty": "",
|
|
17
|
-
role: "presentation",
|
|
18
|
-
children
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
/** Stops the input losing focus when an option is pressed. */
|
|
22
|
-
const keepInputFocus = (event) => {
|
|
23
|
-
event.preventDefault();
|
|
24
|
-
event.stopPropagation();
|
|
25
|
-
};
|
|
26
|
-
const SelectedBadge = ({ option, disabled, className, onRemove }) => /* @__PURE__ */ jsxs("div", {
|
|
27
|
-
className: cn("animate-fadeIn relative inline-flex h-7 cursor-default items-center rounded-md border border-solid bg-background pe-7 pl-2 ps-2 text-xs font-medium text-secondary-foreground transition-all hover:bg-background disabled:cursor-not-allowed disabled:opacity-50 data-fixed:pe-2", className),
|
|
28
|
-
"data-fixed": option.fixed,
|
|
29
|
-
"data-disabled": disabled ? true : void 0,
|
|
30
|
-
children: [option.label, /* @__PURE__ */ jsx("button", {
|
|
31
|
-
type: "button",
|
|
32
|
-
className: "absolute -inset-y-px -end-px flex size-7 items-center justify-center rounded-e-lg border border-transparent p-0 text-muted-foreground/80 outline-0 transition-colors hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-ring/70",
|
|
33
|
-
onMouseDown: keepInputFocus,
|
|
34
|
-
onClick: onRemove,
|
|
35
|
-
"aria-label": "Remove",
|
|
36
|
-
children: /* @__PURE__ */ jsx(IconX, {
|
|
37
|
-
size: 14,
|
|
38
|
-
strokeWidth: 2,
|
|
39
|
-
"aria-hidden": "true"
|
|
40
|
-
})
|
|
41
|
-
})]
|
|
42
|
-
});
|
|
43
|
-
const CreatableItem = ({ inputValue, onCreate }) => /* @__PURE__ */ jsx(Command$1.Item, {
|
|
44
|
-
value: inputValue,
|
|
45
|
-
className: "cursor-pointer",
|
|
46
|
-
onMouseDown: keepInputFocus,
|
|
47
|
-
onSelect: onCreate,
|
|
48
|
-
children: `Create "${inputValue}"`
|
|
49
|
-
});
|
|
50
|
-
const OptionGroups = ({ groups, onSelect }) => Object.entries(groups).map(([heading, options]) => /* @__PURE__ */ jsx(Command$1.Group, {
|
|
51
|
-
heading,
|
|
52
|
-
className: "h-full overflow-auto",
|
|
53
|
-
children: options.map((option) => /* @__PURE__ */ jsx(Command$1.Item, {
|
|
54
|
-
value: option.value,
|
|
55
|
-
disabled: option.disable,
|
|
56
|
-
onMouseDown: keepInputFocus,
|
|
57
|
-
onSelect: () => onSelect(option),
|
|
58
|
-
className: cn("cursor-pointer", option.disable && "cursor-not-allowed opacity-50"),
|
|
59
|
-
children: option.label
|
|
60
|
-
}, option.value))
|
|
61
|
-
}, heading));
|
|
62
|
-
export { CreatableItem, MultiSelectEmpty, OptionGroups, SelectedBadge };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { GroupedOptions, MultiSelectOption } from "./multiselect-options.js";
|
|
2
|
-
import { Command } from "./command.js";
|
|
3
|
-
export interface MultipleSelectorProps {
|
|
4
|
-
value?: MultiSelectOption[];
|
|
5
|
-
defaultOptions?: MultiSelectOption[];
|
|
6
|
-
/** manually controlled options */
|
|
7
|
-
options?: MultiSelectOption[];
|
|
8
|
-
placeholder?: string;
|
|
9
|
-
loadingIndicator?: React.ReactNode;
|
|
10
|
-
emptyIndicator?: React.ReactNode;
|
|
11
|
-
/** Debounce time for search, in ms. */
|
|
12
|
-
delay?: number;
|
|
13
|
-
/** Search as soon as the input gets focus, before anything is typed. */
|
|
14
|
-
triggerSearchOnFocus?: boolean;
|
|
15
|
-
/** async search; options come from it while it is set. */
|
|
16
|
-
onSearch?: (value: string) => Promise<MultiSelectOption[]>;
|
|
17
|
-
/** sync search, without the loading indicator. */
|
|
18
|
-
onSearchSync?: (value: string) => MultiSelectOption[];
|
|
19
|
-
onChange?: (options: MultiSelectOption[]) => void;
|
|
20
|
-
/** Limit the maximum number of selected options. */
|
|
21
|
-
maxSelected?: number;
|
|
22
|
-
/** Called instead of selecting when the limit is reached. */
|
|
23
|
-
onMaxSelected?: (maxLimit: number) => void;
|
|
24
|
-
/** Hide the placeholder when there are options selected. */
|
|
25
|
-
hidePlaceholderWhenSelected?: boolean;
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
/** Group the options by this option key. */
|
|
28
|
-
groupBy?: string;
|
|
29
|
-
className?: string;
|
|
30
|
-
badgeClassName?: string;
|
|
31
|
-
/**
|
|
32
|
-
* cmdk highlights the first item; false adds a hidden dummy item instead.
|
|
33
|
-
* @see https://github.com/pacocoursey/cmdk/issues/171
|
|
34
|
-
*/
|
|
35
|
-
selectFirstItem?: boolean;
|
|
36
|
-
/** Allow creating an option when none matches. */
|
|
37
|
-
creatable?: boolean;
|
|
38
|
-
commandProps?: React.ComponentPropsWithoutRef<typeof Command>;
|
|
39
|
-
inputProps?: Omit<React.ComponentPropsWithoutRef<typeof Command.Input>, 'value' | 'placeholder' | 'disabled'>;
|
|
40
|
-
hideClearAllButton?: boolean;
|
|
41
|
-
}
|
|
42
|
-
export interface MultipleSelectorRef {
|
|
43
|
-
selectedValue: MultiSelectOption[];
|
|
44
|
-
input: HTMLInputElement | null;
|
|
45
|
-
focus: () => void;
|
|
46
|
-
reset: () => void;
|
|
47
|
-
}
|
|
48
|
-
/** Selection, options, open state and the actions MultipleSelector's parts use. */
|
|
49
|
-
export declare const useMultipleSelector: (props: MultipleSelectorProps, ref: React.Ref<MultipleSelectorRef> | undefined) => {
|
|
50
|
-
inputRef: import("react").RefObject<HTMLInputElement | null>;
|
|
51
|
-
dropdownRef: import("react").RefObject<HTMLDivElement | null>;
|
|
52
|
-
open: boolean;
|
|
53
|
-
setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
54
|
-
onScrollbar: boolean;
|
|
55
|
-
setOnScrollbar: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
56
|
-
inputValue: string;
|
|
57
|
-
setInputValue: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
58
|
-
selected: MultiSelectOption[];
|
|
59
|
-
groups: GroupedOptions;
|
|
60
|
-
isLoading: boolean;
|
|
61
|
-
canCreate: boolean;
|
|
62
|
-
change: (next: MultiSelectOption[]) => void;
|
|
63
|
-
select: (option: MultiSelectOption) => void;
|
|
64
|
-
remove: (option: MultiSelectOption) => void;
|
|
65
|
-
};
|
|
66
|
-
export type MultipleSelectorState = ReturnType<typeof useMultipleSelector>;
|