@dimasbaguspm/versaur 0.0.18 → 0.0.19
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/js/forms/index.js +11 -9
- package/dist/js/{description-list-DZQF212Z.js → image-rectangle-CLU-GVtw.js} +263 -76
- package/dist/js/index.js +53 -47
- package/dist/js/primitive/index.js +15 -11
- package/dist/js/{email-input-BIbrfs5q.js → selectable-multiple-input-CJXfqy1Z.js} +573 -403
- package/dist/types/forms/index.d.ts +2 -0
- package/dist/types/forms/selectable-multiple-input/index.d.ts +2 -0
- package/dist/types/forms/selectable-multiple-input/selectable-multiple-input.d.ts +6 -0
- package/dist/types/forms/selectable-multiple-input/types.d.ts +18 -0
- package/dist/types/forms/selectable-single-input/index.d.ts +2 -0
- package/dist/types/forms/selectable-single-input/selectable-single-input.d.ts +6 -0
- package/dist/types/forms/selectable-single-input/types.d.ts +18 -0
- package/dist/types/primitive/image/base-image.atoms.d.ts +6 -0
- package/dist/types/primitive/image/base-image.d.ts +6 -0
- package/dist/types/primitive/image/image-circle.d.ts +6 -0
- package/dist/types/primitive/image/image-rectangle.d.ts +6 -0
- package/dist/types/primitive/image/image-square.d.ts +6 -0
- package/dist/types/primitive/image/index.d.ts +5 -0
- package/dist/types/primitive/image/types.d.ts +48 -0
- package/dist/types/primitive/image/use-image.d.ts +13 -0
- package/dist/types/primitive/index.d.ts +1 -0
- package/dist/utils/enforce-subpath-import.js +6 -0
- package/package.json +1 -1
package/dist/js/forms/index.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { C as a, b as n, a as p, D as u, E as
|
|
1
|
+
import { C as a, b as n, a as p, D as u, E as i, P as s, R as I, d as l, c as S, S as c, e as g, j as r, i as h, h as m, f as b, T as o, g as x } from "../selectable-multiple-input-CJXfqy1Z.js";
|
|
2
2
|
export {
|
|
3
3
|
a as CheckboxInput,
|
|
4
4
|
n as ChipMultipleInput,
|
|
5
5
|
p as ChipSingleInput,
|
|
6
6
|
u as DateSinglePickerInput,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
i as EmailInput,
|
|
8
|
+
s as PriceInput,
|
|
9
|
+
I as RadioInput,
|
|
10
10
|
l as SearchInput,
|
|
11
11
|
S as SegmentMultipleInput,
|
|
12
12
|
c as SegmentSingleInput,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
h as
|
|
16
|
-
m as
|
|
17
|
-
|
|
13
|
+
g as SelectInput,
|
|
14
|
+
r as SelectableMultipleInput,
|
|
15
|
+
h as SelectableSingleInput,
|
|
16
|
+
m as SwitchInput,
|
|
17
|
+
b as TextAreaInput,
|
|
18
|
+
o as TextInput,
|
|
19
|
+
x as TimePickerInput
|
|
18
20
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { c as cva, j as jsxRuntimeExports, a as cn } from "./index-DOdDlCoL.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import React__default, { forwardRef, useState, useEffect, useCallback, useRef, createContext, useContext, useMemo } from "react";
|
|
4
|
-
import { X, ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
|
+
import { X, ChevronLeft, ChevronRight, ImageOff } from "lucide-react";
|
|
5
|
+
import { S as Skeleton } from "./skeleton-BNZyaRjo.js";
|
|
5
6
|
const iconVariants = cva("inline-flex items-center justify-center", {
|
|
6
7
|
variants: {
|
|
7
8
|
size: {
|
|
@@ -337,8 +338,8 @@ const iconVariants = cva("inline-flex items-center justify-center", {
|
|
|
337
338
|
a(!1);
|
|
338
339
|
}, [e]);
|
|
339
340
|
const u = useCallback(
|
|
340
|
-
(
|
|
341
|
-
a(!0), s?.(
|
|
341
|
+
(l) => {
|
|
342
|
+
a(!0), s?.(l);
|
|
342
343
|
},
|
|
343
344
|
[s]
|
|
344
345
|
);
|
|
@@ -523,12 +524,12 @@ const iconVariants = cva("inline-flex items-center justify-center", {
|
|
|
523
524
|
className: i,
|
|
524
525
|
children: a,
|
|
525
526
|
...u
|
|
526
|
-
},
|
|
527
|
+
}, l) => {
|
|
527
528
|
const f = !(a != null && a !== "") && !!(n || o);
|
|
528
529
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
529
530
|
"span",
|
|
530
531
|
{
|
|
531
|
-
ref:
|
|
532
|
+
ref: l,
|
|
532
533
|
className: cn(
|
|
533
534
|
badgeVariants({
|
|
534
535
|
variant: e,
|
|
@@ -738,32 +739,32 @@ const SvgSpenicleSquare = (e) => /* @__PURE__ */ React.createElement("svg", { wi
|
|
|
738
739
|
);
|
|
739
740
|
function useFloatingPosition(e, t = "1rem") {
|
|
740
741
|
const r = useRef(null), [s, n] = useState({}), [o, i] = useState("fixed bottom-4 right-4"), a = useCallback(() => {
|
|
741
|
-
const
|
|
742
|
-
if (!
|
|
743
|
-
const
|
|
744
|
-
let f = {},
|
|
745
|
-
|
|
742
|
+
const l = r.current;
|
|
743
|
+
if (!l) return;
|
|
744
|
+
const h = l.getBoundingClientRect().height > window.innerHeight;
|
|
745
|
+
let f = {}, p = "";
|
|
746
|
+
h ? (f = {
|
|
746
747
|
position: "fixed",
|
|
747
748
|
bottom: t,
|
|
748
749
|
zIndex: 50,
|
|
749
|
-
transform: `translateY(${
|
|
750
|
-
},
|
|
750
|
+
transform: `translateY(${l.scrollTop}px)`
|
|
751
|
+
}, p = `fixed bottom-4 ${e}-4`) : (f = {
|
|
751
752
|
position: "fixed",
|
|
752
753
|
bottom: t,
|
|
753
754
|
zIndex: 50
|
|
754
|
-
},
|
|
755
|
+
}, p = `fixed bottom-4 ${e}-4`), n(f), i(p);
|
|
755
756
|
}, [e, t]);
|
|
756
757
|
return useEffect(() => {
|
|
757
758
|
a();
|
|
758
|
-
const
|
|
759
|
-
return
|
|
760
|
-
|
|
759
|
+
const l = r.current;
|
|
760
|
+
return l && l.addEventListener("scroll", a), window.addEventListener("resize", a), () => {
|
|
761
|
+
l && l.removeEventListener("scroll", a), window.removeEventListener("resize", a);
|
|
761
762
|
};
|
|
762
763
|
}, [a]), useEffect(() => {
|
|
763
764
|
r.current && a();
|
|
764
765
|
}, [e, t, a]), [useCallback(
|
|
765
|
-
(
|
|
766
|
-
r.current =
|
|
766
|
+
(l) => {
|
|
767
|
+
r.current = l, l && a();
|
|
767
768
|
},
|
|
768
769
|
[a]
|
|
769
770
|
), s, o];
|
|
@@ -777,10 +778,10 @@ const ButtonFloat = forwardRef(
|
|
|
777
778
|
offset: o = "1rem",
|
|
778
779
|
...i
|
|
779
780
|
}, a) {
|
|
780
|
-
const [u,
|
|
781
|
+
const [u, l, x] = useFloatingPosition(
|
|
781
782
|
n,
|
|
782
783
|
o
|
|
783
|
-
), [
|
|
784
|
+
), [h, f] = useState(!1);
|
|
784
785
|
return useEffect(() => {
|
|
785
786
|
f(!0);
|
|
786
787
|
}, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: u, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -791,10 +792,10 @@ const ButtonFloat = forwardRef(
|
|
|
791
792
|
className: cn(
|
|
792
793
|
buttonFloatVariants({ variant: r, size: s }),
|
|
793
794
|
x,
|
|
794
|
-
|
|
795
|
+
h && "animate-fab-in",
|
|
795
796
|
t
|
|
796
797
|
),
|
|
797
|
-
style:
|
|
798
|
+
style: l,
|
|
798
799
|
...i
|
|
799
800
|
}
|
|
800
801
|
) });
|
|
@@ -903,11 +904,11 @@ const buttonIconVariants = cva(
|
|
|
903
904
|
as: i,
|
|
904
905
|
"aria-label": a,
|
|
905
906
|
...u
|
|
906
|
-
},
|
|
907
|
+
}, l) {
|
|
907
908
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
908
909
|
"button",
|
|
909
910
|
{
|
|
910
|
-
ref:
|
|
911
|
+
ref: l,
|
|
911
912
|
type: "button",
|
|
912
913
|
className: cn(
|
|
913
914
|
buttonIconVariants({
|
|
@@ -1051,7 +1052,7 @@ const BUTTONS = [
|
|
|
1051
1052
|
className: s,
|
|
1052
1053
|
"aria-label": n
|
|
1053
1054
|
}, o) => {
|
|
1054
|
-
const { input: i, inputRef: a, handleButton: u, handleInput:
|
|
1055
|
+
const { input: i, inputRef: a, handleButton: u, handleInput: l } = useCalculator({
|
|
1055
1056
|
initialValue: e,
|
|
1056
1057
|
disabled: r,
|
|
1057
1058
|
onChange: t
|
|
@@ -1070,13 +1071,13 @@ const BUTTONS = [
|
|
|
1070
1071
|
ref: a,
|
|
1071
1072
|
className: "w-full mb-3 px-3 py-2 rounded border border-[var(--color-neutral)] bg-[var(--color-neutral-soft)] text-right text-xl font-mono focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]",
|
|
1072
1073
|
value: i,
|
|
1073
|
-
onChange:
|
|
1074
|
+
onChange: l,
|
|
1074
1075
|
disabled: r,
|
|
1075
1076
|
inputMode: "decimal",
|
|
1076
1077
|
"aria-label": "Calculator input"
|
|
1077
1078
|
}
|
|
1078
1079
|
),
|
|
1079
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 mb-3", children: BUTTONS.map((x,
|
|
1080
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 mb-3", children: BUTTONS.map((x, h) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full", children: x.map((f) => f === "⌫" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1080
1081
|
ButtonIcon,
|
|
1081
1082
|
{
|
|
1082
1083
|
as: X,
|
|
@@ -1097,7 +1098,7 @@ const BUTTONS = [
|
|
|
1097
1098
|
children: f
|
|
1098
1099
|
},
|
|
1099
1100
|
f
|
|
1100
|
-
)) },
|
|
1101
|
+
)) }, h)) })
|
|
1101
1102
|
]
|
|
1102
1103
|
}
|
|
1103
1104
|
);
|
|
@@ -1184,11 +1185,11 @@ const textVariants = cva("", {
|
|
|
1184
1185
|
clamp: i = "none",
|
|
1185
1186
|
ellipsis: a = !1,
|
|
1186
1187
|
fontSize: u,
|
|
1187
|
-
fontWeight:
|
|
1188
|
+
fontWeight: l,
|
|
1188
1189
|
className: x,
|
|
1189
|
-
children:
|
|
1190
|
+
children: h,
|
|
1190
1191
|
...f
|
|
1191
|
-
},
|
|
1192
|
+
}, p) => {
|
|
1192
1193
|
const d = [
|
|
1193
1194
|
"h1",
|
|
1194
1195
|
"h2",
|
|
@@ -1199,11 +1200,11 @@ const textVariants = cva("", {
|
|
|
1199
1200
|
"p",
|
|
1200
1201
|
"span",
|
|
1201
1202
|
"label"
|
|
1202
|
-
].includes(e) ? e : "span", v = u ? `text-${u}` : "",
|
|
1203
|
+
].includes(e) ? e : "span", v = u ? `text-${u}` : "", w = l ? `font-${l}` : "";
|
|
1203
1204
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1204
1205
|
e,
|
|
1205
1206
|
{
|
|
1206
|
-
ref:
|
|
1207
|
+
ref: p,
|
|
1207
1208
|
className: cn(
|
|
1208
1209
|
textVariants({
|
|
1209
1210
|
color: t,
|
|
@@ -1217,11 +1218,11 @@ const textVariants = cva("", {
|
|
|
1217
1218
|
as: d
|
|
1218
1219
|
}),
|
|
1219
1220
|
v,
|
|
1220
|
-
|
|
1221
|
+
w,
|
|
1221
1222
|
x
|
|
1222
1223
|
),
|
|
1223
1224
|
...f,
|
|
1224
|
-
children:
|
|
1225
|
+
children: h
|
|
1225
1226
|
}
|
|
1226
1227
|
);
|
|
1227
1228
|
}
|
|
@@ -1268,9 +1269,9 @@ const CalendarHeader = () => {
|
|
|
1268
1269
|
] })
|
|
1269
1270
|
] });
|
|
1270
1271
|
}, CalendarWeekdays = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-7 px-4 text-ghost-500 mb-3", children: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((e) => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { fontSize: "xs", color: "ghost", align: "center", children: e }, e)) }), CalendarDaysSingle = () => {
|
|
1271
|
-
const e = useCalendarContext(), { year: t, month: r, value: s, onChange: n, setMonth: o, setYear: i } = e, a = (g, m) => new Date(g, m + 1, 0).getDate(),
|
|
1272
|
-
for (let g = 0; g <
|
|
1273
|
-
const m =
|
|
1272
|
+
const e = useCalendarContext(), { year: t, month: r, value: s, onChange: n, setMonth: o, setYear: i } = e, a = (g, m) => new Date(g, m + 1, 0).getDate(), l = ((g, m) => new Date(g, m, 1).getDay())(t, r), x = a(t, r), h = r - 1 < 0 ? 11 : r - 1, f = r === 0 ? t - 1 : t, p = a(t, h), y = r === 11 ? 0 : r + 1, d = r === 11 ? t + 1 : t, v = [];
|
|
1273
|
+
for (let g = 0; g < l; g++) {
|
|
1274
|
+
const m = p - l + g + 1;
|
|
1274
1275
|
v.push(
|
|
1275
1276
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1276
1277
|
ButtonIcon,
|
|
@@ -1280,7 +1281,7 @@ const CalendarHeader = () => {
|
|
|
1280
1281
|
"aria-label": "Previous month day",
|
|
1281
1282
|
variant: "ghost",
|
|
1282
1283
|
onClick: () => {
|
|
1283
|
-
n?.(new Date(f,
|
|
1284
|
+
n?.(new Date(f, h, m)), o(h), i(f);
|
|
1284
1285
|
}
|
|
1285
1286
|
},
|
|
1286
1287
|
"prev-" + g
|
|
@@ -1315,8 +1316,8 @@ const CalendarHeader = () => {
|
|
|
1315
1316
|
)
|
|
1316
1317
|
);
|
|
1317
1318
|
}
|
|
1318
|
-
const
|
|
1319
|
-
for (let g = 0; g < (
|
|
1319
|
+
const w = l + x;
|
|
1320
|
+
for (let g = 0; g < (w % 7 === 0 ? 0 : 7 - w % 7); g++)
|
|
1320
1321
|
v.push(
|
|
1321
1322
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1322
1323
|
ButtonIcon,
|
|
@@ -1334,35 +1335,35 @@ const CalendarHeader = () => {
|
|
|
1334
1335
|
);
|
|
1335
1336
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-7 gap-2 px-4 pb-4", children: v });
|
|
1336
1337
|
}, CalendarDaysRange = () => {
|
|
1337
|
-
const { year: e, month: t, value: r, onChange: s, setMonth: n, setYear: o } = useCalendarContext(), i = (
|
|
1338
|
+
const { year: e, month: t, value: r, onChange: s, setMonth: n, setYear: o } = useCalendarContext(), i = (c, b) => new Date(c, b + 1, 0).getDate(), u = ((c, b) => new Date(c, b, 1).getDay())(e, t), l = i(e, t), x = t - 1 < 0 ? 11 : t - 1, h = t === 0 ? e - 1 : e, f = i(e, x), p = t === 11 ? 0 : t + 1, y = t === 11 ? e + 1 : e, d = [], v = () => {
|
|
1338
1339
|
if (!Array.isArray(r)) return [null, null];
|
|
1339
|
-
const [
|
|
1340
|
-
return !
|
|
1341
|
-
}, [
|
|
1342
|
-
if (!
|
|
1343
|
-
const
|
|
1344
|
-
return
|
|
1345
|
-
},
|
|
1346
|
-
for (let
|
|
1347
|
-
const
|
|
1340
|
+
const [c, b] = r;
|
|
1341
|
+
return !c && !b ? [null, null] : c && b ? c <= b ? [c, b] : [b, c] : [c, b];
|
|
1342
|
+
}, [w, g] = v(), m = (c) => {
|
|
1343
|
+
if (!w || !g) return !1;
|
|
1344
|
+
const b = new Date(e, t, c);
|
|
1345
|
+
return b >= w && b <= g;
|
|
1346
|
+
}, I = (c) => w ? w.getFullYear() === e && w.getMonth() === t && w.getDate() === c : !1, N = (c) => g ? g.getFullYear() === e && g.getMonth() === t && g.getDate() === c : !1;
|
|
1347
|
+
for (let c = 0; c < u; c++) {
|
|
1348
|
+
const b = f - u + c + 1;
|
|
1348
1349
|
d.push(
|
|
1349
1350
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1350
1351
|
ButtonIcon,
|
|
1351
1352
|
{
|
|
1352
|
-
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children:
|
|
1353
|
+
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children: b }),
|
|
1353
1354
|
size: "sm",
|
|
1354
1355
|
"aria-label": "Previous month day",
|
|
1355
1356
|
variant: "ghost",
|
|
1356
1357
|
onClick: () => {
|
|
1357
|
-
s?.([null, null]), n(x), o(
|
|
1358
|
+
s?.([null, null]), n(x), o(h);
|
|
1358
1359
|
}
|
|
1359
1360
|
},
|
|
1360
|
-
"prev-" +
|
|
1361
|
+
"prev-" + c
|
|
1361
1362
|
)
|
|
1362
1363
|
);
|
|
1363
1364
|
}
|
|
1364
|
-
for (let
|
|
1365
|
-
const
|
|
1365
|
+
for (let c = 1; c <= l; c++) {
|
|
1366
|
+
const b = m(c), C = I(c), E = N(c);
|
|
1366
1367
|
d.push(
|
|
1367
1368
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1368
1369
|
ButtonIcon,
|
|
@@ -1372,47 +1373,47 @@ const CalendarHeader = () => {
|
|
|
1372
1373
|
{
|
|
1373
1374
|
as: "span",
|
|
1374
1375
|
fontSize: "sm",
|
|
1375
|
-
color:
|
|
1376
|
+
color: b || C || E ? "inherit" : "ghost",
|
|
1376
1377
|
className: cn(
|
|
1377
|
-
|
|
1378
|
+
b && " bg-primary text-white",
|
|
1378
1379
|
C && "rounded-l-full bg-primary text-white",
|
|
1379
1380
|
E && "rounded-r-full bg-primary text-white"
|
|
1380
1381
|
),
|
|
1381
|
-
children:
|
|
1382
|
+
children: c
|
|
1382
1383
|
}
|
|
1383
1384
|
),
|
|
1384
|
-
variant: C || E ||
|
|
1385
|
+
variant: C || E || b ? "primary" : "ghost",
|
|
1385
1386
|
size: "sm",
|
|
1386
|
-
"aria-label": `Select ${e}-${t + 1}-${
|
|
1387
|
+
"aria-label": `Select ${e}-${t + 1}-${c}`,
|
|
1387
1388
|
"aria-current": C || E ? "date" : void 0,
|
|
1388
1389
|
onClick: () => {
|
|
1389
1390
|
if (!Array.isArray(r) || !r[0] || r[0] && r[1])
|
|
1390
|
-
s?.([new Date(e, t,
|
|
1391
|
+
s?.([new Date(e, t, c), null]);
|
|
1391
1392
|
else if (r[0] && !r[1]) {
|
|
1392
|
-
const j = r[0], R = new Date(e, t,
|
|
1393
|
+
const j = r[0], R = new Date(e, t, c);
|
|
1393
1394
|
j.getTime() === R.getTime() ? s?.([j, R]) : s?.(j < R ? [j, R] : [R, j]);
|
|
1394
1395
|
}
|
|
1395
1396
|
}
|
|
1396
1397
|
},
|
|
1397
|
-
|
|
1398
|
+
c
|
|
1398
1399
|
)
|
|
1399
1400
|
);
|
|
1400
1401
|
}
|
|
1401
|
-
const S = u +
|
|
1402
|
-
for (let
|
|
1402
|
+
const S = u + l;
|
|
1403
|
+
for (let c = 0; c < (S % 7 === 0 ? 0 : 7 - S % 7); c++)
|
|
1403
1404
|
d.push(
|
|
1404
1405
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1405
1406
|
ButtonIcon,
|
|
1406
1407
|
{
|
|
1407
|
-
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children:
|
|
1408
|
+
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children: c + 1 }),
|
|
1408
1409
|
size: "sm",
|
|
1409
1410
|
"aria-label": "Next month day",
|
|
1410
1411
|
variant: "ghost",
|
|
1411
1412
|
onClick: () => {
|
|
1412
|
-
s?.([null, null]), n(
|
|
1413
|
+
s?.([null, null]), n(p), o(y);
|
|
1413
1414
|
}
|
|
1414
1415
|
},
|
|
1415
|
-
"next-" +
|
|
1416
|
+
"next-" + c
|
|
1416
1417
|
)
|
|
1417
1418
|
);
|
|
1418
1419
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-7 gap-2 px-4 pb-4", children: d });
|
|
@@ -1427,16 +1428,16 @@ function useCalendar({
|
|
|
1427
1428
|
initialYear: s,
|
|
1428
1429
|
initialMonth: n
|
|
1429
1430
|
}) {
|
|
1430
|
-
const [o, i] = useState(n), [a, u] = useState(s), [
|
|
1431
|
+
const [o, i] = useState(n), [a, u] = useState(s), [l, x] = useState([
|
|
1431
1432
|
null,
|
|
1432
1433
|
null
|
|
1433
1434
|
]);
|
|
1434
|
-
let
|
|
1435
|
-
t === "range" && !e && (
|
|
1435
|
+
let h = e;
|
|
1436
|
+
t === "range" && !e && (h = l);
|
|
1436
1437
|
const f = useCallback(() => {
|
|
1437
1438
|
const d = o === 0 ? 11 : o - 1, v = o === 0 ? a - 1 : a;
|
|
1438
1439
|
i(d), u(v), t === "single" && r?.(new Date(v, d, 1));
|
|
1439
|
-
}, [o, a, t, r]),
|
|
1440
|
+
}, [o, a, t, r]), p = useCallback(() => {
|
|
1440
1441
|
const d = o === 11 ? 0 : o + 1, v = o === 11 ? a + 1 : a;
|
|
1441
1442
|
i(d), u(v), t === "single" && r?.(new Date(v, d, 1));
|
|
1442
1443
|
}, [o, a, t, r]), y = useCallback(
|
|
@@ -1448,12 +1449,12 @@ function useCalendar({
|
|
|
1448
1449
|
return {
|
|
1449
1450
|
year: a,
|
|
1450
1451
|
month: o,
|
|
1451
|
-
value:
|
|
1452
|
+
value: h,
|
|
1452
1453
|
setMonth: i,
|
|
1453
1454
|
setYear: u,
|
|
1454
1455
|
onChange: y,
|
|
1455
1456
|
handlePrevMonth: f,
|
|
1456
|
-
handleNextMonth:
|
|
1457
|
+
handleNextMonth: p
|
|
1457
1458
|
};
|
|
1458
1459
|
}
|
|
1459
1460
|
const CalendarRoot = ({
|
|
@@ -1767,6 +1768,188 @@ const DescriptionListItem = forwardRef(function e({ children: t, className: r, s
|
|
|
1767
1768
|
Term: DescriptionListTerm,
|
|
1768
1769
|
Details: DescriptionListDetails
|
|
1769
1770
|
});
|
|
1771
|
+
function useImage({ src: e }) {
|
|
1772
|
+
const [t, r] = useState(!1), [s, n] = useState(!1), o = useRef(!1), i = () => {
|
|
1773
|
+
r(!0);
|
|
1774
|
+
}, a = () => {
|
|
1775
|
+
n(!0);
|
|
1776
|
+
};
|
|
1777
|
+
return useEffect(() => {
|
|
1778
|
+
if (!e) return;
|
|
1779
|
+
const u = new Image();
|
|
1780
|
+
return u.src = e, u.onload = () => {
|
|
1781
|
+
o.current || r(!0);
|
|
1782
|
+
}, u.onerror = () => {
|
|
1783
|
+
o.current || n(!0);
|
|
1784
|
+
}, () => {
|
|
1785
|
+
o.current = !0;
|
|
1786
|
+
};
|
|
1787
|
+
}, [e]), {
|
|
1788
|
+
loaded: t,
|
|
1789
|
+
errored: s,
|
|
1790
|
+
handleLoad: i,
|
|
1791
|
+
handleError: a
|
|
1792
|
+
};
|
|
1793
|
+
}
|
|
1794
|
+
const imageVariants = cva("block object-cover", {
|
|
1795
|
+
variants: {
|
|
1796
|
+
position: {
|
|
1797
|
+
cover: "object-cover",
|
|
1798
|
+
contain: "object-contain",
|
|
1799
|
+
center: "object-center",
|
|
1800
|
+
top: "object-top",
|
|
1801
|
+
bottom: "object-bottom",
|
|
1802
|
+
left: "object-left",
|
|
1803
|
+
right: "object-right",
|
|
1804
|
+
none: ""
|
|
1805
|
+
},
|
|
1806
|
+
size: {
|
|
1807
|
+
sm: "w-16 h-16",
|
|
1808
|
+
md: "w-32 h-32",
|
|
1809
|
+
lg: "w-48 h-48",
|
|
1810
|
+
full: "w-full h-full",
|
|
1811
|
+
auto: ""
|
|
1812
|
+
},
|
|
1813
|
+
shape: {
|
|
1814
|
+
rectangle: "rounded",
|
|
1815
|
+
square: "aspect-square rounded",
|
|
1816
|
+
circle: "rounded-full aspect-square"
|
|
1817
|
+
}
|
|
1818
|
+
},
|
|
1819
|
+
defaultVariants: {
|
|
1820
|
+
position: "cover",
|
|
1821
|
+
size: "auto",
|
|
1822
|
+
shape: "rectangle"
|
|
1823
|
+
}
|
|
1824
|
+
}), imageAtomVariants = cva(
|
|
1825
|
+
"flex items-center justify-center bg-neutral-soft text-ghost border border-border",
|
|
1826
|
+
{
|
|
1827
|
+
variants: {
|
|
1828
|
+
shape: {
|
|
1829
|
+
rectangle: "rounded",
|
|
1830
|
+
square: "aspect-square rounded",
|
|
1831
|
+
circle: "rounded-full aspect-square"
|
|
1832
|
+
},
|
|
1833
|
+
size: {
|
|
1834
|
+
sm: "w-16 h-16",
|
|
1835
|
+
md: "w-32 h-32",
|
|
1836
|
+
lg: "w-48 h-48",
|
|
1837
|
+
full: "w-full h-full",
|
|
1838
|
+
auto: "w-full h-full"
|
|
1839
|
+
}
|
|
1840
|
+
},
|
|
1841
|
+
defaultVariants: {
|
|
1842
|
+
shape: "rectangle",
|
|
1843
|
+
size: "auto"
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
);
|
|
1847
|
+
function BaseImageSkeleton({
|
|
1848
|
+
className: e,
|
|
1849
|
+
shape: t,
|
|
1850
|
+
size: r,
|
|
1851
|
+
height: s,
|
|
1852
|
+
width: n
|
|
1853
|
+
}) {
|
|
1854
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1855
|
+
Skeleton,
|
|
1856
|
+
{
|
|
1857
|
+
className: cn(imageAtomVariants({ shape: t, size: r }), e),
|
|
1858
|
+
style: { height: s, width: n }
|
|
1859
|
+
}
|
|
1860
|
+
);
|
|
1861
|
+
}
|
|
1862
|
+
function BaseImageFallback({
|
|
1863
|
+
alt: e,
|
|
1864
|
+
width: t,
|
|
1865
|
+
height: r,
|
|
1866
|
+
className: s,
|
|
1867
|
+
style: n,
|
|
1868
|
+
shape: o,
|
|
1869
|
+
size: i
|
|
1870
|
+
}) {
|
|
1871
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1872
|
+
"div",
|
|
1873
|
+
{
|
|
1874
|
+
className: imageAtomVariants({ shape: o, size: i, className: s }),
|
|
1875
|
+
style: { width: t, height: r, ...n },
|
|
1876
|
+
"aria-label": e,
|
|
1877
|
+
role: "img",
|
|
1878
|
+
children: [
|
|
1879
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1880
|
+
ImageOff,
|
|
1881
|
+
{
|
|
1882
|
+
size: 32,
|
|
1883
|
+
style: { opacity: 0.5, marginRight: 4 },
|
|
1884
|
+
"aria-hidden": "true"
|
|
1885
|
+
}
|
|
1886
|
+
),
|
|
1887
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { opacity: 0.7 }, children: e })
|
|
1888
|
+
]
|
|
1889
|
+
}
|
|
1890
|
+
);
|
|
1891
|
+
}
|
|
1892
|
+
const BaseImage = forwardRef(
|
|
1893
|
+
({
|
|
1894
|
+
src: e,
|
|
1895
|
+
alt: t,
|
|
1896
|
+
onLoad: r,
|
|
1897
|
+
onError: s,
|
|
1898
|
+
width: n,
|
|
1899
|
+
height: o,
|
|
1900
|
+
loading: i = "lazy",
|
|
1901
|
+
position: a = "cover",
|
|
1902
|
+
size: u = "auto",
|
|
1903
|
+
shape: l,
|
|
1904
|
+
className: x,
|
|
1905
|
+
...h
|
|
1906
|
+
}, f) => {
|
|
1907
|
+
const { loaded: p, errored: y, handleLoad: d, handleError: v } = useImage({
|
|
1908
|
+
src: e
|
|
1909
|
+
}), w = typeof n == "number" ? n : Number(n), g = typeof o == "number" ? o : Number(o);
|
|
1910
|
+
return !p && !y ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1911
|
+
BaseImageSkeleton,
|
|
1912
|
+
{
|
|
1913
|
+
shape: l,
|
|
1914
|
+
width: w,
|
|
1915
|
+
height: g
|
|
1916
|
+
}
|
|
1917
|
+
) : y ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1918
|
+
BaseImageFallback,
|
|
1919
|
+
{
|
|
1920
|
+
shape: l,
|
|
1921
|
+
alt: t,
|
|
1922
|
+
width: w,
|
|
1923
|
+
height: g
|
|
1924
|
+
}
|
|
1925
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1926
|
+
"img",
|
|
1927
|
+
{
|
|
1928
|
+
ref: f,
|
|
1929
|
+
src: e,
|
|
1930
|
+
alt: t,
|
|
1931
|
+
width: w,
|
|
1932
|
+
height: g,
|
|
1933
|
+
loading: i,
|
|
1934
|
+
className: cn(
|
|
1935
|
+
imageVariants({
|
|
1936
|
+
position: a,
|
|
1937
|
+
size: u,
|
|
1938
|
+
shape: l
|
|
1939
|
+
}),
|
|
1940
|
+
x
|
|
1941
|
+
),
|
|
1942
|
+
onLoad: (m) => {
|
|
1943
|
+
d(), r?.(m);
|
|
1944
|
+
},
|
|
1945
|
+
onError: (m) => {
|
|
1946
|
+
v(), s?.(m);
|
|
1947
|
+
},
|
|
1948
|
+
...h
|
|
1949
|
+
}
|
|
1950
|
+
);
|
|
1951
|
+
}
|
|
1952
|
+
), ImageCircle = forwardRef((e, t) => /* @__PURE__ */ jsxRuntimeExports.jsx(BaseImage, { ref: t, ...e, shape: "circle" })), ImageSquare = forwardRef((e, t) => /* @__PURE__ */ jsxRuntimeExports.jsx(BaseImage, { ref: t, ...e, shape: "square" })), ImageRectangle = forwardRef((e, t) => /* @__PURE__ */ jsxRuntimeExports.jsx(BaseImage, { ref: t, ...e, shape: "rectangle" }));
|
|
1770
1953
|
export {
|
|
1771
1954
|
Alert as A,
|
|
1772
1955
|
Badge as B,
|
|
@@ -1782,5 +1965,9 @@ export {
|
|
|
1782
1965
|
ButtonIcon as f,
|
|
1783
1966
|
Calendar as g,
|
|
1784
1967
|
Text as h,
|
|
1785
|
-
Tile as i
|
|
1968
|
+
Tile as i,
|
|
1969
|
+
ImageCircle as j,
|
|
1970
|
+
ImageSquare as k,
|
|
1971
|
+
ImageRectangle as l,
|
|
1972
|
+
BaseImage as m
|
|
1786
1973
|
};
|