@devalok/shilp-sutra 0.8.4 → 0.9.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 (218) hide show
  1. package/dist/_chunks/avatar.js +50 -0
  2. package/dist/_chunks/button.js +95 -0
  3. package/dist/_chunks/card.js +40 -0
  4. package/dist/_chunks/checkbox.js +14 -0
  5. package/dist/_chunks/form.js +27 -0
  6. package/dist/_chunks/primitives.js +6965 -0
  7. package/dist/_chunks/sidebar.js +592 -0
  8. package/dist/_chunks/spinner.js +34 -0
  9. package/dist/_chunks/tiptap.js +15254 -0
  10. package/dist/_chunks/tooltip.js +13 -0
  11. package/dist/_chunks/tree-view.js +304 -0
  12. package/dist/_chunks/use-calendar.js +990 -0
  13. package/dist/_chunks/utils.js +15 -0
  14. package/dist/_chunks/vendor-client.js +1835 -0
  15. package/dist/_chunks/vendor-utils.js +3995 -0
  16. package/dist/composed/avatar-group.js +20 -20
  17. package/dist/composed/command-palette.js +1 -1
  18. package/dist/composed/confirm-dialog.js +5 -5
  19. package/dist/composed/content-card.d.ts +1 -1
  20. package/dist/composed/content-card.js +2 -2
  21. package/dist/composed/date-picker/index.js +13 -0
  22. package/dist/composed/empty-state.js +10 -10
  23. package/dist/composed/error-boundary.js +2 -2
  24. package/dist/composed/global-loading.js +4 -4
  25. package/dist/composed/index.js +45 -53
  26. package/dist/composed/loading-skeleton.js +2 -2
  27. package/dist/composed/member-picker.js +5 -5
  28. package/dist/composed/page-header.js +4 -4
  29. package/dist/composed/page-skeletons.js +1 -1
  30. package/dist/composed/priority-indicator.js +6 -6
  31. package/dist/composed/rich-text-editor.js +422 -209
  32. package/dist/composed/schedule-view.js +1 -1
  33. package/dist/composed/simple-tooltip.js +6 -6
  34. package/dist/composed/status-badge.d.ts +1 -1
  35. package/dist/composed/status-badge.js +2 -2
  36. package/dist/shell/bottom-navbar.js +1 -1
  37. package/dist/shell/notification-center.js +2 -2
  38. package/dist/shell/notification-preferences.js +32 -33
  39. package/dist/shell/sidebar.js +24 -24
  40. package/dist/shell/top-bar.js +22 -22
  41. package/dist/ui/accordion.js +17 -17
  42. package/dist/ui/alert-dialog.js +29 -29
  43. package/dist/ui/alert.d.ts +2 -2
  44. package/dist/ui/alert.js +65 -44
  45. package/dist/ui/aspect-ratio.js +1 -1
  46. package/dist/ui/autocomplete.js +11 -11
  47. package/dist/ui/avatar.d.ts +1 -1
  48. package/dist/ui/avatar.js +67 -25
  49. package/dist/ui/badge.d.ts +2 -2
  50. package/dist/ui/badge.js +115 -91
  51. package/dist/ui/banner.d.ts +1 -1
  52. package/dist/ui/banner.js +2 -2
  53. package/dist/ui/breadcrumb.js +14 -14
  54. package/dist/ui/button-group.js +30 -15
  55. package/dist/ui/button.d.ts +2 -2
  56. package/dist/ui/button.js +114 -71
  57. package/dist/ui/card.js +66 -22
  58. package/dist/ui/charts/index.js +1221 -18
  59. package/dist/ui/checkbox.js +25 -5
  60. package/dist/ui/chip.d.ts +4 -4
  61. package/dist/ui/chip.js +2 -2
  62. package/dist/ui/code.js +1 -1
  63. package/dist/ui/collapsible.js +5 -5
  64. package/dist/ui/color-input.js +11 -11
  65. package/dist/ui/combobox.js +12 -12
  66. package/dist/ui/container.js +4 -4
  67. package/dist/ui/context-menu.js +37 -37
  68. package/dist/ui/data-table-toolbar.js +18 -18
  69. package/dist/ui/data-table.js +2 -2
  70. package/dist/ui/dialog.js +33 -33
  71. package/dist/ui/dropdown-menu.js +60 -60
  72. package/dist/ui/file-upload.js +1 -1
  73. package/dist/ui/form.js +36 -15
  74. package/dist/ui/hover-card.js +7 -7
  75. package/dist/ui/icon-button.js +9 -9
  76. package/dist/ui/index.js +523 -325
  77. package/dist/ui/input-otp.d.ts +2 -2
  78. package/dist/ui/input-otp.js +14 -14
  79. package/dist/ui/input.js +56 -28
  80. package/dist/ui/label.js +18 -4
  81. package/dist/ui/lib/utils.js +4 -5
  82. package/dist/ui/link.js +9 -9
  83. package/dist/ui/menubar.js +81 -81
  84. package/dist/ui/navigation-menu.js +42 -42
  85. package/dist/ui/number-input.js +13 -13
  86. package/dist/ui/pagination.js +5 -5
  87. package/dist/ui/popover.js +9 -9
  88. package/dist/ui/progress.d.ts +1 -1
  89. package/dist/ui/progress.js +15 -15
  90. package/dist/ui/radio.js +10 -10
  91. package/dist/ui/search-input.js +5 -5
  92. package/dist/ui/segmented-control.js +91 -83
  93. package/dist/ui/select.js +52 -52
  94. package/dist/ui/separator.js +20 -5
  95. package/dist/ui/sheet.js +28 -28
  96. package/dist/ui/sidebar.js +36 -560
  97. package/dist/ui/skeleton.d.ts +1 -1
  98. package/dist/ui/skeleton.js +7 -7
  99. package/dist/ui/slider.js +11 -11
  100. package/dist/ui/spinner.js +37 -2
  101. package/dist/ui/stack.js +1 -1
  102. package/dist/ui/stat-card.js +1 -1
  103. package/dist/ui/stepper.js +15 -15
  104. package/dist/ui/switch.js +22 -3
  105. package/dist/ui/table.js +1 -1
  106. package/dist/ui/tabs.js +59 -32
  107. package/dist/ui/text.js +2 -2
  108. package/dist/ui/textarea.js +7 -7
  109. package/dist/ui/toast.d.ts +1 -1
  110. package/dist/ui/toast.js +28 -28
  111. package/dist/ui/toggle-group.js +11 -11
  112. package/dist/ui/toggle.js +7 -7
  113. package/dist/ui/tooltip.js +17 -6
  114. package/dist/ui/transitions.js +68 -58
  115. package/dist/ui/tree-view/index.js +7 -0
  116. package/dist/ui/visually-hidden.js +3 -3
  117. package/llms-full.txt +1 -1
  118. package/llms.txt +7 -0
  119. package/package.json +656 -706
  120. package/dist/_virtual/client.js +0 -5
  121. package/dist/_virtual/index.js +0 -5
  122. package/dist/_virtual/react-dom-client.development.js +0 -5
  123. package/dist/_virtual/react-dom-client.production.js +0 -5
  124. package/dist/_virtual/scheduler.development.js +0 -5
  125. package/dist/_virtual/scheduler.production.js +0 -5
  126. package/dist/composed/date-picker/calendar-grid.js +0 -194
  127. package/dist/composed/date-picker/date-picker.js +0 -124
  128. package/dist/composed/date-picker/date-range-picker.js +0 -167
  129. package/dist/composed/date-picker/date-time-picker.js +0 -193
  130. package/dist/composed/date-picker/month-picker.js +0 -53
  131. package/dist/composed/date-picker/presets.js +0 -84
  132. package/dist/composed/date-picker/time-picker.js +0 -181
  133. package/dist/composed/date-picker/use-calendar.js +0 -17
  134. package/dist/composed/date-picker/year-picker.js +0 -45
  135. package/dist/composed/extensions/emoji-suggestion.js +0 -119
  136. package/dist/composed/extensions/file-attachment.js +0 -55
  137. package/dist/composed/extensions/mention-suggestion.js +0 -79
  138. package/dist/node_modules/.pnpm/@emoji-mart_data@1.2.1/node_modules/@emoji-mart/data/sets/15/native.json.js +0 -40141
  139. package/dist/node_modules/.pnpm/@emoji-mart_react@1.1.1_emoji-mart@5.6.0_react@19.2.4/node_modules/@emoji-mart/react/dist/module.js +0 -17
  140. package/dist/node_modules/.pnpm/emoji-mart@5.6.0/node_modules/emoji-mart/dist/module.js +0 -2958
  141. package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/cjs/react-dom-client.development.js +0 -17062
  142. package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/cjs/react-dom-client.production.js +0 -9790
  143. package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/client.js +0 -20
  144. package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.development.js +0 -237
  145. package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.production.js +0 -234
  146. package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/index.js +0 -11
  147. package/dist/primitives/_internal/number.js +0 -6
  148. package/dist/primitives/_internal/primitive.js +0 -9
  149. package/dist/primitives/_internal/react-arrow.js +0 -13
  150. package/dist/primitives/_internal/react-collection.js +0 -48
  151. package/dist/primitives/_internal/react-compose-refs.js +0 -29
  152. package/dist/primitives/_internal/react-context.js +0 -76
  153. package/dist/primitives/_internal/react-direction.js +0 -10
  154. package/dist/primitives/_internal/react-dismissable-layer.js +0 -103
  155. package/dist/primitives/_internal/react-focus-guards.js +0 -17
  156. package/dist/primitives/_internal/react-focus-scope.js +0 -137
  157. package/dist/primitives/_internal/react-id.js +0 -14
  158. package/dist/primitives/_internal/react-popper.js +0 -137
  159. package/dist/primitives/_internal/react-portal.js +0 -16
  160. package/dist/primitives/_internal/react-presence.js +0 -71
  161. package/dist/primitives/_internal/react-primitive.js +0 -36
  162. package/dist/primitives/_internal/react-use-callback-ref.js +0 -13
  163. package/dist/primitives/_internal/react-use-controllable-state.js +0 -44
  164. package/dist/primitives/_internal/react-use-escape-keydown.js +0 -14
  165. package/dist/primitives/_internal/react-use-is-hydrated.js +0 -15
  166. package/dist/primitives/_internal/react-use-layout-effect.js +0 -6
  167. package/dist/primitives/_internal/react-use-previous.js +0 -8
  168. package/dist/primitives/_internal/react-use-size.js +0 -27
  169. package/dist/primitives/react-accordion.js +0 -239
  170. package/dist/primitives/react-alert-dialog.js +0 -127
  171. package/dist/primitives/react-aspect-ratio.js +0 -43
  172. package/dist/primitives/react-avatar.js +0 -75
  173. package/dist/primitives/react-checkbox.js +0 -251
  174. package/dist/primitives/react-collapsible.js +0 -120
  175. package/dist/primitives/react-context-menu.js +0 -240
  176. package/dist/primitives/react-dialog.js +0 -262
  177. package/dist/primitives/react-dropdown-menu.js +0 -227
  178. package/dist/primitives/react-hover-card.js +0 -187
  179. package/dist/primitives/react-label.js +0 -20
  180. package/dist/primitives/react-menu.js +0 -652
  181. package/dist/primitives/react-menubar.js +0 -355
  182. package/dist/primitives/react-navigation-menu.js +0 -607
  183. package/dist/primitives/react-popover.js +0 -243
  184. package/dist/primitives/react-progress.js +0 -84
  185. package/dist/primitives/react-radio-group.js +0 -238
  186. package/dist/primitives/react-roving-focus.js +0 -183
  187. package/dist/primitives/react-select.js +0 -862
  188. package/dist/primitives/react-separator.js +0 -24
  189. package/dist/primitives/react-slider.js +0 -437
  190. package/dist/primitives/react-slot.js +0 -70
  191. package/dist/primitives/react-switch.js +0 -132
  192. package/dist/primitives/react-tabs.js +0 -163
  193. package/dist/primitives/react-toast.js +0 -446
  194. package/dist/primitives/react-toggle-group.js +0 -137
  195. package/dist/primitives/react-toggle.js +0 -33
  196. package/dist/primitives/react-tooltip.js +0 -338
  197. package/dist/primitives/react-visually-hidden.js +0 -32
  198. package/dist/ui/charts/_internal/animation.js +0 -18
  199. package/dist/ui/charts/_internal/axes.js +0 -42
  200. package/dist/ui/charts/_internal/colors.js +0 -21
  201. package/dist/ui/charts/_internal/grid-lines.js +0 -43
  202. package/dist/ui/charts/_internal/legend.js +0 -29
  203. package/dist/ui/charts/_internal/tooltip.js +0 -39
  204. package/dist/ui/charts/_internal/types.js +0 -10
  205. package/dist/ui/charts/area-chart.js +0 -245
  206. package/dist/ui/charts/bar-chart.js +0 -153
  207. package/dist/ui/charts/chart-container.js +0 -27
  208. package/dist/ui/charts/gauge-chart.js +0 -72
  209. package/dist/ui/charts/line-chart.js +0 -163
  210. package/dist/ui/charts/pie-chart.js +0 -132
  211. package/dist/ui/charts/radar-chart.js +0 -223
  212. package/dist/ui/charts/sparkline.js +0 -124
  213. package/dist/ui/lib/motion.js +0 -32
  214. package/dist/ui/lib/use-reduced-motion.js +0 -15
  215. package/dist/ui/lib/use-ripple.js +0 -14
  216. package/dist/ui/tree-view/tree-item.js +0 -139
  217. package/dist/ui/tree-view/tree-view.js +0 -140
  218. package/dist/ui/tree-view/use-tree.js +0 -38
