@justanarthur/modo-ui 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/LICENSE.beui +21 -0
- package/LICENSE.fluid-functionalism +21 -0
- package/LICENSE.motion-primitives +21 -0
- package/LICENSE.sileo +21 -0
- package/README.md +608 -2
- package/dist/base.css +994 -0
- package/dist/blocks/sidebar-app/index.d.ts +34 -0
- package/dist/blocks/sidebar-app/index.js +31 -0
- package/dist/components/badge/index.d.ts +59 -0
- package/dist/components/badge/index.js +16 -0
- package/dist/components/button/index.d.ts +59 -0
- package/dist/components/button/index.js +14 -0
- package/dist/components/card/index.d.ts +141 -0
- package/dist/components/card/index.js +42 -0
- package/dist/components/inputs/checkbox-group/index.d.ts +50 -0
- package/dist/components/inputs/checkbox-group/index.js +21 -0
- package/dist/components/inputs/color-picker/index.d.ts +137 -0
- package/dist/components/inputs/color-picker/index.js +35 -0
- package/dist/components/inputs/combobox/index.d.ts +161 -0
- package/dist/components/inputs/combobox/index.js +38 -0
- package/dist/components/inputs/date-time/calendar/index.d.ts +45 -0
- package/dist/components/inputs/date-time/calendar/index.js +18 -0
- package/dist/components/inputs/date-time/date-picker/index.d.ts +82 -0
- package/dist/components/inputs/date-time/date-picker/index.js +32 -0
- package/dist/components/inputs/date-time/date-range-picker/index.d.ts +64 -0
- package/dist/components/inputs/date-time/date-range-picker/index.js +31 -0
- package/dist/components/inputs/date-time/duration-picker/index.d.ts +57 -0
- package/dist/components/inputs/date-time/duration-picker/index.js +31 -0
- package/dist/components/inputs/date-time/month-picker/index.d.ts +57 -0
- package/dist/components/inputs/date-time/month-picker/index.js +30 -0
- package/dist/components/inputs/date-time/time-picker/index.d.ts +59 -0
- package/dist/components/inputs/date-time/time-picker/index.js +31 -0
- package/dist/components/inputs/input/index.d.ts +84 -0
- package/dist/components/inputs/input/index.js +19 -0
- package/dist/components/inputs/input-copy/index.d.ts +44 -0
- package/dist/components/inputs/input-copy/index.js +16 -0
- package/dist/components/inputs/input-message/index.d.ts +125 -0
- package/dist/components/inputs/input-message/index.js +25 -0
- package/dist/components/inputs/radio-group/index.d.ts +58 -0
- package/dist/components/inputs/radio-group/index.js +20 -0
- package/dist/components/inputs/search/index.d.ts +83 -0
- package/dist/components/inputs/search/index.js +25 -0
- package/dist/components/inputs/select/index.d.ts +105 -0
- package/dist/components/inputs/select/index.js +34 -0
- package/dist/components/inputs/slider/index.d.ts +108 -0
- package/dist/components/inputs/slider/index.js +14 -0
- package/dist/components/inputs/switch/index.d.ts +43 -0
- package/dist/components/inputs/switch/index.js +14 -0
- package/dist/components/navigation/accordion/index.d.ts +117 -0
- package/dist/components/navigation/accordion/index.js +28 -0
- package/dist/components/navigation/sidebar/index.d.ts +388 -0
- package/dist/components/navigation/sidebar/index.js +99 -0
- package/dist/components/navigation/tabs/index.d.ts +70 -0
- package/dist/components/navigation/tabs/index.js +23 -0
- package/dist/components/navigation/tabs-subtle/index.d.ts +73 -0
- package/dist/components/navigation/tabs-subtle/index.js +21 -0
- package/dist/components/overlays/alert-dialog/index.d.ts +67 -0
- package/dist/components/overlays/alert-dialog/index.js +22 -0
- package/dist/components/overlays/command/index.d.ts +121 -0
- package/dist/components/overlays/command/index.js +36 -0
- package/dist/components/overlays/context-menu/index.d.ts +97 -0
- package/dist/components/overlays/context-menu/index.js +29 -0
- package/dist/components/overlays/dialog/index.d.ts +130 -0
- package/dist/components/overlays/dialog/index.js +37 -0
- package/dist/components/overlays/dropdown/index.d.ts +222 -0
- package/dist/components/overlays/dropdown/index.js +44 -0
- package/dist/components/overlays/popover/index.d.ts +87 -0
- package/dist/components/overlays/popover/index.js +26 -0
- package/dist/components/overlays/preview-card/index.d.ts +75 -0
- package/dist/components/overlays/preview-card/index.js +19 -0
- package/dist/components/overlays/sheet/index.d.ts +67 -0
- package/dist/components/overlays/sheet/index.js +24 -0
- package/dist/components/overlays/toast/index.d.ts +107 -0
- package/dist/components/overlays/toast/index.js +21 -0
- package/dist/components/overlays/tooltip/index.d.ts +75 -0
- package/dist/components/overlays/tooltip/index.js +17 -0
- package/dist/components/table/index.d.ts +44 -0
- package/dist/components/table/index.js +26 -0
- package/dist/components/thinking-indicator/index.d.ts +32 -0
- package/dist/components/thinking-indicator/index.js +13 -0
- package/dist/index.d.ts +3926 -0
- package/dist/index.js +511 -0
- package/dist/preset.d.ts +104 -0
- package/dist/preset.js +124 -0
- package/dist/primitives/code/index.d.ts +23 -0
- package/dist/primitives/code/index.js +11 -0
- package/dist/primitives/craft/index.d.ts +31 -0
- package/dist/primitives/craft/index.js +11 -0
- package/dist/primitives/fluid-hover/index.d.ts +233 -0
- package/dist/primitives/fluid-hover/index.js +25 -0
- package/dist/primitives/morph/index.d.ts +127 -0
- package/dist/primitives/morph/index.js +19 -0
- package/dist/primitives/motion/index.d.ts +115 -0
- package/dist/primitives/motion/index.js +19 -0
- package/dist/primitives/scroll-area/index.d.ts +41 -0
- package/dist/primitives/scroll-area/index.js +12 -0
- package/dist/primitives/sizes/index.d.ts +128 -0
- package/dist/primitives/sizes/index.js +21 -0
- package/dist/primitives/surface/index.d.ts +69 -0
- package/dist/primitives/surface/index.js +17 -0
- package/dist/shared/components-0ke6xada.js +123 -0
- package/dist/shared/components-0q0sqfh4.js +146 -0
- package/dist/shared/components-0sn7ypjw.js +61 -0
- package/dist/shared/components-1j9791sn.js +345 -0
- package/dist/shared/components-1rfwbyyc.js +361 -0
- package/dist/shared/components-1v7rxytx.js +30 -0
- package/dist/shared/components-1xekx2hx.js +215 -0
- package/dist/shared/components-39jq9va1.js +86 -0
- package/dist/shared/components-3gae8nta.js +719 -0
- package/dist/shared/components-3k8xpnpq.js +1759 -0
- package/dist/shared/components-3ky44908.js +9 -0
- package/dist/shared/components-3mkepka5.js +111 -0
- package/dist/shared/components-3wk0w46f.js +667 -0
- package/dist/shared/components-4cnjmgex.js +124 -0
- package/dist/shared/components-59efxjd9.js +298 -0
- package/dist/shared/components-5xc2j8jz.js +159 -0
- package/dist/shared/components-62ybc7t2.js +496 -0
- package/dist/shared/components-66mv71kx.js +262 -0
- package/dist/shared/components-7ans7ce5.js +120 -0
- package/dist/shared/components-7btqt08d.js +270 -0
- package/dist/shared/components-7r3etddy.js +171 -0
- package/dist/shared/components-7x9kawxv.js +152 -0
- package/dist/shared/components-8fpr3s4p.js +292 -0
- package/dist/shared/components-9jvzzvt1.js +198 -0
- package/dist/shared/components-apdwtweq.js +484 -0
- package/dist/shared/components-asr5pg50.js +191 -0
- package/dist/shared/components-b2wyq2cq.js +232 -0
- package/dist/shared/components-c6s6b43g.js +15 -0
- package/dist/shared/components-ca2c898n.js +1828 -0
- package/dist/shared/components-cbxjn9p8.js +141 -0
- package/dist/shared/components-chacnk61.js +216 -0
- package/dist/shared/components-cv16mryv.js +62 -0
- package/dist/shared/components-ez65vtbq.js +110 -0
- package/dist/shared/components-ezxhrmer.js +17 -0
- package/dist/shared/components-gc5vtq2f.js +149 -0
- package/dist/shared/components-gf5s6ap9.js +42 -0
- package/dist/shared/components-gvr9w41t.js +193 -0
- package/dist/shared/components-h2dpcwgc.js +137 -0
- package/dist/shared/components-hawvy2qz.js +105 -0
- package/dist/shared/components-hqeq3w9q.js +375 -0
- package/dist/shared/components-jjw69c4c.js +28 -0
- package/dist/shared/components-jwst3vtj.js +346 -0
- package/dist/shared/components-kvr7f9hy.js +45 -0
- package/dist/shared/components-men63rwj.js +9 -0
- package/dist/shared/components-mhd39z7x.js +22 -0
- package/dist/shared/components-n7mjr357.js +26 -0
- package/dist/shared/components-ng72k97e.js +128 -0
- package/dist/shared/components-nh8tma1n.js +986 -0
- package/dist/shared/components-njzgqdwy.js +445 -0
- package/dist/shared/components-ny774h8p.js +293 -0
- package/dist/shared/components-q4daerx0.js +58 -0
- package/dist/shared/components-q5xj5c16.js +79 -0
- package/dist/shared/components-rr7a6ja9.js +160 -0
- package/dist/shared/components-s2bz1xpk.js +63 -0
- package/dist/shared/components-tqvarbfv.js +288 -0
- package/dist/shared/components-v6xp325t.js +304 -0
- package/dist/shared/components-v7wtz8hk.js +144 -0
- package/dist/shared/components-vc7vq5nz.js +32 -0
- package/dist/shared/components-vfbhxf5r.js +58 -0
- package/dist/shared/components-vynjtrk6.js +19 -0
- package/dist/shared/components-wvp1m52g.js +1200 -0
- package/dist/shared/components-yh3kwdhr.js +981 -0
- package/dist/shared/components-ytb2tefr.js +291 -0
- package/dist/shared/components-zfnmn5d4.js +220 -0
- package/dist/shared/components-zrkzcayz.js +141 -0
- package/dist/shared/components-zx6b6yby.js +42 -0
- package/dist/styles.css +1949 -0
- package/dist/tailwind.css +219 -0
- package/dist/tokens.css +345 -0
- package/package.json +103 -4
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultLocale,
|
|
3
|
+
parseDateText
|
|
4
|
+
} from "./components-9jvzzvt1.js";
|
|
5
|
+
import {
|
|
6
|
+
useControllableState
|
|
7
|
+
} from "./components-n7mjr357.js";
|
|
8
|
+
import {
|
|
9
|
+
calendar_default
|
|
10
|
+
} from "./components-1rfwbyyc.js";
|
|
11
|
+
import {
|
|
12
|
+
PickerShell,
|
|
13
|
+
PickerInput
|
|
14
|
+
} from "./components-7btqt08d.js";
|
|
15
|
+
|
|
16
|
+
// components/inputs/date-time/date-range-picker/index.tsx
|
|
17
|
+
import { endOfMonth, format } from "date-fns";
|
|
18
|
+
import { useRef, useState } from "react";
|
|
19
|
+
import { dateMatchModifiers } from "react-day-picker";
|
|
20
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
21
|
+
function DateRangePicker2({
|
|
22
|
+
value: valueProp,
|
|
23
|
+
defaultValue = null,
|
|
24
|
+
onValueChange,
|
|
25
|
+
locale = defaultLocale,
|
|
26
|
+
placeholder,
|
|
27
|
+
disabled,
|
|
28
|
+
startMonth,
|
|
29
|
+
endMonth,
|
|
30
|
+
invalid,
|
|
31
|
+
size,
|
|
32
|
+
open: openProp,
|
|
33
|
+
defaultOpen = false,
|
|
34
|
+
onOpenChange,
|
|
35
|
+
dir,
|
|
36
|
+
columnsSide,
|
|
37
|
+
id,
|
|
38
|
+
from: growFrom,
|
|
39
|
+
effect,
|
|
40
|
+
hideSource,
|
|
41
|
+
tier,
|
|
42
|
+
className
|
|
43
|
+
}) {
|
|
44
|
+
const [value, setValue] = useControllableState(valueProp, defaultValue, onValueChange);
|
|
45
|
+
const [open, setOpenState] = useControllableState(openProp, defaultOpen, onOpenChange);
|
|
46
|
+
const [picking, setPicking] = useState(false);
|
|
47
|
+
const fromInput = useRef(null);
|
|
48
|
+
const off = typeof disabled === "boolean" && disabled;
|
|
49
|
+
const days = off ? undefined : disabled;
|
|
50
|
+
const from = value?.from;
|
|
51
|
+
const to = value?.to;
|
|
52
|
+
const setOpen = (next) => {
|
|
53
|
+
setPicking(false);
|
|
54
|
+
setOpenState(next);
|
|
55
|
+
};
|
|
56
|
+
const allowed = (date) => (!startMonth || date >= startMonth) && (!endMonth || date <= endOfMonth(endMonth)) && !(days && dateMatchModifiers(date, days));
|
|
57
|
+
const pick = (day) => {
|
|
58
|
+
if (!picking || !from) {
|
|
59
|
+
setValue({ from: day, to: undefined });
|
|
60
|
+
setPicking(true);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
setValue(day < from ? { from: day, to: from } : { from, to: day });
|
|
64
|
+
setOpen(false);
|
|
65
|
+
};
|
|
66
|
+
const readEnd = (end) => (text) => {
|
|
67
|
+
if (!text.trim()) {
|
|
68
|
+
setValue(end === "from" ? null : from ? { from, to: undefined } : null);
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
const date = parseDateText(text, locale, (end === "from" ? from : to) ?? undefined);
|
|
72
|
+
if (!date || !allowed(date))
|
|
73
|
+
return false;
|
|
74
|
+
if (end === "from")
|
|
75
|
+
setValue({ from: date, to: to && to >= date ? to : undefined });
|
|
76
|
+
else if (!from || date < from)
|
|
77
|
+
return false;
|
|
78
|
+
else
|
|
79
|
+
setValue({ from, to: date });
|
|
80
|
+
return true;
|
|
81
|
+
};
|
|
82
|
+
const display = from ? to ? new Intl.DateTimeFormat(locale.code, { dateStyle: "medium" }).formatRange(from, to) : `${format(from, "PP", { locale })} –` : "";
|
|
83
|
+
const header = /* @__PURE__ */ jsxs(Fragment, {
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ jsx(PickerInput, {
|
|
86
|
+
ref: fromInput,
|
|
87
|
+
"aria-label": "Start date",
|
|
88
|
+
placeholder,
|
|
89
|
+
formatted: from ? format(from, "PP", { locale }) : "",
|
|
90
|
+
onText: readEnd("from"),
|
|
91
|
+
onEnter: () => setOpen(false),
|
|
92
|
+
className: "min-w-0 flex-1"
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ jsx("span", {
|
|
95
|
+
"aria-hidden": true,
|
|
96
|
+
className: "px-0.5 text-muted-foreground",
|
|
97
|
+
children: "–"
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ jsx(PickerInput, {
|
|
100
|
+
"aria-label": "End date",
|
|
101
|
+
formatted: to ? format(to, "PP", { locale }) : "",
|
|
102
|
+
onText: readEnd("to"),
|
|
103
|
+
onEnter: () => setOpen(false),
|
|
104
|
+
className: "min-w-0 flex-1"
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
});
|
|
108
|
+
return /* @__PURE__ */ jsx(PickerShell, {
|
|
109
|
+
open,
|
|
110
|
+
onOpenChange: setOpen,
|
|
111
|
+
size,
|
|
112
|
+
invalid,
|
|
113
|
+
disabled: off,
|
|
114
|
+
icon: "calendar",
|
|
115
|
+
display,
|
|
116
|
+
placeholder,
|
|
117
|
+
header,
|
|
118
|
+
initialFocus: fromInput,
|
|
119
|
+
id,
|
|
120
|
+
dir,
|
|
121
|
+
from: growFrom,
|
|
122
|
+
effect,
|
|
123
|
+
hideSource,
|
|
124
|
+
tier,
|
|
125
|
+
className,
|
|
126
|
+
children: /* @__PURE__ */ jsx(calendar_default, {
|
|
127
|
+
mode: "range",
|
|
128
|
+
locale,
|
|
129
|
+
selected: value ?? undefined,
|
|
130
|
+
onSelect: (_, day) => pick(day),
|
|
131
|
+
disabled: days,
|
|
132
|
+
startMonth,
|
|
133
|
+
endMonth,
|
|
134
|
+
dir,
|
|
135
|
+
columnsSide
|
|
136
|
+
})
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
var date_range_picker_default = DateRangePicker2;
|
|
140
|
+
|
|
141
|
+
export { DateRangePicker2, date_range_picker_default };
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useReduceMotion
|
|
3
|
+
} from "./components-men63rwj.js";
|
|
4
|
+
import {
|
|
5
|
+
GOO_MATRIX,
|
|
6
|
+
GOO_BLUR_RATIO
|
|
7
|
+
} from "./components-hqeq3w9q.js";
|
|
8
|
+
import {
|
|
9
|
+
cn2
|
|
10
|
+
} from "./components-ezxhrmer.js";
|
|
11
|
+
import {
|
|
12
|
+
spring2
|
|
13
|
+
} from "./components-1v7rxytx.js";
|
|
14
|
+
|
|
15
|
+
// lib/goo-indicator.tsx
|
|
16
|
+
import { animate, motion, useMotionValue } from "motion/react";
|
|
17
|
+
import { useId, useLayoutEffect, useRef, useState } from "react";
|
|
18
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
19
|
+
var COVERAGE = "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0";
|
|
20
|
+
var NECK = 0.5;
|
|
21
|
+
function union(a, b) {
|
|
22
|
+
if (!a)
|
|
23
|
+
return b;
|
|
24
|
+
const left = Math.min(a.left, b.left);
|
|
25
|
+
const top = Math.min(a.top, b.top);
|
|
26
|
+
return {
|
|
27
|
+
left,
|
|
28
|
+
top,
|
|
29
|
+
width: Math.max(a.left + a.width, b.left + b.width) - left,
|
|
30
|
+
height: Math.max(a.top + a.height, b.top + b.height) - top
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function pad(rect, by) {
|
|
34
|
+
return { left: rect.left - by, top: rect.top - by, width: rect.width + by * 2, height: rect.height + by * 2 };
|
|
35
|
+
}
|
|
36
|
+
function center(rect) {
|
|
37
|
+
return { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };
|
|
38
|
+
}
|
|
39
|
+
function travels(from, to) {
|
|
40
|
+
const a = center(from);
|
|
41
|
+
const b = center(to);
|
|
42
|
+
return Math.abs(b.x - a.x) > Math.min(from.width, to.width) / 2 || Math.abs(b.y - a.y) > Math.min(from.height, to.height) / 2;
|
|
43
|
+
}
|
|
44
|
+
function retract(from, to) {
|
|
45
|
+
const axis = (start, size, toStart, toSize) => {
|
|
46
|
+
const delta = toStart + toSize / 2 - (start + size / 2);
|
|
47
|
+
if (Math.abs(delta) < 1)
|
|
48
|
+
return [start + size * (1 - NECK) / 2, size * NECK];
|
|
49
|
+
return [delta > 0 ? toStart : toStart + toSize, 0];
|
|
50
|
+
};
|
|
51
|
+
const [left, width] = axis(from.left, from.width, to.left, to.width);
|
|
52
|
+
const [top, height] = axis(from.top, from.height, to.top, to.height);
|
|
53
|
+
return { left, top, width, height };
|
|
54
|
+
}
|
|
55
|
+
function toTarget(rect) {
|
|
56
|
+
return { x: rect.left, y: rect.top, width: rect.width, height: rect.height };
|
|
57
|
+
}
|
|
58
|
+
function blurOf(el, rect) {
|
|
59
|
+
const r = Number.parseFloat(getComputedStyle(el).borderTopLeftRadius) || 0;
|
|
60
|
+
return Math.min(r, rect.width / 2, rect.height / 2) * GOO_BLUR_RATIO;
|
|
61
|
+
}
|
|
62
|
+
function GooLayer({ active, blur, box, fill, children }) {
|
|
63
|
+
const id = `goo-${useId().replace(/:/g, "")}`;
|
|
64
|
+
const flood = useRef(null);
|
|
65
|
+
const probe = useRef(null);
|
|
66
|
+
const layer = box ? pad(box, blur * 3) : { left: 0, top: 0, width: 0, height: 0 };
|
|
67
|
+
useLayoutEffect(() => {
|
|
68
|
+
if (!active || !probe.current)
|
|
69
|
+
return;
|
|
70
|
+
flood.current?.setAttribute("flood-color", getComputedStyle(probe.current).backgroundColor);
|
|
71
|
+
}, [active]);
|
|
72
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx("svg", {
|
|
75
|
+
"aria-hidden": true,
|
|
76
|
+
className: "absolute size-0",
|
|
77
|
+
children: /* @__PURE__ */ jsxs("filter", {
|
|
78
|
+
id,
|
|
79
|
+
x: "-50%",
|
|
80
|
+
y: "-50%",
|
|
81
|
+
width: "200%",
|
|
82
|
+
height: "200%",
|
|
83
|
+
colorInterpolationFilters: "sRGB",
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ jsx("feColorMatrix", {
|
|
86
|
+
in: "SourceGraphic",
|
|
87
|
+
values: COVERAGE,
|
|
88
|
+
result: "coverage"
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ jsx("feGaussianBlur", {
|
|
91
|
+
in: "coverage",
|
|
92
|
+
stdDeviation: blur,
|
|
93
|
+
result: "blur"
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ jsx("feColorMatrix", {
|
|
96
|
+
in: "blur",
|
|
97
|
+
values: GOO_MATRIX,
|
|
98
|
+
result: "goo"
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ jsx("feFlood", {
|
|
101
|
+
ref: flood
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ jsx("feComposite", {
|
|
104
|
+
in2: "goo",
|
|
105
|
+
operator: "in"
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
})
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ jsx("div", {
|
|
111
|
+
"aria-hidden": true,
|
|
112
|
+
className: "pointer-events-none absolute",
|
|
113
|
+
style: { ...layer, filter: active ? `url(#${id})` : undefined },
|
|
114
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
115
|
+
ref: probe,
|
|
116
|
+
className: cn2(fill, "absolute"),
|
|
117
|
+
style: { left: -layer.left, top: -layer.top },
|
|
118
|
+
children
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function GooIndicator({
|
|
125
|
+
rect,
|
|
126
|
+
from,
|
|
127
|
+
className,
|
|
128
|
+
shadow,
|
|
129
|
+
transition = spring2.moderate,
|
|
130
|
+
opacity = 1
|
|
131
|
+
}) {
|
|
132
|
+
const reduced = useReduceMotion();
|
|
133
|
+
const start = from ?? rect;
|
|
134
|
+
const x = useMotionValue(start.left);
|
|
135
|
+
const y = useMotionValue(start.top);
|
|
136
|
+
const width = useMotionValue(start.width);
|
|
137
|
+
const height = useMotionValue(start.height);
|
|
138
|
+
const lead = useRef(null);
|
|
139
|
+
const [trails, setTrails] = useState([]);
|
|
140
|
+
const [blur, setBlur] = useState(0);
|
|
141
|
+
const ids = useRef(0);
|
|
142
|
+
const travel = transition === false || reduced ? false : transition;
|
|
143
|
+
const travelRef = useRef(travel);
|
|
144
|
+
travelRef.current = travel;
|
|
145
|
+
const read = () => ({ left: x.get(), top: y.get(), width: width.get(), height: height.get() });
|
|
146
|
+
useLayoutEffect(() => {
|
|
147
|
+
const move = travelRef.current;
|
|
148
|
+
const current = read();
|
|
149
|
+
if (!move) {
|
|
150
|
+
x.jump(rect.left);
|
|
151
|
+
y.jump(rect.top);
|
|
152
|
+
width.jump(rect.width);
|
|
153
|
+
height.jump(rect.height);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const goo = lead.current && travels(current, rect) ? blurOf(lead.current, current) : 0;
|
|
157
|
+
if (goo >= 1) {
|
|
158
|
+
setBlur(goo);
|
|
159
|
+
setTrails((list) => [...list, { id: ++ids.current, from: current, to: retract(current, rect) }]);
|
|
160
|
+
}
|
|
161
|
+
animate(x, rect.left, move);
|
|
162
|
+
animate(y, rect.top, move);
|
|
163
|
+
animate(width, rect.width, move);
|
|
164
|
+
animate(height, rect.height, move);
|
|
165
|
+
}, [rect.left, rect.top, rect.width, rect.height]);
|
|
166
|
+
const melting = trails.length > 0;
|
|
167
|
+
const linger = travel ? { ...travel, delay: (travel.duration ?? 0) / 3 } : undefined;
|
|
168
|
+
const shape = cn2("pointer-events-none absolute top-0 left-0", className);
|
|
169
|
+
const box = trails.reduce((all, trail) => union(all, trail.from), union(read(), rect));
|
|
170
|
+
const drop = (trail) => setTrails((list) => list.filter((t) => t.id !== trail.id));
|
|
171
|
+
return /* @__PURE__ */ jsxs(motion.div, {
|
|
172
|
+
"aria-hidden": true,
|
|
173
|
+
className: "pointer-events-none absolute top-0 left-0",
|
|
174
|
+
initial: false,
|
|
175
|
+
animate: { opacity },
|
|
176
|
+
transition: { duration: spring2.fast.duration },
|
|
177
|
+
children: [
|
|
178
|
+
shadow && /* @__PURE__ */ jsxs(Fragment, {
|
|
179
|
+
children: [
|
|
180
|
+
trails.map((trail) => /* @__PURE__ */ jsx(motion.div, {
|
|
181
|
+
className: cn2(shape, shadow),
|
|
182
|
+
initial: { ...toTarget(trail.from), opacity: 1 },
|
|
183
|
+
animate: { ...toTarget(trail.to), opacity: 0 },
|
|
184
|
+
transition: linger
|
|
185
|
+
}, trail.id)),
|
|
186
|
+
/* @__PURE__ */ jsx(motion.div, {
|
|
187
|
+
className: cn2(shape, shadow, !melting && "invisible"),
|
|
188
|
+
style: { x, y, width, height }
|
|
189
|
+
})
|
|
190
|
+
]
|
|
191
|
+
}),
|
|
192
|
+
/* @__PURE__ */ jsxs(GooLayer, {
|
|
193
|
+
active: melting,
|
|
194
|
+
blur,
|
|
195
|
+
box,
|
|
196
|
+
fill: className ?? "",
|
|
197
|
+
children: [
|
|
198
|
+
trails.map((trail) => /* @__PURE__ */ jsx(motion.div, {
|
|
199
|
+
className: shape,
|
|
200
|
+
initial: toTarget(trail.from),
|
|
201
|
+
animate: toTarget(trail.to),
|
|
202
|
+
transition: linger,
|
|
203
|
+
onAnimationComplete: () => drop(trail)
|
|
204
|
+
}, trail.id)),
|
|
205
|
+
/* @__PURE__ */ jsx(motion.div, {
|
|
206
|
+
ref: lead,
|
|
207
|
+
className: cn2(shape, !melting && shadow),
|
|
208
|
+
style: { x, y, width, height }
|
|
209
|
+
})
|
|
210
|
+
]
|
|
211
|
+
})
|
|
212
|
+
]
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export { union, GooLayer, GooIndicator };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// lib/shape-context.tsx
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var shapeMap = {
|
|
5
|
+
pill: {
|
|
6
|
+
variant: "pill",
|
|
7
|
+
item: "rounded-[20px]",
|
|
8
|
+
bg: "rounded-[20px]",
|
|
9
|
+
focusRing: "rounded-[22px]",
|
|
10
|
+
mergedBg: "rounded-2xl",
|
|
11
|
+
container: "rounded-3xl",
|
|
12
|
+
button: "rounded-[20px]",
|
|
13
|
+
input: "rounded-[20px]",
|
|
14
|
+
bgRadius: 20,
|
|
15
|
+
mergedRadius: 16
|
|
16
|
+
},
|
|
17
|
+
rounded: {
|
|
18
|
+
variant: "rounded",
|
|
19
|
+
item: "rounded-lg",
|
|
20
|
+
bg: "rounded-lg",
|
|
21
|
+
focusRing: "rounded-[10px]",
|
|
22
|
+
mergedBg: "rounded-lg",
|
|
23
|
+
container: "rounded-xl",
|
|
24
|
+
button: "rounded-lg",
|
|
25
|
+
input: "rounded-lg",
|
|
26
|
+
bgRadius: 8,
|
|
27
|
+
mergedRadius: 8
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var ShapeContext = createContext(null);
|
|
31
|
+
function useShape() {
|
|
32
|
+
const ctx = useContext(ShapeContext);
|
|
33
|
+
if (!ctx)
|
|
34
|
+
return shapeMap.rounded;
|
|
35
|
+
return ctx.classes;
|
|
36
|
+
}
|
|
37
|
+
function ShapeProvider2({ children, defaultShape = "rounded" }) {
|
|
38
|
+
const [shape, setShapeState] = useState(defaultShape);
|
|
39
|
+
const transitionTimeoutRef = useRef(null);
|
|
40
|
+
const transitionShape = useCallback((callback) => {
|
|
41
|
+
const root = document.documentElement;
|
|
42
|
+
root.classList.add("transitioning");
|
|
43
|
+
root.offsetHeight;
|
|
44
|
+
callback();
|
|
45
|
+
if (transitionTimeoutRef.current)
|
|
46
|
+
clearTimeout(transitionTimeoutRef.current);
|
|
47
|
+
transitionTimeoutRef.current = setTimeout(() => root.classList.remove("transitioning"), 200);
|
|
48
|
+
}, []);
|
|
49
|
+
const setShape = useCallback((next) => {
|
|
50
|
+
transitionShape(() => setShapeState(next));
|
|
51
|
+
}, [transitionShape]);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
document.documentElement.style.setProperty("--shape-input-radius", `${shapeMap[shape].bgRadius}px`);
|
|
54
|
+
}, [shape]);
|
|
55
|
+
const value = useMemo(() => ({ shape, setShape, classes: shapeMap[shape] }), [shape, setShape]);
|
|
56
|
+
return /* @__PURE__ */ jsx(ShapeContext.Provider, {
|
|
57
|
+
value,
|
|
58
|
+
children
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { shapeMap, useShape, ShapeProvider2 };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultLocale,
|
|
3
|
+
hourCycleOf,
|
|
4
|
+
parseTimeText,
|
|
5
|
+
dividedColumns
|
|
6
|
+
} from "./components-9jvzzvt1.js";
|
|
7
|
+
import {
|
|
8
|
+
cn2
|
|
9
|
+
} from "./components-ezxhrmer.js";
|
|
10
|
+
import {
|
|
11
|
+
useControllableState
|
|
12
|
+
} from "./components-n7mjr357.js";
|
|
13
|
+
import {
|
|
14
|
+
PickerShell,
|
|
15
|
+
PickerInput
|
|
16
|
+
} from "./components-7btqt08d.js";
|
|
17
|
+
import {
|
|
18
|
+
pad,
|
|
19
|
+
TimeColumns
|
|
20
|
+
} from "./components-q4daerx0.js";
|
|
21
|
+
|
|
22
|
+
// components/inputs/date-time/time-picker/index.tsx
|
|
23
|
+
import { format, set } from "date-fns";
|
|
24
|
+
import { useRef } from "react";
|
|
25
|
+
import { jsx } from "react/jsx-runtime";
|
|
26
|
+
var toTime = (value) => {
|
|
27
|
+
const [hours, minutes] = value?.split(":").map(Number) ?? [];
|
|
28
|
+
return hours === undefined || minutes === undefined ? null : { hours, minutes };
|
|
29
|
+
};
|
|
30
|
+
var toValue = ({ hours, minutes }) => `${pad(hours)}:${pad(minutes)}`;
|
|
31
|
+
function TimePicker2({
|
|
32
|
+
value: valueProp,
|
|
33
|
+
defaultValue = null,
|
|
34
|
+
onValueChange,
|
|
35
|
+
hourCycle,
|
|
36
|
+
minuteStep = 1,
|
|
37
|
+
locale = defaultLocale,
|
|
38
|
+
placeholder,
|
|
39
|
+
disabled,
|
|
40
|
+
invalid,
|
|
41
|
+
size,
|
|
42
|
+
open: openProp,
|
|
43
|
+
defaultOpen = false,
|
|
44
|
+
onOpenChange,
|
|
45
|
+
id,
|
|
46
|
+
from,
|
|
47
|
+
effect,
|
|
48
|
+
hideSource,
|
|
49
|
+
tier,
|
|
50
|
+
className
|
|
51
|
+
}) {
|
|
52
|
+
const [value, setValue] = useControllableState(valueProp, defaultValue, onValueChange);
|
|
53
|
+
const [open, setOpen] = useControllableState(openProp, defaultOpen, onOpenChange);
|
|
54
|
+
const input = useRef(null);
|
|
55
|
+
const time = toTime(value);
|
|
56
|
+
const formatted = time ? format(set(new Date, time), "p", { locale }) : "";
|
|
57
|
+
const readTime = (text) => {
|
|
58
|
+
if (!text.trim()) {
|
|
59
|
+
setValue(null);
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
const read = parseTimeText(text, locale);
|
|
63
|
+
if (!read)
|
|
64
|
+
return false;
|
|
65
|
+
setValue(toValue({ hours: read.getHours(), minutes: read.getMinutes() }));
|
|
66
|
+
return true;
|
|
67
|
+
};
|
|
68
|
+
return /* @__PURE__ */ jsx(PickerShell, {
|
|
69
|
+
open,
|
|
70
|
+
onOpenChange: setOpen,
|
|
71
|
+
size,
|
|
72
|
+
invalid,
|
|
73
|
+
disabled,
|
|
74
|
+
icon: "clock",
|
|
75
|
+
display: formatted,
|
|
76
|
+
placeholder,
|
|
77
|
+
header: /* @__PURE__ */ jsx(PickerInput, {
|
|
78
|
+
ref: input,
|
|
79
|
+
"aria-label": placeholder ?? "Time",
|
|
80
|
+
placeholder,
|
|
81
|
+
formatted,
|
|
82
|
+
onText: readTime,
|
|
83
|
+
onEnter: () => setOpen(false),
|
|
84
|
+
className: "flex-1"
|
|
85
|
+
}),
|
|
86
|
+
initialFocus: input,
|
|
87
|
+
popupClassName: "w-[max(var(--anchor-width,0px),14rem)]",
|
|
88
|
+
id,
|
|
89
|
+
from,
|
|
90
|
+
effect,
|
|
91
|
+
hideSource,
|
|
92
|
+
tier,
|
|
93
|
+
className,
|
|
94
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
95
|
+
className: cn2(dividedColumns, "h-56"),
|
|
96
|
+
children: /* @__PURE__ */ jsx(TimeColumns, {
|
|
97
|
+
value: time,
|
|
98
|
+
onValueChange: (next) => setValue(toValue(next)),
|
|
99
|
+
hourCycle: hourCycle ?? hourCycleOf(locale),
|
|
100
|
+
minuteStep,
|
|
101
|
+
locale,
|
|
102
|
+
orientation: "vertical",
|
|
103
|
+
fill: true
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
var time_picker_default = TimePicker2;
|
|
109
|
+
|
|
110
|
+
export { TimePicker2, time_picker_default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// lib/utils.ts
|
|
2
|
+
import { createCn } from "cn/config";
|
|
3
|
+
var TYPE_ROLES = ["display", "title", "subtitle", "body", "caption", "micro"];
|
|
4
|
+
var TIERS = ["fast", "fast-exit", "moderate", "moderate-exit", "slow", "slow-exit"];
|
|
5
|
+
var cn2 = createCn({
|
|
6
|
+
extend: {
|
|
7
|
+
classGroups: {
|
|
8
|
+
"font-size": [{ text: TYPE_ROLES.flatMap((role) => [role, `${role}-compact`]) }],
|
|
9
|
+
"font-variation": [{ weight: ["normal", "medium", "semibold", "bold"] }],
|
|
10
|
+
duration: [{ duration: TIERS }],
|
|
11
|
+
delay: [{ delay: TIERS }],
|
|
12
|
+
rounded: [{ rounded: ["box", "glyph"] }]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export { cn2 };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MorphSurface
|
|
3
|
+
} from "./components-0q0sqfh4.js";
|
|
4
|
+
import {
|
|
5
|
+
opensInPlace,
|
|
6
|
+
inPlaceOffset,
|
|
7
|
+
useMorphOrigin,
|
|
8
|
+
useMorph
|
|
9
|
+
} from "./components-hqeq3w9q.js";
|
|
10
|
+
import {
|
|
11
|
+
cn2
|
|
12
|
+
} from "./components-ezxhrmer.js";
|
|
13
|
+
import {
|
|
14
|
+
useShape
|
|
15
|
+
} from "./components-cv16mryv.js";
|
|
16
|
+
import {
|
|
17
|
+
slotRender
|
|
18
|
+
} from "./components-3ky44908.js";
|
|
19
|
+
import {
|
|
20
|
+
SURFACE_BG,
|
|
21
|
+
SURFACE_SHADOW,
|
|
22
|
+
useSurface2,
|
|
23
|
+
SurfaceProvider2
|
|
24
|
+
} from "./components-zx6b6yby.js";
|
|
25
|
+
import {
|
|
26
|
+
useControllableState
|
|
27
|
+
} from "./components-n7mjr357.js";
|
|
28
|
+
|
|
29
|
+
// components/overlays/popover/index.tsx
|
|
30
|
+
import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
|
|
31
|
+
import {
|
|
32
|
+
createContext,
|
|
33
|
+
forwardRef,
|
|
34
|
+
useContext,
|
|
35
|
+
useImperativeHandle,
|
|
36
|
+
useMemo
|
|
37
|
+
} from "react";
|
|
38
|
+
import { jsx } from "react/jsx-runtime";
|
|
39
|
+
var PopoverContext = createContext({ open: false, origin: { current: {} } });
|
|
40
|
+
var PopoverTrigger2 = forwardRef(({ render, asChild, children, ...props }, ref) => {
|
|
41
|
+
const el = slotRender(render, asChild, children);
|
|
42
|
+
return el ? /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, {
|
|
43
|
+
ref,
|
|
44
|
+
render: el,
|
|
45
|
+
...props
|
|
46
|
+
}) : /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, {
|
|
47
|
+
ref,
|
|
48
|
+
...props,
|
|
49
|
+
children
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
PopoverTrigger2.displayName = "PopoverTrigger";
|
|
53
|
+
var PopoverClose2 = forwardRef(({ render, asChild, children, ...props }, ref) => {
|
|
54
|
+
const el = slotRender(render, asChild, children);
|
|
55
|
+
return el ? /* @__PURE__ */ jsx(PopoverPrimitive.Close, {
|
|
56
|
+
ref,
|
|
57
|
+
render: el,
|
|
58
|
+
...props
|
|
59
|
+
}) : /* @__PURE__ */ jsx(PopoverPrimitive.Close, {
|
|
60
|
+
ref,
|
|
61
|
+
...props,
|
|
62
|
+
children
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
PopoverClose2.displayName = "PopoverClose";
|
|
66
|
+
var PopoverContent2 = forwardRef(({
|
|
67
|
+
side = "bottom",
|
|
68
|
+
align,
|
|
69
|
+
sideOffset = 12,
|
|
70
|
+
from,
|
|
71
|
+
effect,
|
|
72
|
+
hideSource,
|
|
73
|
+
tier,
|
|
74
|
+
container,
|
|
75
|
+
className,
|
|
76
|
+
children,
|
|
77
|
+
...props
|
|
78
|
+
}, ref) => {
|
|
79
|
+
const { open, origin } = useContext(PopoverContext);
|
|
80
|
+
const morph = useMorph(open, origin, { from, effect, hideSource, tier });
|
|
81
|
+
const inPlace = opensInPlace({ effect, hideSource });
|
|
82
|
+
useImperativeHandle(ref, () => morph.popup, [morph.popup]);
|
|
83
|
+
const shape = useShape();
|
|
84
|
+
const level = Math.min(useSurface2() + 2, 8);
|
|
85
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, {
|
|
86
|
+
container: container ?? undefined,
|
|
87
|
+
children: /* @__PURE__ */ jsx(PopoverPrimitive.Positioner, {
|
|
88
|
+
side,
|
|
89
|
+
align: align ?? (inPlace ? "start" : "center"),
|
|
90
|
+
sideOffset: inPlace ? inPlaceOffset : sideOffset,
|
|
91
|
+
className: "z-50 outline-none",
|
|
92
|
+
children: /* @__PURE__ */ jsx(PopoverPrimitive.Popup, {
|
|
93
|
+
ref: morph.popupRef,
|
|
94
|
+
className: "relative outline-none",
|
|
95
|
+
...props,
|
|
96
|
+
children: /* @__PURE__ */ jsx(SurfaceProvider2, {
|
|
97
|
+
value: level,
|
|
98
|
+
children: /* @__PURE__ */ jsx(MorphSurface, {
|
|
99
|
+
morph,
|
|
100
|
+
bg: SURFACE_BG[level],
|
|
101
|
+
shadow: SURFACE_SHADOW[3],
|
|
102
|
+
radius: shape.container,
|
|
103
|
+
className: cn2("flex w-max max-w-[min(92vw,20rem)] flex-col gap-1 p-4", className),
|
|
104
|
+
children
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
PopoverContent2.displayName = "PopoverContent";
|
|
112
|
+
var PopoverTitle2 = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Title, {
|
|
113
|
+
ref,
|
|
114
|
+
className: cn2("text-subtitle weight-semibold text-foreground", className),
|
|
115
|
+
...props
|
|
116
|
+
}));
|
|
117
|
+
PopoverTitle2.displayName = "PopoverTitle";
|
|
118
|
+
var PopoverDescription2 = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Description, {
|
|
119
|
+
ref,
|
|
120
|
+
className: cn2("text-caption text-muted-foreground", className),
|
|
121
|
+
...props
|
|
122
|
+
}));
|
|
123
|
+
PopoverDescription2.displayName = "PopoverDescription";
|
|
124
|
+
function Popover2({ open, defaultOpen = false, onOpenChange, modal = false, children }) {
|
|
125
|
+
const [current, setCurrent] = useControllableState(open, defaultOpen, onOpenChange);
|
|
126
|
+
const { origin, capture } = useMorphOrigin();
|
|
127
|
+
const ctx = useMemo(() => ({ open: current, origin }), [current, origin]);
|
|
128
|
+
return /* @__PURE__ */ jsx(PopoverContext.Provider, {
|
|
129
|
+
value: ctx,
|
|
130
|
+
children: /* @__PURE__ */ jsx(PopoverPrimitive.Root, {
|
|
131
|
+
open: current,
|
|
132
|
+
modal,
|
|
133
|
+
onOpenChange: (next, details) => {
|
|
134
|
+
if (next)
|
|
135
|
+
capture(details);
|
|
136
|
+
setCurrent(next);
|
|
137
|
+
},
|
|
138
|
+
children
|
|
139
|
+
})
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
Popover2.Trigger = PopoverTrigger2;
|
|
143
|
+
Popover2.Content = PopoverContent2;
|
|
144
|
+
Popover2.Title = PopoverTitle2;
|
|
145
|
+
Popover2.Description = PopoverDescription2;
|
|
146
|
+
Popover2.Close = PopoverClose2;
|
|
147
|
+
var popover_default = Popover2;
|
|
148
|
+
|
|
149
|
+
export { PopoverTrigger2, PopoverClose2, PopoverContent2, PopoverTitle2, PopoverDescription2, Popover2, popover_default };
|