@base-framework/ui 1.0.2023 → 1.0.2025

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -4,7 +4,7 @@ import { C as T, F as b } from "./form-group-BB7dLJir.js";
4
4
  import { C as D, d as S, D as F, c as B, E as P, F as k, H as M, I as x, M as f, N as v, P as N, R as y, T as h, a as U, b as L, U as W, W as w } from "./inputs-9udyzkHR.js";
5
5
  import { I as R, V as A, a as G } from "./image-BB__4s0g.js";
6
6
  import { Icons as E } from "./icons.es.js";
7
- import { A as j, B as q, C as J, x as z, O as K, z as Q, E as _, G as X, H as Y, D as Z, m as $, n as aa, R as ea, Q as sa, w as oa, o as ta, c as ra, a as na, b as la, U as ia, l as pa, g as ma, i as da, h as ua, j as ga, e as Ca, k as ca, F as Ta, d as ba, f as Ia, I as Da, L as Sa, y as Fa, M as Ba, p as Pa, N as ka, P as Ma, t as xa, u as fa, S as va, r as Na, s as ya, T as ha, J as Ua, K as La, q as Wa, v as wa } from "./empty-state-BJJ3lWNv.js";
7
+ import { A as j, B as q, C as J, x as z, O as K, z as Q, E as _, G as X, H as Y, D as Z, m as $, n as aa, R as ea, Q as sa, w as oa, o as ta, c as ra, a as na, b as la, U as ia, l as pa, g as ma, i as da, h as ua, j as ga, e as Ca, k as ca, F as Ta, d as ba, f as Ia, I as Da, L as Sa, y as Fa, M as Ba, p as Pa, N as ka, P as Ma, t as xa, u as fa, S as va, r as Na, s as ya, T as ha, J as Ua, K as La, q as Wa, v as wa } from "./empty-state-CpNRoBnH.js";
8
8
  import { A as Ra, b as Aa, C as Ga, D as Oa, a as Ea, F as Va, M as ja, P as qa, R as Ja, c as za, g as Ka, p as Qa } from "./range-calendar-6CLMTieN.js";
9
9
  import { B as Xa, p as Ya, C as Za, j as $a, D as ae, m as ee, k as se, H as oe, I as te, N as re, O as ne, P as le, S as ie, n as pe, o as me, x as de, s as ue, q as ge, r as Ce, T as ce, t as Te, w as be, u as Ie, v as De, l as Se, U as Fe, W as Be, f as Pe, h as ke, i as Me, c as xe, d as fe, b as ve, e as Ne, a as ye, g as he } from "./signature-panel-JSfsTsVc.js";
10
10
  import { B as Le, I as We, M as we, d as He, e as Re, g as Ae, N as Ge, b as Oe, a as Ee, f as Ve, P as je, c as qe, S as Je, T as ze } from "./mobile-nav-wrapper-Dm9DinRD.js";
@@ -1,4 +1,4 @@
1
- import { A as s, B as t, C as r, x as e, O as i, z as n, E as m, G as l, H as d, D as C, m as p, n as D, R as S, Q as g, w as u, o as c, c as F, a as T, b as P, U as w, l as A, g as I, i as f, h as b, j as y, e as B, k as M, F as U, d as k, f as x, I as L, L as R, y as v, M as E, p as N, N as h, P as G, t as O, u as j, S as q, r as z, s as H, T as J, J as K, K as Q, q as _, v as V } from "./empty-state-BJJ3lWNv.js";
1
+ import { A as s, B as t, C as r, x as e, O as i, z as n, E as m, G as l, H as d, D as C, m as p, n as D, R as S, Q as g, w as u, o as c, c as F, a as T, b as P, U as w, l as A, g as I, i as f, h as b, j as y, e as B, k as M, F as U, d as k, f as x, I as L, L as R, y as v, M as E, p as N, N as h, P as G, t as O, u as j, S as q, r as z, s as H, T as J, J as K, K as Q, q as _, v as V } from "./empty-state-CpNRoBnH.js";
2
2
  import { A as X, P as Y, g as Z } from "./range-calendar-6CLMTieN.js";
