@seekalfred/primitives 0.2.0 → 0.4.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 (157) hide show
  1. package/README.md +975 -13
  2. package/dist/accordion/accordion.d.ts +107 -0
  3. package/dist/accordion/accordion.js +84 -0
  4. package/dist/accordion/accordion.js.map +1 -0
  5. package/dist/accordion/index.d.ts +2 -0
  6. package/dist/accordion/index.js +2 -0
  7. package/dist/alert/alert.d.ts +68 -0
  8. package/dist/alert/alert.js +67 -0
  9. package/dist/alert/alert.js.map +1 -0
  10. package/dist/alert/index.d.ts +2 -0
  11. package/dist/alert/index.js +2 -0
  12. package/dist/alert-dialog/alert-dialog.d.ts +53 -0
  13. package/dist/alert-dialog/alert-dialog.js +16 -0
  14. package/dist/alert-dialog/alert-dialog.js.map +1 -0
  15. package/dist/alert-dialog/index.d.ts +2 -0
  16. package/dist/alert-dialog/index.js +2 -0
  17. package/dist/avatar/avatar.d.ts +50 -0
  18. package/dist/avatar/avatar.js +91 -0
  19. package/dist/avatar/avatar.js.map +1 -0
  20. package/dist/avatar/index.d.ts +2 -0
  21. package/dist/avatar/index.js +2 -0
  22. package/dist/badge/badge.d.ts +47 -0
  23. package/dist/badge/badge.js +189 -0
  24. package/dist/badge/badge.js.map +1 -0
  25. package/dist/badge/index.d.ts +2 -0
  26. package/dist/badge/index.js +2 -0
  27. package/dist/breadcrumb/breadcrumb.d.ts +98 -0
  28. package/dist/breadcrumb/breadcrumb.js +93 -0
  29. package/dist/breadcrumb/breadcrumb.js.map +1 -0
  30. package/dist/breadcrumb/index.d.ts +2 -0
  31. package/dist/breadcrumb/index.js +2 -0
  32. package/dist/button/button.d.ts +1 -1
  33. package/dist/button/button.js +7 -0
  34. package/dist/button/button.js.map +1 -1
  35. package/dist/calendar/calendar.d.ts +154 -0
  36. package/dist/calendar/calendar.js +282 -0
  37. package/dist/calendar/calendar.js.map +1 -0
  38. package/dist/calendar/index.d.ts +2 -0
  39. package/dist/calendar/index.js +2 -0
  40. package/dist/card/card.d.ts +93 -0
  41. package/dist/card/card.js +105 -0
  42. package/dist/card/card.js.map +1 -0
  43. package/dist/card/index.d.ts +2 -0
  44. package/dist/card/index.js +2 -0
  45. package/dist/checkbox/checkbox.d.ts +63 -0
  46. package/dist/checkbox/checkbox.js +94 -0
  47. package/dist/checkbox/checkbox.js.map +1 -0
  48. package/dist/checkbox/index.d.ts +2 -0
  49. package/dist/checkbox/index.js +2 -0
  50. package/dist/dialog/dialog.d.ts +140 -0
  51. package/dist/dialog/dialog.js +127 -0
  52. package/dist/dialog/dialog.js.map +1 -0
  53. package/dist/dialog/index.d.ts +2 -0
  54. package/dist/dialog/index.js +2 -0
  55. package/dist/index.d.ts +30 -1
  56. package/dist/index.js +30 -1
  57. package/dist/input/index.d.ts +2 -0
  58. package/dist/input/index.js +2 -0
  59. package/dist/input/input.d.ts +80 -0
  60. package/dist/input/input.js +195 -0
  61. package/dist/input/input.js.map +1 -0
  62. package/dist/label/index.d.ts +2 -0
  63. package/dist/label/index.js +2 -0
  64. package/dist/label/label.d.ts +41 -0
  65. package/dist/label/label.js +44 -0
  66. package/dist/label/label.js.map +1 -0
  67. package/dist/lib/field-surface.js +40 -0
  68. package/dist/lib/field-surface.js.map +1 -0
  69. package/dist/lib/selection-control.js +57 -0
  70. package/dist/lib/selection-control.js.map +1 -0
  71. package/dist/menu/index.d.ts +2 -0
  72. package/dist/menu/index.js +2 -0
  73. package/dist/menu/menu.d.ts +98 -0
  74. package/dist/menu/menu.js +99 -0
  75. package/dist/menu/menu.js.map +1 -0
  76. package/dist/popover/index.d.ts +2 -0
  77. package/dist/popover/index.js +2 -0
  78. package/dist/popover/popover.d.ts +50 -0
  79. package/dist/popover/popover.js +46 -0
  80. package/dist/popover/popover.js.map +1 -0
  81. package/dist/progress/index.d.ts +2 -0
  82. package/dist/progress/index.js +2 -0
  83. package/dist/progress/progress.d.ts +82 -0
  84. package/dist/progress/progress.js +82 -0
  85. package/dist/progress/progress.js.map +1 -0
  86. package/dist/radio-group/index.d.ts +2 -0
  87. package/dist/radio-group/index.js +2 -0
  88. package/dist/radio-group/radio-group.d.ts +53 -0
  89. package/dist/radio-group/radio-group.js +65 -0
  90. package/dist/radio-group/radio-group.js.map +1 -0
  91. package/dist/scroll-area/index.d.ts +2 -0
  92. package/dist/scroll-area/index.js +2 -0
  93. package/dist/scroll-area/scroll-area.d.ts +74 -0
  94. package/dist/scroll-area/scroll-area.js +63 -0
  95. package/dist/scroll-area/scroll-area.js.map +1 -0
  96. package/dist/select/index.d.ts +2 -0
  97. package/dist/select/index.js +2 -0
  98. package/dist/select/select.d.ts +105 -0
  99. package/dist/select/select.js +149 -0
  100. package/dist/select/select.js.map +1 -0
  101. package/dist/separator/index.d.ts +2 -0
  102. package/dist/separator/index.js +2 -0
  103. package/dist/separator/separator.d.ts +42 -0
  104. package/dist/separator/separator.js +49 -0
  105. package/dist/separator/separator.js.map +1 -0
  106. package/dist/sheet/index.d.ts +2 -0
  107. package/dist/sheet/index.js +2 -0
  108. package/dist/sheet/sheet.d.ts +96 -0
  109. package/dist/sheet/sheet.js +98 -0
  110. package/dist/sheet/sheet.js.map +1 -0
  111. package/dist/skeleton/index.d.ts +2 -0
  112. package/dist/skeleton/index.js +2 -0
  113. package/dist/skeleton/skeleton.d.ts +33 -0
  114. package/dist/skeleton/skeleton.js +42 -0
  115. package/dist/skeleton/skeleton.js.map +1 -0
  116. package/dist/slider/index.d.ts +2 -0
  117. package/dist/slider/index.js +2 -0
  118. package/dist/slider/slider.d.ts +70 -0
  119. package/dist/slider/slider.js +92 -0
  120. package/dist/slider/slider.js.map +1 -0
  121. package/dist/spinner/index.d.ts +2 -0
  122. package/dist/spinner/index.js +2 -0
  123. package/dist/spinner/spinner.d.ts +75 -0
  124. package/dist/spinner/spinner.js +68 -0
  125. package/dist/spinner/spinner.js.map +1 -0
  126. package/dist/styles.css +1 -1
  127. package/dist/switch/index.d.ts +2 -0
  128. package/dist/switch/index.js +2 -0
  129. package/dist/switch/switch.d.ts +50 -0
  130. package/dist/switch/switch.js +66 -0
  131. package/dist/switch/switch.js.map +1 -0
  132. package/dist/table/index.d.ts +2 -0
  133. package/dist/table/index.js +2 -0
  134. package/dist/table/table.d.ts +288 -0
  135. package/dist/table/table.js +513 -0
  136. package/dist/table/table.js.map +1 -0
  137. package/dist/tabs/index.d.ts +2 -0
  138. package/dist/tabs/index.js +2 -0
  139. package/dist/tabs/tabs.d.ts +79 -0
  140. package/dist/tabs/tabs.js +103 -0
  141. package/dist/tabs/tabs.js.map +1 -0
  142. package/dist/textarea/index.d.ts +2 -0
  143. package/dist/textarea/index.js +2 -0
  144. package/dist/textarea/textarea.d.ts +27 -0
  145. package/dist/textarea/textarea.js +37 -0
  146. package/dist/textarea/textarea.js.map +1 -0
  147. package/dist/toast/index.d.ts +2 -0
  148. package/dist/toast/index.js +2 -0
  149. package/dist/toast/toast.d.ts +93 -0
  150. package/dist/toast/toast.js +145 -0
  151. package/dist/toast/toast.js.map +1 -0
  152. package/dist/tooltip/index.d.ts +2 -0
  153. package/dist/tooltip/index.js +2 -0
  154. package/dist/tooltip/tooltip.d.ts +70 -0
  155. package/dist/tooltip/tooltip.js +65 -0
  156. package/dist/tooltip/tooltip.js.map +1 -0
  157. package/package.json +125 -7
