@eodparks/ui 0.0.0-stage → 0.2.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 (176) hide show
  1. package/LICENSE +21 -0
  2. package/dist/accordion.d.ts +36 -0
  3. package/dist/accordion.js +57 -0
  4. package/dist/alert-dialog.d.ts +50 -0
  5. package/dist/alert-dialog.js +149 -0
  6. package/dist/alert.d.ts +23 -0
  7. package/dist/alert.js +87 -0
  8. package/dist/avatar.d.ts +35 -0
  9. package/dist/avatar.js +118 -0
  10. package/dist/badge.d.ts +27 -0
  11. package/dist/badge.js +148 -0
  12. package/dist/button-C2CCxHu1.d.ts +15 -0
  13. package/dist/button-DEsRlveL.js +86 -0
  14. package/dist/button.d.ts +2 -0
  15. package/dist/button.js +1 -0
  16. package/dist/calendar-DhsRPq2D.d.ts +23 -0
  17. package/dist/calendar-kbn4gZ1a.js +110 -0
  18. package/dist/calendar.d.ts +2 -0
  19. package/dist/calendar.js +1 -0
  20. package/dist/card-tkP52GwZ.js +77 -0
  21. package/dist/card.d.ts +18 -0
  22. package/dist/card.js +1 -0
  23. package/dist/chart.d.ts +52 -0
  24. package/dist/chart.js +163 -0
  25. package/dist/checkbox.d.ts +7 -0
  26. package/dist/checkbox.js +26 -0
  27. package/dist/cn-B-fHM4Ov.js +12 -0
  28. package/dist/collapsible.d.ts +10 -0
  29. package/dist/collapsible.js +23 -0
  30. package/dist/command.d.ts +38 -0
  31. package/dist/command.js +124 -0
  32. package/dist/date-picker.d.ts +46 -0
  33. package/dist/date-picker.js +159 -0
  34. package/dist/dialog-JjpMFEDR.js +117 -0
  35. package/dist/dialog.d.ts +2 -0
  36. package/dist/dialog.js +3 -0
  37. package/dist/dropdown-menu-B_VG1VXX.js +116 -0
  38. package/dist/dropdown-menu-CZ8xcq1d.d.ts +38 -0
  39. package/dist/dropdown-menu.d.ts +2 -0
  40. package/dist/dropdown-menu.js +1 -0
  41. package/dist/empty-state-B11Uq0U_.js +66 -0
  42. package/dist/empty-state.d.ts +15 -0
  43. package/dist/empty-state.js +1 -0
  44. package/dist/error-state.d.ts +48 -0
  45. package/dist/error-state.js +139 -0
  46. package/dist/field-Cwhz73-_.d.ts +15 -0
  47. package/dist/field-D-n7O1n6.js +63 -0
  48. package/dist/field.d.ts +2 -0
  49. package/dist/field.js +1 -0
  50. package/dist/focus-ring-BpxMbGAn.js +3 -0
  51. package/dist/form-actions.d.ts +21 -0
  52. package/dist/form-actions.js +41 -0
  53. package/dist/forms/formik.d.ts +20 -0
  54. package/dist/forms/formik.js +50 -0
  55. package/dist/forms/rhf.d.ts +32 -0
  56. package/dist/forms/rhf.js +114 -0
  57. package/dist/icon-button-XAjcFsZ2.js +14 -0
  58. package/dist/icon-button.d.ts +9 -0
  59. package/dist/icon-button.js +1 -0
  60. package/dist/icon.d.ts +15 -0
  61. package/dist/icon.js +21 -0
  62. package/dist/index-Ct4mPvuB.d.ts +29 -0
  63. package/dist/input-BxjcqQS1.js +49 -0
  64. package/dist/input-group.d.ts +12 -0
  65. package/dist/input-group.js +26 -0
  66. package/dist/input.d.ts +15 -0
  67. package/dist/input.js +1 -0
  68. package/dist/label-BrOAJU1p.js +31 -0
  69. package/dist/label-CUAiaBbm.d.ts +13 -0
  70. package/dist/label.d.ts +2 -0
  71. package/dist/label.js +1 -0
  72. package/dist/native-select.d.ts +8 -0
  73. package/dist/native-select.js +41 -0
  74. package/dist/page-header.d.ts +19 -0
  75. package/dist/page-header.js +51 -0
  76. package/dist/pagination.d.ts +47 -0
  77. package/dist/pagination.js +131 -0
  78. package/dist/password-input.d.ts +14 -0
  79. package/dist/password-input.js +41 -0
  80. package/dist/popover.d.ts +19 -0
  81. package/dist/popover.js +54 -0
  82. package/dist/popup-CLsuJ-AA.js +6 -0
  83. package/dist/progress.d.ts +8 -0
  84. package/dist/progress.js +36 -0
  85. package/dist/radio-group.d.ts +14 -0
  86. package/dist/radio-group.js +25 -0
  87. package/dist/scroll-area.d.ts +16 -0
  88. package/dist/scroll-area.js +52 -0
  89. package/dist/select-Cq_JDuYO.js +266 -0
  90. package/dist/select.d.ts +40 -0
  91. package/dist/select.js +1 -0
  92. package/dist/separator.d.ts +8 -0
  93. package/dist/separator.js +38 -0
  94. package/dist/sheet.d.ts +27 -0
  95. package/dist/sheet.js +95 -0
  96. package/dist/skeleton.d.ts +19 -0
  97. package/dist/skeleton.js +45 -0
  98. package/dist/spinner.d.ts +13 -0
  99. package/dist/spinner.js +44 -0
  100. package/dist/switch.d.ts +7 -0
  101. package/dist/switch.js +19 -0
  102. package/dist/table.d.ts +24 -0
  103. package/dist/table.js +75 -0
  104. package/dist/tabs.d.ts +24 -0
  105. package/dist/tabs.js +74 -0
  106. package/dist/textarea.d.ts +5 -0
  107. package/dist/textarea.js +15 -0
  108. package/dist/theme-toggle.d.ts +11 -0
  109. package/dist/theme-toggle.js +50 -0
  110. package/dist/toast.d.ts +12 -0
  111. package/dist/toast.js +105 -0
  112. package/dist/tooltip-BsVKZDXs.js +47 -0
  113. package/dist/tooltip.d.ts +18 -0
  114. package/dist/tooltip.js +1 -0
  115. package/dist/typography-Dy3PCTrL.js +34 -0
  116. package/dist/typography.d.ts +11 -0
  117. package/dist/typography.js +1 -0
  118. package/dist/visually-hidden-BrCs6ZEy.js +11 -0
  119. package/dist/visually-hidden.d.ts +3 -0
  120. package/dist/visually-hidden.js +1 -0
  121. package/docs/accessibility.md +95 -0
  122. package/docs/accordion.md +89 -0
  123. package/docs/alert-dialog.md +157 -0
  124. package/docs/alert.md +70 -0
  125. package/docs/avatar.md +57 -0
  126. package/docs/badge.md +51 -0
  127. package/docs/button.md +121 -0
  128. package/docs/calendar.md +116 -0
  129. package/docs/card.md +74 -0
  130. package/docs/chart.md +93 -0
  131. package/docs/checkbox.md +119 -0
  132. package/docs/collapsible.md +76 -0
  133. package/docs/command.md +114 -0
  134. package/docs/date-picker.md +177 -0
  135. package/docs/dialog.md +110 -0
  136. package/docs/dropdown-menu.md +126 -0
  137. package/docs/empty-state.md +65 -0
  138. package/docs/error-state.md +59 -0
  139. package/docs/field.md +54 -0
  140. package/docs/form-actions.md +55 -0
  141. package/docs/forms/formik.md +42 -0
  142. package/docs/forms/rhf.md +64 -0
  143. package/docs/icon-button.md +84 -0
  144. package/docs/icon.md +77 -0
  145. package/docs/input-group.md +47 -0
  146. package/docs/input.md +46 -0
  147. package/docs/label.md +33 -0
  148. package/docs/layout.md +102 -0
  149. package/docs/llms.txt +72 -0
  150. package/docs/native-select.md +87 -0
  151. package/docs/page-header.md +61 -0
  152. package/docs/pagination.md +107 -0
  153. package/docs/password-input.md +30 -0
  154. package/docs/popover.md +103 -0
  155. package/docs/progress.md +53 -0
  156. package/docs/radio-group.md +119 -0
  157. package/docs/scroll-area.md +85 -0
  158. package/docs/select.md +106 -0
  159. package/docs/separator.md +38 -0
  160. package/docs/sheet.md +118 -0
  161. package/docs/skeleton.md +50 -0
  162. package/docs/spinner.md +46 -0
  163. package/docs/switch.md +92 -0
  164. package/docs/table.md +87 -0
  165. package/docs/tabs.md +96 -0
  166. package/docs/textarea.md +38 -0
  167. package/docs/theme-toggle.md +76 -0
  168. package/docs/toast.md +95 -0
  169. package/docs/tooltip.md +101 -0
  170. package/docs/typography.md +96 -0
  171. package/docs/visually-hidden.md +44 -0
  172. package/layer.css +22 -0
  173. package/package.json +275 -3
  174. package/skills/eod-ui/SKILL.md +37 -0
  175. package/styles.css +2 -0
  176. package/README.md +0 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 EOD Parks
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,36 @@
1
+ import { Accordion as Accordion$1, AccordionItem as AccordionItem$1, AccordionPanel, AccordionTrigger as AccordionTrigger$1 } from "@ui-sdk/react/accordion";
2
+ import { ComponentProps, ReactNode } from "react";
3
+ type UIAccordionProps = ComponentProps<typeof Accordion$1>;
4
+ type ValueDetails = Parameters<NonNullable<UIAccordionProps["onValueChange"]>>[1];
5
+ type Shared = Omit<UIAccordionProps, "value" | "defaultValue" | "onValueChange" | "multiple" | "collapsible">;
6
+ type SingleProps = Shared & {
7
+ type: "single";
8
+ /** The open item, or `""` for none. */
9
+ value?: string;
10
+ defaultValue?: string;
11
+ onValueChange?: (value: string, details: ValueDetails) => void;
12
+ /** Whether the open item can be closed again. */
13
+ collapsible?: boolean;
14
+ };
15
+ type MultipleProps = Shared & {
16
+ type: "multiple";
17
+ value?: string[];
18
+ defaultValue?: string[];
19
+ onValueChange?: (value: string[], details: ValueDetails) => void;
20
+ };
21
+ type AccordionProps = SingleProps | MultipleProps;
22
+ declare function Accordion(props: AccordionProps): import("react").JSX.Element;
23
+ type AccordionItemProps = ComponentProps<typeof AccordionItem$1>;
24
+ declare function AccordionItem({ className, ...props }: AccordionItemProps): import("react").JSX.Element;
25
+ type AccordionTriggerProps = Omit<ComponentProps<typeof AccordionTrigger$1>, "children"> & {
26
+ children?: ReactNode;
27
+ /** The heading level that holds the trigger; pick one that fits the page outline. */
28
+ level?: 2 | 3 | 4 | 5 | 6;
29
+ };
30
+ declare function AccordionTrigger({ level, className, children, ...props }: AccordionTriggerProps): import("react").JSX.Element;
31
+ type AccordionContentProps = Omit<ComponentProps<typeof AccordionPanel>, "className" | "children"> & {
32
+ className?: string;
33
+ children?: ReactNode;
34
+ };
35
+ declare function AccordionContent({ className, children, ...props }: AccordionContentProps): import("react").JSX.Element;
36
+ export { Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps };
@@ -0,0 +1,57 @@
1
+ import { Accordion as Accordion$1, AccordionHeader, AccordionItem as AccordionItem$1, AccordionPanel, AccordionTrigger as AccordionTrigger$1 } from "@ui-sdk/react/accordion";
2
+ import { ChevronDownIcon } from "lucide-react";
3
+ import { createElement } from "react";
4
+ import { n as withBase, t as cn } from "./cn-B-fHM4Ov.js";
5
+ import { t as focusRing } from "./focus-ring-BpxMbGAn.js";
6
+ import { n as textVariants } from "./typography-Dy3PCTrL.js";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ // src/accordion/accordion.tsx
9
+ const list = (item) => item === void 0 ? void 0 : item ? [item] : [];
10
+ function Accordion(props) {
11
+ if (props.type === "multiple") {
12
+ const { type: _, ...rest } = props;
13
+ return /* @__PURE__ */ jsx(Accordion$1, {
14
+ ...rest,
15
+ multiple: true
16
+ });
17
+ }
18
+ const { type: _, value, defaultValue, onValueChange, collapsible = false, ...rest } = props;
19
+ return /* @__PURE__ */ jsx(Accordion$1, {
20
+ ...rest,
21
+ collapsible,
22
+ value: list(value),
23
+ defaultValue: list(defaultValue),
24
+ onValueChange: (next, details) => onValueChange?.(next[0] ?? "", details)
25
+ });
26
+ }
27
+ function AccordionItem({ className, ...props }) {
28
+ return /* @__PURE__ */ jsx(AccordionItem$1, {
29
+ ...props,
30
+ className: withBase("border-b", className)
31
+ });
32
+ }
33
+ function AccordionTrigger({ level = 3, className, children, ...props }) {
34
+ return /* @__PURE__ */ jsx(AccordionHeader, {
35
+ render: createElement(`h${level}`),
36
+ className: "flex",
37
+ children: /* @__PURE__ */ jsxs(AccordionTrigger$1, {
38
+ ...props,
39
+ className: withBase(cn(textVariants({ variant: "label" }), "flex flex-1 items-center justify-between gap-4 rounded-item py-4 text-start", focusRing, "hover:underline data-disabled:cursor-not-allowed data-disabled:hover:no-underline data-disabled:opacity-50", "data-open:[&>svg]:rotate-180"), className),
40
+ children: [children, /* @__PURE__ */ jsx(ChevronDownIcon, {
41
+ "aria-hidden": true,
42
+ className: "size-4 shrink-0 transition-transform duration-200 motion-reduce:transition-none"
43
+ })]
44
+ })
45
+ });
46
+ }
47
+ function AccordionContent({ className, children, ...props }) {
48
+ return /* @__PURE__ */ jsx(AccordionPanel, {
49
+ ...props,
50
+ className: "h-(--accordion-panel-height) overflow-hidden text-sm transition-[height] duration-200 data-ending-style:h-0 data-starting-style:h-0 motion-reduce:transition-none",
51
+ children: /* @__PURE__ */ jsx("div", {
52
+ className: cn("pb-4", className),
53
+ children
54
+ })
55
+ });
56
+ }
57
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
@@ -0,0 +1,50 @@
1
+ import { AlertDialog as AlertDialog$1, AlertDialogClose, AlertDialogContent as AlertDialogContent$1, AlertDialogController, AlertDialogDescription as AlertDialogDescription$1, AlertDialogTitle as AlertDialogTitle$1, AlertDialogTrigger as AlertDialogTrigger$1, createAlertDialogController } from "@ui-sdk/react/alert-dialog";
2
+ import { PartProps } from "@ui-sdk/react/primitive";
3
+ import { ComponentProps, ReactNode } from "react";
4
+ type AlertDialogProps = ComponentProps<typeof AlertDialog$1>;
5
+ declare function AlertDialog(props: AlertDialogProps): import("react").JSX.Element;
6
+ type AlertDialogTriggerProps = ComponentProps<typeof AlertDialogTrigger$1>;
7
+ declare function AlertDialogTrigger(props: AlertDialogTriggerProps): import("react").JSX.Element;
8
+ type UIContentProps<Payload> = Parameters<typeof AlertDialogContent$1<Payload>>[0];
9
+ type AlertDialogContentProps<Payload = unknown> = UIContentProps<Payload> & {
10
+ size?: "sm" | "md";
11
+ };
12
+ declare function AlertDialogContent<Payload = unknown>({ size, inline, className, children, ...props }: AlertDialogContentProps<Payload>): import("react").JSX.Element;
13
+ declare function AlertDialogHeader({ className, ...props }: PartProps<"div">): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
14
+ declare function AlertDialogFooter({ className, ...props }: PartProps<"div">): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
15
+ type AlertDialogTitleProps = ComponentProps<typeof AlertDialogTitle$1>;
16
+ declare function AlertDialogTitle({ className, ...props }: AlertDialogTitleProps): import("react").JSX.Element;
17
+ type AlertDialogDescriptionProps = ComponentProps<typeof AlertDialogDescription$1>;
18
+ declare function AlertDialogDescription({ className, ...props }: AlertDialogDescriptionProps): import("react").JSX.Element;
19
+ type CloseProps = ComponentProps<typeof AlertDialogClose>;
20
+ type AlertDialogActionProps = CloseProps & {
21
+ variant?: "default" | "destructive";
22
+ };
23
+ declare function AlertDialogAction({ variant, value, disabled, className, children, ...props }: AlertDialogActionProps): import("react").JSX.Element;
24
+ declare function AlertDialogCancel({ className, ...props }: CloseProps): import("react").JSX.Element;
25
+ type AlertDialogConfirmFieldProps = Omit<PartProps<"div">, "children"> & {
26
+ /** The text a person must type before the confirm action is enabled. */
27
+ phrase: string;
28
+ /** The field's label. */
29
+ label?: ReactNode;
30
+ };
31
+ declare function AlertDialogConfirmField({ phrase, label, className, ...props }: AlertDialogConfirmFieldProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
32
+ type ConfirmOptions = {
33
+ /** The question, such as "Delete this project?". */
34
+ title: string;
35
+ /** What agreeing does, and whether it can be undone. */
36
+ description?: string;
37
+ confirmLabel?: string;
38
+ cancelLabel?: string;
39
+ /** Styles the confirm action as destructive. */
40
+ destructive?: boolean;
41
+ /** A phrase to type before the confirm action is enabled. */
42
+ typeToConfirm?: string;
43
+ /** The label of the type-to-confirm field. */
44
+ typeToConfirmLabel?: string;
45
+ };
46
+ /** Asks a question through the `ConfirmHost` and resolves `true` when the person confirms. */
47
+ declare function confirm(options: ConfirmOptions): Promise<boolean>;
48
+ /** Renders every `confirm()` question. Mount it once near the root of the app. */
49
+ declare function ConfirmHost(): import("react").JSX.Element;
50
+ export { AlertDialog, AlertDialogAction, type AlertDialogActionProps, AlertDialogCancel, AlertDialogConfirmField, type AlertDialogConfirmFieldProps, AlertDialogContent, type AlertDialogContentProps, type AlertDialogController, AlertDialogDescription, type AlertDialogDescriptionProps, AlertDialogFooter, AlertDialogHeader, type AlertDialogProps, AlertDialogTitle, type AlertDialogTitleProps, AlertDialogTrigger, type AlertDialogTriggerProps, ConfirmHost, type ConfirmOptions, confirm, createAlertDialogController };
@@ -0,0 +1,149 @@
1
+ import { AlertDialog as AlertDialog$1, AlertDialogBackdrop, AlertDialogClose, AlertDialogContent as AlertDialogContent$1, AlertDialogDescription as AlertDialogDescription$1, AlertDialogTitle as AlertDialogTitle$1, AlertDialogTrigger as AlertDialogTrigger$1, createAlertDialogController, createConfirm } from "@ui-sdk/react/alert-dialog";
2
+ import { renderElement } from "@ui-sdk/react/primitive";
3
+ import { LoaderCircleIcon } from "lucide-react";
4
+ import { createContext, use, useEffect, useId, useState } from "react";
5
+ import { n as buttonVariants } from "./button-DEsRlveL.js";
6
+ import { u as dialogContentVariants } from "./dialog-JjpMFEDR.js";
7
+ import { n as withBase, t as cn } from "./cn-B-fHM4Ov.js";
8
+ import { t as focusRing } from "./focus-ring-BpxMbGAn.js";
9
+ import { n as textVariants } from "./typography-Dy3PCTrL.js";
10
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
+ // src/alert-dialog/alert-dialog.tsx
12
+ function AlertDialog(props) {
13
+ return /* @__PURE__ */ jsx(AlertDialog$1, { ...props });
14
+ }
15
+ function AlertDialogTrigger(props) {
16
+ return /* @__PURE__ */ jsx(AlertDialogTrigger$1, { ...props });
17
+ }
18
+ const Blocked = createContext({
19
+ blocked: false,
20
+ setBlocked: () => {}
21
+ });
22
+ function AlertDialogContent({ size = "md", inline = false, className, children, ...props }) {
23
+ const [blocked, setBlocked] = useState(false);
24
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(AlertDialogBackdrop, {
25
+ render: /* @__PURE__ */ jsx("div", { "data-slot": "alert-dialog-overlay" }),
26
+ className: cn(inline ? "absolute" : "fixed", "inset-0 m-0 bg-overlay/80 transition-opacity duration-150 data-starting-style:opacity-0 data-ending-style:opacity-0 motion-reduce:duration-0")
27
+ }), /* @__PURE__ */ jsx(AlertDialogContent$1, {
28
+ ...props,
29
+ inline,
30
+ className: withBase(dialogContentVariants({
31
+ size,
32
+ inline
33
+ }), className),
34
+ children: (state) => /* @__PURE__ */ jsx(Blocked, {
35
+ value: {
36
+ blocked,
37
+ setBlocked
38
+ },
39
+ children: typeof children === "function" ? children(state) : children
40
+ })
41
+ })] });
42
+ }
43
+ function AlertDialogHeader({ className, ...props }) {
44
+ return renderElement("div", {
45
+ ...props,
46
+ "data-slot": "alert-dialog-header",
47
+ className: withBase("flex flex-col gap-1.5", className)
48
+ }, props.render);
49
+ }
50
+ function AlertDialogFooter({ className, ...props }) {
51
+ return renderElement("div", {
52
+ ...props,
53
+ "data-slot": "alert-dialog-footer",
54
+ className: withBase("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)
55
+ }, props.render);
56
+ }
57
+ function AlertDialogTitle({ className, ...props }) {
58
+ return /* @__PURE__ */ jsx(AlertDialogTitle$1, {
59
+ ...props,
60
+ className: withBase(textVariants({ variant: "section-title" }), className)
61
+ });
62
+ }
63
+ function AlertDialogDescription({ className, ...props }) {
64
+ return /* @__PURE__ */ jsx(AlertDialogDescription$1, {
65
+ ...props,
66
+ className: withBase(cn(textVariants({ variant: "small" }), "text-muted-foreground"), className)
67
+ });
68
+ }
69
+ function AlertDialogAction({ variant = "default", value = "confirm", disabled, className, children, ...props }) {
70
+ const { blocked } = use(Blocked);
71
+ return /* @__PURE__ */ jsx(AlertDialogClose, {
72
+ ...props,
73
+ value,
74
+ disabled: disabled || blocked,
75
+ "data-variant": variant,
76
+ className: withBase(cn(buttonVariants({ variant }), "disabled:cursor-not-allowed disabled:opacity-50"), className),
77
+ children: (state) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
78
+ className: "truncate",
79
+ children: typeof children === "function" ? children(state) : children
80
+ }), /* @__PURE__ */ jsx(LoaderCircleIcon, {
81
+ "data-slot": "button-spinner",
82
+ "aria-hidden": "true",
83
+ className: "absolute inset-0 m-auto hidden animate-spin motion-reduce:animate-none in-data-pending:block"
84
+ })] })
85
+ });
86
+ }
87
+ function AlertDialogCancel({ className, ...props }) {
88
+ return /* @__PURE__ */ jsx(AlertDialogClose, {
89
+ ...props,
90
+ className: withBase(buttonVariants({ variant: "outline" }), className)
91
+ });
92
+ }
93
+ function AlertDialogConfirmField({ phrase, label = `Type ${phrase} to confirm`, className, ...props }) {
94
+ const [value, setValue] = useState("");
95
+ const { setBlocked } = use(Blocked);
96
+ const id = useId();
97
+ useEffect(() => {
98
+ setBlocked(value !== phrase);
99
+ return () => setBlocked(false);
100
+ }, [
101
+ value,
102
+ phrase,
103
+ setBlocked
104
+ ]);
105
+ return renderElement("div", {
106
+ ...props,
107
+ "data-slot": "alert-dialog-confirm-field",
108
+ className: withBase("flex flex-col gap-1.5", className),
109
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("label", {
110
+ htmlFor: id,
111
+ className: textVariants({ variant: "label" }),
112
+ children: label
113
+ }), /* @__PURE__ */ jsx("input", {
114
+ id,
115
+ value,
116
+ onChange: (event) => setValue(event.currentTarget.value),
117
+ autoComplete: "off",
118
+ autoCapitalize: "off",
119
+ spellCheck: false,
120
+ className: cn("h-(--control-h) w-full min-w-0 rounded-control border border-input bg-background px-3 text-sm text-foreground", focusRing)
121
+ })] })
122
+ }, props.render);
123
+ }
124
+ const ask = createConfirm();
125
+ /** Asks a question through the `ConfirmHost` and resolves `true` when the person confirms. */
126
+ function confirm(options) {
127
+ return ask(options);
128
+ }
129
+ /** Renders every `confirm()` question. Mount it once near the root of the app. */
130
+ function ConfirmHost() {
131
+ return /* @__PURE__ */ jsx(AlertDialog, {
132
+ controller: ask.controller,
133
+ children: /* @__PURE__ */ jsx(AlertDialogContent, {
134
+ size: "sm",
135
+ children: ({ payload }) => payload && /* @__PURE__ */ jsxs(Fragment, { children: [
136
+ /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: payload.title }), payload.description && /* @__PURE__ */ jsx(AlertDialogDescription, { children: payload.description })] }),
137
+ payload.typeToConfirm && /* @__PURE__ */ jsx(AlertDialogConfirmField, {
138
+ phrase: payload.typeToConfirm,
139
+ label: payload.typeToConfirmLabel
140
+ }),
141
+ /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [/* @__PURE__ */ jsx(AlertDialogCancel, { children: payload.cancelLabel ?? "Cancel" }), /* @__PURE__ */ jsx(AlertDialogAction, {
142
+ variant: payload.destructive ? "destructive" : "default",
143
+ children: payload.confirmLabel ?? "Confirm"
144
+ })] })
145
+ ] })
146
+ })
147
+ });
148
+ }
149
+ export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogConfirmField, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, ConfirmHost, confirm, createAlertDialogController };
@@ -0,0 +1,23 @@
1
+ import { PartProps } from "@ui-sdk/react/primitive";
2
+ import { ReactNode } from "react";
3
+ type Variant = "info" | "success" | "warning" | "destructive";
4
+ declare const alertVariants: (props?: ({
5
+ variant?: "destructive" | "info" | "success" | "warning" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ type AlertProps = Omit<PartProps<"div">, "children"> & {
8
+ variant?: Variant;
9
+ /** The icon repeats the type so colour is not the only signal. `false` hides it. */
10
+ icon?: ReactNode | false;
11
+ /** Shows a close button that hides the alert. */
12
+ dismissible?: boolean;
13
+ onDismiss?: () => void;
14
+ /** Accessible name of the close button. */
15
+ dismissLabel?: string;
16
+ children?: ReactNode;
17
+ };
18
+ declare function Alert({ variant, icon, dismissible, onDismiss, dismissLabel, render, className, children, ...props }: AlertProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
19
+ declare function AlertTitle({ render, className, ...props }: PartProps<"div">): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
20
+ declare function AlertDescription({ render, className, ...props }: PartProps<"div">): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
21
+ /** One link or button for the next step, under the text. A button edge takes the text colour so it stays 3:1 on the fill. */
22
+ declare function AlertAction({ render, className, ...props }: PartProps<"div">): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
23
+ export { Alert, AlertAction, AlertDescription, type AlertProps, AlertTitle, alertVariants };
package/dist/alert.js ADDED
@@ -0,0 +1,87 @@
1
+ import { renderElement } from "@ui-sdk/react/primitive";
2
+ import { cva } from "class-variance-authority";
3
+ import { CircleAlertIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon, XIcon } from "lucide-react";
4
+ import { useState } from "react";
5
+ import { t as Button } from "./button-DEsRlveL.js";
6
+ import { n as withBase } from "./cn-B-fHM4Ov.js";
7
+ import { n as textVariants } from "./typography-Dy3PCTrL.js";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ // src/alert/alert.tsx
10
+ const alertVariants = cva("flex w-full items-start gap-3 rounded-surface border p-4", {
11
+ variants: { variant: {
12
+ info: "border-info-border bg-info-subtle text-info-subtle-foreground",
13
+ success: "border-success-border bg-success-subtle text-success-subtle-foreground",
14
+ warning: "border-warning-border bg-warning-subtle text-warning-subtle-foreground",
15
+ destructive: "border-destructive-border bg-destructive-subtle text-destructive-subtle-foreground"
16
+ } },
17
+ defaultVariants: { variant: "info" }
18
+ });
19
+ const icons = {
20
+ info: InfoIcon,
21
+ success: CircleCheckIcon,
22
+ warning: TriangleAlertIcon,
23
+ destructive: CircleAlertIcon
24
+ };
25
+ const roles = {
26
+ info: "status",
27
+ success: "status",
28
+ warning: "alert",
29
+ destructive: "alert"
30
+ };
31
+ function Alert({ variant = "info", icon, dismissible = false, onDismiss, dismissLabel = "Dismiss", render, className, children, ...props }) {
32
+ const [dismissed, setDismissed] = useState(false);
33
+ if (dismissed) return null;
34
+ const Glyph = icons[variant];
35
+ return renderElement("div", {
36
+ role: roles[variant],
37
+ ...props,
38
+ "data-slot": "alert",
39
+ "data-variant": variant,
40
+ className: withBase(alertVariants({ variant }), className),
41
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [
42
+ icon !== false && /* @__PURE__ */ jsx("span", {
43
+ "aria-hidden": "true",
44
+ className: "flex h-5 shrink-0 items-center [&_svg]:size-4",
45
+ children: icon ?? /* @__PURE__ */ jsx(Glyph, {})
46
+ }),
47
+ /* @__PURE__ */ jsx("div", {
48
+ className: "flex min-w-0 flex-1 flex-col gap-1",
49
+ children
50
+ }),
51
+ dismissible && /* @__PURE__ */ jsx(Button, {
52
+ variant: "ghost",
53
+ size: "icon-xs",
54
+ "aria-label": dismissLabel,
55
+ className: "-my-0.5 -me-1 shrink-0 text-current",
56
+ onClick: () => {
57
+ setDismissed(true);
58
+ onDismiss?.();
59
+ },
60
+ children: /* @__PURE__ */ jsx(XIcon, {})
61
+ })
62
+ ] })
63
+ }, render);
64
+ }
65
+ function AlertTitle({ render, className, ...props }) {
66
+ return renderElement("div", {
67
+ ...props,
68
+ "data-slot": "alert-title",
69
+ className: withBase(`${textVariants({ variant: "label" })} wrap-anywhere`, className)
70
+ }, render);
71
+ }
72
+ function AlertDescription({ render, className, ...props }) {
73
+ return renderElement("div", {
74
+ ...props,
75
+ "data-slot": "alert-description",
76
+ className: withBase(`${textVariants({ variant: "small" })} wrap-anywhere`, className)
77
+ }, render);
78
+ }
79
+ /** One link or button for the next step, under the text. A button edge takes the text colour so it stays 3:1 on the fill. */
80
+ function AlertAction({ render, className, ...props }) {
81
+ return renderElement("div", {
82
+ ...props,
83
+ "data-slot": "alert-action",
84
+ className: withBase("flex flex-wrap items-center gap-2 pt-1 [&_button]:border-current", className)
85
+ }, render);
86
+ }
87
+ export { Alert, AlertAction, AlertDescription, AlertTitle, alertVariants };
@@ -0,0 +1,35 @@
1
+ import { Avatar as Avatar$1, AvatarFallback as AvatarFallback$1, AvatarImage as AvatarImage$1 } from "@ui-sdk/react/avatar";
2
+ import { PartProps } from "@ui-sdk/react/primitive";
3
+ import { ComponentProps, ReactNode } from "react";
4
+ type Size = "sm" | "md" | "lg";
5
+ type Status = "online" | "away" | "busy" | "offline";
6
+ declare const avatarVariants: (props?: ({
7
+ size?: "sm" | "lg" | "md" | null | undefined;
8
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
+ type AvatarProps = Omit<ComponentProps<typeof Avatar$1>, "children"> & {
10
+ children?: ReactNode;
11
+ size?: Size;
12
+ /** A presence dot on the bottom end corner. */
13
+ status?: Status;
14
+ /** Names the dot for assistive technology. */
15
+ statusLabel?: string;
16
+ };
17
+ declare function Avatar({ size, status, statusLabel, className, children, ...props }: AvatarProps): import("react").JSX.Element;
18
+ declare function AvatarImage({ className, ...props }: ComponentProps<typeof AvatarImage$1>): import("react").JSX.Element;
19
+ type AvatarFallbackProps = Omit<ComponentProps<typeof AvatarFallback$1>, "children"> & {
20
+ children?: ReactNode;
21
+ /** Names the avatar for assistive technology. The visible children are hidden from it. */
22
+ label?: string;
23
+ };
24
+ /** Initials as children, or no children for the person icon. */
25
+ declare function AvatarFallback({ label, className, children, ...props }: AvatarFallbackProps): import("react").JSX.Element;
26
+ type AvatarGroupProps = PartProps<"div"> & {
27
+ size?: Size;
28
+ /** Avatars shown before the rest collapse into a `+N` avatar. */
29
+ max?: number;
30
+ /** Names the group and the overflow avatar's hidden text. Receives the hidden count. */
31
+ overflowLabel?: (hidden: number) => string;
32
+ children?: ReactNode;
33
+ };
34
+ declare function AvatarGroup({ size, max, overflowLabel, render, className, children, ...props }: AvatarGroupProps): import("react").JSX.Element;
35
+ export { Avatar, AvatarFallback, type AvatarFallbackProps, AvatarGroup, type AvatarGroupProps, AvatarImage, type AvatarProps, avatarVariants };
package/dist/avatar.js ADDED
@@ -0,0 +1,118 @@
1
+ import { Avatar as Avatar$1, AvatarFallback as AvatarFallback$1, AvatarImage as AvatarImage$1 } from "@ui-sdk/react/avatar";
2
+ import { renderElement } from "@ui-sdk/react/primitive";
3
+ import { cva } from "class-variance-authority";
4
+ import { UserIcon } from "lucide-react";
5
+ import { Children, createContext, isValidElement, use } from "react";
6
+ import { n as withBase, t as cn } from "./cn-B-fHM4Ov.js";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ // src/avatar/avatar.tsx
9
+ const SizeContext = createContext("md");
10
+ const avatarVariants = cva("group/avatar relative inline-flex shrink-0 select-none", {
11
+ variants: { size: {
12
+ sm: "size-8",
13
+ md: "size-10",
14
+ lg: "size-12"
15
+ } },
16
+ defaultVariants: { size: "md" }
17
+ });
18
+ const statusColour = {
19
+ online: "bg-success",
20
+ away: "bg-warning",
21
+ busy: "bg-destructive",
22
+ offline: "bg-muted-foreground"
23
+ };
24
+ const statusMark = {
25
+ online: null,
26
+ away: /* @__PURE__ */ jsx("path", {
27
+ d: "M6 3v3l2 1.5",
28
+ className: "fill-none stroke-warning-foreground",
29
+ strokeWidth: "1.5",
30
+ strokeLinecap: "round"
31
+ }),
32
+ busy: /* @__PURE__ */ jsx("path", {
33
+ d: "M3 6h6",
34
+ className: "fill-none stroke-destructive-foreground",
35
+ strokeWidth: "1.5",
36
+ strokeLinecap: "round"
37
+ }),
38
+ offline: /* @__PURE__ */ jsx("circle", {
39
+ cx: "6",
40
+ cy: "6",
41
+ r: "2.5",
42
+ className: "fill-background"
43
+ })
44
+ };
45
+ function Avatar({ size, status, statusLabel, className, children, ...props }) {
46
+ const inherited = use(SizeContext);
47
+ const resolved = size ?? inherited;
48
+ return /* @__PURE__ */ jsxs(Avatar$1, {
49
+ ...props,
50
+ "data-size": resolved,
51
+ className: withBase(avatarVariants({ size: resolved }), className),
52
+ children: [children, status && /* @__PURE__ */ jsx("span", {
53
+ role: "img",
54
+ "aria-label": statusLabel ?? status[0]?.toUpperCase() + status.slice(1),
55
+ "data-slot": "avatar-status",
56
+ "data-status": status,
57
+ className: cn("absolute end-0 bottom-0 flex size-3 items-center justify-center rounded-full ring-2 ring-background", statusColour[status]),
58
+ children: /* @__PURE__ */ jsx("svg", {
59
+ "aria-hidden": "true",
60
+ viewBox: "0 0 12 12",
61
+ className: "size-full",
62
+ children: statusMark[status]
63
+ })
64
+ })]
65
+ });
66
+ }
67
+ function AvatarImage({ className, ...props }) {
68
+ return /* @__PURE__ */ jsx(AvatarImage$1, {
69
+ ...props,
70
+ className: withBase("size-full rounded-full object-cover", className)
71
+ });
72
+ }
73
+ /** Initials as children, or no children for the person icon. */
74
+ function AvatarFallback({ label, className, children, ...props }) {
75
+ return /* @__PURE__ */ jsxs(AvatarFallback$1, {
76
+ ...props,
77
+ className: withBase("flex size-full items-center justify-center rounded-full bg-muted text-sm/5 font-medium text-muted-foreground group-data-[size=lg]/avatar:text-base/6 group-data-[size=sm]/avatar:text-xs/4 [&_svg]:size-5 group-data-[size=sm]/avatar:[&_svg]:size-4", className),
78
+ children: [/* @__PURE__ */ jsx("span", {
79
+ "aria-hidden": "true",
80
+ className: "contents",
81
+ children: children ?? /* @__PURE__ */ jsx(UserIcon, {})
82
+ }), label && /* @__PURE__ */ jsx("span", {
83
+ className: "sr-only",
84
+ children: label
85
+ })]
86
+ });
87
+ }
88
+ const keyOf = (node) => isValidElement(node) ? node.key : null;
89
+ function AvatarGroup({ size = "md", max = 4, overflowLabel = (hidden) => `${hidden} more`, render, className, children, ...props }) {
90
+ const avatars = Children.toArray(children);
91
+ const shown = avatars.length > max ? avatars.slice(0, max) : avatars;
92
+ const hidden = avatars.length - shown.length;
93
+ const item = "-ms-2 rounded-full ring-2 ring-background first:ms-0";
94
+ return /* @__PURE__ */ jsx(SizeContext, {
95
+ value: size,
96
+ children: renderElement("div", {
97
+ role: "group",
98
+ ...props,
99
+ "data-slot": "avatar-group",
100
+ "data-size": size,
101
+ className: withBase("flex items-center", className),
102
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [shown.map((avatar) => /* @__PURE__ */ jsx("span", {
103
+ className: item,
104
+ children: avatar
105
+ }, keyOf(avatar))), hidden > 0 && /* @__PURE__ */ jsx("span", {
106
+ className: item,
107
+ children: /* @__PURE__ */ jsx(Avatar, {
108
+ "data-overflow": "",
109
+ children: /* @__PURE__ */ jsx(AvatarFallback, {
110
+ label: overflowLabel(hidden),
111
+ children: /* @__PURE__ */ jsx("bdi", { children: `+${hidden}` })
112
+ })
113
+ })
114
+ })] })
115
+ }, render)
116
+ });
117
+ }
118
+ export { Avatar, AvatarFallback, AvatarGroup, AvatarImage, avatarVariants };
@@ -0,0 +1,27 @@
1
+ import { PartProps } from "@ui-sdk/react/primitive";
2
+ import { VariantProps } from "class-variance-authority";
3
+ import { ReactNode } from "react";
4
+ declare const badgeVariants: (props?: ({
5
+ variant?: "default" | "secondary" | "outline" | "destructive" | "info" | "success" | "warning" | "highlight" | null | undefined;
6
+ subtle?: boolean | null | undefined;
7
+ shape?: "label" | "count" | "dot" | null | undefined;
8
+ offset?: boolean | null | undefined;
9
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
10
+ type BadgeProps = Omit<PartProps<"span">, "children"> & Pick<VariantProps<typeof badgeVariants>, "variant"> & {
11
+ children?: ReactNode;
12
+ /** A tinted fill with a border of the same intent, for lists where a solid fill is loud. */
13
+ subtle?: boolean;
14
+ /** Shows a number, `99+` above `max`. A count of 0 renders nothing. */
15
+ count?: number;
16
+ max?: number;
17
+ /** A plain dot with no text. Name it with `label`, or leave it decorative. */
18
+ dot?: boolean;
19
+ /** Names a dot or a count for assistive technology, such as "unread messages". */
20
+ label?: string;
21
+ /** Pins the badge to the top end corner of a `BadgeAnchor`. */
22
+ offset?: boolean;
23
+ };
24
+ declare function Badge({ variant, subtle: isSubtle, count, max, dot, label, offset, render, className, children, ...props }: BadgeProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
25
+ /** The element a badge is pinned to. It places the badge and adds no space of its own. */
26
+ declare function BadgeAnchor({ render, className, ...props }: PartProps<"span">): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
27
+ export { Badge, BadgeAnchor, type BadgeProps, badgeVariants };