@justanarthur/modo-ui 0.1.0 → 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/dist/blocks/sidebar-app/index.d.ts +1 -1
- package/dist/blocks/sidebar-app/index.js +28 -31
- 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/checkbox-group/index.d.ts +1 -1
- package/dist/components/inputs/checkbox-group/index.js +17 -19
- 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 +1 -1
- 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/input-copy/index.d.ts +1 -1
- package/dist/components/inputs/input-copy/index.js +12 -14
- package/dist/components/inputs/input-message/index.d.ts +1 -1
- package/dist/components/inputs/input-message/index.js +21 -23
- package/dist/components/inputs/radio-group/index.d.ts +1 -1
- package/dist/components/inputs/radio-group/index.js +16 -18
- 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 +1 -1
- package/dist/components/inputs/switch/index.js +10 -12
- package/dist/components/navigation/accordion/index.d.ts +1 -1
- package/dist/components/navigation/accordion/index.js +24 -26
- 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 +1 -1
- 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/components/thinking-indicator/index.d.ts +1 -1
- package/dist/components/thinking-indicator/index.js +9 -11
- package/dist/index.d.ts +51 -51
- package/dist/index.js +506 -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 +1 -1
- 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 +1 -1
- 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-0ke6xada.js +123 -0
- 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-p2vmyfe1.js → components-1j9791sn.js} +42 -42
- package/dist/shared/{components-6phwsry6.js → components-1rfwbyyc.js} +25 -25
- package/dist/shared/{components-vc1k7yv2.js → components-1v7rxytx.js} +3 -3
- package/dist/shared/{components-tm88ghva.js → components-1xekx2hx.js} +58 -58
- package/dist/shared/{components-6t6nr33r.js → components-39jq9va1.js} +26 -26
- package/dist/shared/{components-j65qt1mq.js → components-3gae8nta.js} +101 -101
- package/dist/shared/{components-r2gke5p6.js → components-3k8xpnpq.js} +125 -125
- package/dist/shared/{components-6y1th6k4.js → components-3mkepka5.js} +31 -31
- package/dist/shared/{components-vktws5r6.js → components-3wk0w46f.js} +72 -72
- package/dist/shared/{components-zx2hr57f.js → components-4cnjmgex.js} +15 -15
- 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-7gv95yfy.js → components-62ybc7t2.js} +83 -83
- package/dist/shared/{components-brnzrp2t.js → components-66mv71kx.js} +41 -41
- package/dist/shared/{components-taxmgbnh.js → components-7ans7ce5.js} +17 -17
- 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-5zry9te1.js → components-7x9kawxv.js} +26 -26
- package/dist/shared/{components-4hh0gm0v.js → components-8fpr3s4p.js} +61 -61
- package/dist/shared/{components-x2xyckd5.js → components-9jvzzvt1.js} +20 -20
- package/dist/shared/{components-bf2d9k02.js → components-apdwtweq.js} +94 -94
- package/dist/shared/{components-hjkrv00c.js → components-asr5pg50.js} +18 -18
- package/dist/shared/{components-5pkcfprd.js → components-b2wyq2cq.js} +22 -22
- package/dist/shared/{components-nn6xezy2.js → components-ca2c898n.js} +226 -226
- package/dist/shared/{components-xszag63d.js → components-cbxjn9p8.js} +12 -12
- 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-4xxtggzp.js → components-ez65vtbq.js} +18 -18
- package/dist/shared/{components-0f0as45n.js → components-ezxhrmer.js} +2 -2
- 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-ess3ch6w.js → components-h2dpcwgc.js} +23 -23
- 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-vb033rns.js → components-jjw69c4c.js} +6 -6
- package/dist/shared/{components-tad5h7ta.js → components-jwst3vtj.js} +48 -48
- package/dist/shared/{components-r22vtgqc.js → components-kvr7f9hy.js} +11 -11
- package/dist/shared/{components-gndm6am4.js → components-ng72k97e.js} +17 -17
- package/dist/shared/{components-40j34hdb.js → components-nh8tma1n.js} +116 -116
- package/dist/shared/{components-s5pkbjx1.js → components-njzgqdwy.js} +56 -56
- package/dist/shared/{components-54nf2x99.js → components-ny774h8p.js} +42 -42
- package/dist/shared/{components-r4jt6hgd.js → components-q4daerx0.js} +6 -6
- package/dist/shared/{components-peg09pzs.js → components-q5xj5c16.js} +11 -11
- package/dist/shared/{components-r43mqnd6.js → components-rr7a6ja9.js} +46 -46
- package/dist/shared/{components-bkvb6nem.js → components-s2bz1xpk.js} +11 -11
- package/dist/shared/{components-zvb11ker.js → components-tqvarbfv.js} +47 -47
- package/dist/shared/{components-aaq3yk4f.js → components-v6xp325t.js} +43 -43
- package/dist/shared/{components-v7es8aan.js → components-v7wtz8hk.js} +15 -15
- 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-gjfrycb5.js → components-yh3kwdhr.js} +63 -66
- package/dist/shared/{components-y3cqdrgy.js → components-ytb2tefr.js} +43 -43
- 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/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,51 +1,51 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
opensInPlace,
|
|
3
|
+
inPlaceOffset,
|
|
4
|
+
useMorphOrigin,
|
|
5
|
+
useMorph
|
|
6
|
+
} from "./components-hqeq3w9q.js";
|
|
4
7
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./components-
|
|
8
|
+
cn2
|
|
9
|
+
} from "./components-ezxhrmer.js";
|
|
7
10
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./components-
|
|
11
|
+
FluidHoverHighlight2
|
|
12
|
+
} from "./components-kvr7f9hy.js";
|
|
10
13
|
import {
|
|
11
14
|
useIcon
|
|
12
|
-
} from "./components-
|
|
13
|
-
import {
|
|
14
|
-
SURFACE_BG,
|
|
15
|
-
SURFACE_SHADOW,
|
|
16
|
-
SurfaceProvider,
|
|
17
|
-
surfaceClasses,
|
|
18
|
-
useSurface
|
|
19
|
-
} from "./components-csxz9f52.js";
|
|
15
|
+
} from "./components-zrkzcayz.js";
|
|
20
16
|
import {
|
|
21
17
|
MorphSurface
|
|
22
|
-
} from "./components-
|
|
23
|
-
import {
|
|
24
|
-
FluidHoverHighlight
|
|
25
|
-
} from "./components-r22vtgqc.js";
|
|
26
|
-
import {
|
|
27
|
-
useFluidHover,
|
|
28
|
-
useRegisterFluidHoverItem
|
|
29
|
-
} from "./components-e46kf6cp.js";
|
|
18
|
+
} from "./components-0q0sqfh4.js";
|
|
30
19
|
import {
|
|
31
20
|
shapeMap,
|
|
32
21
|
useShape
|
|
33
|
-
} from "./components-
|
|
22
|
+
} from "./components-cv16mryv.js";
|
|
34
23
|
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
useSize2
|
|
25
|
+
} from "./components-0sn7ypjw.js";
|
|
26
|
+
import {
|
|
27
|
+
SURFACE_BG,
|
|
28
|
+
SURFACE_SHADOW,
|
|
29
|
+
surfaceClasses2,
|
|
30
|
+
useSurface2,
|
|
31
|
+
SurfaceProvider2
|
|
32
|
+
} from "./components-zx6b6yby.js";
|
|
33
|
+
import {
|
|
34
|
+
useFluidHover2,
|
|
35
|
+
useRegisterFluidHoverItem2
|
|
36
|
+
} from "./components-59efxjd9.js";
|
|
37
|
+
import {
|
|
38
|
+
SizeProvider2
|
|
39
|
+
} from "./components-jjw69c4c.js";
|
|
40
40
|
import {
|
|
41
|
-
|
|
42
|
-
} from "./components-
|
|
41
|
+
Tooltip2
|
|
42
|
+
} from "./components-ng72k97e.js";
|
|
43
43
|
import {
|
|
44
|
-
|
|
45
|
-
} from "./components-
|
|
44
|
+
Slider2
|
|
45
|
+
} from "./components-wvp1m52g.js";
|
|
46
46
|
import {
|
|
47
|
-
|
|
48
|
-
} from "./components-
|
|
47
|
+
spring2
|
|
48
|
+
} from "./components-1v7rxytx.js";
|
|
49
49
|
|
|
50
50
|
// components/inputs/color-picker/index.tsx
|
|
51
51
|
import { Menu } from "@base-ui/react/menu";
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
} from "react";
|
|
65
65
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
66
66
|
var ColorPickerPortalContainerContext = createContext(null);
|
|
67
|
-
function
|
|
67
|
+
function ColorPickerPortalContainer2({ value, children }) {
|
|
68
68
|
return /* @__PURE__ */ jsx(ColorPickerPortalContainerContext.Provider, {
|
|
69
69
|
value,
|
|
70
70
|
children
|
|
@@ -283,7 +283,7 @@ function parseAlphaPart(part) {
|
|
|
283
283
|
return 1;
|
|
284
284
|
return part.endsWith("%") ? parseFloat(part) / 100 : parseFloat(part);
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function parseColor2(input) {
|
|
287
287
|
const s = input.trim();
|
|
288
288
|
if (!s)
|
|
289
289
|
return null;
|
|
@@ -335,7 +335,7 @@ function parseColor(input) {
|
|
|
335
335
|
}
|
|
336
336
|
var cssColorCtx = null;
|
|
337
337
|
function resolveCssColor(input) {
|
|
338
|
-
const direct =
|
|
338
|
+
const direct = parseColor2(input);
|
|
339
339
|
if (direct)
|
|
340
340
|
return direct;
|
|
341
341
|
const s = input.trim();
|
|
@@ -355,9 +355,9 @@ function resolveCssColor(input) {
|
|
|
355
355
|
const second = String(ctx.fillStyle);
|
|
356
356
|
if (first !== second)
|
|
357
357
|
return null;
|
|
358
|
-
return
|
|
358
|
+
return parseColor2(first);
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function buildParsed2(h, s, v, a) {
|
|
361
361
|
const { r, g, b } = hsvToRgb(h, s, v);
|
|
362
362
|
const hsl = rgbToHsl(r, g, b);
|
|
363
363
|
const oklch = rgbToOklch(r, g, b);
|
|
@@ -481,13 +481,13 @@ function SaturationSquare({ h, s, v, onChange }) {
|
|
|
481
481
|
onPointerMove,
|
|
482
482
|
onPointerUp,
|
|
483
483
|
onKeyDown,
|
|
484
|
-
className:
|
|
484
|
+
className: cn2("relative w-full select-none touch-none cursor-none outline-none", focused && "ring-2 ring-focus-ring", shape.bg),
|
|
485
485
|
style: {
|
|
486
486
|
height: SQUARE_HEIGHT
|
|
487
487
|
},
|
|
488
488
|
children: [
|
|
489
489
|
/* @__PURE__ */ jsx("div", {
|
|
490
|
-
className:
|
|
490
|
+
className: cn2("absolute inset-0 overflow-hidden", shape.bg === "rounded-[20px]" ? "rounded-2xl" : shape.bg),
|
|
491
491
|
style: {
|
|
492
492
|
background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${h}, 100%, 50%))`
|
|
493
493
|
}
|
|
@@ -522,7 +522,7 @@ function SaturationSquare({ h, s, v, onChange }) {
|
|
|
522
522
|
}
|
|
523
523
|
function HueSlider({ h, onChange }) {
|
|
524
524
|
const hueColor = `hsl(${h}, 100%, 50%)`;
|
|
525
|
-
return /* @__PURE__ */ jsx(
|
|
525
|
+
return /* @__PURE__ */ jsx(Slider2, {
|
|
526
526
|
value: h,
|
|
527
527
|
onChange: (v) => onChange(typeof v === "number" ? v : v[0] ?? 0),
|
|
528
528
|
min: 0,
|
|
@@ -548,7 +548,7 @@ function AlphaSlider({
|
|
|
548
548
|
onChange
|
|
549
549
|
}) {
|
|
550
550
|
const transparentColor = `rgba(${solidR}, ${solidG}, ${solidB}, 0)`;
|
|
551
|
-
return /* @__PURE__ */ jsx(
|
|
551
|
+
return /* @__PURE__ */ jsx(Slider2, {
|
|
552
552
|
value: Math.round(a * 100),
|
|
553
553
|
onChange: (v) => onChange((typeof v === "number" ? v : v[0] ?? 0) / 100),
|
|
554
554
|
min: 0,
|
|
@@ -584,9 +584,9 @@ function FormatItem({
|
|
|
584
584
|
const ref = useRef(null);
|
|
585
585
|
const menuCtx = useContext(FormatMenuContext);
|
|
586
586
|
const shape = useShape();
|
|
587
|
-
const sizeClasses =
|
|
587
|
+
const sizeClasses = useSize2();
|
|
588
588
|
const compact = sizeClasses.variant === "compact";
|
|
589
|
-
|
|
589
|
+
useRegisterFluidHoverItem2(menuCtx?.registerItem, index, ref);
|
|
590
590
|
const isActive = menuCtx?.activeIndex === index;
|
|
591
591
|
return /* @__PURE__ */ jsx(Menu.RadioItem, {
|
|
592
592
|
value,
|
|
@@ -595,7 +595,7 @@ function FormatItem({
|
|
|
595
595
|
render: /* @__PURE__ */ jsx("div", {
|
|
596
596
|
ref,
|
|
597
597
|
"data-fluid-hover-index": index,
|
|
598
|
-
className:
|
|
598
|
+
className: cn2("relative z-10 flex items-center cursor-pointer outline-none", compact ? "px-2.5 py-1.5" : "px-3 py-2", sizeClasses.text, shape.item)
|
|
599
599
|
}),
|
|
600
600
|
children: /* @__PURE__ */ jsxs("span", {
|
|
601
601
|
className: "inline-grid",
|
|
@@ -606,7 +606,7 @@ function FormatItem({
|
|
|
606
606
|
children: label
|
|
607
607
|
}),
|
|
608
608
|
/* @__PURE__ */ jsx("span", {
|
|
609
|
-
className:
|
|
609
|
+
className: cn2("col-start-1 row-start-1 transition-[color,font-variation-settings] duration-fast", isActive || checked ? "text-foreground" : "text-muted-foreground", checked ? "weight-semibold" : "weight-normal"),
|
|
610
610
|
children: label
|
|
611
611
|
})
|
|
612
612
|
]
|
|
@@ -624,13 +624,13 @@ function FormatDropdown({
|
|
|
624
624
|
const open = isControlled ? openProp : internalOpen;
|
|
625
625
|
const { origin, capture } = useMorphOrigin();
|
|
626
626
|
const morph = useMorph(open, origin, { tier: "moderate" });
|
|
627
|
-
const level = Math.min(
|
|
627
|
+
const level = Math.min(useSurface2() + 2, 8);
|
|
628
628
|
const shape = useShape();
|
|
629
|
-
const sizeClasses =
|
|
629
|
+
const sizeClasses = useSize2();
|
|
630
630
|
const portalContainer = useContext(ColorPickerPortalContainerContext);
|
|
631
631
|
const containerRef = useRef(null);
|
|
632
632
|
const ChevronDownIcon = useIcon("chevron-down");
|
|
633
|
-
const hover =
|
|
633
|
+
const hover = useFluidHover2(containerRef);
|
|
634
634
|
const { activeIndex, setActiveIndex, itemRects, handlers, registerItem, remeasure } = hover;
|
|
635
635
|
const [focusedIndex, setFocusedIndex] = useState(null);
|
|
636
636
|
useEffect(() => {
|
|
@@ -653,7 +653,7 @@ function FormatDropdown({
|
|
|
653
653
|
modal: false,
|
|
654
654
|
children: [
|
|
655
655
|
/* @__PURE__ */ jsxs(Menu.Trigger, {
|
|
656
|
-
className:
|
|
656
|
+
className: cn2("flex items-center justify-between bg-transparent hover:bg-hover hover:text-foreground transition-colors duration-fast outline-none focus-visible:ring-1 focus-visible:ring-focus-ring cursor-pointer", sizeClasses.gap, sizeClasses.control, sizeClasses.px, sizeClasses.text, open ? "bg-active text-foreground" : "text-muted-foreground active:bg-active", shape.input, "weight-medium"),
|
|
657
657
|
children: [
|
|
658
658
|
/* @__PURE__ */ jsx("span", {
|
|
659
659
|
children: FORMAT_LABELS[value]
|
|
@@ -661,7 +661,7 @@ function FormatDropdown({
|
|
|
661
661
|
/* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
662
662
|
size: 14,
|
|
663
663
|
strokeWidth: 1.5,
|
|
664
|
-
className:
|
|
664
|
+
className: cn2("text-muted-foreground transition-transform duration-150", open && "rotate-180")
|
|
665
665
|
})
|
|
666
666
|
]
|
|
667
667
|
}),
|
|
@@ -698,7 +698,7 @@ function FormatDropdown({
|
|
|
698
698
|
setActiveIndex(null);
|
|
699
699
|
},
|
|
700
700
|
className: "relative select-none outline-none",
|
|
701
|
-
children: /* @__PURE__ */ jsx(
|
|
701
|
+
children: /* @__PURE__ */ jsx(SurfaceProvider2, {
|
|
702
702
|
value: level,
|
|
703
703
|
children: /* @__PURE__ */ jsx(MorphSurface, {
|
|
704
704
|
morph,
|
|
@@ -721,14 +721,14 @@ function FormatDropdown({
|
|
|
721
721
|
height: checkedRect.height,
|
|
722
722
|
opacity: 1
|
|
723
723
|
},
|
|
724
|
-
exit: { opacity: 0, transition:
|
|
724
|
+
exit: { opacity: 0, transition: spring2.moderate.exit },
|
|
725
725
|
transition: {
|
|
726
|
-
...
|
|
727
|
-
opacity: { duration:
|
|
726
|
+
...spring2.moderate,
|
|
727
|
+
opacity: { duration: spring2.fast.duration }
|
|
728
728
|
}
|
|
729
729
|
})
|
|
730
730
|
}),
|
|
731
|
-
/* @__PURE__ */ jsx(
|
|
731
|
+
/* @__PURE__ */ jsx(FluidHoverHighlight2, {
|
|
732
732
|
hover,
|
|
733
733
|
from: checkedRect,
|
|
734
734
|
className: menuShape.bg
|
|
@@ -743,10 +743,10 @@ function FormatDropdown({
|
|
|
743
743
|
width: focusRect.width + 4,
|
|
744
744
|
height: focusRect.height + 4
|
|
745
745
|
},
|
|
746
|
-
exit: { opacity: 0, transition:
|
|
746
|
+
exit: { opacity: 0, transition: spring2.fast.exit },
|
|
747
747
|
transition: {
|
|
748
|
-
...
|
|
749
|
-
opacity: { duration:
|
|
748
|
+
...spring2.fast,
|
|
749
|
+
opacity: { duration: spring2.fast.duration }
|
|
750
750
|
}
|
|
751
751
|
})
|
|
752
752
|
}),
|
|
@@ -793,7 +793,7 @@ var TextColorInput = forwardRef(({
|
|
|
793
793
|
const [draft, setDraft] = useState(value);
|
|
794
794
|
const interactingRef = useRef(false);
|
|
795
795
|
const shape = useShape();
|
|
796
|
-
const sizeClasses =
|
|
796
|
+
const sizeClasses = useSize2();
|
|
797
797
|
const compact = sizeClasses.variant === "compact";
|
|
798
798
|
useEffect(() => {
|
|
799
799
|
if (!interactingRef.current)
|
|
@@ -824,11 +824,11 @@ var TextColorInput = forwardRef(({
|
|
|
824
824
|
commitNumber(cur + direction * baseStep);
|
|
825
825
|
};
|
|
826
826
|
return /* @__PURE__ */ jsxs("div", {
|
|
827
|
-
className:
|
|
827
|
+
className: cn2("flex items-center px-2 bg-transparent hover:bg-hover active:bg-active transition-colors duration-fast focus-within:ring-1 focus-within:ring-focus-ring select-none", sizeClasses.control, shape.input, className),
|
|
828
828
|
style: { width },
|
|
829
829
|
children: [
|
|
830
830
|
prefix && /* @__PURE__ */ jsx("span", {
|
|
831
|
-
className:
|
|
831
|
+
className: cn2("text-muted-foreground mr-1 select-none", compact ? "text-caption-compact" : "text-caption"),
|
|
832
832
|
children: prefix
|
|
833
833
|
}),
|
|
834
834
|
/* @__PURE__ */ jsx("input", {
|
|
@@ -864,7 +864,7 @@ var TextColorInput = forwardRef(({
|
|
|
864
864
|
},
|
|
865
865
|
inputMode,
|
|
866
866
|
"aria-label": ariaLabel,
|
|
867
|
-
className:
|
|
867
|
+
className: cn2("flex-1 min-w-0 bg-transparent text-foreground outline-none tabular-nums", sizeClasses.text, align === "center" && "text-center", align === "right" && "text-right", "weight-medium", inputClassName)
|
|
868
868
|
})
|
|
869
869
|
]
|
|
870
870
|
});
|
|
@@ -889,7 +889,7 @@ var ScrubColorInput = forwardRef(({
|
|
|
889
889
|
wrap = false
|
|
890
890
|
}, ref) => {
|
|
891
891
|
const shape = useShape();
|
|
892
|
-
const sizeClasses =
|
|
892
|
+
const sizeClasses = useSize2();
|
|
893
893
|
const compact = sizeClasses.variant === "compact";
|
|
894
894
|
const inputRef = useRef(null);
|
|
895
895
|
const [editing, setEditing] = useState(false);
|
|
@@ -955,7 +955,7 @@ var ScrubColorInput = forwardRef(({
|
|
|
955
955
|
step: nudgeStep ?? 1,
|
|
956
956
|
largeStep: nudgeShiftStep ?? 10,
|
|
957
957
|
format,
|
|
958
|
-
className:
|
|
958
|
+
className: cn2("flex items-center bg-transparent hover:bg-hover active:bg-active transition-colors duration-fast focus-within:ring-1 focus-within:ring-focus-ring select-none", sizeClasses.control, shape.input, className),
|
|
959
959
|
style: { width },
|
|
960
960
|
children: /* @__PURE__ */ jsxs(NumberField.ScrubArea, {
|
|
961
961
|
direction: "horizontal",
|
|
@@ -969,7 +969,7 @@ var ScrubColorInput = forwardRef(({
|
|
|
969
969
|
inputRef.current?.focus();
|
|
970
970
|
inputRef.current?.select();
|
|
971
971
|
},
|
|
972
|
-
className:
|
|
972
|
+
className: cn2("flex flex-1 min-w-0 items-center self-stretch px-2", !editing && "cursor-ew-resize"),
|
|
973
973
|
children: [
|
|
974
974
|
/* @__PURE__ */ jsx(NumberField.ScrubAreaCursor, {
|
|
975
975
|
className: "drop-shadow-picker-cursor",
|
|
@@ -986,7 +986,7 @@ var ScrubColorInput = forwardRef(({
|
|
|
986
986
|
})
|
|
987
987
|
}),
|
|
988
988
|
prefix && /* @__PURE__ */ jsx("span", {
|
|
989
|
-
className:
|
|
989
|
+
className: cn2("text-muted-foreground mr-1 select-none", compact ? "text-caption-compact" : "text-caption"),
|
|
990
990
|
children: prefix
|
|
991
991
|
}),
|
|
992
992
|
/* @__PURE__ */ jsx(NumberField.Input, {
|
|
@@ -1020,7 +1020,7 @@ var ScrubColorInput = forwardRef(({
|
|
|
1020
1020
|
input.blur();
|
|
1021
1021
|
}
|
|
1022
1022
|
},
|
|
1023
|
-
className:
|
|
1023
|
+
className: cn2("flex-1 min-w-0 bg-transparent text-foreground outline-none tabular-nums", sizeClasses.text, align === "center" && "text-center", align === "right" && "text-right", !editing && "pointer-events-none", "weight-medium", inputClassName)
|
|
1024
1024
|
})
|
|
1025
1025
|
]
|
|
1026
1026
|
})
|
|
@@ -1038,7 +1038,7 @@ ColorInput.displayName = "ColorInput";
|
|
|
1038
1038
|
function EyeDropperButton({ onPick }) {
|
|
1039
1039
|
const [supported, setSupported] = useState(false);
|
|
1040
1040
|
const shape = useShape();
|
|
1041
|
-
const sizeClasses =
|
|
1041
|
+
const sizeClasses = useSize2();
|
|
1042
1042
|
const PipetteIcon = useIcon("pipette");
|
|
1043
1043
|
useEffect(() => {
|
|
1044
1044
|
setSupported(typeof window !== "undefined" && "EyeDropper" in window);
|
|
@@ -1057,17 +1057,17 @@ function EyeDropperButton({ onPick }) {
|
|
|
1057
1057
|
type: "button",
|
|
1058
1058
|
onClick: handleClick,
|
|
1059
1059
|
"aria-label": "Pick color from screen",
|
|
1060
|
-
className:
|
|
1060
|
+
className: cn2("flex items-center justify-center text-muted-foreground bg-transparent hover:bg-hover hover:text-foreground active:bg-active transition-colors duration-fast outline-none focus-visible:ring-1 focus-visible:ring-focus-ring cursor-pointer", sizeClasses.control, sizeClasses.px, shape.input),
|
|
1061
1061
|
children: /* @__PURE__ */ jsx(PipetteIcon, {
|
|
1062
1062
|
size: sizeClasses.icon,
|
|
1063
1063
|
strokeWidth: 1.5
|
|
1064
1064
|
})
|
|
1065
1065
|
});
|
|
1066
1066
|
}
|
|
1067
|
-
function
|
|
1067
|
+
function ColorTile2({ color, size = 24, className, style }) {
|
|
1068
1068
|
const shape = useShape();
|
|
1069
1069
|
return /* @__PURE__ */ jsx("span", {
|
|
1070
|
-
className:
|
|
1070
|
+
className: cn2("inline-block relative shrink-0 overflow-hidden shadow-swatch", shape.bg, className),
|
|
1071
1071
|
style: {
|
|
1072
1072
|
width: size,
|
|
1073
1073
|
height: size,
|
|
@@ -1080,7 +1080,7 @@ function ColorTile({ color, size = 24, className, style }) {
|
|
|
1080
1080
|
})
|
|
1081
1081
|
});
|
|
1082
1082
|
}
|
|
1083
|
-
var
|
|
1083
|
+
var ColorSwatch2 = forwardRef(({ color, size = 28, selected, className, onMouseEnter, onMouseLeave, ...props }, ref) => {
|
|
1084
1084
|
const shape = useShape();
|
|
1085
1085
|
const [hovered, setHovered] = useState(false);
|
|
1086
1086
|
const ring = selected ? "shadow-swatch-selected" : hovered ? "shadow-swatch-hover" : "shadow-swatch";
|
|
@@ -1088,7 +1088,7 @@ var ColorSwatch = forwardRef(({ color, size = 28, selected, className, onMouseEn
|
|
|
1088
1088
|
ref,
|
|
1089
1089
|
type: "button",
|
|
1090
1090
|
"aria-label": `Select color ${color}`,
|
|
1091
|
-
className:
|
|
1091
|
+
className: cn2("relative shrink-0 overflow-hidden cursor-pointer outline-none transition-shadow duration-100", shape.bg, ring, className),
|
|
1092
1092
|
style: {
|
|
1093
1093
|
width: size,
|
|
1094
1094
|
height: size,
|
|
@@ -1109,21 +1109,21 @@ var ColorSwatch = forwardRef(({ color, size = 28, selected, className, onMouseEn
|
|
|
1109
1109
|
})
|
|
1110
1110
|
});
|
|
1111
1111
|
});
|
|
1112
|
-
|
|
1112
|
+
ColorSwatch2.displayName = "ColorSwatch";
|
|
1113
1113
|
function SwatchStrip({
|
|
1114
1114
|
swatches,
|
|
1115
1115
|
current,
|
|
1116
1116
|
onPick
|
|
1117
1117
|
}) {
|
|
1118
1118
|
const normalizedCurrent = useMemo(() => {
|
|
1119
|
-
const p =
|
|
1119
|
+
const p = parseColor2(current);
|
|
1120
1120
|
return p ? rgbToHexStr(p.r, p.g, p.b, p.a).toLowerCase() : "";
|
|
1121
1121
|
}, [current]);
|
|
1122
1122
|
const [resolvedSwatches, setResolvedSwatches] = useState({});
|
|
1123
1123
|
useEffect(() => {
|
|
1124
1124
|
const next = {};
|
|
1125
1125
|
for (const sw of swatches) {
|
|
1126
|
-
if (!
|
|
1126
|
+
if (!parseColor2(sw)) {
|
|
1127
1127
|
const p = resolveCssColor(sw);
|
|
1128
1128
|
if (p)
|
|
1129
1129
|
next[sw] = rgbToHexStr(p.r, p.g, p.b, p.a).toLowerCase();
|
|
@@ -1134,10 +1134,10 @@ function SwatchStrip({
|
|
|
1134
1134
|
return /* @__PURE__ */ jsx("div", {
|
|
1135
1135
|
className: "flex flex-wrap gap-2",
|
|
1136
1136
|
children: swatches.map((sw, i) => {
|
|
1137
|
-
const parsed =
|
|
1137
|
+
const parsed = parseColor2(sw);
|
|
1138
1138
|
const normalized = parsed ? rgbToHexStr(parsed.r, parsed.g, parsed.b, parsed.a).toLowerCase() : resolvedSwatches[sw] ?? sw.toLowerCase();
|
|
1139
1139
|
const isSelected = normalized === normalizedCurrent;
|
|
1140
|
-
return /* @__PURE__ */ jsx(
|
|
1140
|
+
return /* @__PURE__ */ jsx(ColorSwatch2, {
|
|
1141
1141
|
color: sw,
|
|
1142
1142
|
size: 28,
|
|
1143
1143
|
selected: isSelected,
|
|
@@ -1146,7 +1146,7 @@ function SwatchStrip({
|
|
|
1146
1146
|
})
|
|
1147
1147
|
});
|
|
1148
1148
|
}
|
|
1149
|
-
var
|
|
1149
|
+
var ColorPicker2 = forwardRef(({
|
|
1150
1150
|
value,
|
|
1151
1151
|
defaultValue = "#6B97FF",
|
|
1152
1152
|
onValueChange,
|
|
@@ -1168,11 +1168,11 @@ var ColorPicker = forwardRef(({
|
|
|
1168
1168
|
const [internalFormat, setInternalFormat] = useState(defaultFormat);
|
|
1169
1169
|
const currentFormat = isFormatControlled ? format : internalFormat;
|
|
1170
1170
|
const initialParsed = useMemo(() => {
|
|
1171
|
-
const p =
|
|
1171
|
+
const p = parseColor2(currentRawValue);
|
|
1172
1172
|
if (!p)
|
|
1173
1173
|
return { h: 0, s: 1, v: 1, a: 1 };
|
|
1174
|
-
const
|
|
1175
|
-
return { h:
|
|
1174
|
+
const hsv = rgbToHsv(p.r, p.g, p.b);
|
|
1175
|
+
return { h: hsv.s === 0 ? 0 : hsv.h, s: hsv.s, v: hsv.v, a: p.a };
|
|
1176
1176
|
}, []);
|
|
1177
1177
|
const [hsv, setHsv] = useState(initialParsed);
|
|
1178
1178
|
const oklchHueRef = useRef(null);
|
|
@@ -1184,7 +1184,7 @@ var ColorPicker = forwardRef(({
|
|
|
1184
1184
|
const cur = value;
|
|
1185
1185
|
if (cur === emitted)
|
|
1186
1186
|
return;
|
|
1187
|
-
const p =
|
|
1187
|
+
const p = parseColor2(cur);
|
|
1188
1188
|
if (!p)
|
|
1189
1189
|
return;
|
|
1190
1190
|
oklchHueRef.current = null;
|
|
@@ -1196,11 +1196,11 @@ var ColorPicker = forwardRef(({
|
|
|
1196
1196
|
a: p.a
|
|
1197
1197
|
}));
|
|
1198
1198
|
}, [value, isControlled]);
|
|
1199
|
-
const parsed = useMemo(() =>
|
|
1199
|
+
const parsed = useMemo(() => buildParsed2(hsv.h, hsv.s, hsv.v, hsv.a), [hsv]);
|
|
1200
1200
|
const updateHsv = useCallback((next) => {
|
|
1201
1201
|
const merged = { ...hsv, ...next };
|
|
1202
1202
|
setHsv(merged);
|
|
1203
|
-
const p =
|
|
1203
|
+
const p = buildParsed2(merged.h, merged.s, merged.v, merged.a);
|
|
1204
1204
|
const formatted = formatValueByFormat(p, currentFormat);
|
|
1205
1205
|
lastEmittedRef.current = formatted;
|
|
1206
1206
|
if (!isControlled)
|
|
@@ -1230,7 +1230,7 @@ var ColorPicker = forwardRef(({
|
|
|
1230
1230
|
a: p.a
|
|
1231
1231
|
};
|
|
1232
1232
|
setHsv(merged);
|
|
1233
|
-
const next =
|
|
1233
|
+
const next = buildParsed2(merged.h, merged.s, merged.v, merged.a);
|
|
1234
1234
|
const formatted = formatValueByFormat(next, currentFormat);
|
|
1235
1235
|
lastEmittedRef.current = formatted;
|
|
1236
1236
|
if (!isControlled)
|
|
@@ -1249,14 +1249,14 @@ var ColorPicker = forwardRef(({
|
|
|
1249
1249
|
const solidB = Math.round(solidHueRgb.b);
|
|
1250
1250
|
const solidColorString = `rgb(${solidR}, ${solidG}, ${solidB})`;
|
|
1251
1251
|
const shape = useShape();
|
|
1252
|
-
const substrate =
|
|
1252
|
+
const substrate = useSurface2();
|
|
1253
1253
|
const pickerLevel = Math.max(substrate, 3);
|
|
1254
1254
|
const paintsSurface = useContext(PanelSurfaceContext);
|
|
1255
|
-
const root = /* @__PURE__ */ jsx(
|
|
1255
|
+
const root = /* @__PURE__ */ jsx(SurfaceProvider2, {
|
|
1256
1256
|
value: pickerLevel,
|
|
1257
1257
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1258
1258
|
ref,
|
|
1259
|
-
className:
|
|
1259
|
+
className: cn2("flex flex-col gap-2 p-3", paintsSurface && surfaceClasses2(pickerLevel, 1), shape.container, className),
|
|
1260
1260
|
style: { width: PANEL_WIDTH },
|
|
1261
1261
|
...props,
|
|
1262
1262
|
children: [
|
|
@@ -1304,19 +1304,19 @@ var ColorPicker = forwardRef(({
|
|
|
1304
1304
|
parsed,
|
|
1305
1305
|
format: currentFormat,
|
|
1306
1306
|
oklchHue: oklchHueRef.current,
|
|
1307
|
-
onChannelChange: (channel,
|
|
1307
|
+
onChannelChange: (channel, value) => {
|
|
1308
1308
|
const p = { ...parsed };
|
|
1309
1309
|
switch (channel) {
|
|
1310
1310
|
case "hex":
|
|
1311
|
-
handleHexCommit(
|
|
1311
|
+
handleHexCommit(value);
|
|
1312
1312
|
return;
|
|
1313
1313
|
case "r":
|
|
1314
1314
|
case "g":
|
|
1315
1315
|
case "b": {
|
|
1316
1316
|
oklchHueRef.current = null;
|
|
1317
|
-
const r = channel === "r" ? Number(
|
|
1318
|
-
const g = channel === "g" ? Number(
|
|
1319
|
-
const b = channel === "b" ? Number(
|
|
1317
|
+
const r = channel === "r" ? Number(value) : p.r;
|
|
1318
|
+
const g = channel === "g" ? Number(value) : p.g;
|
|
1319
|
+
const b = channel === "b" ? Number(value) : p.b;
|
|
1320
1320
|
const hsvVal = rgbToHsv(r, g, b);
|
|
1321
1321
|
updateHsv({
|
|
1322
1322
|
h: hsvVal.s === 0 ? hsv.h : hsvVal.h,
|
|
@@ -1331,9 +1331,9 @@ var ColorPicker = forwardRef(({
|
|
|
1331
1331
|
if (channel === "hSL")
|
|
1332
1332
|
oklchHueRef.current = null;
|
|
1333
1333
|
const hsl = rgbToHsl(p.r, p.g, p.b);
|
|
1334
|
-
const h2 = channel === "hSL" ? Number(
|
|
1335
|
-
const s2 = channel === "sSL" ? Number(
|
|
1336
|
-
const l2 = channel === "lSL" ? Number(
|
|
1334
|
+
const h2 = channel === "hSL" ? Number(value) : hsl.h;
|
|
1335
|
+
const s2 = channel === "sSL" ? Number(value) / 100 : hsl.s;
|
|
1336
|
+
const l2 = channel === "lSL" ? Number(value) / 100 : hsl.l;
|
|
1337
1337
|
const rgb = hslToRgb(h2, clamp01(s2), clamp01(l2));
|
|
1338
1338
|
const hsvVal = rgbToHsv(rgb.r, rgb.g, rgb.b);
|
|
1339
1339
|
updateHsv({
|
|
@@ -1348,9 +1348,9 @@ var ColorPicker = forwardRef(({
|
|
|
1348
1348
|
case "H": {
|
|
1349
1349
|
const cur = rgbToOklch(p.r, p.g, p.b);
|
|
1350
1350
|
const baseH = oklchHueRef.current ?? cur.H;
|
|
1351
|
-
const L = channel === "L" ? Number(
|
|
1352
|
-
const C = channel === "C" ? Number(
|
|
1353
|
-
const H = channel === "H" ? Number(
|
|
1351
|
+
const L = channel === "L" ? Number(value) / 100 : cur.L;
|
|
1352
|
+
const C = channel === "C" ? Number(value) : cur.C;
|
|
1353
|
+
const H = channel === "H" ? Number(value) : baseH;
|
|
1354
1354
|
oklchHueRef.current = H;
|
|
1355
1355
|
const rgb = oklchToRgb(clamp01(L), Math.max(0, C), H);
|
|
1356
1356
|
const hsvVal = rgbToHsv(rgb.r, rgb.g, rgb.b);
|
|
@@ -1362,7 +1362,7 @@ var ColorPicker = forwardRef(({
|
|
|
1362
1362
|
return;
|
|
1363
1363
|
}
|
|
1364
1364
|
case "alphaPercent": {
|
|
1365
|
-
const a = clamp01(Number(
|
|
1365
|
+
const a = clamp01(Number(value) / 100);
|
|
1366
1366
|
updateHsv({ a });
|
|
1367
1367
|
return;
|
|
1368
1368
|
}
|
|
@@ -1377,12 +1377,12 @@ var ColorPicker = forwardRef(({
|
|
|
1377
1377
|
]
|
|
1378
1378
|
})
|
|
1379
1379
|
});
|
|
1380
|
-
return size ? /* @__PURE__ */ jsx(
|
|
1380
|
+
return size ? /* @__PURE__ */ jsx(SizeProvider2, {
|
|
1381
1381
|
size,
|
|
1382
1382
|
children: root
|
|
1383
1383
|
}) : root;
|
|
1384
1384
|
});
|
|
1385
|
-
|
|
1385
|
+
ColorPicker2.displayName = "ColorPicker";
|
|
1386
1386
|
function ColorInputsRow({
|
|
1387
1387
|
parsed,
|
|
1388
1388
|
format,
|
|
@@ -1585,7 +1585,7 @@ function ColorInputsRow({
|
|
|
1585
1585
|
});
|
|
1586
1586
|
}
|
|
1587
1587
|
function ChannelTooltip({ label, children }) {
|
|
1588
|
-
return /* @__PURE__ */ jsx(
|
|
1588
|
+
return /* @__PURE__ */ jsx(Tooltip2, {
|
|
1589
1589
|
content: label,
|
|
1590
1590
|
delayDuration: 300,
|
|
1591
1591
|
children: /* @__PURE__ */ jsx("div", {
|
|
@@ -1616,7 +1616,7 @@ function AlphaInput({ value, onCommit }) {
|
|
|
1616
1616
|
})
|
|
1617
1617
|
});
|
|
1618
1618
|
}
|
|
1619
|
-
var
|
|
1619
|
+
var ColorPickerPopover2 = forwardRef(({
|
|
1620
1620
|
triggerLabel,
|
|
1621
1621
|
triggerLabelPosition = "left",
|
|
1622
1622
|
triggerShowValue = true,
|
|
@@ -1639,9 +1639,9 @@ var ColorPickerPopover = forwardRef(({
|
|
|
1639
1639
|
const { origin, capture } = useMorphOrigin();
|
|
1640
1640
|
const morph = useMorph(open, origin, { from, effect, hideSource, tier });
|
|
1641
1641
|
const shape = useShape();
|
|
1642
|
-
const sizeClasses =
|
|
1642
|
+
const sizeClasses = useSize2(size);
|
|
1643
1643
|
const compact = sizeClasses.variant === "compact";
|
|
1644
|
-
const substrate =
|
|
1644
|
+
const substrate = useSurface2();
|
|
1645
1645
|
const level = Math.min(substrate + 2, 8);
|
|
1646
1646
|
const handleOpenChange = useCallback((next, details) => {
|
|
1647
1647
|
if (next)
|
|
@@ -1653,13 +1653,13 @@ var ColorPickerPopover = forwardRef(({
|
|
|
1653
1653
|
const isControlled = pickerProps.value !== undefined;
|
|
1654
1654
|
const [internalValue, setInternalValue] = useState(pickerProps.value ?? pickerProps.defaultValue ?? "#6B97FF");
|
|
1655
1655
|
const currentValue = isControlled ? pickerProps.value : internalValue;
|
|
1656
|
-
const handleValueChange = useCallback((v,
|
|
1656
|
+
const handleValueChange = useCallback((v, parsed) => {
|
|
1657
1657
|
if (!isControlled)
|
|
1658
1658
|
setInternalValue(v);
|
|
1659
|
-
pickerProps.onValueChange?.(v,
|
|
1659
|
+
pickerProps.onValueChange?.(v, parsed);
|
|
1660
1660
|
}, [isControlled, pickerProps]);
|
|
1661
1661
|
const XIcon = useIcon("x");
|
|
1662
|
-
const parsed = useMemo(() =>
|
|
1662
|
+
const parsed = useMemo(() => parseColor2(currentValue), [currentValue]);
|
|
1663
1663
|
const swatchColor = parsed ? rgbToHexStr(parsed.r, parsed.g, parsed.b, parsed.a) : currentValue;
|
|
1664
1664
|
const valueLabel = parsed ? rgbToHexStr(parsed.r, parsed.g, parsed.b, 1).replace(/^#/, "").toUpperCase() : currentValue;
|
|
1665
1665
|
const root = /* @__PURE__ */ jsx(Popover.Root, {
|
|
@@ -1671,22 +1671,22 @@ var ColorPickerPopover = forwardRef(({
|
|
|
1671
1671
|
className: "inline-flex",
|
|
1672
1672
|
children: [
|
|
1673
1673
|
/* @__PURE__ */ jsxs(Popover.Trigger, {
|
|
1674
|
-
className:
|
|
1674
|
+
className: cn2("flex items-center border border-border bg-transparent hover:bg-hover transition-colors duration-fast outline-none focus-visible:ring-1 focus-visible:ring-focus-ring cursor-pointer", sizeClasses.gap, sizeClasses.control, compact ? "px-1.5" : "px-2", shape.input, "weight-medium", triggerClassName),
|
|
1675
1675
|
children: [
|
|
1676
1676
|
triggerLabel && triggerLabelPosition === "left" && /* @__PURE__ */ jsx("span", {
|
|
1677
|
-
className:
|
|
1677
|
+
className: cn2("text-muted-foreground px-1 select-none", sizeClasses.text),
|
|
1678
1678
|
children: triggerLabel
|
|
1679
1679
|
}),
|
|
1680
|
-
/* @__PURE__ */ jsx(
|
|
1680
|
+
/* @__PURE__ */ jsx(ColorTile2, {
|
|
1681
1681
|
color: swatchColor,
|
|
1682
1682
|
size: compact ? 16 : 20
|
|
1683
1683
|
}),
|
|
1684
1684
|
triggerShowValue && /* @__PURE__ */ jsx("span", {
|
|
1685
|
-
className:
|
|
1685
|
+
className: cn2("text-foreground tabular-nums", sizeClasses.text),
|
|
1686
1686
|
children: valueLabel
|
|
1687
1687
|
}),
|
|
1688
1688
|
triggerLabel && triggerLabelPosition === "right" && /* @__PURE__ */ jsx("span", {
|
|
1689
|
-
className:
|
|
1689
|
+
className: cn2("text-muted-foreground px-1 select-none", sizeClasses.text),
|
|
1690
1690
|
children: triggerLabel
|
|
1691
1691
|
}),
|
|
1692
1692
|
triggerShowRemove && /* @__PURE__ */ jsx("span", {
|
|
@@ -1721,9 +1721,9 @@ var ColorPickerPopover = forwardRef(({
|
|
|
1721
1721
|
children: /* @__PURE__ */ jsx(Popover.Popup, {
|
|
1722
1722
|
ref: morph.popupRef,
|
|
1723
1723
|
className: "relative outline-none",
|
|
1724
|
-
children: /* @__PURE__ */ jsx(
|
|
1724
|
+
children: /* @__PURE__ */ jsx(ColorPickerPortalContainer2, {
|
|
1725
1725
|
value: morph.popup,
|
|
1726
|
-
children: /* @__PURE__ */ jsx(
|
|
1726
|
+
children: /* @__PURE__ */ jsx(SurfaceProvider2, {
|
|
1727
1727
|
value: level,
|
|
1728
1728
|
children: /* @__PURE__ */ jsx(MorphSurface, {
|
|
1729
1729
|
morph,
|
|
@@ -1732,7 +1732,7 @@ var ColorPickerPopover = forwardRef(({
|
|
|
1732
1732
|
radius: shape.container,
|
|
1733
1733
|
children: /* @__PURE__ */ jsx(PanelSurfaceContext.Provider, {
|
|
1734
1734
|
value: false,
|
|
1735
|
-
children: /* @__PURE__ */ jsx(
|
|
1735
|
+
children: /* @__PURE__ */ jsx(ColorPicker2, {
|
|
1736
1736
|
...pickerProps,
|
|
1737
1737
|
value: currentValue,
|
|
1738
1738
|
onValueChange: handleValueChange
|
|
@@ -1747,13 +1747,13 @@ var ColorPickerPopover = forwardRef(({
|
|
|
1747
1747
|
]
|
|
1748
1748
|
})
|
|
1749
1749
|
});
|
|
1750
|
-
return size ? /* @__PURE__ */ jsx(
|
|
1750
|
+
return size ? /* @__PURE__ */ jsx(SizeProvider2, {
|
|
1751
1751
|
size,
|
|
1752
1752
|
children: root
|
|
1753
1753
|
}) : root;
|
|
1754
1754
|
});
|
|
1755
|
-
|
|
1756
|
-
Object.assign(
|
|
1757
|
-
var color_picker_default =
|
|
1755
|
+
ColorPickerPopover2.displayName = "ColorPickerPopover";
|
|
1756
|
+
Object.assign(ColorPicker2, { Popover: ColorPickerPopover2 });
|
|
1757
|
+
var color_picker_default = ColorPicker2;
|
|
1758
1758
|
|
|
1759
|
-
export {
|
|
1759
|
+
export { ColorPickerPortalContainer2, parseColor2, buildParsed2, ColorTile2, ColorSwatch2, ColorPicker2, ColorPickerPopover2, color_picker_default };
|