@pebble-software/bonsai 0.1.0 → 0.1.2

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 (45) hide show
  1. package/README.md +4 -0
  2. package/dist/ast.js +10 -0
  3. package/dist/ast.js.map +1 -0
  4. package/dist/chunks/builder.meta-WpXc5VBB.js +666 -0
  5. package/dist/chunks/builder.meta-WpXc5VBB.js.map +1 -0
  6. package/dist/chunks/{button-CSLrIvsS.js → button-jfJanilw.js} +46 -51
  7. package/dist/chunks/button-jfJanilw.js.map +1 -0
  8. package/dist/chunks/{create-renderer-1cky1uN9.js → create-renderer-DHneTPd-.js} +8 -8
  9. package/dist/chunks/{create-renderer-1cky1uN9.js.map → create-renderer-DHneTPd-.js.map} +1 -1
  10. package/dist/chunks/index-DzpRdatr.js +359 -0
  11. package/dist/chunks/index-DzpRdatr.js.map +1 -0
  12. package/dist/chunks/{render-shared-CIUUkLDn.js → render-shared-Ci28BpkI.js} +601 -931
  13. package/dist/chunks/render-shared-Ci28BpkI.js.map +1 -0
  14. package/dist/constants.d.ts +1 -0
  15. package/dist/constants.js +11 -0
  16. package/dist/constants.js.map +1 -0
  17. package/dist/core.js +3 -3
  18. package/dist/index.js +308 -955
  19. package/dist/index.js.map +1 -1
  20. package/dist/library/constants/src/components.d.ts +59 -0
  21. package/dist/library/constants/src/index.d.ts +2 -0
  22. package/dist/library/constants/src/webhook-events.d.ts +6 -0
  23. package/dist/library/schemas/src/bonsai.schema.d.ts +24 -0
  24. package/dist/library/schemas/src/builder.meta.d.ts +26 -0
  25. package/dist/presets/calendar.js +83 -74
  26. package/dist/presets/calendar.js.map +1 -1
  27. package/dist/presets/signature.js +9 -8
  28. package/dist/presets/signature.js.map +1 -1
  29. package/dist/schemas.d.ts +2 -0
  30. package/dist/schemas.js +13 -0
  31. package/dist/schemas.js.map +1 -0
  32. package/dist/styles/css/base.css +144 -0
  33. package/dist/styles/css/fonts.css +25 -0
  34. package/dist/styles/css/maplibre.css +29 -0
  35. package/dist/styles/css/overrides.css +7 -0
  36. package/dist/styles/css/tailwind.css +1 -0
  37. package/dist/styles/css/theme.css +197 -0
  38. package/dist/styles/css/tw-animate.css +1 -0
  39. package/dist/styles/css/utilities.css +44 -0
  40. package/dist/styles/presets.json +20 -0
  41. package/dist/styles/vendor/maplibre-gl.css +701 -0
  42. package/dist/styles/vendor/tw-animate.css +692 -0
  43. package/package.json +19 -3
  44. package/dist/chunks/button-CSLrIvsS.js.map +0 -1
  45. package/dist/chunks/render-shared-CIUUkLDn.js.map +0 -1
@@ -0,0 +1,59 @@
1
+ export declare enum COMPONENT {
2
+ A = "a",
3
+ P = "p",
4
+ H = "h",
5
+ OL = "ol",
6
+ UL = "ul",
7
+ LI = "li",
8
+ DIV = "div",
9
+ SPAN = "span",
10
+ ACCORDION = "accordion",
11
+ ACCORDION_ITEM = "accordion-item",
12
+ ACCORDION_TRIGGER = "accordion-trigger",
13
+ ACCORDION_CONTENT = "accordion-content",
14
+ ALERT = "alert",
15
+ AVATAR = "avatar",
16
+ BADGE = "badge",
17
+ BUTTON = "button",
18
+ CARD = "card",
19
+ CARD_HEADER = "card-header",
20
+ CARD_TITLE = "card-title",
21
+ CARD_DESCRIPTION = "card-description",
22
+ CARD_CONTENT = "card-content",
23
+ CARD_FOOTER = "card-footer",
24
+ CARD_ACTION = "card-action",
25
+ CARD_ICON = "card-icon",
26
+ CALENDAR = "calendar",
27
+ CHECKBOX = "checkbox",
28
+ COLLAPSIBLE = "collapsible",
29
+ COLLAPSIBLE_TRIGGER = "collapsible-trigger",
30
+ COLLAPSIBLE_CONTENT = "collapsible-content",
31
+ IMAGE = "image",
32
+ OTP = "otp",
33
+ INPUT = "input",
34
+ INPUT_GROUP = "input-group",
35
+ INPUT_GROUP_TEXT = "input-group-text",
36
+ INPUT_GROUP_ADDON = "input-group-addon",
37
+ INPUT_GROUP_BUTTON = "input-group-button",
38
+ INPUT_GROUP_INPUT = "input-group-input",
39
+ INPUT_GROUP_TEXTAREA = "input-group-textarea",
40
+ LABEL = "label",
41
+ LOADER = "loader",
42
+ PROGRESS = "progress",
43
+ SEPARATOR = "separator",
44
+ SKELETON = "skeleton",
45
+ SWITCH = "switch",
46
+ TABLE = "table",
47
+ TABLE_HEADER = "table-header",
48
+ TABLE_BODY = "table-body",
49
+ TABLE_FOOTER = "table-footer",
50
+ TABLE_HEAD = "table-head",
51
+ TABLE_ROW = "table-row",
52
+ TABLE_CELL = "table-cell",
53
+ TABLE_CAPTION = "table-caption",
54
+ TEXTAREA = "textarea",
55
+ SIGNATURE = "signature",
56
+ EACH = "each",
57
+ IF = "if"
58
+ }
59
+ export declare const COMPONENT_LIST: Set<COMPONENT>;
@@ -0,0 +1,2 @@
1
+ export * from './webhook-events.js';
2
+ export * from './components.js';
@@ -0,0 +1,6 @@
1
+ export declare enum WEBHOOK_EVENT {
2
+ FORM_CAPTURED = "FORM_CAPTURED",
3
+ FILE_GENERATED = "FILE_GENERATED",
4
+ FILE_UPLOADED = "FILE_UPLOADED"
5
+ }
6
+ export declare const WEBHOOK_EVENTS: Set<WEBHOOK_EVENT>;
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ export interface TemplateSchemaComponent {
3
+ argsSchema: z.ZodType<any>;
4
+ description?: string;
5
+ }
6
+ export interface GeneratedTemplateSchema {
7
+ Node: z.ZodType<any>;
8
+ ComponentNode: z.ZodDiscriminatedUnion<any>;
9
+ }
10
+ /**
11
+ * Builds the same `CoreNode.extend({ type, args }).meta({ description })` shape used
12
+ * above, from a registry's component list rather than a hand-written literal — the
13
+ * union stops being static; it does not stop existing. See REGISTRY_SPIKE.md,
14
+ * "Schema strategy".
15
+ */
16
+ export declare function createTemplateSchema(components: Record<string, TemplateSchemaComponent>): GeneratedTemplateSchema;
17
+ export declare const PEBBLE_COMPONENT_SCHEMAS: Record<string, TemplateSchemaComponent>;
18
+ declare const pebbleTemplateSchema: GeneratedTemplateSchema;
19
+ export declare const ComponentNode: z.ZodDiscriminatedUnion<any, string>;
20
+ export declare const Config: z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>;
21
+ export type Config = z.infer<typeof pebbleTemplateSchema.Node>;
22
+ /** Every element (non-string) node schema, keyed by its `type` literal. */
23
+ export declare const NodeSchemas: Record<string, z.ZodObject<any>>;
24
+ export {};
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Which children a node type may hold, and where it may be placed.
4
+ * `each` / `if` are transparent: they are allowed wherever their children are,
5
+ * and a child's `parent` rule is checked against the nearest element above them.
6
+ */
7
+ export interface NodeRules {
8
+ /** "any" (default), "none" (void / self-contained), or an allow-list of child types. */
9
+ accepts: "any" | "none" | string[];
10
+ /** Allow-list of direct parent types; absent means any parent. */
11
+ parent?: string[];
12
+ }
13
+ export type FieldControl = "text" | "textarea" | "select" | "switch" | "number" | "color" | "binding" | "json";
14
+ export type FieldGroup = "Content" | "Data" | "Style" | "Advanced";
15
+ export interface FieldHints {
16
+ label?: string;
17
+ control?: FieldControl;
18
+ group?: FieldGroup;
19
+ placeholder?: string;
20
+ }
21
+ export declare const nodeRules: z.core.$ZodRegistry<NodeRules, z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
22
+ export declare const fieldHints: z.core.$ZodRegistry<FieldHints, z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
23
+ /** The args object schema of a node type, unwrapped from `.optional()`. */
24
+ export declare function getArgsSchema(type: string): z.ZodObject | undefined;
25
+ /** Nesting rules for a node type; unknown types accept anything. */
26
+ export declare function getNodeRules(type: string): NodeRules;
@@ -1,12 +1,13 @@
1
- import { c as a, b, B as _, C as h } from "../chunks/button-CSLrIvsS.js";
2
- import { jsxs as p, jsx as t } from "react/jsx-runtime";
3
- import * as x from "react";
4
- import { getDefaultClassNames as S, DayPicker as z } from "react-day-picker";
5
- import { IconSelector as C, IconCheck as k, IconChevronUp as D, IconChevronDown as v, IconChevronLeft as I, IconChevronRight as j } from "@tabler/icons-react";
1
+ import { COMPONENT as w } from "../constants.js";
2
+ import { jsxs as h, jsx as t } from "react/jsx-runtime";
3
+ import * as N from "react";
4
+ import { getDefaultClassNames as C, DayPicker as I } from "react-day-picker";
5
+ import { c as a, b as p, B as j } from "../chunks/button-jfJanilw.js";
6
+ import { IconSelector as P, IconCheck as L, IconChevronUp as R, IconChevronDown as _, IconChevronLeft as A, IconChevronRight as B } from "@tabler/icons-react";
6
7
  import { Select as s } from "@base-ui/react/select";
