@api7/ui-components 0.4.0 → 0.5.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.
Files changed (57) hide show
  1. package/README.md +176 -30
  2. package/dist/animations.css +12 -0
  3. package/dist/components/alert/alert.js +7 -7
  4. package/dist/components/avatar/avatar.d.ts +4 -4
  5. package/dist/components/avatar/avatar.js +6 -6
  6. package/dist/components/badge/badge.js +14 -14
  7. package/dist/components/button/button.d.ts +1 -2
  8. package/dist/components/button/button.js +14 -14
  9. package/dist/components/calendar/calendar.d.ts +1 -1
  10. package/dist/components/calendar/calendar.js +28 -28
  11. package/dist/components/checkbox/checkbox.js +3 -3
  12. package/dist/components/combobox/combobox.js +24 -23
  13. package/dist/components/data-table/data-table.js +7 -7
  14. package/dist/components/data-table/filter-header.js +4 -4
  15. package/dist/components/data-table/sort-header.js +2 -2
  16. package/dist/components/date-picker/date-picker.js +14 -14
  17. package/dist/components/description-list/description-list.d.ts +26 -0
  18. package/dist/components/description-list/description-list.js +89 -0
  19. package/dist/components/dialog/dialog.js +11 -11
  20. package/dist/components/drawer/drawer.js +12 -12
  21. package/dist/components/empty/empty.js +8 -8
  22. package/dist/components/field/field.js +6 -6
  23. package/dist/components/form/date-fields.js +1 -1
  24. package/dist/components/form/form-item.js +6 -6
  25. package/dist/components/form/lazy-field-components.js +1 -1
  26. package/dist/components/form/toggle-fields.js +4 -4
  27. package/dist/components/input/input.js +1 -1
  28. package/dist/components/input-group/input-group.js +11 -11
  29. package/dist/components/menu/menu.js +13 -11
  30. package/dist/components/number-field/number-field.js +7 -7
  31. package/dist/components/pagination/pagination.js +12 -12
  32. package/dist/components/popover/popover.js +5 -4
  33. package/dist/components/progress/progress.d.ts +19 -0
  34. package/dist/components/progress/progress.js +36 -0
  35. package/dist/components/radio-group/radio-group.js +3 -3
  36. package/dist/components/select/select.js +17 -16
  37. package/dist/components/separator/separator.js +1 -1
  38. package/dist/components/sidebar/sidebar.js +9 -9
  39. package/dist/components/skeleton/skeleton.js +1 -1
  40. package/dist/components/spinner/spinner.d.ts +14 -0
  41. package/dist/components/spinner/spinner.js +28 -0
  42. package/dist/components/switch/switch.js +2 -2
  43. package/dist/components/table/table.js +7 -7
  44. package/dist/components/tabs/tabs.js +4 -4
  45. package/dist/components/textarea/textarea.js +1 -1
  46. package/dist/components/toast/toast.js +18 -18
  47. package/dist/components/tooltip/tooltip.js +4 -2
  48. package/dist/config/messages.d.ts +4 -0
  49. package/dist/config/messages.js +2 -0
  50. package/dist/index.d.ts +4 -1
  51. package/dist/index.js +4 -1
  52. package/dist/lib/cn.js +4 -4
  53. package/dist/lib/control.js +3 -3
  54. package/dist/lib/popup.js +5 -4
  55. package/dist/theme.css +220 -0
  56. package/package.json +7 -5
  57. package/dist/styles.css +0 -2
@@ -1,6 +1,6 @@
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
  //#region src/components/popover/popover.tsx
@@ -14,11 +14,12 @@ 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, "asu:w-72 asu:max-w-[calc(100vw-2rem)] asu:p-3", className),
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
  })
