@base-framework/ui 1.0.208 → 1.0.210

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.
@@ -0,0 +1,501 @@
1
+ import { Div as i, Img as j, Span as P, Button as I, OnState as W } from "@base-framework/atoms";
2
+ import { Component as N, Data as Y, Atom as z, DateTime as B } from "@base-framework/base";
3
+ import { B as m } from "./buttons-Cm9etaEG.js";
4
+ import { Icons as S } from "./icons.es.js";
5
+ const H = (e, t) => {
6
+ const n = e ? e.getBoundingClientRect() : { top: 0, bottom: 0, left: 0 }, s = t.getBoundingClientRect(), r = 10, a = globalThis.scrollX, l = globalThis.scrollY;
7
+ let c = n.left + a, g = n.bottom + l;
8
+ const d = globalThis.innerHeight - n.bottom, h = n.top;
9
+ return c + s.width > globalThis.innerWidth && (c = globalThis.innerWidth - s.width - r), d < s.height && h > d ? g = n.top + l - s.height - r : d < s.height && (g = n.bottom + l - (s.height - d) - r), { x: c, y: g };
10
+ };
11
+ class ht extends N {
12
+ /**
13
+ * This will set up the data.
14
+ *
15
+ * @returns {object}
16
+ */
17
+ setData() {
18
+ const t = this.parent.data || new Y();
19
+ return t.set({
20
+ position: { x: 0, y: 0 }
21
+ }), t;
22
+ }
23
+ /**
24
+ * This will get the class size.
25
+ *
26
+ * @returns {string}
27
+ */
28
+ getSize() {
29
+ switch (this.size || "lg") {
30
+ // @ts-ignore
31
+ case "sm":
32
+ return "w-48";
33
+ // @ts-ignore
34
+ case "md":
35
+ return "w-64";
36
+ case "lg":
37
+ return "w-[250px]";
38
+ // @ts-ignore
39
+ case "xl":
40
+ return "w-96";
41
+ // @ts-ignore
42
+ case "2xl":
43
+ return "w-[400px]";
44
+ // @ts-ignore
45
+ case "fit":
46
+ return "w-fit";
47
+ // @ts-ignore
48
+ case "full":
49
+ return "w-full";
50
+ }
51
+ }
52
+ /**
53
+ * This will render the modal component.
54
+ *
55
+ * @returns {object}
56
+ */
57
+ render() {
58
+ const t = this.getSize();
59
+ return i({
60
+ class: `absolute inset-auto fadeIn mt-2 rounded-md p-0 shadow-lg bg-popover min-h-12 backdrop:bg-transparent text-inherit r z-30 ${t}`,
61
+ popover: "manual",
62
+ toggle: (n, { state: s }) => n.newState === "closed" ? s.open = !1 : null,
63
+ style: "top: [[position.y]]px; left: [[position.x]]px"
64
+ }, this.children);
65
+ }
66
+ /**
67
+ * This will setup the states.
68
+ *
69
+ * @returns {object}
70
+ */
71
+ setupStates() {
72
+ return {
73
+ open: {
74
+ id: this.parent.getId(),
75
+ callBack: (s) => {
76
+ this.state.open === !1 && this.destroy();
77
+ }
78
+ }
79
+ };
80
+ }
81
+ /**
82
+ * Updates the dropdown position.
83
+ *
84
+ * @returns {void}
85
+ */
86
+ updatePosition() {
87
+ const t = this.button ?? null, n = this.panel, s = H(t, n);
88
+ this.data.position = s;
89
+ }
90
+ /**
91
+ * This will run after the setup.
92
+ *
93
+ * @returns {void}
94
+ */
95
+ afterSetup() {
96
+ this.panel.showPopover(), this.updatePosition();
97
+ }
98
+ /**
99
+ * This will check if the element clicked was in the
100
+ * component of the button.
101
+ *
102
+ * @param {object} element
103
+ * @returns {boolean}
104
+ */
105
+ isOutsideClick(t) {
106
+ return !this.panel.contains(t) && this.button && !this.button.contains(t);
107
+ }
108
+ /**
109
+ * This will set up the events.
110
+ *
111
+ * @returns {array}
112
+ */
113
+ setupEvents() {
114
+ return [
115
+ ["click", document, (t) => {
116
+ this.isOutsideClick(t.target) && (this.state.open = !1);
117
+ }],
118
+ ["resize", globalThis, (t) => this.updatePosition()],
119
+ ["scroll", document, (t) => this.updatePosition()]
120
+ ];
121
+ }
122
+ /**
123
+ * This will override the set up to use the app shell.
124
+ *
125
+ * @param {object} container
126
+ */
127
+ setContainer(t) {
128
+ this.container = app.root;
129
+ }
130
+ /**
131
+ * This will hide the popover before destroying.
132
+ *
133
+ * @returns {void}
134
+ */
135
+ beforeDestroy() {
136
+ this.panel.hidePopover();
137
+ }
138
+ }
139
+ const R = z(({ src: e, alt: t }) => e ? j({
140
+ class: "absolute w-full h-full rounded-full object-cover fadeIn",
141
+ src: e,
142
+ alt: t,
143
+ /**
144
+ * If there's an error loading the image, hide it.
145
+ */
146
+ error: (n) => n.target.style.display = "none"
147
+ }) : null), X = (e) => e && (Array.isArray(e) && (e = e.join(" ")), typeof e != "string" && (e = String(e)), e.split(" ").map((t) => t.charAt(0)).join("").toUpperCase()), O = (e) => !e || e.length < 2 ? e : X(e), E = (e) => P([e, (t, n) => {
148
+ n.textContent = O(t);
149
+ }]), T = {
150
+ xs: "h-6 w-6",
151
+ sm: "h-8 w-8",
152
+ md: "h-12 w-12",
153
+ lg: "h-16 w-16",
154
+ xl: "h-24 w-24",
155
+ "2xl": "h-32 w-32",
156
+ "3xl": "h-48 w-48",
157
+ "4xl": "h-64 w-64",
158
+ default: "h-12 w-12"
159
+ }, k = {
160
+ xs: "text-[7px]",
161
+ sm: "text-xs",
162
+ md: "text-base",
163
+ lg: "text-xl",
164
+ xl: "text-2xl",
165
+ "2xl": "text-3xl",
166
+ "3xl": "text-4xl",
167
+ "4xl": "text-5xl",
168
+ default: "text-base"
169
+ }, G = (e) => T[e] || T.default, L = (e) => k[e] || k.default, U = (e, t = null, n = "md") => {
170
+ const s = O(e), r = L(n);
171
+ return i(
172
+ {
173
+ class: `
174
+ flex items-center justify-center w-full h-full rounded-full
175
+ bg-muted text-muted-foreground font-medium
176
+ ${r}
177
+ `
178
+ },
179
+ [
180
+ t ? E(t) : P({ class: "uppercase" }, s)
181
+ ]
182
+ );
183
+ }, dt = z(({ src: e, alt: t, fallbackText: n, watcherFallback: s, size: r }) => {
184
+ const a = G(r);
185
+ return i(
186
+ {
187
+ class: `relative flex items-center justify-center ${a}`
188
+ },
189
+ [
190
+ R({ src: e, alt: t }),
191
+ U(n, s, r)
192
+ ]
193
+ );
194
+ }), _ = ({ currentYear: e, onSelect: t }) => i(
195
+ { class: "grid grid-cols-3 gap-2" },
196
+ B.monthNames.map(
197
+ (n, s) => m(
198
+ {
199
+ click: () => t(s),
200
+ variant: "ghost",
201
+ "aria-label": `Select ${n} ${e}`
202
+ },
203
+ n
204
+ )
205
+ )
206
+ ), D = (e) => (e *= 1, e < 10 ? `0${e}` : String(e)), q = (e) => (e.indexOf("T") === -1 && e.indexOf(" ") === -1 && (e += "T00:00:01"), e.replace(" ", "T"), e), x = (e, t, n) => `${e}-${D(t + 1)}-${D(n)}`, J = (e) => e ? "bg-accent text-primary" : "", K = (e) => e ? "text-muted-foreground opacity-50" : "", Q = (e, t) => e === t, V = (e, t) => Q(e, t) ? "bg-primary text-primary-foreground" : "", Z = (e, t, n, s) => {
207
+ const r = V(t, s);
208
+ return r || (e ? J(e) : n ? K(n) : "text-foreground");
209
+ }, C = (e) => {
210
+ const {
211
+ day: t,
212
+ currentDate: n,
213
+ date: s,
214
+ isToday: r,
215
+ isOutsideMonth: a,
216
+ select: l,
217
+ disabled: c
218
+ } = e;
219
+ return I(
220
+ {
221
+ class: `
222
+ flex items-center justify-center h-9 w-auto p-0 font-normal text-sm rounded-md
223
+ ${Z(r, n, a, s)}
224
+ hover:bg-muted/50 hover:text-muted-foreground focus:z-10
225
+ disabled:pointer-events-none disabled:opacity-50
226
+ `,
227
+ disabled: c || t === null,
228
+ "aria-label": t ? `Day ${t}` : null,
229
+ // Only call select if it's not disabled.
230
+ click: () => !c && l(s)
231
+ },
232
+ t.toString()
233
+ );
234
+ }, M = (e, t, n, s) => e === s.date && t === s.month && n === s.year, tt = (e, t, n, s = !1) => {
235
+ const { year: r, month: a } = e, l = x(r, a, e.date), c = new Date(r, a, 1).getDay(), g = new Date(r, a + 1, 0).getDate(), d = new Date(r, a, 0).getDate(), h = [], y = a === 0 ? 11 : a - 1, w = a === 0 ? r - 1 : r;
236
+ for (let o = c - 1; o >= 0; o--) {
237
+ const u = d - o, f = M(u, y, w, t), p = new Date(w, y, u) < new Date(t.year, t.month, t.date), F = s && p;
238
+ h.push(
239
+ C({
240
+ day: u,
241
+ currentDate: l,
242
+ date: x(w, y, u),
243
+ isToday: f,
244
+ isOutsideMonth: !0,
245
+ select: n,
246
+ disabled: F
247
+ })
248
+ );
249
+ }
250
+ for (let o = 1; o <= g; o++) {
251
+ const u = M(o, a, r, t), f = new Date(r, a, o) < new Date(t.year, t.month, t.date), p = s && f;
252
+ h.push(
253
+ C({
254
+ day: o,
255
+ currentDate: l,
256
+ date: x(r, a, o),
257
+ isToday: u,
258
+ isOutsideMonth: !1,
259
+ select: n,
260
+ disabled: p
261
+ })
262
+ );
263
+ }
264
+ const v = a === 11 ? 0 : a + 1, b = a === 11 ? r + 1 : r, A = (7 - h.length % 7) % 7;
265
+ for (let o = 1; o <= A; o++) {
266
+ const u = M(o, v, b, t), f = new Date(b, v, o) < new Date(t.year, t.month, t.date), p = s && f;
267
+ h.push(
268
+ C({
269
+ day: o,
270
+ currentDate: l,
271
+ date: x(b, v, o),
272
+ isToday: u,
273
+ isOutsideMonth: !0,
274
+ select: n,
275
+ disabled: p
276
+ })
277
+ );
278
+ }
279
+ return h;
280
+ }, $ = ({ label: e, click: t }) => m(
281
+ {
282
+ class: `
283
+ inline-flex items-center justify-center h-7 w-7 bg-transparent p-0
284
+ opacity-50 hover:opacity-100 text-muted-foreground absolute
285
+ ${e === "Previous" ? "left-1" : "right-1"}
286
+ focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
287
+ `,
288
+ click: t,
289
+ "aria-label": `${e} month`,
290
+ variant: "icon",
291
+ icon: e === "Previous" ? S.chevron.single.left : S.chevron.single.right
292
+ }
293
+ ), et = ({ onMonthClick: e, onYearClick: t, next: n, previous: s }) => i({ class: "flex items-center justify-center space-x-2 relative min-h-12 text-sm font-medium" }, [
294
+ m({ click: e, variant: "ghost", "aria-label": "Select month" }, "[[monthName]]"),
295
+ m({ click: t, variant: "ghost", "aria-label": "Select year" }, "[[current.year]]"),
296
+ $({ label: "Previous", click: s }),
297
+ $({ label: "Next", click: n })
298
+ ]), nt = (e) => i(
299
+ { class: "flex items-center justify-center h-9 w-auto text-[0.8rem] font-normal text-muted-foreground" },
300
+ e
301
+ ), st = () => ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map(nt), rt = (e) => i({ class: "rdp w-full space-y-1" }, [
302
+ et({
303
+ onMonthClick: e.onMonthClick,
304
+ onYearClick: e.onYearClick,
305
+ next: e.next,
306
+ previous: e.previous
307
+ }),
308
+ i({
309
+ class: "flex flex-auto flex-col w-full",
310
+ onSet: [
311
+ "currentDate",
312
+ () => [
313
+ i({ class: "grid grid-cols-7" }, st()),
314
+ i(
315
+ { class: "grid grid-cols-7" },
316
+ tt(
317
+ e.current,
318
+ e.today,
319
+ e.select,
320
+ e.blockPriorDates
321
+ )
322
+ )
323
+ ]
324
+ ]
325
+ })
326
+ ]), at = ({ currentMonth: e, currentYear: t, onSelect: n }) => {
327
+ const s = t - 50, r = Array.from({ length: 101 }, (a, l) => s + l);
328
+ return i(
329
+ { class: "grid grid-cols-5 gap-2" },
330
+ r.map(
331
+ (a) => m(
332
+ {
333
+ click: () => n(a),
334
+ variant: "ghost",
335
+ "aria-label": `Select ${a}`
336
+ },
337
+ a.toString()
338
+ )
339
+ )
340
+ );
341
+ };
342
+ class gt extends N {
343
+ /**
344
+ * This will declare the props for the compiler.
345
+ *
346
+ * @returns {void}
347
+ */
348
+ declareProps() {
349
+ this.selectedDate = null, this.selectedCallBack = null, this.blockPriorDates = !1;
350
+ }
351
+ /**
352
+ * This will get the selected data.
353
+ *
354
+ * @param {object} today
355
+ * @returns {Date}
356
+ */
357
+ getSelectedDate(t) {
358
+ const n = this.selectedDate ? new Date(q(this.selectedDate)) : t;
359
+ return new Date(n.getFullYear(), n.getMonth(), n.getDate());
360
+ }
361
+ /**
362
+ * This will set up the data for the calendar.
363
+ *
364
+ * @returns {Data}
365
+ */
366
+ setData() {
367
+ const t = /* @__PURE__ */ new Date(), n = this.getSelectedDate(t), s = n.getMonth();
368
+ return new Y({
369
+ monthName: this.getMonthName(s),
370
+ currentDate: `${n.getFullYear()}-${s + 1}-${n.getDate()}`,
371
+ current: {
372
+ date: n.getDate(),
373
+ year: n.getFullYear(),
374
+ month: s
375
+ },
376
+ today: {
377
+ date: t.getDate(),
378
+ month: t.getMonth(),
379
+ year: t.getFullYear()
380
+ }
381
+ });
382
+ }
383
+ /**
384
+ * This will set up the states for the calendar.
385
+ *
386
+ * @return {object}
387
+ */
388
+ setupStates() {
389
+ return {
390
+ view: "calendar"
391
+ // 'calendar' | 'months' | 'years'
392
+ };
393
+ }
394
+ /**
395
+ * This will get the name of the month.
396
+ *
397
+ * @param {number} month
398
+ * @returns {string}
399
+ */
400
+ getMonthName(t) {
401
+ return B.monthNames[t];
402
+ }
403
+ /**
404
+ * This will go to the previous month.
405
+ *
406
+ * @returns {void}
407
+ */
408
+ goToPreviousMonth() {
409
+ const t = this.data;
410
+ let n = t.current.month, s = t.current.year;
411
+ n === 0 ? (n = 11, s--) : n--, this.setCurrentDate(n, s);
412
+ }
413
+ /**
414
+ * This will go to the next month.
415
+ *
416
+ * @returns {void}
417
+ */
418
+ goToNextMonth() {
419
+ const t = this.data;
420
+ let n = t.current.month, s = t.current.year;
421
+ n === 11 ? (n = 0, s++) : n++, this.setCurrentDate(n, s);
422
+ }
423
+ /**
424
+ * This will set the current month and year.
425
+ *
426
+ * @param {number} month
427
+ * @param {number} year
428
+ * @param {number} [date=null]
429
+ * @returns {void}
430
+ */
431
+ setCurrentDate(t, n, s = null) {
432
+ const r = this.data;
433
+ r.current.month = t, r.current.year = n, typeof s == "number" && (r.current.date = D(s)), r.currentDate = `${n}-${D(t + 1)}-${r.current.date}`, r.monthName = this.getMonthName(t);
434
+ }
435
+ /**
436
+ * This will select a date.
437
+ *
438
+ * @param {string} date
439
+ * @returns {void}
440
+ */
441
+ selectDate(t) {
442
+ const n = /* @__PURE__ */ new Date(t + "T00:00:00");
443
+ this.setCurrentDate(n.getMonth(), n.getFullYear(), n.getDate()), typeof this.selectedCallBack == "function" && this.selectedCallBack(this.data.currentDate);
444
+ }
445
+ /**
446
+ * This will render the calendar.
447
+ *
448
+ * @returns {object}
449
+ */
450
+ render() {
451
+ return i({ class: "calendar-container p-3 rounded-md border min-w-80" }, [
452
+ W("view", (t) => {
453
+ switch (t) {
454
+ case "months":
455
+ return _(
456
+ {
457
+ currentYear: this.data.current.year,
458
+ onSelect: (n) => {
459
+ this.setCurrentDate(n, this.data.current.year), this.state.view = "calendar";
460
+ }
461
+ }
462
+ );
463
+ case "years":
464
+ return at(
465
+ {
466
+ currentMonth: this.data.current.month,
467
+ currentYear: this.data.current.year,
468
+ onSelect: (n) => {
469
+ this.setCurrentDate(this.data.current.month, n), this.state.view = "calendar";
470
+ }
471
+ }
472
+ );
473
+ default:
474
+ return rt({
475
+ current: this.data.current,
476
+ today: this.data.today,
477
+ select: (n) => this.selectDate(n),
478
+ next: () => this.goToNextMonth(),
479
+ previous: () => this.goToPreviousMonth(),
480
+ blockPriorDates: this.blockPriorDates || !1,
481
+ onMonthClick: () => this.state.view = "months",
482
+ onYearClick: () => this.state.view = "years"
483
+ });
484
+ }
485
+ })
486
+ ]);
487
+ }
488
+ }
489
+ export {
490
+ dt as A,
491
+ tt as C,
492
+ C as D,
493
+ x as F,
494
+ rt as M,
495
+ ht as P,
496
+ nt as a,
497
+ gt as b,
498
+ q as c,
499
+ H as g,
500
+ D as p
501
+ };
@@ -1,6 +1,6 @@
1
1
  import { Div as n, H5 as R, P as g, I as b, Li as O, Span as a, Ul as V, Button as m, OnState as v, Label as W, Form as G, H2 as C, Header as k, Footer as M, A as Y, H3 as J, Checkbox as K, Nav as Q, Input as S, UseParent as X, Time as Z, Dialog as ee } from "@base-framework/atoms";
