@wirecore/wirelayer-react 0.8.0 → 0.9.0

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 (46) hide show
  1. package/dist/ContextMenu-GCeoPu8T.js +1523 -0
  2. package/dist/PasswordInput-CxZXGV2m.js +449 -0
  3. package/dist/{Select-C2CiPTCK.js → Select-CGyqfOm3.js} +65 -65
  4. package/dist/components/Avatar/Avatar.d.ts +3 -1
  5. package/dist/components/Avatar/Avatar.d.ts.map +1 -1
  6. package/dist/components/Card/Card.d.ts +3 -1
  7. package/dist/components/Card/Card.d.ts.map +1 -1
  8. package/dist/components/Code/Code.d.ts +11 -0
  9. package/dist/components/Code/Code.d.ts.map +1 -0
  10. package/dist/components/ContextMenu/ContextMenu.d.ts +4 -3
  11. package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
  12. package/dist/components/Dialog/Dialog.d.ts +7 -3
  13. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  14. package/dist/components/NativeSelect/NativeSelect.d.ts +9 -6
  15. package/dist/components/NativeSelect/NativeSelect.d.ts.map +1 -1
  16. package/dist/components/NumberInput/NumberInput.d.ts +11 -3
  17. package/dist/components/NumberInput/NumberInput.d.ts.map +1 -1
  18. package/dist/components/Progress/Progress.d.ts +5 -2
  19. package/dist/components/Progress/Progress.d.ts.map +1 -1
  20. package/dist/components/RadioGroup/RadioGroup.d.ts +12 -5
  21. package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -1
  22. package/dist/components/SegmentedControl/SegmentedControl.d.ts +12 -4
  23. package/dist/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  24. package/dist/components/Select/Select.d.ts +11 -5
  25. package/dist/components/Select/Select.d.ts.map +1 -1
  26. package/dist/components/Stepper/Stepper.d.ts +3 -1
  27. package/dist/components/Stepper/Stepper.d.ts.map +1 -1
  28. package/dist/components/Tabs/Tabs.d.ts +11 -2
  29. package/dist/components/Tabs/Tabs.d.ts.map +1 -1
  30. package/dist/components/Wizard/Wizard.d.ts +11 -3
  31. package/dist/components/Wizard/Wizard.d.ts.map +1 -1
  32. package/dist/data-table.js +2 -2
  33. package/dist/hooks/index.d.ts +1 -1
  34. package/dist/hooks/index.d.ts.map +1 -1
  35. package/dist/hooks/media.d.ts +7 -0
  36. package/dist/hooks/media.d.ts.map +1 -1
  37. package/dist/index.d.ts +5 -3
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +1931 -1898
  40. package/dist/pdf.js +2 -2
  41. package/dist/sources/Code.css +2 -0
  42. package/llms-full.txt +56 -13
  43. package/llms.txt +1 -0
  44. package/package.json +3 -3
  45. package/dist/ContextMenu-C6ZaMtqf.js +0 -1511
  46. package/dist/PasswordInput-dpeKVREo.js +0 -425
