@overmap-ai/blocks 1.0.34 → 1.0.35-alpha.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/Menu/typings.d.ts +3 -3
- package/dist/SelectContext/typings.d.ts +1 -1
- package/dist/blocks.js +98 -73
- package/dist/blocks.js.map +1 -1
- package/dist/blocks.umd.cjs +98 -73
- package/dist/blocks.umd.cjs.map +1 -1
- package/dist/cva/floating.d.ts +0 -2
- package/package.json +1 -1
package/dist/Menu/typings.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface MenuRootProps extends PropsWithChildren {
|
|
|
28
28
|
loop?: boolean;
|
|
29
29
|
modal?: boolean;
|
|
30
30
|
}
|
|
31
|
-
export interface MenuContentProps extends ComponentPropsWithRef<"
|
|
31
|
+
export interface MenuContentProps extends ComponentPropsWithRef<"ul">, MenuVariantProps {
|
|
32
32
|
}
|
|
33
33
|
export interface MenuClickTriggerProps {
|
|
34
34
|
children: ReactElement;
|
|
@@ -54,7 +54,7 @@ export interface MenuItemMeta {
|
|
|
54
54
|
selected: boolean;
|
|
55
55
|
}
|
|
56
56
|
type ActiveAndSelectedItemCallback<T> = (meta: MenuItemMeta) => T;
|
|
57
|
-
export interface MenuItemProps extends Omit<ComponentPropsWithRef<"
|
|
57
|
+
export interface MenuItemProps extends Omit<ComponentPropsWithRef<"li">, "children" | "value"> {
|
|
58
58
|
disabled?: boolean;
|
|
59
59
|
children: ReactNode | ActiveAndSelectedItemCallback<ReactNode>;
|
|
60
60
|
closeOnSelect?: boolean;
|
|
@@ -84,7 +84,7 @@ export interface MenuSubProps extends PropsWithChildren {
|
|
|
84
84
|
loop?: boolean;
|
|
85
85
|
modal?: boolean;
|
|
86
86
|
}
|
|
87
|
-
export interface SubMenuContentProps extends ComponentPropsWithRef<"
|
|
87
|
+
export interface SubMenuContentProps extends ComponentPropsWithRef<"ul"> {
|
|
88
88
|
}
|
|
89
89
|
export interface MenuSubTriggerProps extends Omit<MenuItemProps, "closeOnSelect" | "disabled"> {
|
|
90
90
|
}
|
|
@@ -4,7 +4,7 @@ type _SingleSelectProps<TValue> = {
|
|
|
4
4
|
value?: TValue;
|
|
5
5
|
};
|
|
6
6
|
export type SingleSelectRequiredProps<TValue> = _SingleSelectProps<TValue>;
|
|
7
|
-
export type SingleSelectNotRequiredProps<TValue> = _SingleSelectProps<TValue |
|
|
7
|
+
export type SingleSelectNotRequiredProps<TValue> = _SingleSelectProps<TValue | undefined>;
|
|
8
8
|
export type SingleSelectProps<TValue> = (SingleSelectRequiredProps<TValue> & {
|
|
9
9
|
required: true;
|
|
10
10
|
}) | (SingleSelectNotRequiredProps<TValue> & {
|
package/dist/blocks.js
CHANGED
|
@@ -118,9 +118,11 @@ const Provider = (props) => {
|
|
|
118
118
|
const dialogOverlay = cva([
|
|
119
119
|
"fixed",
|
|
120
120
|
"inset-0",
|
|
121
|
-
|
|
121
|
+
// background
|
|
122
122
|
"bg-(--black-a6)",
|
|
123
123
|
"dark:bg-(--black-a8)",
|
|
124
|
+
// background and border
|
|
125
|
+
"duration-200",
|
|
124
126
|
"data-[state='open']:animate-in",
|
|
125
127
|
"data-[state='open']:fade-in-0",
|
|
126
128
|
"data-[state='closed']:animate-out",
|
|
@@ -128,24 +130,25 @@ const dialogOverlay = cva([
|
|
|
128
130
|
]);
|
|
129
131
|
const dialogContent = cva(
|
|
130
132
|
[
|
|
131
|
-
"flex",
|
|
132
|
-
"flex-col",
|
|
133
133
|
"h-max",
|
|
134
|
-
"[scrollbar-width:thin]",
|
|
135
|
-
"[scrollbar-color:var(--base-6)_transparent]",
|
|
136
134
|
"max-h-3/4",
|
|
137
|
-
"shadow-md",
|
|
138
135
|
"overflow-hidden",
|
|
139
136
|
"w-full",
|
|
137
|
+
// background and border
|
|
138
|
+
"shadow-md",
|
|
140
139
|
"bg-(--color-background)",
|
|
141
140
|
"dark:bg-(--base-2)",
|
|
142
141
|
"ring-1",
|
|
143
142
|
"ring-(--base-a6)",
|
|
143
|
+
"[scrollbar-width:thin]",
|
|
144
|
+
"[scrollbar-color:var(--base-6)_transparent]",
|
|
145
|
+
// positioning
|
|
144
146
|
"fixed",
|
|
145
147
|
"left-[50%]",
|
|
146
148
|
"top-[50%]",
|
|
147
149
|
"translate-x-[-50%]",
|
|
148
150
|
"translate-y-[-50%]",
|
|
151
|
+
// animation
|
|
149
152
|
"duration-200",
|
|
150
153
|
"data-[state='open']:animate-in",
|
|
151
154
|
"data-[state='open']:fade-in-0",
|
|
@@ -222,10 +225,13 @@ ButtonGroup.displayName = "Buttons";
|
|
|
222
225
|
const useButtonGroup = () => useContext(ButtonGroupContext);
|
|
223
226
|
const buttonCva = cva(
|
|
224
227
|
[
|
|
225
|
-
"flex",
|
|
228
|
+
"inline-flex",
|
|
226
229
|
"items-center",
|
|
227
230
|
"justify-center",
|
|
228
231
|
"shrink-0",
|
|
232
|
+
"whitespace-nowrap",
|
|
233
|
+
"text-center",
|
|
234
|
+
"align-top",
|
|
229
235
|
// select
|
|
230
236
|
"cursor-pointer",
|
|
231
237
|
"select-none",
|
|
@@ -478,7 +484,7 @@ const AlertDialog = {
|
|
|
478
484
|
Cancel: RadixAlertDialog.Cancel
|
|
479
485
|
};
|
|
480
486
|
const AvatarContext = createContext({});
|
|
481
|
-
const avatar = cva(["shrink-0", "select-none", "inline-block"], {
|
|
487
|
+
const avatar = cva(["shrink-0", "select-none", "inline-block", "align-middle"], {
|
|
482
488
|
variants: {
|
|
483
489
|
size: {
|
|
484
490
|
xs: ["h-5", "w-5", "text-xs"],
|
|
@@ -492,7 +498,7 @@ const avatar = cva(["shrink-0", "select-none", "inline-block"], {
|
|
|
492
498
|
size: "md"
|
|
493
499
|
}
|
|
494
500
|
});
|
|
495
|
-
const avatarFallback = cva(["flex", "items-center", "justify-center", "
|
|
501
|
+
const avatarFallback = cva(["flex", "items-center", "justify-center", "size-full", "rounded-[inherit]"], {
|
|
496
502
|
variants: {
|
|
497
503
|
variant: {
|
|
498
504
|
solid: ["bg-(--accent-9)", "text-(--accent-contrast)"],
|
|
@@ -551,7 +557,7 @@ const Avatar = {
|
|
|
551
557
|
Image: AvatarImage,
|
|
552
558
|
Root: AvatarRoot
|
|
553
559
|
};
|
|
554
|
-
const badge = cva(["inline-flex", "items-center", "shrink-0"], {
|
|
560
|
+
const badge = cva(["inline-flex", "items-center", "shrink-0", "whitespace-nowrap"], {
|
|
555
561
|
variants: {
|
|
556
562
|
icon: {
|
|
557
563
|
true: ["justify-center"],
|
|
@@ -709,6 +715,7 @@ CheckboxIndicator.displayName = "CheckboxIndicator";
|
|
|
709
715
|
const checkbox = cva(
|
|
710
716
|
[
|
|
711
717
|
"shrink-0",
|
|
718
|
+
"align-top",
|
|
712
719
|
// select
|
|
713
720
|
"cursor-pointer",
|
|
714
721
|
"select-none",
|
|
@@ -1457,12 +1464,12 @@ const SingleSelectRequiredProvider = genericMemo(function SingleSelectRequiredPr
|
|
|
1457
1464
|
return /* @__PURE__ */ jsx(SelectContext, { value: contextValue, children });
|
|
1458
1465
|
});
|
|
1459
1466
|
const SingleSelectNotRequiredProvider = genericMemo(function SingleSelectNotRequiredProvider2(props) {
|
|
1460
|
-
const { children, defaultValue =
|
|
1467
|
+
const { children, defaultValue = void 0, value: controlledValue, onValueChange } = props;
|
|
1461
1468
|
const [value, setValue] = useControlledState(defaultValue, controlledValue, onValueChange);
|
|
1462
1469
|
const selected = useCallback((v) => v === value, [value]);
|
|
1463
1470
|
const selectValue = useCallback(
|
|
1464
1471
|
(v) => {
|
|
1465
|
-
setValue(selected(v) ?
|
|
1472
|
+
setValue(selected(v) ? void 0 : v);
|
|
1466
1473
|
},
|
|
1467
1474
|
[selected, setValue]
|
|
1468
1475
|
);
|
|
@@ -2768,11 +2775,11 @@ const menuContent = cva(
|
|
|
2768
2775
|
{
|
|
2769
2776
|
variants: {
|
|
2770
2777
|
size: {
|
|
2771
|
-
xs: ["p-0.5", "text-xs"],
|
|
2772
|
-
sm: ["p-0.75", "text-sm"],
|
|
2773
|
-
md: ["p-1", "text-md"],
|
|
2774
|
-
lg: ["p-1.25", "text-lg"],
|
|
2775
|
-
xl: ["p-1.5", "text-xl"]
|
|
2778
|
+
xs: ["p-0.5", "text-xs", "min-w-30"],
|
|
2779
|
+
sm: ["p-0.75", "text-sm", "min-w-35"],
|
|
2780
|
+
md: ["p-1", "text-md", "min-w-40"],
|
|
2781
|
+
lg: ["p-1.25", "text-lg", "min-w-45"],
|
|
2782
|
+
xl: ["p-1.5", "text-xl", "min-w-50"]
|
|
2776
2783
|
},
|
|
2777
2784
|
radius: {
|
|
2778
2785
|
none: ["rounded-none"],
|
|
@@ -3029,7 +3036,7 @@ const MenuContent = memo((props) => {
|
|
|
3029
3036
|
"data-floating-content": "",
|
|
3030
3037
|
...getFloatingProps(),
|
|
3031
3038
|
children: /* @__PURE__ */ jsx(
|
|
3032
|
-
"
|
|
3039
|
+
"ul",
|
|
3033
3040
|
{
|
|
3034
3041
|
className: cx(
|
|
3035
3042
|
className,
|
|
@@ -3176,8 +3183,8 @@ const MenuItem = memo((props) => {
|
|
|
3176
3183
|
(e) => {
|
|
3177
3184
|
e.stopPropagation();
|
|
3178
3185
|
if (disabled) return;
|
|
3179
|
-
|
|
3180
|
-
|
|
3186
|
+
onClick == null ? void 0 : onClick(e);
|
|
3187
|
+
onSelect == null ? void 0 : onSelect();
|
|
3181
3188
|
if (closeOnSelect) setOpen(false);
|
|
3182
3189
|
if (closeRoot) rootMenuContext.setOpen(false);
|
|
3183
3190
|
},
|
|
@@ -3186,9 +3193,9 @@ const MenuItem = memo((props) => {
|
|
|
3186
3193
|
const handleKeyDown = useCallback(
|
|
3187
3194
|
(e) => {
|
|
3188
3195
|
if (disabled) return;
|
|
3189
|
-
|
|
3196
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
3190
3197
|
if (TRIGGER_SELECT_KEYS.includes(e.key)) {
|
|
3191
|
-
|
|
3198
|
+
onSelect == null ? void 0 : onSelect();
|
|
3192
3199
|
if (closeOnSelect) setOpen(false);
|
|
3193
3200
|
}
|
|
3194
3201
|
},
|
|
@@ -3199,7 +3206,7 @@ const MenuItem = memo((props) => {
|
|
|
3199
3206
|
return typeof children === "function" ? children({ active: isActive, selected: false }) : children;
|
|
3200
3207
|
}, [children, isActive]);
|
|
3201
3208
|
return /* @__PURE__ */ jsx(
|
|
3202
|
-
"
|
|
3209
|
+
"li",
|
|
3203
3210
|
{
|
|
3204
3211
|
className: cx(className, menuItem({ size: size2, variant }), radiusCva({ radius, maxLarge: true })),
|
|
3205
3212
|
ref: mergeRefs2,
|
|
@@ -3394,7 +3401,7 @@ const MenuMultiSelectItem = genericMemo(function(props) {
|
|
|
3394
3401
|
}, [registerValue, value]);
|
|
3395
3402
|
const isSelected = selected(value);
|
|
3396
3403
|
const handleSelect = useCallback(() => {
|
|
3397
|
-
|
|
3404
|
+
onSelect == null ? void 0 : onSelect();
|
|
3398
3405
|
selectValue(value);
|
|
3399
3406
|
}, [onSelect, selectValue, value]);
|
|
3400
3407
|
const computedChildren = useMemo(() => {
|
|
@@ -3434,10 +3441,10 @@ const MenuPageTrigger = memo((props) => {
|
|
|
3434
3441
|
const { setActivePage } = usePagesContext();
|
|
3435
3442
|
const handleSelect = useCallback(() => {
|
|
3436
3443
|
var _a;
|
|
3444
|
+
onSelect == null ? void 0 : onSelect();
|
|
3437
3445
|
setActivePage(page);
|
|
3438
3446
|
(_a = refs.floating.current) == null ? void 0 : _a.focus();
|
|
3439
3447
|
setActiveIndex(null);
|
|
3440
|
-
if (onSelect) onSelect();
|
|
3441
3448
|
}, [onSelect, page, refs.floating, setActiveIndex, setActivePage]);
|
|
3442
3449
|
return /* @__PURE__ */ jsx(MenuItem, { ref, onSelect: handleSelect, closeOnSelect: false, ...rest });
|
|
3443
3450
|
});
|
|
@@ -3497,7 +3504,7 @@ const MenuSelectItem = genericMemo(function(props) {
|
|
|
3497
3504
|
const { selected, selectValue } = use(SelectContext);
|
|
3498
3505
|
const isSelected = useMemo(() => selected(value), [selected, value]);
|
|
3499
3506
|
const handleSelect = useCallback(() => {
|
|
3500
|
-
|
|
3507
|
+
onSelect == null ? void 0 : onSelect();
|
|
3501
3508
|
selectValue(value);
|
|
3502
3509
|
}, [onSelect, selectValue, value]);
|
|
3503
3510
|
const computedChildren = useMemo(() => {
|
|
@@ -3574,7 +3581,7 @@ const MenuSubContent = memo((props) => {
|
|
|
3574
3581
|
style: computedFloatingStyles,
|
|
3575
3582
|
...getFloatingProps(),
|
|
3576
3583
|
children: /* @__PURE__ */ jsx(
|
|
3577
|
-
"
|
|
3584
|
+
"ul",
|
|
3578
3585
|
{
|
|
3579
3586
|
className: cx(
|
|
3580
3587
|
"overmap-menu-sub-content",
|
|
@@ -3672,17 +3679,23 @@ const Menu = {
|
|
|
3672
3679
|
};
|
|
3673
3680
|
const RiIcon = memo(
|
|
3674
3681
|
forwardRef((props, ref) => {
|
|
3675
|
-
const { icon, size: size2, title, color, ...rest } = props;
|
|
3682
|
+
const { icon, size: size2, title, color, className, ...rest } = props;
|
|
3676
3683
|
const Icon = RiIcons[icon];
|
|
3677
3684
|
if (!Icon) console.error(`Icon ${icon} not found`);
|
|
3678
3685
|
return Icon ? (
|
|
3679
3686
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3680
3687
|
// @ts-ignore
|
|
3681
|
-
/* @__PURE__ */ jsx(Icon, { ref, title, size: size2, color, ...rest })
|
|
3682
|
-
) : (
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3688
|
+
/* @__PURE__ */ jsx(Icon, { className: cx(className, "shrink-0"), ref, title, size: size2, color, ...rest })
|
|
3689
|
+
) : /* @__PURE__ */ jsx(
|
|
3690
|
+
RiQuestionMark,
|
|
3691
|
+
{
|
|
3692
|
+
className: cx(className, "shrink-0"),
|
|
3693
|
+
ref,
|
|
3694
|
+
title,
|
|
3695
|
+
size: size2,
|
|
3696
|
+
color,
|
|
3697
|
+
...rest
|
|
3698
|
+
}
|
|
3686
3699
|
);
|
|
3687
3700
|
})
|
|
3688
3701
|
);
|
|
@@ -3782,12 +3795,25 @@ const Popover = {
|
|
|
3782
3795
|
};
|
|
3783
3796
|
const RadioGroupIndicator = forwardRef((props, ref) => {
|
|
3784
3797
|
const { className, ...rest } = props;
|
|
3785
|
-
return /* @__PURE__ */ jsx(
|
|
3798
|
+
return /* @__PURE__ */ jsx(
|
|
3799
|
+
RadixRadioGroup.Indicator,
|
|
3800
|
+
{
|
|
3801
|
+
className: cx(className, "inline-flex items-center justify-center"),
|
|
3802
|
+
ref,
|
|
3803
|
+
...rest
|
|
3804
|
+
}
|
|
3805
|
+
);
|
|
3786
3806
|
});
|
|
3787
3807
|
RadioGroupIndicator.displayName = "RadioGroupIndicator";
|
|
3788
3808
|
const RadioGroupContext = createContext({});
|
|
3789
3809
|
const radioGroupItem = cva(
|
|
3790
3810
|
[
|
|
3811
|
+
"inline-flex",
|
|
3812
|
+
"justify-center",
|
|
3813
|
+
"items-center",
|
|
3814
|
+
"shrink-0",
|
|
3815
|
+
"align-top",
|
|
3816
|
+
"cursor-pointer",
|
|
3791
3817
|
"rounded-full",
|
|
3792
3818
|
"focus-visible:outline-2",
|
|
3793
3819
|
"focus-visible:outline-(--accent-a8)",
|
|
@@ -3827,14 +3853,7 @@ const RadioGroupItem = memo(
|
|
|
3827
3853
|
forwardRef((props, ref) => {
|
|
3828
3854
|
const radioGroupContext = useContext(RadioGroupContext);
|
|
3829
3855
|
const { className, size: size2 = radioGroupContext.size, variant = radioGroupContext.variant, ...rest } = props;
|
|
3830
|
-
return /* @__PURE__ */ jsx(
|
|
3831
|
-
RadixRadioGroup.Item,
|
|
3832
|
-
{
|
|
3833
|
-
className: cx(className, radioGroupItem({ size: size2, variant }), "flex", "justify-center", "items-center"),
|
|
3834
|
-
ref,
|
|
3835
|
-
...rest
|
|
3836
|
-
}
|
|
3837
|
-
);
|
|
3856
|
+
return /* @__PURE__ */ jsx(RadixRadioGroup.Item, { className: cx(className, radioGroupItem({ size: size2, variant })), ref, ...rest });
|
|
3838
3857
|
})
|
|
3839
3858
|
);
|
|
3840
3859
|
const RadioGroupRoot = memo(
|
|
@@ -3856,22 +3875,25 @@ const RadioGroup = {
|
|
|
3856
3875
|
Item: RadioGroupItem,
|
|
3857
3876
|
Root: RadioGroupRoot
|
|
3858
3877
|
};
|
|
3859
|
-
const segmentedControlRootCva = cva(
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3878
|
+
const segmentedControlRootCva = cva(
|
|
3879
|
+
["shrink-0", "transition-colors", "inline-flex", "box-border", "min-w-max", "text-center"],
|
|
3880
|
+
{
|
|
3881
|
+
variants: {
|
|
3882
|
+
variant: {
|
|
3883
|
+
soft: ["bg-(--accent-a3)"],
|
|
3884
|
+
surface: ["bg-(--accent-surface)", "border", "border-(--accent-a6)"],
|
|
3885
|
+
outline: ["bg-transparent", "border", "border-(--accent-a6)"]
|
|
3886
|
+
},
|
|
3887
|
+
size: {
|
|
3888
|
+
xs: ["h-5", "text-xs"],
|
|
3889
|
+
sm: ["h-6", "text-sm"],
|
|
3890
|
+
md: ["h-7", "text-base"],
|
|
3891
|
+
lg: ["h-8", "text-lg"],
|
|
3892
|
+
xl: ["h-9", "text-xl"]
|
|
3893
|
+
}
|
|
3872
3894
|
}
|
|
3873
3895
|
}
|
|
3874
|
-
|
|
3896
|
+
);
|
|
3875
3897
|
const segmentedControlItemCva = cva(
|
|
3876
3898
|
[
|
|
3877
3899
|
"h-full",
|
|
@@ -4051,26 +4073,29 @@ const SegmentedControl = {
|
|
|
4051
4073
|
Root: SegmentedControlRoot
|
|
4052
4074
|
};
|
|
4053
4075
|
const SegmentedTabsListContext = createContext({});
|
|
4054
|
-
const segmentedTabsListCva = cva(
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4076
|
+
const segmentedTabsListCva = cva(
|
|
4077
|
+
["shrink-0", "transition-colors", "inline-flex", "box-border", "min-w-max", "text-center"],
|
|
4078
|
+
{
|
|
4079
|
+
variants: {
|
|
4080
|
+
variant: {
|
|
4081
|
+
soft: ["bg-(--accent-a3)"],
|
|
4082
|
+
surface: ["bg-(--accent-surface)", "border", "border-(--accent-a6)"],
|
|
4083
|
+
outline: ["bg-transparent", "border", "border-(--accent-a6)"]
|
|
4084
|
+
},
|
|
4085
|
+
size: {
|
|
4086
|
+
xs: ["h-5", "text-xs"],
|
|
4087
|
+
sm: ["h-6", "text-sm"],
|
|
4088
|
+
md: ["h-7", "text-base"],
|
|
4089
|
+
lg: ["h-8", "text-lg"],
|
|
4090
|
+
xl: ["h-9", "text-xl"]
|
|
4091
|
+
}
|
|
4060
4092
|
},
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
md: ["h-7", "text-base"],
|
|
4065
|
-
lg: ["h-8", "text-lg"],
|
|
4066
|
-
xl: ["h-9", "text-xl"]
|
|
4093
|
+
defaultVariants: {
|
|
4094
|
+
variant: "surface",
|
|
4095
|
+
size: "md"
|
|
4067
4096
|
}
|
|
4068
|
-
},
|
|
4069
|
-
defaultVariants: {
|
|
4070
|
-
variant: "surface",
|
|
4071
|
-
size: "md"
|
|
4072
4097
|
}
|
|
4073
|
-
|
|
4098
|
+
);
|
|
4074
4099
|
const segmentedTabsTriggerCva = cva(
|
|
4075
4100
|
[
|
|
4076
4101
|
"h-full",
|