mimir-ui-kit 1.14.0 → 1.14.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. package/README.md +62 -62
  2. package/dist/DatePickerModal-BM0BgzTb.js +204 -0
  3. package/dist/{NavigationButtons-B8tMfqrg.js → NavigationButtons-DuOoqaPo.js} +20 -20
  4. package/dist/assets/Accordion.css +1 -0
  5. package/dist/assets/AccordionItem.css +1 -0
  6. package/dist/assets/Button.css +1 -1
  7. package/dist/assets/DatePickerModal.css +1 -0
  8. package/dist/assets/Drawer.css +1 -0
  9. package/dist/assets/Input.css +1 -1
  10. package/dist/assets/ListPhotos.css +1 -0
  11. package/dist/assets/MergedButton.css +1 -1
  12. package/dist/assets/OtpInput.css +1 -1
  13. package/dist/assets/Pagination.css +1 -0
  14. package/dist/assets/RadioGroup.css +1 -1
  15. package/dist/assets/SelectSearch.css +1 -0
  16. package/dist/assets/Slider.css +1 -1
  17. package/dist/assets/Switch.css +1 -0
  18. package/dist/assets/TabTrail.css +1 -0
  19. package/dist/assets/Tag.css +1 -0
  20. package/dist/assets/Timer.css +1 -0
  21. package/dist/assets/Uploader.css +1 -0
  22. package/dist/assets/UploaderPhotos.css +1 -0
  23. package/dist/assets/index.css +1 -1
  24. package/dist/bugs-CSBdWk0R.js +18 -0
  25. package/dist/components/Accordion/Accordion.d.ts +10 -0
  26. package/dist/components/Accordion/Accordion.js +176 -0
  27. package/dist/components/Accordion/AccordionItem/AccordionItem.d.ts +8 -0
  28. package/dist/components/Accordion/AccordionItem/AccordionItem.js +16 -0
  29. package/dist/components/Accordion/AccordionItem/index.d.ts +1 -0
  30. package/dist/components/Accordion/AccordionItem/index.js +4 -0
  31. package/dist/components/Accordion/constants.d.ts +8 -0
  32. package/dist/components/Accordion/constants.js +14 -0
  33. package/dist/components/Accordion/index.d.ts +3 -0
  34. package/dist/components/Accordion/index.js +8 -0
  35. package/dist/components/Button/Button.d.ts +0 -1
  36. package/dist/components/Button/Button.js +26 -25
  37. package/dist/components/Button/constants.d.ts +2 -1
  38. package/dist/components/Button/constants.js +1 -0
  39. package/dist/components/DatePicker/DatePicker.d.ts +44 -0
  40. package/dist/components/DatePicker/DatePicker.js +69 -0
  41. package/dist/components/DatePicker/DatePickerModal.d.ts +8 -0
  42. package/dist/components/DatePicker/DatePickerModal.js +9 -0
  43. package/dist/components/DatePicker/constants.d.ts +6 -0
  44. package/dist/components/DatePicker/constants.js +11 -0
  45. package/dist/components/DatePicker/index.d.ts +2 -0
  46. package/dist/components/DatePicker/index.js +4 -0
  47. package/dist/components/Drawer/Drawer.d.ts +42 -0
  48. package/dist/components/Drawer/Drawer.js +145 -0
  49. package/dist/components/Drawer/constants.d.ts +5 -0
  50. package/dist/components/Drawer/constants.js +9 -0
  51. package/dist/components/Drawer/index.d.ts +2 -0
  52. package/dist/components/Drawer/index.js +6 -0
  53. package/dist/components/Input/Input.d.ts +2 -2
  54. package/dist/components/Input/Input.js +17 -16
  55. package/dist/components/InputPassword/InputPassword.js +2 -2
  56. package/dist/components/InputPhoneNumber/InputPhoneNumber.js +1 -1
  57. package/dist/components/ListPhotos/ListPhotos.d.ts +23 -0
  58. package/dist/components/ListPhotos/ListPhotos.js +33 -0
  59. package/dist/components/ListPhotos/constants.d.ts +3 -0
  60. package/dist/components/ListPhotos/constants.js +21 -0
  61. package/dist/components/ListPhotos/index.d.ts +2 -0
  62. package/dist/components/ListPhotos/index.js +4 -0
  63. package/dist/components/MergedButton/MergedButton.d.ts +1 -1
  64. package/dist/components/MergedButton/MergedButton.js +17 -19
  65. package/dist/components/OtpInput/OtpInput.js +6 -6
  66. package/dist/components/Pagination/Pagination.d.ts +42 -0
  67. package/dist/components/Pagination/Pagination.js +220 -0
  68. package/dist/components/Pagination/constants.d.ts +2 -0
  69. package/dist/components/Pagination/constants.js +6 -0
  70. package/dist/components/Pagination/index.d.ts +1 -0
  71. package/dist/components/Pagination/index.js +4 -0
  72. package/dist/components/Pagination/types.d.ts +0 -0
  73. package/dist/components/Pagination/types.js +1 -0
  74. package/dist/components/Portal/Portal.d.ts +7 -0
  75. package/dist/components/Portal/Portal.js +10 -0
  76. package/dist/components/Portal/index.d.ts +1 -0
  77. package/dist/components/Portal/index.js +4 -0
  78. package/dist/components/RadioGroup/RadioGroup.d.ts +18 -2
  79. package/dist/components/RadioGroup/RadioGroup.js +130 -1061
  80. package/dist/components/RadioGroup/index.d.ts +1 -1
  81. package/dist/components/SelectSearch/SelectSearch.d.ts +15 -0
  82. package/dist/components/SelectSearch/SelectSearch.js +3876 -0
  83. package/dist/components/SelectSearch/constants.d.ts +4 -0
  84. package/dist/components/SelectSearch/constants.js +8 -0
  85. package/dist/components/SelectSearch/index.d.ts +2 -0
  86. package/dist/components/SelectSearch/index.js +6 -0
  87. package/dist/components/Slider/NavigationButtons/NavigationButtons.js +1 -1
  88. package/dist/components/Slider/NavigationButtons/index.js +1 -1
  89. package/dist/components/Slider/Slider.js +10 -10
  90. package/dist/components/Switch/Switch.d.ts +294 -0
  91. package/dist/components/Switch/Switch.js +59 -0
  92. package/dist/components/Switch/index.d.ts +2 -0
  93. package/dist/components/Switch/index.js +4 -0
  94. package/dist/components/TabTrail/TabButtons/TabButtons.d.ts +8 -0
  95. package/dist/components/TabTrail/TabButtons/TabButtons.js +29 -0
  96. package/dist/components/TabTrail/TabButtons/constants.d.ts +8 -0
  97. package/dist/components/TabTrail/TabButtons/constants.js +14 -0
  98. package/dist/components/TabTrail/TabButtons/index.d.ts +1 -0
  99. package/dist/components/TabTrail/TabButtons/index.js +4 -0
  100. package/dist/components/TabTrail/TabTrail.d.ts +11 -0
  101. package/dist/components/TabTrail/TabTrail.js +282 -0
  102. package/dist/components/TabTrail/constants.d.ts +4 -0
  103. package/dist/components/TabTrail/constants.js +8 -0
  104. package/dist/components/TabTrail/index.d.ts +2 -0
  105. package/dist/components/TabTrail/index.js +6 -0
  106. package/dist/components/Tag/Tag.d.ts +20 -57
  107. package/dist/components/Tag/Tag.js +39 -84
  108. package/dist/components/Tag/constants.d.ts +5 -37
  109. package/dist/components/Tag/constants.js +13 -53
  110. package/dist/components/Tag/index.d.ts +2 -3
  111. package/dist/components/Tag/index.js +5 -6
  112. package/dist/components/Tag/types.d.ts +0 -6
  113. package/dist/components/Timer/Timer.d.ts +24 -0
  114. package/dist/components/Timer/Timer.js +29 -0
  115. package/dist/components/Timer/index.d.ts +1 -0
  116. package/dist/components/Timer/index.js +4 -0
  117. package/dist/components/Uploader/Uploader.d.ts +30 -0
  118. package/dist/components/Uploader/Uploader.js +90 -0
  119. package/dist/components/Uploader/constants.d.ts +5 -0
  120. package/dist/components/Uploader/constants.js +16 -0
  121. package/dist/components/Uploader/index.d.ts +2 -0
  122. package/dist/components/Uploader/index.js +4 -0
  123. package/dist/components/UploaderPhotos/UploaderPhotos.d.ts +29 -0
  124. package/dist/components/UploaderPhotos/UploaderPhotos.js +46 -0
  125. package/dist/components/UploaderPhotos/index.d.ts +2 -0
  126. package/dist/components/UploaderPhotos/index.js +4 -0
  127. package/dist/components/index.d.ts +16 -1
  128. package/dist/components/index.js +31 -0
  129. package/dist/focus-management-1rQPII7Z.js +77 -0
  130. package/dist/hidden-BuVoeHNy.js +13 -0
  131. package/dist/hooks/index.d.ts +3 -0
  132. package/dist/hooks/index.js +7 -1
  133. package/dist/hooks/useClickOutside/index.d.ts +1 -0
  134. package/dist/hooks/useClickOutside/index.js +4 -0
  135. package/dist/hooks/useClickOutside/useClickOutside.d.ts +7 -0
  136. package/dist/hooks/useClickOutside/useClickOutside.js +25 -0
  137. package/dist/hooks/useInterval/index.d.ts +1 -0
  138. package/dist/hooks/useInterval/index.js +4 -0
  139. package/dist/hooks/useInterval/useInterval.d.ts +1 -0
  140. package/dist/hooks/useInterval/useInterval.js +17 -0
  141. package/dist/hooks/useLockBodyScroll/index.d.ts +1 -0
  142. package/dist/hooks/useLockBodyScroll/index.js +4 -0
  143. package/dist/hooks/useLockBodyScroll/useLockBodyScroll.d.ts +6 -0
  144. package/dist/hooks/useLockBodyScroll/useLockBodyScroll.js +20 -0
  145. package/dist/hooks/useTimer/index.d.ts +18 -0
  146. package/dist/hooks/useTimer/index.js +83 -0
  147. package/dist/hooks/useTimer/useTimer.d.ts +18 -0
  148. package/dist/hooks/useTimer/useTimer.js +87 -0
  149. package/dist/hooks/useTimer/utils.d.ts +24 -0
  150. package/dist/hooks/useTimer/utils.js +88 -0
  151. package/dist/hooks/useWindowSize/index.d.ts +4 -0
  152. package/dist/hooks/useWindowSize/index.js +26 -0
  153. package/dist/icons/Icon.js +1 -1
  154. package/dist/icons/components/12px/Close12px.d.ts +4 -0
  155. package/dist/icons/components/12px/Close12px.js +18 -0
  156. package/dist/icons/components/index.d.ts +1 -0
  157. package/dist/icons/components/index.js +560 -559
  158. package/dist/{index-_ACzPKPw.js → index-Cxiikb7g.js} +561 -558
  159. package/dist/index.d.ts +1 -0
  160. package/dist/index.js +40 -1
  161. package/dist/keyboard-B256ZoM-.js +745 -0
  162. package/dist/label-C_5Syaoj.js +159 -0
  163. package/dist/open-closed-CbXq00et.js +93 -0
  164. package/dist/use-active-press-B6yeSopF.js +31 -0
  165. package/dist/use-by-comparator-BUO78DGe.js +16 -0
  166. package/dist/use-resolve-button-type-B6LE6gU3.js +19 -0
  167. package/dist/utils/UUID4.d.ts +1 -0
  168. package/dist/utils/UUID4.js +9 -0
  169. package/dist/utils/formating/Date.d.ts +1 -0
  170. package/dist/utils/formating/Date.js +26 -0
  171. package/dist/utils/formating/Month.d.ts +8 -0
  172. package/dist/utils/formating/Month.js +80 -0
  173. package/dist/utils/formating/Numbers.d.ts +6 -0
  174. package/dist/utils/formating/Numbers.js +8 -0
  175. package/dist/utils/index.d.ts +11 -0
  176. package/dist/utils/index.js +13 -0
  177. package/package.json +128 -128
