@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.d.mts
CHANGED
|
@@ -830,13 +830,14 @@ interface ComboBoxProps extends Omit<Combobox.Root.Props<string>, 'children' | '
|
|
|
830
830
|
label?: string;
|
|
831
831
|
placeholder?: string;
|
|
832
832
|
isDisabled?: boolean;
|
|
833
|
+
maxHeight?: string | number;
|
|
833
834
|
onChange?: (value: string | null) => void;
|
|
834
835
|
renderEmptyState?: (props: object) => ReactNode;
|
|
835
836
|
listProps?: ListProps;
|
|
836
837
|
popoverProps?: Combobox.Positioner.Props;
|
|
837
838
|
className?: string;
|
|
838
839
|
}
|
|
839
|
-
declare function ComboBox({ className, label, placeholder, isDisabled, onChange, renderEmptyState, listProps, popoverProps, children, items, itemToStringLabel, ...props }: ComboBoxProps): react_jsx_runtime.JSX.Element;
|
|
840
|
+
declare function ComboBox({ className, label, placeholder, isDisabled, maxHeight, onChange, renderEmptyState, listProps, popoverProps, children, items, itemToStringLabel, ...props }: ComboBoxProps): react_jsx_runtime.JSX.Element;
|
|
840
841
|
|
|
841
842
|
interface CommandProps extends ComponentProps<typeof Command$1> {
|
|
842
843
|
}
|
|
@@ -845,8 +846,9 @@ interface CommandInputProps extends ComponentProps<typeof Command$1.Input> {
|
|
|
845
846
|
}
|
|
846
847
|
declare function CommandInput({ className, ...props }: CommandInputProps): react_jsx_runtime.JSX.Element;
|
|
847
848
|
interface CommandListProps extends ComponentProps<typeof Command$1.List> {
|
|
849
|
+
maxHeight?: string | number;
|
|
848
850
|
}
|
|
849
|
-
declare function CommandList({ className, ...props }: CommandListProps): react_jsx_runtime.JSX.Element;
|
|
851
|
+
declare function CommandList({ maxHeight, className, ...props }: CommandListProps): react_jsx_runtime.JSX.Element;
|
|
850
852
|
interface CommandEmptyProps extends ComponentProps<typeof Command$1.Empty> {
|
|
851
853
|
}
|
|
852
854
|
declare function CommandEmpty({ className, ...props }: CommandEmptyProps): react_jsx_runtime.JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -830,13 +830,14 @@ interface ComboBoxProps extends Omit<Combobox.Root.Props<string>, 'children' | '
|
|
|
830
830
|
label?: string;
|
|
831
831
|
placeholder?: string;
|
|
832
832
|
isDisabled?: boolean;
|
|
833
|
+
maxHeight?: string | number;
|
|
833
834
|
onChange?: (value: string | null) => void;
|
|
834
835
|
renderEmptyState?: (props: object) => ReactNode;
|
|
835
836
|
listProps?: ListProps;
|
|
836
837
|
popoverProps?: Combobox.Positioner.Props;
|
|
837
838
|
className?: string;
|
|
838
839
|
}
|
|
839
|
-
declare function ComboBox({ className, label, placeholder, isDisabled, onChange, renderEmptyState, listProps, popoverProps, children, items, itemToStringLabel, ...props }: ComboBoxProps): react_jsx_runtime.JSX.Element;
|
|
840
|
+
declare function ComboBox({ className, label, placeholder, isDisabled, maxHeight, onChange, renderEmptyState, listProps, popoverProps, children, items, itemToStringLabel, ...props }: ComboBoxProps): react_jsx_runtime.JSX.Element;
|
|
840
841
|
|
|
841
842
|
interface CommandProps extends ComponentProps<typeof Command$1> {
|
|
842
843
|
}
|
|
@@ -845,8 +846,9 @@ interface CommandInputProps extends ComponentProps<typeof Command$1.Input> {
|
|
|
845
846
|
}
|
|
846
847
|
declare function CommandInput({ className, ...props }: CommandInputProps): react_jsx_runtime.JSX.Element;
|
|
847
848
|
interface CommandListProps extends ComponentProps<typeof Command$1.List> {
|
|
849
|
+
maxHeight?: string | number;
|
|
848
850
|
}
|
|
849
|
-
declare function CommandList({ className, ...props }: CommandListProps): react_jsx_runtime.JSX.Element;
|
|
851
|
+
declare function CommandList({ maxHeight, className, ...props }: CommandListProps): react_jsx_runtime.JSX.Element;
|
|
850
852
|
interface CommandEmptyProps extends ComponentProps<typeof Command$1.Empty> {
|
|
851
853
|
}
|
|
852
854
|
declare function CommandEmpty({ className, ...props }: CommandEmptyProps): react_jsx_runtime.JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ var checkboxGroup = require('@base-ui/react/checkbox-group');
|
|
|
22
22
|
var collapsible = require('@base-ui/react/collapsible');
|
|
23
23
|
var combobox = require('@base-ui/react/combobox');
|
|
24
24
|
var select = require('@base-ui/react/select');
|
|
25
|
+
var scrollArea = require('@base-ui/react/scroll-area');
|
|
25
26
|
var cmdk = require('cmdk');
|
|
26
27
|
var contextMenu = require('@base-ui/react/context-menu');
|
|
27
28
|
var reactHookForm = require('react-hook-form');
|
|
@@ -36,7 +37,6 @@ var progress = require('@base-ui/react/progress');
|
|
|
36
37
|
var radio = require('@base-ui/react/radio');
|
|
37
38
|
var radioGroup = require('@base-ui/react/radio-group');
|
|
38
39
|
var reactResizablePanels = require('react-resizable-panels');
|
|
39
|
-
var scrollArea = require('@base-ui/react/scroll-area');
|
|
40
40
|
var slider = require('@base-ui/react/slider');
|
|
41
41
|
var _switch = require('@base-ui/react/switch');
|
|
42
42
|
var tabs = require('@base-ui/react/tabs');
|
|
@@ -2490,7 +2490,7 @@ var alert = tailwindVariants.tv({
|
|
|
2490
2490
|
variant: {
|
|
2491
2491
|
default: "bg-surface-base text-foreground-primary",
|
|
2492
2492
|
danger: [
|
|
2493
|
-
"bg-surface-base text-status-error",
|
|
2493
|
+
"border-status-error bg-surface-base text-status-error",
|
|
2494
2494
|
"*:data-[slot=alert-description]:text-status-error/90"
|
|
2495
2495
|
]
|
|
2496
2496
|
}
|
|
@@ -4019,6 +4019,58 @@ var InputGroupTextarea = react.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
4019
4019
|
}
|
|
4020
4020
|
));
|
|
4021
4021
|
InputGroupTextarea.displayName = "InputGroupTextarea";
|
|
4022
|
+
var scrollbarClasses = [
|
|
4023
|
+
"flex touch-none select-none justify-center rounded bg-transparent",
|
|
4024
|
+
"opacity-0 transition-opacity duration-200 delay-300",
|
|
4025
|
+
"data-[hovering]:opacity-100 data-[hovering]:delay-0",
|
|
4026
|
+
"data-[scrolling]:opacity-100 data-[scrolling]:delay-0"
|
|
4027
|
+
];
|
|
4028
|
+
function ScrollArea({
|
|
4029
|
+
maxHeight,
|
|
4030
|
+
orientation = "vertical",
|
|
4031
|
+
className,
|
|
4032
|
+
style,
|
|
4033
|
+
children,
|
|
4034
|
+
...props
|
|
4035
|
+
}) {
|
|
4036
|
+
const showVertical = orientation !== "horizontal";
|
|
4037
|
+
const showHorizontal = orientation !== "vertical";
|
|
4038
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4039
|
+
scrollArea.ScrollArea.Root,
|
|
4040
|
+
{
|
|
4041
|
+
...props,
|
|
4042
|
+
className: cn("relative overflow-hidden", className),
|
|
4043
|
+
style,
|
|
4044
|
+
children: [
|
|
4045
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4046
|
+
scrollArea.ScrollArea.Viewport,
|
|
4047
|
+
{
|
|
4048
|
+
className: "size-full overscroll-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-focus-ring",
|
|
4049
|
+
style: { maxHeight },
|
|
4050
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(scrollArea.ScrollArea.Content, { children })
|
|
4051
|
+
}
|
|
4052
|
+
),
|
|
4053
|
+
showVertical && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4054
|
+
scrollArea.ScrollArea.Scrollbar,
|
|
4055
|
+
{
|
|
4056
|
+
orientation: "vertical",
|
|
4057
|
+
className: cn(scrollbarClasses, "w-1.5 mr-0.5"),
|
|
4058
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(scrollArea.ScrollArea.Thumb, { className: "w-full rounded bg-edge-strong" })
|
|
4059
|
+
}
|
|
4060
|
+
),
|
|
4061
|
+
showHorizontal && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4062
|
+
scrollArea.ScrollArea.Scrollbar,
|
|
4063
|
+
{
|
|
4064
|
+
orientation: "horizontal",
|
|
4065
|
+
className: cn(scrollbarClasses, "h-1.5 mb-0.5 flex-col"),
|
|
4066
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(scrollArea.ScrollArea.Thumb, { className: "h-full rounded bg-edge-strong" })
|
|
4067
|
+
}
|
|
4068
|
+
),
|
|
4069
|
+
orientation === "both" && /* @__PURE__ */ jsxRuntime.jsx(scrollArea.ScrollArea.Corner, {})
|
|
4070
|
+
]
|
|
4071
|
+
}
|
|
4072
|
+
);
|
|
4073
|
+
}
|
|
4022
4074
|
function getItemLabel(label) {
|
|
4023
4075
|
if (typeof label === "string" || typeof label === "number") {
|
|
4024
4076
|
return String(label);
|
|
@@ -4036,6 +4088,7 @@ function ComboBox({
|
|
|
4036
4088
|
label,
|
|
4037
4089
|
placeholder,
|
|
4038
4090
|
isDisabled,
|
|
4091
|
+
maxHeight,
|
|
4039
4092
|
onChange,
|
|
4040
4093
|
renderEmptyState,
|
|
4041
4094
|
listProps,
|
|
@@ -4073,13 +4126,20 @@ function ComboBox({
|
|
|
4073
4126
|
/* @__PURE__ */ jsxRuntime.jsx(InputGroupAddon, { align: "inline-end", children: /* @__PURE__ */ jsxRuntime.jsx(combobox.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__ */ jsxRuntime.jsx(Icon, { rotate: 90, "aria-hidden": "true", size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(icons_exports.ChevronRight, {}) }) }) })
|
|
4074
4127
|
] }),
|
|
4075
4128
|
/* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Positioner, { align: "start", sideOffset: 4, ...popoverProps, children: /* @__PURE__ */ jsxRuntime.jsxs(combobox.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: [
|
|
4076
|
-
/* @__PURE__ */ jsxRuntime.jsx(ListPrimitiveProvider, { kind: "combobox", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4129
|
+
/* @__PURE__ */ jsxRuntime.jsx(ListPrimitiveProvider, { kind: "combobox", children: /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { maxHeight: maxHeight ?? "min(23rem, var(--available-height))", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4130
|
+
List,
|
|
4131
|
+
{
|
|
4132
|
+
...listProps,
|
|
4133
|
+
className: cn("overflow-visible", listProps?.className),
|
|
4134
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Collection, { children: (value) => {
|
|
4135
|
+
const item = normalizedItems.find((option) => option.value === value);
|
|
4136
|
+
if (!item) {
|
|
4137
|
+
return null;
|
|
4138
|
+
}
|
|
4139
|
+
return item.element ?? /* @__PURE__ */ jsxRuntime.jsx(ListItem, { value: item.value, children: item.label }, item.value);
|
|
4140
|
+
} })
|
|
4080
4141
|
}
|
|
4081
|
-
|
|
4082
|
-
} }) }) }),
|
|
4142
|
+
) }) }),
|
|
4083
4143
|
/* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Empty, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-16 items-center justify-center px-4 py-3 text-center", children: renderEmptyState ? renderEmptyState({}) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-foreground-muted", children: "No items found." }) }) })
|
|
4084
4144
|
] }) }) })
|
|
4085
4145
|
] })
|
|
@@ -4143,14 +4203,8 @@ function CommandInput({ className, ...props }) {
|
|
|
4143
4203
|
)
|
|
4144
4204
|
] });
|
|
4145
4205
|
}
|
|
4146
|
-
function CommandList({ className, ...props }) {
|
|
4147
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4148
|
-
cmdk.Command.List,
|
|
4149
|
-
{
|
|
4150
|
-
...props,
|
|
4151
|
-
className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden p-2", className)
|
|
4152
|
-
}
|
|
4153
|
-
);
|
|
4206
|
+
function CommandList({ maxHeight = 300, className, ...props }) {
|
|
4207
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { maxHeight, children: /* @__PURE__ */ jsxRuntime.jsx(cmdk.Command.List, { ...props, className: cn("p-2", className) }) });
|
|
4154
4208
|
}
|
|
4155
4209
|
function CommandEmpty({ className, ...props }) {
|
|
4156
4210
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5837,10 +5891,11 @@ function MenuSection({
|
|
|
5837
5891
|
}) {
|
|
5838
5892
|
const primitiveKind = react.useContext(MenuPrimitiveContext);
|
|
5839
5893
|
const groupClassName = cn("[&:not(:last-child)]:mb-4", className);
|
|
5840
|
-
const groupStyle =
|
|
5894
|
+
const groupStyle = style;
|
|
5895
|
+
const body = maxHeight ? /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { maxHeight, children }) : children;
|
|
5841
5896
|
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5842
5897
|
title && (primitiveKind === "context-menu" ? /* @__PURE__ */ jsxRuntime.jsx(contextMenu.ContextMenu.GroupLabel, { className: "text-base font-bold px-2 py-1.5", children: title }) : primitiveKind === "menu" ? /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.GroupLabel, { className: "text-base font-bold px-2 py-1.5", children: title }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-bold px-2 py-1.5", children: title })),
|
|
5843
|
-
|
|
5898
|
+
body
|
|
5844
5899
|
] });
|
|
5845
5900
|
if (primitiveKind === "context-menu") {
|
|
5846
5901
|
return /* @__PURE__ */ jsxRuntime.jsx(contextMenu.ContextMenu.Group, { ...props, className: groupClassName, style: groupStyle, children: content });
|
|
@@ -6479,58 +6534,6 @@ function ResizableHandle({ withHandle, className, ...props }) {
|
|
|
6479
6534
|
}
|
|
6480
6535
|
);
|
|
6481
6536
|
}
|
|
6482
|
-
var scrollbarClasses = [
|
|
6483
|
-
"flex touch-none select-none justify-center rounded bg-transparent",
|
|
6484
|
-
"opacity-0 transition-opacity duration-200 delay-300",
|
|
6485
|
-
"data-[hovering]:opacity-100 data-[hovering]:delay-0",
|
|
6486
|
-
"data-[scrolling]:opacity-100 data-[scrolling]:delay-0"
|
|
6487
|
-
];
|
|
6488
|
-
function ScrollArea({
|
|
6489
|
-
maxHeight,
|
|
6490
|
-
orientation = "vertical",
|
|
6491
|
-
className,
|
|
6492
|
-
style,
|
|
6493
|
-
children,
|
|
6494
|
-
...props
|
|
6495
|
-
}) {
|
|
6496
|
-
const showVertical = orientation !== "horizontal";
|
|
6497
|
-
const showHorizontal = orientation !== "vertical";
|
|
6498
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6499
|
-
scrollArea.ScrollArea.Root,
|
|
6500
|
-
{
|
|
6501
|
-
...props,
|
|
6502
|
-
className: cn("relative overflow-hidden", className),
|
|
6503
|
-
style,
|
|
6504
|
-
children: [
|
|
6505
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6506
|
-
scrollArea.ScrollArea.Viewport,
|
|
6507
|
-
{
|
|
6508
|
-
className: "size-full overscroll-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-focus-ring",
|
|
6509
|
-
style: { maxHeight },
|
|
6510
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(scrollArea.ScrollArea.Content, { children })
|
|
6511
|
-
}
|
|
6512
|
-
),
|
|
6513
|
-
showVertical && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6514
|
-
scrollArea.ScrollArea.Scrollbar,
|
|
6515
|
-
{
|
|
6516
|
-
orientation: "vertical",
|
|
6517
|
-
className: cn(scrollbarClasses, "w-1.5 mr-0.5"),
|
|
6518
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(scrollArea.ScrollArea.Thumb, { className: "w-full rounded bg-edge-strong" })
|
|
6519
|
-
}
|
|
6520
|
-
),
|
|
6521
|
-
showHorizontal && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6522
|
-
scrollArea.ScrollArea.Scrollbar,
|
|
6523
|
-
{
|
|
6524
|
-
orientation: "horizontal",
|
|
6525
|
-
className: cn(scrollbarClasses, "h-1.5 mb-0.5 flex-col"),
|
|
6526
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(scrollArea.ScrollArea.Thumb, { className: "h-full rounded bg-edge-strong" })
|
|
6527
|
-
}
|
|
6528
|
-
),
|
|
6529
|
-
orientation === "both" && /* @__PURE__ */ jsxRuntime.jsx(scrollArea.ScrollArea.Corner, {})
|
|
6530
|
-
]
|
|
6531
|
-
}
|
|
6532
|
-
);
|
|
6533
|
-
}
|
|
6534
6537
|
function SearchField({
|
|
6535
6538
|
label,
|
|
6536
6539
|
placeholder,
|
|
@@ -6630,6 +6633,7 @@ function Select({
|
|
|
6630
6633
|
(item) => typeof item === "object" ? item : { label: String(item), value: item }
|
|
6631
6634
|
);
|
|
6632
6635
|
const collection = children || normalizedItems?.map((item) => /* @__PURE__ */ jsxRuntime.jsx(ListItem, { value: item.value, children: item.label }, item.value));
|
|
6636
|
+
const isEmpty = !collection || Array.isArray(collection) && collection.length === 0;
|
|
6633
6637
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex flex-col gap-1", className), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6634
6638
|
select.Select.Root,
|
|
6635
6639
|
{
|
|
@@ -6690,7 +6694,7 @@ function Select({
|
|
|
6690
6694
|
allowSearch && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6691
6695
|
SearchField,
|
|
6692
6696
|
{
|
|
6693
|
-
className: "
|
|
6697
|
+
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",
|
|
6694
6698
|
value: search,
|
|
6695
6699
|
onChange: setSearch,
|
|
6696
6700
|
onSearch: (value2) => {
|
|
@@ -6708,18 +6712,22 @@ function Select({
|
|
|
6708
6712
|
}
|
|
6709
6713
|
),
|
|
6710
6714
|
isLoading && /* @__PURE__ */ jsxRuntime.jsx(Loading, { className: "py-8", icon: "dots", placement: "center", size: "sm" }),
|
|
6715
|
+
!isLoading && isEmpty && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 py-8 text-center text-base text-foreground-muted", children: "No results found" }),
|
|
6711
6716
|
/* @__PURE__ */ jsxRuntime.jsx(ListPrimitiveProvider, { kind: "select", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6712
|
-
|
|
6717
|
+
ScrollArea,
|
|
6713
6718
|
{
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6719
|
+
maxHeight,
|
|
6720
|
+
style: { display: isLoading || isEmpty ? "none" : void 0 },
|
|
6721
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6722
|
+
List,
|
|
6723
|
+
{
|
|
6724
|
+
...listProps,
|
|
6725
|
+
isFullscreen,
|
|
6726
|
+
className: cn("overflow-visible", listProps?.className),
|
|
6727
|
+
style: listProps?.style,
|
|
6728
|
+
children: collection
|
|
6729
|
+
}
|
|
6730
|
+
)
|
|
6723
6731
|
}
|
|
6724
6732
|
) })
|
|
6725
6733
|
] })
|