impact-nova 1.8.1 → 1.8.3

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.
Files changed (29) hide show
  1. package/dist/components/ui/ag-grid-react/cell-renderers/default-text-cell-renderer.d.ts +6 -0
  2. package/dist/components/ui/ag-grid-react/cell-renderers/default-text-cell-renderer.js +9 -0
  3. package/dist/components/ui/ag-grid-react/headers/custom-header-group.d.ts +5 -6
  4. package/dist/components/ui/ag-grid-react/headers/custom-header-group.js +19 -19
  5. package/dist/components/ui/ag-grid-react/index.d.ts +1 -1
  6. package/dist/components/ui/ag-grid-react/index.js +164 -165
  7. package/dist/components/ui/button-group.d.ts +10 -6
  8. package/dist/components/ui/button-group.js +1 -2
  9. package/dist/components/ui/calendar.js +2 -3
  10. package/dist/components/ui/combobox.d.ts +1 -0
  11. package/dist/components/ui/combobox.js +116 -102
  12. package/dist/components/ui/date-picker/date-picker.js +52 -50
  13. package/dist/components/ui/date-picker/date-range-picker.js +92 -90
  14. package/dist/components/ui/date-picker/month-picker.js +57 -55
  15. package/dist/components/ui/date-picker/month-range-picker.js +84 -82
  16. package/dist/components/ui/date-picker/multi-date-picker.js +45 -43
  17. package/dist/components/ui/date-picker/week-range-picker.js +77 -75
  18. package/dist/components/ui/expandable-sku/expandable-sku.js +10 -10
  19. package/dist/components/ui/filter-strip/filter-tag-list.d.ts +8 -1
  20. package/dist/components/ui/filter-strip/filter-tag-list.js +99 -85
  21. package/dist/components/ui/input.js +12 -13
  22. package/dist/components/ui/smart-input.d.ts +2 -2
  23. package/dist/components/ui/smart-input.js +52 -51
  24. package/dist/components/ui/textarea.d.ts +10 -8
  25. package/dist/components/ui/textarea.js +52 -52
  26. package/dist/components/ui/types/ag-grid.types.d.ts +5 -0
  27. package/dist/components/ui/types/button-group.types.d.ts +1 -1
  28. package/dist/index.js +425 -426
  29. package/package.json +1 -1
@@ -1,92 +1,106 @@
1
1
  import { jsx as r, jsxs as o } from "react/jsx-runtime";
