@base-framework/ui 1.2.14 → 1.2.16
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/atoms.es.js +43 -45
- package/dist/bside-template-C7AQgQ6H.js +59 -0
- package/dist/confirmation-DIaNfDm8.js +751 -0
- package/dist/full-page-B0EJ6uzY.js +4573 -0
- package/dist/index.es.js +181 -187
- package/dist/molecules.es.js +47 -47
- package/dist/organisms.es.js +62 -63
- package/dist/pages.es.js +8 -8
- package/dist/{sidebar-menu-Dz2oh95a.js → sidebar-menu-BpgoQxtT.js} +3 -3
- package/dist/{sidebar-menu-page-BImgFKeY.js → sidebar-menu-page-CUihu9QC.js} +14 -15
- package/dist/{signature-panel-h1ranAet.js → signature-panel-Cm15deyP.js} +40 -42
- package/dist/templates.es.js +6 -7
- package/dist/types/components/atoms/buttons/toggle-button.d.ts +4 -1
- package/package.json +1 -1
- package/dist/aside-template-B9V-0xle.js +0 -48
- package/dist/bside-template-oLChzjxQ.js +0 -17
- package/dist/buttons-C-_NH7ie.js +0 -254
- package/dist/empty-state-Bpuw_-Rm.js +0 -2151
- package/dist/full-page-CgVI1G7F.js +0 -69
- package/dist/image-XjAp5NjV.js +0 -255
- package/dist/mobile-nav-wrapper-C7cKTxaV.js +0 -499
- package/dist/simple-search-input-DBNmoBCn.js +0 -1730
- package/dist/tooltip-BG73cjI2.js +0 -404
|
@@ -0,0 +1,751 @@
|
|
|
1
|
+
import { Component as c, Html as m, Dom as y, base as w, Data as T, Builder as b, DateTime as g } from "@base-framework/base";
|
|
2
|
+
import { Li as v, Span as u, Div as r, Ul as D, Button as S, I as x, OnState as B, Time as Y } from "@base-framework/atoms";
|
|
3
|
+
import { ar as k, b0 as C, f as h, al as N, F as O } from "./full-page-B0EJ6uzY.js";
|
|
4
|
+
import { List as F, DynamicTime as E } from "@base-framework/organisms";
|
|
5
|
+
class X extends c {
|
|
6
|
+
/**
|
|
7
|
+
* This will declare the props for the compiler.
|
|
8
|
+
*
|
|
9
|
+
* @returns {void}
|
|
10
|
+
*/
|
|
11
|
+
declareProps() {
|
|
12
|
+
this.removingClass = "";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* This will remove the component from the DOM after a delay.
|
|
16
|
+
*
|
|
17
|
+
* @returns {void}
|
|
18
|
+
*/
|
|
19
|
+
remove() {
|
|
20
|
+
this.prepareDestroy(), this.removeContext();
|
|
21
|
+
const t = this.panel, s = this.removingClass;
|
|
22
|
+
if (!s) {
|
|
23
|
+
m.removeElement(t);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
y.addClass(t, s), w.on("animationend", t, (o) => m.removeElement(t));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const L = (e) => u({ class: "ml-auto text-xs tracking-widest opacity-60" }, e), M = (e) => u({ class: "flex w-4 h-4", html: e }), P = (e) => u({ class: "flex-auto" }, e), I = (e, t) => v({
|
|
30
|
+
class: "relative flex cursor-pointer hover:bg-muted/50 select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
31
|
+
click: () => t(e)
|
|
32
|
+
}, [
|
|
33
|
+
e.icon && M(e.icon),
|
|
34
|
+
P(e.label),
|
|
35
|
+
e.shortcut && L(e.shortcut)
|
|
36
|
+
]), A = (e, t) => D({ class: "grid gap-2" }, [
|
|
37
|
+
e.map((s) => I(s, t))
|
|
38
|
+
]), U = (e) => r({ class: "w-full z-10" }, [
|
|
39
|
+
r({
|
|
40
|
+
class: "max-h-60 border rounded-md overflow-y-auto p-1 grid gap-2 divide-y divide-border",
|
|
41
|
+
for: ["groups", (t) => A(t, e)]
|
|
42
|
+
})
|
|
43
|
+
]), z = ({ label: e, icon: t, toggleDropdown: s }) => S({
|
|
44
|
+
cache: "button",
|
|
45
|
+
class: `inline-flex items-center justify-between rounded-md border
|
|
46
|
+
px-2 py-2 text-sm font-medium hover:bg-muted
|
|
47
|
+
focus:outline-none transition duration-150 ease-in-out`,
|
|
48
|
+
click: s
|
|
49
|
+
}, [
|
|
50
|
+
e && u(e),
|
|
51
|
+
t && x({ html: t })
|
|
52
|
+
]), $ = ({ onSelect: e }) => r([
|
|
53
|
+
B(
|
|
54
|
+
"open",
|
|
55
|
+
(t, s, o) => t ? new k({
|
|
56
|
+
cache: "dropdown",
|
|
57
|
+
parent: o,
|
|
58
|
+
button: o.button
|
|
59
|
+
}, [
|
|
60
|
+
U(e)
|
|
61
|
+
]) : null
|
|
62
|
+
)
|
|
63
|
+
]);
|
|
64
|
+
class Z extends c {
|
|
65
|
+
/**
|
|
66
|
+
* This will declare the props for the compiler.
|
|
67
|
+
*
|
|
68
|
+
* @returns {void}
|
|
69
|
+
*/
|
|
70
|
+
declareProps() {
|
|
71
|
+
this.label = null, this.icon = null, this.onSelect = null, this.groups = [];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Initializes component data.
|
|
75
|
+
*
|
|
76
|
+
* @returns {Data}
|
|
77
|
+
*/
|
|
78
|
+
setData() {
|
|
79
|
+
return new T({
|
|
80
|
+
groups: this.groups || []
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Initializes the component state.
|
|
85
|
+
*
|
|
86
|
+
* @returns {object}
|
|
87
|
+
*/
|
|
88
|
+
setupStates() {
|
|
89
|
+
return {
|
|
90
|
+
open: !1,
|
|
91
|
+
selectedItem: null
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Toggles the dropdown open state.
|
|
96
|
+
*
|
|
97
|
+
* @returns {void}
|
|
98
|
+
*/
|
|
99
|
+
toggleDropdown() {
|
|
100
|
+
this.state.toggle("open");
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Handles item selection within the dropdown.
|
|
104
|
+
*
|
|
105
|
+
* @param {object} item - The selected item object
|
|
106
|
+
* @returns {void}
|
|
107
|
+
*/
|
|
108
|
+
handleSelect(t) {
|
|
109
|
+
this.state.selectedItem = t, this.state.open = !1, typeof this.onSelect == "function" && this.onSelect(t);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Renders the Dropdown component.
|
|
113
|
+
*
|
|
114
|
+
* @returns {object}
|
|
115
|
+
*/
|
|
116
|
+
render() {
|
|
117
|
+
return r({ class: "relative" }, [
|
|
118
|
+
z({
|
|
119
|
+
label: this.label,
|
|
120
|
+
icon: this.icon,
|
|
121
|
+
toggleDropdown: this.toggleDropdown.bind(this)
|
|
122
|
+
}),
|
|
123
|
+
$({ onSelect: this.handleSelect.bind(this) })
|
|
124
|
+
]);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const H = (e) => b.render(e, app.root);
|
|
128
|
+
class W extends c {
|
|
129
|
+
/**
|
|
130
|
+
* This will declare the props for the compiler.
|
|
131
|
+
*
|
|
132
|
+
* @returns {void}
|
|
133
|
+
*/
|
|
134
|
+
declareProps() {
|
|
135
|
+
this.title = null, this.description = null, this.size = null, this.type = null, this.hidePrimaryButton = !1, this.hideFooter = !1, this.icon = null, this.onSubmit = null, this.onClose = null, this.back = !1;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* This will render the modal component.
|
|
139
|
+
*
|
|
140
|
+
* @returns {object}
|
|
141
|
+
*/
|
|
142
|
+
render() {
|
|
143
|
+
const t = this.getMainClass(), s = this.title || "", o = this.description || null;
|
|
144
|
+
return C(
|
|
145
|
+
{
|
|
146
|
+
class: t,
|
|
147
|
+
title: s,
|
|
148
|
+
description: o,
|
|
149
|
+
options: this.headerOptions(),
|
|
150
|
+
buttons: this.getButtons(),
|
|
151
|
+
hideFooter: this.hideFooter,
|
|
152
|
+
onSubmit: (i) => {
|
|
153
|
+
let n = !0;
|
|
154
|
+
this.onSubmit && (n = this.onSubmit(i)), n !== !1 && this.destroy();
|
|
155
|
+
},
|
|
156
|
+
icon: this.icon,
|
|
157
|
+
back: this.back ?? !1,
|
|
158
|
+
aria: { expanded: ["open"] }
|
|
159
|
+
},
|
|
160
|
+
this.children
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* This will setup the states.
|
|
165
|
+
*
|
|
166
|
+
* @returns {object}
|
|
167
|
+
*/
|
|
168
|
+
setupStates() {
|
|
169
|
+
return {
|
|
170
|
+
open: {
|
|
171
|
+
state: !1,
|
|
172
|
+
callBack: (t) => {
|
|
173
|
+
t || this.destroy();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* This will get the header options.
|
|
180
|
+
*
|
|
181
|
+
* @returns {Array<object>}
|
|
182
|
+
*/
|
|
183
|
+
headerOptions() {
|
|
184
|
+
return [];
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* This will get the buttons for the modal.
|
|
188
|
+
*
|
|
189
|
+
* @returns {array}
|
|
190
|
+
*/
|
|
191
|
+
getButtons() {
|
|
192
|
+
return [
|
|
193
|
+
h({ variant: "outline", click: () => this.destroy() }, "Cancel"),
|
|
194
|
+
this.hidePrimaryButton !== !0 && h({ variant: "primary", type: "submit" }, "Save")
|
|
195
|
+
];
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* This will check if the click was outside the component.
|
|
199
|
+
*
|
|
200
|
+
* @param {object} element
|
|
201
|
+
* @returns {boolean}
|
|
202
|
+
*/
|
|
203
|
+
isOutsideClick(t) {
|
|
204
|
+
return !this.panel.contains(t);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* This will get the size class.
|
|
208
|
+
*
|
|
209
|
+
* @returns {string}
|
|
210
|
+
*/
|
|
211
|
+
getSizeClass() {
|
|
212
|
+
switch (this.size) {
|
|
213
|
+
// case 'sm':
|
|
214
|
+
// return 'sm max-w-[646px]';
|
|
215
|
+
case "lg":
|
|
216
|
+
return "lg max-w-[900px]";
|
|
217
|
+
case "xl":
|
|
218
|
+
return "xl max-w-[1400px]";
|
|
219
|
+
default:
|
|
220
|
+
return "md max-w-[760px]";
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* This will get the type class.
|
|
225
|
+
*
|
|
226
|
+
* @returns {string}
|
|
227
|
+
*/
|
|
228
|
+
getTypeClass() {
|
|
229
|
+
switch (this.type) {
|
|
230
|
+
case "right":
|
|
231
|
+
return "right right-0";
|
|
232
|
+
case "left":
|
|
233
|
+
return "left left-0";
|
|
234
|
+
case "drawer":
|
|
235
|
+
return "drawer";
|
|
236
|
+
default:
|
|
237
|
+
return "";
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* This will get the modal class.
|
|
242
|
+
*
|
|
243
|
+
* @returns {string}
|
|
244
|
+
*/
|
|
245
|
+
getMainClass() {
|
|
246
|
+
return this.getSizeClass() + " " + this.getTypeClass();
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* This will override the set up to use the app shell.
|
|
250
|
+
*
|
|
251
|
+
* @param {object} container
|
|
252
|
+
*/
|
|
253
|
+
setContainer(t) {
|
|
254
|
+
this.container = app.root;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* This will open the modal.
|
|
258
|
+
*
|
|
259
|
+
* @returns {void}
|
|
260
|
+
*/
|
|
261
|
+
open() {
|
|
262
|
+
H(this), this.showModal();
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* This will destroy the modal.
|
|
266
|
+
*
|
|
267
|
+
* @returns {void}
|
|
268
|
+
*/
|
|
269
|
+
close() {
|
|
270
|
+
this.destroy();
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* This will show the modal.
|
|
274
|
+
*
|
|
275
|
+
* @protected
|
|
276
|
+
* @returns {void}
|
|
277
|
+
*/
|
|
278
|
+
showModal() {
|
|
279
|
+
globalThis.setTimeout(() => this.panel.showPopover(), 10), this.state.open = !0, document.documentElement.style.overflowY = "hidden";
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* This will hide the modal.
|
|
283
|
+
*
|
|
284
|
+
* @protected
|
|
285
|
+
* @returns {void}
|
|
286
|
+
*/
|
|
287
|
+
beforeDestroy() {
|
|
288
|
+
this?.panel?.hidePopover(), this.state.open = !1, typeof this.onClose == "function" && this.onClose(this), document.documentElement.style.overflowY = "auto";
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
class G {
|
|
292
|
+
/**
|
|
293
|
+
* Creates an instance of DrawerGesture.
|
|
294
|
+
*
|
|
295
|
+
* @param {object} [options={}]
|
|
296
|
+
* @param {HTMLElement} [options.modal=null] - The modal element (panel) reference
|
|
297
|
+
* @param {HTMLElement} [options.modalContent=null] - The modal content element reference
|
|
298
|
+
* @param {HTMLElement} [options.modalBody=null] - The scrollable body element reference
|
|
299
|
+
* @param {number} [options.closeThreshold=150] - Pixels to drag before closing
|
|
300
|
+
* @param {number} [options.snapThreshold=50] - Pixels to drag before snapping
|
|
301
|
+
* @param {Function} [options.onClose=null] - Callback when drawer should close
|
|
302
|
+
*/
|
|
303
|
+
constructor(t = {}) {
|
|
304
|
+
const {
|
|
305
|
+
modal: s = null,
|
|
306
|
+
modalContent: o = null,
|
|
307
|
+
modalBody: i = null,
|
|
308
|
+
closeThreshold: n = 150,
|
|
309
|
+
snapThreshold: a = 50,
|
|
310
|
+
onClose: p = null
|
|
311
|
+
} = t;
|
|
312
|
+
this.modal = s, this.modalContent = o, this.modalBody = i, this.closeThreshold = n, this.snapThreshold = a, this.onClose = p, this.reset();
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Resets the drag state to initial values
|
|
316
|
+
*
|
|
317
|
+
* @returns {void}
|
|
318
|
+
*/
|
|
319
|
+
reset() {
|
|
320
|
+
this.state = {
|
|
321
|
+
isDragging: !1,
|
|
322
|
+
startY: 0,
|
|
323
|
+
currentY: 0,
|
|
324
|
+
startScrollTop: 0,
|
|
325
|
+
canDrag: !1
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Checks if the viewport is mobile size
|
|
330
|
+
*
|
|
331
|
+
* @returns {boolean}
|
|
332
|
+
*/
|
|
333
|
+
isMobile() {
|
|
334
|
+
return window.innerWidth < 1024;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Handles touch start event
|
|
338
|
+
*
|
|
339
|
+
* @param {TouchEvent} e - The touch event
|
|
340
|
+
* @returns {void}
|
|
341
|
+
*/
|
|
342
|
+
handleTouchStart(t) {
|
|
343
|
+
if (!this.modalBody)
|
|
344
|
+
return;
|
|
345
|
+
const s = t.touches[0];
|
|
346
|
+
this.state.startY = s.clientY, this.state.currentY = s.clientY, this.state.startScrollTop = this.modalBody.scrollTop, this.state.canDrag = this.modalBody.scrollTop === 0;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Handles touch move event
|
|
350
|
+
*
|
|
351
|
+
* @param {TouchEvent} e - The touch event
|
|
352
|
+
* @returns {void}
|
|
353
|
+
*/
|
|
354
|
+
handleTouchMove(t) {
|
|
355
|
+
if (!this.modalContent || !this.modalBody)
|
|
356
|
+
return;
|
|
357
|
+
const s = t.touches[0];
|
|
358
|
+
this.state.currentY = s.clientY;
|
|
359
|
+
const o = this.getDeltaY();
|
|
360
|
+
if (!this.state.isDragging && this.state.canDrag && o > 0 && this.modalBody.scrollTop === 0 && (this.state.isDragging = !0), this.state.isDragging && o > 0) {
|
|
361
|
+
t.preventDefault();
|
|
362
|
+
const i = this.calculateTranslateY(o);
|
|
363
|
+
this.modalContent.style.transform = `translateY(${i}px)`, this.modalContent.style.transition = "none";
|
|
364
|
+
const n = this.calculateBackdropOpacity(o);
|
|
365
|
+
this.updateBackdropOpacity(n);
|
|
366
|
+
} else this.modalBody.scrollTop > 0 && (this.state.canDrag = !1);
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Handles touch end event
|
|
370
|
+
*
|
|
371
|
+
* @param {TouchEvent} e - The touch event
|
|
372
|
+
* @returns {void}
|
|
373
|
+
*/
|
|
374
|
+
handleTouchEnd(t) {
|
|
375
|
+
if (!this.modalContent)
|
|
376
|
+
return;
|
|
377
|
+
const s = this.getDeltaY();
|
|
378
|
+
this.state.isDragging && (this.modalContent.style.transition = "transform 0.3s ease-out, opacity 0.3s ease-out", s > this.closeThreshold ? this.animateClose() : this.snapBack()), this.state.isDragging = !1, this.state.canDrag = !1;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Gets current drag delta Y
|
|
382
|
+
*
|
|
383
|
+
* @returns {number} The vertical drag distance in pixels
|
|
384
|
+
*/
|
|
385
|
+
getDeltaY() {
|
|
386
|
+
return this.state.currentY - this.state.startY;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Calculates translateY with rubber band damping effect.
|
|
390
|
+
* The further you drag, the more resistance is applied.
|
|
391
|
+
*
|
|
392
|
+
* @param {number} deltaY - The raw drag distance
|
|
393
|
+
* @returns {number} The damped translation distance
|
|
394
|
+
*/
|
|
395
|
+
calculateTranslateY(t) {
|
|
396
|
+
const s = 1 - t / (window.innerHeight * 2);
|
|
397
|
+
return t * Math.max(s, 0.5);
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Calculates backdrop opacity based on drag distance.
|
|
401
|
+
* Opacity decreases as the drawer is dragged down.
|
|
402
|
+
*
|
|
403
|
+
* @param {number} deltaY - The drag distance
|
|
404
|
+
* @returns {number} Opacity value between 0 and 1
|
|
405
|
+
*/
|
|
406
|
+
calculateBackdropOpacity(t) {
|
|
407
|
+
return Math.max(0, 1 - t / this.closeThreshold);
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Updates the backdrop opacity via CSS custom property
|
|
411
|
+
*
|
|
412
|
+
* @param {number} opacity - The opacity value (0-1)
|
|
413
|
+
* @returns {void}
|
|
414
|
+
*/
|
|
415
|
+
updateBackdropOpacity(t) {
|
|
416
|
+
this.modal && this.modal.style.setProperty("--backdrop-opacity", t.toString());
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Animates the drawer closing by translating the entire modal off-screen
|
|
420
|
+
*
|
|
421
|
+
* @returns {void}
|
|
422
|
+
*/
|
|
423
|
+
animateClose() {
|
|
424
|
+
!this.modal || !this.modalContent || (this.modalContent.style.transform = "translateY(0)", this.modalContent.style.transition = "none", this.modal.style.transition = "transform 0.3s ease-out, opacity 0.3s ease-out", this.modal.style.transform = "translateY(100%)", this.updateBackdropOpacity(0), setTimeout(() => {
|
|
425
|
+
this.onClose && this.onClose();
|
|
426
|
+
}, 300));
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Snaps the drawer back to its original position
|
|
430
|
+
*
|
|
431
|
+
* @returns {void}
|
|
432
|
+
*/
|
|
433
|
+
snapBack() {
|
|
434
|
+
this.modalContent && (this.modalContent.style.transform = "translateY(0)", this.updateBackdropOpacity(1));
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Checks if currently dragging
|
|
438
|
+
*
|
|
439
|
+
* @returns {boolean}
|
|
440
|
+
*/
|
|
441
|
+
isDragging() {
|
|
442
|
+
return this.state.isDragging;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Cleans up resources and resets state
|
|
446
|
+
*
|
|
447
|
+
* @returns {void}
|
|
448
|
+
*/
|
|
449
|
+
destroy() {
|
|
450
|
+
this.reset(), this.modal = null, this.onClose = null;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
class tt extends W {
|
|
454
|
+
/**
|
|
455
|
+
* Declares the component props
|
|
456
|
+
*
|
|
457
|
+
* @returns {void}
|
|
458
|
+
*/
|
|
459
|
+
declareProps() {
|
|
460
|
+
super.declareProps(), this.type = "drawer", this.swipeToClose = !0, this.closeThreshold = 150, this.snapThreshold = 50, this.gesture = null, this.modalContent = null, this.modalBody = null;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Gets extra props to pass to ModalContainer
|
|
464
|
+
*
|
|
465
|
+
* @returns {object}
|
|
466
|
+
*/
|
|
467
|
+
getContainerProps() {
|
|
468
|
+
const t = {};
|
|
469
|
+
return this.swipeToClose && (t.gestureHandlers = this.getGestureHandlers()), t;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Renders the drawer with gesture handlers
|
|
473
|
+
*
|
|
474
|
+
* @returns {object}
|
|
475
|
+
*/
|
|
476
|
+
render() {
|
|
477
|
+
const t = this.getMainClass(), s = this.title || "", o = this.description || null, i = this.getContainerProps();
|
|
478
|
+
return C(
|
|
479
|
+
{
|
|
480
|
+
class: t,
|
|
481
|
+
title: s,
|
|
482
|
+
description: o,
|
|
483
|
+
options: this.headerOptions(),
|
|
484
|
+
buttons: this.getButtons(),
|
|
485
|
+
hideFooter: this.hideFooter,
|
|
486
|
+
onSubmit: (n) => {
|
|
487
|
+
let a = !0;
|
|
488
|
+
this.onSubmit && (a = this.onSubmit(n)), a !== !1 && this.destroy();
|
|
489
|
+
},
|
|
490
|
+
icon: this.icon,
|
|
491
|
+
back: this.back ?? !1,
|
|
492
|
+
aria: { expanded: ["open"] },
|
|
493
|
+
...i
|
|
494
|
+
},
|
|
495
|
+
this.children
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Shows the modal and initializes gesture handling
|
|
500
|
+
*
|
|
501
|
+
* @protected
|
|
502
|
+
* @returns {void}
|
|
503
|
+
*/
|
|
504
|
+
showModal() {
|
|
505
|
+
super.showModal(), this.swipeToClose && !this.gesture && (this.gesture = new G({
|
|
506
|
+
// @ts-ignore
|
|
507
|
+
modal: this.panel,
|
|
508
|
+
// @ts-ignore
|
|
509
|
+
modalContent: this.modalContent,
|
|
510
|
+
// @ts-ignore
|
|
511
|
+
modalBody: this.modalBody,
|
|
512
|
+
closeThreshold: this.closeThreshold,
|
|
513
|
+
snapThreshold: this.snapThreshold,
|
|
514
|
+
onClose: () => this.destroy()
|
|
515
|
+
}));
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Gets gesture event handlers for modal content.
|
|
519
|
+
* Returns event props to be spread onto the modal-content element.
|
|
520
|
+
* Handlers are bound methods that will work once gesture is initialized.
|
|
521
|
+
*
|
|
522
|
+
* @returns {object}
|
|
523
|
+
*/
|
|
524
|
+
getGestureHandlers() {
|
|
525
|
+
return this.swipeToClose ? {
|
|
526
|
+
touchstart: (t) => this.gesture?.handleTouchStart(t),
|
|
527
|
+
touchmove: (t) => this.gesture?.handleTouchMove(t),
|
|
528
|
+
touchend: (t) => this.gesture?.handleTouchEnd(t)
|
|
529
|
+
} : {};
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Cleans up before destroy
|
|
533
|
+
*
|
|
534
|
+
* @protected
|
|
535
|
+
* @returns {void}
|
|
536
|
+
*/
|
|
537
|
+
beforeDestroy() {
|
|
538
|
+
this.gesture && (this.gesture.destroy(), this.gesture = null), super.beforeDestroy();
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
let _ = 0;
|
|
542
|
+
class et extends c {
|
|
543
|
+
/**
|
|
544
|
+
* This will render the component.
|
|
545
|
+
*
|
|
546
|
+
* @returns {object}
|
|
547
|
+
*/
|
|
548
|
+
render() {
|
|
549
|
+
return r({ class: "notification-container pointer-events-none inset-auto bg-transparent backdrop:bg-transparent overflow-visible fixed bottom-[80px] right-0 z-50 p-5", popover: "manual" }, [
|
|
550
|
+
new F({
|
|
551
|
+
cache: "list",
|
|
552
|
+
key: "id",
|
|
553
|
+
role: "list",
|
|
554
|
+
rowItem: (t) => new N(t)
|
|
555
|
+
})
|
|
556
|
+
]);
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* This will add a notification.
|
|
560
|
+
*
|
|
561
|
+
* @param {object} props
|
|
562
|
+
* @returns {void}
|
|
563
|
+
*/
|
|
564
|
+
addNotice(t = {}) {
|
|
565
|
+
t.id = _++, t.callBack = () => this.removeNotice(t), this?.list?.append([t]), this?.panel?.hidePopover(), this?.panel?.showPopover();
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* This will remove a notification.
|
|
569
|
+
*
|
|
570
|
+
* @param {object} notice
|
|
571
|
+
* @returns {void}
|
|
572
|
+
*/
|
|
573
|
+
removeNotice(t) {
|
|
574
|
+
this?.list?.delete(t.id), this?.list?.isEmpty() && this?.panel?.hidePopover();
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
const d = {
|
|
578
|
+
ONLINE: "online",
|
|
579
|
+
OFFLINE: "offline",
|
|
580
|
+
BUSY: "busy",
|
|
581
|
+
AWAY: "away"
|
|
582
|
+
}, l = {
|
|
583
|
+
ONLINE: "bg-green-500",
|
|
584
|
+
OFFLINE: "bg-gray-500",
|
|
585
|
+
BUSY: "bg-red-500",
|
|
586
|
+
AWAY: "bg-yellow-500"
|
|
587
|
+
}, j = (e = "") => (e = e.toUpperCase(), l[e] || l.OFFLINE), st = (e) => r({
|
|
588
|
+
class: `absolute bottom-0 right-0 w-3 h-3 border-2 rounded-full ${j(e)}`
|
|
589
|
+
}), ot = ({ propName: e = "status" } = {}) => r({
|
|
590
|
+
class: "absolute bottom-0 right-0 w-3 h-3 border-2 rounded-full",
|
|
591
|
+
onSet: [e, {
|
|
592
|
+
[l.ONLINE]: d.ONLINE,
|
|
593
|
+
[l.OFFLINE]: d.OFFLINE,
|
|
594
|
+
[l.BUSY]: d.BUSY,
|
|
595
|
+
[l.AWAY]: d.AWAY
|
|
596
|
+
}]
|
|
597
|
+
}), it = ({ dateTime: e = "", remoteTimeZone: t = "America/Denver", filter: s = null }) => Y([
|
|
598
|
+
new E({
|
|
599
|
+
dateTime: e,
|
|
600
|
+
filter: s || ((o) => {
|
|
601
|
+
const i = g.getLocalTime(o, !0, !1, t);
|
|
602
|
+
return g.getTimeFrame(i);
|
|
603
|
+
})
|
|
604
|
+
})
|
|
605
|
+
]), q = (e) => b.render(e, app.root), f = {
|
|
606
|
+
info: {
|
|
607
|
+
borderColor: "border-blue-500",
|
|
608
|
+
bgColor: "bg-muted/10",
|
|
609
|
+
iconColor: "text-blue-500"
|
|
610
|
+
},
|
|
611
|
+
warning: {
|
|
612
|
+
bgColor: "bg-muted/10",
|
|
613
|
+
borderColor: "border-warning",
|
|
614
|
+
iconColor: "text-warning"
|
|
615
|
+
},
|
|
616
|
+
destructive: {
|
|
617
|
+
bgColor: "bg-muted/10",
|
|
618
|
+
borderColor: "border-destructive",
|
|
619
|
+
iconColor: "text-red-500"
|
|
620
|
+
},
|
|
621
|
+
success: {
|
|
622
|
+
bgColor: "bg-muted/10",
|
|
623
|
+
borderColor: "border-emerald-500",
|
|
624
|
+
iconColor: "text-emerald-500"
|
|
625
|
+
},
|
|
626
|
+
default: {
|
|
627
|
+
borderColor: "border",
|
|
628
|
+
bgColor: "bg-muted/10",
|
|
629
|
+
iconColor: "text-muted-foreground"
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
class J extends c {
|
|
633
|
+
/**
|
|
634
|
+
* This will declare the props for the compiler.
|
|
635
|
+
*
|
|
636
|
+
* @returns {void}
|
|
637
|
+
*/
|
|
638
|
+
declareProps() {
|
|
639
|
+
this.title = null, this.description = null, this.type = "", this.icon = null, this.onClose = null, this.hideFooter = !1, this.buttons = null;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* This will render the modal component.
|
|
643
|
+
*
|
|
644
|
+
* @returns {object}
|
|
645
|
+
*/
|
|
646
|
+
render() {
|
|
647
|
+
const t = (p) => {
|
|
648
|
+
p.target === this.panel && this.close();
|
|
649
|
+
}, { borderColor: s, bgColor: o, iconColor: i } = f[this.type] || f.default, n = `${this.getMainClass()} ${o} ${s}`, a = this.title || "Dialog Title";
|
|
650
|
+
return O({
|
|
651
|
+
class: n,
|
|
652
|
+
title: a,
|
|
653
|
+
click: t,
|
|
654
|
+
icon: this.icon,
|
|
655
|
+
iconColor: i,
|
|
656
|
+
description: this.description,
|
|
657
|
+
buttons: this.getButtons()
|
|
658
|
+
}, this.children);
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* This will get the buttons for the modal.
|
|
662
|
+
*
|
|
663
|
+
* @returns {array|null}
|
|
664
|
+
*/
|
|
665
|
+
getButtons() {
|
|
666
|
+
return this.hideFooter ? null : this.buttons ? this.buttons : [
|
|
667
|
+
h({ variant: "outline", click: () => this.close() }, "Close")
|
|
668
|
+
];
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* This will setup the states.
|
|
672
|
+
*
|
|
673
|
+
* @returns {object}
|
|
674
|
+
*/
|
|
675
|
+
setupStates() {
|
|
676
|
+
return {
|
|
677
|
+
open: !1
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* This will get the modal class.
|
|
682
|
+
*
|
|
683
|
+
* @returns {string}
|
|
684
|
+
*/
|
|
685
|
+
getMainClass() {
|
|
686
|
+
return "";
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* This will open the modal.
|
|
690
|
+
*
|
|
691
|
+
* @returns {void}
|
|
692
|
+
*/
|
|
693
|
+
open() {
|
|
694
|
+
q(this), this.panel.showModal(), this.state.open = !0;
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* This will close the modal.
|
|
698
|
+
*
|
|
699
|
+
* @returns {void}
|
|
700
|
+
*/
|
|
701
|
+
close() {
|
|
702
|
+
this.state.open = !1, this.panel.close(), typeof this.onClose == "function" && this.onClose(), this.destroy();
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
class nt extends J {
|
|
706
|
+
/**
|
|
707
|
+
* This will declare the props for the compiler.
|
|
708
|
+
*
|
|
709
|
+
* @returns {void}
|
|
710
|
+
*/
|
|
711
|
+
declareProps() {
|
|
712
|
+
this.confirmTextLabel = null, this.confirmed = null;
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* This will get the buttons for the modal.
|
|
716
|
+
*
|
|
717
|
+
* @returns {array}
|
|
718
|
+
*/
|
|
719
|
+
getButtons() {
|
|
720
|
+
const t = this.confirmTextLabel || "Confirm";
|
|
721
|
+
return [
|
|
722
|
+
h({ variant: "outline", click: () => this.close() }, "Cancel"),
|
|
723
|
+
h({ variant: "primary", click: () => this.confirm() }, t)
|
|
724
|
+
];
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* This will confirm the action.
|
|
728
|
+
*
|
|
729
|
+
* @returns {void}
|
|
730
|
+
*/
|
|
731
|
+
confirm() {
|
|
732
|
+
this.confirmed && this.confirmed(), this.close();
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
export {
|
|
736
|
+
nt as C,
|
|
737
|
+
X as D,
|
|
738
|
+
W as M,
|
|
739
|
+
et as N,
|
|
740
|
+
d as S,
|
|
741
|
+
it as T,
|
|
742
|
+
J as a,
|
|
743
|
+
tt as b,
|
|
744
|
+
U as c,
|
|
745
|
+
I as d,
|
|
746
|
+
Z as e,
|
|
747
|
+
l as f,
|
|
748
|
+
st as g,
|
|
749
|
+
ot as h,
|
|
750
|
+
j as i
|
|
751
|
+
};
|