@simplysm/solid 13.0.76 → 13.0.77
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 +9 -10
- package/dist/components/data/kanban/Kanban.d.ts +31 -38
- package/dist/components/data/kanban/Kanban.d.ts.map +1 -1
- package/dist/components/data/kanban/Kanban.js.map +1 -1
- package/dist/components/data/list/List.d.ts +7 -28
- package/dist/components/data/list/List.d.ts.map +1 -1
- package/dist/components/data/list/List.js +3 -2
- package/dist/components/data/list/List.js.map +2 -2
- package/dist/components/data/sheet/DataSheet.d.ts +3 -8
- package/dist/components/data/sheet/DataSheet.d.ts.map +1 -1
- package/dist/components/data/sheet/DataSheet.js +305 -418
- package/dist/components/data/sheet/DataSheet.js.map +2 -2
- package/dist/components/data/sheet/{types.d.ts → DataSheet.types.d.ts} +9 -3
- package/dist/components/data/sheet/DataSheet.types.d.ts.map +1 -0
- package/dist/components/data/sheet/DataSheet.types.js +1 -0
- package/dist/components/data/sheet/{sheetUtils.d.ts → DataSheet.utils.d.ts} +2 -2
- package/dist/components/data/sheet/DataSheet.utils.d.ts.map +1 -0
- package/dist/components/data/sheet/{sheetUtils.js → DataSheet.utils.js} +3 -3
- package/dist/components/data/sheet/DataSheet.utils.js.map +6 -0
- package/dist/components/data/sheet/DataSheetColumn.d.ts +1 -1
- package/dist/components/data/sheet/DataSheetColumn.d.ts.map +1 -1
- package/dist/components/data/sheet/DataSheetConfigDialog.d.ts +1 -1
- package/dist/components/data/sheet/DataSheetConfigDialog.d.ts.map +1 -1
- package/dist/components/data/sheet/hooks/useDataSheetExpansion.d.ts +1 -1
- package/dist/components/data/sheet/hooks/useDataSheetExpansion.d.ts.map +1 -1
- package/dist/components/data/sheet/hooks/useDataSheetExpansion.js +1 -1
- package/dist/components/data/sheet/hooks/useDataSheetFixedColumns.d.ts +2 -2
- package/dist/components/data/sheet/hooks/useDataSheetFixedColumns.d.ts.map +1 -1
- package/dist/components/data/sheet/hooks/useDataSheetHeaderCell.d.ts +27 -0
- package/dist/components/data/sheet/hooks/useDataSheetHeaderCell.d.ts.map +1 -0
- package/dist/components/data/sheet/hooks/useDataSheetHeaderCell.js +173 -0
- package/dist/components/data/sheet/hooks/useDataSheetHeaderCell.js.map +6 -0
- package/dist/components/data/sheet/hooks/useDataSheetReorder.d.ts +1 -2
- package/dist/components/data/sheet/hooks/useDataSheetReorder.d.ts.map +1 -1
- package/dist/components/data/sheet/hooks/useDataSheetReorder.js.map +1 -1
- package/dist/components/data/sheet/hooks/useDataSheetSelection.d.ts +2 -2
- package/dist/components/data/sheet/hooks/useDataSheetSelection.d.ts.map +1 -1
- package/dist/components/data/sheet/hooks/useDataSheetSelection.js +2 -2
- package/dist/components/data/sheet/hooks/useDataSheetSelection.js.map +1 -1
- package/dist/components/data/sheet/hooks/useDataSheetSorting.d.ts +1 -1
- package/dist/components/data/sheet/hooks/useDataSheetSorting.d.ts.map +1 -1
- package/dist/components/data/sheet/hooks/useDataSheetSorting.js +1 -1
- package/dist/components/disclosure/Dialog.d.ts +6 -10
- package/dist/components/disclosure/Dialog.d.ts.map +1 -1
- package/dist/components/disclosure/Dialog.js +11 -14
- package/dist/components/disclosure/Dialog.js.map +2 -2
- package/dist/components/disclosure/Dropdown.d.ts +8 -12
- package/dist/components/disclosure/Dropdown.d.ts.map +1 -1
- package/dist/components/disclosure/Dropdown.js.map +1 -1
- package/dist/components/disclosure/Tabs.d.ts +3 -5
- package/dist/components/disclosure/Tabs.d.ts.map +1 -1
- package/dist/components/disclosure/Tabs.js.map +1 -1
- package/dist/components/display/Barcode.d.ts +1 -1
- package/dist/components/display/Barcode.d.ts.map +1 -1
- package/dist/components/display/Barcode.js +2 -1
- package/dist/components/display/Barcode.js.map +2 -2
- package/dist/components/display/Barcode.types.d.ts +2 -0
- package/dist/components/display/Barcode.types.d.ts.map +1 -0
- package/dist/components/display/Barcode.types.js +1 -0
- package/dist/components/display/Echarts.d.ts +2 -2
- package/dist/components/display/Echarts.d.ts.map +1 -1
- package/dist/components/display/Echarts.js +7 -8
- package/dist/components/display/Echarts.js.map +2 -2
- package/dist/components/features/address/AddressSearch.d.ts.map +1 -1
- package/dist/components/features/address/AddressSearch.js +4 -1
- package/dist/components/features/address/AddressSearch.js.map +2 -2
- package/dist/components/features/crud-detail/CrudDetail.d.ts +12 -13
- package/dist/components/features/crud-detail/CrudDetail.d.ts.map +1 -1
- package/dist/components/features/crud-detail/CrudDetail.js +18 -15
- package/dist/components/features/crud-detail/CrudDetail.js.map +2 -2
- package/dist/components/features/crud-detail/{types.d.ts → CrudDetail.types.d.ts} +1 -1
- package/dist/components/features/crud-detail/CrudDetail.types.d.ts.map +1 -0
- package/dist/components/features/crud-detail/CrudDetail.types.js +1 -0
- package/dist/components/features/crud-sheet/CrudSheet.d.ts +3 -13
- package/dist/components/features/crud-sheet/CrudSheet.d.ts.map +1 -1
- package/dist/components/features/crud-sheet/CrudSheet.js +62 -73
- package/dist/components/features/crud-sheet/CrudSheet.js.map +2 -2
- package/dist/components/features/crud-sheet/{types.d.ts → CrudSheet.types.d.ts} +10 -10
- package/dist/components/features/crud-sheet/CrudSheet.types.d.ts.map +1 -0
- package/dist/components/features/crud-sheet/CrudSheet.types.js +1 -0
- package/dist/components/features/crud-sheet/CrudSheet.types.js.map +6 -0
- package/dist/components/features/crud-sheet/CrudSheetColumn.d.ts +1 -1
- package/dist/components/features/crud-sheet/CrudSheetColumn.d.ts.map +1 -1
- package/dist/components/features/crud-sheet/CrudSheetTools.d.ts +1 -1
- package/dist/components/features/crud-sheet/CrudSheetTools.d.ts.map +1 -1
- package/dist/components/features/data-select-button/DataSelectButton.d.ts +2 -2
- package/dist/components/features/data-select-button/DataSelectButton.d.ts.map +1 -1
- package/dist/components/features/data-select-button/DataSelectButton.js +3 -3
- package/dist/components/features/data-select-button/DataSelectButton.js.map +2 -2
- package/dist/components/features/shared-data/SharedDataSelect.d.ts +7 -11
- package/dist/components/features/shared-data/SharedDataSelect.d.ts.map +1 -1
- package/dist/components/features/shared-data/SharedDataSelect.js +5 -4
- package/dist/components/features/shared-data/SharedDataSelect.js.map +2 -2
- package/dist/components/features/shared-data/SharedDataSelectButton.d.ts.map +1 -1
- package/dist/components/features/shared-data/SharedDataSelectButton.js.map +1 -1
- package/dist/components/features/shared-data/SharedDataSelectList.d.ts +8 -15
- package/dist/components/features/shared-data/SharedDataSelectList.d.ts.map +1 -1
- package/dist/components/features/shared-data/SharedDataSelectList.js +5 -3
- package/dist/components/features/shared-data/SharedDataSelectList.js.map +2 -2
- package/dist/components/feedback/notification/NotificationProvider.d.ts.map +1 -1
- package/dist/components/feedback/notification/NotificationProvider.js +9 -1
- package/dist/components/feedback/notification/NotificationProvider.js.map +2 -2
- package/dist/components/feedback/print/Print.d.ts +4 -6
- package/dist/components/feedback/print/Print.d.ts.map +1 -1
- package/dist/components/feedback/print/Print.js +3 -2
- package/dist/components/feedback/print/Print.js.map +2 -2
- package/dist/components/feedback/print/PrintProvider.d.ts.map +1 -1
- package/dist/components/feedback/print/PrintProvider.js +1 -0
- package/dist/components/feedback/print/PrintProvider.js.map +1 -1
- package/dist/components/form-control/Invalid.d.ts +1 -1
- package/dist/components/form-control/Invalid.d.ts.map +1 -1
- package/dist/components/form-control/Invalid.js +27 -26
- package/dist/components/form-control/Invalid.js.map +2 -2
- package/dist/components/form-control/checkbox/Checkbox.d.ts +1 -1
- package/dist/components/form-control/checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/form-control/checkbox/CheckboxGroup.d.ts +10 -10
- package/dist/components/form-control/checkbox/CheckboxGroup.d.ts.map +1 -1
- package/dist/components/form-control/checkbox/CheckboxGroup.js +2 -2
- package/dist/components/form-control/checkbox/CheckboxGroup.js.map +2 -2
- package/dist/components/form-control/checkbox/Radio.d.ts +1 -1
- package/dist/components/form-control/checkbox/Radio.d.ts.map +1 -1
- package/dist/components/form-control/checkbox/RadioGroup.d.ts +10 -10
- package/dist/components/form-control/checkbox/RadioGroup.d.ts.map +1 -1
- package/dist/components/form-control/checkbox/RadioGroup.js +2 -2
- package/dist/components/form-control/checkbox/RadioGroup.js.map +2 -2
- package/dist/components/form-control/checkbox/SelectableBase.d.ts +1 -1
- package/dist/components/form-control/checkbox/SelectableBase.d.ts.map +1 -1
- package/dist/components/form-control/checkbox/SelectableBase.js +3 -3
- package/dist/components/form-control/checkbox/SelectableBase.js.map +2 -2
- package/dist/components/form-control/checkbox/SelectionGroupBase.d.ts +1 -1
- package/dist/components/form-control/checkbox/SelectionGroupBase.d.ts.map +1 -1
- package/dist/components/form-control/checkbox/SelectionGroupBase.js +3 -3
- package/dist/components/form-control/checkbox/SelectionGroupBase.js.map +2 -2
- package/dist/components/form-control/color-picker/ColorPicker.d.ts +2 -2
- package/dist/components/form-control/color-picker/ColorPicker.d.ts.map +1 -1
- package/dist/components/form-control/color-picker/ColorPicker.js +3 -3
- package/dist/components/form-control/color-picker/ColorPicker.js.map +2 -2
- package/dist/components/form-control/combobox/Combobox.d.ts +3 -3
- package/dist/components/form-control/combobox/Combobox.d.ts.map +1 -1
- package/dist/components/form-control/combobox/Combobox.js +10 -5
- package/dist/components/form-control/combobox/Combobox.js.map +2 -2
- package/dist/components/form-control/date-range-picker/DateRangePicker.js +4 -4
- package/dist/components/form-control/date-range-picker/DateRangePicker.js.map +2 -2
- package/dist/components/form-control/editor/EditorToolbar.d.ts.map +1 -1
- package/dist/components/form-control/editor/EditorToolbar.js +176 -312
- package/dist/components/form-control/editor/EditorToolbar.js.map +2 -2
- package/dist/components/form-control/field/DatePicker.d.ts +2 -2
- package/dist/components/form-control/field/DatePicker.d.ts.map +1 -1
- package/dist/components/form-control/field/DatePicker.js +3 -3
- package/dist/components/form-control/field/DatePicker.js.map +2 -2
- package/dist/components/form-control/field/DateTimePicker.d.ts +2 -2
- package/dist/components/form-control/field/DateTimePicker.d.ts.map +1 -1
- package/dist/components/form-control/field/DateTimePicker.js +3 -3
- package/dist/components/form-control/field/DateTimePicker.js.map +2 -2
- package/dist/components/form-control/field/FieldShell.d.ts +1 -1
- package/dist/components/form-control/field/FieldShell.d.ts.map +1 -1
- package/dist/components/form-control/field/FieldShell.js +2 -2
- package/dist/components/form-control/field/FieldShell.js.map +2 -2
- package/dist/components/form-control/field/NumberInput.d.ts +7 -28
- package/dist/components/form-control/field/NumberInput.d.ts.map +1 -1
- package/dist/components/form-control/field/NumberInput.js +7 -5
- package/dist/components/form-control/field/NumberInput.js.map +2 -2
- package/dist/components/form-control/field/TextInput.d.ts +7 -23
- package/dist/components/form-control/field/TextInput.d.ts.map +1 -1
- package/dist/components/form-control/field/TextInput.js +6 -5
- package/dist/components/form-control/field/TextInput.js.map +2 -2
- package/dist/components/form-control/field/Textarea.d.ts +2 -2
- package/dist/components/form-control/field/Textarea.d.ts.map +1 -1
- package/dist/components/form-control/field/Textarea.js +3 -3
- package/dist/components/form-control/field/Textarea.js.map +2 -2
- package/dist/components/form-control/field/TimePicker.d.ts +2 -2
- package/dist/components/form-control/field/TimePicker.d.ts.map +1 -1
- package/dist/components/form-control/field/TimePicker.js +3 -3
- package/dist/components/form-control/field/TimePicker.js.map +2 -2
- package/dist/components/form-control/select/Select.d.ts +22 -44
- package/dist/components/form-control/select/Select.d.ts.map +1 -1
- package/dist/components/form-control/select/Select.js +8 -6
- package/dist/components/form-control/select/Select.js.map +2 -2
- package/dist/components/form-control/state-preset/StatePreset.js +5 -5
- package/dist/components/form-control/state-preset/StatePreset.js.map +2 -2
- package/dist/components/layout/sidebar/Sidebar.d.ts +5 -102
- package/dist/components/layout/sidebar/Sidebar.d.ts.map +1 -1
- package/dist/components/layout/sidebar/Sidebar.js.map +1 -1
- package/dist/components/layout/topbar/Topbar.d.ts +1 -1
- package/dist/components/layout/topbar/Topbar.d.ts.map +1 -1
- package/dist/components/layout/topbar/Topbar.js +3 -3
- package/dist/components/layout/topbar/Topbar.js.map +2 -2
- package/dist/helpers/createAppStructure.d.ts.map +1 -1
- package/dist/helpers/createAppStructure.js.map +1 -1
- package/dist/hooks/createControllableStore.js +5 -5
- package/dist/hooks/createControllableStore.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/providers/ServiceClientProvider.d.ts +2 -2
- package/dist/providers/ServiceClientProvider.d.ts.map +1 -1
- package/dist/providers/ServiceClientProvider.js.map +1 -1
- package/dist/providers/shared-data/SharedDataProvider.d.ts +1 -1
- package/dist/providers/shared-data/SharedDataProvider.d.ts.map +1 -1
- package/dist/providers/shared-data/SharedDataProvider.js +98 -86
- package/dist/providers/shared-data/SharedDataProvider.js.map +2 -2
- package/package.json +5 -5
- package/src/components/data/kanban/Kanban.tsx +37 -32
- package/src/components/data/list/List.tsx +3 -6
- package/src/components/data/sheet/DataSheet.tsx +224 -334
- package/src/components/data/sheet/{types.ts → DataSheet.types.ts} +8 -2
- package/src/components/data/sheet/{sheetUtils.ts → DataSheet.utils.ts} +3 -3
- package/src/components/data/sheet/DataSheetColumn.tsx +1 -1
- package/src/components/data/sheet/DataSheetConfigDialog.tsx +1 -1
- package/src/components/data/sheet/hooks/useDataSheetExpansion.ts +2 -2
- package/src/components/data/sheet/hooks/useDataSheetFixedColumns.ts +2 -2
- package/src/components/data/sheet/hooks/useDataSheetHeaderCell.tsx +168 -0
- package/src/components/data/sheet/hooks/useDataSheetReorder.ts +1 -2
- package/src/components/data/sheet/hooks/useDataSheetSelection.ts +4 -4
- package/src/components/data/sheet/hooks/useDataSheetSorting.ts +2 -2
- package/src/components/disclosure/Dialog.tsx +21 -27
- package/src/components/disclosure/Dropdown.tsx +1 -6
- package/src/components/disclosure/Tabs.tsx +1 -6
- package/src/components/display/Barcode.tsx +4 -113
- package/src/components/display/Barcode.types.ts +111 -0
- package/src/components/display/Echarts.tsx +10 -11
- package/src/components/features/address/AddressSearch.tsx +21 -3
- package/src/components/features/crud-detail/CrudDetail.tsx +21 -38
- package/src/components/features/crud-sheet/CrudSheet.tsx +77 -93
- package/src/components/features/crud-sheet/{types.ts → CrudSheet.types.ts} +9 -9
- package/src/components/features/crud-sheet/CrudSheetColumn.tsx +1 -1
- package/src/components/features/crud-sheet/CrudSheetTools.tsx +1 -1
- package/src/components/features/data-select-button/DataSelectButton.tsx +8 -8
- package/src/components/features/shared-data/SharedDataSelect.tsx +23 -34
- package/src/components/features/shared-data/SharedDataSelectButton.tsx +1 -4
- package/src/components/features/shared-data/SharedDataSelectList.tsx +6 -10
- package/src/components/feedback/notification/NotificationProvider.tsx +9 -1
- package/src/components/feedback/print/Print.tsx +4 -8
- package/src/components/feedback/print/PrintProvider.tsx +2 -1
- package/src/components/form-control/Invalid.tsx +33 -29
- package/src/components/form-control/checkbox/Checkbox.tsx +1 -1
- package/src/components/form-control/checkbox/CheckboxGroup.tsx +3 -12
- package/src/components/form-control/checkbox/Radio.tsx +1 -1
- package/src/components/form-control/checkbox/RadioGroup.tsx +3 -12
- package/src/components/form-control/checkbox/SelectableBase.tsx +3 -3
- package/src/components/form-control/checkbox/SelectionGroupBase.tsx +3 -3
- package/src/components/form-control/color-picker/ColorPicker.tsx +4 -4
- package/src/components/form-control/combobox/Combobox.tsx +23 -18
- package/src/components/form-control/date-range-picker/DateRangePicker.tsx +5 -5
- package/src/components/form-control/editor/EditorToolbar.tsx +82 -202
- package/src/components/form-control/field/DatePicker.tsx +4 -4
- package/src/components/form-control/field/DateTimePicker.tsx +4 -4
- package/src/components/form-control/field/FieldShell.tsx +2 -2
- package/src/components/form-control/field/NumberInput.tsx +8 -11
- package/src/components/form-control/field/TextInput.tsx +7 -11
- package/src/components/form-control/field/Textarea.tsx +4 -4
- package/src/components/form-control/field/TimePicker.tsx +4 -4
- package/src/components/form-control/select/Select.tsx +33 -42
- package/src/components/form-control/state-preset/StatePreset.tsx +5 -5
- package/src/components/layout/sidebar/Sidebar.tsx +1 -7
- package/src/components/layout/topbar/Topbar.tsx +3 -3
- package/src/helpers/createAppStructure.ts +16 -0
- package/src/hooks/createControllableStore.ts +5 -5
- package/src/index.ts +4 -3
- package/src/providers/ServiceClientProvider.tsx +4 -4
- package/src/providers/shared-data/SharedDataProvider.tsx +136 -113
- package/tests/components/data/sheet/DataSheet.spec.tsx +2 -2
- package/tests/components/data/sheet/hooks/useDataSheetFixedColumns.spec.ts +1 -1
- package/tests/components/data/sheet/hooks/useDataSheetSelection.spec.ts +34 -17
- package/tests/components/data/sheet/hooks/useDataSheetSorting.spec.ts +1 -1
- package/tests/components/disclosure/Dialog.spec.tsx +7 -7
- package/tests/components/display/Barcode.spec.tsx +15 -1
- package/tests/components/features/crud-sheet/CrudSheet.spec.tsx +6 -6
- package/tests/components/form-control/Invalid.spec.tsx +5 -5
- package/tests/components/form-control/combobox/Combobox.spec.tsx +24 -1
- package/tests/components/layout/topbar/TopbarActions.spec.tsx +4 -4
- package/tests/components/layout/topbar/{createTopbarActions.spec.tsx → useTopbarActions.spec.tsx} +4 -4
- package/tests/providers/shared-data/SharedDataProvider.spec.tsx +130 -8
- package/dist/components/data/sheet/sheetUtils.d.ts.map +0 -1
- package/dist/components/data/sheet/sheetUtils.js.map +0 -6
- package/dist/components/data/sheet/types.d.ts.map +0 -1
- package/dist/components/data/sheet/types.js +0 -1
- package/dist/components/features/crud-detail/types.d.ts.map +0 -1
- package/dist/components/features/crud-detail/types.js +0 -1
- package/dist/components/features/crud-sheet/types.d.ts.map +0 -1
- package/dist/components/features/crud-sheet/types.js +0 -1
- package/dist/components/feedback/notification/index.d.ts +0 -4
- package/dist/components/feedback/notification/index.d.ts.map +0 -1
- package/dist/components/feedback/notification/index.js +0 -4
- package/dist/components/feedback/notification/index.js.map +0 -6
- package/src/components/feedback/notification/index.ts +0 -3
- /package/dist/components/data/sheet/{types.js.map → DataSheet.types.js.map} +0 -0
- /package/dist/components/{features/crud-detail/types.js.map → display/Barcode.types.js.map} +0 -0
- /package/dist/components/features/{crud-sheet/types.js.map → crud-detail/CrudDetail.types.js.map} +0 -0
- /package/src/components/features/crud-detail/{types.ts → CrudDetail.types.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type Component } from "solid-js";
|
|
1
|
+
import { type Component, For } from "solid-js";
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { twMerge } from "tailwind-merge";
|
|
4
|
-
import type { Editor } from "@tiptap/core";
|
|
4
|
+
import type { ChainedCommands, Editor } from "@tiptap/core";
|
|
5
5
|
import { createEditorTransaction } from "solid-tiptap";
|
|
6
6
|
import { Button } from "../Button";
|
|
7
7
|
import {
|
|
@@ -60,33 +60,63 @@ const colorLabelClass = clsx(
|
|
|
60
60
|
// Color input hide style
|
|
61
61
|
const colorInputClass = clsx("absolute opacity-0", "size-0");
|
|
62
62
|
|
|
63
|
+
interface ToolbarButtonItem {
|
|
64
|
+
icon: Component;
|
|
65
|
+
i18nKey: string;
|
|
66
|
+
/** Tiptap editor command — receives editor.chain().focus() */
|
|
67
|
+
command: (chain: ChainedCommands) => void;
|
|
68
|
+
/** Active state check — receives editor instance */
|
|
69
|
+
isActive?: (editor: Editor) => boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
type ToolbarItem = ToolbarButtonItem | "separator";
|
|
73
|
+
|
|
74
|
+
// Items before color pickers: Headings + Text formatting
|
|
75
|
+
const toolbarItemsBefore: ToolbarItem[] = [
|
|
76
|
+
// Headings
|
|
77
|
+
{ icon: IconH1, i18nKey: "editorToolbar.heading1", command: (c) => c.toggleHeading({ level: 1 }).run(), isActive: (e) => e.isActive("heading", { level: 1 }) },
|
|
78
|
+
{ icon: IconH2, i18nKey: "editorToolbar.heading2", command: (c) => c.toggleHeading({ level: 2 }).run(), isActive: (e) => e.isActive("heading", { level: 2 }) },
|
|
79
|
+
"separator",
|
|
80
|
+
// Text formatting
|
|
81
|
+
{ icon: IconBold, i18nKey: "editorToolbar.bold", command: (c) => c.toggleBold().run(), isActive: (e) => e.isActive("bold") },
|
|
82
|
+
{ icon: IconItalic, i18nKey: "editorToolbar.italic", command: (c) => c.toggleItalic().run(), isActive: (e) => e.isActive("italic") },
|
|
83
|
+
{ icon: IconUnderline, i18nKey: "editorToolbar.underline", command: (c) => c.toggleUnderline().run(), isActive: (e) => e.isActive("underline") },
|
|
84
|
+
{ icon: IconStrikethrough, i18nKey: "editorToolbar.strikethrough", command: (c) => c.toggleStrike().run(), isActive: (e) => e.isActive("strike") },
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
// Items after color pickers: Lists + Indent + Block + Alignment
|
|
88
|
+
const toolbarItemsAfter: ToolbarItem[] = [
|
|
89
|
+
// Lists
|
|
90
|
+
{ icon: IconList, i18nKey: "editorToolbar.bulletList", command: (c) => c.toggleBulletList().run(), isActive: (e) => e.isActive("bulletList") },
|
|
91
|
+
{ icon: IconListNumbers, i18nKey: "editorToolbar.numberedList", command: (c) => c.toggleOrderedList().run(), isActive: (e) => e.isActive("orderedList") },
|
|
92
|
+
"separator",
|
|
93
|
+
// Indentation
|
|
94
|
+
{ icon: IconIndentIncrease, i18nKey: "editorToolbar.increaseIndent", command: (c) => c.sinkListItem("listItem").run() },
|
|
95
|
+
{ icon: IconIndentDecrease, i18nKey: "editorToolbar.decreaseIndent", command: (c) => c.liftListItem("listItem").run() },
|
|
96
|
+
"separator",
|
|
97
|
+
// Block
|
|
98
|
+
{ icon: IconQuote, i18nKey: "editorToolbar.blockquote", command: (c) => c.toggleBlockquote().run(), isActive: (e) => e.isActive("blockquote") },
|
|
99
|
+
{ icon: IconCode, i18nKey: "editorToolbar.codeBlock", command: (c) => c.toggleCodeBlock().run(), isActive: (e) => e.isActive("codeBlock") },
|
|
100
|
+
"separator",
|
|
101
|
+
// Alignment
|
|
102
|
+
{ icon: IconAlignLeft, i18nKey: "editorToolbar.alignLeft", command: (c) => c.setTextAlign("left").run(), isActive: (e) => e.isActive({ textAlign: "left" }) },
|
|
103
|
+
{ icon: IconAlignCenter, i18nKey: "editorToolbar.alignCenter", command: (c) => c.setTextAlign("center").run(), isActive: (e) => e.isActive({ textAlign: "center" }) },
|
|
104
|
+
{ icon: IconAlignRight, i18nKey: "editorToolbar.alignRight", command: (c) => c.setTextAlign("right").run(), isActive: (e) => e.isActive({ textAlign: "right" }) },
|
|
105
|
+
{ icon: IconAlignJustified, i18nKey: "editorToolbar.justify", command: (c) => c.setTextAlign("justify").run(), isActive: (e) => e.isActive({ textAlign: "justify" }) },
|
|
106
|
+
];
|
|
107
|
+
|
|
63
108
|
export const EditorToolbar: Component<EditorToolbarProps> = (props) => {
|
|
64
109
|
const e = () => props.editor;
|
|
65
110
|
const i18n = useI18n();
|
|
66
111
|
|
|
67
112
|
// Track active state reactively with createEditorTransaction
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const isOrderedList = createEditorTransaction(e, (editor) => editor.isActive("orderedList"));
|
|
76
|
-
const isBlockquote = createEditorTransaction(e, (editor) => editor.isActive("blockquote"));
|
|
77
|
-
const isCodeBlock = createEditorTransaction(e, (editor) => editor.isActive("codeBlock"));
|
|
78
|
-
const isAlignLeft = createEditorTransaction(e, (editor) =>
|
|
79
|
-
editor.isActive({ textAlign: "left" } as unknown as string),
|
|
80
|
-
);
|
|
81
|
-
const isAlignCenter = createEditorTransaction(e, (editor) =>
|
|
82
|
-
editor.isActive({ textAlign: "center" } as unknown as string),
|
|
83
|
-
);
|
|
84
|
-
const isAlignRight = createEditorTransaction(e, (editor) =>
|
|
85
|
-
editor.isActive({ textAlign: "right" } as unknown as string),
|
|
86
|
-
);
|
|
87
|
-
const isAlignJustify = createEditorTransaction(e, (editor) =>
|
|
88
|
-
editor.isActive({ textAlign: "justify" } as unknown as string),
|
|
89
|
-
);
|
|
113
|
+
const activeStates = new Map<ToolbarButtonItem, () => boolean>();
|
|
114
|
+
for (const item of [...toolbarItemsBefore, ...toolbarItemsAfter]) {
|
|
115
|
+
if (item !== "separator" && item.isActive) {
|
|
116
|
+
const check = item.isActive;
|
|
117
|
+
activeStates.set(item, createEditorTransaction(e, (editor) => check(editor)));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
90
120
|
|
|
91
121
|
// Current text color
|
|
92
122
|
const currentColor = createEditorTransaction(
|
|
@@ -103,6 +133,28 @@ export const EditorToolbar: Component<EditorToolbarProps> = (props) => {
|
|
|
103
133
|
const btnClass = (active: () => boolean) =>
|
|
104
134
|
twMerge(toolbarBtnExtra, active() && toolbarBtnActiveClass);
|
|
105
135
|
|
|
136
|
+
function renderToolbarItems(items: ToolbarItem[]) {
|
|
137
|
+
return (
|
|
138
|
+
<For each={items}>
|
|
139
|
+
{(item) =>
|
|
140
|
+
item === "separator" ? (
|
|
141
|
+
<div class={separatorClass} />
|
|
142
|
+
) : (
|
|
143
|
+
<Button
|
|
144
|
+
variant="ghost"
|
|
145
|
+
size="xs"
|
|
146
|
+
class={item.isActive ? btnClass(() => activeStates.get(item)?.() ?? false) : toolbarBtnExtra}
|
|
147
|
+
title={i18n.t(item.i18nKey)}
|
|
148
|
+
onClick={() => item.command(props.editor.chain().focus())}
|
|
149
|
+
>
|
|
150
|
+
<Icon icon={item.icon} size="1em" />
|
|
151
|
+
</Button>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
</For>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
106
158
|
// Image insert handler
|
|
107
159
|
const handleImageInsert = () => {
|
|
108
160
|
const input = document.createElement("input");
|
|
@@ -126,71 +178,10 @@ export const EditorToolbar: Component<EditorToolbarProps> = (props) => {
|
|
|
126
178
|
|
|
127
179
|
return (
|
|
128
180
|
<div class={twMerge(clsx("flex flex-wrap items-center", gap.sm, "border-b", border.default, pad.default), props.class)}>
|
|
129
|
-
{
|
|
130
|
-
<Button
|
|
131
|
-
variant="ghost"
|
|
132
|
-
size="xs"
|
|
133
|
-
class={btnClass(isH1)}
|
|
134
|
-
title={i18n.t("editorToolbar.heading1")}
|
|
135
|
-
onClick={() => props.editor.chain().focus().toggleHeading({ level: 1 }).run()}
|
|
136
|
-
>
|
|
137
|
-
<Icon icon={IconH1} size="1em" />
|
|
138
|
-
</Button>
|
|
139
|
-
<Button
|
|
140
|
-
variant="ghost"
|
|
141
|
-
size="xs"
|
|
142
|
-
class={btnClass(isH2)}
|
|
143
|
-
title={i18n.t("editorToolbar.heading2")}
|
|
144
|
-
onClick={() => props.editor.chain().focus().toggleHeading({ level: 2 }).run()}
|
|
145
|
-
>
|
|
146
|
-
<Icon icon={IconH2} size="1em" />
|
|
147
|
-
</Button>
|
|
148
|
-
|
|
149
|
-
{/* 2. Separator */}
|
|
150
|
-
<div class={separatorClass} />
|
|
151
|
-
|
|
152
|
-
{/* 3. Text format (Bold, Italic, Underline, Strike) */}
|
|
153
|
-
<Button
|
|
154
|
-
variant="ghost"
|
|
155
|
-
size="xs"
|
|
156
|
-
class={btnClass(isBold)}
|
|
157
|
-
title={i18n.t("editorToolbar.bold")}
|
|
158
|
-
onClick={() => props.editor.chain().focus().toggleBold().run()}
|
|
159
|
-
>
|
|
160
|
-
<Icon icon={IconBold} size="1em" />
|
|
161
|
-
</Button>
|
|
162
|
-
<Button
|
|
163
|
-
variant="ghost"
|
|
164
|
-
size="xs"
|
|
165
|
-
class={btnClass(isItalic)}
|
|
166
|
-
title={i18n.t("editorToolbar.italic")}
|
|
167
|
-
onClick={() => props.editor.chain().focus().toggleItalic().run()}
|
|
168
|
-
>
|
|
169
|
-
<Icon icon={IconItalic} size="1em" />
|
|
170
|
-
</Button>
|
|
171
|
-
<Button
|
|
172
|
-
variant="ghost"
|
|
173
|
-
size="xs"
|
|
174
|
-
class={btnClass(isUnderline)}
|
|
175
|
-
title={i18n.t("editorToolbar.underline")}
|
|
176
|
-
onClick={() => props.editor.chain().focus().toggleUnderline().run()}
|
|
177
|
-
>
|
|
178
|
-
<Icon icon={IconUnderline} size="1em" />
|
|
179
|
-
</Button>
|
|
180
|
-
<Button
|
|
181
|
-
variant="ghost"
|
|
182
|
-
size="xs"
|
|
183
|
-
class={btnClass(isStrike)}
|
|
184
|
-
title={i18n.t("editorToolbar.strikethrough")}
|
|
185
|
-
onClick={() => props.editor.chain().focus().toggleStrike().run()}
|
|
186
|
-
>
|
|
187
|
-
<Icon icon={IconStrikethrough} size="1em" />
|
|
188
|
-
</Button>
|
|
181
|
+
{renderToolbarItems(toolbarItemsBefore)}
|
|
189
182
|
|
|
190
|
-
{/*
|
|
183
|
+
{/* Color pickers */}
|
|
191
184
|
<div class={separatorClass} />
|
|
192
|
-
|
|
193
|
-
{/* 5. Text color + background color (using input[type=color]) */}
|
|
194
185
|
<label class={colorLabelClass} title={i18n.t("editorToolbar.textColor")}>
|
|
195
186
|
<span class={clsx("text-sm font-bold")}>A</span>
|
|
196
187
|
<div class="absolute inset-x-1 bottom-0.5 h-0.5 rounded-full" style={{ "background-color": currentColor() }} />
|
|
@@ -218,120 +209,11 @@ export const EditorToolbar: Component<EditorToolbarProps> = (props) => {
|
|
|
218
209
|
/>
|
|
219
210
|
</label>
|
|
220
211
|
|
|
221
|
-
{/* 6. Separator */}
|
|
222
212
|
<div class={separatorClass} />
|
|
213
|
+
{renderToolbarItems(toolbarItemsAfter)}
|
|
223
214
|
|
|
224
|
-
{/*
|
|
225
|
-
<Button
|
|
226
|
-
variant="ghost"
|
|
227
|
-
size="xs"
|
|
228
|
-
class={btnClass(isBulletList)}
|
|
229
|
-
title={i18n.t("editorToolbar.bulletList")}
|
|
230
|
-
onClick={() => props.editor.chain().focus().toggleBulletList().run()}
|
|
231
|
-
>
|
|
232
|
-
<Icon icon={IconList} size="1em" />
|
|
233
|
-
</Button>
|
|
234
|
-
<Button
|
|
235
|
-
variant="ghost"
|
|
236
|
-
size="xs"
|
|
237
|
-
class={btnClass(isOrderedList)}
|
|
238
|
-
title={i18n.t("editorToolbar.numberedList")}
|
|
239
|
-
onClick={() => props.editor.chain().focus().toggleOrderedList().run()}
|
|
240
|
-
>
|
|
241
|
-
<Icon icon={IconListNumbers} size="1em" />
|
|
242
|
-
</Button>
|
|
243
|
-
|
|
244
|
-
{/* 8. Separator */}
|
|
215
|
+
{/* Insert table */}
|
|
245
216
|
<div class={separatorClass} />
|
|
246
|
-
|
|
247
|
-
{/* 9. Indentation (Increase, Decrease) */}
|
|
248
|
-
<Button
|
|
249
|
-
variant="ghost"
|
|
250
|
-
size="xs"
|
|
251
|
-
class={toolbarBtnExtra}
|
|
252
|
-
title={i18n.t("editorToolbar.increaseIndent")}
|
|
253
|
-
onClick={() => props.editor.chain().focus().sinkListItem("listItem").run()}
|
|
254
|
-
>
|
|
255
|
-
<Icon icon={IconIndentIncrease} size="1em" />
|
|
256
|
-
</Button>
|
|
257
|
-
<Button
|
|
258
|
-
variant="ghost"
|
|
259
|
-
size="xs"
|
|
260
|
-
class={toolbarBtnExtra}
|
|
261
|
-
title={i18n.t("editorToolbar.decreaseIndent")}
|
|
262
|
-
onClick={() => props.editor.chain().focus().liftListItem("listItem").run()}
|
|
263
|
-
>
|
|
264
|
-
<Icon icon={IconIndentDecrease} size="1em" />
|
|
265
|
-
</Button>
|
|
266
|
-
|
|
267
|
-
{/* 10. Separator */}
|
|
268
|
-
<div class={separatorClass} />
|
|
269
|
-
|
|
270
|
-
{/* 11. Block (Blockquote, CodeBlock) */}
|
|
271
|
-
<Button
|
|
272
|
-
variant="ghost"
|
|
273
|
-
size="xs"
|
|
274
|
-
class={btnClass(isBlockquote)}
|
|
275
|
-
title={i18n.t("editorToolbar.blockquote")}
|
|
276
|
-
onClick={() => props.editor.chain().focus().toggleBlockquote().run()}
|
|
277
|
-
>
|
|
278
|
-
<Icon icon={IconQuote} size="1em" />
|
|
279
|
-
</Button>
|
|
280
|
-
<Button
|
|
281
|
-
variant="ghost"
|
|
282
|
-
size="xs"
|
|
283
|
-
class={btnClass(isCodeBlock)}
|
|
284
|
-
title={i18n.t("editorToolbar.codeBlock")}
|
|
285
|
-
onClick={() => props.editor.chain().focus().toggleCodeBlock().run()}
|
|
286
|
-
>
|
|
287
|
-
<Icon icon={IconCode} size="1em" />
|
|
288
|
-
</Button>
|
|
289
|
-
|
|
290
|
-
{/* 12. Separator */}
|
|
291
|
-
<div class={separatorClass} />
|
|
292
|
-
|
|
293
|
-
{/* 13. Alignment (Left, Center, Right, Justify) */}
|
|
294
|
-
<Button
|
|
295
|
-
variant="ghost"
|
|
296
|
-
size="xs"
|
|
297
|
-
class={btnClass(isAlignLeft)}
|
|
298
|
-
title={i18n.t("editorToolbar.alignLeft")}
|
|
299
|
-
onClick={() => props.editor.chain().focus().setTextAlign("left").run()}
|
|
300
|
-
>
|
|
301
|
-
<Icon icon={IconAlignLeft} size="1em" />
|
|
302
|
-
</Button>
|
|
303
|
-
<Button
|
|
304
|
-
variant="ghost"
|
|
305
|
-
size="xs"
|
|
306
|
-
class={btnClass(isAlignCenter)}
|
|
307
|
-
title={i18n.t("editorToolbar.alignCenter")}
|
|
308
|
-
onClick={() => props.editor.chain().focus().setTextAlign("center").run()}
|
|
309
|
-
>
|
|
310
|
-
<Icon icon={IconAlignCenter} size="1em" />
|
|
311
|
-
</Button>
|
|
312
|
-
<Button
|
|
313
|
-
variant="ghost"
|
|
314
|
-
size="xs"
|
|
315
|
-
class={btnClass(isAlignRight)}
|
|
316
|
-
title={i18n.t("editorToolbar.alignRight")}
|
|
317
|
-
onClick={() => props.editor.chain().focus().setTextAlign("right").run()}
|
|
318
|
-
>
|
|
319
|
-
<Icon icon={IconAlignRight} size="1em" />
|
|
320
|
-
</Button>
|
|
321
|
-
<Button
|
|
322
|
-
variant="ghost"
|
|
323
|
-
size="xs"
|
|
324
|
-
class={btnClass(isAlignJustify)}
|
|
325
|
-
title={i18n.t("editorToolbar.justify")}
|
|
326
|
-
onClick={() => props.editor.chain().focus().setTextAlign("justify").run()}
|
|
327
|
-
>
|
|
328
|
-
<Icon icon={IconAlignJustified} size="1em" />
|
|
329
|
-
</Button>
|
|
330
|
-
|
|
331
|
-
{/* 14. Separator */}
|
|
332
|
-
<div class={separatorClass} />
|
|
333
|
-
|
|
334
|
-
{/* 15. Insert table */}
|
|
335
217
|
<Button
|
|
336
218
|
variant="ghost"
|
|
337
219
|
size="xs"
|
|
@@ -344,7 +226,7 @@ export const EditorToolbar: Component<EditorToolbarProps> = (props) => {
|
|
|
344
226
|
<Icon icon={IconTablePlus} size="1em" />
|
|
345
227
|
</Button>
|
|
346
228
|
|
|
347
|
-
{/*
|
|
229
|
+
{/* Insert image */}
|
|
348
230
|
<Button
|
|
349
231
|
variant="ghost"
|
|
350
232
|
size="xs"
|
|
@@ -355,10 +237,8 @@ export const EditorToolbar: Component<EditorToolbarProps> = (props) => {
|
|
|
355
237
|
<Icon icon={IconPhoto} size="1em" />
|
|
356
238
|
</Button>
|
|
357
239
|
|
|
358
|
-
{/*
|
|
240
|
+
{/* Clear formatting */}
|
|
359
241
|
<div class={separatorClass} />
|
|
360
|
-
|
|
361
|
-
{/* 18. Clear formatting */}
|
|
362
242
|
<Button
|
|
363
243
|
variant="ghost"
|
|
364
244
|
size="xs"
|
|
@@ -50,8 +50,8 @@ export interface DatePickerProps {
|
|
|
50
50
|
/** Custom validation function */
|
|
51
51
|
validate?: (value: DateOnly | undefined) => string | undefined;
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
|
|
53
|
+
/** lazyValidation: show errors only after blur */
|
|
54
|
+
lazyValidation?: boolean;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
@@ -151,7 +151,7 @@ export const DatePicker: Component<DatePickerProps> = (props) => {
|
|
|
151
151
|
"style",
|
|
152
152
|
"required",
|
|
153
153
|
"validate",
|
|
154
|
-
"
|
|
154
|
+
"lazyValidation",
|
|
155
155
|
]);
|
|
156
156
|
|
|
157
157
|
const i18n = useI18n();
|
|
@@ -205,7 +205,7 @@ export const DatePicker: Component<DatePickerProps> = (props) => {
|
|
|
205
205
|
<FieldShell
|
|
206
206
|
errorMsg={errorMsg()}
|
|
207
207
|
invalidVariant={local.inset ? "dot" : "border"}
|
|
208
|
-
|
|
208
|
+
lazyValidation={local.lazyValidation}
|
|
209
209
|
inset={local.inset}
|
|
210
210
|
isEditable={isEditable()}
|
|
211
211
|
wrapperClass={getWrapperClass}
|
|
@@ -50,8 +50,8 @@ export interface DateTimePickerProps {
|
|
|
50
50
|
/** Custom validation function */
|
|
51
51
|
validate?: (value: DateTime | undefined) => string | undefined;
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
|
|
53
|
+
/** lazyValidation: show errors only after blur */
|
|
54
|
+
lazyValidation?: boolean;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
@@ -146,7 +146,7 @@ export const DateTimePicker: Component<DateTimePickerProps> = (props) => {
|
|
|
146
146
|
"style",
|
|
147
147
|
"required",
|
|
148
148
|
"validate",
|
|
149
|
-
"
|
|
149
|
+
"lazyValidation",
|
|
150
150
|
]);
|
|
151
151
|
|
|
152
152
|
const i18n = useI18n();
|
|
@@ -203,7 +203,7 @@ export const DateTimePicker: Component<DateTimePickerProps> = (props) => {
|
|
|
203
203
|
<FieldShell
|
|
204
204
|
errorMsg={errorMsg()}
|
|
205
205
|
invalidVariant={local.inset ? "dot" : "border"}
|
|
206
|
-
|
|
206
|
+
lazyValidation={local.lazyValidation}
|
|
207
207
|
inset={local.inset}
|
|
208
208
|
isEditable={isEditable()}
|
|
209
209
|
wrapperClass={getWrapperClass}
|
|
@@ -9,7 +9,7 @@ export interface FieldShellProps {
|
|
|
9
9
|
/** Invalid visual indicator variant */
|
|
10
10
|
invalidVariant: "dot" | "border";
|
|
11
11
|
/** Show error only after blur */
|
|
12
|
-
|
|
12
|
+
lazyValidation?: boolean;
|
|
13
13
|
|
|
14
14
|
/** Inset (borderless) mode */
|
|
15
15
|
inset: boolean | undefined;
|
|
@@ -50,7 +50,7 @@ export const FieldShell: ParentComponent<FieldShellProps> = (props) => {
|
|
|
50
50
|
<Invalid
|
|
51
51
|
message={props.errorMsg}
|
|
52
52
|
variant={props.invalidVariant}
|
|
53
|
-
|
|
53
|
+
lazyValidation={props.lazyValidation}
|
|
54
54
|
>
|
|
55
55
|
<Show
|
|
56
56
|
when={props.inset}
|
|
@@ -79,8 +79,8 @@ export interface NumberInputProps {
|
|
|
79
79
|
/** Custom validation function */
|
|
80
80
|
validate?: (value: number | undefined) => string | undefined;
|
|
81
81
|
|
|
82
|
-
/**
|
|
83
|
-
|
|
82
|
+
/** lazyValidation: show errors only after blur */
|
|
83
|
+
lazyValidation?: boolean;
|
|
84
84
|
|
|
85
85
|
/** Children (Prefix slot, etc.) */
|
|
86
86
|
children?: JSX.Element;
|
|
@@ -162,11 +162,6 @@ function isValidNumberInput(str: string): boolean {
|
|
|
162
162
|
return /^-?\d*\.?\d*$/.test(cleanStr);
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
interface NumberInputComponent {
|
|
166
|
-
(props: NumberInputProps): JSX.Element;
|
|
167
|
-
Prefix: typeof NumberInputPrefix;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
165
|
/**
|
|
171
166
|
* NumberInput component
|
|
172
167
|
*
|
|
@@ -187,7 +182,7 @@ interface NumberInputComponent {
|
|
|
187
182
|
* </NumberInput>
|
|
188
183
|
* ```
|
|
189
184
|
*/
|
|
190
|
-
|
|
185
|
+
const NumberInputInner = (props: NumberInputProps): JSX.Element => {
|
|
191
186
|
const [local, rest] = splitProps(props, [
|
|
192
187
|
"value",
|
|
193
188
|
"onValueChange",
|
|
@@ -203,7 +198,7 @@ export const NumberInput: NumberInputComponent = (props) => {
|
|
|
203
198
|
"min",
|
|
204
199
|
"max",
|
|
205
200
|
"validate",
|
|
206
|
-
"
|
|
201
|
+
"lazyValidation",
|
|
207
202
|
"class",
|
|
208
203
|
"style",
|
|
209
204
|
"children",
|
|
@@ -307,7 +302,7 @@ export const NumberInput: NumberInputComponent = (props) => {
|
|
|
307
302
|
<FieldShell
|
|
308
303
|
errorMsg={errorMsg()}
|
|
309
304
|
invalidVariant={local.inset ? "dot" : "border"}
|
|
310
|
-
|
|
305
|
+
lazyValidation={local.lazyValidation}
|
|
311
306
|
inset={local.inset}
|
|
312
307
|
isEditable={isEditable()}
|
|
313
308
|
wrapperClass={getWrapperClass}
|
|
@@ -350,4 +345,6 @@ export const NumberInput: NumberInputComponent = (props) => {
|
|
|
350
345
|
);
|
|
351
346
|
};
|
|
352
347
|
|
|
353
|
-
NumberInput
|
|
348
|
+
export const NumberInput = Object.assign(NumberInputInner, {
|
|
349
|
+
Prefix: NumberInputPrefix,
|
|
350
|
+
});
|
|
@@ -64,8 +64,8 @@ export interface TextInputProps {
|
|
|
64
64
|
/** Custom validation function */
|
|
65
65
|
validate?: (value: string) => string | undefined;
|
|
66
66
|
|
|
67
|
-
/**
|
|
68
|
-
|
|
67
|
+
/** lazyValidation: Show error only after blur */
|
|
68
|
+
lazyValidation?: boolean;
|
|
69
69
|
|
|
70
70
|
/** Custom class */
|
|
71
71
|
class?: string;
|
|
@@ -140,11 +140,6 @@ function removeFormat(formattedValue: string, format: string): string {
|
|
|
140
140
|
* <TextInput type="password" placeholder="Enter password" />
|
|
141
141
|
* ```
|
|
142
142
|
*/
|
|
143
|
-
interface TextInputComponent {
|
|
144
|
-
(props: TextInputProps): JSX.Element;
|
|
145
|
-
Prefix: typeof TextInputPrefix;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
143
|
const TextInputInner = (props: TextInputProps) => {
|
|
149
144
|
const [local, rest] = splitProps(props, [
|
|
150
145
|
"value",
|
|
@@ -163,7 +158,7 @@ const TextInputInner = (props: TextInputProps) => {
|
|
|
163
158
|
"maxLength",
|
|
164
159
|
"pattern",
|
|
165
160
|
"validate",
|
|
166
|
-
"
|
|
161
|
+
"lazyValidation",
|
|
167
162
|
"class",
|
|
168
163
|
"style",
|
|
169
164
|
"children",
|
|
@@ -263,7 +258,7 @@ const TextInputInner = (props: TextInputProps) => {
|
|
|
263
258
|
<FieldShell
|
|
264
259
|
errorMsg={errorMsg()}
|
|
265
260
|
invalidVariant={local.inset ? "dot" : "border"}
|
|
266
|
-
|
|
261
|
+
lazyValidation={local.lazyValidation}
|
|
267
262
|
inset={local.inset}
|
|
268
263
|
isEditable={isEditable()}
|
|
269
264
|
wrapperClass={getWrapperClass}
|
|
@@ -302,5 +297,6 @@ const TextInputInner = (props: TextInputProps) => {
|
|
|
302
297
|
);
|
|
303
298
|
};
|
|
304
299
|
|
|
305
|
-
export const TextInput = TextInputInner
|
|
306
|
-
|
|
300
|
+
export const TextInput = Object.assign(TextInputInner, {
|
|
301
|
+
Prefix: TextInputPrefix,
|
|
302
|
+
});
|
|
@@ -49,8 +49,8 @@ export interface TextareaProps {
|
|
|
49
49
|
/** Custom validation function */
|
|
50
50
|
validate?: (value: string) => string | undefined;
|
|
51
51
|
|
|
52
|
-
/**
|
|
53
|
-
|
|
52
|
+
/** lazyValidation: Show error only after blur */
|
|
53
|
+
lazyValidation?: boolean;
|
|
54
54
|
|
|
55
55
|
/** Custom class */
|
|
56
56
|
class?: string;
|
|
@@ -94,7 +94,7 @@ export const Textarea: Component<TextareaProps> = (props) => {
|
|
|
94
94
|
"minLength",
|
|
95
95
|
"maxLength",
|
|
96
96
|
"validate",
|
|
97
|
-
"
|
|
97
|
+
"lazyValidation",
|
|
98
98
|
"class",
|
|
99
99
|
"style",
|
|
100
100
|
]);
|
|
@@ -194,7 +194,7 @@ export const Textarea: Component<TextareaProps> = (props) => {
|
|
|
194
194
|
<FieldShell
|
|
195
195
|
errorMsg={errorMsg()}
|
|
196
196
|
invalidVariant={local.inset ? "dot" : "border"}
|
|
197
|
-
|
|
197
|
+
lazyValidation={local.lazyValidation}
|
|
198
198
|
inset={local.inset}
|
|
199
199
|
isEditable={isEditable()}
|
|
200
200
|
wrapperClass={getWrapperClass}
|
|
@@ -50,8 +50,8 @@ export interface TimePickerProps {
|
|
|
50
50
|
/** Custom validation function */
|
|
51
51
|
validate?: (value: Time | undefined) => string | undefined;
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
|
|
53
|
+
/** lazyValidation: show errors only after blur */
|
|
54
|
+
lazyValidation?: boolean;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
@@ -121,7 +121,7 @@ export const TimePicker: Component<TimePickerProps> = (props) => {
|
|
|
121
121
|
"max",
|
|
122
122
|
"required",
|
|
123
123
|
"validate",
|
|
124
|
-
"
|
|
124
|
+
"lazyValidation",
|
|
125
125
|
]);
|
|
126
126
|
|
|
127
127
|
const i18n = useI18n();
|
|
@@ -178,7 +178,7 @@ export const TimePicker: Component<TimePickerProps> = (props) => {
|
|
|
178
178
|
<FieldShell
|
|
179
179
|
errorMsg={errorMsg()}
|
|
180
180
|
invalidVariant={local.inset ? "dot" : "border"}
|
|
181
|
-
|
|
181
|
+
lazyValidation={local.lazyValidation}
|
|
182
182
|
inset={local.inset}
|
|
183
183
|
isEditable={isEditable()}
|
|
184
184
|
wrapperClass={getWrapperClass}
|