triafly-ui-kit 1.0.23 → 1.0.24

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 (157) hide show
  1. package/README.md +93 -93
  2. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  3. package/dist/assets/Accordeon.css +1 -0
  4. package/dist/assets/Alert.css +1 -0
  5. package/dist/assets/Avatar.css +1 -0
  6. package/dist/assets/Badge.css +1 -0
  7. package/dist/assets/Button.css +1 -0
  8. package/dist/assets/ButtonsArray.css +1 -0
  9. package/dist/assets/Checkbox.css +1 -0
  10. package/dist/assets/CliTextareaInput.css +1 -0
  11. package/dist/assets/CustomLink.css +1 -0
  12. package/dist/assets/DatePicker.css +1 -0
  13. package/dist/assets/DropdownInput.css +1 -0
  14. package/dist/assets/DropdownMenu.css +1 -0
  15. package/dist/assets/FileUpload.css +1 -0
  16. package/dist/assets/FormRoot.css +1 -0
  17. package/dist/assets/Loader.css +1 -0
  18. package/dist/assets/ModalWindow.css +1 -0
  19. package/dist/assets/Pagination.css +1 -0
  20. package/dist/assets/Radio.css +1 -0
  21. package/dist/assets/SearchInput.css +1 -0
  22. package/dist/assets/Skeleton.css +1 -0
  23. package/dist/assets/Switch.css +1 -0
  24. package/dist/assets/Table.css +1 -0
  25. package/dist/assets/Tabs.css +1 -0
  26. package/dist/assets/TextInput.css +1 -0
  27. package/dist/assets/TextareaInput.css +1 -0
  28. package/dist/assets/ToastContext.css +1 -0
  29. package/dist/assets/Tooltip.css +1 -0
  30. package/dist/assets/Tooltip2.css +1 -0
  31. package/dist/assets/fonts/FiraCode-Regular.ttf +0 -0
  32. package/dist/assets/fonts/Manrope-Bold.ttf +0 -0
  33. package/dist/assets/fonts/Manrope-Regular.ttf +0 -0
  34. package/dist/assets/fonts/Manrope-SemiBold.ttf +0 -0
  35. package/dist/assets/fonts/RobotoSlab-SemiBold.ttf +0 -0
  36. package/dist/components/Ui/Accordeon/Accordeon.js +33 -0
  37. package/dist/components/Ui/Accordeon/Accordeon.stories.js +72 -0
  38. package/dist/components/Ui/Accordeon/index.js +4 -0
  39. package/dist/components/Ui/Alert/Alert.js +14 -0
  40. package/dist/components/Ui/Alert/index.js +4 -0
  41. package/dist/components/Ui/Avatar/Avatar.js +10 -0
  42. package/dist/components/Ui/Avatar/index.js +4 -0
  43. package/dist/components/Ui/Badge/Badge.js +43 -0
  44. package/dist/components/Ui/Badge/index.js +4 -0
  45. package/dist/components/Ui/Button/Button.js +49 -0
  46. package/dist/components/Ui/Button/index.js +4 -0
  47. package/dist/components/Ui/ButtonsArray/ButtonsArray.js +28 -0
  48. package/dist/components/Ui/ButtonsArray/ButtonsArray.stories.js +78 -0
  49. package/dist/components/Ui/ButtonsArray/index.js +4 -0
  50. package/dist/components/Ui/Checkbox/Checkbox.js +39 -0
  51. package/dist/components/Ui/Checkbox/Checkbox.stories.js +120 -0
  52. package/dist/components/Ui/Checkbox/index.js +4 -0
  53. package/dist/components/Ui/CliTextareaInput/CliTextareaInput.js +121 -0
  54. package/dist/components/Ui/CliTextareaInput/index.js +23 -0
  55. package/dist/components/Ui/CliTextareaInput/utils/escapeHtml/escapeHtml.js +4 -0
  56. package/dist/components/Ui/CliTextareaInput/utils/fixJson/fixJson.js +12 -0
  57. package/dist/components/Ui/CliTextareaInput/utils/highlightSyntax/highlightSyntax.js +20 -0
  58. package/dist/components/Ui/CliTextareaInput/utils/highlightSyntax/index.js +4 -0
  59. package/dist/components/Ui/CliTextareaInput/utils/hooks/index.js +17 -0
  60. package/dist/components/Ui/CliTextareaInput/utils/hooks/useFixFormat/index.js +4 -0
  61. package/dist/components/Ui/CliTextareaInput/utils/hooks/useFixFormat/useFixFormat.js +29 -0
  62. package/dist/components/Ui/CliTextareaInput/utils/hooks/useHistoryNavigation/index.js +4 -0
  63. package/dist/components/Ui/CliTextareaInput/utils/hooks/useHistoryNavigation/useHistoryNavigation.js +34 -0
  64. package/dist/components/Ui/CliTextareaInput/utils/hooks/useKeyHandlers/index.js +4 -0
  65. package/dist/components/Ui/CliTextareaInput/utils/hooks/useKeyHandlers/useKeyHandlers.js +45 -0
  66. package/dist/components/Ui/CliTextareaInput/utils/hooks/useLineNumbers/index.js +5 -0
  67. package/dist/components/Ui/CliTextareaInput/utils/hooks/useLineNumbers/useLineNumbers.js +17 -0
  68. package/dist/components/Ui/CliTextareaInput/utils/hooks/useScrollSync/index.js +4 -0
  69. package/dist/components/Ui/CliTextareaInput/utils/hooks/useScrollSync/useScrollSync.js +13 -0
  70. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextActions/index.js +4 -0
  71. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextActions/useTextActions.js +37 -0
  72. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextCoursore/index.js +4 -0
  73. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextCoursore/useTextCoursore.js +14 -0
  74. package/dist/components/Ui/CliTextareaInput/utils/index.js +21 -0
  75. package/dist/components/Ui/CliTextareaInput/utils/processJson/index.js +4 -0
  76. package/dist/components/Ui/CliTextareaInput/utils/processJson/processJson.js +11 -0
  77. package/dist/components/Ui/CliTextareaInput/utils/processXml/processXml.js +8 -0
  78. package/dist/components/Ui/CliTextareaInput/utils/processYml/processYml.js +27 -0
  79. package/dist/components/Ui/CliTextareaInput/utils/types.js +1 -0
  80. package/dist/components/Ui/CustomLink/CustomLink.js +49 -0
  81. package/dist/components/Ui/CustomLink/index.js +4 -0
  82. package/dist/components/Ui/DatePicker/DatePicker.js +175 -0
  83. package/dist/components/Ui/DatePicker/DatePicker.stories.js +114 -0
  84. package/dist/components/Ui/DatePicker/index.js +4 -0
  85. package/dist/components/Ui/DropdownInput/DropdownInput.js +91 -0
  86. package/dist/components/Ui/DropdownInput/DropdownInput.stories.js +77 -0
  87. package/dist/components/Ui/DropdownInput/index.js +4 -0
  88. package/dist/components/Ui/DropdownMenu/DropdownMenu.js +83 -0
  89. package/dist/components/Ui/DropdownMenu/DropdownMenu.stories.js +50 -0
  90. package/dist/components/Ui/DropdownMenu/index.js +4 -0
  91. package/dist/components/Ui/FileUpload/FileUpload.js +615 -0
  92. package/dist/components/Ui/FileUpload/fn.js +10 -0
  93. package/dist/components/Ui/FileUpload/index.js +4 -0
  94. package/dist/components/Ui/FileUpload/types.js +1 -0
  95. package/dist/components/Ui/Form/FormContext/FormContext.js +5 -0
  96. package/dist/components/Ui/Form/FormItem/FormItem.js +107 -0
  97. package/dist/components/Ui/Form/FormItem/fn.js +25 -0
  98. package/dist/components/Ui/Form/FormItem/types.js +1 -0
  99. package/dist/components/Ui/Form/FormRoot/FormRoot.js +25 -0
  100. package/dist/components/Ui/Form/FormRoot/index.js +4 -0
  101. package/dist/components/Ui/Form/FormRoot/types.js +1 -0
  102. package/dist/components/Ui/Form/index.js +6 -0
  103. package/dist/components/Ui/Form/useForm/index.js +4 -0
  104. package/dist/components/Ui/Form/useForm/useForm.js +111 -0
  105. package/dist/components/Ui/Form/utils/fn.js +31 -0
  106. package/dist/components/Ui/Form/utils/types.js +1 -0
  107. package/dist/components/Ui/Icons/Icons.js +577 -0
  108. package/dist/components/Ui/Icons/index.js +97 -0
  109. package/dist/components/Ui/Icons/utils/CreateIcon.js +23 -0
  110. package/dist/components/Ui/Loader/Loader.js +6 -0
  111. package/dist/components/Ui/Loader/index.js +4 -0
  112. package/dist/components/Ui/ModalWindow/ModalWindow.js +50 -0
  113. package/dist/components/Ui/ModalWindow/index.js +4 -0
  114. package/dist/components/Ui/Pagination/Pagination.js +294 -0
  115. package/dist/components/Ui/Pagination/index.js +4 -0
  116. package/dist/components/Ui/Radio/Radio.js +30 -0
  117. package/dist/components/Ui/Radio/Radio.stories.js +42 -0
  118. package/dist/components/Ui/Radio/index.js +4 -0
  119. package/dist/components/Ui/SearchInput/SearchData.js +30 -0
  120. package/dist/components/Ui/SearchInput/SearchInput.js +109 -0
  121. package/dist/components/Ui/Skeleton/Skeleton.js +28 -0
  122. package/dist/components/Ui/Skeleton/index.js +4 -0
  123. package/dist/components/Ui/Switch/Switch.js +25 -0
  124. package/dist/components/Ui/Switch/index.js +4 -0
  125. package/dist/components/Ui/Table/MemoizedRow/MemoizedRow.js +79 -0
  126. package/dist/components/Ui/Table/Table.js +160 -0
  127. package/dist/components/Ui/Table/TableTypes.js +1 -0
  128. package/dist/components/Ui/Table/index.js +4 -0
  129. package/dist/components/Ui/Tabs/Tabs.js +24 -0
  130. package/dist/components/Ui/Tabs/Tabs.stories.js +67 -0
  131. package/dist/components/Ui/Tabs/index.js +4 -0
  132. package/dist/components/Ui/TextInput/TextInput.js +85 -0
  133. package/dist/components/Ui/TextInput/TextInput.stories.js +225 -0
  134. package/dist/components/Ui/TextInput/index.js +4 -0
  135. package/dist/components/Ui/TextareaInput/TextareaInput.js +68 -0
  136. package/dist/components/Ui/TextareaInput/TextareaInput.stories.js +19 -0
  137. package/dist/components/Ui/TextareaInput/index.js +4 -0
  138. package/dist/components/Ui/Tooltip/Tooltip.js +92 -0
  139. package/dist/components/Ui/Tooltip/Tooltip.stories.js +92 -0
  140. package/dist/components/Ui/Tooltip/index.js +4 -0
  141. package/dist/context/ToastContext/ToastContext.js +40 -0
  142. package/dist/context/ToastContext/index.js +5 -0
  143. package/dist/context/TriaflyContext/TriaflyContext.types.js +1 -0
  144. package/dist/context/TriaflyContext/TriaflyProvider.js +27 -0
  145. package/dist/context/TriaflyContext/hooks/index.js +8 -0
  146. package/dist/context/TriaflyContext/hooks/useBreakpointValue/index.js +4 -0
  147. package/dist/context/TriaflyContext/hooks/useBreakpointValue/useBreakpointValue.js +11 -0
  148. package/dist/context/TriaflyContext/hooks/useModal/index.js +4 -0
  149. package/dist/context/TriaflyContext/hooks/useModal/useModal.js +16 -0
  150. package/dist/context/TriaflyContext/hooks/useTheme/index.js +4 -0
  151. package/dist/context/TriaflyContext/hooks/useTheme/useTheme.js +17 -0
  152. package/dist/context/TriaflyContext/index.js +12 -0
  153. package/dist/index-2QXL0WYc.js +45 -0
  154. package/dist/main.d.ts +1243 -0
  155. package/dist/main.js +164 -0
  156. package/dist/vite-env.d.js +1 -0
  157. package/package.json +106 -106
