@base-framework/ui 1.2.68 → 1.2.70

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 CHANGED
@@ -1,4 +1,4 @@
1
- import { c as t, f as e, h as n, i as o, k as l, l as i, m as u, n as r, t as p, w as I, J as g, L as c, M as d, N as m, O as F, P as T, Q as B, R as S, S as b, T as C, U as x, a0 as f, a7 as P, a8 as h, a9 as k, ac as M, ad as U, ae as w, ai as E, an as G, au as L, ax as N, aB as R, aC as Z, aE as D, aF as H, aG as J, aK as Q, aP as V, aQ as W, aS as v, aW as K, aX as O, aY as X, aZ as Y, b0 as j, b1 as q, b2 as y, b5 as z, b6 as A } from "./full-page-BiH_l_Ok.js";
1
+ import { c as t, f as e, h as n, i as o, k as l, l as i, m as u, n as r, t as p, w as I, J as g, L as c, M as d, N as m, O as F, P as T, Q as B, R as S, S as b, T as C, U as x, a0 as f, a7 as P, a8 as h, a9 as k, ac as M, ad as U, ae as w, ai as E, an as G, au as L, ax as N, aB as R, aC as Z, aE as D, aF as H, aG as J, aK as Q, aP as V, aQ as W, aS as v, aW as K, aX as O, aY as X, aZ as Y, b0 as j, b1 as q, b2 as y, b5 as z, b6 as A } from "./full-page-Q-0SO6xi.js";
2
2
  import { S as $ } from "./skeleton-BlY3opxG.js";
