@lax-wp/design-system 0.13.33 → 0.13.35

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 (169) hide show
  1. package/dist/components/button/Button.cjs.js +5 -5
  2. package/dist/components/button/Button.cjs.js.map +1 -1
  3. package/dist/components/button/Button.es.js +18 -18
  4. package/dist/components/button/Button.es.js.map +1 -1
  5. package/dist/components/button/IconButton.cjs.js +1 -1
  6. package/dist/components/button/IconButton.cjs.js.map +1 -1
  7. package/dist/components/button/IconButton.es.js +8 -8
  8. package/dist/components/button/IconButton.es.js.map +1 -1
  9. package/dist/components/buttons/option-button/OptionButton.cjs.js +1 -1
  10. package/dist/components/buttons/option-button/OptionButton.cjs.js.map +1 -1
  11. package/dist/components/buttons/option-button/OptionButton.es.js +1 -1
  12. package/dist/components/buttons/option-button/OptionButton.es.js.map +1 -1
  13. package/dist/components/data-display/comparison/components/Header.cjs.js +1 -1
  14. package/dist/components/data-display/comparison/components/Header.cjs.js.map +1 -1
  15. package/dist/components/data-display/comparison/components/Header.es.js +13 -13
  16. package/dist/components/data-display/comparison/components/Header.es.js.map +1 -1
  17. package/dist/components/data-display/infinite-table/body/cell/CheckboxCell.cjs.js +1 -1
  18. package/dist/components/data-display/infinite-table/body/cell/CheckboxCell.cjs.js.map +1 -1
  19. package/dist/components/data-display/infinite-table/body/cell/CheckboxCell.es.js +23 -23
  20. package/dist/components/data-display/infinite-table/body/cell/CheckboxCell.es.js.map +1 -1
  21. package/dist/components/data-display/infinite-table/body/cell/DataCell.cjs.js +1 -1
  22. package/dist/components/data-display/infinite-table/body/cell/DataCell.cjs.js.map +1 -1
  23. package/dist/components/data-display/infinite-table/body/cell/DataCell.es.js +1 -1
  24. package/dist/components/data-display/infinite-table/body/cell/DataCell.es.js.map +1 -1
  25. package/dist/components/data-display/infinite-table/body/rows/index.cjs.js +1 -1
  26. package/dist/components/data-display/infinite-table/body/rows/index.cjs.js.map +1 -1
  27. package/dist/components/data-display/infinite-table/body/rows/index.es.js +104 -101
  28. package/dist/components/data-display/infinite-table/body/rows/index.es.js.map +1 -1
  29. package/dist/components/data-display/infinite-table/constants.cjs.js +1 -1
  30. package/dist/components/data-display/infinite-table/constants.cjs.js.map +1 -1
  31. package/dist/components/data-display/infinite-table/constants.d.ts +6 -0
  32. package/dist/components/data-display/infinite-table/constants.es.js +17 -16
  33. package/dist/components/data-display/infinite-table/constants.es.js.map +1 -1
  34. package/dist/components/data-display/infinite-table/head/CheckAll.cjs.js +1 -1
  35. package/dist/components/data-display/infinite-table/head/CheckAll.cjs.js.map +1 -1
  36. package/dist/components/data-display/infinite-table/head/CheckAll.es.js +4 -4
  37. package/dist/components/data-display/infinite-table/head/CheckAll.es.js.map +1 -1
  38. package/dist/components/data-display/infinite-table/head/index.cjs.js +1 -1
  39. package/dist/components/data-display/infinite-table/head/index.cjs.js.map +1 -1
  40. package/dist/components/data-display/infinite-table/head/index.es.js +5 -5
  41. package/dist/components/data-display/infinite-table/head/index.es.js.map +1 -1
  42. package/dist/components/data-display/infinite-table/index.cjs.js +1 -1
  43. package/dist/components/data-display/infinite-table/index.cjs.js.map +1 -1
  44. package/dist/components/data-display/infinite-table/index.es.js +188 -187
  45. package/dist/components/data-display/infinite-table/index.es.js.map +1 -1
  46. package/dist/components/data-display/infinite-table/useRowHeight.cjs.js +2 -0
  47. package/dist/components/data-display/infinite-table/useRowHeight.cjs.js.map +1 -0
  48. package/dist/components/data-display/infinite-table/useRowHeight.d.ts +15 -0
  49. package/dist/components/data-display/infinite-table/useRowHeight.es.js +24 -0
  50. package/dist/components/data-display/infinite-table/useRowHeight.es.js.map +1 -0
  51. package/dist/components/data-display/tag/Tag.cjs.js +1 -1
  52. package/dist/components/data-display/tag/Tag.cjs.js.map +1 -1
  53. package/dist/components/data-display/tag/Tag.es.js +11 -9
  54. package/dist/components/data-display/tag/Tag.es.js.map +1 -1
  55. package/dist/components/floating-bar/FloatingBar.cjs.js +1 -1
  56. package/dist/components/floating-bar/FloatingBar.cjs.js.map +1 -1
  57. package/dist/components/floating-bar/FloatingBar.es.js +9 -9
  58. package/dist/components/floating-bar/FloatingBar.es.js.map +1 -1
  59. package/dist/components/forms/base-input-field/BaseInputField.cjs.js +2 -2
  60. package/dist/components/forms/base-input-field/BaseInputField.cjs.js.map +1 -1
  61. package/dist/components/forms/base-input-field/BaseInputField.es.js +40 -42
  62. package/dist/components/forms/base-input-field/BaseInputField.es.js.map +1 -1
  63. package/dist/components/forms/creatable-select/CreatableSelect.cjs.js +1 -1
  64. package/dist/components/forms/creatable-select/CreatableSelect.cjs.js.map +1 -1
  65. package/dist/components/forms/creatable-select/CreatableSelect.es.js +14 -15
  66. package/dist/components/forms/creatable-select/CreatableSelect.es.js.map +1 -1
  67. package/dist/components/forms/currency-input/CurrencyInputField.cjs.js +1 -1
  68. package/dist/components/forms/currency-input/CurrencyInputField.cjs.js.map +1 -1
  69. package/dist/components/forms/currency-input/CurrencyInputField.es.js +57 -65
  70. package/dist/components/forms/currency-input/CurrencyInputField.es.js.map +1 -1
  71. package/dist/components/forms/date-time-field/DateTimeField.cjs.js +1 -1
  72. package/dist/components/forms/date-time-field/DateTimeField.cjs.js.map +1 -1
  73. package/dist/components/forms/date-time-field/DateTimeField.es.js +33 -33
  74. package/dist/components/forms/date-time-field/DateTimeField.es.js.map +1 -1
  75. package/dist/components/forms/debounce-input/DebounceInputField.cjs.js +1 -1
  76. package/dist/components/forms/debounce-input/DebounceInputField.cjs.js.map +1 -1
  77. package/dist/components/forms/debounce-input/DebounceInputField.es.js +2 -2
  78. package/dist/components/forms/debounce-input/DebounceInputField.es.js.map +1 -1
  79. package/dist/components/forms/dynamic-data-input/DynamicDataInput.cjs.js +1 -1
  80. package/dist/components/forms/dynamic-data-input/DynamicDataInput.cjs.js.map +1 -1
  81. package/dist/components/forms/dynamic-data-input/DynamicDataInput.es.js +7 -7
  82. package/dist/components/forms/dynamic-data-input/DynamicDataInput.es.js.map +1 -1
  83. package/dist/components/forms/dynamic-data-input/DynamicDataInputField.cjs.js +1 -1
  84. package/dist/components/forms/dynamic-data-input/DynamicDataInputField.cjs.js.map +1 -1
  85. package/dist/components/forms/dynamic-data-input/DynamicDataInputField.es.js +17 -19
  86. package/dist/components/forms/dynamic-data-input/DynamicDataInputField.es.js.map +1 -1
  87. package/dist/components/forms/field-options/Item.cjs.js +1 -1
  88. package/dist/components/forms/field-options/Item.cjs.js.map +1 -1
  89. package/dist/components/forms/field-options/Item.es.js +5 -5
  90. package/dist/components/forms/field-options/Item.es.js.map +1 -1
  91. package/dist/components/forms/formula-input/FormulaInput.cjs.js +1 -1
  92. package/dist/components/forms/formula-input/FormulaInput.cjs.js.map +1 -1
  93. package/dist/components/forms/formula-input/FormulaInput.es.js +10 -10
  94. package/dist/components/forms/formula-input/FormulaInput.es.js.map +1 -1
  95. package/dist/components/forms/icon-picker/IconPicker.cjs.js +1 -1
  96. package/dist/components/forms/icon-picker/IconPicker.cjs.js.map +1 -1
  97. package/dist/components/forms/icon-picker/IconPicker.es.js +42 -57
  98. package/dist/components/forms/icon-picker/IconPicker.es.js.map +1 -1
  99. package/dist/components/forms/input-field/InputField.cjs.js.map +1 -1
  100. package/dist/components/forms/input-field/InputField.es.js.map +1 -1
  101. package/dist/components/forms/master-data-input/MasterDataInputField.cjs.js +1 -1
  102. package/dist/components/forms/master-data-input/MasterDataInputField.cjs.js.map +1 -1
  103. package/dist/components/forms/master-data-input/MasterDataInputField.es.js +54 -60
  104. package/dist/components/forms/master-data-input/MasterDataInputField.es.js.map +1 -1
  105. package/dist/components/forms/md-input/RichMarkdownInput.cjs.js +3 -3
  106. package/dist/components/forms/md-input/RichMarkdownInput.cjs.js.map +1 -1
  107. package/dist/components/forms/md-input/RichMarkdownInput.es.js +63 -63
  108. package/dist/components/forms/md-input/RichMarkdownInput.es.js.map +1 -1
  109. package/dist/components/forms/number-input-field/NumberInputField.cjs.js +1 -1
  110. package/dist/components/forms/number-input-field/NumberInputField.cjs.js.map +1 -1
  111. package/dist/components/forms/number-input-field/NumberInputField.es.js +5 -5
  112. package/dist/components/forms/number-input-field/NumberInputField.es.js.map +1 -1
  113. package/dist/components/forms/percentage-input/PercentageInputField.cjs.js +2 -2
  114. package/dist/components/forms/percentage-input/PercentageInputField.cjs.js.map +1 -1
  115. package/dist/components/forms/percentage-input/PercentageInputField.es.js +20 -20
  116. package/dist/components/forms/percentage-input/PercentageInputField.es.js.map +1 -1
  117. package/dist/components/forms/search-bar/SearchBar.cjs.js +1 -1
  118. package/dist/components/forms/search-bar/SearchBar.cjs.js.map +1 -1
  119. package/dist/components/forms/search-bar/SearchBar.es.js +16 -16
  120. package/dist/components/forms/search-bar/SearchBar.es.js.map +1 -1
  121. package/dist/components/forms/select-field/SelectField.cjs.js +2 -2
  122. package/dist/components/forms/select-field/SelectField.cjs.js.map +1 -1
  123. package/dist/components/forms/select-field/SelectField.d.ts +4 -0
  124. package/dist/components/forms/select-field/SelectField.es.js +202 -203
  125. package/dist/components/forms/select-field/SelectField.es.js.map +1 -1
  126. package/dist/components/forms/text-area-field/TextAreaField.cjs.js +1 -1
  127. package/dist/components/forms/text-area-field/TextAreaField.cjs.js.map +1 -1
  128. package/dist/components/forms/text-area-field/TextAreaField.es.js +14 -14
  129. package/dist/components/forms/text-area-field/TextAreaField.es.js.map +1 -1
  130. package/dist/components/forms/toggle/Toggle.cjs.js +1 -1
  131. package/dist/components/forms/toggle/Toggle.cjs.js.map +1 -1
  132. package/dist/components/forms/toggle/Toggle.es.js +65 -59
  133. package/dist/components/forms/toggle/Toggle.es.js.map +1 -1
  134. package/dist/components/navigation/accordion/Accordion.cjs.js +1 -1
  135. package/dist/components/navigation/accordion/Accordion.cjs.js.map +1 -1
  136. package/dist/components/navigation/accordion/Accordion.es.js +5 -5
  137. package/dist/components/navigation/accordion/Accordion.es.js.map +1 -1
  138. package/dist/components/navigation/stepper/Stepper.cjs.js +1 -1
  139. package/dist/components/navigation/stepper/Stepper.cjs.js.map +1 -1
  140. package/dist/components/navigation/stepper/Stepper.es.js +1 -1
  141. package/dist/components/navigation/stepper/Stepper.es.js.map +1 -1
  142. package/dist/components/navigation/tabs/TabOptions.cjs.js +1 -1
  143. package/dist/components/navigation/tabs/TabOptions.cjs.js.map +1 -1
  144. package/dist/components/navigation/tabs/TabOptions.es.js +15 -15
  145. package/dist/components/navigation/tabs/TabOptions.es.js.map +1 -1
  146. package/dist/components/navigation/tabs/TabSwitch.cjs.js +1 -1
  147. package/dist/components/navigation/tabs/TabSwitch.cjs.js.map +1 -1
  148. package/dist/components/navigation/tabs/TabSwitch.es.js +7 -7
  149. package/dist/components/navigation/tabs/TabSwitch.es.js.map +1 -1
  150. package/dist/components/navigation/tabs/Tabs.cjs.js +1 -1
  151. package/dist/components/navigation/tabs/Tabs.cjs.js.map +1 -1
  152. package/dist/components/navigation/tabs/Tabs.es.js +1 -1
  153. package/dist/components/navigation/tabs/Tabs.es.js.map +1 -1
  154. package/dist/components/tooltip/Tooltip.cjs.js +1 -1
  155. package/dist/components/tooltip/Tooltip.cjs.js.map +1 -1
  156. package/dist/components/tooltip/Tooltip.es.js +19 -19
  157. package/dist/components/tooltip/Tooltip.es.js.map +1 -1
  158. package/dist/components/user-avatar/UserAvatar.cjs.js +1 -1
  159. package/dist/components/user-avatar/UserAvatar.cjs.js.map +1 -1
  160. package/dist/components/user-avatar/UserAvatar.d.ts +1 -1
  161. package/dist/components/user-avatar/UserAvatar.es.js +40 -38
  162. package/dist/components/user-avatar/UserAvatar.es.js.map +1 -1
  163. package/dist/components/user-avatar/constants.cjs.js +1 -1
  164. package/dist/components/user-avatar/constants.cjs.js.map +1 -1
  165. package/dist/components/user-avatar/constants.d.ts +1 -0
  166. package/dist/components/user-avatar/constants.es.js +10 -9
  167. package/dist/components/user-avatar/constants.es.js.map +1 -1
  168. package/dist/design-system.css +1 -1
  169. package/package.json +2 -3