@@ -26,14 +27,14 @@ function PopoverContent({ className, side = "bottom", sideOffset = 4, align = "s
26
27
  }
27
28
  function PopoverTitle({ className, ...props }) {
28
29
  return /* @__PURE__ */ jsx(Popover.Title, {
29
- className: cn("asu:text-sm asu:font-medium", className),
30
+ className: cn("text-sm font-medium", className),
30
31
  ...props,
31
32
  "data-slot": "popover-title"
32
33
  });
33
34
  }
34
35
  function PopoverDescription({ className, ...props }) {
35
36
  return /* @__PURE__ */ jsx(Popover.Description, {
36
- className: cn("asu:text-sm asu:text-muted-foreground", className),
37
+ className: cn("text-sm text-muted-foreground", className),
37
38
  ...props,
38
39
  "data-slot": "popover-description"
39
40
  });
@@ -0,0 +1,19 @@
1
+ import { VariantProps } from "class-variance-authority";
2
+ import { Progress } from "@base-ui/react/progress";
3
+ //#region src/components/progress/progress.d.ts
4
+ declare const trackVariants: (props?: ({
5
+ size?: "sm" | "md" | "xs" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ declare const indicatorVariants: (props?: ({
8
+ variant?: "destructive" | "success" | "warning" | "default" | null | undefined;
9
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
10
+ /**
11
+ * A `null` value makes the bar indeterminate. A progress bar has no default name, because only the caller
12
+ * knows what is progressing, so give it an `aria-label` or an `aria-labelledby`.
13
+ */
14
+ export interface ProgressProps extends Omit<Progress.Root.Props, 'className' | 'children'>, VariantProps<typeof trackVariants>, VariantProps<typeof indicatorVariants> {
15
+ className?: string;
16
+ }
17
+ declare function Progress$1({ className, size, variant, ...props }: ProgressProps): import("react").JSX.Element;
18
+ //#endregion
19
+ export { Progress$1 as Progress };
@@ -0,0 +1,36 @@
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
+ //#region 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
+ //#endregion
36
+ export { Progress$1 as Progress };
@@ -6,7 +6,7 @@ import { RadioGroup } from "@base-ui/react/radio-group";
6
6
  //#region src/components/radio-group/radio-group.tsx
7
7
  function RadioGroup$1({ className, ...props }) {
8
8
  return /* @__PURE__ */ jsx(RadioGroup, {
9
- className: cn("asu:flex asu:flex-col asu:gap-2", className),
9
+ className: cn("flex flex-col gap-2", className),
10
10
  ...props,
11
11
  "data-slot": "radio-group"
12
12
  });
@@ -14,11 +14,11 @@ 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("asu:peer asu:relative asu:inline-flex asu:size-4 asu:shrink-0 asu:items-center asu:justify-center asu:rounded-full asu:border asu:border-input asu:bg-background asu:transition-colors asu:outline-none asu:focus-visible:ring-2 asu:focus-visible:ring-ring/40 asu:data-checked:border-primary asu:data-checked:bg-primary asu:data-disabled:cursor-not-allowed asu:data-disabled:opacity-50 asu:aria-invalid:border-destructive", className),
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: "asu:size-1.5 asu:rounded-full asu:bg-primary-foreground",
21
+ className: "size-1.5 rounded-full bg-primary-foreground",
22
22
  "data-slot": "radio-group-indicator"
23
23
  })
24
24
  });
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { useMessages } from "../../config/config-provider.js";
3
3
  import { cn } from "../../lib/cn.js";
4
- import { listItemClassName, listboxClassName } from "../../lib/popup.js";
4
+ import { listItemClassName, listboxClassName, popupLayerClassName } from "../../lib/popup.js";
5
5
  import { controlFocus, controlSurface } from "../../lib/control.js";
6
6
  import { createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -72,19 +72,19 @@ function SelectTrigger({ className, children, size = "default", ...props }) {
72
72
  const messages = useMessages();
73
73
  const showClear = clearState?.hasValue ?? false;
74
74
  return /* @__PURE__ */ jsxs("div", {
75
- className: cn("asu:relative asu:flex asu:w-full", className),
75
+ className: cn("relative flex w-full", className),
76
76
  "data-slot": "select-trigger-wrapper",
77
77
  children: [/* @__PURE__ */ jsxs(Select.Trigger, {
78
78
  ref: clearState?.triggerRef,
79
- className: cn(controlSurface, controlFocus, "asu:peer/select-trigger asu:flex asu:w-full asu:items-center asu:justify-between", size === "sm" ? "asu:h-6 asu:gap-1 asu:px-2" : "asu:h-8 asu:gap-2 asu:px-3"),
79
+ className: cn(controlSurface, controlFocus, "peer/select-trigger flex w-full items-center justify-between", size === "sm" ? "h-6 gap-1 px-2" : "h-8 gap-2 px-3"),
80
80
  ...props,
81
81
  "data-slot": "select-trigger",
82
82
  children: [children, /* @__PURE__ */ jsxs("span", {
83
- className: "asu:flex asu:shrink-0 asu:items-center asu:gap-2",
83
+ className: "flex shrink-0 items-center gap-2",
84
84
  children: [showClear && /* @__PURE__ */ jsx("span", {
85
85
  "aria-hidden": true,
86
- className: "asu:size-3"
87
- }), /* @__PURE__ */ jsx(Select.Icon, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn("asu:shrink-0 asu:text-foreground", size === "sm" ? "asu:size-3.5" : "asu:size-5") }) })]
86
+ className: "size-3"
87
+ }), /* @__PURE__ */ jsx(Select.Icon, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn("shrink-0 text-foreground", size === "sm" ? "size-3.5" : "size-5") }) })]
88
88
  })]
89
89
  }), showClear && clearState && /* @__PURE__ */ jsx("button", {
90
90
  type: "button",
@@ -93,31 +93,32 @@ function SelectTrigger({ className, children, size = "default", ...props }) {
93
93
  event.stopPropagation();
94
94
  clearState.onClear();
95
95
  },
96
- className: cn("asu:absolute asu:top-1/2 asu:-translate-y-1/2 asu:rounded-sm asu:text-muted-foreground asu:outline-none asu:hover:text-foreground", size === "sm" ? "asu:right-6" : "asu:right-8", "asu:peer-data-disabled/select-trigger:hidden", "asu:focus-visible:border-ring asu:focus-visible:ring-2 asu:focus-visible:ring-ring/40 asu:aria-invalid:focus-visible:ring-destructive/40 asu:data-invalid:focus-visible:ring-destructive/40"),
96
+ className: cn("absolute top-1/2 -translate-y-1/2 rounded-sm text-muted-foreground outline-none hover:text-foreground", size === "sm" ? "right-6" : "right-8", "peer-data-disabled/select-trigger:hidden", "focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/40 aria-invalid:focus-visible:ring-destructive/40 data-invalid:focus-visible:ring-destructive/40"),
97
97
  "data-slot": "select-clear",
98
- children: /* @__PURE__ */ jsx(XIcon, { className: "asu:size-3" })
98
+ children: /* @__PURE__ */ jsx(XIcon, { className: "size-3" })
99
99
  })]