@@ -1,425 +0,0 @@
1
- "use client";
2
- import { a as e, n as t } from "./RecipesProvider-0idafuGm.js";
3
- import { r as n, t as r } from "./InputStatus-hVzkU_4q.js";
4
- import { checkPasswordRequirements as i, clampDialogOffset as a, closeTab as o, controlIds as s, dialog as c, dialogMoveForKey as l, dialogMoveKeys as u, passwordInput as d, passwordStrength as f, scrollEdges as p, setTextControlValue as m, tabs as h } from "@wirecore/wirelayer-recipes";
5
- import { Check as g, ChevronLeft as _, ChevronRight as v, Circle as y, Eye as b, EyeOff as x, Maximize2 as S, Minimize2 as C, X as w } from "lucide-react";
6
- import { createContext as T, useContext as E, useEffect as D, useId as O, useRef as k, useState as A } from "react";
7
- import { jsx as j, jsxs as M } from "react/jsx-runtime";
8
- import { Portal as N } from "@ark-ui/react/portal";
9
- import { useFieldContext as P } from "@ark-ui/react/field";
10
- import { Tabs as F } from "@ark-ui/react/tabs";
11
- import { Dialog as I, useDialogContext as ee } from "@ark-ui/react/dialog";
12
- import { PasswordInput as L } from "@ark-ui/react/password-input";
13
- //#region src/components/Tabs/Tabs.tsx
14
- function R({ classes: e, value: n, defaultValue: r, onValueChange: i, label: a, orientation: o, activationMode: s, lazyMount: c, unmountOnExit: l, className: u, ...d }) {
15
- let f = t("tabs", h, e)();
16
- return /* @__PURE__ */ j(F.Root, {
17
- ...d,
18
- className: f.base({ class: u }),
19
- value: n,
20
- defaultValue: r,
21
- onValueChange: (e) => i?.(e.value),
22
- orientation: o,
23
- activationMode: s,
24
- lazyMount: c,
25
- unmountOnExit: l,
26
- translations: a ? { listLabel: a } : void 0
27
- });
28
- }
29
- function z({ scrollable: e = !1, className: n, children: r, ...i }) {
30
- let a = t("tabs", h)(), o = k(null), [s, c] = A({
31
- start: !1,
32
- end: !1
33
- }), l = () => o.current && c(p(o.current));
34
- D(() => {
35
- if (!e || !o.current) return;
36
- l();
37
- let t = new ResizeObserver(l);
38
- return t.observe(o.current), () => t.disconnect();
39
- }, [e]);
40
- let u = (e) => {
41
- let t = o.current;
42
- if (!t) return;
43
- let n = getComputedStyle(t).direction === "rtl", r = t.clientWidth * .8 * (e ? 1 : -1) * (n ? -1 : 1), i = !matchMedia("(prefers-reduced-motion: reduce)").matches;
44
- t.scrollBy({
45
- left: r,
46
- behavior: i ? "smooth" : "auto"
47
- });
48
- };
49
- return e ? /* @__PURE__ */ M("div", {
50
- className: a.scroller(),
51
- children: [
52
- s.start && /* @__PURE__ */ j("button", {
53
- type: "button",
54
- tabIndex: -1,
55
- "aria-hidden": "true",
56
- "data-side": "start",
57
- className: a.scrollButton(),
58
- onClick: () => u(!1),
59
- children: /* @__PURE__ */ j(_, { className: a.scrollIcon() })
60
- }),
61
- /* @__PURE__ */ j(F.List, {
62
- ...i,
63
- ref: o,
64
- className: a.list({ class: [a.scrollList(), n] }),
65
- onScroll: (e) => {
66
- l(), i.onScroll?.(e);
67
- },
68
- children: r
69
- }),
70
- s.end && /* @__PURE__ */ j("button", {
71
- type: "button",
72
- tabIndex: -1,
73
- "aria-hidden": "true",
74
- "data-side": "end",
75
- className: a.scrollButton(),
76
- onClick: () => u(!0),
77
- children: /* @__PURE__ */ j(v, { className: a.scrollIcon() })
78
- })
79
- ]
80
- }) : /* @__PURE__ */ j(F.List, {
81
- ...i,
82
- className: a.list({ class: n }),
83
- children: r
84
- });
85
- }
86
- function B({ classes: e, value: n, icon: r, disabled: i, closable: a = !1, onClose: s, className: c, children: l, onKeyDown: u, ...d }) {
87
- let f = t("tabs", h, e)({ closable: a }), p = /* @__PURE__ */ M(F.Trigger, {
88
- ...d,
89
- className: f.trigger({ class: c }),
90
- value: n,
91
- disabled: i,
92
- ...a ? {
93
- "aria-keyshortcuts": "Delete",
94
- onKeyDown: (e) => {
95
- u?.(e), !(e.key !== "Delete" || e.defaultPrevented || i) && (e.preventDefault(), o(e.currentTarget, () => s?.(n)));
96
- }
97
- } : { onKeyDown: u },
98
- children: [r && /* @__PURE__ */ j(r, {
99
- className: f.icon(),
100
- "aria-hidden": "true"
101
- }), l]
102
- });
103
- return a ? /* @__PURE__ */ M("span", {
104
- role: "presentation",
105
- className: f.tab(),
106
- children: [p, /* @__PURE__ */ j("button", {
107
- type: "button",
108
- tabIndex: -1,
109
- "aria-hidden": "true",
110
- className: f.close(),
111
- disabled: i,
112
- onClick: (e) => {
113
- let t = e.currentTarget.parentElement?.querySelector("[role=tab]");
114
- t && o(t, () => s?.(n));
115
- },
116
- children: /* @__PURE__ */ j(w, { className: f.closeIcon() })
117
- })]
118
- }) : p;
119
- }
120
- function V({ classes: e, value: n, className: r, ...i }) {
121
- let a = t("tabs", h, e)();
122
- return /* @__PURE__ */ j(F.Content, {
123
- ...i,
124
- className: a.content({ class: r }),
125
- value: n
126
- });
127
- }
128
- //#endregion
129
- //#region src/components/Dialog/Dialog.tsx
130
- var H = T({ modal: !0 });
131
- function U({ open: e, defaultOpen: t, onOpenChange: n, role: r = "dialog", modal: i = !0, closeOnEscape: a = !0, closeOnInteractOutside: o, children: s }) {
132
- return /* @__PURE__ */ j(H.Provider, {
133
- value: { modal: i },
134
- children: /* @__PURE__ */ j(I.Root, {
135
- open: e,
136
- defaultOpen: t,
137
- onOpenChange: (e) => n?.(e.open),
138
- role: r,
139
- modal: i,
140
- closeOnEscape: a,
141
- closeOnInteractOutside: o,
142
- lazyMount: !0,
143
- unmountOnExit: !0,
144
- children: s
145
- })
146
- });
147
- }
148
- function W({ children: e }) {
149
- return /* @__PURE__ */ j(I.Trigger, {
150
- asChild: !0,
151
- children: e
152
- });
153
- }
154
- function G({ children: e }) {
155
- return /* @__PURE__ */ j(I.CloseTrigger, {
156
- asChild: !0,
157
- children: e
158
- });
159
- }
160
- function K(e, t) {
161
- let [n, r] = A({
162
- x: 0,
163
- y: 0
164
- }), i = k(null), [o, s] = A(t);
165
- o !== t && (s(t), t || r({
166
- x: 0,
167
- y: 0
168
- }));
169
- let c = (e, t, n) => {
170
- let i = t.getBoundingClientRect(), o = {
171
- x: i.x - n.x,
172
- y: i.y - n.y,
173
- width: i.width,
174
- height: i.height
175
- };
176
- r(a(e, o, {
177
- width: innerWidth,
178
- height: innerHeight
179
- }));
180
- };
181
- return {
182
- header: {
183
- onPointerDown(t) {
184
- if (!e || t.button !== 0 || t.target.closest("button, a, input")) return;
185
- let r = t.currentTarget.closest("[data-part=content]");
186
- r && (i.current = {
187
- id: t.pointerId,
188
- x: t.clientX,
189
- y: t.clientY,
190
- origin: n,
191
- content: r
192
- }, t.currentTarget.setPointerCapture?.(t.pointerId), t.preventDefault());
193
- },
194
- onPointerMove(e) {
195
- let t = i.current;
196
- t && e.pointerId === t.id && c({
197
- x: t.origin.x + e.clientX - t.x,
198
- y: t.origin.y + e.clientY - t.y
199
- }, t.content, n);
200
- },
201
- onPointerUp() {
202
- i.current = null;
203
- },
204
- onPointerCancel() {
205
- i.current = null;
206
- }
207
- },
208
- onKeyDown: (t) => {
209
- if (!e) return;
210
- let r = l(t);
211
- r && (t.preventDefault(), c({
212
- x: n.x + r.x,
213
- y: n.y + r.y
214
- }, t.currentTarget, n));
215
- },
216
- style: e && (n.x || n.y) ? { translate: `${n.x}px ${n.y}px` } : void 0
217
- };
218
- }
219
- function q({ classes: n, title: r, hideTitle: i, titlePosition: a = "body", description: o, icon: s, status: l, size: d, position: f, fullscreen: p, maximizable: m, maximized: h, defaultMaximized: g, onMaximizedChange: _, draggable: v, closable: y = !0, scrollBehavior: b, responsive: x = !0, closeLabel: T, maximizeLabel: D, restoreLabel: O, footer: k, portalTarget: P, className: F, style: L, onKeyDown: R, children: z, ...B }) {
220
- let V = t("dialog", c, n), U = e(), { modal: W } = E(H), G = ee(), [q, J] = A(g ?? !1), Y = h ?? q, X = () => {
221
- J(!Y), _?.(!Y);
222
- }, Z = K(!!v && !Y && !p, G.open), Q = V({
223
- status: l,
224
- size: d,
225
- position: f,
226
- scrollBehavior: b,
227
- fullscreen: p || Y,
228
- responsive: x,
229
- draggable: v && !Y,
230
- maximizable: m,
231
- hideTitle: i,
232
- titleInHeader: a === "header"
233
- }), $ = /* @__PURE__ */ j(I.Title, {
234
- className: Q.title(),
235
- children: r
236
- }), te = Y ? C : S;
237
- return /* @__PURE__ */ M(N, {
238
- ...P ? { container: { current: P } } : {},
239
- children: [W && /* @__PURE__ */ j(I.Backdrop, { className: Q.backdrop() }), /* @__PURE__ */ j(I.Positioner, {
240
- className: Q.positioner(),
241
- children: /* @__PURE__ */ M(I.Content, {
242
- ...B,
243
- ...v ? { "aria-keyshortcuts": u } : {},
244
- className: Q.content({ class: F }),
245
- style: Z.style ? {
246
- ...L,
247
- ...Z.style
248
- } : L,
249
- onKeyDown: (e) => {
250
- R?.(e), v && Z.onKeyDown(e);
251
- },
252
- children: [
253
- /* @__PURE__ */ M("div", {
254
- className: Q.header(),
255
- ...v ? Z.header : {},
256
- children: [
257
- s && /* @__PURE__ */ j("span", {
258
- className: Q.iconBox(),
259
- children: /* @__PURE__ */ j(s, {
260
- className: Q.icon(),
261
- "aria-hidden": "true"
262
- })
263
- }),
264
- a === "header" && $,
265
- m && /* @__PURE__ */ j("button", {
266
- type: "button",
267
- className: Q.maximize(),
268
- "aria-label": Y ? O ?? U.dialog.restore : D ?? U.dialog.maximize,
269
- onClick: X,
270
- children: /* @__PURE__ */ j(te, {
271
- className: Q.maximizeIcon(),
272
- "aria-hidden": "true"
273
- })
274
- }),
275
- y && /* @__PURE__ */ j(I.CloseTrigger, {
276
- className: Q.close(),
277
- "aria-label": T ?? U.common.close,
278
- children: /* @__PURE__ */ j(w, {
279
- className: Q.closeIcon(),
280
- "aria-hidden": "true"
281
- })
282
- })
283
- ]
284
- }),
285
- /* @__PURE__ */ M("div", {
286
- className: Q.body(),
287
- children: [
288
- a === "body" && $,
289
- o && /* @__PURE__ */ j(I.Description, {
290
- className: Q.description(),
291
- children: o
292
- }),
293
- z
294
- ]
295
- }),
296
- k && /* @__PURE__ */ j("div", {
297
- className: Q.footer(),
298
- children: k
299
- })
300
- ]
301
- })
302
- })]
303
- });
304
- }
305
- //#endregion
306
- //#region src/components/PasswordInput/PasswordInput.tsx
307
- function J({ classes: a, size: o, invalid: c, success: l, disabled: u, readOnly: p, required: h, name: _, defaultVisible: v, visible: S, onVisibleChange: C, autoComplete: w = "current-password", strength: T = !1, requirements: E, loading: D = !1, clearable: N = !1, clearLabel: F, mono: I = !1, id: ee, className: R, style: z, ...B }) {
308
- let V = t("passwordInput", d, a), H = e(), U = P(), W = n(), G = !(c || U?.invalid) && (!!l || W.success), K = V({
309
- size: o,
310
- success: G,
311
- mono: I
312
- }), q = O(), [J, Y] = A(String(B.defaultValue ?? "")), X = B.value === void 0 ? J : String(B.value), Z = f(X), Q = X ? H.passwordStrength.levels[Z] : "", $ = i(X, E ?? []), te = T || E?.length ? [
313
- U?.ariaDescribedby,
314
- T && `${q}strength`,
315
- E?.length && `${q}requirements`
316
- ].filter(Boolean).join(" ") : void 0, ne = k(null), re = () => {
317
- let e = ne.current?.querySelector("input");
318
- e && (m(e), e.focus());
319
- };
320
- return /* @__PURE__ */ M(L.Root, {
321
- className: K.base({ class: R }),
322
- style: z,
323
- invalid: c,
324
- disabled: u,
325
- readOnly: p,
326
- required: h,
327
- name: _,
328
- defaultVisible: v,
329
- visible: S,
330
- onVisibilityChange: (e) => C?.(e.visible),
331
- autoComplete: w,
332
- translations: H.passwordInput,
333
- ...s(ee, "input", { input: U?.ids.control }),
334
- children: [
335
- /* @__PURE__ */ M(L.Control, {
336
- ref: ne,
337
- className: K.control(),
338
- children: [
339
- /* @__PURE__ */ j(L.Input, {
340
- ...B,
341
- "aria-describedby": te,
342
- "aria-busy": D || void 0,
343
- className: K.input(),
344
- onChange: (e) => {
345
- Y(e.target.value), B.onChange?.(e);
346
- }
347
- }),
348
- (D || N || G) && /* @__PURE__ */ j(r, {
349
- loading: D,
350
- clear: N && !!X && !(u || U?.disabled) && !(p || U?.readOnly),
351
- clearLabel: F ?? H.field.clear,
352
- onClear: re,
353
- success: G,
354
- classes: {
355
- spinner: K.spinner(),
356
- clear: K.clear(),
357
- clearIcon: K.clearIcon(),
358
- statusIcon: K.statusIcon()
359
- }
360
- }),
361
- /* @__PURE__ */ j(L.VisibilityTrigger, {
362
- className: K.toggle(),
363
- children: /* @__PURE__ */ j(L.Indicator, {
364
- fallback: /* @__PURE__ */ j(b, {
365
- className: K.toggleIcon(),
366
- "aria-hidden": "true"
367
- }),
368
- children: /* @__PURE__ */ j(x, {
369
- className: K.toggleIcon(),
370
- "aria-hidden": "true"
371
- })
372
- })
373
- })
374
- ]
375
- }),
376
- T && /* @__PURE__ */ M("div", {
377
- className: K.strength(),
378
- children: [/* @__PURE__ */ j("div", {
379
- className: K.meter(),
380
- "aria-hidden": "true",
381
- children: [
382
- 1,
383
- 2,
384
- 3,
385
- 4
386
- ].map((e) => /* @__PURE__ */ j("span", {
387
- className: K.bar(),
388
- "data-level": Z,
389
- "data-filled": e <= Z || void 0
390
- }, e))
391
- }), /* @__PURE__ */ j("span", {
392
- id: `${q}strength`,
393
- className: K.strengthText(),
394
- "aria-live": "polite",
395
- children: Q && H.passwordStrength.label(Q)
396
- })]
397
- }),
398
- !!E?.length && /* @__PURE__ */ j("ul", {
399
- id: `${q}requirements`,
400
- className: K.requirements(),
401
- "aria-label": H.passwordRequirements.label,
402
- children: E.map((e, t) => /* @__PURE__ */ M("li", {
403
- className: K.requirement(),
404
- "data-met": $[t] || void 0,
405
- children: [
406
- $[t] ? /* @__PURE__ */ j(g, {
407
- className: K.requirementIcon(),
408
- "aria-hidden": "true"
409
- }) : /* @__PURE__ */ j(y, {
410
- className: K.requirementIcon(),
411
- "aria-hidden": "true"
412
- }),
413
- e.label,
414
- /* @__PURE__ */ j("span", {
415
- className: K.requirementState(),
416
- children: `: ${$[t] ? H.passwordRequirements.met : H.passwordRequirements.unmet}`
417
- })
418
- ]
419
- }, e.label))
420
- })
421
- ]
422
- });
423
- }
424
- //#endregion
425
- export { H as a, V as c, q as i, z as l, U as n, W as o, G as r, R as s, J as t, B as u };