jaguar-form 1.0.4 → 1.0.6
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 +38 -2
- package/dist/Cascader-ZIkXvvC3.js +226 -0
- package/dist/Select-BIBk_TT6.js +415 -0
- package/dist/TreeSelect-BQCyCCqa.js +350 -0
- package/dist/{compound-D4_6P0d_.js → compound-BX_PoTK5.js} +100 -88
- package/dist/compound.js +1 -1
- package/dist/core.js +1 -1
- package/dist/date-time.js +1 -1
- package/dist/demo-plant.svg +1 -0
- package/dist/form-CSfUExUT.js +599 -0
- package/dist/form.js +3 -3
- package/dist/{icons-BI3fdIey.js → icons-BwE05e0C.js} +1 -1
- package/dist/{image-upload-VtUlQgzJ.js → image-upload-D9oPG0Eh.js} +252 -179
- package/dist/image-upload.js +1 -1
- package/dist/index.js +15 -14
- package/dist/input.js +1 -1
- package/dist/inputs-Dx3xOy9q.js +718 -0
- package/dist/{useSelection-C0OEFZUE.js → lazy-tree-NCX3ntYm.js} +96 -4
- package/dist/locale/load.js +7 -3
- package/dist/pickers-Bci1y8cc.js +634 -0
- package/dist/select.js +3 -1
- package/dist/selection-DCIzhR5q.js +197 -0
- package/dist/{slider-CNwkLMmo.js → slider-AM0Egz9P.js} +1 -1
- package/dist/slider.js +1 -1
- package/dist/store-CFSQW-Fv.js +622 -0
- package/dist/style.css +1 -1
- package/dist/tree-select.js +1 -1
- package/dist/types/components/compound/ControlGroup.d.ts +5 -2
- package/dist/types/components/compound/index.d.ts +10 -1
- package/dist/types/components/extended-inputs.d.ts +34 -0
- package/dist/types/components/image-upload/ManagedImageUpload.d.ts +11 -4
- package/dist/types/components/image-upload/index.d.ts +3 -2
- package/dist/types/components/image-upload/upload.d.ts +1 -1
- package/dist/types/components/image-upload/usePreparation.d.ts +7 -0
- package/dist/types/components/image-upload/validation.d.ts +16 -0
- package/dist/types/components/inputs.d.ts +42 -4
- package/dist/types/components/select/Cascader.d.ts +13 -0
- package/dist/types/components/select/types.d.ts +10 -1
- package/dist/types/components/select/useRemoteOptions.d.ts +18 -0
- package/dist/types/components/select.d.ts +3 -0
- package/dist/types/config/index.d.ts +3 -0
- package/dist/types/entries/input.d.ts +5 -2
- package/dist/types/entries/select.d.ts +3 -0
- package/dist/types/form/adapter.d.ts +1 -0
- package/dist/types/form/index.d.ts +85 -10
- package/dist/types/form/store.d.ts +21 -1
- package/dist/types/locale/load.d.ts +2 -1
- package/dist/types/primitives/Control.d.ts +3 -1
- package/dist/types/primitives/Popup.d.ts +1 -0
- package/dist/types/types.d.ts +1 -0
- package/dist/types/utils/cascader.d.ts +12 -0
- package/dist/types/utils/decimal.d.ts +22 -0
- package/dist/types/utils/remote-options.d.ts +24 -0
- package/dist/useControllable-QDX_UWRh.js +102 -0
- package/package.json +1 -1
- package/dist/Control-B36bu6zQ.js +0 -47
- package/dist/Select-BG2H-YnK.js +0 -252
- package/dist/TreeSelect-CkPtMg-g.js +0 -440
- package/dist/form-DTI0Sqsy.js +0 -413
- package/dist/inputs-BOP8Ryne.js +0 -403
- package/dist/pickers-C9QTR2XN.js +0 -631
- package/dist/selection-CIEa1uce.js +0 -146
- package/dist/store-DOn9K-EA.js +0 -491
- package/dist/useControllable-Zax42z2F.js +0 -87
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { a as e, i as t, r as n, s as r } from "./useControllable-QDX_UWRh.js";
|
|
2
|
+
import { t as i } from "./icons-BwE05e0C.js";
|
|
3
|
+
import { createContext as a, useCallback as o, useContext as s, useId as c, useLayoutEffect as l, useState as u, useSyncExternalStore as d } from "react";
|
|
4
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
5
|
+
import { FloatingFocusManager as m, FloatingNode as h, FloatingOverlay as g, FloatingPortal as _, FloatingTree as v, autoUpdate as y, flip as b, offset as x, shift as S, size as C, useDismiss as w, useFloating as T, useFloatingNodeId as ee, useFloatingTree as E, useInteractions as D, useRole as te, useTransitionStyles as O } from "@floating-ui/react";
|
|
6
|
+
// src/primitives/Control.tsx
|
|
7
|
+
function k({ children: e, actions: n, prefix: a, suffix: o, prefixIcon: s, suffixIcon: c, size: l, variant: u, status: d, disabled: m, readOnly: h, className: g, style: _, floatingLabel: v, floatingFilled: y, floatingOpen: b, id: x, "aria-invalid": S }) {
|
|
8
|
+
let C = t();
|
|
9
|
+
return /* @__PURE__ */ p("div", {
|
|
10
|
+
className: r("rfe-control", !!v && "rfe-floating-shell", g),
|
|
11
|
+
style: _,
|
|
12
|
+
"data-size": l ?? C.size,
|
|
13
|
+
"data-variant": u ?? C.variant,
|
|
14
|
+
"data-status": S ? "error" : d ?? "default",
|
|
15
|
+
"data-disabled": m || void 0,
|
|
16
|
+
"data-readonly": h || void 0,
|
|
17
|
+
"data-floating-filled": y || void 0,
|
|
18
|
+
"data-floating-open": b || void 0,
|
|
19
|
+
children: [
|
|
20
|
+
(s || a) && /* @__PURE__ */ p("span", {
|
|
21
|
+
className: "rfe-affix",
|
|
22
|
+
children: [/* @__PURE__ */ f(i, { source: s }), a]
|
|
23
|
+
}),
|
|
24
|
+
e,
|
|
25
|
+
(c || o) && /* @__PURE__ */ p("span", {
|
|
26
|
+
className: "rfe-affix",
|
|
27
|
+
children: [/* @__PURE__ */ f(i, { source: c }), o]
|
|
28
|
+
}),
|
|
29
|
+
n,
|
|
30
|
+
v && /* @__PURE__ */ f("label", {
|
|
31
|
+
className: "rfe-shell-label",
|
|
32
|
+
htmlFor: x,
|
|
33
|
+
children: v
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function A({ name: e, source: t, label: n, onClick: r, disabled: a, hidden: o }) {
|
|
39
|
+
return /* @__PURE__ */ f("button", {
|
|
40
|
+
className: "rfe-action",
|
|
41
|
+
type: "button",
|
|
42
|
+
"aria-label": n,
|
|
43
|
+
title: n,
|
|
44
|
+
disabled: a || o,
|
|
45
|
+
style: o ? { visibility: "hidden" } : void 0,
|
|
46
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
47
|
+
onClick: (e) => {
|
|
48
|
+
e.stopPropagation(), r();
|
|
49
|
+
},
|
|
50
|
+
children: /* @__PURE__ */ f(i, {
|
|
51
|
+
name: e,
|
|
52
|
+
source: t
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// src/components/compound/context.ts
|
|
57
|
+
var j = a(null), M = () => s(j), N = "(max-width: 560px)", P = (e) => {
|
|
58
|
+
let t = window.matchMedia(N);
|
|
59
|
+
return t.addEventListener("change", e), () => t.removeEventListener("change", e);
|
|
60
|
+
}, F = () => typeof window < "u" && window.matchMedia(N).matches;
|
|
61
|
+
function I(e) {
|
|
62
|
+
return E() ? /* @__PURE__ */ f(L, { ...e }) : /* @__PURE__ */ f(v, { children: /* @__PURE__ */ f(L, { ...e }) });
|
|
63
|
+
}
|
|
64
|
+
function L({ open: r, onOpenChange: i, children: a, trigger: s, placement: v = "bottom-start", popupWidth: E = "trigger", popupMaxHeight: k = 320, portalContainer: A, role: j = "dialog", label: N, popupMode: I, layout: L = "content", initialFocus: R = 0 }) {
|
|
65
|
+
let z = M(), [B, V] = u(null), H = t(), U = e(), W = c(), G = ee(), K = d(P, F, () => !1), q = I ?? H.popupMode, J = q === "sheet" || q === "auto" && K, [Y, X] = u(null), { refs: Z, floatingStyles: ne, context: Q, placement: re } = T({
|
|
66
|
+
nodeId: G,
|
|
67
|
+
open: r,
|
|
68
|
+
onOpenChange: i,
|
|
69
|
+
placement: v,
|
|
70
|
+
strategy: J ? "fixed" : "absolute",
|
|
71
|
+
whileElementsMounted: J ? void 0 : y,
|
|
72
|
+
middleware: J ? [] : [
|
|
73
|
+
x(6),
|
|
74
|
+
b(),
|
|
75
|
+
S({ padding: 8 }),
|
|
76
|
+
C({
|
|
77
|
+
padding: 8,
|
|
78
|
+
apply({ availableHeight: e, availableWidth: t, rects: n, elements: r }) {
|
|
79
|
+
Object.assign(r.floating.style, {
|
|
80
|
+
maxHeight: `${Math.max(0, Math.min(e, k))}px`,
|
|
81
|
+
maxWidth: `${Math.max(0, t)}px`,
|
|
82
|
+
width: `${Math.max(0, Math.min(t, E === "trigger" ? n.reference.width : E))}px`
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
}), ie = o((e) => {
|
|
88
|
+
Z.setFloating(e), V(e);
|
|
89
|
+
}, [Z.setFloating]);
|
|
90
|
+
l(() => {
|
|
91
|
+
if (r && B) return z?.registerPopup(B);
|
|
92
|
+
}, [
|
|
93
|
+
r,
|
|
94
|
+
B,
|
|
95
|
+
z
|
|
96
|
+
]);
|
|
97
|
+
let ae = o((e) => {
|
|
98
|
+
Z.setReference(e), X(e?.closest("dialog[open]") ?? null);
|
|
99
|
+
}, [Z.setReference]), oe = w(Q, { bubbles: {
|
|
100
|
+
escapeKey: !1,
|
|
101
|
+
outsidePress: !0
|
|
102
|
+
} }), se = te(Q, { role: j }), { getReferenceProps: ce, getFloatingProps: le } = D([oe, se]), { isMounted: ue, styles: de } = O(Q, {
|
|
103
|
+
duration: H.motion ? {
|
|
104
|
+
open: 160,
|
|
105
|
+
close: 100
|
|
106
|
+
} : 0,
|
|
107
|
+
initial: ({ side: e }) => ({
|
|
108
|
+
opacity: 0,
|
|
109
|
+
transform: J ? "translateY(16px)" : `translateY(${e === "top" ? 4 : -4}px) scale(.985)`
|
|
110
|
+
})
|
|
111
|
+
}), fe = {
|
|
112
|
+
lang: U.code,
|
|
113
|
+
dir: U.direction,
|
|
114
|
+
"data-theme": H.theme,
|
|
115
|
+
"data-density": H.density,
|
|
116
|
+
"data-motion": H.motion ? "on" : "off"
|
|
117
|
+
}, $ = /* @__PURE__ */ f(m, {
|
|
118
|
+
context: Q,
|
|
119
|
+
modal: J,
|
|
120
|
+
initialFocus: R,
|
|
121
|
+
disabled: !r,
|
|
122
|
+
returnFocus: !0,
|
|
123
|
+
children: /* @__PURE__ */ f("div", {
|
|
124
|
+
...fe,
|
|
125
|
+
className: "rfe-scope rfe-popup-position",
|
|
126
|
+
"data-sheet": J || void 0,
|
|
127
|
+
ref: ie,
|
|
128
|
+
style: {
|
|
129
|
+
...n(H.tokens),
|
|
130
|
+
...J ? {
|
|
131
|
+
position: "fixed",
|
|
132
|
+
insetInline: 0,
|
|
133
|
+
bottom: 0,
|
|
134
|
+
width: "100%",
|
|
135
|
+
maxWidth: "100%",
|
|
136
|
+
maxHeight: "85dvh"
|
|
137
|
+
} : ne
|
|
138
|
+
},
|
|
139
|
+
...le({
|
|
140
|
+
id: W,
|
|
141
|
+
"aria-label": N,
|
|
142
|
+
"aria-modal": J || void 0
|
|
143
|
+
}),
|
|
144
|
+
children: /* @__PURE__ */ p("div", {
|
|
145
|
+
className: "rfe-panel",
|
|
146
|
+
"data-layout": L,
|
|
147
|
+
"data-side": re.split("-")[0],
|
|
148
|
+
style: {
|
|
149
|
+
...de,
|
|
150
|
+
pointerEvents: r ? "auto" : "none"
|
|
151
|
+
},
|
|
152
|
+
inert: !r,
|
|
153
|
+
children: [J && /* @__PURE__ */ f("span", {
|
|
154
|
+
className: "rfe-sheet-handle",
|
|
155
|
+
"aria-hidden": "true"
|
|
156
|
+
}), a]
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
return /* @__PURE__ */ p(h, {
|
|
161
|
+
id: G,
|
|
162
|
+
children: [s(ce({
|
|
163
|
+
"aria-expanded": r,
|
|
164
|
+
"aria-controls": r ? W : void 0
|
|
165
|
+
}), ae, W), ue && /* @__PURE__ */ f(_, {
|
|
166
|
+
root: A ?? Y ?? void 0,
|
|
167
|
+
children: J ? /* @__PURE__ */ f(g, {
|
|
168
|
+
lockScroll: r,
|
|
169
|
+
className: "rfe-sheet-overlay",
|
|
170
|
+
style: n(H.tokens),
|
|
171
|
+
children: $
|
|
172
|
+
}) : $
|
|
173
|
+
})]
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
// src/utils/selection.ts
|
|
177
|
+
function R(e, t, n, r) {
|
|
178
|
+
if (e <= 0) return -1;
|
|
179
|
+
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;
|
|
180
|
+
for (; o >= 0 && o < e;) {
|
|
181
|
+
if (r(o)) return o;
|
|
182
|
+
o += a;
|
|
183
|
+
}
|
|
184
|
+
return t >= 0 && t < e && r(t) ? t : -1;
|
|
185
|
+
}
|
|
186
|
+
function z(e, t, n, r, i = 1, a = 4) {
|
|
187
|
+
if (e <= 0 || i <= 0 || !n) return 0;
|
|
188
|
+
let o = (o) => {
|
|
189
|
+
let s = 1, c = 0, l = t.slice(0, o).map((t) => Math.min(t, e));
|
|
190
|
+
o < n && l.push(Math.min(r, e));
|
|
191
|
+
for (let t of l) if (c && c + a + t > e && (s++, c = 0), c += t + (c ? a : 0), s > i) return !1;
|
|
192
|
+
return !0;
|
|
193
|
+
}, s = Math.min(t.length, n);
|
|
194
|
+
for (; s > 0 && !o(s);) s--;
|
|
195
|
+
return s;
|
|
196
|
+
}
|
|
197
|
+
export { M as a, j as i, R as n, A as o, I as r, k as s, z 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-QDX_UWRh.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-AM0Egz9P.js";
|