@@ -0,0 +1,154 @@
1
+ import { CalendarProps, RangeCalendarProps } from "react-aria-components";
2
+ import { DateValue } from "@internationalized/date";
3
+ //#region src/calendar/calendar.d.ts
4
+ /**
5
+ * Calendar, built on React Aria's Calendar and RangeCalendar.
6
+ *
7
+ * Values are `DateValue` objects from `@internationalized/date`, NOT JS
8
+ * `Date`. ADR 0006 names that package the one allowed public type dependency
9
+ * precisely here: a calendar day has no time zone, so modelling it as a
10
+ * timestamp is what costs you a day at a DST boundary. The import is
11
+ * `import type` only — nothing at runtime needs a constructor from it, so the
12
+ * package contributes zero bytes to the bundle.
13
+ *
14
+ * Every string below is a STATIC literal. Tailwind scans source text, so a
15
+ * class assembled at runtime is invisible to it and would simply never be
16
+ * emitted — the component would render unstyled, with no error anywhere.
17
+ *
18
+ * State comes from React Aria's data attributes rather than pseudo-classes:
19
+ * `data-[focus-visible]` is keyboard focus only, and `data-[hovered]` /
20
+ * `data-[pressed]` cover pointer, touch and keyboard uniformly.
21
+ */
22
+ export declare const calendarVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
23
+ export declare const calendarLabelVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
24
+ export declare const calendarHeaderVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
25
+ /**
26
+ * The month/prev/next buttons.
27
+ *
28
+ * Deliberately NOT `buttonVariants` from ../button. That would put a
29
+ * cross-component import in the bundle for one caller and six classes, and
30
+ * DRY extracts at two callers, not one.
31
+ */
32
+ export declare const calendarNavVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
33
+ export declare const calendarMonthsVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
34
+ export declare const calendarHeadingVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
35
+ export declare const calendarGridVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
36
+ export declare const calendarHeaderCellVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
37
+ export declare const calendarClearVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
38
+ /**
39
+ * A day.
40
+ *
41
+ * Sized from `--density-control-h-sm` rather than a new
42
+ * `--density-calendar-cell`: the density contract test requires every scope to
43
+ * declare every token name, so a new one is three file edits — and this one is
44
+ * already 30/36/42px, all clear of the 24px floor that WCAG 2.2 SC 2.5.8 sets.
45
+ *
46
+ * ARCHITECTURE section 5 rule 6 — no state is carried by colour alone, because
47
+ * every author colour is replaced under forced-colors and the distinction
48
+ * would vanish. Selected adds weight, the range ends add SHAPE, today is an
49
+ * underline (not an outline, which would fight the focus ring) and unavailable
50
+ * is a strikethrough.
51
+ */
52
+ export declare const calendarCellVariants: (props?: ({
53
+ selection?: "single" | "range" | null | undefined;
54
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
55
+ interface CalendarSharedProps {
56
+ /**
57
+ * Accessible name for the calendar.
58
+ *
59
+ * REQUIRED. React Aria renders the root as `role="application"`, which has
60
+ * no implicit name, so without this every calendar announces as an unnamed
61
+ * application — the same finding that made `label` required on Select,
62
+ * Progress, Slider and ScrollArea.
63
+ */
64
+ label: string;
65
+ /**
66
+ * Hide the label visually while leaving it on the accessibility tree. Pass
67
+ * this when the surrounding UI already names the control.
68
+ *
69
+ * @default false
70
+ */
71
+ labelHidden?: boolean;
72
+ /**
73
+ * Number of months displayed side by side. Maps to React Aria's
74
+ * `visibleDuration`, which is omitted from the public surface so the two
75
+ * cannot disagree.
76
+ *
77
+ * @default 1
78
+ */
79
+ visibleMonths?: number;
80
+ /**
81
+ * Render a Clear button that resets the selection to `null`.
82
+ *
83
+ * Works controlled and uncontrolled: the button calls React Aria's
84
+ * `setValue(null)` through context, so `onChange` fires either way and there
85
+ * is no `onClear` for a consumer to wire up.
86
+ *
87
+ * @default false
88
+ */
89
+ clearable?: boolean;
90
+ /**
91
+ * Visible text of the Clear button.
92
+ *
93
+ * A prop rather than a literal because `ARCHITECTURE.md` §7 rule 9 forbids
94
+ * hard-coded user-visible strings and says it cannot be retrofitted.
95
+ * `useMessages()` does not exist yet, so this follows Dialog's `closeLabel`.
96
+ *
97
+ * @default "Clear"
98
+ */
99
+ clearLabel?: string;
100
+ /**
101
+ * Accessible name for the previous-month button, which is icon-only. Same
102
+ * reasoning as {@link CalendarSharedProps.clearLabel}.
103
+ *
104
+ * @default "Previous month"
105
+ */
106
+ previousLabel?: string;
107
+ /**
108
+ * Accessible name for the next-month button. Same reasoning as
109
+ * {@link CalendarSharedProps.clearLabel}.
110
+ *
111
+ * @default "Next month"
112
+ */
113
+ nextLabel?: string;
114
+ /** Extra classes. Merged last through `cn()`, so the consumer wins. */
115
+ className?: string;
116
+ }
117
+ /**
118
+ * Props for {@link Calendar}.
119
+ *
120
+ * Extends the React Aria type via `Omit` rather than
121
+ * `ComponentPropsWithoutRef`, matching every other React Aria-backed component
122
+ * here and recorded in ADR 0008. Intersecting would advertise DOM props that
123
+ * React Aria ignores silently.
124
+ */
125
+ interface CalendarProps$1 extends Omit<CalendarProps<DateValue>, "className" | "style" | "children" | "visibleDuration">, CalendarSharedProps {}
126
+ /** Props for {@link CalendarRange}. */
127
+ export interface CalendarRangeProps extends Omit<RangeCalendarProps<DateValue>, "className" | "style" | "children" | "visibleDuration">, CalendarSharedProps {}
128
+ /**
129
+ * A calendar for picking a single date.
130
+ *
131
+ * Maturity: **experimental**. `ARCHITECTURE.md` §7 rule 8's metadata mechanism
132
+ * does not exist yet, and ADR 0006 blocks `stable` until a WebKit test
133
+ * instance lands regardless.
134
+ *
135
+ * `onChange` hands back a `DateValue`; `String(value)` is its `YYYY-MM-DD`
136
+ * form, which is what an API filter or query parameter wants.
137
+ *
138
+ * @example
139
+ * <Calendar label="Report date" value={date} onChange={setDate} clearable />
140
+ */
141
+ declare function Calendar$1({ className, label, labelHidden, visibleMonths, clearable, clearLabel, previousLabel, nextLabel, ...props }: CalendarProps$1): import("react").JSX.Element;
142
+ /**
143
+ * A calendar for picking a contiguous date range.
144
+ *
145
+ * `onChange` hands back `{ start, end }`, both `DateValue`.
146
+ *
147
+ * @example
148
+ * <CalendarRange label="Period" visibleMonths={3}
149
+ * value={range} onChange={setRange} clearable />
150
+ */
151
+ export declare function CalendarRange({ className, label, labelHidden, visibleMonths, clearable, clearLabel, previousLabel, nextLabel, ...props }: CalendarRangeProps): import("react").JSX.Element;
152
+ //#endregion
153
+ export { Calendar$1 as Calendar, CalendarProps$1 as CalendarProps };
154
+ //# sourceMappingURL=calendar.d.ts.map
@@ -0,0 +1,282 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import { cva } from "class-variance-authority";
4
+ import { Button, Calendar, CalendarCell, CalendarGrid, CalendarGridBody, CalendarGridHeader, CalendarHeaderCell, CalendarHeading, CalendarStateContext, RangeCalendar, RangeCalendarStateContext } from "react-aria-components";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { useContext } from "react";
7
+ //#region src/calendar/calendar.tsx
8
+ /**
9
+ * Calendar, built on React Aria's Calendar and RangeCalendar.
10
+ *
11
+ * Values are `DateValue` objects from `@internationalized/date`, NOT JS
12
+ * `Date`. ADR 0006 names that package the one allowed public type dependency
13
+ * precisely here: a calendar day has no time zone, so modelling it as a
14
+ * timestamp is what costs you a day at a DST boundary. The import is
15
+ * `import type` only — nothing at runtime needs a constructor from it, so the
16
+ * package contributes zero bytes to the bundle.
17
+ *
18
+ * Every string below is a STATIC literal. Tailwind scans source text, so a
19
+ * class assembled at runtime is invisible to it and would simply never be
20
+ * emitted — the component would render unstyled, with no error anywhere.
21
+ *
22
+ * State comes from React Aria's data attributes rather than pseudo-classes:
23
+ * `data-[focus-visible]` is keyboard focus only, and `data-[hovered]` /
24
+ * `data-[pressed]` cover pointer, touch and keyboard uniformly.
25
+ */
26
+ const calendarVariants = cva(["flex w-fit flex-col gap-(--density-gap) box-border", "font-sans text-sm leading-(--leading-normal) text-foreground"]);
27
+ const calendarLabelVariants = cva(["text-sm font-medium text-foreground"]);
28
+ const calendarHeaderVariants = cva(["flex items-center justify-between gap-(--density-control-gap)"]);
29
+ /**
30
+ * The month/prev/next buttons.
31
+ *
32
+ * Deliberately NOT `buttonVariants` from ../button. That would put a
33
+ * cross-component import in the bundle for one caller and six classes, and
34
+ * DRY extracts at two callers, not one.
35
+ */
36
+ const calendarNavVariants = cva([
37
+ "inline-flex shrink-0 items-center justify-center",
38
+ "size-(--density-control-h-sm) rounded-md",
39
+ "border-(length:--border-width) border-transparent bg-transparent",
40
+ "cursor-pointer select-none text-foreground outline-none",
41
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0",
42
+ "[&_svg:not([class*='size-'])]:size-(--icon-sm)",
43
+ "[&_svg]:rtl:-scale-x-100",
44
+ "motion-safe:transition-colors motion-safe:duration-(--duration-fast) motion-safe:ease-standard",
45
+ "data-[hovered]:bg-muted data-[pressed]:bg-muted",
46
+ "data-[focus-visible]:outline-solid data-[focus-visible]:outline-(length:--focus-ring-width)",
47
+ "data-[focus-visible]:outline-offset-(--focus-ring-offset) data-[focus-visible]:outline-(--color-ring)",
48
+ "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-(--opacity-disabled)"
49
+ ]);
50
+ const calendarMonthsVariants = cva(["flex flex-col gap-(--density-gap) sm:flex-row sm:items-start"]);
51
+ const calendarHeadingVariants = cva(["mb-1 text-center text-sm font-semibold text-foreground"]);
52
+ const calendarGridVariants = cva(["border-collapse"]);
53
+ const calendarHeaderCellVariants = cva(["w-(--density-control-h-sm) pb-1", "text-center text-2xs font-medium text-muted-foreground"]);
54
+ const calendarClearVariants = cva([
55
+ "self-end rounded-md px-2 py-1",
56
+ "border-(length:--border-width) border-transparent bg-transparent",
57
+ "cursor-pointer select-none text-sm text-muted-foreground outline-none",
58
+ "motion-safe:transition-colors motion-safe:duration-(--duration-fast) motion-safe:ease-standard",
59
+ "data-[hovered]:bg-muted data-[hovered]:text-foreground",
60
+ "data-[focus-visible]:outline-solid data-[focus-visible]:outline-(length:--focus-ring-width)",
61
+ "data-[focus-visible]:outline-offset-(--focus-ring-offset) data-[focus-visible]:outline-(--color-ring)"
62
+ ]);
63
+ /**
64
+ * A day.
65
+ *
66
+ * Sized from `--density-control-h-sm` rather than a new
67
+ * `--density-calendar-cell`: the density contract test requires every scope to
68
+ * declare every token name, so a new one is three file edits — and this one is
69
+ * already 30/36/42px, all clear of the 24px floor that WCAG 2.2 SC 2.5.8 sets.
70
+ *
71
+ * ARCHITECTURE section 5 rule 6 — no state is carried by colour alone, because
72
+ * every author colour is replaced under forced-colors and the distinction
73
+ * would vanish. Selected adds weight, the range ends add SHAPE, today is an
74
+ * underline (not an outline, which would fight the focus ring) and unavailable
75
+ * is a strikethrough.
76
+ */
77
+ const calendarCellVariants = cva([
78
+ "flex items-center justify-center box-border",
79
+ "size-(--density-control-h-sm) rounded-md",
80
+ "text-sm leading-(--leading-normal) text-foreground",
81
+ "cursor-pointer select-none outline-none",
82
+ "motion-safe:transition-colors motion-safe:duration-(--duration-fast) motion-safe:ease-standard",
83
+ "data-[hovered]:bg-muted",
84
+ "data-[today]:font-semibold data-[today]:underline data-[today]:underline-offset-4",
85
+ "data-[outside-month]:text-muted-foreground data-[outside-month]:opacity-(--opacity-disabled)",
86
+ "data-[unavailable]:cursor-not-allowed data-[unavailable]:text-muted-foreground",
87
+ "data-[unavailable]:line-through",
88
+ "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-(--opacity-disabled)",
89
+ "data-[focus-visible]:outline-solid data-[focus-visible]:outline-(length:--focus-ring-width)",
90
+ "data-[focus-visible]:outline-offset-(--focus-ring-offset) data-[focus-visible]:outline-(--color-ring)"
91
+ ], {
92
+ variants: {
93
+ /**
94
+ * A variant axis rather than a boolean prop, because the two modes are
95
+ * mutually exclusive visual treatments of the same element — which is
96
+ * exactly what OCP asks a variant to model.
97
+ */
98
+ selection: {
99
+ single: ["data-[selected]:bg-primary data-[selected]:text-primary-foreground", "data-[selected]:font-semibold"],
100
+ range: [
101
+ "data-[selected]:rounded-none data-[selected]:bg-muted data-[selected]:text-foreground",
102
+ "data-[selection-start]:rounded-s-md data-[selection-start]:bg-primary",
103
+ "data-[selection-start]:font-semibold data-[selection-start]:text-primary-foreground",
104
+ "data-[selection-end]:rounded-e-md data-[selection-end]:bg-primary",
105
+ "data-[selection-end]:font-semibold data-[selection-end]:text-primary-foreground"
106
+ ]
107
+ } },
108
+ defaultVariants: { selection: "single" }
109
+ });
110
+ function ChevronPrevious() {
111
+ return /* @__PURE__ */ jsx("svg", {
112
+ viewBox: "0 0 24 24",
113
+ fill: "none",
114
+ stroke: "currentColor",
115
+ strokeWidth: "2",
116
+ "aria-hidden": "true",
117
+ children: /* @__PURE__ */ jsx("path", {
118
+ d: "m15 18-6-6 6-6",
119
+ strokeLinecap: "round",
120
+ strokeLinejoin: "round"
121
+ })
122
+ });
123
+ }
124
+ function ChevronNext() {
125
+ return /* @__PURE__ */ jsx("svg", {
126
+ viewBox: "0 0 24 24",
127
+ fill: "none",
128
+ stroke: "currentColor",
129
+ strokeWidth: "2",
130
+ "aria-hidden": "true",
131
+ children: /* @__PURE__ */ jsx("path", {
132
+ d: "m9 18 6-6-6-6",
133
+ strokeLinecap: "round",
134
+ strokeLinejoin: "round"
135
+ })
136
+ });
137
+ }
138
+ /**
139
+ * Resets the selection to null.
140
+ *
141
+ * It reads the calendar state from React Aria's context and calls
142
+ * `setValue(null)`, which runs through `useControlledState` — so it fires
143
+ * `onChange` for a controlled parent AND updates uncontrolled state, with no
144
+ * mirrored state here. That is the whole reason there is no `onClear` prop:
145
+ * from inside the provider tree the reset is free, and from outside it it
146
+ * would force every consumer to own the value.
147
+ *
148
+ * The two states are narrowed separately rather than through a union, because
149
+ * `setValue` has a different parameter type on each and the union call is not
150
+ * assignable to either.
151
+ *
152
+ * `slot={null}` opts out of the Button context: inside a Calendar that context
153
+ * carries the previous/next slots, and an unslotted Button would claim one.
154
+ */
155
+ function ClearButton({ label }) {
156
+ const calendarState = useContext(CalendarStateContext);
157
+ const rangeState = useContext(RangeCalendarStateContext);
158
+ const state = calendarState ?? rangeState;
159
+ const isInert = Boolean(state?.isDisabled ?? false) || Boolean(state?.isReadOnly ?? false);
160
+ return /* @__PURE__ */ jsx(Button, {
161
+ slot: null,
162
+ "data-slot": "calendar-clear",
163
+ isDisabled: isInert,
164
+ className: calendarClearVariants(),
165
+ onPress: () => {
166
+ if (calendarState) calendarState.setValue(null);
167
+ else rangeState?.setValue(null);
168
+ },
169
+ children: label
170
+ });
171
+ }
172
+ /** Header, grids and Clear — identical under both calendar roots. */
173
+ function CalendarBody({ visibleMonths, clearable, clearLabel, previousLabel, nextLabel, selection }) {
174
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
175
+ /* @__PURE__ */ jsxs("header", {
176
+ "data-slot": "calendar-header",
177
+ className: calendarHeaderVariants(),
178
+ children: [/* @__PURE__ */ jsx(Button, {
179
+ slot: "previous",
180
+ "aria-label": previousLabel,
181
+ className: calendarNavVariants(),
182
+ children: /* @__PURE__ */ jsx(ChevronPrevious, {})
183
+ }), /* @__PURE__ */ jsx(Button, {
184
+ slot: "next",
185
+ "aria-label": nextLabel,
186
+ className: calendarNavVariants(),
187
+ children: /* @__PURE__ */ jsx(ChevronNext, {})
188
+ })]
189
+ }),
190
+ /* @__PURE__ */ jsx("div", {
191
+ "data-slot": "calendar-months",
192
+ className: calendarMonthsVariants(),
193
+ children: Array.from({ length: visibleMonths }, (_, offset) => /* @__PURE__ */ jsxs("div", {
194
+ "data-slot": "calendar-month",
195
+ children: [/* @__PURE__ */ jsx(CalendarHeading, {
196
+ offset: { months: offset },
197
+ className: calendarHeadingVariants()
198
+ }), /* @__PURE__ */ jsxs(CalendarGrid, {
199
+ offset: { months: offset },
200
+ className: calendarGridVariants(),
201
+ children: [/* @__PURE__ */ jsx(CalendarGridHeader, { children: (weekday) => /* @__PURE__ */ jsx(CalendarHeaderCell, {
202
+ className: calendarHeaderCellVariants(),
203
+ children: weekday
204
+ }) }), /* @__PURE__ */ jsx(CalendarGridBody, { children: (date) => /* @__PURE__ */ jsx(CalendarCell, {
205
+ date,
206
+ "data-slot": "calendar-cell",
207
+ className: calendarCellVariants({ selection })
208
+ }) })]
209
+ })]
210
+ }, offset))
211
+ }),
212
+ clearable ? /* @__PURE__ */ jsx(ClearButton, { label: clearLabel }) : null
213
+ ] });
214
+ }
215
+ /**
216
+ * A calendar for picking a single date.
217
+ *
218
+ * Maturity: **experimental**. `ARCHITECTURE.md` §7 rule 8's metadata mechanism
219
+ * does not exist yet, and ADR 0006 blocks `stable` until a WebKit test
220
+ * instance lands regardless.
221
+ *
222
+ * `onChange` hands back a `DateValue`; `String(value)` is its `YYYY-MM-DD`
223
+ * form, which is what an API filter or query parameter wants.
224
+ *
225
+ * @example
226
+ * <Calendar label="Report date" value={date} onChange={setDate} clearable />
227
+ */
228
+ function Calendar$1({ className, label, labelHidden = false, visibleMonths = 1, clearable = false, clearLabel = "Clear", previousLabel = "Previous month", nextLabel = "Next month", ...props }) {
229
+ return /* @__PURE__ */ jsxs(Calendar, {
230
+ ...props,
231
+ "aria-label": label,
232
+ visibleDuration: { months: visibleMonths },
233
+ "data-slot": "calendar",
234
+ className: cn(calendarVariants(), className),
235
+ children: [labelHidden ? null : /* @__PURE__ */ jsx("span", {
236
+ "data-slot": "calendar-label",
237
+ className: calendarLabelVariants(),
238
+ children: label
239
+ }), /* @__PURE__ */ jsx(CalendarBody, {
240
+ visibleMonths,
241
+ clearable,
242
+ clearLabel,
243
+ previousLabel,
244
+ nextLabel,
245
+ selection: "single"
246
+ })]
247
+ });
248
+ }
249
+ /**
250
+ * A calendar for picking a contiguous date range.
251
+ *
252
+ * `onChange` hands back `{ start, end }`, both `DateValue`.
253
+ *
254
+ * @example
255
+ * <CalendarRange label="Period" visibleMonths={3}
256
+ * value={range} onChange={setRange} clearable />
257
+ */
258
+ function CalendarRange({ className, label, labelHidden = false, visibleMonths = 1, clearable = false, clearLabel = "Clear", previousLabel = "Previous month", nextLabel = "Next month", ...props }) {
259
+ return /* @__PURE__ */ jsxs(RangeCalendar, {
260
+ ...props,
261
+ "aria-label": label,
262
+ visibleDuration: { months: visibleMonths },
263
+ "data-slot": "calendar",
264
+ className: cn(calendarVariants(), className),
265
+ children: [labelHidden ? null : /* @__PURE__ */ jsx("span", {
266
+ "data-slot": "calendar-label",
267
+ className: calendarLabelVariants(),
268
+ children: label
269
+ }), /* @__PURE__ */ jsx(CalendarBody, {
270
+ visibleMonths,
271
+ clearable,
272
+ clearLabel,
273
+ previousLabel,
274
+ nextLabel,
275
+ selection: "range"
276
+ })]
277
+ });
278
+ }
279
+ //#endregion
280
+ export { Calendar$1 as Calendar, CalendarRange, calendarCellVariants, calendarClearVariants, calendarGridVariants, calendarHeaderCellVariants, calendarHeaderVariants, calendarHeadingVariants, calendarLabelVariants, calendarMonthsVariants, calendarNavVariants, calendarVariants };
281
+
282
+ //# sourceMappingURL=calendar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar.js","names":["AriaButton","AriaCalendarHeading","AriaCalendarGrid","AriaCalendarGridHeader","AriaCalendarHeaderCell","AriaCalendarGridBody","AriaCalendarCell","Calendar","AriaCalendar","AriaRangeCalendar"],"sources":["../../src/calendar/calendar.tsx"],"sourcesContent":["\"use client\";\n\nimport type { DateValue } from \"@internationalized/date\";\nimport { cva } from \"class-variance-authority\";\nimport { useContext } from \"react\";\nimport {\n Button as AriaButton,\n Calendar as AriaCalendar,\n CalendarCell as AriaCalendarCell,\n CalendarGrid as AriaCalendarGrid,\n CalendarGridBody as AriaCalendarGridBody,\n CalendarGridHeader as AriaCalendarGridHeader,\n CalendarHeaderCell as AriaCalendarHeaderCell,\n CalendarHeading as AriaCalendarHeading,\n CalendarStateContext,\n RangeCalendar as AriaRangeCalendar,\n RangeCalendarStateContext,\n type CalendarProps as AriaCalendarProps,\n type RangeCalendarProps as AriaRangeCalendarProps,\n} from \"react-aria-components\";\n\nimport { cn } from \"../lib/cn.js\";\n\n/**\n * Calendar, built on React Aria's Calendar and RangeCalendar.\n *\n * Values are `DateValue` objects from `@internationalized/date`, NOT JS\n * `Date`. ADR 0006 names that package the one allowed public type dependency\n * precisely here: a calendar day has no time zone, so modelling it as a\n * timestamp is what costs you a day at a DST boundary. The import is\n * `import type` only — nothing at runtime needs a constructor from it, so the\n * package contributes zero bytes to the bundle.\n *\n * Every string below is a STATIC literal. Tailwind scans source text, so a\n * class assembled at runtime is invisible to it and would simply never be\n * emitted — the component would render unstyled, with no error anywhere.\n *\n * State comes from React Aria's data attributes rather than pseudo-classes:\n * `data-[focus-visible]` is keyboard focus only, and `data-[hovered]` /\n * `data-[pressed]` cover pointer, touch and keyboard uniformly.\n */\nexport const calendarVariants = cva([\n \"flex w-fit flex-col gap-(--density-gap) box-border\",\n \"font-sans text-sm leading-(--leading-normal) text-foreground\",\n]);\n\nexport const calendarLabelVariants = cva([\"text-sm font-medium text-foreground\"]);\n\nexport const calendarHeaderVariants = cva([\n \"flex items-center justify-between gap-(--density-control-gap)\",\n]);\n\n/**\n * The month/prev/next buttons.\n *\n * Deliberately NOT `buttonVariants` from ../button. That would put a\n * cross-component import in the bundle for one caller and six classes, and\n * DRY extracts at two callers, not one.\n */\nexport const calendarNavVariants = cva([\n \"inline-flex shrink-0 items-center justify-center\",\n \"size-(--density-control-h-sm) rounded-md\",\n // A library consumer may load no reset at all, so a bare <button> keeps its\n // user-agent border and ButtonFace grey without these two.\n \"border-(length:--border-width) border-transparent bg-transparent\",\n \"cursor-pointer select-none text-foreground outline-none\",\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0\",\n \"[&_svg:not([class*='size-'])]:size-(--icon-sm)\",\n // The glyph is directional where the BEHAVIOUR is logical: React Aria maps\n // slot=\"previous\" to the correct month either way, so only the arrow flips.\n \"[&_svg]:rtl:-scale-x-100\",\n \"motion-safe:transition-colors motion-safe:duration-(--duration-fast) motion-safe:ease-standard\",\n \"data-[hovered]:bg-muted data-[pressed]:bg-muted\",\n \"data-[focus-visible]:outline-solid data-[focus-visible]:outline-(length:--focus-ring-width)\",\n \"data-[focus-visible]:outline-offset-(--focus-ring-offset) data-[focus-visible]:outline-(--color-ring)\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-(--opacity-disabled)\",\n]);\n\nexport const calendarMonthsVariants = cva([\n \"flex flex-col gap-(--density-gap) sm:flex-row sm:items-start\",\n]);\n\nexport const calendarHeadingVariants = cva([\n \"mb-1 text-center text-sm font-semibold text-foreground\",\n]);\n\nexport const calendarGridVariants = cva([\n // Without this a bare <table> falls back to user-agent border spacing and\n // the range band shows gaps between cells.\n \"border-collapse\",\n]);\n\nexport const calendarHeaderCellVariants = cva([\n \"w-(--density-control-h-sm) pb-1\",\n \"text-center text-2xs font-medium text-muted-foreground\",\n]);\n\nexport const calendarClearVariants = cva([\n \"self-end rounded-md px-2 py-1\",\n \"border-(length:--border-width) border-transparent bg-transparent\",\n \"cursor-pointer select-none text-sm text-muted-foreground outline-none\",\n \"motion-safe:transition-colors motion-safe:duration-(--duration-fast) motion-safe:ease-standard\",\n \"data-[hovered]:bg-muted data-[hovered]:text-foreground\",\n \"data-[focus-visible]:outline-solid data-[focus-visible]:outline-(length:--focus-ring-width)\",\n \"data-[focus-visible]:outline-offset-(--focus-ring-offset) data-[focus-visible]:outline-(--color-ring)\",\n]);\n\n/**\n * A day.\n *\n * Sized from `--density-control-h-sm` rather than a new\n * `--density-calendar-cell`: the density contract test requires every scope to\n * declare every token name, so a new one is three file edits — and this one is\n * already 30/36/42px, all clear of the 24px floor that WCAG 2.2 SC 2.5.8 sets.\n *\n * ARCHITECTURE section 5 rule 6 — no state is carried by colour alone, because\n * every author colour is replaced under forced-colors and the distinction\n * would vanish. Selected adds weight, the range ends add SHAPE, today is an\n * underline (not an outline, which would fight the focus ring) and unavailable\n * is a strikethrough.\n */\nexport const calendarCellVariants = cva(\n [\n \"flex items-center justify-center box-border\",\n \"size-(--density-control-h-sm) rounded-md\",\n \"text-sm leading-(--leading-normal) text-foreground\",\n \"cursor-pointer select-none outline-none\",\n \"motion-safe:transition-colors motion-safe:duration-(--duration-fast) motion-safe:ease-standard\",\n \"data-[hovered]:bg-muted\",\n \"data-[today]:font-semibold data-[today]:underline data-[today]:underline-offset-4\",\n \"data-[outside-month]:text-muted-foreground data-[outside-month]:opacity-(--opacity-disabled)\",\n // Unavailable dates stay FOCUSABLE, so ADR 0007 holds them to 4.5:1 — this\n // dims to muted-foreground, which the contrast contract grades, never below.\n \"data-[unavailable]:cursor-not-allowed data-[unavailable]:text-muted-foreground\",\n \"data-[unavailable]:line-through\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-(--opacity-disabled)\",\n \"data-[focus-visible]:outline-solid data-[focus-visible]:outline-(length:--focus-ring-width)\",\n \"data-[focus-visible]:outline-offset-(--focus-ring-offset) data-[focus-visible]:outline-(--color-ring)\",\n ],\n {\n variants: {\n /**\n * A variant axis rather than a boolean prop, because the two modes are\n * mutually exclusive visual treatments of the same element — which is\n * exactly what OCP asks a variant to model.\n */\n selection: {\n single: [\n \"data-[selected]:bg-primary data-[selected]:text-primary-foreground\",\n \"data-[selected]:font-semibold\",\n ],\n range: [\n // The band is `muted` — a pair the contrast contract already grades\n // at 4.5:1, so the range needs no new contrast-pairs.json entry.\n \"data-[selected]:rounded-none data-[selected]:bg-muted data-[selected]:text-foreground\",\n \"data-[selection-start]:rounded-s-md data-[selection-start]:bg-primary\",\n \"data-[selection-start]:font-semibold data-[selection-start]:text-primary-foreground\",\n \"data-[selection-end]:rounded-e-md data-[selection-end]:bg-primary\",\n \"data-[selection-end]:font-semibold data-[selection-end]:text-primary-foreground\",\n ],\n },\n },\n defaultVariants: { selection: \"single\" },\n },\n);\n\nfunction ChevronPrevious() {\n return (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" aria-hidden=\"true\">\n <path d=\"m15 18-6-6 6-6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n );\n}\n\nfunction ChevronNext() {\n return (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" aria-hidden=\"true\">\n <path d=\"m9 18 6-6-6-6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n );\n}\n\n/**\n * Resets the selection to null.\n *\n * It reads the calendar state from React Aria's context and calls\n * `setValue(null)`, which runs through `useControlledState` — so it fires\n * `onChange` for a controlled parent AND updates uncontrolled state, with no\n * mirrored state here. That is the whole reason there is no `onClear` prop:\n * from inside the provider tree the reset is free, and from outside it it\n * would force every consumer to own the value.\n *\n * The two states are narrowed separately rather than through a union, because\n * `setValue` has a different parameter type on each and the union call is not\n * assignable to either.\n *\n * `slot={null}` opts out of the Button context: inside a Calendar that context\n * carries the previous/next slots, and an unslotted Button would claim one.\n */\nfunction ClearButton({ label }: { label: string }) {\n const calendarState = useContext(CalendarStateContext);\n const rangeState = useContext(RangeCalendarStateContext);\n\n /*\n * Inherit the calendar's own inert states.\n *\n * Without this the Clear button stayed focusable and announced as enabled\n * inside an `isDisabled` calendar — every cell and both nav buttons were\n * inert, and one control in the middle of them was not. `isReadOnly` is the\n * same argument: \"the value is immutable\" has to include clearing it.\n */\n const state = calendarState ?? rangeState;\n const isInert = Boolean(state?.isDisabled ?? false) || Boolean(state?.isReadOnly ?? false);\n\n return (\n <AriaButton\n slot={null}\n data-slot=\"calendar-clear\"\n isDisabled={isInert}\n className={calendarClearVariants()}\n // Stays enabled when there is nothing to clear. Disabling it on press\n // moves focus to <body>, which silently strands a keyboard user mid-grid.\n onPress={() => {\n if (calendarState) calendarState.setValue(null);\n else rangeState?.setValue(null);\n }}\n >\n {label}\n </AriaButton>\n );\n}\n\ninterface CalendarBodyProps {\n visibleMonths: number;\n clearable: boolean;\n clearLabel: string;\n previousLabel: string;\n nextLabel: string;\n selection: \"single\" | \"range\";\n}\n\n/** Header, grids and Clear — identical under both calendar roots. */\nfunction CalendarBody({\n visibleMonths,\n clearable,\n clearLabel,\n previousLabel,\n nextLabel,\n selection,\n}: CalendarBodyProps) {\n return (\n <>\n <header data-slot=\"calendar-header\" className={calendarHeaderVariants()}>\n <AriaButton slot=\"previous\" aria-label={previousLabel} className={calendarNavVariants()}>\n <ChevronPrevious />\n </AriaButton>\n <AriaButton slot=\"next\" aria-label={nextLabel} className={calendarNavVariants()}>\n <ChevronNext />\n </AriaButton>\n </header>\n\n <div data-slot=\"calendar-months\" className={calendarMonthsVariants()}>\n {Array.from({ length: visibleMonths }, (_, offset) => (\n <div key={offset} data-slot=\"calendar-month\">\n {/* Per grid, so three months are three named columns rather than\n one combined range nobody can map back to a column. */}\n <AriaCalendarHeading\n offset={{ months: offset }}\n className={calendarHeadingVariants()}\n />\n <AriaCalendarGrid offset={{ months: offset }} className={calendarGridVariants()}>\n <AriaCalendarGridHeader>\n {(weekday) => (\n <AriaCalendarHeaderCell className={calendarHeaderCellVariants()}>\n {weekday}\n </AriaCalendarHeaderCell>\n )}\n </AriaCalendarGridHeader>\n <AriaCalendarGridBody>\n {(date) => (\n <AriaCalendarCell\n date={date}\n data-slot=\"calendar-cell\"\n className={calendarCellVariants({ selection })}\n />\n )}\n </AriaCalendarGridBody>\n </AriaCalendarGrid>\n </div>\n ))}\n </div>\n\n {clearable ? <ClearButton label={clearLabel} /> : null}\n </>\n );\n}\n\ninterface CalendarSharedProps {\n /**\n * Accessible name for the calendar.\n *\n * REQUIRED. React Aria renders the root as `role=\"application\"`, which has\n * no implicit name, so without this every calendar announces as an unnamed\n * application — the same finding that made `label` required on Select,\n * Progress, Slider and ScrollArea.\n */\n label: string;\n /**\n * Hide the label visually while leaving it on the accessibility tree. Pass\n * this when the surrounding UI already names the control.\n *\n * @default false\n */\n labelHidden?: boolean;\n /**\n * Number of months displayed side by side. Maps to React Aria's\n * `visibleDuration`, which is omitted from the public surface so the two\n * cannot disagree.\n *\n * @default 1\n */\n visibleMonths?: number;\n /**\n * Render a Clear button that resets the selection to `null`.\n *\n * Works controlled and uncontrolled: the button calls React Aria's\n * `setValue(null)` through context, so `onChange` fires either way and there\n * is no `onClear` for a consumer to wire up.\n *\n * @default false\n */\n clearable?: boolean;\n /**\n * Visible text of the Clear button.\n *\n * A prop rather than a literal because `ARCHITECTURE.md` §7 rule 9 forbids\n * hard-coded user-visible strings and says it cannot be retrofitted.\n * `useMessages()` does not exist yet, so this follows Dialog's `closeLabel`.\n *\n * @default \"Clear\"\n */\n clearLabel?: string;\n /**\n * Accessible name for the previous-month button, which is icon-only. Same\n * reasoning as {@link CalendarSharedProps.clearLabel}.\n *\n * @default \"Previous month\"\n */\n previousLabel?: string;\n /**\n * Accessible name for the next-month button. Same reasoning as\n * {@link CalendarSharedProps.clearLabel}.\n *\n * @default \"Next month\"\n */\n nextLabel?: string;\n /** Extra classes. Merged last through `cn()`, so the consumer wins. */\n className?: string;\n}\n\n/**\n * Props for {@link Calendar}.\n *\n * Extends the React Aria type via `Omit` rather than\n * `ComponentPropsWithoutRef`, matching every other React Aria-backed component\n * here and recorded in ADR 0008. Intersecting would advertise DOM props that\n * React Aria ignores silently.\n */\nexport interface CalendarProps\n extends Omit<\n AriaCalendarProps<DateValue>,\n \"className\" | \"style\" | \"children\" | \"visibleDuration\"\n >,\n CalendarSharedProps {}\n\n/** Props for {@link CalendarRange}. */\nexport interface CalendarRangeProps\n extends Omit<\n AriaRangeCalendarProps<DateValue>,\n \"className\" | \"style\" | \"children\" | \"visibleDuration\"\n >,\n CalendarSharedProps {}\n\n/**\n * A calendar for picking a single date.\n *\n * Maturity: **experimental**. `ARCHITECTURE.md` §7 rule 8's metadata mechanism\n * does not exist yet, and ADR 0006 blocks `stable` until a WebKit test\n * instance lands regardless.\n *\n * `onChange` hands back a `DateValue`; `String(value)` is its `YYYY-MM-DD`\n * form, which is what an API filter or query parameter wants.\n *\n * @example\n * <Calendar label=\"Report date\" value={date} onChange={setDate} clearable />\n */\nexport function Calendar({\n className,\n label,\n labelHidden = false,\n visibleMonths = 1,\n clearable = false,\n clearLabel = \"Clear\",\n previousLabel = \"Previous month\",\n nextLabel = \"Next month\",\n ...props\n}: CalendarProps) {\n return (\n <AriaCalendar\n {...props}\n aria-label={label}\n visibleDuration={{ months: visibleMonths }}\n data-slot=\"calendar\"\n className={cn(calendarVariants(), className)}\n >\n {labelHidden ? null : (\n <span data-slot=\"calendar-label\" className={calendarLabelVariants()}>\n {label}\n </span>\n )}\n <CalendarBody\n visibleMonths={visibleMonths}\n clearable={clearable}\n clearLabel={clearLabel}\n previousLabel={previousLabel}\n nextLabel={nextLabel}\n selection=\"single\"\n />\n </AriaCalendar>\n );\n}\n\n/**\n * A calendar for picking a contiguous date range.\n *\n * `onChange` hands back `{ start, end }`, both `DateValue`.\n *\n * @example\n * <CalendarRange label=\"Period\" visibleMonths={3}\n * value={range} onChange={setRange} clearable />\n */\nexport function CalendarRange({\n className,\n label,\n labelHidden = false,\n visibleMonths = 1,\n clearable = false,\n clearLabel = \"Clear\",\n previousLabel = \"Previous month\",\n nextLabel = \"Next month\",\n ...props\n}: CalendarRangeProps) {\n return (\n <AriaRangeCalendar\n {...props}\n aria-label={label}\n visibleDuration={{ months: visibleMonths }}\n data-slot=\"calendar\"\n className={cn(calendarVariants(), className)}\n >\n {labelHidden ? null : (\n <span data-slot=\"calendar-label\" className={calendarLabelVariants()}>\n {label}\n </span>\n )}\n <CalendarBody\n visibleMonths={visibleMonths}\n clearable={clearable}\n clearLabel={clearLabel}\n previousLabel={previousLabel}\n nextLabel={nextLabel}\n selection=\"range\"\n />\n </AriaRangeCalendar>\n );\n}\n"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ import { Calendar, CalendarProps, CalendarRange, CalendarRangeProps, calendarCellVariants, calendarClearVariants, calendarGridVariants, calendarHeaderCellVariants, calendarHeaderVariants, calendarHeadingVariants, calendarLabelVariants, calendarMonthsVariants, calendarNavVariants, calendarVariants } from "./calendar.js";
2
+ export { Calendar, type CalendarProps, CalendarRange, type CalendarRangeProps, calendarCellVariants, calendarClearVariants, calendarGridVariants, calendarHeaderCellVariants, calendarHeaderVariants, calendarHeadingVariants, calendarLabelVariants, calendarMonthsVariants, calendarNavVariants, calendarVariants };
@@ -0,0 +1,2 @@
1
+ import { Calendar, CalendarRange, calendarCellVariants, calendarClearVariants, calendarGridVariants, calendarHeaderCellVariants, calendarHeaderVariants, calendarHeadingVariants, calendarLabelVariants, calendarMonthsVariants, calendarNavVariants, calendarVariants } from "./calendar.js";
2
+ export { Calendar, CalendarRange, calendarCellVariants, calendarClearVariants, calendarGridVariants, calendarHeaderCellVariants, calendarHeaderVariants, calendarHeadingVariants, calendarLabelVariants, calendarMonthsVariants, calendarNavVariants, calendarVariants };
@@ -0,0 +1,93 @@
1
+ import { ComponentPropsWithoutRef } from "react";
2
+ //#region src/card/card.d.ts
3
+ /**
4
+ * Card, ported from the legacy shadcn component.
5
+ *
6
+ * Presentational, so there is no React Aria base -- React Aria ships no card,
7
+ * and a container that is not focusable, selectable or interactive needs no
8
+ * behaviour to inherit.
9
+ *
10
+ * Five parts, from six. The census (24 consumer files, the most-used
11
+ * container in the app) reads: Card 55, CardContent 40, CardHeader 21,
12
+ * CardTitle 19, CardDescription 8, CardFooter 2, **CardAction 0**.
13
+ *
14
+ * Dropping `CardAction` takes three things with it, which is most of the
15
+ * legacy header's complexity: the `grid`, the `grid-rows-[auto_auto]`, and
16
+ * the `has-data-[slot=card-action]:grid-cols-[1fr_auto]` rule that existed
17
+ * only to reserve a column for it. With no action to place, a header is a
18
+ * stack.
19
+ *
20
+ * Two more legacy rules are gone. `[.border-b]:pb-6` and `[.border-t]:pt-6`
21
+ * added padding when the CONSUMER happened to add a border class -- clever,
22
+ * but action at a distance through a class name we do not own, and the census
23
+ * found zero application call sites relying on it (one call site passes
24
+ * `border-b-0`, which removes a border it never had). `@container/card-header`
25
+ * named a container nothing queried.
26
+ *
27
+ * Every string in the cva blocks below is a STATIC literal. Tailwind scans
28
+ * source text, so a class assembled at runtime is invisible to it and would
29
+ * simply never be emitted.
30
+ */
31
+ export declare const cardVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
32
+ /**
33
+ * Padding is inline-only on the sections and block-only on the shell.
34
+ *
35
+ * That split is load-bearing rather than stylistic: it is what lets a
36
+ * consumer run a divider or a full-bleed image edge to edge, which a single
37
+ * `p-6` on the shell would make impossible.
38
+ */
39
+ export declare const cardHeaderVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
40
+ export declare const cardTitleVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
41
+ export declare const cardDescriptionVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
42
+ export declare const cardContentVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
43
+ export declare const cardFooterVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
44
+ /**
45
+ * A content container.
46
+ *
47
+ * @example
48
+ * <Card>
49
+ * <CardHeader>
50
+ * <CardTitle>Learning Progress</CardTitle>
51
+ * <CardDescription>Across all active courses.</CardDescription>
52
+ * </CardHeader>
53
+ * <CardContent>Twelve of eighteen modules complete.</CardContent>
54
+ * </Card>
55
+ */
56
+ export type CardProps = ComponentPropsWithoutRef<"div">;
57
+ export declare function Card({ className, ...props }: CardProps): import("react").JSX.Element;
58
+ /** Title and description, stacked. */
59
+ export type CardHeaderProps = ComponentPropsWithoutRef<"div">;
60
+ export declare function CardHeader({ className, ...props }: CardHeaderProps): import("react").JSX.Element;
61
+ /**
62
+ * The card's heading.
63
+ *
64
+ * A REAL heading, unlike the legacy `<div class="font-semibold">`. None of
65
+ * the 19 legacy call sites wrapped one, so 19 card titles were invisible to
66
+ * screen-reader heading navigation -- the same shape of finding as the Avatar
67
+ * port's missing `alt`, and the migration is when it gets answered.
68
+ */
69
+ export interface CardTitleProps extends ComponentPropsWithoutRef<"h3"> {
70
+ /**
71
+ * Heading level.
72
+ *
73
+ * `3` by default, because a card almost always sits under a section
74
+ * heading. It is a prop rather than a constant because the correct level
75
+ * is a fact about the PAGE, and a fixed one would be wrong somewhere; the
76
+ * level changes semantics only, never the rendered size.
77
+ *
78
+ * @default 3
79
+ */
80
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
81
+ }
82
+ export declare function CardTitle({ className, level, ...props }: CardTitleProps): import("react").JSX.Element;
83
+ /** Secondary text under the title. */
84
+ export type CardDescriptionProps = ComponentPropsWithoutRef<"div">;
85
+ export declare function CardDescription({ className, ...props }: CardDescriptionProps): import("react").JSX.Element;
86
+ /** The card's body. */
87
+ export type CardContentProps = ComponentPropsWithoutRef<"div">;
88
+ export declare function CardContent({ className, ...props }: CardContentProps): import("react").JSX.Element;
89
+ /** Actions or metadata at the foot of the card. */
90
+ export type CardFooterProps = ComponentPropsWithoutRef<"div">;
91
+ export declare function CardFooter({ className, ...props }: CardFooterProps): import("react").JSX.Element;
92
+ //#endregion
93
+ //# sourceMappingURL=card.d.ts.map