@base-framework/ui 1.0.223 → 1.0.224

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.
package/dist/index.es.js CHANGED
@@ -5,7 +5,7 @@ import { V as w, a as R } from "./veil-D4dRxILB.js";
5
5
  import { Icons as E } from "./icons.es.js";
6
6
  import { A as O, B as V, C as j, t as q, E as z, v as J, w as _, x as K, D as Q, j as X, k as Y, H as Z, G as $, s as aa, c as ea, a as sa, b as oa, I as ta, i as ra, g as na, e as la, h as ia, F as pa, d as ua, f as ma, u as da, M as ca, l as ga, N as Ca, P as Ta, p as ba, q as Da, S as Ia, n as Sa, o as Ba, T as Pa, y as Fa, z as Ma, m as ka, r as Na } from "./empty-state-2O1fITpG.js";
7
7
  import { A as va, b as xa, C as ya, D as ha, a as Wa, F as Ha, M as La, P as Aa, c as wa, g as Ra, p as Ua } from "./calendar-Bn55oWBo.js";
8
- import { B as Ga, p as Oa, C as Va, j as ja, D as qa, m as za, k as Ja, H as _a, I as Ka, N as Qa, O as Xa, P as Ya, R as Za, S as $a, n as ae, o as ee, t as se, s as oe, q as te, r as re, T as ne, l as le, U as ie, W as pe, f as ue, h as me, i as de, c as ce, d as ge, b as Ce, e as Te, a as be, g as De } from "./signature-panel-Casw0xrl.js";
8
+ import { B as Ga, p as Oa, C as Va, j as ja, D as qa, m as za, k as Ja, H as _a, I as Ka, N as Qa, O as Xa, P as Ya, R as Za, S as $a, n as ae, o as ee, t as se, s as oe, q as te, r as re, T as ne, l as le, U as ie, W as pe, f as ue, h as me, i as de, c as ce, d as ge, b as Ce, e as Te, a as be, g as De } from "./signature-panel-H6LXfuxW.js";
9
9
  import { B as Se, I as Be, M as Pe, d as Fe, e as Me, g as ke, N as Ne, b as fe, a as ve, f as xe, P as ye, c as he, S as We, T as He } from "./mobile-nav-wrapper-Dj67Pb8l.js";
10
10
  import { B as Ae, a as we, C as Re, F as Ue, b as Ee, c as Ge, M as Oe, P as Ve, S as je } from "./sidebar-menu-page-BVryQj2Z.js";
11
11
  import { A as ze, F as Je, M as _e, a as Ke, T as Qe } from "./aside-template-McEj_Gxc.js";
@@ -1,4 +1,4 @@
1
- import { B as s, p as t, C as o, j as r, D as n, m as l, k as i, H as b, I as d, N as g, O as p, P as u, R as v, S as D, n as N, o as k, t as C, s as c, q as T, r as M, T as m, l as y, U as B, W, f as h, h as S, i as H, c as P, d as I, b as f, e as x, a as L, g as O } from "./signature-panel-Casw0xrl.js";
1
+ import { B as s, p as t, C as o, j as r, D as n, m as l, k as i, H as b, I as d, N as g, O as p, P as u, R as v, S as D, n as N, o as k, t as C, s as c, q as T, r as M, T as m, l as y, U as B, W, f as h, h as S, i as H, c as P, d as I, b as f, e as x, a as L, g as O } from "./signature-panel-H6LXfuxW.js";
2
2
  import { b as U, C as G, D as R, a as j, F as q, M as w, c as z, p as A } from "./calendar-Bn55oWBo.js";
3
3
  import { B as J, I as K, M as Q, d as V, e as X, g as Y, N as Z, b as _, a as $, f as aa, P as ea, c as sa, S as ta, T as oa } from "./mobile-nav-wrapper-Dj67Pb8l.js";