@@ -0,0 +1,282 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { c as classNames } from "../../index-CweZ_OcN.js";
3
+ import * as React from "react";
4
+ import React__default, { useRef, useState, createContext, useReducer, useMemo, useId, useContext, forwardRef, useEffect } from "react";
5
+ import { ETabTrailSize } from "./constants.js";
6
+ import { TabButtons } from "./TabButtons/TabButtons.js";
7
+ import { useMediaQuery } from "../../hooks/useMediaQuery/useMediaQuery.js";
8
+ import { EMediaQuery } from "../../hooks/useMediaQuery/constants.js";
9
+ import { n, M, W, s as s$3, y, o, H, $ as $f7dceffc5ad7768b$export$4e328f61c538687f, b as $6179b936705e76d3$export$ae780daf29e6d456, D, a as u, u as u$1, c as o$1, t } from "../../keyboard-B256ZoM-.js";
10
+ import { w } from "../../use-active-press-B6yeSopF.js";
11
+ import { T as T$1 } from "../../use-resolve-button-type-B6LE6gU3.js";
12
+ import { T, s as s$2 } from "../../hidden-BuVoeHNy.js";
13
+ import { _, T as T$2, P, F } from "../../focus-management-1rQPII7Z.js";
14
+ import '../../assets/TabTrail.css';function f$1() {
15
+ let e = useRef(false);
16
+ return n(() => (e.current = true, () => {
17
+ e.current = false;
18
+ }), []), e;
19
+ }
20
+ function b({ onFocus: n2 }) {
21
+ let [r, o2] = useState(true), u2 = f$1();
22
+ return r ? React__default.createElement(T, { as: "button", type: "button", features: s$2.Focusable, onFocus: (a2) => {
23
+ a2.preventDefault();
24
+ let e, i = 50;
25
+ function t2() {
26
+ if (i-- <= 0) {
27
+ e && cancelAnimationFrame(e);
28
+ return;
29
+ }
30
+ if (n2()) {
31
+ if (cancelAnimationFrame(e), !u2.current) return;
32
+ o2(false);
33
+ return;
34
+ }
35
+ e = requestAnimationFrame(t2);
36
+ }
37
+ e = requestAnimationFrame(t2);
38
+ } }) : null;
39
+ }
40
+ const s$1 = React.createContext(null);
41
+ function a() {
42
+ return { groups: /* @__PURE__ */ new Map(), get(o2, e) {
43
+ var i;
44
+ let t2 = this.groups.get(o2);
45
+ t2 || (t2 = /* @__PURE__ */ new Map(), this.groups.set(o2, t2));
46
+ let n2 = (i = t2.get(e)) != null ? i : 0;
47
+ t2.set(e, n2 + 1);
48
+ let r = Array.from(t2.keys()).indexOf(e);
49
+ function u2() {
50
+ let c = t2.get(e);
51
+ c > 1 ? t2.set(e, c - 1) : t2.delete(e);
52
+ }
53
+ return [r, u2];
54
+ } };
55
+ }
56
+ function f({ children: o2 }) {
57
+ let e = React.useRef(a());
58
+ return React.createElement(s$1.Provider, { value: e }, o2);
59
+ }
60
+ function C$1(o2) {
61
+ let e = React.useContext(s$1);
62
+ if (!e) throw new Error("You must wrap your component in a <StableCollection>");
63
+ let t2 = React.useId(), [n2, r] = e.current.get(o2, t2);
64
+ return React.useEffect(() => r, []), n2;
65
+ }
66
+ var Ae = ((t2) => (t2[t2.Forwards = 0] = "Forwards", t2[t2.Backwards = 1] = "Backwards", t2))(Ae || {}), Ee = ((o2) => (o2[o2.Less = -1] = "Less", o2[o2.Equal = 0] = "Equal", o2[o2.Greater = 1] = "Greater", o2))(Ee || {}), Re = ((n2) => (n2[n2.SetSelectedIndex = 0] = "SetSelectedIndex", n2[n2.RegisterTab = 1] = "RegisterTab", n2[n2.UnregisterTab = 2] = "UnregisterTab", n2[n2.RegisterPanel = 3] = "RegisterPanel", n2[n2.UnregisterPanel = 4] = "UnregisterPanel", n2))(Re || {});
67
+ let Le = { [0](e, r) {
68
+ var c;
69
+ let t2 = _(e.tabs, (T2) => T2.current), o2 = _(e.panels, (T2) => T2.current), a2 = t2.filter((T2) => {
70
+ var d;
71
+ return !((d = T2.current) != null && d.hasAttribute("disabled"));
72
+ }), n2 = { ...e, tabs: t2, panels: o2 };
73
+ if (r.index < 0 || r.index > t2.length - 1) {
74
+ let T2 = u(Math.sign(r.index - e.selectedIndex), { [-1]: () => 1, [0]: () => u(Math.sign(r.index), { [-1]: () => 0, [0]: () => 0, [1]: () => 1 }), [1]: () => 0 });
75
+ if (a2.length === 0) return n2;
76
+ let d = u(T2, { [0]: () => t2.indexOf(a2[0]), [1]: () => t2.indexOf(a2[a2.length - 1]) });
77
+ return { ...n2, selectedIndex: d === -1 ? e.selectedIndex : d };
78
+ }
79
+ let u$12 = t2.slice(0, r.index), x = [...t2.slice(r.index), ...u$12].find((T2) => a2.includes(T2));
80
+ if (!x) return n2;
81
+ let f2 = (c = t2.indexOf(x)) != null ? c : e.selectedIndex;
82
+ return f2 === -1 && (f2 = e.selectedIndex), { ...n2, selectedIndex: f2 };
83
+ }, [1](e, r) {
84
+ if (e.tabs.includes(r.tab)) return e;
85
+ let t2 = e.tabs[e.selectedIndex], o2 = _([...e.tabs, r.tab], (n2) => n2.current), a2 = e.selectedIndex;
86
+ return e.info.current.isControlled || (a2 = o2.indexOf(t2), a2 === -1 && (a2 = e.selectedIndex)), { ...e, tabs: o2, selectedIndex: a2 };
87
+ }, [2](e, r) {
88
+ return { ...e, tabs: e.tabs.filter((t2) => t2 !== r.tab) };
89
+ }, [3](e, r) {
90
+ return e.panels.includes(r.panel) ? e : { ...e, panels: _([...e.panels, r.panel], (t2) => t2.current) };
91
+ }, [4](e, r) {
92
+ return { ...e, panels: e.panels.filter((t2) => t2 !== r.panel) };
93
+ } }, z = createContext(null);
94
+ z.displayName = "TabsDataContext";
95
+ function C(e) {
96
+ let r = useContext(z);
97
+ if (r === null) {
98
+ let t2 = new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);
99
+ throw Error.captureStackTrace && Error.captureStackTrace(t2, C), t2;
100
+ }
101
+ return r;
102
+ }
103
+ let V = createContext(null);
104
+ V.displayName = "TabsActionsContext";
105
+ function Q(e) {
106
+ let r = useContext(V);
107
+ if (r === null) {
108
+ let t2 = new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);
109
+ throw Error.captureStackTrace && Error.captureStackTrace(t2, Q), t2;
110
+ }
111
+ return r;
112
+ }
113
+ function _e(e, r) {
114
+ return u(r.type, Le, e, r);
115
+ }
116
+ let De = "div";
117
+ function Se(e, r) {
118
+ let { defaultIndex: t2 = 0, vertical: o$12 = false, manual: a2 = false, onChange: n$1, selectedIndex: u2 = null, ..._$1 } = e;
119
+ const x = o$12 ? "vertical" : "horizontal", f$12 = a2 ? "manual" : "auto";
120
+ let c = u2 !== null, T2 = s$3({ isControlled: c }), d = y(r), [i, s2] = useReducer(_e, { info: T2, selectedIndex: u2 != null ? u2 : t2, tabs: [], panels: [] }), F2 = useMemo(() => ({ selectedIndex: i.selectedIndex }), [i.selectedIndex]), M2 = s$3(n$1 || (() => {
121
+ })), b$1 = s$3(i.tabs), m2 = useMemo(() => ({ orientation: x, activation: f$12, ...i }), [x, f$12, i]), E = o((p) => (s2({ type: 1, tab: p }), () => s2({ type: 2, tab: p }))), I = o((p) => (s2({ type: 3, panel: p }), () => s2({ type: 4, panel: p }))), g = o((p) => {
122
+ R.current !== p && M2.current(p), c || s2({ type: 0, index: p });
123
+ }), R = s$3(c ? e.selectedIndex : i.selectedIndex), J = useMemo(() => ({ registerTab: E, registerPanel: I, change: g }), []);
124
+ n(() => {
125
+ s2({ type: 0, index: u2 != null ? u2 : t2 });
126
+ }, [u2]), n(() => {
127
+ if (R.current === void 0 || i.tabs.length <= 0) return;
128
+ let p = _(i.tabs, (L) => L.current);
129
+ p.some((L, B) => i.tabs[B] !== L) && g(p.indexOf(i.tabs[R.current]));
130
+ });
131
+ let k = { ref: d };
132
+ return React__default.createElement(f, null, React__default.createElement(V.Provider, { value: J }, React__default.createElement(z.Provider, { value: m2 }, m2.tabs.length <= 0 && React__default.createElement(b, { onFocus: () => {
133
+ var p, h;
134
+ for (let L of b$1.current) if (((p = L.current) == null ? void 0 : p.tabIndex) === 0) return (h = L.current) == null || h.focus(), true;
135
+ return false;
136
+ } }), H({ ourProps: k, theirProps: _$1, slot: F2, defaultTag: De, name: "Tabs" }))));
137
+ }
138
+ let Fe = "div";
139
+ function Ie(e, r) {
140
+ let { orientation: t2, selectedIndex: o2 } = C("Tab.List"), a2 = y(r), n2 = useMemo(() => ({ selectedIndex: o2 }), [o2]);
141
+ return H({ ourProps: { ref: a2, role: "tablist", "aria-orientation": t2 }, theirProps: e, slot: n2, defaultTag: Fe, name: "Tabs.List" });
142
+ }
143
+ let he = "button";
144
+ function ve(e, r) {
145
+ var Y, Z;
146
+ let t$1 = useId(), { id: o$2 = `headlessui-tabs-tab-${t$1}`, disabled: a2 = false, autoFocus: n$1 = false, ...u$2 } = e, { orientation: _2, activation: x, selectedIndex: f2, tabs: c, panels: T2 } = C("Tab"), d = Q("Tab"), i = C("Tab"), s2 = useRef(null), F$1 = y(s2, r);
147
+ n(() => d.registerTab(s2), [d, s2]);
148
+ let M2 = C$1("tabs"), b2 = c.indexOf(s2);
149
+ b2 === -1 && (b2 = M2);
150
+ let m2 = b2 === f2, E = o((l) => {
151
+ var X;
152
+ let A = l();
153
+ if (A === T$2.Success && x === "auto") {
154
+ let $ = (X = u$1(s2)) == null ? void 0 : X.activeElement, ee = i.tabs.findIndex((Te) => Te.current === $);
155
+ ee !== -1 && d.change(ee);
156
+ }
157
+ return A;
158
+ }), I = o((l) => {
159
+ let A = c.map(($) => $.current).filter(Boolean);
160
+ if (l.key === o$1.Space || l.key === o$1.Enter) {
161
+ l.preventDefault(), l.stopPropagation(), d.change(b2);
162
+ return;
163
+ }
164
+ switch (l.key) {
165
+ case o$1.Home:
166
+ case o$1.PageUp:
167
+ return l.preventDefault(), l.stopPropagation(), E(() => P(A, F.First));
168
+ case o$1.End:
169
+ case o$1.PageDown:
170
+ return l.preventDefault(), l.stopPropagation(), E(() => P(A, F.Last));
171
+ }
172
+ if (E(() => u(_2, { vertical() {
173
+ return l.key === o$1.ArrowUp ? P(A, F.Previous | F.WrapAround) : l.key === o$1.ArrowDown ? P(A, F.Next | F.WrapAround) : T$2.Error;
174
+ }, horizontal() {
175
+ return l.key === o$1.ArrowLeft ? P(A, F.Previous | F.WrapAround) : l.key === o$1.ArrowRight ? P(A, F.Next | F.WrapAround) : T$2.Error;
176
+ } })) === T$2.Success) return l.preventDefault();
177
+ }), g = useRef(false), R = o(() => {
178
+ var l;
179
+ g.current || (g.current = true, (l = s2.current) == null || l.focus({ preventScroll: true }), d.change(b2), t(() => {
180
+ g.current = false;
181
+ }));
182
+ }), J = o((l) => {
183
+ l.preventDefault();
184
+ }), { isFocusVisible: k, focusProps: p } = $f7dceffc5ad7768b$export$4e328f61c538687f({ autoFocus: n$1 }), { isHovered: h, hoverProps: L } = $6179b936705e76d3$export$ae780daf29e6d456({ isDisabled: a2 }), { pressed: B, pressProps: ie } = w({ disabled: a2 }), pe = useMemo(() => ({ selected: m2, hover: h, active: B, focus: k, autofocus: n$1, disabled: a2 }), [m2, h, k, B, n$1, a2]), ue = D({ ref: F$1, onKeyDown: I, onMouseDown: J, onClick: R, id: o$2, role: "tab", type: T$1(e, s2), "aria-controls": (Z = (Y = T2[b2]) == null ? void 0 : Y.current) == null ? void 0 : Z.id, "aria-selected": m2, tabIndex: m2 ? 0 : -1, disabled: a2 || void 0, autoFocus: n$1 }, p, L, ie);
185
+ return H({ ourProps: ue, theirProps: u$2, slot: pe, defaultTag: he, name: "Tabs.Tab" });
186
+ }
187
+ let Ce = "div";
188
+ function Me(e, r) {
189
+ let { selectedIndex: t2 } = C("Tab.Panels"), o2 = y(r), a2 = useMemo(() => ({ selectedIndex: t2 }), [t2]);
190
+ return H({ ourProps: { ref: o2 }, theirProps: e, slot: a2, defaultTag: Ce, name: "Tabs.Panels" });
191
+ }
192
+ let Ge = "div", Ue = M.RenderStrategy | M.Static;
193
+ function He(e, r) {
194
+ var E, I, g, R;
195
+ let t2 = useId(), { id: o2 = `headlessui-tabs-panel-${t2}`, tabIndex: a2 = 0, ...n$1 } = e, { selectedIndex: u2, tabs: _2, panels: x } = C("Tab.Panel"), f2 = Q("Tab.Panel"), c = useRef(null), T$12 = y(c, r);
196
+ n(() => f2.registerPanel(c), [f2, c]);
197
+ let d = C$1("panels"), i = x.indexOf(c);
198
+ i === -1 && (i = d);
199
+ let s2 = i === u2, { isFocusVisible: F2, focusProps: M2 } = $f7dceffc5ad7768b$export$4e328f61c538687f(), b2 = useMemo(() => ({ selected: s2, focus: F2 }), [s2, F2]), m2 = D({ ref: T$12, id: o2, role: "tabpanel", "aria-labelledby": (I = (E = _2[i]) == null ? void 0 : E.current) == null ? void 0 : I.id, tabIndex: s2 ? a2 : -1 }, M2);
200
+ return !s2 && ((g = n$1.unmount) == null || g) && !((R = n$1.static) != null && R) ? React__default.createElement(T, { "aria-hidden": "true", ...m2 }) : H({ ourProps: m2, theirProps: n$1, slot: b2, defaultTag: Ge, features: Ue, visible: s2, name: "Tabs.Panel" });
201
+ }
202
+ let we = W(ve), Oe = W(Se), Ne = W(Ie), ke = W(Me), Be = W(He), st = Object.assign(we, { Group: Oe, List: Ne, Panels: ke, Panel: Be });
203
+ const container = "_container_y23cb_2";
204
+ const group = "_group_y23cb_6";
205
+ const tab = "_tab_y23cb_15";
206
+ const list = "_list_y23cb_30";
207
+ const tabs = "_tabs_y23cb_41";
208
+ const buttons = "_buttons_y23cb_45";
209
+ const m = "_m_y23cb_52";
210
+ const s = "_s_y23cb_57";
211
+ const cls = {
212
+ container,
213
+ group,
214
+ "group-inner": "_group-inner_y23cb_10",
215
+ tab,
216
+ list,
217
+ tabs,
218
+ buttons,
219
+ m,
220
+ s
221
+ };
222
+ const TabTrail = forwardRef(
223
+ ({ categories, size = ETabTrailSize.M }, ref) => {
224
+ const [activeIndex, setActiveIndex] = useState(0);
225
+ const tabListRef = useRef(null);
226
+ const isTablet = useMediaQuery(EMediaQuery.S);
227
+ const handleNext = () => {
228
+ setActiveIndex((prevIndex) => (prevIndex + 1) % categories.length);
229
+ };
230
+ const handlePrev = () => {
231
+ setActiveIndex(
232
+ (prevIndex) => (prevIndex - 1 + categories.length) % categories.length
233
+ );
234
+ };
235
+ useEffect(() => {
236
+ var _a;
237
+ const activeTab = (_a = tabListRef.current) == null ? void 0 : _a.querySelector(
238
+ `.${cls.tab}[data-active="true"]`
239
+ );
240
+ if (activeTab) {
241
+ activeTab.scrollIntoView({
242
+ behavior: "smooth",
243
+ block: "nearest",
244
+ inline: "center"
245
+ });
246
+ }
247
+ }, [activeIndex]);
248
+ return /* @__PURE__ */ jsxs(
249
+ Oe,
250
+ {
251
+ ref,
252
+ className: classNames(cls.group, cls[size]),
253
+ selectedIndex: activeIndex,
254
+ onChange: setActiveIndex,
255
+ children: [
256
+ /* @__PURE__ */ jsxs("div", { className: cls["group-inner"], children: [
257
+ /* @__PURE__ */ jsx(Ne, { ref: tabListRef, className: cls.list, children: /* @__PURE__ */ jsx("div", { className: cls.tabs, children: categories.map(({ name }, index) => /* @__PURE__ */ jsx(
258
+ st,
259
+ {
260
+ className: `${cls.tab} ${activeIndex === index ? 'data-active="true"' : ""}`,
261
+ "data-active": activeIndex === index,
262
+ children: name
263
+ },
264
+ name
265
+ )) }) }),
266
+ !isTablet && /* @__PURE__ */ jsx("div", { className: cls.buttons, children: /* @__PURE__ */ jsx(
267
+ TabButtons,
268
+ {
269
+ handlePrevTab: handlePrev,
270
+ handleNextTab: handleNext
271
+ }
272
+ ) })
273
+ ] }),
274
+ /* @__PURE__ */ jsx(ke, { className: cls.panels, children: categories.map(({ name, content }) => /* @__PURE__ */ jsx(Be, { className: cls.panel, children: content }, name)) })
275
+ ]
276
+ }
277
+ );
278
+ }
279
+ );
280
+ export {
281
+ TabTrail
282
+ };
@@ -0,0 +1,4 @@
1
+ export declare enum ETabTrailSize {
2
+ M = "m",
3
+ S = "s"
4
+ }
@@ -0,0 +1,8 @@
1
+ var ETabTrailSize = /* @__PURE__ */ ((ETabTrailSize2) => {
2
+ ETabTrailSize2["M"] = "m";
3
+ ETabTrailSize2["S"] = "s";
4
+ return ETabTrailSize2;
5
+ })(ETabTrailSize || {});
6
+ export {
7
+ ETabTrailSize
8
+ };
@@ -0,0 +1,2 @@
1
+ export { TabTrail, type TTabTrailProps, type TCategoryTab } from './TabTrail';
2
+ export { ETabTrailSize } from './constants';
@@ -0,0 +1,6 @@
1
+ import { TabTrail } from "./TabTrail.js";
2
+ import { ETabTrailSize } from "./constants.js";
3
+ export {
4
+ ETabTrailSize,
5
+ TabTrail
6
+ };
@@ -1,79 +1,42 @@
1
- import { EStepsPrimaryColor, EStepsSecondaryColor } from './constants';
2
- import { TCommonStepsProps } from './types';
1
+ import { ReactNode } from 'react';
2
+ import { ETagSize, ETagType } from './constants';
3
3
 
