@base-framework/ui 1.0.271 → 1.0.274

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.
@@ -1,7 +1,7 @@
1
- import { Div as u, Label as h, Checkbox as m, Span as $, OnState as p, I as x, Input as r, Textarea as k } from "@base-framework/atoms";
1
+ import { Div as u, Label as m, Checkbox as f, Span as b, OnState as p, I as x, Input as n, Textarea as k } from "@base-framework/atoms";
2
2
  import { Jot as g, Atom as s } from "@base-framework/base";
3
3
  import { Icons as y } from "./icons.es.js";
4
- const I = "flex h-10 w-full px-3 py-2 text-sm", n = "rounded-md border border-border bg-input", o = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ring-offset-background", a = "disabled:cursor-not-allowed disabled:opacity-50 [&:user-invalid]:border-destructive", l = "placeholder:text-muted-foreground", f = `${I} ${n} ${o} ${l} ${a}`, C = ({ id: e, checked: c, bind: t, required: d }) => m({
4
+ const I = "flex h-10 w-full px-3 py-2 text-sm", r = "rounded-md border border-border bg-input", o = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ring-offset-background", c = "disabled:cursor-not-allowed disabled:opacity-50 [&:user-invalid]:border-destructive", l = "placeholder:text-muted-foreground", $ = `${I} ${r} ${o} ${l} ${c}`, C = ({ id: e, checked: a, bind: t, required: d }) => f({
5
5
  id: e,
6
6
  cache: "checkbox",
7
7
  class: "absolute opacity-0 w-full h-full cursor-pointer pointer-events-none",
@@ -9,9 +9,9 @@ const I = "flex h-10 w-full px-3 py-2 text-sm", n = "rounded-md border border-bo
9
9
  checked: ["checked"]
10
10
  },
11
11
  required: d,
12
- checked: c,
12
+ checked: a,
13
13
  bind: t