7
- const y = s.Root;
8
- y.displayName = "Select";
9
- function P({ className: n, ...e }) {
8
+ const S = s.Root;
9
+ S.displayName = "Select";
10
+ function E({ className: n, ...e }) {
10
11
  return /* @__PURE__ */ t(
11
12
  s.Value,
12
13
  {
@@ -20,23 +21,23 @@ function P({ className: n, ...e }) {
20
21
  }
21
22
  );
22
23
  }
23
- function L({
24
+ function T({
24
25
  className: n,
25
26
  size: e = "lg",
26
- variant: i = "outline",
27
+ variant: d = "outline",
27
28
  raised: c,
28
29
  extrude: m,
29
30
  children: f,
30
31
  ...r
31
32
  }) {
32
- return /* @__PURE__ */ p(
33
+ return /* @__PURE__ */ h(
33
34
  s.Trigger,
34
35
  {
35
36
  "data-slot": "select-trigger",
36
37
  "data-size": e,
37
38
  "aria-label": r["aria-label"] ?? "select-trigger",
38
39
  className: a(
39
- b({ size: e, variant: i, raised: c, extrude: m }),
40
+ p({ size: e, variant: d, raised: c, extrude: m }),
40
41
  "group/select-trigger neo-base neo-input-focus disabled:opacity-50 [&_svg]:shrink-0 w-full",
41
42
  n
42
43
  ),
@@ -48,7 +49,7 @@ function L({
48
49
  {
49
50
  className: "flex items-center justify-center",
50
51
  render: /* @__PURE__ */ t(
51
- C,
52
+ P,
52
53
  {
53
54
  "data-slot": "select-selector",
54
55
  className: "text-muted size-4 pointer-events-none"
@@ -60,10 +61,10 @@ function L({
60
61
  }
61
62
  );
62
63
  }
63
- function R({
64
+ function M({
64
65
  className: n,
65
66
  children: e,
66
- side: i = "bottom",
67
+ side: d = "bottom",
67
68
  sideOffset: c = 4,
68
69
  align: m = "center",
69
70
  alignOffset: f = 0,
@@ -73,13 +74,13 @@ function R({
73
74
  return /* @__PURE__ */ t(s.Portal, { children: /* @__PURE__ */ t(
74
75
  s.Positioner,
75
76
  {
76
- side: i,
77
+ side: d,
77
78
  sideOffset: c,
78
79
  align: m,
79
80
  alignOffset: f,
80
81
  alignItemWithTrigger: r,
81
82
  className: "isolate z-50",
82
- children: /* @__PURE__ */ p(
83
+ children: /* @__PURE__ */ h(
83
84
  s.Popup,
84
85
  {
85
86
  "data-slot": "select-content",
@@ -97,21 +98,21 @@ function R({
97
98
  ),
98
99
  ...g,
99
100
  children: [
100
- /* @__PURE__ */ t(B, {}),
101
+ /* @__PURE__ */ t(V, {}),
101
102
  /* @__PURE__ */ t(s.List, { className: "flex flex-col gap-0.5 p-0.5", children: e }),
102
- /* @__PURE__ */ t(E, {})
103
+ /* @__PURE__ */ t(W, {})
103
104
  ]
104
105
  }
105
106
  )
106
107
  }
107
108
  ) });
108
109
  }
109
- function A({
110
+ function U({
110
111
  className: n,
111
112
  children: e,
112
- ...i
113
+ ...d
113
114
  }) {
114
- return /* @__PURE__ */ p(
115
+ return /* @__PURE__ */ h(
115
116
  s.Item,
116
117
  {
117
118
  "data-slot": "select-item",
@@ -123,21 +124,21 @@ function A({
123
124
  "[&_svg]:pointer-events-none [&_svg]:shrink-0",
124
125
  n
125
126
  ),
126
- ...i,
127
+ ...d,
127
128
  children: [
128
129
  /* @__PURE__ */ t(s.ItemText, { className: "flex flex-1 gap-2 shrink-0 whitespace-nowrap", children: e }),
129
130
  /* @__PURE__ */ t(
130
131
  s.ItemIndicator,
131
132
  {
132
133
  render: /* @__PURE__ */ t("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center" }),
133
- children: /* @__PURE__ */ t(k, { className: "pointer-events-none" })
134
+ children: /* @__PURE__ */ t(L, { className: "pointer-events-none" })
134
135
  }
135
136
  )
136
137
  ]
137
138
  }
138
139
  );
139
140
  }
140
- function B({
141
+ function V({
141
142
  className: n,
142
143
  ...e
143
144
  }) {
@@ -150,11 +151,11 @@ function B({
150
151
  n
151
152
  ),
152
153
  ...e,
153
- children: /* @__PURE__ */ t(D, {})
154
+ children: /* @__PURE__ */ t(R, {})
154
155
  }
155
156
  );
156
157
  }
157
- function E({
158
+ function W({
158
159
  className: n,
159
160
  ...e
160
161
  }) {
@@ -167,27 +168,29 @@ function E({
167
168
  n
168
169
  ),
169
170
  ...e,
170
- children: /* @__PURE__ */ t(v, {})
171
+ children: /* @__PURE__ */ t(_, {})
171
172
  }
172
173
  );
173
174
  }
174
- function T({
175
+ function O({
175
176
  className: n,
176
177
  classNames: e,
177
- showOutsideDays: i = !0,
178
+ showOutsideDays: d = !0,
178
179
  captionLayout: c = "label",
179
180
  hideWeekdays: m = !1,
180
181
  buttonVariant: f = "outline",
181
182
  hideWeekends: r,
182
183
  formatters: g,
183
- components: w,
184
- ...N
184
+ components: z,
185
+ ...x
185
186
  }) {
186
- const o = S();
187
+ const o = C(), { selected: b } = x, v = typeof b == "string" ? $(b) : void 0, D = v ? { ...x, selected: v } : x;
187
188
  return /* @__PURE__ */ t(
188
- z,
189
+ I,
189
190
  {
190
- showOutsideDays: i,
191
+ mode: "single",
192
+ defaultMonth: v ?? (b instanceof Date ? b : void 0),
193
+ showOutsideDays: d,
191
194
  className: a(
192
195
  "p-3 bg-surface group/calendar [--cell-size:--spacing(8)]",
193
196
  "in-data-[slot=card-content]:bg-transparent",
@@ -207,12 +210,12 @@ function T({
207
210
  o.nav
208
211
  ),
209
212
  button_previous: a(
210
- b({ variant: f, icon: "sm" }),
213
+ p({ variant: f, icon: "sm" }),
211
214
  "aria-disabled:opacity-50 aria-disabled:translate-[0px] aria-disabled:shadow-none aria-disabled:pointer-events-none",
212
215
  o.button_previous
213
216
  ),
214
217
  button_next: a(
215
- b({ variant: f, icon: "sm" }),
218
+ p({ variant: f, icon: "sm" }),
216
219
  "aria-disabled:opacity-50 aria-disabled:translate-[0px] aria-disabled:shadow-none aria-disabled:pointer-events-none",
217
220
  o.button_next
218
221
  ),
@@ -225,7 +228,7 @@ function T({
225
228
  "flex flex-col w-full gap-4 *:first:*:h-(--cell-size) *:first:*:flex *:first:*:items-center *:first:*:justify-center *:first:**:font-medium *:first:**:font-heading *:first:**:text-base",
226
229
  o.month
227
230
  ),
228
- table: "w-full border-collapse",
231
+ month_grid: "w-full border-collapse",
229
232
  weekdays: a("flex", o.weekdays),
230
233
  weekday: a(
231
234
  m ? "hidden" : "text-sm font-normal font-heading text-muted text-center select-none flex-1",
@@ -256,48 +259,54 @@ function T({
256
259
  ...e
257
260
  },
258
261
  components: {
259
- Root: ({ className: l, rootRef: d, ...u }) => /* @__PURE__ */ t(
262
+ Root: ({ className: l, rootRef: i, ...u }) => /* @__PURE__ */ t(
260
263
  "div",
261
264
  {
262
265
  "data-slot": "calendar",
263
- ref: d,
266
+ ref: i,
264
267
  className: a(l),
265
268
  ...u
266
269
  }
267
270
  ),
268
- Chevron: ({ className: l, orientation: d, ...u }) => d === "left" ? /* @__PURE__ */ t(I, { className: a("size-4", l), ...u }) : d === "right" ? /* @__PURE__ */ t(
269
- j,
271
+ Chevron: ({ className: l, orientation: i, ...u }) => i === "left" ? /* @__PURE__ */ t(A, { className: a("size-4", l), ...u }) : i === "right" ? /* @__PURE__ */ t(
272
+ B,
270
273
  {
271
274
  className: a("size-4", l),
272
275
  ...u
273
276
  }
274
- ) : /* @__PURE__ */ t(v, { className: a("size-4", l), ...u }),
275
- Weekday: ({ children: l, ...d }) => {
276
- const u = d["aria-label"] === "Saturday" || d["aria-label"] === "Sunday";
277
- return r && u ? /* @__PURE__ */ t("td", { hidden: !0 }) : /* @__PURE__ */ t("td", { ...d, children: l });
277
+ ) : /* @__PURE__ */ t(_, { className: a("size-4", l), ...u }),
278
+ Weekday: ({ children: l, ...i }) => {
279
+ const u = i["aria-label"] === "Saturday" || i["aria-label"] === "Sunday";
280
+ return r && u ? /* @__PURE__ */ t("td", { hidden: !0 }) : /* @__PURE__ */ t("td", { ...i, children: l });
278
281
  },
279
- Day: ({ children: l, ...d }) => {
280
- const u = new Date(d.day.date).getDay();
281
- return r && (u === 0 || u === 6) ? /* @__PURE__ */ t("td", { hidden: !0 }) : d.modifiers.hidden ? /* @__PURE__ */ t("td", { className: "all-unset size-(--cell-size) m-1 bg-foreground opacity-20 rounded-base" }) : /* @__PURE__ */ t("td", { ...d, children: l });
282
+ // `day` and `modifiers` are for us, not the DOM: spread onto the <td>
283
+ // they leak as `day="[object Object]"` attributes.
284
+ Day: ({ children: l, day: i, modifiers: u, ...k }) => {
285
+ const y = new Date(i.date).getDay();
286
+ return r && (y === 0 || y === 6) ? /* @__PURE__ */ t("td", { hidden: !0 }) : u.hidden ? /* @__PURE__ */ t("td", { className: "all-unset size-(--cell-size) m-1 bg-foreground opacity-20 rounded-base" }) : /* @__PURE__ */ t("td", { ...k, children: l });
282
287
  },
283
- Dropdown: V,
284
- DayButton: U,
285
- ...w
288
+ Dropdown: F,
289
+ DayButton: q,
290
+ ...z
286
291
  },
287
- ...N
292
+ ...D
288
293
  }
289
294
  );
290
295
  }
291
- function U({
296
+ function $(n) {
297
+ const e = /^(\d{4})-(\d{2})-(\d{2})$/.exec(n);
298
+ return e ? new Date(+e[1], +e[2] - 1, +e[3]) : new Date(n);
299
+ }
300
+ function q({
292
301
  day: n,
293
302
  modifiers: e,
294
- ...i
303
+ ...d
295
304
  }) {
296
- const c = x.useRef(null);
297
- return x.useEffect(() => {
305
+ const c = N.useRef(null);
306
+ return N.useEffect(() => {
298
307
  e.focused && c.current?.focus();
299
308
  }, [e.focused]), /* @__PURE__ */ t(
300
- _,
309
+ j,
301
310
  {
302
311
  "data-slot": "calendar-day-button",
303
312
  "data-day": n.date.toLocaleDateString(),
@@ -311,38 +320,38 @@ function U({
311
320
  extrude: e.selected ? null : "xs",
312
321
  disabled: e.disabled,
313
322
  icon: "sm",
314
- ...i
323
+ ...d
315
324
  }
316
325
  );
317
326
  }
318
- function V(n) {
319
- const { options: e, onChange: i, value: c } = n, m = e?.find((r) => r.value === c), f = (r) => {
320
- i?.({
327
+ function F(n) {
328
+ const { options: e, onChange: d, value: c } = n, m = e?.find((r) => r.value === c), f = (r) => {
329
+ d?.({
321
330
  target: { value: r }
322
331
  });
323
332
  };
324
- return /* @__PURE__ */ p(
325
- y,
333
+ return /* @__PURE__ */ h(
334
+ S,
326
335
  {
327
336
  value: c?.toString(),
328
337
  onValueChange: (r) => f(r),
329
338
  children: [
330
339
  /* @__PURE__ */ t(
331
- L,
340
+ T,
332
341
  {
333
342
  variant: "ghost",
334
343
  raised: null,
335
344
  extrude: null,
336
345
  className: "w-fit mx-1",
337
346
  size: "sm",
338
- children: /* @__PURE__ */ t(P, { children: m?.label })
347
+ children: /* @__PURE__ */ t(E, { children: m?.label })
339
348
  }
340
349
  ),
341
- /* @__PURE__ */ t(R, { className: "bg-transparent border-0 w-30 shadow-none", children: /* @__PURE__ */ t("div", { className: "p-2", children: /* @__PURE__ */ t("div", { className: "flex flex-col items-center bg-foreground shadow-xs rounded-base", children: e?.map((r) => /* @__PURE__ */ t(
342
- A,
350
+ /* @__PURE__ */ t(M, { className: "bg-transparent border-0 w-30 shadow-none", children: /* @__PURE__ */ t("div", { className: "p-2", children: /* @__PURE__ */ t("div", { className: "flex flex-col items-center bg-foreground shadow-xs rounded-base", children: e?.map((r) => /* @__PURE__ */ t(
351
+ U,
343
352
  {
344
353
  className: a(
345
- b({ extrude: "md" }),
354
+ p({ extrude: "md" }),
346
355
  "not-last:rounded-b-none not-first:rounded-t-none border-2 not-last:border-b-0 hover:border-2 hover:z-2 z-1 duration-200"
347
356
  ),
348
357
  value: r.value.toString(),
@@ -354,12 +363,12 @@ function V(n) {
354
363
  }
355
364
  );
356
365
  }
357
- const G = {
366
+ const Z = {
358
367
  components: {
359
- [h.CALENDAR]: T
368
+ [w.CALENDAR]: O
360
369
  },
361
370
  controlledInputs: {
362
- [h.CALENDAR]: {
371
+ [w.CALENDAR]: {
363
372
  valueProp: "selected",
364
373
  changeProp: "onSelect",
365
374
  extractor: (n) => n
@@ -367,7 +376,7 @@ const G = {
367
376
  }
368
377
  };
369
378
  export {
370
- T as Calendar,
371
- G as calendarPreset
379
+ O as Calendar,
380
+ Z as calendarPreset
372
381
  };
373
382
  //# sourceMappingURL=calendar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.js","sources":["../../src/components/ui/select.tsx","../../src/components/ui/calendar.tsx","../../src/renderer/presets/calendar.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Select as SelectPrimitive } from \"@base-ui/react/select\";\nimport {\n IconSelector,\n IconCheck,\n IconChevronUp,\n IconChevronDown,\n} from \"@tabler/icons-react\";\nimport { cn } from \"@/lib/utils\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport { buttonVariants } from \"./button\";\n\nconst Select = SelectPrimitive.Root;\n(Select as any).displayName = \"Select\";\n\nfunction SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {\n return (\n <SelectPrimitive.Group\n data-slot=\"select-group\"\n className={cn(\"scroll-my-1 p-1\", className)}\n {...props}\n />\n );\n}\n\nfunction SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {\n return (\n <SelectPrimitive.Value\n data-slot=\"select-value\"\n className={cn(\n \"flex flex-1 text-left\",\n \"group/select-trigger:line-clamp-1 group/select-trigger:items-center data-placeholder:text-subtle font-base\",\n className,\n )}\n {...props}\n />\n );\n}\n\ninterface SelectTriggerProps\n extends\n SelectPrimitive.Trigger.Props,\n Omit<VariantProps<typeof buttonVariants>, \"icon\"> {}\n\nfunction SelectTrigger({\n className,\n size = \"lg\",\n variant = \"outline\",\n raised,\n extrude,\n children,\n ...props\n}: SelectTriggerProps) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n data-size={size}\n aria-label={props[\"aria-label\"] ?? \"select-trigger\"}\n className={cn(\n buttonVariants({ size, variant, raised, extrude }),\n \"group/select-trigger neo-base neo-input-focus disabled:opacity-50 [&_svg]:shrink-0 w-full\",\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon\n className=\"flex items-center justify-center\"\n render={\n <IconSelector\n data-slot=\"select-selector\"\n className=\"text-muted size-4 pointer-events-none\"\n />\n }\n />\n </SelectPrimitive.Trigger>\n );\n}\n\nfunction SelectContent({\n className,\n children,\n side = \"bottom\",\n sideOffset = 4,\n align = \"center\",\n alignOffset = 0,\n alignItemWithTrigger = true,\n ...props\n}: SelectPrimitive.Popup.Props &\n Pick<\n SelectPrimitive.Positioner.Props,\n \"align\" | \"alignOffset\" | \"side\" | \"sideOffset\" | \"alignItemWithTrigger\"\n >) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n alignItemWithTrigger={alignItemWithTrigger}\n className=\"isolate z-50\"\n >\n <SelectPrimitive.Popup\n data-slot=\"select-content\"\n className={cn(\n \"neo-base neo-focus relative isolate bg-surface text-foreground rounded-base shadow-md border-2 z-50 duration-100\",\n \"max-h-(--available-height) w-(--anchor-width) min-w-36\",\n \"origin-(--transform-origin) overflow-x-hidden overflow-y-auto\",\n \"data-open:animate-in data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95\",\n \"data-closed:animate-out data-closed:fade-out-0\",\n \"data-[side=top]:slide-in-from-bottom-2\",\n \"data-[side=bottom]:slide-in-from-top-2\",\n \"data-[side=left]:slide-in-from-right-2\",\n \"data-[side=right]:slide-in-from-left-2\",\n className,\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.List className=\"flex flex-col gap-0.5 p-0.5\">\n {children}\n </SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectLabel({\n className,\n ...props\n}: SelectPrimitive.GroupLabel.Props) {\n return (\n <SelectPrimitive.GroupLabel\n data-slot=\"select-label\"\n className={cn(\"text-muted px-2 py-1.5 text-xs\", className)}\n {...props}\n />\n );\n}\n\nfunction SelectItem({\n className,\n children,\n ...props\n}: SelectPrimitive.Item.Props) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n \"neo-base flex items-center gap-2 py-1.5 pr-8 pl-2 relative w-full cursor-pointer select-none\",\n \"border-2 border-transparent hover:border-border focus-visible:border-border outline-hidden rounded-base text-sm\",\n \"*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.ItemText className=\"flex flex-1 gap-2 shrink-0 whitespace-nowrap\">\n {children}\n </SelectPrimitive.ItemText>\n <SelectPrimitive.ItemIndicator\n render={\n <span className=\"pointer-events-none absolute right-2 flex size-4 items-center justify-center\" />\n }\n >\n <IconCheck className=\"pointer-events-none\" />\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: SelectPrimitive.Separator.Props) {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cn(\n \"bg-foreground -mx-1 my-1 h-px pointer-events-none\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {\n return (\n <SelectPrimitive.ScrollUpArrow\n data-slot=\"select-scroll-up-button\"\n className={cn(\n \"bg-surface z-10 flex cursor-default items-center justify-center py-1 top-0 w-full\",\n className,\n )}\n {...props}\n >\n <IconChevronUp />\n </SelectPrimitive.ScrollUpArrow>\n );\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {\n return (\n <SelectPrimitive.ScrollDownArrow\n data-slot=\"select-scroll-down-button\"\n className={cn(\n \"bg-surface z-10 flex cursor-default items-center justify-center py-1 bottom-0 w-full\",\n className,\n )}\n {...props}\n >\n <IconChevronDown />\n </SelectPrimitive.ScrollDownArrow>\n );\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport {\n DayPicker,\n getDefaultClassNames,\n type DayButton,\n type DropdownOption,\n} from \"react-day-picker\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Button, buttonVariants } from \"@/components/ui/button\";\nimport {\n IconChevronLeft,\n IconChevronRight,\n IconChevronDown,\n} from \"@tabler/icons-react\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"./select\";\n\ntype CalendarProps = React.ComponentProps<typeof DayPicker> & {\n buttonVariant?: React.ComponentProps<typeof Button>[\"variant\"];\n hideWeekends?: boolean;\n};\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"label\",\n hideWeekdays = false,\n buttonVariant = \"outline\",\n hideWeekends,\n formatters,\n components,\n ...props\n}: CalendarProps) {\n const defaultClassNames = getDefaultClassNames();\n\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\n \"p-3 bg-surface group/calendar [--cell-size:--spacing(8)]\",\n \"in-data-[slot=card-content]:bg-transparent\",\n \"in-data-[slot=popover-content]:bg-transparent\",\n className,\n )}\n captionLayout={captionLayout}\n formatters={{\n formatCaption: (date) =>\n date.toLocaleString(\"default\", { month: \"short\", year: \"numeric\" }),\n formatMonthDropdown: (date) =>\n date.toLocaleString(\"default\", { month: \"short\" }),\n ...formatters,\n }}\n classNames={{\n root: cn(\"w-fit\", defaultClassNames.root),\n nav: cn(\n \"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between\",\n defaultClassNames.nav,\n ),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant, icon: \"sm\" }),\n \"aria-disabled:opacity-50 aria-disabled:translate-[0px] aria-disabled:shadow-none aria-disabled:pointer-events-none\",\n defaultClassNames.button_previous,\n ),\n button_next: cn(\n buttonVariants({ variant: buttonVariant, icon: \"sm\" }),\n \"aria-disabled:opacity-50 aria-disabled:translate-[0px] aria-disabled:shadow-none aria-disabled:pointer-events-none\",\n defaultClassNames.button_next,\n ),\n caption_label: cn(\"select-none\", defaultClassNames.caption_label),\n months: cn(\n \"flex gap-4 flex-col md:flex-row relative\",\n defaultClassNames.months,\n ),\n month: cn(\n \"flex flex-col w-full gap-4 *:first:*:h-(--cell-size) *:first:*:flex *:first:*:items-center *:first:*:justify-center *:first:**:font-medium *:first:**:font-heading *:first:**:text-base\",\n defaultClassNames.month,\n ),\n table: \"w-full border-collapse\",\n weekdays: cn(\"flex\", defaultClassNames.weekdays),\n weekday: cn(\n hideWeekdays\n ? \"hidden\"\n : \"text-sm font-normal font-heading text-muted text-center select-none flex-1\",\n defaultClassNames.weekday,\n ),\n week_number: cn(\n \"text-sm font-normal font-heading text-muted text-center select-none flex size-(--cell-size) items-center justify-center my-auto\",\n defaultClassNames.week_number,\n ),\n week_number_header: cn(\n \"select-none w-(--cell-size)\",\n defaultClassNames.week_number_header,\n ),\n week: cn(\"flex w-full\", defaultClassNames.week),\n day: cn(\n \"relative text-center group/day select-none transition-[width,padding,margin] duration-200\",\n defaultClassNames.day,\n ),\n day_button: cn(\"m-1\", defaultClassNames.day_button),\n today: cn(\n \"*:data-[slot=calendar-day-button]:font-semibold *:data-[slot=calendar-day-button]:text-lg\",\n defaultClassNames.today,\n ),\n outside: cn(\n \"text-muted aria-selected:text-foreground opacity-50 hover:opacity-100 aria-selected:opacity-100 aria-selected:*:data-[slot=calendar-day-button]:bg-main-secondary hover:*:data-[slot=calendar-day-button]:bg-surface *:data-[slot=calendar-day-button]:bg-foreground/20\",\n defaultClassNames.outside,\n ),\n ...classNames,\n }}\n components={{\n Root: ({ className, rootRef, ...props }) => {\n return (\n <div\n data-slot=\"calendar\"\n ref={rootRef}\n className={cn(className)}\n {...props}\n />\n );\n },\n Chevron: ({ className, orientation, ...props }) => {\n if (orientation === \"left\") {\n return (\n <IconChevronLeft className={cn(\"size-4\", className)} {...props} />\n );\n }\n\n if (orientation === \"right\") {\n return (\n <IconChevronRight\n className={cn(\"size-4\", className)}\n {...props}\n />\n );\n }\n\n return (\n <IconChevronDown className={cn(\"size-4\", className)} {...props} />\n );\n },\n Weekday: ({ children, ...props }) => {\n const isWeekend =\n props[\"aria-label\"] === \"Saturday\" ||\n props[\"aria-label\"] === \"Sunday\";\n if (hideWeekends && isWeekend) {\n return <td hidden />;\n }\n return <td {...props}>{children}</td>;\n },\n Day: ({ children, ...props }) => {\n const weekday = new Date(props.day.date).getDay();\n const isWeekend = weekday === 0 || weekday === 6;\n if (hideWeekends && isWeekend) {\n return <td hidden />;\n }\n if (props.modifiers.hidden) {\n return (\n <td className=\"all-unset size-(--cell-size) m-1 bg-foreground opacity-20 rounded-base\" />\n );\n }\n return <td {...props}>{children}</td>;\n },\n Dropdown: CalendarDropdown,\n DayButton: CalendarDayButton,\n ...components,\n }}\n {...props}\n />\n );\n}\n\nfunction CalendarDayButton({\n day,\n modifiers,\n ...props\n}: React.ComponentProps<typeof DayButton>) {\n const ref = React.useRef<HTMLButtonElement>(null);\n React.useEffect(() => {\n if (modifiers.focused) ref.current?.focus();\n }, [modifiers.focused]);\n\n return (\n <Button\n data-slot=\"calendar-day-button\"\n data-day={day.date.toLocaleDateString()}\n data-selected-single={\n modifiers.selected &&\n !modifiers.range_start &&\n !modifiers.range_end &&\n !modifiers.range_middle\n }\n data-range-start={modifiers.range_start}\n data-range-end={modifiers.range_end}\n data-range-middle={modifiers.range_middle}\n aria-label={day.date.toDateString()}\n raised={\n modifiers.range_start || modifiers.range_end\n ? \"md\"\n : modifiers.range_middle\n ? \"xs\"\n : \"sm\"\n }\n variant={modifiers.selected ? \"default\" : \"outline\"}\n extrude={modifiers.selected ? null : \"xs\"}\n disabled={modifiers.disabled}\n icon=\"sm\"\n {...props}\n />\n );\n}\n\nfunction CalendarDropdown(\n props: Omit<React.SelectHTMLAttributes<HTMLSelectElement>, \"children\"> & {\n options?: DropdownOption[] | undefined;\n },\n) {\n const { options, onChange, value } = props;\n const selected = options?.find((option) => option.value === value);\n const handleChange = (value: string) => {\n const changeEvent = {\n target: { value },\n } as React.ChangeEvent<HTMLSelectElement>;\n onChange?.(changeEvent);\n };\n\n return (\n <Select\n value={value?.toString()}\n onValueChange={(value) => handleChange(value as any)}\n >\n <SelectTrigger\n variant=\"ghost\"\n raised={null}\n extrude={null}\n className=\"w-fit mx-1\"\n size=\"sm\"\n >\n <SelectValue>{selected?.label}</SelectValue>\n </SelectTrigger>\n <SelectContent className=\"bg-transparent border-0 w-30 shadow-none\">\n <div className=\"p-2\">\n <div className=\"flex flex-col items-center bg-foreground shadow-xs rounded-base\">\n {options?.map((option) => (\n <SelectItem\n className={cn(\n buttonVariants({ extrude: \"md\" }),\n \"not-last:rounded-b-none not-first:rounded-t-none border-2 not-last:border-b-0 hover:border-2 hover:z-2 z-1 duration-200\",\n )}\n key={option.value}\n value={option.value.toString()}\n >\n {option.label}\n </SelectItem>\n ))}\n </div>\n </div>\n </SelectContent>\n </Select>\n );\n}\n\nexport { Calendar };\n","import { COMPONENT } from \"@bonsai/constants\";\n\nimport { Calendar } from \"../../components/ui/calendar\";\nimport type { BonsaiPreset } from \"../core-registry\";\n\n/** Opt-in `calendar` component. Pulls in react-day-picker. */\nexport const calendarPreset: BonsaiPreset = {\n components: {\n [COMPONENT.CALENDAR]: Calendar,\n },\n controlledInputs: {\n [COMPONENT.CALENDAR]: {\n valueProp: \"selected\",\n changeProp: \"onSelect\",\n extractor: (date) => date,\n },\n },\n};\n\nexport { Calendar };\n"],"names":["Select","SelectPrimitive","SelectValue","className","props","jsx","cn","SelectTrigger","size","variant","raised","extrude","children","jsxs","buttonVariants","IconSelector","SelectContent","side","sideOffset","align","alignOffset","alignItemWithTrigger","SelectScrollUpButton","SelectScrollDownButton","SelectItem","IconCheck","IconChevronUp","IconChevronDown","Calendar","classNames","showOutsideDays","captionLayout","hideWeekdays","buttonVariant","hideWeekends","formatters","components","defaultClassNames","getDefaultClassNames","DayPicker","date","rootRef","orientation","IconChevronLeft","IconChevronRight","isWeekend","weekday","CalendarDropdown","CalendarDayButton","day","modifiers","ref","React","Button","options","onChange","value","selected","option","handleChange","calendarPreset","COMPONENT"],"mappings":";;;;;;AAcA,MAAMA,IAASC,EAAgB;AAC9BD,EAAe,cAAc;AAY9B,SAASE,EAAY,EAAE,WAAAC,GAAW,GAAGC,KAAsC;AACzE,SACE,gBAAAC;AAAA,IAACJ,EAAgB;AAAA,IAAhB;AAAA,MACC,aAAU;AAAA,MACV,WAAWK;AAAA,QACT;AAAA,QACA;AAAA,QACAH;AAAA,MAAA;AAAA,MAED,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;AAOA,SAASG,EAAc;AAAA,EACrB,WAAAJ;AAAA,EACA,MAAAK,IAAO;AAAA,EACP,SAAAC,IAAU;AAAA,EACV,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGR;AACL,GAAuB;AACrB,SACE,gBAAAS;AAAA,IAACZ,EAAgB;AAAA,IAAhB;AAAA,MACC,aAAU;AAAA,MACV,aAAWO;AAAA,MACX,cAAYJ,EAAM,YAAY,KAAK;AAAA,MACnC,WAAWE;AAAA,QACTQ,EAAe,EAAE,MAAAN,GAAM,SAAAC,GAAS,QAAAC,GAAQ,SAAAC,GAAS;AAAA,QACjD;AAAA,QACAR;AAAA,MAAA;AAAA,MAED,GAAGC;AAAA,MAEH,UAAA;AAAA,QAAAQ;AAAA,QACD,gBAAAP;AAAA,UAACJ,EAAgB;AAAA,UAAhB;AAAA,YACC,WAAU;AAAA,YACV,QACE,gBAAAI;AAAA,cAACU;AAAA,cAAA;AAAA,gBACC,a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ACX,YAAY;AAAA,MACZ,WAAW,CAACrB,MAASA;AAAA,IAAA;AAAA,EACvB;AAEJ;"}
1
+ {"version":3,"file":"calendar.js","sources":["../../src/components/ui/select.tsx","../../src/components/ui/calendar.tsx","../../src/renderer/presets/calendar.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Select as SelectPrimitive } from \"@base-ui/react/select\";\nimport {\n IconSelector,\n IconCheck,\n IconChevronUp,\n IconChevronDown,\n} from \"@tabler/icons-react\";\nimport { cn } from \"@/lib/utils\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport { buttonVariants } from \"./button\";\n\nconst Select = SelectPrimitive.Root;\n(Select as any).displayName = \"Select\";\n\nfunction SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {\n return (\n <SelectPrimitive.Group\n data-slot=\"select-group\"\n className={cn(\"scroll-my-1 p-1\", className)}\n {...props}\n />\n );\n}\n\nfunction SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {\n return (\n <SelectPrimitive.Value\n data-slot=\"select-value\"\n className={cn(\n \"flex flex-1 text-left\",\n \"group/select-trigger:line-clamp-1 group/select-trigger:items-center data-placeholder:text-subtle font-base\",\n className,\n )}\n {...props}\n />\n );\n}\n\ninterface SelectTriggerProps\n extends\n SelectPrimitive.Trigger.Props,\n Omit<VariantProps<typeof buttonVariants>, \"icon\"> {}\n\nfunction SelectTrigger({\n className,\n size = \"lg\",\n variant = \"outline\",\n raised,\n extrude,\n children,\n ...props\n}: SelectTriggerProps) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n data-size={size}\n aria-label={props[\"aria-label\"] ?? \"select-trigger\"}\n className={cn(\n buttonVariants({ size, variant, raised, extrude }),\n \"group/select-trigger neo-base neo-input-focus disabled:opacity-50 [&_svg]:shrink-0 w-full\",\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon\n className=\"flex items-center justify-center\"\n render={\n <IconSelector\n data-slot=\"select-selector\"\n className=\"text-muted size-4 pointer-events-none\"\n />\n }\n />\n </SelectPrimitive.Trigger>\n );\n}\n\nfunction SelectContent({\n className,\n children,\n side = \"bottom\",\n sideOffset = 4,\n align = \"center\",\n alignOffset = 0,\n alignItemWithTrigger = true,\n ...props\n}: SelectPrimitive.Popup.Props &\n Pick<\n SelectPrimitive.Positioner.Props,\n \"align\" | \"alignOffset\" | \"side\" | \"sideOffset\" | \"alignItemWithTrigger\"\n >) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n alignItemWithTrigger={alignItemWithTrigger}\n className=\"isolate z-50\"\n >\n <SelectPrimitive.Popup\n data-slot=\"select-content\"\n className={cn(\n \"neo-base neo-focus relative isolate bg-surface text-foreground rounded-base shadow-md border-2 z-50 duration-100\",\n \"max-h-(--available-height) w-(--anchor-width) min-w-36\",\n \"origin-(--transform-origin) overflow-x-hidden overflow-y-auto\",\n \"data-open:animate-in data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95\",\n \"data-closed:animate-out data-closed:fade-out-0\",\n \"data-[side=top]:slide-in-from-bottom-2\",\n \"data-[side=bottom]:slide-in-from-top-2\",\n \"data-[side=left]:slide-in-from-right-2\",\n \"data-[side=right]:slide-in-from-left-2\",\n className,\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.List className=\"flex flex-col gap-0.5 p-0.5\">\n {children}\n </SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectLabel({\n className,\n ...props\n}: SelectPrimitive.GroupLabel.Props) {\n return (\n <SelectPrimitive.GroupLabel\n data-slot=\"select-label\"\n className={cn(\"text-muted px-2 py-1.5 text-xs\", className)}\n {...props}\n />\n );\n}\n\nfunction SelectItem({\n className,\n children,\n ...props\n}: SelectPrimitive.Item.Props) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n \"neo-base flex items-center gap-2 py-1.5 pr-8 pl-2 relative w-full cursor-pointer select-none\",\n \"border-2 border-transparent hover:border-border focus-visible:border-border outline-hidden rounded-base text-sm\",\n \"*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.ItemText className=\"flex flex-1 gap-2 shrink-0 whitespace-nowrap\">\n {children}\n </SelectPrimitive.ItemText>\n <SelectPrimitive.ItemIndicator\n render={\n <span className=\"pointer-events-none absolute right-2 flex size-4 items-center justify-center\" />\n }\n >\n <IconCheck className=\"pointer-events-none\" />\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: SelectPrimitive.Separator.Props) {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cn(\n \"bg-foreground -mx-1 my-1 h-px pointer-events-none\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {\n return (\n <SelectPrimitive.ScrollUpArrow\n data-slot=\"select-scroll-up-button\"\n className={cn(\n \"bg-surface z-10 flex cursor-default items-center justify-center py-1 top-0 w-full\",\n className,\n )}\n {...props}\n >\n <IconChevronUp />\n </SelectPrimitive.ScrollUpArrow>\n );\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {\n return (\n <SelectPrimitive.ScrollDownArrow\n data-slot=\"select-scroll-down-button\"\n className={cn(\n \"bg-surface z-10 flex cursor-default items-center justify-center py-1 bottom-0 w-full\",\n className,\n )}\n {...props}\n >\n <IconChevronDown />\n </SelectPrimitive.ScrollDownArrow>\n );\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport {\n DayPicker,\n getDefaultClassNames,\n type DayButton,\n type DropdownOption,\n} from \"react-day-picker\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Button, buttonVariants } from \"@/components/ui/button\";\nimport {\n IconChevronLeft,\n IconChevronRight,\n IconChevronDown,\n} from \"@tabler/icons-react\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"./select\";\n\ntype CalendarProps = React.ComponentProps<typeof DayPicker> & {\n buttonVariant?: React.ComponentProps<typeof Button>[\"variant\"];\n hideWeekends?: boolean;\n};\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"label\",\n hideWeekdays = false,\n buttonVariant = \"outline\",\n hideWeekends,\n formatters,\n components,\n ...props\n}: CalendarProps) {\n const defaultClassNames = getDefaultClassNames();\n const { selected } = props as { selected?: unknown };\n const parsed = typeof selected === \"string\" ? parseDate(selected) : undefined;\n // A string only comes from untyped template data, which binds single mode.\n const pickerProps = parsed ? ({ ...props, selected: parsed } as typeof props) : props;\n\n return (\n <DayPicker\n // Templates bind `selected`/`onSelect` without a `mode`, and without one\n // DayPicker isn't interactive: no day buttons, so the grid collapses.\n mode=\"single\"\n // Open on the selected day's month, not today's.\n defaultMonth={parsed ?? (selected instanceof Date ? selected : undefined)}\n showOutsideDays={showOutsideDays}\n className={cn(\n \"p-3 bg-surface group/calendar [--cell-size:--spacing(8)]\",\n \"in-data-[slot=card-content]:bg-transparent\",\n \"in-data-[slot=popover-content]:bg-transparent\",\n className,\n )}\n captionLayout={captionLayout}\n formatters={{\n formatCaption: (date) =>\n date.toLocaleString(\"default\", { month: \"short\", year: \"numeric\" }),\n formatMonthDropdown: (date) =>\n date.toLocaleString(\"default\", { month: \"short\" }),\n ...formatters,\n }}\n classNames={{\n root: cn(\"w-fit\", defaultClassNames.root),\n nav: cn(\n \"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between\",\n defaultClassNames.nav,\n ),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant, icon: \"sm\" }),\n \"aria-disabled:opacity-50 aria-disabled:translate-[0px] aria-disabled:shadow-none aria-disabled:pointer-events-none\",\n defaultClassNames.button_previous,\n ),\n button_next: cn(\n buttonVariants({ variant: buttonVariant, icon: \"sm\" }),\n \"aria-disabled:opacity-50 aria-disabled:translate-[0px] aria-disabled:shadow-none aria-disabled:pointer-events-none\",\n defaultClassNames.button_next,\n ),\n caption_label: cn(\"select-none\", defaultClassNames.caption_label),\n months: cn(\n \"flex gap-4 flex-col md:flex-row relative\",\n defaultClassNames.months,\n ),\n month: cn(\n \"flex flex-col w-full gap-4 *:first:*:h-(--cell-size) *:first:*:flex *:first:*:items-center *:first:*:justify-center *:first:**:font-medium *:first:**:font-heading *:first:**:text-base\",\n defaultClassNames.month,\n ),\n month_grid: \"w-full border-collapse\",\n weekdays: cn(\"flex\", defaultClassNames.weekdays),\n weekday: cn(\n hideWeekdays\n ? \"hidden\"\n : \"text-sm font-normal font-heading text-muted text-center select-none flex-1\",\n defaultClassNames.weekday,\n ),\n week_number: cn(\n \"text-sm font-normal font-heading text-muted text-center select-none flex size-(--cell-size) items-center justify-center my-auto\",\n defaultClassNames.week_number,\n ),\n week_number_header: cn(\n \"select-none w-(--cell-size)\",\n defaultClassNames.week_number_header,\n ),\n week: cn(\"flex w-full\", defaultClassNames.week),\n day: cn(\n \"relative text-center group/day select-none transition-[width,padding,margin] duration-200\",\n defaultClassNames.day,\n ),\n day_button: cn(\"m-1\", defaultClassNames.day_button),\n today: cn(\n \"*:data-[slot=calendar-day-button]:font-semibold *:data-[slot=calendar-day-button]:text-lg\",\n defaultClassNames.today,\n ),\n outside: cn(\n \"text-muted aria-selected:text-foreground opacity-50 hover:opacity-100 aria-selected:opacity-100 aria-selected:*:data-[slot=calendar-day-button]:bg-main-secondary hover:*:data-[slot=calendar-day-button]:bg-surface *:data-[slot=calendar-day-button]:bg-foreground/20\",\n defaultClassNames.outside,\n ),\n ...classNames,\n }}\n components={{\n Root: ({ className, rootRef, ...props }) => {\n return (\n <div\n data-slot=\"calendar\"\n ref={rootRef}\n className={cn(className)}\n {...props}\n />\n );\n },\n Chevron: ({ className, orientation, ...props }) => {\n if (orientation === \"left\") {\n return (\n <IconChevronLeft className={cn(\"size-4\", className)} {...props} />\n );\n }\n\n if (orientation === \"right\") {\n return (\n <IconChevronRight\n className={cn(\"size-4\", className)}\n {...props}\n />\n );\n }\n\n return (\n <IconChevronDown className={cn(\"size-4\", className)} {...props} />\n );\n },\n Weekday: ({ children, ...props }) => {\n const isWeekend =\n props[\"aria-label\"] === \"Saturday\" ||\n props[\"aria-label\"] === \"Sunday\";\n if (hideWeekends && isWeekend) {\n return <td hidden />;\n }\n return <td {...props}>{children}</td>;\n },\n // `day` and `modifiers` are for us, not the DOM: spread onto the <td>\n // they leak as `day=\"[object Object]\"` attributes.\n Day: ({ children, day, modifiers, ...props }) => {\n const weekday = new Date(day.date).getDay();\n const isWeekend = weekday === 0 || weekday === 6;\n if (hideWeekends && isWeekend) {\n return <td hidden />;\n }\n if (modifiers.hidden) {\n return (\n <td className=\"all-unset size-(--cell-size) m-1 bg-foreground opacity-20 rounded-base\" />\n );\n }\n return <td {...props}>{children}</td>;\n },\n Dropdown: CalendarDropdown,\n DayButton: CalendarDayButton,\n ...components,\n }}\n {...pickerProps}\n />\n );\n}\n\n// Bound data carries dates as JSON strings. A bare `2024-01-01` parses as UTC\n// midnight, which is the day before west of UTC, so read it as a local date.\nfunction parseDate(value: string): Date {\n const ymd = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(value);\n return ymd ? new Date(+ymd[1], +ymd[2] - 1, +ymd[3]) : new Date(value);\n}\n\nfunction CalendarDayButton({\n day,\n modifiers,\n ...props\n}: React.ComponentProps<typeof DayButton>) {\n const ref = React.useRef<HTMLButtonElement>(null);\n React.useEffect(() => {\n if (modifiers.focused) ref.current?.focus();\n }, [modifiers.focused]);\n\n return (\n <Button\n data-slot=\"calendar-day-button\"\n data-day={day.date.toLocaleDateString()}\n data-selected-single={\n modifiers.selected &&\n !modifiers.range_start &&\n !modifiers.range_end &&\n !modifiers.range_middle\n }\n data-range-start={modifiers.range_start}\n data-range-end={modifiers.range_end}\n data-range-middle={modifiers.range_middle}\n aria-label={day.date.toDateString()}\n raised={\n modifiers.range_start || modifiers.range_end\n ? \"md\"\n : modifiers.range_middle\n ? \"xs\"\n : \"sm\"\n }\n variant={modifiers.selected ? \"default\" : \"outline\"}\n extrude={modifiers.selected ? null : \"xs\"}\n disabled={modifiers.disabled}\n icon=\"sm\"\n {...props}\n />\n );\n}\n\nfunction CalendarDropdown(\n props: Omit<React.SelectHTMLAttributes<HTMLSelectElement>, \"children\"> & {\n options?: DropdownOption[] | undefined;\n },\n) {\n const { options, onChange, value } = props;\n const selected = options?.find((option) => option.value === value);\n const handleChange = (value: string) => {\n const changeEvent = {\n target: { value },\n } as React.ChangeEvent<HTMLSelectElement>;\n onChange?.(changeEvent);\n };\n\n return (\n <Select\n value={value?.toString()}\n onValueChange={(value) => handleChange(value as any)}\n >\n <SelectTrigger\n variant=\"ghost\"\n raised={null}\n extrude={null}\n className=\"w-fit mx-1\"\n size=\"sm\"\n >\n <SelectValue>{selected?.label}</SelectValue>\n </SelectTrigger>\n <SelectContent className=\"bg-transparent border-0 w-30 shadow-none\">\n <div className=\"p-2\">\n <div className=\"flex flex-col items-center bg-foreground shadow-xs rounded-base\">\n {options?.map((option) => (\n <SelectItem\n className={cn(\n buttonVariants({ extrude: \"md\" }),\n \"not-last:rounded-b-none not-first:rounded-t-none border-2 not-last:border-b-0 hover:border-2 hover:z-2 z-1 duration-200\",\n )}\n key={option.value}\n value={option.value.toString()}\n >\n {option.label}\n </SelectItem>\n ))}\n </div>\n </div>\n </SelectContent>\n </Select>\n );\n}\n\nexport { Calendar };\n","import { COMPONENT } from \"@bonsai/constants\";\n\nimport { Calendar } from \"../../components/ui/calendar\";\nimport type { BonsaiPreset } from \"../core-registry\";\n\n/** Opt-in `calendar` component. Pulls in react-day-picker. */\nexport const calendarPreset: BonsaiPreset = {\n components: {\n [COMPONENT.CALENDAR]: Calendar,\n },\n controlledInputs: {\n [COMPONENT.CALENDAR]: {\n valueProp: \"selected\",\n changeProp: \"onSelect\",\n extractor: (date) => date,\n },\n },\n};\n\nexport { Calendar };\n"],"names":["Select","SelectPrimitive","SelectValue","className","props","jsx","cn","SelectTrigger","size","variant","raised","extrude","children","jsxs","buttonVariants","IconSelector","SelectContent","side","sideOffset","align","alignOffset","alignItemWithTrigger","SelectScrollUpButton","SelectScrollDownButton","SelectItem","IconCheck","IconChevronUp","IconChevronDown","Calendar","classNames","showOutsideDays","captionLayout","hideWeekdays","buttonVariant","hideWeekends","formatters","components","defaultClassNames","getDefaultClassNames","selected","parsed","parseDate","pickerProps","DayPicker","date","rootRef","orientation","IconChevronLeft","IconChevronRight","isWeekend","day","modifiers","weekday","CalendarDropdown","CalendarDayButton","value","ymd","ref","React","Button","options","onChange","option","handleChange","calendarPreset","COMPONENT"],"mappings":";;;;;;;AAcA,MAAMA,IAASC,EAAgB;AAC9BD,EAAe,cAAc;AAY9B,SAASE,EAAY,EAAE,WAAAC,GAAW,GAAGC,KAAsC;AACzE,SACE,gBAAAC;AAAA,IAACJ,EAAgB;AAAA,IAAhB;AAAA,MACC,aAAU;AAAA,MACV,WAAWK;AAAA,QACT;AAAA,QACA;AAAA,QACAH;AAAA,MAAA;AAAA,MAED,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;AAOA,SAASG,EAAc;AAAA,EACrB,WAAAJ;AAAA,EACA,MAAAK,IAAO;AAAA,EACP,SAAAC,IAAU;AAAA,EACV,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGR;AACL,GAAuB;AACrB,SACE,gBAAAS;AAAA,IAACZ,EA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