2
2
  import { Atom as c, Component as x, Html as L, Dom as te, base as se, Data as D, Builder as H, Jot as I, DateTime as B } from "@base-framework/base";
3
- import { P as T, b as oe } from "./calendar-DQXME-2u.js";
3
+ import { P as T, b as oe } from "./calendar-Drlwc-pr.js";
4
4
  import { B as h, I as p } from "./buttons-Cm9etaEG.js";
5
5
  import { Icons as u } from "./icons.es.js";
6
6
  import { Timer as ne, List as le, DynamicTime as re } from "@base-framework/organisms";
package/dist/index.es.js CHANGED
@@ -3,9 +3,9 @@ import { B as g, I as C, L as T } from "./buttons-Cm9etaEG.js";
3
3
  import { C as D, d as I, D as S, c as B, E as P, F, H as M, I as k, M as N, N as f, P as v, R as x, T as y, a as h, b as W, U as H, W as L } from "./inputs-CMjx5-IX.js";
4
4
  import { V as w, a as U } from "./veil-D4dRxILB.js";
5
5
  import { Icons as E } from "./icons.es.js";
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 sa, a as ea, 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-CWXZVNA5.js";
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 Ua, p as Ra } from "./calendar-DQXME-2u.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, S as Za, n as $a, o as as, t as ss, s as es, q as os, r as ts, T as rs, l as ns, U as ls, W as is, f as ps, h as us, i as ms, c as ds, d as cs, b as gs, e as Cs, a as Ts, g as bs } from "./signature-panel-CJVWNEzI.js";
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 sa, a as ea, 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-JuhAfRyR.js";
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 Ua, p as Ra } from "./calendar-Drlwc-pr.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, S as Za, n as $a, o as as, t as ss, s as es, q as os, r as ts, T as rs, l as ns, U as ls, W as is, f as ps, h as us, i as ms, c as ds, d as cs, b as gs, e as Cs, a as Ts, g as bs } from "./signature-panel-DS9pkFpG.js";
9
9
  import { B as Is, I as Ss, M as Bs, d as Ps, e as Fs, g as Ms, N as ks, b as Ns, a as fs, f as vs, P as xs, c as ys, S as hs, T as Ws } from "./mobile-nav-wrapper-Dj67Pb8l.js";
