@vhyxui/react 0.3.1-alpha → 0.4.0-alpha

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 (237) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +65 -0
  3. package/dist/Accordion-qtPur3CA.js +81 -0
  4. package/dist/Accordion-z3QDvyGf.cjs +1 -0
  5. package/dist/Alert-D4EFVKUy.js +99 -0
  6. package/dist/Alert-DWB9Gtpv.cjs +1 -0
  7. package/dist/Avatar-CDoAvY0m.js +51 -0
  8. package/dist/Avatar-afXJdutp.cjs +1 -0
  9. package/dist/Badge-DOhfKlXt.cjs +1 -0
  10. package/dist/Badge-Z6crWSLX.js +38 -0
  11. package/dist/Breadcrumb-CbPmH-b4.js +90 -0
  12. package/dist/Breadcrumb-DWRxQvbb.cjs +1 -0
  13. package/dist/Button-CnNtk6HV.cjs +1 -0
  14. package/dist/Button-DN5vy24q.js +60 -0
  15. package/dist/Card-CI7DyOJg.js +79 -0
  16. package/dist/Card-CZUQhd45.cjs +1 -0
  17. package/dist/Center-BmKeGEa1.cjs +1 -0
  18. package/dist/Center-DFq5m7mf.js +22 -0
  19. package/dist/Checkbox-D-5qaOEj.js +92 -0
  20. package/dist/Checkbox-DOd4SIx2.cjs +1 -0
  21. package/dist/Container-CcsVyA6r.cjs +1 -0
  22. package/dist/Container-DPKIgeDZ.js +21 -0
  23. package/dist/Dialog-B7Mhq9Qc.cjs +1 -0
  24. package/dist/Dialog-DhIanyWH.js +258 -0
  25. package/dist/Drawer-8maigAH9.cjs +1 -0
  26. package/dist/Drawer-BKizItfr.js +259 -0
  27. package/dist/Field-DJvjEmzE.cjs +1 -0
  28. package/dist/Field-Dx9gXxGL.js +120 -0
  29. package/dist/Grid-Bzzb0usH.cjs +1 -0
  30. package/dist/Grid-x_OHCzGV.js +25 -0
  31. package/dist/Heading-BPqfnM8i.js +14 -0
  32. package/dist/Heading-icKRWRno.cjs +1 -0
  33. package/dist/Input-B0dEXpG8.js +151 -0
  34. package/dist/Input-CdS0oZyf.cjs +1 -0
  35. package/dist/Kbd-C2vxklhy.cjs +1 -0
  36. package/dist/Kbd-DGURpjWN.js +22 -0
  37. package/dist/Pagination-CiE9Jzm0.cjs +1 -0
  38. package/dist/Pagination-UQ53MWnR.js +128 -0
  39. package/dist/{Popover-j9pNswBn.js → Popover-0QvSlzcQ.js} +53 -53
  40. package/dist/Popover-Chf2ikqa.cjs +1 -0
  41. package/dist/Progress-DdWZRQVS.js +75 -0
  42. package/dist/Progress-lItZES-D.cjs +1 -0
  43. package/dist/RadioItem-BbIH7LoA.js +141 -0
  44. package/dist/RadioItem-Cfxch4Gj.cjs +1 -0
  45. package/dist/Select-CgjfJSB8.js +350 -0
  46. package/dist/Select-D_oVKzzK.cjs +1 -0
  47. package/dist/SelectField-DBGtOECg.js +49 -0
  48. package/dist/SelectField-DdkU9fXq.cjs +1 -0
  49. package/dist/Separator-BwR51KpL.js +52 -0
  50. package/dist/Separator-CTncQd7E.cjs +1 -0
  51. package/dist/Skeleton-C1LTpmVC.js +20 -0
  52. package/dist/Skeleton-CpzYhkFp.cjs +1 -0
  53. package/dist/Spinner-BJnT9SOB.cjs +1 -0
  54. package/dist/{Spinner-BYi9eTfl.js → Spinner-Dz68qwGs.js} +25 -25
  55. package/dist/Stack--mNjuxZe.cjs +1 -0
  56. package/dist/Stack-CfwjUv0j.js +49 -0
  57. package/dist/Switch-I712svE0.cjs +1 -0
  58. package/dist/{Switch-DOAZfSV0.js → Switch-bIbcXIMH.js} +22 -22
  59. package/dist/Table-C2TUkSZv.cjs +1 -0
  60. package/dist/Table-C_jZjmPK.js +67 -0
  61. package/dist/Tabs-CbmdCTVE.js +220 -0
  62. package/dist/Tabs-Dfuu2ZVq.cjs +1 -0
  63. package/dist/Text-CgsfCbWf.cjs +1 -0
  64. package/dist/Text-Dl4z0gus.js +26 -0
  65. package/dist/Text.module-CEBydIO4.js +7 -0
  66. package/dist/Text.module-gGopk2Yk.cjs +1 -0
  67. package/dist/TextField-B492c5Ct.js +31 -0
  68. package/dist/TextField-Bp-b0-hG.cjs +1 -0
  69. package/dist/{Textarea-CLrctxHU.js → Textarea-cloHZ5Sz.js} +41 -41
  70. package/dist/Textarea-uXK6PrFb.cjs +1 -0
  71. package/dist/TextareaField-C5naVyA1.cjs +1 -0
  72. package/dist/TextareaField-CrRndsuY.js +31 -0
  73. package/dist/Toast-CESL8AKT.cjs +1 -0
  74. package/dist/Toast-DYqE0PjM.js +167 -0
  75. package/dist/Tooltip-B-PpSm6T.cjs +1 -0
  76. package/dist/{Tooltip-BAmErB_g.js → Tooltip-DCCaNX5W.js} +34 -34
  77. package/dist/VhyxUIProvider-3f3b9ukY.cjs +1 -0
  78. package/dist/VhyxUIProvider-B2UHeumk.js +58 -0
  79. package/dist/VisuallyHidden-BWdnOImJ.cjs +1 -0
  80. package/dist/VisuallyHidden-CPTxPvL_.js +18 -0
  81. package/dist/accordion.cjs +1 -0
  82. package/dist/accordion.d.ts +48 -0
  83. package/dist/accordion.js +5 -0
  84. package/dist/alert.cjs +1 -1
  85. package/dist/alert.js +3 -2
  86. package/dist/avatar.cjs +1 -0
  87. package/dist/avatar.d.ts +53 -0
  88. package/dist/avatar.js +7 -0
  89. package/dist/badge.cjs +1 -1
  90. package/dist/badge.js +2 -1
  91. package/dist/breadcrumb.cjs +1 -1
  92. package/dist/breadcrumb.js +3 -2
  93. package/dist/button.cjs +1 -1
  94. package/dist/button.js +3 -2
  95. package/dist/card.cjs +1 -1
  96. package/dist/card.js +3 -2
  97. package/dist/center.cjs +1 -0
  98. package/dist/center.d.ts +20 -0
  99. package/dist/center.js +5 -0
  100. package/dist/checkbox.cjs +1 -1
  101. package/dist/checkbox.js +3 -2
  102. package/dist/container.cjs +1 -0
  103. package/dist/container.d.ts +23 -0
  104. package/dist/container.js +5 -0
  105. package/dist/cx-OWdTFKLx.js +15 -0
  106. package/dist/cx-dgWA95G6.cjs +1 -0
  107. package/dist/dialog.cjs +1 -1
  108. package/dist/dialog.d.ts +0 -1
  109. package/dist/dialog.js +3 -2
  110. package/dist/drawer.cjs +1 -1
  111. package/dist/drawer.d.ts +0 -1
  112. package/dist/drawer.js +3 -2
  113. package/dist/env-Cqd4Y-Z7.cjs +1 -0
  114. package/dist/env-lFT_FRkA.js +19 -0
  115. package/dist/form.cjs +1 -1
  116. package/dist/form.d.ts +6 -6
  117. package/dist/form.js +5 -4
  118. package/dist/grid.cjs +1 -0
  119. package/dist/grid.d.ts +35 -0
  120. package/dist/grid.js +5 -0
  121. package/dist/heading.cjs +1 -0
  122. package/dist/heading.d.ts +25 -0
  123. package/dist/heading.js +5 -0
  124. package/dist/index.cjs +1 -1
  125. package/dist/index.d.ts +440 -20
  126. package/dist/index.js +96 -62
  127. package/dist/input.cjs +1 -1
  128. package/dist/input.js +3 -2
  129. package/dist/kbd.cjs +1 -0
  130. package/dist/kbd.d.ts +16 -0
  131. package/dist/kbd.js +5 -0
  132. package/dist/pagination.cjs +1 -1
  133. package/dist/pagination.js +2 -1
  134. package/dist/popover.cjs +1 -1
  135. package/dist/popover.js +3 -2
  136. package/dist/progress.cjs +1 -1
  137. package/dist/progress.js +2 -1
  138. package/dist/radio.cjs +1 -1
  139. package/dist/radio.js +4 -3
  140. package/dist/select.cjs +1 -1
  141. package/dist/select.d.ts +3 -3
  142. package/dist/select.js +3 -2
  143. package/dist/selectfield.cjs +1 -1
  144. package/dist/selectfield.d.ts +6 -6
  145. package/dist/selectfield.js +3 -2
  146. package/dist/separator.cjs +1 -1
  147. package/dist/separator.js +3 -2
  148. package/dist/skeleton.cjs +1 -0
  149. package/dist/skeleton.d.ts +22 -0
  150. package/dist/skeleton.js +5 -0
  151. package/dist/spinner.cjs +1 -1
  152. package/dist/spinner.js +3 -2
  153. package/dist/stack.cjs +1 -0
  154. package/dist/stack.d.ts +58 -0
  155. package/dist/stack.js +7 -0
  156. package/dist/style.css +2 -1
  157. package/dist/switch.cjs +1 -1
  158. package/dist/switch.js +3 -2
  159. package/dist/table.cjs +1 -0
  160. package/dist/table.d.ts +65 -0
  161. package/dist/table.js +5 -0
  162. package/dist/tabs.cjs +1 -1
  163. package/dist/tabs.js +3 -2
  164. package/dist/test-utils.cjs +1 -1
  165. package/dist/test-utils.d.ts +14 -2
  166. package/dist/test-utils.js +5 -5
  167. package/dist/text.cjs +1 -0
  168. package/dist/text.d.ts +38 -0
  169. package/dist/text.js +5 -0
  170. package/dist/textarea.cjs +1 -1
  171. package/dist/textarea.js +2 -1
  172. package/dist/textareafield.cjs +1 -1
  173. package/dist/textareafield.d.ts +6 -6
  174. package/dist/textareafield.js +2 -1
  175. package/dist/textfield.cjs +1 -1
  176. package/dist/textfield.d.ts +6 -6
  177. package/dist/textfield.js +3 -2
  178. package/dist/toast.cjs +1 -1
  179. package/dist/toast.js +4 -3
  180. package/dist/tooltip.cjs +1 -1
  181. package/dist/tooltip.js +3 -2
  182. package/dist/utils.cjs +1 -0
  183. package/dist/utils.d.ts +28 -0
  184. package/dist/utils.js +8 -0
  185. package/dist/visually-hidden.cjs +1 -0
  186. package/dist/visually-hidden.d.ts +16 -0
  187. package/dist/visually-hidden.js +5 -0
  188. package/package.json +166 -72
  189. package/dist/Alert-BJ1O0bnK.cjs +0 -1
  190. package/dist/Alert-am3ANPTH.js +0 -99
  191. package/dist/Badge-Bbxb4wyt.js +0 -38
  192. package/dist/Badge-SBO9tGzn.cjs +0 -1
  193. package/dist/Breadcrumb-Db7ASomJ.js +0 -90
  194. package/dist/Breadcrumb-StitgXXx.cjs +0 -1
  195. package/dist/Button-DDMc7-3S.js +0 -58
  196. package/dist/Button-akOSYEu9.cjs +0 -1
  197. package/dist/Card-DSCA-Igh.cjs +0 -1
  198. package/dist/Card-Dh9Pcmfa.js +0 -79
  199. package/dist/Checkbox-DWl91ci_.js +0 -92
  200. package/dist/Checkbox-DvkT6QP9.cjs +0 -1
  201. package/dist/Dialog-CtYu14zl.js +0 -245
  202. package/dist/Dialog-gPT4noD8.cjs +0 -1
  203. package/dist/Drawer-BFJxsPG1.js +0 -246
  204. package/dist/Drawer-BygSIQQn.cjs +0 -1
  205. package/dist/Field-Bv07PL2M.js +0 -120
  206. package/dist/Field-D6FSsUGj.cjs +0 -1
  207. package/dist/Input-BS_t1bl-.js +0 -151
  208. package/dist/Input-UQ2fQwE7.cjs +0 -1
  209. package/dist/Pagination-C1h7OTgM.js +0 -128
  210. package/dist/Pagination-CmmcBPNz.cjs +0 -1
  211. package/dist/Popover-BlCmIF9J.cjs +0 -1
  212. package/dist/Progress-DWLr6Bq2.js +0 -75
  213. package/dist/Progress-FO-4WX0i.cjs +0 -1
  214. package/dist/RadioItem-BfkTHBxQ.cjs +0 -1
  215. package/dist/RadioItem-CzHSS_qK.js +0 -141
  216. package/dist/Select-BkJNe4Lc.cjs +0 -1
  217. package/dist/Select-DfV10hZt.js +0 -350
  218. package/dist/SelectField-B6N0uub8.js +0 -49
  219. package/dist/SelectField-Dxl2Mgbv.cjs +0 -1
  220. package/dist/Separator-C5lPGzes.cjs +0 -1
  221. package/dist/Separator-DQT58t90.js +0 -52
  222. package/dist/Spinner-CeIDpqkx.cjs +0 -1
  223. package/dist/Switch-BU_Tcttb.cjs +0 -1
  224. package/dist/Tabs-BTfm4LbV.js +0 -220
  225. package/dist/Tabs-DuU02-UD.cjs +0 -1
  226. package/dist/TextField-C3r-6jr6.cjs +0 -1
  227. package/dist/TextField-DtXQQJJk.js +0 -31
  228. package/dist/Textarea-H6evM8L4.cjs +0 -1
  229. package/dist/TextareaField-CpqPinvx.js +0 -31
  230. package/dist/TextareaField-D234Lyi_.cjs +0 -1
  231. package/dist/Toast-DHyfbt0C.js +0 -167
  232. package/dist/Toast-DVvbVxTf.cjs +0 -1
  233. package/dist/Tooltip-CCd6VRvZ.cjs +0 -1
  234. package/dist/VhyxUIProvider-DI8J763o.js +0 -31
  235. package/dist/VhyxUIProvider-oVy4G3P4.cjs +0 -1
  236. package/dist/jsx-runtime-BRMkMA8J.cjs +0 -22
  237. package/dist/jsx-runtime-CL69jGNW.js +0 -279
