@cascivo/react 0.17.1 → 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
|
@@ -141,31 +141,31 @@ function b({ item: e }) {
|
|
|
141
141
|
}, t))]
|
|
142
142
|
})] });
|
|
143
143
|
}
|
|
144
|
-
function x({ items: t, groups: r, collapsed: o, defaultCollapsed: _ = !1, onCollapsedChange: x, ariaLabel: S,
|
|
144
|
+
function x({ items: t, groups: r, collapsed: o, defaultCollapsed: _ = !1, onCollapsedChange: x, ariaLabel: S, label: C, collapseLabel: w, expandLabel: T, expandOnHover: E = !1, showCollapseToggle: D = !0, header: O, footer: k, className: A }) {
|
|
145
145
|
u();
|
|
146
|
-
let
|
|
146
|
+
let j = S ?? C ?? f(d.sideNav.nav), M = w ?? f(d.sideNav.collapse), N = T ?? f(d.sideNav.expand), P = i(), [F] = c({
|
|
147
147
|
value: o,
|
|
148
148
|
defaultValue: _
|
|
149
|
-
}),
|
|
150
|
-
let t =
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
let e = !
|
|
154
|
-
o === void 0 && (
|
|
155
|
-
},
|
|
149
|
+
}), I = r ?? (t ? [{ items: t }] : [{ items: [] }]), L = l(I.flatMap((e) => e.items).filter((e) => e.items?.some((e) => g(e) && e.active)).map((e) => e.label)), R = (e) => {
|
|
150
|
+
let t = L.value;
|
|
151
|
+
L.value = t.includes(e) ? t.filter((t) => t !== e) : [...t, e];
|
|
152
|
+
}, z = () => {
|
|
153
|
+
let e = !F.value;
|
|
154
|
+
o === void 0 && (F.value = e), x?.(e);
|
|
155
|
+
}, B = F.value;
|
|
156
156
|
return /* @__PURE__ */ h("nav", {
|
|
157
|
-
"aria-label":
|
|
158
|
-
"data-state":
|
|
159
|
-
"data-expand-on-hover":
|
|
160
|
-
className: a(n.sideNav,
|
|
157
|
+
"aria-label": j,
|
|
158
|
+
"data-state": B ? "collapsed" : "expanded",
|
|
159
|
+
"data-expand-on-hover": B && E ? "" : void 0,
|
|
160
|
+
className: a(n.sideNav, A),
|
|
161
161
|
children: [
|
|
162
|
-
|
|
162
|
+
O && /* @__PURE__ */ m("div", {
|
|
163
163
|
className: n.header,
|
|
164
|
-
children:
|
|
164
|
+
children: O
|
|
165
165
|
}),
|
|
166
166
|
/* @__PURE__ */ m("ul", {
|
|
167
167
|
className: n.list,
|
|
168
|
-
children:
|
|
168
|
+
children: I.map((t, r) => /* @__PURE__ */ h("li", {
|
|
169
169
|
className: n.group,
|
|
170
170
|
children: [t.label && /* @__PURE__ */ m("h3", {
|
|
171
171
|
className: n.groupLabel,
|
|
@@ -175,22 +175,22 @@ function x({ items: t, groups: r, collapsed: o, defaultCollapsed: _ = !1, onColl
|
|
|
175
175
|
children: t.items.map((t, i) => {
|
|
176
176
|
let a = `${r}-${i}`;
|
|
177
177
|
if (t.items) {
|
|
178
|
-
if (
|
|
179
|
-
let e =
|
|
178
|
+
if (B && !E) return /* @__PURE__ */ m("li", { children: /* @__PURE__ */ m(b, { item: t }) }, t.id ?? a);
|
|
179
|
+
let e = L.value.includes(t.label), r = `${P}-group-${a}`;
|
|
180
180
|
return /* @__PURE__ */ h("li", { children: [/* @__PURE__ */ h("button", {
|
|
181
181
|
type: "button",
|
|
182
182
|
"aria-expanded": e,
|
|
183
183
|
"aria-controls": r,
|
|
184
|
-
"aria-label":
|
|
184
|
+
"aria-label": B ? t.label : void 0,
|
|
185
185
|
"data-state": e ? "open" : "closed",
|
|
186
186
|
className: n.groupTrigger,
|
|
187
|
-
onClick: () =>
|
|
187
|
+
onClick: () => R(t.label),
|
|
188
188
|
children: [
|
|
189
189
|
t.icon ? /* @__PURE__ */ m("span", {
|
|
190
190
|
className: n.icon,
|
|
191
191
|
"aria-hidden": "true",
|
|
192
192
|
children: t.icon
|
|
193
|
-
}) :
|
|
193
|
+
}) : B ? /* @__PURE__ */ m("span", {
|
|
194
194
|
className: n.fallbackIcon,
|
|
195
195
|
"data-fallback-icon": !0,
|
|
196
196
|
"aria-hidden": "true",
|
|
@@ -198,7 +198,7 @@ function x({ items: t, groups: r, collapsed: o, defaultCollapsed: _ = !1, onColl
|
|
|
198
198
|
}) : null,
|
|
199
199
|
/* @__PURE__ */ m("span", {
|
|
200
200
|
className: n.label,
|
|
201
|
-
"data-rail-hidden":
|
|
201
|
+
"data-rail-hidden": B || void 0,
|
|
202
202
|
children: t.label
|
|
203
203
|
}),
|
|
204
204
|
/* @__PURE__ */ m("svg", {
|
|
@@ -238,7 +238,7 @@ function x({ items: t, groups: r, collapsed: o, defaultCollapsed: _ = !1, onColl
|
|
|
238
238
|
className: n.icon,
|
|
239
239
|
"aria-hidden": "true",
|
|
240
240
|
children: t.icon
|
|
241
|
-
}) :
|
|
241
|
+
}) : B ? /* @__PURE__ */ m("span", {
|
|
242
242
|
className: n.fallbackIcon,
|
|
243
243
|
"data-fallback-icon": !0,
|
|
244
244
|
"aria-hidden": "true",
|
|
@@ -246,18 +246,18 @@ function x({ items: t, groups: r, collapsed: o, defaultCollapsed: _ = !1, onColl
|
|
|
246
246
|
}) : null,
|
|
247
247
|
/* @__PURE__ */ m("span", {
|
|
248
248
|
className: n.label,
|
|
249
|
-
"data-rail-hidden":
|
|
249
|
+
"data-rail-hidden": B || void 0,
|
|
250
250
|
children: t.label
|
|
251
251
|
}),
|
|
252
252
|
t.trailing == null ? null : /* @__PURE__ */ m("span", {
|
|
253
253
|
className: n.trailing,
|
|
254
|
-
"data-rail-hidden":
|
|
254
|
+
"data-rail-hidden": B || void 0,
|
|
255
255
|
children: t.trailing
|
|
256
256
|
})
|
|
257
257
|
] }), c = t.tone && t.tone !== "default" ? t.tone : void 0, l = {
|
|
258
258
|
href: t.disabled ? void 0 : t.href,
|
|
259
259
|
"aria-current": t.active ? "page" : void 0,
|
|
260
|
-
"aria-label":
|
|
260
|
+
"aria-label": B ? t.label : void 0,
|
|
261
261
|
"aria-disabled": t.disabled || void 0,
|
|
262
262
|
tabIndex: t.disabled ? -1 : void 0,
|
|
263
263
|
"data-state": t.active ? "active" : void 0,
|
|
@@ -274,7 +274,7 @@ function x({ items: t, groups: r, collapsed: o, defaultCollapsed: _ = !1, onColl
|
|
|
274
274
|
if (t.render) return /* @__PURE__ */ m("li", {
|
|
275
275
|
className: n.customItem,
|
|
276
276
|
children: t.render({
|
|
277
|
-
collapsed:
|
|
277
|
+
collapsed: B,
|
|
278
278
|
children: o,
|
|
279
279
|
linkProps: l
|
|
280
280
|
})
|
|
@@ -282,7 +282,7 @@ function x({ items: t, groups: r, collapsed: o, defaultCollapsed: _ = !1, onColl
|
|
|
282
282
|
let u = s(), d = t.onClick && !t.href ? /* @__PURE__ */ m("button", {
|
|
283
283
|
type: "button",
|
|
284
284
|
"aria-current": t.active ? "page" : void 0,
|
|
285
|
-
"aria-label":
|
|
285
|
+
"aria-label": B ? t.label : void 0,
|
|
286
286
|
"data-state": t.active ? "active" : void 0,
|
|
287
287
|
"data-tone": c,
|
|
288
288
|
className: n.link,
|
|
@@ -293,24 +293,24 @@ function x({ items: t, groups: r, collapsed: o, defaultCollapsed: _ = !1, onColl
|
|
|
293
293
|
...l,
|
|
294
294
|
children: o
|
|
295
295
|
});
|
|
296
|
-
return /* @__PURE__ */ m("li", { children:
|
|
296
|
+
return /* @__PURE__ */ m("li", { children: B && !E ? /* @__PURE__ */ m(e, {
|
|
297
297
|
content: t.label,
|
|
298
298
|
placement: "right",
|
|
299
299
|
children: d
|
|
300
300
|
}) : d }, t.id ?? a);
|
|
301
301
|
})
|
|
302
302
|
})]
|
|
303
|
-
}, r))
|
|
303
|
+
}, t.id ?? r))
|
|
304
304
|
}),
|
|
305
|
-
|
|
305
|
+
k && /* @__PURE__ */ m("div", {
|
|
306
306
|
className: n.footer,
|
|
307
|
-
children:
|
|
307
|
+
children: k
|
|
308
308
|
}),
|
|
309
|
-
|
|
309
|
+
D && /* @__PURE__ */ m("button", {
|
|
310
310
|
type: "button",
|
|
311
|
-
"aria-label":
|
|
311
|
+
"aria-label": B ? N : M,
|
|
312
312
|
className: n.collapseToggle,
|
|
313
|
-
onClick:
|
|
313
|
+
onClick: z,
|
|
314
314
|
children: /* @__PURE__ */ m("svg", {
|
|
315
315
|
viewBox: "0 0 16 16",
|
|
316
316
|
width: "14",
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
sideNav: "
|
|
3
|
-
label: "
|
|
4
|
-
trailing: "
|
|
5
|
-
groupIndicator: "
|
|
6
|
-
link: "
|
|
7
|
-
groupTrigger: "
|
|
8
|
-
fallbackIcon: "
|
|
9
|
-
list: "
|
|
10
|
-
sublistInner: "
|
|
11
|
-
groupItems: "
|
|
12
|
-
group: "
|
|
13
|
-
groupLabel: "
|
|
14
|
-
checkMark: "
|
|
15
|
-
icon: "
|
|
16
|
-
sublist: "
|
|
17
|
-
sublink: "
|
|
18
|
-
subSeparator: "
|
|
19
|
-
subGroupLabel: "
|
|
20
|
-
header: "
|
|
21
|
-
footer: "
|
|
22
|
-
customItem: "
|
|
23
|
-
collapseToggle: "
|
|
24
|
-
collapseIcon: "
|
|
25
|
-
railFlyout: "
|
|
26
|
-
railFlyoutCaption: "
|
|
27
|
-
flyoutItem: "
|
|
28
|
-
flyoutSeparator: "
|
|
2
|
+
sideNav: "_sideNav_uayvm_2",
|
|
3
|
+
label: "_label_uayvm_24",
|
|
4
|
+
trailing: "_trailing_uayvm_25",
|
|
5
|
+
groupIndicator: "_groupIndicator_uayvm_29",
|
|
6
|
+
link: "_link_uayvm_50",
|
|
7
|
+
groupTrigger: "_groupTrigger_uayvm_51",
|
|
8
|
+
fallbackIcon: "_fallbackIcon_uayvm_60",
|
|
9
|
+
list: "_list_uayvm_67",
|
|
10
|
+
sublistInner: "_sublistInner_uayvm_68",
|
|
11
|
+
groupItems: "_groupItems_uayvm_69",
|
|
12
|
+
group: "_group_uayvm_29",
|
|
13
|
+
groupLabel: "_groupLabel_uayvm_84",
|
|
14
|
+
checkMark: "_checkMark_uayvm_185",
|
|
15
|
+
icon: "_icon_uayvm_191",
|
|
16
|
+
sublist: "_sublist_uayvm_68",
|
|
17
|
+
sublink: "_sublink_uayvm_251",
|
|
18
|
+
subSeparator: "_subSeparator_uayvm_263",
|
|
19
|
+
subGroupLabel: "_subGroupLabel_uayvm_270",
|
|
20
|
+
header: "_header_uayvm_282",
|
|
21
|
+
footer: "_footer_uayvm_289",
|
|
22
|
+
customItem: "_customItem_uayvm_297",
|
|
23
|
+
collapseToggle: "_collapseToggle_uayvm_302",
|
|
24
|
+
collapseIcon: "_collapseIcon_uayvm_328",
|
|
25
|
+
railFlyout: "_railFlyout_uayvm_337",
|
|
26
|
+
railFlyoutCaption: "_railFlyoutCaption_uayvm_369",
|
|
27
|
+
flyoutItem: "_flyoutItem_uayvm_379",
|
|
28
|
+
flyoutSeparator: "_flyoutSeparator_uayvm_384"
|
|
29
29
|
};
|
|
30
30
|
//#endregion
|
|
31
31
|
export { e as default };
|
|
@@ -3,25 +3,26 @@ import { cn as t } from "@cascivo/core/pure";
|
|
|
3
3
|
import { forwardRef as n } from "react";
|
|
4
4
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
5
|
//#region ../components/src/slider/slider.tsx
|
|
6
|
-
var a = n(function({ label: n,
|
|
7
|
-
let
|
|
6
|
+
var a = n(function({ label: n, ariaLabel: a, className: o, id: s, min: c = 0, max: l = 100, step: u = 1, disabled: d, ...f }, p) {
|
|
7
|
+
let m = s ?? (n ? `cascade-slider-${n.toLowerCase().replace(/\s+/g, "-")}` : void 0);
|
|
8
8
|
return /* @__PURE__ */ i("div", {
|
|
9
|
-
className: t(e.wrapper,
|
|
10
|
-
"data-disabled":
|
|
9
|
+
className: t(e.wrapper, o),
|
|
10
|
+
"data-disabled": d || void 0,
|
|
11
11
|
children: [n && /* @__PURE__ */ r("label", {
|
|
12
12
|
className: e.label,
|
|
13
|
-
htmlFor:
|
|
13
|
+
htmlFor: m,
|
|
14
14
|
children: n
|
|
15
15
|
}), /* @__PURE__ */ r("input", {
|
|
16
|
-
id:
|
|
16
|
+
id: m,
|
|
17
17
|
type: "range",
|
|
18
|
-
min:
|
|
19
|
-
max:
|
|
20
|
-
step:
|
|
21
|
-
disabled:
|
|
18
|
+
min: c,
|
|
19
|
+
max: l,
|
|
20
|
+
step: u,
|
|
21
|
+
disabled: d,
|
|
22
22
|
className: e.slider,
|
|
23
|
-
ref:
|
|
24
|
-
...
|
|
23
|
+
ref: p,
|
|
24
|
+
...f,
|
|
25
|
+
"aria-label": f["aria-label"] ?? a
|
|
25
26
|
})]
|
|
26
27
|
});
|
|
27
28
|
});
|
|
@@ -5,13 +5,13 @@ import { cn as t, useSignals as n } from "@cascivo/core";
|
|
|
5
5
|
import { builtin as r, t as i } from "@cascivo/i18n";
|
|
6
6
|
import { jsx as a } from "react/jsx-runtime";
|
|
7
7
|
//#region ../components/src/spinner/spinner.tsx
|
|
8
|
-
function o({ size: o = "md", label: s,
|
|
8
|
+
function o({ size: o = "md", label: s, ariaLabel: c, className: l, ...u }) {
|
|
9
9
|
return n(), /* @__PURE__ */ a("span", {
|
|
10
10
|
role: "status",
|
|
11
|
-
"aria-label": s ?? i(r.spinner.label),
|
|
11
|
+
"aria-label": c ?? s ?? i(r.spinner.label),
|
|
12
12
|
"data-size": o,
|
|
13
|
-
className: t(e.spinner,
|
|
14
|
-
...
|
|
13
|
+
className: t(e.spinner, l),
|
|
14
|
+
...u
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
//#endregion
|
package/dist/node/steps/steps.js
CHANGED
|
@@ -5,17 +5,17 @@ import { normalizeProgress as t, useSignal as n, useSignals as r } from "@casciv
|
|
|
5
5
|
import { builtin as i, t as a } from "@cascivo/i18n";
|
|
6
6
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
7
|
//#region ../components/src/steps/steps.tsx
|
|
8
|
-
function c({ steps: c,
|
|
8
|
+
function c({ steps: c, items: l, activeStep: u, orientation: d = "horizontal", className: f, ariaLabel: p, label: m }) {
|
|
9
9
|
r();
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
let
|
|
10
|
+
let h = l ?? c ?? [], g = n(u ?? 0);
|
|
11
|
+
g.value = u ?? g.value;
|
|
12
|
+
let _ = p ?? m ?? a(i.steps.label);
|
|
13
13
|
return /* @__PURE__ */ o("ol", {
|
|
14
|
-
className: [e.steps,
|
|
15
|
-
"data-orientation":
|
|
16
|
-
"aria-label":
|
|
17
|
-
children:
|
|
18
|
-
let i = n.state ? t(n.state) : r <
|
|
14
|
+
className: [e.steps, f].filter(Boolean).join(" "),
|
|
15
|
+
"data-orientation": d,
|
|
16
|
+
"aria-label": _,
|
|
17
|
+
children: h.map((n, r) => {
|
|
18
|
+
let i = n.state ? t(n.state) : r < g.value ? "complete" : r === g.value ? "active" : "pending";
|
|
19
19
|
return /* @__PURE__ */ s("li", {
|
|
20
20
|
className: e.step,
|
|
21
21
|
"data-state": i,
|
|
@@ -27,7 +27,7 @@ function c({ steps: c, activeStep: l, orientation: u = "horizontal", className:
|
|
|
27
27
|
className: e.label,
|
|
28
28
|
children: n.label
|
|
29
29
|
})]
|
|
30
|
-
}, r);
|
|
30
|
+
}, n.id ?? r);
|
|
31
31
|
})
|
|
32
32
|
});
|
|
33
33
|
}
|
|
@@ -6,10 +6,10 @@ import { cn as n, useControllableSignal as r, useRovingFocus as i, useSignals as
|
|
|
6
6
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
7
|
//#region ../components/src/structured-list/structured-list.tsx
|
|
8
8
|
function c(t) {
|
|
9
|
-
let { items: r, headers: i, selectable: a = !1, className: c, ariaLabel: u, "aria-label":
|
|
9
|
+
let { items: r, headers: i, selectable: a = !1, className: c, ariaLabel: u, label: d, "aria-label": f } = t;
|
|
10
10
|
return a ? /* @__PURE__ */ o(l, { ...t }) : /* @__PURE__ */ s("div", {
|
|
11
11
|
role: "table",
|
|
12
|
-
"aria-label":
|
|
12
|
+
"aria-label": f ?? u ?? d,
|
|
13
13
|
className: n(e.list, c),
|
|
14
14
|
children: [i && /* @__PURE__ */ o("div", {
|
|
15
15
|
role: "row",
|
|
@@ -34,22 +34,22 @@ function c(t) {
|
|
|
34
34
|
})]
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
function l({ items: c, headers: l, value: u, defaultValue: d, onSelect: f, className: p, ariaLabel: m, "aria-label": h }) {
|
|
38
|
-
let
|
|
37
|
+
function l({ items: c, headers: l, value: u, defaultValue: d, onSelect: f, className: p, ariaLabel: m, "aria-label": h, label: g }) {
|
|
38
|
+
let _ = h ?? m ?? g;
|
|
39
39
|
a();
|
|
40
|
-
let
|
|
40
|
+
let v = t(), [y, b] = r({
|
|
41
41
|
value: u,
|
|
42
42
|
defaultValue: d ?? c.find((e) => e.selected)?.id ?? "",
|
|
43
43
|
onChange: f
|
|
44
|
-
}),
|
|
44
|
+
}), x = i({
|
|
45
45
|
orientation: "vertical",
|
|
46
46
|
loop: !1
|
|
47
|
-
}),
|
|
48
|
-
|
|
47
|
+
}), S = (e) => {
|
|
48
|
+
b(e);
|
|
49
49
|
};
|
|
50
50
|
return /* @__PURE__ */ s("div", {
|
|
51
51
|
role: "radiogroup",
|
|
52
|
-
"aria-label":
|
|
52
|
+
"aria-label": _,
|
|
53
53
|
className: n(e.list, e.selectable, p),
|
|
54
54
|
children: [l && /* @__PURE__ */ s("div", {
|
|
55
55
|
className: e.headerRow,
|
|
@@ -63,18 +63,18 @@ function l({ items: c, headers: l, value: u, defaultValue: d, onSelect: f, class
|
|
|
63
63
|
}), /* @__PURE__ */ o("div", {
|
|
64
64
|
className: e.body,
|
|
65
65
|
children: c.map((t, n) => {
|
|
66
|
-
let r =
|
|
66
|
+
let r = y.value === t.id, { ref: i, ...a } = x.getItemProps(n);
|
|
67
67
|
return /* @__PURE__ */ s("div", {
|
|
68
68
|
role: "radio",
|
|
69
69
|
"aria-checked": r,
|
|
70
|
-
"aria-labelledby": `${
|
|
70
|
+
"aria-labelledby": `${v}-${t.id}-label`,
|
|
71
71
|
"data-selected": r || void 0,
|
|
72
72
|
className: e.row,
|
|
73
73
|
ref: i,
|
|
74
74
|
...a,
|
|
75
|
-
onClick: () =>
|
|
75
|
+
onClick: () => S(t.id),
|
|
76
76
|
onKeyDown: (e) => {
|
|
77
|
-
a.onKeyDown(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
77
|
+
a.onKeyDown(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), S(t.id));
|
|
78
78
|
},
|
|
79
79
|
children: [
|
|
80
80
|
/* @__PURE__ */ o("div", {
|
|
@@ -84,7 +84,7 @@ function l({ items: c, headers: l, value: u, defaultValue: d, onSelect: f, class
|
|
|
84
84
|
}),
|
|
85
85
|
/* @__PURE__ */ o("div", {
|
|
86
86
|
className: e.cell,
|
|
87
|
-
id: `${
|
|
87
|
+
id: `${v}-${t.id}-label`,
|
|
88
88
|
children: t.cells[0]
|
|
89
89
|
}),
|
|
90
90
|
t.cells.slice(1).map((t, n) => /* @__PURE__ */ o("div", {
|
package/dist/node/swap/swap.js
CHANGED
|
@@ -4,23 +4,23 @@ import e from "./swap.module.js";
|
|
|
4
4
|
import { useControllableSignal as t, useSignals as n } from "@cascivo/core";
|
|
5
5
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
6
|
//#region ../components/src/swap/swap.tsx
|
|
7
|
-
function a({ on: a, off: o, checked: s = !1, onValueChange: c,
|
|
7
|
+
function a({ on: a, off: o, checked: s = !1, onValueChange: c, mode: l = "rotate", className: u, ariaLabel: d, label: f, ...p }) {
|
|
8
8
|
n();
|
|
9
9
|
let [m] = t({ value: s });
|
|
10
10
|
function h() {
|
|
11
11
|
let e = !m.value;
|
|
12
|
-
|
|
12
|
+
c?.(e);
|
|
13
13
|
}
|
|
14
14
|
return /* @__PURE__ */ i("button", {
|
|
15
15
|
type: "button",
|
|
16
16
|
role: "switch",
|
|
17
17
|
"aria-checked": m.value,
|
|
18
|
-
className: [e.swap,
|
|
18
|
+
className: [e.swap, u].filter(Boolean).join(" "),
|
|
19
19
|
"data-checked": m.value || void 0,
|
|
20
|
-
"data-mode":
|
|
20
|
+
"data-mode": l,
|
|
21
21
|
onClick: h,
|
|
22
22
|
...p,
|
|
23
|
-
...f === void 0 ? {} : { "aria-label": f },
|
|
23
|
+
...(d ?? f) === void 0 ? {} : { "aria-label": d ?? f },
|
|
24
24
|
children: [/* @__PURE__ */ r("span", {
|
|
25
25
|
className: e.on,
|
|
26
26
|
"aria-hidden": "true",
|
|
@@ -5,17 +5,17 @@ import { cn as t, getLinkComponent as n, useSignals as r } from "@cascivo/core";
|
|
|
5
5
|
import { builtin as i, t as a } from "@cascivo/i18n";
|
|
6
6
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
7
|
//#region ../components/src/switcher/switcher.tsx
|
|
8
|
-
function c({ items: c, label: l,
|
|
8
|
+
function c({ items: c, label: l, ariaLabel: u, className: d }) {
|
|
9
9
|
r();
|
|
10
|
-
let
|
|
10
|
+
let f = n();
|
|
11
11
|
return /* @__PURE__ */ o("ul", {
|
|
12
|
-
"aria-label": l ?? a(i.switcher.label),
|
|
13
|
-
className: t(e.switcher,
|
|
12
|
+
"aria-label": u ?? l ?? a(i.switcher.label),
|
|
13
|
+
className: t(e.switcher, d),
|
|
14
14
|
children: c.map((t, n) => "divider" in t ? /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o("span", {
|
|
15
15
|
role: "separator",
|
|
16
16
|
"aria-orientation": "horizontal",
|
|
17
17
|
className: e.divider
|
|
18
|
-
}) }, `divider-${n}`) : /* @__PURE__ */ o("li", { children: /* @__PURE__ */ s(
|
|
18
|
+
}) }, `divider-${n}`) : /* @__PURE__ */ o("li", { children: /* @__PURE__ */ s(f, {
|
|
19
19
|
href: t.href,
|
|
20
20
|
"aria-current": t.active ? "page" : void 0,
|
|
21
21
|
"data-state": t.active ? "active" : void 0,
|
|
@@ -6,22 +6,22 @@ import { cn as n, focusElement as r, useSignal as i, useSignals as a } from "@ca
|
|
|
6
6
|
import { builtin as o, t as s } from "@cascivo/i18n";
|
|
7
7
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
8
|
//#region ../components/src/tags-input/tags-input.tsx
|
|
9
|
-
function u({ value: u, onValueChange: d, placeholder: f, validate: p, max: m, disabled: h = !1, className: g,
|
|
9
|
+
function u({ value: u, onValueChange: d, placeholder: f, validate: p, max: m, disabled: h = !1, className: g, id: _, ariaLabel: v, label: y, "aria-labelledby": b, "aria-describedby": x, "aria-invalid": S, ...C }) {
|
|
10
10
|
a();
|
|
11
|
-
let
|
|
12
|
-
function
|
|
11
|
+
let w = i(""), T = t(null), E = v ?? y ?? (b === void 0 ? s(o.tagsInput.label) : void 0);
|
|
12
|
+
function D(e) {
|
|
13
13
|
let t = e.trim();
|
|
14
|
-
t && (m !== void 0 && u.length >= m || u.includes(t) || p && !p(t) || (d([...u, t]),
|
|
14
|
+
t && (m !== void 0 && u.length >= m || u.includes(t) || p && !p(t) || (d([...u, t]), w.value = ""));
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function O(e) {
|
|
17
17
|
d(u.filter((t, n) => n !== e));
|
|
18
18
|
}
|
|
19
|
-
let
|
|
19
|
+
let k = f ?? s(o.tagsInput.placeholder);
|
|
20
20
|
return /* @__PURE__ */ l("div", {
|
|
21
21
|
className: n(e.wrapper, g),
|
|
22
22
|
"data-disabled": h ? "" : void 0,
|
|
23
|
-
onClick: () => r(
|
|
24
|
-
...
|
|
23
|
+
onClick: () => r(T.current),
|
|
24
|
+
...C,
|
|
25
25
|
children: [u.map((t, n) => {
|
|
26
26
|
let r = p ? !p(t) : !1;
|
|
27
27
|
return /* @__PURE__ */ l("span", {
|
|
@@ -33,7 +33,7 @@ function u({ value: u, onValueChange: d, placeholder: f, validate: p, max: m, di
|
|
|
33
33
|
"aria-label": s(o.tagsInput.remove, { tag: t }),
|
|
34
34
|
disabled: h,
|
|
35
35
|
onClick: (e) => {
|
|
36
|
-
e.stopPropagation(),
|
|
36
|
+
e.stopPropagation(), O(n);
|
|
37
37
|
},
|
|
38
38
|
children: /* @__PURE__ */ c("span", {
|
|
39
39
|
"aria-hidden": "true",
|
|
@@ -42,20 +42,24 @@ function u({ value: u, onValueChange: d, placeholder: f, validate: p, max: m, di
|
|
|
42
42
|
})]
|
|
43
43
|
}, n);
|
|
44
44
|
}), /* @__PURE__ */ c("input", {
|
|
45
|
-
ref:
|
|
45
|
+
ref: T,
|
|
46
46
|
className: e.input,
|
|
47
|
-
value:
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
value: w.value,
|
|
48
|
+
id: _,
|
|
49
|
+
"aria-labelledby": b,
|
|
50
|
+
"aria-describedby": x,
|
|
51
|
+
"aria-invalid": S,
|
|
52
|
+
"aria-label": E,
|
|
53
|
+
placeholder: u.length === 0 ? k : void 0,
|
|
50
54
|
disabled: h,
|
|
51
55
|
onChange: (e) => {
|
|
52
|
-
|
|
56
|
+
w.value = e.currentTarget.value;
|
|
53
57
|
},
|
|
54
58
|
onKeyDown: (e) => {
|
|
55
|
-
e.key === "Enter" || e.key === "," ? (e.preventDefault(),
|
|
59
|
+
e.key === "Enter" || e.key === "," ? (e.preventDefault(), D(w.value)) : e.key === "Backspace" && !w.value && O(u.length - 1);
|
|
56
60
|
},
|
|
57
61
|
onBlur: () => {
|
|
58
|
-
|
|
62
|
+
w.value && D(w.value);
|
|
59
63
|
}
|
|
60
64
|
})]
|
|
61
65
|
});
|
|
@@ -11,42 +11,43 @@ var s = r({
|
|
|
11
11
|
idle: { on: { FOCUS: "focused" } },
|
|
12
12
|
focused: { on: { BLUR: "idle" } }
|
|
13
13
|
}
|
|
14
|
-
}), c = t(function({ label: t, hint: r, error: c, resize: l = "vertical", rows: u = 4,
|
|
15
|
-
let [
|
|
14
|
+
}), c = t(function({ label: t, hint: r, error: c, resize: l = "vertical", rows: u = 4, ariaLabel: d, className: f, id: p, onFocus: m, onBlur: h, ...g }, _) {
|
|
15
|
+
let [v, y] = i(s), b = p ?? (t ? `cascade-textarea-${t.toLowerCase().replace(/\s+/g, "-")}` : void 0);
|
|
16
16
|
return /* @__PURE__ */ o("div", {
|
|
17
|
-
className: n(e.wrapper,
|
|
18
|
-
"data-state": c ? "error" :
|
|
17
|
+
className: n(e.wrapper, f),
|
|
18
|
+
"data-state": c ? "error" : v.value,
|
|
19
19
|
"data-resize": l,
|
|
20
20
|
children: [
|
|
21
21
|
t && /* @__PURE__ */ a("label", {
|
|
22
22
|
className: e.label,
|
|
23
|
-
htmlFor:
|
|
23
|
+
htmlFor: b,
|
|
24
24
|
children: t
|
|
25
25
|
}),
|
|
26
26
|
/* @__PURE__ */ a("textarea", {
|
|
27
|
-
ref:
|
|
28
|
-
id:
|
|
27
|
+
ref: _,
|
|
28
|
+
id: b,
|
|
29
29
|
rows: u,
|
|
30
30
|
"aria-multiline": "true",
|
|
31
31
|
className: e.textarea,
|
|
32
32
|
"aria-invalid": c ? !0 : void 0,
|
|
33
|
-
"aria-describedby": c ? `${
|
|
33
|
+
"aria-describedby": c ? `${b}-error` : r ? `${b}-hint` : void 0,
|
|
34
34
|
onFocus: (e) => {
|
|
35
|
-
|
|
35
|
+
y("FOCUS"), m?.(e);
|
|
36
36
|
},
|
|
37
37
|
onBlur: (e) => {
|
|
38
|
-
|
|
38
|
+
y("BLUR"), h?.(e);
|
|
39
39
|
},
|
|
40
|
-
...
|
|
40
|
+
...g,
|
|
41
|
+
"aria-label": g["aria-label"] ?? d
|
|
41
42
|
}),
|
|
42
43
|
c && /* @__PURE__ */ a("span", {
|
|
43
|
-
id: `${
|
|
44
|
+
id: `${b}-error`,
|
|
44
45
|
className: e.error,
|
|
45
46
|
role: "alert",
|
|
46
47
|
children: c
|
|
47
48
|
}),
|
|
48
49
|
!c && r && /* @__PURE__ */ a("span", {
|
|
49
|
-
id: `${
|
|
50
|
+
id: `${b}-hint`,
|
|
50
51
|
className: e.hint,
|
|
51
52
|
children: r
|
|
52
53
|
})
|
|
@@ -11,18 +11,18 @@ var c = r({
|
|
|
11
11
|
idle: { on: { FOCUS: "focused" } },
|
|
12
12
|
focused: { on: { BLUR: "idle" } }
|
|
13
13
|
}
|
|
14
|
-
}), l = t(function({ value: t, defaultValue: r, onValueChange: l,
|
|
14
|
+
}), l = t(function({ value: t, defaultValue: r, onValueChange: l, min: u, max: d, step: f, label: p, hint: m, error: h, size: g = "md", className: _, id: v, onFocus: y, onBlur: b, ariaLabel: x, ...S }, C) {
|
|
15
15
|
a();
|
|
16
|
-
let [w, T] = i(c), E =
|
|
16
|
+
let [w, T] = i(c), E = v ?? (p ? `cascade-time-picker-${p.toLowerCase().replace(/\s+/g, "-")}` : void 0);
|
|
17
17
|
return /* @__PURE__ */ s("div", {
|
|
18
|
-
className: n(e.wrapper,
|
|
19
|
-
"data-state":
|
|
20
|
-
"data-size":
|
|
18
|
+
className: n(e.wrapper, _),
|
|
19
|
+
"data-state": h ? "error" : w.value,
|
|
20
|
+
"data-size": g,
|
|
21
21
|
children: [
|
|
22
|
-
|
|
22
|
+
p && /* @__PURE__ */ o("label", {
|
|
23
23
|
className: e.label,
|
|
24
24
|
htmlFor: E,
|
|
25
|
-
children:
|
|
25
|
+
children: p
|
|
26
26
|
}),
|
|
27
27
|
/* @__PURE__ */ o("input", {
|
|
28
28
|
id: E,
|
|
@@ -30,31 +30,32 @@ var c = r({
|
|
|
30
30
|
className: e.input,
|
|
31
31
|
value: t,
|
|
32
32
|
defaultValue: r,
|
|
33
|
-
min:
|
|
34
|
-
max:
|
|
35
|
-
step:
|
|
36
|
-
"aria-invalid":
|
|
37
|
-
"aria-describedby":
|
|
38
|
-
onChange: (e) =>
|
|
33
|
+
min: u,
|
|
34
|
+
max: d,
|
|
35
|
+
step: f,
|
|
36
|
+
"aria-invalid": h ? !0 : void 0,
|
|
37
|
+
"aria-describedby": h ? `${E}-error` : m ? `${E}-hint` : void 0,
|
|
38
|
+
onChange: (e) => l?.(e.target.value),
|
|
39
39
|
onFocus: (e) => {
|
|
40
|
-
T("FOCUS"),
|
|
40
|
+
T("FOCUS"), y?.(e);
|
|
41
41
|
},
|
|
42
42
|
onBlur: (e) => {
|
|
43
|
-
T("BLUR"),
|
|
43
|
+
T("BLUR"), b?.(e);
|
|
44
44
|
},
|
|
45
45
|
ref: C,
|
|
46
|
-
...S
|
|
46
|
+
...S,
|
|
47
|
+
"aria-label": S["aria-label"] ?? x
|
|
47
48
|
}),
|
|
48
|
-
|
|
49
|
+
h && /* @__PURE__ */ o("span", {
|
|
49
50
|
id: `${E}-error`,
|
|
50
51
|
className: e.error,
|
|
51
52
|
role: "alert",
|
|
52
|
-
children:
|
|
53
|
+
children: h
|
|
53
54
|
}),
|
|
54
|
-
!
|
|
55
|
+
!h && m && /* @__PURE__ */ o("span", {
|
|
55
56
|
id: `${E}-hint`,
|
|
56
57
|
className: e.hint,
|
|
57
|
-
children:
|
|
58
|
+
children: m
|
|
58
59
|
})
|
|
59
60
|
]
|
|
60
61
|
});
|