4
4
  export {
@@ -66,9 +66,9 @@ const ft = (e) => {
66
66
  }, be = (e, t) => {
67
67
  const s = new Date(e, t, 1).getDay(), a = new Date(e, t + 1, 0).getDate(), n = [];
68
68
  let i = [];
69
- for (let l = 1 - s; l <= a; l++) {
70
- const u = new Date(e, t, l);
71
- i.push(l > 0 ? u : null), (i.length === 7 || l === a) && (n.push([...i]), i = []);
69
+ for (let r = 1 - s; r <= a; r++) {
70
+ const l = new Date(e, t, r);
71
+ i.push(r > 0 ? l : null), (i.length === 7 || r === a) && (n.push([...i]), i = []);
72
72
  }
73
73
  return n;
74
74
  }, we = (e, t) => {
@@ -93,18 +93,18 @@ const ft = (e) => {
93
93
  click: () => n(a, s)
94
94
  });
95
95
  }, wt = (e, t) => {
96
- const s = new Date(e, t, 1).getDay(), a = new Date(e, t + 1, 0).getDate(), n = gt(e, t, s), i = Array.from({ length: a }, (d, p) => new Date(e, t, p + 1)), l = (n.length + i.length) % 7, u = l === 0 ? 0 : 7 - l, c = pt(e, t, u), h = [...n, ...i, ...c], r = [];
97
- for (let d = 0; d < h.length; d += 7) {
98
- const p = h.slice(d, d + 7), y = p.find((B) => B) || new Date(e, t, 1), { weekNumber: L, year: T } = mt(y);
99
- r.push({
96
+ const s = new Date(e, t, 1).getDay(), a = new Date(e, t + 1, 0).getDate(), n = gt(e, t, s), i = Array.from({ length: a }, (h, p) => new Date(e, t, p + 1)), r = (n.length + i.length) % 7, l = r === 0 ? 0 : 7 - r, c = pt(e, t, l), d = [...n, ...i, ...c], u = [];
97
+ for (let h = 0; h < d.length; h += 7) {
98
+ const p = d.slice(h, h + 7), y = p.find((B) => B) || new Date(e, t, 1), { weekNumber: L, year: T } = mt(y);
99
+ u.push({
100
100
  weekNumber: L,
101
101
  year: T,
102
102
  days: p
103
103
  });
104
104
  }
105
- return r;
105
+ return u;
106
106
  }, xt = ({ selectWeek: e }) => D("month", (t, s, { data: a }) => {
107
- const { year: n, month: i, currentDate: l } = a, u = wt(n, i);
107
+ const { year: n, month: i, currentDate: r } = a, l = wt(n, i);
108
108
  return o(
109
109
  { class: "grid grid-cols-8 gap-1 text-sm px-4 py-2" },
110
110
  [
@@ -119,8 +119,8 @@ const ft = (e) => {
119
119
  )
120
120
  ),
121
121
  // Render each "week" row
122
- ...u.map(
123
- ({ weekNumber: c, days: h, year: r }) => o({
122
+ ...l.map(
123
+ ({ weekNumber: c, days: d, year: u }) => o({
124
124
  class: "grid grid-cols-8 col-span-8 items-center ring-primary rounded-sm px-1",
125
125
  onSet: ["currentWeek", {
126
126
  ring: c
@@ -129,7 +129,7 @@ const ft = (e) => {
129
129
  // Left column: ISO week number
130
130
  o({
131
131
  class: "font-medium text-center col-span-1 rounded-sm cursor-pointer",
132
- click: () => e(c, r),
132
+ click: () => e(c, u),
133
133
  // If you have a 'currentWeek' state, you can highlight it with 'onSet'
134
134
  onSet: ["currentWeek", {
135
135
  "text-primary-foreground": c,
@@ -140,11 +140,11 @@ const ft = (e) => {
140
140
  // The 7 cells for each day in the row
141
141
  o(
142
142
  { class: "grid grid-cols-7 col-span-7 text-center" },
143
- h.map(
144
- (d) => bt({
145
- year: (d == null ? void 0 : d.getFullYear()) || null,
146
- month: (d == null ? void 0 : d.getMonth()) || null,
147
- day: (d == null ? void 0 : d.getDate()) || null,
143
+ d.map(
144
+ (h) => bt({
145
+ year: (h == null ? void 0 : h.getFullYear()) || null,
146
+ month: (h == null ? void 0 : h.getMonth()) || null,
147
+ day: (h == null ? void 0 : h.getDate()) || null,
148
148
  weekNumber: c,
149
149
  selectWeek: e
150
150
  })
@@ -317,33 +317,50 @@ const j = ({ label: e, click: t }) => g(
317
317
  ]), Dt = (e) => o({ class: "h-9 flex items-center justify-center font-medium" }, e), St = () => o(
318
318
  { class: "grid grid-cols-7 gap-1 text-center text-xs font-medium text-muted-foreground mb-2" },
319
319
  ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map(Dt)
320
- ), Ct = ({ day: e, iso: t, disabled: s, isStart: a, isEnd: n, isBetween: i, click: l }) => {
321
- let u = "ghost", c = "";
322
- return a || n ? (u = "default", c = "bg-primary text-primary-foreground hover:bg-primary/90") : i && (c = "bg-accent text-accent-foreground hover:bg-accent/80"), s && (c += " opacity-50 cursor-not-allowed"), g(
320
+ ), Ct = ({ day: e, iso: t, disabled: s, isStart: a, isEnd: n, isBetween: i, click: r }) => {
321
+ let l = "ghost", c = "";
322
+ return a || n ? (l = "default", c = "bg-primary text-primary-foreground hover:bg-primary/90") : i && (c = "bg-accent text-accent-foreground hover:bg-accent/80"), s && (c += " opacity-50 cursor-not-allowed"), g(
323
323
  {
324
324
  class: `flex items-center justify-center h-9 w-9 p-0 text-sm font-medium rounded-md transition-colors ${c}`,
325
- variant: u,
325
+ variant: l,
326
326
  disabled: s,
327
327
  click: () => {
328
- s || l();
328
+ s || r();
329
329
  }
330
330
  },
331
331
  e.toString()
332
332
  );
333
- }, It = ({ cells: e }) => o(
334
- { class: "grid grid-cols-7 gap-1" },
335
- e.map(
336
- (t, s) => t ? Ct({
337
- day: t.day,
338
- iso: t.iso,
339
- disabled: t.disabled,
340
- isStart: t.isStart,
341
- isEnd: t.isEnd,
342
- isBetween: t.isBetween,
343
- click: t.click
344
- }) : o({ class: "h-9" })
345
- )
346
- ), Mt = f((e, t) => o({ class: "flex flex-auto flex-col" }, [
333
+ }, It = ({ today: e, current: t, blockPriorDates: s, onDateClick: a }) => {
334
+ const { start: n, end: i } = t, r = new Date(t.year, t.month, 1).getDay(), l = new Date(t.year, t.month + 1, 0).getDate(), c = [];
335
+ for (let d = 0; d < r; d++)
336
+ c.push(null);
337
+ for (let d = 1; d <= l; d++) {
338
+ const u = st(t.year, t.month, d), h = new Date(t.year, t.month, d), p = new Date(e.year, e.month, e.date), y = h < p, L = s && y, T = n === u, B = i === u, X = n && i && u > n && u < i;
339
+ c.push({
340
+ day: d,
341
+ iso: u,
342
+ disabled: L,
343
+ isStart: T,
344
+ isEnd: B,
345
+ isBetween: X,
346
+ click: () => a(u)
347
+ });
348
+ }
349
+ return o(
350
+ { class: "grid grid-cols-7 gap-1" },
351
+ c.map(
352
+ (d, u) => d ? Ct({
353
+ day: d.day,
354
+ iso: d.iso,
355
+ disabled: d.disabled,
356
+ isStart: d.isStart,
357
+ isEnd: d.isEnd,
358
+ isBetween: d.isBetween,
359
+ click: d.click
360
+ }) : o({ class: "h-9" })
361
+ )
362
+ );
363
+ }, Mt = f((e, t) => o({ class: "flex flex-auto flex-col" }, [
347
364
  vt({
348
365
  monthName: e.monthName,
349
366
  year: e.year,
@@ -352,10 +369,21 @@ const j = ({ label: e, click: t }) => g(
352
369
  next: e.next,
353
370
  previous: e.previous
354
371
  }),
355
- o({ class: "flex flex-auto flex-col w-full" }, [
356
- St(),
357
- It({ cells: e.cells })
358
- ])
372
+ o({
373
+ class: "flex flex-auto flex-col w-full",
374
+ onSet: [
375
+ "currentDate",
376
+ () => [
377
+ St(),
378
+ It({
379
+ today: e.today,
380
+ current: e.current,
381
+ blockPriorDates: e.blockPriorDates,
382
+ onDateClick: e.onDateClick
383
+ })
384
+ ]
385
+ ]
386
+ })
359
387
  ])), Lt = ({ currentMonth: e, currentYear: t, onSelect: s }) => o(
360
388
  { class: "grid grid-cols-3 gap-2" },
361
389
  P.monthNames.map(
@@ -486,21 +514,7 @@ class ke extends m {
486
514
  * @returns {object}
487
515
  */
488
516
  render() {
489
- const { today: t, current: s, selecting: a } = this.data, { start: n, end: i } = s, l = new Date(s.year, s.month, 1).getDay(), u = new Date(s.year, s.month + 1, 0).getDate(), c = [];
490
- for (let h = 0; h < l; h++)
491
- c.push(null);
492
- for (let h = 1; h <= u; h++) {
493
- const r = st(s.year, s.month, h), d = new Date(s.year, s.month, h), p = new Date(t.year, t.month, t.date), y = d < p, L = this.blockPriorDates && y, T = n === r, B = i === r, X = n && i && r > n && r < i;
494
- c.push({
495
- day: h,
496
- iso: r,
497
- disabled: L,
498
- isStart: T,
499
- isEnd: B,
500
- isBetween: X,
501
- click: this.handleClick.bind(this, r)
502
- });
503
- }
517
+ const { today: t, current: s, selecting: a } = this.data, { start: n, end: i } = s;
504
518
  return o({ class: "range-calendar bg-background border border-border rounded-lg shadow-md p-4 w-full max-w-sm" }, [
505
519
  Tt({
506
520
  start: n,
@@ -509,15 +523,15 @@ class ke extends m {
509
523
  onSelectStart: () => this.data.selecting = "start",
510
524
  onSelectEnd: () => this.data.selecting = "end"
511
525
  }),
512
- q("view", (h) => {
513
- switch (h) {
526
+ q("view", (r) => {
527
+ switch (r) {
514
528
  case "months":
515
529
  return Lt(
516
530
  {
517
531
  currentMonth: s.month,
518
532
  currentYear: s.year,
519
- onSelect: (r) => {
520
- this.setCurrent({ month: r, year: s.year }), this.state.view = "calendar";
533
+ onSelect: (l) => {
534
+ this.setCurrent({ month: l, year: s.year }), this.state.view = "calendar";
521
535
  }
522
536
  }
523
537
  );
@@ -525,8 +539,8 @@ class ke extends m {
525
539
  return Bt(
526
540
  {
527
541
  currentYear: s.year,
528
- onSelect: (r) => {
529
- this.setCurrent({ month: s.month, year: r }), this.state.view = "calendar";
542
+ onSelect: (l) => {
543
+ this.setCurrent({ month: s.month, year: l }), this.state.view = "calendar";
530
544
  }
531
545
  }
532
546
  );
@@ -534,17 +548,20 @@ class ke extends m {
534
548
  return Mt({
535
549
  monthName: this.data.monthName,
536
550
  year: s.year,
551
+ today: t,
552
+ current: s,
553
+ blockPriorDates: this.blockPriorDates,
554
+ onDateClick: (l) => this.handleClick(l),
537
555
  onMonthClick: () => this.state.view = "months",
538
556
  onYearClick: () => this.state.view = "years",
539
557
  next: () => {
540
- const r = this.data.current, d = r.month === 11 ? { month: 0, year: r.year + 1 } : { month: r.month + 1, year: r.year };
541
- this.setCurrent(d);
558
+ const l = this.data.current, c = l.month === 11 ? { month: 0, year: l.year + 1 } : { month: l.month + 1, year: l.year };
559
+ this.setCurrent(c);
542
560
  },
543
561
  previous: () => {
544
- const r = this.data.current, d = r.month === 0 ? { month: 11, year: r.year - 1 } : { month: r.month - 1, year: r.year };
545
- this.setCurrent(d);
546
- },
547
- cells: c
562
+ const l = this.data.current, c = l.month === 0 ? { month: 11, year: l.year - 1 } : { month: l.month - 1, year: l.year };
563
+ this.setCurrent(c);
564
+ }
548
565
  });
549
566
  }
550
567
  })
@@ -557,12 +574,12 @@ const Rt = (e, t) => {
557
574
  }, Pt = (e) => A({ class: `cursor-pointer py-3 px-4 text-base w-10 ${e.class || ""}` }, [
558
575
  K((t) => new dt({ class: "mr-2", onChange: (s, a) => Rt(t, a) }))
559
576
  ]), Nt = ({ align: e, sortable: t, key: s, label: a, sort: n, class: i }) => {
560
- const l = e || "justify-start";
577
+ const r = e || "justify-start";
561
578
  return A({
562
579
  class: `cursor-pointer py-3 px-4 text-base ${i || ""}`,
563
580
  click: t && (() => n(s))
564
581
  }, [
565
- o({ class: `flex flex-auto w-full items-center ${l}` }, [
582
+ o({ class: `flex flex-auto w-full items-center ${r}` }, [
566
583
  S(a),
567
584
  t && G({ class: "ml-2", html: b.arrows.upDown })
568
585
  ])
@@ -1784,11 +1801,11 @@ class ce extends m {
1784
1801
  * @returns {Array} An array of [eventName, element, callback] definitions.
1785
1802
  */
1786
1803
  setupEvents() {
1787
- const t = this.panel, s = this.pointerPosition.bind(this), a = this.pointerUp.bind(this), n = this.pointerDown.bind(this), i = this.resize.bind(this), l = { passive: !1 };
1804
+ const t = this.panel, s = this.pointerPosition.bind(this), a = this.pointerUp.bind(this), n = this.pointerDown.bind(this), i = this.resize.bind(this), r = { passive: !1 };
1788
1805
  return [
1789
- ["pointermove", t, s, l],
1806
+ ["pointermove", t, s, r],
1790
1807
  ["pointerup", t, a],
1791
- ["pointerdown", t, n, l],
1808
+ ["pointerdown", t, n, r],
1792
1809
  ["pointerout", t, a],
1793
1810
  ["resize", globalThis, i]
1794
1811
  ];
@@ -1801,14 +1818,14 @@ class ce extends m {
1801
1818
  */
1802
1819
  getEventPosition(t) {
1803
1820
  let s, a;
1804
- const n = this.canvas, i = n.width / parseInt(n.style.width), l = n.getBoundingClientRect();
1821
+ const n = this.canvas, i = n.width / parseInt(n.style.width), r = n.getBoundingClientRect();
1805
1822
  if (t.touches && t.touches.length) {
1806
- const h = t.touches[0];
1807
- s = h.clientX, a = h.clientY;
1823
+ const d = t.touches[0];
1824
+ s = d.clientX, a = d.clientY;
1808
1825
  } else
1809
1826
  s = t.x || t.clientX, a = t.y || t.clientY;
1810
- const u = parseInt((s - l.left) * i), c = parseInt((a - l.top) * i);
1811
- this.mouse.x = u, this.mouse.y = c;
1827
+ const l = parseInt((s - r.left) * i), c = parseInt((a - r.top) * i);
1828
+ this.mouse.x = l, this.mouse.y = c;
1812
1829
  }
1813
1830
  /**
1814
1831
  * Called when the pointer goes down on the canvas.
@@ -1882,13 +1899,13 @@ class ce extends m {
1882
1899
  * @returns {void}
1883
1900
  */
1884
1901
  scale() {
1885
- const t = this.canvas, s = this.container, a = O.getSize(s), n = this.targetSize, i = n.width, l = n.height;
1886
- let u = i + "px", c = l + "px";
1887
- if (this.width = t.width = i, this.height = t.height = l, a.width !== 0 && a.height !== 0) {
1888
- const h = a.width, r = a.height, d = h / i, p = r / l, y = Math.min(d, p);
1889
- u = i * y + "px", c = l * y + "px";
1902
+ const t = this.canvas, s = this.container, a = O.getSize(s), n = this.targetSize, i = n.width, r = n.height;
1903
+ let l = i + "px", c = r + "px";
1904
+ if (this.width = t.width = i, this.height = t.height = r, a.width !== 0 && a.height !== 0) {
1905
+ const d = a.width, u = a.height, h = d / i, p = u / r, y = Math.min(h, p);
1906
+ l = i * y + "px", c = r * y + "px";
1890
1907
  }
1891
- t.style.width = u, t.style.height = c;
1908
+ t.style.width = l, t.style.height = c;
1892
1909
  }
1893
1910
  /**
1894
1911
  * Main drawing loop. If the mouse is down, adds a line
@@ -1922,8 +1939,8 @@ class ce extends m {
1922
1939
  */
1923
1940
  addLine(t, s, a, n) {
1924
1941
  this.signed || (this.signed = !0);
1925
- const i = Math.round(s), l = Math.round(a);
1926
- t.lineWidth = this.lineWidth, t.strokeStyle = n, t.lineTo(i, l), t.stroke();
1942
+ const i = Math.round(s), r = Math.round(a);
1943
+ t.lineWidth = this.lineWidth, t.strokeStyle = n, t.lineTo(i, r), t.stroke();
1927
1944
  }
1928
1945
  /**
1929
1946
  * Clears the canvas, sets signed to false, and re-initializes
@@ -4,11 +4,14 @@
4
4
  * @param {object} props
5
5
  * @param {string} props.monthName
6
6
  * @param {number} props.year
7
+ * @param {object} props.today
8
+ * @param {object} props.current
9
+ * @param {boolean} props.blockPriorDates
10
+ * @param {function} props.onDateClick
7
11
  * @param {function} props.onMonthClick
8
12
  * @param {function} props.onYearClick
9
13
  * @param {function} props.next
10
14
  * @param {function} props.previous
11
- * @param {Array} props.cells
12
15
  * @returns {object}
13
16
  */
14
17
  export const MonthCalendar: Function;
@@ -1,3 +1,6 @@
1
- export function RangeDaysGrid({ cells }: {
2
- cells: Array<object | null>;
1
+ export function RangeDaysGrid({ today, current, blockPriorDates, onDateClick }: {
2
+ today: object;
3
+ current: object;
4
+ blockPriorDates: boolean;
5
+ onDateClick: Function;
3
6
  }): object;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base-framework/ui",
3
- "version": "1.0.223",
3
+ "version": "1.0.224",
4
4
  "description": "This is a UI package that adds components and atoms that use Tailwind CSS and a theme based on Shadcn.",
5
5
  "main": "./dist/index.es.js",
6
6
  "scripts": {