triafly-ui-kit 1.0.23 → 1.0.25

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.
Files changed (181) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +6 -0
  2. package/dist/_virtual/index.js +7 -0
  3. package/dist/_virtual/index2.js +7 -0
  4. package/dist/_virtual/index3.js +4 -0
  5. package/dist/_virtual/papaparse.min.js +7 -0
  6. package/dist/_virtual/papaparse.min2.js +4 -0
  7. package/dist/_virtual/react-paginate.js +7 -0
  8. package/dist/_virtual/react-paginate2.js +4 -0
  9. package/dist/assets/fonts/FiraCode-Regular.ttf +0 -0
  10. package/dist/assets/fonts/Manrope-Bold.ttf +0 -0
  11. package/dist/assets/fonts/Manrope-Regular.ttf +0 -0
  12. package/dist/assets/fonts/Manrope-SemiBold.ttf +0 -0
  13. package/dist/assets/fonts/RobotoSlab-SemiBold.ttf +0 -0
  14. package/dist/assets/src/components/Ui/Accordeon/Accordeon.css +1 -0
  15. package/dist/assets/src/components/Ui/Alert/Alert.css +1 -0
  16. package/dist/assets/src/components/Ui/Avatar/Avatar.css +1 -0
  17. package/dist/assets/src/components/Ui/Badge/Badge.module.css +1 -0
  18. package/dist/assets/src/components/Ui/Button/Button.css +1 -0
  19. package/dist/assets/src/components/Ui/ButtonsArray/ButtonsArray.css +1 -0
  20. package/dist/assets/src/components/Ui/Checkbox/Checkbox.css +1 -0
  21. package/dist/assets/src/components/Ui/CliTextareaInput/CliTextareaInput.css +1 -0
  22. package/dist/assets/src/components/Ui/CustomLink/CustomLink.css +1 -0
  23. package/dist/assets/src/components/Ui/DatePicker/DatePicker.css +1 -0
  24. package/dist/assets/src/components/Ui/DropdownInput/DropdownInput.css +1 -0
  25. package/dist/assets/src/components/Ui/DropdownMenu/DropdownMenu.css +1 -0
  26. package/dist/assets/src/components/Ui/FileUpload/FileUpload.css +1 -0
  27. package/dist/assets/src/components/Ui/Form/FormRoot/Form.css +1 -0
  28. package/dist/assets/src/components/Ui/Loader/Loader.css +1 -0
  29. package/dist/assets/src/components/Ui/ModalWindow/ModalWindow.css +1 -0
  30. package/dist/assets/src/components/Ui/Pagination/Pagination.css +1 -0
  31. package/dist/assets/src/components/Ui/Radio/Radio.css +1 -0
  32. package/dist/assets/src/components/Ui/SearchInput/SearchInput.css +1 -0
  33. package/dist/assets/src/components/Ui/Skeleton/Skeleton.module.css +1 -0
  34. package/dist/assets/src/components/Ui/Switch/Switch.css +1 -0
  35. package/dist/assets/src/components/Ui/Table/Table.css +1 -0
  36. package/dist/assets/src/components/Ui/Tabs/Tabs.css +1 -0
  37. package/dist/assets/src/components/Ui/TextInput/TextInput.css +1 -0
  38. package/dist/assets/src/components/Ui/TextareaInput/TextareaInput.css +1 -0
  39. package/dist/assets/src/components/Ui/Tooltip/Tooltip.css +1 -0
  40. package/dist/assets/src/components/Ui/Tooltip/Tooltip.stories.module.css +1 -0
  41. package/dist/assets/src/context/ToastContext/ToastContext.module.css +1 -0
  42. package/dist/components/Ui/Accordeon/Accordeon.js +34 -0
  43. package/dist/components/Ui/Accordeon/Accordeon.stories.js +72 -0
  44. package/dist/components/Ui/Accordeon/index.js +4 -0
  45. package/dist/components/Ui/Alert/Alert.js +15 -0
  46. package/dist/components/Ui/Alert/index.js +4 -0
  47. package/dist/components/Ui/Avatar/Avatar.js +11 -0
  48. package/dist/components/Ui/Avatar/index.js +4 -0
  49. package/dist/components/Ui/Badge/Badge.js +30 -0
  50. package/dist/components/Ui/Badge/index.js +4 -0
  51. package/dist/components/Ui/Button/Button.js +50 -0
  52. package/dist/components/Ui/Button/index.js +4 -0
  53. package/dist/components/Ui/ButtonsArray/ButtonsArray.js +29 -0
  54. package/dist/components/Ui/ButtonsArray/ButtonsArray.stories.js +78 -0
  55. package/dist/components/Ui/ButtonsArray/index.js +4 -0
  56. package/dist/components/Ui/Checkbox/Checkbox.js +40 -0
  57. package/dist/components/Ui/Checkbox/Checkbox.stories.js +120 -0
  58. package/dist/components/Ui/Checkbox/index.js +4 -0
  59. package/dist/components/Ui/CliTextareaInput/CliTextareaInput.js +122 -0
  60. package/dist/components/Ui/CliTextareaInput/index.js +23 -0
  61. package/dist/components/Ui/CliTextareaInput/utils/escapeHtml/escapeHtml.js +4 -0
  62. package/dist/components/Ui/CliTextareaInput/utils/fixJson/fixJson.js +12 -0
  63. package/dist/components/Ui/CliTextareaInput/utils/highlightSyntax/highlightSyntax.js +20 -0
  64. package/dist/components/Ui/CliTextareaInput/utils/highlightSyntax/index.js +4 -0
  65. package/dist/components/Ui/CliTextareaInput/utils/hooks/index.js +17 -0
  66. package/dist/components/Ui/CliTextareaInput/utils/hooks/useFixFormat/index.js +4 -0
  67. package/dist/components/Ui/CliTextareaInput/utils/hooks/useFixFormat/useFixFormat.js +29 -0
  68. package/dist/components/Ui/CliTextareaInput/utils/hooks/useHistoryNavigation/index.js +4 -0
  69. package/dist/components/Ui/CliTextareaInput/utils/hooks/useHistoryNavigation/useHistoryNavigation.js +34 -0
  70. package/dist/components/Ui/CliTextareaInput/utils/hooks/useKeyHandlers/index.js +4 -0
  71. package/dist/components/Ui/CliTextareaInput/utils/hooks/useKeyHandlers/useKeyHandlers.js +45 -0
  72. package/dist/components/Ui/CliTextareaInput/utils/hooks/useLineNumbers/index.js +5 -0
  73. package/dist/components/Ui/CliTextareaInput/utils/hooks/useLineNumbers/useLineNumbers.js +17 -0
  74. package/dist/components/Ui/CliTextareaInput/utils/hooks/useScrollSync/index.js +4 -0
  75. package/dist/components/Ui/CliTextareaInput/utils/hooks/useScrollSync/useScrollSync.js +13 -0
  76. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextActions/index.js +4 -0
  77. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextActions/useTextActions.js +37 -0
  78. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextCoursore/index.js +4 -0
  79. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextCoursore/useTextCoursore.js +14 -0
  80. package/dist/components/Ui/CliTextareaInput/utils/index.js +21 -0
  81. package/dist/components/Ui/CliTextareaInput/utils/processJson/index.js +4 -0
  82. package/dist/components/Ui/CliTextareaInput/utils/processJson/processJson.js +11 -0
  83. package/dist/components/Ui/CliTextareaInput/utils/processXml/processXml.js +8 -0
  84. package/dist/components/Ui/CliTextareaInput/utils/processYml/processYml.js +27 -0
  85. package/dist/components/Ui/CliTextareaInput/utils/types.js +1 -0
  86. package/dist/components/Ui/CustomLink/CustomLink.js +50 -0
  87. package/dist/components/Ui/CustomLink/index.js +4 -0
  88. package/dist/components/Ui/DatePicker/DatePicker.js +183 -0
  89. package/dist/components/Ui/DatePicker/DatePicker.stories.js +120 -0
  90. package/dist/components/Ui/DropdownInput/DropdownInput.js +92 -0
  91. package/dist/components/Ui/DropdownInput/DropdownInput.stories.js +77 -0
  92. package/dist/components/Ui/DropdownInput/index.js +4 -0
  93. package/dist/components/Ui/DropdownMenu/DropdownMenu.js +84 -0
  94. package/dist/components/Ui/DropdownMenu/DropdownMenu.stories.js +50 -0
  95. package/dist/components/Ui/DropdownMenu/index.js +4 -0
  96. package/dist/components/Ui/FileUpload/FileUpload.js +197 -0
  97. package/dist/components/Ui/FileUpload/fn.js +10 -0
  98. package/dist/components/Ui/FileUpload/index.js +4 -0
  99. package/dist/components/Ui/FileUpload/types.js +1 -0
  100. package/dist/components/Ui/Form/FormContext/FormContext.js +5 -0
  101. package/dist/components/Ui/Form/FormItem/FormItem.js +107 -0
  102. package/dist/components/Ui/Form/FormItem/fn.js +25 -0
  103. package/dist/components/Ui/Form/FormItem/types.js +1 -0
  104. package/dist/components/Ui/Form/FormRoot/FormRoot.js +26 -0
  105. package/dist/components/Ui/Form/FormRoot/index.js +4 -0
  106. package/dist/components/Ui/Form/FormRoot/types.js +1 -0
  107. package/dist/components/Ui/Form/index.js +6 -0
  108. package/dist/components/Ui/Form/useForm/index.js +4 -0
  109. package/dist/components/Ui/Form/useForm/useForm.js +111 -0
  110. package/dist/components/Ui/Form/utils/fn.js +31 -0
  111. package/dist/components/Ui/Form/utils/types.js +1 -0
  112. package/dist/components/Ui/Icons/Icons.js +577 -0
  113. package/dist/components/Ui/Icons/index.js +97 -0
  114. package/dist/components/Ui/Icons/utils/CreateIcon.js +23 -0
  115. package/dist/components/Ui/Loader/Loader.js +7 -0
  116. package/dist/components/Ui/Loader/index.js +4 -0
  117. package/dist/components/Ui/ModalWindow/ModalWindow.js +51 -0
  118. package/dist/components/Ui/ModalWindow/index.js +4 -0
  119. package/dist/components/Ui/Pagination/Pagination.js +39 -0
  120. package/dist/components/Ui/Pagination/index.js +4 -0
  121. package/dist/components/Ui/Radio/Radio.js +31 -0
  122. package/dist/components/Ui/Radio/Radio.stories.js +42 -0
  123. package/dist/components/Ui/Radio/index.js +4 -0
  124. package/dist/components/Ui/SearchInput/SearchData.js +30 -0
  125. package/dist/components/Ui/SearchInput/SearchInput.js +110 -0
  126. package/dist/components/Ui/Skeleton/Skeleton.js +26 -0
  127. package/dist/components/Ui/Skeleton/index.js +4 -0
  128. package/dist/components/Ui/Switch/Switch.js +26 -0
  129. package/dist/components/Ui/Switch/index.js +4 -0
  130. package/dist/components/Ui/Table/MemoizedRow/MemoizedRow.js +50 -0
  131. package/dist/components/Ui/Table/Table.js +161 -0
  132. package/dist/components/Ui/Table/TableTypes.js +1 -0
  133. package/dist/components/Ui/Table/index.js +4 -0
  134. package/dist/components/Ui/Tabs/Tabs.js +25 -0
  135. package/dist/components/Ui/Tabs/Tabs.stories.js +67 -0
  136. package/dist/components/Ui/Tabs/index.js +4 -0
  137. package/dist/components/Ui/TextInput/TextInput.js +86 -0
  138. package/dist/components/Ui/TextInput/TextInput.stories.js +225 -0
  139. package/dist/components/Ui/TextInput/index.js +4 -0
  140. package/dist/components/Ui/TextareaInput/TextareaInput.js +69 -0
  141. package/dist/components/Ui/TextareaInput/TextareaInput.stories.js +19 -0
  142. package/dist/components/Ui/TextareaInput/index.js +4 -0
  143. package/dist/components/Ui/Tooltip/Tooltip.js +93 -0
  144. package/dist/components/Ui/Tooltip/Tooltip.stories.js +87 -0
  145. package/dist/components/Ui/Tooltip/index.js +4 -0
  146. package/dist/context/ToastContext/ToastContext.js +38 -0
  147. package/dist/context/ToastContext/index.js +5 -0
  148. package/dist/context/TriaflyContext/TriaflyContext.types.js +1 -0
  149. package/dist/context/TriaflyContext/TriaflyProvider.js +27 -0
  150. package/dist/context/TriaflyContext/hooks/index.js +8 -0
  151. package/dist/context/TriaflyContext/hooks/useBreakpointValue/index.js +4 -0
  152. package/dist/context/TriaflyContext/hooks/useBreakpointValue/useBreakpointValue.js +11 -0
  153. package/dist/context/TriaflyContext/hooks/useModal/index.js +4 -0
  154. package/dist/context/TriaflyContext/hooks/useModal/useModal.js +16 -0
  155. package/dist/context/TriaflyContext/hooks/useTheme/index.js +4 -0
  156. package/dist/context/TriaflyContext/hooks/useTheme/useTheme.js +17 -0
  157. package/dist/context/TriaflyContext/index.js +12 -0
  158. package/dist/main.d.ts +1229 -0
  159. package/dist/main.js +162 -0
  160. package/dist/node_modules/classnames/index.js +42 -0
  161. package/dist/node_modules/fast-deep-equal/index.js +31 -0
  162. package/dist/node_modules/papaparse/papaparse.min.js +421 -0
  163. package/dist/node_modules/react-paginate/dist/react-paginate.js +259 -0
  164. package/dist/src/components/Ui/Badge/Badge.module.scss.js +30 -0
  165. package/dist/src/components/Ui/Skeleton/Skeleton.module.scss.js +9 -0
  166. package/dist/src/components/Ui/Tooltip/Tooltip.stories.module.css.js +15 -0
  167. package/dist/src/context/ToastContext/ToastContext.module.scss.js +9 -0
  168. package/dist/styles/_mixins.scss +22 -0
  169. package/dist/styles/fix.scss +4 -0
  170. package/dist/styles/main.scss +27 -0
  171. package/dist/styles/reset.scss +106 -0
  172. package/dist/styles/typography.scss +102 -0
  173. package/dist/styles/variables.scss +278 -0
  174. package/dist/vite-env.d.js +1 -0
  175. package/package.json +6 -2
  176. package/src/styles/_mixins.scss +22 -0
  177. package/src/styles/fix.scss +4 -0
  178. package/src/styles/main.scss +27 -0
  179. package/src/styles/reset.scss +106 -0
  180. package/src/styles/typography.scss +102 -0
  181. package/src/styles/variables.scss +278 -0
