@justanarthur/modo-ui 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -15
- package/dist/blocks/sidebar-app/index.d.ts +1 -1
- package/dist/blocks/sidebar-app/index.js +28 -31
- package/dist/components/{inputs → AI}/input-message/index.d.ts +1 -1
- package/dist/components/AI/input-message/index.js +25 -0
- package/dist/components/{thinking-indicator → AI/thinking-indicator}/index.d.ts +1 -1
- package/dist/components/AI/thinking-indicator/index.js +13 -0
- package/dist/components/{navigation/accordion → accordion}/index.d.ts +1 -1
- package/dist/components/accordion/index.js +28 -0
- package/dist/components/badge/index.d.ts +1 -1
- package/dist/components/badge/index.js +12 -14
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/button/index.js +10 -12
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/card/index.js +38 -40
- package/dist/components/{inputs/input-copy → copy}/index.d.ts +7 -7
- package/dist/components/copy/index.js +16 -0
- package/dist/components/inputs/checkbox/index.d.ts +62 -0
- package/dist/components/inputs/checkbox/index.js +22 -0
- package/dist/components/inputs/color-picker/index.d.ts +1 -1
- package/dist/components/inputs/color-picker/index.js +31 -33
- package/dist/components/inputs/combobox/index.d.ts +2 -2
- package/dist/components/inputs/combobox/index.js +31 -34
- package/dist/components/inputs/date-time/calendar/index.d.ts +1 -1
- package/dist/components/inputs/date-time/calendar/index.js +14 -16
- package/dist/components/inputs/date-time/date-picker/index.d.ts +1 -1
- package/dist/components/inputs/date-time/date-picker/index.js +28 -30
- package/dist/components/inputs/date-time/date-range-picker/index.d.ts +1 -1
- package/dist/components/inputs/date-time/date-range-picker/index.js +27 -29
- package/dist/components/inputs/date-time/duration-picker/index.d.ts +1 -1
- package/dist/components/inputs/date-time/duration-picker/index.js +27 -29
- package/dist/components/inputs/date-time/month-picker/index.d.ts +1 -1
- package/dist/components/inputs/date-time/month-picker/index.js +26 -28
- package/dist/components/inputs/date-time/time-picker/index.d.ts +1 -1
- package/dist/components/inputs/date-time/time-picker/index.js +27 -29
- package/dist/components/inputs/input/index.d.ts +1 -1
- package/dist/components/inputs/input/index.js +15 -16
- package/dist/components/inputs/{radio-group → radio}/index.d.ts +30 -30
- package/dist/components/inputs/radio/index.js +21 -0
- package/dist/components/inputs/search/index.d.ts +1 -1
- package/dist/components/inputs/search/index.js +21 -24
- package/dist/components/inputs/select/index.d.ts +1 -1
- package/dist/components/inputs/select/index.js +30 -33
- package/dist/components/inputs/slider/index.d.ts +1 -1
- package/dist/components/inputs/slider/index.js +10 -12
- package/dist/components/inputs/switch/index.d.ts +27 -6
- package/dist/components/inputs/switch/index.js +17 -12
- package/dist/components/navigation/sidebar/index.d.ts +3 -3
- package/dist/components/navigation/sidebar/index.js +95 -97
- package/dist/components/navigation/tabs/index.d.ts +1 -1
- package/dist/components/navigation/tabs/index.js +19 -21
- package/dist/components/navigation/tabs-subtle/index.d.ts +1 -1
- package/dist/components/navigation/tabs-subtle/index.js +17 -19
- package/dist/components/overlays/alert-dialog/index.d.ts +2 -2
- package/dist/components/overlays/alert-dialog/index.js +18 -20
- package/dist/components/overlays/command/index.d.ts +1 -1
- package/dist/components/overlays/command/index.js +32 -35
- package/dist/components/overlays/context-menu/index.d.ts +1 -1
- package/dist/components/overlays/context-menu/index.js +25 -28
- package/dist/components/overlays/dialog/index.d.ts +1 -1
- package/dist/components/overlays/dialog/index.js +33 -35
- package/dist/components/overlays/dropdown/index.d.ts +3 -3
- package/dist/components/overlays/dropdown/index.js +40 -43
- package/dist/components/overlays/popover/index.d.ts +1 -1
- package/dist/components/overlays/popover/index.js +22 -24
- package/dist/components/overlays/preview-card/index.d.ts +1 -1
- package/dist/components/overlays/preview-card/index.js +15 -17
- package/dist/components/overlays/sheet/index.d.ts +1 -1
- package/dist/components/overlays/sheet/index.js +20 -22
- package/dist/components/overlays/toast/index.d.ts +1 -1
- package/dist/components/overlays/toast/index.js +17 -19
- package/dist/components/overlays/tooltip/index.d.ts +1 -1
- package/dist/components/overlays/tooltip/index.js +13 -15
- package/dist/components/table/index.d.ts +1 -1
- package/dist/components/table/index.js +22 -24
- package/dist/index.d.ts +828 -795
- package/dist/index.js +509 -508
- package/dist/preset.d.ts +1 -1
- package/dist/preset.js +5 -5
- package/dist/primitives/code/index.d.ts +1 -1
- package/dist/primitives/code/index.js +8 -9
- package/dist/primitives/craft/index.d.ts +1 -1
- package/dist/primitives/craft/index.js +6 -8
- package/dist/primitives/fluid-hover/index.d.ts +1 -1
- package/dist/primitives/fluid-hover/index.js +18 -20
- package/dist/primitives/morph/index.d.ts +3 -3
- package/dist/primitives/morph/index.js +15 -17
- package/dist/primitives/motion/index.d.ts +1 -1
- package/dist/primitives/motion/index.js +15 -16
- package/dist/primitives/scroll-area/index.d.ts +1 -1
- package/dist/primitives/scroll-area/index.js +8 -9
- package/dist/primitives/sizes/index.d.ts +3 -3
- package/dist/primitives/sizes/index.js +17 -18
- package/dist/primitives/surface/index.d.ts +1 -1
- package/dist/primitives/surface/index.js +11 -12
- package/dist/shared/{components-jxgznftn.js → components-0q0sqfh4.js} +16 -16
- package/dist/shared/{components-x3rz4cyn.js → components-0sn7ypjw.js} +14 -14
- package/dist/shared/components-1434p1mh.js +123 -0
- package/dist/shared/{components-vc1k7yv2.js → components-1v7rxytx.js} +3 -3
- package/dist/shared/{components-6phwsry6.js → components-1z6tdadk.js} +25 -25
- package/dist/shared/{components-5zry9te1.js → components-27nnvrwe.js} +27 -27
- package/dist/shared/{components-ess3ch6w.js → components-2dxkv6zm.js} +23 -23
- package/dist/shared/{components-s5pkbjx1.js → components-2n3whx7z.js} +56 -56
- package/dist/shared/{components-v7es8aan.js → components-2nhgyh31.js} +15 -15
- package/dist/shared/{components-6t6nr33r.js → components-39jq9va1.js} +26 -26
- package/dist/shared/{components-4hh0gm0v.js → components-39vmfq9s.js} +61 -61
- package/dist/shared/{components-zx2hr57f.js → components-3fbbvq5j.js} +15 -15
- package/dist/shared/{components-6y1th6k4.js → components-3mkepka5.js} +31 -31
- package/dist/shared/{components-e46kf6cp.js → components-59efxjd9.js} +8 -8
- package/dist/shared/{components-rc63qsy6.js → components-5xc2j8jz.js} +10 -10
- package/dist/shared/{components-hzfp4tjb.js → components-7btqt08d.js} +42 -42
- package/dist/shared/{components-9p8s8n5q.js → components-7r3etddy.js} +22 -22
- package/dist/shared/{components-j65qt1mq.js → components-8ey44d79.js} +101 -101
- package/dist/shared/{components-hjkrv00c.js → components-8snj490h.js} +120 -23
- package/dist/shared/{components-40j34hdb.js → components-a86dytt0.js} +116 -116
- package/dist/shared/{components-tm88ghva.js → components-ar66gnt0.js} +58 -58
- package/dist/shared/{components-5pkcfprd.js → components-b2wyq2cq.js} +22 -22
- package/dist/shared/{components-vktws5r6.js → components-b3c5et5b.js} +73 -73
- package/dist/shared/{components-4xxtggzp.js → components-bshdmf75.js} +18 -18
- package/dist/shared/{components-kf2ehztc.js → components-chacnk61.js} +16 -16
- package/dist/shared/{components-7zp99w5d.js → components-cv16mryv.js} +2 -2
- package/dist/shared/{components-gjfrycb5.js → components-d6xtjht3.js} +66 -69
- package/dist/shared/{components-aaq3yk4f.js → components-dk0gjr5a.js} +43 -43
- package/dist/shared/{components-0f0as45n.js → components-ezxhrmer.js} +2 -2
- package/dist/shared/{components-7gv95yfy.js → components-frw34b65.js} +83 -83
- package/dist/shared/{components-s3yfvfkr.js → components-gc5vtq2f.js} +42 -42
- package/dist/shared/components-gf5s6ap9.js +42 -0
- package/dist/shared/{components-7cqq1sqy.js → components-gvr9w41t.js} +40 -40
- package/dist/shared/{components-x2xyckd5.js → components-gz8zf3ec.js} +20 -20
- package/dist/shared/{components-ed7cmssr.js → components-hawvy2qz.js} +18 -18
- package/dist/shared/{components-7nww01w4.js → components-hqeq3w9q.js} +34 -34
- package/dist/shared/{components-zvb11ker.js → components-hw9yk32z.js} +47 -47
- package/dist/shared/{components-y3cqdrgy.js → components-hyq23phv.js} +73 -54
- package/dist/shared/{components-bf2d9k02.js → components-jbbmdr74.js} +94 -94
- package/dist/shared/{components-vb033rns.js → components-jjw69c4c.js} +6 -6
- package/dist/shared/{components-r2gke5p6.js → components-jthe1pwb.js} +125 -125
- package/dist/shared/{components-tad5h7ta.js → components-jwst3vtj.js} +48 -48
- package/dist/shared/{components-xszag63d.js → components-k809mbn0.js} +12 -12
- package/dist/shared/{components-r22vtgqc.js → components-kvr7f9hy.js} +11 -11
- package/dist/shared/{components-r4jt6hgd.js → components-mjthm1kf.js} +6 -6
- package/dist/shared/{components-nn6xezy2.js → components-nb87fjy4.js} +226 -226
- package/dist/shared/{components-gndm6am4.js → components-ng72k97e.js} +17 -17
- package/dist/shared/{components-54nf2x99.js → components-pbmqctfa.js} +52 -45
- package/dist/shared/{components-peg09pzs.js → components-q5xj5c16.js} +11 -11
- package/dist/shared/{components-taxmgbnh.js → components-re6rs21k.js} +17 -17
- package/dist/shared/{components-r43mqnd6.js → components-rr7a6ja9.js} +46 -46
- package/dist/shared/{components-p2vmyfe1.js → components-s083f38z.js} +43 -43
- package/dist/shared/{components-bkvb6nem.js → components-s2bz1xpk.js} +11 -11
- package/dist/shared/components-ta7shw28.js +19 -0
- package/dist/shared/components-vc7vq5nz.js +32 -0
- package/dist/shared/{components-6hzwfmfd.js → components-vfbhxf5r.js} +8 -8
- package/dist/shared/{components-8hk9ve3r.js → components-wvp1m52g.js} +57 -57
- package/dist/shared/{components-brnzrp2t.js → components-xxvdw7k1.js} +41 -41
- package/dist/shared/{components-61ckf42z.js → components-zfnmn5d4.js} +64 -64
- package/dist/shared/{components-m5br529r.js → components-zrkzcayz.js} +2 -2
- package/dist/shared/{components-csxz9f52.js → components-zx6b6yby.js} +4 -4
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/dist/components/inputs/checkbox-group/index.d.ts +0 -50
- package/dist/components/inputs/checkbox-group/index.js +0 -23
- package/dist/components/inputs/input-copy/index.js +0 -18
- package/dist/components/inputs/input-message/index.js +0 -27
- package/dist/components/inputs/radio-group/index.js +0 -22
- package/dist/components/navigation/accordion/index.js +0 -30
- package/dist/components/thinking-indicator/index.js +0 -15
- package/dist/shared/components-74c20v2f.js +0 -32
- package/dist/shared/components-8hzbsfbd.js +0 -123
- package/dist/shared/components-dphg9gjr.js +0 -42
- package/dist/shared/components-kpbcms10.js +0 -9
- /package/dist/shared/{components-5vxtcp88.js → components-3ky44908.js} +0 -0
- /package/dist/shared/{components-4xxddc44.js → components-c6s6b43g.js} +0 -0
- /package/dist/shared/{components-nnnd2xef.js → components-men63rwj.js} +0 -0
- /package/dist/shared/{components-de8xsm9y.js → components-mhd39z7x.js} +0 -0
- /package/dist/shared/{components-dg0w8g5p.js → components-n7mjr357.js} +0 -0
- /package/dist/shared/{components-jw16snbn.js → components-vynjtrk6.js} +0 -0
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TimeColumns,
|
|
3
|
-
pad
|
|
4
|
-
} from "./components-r4jt6hgd.js";
|
|
5
|
-
import {
|
|
6
|
-
PickerInput,
|
|
7
|
-
PickerShell
|
|
8
|
-
} from "./components-hzfp4tjb.js";
|
|
9
1
|
import {
|
|
10
2
|
defaultLocale,
|
|
11
|
-
dividedColumns,
|
|
12
3
|
hourCycleOf,
|
|
13
|
-
parseTimeText
|
|
14
|
-
|
|
4
|
+
parseTimeText,
|
|
5
|
+
dividedColumns
|
|
6
|
+
} from "./components-gz8zf3ec.js";
|
|
7
|
+
import {
|
|
8
|
+
cn2
|
|
9
|
+
} from "./components-ezxhrmer.js";
|
|
15
10
|
import {
|
|
16
11
|
useControllableState
|
|
17
|
-
} from "./components-
|
|
12
|
+
} from "./components-n7mjr357.js";
|
|
13
|
+
import {
|
|
14
|
+
PickerShell,
|
|
15
|
+
PickerInput
|
|
16
|
+
} from "./components-7btqt08d.js";
|
|
18
17
|
import {
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
pad,
|
|
19
|
+
TimeColumns
|
|
20
|
+
} from "./components-mjthm1kf.js";
|
|
21
21
|
|
|
22
22
|
// components/inputs/date-time/time-picker/index.tsx
|
|
23
23
|
import { format, set } from "date-fns";
|
|
@@ -28,7 +28,7 @@ var toTime = (value) => {
|
|
|
28
28
|
return hours === undefined || minutes === undefined ? null : { hours, minutes };
|
|
29
29
|
};
|
|
30
30
|
var toValue = ({ hours, minutes }) => `${pad(hours)}:${pad(minutes)}`;
|
|
31
|
-
function
|
|
31
|
+
function TimePicker2({
|
|
32
32
|
value: valueProp,
|
|
33
33
|
defaultValue = null,
|
|
34
34
|
onValueChange,
|
|
@@ -92,7 +92,7 @@ function TimePicker({
|
|
|
92
92
|
tier,
|
|
93
93
|
className,
|
|
94
94
|
children: /* @__PURE__ */ jsx("div", {
|
|
95
|
-
className:
|
|
95
|
+
className: cn2(dividedColumns, "h-56"),
|
|
96
96
|
children: /* @__PURE__ */ jsx(TimeColumns, {
|
|
97
97
|
value: time,
|
|
98
98
|
onValueChange: (next) => setValue(toValue(next)),
|
|
@@ -105,6 +105,6 @@ function TimePicker({
|
|
|
105
105
|
})
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
|
-
var time_picker_default =
|
|
108
|
+
var time_picker_default = TimePicker2;
|
|
109
109
|
|
|
110
|
-
export {
|
|
110
|
+
export { TimePicker2, time_picker_default };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GOO_BLUR_RATIO,
|
|
3
|
-
GOO_MATRIX
|
|
4
|
-
} from "./components-7nww01w4.js";
|
|
5
1
|
import {
|
|
6
2
|
useReduceMotion
|
|
7
|
-
} from "./components-
|
|
3
|
+
} from "./components-men63rwj.js";
|
|
4
|
+
import {
|
|
5
|
+
GOO_MATRIX,
|
|
6
|
+
GOO_BLUR_RATIO
|
|
7
|
+
} from "./components-hqeq3w9q.js";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
} from "./components-
|
|
9
|
+
cn2
|
|
10
|
+
} from "./components-ezxhrmer.js";
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
} from "./components-
|
|
12
|
+
spring2
|
|
13
|
+
} from "./components-1v7rxytx.js";
|
|
14
14
|
|
|
15
15
|
// lib/goo-indicator.tsx
|
|
16
16
|
import { animate, motion, useMotionValue } from "motion/react";
|
|
@@ -113,7 +113,7 @@ function GooLayer({ active, blur, box, fill, children }) {
|
|
|
113
113
|
style: { ...layer, filter: active ? `url(#${id})` : undefined },
|
|
114
114
|
children: /* @__PURE__ */ jsx("div", {
|
|
115
115
|
ref: probe,
|
|
116
|
-
className:
|
|
116
|
+
className: cn2(fill, "absolute"),
|
|
117
117
|
style: { left: -layer.left, top: -layer.top },
|
|
118
118
|
children
|
|
119
119
|
})
|
|
@@ -126,7 +126,7 @@ function GooIndicator({
|
|
|
126
126
|
from,
|
|
127
127
|
className,
|
|
128
128
|
shadow,
|
|
129
|
-
transition =
|
|
129
|
+
transition = spring2.moderate,
|
|
130
130
|
opacity = 1
|
|
131
131
|
}) {
|
|
132
132
|
const reduced = useReduceMotion();
|
|
@@ -165,7 +165,7 @@ function GooIndicator({
|
|
|
165
165
|
}, [rect.left, rect.top, rect.width, rect.height]);
|
|
166
166
|
const melting = trails.length > 0;
|
|
167
167
|
const linger = travel ? { ...travel, delay: (travel.duration ?? 0) / 3 } : undefined;
|
|
168
|
-
const shape =
|
|
168
|
+
const shape = cn2("pointer-events-none absolute top-0 left-0", className);
|
|
169
169
|
const box = trails.reduce((all, trail) => union(all, trail.from), union(read(), rect));
|
|
170
170
|
const drop = (trail) => setTrails((list) => list.filter((t) => t.id !== trail.id));
|
|
171
171
|
return /* @__PURE__ */ jsxs(motion.div, {
|
|
@@ -173,18 +173,18 @@ function GooIndicator({
|
|
|
173
173
|
className: "pointer-events-none absolute top-0 left-0",
|
|
174
174
|
initial: false,
|
|
175
175
|
animate: { opacity },
|
|
176
|
-
transition: { duration:
|
|
176
|
+
transition: { duration: spring2.fast.duration },
|
|
177
177
|
children: [
|
|
178
178
|
shadow && /* @__PURE__ */ jsxs(Fragment, {
|
|
179
179
|
children: [
|
|
180
180
|
trails.map((trail) => /* @__PURE__ */ jsx(motion.div, {
|
|
181
|
-
className:
|
|
181
|
+
className: cn2(shape, shadow),
|
|
182
182
|
initial: { ...toTarget(trail.from), opacity: 1 },
|
|
183
183
|
animate: { ...toTarget(trail.to), opacity: 0 },
|
|
184
184
|
transition: linger
|
|
185
185
|
}, trail.id)),
|
|
186
186
|
/* @__PURE__ */ jsx(motion.div, {
|
|
187
|
-
className:
|
|
187
|
+
className: cn2(shape, shadow, !melting && "invisible"),
|
|
188
188
|
style: { x, y, width, height }
|
|
189
189
|
})
|
|
190
190
|
]
|
|
@@ -204,7 +204,7 @@ function GooIndicator({
|
|
|
204
204
|
}, trail.id)),
|
|
205
205
|
/* @__PURE__ */ jsx(motion.div, {
|
|
206
206
|
ref: lead,
|
|
207
|
-
className:
|
|
207
|
+
className: cn2(shape, !melting && shadow),
|
|
208
208
|
style: { x, y, width, height }
|
|
209
209
|
})
|
|
210
210
|
]
|
|
@@ -34,7 +34,7 @@ function useShape() {
|
|
|
34
34
|
return shapeMap.rounded;
|
|
35
35
|
return ctx.classes;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function ShapeProvider2({ children, defaultShape = "rounded" }) {
|
|
38
38
|
const [shape, setShapeState] = useState(defaultShape);
|
|
39
39
|
const transitionTimeoutRef = useRef(null);
|
|
40
40
|
const transitionShape = useCallback((callback) => {
|
|
@@ -59,4 +59,4 @@ function ShapeProvider({ children, defaultShape = "rounded" }) {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export { shapeMap, useShape,
|
|
62
|
+
export { shapeMap, useShape, ShapeProvider2 };
|
|
@@ -1,46 +1,43 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./components-
|
|
2
|
+
cn2
|
|
3
|
+
} from "./components-ezxhrmer.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./components-
|
|
7
|
-
import {
|
|
8
|
-
Button
|
|
9
|
-
} from "./components-5pkcfprd.js";
|
|
5
|
+
FluidHoverHighlight2
|
|
6
|
+
} from "./components-kvr7f9hy.js";
|
|
10
7
|
import {
|
|
11
8
|
useIcon
|
|
12
|
-
} from "./components-
|
|
9
|
+
} from "./components-zrkzcayz.js";
|
|
13
10
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} from "./components-csxz9f52.js";
|
|
11
|
+
useShape
|
|
12
|
+
} from "./components-cv16mryv.js";
|
|
17
13
|
import {
|
|
18
|
-
|
|
19
|
-
} from "./components-
|
|
14
|
+
useSize2
|
|
15
|
+
} from "./components-0sn7ypjw.js";
|
|
20
16
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} from "./components-
|
|
24
|
-
import {
|
|
25
|
-
useShape
|
|
26
|
-
} from "./components-7zp99w5d.js";
|
|
17
|
+
surfaceClasses2,
|
|
18
|
+
SurfaceProvider2
|
|
19
|
+
} from "./components-zx6b6yby.js";
|
|
27
20
|
import {
|
|
28
21
|
useControllableState
|
|
29
|
-
} from "./components-
|
|
22
|
+
} from "./components-n7mjr357.js";
|
|
23
|
+
import {
|
|
24
|
+
useFluidHover2,
|
|
25
|
+
useRegisterFluidHoverItem2
|
|
26
|
+
} from "./components-59efxjd9.js";
|
|
30
27
|
import {
|
|
31
|
-
|
|
32
|
-
} from "./components-
|
|
28
|
+
SizeProvider2
|
|
29
|
+
} from "./components-jjw69c4c.js";
|
|
33
30
|
import {
|
|
34
|
-
|
|
35
|
-
} from "./components-
|
|
31
|
+
Button2
|
|
32
|
+
} from "./components-b2wyq2cq.js";
|
|
36
33
|
import {
|
|
37
|
-
|
|
38
|
-
} from "./components-
|
|
34
|
+
Tooltip2
|
|
35
|
+
} from "./components-ng72k97e.js";
|
|
39
36
|
import {
|
|
40
|
-
|
|
41
|
-
} from "./components-
|
|
37
|
+
spring2
|
|
38
|
+
} from "./components-1v7rxytx.js";
|
|
42
39
|
|
|
43
|
-
// components/
|
|
40
|
+
// components/AI/input-message/index.tsx
|
|
44
41
|
import { AnimatePresence, motion, Reorder, useReducedMotion } from "motion/react";
|
|
45
42
|
import {
|
|
46
43
|
forwardRef,
|
|
@@ -53,7 +50,7 @@ import {
|
|
|
53
50
|
useState as useState2
|
|
54
51
|
} from "react";
|
|
55
52
|
|
|
56
|
-
// components/
|
|
53
|
+
// components/AI/input-message/file-thumbnail.tsx
|
|
57
54
|
import { useEffect, useState } from "react";
|
|
58
55
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
59
56
|
var pdfjsPromise = null;
|
|
@@ -82,7 +79,7 @@ async function renderPdfFirstPage(file, targetWidth) {
|
|
|
82
79
|
await page.render({ canvas, viewport }).promise;
|
|
83
80
|
return canvas.toDataURL("image/png");
|
|
84
81
|
}
|
|
85
|
-
function
|
|
82
|
+
function FileThumbnail2({ file, size, className }) {
|
|
86
83
|
const shape = useShape();
|
|
87
84
|
const isImage = file.type.startsWith("image/");
|
|
88
85
|
const isPdf = file.type === "application/pdf";
|
|
@@ -119,7 +116,7 @@ function FileThumbnail({ file, size, className }) {
|
|
|
119
116
|
const previewUrl = imageUrl ?? pdfUrl;
|
|
120
117
|
const isPending = isImage && !imageUrl || isPdf && !pdfUrl && !pdfError;
|
|
121
118
|
return /* @__PURE__ */ jsx("div", {
|
|
122
|
-
className:
|
|
119
|
+
className: cn2("relative shrink-0 overflow-hidden bg-accent border border-border", shape.bg, className),
|
|
123
120
|
style: { width: size, height: size },
|
|
124
121
|
children: previewUrl ? /* @__PURE__ */ jsx("img", {
|
|
125
122
|
src: previewUrl,
|
|
@@ -159,7 +156,7 @@ function FileThumbnail({ file, size, className }) {
|
|
|
159
156
|
});
|
|
160
157
|
}
|
|
161
158
|
|
|
162
|
-
// components/
|
|
159
|
+
// components/AI/input-message/index.tsx
|
|
163
160
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
164
161
|
var useIsoLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect2;
|
|
165
162
|
function useRegionHeight() {
|
|
@@ -196,22 +193,22 @@ function useIsTouch() {
|
|
|
196
193
|
var DEFAULT_ACCEPT = "image/png,image/jpeg,application/pdf";
|
|
197
194
|
var NO_FILES = [];
|
|
198
195
|
var NO_QUEUE = [];
|
|
199
|
-
var FilePreviewTile = forwardRef(function
|
|
196
|
+
var FilePreviewTile = forwardRef(function FilePreviewTile({ file, onRemove, size }, ref) {
|
|
200
197
|
const XIcon = useIcon("x");
|
|
201
198
|
return /* @__PURE__ */ jsxs2(motion.div, {
|
|
202
199
|
ref,
|
|
203
200
|
layout: true,
|
|
204
201
|
initial: { opacity: 0, scale: 0.9 },
|
|
205
202
|
animate: { opacity: 1, scale: 1 },
|
|
206
|
-
exit: { opacity: 0, scale: 0.9, transition:
|
|
207
|
-
transition:
|
|
203
|
+
exit: { opacity: 0, scale: 0.9, transition: spring2.fast.exit },
|
|
204
|
+
transition: spring2.fast,
|
|
208
205
|
className: "relative shrink-0 cursor-default group/tile",
|
|
209
206
|
children: [
|
|
210
|
-
/* @__PURE__ */ jsx2(
|
|
207
|
+
/* @__PURE__ */ jsx2(FileThumbnail2, {
|
|
211
208
|
file,
|
|
212
209
|
size
|
|
213
210
|
}),
|
|
214
|
-
/* @__PURE__ */ jsx2(
|
|
211
|
+
/* @__PURE__ */ jsx2(Tooltip2, {
|
|
215
212
|
content: "Remove",
|
|
216
213
|
side: "top",
|
|
217
214
|
children: /* @__PURE__ */ jsx2("button", {
|
|
@@ -234,7 +231,7 @@ var FilePreviewTile = forwardRef(function FilePreviewTile2({ file, onRemove, siz
|
|
|
234
231
|
function QueuedRow({ item, index, total, reduceMotion, isTouch, onEdit, onRemove, onMove }) {
|
|
235
232
|
const XIcon = useIcon("x");
|
|
236
233
|
const ImageIcon = useIcon("image");
|
|
237
|
-
const compactStep =
|
|
234
|
+
const compactStep = useSize2().variant === "compact";
|
|
238
235
|
const fileCount = item.files.length;
|
|
239
236
|
const label = item.text || `${fileCount} attachment${fileCount === 1 ? "" : "s"}`;
|
|
240
237
|
return /* @__PURE__ */ jsxs2(Reorder.Item, {
|
|
@@ -242,8 +239,8 @@ function QueuedRow({ item, index, total, reduceMotion, isTouch, onEdit, onRemove
|
|
|
242
239
|
layout: true,
|
|
243
240
|
initial: reduceMotion ? { opacity: 0 } : { opacity: 0, scale: 0.97 },
|
|
244
241
|
animate: { opacity: 1, scale: 1 },
|
|
245
|
-
exit: reduceMotion ? { opacity: 0 } : { opacity: 0, scale: 0.97, transition:
|
|
246
|
-
transition:
|
|
242
|
+
exit: reduceMotion ? { opacity: 0 } : { opacity: 0, scale: 0.97, transition: spring2.fast.exit },
|
|
243
|
+
transition: spring2.fast,
|
|
247
244
|
"aria-label": `Queued message ${index + 1} of ${total}: ${label}`,
|
|
248
245
|
tabIndex: 0,
|
|
249
246
|
onDoubleClick: () => onEdit(item),
|
|
@@ -259,7 +256,7 @@ function QueuedRow({ item, index, total, reduceMotion, isTouch, onEdit, onRemove
|
|
|
259
256
|
onMove(item, e.key === "ArrowUp" ? -1 : 1);
|
|
260
257
|
}
|
|
261
258
|
},
|
|
262
|
-
className:
|
|
259
|
+
className: cn2("group/qrow flex items-center gap-2 rounded-lg bg-muted", compactStep ? "h-7 px-2 text-body-compact" : "h-8 px-2.5 text-body", "text-foreground/85 select-none outline-none", "cursor-grab active:cursor-grabbing", "focus-visible:ring-1 focus-visible:ring-focus-ring", "weight-normal"),
|
|
263
260
|
children: [
|
|
264
261
|
fileCount > 0 && /* @__PURE__ */ jsxs2("span", {
|
|
265
262
|
className: "flex shrink-0 items-center gap-0.5 text-muted-foreground",
|
|
@@ -277,7 +274,7 @@ function QueuedRow({ item, index, total, reduceMotion, isTouch, onEdit, onRemove
|
|
|
277
274
|
className: "min-w-0 flex-1 truncate [text-box:trim-both_cap_alphabetic] py-1 -my-1",
|
|
278
275
|
children: label
|
|
279
276
|
}),
|
|
280
|
-
/* @__PURE__ */ jsx2(
|
|
277
|
+
/* @__PURE__ */ jsx2(Tooltip2, {
|
|
281
278
|
content: "Remove",
|
|
282
279
|
side: "top",
|
|
283
280
|
children: /* @__PURE__ */ jsx2("button", {
|
|
@@ -288,7 +285,7 @@ function QueuedRow({ item, index, total, reduceMotion, isTouch, onEdit, onRemove
|
|
|
288
285
|
onRemove(item);
|
|
289
286
|
},
|
|
290
287
|
"aria-label": `Remove queued message: ${label}`,
|
|
291
|
-
className:
|
|
288
|
+
className: cn2("shrink-0 flex h-5 w-5 items-center justify-center rounded-full", "text-muted-foreground hover:text-foreground hover:bg-hover", isTouch ? "opacity-100" : "opacity-0 group-hover/qrow:opacity-100 focus-visible:opacity-100", "transition-opacity duration-fast cursor-pointer outline-none", "focus-visible:ring-1 focus-visible:ring-focus-ring"),
|
|
292
289
|
children: /* @__PURE__ */ jsx2(XIcon, {
|
|
293
290
|
size: 13,
|
|
294
291
|
strokeWidth: 2.5
|
|
@@ -301,16 +298,16 @@ function QueuedRow({ item, index, total, reduceMotion, isTouch, onEdit, onRemove
|
|
|
301
298
|
function SuggestionRow({ text, index, active, keyHint, optionId, registerItem, onSelect }) {
|
|
302
299
|
const EnterIcon = useIcon("corner-down-left");
|
|
303
300
|
const ArrowDownIcon = useIcon("arrow-down");
|
|
304
|
-
const compactStep =
|
|
301
|
+
const compactStep = useSize2().variant === "compact";
|
|
305
302
|
const ref = useRef(null);
|
|
306
|
-
|
|
303
|
+
useRegisterFluidHoverItem2(registerItem, index, ref);
|
|
307
304
|
return /* @__PURE__ */ jsxs2("div", {
|
|
308
305
|
ref,
|
|
309
306
|
id: optionId,
|
|
310
307
|
role: "option",
|
|
311
308
|
"aria-selected": active,
|
|
312
309
|
onClick: onSelect,
|
|
313
|
-
className:
|
|
310
|
+
className: cn2("relative flex cursor-pointer items-center gap-2", compactStep ? "h-7 px-2 text-subtitle-compact" : "h-8 px-2.5 text-subtitle", "text-muted-foreground transition-colors duration-fast", active && "text-foreground", "weight-normal"),
|
|
314
311
|
children: [
|
|
315
312
|
/* @__PURE__ */ jsx2("span", {
|
|
316
313
|
className: "min-w-0 flex-1 truncate [text-box:trim-both_cap_alphabetic] py-1 -my-1",
|
|
@@ -321,12 +318,12 @@ function SuggestionRow({ text, index, active, keyHint, optionId, registerItem, o
|
|
|
321
318
|
className: "shrink-0 text-muted-foreground/70 transition-opacity duration-fast"
|
|
322
319
|
}) : /* @__PURE__ */ jsx2(EnterIcon, {
|
|
323
320
|
size: 13,
|
|
324
|
-
className:
|
|
321
|
+
className: cn2("shrink-0 transition-opacity duration-fast", active ? "opacity-100" : "opacity-0")
|
|
325
322
|
})
|
|
326
323
|
]
|
|
327
324
|
});
|
|
328
325
|
}
|
|
329
|
-
var
|
|
326
|
+
var InputMessage2 = forwardRef(({
|
|
330
327
|
size,
|
|
331
328
|
value: valueProp,
|
|
332
329
|
defaultValue,
|
|
@@ -363,7 +360,7 @@ var InputMessage = forwardRef(({
|
|
|
363
360
|
...props
|
|
364
361
|
}, ref) => {
|
|
365
362
|
const shape = useShape();
|
|
366
|
-
const compactStep =
|
|
363
|
+
const compactStep = useSize2(size).variant === "compact";
|
|
367
364
|
const ArrowUpIcon = useIcon("arrow-up");
|
|
368
365
|
const reduceMotion = useReducedMotion() ?? false;
|
|
369
366
|
const isTouch = useIsTouch();
|
|
@@ -400,7 +397,7 @@ var InputMessage = forwardRef(({
|
|
|
400
397
|
const [filesRegionRef, filesRegionHeight] = useRegionHeight();
|
|
401
398
|
const [queueRegionRef, queueRegionHeight] = useRegionHeight();
|
|
402
399
|
const [suggestionsRegionRef, suggestionsRegionHeight] = useRegionHeight();
|
|
403
|
-
const suggestionHover =
|
|
400
|
+
const suggestionHover = useFluidHover2(suggestionListRef);
|
|
404
401
|
const {
|
|
405
402
|
activeIndex: activeSuggestion,
|
|
406
403
|
setActiveIndex: setActiveSuggestion,
|
|
@@ -754,12 +751,12 @@ var InputMessage = forwardRef(({
|
|
|
754
751
|
onDragOver: handleDragOver,
|
|
755
752
|
onDragLeave: handleDragLeave,
|
|
756
753
|
onDrop: handleDrop,
|
|
757
|
-
className:
|
|
754
|
+
className: cn2("flex flex-col gap-1 p-2 transition-[box-shadow,color] duration-fast", surfaceClasses2(2, 2), shape.container, clickToFocus && !disabled && "cursor-text", disabled && "opacity-50 pointer-events-none", className),
|
|
758
755
|
style: edgeShadow ? { boxShadow: edgeShadow, ...style } : style,
|
|
759
756
|
onMouseEnter: () => setHovered(true),
|
|
760
757
|
onMouseLeave: () => setHovered(false),
|
|
761
758
|
...props,
|
|
762
|
-
children: /* @__PURE__ */ jsxs2(
|
|
759
|
+
children: /* @__PURE__ */ jsxs2(SurfaceProvider2, {
|
|
763
760
|
value: 2,
|
|
764
761
|
children: [
|
|
765
762
|
supportsFiles && /* @__PURE__ */ jsx2("input", {
|
|
@@ -778,7 +775,7 @@ var InputMessage = forwardRef(({
|
|
|
778
775
|
initial: { height: 0, opacity: 0 },
|
|
779
776
|
animate: { height: filesRegionHeight ?? 0, opacity: 1 },
|
|
780
777
|
exit: { height: 0, opacity: 0 },
|
|
781
|
-
transition: { ...
|
|
778
|
+
transition: { ...spring2.moderate, bounce: 0 },
|
|
782
779
|
className: "overflow-hidden",
|
|
783
780
|
children: /* @__PURE__ */ jsx2("div", {
|
|
784
781
|
ref: filesRegionRef,
|
|
@@ -801,7 +798,7 @@ var InputMessage = forwardRef(({
|
|
|
801
798
|
initial: { height: 0, opacity: 0 },
|
|
802
799
|
animate: { height: queueRegionHeight ?? 0, opacity: 1 },
|
|
803
800
|
exit: { height: 0, opacity: 0 },
|
|
804
|
-
transition: { ...
|
|
801
|
+
transition: { ...spring2.moderate, bounce: 0 },
|
|
805
802
|
className: "overflow-hidden",
|
|
806
803
|
children: /* @__PURE__ */ jsx2(Reorder.Group, {
|
|
807
804
|
ref: queueRegionRef,
|
|
@@ -854,12 +851,12 @@ var InputMessage = forwardRef(({
|
|
|
854
851
|
"aria-label": textareaProps?.["aria-label"] ?? "Message",
|
|
855
852
|
"aria-describedby": [showGhost ? ghostHintId : null, textareaDescribedBy].filter(Boolean).join(" ") || undefined,
|
|
856
853
|
"aria-activedescendant": activeSuggestion != null ? `${suggestionListId}-${activeSuggestion}` : undefined,
|
|
857
|
-
className:
|
|
854
|
+
className: cn2("w-full resize-none rounded-none bg-transparent outline-none", "text-foreground placeholder:text-muted-foreground", compactStep ? "text-subtitle-compact leading-4.5 px-1.5 py-1.5" : "text-subtitle leading-5 px-2 py-2", "weight-normal"),
|
|
858
855
|
...restTextareaProps
|
|
859
856
|
}),
|
|
860
857
|
showGhost && /* @__PURE__ */ jsx2("div", {
|
|
861
858
|
"aria-hidden": "true",
|
|
862
|
-
className:
|
|
859
|
+
className: cn2("pointer-events-none absolute inset-0 overflow-hidden text-muted-foreground", compactStep ? "text-subtitle-compact leading-4.5 px-1.5 py-1.5" : "text-subtitle leading-5 px-2 py-2", "weight-normal"),
|
|
863
860
|
children: /* @__PURE__ */ jsxs2("span", {
|
|
864
861
|
className: "flex max-w-full items-center gap-1.5",
|
|
865
862
|
children: [
|
|
@@ -868,7 +865,7 @@ var InputMessage = forwardRef(({
|
|
|
868
865
|
children: placeholderSuggestion
|
|
869
866
|
}),
|
|
870
867
|
/* @__PURE__ */ jsx2("kbd", {
|
|
871
|
-
className:
|
|
868
|
+
className: cn2("inline-flex shrink-0 -translate-y-px items-center rounded-box border border-border bg-background px-1 font-sans text-muted-foreground", compactStep ? "h-4 text-micro-compact" : "h-[18px] text-micro"),
|
|
872
869
|
children: "Tab"
|
|
873
870
|
})
|
|
874
871
|
]
|
|
@@ -886,7 +883,7 @@ var InputMessage = forwardRef(({
|
|
|
886
883
|
]
|
|
887
884
|
}),
|
|
888
885
|
/* @__PURE__ */ jsxs2("div", {
|
|
889
|
-
className:
|
|
886
|
+
className: cn2("flex items-center justify-between", compactStep ? "gap-1.5 [&_button]:h-6 [&_button.w-7]:w-6 [&_button]:text-caption-compact" : "gap-2"),
|
|
890
887
|
children: [
|
|
891
888
|
/* @__PURE__ */ jsx2("div", {
|
|
892
889
|
className: "flex items-center gap-1.5 min-w-0",
|
|
@@ -896,7 +893,7 @@ var InputMessage = forwardRef(({
|
|
|
896
893
|
className: "flex items-center gap-1.5 shrink-0",
|
|
897
894
|
children: [
|
|
898
895
|
rightContent,
|
|
899
|
-
/* @__PURE__ */ jsx2(
|
|
896
|
+
/* @__PURE__ */ jsx2(Button2, {
|
|
900
897
|
type: "button",
|
|
901
898
|
variant: "primary",
|
|
902
899
|
size: "icon-sm",
|
|
@@ -909,14 +906,14 @@ var InputMessage = forwardRef(({
|
|
|
909
906
|
children: /* @__PURE__ */ jsx2(motion.span, {
|
|
910
907
|
initial: reduceMotion ? { opacity: 0 } : { opacity: 0, scale: 0.6 },
|
|
911
908
|
animate: { opacity: 1, scale: 1 },
|
|
912
|
-
exit: reduceMotion ? { opacity: 0 } : { opacity: 0, scale: 0.6, transition:
|
|
913
|
-
transition:
|
|
909
|
+
exit: reduceMotion ? { opacity: 0 } : { opacity: 0, scale: 0.6, transition: spring2.fast.exit },
|
|
910
|
+
transition: spring2.fast,
|
|
914
911
|
className: "flex items-center justify-center leading-none",
|
|
915
912
|
children: buttonMode === "stop" ? /* @__PURE__ */ jsx2("span", {
|
|
916
913
|
className: "h-3 w-3 rounded-glyph bg-current"
|
|
917
914
|
}) : /* @__PURE__ */ jsx2(ArrowUpIcon, {
|
|
918
915
|
size: compactStep ? 15 : 19,
|
|
919
|
-
className:
|
|
916
|
+
className: cn2("block", compactStep ? "!h-[15px] !w-[15px]" : "!h-[19px] !w-[19px]")
|
|
920
917
|
})
|
|
921
918
|
}, buttonMode === "stop" ? "stop" : "arrow")
|
|
922
919
|
})
|
|
@@ -931,7 +928,7 @@ var InputMessage = forwardRef(({
|
|
|
931
928
|
initial: { height: 0, opacity: 0 },
|
|
932
929
|
animate: { height: suggestionsRegionHeight ?? 0, opacity: 1 },
|
|
933
930
|
exit: { height: 0 },
|
|
934
|
-
transition: { ...
|
|
931
|
+
transition: { ...spring2.moderate, bounce: 0 },
|
|
935
932
|
className: "-mx-2 -mt-1 overflow-hidden",
|
|
936
933
|
children: /* @__PURE__ */ jsxs2("div", {
|
|
937
934
|
ref: (el) => {
|
|
@@ -947,7 +944,7 @@ var InputMessage = forwardRef(({
|
|
|
947
944
|
onClick: suggestionHandlers.onClick,
|
|
948
945
|
className: "relative mt-2 flex flex-col border-t border-border/60 px-1.5 pt-1.5",
|
|
949
946
|
children: [
|
|
950
|
-
/* @__PURE__ */ jsx2(
|
|
947
|
+
/* @__PURE__ */ jsx2(FluidHoverHighlight2, {
|
|
951
948
|
hover: suggestionHover,
|
|
952
949
|
className: shape.bg
|
|
953
950
|
}),
|
|
@@ -973,12 +970,12 @@ var InputMessage = forwardRef(({
|
|
|
973
970
|
]
|
|
974
971
|
})
|
|
975
972
|
});
|
|
976
|
-
return size ? /* @__PURE__ */ jsx2(
|
|
973
|
+
return size ? /* @__PURE__ */ jsx2(SizeProvider2, {
|
|
977
974
|
size,
|
|
978
975
|
children: composer
|
|
979
976
|
}) : composer;
|
|
980
977
|
});
|
|
981
|
-
|
|
982
|
-
var input_message_default =
|
|
978
|
+
InputMessage2.displayName = "InputMessage";
|
|
979
|
+
var input_message_default = InputMessage2;
|
|
983
980
|
|
|
984
|
-
export {
|
|
981
|
+
export { FileThumbnail2, InputMessage2, input_message_default };
|