100
100
  });
101
101
  }
102
102
  function SelectValue({ className, ...props }) {
103
103
  return /* @__PURE__ */ jsx(Select.Value, {
104
- className: cn("asu:min-w-0 asu:truncate asu:text-left asu:data-placeholder:text-muted-foreground", className),
104
+ className: cn("min-w-0 truncate text-left data-placeholder:text-muted-foreground", className),
105
105
  ...props,
106
106
  "data-slot": "select-value"
107
107
  });
108
108
  }
109
109
  function SelectContent({ className, side = "bottom", sideOffset = 4, align = "start", alignItemWithTrigger = false, children, ...props }) {
110
110
  return /* @__PURE__ */ jsx(Select.Portal, { children: /* @__PURE__ */ jsx(Select.Positioner, {
111
+ className: popupLayerClassName,
111
112
  side,
112
113
  sideOffset,
113
114
  align,
114
115
  alignItemWithTrigger,
115
116
  children: /* @__PURE__ */ jsx(Select.Popup, {
116
- className: "asu:outline-none",
117
+ className: "outline-none",
117
118
  ...props,
118
119
  "data-slot": "select-popup",
119
120
  children: /* @__PURE__ */ jsx(Select.List, {
120
- className: cn(listboxClassName, "asu:min-w-(--anchor-width)", className),
121
+ className: cn(listboxClassName, "min-w-(--anchor-width)", className),
121
122
  "data-slot": "select-content",
122
123
  children
123
124
  })
@@ -130,11 +131,11 @@ function SelectItem({ className, children, ...props }) {
130
131
  ...props,
131
132
  "data-slot": "select-item",
132
133
  children: [/* @__PURE__ */ jsx(Select.ItemText, {
133
- className: "asu:min-w-0 asu:flex-1 asu:truncate",
134
+ className: "min-w-0 flex-1 truncate",
134
135
  children
135
136
  }), /* @__PURE__ */ jsx(Select.ItemIndicator, {
136
- className: "asu:flex asu:size-4 asu:shrink-0 asu:items-center asu:justify-center",
137
- children: /* @__PURE__ */ jsx(CheckIcon, { className: "asu:size-4" })
137
+ className: "flex size-4 shrink-0 items-center justify-center",
138
+ children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" })
138
139
  })]
139
140
  });
140
141
  }
@@ -147,14 +148,14 @@ function SelectGroup({ className, ...props }) {
147
148
  }
148
149
  function SelectGroupLabel({ className, ...props }) {
149
150
  return /* @__PURE__ */ jsx(Select.GroupLabel, {
150
- className: cn("asu:px-4 asu:py-2 asu:text-xs asu:font-medium asu:text-muted-foreground", className),
151
+ className: cn("px-4 py-2 text-xs font-medium text-muted-foreground", className),
151
152
  ...props,
152
153
  "data-slot": "select-group-label"
153
154
  });
154
155
  }
155
156
  function SelectSeparator({ className, ...props }) {
156
157
  return /* @__PURE__ */ jsx(Select.Separator, {
157
- className: cn("asu:my-1 asu:h-px asu:bg-border", className),
158
+ className: cn("my-1 h-px bg-border", className),
158
159
  ...props,
159
160
  "data-slot": "select-separator"
160
161
  });
@@ -6,7 +6,7 @@ import { Separator } from "@base-ui/react/separator";
6
6
  function Separator$1({ className, orientation = "horizontal", ...props }) {
7
7
  return /* @__PURE__ */ jsx(Separator, {
8
8
  orientation,
9
- className: cn("asu:shrink-0 asu:bg-border asu:data-[orientation=horizontal]:h-px asu:data-[orientation=horizontal]:w-full asu:data-[orientation=vertical]:w-px asu:data-[orientation=vertical]:self-stretch", className),
9
+ className: cn("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch", className),
10
10
  ...props,
11
11
  "data-slot": "separator"
12
12
  });
@@ -7,7 +7,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  //#region src/components/sidebar/sidebar.tsx
8
8
  function Sidebar({ className, ...props }) {
9
9
  return /* @__PURE__ */ jsx("nav", {
10
- className: cn("asu:w-[226px] asu:bg-background asu:p-2 asu:pt-5", className),
10
+ className: cn("w-[226px] bg-background p-2 pt-5", className),
11
11
  ...props,
12
12
  "data-slot": "sidebar"
13
13
  });
@@ -15,13 +15,13 @@ function Sidebar({ className, ...props }) {
15
15
  function SidebarGroup({ label, separator = false, className, children, ...props }) {
16
16
  return /* @__PURE__ */ jsxs(Fragment, { children: [separator && /* @__PURE__ */ jsx("div", {
17
17
  "data-slot": "sidebar-group-separator",
18
- children: /* @__PURE__ */ jsx(Separator, { className: "asu:my-2" })
18
+ children: /* @__PURE__ */ jsx(Separator, { className: "my-2" })
19
19
  }), /* @__PURE__ */ jsxs("div", {
20
- className: cn("asu:mb-2", className),
20
+ className: cn("mb-2", className),
21
21
  ...props,
22
22
  "data-slot": "sidebar-group",
23
23
  children: [label && /* @__PURE__ */ jsx("div", {
24
- className: "asu:px-2 asu:py-2 asu:pl-4 asu:text-xs asu:text-muted-foreground",
24
+ className: "px-2 py-2 pl-4 text-xs text-muted-foreground",
25
25
  "data-slot": "sidebar-group-label",
26
26
  children: label
27
27
  }), children]
@@ -32,17 +32,17 @@ function SidebarItem({ render, className, active = false, disabled = false, disa
32
32
  const content = /* @__PURE__ */ jsxs(Fragment, { children: [
33
33
  icon && /* @__PURE__ */ jsx("span", {
34
34
  "aria-hidden": "true",
35
- className: "asu:size-5 asu:shrink-0 asu:[&>svg]:size-5",
35
+ className: "size-5 shrink-0 [&>svg]:size-5",
36
36
  "data-slot": "sidebar-item-icon",
37
37
  children: icon
38
38
  }),
39
39
  /* @__PURE__ */ jsx("span", {
40
- className: "asu:truncate",
40
+ className: "truncate",
41
41
  children
42
42
  }),
43
43
  active && /* @__PURE__ */ jsx("span", {
44
44
  "aria-hidden": "true",
45
- className: "asu:absolute asu:inset-y-0 asu:left-0 asu:w-1 asu:bg-sidebar-indicator",
45
+ className: "absolute inset-y-0 left-0 w-1 bg-sidebar-indicator",
46
46
  "data-slot": "sidebar-item-indicator"
47
47
  })
48
48
  ] });
@@ -68,12 +68,12 @@ function SidebarItem({ render, className, active = false, disabled = false, disa
68
68
  baseProps.onClick?.(event);
69
69
  onClick?.(event);
70
70
  },
71
- className: cn("asu:relative asu:mb-1 asu:flex asu:items-center asu:gap-3 asu:overflow-hidden asu:rounded-md asu:px-3 asu:py-2.5 asu:text-sm asu:leading-5 asu:text-foreground asu:whitespace-nowrap", "asu:hover:bg-sidebar-accent", active && "asu:bg-sidebar-accent asu:font-medium", disabled && "asu:opacity-50 asu:cursor-not-allowed", baseProps.className, className),
71
+ className: cn("relative mb-1 flex items-center gap-3 overflow-hidden rounded-md px-3 py-2.5 text-sm leading-5 text-foreground whitespace-nowrap", "hover:bg-sidebar-accent", active && "bg-sidebar-accent font-medium", disabled && "opacity-50 cursor-not-allowed", baseProps.className, className),
72
72
  "data-slot": "sidebar-item"
73
73
  }, content);
74
74
  if (showReason) return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: element }), /* @__PURE__ */ jsx(TooltipContent, { children: disabledReason })] }), /* @__PURE__ */ jsx("span", {
75
75
  id: reasonId,
76
- className: "asu:sr-only",
76
+ className: "sr-only",
77
77
  "data-slot": "sidebar-item-reason",
78
78
  children: disabledReason
79
79
  })] });
@@ -3,7 +3,7 @@ import { jsx } from "react/jsx-runtime";
3
3
  //#region src/components/skeleton/skeleton.tsx
4
4
  function Skeleton({ className, ...props }) {
5
5
  return /* @__PURE__ */ jsx("div", {
6
- className: cn("asu:animate-pulse asu:rounded-md asu:bg-accent-selected asu:motion-reduce:animate-none", className),
6
+ className: cn("animate-pulse rounded-md bg-accent-selected motion-reduce:animate-none", className),
7
7
  ...props,
8
8
  "data-slot": "skeleton"
9
9
  });
@@ -0,0 +1,14 @@
1
+ import { ComponentProps } from "react";
2
+ import { VariantProps } from "class-variance-authority";
3
+ //#region src/components/spinner/spinner.d.ts
4
+ declare const spinnerVariants: (props?: ({
5
+ size?: "sm" | "md" | "lg" | "xs" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ /**
8
+ * The spinner is an SVG that takes its colour from the text colour, so set it with a `text-*` class. An
9
+ * `aria-label` overrides the localized default announcement.
10
+ */
11
+ export type SpinnerProps = Omit<ComponentProps<'svg'>, 'ref'> & VariantProps<typeof spinnerVariants>;
12
+ declare function Spinner({ className, size, ...props }: SpinnerProps): import("react").JSX.Element;
13
+ //#endregion
14
+ export { Spinner, spinnerVariants };
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { useMessages } from "../../config/config-provider.js";
3
+ import { cn } from "../../lib/cn.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { cva } from "class-variance-authority";
6
+ import { LoaderCircle } from "lucide-react";
7
+ //#region src/components/spinner/spinner.tsx
8
+ const spinnerVariants = cva("shrink-0 animate-spin motion-reduce:animate-none", {
9
+ variants: { size: {
10
+ xs: "size-3",
11
+ sm: "size-4",
12
+ md: "size-6",
13
+ lg: "size-8"
14
+ } },
15
+ defaultVariants: { size: "md" }
16
+ });
17
+ function Spinner({ className, size, ...props }) {
18
+ const messages = useMessages();
19
+ return /* @__PURE__ */ jsx(LoaderCircle, {
20
+ role: "status",
21
+ "aria-label": messages.spinner.label,
22
+ className: cn(spinnerVariants({ size }), className),
23
+ ...props,
24
+ "data-slot": "spinner"
25
+ });
26
+ }
27
+ //#endregion
28
+ export { Spinner, spinnerVariants };
@@ -7,11 +7,11 @@ function Switch$1({ className, size = "md", ...props }) {
7
7
  return /* @__PURE__ */ jsx(Switch.Root, {
8
8
  "data-size": size,
9
9
  "data-base-ui-swipe-ignore": true,
10
- className: cn("asu:group/switch asu:peer asu:relative asu:inline-flex asu:shrink-0 asu:items-center asu:rounded-full asu:p-0.5 asu:transition-colors asu:outline-none asu:focus-visible:ring-2 asu:focus-visible:ring-ring/40 asu:data-checked:bg-primary asu:data-unchecked:bg-input asu:data-disabled:cursor-not-allowed asu:data-disabled:opacity-50 asu:data-[size=md]:h-5 asu:data-[size=md]:w-9 asu:data-[size=sm]:h-4 asu:data-[size=sm]:w-7", className),
10
+ className: cn("group/switch peer relative inline-flex shrink-0 items-center rounded-full p-0.5 transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/40 data-checked:bg-primary data-unchecked:bg-input data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[size=md]:h-5 data-[size=md]:w-9 data-[size=sm]:h-4 data-[size=sm]:w-7", className),
11
11
  ...props,
12
12
  "data-slot": "switch",
13
13
  children: /* @__PURE__ */ jsx(Switch.Thumb, {
14
- className: "asu:pointer-events-none asu:block asu:rounded-full asu:bg-background asu:shadow-sm asu:transition-transform asu:group-data-[size=md]/switch:size-4 asu:group-data-[size=sm]/switch:size-3 asu:data-unchecked:translate-x-0 asu:group-data-[size=md]/switch:data-checked:translate-x-4 asu:group-data-[size=sm]/switch:data-checked:translate-x-3",
14
+ className: "pointer-events-none block rounded-full bg-background shadow-sm transition-transform group-data-[size=md]/switch:size-4 group-data-[size=sm]/switch:size-3 data-unchecked:translate-x-0 group-data-[size=md]/switch:data-checked:translate-x-4 group-data-[size=sm]/switch:data-checked:translate-x-3",
15
15
  "data-slot": "switch-thumb"
16
16
  })
17
17
  });
@@ -4,9 +4,9 @@ import { jsx } from "react/jsx-runtime";
4
4
  function Table({ className, containerClassName, ...props }) {
5
5
  return /* @__PURE__ */ jsx("div", {
6
6
  "data-slot": "table-container",
7
- className: cn("asu:relative asu:w-full asu:overflow-x-auto", containerClassName),
7
+ className: cn("relative w-full overflow-x-auto", containerClassName),
8
8
  children: /* @__PURE__ */ jsx("table", {
9
- className: cn("asu:w-full asu:caption-bottom asu:border-collapse asu:text-sm", className),
9
+ className: cn("w-full caption-bottom border-collapse text-sm", className),
10
10
  ...props,
11
11
  "data-slot": "table"
12
12
  })
@@ -21,21 +21,21 @@ function TableHeader({ className, ...props }) {
21
21
  }
22
22
  function TableBody({ className, ...props }) {
23
23
  return /* @__PURE__ */ jsx("tbody", {
24
- className: cn("asu:[&_tr:hover]:bg-muted/50", className),
24
+ className: cn("[&_tr:hover]:bg-muted/50", className),
25
25
  ...props,
26
26
  "data-slot": "table-body"
27
27
  });
28
28
  }
29
29
  function TableRow({ className, ...props }) {
30
30
  return /* @__PURE__ */ jsx("tr", {
31
- className: cn("asu:group/row asu:border-b asu:border-border", className),
31
+ className: cn("group/row border-b border-border", className),
32
32
  ...props,
33
33
  "data-slot": "table-row"
34
34
  });
35
35
  }
36
36
  function TableHead({ className, ...props }) {
37
37
  return /* @__PURE__ */ jsx("th", {
38
- className: cn("asu:h-10 asu:px-4 asu:py-2 asu:text-left asu:align-middle asu:text-xs asu:font-medium asu:text-muted-foreground asu:bg-table-header", className),
38
+ className: cn("h-10 px-4 py-2 text-left align-middle text-xs font-medium text-muted-foreground bg-table-header", className),
39
39
  scope: "col",
40
40
  ...props,
41
41
  "data-slot": "table-head"
@@ -43,14 +43,14 @@ function TableHead({ className, ...props }) {
43
43
  }
44
44
  function TableCell({ className, ...props }) {
45
45
  return /* @__PURE__ */ jsx("td", {
46
- className: cn("asu:p-4 asu:align-middle asu:text-sm asu:leading-[1.75] asu:text-foreground", className),
46
+ className: cn("p-4 align-middle text-sm leading-[1.75] text-foreground", className),
47
47
  ...props,
48
48
  "data-slot": "table-cell"
49
49
  });
50
50
  }
51
51
  function TableCaption({ className, ...props }) {
52
52
  return /* @__PURE__ */ jsx("caption", {
53
- className: cn("asu:mt-4 asu:text-sm asu:text-muted-foreground", className),
53
+ className: cn("mt-4 text-sm text-muted-foreground", className),
54
54
  ...props,
55
55
  "data-slot": "table-caption"
56
56
  });
@@ -5,14 +5,14 @@ import { Tabs } from "@base-ui/react/tabs";
5
5
  //#region src/components/tabs/tabs.tsx
6
6
  function Tabs$1({ className, ...props }) {
7
7
  return /* @__PURE__ */ jsx(Tabs.Root, {
8
- className: cn("asu:flex asu:flex-col asu:data-[orientation=vertical]:flex-row", className),
8
+ className: cn("flex flex-col data-[orientation=vertical]:flex-row", className),
9
9
  ...props,
10
10
  "data-slot": "tabs"
11
11
  });
12
12
  }
13
13
  function TabsList({ className, children, ...props }) {
14
14
  return /* @__PURE__ */ jsx(Tabs.List, {
15
- className: cn("asu:relative asu:flex asu:gap-8 asu:overflow-x-auto asu:shadow-[inset_0_-1px_0_0_var(--asu-border)] asu:data-[orientation=vertical]:flex-col asu:data-[orientation=vertical]:overflow-x-visible asu:data-[orientation=vertical]:shadow-[inset_-1px_0_0_0_var(--asu-border)]", className),
15
+ className: cn("relative flex gap-8 overflow-x-auto shadow-[inset_0_-1px_0_0_var(--color-border)] data-[orientation=vertical]:flex-col data-[orientation=vertical]:overflow-x-visible data-[orientation=vertical]:shadow-[inset_-1px_0_0_0_var(--color-border)]", className),
16
16
  ...props,
17
17
  "data-slot": "tabs-list",
18
18
  children
@@ -20,14 +20,14 @@ function TabsList({ className, children, ...props }) {
20
20
  }
21
21
  function TabsTrigger({ className, ...props }) {
22
22
  return /* @__PURE__ */ jsx(Tabs.Tab, {
23
- className: cn("asu:relative asu:h-10 asu:shrink-0 asu:rounded-sm asu:px-0 asu:text-sm asu:font-medium asu:whitespace-nowrap asu:text-muted-foreground asu:outline-none asu:focus-visible:ring-2 asu:focus-visible:ring-ring/40 asu:data-active:text-primary-text asu:data-disabled:opacity-50", "asu:after:pointer-events-none asu:after:absolute asu:after:inset-x-[-10px] asu:after:bottom-0 asu:after:hidden asu:after:h-0.5 asu:after:bg-primary asu:after:content-[\"\"] asu:data-active:after:block asu:data-[orientation=vertical]:after:inset-x-auto asu:data-[orientation=vertical]:after:inset-y-[-10px] asu:data-[orientation=vertical]:after:right-[-1px] asu:data-[orientation=vertical]:after:bottom-auto asu:data-[orientation=vertical]:after:h-auto asu:data-[orientation=vertical]:after:w-0.5", className),
23
+ className: cn("relative h-10 shrink-0 rounded-sm px-0 text-sm font-medium whitespace-nowrap text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/40 data-active:text-primary-text data-disabled:opacity-50", "after:pointer-events-none after:absolute after:inset-x-[-10px] after:bottom-0 after:hidden after:h-0.5 after:bg-primary after:content-[\"\"] data-active:after:block data-[orientation=vertical]:after:inset-x-auto data-[orientation=vertical]:after:inset-y-[-10px] data-[orientation=vertical]:after:right-[-1px] data-[orientation=vertical]:after:bottom-auto data-[orientation=vertical]:after:h-auto data-[orientation=vertical]:after:w-0.5", className),
24
24
  ...props,
25
25
  "data-slot": "tabs-trigger"
26
26
  });
27
27
  }
28
28
  function TabsContent({ className, ...props }) {
29
29
  return /* @__PURE__ */ jsx(Tabs.Panel, {
30
- className: cn("asu:pt-4 asu:outline-none asu:data-[orientation=vertical]:pt-0 asu:data-[orientation=vertical]:pl-4", className),
30
+ className: cn("pt-4 outline-none data-[orientation=vertical]:pt-0 data-[orientation=vertical]:pl-4", className),
31
31
  ...props,
32
32
  "data-slot": "tabs-content"
33
33
  });
@@ -18,7 +18,7 @@ function Textarea({ className, id, name, disabled, autoFocus, value, defaultValu
18
18
  ...rest,
19
19
  "data-slot": "textarea"
20
20
  }),
21
- className: cn(controlSurface, controlFocus, "asu:min-h-16 asu:px-3 asu:py-2 asu:field-sizing-content", className)
21
+ className: cn(controlSurface, controlFocus, "min-h-16 px-3 py-2 field-sizing-content", className)
22
22
  });
23
23
  }
24
24
  //#endregion
@@ -22,18 +22,18 @@ const TOAST_ICON = {
22
22
  loading: LoaderCircle
23
23
  };
24
24
  const TOAST_ICON_CLASSNAME = {
25
- success: "asu:text-success",
26
- info: "asu:text-info",
27
- warning: "asu:text-warning",
28
- error: "asu:text-destructive-text",
29
- loading: "asu:text-info"
25
+ success: "text-success",
26
+ info: "text-info",
27
+ warning: "text-warning",
28
+ error: "text-destructive-text",
29
+ loading: "text-info"
30
30
  };
31
31
  const TOAST_BACKGROUND_CLASSNAME = {
32
- success: "asu:bg-success-subtle",
33
- info: "asu:bg-info-subtle",
34
- warning: "asu:bg-warning-subtle",
35
- error: "asu:bg-destructive-subtle",
36
- loading: "asu:bg-info-subtle"
32
+ success: "bg-success-subtle",
33
+ info: "bg-info-subtle",
34
+ warning: "bg-warning-subtle",
35
+ error: "bg-destructive-subtle",
36
+ loading: "bg-info-subtle"
37
37
  };
38
38
  const toastManager = Toast.createToastManager();
39
39
  function isToastPromiseMessage(value) {
@@ -88,24 +88,24 @@ function ToastItem({ toast: toastObject }) {
88
88
  const Icon = TOAST_ICON[type];
89
89
  return /* @__PURE__ */ jsxs(Toast.Root, {
90
90
  toast: toastObject,
91
- className: cn("asu:relative asu:flex asu:gap-2 asu:rounded-md asu:p-2 asu:pr-8 asu:text-sm asu:text-foreground asu:shadow-lg asu:dark:ring-1 asu:dark:ring-border asu:data-limited:hidden", TOAST_BACKGROUND_CLASSNAME[type]),
91
+ className: cn("relative flex gap-2 rounded-md p-2 pr-8 text-sm text-foreground shadow-lg dark:ring-1 dark:ring-border data-limited:hidden", TOAST_BACKGROUND_CLASSNAME[type]),
92
92
  "data-slot": "toast",
93
93
  children: [/* @__PURE__ */ jsxs(Toast.Content, {
94
- className: "asu:flex asu:flex-1 asu:gap-2",
94
+ className: "flex flex-1 gap-2",
95
95
  children: [/* @__PURE__ */ jsx(Icon, {
96
96
  "aria-hidden": "true",
97
- className: cn("asu:size-4 asu:shrink-0", TOAST_ICON_CLASSNAME[type], type === "loading" && "asu:animate-spin")
97
+ className: cn("size-4 shrink-0", TOAST_ICON_CLASSNAME[type], type === "loading" && "animate-spin")
98
98
  }), /* @__PURE__ */ jsxs("div", {
99
- className: "asu:flex asu:flex-1 asu:flex-col asu:gap-0.5",
99
+ className: "flex flex-1 flex-col gap-0.5",
100
100
  children: [
101
- /* @__PURE__ */ jsx(Toast.Title, { className: "asu:font-medium" }),
101
+ /* @__PURE__ */ jsx(Toast.Title, { className: "font-medium" }),
102
102
  /* @__PURE__ */ jsx(Toast.Description, {}),
103
103
  toastObject.actionProps && /* @__PURE__ */ jsx(Toast.Action, {
104
104
  ...toastObject.actionProps,
105
105
  className: cn(buttonVariants({
106
106
  variant: "outline",
107
107
  size: "sm"
108
- }), "asu:mt-1 asu:self-start", toastObject.actionProps.className)
108
+ }), "mt-1 self-start", toastObject.actionProps.className)
109
109
  })
110
110
  ]
111
111
  })]
@@ -114,7 +114,7 @@ function ToastItem({ toast: toastObject }) {
114
114
  className: cn(buttonVariants({
115
115
  variant: "ghost",
116
116
  size: "icon"
117
- }), "asu:absolute asu:top-1 asu:right-1 asu:size-6"),
117
+ }), "absolute top-1 right-1 size-6"),
118
118
  children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true" })
119
119
  })]
120
120
  });
@@ -155,7 +155,7 @@ function Toaster({ limit = 3 }) {
155
155
  toastManager,
156
156
  limit,
157
157
  children: /* @__PURE__ */ jsx(Toast.Portal, { children: /* @__PURE__ */ jsx(Toast.Viewport, {
158
- className: "asu:fixed asu:top-4 asu:right-4 asu:z-[1010] asu:flex asu:w-90 asu:max-w-[calc(100vw-2rem)] asu:flex-col asu:gap-2",
158
+ className: "fixed top-4 right-4 z-[1010] flex w-90 max-w-[calc(100vw-2rem)] flex-col gap-2",
159
159
  "data-slot": "toaster",
160
160
  children: /* @__PURE__ */ jsx(ToastList, {})
161
161
  }) })
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { cn } from "../../lib/cn.js";
3
+ import { popupLayerClassName } from "../../lib/popup.js";
3
4
  import { createContext, useContext } from "react";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  import { Tooltip } from "@base-ui/react/tooltip";
@@ -29,15 +30,16 @@ function TooltipTrigger({ className, delay, ...props }) {
29
30
  }
30
31
  function TooltipContent({ className, side = "top", sideOffset = 6, align, children, ...props }) {
31
32
  return /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
33
+ className: popupLayerClassName,
32
34
  side,
33
35
  sideOffset,
34
36
  align,
35
37
  children: /* @__PURE__ */ jsxs(Tooltip.Popup, {
36
- className: cn("asu:rounded-sm asu:bg-tooltip asu:px-2 asu:py-1 asu:text-sm asu:leading-5 asu:text-tooltip-foreground asu:max-w-xs", className),
38
+ className: cn("rounded-sm bg-tooltip px-2 py-1 text-sm leading-5 text-tooltip-foreground max-w-xs", className),
37
39
  ...props,
38
40
  "data-slot": "tooltip-content",
39
41
  children: [children, /* @__PURE__ */ jsx(Tooltip.Arrow, {
40
- className: "asu:size-2.5 asu:rotate-45 asu:bg-tooltip asu:data-[side=bottom]:-top-1 asu:data-[side=left]:-right-1 asu:data-[side=right]:-left-1 asu:data-[side=top]:-bottom-1",
42
+ className: "size-2.5 rotate-45 bg-tooltip data-[side=bottom]:-top-1 data-[side=left]:-right-1 data-[side=right]:-left-1 data-[side=top]:-bottom-1",
41
43
  "data-slot": "tooltip-arrow"
42
44
  })]
43
45
  })
@@ -4,6 +4,10 @@ export interface Messages {
4
4
  readonly button: {
5
5
  readonly loading: string;
6
6
  };
7
+ /** Accessible name of a Spinner, announced as a status. */
8
+ readonly spinner: {
9
+ readonly label: string;
10
+ };
7
11
  readonly numberField: {
8
12
  readonly increment: string;
9
13
  readonly decrement: string;
@@ -5,6 +5,7 @@ function deepFreeze(value) {
5
5
  }
6
6
  const enUS = deepFreeze({
7
7
  button: { loading: "Loading" },
8
+ spinner: { label: "Loading" },
8
9
  numberField: {
9
10
  increment: "Increase",
10
11
  decrement: "Decrease"
@@ -50,6 +51,7 @@ const enUS = deepFreeze({
50
51
  });
51
52
  const zhCN = deepFreeze({
52
53
  button: { loading: "加载中" },
54
+ spinner: { label: "加载中" },
53
55
  numberField: {
54
56
  increment: "增加",
55
57
  decrement: "减少"