doodleui-react 0.3.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/dist/index.js CHANGED
@@ -14,6 +14,12 @@ import * as ToastPrimitive from '@radix-ui/react-toast';
14
14
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
15
15
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
16
16
  import * as SliderPrimitive from '@radix-ui/react-slider';
17
+ import * as LabelPrimitive from '@radix-ui/react-label';
18
+ import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
19
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
20
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
21
+ import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
22
+ import { Command as Command$1, CommandInput as CommandInput$1, CommandList as CommandList$1, CommandEmpty as CommandEmpty$1, CommandGroup as CommandGroup$1, CommandItem as CommandItem$1, CommandSeparator as CommandSeparator$1 } from 'cmdk';
17
23
 
18
24
  // src/types.ts
19
25
  function toRoughOptions(props) {
@@ -3697,7 +3703,1479 @@ var Stepper = forwardRef(
3697
3703
  );
3698
3704
  }
3699
3705
  );
3706
+ var Label2 = forwardRef(function Label3({
3707
+ className,
3708
+ style,
3709
+ children,
3710
+ required,
3711
+ roughness,
3712
+ seed,
3713
+ sketchColor,
3714
+ bowing,
3715
+ strokeWidth,
3716
+ animate,
3717
+ ...rest
3718
+ }, ref) {
3719
+ const ink = sketchColor ?? SKETCH_COLORS.ink;
3720
+ const resolvedSeed = useResolvedSeed(seed);
3721
+ const shouldAnimate = useAnimate(animate);
3722
+ const markRef = useRef(null);
3723
+ useDrawIn(markRef, DRAW_IN_MARK_MS, shouldAnimate);
3724
+ return /* @__PURE__ */ jsxs(
3725
+ LabelPrimitive.Root,
3726
+ {
3727
+ ref,
3728
+ className: cn(className),
3729
+ style: {
3730
+ display: "inline-flex",
3731
+ alignItems: "center",
3732
+ gap: 4,
3733
+ fontFamily: doodleUiFontFamily,
3734
+ fontSize: 13,
3735
+ fontWeight: doodleUiFontWeight(600),
3736
+ color: ink,
3737
+ cursor: "default",
3738
+ ...style
3739
+ },
3740
+ ...rest,
3741
+ children: [
3742
+ children,
3743
+ required ? /* @__PURE__ */ jsx(
3744
+ "span",
3745
+ {
3746
+ ref: markRef,
3747
+ "aria-hidden": "true",
3748
+ style: { position: "relative", width: 10, height: 10, flexShrink: 0 },
3749
+ children: /* @__PURE__ */ jsx(
3750
+ RoughSvg,
3751
+ {
3752
+ shape: "ellipse",
3753
+ roughness: (roughness ?? 1.5) * 0.9,
3754
+ seed: resolvedSeed,
3755
+ sketchColor: SKETCH_COLORS.accent,
3756
+ bowing,
3757
+ fillStyle: "solid",
3758
+ fill: SKETCH_COLORS.accent,
3759
+ strokeWidth: strokeWidth ?? 1.2,
3760
+ inset: 1
3761
+ }
3762
+ )
3763
+ }
3764
+ ) : null
3765
+ ]
3766
+ }
3767
+ );
3768
+ });
3769
+ var CHEVRON_PATH4 = "M 6 4 L 12 10 L 6 16";
3770
+ var CollapsibleSketchContext = createContext(null);
3771
+ function useCollapsibleSketch() {
3772
+ const ctx = useContext(CollapsibleSketchContext);
3773
+ if (!ctx) {
3774
+ throw new Error(
3775
+ "Collapsible parts must be used inside <Collapsible>."
3776
+ );
3777
+ }
3778
+ return ctx;
3779
+ }
3780
+ var Collapsible = forwardRef(
3781
+ function Collapsible2({
3782
+ className,
3783
+ style,
3784
+ children,
3785
+ open,
3786
+ defaultOpen,
3787
+ onOpenChange,
3788
+ disabled,
3789
+ roughness,
3790
+ seed,
3791
+ sketchColor,
3792
+ bowing,
3793
+ fillStyle,
3794
+ strokeWidth,
3795
+ ...rest
3796
+ }, ref) {
3797
+ const resolvedSeed = useResolvedSeed(seed);
3798
+ const ink = sketchColor ?? SKETCH_COLORS.ink;
3799
+ const [uncontrolled, setUncontrolled] = useState(defaultOpen ?? false);
3800
+ const isOpen = open ?? uncontrolled;
3801
+ return /* @__PURE__ */ jsx(
3802
+ CollapsibleSketchContext.Provider,
3803
+ {
3804
+ value: {
3805
+ roughness,
3806
+ seed: resolvedSeed,
3807
+ sketchColor,
3808
+ bowing,
3809
+ fillStyle,
3810
+ strokeWidth,
3811
+ resolvedSeed,
3812
+ ink,
3813
+ open: isOpen
3814
+ },
3815
+ children: /* @__PURE__ */ jsx(
3816
+ CollapsiblePrimitive.Root,
3817
+ {
3818
+ ref,
3819
+ open: isOpen,
3820
+ disabled,
3821
+ className: cn(className),
3822
+ style,
3823
+ onOpenChange: (next) => {
3824
+ setUncontrolled(next);
3825
+ onOpenChange?.(next);
3826
+ },
3827
+ ...rest,
3828
+ children
3829
+ }
3830
+ )
3831
+ }
3832
+ );
3833
+ }
3834
+ );
3835
+ var CollapsibleTrigger = forwardRef(function CollapsibleTrigger2({ className, style, children, ...rest }, ref) {
3836
+ const sketch = useCollapsibleSketch();
3837
+ return /* @__PURE__ */ jsxs(
3838
+ CollapsiblePrimitive.Trigger,
3839
+ {
3840
+ ref,
3841
+ className: cn(className),
3842
+ style: {
3843
+ display: "flex",
3844
+ width: "100%",
3845
+ alignItems: "center",
3846
+ justifyContent: "space-between",
3847
+ gap: 12,
3848
+ padding: "10px 4px",
3849
+ border: "none",
3850
+ background: "transparent",
3851
+ cursor: "pointer",
3852
+ fontFamily: doodleUiFontFamily,
3853
+ fontSize: 15,
3854
+ fontWeight: doodleUiFontWeight(600),
3855
+ color: sketch.ink,
3856
+ textAlign: "left",
3857
+ outline: "none",
3858
+ ...style
3859
+ },
3860
+ ...rest,
3861
+ children: [
3862
+ /* @__PURE__ */ jsx("span", { children }),
3863
+ /* @__PURE__ */ jsx(
3864
+ "span",
3865
+ {
3866
+ style: {
3867
+ position: "relative",
3868
+ width: 18,
3869
+ height: 18,
3870
+ flexShrink: 0,
3871
+ transform: sketch.open ? "rotate(90deg)" : "rotate(0deg)",
3872
+ transition: "transform 180ms ease"
3873
+ },
3874
+ children: /* @__PURE__ */ jsx(
3875
+ RoughSvg,
3876
+ {
3877
+ shape: "path",
3878
+ path: CHEVRON_PATH4,
3879
+ roughness: (sketch.roughness ?? 1.5) * 0.7,
3880
+ seed: sketch.resolvedSeed,
3881
+ sketchColor: sketch.ink,
3882
+ bowing: sketch.bowing,
3883
+ strokeWidth: (sketch.strokeWidth ?? 1.6) + 0.2,
3884
+ inset: 0
3885
+ }
3886
+ )
3887
+ }
3888
+ )
3889
+ ]
3890
+ }
3891
+ );
3892
+ });
3893
+ var CollapsibleContent = forwardRef(function CollapsibleContent2({ className, style, children, ...rest }, ref) {
3894
+ const sketch = useCollapsibleSketch();
3895
+ return /* @__PURE__ */ jsx(
3896
+ CollapsiblePrimitive.Content,
3897
+ {
3898
+ ref,
3899
+ className: cn(className),
3900
+ style: {
3901
+ padding: "0 4px 12px",
3902
+ fontFamily: doodleUiFontFamily,
3903
+ fontSize: 14,
3904
+ lineHeight: 1.5,
3905
+ color: sketch.ink,
3906
+ ...style
3907
+ },
3908
+ ...rest,
3909
+ children
3910
+ }
3911
+ );
3912
+ });
3913
+ var PopoverSketchContext = createContext(
3914
+ null
3915
+ );
3916
+ function usePopoverSketch() {
3917
+ const ctx = useContext(PopoverSketchContext);
3918
+ if (!ctx) {
3919
+ throw new Error("Popover parts must be used inside <Popover>.");
3920
+ }
3921
+ return ctx;
3922
+ }
3923
+ function Popover({
3924
+ children,
3925
+ roughness,
3926
+ seed,
3927
+ sketchColor,
3928
+ bowing,
3929
+ fillStyle,
3930
+ strokeWidth,
3931
+ animate,
3932
+ ...rest
3933
+ }) {
3934
+ const resolvedSeed = useResolvedSeed(seed);
3935
+ const ink = sketchColor ?? SKETCH_COLORS.ink;
3936
+ return /* @__PURE__ */ jsx(
3937
+ PopoverSketchContext.Provider,
3938
+ {
3939
+ value: {
3940
+ roughness,
3941
+ seed: resolvedSeed,
3942
+ sketchColor,
3943
+ bowing,
3944
+ fillStyle,
3945
+ strokeWidth,
3946
+ resolvedSeed,
3947
+ ink,
3948
+ animate
3949
+ },
3950
+ children: /* @__PURE__ */ jsx(PopoverPrimitive.Root, { ...rest, children })
3951
+ }
3952
+ );
3953
+ }
3954
+ var PopoverTrigger = PopoverPrimitive.Trigger;
3955
+ var PopoverAnchor = PopoverPrimitive.Anchor;
3956
+ var PopoverClose = PopoverPrimitive.Close;
3957
+ var PopoverContent = forwardRef(
3958
+ function PopoverContent2({ className, style, children, sideOffset = 8, ...rest }, ref) {
3959
+ const sketch = usePopoverSketch();
3960
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
3961
+ PopoverPrimitive.Content,
3962
+ {
3963
+ ref,
3964
+ sideOffset,
3965
+ className: cn(className),
3966
+ style: { zIndex: 80, outline: "none", ...style },
3967
+ ...rest,
3968
+ children: /* @__PURE__ */ jsx(
3969
+ SketchBox,
3970
+ {
3971
+ roughness: sketch.roughness,
3972
+ seed: sketch.resolvedSeed,
3973
+ sketchColor: sketch.ink,
3974
+ bowing: sketch.bowing,
3975
+ fillStyle: sketch.fillStyle ?? "solid",
3976
+ fill: "#f7f6f2",
3977
+ strokeWidth: sketch.strokeWidth ?? 1.5,
3978
+ shadow: true,
3979
+ animate: sketch.animate,
3980
+ contentStyle: { padding: "14px 16px", minWidth: 200 },
3981
+ children
3982
+ }
3983
+ )
3984
+ }
3985
+ ) });
3986
+ }
3987
+ );
3988
+ var PopoverArrow = forwardRef(
3989
+ function PopoverArrow2(props, ref) {
3990
+ const sketch = usePopoverSketch();
3991
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Arrow, { ref, fill: sketch.ink, ...props });
3992
+ }
3993
+ );
3994
+ var DropdownMenuSketchContext = createContext(null);
3995
+ function useDropdownMenuSketch() {
3996
+ const ctx = useContext(DropdownMenuSketchContext);
3997
+ if (!ctx) {
3998
+ throw new Error(
3999
+ "DropdownMenu parts must be used inside <DropdownMenu>."
4000
+ );
4001
+ }
4002
+ return ctx;
4003
+ }
4004
+ function DropdownMenu({
4005
+ children,
4006
+ roughness,
4007
+ seed,
4008
+ sketchColor,
4009
+ bowing,
4010
+ fillStyle,
4011
+ strokeWidth,
4012
+ animate,
4013
+ ...rest
4014
+ }) {
4015
+ const resolvedSeed = useResolvedSeed(seed);
4016
+ const ink = sketchColor ?? SKETCH_COLORS.ink;
4017
+ return /* @__PURE__ */ jsx(
4018
+ DropdownMenuSketchContext.Provider,
4019
+ {
4020
+ value: {
4021
+ roughness,
4022
+ seed: resolvedSeed,
4023
+ sketchColor,
4024
+ bowing,
4025
+ fillStyle,
4026
+ strokeWidth,
4027
+ resolvedSeed,
4028
+ ink,
4029
+ animate
4030
+ },
4031
+ children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { ...rest, children })
4032
+ }
4033
+ );
4034
+ }
4035
+ var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
4036
+ var DropdownMenuGroup = DropdownMenuPrimitive.Group;
4037
+ var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
4038
+ var DropdownMenuSub = DropdownMenuPrimitive.Sub;
4039
+ var DropdownMenuContent = forwardRef(function DropdownMenuContent2({ className, style, children, sideOffset = 6, align = "start", ...rest }, ref) {
4040
+ const sketch = useDropdownMenuSketch();
4041
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
4042
+ DropdownMenuPrimitive.Content,
4043
+ {
4044
+ ref,
4045
+ sideOffset,
4046
+ align,
4047
+ className: cn(className),
4048
+ style: { zIndex: 80, outline: "none", minWidth: 180, ...style },
4049
+ ...rest,
4050
+ children: /* @__PURE__ */ jsx(
4051
+ SketchBox,
4052
+ {
4053
+ roughness: sketch.roughness,
4054
+ seed: sketch.resolvedSeed,
4055
+ sketchColor: sketch.ink,
4056
+ bowing: sketch.bowing,
4057
+ fillStyle: sketch.fillStyle ?? "solid",
4058
+ fill: "#f7f6f2",
4059
+ strokeWidth: sketch.strokeWidth ?? 1.5,
4060
+ shadow: true,
4061
+ animate: sketch.animate,
4062
+ contentStyle: { padding: "6px 4px" },
4063
+ children
4064
+ }
4065
+ )
4066
+ }
4067
+ ) });
4068
+ });
4069
+ function useMark(highlighted) {
4070
+ const sketch = useDropdownMenuSketch();
4071
+ return { sketch, mark: highlighted };
4072
+ }
4073
+ var DropdownMenuItem = forwardRef(function DropdownMenuItem2({ className, style, children, inset, ...rest }, ref) {
4074
+ const [highlighted, setHighlighted] = useState(false);
4075
+ const { sketch, mark } = useMark(highlighted);
4076
+ return /* @__PURE__ */ jsxs(
4077
+ DropdownMenuPrimitive.Item,
4078
+ {
4079
+ ref,
4080
+ className: cn(className),
4081
+ onPointerMove: () => setHighlighted(true),
4082
+ onPointerLeave: () => setHighlighted(false),
4083
+ onFocus: () => setHighlighted(true),
4084
+ onBlur: () => setHighlighted(false),
4085
+ style: {
4086
+ position: "relative",
4087
+ display: "flex",
4088
+ alignItems: "center",
4089
+ gap: 8,
4090
+ padding: inset ? "7px 12px 7px 26px" : "7px 12px",
4091
+ fontFamily: doodleUiFontFamily,
4092
+ fontSize: 14,
4093
+ color: sketch.ink,
4094
+ outline: "none",
4095
+ cursor: "pointer",
4096
+ userSelect: "none",
4097
+ ...style
4098
+ },
4099
+ ...rest,
4100
+ children: [
4101
+ mark ? /* @__PURE__ */ jsx(
4102
+ RoughSvg,
4103
+ {
4104
+ shape: "line",
4105
+ roughness: (sketch.roughness ?? 1.5) + 0.4,
4106
+ seed: sketch.resolvedSeed,
4107
+ sketchColor: sketch.ink,
4108
+ bowing: sketch.bowing ?? 1.6,
4109
+ strokeWidth: 1.3,
4110
+ inset: 4,
4111
+ style: { opacity: 0.4 }
4112
+ }
4113
+ ) : null,
4114
+ /* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1 }, children })
4115
+ ]
4116
+ }
4117
+ );
4118
+ });
4119
+ var CHECK_PATH2 = "M 2 6 L 5 9 L 10 3";
4120
+ var DropdownMenuCheckboxItem = forwardRef(function DropdownMenuCheckboxItem2({ className, style, children, checked, ...rest }, ref) {
4121
+ const [highlighted, setHighlighted] = useState(false);
4122
+ const { sketch, mark } = useMark(highlighted);
4123
+ return /* @__PURE__ */ jsxs(
4124
+ DropdownMenuPrimitive.CheckboxItem,
4125
+ {
4126
+ ref,
4127
+ checked,
4128
+ className: cn(className),
4129
+ onPointerMove: () => setHighlighted(true),
4130
+ onPointerLeave: () => setHighlighted(false),
4131
+ style: {
4132
+ position: "relative",
4133
+ display: "flex",
4134
+ alignItems: "center",
4135
+ gap: 8,
4136
+ padding: "7px 12px 7px 26px",
4137
+ fontFamily: doodleUiFontFamily,
4138
+ fontSize: 14,
4139
+ color: sketch.ink,
4140
+ outline: "none",
4141
+ cursor: "pointer",
4142
+ userSelect: "none",
4143
+ ...style
4144
+ },
4145
+ ...rest,
4146
+ children: [
4147
+ mark ? /* @__PURE__ */ jsx(
4148
+ RoughSvg,
4149
+ {
4150
+ shape: "line",
4151
+ roughness: (sketch.roughness ?? 1.5) + 0.4,
4152
+ seed: sketch.resolvedSeed,
4153
+ sketchColor: sketch.ink,
4154
+ bowing: sketch.bowing ?? 1.6,
4155
+ strokeWidth: 1.3,
4156
+ inset: 4,
4157
+ style: { opacity: 0.4 }
4158
+ }
4159
+ ) : null,
4160
+ /* @__PURE__ */ jsx(
4161
+ "span",
4162
+ {
4163
+ style: {
4164
+ position: "relative",
4165
+ width: 12,
4166
+ height: 12,
4167
+ flexShrink: 0,
4168
+ marginLeft: -18
4169
+ },
4170
+ children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(
4171
+ RoughSvg,
4172
+ {
4173
+ shape: "path",
4174
+ path: CHECK_PATH2,
4175
+ roughness: (sketch.roughness ?? 1.5) * 0.7,
4176
+ seed: deriveSeed(sketch.resolvedSeed, "checkbox-mark"),
4177
+ sketchColor: SKETCH_COLORS.accent,
4178
+ bowing: sketch.bowing,
4179
+ strokeWidth: 1.6,
4180
+ inset: 0
4181
+ }
4182
+ ) })
4183
+ }
4184
+ ),
4185
+ /* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1 }, children })
4186
+ ]
4187
+ }
4188
+ );
4189
+ });
4190
+ var DropdownMenuRadioItem = forwardRef(function DropdownMenuRadioItem2({ className, style, children, ...rest }, ref) {
4191
+ const [highlighted, setHighlighted] = useState(false);
4192
+ const { sketch, mark } = useMark(highlighted);
4193
+ return /* @__PURE__ */ jsxs(
4194
+ DropdownMenuPrimitive.RadioItem,
4195
+ {
4196
+ ref,
4197
+ className: cn(className),
4198
+ onPointerMove: () => setHighlighted(true),
4199
+ onPointerLeave: () => setHighlighted(false),
4200
+ style: {
4201
+ position: "relative",
4202
+ display: "flex",
4203
+ alignItems: "center",
4204
+ gap: 8,
4205
+ padding: "7px 12px 7px 26px",
4206
+ fontFamily: doodleUiFontFamily,
4207
+ fontSize: 14,
4208
+ color: sketch.ink,
4209
+ outline: "none",
4210
+ cursor: "pointer",
4211
+ userSelect: "none",
4212
+ ...style
4213
+ },
4214
+ ...rest,
4215
+ children: [
4216
+ mark ? /* @__PURE__ */ jsx(
4217
+ RoughSvg,
4218
+ {
4219
+ shape: "line",
4220
+ roughness: (sketch.roughness ?? 1.5) + 0.4,
4221
+ seed: sketch.resolvedSeed,
4222
+ sketchColor: sketch.ink,
4223
+ bowing: sketch.bowing ?? 1.6,
4224
+ strokeWidth: 1.3,
4225
+ inset: 4,
4226
+ style: { opacity: 0.4 }
4227
+ }
4228
+ ) : null,
4229
+ /* @__PURE__ */ jsx(
4230
+ "span",
4231
+ {
4232
+ style: {
4233
+ position: "relative",
4234
+ width: 8,
4235
+ height: 8,
4236
+ flexShrink: 0,
4237
+ marginLeft: -18
4238
+ },
4239
+ children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(
4240
+ RoughSvg,
4241
+ {
4242
+ shape: "ellipse",
4243
+ roughness: (sketch.roughness ?? 1.5) * 0.8,
4244
+ seed: deriveSeed(sketch.resolvedSeed, "radio-mark"),
4245
+ sketchColor: SKETCH_COLORS.accent,
4246
+ bowing: sketch.bowing,
4247
+ fillStyle: "solid",
4248
+ fill: SKETCH_COLORS.accent,
4249
+ strokeWidth: 1.2,
4250
+ inset: 0
4251
+ }
4252
+ ) })
4253
+ }
4254
+ ),
4255
+ /* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1 }, children })
4256
+ ]
4257
+ }
4258
+ );
4259
+ });
4260
+ var DropdownMenuLabel = forwardRef(function DropdownMenuLabel2({ className, style, children, ...rest }, ref) {
4261
+ const sketch = useDropdownMenuSketch();
4262
+ return /* @__PURE__ */ jsx(
4263
+ DropdownMenuPrimitive.Label,
4264
+ {
4265
+ ref,
4266
+ className: cn(className),
4267
+ style: {
4268
+ padding: "6px 12px",
4269
+ fontFamily: doodleUiFontFamily,
4270
+ fontSize: 12,
4271
+ fontWeight: 700,
4272
+ color: sketch.ink,
4273
+ opacity: 0.6,
4274
+ textTransform: "uppercase",
4275
+ letterSpacing: 0.4,
4276
+ ...style
4277
+ },
4278
+ ...rest,
4279
+ children
4280
+ }
4281
+ );
4282
+ });
4283
+ var DropdownMenuSeparator = forwardRef(function DropdownMenuSeparator2({ className, style, ...rest }, ref) {
4284
+ const sketch = useDropdownMenuSketch();
4285
+ return /* @__PURE__ */ jsx(
4286
+ DropdownMenuPrimitive.Separator,
4287
+ {
4288
+ ref,
4289
+ className: cn(className),
4290
+ style: { position: "relative", height: 10, margin: "2px 0", ...style },
4291
+ ...rest,
4292
+ children: /* @__PURE__ */ jsx(
4293
+ RoughSvg,
4294
+ {
4295
+ shape: "line",
4296
+ roughness: (sketch.roughness ?? 1.5) + 0.2,
4297
+ seed: deriveSeed(sketch.resolvedSeed, "separator"),
4298
+ sketchColor: sketch.ink,
4299
+ bowing: sketch.bowing ?? 1.8,
4300
+ strokeWidth: 1.2,
4301
+ inset: 6,
4302
+ style: { opacity: 0.5 }
4303
+ }
4304
+ )
4305
+ }
4306
+ );
4307
+ });
4308
+ var DialogSketchContext = createContext(
4309
+ null
4310
+ );
4311
+ function useDialogSketch() {
4312
+ const ctx = useContext(DialogSketchContext);
4313
+ if (!ctx) {
4314
+ throw new Error("Dialog parts must be used inside <Dialog>.");
4315
+ }
4316
+ return ctx;
4317
+ }
4318
+ function Dialog2({
4319
+ children,
4320
+ open,
4321
+ defaultOpen,
4322
+ onOpenChange,
4323
+ roughness,
4324
+ seed,
4325
+ sketchColor,
4326
+ bowing,
4327
+ fillStyle,
4328
+ strokeWidth,
4329
+ animate,
4330
+ ...rest
4331
+ }) {
4332
+ const resolvedSeed = useResolvedSeed(seed);
4333
+ const ink = sketchColor ?? SKETCH_COLORS.ink;
4334
+ const [uncontrolled, setUncontrolled] = useState(defaultOpen === true);
4335
+ const isOpen = open ?? uncontrolled;
4336
+ return /* @__PURE__ */ jsx(
4337
+ DialogSketchContext.Provider,
4338
+ {
4339
+ value: {
4340
+ roughness,
4341
+ seed: resolvedSeed,
4342
+ sketchColor,
4343
+ bowing,
4344
+ fillStyle,
4345
+ strokeWidth,
4346
+ resolvedSeed,
4347
+ ink,
4348
+ animate,
4349
+ open: isOpen
4350
+ },
4351
+ children: /* @__PURE__ */ jsx(
4352
+ Dialog.Root,
4353
+ {
4354
+ open: isOpen,
4355
+ onOpenChange: (next) => {
4356
+ setUncontrolled(next);
4357
+ onOpenChange?.(next);
4358
+ },
4359
+ ...rest,
4360
+ children
4361
+ }
4362
+ )
4363
+ }
4364
+ );
4365
+ }
4366
+ var DialogTrigger = Dialog.Trigger;
4367
+ var DialogPortal = Dialog.Portal;
4368
+ var DialogClose = Dialog.Close;
4369
+ var DialogOverlay = forwardRef(
4370
+ function DialogOverlay2({ style, ...rest }, ref) {
4371
+ const sketch = useDialogSketch();
4372
+ const shouldAnimate = useAnimate(sketch.animate);
4373
+ return /* @__PURE__ */ jsx(Dialog.Overlay, { ref, asChild: true, forceMount: true, ...rest, children: /* @__PURE__ */ jsx(
4374
+ motion.div,
4375
+ {
4376
+ initial: shouldAnimate ? { opacity: 0 } : false,
4377
+ animate: { opacity: 1 },
4378
+ exit: shouldAnimate ? { opacity: 0 } : void 0,
4379
+ transition: shouldAnimate ? { duration: 0.2, ease: "easeOut" } : { duration: 0 },
4380
+ style: {
4381
+ position: "fixed",
4382
+ inset: 0,
4383
+ background: "rgba(31, 29, 26, 0.38)",
4384
+ zIndex: 70,
4385
+ ...style
4386
+ }
4387
+ }
4388
+ ) });
4389
+ }
4390
+ );
4391
+ var DialogContent = forwardRef(
4392
+ function DialogContent2({ className, style, contentStyle, children, ...rest }, ref) {
4393
+ const sketch = useDialogSketch();
4394
+ const shouldAnimate = useAnimate(sketch.animate);
4395
+ return /* @__PURE__ */ jsx(AnimatePresence, { children: sketch.open ? /* @__PURE__ */ jsxs(Dialog.Portal, { forceMount: true, children: [
4396
+ /* @__PURE__ */ jsx(DialogOverlay, {}),
4397
+ /* @__PURE__ */ jsx(
4398
+ "div",
4399
+ {
4400
+ style: {
4401
+ position: "fixed",
4402
+ inset: 0,
4403
+ zIndex: 80,
4404
+ display: "flex",
4405
+ alignItems: "center",
4406
+ justifyContent: "center",
4407
+ pointerEvents: "none",
4408
+ padding: 16
4409
+ },
4410
+ children: /* @__PURE__ */ jsx(Dialog.Content, { ref, asChild: true, forceMount: true, ...rest, children: /* @__PURE__ */ jsx(
4411
+ motion.div,
4412
+ {
4413
+ className: cn(className),
4414
+ initial: shouldAnimate ? { opacity: 0, scale: 0.96, y: 10 } : false,
4415
+ animate: { opacity: 1, scale: 1, y: 0 },
4416
+ exit: shouldAnimate ? { opacity: 0, scale: 0.96, y: 8 } : void 0,
4417
+ transition: shouldAnimate ? { duration: 0.22, ease: "easeOut" } : { duration: 0 },
4418
+ style: {
4419
+ width: "min(420px, calc(100vw - 32px))",
4420
+ outline: "none",
4421
+ pointerEvents: "auto",
4422
+ ...style
4423
+ },
4424
+ children: /* @__PURE__ */ jsx(
4425
+ SketchBox,
4426
+ {
4427
+ roughness: sketch.roughness,
4428
+ seed: sketch.resolvedSeed,
4429
+ sketchColor: sketch.ink,
4430
+ bowing: sketch.bowing,
4431
+ fillStyle: sketch.fillStyle ?? "solid",
4432
+ fill: "#f7f6f2",
4433
+ strokeWidth: sketch.strokeWidth ?? 2,
4434
+ animate: sketch.animate,
4435
+ contentStyle: { padding: 20, ...contentStyle },
4436
+ children
4437
+ }
4438
+ )
4439
+ }
4440
+ ) })
4441
+ }
4442
+ )
4443
+ ] }) : null });
4444
+ }
4445
+ );
4446
+ function DialogHeader({ children, className, style }) {
4447
+ return /* @__PURE__ */ jsx(
4448
+ "div",
4449
+ {
4450
+ className: cn(className),
4451
+ style: {
4452
+ display: "flex",
4453
+ flexDirection: "column",
4454
+ gap: 6,
4455
+ marginBottom: 12,
4456
+ ...style
4457
+ },
4458
+ children
4459
+ }
4460
+ );
4461
+ }
4462
+ function DialogFooter({ children, className, style }) {
4463
+ return /* @__PURE__ */ jsx(
4464
+ "div",
4465
+ {
4466
+ className: cn(className),
4467
+ style: {
4468
+ display: "flex",
4469
+ justifyContent: "flex-end",
4470
+ gap: 8,
4471
+ marginTop: 16,
4472
+ ...style
4473
+ },
4474
+ children
4475
+ }
4476
+ );
4477
+ }
4478
+ var DialogTitle = forwardRef(
4479
+ function DialogTitle2({ style, ...rest }, ref) {
4480
+ const sketch = useDialogSketch();
4481
+ return /* @__PURE__ */ jsx(
4482
+ Dialog.Title,
4483
+ {
4484
+ ref,
4485
+ style: {
4486
+ margin: 0,
4487
+ fontSize: 18,
4488
+ fontWeight: doodleUiFontWeight(700),
4489
+ fontFamily: doodleUiFontFamily,
4490
+ color: sketch.ink,
4491
+ ...style
4492
+ },
4493
+ ...rest
4494
+ }
4495
+ );
4496
+ }
4497
+ );
4498
+ var DialogDescription = forwardRef(function DialogDescription2({ style, ...rest }, ref) {
4499
+ const sketch = useDialogSketch();
4500
+ return /* @__PURE__ */ jsx(
4501
+ Dialog.Description,
4502
+ {
4503
+ ref,
4504
+ style: {
4505
+ margin: 0,
4506
+ fontSize: 14,
4507
+ lineHeight: 1.5,
4508
+ fontFamily: doodleUiFontFamily,
4509
+ color: sketch.ink,
4510
+ opacity: 0.8,
4511
+ ...style
4512
+ },
4513
+ ...rest
4514
+ }
4515
+ );
4516
+ });
4517
+ var AlertDialogSketchContext = createContext(null);
4518
+ function useAlertDialogSketch() {
4519
+ const ctx = useContext(AlertDialogSketchContext);
4520
+ if (!ctx) {
4521
+ throw new Error(
4522
+ "AlertDialog parts must be used inside <AlertDialog>."
4523
+ );
4524
+ }
4525
+ return ctx;
4526
+ }
4527
+ function AlertDialog({
4528
+ children,
4529
+ open,
4530
+ defaultOpen,
4531
+ onOpenChange,
4532
+ roughness,
4533
+ seed,
4534
+ sketchColor,
4535
+ bowing,
4536
+ fillStyle,
4537
+ strokeWidth,
4538
+ animate,
4539
+ ...rest
4540
+ }) {
4541
+ const resolvedSeed = useResolvedSeed(seed);
4542
+ const ink = sketchColor ?? SKETCH_COLORS.ink;
4543
+ const [uncontrolled, setUncontrolled] = useState(defaultOpen === true);
4544
+ const isOpen = open ?? uncontrolled;
4545
+ return /* @__PURE__ */ jsx(
4546
+ AlertDialogSketchContext.Provider,
4547
+ {
4548
+ value: {
4549
+ roughness,
4550
+ seed: resolvedSeed,
4551
+ sketchColor,
4552
+ bowing,
4553
+ fillStyle,
4554
+ strokeWidth,
4555
+ resolvedSeed,
4556
+ ink,
4557
+ animate,
4558
+ open: isOpen
4559
+ },
4560
+ children: /* @__PURE__ */ jsx(
4561
+ AlertDialogPrimitive.Root,
4562
+ {
4563
+ open: isOpen,
4564
+ onOpenChange: (next) => {
4565
+ setUncontrolled(next);
4566
+ onOpenChange?.(next);
4567
+ },
4568
+ ...rest,
4569
+ children
4570
+ }
4571
+ )
4572
+ }
4573
+ );
4574
+ }
4575
+ var AlertDialogTrigger = AlertDialogPrimitive.Trigger;
4576
+ var AlertDialogPortal = AlertDialogPrimitive.Portal;
4577
+ var AlertDialogOverlay = forwardRef(function AlertDialogOverlay2({ style, ...rest }, ref) {
4578
+ const sketch = useAlertDialogSketch();
4579
+ const shouldAnimate = useAnimate(sketch.animate);
4580
+ return /* @__PURE__ */ jsx(AlertDialogPrimitive.Overlay, { ref, asChild: true, forceMount: true, ...rest, children: /* @__PURE__ */ jsx(
4581
+ motion.div,
4582
+ {
4583
+ initial: shouldAnimate ? { opacity: 0 } : false,
4584
+ animate: { opacity: 1 },
4585
+ exit: shouldAnimate ? { opacity: 0 } : void 0,
4586
+ transition: shouldAnimate ? { duration: 0.2, ease: "easeOut" } : { duration: 0 },
4587
+ style: {
4588
+ position: "fixed",
4589
+ inset: 0,
4590
+ background: "rgba(31, 29, 26, 0.38)",
4591
+ zIndex: 70,
4592
+ ...style
4593
+ }
4594
+ }
4595
+ ) });
4596
+ });
4597
+ var AlertDialogContent = forwardRef(function AlertDialogContent2({ className, style, contentStyle, children, ...rest }, ref) {
4598
+ const sketch = useAlertDialogSketch();
4599
+ const shouldAnimate = useAnimate(sketch.animate);
4600
+ return /* @__PURE__ */ jsx(AnimatePresence, { children: sketch.open ? /* @__PURE__ */ jsxs(AlertDialogPrimitive.Portal, { forceMount: true, children: [
4601
+ /* @__PURE__ */ jsx(AlertDialogOverlay, {}),
4602
+ /* @__PURE__ */ jsx(
4603
+ "div",
4604
+ {
4605
+ style: {
4606
+ position: "fixed",
4607
+ inset: 0,
4608
+ zIndex: 80,
4609
+ display: "flex",
4610
+ alignItems: "center",
4611
+ justifyContent: "center",
4612
+ pointerEvents: "none",
4613
+ padding: 16
4614
+ },
4615
+ children: /* @__PURE__ */ jsx(AlertDialogPrimitive.Content, { ref, asChild: true, forceMount: true, ...rest, children: /* @__PURE__ */ jsx(
4616
+ motion.div,
4617
+ {
4618
+ className: cn(className),
4619
+ initial: shouldAnimate ? { opacity: 0, scale: 0.96, y: 10 } : false,
4620
+ animate: { opacity: 1, scale: 1, y: 0 },
4621
+ exit: shouldAnimate ? { opacity: 0, scale: 0.96, y: 8 } : void 0,
4622
+ transition: shouldAnimate ? { duration: 0.22, ease: "easeOut" } : { duration: 0 },
4623
+ style: {
4624
+ width: "min(420px, calc(100vw - 32px))",
4625
+ outline: "none",
4626
+ pointerEvents: "auto",
4627
+ ...style
4628
+ },
4629
+ children: /* @__PURE__ */ jsx(
4630
+ SketchBox,
4631
+ {
4632
+ roughness: sketch.roughness,
4633
+ seed: sketch.resolvedSeed,
4634
+ sketchColor: sketch.ink,
4635
+ bowing: sketch.bowing,
4636
+ fillStyle: sketch.fillStyle ?? "solid",
4637
+ fill: "#f7f6f2",
4638
+ strokeWidth: sketch.strokeWidth ?? 2,
4639
+ animate: sketch.animate,
4640
+ contentStyle: { padding: 20, ...contentStyle },
4641
+ children
4642
+ }
4643
+ )
4644
+ }
4645
+ ) })
4646
+ }
4647
+ )
4648
+ ] }) : null });
4649
+ });
4650
+ function AlertDialogHeader({
4651
+ children,
4652
+ className,
4653
+ style
4654
+ }) {
4655
+ return /* @__PURE__ */ jsx(
4656
+ "div",
4657
+ {
4658
+ className: cn(className),
4659
+ style: {
4660
+ display: "flex",
4661
+ flexDirection: "column",
4662
+ gap: 6,
4663
+ marginBottom: 12,
4664
+ ...style
4665
+ },
4666
+ children
4667
+ }
4668
+ );
4669
+ }
4670
+ function AlertDialogFooter({
4671
+ children,
4672
+ className,
4673
+ style
4674
+ }) {
4675
+ return /* @__PURE__ */ jsx(
4676
+ "div",
4677
+ {
4678
+ className: cn(className),
4679
+ style: {
4680
+ display: "flex",
4681
+ justifyContent: "flex-end",
4682
+ gap: 8,
4683
+ marginTop: 16,
4684
+ ...style
4685
+ },
4686
+ children
4687
+ }
4688
+ );
4689
+ }
4690
+ var AlertDialogTitle = forwardRef(function AlertDialogTitle2({ style, ...rest }, ref) {
4691
+ const sketch = useAlertDialogSketch();
4692
+ return /* @__PURE__ */ jsx(
4693
+ AlertDialogPrimitive.Title,
4694
+ {
4695
+ ref,
4696
+ style: {
4697
+ margin: 0,
4698
+ fontSize: 18,
4699
+ fontWeight: doodleUiFontWeight(700),
4700
+ fontFamily: doodleUiFontFamily,
4701
+ color: sketch.ink,
4702
+ ...style
4703
+ },
4704
+ ...rest
4705
+ }
4706
+ );
4707
+ });
4708
+ var AlertDialogDescription = forwardRef(function AlertDialogDescription2({ style, ...rest }, ref) {
4709
+ const sketch = useAlertDialogSketch();
4710
+ return /* @__PURE__ */ jsx(
4711
+ AlertDialogPrimitive.Description,
4712
+ {
4713
+ ref,
4714
+ style: {
4715
+ margin: 0,
4716
+ fontSize: 14,
4717
+ lineHeight: 1.5,
4718
+ fontFamily: doodleUiFontFamily,
4719
+ color: sketch.ink,
4720
+ opacity: 0.8,
4721
+ ...style
4722
+ },
4723
+ ...rest
4724
+ }
4725
+ );
4726
+ });
4727
+ var AlertDialogAction = forwardRef(function AlertDialogAction2({ children, ...rest }, ref) {
4728
+ const sketch = useAlertDialogSketch();
4729
+ return /* @__PURE__ */ jsx(AlertDialogPrimitive.Action, { asChild: true, children: /* @__PURE__ */ jsx(
4730
+ Button,
4731
+ {
4732
+ ref,
4733
+ variant: "primary",
4734
+ sketchColor: sketch.sketchColor,
4735
+ roughness: sketch.roughness,
4736
+ seed: sketch.resolvedSeed,
4737
+ bowing: sketch.bowing,
4738
+ animate: sketch.animate,
4739
+ ...rest,
4740
+ children
4741
+ }
4742
+ ) });
4743
+ });
4744
+ var AlertDialogCancel = forwardRef(function AlertDialogCancel2({ children, ...rest }, ref) {
4745
+ const sketch = useAlertDialogSketch();
4746
+ return /* @__PURE__ */ jsx(AlertDialogPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsx(
4747
+ Button,
4748
+ {
4749
+ ref,
4750
+ variant: "outline",
4751
+ sketchColor: sketch.sketchColor,
4752
+ roughness: sketch.roughness,
4753
+ seed: sketch.resolvedSeed,
4754
+ bowing: sketch.bowing,
4755
+ animate: sketch.animate,
4756
+ ...rest,
4757
+ children
4758
+ }
4759
+ ) });
4760
+ });
4761
+ var CommandSketchContext = createContext(
4762
+ null
4763
+ );
4764
+ function useCommandSketch() {
4765
+ const ctx = useContext(CommandSketchContext);
4766
+ if (!ctx) {
4767
+ throw new Error("Command parts must be used inside <Command>.");
4768
+ }
4769
+ return ctx;
4770
+ }
4771
+ var Command = forwardRef(
4772
+ function Command2({
4773
+ className,
4774
+ style,
4775
+ children,
4776
+ roughness,
4777
+ seed,
4778
+ sketchColor,
4779
+ bowing,
4780
+ fillStyle,
4781
+ strokeWidth,
4782
+ animate,
4783
+ ...rest
4784
+ }, ref) {
4785
+ const resolvedSeed = useResolvedSeed(seed);
4786
+ const ink = sketchColor ?? SKETCH_COLORS.ink;
4787
+ return /* @__PURE__ */ jsx(
4788
+ CommandSketchContext.Provider,
4789
+ {
4790
+ value: {
4791
+ roughness,
4792
+ seed: resolvedSeed,
4793
+ sketchColor,
4794
+ bowing,
4795
+ fillStyle,
4796
+ strokeWidth,
4797
+ resolvedSeed,
4798
+ ink,
4799
+ animate
4800
+ },
4801
+ children: /* @__PURE__ */ jsx(
4802
+ SketchBox,
4803
+ {
4804
+ className: cn(className),
4805
+ style,
4806
+ roughness,
4807
+ seed: resolvedSeed,
4808
+ sketchColor: ink,
4809
+ bowing,
4810
+ fillStyle: fillStyle ?? "solid",
4811
+ fill: "#f7f6f2",
4812
+ strokeWidth: strokeWidth ?? 1.5,
4813
+ animate,
4814
+ contentStyle: { padding: 0, display: "flex", flexDirection: "column" },
4815
+ children: /* @__PURE__ */ jsx(Command$1, { ref, ...rest, children })
4816
+ }
4817
+ )
4818
+ }
4819
+ );
4820
+ }
4821
+ );
4822
+ var CommandInput = forwardRef(
4823
+ function CommandInput2({ className, style, ...rest }, ref) {
4824
+ const sketch = useCommandSketch();
4825
+ return /* @__PURE__ */ jsxs("div", { style: { position: "relative", padding: "10px 12px 12px" }, children: [
4826
+ /* @__PURE__ */ jsx(
4827
+ CommandInput$1,
4828
+ {
4829
+ ref,
4830
+ className: cn(className),
4831
+ style: {
4832
+ width: "100%",
4833
+ boxSizing: "border-box",
4834
+ border: "none",
4835
+ outline: "none",
4836
+ background: "transparent",
4837
+ color: sketch.ink,
4838
+ fontFamily: doodleUiFontFamily,
4839
+ fontSize: 15,
4840
+ padding: "2px 2px 8px",
4841
+ ...style
4842
+ },
4843
+ ...rest
4844
+ }
4845
+ ),
4846
+ /* @__PURE__ */ jsx(
4847
+ RoughSvg,
4848
+ {
4849
+ shape: "line",
4850
+ roughness: (sketch.roughness ?? 1.5) + 0.2,
4851
+ seed: deriveSeed(sketch.resolvedSeed, "command-divider"),
4852
+ sketchColor: sketch.ink,
4853
+ bowing: sketch.bowing ?? 1.6,
4854
+ strokeWidth: 1.2,
4855
+ inset: 4,
4856
+ style: { position: "absolute", bottom: 0, left: 0, right: 0, height: 8, opacity: 0.4 }
4857
+ }
4858
+ )
4859
+ ] });
4860
+ }
4861
+ );
4862
+ var CommandList = forwardRef(
4863
+ function CommandList2({ className, style, ...rest }, ref) {
4864
+ return /* @__PURE__ */ jsx(
4865
+ CommandList$1,
4866
+ {
4867
+ ref,
4868
+ className: cn(className),
4869
+ style: {
4870
+ maxHeight: 280,
4871
+ overflowY: "auto",
4872
+ padding: "4px 4px 8px",
4873
+ ...style
4874
+ },
4875
+ ...rest
4876
+ }
4877
+ );
4878
+ }
4879
+ );
4880
+ var CommandEmpty = forwardRef(
4881
+ function CommandEmpty2({ className, style, ...rest }, ref) {
4882
+ const sketch = useCommandSketch();
4883
+ return /* @__PURE__ */ jsx(
4884
+ CommandEmpty$1,
4885
+ {
4886
+ ref,
4887
+ className: cn(className),
4888
+ style: {
4889
+ padding: "16px 12px",
4890
+ textAlign: "center",
4891
+ fontFamily: doodleUiFontFamily,
4892
+ fontSize: 14,
4893
+ color: sketch.ink,
4894
+ opacity: 0.6,
4895
+ ...style
4896
+ },
4897
+ ...rest
4898
+ }
4899
+ );
4900
+ }
4901
+ );
4902
+ var CommandGroup = forwardRef(
4903
+ function CommandGroup2({ className, style, ...rest }, ref) {
4904
+ const sketch = useCommandSketch();
4905
+ return /* @__PURE__ */ jsx(
4906
+ CommandGroup$1,
4907
+ {
4908
+ ref,
4909
+ className: cn(className),
4910
+ style: { padding: "4px 2px", color: sketch.ink, ...style },
4911
+ ...rest
4912
+ }
4913
+ );
4914
+ }
4915
+ );
4916
+ var CommandItem = forwardRef(
4917
+ function CommandItem2({ className, style, children, onMouseEnter, onMouseLeave, ...rest }, ref) {
4918
+ const sketch = useCommandSketch();
4919
+ const [highlighted, setHighlighted] = useState(false);
4920
+ return /* @__PURE__ */ jsxs(
4921
+ CommandItem$1,
4922
+ {
4923
+ ref,
4924
+ className: cn(className),
4925
+ onMouseEnter: (event) => {
4926
+ setHighlighted(true);
4927
+ onMouseEnter?.(event);
4928
+ },
4929
+ onMouseLeave: (event) => {
4930
+ setHighlighted(false);
4931
+ onMouseLeave?.(event);
4932
+ },
4933
+ style: {
4934
+ position: "relative",
4935
+ display: "flex",
4936
+ alignItems: "center",
4937
+ gap: 8,
4938
+ padding: "7px 10px",
4939
+ borderRadius: 4,
4940
+ fontFamily: doodleUiFontFamily,
4941
+ fontSize: 14,
4942
+ color: sketch.ink,
4943
+ cursor: "pointer",
4944
+ userSelect: "none",
4945
+ outline: "none",
4946
+ ...style
4947
+ },
4948
+ ...rest,
4949
+ children: [
4950
+ highlighted ? /* @__PURE__ */ jsx(
4951
+ RoughSvg,
4952
+ {
4953
+ shape: "line",
4954
+ roughness: (sketch.roughness ?? 1.5) + 0.4,
4955
+ seed: sketch.resolvedSeed,
4956
+ sketchColor: sketch.ink,
4957
+ bowing: sketch.bowing ?? 1.6,
4958
+ strokeWidth: 1.3,
4959
+ inset: 3,
4960
+ style: { opacity: 0.4 }
4961
+ }
4962
+ ) : null,
4963
+ /* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1, flex: 1 }, children })
4964
+ ]
4965
+ }
4966
+ );
4967
+ }
4968
+ );
4969
+ var CommandSeparator = forwardRef(function CommandSeparator2({ className, style, ...rest }, ref) {
4970
+ const sketch = useCommandSketch();
4971
+ return /* @__PURE__ */ jsx(
4972
+ CommandSeparator$1,
4973
+ {
4974
+ ref,
4975
+ className: cn(className),
4976
+ style: { position: "relative", height: 10, margin: "2px 4px", ...style },
4977
+ ...rest,
4978
+ children: /* @__PURE__ */ jsx(
4979
+ RoughSvg,
4980
+ {
4981
+ shape: "line",
4982
+ roughness: (sketch.roughness ?? 1.5) + 0.2,
4983
+ seed: deriveSeed(sketch.resolvedSeed, "command-separator"),
4984
+ sketchColor: sketch.ink,
4985
+ bowing: sketch.bowing ?? 1.8,
4986
+ strokeWidth: 1.2,
4987
+ inset: 4,
4988
+ style: { opacity: 0.4 }
4989
+ }
4990
+ )
4991
+ }
4992
+ );
4993
+ });
4994
+ function CommandShortcut({
4995
+ children,
4996
+ className,
4997
+ style
4998
+ }) {
4999
+ const sketch = useCommandSketch();
5000
+ return /* @__PURE__ */ jsx(
5001
+ "span",
5002
+ {
5003
+ className: cn(className),
5004
+ style: {
5005
+ marginLeft: "auto",
5006
+ fontFamily: doodleUiFontFamily,
5007
+ fontSize: 12,
5008
+ color: sketch.ink,
5009
+ opacity: 0.5,
5010
+ letterSpacing: 0.4,
5011
+ ...style
5012
+ },
5013
+ children
5014
+ }
5015
+ );
5016
+ }
5017
+ var CHEVRON_PATH5 = "M 4 6 L 10 12 L 16 6";
5018
+ function Combobox({
5019
+ options,
5020
+ placeholder = "Select\u2026",
5021
+ searchPlaceholder = "Search\u2026",
5022
+ emptyMessage = "No results.",
5023
+ value,
5024
+ defaultValue,
5025
+ onValueChange,
5026
+ disabled,
5027
+ className,
5028
+ style,
5029
+ roughness,
5030
+ seed,
5031
+ sketchColor,
5032
+ bowing,
5033
+ fillStyle,
5034
+ strokeWidth,
5035
+ animate,
5036
+ "aria-label": ariaLabel
5037
+ }) {
5038
+ const [open, setOpen] = useState(false);
5039
+ const [uncontrolled, setUncontrolled] = useState(defaultValue);
5040
+ const selectedValue = value ?? uncontrolled;
5041
+ const selectedOption = options.find(
5042
+ (option) => option.value === selectedValue
5043
+ );
5044
+ const ink = sketchColor ?? SKETCH_COLORS.ink;
5045
+ const resolvedSeed = useResolvedSeed(seed);
5046
+ const shouldAnimate = useAnimate(animate);
5047
+ const triggerRef = useRef(null);
5048
+ useDrawIn(triggerRef, DRAW_IN_DURATION_MS, shouldAnimate);
5049
+ function handleSelect(nextValue) {
5050
+ setUncontrolled(nextValue);
5051
+ onValueChange?.(nextValue);
5052
+ setOpen(false);
5053
+ }
5054
+ return /* @__PURE__ */ jsxs(PopoverPrimitive.Root, { open, onOpenChange: setOpen, children: [
5055
+ /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
5056
+ "button",
5057
+ {
5058
+ ref: (node) => assignRef(triggerRef, node),
5059
+ type: "button",
5060
+ role: "combobox",
5061
+ "aria-expanded": open,
5062
+ "aria-label": ariaLabel,
5063
+ disabled,
5064
+ className: cn(className),
5065
+ style: {
5066
+ position: "relative",
5067
+ display: "inline-flex",
5068
+ alignItems: "center",
5069
+ justifyContent: "space-between",
5070
+ gap: 12,
5071
+ width: "100%",
5072
+ minWidth: 200,
5073
+ minHeight: 38,
5074
+ padding: "8px 12px",
5075
+ border: "none",
5076
+ background: "transparent",
5077
+ cursor: disabled ? "not-allowed" : "pointer",
5078
+ opacity: disabled ? 0.5 : 1,
5079
+ color: ink,
5080
+ fontFamily: doodleUiFontFamily,
5081
+ fontSize: 15,
5082
+ lineHeight: 1.2,
5083
+ outline: "none",
5084
+ textAlign: "left",
5085
+ ...style
5086
+ },
5087
+ children: [
5088
+ /* @__PURE__ */ jsx(
5089
+ RoughSvg,
5090
+ {
5091
+ shape: "rectangle",
5092
+ roughness,
5093
+ seed: resolvedSeed,
5094
+ sketchColor: open ? SKETCH_COLORS.accent : ink,
5095
+ bowing,
5096
+ fillStyle,
5097
+ strokeWidth: open ? (strokeWidth ?? 1.75) + 0.35 : strokeWidth
5098
+ }
5099
+ ),
5100
+ /* @__PURE__ */ jsx(
5101
+ "span",
5102
+ {
5103
+ style: {
5104
+ position: "relative",
5105
+ zIndex: 1,
5106
+ flex: 1,
5107
+ overflow: "hidden",
5108
+ textOverflow: "ellipsis",
5109
+ whiteSpace: "nowrap"
5110
+ },
5111
+ children: selectedOption?.label ?? placeholder
5112
+ }
5113
+ ),
5114
+ /* @__PURE__ */ jsx(
5115
+ "span",
5116
+ {
5117
+ style: { position: "relative", zIndex: 1, width: 18, height: 18, flexShrink: 0 },
5118
+ children: /* @__PURE__ */ jsx(
5119
+ RoughSvg,
5120
+ {
5121
+ shape: "path",
5122
+ path: CHEVRON_PATH5,
5123
+ roughness: roughness ? roughness * 0.7 : 1.05,
5124
+ seed: resolvedSeed,
5125
+ sketchColor: ink,
5126
+ bowing,
5127
+ strokeWidth: (strokeWidth ?? 1.6) + 0.2,
5128
+ inset: 0
5129
+ }
5130
+ )
5131
+ }
5132
+ )
5133
+ ]
5134
+ }
5135
+ ) }),
5136
+ /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
5137
+ PopoverPrimitive.Content,
5138
+ {
5139
+ align: "start",
5140
+ sideOffset: 8,
5141
+ style: {
5142
+ zIndex: 80,
5143
+ outline: "none",
5144
+ width: "var(--radix-popover-trigger-width)"
5145
+ },
5146
+ children: /* @__PURE__ */ jsxs(
5147
+ Command,
5148
+ {
5149
+ roughness,
5150
+ seed: resolvedSeed,
5151
+ sketchColor: ink,
5152
+ bowing,
5153
+ fillStyle,
5154
+ strokeWidth,
5155
+ animate,
5156
+ children: [
5157
+ /* @__PURE__ */ jsx(CommandInput, { placeholder: searchPlaceholder }),
5158
+ /* @__PURE__ */ jsxs(CommandList, { children: [
5159
+ /* @__PURE__ */ jsx(CommandEmpty, { children: emptyMessage }),
5160
+ /* @__PURE__ */ jsx(CommandGroup, { children: options.map((option) => /* @__PURE__ */ jsx(
5161
+ CommandItem,
5162
+ {
5163
+ value: option.value,
5164
+ disabled: option.disabled,
5165
+ onSelect: handleSelect,
5166
+ children: option.label
5167
+ },
5168
+ option.value
5169
+ )) })
5170
+ ] })
5171
+ ]
5172
+ }
5173
+ )
5174
+ }
5175
+ ) })
5176
+ ] });
5177
+ }
3700
5178
 
3701
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, Avatar, Badge, Breadcrumb, BreadcrumbItem, Button, Card, Checkbox, DEFAULT_BOWING, DEFAULT_INK, DEFAULT_ROUGHNESS, DEFAULT_STROKE_WIDTH, DRAW_IN_ALERT_MS, DRAW_IN_DURATION_MS, DRAW_IN_MARK_MS, DRAW_IN_TOOLTIP_MS, Divider, DoodleUIProvider, Input, Modal, ModalClose, ModalDescription, ModalRoot, ModalTitle, ModalTrigger, Pagination, Progress, Radio, RadioGroup, RoughSvg, SKETCH_COLORS, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectRoot, SelectSeparator, SelectTrigger, SelectValue, Skeleton, SketchBox, SketchSeedProvider, Slider, Stepper, Switch, TABLE_STAGGER_MS, Tab, TabList, TabPanel, Table, TableBody, TableCell, TableHead, TableHeaderCell, TableRow, Tabs, Textarea, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastRoot, ToastTitle, ToastViewport, Tooltip, TooltipProvider, deriveSeed, toRoughOptions, useAnimate, useDoodleUI, useDrawIn, useResolvedSeed, useSketchSeed };
5179
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, Badge, Breadcrumb, BreadcrumbItem, Button, Card, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DEFAULT_BOWING, DEFAULT_INK, DEFAULT_ROUGHNESS, DEFAULT_STROKE_WIDTH, DRAW_IN_ALERT_MS, DRAW_IN_DURATION_MS, DRAW_IN_MARK_MS, DRAW_IN_TOOLTIP_MS, Dialog2 as Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Divider, DoodleUIProvider, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuTrigger, Input, Label2 as Label, Modal, ModalClose, ModalDescription, ModalRoot, ModalTitle, ModalTrigger, Pagination, Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, PopoverTrigger, Progress, Radio, RadioGroup, RoughSvg, SKETCH_COLORS, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectRoot, SelectSeparator, SelectTrigger, SelectValue, Skeleton, SketchBox, SketchSeedProvider, Slider, Stepper, Switch, TABLE_STAGGER_MS, Tab, TabList, TabPanel, Table, TableBody, TableCell, TableHead, TableHeaderCell, TableRow, Tabs, Textarea, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastRoot, ToastTitle, ToastViewport, Tooltip, TooltipProvider, deriveSeed, toRoughOptions, useAnimate, useDoodleUI, useDrawIn, useResolvedSeed, useSketchSeed };
3702
5180
  //# sourceMappingURL=index.js.map
3703
5181
  //# sourceMappingURL=index.js.map