4
- export type TProps = TCommonStepsProps & {
4
+ export type TProps = {
5
5
  /**
6
6
  * Класс, применяемый к корневому элементу
7
7
  */
8
8
  rootClassName?: string;
9
9
  /**
10
- * Класс, применяемый к шагам
10
+ * Класс, применяемый к контентному элементу
11
11
  */
12
- stepClassName?: string;
12
+ innerClassName?: string;
13
13
  /**
14
- * Количество шагов.
14
+ * Класс, применяемый к контентному элементу
15
15
  */
16
- quantity: number;
16
+ size?: ETagSize;
17
17
  /**
18
- * Текущий шаг
18
+ * Класс, применяемый к корневому элемент
19
19
  */
20
- current?: number;
20
+ children?: ReactNode;
21
21
  /**
22
- * Есть ли возможность переключать шаги по клику
23
- */
24
- editable?: boolean;
25
- /**
26
- * Обработчик клика на шаг
27
- */
28
- onClick?: (step: number) => void;
29
- /**
30
- * Отключено / включено взаимодействие с шагами
22
+ * Класс, применяемый к корневому элемент
31
23
  */
32
24
  disabled?: boolean;
33
25
  /**
34
- * Цвет пройденных шагов
35
- */
36
- primaryColor?: EStepsPrimaryColor;
37
- /**
38
- * Цвет оставшихся шагов
26
+ * Определяет какой тип элемента будет создан, по умолчанию - button
39
27
  */
40
- secondaryColor?: EStepsSecondaryColor;
41
- };
42
- export declare const Steps: import('react').ForwardRefExoticComponent<TCommonStepsProps & {
43
- /**
44
- * Класс, применяемый к корневому элементу
45
- */
46
- rootClassName?: string;
28
+ elementType?: ETagType;
47
29
  /**
48
- * Класс, применяемый к шагам
30
+ * Цвет фона, при outline и текста
49
31
  */
50
- stepClassName?: string;
32
+ backgroundColor?: string;
51
33
  /**
52
- * Количество шагов.
34
+ * Цвет текста (если не outline)
53
35
  */
54
- quantity: number;
36
+ color?: string;
55
37
  /**
56
- * Текущий шаг
38
+ * Определяет должен быть тег в стилистике outline или нет
57
39
  */
58
- current?: number;
59
- /**
60
- * Есть ли возможность переключать шаги по клику
61
- */
62
- editable?: boolean;
63
- /**
64
- * Обработчик клика на шаг
65
- */
66
- onClick?: (step: number) => void;
67
- /**
68
- * Отключено / включено взаимодействие с шагами
69
- */
70
- disabled?: boolean;
71
- /**
72
- * Цвет пройденных шагов
73
- */
74
- primaryColor?: EStepsPrimaryColor;
75
- /**
76
- * Цвет оставшихся шагов
77
- */
78
- secondaryColor?: EStepsSecondaryColor;
79
- } & import('react').RefAttributes<HTMLDivElement>>;
40
+ outline?: boolean;
41
+ };
42
+ export declare const Tag: import('react').ForwardRefExoticComponent<TProps & import('react').RefAttributes<HTMLButtonElement | HTMLDivElement>>;
@@ -1,99 +1,54 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { c as classNames } from "../../index-CweZ_OcN.js";
3
- import { forwardRef, useId, useState, useRef, useEffect } from "react";
4
- import { ZERO_STEP, EStepsSize, EStepsPrimaryColor, ID_SEPARATOR, EStepsColorType, StepSize, DIFF_BETWEEN_STEP_AND_INDEX } from "./constants.js";
5
- import { Icon } from "../../icons/Icon.js";
6
- import '../../assets/Steps.css';const container = "_container_j31xr_2";
7
- const step = "_step_j31xr_6";
8
- const editable = "_editable_j31xr_9";
9
- const PRIMARY = "_PRIMARY_j31xr_12";
10
- const GRAY = "_GRAY_j31xr_12";
11
- const CITRINE = "_CITRINE_j31xr_15";
12
- const SAPPHIRE = "_SAPPHIRE_j31xr_18";
13
- const SECONDARY = "_SECONDARY_j31xr_21";
14
- const WHITE = "_WHITE_j31xr_21";
15
- const LIGHT_SAPPHIRE = "_LIGHT_SAPPHIRE_j31xr_24";
16
- const LIGHT_GRAY = "_LIGHT_GRAY_j31xr_27";
17
- const disabled = "_disabled_j31xr_27";
3
+ import { forwardRef } from "react";
4
+ import { ETagSize, ETagType } from "./constants.js";
5
+ import '../../assets/Tag.css';const container = "_container_1f2sk_2";
6
+ const disabled = "_disabled_1f2sk_24";
7
+ const inner = "_inner_1f2sk_29";
8
+ const M = "_M_1f2sk_37";
9
+ const S = "_S_1f2sk_41";
10
+ const XS = "_XS_1f2sk_49";
18
11
  const cls = {
19
12
  container,
20
- step,
21
- editable,
22
- PRIMARY,
23
- GRAY,
24
- CITRINE,
25
- SAPPHIRE,
26
- SECONDARY,
27
- WHITE,
28
- LIGHT_SAPPHIRE,
29
- LIGHT_GRAY,
30
- disabled
13
+ disabled,
14
+ inner,
15
+ M,
16
+ S,
17
+ XS
31
18
  };