@@ -1,5 +0,0 @@
1
- "use client";
2
- var e = { exports: {} };
3
- export {
4
- e as __module
5
- };
@@ -1,5 +0,0 @@
1
- "use client";
2
- var e = { exports: {} };
3
- export {
4
- e as __module
5
- };
@@ -1,5 +0,0 @@
1
- "use client";
2
- var e = {};
3
- export {
4
- e as __exports
5
- };
@@ -1,5 +0,0 @@
1
- "use client";
2
- var o = {};
3
- export {
4
- o as __exports
5
- };
@@ -1,5 +0,0 @@
1
- "use client";
2
- var e = {};
3
- export {
4
- e as __exports
5
- };
@@ -1,5 +0,0 @@
1
- "use client";
2
- var r = {};
3
- export {
4
- r as __exports
5
- };
@@ -1,194 +0,0 @@
1
- "use client";
2
- import { jsxs as y, jsx as a } from "react/jsx-runtime";
3
- import * as M from "react";
4
- import { format as l, startOfMonth as k, endOfMonth as ee, startOfWeek as te, endOfWeek as se, addDays as m, subMonths as re, addMonths as ne, isSameMonth as T, isSameDay as x, lastDayOfMonth as oe, isBefore as N, startOfDay as G, isAfter as g, isWithinInterval as L } from "date-fns";
5
- import { IconChevronLeft as ae, IconChevronRight as ie } from "@tabler/icons-react";
6
- import { cn as B } from "../../ui/lib/utils.js";
7
- const de = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], ce = M.forwardRef(
8
- function({
9
- currentMonth: i,
10
- selected: R,
11
- rangeStart: n,
12
- rangeEnd: d,
13
- hoverDate: u,
14
- onSelect: j,
15
- onHover: c,
16
- onMonthChange: h,
17
- onHeaderClick: C,
18
- disabledDates: b,
19
- minDate: A,
20
- maxDate: E,
21
- hidePrevNav: q,
22
- hideNextNav: F,
23
- events: w
24
- }, P) {
25
- const v = M.useRef(null), U = M.useMemo(() => {
26
- const e = /* @__PURE__ */ new Map();
27
- if (!w) return e;
28
- for (const o of w) {
29
- const t = l(o.date, "yyyy-MM-dd"), s = e.get(t) ?? [];
30
- s.push(o), e.set(t, s);
31
- }
32
- return e;
33
- }, [w]), Y = k(i), $ = ee(i), z = te(Y), J = se($), D = [];
34
- let p = z;
35
- for (; p <= J; )
36
- D.push(p), p = m(p, 1);
37
- const I = (e) => !!(b != null && b(e) || A && N(e, G(A)) || E && g(e, G(E))), Q = (e) => {
38
- if (n && d) {
39
- const o = N(n, d) ? n : d, t = g(d, n) ? d : n;
40
- return L(e, { start: o, end: t });
41
- }
42
- if (n && u) {
43
- const o = N(n, u) ? n : u, t = g(u, n) ? u : n;
44
- return L(e, { start: o, end: t });
45
- }
46
- return !1;
47
- }, S = (e) => !!(n && x(e, n) || d && x(e, d)), V = (e) => {
48
- if (!v.current) return;
49
- const o = l(e, "yyyy-MM-dd"), t = v.current.querySelector(
50
- `[data-date="${o}"]`
51
- );
52
- t ? t.focus() : h(k(e));
53
- }, X = (e) => {
54
- const t = e.target.getAttribute("data-date");
55
- if (!t) return;
56
- const s = /* @__PURE__ */ new Date(t + "T00:00:00");
57
- let r = null;
58
- switch (e.key) {
59
- case "ArrowLeft":
60
- r = m(s, -1);
61
- break;
62
- case "ArrowRight":
63
- r = m(s, 1);
64
- break;
65
- case "ArrowUp":
66
- r = m(s, -7);
67
- break;
68
- case "ArrowDown":
69
- r = m(s, 7);
70
- break;
71
- case "Home":
72
- r = k(s);
73
- break;
74
- case "End":
75
- r = oe(s);
76
- break;
77
- case "Enter":
78
- case " ": {
79
- e.preventDefault(), !I(s) && T(s, i) && j(s);
80
- return;
81
- }
82
- default:
83
- return;
84
- }
85
- r && (e.preventDefault(), V(r));
86
- };
87
- return /* @__PURE__ */ y("div", { ref: P, className: "w-[252px]", children: [
88
- /* @__PURE__ */ y("div", { className: "flex items-center justify-between px-ds-02 pb-ds-04", children: [
89
- q ? /* @__PURE__ */ a("span", { className: "h-ds-xs-plus w-ds-xs-plus" }) : /* @__PURE__ */ a(
90
- "button",
91
- {
92
- type: "button",
93
- onClick: () => h(re(i, 1)),
94
- className: "inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md text-text-placeholder transition-colors duration-fast-01 ease-productive-standard hover:bg-field hover:text-text-secondary",
95
- "aria-label": "Previous month",
96
- children: /* @__PURE__ */ a(ae, { className: "h-ico-sm w-ico-sm", stroke: 1.5 })
97
- }
98
- ),
99
- /* @__PURE__ */ a(
100
- "button",
101
- {
102
- type: "button",
103
- onClick: C,
104
- className: B(
105
- "text-ds-md font-semibold text-text-primary",
106
- C && "cursor-pointer rounded-ds-md px-ds-02 transition-colors duration-fast-01 ease-productive-standard hover:bg-field"
107
- ),
108
- "aria-label": "Switch to month/year view",
109
- children: l(i, "MMMM yyyy")
110
- }
111
- ),
112
- F ? /* @__PURE__ */ a("span", { className: "h-ds-xs-plus w-ds-xs-plus" }) : /* @__PURE__ */ a(
113
- "button",
114
- {
115
- type: "button",
116
- onClick: () => h(ne(i, 1)),
117
- className: "inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md text-text-placeholder transition-colors duration-fast-01 ease-productive-standard hover:bg-field hover:text-text-secondary",
118
- "aria-label": "Next month",
119
- children: /* @__PURE__ */ a(ie, { className: "h-ico-sm w-ico-sm", stroke: 1.5 })
120
- }
121
- )
122
- ] }),
123
- /* @__PURE__ */ y(
124
- "div",
125
- {
126
- ref: v,
127
- className: "grid grid-cols-7 gap-0",
128
- role: "grid",
129
- tabIndex: 0,
130
- "aria-label": "Calendar",
131
- onKeyDown: X,
132
- children: [
133
- de.map((e) => /* @__PURE__ */ a(
134
- "div",
135
- {
136
- role: "columnheader",
137
- className: "flex h-ds-sm items-center justify-center text-ds-xs font-semibold uppercase tracking-wider text-text-placeholder",
138
- children: e
139
- },
140
- e
141
- )),
142
- D.map((e, o) => {
143
- const t = T(e, i), s = I(e), r = R && x(e, R), O = Q(e), f = S(e), Z = x(e, /* @__PURE__ */ new Date()), W = l(e, "yyyy-MM-dd"), K = U.get(W) ?? [];
144
- return /* @__PURE__ */ y(
145
- "button",
146
- {
147
- type: "button",
148
- role: "gridcell",
149
- "data-date": W,
150
- tabIndex: t && !s ? 0 : -1,
151
- disabled: !t || s,
152
- onClick: () => {
153
- t && !s && j(e);
154
- },
155
- onMouseEnter: () => c == null ? void 0 : c(e),
156
- onMouseLeave: () => c == null ? void 0 : c(null),
157
- "aria-label": l(e, "EEEE, MMMM d, yyyy"),
158
- "aria-selected": r || f || void 0,
159
- "aria-disabled": !t || s || void 0,
160
- className: B(
161
- "relative flex h-ds-sm w-ds-sm-plus items-center justify-center rounded-ds-md text-ds-md font-body transition-colors duration-fast-01 ease-productive-standard",
162
- !t && "pointer-events-none opacity-0",
163
- t && s && "opacity-[0.38] pointer-events-none cursor-not-allowed",
164
- t && !s && !r && !f && !O && "text-text-primary hover:bg-field",
165
- O && !f && "rounded-ds-none bg-field text-text-primary",
166
- (r || f) && "bg-interactive text-text-on-color hover:bg-interactive-hover",
167
- Z && !r && !f && !s && "font-semibold text-interactive"
168
- ),
169
- children: [
170
- l(e, "d"),
171
- K.length > 0 && /* @__PURE__ */ a("span", { className: "flex gap-px justify-center absolute bottom-[2px] left-0 right-0", children: K.slice(0, 3).map((_, H) => /* @__PURE__ */ a(
172
- "span",
173
- {
174
- "data-event-dot": !0,
175
- className: "h-[4px] w-[4px] rounded-ds-full",
176
- style: { backgroundColor: _.color ?? "var(--color-interactive)" }
177
- },
178
- H
179
- )) })
180
- ]
181
- },
182
- o
183
- );
184
- })
185
- ]
186
- }
187
- )
188
- ] });
189
- }
190
- );
191
- ce.displayName = "CalendarGrid";
192
- export {
193
- ce as CalendarGrid
194
- };
@@ -1,124 +0,0 @@
1
- "use client";
2
- import { jsxs as p, jsx as r } from "react/jsx-runtime";
3
- import * as o from "react";
4
- import { format as C, setMonth as N, setYear as F } from "date-fns";
5
- import { IconCalendarEvent as O } from "@tabler/icons-react";
6
- import { cn as h } from "../../ui/lib/utils.js";
7
- import { Popover as j, PopoverTrigger as E, PopoverContent as H } from "../../ui/popover.js";
8
- import { CalendarGrid as R } from "./calendar-grid.js";
9
- import { YearPicker as V } from "./year-picker.js";
10
- import { MonthPicker as G } from "./month-picker.js";
11
- const I = o.forwardRef(
12
- function({
13
- value: e,
14
- onChange: n,
15
- placeholder: u = "Pick a date",
16
- className: b,
17
- formatStr: y = "MMM d, yyyy",
18
- minDate: c,
19
- maxDate: i,
20
- disabledDates: g
21
- }, M) {
22
- const [d, m] = o.useState(!1), [a, l] = o.useState(
23
- e ?? /* @__PURE__ */ new Date()
24
- ), [x, s] = o.useState("days");
25
- o.useEffect(() => {
26
- d || s("days");
27
- }, [d]);
28
- const Y = (t) => {
29
- n == null || n(t), m(!1);
30
- }, k = () => {
31
- s((t) => t === "days" ? "months" : "years");
32
- }, P = (t) => {
33
- l((f) => N(f, t)), s("days");
34
- }, S = (t) => {
35
- l((f) => F(f, t)), s("months");
36
- }, w = () => {
37
- switch (x) {
38
- case "years":
39
- return /* @__PURE__ */ r(
40
- V,
41
- {
42
- currentYear: a.getFullYear(),
43
- selectedYear: e == null ? void 0 : e.getFullYear(),
44
- onYearSelect: S,
45
- minDate: c,
46
- maxDate: i
47
- }
48
- );
49
- case "months":
50
- return /* @__PURE__ */ r(
51
- G,
52
- {
53
- currentYear: a.getFullYear(),
54
- selectedMonth: e == null ? void 0 : e.getMonth(),
55
- onMonthSelect: P,
56
- minDate: c,
57
- maxDate: i
58
- }
59
- );
60
- default:
61
- return /* @__PURE__ */ r(
62
- R,
63
- {
64
- currentMonth: a,
65
- selected: e,
66
- onSelect: Y,
67
- onMonthChange: l,
68
- onHeaderClick: k,
69
- disabledDates: g,
70
- minDate: c,
71
- maxDate: i
72
- }
73
- );
74
- }
75
- };
76
- return /* @__PURE__ */ p(j, { open: d, onOpenChange: m, children: [
77
- /* @__PURE__ */ r(E, { asChild: !0, children: /* @__PURE__ */ p(
78
- "button",
79
- {
80
- ref: M,
81
- type: "button",
82
- className: h(
83
- "inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-border bg-layer-01 px-ds-04 text-left transition-colors duration-fast-01 ease-productive-standard",
84
- "hover:border-border-strong",
85
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2",
86
- b
87
- ),
88
- children: [
89
- /* @__PURE__ */ r(
90
- O,
91
- {
92
- className: "h-ico-sm w-ico-sm text-text-placeholder",
93
- stroke: 1.5
94
- }
95
- ),
96
- /* @__PURE__ */ r(
97
- "span",
98
- {
99
- className: h(
100
- "text-ds-md",
101
- e ? "text-text-primary" : "text-text-placeholder"
102
- ),
103
- children: e ? C(e, y) : u
104
- }
105
- )
106
- ]
107
- }
108
- ) }),
109
- /* @__PURE__ */ r(
110
- H,
111
- {
112
- className: "w-auto border-border bg-layer-01 p-ds-04",
113
- align: "start",
114
- sideOffset: 4,
115
- children: w()
116
- }
117
- )
118
- ] });
119
- }
120
- );
121
- I.displayName = "DatePicker";
122
- export {
123
- I as DatePicker
124
- };
@@ -1,167 +0,0 @@
1
- "use client";
2
- import { jsxs as M, jsx as o } from "react/jsx-runtime";
3
- import * as s from "react";
4
- import { format as H, setMonth as z, setYear as J, addMonths as E, isBefore as K, isAfter as L } from "date-fns";
5
- import { IconCalendarEvent as Q } from "@tabler/icons-react";
6
- import { cn as C } from "../../ui/lib/utils.js";
7
- import { Popover as U, PopoverTrigger as W, PopoverContent as X } from "../../ui/popover.js";
8
- import { CalendarGrid as F } from "./calendar-grid.js";
9
- import { YearPicker as Z } from "./year-picker.js";
10
- import { MonthPicker as D } from "./month-picker.js";
11
- import { Presets as ee } from "./presets.js";
12
- const re = s.forwardRef(
13
- function({
14
- startDate: c,
15
- endDate: v,
16
- onChange: n,
17
- placeholder: O = "Pick a date range",
18
- className: j,
19
- formatStr: P = "MMM d, yyyy",
20
- minDate: a,
21
- maxDate: d,
22
- disabledDates: S,
23
- presets: x,
24
- numberOfMonths: A = 1
25
- }, G) {
26
- const [b, g] = s.useState(!1), [i, u] = s.useState(
27
- c ?? /* @__PURE__ */ new Date()
28
- ), [e, f] = s.useState(
29
- c ?? null
30
- ), [l, h] = s.useState(
31
- v ?? null
32
- ), [w, N] = s.useState(null), [T, m] = s.useState("days"), y = Math.max(1, A);
33
- s.useEffect(() => {
34
- f(c ?? null), h(v ?? null);
35
- }, [c, v]), s.useEffect(() => {
36
- b || m("days");
37
- }, [b]);
38
- const k = (r) => {
39
- if (!e || e && l)
40
- f(r), h(null);
41
- else {
42
- const t = K(r, e) ? r : e, p = L(r, e) ? r : e;
43
- f(t), h(p), n == null || n({ start: t, end: p }), g(!1);
44
- }
45
- }, V = (r, t) => {
46
- f(r), h(t), n == null || n({ start: r, end: t }), g(!1);
47
- }, Y = () => {
48
- m((r) => r === "days" ? "months" : "years");
49
- }, $ = (r) => {
50
- u((t) => z(t, r)), m("days");
51
- }, B = (r) => {
52
- u((t) => J(t, r)), m("months");
53
- }, I = () => e && l ? `${H(e, P)} - ${H(l, P)}` : O, _ = () => y === 1 ? /* @__PURE__ */ o(
54
- F,
55
- {
56
- currentMonth: i,
57
- rangeStart: e,
58
- rangeEnd: l,
59
- hoverDate: w,
60
- onSelect: k,
61
- onHover: N,
62
- onMonthChange: u,
63
- onHeaderClick: Y,
64
- disabledDates: S,
65
- minDate: a,
66
- maxDate: d
67
- }
68
- ) : /* @__PURE__ */ o("div", { className: "flex flex-row gap-ds-04", children: Array.from({ length: y }, (r, t) => /* @__PURE__ */ o(
69
- F,
70
- {
71
- currentMonth: E(i, t),
72
- rangeStart: e,
73
- rangeEnd: l,
74
- hoverDate: w,
75
- onSelect: k,
76
- onHover: N,
77
- onMonthChange: (p) => {
78
- u(E(p, -t));
79
- },
80
- onHeaderClick: Y,
81
- disabledDates: S,
82
- minDate: a,
83
- maxDate: d,
84
- hidePrevNav: t > 0,
85
- hideNextNav: t < y - 1
86
- },
87
- t
88
- )) }), R = () => {
89
- switch (T) {
90
- case "years":
91
- return /* @__PURE__ */ o(
92
- Z,
93
- {
94
- currentYear: i.getFullYear(),
95
- selectedYear: e == null ? void 0 : e.getFullYear(),
96
- onYearSelect: B,
97
- minDate: a,
98
- maxDate: d
99
- }
100
- );
101
- case "months":
102
- return /* @__PURE__ */ o(
103
- D,
104
- {
105
- currentYear: i.getFullYear(),
106
- selectedMonth: e == null ? void 0 : e.getMonth(),
107
- onMonthSelect: $,
108
- minDate: a,
109
- maxDate: d
110
- }
111
- );
112
- default:
113
- return _();
114
- }
115
- }, q = x && x.length > 0;
116
- return /* @__PURE__ */ M(U, { open: b, onOpenChange: g, children: [
117
- /* @__PURE__ */ o(W, { asChild: !0, children: /* @__PURE__ */ M(
118
- "button",
119
- {
120
- ref: G,
121
- type: "button",
122
- className: C(
123
- "inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-border bg-layer-01 px-ds-04 text-left transition-colors duration-fast-01 ease-productive-standard",
124
- "hover:border-border-strong",
125
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2",
126
- j
127
- ),
128
- children: [
129
- /* @__PURE__ */ o(
130
- Q,
131
- {
132
- className: "h-ico-sm w-ico-sm text-text-placeholder",
133
- stroke: 1.5
134
- }
135
- ),
136
- /* @__PURE__ */ o(
137
- "span",
138
- {
139
- className: C(
140
- "text-ds-md",
141
- e && l ? "text-text-primary" : "text-text-placeholder"
142
- ),
143
- children: I()
144
- }
145
- )
146
- ]
147
- }
148
- ) }),
149
- /* @__PURE__ */ o(
150
- X,
151
- {
152
- className: "w-auto border-border bg-layer-01 p-ds-04",
153
- align: "start",
154
- sideOffset: 4,
155
- children: q ? /* @__PURE__ */ M("div", { className: "flex flex-row gap-ds-04", children: [
156
- /* @__PURE__ */ o("div", { className: "min-w-[140px] border-r border-border pr-ds-04", children: /* @__PURE__ */ o(ee, { presets: x, onSelect: V }) }),
157
- /* @__PURE__ */ o("div", { children: R() })
158
- ] }) : R()
159
- }
160
- )
161
- ] });
162
- }
163
- );
164
- re.displayName = "DateRangePicker";
165
- export {
166
- re as DateRangePicker
167
- };