@umami/react-zen 0.246.0 → 0.247.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.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +89 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +89 -81
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/styles.full.css +1 -1
package/dist/index.mjs
CHANGED
|
@@ -20,6 +20,7 @@ import { CheckboxGroup as CheckboxGroup$1 } from '@base-ui/react/checkbox-group'
|
|
|
20
20
|
import { Collapsible as Collapsible$1 } from '@base-ui/react/collapsible';
|
|
21
21
|
import { Combobox } from '@base-ui/react/combobox';
|
|
22
22
|
import { Select as Select$1 } from '@base-ui/react/select';
|
|
23
|
+
import { ScrollArea as ScrollArea$1 } from '@base-ui/react/scroll-area';
|
|
23
24
|
import { Command as Command$1 } from 'cmdk';
|
|
24
25
|
import { ContextMenu as ContextMenu$1 } from '@base-ui/react/context-menu';
|
|
25
26
|
import { useForm, FormProvider, Controller, useFormContext, useFieldArray } from 'react-hook-form';
|
|
@@ -34,7 +35,6 @@ import { Progress } from '@base-ui/react/progress';
|
|
|
34
35
|
import { Radio as Radio$1 } from '@base-ui/react/radio';
|
|
35
36
|
import { RadioGroup as RadioGroup$1 } from '@base-ui/react/radio-group';
|
|
36
37
|
import { Group, Panel, Separator as Separator$2 } from 'react-resizable-panels';
|
|
37
|
-
import { ScrollArea as ScrollArea$1 } from '@base-ui/react/scroll-area';
|
|
38
38
|
import { Slider as Slider$1 } from '@base-ui/react/slider';
|
|
39
39
|
import { Switch as Switch$1 } from '@base-ui/react/switch';
|
|
40
40
|
import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
|
|
@@ -2465,7 +2465,7 @@ var alert = tv({
|
|
|
2465
2465
|
variant: {
|
|
2466
2466
|
default: "bg-surface-base text-foreground-primary",
|
|
2467
2467
|
danger: [
|
|
2468
|
-
"bg-surface-base text-status-error",
|
|
2468
|
+
"border-status-error bg-surface-base text-status-error",
|
|
2469
2469
|
"*:data-[slot=alert-description]:text-status-error/90"
|
|
2470
2470
|
]
|
|
2471
2471
|
}
|
|
@@ -3994,6 +3994,58 @@ var InputGroupTextarea = forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
3994
3994
|
}
|
|
3995
3995
|
));
|
|
3996
3996
|
InputGroupTextarea.displayName = "InputGroupTextarea";
|
|
3997
|
+
var scrollbarClasses = [
|
|
3998
|
+
"flex touch-none select-none justify-center rounded bg-transparent",
|
|
3999
|
+
"opacity-0 transition-opacity duration-200 delay-300",
|
|
4000
|
+
"data-[hovering]:opacity-100 data-[hovering]:delay-0",
|
|
4001
|
+
"data-[scrolling]:opacity-100 data-[scrolling]:delay-0"
|
|
4002
|
+
];
|
|
4003
|
+
function ScrollArea({
|
|
4004
|
+
maxHeight,
|
|
4005
|
+
orientation = "vertical",
|
|
4006
|
+
className,
|
|
4007
|
+
style,
|
|
4008
|
+
children,
|
|
4009
|
+
...props
|
|
4010
|
+
}) {
|
|
4011
|
+
const showVertical = orientation !== "horizontal";
|
|
4012
|
+
const showHorizontal = orientation !== "vertical";
|
|
4013
|
+
return /* @__PURE__ */ jsxs(
|
|
4014
|
+
ScrollArea$1.Root,
|
|
4015
|
+
{
|
|
4016
|
+
...props,
|
|
4017
|
+
className: cn("relative overflow-hidden", className),
|
|
4018
|
+
style,
|
|
4019
|
+
children: [
|
|
4020
|
+
/* @__PURE__ */ jsx(
|
|
4021
|
+
ScrollArea$1.Viewport,
|
|
4022
|
+
{
|
|
4023
|
+
className: "size-full overscroll-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-focus-ring",
|
|
4024
|
+
style: { maxHeight },
|
|
4025
|
+
children: /* @__PURE__ */ jsx(ScrollArea$1.Content, { children })
|
|
4026
|
+
}
|
|
4027
|
+
),
|
|
4028
|
+
showVertical && /* @__PURE__ */ jsx(
|
|
4029
|
+
ScrollArea$1.Scrollbar,
|
|
4030
|
+
{
|
|
4031
|
+
orientation: "vertical",
|
|
4032
|
+
className: cn(scrollbarClasses, "w-1.5 mr-0.5"),
|
|
4033
|
+
children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: "w-full rounded bg-edge-strong" })
|
|
4034
|
+
}
|
|
4035
|
+
),
|
|
4036
|
+
showHorizontal && /* @__PURE__ */ jsx(
|
|
4037
|
+
ScrollArea$1.Scrollbar,
|
|
4038
|
+
{
|
|
4039
|
+
orientation: "horizontal",
|
|
4040
|
+
className: cn(scrollbarClasses, "h-1.5 mb-0.5 flex-col"),
|
|
4041
|
+
children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: "h-full rounded bg-edge-strong" })
|
|
4042
|
+
}
|
|
4043
|
+
),
|
|
4044
|
+
orientation === "both" && /* @__PURE__ */ jsx(ScrollArea$1.Corner, {})
|
|
4045
|
+
]
|
|
4046
|
+
}
|
|
4047
|
+
);
|
|
4048
|
+
}
|
|
3997
4049
|
function getItemLabel(label) {
|
|
3998
4050
|
if (typeof label === "string" || typeof label === "number") {
|
|
3999
4051
|
return String(label);
|
|
@@ -4011,6 +4063,7 @@ function ComboBox({
|
|
|
4011
4063
|
label,
|
|
4012
4064
|
placeholder,
|
|
4013
4065
|
isDisabled,
|
|
4066
|
+
maxHeight,
|
|
4014
4067
|
onChange,
|
|
4015
4068
|
renderEmptyState,
|
|
4016
4069
|
listProps,
|
|
@@ -4048,13 +4101,20 @@ function ComboBox({
|
|
|
4048
4101
|
/* @__PURE__ */ jsx(InputGroupAddon, { align: "inline-end", children: /* @__PURE__ */ jsx(Combobox.Trigger, { className: "flex size-6 shrink-0 items-center justify-center rounded text-foreground-muted hover:bg-interactive hover:text-foreground-primary", children: /* @__PURE__ */ jsx(Icon, { rotate: 90, "aria-hidden": "true", size: "sm", children: /* @__PURE__ */ jsx(icons_exports.ChevronRight, {}) }) }) })
|
|
4049
4102
|
] }),
|
|
4050
4103
|
/* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsx(Combobox.Positioner, { align: "start", sideOffset: 4, ...popoverProps, children: /* @__PURE__ */ jsxs(Combobox.Popup, { className: "zen-popover w-[var(--anchor-width)] max-w-[var(--available-width)] p-2 border border-edge rounded-md shadow-lg bg-surface-overlay outline-none", children: [
|
|
4051
|
-
/* @__PURE__ */ jsx(ListPrimitiveProvider, { kind: "combobox", children: /* @__PURE__ */ jsx(
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4104
|
+
/* @__PURE__ */ jsx(ListPrimitiveProvider, { kind: "combobox", children: /* @__PURE__ */ jsx(ScrollArea, { maxHeight: maxHeight ?? "min(23rem, var(--available-height))", children: /* @__PURE__ */ jsx(
|
|
4105
|
+
List,
|
|
4106
|
+
{
|
|
4107
|
+
...listProps,
|
|
4108
|
+
className: cn("overflow-visible", listProps?.className),
|
|
4109
|
+
children: /* @__PURE__ */ jsx(Combobox.Collection, { children: (value) => {
|
|
4110
|
+
const item = normalizedItems.find((option) => option.value === value);
|
|
4111
|
+
if (!item) {
|
|
4112
|
+
return null;
|
|
4113
|
+
}
|
|
4114
|
+
return item.element ?? /* @__PURE__ */ jsx(ListItem, { value: item.value, children: item.label }, item.value);
|
|
4115
|
+
} })
|
|
4055
4116
|
}
|
|
4056
|
-
|
|
4057
|
-
} }) }) }),
|
|
4117
|
+
) }) }),
|
|
4058
4118
|
/* @__PURE__ */ jsx(Combobox.Empty, { children: /* @__PURE__ */ jsx("div", { className: "flex min-h-16 items-center justify-center px-4 py-3 text-center", children: renderEmptyState ? renderEmptyState({}) : /* @__PURE__ */ jsx("span", { className: "text-base text-foreground-muted", children: "No items found." }) }) })
|
|
4059
4119
|
] }) }) })
|
|
4060
4120
|
] })
|
|
@@ -4118,14 +4178,8 @@ function CommandInput({ className, ...props }) {
|
|
|
4118
4178
|
)
|
|
4119
4179
|
] });
|
|
4120
4180
|
}
|
|
4121
|
-
function CommandList({ className, ...props }) {
|
|
4122
|
-
return /* @__PURE__ */ jsx(
|
|
4123
|
-
Command$1.List,
|
|
4124
|
-
{
|
|
4125
|
-
...props,
|
|
4126
|
-
className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden p-2", className)
|
|
4127
|
-
}
|
|
4128
|
-
);
|
|
4181
|
+
function CommandList({ maxHeight = 300, className, ...props }) {
|
|
4182
|
+
return /* @__PURE__ */ jsx(ScrollArea, { maxHeight, children: /* @__PURE__ */ jsx(Command$1.List, { ...props, className: cn("p-2", className) }) });
|
|
4129
4183
|
}
|
|
4130
4184
|
function CommandEmpty({ className, ...props }) {
|
|
4131
4185
|
return /* @__PURE__ */ jsx(
|
|
@@ -5812,10 +5866,11 @@ function MenuSection({
|
|
|
5812
5866
|
}) {
|
|
5813
5867
|
const primitiveKind = useContext(MenuPrimitiveContext);
|
|
5814
5868
|
const groupClassName = cn("[&:not(:last-child)]:mb-4", className);
|
|
5815
|
-
const groupStyle =
|
|
5869
|
+
const groupStyle = style;
|
|
5870
|
+
const body = maxHeight ? /* @__PURE__ */ jsx(ScrollArea, { maxHeight, children }) : children;
|
|
5816
5871
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5817
5872
|
title && (primitiveKind === "context-menu" ? /* @__PURE__ */ jsx(ContextMenu$1.GroupLabel, { className: "text-base font-bold px-2 py-1.5", children: title }) : primitiveKind === "menu" ? /* @__PURE__ */ jsx(Menu$1.GroupLabel, { className: "text-base font-bold px-2 py-1.5", children: title }) : /* @__PURE__ */ jsx("div", { className: "text-base font-bold px-2 py-1.5", children: title })),
|
|
5818
|
-
|
|
5873
|
+
body
|
|
5819
5874
|
] });
|
|
5820
5875
|
if (primitiveKind === "context-menu") {
|
|
5821
5876
|
return /* @__PURE__ */ jsx(ContextMenu$1.Group, { ...props, className: groupClassName, style: groupStyle, children: content });
|
|
@@ -6454,58 +6509,6 @@ function ResizableHandle({ withHandle, className, ...props }) {
|
|
|
6454
6509
|
}
|
|
6455
6510
|
);
|
|
6456
6511
|
}
|
|
6457
|
-
var scrollbarClasses = [
|
|
6458
|
-
"flex touch-none select-none justify-center rounded bg-transparent",
|
|
6459
|
-
"opacity-0 transition-opacity duration-200 delay-300",
|
|
6460
|
-
"data-[hovering]:opacity-100 data-[hovering]:delay-0",
|
|
6461
|
-
"data-[scrolling]:opacity-100 data-[scrolling]:delay-0"
|
|
6462
|
-
];
|
|
6463
|
-
function ScrollArea({
|
|
6464
|
-
maxHeight,
|
|
6465
|
-
orientation = "vertical",
|
|
6466
|
-
className,
|
|
6467
|
-
style,
|
|
6468
|
-
children,
|
|
6469
|
-
...props
|
|
6470
|
-
}) {
|
|
6471
|
-
const showVertical = orientation !== "horizontal";
|
|
6472
|
-
const showHorizontal = orientation !== "vertical";
|
|
6473
|
-
return /* @__PURE__ */ jsxs(
|
|
6474
|
-
ScrollArea$1.Root,
|
|
6475
|
-
{
|
|
6476
|
-
...props,
|
|
6477
|
-
className: cn("relative overflow-hidden", className),
|
|
6478
|
-
style,
|
|
6479
|
-
children: [
|
|
6480
|
-
/* @__PURE__ */ jsx(
|
|
6481
|
-
ScrollArea$1.Viewport,
|
|
6482
|
-
{
|
|
6483
|
-
className: "size-full overscroll-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-focus-ring",
|
|
6484
|
-
style: { maxHeight },
|
|
6485
|
-
children: /* @__PURE__ */ jsx(ScrollArea$1.Content, { children })
|
|
6486
|
-
}
|
|
6487
|
-
),
|
|
6488
|
-
showVertical && /* @__PURE__ */ jsx(
|
|
6489
|
-
ScrollArea$1.Scrollbar,
|
|
6490
|
-
{
|
|
6491
|
-
orientation: "vertical",
|
|
6492
|
-
className: cn(scrollbarClasses, "w-1.5 mr-0.5"),
|
|
6493
|
-
children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: "w-full rounded bg-edge-strong" })
|
|
6494
|
-
}
|
|
6495
|
-
),
|
|
6496
|
-
showHorizontal && /* @__PURE__ */ jsx(
|
|
6497
|
-
ScrollArea$1.Scrollbar,
|
|
6498
|
-
{
|
|
6499
|
-
orientation: "horizontal",
|
|
6500
|
-
className: cn(scrollbarClasses, "h-1.5 mb-0.5 flex-col"),
|
|
6501
|
-
children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: "h-full rounded bg-edge-strong" })
|
|
6502
|
-
}
|
|
6503
|
-
),
|
|
6504
|
-
orientation === "both" && /* @__PURE__ */ jsx(ScrollArea$1.Corner, {})
|
|
6505
|
-
]
|
|
6506
|
-
}
|
|
6507
|
-
);
|
|
6508
|
-
}
|
|
6509
6512
|
function SearchField({
|
|
6510
6513
|
label,
|
|
6511
6514
|
placeholder,
|
|
@@ -6605,6 +6608,7 @@ function Select({
|
|
|
6605
6608
|
(item) => typeof item === "object" ? item : { label: String(item), value: item }
|
|
6606
6609
|
);
|
|
6607
6610
|
const collection = children || normalizedItems?.map((item) => /* @__PURE__ */ jsx(ListItem, { value: item.value, children: item.label }, item.value));
|
|
6611
|
+
const isEmpty = !collection || Array.isArray(collection) && collection.length === 0;
|
|
6608
6612
|
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-1", className), children: /* @__PURE__ */ jsxs(
|
|
6609
6613
|
Select$1.Root,
|
|
6610
6614
|
{
|
|
@@ -6665,7 +6669,7 @@ function Select({
|
|
|
6665
6669
|
allowSearch && /* @__PURE__ */ jsx(
|
|
6666
6670
|
SearchField,
|
|
6667
6671
|
{
|
|
6668
|
-
className: "
|
|
6672
|
+
className: "-mx-2 -mt-2 w-auto rounded-t-md rounded-b-none border-0 border-b border-edge shadow-none focus-within:border-edge",
|
|
6669
6673
|
value: search,
|
|
6670
6674
|
onChange: setSearch,
|
|
6671
6675
|
onSearch: (value2) => {
|
|
@@ -6683,18 +6687,22 @@ function Select({
|
|
|
6683
6687
|
}
|
|
6684
6688
|
),
|
|
6685
6689
|
isLoading && /* @__PURE__ */ jsx(Loading, { className: "py-8", icon: "dots", placement: "center", size: "sm" }),
|
|
6690
|
+
!isLoading && isEmpty && /* @__PURE__ */ jsx("div", { className: "px-2 py-8 text-center text-base text-foreground-muted", children: "No results found" }),
|
|
6686
6691
|
/* @__PURE__ */ jsx(ListPrimitiveProvider, { kind: "select", children: /* @__PURE__ */ jsx(
|
|
6687
|
-
|
|
6692
|
+
ScrollArea,
|
|
6688
6693
|
{
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6694
|
+
maxHeight,
|
|
6695
|
+
style: { display: isLoading || isEmpty ? "none" : void 0 },
|
|
6696
|
+
children: /* @__PURE__ */ jsx(
|
|
6697
|
+
List,
|
|
6698
|
+
{
|
|
6699
|
+
...listProps,
|
|
6700
|
+
isFullscreen,
|
|
6701
|
+
className: cn("overflow-visible", listProps?.className),
|
|
6702
|
+
style: listProps?.style,
|
|
6703
|
+
children: collection
|
|
6704
|
+
}
|
|
6705
|
+
)
|
|
6698
6706
|
}
|
|
6699
6707
|
) })
|
|
6700
6708
|
] })
|