3
3
  export {
4
4
  s as Alert,
@@ -0,0 +1,135 @@
1
+ /**
2
+ * DrawerGesture
3
+ *
4
+ * Manages touch gesture tracking for drawer components.
5
+ * Handles drag state, velocity thresholds, and swipe-to-close behavior.
6
+ *
7
+ * This class provides methods for:
8
+ * - Tracking touch start/move/end events
9
+ * - Calculating drag deltas with rubber-band damping
10
+ * - Determining when to close or snap back the drawer
11
+ * - Managing backdrop opacity during drag
12
+ *
13
+ * @export
14
+ * @class DrawerGesture
15
+ */
16
+ export class DrawerGesture {
17
+ /**
18
+ * Creates an instance of DrawerGesture.
19
+ *
20
+ * @param {object} [options={}]
21
+ * @param {HTMLElement} [options.modal=null] - The modal element (panel) reference
22
+ * @param {HTMLElement} [options.modalContent=null] - The modal content element reference
23
+ * @param {HTMLElement} [options.modalBody=null] - The scrollable body element reference
24
+ * @param {number} [options.closeThreshold=150] - Pixels to drag before closing
25
+ * @param {number} [options.snapThreshold=50] - Pixels to drag before snapping
26
+ * @param {Function} [options.onClose=null] - Callback when drawer should close
27
+ */
28
+ constructor(options?: {
29
+ modal?: HTMLElement;
30
+ modalContent?: HTMLElement;
31
+ modalBody?: HTMLElement;
32
+ closeThreshold?: number;
33
+ snapThreshold?: number;
34
+ onClose?: Function;
35
+ });
36
+ modal: HTMLElement;
37
+ modalContent: HTMLElement;
38
+ modalBody: HTMLElement;
39
+ closeThreshold: number;
40
+ snapThreshold: number;
41
+ onClose: Function;
42
+ /**
43
+ * Resets the drag state to initial values
44
+ *
45
+ * @returns {void}
46
+ */
47
+ reset(): void;
48
+ state: {
49
+ isDragging: boolean;
50
+ startY: number;
51
+ currentY: number;
52
+ startScrollTop: number;
53
+ canDrag: boolean;
54
+ };
55
+ /**
56
+ * Checks if the viewport is mobile size
57
+ *
58
+ * @returns {boolean}
59
+ */
60
+ isMobile(): boolean;
61
+ /**
62
+ * Handles touch start event
63
+ *
64
+ * @param {TouchEvent} e - The touch event
65
+ * @returns {void}
66
+ */
67
+ handleTouchStart(e: TouchEvent): void;
68
+ /**
69
+ * Handles touch move event
70
+ *
71
+ * @param {TouchEvent} e - The touch event
72
+ * @returns {void}
73
+ */
74
+ handleTouchMove(e: TouchEvent): void;
75
+ /**
76
+ * Handles touch end event
77
+ *
78
+ * @param {TouchEvent} e - The touch event
79
+ * @returns {void}
80
+ */
81
+ handleTouchEnd(e: TouchEvent): void;
82
+ /**
83
+ * Gets current drag delta Y
84
+ *
85
+ * @returns {number} The vertical drag distance in pixels
86
+ */
87
+ getDeltaY(): number;
88
+ /**
89
+ * Calculates translateY with rubber band damping effect.
90
+ * The further you drag, the more resistance is applied.
91
+ *
92
+ * @param {number} deltaY - The raw drag distance
93
+ * @returns {number} The damped translation distance
94
+ */
95
+ calculateTranslateY(deltaY: number): number;
96
+ /**
97
+ * Calculates backdrop opacity based on drag distance.
98
+ * Opacity decreases as the drawer is dragged down.
99
+ *
100
+ * @param {number} deltaY - The drag distance
101
+ * @returns {number} Opacity value between 0 and 1
102
+ */
103
+ calculateBackdropOpacity(deltaY: number): number;
104
+ /**
105
+ * Updates the backdrop opacity via CSS custom property
106
+ *
107
+ * @param {number} opacity - The opacity value (0-1)
108
+ * @returns {void}
109
+ */
110
+ updateBackdropOpacity(opacity: number): void;
111
+ /**
112
+ * Animates the drawer closing by translating it off-screen
113
+ *
114
+ * @returns {void}
115
+ */
116
+ animateClose(): void;
117
+ /**
118
+ * Snaps the drawer back to its original position
119
+ *
120
+ * @returns {void}
121
+ */
122
+ snapBack(): void;
123
+ /**
124
+ * Checks if currently dragging
125
+ *
126
+ * @returns {boolean}
127
+ */
128
+ isDragging(): boolean;
129
+ /**
130
+ * Cleans up resources and resets state
131
+ *
132
+ * @returns {void}
133
+ */
134
+ destroy(): void;
135
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Drawer
3
+ *
4
+ * A mobile-first drawer component that slides up from the bottom on mobile
5
+ * and appears as a centered modal on desktop. Supports swipe-to-close gestures.
6
+ *
7
+ * Extends the Modal component with:
8
+ * - Mobile-optimized slide-up animation
9
+ * - Touch gesture support for swipe-to-close
10
+ * - Rubber-band drag effect
11
+ * - Adaptive behavior (drawer on mobile, modal on desktop)
12
+ *
13
+ * @export
14
+ * @class Drawer
15
+ * @extends {Modal}
16
+ */
17
+ export class Drawer extends Modal {
18
+ /**
19
+ * Enables swipe-to-close gesture on mobile
20
+ * @type {boolean}
21
+ * @default true
22
+ */
23
+ swipeToClose: boolean;
24
+ /**
25
+ * Pixels to drag before closing (mobile only)
26
+ * @type {number}
27
+ * @default 150
28
+ */
29
+ closeThreshold: number;
30
+ /**
31
+ * Pixels to drag before snapping behavior kicks in
32
+ * @type {number}
33
+ * @default 50
34
+ */
35
+ snapThreshold: number;
36
+ /**
37
+ * DrawerGesture instance for handling touch events
38
+ * @type {DrawerGesture|null}
39
+ * @private
40
+ */
41
+ private gesture;
42
+ /**
43
+ * Cached reference to modal content element (set via cache property)
44
+ * @type {HTMLElement|null}
45
+ */
46
+ modalContent: HTMLElement | null;
47
+ /**
48
+ * Cached reference to modal body element (set via cache property)
49
+ * @type {HTMLElement|null}
50
+ */
51
+ modalBody: HTMLElement | null;
52
+ /**
53
+ * Gets extra props to pass to ModalContainer
54
+ *
55
+ * @returns {object}
56
+ */
57
+ getContainerProps(): object;
58
+ /**
59
+ * Gets gesture event handlers for modal content.
60
+ * Returns event props to be spread onto the modal-content element.
61
+ *
62
+ * @returns {object}
63
+ */
64
+ getGestureHandlers(): object;
65
+ }
66
+ import { Modal } from '../modal.js';
@@ -0,0 +1,2 @@
1
+ export { DrawerGesture } from "./drawer-gesture.js";
2
+ export { Drawer } from "./drawer.js";
@@ -1,8 +1,21 @@
1
1
  /**
2
- * This will create a dialog component.
2
+ * ModalContainer
3
3
  *
4
- * @param {object} props
5
- * @param {array} children
4
+ * Creates a container for modal/drawer components with header, body, and footer.
5
+ * Handles popover behavior, form submission, and backdrop clicks.
6
+ *
7
+ * @param {object} props - Component properties
8
+ * @param {string} [props.class] - Additional CSS classes
9
+ * @param {string} props.title - Modal title
10
+ * @param {string} [props.description] - Optional description
11
+ * @param {boolean} [props.back=false] - Show back button on mobile
12
+ * @param {string} [props.icon] - Icon to display in header
13
+ * @param {Array} [props.options=[]] - Header action buttons
14
+ * @param {Array} [props.buttons=[]] - Footer buttons
15
+ * @param {boolean} [props.hideFooter=false] - Hide footer section
16
+ * @param {Function} [props.onSubmit] - Form submission handler
17
+ * @param {object} [props.gestureHandlers] - Touch gesture handlers for drawer
18
+ * @param {Array} children - Modal body content
6
19
  * @returns {object}
7
20
  */
8
21
  export const ModalContainer: Function;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * ModalHeader
3
+ *
4
+ * Renders a header for modal/drawer components with title, description,
5
+ * optional back button (mobile), icon, and action buttons.
6
+ *
7
+ * @param {object} props
8
+ * @param {string} props.title - The modal title
9
+ * @param {string} [props.description] - Optional description text
10
+ * @param {boolean} [props.back=false] - Show back button on mobile
11
+ * @param {string} [props.icon] - SVG icon string to display
12
+ * @param {Array} [props.options=[]] - Array of action buttons/elements
13
+ * @returns {object}
14
+ */
15
+ export const ModalHeader: Function;
@@ -9,7 +9,7 @@ export * from "./form/form-control.js";
9
9
  export * from "./form/form-field.js";
10
10
  export * from "./form/form.js";
11
11
  export * from "./modals/atoms.js";
12
- export * from "./modals/drawer.js";
12
+ export * from "./modals/drawer/drawer.js";
13
13
  export * from "./modals/modal.js";
14
14
  export * from "./notifications/notification-container.js";
15
15
  export * from "./notifications/notification.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base-framework/ui",
3
- "version": "1.0.2023",
3
+ "version": "1.0.2025",
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,119 +0,0 @@
1
- /**
2
- * DrawerGesture
3
- *
4
- * Handles touch gesture tracking for drawer components.
5
- * Manages drag state, thresholds, and provides helper methods for swipe-to-close behavior.
6
- *
7
- * @export
8
- * @class DrawerGesture
9
- */
10
- export class DrawerGesture {
11
- /**
12
- * Creates an instance of DrawerGesture.
13
- *
14
- * @param {object} [options={}]
15
- * @param {HTMLElement|null} [options.modal=null] - The modal element (panel) reference
16
- * @param {number} [options.closeThreshold=150] - Pixels to drag before closing
17
- * @param {number} [options.snapThreshold=50] - Pixels to drag before snapping
18
- * @param {Function|null} [options.onClose=null] - Callback when drawer should close
19
- */
20
- constructor(options?: {
21
- modal?: HTMLElement | null;
22
- closeThreshold?: number;
23
- snapThreshold?: number;
24
- onClose?: Function | null;
25
- });
26
- modal: HTMLElement;
27
- /**
28
- * Reset drag state
29
- *
30
- * @returns {void}
31
- */
32
- reset(): void;
33
- state: {
34
- isDragging: boolean;
35
- startY: number;
36
- currentY: number;
37
- startScrollTop: number;
38
- canDrag: boolean;
39
- };
40
- /**
41
- * Check if viewport is mobile
42
- *
43
- * @returns {boolean}
44
- */
45
- isMobile(): boolean;
46
- /**
47
- * Handle touch start
48
- *
49
- * @param {TouchEvent} e
50
- * @returns {void}
51
- */
52
- handleTouchStart(e: TouchEvent): void;
53
- /**
54
- * Handle touch move
55
- *
56
- * @param {TouchEvent} e
57
- * @returns {void}
58
- */
59
- handleTouchMove(e: TouchEvent): void;
60
- /**
61
- * Handle touch end
62
- *
63
- * @param {TouchEvent} e
64
- * @returns {void}
65
- */
66
- handleTouchEnd(e: TouchEvent): void;
67
- /**
68
- * Get current drag delta Y
69
- *
70
- * @returns {number}
71
- */
72
- getDeltaY(): number;
73
- /**
74
- * Calculate translateY with rubber band damping
75
- *
76
- * @param {number} deltaY
77
- * @returns {number}
78
- */
79
- calculateTranslateY(deltaY: number): number;
80
- /**
81
- * Calculate backdrop opacity based on drag distance
82
- *
83
- * @param {number} deltaY
84
- * @returns {number}
85
- */
86
- calculateBackdropOpacity(deltaY: number): number;
87
- /**
88
- * Update backdrop opacity
89
- *
90
- * @param {number} opacity
91
- * @returns {void}
92
- */
93
- updateBackdropOpacity(opacity: number): void;
94
- /**
95
- * Animate drawer closing
96
- *
97
- * @returns {void}
98
- */
99
- animateClose(): void;
100
- /**
101
- * Snap drawer back to original position
102
- *
103
- * @returns {void}
104
- */
105
- snapBack(): void;
106
- /**
107
- * Check if currently dragging
108
- *
109
- * @returns {boolean}
110
- */
111
- isDragging(): boolean;
112
- /**
113
- * Cleanup
114
- *
115
- * @returns {void}
116
- */
117
- destroy(): void;
118
- onClose: any;
119
- }
@@ -1,46 +0,0 @@
1
- /**
2
- * Drawer
3
- *
4
- * A mobile-first drawer component that slides up from the bottom on mobile
5
- * and appears as a centered modal on desktop. Supports swipe-to-close gestures.
6
- *
7
- * @export
8
- * @class Drawer
9
- * @extends {Modal}
10
- */
11
- export class Drawer extends Modal {
12
- /**
13
- * @member {boolean} swipeToClose
14
- * @default true
15
- * @description Enable swipe-to-close gesture on mobile
16
- */
17
- swipeToClose: boolean;
18
- /**
19
- * @member {number} closeThreshold
20
- * @default 150
21
- * @description Pixels to drag before closing (mobile only)
22
- */
23
- closeThreshold: number;
24
- /**
25
- * @member {number} snapThreshold
26
- * @default 50
27
- * @description Pixels to drag before snapping behavior kicks in
28
- */
29
- snapThreshold: number;
30
- /**
31
- * Get extra props for ModalContainer
32
- *
33
- * @returns {object}
34
- */
35
- getContainerProps(): object;
36
- gesture: DrawerGesture;
37
- /**
38
- * Get gesture event handlers for modal content
39
- * Returns event props to be spread onto the modal-content element
40
- *
41
- * @returns {object}
42
- */
43
- getGestureHandlers(): object;
44
- }
45
- import { Modal } from './modal.js';
46
- import { DrawerGesture } from './drawer-gesture.js';