@@ -0,0 +1,225 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import { useState as t } from "react";
3
+ import { TextInput as l } from "./TextInput.js";
4
+ const y = {
5
+ title: "UIKit/TextInput",
6
+ component: l,
7
+ tags: ["autodocs"],
8
+ argTypes: {
9
+ iconType: {
10
+ control: {
11
+ type: "select",
12
+ options: [void 0, "email", "password", "search", "checkmark"]
13
+ }
14
+ },
15
+ type: {
16
+ control: {
17
+ type: "select",
18
+ options: ["text", "password", "email", "search"]
19
+ }
20
+ },
21
+ className: {
22
+ control: {
23
+ type: "text",
24
+ description: "Комбинируйте классы: 'sm', 'rounded' через пробел"
25
+ }
26
+ }
27
+ }
28
+ }, f = {
29
+ args: {
30
+ placeholder: "Введите текст...",
31
+ label: "Текстовое поле"
32
+ }
33
+ }, v = {
34
+ args: {
35
+ placeholder: "Поиск...",
36
+ iconType: "search"
37
+ }
38
+ }, N = {
39
+ args: {
40
+ label: "Email",
41
+ placeholder: "Введите email",
42
+ hasError: !0,
43
+ errorMessage: "Неверный формат email",
44
+ iconType: "email"
45
+ }
46
+ }, k = {
47
+ args: {
48
+ label: "Заблокированное поле",
49
+ value: "Нельзя изменить",
50
+ isDisabled: !0
51
+ }
52
+ }, C = {
53
+ args: {
54
+ label: "Поле с очисткой",
55
+ placeholder: "Введите и очистите",
56
+ isClearable: !0,
57
+ value: "Пример текста"
58
+ }
59
+ }, T = {
60
+ args: {
61
+ label: "Поле с загрузкой",
62
+ isLoading: !0
63
+ }
64
+ }, I = {
65
+ args: {
66
+ placeholder: "Маленькое поле...",
67
+ label: "Текстовое поле (sm)",
68
+ className: "sm"
69
+ }
70
+ }, D = {
71
+ args: {
72
+ placeholder: "Маленькое и круглое...",
73
+ label: "Поле (sm + rounded)",
74
+ className: "sm rounded"
75
+ }
76
+ }, S = {
77
+ render: () => /* @__PURE__ */ a("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "24px" }, children: [
78
+ /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: [
79
+ /* @__PURE__ */ e("h3", { children: "Обычный размер (44px)" }),
80
+ /* @__PURE__ */ e(l, { label: "Обычное поле", placeholder: "Просто текст" }),
81
+ /* @__PURE__ */ e(l, { label: "С иконкой", iconType: "email", placeholder: "email@example.com" }),
82
+ /* @__PURE__ */ e(
83
+ l,
84
+ {
85
+ label: "С ошибкой",
86
+ hasError: !0,
87
+ errorMessage: "Ошибка валидации",
88
+ value: "Неверное значение"
89
+ }
90
+ ),
91
+ /* @__PURE__ */ e(l, { label: "С очисткой", isClearable: !0, value: "Можно очистить" }),
92
+ /* @__PURE__ */ e(l, { label: "Загрузка", isLoading: !0 }),
93
+ /* @__PURE__ */ e(l, { label: "Закругленное", className: "rounded", placeholder: "rounded" })
94
+ ] }),
95
+ /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: [
96
+ /* @__PURE__ */ e("h3", { children: "Маленький размер (36px)" }),
97
+ /* @__PURE__ */ e(l, { label: "Поле sm", className: "sm", placeholder: "Маленькое поле" }),
98
+ /* @__PURE__ */ e(l, { label: "С иконкой", className: "sm", iconType: "search", placeholder: "Поиск..." }),
99
+ /* @__PURE__ */ e(
100
+ l,
101
+ {
102
+ label: "С ошибкой",
103
+ className: "sm",
104
+ hasError: !0,
105
+ errorMessage: "Маленькая ошибка",
106
+ value: "Ошибка"
107
+ }
108
+ ),
109
+ /* @__PURE__ */ e(l, { label: "С очисткой", className: "sm", isClearable: !0, value: "Можно очистить" }),
110
+ /* @__PURE__ */ e(l, { label: "Загрузка", className: "sm", isLoading: !0 }),
111
+ /* @__PURE__ */ e(l, { label: "Закругленное sm", className: "sm rounded", placeholder: "sm + rounded" })
112
+ ] })
113
+ ] })
114
+ }, E = {
115
+ render: () => /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: "8px", maxWidth: "400px" }, children: [
116
+ /* @__PURE__ */ e(l, { label: "Обычный размер (44px)", value: "Текст" }),
117
+ /* @__PURE__ */ e(l, { label: "Маленький (36px)", className: "sm", value: "Текст" }),
118
+ /* @__PURE__ */ e(l, { label: "Обычный + rounded", className: "rounded", value: "Текст" }),
119
+ /* @__PURE__ */ e(l, { label: "Маленький + rounded", className: "sm rounded", value: "Текст" }),
120
+ /* @__PURE__ */ e("div", { style: { marginTop: "16px", height: "1px", background: "#eee" } }),
121
+ /* @__PURE__ */ e(
122
+ l,
123
+ {
124
+ label: "Комбинированный пример",
125
+ className: "sm rounded",
126
+ iconType: "password",
127
+ type: "password",
128
+ isClearable: !0,
129
+ value: "password123"
130
+ }
131
+ )
132
+ ] })
133
+ }, w = {
134
+ render: function() {
135
+ const [i, p] = t(""), [r, m] = t(!1), [c, h] = t(!1), [o, n] = t(!1), d = [r ? "sm" : "", c ? "rounded" : ""].filter(Boolean).join(" ") || void 0;
136
+ return /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: "24px" }, children: [
137
+ /* @__PURE__ */ e(
138
+ l,
139
+ {
140
+ label: "Интерактивная демонстрация",
141
+ placeholder: "Попробуйте ввести текст",
142
+ value: i,
143
+ onChange: (s) => {
144
+ p(s.target.value), n(s.target.value.length > 0 && s.target.value.length < 3);
145
+ },
146
+ className: d,
147
+ hasError: o,
148
+ errorMessage: o ? "Слишком короткое значение" : "",
149
+ isClearable: !0,
150
+ iconType: "search"
151
+ }
152
+ ),
153
+ /* @__PURE__ */ a("div", { style: { display: "flex", flexWrap: "wrap", gap: "16px" }, children: [
154
+ /* @__PURE__ */ a("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
155
+ /* @__PURE__ */ e(
156
+ "input",
157
+ {
158
+ type: "checkbox",
159
+ checked: r,
160
+ onChange: (s) => m(s.target.checked)
161
+ }
162
+ ),
163
+ "Маленький размер (sm)"
164
+ ] }),
165
+ /* @__PURE__ */ a("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
166
+ /* @__PURE__ */ e(
167
+ "input",
168
+ {
169
+ type: "checkbox",
170
+ checked: c,
171
+ onChange: (s) => h(s.target.checked)
172
+ }
173
+ ),
174
+ "Закругленные углы"
175
+ ] }),
176
+ /* @__PURE__ */ a("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
177
+ /* @__PURE__ */ e(
178
+ "input",
179
+ {
180
+ type: "checkbox",
181
+ checked: o,
182
+ onChange: (s) => n(s.target.checked)
183
+ }
184
+ ),
185
+ "Показать ошибку"
186
+ ] })
187
+ ] }),
188
+ /* @__PURE__ */ a("div", { style: { background: "#f5f5f5", padding: "12px", borderRadius: "4px" }, children: [
189
+ /* @__PURE__ */ e("h4", { children: "Текущие параметры:" }),
190
+ /* @__PURE__ */ a("ul", { children: [
191
+ /* @__PURE__ */ a("li", { children: [
192
+ "Классы: ",
193
+ /* @__PURE__ */ e("strong", { children: d || "default" })
194
+ ] }),
195
+ /* @__PURE__ */ a("li", { children: [
196
+ "Высота: ",
197
+ /* @__PURE__ */ e("strong", { children: r ? "36px" : "44px" })
198
+ ] }),
199
+ c && /* @__PURE__ */ a("li", { children: [
200
+ "Радиус: ",
201
+ /* @__PURE__ */ e("strong", { children: r ? "18px" : "22px" })
202
+ ] }),
203
+ /* @__PURE__ */ a("li", { children: [
204
+ "Состояние: ",
205
+ o ? "❌ Ошибка" : "✅ Нормальное"
206
+ ] })
207
+ ] })
208
+ ] })
209
+ ] });
210
+ }
211
+ };
212
+ export {
213
+ S as AllStates,
214
+ C as Clearable,
215
+ f as Default,
216
+ k as Disabled,
217
+ w as InteractiveDemo,
218
+ T as Loading,
219
+ E as SizeComparison,
220
+ D as SmallRounded,
221
+ I as SmallSize,
222
+ N as WithError,
223
+ v as WithIcon,
224
+ y as default
225
+ };
@@ -0,0 +1,4 @@
1
+ import { TextInput as o } from "./TextInput.js";
2
+ export {
3
+ o as TextInput
4
+ };
@@ -0,0 +1,68 @@
1
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
+ import { forwardRef as C, useState as V } from "react";
3
+ import { c as $ } from "../../../index-2QXL0WYc.js";
4
+ import { IconX as b } from "../Icons/Icons.js";
5
+ import '../../../assets/TextareaInput.css';const g = C(
6
+ ({
7
+ label: c,
8
+ name: f = "TextareaInput",
9
+ placeholder: p,
10
+ errorMessage: i,
11
+ hasError: u = !1,
12
+ isDisabled: x,
13
+ charLimit: a,
14
+ onChange: l,
15
+ value: o,
16
+ // Значение из пропсов
17
+ resize: v = !1,
18
+ isClearable: d,
19
+ spellCheck: N = !1
20
+ }, h) => {
21
+ const [I, m] = V(""), s = o !== void 0, t = s ? o : I, w = (z) => {
22
+ const n = z.target.value;
23
+ (!a || n.length <= a) && (s || m(n), l && l(n));
24
+ }, T = () => {
25
+ s && l ? l("") : m("");
26
+ }, j = $({
27
+ "no-resize": !v
28
+ });
29
+ return /* @__PURE__ */ r(
30
+ "div",
31
+ {
32
+ className: `textarea-input
33
+ ${u && "invalid"}
34
+ ${d && "clearable"}`,
35
+ children: [
36
+ c && /* @__PURE__ */ e("label", { children: c }),
37
+ /* @__PURE__ */ r("div", { className: "textarea-wrapper", children: [
38
+ /* @__PURE__ */ e(
39
+ "textarea",
40
+ {
41
+ ref: h,
42
+ className: j,
43
+ value: t,
44
+ onChange: w,
45
+ name: f,
46
+ placeholder: p,
47
+ disabled: x,
48
+ spellCheck: N
49
+ }
50
+ ),
51
+ d && t && /* @__PURE__ */ e("div", { className: "clear-value", onClick: T, children: /* @__PURE__ */ e(b, { size: 20 }) })
52
+ ] }),
53
+ a && /* @__PURE__ */ r("p", { className: "char-limit", children: [
54
+ t.length,
55
+ "/",
56
+ a
57
+ ] }),
58
+ i && /* @__PURE__ */ e("span", { className: "helper-text", children: i })
59
+ ]
60
+ }
61
+ );
62
+ }
63
+ );
64
+ g.displayName = "TextareaInput";
65
+ export {
66
+ g as TextareaInput,
67
+ g as default
68
+ };
@@ -0,0 +1,19 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { TextareaInput as e } from "./TextareaInput.js";
3
+ const l = {
4
+ title: "UIKit/TextareaInput",
5
+ component: e
6
+ }, r = {
7
+ render: (t) => /* @__PURE__ */ a(e, { ...t })
8
+ }, m = {
9
+ ...r,
10
+ args: {
11
+ label: "Введите текст:",
12
+ name: "textarea",
13
+ placeholder: "Ваш текст"
14
+ }
15
+ };
16
+ export {
17
+ m as Default,
18
+ l as default
19
+ };
@@ -0,0 +1,4 @@
1
+ import { TextareaInput as t } from "./TextareaInput.js";
2
+ export {
3
+ t as TextareaInput
4
+ };
@@ -0,0 +1,92 @@
1
+ import { jsxs as I, jsx as O } from "react/jsx-runtime";
2
+ import { useState as g, useRef as C, useCallback as u, useEffect as m } from "react";
3
+ import '../../../assets/Tooltip2.css';const V = ({
4
+ content: E,
5
+ children: y,
6
+ position: n = "top",
7
+ trigger: l = "hover",
8
+ clickBehavior: d = "toggle",
9
+ className: L = ""
10
+ }) => {
11
+ const [o, v] = g(!1), [P, T] = g(n), [k, w] = g(!1), f = C(null), c = C(null), b = u(() => {
12
+ if (!c.current || !f.current) return n;
13
+ const e = c.current.getBoundingClientRect(), r = f.current.getBoundingClientRect(), a = {
14
+ top: {
15
+ fits: e.top - r.height - 8 > 0,
16
+ space: e.top
17
+ },
18
+ bottom: {
19
+ fits: window.innerHeight - e.bottom - r.height - 8 > 0,
20
+ space: window.innerHeight - e.bottom
21
+ },
22
+ left: {
23
+ fits: e.left - r.width - 8 > 0,
24
+ space: e.left
25
+ },
26
+ right: {
27
+ fits: window.innerWidth - e.right - r.width - 8 > 0,
28
+ space: window.innerWidth - e.right
29
+ }
30
+ };
31
+ if (a[n].fits) return n;
32
+ const p = ["top", "right", "bottom", "left"], M = p.indexOf(n);
33
+ for (let s = 1; s <= p.length; s++) {
34
+ const h = p[(M + s) % p.length];
35
+ if (a[h].fits) return h;
36
+ }
37
+ return Object.entries(a).reduce(
38
+ (s, [h, { space: j }]) => j > a[s].space ? h : s,
39
+ n
40
+ );
41
+ }, [n]), i = u(() => {
42
+ w(!1), v(!0);
43
+ }, []), t = u(() => {
44
+ v(!1), w(!1);
45
+ }, []), R = u(() => {
46
+ o ? t() : i();
47
+ }, [o, t, i]), x = u(() => {
48
+ d === "toggle" ? R() : d === "show" ? i() : d === "hide" && t();
49
+ }, [d, R, i, t]);
50
+ return m(() => {
51
+ o && f.current && (T(b()), w(!0));
52
+ }, [o, b]), m(() => {
53
+ if (o) {
54
+ const e = () => t();
55
+ return window.addEventListener("scroll", e, !0), () => {
56
+ window.removeEventListener("scroll", e, !0);
57
+ };
58
+ }
59
+ }, [o, t]), m(() => {
60
+ if ((l === "click" || l === "mixed") && o) {
61
+ const e = (r) => {
62
+ c.current && !c.current.contains(r.target) && t();
63
+ };
64
+ return document.addEventListener("mousedown", e), () => {
65
+ document.removeEventListener("mousedown", e);
66
+ };
67
+ }
68
+ }, [o, l, t]), /* @__PURE__ */ I("div", { className: "tooltip-wrapper", ref: c, ...l === "hover" ? { onMouseEnter: i, onMouseLeave: t } : l === "click" ? { onClick: x } : {
69
+ onMouseEnter: i,
70
+ onMouseLeave: t,
71
+ onClick: x
72
+ }, children: [
73
+ y,
74
+ /* @__PURE__ */ O(
75
+ "div",
76
+ {
77
+ className: `tooltip-content ${L} tooltip-${P}`,
78
+ ref: f,
79
+ role: "tooltip",
80
+ style: {
81
+ visibility: o ? "visible" : "hidden",
82
+ opacity: k ? 1 : 0,
83
+ transition: "opacity 0.15s ease-out"
84
+ },
85
+ children: E
86
+ }
87
+ )
88
+ ] });
89
+ };
90
+ export {
91
+ V as Tooltip
92
+ };
@@ -0,0 +1,92 @@
1
+ import { jsxs as e, jsx as i } from "react/jsx-runtime";
2
+ import { Tooltip as o } from "./Tooltip.js";
3
+ import '../../../assets/Tooltip.css';const c = "_container_193w2_1", r = "_trigger_193w2_14", n = "_clickTrigger_193w2_29 _trigger_193w2_14", l = "_positionsContainer_193w2_38", s = "_positionGroup_193w2_42", t = {
4
+ container: c,
5
+ trigger: r,
6
+ clickTrigger: n,
7
+ positionsContainer: l,
8
+ positionGroup: s
9
+ }, d = {
10
+ title: "UIKit/Tooltip",
11
+ component: o,
12
+ tags: ["autodocs"],
13
+ argTypes: {
14
+ position: {
15
+ control: "select",
16
+ options: ["top", "bottom", "left", "right"]
17
+ },
18
+ trigger: {
19
+ control: "select",
20
+ options: ["hover", "click", "mixed"]
21
+ },
22
+ clickBehavior: {
23
+ control: "select",
24
+ options: ["toggle", "show", "hide"]
25
+ }
26
+ }
27
+ }, p = {
28
+ render: () => /* @__PURE__ */ e("div", { className: t.container, children: [
29
+ /* @__PURE__ */ i(o, { content: "Top-left tooltip", className: "white", position: "top", children: /* @__PURE__ */ i("div", { className: t.trigger, children: "Top-left (hover)" }) }),
30
+ /* @__PURE__ */ i(o, { content: "Top-right tooltip", position: "top", trigger: "click", clickBehavior: "toggle", children: /* @__PURE__ */ i("div", { className: t.clickTrigger, children: "Top-right (click toggle)" }) }),
31
+ /* @__PURE__ */ i(o, { content: "Center tooltip", position: "bottom", trigger: "mixed", clickBehavior: "hide", children: /* @__PURE__ */ i("div", { className: t.mixedTrigger, children: "Center (hover + click hide)" }) }),
32
+ /* @__PURE__ */ i(o, { content: "Bottom-left tooltip", position: "left", trigger: "click", clickBehavior: "show", children: /* @__PURE__ */ i("div", { className: t.clickTrigger, children: "Bottom-left (click show)" }) }),
33
+ /* @__PURE__ */ i(o, { content: "Bottom-right tooltip", position: "right", trigger: "mixed", clickBehavior: "hide", children: /* @__PURE__ */ i("div", { className: t.mixedTrigger, children: "Bottom-right (hover + click hide)" }) })
34
+ ] })
35
+ }, a = {
36
+ render: () => /* @__PURE__ */ e("div", { className: t.positionsContainer, children: [
37
+ /* @__PURE__ */ i("h3", { children: "Hover Triggers" }),
38
+ /* @__PURE__ */ e("div", { className: t.positionGroup, children: [
39
+ /* @__PURE__ */ i(o, { content: "Top tooltip", position: "top", children: /* @__PURE__ */ i("div", { className: t.trigger, children: "Top" }) }),
40
+ /* @__PURE__ */ i(o, { content: "Right tooltip", position: "right", children: /* @__PURE__ */ i("div", { className: t.trigger, children: "Right" }) }),
41
+ /* @__PURE__ */ i(o, { content: "Bottom tooltip", position: "bottom", children: /* @__PURE__ */ i("div", { className: t.trigger, children: "Bottom" }) }),
42
+ /* @__PURE__ */ i(o, { content: "Left tooltip", position: "left", children: /* @__PURE__ */ i("div", { className: t.trigger, children: "Left" }) })
43
+ ] }),
44
+ /* @__PURE__ */ i("h3", { children: "Click Triggers" }),
45
+ /* @__PURE__ */ e("div", { className: t.positionGroup, children: [
46
+ /* @__PURE__ */ i(o, { content: "Top tooltip (click toggle)", position: "top", trigger: "click", children: /* @__PURE__ */ i("div", { className: t.clickTrigger, children: "Top (toggle)" }) }),
47
+ /* @__PURE__ */ i(
48
+ o,
49
+ {
50
+ content: "Right tooltip (click show)",
51
+ position: "right",
52
+ trigger: "click",
53
+ clickBehavior: "show",
54
+ children: /* @__PURE__ */ i("div", { className: t.clickTrigger, children: "Right (show)" })
55
+ }
56
+ ),
57
+ /* @__PURE__ */ i(
58
+ o,
59
+ {
60
+ content: "Bottom tooltip (click hide)",
61
+ position: "bottom",
62
+ trigger: "click",
63
+ clickBehavior: "hide",
64
+ children: /* @__PURE__ */ i("div", { className: t.clickTrigger, children: "Bottom (hide)" })
65
+ }
66
+ ),
67
+ /* @__PURE__ */ i(
68
+ o,
69
+ {
70
+ content: "Left tooltip (mixed)",
71
+ position: "left",
72
+ trigger: "mixed",
73
+ clickBehavior: "hide",
74
+ children: /* @__PURE__ */ i("div", { className: t.mixedTrigger, children: "Left (hover+click)" })
75
+ }
76
+ )
77
+ ] })
78
+ ] })
79
+ }, m = {
80
+ args: {
81
+ content: "Interactive tooltip content",
82
+ children: /* @__PURE__ */ i("button", { style: { padding: "8px 16px" }, type: "button", children: "Hover or click me" }),
83
+ position: "top",
84
+ trigger: "hover"
85
+ }
86
+ };
87
+ export {
88
+ a as AllPositions,
89
+ p as EdgeCases,
90
+ m as InteractiveExample,
91
+ d as default
92
+ };
@@ -0,0 +1,4 @@
1
+ import { Tooltip as r } from "./Tooltip.js";
2
+ export {
3
+ r as Tooltip
4
+ };
@@ -0,0 +1,40 @@
1
+ import { jsxs as v, jsx as d } from "react/jsx-runtime";
2
+ import { createContext as f, useState as h, useCallback as u, useMemo as _, useContext as w } from "react";
3
+ import C from "react-dom";
4
+ import '../../assets/ToastContext.css';const P = "_Wrapper_12sk9_1", W = "_Toast_12sk9_11", m = {
5
+ Wrapper: P,
6
+ Toast: W
7
+ }, T = f(void 0), g = () => {
8
+ const o = w(T);
9
+ if (!o)
10
+ throw new Error("useToast must be used within a ToastProvider");
11
+ return o;
12
+ }, j = ({ children: o }) => {
13
+ const [l, r] = h([]), p = 3, n = 4e3, c = u((t) => {
14
+ r((s) => s.filter((e) => e.id !== t));
15
+ }, []), i = u(
16
+ (t) => {
17
+ const s = {
18
+ id: Date.now(),
19
+ message: t,
20
+ duration: n
21
+ };
22
+ r((e) => {
23
+ const a = [...e, s];
24
+ return a.length > p ? a.slice(1) : a;
25
+ }), setTimeout(() => c(s.id), n);
26
+ },
27
+ [c]
28
+ ), x = _(() => ({ addToast: i }), [i]);
29
+ return /* @__PURE__ */ v(T.Provider, { value: x, children: [
30
+ o,
31
+ C.createPortal(
32
+ /* @__PURE__ */ d("div", { className: m.Wrapper, children: l.map((t) => /* @__PURE__ */ d("div", { className: m.Toast, children: t.message }, t.id)) }),
33
+ document.body
34
+ )
35
+ ] });
36
+ };
37
+ export {
38
+ j as ToastProvider,
39
+ g as useToast
40
+ };
@@ -0,0 +1,5 @@
1
+ import { ToastProvider as e, useToast as s } from "./ToastContext.js";
2
+ export {
3
+ e as ToastProvider,
4
+ s as useToast
5
+ };
@@ -0,0 +1,27 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { createContext as s, useMemo as m, useContext as a } from "react";
3
+ import { useBreakpointValueTriafly as u } from "./hooks/useBreakpointValue/useBreakpointValue.js";
4
+ import { useThemeLogic as f } from "./hooks/useTheme/useTheme.js";
5
+ import { useModalState as l } from "./hooks/useModal/useModal.js";
6
+ const t = s(void 0), y = () => {
7
+ const e = a(t);
8
+ if (!e)
9
+ throw new Error("useTriafly must be used within a TriaflyProvider");
10
+ return e;
11
+ }, h = ({ children: e }) => {
12
+ const { theme: o, toggleTheme: r } = f(), i = m(
13
+ () => ({
14
+ theme: o,
15
+ toggleTheme: r,
16
+ useBreakpointValueTriafly: u,
17
+ useModalState: l
18
+ }),
19
+ [o, r]
20
+ );
21
+ return /* @__PURE__ */ n(t.Provider, { value: i, children: e });
22
+ };
23
+ export {
24
+ t as TriaflyContext,
25
+ h as TriaflyProvider,
26
+ y as useTriafly
27
+ };
@@ -0,0 +1,8 @@
1
+ import { useBreakpointValueTriafly as r } from "./useBreakpointValue/useBreakpointValue.js";
2
+ import { useThemeLogic as a } from "./useTheme/useTheme.js";
3
+ import { useModalState as m } from "./useModal/useModal.js";
4
+ export {
5
+ r as useBreakpointValueTriafly,
6
+ m as useModalState,
7
+ a as useThemeLogic
8
+ };
@@ -0,0 +1,4 @@
1
+ import { useBreakpointValueTriafly as a } from "./useBreakpointValue.js";
2
+ export {
3
+ a as useBreakpointValueTriafly
4
+ };
@@ -0,0 +1,11 @@
1
+ import { useState as t, useEffect as d } from "react";
2
+ const w = (i) => {
3
+ const [n, r] = t(window.innerWidth);
4
+ return d(() => {
5
+ const e = () => r(window.innerWidth);
6
+ return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
7
+ }, []), n >= 1280 && i.xl !== void 0 ? i.xl : n >= 1024 && i.lg !== void 0 ? i.lg : n >= 768 && i.md !== void 0 ? i.md : n >= 480 && i.sm !== void 0 ? i.sm : i.base !== void 0 ? i.base : null;
8
+ };
9
+ export {
10
+ w as useBreakpointValueTriafly
11
+ };
@@ -0,0 +1,4 @@
1
+ import { useModalState as t } from "./useModal.js";
2
+ export {
3
+ t as useModalState
4
+ };
@@ -0,0 +1,16 @@
1
+ import { useState as a, useCallback as s } from "react";
2
+ const r = () => {
3
+ const [t, e] = a(!1), o = s(() => {
4
+ e(!0);
5
+ }, []), n = s(() => {
6
+ e(!1);
7
+ }, []);
8
+ return {
9
+ isOpen: t,
10
+ onOpen: o,
11
+ onClose: n
12
+ };
13
+ };
14
+ export {
15
+ r as useModalState
16
+ };
@@ -0,0 +1,4 @@
1
+ import { useThemeLogic as m } from "./useTheme.js";
2
+ export {
3
+ m as useThemeLogic
4
+ };
@@ -0,0 +1,17 @@
1
+ import { useSyncExternalStore as n } from "react";
2
+ const o = () => {
3
+ const t = window.matchMedia("(prefers-color-scheme: dark)").matches;
4
+ return localStorage.getItem("theme") || (t ? "dark" : "light");
5
+ }, m = o();
6
+ document.documentElement.setAttribute("data-theme", m);
7
+ const c = () => {
8
+ const t = n((e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e)), o), r = (e) => {
9
+ localStorage.setItem("theme", e), localStorage.setItem("chakra-ui-color-mode", e), document.documentElement.setAttribute("data-theme", e), window.dispatchEvent(new Event("storage"));
10
+ };
11
+ return { theme: t, toggleTheme: () => {
12
+ r(t === "light" ? "dark" : "light");
13
+ } };
14
+ };
15
+ export {
16
+ c as useThemeLogic
17
+ };