@arcfusionz/arc-primitive-ui 0.1.0 → 0.2.1

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 (135) hide show
  1. package/dist/components/AILoader/AILoader.d.ts +32 -0
  2. package/dist/components/AILoader/AILoader.js +157 -0
  3. package/dist/components/AILoader/index.d.ts +2 -0
  4. package/dist/components/AILoader/index.js +2 -0
  5. package/dist/components/Accordion/Accordion.d.ts +96 -0
  6. package/dist/components/Accordion/Accordion.js +149 -0
  7. package/dist/components/Accordion/index.d.ts +2 -0
  8. package/dist/components/Accordion/index.js +2 -0
  9. package/dist/components/Avatar/Avatar.d.ts +152 -0
  10. package/dist/components/Avatar/Avatar.js +216 -0
  11. package/dist/components/Avatar/index.d.ts +2 -0
  12. package/dist/components/Avatar/index.js +2 -0
  13. package/dist/components/Badge/Badge.d.ts +87 -0
  14. package/dist/components/Badge/Badge.js +118 -0
  15. package/dist/components/Badge/index.d.ts +2 -0
  16. package/dist/components/Badge/index.js +2 -0
  17. package/dist/components/Breadcrumb/Breadcrumb.d.ts +109 -0
  18. package/dist/components/Breadcrumb/Breadcrumb.js +182 -0
  19. package/dist/components/Breadcrumb/index.d.ts +2 -0
  20. package/dist/components/Breadcrumb/index.js +2 -0
  21. package/dist/components/Button/Button.d.ts +57 -0
  22. package/dist/components/Button/Button.js +177 -0
  23. package/dist/components/Button/index.d.ts +2 -0
  24. package/dist/components/Button/index.js +2 -0
  25. package/dist/components/Calendar/Calendar.d.ts +140 -0
  26. package/dist/components/Calendar/Calendar.js +468 -0
  27. package/dist/components/Calendar/index.d.ts +2 -0
  28. package/dist/components/Calendar/index.js +2 -0
  29. package/dist/components/Checkbox/Checkbox.d.ts +60 -0
  30. package/dist/components/Checkbox/Checkbox.js +129 -0
  31. package/dist/components/Checkbox/index.d.ts +2 -0
  32. package/dist/components/Checkbox/index.js +2 -0
  33. package/dist/components/Combobox/Combobox.d.ts +251 -0
  34. package/dist/components/Combobox/Combobox.js +354 -0
  35. package/dist/components/Combobox/index.d.ts +2 -0
  36. package/dist/components/Combobox/index.js +2 -0
  37. package/dist/components/ContextMenu/ContextMenu.d.ts +129 -0
  38. package/dist/components/ContextMenu/ContextMenu.js +93 -0
  39. package/dist/components/ContextMenu/index.d.ts +2 -0
  40. package/dist/components/ContextMenu/index.js +2 -0
  41. package/dist/components/DatePicker/DatePicker.d.ts +109 -0
  42. package/dist/components/DatePicker/DatePicker.js +145 -0
  43. package/dist/components/DatePicker/index.d.ts +2 -0
  44. package/dist/components/DatePicker/index.js +2 -0
  45. package/dist/components/DateRangePicker/DateRangePicker.d.ts +107 -0
  46. package/dist/components/DateRangePicker/DateRangePicker.js +161 -0
  47. package/dist/components/DateRangePicker/index.d.ts +2 -0
  48. package/dist/components/DateRangePicker/index.js +2 -0
  49. package/dist/components/Dialog/Dialog.d.ts +112 -0
  50. package/dist/components/Dialog/Dialog.js +141 -0
  51. package/dist/components/Dialog/index.d.ts +2 -0
  52. package/dist/components/Dialog/index.js +2 -0
  53. package/dist/components/Drawer/Drawer.d.ts +188 -0
  54. package/dist/components/Drawer/Drawer.js +268 -0
  55. package/dist/components/Drawer/index.d.ts +2 -0
  56. package/dist/components/Drawer/index.js +2 -0
  57. package/dist/components/Field/Field.d.ts +123 -0
  58. package/dist/components/Field/Field.js +241 -0
  59. package/dist/components/Field/FieldContext.d.ts +43 -0
  60. package/dist/components/Field/FieldContext.js +28 -0
  61. package/dist/components/Field/index.d.ts +3 -0
  62. package/dist/components/Field/index.js +3 -0
  63. package/dist/components/Fieldset/Fieldset.d.ts +43 -0
  64. package/dist/components/Fieldset/Fieldset.js +48 -0
  65. package/dist/components/Fieldset/index.d.ts +2 -0
  66. package/dist/components/Fieldset/index.js +2 -0
  67. package/dist/components/Form/Form.d.ts +54 -0
  68. package/dist/components/Form/Form.js +57 -0
  69. package/dist/components/Form/index.d.ts +2 -0
  70. package/dist/components/Form/index.js +2 -0
  71. package/dist/components/Input/Input.d.ts +64 -0
  72. package/dist/components/Input/Input.js +111 -0
  73. package/dist/components/Input/index.d.ts +2 -0
  74. package/dist/components/Input/index.js +2 -0
  75. package/dist/components/Menu/Menu.d.ts +212 -0
  76. package/dist/components/Menu/Menu.js +255 -0
  77. package/dist/components/Menu/index.d.ts +2 -0
  78. package/dist/components/Menu/index.js +2 -0
  79. package/dist/components/Popover/Popover.d.ts +122 -0
  80. package/dist/components/Popover/Popover.js +116 -0
  81. package/dist/components/Popover/index.d.ts +2 -0
  82. package/dist/components/Popover/index.js +2 -0
  83. package/dist/components/Progress/Progress.d.ts +87 -0
  84. package/dist/components/Progress/Progress.js +73 -0
  85. package/dist/components/Progress/index.d.ts +2 -0
  86. package/dist/components/Progress/index.js +2 -0
  87. package/dist/components/Radio/Radio.d.ts +65 -0
  88. package/dist/components/Radio/Radio.js +93 -0
  89. package/dist/components/Radio/index.d.ts +2 -0
  90. package/dist/components/Radio/index.js +2 -0
  91. package/dist/components/Select/Select.d.ts +136 -0
  92. package/dist/components/Select/Select.js +219 -0
  93. package/dist/components/Select/index.d.ts +2 -0
  94. package/dist/components/Select/index.js +2 -0
  95. package/dist/components/Skeleton/Skeleton.d.ts +39 -0
  96. package/dist/components/Skeleton/Skeleton.js +44 -0
  97. package/dist/components/Skeleton/index.d.ts +2 -0
  98. package/dist/components/Skeleton/index.js +2 -0
  99. package/dist/components/Stepper/Stepper.d.ts +161 -0
  100. package/dist/components/Stepper/Stepper.js +344 -0
  101. package/dist/components/Stepper/index.d.ts +2 -0
  102. package/dist/components/Stepper/index.js +2 -0
  103. package/dist/components/Switch/Switch.d.ts +56 -0
  104. package/dist/components/Switch/Switch.js +87 -0
  105. package/dist/components/Switch/index.d.ts +2 -0
  106. package/dist/components/Switch/index.js +2 -0
  107. package/dist/components/Table/Table.d.ts +116 -0
  108. package/dist/components/Table/Table.js +143 -0
  109. package/dist/components/Table/index.d.ts +2 -0
  110. package/dist/components/Table/index.js +2 -0
  111. package/dist/components/Tabs/Tabs.d.ts +116 -0
  112. package/dist/components/Tabs/Tabs.js +158 -0
  113. package/dist/components/Tabs/index.d.ts +2 -0
  114. package/dist/components/Tabs/index.js +2 -0
  115. package/dist/components/Timeline/Timeline.d.ts +137 -0
  116. package/dist/components/Timeline/Timeline.js +243 -0
  117. package/dist/components/Timeline/index.d.ts +2 -0
  118. package/dist/components/Timeline/index.js +2 -0
  119. package/dist/components/Toast/Toast.d.ts +135 -0
  120. package/dist/components/Toast/Toast.js +314 -0
  121. package/dist/components/Toast/index.d.ts +2 -0
  122. package/dist/components/Toast/index.js +2 -0
  123. package/dist/components/Tooltip/Tooltip.d.ts +104 -0
  124. package/dist/components/Tooltip/Tooltip.js +95 -0
  125. package/dist/components/Tooltip/index.d.ts +2 -0
  126. package/dist/components/Tooltip/index.js +2 -0
  127. package/dist/components/Typography/Typography.d.ts +38 -0
  128. package/dist/components/Typography/Typography.js +53 -0
  129. package/dist/components/Typography/index.d.ts +2 -0
  130. package/dist/components/Typography/index.js +2 -0
  131. package/dist/index.d.ts +66 -3398
  132. package/dist/index.js +34 -5343
  133. package/dist/lib/cn.d.ts +6 -0
  134. package/dist/lib/cn.js +9 -0
  135. package/package.json +6 -2