14
- }), v = () => $({ class: "absolute text-xs pointer-events-none" }, [
14
+ }), v = () => b({ class: "absolute text-xs pointer-events-none" }, [
15
15
  p(
16
16
  "checked",
17
17
  (e) => e ? x({
@@ -19,11 +19,11 @@ const I = "flex h-10 w-full px-3 py-2 text-sm", n = "rounded-md border border-bo
19
19
  html: y.check
20
20
  }) : null
21
21
  )
22
- ]), w = ({ id: e, bind: c, checked: t, required: d, clickHandler: b }) => u({
22
+ ]), w = ({ id: e, bind: a, checked: t, required: d, clickHandler: h }) => u({
23
23
  class: `relative flex items-center justify-center w-5 h-5 transition-colors duration-200 hover:border-accent-foreground
24
24
  rounded-md border
25
25
  ${o}
26
- ${a}`.trim(),
26
+ ${c}`.trim(),
27
27
  onState: [
28
28
  "checked",
29
29
  {
@@ -37,15 +37,15 @@ const I = "flex h-10 w-full px-3 py-2 text-sm", n = "rounded-md border border-bo
37
37
  checked: ["checked"]
38
38
  },
39
39
  tabIndex: 0,
40
- click: b
40
+ click: h
41
41
  }, [
42
- C({ bind: c, checked: t, id: e, required: d }),
42
+ C({ bind: a, checked: t, id: e, required: d }),
43
43
  v()
44
- ]), T = ({ id: e, label: c, clickHandler: t }) => h({
44
+ ]), T = ({ id: e, label: a, clickHandler: t }) => m({
45
45
  class: "text-base cursor-pointer",
46
46
  htmlFor: e,
47
47
  click: t
48
- }, c), L = g(
48
+ }, a), F = g(
49
49
  {
50
50
  /**
51
51
  * This will initialize the state of the checkbox.
@@ -82,7 +82,7 @@ const I = "flex h-10 w-full px-3 py-2 text-sm", n = "rounded-md border border-bo
82
82
  * @returns {object}
83
83
  */
84
84
  render() {
85
- const e = this.getId(), c = (t) => this.clickHandler(t);
85
+ const e = this.getId(), a = (t) => this.clickHandler(t);
86
86
  return u({ class: `flex items-center space-x-2 cursor-pointer ${this.class || ""}` }, [
87
87
  w({
88
88
  id: e,
@@ -93,10 +93,10 @@ const I = "flex h-10 w-full px-3 py-2 text-sm", n = "rounded-md border border-bo
93
93
  // @ts-ignore
94
94
  required: this.required,
95
95
  // @ts-ignore
96
- clickHandler: c
96
+ clickHandler: a
97
97
  }),
98
98
  // @ts-ignore
99
- this.label && T({ id: e, label: this.label, clickHandler: c })
99
+ this.label && T({ id: e, label: this.label, clickHandler: a })
100
100
  ]);
101
101
  }
102
102
  }
@@ -105,12 +105,12 @@ const I = "flex h-10 w-full px-3 py-2 text-sm", n = "rounded-md border border-bo
105
105
  const t = e.replace(/\D/g, "").match(/^(\d{0,3})(\d{0,3})(\d{0,4})$/);
106
106
  return t ? t[2] ? `(${t[1]}) ${t[2]}${t[3] ? "-" + t[3] : ""}` : t[1] || "" : e;
107
107
  }, D = (e) => {
108
- const c = e.target, t = H(c.value);
109
- t && (c.value = t);
110
- }, i = s((e) => r({
108
+ const a = e.target, t = H(a.value);
109
+ t && (a.value = t);
110
+ }, i = s((e) => n({
111
111
  ...e,
112
- class: `${f} ${e.class || ""}`.trim()
113
- })), M = s((e) => i({
112
+ class: `${$} ${e.class || ""}`.trim()
113
+ })), L = s((e) => i({
114
114
  ...e,
115
115
  type: "tel",
116
116
  name: e.name || "Phone",
@@ -118,7 +118,7 @@ const I = "flex h-10 w-full px-3 py-2 text-sm", n = "rounded-md border border-bo
118
118
  placeholder: "(555) 555-5555",
119
119
  pattern: e.pattern || "\\(\\d{3}\\) \\d{3}-\\d{4}",
120
120
  keyup: D
121
- })), S = s((e) => i({
121
+ })), M = s((e) => i({
122
122
  ...e,
123
123
  type: "email",
124
124
  name: e.name || "Email",
@@ -127,34 +127,34 @@ const I = "flex h-10 w-full px-3 py-2 text-sm", n = "rounded-md border border-bo
127
127
  })), q = s((e) => k({
128
128
  ...e,
129
129
  as: "textarea",
130
- class: `flex w-full h-24 px-3 py-2 text-sm ${n} ${o} ${l} ${a} ${e.class || ""}`.trim()
130
+ class: `flex w-full h-24 px-3 py-2 text-sm ${r} ${o} ${l} ${c} ${e.class || ""}`.trim()
131
131
  })), R = (e = {}) => u({ class: "flex items-center space-x-2" }, [
132
- r({
132
+ n({
133
133
  ...e,
134
134
  type: "radio",
135
135
  class: "cursor-pointer appearance-none h-4 w-4 border rounded-full checked:border-primary checked:bg-primary focus:ring focus:ring-primary".trim()
136
136
  }),
137
- e.label && h({ forHTML: e.value, class: "cursor-pointer" }, e.label)
138
- ]), U = s((e) => r({
137
+ e.label && m({ forHTML: e.value, class: "cursor-pointer" }, e.label)
138
+ ]), U = s((e) => n({
139
139
  ...e,
140
140
  type: "date",
141
- class: `${n} ${o} ${l} ${a} px-3 py-2 text-sm ring-offset-background ${e.class || ""}`.trim()
142
- })), W = s((e) => r({
141
+ class: `${r} ${o} ${l} ${c} px-3 py-2 text-sm ring-offset-background ${e.class || ""}`.trim()
142
+ })), W = s((e) => n({
143
143
  ...e,
144
144
  type: "time",
145
- class: `${n} ${o} ${l} ${a} px-3 py-2 text-sm ring-offset-background ${e.class || ""}`.trim()
146
- })), j = s((e) => r({
145
+ class: `${r} ${o} ${l} ${c} px-3 py-2 text-sm ring-offset-background ${e.class || ""}`.trim()
146
+ })), j = s((e) => n({
147
147
  ...e,
148
148
  type: "datetime-local",
149
- class: `${n} ${o} ${l} ${a} px-3 py-2 text-sm ring-offset-background ${e.class || ""}`.trim()
150
- })), z = s((e) => r({
149
+ class: `${r} ${o} ${l} ${c} px-3 py-2 text-sm ring-offset-background ${e.class || ""}`.trim()
150
+ })), z = s((e) => n({
151
151
  ...e,
152
152
  type: "month",
153
- class: `${n} ${o} ${l} ${a} px-3 py-2 text-sm ring-offset-background ${e.class || ""}`.trim()
154
- })), A = s((e) => r({
153
+ class: `${r} ${o} ${l} ${c} px-3 py-2 text-sm ring-offset-background ${e.class || ""}`.trim()
154
+ })), A = s((e) => n({
155
155
  ...e,
156
156
  type: "week",
157
- class: `${n} ${o} ${l} ${a} px-3 py-2 text-sm ring-offset-background ${e.class || ""}`.trim()
157
+ class: `${r} ${o} ${l} ${c} px-3 py-2 text-sm ring-offset-background ${e.class || ""}`.trim()
158
158
  })), B = s((e) => i({
159
159
  ...e,
160
160
  type: "number"
@@ -172,24 +172,26 @@ const O = s((e) => i({
172
172
  })), G = s((e) => i({
173
173
  ...e,
174
174
  type: "hidden"
175
- })), K = s((e) => r({
175
+ })), K = s((e) => n({
176
176
  ...e,
177
177
  type: "color",
178
- class: `${n} text-foreground p-0 ${a} ${e.class || ""}`.trim()
178
+ class: `${r} text-foreground p-0 ${c} ${e.class || ""}`.trim()
179
179
  }));
180
- s((e) => m({
180
+ s((e) => f({
181
181
  ...e,
182
- class: `flex h-4 w-4 text-foreground ${n} ${o} ${a} ${e.class || ""}`.trim()
182
+ class: `flex h-4 w-4 text-foreground ${r} ${o} ${c} ${e.class || ""}`.trim()
183
183
  }));
184
- const E = "file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground", Q = s((e) => r({
184
+ const E = "file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground", Q = s((e) => n({
185
185
  ...e,
186
186
  type: "file",
187
- class: `${f} ${E} ${e.class || ""}`.trim()
188
- }));
187
+ class: `${$} ${E} ${e.class || ""}`.trim()
188
+ })), V = ({ class: e, shape: a = "rectangle", width: t = "w-full", height: d = "h-4" }) => u({
189
+ class: `bg-muted animate-pulse ${t} ${d} ${a === "circle" ? "rounded-full" : "rounded-md"} ${e || ""}`
190
+ });
189
191
  export {
190
- L as C,
192
+ F as C,
191
193
  U as D,
192
- S as E,
194
+ M as E,
193
195
  Q as F,
194
196
  G as H,
195
197
  i as I,
@@ -197,14 +199,15 @@ export {
197
199
  B as N,
198
200
  J as P,
199
201
  R,
200
- M as T,
202
+ V as S,
203
+ L as T,
201
204
  O as U,
202
205
  A as W,
203
206
  q as a,
204
207
  W as b,
205
208
  j as c,
206
209
  K as d,
207
- a as e,
210
+ c as e,
208
211
  o as f,
209
- f as g
212
+ $ as g
210
213
  };
@@ -1,7 +1,7 @@
1
- import { Span as c, Legend as b, Fieldset as C, Div as l, UseParent as u, Input as x } from "@base-framework/atoms";
1
+ import { Span as c, Legend as f, Fieldset as x, Div as l, UseParent as u, Input as C } from "@base-framework/atoms";
2
2
  import { Atom as s, Html as p } from "@base-framework/base";
3
3
  import { a as d } from "./veil-tVDPinrr.js";
4
- import { f as h, e as y, g as k } from "./inputs-DYxmO1rQ.js";
4
+ import { f as h, e as y, g as k } from "./skeleton-CLm2c9Bc.js";
5
5
  const a = {
6
6
  gray: {
7
7
  backgroundColor: "bg-gray-50",
@@ -78,22 +78,22 @@ const a = {
78
78
  textColor: "text-primary",
79
79
  ringColor: "ring-background"
80
80
  }
81
- }, w = (t) => a[t] || a.gray, $ = (t) => {
81
+ }, w = (t) => a[t] || a.gray, v = (t) => {
82
82
  const { backgroundColor: e, textColor: r, ringColor: o } = w(t);
83
83
  return `inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors ${e} ${r} ${o}`;
84
84
  }, T = s((t, e) => {
85
- const r = $(t == null ? void 0 : t.type);
85
+ const r = v(t == null ? void 0 : t.type);
86
86
  return c({ ...t, class: r }, e);
87
- }), v = s((t, e) => b({
87
+ }), P = s((t, e) => f({
88
88
  ...t,
89
89
  class: ` font-medium -mt-4 -mx-1 px-2 py-2 ${t.class || ""}`
90
90
  }, e)), L = s((t, e) => {
91
91
  const r = t.border === "full" ? "border rounded-md" : "border-t";
92
- return C({
92
+ return x({
93
93
  ...t,
94
94
  class: `p-6 ${r} ${t.class || ""}`
95
95
  }, [
96
- t.legend && v(t.legend),
96
+ t.legend && P(t.legend),
97
97
  l({ class: "flex flex-auto flex-col space-y-6" }, e)
98
98
  ]);
99
99
  }), I = d(
@@ -146,7 +146,7 @@ const a = {
146
146
  style: ["left: [[filledPercentage]]%", t]
147
147
  }),
148
148
  // Hidden Range Input
149
- x({
149
+ C({
150
150
  type: "range",
151
151
  min: ["[[min]]", t],
152
152
  max: ["[[max]]", t],
@@ -175,8 +175,8 @@ const a = {
175
175
  },
176
176
  ...t,
177
177
  class: `${k} ${t.class || ""}`.trim()
178
- })), P = (t) => !t || isNaN(t) ? null : t, i = (t, e) => {
179
- const r = t, o = 16, n = 2 * Math.PI * o, m = r / 100 * n, f = `
178
+ })), $ = (t) => !t || isNaN(t) ? null : t, i = (t, e) => {
179
+ const r = t, o = 16, n = 2 * Math.PI * o, m = r / 100 * n, b = `
180
180
  <svg class="w-40 h-40 mx-auto" viewBox="0 0 36 36" xmlns="http://www.w3.org/2000/svg">
181
181
  <!-- Background Circle -->
182
182
  <circle
@@ -216,7 +216,7 @@ const a = {
216
216
  `;
217
217
  return l({
218
218
  class: "circle-graph text-inherit",
219
- html: f
219
+ html: b
220
220
  });
221
221
  }, R = s((t) => {
222
222
  const e = t.progress || 0, r = t.class || "", o = i(e, r);
@@ -224,7 +224,7 @@ const a = {
224
224
  class: "circle-graph-wrap",
225
225
  onSet: [
226
226
  t.prop,
227
- (n) => (n = P(n), n ? i(n, r) : o)
227
+ (n) => (n = $(n), n ? i(n, r) : o)
228
228
  ]
229
229
  }, [o]);
230
230
  }), S = () => u(({ state: t }) => l({
@@ -282,9 +282,7 @@ const a = {
282
282
  t < 0 && (t = 0), t > 100 && (t = 100), this.state.progress = t;
283
283
  }
284
284
  }
285
- ), V = ({ class: t, shape: e = "rectangle", width: r = "w-full", height: o = "h-4" }) => l({
286
- class: `bg-muted animate-pulse ${r} ${o} ${e === "circle" ? "rounded-full" : "rounded-md"} ${t || ""}`
287
- }), g = {
285
+ ), g = {
288
286
  top: "bottom-full left-1/2 transform -translate-x-1/2 mb-2",
289
287
  "top-right": "bottom-full left-full transform -translate-x-1 mb-2",
290
288
  "top-left": "bottom-full right-full transform translate-x-1 mb-2",
@@ -293,7 +291,7 @@ const a = {
293
291
  "bottom-left": "top-full right-full transform translate-x-1 mt-2",
294
292
  left: "top-1/2 right-full transform -translate-y-1/2 mr-2",
295
293
  right: "top-1/2 left-full transform -translate-y-1/2 ml-2"
296
- }, E = (t) => g[t] || g.top, D = s(({ position: t = "top", content: e }, r) => {
294
+ }, E = (t) => g[t] || g.top, V = s(({ position: t = "top", content: e }, r) => {
297
295
  const o = E(t);
298
296
  return Array.isArray(r) === !1 && (r = [r]), l({ class: "relative group inline-block" }, [
299
297
  ...r,
@@ -310,10 +308,9 @@ export {
310
308
  T as B,
311
309
  R as C,
312
310
  L as F,
313
- v as L,
311
+ P as L,
314
312
  O as P,
315
313
  I as R,
316
314
  G as S,
317
- D as T,
318
- V as a
315
+ V as T
319
316
  };
@@ -4,9 +4,9 @@
4
4
  * A component that displays notifications.
5
5
  *
6
6
  * @class
7
- * @extends DelayComponent
7
+ * @extends Component
8
8
  */
9
- export class Notification extends DelayComponent {
9
+ export class Notification extends Component {
10
10
  /**
11
11
  * @member {function|null} secondaryAction
12
12
  */
@@ -75,5 +75,5 @@ export class Notification extends DelayComponent {
75
75
  close(e: object): void;
76
76
  }
77
77
  export default Notification;
78
- import { DelayComponent } from "../delay-component.js";
78
+ import { Component } from "@base-framework/base";
79
79
  import { Timer } from "@base-framework/organisms";
@@ -4,6 +4,7 @@
4
4
  * Manages data, filtering, pagination, and selection within a table.
5
5
  *
6
6
  * @param {object} props
7
+ * @param {boolean|object} [props.skeleton] - Skeleton configuration. Can be true for default or object with { number: 5, row: customRowFunction }
7
8
  * @returns {object}
8
9
  */
9
10
  export class DataTable extends Component {
@@ -25,6 +26,18 @@ export class DataTable extends Component {
25
26
  * @returns {void}
26
27
  */
27
28
  updateSelected(): void;
29
+ /**
30
+ * Generates skeleton rows for the table.
31
+ *
32
+ * @returns {Array}
33
+ */
34
+ generateSkeletonRows(): any[];
35
+ /**
36
+ * Removes skeleton rows and shows real content.
37
+ *
38
+ * @returns {void}
39
+ */
40
+ removeSkeleton(): void;
28
41
  /**
29
42
  * This will get the selected rows.
30
43
  *
@@ -18,6 +18,7 @@
18
18
  * @property {object} [props.data] - The table data.
19
19
  * @property {string} [props.cache] - The table cache identifier.
20
20
  * @property {object|null} [props.emptyState] - The empty state to show when there are no items.
21
+ * @property {boolean|object} [props.skeleton] - Skeleton configuration. Can be true for default or object with { number: 5, row: customRowFunction }
21
22
  * @returns {object}
22
23
  */
23
24
  export const DynamicDataTable: Function;
@@ -15,6 +15,7 @@ export function DynamicTableBody(props: object): object;
15
15
  * @property {function} [props.rowItem] - The row item.
16
16
  * @property {string} [props.containerClass] - The class to add to the scroll container.
17
17
  * @property {object|null} [props.emptyState] - The empty state to show when there are no items.
18
+ * @property {boolean|object} [props.skeleton] - Skeleton configuration. Can be true for default or object with { number: 5, row: customRowFunction }
18
19
  * @returns {object}
19
20
  */
20
21
  export class DynamicTable extends DataTable {
@@ -19,6 +19,7 @@
19
19
  * @property {object} [props.data] - The table data.
20
20
  * @property {string} [props.cache] - The table cache identifier.
21
21
  * @property {object|null} [props.emptyState] - The empty state to show when there are no items.
22
+ * @property {boolean|object} [props.skeleton] - Skeleton configuration. Can be true for default or object with { number: 5, row: customRowFunction }
22
23
  * @returns {object}
23
24
  */
24
25
  export const ScrollableDataTable: Function;
@@ -16,6 +16,7 @@ export function ScrollableDataTableBody(props: object): object;
16
16
  * @property {function} [props.rowItem] - The row item.
17
17
  * @property {string} [props.containerClass] - The class to add to the scroll container.
18
18
  * @property {array} [props.emptyState] - The empty state to show when there are no items.
19
+ * @property {boolean|object} [props.skeleton] - Skeleton configuration. Can be true for default or object with { number: 5, row: customRowFunction }
19
20
  * @returns {object}
20
21
  */
21
22
  export class ScrollableTable extends DataTable {
@@ -0,0 +1,12 @@
1
+ export function BasicSkeletonExample(): DataTable;
2
+ export function CustomCountExample(): DataTable;
3
+ export function CustomSkeletonRowExample(): DataTable;
4
+ export function demonstrateSkeletonUsage(): DataTable;
5
+ declare namespace _default {
6
+ export { BasicSkeletonExample };
7
+ export { CustomCountExample };
8
+ export { CustomSkeletonRowExample };
9
+ export { demonstrateSkeletonUsage };
10
+ }
11
+ export default _default;
12
+ import { DataTable } from './data-table.js';
@@ -0,0 +1,6 @@
1
+ export function SkeletonTableRow({ columnCount, customCell, key }: {
2
+ columnCount?: number;
3
+ customCell?: Function;
4
+ key?: string;
5
+ }): object;
6
+ export default SkeletonTableRow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base-framework/ui",
3
- "version": "1.0.271",
3
+ "version": "1.0.274",
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": {