10
10
  import { B as Ls, a as As, C as ws, F as Us, b as Rs, c as Es, M as Gs, P as Os, S as Vs } from "./sidebar-menu-page-BVryQj2Z.js";
11
11
  import { A as qs, F as zs, M as Js, a as _s, T as Ks } from "./aside-template-McEj_Gxc.js";
@@ -1,5 +1,5 @@
1
- import { A as o, B as t, C as e, t as i, E as r, v as n, w as m, x as l, D as S, j as u, k as D, H as c, G as p, s as C, c as d, a as g, b as F, I as T, i as A, g as P, e as f, h as w, F as I, d as b, f as y, u as B, M, l as x, N as k, P as v, p as E, q as N, S as h, n as L, o as R, T as U, y as j, z as q, m as z, r as G } from "./empty-state-CWXZVNA5.js";
2
- import { A as O, P as _, g as J } from "./calendar-DQXME-2u.js";
1
+ import { A as o, B as t, C as e, t as i, E as r, v as n, w as m, x as l, D as S, j as u, k as D, H as c, G as p, s as C, c as d, a as g, b as F, I as T, i as A, g as P, e as f, h as w, F as I, d as b, f as y, u as B, M, l as x, N as k, P as v, p as E, q as N, S as h, n as L, o as R, T as U, y as j, z as q, m as z, r as G } from "./empty-state-JuhAfRyR.js";
2
+ import { A as O, P as _, g as J } from "./calendar-Drlwc-pr.js";
3
3
  export {
4
4
  o as Alert,
5
5
  O as Avatar,
@@ -1,5 +1,5 @@
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 p, O as u, P as v, S as D, n as g, o as N, t as k, s as c, q as C, r as T, T as M, l as m, U as y, W as B, f as W, h, i as S, c as H, d as P, b as I, e as f, a as x, g as L } from "./signature-panel-CJVWNEzI.js";
2
- import { b as F, C as U, D as G, a as j, F as q, M as w, c as z, p as A } from "./calendar-DQXME-2u.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 p, O as u, P as v, S as D, n as g, o as N, t as k, s as c, q as C, r as T, T as M, l as m, U as y, W as B, f as W, h, i as S, c as H, d as P, b as I, e as f, a as x, g as L } from "./signature-panel-DS9pkFpG.js";
2
+ import { b as F, C as U, D as G, a as j, F as q, M as w, c as z, p as A } from "./calendar-Drlwc-pr.js";
3
3
  import { B as J, I as K, M as Q, d as R, e as V, g as X, N as Y, b as Z, a as _, f as $, P as aa, c as ea, S as sa, T as ta } from "./mobile-nav-wrapper-Dj67Pb8l.js";