@@ -0,0 +1,161 @@
1
+ import { cn } from "../../lib/cn.js";
2
+ import { Calendar } from "../Calendar/Calendar.js";
3
+ import { Popover, PopoverPopup, PopoverTrigger } from "../Popover/Popover.js";
4
+ import { datePickerVariants } from "../DatePicker/DatePicker.js";
5
+ import { forwardRef, useMemo, useRef, useState } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/components/DateRangePicker/DateRangePicker.tsx
8
+ /** Class list for an element styled as the DateRangePicker trigger. */
9
+ function dateRangePickerVariants({ variant = "outline", size = "md", fullWidth = false, className } = {}) {
10
+ return cn(datePickerVariants({
11
+ variant,
12
+ size,
13
+ fullWidth
14
+ }), !fullWidth && "w-72", className);
15
+ }
16
+ function CalendarRangeIcon(props) {
17
+ return /* @__PURE__ */ jsxs("svg", {
18
+ viewBox: "0 0 24 24",
19
+ fill: "none",
20
+ stroke: "currentColor",
21
+ strokeWidth: 2,
22
+ strokeLinecap: "round",
23
+ strokeLinejoin: "round",
24
+ "aria-hidden": "true",
25
+ ...props,
26
+ children: [
27
+ /* @__PURE__ */ jsx("path", { d: "M8 2v4M16 2v4M3 9h18" }),
28
+ /* @__PURE__ */ jsx("rect", {
29
+ x: "3",
30
+ y: "4",
31
+ width: "18",
32
+ height: "17",
33
+ rx: "2"
34
+ }),
35
+ /* @__PURE__ */ jsx("path", { d: "M7 14h3M14 14h3" })
36
+ ]
37
+ });
38
+ }
39
+ function mergeAnchorWidth(anchorWidth, style) {
40
+ if (anchorWidth == null) return style;
41
+ const anchorStyle = { width: anchorWidth };
42
+ return typeof style === "function" ? (state) => ({
43
+ ...anchorStyle,
44
+ ...style(state)
45
+ }) : {
46
+ ...anchorStyle,
47
+ ...style ?? {}
48
+ };
49
+ }
50
+ function createFormatter(locale, options) {
51
+ try {
52
+ return new Intl.DateTimeFormat(locale, options);
53
+ } catch {
54
+ return new Intl.DateTimeFormat(void 0, options);
55
+ }
56
+ }
57
+ function compareDays(a, b) {
58
+ return a.getFullYear() - b.getFullYear() || a.getMonth() - b.getMonth() || a.getDate() - b.getDate();
59
+ }
60
+ function orderRange(range) {
61
+ return compareDays(range.start, range.end) <= 0 ? range : {
62
+ start: range.end,
63
+ end: range.start
64
+ };
65
+ }
66
+ function toLocalISODate(date) {
67
+ return `${String(date.getFullYear()).padStart(4, "0")}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
68
+ }
69
+ const emptyDataAttribute = { "data-empty": "" };
70
+ const readOnlyDataAttribute = { "data-readonly": "" };
71
+ const DEFAULT_FORMAT_OPTIONS = { dateStyle: "medium" };
72
+ /**
73
+ * A localized date-range trigger with an ArcFusion Calendar in a Base UI Popover.
74
+ *
75
+ * The visible trigger text is always its baseline accessible name. Add
76
+ * `aria-label`/`aria-labelledby` when surrounding context (for example,
77
+ * "Booking dates") must be part of the name.
78
+ */
79
+ const DateRangePicker = forwardRef(({ value: valueProp, defaultValue = null, onValueChange, open, defaultOpen = false, onOpenChange, onOpenChangeComplete, closeOnSelect = true, placeholder = "Pick a date range", locale, formatOptions = DEFAULT_FORMAT_OPTIONS, formatValue, calendarLabel = "Choose date range", calendarProps, popupProps, popupClassName, variant = "outline", size = "md", fullWidth = false, anchorWidth, icon, disabled = false, readOnly = false, startName, endName, form, type = "button", style, className, ...rest }, ref) => {
80
+ const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue ? orderRange(defaultValue) : null);
81
+ const selectedRange = valueProp !== void 0 ? valueProp && orderRange(valueProp) : uncontrolledValue;
82
+ const actionsRef = useRef(null);
83
+ const popupRef = useRef(null);
84
+ const formatter = useMemo(() => createFormatter(locale, formatOptions), [locale, formatOptions]);
85
+ const valueText = selectedRange ? formatValue?.(selectedRange, locale) ?? formatter.formatRange(selectedRange.start, selectedRange.end) : placeholder;
86
+ const handleValueChange = (nextValue) => {
87
+ const orderedValue = nextValue && orderRange(nextValue);
88
+ if (valueProp === void 0) setUncontrolledValue(orderedValue);
89
+ onValueChange?.(orderedValue);
90
+ if (closeOnSelect && orderedValue) actionsRef.current?.close();
91
+ };
92
+ return /* @__PURE__ */ jsxs(Popover, {
93
+ actionsRef,
94
+ open,
95
+ defaultOpen,
96
+ onOpenChange,
97
+ onOpenChangeComplete,
98
+ children: [
99
+ /* @__PURE__ */ jsxs(PopoverTrigger, {
100
+ ref,
101
+ type,
102
+ disabled,
103
+ form,
104
+ style: mergeAnchorWidth(anchorWidth, style),
105
+ className: cn(dateRangePickerVariants({
106
+ variant,
107
+ size,
108
+ fullWidth
109
+ }), className),
110
+ ...!selectedRange ? emptyDataAttribute : void 0,
111
+ ...readOnly ? readOnlyDataAttribute : void 0,
112
+ ...rest,
113
+ children: [icon !== null && /* @__PURE__ */ jsx("span", {
114
+ "aria-hidden": "true",
115
+ className: "inline-flex shrink-0 text-muted-foreground",
116
+ children: icon ?? /* @__PURE__ */ jsx(CalendarRangeIcon, {})
117
+ }), /* @__PURE__ */ jsx("span", {
118
+ className: "min-w-0 flex-1 truncate text-left font-normal",
119
+ children: valueText
120
+ })]
121
+ }),
122
+ startName && /* @__PURE__ */ jsx("input", {
123
+ type: "hidden",
124
+ name: startName,
125
+ form,
126
+ disabled: disabled || void 0,
127
+ value: selectedRange ? toLocalISODate(selectedRange.start) : ""
128
+ }),
129
+ endName && /* @__PURE__ */ jsx("input", {
130
+ type: "hidden",
131
+ name: endName,
132
+ form,
133
+ disabled: disabled || void 0,
134
+ value: selectedRange ? toLocalISODate(selectedRange.end) : ""
135
+ }),
136
+ /* @__PURE__ */ jsx(PopoverPopup, {
137
+ ref: popupRef,
138
+ "aria-label": calendarLabel,
139
+ align: "start",
140
+ initialFocus: () => popupRef.current?.querySelector("[role=\"grid\"] button[tabindex=\"0\"]") ?? true,
141
+ ...popupProps,
142
+ className: cn("w-auto max-w-[var(--available-width)] p-0", popupClassName),
143
+ children: /* @__PURE__ */ jsx(Calendar, {
144
+ "aria-label": calendarLabel,
145
+ fixedWeeks: true,
146
+ numberOfMonths: 2,
147
+ ...calendarProps,
148
+ mode: "range",
149
+ value: selectedRange,
150
+ onValueChange: handleValueChange,
151
+ disabled,
152
+ readOnly,
153
+ locale
154
+ })
155
+ })
156
+ ]
157
+ });
158
+ });
159
+ DateRangePicker.displayName = "DateRangePicker";
160
+ //#endregion
161
+ export { DateRangePicker, dateRangePickerVariants };
@@ -0,0 +1,2 @@
1
+ import { DateRangePicker, DateRangePickerCalendarProps, DateRangePickerPopupProps, DateRangePickerProps, DateRangePickerSize, DateRangePickerVariant, DateRangePickerVariantsOptions, dateRangePickerVariants } from "./DateRangePicker.js";
2
+ export { DateRangePicker, type DateRangePickerCalendarProps, type DateRangePickerPopupProps, type DateRangePickerProps, type DateRangePickerSize, type DateRangePickerVariant, type DateRangePickerVariantsOptions, dateRangePickerVariants };
@@ -0,0 +1,2 @@
1
+ import { DateRangePicker, dateRangePickerVariants } from "./DateRangePicker.js";
2
+ export { DateRangePicker, dateRangePickerVariants };
@@ -0,0 +1,112 @@
1
+ import { ComponentPropsWithoutRef, HTMLAttributes } from "react";
2
+ import { Dialog } from "@base-ui/react/dialog";
3
+ //#region src/components/Dialog/Dialog.d.ts
4
+ type DialogSize = "sm" | "md" | "lg" | "full";
5
+ type DialogScrollBehavior = "inside" | "outside";
6
+ /**
7
+ * Groups all parts of the dialog and owns its state. Renders no DOM.
8
+ *
9
+ * This is Base UI's `Dialog.Root` re-exported unchanged, so every root
10
+ * feature is available: `open`/`defaultOpen`/`onOpenChange(open, details)`,
11
+ * `modal` (`true` | `false` | `"trap-focus"`), `disablePointerDismissal`,
12
+ * `onOpenChangeComplete`, `actionsRef`, and detached triggers via
13
+ * `Dialog.createHandle()` payloads.
14
+ */
15
+ declare const Dialog$1: typeof Dialog.Root;
16
+ type DialogProps = Dialog.Root.Props;
17
+ interface DialogTriggerProps extends Omit<ComponentPropsWithoutRef<typeof Dialog.Trigger>, "className"> {
18
+ className?: string;
19
+ }
20
+ /**
21
+ * Opens the dialog. Renders an unstyled `<button>` and exposes
22
+ * `data-popup-open` while its dialog is open — compose it with Button for
23
+ * the usual look: `<DialogTrigger render={<Button>Open</Button>} />`.
24
+ */
25
+ declare const DialogTrigger: import("react").ForwardRefExoticComponent<DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
26
+ interface DialogCloseProps extends Omit<ComponentPropsWithoutRef<typeof Dialog.Close>, "className"> {
27
+ className?: string;
28
+ }
29
+ /**
30
+ * Closes the dialog. Renders an unstyled `<button>` — compose it with
31
+ * Button for footer actions:
32
+ * `<DialogClose render={<Button variant="outline">Cancel</Button>} />`.
33
+ */
34
+ declare const DialogClose: import("react").ForwardRefExoticComponent<DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
35
+ interface DialogPopupVariantsOptions {
36
+ size?: DialogSize;
37
+ scrollBehavior?: DialogScrollBehavior;
38
+ className?: string;
39
+ }
40
+ /**
41
+ * Class list for the dialog surface itself. Useful when composing Base UI's
42
+ * dialog parts directly (custom portals, alert dialogs) while keeping the
43
+ * ArcFusion look.
44
+ */
45
+ declare function dialogPopupVariants({ size, scrollBehavior, className }?: DialogPopupVariantsOptions): string;
46
+ interface DialogPopupProps extends Omit<ComponentPropsWithoutRef<typeof Dialog.Popup>, "className"> {
47
+ /**
48
+ * Width preset: `sm` 384px for confirmations, `md` 512px (default) for
49
+ * forms, `lg` 672px for rich content, `full` for an edge-to-edge
50
+ * full-screen dialog. Below the preset the popup shrinks with the
51
+ * viewport, keeping a 16px margin.
52
+ */
53
+ size?: DialogSize;
54
+ /**
55
+ * How content taller than the viewport scrolls. `inside` (default) caps
56
+ * the popup at the viewport and scrolls within it; `outside` lets the
57
+ * popup grow and scrolls the page-like viewport behind the backdrop
58
+ * instead. `full` dialogs always scroll inside.
59
+ */
60
+ scrollBehavior?: DialogScrollBehavior;
61
+ /**
62
+ * Show the corner close button. When disabling it for a required
63
+ * decision, keep another `DialogClose` action inside the popup — with
64
+ * `modal` dialogs a visible close control is what lets touch
65
+ * screen-reader users escape.
66
+ */
67
+ showCloseButton?: boolean;
68
+ /** Accessible name (and tooltip-free label) of the corner close button — localize it alongside your content. */
69
+ closeLabel?: string;
70
+ /**
71
+ * Render the dimming scrim behind the dialog. Disable it together with
72
+ * `modal={false}` on the root so the rest of the page stays visible and
73
+ * interactive.
74
+ */
75
+ showBackdrop?: boolean;
76
+ /**
77
+ * Keep the dialog mounted in the DOM while closed. Off by default —
78
+ * enable it to preserve heavy content or form state across reopens.
79
+ */
80
+ keepMounted?: boolean;
81
+ /** Element the dialog portals into instead of `<body>` — for scoped stacking contexts, shadow DOM, or inline previews. */
82
+ container?: ComponentPropsWithoutRef<typeof Dialog.Portal>["container"];
83
+ className?: string;
84
+ }
85
+ /**
86
+ * The dialog surface. Bundles Base UI's Portal, Backdrop, Viewport, and
87
+ * Popup parts into one styled component; `initialFocus`/`finalFocus` and
88
+ * every other Base UI popup prop pass straight through.
89
+ */
90
+ declare const DialogPopup: import("react").ForwardRefExoticComponent<DialogPopupProps & import("react").RefAttributes<HTMLDivElement>>;
91
+ interface DialogHeaderProps extends HTMLAttributes<HTMLDivElement> {}
92
+ /** Groups the title and description with standard spacing at the top of the popup. */
93
+ declare const DialogHeader: import("react").ForwardRefExoticComponent<DialogHeaderProps & import("react").RefAttributes<HTMLDivElement>>;
94
+ interface DialogFooterProps extends HTMLAttributes<HTMLDivElement> {}
95
+ /** Action row: right-aligned on desktop, stacked with the primary action on top on small screens. */
96
+ declare const DialogFooter: import("react").ForwardRefExoticComponent<DialogFooterProps & import("react").RefAttributes<HTMLDivElement>>;
97
+ interface DialogTitleProps extends Omit<ComponentPropsWithoutRef<typeof Dialog.Title>, "className"> {
98
+ className?: string;
99
+ }
100
+ /**
101
+ * Labels the dialog — Base UI wires it to the popup's `aria-labelledby`.
102
+ * Renders an `<h2>`; every dialog should have one (or an `aria-label` on
103
+ * the popup) so the dialog announces meaningfully.
104
+ */
105
+ declare const DialogTitle: import("react").ForwardRefExoticComponent<DialogTitleProps & import("react").RefAttributes<HTMLHeadingElement>>;
106
+ interface DialogDescriptionProps extends Omit<ComponentPropsWithoutRef<typeof Dialog.Description>, "className"> {
107
+ className?: string;
108
+ }
109
+ /** Supporting copy announced when the dialog opens — wired to `aria-describedby`. */
110
+ declare const DialogDescription: import("react").ForwardRefExoticComponent<DialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>>;
111
+ //#endregion
112
+ export { Dialog$1 as Dialog, DialogClose, DialogCloseProps, DialogDescription, DialogDescriptionProps, DialogFooter, DialogFooterProps, DialogHeader, DialogHeaderProps, DialogPopup, DialogPopupProps, DialogPopupVariantsOptions, DialogProps, DialogScrollBehavior, DialogSize, DialogTitle, DialogTitleProps, DialogTrigger, DialogTriggerProps, dialogPopupVariants };
@@ -0,0 +1,141 @@
1
+ import { cn } from "../../lib/cn.js";
2
+ import { forwardRef } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { Dialog } from "@base-ui/react/dialog";
5
+ //#region src/components/Dialog/Dialog.tsx
6
+ /**
7
+ * Groups all parts of the dialog and owns its state. Renders no DOM.
8
+ *
9
+ * This is Base UI's `Dialog.Root` re-exported unchanged, so every root
10
+ * feature is available: `open`/`defaultOpen`/`onOpenChange(open, details)`,
11
+ * `modal` (`true` | `false` | `"trap-focus"`), `disablePointerDismissal`,
12
+ * `onOpenChangeComplete`, `actionsRef`, and detached triggers via
13
+ * `Dialog.createHandle()` payloads.
14
+ */
15
+ const Dialog$1 = Dialog.Root;
16
+ /**
17
+ * Opens the dialog. Renders an unstyled `<button>` and exposes
18
+ * `data-popup-open` while its dialog is open — compose it with Button for
19
+ * the usual look: `<DialogTrigger render={<Button>Open</Button>} />`.
20
+ */
21
+ const DialogTrigger = forwardRef((props, ref) => /* @__PURE__ */ jsx(Dialog.Trigger, {
22
+ ref,
23
+ ...props
24
+ }));
25
+ DialogTrigger.displayName = "DialogTrigger";
26
+ /**
27
+ * Closes the dialog. Renders an unstyled `<button>` — compose it with
28
+ * Button for footer actions:
29
+ * `<DialogClose render={<Button variant="outline">Cancel</Button>} />`.
30
+ */
31
+ const DialogClose = forwardRef((props, ref) => /* @__PURE__ */ jsx(Dialog.Close, {
32
+ ref,
33
+ ...props
34
+ }));
35
+ DialogClose.displayName = "DialogClose";
36
+ const backdropClasses = "fixed inset-0 z-50 min-h-dvh bg-overlay supports-[-webkit-touch-callout:none]:absolute motion-safe:transition-opacity motion-safe:duration-150 motion-safe:ease-out data-starting-style:opacity-0 data-ending-style:opacity-0";
37
+ const viewportBaseClasses = "fixed inset-0 z-50 flex data-closed:pointer-events-none";
38
+ const viewportInsideClasses = "pointer-events-none";
39
+ const viewportSizeClasses = {
40
+ sm: "p-4",
41
+ md: "p-4",
42
+ lg: "p-4",
43
+ full: "p-0"
44
+ };
45
+ const viewportOutsideClasses = "overflow-y-auto overscroll-contain py-12";
46
+ const popupBaseClasses = "relative m-auto flex w-full flex-col gap-4 rounded-md border border-border bg-background p-6 font-sans text-foreground shadow-lg outline-none pointer-events-auto data-closed:pointer-events-none scale-[calc(1-0.05*var(--nested-dialogs))] after:pointer-events-none after:absolute after:inset-0 after:rounded-md after:bg-slate-950/5 after:opacity-0 data-nested-dialog-open:after:opacity-100 motion-safe:transition-[opacity,scale] motion-safe:duration-150 motion-safe:ease-out motion-safe:after:transition-opacity motion-safe:after:duration-150 data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0";
47
+ const popupSizeClasses = {
48
+ sm: "max-w-sm",
49
+ md: "max-w-lg",
50
+ lg: "max-w-2xl",
51
+ full: "h-full max-w-none overflow-y-auto rounded-none border-none shadow-none"
52
+ };
53
+ const popupInsideScrollClasses = "max-h-full overflow-y-auto overscroll-contain";
54
+ const closeClearanceClasses = "[&>[data-dialog-header]]:pr-8 [&>[data-dialog-title]]:pr-8";
55
+ const cornerCloseClasses = "absolute top-4 right-4 inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors duration-150 hover:bg-muted hover:text-foreground active:bg-slate-200 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring";
56
+ function XIcon(props) {
57
+ return /* @__PURE__ */ jsx("svg", {
58
+ viewBox: "0 0 16 16",
59
+ fill: "none",
60
+ stroke: "currentColor",
61
+ strokeWidth: 1.5,
62
+ strokeLinecap: "round",
63
+ "aria-hidden": "true",
64
+ className: "size-4",
65
+ ...props,
66
+ children: /* @__PURE__ */ jsx("path", { d: "m3.5 3.5 9 9m-9 0 9-9" })
67
+ });
68
+ }
69
+ /**
70
+ * Class list for the dialog surface itself. Useful when composing Base UI's
71
+ * dialog parts directly (custom portals, alert dialogs) while keeping the
72
+ * ArcFusion look.
73
+ */
74
+ function dialogPopupVariants({ size = "md", scrollBehavior = "inside", className } = {}) {
75
+ return cn(popupBaseClasses, popupSizeClasses[size], scrollBehavior === "inside" && size !== "full" && popupInsideScrollClasses, className);
76
+ }
77
+ /**
78
+ * The dialog surface. Bundles Base UI's Portal, Backdrop, Viewport, and
79
+ * Popup parts into one styled component; `initialFocus`/`finalFocus` and
80
+ * every other Base UI popup prop pass straight through.
81
+ */
82
+ const DialogPopup = forwardRef(({ size = "md", scrollBehavior = "inside", showCloseButton = true, closeLabel = "Close", showBackdrop = true, keepMounted = false, container, className, children, ...rest }, ref) => {
83
+ const scroll = size === "full" ? "inside" : scrollBehavior;
84
+ return /* @__PURE__ */ jsxs(Dialog.Portal, {
85
+ keepMounted,
86
+ container,
87
+ children: [showBackdrop && /* @__PURE__ */ jsx(Dialog.Backdrop, { className: backdropClasses }), /* @__PURE__ */ jsx(Dialog.Viewport, {
88
+ className: cn(viewportBaseClasses, viewportSizeClasses[size], scroll === "inside" ? viewportInsideClasses : viewportOutsideClasses),
89
+ children: /* @__PURE__ */ jsxs(Dialog.Popup, {
90
+ ref,
91
+ className: cn(dialogPopupVariants({
92
+ size,
93
+ scrollBehavior: scroll
94
+ }), showCloseButton && closeClearanceClasses, className),
95
+ ...rest,
96
+ children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog.Close, {
97
+ "aria-label": closeLabel,
98
+ className: cornerCloseClasses,
99
+ children: /* @__PURE__ */ jsx(XIcon, {})
100
+ })]
101
+ })
102
+ })]
103
+ });
104
+ });
105
+ DialogPopup.displayName = "DialogPopup";
106
+ /** Groups the title and description with standard spacing at the top of the popup. */
107
+ const DialogHeader = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx("div", {
108
+ ref,
109
+ "data-dialog-header": "",
110
+ className: cn("flex flex-col gap-1.5", className),
111
+ ...rest
112
+ }));
113
+ DialogHeader.displayName = "DialogHeader";
114
+ /** Action row: right-aligned on desktop, stacked with the primary action on top on small screens. */
115
+ const DialogFooter = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx("div", {
116
+ ref,
117
+ className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-end", className),
118
+ ...rest
119
+ }));
120
+ DialogFooter.displayName = "DialogFooter";
121
+ /**
122
+ * Labels the dialog — Base UI wires it to the popup's `aria-labelledby`.
123
+ * Renders an `<h2>`; every dialog should have one (or an `aria-label` on
124
+ * the popup) so the dialog announces meaningfully.
125
+ */
126
+ const DialogTitle = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Dialog.Title, {
127
+ ref,
128
+ "data-dialog-title": "",
129
+ className: cn("font-heading text-xl font-semibold text-foreground", className),
130
+ ...rest
131
+ }));
132
+ DialogTitle.displayName = "DialogTitle";
133
+ /** Supporting copy announced when the dialog opens — wired to `aria-describedby`. */
134
+ const DialogDescription = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Dialog.Description, {
135
+ ref,
136
+ className: cn("font-sans text-sm text-muted-foreground", className),
137
+ ...rest
138
+ }));
139
+ DialogDescription.displayName = "DialogDescription";
140
+ //#endregion
141
+ export { Dialog$1 as Dialog, DialogClose, DialogDescription, DialogFooter, DialogHeader, DialogPopup, DialogTitle, DialogTrigger, dialogPopupVariants };
@@ -0,0 +1,2 @@
1
+ import { Dialog, DialogClose, DialogCloseProps, DialogDescription, DialogDescriptionProps, DialogFooter, DialogFooterProps, DialogHeader, DialogHeaderProps, DialogPopup, DialogPopupProps, DialogPopupVariantsOptions, DialogProps, DialogScrollBehavior, DialogSize, DialogTitle, DialogTitleProps, DialogTrigger, DialogTriggerProps, dialogPopupVariants } from "./Dialog.js";
2
+ export { Dialog, DialogClose, type DialogCloseProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogPopup, type DialogPopupProps, type DialogPopupVariantsOptions, type DialogProps, type DialogScrollBehavior, type DialogSize, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, dialogPopupVariants };
@@ -0,0 +1,2 @@
1
+ import { Dialog, DialogClose, DialogDescription, DialogFooter, DialogHeader, DialogPopup, DialogTitle, DialogTrigger, dialogPopupVariants } from "./Dialog.js";
2
+ export { Dialog, DialogClose, DialogDescription, DialogFooter, DialogHeader, DialogPopup, DialogTitle, DialogTrigger, dialogPopupVariants };
@@ -0,0 +1,188 @@
1
+ import { ComponentPropsWithoutRef, HTMLAttributes } from "react";
2
+ import { Drawer } from "@base-ui/react/drawer";
3
+ //#region src/components/Drawer/Drawer.d.ts
4
+ type DrawerSide = "top" | "right" | "bottom" | "left";
5
+ type DrawerSize = "sm" | "md" | "lg" | "full";
6
+ interface DrawerProps extends Drawer.Root.Props {
7
+ /**
8
+ * Screen edge the drawer is attached to. `right` (default) suits detail
9
+ * and settings panels, `left` navigation, `bottom` mobile sheets (snap
10
+ * points and the drag handle are designed for it), `top` banners. Also
11
+ * sets the matching swipe-to-dismiss direction.
12
+ */
13
+ side?: DrawerSide;
14
+ }
15
+ /**
16
+ * Groups all parts of the drawer and owns its state. Renders no DOM.
17
+ *
18
+ * Wraps Base UI's `Drawer.Root`, deriving `swipeDirection` from `side` (pass
19
+ * `swipeDirection` yourself only to decouple them). Every other root feature
20
+ * passes through: `open`/`defaultOpen`/`onOpenChange(open, details)`,
21
+ * `snapPoints` with `snapPoint`/`defaultSnapPoint`/`onSnapPointChange`,
22
+ * `modal` (`true` | `false` | `"trap-focus"`), `disablePointerDismissal`,
23
+ * `onOpenChangeComplete`, `actionsRef`, and detached triggers via
24
+ * `createDrawerHandle()` payloads.
25
+ */
26
+ declare function Drawer$1({ side, swipeDirection, ...rest }: DrawerProps): import("react").JSX.Element;
27
+ declare namespace Drawer$1 {
28
+ var displayName: string;
29
+ }
30
+ interface DrawerTriggerProps extends Omit<ComponentPropsWithoutRef<typeof Drawer.Trigger>, "className"> {
31
+ className?: string;
32
+ }
33
+ /**
34
+ * Opens the drawer. Renders an unstyled `<button>` and exposes
35
+ * `data-popup-open` while its drawer is open — compose it with Button for
36
+ * the usual look: `<DrawerTrigger render={<Button>Open</Button>} />`.
37
+ */
38
+ declare const DrawerTrigger: import("react").ForwardRefExoticComponent<DrawerTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
39
+ interface DrawerCloseProps extends Omit<ComponentPropsWithoutRef<typeof Drawer.Close>, "className"> {
40
+ className?: string;
41
+ }
42
+ /**
43
+ * Closes the drawer. Renders an unstyled `<button>` — compose it with
44
+ * Button for footer actions:
45
+ * `<DrawerClose render={<Button variant="outline">Cancel</Button>} />`.
46
+ */
47
+ declare const DrawerClose: import("react").ForwardRefExoticComponent<DrawerCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
48
+ interface DrawerPopupVariantsOptions {
49
+ side?: DrawerSide;
50
+ size?: DrawerSize;
51
+ className?: string;
52
+ }
53
+ /**
54
+ * Class list for the drawer surface itself. Useful when composing Base UI's
55
+ * drawer parts directly (custom viewports, snap-point layouts) while keeping
56
+ * the ArcFusion look.
57
+ */
58
+ declare function drawerPopupVariants({ side, size, className }?: DrawerPopupVariantsOptions): string;
59
+ interface DrawerPopupProps extends Omit<ComponentPropsWithoutRef<typeof Drawer.Popup>, "className"> {
60
+ /**
61
+ * Amount of screen the drawer takes on its `side`'s axis. Side panels:
62
+ * `sm` 320px, `md` 384px (default), `lg` 512px, `full` edge-to-edge — all
63
+ * but `full` keep a 48px page peek on narrow screens. Sheets (`top`/
64
+ * `bottom`) size to their content up to `sm` 40dvh, `md` 75dvh, `lg`
65
+ * 90dvh, or a `full` viewport takeover.
66
+ */
67
+ size?: DrawerSize;
68
+ /**
69
+ * Show the corner close button. When disabling it for a required
70
+ * decision, keep another `DrawerClose` action inside the popup — swiping
71
+ * is not discoverable or possible for everyone, and with `modal` drawers
72
+ * a visible close control is what lets touch screen-reader users escape.
73
+ */
74
+ showCloseButton?: boolean;
75
+ /** Accessible name (and tooltip-free label) of the corner close button — localize it alongside your content. */
76
+ closeLabel?: string;
77
+ /**
78
+ * Show the drag-handle affordance on the swipe edge. Recommended for
79
+ * `bottom` sheets on touch surfaces; it is decorative (the whole drawer
80
+ * responds to swipes) and hidden from assistive technology.
81
+ */
82
+ showHandle?: boolean;
83
+ /**
84
+ * Render the dimming scrim behind the drawer. Disable it together with
85
+ * `modal={false}` on the root so the rest of the page stays visible and
86
+ * interactive.
87
+ */
88
+ showBackdrop?: boolean;
89
+ /**
90
+ * Keep the drawer mounted in the DOM while closed. Off by default —
91
+ * enable it to preserve heavy content or form state across reopens.
92
+ */
93
+ keepMounted?: boolean;
94
+ /**
95
+ * Enable Base UI's keyboard-aware focus and scroll handling — turn it on
96
+ * for bottom sheets with form fields so software keyboards don't cover
97
+ * the focused input. No effect on devices without a virtual keyboard.
98
+ */
99
+ virtualKeyboard?: boolean;
100
+ /** Element the drawer portals into instead of `<body>` — for scoped stacking contexts, shadow DOM, or inline previews. */
101
+ container?: ComponentPropsWithoutRef<typeof Drawer.Portal>["container"];
102
+ className?: string;
103
+ }
104
+ /**
105
+ * The drawer surface. Bundles Base UI's Portal, Backdrop, Viewport, Popup,
106
+ * and Content parts into one styled component positioned on the root's
107
+ * `side`; `initialFocus`/`finalFocus` and every other Base UI popup prop
108
+ * pass straight through. Children render inside the scrollable content
109
+ * region while the handle and corner close stay pinned to the frame.
110
+ */
111
+ declare const DrawerPopup: import("react").ForwardRefExoticComponent<DrawerPopupProps & import("react").RefAttributes<HTMLDivElement>>;
112
+ interface DrawerHeaderProps extends HTMLAttributes<HTMLDivElement> {}
113
+ /** Groups the title and description with standard spacing at the top of the drawer. */
114
+ declare const DrawerHeader: import("react").ForwardRefExoticComponent<DrawerHeaderProps & import("react").RefAttributes<HTMLDivElement>>;
115
+ interface DrawerFooterProps extends HTMLAttributes<HTMLDivElement> {}
116
+ /**
117
+ * Action row: right-aligned on desktop, stacked with the primary action on
118
+ * top on small screens. As a direct child of the popup it pins to the
119
+ * drawer's bottom edge when the content is shorter than a full-height panel.
120
+ */
121
+ declare const DrawerFooter: import("react").ForwardRefExoticComponent<DrawerFooterProps & import("react").RefAttributes<HTMLDivElement>>;
122
+ interface DrawerTitleProps extends Omit<ComponentPropsWithoutRef<typeof Drawer.Title>, "className"> {
123
+ className?: string;
124
+ }
125
+ /**
126
+ * Labels the drawer — Base UI wires it to the popup's `aria-labelledby`.
127
+ * Renders an `<h2>`; every drawer should have one (or an `aria-label` on
128
+ * the popup) so the panel announces meaningfully.
129
+ */
130
+ declare const DrawerTitle: import("react").ForwardRefExoticComponent<DrawerTitleProps & import("react").RefAttributes<HTMLHeadingElement>>;
131
+ interface DrawerDescriptionProps extends Omit<ComponentPropsWithoutRef<typeof Drawer.Description>, "className"> {
132
+ className?: string;
133
+ }
134
+ /** Supporting copy announced when the drawer opens — wired to `aria-describedby`. */
135
+ declare const DrawerDescription: import("react").ForwardRefExoticComponent<DrawerDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>>;
136
+ interface DrawerSwipeAreaProps extends Omit<ComponentPropsWithoutRef<typeof Drawer.SwipeArea>, "className"> {
137
+ className?: string;
138
+ }
139
+ /**
140
+ * Invisible strip along the drawer's edge that opens it with a swipe-in
141
+ * gesture (mobile-navigation pattern). Positions itself on the root's
142
+ * `side` with a 24px hit area — pass `className` to widen it or add a
143
+ * visible affordance as children. Keep a regular `DrawerTrigger` too:
144
+ * edge swipes are invisible to most users and unavailable to keyboards.
145
+ */
146
+ declare const DrawerSwipeArea: import("react").ForwardRefExoticComponent<DrawerSwipeAreaProps & import("react").RefAttributes<HTMLDivElement>>;
147
+ /**
148
+ * Shares drawer state across the app shell so `DrawerIndent` /
149
+ * `DrawerIndentBackground` can react to any drawer opening. Renders no DOM —
150
+ * wrap it around the app root only when using the indent effect.
151
+ */
152
+ declare const DrawerProvider: typeof Drawer.Provider;
153
+ /**
154
+ * Keyboard-aware focus and scroll handling for bottom sheets that contain
155
+ * form fields. Prefer the `virtualKeyboard` prop on `DrawerPopup`; this raw
156
+ * part exists for custom compositions and MUST render inside a `Drawer`
157
+ * (it reads the root's context), wrapping the drawer's parts. Exposes
158
+ * `--drawer-keyboard-inset` on the viewport. Renders no DOM.
159
+ */
160
+ declare const DrawerVirtualKeyboardProvider: typeof Drawer.VirtualKeyboardProvider;
161
+ /**
162
+ * Creates a handle that connects detached `DrawerTrigger`s (or imperative
163
+ * `open`/`close` calls) to a `Drawer` rendered elsewhere — e.g. opening a
164
+ * drawer from a menu item. Pass it to both as the `handle` prop.
165
+ */
166
+ declare const createDrawerHandle: typeof Drawer.createHandle;
167
+ interface DrawerIndentProps extends Omit<ComponentPropsWithoutRef<typeof Drawer.Indent>, "className"> {
168
+ className?: string;
169
+ }
170
+ /**
171
+ * Wrapper for the app's main UI inside a `DrawerProvider`; gets
172
+ * `data-active` while any drawer is open. Unstyled on purpose — the app
173
+ * shell owns the effect, e.g.
174
+ * `className="motion-safe:transition-transform data-active:scale-[0.98]"`
175
+ * for the iOS-style recede.
176
+ */
177
+ declare const DrawerIndent: import("react").ForwardRefExoticComponent<DrawerIndentProps & import("react").RefAttributes<HTMLDivElement>>;
178
+ interface DrawerIndentBackgroundProps extends Omit<ComponentPropsWithoutRef<typeof Drawer.IndentBackground>, "className"> {
179
+ className?: string;
180
+ }
181
+ /**
182
+ * Backdrop layer rendered behind `DrawerIndent` (place it just before) so
183
+ * the receded app has something to sit on — style it with `data-active`
184
+ * like the indent itself. Unstyled on purpose.
185
+ */
186
+ declare const DrawerIndentBackground: import("react").ForwardRefExoticComponent<DrawerIndentBackgroundProps & import("react").RefAttributes<HTMLDivElement>>;
187
+ //#endregion
188
+ export { Drawer$1 as Drawer, DrawerClose, DrawerCloseProps, DrawerDescription, DrawerDescriptionProps, DrawerFooter, DrawerFooterProps, DrawerHeader, DrawerHeaderProps, DrawerIndent, DrawerIndentBackground, DrawerIndentBackgroundProps, DrawerIndentProps, DrawerPopup, DrawerPopupProps, DrawerPopupVariantsOptions, DrawerProps, DrawerProvider, DrawerSide, DrawerSize, DrawerSwipeArea, DrawerSwipeAreaProps, DrawerTitle, DrawerTitleProps, DrawerTrigger, DrawerTriggerProps, DrawerVirtualKeyboardProvider, createDrawerHandle, drawerPopupVariants };