@cascivo/react 0.13.0 → 0.14.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/dist/accordion/accordion.js +46 -44
- package/dist/action-sheet/action-sheet.js +16 -16
- package/dist/alert-dialog/alert-dialog.js +34 -34
- package/dist/app-shell/app-shell.css +1 -1
- package/dist/app-shell/app-shell.js +14 -12
- package/dist/app-shell/app-shell.module.js +8 -8
- package/dist/avatar-group/avatar-group.js +6 -6
- package/dist/bottom-sheet/bottom-sheet.js +18 -18
- package/dist/button/button.js +15 -12
- package/dist/button-group/button-group.js +8 -8
- package/dist/carousel/carousel.js +20 -20
- package/dist/checkbox/checkbox.js +21 -21
- package/dist/checkbox-card/checkbox-card.js +15 -13
- package/dist/collapsible/collapsible.js +7 -7
- package/dist/color-picker/color-picker.js +26 -26
- package/dist/combobox/combobox.js +86 -86
- package/dist/command-menu/command-menu.js +111 -111
- package/dist/comparison/comparison.js +10 -10
- package/dist/context-menu/context-menu.js +9 -9
- package/dist/copy-button/copy-button.js +18 -16
- package/dist/data-table/data-table.js +1 -1
- package/dist/date-picker/date-picker.js +25 -25
- package/dist/date-range-picker/date-range-picker.js +26 -26
- package/dist/drawer/drawer.css +1 -1
- package/dist/drawer/drawer.js +18 -17
- package/dist/drawer/drawer.module.js +9 -9
- package/dist/dropdown/dropdown.js +48 -48
- package/dist/editable/editable.js +11 -11
- package/dist/fab/fab.js +53 -53
- package/dist/field/field.js +8 -8
- package/dist/file-uploader/file-uploader.js +19 -19
- package/dist/header-panel/header-panel.js +31 -31
- package/dist/hover-card/hover-card.js +21 -21
- package/dist/icon-button/icon-button.js +5 -5
- package/dist/index.d.ts +233 -194
- package/dist/input/input.js +22 -21
- package/dist/link/link.js +8 -6
- package/dist/log-viewer/log-viewer.js +26 -26
- package/dist/menu/menu.js +20 -20
- package/dist/menu-button/menu-button.js +48 -48
- package/dist/menubar/menubar.js +42 -42
- package/dist/modal/modal.css +1 -1
- package/dist/modal/modal.js +41 -35
- package/dist/modal/modal.module.js +8 -7
- package/dist/multi-select/multi-select.css +1 -1
- package/dist/multi-select/multi-select.js +57 -57
- package/dist/multi-select/multi-select.module.js +11 -11
- package/dist/native-select/native-select.js +13 -11
- package/dist/navigation-menu/navigation-menu.js +46 -46
- package/dist/node/accordion/accordion.js +46 -44
- package/dist/node/action-sheet/action-sheet.js +16 -16
- package/dist/node/alert-dialog/alert-dialog.js +34 -34
- package/dist/node/app-shell/app-shell.js +14 -12
- package/dist/node/app-shell/app-shell.module.js +8 -8
- package/dist/node/avatar-group/avatar-group.js +6 -6
- package/dist/node/bottom-sheet/bottom-sheet.js +18 -18
- package/dist/node/button/button.js +15 -12
- package/dist/node/button-group/button-group.js +8 -8
- package/dist/node/carousel/carousel.js +20 -20
- package/dist/node/checkbox/checkbox.js +21 -21
- package/dist/node/checkbox-card/checkbox-card.js +15 -13
- package/dist/node/collapsible/collapsible.js +7 -7
- package/dist/node/color-picker/color-picker.js +26 -26
- package/dist/node/combobox/combobox.js +86 -86
- package/dist/node/command-menu/command-menu.js +111 -111
- package/dist/node/comparison/comparison.js +10 -10
- package/dist/node/context-menu/context-menu.js +9 -9
- package/dist/node/copy-button/copy-button.js +18 -16
- package/dist/node/data-table/data-table.js +1 -1
- package/dist/node/date-picker/date-picker.js +25 -25
- package/dist/node/date-range-picker/date-range-picker.js +26 -26
- package/dist/node/drawer/drawer.js +18 -17
- package/dist/node/drawer/drawer.module.js +9 -9
- package/dist/node/dropdown/dropdown.js +48 -48
- package/dist/node/editable/editable.js +11 -11
- package/dist/node/fab/fab.js +53 -53
- package/dist/node/field/field.js +8 -8
- package/dist/node/file-uploader/file-uploader.js +19 -19
- package/dist/node/header-panel/header-panel.js +31 -31
- package/dist/node/hover-card/hover-card.js +21 -21
- package/dist/node/icon-button/icon-button.js +5 -5
- package/dist/node/input/input.js +22 -21
- package/dist/node/link/link.js +8 -6
- package/dist/node/log-viewer/log-viewer.js +26 -26
- package/dist/node/menu/menu.js +20 -20
- package/dist/node/menu-button/menu-button.js +48 -48
- package/dist/node/menubar/menubar.js +42 -42
- package/dist/node/modal/modal.js +41 -35
- package/dist/node/modal/modal.module.js +8 -7
- package/dist/node/multi-select/multi-select.js +57 -57
- package/dist/node/multi-select/multi-select.module.js +11 -11
- package/dist/node/native-select/native-select.js +13 -11
- package/dist/node/navigation-menu/navigation-menu.js +46 -46
- package/dist/node/notification/notification.js +26 -26
- package/dist/node/number-input/number-input.js +52 -50
- package/dist/node/otp-input/otp-input.js +8 -8
- package/dist/node/password-input/password-input.js +28 -27
- package/dist/node/popover/popover.js +26 -24
- package/dist/node/pull-to-refresh/pull-to-refresh.js +13 -13
- package/dist/node/radial-progress/radial-progress.js +5 -5
- package/dist/node/radio/radio.js +23 -22
- package/dist/node/radio-card/radio-card.js +27 -26
- package/dist/node/react/src/index.js +3 -3
- package/dist/node/react/src/theme.js +30 -19
- package/dist/node/resizable/resizable.js +11 -11
- package/dist/node/scroll-area/scroll-area.js +4 -4
- package/dist/node/search/search.js +49 -49
- package/dist/node/select/select.js +27 -26
- package/dist/node/sheet/sheet.js +11 -10
- package/dist/node/sheet/sheet.module.js +5 -5
- package/dist/node/shell-header/shell-header.js +21 -18
- package/dist/node/shell-header/shell-header.module.js +20 -19
- package/dist/node/side-nav/side-nav.js +91 -91
- package/dist/node/skip-nav/skip-nav.js +12 -12
- package/dist/node/slider/slider.js +13 -11
- package/dist/node/structured-list/structured-list.js +23 -23
- package/dist/node/tabs/tabs.js +49 -47
- package/dist/node/tags-input/tags-input.js +35 -35
- package/dist/node/textarea/textarea.js +22 -21
- package/dist/node/time-picker/time-picker.js +22 -21
- package/dist/node/timeline/timeline.js +23 -16
- package/dist/node/timeline/timeline.module.js +7 -7
- package/dist/node/toast/toast.js +15 -15
- package/dist/node/toc/toc.js +8 -8
- package/dist/node/toggle/toggle.js +15 -13
- package/dist/node/toggle-group/toggle-group.js +10 -10
- package/dist/node/toggletip/toggletip.js +9 -9
- package/dist/node/tooltip/tooltip.js +5 -5
- package/dist/node/tree-view/tree-view.js +32 -32
- package/dist/notification/notification.js +26 -26
- package/dist/number-input/number-input.js +52 -50
- package/dist/otp-input/otp-input.js +8 -8
- package/dist/password-input/password-input.js +28 -27
- package/dist/popover/popover.js +26 -24
- package/dist/pull-to-refresh/pull-to-refresh.js +13 -13
- package/dist/radial-progress/radial-progress.js +5 -5
- package/dist/radio/radio.js +23 -22
- package/dist/radio-card/radio-card.js +27 -26
- package/dist/react/src/index.js +3 -3
- package/dist/react/src/theme.js +30 -19
- package/dist/resizable/resizable.js +11 -11
- package/dist/scroll-area/scroll-area.js +4 -4
- package/dist/search/search.js +49 -49
- package/dist/select/select.js +27 -26
- package/dist/sheet/sheet.css +1 -1
- package/dist/sheet/sheet.js +11 -10
- package/dist/sheet/sheet.module.js +5 -5
- package/dist/shell-header/shell-header.css +1 -1
- package/dist/shell-header/shell-header.js +21 -18
- package/dist/shell-header/shell-header.module.js +20 -19
- package/dist/side-nav/side-nav.js +91 -91
- package/dist/skip-nav/skip-nav.js +12 -12
- package/dist/slider/slider.js +13 -11
- package/dist/structured-list/structured-list.js +23 -23
- package/dist/styles.css +57 -7
- package/dist/tabs/tabs.js +49 -47
- package/dist/tags-input/tags-input.js +35 -35
- package/dist/textarea/textarea.js +22 -21
- package/dist/time-picker/time-picker.js +22 -21
- package/dist/timeline/timeline.css +1 -1
- package/dist/timeline/timeline.js +23 -16
- package/dist/timeline/timeline.module.js +7 -7
- package/dist/toast/toast.js +15 -15
- package/dist/toc/toc.js +8 -8
- package/dist/toggle/toggle.js +15 -13
- package/dist/toggle-group/toggle-group.js +10 -10
- package/dist/toggletip/toggletip.js +9 -9
- package/dist/tooltip/tooltip.js +5 -5
- package/dist/tree-view/tree-view.js +32 -32
- package/package.json +10 -4
|
@@ -2,99 +2,101 @@
|
|
|
2
2
|
|
|
3
3
|
import e from "./number-input.module.js";
|
|
4
4
|
import { cn as t, createMachine as n, useMachine as r, useSignal as i, useSignals as a } from "@cascivo/core";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { forwardRef as o } from "react";
|
|
6
|
+
import { builtin as s, t as c } from "@cascivo/i18n";
|
|
7
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
8
|
//#region ../components/src/number-input/number-input.tsx
|
|
8
|
-
var
|
|
9
|
+
var d = n({
|
|
9
10
|
initial: "idle",
|
|
10
11
|
states: {
|
|
11
12
|
idle: { on: { FOCUS: "focused" } },
|
|
12
13
|
focused: { on: { BLUR: "idle" } }
|
|
13
14
|
}
|
|
14
15
|
});
|
|
15
|
-
function
|
|
16
|
+
function f(e, t, n) {
|
|
16
17
|
let r = e;
|
|
17
18
|
return t !== void 0 && (r = Math.max(r, t)), n !== void 0 && (r = Math.min(r, n)), r;
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function p(e) {
|
|
20
21
|
let t = String(e), n = t.indexOf(".");
|
|
21
22
|
return n === -1 ? 0 : t.length - n - 1;
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
+
function m(e, t) {
|
|
24
25
|
let n = 10 ** t;
|
|
25
26
|
return Math.round(e * n) / n;
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function h(e) {
|
|
28
29
|
let t = e.trim();
|
|
29
30
|
if (t === "") return null;
|
|
30
31
|
let n = Number(t);
|
|
31
32
|
return Number.isFinite(n) ? n : null;
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
var g = o(function({ value: n, defaultValue: o, onValueChange: g, onChange: _, min: v, max: y, step: b = 1, precision: x, formatOptions: S, label: C, hint: w, error: T, size: E = "md", disabled: D, incrementLabel: O, decrementLabel: k, className: A, id: j, onFocus: M, onBlur: N, onKeyDown: P, ...F }, I) {
|
|
34
35
|
a();
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
let e =
|
|
39
|
-
e != null && (e =
|
|
40
|
-
},
|
|
41
|
-
let t = (
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
return /* @__PURE__ */
|
|
36
|
+
let L = O ?? c(s.numberInput.increment), R = k ?? c(s.numberInput.decrement), [z, B] = r(d), V = n !== void 0, H = i(o ?? null), U = i(""), W = V ? n : H.value, G = j ?? (C ? `cascade-number-input-${C.toLowerCase().replace(/\s+/g, "-")}` : void 0), K = (e) => {
|
|
37
|
+
V || (H.value = e), U.value = e == null ? "" : String(e), e !== W && (g ?? _)?.(e);
|
|
38
|
+
}, q = () => {
|
|
39
|
+
let e = h(U.value);
|
|
40
|
+
e != null && (e = f(e, v, y), x !== void 0 && (e = m(e, x))), K(e);
|
|
41
|
+
}, J = (e) => {
|
|
42
|
+
let t = (z.value === "focused" ? h(U.value) : W) ?? 0, n = x ?? Math.max(p(b), p(t));
|
|
43
|
+
K(f(m(t + e * b, n), v, y));
|
|
44
|
+
}, Y = z.value === "focused" ? U.value : ((e) => e == null ? "" : S ? new Intl.NumberFormat(void 0, S).format(e) : String(e))(W), X = W != null && y !== void 0 && W >= y, Z = W != null && v !== void 0 && W <= v;
|
|
45
|
+
return /* @__PURE__ */ u("div", {
|
|
45
46
|
className: t(e.wrapper, A),
|
|
46
|
-
"data-state": T ? "error" :
|
|
47
|
+
"data-state": T ? "error" : z.value,
|
|
47
48
|
"data-size": E,
|
|
48
49
|
children: [
|
|
49
|
-
C && /* @__PURE__ */
|
|
50
|
+
C && /* @__PURE__ */ l("label", {
|
|
50
51
|
className: e.label,
|
|
51
|
-
htmlFor:
|
|
52
|
+
htmlFor: G,
|
|
52
53
|
children: C
|
|
53
54
|
}),
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ u("div", {
|
|
55
56
|
className: e.field,
|
|
56
|
-
children: [/* @__PURE__ */
|
|
57
|
-
id:
|
|
57
|
+
children: [/* @__PURE__ */ l("input", {
|
|
58
|
+
id: G,
|
|
58
59
|
type: "text",
|
|
59
60
|
inputMode: "decimal",
|
|
60
61
|
autoComplete: "off",
|
|
61
62
|
role: "spinbutton",
|
|
62
63
|
className: e.input,
|
|
63
|
-
value:
|
|
64
|
+
value: Y,
|
|
64
65
|
disabled: D,
|
|
65
|
-
"aria-valuenow":
|
|
66
|
+
"aria-valuenow": W ?? void 0,
|
|
66
67
|
"aria-valuemin": v,
|
|
67
68
|
"aria-valuemax": y,
|
|
68
69
|
"aria-invalid": T ? !0 : void 0,
|
|
69
|
-
"aria-describedby": T ? `${
|
|
70
|
+
"aria-describedby": T ? `${G}-error` : w ? `${G}-hint` : void 0,
|
|
70
71
|
onChange: (e) => {
|
|
71
|
-
|
|
72
|
+
U.value = e.target.value;
|
|
72
73
|
},
|
|
73
74
|
onFocus: (e) => {
|
|
74
|
-
|
|
75
|
+
U.value = W == null ? "" : String(W), B("FOCUS"), M?.(e);
|
|
75
76
|
},
|
|
76
77
|
onBlur: (e) => {
|
|
77
|
-
|
|
78
|
+
q(), B("BLUR"), N?.(e);
|
|
78
79
|
},
|
|
79
80
|
onKeyDown: (e) => {
|
|
80
|
-
e.key === "ArrowUp" ? (e.preventDefault(),
|
|
81
|
+
e.key === "ArrowUp" ? (e.preventDefault(), J(1)) : e.key === "ArrowDown" ? (e.preventDefault(), J(-1)) : e.key === "Enter" && q(), P?.(e);
|
|
81
82
|
},
|
|
83
|
+
ref: I,
|
|
82
84
|
...F
|
|
83
|
-
}), /* @__PURE__ */
|
|
85
|
+
}), /* @__PURE__ */ u("div", {
|
|
84
86
|
className: e.steppers,
|
|
85
|
-
children: [/* @__PURE__ */
|
|
87
|
+
children: [/* @__PURE__ */ l("button", {
|
|
86
88
|
type: "button",
|
|
87
89
|
className: e.stepper,
|
|
88
|
-
"aria-label":
|
|
90
|
+
"aria-label": L,
|
|
89
91
|
tabIndex: -1,
|
|
90
|
-
disabled: D ||
|
|
92
|
+
disabled: D || X,
|
|
91
93
|
onMouseDown: (e) => e.preventDefault(),
|
|
92
|
-
onClick: () =>
|
|
93
|
-
children: /* @__PURE__ */
|
|
94
|
+
onClick: () => J(1),
|
|
95
|
+
children: /* @__PURE__ */ l("svg", {
|
|
94
96
|
viewBox: "0 0 10 10",
|
|
95
97
|
"aria-hidden": "true",
|
|
96
98
|
focusable: "false",
|
|
97
|
-
children: /* @__PURE__ */
|
|
99
|
+
children: /* @__PURE__ */ l("path", {
|
|
98
100
|
d: "M2 6.5 5 3.5 8 6.5",
|
|
99
101
|
fill: "none",
|
|
100
102
|
stroke: "currentColor",
|
|
@@ -103,19 +105,19 @@ function h({ value: n, defaultValue: h, onValueChange: g, onChange: _, min: v, m
|
|
|
103
105
|
strokeLinejoin: "round"
|
|
104
106
|
})
|
|
105
107
|
})
|
|
106
|
-
}), /* @__PURE__ */
|
|
108
|
+
}), /* @__PURE__ */ l("button", {
|
|
107
109
|
type: "button",
|
|
108
110
|
className: e.stepper,
|
|
109
|
-
"aria-label":
|
|
111
|
+
"aria-label": R,
|
|
110
112
|
tabIndex: -1,
|
|
111
|
-
disabled: D ||
|
|
113
|
+
disabled: D || Z,
|
|
112
114
|
onMouseDown: (e) => e.preventDefault(),
|
|
113
|
-
onClick: () =>
|
|
114
|
-
children: /* @__PURE__ */
|
|
115
|
+
onClick: () => J(-1),
|
|
116
|
+
children: /* @__PURE__ */ l("svg", {
|
|
115
117
|
viewBox: "0 0 10 10",
|
|
116
118
|
"aria-hidden": "true",
|
|
117
119
|
focusable: "false",
|
|
118
|
-
children: /* @__PURE__ */
|
|
120
|
+
children: /* @__PURE__ */ l("path", {
|
|
119
121
|
d: "M2 3.5 5 6.5 8 3.5",
|
|
120
122
|
fill: "none",
|
|
121
123
|
stroke: "currentColor",
|
|
@@ -127,19 +129,19 @@ function h({ value: n, defaultValue: h, onValueChange: g, onChange: _, min: v, m
|
|
|
127
129
|
})]
|
|
128
130
|
})]
|
|
129
131
|
}),
|
|
130
|
-
T && /* @__PURE__ */
|
|
131
|
-
id: `${
|
|
132
|
+
T && /* @__PURE__ */ l("span", {
|
|
133
|
+
id: `${G}-error`,
|
|
132
134
|
className: e.error,
|
|
133
135
|
role: "alert",
|
|
134
136
|
children: T
|
|
135
137
|
}),
|
|
136
|
-
!T && w && /* @__PURE__ */
|
|
137
|
-
id: `${
|
|
138
|
+
!T && w && /* @__PURE__ */ l("span", {
|
|
139
|
+
id: `${G}-hint`,
|
|
138
140
|
className: e.hint,
|
|
139
141
|
children: w
|
|
140
142
|
})
|
|
141
143
|
]
|
|
142
144
|
});
|
|
143
|
-
}
|
|
145
|
+
});
|
|
144
146
|
//#endregion
|
|
145
|
-
export {
|
|
147
|
+
export { g as NumberInput };
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import e from "./otp-input.module.js";
|
|
4
4
|
import { cn as t, useSignal as n, useSignals as r } from "@cascivo/core";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useRef as i } from "react";
|
|
6
|
+
import { builtin as a, t as o } from "@cascivo/i18n";
|
|
7
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
8
8
|
//#region ../components/src/otp-input/otp-input.tsx
|
|
9
9
|
function c({ length: c = 6, value: l, onValueChange: u, disabled: d = !1, type: f = "numeric", className: p, ...m }) {
|
|
10
10
|
r();
|
|
11
|
-
let h = n(Array.from({ length: c }, (e, t) => l[t] ?? "")), g =
|
|
11
|
+
let h = n(Array.from({ length: c }, (e, t) => l[t] ?? "")), g = i([]), _ = Array.from({ length: c }, (e, t) => l[t] ?? "");
|
|
12
12
|
JSON.stringify(h.value) !== JSON.stringify(_) && (h.value = _);
|
|
13
13
|
function v(e) {
|
|
14
14
|
u(e.join("")), h.value = e;
|
|
@@ -37,13 +37,13 @@ function c({ length: c = 6, value: l, onValueChange: u, disabled: d = !1, type:
|
|
|
37
37
|
for (let t = 0; t < n.length; t++) e + t < c && (r[e + t] = n[t] ?? "");
|
|
38
38
|
v(r), y(Math.min(e + n.length, c - 1));
|
|
39
39
|
}
|
|
40
|
-
let C = a
|
|
41
|
-
return /* @__PURE__ */
|
|
40
|
+
let C = o(a.otpInput.label);
|
|
41
|
+
return /* @__PURE__ */ s("div", {
|
|
42
42
|
className: t(e.wrapper, p),
|
|
43
43
|
role: "group",
|
|
44
44
|
"aria-label": C,
|
|
45
45
|
...m,
|
|
46
|
-
children: h.value.map((t, n) => /* @__PURE__ */
|
|
46
|
+
children: h.value.map((t, n) => /* @__PURE__ */ s("input", {
|
|
47
47
|
ref: (e) => {
|
|
48
48
|
g.current[n] = e;
|
|
49
49
|
},
|
|
@@ -52,7 +52,7 @@ function c({ length: c = 6, value: l, onValueChange: u, disabled: d = !1, type:
|
|
|
52
52
|
className: e.slot,
|
|
53
53
|
value: t,
|
|
54
54
|
maxLength: 1,
|
|
55
|
-
"aria-label": a
|
|
55
|
+
"aria-label": o(a.otpInput.digit, { n: String(n + 1) }),
|
|
56
56
|
autoComplete: n === 0 ? "one-time-code" : "off",
|
|
57
57
|
disabled: d,
|
|
58
58
|
"data-filled": t ? "" : void 0,
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import e from "./password-input.module.js";
|
|
4
4
|
import { cn as t, useSignal as n, useSignals as r } from "@cascivo/core";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { forwardRef as i, useId as a } from "react";
|
|
6
|
+
import { builtin as o, t as s } from "@cascivo/i18n";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
8
|
//#region ../components/src/password-input/password-input.tsx
|
|
9
|
-
function
|
|
9
|
+
function u(e) {
|
|
10
10
|
if (!e) return {
|
|
11
11
|
score: 0,
|
|
12
12
|
label: "weak"
|
|
@@ -23,58 +23,59 @@ function l(e) {
|
|
|
23
23
|
][t]
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
var d = i(function({ showStrengthMeter: i = !1, size: d = "md", labels: f, className: p, id: m, value: h, defaultValue: g, onChange: _, ...v }, y) {
|
|
27
27
|
r();
|
|
28
|
-
let
|
|
29
|
-
typeof h == "string" && (
|
|
30
|
-
let
|
|
31
|
-
return /* @__PURE__ */
|
|
28
|
+
let b = n(!1), x = n(typeof h == "string" ? h : typeof g == "string" ? g : "");
|
|
29
|
+
typeof h == "string" && (x.value = h);
|
|
30
|
+
let S = a(), C = m ?? `cascade-password-${S}`, w = i ? u(x.value) : null, T = b.value ? f?.hide ?? s(o.passwordInput.hide) : f?.reveal ?? s(o.passwordInput.reveal), E = w ? f?.strengthLabel ? f.strengthLabel(w.label) : s(o.passwordInput.strengthLabel, { level: w.label }) : void 0;
|
|
31
|
+
return /* @__PURE__ */ l("div", {
|
|
32
32
|
className: t(e.wrapper, p),
|
|
33
33
|
"data-size": d,
|
|
34
|
-
"data-revealed":
|
|
35
|
-
children: [/* @__PURE__ */
|
|
34
|
+
"data-revealed": b.value ? "" : void 0,
|
|
35
|
+
children: [/* @__PURE__ */ l("div", {
|
|
36
36
|
className: e["input-row"],
|
|
37
|
-
children: [/* @__PURE__ */
|
|
37
|
+
children: [/* @__PURE__ */ c("input", {
|
|
38
|
+
ref: y,
|
|
38
39
|
...v,
|
|
39
|
-
id:
|
|
40
|
-
type:
|
|
40
|
+
id: C,
|
|
41
|
+
type: b.value ? "text" : "password",
|
|
41
42
|
className: e.input,
|
|
42
43
|
value: h,
|
|
43
44
|
defaultValue: g,
|
|
44
45
|
onChange: (e) => {
|
|
45
|
-
typeof h != "string" && (
|
|
46
|
+
typeof h != "string" && (x.value = e.currentTarget.value), _?.(e);
|
|
46
47
|
}
|
|
47
|
-
}), /* @__PURE__ */
|
|
48
|
+
}), /* @__PURE__ */ c("button", {
|
|
48
49
|
type: "button",
|
|
49
50
|
className: e["reveal-btn"],
|
|
50
|
-
"aria-label":
|
|
51
|
+
"aria-label": T,
|
|
51
52
|
onClick: () => {
|
|
52
|
-
|
|
53
|
+
b.value = !b.value;
|
|
53
54
|
},
|
|
54
|
-
children: /* @__PURE__ */
|
|
55
|
+
children: /* @__PURE__ */ c("span", {
|
|
55
56
|
className: e["reveal-icon"],
|
|
56
57
|
"aria-hidden": "true"
|
|
57
58
|
})
|
|
58
59
|
})]
|
|
59
|
-
}),
|
|
60
|
+
}), i && w && /* @__PURE__ */ c("div", {
|
|
60
61
|
className: e["strength-meter"],
|
|
61
62
|
role: "meter",
|
|
62
|
-
"aria-label":
|
|
63
|
-
"aria-valuenow":
|
|
63
|
+
"aria-label": E,
|
|
64
|
+
"aria-valuenow": w.score,
|
|
64
65
|
"aria-valuemin": 0,
|
|
65
66
|
"aria-valuemax": 4,
|
|
66
|
-
"data-strength":
|
|
67
|
+
"data-strength": w.label,
|
|
67
68
|
children: [
|
|
68
69
|
0,
|
|
69
70
|
1,
|
|
70
71
|
2,
|
|
71
72
|
3
|
|
72
|
-
].map((t) => /* @__PURE__ */
|
|
73
|
+
].map((t) => /* @__PURE__ */ c("div", {
|
|
73
74
|
className: e["strength-segment"],
|
|
74
|
-
"data-filled": t <
|
|
75
|
+
"data-filled": t < w.score ? "" : void 0
|
|
75
76
|
}, t))
|
|
76
77
|
})]
|
|
77
78
|
});
|
|
78
|
-
}
|
|
79
|
+
});
|
|
79
80
|
//#endregion
|
|
80
|
-
export {
|
|
81
|
+
export { d as PasswordInput };
|
package/dist/popover/popover.js
CHANGED
|
@@ -2,48 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
import { usePopover as e } from "./use-popover.js";
|
|
4
4
|
import t from "./popover.module.js";
|
|
5
|
-
import {
|
|
6
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
import { Slot as n, useSignals as r } from "@cascivo/core";
|
|
7
6
|
import { createContext as i } from "react";
|
|
7
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
8
8
|
//#region ../components/src/popover/popover.tsx
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
value:
|
|
9
|
+
var o = i(null);
|
|
10
|
+
function s({ children: t, ...n }) {
|
|
11
|
+
let r = e(n);
|
|
12
|
+
return /* @__PURE__ */ a(o.Provider, {
|
|
13
|
+
value: r,
|
|
14
14
|
children: t
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
17
|
+
function c({ children: e, asChild: i = !1 }) {
|
|
18
|
+
r();
|
|
19
|
+
let s = i ? n : "button";
|
|
20
|
+
return /* @__PURE__ */ a(o.Consumer, { children: (n) => {
|
|
19
21
|
if (!n) throw Error("PopoverTrigger must be used inside <Popover>");
|
|
20
|
-
let { triggerRef:
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
ref:
|
|
23
|
-
type: "button",
|
|
24
|
-
"aria-expanded":
|
|
22
|
+
let { triggerRef: r, toggle: o, anchorName: c, isOpen: l } = n;
|
|
23
|
+
return /* @__PURE__ */ a(s, {
|
|
24
|
+
ref: r,
|
|
25
|
+
type: i ? void 0 : "button",
|
|
26
|
+
"aria-expanded": l.value,
|
|
25
27
|
"aria-haspopup": "dialog",
|
|
26
|
-
style: { anchorName:
|
|
27
|
-
onClick:
|
|
28
|
+
style: { anchorName: c },
|
|
29
|
+
onClick: o,
|
|
28
30
|
className: t.trigger,
|
|
29
31
|
children: e
|
|
30
32
|
});
|
|
31
33
|
} });
|
|
32
34
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
35
|
-
if (!
|
|
36
|
-
let { popoverRef:
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
ref:
|
|
35
|
+
function l({ children: e, className: n }) {
|
|
36
|
+
return r(), /* @__PURE__ */ a(o.Consumer, { children: (r) => {
|
|
37
|
+
if (!r) throw Error("PopoverContent must be used inside <Popover>");
|
|
38
|
+
let { popoverRef: i, anchorName: o, isOpen: s } = r;
|
|
39
|
+
return /* @__PURE__ */ a("div", {
|
|
40
|
+
ref: i,
|
|
39
41
|
popover: "auto",
|
|
40
42
|
role: "dialog",
|
|
41
43
|
"data-state": s.value ? "open" : "closed",
|
|
42
44
|
style: { positionAnchor: o },
|
|
43
|
-
className: [t.content,
|
|
45
|
+
className: [t.content, n].filter(Boolean).join(" "),
|
|
44
46
|
children: e
|
|
45
47
|
});
|
|
46
48
|
} });
|
|
47
49
|
}
|
|
48
50
|
//#endregion
|
|
49
|
-
export {
|
|
51
|
+
export { s as Popover, l as PopoverContent, c as PopoverTrigger };
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
import { Spinner as e } from "../spinner/spinner.js";
|
|
4
4
|
import t from "./pull-to-refresh.module.js";
|
|
5
5
|
import { cn as n, useSignal as r, useSignalEffect as i, useSignals as a } from "@cascivo/core";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { useRef as o } from "react";
|
|
7
|
+
import { builtin as s, t as c } from "@cascivo/i18n";
|
|
8
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
9
9
|
//#region ../components/src/pull-to-refresh/pull-to-refresh.tsx
|
|
10
10
|
var d = .5;
|
|
11
11
|
function f({ onRefresh: f, children: p, threshold: m = 64, disabled: h = !1, labels: g, className: _ }) {
|
|
12
12
|
a();
|
|
13
|
-
let v =
|
|
13
|
+
let v = o(null), y = r(0), b = r(!1), x = r(!1), S = o(f);
|
|
14
14
|
S.current = f;
|
|
15
|
-
let C =
|
|
15
|
+
let C = o(m);
|
|
16
16
|
C.current = m;
|
|
17
|
-
let w =
|
|
17
|
+
let w = o(h);
|
|
18
18
|
w.current = h, i(() => {
|
|
19
19
|
let e = v.current;
|
|
20
20
|
if (!e || typeof window > "u") return;
|
|
@@ -39,21 +39,21 @@ function f({ onRefresh: f, children: p, threshold: m = 64, disabled: h = !1, lab
|
|
|
39
39
|
e.removeEventListener("pointerdown", r), window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a), window.removeEventListener("pointercancel", a);
|
|
40
40
|
};
|
|
41
41
|
});
|
|
42
|
-
let T = b.value ? m : y.value, E = Math.min(T / m, 1), D = E >= 1, O = b.value ? g?.refreshing ?? s
|
|
43
|
-
return /* @__PURE__ */
|
|
42
|
+
let T = b.value ? m : y.value, E = Math.min(T / m, 1), D = E >= 1, O = b.value ? g?.refreshing ?? c(s.pullToRefresh.refreshing) : D ? g?.release ?? c(s.pullToRefresh.release) : T > 0 ? g?.pull ?? c(s.pullToRefresh.pull) : "", k = { "--_pull": `${T}px` };
|
|
43
|
+
return /* @__PURE__ */ u("div", {
|
|
44
44
|
className: n(t.root, _),
|
|
45
45
|
style: k,
|
|
46
46
|
children: [
|
|
47
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ l("div", {
|
|
48
48
|
className: t.indicator,
|
|
49
49
|
"data-dragging": x.value ? "" : void 0,
|
|
50
|
-
children: b.value ? /* @__PURE__ */
|
|
50
|
+
children: b.value ? /* @__PURE__ */ l(e, { size: "sm" }) : /* @__PURE__ */ l("svg", {
|
|
51
51
|
"aria-hidden": "true",
|
|
52
52
|
viewBox: "0 0 16 16",
|
|
53
53
|
className: t.arrow,
|
|
54
54
|
"data-ready": D ? "" : void 0,
|
|
55
55
|
style: { opacity: E },
|
|
56
|
-
children: /* @__PURE__ */
|
|
56
|
+
children: /* @__PURE__ */ l("path", {
|
|
57
57
|
d: "M8 13V3M4 7l4-4 4 4",
|
|
58
58
|
fill: "none",
|
|
59
59
|
stroke: "currentColor",
|
|
@@ -63,13 +63,13 @@ function f({ onRefresh: f, children: p, threshold: m = 64, disabled: h = !1, lab
|
|
|
63
63
|
})
|
|
64
64
|
})
|
|
65
65
|
}),
|
|
66
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ l("span", {
|
|
67
67
|
role: "status",
|
|
68
68
|
"aria-live": "polite",
|
|
69
69
|
className: t.srOnly,
|
|
70
70
|
children: O
|
|
71
71
|
}),
|
|
72
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ l("div", {
|
|
73
73
|
ref: v,
|
|
74
74
|
className: t.viewport,
|
|
75
75
|
"data-dragging": x.value ? "" : void 0,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import e from "./radial-progress.module.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useId as t } from "react";
|
|
5
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
6
|
//#region ../components/src/radial-progress/radial-progress.tsx
|
|
7
7
|
function r({ value: r, size: i = "md", variant: a = "primary", children: o, className: s, ...c }) {
|
|
8
|
-
let l = Math.min(100, Math.max(0, r)), u =
|
|
9
|
-
return /* @__PURE__ */
|
|
8
|
+
let l = Math.min(100, Math.max(0, r)), u = t();
|
|
9
|
+
return /* @__PURE__ */ n("div", {
|
|
10
10
|
role: "progressbar",
|
|
11
11
|
"aria-valuenow": l,
|
|
12
12
|
"aria-valuemin": 0,
|
|
@@ -17,7 +17,7 @@ function r({ value: r, size: i = "md", variant: a = "primary", children: o, clas
|
|
|
17
17
|
"data-variant": a,
|
|
18
18
|
style: { "--cascivo-radial-progress": l },
|
|
19
19
|
...c,
|
|
20
|
-
children: /* @__PURE__ */
|
|
20
|
+
children: /* @__PURE__ */ n("span", {
|
|
21
21
|
id: u,
|
|
22
22
|
className: e.label,
|
|
23
23
|
children: o ?? `${l}%`
|
package/dist/radio/radio.js
CHANGED
|
@@ -2,48 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
import e from "./radio.module.js";
|
|
4
4
|
import { cn as t } from "@cascivo/core";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Children as n, cloneElement as r, forwardRef as i, isValidElement as a } from "react";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
7
|
//#region ../components/src/radio/radio.tsx
|
|
8
|
-
|
|
9
|
-
let
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
className: t(e.wrapper,
|
|
12
|
-
"data-disabled":
|
|
8
|
+
var c = i(function({ label: n, className: r, id: i, disabled: a, value: c, ...l }, u) {
|
|
9
|
+
let d = i ?? (n ? `cascade-radio-${c}` : void 0);
|
|
10
|
+
return /* @__PURE__ */ s("label", {
|
|
11
|
+
className: t(e.wrapper, r),
|
|
12
|
+
"data-disabled": a || void 0,
|
|
13
13
|
children: [
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
id:
|
|
14
|
+
/* @__PURE__ */ o("input", {
|
|
15
|
+
id: d,
|
|
16
16
|
type: "radio",
|
|
17
17
|
value: c,
|
|
18
18
|
className: e.input,
|
|
19
|
-
disabled:
|
|
19
|
+
disabled: a,
|
|
20
|
+
ref: u,
|
|
20
21
|
...l
|
|
21
22
|
}),
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
+
/* @__PURE__ */ o("span", {
|
|
23
24
|
className: e.control,
|
|
24
25
|
"aria-hidden": "true"
|
|
25
26
|
}),
|
|
26
|
-
|
|
27
|
+
n && /* @__PURE__ */ o("span", {
|
|
27
28
|
className: e.label,
|
|
28
|
-
children:
|
|
29
|
+
children: n
|
|
29
30
|
})
|
|
30
31
|
]
|
|
31
32
|
});
|
|
32
|
-
}
|
|
33
|
-
function
|
|
33
|
+
});
|
|
34
|
+
function l({ name: i, value: s, defaultValue: c, onChange: l, orientation: u = "vertical", className: d, children: f }) {
|
|
34
35
|
let p = s !== void 0;
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ o("div", {
|
|
36
37
|
role: "radiogroup",
|
|
37
38
|
"data-orientation": u,
|
|
38
39
|
className: t(e.group, d),
|
|
39
|
-
children:
|
|
40
|
-
if (!
|
|
41
|
-
let t = e, n = t.props.value,
|
|
42
|
-
return p ?
|
|
40
|
+
children: n.map(f, (e) => {
|
|
41
|
+
if (!a(e)) return e;
|
|
42
|
+
let t = e, n = t.props.value, o = { name: i };
|
|
43
|
+
return p ? o.checked = n === s : c !== void 0 && (o.defaultChecked = n === c), l && (o.onChange = (e) => {
|
|
43
44
|
e.target.checked && l(n);
|
|
44
|
-
}),
|
|
45
|
+
}), r(t, o);
|
|
45
46
|
})
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
//#endregion
|
|
49
|
-
export {
|
|
50
|
+
export { c as Radio, l as RadioGroup };
|