@api7/ui-components 0.4.0 → 0.6.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/README.md +221 -30
- package/dist/animations.css +12 -0
- package/dist/components/alert/alert.d.ts +0 -2
- package/dist/components/alert/alert.js +8 -9
- package/dist/components/avatar/avatar.d.ts +4 -6
- package/dist/components/avatar/avatar.js +7 -8
- package/dist/components/badge/badge.d.ts +0 -2
- package/dist/components/badge/badge.js +15 -16
- package/dist/components/button/button.d.ts +1 -4
- package/dist/components/button/button.js +15 -16
- package/dist/components/calendar/calendar.d.ts +1 -3
- package/dist/components/calendar/calendar.js +29 -30
- package/dist/components/checkbox/checkbox.d.ts +0 -2
- package/dist/components/checkbox/checkbox.js +4 -5
- package/dist/components/combobox/combobox.d.ts +0 -2
- package/dist/components/combobox/combobox.js +25 -25
- package/dist/components/data-table/data-table.d.ts +0 -2
- package/dist/components/data-table/data-table.js +8 -9
- package/dist/components/data-table/filter-header.d.ts +1 -3
- package/dist/components/data-table/filter-header.js +5 -6
- package/dist/components/data-table/sort-header.js +3 -4
- package/dist/components/date-picker/date-picker.d.ts +0 -2
- package/dist/components/date-picker/date-picker.js +15 -16
- package/dist/components/description-list/description-list.d.ts +24 -0
- package/dist/components/description-list/description-list.js +88 -0
- package/dist/components/dialog/dialog.d.ts +0 -2
- package/dist/components/dialog/dialog.js +12 -13
- package/dist/components/drawer/drawer.d.ts +0 -2
- package/dist/components/drawer/drawer.js +13 -14
- package/dist/components/empty/empty.d.ts +0 -2
- package/dist/components/empty/empty.js +9 -10
- package/dist/components/field/field.d.ts +0 -2
- package/dist/components/field/field.js +7 -8
- package/dist/components/field/labeled-field.d.ts +33 -0
- package/dist/components/field/labeled-field.js +67 -0
- package/dist/components/form/choice-fields.d.ts +1 -3
- package/dist/components/form/choice-fields.js +1 -2
- package/dist/components/form/date-fields.d.ts +0 -2
- package/dist/components/form/date-fields.js +2 -3
- package/dist/components/form/errors.d.ts +1 -3
- package/dist/components/form/errors.js +1 -2
- package/dist/components/form/form-context.d.ts +1 -3
- package/dist/components/form/form-context.js +1 -2
- package/dist/components/form/form-item.d.ts +6 -17
- package/dist/components/form/form-item.js +9 -58
- package/dist/components/form/form.d.ts +1 -3
- package/dist/components/form/form.js +1 -2
- package/dist/components/form/lazy-field-components.js +2 -3
- package/dist/components/form/submit-button.d.ts +1 -3
- package/dist/components/form/submit-button.js +1 -2
- package/dist/components/form/text-field.d.ts +1 -3
- package/dist/components/form/text-field.js +1 -2
- package/dist/components/form/toggle-fields.d.ts +1 -3
- package/dist/components/form/toggle-fields.js +30 -46
- package/dist/components/input/input.d.ts +0 -2
- package/dist/components/input/input.js +2 -3
- package/dist/components/input-group/input-group.d.ts +0 -2
- package/dist/components/input-group/input-group.js +12 -13
- package/dist/components/menu/menu.d.ts +14 -4
- package/dist/components/menu/menu.js +43 -31
- package/dist/components/number-field/number-field.d.ts +0 -2
- package/dist/components/number-field/number-field.js +8 -9
- package/dist/components/pagination/pagination.d.ts +1 -3
- package/dist/components/pagination/pagination.js +13 -14
- package/dist/components/popover/popover.d.ts +3 -3
- package/dist/components/popover/popover.js +14 -7
- package/dist/components/progress/progress.d.ts +17 -0
- package/dist/components/progress/progress.js +35 -0
- package/dist/components/radio-group/radio-group.d.ts +0 -2
- package/dist/components/radio-group/radio-group.js +4 -5
- package/dist/components/select/select.d.ts +0 -2
- package/dist/components/select/select.js +18 -18
- package/dist/components/separator/separator.d.ts +0 -2
- package/dist/components/separator/separator.js +2 -3
- package/dist/components/sidebar/sidebar.d.ts +0 -2
- package/dist/components/sidebar/sidebar.js +11 -12
- package/dist/components/skeleton/skeleton.d.ts +0 -2
- package/dist/components/skeleton/skeleton.js +2 -3
- package/dist/components/spinner/spinner.d.ts +12 -0
- package/dist/components/spinner/spinner.js +27 -0
- package/dist/components/switch/switch.d.ts +0 -2
- package/dist/components/switch/switch.js +3 -4
- package/dist/components/table/table.d.ts +0 -2
- package/dist/components/table/table.js +8 -9
- package/dist/components/tabs/tabs.d.ts +0 -2
- package/dist/components/tabs/tabs.js +5 -6
- package/dist/components/textarea/textarea.d.ts +0 -2
- package/dist/components/textarea/textarea.js +2 -3
- package/dist/components/toast/toast.d.ts +0 -2
- package/dist/components/toast/toast.js +19 -20
- package/dist/components/tooltip/tooltip.d.ts +0 -2
- package/dist/components/tooltip/tooltip.js +5 -4
- package/dist/config/config-provider.d.ts +1 -3
- package/dist/config/config-provider.js +1 -2
- package/dist/config/messages.d.ts +5 -3
- package/dist/config/messages.js +3 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +7 -3
- package/dist/lib/cn.js +5 -6
- package/dist/lib/control.js +4 -5
- package/dist/lib/popup.js +6 -6
- package/dist/theme.css +220 -0
- package/dist/tokens/contrast.d.ts +1 -3
- package/dist/tokens/contrast.js +1 -2
- package/dist/tokens/palette.d.ts +0 -2
- package/dist/tokens/palette.js +1 -2
- package/dist/tokens/scale.js +1 -2
- package/dist/tokens/semantic.d.ts +0 -2
- package/dist/tokens/semantic.js +0 -1
- package/dist/tokens/types.d.ts +1 -3
- package/dist/tokens/types.js +1 -2
- package/package.json +11 -9
- package/dist/styles.css +0 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Menu } from "@base-ui/react/menu";
|
|
2
|
-
//#region src/components/menu/menu.d.ts
|
|
3
2
|
type WithClassName<P> = Omit<P, 'className'> & {
|
|
4
3
|
className?: string;
|
|
5
4
|
};
|
|
@@ -10,8 +9,12 @@ export type MenuContentProps = WithClassName<Menu.Popup.Props> & {
|
|
|
10
9
|
side?: Menu.Positioner.Props['side'];
|
|
11
10
|
sideOffset?: Menu.Positioner.Props['sideOffset'];
|
|
12
11
|
align?: Menu.Positioner.Props['align'];
|
|
12
|
+
/** Additional positioning options, including alignment offset and fixed positioning. */
|
|
13
|
+
positionerProps?: Omit<Menu.Positioner.Props, 'children'>;
|
|
14
|
+
/** Preserve child state while the menu is closed. */
|
|
15
|
+
keepMounted?: Menu.Portal.Props['keepMounted'];
|
|
13
16
|
};
|
|
14
|
-
declare function MenuContent({ className, side, sideOffset, align, ...props }: MenuContentProps): import("react").JSX.Element;
|
|
17
|
+
declare function MenuContent({ className, side, sideOffset, align, positionerProps, keepMounted, ...props }: MenuContentProps): import("react").JSX.Element;
|
|
15
18
|
export type MenuItemProps = WithClassName<Menu.Item.Props> & {
|
|
16
19
|
variant?: 'default' | 'destructive';
|
|
17
20
|
};
|
|
@@ -35,7 +38,14 @@ export type MenuSubContentProps = WithClassName<Menu.Popup.Props> & {
|
|
|
35
38
|
side?: Menu.Positioner.Props['side'];
|
|
36
39
|
sideOffset?: Menu.Positioner.Props['sideOffset'];
|
|
37
40
|
align?: Menu.Positioner.Props['align'];
|
|
41
|
+
/** Additional positioning options, including alignment offset and fixed positioning. */
|
|
42
|
+
positionerProps?: Omit<Menu.Positioner.Props, 'children'>;
|
|
43
|
+
/**
|
|
44
|
+
* Preserve child state while the submenu is closed. Every ancestor menu content
|
|
45
|
+
* must also use keepMounted to preserve this subtree (including dialogs it
|
|
46
|
+
* opens) when selecting an item closes the parent menu.
|
|
47
|
+
*/
|
|
48
|
+
keepMounted?: Menu.Portal.Props['keepMounted'];
|
|
38
49
|
};
|
|
39
|
-
declare function MenuSubContent({ className, side, sideOffset, align, ...props }: MenuSubContentProps): import("react").JSX.Element;
|
|
40
|
-
//#endregion
|
|
50
|
+
declare function MenuSubContent({ className, side, sideOffset, align, positionerProps, keepMounted, ...props }: MenuSubContentProps): import("react").JSX.Element;
|
|
41
51
|
export { Menu$1 as Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../../lib/cn.js";
|
|
3
|
-
import { popupClassName } from "../../lib/popup.js";
|
|
3
|
+
import { popupClassName, popupLayerClassName } from "../../lib/popup.js";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { CheckIcon, ChevronRightIcon } from "lucide-react";
|
|
6
6
|
import { Menu } from "@base-ui/react/menu";
|
|
7
|
-
|
|
8
|
-
const menuItemClassName = "
|
|
9
|
-
const destructiveItemClassName = "
|
|
7
|
+
// src/components/menu/menu.tsx
|
|
8
|
+
const menuItemClassName = "flex h-13 cursor-default items-center gap-2 px-3 text-sm outline-none select-none data-highlighted:bg-accent data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0";
|
|
9
|
+
const destructiveItemClassName = "text-destructive-text data-highlighted:bg-destructive-subtle";
|
|
10
10
|
const Menu$1 = Menu.Root;
|
|
11
11
|
function MenuTrigger({ className, ...props }) {
|
|
12
12
|
return /* @__PURE__ */ jsx(Menu.Trigger, {
|
|
@@ -15,17 +15,25 @@ function MenuTrigger({ className, ...props }) {
|
|
|
15
15
|
"data-slot": "menu-trigger"
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
...
|
|
26
|
-
|
|
18
|
+
function positionerClassName(className) {
|
|
19
|
+
return typeof className === "function" ? (state) => cn(popupLayerClassName, className(state)) : cn(popupLayerClassName, className);
|
|
20
|
+
}
|
|
21
|
+
function MenuContent({ className, side = "bottom", sideOffset = 4, align = "end", positionerProps, keepMounted, ...props }) {
|
|
22
|
+
return /* @__PURE__ */ jsx(Menu.Portal, {
|
|
23
|
+
keepMounted,
|
|
24
|
+
children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
25
|
+
...positionerProps,
|
|
26
|
+
className: positionerClassName(positionerProps?.className),
|
|
27
|
+
side: positionerProps?.side ?? side,
|
|
28
|
+
sideOffset: positionerProps?.sideOffset ?? sideOffset,
|
|
29
|
+
align: positionerProps?.align ?? align,
|
|
30
|
+
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
31
|
+
className: cn(popupClassName, "min-w-40 py-1", className),
|
|
32
|
+
...props,
|
|
33
|
+
"data-slot": "menu-content"
|
|
34
|
+
})
|
|
27
35
|
})
|
|
28
|
-
})
|
|
36
|
+
});
|
|
29
37
|
}
|
|
30
38
|
function MenuItem({ className, variant = "default", ...props }) {
|
|
31
39
|
return /* @__PURE__ */ jsx(Menu.Item, {
|
|
@@ -36,7 +44,7 @@ function MenuItem({ className, variant = "default", ...props }) {
|
|
|
36
44
|
}
|
|
37
45
|
function MenuSeparator({ className, ...props }) {
|
|
38
46
|
return /* @__PURE__ */ jsx(Menu.Separator, {
|
|
39
|
-
className: cn("
|
|
47
|
+
className: cn("my-1 h-px bg-border", className),
|
|
40
48
|
...props,
|
|
41
49
|
"data-slot": "menu-separator"
|
|
42
50
|
});
|
|
@@ -50,7 +58,7 @@ function MenuGroup({ className, ...props }) {
|
|
|
50
58
|
}
|
|
51
59
|
function MenuGroupLabel({ className, ...props }) {
|
|
52
60
|
return /* @__PURE__ */ jsx(Menu.GroupLabel, {
|
|
53
|
-
className: cn("
|
|
61
|
+
className: cn("px-3 py-2 text-xs font-medium text-muted-foreground", className),
|
|
54
62
|
...props,
|
|
55
63
|
"data-slot": "menu-group-label"
|
|
56
64
|
});
|
|
@@ -61,7 +69,7 @@ function MenuCheckboxItem({ className, children, ...props }) {
|
|
|
61
69
|
...props,
|
|
62
70
|
"data-slot": "menu-checkbox-item",
|
|
63
71
|
children: [/* @__PURE__ */ jsx("span", {
|
|
64
|
-
className: "
|
|
72
|
+
className: "flex size-4 shrink-0 items-center justify-center",
|
|
65
73
|
children: /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
66
74
|
}), children]
|
|
67
75
|
});
|
|
@@ -79,8 +87,8 @@ function MenuRadioItem({ className, children, ...props }) {
|
|
|
79
87
|
...props,
|
|
80
88
|
"data-slot": "menu-radio-item",
|
|
81
89
|
children: [/* @__PURE__ */ jsx("span", {
|
|
82
|
-
className: "
|
|
83
|
-
children: /* @__PURE__ */ jsx(Menu.RadioItemIndicator, { children: /* @__PURE__ */ jsx("span", { className: "
|
|
90
|
+
className: "flex size-4 shrink-0 items-center justify-center",
|
|
91
|
+
children: /* @__PURE__ */ jsx(Menu.RadioItemIndicator, { children: /* @__PURE__ */ jsx("span", { className: "inline-block size-2 rounded-full bg-current" }) })
|
|
84
92
|
}), children]
|
|
85
93
|
});
|
|
86
94
|
}
|
|
@@ -90,20 +98,24 @@ function MenuSubTrigger({ className, children, ...props }) {
|
|
|
90
98
|
className: cn(menuItemClassName, className),
|
|
91
99
|
...props,
|
|
92
100
|
"data-slot": "menu-sub-trigger",
|
|
93
|
-
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "
|
|
101
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto" })]
|
|
94
102
|
});
|
|
95
103
|
}
|
|
96
|
-
function MenuSubContent({ className, side, sideOffset, align, ...props }) {
|
|
97
|
-
return /* @__PURE__ */ jsx(Menu.Portal, {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
function MenuSubContent({ className, side, sideOffset, align, positionerProps, keepMounted, ...props }) {
|
|
105
|
+
return /* @__PURE__ */ jsx(Menu.Portal, {
|
|
106
|
+
keepMounted,
|
|
107
|
+
children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
108
|
+
...positionerProps,
|
|
109
|
+
className: positionerClassName(positionerProps?.className),
|
|
110
|
+
side: positionerProps?.side ?? side,
|
|
111
|
+
sideOffset: positionerProps?.sideOffset ?? sideOffset,
|
|
112
|
+
align: positionerProps?.align ?? align,
|
|
113
|
+
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
114
|
+
className: cn(popupClassName, "min-w-40 py-1", className),
|
|
115
|
+
...props,
|
|
116
|
+
"data-slot": "menu-sub-content"
|
|
117
|
+
})
|
|
105
118
|
})
|
|
106
|
-
})
|
|
119
|
+
});
|
|
107
120
|
}
|
|
108
|
-
//#endregion
|
|
109
121
|
export { Menu$1 as Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { NumberField } from "@base-ui/react/number-field";
|
|
3
|
-
//#region src/components/number-field/number-field.d.ts
|
|
4
3
|
export type NumberFieldProps = Omit<NumberField.Root.Props, 'className' | 'children'> & {
|
|
5
4
|
className?: string;
|
|
6
5
|
placeholder?: string;
|
|
@@ -12,5 +11,4 @@ export type NumberFieldProps = Omit<NumberField.Root.Props, 'className' | 'child
|
|
|
12
11
|
decrementLabel?: string;
|
|
13
12
|
};
|
|
14
13
|
declare function NumberField$1({ className, placeholder, showStepper, unit, incrementLabel, decrementLabel, locale, format, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, ...props }: NumberFieldProps): import("react").JSX.Element;
|
|
15
|
-
//#endregion
|
|
16
14
|
export { NumberField$1 as NumberField };
|
|
@@ -6,8 +6,8 @@ import { useId } from "react";
|
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { ChevronDown, ChevronUp } from "lucide-react";
|
|
8
8
|
import { NumberField } from "@base-ui/react/number-field";
|
|
9
|
-
|
|
10
|
-
const stepperButtonClassName = "
|
|
9
|
+
// src/components/number-field/number-field.tsx
|
|
10
|
+
const stepperButtonClassName = "flex basis-1/2 grow-0 shrink-0 items-center justify-center text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:size-3";
|
|
11
11
|
function NumberField$1({ className, placeholder, showStepper = false, unit, incrementLabel, decrementLabel, locale, format, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, ...props }) {
|
|
12
12
|
const messages = useMessages();
|
|
13
13
|
const uiLocale = useLocale();
|
|
@@ -20,25 +20,25 @@ function NumberField$1({ className, placeholder, showStepper = false, unit, incr
|
|
|
20
20
|
useGrouping: false,
|
|
21
21
|
...format
|
|
22
22
|
},
|
|
23
|
-
className: cn("
|
|
23
|
+
className: cn("group/number-field flex w-full", className),
|
|
24
24
|
...props,
|
|
25
25
|
"data-slot": "number-field",
|
|
26
26
|
children: [/* @__PURE__ */ jsxs(NumberField.Group, {
|
|
27
|
-
className: cn(controlSurface, controlFocusWithin, "
|
|
27
|
+
className: cn(controlSurface, controlFocusWithin, "flex h-8 flex-1 overflow-hidden", hasUnit ? "rounded-l-sm rounded-r-none" : "rounded-sm"),
|
|
28
28
|
"data-slot": "number-field-group",
|
|
29
29
|
children: [/* @__PURE__ */ jsx(NumberField.Input, {
|
|
30
30
|
placeholder,
|
|
31
31
|
"aria-label": ariaLabel,
|
|
32
32
|
"aria-labelledby": ariaLabelledby,
|
|
33
33
|
"aria-describedby": describedBy,
|
|
34
|
-
className: "
|
|
34
|
+
className: "min-w-0 flex-1 bg-transparent px-3 text-left text-foreground tabular-nums outline-none placeholder:text-muted-foreground",
|
|
35
35
|
"data-slot": "number-field-input"
|
|
36
36
|
}), showStepper && /* @__PURE__ */ jsxs("div", {
|
|
37
|
-
className: "
|
|
37
|
+
className: "flex w-6 shrink-0 flex-col border-l border-input",
|
|
38
38
|
"data-slot": "number-field-stepper",
|
|
39
39
|
children: [/* @__PURE__ */ jsx(NumberField.Increment, {
|
|
40
40
|
"aria-label": incrementLabel ?? messages.numberField.increment,
|
|
41
|
-
className: cn(stepperButtonClassName, "
|
|
41
|
+
className: cn(stepperButtonClassName, "border-b border-input"),
|
|
42
42
|
"data-slot": "number-field-increment",
|
|
43
43
|
children: /* @__PURE__ */ jsx(ChevronUp, {})
|
|
44
44
|
}), /* @__PURE__ */ jsx(NumberField.Decrement, {
|
|
@@ -50,11 +50,10 @@ function NumberField$1({ className, placeholder, showStepper = false, unit, incr
|
|
|
50
50
|
})]
|
|
51
51
|
}), hasUnit && /* @__PURE__ */ jsx("span", {
|
|
52
52
|
id: unitId,
|
|
53
|
-
className: "
|
|
53
|
+
className: "flex shrink-0 items-center rounded-r-sm border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground group-data-disabled/number-field:opacity-50",
|
|
54
54
|
"data-slot": "number-field-unit",
|
|
55
55
|
children: unit
|
|
56
56
|
})]
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
//#endregion
|
|
60
59
|
export { NumberField$1 as NumberField };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/components/pagination/pagination.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Page buttons to render: page indexes (0-based) and 'ellipsis' markers, mirroring
|
|
4
3
|
* react-paginate with pageRangeDisplayed=2 and one page kept at each edge. The window is 3
|
|
@@ -20,5 +19,4 @@ export interface PaginationProps {
|
|
|
20
19
|
className?: string;
|
|
21
20
|
}
|
|
22
21
|
/** Renders nothing when `rowCount` is 0, matching the legacy footer's `total > 0` guard. */
|
|
23
|
-
export declare function Pagination({ pageIndex, pageSize, rowCount, pageSizeOptions, onPageIndexChange, onPageSizeChange, label, className }: PaginationProps): import("react").JSX.Element | null;
|
|
24
|
-
//#endregion
|
|
22
|
+
export declare function Pagination({ pageIndex, pageSize, rowCount, pageSizeOptions, onPageIndexChange, onPageSizeChange, label, className }: PaginationProps): import("react").JSX.Element | null;
|
|
@@ -4,7 +4,7 @@ import { cn } from "../../lib/cn.js";
|
|
|
4
4
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../select/select.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
7
|
-
|
|
7
|
+
// src/components/pagination/pagination.tsx
|
|
8
8
|
const DEFAULT_PAGE_SIZE_OPTIONS = [
|
|
9
9
|
10,
|
|
10
10
|
20,
|
|
@@ -56,13 +56,13 @@ function Pagination({ pageIndex, pageSize, rowCount, pageSizeOptions = DEFAULT_P
|
|
|
56
56
|
const pageItems = getPageItems(currentPage, pageCount);
|
|
57
57
|
const effectivePageSizeOptions = pageSizeOptions.includes(pageSize) ? pageSizeOptions : [...pageSizeOptions, pageSize].sort((a, b) => a - b);
|
|
58
58
|
return /* @__PURE__ */ jsxs("div", {
|
|
59
|
-
className: cn("
|
|
59
|
+
className: cn("flex h-11 items-center justify-between px-[22px] py-3", className),
|
|
60
60
|
"data-slot": "pagination",
|
|
61
61
|
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
|
|
62
|
-
className: "
|
|
62
|
+
className: "text-sm text-muted-foreground",
|
|
63
63
|
children: messages.pagination.results
|
|
64
64
|
}), /* @__PURE__ */ jsx("span", {
|
|
65
|
-
className: "
|
|
65
|
+
className: "ml-2.5 text-sm text-foreground",
|
|
66
66
|
children: messages.pagination.range({
|
|
67
67
|
from: formatter.format(from),
|
|
68
68
|
to: formatter.format(to),
|
|
@@ -70,7 +70,7 @@ function Pagination({ pageIndex, pageSize, rowCount, pageSizeOptions = DEFAULT_P
|
|
|
70
70
|
})
|
|
71
71
|
})] }), /* @__PURE__ */ jsxs("nav", {
|
|
72
72
|
"aria-label": label ?? messages.pagination.label,
|
|
73
|
-
className: "
|
|
73
|
+
className: "flex items-center gap-1.5",
|
|
74
74
|
"data-slot": "pagination-nav",
|
|
75
75
|
children: [
|
|
76
76
|
/* @__PURE__ */ jsx("button", {
|
|
@@ -78,13 +78,13 @@ function Pagination({ pageIndex, pageSize, rowCount, pageSizeOptions = DEFAULT_P
|
|
|
78
78
|
"aria-label": messages.pagination.previous,
|
|
79
79
|
disabled: currentPage <= 0,
|
|
80
80
|
onClick: () => onPageIndexChange(currentPage - 1),
|
|
81
|
-
className: cn("
|
|
81
|
+
className: cn("flex size-6 items-center justify-center rounded-sm border border-input outline-none focus-visible:ring-2 focus-visible:ring-ring/40", currentPage <= 0 && "cursor-not-allowed opacity-50"),
|
|
82
82
|
"data-slot": "pagination-previous",
|
|
83
|
-
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "
|
|
83
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-3.5" })
|
|
84
84
|
}),
|
|
85
85
|
pageItems.map((item, index) => item === "ellipsis" ? /* @__PURE__ */ jsx("span", {
|
|
86
86
|
"aria-hidden": "true",
|
|
87
|
-
className: "
|
|
87
|
+
className: "flex size-6 items-center justify-center text-sm text-muted-foreground",
|
|
88
88
|
"data-slot": "pagination-ellipsis",
|
|
89
89
|
children: "…"
|
|
90
90
|
}, `ellipsis-${index}`) : /* @__PURE__ */ jsx("button", {
|
|
@@ -92,7 +92,7 @@ function Pagination({ pageIndex, pageSize, rowCount, pageSizeOptions = DEFAULT_P
|
|
|
92
92
|
"aria-label": messages.pagination.page({ page: formatter.format(item + 1) }),
|
|
93
93
|
"aria-current": item === currentPage ? "page" : void 0,
|
|
94
94
|
onClick: () => onPageIndexChange(item),
|
|
95
|
-
className: cn("
|
|
95
|
+
className: cn("size-6 rounded-sm text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring/40", item === currentPage ? "bg-primary text-primary-foreground" : "hover:bg-accent-hover"),
|
|
96
96
|
"data-slot": "pagination-page",
|
|
97
97
|
children: item + 1
|
|
98
98
|
}, item)),
|
|
@@ -101,9 +101,9 @@ function Pagination({ pageIndex, pageSize, rowCount, pageSizeOptions = DEFAULT_P
|
|
|
101
101
|
"aria-label": messages.pagination.next,
|
|
102
102
|
disabled: currentPage >= pageCount - 1,
|
|
103
103
|
onClick: () => onPageIndexChange(currentPage + 1),
|
|
104
|
-
className: cn("
|
|
104
|
+
className: cn("flex size-6 items-center justify-center rounded-sm border border-input outline-none focus-visible:ring-2 focus-visible:ring-ring/40", currentPage >= pageCount - 1 && "cursor-not-allowed opacity-50"),
|
|
105
105
|
"data-slot": "pagination-next",
|
|
106
|
-
children: /* @__PURE__ */ jsx(ChevronRight, { className: "
|
|
106
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5" })
|
|
107
107
|
}),
|
|
108
108
|
/* @__PURE__ */ jsxs(Select, {
|
|
109
109
|
items: pageSizeItems(effectivePageSizeOptions, messages, formatter),
|
|
@@ -111,9 +111,9 @@ function Pagination({ pageIndex, pageSize, rowCount, pageSizeOptions = DEFAULT_P
|
|
|
111
111
|
onValueChange: (value) => onPageSizeChange(Number(value)),
|
|
112
112
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
113
113
|
size: "sm",
|
|
114
|
-
className: "
|
|
114
|
+
className: "w-[110px]",
|
|
115
115
|
"aria-label": messages.pagination.pageSizeLabel,
|
|
116
|
-
children: /* @__PURE__ */ jsx(SelectValue, { className: "
|
|
116
|
+
children: /* @__PURE__ */ jsx(SelectValue, { className: "flex-1 text-center" })
|
|
117
117
|
}), /* @__PURE__ */ jsx(SelectContent, { children: effectivePageSizeOptions.map((size) => /* @__PURE__ */ jsx(SelectItem, {
|
|
118
118
|
value: String(size),
|
|
119
119
|
children: messages.pagination.pageSize({ size: formatter.format(size) })
|
|
@@ -126,5 +126,4 @@ function Pagination({ pageIndex, pageSize, rowCount, pageSizeOptions = DEFAULT_P
|
|
|
126
126
|
function pageSizeItems(pageSizeOptions, messages, formatter) {
|
|
127
127
|
return Object.fromEntries(pageSizeOptions.map((size) => [String(size), messages.pagination.pageSize({ size: formatter.format(size) })]));
|
|
128
128
|
}
|
|
129
|
-
//#endregion
|
|
130
129
|
export { DEFAULT_PAGE_SIZE_OPTIONS, Pagination, getPageItems };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Popover } from "@base-ui/react/popover";
|
|
2
|
-
//#region src/components/popover/popover.d.ts
|
|
3
2
|
type WithClassName<P> = Omit<P, 'className'> & {
|
|
4
3
|
className?: string;
|
|
5
4
|
};
|
|
@@ -12,11 +11,12 @@ export type PopoverContentProps = WithClassName<Popover.Popup.Props> & {
|
|
|
12
11
|
align?: Popover.Positioner.Props['align'];
|
|
13
12
|
};
|
|
14
13
|
declare function PopoverContent({ className, side, sideOffset, align, ...props }: PopoverContentProps): import("react").JSX.Element;
|
|
14
|
+
export type PopoverArrowProps = WithClassName<Popover.Arrow.Props>;
|
|
15
|
+
declare function PopoverArrow({ className, ...props }: PopoverArrowProps): import("react").JSX.Element;
|
|
15
16
|
export type PopoverTitleProps = WithClassName<Popover.Title.Props>;
|
|
16
17
|
declare function PopoverTitle({ className, ...props }: PopoverTitleProps): import("react").JSX.Element;
|
|
17
18
|
export type PopoverDescriptionProps = WithClassName<Popover.Description.Props>;
|
|
18
19
|
declare function PopoverDescription({ className, ...props }: PopoverDescriptionProps): import("react").JSX.Element;
|
|
19
20
|
export type PopoverCloseProps = WithClassName<Popover.Close.Props>;
|
|
20
21
|
declare function PopoverClose({ className, ...props }: PopoverCloseProps): import("react").JSX.Element;
|
|
21
|
-
|
|
22
|
-
export { Popover$1 as Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger };
|
|
22
|
+
export { Popover$1 as Popover, PopoverArrow, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../../lib/cn.js";
|
|
3
|
-
import { popupClassName } from "../../lib/popup.js";
|
|
3
|
+
import { popupClassName, popupLayerClassName } from "../../lib/popup.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { Popover } from "@base-ui/react/popover";
|
|
6
|
-
|
|
6
|
+
// src/components/popover/popover.tsx
|
|
7
7
|
const Popover$1 = Popover.Root;
|
|
8
8
|
function PopoverTrigger({ className, ...props }) {
|
|
9
9
|
return /* @__PURE__ */ jsx(Popover.Trigger, {
|
|
@@ -14,26 +14,34 @@ function PopoverTrigger({ className, ...props }) {
|
|
|
14
14
|
}
|
|
15
15
|
function PopoverContent({ className, side = "bottom", sideOffset = 4, align = "start", ...props }) {
|
|
16
16
|
return /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, {
|
|
17
|
+
className: popupLayerClassName,
|
|
17
18
|
side,
|
|
18
19
|
sideOffset,
|
|
19
20
|
align,
|
|
20
21
|
children: /* @__PURE__ */ jsx(Popover.Popup, {
|
|
21
|
-
className: cn(popupClassName, "
|
|
22
|
+
className: cn(popupClassName, "w-72 max-w-[calc(100vw-2rem)] p-3", className),
|
|
22
23
|
...props,
|
|
23
24
|
"data-slot": "popover-content"
|
|
24
25
|
})
|
|
25
26
|
}) });
|
|
26
27
|
}
|
|
28
|
+
function PopoverArrow({ className, ...props }) {
|
|
29
|
+
return /* @__PURE__ */ jsx(Popover.Arrow, {
|
|
30
|
+
className: cn("size-3 rotate-45 bg-popover data-[side=bottom]:-top-1.5 data-[side=left]:-right-1.5 data-[side=right]:-left-1.5 data-[side=top]:-bottom-1.5 data-[side=inline-start]:-end-1.5 data-[side=inline-end]:-start-1.5", className),
|
|
31
|
+
...props,
|
|
32
|
+
"data-slot": "popover-arrow"
|
|
33
|
+
});
|
|
34
|
+
}
|
|
27
35
|
function PopoverTitle({ className, ...props }) {
|
|
28
36
|
return /* @__PURE__ */ jsx(Popover.Title, {
|
|
29
|
-
className: cn("
|
|
37
|
+
className: cn("text-sm font-medium", className),
|
|
30
38
|
...props,
|
|
31
39
|
"data-slot": "popover-title"
|
|
32
40
|
});
|
|
33
41
|
}
|
|
34
42
|
function PopoverDescription({ className, ...props }) {
|
|
35
43
|
return /* @__PURE__ */ jsx(Popover.Description, {
|
|
36
|
-
className: cn("
|
|
44
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
37
45
|
...props,
|
|
38
46
|
"data-slot": "popover-description"
|
|
39
47
|
});
|
|
@@ -45,5 +53,4 @@ function PopoverClose({ className, ...props }) {
|
|
|
45
53
|
"data-slot": "popover-close"
|
|
46
54
|
});
|
|
47
55
|
}
|
|
48
|
-
|
|
49
|
-
export { Popover$1 as Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger };
|
|
56
|
+
export { Popover$1 as Popover, PopoverArrow, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import { Progress } from "@base-ui/react/progress";
|
|
3
|
+
declare const trackVariants: (props?: ({
|
|
4
|
+
size?: "sm" | "md" | "xs" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
declare const indicatorVariants: (props?: ({
|
|
7
|
+
variant?: "destructive" | "success" | "warning" | "default" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
/**
|
|
10
|
+
* A `null` value makes the bar indeterminate. A progress bar has no default name, because only the caller
|
|
11
|
+
* knows what is progressing, so give it an `aria-label` or an `aria-labelledby`.
|
|
12
|
+
*/
|
|
13
|
+
export interface ProgressProps extends Omit<Progress.Root.Props, 'className' | 'children'>, VariantProps<typeof trackVariants>, VariantProps<typeof indicatorVariants> {
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
declare function Progress$1({ className, size, variant, ...props }: ProgressProps): import("react").JSX.Element;
|
|
17
|
+
export { Progress$1 as Progress };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/cn.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { Progress } from "@base-ui/react/progress";
|
|
6
|
+
// src/components/progress/progress.tsx
|
|
7
|
+
const trackVariants = cva("block w-full overflow-hidden rounded-full bg-accent-selected", {
|
|
8
|
+
variants: { size: {
|
|
9
|
+
xs: "h-1",
|
|
10
|
+
sm: "h-1.5",
|
|
11
|
+
md: "h-2"
|
|
12
|
+
} },
|
|
13
|
+
defaultVariants: { size: "sm" }
|
|
14
|
+
});
|
|
15
|
+
const indicatorVariants = cva("block h-full rounded-full transition-[width] motion-reduce:transition-none motion-safe:data-indeterminate:w-1/3 motion-safe:data-indeterminate:animate-progress-indeterminate motion-reduce:data-indeterminate:w-full motion-reduce:data-indeterminate:opacity-50", {
|
|
16
|
+
variants: { variant: {
|
|
17
|
+
default: "bg-primary-text",
|
|
18
|
+
success: "bg-success-foreground",
|
|
19
|
+
warning: "bg-warning-foreground",
|
|
20
|
+
destructive: "bg-destructive-text"
|
|
21
|
+
} },
|
|
22
|
+
defaultVariants: { variant: "default" }
|
|
23
|
+
});
|
|
24
|
+
function Progress$1({ className, size, variant, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx(Progress.Root, {
|
|
26
|
+
className: cn("block w-full", className),
|
|
27
|
+
...props,
|
|
28
|
+
"data-slot": "progress",
|
|
29
|
+
children: /* @__PURE__ */ jsx(Progress.Track, {
|
|
30
|
+
className: trackVariants({ size }),
|
|
31
|
+
children: /* @__PURE__ */ jsx(Progress.Indicator, { className: indicatorVariants({ variant }) })
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export { Progress$1 as Progress };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Radio } from "@base-ui/react/radio";
|
|
2
2
|
import { RadioGroup } from "@base-ui/react/radio-group";
|
|
3
|
-
//#region src/components/radio-group/radio-group.d.ts
|
|
4
3
|
export type RadioGroupProps = Omit<RadioGroup.Props, 'className'> & {
|
|
5
4
|
className?: string;
|
|
6
5
|
};
|
|
@@ -9,5 +8,4 @@ export type RadioGroupItemProps = Omit<Radio.Root.Props, 'className'> & {
|
|
|
9
8
|
};
|
|
10
9
|
declare function RadioGroup$1({ className, ...props }: RadioGroupProps): import("react").JSX.Element;
|
|
11
10
|
declare function RadioGroupItem({ className, ...props }: RadioGroupItemProps): import("react").JSX.Element;
|
|
12
|
-
//#endregion
|
|
13
11
|
export { RadioGroup$1 as RadioGroup, RadioGroupItem };
|
|
@@ -3,10 +3,10 @@ import { cn } from "../../lib/cn.js";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { Radio } from "@base-ui/react/radio";
|
|
5
5
|
import { RadioGroup } from "@base-ui/react/radio-group";
|
|
6
|
-
|
|
6
|
+
// src/components/radio-group/radio-group.tsx
|
|
7
7
|
function RadioGroup$1({ className, ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx(RadioGroup, {
|
|
9
|
-
className: cn("
|
|
9
|
+
className: cn("flex flex-col gap-2", className),
|
|
10
10
|
...props,
|
|
11
11
|
"data-slot": "radio-group"
|
|
12
12
|
});
|
|
@@ -14,14 +14,13 @@ function RadioGroup$1({ className, ...props }) {
|
|
|
14
14
|
function RadioGroupItem({ className, ...props }) {
|
|
15
15
|
return /* @__PURE__ */ jsx(Radio.Root, {
|
|
16
16
|
"data-base-ui-swipe-ignore": true,
|
|
17
|
-
className: cn("
|
|
17
|
+
className: cn("peer relative inline-flex size-4 shrink-0 items-center justify-center rounded-full border border-input bg-background transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/40 data-checked:border-primary data-checked:bg-primary data-disabled:cursor-not-allowed data-disabled:opacity-50 aria-invalid:border-destructive", className),
|
|
18
18
|
...props,
|
|
19
19
|
"data-slot": "radio-group-item",
|
|
20
20
|
children: /* @__PURE__ */ jsx(Radio.Indicator, {
|
|
21
|
-
className: "
|
|
21
|
+
className: "size-1.5 rounded-full bg-primary-foreground",
|
|
22
22
|
"data-slot": "radio-group-indicator"
|
|
23
23
|
})
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
//#endregion
|
|
27
26
|
export { RadioGroup$1 as RadioGroup, RadioGroupItem };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Select } from "@base-ui/react/select";
|
|
2
|
-
//#region src/components/select/select.d.ts
|
|
3
2
|
type WithClassName<P> = Omit<P, 'className'> & {
|
|
4
3
|
className?: string;
|
|
5
4
|
};
|
|
@@ -51,5 +50,4 @@ export type SelectGroupLabelProps = WithClassName<Select.GroupLabel.Props>;
|
|
|
51
50
|
declare function SelectGroupLabel({ className, ...props }: SelectGroupLabelProps): import("react").JSX.Element;
|
|
52
51
|
export type SelectSeparatorProps = WithClassName<Select.Separator.Props>;
|
|
53
52
|
declare function SelectSeparator({ className, ...props }: SelectSeparatorProps): import("react").JSX.Element;
|
|
54
|
-
//#endregion
|
|
55
53
|
export { Select$1 as Select, SelectContent, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger, SelectValue };
|