@@ -1,13 +1,13 @@
1
1
  import { jsx as t, jsxs as b } from "react/jsx-runtime";
2
2
  import v from "../../../_virtual/index.es.js";
3
- import N, { Suspense as I, useState as x, useRef as g, useEffect as P } from "react";
3
+ import N, { Suspense as I, useState as w, useRef as g, useEffect as P } from "react";
4
4
  import { FixedSizeGrid as S } from "react-window";
5
5
  import * as h from "@mui/icons-material";
6
6
  import { IconButton as R } from "@mui/material";
7
7
  import { Popover as D, Tooltip as L } from "antd";
8
8
  import { Typography as k } from "../../data-display/typography/Typography.es.js";
9
9
  import { InputField as E } from "../input-field/InputField.es.js";
10
- import { COUNTRY_CODES as O, countryNameFromCode as w } from "../../../types/icon-picker.es.js";
10
+ import { COUNTRY_CODES as O, countryNameFromCode as x } from "../../../types/icon-picker.es.js";
11
11
  import { getFlagComponent as T } from "../../../utils/countryFlags.es.js";
12
12
  import { InputLabel as j } from "../shared/InputLabel.es.js";
13
13
  const W = Object.keys(h).filter(
@@ -17,23 +17,23 @@ const W = Object.keys(h).filter(
17
17
  ...(O || []).map((e) => `flag-${e}`)
18
18
  ], z = (e) => {
19
19
  if (e?.startsWith("flag-")) {
20
- const l = e?.replace("flag-", "");
21
- return w(l || "") || l;
20
+ const a = e?.replace("flag-", "");
21
+ return x(a || "") || a;
22
22
  }
23
23
  return e.replaceAll(/([A-Z])/g, " $1").trim();
24
24
  }, B = ({
25
25
  onChange: e,
26
- selectedIcon: l,
26
+ selectedIcon: a,
27
27
  setOpen: u
28
28
  }) => {
29
- const [i, f] = x(""), a = ($ || []).filter((r) => {
29
+ const [c, f] = w(""), l = ($ || []).filter((r) => {
30
30
  if (r?.startsWith("flag-")) {
31
31
  const n = r?.replace("flag-", "");
32
- return n?.toLowerCase()?.includes(i?.trim()?.toLowerCase() || "") || w(n || "")?.toLowerCase()?.includes(i?.trim()?.toLowerCase() || "");
32
+ return n?.toLowerCase()?.includes(c?.trim()?.toLowerCase() || "") || x(n || "")?.toLowerCase()?.includes(c?.trim()?.toLowerCase() || "");
33
33
  }
34
- return r?.trim()?.toLowerCase()?.includes(i?.trim()?.toLowerCase() || "");
35
- }), d = (r, n) => {
36
- if (n.stopPropagation(), l === r) {
34
+ return r?.trim()?.toLowerCase()?.includes(c?.trim()?.toLowerCase() || "");
35
+ }), m = (r, n) => {
36
+ if (n.stopPropagation(), a === r) {
37
37
  e?.(null);
38
38
  return;
39
39
  }
@@ -53,53 +53,39 @@ const W = Object.keys(h).filter(
53
53
  id: "input-field-icon-picker",
54
54
  placeholder: "Search icons...",
55
55
  onChange: (r) => f(r || ""),
56
- fieldSuffix: /* @__PURE__ */ t(
57
- h.Search,
58
- {
59
- sx: {
60
- width: 16,
61
- height: 16,
62
- color: "rgb(152 162 179)"
63
- // neutral-400
64
- }
65
- }
66
- )
56
+ fieldSuffix: /* @__PURE__ */ t(h.Search, { className: "!w-4 !h-4 text-neutral-400" })
67
57
  }
68
58
  ),
69
59
  /* @__PURE__ */ t(
70
60
  S,
71
61
  {
72
62
  columnCount: 5,
73
- rowCount: Math.ceil((a?.length || 0) / 5),
63
+ rowCount: Math.ceil((l?.length || 0) / 5),
74
64
  columnWidth: 40,
75
65
  rowHeight: 40,
76
66
  width: 220,
77
67
  height: 240,
78
- children: ({ columnIndex: r, rowIndex: n, style: m }) => {
79
- const p = n * 5 + r, c = a?.[p];
80
- return c ? /* @__PURE__ */ t("div", { style: { ...m, padding: "4px" }, children: /* @__PURE__ */ t(L, { title: z(c), placement: "bottom", children: /* @__PURE__ */ t(
68
+ children: ({ columnIndex: r, rowIndex: n, style: d }) => {
69
+ const p = n * 5 + r, i = l?.[p];
70
+ return i ? /* @__PURE__ */ t("div", { style: d, className: "p-1", children: /* @__PURE__ */ t(L, { title: z(i), placement: "bottom", children: /* @__PURE__ */ t(
81
71
  R,
82
72
  {
83
73
  type: "button",
84
74
  className: v(
85
75
  "flex items-center justify-center !rounded-md hover:bg-neutral-200 dark:hover:bg-black-700",
86
76
  {
87
- "!bg-primary-50 dark:!bg-black-800": l === c
77
+ "!bg-primary-50 dark:!bg-black-800": a === i
88
78
  }
89
79
  ),
90
- onClick: (s) => d(c, s),
80
+ onClick: (s) => m(i, s),
91
81
  onKeyDown: (s) => {
92
82
  s.key === "Enter" && (s.preventDefault(), s.stopPropagation());
93
83
  },
94
84
  children: /* @__PURE__ */ t(
95
85
  y,
96
86
  {
97
- iconName: c,
98
- sx: {
99
- width: 20,
100
- height: 20
101
- },
102
- className: "text-neutral-900 dark:text-white"
87
+ iconName: i,
88
+ className: "!w-5 !h-5 text-neutral-900 dark:text-white"
103
89
  }
104
90
  )
105
91
  }
@@ -110,29 +96,29 @@ const W = Object.keys(h).filter(
110
96
  ]
111
97
  }
112
98
  );
113
- }, y = ({ iconName: e, sx: l, className: u, isHovering: i }) => {
99
+ }, y = ({ iconName: e, sx: a, className: u, isHovering: c }) => {
114
100
  if (e?.startsWith?.("flag-")) {
115
- const a = e?.replace("flag-", "");
116
- return T?.(a || "", i || !1) || /* @__PURE__ */ t("div", { children: "-" });
101
+ const l = e?.replace("flag-", "");
102
+ return T?.(l || "", c || !1) || /* @__PURE__ */ t("div", { children: "-" });
117
103
  }
118
104
  const f = h?.[e];
119
- return f ? /* @__PURE__ */ t(f, { sx: l, className: u, isHovering: i }) : /* @__PURE__ */ t("div", { children: "-" });
105
+ return f ? /* @__PURE__ */ t(f, { sx: a, className: u, isHovering: c }) : /* @__PURE__ */ t("div", { children: "-" });
120
106
  }, F = ({
121
107
  selectedIcon: e,
122
- onChange: l,
108
+ onChange: a,
123
109
  label: u,
124
- required: i = !1,
110
+ required: c = !1,
125
111
  allowClear: f = !0,
126
- disabled: a = !1,
127
- errorMessage: d,
112
+ disabled: l = !1,
113
+ errorMessage: m,
128
114
  dropdownPosition: r = "bottom"
129
115
  }) => {
130
- const [n, m] = x(!1), p = g(!1), c = g(null), s = g(!1);
116
+ const [n, d] = w(!1), p = g(!1), i = g(null), s = g(!1);
131
117
  P(() => {
132
- s.current && !n && c.current?.focus(), s.current = n;
118
+ s.current && !n && i.current?.focus(), s.current = n;
133
119
  }, [n]);
134
120
  const C = (o) => {
135
- o.stopPropagation(), l?.("");
121
+ o.stopPropagation(), a?.("");
136
122
  };
137
123
  return /* @__PURE__ */ t(
138
124
  D,
@@ -143,21 +129,21 @@ const W = Object.keys(h).filter(
143
129
  getPopupContainer: (o) => o?.parentElement || document.body,
144
130
  open: n,
145
131
  onOpenChange: (o) => {
146
- o ? (p.current && m(!0), p.current = !1) : m(!1);
132
+ o ? (p.current && d(!0), p.current = !1) : d(!1);
147
133
  },
148
- content: /* @__PURE__ */ t(B, { onChange: l, selectedIcon: e, setOpen: m }),
134
+ content: /* @__PURE__ */ t(B, { onChange: a, selectedIcon: e, setOpen: d }),
149
135
  children: /* @__PURE__ */ b("div", { className: "flex flex-col gap-1", children: [
150
- u ? /* @__PURE__ */ t(j, { label: u || "", required: i || !1 }) : null,
136
+ u ? /* @__PURE__ */ t(j, { label: u || "", required: c || !1 }) : null,
151
137
  /* @__PURE__ */ b(
152
138
  "button",
153
139
  {
154
- ref: c,
140
+ ref: i,
155
141
  type: "button",
156
142
  id: `btn-icon-picker-icon-${e ? "selected" : "unselected"}`,
157
- className: `lax-form-trigger min-w-[83px] py-1.5 px-3 rounded-md border ${a ? "cursor-not-allowed opacity-60 bg-neutral-50 dark:bg-black-800" : "bg-white dark:bg-black-800"} ${d ? "border-red-500" : "focus:border-primary-600 dark:focus:border-primary-400"} flex items-center justify-between gap-2`,
158
- disabled: a,
143
+ className: `lax-form-trigger min-w-[83px] py-1.5 px-3 rounded-md border ${l ? "cursor-not-allowed opacity-60 bg-neutral-50 dark:bg-black-800" : "bg-white dark:bg-black-800"} ${m ? "border-red-500" : "focus:border-primary-600 dark:focus:border-primary-400"} flex items-center justify-between gap-2`,
144
+ disabled: l,
159
145
  onClick: (o) => {
160
- if (a) {
146
+ if (l) {
161
147
  o.preventDefault(), o.stopPropagation();
162
148
  return;
163
149
  }
@@ -167,7 +153,7 @@ const W = Object.keys(h).filter(
167
153
  o.key === "Enter" && (o.preventDefault(), n || o.currentTarget.closest("form")?.querySelector('button[type="submit"]')?.click());
168
154
  },
169
155
  children: [
170
- e ? /* @__PURE__ */ t(y, { iconName: e, sx: { width: 20, height: 20 }, className: "text-neutral-900 dark:text-white" }) : /* @__PURE__ */ t(
156
+ e ? /* @__PURE__ */ t(y, { iconName: e, className: "!w-5 !h-5 text-neutral-900 dark:text-white" }) : /* @__PURE__ */ t(
171
157
  k,
172
158
  {
173
159
  size: "small",
@@ -176,24 +162,23 @@ const W = Object.keys(h).filter(
176
162
  children: "Select Icon"
177
163
  }
178
164
  ),
179
- e && f && !a ? /* @__PURE__ */ t(
165
+ e && f && !l ? /* @__PURE__ */ t(
180
166
  h.CloseRounded,
181
167
  {
182
- sx: { width: 20, height: 20 },
183
- className: "hover:bg-neutral-100 dark:hover:bg-black-800 rounded-full transition-colors cursor-pointer text-neutral-400 dark:text-neutral-500",
168
+ className: "!w-5 !h-5 hover:bg-neutral-100 dark:hover:bg-black-800 rounded-full transition-colors cursor-pointer text-neutral-400 dark:text-neutral-500",
184
169
  onClick: C
185
170
  }
186
171
  ) : null
187
172
  ]
188
173
  }
189
174
  ),
190
- d && /* @__PURE__ */ t(k, { size: "extra-small", className: "text-red-500 font-medium", children: d })
175
+ m && /* @__PURE__ */ t(k, { size: "extra-small", className: "text-red-500 font-medium", children: m })
191
176
  ] })
192
177
  }
193
178
  );
194
179
  }, M = N.lazy(
195
180
  () => Promise.resolve({
196
- default: (e) => /* @__PURE__ */ t(I, { fallback: /* @__PURE__ */ t("div", { className: "min-w-[83px] h-[30px] animate-pulse bg-neutral-100 dark:bg-black-800 rounded-md" }), children: /* @__PURE__ */ t(F, { ...e }) })
181
+ default: (e) => /* @__PURE__ */ t(I, { fallback: /* @__PURE__ */ t("div", { className: "min-w-20 h-8 animate-pulse bg-neutral-100 dark:bg-black-800 rounded-md" }), children: /* @__PURE__ */ t(F, { ...e }) })
197
182
  })
198
183
  );
199
184
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"IconPicker.es.js","sources":["../../../../src/components/forms/icon-picker/IconPicker.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport React, { Suspense, useEffect, useRef, useState } from 'react';\nimport { FixedSizeGrid, type GridChildComponentProps } from 'react-window';\nimport * as AllIcons from '@mui/icons-material';\nimport { IconButton, type SvgIconOwnProps } from '@mui/material';\nimport { Popover, Tooltip } from \"antd\";\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { InputField } from \"../input-field/InputField\";\nimport { COUNTRY_CODES, countryNameFromCode } from \"../../../types/icon-picker\";\nimport { getFlagComponent } from \"../../../utils/countryFlags\";\nimport { InputLabel } from '../shared/InputLabel';\n\nconst roundedIconNames = Object.keys(AllIcons).filter((name) =>\n name?.endsWith(\"Rounded\")\n);\n\n// Merge icon names and country codes for the picker\nconst mergedIconNames = [\n ...(roundedIconNames || []),\n ...(COUNTRY_CODES || []).map((code) => `flag-${code}`),\n];\n\n// Utility function to convert camelCase to human-readable format\nconst formatIconName = (iconName: string): string => {\n // Handle flag icons\n if (iconName?.startsWith(\"flag-\")) {\n const code = iconName?.replace(\"flag-\", \"\");\n return countryNameFromCode(code || \"\") || code;\n }\n\n // Convert camelCase to space-separated words\n // e.g., \"PersonRounded\" -> \"Person Rounded\"\n return iconName.replaceAll(/([A-Z])/g, \" $1\").trim();\n};\n\n/** Ant Design `Popover` placement for the icon panel (bottom edge of the trigger). */\nexport type IconPickerDropdownPosition = 'bottom' | 'bottomLeft' | 'bottomRight';\n\nexport interface IconPickerContentProps {\n selectedIcon: string | null;\n onChange: (iconName: string | null) => void;\n label?: string;\n required?: boolean;\n allowClear?: boolean;\n disabled?: boolean;\n errorMessage?: string;\n /** Popover placement: `bottom` | `bottomLeft` | `bottomRight`. Default: `bottom`. */\n dropdownPosition?: IconPickerDropdownPosition;\n}\n\ninterface IconPickerContentInternalProps {\n onChange: (iconName: string | null) => void;\n selectedIcon: string | null;\n setOpen?: React.Dispatch<React.SetStateAction<boolean>>;\n}\n\nconst IconPickerContent = ({\n onChange,\n selectedIcon,\n setOpen,\n}: IconPickerContentInternalProps) => {\n const [searchTerm, setSearchTerm] = useState<string>(\"\");\n\n // Filter both icons and flags\n const filteredIcons = (mergedIconNames || []).filter((name) => {\n if (name?.startsWith(\"flag-\")) {\n // For flags, allow search by country code or country name\n const code = name?.replace(\"flag-\", \"\");\n return (\n code\n ?.toLowerCase()\n ?.includes(searchTerm?.trim()?.toLowerCase() || \"\") ||\n countryNameFromCode(code || \"\")\n ?.toLowerCase()\n ?.includes(searchTerm?.trim()?.toLowerCase() || \"\")\n );\n }\n return name\n ?.trim()\n ?.toLowerCase()\n ?.includes(searchTerm?.trim()?.toLowerCase() || \"\");\n });\n\n const handleClick = (icon: string, event: React.MouseEvent) => {\n event.stopPropagation();\n if (selectedIcon === icon) {\n onChange?.(null);\n return;\n }\n onChange?.(icon);\n setOpen?.(false);\n };\n\n return (\n <div \n className=\"flex flex-col gap-3\"\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n }\n }}\n >\n <InputField\n id={`input-field-icon-picker`}\n placeholder=\"Search icons...\"\n onChange={(value) => setSearchTerm(value || \"\")}\n fieldSuffix={\n <AllIcons.Search\n sx={{\n width: 16,\n height: 16,\n color: \"rgb(152 162 179)\", // neutral-400\n }}\n />\n }\n />\n <FixedSizeGrid\n columnCount={5}\n rowCount={Math.ceil((filteredIcons?.length || 0) / 5)}\n columnWidth={40}\n rowHeight={40}\n width={220}\n height={240}\n >\n {({ columnIndex, rowIndex, style }: GridChildComponentProps) => {\n const itemIndex = rowIndex * 5 + columnIndex;\n const iconName = filteredIcons?.[itemIndex];\n return iconName ? (\n <div style={{ ...style, padding: \"4px\" }}>\n <Tooltip title={formatIconName(iconName)} placement='bottom'>\n <IconButton\n type='button'\n className={classNames(\n \"flex items-center justify-center !rounded-md hover:bg-neutral-200 dark:hover:bg-black-700\",\n {\n \"!bg-primary-50 dark:!bg-black-800\":\n selectedIcon === iconName,\n }\n )}\n onClick={(event) => handleClick(iconName, event)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n }\n }}\n >\n <IconRenderer\n iconName={iconName}\n sx={{\n width: 20,\n height: 20,\n }}\n className=\"text-neutral-900 dark:text-white\"\n />\n </IconButton>\n </Tooltip>\n </div>\n ) : null;\n }}\n </FixedSizeGrid>\n </div>\n );\n};\n\ninterface IconRendererProps {\n iconName: string;\n sx?: SvgIconOwnProps['sx'];\n className?: string;\n isHovering?: boolean;\n}\n\nexport const IconRenderer = ({ iconName, sx, className, isHovering }: IconRendererProps) => {\n // Render flag if iconName starts with 'flag-'\n if (iconName?.startsWith?.('flag-')) {\n const code = iconName?.replace('flag-', '');\n return getFlagComponent?.(code || '', isHovering || false) || <div>-</div>;\n }\n const Icon = AllIcons?.[iconName as keyof typeof AllIcons] as React.ComponentType<{\n sx?: SvgIconOwnProps['sx'];\n className?: string;\n isHovering?: boolean;\n }>;\n\n if (!Icon) {\n return <div>-</div>;\n }\n\n return <Icon sx={sx} className={className} isHovering={isHovering} />;\n};\n\nconst IconPickerBase = ({\n selectedIcon,\n onChange,\n label,\n required = false,\n allowClear = true,\n disabled = false,\n errorMessage,\n dropdownPosition = 'bottom',\n}: IconPickerContentProps) => {\n const [open, setOpen] = useState(false);\n const mouseClickRef = useRef(false);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const wasOpenRef = useRef(false);\n\n useEffect(() => {\n if (wasOpenRef.current && !open) {\n buttonRef.current?.focus();\n }\n wasOpenRef.current = open;\n }, [open]);\n const handleClearIcon = (e: React.MouseEvent) => {\n e.stopPropagation();\n onChange?.('');\n };\n\n return (\n <Popover\n arrow={false}\n placement={dropdownPosition}\n trigger='click'\n getPopupContainer={(triggerNode) => triggerNode?.parentElement || document.body}\n open={open}\n onOpenChange={(newOpen) => {\n if (newOpen) {\n if (mouseClickRef.current) {\n setOpen(true);\n }\n mouseClickRef.current = false;\n } else {\n setOpen(false);\n }\n }}\n content={<IconPickerContent onChange={onChange} selectedIcon={selectedIcon} setOpen={setOpen} />}\n >\n <div className='flex flex-col gap-1'>\n {label ? (\n <InputLabel label={label || \"\"} required={required || false} />\n ) : null}\n <button\n ref={buttonRef}\n type='button'\n id={`btn-icon-picker-icon-${selectedIcon ? 'selected' : 'unselected'}`}\n className={`lax-form-trigger min-w-[83px] py-1.5 px-3 rounded-md border ${\n disabled ? 'cursor-not-allowed opacity-60 bg-neutral-50 dark:bg-black-800' : 'bg-white dark:bg-black-800'\n } ${errorMessage ? 'border-red-500' : 'focus:border-primary-600 dark:focus:border-primary-400'} flex items-center justify-between gap-2`}\n disabled={disabled}\n onClick={(e) => {\n if (disabled) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n if (e.detail > 0) {\n mouseClickRef.current = true;\n }\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n if (!open) {\n const form = (e.currentTarget as HTMLElement).closest('form');\n const submitBtn = form?.querySelector('button[type=\"submit\"]') as HTMLButtonElement | null;\n submitBtn?.click();\n }\n }\n }}\n >\n {selectedIcon ? (\n <IconRenderer iconName={selectedIcon} sx={{ width: 20, height: 20 }} className='text-neutral-900 dark:text-white' />\n ) : (\n <Typography\n size='small'\n variant='medium'\n appearance='subtitle'\n >\n Select Icon\n </Typography>\n )}\n {selectedIcon && allowClear && !disabled ? (\n <AllIcons.CloseRounded\n sx={{ width: 20, height: 20 }}\n className='hover:bg-neutral-100 dark:hover:bg-black-800 rounded-full transition-colors cursor-pointer text-neutral-400 dark:text-neutral-500'\n onClick={handleClearIcon}\n />\n ) : (\n null\n )}\n </button>\n {errorMessage && (\n <Typography size='extra-small' className='text-red-500 font-medium'>\n {errorMessage}\n </Typography>\n )}\n </div>\n </Popover>\n );\n};\n\nexport const IconPicker = React.lazy(() =>\n Promise.resolve({\n default: (props: IconPickerContentProps) => (\n <Suspense fallback={<div className='min-w-[83px] h-[30px] animate-pulse bg-neutral-100 dark:bg-black-800 rounded-md' />}>\n <IconPickerBase {...props} />\n </Suspense>\n ),\n }),\n);\n\n"],"names":["roundedIconNames","AllIcons","name","mergedIconNames","COUNTRY_CODES","code","formatIconName","iconName","countryNameFromCode","IconPickerContent","onChange","selectedIcon","setOpen","searchTerm","setSearchTerm","useState","filteredIcons","handleClick","icon","event","jsxs","e","jsx","InputField","value","FixedSizeGrid","columnIndex","rowIndex","style","itemIndex","Tooltip","IconButton","classNames","IconRenderer","sx","className","isHovering","getFlagComponent","Icon","IconPickerBase","label","required","allowClear","disabled","errorMessage","dropdownPosition","open","mouseClickRef","useRef","buttonRef","wasOpenRef","useEffect","handleClearIcon","Popover","triggerNode","newOpen","InputLabel","Typography","IconPicker","React","props","Suspense"],"mappings":";;;;;;;;;;;;AAYA,MAAMA,IAAmB,OAAO,KAAKC,CAAQ,EAAE;AAAA,EAAO,CAACC,MACrDA,GAAM,SAAS,SAAS;AAC1B,GAGMC,IAAkB;AAAA,EACtB,GAAIH,KAAoB,CAAA;AAAA,EACxB,IAAII,KAAiB,CAAA,GAAI,IAAI,CAACC,MAAS,QAAQA,CAAI,EAAE;AACvD,GAGMC,IAAiB,CAACC,MAA6B;AAEnD,MAAIA,GAAU,WAAW,OAAO,GAAG;AACjC,UAAMF,IAAOE,GAAU,QAAQ,SAAS,EAAE;AAC1C,WAAOC,EAAoBH,KAAQ,EAAE,KAAKA;AAAA,EAC5C;AAIA,SAAOE,EAAS,WAAW,YAAY,KAAK,EAAE,KAAA;AAChD,GAuBME,IAAoB,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,SAAAC;AACF,MAAsC;AACpC,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAiB,EAAE,GAGjDC,KAAiBb,KAAmB,CAAA,GAAI,OAAO,CAACD,MAAS;AAC7D,QAAIA,GAAM,WAAW,OAAO,GAAG;AAE7B,YAAMG,IAAOH,GAAM,QAAQ,SAAS,EAAE;AACtC,aACEG,GACI,eACA,SAASQ,GAAY,QAAQ,iBAAiB,EAAE,KACpDL,EAAoBH,KAAQ,EAAE,GAC1B,YAAA,GACA,SAASQ,GAAY,KA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EAAgB,GAAGqB,GAAO,EAAA,CAC7B;AAAA,EAAA,CAEH;AACH;"}
1
+ {"version":3,"file":"IconPicker.es.js","sources":["../../../../src/components/forms/icon-picker/IconPicker.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport React, { Suspense, useEffect, useRef, useState } from 'react';\nimport { FixedSizeGrid, type GridChildComponentProps } from 'react-window';\nimport * as AllIcons from '@mui/icons-material';\nimport { IconButton, type SvgIconOwnProps } from '@mui/material';\nimport { Popover, Tooltip } from \"antd\";\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { InputField } from \"../input-field/InputField\";\nimport { COUNTRY_CODES, countryNameFromCode } from \"../../../types/icon-picker\";\nimport { getFlagComponent } from \"../../../utils/countryFlags\";\nimport { InputLabel } from '../shared/InputLabel';\n\nconst roundedIconNames = Object.keys(AllIcons).filter((name) =>\n name?.endsWith(\"Rounded\")\n);\n\n// Merge icon names and country codes for the picker\nconst mergedIconNames = [\n ...(roundedIconNames || []),\n ...(COUNTRY_CODES || []).map((code) => `flag-${code}`),\n];\n\n// Utility function to convert camelCase to human-readable format\nconst formatIconName = (iconName: string): string => {\n // Handle flag icons\n if (iconName?.startsWith(\"flag-\")) {\n const code = iconName?.replace(\"flag-\", \"\");\n return countryNameFromCode(code || \"\") || code;\n }\n\n // Convert camelCase to space-separated words\n // e.g., \"PersonRounded\" -> \"Person Rounded\"\n return iconName.replaceAll(/([A-Z])/g, \" $1\").trim();\n};\n\n/** Ant Design `Popover` placement for the icon panel (bottom edge of the trigger). */\nexport type IconPickerDropdownPosition = 'bottom' | 'bottomLeft' | 'bottomRight';\n\nexport interface IconPickerContentProps {\n selectedIcon: string | null;\n onChange: (iconName: string | null) => void;\n label?: string;\n required?: boolean;\n allowClear?: boolean;\n disabled?: boolean;\n errorMessage?: string;\n /** Popover placement: `bottom` | `bottomLeft` | `bottomRight`. Default: `bottom`. */\n dropdownPosition?: IconPickerDropdownPosition;\n}\n\ninterface IconPickerContentInternalProps {\n onChange: (iconName: string | null) => void;\n selectedIcon: string | null;\n setOpen?: React.Dispatch<React.SetStateAction<boolean>>;\n}\n\nconst IconPickerContent = ({\n onChange,\n selectedIcon,\n setOpen,\n}: IconPickerContentInternalProps) => {\n const [searchTerm, setSearchTerm] = useState<string>(\"\");\n\n // Filter both icons and flags\n const filteredIcons = (mergedIconNames || []).filter((name) => {\n if (name?.startsWith(\"flag-\")) {\n // For flags, allow search by country code or country name\n const code = name?.replace(\"flag-\", \"\");\n return (\n code\n ?.toLowerCase()\n ?.includes(searchTerm?.trim()?.toLowerCase() || \"\") ||\n countryNameFromCode(code || \"\")\n ?.toLowerCase()\n ?.includes(searchTerm?.trim()?.toLowerCase() || \"\")\n );\n }\n return name\n ?.trim()\n ?.toLowerCase()\n ?.includes(searchTerm?.trim()?.toLowerCase() || \"\");\n });\n\n const handleClick = (icon: string, event: React.MouseEvent) => {\n event.stopPropagation();\n if (selectedIcon === icon) {\n onChange?.(null);\n return;\n }\n onChange?.(icon);\n setOpen?.(false);\n };\n\n return (\n <div \n className=\"flex flex-col gap-3\"\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n }\n }}\n >\n <InputField\n id={`input-field-icon-picker`}\n placeholder=\"Search icons...\"\n onChange={(value) => setSearchTerm(value || \"\")}\n fieldSuffix={\n <AllIcons.Search className=\"!w-4 !h-4 text-neutral-400\" />\n }\n />\n <FixedSizeGrid\n columnCount={5}\n rowCount={Math.ceil((filteredIcons?.length || 0) / 5)}\n columnWidth={40}\n rowHeight={40}\n width={220}\n height={240}\n >\n {({ columnIndex, rowIndex, style }: GridChildComponentProps) => {\n const itemIndex = rowIndex * 5 + columnIndex;\n const iconName = filteredIcons?.[itemIndex];\n return iconName ? (\n <div style={style} className=\"p-1\">\n <Tooltip title={formatIconName(iconName)} placement='bottom'>\n <IconButton\n type='button'\n className={classNames(\n \"flex items-center justify-center !rounded-md hover:bg-neutral-200 dark:hover:bg-black-700\",\n {\n \"!bg-primary-50 dark:!bg-black-800\":\n selectedIcon === iconName,\n }\n )}\n onClick={(event) => handleClick(iconName, event)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n }\n }}\n >\n <IconRenderer\n iconName={iconName}\n className=\"!w-5 !h-5 text-neutral-900 dark:text-white\"\n />\n </IconButton>\n </Tooltip>\n </div>\n ) : null;\n }}\n </FixedSizeGrid>\n </div>\n );\n};\n\ninterface IconRendererProps {\n iconName: string;\n sx?: SvgIconOwnProps['sx'];\n className?: string;\n isHovering?: boolean;\n}\n\nexport const IconRenderer = ({ iconName, sx, className, isHovering }: IconRendererProps) => {\n // Render flag if iconName starts with 'flag-'\n if (iconName?.startsWith?.('flag-')) {\n const code = iconName?.replace('flag-', '');\n return getFlagComponent?.(code || '', isHovering || false) || <div>-</div>;\n }\n const Icon = AllIcons?.[iconName as keyof typeof AllIcons] as React.ComponentType<{\n sx?: SvgIconOwnProps['sx'];\n className?: string;\n isHovering?: boolean;\n }>;\n\n if (!Icon) {\n return <div>-</div>;\n }\n\n return <Icon sx={sx} className={className} isHovering={isHovering} />;\n};\n\nconst IconPickerBase = ({\n selectedIcon,\n onChange,\n label,\n required = false,\n allowClear = true,\n disabled = false,\n errorMessage,\n dropdownPosition = 'bottom',\n}: IconPickerContentProps) => {\n const [open, setOpen] = useState(false);\n const mouseClickRef = useRef(false);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const wasOpenRef = useRef(false);\n\n useEffect(() => {\n if (wasOpenRef.current && !open) {\n buttonRef.current?.focus();\n }\n wasOpenRef.current = open;\n }, [open]);\n const handleClearIcon = (e: React.MouseEvent) => {\n e.stopPropagation();\n onChange?.('');\n };\n\n return (\n <Popover\n arrow={false}\n placement={dropdownPosition}\n trigger='click'\n getPopupContainer={(triggerNode) => triggerNode?.parentElement || document.body}\n open={open}\n onOpenChange={(newOpen) => {\n if (newOpen) {\n if (mouseClickRef.current) {\n setOpen(true);\n }\n mouseClickRef.current = false;\n } else {\n setOpen(false);\n }\n }}\n content={<IconPickerContent onChange={onChange} selectedIcon={selectedIcon} setOpen={setOpen} />}\n >\n <div className='flex flex-col gap-1'>\n {label ? (\n <InputLabel label={label || \"\"} required={required || false} />\n ) : null}\n <button\n ref={buttonRef}\n type='button'\n id={`btn-icon-picker-icon-${selectedIcon ? 'selected' : 'unselected'}`}\n className={`lax-form-trigger min-w-[83px] py-1.5 px-3 rounded-md border ${\n disabled ? 'cursor-not-allowed opacity-60 bg-neutral-50 dark:bg-black-800' : 'bg-white dark:bg-black-800'\n } ${errorMessage ? 'border-red-500' : 'focus:border-primary-600 dark:focus:border-primary-400'} flex items-center justify-between gap-2`}\n disabled={disabled}\n onClick={(e) => {\n if (disabled) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n if (e.detail > 0) {\n mouseClickRef.current = true;\n }\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n if (!open) {\n const form = (e.currentTarget as HTMLElement).closest('form');\n const submitBtn = form?.querySelector('button[type=\"submit\"]') as HTMLButtonElement | null;\n submitBtn?.click();\n }\n }\n }}\n >\n {selectedIcon ? (\n <IconRenderer iconName={selectedIcon} className='!w-5 !h-5 text-neutral-900 dark:text-white' />\n ) : (\n <Typography\n size='small'\n variant='medium'\n appearance='subtitle'\n >\n Select Icon\n </Typography>\n )}\n {selectedIcon && allowClear && !disabled ? (\n <AllIcons.CloseRounded\n className='!w-5 !h-5 hover:bg-neutral-100 dark:hover:bg-black-800 rounded-full transition-colors cursor-pointer text-neutral-400 dark:text-neutral-500'\n onClick={handleClearIcon}\n />\n ) : (\n null\n )}\n </button>\n {errorMessage && (\n <Typography size='extra-small' className='text-red-500 font-medium'>\n {errorMessage}\n </Typography>\n )}\n </div>\n </Popover>\n );\n};\n\nexport const IconPicker = React.lazy(() =>\n Promise.resolve({\n default: (props: IconPickerContentProps) => (\n <Suspense fallback={<div className='min-w-20 h-8 animate-pulse bg-neutral-100 dark:bg-black-800 rounded-md' />}>\n <IconPickerBase {...props} />\n </Suspense>\n ),\n }),\n);\n\n"],"names":["roundedIconNames","AllIcons","name","mergedIconNames","COUNTRY_CODES","code","formatIconName","iconName","countryNameFromCode","IconPickerContent","onChange","selectedIcon","setOpen","searchTerm","setSearchTerm","useState","filteredIcons","handleClick","icon","event","jsxs","e","jsx","InputField","value","FixedSizeGrid","columnIndex","rowIndex","style","itemIndex","Tooltip","IconButton","classNames","IconRenderer","sx","className","isHovering","getFlagComponent","Icon","IconPickerBase","label","required","allowClear","disabled","errorMessage","dropdownPosition","open","mouseClickRef","useRef","buttonRef","wasOpenRef","useEffect","handleClearIcon","Popover","triggerNode","newOpen","InputLabel","Typography","IconPicker","React","props","Suspense"],"mappings":";;;;;;;;;;;;AAYA,MAAMA,IAAmB,OAAO,KAAKC,CAAQ,EAAE;AAAA,EAAO,CAACC,MACrDA,GAAM,SAAS,SAAS;AAC1B,GAGMC,IAAkB;AAAA,EACtB,GAAIH,KAAoB,CAAA;AAAA,EACxB,IAAII,KAAiB,CAAA,GAAI,IAAI,CAACC,MAAS,QAAQA,CAAI,EAAE;AACvD,GAGMC,IAAiB,CAACC,MAA6B;AAEnD,MAAIA,GAAU,WAAW,OAAO,GAAG;AACjC,UAAMF,IAAOE,GAAU,QAAQ,SAAS,EAAE;AAC1C,WAAOC,EAAoBH,KAAQ,EAAE,KAAKA;AAAA,EAC5C;AAIA,SAAOE,EAAS,WAAW,YAAY,KAAK,EAAE,KAAA;AAChD,GAuBME,IAAoB,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,SAAAC;AACF,MAAsC;AACpC,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAiB,EAAE,GAGjDC,KAAiBb,KAAmB,CAAA,GAAI,OAAO,CAACD,MAAS;AAC7D,QAAIA,GAAM,WAAW,OAAO,GAAG;AAE7B,YAAMG,IAAOH,GAAM,QAAQ,SAAS,EAAE;AACtC,aACEG,GACI,eACA,SAASQ,GAAY,QAAQ,iBA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AU;AACZ,gBAAAtB,EAAE,eAAA,GACFA,EAAE,gBAAA;AACF;AAAA,cACF;AACA,cAAIA,EAAE,SAAS,MACb0B,EAAc,UAAU;AAAA,YAE5B;AAAA,YACA,WAAW,CAAC1B,MAAM;AAChB,cAAIA,EAAE,QAAQ,YACZA,EAAE,eAAA,GACGyB,KACWzB,EAAE,cAA8B,QAAQ,MAAM,GACpC,cAAc,uBAAuB,GAClD,MAAA;AAAA,YAGjB;AAAA,YAEC,UAAA;AAAA,cAAAV,sBACEsB,GAAA,EAAa,UAAUtB,GAAc,WAAU,8CAA6C,IAE7F,gBAAAW;AAAA,gBAACmC;AAAA,gBAAA;AAAA,kBACC,MAAK;AAAA,kBACL,SAAQ;AAAA,kBACR,YAAW;AAAA,kBACZ,UAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,cAIF9C,KAAgB+B,KAAc,CAACC,IAC9B,gBAAArB;AAAA,gBAACrB,EAAS;AAAA,gBAAT;AAAA,kBACC,WAAU;AAAA,kBACV,SAASmD;AAAA,gBAAA;AAAA,cAAA,IAGZ;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGFR,KACC,gBAAAtB,EAACmC,GAAA,EAAW,MAAK,eAAc,WAAU,4BACtC,UAAAb,EAAA,CACH;AAAA,MAAA,EAAA,CAEJ;AAAA,IAAA;AAAA,EAAA;AAGN,GAEac,IAAaC,EAAM;AAAA,EAAK,MACnC,QAAQ,QAAQ;AAAA,IACd,SAAS,CAACC,MACR,gBAAAtC,EAACuC,KAAS,UAAU,gBAAAvC,EAAC,OAAA,EAAI,WAAU,0EAAyE,GAC1G,UAAA,gBAAAA,EAACiB,GAAA,EAAgB,GAAGqB,GAAO,EAAA,CAC7B;AAAA,EAAA,CAEH;AACH;"}
@@ -1 +1 @@
1
- {"version":3,"file":"InputField.cjs.js","sources":["../../../../src/components/forms/input-field/InputField.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React, { forwardRef, useEffect, useRef, useState } from \"react\";\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { InputLabel } from \"../shared/InputLabel\";\n\n/**\n * Props for the InputField component\n */\nexport interface InputFieldProps {\n /** Unique identifier for the input field */\n id: string;\n /** The current value of the input field */\n value?: string;\n /** Callback function called when the input value changes */\n onChange: (value: string) => void;\n /** Callback function called on key down events */\n onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n /** Error message to display below the input */\n message?: string;\n /** Success message to display below the input */\n messageType?: \"success\" | \"error\" | \"info\" | \"default\";\n /** Default value for the input field */\n defaultValue?: string;\n /** Whether the input field is disabled */\n disabled?: boolean;\n /** Maximum value for number inputs */\n max?: number;\n /** Minimum value for number inputs */\n min?: number;\n /** Whether the field is required */\n required?: boolean;\n /** Label text for the input field */\n label?: string;\n /** Input type (text, email, password, number, etc.) */\n type?: string;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Icon or element to display at the end of the input */\n fieldSuffix?: React.ReactNode;\n /** Additional CSS classes for the wrapper container */\n wrapperClassNames?: string;\n /** Additional CSS classes for the input element */\n inputClassNames?: string;\n /** Inline styles for the input element */\n inputStyle?: React.CSSProperties;\n /** Additional props to pass to the input element */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n}\n/**\n * A highly customizable input field component with label, validation, and styling support.\n *\n * @example\n * ```tsx\n * <InputField\n * id=\"email\"\n * label=\"Email Address\"\n * type=\"email\"\n * value={email}\n * onChange={setEmail}\n * placeholder=\"Enter your email\"\n * required\n * errorMessage={emailError}\n * />\n * ```\n */\nexport const InputField = forwardRef<HTMLInputElement, InputFieldProps>(\n (\n {\n id,\n value,\n onChange,\n onKeyDown,\n message,\n messageType = \"default\",\n defaultValue,\n disabled = false,\n max,\n min,\n required = false,\n label,\n type = \"text\",\n placeholder,\n fieldSuffix,\n wrapperClassNames,\n inputClassNames,\n inputStyle = {},\n inputProps,\n },\n ref\n ) => {\n // Refs and state for dynamic padding\n const suffixRef = useRef<HTMLDivElement>(null);\n const [suffixWidth, setSuffixWidth] = useState<number>(0);\n\n // Base styles for different states\n const getInputBorderClasses = (): string => {\n if (messageType === \"error\")\n return \"border-red-300 focus:border-red-500 focus:ring-red-200\";\n if (messageType === \"success\")\n return \"border-green-300 focus:border-green-500 focus:ring-green-200\";\n if (messageType === \"info\")\n return \"border-blue-300 focus:border-blue-500 focus:ring-blue-200\";\n return \"border-neutral-200 dark:border-black-600 focus:border-primary-500 dark:focus:border-primary-400 focus:ring-primary-200 dark:focus:ring-primary-400/20\";\n };\n\n // Typography class for message\n const getMessageTypographyClass = (): string => {\n if (messageType === \"error\") return \"text-red-500 dark:text-red-400\";\n if (messageType === \"success\")\n return \"text-green-500 dark:text-green-400\";\n if (messageType === \"info\") return \"text-blue-500 dark:text-blue-400\";\n return \"text-neutral-500 dark:text-black-100\";\n };\n\n const inputId = id || `input-${label?.replace(/\\s+/g, \"-\").toLowerCase()}`;\n\n // Effect to measure suffix width and update input padding\n useEffect(() => {\n if (fieldSuffix && suffixRef.current) {\n const resizeObserver = new ResizeObserver((entries) => {\n const suffixElement = entries[0];\n if (suffixElement) {\n // Add extra padding (8px base + 4px buffer) to prevent overlap\n const calculatedWidth =\n Math.ceil(suffixElement.contentRect.width) + 24;\n setSuffixWidth(calculatedWidth);\n }\n });\n\n resizeObserver.observe(suffixRef.current);\n\n // Initial measurement\n const initialWidth = Math.ceil(suffixRef.current.offsetWidth) + 12;\n setSuffixWidth(initialWidth);\n\n return () => {\n resizeObserver.disconnect();\n };\n } else {\n setSuffixWidth(0);\n }\n }, [fieldSuffix]);\n\n // Calculate dynamic padding style\n const getDynamicInputStyle = (): React.CSSProperties => {\n const basePadding = 12; // Default px-3 is 12px\n const rightPadding = fieldSuffix\n ? Math.max(basePadding, suffixWidth)\n : basePadding;\n\n return {\n \"--input-bg-color\": \"var(--tw-bg-opacity, 1) rgb(var(--bg-color))\",\n \"--text-color\": \"#111827\",\n paddingRight: `${rightPadding}px`,\n ...inputStyle,\n } as React.CSSProperties;\n };\n\n return (\n <div className={cn(\"flex flex-col w-full\", wrapperClassNames)}>\n {/* Autofill styles */}\n <style>\n {`\n .input-field input:-webkit-autofill,\n .input-field input:-webkit-autofill:hover,\n .input-field input:-webkit-autofill:focus {\n -webkit-text-fill-color: var(--text-color) !important;\n -webkit-box-shadow: 0 0 0px 1000px var(--input-bg-color) inset !important;\n transition: background-color 5000s ease-in-out 0s;\n }\n \n .dark .input-field input:-webkit-autofill,\n .dark .input-field input:-webkit-autofill:hover,\n .dark .input-field input:-webkit-autofill:focus {\n -webkit-text-fill-color: white !important;\n -webkit-box-shadow: 0 0 0px 1000px var(--input-bg-color) inset !important;\n }\n `}\n </style>\n\n {/* Label */}\n {label ? (\n <label\n htmlFor={inputId}\n className=\"mb-1 text-xs font-medium text-gray-600 dark:text-gray-300 inline-flex items-center gap-1\"\n >\n <div className=\"flex flex-wrap items-center justify-between w-full\">\n <div className=\"inline-flex flex-wrap items-center gap-1\">\n <InputLabel label={label || \"\"} required={required || false} />\n {/* TODO: Add tooltip support when Tooltip component is available */}\n {/* {tooltip && (\n <Tooltip placement=\"top\" title={tooltip}>\n <div className=\"cursor-pointer\">\n <HelpIcon className=\"text-neutral-500 w-3 h-3\" />\n </div>\n </Tooltip>\n )} */}\n </div>\n </div>\n </label>\n ) : null}\n\n {/* Input Container */}\n <div className=\"relative input-field\">\n <input\n {...inputProps}\n ref={ref}\n id={inputId}\n type={type}\n value={value}\n defaultValue={defaultValue}\n placeholder={placeholder}\n required={required}\n disabled={disabled}\n max={max}\n min={min}\n onKeyDown={onKeyDown}\n style={getDynamicInputStyle()}\n className={cn(\n // Base styles\n \"border border-solid h-8 rounded-md block w-full pl-3\",\n \"text-sm font-medium text-neutral-900 dark:text-black-100\",\n \"bg-white dark:bg-black-600\",\n \"transition-colors duration-200 ease-in-out\",\n \"focus:outline-none focus:ring-2\",\n\n // State-specific styles\n getInputBorderClasses(),\n\n // Disabled styles\n disabled &&\n \"opacity-70 cursor-not-allowed bg-neutral-50 dark:bg-black-700\",\n\n // Custom classes\n inputClassNames\n )}\n onChange={(e) => onChange(e.target.value)}\n onClick={(e) => e.stopPropagation()}\n />\n\n {/* Suffix Icon */}\n {fieldSuffix && (\n <div\n ref={suffixRef}\n className=\"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none\"\n >\n {fieldSuffix}\n </div>\n )}\n </div>\n\n {/* Error Message */}\n <AnimatePresence>\n {message && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n >\n <Typography\n className={cn(\"mt-1\", getMessageTypographyClass())}\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {message}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n );\n }\n);\n\nInputField.displayName = \"InputField\";\n"],"names":["InputField","forwardRef","id","value","onChange","onKeyDown","message","messageType","defaultValue","disabled","max","min","required","label","type","placeholder","fieldSuffix","wrapperClassNames","inputClassNames","inputStyle","inputProps","ref","suffixRef","useRef","suffixWidth","setSuffixWidth","useState","getInputBorderClasses","getMessageTypographyClass","inputId","useEffect","resizeObserver","entries","suffixElement","calculatedWidth","initialWidth","getDynamicInputStyle","cn","jsx","InputLabel","jsxs","e","AnimatePresence","motion","Typography"],"mappings":"qTAkEaA,EAAaC,EAAAA,WACxB,CACE,CACE,GAAAC,EACA,MAAAC,EACA,SAAAC,EACA,UAAAC,EACA,QAAAC,EACA,YAAAC,EAAc,UACd,aAAAC,EACA,SAAAC,EAAW,GACX,IAAAC,EACA,IAAAC,EACA,SAAAC,EAAW,GACX,MAAAC,EACA,KAAAC,EAAO,OACP,YAAAC,EACA,YAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,WAAAC,EAAa,CAAA,EACb,WAAAC,CAAA,EAEFC,IACG,CAEH,MAAMC,EAAYC,EAAAA,OAAuB,IAAI,EACvC,CAACC,EAAaC,CAAc,EA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,CAAW,MAAO1B,GAAS,GAAI,SAAUD,GAAY,GAAO,EAS7D,CAAA,CACF,CAAA,CAAA,EAEA,KAGJ4B,EAAAA,KAAC,MAAA,CAAI,UAAU,uBACb,SAAA,CAAAF,EAAAA,IAAC,QAAA,CACE,GAAGlB,EACJ,IAAAC,EACA,GAAIQ,EACJ,KAAAf,EACA,MAAAX,EACA,aAAAK,EACA,YAAAO,EACA,SAAAH,EACA,SAAAH,EACA,IAAAC,EACA,IAAAC,EACA,UAAAN,EACA,MAAO+B,EAAA,EACP,UAAWC,EAET,uDACA,2DACA,6BACA,6CACA,kCAGAV,EAAA,EAGAlB,GACE,gEAGFS,CAAA,EAEF,SAAWuB,GAAMrC,EAASqC,EAAE,OAAO,KAAK,EACxC,QAAUA,GAAMA,EAAE,gBAAA,CAAgB,CAAA,EAInCzB,GACCsB,EAAAA,IAAC,MAAA,CACC,IAAKhB,EACL,UAAU,wEAET,SAAAN,CAAA,CAAA,CACH,EAEJ,EAGAsB,EAAAA,IAACI,EAAAA,iBACE,SAAApC,GACCgC,EAAAA,IAACK,EAAAA,OAAO,IAAP,CACC,QAAS,CAAE,QAAS,EAAG,EAAG,GAAA,EAC1B,QAAS,CAAE,QAAS,EAAG,EAAG,CAAA,EAC1B,KAAM,CAAE,QAAS,EAAG,EAAG,GAAA,EACvB,WAAY,CAAE,SAAU,EAAA,EAExB,SAAAL,EAAAA,IAACM,EAAAA,WAAA,CACC,UAAWP,EAAG,OAAQT,GAA2B,EACjD,WAAW,SACX,KAAK,cACL,QAAQ,SAEP,SAAAtB,CAAA,CAAA,CACH,CAAA,CACF,CAEJ,CAAA,EACF,CAEJ,CACF,EAEAN,EAAW,YAAc"}
1
+ {"version":3,"file":"InputField.cjs.js","sources":["../../../../src/components/forms/input-field/InputField.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React, { forwardRef, useEffect, useRef, useState } from \"react\";\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { InputLabel } from \"../shared/InputLabel\";\n\n/**\n * Props for the InputField component\n */\nexport interface InputFieldProps {\n /** Unique identifier for the input field */\n id: string;\n /** The current value of the input field */\n value?: string;\n /** Callback function called when the input value changes */\n onChange: (value: string) => void;\n /** Callback function called on key down events */\n onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n /** Error message to display below the input */\n message?: string;\n /** Success message to display below the input */\n messageType?: \"success\" | \"error\" | \"info\" | \"default\";\n /** Default value for the input field */\n defaultValue?: string;\n /** Whether the input field is disabled */\n disabled?: boolean;\n /** Maximum value for number inputs */\n max?: number;\n /** Minimum value for number inputs */\n min?: number;\n /** Whether the field is required */\n required?: boolean;\n /** Label text for the input field */\n label?: string;\n /** Input type (text, email, password, number, etc.) */\n type?: string;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Icon or element to display at the end of the input */\n fieldSuffix?: React.ReactNode;\n /** Additional CSS classes for the wrapper container */\n wrapperClassNames?: string;\n /** Additional CSS classes for the input element */\n inputClassNames?: string;\n /** Inline styles for the input element */\n inputStyle?: React.CSSProperties;\n /** Additional props to pass to the input element */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n}\n/**\n * A highly customizable input field component with label, validation, and styling support.\n *\n * @example\n * ```tsx\n * <InputField\n * id=\"email\"\n * label=\"Email Address\"\n * type=\"email\"\n * value={email}\n * onChange={setEmail}\n * placeholder=\"Enter your email\"\n * required\n * errorMessage={emailError}\n * />\n * ```\n */\nexport const InputField = forwardRef<HTMLInputElement, InputFieldProps>(\n (\n {\n id,\n value,\n onChange,\n onKeyDown,\n message,\n messageType = \"default\",\n defaultValue,\n disabled = false,\n max,\n min,\n required = false,\n label,\n type = \"text\",\n placeholder,\n fieldSuffix,\n wrapperClassNames,\n inputClassNames,\n inputStyle = {},\n inputProps,\n },\n ref\n ) => {\n // Refs and state for dynamic padding\n const suffixRef = useRef<HTMLDivElement>(null);\n const [suffixWidth, setSuffixWidth] = useState<number>(0);\n\n // Base styles for different states\n const getInputBorderClasses = (): string => {\n if (messageType === \"error\")\n return \"border-red-300 focus:border-red-500 focus:ring-red-200\";\n if (messageType === \"success\")\n return \"border-green-300 focus:border-green-500 focus:ring-green-200\";\n if (messageType === \"info\")\n return \"border-blue-300 focus:border-blue-500 focus:ring-blue-200\";\n return \"border-neutral-200 dark:border-black-600 focus:border-primary-500 dark:focus:border-primary-400 focus:ring-primary-200 dark:focus:ring-primary-400/20\";\n };\n\n // Typography class for message\n const getMessageTypographyClass = (): string => {\n if (messageType === \"error\") return \"text-red-500 dark:text-red-400\";\n if (messageType === \"success\")\n return \"text-green-500 dark:text-green-400\";\n if (messageType === \"info\") return \"text-blue-500 dark:text-blue-400\";\n return \"text-neutral-500 dark:text-black-100\";\n };\n\n const inputId = id || `input-${label?.replace(/\\s+/g, \"-\").toLowerCase()}`;\n\n // Effect to measure suffix width and update input padding\n useEffect(() => {\n if (fieldSuffix && suffixRef.current) {\n const resizeObserver = new ResizeObserver((entries) => {\n const suffixElement = entries[0];\n if (suffixElement) {\n // Add extra padding (8px base + 4px buffer) to prevent overlap\n const calculatedWidth =\n Math.ceil(suffixElement.contentRect.width) + 24;\n setSuffixWidth(calculatedWidth);\n }\n });\n\n resizeObserver.observe(suffixRef.current);\n\n // Initial measurement\n const initialWidth = Math.ceil(suffixRef.current.offsetWidth) + 12;\n setSuffixWidth(initialWidth);\n\n return () => {\n resizeObserver.disconnect();\n };\n } else {\n setSuffixWidth(0);\n }\n }, [fieldSuffix]);\n\n // Calculate dynamic padding style\n const getDynamicInputStyle = (): React.CSSProperties => {\n const basePadding = 12; // Default px-3 is 12px\n const rightPadding = fieldSuffix\n ? Math.max(basePadding, suffixWidth)\n : basePadding;\n\n return {\n \"--input-bg-color\": \"var(--tw-bg-opacity, 1) rgb(var(--bg-color))\",\n \"--text-color\": \"#111827\",\n paddingRight: `${rightPadding}px`,\n ...inputStyle,\n } as React.CSSProperties;\n };\n\n return (\n <div className={cn(\"flex flex-col w-full\", wrapperClassNames)}>\n {/* Autofill styles */}\n <style>\n {`\n .input-field input:-webkit-autofill,\n .input-field input:-webkit-autofill:hover,\n .input-field input:-webkit-autofill:focus {\n -webkit-text-fill-color: var(--text-color) !important;\n -webkit-box-shadow: 0 0 0px 1000px var(--input-bg-color) inset !important;\n transition: background-color 5000s ease-in-out 0s;\n }\n \n .dark .input-field input:-webkit-autofill,\n .dark .input-field input:-webkit-autofill:hover,\n .dark .input-field input:-webkit-autofill:focus {\n -webkit-text-fill-color: white !important;\n -webkit-box-shadow: 0 0 0px 1000px var(--input-bg-color) inset !important;\n }\n `}\n </style>\n\n {/* Label */}\n {label ? (\n <label\n htmlFor={inputId}\n className=\"mb-1 text-xs font-medium text-gray-600 dark:text-gray-300 inline-flex items-center gap-1\"\n >\n <div className=\"flex flex-wrap items-center justify-between w-full\">\n <div className=\"inline-flex flex-wrap items-center gap-1\">\n <InputLabel label={label || \"\"} required={required || false} />\n {/* TODO: Add tooltip support when Tooltip component is available */}\n {/* {tooltip && (\n <Tooltip placement=\"top\" title={tooltip}>\n <div className=\"cursor-pointer\">\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </Tooltip>\n )} */}\n </div>\n </div>\n </label>\n ) : null}\n\n {/* Input Container */}\n <div className=\"relative input-field\">\n <input\n {...inputProps}\n ref={ref}\n id={inputId}\n type={type}\n value={value}\n defaultValue={defaultValue}\n placeholder={placeholder}\n required={required}\n disabled={disabled}\n max={max}\n min={min}\n onKeyDown={onKeyDown}\n style={getDynamicInputStyle()}\n className={cn(\n // Base styles\n \"border border-solid h-8 rounded-md block w-full pl-3\",\n \"text-sm font-medium text-neutral-900 dark:text-black-100\",\n \"bg-white dark:bg-black-600\",\n \"transition-colors duration-200 ease-in-out\",\n \"focus:outline-none focus:ring-2\",\n\n // State-specific styles\n getInputBorderClasses(),\n\n // Disabled styles\n disabled &&\n \"opacity-70 cursor-not-allowed bg-neutral-50 dark:bg-black-700\",\n\n // Custom classes\n inputClassNames\n )}\n onChange={(e) => onChange(e.target.value)}\n onClick={(e) => e.stopPropagation()}\n />\n\n {/* Suffix Icon */}\n {fieldSuffix && (\n <div\n ref={suffixRef}\n className=\"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none\"\n >\n {fieldSuffix}\n </div>\n )}\n </div>\n\n {/* Error Message */}\n <AnimatePresence>\n {message && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n >\n <Typography\n className={cn(\"mt-1\", getMessageTypographyClass())}\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {message}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n );\n }\n);\n\nInputField.displayName = \"InputField\";\n"],"names":["InputField","forwardRef","id","value","onChange","onKeyDown","message","messageType","defaultValue","disabled","max","min","required","label","type","placeholder","fieldSuffix","wrapperClassNames","inputClassNames","inputStyle","inputProps","ref","suffixRef","useRef","suffixWidth","setSuffixWidth","useState","getInputBorderClasses","getMessageTypographyClass","inputId","useEffect","resizeObserver","entries","suffixElement","calculatedWidth","initialWidth","getDynamicInputStyle","cn","jsx","InputLabel","jsxs","e","AnimatePresence","motion","Typography"],"mappings":"qTAkEaA,EAAaC,EAAAA,WACxB,CACE,CACE,GAAAC,EACA,MAAAC,EACA,SAAAC,EACA,UAAAC,EACA,QAAAC,EACA,YAAAC,EAAc,UACd,aAAAC,EACA,SAAAC,EAAW,GACX,IAAAC,EACA,IAAAC,EACA,SAAAC,EAAW,GACX,MAAAC,EACA,KAAAC,EAAO,OACP,YAAAC,EACA,YAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,WAAAC,EAAa,CAAA,EACb,WAAAC,CAAA,EAEFC,IACG,CAEH,MAAMC,EAAYC,EAAAA,OAAuB,IAAI,EACvC,CAACC,EAAaC,CAAc,EAAIC,EAAAA,SAAiB,CAAC,EAGlDC,EAAwB,IACxBpB,IAAgB,QACX,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ACF,CAAA,CAAA,EAEA,KAGJ4B,EAAAA,KAAC,MAAA,CAAI,UAAU,uBACb,SAAA,CAAAF,EAAAA,IAAC,QAAA,CACE,GAAGlB,EACJ,IAAAC,EACA,GAAIQ,EACJ,KAAAf,EACA,MAAAX,EACA,aAAAK,EACA,YAAAO,EACA,SAAAH,EACA,SAAAH,EACA,IAAAC,EACA,IAAAC,EACA,UAAAN,EACA,MAAO+B,EAAA,EACP,UAAWC,EAET,uDACA,2DACA,6BACA,6CACA,kCAGAV,EAAA,EAGAlB,GACE,gEAGFS,CAAA,EAEF,SAAWuB,GAAMrC,EAASqC,EAAE,OAAO,KAAK,EACxC,QAAUA,GAAMA,EAAE,gBAAA,CAAgB,CAAA,EAInCzB,GACCsB,EAAAA,IAAC,MAAA,CACC,IAAKhB,EACL,UAAU,wEAET,SAAAN,CAAA,CAAA,CACH,EAEJ,EAGAsB,EAAAA,IAACI,EAAAA,iBACE,SAAApC,GACCgC,EAAAA,IAACK,EAAAA,OAAO,IAAP,CACC,QAAS,CAAE,QAAS,EAAG,EAAG,GAAA,EAC1B,QAAS,CAAE,QAAS,EAAG,EAAG,CAAA,EAC1B,KAAM,CAAE,QAAS,EAAG,EAAG,GAAA,EACvB,WAAY,CAAE,SAAU,EAAA,EAExB,SAAAL,EAAAA,IAACM,EAAAA,WAAA,CACC,UAAWP,EAAG,OAAQT,GAA2B,EACjD,WAAW,SACX,KAAK,cACL,QAAQ,SAEP,SAAAtB,CAAA,CAAA,CACH,CAAA,CACF,CAEJ,CAAA,EACF,CAEJ,CACF,EAEAN,EAAW,YAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"InputField.es.js","sources":["../../../../src/components/forms/input-field/InputField.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React, { forwardRef, useEffect, useRef, useState } from \"react\";\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { InputLabel } from \"../shared/InputLabel\";\n\n/**\n * Props for the InputField component\n */\nexport interface InputFieldProps {\n /** Unique identifier for the input field */\n id: string;\n /** The current value of the input field */\n value?: string;\n /** Callback function called when the input value changes */\n onChange: (value: string) => void;\n /** Callback function called on key down events */\n onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n /** Error message to display below the input */\n message?: string;\n /** Success message to display below the input */\n messageType?: \"success\" | \"error\" | \"info\" | \"default\";\n /** Default value for the input field */\n defaultValue?: string;\n /** Whether the input field is disabled */\n disabled?: boolean;\n /** Maximum value for number inputs */\n max?: number;\n /** Minimum value for number inputs */\n min?: number;\n /** Whether the field is required */\n required?: boolean;\n /** Label text for the input field */\n label?: string;\n /** Input type (text, email, password, number, etc.) */\n type?: string;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Icon or element to display at the end of the input */\n fieldSuffix?: React.ReactNode;\n /** Additional CSS classes for the wrapper container */\n wrapperClassNames?: string;\n /** Additional CSS classes for the input element */\n inputClassNames?: string;\n /** Inline styles for the input element */\n inputStyle?: React.CSSProperties;\n /** Additional props to pass to the input element */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n}\n/**\n * A highly customizable input field component with label, validation, and styling support.\n *\n * @example\n * ```tsx\n * <InputField\n * id=\"email\"\n * label=\"Email Address\"\n * type=\"email\"\n * value={email}\n * onChange={setEmail}\n * placeholder=\"Enter your email\"\n * required\n * errorMessage={emailError}\n * />\n * ```\n */\nexport const InputField = forwardRef<HTMLInputElement, InputFieldProps>(\n (\n {\n id,\n value,\n onChange,\n onKeyDown,\n message,\n messageType = \"default\",\n defaultValue,\n disabled = false,\n max,\n min,\n required = false,\n label,\n type = \"text\",\n placeholder,\n fieldSuffix,\n wrapperClassNames,\n inputClassNames,\n inputStyle = {},\n inputProps,\n },\n ref\n ) => {\n // Refs and state for dynamic padding\n const suffixRef = useRef<HTMLDivElement>(null);\n const [suffixWidth, setSuffixWidth] = useState<number>(0);\n\n // Base styles for different states\n const getInputBorderClasses = (): string => {\n if (messageType === \"error\")\n return \"border-red-300 focus:border-red-500 focus:ring-red-200\";\n if (messageType === \"success\")\n return \"border-green-300 focus:border-green-500 focus:ring-green-200\";\n if (messageType === \"info\")\n return \"border-blue-300 focus:border-blue-500 focus:ring-blue-200\";\n return \"border-neutral-200 dark:border-black-600 focus:border-primary-500 dark:focus:border-primary-400 focus:ring-primary-200 dark:focus:ring-primary-400/20\";\n };\n\n // Typography class for message\n const getMessageTypographyClass = (): string => {\n if (messageType === \"error\") return \"text-red-500 dark:text-red-400\";\n if (messageType === \"success\")\n return \"text-green-500 dark:text-green-400\";\n if (messageType === \"info\") return \"text-blue-500 dark:text-blue-400\";\n return \"text-neutral-500 dark:text-black-100\";\n };\n\n const inputId = id || `input-${label?.replace(/\\s+/g, \"-\").toLowerCase()}`;\n\n // Effect to measure suffix width and update input padding\n useEffect(() => {\n if (fieldSuffix && suffixRef.current) {\n const resizeObserver = new ResizeObserver((entries) => {\n const suffixElement = entries[0];\n if (suffixElement) {\n // Add extra padding (8px base + 4px buffer) to prevent overlap\n const calculatedWidth =\n Math.ceil(suffixElement.contentRect.width) + 24;\n setSuffixWidth(calculatedWidth);\n }\n });\n\n resizeObserver.observe(suffixRef.current);\n\n // Initial measurement\n const initialWidth = Math.ceil(suffixRef.current.offsetWidth) + 12;\n setSuffixWidth(initialWidth);\n\n return () => {\n resizeObserver.disconnect();\n };\n } else {\n setSuffixWidth(0);\n }\n }, [fieldSuffix]);\n\n // Calculate dynamic padding style\n const getDynamicInputStyle = (): React.CSSProperties => {\n const basePadding = 12; // Default px-3 is 12px\n const rightPadding = fieldSuffix\n ? Math.max(basePadding, suffixWidth)\n : basePadding;\n\n return {\n \"--input-bg-color\": \"var(--tw-bg-opacity, 1) rgb(var(--bg-color))\",\n \"--text-color\": \"#111827\",\n paddingRight: `${rightPadding}px`,\n ...inputStyle,\n } as React.CSSProperties;\n };\n\n return (\n <div className={cn(\"flex flex-col w-full\", wrapperClassNames)}>\n {/* Autofill styles */}\n <style>\n {`\n .input-field input:-webkit-autofill,\n .input-field input:-webkit-autofill:hover,\n .input-field input:-webkit-autofill:focus {\n -webkit-text-fill-color: var(--text-color) !important;\n -webkit-box-shadow: 0 0 0px 1000px var(--input-bg-color) inset !important;\n transition: background-color 5000s ease-in-out 0s;\n }\n \n .dark .input-field input:-webkit-autofill,\n .dark .input-field input:-webkit-autofill:hover,\n .dark .input-field input:-webkit-autofill:focus {\n -webkit-text-fill-color: white !important;\n -webkit-box-shadow: 0 0 0px 1000px var(--input-bg-color) inset !important;\n }\n `}\n </style>\n\n {/* Label */}\n {label ? (\n <label\n htmlFor={inputId}\n className=\"mb-1 text-xs font-medium text-gray-600 dark:text-gray-300 inline-flex items-center gap-1\"\n >\n <div className=\"flex flex-wrap items-center justify-between w-full\">\n <div className=\"inline-flex flex-wrap items-center gap-1\">\n <InputLabel label={label || \"\"} required={required || false} />\n {/* TODO: Add tooltip support when Tooltip component is available */}\n {/* {tooltip && (\n <Tooltip placement=\"top\" title={tooltip}>\n <div className=\"cursor-pointer\">\n <HelpIcon className=\"text-neutral-500 w-3 h-3\" />\n </div>\n </Tooltip>\n )} */}\n </div>\n </div>\n </label>\n ) : null}\n\n {/* Input Container */}\n <div className=\"relative input-field\">\n <input\n {...inputProps}\n ref={ref}\n id={inputId}\n type={type}\n value={value}\n defaultValue={defaultValue}\n placeholder={placeholder}\n required={required}\n disabled={disabled}\n max={max}\n min={min}\n onKeyDown={onKeyDown}\n style={getDynamicInputStyle()}\n className={cn(\n // Base styles\n \"border border-solid h-8 rounded-md block w-full pl-3\",\n \"text-sm font-medium text-neutral-900 dark:text-black-100\",\n \"bg-white dark:bg-black-600\",\n \"transition-colors duration-200 ease-in-out\",\n \"focus:outline-none focus:ring-2\",\n\n // State-specific styles\n getInputBorderClasses(),\n\n // Disabled styles\n disabled &&\n \"opacity-70 cursor-not-allowed bg-neutral-50 dark:bg-black-700\",\n\n // Custom classes\n inputClassNames\n )}\n onChange={(e) => onChange(e.target.value)}\n onClick={(e) => e.stopPropagation()}\n />\n\n {/* Suffix Icon */}\n {fieldSuffix && (\n <div\n ref={suffixRef}\n className=\"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none\"\n >\n {fieldSuffix}\n </div>\n )}\n </div>\n\n {/* Error Message */}\n <AnimatePresence>\n {message && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n >\n <Typography\n className={cn(\"mt-1\", getMessageTypographyClass())}\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {message}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n );\n }\n);\n\nInputField.displayName = \"InputField\";\n"],"names":["InputField","forwardRef","id","value","onChange","onKeyDown","message","messageType","defaultValue","disabled","max","min","required","label","type","placeholder","fieldSuffix","wrapperClassNames","inputClassNames","inputStyle","inputProps","ref","suffixRef","useRef","suffixWidth","setSuffixWidth","useState","getInputBorderClasses","getMessageTypographyClass","inputId","useEffect","resizeObserver","entries","suffixElement","calculatedWidth","initialWidth","getDynamicInputStyle","cn","jsx","InputLabel","jsxs","AnimatePresence","motion","Typography"],"mappings":";;;;;;AAkEO,MAAMA,IAAaC;AAAA,EACxB,CACE;AAAA,IACE,IAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,cAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,KAAAC;AAAA,IACA,KAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,OAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,YAAAC,IAAa,CAAA;AAAA,IACb,YAAAC;AAAA,EAAA,GAEFC,MACG;AAEH,UAAMC,IAAYC,EAAuB,IAAI,GACvC,CAACC,GAAaC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AAG,GAAG,IAAA;AAAA,UACvB,YAAY,EAAE,UAAU,IAAA;AAAA,UAExB,UAAA,gBAAAJ;AAAA,YAACK;AAAA,YAAA;AAAA,cACC,WAAWN,EAAG,QAAQT,GAA2B;AAAA,cACjD,YAAW;AAAA,cACX,MAAK;AAAA,cACL,SAAQ;AAAA,cAEP,UAAAtB;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA,EACF,CAEJ;AAAA,IAAA,GACF;AAAA,EAEJ;AACF;AAEAN,EAAW,cAAc;"}
1
+ {"version":3,"file":"InputField.es.js","sources":["../../../../src/components/forms/input-field/InputField.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React, { forwardRef, useEffect, useRef, useState } from \"react\";\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { InputLabel } from \"../shared/InputLabel\";\n\n/**\n * Props for the InputField component\n */\nexport interface InputFieldProps {\n /** Unique identifier for the input field */\n id: string;\n /** The current value of the input field */\n value?: string;\n /** Callback function called when the input value changes */\n onChange: (value: string) => void;\n /** Callback function called on key down events */\n onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n /** Error message to display below the input */\n message?: string;\n /** Success message to display below the input */\n messageType?: \"success\" | \"error\" | \"info\" | \"default\";\n /** Default value for the input field */\n defaultValue?: string;\n /** Whether the input field is disabled */\n disabled?: boolean;\n /** Maximum value for number inputs */\n max?: number;\n /** Minimum value for number inputs */\n min?: number;\n /** Whether the field is required */\n required?: boolean;\n /** Label text for the input field */\n label?: string;\n /** Input type (text, email, password, number, etc.) */\n type?: string;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Icon or element to display at the end of the input */\n fieldSuffix?: React.ReactNode;\n /** Additional CSS classes for the wrapper container */\n wrapperClassNames?: string;\n /** Additional CSS classes for the input element */\n inputClassNames?: string;\n /** Inline styles for the input element */\n inputStyle?: React.CSSProperties;\n /** Additional props to pass to the input element */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n}\n/**\n * A highly customizable input field component with label, validation, and styling support.\n *\n * @example\n * ```tsx\n * <InputField\n * id=\"email\"\n * label=\"Email Address\"\n * type=\"email\"\n * value={email}\n * onChange={setEmail}\n * placeholder=\"Enter your email\"\n * required\n * errorMessage={emailError}\n * />\n * ```\n */\nexport const InputField = forwardRef<HTMLInputElement, InputFieldProps>(\n (\n {\n id,\n value,\n onChange,\n onKeyDown,\n message,\n messageType = \"default\",\n defaultValue,\n disabled = false,\n max,\n min,\n required = false,\n label,\n type = \"text\",\n placeholder,\n fieldSuffix,\n wrapperClassNames,\n inputClassNames,\n inputStyle = {},\n inputProps,\n },\n ref\n ) => {\n // Refs and state for dynamic padding\n const suffixRef = useRef<HTMLDivElement>(null);\n const [suffixWidth, setSuffixWidth] = useState<number>(0);\n\n // Base styles for different states\n const getInputBorderClasses = (): string => {\n if (messageType === \"error\")\n return \"border-red-300 focus:border-red-500 focus:ring-red-200\";\n if (messageType === \"success\")\n return \"border-green-300 focus:border-green-500 focus:ring-green-200\";\n if (messageType === \"info\")\n return \"border-blue-300 focus:border-blue-500 focus:ring-blue-200\";\n return \"border-neutral-200 dark:border-black-600 focus:border-primary-500 dark:focus:border-primary-400 focus:ring-primary-200 dark:focus:ring-primary-400/20\";\n };\n\n // Typography class for message\n const getMessageTypographyClass = (): string => {\n if (messageType === \"error\") return \"text-red-500 dark:text-red-400\";\n if (messageType === \"success\")\n return \"text-green-500 dark:text-green-400\";\n if (messageType === \"info\") return \"text-blue-500 dark:text-blue-400\";\n return \"text-neutral-500 dark:text-black-100\";\n };\n\n const inputId = id || `input-${label?.replace(/\\s+/g, \"-\").toLowerCase()}`;\n\n // Effect to measure suffix width and update input padding\n useEffect(() => {\n if (fieldSuffix && suffixRef.current) {\n const resizeObserver = new ResizeObserver((entries) => {\n const suffixElement = entries[0];\n if (suffixElement) {\n // Add extra padding (8px base + 4px buffer) to prevent overlap\n const calculatedWidth =\n Math.ceil(suffixElement.contentRect.width) + 24;\n setSuffixWidth(calculatedWidth);\n }\n });\n\n resizeObserver.observe(suffixRef.current);\n\n // Initial measurement\n const initialWidth = Math.ceil(suffixRef.current.offsetWidth) + 12;\n setSuffixWidth(initialWidth);\n\n return () => {\n resizeObserver.disconnect();\n };\n } else {\n setSuffixWidth(0);\n }\n }, [fieldSuffix]);\n\n // Calculate dynamic padding style\n const getDynamicInputStyle = (): React.CSSProperties => {\n const basePadding = 12; // Default px-3 is 12px\n const rightPadding = fieldSuffix\n ? Math.max(basePadding, suffixWidth)\n : basePadding;\n\n return {\n \"--input-bg-color\": \"var(--tw-bg-opacity, 1) rgb(var(--bg-color))\",\n \"--text-color\": \"#111827\",\n paddingRight: `${rightPadding}px`,\n ...inputStyle,\n } as React.CSSProperties;\n };\n\n return (\n <div className={cn(\"flex flex-col w-full\", wrapperClassNames)}>\n {/* Autofill styles */}\n <style>\n {`\n .input-field input:-webkit-autofill,\n .input-field input:-webkit-autofill:hover,\n .input-field input:-webkit-autofill:focus {\n -webkit-text-fill-color: var(--text-color) !important;\n -webkit-box-shadow: 0 0 0px 1000px var(--input-bg-color) inset !important;\n transition: background-color 5000s ease-in-out 0s;\n }\n \n .dark .input-field input:-webkit-autofill,\n .dark .input-field input:-webkit-autofill:hover,\n .dark .input-field input:-webkit-autofill:focus {\n -webkit-text-fill-color: white !important;\n -webkit-box-shadow: 0 0 0px 1000px var(--input-bg-color) inset !important;\n }\n `}\n </style>\n\n {/* Label */}\n {label ? (\n <label\n htmlFor={inputId}\n className=\"mb-1 text-xs font-medium text-gray-600 dark:text-gray-300 inline-flex items-center gap-1\"\n >\n <div className=\"flex flex-wrap items-center justify-between w-full\">\n <div className=\"inline-flex flex-wrap items-center gap-1\">\n <InputLabel label={label || \"\"} required={required || false} />\n {/* TODO: Add tooltip support when Tooltip component is available */}\n {/* {tooltip && (\n <Tooltip placement=\"top\" title={tooltip}>\n <div className=\"cursor-pointer\">\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </Tooltip>\n )} */}\n </div>\n </div>\n </label>\n ) : null}\n\n {/* Input Container */}\n <div className=\"relative input-field\">\n <input\n {...inputProps}\n ref={ref}\n id={inputId}\n type={type}\n value={value}\n defaultValue={defaultValue}\n placeholder={placeholder}\n required={required}\n disabled={disabled}\n max={max}\n min={min}\n onKeyDown={onKeyDown}\n style={getDynamicInputStyle()}\n className={cn(\n // Base styles\n \"border border-solid h-8 rounded-md block w-full pl-3\",\n \"text-sm font-medium text-neutral-900 dark:text-black-100\",\n \"bg-white dark:bg-black-600\",\n \"transition-colors duration-200 ease-in-out\",\n \"focus:outline-none focus:ring-2\",\n\n // State-specific styles\n getInputBorderClasses(),\n\n // Disabled styles\n disabled &&\n \"opacity-70 cursor-not-allowed bg-neutral-50 dark:bg-black-700\",\n\n // Custom classes\n inputClassNames\n )}\n onChange={(e) => onChange(e.target.value)}\n onClick={(e) => e.stopPropagation()}\n />\n\n {/* Suffix Icon */}\n {fieldSuffix && (\n <div\n ref={suffixRef}\n className=\"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none\"\n >\n {fieldSuffix}\n </div>\n )}\n </div>\n\n {/* Error Message */}\n <AnimatePresence>\n {message && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n >\n <Typography\n className={cn(\"mt-1\", getMessageTypographyClass())}\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {message}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n );\n }\n);\n\nInputField.displayName = \"InputField\";\n"],"names":["InputField","forwardRef","id","value","onChange","onKeyDown","message","messageType","defaultValue","disabled","max","min","required","label","type","placeholder","fieldSuffix","wrapperClassNames","inputClassNames","inputStyle","inputProps","ref","suffixRef","useRef","suffixWidth","setSuffixWidth","useState","getInputBorderClasses","getMessageTypographyClass","inputId","useEffect","resizeObserver","entries","suffixElement","calculatedWidth","initialW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AAA;AAAA,cAGAV,EAAA;AAAA;AAAA,cAGAlB,KACE;AAAA;AAAA,cAGFS;AAAA,YAAA;AAAA,YAEF,UAAU,CAAC,MAAMd,EAAS,EAAE,OAAO,KAAK;AAAA,YACxC,SAAS,CAAC,MAAM,EAAE,gBAAA;AAAA,UAAgB;AAAA,QAAA;AAAA,QAInCY,KACC,gBAAAsB;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAKhB;AAAA,YACL,WAAU;AAAA,YAET,UAAAN;AAAA,UAAA;AAAA,QAAA;AAAA,MACH,GAEJ;AAAA,MAGA,gBAAAsB,EAACG,KACE,UAAAnC,KACC,gBAAAgC;AAAA,QAACI,EAAO;AAAA,QAAP;AAAA,UACC,SAAS,EAAE,SAAS,GAAG,GAAG,IAAA;AAAA,UAC1B,SAAS,EAAE,SAAS,GAAG,GAAG,EAAA;AAAA,UAC1B,MAAM,EAAE,SAAS,GAAG,GAAG,IAAA;AAAA,UACvB,YAAY,EAAE,UAAU,IAAA;AAAA,UAExB,UAAA,gBAAAJ;AAAA,YAACK;AAAA,YAAA;AAAA,cACC,WAAWN,EAAG,QAAQT,GAA2B;AAAA,cACjD,YAAW;AAAA,cACX,MAAK;AAAA,cACL,SAAQ;AAAA,cAEP,UAAAtB;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA,EACF,CAEJ;AAAA,IAAA,GACF;AAAA,EAEJ;AACF;AAEAN,EAAW,cAAc;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("../../../_virtual/index.cjs.js"),r=require("react"),Se=require("antd"),we=require("react-i18next"),ye=require("../../data-display/typography/Typography.cjs.js"),Ce=require("../../data-display/label/Label.cjs.js"),m=require("@mui/icons-material"),Ie=require("../../icons/AIExtractedIndicator.cjs.js"),ke=require("../../icons/AIStarIcon.cjs.js"),qe=require("../../icons/HelpIcon.cjs.js"),$=require("../../tooltip/Tooltip.cjs.js"),T=require("../../button/IconButton.cjs.js"),Ne=require("../shared/InputLabel.cjs.js"),c=require("../../../utils/confidenceScoreUtils.cjs.js"),U=r.forwardRef(({id:W,label:J,placeholder:Q,value:s,onChange:E,errorMessage:x,defaultValue:X,required:z=!1,isRequiredConditional:Y=!1,masterDataName:f,masterDataColumnName:Z,masterDataFormula:o,masterDataFilters:F,tags:G,index:D,tooltip:M="",originalCase:ee=!1,color:R="",isGTN:j=!1,labelClassName:te,gtnName:V=null,isAiExtracted:le=!1,confidenceScore:v,confidenceType:d="high",confidenceTooltip:S,sourceMeta:re=[],onConfidenceScoreClick:ne,disabled:L=!1,reference:se={},isLiveField:oe=!1,onBlur:ae,onAddGTNToDocument:w,riskDetails:a,isRiskAnalysisOpen:y=!1,RiskDetailsCard:B,primaryColorShades:ie,setDisableActions:H,showDeprecatedFieldWarning:O,MasterDataModal:P,parseMasterDataFormula:p},ce)=>{const{t:de}=we.useTranslation(),[b,C]=r.useState(!1),[n,u]=r.useState(null),[i,A]=r.useState(!1),[ue,xe]=r.useState(""),[I,K]=r.useState(null),[fe,pe]=r.useState(!1),k=r.useRef(null),q=ce||k;r.useEffect(()=>{const t=()=>{const l=q.current||k.current;l&&pe(l.scrollWidth>l.clientWidth)};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[n,s]),r.useEffect(()=>{u(s)},[D,s]),r.useEffect(()=>{n!==null&&n!==s&&E(n,I)},[n,I]);const N=()=>{H?.(!i),A(!i)},be=t=>{if(t.keyCode===9||t.key==="Enter"){const l=q.current||k.current;l&&(u(ue),l.blur())}},he=(t,l)=>{let h=t;o&&p&&(h=p(o,l)),xe(""),u(h),N(),K(l)},ge=()=>{u(""),K(null)},me=t=>{w&&V&&w({key:V,value:t})},je=()=>{const t="border h-[32px] text-sm rounded-lg block w-full p-2.5 pr-16 font-inter font-medium",l=x?"border-red-300":y&&a?.color?`border-${a?.color}-300`:"border-gray-300 dark:border-black-600",h="placeholder:text-neutral-900 dark:placeholder:text-black-400",ve=`${y&&a?.color?`bg-${a?.color}-50`:"bg-gray-200 dark:bg-black-600 "} ${R||"text-neutral-900 dark:text-black-200"}`;return`${t} ${l} ${ve} ${h}`},_=()=>n!==null?n:o&&p?p(o,se):s;return r.useEffect(()=>{i&&!f&&(O?.(),A(!1))},[i,f,O]),e.jsxs("div",{className:g("flex gap-0.5 w-full relative",b&&j?"border rounded-lg border-primary-100 bg-primary-50 p-1":"",{"error-field":!!x}),onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),children:[j&&!b?e.jsx("div",{className:"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5"}):null,e.jsxs("div",{className:g("flex flex-col w-full"),children:[e.jsx("label",{htmlFor:"text",className:`text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${ee?"":"capitalize"} ${te||""}`,children:e.jsxs("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1",children:[e.jsxs("div",{className:"inline-flex min-w-0 items-center gap-1 flex-wrap",children:[e.jsx(Ne.InputLabel,{label:J||"",required:z||!1,isRequiredConditional:Y||!1}),oe&&e.jsx(m.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),le&&!c.shouldShowConfidenceScore(v)&&e.jsx(Ie.AIExtractedIndicator,{}),e.jsx(Ce.Label,{labels:G}),M&&e.jsx($,{placement:"top",title:`${M}${o?` | ${o}`:""}`,children:e.jsx("div",{className:"cursor-pointer",children:e.jsx(qe.HelpIcon,{})})})]}),e.jsxs("div",{className:"flex items-center gap-1 justify-self-end",children:[c.shouldShowConfidenceScore(v)&&d?e.jsx($,{placement:"top-end",title:S??"",hideTooltip:S==null,className:"cursor-pointer",children:e.jsxs("div",{className:g("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",c.getConfidenceScoreBadgeClass(d)),onClick:()=>ne?.(re),children:[e.jsx(ke.AIStarIcon,{size:12,fill:c.getConfidenceScoreBadgeColor(d),fillSecondary:c.getConfidenceScoreBadgeFill(d)}),e.jsxs("span",{className:g("text-xs font-medium leading-4",c.getConfidenceScoreBadgeTextColor(d)),children:[v,"%"]})]})}):null,j&&b&&w?e.jsx("button",{id:"btn-master-data-input-add-to-document",className:"cursor-pointer",onClick:()=>me(s?.toString()||""),type:"button",children:e.jsx(Se.Tooltip,{placement:"top",title:de("Add to document"),children:e.jsx(m.NoteAddOutlined,{sx:{fontSize:16,color:ie?.[600]||"var(--color-primary-600)"}})})}):null]})]})}),e.jsxs("label",{className:"relative block mt-1",children:[e.jsx($,{title:fe?_():"",children:e.jsx("input",{id:W,ref:q,required:z,placeholder:Q,className:je(),onChange:t=>{E(t.target.value,I),u(t.target?.value)},onKeyDown:be,value:_(),defaultValue:X,disabled:!0,autoComplete:"off",onBlur:ae})}),e.jsx(T,{id:"btn-dynamic-data-input-rx-cross",onClick:ge,className:"absolute inset-y-0 right-1 flex items-center px-2 focus:border-transparent",variant:"ghost",disabled:L,children:e.jsx(m.CloseRounded,{className:"text-neutral-900 dark:text-black-300",sx:{fontSize:16}})}),e.jsx(T,{id:"btn-dynamic-data-input-ai-outline-pic-center",onClick:N,className:"absolute inset-y-0 right-8 flex items-center px-2 focus:border-transparent",variant:"ghost",disabled:L,children:e.jsx(m.TableChartRounded,{className:"text-neutral-900 dark:text-black-300",sx:{fontSize:16}})})]}),x&&e.jsx(ye.Typography,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:x}),i&&P&&e.jsx(P,{isVisible:i,onSelected:he,onClose:N,masterDataColumnName:Z,masterDataFilters:F,masterDataName:f,masterDataId:f,showFilters:!0})]}),b&&a&&y&&B&&e.jsx("div",{role:"tooltip",tabIndex:0,className:"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl",onClick:t=>t.stopPropagation(),onMouseDown:t=>t.preventDefault(),onKeyDown:t=>{t.key==="Escape"&&C(!1)},children:e.jsx(B,{riskDetails:a})})]})});U.displayName="MasterDataInputField";exports.MasterDataInputField=U;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("../../../_virtual/index.cjs.js"),n=require("react"),ve=require("antd"),Ce=require("react-i18next"),Se=require("../../data-display/typography/Typography.cjs.js"),ye=require("../../data-display/label/Label.cjs.js"),N=require("@mui/icons-material"),Ie=require("../../icons/AIExtractedIndicator.cjs.js"),ke=require("../../icons/AIStarIcon.cjs.js"),qe=require("../../icons/HelpIcon.cjs.js"),$=require("../../tooltip/Tooltip.cjs.js"),T=require("../../button/IconButton.cjs.js"),Ne=require("../shared/InputLabel.cjs.js"),c=require("../../../utils/confidenceScoreUtils.cjs.js"),$e=require("../../icon/icons.generated.cjs.js"),U=n.forwardRef(({id:W,label:J,placeholder:Q,value:s,onChange:E,errorMessage:f,defaultValue:X,required:z=!1,isRequiredConditional:Y=!1,masterDataName:x,masterDataColumnName:Z,masterDataFormula:o,masterDataFilters:F,tags:G,index:D,tooltip:M="",originalCase:ee=!1,color:V="",isGTN:g=!1,labelClassName:te,gtnName:L=null,isAiExtracted:le=!1,confidenceScore:j,confidenceType:d="high",confidenceTooltip:w,sourceMeta:ne=[],onConfidenceScoreClick:re,disabled:R=!1,reference:se={},isLiveField:oe=!1,onBlur:ae,onAddGTNToDocument:v,riskDetails:a,isRiskAnalysisOpen:C=!1,RiskDetailsCard:B,primaryColorShades:ie,setDisableActions:H,showDeprecatedFieldWarning:O,MasterDataModal:P,parseMasterDataFormula:p},ce)=>{const{t:de}=Ce.useTranslation(),[m,S]=n.useState(!1),[r,u]=n.useState(null),[i,A]=n.useState(!1),[ue,fe]=n.useState(""),[y,K]=n.useState(null),[xe,pe]=n.useState(!1),I=n.useRef(null),k=ce||I;n.useEffect(()=>{const t=()=>{const l=k.current||I.current;l&&pe(l.scrollWidth>l.clientWidth)};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[r,s]),n.useEffect(()=>{u(s)},[D,s]),n.useEffect(()=>{r!==null&&r!==s&&E(r,y)},[r,y]);const q=()=>{H?.(!i),A(!i)},me=t=>{if(t.keyCode===9||t.key==="Enter"){const l=k.current||I.current;l&&(u(ue),l.blur())}},he=(t,l)=>{let h=t;o&&p&&(h=p(o,l)),fe(""),u(h),q(),K(l)},be=()=>{u(""),K(null)},ge=t=>{v&&L&&v({key:L,value:t})},je=()=>{const t="border h-8 text-sm rounded-lg block w-full p-2.5 pr-16 font-inter font-medium",l=f?"border-red-300":C&&a?.color?`border-${a?.color}-300`:"border-gray-300 dark:border-black-600",h="placeholder:text-neutral-900 dark:placeholder:text-black-400",we=`${C&&a?.color?`bg-${a?.color}-50`:"dark:bg-black-600 "} ${V||"text-neutral-900 dark:text-black-200"}`;return`${t} ${l} ${we} ${h}`},_=()=>r!==null?r:o&&p?p(o,se):s;return n.useEffect(()=>{i&&!x&&(O?.(),A(!1))},[i,x,O]),e.jsxs("div",{className:b("flex gap-0.5 w-full relative",m&&g?"border rounded-lg border-primary-100 p-1":"",{"error-field":!!f}),onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),children:[g&&!m?e.jsx("div",{className:"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5"}):null,e.jsxs("div",{className:b("flex flex-col w-full"),children:[e.jsx("label",{htmlFor:"text",className:`text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${ee?"":"capitalize"} ${te||""}`,children:e.jsxs("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1",children:[e.jsxs("div",{className:"inline-flex min-w-0 items-center gap-1 flex-wrap",children:[e.jsx(Ne.InputLabel,{label:J||"",required:z||!1,isRequiredConditional:Y||!1}),oe&&e.jsx(N.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),le&&!c.shouldShowConfidenceScore(j)&&e.jsx(Ie.AIExtractedIndicator,{}),e.jsx(ye.Label,{labels:G}),M&&e.jsx($,{placement:"top",title:`${M}${o?` | ${o}`:""}`,children:e.jsx("div",{className:"cursor-pointer",children:e.jsx(qe.HelpIcon,{className:"w-icon-sm h-icon-sm"})})})]}),e.jsxs("div",{className:"flex items-center gap-1 justify-self-end",children:[c.shouldShowConfidenceScore(j)&&d?e.jsx($,{placement:"top-end",title:w??"",hideTooltip:w==null,className:"cursor-pointer",children:e.jsxs("div",{className:b("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",c.getConfidenceScoreBadgeClass(d)),onClick:()=>re?.(ne),children:[e.jsx(ke.AIStarIcon,{size:12,fill:c.getConfidenceScoreBadgeColor(d),fillSecondary:c.getConfidenceScoreBadgeFill(d)}),e.jsxs("span",{className:b("text-xs font-medium leading-4",c.getConfidenceScoreBadgeTextColor(d)),children:[j,"%"]})]})}):null,g&&m&&v?e.jsx("button",{id:"btn-master-data-input-add-to-document",className:"cursor-pointer",onClick:()=>ge(s?.toString()||""),type:"button",children:e.jsx(ve.Tooltip,{placement:"top",title:de("Add to document"),children:e.jsx(N.NoteAddOutlined,{sx:{fontSize:16,color:ie?.[600]||"var(--color-primary-600)"}})})}):null]})]})}),e.jsxs("label",{className:"relative block mt-1",children:[e.jsx($,{title:xe?_():"",children:e.jsx("input",{id:W,ref:k,required:z,placeholder:Q,className:je(),onChange:t=>{E(t.target.value,y),u(t.target?.value)},onKeyDown:me,value:_(),defaultValue:X,disabled:!0,autoComplete:"off",onBlur:ae})}),e.jsx(T,{id:"btn-dynamic-data-input-rx-cross",onClick:be,className:"absolute inset-y-0 right-1 flex items-center px-2 focus:border-transparent",variant:"ghost",disabled:R,children:e.jsx($e.CloseIcon,{className:"w-6 h-6 text-neutral-500 dark:text-neutral-400 w-sm h-sm"})}),e.jsx(T,{id:"btn-dynamic-data-input-ai-outline-pic-center",onClick:q,className:"absolute inset-y-0 right-8 flex items-center px-2 focus:border-transparent",variant:"ghost",disabled:R,children:e.jsx(N.TableChartRounded,{className:"text-neutral-500 dark:text-neutral-400 w-sm h-sm"})})]}),f&&e.jsx(Se.Typography,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:f}),i&&P&&e.jsx(P,{isVisible:i,onSelected:he,onClose:q,masterDataColumnName:Z,masterDataFilters:F,masterDataName:x,masterDataId:x,showFilters:!0})]}),m&&a&&C&&B&&e.jsx("div",{role:"tooltip",tabIndex:0,className:"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl",onClick:t=>t.stopPropagation(),onMouseDown:t=>t.preventDefault(),onKeyDown:t=>{t.key==="Escape"&&S(!1)},children:e.jsx(B,{riskDetails:a})})]})});U.displayName="MasterDataInputField";exports.MasterDataInputField=U;
2
2
  //# sourceMappingURL=MasterDataInputField.cjs.js.map