@cascivo/react 0.18.0 → 1.0.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.
- package/README.md +4 -3
- package/dist/action-sheet/action-sheet.js +1 -1
- package/dist/breadcrumb/breadcrumb.js +7 -7
- package/dist/checkbox/checkbox.js +11 -10
- package/dist/color-picker/color-picker.js +81 -77
- package/dist/combobox/combobox.js +81 -76
- package/dist/command-menu/command-menu.js +104 -104
- package/dist/comparison/comparison.js +18 -18
- package/dist/data-table/data-table.css +1 -1
- package/dist/data-table/data-table.js +148 -121
- package/dist/data-table/data-table.module.js +29 -29
- package/dist/date-picker/date-picker.js +98 -93
- package/dist/date-range-picker/date-range-picker.js +1 -1
- package/dist/dock/dock.js +2 -2
- package/dist/dropdown/dropdown.js +43 -40
- package/dist/editable/editable.js +29 -20
- package/dist/fab/fab.js +37 -37
- package/dist/field/field.js +24 -17
- package/dist/file-uploader/file-uploader.js +24 -23
- package/dist/filter/filter.js +11 -11
- package/dist/index.d.ts +1302 -85
- package/dist/input/input.js +14 -13
- package/dist/navigation-menu/navigation-menu.js +9 -9
- package/dist/node/action-sheet/action-sheet.js +1 -1
- package/dist/node/breadcrumb/breadcrumb.js +7 -7
- package/dist/node/checkbox/checkbox.js +11 -10
- package/dist/node/color-picker/color-picker.js +81 -77
- package/dist/node/combobox/combobox.js +81 -76
- package/dist/node/command-menu/command-menu.js +104 -104
- package/dist/node/comparison/comparison.js +18 -18
- package/dist/node/data-table/data-table.js +148 -121
- package/dist/node/data-table/data-table.module.js +29 -29
- package/dist/node/date-picker/date-picker.js +98 -93
- package/dist/node/date-range-picker/date-range-picker.js +1 -1
- package/dist/node/dock/dock.js +2 -2
- package/dist/node/dropdown/dropdown.js +43 -40
- package/dist/node/editable/editable.js +29 -20
- package/dist/node/fab/fab.js +37 -37
- package/dist/node/field/field.js +24 -17
- package/dist/node/file-uploader/file-uploader.js +24 -23
- package/dist/node/filter/filter.js +11 -11
- package/dist/node/input/input.js +14 -13
- package/dist/node/navigation-menu/navigation-menu.js +9 -9
- package/dist/node/number-input/number-input.js +28 -27
- package/dist/node/overflow-menu/overflow-menu.js +7 -7
- package/dist/node/progress/progress.js +3 -3
- package/dist/node/progress-circle/progress-circle.js +8 -8
- package/dist/node/progress-indicator/progress-indicator.js +1 -1
- package/dist/node/qr-code/qr-code.js +11 -11
- package/dist/node/radial-progress/radial-progress.js +9 -9
- package/dist/node/radio/radio.js +10 -9
- package/dist/node/react/src/index.js +93 -93
- package/dist/node/resizable/resizable.js +24 -24
- package/dist/node/search/search.js +35 -31
- package/dist/node/select/select.js +15 -14
- package/dist/node/side-nav/side-nav.js +35 -35
- package/dist/node/side-nav/side-nav.module.js +27 -27
- package/dist/node/slider/slider.js +13 -12
- package/dist/node/spinner/spinner.js +4 -4
- package/dist/node/steps/steps.js +10 -10
- package/dist/node/structured-list/structured-list.js +14 -14
- package/dist/node/swap/swap.js +5 -5
- package/dist/node/switcher/switcher.js +5 -5
- package/dist/node/tags-input/tags-input.js +20 -16
- package/dist/node/textarea/textarea.js +14 -13
- package/dist/node/time-picker/time-picker.js +21 -20
- package/dist/node/toggle/toggle.js +8 -7
- package/dist/node/tree-view/tree-view.js +43 -43
- package/dist/node/virtual-list/virtual-list.js +10 -10
- package/dist/node/wheel-picker/wheel-picker.js +36 -36
- package/dist/number-input/number-input.js +28 -27
- package/dist/overflow-menu/overflow-menu.js +7 -7
- package/dist/progress/progress.js +3 -3
- package/dist/progress-circle/progress-circle.js +8 -8
- package/dist/progress-indicator/progress-indicator.js +1 -1
- package/dist/qr-code/qr-code.js +11 -11
- package/dist/radial-progress/radial-progress.js +9 -9
- package/dist/radio/radio.js +10 -9
- package/dist/react/src/index.js +93 -93
- package/dist/resizable/resizable.js +24 -24
- package/dist/search/search.js +35 -31
- package/dist/select/select.js +15 -14
- package/dist/side-nav/side-nav.css +1 -1
- package/dist/side-nav/side-nav.js +35 -35
- package/dist/side-nav/side-nav.module.js +27 -27
- package/dist/slider/slider.js +13 -12
- package/dist/spinner/spinner.js +4 -4
- package/dist/steps/steps.js +10 -10
- package/dist/structured-list/structured-list.js +14 -14
- package/dist/styles.css +2 -2
- package/dist/swap/swap.js +5 -5
- package/dist/switcher/switcher.js +5 -5
- package/dist/tags-input/tags-input.js +20 -16
- package/dist/textarea/textarea.js +14 -13
- package/dist/time-picker/time-picker.js +21 -20
- package/dist/toggle/toggle.js +8 -7
- package/dist/tree-view/tree-view.js +43 -43
- package/dist/virtual-list/virtual-list.js +10 -10
- package/dist/wheel-picker/wheel-picker.js +36 -36
- package/package.json +4 -4
- package/readme.body.md +4 -3
package/dist/fab/fab.js
CHANGED
|
@@ -5,57 +5,57 @@ import { useId as t, useRef as n } from "react";
|
|
|
5
5
|
import { DismissableLayer as r, Presence as i, cn as a, focusElement as o, useControllableSignal as s, useRovingFocus as c, useSignalEffect as l, useSignals as u } from "@cascivo/core";
|
|
6
6
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
7
7
|
//#region ../components/src/fab/fab.tsx
|
|
8
|
-
function p({ children: p,
|
|
8
|
+
function p({ children: p, ariaLabel: m, label: h, onClick: g, actions: _, position: v = "bottom-end", open: y, defaultOpen: b, onOpenChange: x, className: S }) {
|
|
9
9
|
u();
|
|
10
|
-
let
|
|
11
|
-
value:
|
|
12
|
-
defaultValue:
|
|
13
|
-
onChange:
|
|
14
|
-
}),
|
|
10
|
+
let C = _ != null && _.length > 0, [w, T] = s({
|
|
11
|
+
value: y,
|
|
12
|
+
defaultValue: b ?? !1,
|
|
13
|
+
onChange: x
|
|
14
|
+
}), E = c({
|
|
15
15
|
orientation: "vertical",
|
|
16
16
|
loop: !0
|
|
17
|
-
}),
|
|
17
|
+
}), D = n(null), O = n(null), k = t(), A = n(!1);
|
|
18
18
|
l(() => {
|
|
19
|
-
let e =
|
|
20
|
-
e && !
|
|
19
|
+
let e = C && w.value;
|
|
20
|
+
e && !A.current ? O.current?.querySelector("[role=\"menuitem\"]:not([aria-disabled=\"true\"])")?.focus() : !e && A.current && o(D.current), A.current = e;
|
|
21
21
|
});
|
|
22
|
-
let
|
|
23
|
-
e.disabled || (e.onSelect(),
|
|
24
|
-
},
|
|
25
|
-
ref:
|
|
22
|
+
let j = (e) => {
|
|
23
|
+
e.disabled || (e.onSelect(), T(!1));
|
|
24
|
+
}, M = /* @__PURE__ */ d("button", {
|
|
25
|
+
ref: D,
|
|
26
26
|
type: "button",
|
|
27
|
-
"aria-label": m,
|
|
27
|
+
"aria-label": h ?? m,
|
|
28
28
|
className: e.fab,
|
|
29
|
-
...
|
|
29
|
+
...C ? {
|
|
30
30
|
"aria-haspopup": "menu",
|
|
31
|
-
"aria-expanded":
|
|
32
|
-
"aria-controls":
|
|
33
|
-
"data-state":
|
|
34
|
-
onClick: () =>
|
|
35
|
-
} : { onClick:
|
|
31
|
+
"aria-expanded": w.value,
|
|
32
|
+
"aria-controls": k,
|
|
33
|
+
"data-state": w.value ? "open" : "closed",
|
|
34
|
+
onClick: () => T(!w.value)
|
|
35
|
+
} : { onClick: g },
|
|
36
36
|
children: /* @__PURE__ */ d("span", {
|
|
37
37
|
className: e.icon,
|
|
38
38
|
"aria-hidden": "true",
|
|
39
39
|
children: p
|
|
40
40
|
})
|
|
41
41
|
});
|
|
42
|
-
return
|
|
43
|
-
onDismiss: () =>
|
|
44
|
-
escapeDismisses:
|
|
45
|
-
disableOutsidePointer: !
|
|
42
|
+
return C ? /* @__PURE__ */ d(r, {
|
|
43
|
+
onDismiss: () => T(!1),
|
|
44
|
+
escapeDismisses: w.value,
|
|
45
|
+
disableOutsidePointer: !w.value,
|
|
46
46
|
children: /* @__PURE__ */ f("div", {
|
|
47
|
-
className: a(e.root,
|
|
48
|
-
"data-position":
|
|
47
|
+
className: a(e.root, S),
|
|
48
|
+
"data-position": v,
|
|
49
49
|
children: [/* @__PURE__ */ d(i, {
|
|
50
|
-
present:
|
|
50
|
+
present: w,
|
|
51
51
|
children: /* @__PURE__ */ d("menu", {
|
|
52
|
-
ref:
|
|
53
|
-
id:
|
|
52
|
+
ref: O,
|
|
53
|
+
id: k,
|
|
54
54
|
role: "menu",
|
|
55
|
-
"aria-label": m,
|
|
55
|
+
"aria-label": h ?? m,
|
|
56
56
|
className: e.dial,
|
|
57
|
-
children:
|
|
58
|
-
let r =
|
|
57
|
+
children: _.map((t, n) => {
|
|
58
|
+
let r = E.getItemProps(n);
|
|
59
59
|
return /* @__PURE__ */ d("li", {
|
|
60
60
|
role: "presentation",
|
|
61
61
|
className: e.dialItem,
|
|
@@ -68,7 +68,7 @@ function p({ children: p, label: m, onClick: h, actions: g, position: _ = "botto
|
|
|
68
68
|
className: e.action,
|
|
69
69
|
onKeyDown: r.onKeyDown,
|
|
70
70
|
onFocus: r.onFocus,
|
|
71
|
-
onClick: () =>
|
|
71
|
+
onClick: () => j(t),
|
|
72
72
|
children: [/* @__PURE__ */ d("span", {
|
|
73
73
|
className: e.actionLabel,
|
|
74
74
|
children: t.label
|
|
@@ -81,12 +81,12 @@ function p({ children: p, label: m, onClick: h, actions: g, position: _ = "botto
|
|
|
81
81
|
}, t.id ?? n);
|
|
82
82
|
})
|
|
83
83
|
})
|
|
84
|
-
}),
|
|
84
|
+
}), M]
|
|
85
85
|
})
|
|
86
86
|
}) : /* @__PURE__ */ d("div", {
|
|
87
|
-
className: a(e.root,
|
|
88
|
-
"data-position":
|
|
89
|
-
children:
|
|
87
|
+
className: a(e.root, S),
|
|
88
|
+
"data-position": v,
|
|
89
|
+
children: M
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
//#endregion
|
package/dist/field/field.js
CHANGED
|
@@ -13,34 +13,41 @@ function d(e, t) {
|
|
|
13
13
|
let n = String(e);
|
|
14
14
|
l.has(n) || (l.add(n), console.warn(`cascivo Field: both the Field and its child control define a \`label\` (${n}). Omit the child's \`label\` inside a Field — it renders a second <label> for the same control. The Field owns the label.`));
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
let
|
|
16
|
+
var f = /* @__PURE__ */ new Set();
|
|
17
|
+
function p(e, t) {
|
|
18
|
+
if (!u() || e == null || t.props.hint == null) return;
|
|
19
|
+
let n = String(e);
|
|
20
|
+
f.has(n) || (f.add(n), console.warn(`cascivo Field: both the Field and its child control define supporting text (${n}). Omit the child's \`hint\` inside a Field — the Field owns it, and only the Field's is wired into aria-describedby.`));
|
|
21
|
+
}
|
|
22
|
+
function m({ label: l, description: u, hint: f, error: m, required: h = !1, disabled: g = !1, id: _, children: v, className: y }) {
|
|
23
|
+
let b = u ?? f, x = r("cascade-field"), S = _ ?? x, C = `${S}-description`, w = `${S}-error`, T = `${S}-label`, E = [b ? C : null, m ? w : null].filter(Boolean).join(" ") || void 0, D = { id: S };
|
|
24
|
+
l != null && (D["aria-labelledby"] = T), E && (D["aria-describedby"] = E), m && (D["aria-invalid"] = !0), (g || v.props.disabled) && (D.disabled = !0), o(v) && (d(l, v), p(b, v));
|
|
25
|
+
let O = o(v) ? a(i.only(v), D) : v;
|
|
20
26
|
return /* @__PURE__ */ c("div", {
|
|
21
|
-
className: n(t.field,
|
|
22
|
-
"data-disabled":
|
|
27
|
+
className: n(t.field, y),
|
|
28
|
+
"data-disabled": g ? "" : void 0,
|
|
23
29
|
children: [
|
|
24
30
|
l && /* @__PURE__ */ s(e, {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
id: T,
|
|
32
|
+
htmlFor: S,
|
|
33
|
+
required: h,
|
|
34
|
+
disabled: g,
|
|
28
35
|
children: l
|
|
29
36
|
}),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
id:
|
|
37
|
+
O,
|
|
38
|
+
b && /* @__PURE__ */ s("p", {
|
|
39
|
+
id: C,
|
|
33
40
|
className: t.description,
|
|
34
|
-
children:
|
|
41
|
+
children: b
|
|
35
42
|
}),
|
|
36
|
-
|
|
37
|
-
id:
|
|
43
|
+
m && /* @__PURE__ */ s("p", {
|
|
44
|
+
id: w,
|
|
38
45
|
role: "alert",
|
|
39
46
|
className: t.error,
|
|
40
|
-
children:
|
|
47
|
+
children: m
|
|
41
48
|
})
|
|
42
49
|
]
|
|
43
50
|
});
|
|
44
51
|
}
|
|
45
52
|
//#endregion
|
|
46
|
-
export {
|
|
53
|
+
export { m as Field };
|
|
@@ -14,58 +14,59 @@ function u(e, t) {
|
|
|
14
14
|
function d(e) {
|
|
15
15
|
return e >= 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(1)} MB` : e >= 1024 ? `${(e / 1024).toFixed(1)} KB` : `${e} B`;
|
|
16
16
|
}
|
|
17
|
-
function f({ files: f = [], onFilesAdded: p, onRemove: m, multiple: h = !1, accept: g, maxSize: _, onRejected: v, label: y,
|
|
17
|
+
function f({ files: f = [], onFilesAdded: p, onRemove: m, multiple: h = !1, accept: g, maxSize: _, onRejected: v, label: y, ariaLabel: b, hint: x, labels: S, disabled: C = !1, className: w }) {
|
|
18
18
|
a();
|
|
19
|
-
let
|
|
19
|
+
let T = n(null), E = i(!1), D = y ?? S?.label ?? s(o.fileUploader.label), O = S?.drop ?? s(o.fileUploader.drop), k = S?.uploading ?? s(o.fileUploader.uploading), A = S?.complete ?? s(o.fileUploader.complete), j = S?.error ?? s(o.fileUploader.error), M = (e) => S?.remove ? S.remove.replace("{name}", e) : s(o.fileUploader.remove, { name: e }), N = `cascade-uploader-${D.toLowerCase().replace(/\s+/g, "-")}`, P = `${N}-label`, F = `${N}-hint`, I = (e) => {
|
|
20
20
|
if (!e || e.length === 0) return;
|
|
21
21
|
let t = h ? Array.from(e) : Array.from(e).slice(0, 1), n = [], r = [], i = [];
|
|
22
22
|
for (let e of t) g && !u(e, g) ? r.push(e) : _ !== void 0 && e.size > _ ? i.push(e) : n.push(e);
|
|
23
23
|
r.length > 0 && v?.(r, "type"), i.length > 0 && v?.(i, "size"), n.length > 0 && p?.(n);
|
|
24
24
|
};
|
|
25
25
|
return /* @__PURE__ */ l("div", {
|
|
26
|
-
className: r(t.uploader,
|
|
26
|
+
className: r(t.uploader, w),
|
|
27
27
|
children: [
|
|
28
28
|
/* @__PURE__ */ c("span", {
|
|
29
|
-
id:
|
|
29
|
+
id: P,
|
|
30
30
|
className: t.label,
|
|
31
|
-
children:
|
|
31
|
+
children: D
|
|
32
32
|
}),
|
|
33
33
|
/* @__PURE__ */ c("input", {
|
|
34
|
-
ref:
|
|
34
|
+
ref: T,
|
|
35
35
|
type: "file",
|
|
36
36
|
className: t.input,
|
|
37
37
|
tabIndex: -1,
|
|
38
38
|
"aria-hidden": "true",
|
|
39
39
|
multiple: h,
|
|
40
40
|
accept: g,
|
|
41
|
-
disabled:
|
|
41
|
+
disabled: C,
|
|
42
42
|
onChange: (e) => {
|
|
43
|
-
|
|
43
|
+
I(e.target.files), e.target.value = "";
|
|
44
44
|
}
|
|
45
45
|
}),
|
|
46
46
|
/* @__PURE__ */ c("button", {
|
|
47
47
|
type: "button",
|
|
48
48
|
className: t.zone,
|
|
49
|
-
"data-state":
|
|
50
|
-
disabled:
|
|
51
|
-
"aria-
|
|
52
|
-
|
|
49
|
+
"data-state": E.value ? "dragover" : "idle",
|
|
50
|
+
disabled: C,
|
|
51
|
+
"aria-label": b,
|
|
52
|
+
"aria-describedby": x ? `${P} ${F}` : P,
|
|
53
|
+
onClick: () => T.current?.click(),
|
|
53
54
|
onDragEnter: (e) => {
|
|
54
|
-
e.preventDefault(),
|
|
55
|
+
e.preventDefault(), C || (E.value = !0);
|
|
55
56
|
},
|
|
56
57
|
onDragOver: (e) => e.preventDefault(),
|
|
57
58
|
onDragLeave: () => {
|
|
58
|
-
|
|
59
|
+
E.value = !1;
|
|
59
60
|
},
|
|
60
61
|
onDrop: (e) => {
|
|
61
|
-
e.preventDefault(),
|
|
62
|
+
e.preventDefault(), E.value = !1, !C && I(e.dataTransfer.files);
|
|
62
63
|
},
|
|
63
|
-
children:
|
|
64
|
+
children: O
|
|
64
65
|
}),
|
|
65
|
-
|
|
66
|
-
id:
|
|
66
|
+
x && /* @__PURE__ */ c("span", {
|
|
67
|
+
id: F,
|
|
67
68
|
className: t.hint,
|
|
68
|
-
children:
|
|
69
|
+
children: x
|
|
69
70
|
}),
|
|
70
71
|
f.length > 0 && /* @__PURE__ */ c("ul", {
|
|
71
72
|
className: t.list,
|
|
@@ -79,16 +80,16 @@ function f({ files: f = [], onFilesAdded: p, onRemove: m, multiple: h = !1, acce
|
|
|
79
80
|
children: [
|
|
80
81
|
n.status === "uploading" && /* @__PURE__ */ c(e, {
|
|
81
82
|
size: "sm",
|
|
82
|
-
label:
|
|
83
|
+
label: k
|
|
83
84
|
}),
|
|
84
85
|
n.status === "complete" && /* @__PURE__ */ c("span", {
|
|
85
86
|
className: t["glyph-complete"],
|
|
86
|
-
"aria-label":
|
|
87
|
+
"aria-label": A,
|
|
87
88
|
children: "✓"
|
|
88
89
|
}),
|
|
89
90
|
n.status === "error" && /* @__PURE__ */ c("span", {
|
|
90
91
|
className: t["glyph-error"],
|
|
91
|
-
"aria-label":
|
|
92
|
+
"aria-label": j,
|
|
92
93
|
children: "✕"
|
|
93
94
|
})
|
|
94
95
|
]
|
|
@@ -104,7 +105,7 @@ function f({ files: f = [], onFilesAdded: p, onRemove: m, multiple: h = !1, acce
|
|
|
104
105
|
/* @__PURE__ */ c("button", {
|
|
105
106
|
type: "button",
|
|
106
107
|
className: t.remove,
|
|
107
|
-
"aria-label":
|
|
108
|
+
"aria-label": M(n.name),
|
|
108
109
|
onClick: () => m?.(n.id),
|
|
109
110
|
children: "✕"
|
|
110
111
|
}),
|
package/dist/filter/filter.js
CHANGED
|
@@ -4,29 +4,29 @@ import e from "./filter.module.js";
|
|
|
4
4
|
import { useControllableSignal as t, useSignals as n } from "@cascivo/core";
|
|
5
5
|
import { jsx as r } from "react/jsx-runtime";
|
|
6
6
|
//#region ../components/src/filter/filter.tsx
|
|
7
|
-
function i({ options: i, value: a, defaultValue: o = [], onValueChange: s,
|
|
7
|
+
function i({ options: i, value: a, defaultValue: o = [], onValueChange: s, multi: c = !1, multiple: l, variant: u = "pill", className: d, ariaLabel: f, label: p, ...m }) {
|
|
8
8
|
n();
|
|
9
|
-
let [
|
|
9
|
+
let h = l ?? c, [g, _] = t({
|
|
10
10
|
value: a,
|
|
11
11
|
defaultValue: o,
|
|
12
|
-
onChange: s
|
|
12
|
+
onChange: s
|
|
13
13
|
});
|
|
14
|
-
function
|
|
15
|
-
let t =
|
|
16
|
-
n =
|
|
14
|
+
function v(e) {
|
|
15
|
+
let t = g.value, n;
|
|
16
|
+
n = h ? t.includes(e) ? t.filter((t) => t !== e) : [...t, e] : t.includes(e) ? [] : [e], _(n);
|
|
17
17
|
}
|
|
18
18
|
return /* @__PURE__ */ r("div", {
|
|
19
19
|
role: "group",
|
|
20
20
|
className: [e.filter, d].filter(Boolean).join(" "),
|
|
21
21
|
"data-variant": u,
|
|
22
|
-
"aria-label":
|
|
23
|
-
...
|
|
22
|
+
"aria-label": m["aria-label"] ?? f ?? p,
|
|
23
|
+
...m,
|
|
24
24
|
children: i.map((t) => /* @__PURE__ */ r("button", {
|
|
25
25
|
type: "button",
|
|
26
26
|
className: e.item,
|
|
27
|
-
"data-selected":
|
|
28
|
-
onClick: () =>
|
|
29
|
-
"aria-pressed":
|
|
27
|
+
"data-selected": g.value.includes(t.value) || void 0,
|
|
28
|
+
onClick: () => v(t.value),
|
|
29
|
+
"aria-pressed": g.value.includes(t.value),
|
|
30
30
|
children: t.label
|
|
31
31
|
}, t.value))
|
|
32
32
|
});
|