jaguar-form 1.0.1 → 1.0.3
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.
- package/README.md +24 -0
- package/dist/{Control-fWNQOzmu.js → Control-B36bu6zQ.js} +2 -2
- package/dist/{Select-BFLDNUiq.js → Select-BG2H-YnK.js} +5 -5
- package/dist/{TreeSelect-D8smQmgp.js → TreeSelect-CkPtMg-g.js} +6 -5
- package/dist/compound-D4_6P0d_.js +320 -0
- package/dist/compound.js +1 -0
- package/dist/core.js +3 -1
- package/dist/date-time.js +1 -1
- package/dist/form-DTI0Sqsy.js +413 -0
- package/dist/form.js +4 -3
- package/dist/{icons-KmLuj5v3.js → icons-BI3fdIey.js} +2 -1
- package/dist/{image-upload-CkX8vlWK.js → image-upload-VtUlQgzJ.js} +4 -4
- package/dist/image-upload.js +1 -1
- package/dist/index.js +14 -12
- package/dist/input.js +1 -1
- package/dist/{inputs-DNNFmj2K.js → inputs-BOP8Ryne.js} +5 -4
- package/dist/{pickers-BOMKe7vt.js → pickers-C9QTR2XN.js} +6 -4
- package/dist/select.js +1 -1
- package/dist/selection-CIEa1uce.js +146 -0
- package/dist/{slider-BwDcSnnI.js → slider-CNwkLMmo.js} +1 -1
- package/dist/slider.js +1 -1
- package/dist/{store-DmlIFdPW.js → store-DOn9K-EA.js} +171 -229
- package/dist/style.css +1 -1
- package/dist/tree-select.js +1 -1
- package/dist/types/components/compound/ControlGroup.d.ts +29 -0
- package/dist/types/components/compound/context.d.ts +5 -0
- package/dist/types/components/compound/index.d.ts +40 -0
- package/dist/types/components/compound/model.d.ts +14 -0
- package/dist/types/components/compound/types.d.ts +24 -0
- package/dist/types/components/date-time/types.d.ts +1 -0
- package/dist/types/config/index.d.ts +2 -0
- package/dist/types/entries/compound.d.ts +1 -0
- package/dist/types/icons/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/{useControllable-Dl8gno_5.js → useControllable-Zax42z2F.js} +6 -1
- package/dist/{useSelection-FYP8nzFQ.js → useSelection-C0OEFZUE.js} +3 -3
- package/dist/validation-D6vk5NAv.js +61 -0
- package/package.json +5 -1
- package/dist/form-zqtJgUQ3.js +0 -407
- package/dist/selection-Bfrk6SoB.js +0 -136
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { a as e, i as t, r as n } from "./useControllable-Zax42z2F.js";
|
|
2
|
+
import { createContext as r, useCallback as i, useContext as a, useId as o, useLayoutEffect as s, useState as c, useSyncExternalStore as l } from "react";
|
|
3
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
4
|
+
import { FloatingFocusManager as ee, FloatingNode as f, FloatingOverlay as p, FloatingPortal as m, FloatingTree as h, autoUpdate as g, flip as _, offset as v, shift as y, size as b, useDismiss as x, useFloating as S, useFloatingNodeId as C, useFloatingTree as w, useInteractions as T, useRole as E, useTransitionStyles as te } from "@floating-ui/react";
|
|
5
|
+
// src/components/compound/context.ts
|
|
6
|
+
var D = r(null), O = () => a(D), k = "(max-width: 560px)", ne = (e) => {
|
|
7
|
+
let t = window.matchMedia(k);
|
|
8
|
+
return t.addEventListener("change", e), () => t.removeEventListener("change", e);
|
|
9
|
+
}, A = () => typeof window < "u" && window.matchMedia(k).matches;
|
|
10
|
+
function j(e) {
|
|
11
|
+
return w() ? /* @__PURE__ */ u(M, { ...e }) : /* @__PURE__ */ u(h, { children: /* @__PURE__ */ u(M, { ...e }) });
|
|
12
|
+
}
|
|
13
|
+
function M({ open: r, onOpenChange: a, children: h, trigger: w, placement: D = "bottom-start", popupWidth: k = "trigger", popupMaxHeight: j = 320, portalContainer: M, role: N = "dialog", label: P, popupMode: F, layout: I = "content" }) {
|
|
14
|
+
let L = O(), [R, z] = c(null), B = t(), V = e(), H = o(), U = C(), W = l(ne, A, () => !1), G = F ?? B.popupMode, K = G === "sheet" || G === "auto" && W, [q, J] = c(null), { refs: Y, floatingStyles: X, context: Z, placement: re } = S({
|
|
15
|
+
nodeId: U,
|
|
16
|
+
open: r,
|
|
17
|
+
onOpenChange: a,
|
|
18
|
+
placement: D,
|
|
19
|
+
strategy: K ? "fixed" : "absolute",
|
|
20
|
+
whileElementsMounted: K ? void 0 : g,
|
|
21
|
+
middleware: K ? [] : [
|
|
22
|
+
v(6),
|
|
23
|
+
_(),
|
|
24
|
+
y({ padding: 8 }),
|
|
25
|
+
b({
|
|
26
|
+
padding: 8,
|
|
27
|
+
apply({ availableHeight: e, availableWidth: t, rects: n, elements: r }) {
|
|
28
|
+
Object.assign(r.floating.style, {
|
|
29
|
+
maxHeight: `${Math.max(0, Math.min(e, j))}px`,
|
|
30
|
+
maxWidth: `${Math.max(0, t)}px`,
|
|
31
|
+
width: `${Math.max(0, Math.min(t, k === "trigger" ? n.reference.width : k))}px`
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
}), ie = i((e) => {
|
|
37
|
+
Y.setFloating(e), z(e);
|
|
38
|
+
}, [Y.setFloating]);
|
|
39
|
+
s(() => {
|
|
40
|
+
if (r && R) return L?.registerPopup(R);
|
|
41
|
+
}, [
|
|
42
|
+
r,
|
|
43
|
+
R,
|
|
44
|
+
L
|
|
45
|
+
]);
|
|
46
|
+
let ae = i((e) => {
|
|
47
|
+
Y.setReference(e), J(e?.closest("dialog[open]") ?? null);
|
|
48
|
+
}, [Y.setReference]), oe = x(Z, { bubbles: {
|
|
49
|
+
escapeKey: !1,
|
|
50
|
+
outsidePress: !0
|
|
51
|
+
} }), se = E(Z, { role: N }), { getReferenceProps: Q, getFloatingProps: ce } = T([oe, se]), { isMounted: le, styles: ue } = te(Z, {
|
|
52
|
+
duration: B.motion ? {
|
|
53
|
+
open: 160,
|
|
54
|
+
close: 100
|
|
55
|
+
} : 0,
|
|
56
|
+
initial: ({ side: e }) => ({
|
|
57
|
+
opacity: 0,
|
|
58
|
+
transform: K ? "translateY(16px)" : `translateY(${e === "top" ? 4 : -4}px) scale(.985)`
|
|
59
|
+
})
|
|
60
|
+
}), de = {
|
|
61
|
+
lang: V.code,
|
|
62
|
+
dir: V.direction,
|
|
63
|
+
"data-theme": B.theme,
|
|
64
|
+
"data-density": B.density,
|
|
65
|
+
"data-motion": B.motion ? "on" : "off"
|
|
66
|
+
}, $ = /* @__PURE__ */ u(ee, {
|
|
67
|
+
context: Z,
|
|
68
|
+
modal: K,
|
|
69
|
+
initialFocus: 0,
|
|
70
|
+
disabled: !r,
|
|
71
|
+
returnFocus: !0,
|
|
72
|
+
children: /* @__PURE__ */ u("div", {
|
|
73
|
+
...de,
|
|
74
|
+
className: "rfe-scope rfe-popup-position",
|
|
75
|
+
"data-sheet": K || void 0,
|
|
76
|
+
ref: ie,
|
|
77
|
+
style: {
|
|
78
|
+
...n(B.tokens),
|
|
79
|
+
...K ? {
|
|
80
|
+
position: "fixed",
|
|
81
|
+
insetInline: 0,
|
|
82
|
+
bottom: 0,
|
|
83
|
+
width: "100%",
|
|
84
|
+
maxWidth: "100%",
|
|
85
|
+
maxHeight: "85dvh"
|
|
86
|
+
} : X
|
|
87
|
+
},
|
|
88
|
+
...ce({
|
|
89
|
+
id: H,
|
|
90
|
+
"aria-label": P,
|
|
91
|
+
"aria-modal": K || void 0
|
|
92
|
+
}),
|
|
93
|
+
children: /* @__PURE__ */ d("div", {
|
|
94
|
+
className: "rfe-panel",
|
|
95
|
+
"data-layout": I,
|
|
96
|
+
"data-side": re.split("-")[0],
|
|
97
|
+
style: {
|
|
98
|
+
...ue,
|
|
99
|
+
pointerEvents: r ? "auto" : "none"
|
|
100
|
+
},
|
|
101
|
+
inert: !r,
|
|
102
|
+
children: [K && /* @__PURE__ */ u("span", {
|
|
103
|
+
className: "rfe-sheet-handle",
|
|
104
|
+
"aria-hidden": "true"
|
|
105
|
+
}), h]
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
});
|
|
109
|
+
return /* @__PURE__ */ d(f, {
|
|
110
|
+
id: U,
|
|
111
|
+
children: [w(Q({
|
|
112
|
+
"aria-expanded": r,
|
|
113
|
+
"aria-controls": r ? H : void 0
|
|
114
|
+
}), ae, H), le && /* @__PURE__ */ u(m, {
|
|
115
|
+
root: M ?? q ?? void 0,
|
|
116
|
+
children: K ? /* @__PURE__ */ u(p, {
|
|
117
|
+
lockScroll: r,
|
|
118
|
+
className: "rfe-sheet-overlay",
|
|
119
|
+
style: n(B.tokens),
|
|
120
|
+
children: $
|
|
121
|
+
}) : $
|
|
122
|
+
})]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
// src/utils/selection.ts
|
|
126
|
+
function N(e, t, n, r) {
|
|
127
|
+
if (e <= 0) return -1;
|
|
128
|
+
let i = n === "ArrowUp" || n === "End", a = i ? -1 : 1, o = n === "Home" ? 0 : n === "End" ? e - 1 : t < 0 ? i ? e - 1 : 0 : t + a;
|
|
129
|
+
for (; o >= 0 && o < e;) {
|
|
130
|
+
if (r(o)) return o;
|
|
131
|
+
o += a;
|
|
132
|
+
}
|
|
133
|
+
return t >= 0 && t < e && r(t) ? t : -1;
|
|
134
|
+
}
|
|
135
|
+
function P(e, t, n, r, i = 1, a = 4) {
|
|
136
|
+
if (e <= 0 || i <= 0 || !n) return 0;
|
|
137
|
+
let o = (o) => {
|
|
138
|
+
let s = 1, c = 0, l = t.slice(0, o).map((t) => Math.min(t, e));
|
|
139
|
+
o < n && l.push(Math.min(r, e));
|
|
140
|
+
for (let t of l) if (c && c + a + t > e && (s++, c = 0), c += t + (c ? a : 0), s > i) return !1;
|
|
141
|
+
return !0;
|
|
142
|
+
}, s = Math.min(t.length, n);
|
|
143
|
+
for (; s > 0 && !o(s);) s--;
|
|
144
|
+
return s;
|
|
145
|
+
}
|
|
146
|
+
export { O as a, D as i, N as n, j as r, P as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useId as e, useLayoutEffect as t, useMemo as n, useRef as r, useState as i } from "react";
|
|
2
|
-
import { a, i as o, s, t as c } from "./useControllable-
|
|
2
|
+
import { a, i as o, s, t as c } from "./useControllable-Zax42z2F.js";
|
|
3
3
|
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
4
4
|
// src/components/slider/math.ts
|
|
5
5
|
function f(e = 0, t = 100, n = 1) {
|
package/dist/slider.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as RangeSlider, n as Slider } from "./slider-
|
|
1
|
+
export { t as RangeSlider, n as Slider } from "./slider-CNwkLMmo.js";
|