astralis-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +89 -0
  3. package/dist/components/buttons/button/button.js +83 -0
  4. package/dist/components/buttons/button/button.styles.js +69 -0
  5. package/dist/components/buttons/button-group/button-group.context.js +10 -0
  6. package/dist/components/buttons/button-group/button-group.js +42 -0
  7. package/dist/components/buttons/button-group/button-group.styles.js +39 -0
  8. package/dist/components/buttons/theme-toggle/theme-toggle.js +53 -0
  9. package/dist/components/data-display/avatar/avatar.context.js +10 -0
  10. package/dist/components/data-display/avatar/avatar.styles.js +40 -0
  11. package/dist/components/data-display/avatar/components/avatar-badge.js +24 -0
  12. package/dist/components/data-display/avatar/components/avatar-group.js +30 -0
  13. package/dist/components/data-display/avatar/components/avatar-root.js +57 -0
  14. package/dist/components/data-display/avatar/index.js +13 -0
  15. package/dist/components/data-display/badge/badge.js +12 -0
  16. package/dist/components/data-display/badge/badge.styles.js +25 -0
  17. package/dist/components/data-display/calendar/calendar.context.js +13 -0
  18. package/dist/components/data-display/calendar/components/calendar-cell.js +60 -0
  19. package/dist/components/data-display/calendar/components/calendar-grid.js +106 -0
  20. package/dist/components/data-display/calendar/components/calendar-header.js +23 -0
  21. package/dist/components/data-display/calendar/components/calendar-next-trigger.js +34 -0
  22. package/dist/components/data-display/calendar/components/calendar-prev-trigger.js +34 -0
  23. package/dist/components/data-display/calendar/components/calendar-root.js +154 -0
  24. package/dist/components/data-display/calendar/components/calendar-view-trigger.js +28 -0
  25. package/dist/components/data-display/calendar/components/calendar-weekdays.js +43 -0
  26. package/dist/components/data-display/calendar/index.js +30 -0
  27. package/dist/components/data-display/card/card.context.js +10 -0
  28. package/dist/components/data-display/card/card.styles.js +30 -0
  29. package/dist/components/data-display/card/components/card-body.js +19 -0
  30. package/dist/components/data-display/card/components/card-description.js +25 -0
  31. package/dist/components/data-display/card/components/card-footer.js +32 -0
  32. package/dist/components/data-display/card/components/card-header.js +37 -0
  33. package/dist/components/data-display/card/components/card-root.js +30 -0
  34. package/dist/components/data-display/card/components/card-title.js +25 -0
  35. package/dist/components/data-display/card/index.js +24 -0
  36. package/dist/components/data-display/data-list/components/data-list-item.js +20 -0
  37. package/dist/components/data-display/data-list/components/data-list-label.js +23 -0
  38. package/dist/components/data-display/data-list/components/data-list-root.js +11 -0
  39. package/dist/components/data-display/data-list/components/data-list-value.js +12 -0
  40. package/dist/components/data-display/data-list/data-list.context.js +12 -0
  41. package/dist/components/data-display/data-list/index.js +16 -0
  42. package/dist/components/data-display/image/components/image-group.js +79 -0
  43. package/dist/components/data-display/image/components/image-lightbox.js +188 -0
  44. package/dist/components/data-display/image/components/image-root.js +98 -0
  45. package/dist/components/data-display/image/components/image.constants.js +28 -0
  46. package/dist/components/data-display/image/index.js +11 -0
  47. package/dist/components/data-display/marquee/components/marquee-item.js +27 -0
  48. package/dist/components/data-display/marquee/components/marquee-root.js +130 -0
  49. package/dist/components/data-display/marquee/index.js +11 -0
  50. package/dist/components/data-display/qr-code/index.js +7 -0
  51. package/dist/components/data-display/qr-code/qr-code.js +203 -0
  52. package/dist/components/data-display/stat/components/stat-help-text.js +9 -0
  53. package/dist/components/data-display/stat/components/stat-indicator.js +23 -0
  54. package/dist/components/data-display/stat/components/stat-label.js +9 -0
  55. package/dist/components/data-display/stat/components/stat-root.js +10 -0
  56. package/dist/components/data-display/stat/components/stat-value.js +9 -0
  57. package/dist/components/data-display/stat/index.js +19 -0
  58. package/dist/components/data-display/stat/stat.context.js +6 -0
  59. package/dist/components/data-display/table/components/table-body.js +9 -0
  60. package/dist/components/data-display/table/components/table-caption.js +26 -0
  61. package/dist/components/data-display/table/components/table-cell.js +12 -0
  62. package/dist/components/data-display/table/components/table-footer.js +9 -0
  63. package/dist/components/data-display/table/components/table-head.js +20 -0
  64. package/dist/components/data-display/table/components/table-header.js +22 -0
  65. package/dist/components/data-display/table/components/table-root.js +20 -0
  66. package/dist/components/data-display/table/components/table-row.js +23 -0
  67. package/dist/components/data-display/table/index.js +28 -0
  68. package/dist/components/data-display/table/table.context.js +12 -0
  69. package/dist/components/data-display/table/table.styles.js +9 -0
  70. package/dist/components/data-display/tag/components/checkable-tag-group.js +37 -0
  71. package/dist/components/data-display/tag/components/checkable-tag.js +45 -0
  72. package/dist/components/data-display/tag/components/tag-root.js +52 -0
  73. package/dist/components/data-display/tag/index.js +14 -0
  74. package/dist/components/data-display/tag/tag.styles.js +27 -0
  75. package/dist/components/data-display/timeline/components/timeline-content.js +23 -0
  76. package/dist/components/data-display/timeline/components/timeline-indicator.js +21 -0
  77. package/dist/components/data-display/timeline/components/timeline-item.js +23 -0
  78. package/dist/components/data-display/timeline/components/timeline-root.js +12 -0
  79. package/dist/components/data-display/timeline/index.js +20 -0
  80. package/dist/components/data-display/timeline/timeline.context.js +18 -0
  81. package/dist/components/data-display/timeline/timeline.styles.js +33 -0
  82. package/dist/components/data-entry/checkbox/checkbox.context.js +12 -0
  83. package/dist/components/data-entry/checkbox/checkbox.styles.js +14 -0
  84. package/dist/components/data-entry/checkbox/components/checkbox-group.js +38 -0
  85. package/dist/components/data-entry/checkbox/components/checkbox.js +86 -0
  86. package/dist/components/data-entry/checkbox/index.js +11 -0
  87. package/dist/components/data-entry/combobox/combobox.js +178 -0
  88. package/dist/components/data-entry/field/components/field-error-text.js +47 -0
  89. package/dist/components/data-entry/field/components/field-help-text.js +30 -0
  90. package/dist/components/data-entry/field/components/field-label.js +35 -0
  91. package/dist/components/data-entry/field/components/field-root.js +45 -0
  92. package/dist/components/data-entry/field/field.context.js +10 -0
  93. package/dist/components/data-entry/field/index.js +17 -0
  94. package/dist/components/data-entry/input/components/input-group.js +15 -0
  95. package/dist/components/data-entry/input/components/input-password.js +42 -0
  96. package/dist/components/data-entry/input/components/input-search.js +48 -0
  97. package/dist/components/data-entry/input/components/input-textarea.js +53 -0
  98. package/dist/components/data-entry/input/components/input.js +44 -0
  99. package/dist/components/data-entry/input/index.js +18 -0
  100. package/dist/components/data-entry/input/input.context.js +13 -0
  101. package/dist/components/data-entry/input/input.styles.js +48 -0
  102. package/dist/components/data-entry/multi-select/components/multi-select.js +301 -0
  103. package/dist/components/data-entry/multi-select/multi-select.styles.js +47 -0
  104. package/dist/components/data-entry/number-input/number-input.js +97 -0
  105. package/dist/components/data-entry/pin-input/components/pin-input.js +127 -0
  106. package/dist/components/data-entry/pin-input/pin-input.styles.js +35 -0
  107. package/dist/components/data-entry/radio/components/radio-group.js +38 -0
  108. package/dist/components/data-entry/radio/components/radio.js +80 -0
  109. package/dist/components/data-entry/radio/index.js +11 -0
  110. package/dist/components/data-entry/radio/radio.context.js +10 -0
  111. package/dist/components/data-entry/radio/radio.styles.js +14 -0
  112. package/dist/components/data-entry/select/components/select.js +208 -0
  113. package/dist/components/data-entry/select/select.styles.js +35 -0
  114. package/dist/components/data-entry/shared/options.js +49 -0
  115. package/dist/components/data-entry/slider/components/slider.js +395 -0
  116. package/dist/components/data-entry/slider/slider.styles.js +15 -0
  117. package/dist/components/data-entry/switch/components/switch.js +86 -0
  118. package/dist/components/data-entry/switch/switch.styles.js +14 -0
  119. package/dist/components/disclosure/accordion/accordion.context.js +20 -0
  120. package/dist/components/disclosure/accordion/accordion.styles.js +84 -0
  121. package/dist/components/disclosure/accordion/components/accordion-content.js +26 -0
  122. package/dist/components/disclosure/accordion/components/accordion-item.js +30 -0
  123. package/dist/components/disclosure/accordion/components/accordion-root.js +80 -0
  124. package/dist/components/disclosure/accordion/components/accordion-trigger.js +49 -0
  125. package/dist/components/disclosure/accordion/index.js +16 -0
  126. package/dist/components/disclosure/carousel/carousel.context.js +18 -0
  127. package/dist/components/disclosure/carousel/carousel.styles.js +77 -0
  128. package/dist/components/disclosure/carousel/components/carousel-autoplay-trigger.js +25 -0
  129. package/dist/components/disclosure/carousel/components/carousel-control.js +12 -0
  130. package/dist/components/disclosure/carousel/components/carousel-indicator.js +22 -0
  131. package/dist/components/disclosure/carousel/components/carousel-indicators.js +32 -0
  132. package/dist/components/disclosure/carousel/components/carousel-next.js +24 -0
  133. package/dist/components/disclosure/carousel/components/carousel-prev.js +24 -0
  134. package/dist/components/disclosure/carousel/components/carousel-progress-text.js +21 -0
  135. package/dist/components/disclosure/carousel/components/carousel-root.js +129 -0
  136. package/dist/components/disclosure/carousel/components/carousel-slide.js +49 -0
  137. package/dist/components/disclosure/carousel/components/carousel-track.js +74 -0
  138. package/dist/components/disclosure/carousel/index.js +34 -0
  139. package/dist/components/disclosure/pagination/components/pagination-controls.js +79 -0
  140. package/dist/components/disclosure/pagination/components/pagination-ellipsis.js +11 -0
  141. package/dist/components/disclosure/pagination/components/pagination-item.js +24 -0
  142. package/dist/components/disclosure/pagination/components/pagination-jumper.js +35 -0
  143. package/dist/components/disclosure/pagination/components/pagination-list.js +9 -0
  144. package/dist/components/disclosure/pagination/components/pagination-page-text.js +18 -0
  145. package/dist/components/disclosure/pagination/components/pagination-pages.js +24 -0
  146. package/dist/components/disclosure/pagination/components/pagination-root.js +44 -0
  147. package/dist/components/disclosure/pagination/index.js +34 -0
  148. package/dist/components/disclosure/pagination/pagination.context.js +12 -0
  149. package/dist/components/disclosure/pagination/pagination.styles.js +84 -0
  150. package/dist/components/feedback/alert/alert.js +55 -0
  151. package/dist/components/feedback/alert/alert.styles.js +23 -0
  152. package/dist/components/feedback/progress/progress.js +112 -0
  153. package/dist/components/feedback/progress/progress.styles.js +25 -0
  154. package/dist/components/feedback/skeleton/skeleton.js +27 -0
  155. package/dist/components/feedback/skeleton/skeleton.styles.js +20 -0
  156. package/dist/components/feedback/spinner/spinner.js +32 -0
  157. package/dist/components/feedback/spinner/spinner.styles.js +17 -0
  158. package/dist/components/feedback/status.js +18 -0
  159. package/dist/components/feedback/toast/toast-store.js +35 -0
  160. package/dist/components/feedback/toast/toast.styles.js +20 -0
  161. package/dist/components/feedback/toast/toaster.js +65 -0
  162. package/dist/components/icon/icon.js +47 -0
  163. package/dist/components/icon/icon.styles.js +20 -0
  164. package/dist/components/icon/internal-icons.js +143 -0
  165. package/dist/components/layout/aspect-ratio/aspect-ratio.js +32 -0
  166. package/dist/components/layout/aspect-ratio/aspect-ratio.styles.js +18 -0
  167. package/dist/components/layout/box/box.js +30 -0
  168. package/dist/components/layout/box/box.styles.js +76 -0
  169. package/dist/components/layout/center/center.js +31 -0
  170. package/dist/components/layout/container/container.js +40 -0
  171. package/dist/components/layout/flex/flex-item.js +35 -0
  172. package/dist/components/layout/flex/flex.js +32 -0
  173. package/dist/components/layout/flex/flex.style.js +42 -0
  174. package/dist/components/layout/flex/index.js +11 -0
  175. package/dist/components/layout/float/float.js +32 -0
  176. package/dist/components/layout/float/float.styles.js +29 -0
  177. package/dist/components/layout/grid/grid-item.js +36 -0
  178. package/dist/components/layout/grid/grid.js +47 -0
  179. package/dist/components/layout/grid/grid.styles.js +43 -0
  180. package/dist/components/layout/grid/index.js +10 -0
  181. package/dist/components/layout/separator/separator.js +33 -0
  182. package/dist/components/layout/separator/separator.styles.js +29 -0
  183. package/dist/components/layout/stack/stack.js +24 -0
  184. package/dist/components/menu/components/menu-content.js +62 -0
  185. package/dist/components/menu/components/menu-parts.js +81 -0
  186. package/dist/components/menu/components/menu-root.js +36 -0
  187. package/dist/components/menu/index.js +15 -0
  188. package/dist/components/menu/menu.context.js +12 -0
  189. package/dist/components/menu/menu.styles.js +12 -0
  190. package/dist/components/navigation/breadcrumb/breadcrumb.js +50 -0
  191. package/dist/components/navigation/steps/components/steps-completed.js +12 -0
  192. package/dist/components/navigation/steps/components/steps-content.js +12 -0
  193. package/dist/components/navigation/steps/components/steps-description.js +13 -0
  194. package/dist/components/navigation/steps/components/steps-indicator.js +34 -0
  195. package/dist/components/navigation/steps/components/steps-item.js +112 -0
  196. package/dist/components/navigation/steps/components/steps-list.js +21 -0
  197. package/dist/components/navigation/steps/components/steps-next.js +25 -0
  198. package/dist/components/navigation/steps/components/steps-prev.js +25 -0
  199. package/dist/components/navigation/steps/components/steps-root.js +61 -0
  200. package/dist/components/navigation/steps/components/steps-title.js +13 -0
  201. package/dist/components/navigation/steps/index.js +34 -0
  202. package/dist/components/navigation/steps/steps.context.js +20 -0
  203. package/dist/components/navigation/steps/steps.styles.js +97 -0
  204. package/dist/components/navigation/tabs/components/tabs-content.js +26 -0
  205. package/dist/components/navigation/tabs/components/tabs-list.js +45 -0
  206. package/dist/components/navigation/tabs/components/tabs-root.js +54 -0
  207. package/dist/components/navigation/tabs/components/tabs-trigger.js +54 -0
  208. package/dist/components/navigation/tabs/index.js +16 -0
  209. package/dist/components/navigation/tabs/tabs.context.js +12 -0
  210. package/dist/components/navigation/tabs/tabs.styles.js +80 -0
  211. package/dist/components/overlay/drawer/components/drawer-content.js +48 -0
  212. package/dist/components/overlay/drawer/components/drawer-parts.js +48 -0
  213. package/dist/components/overlay/drawer/components/drawer-root.js +58 -0
  214. package/dist/components/overlay/drawer/drawer.context.js +12 -0
  215. package/dist/components/overlay/drawer/drawer.styles.js +32 -0
  216. package/dist/components/overlay/drawer/index.js +27 -0
  217. package/dist/components/overlay/modal/components/modal-content.js +48 -0
  218. package/dist/components/overlay/modal/components/modal-parts.js +48 -0
  219. package/dist/components/overlay/modal/components/modal-root.js +58 -0
  220. package/dist/components/overlay/modal/index.js +27 -0
  221. package/dist/components/overlay/modal/modal.context.js +12 -0
  222. package/dist/components/overlay/modal/modal.styles.js +31 -0
  223. package/dist/components/overlay/popover/components/popover-content.js +76 -0
  224. package/dist/components/overlay/popover/components/popover-parts.js +17 -0
  225. package/dist/components/overlay/popover/components/popover-root.js +71 -0
  226. package/dist/components/overlay/popover/index.js +19 -0
  227. package/dist/components/overlay/popover/popover.context.js +12 -0
  228. package/dist/components/overlay/popover/popover.styles.js +6 -0
  229. package/dist/components/overlay/portal.js +10 -0
  230. package/dist/components/overlay/tooltip/components/tooltip-content.js +52 -0
  231. package/dist/components/overlay/tooltip/components/tooltip-root.js +53 -0
  232. package/dist/components/overlay/tooltip/index.js +12 -0
  233. package/dist/components/overlay/tooltip/tooltip.context.js +12 -0
  234. package/dist/components/overlay/tooltip/tooltip.styles.js +6 -0
  235. package/dist/components/typography/blockquote/blockquote.js +39 -0
  236. package/dist/components/typography/blockquote/blockquote.styles.js +21 -0
  237. package/dist/components/typography/code/code.js +35 -0
  238. package/dist/components/typography/code/code.styles.js +26 -0
  239. package/dist/components/typography/code-block/code-block.js +57 -0
  240. package/dist/components/typography/code-block/code-block.styles.js +36 -0
  241. package/dist/components/typography/heading/heading.js +21 -0
  242. package/dist/components/typography/highlight/highlight.js +30 -0
  243. package/dist/components/typography/highlight/highlight.styles.js +18 -0
  244. package/dist/components/typography/kbd/kbd.js +26 -0
  245. package/dist/components/typography/link/link.js +48 -0
  246. package/dist/components/typography/list/index.js +10 -0
  247. package/dist/components/typography/list/list-item.js +37 -0
  248. package/dist/components/typography/list/list.js +35 -0
  249. package/dist/components/typography/list/list.styles.js +35 -0
  250. package/dist/components/typography/text/text.js +80 -0
  251. package/dist/components/typography/text/text.styles.js +110 -0
  252. package/dist/const/color-mappings.js +541 -0
  253. package/dist/const/color-schemes.js +5 -0
  254. package/dist/const/common-mappings.js +127 -0
  255. package/dist/const/layout-mappings.js +446 -0
  256. package/dist/const/positioning-mappings.js +164 -0
  257. package/dist/const/rounded-mappings.js +121 -0
  258. package/dist/const/sizing-mappings.js +1113 -0
  259. package/dist/const/spacing-mappings.js +508 -0
  260. package/dist/hooks/use-anchor-position.js +39 -0
  261. package/dist/hooks/use-controllable-state.js +18 -0
  262. package/dist/hooks/use-dismiss.js +23 -0
  263. package/dist/hooks/use-overlay-behavior.js +42 -0
  264. package/dist/hooks/use-prefers-reduced-motion.js +15 -0
  265. package/dist/hooks/use-presence.js +18 -0
  266. package/dist/hooks/use-roving-focus.js +51 -0
  267. package/dist/index.d.ts +3533 -0
  268. package/dist/index.js +359 -0
  269. package/dist/styles.css +2 -0
  270. package/dist/theme/provider.js +130 -0
  271. package/dist/utils/astralis-merge.js +31 -0
  272. package/dist/utils/overlay-stack.js +27 -0
  273. package/dist/utils/responsive.js +32 -0
  274. package/dist/utils/split-variant-props.js +13 -0
  275. package/package.json +107 -0
