@ryuzaki13/react-foundation-ui 1.5.10 → 1.5.11
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/dist/advanced-search/index.js +182 -148
- package/dist/advanced-search/index.js.map +1 -1
- package/dist/advanced-search/model/useAdvancedSearchSelection.d.ts +1 -1
- package/dist/advanced-search/model/useAdvancedSearchSelection.d.ts.map +1 -1
- package/dist/advanced-search/ui/AdvancedSearchModal.d.ts +12 -3
- package/dist/advanced-search/ui/AdvancedSearchModal.d.ts.map +1 -1
- package/dist/advanced-search/ui/AdvancedSearchModalSession.d.ts +15 -0
- package/dist/advanced-search/ui/AdvancedSearchModalSession.d.ts.map +1 -0
- package/dist/advanced-search/ui/AdvancedSearchSelect.d.ts.map +1 -1
- package/dist/badge/index.js +1 -1
- package/dist/base-table/index.js +1 -1
- package/dist/button/index.js +1 -1
- package/dist/check-box/index.js +1 -1
- package/dist/chunks/{CalendarView-BSshXZAX.js → CalendarView-DqA-PbAU.js} +42 -42
- package/dist/chunks/{CalendarView-BSshXZAX.js.map → CalendarView-DqA-PbAU.js.map} +1 -1
- package/dist/chunks/{ImageViewerRuntime-BMs3BBkV.js → ImageViewerRuntime-HGBWp9NM.js} +18 -18
- package/dist/chunks/{ImageViewerRuntime-BMs3BBkV.js.map → ImageViewerRuntime-HGBWp9NM.js.map} +1 -1
- package/dist/chunks/{TextEditorLexicalClient-CLjpATRu.js → TextEditorLexicalClient-B084kVzu.js} +322 -322
- package/dist/chunks/{TextEditorLexicalClient-CLjpATRu.js.map → TextEditorLexicalClient-B084kVzu.js.map} +1 -1
- package/dist/chunks/{badge-CaooZXYD.js → badge-DMM8cOHd.js} +16 -16
- package/dist/chunks/{badge-CaooZXYD.js.map → badge-DMM8cOHd.js.map} +1 -1
- package/dist/chunks/{base-table-fUJY__6M.js → base-table-CJdKCKhb.js} +125 -125
- package/dist/chunks/{base-table-fUJY__6M.js.map → base-table-CJdKCKhb.js.map} +1 -1
- package/dist/chunks/{button-C--u7uJj.js → button-CzUO5rzq.js} +17 -17
- package/dist/chunks/{button-C--u7uJj.js.map → button-CzUO5rzq.js.map} +1 -1
- package/dist/chunks/{check-box-BZiEBR9c.js → check-box-sfGjYczQ.js} +11 -11
- package/dist/chunks/{check-box-BZiEBR9c.js.map → check-box-sfGjYczQ.js.map} +1 -1
- package/dist/chunks/{context-menu-XZ-e0f6_.js → context-menu-6nJkPmKV.js} +83 -83
- package/dist/chunks/{context-menu-XZ-e0f6_.js.map → context-menu-6nJkPmKV.js.map} +1 -1
- package/dist/chunks/date-input-9T8AoG5U.js +341 -0
- package/dist/chunks/{date-input-Dr5QNVT6.js.map → date-input-9T8AoG5U.js.map} +1 -1
- package/dist/chunks/{input-BNszawm6.js → input-VC8jEoTa.js} +37 -37
- package/dist/chunks/{input-BNszawm6.js.map → input-VC8jEoTa.js.map} +1 -1
- package/dist/chunks/{input-files-DxLVr2PF.js → input-files-CoMjadk7.js} +22 -22
- package/dist/chunks/{input-files-DxLVr2PF.js.map → input-files-CoMjadk7.js.map} +1 -1
- package/dist/chunks/{input-search-C2OOhZlw.js → input-search-Bs_9SxT0.js} +2 -2
- package/dist/chunks/{input-search-C2OOhZlw.js.map → input-search-Bs_9SxT0.js.map} +1 -1
- package/dist/chunks/{misc-Cp_r022Z.js → misc-CkRRma5E.js} +55 -55
- package/dist/chunks/{misc-Cp_r022Z.js.map → misc-CkRRma5E.js.map} +1 -1
- package/dist/chunks/{modal-DK9M7lT5.js → modal-LHkNxBko.js} +38 -38
- package/dist/chunks/{modal-DK9M7lT5.js.map → modal-LHkNxBko.js.map} +1 -1
- package/dist/chunks/{multi-select-CFHaQPot.js → multi-select-BJ6Lst1E.js} +44 -44
- package/dist/chunks/{multi-select-CFHaQPot.js.map → multi-select-BJ6Lst1E.js.map} +1 -1
- package/dist/chunks/{picker-D3Fc15JH.js → picker-DLnfOgZj.js} +34 -34
- package/dist/chunks/{picker-D3Fc15JH.js.map → picker-DLnfOgZj.js.map} +1 -1
- package/dist/chunks/{popover-BTT7zSqx.js → popover-IExDrsF6.js} +67 -67
- package/dist/chunks/{popover-BTT7zSqx.js.map → popover-IExDrsF6.js.map} +1 -1
- package/dist/chunks/{select-BolFlcoY.js → select-CysiIrej.js} +5 -5
- package/dist/chunks/{select-BolFlcoY.js.map → select-CysiIrej.js.map} +1 -1
- package/dist/chunks/{sortable-DcTIAbjD.js → sortable-BKIwlqhI.js} +17 -17
- package/dist/chunks/{sortable-DcTIAbjD.js.map → sortable-BKIwlqhI.js.map} +1 -1
- package/dist/chunks/{table-BChs6bgR.js → table-CIWdAcPY.js} +2 -2
- package/dist/chunks/{table-BChs6bgR.js.map → table-CIWdAcPY.js.map} +1 -1
- package/dist/chunks/{types-CxXyru6U.js → types-D9Wj9wrg.js} +21 -21
- package/dist/chunks/{types-CxXyru6U.js.map → types-D9Wj9wrg.js.map} +1 -1
- package/dist/chunks/{useODataSelectBase-BhCMCzv_.js → useODataSelectBase-Bq36Wp1U.js} +8 -8
- package/dist/chunks/{useODataSelectBase-BhCMCzv_.js.map → useODataSelectBase-Bq36Wp1U.js.map} +1 -1
- package/dist/context-menu/index.js +1 -1
- package/dist/date-input/index.js +2 -2
- package/dist/date-time-input/index.js +32 -32
- package/dist/dialog/index.js +9 -9
- package/dist/disclosure/index.js +10 -10
- package/dist/drop-zone/index.js +8 -8
- package/dist/errors/index.js +8 -8
- package/dist/expandable-action-panel/index.js +16 -16
- package/dist/flex/useFlexClasses.d.ts +1 -1
- package/dist/fullscreen-portal/index.js +7 -7
- package/dist/image/index.js +27 -27
- package/dist/input/index.js +1 -1
- package/dist/input-date-time/index.js +1 -1
- package/dist/input-file/index.js +1 -1
- package/dist/input-files/index.js +1 -1
- package/dist/input-image/index.js +1 -1
- package/dist/input-search/index.js +1 -1
- package/dist/layout-picker/index.js +1 -1
- package/dist/list/index.js +25 -25
- package/dist/listbox/index.js +5 -5
- package/dist/misc/index.js +1 -1
- package/dist/modal/index.js +1 -1
- package/dist/multi-select/index.js +1 -1
- package/dist/notifications/index.js +30 -30
- package/dist/picker/index.js +1 -1
- package/dist/popover/index.js +1 -1
- package/dist/preset-range-date-input/index.js +1 -1
- package/dist/preset-select/index.js +1 -1
- package/dist/radio-button/index.js +10 -10
- package/dist/select/index.js +1 -1
- package/dist/simple-table/index.js +1 -1
- package/dist/slider/index.js +3 -3
- package/dist/sortable/index.js +1 -1
- package/dist/state-select/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/switch/index.js +11 -11
- package/dist/table/index.js +1 -1
- package/dist/table-sorting/index.js +13 -13
- package/dist/tabs/index.js +1 -1
- package/dist/tag-input/index.js +55 -55
- package/dist/tag-input/index.js.map +1 -1
- package/dist/text/index.js +1 -1
- package/dist/text-editor/index.js +3 -3
- package/dist/textarea/index.js +1 -1
- package/dist/tree-select/index.js +134 -134
- package/dist/tree-select/index.js.map +1 -1
- package/dist/tree-table/index.js +16 -16
- package/package.json +1 -1
- package/storybook-static/project.json +1 -1
- package/dist/chunks/date-input-Dr5QNVT6.js +0 -341
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Bold as t, Code as n, Heading1 as r, Heading2 as i, Heading3 as a, Heading4 as o, Heading5 as s, Heading6 as c, Highlighter as l, Italic as u, List as d, ListOrdered as f, Pilcrow as p, Strikethrough as m, TextQuote as h, Type as g, Underline as _ } from "lucide-react";
|
|
3
3
|
//#region src/text-editor/editorModel.ts
|
|
4
4
|
var v = (e) => {
|
|
5
5
|
if (!e || typeof e != "object") return !1;
|
|
@@ -10,109 +10,109 @@ var v = (e) => {
|
|
|
10
10
|
label: "Параграф",
|
|
11
11
|
node: "p",
|
|
12
12
|
style: "unstyled",
|
|
13
|
-
icon: /* @__PURE__ */
|
|
13
|
+
icon: /* @__PURE__ */ e(g, {})
|
|
14
14
|
},
|
|
15
15
|
paragraph: {
|
|
16
16
|
label: "Параграф",
|
|
17
17
|
node: "p",
|
|
18
18
|
style: "paragraph",
|
|
19
|
-
icon: /* @__PURE__ */
|
|
19
|
+
icon: /* @__PURE__ */ e(p, {})
|
|
20
20
|
},
|
|
21
21
|
"header-one": {
|
|
22
22
|
label: "Заголовок первого уровня",
|
|
23
23
|
node: "h1",
|
|
24
24
|
style: "header-one",
|
|
25
|
-
icon: /* @__PURE__ */
|
|
25
|
+
icon: /* @__PURE__ */ e(r, {})
|
|
26
26
|
},
|
|
27
27
|
"header-two": {
|
|
28
28
|
label: "Заголовок второго уровня",
|
|
29
29
|
node: "h2",
|
|
30
30
|
style: "header-two",
|
|
31
|
-
icon: /* @__PURE__ */
|
|
31
|
+
icon: /* @__PURE__ */ e(i, {})
|
|
32
32
|
},
|
|
33
33
|
"header-three": {
|
|
34
34
|
label: "Заголовок третьего уровня",
|
|
35
35
|
node: "h3",
|
|
36
36
|
style: "header-three",
|
|
37
|
-
icon: /* @__PURE__ */
|
|
37
|
+
icon: /* @__PURE__ */ e(a, {})
|
|
38
38
|
},
|
|
39
39
|
"header-four": {
|
|
40
40
|
label: "Заголовок четвертого уровня",
|
|
41
41
|
node: "h4",
|
|
42
42
|
style: "header-four",
|
|
43
|
-
icon: /* @__PURE__ */
|
|
43
|
+
icon: /* @__PURE__ */ e(o, {})
|
|
44
44
|
},
|
|
45
45
|
"header-five": {
|
|
46
46
|
label: "Заголовок пятого уровня",
|
|
47
47
|
node: "h5",
|
|
48
48
|
style: "header-five",
|
|
49
|
-
icon: /* @__PURE__ */
|
|
49
|
+
icon: /* @__PURE__ */ e(s, {})
|
|
50
50
|
},
|
|
51
51
|
"header-six": {
|
|
52
52
|
label: "Заголовок шестого уровня",
|
|
53
53
|
node: "h6",
|
|
54
54
|
style: "header-six",
|
|
55
|
-
icon: /* @__PURE__ */
|
|
55
|
+
icon: /* @__PURE__ */ e(c, {})
|
|
56
56
|
},
|
|
57
57
|
"code-block": {
|
|
58
58
|
label: "Блок кода",
|
|
59
59
|
node: "pre",
|
|
60
60
|
style: "code-block",
|
|
61
|
-
icon: /* @__PURE__ */
|
|
61
|
+
icon: /* @__PURE__ */ e(n, {})
|
|
62
62
|
},
|
|
63
63
|
blockquote: {
|
|
64
64
|
label: "Цитата",
|
|
65
65
|
node: "blockquote",
|
|
66
66
|
style: "blockquote",
|
|
67
|
-
icon: /* @__PURE__ */
|
|
67
|
+
icon: /* @__PURE__ */ e(h, {})
|
|
68
68
|
},
|
|
69
69
|
"unordered-list-item": {
|
|
70
70
|
label: "Маркированный список",
|
|
71
71
|
node: "ul",
|
|
72
72
|
style: "unordered-list-item",
|
|
73
|
-
icon: /* @__PURE__ */
|
|
73
|
+
icon: /* @__PURE__ */ e(d, {})
|
|
74
74
|
},
|
|
75
75
|
"ordered-list-item": {
|
|
76
76
|
label: "Нумерованный список",
|
|
77
77
|
node: "ol",
|
|
78
78
|
style: "ordered-list-item",
|
|
79
|
-
icon: /* @__PURE__ */
|
|
79
|
+
icon: /* @__PURE__ */ e(f, {})
|
|
80
80
|
},
|
|
81
81
|
CODE: {
|
|
82
82
|
label: "Моноширинный код",
|
|
83
83
|
node: "code",
|
|
84
84
|
style: "CODE",
|
|
85
|
-
icon: /* @__PURE__ */
|
|
85
|
+
icon: /* @__PURE__ */ e(n, {})
|
|
86
86
|
},
|
|
87
87
|
BOLD: {
|
|
88
88
|
label: "Выделение жирным",
|
|
89
89
|
node: "strong",
|
|
90
90
|
style: "BOLD",
|
|
91
|
-
icon: /* @__PURE__ */
|
|
91
|
+
icon: /* @__PURE__ */ e(t, {})
|
|
92
92
|
},
|
|
93
93
|
UNDERLINE: {
|
|
94
94
|
label: "Выделение подчеркнутым",
|
|
95
95
|
node: "u",
|
|
96
96
|
style: "UNDERLINE",
|
|
97
|
-
icon: /* @__PURE__ */ _
|
|
97
|
+
icon: /* @__PURE__ */ e(_, {})
|
|
98
98
|
},
|
|
99
99
|
STRIKETHROUGH: {
|
|
100
100
|
label: "Выделение зачеркнутым",
|
|
101
101
|
node: "s",
|
|
102
102
|
style: "STRIKETHROUGH",
|
|
103
|
-
icon: /* @__PURE__ */
|
|
103
|
+
icon: /* @__PURE__ */ e(m, {})
|
|
104
104
|
},
|
|
105
105
|
HIGHLIGHT: {
|
|
106
106
|
label: "Подсветка цветом",
|
|
107
107
|
node: "span",
|
|
108
108
|
style: "HIGHLIGHT",
|
|
109
|
-
icon: /* @__PURE__ */
|
|
109
|
+
icon: /* @__PURE__ */ e(l, {})
|
|
110
110
|
},
|
|
111
111
|
ITALIC: {
|
|
112
112
|
label: "Выделение курсивным",
|
|
113
113
|
node: "i",
|
|
114
114
|
style: "ITALIC",
|
|
115
|
-
icon: /* @__PURE__ */
|
|
115
|
+
icon: /* @__PURE__ */ e(u, {})
|
|
116
116
|
}
|
|
117
117
|
}, b = [
|
|
118
118
|
y.unstyled,
|
|
@@ -138,4 +138,4 @@ var v = (e) => {
|
|
|
138
138
|
//#endregion
|
|
139
139
|
export { v as a, x as i, C as n, b as r, S as t };
|
|
140
140
|
|
|
141
|
-
//# sourceMappingURL=types-
|
|
141
|
+
//# sourceMappingURL=types-D9Wj9wrg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-D9Wj9wrg.js","names":[],"sources":["../../src/text-editor/editorModel.ts","../../src/text-editor/toolbar/types.tsx"],"sourcesContent":["import { ComponentType } from \"react\";\n\nexport type TextEditorLexicalRaw = {\n\tformat: \"lexical\";\n\tversion: 1;\n\teditorState: Record<string, unknown>;\n};\n\nexport type TextEditorData<TRaw = unknown> = {\n\thtml: string;\n\traw: TRaw;\n};\n\nexport interface TextEditorToolbarComponents {\n\tblocks?: boolean;\n\tlinks?: boolean;\n\thistory?: boolean;\n\talignment?: boolean;\n\tinline?: boolean;\n\ttags?: boolean;\n}\n\nexport interface LocalLinkDialogAdapterProps {\n\tisOpen: boolean;\n\tonClose: () => void;\n\tonConfirm: (url: string, ariaLabel: string) => void;\n}\n\nexport interface TextEditorBusinessAdapters {\n\tLocalLinkDialogComponent?: ComponentType<LocalLinkDialogAdapterProps>;\n}\n\nexport interface TextEditorCoreProps<TRaw = unknown> {\n\tinitialData: TextEditorData<TRaw>;\n\tonChange: (data: TextEditorData<TextEditorLexicalRaw>) => void;\n\ttoolbarComponents?: TextEditorToolbarComponents;\n\tbusinessAdapters?: TextEditorBusinessAdapters;\n}\n\nexport const isLexicalTextRaw = (raw: unknown): raw is TextEditorLexicalRaw => {\n\tif (!raw || typeof raw !== \"object\") return false;\n\n\tconst value = raw as Partial<TextEditorLexicalRaw>;\n\treturn value.format === \"lexical\" && value.version === 1 && !!value.editorState && typeof value.editorState === \"object\";\n};\n","import { JSX } from \"react\";\n\nimport {\n\tBold,\n\tCode,\n\tHeading1,\n\tHeading2,\n\tHeading3,\n\tHeading4,\n\tHeading5,\n\tHeading6,\n\tHighlighter,\n\tItalic,\n\tList,\n\tListOrdered,\n\tPilcrow,\n\tStrikethrough,\n\tTextQuote,\n\tType,\n\tUnderline\n} from \"lucide-react\";\n\nimport type { TextEditorElementTypes } from \"../types\";\n\ninterface TextEditorElement {\n\tlabel: string;\n\tstyle: TextEditorElementTypes;\n\tnode: string;\n\ticon: JSX.Element;\n}\n\nconst TextEditorElements: Record<TextEditorElementTypes, TextEditorElement> = {\n\tunstyled: { label: \"Параграф\", node: \"p\", style: \"unstyled\", icon: <Type /> },\n\tparagraph: { label: \"Параграф\", node: \"p\", style: \"paragraph\", icon: <Pilcrow /> },\n\t\"header-one\": { label: \"Заголовок первого уровня\", node: \"h1\", style: \"header-one\", icon: <Heading1 /> },\n\t\"header-two\": { label: \"Заголовок второго уровня\", node: \"h2\", style: \"header-two\", icon: <Heading2 /> },\n\t\"header-three\": { label: \"Заголовок третьего уровня\", node: \"h3\", style: \"header-three\", icon: <Heading3 /> },\n\t\"header-four\": { label: \"Заголовок четвертого уровня\", node: \"h4\", style: \"header-four\", icon: <Heading4 /> },\n\t\"header-five\": { label: \"Заголовок пятого уровня\", node: \"h5\", style: \"header-five\", icon: <Heading5 /> },\n\t\"header-six\": { label: \"Заголовок шестого уровня\", node: \"h6\", style: \"header-six\", icon: <Heading6 /> },\n\t\"code-block\": { label: \"Блок кода\", node: \"pre\", style: \"code-block\", icon: <Code /> },\n\tblockquote: { label: \"Цитата\", node: \"blockquote\", style: \"blockquote\", icon: <TextQuote /> },\n\t\"unordered-list-item\": { label: \"Маркированный список\", node: \"ul\", style: \"unordered-list-item\", icon: <List /> },\n\t\"ordered-list-item\": { label: \"Нумерованный список\", node: \"ol\", style: \"ordered-list-item\", icon: <ListOrdered /> },\n\tCODE: { label: \"Моноширинный код\", node: \"code\", style: \"CODE\", icon: <Code /> },\n\tBOLD: { label: \"Выделение жирным\", node: \"strong\", style: \"BOLD\", icon: <Bold /> },\n\tUNDERLINE: { label: \"Выделение подчеркнутым\", node: \"u\", style: \"UNDERLINE\", icon: <Underline /> },\n\tSTRIKETHROUGH: { label: \"Выделение зачеркнутым\", node: \"s\", style: \"STRIKETHROUGH\", icon: <Strikethrough /> },\n\tHIGHLIGHT: { label: \"Подсветка цветом\", node: \"span\", style: \"HIGHLIGHT\", icon: <Highlighter /> },\n\tITALIC: { label: \"Выделение курсивным\", node: \"i\", style: \"ITALIC\", icon: <Italic /> }\n};\n\nexport const getElementFromElementStyle = (style: TextEditorElementTypes) => {\n\tconst element = TextEditorElements[style];\n\tif (!element) {\n\t\treturn \"div\";\n\t}\n\treturn element.node;\n};\n\nexport const getTagFromElementStyle = (style: TextEditorElementTypes) => {\n\tconst element = TextEditorElements[style];\n\tif (!element) {\n\t\treturn null;\n\t}\n\treturn element.node;\n};\n\nexport const TextEditorBlockControls = [\n\tTextEditorElements.unstyled,\n\tTextEditorElements[\"header-three\"],\n\tTextEditorElements[\"header-four\"],\n\tTextEditorElements[\"header-five\"],\n\tTextEditorElements[\"header-six\"],\n\tTextEditorElements[\"ordered-list-item\"],\n\tTextEditorElements[\"unordered-list-item\"],\n\tTextEditorElements.blockquote\n];\n\nexport const TextEditorInlineControls = [\n\tTextEditorElements.BOLD,\n\tTextEditorElements.ITALIC,\n\tTextEditorElements.UNDERLINE,\n\tTextEditorElements.STRIKETHROUGH,\n\tTextEditorElements.HIGHLIGHT,\n\tTextEditorElements.CODE\n];\n\nexport const TextEditorStyleClasses = {\n\tCODE: {\n\t\tcolor: \"rgb(8, 89, 114)\",\n\t\tpadding: \"0.15em 0.4em\",\n\t\tmargin: \"0\",\n\t\tfontFamily: \"monospace\",\n\t\tfontSize: \"85%\",\n\t\tbackgroundColor: \"rgba(40, 68, 77, 0.05)\",\n\t\tborderRadius: \"var(--radius-md)\",\n\t\tlineHeight: \"1\"\n\t},\n\tHIGHLIGHT: {\n\t\tpaddingInline: \"0.15em\",\n\t\tbackgroundColor: \"rgb(234,255,142)\",\n\t\tborderRadius: \"var(--radius-md)\"\n\t},\n\tunstyled: {\n\t\tmarginBottom: \"1.5em\"\n\t},\n\tBOLD: { fontWeight: \"bold\" },\n\tITALIC: { fontStyle: \"italic\" },\n\tUNDERLINE: { textDecoration: \"underline\" },\n\tSTRIKETHROUGH: { textDecoration: \"line-through\" }\n};\n\nexport enum LinkTypes {\n\tLINK = \"link\",\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tLOCAL_LINK = \"localLink\",\n\tPHONE = \"phone\",\n\tEMAIL = \"email\"\n}\n\nexport enum TagTypes {\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tabbr = \"abbr\",\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tlang = \"lang\",\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\ttime = \"time\",\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tcite = \"cite\",\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tins = \"ins\",\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tdel = \"del\"\n}\n"],"mappings":";;;AAuCA,IAAa,KAAoB,MAA8C;CAC9E,IAAI,CAAC,KAAO,OAAO,KAAQ,UAAU,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} from "../text/index.js";
|
|
3
3
|
import { useEffect as n, useMemo as r, useState as i } from "react";
|
|
4
4
|
import { useODataCollection as a } from "@ryuzaki13/react-foundation-api/odata";
|
|
5
5
|
import { cn as o } from "@ryuzaki13/react-foundation-lib/utils";
|
|
@@ -8,16 +8,16 @@ import { startsWithIgnoringZeros as l } from "@ryuzaki13/react-foundation-lib/fo
|
|
|
8
8
|
//#region src/select/SelectOptionContent.tsx
|
|
9
9
|
function u({ label: n, code: r, highlight: i, labelClassName: a, codeClassName: l }) {
|
|
10
10
|
return /* @__PURE__ */ c("div", {
|
|
11
|
-
className:
|
|
11
|
+
className: e.uiOptionBase,
|
|
12
12
|
children: [/* @__PURE__ */ s("div", {
|
|
13
|
-
className: o(
|
|
14
|
-
children: /* @__PURE__ */ s(
|
|
13
|
+
className: o(e.uiOptionText, "flexEllipsis", a),
|
|
14
|
+
children: /* @__PURE__ */ s(t, {
|
|
15
15
|
text: n,
|
|
16
16
|
highlight: i
|
|
17
17
|
})
|
|
18
18
|
}), r && /* @__PURE__ */ s("div", {
|
|
19
|
-
className: o(
|
|
20
|
-
children: /* @__PURE__ */ s(
|
|
19
|
+
className: o(e.uiOptionCode, l),
|
|
20
|
+
children: /* @__PURE__ */ s(t, {
|
|
21
21
|
text: r,
|
|
22
22
|
highlight: i
|
|
23
23
|
})
|
|
@@ -138,4 +138,4 @@ function _(e, t) {
|
|
|
138
138
|
//#endregion
|
|
139
139
|
export { g as n, u as r, _ as t };
|
|
140
140
|
|
|
141
|
-
//# sourceMappingURL=useODataSelectBase-
|
|
141
|
+
//# sourceMappingURL=useODataSelectBase-Bq36Wp1U.js.map
|
package/dist/chunks/{useODataSelectBase-BhCMCzv_.js.map → useODataSelectBase-Bq36Wp1U.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useODataSelectBase-BhCMCzv_.js","names":[],"sources":["../../src/select/SelectOptionContent.tsx","../../src/select/model/useODataSelectBase.ts"],"sourcesContent":["import { cn } from \"@ryuzaki13/react-foundation-lib/utils\";\n\nimport { HighlightText } from \"../text\";\nimport uiStyles from \"../ui.module.scss\";\n\ninterface OptionContentProps {\n\tlabel: string;\n\tcode?: string;\n\thighlight?: string;\n\t/** Приватный визуальный modifier label для специализированного владельца option. */\n\tlabelClassName?: string;\n\t/** Отдельный modifier code, потому что code задаёт собственный variable-font weight. */\n\tcodeClassName?: string;\n}\n\n/**\n * Универсальный рендерер опции. Используется и в single-select, и в multi-select.\n */\nexport function SelectOptionContent({ label, code, highlight, labelClassName, codeClassName }: OptionContentProps) {\n\treturn (\n\t\t<div className={uiStyles.uiOptionBase}>\n\t\t\t<div className={cn(uiStyles.uiOptionText, \"flexEllipsis\", labelClassName)}>\n\t\t\t\t<HighlightText text={label} highlight={highlight} />\n\t\t\t</div>\n\t\t\t{code && (\n\t\t\t\t<div className={cn(uiStyles.uiOptionCode, codeClassName)}>\n\t\t\t\t\t<HighlightText text={code} highlight={highlight} />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n","import { useEffect, useMemo, useState } from \"react\";\n\nimport { ODataCollectionModel, ODataSelectBaseProps, useODataCollection } from \"@ryuzaki13/react-foundation-api/odata\";\nimport { startsWithIgnoringZeros } from \"@ryuzaki13/react-foundation-lib/formatters\";\nimport { CollectionItem } from \"@ryuzaki13/react-foundation-lib/odata\";\n\ninterface UseODataSelectBaseOptions extends Omit<ODataSelectBaseProps, \"model\" | \"value\"> {\n\tmodel: Required<ODataCollectionModel>;\n\tvalue?: string[];\n}\n\nconst DEPENDENCY_KEY_SEPARATOR = \"\\u0002\";\nconst DEPENDENCY_VALUE_SEPARATOR = \"\\u0001\";\n\nfunction normalizeDependencyValues(values?: readonly string[]) {\n\tif (!values?.length) return [];\n\treturn [...new Set(values)].sort();\n}\n\nfunction createDependencySignature(codeKey: string, availableKeys: Record<string, unknown>, dependencies?: Record<string, string[]>) {\n\tconst parts: string[] = [];\n\n\tfor (const key of Object.keys(availableKeys).sort()) {\n\t\tif (key === codeKey) continue;\n\n\t\tconst values = normalizeDependencyValues(dependencies?.[key]);\n\t\tif (!values.length) continue;\n\n\t\tparts.push(`${key}:${values.join(DEPENDENCY_VALUE_SEPARATOR)}`);\n\t}\n\n\treturn parts.join(DEPENDENCY_KEY_SEPARATOR);\n}\n\nfunction parseDependencySignature(signature: string) {\n\tconst dependencies = new Map<string, string[]>();\n\tif (!signature) return dependencies;\n\n\tfor (const part of signature.split(DEPENDENCY_KEY_SEPARATOR)) {\n\t\tconst separatorIndex = part.indexOf(\":\");\n\t\tif (separatorIndex < 0) continue;\n\n\t\tconst key = part.slice(0, separatorIndex);\n\t\tconst values = part\n\t\t\t.slice(separatorIndex + 1)\n\t\t\t.split(DEPENDENCY_VALUE_SEPARATOR)\n\t\t\t.filter(Boolean);\n\t\tif (key && values.length) {\n\t\t\tdependencies.set(key, values);\n\t\t}\n\t}\n\n\treturn dependencies;\n}\n\nexport function useODataSelectBase({ odata, segment, model, value, dependencies }: UseODataSelectBaseOptions) {\n\tconst [query, setQuery] = useState(\"\");\n\tconst [debouncedQuery, setDebouncedQuery] = useState(\"\");\n\n\tconst { codeKey, searchDebounceDelay, minSearchCodeLength, minSearchTextLength: minSearchLength } = model;\n\n\tconst {\n\t\tdata: rawData,\n\t\ttextKey,\n\t\tisLoading,\n\t\tisError,\n\t\tgetItems,\n\t\tseparatedItems,\n\t\tfindSourceItemsByKeys,\n\t\tsetFilteredItems,\n\t\tdebounce\n\t} = useODataCollection({ odata, model });\n\n\tconst itemsCount = separatedItems.length;\n\tconst selectionKey = segment.selectText && textKey ? textKey : codeKey;\n\n\tconst dependencySignature = useMemo(() => {\n\t\tif (!rawData) return \"\";\n\t\treturn createDependencySignature(codeKey, rawData.keyPairsMap, dependencies);\n\t}, [rawData, codeKey, dependencies]);\n\n\tuseEffect(() => {\n\t\tif (!rawData) return;\n\n\t\tconst selfIndex = rawData.chain.findIndex((c) => c.codeKey === codeKey);\n\t\tconst currentDependencies = parseDependencySignature(dependencySignature);\n\n\t\tconst resolveFilteredItems = (index: number) => {\n\t\t\tconst key = rawData.chain[index].codeKey;\n\t\t\tconst dependenciesValues = currentDependencies.get(key);\n\t\t\tif (dependenciesValues?.length) {\n\t\t\t\treturn findSourceItemsByKeys(key, dependenciesValues);\n\t\t\t}\n\t\t};\n\n\t\tfor (let i = rawData.chain.length - 1; i > selfIndex; i--) {\n\t\t\tconst filteredItems = resolveFilteredItems(i);\n\t\t\tif (filteredItems) {\n\t\t\t\tsetFilteredItems(filteredItems);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < selfIndex; i++) {\n\t\t\tconst filteredItems = resolveFilteredItems(i);\n\t\t\tif (filteredItems) {\n\t\t\t\tsetFilteredItems(filteredItems);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tsetFilteredItems(undefined);\n\t}, [rawData, dependencySignature, codeKey, findSourceItemsByKeys, setFilteredItems]);\n\n\tuseEffect(() => {\n\t\tdebounce(\n\t\t\t\"search\",\n\t\t\t() => {\n\t\t\t\tsetDebouncedQuery(query.trim().toLowerCase());\n\t\t\t},\n\t\t\tsearchDebounceDelay\n\t\t);\n\t}, [debounce, query, searchDebounceDelay]);\n\n\tconst selectedItems = useMemo(() => {\n\t\tif (!value?.length || !selectionKey) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst selectedValues = new Set(value);\n\t\treturn separatedItems.filter((item) => selectedValues.has(item[selectionKey]));\n\t}, [separatedItems, selectionKey, value]);\n\n\tconst filteredItems = useMemo(() => {\n\t\tif (!rawData) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst isFiltered = debouncedQuery.length >= minSearchLength;\n\n\t\tif (!isFiltered) {\n\t\t\treturn getItems(undefined, selectedItems);\n\t\t}\n\n\t\tconst isAheadText = debouncedQuery.length >= minSearchLength;\n\t\tconst isAheadCode = !segment.hideCode && debouncedQuery.length >= minSearchCodeLength && !Number.isNaN(Number(debouncedQuery));\n\n\t\treturn getItems((codeValue: string, textValue: string) => {\n\t\t\tif (codeValue && textValue) {\n\t\t\t\tif (isAheadCode && startsWithIgnoringZeros(codeValue, debouncedQuery)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tif (isAheadText && textValue.toLowerCase().includes(debouncedQuery)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}, selectedItems);\n\t}, [debouncedQuery, getItems, minSearchCodeLength, minSearchLength, rawData, segment.hideCode, selectedItems]);\n\n\t// const placeholder = useMemo(() => {\n\t// \tconst filteredItemsLength = filteredItems.length;\n\n\t// \tif (!itemsCount) {\n\t// \t\treturn `${segment.placeholder} <пусто>`;\n\t// \t}\n\n\t// \tif (filteredItemsLength < itemsCount) {\n\t// \t\treturn `${segment.placeholder} <${filteredItemsLength}+>`;\n\t// \t}\n\n\t// \treturn `${segment.placeholder} <${itemsCount > model.maxVisibleItems ? `${model.maxVisibleItems}+` : itemsCount}>`;\n\t// }, [filteredItems.length, itemsCount, model.maxVisibleItems, segment.placeholder]);\n\n\treturn {\n\t\tquery,\n\t\tsetQuery,\n\t\tdebouncedQuery,\n\t\tselectedItems,\n\t\tfilteredItems,\n\t\titemsCount,\n\t\tisLoading,\n\t\tisError,\n\t\tcodeKey,\n\t\ttextKey,\n\t\tselectionKey,\n\t\tplaceholder: segment.placeholder\n\t};\n}\n\nexport type ODataSelectBaseModel = ReturnType<typeof useODataSelectBase>;\n\nexport function mapSelectedItemsToValues(items: CollectionItem[], selectionKey: string) {\n\treturn items.map((item) => item[selectionKey]);\n}\n"],"mappings":";;;;;;;;AAkBA,SAAgB,EAAoB,EAAE,UAAO,SAAM,cAAW,mBAAgB,oBAAqC;CAClH,OACC,kBAAC,OAAD;EAAK,WAAW,EAAS;EAAzB,UAAA,CACC,kBAAC,OAAD;GAAK,WAAW,EAAG,EAAS,cAAc,gBAAgB,CAAc;GACvE,UAAA,kBAAC,GAAD;IAAe,MAAM;IAAkB;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EAAe,IAAI,EAAK,EAAa,CAAC;CAC9E,GAAG;EAAC;EAAgB;EAAc;CAAK,CAAC;CA6CxC,OAAO;EACN;EACA;EACA;EACA;EACA,eAhDqB,QAAc;GACnC,IAAI,CAAC,GACJ,OAAO,CAAC;GAKT,IAAI,EAFe,EAAe,UAAU,IAG3C,OAAO,EAAS,KAAA,GAAW,CAAa;GAGzC,IAAM,IAAc,EAAe,UAAU,GACvC,IAAc,CAAC,EAAQ,YAAY,EAAe,UAAU,KAAuB,CAAC,OAAO,MAAM,OAAO,CAAc,CAAC;GAE7H,OAAO,GAAU,GAAmB,MACnC,GAAI,KAAa,MACZ,KAAe,EAAwB,GAAW,CAAc,KAIhE,KAAe,EAAU,YAAY,CAAC,CAAC,SAAS,CAAc,KAMjE,CAAa;EACjB,GAAG;GAAC;GAAgB;GAAU;GAAqB;GAAiB;GAAS,EAAQ;GAAU;EAAa,CAqB3G;EACA;EACA;EACA;EACA;EACA;EACA;EACA,aAAa,EAAQ;CACtB;AACD;AAIA,SAAgB,EAAyB,GAAyB,GAAsB;CACvF,OAAO,EAAM,KAAK,MAAS,EAAK,EAAa;AAC9C"}
|
|
1
|
+
{"version":3,"file":"useODataSelectBase-Bq36Wp1U.js","names":[],"sources":["../../src/select/SelectOptionContent.tsx","../../src/select/model/useODataSelectBase.ts"],"sourcesContent":["import { cn } from \"@ryuzaki13/react-foundation-lib/utils\";\n\nimport { HighlightText } from \"../text\";\nimport uiStyles from \"../ui.module.scss\";\n\ninterface OptionContentProps {\n\tlabel: string;\n\tcode?: string;\n\thighlight?: string;\n\t/** Приватный визуальный modifier label для специализированного владельца option. */\n\tlabelClassName?: string;\n\t/** Отдельный modifier code, потому что code задаёт собственный variable-font weight. */\n\tcodeClassName?: string;\n}\n\n/**\n * Универсальный рендерер опции. Используется и в single-select, и в multi-select.\n */\nexport function SelectOptionContent({ label, code, highlight, labelClassName, codeClassName }: OptionContentProps) {\n\treturn (\n\t\t<div className={uiStyles.uiOptionBase}>\n\t\t\t<div className={cn(uiStyles.uiOptionText, \"flexEllipsis\", labelClassName)}>\n\t\t\t\t<HighlightText text={label} highlight={highlight} />\n\t\t\t</div>\n\t\t\t{code && (\n\t\t\t\t<div className={cn(uiStyles.uiOptionCode, codeClassName)}>\n\t\t\t\t\t<HighlightText text={code} highlight={highlight} />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n","import { useEffect, useMemo, useState } from \"react\";\n\nimport { ODataCollectionModel, ODataSelectBaseProps, useODataCollection } from \"@ryuzaki13/react-foundation-api/odata\";\nimport { startsWithIgnoringZeros } from \"@ryuzaki13/react-foundation-lib/formatters\";\nimport { CollectionItem } from \"@ryuzaki13/react-foundation-lib/odata\";\n\ninterface UseODataSelectBaseOptions extends Omit<ODataSelectBaseProps, \"model\" | \"value\"> {\n\tmodel: Required<ODataCollectionModel>;\n\tvalue?: string[];\n}\n\nconst DEPENDENCY_KEY_SEPARATOR = \"\\u0002\";\nconst DEPENDENCY_VALUE_SEPARATOR = \"\\u0001\";\n\nfunction normalizeDependencyValues(values?: readonly string[]) {\n\tif (!values?.length) return [];\n\treturn [...new Set(values)].sort();\n}\n\nfunction createDependencySignature(codeKey: string, availableKeys: Record<string, unknown>, dependencies?: Record<string, string[]>) {\n\tconst parts: string[] = [];\n\n\tfor (const key of Object.keys(availableKeys).sort()) {\n\t\tif (key === codeKey) continue;\n\n\t\tconst values = normalizeDependencyValues(dependencies?.[key]);\n\t\tif (!values.length) continue;\n\n\t\tparts.push(`${key}:${values.join(DEPENDENCY_VALUE_SEPARATOR)}`);\n\t}\n\n\treturn parts.join(DEPENDENCY_KEY_SEPARATOR);\n}\n\nfunction parseDependencySignature(signature: string) {\n\tconst dependencies = new Map<string, string[]>();\n\tif (!signature) return dependencies;\n\n\tfor (const part of signature.split(DEPENDENCY_KEY_SEPARATOR)) {\n\t\tconst separatorIndex = part.indexOf(\":\");\n\t\tif (separatorIndex < 0) continue;\n\n\t\tconst key = part.slice(0, separatorIndex);\n\t\tconst values = part\n\t\t\t.slice(separatorIndex + 1)\n\t\t\t.split(DEPENDENCY_VALUE_SEPARATOR)\n\t\t\t.filter(Boolean);\n\t\tif (key && values.length) {\n\t\t\tdependencies.set(key, values);\n\t\t}\n\t}\n\n\treturn dependencies;\n}\n\nexport function useODataSelectBase({ odata, segment, model, value, dependencies }: UseODataSelectBaseOptions) {\n\tconst [query, setQuery] = useState(\"\");\n\tconst [debouncedQuery, setDebouncedQuery] = useState(\"\");\n\n\tconst { codeKey, searchDebounceDelay, minSearchCodeLength, minSearchTextLength: minSearchLength } = model;\n\n\tconst {\n\t\tdata: rawData,\n\t\ttextKey,\n\t\tisLoading,\n\t\tisError,\n\t\tgetItems,\n\t\tseparatedItems,\n\t\tfindSourceItemsByKeys,\n\t\tsetFilteredItems,\n\t\tdebounce\n\t} = useODataCollection({ odata, model });\n\n\tconst itemsCount = separatedItems.length;\n\tconst selectionKey = segment.selectText && textKey ? textKey : codeKey;\n\n\tconst dependencySignature = useMemo(() => {\n\t\tif (!rawData) return \"\";\n\t\treturn createDependencySignature(codeKey, rawData.keyPairsMap, dependencies);\n\t}, [rawData, codeKey, dependencies]);\n\n\tuseEffect(() => {\n\t\tif (!rawData) return;\n\n\t\tconst selfIndex = rawData.chain.findIndex((c) => c.codeKey === codeKey);\n\t\tconst currentDependencies = parseDependencySignature(dependencySignature);\n\n\t\tconst resolveFilteredItems = (index: number) => {\n\t\t\tconst key = rawData.chain[index].codeKey;\n\t\t\tconst dependenciesValues = currentDependencies.get(key);\n\t\t\tif (dependenciesValues?.length) {\n\t\t\t\treturn findSourceItemsByKeys(key, dependenciesValues);\n\t\t\t}\n\t\t};\n\n\t\tfor (let i = rawData.chain.length - 1; i > selfIndex; i--) {\n\t\t\tconst filteredItems = resolveFilteredItems(i);\n\t\t\tif (filteredItems) {\n\t\t\t\tsetFilteredItems(filteredItems);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < selfIndex; i++) {\n\t\t\tconst filteredItems = resolveFilteredItems(i);\n\t\t\tif (filteredItems) {\n\t\t\t\tsetFilteredItems(filteredItems);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tsetFilteredItems(undefined);\n\t}, [rawData, dependencySignature, codeKey, findSourceItemsByKeys, setFilteredItems]);\n\n\tuseEffect(() => {\n\t\tdebounce(\n\t\t\t\"search\",\n\t\t\t() => {\n\t\t\t\tsetDebouncedQuery(query.trim().toLowerCase());\n\t\t\t},\n\t\t\tsearchDebounceDelay\n\t\t);\n\t}, [debounce, query, searchDebounceDelay]);\n\n\tconst selectedItems = useMemo(() => {\n\t\tif (!value?.length || !selectionKey) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst selectedValues = new Set(value);\n\t\treturn separatedItems.filter((item) => selectedValues.has(item[selectionKey]));\n\t}, [separatedItems, selectionKey, value]);\n\n\tconst filteredItems = useMemo(() => {\n\t\tif (!rawData) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst isFiltered = debouncedQuery.length >= minSearchLength;\n\n\t\tif (!isFiltered) {\n\t\t\treturn getItems(undefined, selectedItems);\n\t\t}\n\n\t\tconst isAheadText = debouncedQuery.length >= minSearchLength;\n\t\tconst isAheadCode = !segment.hideCode && debouncedQuery.length >= minSearchCodeLength && !Number.isNaN(Number(debouncedQuery));\n\n\t\treturn getItems((codeValue: string, textValue: string) => {\n\t\t\tif (codeValue && textValue) {\n\t\t\t\tif (isAheadCode && startsWithIgnoringZeros(codeValue, debouncedQuery)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tif (isAheadText && textValue.toLowerCase().includes(debouncedQuery)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}, selectedItems);\n\t}, [debouncedQuery, getItems, minSearchCodeLength, minSearchLength, rawData, segment.hideCode, selectedItems]);\n\n\t// const placeholder = useMemo(() => {\n\t// \tconst filteredItemsLength = filteredItems.length;\n\n\t// \tif (!itemsCount) {\n\t// \t\treturn `${segment.placeholder} <пусто>`;\n\t// \t}\n\n\t// \tif (filteredItemsLength < itemsCount) {\n\t// \t\treturn `${segment.placeholder} <${filteredItemsLength}+>`;\n\t// \t}\n\n\t// \treturn `${segment.placeholder} <${itemsCount > model.maxVisibleItems ? `${model.maxVisibleItems}+` : itemsCount}>`;\n\t// }, [filteredItems.length, itemsCount, model.maxVisibleItems, segment.placeholder]);\n\n\treturn {\n\t\tquery,\n\t\tsetQuery,\n\t\tdebouncedQuery,\n\t\tselectedItems,\n\t\tfilteredItems,\n\t\titemsCount,\n\t\tisLoading,\n\t\tisError,\n\t\tcodeKey,\n\t\ttextKey,\n\t\tselectionKey,\n\t\tplaceholder: segment.placeholder\n\t};\n}\n\nexport type ODataSelectBaseModel = ReturnType<typeof useODataSelectBase>;\n\nexport function mapSelectedItemsToValues(items: CollectionItem[], selectionKey: string) {\n\treturn items.map((item) => item[selectionKey]);\n}\n"],"mappings":";;;;;;;;AAkBA,SAAgB,EAAoB,EAAE,UAAO,SAAM,cAAW,mBAAgB,oBAAqC;CAClH,OACC,kBAAC,OAAD;EAAK,WAAW,EAAS;EAAzB,UAAA,CACC,kBAAC,OAAD;GAAK,WAAW,EAAG,EAAS,cAAc,gBAAgB,CAAc;GACvE,UAAA,kBAAC,GAAD;IAAe,MAAM;IAAkB;GAAY,CAAA;EAC/C,CAAA,GACJ,KACA,kBAAC,OAAD;GAAK,WAAW,EAAG,EAAS,cAAc,CAAa;GACtD,UAAA,kBAAC,GAAD;IAAe,MAAM;IAAiB;GAAY,CAAA;EAC9C,CAAA,CAEF;;AAEP;;;ACpBA,IAAM,IAA2B,KAC3B,IAA6B;AAEnC,SAAS,EAA0B,GAA4B;CAE9D,OADK,GAAQ,SACN,CAAC,GAAG,IAAI,IAAI,CAAM,CAAC,CAAC,CAAC,KAAK,IADL,CAAC;AAE9B;AAEA,SAAS,EAA0B,GAAiB,GAAwC,GAAyC;CACpI,IAAM,IAAkB,CAAC;C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,KAAe,EAAwB,GAAW,CAAc,KAIhE,KAAe,EAAU,YAAY,CAAC,CAAC,SAAS,CAAc,KAMjE,CAAa;EACjB,GAAG;GAAC;GAAgB;GAAU;GAAqB;GAAiB;GAAS,EAAQ;GAAU;EAAa,CAqB3G;EACA;EACA;EACA;EACA;EACA;EACA;EACA,aAAa,EAAQ;CACtB;AACD;AAIA,SAAgB,EAAyB,GAAyB,GAAsB;CACvF,OAAO,EAAM,KAAK,MAAS,EAAK,EAAa;AAC9C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../chunks/context-menu-
|
|
1
|
+
import { n as e, t } from "../chunks/context-menu-6nJkPmKV.js";
|
|
2
2
|
export { e as ContextMenu, t as DropdownMenu };
|
package/dist/date-input/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "../chunks/CalendarView-
|
|
2
|
-
import { a as c, c as l, d as u, f as d, h as f, i as p, l as m, m as h, n as g, o as _, p as v, r as y, s as b, t as x, u as S } from "../chunks/date-input-
|
|
1
|
+
import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "../chunks/CalendarView-DqA-PbAU.js";
|
|
2
|
+
import { a as c, c as l, d as u, f as d, h as f, i as p, l as m, m as h, n as g, o as _, p as v, r as y, s as b, t as x, u as S } from "../chunks/date-input-9T8AoG5U.js";
|
|
3
3
|
export { s as CalendarView, r as DATE_INPUT_SELECTION_MODES, a as DATE_INPUT_WEEK_END_DAYS, n as DATE_PICKER_LEVELS, y as DEFAULT_DATE_INPUT_FORMAT, p as DEFAULT_DATE_INPUT_PRESET, x as RangeDateInput, g as SingleDateInput, c as areRangeDateValuesEqual, _ as areSingleDateValuesEqual, b as formatDateInputValue, l as formatRangeDateValue, m as formatSingleDateValue, e as getDatePickerLevelForSelectionMode, i as isDatePickerLevelAvailable, S as normalizeRangeDateValue, u as normalizeRangeEndDateValue, d as normalizeSingleDateValue, v as parseRangeDateValue, h as parseRangeEndDateValue, f as parseSingleDateValue, o as resolveAvailableDatePickerLevel, t as resolveDateInputPeriodRangeState };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { r as e } from "../chunks/popover-
|
|
1
|
+
import { r as e } from "../chunks/popover-IExDrsF6.js";
|
|
2
2
|
import { t } from "../chunks/ui.module-DHVTOqZ0.js";
|
|
3
|
-
import { i as n, l as r, s as i } from "../chunks/input-
|
|
4
|
-
import { t as a } from "../chunks/CalendarView-
|
|
3
|
+
import { i as n, l as r, s as i } from "../chunks/input-VC8jEoTa.js";
|
|
4
|
+
import { t as a } from "../chunks/CalendarView-DqA-PbAU.js";
|
|
5
5
|
import { t as o } from "../chunks/wheel-picker-FS58cRsQ.js";
|
|
6
6
|
import { useCallback as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
7
7
|
import { cn as d } from "@ryuzaki13/react-foundation-lib/utils";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
9
|
+
import { CalendarDaysIcon as m, Clock3Icon as h } from "lucide-react";
|
|
10
10
|
import { createCalendarDate as g, getStartOfDay as _, isDateRangeTuple as v, parseDate as y } from "@ryuzaki13/react-foundation-lib/formatters";
|
|
11
11
|
import { areAllDateSegmentsEmpty as b, dateToIndexedSegmentValues as x, indexedSegmentsToDate as S, parseDateSegmentMask as C } from "@ryuzaki13/react-foundation-lib/date-segments";
|
|
12
12
|
//#region src/date-time-input/lib/dateTimeValue.ts
|
|
@@ -272,22 +272,22 @@ var V = {
|
|
|
272
272
|
//#region src/date-time-input/ui/TimePanel.tsx
|
|
273
273
|
function U({ value: e, disabled: t, minDate: n, maxDate: r, mode: i = "date-time", onChange: a }) {
|
|
274
274
|
let s = R(e, n, r, i), c = (e) => String(e).padStart(2, "0");
|
|
275
|
-
return s.disabled ? /* @__PURE__ */
|
|
275
|
+
return s.disabled ? /* @__PURE__ */ f("div", {
|
|
276
276
|
className: H.timePanel,
|
|
277
|
-
children: /* @__PURE__ */
|
|
277
|
+
children: /* @__PURE__ */ f("p", {
|
|
278
278
|
className: H.hint,
|
|
279
279
|
children: "Для выбранного дня нет доступного времени в заданном диапазоне."
|
|
280
280
|
})
|
|
281
|
-
}) : /* @__PURE__ */
|
|
281
|
+
}) : /* @__PURE__ */ f("div", {
|
|
282
282
|
className: H.timePanel,
|
|
283
|
-
children: /* @__PURE__ */
|
|
283
|
+
children: /* @__PURE__ */ p("div", {
|
|
284
284
|
className: H.fields,
|
|
285
|
-
children: [/* @__PURE__ */
|
|
285
|
+
children: [/* @__PURE__ */ p("label", {
|
|
286
286
|
className: H.field,
|
|
287
|
-
children: [/* @__PURE__ */
|
|
287
|
+
children: [/* @__PURE__ */ f("span", {
|
|
288
288
|
className: H.label,
|
|
289
289
|
children: "Часы"
|
|
290
|
-
}), /* @__PURE__ */
|
|
290
|
+
}), /* @__PURE__ */ f(o, {
|
|
291
291
|
className: H.wheel,
|
|
292
292
|
items: s.hours,
|
|
293
293
|
value: s.selectedHour,
|
|
@@ -296,12 +296,12 @@ function U({ value: e, disabled: t, minDate: n, maxDate: r, mode: i = "date-time
|
|
|
296
296
|
disabled: t,
|
|
297
297
|
formatItem: c
|
|
298
298
|
})]
|
|
299
|
-
}), /* @__PURE__ */
|
|
299
|
+
}), /* @__PURE__ */ p("label", {
|
|
300
300
|
className: H.field,
|
|
301
|
-
children: [/* @__PURE__ */
|
|
301
|
+
children: [/* @__PURE__ */ f("span", {
|
|
302
302
|
className: H.label,
|
|
303
303
|
children: "Минуты"
|
|
304
|
-
}), /* @__PURE__ */
|
|
304
|
+
}), /* @__PURE__ */ f(o, {
|
|
305
305
|
className: H.wheel,
|
|
306
306
|
items: s.minutes,
|
|
307
307
|
value: s.selectedMinute,
|
|
@@ -342,10 +342,10 @@ function W({ value: o, onChange: s, label: l, description: g, placeholder: y, di
|
|
|
342
342
|
}, de = () => {
|
|
343
343
|
(O?.getTime() ?? null) !== (R?.getTime() ?? null) && s(R);
|
|
344
344
|
}, fe = E === "right" ? V.timePanelPaneRight : V.timePanelPaneBottom, pe = D === "time" ? "Открыть выбор времени" : "Открыть календарь даты и времени", me = y ?? (D === "time" ? "чч:мм" : "дд.мм.гггг чч:мм"), $ = R ?? O ?? G;
|
|
345
|
-
return /* @__PURE__ */
|
|
345
|
+
return /* @__PURE__ */ p(e, {
|
|
346
346
|
open: A,
|
|
347
347
|
onOpenChange: ue,
|
|
348
|
-
children: [/* @__PURE__ */
|
|
348
|
+
children: [/* @__PURE__ */ f(i, {
|
|
349
349
|
label: l,
|
|
350
350
|
description: g,
|
|
351
351
|
disabled: b,
|
|
@@ -355,19 +355,19 @@ function W({ value: o, onChange: s, label: l, description: g, placeholder: y, di
|
|
|
355
355
|
labelId: J,
|
|
356
356
|
descriptionId: Y,
|
|
357
357
|
errorId: X,
|
|
358
|
-
children: /* @__PURE__ */
|
|
358
|
+
children: /* @__PURE__ */ f(n, {
|
|
359
359
|
endAdornmentWidth: "var(--control-height)",
|
|
360
|
-
endAdornment: /* @__PURE__ */
|
|
360
|
+
endAdornment: /* @__PURE__ */ f(e.Trigger, { children: /* @__PURE__ */ f("div", {
|
|
361
361
|
className: t.uiToggleButtonContainer,
|
|
362
|
-
children: /* @__PURE__ */
|
|
362
|
+
children: /* @__PURE__ */ f("button", {
|
|
363
363
|
type: "button",
|
|
364
364
|
disabled: b,
|
|
365
365
|
"aria-label": pe,
|
|
366
366
|
className: t.uiToggleButton,
|
|
367
|
-
children:
|
|
367
|
+
children: f(D === "time" ? h : m, {})
|
|
368
368
|
})
|
|
369
369
|
}) }),
|
|
370
|
-
children: ({ controlClassName: e }) => /* @__PURE__ */
|
|
370
|
+
children: ({ controlClassName: e }) => /* @__PURE__ */ f("div", {
|
|
371
371
|
id: q,
|
|
372
372
|
className: d(t.uiInputControlFake, e),
|
|
373
373
|
"data-disabled": b || void 0,
|
|
@@ -382,11 +382,11 @@ function W({ value: o, onChange: s, label: l, description: g, placeholder: y, di
|
|
|
382
382
|
onClick: (e) => {
|
|
383
383
|
e.target === e.currentTarget && ce();
|
|
384
384
|
},
|
|
385
|
-
children: ee.map((e, t) => e.kind === "literal" ? /* @__PURE__ */
|
|
385
|
+
children: ee.map((e, t) => e.kind === "literal" ? /* @__PURE__ */ f("span", {
|
|
386
386
|
className: V.separator,
|
|
387
387
|
"data-disabled": b || void 0,
|
|
388
388
|
children: e.text
|
|
389
|
-
}, t) : /* @__PURE__ */
|
|
389
|
+
}, t) : /* @__PURE__ */ f("input", {
|
|
390
390
|
ref: ne(t),
|
|
391
391
|
type: "text",
|
|
392
392
|
inputMode: "numeric",
|
|
@@ -404,12 +404,12 @@ function W({ value: o, onChange: s, label: l, description: g, placeholder: y, di
|
|
|
404
404
|
}, t))
|
|
405
405
|
})
|
|
406
406
|
})
|
|
407
|
-
}), /* @__PURE__ */
|
|
407
|
+
}), /* @__PURE__ */ f(e.Content, {
|
|
408
408
|
background: "primary",
|
|
409
409
|
onClose: de,
|
|
410
|
-
children: D === "time" ? /* @__PURE__ */
|
|
410
|
+
children: D === "time" ? /* @__PURE__ */ f("div", {
|
|
411
411
|
className: V.timeOnlyPopoverContent,
|
|
412
|
-
children: /* @__PURE__ */
|
|
412
|
+
children: /* @__PURE__ */ f(U, {
|
|
413
413
|
value: $,
|
|
414
414
|
disabled: b,
|
|
415
415
|
minDate: w,
|
|
@@ -417,11 +417,11 @@ function W({ value: o, onChange: s, label: l, description: g, placeholder: y, di
|
|
|
417
417
|
mode: D,
|
|
418
418
|
onChange: Q
|
|
419
419
|
})
|
|
420
|
-
}) : /* @__PURE__ */
|
|
420
|
+
}) : /* @__PURE__ */ p("div", {
|
|
421
421
|
className: d(V.popoverContent, V[E]),
|
|
422
|
-
children: [/* @__PURE__ */
|
|
422
|
+
children: [/* @__PURE__ */ f("div", {
|
|
423
423
|
className: V.calendarPane,
|
|
424
|
-
children: /* @__PURE__ */
|
|
424
|
+
children: /* @__PURE__ */ f(a, {
|
|
425
425
|
view: H,
|
|
426
426
|
datePickerLevel: "day",
|
|
427
427
|
selectionMode: "day",
|
|
@@ -433,9 +433,9 @@ function W({ value: o, onChange: s, label: l, description: g, placeholder: y, di
|
|
|
433
433
|
currentDate: G,
|
|
434
434
|
onCurrentDateChange: K
|
|
435
435
|
})
|
|
436
|
-
}), /* @__PURE__ */
|
|
436
|
+
}), /* @__PURE__ */ f("div", {
|
|
437
437
|
className: d(V.timePanelPane, fe),
|
|
438
|
-
children: /* @__PURE__ */
|
|
438
|
+
children: /* @__PURE__ */ f(U, {
|
|
439
439
|
value: $,
|
|
440
440
|
disabled: b,
|
|
441
441
|
minDate: w,
|
package/dist/dialog/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { useId as e } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { getOrCreatePortalRoot as t, useEscapeDismiss as n, useOverlayFocus as r } from "@ryuzaki13/react-foundation-lib/dom";
|
|
3
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
4
4
|
import { createPortal as o } from "react-dom";
|
|
5
5
|
//#region src/dialog/Dialog.tsx
|
|
6
6
|
function s({ title: s, description: c, open: l, onClose: u, minWidth: d, children: f }) {
|
|
7
|
-
let p = e(), m = e(), h =
|
|
7
|
+
let p = e(), m = e(), h = r({
|
|
8
8
|
active: l,
|
|
9
9
|
trapFocus: !0,
|
|
10
10
|
restoreFocus: !0,
|
|
11
11
|
initialFocus: "auto"
|
|
12
12
|
});
|
|
13
|
-
if (
|
|
13
|
+
if (n({
|
|
14
14
|
active: l,
|
|
15
15
|
onDismiss: u,
|
|
16
16
|
containerRef: h
|
|
17
17
|
}), !l || typeof document > "u") return null;
|
|
18
|
-
let g =
|
|
19
|
-
return g ? o(/* @__PURE__ */
|
|
18
|
+
let g = t("dialog-root");
|
|
19
|
+
return g ? o(/* @__PURE__ */ i("div", {
|
|
20
20
|
className: "fixed inset0 flexCenter surfaceBackdrop",
|
|
21
21
|
style: { zIndex: "var(--z-dialog)" },
|
|
22
22
|
onMouseDown: (e) => e.target === e.currentTarget && u(),
|
|
23
|
-
children: /* @__PURE__ */
|
|
23
|
+
children: /* @__PURE__ */ a("div", {
|
|
24
24
|
ref: h,
|
|
25
25
|
role: "dialog",
|
|
26
26
|
"aria-modal": "true",
|
|
@@ -30,12 +30,12 @@ function s({ title: s, description: c, open: l, onClose: u, minWidth: d, childre
|
|
|
30
30
|
className: "surface0 shadowMd paddingLg radiusSm",
|
|
31
31
|
style: { minWidth: d },
|
|
32
32
|
children: [
|
|
33
|
-
s && /* @__PURE__ */
|
|
33
|
+
s && /* @__PURE__ */ i("h2", {
|
|
34
34
|
id: p,
|
|
35
35
|
className: "margin0",
|
|
36
36
|
children: s
|
|
37
37
|
}),
|
|
38
|
-
c && /* @__PURE__ */
|
|
38
|
+
c && /* @__PURE__ */ i("p", {
|
|
39
39
|
id: m,
|
|
40
40
|
children: c
|
|
41
41
|
}),
|
package/dist/disclosure/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import { n as t } from "../chunks/uiClasses-UkaejTdf.js";
|
|
|
3
3
|
import { t as n } from "../chunks/flex-C7njxZ74.js";
|
|
4
4
|
import { useId as r, useState as i } from "react";
|
|
5
5
|
import { cn as a } from "@ryuzaki13/react-foundation-lib/utils";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
import { ChevronDownIcon as l, ChevronUpIcon as u } from "lucide-react";
|
|
8
8
|
var d = {
|
|
9
9
|
disclosureHeader: "P-rCx1",
|
|
10
10
|
disclosureButton: "_9yjaDf",
|
|
@@ -16,11 +16,11 @@ var d = {
|
|
|
16
16
|
//#region src/disclosure/Disclosure.tsx
|
|
17
17
|
function f({ label: f, defaultOpen: p, headerActions: m, tone: h = "primary", children: g }) {
|
|
18
18
|
let [_, v] = i(p === !0), y = r(), b = r(), x = t(h);
|
|
19
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ c("div", {
|
|
20
20
|
className: a(e.uiElement, e.uiPanel, x, d.disclosure),
|
|
21
|
-
children: [/* @__PURE__ */
|
|
21
|
+
children: [/* @__PURE__ */ c("div", {
|
|
22
22
|
className: d.disclosureHeader,
|
|
23
|
-
children: [/* @__PURE__ */
|
|
23
|
+
children: [/* @__PURE__ */ c("button", {
|
|
24
24
|
id: b,
|
|
25
25
|
type: "button",
|
|
26
26
|
"aria-expanded": _,
|
|
@@ -29,13 +29,13 @@ function f({ label: f, defaultOpen: p, headerActions: m, tone: h = "primary", ch
|
|
|
29
29
|
"data-ui": "disclosure-toggle",
|
|
30
30
|
"data-action": _ ? "collapse-disclosure" : "expand-disclosure",
|
|
31
31
|
onClick: () => v((e) => !e),
|
|
32
|
-
children: [
|
|
33
|
-
}), m ? /* @__PURE__ */
|
|
34
|
-
}), _ && /* @__PURE__ */
|
|
32
|
+
children: [s(_ ? u : l, {}), f]
|
|
33
|
+
}), m ? /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(n, {}), m] }) : null]
|
|
34
|
+
}), _ && /* @__PURE__ */ s("div", {
|
|
35
35
|
id: y,
|
|
36
36
|
role: "region",
|
|
37
37
|
"aria-labelledby": b,
|
|
38
|
-
children: /* @__PURE__ */
|
|
38
|
+
children: /* @__PURE__ */ s("div", {
|
|
39
39
|
className: "paddingMd",
|
|
40
40
|
children: g
|
|
41
41
|
})
|
|
@@ -45,7 +45,7 @@ function f({ label: f, defaultOpen: p, headerActions: m, tone: h = "primary", ch
|
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region src/disclosure/DisclosureGroup.tsx
|
|
47
47
|
function p({ className: e, children: t }) {
|
|
48
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ s("div", {
|
|
49
49
|
className: a(d.disclosureGroup, e),
|
|
50
50
|
children: t
|
|
51
51
|
});
|
package/dist/drop-zone/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as e } from "../chunks/input-files-
|
|
1
|
+
import { n as e } from "../chunks/input-files-CoMjadk7.js";
|
|
2
2
|
import { useCallback as t, useMemo as n, useRef as r, useState as i } from "react";
|
|
3
3
|
import { cn as a, handleKeyboardActivation as o } from "@ryuzaki13/react-foundation-lib/utils";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
5
|
+
import { UploadIcon as u } from "lucide-react";
|
|
6
6
|
import { ReadFileError as d, assertValidAccept as f, assertValidAllowedMime as p, readFile as m } from "@ryuzaki13/react-foundation-lib/file";
|
|
7
7
|
var h = {
|
|
8
8
|
zone: "q2D6Pw",
|
|
@@ -60,8 +60,8 @@ function g({ value: g, onChange: _, onChangeError: v, accept: y, allowedMime: b,
|
|
|
60
60
|
}, [N]), B = t((e) => {
|
|
61
61
|
o(e, P, { disabled: w });
|
|
62
62
|
}, [w, P]);
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
64
|
+
/* @__PURE__ */ c("input", {
|
|
65
65
|
ref: O,
|
|
66
66
|
type: "file",
|
|
67
67
|
hidden: !0,
|
|
@@ -70,7 +70,7 @@ function g({ value: g, onChange: _, onChangeError: v, accept: y, allowedMime: b,
|
|
|
70
70
|
accept: j,
|
|
71
71
|
onChange: z
|
|
72
72
|
}),
|
|
73
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ c("div", {
|
|
74
74
|
className: a(h.zone, k && h.dragOver, w && h.disabled, T),
|
|
75
75
|
onClick: P,
|
|
76
76
|
onKeyDown: B,
|
|
@@ -81,12 +81,12 @@ function g({ value: g, onChange: _, onChangeError: v, accept: y, allowedMime: b,
|
|
|
81
81
|
role: "button",
|
|
82
82
|
tabIndex: w ? -1 : 0,
|
|
83
83
|
"aria-disabled": w,
|
|
84
|
-
children: E ?? /* @__PURE__ */
|
|
84
|
+
children: E ?? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(u, { className: h.icon }), /* @__PURE__ */ c("span", {
|
|
85
85
|
className: h.hint,
|
|
86
86
|
children: C ? "Перетащите файлы сюда или нажмите для выбора" : "Перетащите файл сюда или нажмите для выбора"
|
|
87
87
|
})] })
|
|
88
88
|
}),
|
|
89
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ c(e, {
|
|
90
90
|
files: g,
|
|
91
91
|
onChange: _
|
|
92
92
|
})
|