@cascivo/react 0.13.0 → 0.13.1
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 +202 -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/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/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/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 +55 -5
- 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/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
|
@@ -4,9 +4,9 @@ import { Button as e } from "../button/button.js";
|
|
|
4
4
|
import { Checkbox as t } from "../checkbox/checkbox.js";
|
|
5
5
|
import n from "./data-table.module.js";
|
|
6
6
|
import { batch as r, cn as i, useComputed as a, useSignal as o, useSignalEffect as ee, useSignals as te } from "@cascivo/core";
|
|
7
|
+
import { Fragment as ne, useId as re, useRef as ie } from "react";
|
|
7
8
|
import { builtin as s, t as c } from "@cascivo/i18n";
|
|
8
9
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
9
|
-
import { Fragment as ne, useId as re, useRef as ie } from "react";
|
|
10
10
|
import { flushSync as ae } from "react-dom";
|
|
11
11
|
//#region ../components/src/data-table/data-table.tsx
|
|
12
12
|
function d(e, t) {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import e from "./date-picker.module.js";
|
|
4
4
|
import { batch as t, cn as n, createMachine as r, useMachine as i, useSignal as a, useSignalEffect as o, useSignals as s } from "@cascivo/core";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useId as c, useRef as ee } from "react";
|
|
6
|
+
import { builtin as l, currentLocale as te, t as u } from "@cascivo/i18n";
|
|
7
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
8
8
|
//#region ../components/src/date-picker/date-picker.tsx
|
|
9
9
|
var p = r({
|
|
10
10
|
initial: "closed",
|
|
@@ -41,9 +41,9 @@ function _(e) {
|
|
|
41
41
|
}
|
|
42
42
|
function v({ value: r, defaultValue: v, onValueChange: y, onChange: b, min: x, max: S, clearable: C = !1, label: w, hint: T, error: E, size: D = "md", disabled: O = !1, labels: k, className: re, id: A }) {
|
|
43
43
|
s();
|
|
44
|
-
let [j, M] = i(p), N =
|
|
44
|
+
let [j, M] = i(p), N = c(), P = A ?? `cascade-date-picker-${N}`, F = `${N}-grid`, I = te(), ie = k?.placeholder ?? u(l.datePicker.placeholder), ae = k?.previousMonth ?? u(l.datePicker.previousMonth), L = k?.nextMonth ?? u(l.datePicker.nextMonth), R = k?.clear ?? u(l.datePicker.clear), z = /* @__PURE__ */ new Date(), B = g(z), V = a(r ?? v);
|
|
45
45
|
r !== void 0 && (V.value = r);
|
|
46
|
-
let H = a(V.value ? _(V.value).getUTCFullYear() : z.getUTCFullYear()), U = a(V.value ? _(V.value).getUTCMonth() : z.getUTCMonth()), W = a(V.value), G =
|
|
46
|
+
let H = a(V.value ? _(V.value).getUTCFullYear() : z.getUTCFullYear()), U = a(V.value ? _(V.value).getUTCMonth() : z.getUTCMonth()), W = a(V.value), G = ee(null);
|
|
47
47
|
o(() => {
|
|
48
48
|
if (j.value !== "open") return;
|
|
49
49
|
let e = (e) => {
|
|
@@ -94,20 +94,20 @@ function v({ value: r, defaultValue: v, onValueChange: y, onChange: b, min: x, m
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
}, $ = V.value ? h(_(V.value), I) : "";
|
|
97
|
-
return /* @__PURE__ */
|
|
97
|
+
return /* @__PURE__ */ f("div", {
|
|
98
98
|
ref: G,
|
|
99
99
|
className: n(e.wrapper, re),
|
|
100
100
|
"data-state": E ? "error" : j.value,
|
|
101
101
|
"data-size": D,
|
|
102
102
|
children: [
|
|
103
|
-
w && /* @__PURE__ */
|
|
103
|
+
w && /* @__PURE__ */ d("label", {
|
|
104
104
|
className: e.label,
|
|
105
105
|
htmlFor: P,
|
|
106
106
|
children: w
|
|
107
107
|
}),
|
|
108
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ f("div", {
|
|
109
109
|
className: e.field,
|
|
110
|
-
children: [/* @__PURE__ */
|
|
110
|
+
children: [/* @__PURE__ */ f("button", {
|
|
111
111
|
id: P,
|
|
112
112
|
type: "button",
|
|
113
113
|
role: "combobox",
|
|
@@ -119,15 +119,15 @@ function v({ value: r, defaultValue: v, onValueChange: y, onChange: b, min: x, m
|
|
|
119
119
|
className: e.trigger,
|
|
120
120
|
disabled: O,
|
|
121
121
|
onClick: j.value === "open" ? q : K,
|
|
122
|
-
children: [/* @__PURE__ */
|
|
122
|
+
children: [/* @__PURE__ */ d("span", {
|
|
123
123
|
className: n(e.value, $ ? void 0 : e.placeholder),
|
|
124
124
|
children: $ || ie
|
|
125
|
-
}), /* @__PURE__ */
|
|
125
|
+
}), /* @__PURE__ */ d("span", {
|
|
126
126
|
className: e.icon,
|
|
127
127
|
"aria-hidden": "true",
|
|
128
128
|
children: "📅"
|
|
129
129
|
})]
|
|
130
|
-
}), C && V.value !== void 0 && /* @__PURE__ */
|
|
130
|
+
}), C && V.value !== void 0 && /* @__PURE__ */ d("button", {
|
|
131
131
|
type: "button",
|
|
132
132
|
className: e.clear,
|
|
133
133
|
"aria-label": R,
|
|
@@ -135,29 +135,29 @@ function v({ value: r, defaultValue: v, onValueChange: y, onChange: b, min: x, m
|
|
|
135
135
|
children: "✕"
|
|
136
136
|
})]
|
|
137
137
|
}),
|
|
138
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ f("div", {
|
|
139
139
|
id: F,
|
|
140
140
|
role: "dialog",
|
|
141
141
|
"aria-label": Q,
|
|
142
142
|
className: e.calendar,
|
|
143
143
|
"data-state": j.value,
|
|
144
144
|
onKeyDown: de,
|
|
145
|
-
children: [/* @__PURE__ */
|
|
145
|
+
children: [/* @__PURE__ */ f("div", {
|
|
146
146
|
className: e.header,
|
|
147
147
|
children: [
|
|
148
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ d("button", {
|
|
149
149
|
type: "button",
|
|
150
150
|
className: e.navButton,
|
|
151
151
|
"aria-label": ae,
|
|
152
152
|
onClick: se,
|
|
153
153
|
children: "‹"
|
|
154
154
|
}),
|
|
155
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ d("span", {
|
|
156
156
|
className: e.monthLabel,
|
|
157
157
|
"aria-live": "polite",
|
|
158
158
|
children: Q
|
|
159
159
|
}),
|
|
160
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ d("button", {
|
|
161
161
|
type: "button",
|
|
162
162
|
className: e.navButton,
|
|
163
163
|
"aria-label": L,
|
|
@@ -165,20 +165,20 @@ function v({ value: r, defaultValue: v, onValueChange: y, onChange: b, min: x, m
|
|
|
165
165
|
children: "›"
|
|
166
166
|
})
|
|
167
167
|
]
|
|
168
|
-
}), /* @__PURE__ */
|
|
168
|
+
}), /* @__PURE__ */ f("table", {
|
|
169
169
|
role: "grid",
|
|
170
170
|
className: e.grid,
|
|
171
|
-
children: [/* @__PURE__ */
|
|
171
|
+
children: [/* @__PURE__ */ d("thead", { children: /* @__PURE__ */ d("tr", { children: ue.map((t) => /* @__PURE__ */ d("th", {
|
|
172
172
|
className: e.weekday,
|
|
173
173
|
abbr: t,
|
|
174
174
|
scope: "col",
|
|
175
175
|
children: t
|
|
176
|
-
}, t)) }) }), /* @__PURE__ */
|
|
177
|
-
if (!t) return /* @__PURE__ */
|
|
176
|
+
}, t)) }) }), /* @__PURE__ */ d("tbody", { children: Z.map((t, n) => /* @__PURE__ */ d("tr", { children: t.map((t, n) => {
|
|
177
|
+
if (!t) return /* @__PURE__ */ d("td", { className: e.empty }, n);
|
|
178
178
|
let r = g(t), i = r === V.value, a = r === B, o = r === W.value, s = x !== void 0 && r < x || S !== void 0 && r > S;
|
|
179
|
-
return /* @__PURE__ */
|
|
179
|
+
return /* @__PURE__ */ d("td", {
|
|
180
180
|
className: e.cell,
|
|
181
|
-
children: /* @__PURE__ */
|
|
181
|
+
children: /* @__PURE__ */ d("button", {
|
|
182
182
|
type: "button",
|
|
183
183
|
className: e.day,
|
|
184
184
|
tabIndex: o ? 0 : -1,
|
|
@@ -200,13 +200,13 @@ function v({ value: r, defaultValue: v, onValueChange: y, onChange: b, min: x, m
|
|
|
200
200
|
}) }, n)) })]
|
|
201
201
|
})]
|
|
202
202
|
}),
|
|
203
|
-
E && /* @__PURE__ */
|
|
203
|
+
E && /* @__PURE__ */ d("span", {
|
|
204
204
|
id: `${N}-error`,
|
|
205
205
|
className: e.error,
|
|
206
206
|
role: "alert",
|
|
207
207
|
children: E
|
|
208
208
|
}),
|
|
209
|
-
!E && T && /* @__PURE__ */
|
|
209
|
+
!E && T && /* @__PURE__ */ d("span", {
|
|
210
210
|
id: `${N}-hint`,
|
|
211
211
|
className: e.hint,
|
|
212
212
|
children: T
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import { Calendar as e } from "../calendar/calendar.js";
|
|
4
4
|
import t from "./date-range-picker.module.js";
|
|
5
|
-
import { batch as n, cn as r, useControllableSignal as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { batch as n, cn as r, useControllableSignal as ee, useSignal as i, useSignalEffect as a, useSignals as o } from "@cascivo/core";
|
|
6
|
+
import { useRef as s } from "react";
|
|
7
|
+
import { builtin as c, currentLocale as l, t as u } from "@cascivo/i18n";
|
|
8
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
9
|
//#region ../components/src/date-range-picker/date-range-picker.tsx
|
|
10
10
|
function p(e) {
|
|
11
11
|
return Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate());
|
|
@@ -21,15 +21,15 @@ function h(e, t, n) {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
function g({ value: g, defaultValue: _, onValueChange: te, min: v, max: y, disabled: b, presets: x, locale: S, placeholder: C, size: w = "md", labels: T, className: ne }) {
|
|
24
|
-
|
|
25
|
-
let E = S ??
|
|
24
|
+
o();
|
|
25
|
+
let E = S ?? l(), re = C ?? u(c.dateRangePicker.placeholder), D = T?.apply ?? u(c.dateRangePicker.apply), O = T?.clear ?? u(c.dateRangePicker.clear), k = T?.previousMonth ?? u(c.calendar.previousMonth), A = T?.nextMonth ?? u(c.calendar.nextMonth), [j, M] = ee({
|
|
26
26
|
value: g === void 0 ? void 0 : g,
|
|
27
27
|
defaultValue: _ ?? null,
|
|
28
28
|
onChange: (e) => {
|
|
29
29
|
e && te?.(e);
|
|
30
30
|
}
|
|
31
|
-
}), N =
|
|
32
|
-
|
|
31
|
+
}), N = i(!1), P = i(null), F = i(null), I = j.value?.start ?? _?.start ?? /* @__PURE__ */ new Date(), L = i(I.getUTCFullYear()), R = i(I.getUTCMonth()), z = s(null);
|
|
32
|
+
a(() => {
|
|
33
33
|
if (!N.value) return;
|
|
34
34
|
let e = (e) => {
|
|
35
35
|
z.current && !z.current.contains(e.target) && (N.value = !1);
|
|
@@ -102,49 +102,49 @@ function g({ value: g, defaultValue: _, onValueChange: te, min: v, max: y, disab
|
|
|
102
102
|
nextMonth: A
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
|
-
return /* @__PURE__ */
|
|
105
|
+
return /* @__PURE__ */ f("div", {
|
|
106
106
|
ref: z,
|
|
107
107
|
className: r(t.wrapper, ne),
|
|
108
108
|
"data-size": w,
|
|
109
109
|
onKeyDown: (e) => {
|
|
110
110
|
e.key === "Escape" && N.value && (e.stopPropagation(), V());
|
|
111
111
|
},
|
|
112
|
-
children: [/* @__PURE__ */
|
|
112
|
+
children: [/* @__PURE__ */ f("button", {
|
|
113
113
|
type: "button",
|
|
114
114
|
role: "combobox",
|
|
115
115
|
"aria-expanded": N.value,
|
|
116
116
|
"aria-haspopup": "dialog",
|
|
117
|
-
"aria-label": T?.label ??
|
|
117
|
+
"aria-label": T?.label ?? u(c.dateRangePicker.label),
|
|
118
118
|
className: t.trigger,
|
|
119
119
|
onClick: N.value ? V : B,
|
|
120
|
-
children: [/* @__PURE__ */
|
|
120
|
+
children: [/* @__PURE__ */ d("span", {
|
|
121
121
|
className: r(t.value, Z ? void 0 : t.placeholder),
|
|
122
122
|
children: Z || re
|
|
123
|
-
}), /* @__PURE__ */
|
|
123
|
+
}), /* @__PURE__ */ d("span", {
|
|
124
124
|
className: t.icon,
|
|
125
125
|
"aria-hidden": "true",
|
|
126
126
|
children: "📅"
|
|
127
127
|
})]
|
|
128
|
-
}), /* @__PURE__ */
|
|
128
|
+
}), /* @__PURE__ */ f("div", {
|
|
129
129
|
role: "dialog",
|
|
130
130
|
className: t.panel,
|
|
131
131
|
"data-state": N.value ? "open" : "closed",
|
|
132
132
|
children: [
|
|
133
|
-
x && x.length > 0 && /* @__PURE__ */
|
|
133
|
+
x && x.length > 0 && /* @__PURE__ */ d("div", {
|
|
134
134
|
className: t.presets,
|
|
135
|
-
children: x.map((e) => /* @__PURE__ */
|
|
135
|
+
children: x.map((e) => /* @__PURE__ */ d("button", {
|
|
136
136
|
type: "button",
|
|
137
137
|
className: t.preset,
|
|
138
138
|
onClick: () => W(e),
|
|
139
139
|
children: e.label
|
|
140
140
|
}, e.label))
|
|
141
141
|
}),
|
|
142
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ f("div", {
|
|
143
143
|
className: t.calendars,
|
|
144
144
|
children: [
|
|
145
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ d("div", {
|
|
146
146
|
className: t.calNav,
|
|
147
|
-
children: /* @__PURE__ */
|
|
147
|
+
children: /* @__PURE__ */ d("button", {
|
|
148
148
|
type: "button",
|
|
149
149
|
className: t.navButton,
|
|
150
150
|
"aria-label": k,
|
|
@@ -152,19 +152,19 @@ function g({ value: g, defaultValue: _, onValueChange: te, min: v, max: y, disab
|
|
|
152
152
|
children: "‹"
|
|
153
153
|
})
|
|
154
154
|
}),
|
|
155
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ d(e, {
|
|
156
156
|
month: R.value,
|
|
157
157
|
year: L.value,
|
|
158
158
|
...$
|
|
159
159
|
}),
|
|
160
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ d(e, {
|
|
161
161
|
month: Q.month,
|
|
162
162
|
year: Q.year,
|
|
163
163
|
...$
|
|
164
164
|
}),
|
|
165
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ d("div", {
|
|
166
166
|
className: t.calNav,
|
|
167
|
-
children: /* @__PURE__ */
|
|
167
|
+
children: /* @__PURE__ */ d("button", {
|
|
168
168
|
type: "button",
|
|
169
169
|
className: t.navButton,
|
|
170
170
|
"aria-label": A,
|
|
@@ -174,14 +174,14 @@ function g({ value: g, defaultValue: _, onValueChange: te, min: v, max: y, disab
|
|
|
174
174
|
})
|
|
175
175
|
]
|
|
176
176
|
}),
|
|
177
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ f("div", {
|
|
178
178
|
className: t.footer,
|
|
179
|
-
children: [/* @__PURE__ */
|
|
179
|
+
children: [/* @__PURE__ */ d("button", {
|
|
180
180
|
type: "button",
|
|
181
181
|
className: t.clearBtn,
|
|
182
182
|
onClick: G,
|
|
183
183
|
children: O
|
|
184
|
-
}), /* @__PURE__ */
|
|
184
|
+
}), /* @__PURE__ */ d("button", {
|
|
185
185
|
type: "button",
|
|
186
186
|
className: t.applyBtn,
|
|
187
187
|
onClick: V,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import e from "./drawer.module.js";
|
|
4
4
|
import { DismissableLayer as t, FocusScope as n, Portal as r, Presence as i, cn as a, useControllableSignal as o, useDraggable as s, useScrollLock as c, useSignals as l } from "@cascivo/core";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useId as u } from "react";
|
|
6
|
+
import { builtin as d, t as f } from "@cascivo/i18n";
|
|
7
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
8
8
|
//#region ../components/src/drawer/drawer.tsx
|
|
9
9
|
var h = 80;
|
|
10
10
|
function g({ open: g, defaultOpen: _, onOpenChange: v, side: y = "end", size: b, title: x, description: S, children: C, labels: w, className: T, swipeToDismiss: E = !1 }) {
|
|
@@ -22,25 +22,25 @@ function g({ open: g, defaultOpen: _, onOpenChange: v, side: y = "end", size: b,
|
|
|
22
22
|
let t = k === "y" ? e.y : e.x, n = y === "end" && t > h || y === "start" && t < -80 || y === "bottom" && t > h || y === "top" && t < -80;
|
|
23
23
|
N(), n && O(!1);
|
|
24
24
|
}
|
|
25
|
-
}), P =
|
|
25
|
+
}), P = u(), F = u(), I = w?.close ?? f(d.drawer.close), L = {
|
|
26
26
|
...b ? { "--_drawer-size": b } : {},
|
|
27
27
|
...E ? {
|
|
28
28
|
"--_drawer-drag-x": `${j.value.x}px`,
|
|
29
29
|
"--_drawer-drag-y": `${j.value.y}px`
|
|
30
30
|
} : {}
|
|
31
31
|
};
|
|
32
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ p(r, { children: /* @__PURE__ */ p(i, {
|
|
33
33
|
present: D,
|
|
34
|
-
children: /* @__PURE__ */
|
|
34
|
+
children: /* @__PURE__ */ p("div", {
|
|
35
35
|
className: e.overlay,
|
|
36
36
|
"data-side": y,
|
|
37
|
-
children: /* @__PURE__ */
|
|
37
|
+
children: /* @__PURE__ */ p(t, {
|
|
38
38
|
onDismiss: () => O(!1),
|
|
39
|
-
children: /* @__PURE__ */
|
|
39
|
+
children: /* @__PURE__ */ p(n, {
|
|
40
40
|
trapped: !0,
|
|
41
41
|
restoreFocus: !0,
|
|
42
42
|
autoFocus: !0,
|
|
43
|
-
children: /* @__PURE__ */
|
|
43
|
+
children: /* @__PURE__ */ m("div", {
|
|
44
44
|
role: "dialog",
|
|
45
45
|
"aria-modal": "true",
|
|
46
46
|
"aria-labelledby": x ? P : void 0,
|
|
@@ -49,30 +49,30 @@ function g({ open: g, defaultOpen: _, onOpenChange: v, side: y = "end", size: b,
|
|
|
49
49
|
"data-dragging": E && M.value ? "" : void 0,
|
|
50
50
|
className: a(e.panel, T),
|
|
51
51
|
style: L,
|
|
52
|
-
children: [(x || S) && /* @__PURE__ */
|
|
52
|
+
children: [(x || S) && /* @__PURE__ */ m("div", {
|
|
53
53
|
className: e.header,
|
|
54
54
|
ref: E ? A : void 0,
|
|
55
|
-
children: [/* @__PURE__ */
|
|
55
|
+
children: [/* @__PURE__ */ m("div", {
|
|
56
56
|
className: e.heading,
|
|
57
|
-
children: [x && /* @__PURE__ */
|
|
57
|
+
children: [x && /* @__PURE__ */ p("h2", {
|
|
58
58
|
id: P,
|
|
59
59
|
className: e.title,
|
|
60
60
|
children: x
|
|
61
|
-
}), S && /* @__PURE__ */
|
|
61
|
+
}), S && /* @__PURE__ */ p("p", {
|
|
62
62
|
id: F,
|
|
63
63
|
className: e.description,
|
|
64
64
|
children: S
|
|
65
65
|
})]
|
|
66
|
-
}), /* @__PURE__ */
|
|
66
|
+
}), /* @__PURE__ */ p("button", {
|
|
67
67
|
type: "button",
|
|
68
68
|
"aria-label": I,
|
|
69
69
|
onClick: () => O(!1),
|
|
70
70
|
className: e.close,
|
|
71
|
-
children: /* @__PURE__ */
|
|
71
|
+
children: /* @__PURE__ */ p("svg", {
|
|
72
72
|
"aria-hidden": "true",
|
|
73
73
|
viewBox: "0 0 16 16",
|
|
74
74
|
className: e.closeIcon,
|
|
75
|
-
children: /* @__PURE__ */
|
|
75
|
+
children: /* @__PURE__ */ p("path", {
|
|
76
76
|
d: "M4 4l8 8M12 4l-8 8",
|
|
77
77
|
fill: "none",
|
|
78
78
|
stroke: "currentColor",
|
|
@@ -81,8 +81,9 @@ function g({ open: g, defaultOpen: _, onOpenChange: v, side: y = "end", size: b,
|
|
|
81
81
|
})
|
|
82
82
|
})
|
|
83
83
|
})]
|
|
84
|
-
}), /* @__PURE__ */
|
|
84
|
+
}), /* @__PURE__ */ p("div", {
|
|
85
85
|
className: e.body,
|
|
86
|
+
"data-cascivo-drawer-body": "",
|
|
86
87
|
children: C
|
|
87
88
|
})]
|
|
88
89
|
})
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
var e = {
|
|
4
|
-
overlay: "
|
|
5
|
-
panel: "
|
|
6
|
-
header: "
|
|
7
|
-
heading: "
|
|
8
|
-
title: "
|
|
9
|
-
description: "
|
|
10
|
-
close: "
|
|
11
|
-
closeIcon: "
|
|
12
|
-
body: "
|
|
4
|
+
overlay: "_overlay_1q94b_2",
|
|
5
|
+
panel: "_panel_1q94b_39",
|
|
6
|
+
header: "_header_1q94b_124",
|
|
7
|
+
heading: "_heading_1q94b_134",
|
|
8
|
+
title: "_title_1q94b_140",
|
|
9
|
+
description: "_description_1q94b_147",
|
|
10
|
+
close: "_close_1q94b_153",
|
|
11
|
+
closeIcon: "_closeIcon_1q94b_181",
|
|
12
|
+
body: "_body_1q94b_186"
|
|
13
13
|
};
|
|
14
14
|
//#endregion
|
|
15
15
|
export { e as default };
|
|
@@ -1,100 +1,100 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import e from "./dropdown.module.js";
|
|
4
|
-
import { composeRefs as t, createMachine as n,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { composeRefs as t, createMachine as n, focusElement as r, useEffectPropSignal as i, useMachine as a, useSignal as o, useSignalEffect as s, useSignals as c } from "@cascivo/core";
|
|
5
|
+
import { cloneElement as l, useRef as u } from "react";
|
|
6
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
7
7
|
//#region ../components/src/dropdown/dropdown.tsx
|
|
8
|
-
var
|
|
8
|
+
var p = n({
|
|
9
9
|
initial: "closed",
|
|
10
10
|
states: {
|
|
11
11
|
closed: { on: { OPEN: "open" } },
|
|
12
12
|
open: { on: { CLOSE: "closed" } }
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
let [
|
|
15
|
+
function m({ trigger: n, items: m, onSelect: h, placement: g = "bottom-start", open: _, onOpenChange: v }) {
|
|
16
|
+
c();
|
|
17
|
+
let [y, b] = a(p), x = u(null), S = u(null), C = u(null), w = u([]), T = o(-1), E = _ !== void 0, D = E ? _ : y.value === "open", O = i(D), k = m.map((e, t) => ({
|
|
18
18
|
item: e,
|
|
19
19
|
index: t
|
|
20
|
-
})).filter(({ item: e }) => !e.separator && !e.disabled).map(({ index: e }) => e),
|
|
21
|
-
|
|
20
|
+
})).filter(({ item: e }) => !e.separator && !e.disabled).map(({ index: e }) => e), A = (e) => {
|
|
21
|
+
E || b(e ? "OPEN" : "CLOSE"), v?.(e);
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
let e =
|
|
25
|
-
|
|
26
|
-
}),
|
|
27
|
-
|
|
28
|
-
}),
|
|
29
|
-
|
|
30
|
-
}),
|
|
31
|
-
let e =
|
|
23
|
+
s(() => {
|
|
24
|
+
let e = T.value;
|
|
25
|
+
O.value && e >= 0 && w.current[e]?.focus();
|
|
26
|
+
}), s(() => {
|
|
27
|
+
O.value ? T.value = k[0] ?? -1 : T.value = -1;
|
|
28
|
+
}), s(() => {
|
|
29
|
+
O.value ? C.current?.showPopover() : C.current?.hidePopover();
|
|
30
|
+
}), s(() => {
|
|
31
|
+
let e = C.current;
|
|
32
32
|
if (!e) return;
|
|
33
33
|
let t = (e) => {
|
|
34
|
-
e.newState === "closed" &&
|
|
34
|
+
e.newState === "closed" && A(!1);
|
|
35
35
|
};
|
|
36
36
|
return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
|
|
37
37
|
});
|
|
38
|
-
let
|
|
39
|
-
let t =
|
|
40
|
-
!t || t.separator || t.disabled || (
|
|
41
|
-
}, j = (e) => {
|
|
42
|
-
O.length !== 0 && (w.value = O[(O.indexOf(w.value) + e + O.length) % O.length] ?? -1);
|
|
38
|
+
let j = (e) => {
|
|
39
|
+
let t = m[e];
|
|
40
|
+
!t || t.separator || t.disabled || (h?.(t.value), A(!1), r(S.current));
|
|
43
41
|
}, M = (e) => {
|
|
42
|
+
k.length !== 0 && (T.value = k[(k.indexOf(T.value) + e + k.length) % k.length] ?? -1);
|
|
43
|
+
}, N = (e) => {
|
|
44
44
|
switch (e.key) {
|
|
45
45
|
case "ArrowDown":
|
|
46
|
-
e.preventDefault(),
|
|
46
|
+
e.preventDefault(), M(1);
|
|
47
47
|
break;
|
|
48
48
|
case "ArrowUp":
|
|
49
|
-
e.preventDefault(),
|
|
49
|
+
e.preventDefault(), M(-1);
|
|
50
50
|
break;
|
|
51
51
|
case "Home":
|
|
52
|
-
e.preventDefault(),
|
|
52
|
+
e.preventDefault(), T.value = k[0] ?? -1;
|
|
53
53
|
break;
|
|
54
54
|
case "End":
|
|
55
|
-
e.preventDefault(),
|
|
55
|
+
e.preventDefault(), T.value = k[k.length - 1] ?? -1;
|
|
56
56
|
break;
|
|
57
57
|
case "Escape":
|
|
58
|
-
e.preventDefault(),
|
|
58
|
+
e.preventDefault(), A(!1), r(S.current);
|
|
59
59
|
break;
|
|
60
60
|
case "Enter":
|
|
61
61
|
case " ":
|
|
62
|
-
e.preventDefault(),
|
|
62
|
+
e.preventDefault(), j(T.value);
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
|
-
},
|
|
66
|
-
ref: t(
|
|
65
|
+
}, P = n, F = l(P, {
|
|
66
|
+
ref: t(S, P.props.ref),
|
|
67
67
|
onClick: (e) => {
|
|
68
|
-
|
|
68
|
+
P.props.onClick?.(e), A(!D);
|
|
69
69
|
},
|
|
70
70
|
"aria-haspopup": "menu",
|
|
71
|
-
"aria-expanded":
|
|
71
|
+
"aria-expanded": D
|
|
72
72
|
});
|
|
73
|
-
return /* @__PURE__ */
|
|
74
|
-
ref:
|
|
73
|
+
return /* @__PURE__ */ f("div", {
|
|
74
|
+
ref: x,
|
|
75
75
|
className: e.root,
|
|
76
|
-
children: [
|
|
77
|
-
ref:
|
|
76
|
+
children: [F, /* @__PURE__ */ d("div", {
|
|
77
|
+
ref: C,
|
|
78
78
|
popover: "auto",
|
|
79
79
|
role: "menu",
|
|
80
|
-
"data-placement":
|
|
81
|
-
"data-state":
|
|
80
|
+
"data-placement": g,
|
|
81
|
+
"data-state": D ? "open" : "closed",
|
|
82
82
|
className: e.menu,
|
|
83
|
-
onKeyDown:
|
|
84
|
-
children:
|
|
83
|
+
onKeyDown: N,
|
|
84
|
+
children: m.map((t, n) => t.separator ? /* @__PURE__ */ d("div", {
|
|
85
85
|
role: "separator",
|
|
86
86
|
className: e.separator
|
|
87
|
-
}, `sep-${n}`) : /* @__PURE__ */
|
|
87
|
+
}, `sep-${n}`) : /* @__PURE__ */ f("button", {
|
|
88
88
|
type: "button",
|
|
89
89
|
role: "menuitem",
|
|
90
90
|
ref: (e) => {
|
|
91
|
-
|
|
91
|
+
w.current[n] = e;
|
|
92
92
|
},
|
|
93
|
-
tabIndex:
|
|
93
|
+
tabIndex: T.value === n ? 0 : -1,
|
|
94
94
|
disabled: t.disabled,
|
|
95
95
|
className: e.item,
|
|
96
|
-
onClick: () =>
|
|
97
|
-
children: [t.icon && /* @__PURE__ */
|
|
96
|
+
onClick: () => j(n),
|
|
97
|
+
children: [t.icon && /* @__PURE__ */ d("span", {
|
|
98
98
|
className: e.icon,
|
|
99
99
|
"aria-hidden": "true",
|
|
100
100
|
children: t.icon
|
|
@@ -104,4 +104,4 @@ function p({ trigger: n, items: p, onSelect: m, placement: h = "bottom-start", o
|
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
//#endregion
|
|
107
|
-
export {
|
|
107
|
+
export { m as Dropdown };
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import e from "./editable.module.js";
|
|
4
4
|
import { cn as t, useSignal as n, useSignalEffect as r, useSignals as i } from "@cascivo/core";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useRef as a } from "react";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
7
|
//#region ../components/src/editable/editable.tsx
|
|
8
8
|
function c({ value: c, onValueChange: l, placeholder: u, disabled: d = !1, submitOnBlur: f = !0, onCancel: p, className: m, ...h }) {
|
|
9
9
|
i();
|
|
10
|
-
let g = n(!1), _ = n(c), v =
|
|
10
|
+
let g = n(!1), _ = n(c), v = a(null), y = a(p);
|
|
11
11
|
y.current = p;
|
|
12
|
-
let b =
|
|
12
|
+
let b = a(l);
|
|
13
13
|
b.current = l, g.value || (_.value = c), r(() => {
|
|
14
14
|
if (g.value) {
|
|
15
15
|
let e = v.current;
|
|
@@ -22,10 +22,10 @@ function c({ value: c, onValueChange: l, placeholder: u, disabled: d = !1, submi
|
|
|
22
22
|
function S() {
|
|
23
23
|
_.value = c, g.value = !1, y.current?.();
|
|
24
24
|
}
|
|
25
|
-
return g.value ? /* @__PURE__ */
|
|
25
|
+
return g.value ? /* @__PURE__ */ o("div", {
|
|
26
26
|
className: t(e.wrapper, e.editing, m),
|
|
27
27
|
...h,
|
|
28
|
-
children: /* @__PURE__ */
|
|
28
|
+
children: /* @__PURE__ */ o("input", {
|
|
29
29
|
ref: v,
|
|
30
30
|
className: e.input,
|
|
31
31
|
value: _.value,
|
|
@@ -39,24 +39,24 @@ function c({ value: c, onValueChange: l, placeholder: u, disabled: d = !1, submi
|
|
|
39
39
|
f ? x() : S();
|
|
40
40
|
}
|
|
41
41
|
})
|
|
42
|
-
}) : /* @__PURE__ */
|
|
42
|
+
}) : /* @__PURE__ */ o("div", {
|
|
43
43
|
className: t(e.wrapper, m),
|
|
44
44
|
"data-disabled": d ? "" : void 0,
|
|
45
45
|
...h,
|
|
46
|
-
children: /* @__PURE__ */
|
|
46
|
+
children: /* @__PURE__ */ s("button", {
|
|
47
47
|
type: "button",
|
|
48
48
|
className: e.preview,
|
|
49
49
|
disabled: d,
|
|
50
50
|
onClick: () => {
|
|
51
51
|
d || (g.value = !0);
|
|
52
52
|
},
|
|
53
|
-
children: [/* @__PURE__ */
|
|
53
|
+
children: [/* @__PURE__ */ o("span", {
|
|
54
54
|
className: e["preview-text"],
|
|
55
|
-
children: c || /* @__PURE__ */
|
|
55
|
+
children: c || /* @__PURE__ */ o("span", {
|
|
56
56
|
className: e.placeholder,
|
|
57
57
|
children: u
|
|
58
58
|
})
|
|
59
|
-
}), /* @__PURE__ */
|
|
59
|
+
}), /* @__PURE__ */ o("span", {
|
|
60
60
|
className: e["edit-icon"],
|
|
61
61
|
"aria-hidden": "true"
|
|
62
62
|
})]
|