@base-framework/ui 1.0.200 → 1.0.202

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,652 @@
1
+ var y = Object.defineProperty;
2
+ var S = (i, t, n) => t in i ? y(i, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[t] = n;
3
+ var g = (i, t, n) => S(i, typeof t != "symbol" ? t + "" : t, n);
4
+ import { DateTime as f, base as l } from "@base-framework/base";
5
+ const h = (i, t) => (typeof i == "string" && (i = [i]), Array.isArray(i) ? (i.push(t), i) : {
6
+ ...i,
7
+ callBack: t
8
+ }), x = (i, t = "") => i ?? t, z = {
9
+ /**
10
+ * Formats a number with commas.
11
+ *
12
+ * @param {string|number|object|array} watcher
13
+ * @param {string|null} defaultValue - Value if original is null or undefined.
14
+ * @returns {object|array}
15
+ */
16
+ number(i, t = null) {
17
+ return h(i, (e) => {
18
+ if (!isNaN(e)) {
19
+ const s = /\B(?=(\d{3})+(?!\d))/g;
20
+ return e.toString().replace(s, ",");
21
+ }
22
+ return t || "";
23
+ });
24
+ },
25
+ /**
26
+ * Formats a boolean value as a yes/no string.
27
+ *
28
+ * @param {string|number|object|array} watcher
29
+ * @param {string} yes - Text for true values.
30
+ * @param {string} no - Text for false values.
31
+ * @returns {object|array}
32
+ */
33
+ yesno(i, t = "Yes", n = "No") {
34
+ return h(i, (s) => s ? t : n);
35
+ },
36
+ /**
37
+ * Formats a value as money with two decimals.
38
+ *
39
+ * @param {string|number|object|array} watcher
40
+ * @param {string} currency - Currency symbol.
41
+ * @param {*} defaultValue - Value if original is invalid.
42
+ * @returns {object|array}
43
+ */
44
+ money(i, t = "$", n = null) {
45
+ return h(i, (s) => {
46
+ const o = parseFloat(s);
47
+ if (isNaN(o))
48
+ return n || "";
49
+ const r = /\B(?=(\d{3})+(?!\d))/g;
50
+ return t + o.toFixed(2).toString().replace(r, ",");
51
+ });
52
+ },
53
+ /**
54
+ * Formats a value as a US phone number (10 digits).
55
+ *
56
+ * @param {string|object|array} watcher
57
+ * @param {*} defaultValue - Value if original is invalid.
58
+ * @returns {object|array}
59
+ */
60
+ phone(i, t = null) {
61
+ return h(i, (e) => {
62
+ e = e || "";
63
+ const s = String(e.toString()).replace(/\D/g, "");
64
+ return s.length === 10 ? "(" + s.slice(0, 3) + ") " + s.slice(3, 6) + "-" + s.slice(6) : e || t;
65
+ });
66
+ },
67
+ /**
68
+ * Formats a value as an integer (rounds down).
69
+ *
70
+ * @param {string|number|object|array} watcher
71
+ * @param {*} defaultValue - Value if original is invalid.
72
+ * @returns {object|array}
73
+ */
74
+ integer(i, t = null) {
75
+ return h(i, (e) => {
76
+ e = x(e, t);
77
+ const s = parseInt(e, 10);
78
+ return isNaN(s) ? t : s.toString();
79
+ });
80
+ },
81
+ /**
82
+ * Formats a date value to a standard date format.
83
+ *
84
+ * @param {string|number|object|array} watcher
85
+ * @param {*} defaultValue - Value if original is invalid.
86
+ * @returns {object|array}
87
+ */
88
+ date(i, t = null) {
89
+ return h(i, (e) => e ? f.format("standard", e) : t || "");
90
+ },
91
+ /**
92
+ * Formats a date and time value to a standard date and time format.
93
+ *
94
+ * @param {string|number|object|array} watcher
95
+ * @param {*} defaultValue - Value if original is invalid.
96
+ * @returns {object|array}
97
+ */
98
+ dateTime(i, t = null) {
99
+ return h(i, (e) => e ? f.format("standard", e) + " " + f.formatTime(e, 12) : t || "");
100
+ },
101
+ /**
102
+ * Formats a time value to a standard time format.
103
+ *
104
+ * @param {string|number|object|array} watcher
105
+ * @param {*} defaultValue - Value if original is invalid.
106
+ * @returns {object|array}
107
+ */
108
+ time(i, t = null) {
109
+ return h(i, (e) => e ? f.formatTime(e, 12) : t || "");
110
+ },
111
+ /**
112
+ * Formats a value with a default value if null or undefined.
113
+ *
114
+ * @param {string|number|object|array} watcher
115
+ * @param {string|null} defaultValue - Value if original is null or undefined.
116
+ * @returns {object|array}
117
+ */
118
+ default(i, t = null) {
119
+ return h(i, (e) => x(e, t));
120
+ }
121
+ };
122
+ class v {
123
+ /**
124
+ * Creates an instance of ElementScaler.
125
+ *
126
+ * @constructor
127
+ * @param {HTMLElement} element - The DOM element to scale.
128
+ */
129
+ constructor(t) {
130
+ this.element = t, this.elementBoundingBox = null, this.container = t.parentNode, this.containerSize = {
131
+ width: 0,
132
+ height: 0,
133
+ top: 0,
134
+ left: 0
135
+ }, this.setup();
136
+ }
137
+ /**
138
+ * Initializes the scaling behavior by removing margins
139
+ * and triggering a resize check.
140
+ *
141
+ * @returns {void}
142
+ */
143
+ setup() {
144
+ this.removeMargin(), this.resize();
145
+ }
146
+ /**
147
+ * Removes all margin from the element (top/right/bottom/left).
148
+ *
149
+ * @returns {void}
150
+ */
151
+ removeMargin() {
152
+ this.element.style.margin = "0px 0px 0px 0px";
153
+ }
154
+ /**
155
+ * Gets the current bounding box of the element.
156
+ *
157
+ * @returns {DOMRect|null} The bounding box or null if not set.
158
+ */
159
+ getSize() {
160
+ return this.elementBoundingBox;
161
+ }
162
+ /**
163
+ * Calculates and caches the bounding client rect for the element.
164
+ *
165
+ * @returns {void}
166
+ */
167
+ setBoundingBox() {
168
+ this.elementBoundingBox = this.element.getBoundingClientRect();
169
+ }
170
+ /**
171
+ * Applies translation and scaling (width/height) to the element.
172
+ *
173
+ * @param {number} x - The horizontal position (left).
174
+ * @param {number} y - The vertical position (top).
175
+ * @param {number} scale - Scale factor (e.g., 1.0 = 100%, 0.5 = 50%).
176
+ * @returns {{width: number, height: number}} The new width and height after scaling.
177
+ */
178
+ transform(t, n, e) {
179
+ const s = this.element, o = s.style;
180
+ o.top = n + "px", o.left = t + "px";
181
+ const r = s.naturalWidth * e, c = s.naturalHeight * e;
182
+ return o.width = r + "px", o.height = c + "px", { width: r, height: c };
183
+ }
184
+ /**
185
+ * Updates internal bounding boxes for both the element and its container.
186
+ *
187
+ * @returns {void}
188
+ */
189
+ resize() {
190
+ this.setBoundingBox(), this.containerSize = this.container.getBoundingClientRect();
191
+ }
192
+ }
193
+ class D {
194
+ /**
195
+ * Creates an EventController instance.
196
+ *
197
+ * @constructor
198
+ * @param {object} parent - The parent object (ImageScaler) that handles actions.
199
+ * @param {HTMLElement} container - The DOM element to attach events to.
200
+ */
201
+ constructor(t, n) {
202
+ /**
203
+ * Tracks and measures distances between touches for pinch gestures.
204
+ */
205
+ g(this, "pinchTracker", {
206
+ /** @type {number|null} */
207
+ previousDistance: null,
208
+ /** @type {number|null} */
209
+ currentDistance: null,
210
+ /**
211
+ * Calculates Euclidean distance between two points.
212
+ *
213
+ * @param {number} x1
214
+ * @param {number} y1
215
+ * @param {number} x2
216
+ * @param {number} y2
217
+ * @returns {number}
218
+ */
219
+ distance(t, n, e, s) {
220
+ return Math.sqrt(
221
+ (t - e) * (t - e) + (n - s) * (n - s)
222
+ );
223
+ },
224
+ /**
225
+ * If currentDistance is set, store it as previousDistance.
226
+ *
227
+ * @returns {void}
228
+ */
229
+ setPreviousDistance() {
230
+ this.currentDistance !== null && (this.previousDistance = this.currentDistance);
231
+ },
232
+ /**
233
+ * Sets the current distance between two touch points.
234
+ *
235
+ * @param {object} touch1
236
+ * @param {object} touch2
237
+ * @returns {void}
238
+ */
239
+ setCurrentDistance(t, n) {
240
+ this.currentDistance = this.distance(t.x, t.y, n.x, n.y);
241
+ },
242
+ /**
243
+ * Updates currentDistance and keeps track of the previous distance.
244
+ *
245
+ * @param {object} touch1
246
+ * @param {object} touch2
247
+ * @returns {number} The updated current distance.
248
+ */
249
+ updateCurrentDistance(t, n) {
250
+ return this.setPreviousDistance(), this.setCurrentDistance(t, n), this.currentDistance;
251
+ },
252
+ /**
253
+ * Determines the scale direction (zoom in/out) based on distance changes.
254
+ *
255
+ * @param {object} touch1
256
+ * @param {object} touch2
257
+ * @returns {number} 1 for zoom in, -1 for zoom out, 0 if below threshold.
258
+ */
259
+ getScale(t, n) {
260
+ let e = 0;
261
+ const s = this.updateCurrentDistance(t, n), o = this.previousDistance;
262
+ return o === null || Math.abs(s - o) < 2 || (s > o ? e = 1 : s < o && (e = -1)), e;
263
+ },
264
+ /**
265
+ * Resets the distance measurements.
266
+ *
267
+ * @returns {void}
268
+ */
269
+ reset() {
270
+ this.previousDistance = null, this.currentDistance = null;
271
+ }
272
+ });
273
+ this.parent = t, this.container = n, this.pointer = { x: 0, y: 0, status: "up" }, this.setup();
274
+ }
275
+ /**
276
+ * Initializes event setup.
277
+ *
278
+ * @returns {void}
279
+ */
280
+ setup() {
281
+ this.setupEvents();
282
+ }
283
+ /**
284
+ * Removes all event listeners.
285
+ *
286
+ * @returns {void}
287
+ */
288
+ remove() {
289
+ this.removeEvents();
290
+ }
291
+ /**
292
+ * Creates and binds all required event listeners.
293
+ *
294
+ * @returns {void}
295
+ */
296
+ setupEvents() {
297
+ const t = this.container, n = l.bind(this, this.pointerMove), e = l.bind(this, this.pointerUp), s = l.bind(this, this.pointerDown), o = l.bind(this, this.wheel), r = l.bind(this, this.resize);
298
+ this.addEvents = function() {
299
+ l.on(["mousemove", "touchmove"], t, n), l.on(["mouseup", "mouseout", "touchend", "touchcancel"], t, e), l.on(["mousedown", "touchstart"], t, s), l.onMouseWheel(o, t, !0), l.on("resize", globalThis, r);
300
+ }, this.addEvents(), this.removeEvents = function() {
301
+ l.off(["mousemove", "touchmove"], t, n), l.off(["mouseup", "mouseout", "touchend", "touchcancel"], t, e), l.off(["mousedown", "touchstart"], t, s), l.offMouseWheel(o, t), l.off("resize", globalThis, r);
302
+ };
303
+ }
304
+ /**
305
+ * Handles mouse wheel or pinch events.
306
+ *
307
+ * @param {number} delta - The wheel direction (positive or negative).
308
+ * @param {Event} e - The associated event.
309
+ * @returns {void}
310
+ */
311
+ wheel(t, n) {
312
+ this.parent.callAction("pinch", n, t);
313
+ }
314
+ /**
315
+ * Extracts the position from mouse or touch events and updates `this.pointer`.
316
+ *
317
+ * @param {Event} e - The event object.
318
+ * @returns {void}
319
+ */
320
+ getEventPosition(t) {
321
+ let n, e;
322
+ const s = t.touches;
323
+ if (s && s.length) {
324
+ const o = s[0];
325
+ n = o.clientX, e = o.clientY;
326
+ } else
327
+ n = t.clientX, e = t.clientY;
328
+ this.pointer.x = n, this.pointer.y = e;
329
+ }
330
+ /**
331
+ * Called when the pointer goes down (mouse/touch).
332
+ *
333
+ * @param {Event} e - The associated event.
334
+ * @returns {void}
335
+ */
336
+ pointerDown(t) {
337
+ this.getEventPosition(t), this.pointer.status = "down", this.isGesture(t) === !1 && this.parent.callAction("pointerDown", t);
338
+ }
339
+ /**
340
+ * Called when the pointer is released.
341
+ *
342
+ * @param {Event} e - The associated event.
343
+ * @returns {void}
344
+ */
345
+ pointerUp(t) {
346
+ this.pointer.status = "up", this.parent.callAction("pointerUp", t), this.pinchTracker.reset();
347
+ }
348
+ /**
349
+ * Handles window resize actions.
350
+ *
351
+ * @returns {void}
352
+ */
353
+ resize() {
354
+ this.parent.resize();
355
+ }
356
+ /**
357
+ * Extracts all touches from the event object.
358
+ *
359
+ * @param {Event} e - The touch event.
360
+ * @returns {Array<object>} Array of touch points.
361
+ */
362
+ getTouches(t) {
363
+ const n = [], e = t.touches;
364
+ if (e && e.length)
365
+ for (let s = 0; s < e.length; s++)
366
+ n.push(e[s]);
367
+ return n;
368
+ }
369
+ /**
370
+ * Calculates the midpoint (center) between two sets of coordinates.
371
+ *
372
+ * @param {number} x1
373
+ * @param {number} y1
374
+ * @param {number} x2
375
+ * @param {number} y2
376
+ * @returns {{x: number, y: number}} The center coordinates.
377
+ */
378
+ getCenter(t, n, e, s) {
379
+ return {
380
+ x: (t + e) / 2,
381
+ y: (n + s) / 2
382
+ };
383
+ }
384
+ /**
385
+ * Attempts a pinch gesture if two touches are present.
386
+ *
387
+ * @param {Event} e - The touch event.
388
+ * @returns {void}
389
+ */
390
+ pinch(t) {
391
+ const n = this.getTouches(t);
392
+ if (n.length === 2) {
393
+ this.pointer.status = "down";
394
+ const e = n[0], s = n[1], o = this.getPosition(e.clientX, e.clientY), r = this.getPosition(s.clientX, s.clientY);
395
+ this.centerMousePinch(e, s);
396
+ const c = this.pinchTracker.getScale(o, r);
397
+ this.parent.callAction("pinch", t, c);
398
+ }
399
+ }
400
+ /**
401
+ * Creates a coordinate object from x/y.
402
+ *
403
+ * @param {number} eX
404
+ * @param {number} eY
405
+ * @returns {{x: number, y: number}}
406
+ */
407
+ getPosition(t, n) {
408
+ return {
409
+ x: parseInt(String(t)),
410
+ y: parseInt(String(n))
411
+ };
412
+ }
413
+ /**
414
+ * Moves pointer coordinates to the midpoint of two touches for pinch usage.
415
+ *
416
+ * @param {Touch} touch1
417
+ * @param {Touch} touch2
418
+ * @returns {void}
419
+ */
420
+ centerMousePinch(t, n) {
421
+ const e = this.getCenter(
422
+ t.clientX,
423
+ t.clientY,
424
+ n.clientX,
425
+ n.clientY
426
+ ), s = this.pointer;
427
+ s.x = e.x, s.y = e.y;
428
+ }
429
+ /**
430
+ * Called on a rotate gesture (currently not used).
431
+ *
432
+ * @param {Event} e - The associated event.
433
+ * @returns {void}
434
+ */
435
+ rotate(t) {
436
+ this.pointer.status = "down", this.parent.callAction("rotate", t);
437
+ }
438
+ /**
439
+ * Checks if the event is a multi-touch gesture. If yes, performs pinch logic.
440
+ *
441
+ * @param {Event} e - The event object.
442
+ * @returns {boolean} True if it was a gesture (pinch); false otherwise.
443
+ */
444
+ isGesture(t) {
445
+ let n = !1;
446
+ const e = t.touches;
447
+ return e && e.length > 1 && (t.preventDefault(), this.pinch(t), n = !0), n;
448
+ }
449
+ /**
450
+ * Called when the pointer moves (mouse/touch) but might also detect pinch.
451
+ *
452
+ * @param {Event} e - The associated event.
453
+ * @returns {void}
454
+ */
455
+ pointerMove(t) {
456
+ this.getEventPosition(t), this.isGesture(t) === !1 && this.parent.callAction("pointerMove", t);
457
+ }
458
+ }
459
+ class E {
460
+ /**
461
+ * Creates an instance of ImageScaler.
462
+ *
463
+ * @constructor
464
+ * @param {HTMLImageElement} element - The image element to scale.
465
+ */
466
+ constructor(t) {
467
+ /** @type {number} Minimum allowed scale factor. */
468
+ g(this, "minScale", 0.2);
469
+ this.elementScaler = new v(t), this.scale = this.getImageScale(t), this.panning = !1, this.events = null, this.start = { x: 0, y: 0 }, this.delta = { x: 0, y: 0 }, this.setup();
470
+ }
471
+ /**
472
+ * Initializes event handling and centers the image.
473
+ *
474
+ * @returns {void}
475
+ */
476
+ setup() {
477
+ this.setupEvents(), this.center();
478
+ }
479
+ /**
480
+ * Removes all event bindings.
481
+ *
482
+ * @returns {void}
483
+ */
484
+ remove() {
485
+ this.events.remove();
486
+ }
487
+ /**
488
+ * Invokes a method on this class by name, passing event/data.
489
+ *
490
+ * @param {string} action - The method name to call.
491
+ * @param {Event} e - The associated event object.
492
+ * @param {*} [data] - Additional data passed to the method.
493
+ * @returns {void}
494
+ */
495
+ callAction(t, n, e) {
496
+ this[t](n, e);
497
+ }
498
+ /**
499
+ * Sets up the event controller for the image.
500
+ *
501
+ * @returns {void}
502
+ */
503
+ setupEvents() {
504
+ this.events = new D(this, this.elementScaler.element);
505
+ }
506
+ /**
507
+ * Calculates an initial scale based on the element's offsetWidth vs. naturalWidth.
508
+ *
509
+ * @param {HTMLImageElement} element - The image element.
510
+ * @returns {number} The initial scale factor.
511
+ */
512
+ getImageScale(t) {
513
+ return t.offsetWidth / t.naturalWidth;
514
+ }
515
+ /**
516
+ * Gets the offset position of the pointer, adjusted by scale and delta.
517
+ *
518
+ * @param {Event} e - The associated event object.
519
+ * @returns {{x: number, y: number}} The pointer offset without scale.
520
+ */
521
+ getOffset(t) {
522
+ const n = this.scale, e = this.delta, s = this.getPointerPosition();
523
+ return {
524
+ x: (s.x - e.x) / n,
525
+ y: (s.y - e.y) / n
526
+ };
527
+ }
528
+ /**
529
+ * Transforms the element (x, y, scale) and then re-centers it if needed.
530
+ *
531
+ * @param {number} x - The new left offset.
532
+ * @param {number} y - The new top offset.
533
+ * @param {number} scale - The scale factor.
534
+ * @returns {void}
535
+ */
536
+ scaleElement(t, n, e) {
537
+ const s = this.elementScaler.transform(t, n, e);
538
+ this.center(s.width, s.height);
539
+ }
540
+ /**
541
+ * Attempts to center the scaled element within its container, respecting boundaries.
542
+ *
543
+ * @param {number} [width] - Width of the scaled element.
544
+ * @param {number} [height] - Height of the scaled element.
545
+ * @returns {void}
546
+ */
547
+ center(t, n) {
548
+ const e = this.elementScaler, s = e.containerSize, o = e.elementBoundingBox, r = this.delta;
549
+ t = t || o.width, n = n || o.height;
550
+ let c, a;
551
+ const p = s.width;
552
+ if (t < p)
553
+ c = p / 2 - t / 2, c = c > 0 ? c : 0;
554
+ else {
555
+ c = r.x;
556
+ const u = t + r.x;
557
+ u < p && (c = u + (p - u) - t), r.x > 0 && (c = 0);
558
+ }
559
+ const d = s.height;
560
+ if (n < d)
561
+ a = d / 2 - n / 2, a = a > 0 ? a : 0;
562
+ else {
563
+ a = r.y;
564
+ const u = n + r.y;
565
+ u < d && (a = u + (d - u) - n), r.y > 0 && (a = 0);
566
+ }
567
+ const m = e.element.style;
568
+ m.left = c + "px", m.top = a + "px", this.delta = { x: c, y: a };
569
+ }
570
+ /**
571
+ * Updates the current scale (zoom) value based on scroll delta.
572
+ *
573
+ * @param {number} delta - Positive = zoom in, negative = zoom out.
574
+ * @returns {number} The updated scale factor.
575
+ */
576
+ updateScale(t) {
577
+ let n = this.scale;
578
+ return t !== 0 && (n = t > 0 ? this.scale *= 1.05 : this.scale /= 1.05), n <= this.minScale && (this.scale = this.minScale), this.scale;
579
+ }
580
+ /**
581
+ * Returns the pointer position relative to the container.
582
+ *
583
+ * @returns {{x: number, y: number}} The pointer coordinates.
584
+ */
585
+ getPointerPosition() {
586
+ const t = this.elementScaler.containerSize, n = this.events.pointer;
587
+ return {
588
+ x: n.x - t.left,
589
+ y: n.y - t.top
590
+ };
591
+ }
592
+ /**
593
+ * Called when the user presses down on the pointer (mouse/touch).
594
+ *
595
+ * @param {Event} e - The associated event object.
596
+ * @returns {void}
597
+ */
598
+ pointerDown(t) {
599
+ const n = this.delta, e = this.getPointerPosition();
600
+ this.start = {
601
+ x: e.x - n.x,
602
+ y: e.y - n.y
603
+ }, this.panning = !0;
604
+ }
605
+ /**
606
+ * Called when the user moves the pointer (mouse/touch).
607
+ *
608
+ * @param {Event} e - The associated event object.
609
+ * @returns {void}
610
+ */
611
+ pointerMove(t) {
612
+ if (t.preventDefault(), !this.panning)
613
+ return;
614
+ const n = this.getPointerPosition(), e = this.delta, s = this.start;
615
+ e.x = n.x - s.x, e.y = n.y - s.y, this.scaleElement(e.x, e.y, this.scale);
616
+ }
617
+ /**
618
+ * Called when the user releases the pointer (mouse/touch).
619
+ *
620
+ * @param {Event} e - The associated event object.
621
+ * @returns {void}
622
+ */
623
+ pointerUp(t) {
624
+ this.panning = !1;
625
+ }
626
+ /**
627
+ * Recalculates container/element bounding sizes, e.g., on window resize.
628
+ *
629
+ * @returns {void}
630
+ */
631
+ resize() {
632
+ this.elementScaler.resize();
633
+ }
634
+ /**
635
+ * Called on pinch gesture (usually from a wheel or multi-touch).
636
+ *
637
+ * @param {Event} e - The associated event.
638
+ * @param {number} delta - Positive = zoom in, negative = zoom out.
639
+ * @returns {void}
640
+ */
641
+ pinch(t, n) {
642
+ const e = this.getOffset(t);
643
+ t.preventDefault();
644
+ const s = this.updateScale(n), o = this.getPointerPosition(), r = this.delta;
645
+ r.x = o.x - e.x * s, r.y = o.y - e.y * s, this.scaleElement(r.x, r.y, s);
646
+ }
647
+ }
648
+ export {
649
+ z as F,
650
+ E as I,
651
+ h as c
652
+ };
package/dist/index.es.js CHANGED
@@ -1,36 +1,37 @@
1
- import { B as e, C as t, a as o, F as r, L as n, P as i, R as l, S as p, b as u, T as m } from "./tooltip-CYtKjefM.js";
2
- import { B as g, I as T, L as c } from "./buttons-Cm9etaEG.js";
3
- import { C as D, d as b, D as I, c as S, E as B, F as P, H as F, I as M, M as k, N, P as v, R as f, T as x, a as y, b as h, U as W, W as H } from "./inputs-CMjx5-IX.js";
1
+ import { B as s, C as t, a as o, F as r, L as n, P as l, R as i, S as p, b as u, T as m } from "./tooltip-CYtKjefM.js";
2
+ import { B as c, I as g, L as C } from "./buttons-Cm9etaEG.js";
3
+ import { C as b, d as D, D as I, c as S, E as B, F as P, H as F, I as M, M as k, N, P as f, R as v, T as x, a as y, b as h, U as W, W as H } from "./inputs-CMjx5-IX.js";
4
4
  import { V as A, a as w } from "./veil-D4dRxILB.js";
5
5
  import { Icons as R } from "./icons.es.js";
6
- import { A as O, B as G, C as V, t as j, E as q, v as z, w as J, x as _, D as K, j as Q, k as X, H as Y, G as Z, s as $, c as aa, a as sa, b as ea, I as ta, i as oa, g as ra, e as na, h as ia, F as la, d as pa, f as ua, u as ma, M as da, l as ga, N as Ta, P as ca, p as Ca, q as Da, S as ba, n as Ia, o as Sa, T as Ba, y as Pa, z as Fa, m as Ma, r as ka } from "./empty-state-CWXZVNA5.js";
7
- import { A as va, b as fa, C as xa, D as ya, a as ha, F as Wa, M as Ha, P as La, c as Aa, g as wa, p as Ua } from "./calendar-DQXME-2u.js";
8
- import { B as Ea, p as Oa, C as Ga, j as Va, D as ja, m as qa, k as za, H as Ja, I as _a, N as Ka, O as Qa, P as Xa, S as Ya, n as Za, o as $a, t as as, s as ss, q as es, r as ts, T as os, l as rs, U as ns, W as is, f as ls, h as ps, i as us, c as ms, d as ds, b as gs, e as Ts, a as cs, g as Cs } from "./signature-panel-CJVWNEzI.js";
9
- import { B as bs, I as Is, M as Ss, d as Bs, e as Ps, g as Fs, N as Ms, b as ks, a as Ns, f as vs, P as fs, c as xs, S as ys, T as hs } from "./mobile-nav-wrapper-Dj67Pb8l.js";
10
- import { B as Hs, a as Ls, C as As, F as ws, b as Us, c as Rs, M as Es, P as Os, S as Gs } from "./sidebar-menu-page-BVryQj2Z.js";
11
- import { A as js, F as qs, M as zs, a as Js, T as _s } from "./aside-template-McEj_Gxc.js";
12
- import { B as Qs } from "./bside-template-Du2m3rsE.js";
6
+ import { A as O, B as G, C as V, t as j, E as q, v as z, w as J, x as _, D as K, j as Q, k as X, H as Y, G as Z, s as $, c as aa, a as ea, b as sa, I as ta, i as oa, g as ra, e as na, h as la, F as ia, d as pa, f as ua, u as ma, M as da, l as ca, N as ga, P as Ca, p as Ta, q as ba, S as Da, n as Ia, o as Sa, T as Ba, y as Pa, z as Fa, m as Ma, r as ka } from "./empty-state-CWXZVNA5.js";
7
+ import { A as fa, b as va, C as xa, D as ya, a as ha, F as Wa, M as Ha, P as La, c as Aa, g as wa, p as Ua } from "./calendar-DQXME-2u.js";
8
+ import { B as Ea, p as Oa, C as Ga, j as Va, D as ja, m as qa, k as za, H as Ja, I as _a, N as Ka, O as Qa, P as Xa, S as Ya, n as Za, o as $a, t as ae, s as ee, q as se, r as te, T as oe, l as re, U as ne, W as le, f as ie, h as pe, i as ue, c as me, d as de, b as ce, e as ge, a as Ce, g as Te } from "./signature-panel-CJVWNEzI.js";
9
+ import { B as De, I as Ie, M as Se, d as Be, e as Pe, g as Fe, N as Me, b as ke, a as Ne, f as fe, P as ve, c as xe, S as ye, T as he } from "./mobile-nav-wrapper-Dj67Pb8l.js";
10
+ import { B as He, a as Le, C as Ae, F as we, b as Ue, c as Re, M as Ee, P as Oe, S as Ge } from "./sidebar-menu-page-BVryQj2Z.js";
11
+ import { A as je, F as qe, M as ze, a as Je, T as _e } from "./aside-template-McEj_Gxc.js";
12
+ import { B as Qe } from "./bside-template-Du2m3rsE.js";
13
+ import { F as Ye, I as Ze, c as $e } from "./image-scaler-BQ7WdtlV.js";
13
14
  export {
14
15
  O as Alert,
15
- js as AsideTemplate,
16
- va as Avatar,
16
+ je as AsideTemplate,
17
+ fa as Avatar,
17
18
  Ea as BackButton,
18
- bs as Backdrop,
19
- e as Badge,
20
- Hs as BasicPage,
21
- Ls as BlankPage,
19
+ De as Backdrop,
20
+ s as Badge,
21
+ He as BasicPage,
22
+ Le as BlankPage,
22
23
  G as Breadcrumb,
23
- Qs as BsideTemplate,
24
- g as Button,
24
+ Qe as BsideTemplate,
25
+ c as Button,
25
26
  Oa as ButtonTab,
26
- fa as Calendar,
27
+ va as Calendar,
27
28
  xa as CalendarCells,
28
29
  t as Card,
29
- As as CenterPage,
30
- D as Checkbox,
30
+ Ae as CenterPage,
31
+ b as Checkbox,
31
32
  Ga as CheckboxCol,
32
33
  o as CircleGraph,
33
- b as ColorInput,
34
+ D as ColorInput,
34
35
  V as ColumnRow,
35
36
  j as Combobox,
36
37
  q as Confirmation,
@@ -51,8 +52,8 @@ export {
51
52
  qa as DockableOverlay,
52
53
  $ as DotsIndicator,
53
54
  aa as Dropdown,
54
- sa as DropdownItem,
55
- ea as DropdownMenu,
55
+ ea as DropdownItem,
56
+ sa as DropdownMenu,
56
57
  za as DynamicDataTable,
57
58
  B as EmailInput,
58
59
  ta as EmptyState,
@@ -61,99 +62,102 @@ export {
61
62
  oa as Form,
62
63
  ra as FormControl,
63
64
  na as FormDescription,
64
- ia as FormField,
65
- la as FormItem,
65
+ la as FormField,
66
+ ia as FormItem,
66
67
  pa as FormLabel,
67
68
  ua as FormMessage,
69
+ Ye as Format,
68
70
  Wa as FormatDate,
69
- ws as FullContainPage,
70
- Us as FullPage,
71
- qs as FullTemplate,
72
- Rs as FullscreenPage,
71
+ we as FullContainPage,
72
+ Ue as FullPage,
73
+ qe as FullTemplate,
74
+ Re as FullscreenPage,
73
75
  Ja as HeaderCol,
74
76
  F as HiddenInput,
75
- T as Icon,
77
+ g as Icon,
76
78
  R as Icons,
77
- Is as InlineNavigation,
79
+ Ze as ImageScaler,
80
+ Ie as InlineNavigation,
78
81
  _a as InlineOverlay,
79
82
  M as Input,
80
83
  n as Legend,
81
- c as LoadingButton,
82
- zs as MainColumn,
83
- Ss as MainLink,
84
- Es as MainSection,
84
+ C as LoadingButton,
85
+ ze as MainColumn,
86
+ Se as MainLink,
87
+ Ee as MainSection,
85
88
  ma as MinusButton,
86
- Bs as MobileNavButton,
87
- Ps as MobileNavWrapper,
89
+ Be as MobileNavButton,
90
+ Pe as MobileNavWrapper,
88
91
  da as Modal,
89
92
  Ha as MonthCalendar,
90
93
  k as MonthInput,
91
- Fs as NavButton,
92
- Ms as NavButtonLink,
93
- ks as Navigation,
94
- Ns as NavigationGroup,
94
+ Fe as NavButton,
95
+ Me as NavButtonLink,
96
+ ke as Navigation,
97
+ Ne as NavigationGroup,
95
98
  Ka as NavigationMenu,
96
- vs as NavigationPopover,
97
- ga as Notification,
98
- Ta as NotificationContainer,
99
+ fe as NavigationPopover,
100
+ ca as Notification,
101
+ ga as NotificationContainer,
99
102
  N as NumberInput,
100
103
  Qa as Overlay,
101
- Os as Page,
104
+ Oe as Page,
102
105
  Xa as Panel,
103
- v as PasswordInput,
104
- ca as PlusButton,
106
+ f as PasswordInput,
107
+ Ca as PlusButton,
105
108
  La as PopOver,
106
- fs as PopupHeader,
107
- i as ProgressBar,
108
- f as Radio,
109
- l as RangeSlider,
110
- Ca as STATUSES,
111
- Da as STATUS_CLASS,
109
+ ve as PopupHeader,
110
+ l as ProgressBar,
111
+ v as Radio,
112
+ i as RangeSlider,
113
+ Ta as STATUSES,
114
+ ba as STATUS_CLASS,
112
115
  Ya as ScrollableDataTable,
113
116
  Za as SearchDropdown,
114
117
  $a as SearchInput,
115
118
  p as Select,
116
- xs as SidebarMenu,
117
- Gs as SidebarMenuPage,
118
- as as SignaturePanel,
119
+ xe as SidebarMenu,
120
+ Ge as SidebarMenuPage,
121
+ ae as SignaturePanel,
119
122
  u as Skeleton,
120
- ba as SplitRow,
123
+ Da as SplitRow,
121
124
  Ia as StaticStatusIndicator,
122
125
  Sa as StatusIndicator,
123
- ys as SubNavigation,
124
- ss as Tab,
125
- es as TabGroup,
126
- ts as TabNavigation,
127
- os as TableHeader,
126
+ ye as SubNavigation,
127
+ ee as Tab,
128
+ se as TabGroup,
129
+ te as TabNavigation,
130
+ oe as TableHeader,
128
131
  x as TelInput,
129
- Js as Template,
132
+ Je as Template,
130
133
  y as Textarea,
131
134
  Ba as ThemeToggle,
132
135
  Pa as TimeFrame,
133
136
  h as TimeInput,
134
137
  Fa as TimePicker,
135
- hs as TitleHeader,
138
+ he as TitleHeader,
136
139
  Ma as Toggle,
137
140
  m as Tooltip,
138
- _s as TopBar,
141
+ _e as TopBar,
139
142
  W as UrlInput,
140
- rs as UserList,
141
- ns as UserListItem,
143
+ re as UserList,
144
+ ne as UserListItem,
142
145
  A as Veil,
143
146
  w as VeilJot,
144
- is as WeekCalendar,
145
- ls as WeekCell,
146
- ps as WeekCells,
147
- us as WeekHeader,
147
+ le as WeekCalendar,
148
+ ie as WeekCell,
149
+ pe as WeekCells,
150
+ ue as WeekHeader,
148
151
  H as WeekInput,
149
152
  Aa as addTime,
150
- ms as calculateWeekNumber,
151
- ds as generateWeeks,
152
- gs as getDateFromWeek,
153
- Ts as getMonthDays,
154
- cs as getNextMonthDays,
153
+ me as calculateWeekNumber,
154
+ $e as createWatcherCallback,
155
+ de as generateWeeks,
156
+ ce as getDateFromWeek,
157
+ ge as getMonthDays,
158
+ Ce as getNextMonthDays,
155
159
  wa as getPosition,
156
- Cs as getPreviousMonthDays,
160
+ Te as getPreviousMonthDays,
157
161
  ka as getStatusClass,
158
162
  Ua as pad
159
163
  };
@@ -4,3 +4,4 @@ export * from "./components/molecules/molecules.js";
4
4
  export * from "./components/organisms/organisms.js";
5
5
  export * from "./components/pages/pages.js";
6
6
  export * from "./components/pages/templates/templates.js";
7
+ export * from "./utils/utils.js";
@@ -0,0 +1,78 @@
1
+ export function createWatcherCallback(watcher: string | object | any[], callBack: Function): any[] | object;
2
+ export namespace Format {
3
+ /**
4
+ * Formats a number with commas.
5
+ *
6
+ * @param {string|number|object|array} watcher
7
+ * @param {string|null} defaultValue - Value if original is null or undefined.
8
+ * @returns {object|array}
9
+ */
10
+ export function number(watcher: string | number | object | any[], defaultValue?: string | null): object | any[];
11
+ /**
12
+ * Formats a boolean value as a yes/no string.
13
+ *
14
+ * @param {string|number|object|array} watcher
15
+ * @param {string} yes - Text for true values.
16
+ * @param {string} no - Text for false values.
17
+ * @returns {object|array}
18
+ */
19
+ export function yesno(watcher: string | number | object | any[], yes?: string, no?: string): object | any[];
20
+ /**
21
+ * Formats a value as money with two decimals.
22
+ *
23
+ * @param {string|number|object|array} watcher
24
+ * @param {string} currency - Currency symbol.
25
+ * @param {*} defaultValue - Value if original is invalid.
26
+ * @returns {object|array}
27
+ */
28
+ export function money(watcher: string | number | object | any[], currency?: string, defaultValue?: any): object | any[];
29
+ /**
30
+ * Formats a value as a US phone number (10 digits).
31
+ *
32
+ * @param {string|object|array} watcher
33
+ * @param {*} defaultValue - Value if original is invalid.
34
+ * @returns {object|array}
35
+ */
36
+ export function phone(watcher: string | object | any[], defaultValue?: any): object | any[];
37
+ /**
38
+ * Formats a value as an integer (rounds down).
39
+ *
40
+ * @param {string|number|object|array} watcher
41
+ * @param {*} defaultValue - Value if original is invalid.
42
+ * @returns {object|array}
43
+ */
44
+ export function integer(watcher: string | number | object | any[], defaultValue?: any): object | any[];
45
+ /**
46
+ * Formats a date value to a standard date format.
47
+ *
48
+ * @param {string|number|object|array} watcher
49
+ * @param {*} defaultValue - Value if original is invalid.
50
+ * @returns {object|array}
51
+ */
52
+ export function date(watcher: string | number | object | any[], defaultValue?: any): object | any[];
53
+ /**
54
+ * Formats a date and time value to a standard date and time format.
55
+ *
56
+ * @param {string|number|object|array} watcher
57
+ * @param {*} defaultValue - Value if original is invalid.
58
+ * @returns {object|array}
59
+ */
60
+ export function dateTime(watcher: string | number | object | any[], defaultValue?: any): object | any[];
61
+ /**
62
+ * Formats a time value to a standard time format.
63
+ *
64
+ * @param {string|number|object|array} watcher
65
+ * @param {*} defaultValue - Value if original is invalid.
66
+ * @returns {object|array}
67
+ */
68
+ export function time(watcher: string | number | object | any[], defaultValue?: any): object | any[];
69
+ /**
70
+ * Formats a value with a default value if null or undefined.
71
+ *
72
+ * @param {string|number|object|array} watcher
73
+ * @param {string|null} defaultValue - Value if original is null or undefined.
74
+ * @returns {object|array}
75
+ */
76
+ function _default(watcher: string | number | object | any[], defaultValue?: string | null): object | any[];
77
+ export { _default as default };
78
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./format/format.js";
2
+ export * from "./scaling/image-scaler/image-scaler.js";
package/dist/utils.es.js CHANGED
@@ -1 +1,6 @@
1
-
1
+ import { F as r, I as c, c as t } from "./image-scaler-BQ7WdtlV.js";
2
+ export {
3
+ r as Format,
4
+ c as ImageScaler,
5
+ t as createWatcherCallback
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base-framework/ui",
3
- "version": "1.0.200",
3
+ "version": "1.0.202",
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": {