32
- const Steps = forwardRef(
19
+ const Tag = forwardRef(
33
20
  (props, ref) => {
34
21
  const {
35
22
  rootClassName,
36
- stepClassName,
37
- quantity,
38
- current = ZERO_STEP,
39
- editable: editable2 = false,
40
- size = EStepsSize.M,
41
- onClick,
23
+ innerClassName,
24
+ children,
25
+ size = ETagSize.M,
42
26
  disabled: disabled2 = false,
43
- primaryColor = EStepsPrimaryColor.CITRINE,
44
- secondaryColor = EStepsPrimaryColor.GRAY
27
+ elementType = ETagType.BUTTON,
28
+ backgroundColor = "",
29
+ color = "",
30
+ outline = false,
31
+ ...otherProps
45
32
  } = props;
46
- const idPrefix = useId();
47
- const [step2, setStep] = useState(current);
48
- const [hoveredStep, setHoveredStep] = useState(null);
49
- const stepWasChangedRef = useRef(null);
50
- useEffect(() => {
51
- setStep(current);
52
- }, [current]);
53
- const handleClick = (idx) => {
54
- const clickedStep = idx + DIFF_BETWEEN_STEP_AND_INDEX;
55
- stepWasChangedRef.current = true;
56
- setStep(clickedStep !== step2 ? clickedStep : ZERO_STEP);
57
- };
58
- useEffect(() => {
59
- if (stepWasChangedRef.current === true) {
60
- onClick && onClick(step2);
61
- stepWasChangedRef.current = false;
62
- }
63
- }, [onClick, step2]);
64
- const handleMouseEnter = (evt) => {
65
- const hoveredIdx = Number(evt.currentTarget.id.split(ID_SEPARATOR)[1]);
66
- setHoveredStep(hoveredIdx);
67
- };
68
- const handleMouseLeave = () => {
69
- setHoveredStep(null);
70
- };
71
- const buttons = Array.from({ length: quantity }, (_, idx) => {
72
- const isPrimary = idx + DIFF_BETWEEN_STEP_AND_INDEX <= (hoveredStep !== null ? hoveredStep + DIFF_BETWEEN_STEP_AND_INDEX : step2);
73
- const isSecondary = idx + DIFF_BETWEEN_STEP_AND_INDEX > (hoveredStep !== null ? hoveredStep + DIFF_BETWEEN_STEP_AND_INDEX : step2);
74
- return /* @__PURE__ */ jsx(
75
- "button",
76
- {
77
- id: `${idPrefix}${ID_SEPARATOR}${idx}`,
78
- className: classNames(cls.step, cls[size], stepClassName, {
79
- [cls.editable]: editable2 && !disabled2,
80
- [cls.disabled]: disabled2 || !editable2 && idx + 1 > step2,
81
- [cls[EStepsColorType.PRIMARY]]: isPrimary,
82
- [cls[EStepsColorType.SECONDARY]]: isSecondary,
83
- [cls[primaryColor]]: isPrimary,
84
- [cls[secondaryColor]]: isSecondary
85
- }),
86
- onClick: () => handleClick(idx),
87
- onMouseEnter: handleMouseEnter,
88
- onMouseLeave: handleMouseLeave,
89
- children: /* @__PURE__ */ jsx(Icon, { iconName: "Step", ...StepSize[size] })
33
+ const Element = elementType === ETagType.BUTTON ? ETagType.BUTTON : ETagType.DIV;
34
+ return /* @__PURE__ */ jsx(
35
+ Element,
36
+ {
37
+ className: classNames(cls.container, cls[size], rootClassName, {
38
+ [cls.disabled]: disabled2
39
+ }),
40
+ ref,
41
+ style: {
42
+ backgroundColor: outline ? "transparent" : backgroundColor,
43
+ borderColor: backgroundColor,
44
+ color: outline ? backgroundColor : color
90
45
  },
91
- idx
92
- );
93
- });
94
- return /* @__PURE__ */ jsx("div", { className: classNames(cls.container, rootClassName), ref, children: buttons });
46
+ ...otherProps,
47
+ children: /* @__PURE__ */ jsx("span", { className: classNames(cls.inner, innerClassName), children })
48
+ }
49
+ );
95
50
  }
96
51
  );
97
52
  export {
98
- Steps
53
+ Tag
99
54
  };
@@ -1,41 +1,9 @@
1
- export declare const ZERO_STEP = 0;
2
- export declare const DIFF_BETWEEN_STEP_AND_INDEX = 1;
3
- export declare const ID_SEPARATOR = "-//-";
4
- export declare enum EStepsSize {
1
+ export declare enum ETagSize {
5
2
  XS = "XS",
6
3
  S = "S",
7
- M = "M",
8
- L = "L"
4
+ M = "M"
9
5
  }
10
- export declare const StepSize: {
11
- XS: {
12
- width: number;
13
- height: number;
14
- };
15
- S: {
16
- width: number;
17
- height: number;
18
- };
19
- M: {
20
- width: number;
21
- height: number;
22
- };
23
- L: {
24
- width: number;
25
- height: number;
26
- };
27
- };
28
- export declare enum EStepsColorType {
29
- PRIMARY = "PRIMARY",
30
- SECONDARY = "SECONDARY"
31
- }
32
- export declare enum EStepsPrimaryColor {
33
- GRAY = "GRAY",
34
- CITRINE = "CITRINE",
35
- SAPPHIRE = "SAPPHIRE"
36
- }
37
- export declare enum EStepsSecondaryColor {
38
- LIGHT_GRAY = "LIGHT_GRAY",
39
- LIGHT_SAPPHIRE = "LIGHT_SAPPHIRE",
40
- WHITE = "WHITE"
6
+ export declare enum ETagType {
7
+ DIV = "div",
8
+ BUTTON = "button"
41
9
  }
@@ -1,55 +1,15 @@
1
- const ZERO_STEP = 0;
2
- const DIFF_BETWEEN_STEP_AND_INDEX = 1;
3
- const ID_SEPARATOR = "-//-";
4
- var EStepsSize = /* @__PURE__ */ ((EStepsSize2) => {
5
- EStepsSize2["XS"] = "XS";
6
- EStepsSize2["S"] = "S";
7
- EStepsSize2["M"] = "M";
8
- EStepsSize2["L"] = "L";
9
- return EStepsSize2;
10
- })(EStepsSize || {});
11
- const StepSize = {
12
- XS: {
13
- width: 19,
14
- height: 8
15
- },
16
- S: {
17
- width: 36,
18
- height: 12
19
- },
20
- M: {
21
- width: 48,
22
- height: 21
23
- },
24
- L: {
25
- width: 64,
26
- height: 28
27
- }
28
- };
29
- var EStepsColorType = /* @__PURE__ */ ((EStepsColorType2) => {
30
- EStepsColorType2["PRIMARY"] = "PRIMARY";
31
- EStepsColorType2["SECONDARY"] = "SECONDARY";
32
- return EStepsColorType2;
33
- })(EStepsColorType || {});
34
- var EStepsPrimaryColor = /* @__PURE__ */ ((EStepsPrimaryColor2) => {
35
- EStepsPrimaryColor2["GRAY"] = "GRAY";
36
- EStepsPrimaryColor2["CITRINE"] = "CITRINE";
37
- EStepsPrimaryColor2["SAPPHIRE"] = "SAPPHIRE";
38
- return EStepsPrimaryColor2;
39
- })(EStepsPrimaryColor || {});
40
- var EStepsSecondaryColor = /* @__PURE__ */ ((EStepsSecondaryColor2) => {
41
- EStepsSecondaryColor2["LIGHT_GRAY"] = "LIGHT_GRAY";
42
- EStepsSecondaryColor2["LIGHT_SAPPHIRE"] = "LIGHT_SAPPHIRE";
43
- EStepsSecondaryColor2["WHITE"] = "WHITE";
44
- return EStepsSecondaryColor2;
45
- })(EStepsSecondaryColor || {});
1
+ var ETagSize = /* @__PURE__ */ ((ETagSize2) => {
2
+ ETagSize2["XS"] = "XS";
3
+ ETagSize2["S"] = "S";
4
+ ETagSize2["M"] = "M";
5
+ return ETagSize2;
6
+ })(ETagSize || {});
7
+ var ETagType = /* @__PURE__ */ ((ETagType2) => {
8
+ ETagType2["DIV"] = "div";
9
+ ETagType2["BUTTON"] = "button";
10
+ return ETagType2;
11
+ })(ETagType || {});
46
12
  export {
47
- DIFF_BETWEEN_STEP_AND_INDEX,
48
- EStepsColorType,
49
- EStepsPrimaryColor,
50
- EStepsSecondaryColor,
51
- EStepsSize,
52
- ID_SEPARATOR,
53
- StepSize,
54
- ZERO_STEP
13
+ ETagSize,
14
+ ETagType
55
15
  };
@@ -1,3 +1,2 @@
1
- export { Steps } from './Tag';
2
- export { EStepsPrimaryColor, EStepsSecondaryColor, EStepsSize } from './constants';
3
- export type { TCommonStepsProps } from './types';
1
+ export { Tag } from './Tag';
2
+ export { ETagSize, ETagType } from './constants';