@@ -0,0 +1,60 @@
1
+ "use client";
2
+ import { jsx as n } from "react/jsx-runtime";
3
+ import { useCalendarContext as D } from "../calendar.context.js";
4
+ import { isToday as v } from "./calendar-root.js";
5
+ const d = {
6
+ sm: "astralis:h-8 astralis:w-8",
7
+ md: "astralis:h-9 astralis:w-9",
8
+ lg: "astralis:h-10 astralis:w-10"
9
+ };
10
+ function w({
11
+ date: a,
12
+ className: c,
13
+ children: u,
14
+ onClick: b,
15
+ ref: m,
16
+ ...f
17
+ }) {
18
+ const {
19
+ showOutsideDays: r,
20
+ isOutsideMonth: h,
21
+ isDateDisabled: p,
22
+ isDateSelected: g,
23
+ isDateInRange: x,
24
+ selectDate: y,
25
+ size: i
26
+ } = D(), t = h(a), l = p(a) || t && !r, s = g(a), e = x(a), o = v(a);
27
+ return t && !r ? /* @__PURE__ */ n("div", { className: d[i] }) : /* @__PURE__ */ n(
28
+ "button",
29
+ {
30
+ ref: m,
31
+ type: "button",
32
+ disabled: l,
33
+ "aria-pressed": s,
34
+ "aria-current": o ? "date" : void 0,
35
+ "data-selected": s ? "true" : "false",
36
+ "data-in-range": e ? "true" : "false",
37
+ "data-outside": t ? "true" : "false",
38
+ className: [
39
+ "astralis:inline-flex astralis:items-center astralis:justify-center astralis:rounded-md astralis:border astralis:border-transparent astralis:font-medium astralis:transition-colors",
40
+ d[i],
41
+ s && "astralis:bg-brand-solid astralis:text-brand-contrast astralis:hover:opacity-higher",
42
+ !s && e && "astralis:bg-brand-subtle astralis:text-brand-label",
43
+ !s && !e && "astralis:text-label-base astralis:hover:bg-surface-muted",
44
+ t && !s && "astralis:text-label-subtle",
45
+ o && !s && "astralis:border-stroke-base",
46
+ l && "astralis:cursor-not-allowed astralis:opacity-moderate astralis:hover:bg-transparent",
47
+ c
48
+ ].filter(Boolean).join(" "),
49
+ onClick: (C) => {
50
+ y(a), b?.(C);
51
+ },
52
+ ...f,
53
+ children: u ?? a.getDate()
54
+ }
55
+ );
56
+ }
57
+ w.displayName = "Calendar.Cell";
58
+ export {
59
+ w as CalendarCell
60
+ };
@@ -0,0 +1,106 @@
1
+ "use client";
2
+ import { jsx as p } from "react/jsx-runtime";
3
+ import { useRef as b, useState as Y, useEffect as K } from "react";
4
+ import { useCalendarContext as $ } from "../calendar.context.js";
5
+ import { CalendarCell as v } from "./calendar-cell.js";
6
+ import { toStartOfMonth as R, isToday as j } from "./calendar-root.js";
7
+ function s(t, a) {
8
+ const r = new Date(t);
9
+ return r.setDate(t.getDate() + a), r;
10
+ }
11
+ function M(t, a) {
12
+ const r = new Date(t.getFullYear(), t.getMonth() + a, 1), c = new Date(r.getFullYear(), r.getMonth() + 1, 0).getDate();
13
+ return r.setDate(Math.min(t.getDate(), c)), r;
14
+ }
15
+ function k(t, a) {
16
+ return t.getFullYear() === a.getFullYear() && t.getMonth() === a.getMonth() && t.getDate() === a.getDate();
17
+ }
18
+ function S(t) {
19
+ return `${t.getFullYear()}-${t.getMonth() + 1}-${t.getDate()}`;
20
+ }
21
+ function E({
22
+ className: t,
23
+ ref: a,
24
+ ...r
25
+ }) {
26
+ const {
27
+ visibleMonth: c,
28
+ setVisibleMonth: F,
29
+ firstDayOfWeek: i,
30
+ isDateSelected: C,
31
+ isOutsideMonth: u
32
+ } = $(), h = b(null), [l, y] = Y(null), f = b(!1), w = R(c), x = (w.getDay() - i + 7) % 7, A = s(w, -x), D = Array.from(
33
+ { length: 42 },
34
+ (e, n) => s(A, n)
35
+ ), g = D.filter((e) => !u(e)), d = (l && !u(l) && D.some((e) => k(e, l)) ? l : null) ?? g.find((e) => C(e)) ?? g.find((e) => j(e)) ?? g[0], O = (e) => {
36
+ y(e), f.current = !0, u(e) && F(e);
37
+ };
38
+ return K(() => {
39
+ !f.current || !l || (f.current = !1, h.current?.querySelector(`[data-date="${S(l)}"]`)?.focus());
40
+ }), /* @__PURE__ */ p(
41
+ "div",
42
+ {
43
+ ref: (e) => {
44
+ h.current = e, typeof a == "function" ? a(e) : a && (a.current = e);
45
+ },
46
+ onKeyDown: (e) => {
47
+ const n = l ?? d;
48
+ if (!n) return;
49
+ let o = null;
50
+ switch (e.key) {
51
+ case "ArrowLeft":
52
+ o = s(n, -1);
53
+ break;
54
+ case "ArrowRight":
55
+ o = s(n, 1);
56
+ break;
57
+ case "ArrowUp":
58
+ o = s(n, -7);
59
+ break;
60
+ case "ArrowDown":
61
+ o = s(n, 7);
62
+ break;
63
+ case "Home": {
64
+ const m = (n.getDay() - i + 7) % 7;
65
+ o = s(n, -m);
66
+ break;
67
+ }
68
+ case "End": {
69
+ const m = (n.getDay() - i + 7) % 7;
70
+ o = s(n, 6 - m);
71
+ break;
72
+ }
73
+ case "PageUp":
74
+ o = M(n, -1);
75
+ break;
76
+ case "PageDown":
77
+ o = M(n, 1);
78
+ break;
79
+ default:
80
+ return;
81
+ }
82
+ e.preventDefault(), O(o);
83
+ },
84
+ className: [
85
+ "astralis:grid astralis:grid-cols-7 astralis:gap-1",
86
+ t
87
+ ].filter(Boolean).join(" "),
88
+ ...r,
89
+ children: D.map((e) => /* @__PURE__ */ p(
90
+ v,
91
+ {
92
+ date: e,
93
+ "data-date": S(e),
94
+ tabIndex: d && k(e, d) ? 0 : -1,
95
+ onFocus: () => y(e),
96
+ "aria-label": e.toDateString()
97
+ },
98
+ e.toISOString()
99
+ ))
100
+ }
101
+ );
102
+ }
103
+ E.displayName = "Calendar.Grid";
104
+ export {
105
+ E as CalendarGrid
106
+ };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { jsx as s } from "react/jsx-runtime";
3
+ function t({
4
+ className: e,
5
+ ref: a,
6
+ ...r
7
+ }) {
8
+ return /* @__PURE__ */ s(
9
+ "div",
10
+ {
11
+ ref: a,
12
+ className: [
13
+ "astralis:flex astralis:items-center astralis:justify-between astralis:gap-2",
14
+ e
15
+ ].filter(Boolean).join(" "),
16
+ ...r
17
+ }
18
+ );
19
+ }
20
+ t.displayName = "Calendar.Header";
21
+ export {
22
+ t as CalendarHeader
23
+ };
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx as o } from "react/jsx-runtime";
3
+ import { useCalendarContext as m } from "../calendar.context.js";
4
+ import { moveVisibleMonth as u } from "./calendar-root.js";
5
+ function b({
6
+ className: e,
7
+ onClick: t,
8
+ children: a,
9
+ ref: r,
10
+ ...s
11
+ }) {
12
+ const { visibleMonth: i, setVisibleMonth: l } = m();
13
+ return /* @__PURE__ */ o(
14
+ "button",
15
+ {
16
+ ref: r,
17
+ type: "button",
18
+ "aria-label": "Next month",
19
+ className: [
20
+ "astralis:inline-flex astralis:h-8 astralis:w-8 astralis:items-center astralis:justify-center astralis:rounded-md astralis:text-label-muted astralis:hover:bg-surface-muted astralis:hover:text-label-base",
21
+ e
22
+ ].filter(Boolean).join(" "),
23
+ onClick: (n) => {
24
+ l(u(i, 1)), t?.(n);
25
+ },
26
+ ...s,
27
+ children: a ?? ">"
28
+ }
29
+ );
30
+ }
31
+ b.displayName = "Calendar.NextTrigger";
32
+ export {
33
+ b as CalendarNextTrigger
34
+ };
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx as n } from "react/jsx-runtime";
3
+ import { useCalendarContext as m } from "../calendar.context.js";
4
+ import { moveVisibleMonth as u } from "./calendar-root.js";
5
+ function b({
6
+ className: e,
7
+ onClick: t,
8
+ children: r,
9
+ ref: a,
10
+ ...s
11
+ }) {
12
+ const { visibleMonth: i, setVisibleMonth: l } = m();
13
+ return /* @__PURE__ */ n(
14
+ "button",
15
+ {
16
+ ref: a,
17
+ type: "button",
18
+ "aria-label": "Previous month",
19
+ className: [
20
+ "astralis:inline-flex astralis:h-8 astralis:w-8 astralis:items-center astralis:justify-center astralis:rounded-md astralis:text-label-muted astralis:hover:bg-surface-muted astralis:hover:text-label-base",
21
+ e
22
+ ].filter(Boolean).join(" "),
23
+ onClick: (o) => {
24
+ l(u(i, -1)), t?.(o);
25
+ },
26
+ ...s,
27
+ children: r ?? "<"
28
+ }
29
+ );
30
+ }
31
+ b.displayName = "Calendar.PrevTrigger";
32
+ export {
33
+ b as CalendarPrevTrigger
34
+ };
@@ -0,0 +1,154 @@
1
+ "use client";
2
+ import { jsx as i, jsxs as V, Fragment as Z } from "react/jsx-runtime";
3
+ import { useState as b, useMemo as w } from "react";
4
+ import { CalendarContext as _ } from "../calendar.context.js";
5
+ import { CalendarGrid as q } from "./calendar-grid.js";
6
+ import { CalendarHeader as J } from "./calendar-header.js";
7
+ import { CalendarNextTrigger as K } from "./calendar-next-trigger.js";
8
+ import { CalendarPrevTrigger as Q } from "./calendar-prev-trigger.js";
9
+ import { CalendarViewTrigger as U } from "./calendar-view-trigger.js";
10
+ import { CalendarWeekdays as X } from "./calendar-weekdays.js";
11
+ const $ = {
12
+ sm: "astralis:text-xs",
13
+ md: "astralis:text-sm",
14
+ lg: "astralis:text-base"
15
+ };
16
+ function s(t) {
17
+ return new Date(t.getFullYear(), t.getMonth(), t.getDate());
18
+ }
19
+ function S(t) {
20
+ return new Date(t.getFullYear(), t.getMonth(), 1);
21
+ }
22
+ function v(t, a) {
23
+ return new Date(t.getFullYear(), t.getMonth() + a, 1);
24
+ }
25
+ function o(t, a) {
26
+ return t.getFullYear() === a.getFullYear() && t.getMonth() === a.getMonth() && t.getDate() === a.getDate();
27
+ }
28
+ function c(t) {
29
+ return !!t && !Array.isArray(t) && !(t instanceof Date);
30
+ }
31
+ function F(t, a) {
32
+ return a === "single" ? t instanceof Date ? s(t) : null : a === "multiple" ? Array.isArray(t) ? t.map(s) : [] : c(t) ? {
33
+ start: t.start ? s(t.start) : null,
34
+ end: t.end ? s(t.end) : null
35
+ } : { start: null, end: null };
36
+ }
37
+ function tt({
38
+ selectionMode: t = "single",
39
+ value: a,
40
+ defaultValue: I,
41
+ onValueChange: R,
42
+ defaultMonth: T,
43
+ locale: m = "en-US",
44
+ firstDayOfWeek: Y = 0,
45
+ showOutsideDays: O = !0,
46
+ minDate: h,
47
+ maxDate: D,
48
+ isDateUnavailable: p,
49
+ size: y = "md",
50
+ className: j,
51
+ style: N,
52
+ children: P,
53
+ ref: k,
54
+ ...z
55
+ }) {
56
+ const B = S(T ?? /* @__PURE__ */ new Date()), [f, E] = b(B), [x, G] = b(
57
+ () => F(I ?? null, t)
58
+ ), r = w(
59
+ () => F(a ?? x, t),
60
+ [a, x, t]
61
+ ), H = w(
62
+ () => new Intl.DateTimeFormat(m, {
63
+ month: "long",
64
+ year: "numeric"
65
+ }).format(f),
66
+ [m, f]
67
+ ), C = h ? s(h) : null, M = D ? s(D) : null, A = (n) => {
68
+ const e = s(n);
69
+ return C && e < C || M && e > M ? !0 : p ? p(e) : !1;
70
+ }, l = (n) => {
71
+ a === void 0 && G(n), R?.(n);
72
+ }, L = {
73
+ visibleMonth: f,
74
+ setVisibleMonth: E,
75
+ monthLabel: H,
76
+ selectionMode: t,
77
+ selectedValue: r,
78
+ selectDate: (n) => {
79
+ const e = s(n);
80
+ if (A(e))
81
+ return;
82
+ if (t === "single") {
83
+ l(e);
84
+ return;
85
+ }
86
+ if (t === "multiple") {
87
+ const d = Array.isArray(r) ? r : [], W = d.some((g) => o(g, e)) ? d.filter((g) => !o(g, e)) : [...d, e];
88
+ l(W);
89
+ return;
90
+ }
91
+ const u = c(r) ? r : { start: null, end: null };
92
+ if (!u.start || u.end) {
93
+ l({ start: e, end: null });
94
+ return;
95
+ }
96
+ if (e < u.start) {
97
+ l({ start: e, end: u.start });
98
+ return;
99
+ }
100
+ l({ start: u.start, end: e });
101
+ },
102
+ isDateSelected: (n) => r instanceof Date ? o(r, n) : Array.isArray(r) ? r.some((e) => o(e, n)) : c(r) ? !!r.start && o(r.start, n) || !!r.end && o(r.end, n) : !1,
103
+ isDateInRange: (n) => {
104
+ if (!c(r) || !r.start || !r.end)
105
+ return !1;
106
+ const e = s(n);
107
+ return e > r.start && e < r.end;
108
+ },
109
+ isDateDisabled: A,
110
+ isOutsideMonth: (n) => n.getMonth() !== f.getMonth(),
111
+ showOutsideDays: O,
112
+ firstDayOfWeek: Y,
113
+ locale: m,
114
+ size: y
115
+ };
116
+ return /* @__PURE__ */ i(_.Provider, { value: L, children: /* @__PURE__ */ i(
117
+ "div",
118
+ {
119
+ ref: k,
120
+ className: [
121
+ "astralis:inline-flex astralis:flex-col astralis:gap-3 astralis:rounded-xl astralis:border astralis:border-stroke-subtle astralis:bg-surface-base astralis:p-3",
122
+ $[y],
123
+ j
124
+ ].filter(Boolean).join(" "),
125
+ style: N,
126
+ ...z,
127
+ children: P ?? /* @__PURE__ */ V(Z, { children: [
128
+ /* @__PURE__ */ V(J, { children: [
129
+ /* @__PURE__ */ i(Q, {}),
130
+ /* @__PURE__ */ i(U, {}),
131
+ /* @__PURE__ */ i(K, {})
132
+ ] }),
133
+ /* @__PURE__ */ i(X, {}),
134
+ /* @__PURE__ */ i(q, {})
135
+ ] })
136
+ }
137
+ ) });
138
+ }
139
+ function gt(t, a) {
140
+ return v(t, a);
141
+ }
142
+ function ht(t) {
143
+ return o(t, /* @__PURE__ */ new Date());
144
+ }
145
+ function Dt(t) {
146
+ return S(t);
147
+ }
148
+ tt.displayName = "Calendar.Root";
149
+ export {
150
+ tt as CalendarRoot,
151
+ ht as isToday,
152
+ gt as moveVisibleMonth,
153
+ Dt as toStartOfMonth
154
+ };
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { jsx as l } from "react/jsx-runtime";
3
+ import { useCalendarContext as i } from "../calendar.context.js";
4
+ function n({
5
+ className: e,
6
+ children: t,
7
+ ref: a,
8
+ ...r
9
+ }) {
10
+ const { monthLabel: s } = i();
11
+ return /* @__PURE__ */ l(
12
+ "button",
13
+ {
14
+ ref: a,
15
+ type: "button",
16
+ className: [
17
+ "astralis:flex-1 astralis:rounded-md astralis:px-2 astralis:py-1 astralis:text-center astralis:font-semibold astralis:text-label-base",
18
+ e
19
+ ].filter(Boolean).join(" "),
20
+ ...r,
21
+ children: t ?? s
22
+ }
23
+ );
24
+ }
25
+ n.displayName = "Calendar.ViewTrigger";
26
+ export {
27
+ n as CalendarViewTrigger
28
+ };
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import { jsx as n } from "react/jsx-runtime";
3
+ import { useMemo as u } from "react";
4
+ import { useCalendarContext as f } from "../calendar.context.js";
5
+ function p(e, a) {
6
+ return [...e.slice(a), ...e.slice(0, a)];
7
+ }
8
+ function x({
9
+ className: e,
10
+ ref: a,
11
+ ...o
12
+ }) {
13
+ const { locale: r, firstDayOfWeek: l } = f(), c = u(() => {
14
+ const t = new Date(2024, 0, 7), s = new Intl.DateTimeFormat(r, { weekday: "short" }), m = Array.from({ length: 7 }, (y, d) => {
15
+ const i = new Date(t);
16
+ return i.setDate(t.getDate() + d), s.format(i);
17
+ });
18
+ return p(m, l);
19
+ }, [l, r]);
20
+ return /* @__PURE__ */ n(
21
+ "div",
22
+ {
23
+ ref: a,
24
+ className: [
25
+ "astralis:grid astralis:grid-cols-7 astralis:gap-1",
26
+ e
27
+ ].filter(Boolean).join(" "),
28
+ ...o,
29
+ children: c.map((t, s) => /* @__PURE__ */ n(
30
+ "div",
31
+ {
32
+ className: "astralis:flex astralis:h-8 astralis:items-center astralis:justify-center astralis:text-xs astralis:font-medium astralis:uppercase astralis:tracking-wide astralis:text-label-subtle",
33
+ children: t
34
+ },
35
+ s
36
+ ))
37
+ }
38
+ );
39
+ }
40
+ x.displayName = "Calendar.Weekdays";
41
+ export {
42
+ x as CalendarWeekdays
43
+ };
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import { CalendarHeader as e } from "./components/calendar-header.js";
3
+ import { CalendarNextTrigger as a } from "./components/calendar-next-trigger.js";
4
+ import { CalendarPrevTrigger as o } from "./components/calendar-prev-trigger.js";
5
+ import { CalendarRoot as r } from "./components/calendar-root.js";
6
+ import { CalendarViewTrigger as i } from "./components/calendar-view-trigger.js";
7
+ import { CalendarWeekdays as m } from "./components/calendar-weekdays.js";
8
+ import { CalendarGrid as t } from "./components/calendar-grid.js";
9
+ import { CalendarCell as d } from "./components/calendar-cell.js";
10
+ const c = Object.assign(r, {
11
+ Root: r,
12
+ Header: e,
13
+ PrevTrigger: o,
14
+ ViewTrigger: i,
15
+ NextTrigger: a,
16
+ Weekdays: m,
17
+ Grid: t,
18
+ Cell: d
19
+ });
20
+ export {
21
+ c as Calendar,
22
+ d as CalendarCell,
23
+ t as CalendarGrid,
24
+ e as CalendarHeader,
25
+ a as CalendarNextTrigger,
26
+ o as CalendarPrevTrigger,
27
+ r as CalendarRoot,
28
+ i as CalendarViewTrigger,
29
+ m as CalendarWeekdays
30
+ };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import { useContext as t, createContext as e } from "react";
3
+ const n = e({ size: "md" });
4
+ function r() {
5
+ return t(n);
6
+ }
7
+ export {
8
+ n as CardContext,
9
+ r as useCardContext
10
+ };
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import { cva as a } from "class-variance-authority";
3
+ const r = a("astralis:overflow-hidden astralis:transition-all astralis:duration-moderate", {
4
+ variants: {
5
+ variant: {
6
+ elevated: "astralis:bg-surface-base astralis:border-normal astralis:border-stroke-subtle astralis:shadow-md",
7
+ outline: "astralis:bg-transparent astralis:border-normal astralis:border-stroke-subtle",
8
+ filled: "astralis:bg-surface-muted astralis:border-normal astralis:border-transparent",
9
+ unstyled: ""
10
+ },
11
+ size: {
12
+ sm: "astralis:rounded-lg",
13
+ md: "astralis:rounded-xl",
14
+ lg: "astralis:rounded-2xl"
15
+ },
16
+ hoverable: {
17
+ true: "astralis:cursor-pointer astralis:hover:shadow-lg astralis:hover:-translate-y-0.5 astralis:active:scale-95",
18
+ false: ""
19
+ }
20
+ },
21
+ defaultVariants: { variant: "elevated", size: "md", hoverable: !1 }
22
+ }), t = {
23
+ sm: "astralis:px-4 astralis:py-3",
24
+ md: "astralis:px-5 astralis:py-4",
25
+ lg: "astralis:px-7 astralis:py-5"
26
+ };
27
+ export {
28
+ t as cardPadding,
29
+ r as cardRootVariants
30
+ };
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { jsx as i } from "react/jsx-runtime";
3
+ import { useCardContext as d } from "../card.context.js";
4
+ import { cardPadding as m } from "../card.styles.js";
5
+ import { astralisMerge as l } from "../../../../utils/astralis-merge.js";
6
+ function n({
7
+ className: r = "",
8
+ style: a,
9
+ children: t,
10
+ ref: e,
11
+ ...o
12
+ }) {
13
+ const { size: s } = d();
14
+ return /* @__PURE__ */ i("div", { ref: e, className: l(m[s], "astralis:text-label-base", r), style: a, ...o, children: t });
15
+ }
16
+ n.displayName = "Card.Body";
17
+ export {
18
+ n as CardBody
19
+ };
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { jsx as i } from "react/jsx-runtime";
3
+ import { astralisMerge as l } from "../../../../utils/astralis-merge.js";
4
+ function m({
5
+ className: a = "",
6
+ style: e,
7
+ children: r,
8
+ ref: t,
9
+ ...s
10
+ }) {
11
+ return /* @__PURE__ */ i(
12
+ "p",
13
+ {
14
+ ref: t,
15
+ className: l("astralis:text-sm astralis:text-label-muted astralis:leading-relaxed", a),
16
+ style: e,
17
+ ...s,
18
+ children: r
19
+ }
20
+ );
21
+ }
22
+ m.displayName = "Card.Description";
23
+ export {
24
+ m as CardDescription
25
+ };
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import { jsx as i } from "react/jsx-runtime";
3
+ import { useCardContext as l } from "../card.context.js";
4
+ import { cardPadding as m } from "../card.styles.js";
5
+ import { astralisMerge as d } from "../../../../utils/astralis-merge.js";
6
+ function n({
7
+ className: r = "",
8
+ style: t,
9
+ children: s,
10
+ ref: a,
11
+ ...e
12
+ }) {
13
+ const { size: o } = l();
14
+ return /* @__PURE__ */ i(
15
+ "div",
16
+ {
17
+ ref: a,
18
+ className: d(
19
+ "astralis:flex astralis:items-center astralis:gap-3 astralis:border-t astralis:border-stroke-subtle",
20
+ m[o],
21
+ r
22
+ ),
23
+ style: t,
24
+ ...e,
25
+ children: s
26
+ }
27
+ );
28
+ }
29
+ n.displayName = "Card.Footer";
30
+ export {
31
+ n as CardFooter
32
+ };
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import { jsxs as m, jsx as r } from "react/jsx-runtime";
3
+ import { useCardContext as n } from "../card.context.js";
4
+ import { cardPadding as c } from "../card.styles.js";
5
+ import { astralisMerge as f } from "../../../../utils/astralis-merge.js";
6
+ function p({
7
+ extra: s,
8
+ className: i = "",
9
+ style: t,
10
+ children: e,
11
+ ref: l,
12
+ ...o
13
+ }) {
14
+ const { size: d } = n(), a = s != null;
15
+ return /* @__PURE__ */ m(
16
+ "div",
17
+ {
18
+ ref: l,
19
+ className: f(
20
+ "astralis:flex astralis:items-start astralis:justify-between astralis:gap-3",
21
+ a ? "astralis:border-b astralis:border-stroke-subtle" : "",
22
+ c[d],
23
+ i
24
+ ),
25
+ style: t,
26
+ ...o,
27
+ children: [
28
+ /* @__PURE__ */ r("div", { className: "astralis:flex astralis:flex-col astralis:gap-1 astralis:min-w-0", children: e }),
29
+ a && /* @__PURE__ */ r("div", { className: "astralis:shrink-0 astralis:flex astralis:items-center astralis:gap-2", children: s })
30
+ ]
31
+ }
32
+ );
33
+ }
34
+ p.displayName = "Card.Header";
35
+ export {
36
+ p as CardHeader
37
+ };