@@ -0,0 +1,183 @@
1
+ import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
+ import { useState as w, useRef as $, useEffect as N } from "react";
3
+ import '../../../assets/src/components/Ui/DatePicker/DatePicker.css';/* empty css */
4
+ import { IconCalendarBlank as A, IconCaretUpDown as G, IconCaretLeft as I, IconCaretRight as S } from "../Icons/Icons.js";
5
+ const H = [
6
+ "Январь",
7
+ "Февраль",
8
+ "Март",
9
+ "Апрель",
10
+ "Май",
11
+ "Июнь",
12
+ "Июль",
13
+ "Август",
14
+ "Сентябрь",
15
+ "Октябрь",
16
+ "Ноябрь",
17
+ "Декабрь"
18
+ ], Z = ({
19
+ name: O = "date",
20
+ value: r = null,
21
+ onChange: x = () => {
22
+ },
23
+ placeholder: L = "Любая дата",
24
+ className: R = "",
25
+ inputClassName: T = "",
26
+ calendarClassName: E = "",
27
+ minDate: M,
28
+ maxDate: v
29
+ }) => {
30
+ const [c, k] = w(r), [d, u] = w(r ? new Date(r) : /* @__PURE__ */ new Date()), [F, g] = w(!1), m = $(null), D = $(null), j = (t) => {
31
+ const o = t.getDate(), e = t.getMonth() + 1, p = t.getFullYear();
32
+ return `${o}-${e < 10 ? "0" + e : e}-${p}`;
33
+ };
34
+ N(() => {
35
+ k(r), r && u(new Date(r));
36
+ }, [r]), N(() => {
37
+ D.current && (D.current.value = c ? c.toISOString().split("T")[0] : "");
38
+ }, [c]), N(() => {
39
+ const t = (o) => {
40
+ m.current && !m.current.contains(o.target) && g(!1);
41
+ };
42
+ return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
43
+ }, []);
44
+ const y = (t, o = 0) => {
45
+ const e = new Date(
46
+ d.getFullYear(),
47
+ d.getMonth() + o,
48
+ t
49
+ );
50
+ k(e), x(e), u(new Date(e)), g(!1);
51
+ }, Y = (t) => {
52
+ u((o) => {
53
+ const e = new Date(o);
54
+ return e.setMonth(e.getMonth() + t), e;
55
+ });
56
+ }, b = (t) => {
57
+ u((o) => {
58
+ const e = new Date(o);
59
+ return e.setFullYear(e.getFullYear() + t), e;
60
+ });
61
+ }, P = () => {
62
+ const t = d.getFullYear(), o = d.getMonth(), e = /* @__PURE__ */ new Date(), p = new Date(t, o, 1), B = new Date(t, o + 1, 0).getDate(), U = p.getDay() || 7, W = new Date(t, o, 0).getDate(), q = U - 1, h = [];
63
+ for (let a = q; a > 0; a--) {
64
+ const s = W - a + 1, l = new Date(t, o - 1, s), f = l.getDate() === e.getDate() && l.getMonth() === e.getMonth() && l.getFullYear() === e.getFullYear();
65
+ h.push(
66
+ /* @__PURE__ */ n(
67
+ "div",
68
+ {
69
+ className: `day other-month ${f ? "today" : ""}`,
70
+ onClick: () => y(s, -1),
71
+ children: s
72
+ },
73
+ `prev-${s}`
74
+ )
75
+ );
76
+ }
77
+ for (let a = 1; a <= B; a++) {
78
+ const s = new Date(t, o, a), l = c && s.getDate() === c.getDate() && s.getMonth() === c.getMonth() && s.getFullYear() === c.getFullYear(), f = s.getDate() === e.getDate() && s.getMonth() === e.getMonth() && s.getFullYear() === e.getFullYear(), C = M && s < M || v && s > v;
79
+ h.push(
80
+ /* @__PURE__ */ n(
81
+ "div",
82
+ {
83
+ className: `day ${l ? "selected" : ""} ${C ? "disabled" : ""} ${f ? "today" : ""}`,
84
+ onClick: () => !C && y(a),
85
+ children: a
86
+ },
87
+ `current-${a}`
88
+ )
89
+ );
90
+ }
91
+ const z = 42 - h.length;
92
+ for (let a = 1; a <= z; a++) {
93
+ const s = new Date(t, o + 1, a), l = s.getDate() === e.getDate() && s.getMonth() === e.getMonth() && s.getFullYear() === e.getFullYear();
94
+ h.push(
95
+ /* @__PURE__ */ n(
96
+ "div",
97
+ {
98
+ className: `day other-month ${l ? "today" : ""}`,
99
+ onClick: () => y(a, 1),
100
+ children: a
101
+ },
102
+ `next-${a}`
103
+ )
104
+ );
105
+ }
106
+ return h;
107
+ };
108
+ return /* @__PURE__ */ i("div", { className: `datepicker ${R}`, ref: m, children: [
109
+ /* @__PURE__ */ n(
110
+ "input",
111
+ {
112
+ type: "date",
113
+ ref: D,
114
+ name: O,
115
+ className: "native-input",
116
+ "aria-hidden": "true"
117
+ }
118
+ ),
119
+ /* @__PURE__ */ i(
120
+ "div",
121
+ {
122
+ className: `datepicker-input ${T}`,
123
+ onClick: () => g(!F),
124
+ children: [
125
+ /* @__PURE__ */ n(A, {}),
126
+ /* @__PURE__ */ n("span", { className: "placeholder", children: c ? j(c) : L }),
127
+ /* @__PURE__ */ n(G, { className: "caret" })
128
+ ]
129
+ }
130
+ ),
131
+ F && /* @__PURE__ */ i("div", { className: `datepicker-calendar ${E}`, children: [
132
+ /* @__PURE__ */ i("div", { className: "calendar-controls", children: [
133
+ /* @__PURE__ */ i("div", { className: "month-control", children: [
134
+ /* @__PURE__ */ n(
135
+ "button",
136
+ {
137
+ className: "nav-button",
138
+ onClick: () => Y(-1),
139
+ "aria-label": "Предыдущий месяц",
140
+ children: /* @__PURE__ */ n(I, {})
141
+ }
142
+ ),
143
+ /* @__PURE__ */ n("span", { className: "current-month", children: H[d.getMonth()] }),
144
+ /* @__PURE__ */ n(
145
+ "button",
146
+ {
147
+ className: "nav-button",
148
+ onClick: () => Y(1),
149
+ "aria-label": "Следующий месяц",
150
+ children: /* @__PURE__ */ n(S, {})
151
+ }
152
+ )
153
+ ] }),
154
+ /* @__PURE__ */ i("div", { className: "year-control", children: [
155
+ /* @__PURE__ */ n(
156
+ "button",
157
+ {
158
+ className: "nav-button",
159
+ onClick: () => b(-1),
160
+ "aria-label": "Предыдущий год",
161
+ children: /* @__PURE__ */ n(I, {})
162
+ }
163
+ ),
164
+ /* @__PURE__ */ n("span", { className: "current-year", children: d.getFullYear() }),
165
+ /* @__PURE__ */ n(
166
+ "button",
167
+ {
168
+ className: "nav-button",
169
+ onClick: () => b(1),
170
+ "aria-label": "Следующий год",
171
+ children: /* @__PURE__ */ n(S, {})
172
+ }
173
+ )
174
+ ] })
175
+ ] }),
176
+ /* @__PURE__ */ n("div", { className: "calendar-weekdays", children: ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"].map((t) => /* @__PURE__ */ n("div", { className: "weekday", children: t }, t)) }),
177
+ /* @__PURE__ */ n("div", { className: "calendar-days", children: P() })
178
+ ] })
179
+ ] });
180
+ };
181
+ export {
182
+ Z as default
183
+ };
@@ -0,0 +1,120 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import l from "react";
3
+ import n from "./DatePicker.js";
4
+ const d = {
5
+ title: "UIKit/DatePicker",
6
+ component: n,
7
+ tags: ["autodocs"],
8
+ argTypes: {
9
+ value: {
10
+ control: "date",
11
+ description: "Выбранная дата (timestamp)"
12
+ },
13
+ onChange: {
14
+ action: "dateChanged",
15
+ description: "Обработчик изменения даты"
16
+ },
17
+ className: {
18
+ control: "text",
19
+ description: "Класс для основного контейнера"
20
+ },
21
+ inputClassName: {
22
+ control: "text",
23
+ description: "Класс для кастомного инпута"
24
+ },
25
+ calendarClassName: {
26
+ control: "text",
27
+ description: "Класс для календаря"
28
+ },
29
+ placeholder: {
30
+ control: "text",
31
+ description: "Текст плейсхолдера"
32
+ },
33
+ minDate: {
34
+ control: "date",
35
+ description: "Минимальная доступная дата"
36
+ },
37
+ maxDate: {
38
+ control: "date",
39
+ description: "Максимальная доступная дата"
40
+ }
41
+ }
42
+ }, m = {
43
+ args: {
44
+ placeholder: "Любая дата"
45
+ }
46
+ }, p = {
47
+ args: {
48
+ value: new Date(2023, 5, 15),
49
+ placeholder: "Выберите дату"
50
+ }
51
+ }, u = {
52
+ args: {
53
+ minDate: new Date(2023, 0, 1),
54
+ maxDate: new Date(2023, 11, 31)
55
+ }
56
+ }, x = {
57
+ args: {
58
+ inputClassName: "custom-input",
59
+ calendarClassName: "custom-calendar"
60
+ },
61
+ decorators: [
62
+ (t) => /* @__PURE__ */ a("div", { children: [
63
+ /* @__PURE__ */ e("style", { children: `
64
+ .custom-input {
65
+ border: 2px solid #6366f1;
66
+ background-color: #f0f0ff;
67
+ padding: 12px;
68
+ border-radius: 8px;
69
+ }
70
+ .custom-calendar {
71
+ border: 2px solid #6366f1;
72
+ box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
73
+ }
74
+ .custom-calendar .day.selected {
75
+ background-color: #6366f1;
76
+ }
77
+ ` }),
78
+ /* @__PURE__ */ e(t, {})
79
+ ] })
80
+ ]
81
+ }, h = {
82
+ render: () => {
83
+ const [t, o] = l.useState(null);
84
+ return /* @__PURE__ */ a("div", { style: { maxWidth: "300px" }, children: [
85
+ /* @__PURE__ */ e(
86
+ n,
87
+ {
88
+ value: t,
89
+ onChange: o,
90
+ placeholder: "Контролируемый выбор"
91
+ }
92
+ ),
93
+ /* @__PURE__ */ a("div", { style: { marginTop: "16px", fontSize: "14px" }, children: [
94
+ "Выбрано: ",
95
+ t ? t.toLocaleDateString("ru-RU") : "дата не выбрана"
96
+ ] })
97
+ ] });
98
+ }
99
+ }, g = {
100
+ render: () => /* @__PURE__ */ a("form", { onSubmit: (o) => {
101
+ o.preventDefault();
102
+ const r = new FormData(o.target);
103
+ alert(`Выбрана дата: ${r.get("eventDate")}`);
104
+ }, style: { maxWidth: "300px" }, children: [
105
+ /* @__PURE__ */ a("div", { style: { marginBottom: "16px" }, children: [
106
+ /* @__PURE__ */ e("label", { style: { display: "block", marginBottom: "4px" }, children: "Дата события:" }),
107
+ /* @__PURE__ */ e(n, { name: "eventDate" })
108
+ ] }),
109
+ /* @__PURE__ */ e("button", { type: "submit", children: "Отправить" })
110
+ ] })
111
+ };
112
+ export {
113
+ h as Controlled,
114
+ x as CustomStyled,
115
+ m as Default,
116
+ g as InForm,
117
+ u as WithDateRange,
118
+ p as WithInitialDate,
119
+ d as default
120
+ };
@@ -0,0 +1,92 @@
1
+ import { jsxs as c, jsx as n } from "react/jsx-runtime";
2
+ import { useState as m, useRef as O, useEffect as g } from "react";
3
+ import '../../../assets/src/components/Ui/DropdownInput/DropdownInput.css';/* empty css */
4
+ import { IconCaretUpDown as E, IconWarningCircle as P } from "../Icons/Icons.js";
5
+ const j = ({
6
+ label: v,
7
+ options: i,
8
+ value: o,
9
+ onChange: f,
10
+ name: C = "DropdownInput",
11
+ placeholder: r,
12
+ errorMessage: d = !1,
13
+ isDisabled: h = !1,
14
+ className: k = ""
15
+ }) => {
16
+ var w;
17
+ const [p, u] = m(!1), [t, N] = m(o || ""), [I, x] = m(!1), s = O(null);
18
+ g(() => {
19
+ const e = (l) => {
20
+ s.current && !s.current.contains(l.target) && u(!1);
21
+ };
22
+ return document.addEventListener("click", e), () => {
23
+ document.removeEventListener("click", e);
24
+ };
25
+ }, []), g(() => {
26
+ N(o || "");
27
+ }, [o]);
28
+ const b = (e) => {
29
+ N(e), u(!1), f && f(e);
30
+ }, $ = (e) => {
31
+ var l;
32
+ if (e.stopPropagation(), !p) {
33
+ const a = (l = s.current) == null ? void 0 : l.getBoundingClientRect(), D = window.innerHeight - ((a == null ? void 0 : a.bottom) || 0);
34
+ x(D < 304);
35
+ }
36
+ u((a) => !a);
37
+ };
38
+ return /* @__PURE__ */ c("div", { className: `dropdown-input ${k}`, ref: s, children: [
39
+ /* @__PURE__ */ c(
40
+ "select",
41
+ {
42
+ name: C,
43
+ value: t,
44
+ onChange: (e) => b(e.target.value),
45
+ className: "dropdown-input__native",
46
+ disabled: h,
47
+ children: [
48
+ /* @__PURE__ */ n("option", { value: "", disabled: !0, children: r }),
49
+ i.map((e) => /* @__PURE__ */ n("option", { value: e.value, children: e.label }, e.value))
50
+ ]
51
+ }
52
+ ),
53
+ v && /* @__PURE__ */ n("label", { children: v }),
54
+ /* @__PURE__ */ c(
55
+ "div",
56
+ {
57
+ className: `input-box
58
+ ${p ? "opened" : ""}
59
+ ${h ? "disabled" : ""}
60
+ ${d ? "invalid" : ""}`,
61
+ onClick: $,
62
+ children: [
63
+ /* @__PURE__ */ n("span", { className: "input-value", children: t === void 0 ? (
64
+ // Если значение не передано
65
+ /* @__PURE__ */ n("span", { className: "placeholder", children: r })
66
+ ) : ((w = i.find((e) => e.value === t)) == null ? void 0 : w.label) || /* @__PURE__ */ n("span", { className: "placeholder", children: r }) }),
67
+ /* @__PURE__ */ n(E, { className: "caret" }),
68
+ p && /* @__PURE__ */ n("ul", { className: `options ${I ? "above" : ""}`, children: i.map((e) => /* @__PURE__ */ n(
69
+ "li",
70
+ {
71
+ onClick: (l) => {
72
+ l.stopPropagation(), b(e.value);
73
+ },
74
+ className: t === e.value ? "option--selected" : "",
75
+ children: e.label
76
+ },
77
+ e.value
78
+ )) })
79
+ ]
80
+ }
81
+ ),
82
+ d && /* @__PURE__ */ c("span", { className: "helper-text error", children: [
83
+ /* @__PURE__ */ n(P, { className: "icon", size: 12 }),
84
+ d
85
+ ] })
86
+ ] });
87
+ };
88
+ j.displayName = "DropdownInput";
89
+ export {
90
+ j as DropdownInput,
91
+ j as default
92
+ };
@@ -0,0 +1,77 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import s from "react";
3
+ import { DropdownInput as a } from "./DropdownInput.js";
4
+ const h = {
5
+ title: "UIKit/DropdownInput",
6
+ component: a,
7
+ parameters: { layout: "centered" },
8
+ argTypes: {
9
+ label: { control: "text" },
10
+ name: { control: "text" },
11
+ options: { control: "object" },
12
+ placeholder: { control: "text" },
13
+ value: { control: "text" },
14
+ errorMessage: { control: "text" },
15
+ isDisabled: { control: "boolean" }
16
+ }
17
+ }, e = (l) => {
18
+ const [o, t] = s.useState(l.value || "");
19
+ return /* @__PURE__ */ r(a, { ...l, value: o, onChange: (n) => {
20
+ t(n);
21
+ } });
22
+ }, d = e.bind({});
23
+ d.args = {
24
+ label: "Выберите опцию",
25
+ name: "dropdown",
26
+ options: [
27
+ { value: "1", label: "Опция 1" },
28
+ { value: "2", label: "Опция 2" },
29
+ { value: "3", label: "Опция 3" }
30
+ ],
31
+ placeholder: "Выберите..."
32
+ };
33
+ const c = e.bind({});
34
+ c.args = {
35
+ label: "Выберите опцию",
36
+ name: "dropdown",
37
+ options: [
38
+ { value: "1", label: "Опция 1" },
39
+ { value: "2", label: "Опция 2" },
40
+ { value: "3", label: "Опция 3" }
41
+ ],
42
+ placeholder: "Выберите...",
43
+ value: "2"
44
+ // Предустановленное значение
45
+ };
46
+ const u = e.bind({});
47
+ u.args = {
48
+ label: "Выберите опцию",
49
+ name: "dropdown",
50
+ options: [
51
+ { value: "1", label: "Опция 1" },
52
+ { value: "2", label: "Опция 2" },
53
+ { value: "3", label: "Опция 3" }
54
+ ],
55
+ placeholder: "Выберите...",
56
+ isDisabled: !0
57
+ // Отключаем селект
58
+ };
59
+ const b = e.bind({});
60
+ b.args = {
61
+ label: "Выберите опцию",
62
+ name: "dropdown",
63
+ options: [
64
+ { value: "1", label: "Опция 1" },
65
+ { value: "2", label: "Опция 2" },
66
+ { value: "3", label: "Опция 3" }
67
+ ],
68
+ placeholder: "Выберите...",
69
+ errorMessage: "Пожалуйста, выберите опцию."
70
+ };
71
+ export {
72
+ d as Default,
73
+ u as Disabled,
74
+ b as WithErrorMessage,
75
+ c as WithSelectedValue,
76
+ h as default
77
+ };
@@ -0,0 +1,4 @@
1
+ import { DropdownInput as r } from "./DropdownInput.js";
2
+ export {
3
+ r as DropdownInput
4
+ };
@@ -0,0 +1,84 @@
1
+ import { jsxs as R, jsx as h } from "react/jsx-runtime";
2
+ import { useState as a, useRef as b, useLayoutEffect as C } from "react";
3
+ import '../../../assets/src/components/Ui/DropdownMenu/DropdownMenu.css';/* empty css */
4
+ const W = ({
5
+ content: m,
6
+ horizontalPosition: s = "right",
7
+ verticalPosition: c = "bottom",
8
+ iconTrigger: N
9
+ }) => {
10
+ const [d, o] = a(!1), [j, n] = a(s), [H, l] = a(c), f = b(null), u = b(null);
11
+ C(() => {
12
+ if (d && f.current && u.current) {
13
+ const e = u.current.getBoundingClientRect(), t = f.current.getBoundingClientRect(), r = window.innerHeight, i = window.innerWidth;
14
+ if (c === "bottom" && e.bottom + t.height > r ? l("top") : c === "top" && e.top - t.height < 0 ? l("bottom") : l(c), s === "left" && e.left + t.width > i)
15
+ n("right");
16
+ else if (s === "right" && e.right - t.width < 0)
17
+ n("left");
18
+ else if (s === "center") {
19
+ const g = e.left + e.width / 2 - t.width / 2;
20
+ g < 0 ? n("left") : g + t.width > i ? n("right") : n("center");
21
+ } else
22
+ n(s);
23
+ }
24
+ }, [d, s, c]), C(() => {
25
+ const e = (t) => {
26
+ f.current && !f.current.contains(t.target) && u.current && !u.current.contains(t.target) && o(!1);
27
+ };
28
+ return d && document.addEventListener("click", e), () => {
29
+ document.removeEventListener("click", e);
30
+ };
31
+ }, [d]);
32
+ const k = () => {
33
+ var e, t;
34
+ if (!d) {
35
+ const r = (e = u.current) == null ? void 0 : e.getBoundingClientRect(), i = (t = f.current) == null ? void 0 : t.getBoundingClientRect();
36
+ if (r && i) {
37
+ const g = window.innerHeight, w = window.innerWidth;
38
+ if (c === "bottom" && r.bottom + i.height > g ? l("top") : c === "top" && r.top - i.height < 0 ? l("bottom") : l(c), s === "left" && r.left + i.width > w)
39
+ n("right");
40
+ else if (s === "right" && r.right - i.width < 0)
41
+ n("left");
42
+ else if (s === "center") {
43
+ const p = r.left + r.width / 2 - i.width / 2;
44
+ p < 0 ? n("left") : p + i.width > w ? n("right") : n("center");
45
+ } else
46
+ n(s);
47
+ }
48
+ }
49
+ o(!d);
50
+ }, x = (e) => {
51
+ e && e(), o(!1);
52
+ };
53
+ return /* @__PURE__ */ R("div", { className: `dropdowm-menu ${d ? "open" : ""}`, children: [
54
+ /* @__PURE__ */ h("div", { className: "menu-trigger", onClick: k, ref: u, children: N || /* @__PURE__ */ h("div", { className: "dots" }) }),
55
+ /* @__PURE__ */ h("div", { className: "fader" }),
56
+ /* @__PURE__ */ h(
57
+ "ul",
58
+ {
59
+ className: "menu-list",
60
+ "data-x-fit": j,
61
+ "data-y-fit": H,
62
+ ref: f,
63
+ children: m == null ? void 0 : m.map(({ icon: e, isDanger: t, title: r, onClick: i }, g) => /* @__PURE__ */ R(
64
+ "li",
65
+ {
66
+ onClick: () => {
67
+ i && x(i);
68
+ },
69
+ className: `menu-item ${t ? "danger" : ""}`,
70
+ children: [
71
+ e,
72
+ /* @__PURE__ */ h("span", { className: "label", children: r })
73
+ ]
74
+ },
75
+ g
76
+ ))
77
+ }
78
+ )
79
+ ] });
80
+ };
81
+ export {
82
+ W as DropdownMenu,
83
+ W as default
84
+ };
@@ -0,0 +1,50 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { IconEye as t, IconRoleX as n, IconTrash as i } from "../Icons/Icons.js";
3
+ import { DropdownMenu as e } from "./DropdownMenu.js";
4
+ const l = {
5
+ title: "UIKit/DropdownMenu",
6
+ component: e,
7
+ tags: ["autodocs"],
8
+ // Автоматическая генерация документации
9
+ argTypes: {
10
+ content: {
11
+ control: "object",
12
+ // Позволяет редактировать content в интерфейсе Storybook
13
+ description: "Массив элементов меню"
14
+ },
15
+ horizontalPosition: {
16
+ control: "select",
17
+ options: ["left", "center", "right"],
18
+ description: "Позиционирование меню относительно триггера"
19
+ },
20
+ verticalPosition: {
21
+ control: "select",
22
+ options: ["top", "bottom"],
23
+ description: "Позиционирование меню относительно триггера"
24
+ }
25
+ }
26
+ }, a = {
27
+ args: {
28
+ content: [
29
+ {
30
+ icon: /* @__PURE__ */ o(t, {}),
31
+ title: "Просмотр"
32
+ },
33
+ {
34
+ icon: /* @__PURE__ */ o(n, {}),
35
+ title: "Назначить другую роль"
36
+ },
37
+ {
38
+ icon: /* @__PURE__ */ o(i, {}),
39
+ title: "Удалить",
40
+ isDanger: !0
41
+ }
42
+ ],
43
+ horizontalPosition: "left",
44
+ verticalPosition: "bottom"
45
+ }
46
+ };
47
+ export {
48
+ a as Default,
49
+ l as default
50
+ };
@@ -0,0 +1,4 @@
1
+ import { DropdownMenu as e } from "./DropdownMenu.js";
2
+ export {
3
+ e as DropdownMenu
4
+ };