@justanarthur/modo-ui 0.2.0 → 0.4.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 +20 -16
- package/dist/blocks/sidebar-app/index.js +7 -7
- package/dist/components/{inputs → AI}/input-message/index.js +2 -2
- package/dist/components/AI/thinking-indicator/index.js +13 -0
- package/dist/components/accordion/index.js +28 -0
- package/dist/components/card/index.js +2 -2
- 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-group → checkbox}/index.js +7 -6
- package/dist/components/inputs/color-picker/index.js +2 -2
- package/dist/components/inputs/combobox/index.d.ts +8 -7
- package/dist/components/inputs/combobox/index.js +3 -3
- package/dist/components/inputs/date-time/calendar/index.js +3 -3
- package/dist/components/inputs/date-time/date-picker/index.d.ts +7 -3
- package/dist/components/inputs/date-time/date-picker/index.js +8 -8
- package/dist/components/inputs/date-time/date-range-picker/index.d.ts +7 -3
- package/dist/components/inputs/date-time/date-range-picker/index.js +7 -7
- package/dist/components/inputs/date-time/duration-picker/index.d.ts +7 -3
- package/dist/components/inputs/date-time/duration-picker/index.js +7 -7
- package/dist/components/inputs/date-time/month-picker/index.d.ts +7 -3
- package/dist/components/inputs/date-time/month-picker/index.js +6 -6
- package/dist/components/inputs/date-time/time-picker/index.d.ts +7 -3
- package/dist/components/inputs/date-time/time-picker/index.js +7 -7
- package/dist/components/inputs/input/index.d.ts +5 -1
- package/dist/components/inputs/input/index.js +2 -2
- package/dist/components/inputs/{radio-group → radio}/index.d.ts +30 -30
- package/dist/components/inputs/{radio-group → radio}/index.js +7 -6
- package/dist/components/inputs/search/index.js +3 -3
- package/dist/components/inputs/select/index.js +2 -2
- package/dist/components/inputs/switch/index.d.ts +27 -6
- package/dist/components/inputs/switch/index.js +8 -1
- package/dist/components/inputs/textarea/index.d.ts +46 -0
- package/dist/components/inputs/textarea/index.js +13 -0
- package/dist/components/navigation/sidebar/index.js +4 -4
- package/dist/components/navigation/tabs/index.js +2 -2
- package/dist/components/navigation/tabs-subtle/index.js +2 -2
- package/dist/components/overlays/command/index.js +2 -2
- package/dist/components/overlays/context-menu/index.js +3 -3
- package/dist/components/overlays/dropdown/index.d.ts +2 -2
- package/dist/components/overlays/dropdown/index.js +2 -2
- package/dist/components/table/index.js +2 -2
- package/dist/index.d.ts +896 -808
- package/dist/index.js +57 -50
- package/dist/primitives/fluid-hover/index.js +2 -2
- package/dist/primitives/morph/index.d.ts +2 -2
- package/dist/primitives/sizes/index.d.ts +2 -2
- package/dist/shared/{components-1rfwbyyc.js → components-1z6tdadk.js} +1 -1
- package/dist/shared/{components-7x9kawxv.js → components-27nnvrwe.js} +1 -1
- package/dist/shared/{components-mhd39z7x.js → components-3myrw7ne.js} +36 -1
- package/dist/shared/{components-gvr9w41t.js → components-50m950y9.js} +19 -23
- package/dist/shared/{components-asr5pg50.js → components-8snj490h.js} +106 -9
- package/dist/shared/{components-1xekx2hx.js → components-ar66gnt0.js} +1 -1
- package/dist/shared/{components-3wk0w46f.js → components-b3c5et5b.js} +1 -1
- package/dist/shared/{components-yh3kwdhr.js → components-d6xtjht3.js} +3 -3
- package/dist/shared/{components-ytb2tefr.js → components-hyq23phv.js} +39 -20
- package/dist/shared/{components-q4daerx0.js → components-mjthm1kf.js} +1 -1
- package/dist/shared/{components-ca2c898n.js → components-mqyvvh8k.js} +1 -1
- package/dist/shared/{components-4cnjmgex.js → components-nsjec21k.js} +4 -2
- package/dist/shared/{components-7ans7ce5.js → components-nyq0rym2.js} +5 -3
- package/dist/shared/{components-ny774h8p.js → components-pbmqctfa.js} +15 -8
- package/dist/shared/{components-7btqt08d.js → components-qtqxgfrb.js} +17 -20
- package/dist/shared/components-rd9tbsqv.js +89 -0
- package/dist/shared/{components-1j9791sn.js → components-s083f38z.js} +5 -5
- package/dist/shared/components-ta7shw28.js +19 -0
- package/dist/shared/{components-3gae8nta.js → components-tcee5k0s.js} +22 -24
- package/dist/shared/{components-ez65vtbq.js → components-wshd8f3n.js} +5 -3
- package/dist/shared/{components-v7wtz8hk.js → components-wtbesgdp.js} +6 -4
- package/dist/shared/{components-66mv71kx.js → components-xxvdw7k1.js} +1 -1
- package/dist/shared/{components-njzgqdwy.js → components-ye0ze0h8.js} +2 -2
- package/dist/shared/{components-cbxjn9p8.js → components-zwhtxm15.js} +5 -3
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/components/inputs/checkbox-group/index.d.ts +0 -50
- package/dist/components/inputs/input-copy/index.js +0 -16
- package/dist/components/navigation/accordion/index.js +0 -28
- package/dist/components/thinking-indicator/index.js +0 -13
- /package/dist/components/{inputs → AI}/input-message/index.d.ts +0 -0
- /package/dist/components/{thinking-indicator → AI/thinking-indicator}/index.d.ts +0 -0
- /package/dist/components/{navigation/accordion → accordion}/index.d.ts +0 -0
- /package/dist/shared/{components-0ke6xada.js → components-1434p1mh.js} +0 -0
- /package/dist/shared/{components-h2dpcwgc.js → components-2dxkv6zm.js} +0 -0
- /package/dist/shared/{components-8fpr3s4p.js → components-39vmfq9s.js} +0 -0
- /package/dist/shared/{components-nh8tma1n.js → components-a86dytt0.js} +0 -0
- /package/dist/shared/{components-v6xp325t.js → components-dk0gjr5a.js} +0 -0
- /package/dist/shared/{components-62ybc7t2.js → components-frw34b65.js} +0 -0
- /package/dist/shared/{components-9jvzzvt1.js → components-gz8zf3ec.js} +0 -0
- /package/dist/shared/{components-tqvarbfv.js → components-hw9yk32z.js} +0 -0
- /package/dist/shared/{components-apdwtweq.js → components-jbbmdr74.js} +0 -0
- /package/dist/shared/{components-3k8xpnpq.js → components-jthe1pwb.js} +0 -0
|
@@ -4,6 +4,10 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
FluidHoverHighlight2
|
|
6
6
|
} from "./components-kvr7f9hy.js";
|
|
7
|
+
import {
|
|
8
|
+
IndexedRows,
|
|
9
|
+
useRowIndex
|
|
10
|
+
} from "./components-ta7shw28.js";
|
|
7
11
|
import {
|
|
8
12
|
useShape
|
|
9
13
|
} from "./components-cv16mryv.js";
|
|
@@ -29,7 +33,7 @@ import {
|
|
|
29
33
|
spring2
|
|
30
34
|
} from "./components-1v7rxytx.js";
|
|
31
35
|
|
|
32
|
-
// components/inputs/checkbox
|
|
36
|
+
// components/inputs/checkbox/index.tsx
|
|
33
37
|
import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
|
|
34
38
|
import { AnimatePresence, motion } from "motion/react";
|
|
35
39
|
import {
|
|
@@ -43,12 +47,6 @@ import {
|
|
|
43
47
|
} from "react";
|
|
44
48
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
45
49
|
var CheckboxGroupContext = createContext(null);
|
|
46
|
-
function useCheckboxGroup() {
|
|
47
|
-
const ctx = useContext(CheckboxGroupContext);
|
|
48
|
-
if (!ctx)
|
|
49
|
-
throw new Error("useCheckboxGroup must be used within a CheckboxGroup");
|
|
50
|
-
return ctx;
|
|
51
|
-
}
|
|
52
50
|
var CheckboxGroup2 = forwardRef(({
|
|
53
51
|
children,
|
|
54
52
|
checkedIndices: checkedIndicesProp,
|
|
@@ -152,7 +150,9 @@ var CheckboxGroup2 = forwardRef(({
|
|
|
152
150
|
}
|
|
153
151
|
})
|
|
154
152
|
}),
|
|
155
|
-
|
|
153
|
+
/* @__PURE__ */ jsx(IndexedRows, {
|
|
154
|
+
children
|
|
155
|
+
})
|
|
156
156
|
]
|
|
157
157
|
})
|
|
158
158
|
});
|
|
@@ -162,23 +162,37 @@ var CheckboxGroup2 = forwardRef(({
|
|
|
162
162
|
}) : group;
|
|
163
163
|
});
|
|
164
164
|
CheckboxGroup2.displayName = "CheckboxGroup";
|
|
165
|
-
var
|
|
165
|
+
var Checkbox2 = forwardRef(({
|
|
166
|
+
label,
|
|
167
|
+
checked: checkedProp,
|
|
168
|
+
defaultChecked = false,
|
|
169
|
+
onCheckedChange,
|
|
170
|
+
onToggle: onToggleProp,
|
|
171
|
+
index: indexProp,
|
|
172
|
+
size,
|
|
173
|
+
className,
|
|
174
|
+
...props
|
|
175
|
+
}, ref) => {
|
|
166
176
|
const internalRef = useRef(null);
|
|
167
177
|
const hasMounted = useRef(false);
|
|
168
|
-
const
|
|
169
|
-
const
|
|
178
|
+
const group = useContext(CheckboxGroupContext);
|
|
179
|
+
const index = useRowIndex(indexProp);
|
|
180
|
+
const [ownChecked, setOwnChecked] = useControllableState(checkedProp, defaultChecked, onCheckedChange);
|
|
181
|
+
const [hovered, setHovered] = useState(false);
|
|
182
|
+
const checked = checkedProp ?? (group ? group.checkedIndices.has(index) : ownChecked);
|
|
170
183
|
const onToggle = () => {
|
|
171
184
|
onToggleProp?.();
|
|
172
|
-
setItemChecked(index, !checked);
|
|
185
|
+
group?.setItemChecked(index, !checked);
|
|
186
|
+
setOwnChecked(!checked);
|
|
173
187
|
};
|
|
174
|
-
useRegisterFluidHoverItem2(registerItem, index, internalRef);
|
|
188
|
+
useRegisterFluidHoverItem2(group?.registerItem, index, internalRef);
|
|
175
189
|
useEffect(() => {
|
|
176
190
|
hasMounted.current = true;
|
|
177
191
|
}, []);
|
|
178
|
-
const isActive = activeIndex === index;
|
|
192
|
+
const isActive = group ? group.activeIndex === index : hovered;
|
|
179
193
|
const skipAnimation = !hasMounted.current;
|
|
180
194
|
const shape = useShape();
|
|
181
|
-
const sizeClasses = useSize2();
|
|
195
|
+
const sizeClasses = useSize2(size);
|
|
182
196
|
const compact = sizeClasses.variant === "compact";
|
|
183
197
|
return /* @__PURE__ */ jsxs("div", {
|
|
184
198
|
ref: (node) => {
|
|
@@ -194,6 +208,11 @@ var CheckboxItem2 = forwardRef(({ label, index, checked: checkedProp, onToggle:
|
|
|
194
208
|
"aria-checked": checked,
|
|
195
209
|
"aria-label": label,
|
|
196
210
|
onClick: onToggle,
|
|
211
|
+
onPointerEnter: (e) => {
|
|
212
|
+
if (e.pointerType === "mouse")
|
|
213
|
+
setHovered(true);
|
|
214
|
+
},
|
|
215
|
+
onPointerLeave: () => setHovered(false),
|
|
197
216
|
onMouseDown: (e) => {
|
|
198
217
|
const interactive = e.target.closest('button:not([tabindex="-1"]), a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
199
218
|
if (interactive && interactive !== e.currentTarget)
|
|
@@ -207,7 +226,7 @@ var CheckboxItem2 = forwardRef(({ label, index, checked: checkedProp, onToggle:
|
|
|
207
226
|
onToggle();
|
|
208
227
|
}
|
|
209
228
|
},
|
|
210
|
-
className: cn2(`relative z-10 flex ${sizeClasses.control} items-center ${sizeClasses.gap} ${shape.item} ${sizeClasses.px} cursor-pointer outline-none`, className),
|
|
229
|
+
className: cn2(`relative z-10 flex ${sizeClasses.control} items-center ${sizeClasses.gap} ${shape.item} ${sizeClasses.px} cursor-pointer outline-none`, !group && "focus-visible:ring-1 focus-visible:ring-focus-ring", className),
|
|
211
230
|
...props,
|
|
212
231
|
children: [
|
|
213
232
|
/* @__PURE__ */ jsxs(CheckboxPrimitive.Root, {
|
|
@@ -284,8 +303,8 @@ var CheckboxItem2 = forwardRef(({ label, index, checked: checkedProp, onToggle:
|
|
|
284
303
|
]
|
|
285
304
|
});
|
|
286
305
|
});
|
|
287
|
-
|
|
288
|
-
Object.assign(
|
|
289
|
-
var
|
|
306
|
+
Checkbox2.displayName = "Checkbox";
|
|
307
|
+
Object.assign(Checkbox2, { Group: CheckboxGroup2 });
|
|
308
|
+
var checkbox_default = Checkbox2;
|
|
290
309
|
|
|
291
|
-
export { CheckboxGroup2,
|
|
310
|
+
export { CheckboxGroup2, Checkbox2, checkbox_default };
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
fieldLabel,
|
|
5
5
|
dividedColumns,
|
|
6
6
|
ScrollColumn
|
|
7
|
-
} from "./components-
|
|
7
|
+
} from "./components-gz8zf3ec.js";
|
|
8
8
|
import {
|
|
9
9
|
cn2
|
|
10
10
|
} from "./components-ezxhrmer.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
PickerShell,
|
|
16
16
|
PickerInput
|
|
17
|
-
} from "./components-
|
|
17
|
+
} from "./components-qtqxgfrb.js";
|
|
18
18
|
|
|
19
19
|
// components/inputs/date-time/month-picker/index.tsx
|
|
20
20
|
import { addYears, endOfYear, format, startOfMonth, startOfYear } from "date-fns";
|
|
@@ -29,6 +29,7 @@ function MonthPicker2({
|
|
|
29
29
|
startMonth,
|
|
30
30
|
endMonth,
|
|
31
31
|
disabled,
|
|
32
|
+
variant,
|
|
32
33
|
invalid,
|
|
33
34
|
size,
|
|
34
35
|
open: openProp,
|
|
@@ -74,6 +75,7 @@ function MonthPicker2({
|
|
|
74
75
|
open,
|
|
75
76
|
onOpenChange: setOpen,
|
|
76
77
|
size,
|
|
78
|
+
variant,
|
|
77
79
|
invalid,
|
|
78
80
|
disabled,
|
|
79
81
|
icon: "calendar",
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
fieldLabel,
|
|
4
4
|
dividedColumns,
|
|
5
5
|
ScrollColumn
|
|
6
|
-
} from "./components-
|
|
6
|
+
} from "./components-gz8zf3ec.js";
|
|
7
7
|
import {
|
|
8
8
|
cn2
|
|
9
9
|
} from "./components-ezxhrmer.js";
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
PickerShell,
|
|
15
15
|
PickerInput
|
|
16
|
-
} from "./components-
|
|
16
|
+
} from "./components-qtqxgfrb.js";
|
|
17
17
|
import {
|
|
18
18
|
pad
|
|
19
|
-
} from "./components-
|
|
19
|
+
} from "./components-mjthm1kf.js";
|
|
20
20
|
|
|
21
21
|
// components/inputs/date-time/duration-picker/index.tsx
|
|
22
22
|
import { formatDuration } from "date-fns";
|
|
@@ -32,6 +32,7 @@ function DurationPicker2({
|
|
|
32
32
|
locale = defaultLocale,
|
|
33
33
|
placeholder,
|
|
34
34
|
disabled,
|
|
35
|
+
variant,
|
|
35
36
|
invalid,
|
|
36
37
|
size,
|
|
37
38
|
open: openProp,
|
|
@@ -72,6 +73,7 @@ function DurationPicker2({
|
|
|
72
73
|
open,
|
|
73
74
|
onOpenChange: setOpen,
|
|
74
75
|
size,
|
|
76
|
+
variant,
|
|
75
77
|
invalid,
|
|
76
78
|
disabled,
|
|
77
79
|
icon: "clock",
|
|
@@ -7,6 +7,10 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
FluidHoverHighlight2
|
|
9
9
|
} from "./components-kvr7f9hy.js";
|
|
10
|
+
import {
|
|
11
|
+
IndexedRows,
|
|
12
|
+
useRowIndex
|
|
13
|
+
} from "./components-ta7shw28.js";
|
|
10
14
|
import {
|
|
11
15
|
useShape
|
|
12
16
|
} from "./components-cv16mryv.js";
|
|
@@ -27,7 +31,7 @@ import {
|
|
|
27
31
|
spring2
|
|
28
32
|
} from "./components-1v7rxytx.js";
|
|
29
33
|
|
|
30
|
-
// components/inputs/radio
|
|
34
|
+
// components/inputs/radio/index.tsx
|
|
31
35
|
import { Radio as RadioPrimitive } from "@base-ui/react/radio";
|
|
32
36
|
import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group";
|
|
33
37
|
import { AnimatePresence, motion } from "motion/react";
|
|
@@ -46,7 +50,7 @@ var RadioGroupContext = createContext(null);
|
|
|
46
50
|
function useRadioGroupContext() {
|
|
47
51
|
const ctx = useContext(RadioGroupContext);
|
|
48
52
|
if (!ctx)
|
|
49
|
-
throw new Error("
|
|
53
|
+
throw new Error("Radio must be used within a Radio.Group");
|
|
50
54
|
return ctx;
|
|
51
55
|
}
|
|
52
56
|
var RadioGroup2 = forwardRef(({
|
|
@@ -152,7 +156,9 @@ var RadioGroup2 = forwardRef(({
|
|
|
152
156
|
}
|
|
153
157
|
})
|
|
154
158
|
}),
|
|
155
|
-
|
|
159
|
+
/* @__PURE__ */ jsx(IndexedRows, {
|
|
160
|
+
children
|
|
161
|
+
})
|
|
156
162
|
]
|
|
157
163
|
});
|
|
158
164
|
const withSize = (node) => size ? /* @__PURE__ */ jsx(SizeProvider2, {
|
|
@@ -189,10 +195,11 @@ var RadioGroup2 = forwardRef(({
|
|
|
189
195
|
}));
|
|
190
196
|
});
|
|
191
197
|
RadioGroup2.displayName = "RadioGroup";
|
|
192
|
-
var
|
|
198
|
+
var Radio2 = forwardRef(({ label, index: indexProp, selected, onSelect, value, className, ...props }, ref) => {
|
|
193
199
|
const internalRef = useRef(null);
|
|
194
200
|
const hasMounted = useRef(false);
|
|
195
201
|
const { registerItem, activeIndex, selectedIndex, selectedValue, onValueChange, hasSelection, selectIndex } = useRadioGroupContext();
|
|
202
|
+
const index = useRowIndex(indexProp);
|
|
196
203
|
useRegisterFluidHoverItem2(registerItem, index, internalRef);
|
|
197
204
|
useEffect(() => {
|
|
198
205
|
hasMounted.current = true;
|
|
@@ -286,8 +293,8 @@ var RadioItem2 = forwardRef(({ label, index, selected, onSelect, value, classNam
|
|
|
286
293
|
]
|
|
287
294
|
});
|
|
288
295
|
});
|
|
289
|
-
|
|
290
|
-
Object.assign(
|
|
291
|
-
var
|
|
296
|
+
Radio2.displayName = "Radio";
|
|
297
|
+
Object.assign(Radio2, { Group: RadioGroup2 });
|
|
298
|
+
var radio_default = Radio2;
|
|
292
299
|
|
|
293
|
-
export { RadioGroup2,
|
|
300
|
+
export { RadioGroup2, Radio2, radio_default };
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
useShape
|
|
3
|
+
} from "./components-cv16mryv.js";
|
|
4
|
+
import {
|
|
5
|
+
useSize2
|
|
6
|
+
} from "./components-0sn7ypjw.js";
|
|
7
|
+
import {
|
|
8
|
+
cn2
|
|
9
|
+
} from "./components-ezxhrmer.js";
|
|
10
|
+
import {
|
|
11
|
+
fieldIconClasses,
|
|
12
|
+
useFieldBox
|
|
13
|
+
} from "./components-3myrw7ne.js";
|
|
5
14
|
import {
|
|
6
15
|
useIcon
|
|
7
16
|
} from "./components-zrkzcayz.js";
|
|
@@ -14,15 +23,6 @@ import {
|
|
|
14
23
|
useMorphOrigin,
|
|
15
24
|
useMorph
|
|
16
25
|
} from "./components-hqeq3w9q.js";
|
|
17
|
-
import {
|
|
18
|
-
cn2
|
|
19
|
-
} from "./components-ezxhrmer.js";
|
|
20
|
-
import {
|
|
21
|
-
useShape
|
|
22
|
-
} from "./components-cv16mryv.js";
|
|
23
|
-
import {
|
|
24
|
-
useSize2
|
|
25
|
-
} from "./components-0sn7ypjw.js";
|
|
26
26
|
import {
|
|
27
27
|
SURFACE_BG,
|
|
28
28
|
SURFACE_SHADOW,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
} from "./components-rr7a6ja9.js";
|
|
47
47
|
import {
|
|
48
48
|
input_default
|
|
49
|
-
} from "./components-
|
|
49
|
+
} from "./components-50m950y9.js";
|
|
50
50
|
|
|
51
51
|
// components/inputs/date-time/picker-shell.tsx
|
|
52
52
|
import { Popover } from "@base-ui/react/popover";
|
|
@@ -69,21 +69,18 @@ function PickerShell({ open: openProp, defaultOpen = false, onOpenChange, size,
|
|
|
69
69
|
children: shell
|
|
70
70
|
}) : shell;
|
|
71
71
|
}
|
|
72
|
-
var PickerField = forwardRef(({ icon, display, placeholder, invalid, disabled, id, className, ...props }, ref) => {
|
|
72
|
+
var PickerField = forwardRef(({ icon, display, placeholder, variant = "bordered", invalid, disabled, id, className, ...props }, ref) => {
|
|
73
73
|
const Icon = useIcon(icon);
|
|
74
|
-
const
|
|
75
|
-
const sizeClasses = useSize2();
|
|
76
|
-
const compact = sizeClasses.variant === "compact";
|
|
74
|
+
const { size: sizeClasses, props: boxProps } = useFieldBox({ variant, invalid, disabled });
|
|
77
75
|
return /* @__PURE__ */ jsxs("button", {
|
|
78
76
|
ref,
|
|
79
77
|
type: "button",
|
|
80
78
|
id,
|
|
81
79
|
disabled,
|
|
82
80
|
"aria-invalid": invalid || undefined,
|
|
83
|
-
|
|
84
|
-
"data-disabled": disabled || undefined,
|
|
81
|
+
...boxProps,
|
|
85
82
|
...props,
|
|
86
|
-
className: cn2(
|
|
83
|
+
className: cn2(boxProps.className, "flex w-full min-w-0 items-center text-left cursor-pointer outline-none focus-visible:ring-focus-ring", sizeClasses.gap, sizeClasses.control, className),
|
|
87
84
|
children: [
|
|
88
85
|
/* @__PURE__ */ jsx(Icon, {
|
|
89
86
|
size: sizeClasses.icon,
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn2
|
|
3
|
+
} from "./components-ezxhrmer.js";
|
|
4
|
+
import {
|
|
5
|
+
useFieldBox,
|
|
6
|
+
focusControlOnPress
|
|
7
|
+
} from "./components-3myrw7ne.js";
|
|
8
|
+
import {
|
|
9
|
+
useControllableState
|
|
10
|
+
} from "./components-n7mjr357.js";
|
|
11
|
+
|
|
12
|
+
// components/inputs/textarea/index.tsx
|
|
13
|
+
import { Field } from "@base-ui/react/field";
|
|
14
|
+
import { forwardRef, useCallback, useEffect, useLayoutEffect, useRef } from "react";
|
|
15
|
+
import { jsx } from "react/jsx-runtime";
|
|
16
|
+
var PADDING_Y = {
|
|
17
|
+
default: "py-2",
|
|
18
|
+
compact: "py-1"
|
|
19
|
+
};
|
|
20
|
+
var Textarea2 = forwardRef(({
|
|
21
|
+
value: valueProp,
|
|
22
|
+
defaultValue = "",
|
|
23
|
+
onChange: onChangeProp,
|
|
24
|
+
minRows = 3,
|
|
25
|
+
maxRows = 8,
|
|
26
|
+
variant = "borderless",
|
|
27
|
+
invalid,
|
|
28
|
+
disabled,
|
|
29
|
+
size,
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}, ref) => {
|
|
33
|
+
const [value, onChange] = useControllableState(valueProp, defaultValue, onChangeProp);
|
|
34
|
+
const textareaRef = useRef(null);
|
|
35
|
+
const box = useFieldBox({ variant, invalid, disabled, size });
|
|
36
|
+
const resize = useCallback(() => {
|
|
37
|
+
const el = textareaRef.current;
|
|
38
|
+
if (!el)
|
|
39
|
+
return;
|
|
40
|
+
el.style.height = "auto";
|
|
41
|
+
const lineHeight = Number.parseFloat(getComputedStyle(el).lineHeight);
|
|
42
|
+
const max = lineHeight * Math.max(maxRows, minRows);
|
|
43
|
+
el.style.height = `${Math.min(Math.max(el.scrollHeight, lineHeight * minRows), max)}px`;
|
|
44
|
+
el.style.overflowY = el.scrollHeight > max ? "auto" : "hidden";
|
|
45
|
+
}, [minRows, maxRows]);
|
|
46
|
+
useLayoutEffect(resize, [resize, value, box.size.variant]);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const el = textareaRef.current;
|
|
49
|
+
if (!el)
|
|
50
|
+
return;
|
|
51
|
+
let lastWidth = el.offsetWidth;
|
|
52
|
+
const observer = new ResizeObserver(() => {
|
|
53
|
+
if (el.offsetWidth === lastWidth)
|
|
54
|
+
return;
|
|
55
|
+
lastWidth = el.offsetWidth;
|
|
56
|
+
resize();
|
|
57
|
+
});
|
|
58
|
+
observer.observe(el);
|
|
59
|
+
return () => observer.disconnect();
|
|
60
|
+
}, [resize]);
|
|
61
|
+
return /* @__PURE__ */ jsx("div", {
|
|
62
|
+
onMouseDown: focusControlOnPress(textareaRef),
|
|
63
|
+
...box.props,
|
|
64
|
+
className: cn2(box.props.className, "flex", PADDING_Y[box.size.variant], className),
|
|
65
|
+
children: /* @__PURE__ */ jsx(Field.Control, {
|
|
66
|
+
ref: (node) => {
|
|
67
|
+
const textarea = node;
|
|
68
|
+
textareaRef.current = textarea;
|
|
69
|
+
if (typeof ref === "function")
|
|
70
|
+
ref(textarea);
|
|
71
|
+
else if (ref)
|
|
72
|
+
ref.current = textarea;
|
|
73
|
+
},
|
|
74
|
+
render: /* @__PURE__ */ jsx("textarea", {
|
|
75
|
+
rows: minRows,
|
|
76
|
+
...props
|
|
77
|
+
}),
|
|
78
|
+
value,
|
|
79
|
+
onChange: (e) => onChange(e.target.value),
|
|
80
|
+
disabled,
|
|
81
|
+
"aria-invalid": invalid || undefined,
|
|
82
|
+
className: cn2("block w-full resize-none rounded-none bg-transparent text-foreground placeholder:text-muted-foreground outline-none font-[inherit]", box.size.text, "weight-normal")
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
Textarea2.displayName = "Textarea";
|
|
87
|
+
var textarea_default = Textarea2;
|
|
88
|
+
|
|
89
|
+
export { Textarea2, textarea_default };
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
spring2
|
|
27
27
|
} from "./components-1v7rxytx.js";
|
|
28
28
|
|
|
29
|
-
// components/
|
|
29
|
+
// components/copy/index.tsx
|
|
30
30
|
import { AnimatePresence, animate, motion, useMotionValue } from "motion/react";
|
|
31
31
|
import {
|
|
32
32
|
forwardRef,
|
|
@@ -176,7 +176,7 @@ function CopyGlyph({
|
|
|
176
176
|
]
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
-
var
|
|
179
|
+
var Copy2 = forwardRef(({ value, label, onCopy, disabled, variant = "icon", align = "right", size, className, ...props }, ref) => {
|
|
180
180
|
const CopyIcon = useIcon("copy");
|
|
181
181
|
const [status, setStatus] = useState("idle");
|
|
182
182
|
const [copyCount, setCopyCount] = useState(0);
|
|
@@ -339,7 +339,7 @@ var InputCopy2 = forwardRef(({ value, label, onCopy, disabled, variant = "icon",
|
|
|
339
339
|
]
|
|
340
340
|
});
|
|
341
341
|
});
|
|
342
|
-
|
|
343
|
-
var
|
|
342
|
+
Copy2.displayName = "Copy";
|
|
343
|
+
var copy_default = Copy2;
|
|
344
344
|
|
|
345
|
-
export {
|
|
345
|
+
export { Copy2, copy_default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// lib/row-index.tsx
|
|
2
|
+
import { Children, createContext, isValidElement, useContext } from "react";
|
|
3
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
4
|
+
var RowIndexContext = createContext(0);
|
|
5
|
+
function IndexedRows({ children }) {
|
|
6
|
+
let index = 0;
|
|
7
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
8
|
+
children: Children.map(children, (child) => isValidElement(child) ? /* @__PURE__ */ jsx(RowIndexContext.Provider, {
|
|
9
|
+
value: index++,
|
|
10
|
+
children: child
|
|
11
|
+
}) : child)
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function useRowIndex(own) {
|
|
15
|
+
const position = useContext(RowIndexContext);
|
|
16
|
+
return own ?? position;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { IndexedRows, useRowIndex };
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./components-
|
|
2
|
+
shapeMap,
|
|
3
|
+
useShape
|
|
4
|
+
} from "./components-cv16mryv.js";
|
|
5
|
+
import {
|
|
6
|
+
useSize2
|
|
7
|
+
} from "./components-0sn7ypjw.js";
|
|
8
|
+
import {
|
|
9
|
+
cn2
|
|
10
|
+
} from "./components-ezxhrmer.js";
|
|
11
|
+
import {
|
|
12
|
+
fieldIconClasses,
|
|
13
|
+
useFieldBox
|
|
14
|
+
} from "./components-3myrw7ne.js";
|
|
5
15
|
import {
|
|
6
16
|
opensInPlace,
|
|
7
17
|
inPlaceOffset,
|
|
8
18
|
useMorphOrigin,
|
|
9
19
|
useMorph
|
|
10
20
|
} from "./components-hqeq3w9q.js";
|
|
11
|
-
import {
|
|
12
|
-
cn2
|
|
13
|
-
} from "./components-ezxhrmer.js";
|
|
14
21
|
import {
|
|
15
22
|
FluidHoverHighlight2
|
|
16
23
|
} from "./components-kvr7f9hy.js";
|
|
@@ -20,13 +27,6 @@ import {
|
|
|
20
27
|
import {
|
|
21
28
|
MorphSurface
|
|
22
29
|
} from "./components-0q0sqfh4.js";
|
|
23
|
-
import {
|
|
24
|
-
shapeMap,
|
|
25
|
-
useShape
|
|
26
|
-
} from "./components-cv16mryv.js";
|
|
27
|
-
import {
|
|
28
|
-
useSize2
|
|
29
|
-
} from "./components-0sn7ypjw.js";
|
|
30
30
|
import {
|
|
31
31
|
SURFACE_BG,
|
|
32
32
|
SURFACE_SHADOW,
|
|
@@ -279,9 +279,8 @@ function FieldControls({ clearable, compact, iconSize }) {
|
|
|
279
279
|
]
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
|
-
var ComboboxInput2 = forwardRef(({ className, variant, icon: Icon, placeholder = "Search…", error, clearable = false, size, ...props }, ref) => {
|
|
283
|
-
const
|
|
284
|
-
const sizeClasses = useSize2(size);
|
|
282
|
+
var ComboboxInput2 = forwardRef(({ className, variant = "bordered", icon: Icon, placeholder = "Search…", error, clearable = false, size, ...props }, ref) => {
|
|
283
|
+
const { size: sizeClasses, props: boxProps } = useFieldBox({ variant, invalid: !!error, size });
|
|
285
284
|
const compact = sizeClasses.variant === "compact";
|
|
286
285
|
const { anchorRef } = useComboboxContext();
|
|
287
286
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -289,8 +288,8 @@ var ComboboxInput2 = forwardRef(({ className, variant, icon: Icon, placeholder =
|
|
|
289
288
|
children: [
|
|
290
289
|
/* @__PURE__ */ jsxs(ComboboxPrimitive.InputGroup, {
|
|
291
290
|
ref: anchorRef,
|
|
292
|
-
|
|
293
|
-
className: cn2(
|
|
291
|
+
...boxProps,
|
|
292
|
+
className: cn2(boxProps.className, "flex items-center", sizeClasses.control, sizeClasses.gap, compact ? "min-w-[128px]" : "min-w-[160px]", className),
|
|
294
293
|
children: [
|
|
295
294
|
Icon && /* @__PURE__ */ jsx(Icon, {
|
|
296
295
|
size: sizeClasses.icon,
|
|
@@ -345,12 +344,12 @@ function useChipRowHeight(padY) {
|
|
|
345
344
|
}, [height]);
|
|
346
345
|
return { ref, height };
|
|
347
346
|
}
|
|
348
|
-
var ComboboxChips2 = forwardRef(({ className, variant, icon: Icon, placeholder = "Search…", error, clearable = false, size, ...props }, ref) => {
|
|
347
|
+
var ComboboxChips2 = forwardRef(({ className, variant = "bordered", icon: Icon, placeholder = "Search…", error, clearable = false, size, ...props }, ref) => {
|
|
349
348
|
const XIcon = useIcon("x");
|
|
350
349
|
const shape = useShape();
|
|
351
|
-
const sizeClasses = useSize2(size);
|
|
352
|
-
const compact = sizeClasses.variant === "compact";
|
|
353
350
|
const { anchorRef, open, disabled, inputValue, values } = useComboboxContext();
|
|
351
|
+
const { size: sizeClasses, props: boxProps } = useFieldBox({ variant, invalid: !!error, disabled, size });
|
|
352
|
+
const compact = sizeClasses.variant === "compact";
|
|
354
353
|
const rowHeight = useChipRowHeight(compact ? 8 : 12);
|
|
355
354
|
return /* @__PURE__ */ jsxs("div", {
|
|
356
355
|
className: "flex flex-col gap-1",
|
|
@@ -360,10 +359,9 @@ var ComboboxChips2 = forwardRef(({ className, variant, icon: Icon, placeholder =
|
|
|
360
359
|
render: /* @__PURE__ */ jsx(motion.div, {
|
|
361
360
|
style: { height: rowHeight.height }
|
|
362
361
|
}),
|
|
363
|
-
|
|
364
|
-
"data-invalid": !!error || undefined,
|
|
362
|
+
...boxProps,
|
|
365
363
|
"data-popup-open": open || undefined,
|
|
366
|
-
className: cn2(
|
|
364
|
+
className: cn2(boxProps.className, "flex items-center", "transition-[color,background-color,border-radius,box-shadow,opacity]", "!items-start", compact ? "min-h-7 py-1" : "min-h-9 py-1.5", sizeClasses.gap, compact ? "min-w-[128px]" : "min-w-[160px]", className),
|
|
367
365
|
children: [
|
|
368
366
|
Icon && /* @__PURE__ */ jsx("span", {
|
|
369
367
|
className: cn2("flex shrink-0 items-center", compact ? "h-5" : "h-6"),
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
hourCycleOf,
|
|
4
4
|
parseTimeText,
|
|
5
5
|
dividedColumns
|
|
6
|
-
} from "./components-
|
|
6
|
+
} from "./components-gz8zf3ec.js";
|
|
7
7
|
import {
|
|
8
8
|
cn2
|
|
9
9
|
} from "./components-ezxhrmer.js";
|
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
PickerShell,
|
|
15
15
|
PickerInput
|
|
16
|
-
} from "./components-
|
|
16
|
+
} from "./components-qtqxgfrb.js";
|
|
17
17
|
import {
|
|
18
18
|
pad,
|
|
19
19
|
TimeColumns
|
|
20
|
-
} from "./components-
|
|
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";
|
|
@@ -37,6 +37,7 @@ function TimePicker2({
|
|
|
37
37
|
locale = defaultLocale,
|
|
38
38
|
placeholder,
|
|
39
39
|
disabled,
|
|
40
|
+
variant,
|
|
40
41
|
invalid,
|
|
41
42
|
size,
|
|
42
43
|
open: openProp,
|
|
@@ -69,6 +70,7 @@ function TimePicker2({
|
|
|
69
70
|
open,
|
|
70
71
|
onOpenChange: setOpen,
|
|
71
72
|
size,
|
|
73
|
+
variant,
|
|
72
74
|
invalid,
|
|
73
75
|
disabled,
|
|
74
76
|
icon: "clock",
|
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
hourCycleOf,
|
|
4
4
|
parseDateText,
|
|
5
5
|
parseTimeText
|
|
6
|
-
} from "./components-
|
|
6
|
+
} from "./components-gz8zf3ec.js";
|
|
7
7
|
import {
|
|
8
8
|
useControllableState
|
|
9
9
|
} from "./components-n7mjr357.js";
|
|
10
10
|
import {
|
|
11
11
|
calendar_default
|
|
12
|
-
} from "./components-
|
|
12
|
+
} from "./components-1z6tdadk.js";
|
|
13
13
|
import {
|
|
14
14
|
PickerShell,
|
|
15
15
|
PickerInput
|
|
16
|
-
} from "./components-
|
|
16
|
+
} from "./components-qtqxgfrb.js";
|
|
17
17
|
import {
|
|
18
18
|
TimeColumns
|
|
19
|
-
} from "./components-
|
|
19
|
+
} from "./components-mjthm1kf.js";
|
|
20
20
|
|
|
21
21
|
// components/inputs/date-time/date-picker/index.tsx
|
|
22
22
|
import { endOfMonth, format, set } from "date-fns";
|
|
@@ -36,6 +36,7 @@ function DatePicker2({
|
|
|
36
36
|
disabled,
|
|
37
37
|
startMonth,
|
|
38
38
|
endMonth,
|
|
39
|
+
variant,
|
|
39
40
|
invalid,
|
|
40
41
|
size,
|
|
41
42
|
open: openProp,
|
|
@@ -99,6 +100,7 @@ function DatePicker2({
|
|
|
99
100
|
open,
|
|
100
101
|
onOpenChange: setOpen,
|
|
101
102
|
size,
|
|
103
|
+
variant,
|
|
102
104
|
invalid,
|
|
103
105
|
disabled: off,
|
|
104
106
|
icon: "calendar",
|