@@ -1,246 +0,0 @@
1
- import { j as f } from "./jsx-runtime-CL69jGNW.js";
2
- import D, { useState as M, useRef as v, useCallback as x, useEffect as h, useMemo as C, createContext as $, useContext as K } from "react";
3
- import X from "react-dom";
4
- import { drawerContract as j, Slot as R, VhyxUIError as z, VhyxUIErrorCode as G } from "@vhyxui/core";
5
- import { withAgentContract as J } from "@vhyxseal/react";
6
- import { u as W } from "./useId-BGRmH6iF.js";
7
- const Y = "_trigger_y86qa_1", Q = "_overlay_y86qa_9", Z = "_content_y86qa_19", k = "_header_y86qa_103", ee = "_footer_y86qa_110", te = "_title_y86qa_118", re = "_description_y86qa_127", ne = "_close_y86qa_135", p = {
8
- trigger: Y,
9
- overlay: Q,
10
- content: Z,
11
- header: k,
12
- footer: ee,
13
- title: te,
14
- description: re,
15
- close: ne
16
- }, E = $(null);
17
- function w(r) {
18
- const t = K(E);
19
- if (!t)
20
- throw new z({
21
- code: G.VHYXUI_MISSING_CONTEXT,
22
- message: `${r} must be used within <Drawer>`,
23
- suggestion: "Wrap your component tree with <Drawer>"
24
- });
25
- return t;
26
- }
27
- const oe = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
28
- function N(r) {
29
- return Array.from(r.querySelectorAll(oe));
30
- }
31
- const T = D.forwardRef(
32
- ({
33
- open: r,
34
- onOpenChange: t,
35
- side: n = "right",
36
- size: o = "md",
37
- contract: e,
38
- children: a
39
- }, i) => {
40
- const l = W("vhyx-drawer"), s = `${l}-title`, d = `${l}-description`, c = r !== void 0, [u, g] = M(!1), y = c ? r : u, b = v(null), A = v(!1), _ = x(
41
- (m) => {
42
- c || g(m), t == null || t(m);
43
- },
44
- [c, t]
45
- );
46
- h(() => {
47
- if (y) return;
48
- const m = b.current;
49
- m && document.body.contains(m) && m.focus();
50
- }, [y]);
51
- const H = C(
52
- () => ({ ...j, id: l, ...e }),
53
- [l, e]
54
- ), L = C(
55
- () => ({
56
- open: y,
57
- onOpenChange: _,
58
- side: n,
59
- size: o,
60
- titleId: s,
61
- descriptionId: d,
62
- triggerRef: b,
63
- hasTitleRef: A
64
- }),
65
- [y, _, n, o, s, d]
66
- );
67
- return /* @__PURE__ */ f.jsx(E.Provider, { value: L, children: /* @__PURE__ */ f.jsx(
68
- "div",
69
- {
70
- ref: i,
71
- "data-state": y ? "open" : "closed",
72
- "data-side": n,
73
- "data-vhyx-contract": JSON.stringify(H),
74
- children: a
75
- }
76
- ) });
77
- }
78
- );
79
- T.displayName = "VhyxDrawer";
80
- const I = D.forwardRef(
81
- ({ children: r, className: t, onClick: n, asChild: o = !1, ...e }, a) => {
82
- const i = w("Drawer.Trigger"), l = x(
83
- (u) => {
84
- i.triggerRef.current = u, typeof a == "function" ? a(u) : a && (a.current = u);
85
- },
86
- [a, i.triggerRef]
87
- ), s = x(
88
- (u) => {
89
- n == null || n(u), i.onOpenChange(!0);
90
- },
91
- [n, i]
92
- ), d = [p.trigger, t].filter(Boolean).join(" "), c = {
93
- "aria-haspopup": "dialog",
94
- "aria-expanded": i.open,
95
- onClick: s,
96
- className: d,
97
- ...e
98
- };
99
- return o ? /* @__PURE__ */ f.jsx(R, { ref: l, ...c, children: r }) : /* @__PURE__ */ f.jsx("button", { ref: l, type: "button", ...c, children: r });
100
- }
101
- );
102
- I.displayName = "VhyxDrawerTrigger";
103
- function V({ children: r }) {
104
- return w("Drawer.Portal").open ? X.createPortal(r, document.body) : null;
105
- }
106
- V.displayName = "VhyxDrawerPortal";
107
- const O = D.forwardRef(
108
- ({ className: r, onClick: t, ...n }, o) => {
109
- const e = w("Drawer.Overlay"), a = x(
110
- (l) => {
111
- t == null || t(l), e.onOpenChange(!1);
112
- },
113
- [t, e]
114
- ), i = [p.overlay, r].filter(Boolean).join(" ");
115
- return /* @__PURE__ */ f.jsx(
116
- "div",
117
- {
118
- ref: o,
119
- className: i,
120
- "data-state": "open",
121
- onClick: a,
122
- "aria-hidden": "true",
123
- ...n
124
- }
125
- );
126
- }
127
- );
128
- O.displayName = "VhyxDrawerOverlay";
129
- const q = D.forwardRef(
130
- ({ children: r, className: t, ...n }, o) => {
131
- const e = w("Drawer.Content"), a = v(null), i = x(
132
- (s) => {
133
- a.current = s, typeof o == "function" ? o(s) : o && (o.current = s);
134
- },
135
- [o]
136
- );
137
- h(() => {
138
- if (!e.open) return;
139
- const s = document.body.style.overflow;
140
- return document.body.style.overflow = "hidden", () => {
141
- document.body.style.overflow = s;
142
- };
143
- }, [e.open]), h(() => {
144
- var d;
145
- if (!e.open || !a.current) return;
146
- const s = N(a.current);
147
- s.length > 0 ? (d = s[0]) == null || d.focus() : a.current.focus();
148
- }, [e.open]), h(() => {
149
- e.open && process.env.NODE_ENV !== "production" && !e.hasTitleRef.current && console.warn(
150
- "[VhyxUI] <Drawer.Content> requires <Drawer.Title> for accessibility. Screen reader users need a title to understand the drawer purpose."
151
- );
152
- }, [e.open, e.hasTitleRef]), h(() => {
153
- if (!e.open || !a.current) return;
154
- const s = a.current;
155
- function d(c) {
156
- if (c.key === "Escape") {
157
- e.onOpenChange(!1);
158
- return;
159
- }
160
- if (c.key !== "Tab") return;
161
- const u = N(s);
162
- if (u.length === 0) return;
163
- const g = u[0], y = u[u.length - 1];
164
- c.shiftKey ? (document.activeElement === g || !s.contains(document.activeElement)) && (c.preventDefault(), y.focus()) : (document.activeElement === y || !s.contains(document.activeElement)) && (c.preventDefault(), g.focus());
165
- }
166
- return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
167
- }, [e.open, e.onOpenChange]);
168
- const l = [p.content, t].filter(Boolean).join(" ");
169
- return /* @__PURE__ */ f.jsx(
170
- "div",
171
- {
172
- ref: i,
173
- role: "dialog",
174
- "aria-modal": "true",
175
- "aria-labelledby": e.titleId,
176
- "aria-describedby": e.descriptionId,
177
- tabIndex: -1,
178
- className: l,
179
- "data-state": "open",
180
- "data-side": e.side,
181
- "data-size": e.size,
182
- ...n,
183
- children: r
184
- }
185
- );
186
- }
187
- );
188
- q.displayName = "VhyxDrawerContent";
189
- function S({ children: r, className: t, ...n }) {
190
- const o = [p.header, t].filter(Boolean).join(" ");
191
- return /* @__PURE__ */ f.jsx("div", { className: o, ...n, children: r });
192
- }
193
- S.displayName = "VhyxDrawerHeader";
194
- function B({ children: r, className: t, ...n }) {
195
- const o = [p.footer, t].filter(Boolean).join(" ");
196
- return /* @__PURE__ */ f.jsx("div", { className: o, ...n, children: r });
197
- }
198
- B.displayName = "VhyxDrawerFooter";
199
- function P({ children: r, className: t, ...n }) {
200
- const o = w("Drawer.Title");
201
- h(() => (o.hasTitleRef.current = !0, () => {
202
- o.hasTitleRef.current = !1;
203
- }), [o.hasTitleRef]);
204
- const e = [p.title, t].filter(Boolean).join(" ");
205
- return /* @__PURE__ */ f.jsx("h2", { id: o.titleId, className: e, ...n, children: r });
206
- }
207
- P.displayName = "VhyxDrawerTitle";
208
- function F({ children: r, className: t, ...n }) {
209
- const o = w("Drawer.Description"), e = [p.description, t].filter(Boolean).join(" ");
210
- return /* @__PURE__ */ f.jsx("p", { id: o.descriptionId, className: e, ...n, children: r });
211
- }
212
- F.displayName = "VhyxDrawerDescription";
213
- const U = D.forwardRef(
214
- ({ children: r, className: t, onClick: n, asChild: o = !1, ...e }, a) => {
215
- const i = w("Drawer.Close"), l = x(
216
- (c) => {
217
- n == null || n(c), i.onOpenChange(!1);
218
- },
219
- [n, i]
220
- ), s = [p.close, t].filter(Boolean).join(" "), d = {
221
- onClick: l,
222
- className: s,
223
- ...e
224
- };
225
- return o ? /* @__PURE__ */ f.jsx(R, { ref: a, ...d, children: r }) : /* @__PURE__ */ f.jsx("button", { ref: a, type: "button", ...d, children: r ?? "Close" });
226
- }
227
- );
228
- U.displayName = "VhyxDrawerClose";
229
- const ae = { ...j, id: "vhyxui-drawer" }, se = Object.assign(
230
- J(T, ae),
231
- {
232
- Trigger: I,
233
- Portal: V,
234
- Overlay: O,
235
- Content: q,
236
- Header: S,
237
- Footer: B,
238
- Title: P,
239
- Description: F,
240
- Close: U
241
- }
242
- );
243
- se.displayName = "VhyxDrawer";
244
- export {
245
- se as D
246
- };
@@ -1 +0,0 @@
1
- "use strict";const p=require("./jsx-runtime-BRMkMA8J.cjs"),o=require("react"),U=require("react-dom"),h=require("@vhyxui/core"),A=require("@vhyxseal/react"),H=require("./useId-D2AEOm2G.cjs"),L="_trigger_y86qa_1",M="_overlay_y86qa_9",$="_content_y86qa_19",K="_header_y86qa_103",X="_footer_y86qa_110",k="_title_y86qa_118",z="_description_y86qa_127",G="_close_y86qa_135",y={trigger:L,overlay:M,content:$,header:K,footer:X,title:k,description:z,close:G},E=o.createContext(null);function w(r){const t=o.useContext(E);if(!t)throw new h.VhyxUIError({code:h.VhyxUIErrorCode.VHYXUI_MISSING_CONTEXT,message:`${r} must be used within <Drawer>`,suggestion:"Wrap your component tree with <Drawer>"});return t}const J='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function v(r){return Array.from(r.querySelectorAll(J))}const b=o.forwardRef(({open:r,onOpenChange:t,side:n="right",size:s="md",contract:e,children:a},c)=>{const u=H.useId("vhyx-drawer"),i=`${u}-title`,d=`${u}-description`,l=r!==void 0,[f,D]=o.useState(!1),x=l?r:f,g=o.useRef(null),B=o.useRef(!1),R=o.useCallback(m=>{l||D(m),t==null||t(m)},[l,t]);o.useEffect(()=>{if(x)return;const m=g.current;m&&document.body.contains(m)&&m.focus()},[x]);const P=o.useMemo(()=>({...h.drawerContract,id:u,...e}),[u,e]),F=o.useMemo(()=>({open:x,onOpenChange:R,side:n,size:s,titleId:i,descriptionId:d,triggerRef:g,hasTitleRef:B}),[x,R,n,s,i,d]);return p.jsxRuntimeExports.jsx(E.Provider,{value:F,children:p.jsxRuntimeExports.jsx("div",{ref:c,"data-state":x?"open":"closed","data-side":n,"data-vhyx-contract":JSON.stringify(P),children:a})})});b.displayName="VhyxDrawer";const j=o.forwardRef(({children:r,className:t,onClick:n,asChild:s=!1,...e},a)=>{const c=w("Drawer.Trigger"),u=o.useCallback(f=>{c.triggerRef.current=f,typeof a=="function"?a(f):a&&(a.current=f)},[a,c.triggerRef]),i=o.useCallback(f=>{n==null||n(f),c.onOpenChange(!0)},[n,c]),d=[y.trigger,t].filter(Boolean).join(" "),l={"aria-haspopup":"dialog","aria-expanded":c.open,onClick:i,className:d,...e};return s?p.jsxRuntimeExports.jsx(h.Slot,{ref:u,...l,children:r}):p.jsxRuntimeExports.jsx("button",{ref:u,type:"button",...l,children:r})});j.displayName="VhyxDrawerTrigger";function C({children:r}){return w("Drawer.Portal").open?U.createPortal(r,document.body):null}C.displayName="VhyxDrawerPortal";const _=o.forwardRef(({className:r,onClick:t,...n},s)=>{const e=w("Drawer.Overlay"),a=o.useCallback(u=>{t==null||t(u),e.onOpenChange(!1)},[t,e]),c=[y.overlay,r].filter(Boolean).join(" ");return p.jsxRuntimeExports.jsx("div",{ref:s,className:c,"data-state":"open",onClick:a,"aria-hidden":"true",...n})});_.displayName="VhyxDrawerOverlay";const N=o.forwardRef(({children:r,className:t,...n},s)=>{const e=w("Drawer.Content"),a=o.useRef(null),c=o.useCallback(i=>{a.current=i,typeof s=="function"?s(i):s&&(s.current=i)},[s]);o.useEffect(()=>{if(!e.open)return;const i=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=i}},[e.open]),o.useEffect(()=>{var d;if(!e.open||!a.current)return;const i=v(a.current);i.length>0?(d=i[0])==null||d.focus():a.current.focus()},[e.open]),o.useEffect(()=>{e.open&&process.env.NODE_ENV!=="production"&&!e.hasTitleRef.current&&console.warn("[VhyxUI] <Drawer.Content> requires <Drawer.Title> for accessibility. Screen reader users need a title to understand the drawer purpose.")},[e.open,e.hasTitleRef]),o.useEffect(()=>{if(!e.open||!a.current)return;const i=a.current;function d(l){if(l.key==="Escape"){e.onOpenChange(!1);return}if(l.key!=="Tab")return;const f=v(i);if(f.length===0)return;const D=f[0],x=f[f.length-1];l.shiftKey?(document.activeElement===D||!i.contains(document.activeElement))&&(l.preventDefault(),x.focus()):(document.activeElement===x||!i.contains(document.activeElement))&&(l.preventDefault(),D.focus())}return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e.open,e.onOpenChange]);const u=[y.content,t].filter(Boolean).join(" ");return p.jsxRuntimeExports.jsx("div",{ref:c,role:"dialog","aria-modal":"true","aria-labelledby":e.titleId,"aria-describedby":e.descriptionId,tabIndex:-1,className:u,"data-state":"open","data-side":e.side,"data-size":e.size,...n,children:r})});N.displayName="VhyxDrawerContent";function T({children:r,className:t,...n}){const s=[y.header,t].filter(Boolean).join(" ");return p.jsxRuntimeExports.jsx("div",{className:s,...n,children:r})}T.displayName="VhyxDrawerHeader";function I({children:r,className:t,...n}){const s=[y.footer,t].filter(Boolean).join(" ");return p.jsxRuntimeExports.jsx("div",{className:s,...n,children:r})}I.displayName="VhyxDrawerFooter";function q({children:r,className:t,...n}){const s=w("Drawer.Title");o.useEffect(()=>(s.hasTitleRef.current=!0,()=>{s.hasTitleRef.current=!1}),[s.hasTitleRef]);const e=[y.title,t].filter(Boolean).join(" ");return p.jsxRuntimeExports.jsx("h2",{id:s.titleId,className:e,...n,children:r})}q.displayName="VhyxDrawerTitle";function V({children:r,className:t,...n}){const s=w("Drawer.Description"),e=[y.description,t].filter(Boolean).join(" ");return p.jsxRuntimeExports.jsx("p",{id:s.descriptionId,className:e,...n,children:r})}V.displayName="VhyxDrawerDescription";const O=o.forwardRef(({children:r,className:t,onClick:n,asChild:s=!1,...e},a)=>{const c=w("Drawer.Close"),u=o.useCallback(l=>{n==null||n(l),c.onOpenChange(!1)},[n,c]),i=[y.close,t].filter(Boolean).join(" "),d={onClick:u,className:i,...e};return s?p.jsxRuntimeExports.jsx(h.Slot,{ref:a,...d,children:r}):p.jsxRuntimeExports.jsx("button",{ref:a,type:"button",...d,children:r??"Close"})});O.displayName="VhyxDrawerClose";const W={...h.drawerContract,id:"vhyxui-drawer"},S=Object.assign(A.withAgentContract(b,W),{Trigger:j,Portal:C,Overlay:_,Content:N,Header:T,Footer:I,Title:q,Description:V,Close:O});S.displayName="VhyxDrawer";exports.Drawer=S;
@@ -1,120 +0,0 @@
1
- import { j as r } from "./jsx-runtime-CL69jGNW.js";
2
- import y, { useContext as V, useCallback as w, useMemo as z, createContext as R } from "react";
3
- import { u as M } from "./useId-BGRmH6iF.js";
4
- import { formContract as P } from "@vhyxui/core";
5
- import { withAgentContract as $ } from "@vhyxseal/react";
6
- const k = "_form_14a4e_3", A = "_field_14a4e_24", D = "_label_14a4e_40", H = "_control_14a4e_46", L = "_hint_14a4e_51", G = "_error_14a4e_52", J = "_required_14a4e_76", K = "_optional_14a4e_81", a = {
7
- form: k,
8
- field: A,
9
- "field--horizontal": "_field--horizontal_14a4e_30",
10
- label: D,
11
- control: H,
12
- hint: L,
13
- error: G,
14
- required: J,
15
- optional: K
16
- }, C = R(null);
17
- function O() {
18
- return V(C);
19
- }
20
- const E = y.forwardRef(
21
- ({
22
- form: e,
23
- layout: n = "vertical",
24
- size: l = "md",
25
- disabled: f = !1,
26
- onSubmit: i,
27
- className: v,
28
- children: x,
29
- ...d
30
- }, j) => {
31
- const h = e == null ? void 0 : e.formState, s = e == null ? void 0 : e.register, c = e ? (t) => e.getFieldState(t) : void 0, _ = w(
32
- (t) => {
33
- t.preventDefault(), e && i ? e.handleSubmit((u) => {
34
- i(u);
35
- })(t) : i && i({});
36
- },
37
- [e, i]
38
- ), o = z(
39
- () => {
40
- const t = { disabled: f, size: l, layout: n };
41
- return h !== void 0 && (t.formState = h), s !== void 0 && (t.register = s), c !== void 0 && (t.getFieldState = c), t;
42
- },
43
- [h, s, c, f, l, n]
44
- ), m = [a.form, v].filter(Boolean).join(" ");
45
- return /* @__PURE__ */ r.jsx(C.Provider, { value: o, children: /* @__PURE__ */ r.jsx(
46
- "form",
47
- {
48
- ref: j,
49
- className: m,
50
- "data-layout": n,
51
- "data-size": l,
52
- onSubmit: _,
53
- ...d,
54
- children: x
55
- }
56
- ) });
57
- }
58
- );
59
- E.displayName = "VhyxForm";
60
- const Q = { ...P, id: "vhyxui-form" }, T = $(E, Q);
61
- T.displayName = "VhyxForm";
62
- function U({
63
- name: e,
64
- label: n,
65
- hint: l,
66
- error: f,
67
- required: i = !1,
68
- optional: v = !1,
69
- layout: x,
70
- children: d,
71
- className: j,
72
- ...h
73
- }) {
74
- var b, S, B;
75
- const s = M("field"), c = `${s}-hint`, _ = `${s}-error`, o = O(), m = (B = (S = (b = o == null ? void 0 : o.getFieldState) == null ? void 0 : b.call(o, e)) == null ? void 0 : S.error) == null ? void 0 : B.message, t = f ?? (typeof m == "string" ? m : void 0), u = !!t, F = !!l, p = [];
76
- F && p.push(c), u && p.push(_);
77
- const g = p.length > 0 ? p.join(" ") : void 0, N = x ?? (o == null ? void 0 : o.layout) ?? "vertical", q = y.isValidElement(d) ? y.cloneElement(
78
- d,
79
- {
80
- id: s,
81
- ...g !== void 0 ? { "aria-describedby": g } : {},
82
- ...u ? { "aria-invalid": !0, "data-error": !0 } : {}
83
- }
84
- ) : d, I = [
85
- a.field,
86
- N === "horizontal" ? a["field--horizontal"] : "",
87
- j
88
- ].filter(Boolean).join(" ");
89
- return /* @__PURE__ */ r.jsxs("div", { className: I, "data-layout": N, ...h, children: [
90
- n !== void 0 && /* @__PURE__ */ r.jsxs("label", { htmlFor: s, className: a.label, children: [
91
- n,
92
- i && /* @__PURE__ */ r.jsxs("span", { className: a.required, "aria-hidden": "true", children: [
93
- " ",
94
- "*"
95
- ] }),
96
- v && /* @__PURE__ */ r.jsxs("span", { className: a.optional, "aria-hidden": "true", children: [
97
- " ",
98
- "(optional)"
99
- ] })
100
- ] }),
101
- /* @__PURE__ */ r.jsx("div", { className: a.control, children: q }),
102
- F && /* @__PURE__ */ r.jsx("span", { id: c, className: a.hint, children: l }),
103
- u && /* @__PURE__ */ r.jsx(
104
- "span",
105
- {
106
- id: _,
107
- className: a.error,
108
- role: "alert",
109
- "aria-live": "assertive",
110
- children: t
111
- }
112
- )
113
- ] });
114
- }
115
- U.displayName = "VhyxField";
116
- export {
117
- U as F,
118
- T as a,
119
- O as u
120
- };
@@ -1 +0,0 @@
1
- "use strict";const o=require("./jsx-runtime-BRMkMA8J.cjs"),n=require("react"),z=require("./useId-D2AEOm2G.cjs"),M=require("@vhyxui/core"),P=require("@vhyxseal/react"),$="_form_14a4e_3",k="_field_14a4e_24",A="_label_14a4e_40",D="_control_14a4e_46",H="_hint_14a4e_51",L="_error_14a4e_52",G="_required_14a4e_76",J="_optional_14a4e_81",r={form:$,field:k,"field--horizontal":"_field--horizontal_14a4e_30",label:A,control:D,hint:H,error:L,required:G,optional:J},b=n.createContext(null);function S(){return n.useContext(b)}const C=n.forwardRef(({form:e,layout:l="vertical",size:c="md",disabled:m=!1,onSubmit:a,className:f,children:j,...u},F)=>{const x=e==null?void 0:e.formState,i=e==null?void 0:e.register,d=e?t=>e.getFieldState(t):void 0,p=n.useCallback(t=>{t.preventDefault(),e&&a?e.handleSubmit(h=>{a(h)})(t):a&&a({})},[e,a]),s=n.useMemo(()=>{const t={disabled:m,size:c,layout:l};return x!==void 0&&(t.formState=x),i!==void 0&&(t.register=i),d!==void 0&&(t.getFieldState=d),t},[x,i,d,m,c,l]),_=[r.form,f].filter(Boolean).join(" ");return o.jsxRuntimeExports.jsx(b.Provider,{value:s,children:o.jsxRuntimeExports.jsx("form",{ref:F,className:_,"data-layout":l,"data-size":c,onSubmit:p,...u,children:j})})});C.displayName="VhyxForm";const K={...M.formContract,id:"vhyxui-form"},B=P.withAgentContract(C,K);B.displayName="VhyxForm";function I({name:e,label:l,hint:c,error:m,required:a=!1,optional:f=!1,layout:j,children:u,className:F,...x}){var R,N,q;const i=z.useId("field"),d=`${i}-hint`,p=`${i}-error`,s=S(),_=(q=(N=(R=s==null?void 0:s.getFieldState)==null?void 0:R.call(s,e))==null?void 0:N.error)==null?void 0:q.message,t=m??(typeof _=="string"?_:void 0),h=!!t,y=!!c,v=[];y&&v.push(d),h&&v.push(p);const E=v.length>0?v.join(" "):void 0,g=j??(s==null?void 0:s.layout)??"vertical",V=n.isValidElement(u)?n.cloneElement(u,{id:i,...E!==void 0?{"aria-describedby":E}:{},...h?{"aria-invalid":!0,"data-error":!0}:{}}):u,w=[r.field,g==="horizontal"?r["field--horizontal"]:"",F].filter(Boolean).join(" ");return o.jsxRuntimeExports.jsxs("div",{className:w,"data-layout":g,...x,children:[l!==void 0&&o.jsxRuntimeExports.jsxs("label",{htmlFor:i,className:r.label,children:[l,a&&o.jsxRuntimeExports.jsxs("span",{className:r.required,"aria-hidden":"true",children:[" ","*"]}),f&&o.jsxRuntimeExports.jsxs("span",{className:r.optional,"aria-hidden":"true",children:[" ","(optional)"]})]}),o.jsxRuntimeExports.jsx("div",{className:r.control,children:V}),y&&o.jsxRuntimeExports.jsx("span",{id:d,className:r.hint,children:c}),h&&o.jsxRuntimeExports.jsx("span",{id:p,className:r.error,role:"alert","aria-live":"assertive",children:t})]})}I.displayName="VhyxField";exports.Field=I;exports.Form=B;exports.useFormContext=S;
@@ -1,151 +0,0 @@
1
- import { j as t } from "./jsx-runtime-CL69jGNW.js";
2
- import W, { useState as H, useCallback as b } from "react";
3
- import { inputContract as m } from "@vhyxui/core";
4
- import { withAgentContract as J } from "@vhyxseal/react";
5
- import { u as O } from "./useId-BGRmH6iF.js";
6
- const T = "_wrapper_uqbxf_1", D = "_input_uqbxf_60", G = "_icon_uqbxf_94", K = "_prefix_uqbxf_106", Q = "_suffix_uqbxf_107", e = {
7
- wrapper: T,
8
- "wrapper--error": "_wrapper--error_uqbxf_29",
9
- input: D,
10
- icon: G,
11
- prefix: K,
12
- suffix: Q,
13
- "clear-button": "_clear-button_uqbxf_117",
14
- "toggle-button": "_toggle-button_uqbxf_118"
15
- };
16
- function U({ crossed: a }) {
17
- return /* @__PURE__ */ t.jsx(
18
- "svg",
19
- {
20
- "aria-hidden": "true",
21
- viewBox: "0 0 24 24",
22
- fill: "none",
23
- stroke: "currentColor",
24
- strokeWidth: 2,
25
- strokeLinecap: "round",
26
- strokeLinejoin: "round",
27
- style: { width: "1em", height: "1em" },
28
- children: a ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
29
- /* @__PURE__ */ t.jsx("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94" }),
30
- /* @__PURE__ */ t.jsx("path", { d: "M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19" }),
31
- /* @__PURE__ */ t.jsx("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
32
- ] }) : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
33
- /* @__PURE__ */ t.jsx("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
34
- /* @__PURE__ */ t.jsx("circle", { cx: 12, cy: 12, r: 3 })
35
- ] })
36
- }
37
- );
38
- }
39
- function X() {
40
- return /* @__PURE__ */ t.jsxs(
41
- "svg",
42
- {
43
- "aria-hidden": "true",
44
- viewBox: "0 0 24 24",
45
- fill: "none",
46
- stroke: "currentColor",
47
- strokeWidth: 2.5,
48
- strokeLinecap: "round",
49
- style: { width: "0.75em", height: "0.75em" },
50
- children: [
51
- /* @__PURE__ */ t.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
52
- /* @__PURE__ */ t.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
53
- ]
54
- }
55
- );
56
- }
57
- const w = W.forwardRef(
58
- ({
59
- size: a = "md",
60
- icon: n,
61
- iconPosition: i = "left",
62
- suffix: o,
63
- prefix: x,
64
- clearable: j = !1,
65
- onClear: s,
66
- error: c = !1,
67
- contract: _,
68
- className: y,
69
- id: g,
70
- type: d,
71
- value: l,
72
- onChange: v,
73
- "aria-label": I,
74
- "aria-describedby": N,
75
- ...k
76
- }, C) => {
77
- const q = O("vhyx-input"), h = g ?? q, [u, S] = H(!1), B = b(() => {
78
- S((F) => !F);
79
- }, []), p = d === "password", A = d === "search", L = p ? u ? "text" : "password" : d, M = l !== void 0 ? String(l).length > 0 : !1, f = j || A && M, P = b(() => {
80
- s == null || s();
81
- }, [s]), r = !!n, R = !!x, V = !!o || p || f, z = {
82
- ...m,
83
- id: h,
84
- ..._
85
- }, E = [
86
- e.wrapper,
87
- c ? e["wrapper--error"] : "",
88
- y
89
- ].filter(Boolean).join(" ");
90
- return /* @__PURE__ */ t.jsxs(
91
- "div",
92
- {
93
- className: E,
94
- "data-size": a,
95
- "data-error": c ? !0 : void 0,
96
- "data-has-icon": r ? !0 : void 0,
97
- "data-icon-position": r ? i : void 0,
98
- children: [
99
- R && /* @__PURE__ */ t.jsx("span", { className: e.prefix, "aria-hidden": "true", children: x }),
100
- r && i === "left" && /* @__PURE__ */ t.jsx("span", { className: e.icon, "aria-hidden": "true", children: n }),
101
- /* @__PURE__ */ t.jsx(
102
- "input",
103
- {
104
- ref: C,
105
- id: h,
106
- type: L,
107
- value: l,
108
- onChange: v,
109
- "aria-invalid": c ? !0 : void 0,
110
- "aria-label": I,
111
- "aria-describedby": N,
112
- className: e.input,
113
- "data-vhyx-contract": JSON.stringify(z),
114
- ...k
115
- }
116
- ),
117
- r && i === "right" && /* @__PURE__ */ t.jsx("span", { className: e.icon, "aria-hidden": "true", children: n }),
118
- f && /* @__PURE__ */ t.jsx(
119
- "button",
120
- {
121
- type: "button",
122
- className: e["clear-button"],
123
- onClick: P,
124
- "aria-label": "Clear",
125
- tabIndex: 0,
126
- children: /* @__PURE__ */ t.jsx(X, {})
127
- }
128
- ),
129
- p && /* @__PURE__ */ t.jsx(
130
- "button",
131
- {
132
- type: "button",
133
- className: e["toggle-button"],
134
- onClick: B,
135
- "aria-label": u ? "Hide password" : "Show password",
136
- tabIndex: 0,
137
- children: /* @__PURE__ */ t.jsx(U, { crossed: u })
138
- }
139
- ),
140
- V && o && /* @__PURE__ */ t.jsx("span", { className: e.suffix, "aria-hidden": "true", children: o })
141
- ]
142
- }
143
- );
144
- }
145
- );
146
- w.displayName = "VhyxInput";
147
- const Y = { ...m, id: "vhyxui-input" }, Z = J(w, Y);
148
- Z.displayName = "VhyxInput";
149
- export {
150
- Z as I
151
- };
@@ -1 +0,0 @@
1
- "use strict";const t=require("./jsx-runtime-BRMkMA8J.cjs"),n=require("react"),f=require("@vhyxui/core"),H=require("@vhyxseal/react"),J=require("./useId-D2AEOm2G.cjs"),O="_wrapper_uqbxf_1",T="_input_uqbxf_60",D="_icon_uqbxf_94",G="_prefix_uqbxf_106",K="_suffix_uqbxf_107",s={wrapper:O,"wrapper--error":"_wrapper--error_uqbxf_29",input:T,icon:D,prefix:G,suffix:K,"clear-button":"_clear-button_uqbxf_117","toggle-button":"_toggle-button_uqbxf_118"};function Q({crossed:i}){return t.jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{width:"1em",height:"1em"},children:i?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"}),t.jsxRuntimeExports.jsx("path",{d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"}),t.jsxRuntimeExports.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),t.jsxRuntimeExports.jsx("circle",{cx:12,cy:12,r:3})]})})}function U(){return t.jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",style:{width:"0.75em",height:"0.75em"},children:[t.jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}const b=n.forwardRef(({size:i="md",icon:a,iconPosition:o="left",suffix:x,prefix:h,clearable:R=!1,onClear:e,error:u=!1,contract:E,className:_,id:y,type:c,value:p,onChange:g,"aria-label":v,"aria-describedby":I,...q},k)=>{const C=J.useId("vhyx-input"),j=y??C,[d,N]=n.useState(!1),S=n.useCallback(()=>{N(W=>!W)},[]),l=c==="password",B=c==="search",A=l?d?"text":"password":c,L=p!==void 0?String(p).length>0:!1,m=R||B&&L,M=n.useCallback(()=>{e==null||e()},[e]),r=!!a,P=!!h,V=!!x||l||m,z={...f.inputContract,id:j,...E},F=[s.wrapper,u?s["wrapper--error"]:"",_].filter(Boolean).join(" ");return t.jsxRuntimeExports.jsxs("div",{className:F,"data-size":i,"data-error":u?!0:void 0,"data-has-icon":r?!0:void 0,"data-icon-position":r?o:void 0,children:[P&&t.jsxRuntimeExports.jsx("span",{className:s.prefix,"aria-hidden":"true",children:h}),r&&o==="left"&&t.jsxRuntimeExports.jsx("span",{className:s.icon,"aria-hidden":"true",children:a}),t.jsxRuntimeExports.jsx("input",{ref:k,id:j,type:A,value:p,onChange:g,"aria-invalid":u?!0:void 0,"aria-label":v,"aria-describedby":I,className:s.input,"data-vhyx-contract":JSON.stringify(z),...q}),r&&o==="right"&&t.jsxRuntimeExports.jsx("span",{className:s.icon,"aria-hidden":"true",children:a}),m&&t.jsxRuntimeExports.jsx("button",{type:"button",className:s["clear-button"],onClick:M,"aria-label":"Clear",tabIndex:0,children:t.jsxRuntimeExports.jsx(U,{})}),l&&t.jsxRuntimeExports.jsx("button",{type:"button",className:s["toggle-button"],onClick:S,"aria-label":d?"Hide password":"Show password",tabIndex:0,children:t.jsxRuntimeExports.jsx(Q,{crossed:d})}),V&&x&&t.jsxRuntimeExports.jsx("span",{className:s.suffix,"aria-hidden":"true",children:x})]})});b.displayName="VhyxInput";const X={...f.inputContract,id:"vhyxui-input"},w=H.withAgentContract(b,X);w.displayName="VhyxInput";exports.Input=w;
@@ -1,128 +0,0 @@
1
- import { j as t } from "./jsx-runtime-CL69jGNW.js";
2
- import E, { useMemo as v } from "react";
3
- import { paginationContract as _ } from "@vhyxui/core";
4
- import { withAgentContract as I } from "@vhyxseal/react";
5
- import { u as L } from "./useId-BGRmH6iF.js";
6
- const P = "_nav_1kxmq_1", M = "_list_1kxmq_5", g = "_button_1kxmq_15", w = "_ellipsis_1kxmq_75", l = {
7
- nav: P,
8
- list: M,
9
- button: g,
10
- ellipsis: w
11
- }, h = "ellipsis";
12
- function A(i, s, a) {
13
- const m = a * 2 + 5;
14
- if (s <= m)
15
- return Array.from({ length: s }, (e, x) => x + 1);
16
- const r = Math.max(i - a, 2), c = Math.min(i + a, s - 1), n = r > 2, u = c < s - 1, o = [1];
17
- n && o.push(h);
18
- for (let e = r; e <= c; e++)
19
- o.push(e);
20
- return u && o.push(h), o.push(s), o;
21
- }
22
- const N = E.forwardRef(
23
- ({
24
- page: i,
25
- pageCount: s,
26
- onPageChange: a,
27
- siblingCount: m = 1,
28
- showFirstLast: r = !1,
29
- showPrevNext: c = !0,
30
- size: n = "md",
31
- contract: u,
32
- className: o,
33
- ...e
34
- }, x) => {
35
- const p = L("vhyx-pagination"), k = v(
36
- () => ({ ..._, id: p, ...u }),
37
- [p, u]
38
- ), S = v(
39
- () => A(i, s, m),
40
- [i, s, m]
41
- ), f = i <= 1, j = i >= s, R = [l.nav, o].filter(Boolean).join(" ");
42
- return /* @__PURE__ */ t.jsx(
43
- "nav",
44
- {
45
- ref: x,
46
- "aria-label": "Pagination",
47
- className: R,
48
- "data-size": n,
49
- "data-vhyx-contract": JSON.stringify(k),
50
- ...e,
51
- children: /* @__PURE__ */ t.jsxs("ul", { className: l.list, children: [
52
- r && /* @__PURE__ */ t.jsx("li", { children: /* @__PURE__ */ t.jsx(
53
- "button",
54
- {
55
- type: "button",
56
- className: l.button,
57
- onClick: () => a(1),
58
- disabled: f,
59
- "aria-label": "First page",
60
- "data-size": n,
61
- children: "«"
62
- }
63
- ) }),
64
- c && /* @__PURE__ */ t.jsx("li", { children: /* @__PURE__ */ t.jsx(
65
- "button",
66
- {
67
- type: "button",
68
- className: l.button,
69
- onClick: () => a(i - 1),
70
- disabled: f,
71
- "aria-label": "Previous page",
72
- "data-size": n,
73
- children: "‹"
74
- }
75
- ) }),
76
- S.map((y, q) => {
77
- if (y === h)
78
- return /* @__PURE__ */ t.jsx("li", { children: /* @__PURE__ */ t.jsx("span", { className: l.ellipsis, "aria-hidden": "true", children: "…" }) }, `ellipsis-${q}`);
79
- const d = y, b = d === i;
80
- return /* @__PURE__ */ t.jsx("li", { children: /* @__PURE__ */ t.jsx(
81
- "button",
82
- {
83
- type: "button",
84
- className: l.button,
85
- onClick: () => !b && a(d),
86
- "aria-current": b ? "page" : void 0,
87
- "aria-label": b ? void 0 : `Page ${d}`,
88
- "data-state": b ? "active" : "inactive",
89
- "data-size": n,
90
- children: d
91
- }
92
- ) }, d);
93
- }),
94
- c && /* @__PURE__ */ t.jsx("li", { children: /* @__PURE__ */ t.jsx(
95
- "button",
96
- {
97
- type: "button",
98
- className: l.button,
99
- onClick: () => a(i + 1),
100
- disabled: j,
101
- "aria-label": "Next page",
102
- "data-size": n,
103
- children: "›"
104
- }
105
- ) }),
106
- r && /* @__PURE__ */ t.jsx("li", { children: /* @__PURE__ */ t.jsx(
107
- "button",
108
- {
109
- type: "button",
110
- className: l.button,
111
- onClick: () => a(s),
112
- disabled: j,
113
- "aria-label": "Last page",
114
- "data-size": n,
115
- children: "»"
116
- }
117
- ) })
118
- ] })
119
- }
120
- );
121
- }
122
- );
123
- N.displayName = "VhyxPagination";
124
- const B = { ..._, id: "vhyxui-pagination" }, V = I(N, B);
125
- V.displayName = "VhyxPagination";
126
- export {
127
- V as P
128
- };