ajo-ui-playa 0.1.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 (136) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +90 -0
  3. package/dist/accordion.js +41 -0
  4. package/dist/alert-dialog.js +88 -0
  5. package/dist/alert.js +49 -0
  6. package/dist/aspect-ratio.js +21 -0
  7. package/dist/attachment.js +126 -0
  8. package/dist/avatar.js +54 -0
  9. package/dist/breadcrumb.js +73 -0
  10. package/dist/bubble.js +91 -0
  11. package/dist/button-group.js +58 -0
  12. package/dist/button.js +72 -0
  13. package/dist/calendar.js +109 -0
  14. package/dist/card.js +98 -0
  15. package/dist/carousel.js +86 -0
  16. package/dist/chart.js +125 -0
  17. package/dist/checkbox-group.js +30 -0
  18. package/dist/checkbox.js +25 -0
  19. package/dist/chip.js +61 -0
  20. package/dist/chunks/modal-rE60kyB-.js +14 -0
  21. package/dist/chunks/recipes-CXxPSYdV.js +78 -0
  22. package/dist/chunks/scroll-area-BN7ME1Uj.js +14 -0
  23. package/dist/collapsible.js +35 -0
  24. package/dist/command.js +67 -0
  25. package/dist/context-menu.js +65 -0
  26. package/dist/data-table.js +16 -0
  27. package/dist/dialog.js +55 -0
  28. package/dist/direction.js +13 -0
  29. package/dist/drawer.js +61 -0
  30. package/dist/empty.js +64 -0
  31. package/dist/field.js +123 -0
  32. package/dist/index.js +306 -0
  33. package/dist/input-date.js +176 -0
  34. package/dist/input-group.js +70 -0
  35. package/dist/input-otp.js +50 -0
  36. package/dist/input.js +18 -0
  37. package/dist/item.js +126 -0
  38. package/dist/kbd.js +22 -0
  39. package/dist/label.js +14 -0
  40. package/dist/marker.js +68 -0
  41. package/dist/menu.js +66 -0
  42. package/dist/menubar.js +77 -0
  43. package/dist/message-scroller.js +76 -0
  44. package/dist/message.js +59 -0
  45. package/dist/navigation-menu.js +49 -0
  46. package/dist/pagination.js +93 -0
  47. package/dist/popover.js +20 -0
  48. package/dist/progress.js +16 -0
  49. package/dist/radio-group.js +26 -0
  50. package/dist/resizable.js +41 -0
  51. package/dist/scroll-area.js +19 -0
  52. package/dist/select.js +133 -0
  53. package/dist/separator.js +17 -0
  54. package/dist/sidebar.js +161 -0
  55. package/dist/skeleton.js +15 -0
  56. package/dist/slider.js +39 -0
  57. package/dist/spinner.js +28 -0
  58. package/dist/switch.js +26 -0
  59. package/dist/table.js +70 -0
  60. package/dist/tabs.js +61 -0
  61. package/dist/textarea.js +18 -0
  62. package/dist/toast.js +219 -0
  63. package/dist/toggle-group.js +62 -0
  64. package/dist/toggle.js +30 -0
  65. package/dist/toolbar.js +19 -0
  66. package/dist/tooltip.js +27 -0
  67. package/dist/typography.js +168 -0
  68. package/dist/virtual-list.js +17 -0
  69. package/package.json +379 -0
  70. package/src/accordion.tsx +87 -0
  71. package/src/alert-dialog.tsx +174 -0
  72. package/src/alert.tsx +121 -0
  73. package/src/aspect-ratio.tsx +39 -0
  74. package/src/attachment.tsx +255 -0
  75. package/src/avatar.tsx +131 -0
  76. package/src/breadcrumb.tsx +162 -0
  77. package/src/bubble.tsx +204 -0
  78. package/src/button-group.tsx +140 -0
  79. package/src/button.tsx +164 -0
  80. package/src/calendar.tsx +193 -0
  81. package/src/card.tsx +198 -0
  82. package/src/carousel.tsx +193 -0
  83. package/src/chart.tsx +269 -0
  84. package/src/checkbox-group.tsx +72 -0
  85. package/src/checkbox.tsx +42 -0
  86. package/src/chip.tsx +138 -0
  87. package/src/collapsible.tsx +76 -0
  88. package/src/command.tsx +137 -0
  89. package/src/context-menu.tsx +124 -0
  90. package/src/data-table.tsx +35 -0
  91. package/src/dialog.tsx +115 -0
  92. package/src/direction.tsx +29 -0
  93. package/src/drawer.tsx +104 -0
  94. package/src/empty.tsx +111 -0
  95. package/src/field.tsx +304 -0
  96. package/src/index.ts +1 -0
  97. package/src/input-date.tsx +294 -0
  98. package/src/input-group.tsx +189 -0
  99. package/src/input-otp.tsx +106 -0
  100. package/src/input.tsx +29 -0
  101. package/src/internal/recipes.tsx +131 -0
  102. package/src/internal/scroll-area.tsx +19 -0
  103. package/src/item.tsx +218 -0
  104. package/src/kbd.tsx +24 -0
  105. package/src/label.tsx +28 -0
  106. package/src/marker.tsx +120 -0
  107. package/src/menu.tsx +136 -0
  108. package/src/menubar.tsx +138 -0
  109. package/src/message-scroller.tsx +168 -0
  110. package/src/message.tsx +111 -0
  111. package/src/modal.tsx +17 -0
  112. package/src/navigation-menu.tsx +93 -0
  113. package/src/pagination.tsx +196 -0
  114. package/src/popover.tsx +30 -0
  115. package/src/progress.tsx +39 -0
  116. package/src/radio-group.tsx +62 -0
  117. package/src/resizable.tsx +111 -0
  118. package/src/scroll-area.tsx +32 -0
  119. package/src/select.tsx +225 -0
  120. package/src/separator.tsx +34 -0
  121. package/src/sidebar.tsx +405 -0
  122. package/src/skeleton.tsx +28 -0
  123. package/src/slider.tsx +59 -0
  124. package/src/spinner.tsx +41 -0
  125. package/src/styles.ts +434 -0
  126. package/src/switch.tsx +45 -0
  127. package/src/table.tsx +149 -0
  128. package/src/tabs.tsx +176 -0
  129. package/src/textarea.tsx +30 -0
  130. package/src/toast.tsx +416 -0
  131. package/src/toggle-group.tsx +128 -0
  132. package/src/toggle.tsx +62 -0
  133. package/src/toolbar.tsx +26 -0
  134. package/src/tooltip.tsx +51 -0
  135. package/src/typography.tsx +231 -0
  136. package/src/virtual-list.tsx +40 -0