2
- import * as N from "react";
3
- import k from "../horizontal-scroller/horizontal-scroller.js";
4
- import { TagGroup as S } from "../tag-group.js";
5
- import { Tag as C } from "../tag.js";
6
- import { Tooltip as v, TooltipTrigger as b, TooltipContent as y } from "../tooltip.js";
7
- import { Popover as T, PopoverTrigger as z, PopoverContent as $ } from "../popover.js";
8
- import { Button as j } from "../button.js";
9
- import { Check as I, Copy as P, X as A } from "lucide-react";
10
- const F = ({
2
+ import * as C from "react";
3
+ import S from "../horizontal-scroller/horizontal-scroller.js";
4
+ import { TagGroup as T } from "../tag-group.js";
5
+ import { Tag as k } from "../tag.js";
6
+ import { Tooltip as b, TooltipTrigger as w, TooltipContent as y } from "../tooltip.js";
7
+ import { Popover as z, PopoverTrigger as $, PopoverContent as j } from "../popover.js";
8
+ import { Button as P } from "../button.js";
9
+ import { Check as A, Copy as I, X as O } from "lucide-react";
10
+ const R = ({
11
11
  remainingValues: l,
12
- viewAllTrigger: s = "expand",
13
- onViewAll: d,
14
- onItemRemove: h,
15
- isRemovable: w,
16
- isCopyable: e = !1
12
+ viewAllTrigger: c = "expand",
13
+ onViewAll: p,
14
+ onItemRemove: u,
15
+ isRemovable: N,
16
+ isCopyable: e = !1,
17
+ externalCopyFunction: m
17
18
  }) => {
18
- const [c, p] = N.useState(!1), [u, n] = N.useState(null), m = (a, t, i) => {
19
- navigator.clipboard.writeText(String(t)), n(i), a.currentTarget.blur(), setTimeout(() => n(null), 1500);
20
- }, x = c ? l : l.slice(0, 3), g = l.length > 3, f = () => {
21
- s === "custom" ? d?.() : p(!0);
19
+ const [i, x] = C.useState(!1), [a, d] = C.useState(null), f = (t, s, n) => {
20
+ navigator.clipboard.writeText(String(s)), d(n), t.currentTarget.blur(), setTimeout(() => d(null), 1500);
21
+ }, g = i ? l : l.slice(0, 3), v = l.length > 3, h = () => {
22
+ c === "custom" ? p?.() : x(!0);
22
23
  };
23
24
  return /* @__PURE__ */ r(
24
- $,
25
+ j,
25
26
  {
26
27
  className: "w-[200px] p-0 rounded-[8px] bg-white shadow-[0_0_4px_0_rgba(0,0,0,0.12)] border-none",
27
28
  align: "start",
28
29
  sideOffset: 8,
29
- onOpenAutoFocus: (a) => a.preventDefault(),
30
+ onOpenAutoFocus: (t) => t.preventDefault(),
30
31
  children: /* @__PURE__ */ o("div", { className: "flex flex-col py-2 px-[6px]", children: [
31
- /* @__PURE__ */ r("div", { className: `flex flex-col gap-1 mb-2 ${c ? "max-h-[180px] overflow-y-auto" : ""}`, children: x.map((a, t) => /* @__PURE__ */ o("div", { className: "flex items-center justify-between text-[14px] font-medium leading-[20px] text-[#1f2b4d] px-3 py-2 overflow-hidden hover:bg-slate-50 rounded group shrink-0", children: [
32
- /* @__PURE__ */ o(v, { children: [
33
- /* @__PURE__ */ r(b, { asChild: !0, children: /* @__PURE__ */ r("span", { className: "truncate", children: String(a) }) }),
34
- /* @__PURE__ */ r(y, { variant: "tertiary", side: "right", children: String(a) })
35
- ] }),
36
- /* @__PURE__ */ o("div", { className: "flex items-center shrink-0", children: [
37
- e && /* @__PURE__ */ r(
38
- "button",
39
- {
40
- onClick: (i) => {
41
- i.stopPropagation(), m(i, a, t);
42
- },
43
- "aria-label": `Copy ${String(a)}`,
44
- className: "ml-2 flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-gray-400 hover:bg-black/5 hover:text-gray-600 opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity",
45
- children: u === t ? /* @__PURE__ */ r(I, { size: 12, className: "text-green-500" }) : /* @__PURE__ */ r(P, { size: 12 })
46
- }
47
- ),
48
- w && /* @__PURE__ */ r(
49
- "button",
32
+ /* @__PURE__ */ r(
33
+ "div",
34
+ {
35
+ className: `flex flex-col gap-1 mb-2 ${i ? "max-h-[180px] overflow-y-auto" : ""}`,
36
+ children: g.map((t, s) => /* @__PURE__ */ o(
37
+ "div",
50
38
  {
51
- onClick: (i) => {
52
- i.stopPropagation(), h(a);
53
- },
54
- "aria-label": `Remove ${String(a)}`,
55
- className: "ml-2 flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-gray-400 hover:bg-black/5 hover:text-gray-600 opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity",
56
- children: /* @__PURE__ */ r(A, { size: 12 })
57
- }
58
- )
59
- ] })
60
- ] }, t)) }),
61
- !c && g && /* @__PURE__ */ o("div", { className: "flex flex-col gap-2", children: [
39
+ className: "flex items-center justify-between text-[14px] font-medium leading-[20px] text-[#1f2b4d] px-3 py-2 overflow-hidden hover:bg-slate-50 rounded group shrink-0",
40
+ children: [
41
+ /* @__PURE__ */ o(b, { children: [
42
+ /* @__PURE__ */ r(w, { asChild: !0, children: /* @__PURE__ */ r("span", { className: "truncate", children: String(t) }) }),
43
+ /* @__PURE__ */ r(y, { variant: "tertiary", side: "right", children: String(t) })
44
+ ] }),
45
+ /* @__PURE__ */ o("div", { className: "flex items-center shrink-0", children: [
46
+ e && /* @__PURE__ */ r(
47
+ "button",
48
+ {
49
+ onClick: (n) => {
50
+ n.stopPropagation(), m ? m({ e: n, val: t, index: s }) : f(n, t, s);
51
+ },
52
+ "aria-label": `Copy ${String(t)}`,
53
+ className: "ml-2 flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-gray-400 hover:bg-black/5 hover:text-gray-600 opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity",
54
+ children: a === s ? /* @__PURE__ */ r(A, { size: 12, className: "text-green-500" }) : /* @__PURE__ */ r(I, { size: 12 })
55
+ }
56
+ ),
57
+ N && /* @__PURE__ */ r(
58
+ "button",
59
+ {
60
+ onClick: (n) => {
61
+ n.stopPropagation(), u(t);
62
+ },
63
+ "aria-label": `Remove ${String(t)}`,
64
+ className: "ml-2 flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-gray-400 hover:bg-black/5 hover:text-gray-600 opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity",
65
+ children: /* @__PURE__ */ r(O, { size: 12 })
66
+ }
67
+ )
68
+ ] })
69
+ ]
70
+ },
71
+ s
72
+ ))
73
+ }
74
+ ),
75
+ !i && v && /* @__PURE__ */ o("div", { className: "flex flex-col gap-2", children: [
62
76
  /* @__PURE__ */ r("div", { className: "h-[1px] bg-[#e6e8f0] w-full" }),
63
77
  /* @__PURE__ */ r(
64
- j,
78
+ P,
65
79
  {
66
80
  variant: "secondary",
67
81
  size: "sm",
68
82
  className: "w-full justify-center",
69
- onClick: f,
70
- children: s === "custom" ? "View all" : `View all (${l.length})`
83
+ onClick: h,
84
+ children: c === "custom" ? "View all" : `View all (${l.length})`
71
85
  }
72
86
  )
73
87
  ] })
74
88
  ] })
75
89
  }
76
90
  );
77
- }, q = ({
91
+ }, B = ({
78
92
  filters: l,
79
- onFilterRemove: s,
80
- onOverflowClick: d,
81
- onViewAll: h
93
+ onFilterRemove: c,
94
+ onOverflowClick: p,
95
+ onViewAll: u
82
96
  }) => /* @__PURE__ */ r("div", { className: "flex flex-1 items-center min-w-0", children: /* @__PURE__ */ r(
83
- k,
97
+ S,
84
98
  {
85
99
  items: l,
86
- renderItem: (e, c) => {
87
- const p = Array.isArray(e.value) ? e.value : [e.value], u = p.slice(0, 2), n = p.slice(2), m = !!e.overflow, x = e.overflow?.label ? e.overflow.label : e.overflow?.count ? `+${e.overflow.count}` : null, g = n.length > 0, f = m || g, a = `+${n.length}`;
100
+ renderItem: (e, m) => {
101
+ const i = Array.isArray(e.value) ? e.value : [e.value], x = i.slice(0, 2), a = i.slice(2), d = !!e.overflow, f = e.overflow?.label ? e.overflow.label : e.overflow?.count ? `+${e.overflow.count}` : null, g = a.length > 0, v = d || g, h = `+${a.length}`;
88
102
  return /* @__PURE__ */ o("div", { className: "flex items-center px-1", children: [
89
- c > 0 && /* @__PURE__ */ r("div", { className: "mx-3 h-4 w-[1px] bg-[#e6e8f0] shrink-0" }),
103
+ m > 0 && /* @__PURE__ */ r("div", { className: "mx-3 h-4 w-[1px] bg-[#e6e8f0] shrink-0" }),
90
104
  /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
91
105
  /* @__PURE__ */ o("span", { className: "text-xs font-medium leading-[21px] text-[#60697d] whitespace-nowrap", children: [
92
106
  e.label,
@@ -94,70 +108,70 @@ const F = ({
94
108
  ] }),
95
109
  /* @__PURE__ */ o("div", { className: "flex items-center gap-1", children: [
96
110
  /* @__PURE__ */ r(
97
- S,
111
+ T,
98
112
  {
99
113
  spacing: "sm",
100
- tags: u.map((t) => ({
114
+ tags: x.map((t) => ({
101
115
  label: String(t),
102
116
  variant: "secondary",
103
117
  size: "md",
104
118
  shape: "rounded",
105
119
  removable: e.removable,
106
- onRemove: () => s(e.id, t)
120
+ onRemove: () => c(e.id, t)
107
121
  }))
108
122
  }
109
123
  ),
110
- f && (m ? (
124
+ v && (d ? (
111
125
  // Server-side overflow: Simple tag, no popover
112
- /* @__PURE__ */ o(v, { children: [
113
- /* @__PURE__ */ r(b, { asChild: !0, children: /* @__PURE__ */ r(
114
- C,
126
+ /* @__PURE__ */ o(b, { children: [
127
+ /* @__PURE__ */ r(w, { asChild: !0, children: /* @__PURE__ */ r(
128
+ k,
115
129
  {
116
130
  variant: "secondary",
117
131
  size: "md",
118
132
  shape: "rounded",
119
133
  className: "whitespace-nowrap bg-[#eceefd] text-[#4259ee] hover:bg-[#dce1fc] border-0 h-5 px-2 text-xs font-medium font-['Manrope'] cursor-pointer",
120
- onClick: () => d?.(e.id),
134
+ onClick: () => p?.(e.id),
121
135
  tabIndex: 0,
122
136
  role: "button",
123
- "aria-label": `${e.overflow?.count || n.length} more filters for ${e.label}`,
137
+ "aria-label": `${e.overflow?.count || a.length} more filters for ${e.label}`,
124
138
  onKeyDown: (t) => {
125
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), d?.(e.id));
139
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), p?.(e.id));
126
140
  },
127
- children: x || a
141
+ children: f || h
128
142
  }
129
143
  ) }),
130
144
  /* @__PURE__ */ o(y, { variant: "tertiary", side: "top", children: [
131
- e.overflow?.count || n.length,
145
+ e.overflow?.count || a.length,
132
146
  " more filters"
133
147
  ] })
134
148
  ] })
135
149
  ) : (
136
150
  // Client-side overflow: Popover
137
- /* @__PURE__ */ o(T, { children: [
138
- /* @__PURE__ */ o(v, { children: [
139
- /* @__PURE__ */ r(b, { asChild: !0, children: /* @__PURE__ */ r(z, { asChild: !0, children: /* @__PURE__ */ r(
140
- C,
151
+ /* @__PURE__ */ o(z, { children: [
152
+ /* @__PURE__ */ o(b, { children: [
153
+ /* @__PURE__ */ r(w, { asChild: !0, children: /* @__PURE__ */ r($, { asChild: !0, children: /* @__PURE__ */ r(
154
+ k,
141
155
  {
142
156
  variant: "secondary",
143
157
  size: "md",
144
158
  shape: "rounded",
145
159
  className: "whitespace-nowrap bg-[#eceefd] text-[#4259ee] hover:bg-[#dce1fc] border-0 h-5 px-2 text-xs font-medium font-['Manrope'] cursor-pointer",
146
- children: a
160
+ children: h
147
161
  }
148
162
  ) }) }),
149
163
  /* @__PURE__ */ o(y, { variant: "tertiary", side: "top", children: [
150
- n.length,
164
+ a.length,
151
165
  " more filters"
152
166
  ] })
153
167
  ] }),
154
168
  /* @__PURE__ */ r(
155
- F,
169
+ R,
156
170
  {
157
- remainingValues: n,
171
+ remainingValues: a,
158
172
  viewAllTrigger: e.viewAllTrigger,
159
- onViewAll: h,
160
- onItemRemove: (t) => s(e.id, t),
173
+ onViewAll: u,
174
+ onItemRemove: (t) => c(e.id, t),
161
175
  isRemovable: e.removable,
162
176
  isCopyable: e.copyable
163
177
  }
@@ -173,6 +187,6 @@ const F = ({
173
187
  }
174
188
  ) });
175
189
  export {
176
- F as FilterPopoverContent,
177
- q as FilterTagList
190
+ R as FilterPopoverContent,
191
+ B as FilterTagList
178
192
  };
@@ -29,11 +29,11 @@ const N = g(
29
29
  }
30
30
  ), w = h.forwardRef(
31
31
  ({
32
- className: x,
33
- type: p,
34
- label: r,
32
+ className: p,
33
+ type: x,
34
+ label: i,
35
35
  helperText: s,
36
- helperTextPosition: i = "absolute",
36
+ helperTextPosition: r = "absolute",
37
37
  isError: t,
38
38
  size: b,
39
39
  disabled: n,
@@ -51,16 +51,15 @@ const N = g(
51
51
  "data-invalid": t || void 0,
52
52
  children: [
53
53
  /* @__PURE__ */ d("div", { className: "flex flex-col gap-[6px]", children: [
54
- r && /* @__PURE__ */ d(
54
+ i && /* @__PURE__ */ d(
55
55
  "label",
56
56
  {
57
57
  className: e(
58
58
  "text-xs font-medium leading-[18px] text-content-tertiary",
59
- n && "opacity-70",
60
- t && "text-destructive"
59
+ n && "opacity-70"
61
60
  ),
62
61
  children: [
63
- r,
62
+ i,
64
63
  " ",
65
64
  u.required && /* @__PURE__ */ a("span", { className: "text-destructive", children: "*" })
66
65
  ]
@@ -70,7 +69,7 @@ const N = g(
70
69
  "div",
71
70
  {
72
71
  className: e(
73
- s && i === "absolute" && "relative"
72
+ s && r === "absolute" && "relative"
74
73
  ),
75
74
  children: [
76
75
  /* @__PURE__ */ d(
@@ -78,7 +77,7 @@ const N = g(
78
77
  {
79
78
  "data-component": "input-border",
80
79
  className: e(
81
- N({ size: b, isError: t, disabled: n, className: x }),
80
+ N({ size: b, isError: t, disabled: n, className: p }),
82
81
  "bg-canvas",
83
82
  n && "bg-disabled-surface"
84
83
  ),
@@ -94,7 +93,7 @@ const N = g(
94
93
  /* @__PURE__ */ a(
95
94
  "input",
96
95
  {
97
- type: p,
96
+ type: x,
98
97
  className: e(
99
98
  "flex h-full w-full bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
100
99
  n && "opacity-100 text-disabled-foreground placeholder:text-disabled-foreground"
@@ -116,7 +115,7 @@ const N = g(
116
115
  ]
117
116
  }
118
117
  ),
119
- s && i === "absolute" && /* @__PURE__ */ d(
118
+ s && r === "absolute" && /* @__PURE__ */ d(
120
119
  "div",
121
120
  {
122
121
  className: e(
@@ -151,7 +150,7 @@ const N = g(
151
150
  }
152
151
  )
153
152
  ] }),
154
- s && i === "flow" && /* @__PURE__ */ d(
153
+ s && r === "flow" && /* @__PURE__ */ d(
155
154
  "div",
156
155
  {
157
156
  className: e(
@@ -1,4 +1,4 @@
1
- import { default as React } from 'react';
1
+ import { default as React, HTMLInputTypeAttribute } from 'react';
2
2
  import { InputProps } from './input';
3
3
  type ComparisonOperator = ">" | "<" | ">=" | "<=";
4
4
  export interface SmartInputProps extends Omit<InputProps, "onChange" | "value" | "onFocus" | "onBlur"> {
@@ -6,7 +6,7 @@ export interface SmartInputProps extends Omit<InputProps, "onChange" | "value" |
6
6
  onChange?: (value: string, syntheticEvent?: React.ChangeEvent<HTMLInputElement>) => void;
7
7
  onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
8
8
  onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
9
- isNumeric?: boolean;
9
+ type?: HTMLInputTypeAttribute;
10
10
  allowNegative?: boolean;
11
11
  min?: number;
12
12
  max?: number;
@@ -1,33 +1,33 @@
1
- import { jsx as J } from "react/jsx-runtime";
2
- import { useState as Q, useRef as U, useEffect as X } from "react";
3
- import { Input as Y } from "./input.js";
4
- const re = ({
1
+ import { jsx as H } from "react/jsx-runtime";
2
+ import { useState as J, useRef as Q, useEffect as U } from "react";
3
+ import { Input as X } from "./input.js";
4
+ const ne = ({
5
5
  value: D = "",
6
+ type: C = "text",
6
7
  onChange: V,
7
- onBlur: P,
8
+ onBlur: N,
8
9
  onFocus: W,
9
- isNumeric: l = !1,
10
10
  allowNegative: g = !0,
11
11
  min: s,
12
12
  max: u,
13
13
  min_operator: I = ">=",
14
14
  max_operator: v = "<=",
15
15
  maxIntegerDigits: w,
16
- decimalPlaces: f,
17
- enforceDecimal: z = !1,
18
- allowDecimal: C = !0,
19
- maxLength: a,
20
- trimLeadingSpaces: M = !0,
16
+ decimalPlaces: l,
17
+ enforceDecimal: b = !1,
18
+ allowDecimal: M = !0,
19
+ maxLength: c,
20
+ trimLeadingSpaces: P = !0,
21
21
  customValidator: y,
22
22
  onValidationError: h,
23
23
  disabled: p = !1,
24
- ...F
24
+ ...z
25
25
  }) => {
26
- const [c, $] = Q(String(D ?? "")), K = U(null);
27
- X(() => {
26
+ const [a, $] = J(String(D ?? "")), F = Q(null), i = C === "number";
27
+ U(() => {
28
28
  $(String(D ?? ""));
29
29
  }, [D]);
30
- const b = (t) => {
30
+ const K = (t) => {
31
31
  if (s === void 0) return !0;
32
32
  switch (I) {
33
33
  case ">":
@@ -80,68 +80,69 @@ const re = ({
80
80
  } else if (t.includes("-") && !t.startsWith("-"))
81
81
  return t.replace("-", "");
82
82
  return t;
83
- }, q = (t) => {
84
- if (f === void 0 || !t.includes(".")) return t;
83
+ }, m = (t) => {
84
+ if (l === void 0 || !t.includes(".")) return t;
85
85
  const [e, r] = t.split(".");
86
- return r && r.length > f ? `${e}.${r.slice(0, f)}` : t;
87
- }, A = (t) => {
86
+ return r && r.length > l ? `${e}.${r.slice(0, l)}` : t;
87
+ }, q = (t) => {
88
88
  if (w === void 0) return t;
89
89
  const [e, r] = t.split("."), n = e.replace("-", "");
90
90
  if (n.length > w) {
91
- const i = n.slice(0, w), d = e.startsWith("-") ? "-" : "";
92
- return r !== void 0 ? `${d}${i}.${r}` : `${d}${i}`;
91
+ const o = n.slice(0, w), d = e.startsWith("-") ? "-" : "";
92
+ return r !== void 0 ? `${d}${o}.${r}` : `${d}${o}`;
93
93
  }
94
94
  return t;
95
95
  }, S = (t) => {
96
- if (!l) return t;
96
+ if (!i) return t;
97
97
  let e = String(t ?? "");
98
- return M && (e = e.replace(/^\s+/, "")), e = R(e), e = O(e), e = T(e, t), e = q(e), e = A(e), C || (e = e.replace(".", "")), e;
99
- }, E = (t) => {
100
- if (!l || !t || t === "-") return t;
98
+ return P && (e = e.replace(/^\s+/, "")), e = R(e), e = O(e), e = T(e, t), e = m(e), e = q(e), M || (e = e.replace(".", "")), e;
99
+ }, A = (t) => {
100
+ if (!i || !t || t === "-") return t;
101
101
  let e = t;
102
102
  const r = parseFloat(e);
103
103
  if (isNaN(r)) return "";
104
104
  const n = k(r);
105
- if (z && f !== void 0)
106
- e = n.toFixed(f);
107
- else if (f !== void 0 && e.includes(".")) {
108
- const [i, d = ""] = e.split("."), B = d.padEnd(f, "0");
109
- e = `${i}.${B}`;
105
+ if (b && l !== void 0)
106
+ e = n.toFixed(l);
107
+ else if (l !== void 0 && e.includes(".")) {
108
+ const [o, d = ""] = e.split("."), B = d.padEnd(l, "0");
109
+ e = `${o}.${B}`;
110
110
  } else
111
111
  e = String(n);
112
112
  return e;
113
- }, G = (t) => {
113
+ }, E = (t) => {
114
114
  if (!t) return !0;
115
115
  if (y && !y(t))
116
116
  return h?.("Custom validation failed"), !1;
117
- if (l) {
117
+ if (i) {
118
118
  const e = parseFloat(t);
119
119
  if (isNaN(e))
120
120
  return h?.("Invalid number"), !1;
121
- if (!b(e))
121
+ if (!K(e))
122
122
  return h?.(`Value must be ${I} ${s}`), !1;
123
123
  if (!j(e))
124
124
  return h?.(`Value must be ${v} ${u}`), !1;
125
125
  }
126
- return a && t.length > a ? (h?.(`Maximum length is ${a}`), !1) : !0;
126
+ return c && t.length > c ? (h?.(`Maximum length is ${c}`), !1) : !0;
127
127
  };
128
- return /* @__PURE__ */ J(
129
- Y,
128
+ return /* @__PURE__ */ H(
129
+ X,
130
130
  {
131
- ...F,
132
- value: c,
131
+ ...z,
132
+ type: C,
133
+ value: a,
133
134
  onChange: (t) => {
134
135
  if (p) return;
135
136
  let r = t.target.value;
136
- l ? r = S(r) : M && (r = r.replace(/^\s+/, "")), a && r.length > a && (r = r.slice(0, a)), $(r), V?.(r, t);
137
+ i ? r = S(r) : P && (r = r.replace(/^\s+/, "")), c && r.length > c && (r = r.slice(0, c)), $(r), V?.(r, t);
137
138
  },
138
139
  onBlur: (t) => {
139
- let e = c;
140
- l && e && (e = E(e), G(e) && ($(e), e !== c && V?.(e))), P?.(t);
140
+ let e = a;
141
+ i && e && (e = A(e), E(e) && ($(e), e !== a && V?.(e))), N?.(t);
141
142
  },
142
143
  onFocus: W,
143
144
  onKeyDown: (t) => {
144
- if (p || !l) return;
145
+ if (p || !i) return;
145
146
  const e = t.key;
146
147
  if (e === "e" || e === "E") {
147
148
  t.preventDefault();
@@ -151,11 +152,11 @@ const re = ({
151
152
  t.preventDefault();
152
153
  return;
153
154
  }
154
- if (e === "-" && c.includes("-")) {
155
+ if (e === "-" && a.includes("-")) {
155
156
  t.preventDefault();
156
157
  return;
157
158
  }
158
- if (e === "." && (!C || c.includes("."))) {
159
+ if (e === "." && (!M || a.includes("."))) {
159
160
  t.preventDefault();
160
161
  return;
161
162
  }
@@ -163,20 +164,20 @@ const re = ({
163
164
  onPaste: (t) => {
164
165
  if (p) return;
165
166
  t.preventDefault();
166
- const e = t.clipboardData.getData("text"), r = l ? S(e) : e, n = t.target, i = n.selectionStart || 0, d = n.selectionEnd || 0, B = c.slice(0, i), H = c.slice(d);
167
- let o = B + r + H;
168
- l && (o = S(o)), a && o.length > a && (o = o.slice(0, a)), $(o), V?.(o);
167
+ const e = t.clipboardData.getData("text"), r = i ? S(e) : e, n = t.target, o = n.selectionStart || 0, d = n.selectionEnd || 0, B = a.slice(0, o), G = a.slice(d);
168
+ let f = B + r + G;
169
+ i && (f = S(f)), c && f.length > c && (f = f.slice(0, c)), $(f), V?.(f);
169
170
  },
170
171
  disabled: p,
171
- ref: K,
172
+ ref: F,
172
173
  "data-component": "smart-input",
173
- "data-numeric": l || void 0,
174
- "data-decimal-places": f,
174
+ "data-numeric": i || void 0,
175
+ "data-decimal-places": l,
175
176
  "data-min": s,
176
177
  "data-max": u
177
178
  }
178
179
  );
179
180
  };
180
181
  export {
181
- re as SmartInput
182
+ ne as SmartInput
182
183
  };
@@ -1,17 +1,19 @@
1
- import { VariantProps } from 'class-variance-authority';
2
1
  import { HelperTextPosition } from './types/helper-text.types';
3
2
  import * as React from "react";
4
- declare const textareaVariants: (props?: {
5
- isError?: boolean;
6
- size?: "sm" | "md" | "lg" | "default";
7
- disabled?: boolean;
8
- } & import('class-variance-authority/types').ClassProp) => string;
9
- export interface TextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "disabled" | "size">, VariantProps<typeof textareaVariants> {
3
+ export interface TextareaProps {
4
+ className?: string;
10
5
  label?: string;
6
+ value?: string;
7
+ onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
11
8
  helperText?: React.ReactNode;
12
- /** @default "absolute" */
13
9
  helperTextPosition?: HelperTextPosition;
14
10
  characterLimit?: number;
11
+ isRequired?: boolean;
12
+ isError?: boolean;
13
+ isDisabled?: boolean;
14
+ size?: "default" | "sm" | "md" | "lg";
15
+ defaultValue?: string;
16
+ placeholder?: string;
15
17
  }
16
18
  declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
17
19
  export { Textarea };