3
3
  export {
4
4
  t as Badge,
@@ -1,6 +1,6 @@
1
1
  import { Component as d, Html as g, Dom as v, base as T, Data as S, Builder as C, DateTime as f } from "@base-framework/base";
2
2
  import { Li as w, Span as p, Div as a, Ul as D, Button as x, OnState as Y, Time as B } from "@base-framework/atoms";
3
- import { aY as m, f as h, az as k, b8 as y, at as E, F as L } from "./full-page-BiH_l_Ok.js";
3
+ import { aY as m, f as h, az as k, b8 as y, at as E, F as L } from "./full-page-Q-0SO6xi.js";
4
4
  import { List as N, DynamicTime as M } from "@base-framework/organisms";
5
5
  class V extends d {
6
6
  /**
@@ -1,8 +1,8 @@
1
- import { DateTime as i } from "@base-framework/base";
2
- const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.push(r), t) : {
3
- ...t,
4
- callBack: r
5
- }), B = (t, r = "") => t != null && t !== "" ? t : r, p = {
1
+ import { DateTime as f } from "@base-framework/base";
2
+ const i = (n, t) => (typeof n == "string" && (n = [n]), Array.isArray(n) ? (n.push(t), n) : {
3
+ ...n,
4
+ callBack: t
5
+ }), m = (n, t = "") => n != null && n !== "" ? n : t, B = {
6
6
  /**
7
7
  * Formats a number with commas.
8
8
  *
@@ -10,13 +10,16 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
10
10
  * @param {string|null} defaultValue - Value if original is null or undefined.
11
11
  * @returns {object|array}
12
12
  */
13
- number(t, r = null) {
14
- return o(t, (n) => {
15
- if (!isNaN(n)) {
16
- const l = /\B(?=(\d{3})+(?!\d))/g;
17
- return n.toString().replace(l, ",");
18
- }
19
- return r || "";
13
+ number(n, t = null) {
14
+ const l = typeof Intl < "u" ? new Intl.NumberFormat() : null;
15
+ return i(n, (r) => {
16
+ const a = Number(r);
17
+ if (isNaN(a))
18
+ return t || "";
19
+ if (l)
20
+ return l.format(a);
21
+ const c = /\B(?=(\d{3})+(?!\d))/g;
22
+ return a.toString().replace(c, ",");
20
23
  });
21
24
  },
22
25
  /**
@@ -27,8 +30,8 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
27
30
  * @param {string} no - Text for false values.
28
31
  * @returns {object|array}
29
32
  */
30
- yesno(t, r = "Yes", c = "No") {
31
- return o(t, (l) => l ? r : c);
33
+ yesno(n, t = "Yes", l = "No") {
34
+ return i(n, (r) => r ? t : l);
32
35
  },
33
36
  /**
34
37
  * Formats a value as money with two decimals.
@@ -39,13 +42,19 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
39
42
  * @param {boolean} round - Whether to round to nearest whole number (no decimals).
40
43
  * @returns {object|array}
41
44
  */
42
- money(t, r = "$", c = null, n = !1) {
43
- return o(t, (e) => {
44
- const a = parseFloat(e);
45
- if (isNaN(a))
46
- return r + c || "";
47
- const s = /\B(?=(\d{3})+(?!\d))/g;
48
- return r + (n ? Math.round(a) : a.toFixed(2)).toString().replace(s, ",");
45
+ money(n, t = "$", l = null, e = !1) {
46
+ const r = typeof Intl < "u" ? new Intl.NumberFormat(void 0, {
47
+ minimumFractionDigits: e ? 0 : 2,
48
+ maximumFractionDigits: e ? 0 : 2
49
+ }) : null;
50
+ return i(n, (c) => {
51
+ const o = parseFloat(c);
52
+ if (isNaN(o))
53
+ return t + l || "";
54
+ if (r)
55
+ return t + r.format(o);
56
+ const u = /\B(?=(\d{3})+(?!\d))/g;
57
+ return t + (e ? Math.round(o) : o.toFixed(2)).toString().replace(u, ",");
49
58
  });
50
59
  },
51
60
  /**
@@ -56,13 +65,19 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
56
65
  * @param {*} defaultValue - Value if original is invalid.
57
66
  * @returns {object|array}
58
67
  */
59
- roundMoney(t, r = "$", c = null) {
60
- return o(t, (l) => {
61
- const e = parseFloat(l);
62
- if (isNaN(e))
63
- return r + c || "";
64
- const a = /\B(?=(\d{3})+(?!\d))/g;
65
- return r + Math.round(e).toString().replace(a, ",");
68
+ roundMoney(n, t = "$", l = null) {
69
+ const e = typeof Intl < "u" ? new Intl.NumberFormat(void 0, {
70
+ minimumFractionDigits: 0,
71
+ maximumFractionDigits: 0
72
+ }) : null;
73
+ return i(n, (a) => {
74
+ const c = parseFloat(a);
75
+ if (isNaN(c))
76
+ return t + l || "";
77
+ if (e)
78
+ return t + e.format(Math.round(c));
79
+ const o = /\B(?=(\d{3})+(?!\d))/g;
80
+ return t + Math.round(c).toString().replace(o, ",");
66
81
  });
67
82
  },
68
83
  /**
@@ -72,11 +87,11 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
72
87
  * @param {*} defaultValue - Value if original is invalid.
73
88
  * @returns {object|array}
74
89
  */
75
- phone(t, r = null) {
76
- return o(t, (n) => {
77
- n = n || "";
78
- const l = String(n.toString()).replace(/\D/g, "");
79
- return l.length === 10 ? "(" + l.slice(0, 3) + ") " + l.slice(3, 6) + "-" + l.slice(6) : n || r;
90
+ phone(n, t = null) {
91
+ return i(n, (e) => {
92
+ e = e || "";
93
+ const r = String(e.toString()).replace(/\D/g, "");
94
+ return r.length === 10 ? "(" + r.slice(0, 3) + ") " + r.slice(3, 6) + "-" + r.slice(6) : e || t;
80
95
  });
81
96
  },
82
97
  /**
@@ -86,11 +101,11 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
86
101
  * @param {*} defaultValue - Value if original is invalid.
87
102
  * @returns {object|array}
88
103
  */
89
- integer(t, r = null) {
90
- return o(t, (n) => {
91
- n = B(n, r);
92
- const l = parseInt(n, 10);
93
- return isNaN(l) ? r : l.toString();
104
+ integer(n, t = null) {
105
+ return i(n, (e) => {
106
+ e = m(e, t);
107
+ const r = parseInt(e, 10);
108
+ return isNaN(r) ? t : r.toString();
94
109
  });
95
110
  },
96
111
  /**
@@ -100,8 +115,13 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
100
115
  * @param {*} defaultValue - Value if original is invalid.
101
116
  * @returns {object|array}
102
117
  */
103
- date(t, r = null) {
104
- return o(t, (n) => n ? i.format("standard", n) : r || "");
118
+ date(n, t = null) {
119
+ const l = typeof Intl < "u" ? new Intl.DateTimeFormat(void 0, {
120
+ year: "numeric",
121
+ month: "2-digit",
122
+ day: "2-digit"
123
+ }) : null;
124
+ return i(n, (r) => r ? l ? l.format(new Date(r)) : f.format("standard", r) : t || "");
105
125
  },
106
126
  /**
107
127
  * Formats a date and time value to a standard date and time format.
@@ -110,8 +130,16 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
110
130
  * @param {*} defaultValue - Value if original is invalid.
111
131
  * @returns {object|array}
112
132
  */
113
- dateTime(t, r = null) {
114
- return o(t, (n) => n ? i.format("standard", n) + " " + i.formatTime(n, 12) : r || "");
133
+ dateTime(n, t = null) {
134
+ const l = typeof Intl < "u" ? new Intl.DateTimeFormat(void 0, {
135
+ year: "numeric",
136
+ month: "2-digit",
137
+ day: "2-digit",
138
+ hour: "numeric",
139
+ minute: "2-digit",
140
+ hour12: !0
141
+ }) : null;
142
+ return i(n, (r) => r ? l ? l.format(new Date(r)) : f.format("standard", r) + " " + f.formatTime(r, 12) : t || "");
115
143
  },
116
144
  /**
117
145
  * Formats a time value to a standard time format.
@@ -120,8 +148,13 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
120
148
  * @param {*} defaultValue - Value if original is invalid.
121
149
  * @returns {object|array}
122
150
  */
123
- time(t, r = null) {
124
- return o(t, (n) => n ? i.formatTime(n, 12) : r || "");
151
+ time(n, t = null) {
152
+ const l = typeof Intl < "u" ? new Intl.DateTimeFormat(void 0, {
153
+ hour: "numeric",
154
+ minute: "2-digit",
155
+ hour12: !0
156
+ }) : null;
157
+ return i(n, (r) => r ? l ? l.format(new Date(r)) : f.formatTime(r, 12) : t || "");
125
158
  },
126
159
  /**
127
160
  * Formats a value with a default value if null or undefined.
@@ -130,8 +163,8 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
130
163
  * @param {string|null} defaultValue - Value if original is null or undefined.
131
164
  * @returns {object|array}
132
165
  */
133
- default(t, r = null) {
134
- return o(t, (n) => B(n, r));
166
+ default(n, t = null) {
167
+ return i(n, (e) => m(e, t));
135
168
  },
136
169
  /**
137
170
  * Formats a number as a percentage.
@@ -142,10 +175,21 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
142
175
  * @param {*} defaultValue - Value if original is invalid.
143
176
  * @returns {object|array}
144
177
  */
145
- percentage(t, r = 0, c = !1, n = null) {
146
- return o(t, (e) => {
147
- const a = parseFloat(e);
148
- return isNaN(a) ? n || "" : (c ? a * 100 : a).toFixed(r) + "%";
178
+ percentage(n, t = 0, l = !1, e = null) {
179
+ const r = typeof Intl < "u" ? new Intl.NumberFormat(void 0, {
180
+ style: "percent",
181
+ minimumFractionDigits: t,
182
+ maximumFractionDigits: t
183
+ }) : null;
184
+ return i(n, (c) => {
185
+ const o = parseFloat(c);
186
+ if (isNaN(o))
187
+ return e || "";
188
+ if (r) {
189
+ const s = l ? o : o / 100;
190
+ return r.format(s);
191
+ }
192
+ return (l ? o * 100 : o).toFixed(t) + "%";
149
193
  });
150
194
  },
151
195
  /**
@@ -156,12 +200,12 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
156
200
  * @param {*} defaultValue - Value if original is invalid.
157
201
  * @returns {object|array}
158
202
  */
159
- capitalize(t, r = !0, c = null) {
160
- return o(t, (l) => {
161
- if (!l)
162
- return c || "";
163
- const e = String(l);
164
- return r ? e.replace(/\b\w/g, (a) => a.toUpperCase()) : e.charAt(0).toUpperCase() + e.slice(1);
203
+ capitalize(n, t = !0, l = null) {
204
+ return i(n, (r) => {
205
+ if (!r)
206
+ return l || "";
207
+ const a = String(r);
208
+ return t ? a.replace(/\b\w/g, (c) => c.toUpperCase()) : a.charAt(0).toUpperCase() + a.slice(1);
165
209
  });
166
210
  },
167
211
  /**
@@ -171,8 +215,8 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
171
215
  * @param {*} defaultValue - Value if original is invalid.
172
216
  * @returns {object|array}
173
217
  */
174
- uppercase(t, r = null) {
175
- return o(t, (n) => n ? String(n).toUpperCase() : r || "");
218
+ uppercase(n, t = null) {
219
+ return i(n, (e) => e ? String(e).toUpperCase() : t || "");
176
220
  },
177
221
  /**
178
222
  * Converts a string to lowercase.
@@ -181,8 +225,8 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
181
225
  * @param {*} defaultValue - Value if original is invalid.
182
226
  * @returns {object|array}
183
227
  */
184
- lowercase(t, r = null) {
185
- return o(t, (n) => n ? String(n).toLowerCase() : r || "");
228
+ lowercase(n, t = null) {
229
+ return i(n, (e) => e ? String(e).toLowerCase() : t || "");
186
230
  },
187
231
  /**
188
232
  * Truncates a string to a maximum length with ellipsis.
@@ -193,12 +237,12 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
193
237
  * @param {*} defaultValue - Value if original is invalid.
194
238
  * @returns {object|array}
195
239
  */
196
- truncate(t, r = 50, c = "...", n = null) {
197
- return o(t, (e) => {
198
- if (!e)
199
- return n || "";
200
- const a = String(e);
201
- return a.length <= r ? a : a.slice(0, r - c.length) + c;
240
+ truncate(n, t = 50, l = "...", e = null) {
241
+ return i(n, (a) => {
242
+ if (!a)
243
+ return e || "";
244
+ const c = String(a);
245
+ return c.length <= t ? c : c.slice(0, t - l.length) + l;
202
246
  });
203
247
  },
204
248
  /**
@@ -209,15 +253,15 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
209
253
  * @param {*} defaultValue - Value if original is invalid.
210
254
  * @returns {object|array}
211
255
  */
212
- fileSize(t, r = 2, c = null) {
213
- return o(t, (l) => {
214
- const e = parseFloat(l);
215
- if (isNaN(e) || e < 0)
216
- return c || "";
217
- if (e === 0)
256
+ fileSize(n, t = 2, l = null) {
257
+ return i(n, (r) => {
258
+ const a = parseFloat(r);
259
+ if (isNaN(a) || a < 0)
260
+ return l || "";
261
+ if (a === 0)
218
262
  return "0 Bytes";
219
- const a = 1024, s = ["Bytes", "KB", "MB", "GB", "TB", "PB"], u = Math.floor(Math.log(e) / Math.log(a));
220
- return parseFloat((e / Math.pow(a, u)).toFixed(r)) + " " + s[u];
263
+ const c = 1024, o = ["Bytes", "KB", "MB", "GB", "TB", "PB"], u = Math.floor(Math.log(a) / Math.log(c));
264
+ return parseFloat((a / Math.pow(c, u)).toFixed(t)) + " " + o[u];
221
265
  });
222
266
  },
223
267
  /**
@@ -229,17 +273,18 @@ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
229
273
  * @param {boolean} includeCount - Whether to include the count in output.
230
274
  * @returns {object|array}
231
275
  */
232
- plural(t, r, c = null, n = !0) {
233
- return o(t, (e) => {
234
- const a = parseInt(e, 10);
235
- if (isNaN(a))
276
+ plural(n, t, l = null, e = !0) {
277
+ const r = typeof Intl < "u" && Intl.PluralRules ? new Intl.PluralRules() : null;
278
+ return i(n, (c) => {
279
+ const o = parseInt(c, 10);
280
+ if (isNaN(o))
236
281
  return "";
237
- const s = a === 1 ? r : c || r + "s";
238
- return n ? `${a} ${s}` : s;
282
+ const s = (r ? r.select(o) === "one" : o === 1) ? t : l || t + "s";
283
+ return e ? `${o} ${s}` : s;
239
284
  });
240
285
  }
241
286
  };
242
287
  export {
243
- p as F,
244
- o as c
288
+ B as F,
289
+ i as c
245
290
  };