@@ -0,0 +1,58 @@
1
+ // @unocss-include
2
+ import clsx from "clsx";
3
+ import { jsx } from "ajo/jsx-runtime";
4
+ //#region packages/ajo-ui-playa/src/button-group.tsx
5
+ var groupBase = "flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*=w-])]:w-fit [&>input]:flex-1";
6
+ var groupOrientations = {
7
+ horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:last-child)]:rounded-r-none [&>*:not(:first-child)]:[--un-inset-ring-shadow:inset_0_1px_0_var(--un-inset-ring-color,currentColor),inset_0_-1px_0_var(--un-inset-ring-color,currentColor),inset_-1px_0_0_var(--un-inset-ring-color,currentColor)]",
8
+ vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:last-child)]:rounded-b-none [&>*:not(:first-child)]:[--un-inset-ring-shadow:inset_1px_0_0_var(--un-inset-ring-color,currentColor),inset_-1px_0_0_var(--un-inset-ring-color,currentColor),inset_0_-1px_0_var(--un-inset-ring-color,currentColor)]"
9
+ };
10
+ var textBase = "flex items-center gap-2 rounded-md edge bg-muted px-4 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4";
11
+ var separatorBase = "relative m-0 self-stretch bg-input data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-auto data-[orientation=vertical]:h-auto data-[orientation=vertical]:w-px";
12
+ /** Returns the UnoCSS class list for a ButtonGroup root. */
13
+ var buttonGroupVariants = ({ class: classes, orientation = "horizontal" } = {}) => clsx(groupBase, groupOrientations[orientation], classes);
14
+ /** Group related action buttons or mixed controls. */
15
+ var ButtonGroup = ({ children, class: classes, orientation = "horizontal", ...attrs }) => /* @__PURE__ */ jsx("div", {
16
+ ...attrs,
17
+ class: buttonGroupVariants({
18
+ class: classes,
19
+ orientation
20
+ }),
21
+ "data-orientation": orientation,
22
+ "data-slot": "button-group",
23
+ role: attrs.role ?? "group",
24
+ children
25
+ });
26
+ /** Visual divider for ButtonGroup contents. */
27
+ var ButtonGroupSeparator = ({ class: classes, orientation = "vertical", ...attrs }) => /* @__PURE__ */ jsx("div", {
28
+ ...attrs,
29
+ "aria-hidden": "true",
30
+ class: clsx(separatorBase, classes),
31
+ "data-orientation": orientation,
32
+ "data-slot": "button-group-separator",
33
+ role: attrs.role ?? "none"
34
+ });
35
+ /** Text or label segment for mixed button/input groups. */
36
+ var ButtonGroupText = ({ as = "div", children, class: classes, ...attrs }) => {
37
+ const styles = clsx(textBase, classes);
38
+ if (as === "label") return /* @__PURE__ */ jsx("label", {
39
+ ...attrs,
40
+ class: styles,
41
+ "data-slot": "button-group-text",
42
+ children
43
+ });
44
+ if (as === "span") return /* @__PURE__ */ jsx("span", {
45
+ ...attrs,
46
+ class: styles,
47
+ "data-slot": "button-group-text",
48
+ children
49
+ });
50
+ return /* @__PURE__ */ jsx("div", {
51
+ ...attrs,
52
+ class: styles,
53
+ "data-slot": "button-group-text",
54
+ children
55
+ });
56
+ };
57
+ //#endregion
58
+ export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
package/dist/button.js ADDED
@@ -0,0 +1,72 @@
1
+ // @unocss-include
2
+ import clsx from "clsx";
3
+ import { jsx } from "ajo/jsx-runtime";
4
+ //#region packages/ajo-ui-playa/src/button.tsx
5
+ var base = "inline-flex shrink-0 items-center justify-center text-sm font-medium whitespace-nowrap outline-none focus-visible:ring-3 active:scale-[0.98] motion-reduce:active:scale-100 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-invalid:inset-ring aria-invalid:inset-ring-danger aria-invalid:ring-danger/25 [&_svg]:pointer-events-none [&_svg]:shrink-0";
6
+ var variants = {
7
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
8
+ danger: "bg-danger text-danger-foreground hover:bg-danger/90",
9
+ "danger-ghost": "text-danger hover:bg-danger/10 hover:text-danger",
10
+ outline: "edge bg-transparent text-foreground hover:bg-accent hover:edge-on-accent hover:text-accent-foreground",
11
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
12
+ ghost: "text-foreground hover:bg-accent hover:text-accent-foreground",
13
+ link: "text-primary underline-offset-4 hover:underline",
14
+ "muted-ghost": "text-muted-foreground hover:bg-accent hover:text-foreground"
15
+ };
16
+ var focusRings = {
17
+ default: "focus-visible:ring-ring/50",
18
+ danger: "focus-visible:ring-danger/40",
19
+ "danger-ghost": "focus-visible:ring-danger/40",
20
+ ghost: "focus-visible:ring-ring/50",
21
+ link: "focus-visible:ring-ring/50",
22
+ "muted-ghost": "focus-visible:ring-ring/50",
23
+ outline: "focus-visible:ring-ring/50",
24
+ secondary: "focus-visible:ring-ring/50"
25
+ };
26
+ var sizes = {
27
+ default: "h-9 gap-2 rounded-md px-4 py-2 has-[>svg]:px-3 [&_svg:not([class*=size-])]:size-4",
28
+ xs: "h-6 gap-1 rounded-sm px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*=size-])]:size-3",
29
+ sm: "h-8 gap-2 rounded-md px-3 has-[>svg]:px-2.5 [&_svg:not([class*=size-])]:size-4",
30
+ lg: "h-10 gap-2 rounded-md px-6 has-[>svg]:px-4 [&_svg:not([class*=size-])]:size-4",
31
+ icon: "size-9 gap-2 rounded-md [&_svg:not([class*=size-])]:size-4",
32
+ "icon-xs": "size-6 gap-2 rounded-sm [&_svg:not([class*=size-])]:size-3",
33
+ "icon-sm": "size-8 gap-2 rounded-md [&_svg:not([class*=size-])]:size-4",
34
+ "icon-lg": "size-10 gap-2 rounded-md [&_svg:not([class*=size-])]:size-4",
35
+ none: ""
36
+ };
37
+ /** Returns the UnoCSS class list for a button variant. */
38
+ var buttonVariants = ({ class: classes, size = "default", transition = true, variant = "default" } = {}) => clsx(base, transition && "transition-all", variants[variant], focusRings[variant], sizes[size], classes);
39
+ /** Interactive action surface for buttons, links, and icon controls. */
40
+ var Button = ({ as = "button", class: classes, children, "data-slot": slot = "button", disabled, size = "default", variant = "default", ...attrs }) => {
41
+ const styles = buttonVariants({
42
+ class: classes,
43
+ size,
44
+ variant
45
+ });
46
+ if (as === "a") {
47
+ const anchor = attrs;
48
+ const blocked = Boolean(disabled);
49
+ return /* @__PURE__ */ jsx("a", {
50
+ ...anchor,
51
+ "aria-disabled": blocked ? "true" : void 0,
52
+ class: styles,
53
+ "data-size": size,
54
+ "data-slot": slot,
55
+ "data-variant": variant,
56
+ href: blocked ? void 0 : String(anchor.href),
57
+ tabIndex: blocked ? -1 : anchor.tabIndex,
58
+ children
59
+ });
60
+ }
61
+ return /* @__PURE__ */ jsx("button", {
62
+ ...attrs,
63
+ class: styles,
64
+ "data-size": size,
65
+ "data-slot": slot,
66
+ "data-variant": variant,
67
+ disabled,
68
+ children
69
+ });
70
+ };
71
+ //#endregion
72
+ export { buttonVariants, Button as default };
@@ -0,0 +1,109 @@
1
+ // @unocss-include
2
+ import { buttonVariants } from "./button.js";
3
+ import { Select, SelectContent, SelectItem, SelectList, SelectTrigger, SelectValue } from "./select.js";
4
+ import clsx from "clsx";
5
+ import { jsx, jsxs } from "ajo/jsx-runtime";
6
+ import { Calendar as Calendar$1, CalendarDayButton as CalendarDayButton$1 } from "ajo-ui/calendar";
7
+ //#region packages/ajo-ui-playa/src/calendar.tsx
8
+ var rootBase = "group/calendar bg-background p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent";
9
+ var monthsBase = "flex flex-col gap-4 md:flex-row";
10
+ var monthBase = "flex w-full flex-col gap-4";
11
+ var navButtonBase = "size-[var(--cell-size)] rounded-md p-0 select-none aria-disabled:opacity-50";
12
+ var captionBase = "flex h-[var(--cell-size)] w-full items-center gap-1";
13
+ var dropdownsBase = "flex h-[var(--cell-size)] min-w-0 flex-1 items-center justify-center gap-1.5 text-sm font-medium";
14
+ var gridBase = "grid w-full gap-1";
15
+ var weekdaysBase = "grid w-full gap-0";
16
+ var weekdayBase = "flex h-6 items-center justify-center rounded-md text-xs font-normal text-muted-foreground select-none";
17
+ var weekBase = "grid w-full gap-0";
18
+ var weekNumberBase = "flex size-[var(--cell-size)] items-center justify-center text-xs tabular-nums text-muted-foreground select-none";
19
+ var dayCellBase = "group/day relative flex h-[var(--cell-size)] w-full min-w-[var(--cell-size)] items-center justify-center p-0 text-center select-none";
20
+ var dayButtonBase = "flex h-[var(--cell-size)] w-full min-w-[var(--cell-size)] flex-col items-center justify-center gap-1 rounded-md leading-none font-normal outline-none transition-[color,box-shadow,background-color] focus-visible:ring-3 focus-visible:ring-ring/50 data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[selected-single=true]:hover:bg-primary data-[selected-single=true]:hover:text-primary-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-start=true]:hover:bg-primary data-[range-start=true]:hover:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-end=true]:hover:bg-primary data-[range-end=true]:hover:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-transparent data-[range-middle=true]:text-accent-foreground data-[outside=true]:text-muted-foreground data-[today=true]:font-medium data-[unavailable=true]:line-through data-[unavailable=true]:decoration-danger/70 data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&>span]:text-xs [&>span]:opacity-70";
21
+ var labelBase = "select-none text-sm font-medium";
22
+ var viewBase = "grid w-full gap-1 py-1";
23
+ var viewCellBase = clsx(buttonVariants({
24
+ size: "none",
25
+ transition: false,
26
+ variant: "ghost"
27
+ }), "h-10 w-full rounded-md px-2 text-sm font-normal outline-none focus-visible:ring-3 focus-visible:ring-ring/50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[today=true]:font-medium data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50");
28
+ var viewTriggerBase = "data-[slot=calendar-view-trigger]:rounded-md data-[slot=calendar-view-trigger]:px-2 data-[slot=calendar-view-trigger]:outline-none data-[slot=calendar-view-trigger]:hover:bg-accent data-[slot=calendar-view-trigger]:focus-visible:ring-3 data-[slot=calendar-view-trigger]:focus-visible:ring-ring/50 data-[slot=calendar-view-trigger]:disabled:pointer-events-none data-[slot=calendar-view-trigger]:disabled:opacity-50";
29
+ var calendarClassNames = (classNames) => ({
30
+ caption: clsx(captionBase, classNames?.caption),
31
+ day: classNames?.day,
32
+ day_button: clsx(buttonVariants({
33
+ size: "none",
34
+ transition: false,
35
+ variant: "ghost"
36
+ }), dayButtonBase, classNames?.day_button),
37
+ dropdowns: clsx(dropdownsBase, classNames?.dropdowns),
38
+ grid: clsx(gridBase, classNames?.grid),
39
+ head: clsx(weekdaysBase, classNames?.head),
40
+ month: clsx(monthBase, classNames?.month),
41
+ month_cell: clsx(viewCellBase, classNames?.month_cell),
42
+ month_view: clsx(viewBase, classNames?.month_view),
43
+ months: clsx(monthsBase, classNames?.months),
44
+ week: clsx(weekBase, classNames?.week),
45
+ week_number: clsx(weekNumberBase, classNames?.week_number),
46
+ weekday: clsx(weekdayBase, classNames?.weekday),
47
+ year_cell: clsx(viewCellBase, classNames?.year_cell),
48
+ year_view: clsx(viewBase, classNames?.year_view)
49
+ });
50
+ var dayClassName = (classNames, modifiersClassNames) => ({ modifierNames, modifiers, range }) => {
51
+ const modifierClass = modifierNames.map((name) => modifiersClassNames?.[name]).filter(Boolean).join(" ");
52
+ return clsx(dayCellBase, range && modifiers.range_start && "rounded-s-md bg-accent", range && modifiers.range_middle && "bg-accent", range && modifiers.range_end && "rounded-e-md bg-accent", modifiers.today && !range && !modifiers.outside && "rounded-md bg-accent", modifiers.selected && classNames?.selected, modifiers.outside && classNames?.outside, modifiers.today && classNames?.today, modifiers.range_start && classNames?.range_start, modifiers.range_middle && classNames?.range_middle, modifiers.range_end && classNames?.range_end, modifierClass, classNames?.day);
53
+ };
54
+ var CalendarDropdown = ({ label, onValueChange, options, triggerClass, value }) => /* @__PURE__ */ jsxs(Select, {
55
+ value,
56
+ onValueChange: (next, event) => next == null || onValueChange(String(next), event),
57
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
58
+ "aria-label": label,
59
+ class: triggerClass,
60
+ size: "sm",
61
+ children: /* @__PURE__ */ jsx(SelectValue, {})
62
+ }), /* @__PURE__ */ jsx(SelectContent, { children: /* @__PURE__ */ jsx(SelectList, { children: options.map((option) => /* @__PURE__ */ jsx(SelectItem, {
63
+ value: option.value,
64
+ children: option.label
65
+ }, option.value)) }) })]
66
+ });
67
+ var CalendarMonthDropdown = (attrs) => /* @__PURE__ */ jsx(CalendarDropdown, {
68
+ ...attrs,
69
+ triggerClass: "h-8 w-[6.75rem]"
70
+ });
71
+ var CalendarYearDropdown = (attrs) => /* @__PURE__ */ jsx(CalendarDropdown, {
72
+ ...attrs,
73
+ triggerClass: "h-8 w-[5.5rem]"
74
+ });
75
+ /** Ajo-native calendar with single, multiple, and range selection. */
76
+ var Calendar = ({ buttonVariant = "ghost", class: classes, classNames, modifiersClassNames, ...attrs }) => {
77
+ const styles = calendarClassNames(classNames);
78
+ return /* @__PURE__ */ jsx(Calendar$1, {
79
+ ...attrs,
80
+ captionLabelClass: clsx(labelBase, viewTriggerBase, "min-w-0 flex-1 text-center"),
81
+ class: clsx(rootBase, classes),
82
+ classNames: styles,
83
+ dayButtonClass: styles.day_button,
84
+ dayClassName: dayClassName(classNames, modifiersClassNames),
85
+ hiddenDayClass: "invisible",
86
+ monthDropdown: CalendarMonthDropdown,
87
+ monthLabelClass: labelBase,
88
+ navButtonClass: clsx(buttonVariants({
89
+ size: "none",
90
+ variant: buttonVariant
91
+ }), navButtonBase),
92
+ navSpacerClass: "size-[var(--cell-size)] shrink-0",
93
+ nextIconClass: "i-lucide-chevron-right block size-4 rtl:rotate-180",
94
+ previousIconClass: "i-lucide-chevron-left block size-4 rtl:rotate-180",
95
+ yearDropdown: CalendarYearDropdown,
96
+ yearLabelClass: labelBase
97
+ });
98
+ };
99
+ /** Day button used by Calendar. Exported for advanced composition and testing. */
100
+ var CalendarDayButton = ({ class: classes, ...attrs }) => /* @__PURE__ */ jsx(CalendarDayButton$1, {
101
+ ...attrs,
102
+ class: clsx(buttonVariants({
103
+ size: "none",
104
+ transition: false,
105
+ variant: "ghost"
106
+ }), dayButtonBase, classes)
107
+ });
108
+ //#endregion
109
+ export { Calendar, CalendarDayButton };
package/dist/card.js ADDED
@@ -0,0 +1,98 @@
1
+ // @unocss-include
2
+ import clsx from "clsx";
3
+ import { jsx } from "ajo/jsx-runtime";
4
+ //#region packages/ajo-ui-playa/src/card.tsx
5
+ var base = "group/card flex flex-col gap-[var(--card-spacing)] overflow-hidden rounded-xl glass edge py-[var(--card-spacing)] shadow-xs has-[>img:first-child]:pt-0 [&>img:first-child]:rounded-t-xl [&>img:last-child]:rounded-b-xl [&_[data-slot=table-container]]:rounded-[0px] [&_[data-slot=table-container]]:outline-none";
6
+ var sizes = {
7
+ default: "[--card-spacing:1.5rem]",
8
+ sm: "[--card-spacing:1rem] text-sm"
9
+ };
10
+ /** Returns the UnoCSS class list for a card root. */
11
+ var cardVariants = ({ class: classes, size = "default" } = {}) => clsx(base, sizes[size], classes);
12
+ /** Structured content container with header, body, and footer slots. */
13
+ var Card = ({ as = "div", class: classes, children, "data-slot": slot = "card", size = "default", ...attrs }) => {
14
+ const styles = cardVariants({
15
+ class: classes,
16
+ size
17
+ });
18
+ if (as === "a") return /* @__PURE__ */ jsx("a", {
19
+ ...attrs,
20
+ class: styles,
21
+ "data-size": size,
22
+ "data-slot": slot,
23
+ href: String(attrs.href),
24
+ children
25
+ });
26
+ if (as === "article") return /* @__PURE__ */ jsx("article", {
27
+ ...attrs,
28
+ class: styles,
29
+ "data-size": size,
30
+ "data-slot": slot,
31
+ children
32
+ });
33
+ if (as === "form") return /* @__PURE__ */ jsx("form", {
34
+ ...attrs,
35
+ class: styles,
36
+ "data-size": size,
37
+ "data-slot": slot,
38
+ children
39
+ });
40
+ if (as === "section") return /* @__PURE__ */ jsx("section", {
41
+ ...attrs,
42
+ class: styles,
43
+ "data-size": size,
44
+ "data-slot": slot,
45
+ children
46
+ });
47
+ return /* @__PURE__ */ jsx("div", {
48
+ ...attrs,
49
+ class: styles,
50
+ "data-size": size,
51
+ "data-slot": slot,
52
+ children
53
+ });
54
+ };
55
+ /** Header slot for card titles, descriptions, and actions. */
56
+ var CardHeader = ({ class: classes, children, "data-slot": slot = "card-header", ...attrs }) => /* @__PURE__ */ jsx("div", {
57
+ ...attrs,
58
+ class: clsx("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-[var(--card-spacing)] has-[>[data-slot=card-action]]:grid-cols-[1fr_auto] [&.border-b]:pb-[var(--card-spacing)]", classes),
59
+ "data-slot": slot,
60
+ children
61
+ });
62
+ /** Title slot for `CardHeader`. */
63
+ var CardTitle = ({ class: classes, children, "data-slot": slot = "card-title", ...attrs }) => /* @__PURE__ */ jsx("div", {
64
+ ...attrs,
65
+ class: clsx("font-semibold leading-none", classes),
66
+ "data-slot": slot,
67
+ children
68
+ });
69
+ /** Helper text slot for `CardHeader`. */
70
+ var CardDescription = ({ class: classes, children, "data-slot": slot = "card-description", ...attrs }) => /* @__PURE__ */ jsx("div", {
71
+ ...attrs,
72
+ class: clsx("text-sm text-muted-foreground", classes),
73
+ "data-slot": slot,
74
+ children
75
+ });
76
+ /** Header action slot, aligned to the top-right. */
77
+ var CardAction = ({ class: classes, children, "data-slot": slot = "card-action", ...attrs }) => /* @__PURE__ */ jsx("div", {
78
+ ...attrs,
79
+ class: clsx("col-start-2 row-span-2 row-start-1 self-start justify-self-end", classes),
80
+ "data-slot": slot,
81
+ children
82
+ });
83
+ /** Main body slot for card content. */
84
+ var CardContent = ({ class: classes, children, "data-slot": slot = "card-content", ...attrs }) => /* @__PURE__ */ jsx("div", {
85
+ ...attrs,
86
+ class: clsx("px-[var(--card-spacing)]", classes),
87
+ "data-slot": slot,
88
+ children
89
+ });
90
+ /** Footer slot for actions and secondary content. */
91
+ var CardFooter = ({ class: classes, children, "data-slot": slot = "card-footer", ...attrs }) => /* @__PURE__ */ jsx("div", {
92
+ ...attrs,
93
+ class: clsx("flex items-center px-[var(--card-spacing)] [&.border-t]:pt-[var(--card-spacing)]", classes),
94
+ "data-slot": slot,
95
+ children
96
+ });
97
+ //#endregion
98
+ export { Card, Card as default, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, cardVariants };
@@ -0,0 +1,86 @@
1
+ // @unocss-include
2
+ import { buttonVariants } from "./button.js";
3
+ import clsx from "clsx";
4
+ import { jsx, jsxs } from "ajo/jsx-runtime";
5
+ import { Carousel as Carousel$1, CarouselContent as CarouselContent$1, CarouselContext, CarouselItem as CarouselItem$1, CarouselNext as CarouselNext$1, CarouselPrevious as CarouselPrevious$1 } from "ajo-ui/carousel";
6
+ //#region packages/ajo-ui-playa/src/carousel.tsx
7
+ var carousel = () => {
8
+ const value = CarouselContext();
9
+ if (!value) throw new Error("Carousel parts must be used within a <Carousel />");
10
+ return value;
11
+ };
12
+ /** Native scroll-snap carousel root. */
13
+ var Carousel = ({ children, class: classes, dir, opts, orientation, role = "region", setApi, ...attrs }) => /* @__PURE__ */ jsx(Carousel$1, {
14
+ ...attrs,
15
+ class: clsx("relative", classes),
16
+ dir,
17
+ opts,
18
+ orientation,
19
+ role,
20
+ setApi,
21
+ children
22
+ });
23
+ /** Scroll viewport and track for carousel slides. */
24
+ var CarouselContent = ({ children, class: classes, ...attrs }) => {
25
+ const horizontal = carousel().orientation === "horizontal";
26
+ return /* @__PURE__ */ jsx(CarouselContent$1, {
27
+ ...attrs,
28
+ class: clsx("flex scroll-smooth overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", horizontal ? "-ml-4 overflow-x-auto snap-x snap-mandatory" : "-mt-4 max-h-full flex-col overflow-y-auto snap-y snap-mandatory", classes),
29
+ viewportClass: "overflow-hidden",
30
+ children
31
+ });
32
+ };
33
+ /** Carousel slide item. */
34
+ var CarouselItem = ({ children, class: classes, role = "group", ...attrs }) => {
35
+ const { orientation } = carousel();
36
+ return /* @__PURE__ */ jsx(CarouselItem$1, {
37
+ ...attrs,
38
+ class: clsx("min-w-0 shrink-0 grow-0 basis-full snap-start", orientation === "horizontal" ? "pl-4" : "pt-4", classes),
39
+ role,
40
+ children
41
+ });
42
+ };
43
+ /** Previous slide button. */
44
+ var CarouselPrevious = ({ "aria-label": label = "Previous slide", class: classes, disabled, type = "button", variant = "outline", ...attrs }) => {
45
+ const { orientation } = carousel();
46
+ return /* @__PURE__ */ jsxs(CarouselPrevious$1, {
47
+ ...attrs,
48
+ "aria-label": label,
49
+ class: clsx(buttonVariants({
50
+ size: "none",
51
+ variant
52
+ }), "absolute size-8 rounded-full", orientation === "horizontal" ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90", classes),
53
+ disabled,
54
+ type,
55
+ children: [/* @__PURE__ */ jsx("span", {
56
+ "aria-hidden": "true",
57
+ class: "i-lucide-arrow-left size-4"
58
+ }), /* @__PURE__ */ jsx("span", {
59
+ class: "sr-only",
60
+ children: label
61
+ })]
62
+ });
63
+ };
64
+ /** Next slide button. */
65
+ var CarouselNext = ({ "aria-label": label = "Next slide", class: classes, disabled, type = "button", variant = "outline", ...attrs }) => {
66
+ const { orientation } = carousel();
67
+ return /* @__PURE__ */ jsxs(CarouselNext$1, {
68
+ ...attrs,
69
+ "aria-label": label,
70
+ class: clsx(buttonVariants({
71
+ size: "none",
72
+ variant
73
+ }), "absolute size-8 rounded-full", orientation === "horizontal" ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", classes),
74
+ disabled,
75
+ type,
76
+ children: [/* @__PURE__ */ jsx("span", {
77
+ "aria-hidden": "true",
78
+ class: "i-lucide-arrow-right size-4"
79
+ }), /* @__PURE__ */ jsx("span", {
80
+ class: "sr-only",
81
+ children: label
82
+ })]
83
+ });
84
+ };
85
+ //#endregion
86
+ export { Carousel, CarouselContent, CarouselContext, CarouselItem, CarouselNext, CarouselPrevious };
package/dist/chart.js ADDED
@@ -0,0 +1,125 @@
1
+ // @unocss-include
2
+ import clsx from "clsx";
3
+ import { Fragment, jsx, jsxs } from "ajo/jsx-runtime";
4
+ import { ChartArea as ChartArea$1, ChartBar as ChartBar$1, ChartContainer as ChartContainer$1, ChartIdContext, ChartLegend as ChartLegend$1, ChartLegendContent as ChartLegendContent$1, ChartLine as ChartLine$1, ChartPie as ChartPie$1, ChartTooltip as ChartTooltip$1, ChartTooltipContent as ChartTooltipContent$1 } from "ajo-ui/chart";
5
+ //#region packages/ajo-ui-playa/src/chart.tsx
6
+ var THEMES = {
7
+ dark: ".dark",
8
+ light: ""
9
+ };
10
+ var palette = [
11
+ "var(--chart-1)",
12
+ "var(--chart-2)",
13
+ "var(--chart-3)",
14
+ "var(--chart-4)",
15
+ "var(--chart-5)"
16
+ ];
17
+ var rootBase = "relative flex aspect-video min-h-[200px] w-full flex-col justify-center text-xs text-muted-foreground";
18
+ var svgBase = "h-full min-h-[180px] w-full overflow-visible";
19
+ var tooltipBase = "pointer-events-none absolute z-20 min-w-[8rem] rounded-lg glass-overlay edge px-2.5 py-1.5 text-xs shadow-lg";
20
+ var legendBase = "flex flex-wrap items-center justify-center gap-4 text-xs text-muted-foreground";
21
+ var plotAttrs = (classes) => ({
22
+ axisStroke: "var(--muted-foreground)",
23
+ axisStrokeOpacity: "0.5",
24
+ barClass: "outline-none transition-opacity focus-visible:opacity-80",
25
+ class: clsx(svgBase, classes),
26
+ gridStroke: "var(--border)",
27
+ pointClass: "outline-none",
28
+ pointFill: "var(--background)"
29
+ });
30
+ /** Root provider for chart config, data, tooltip, and legend state. */
31
+ var ChartContainer = ({ children, class: classes, config, id, type = "bar", ...attrs }) => {
32
+ return /* @__PURE__ */ jsxs(ChartContainer$1, {
33
+ ...attrs,
34
+ class: clsx(rootBase, classes),
35
+ config,
36
+ id,
37
+ palette,
38
+ type,
39
+ children: [/* @__PURE__ */ jsx(ChartStyle, { config }), children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
40
+ type === "pie" ? /* @__PURE__ */ jsx(ChartPie, {}) : type === "line" ? /* @__PURE__ */ jsx(ChartLine, {}) : type === "area" ? /* @__PURE__ */ jsx(ChartArea, {}) : /* @__PURE__ */ jsx(ChartBar, {}),
41
+ /* @__PURE__ */ jsx(ChartTooltip, {}),
42
+ /* @__PURE__ */ jsx(ChartLegend, {})
43
+ ] })]
44
+ });
45
+ };
46
+ /** CSS variable injector matching chart config color behavior. */
47
+ var ChartStyle = ({ config }) => {
48
+ const id = ChartIdContext();
49
+ if (!id) return null;
50
+ const entries = Object.entries(config).filter(([, item]) => item.color || item.theme);
51
+ if (!entries.length) return null;
52
+ const scope = `[data-slot="chart"]:has(>style[data-chart-style="${id}"])`;
53
+ return /* @__PURE__ */ jsx("style", {
54
+ "data-chart-style": id,
55
+ children: Object.entries(THEMES).map(([theme, selector]) => {
56
+ const vars = entries.map(([key, item]) => {
57
+ const color = item.theme?.[theme] ?? item.color;
58
+ return color ? ` --color-${key}: ${color};` : "";
59
+ }).filter(Boolean).join("\n");
60
+ return `${selector ? `${selector} ` : ""}${scope} {\n${vars}\n}`;
61
+ }).join("\n")
62
+ });
63
+ };
64
+ /** Native SVG bar chart primitive for use inside ChartContainer. */
65
+ var ChartBar = ({ class: classes, ...attrs }) => /* @__PURE__ */ jsx(ChartBar$1, {
66
+ ...attrs,
67
+ ...plotAttrs(classes)
68
+ });
69
+ /** Native SVG line chart primitive for use inside ChartContainer. */
70
+ var ChartLine = ({ class: classes, ...attrs }) => /* @__PURE__ */ jsx(ChartLine$1, {
71
+ ...attrs,
72
+ ...plotAttrs(classes)
73
+ });
74
+ /** Native SVG area chart primitive for use inside ChartContainer. */
75
+ var ChartArea = ({ class: classes, ...attrs }) => /* @__PURE__ */ jsx(ChartArea$1, {
76
+ ...attrs,
77
+ ...plotAttrs(classes)
78
+ });
79
+ /** Native SVG pie/donut chart primitive for use inside ChartContainer. */
80
+ var ChartPie = ({ class: classes, ...attrs }) => /* @__PURE__ */ jsx(ChartPie$1, {
81
+ ...attrs,
82
+ ...plotAttrs(clsx("mx-auto max-w-[320px]", classes)),
83
+ centerLabelClass: "text-sm font-medium text-foreground",
84
+ centerLabelFill: "currentColor",
85
+ sliceStroke: "var(--background)"
86
+ });
87
+ /** Absolute tooltip layer for native chart primitives. */
88
+ var ChartTooltip = ({ children, class: classes, content, ...attrs }) => /* @__PURE__ */ jsx(ChartTooltip$1, {
89
+ ...attrs,
90
+ class: clsx(tooltipBase, classes),
91
+ content: content ?? children ?? /* @__PURE__ */ jsx(ChartTooltipContent, {})
92
+ });
93
+ /** Tooltip body matching tooltip-content behavior for native chart payloads. */
94
+ var ChartTooltipContent = ({ class: classes, labelClass, ...attrs }) => /* @__PURE__ */ jsx(ChartTooltipContent$1, {
95
+ ...attrs,
96
+ class: clsx("grid gap-1.5", classes),
97
+ formattedValueClass: "font-mono font-medium text-foreground tabular-nums",
98
+ iconClass: "size-3 text-muted-foreground",
99
+ iconWrapperClass: "[&>svg]:size-3",
100
+ indicatorClass: ({ indicator, nestLabel }) => clsx("shrink-0 rounded-[2px] border-[--chart-indicator] bg-[--chart-indicator]", indicator === "dot" && "size-2.5", indicator === "line" && "w-1", indicator === "dashed" && "w-0 border-[1.5px] border-dashed bg-transparent", nestLabel && indicator === "dashed" && "my-0.5"),
101
+ itemClass: ({ indicator }) => clsx("flex w-full items-stretch gap-2", indicator === "dot" && "items-center"),
102
+ itemLabelClass: "text-muted-foreground",
103
+ itemsClass: "grid gap-1.5",
104
+ labelClass: clsx("font-medium", labelClass),
105
+ nestedLabelClass: clsx("font-medium text-foreground", labelClass),
106
+ valueLabelGroupClass: "grid gap-1.5",
107
+ valueRowClass: ({ nestLabel }) => clsx("flex flex-1 justify-between gap-4 leading-none", nestLabel ? "items-end" : "items-center")
108
+ });
109
+ /** Legend layer for native chart primitives. */
110
+ var ChartLegend = ({ children, class: classes, content, ...attrs }) => /* @__PURE__ */ jsx(ChartLegend$1, {
111
+ ...attrs,
112
+ class: classes,
113
+ content: content ?? children ?? /* @__PURE__ */ jsx(ChartLegendContent, {})
114
+ });
115
+ /** Legend content matching legend-content behavior. */
116
+ var ChartLegendContent = ({ class: classes, verticalAlign = "bottom", ...attrs }) => /* @__PURE__ */ jsx(ChartLegendContent$1, {
117
+ ...attrs,
118
+ class: clsx(legendBase, verticalAlign === "top" ? "pb-3" : "pt-3", classes),
119
+ iconClass: "size-3 text-muted-foreground",
120
+ iconWrapperClass: "[&>svg]:size-3",
121
+ itemClass: "flex items-center gap-1.5",
122
+ swatchClass: "size-2 shrink-0 rounded-[2px]"
123
+ });
124
+ //#endregion
125
+ export { ChartArea, ChartBar, ChartContainer, ChartLegend, ChartLegendContent, ChartLine, ChartPie, ChartTooltip, ChartTooltipContent };
@@ -0,0 +1,30 @@
1
+ // @unocss-include
2
+ import { a as checkboxState, i as checkboxInvalidState, n as checkboxCheckedIndicator, o as choiceGroupOrientation, r as checkboxIndeterminateIndicator, s as choiceInput, t as checkboxBox } from "./chunks/recipes-CXxPSYdV.js";
3
+ import clsx from "clsx";
4
+ import { jsx } from "ajo/jsx-runtime";
5
+ import { bool } from "ajo-ui/utils";
6
+ import { FieldContext } from "ajo-ui/field";
7
+ import { CheckboxGroup as CheckboxGroup$1, CheckboxGroupItem as CheckboxGroupItem$1 } from "ajo-ui/checkbox-group";
8
+ //#region packages/ajo-ui-playa/src/checkbox-group.tsx
9
+ /** Checkbox input group matching composition while preserving native forms. */
10
+ var CheckboxGroup = ({ class: classes, orientation = "vertical", ...attrs }) => {
11
+ return /* @__PURE__ */ jsx(CheckboxGroup$1, {
12
+ ...FieldContext()?.groupAttrs ?? {},
13
+ ...attrs,
14
+ class: clsx(choiceGroupOrientation[orientation], classes),
15
+ "data-orientation": orientation
16
+ });
17
+ };
18
+ /** Native checkbox item styled as a custom control. */
19
+ var CheckboxGroupItem = ({ class: classes, type: _type, ...attrs }) => {
20
+ const invalid = bool(attrs["aria-invalid"]);
21
+ return /* @__PURE__ */ jsx(CheckboxGroupItem$1, {
22
+ ...attrs,
23
+ checkedIndicatorClass: checkboxCheckedIndicator,
24
+ class: clsx(checkboxBox, invalid ? checkboxInvalidState : checkboxState, classes),
25
+ indeterminateIndicatorClass: checkboxIndeterminateIndicator,
26
+ inputClass: choiceInput
27
+ });
28
+ };
29
+ //#endregion
30
+ export { CheckboxGroup, CheckboxGroupItem };
@@ -0,0 +1,25 @@
1
+ // @unocss-include
2
+ import { a as checkboxState, i as checkboxInvalidState, n as checkboxCheckedIndicator, r as checkboxIndeterminateIndicator, s as choiceInput, t as checkboxBox } from "./chunks/recipes-CXxPSYdV.js";
3
+ import clsx from "clsx";
4
+ import { jsx } from "ajo/jsx-runtime";
5
+ import { bool } from "ajo-ui/utils";
6
+ import { FieldContext } from "ajo-ui/field";
7
+ import { Checkbox as Checkbox$1 } from "ajo-ui/checkbox";
8
+ //#region packages/ajo-ui-playa/src/checkbox.tsx
9
+ /** Native checkbox control styled as a custom control while preserving form behavior. */
10
+ var Checkbox = ({ class: classes, type: _type, ...attrs }) => {
11
+ const inputAttrs = {
12
+ ...FieldContext()?.controlAttrs ?? {},
13
+ ...attrs
14
+ };
15
+ const invalid = bool(inputAttrs["aria-invalid"]);
16
+ return /* @__PURE__ */ jsx(Checkbox$1, {
17
+ ...inputAttrs,
18
+ checkedIndicatorClass: checkboxCheckedIndicator,
19
+ class: clsx(checkboxBox, invalid ? checkboxInvalidState : checkboxState, classes),
20
+ indeterminateIndicatorClass: checkboxIndeterminateIndicator,
21
+ inputClass: choiceInput
22
+ });
23
+ };
24
+ //#endregion
25
+ export { Checkbox, Checkbox as default };