4
4
  export {
5
5
  s as BackButton,
@@ -4,7 +4,7 @@ import { B as T, I as _ } from "./buttons-Cm9etaEG.js";
4
4
  import { Icons as x } from "./icons.es.js";
5
5
  import { TableBody as J, DataTableBody as Z, ScrollableTableBody as ee, List as te, IntervalTimer as se } from "@base-framework/organisms";
6
6
  import { C as ae, I as ie, H as ne } from "./inputs-CMjx5-IX.js";
7
- import { A as oe, P as le } from "./calendar-DQXME-2u.js";
7
+ import { A as oe, P as le } from "./calendar-Drlwc-pr.js";
8
8
  d((t, e) => ({
9
9
  class: "flex items-center px-4 py-2",
10
10
  ...t,
@@ -38,6 +38,12 @@ export class Calendar extends Component {
38
38
  * @returns {Data}
39
39
  */
40
40
  setData(): Data;
41
+ /**
42
+ * This will set up the states for the calendar.
43
+ *
44
+ * @return {object}
45
+ */
46
+ setupStates(): object;
41
47
  /**
42
48
  * This will get the name of the month.
43
49
  *
@@ -0,0 +1,7 @@
1
+ export function CalendarHeader({ onMonthClick, onYearClick, next, previous }: {
2
+ onMonthClick: Function;
3
+ onYearClick: Function;
4
+ next: Function;
5
+ previous: Function;
6
+ }): object;
7
+ export default CalendarHeader;
@@ -0,0 +1,4 @@
1
+ export function MonthSelector({ currentYear, onSelect }: {
2
+ currentYear: number;
3
+ onSelect: Function;
4
+ }): object;
@@ -0,0 +1,5 @@
1
+ export function YearSelector({ currentMonth, currentYear, onSelect }: {
2
+ currentMonth: number;
3
+ currentYear: number;
4
+ onSelect: Function;
5
+ }): object;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base-framework/ui",
3
- "version": "1.0.208",
3
+ "version": "1.0.210",
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": {
@@ -1,440 +0,0 @@
1
- import { Div as i, Img as F, Span as M, Button as j } from "@base-framework/atoms";
2
- import { Component as N, Data as z, Atom as k, DateTime as I } from "@base-framework/base";
3
- import { B as Y } from "./buttons-Cm9etaEG.js";
4
- import { Icons as T } from "./icons.es.js";
5
- const W = (e, t) => {
6
- const s = e ? e.getBoundingClientRect() : { top: 0, bottom: 0, left: 0 }, n = t.getBoundingClientRect(), o = 10, r = globalThis.scrollX, l = globalThis.scrollY;
7
- let c = s.left + r, f = s.bottom + l;
8
- const h = globalThis.innerHeight - s.bottom, d = s.top;
9
- return c + n.width > globalThis.innerWidth && (c = globalThis.innerWidth - n.width - o), h < n.height && d > h ? f = s.top + l - n.height - o : h < n.height && (f = s.bottom + l - (n.height - h) - o), { x: c, y: f };
10
- };
11
- class lt extends N {
12
- /**
13
- * This will set up the data.
14
- *
15
- * @returns {object}
16
- */
17
- setData() {
18
- const t = this.parent.data || new z();
19
- return t.set({
20
- position: { x: 0, y: 0 }
21
- }), t;
22
- }
23
- /**
24
- * This will get the class size.
25
- *
26
- * @returns {string}
27
- */
28
- getSize() {
29
- switch (this.size || "lg") {
30
- // @ts-ignore
31
- case "sm":
32
- return "w-48";
33
- // @ts-ignore
34
- case "md":
35
- return "w-64";
36
- case "lg":
37
- return "w-[250px]";
38
- // @ts-ignore
39
- case "xl":
40
- return "w-96";
41
- // @ts-ignore
42
- case "2xl":
43
- return "w-[400px]";
44
- // @ts-ignore
45
- case "fit":
46
- return "w-fit";
47
- // @ts-ignore
48
- case "full":
49
- return "w-full";
50
- }
51
- }
52
- /**
53
- * This will render the modal component.
54
- *
55
- * @returns {object}
56
- */
57
- render() {
58
- const t = this.getSize();
59
- return i({
60
- class: `absolute inset-auto fadeIn mt-2 rounded-md p-0 shadow-lg bg-popover min-h-12 backdrop:bg-transparent text-inherit r z-30 ${t}`,
61
- popover: "manual",
62
- toggle: (s, { state: n }) => s.newState === "closed" ? n.open = !1 : null,
63
- style: "top: [[position.y]]px; left: [[position.x]]px"
64
- }, this.children);
65
- }
66
- /**
67
- * This will setup the states.
68
- *
69
- * @returns {object}
70
- */
71
- setupStates() {
72
- return {
73
- open: {
74
- id: this.parent.getId(),
75
- callBack: (n) => {
76
- this.state.open === !1 && this.destroy();
77
- }
78
- }
79
- };
80
- }
81
- /**
82
- * Updates the dropdown position.
83
- *
84
- * @returns {void}
85
- */
86
- updatePosition() {
87
- const t = this.button ?? null, s = this.panel, n = W(t, s);
88
- this.data.position = n;
89
- }
90
- /**
91
- * This will run after the setup.
92
- *
93
- * @returns {void}
94
- */
95
- afterSetup() {
96
- this.panel.showPopover(), this.updatePosition();
97
- }
98
- /**
99
- * This will check if the element clicked was in the
100
- * component of the button.
101
- *
102
- * @param {object} element
103
- * @returns {boolean}
104
- */
105
- isOutsideClick(t) {
106
- return !this.panel.contains(t) && this.button && !this.button.contains(t);
107
- }
108
- /**
109
- * This will set up the events.
110
- *
111
- * @returns {array}
112
- */
113
- setupEvents() {
114
- return [
115
- ["click", document, (t) => {
116
- this.isOutsideClick(t.target) && (this.state.open = !1);
117
- }],
118
- ["resize", globalThis, (t) => this.updatePosition()],
119
- ["scroll", document, (t) => this.updatePosition()]
120
- ];
121
- }
122
- /**
123
- * This will override the set up to use the app shell.
124
- *
125
- * @param {object} container
126
- */
127
- setContainer(t) {
128
- this.container = app.root;
129
- }
130
- /**
131
- * This will hide the popover before destroying.
132
- *
133
- * @returns {void}
134
- */
135
- beforeDestroy() {
136
- this.panel.hidePopover();
137
- }
138
- }
139
- const H = k(({ src: e, alt: t }) => e ? F({
140
- class: "absolute w-full h-full rounded-full object-cover fadeIn",
141
- src: e,
142
- alt: t,
143
- /**
144
- * If there's an error loading the image, hide it.
145
- */
146
- error: (s) => s.target.style.display = "none"
147
- }) : null), R = (e) => e && (Array.isArray(e) && (e = e.join(" ")), typeof e != "string" && (e = String(e)), e.split(" ").map((t) => t.charAt(0)).join("").toUpperCase()), B = (e) => !e || e.length < 2 ? e : R(e), X = (e) => M([e, (t, s) => {
148
- s.textContent = B(t);
149
- }]), S = {
150
- xs: "h-6 w-6",
151
- sm: "h-8 w-8",
152
- md: "h-12 w-12",
153
- lg: "h-16 w-16",
154
- xl: "h-24 w-24",
155
- "2xl": "h-32 w-32",
156
- "3xl": "h-48 w-48",
157
- "4xl": "h-64 w-64",
158
- default: "h-12 w-12"
159
- }, P = {
160
- xs: "text-[7px]",
161
- sm: "text-xs",
162
- md: "text-base",
163
- lg: "text-xl",
164
- xl: "text-2xl",
165
- "2xl": "text-3xl",
166
- "3xl": "text-4xl",
167
- "4xl": "text-5xl",
168
- default: "text-base"
169
- }, E = (e) => S[e] || S.default, G = (e) => P[e] || P.default, L = (e, t = null, s = "md") => {
170
- const n = B(e), o = G(s);
171
- return i(
172
- {
173
- class: `
174
- flex items-center justify-center w-full h-full rounded-full
175
- bg-muted text-muted-foreground font-medium
176
- ${o}
177
- `
178
- },
179
- [
180
- t ? X(t) : M({ class: "uppercase" }, n)
181
- ]
182
- );
183
- }, ct = k(({ src: e, alt: t, fallbackText: s, watcherFallback: n, size: o }) => {
184
- const r = E(o);
185
- return i(
186
- {
187
- class: `relative flex items-center justify-center ${r}`
188
- },
189
- [
190
- H({ src: e, alt: t }),
191
- L(s, n, o)
192
- ]
193
- );
194
- }), x = (e) => (e *= 1, e < 10 ? `0${e}` : String(e)), U = (e) => (e.indexOf("T") === -1 && e.indexOf(" ") === -1 && (e += "T00:00:01"), e.replace(" ", "T"), e), m = (e, t, s) => `${e}-${x(t + 1)}-${x(s)}`, q = (e) => e ? "bg-accent text-primary" : "", J = (e) => e ? "text-muted-foreground opacity-50" : "", K = (e, t) => e === t, Q = (e, t) => K(e, t) ? "bg-primary text-primary-foreground" : "", V = (e, t, s, n) => {
195
- const o = Q(t, n);
196
- return o || (e ? q(e) : s ? J(s) : "text-foreground");
197
- }, v = (e) => {
198
- const {
199
- day: t,
200
- currentDate: s,
201
- date: n,
202
- isToday: o,
203
- isOutsideMonth: r,
204
- select: l,
205
- disabled: c
206
- } = e;
207
- return j(
208
- {
209
- class: `
210
- flex items-center justify-center h-9 w-auto p-0 font-normal text-sm rounded-md
211
- ${V(o, s, r, n)}
212
- hover:bg-muted/50 hover:text-muted-foreground focus:z-10
213
- disabled:pointer-events-none disabled:opacity-50
214
- `,
215
- disabled: c || t === null,
216
- "aria-label": t ? `Day ${t}` : null,
217
- // Only call select if it's not disabled.
218
- click: () => !c && l(n)
219
- },
220
- t.toString()
221
- );
222
- }, C = (e, t, s, n) => e === n.date && t === n.month && s === n.year, Z = (e, t, s, n = !1) => {
223
- const { year: o, month: r } = e, l = m(o, r, e.date), c = new Date(o, r, 1).getDay(), f = new Date(o, r + 1, 0).getDate(), h = new Date(o, r, 0).getDate(), d = [], D = r === 0 ? 11 : r - 1, y = r === 0 ? o - 1 : o;
224
- for (let a = c - 1; a >= 0; a--) {
225
- const u = h - a, g = C(u, D, y, t), p = new Date(y, D, u) < new Date(t.year, t.month, t.date), A = n && p;
226
- d.push(
227
- v({
228
- day: u,
229
- currentDate: l,
230
- date: m(y, D, u),
231
- isToday: g,
232
- isOutsideMonth: !0,
233
- select: s,
234
- disabled: A
235
- })
236
- );
237
- }
238
- for (let a = 1; a <= f; a++) {
239
- const u = C(a, r, o, t), g = new Date(o, r, a) < new Date(t.year, t.month, t.date), p = n && g;
240
- d.push(
241
- v({
242
- day: a,
243
- currentDate: l,
244
- date: m(o, r, a),
245
- isToday: u,
246
- isOutsideMonth: !1,
247
- select: s,
248
- disabled: p
249
- })
250
- );
251
- }
252
- const w = r === 11 ? 0 : r + 1, b = r === 11 ? o + 1 : o, O = (7 - d.length % 7) % 7;
253
- for (let a = 1; a <= O; a++) {
254
- const u = C(a, w, b, t), g = new Date(b, w, a) < new Date(t.year, t.month, t.date), p = n && g;
255
- d.push(
256
- v({
257
- day: a,
258
- currentDate: l,
259
- date: m(b, w, a),
260
- isToday: u,
261
- isOutsideMonth: !0,
262
- select: s,
263
- disabled: p
264
- })
265
- );
266
- }
267
- return d;
268
- }, _ = (e) => i(
269
- { class: "flex items-center justify-center h-9 w-auto text-[0.8rem] font-normal text-muted-foreground" },
270
- e
271
- ), $ = ({ label: e, click: t }) => Y(
272
- {
273
- class: `
274
- inline-flex items-center justify-center h-7 w-7 bg-transparent p-0
275
- opacity-50 hover:opacity-100 text-muted-foreground absolute
276
- ${e === "Previous" ? "left-1" : "right-1"}
277
- focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
278
- `,
279
- click: t,
280
- "aria-label": `${e} month`,
281
- variant: "icon",
282
- icon: e === "Previous" ? T.chevron.single.left : T.chevron.single.right
283
- }
284
- ), tt = ({ next: e, previous: t }) => i({ class: "flex flex-auto min-h-12 text-sm font-medium relative justify-center items-center" }, [
285
- M("[[monthName]] [[current.year]]"),
286
- $({
287
- label: "Previous",
288
- click: t
289
- }),
290
- $({
291
- label: "Next",
292
- click: e
293
- })
294
- ]), et = () => ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map(_), st = (e) => i({ class: "rdp w-full space-y-1" }, [
295
- tt({
296
- next: e.next,
297
- previous: e.previous
298
- }),
299
- i({
300
- class: "flex flex-auto flex-col w-full",
301
- onSet: [
302
- "currentDate",
303
- () => [
304
- i({ class: "grid grid-cols-7" }, et()),
305
- i(
306
- { class: "grid grid-cols-7" },
307
- Z(
308
- e.current,
309
- e.today,
310
- e.select,
311
- e.blockPriorDates
312
- )
313
- )
314
- ]
315
- ]
316
- })
317
- ]);
318
- class ut extends N {
319
- /**
320
- * This will declare the props for the compiler.
321
- *
322
- * @returns {void}
323
- */
324
- declareProps() {
325
- this.selectedDate = null, this.selectedCallBack = null, this.blockPriorDates = !1;
326
- }
327
- /**
328
- * This will get the selected data.
329
- *
330
- * @param {object} today
331
- * @returns {Date}
332
- */
333
- getSelectedDate(t) {
334
- const s = this.selectedDate ? new Date(U(this.selectedDate)) : t;
335
- return new Date(s.getFullYear(), s.getMonth(), s.getDate());
336
- }
337
- /**
338
- * This will set up the data for the calendar.
339
- *
340
- * @returns {Data}
341
- */
342
- setData() {
343
- const t = /* @__PURE__ */ new Date(), s = this.getSelectedDate(t), n = s.getMonth();
344
- return new z({
345
- monthName: this.getMonthName(n),
346
- currentDate: `${s.getFullYear()}-${n + 1}-${s.getDate()}`,
347
- current: {
348
- date: s.getDate(),
349
- year: s.getFullYear(),
350
- month: n
351
- },
352
- today: {
353
- date: t.getDate(),
354
- month: t.getMonth(),
355
- year: t.getFullYear()
356
- }
357
- });
358
- }
359
- /**
360
- * This will get the name of the month.
361
- *
362
- * @param {number} month
363
- * @returns {string}
364
- */
365
- getMonthName(t) {
366
- return I.monthNames[t];
367
- }
368
- /**
369
- * This will go to the previous month.
370
- *
371
- * @returns {void}
372
- */
373
- goToPreviousMonth() {
374
- const t = this.data;
375
- let s = t.current.month, n = t.current.year;
376
- s === 0 ? (s = 11, n--) : s--, this.setCurrentDate(s, n);
377
- }
378
- /**
379
- * This will go to the next month.
380
- *
381
- * @returns {void}
382
- */
383
- goToNextMonth() {
384
- const t = this.data;
385
- let s = t.current.month, n = t.current.year;
386
- s === 11 ? (s = 0, n++) : s++, this.setCurrentDate(s, n);
387
- }
388
- /**
389
- * This will set the current month and year.
390
- *
391
- * @param {number} month
392
- * @param {number} year
393
- * @param {number} [date=null]
394
- * @returns {void}
395
- */
396
- setCurrentDate(t, s, n = null) {
397
- const o = this.data;
398
- o.current.month = t, o.current.year = s, typeof n == "number" && (o.current.date = x(n)), o.currentDate = `${s}-${x(t + 1)}-${o.current.date}`, o.monthName = this.getMonthName(t);
399
- }
400
- /**
401
- * This will select a date.
402
- *
403
- * @param {string} date
404
- * @returns {void}
405
- */
406
- selectDate(t) {
407
- const s = /* @__PURE__ */ new Date(t + "T00:00:00");
408
- this.setCurrentDate(s.getMonth(), s.getFullYear(), s.getDate()), typeof this.selectedCallBack == "function" && this.selectedCallBack(this.data.currentDate);
409
- }
410
- /**
411
- * This will render the calendar.
412
- *
413
- * @returns {object}
414
- */
415
- render() {
416
- return i({ class: "calendar-container p-3 rounded-md border min-w-80" }, [
417
- st({
418
- current: this.data.current,
419
- today: this.data.today,
420
- select: (t) => this.selectDate(t),
421
- next: () => this.goToNextMonth(),
422
- previous: () => this.goToPreviousMonth(),
423
- blockPriorDates: this.blockPriorDates || !1
424
- })
425
- ]);
426
- }
427
- }
428
- export {
429
- ct as A,
430
- Z as C,
431
- v as D,
432
- m as F,
433
- st as M,
434
- lt as P,
435
- _ as a,
436
- ut as b,
437
- U as c,
438
- W as g,
439
- x as p
440
- };