@base-framework/ui 1.1.18 → 1.1.19

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.
@@ -6,7 +6,7 @@ import { Timer as ut, List as ht, DynamicTime as mt } from "@base-framework/orga
6
6
  import { C as ft, b as pt } from "./tooltip-BmvjA9XQ.js";
7
7
  import { f as C } from "./image-BhZbKYDj.js";
8
8
  import { Icons as u } from "./icons.es.js";
9
- import { F as z } from "./format-BmrNQptv.js";
9
+ import { F as z } from "./format-DE4rFWuD.js";
10
10
  import "./mobile-nav-wrapper-DyBtZhx2.js";
11
11
  import "./aside-template-BDvEMLnk.js";
12
12
  import "./full-page-DccgwWsM.js";
@@ -1,5 +1,5 @@
1
1
  import { DateTime as i } from "@base-framework/base";
2
- const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.push(r), t) : {
2
+ const o = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.push(r), t) : {
3
3
  ...t,
4
4
  callBack: r
5
5
  }), B = (t, r = "") => t != null && t !== "" ? t : r, p = {
@@ -11,7 +11,7 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
11
11
  * @returns {object|array}
12
12
  */
13
13
  number(t, r = null) {
14
- return s(t, (n) => {
14
+ return o(t, (n) => {
15
15
  if (!isNaN(n)) {
16
16
  const l = /\B(?=(\d{3})+(?!\d))/g;
17
17
  return n.toString().replace(l, ",");
@@ -28,7 +28,7 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
28
28
  * @returns {object|array}
29
29
  */
30
30
  yesno(t, r = "Yes", c = "No") {
31
- return s(t, (l) => l ? r : c);
31
+ return o(t, (l) => l ? r : c);
32
32
  },
33
33
  /**
34
34
  * Formats a value as money with two decimals.
@@ -36,15 +36,33 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
36
36
  * @param {string|number|object|array} watcher
37
37
  * @param {string} currency - Currency symbol.
38
38
  * @param {*} defaultValue - Value if original is invalid.
39
+ * @param {boolean} round - Whether to round to nearest whole number (no decimals).
39
40
  * @returns {object|array}
40
41
  */
41
- money(t, r = "$", c = null) {
42
- return s(t, (l) => {
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, ",");
49
+ });
50
+ },
51
+ /**
52
+ * Formats a value as money with no decimals (rounded).
53
+ *
54
+ * @param {string|number|object|array} watcher
55
+ * @param {string} currency - Currency symbol.
56
+ * @param {*} defaultValue - Value if original is invalid.
57
+ * @returns {object|array}
58
+ */
59
+ roundMoney(t, r = "$", c = null) {
60
+ return o(t, (l) => {
43
61
  const e = parseFloat(l);
44
62
  if (isNaN(e))
45
63
  return r + c || "";
46
64
  const a = /\B(?=(\d{3})+(?!\d))/g;
47
- return r + e.toFixed(2).toString().replace(a, ",");
65
+ return r + Math.round(e).toString().replace(a, ",");
48
66
  });
49
67
  },
50
68
  /**
@@ -55,7 +73,7 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
55
73
  * @returns {object|array}
56
74
  */
57
75
  phone(t, r = null) {
58
- return s(t, (n) => {
76
+ return o(t, (n) => {
59
77
  n = n || "";
60
78
  const l = String(n.toString()).replace(/\D/g, "");
61
79
  return l.length === 10 ? "(" + l.slice(0, 3) + ") " + l.slice(3, 6) + "-" + l.slice(6) : n || r;
@@ -69,7 +87,7 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
69
87
  * @returns {object|array}
70
88
  */
71
89
  integer(t, r = null) {
72
- return s(t, (n) => {
90
+ return o(t, (n) => {
73
91
  n = B(n, r);
74
92
  const l = parseInt(n, 10);
75
93
  return isNaN(l) ? r : l.toString();
@@ -83,7 +101,7 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
83
101
  * @returns {object|array}
84
102
  */
85
103
  date(t, r = null) {
86
- return s(t, (n) => n ? i.format("standard", n) : r || "");
104
+ return o(t, (n) => n ? i.format("standard", n) : r || "");
87
105
  },
88
106
  /**
89
107
  * Formats a date and time value to a standard date and time format.
@@ -93,7 +111,7 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
93
111
  * @returns {object|array}
94
112
  */
95
113
  dateTime(t, r = null) {
96
- return s(t, (n) => n ? i.format("standard", n) + " " + i.formatTime(n, 12) : r || "");
114
+ return o(t, (n) => n ? i.format("standard", n) + " " + i.formatTime(n, 12) : r || "");
97
115
  },
98
116
  /**
99
117
  * Formats a time value to a standard time format.
@@ -103,7 +121,7 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
103
121
  * @returns {object|array}
104
122
  */
105
123
  time(t, r = null) {
106
- return s(t, (n) => n ? i.formatTime(n, 12) : r || "");
124
+ return o(t, (n) => n ? i.formatTime(n, 12) : r || "");
107
125
  },
108
126
  /**
109
127
  * Formats a value with a default value if null or undefined.
@@ -113,7 +131,7 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
113
131
  * @returns {object|array}
114
132
  */
115
133
  default(t, r = null) {
116
- return s(t, (n) => B(n, r));
134
+ return o(t, (n) => B(n, r));
117
135
  },
118
136
  /**
119
137
  * Formats a number as a percentage.
@@ -125,7 +143,7 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
125
143
  * @returns {object|array}
126
144
  */
127
145
  percentage(t, r = 0, c = !1, n = null) {
128
- return s(t, (e) => {
146
+ return o(t, (e) => {
129
147
  const a = parseFloat(e);
130
148
  return isNaN(a) ? n || "" : (c ? a * 100 : a).toFixed(r) + "%";
131
149
  });
@@ -139,7 +157,7 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
139
157
  * @returns {object|array}
140
158
  */
141
159
  capitalize(t, r = !0, c = null) {
142
- return s(t, (l) => {
160
+ return o(t, (l) => {
143
161
  if (!l)
144
162
  return c || "";
145
163
  const e = String(l);
@@ -154,7 +172,7 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
154
172
  * @returns {object|array}
155
173
  */
156
174
  uppercase(t, r = null) {
157
- return s(t, (n) => n ? String(n).toUpperCase() : r || "");
175
+ return o(t, (n) => n ? String(n).toUpperCase() : r || "");
158
176
  },
159
177
  /**
160
178
  * Converts a string to lowercase.
@@ -164,7 +182,7 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
164
182
  * @returns {object|array}
165
183
  */
166
184
  lowercase(t, r = null) {
167
- return s(t, (n) => n ? String(n).toLowerCase() : r || "");
185
+ return o(t, (n) => n ? String(n).toLowerCase() : r || "");
168
186
  },
169
187
  /**
170
188
  * Truncates a string to a maximum length with ellipsis.
@@ -176,7 +194,7 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
176
194
  * @returns {object|array}
177
195
  */
178
196
  truncate(t, r = 50, c = "...", n = null) {
179
- return s(t, (e) => {
197
+ return o(t, (e) => {
180
198
  if (!e)
181
199
  return n || "";
182
200
  const a = String(e);
@@ -192,14 +210,14 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
192
210
  * @returns {object|array}
193
211
  */
194
212
  fileSize(t, r = 2, c = null) {
195
- return s(t, (l) => {
213
+ return o(t, (l) => {
196
214
  const e = parseFloat(l);
197
215
  if (isNaN(e) || e < 0)
198
216
  return c || "";
199
217
  if (e === 0)
200
218
  return "0 Bytes";
201
- const a = 1024, o = ["Bytes", "KB", "MB", "GB", "TB", "PB"], u = Math.floor(Math.log(e) / Math.log(a));
202
- return parseFloat((e / Math.pow(a, u)).toFixed(r)) + " " + o[u];
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];
203
221
  });
204
222
  },
205
223
  /**
@@ -207,21 +225,21 @@ const s = (t, r) => (typeof t == "string" && (t = [t]), Array.isArray(t) ? (t.pu
207
225
  *
208
226
  * @param {string|number|object|array} watcher
209
227
  * @param {string} singular - Singular form of the word.
210
- * @param {string} plural - Plural form of the word (optional, adds 's' by default).
228
+ * @param {string|null} plural - Plural form of the word (optional, adds 's' by default).
211
229
  * @param {boolean} includeCount - Whether to include the count in output.
212
230
  * @returns {object|array}
213
231
  */
214
232
  plural(t, r, c = null, n = !0) {
215
- return s(t, (e) => {
233
+ return o(t, (e) => {
216
234
  const a = parseInt(e, 10);
217
235
  if (isNaN(a))
218
236
  return "";
219
- const o = a === 1 ? r : c || r + "s";
220
- return n ? `${a} ${o}` : o;
237
+ const s = a === 1 ? r : c || r + "s";
238
+ return n ? `${a} ${s}` : s;
221
239
  });
222
240
  }
223
241
  };
224
242
  export {
225
243
  p as F,
226
- s as c
244
+ o as c
227
245
  };
package/dist/index.es.js CHANGED
@@ -3,7 +3,7 @@ import { B as c, I as g, L as T, M as C, U as I, i as S, a as b } from "./button
3
3
  import { C as B, a as F, D as P, b as M, E as f, F as k, H as x, I as v, c as N, M as U, N as h, P as y, R as L, T as W, d as H, e as R, U as w, V as A, f as G, W as O } from "./image-BhZbKYDj.js";
4
4
  import { S as j } from "./skeleton-BlY3opxG.js";
5
5
  import { Icons as J, MaterialSymbols as q } from "./icons.es.js";
6
- import { A as K, B as Q, C as _, a as X, b as Y, c as Z, d as $, D as aa, e as ea, f as sa, g as oa, h as ta, i as ra, j as na, k as ia, l as la, m as pa, n as ma, o as da, E as ua, F as ca, p as ga, q as Ta, r as Ca, s as Ia, t as Sa, u as ba, v as Da, w as Ba, x as Fa, I as Pa, L as Ma, M as fa, y as ka, N as xa, z as va, P as Na, S as Ua, G as ha, H as ya, J as La, K as Wa, T as Ha, O as Ra, Q as wa, R as Aa, U as Ga } from "./empty-state-BwRJ964Q.js";
6
+ import { A as K, B as Q, C as _, a as X, b as Y, c as Z, d as $, D as aa, e as ea, f as sa, g as oa, h as ta, i as ra, j as na, k as ia, l as la, m as pa, n as ma, o as da, E as ua, F as ca, p as ga, q as Ta, r as Ca, s as Ia, t as Sa, u as ba, v as Da, w as Ba, x as Fa, I as Pa, L as Ma, M as fa, y as ka, N as xa, z as va, P as Na, S as Ua, G as ha, H as ya, J as La, K as Wa, T as Ha, O as Ra, Q as wa, R as Aa, U as Ga } from "./empty-state-ChjK4l3n.js";
7
7
  import { A as Ea, B as ja, C as Va, a as Ja, b as qa, D as za, c as Ka, d as Qa, e as _a, f as Xa, g as Ya, F as Za, H as $a, M as ae, O as ee, P as se, R as oe, S as te, h as re, i as ne, j as ie, T as le, U as pe, k as me, l as de, m as ue, p as ce } from "./simple-search-input-DKPm8m2G.js";
8
8
  import { B as Te, I as Ce, N as Ie, P as Se, S as be, T as De, a as Be, b as Fe, U as Pe, c as Me, d as fe, e as ke, W as xe, f as ve, g as Ne, h as Ue, i as he, j as ye, k as Le, l as We, m as He, n as Re } from "./signature-panel-dsvVvBEM.js";
9
9
  import { B as Ae, I as Ge, M as Oe, a as Ee, b as je, N as Ve, c as Je, d as qe, e as ze, f as Ke, P as Qe, S as _e, T as Xe } from "./mobile-nav-wrapper-DyBtZhx2.js";
@@ -12,7 +12,7 @@ import { B as as, F as es, M as ss, P as os } from "./full-page-DccgwWsM.js";
12
12
  import { B as rs, C as ns, F as is, a as ls, S as ps } from "./sidebar-menu-page-DSILzVNU.js";
13
13
  import { A as ds, F as us, M as cs, T as gs, a as Ts } from "./aside-template-BDvEMLnk.js";
14
14
  import { B as Is } from "./bside-template-BCP2pJWN.js";
15
- import { F as bs, c as Ds } from "./format-BmrNQptv.js";
15
+ import { F as bs, c as Ds } from "./format-DE4rFWuD.js";
16
16
  import { I as Fs } from "./image-scaler-1G-JzJVG.js";
17
17
  export {
18
18
  K as Alert,
@@ -1,4 +1,4 @@
1
- import { A as s, B as t, C as r, a as e, b as i, c as n, d as m, D as l, e as d, f as C, g as p, h as D, i as S, j as u, k as c, l as g, m as F, n as T, o as P, E as w, F as A, p as I, q as f, r as b, s as y, t as B, u as M, v as U, w as k, x, I as L, L as R, M as v, y as E, N, z as h, P as G, S as O, G as j, H as q, J as z, K as H, T as J, O as K, Q, R as _, U as V } from "./empty-state-BwRJ964Q.js";
1
+ import { A as s, B as t, C as r, a as e, b as i, c as n, d as m, D as l, e as d, f as C, g as p, h as D, i as S, j as u, k as c, l as g, m as F, n as T, o as P, E as w, F as A, p as I, q as f, r as b, s as y, t as B, u as M, v as U, w as k, x, I as L, L as R, M as v, y as E, N, z as h, P as G, S as O, G as j, H as q, J as z, K as H, T as J, O as K, Q, R as _, U as V } from "./empty-state-ChjK4l3n.js";
2
2
  import { A as X, P as Y, m as Z } from "./simple-search-input-DKPm8m2G.js";
3
3
  export {
4
4
  s as Alert,
@@ -23,9 +23,19 @@ export namespace Format {
23
23
  * @param {string|number|object|array} watcher
24
24
  * @param {string} currency - Currency symbol.
25
25
  * @param {*} defaultValue - Value if original is invalid.
26
+ * @param {boolean} round - Whether to round to nearest whole number (no decimals).
26
27
  * @returns {object|array}
27
28
  */
28
- export function money(watcher: string | number | object | any[], currency?: string, defaultValue?: any): object | any[];
29
+ export function money(watcher: string | number | object | any[], currency?: string, defaultValue?: any, round?: boolean): object | any[];
30
+ /**
31
+ * Formats a value as money with no decimals (rounded).
32
+ *
33
+ * @param {string|number|object|array} watcher
34
+ * @param {string} currency - Currency symbol.
35
+ * @param {*} defaultValue - Value if original is invalid.
36
+ * @returns {object|array}
37
+ */
38
+ export function roundMoney(watcher: string | number | object | any[], currency?: string, defaultValue?: any): object | any[];
29
39
  /**
30
40
  * Formats a value as a US phone number (10 digits).
31
41
  *
@@ -134,9 +144,9 @@ export namespace Format {
134
144
  *
135
145
  * @param {string|number|object|array} watcher
136
146
  * @param {string} singular - Singular form of the word.
137
- * @param {string} plural - Plural form of the word (optional, adds 's' by default).
147
+ * @param {string|null} plural - Plural form of the word (optional, adds 's' by default).
138
148
  * @param {boolean} includeCount - Whether to include the count in output.
139
149
  * @returns {object|array}
140
150
  */
141
- export function plural(watcher: string | number | object | any[], singular: string, plural?: string, includeCount?: boolean): object | any[];
151
+ export function plural(watcher: string | number | object | any[], singular: string, plural?: string | null, includeCount?: boolean): object | any[];
142
152
  }
package/dist/utils.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { F as e, c } from "./format-BmrNQptv.js";
1
+ import { F as e, c } from "./format-DE4rFWuD.js";
2
2
  import { I as t } from "./image-scaler-1G-JzJVG.js";
3
3
  export {
4
4
  e as Format,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base-framework/ui",
3
- "version": "1.1.18",
3
+ "version": "1.1.19",
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": {