@monolith-forensics/monolith-ui 1.0.12 → 1.1.1

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 (143) hide show
  1. package/dist/Button/Button.d.ts +19 -0
  2. package/dist/Button/Button.js +332 -0
  3. package/dist/Button/index.d.ts +2 -0
  4. package/dist/Button/index.js +8 -0
  5. package/dist/Calendar/Calendar.d.ts +15 -0
  6. package/dist/Calendar/Calendar.js +232 -0
  7. package/dist/Calendar/CalendarStyles.d.ts +36 -0
  8. package/{src/components → dist}/Calendar/CalendarStyles.js +32 -52
  9. package/dist/Calendar/calendarHelpers.d.ts +53 -0
  10. package/dist/Calendar/calendarHelpers.js +181 -0
  11. package/dist/Calendar/index.d.ts +1 -0
  12. package/dist/Calendar/index.js +8 -0
  13. package/dist/CheckBox/CheckBox.d.ts +11 -0
  14. package/dist/CheckBox/CheckBox.js +34 -0
  15. package/dist/CheckBox/index.d.ts +1 -0
  16. package/dist/CheckBox/index.js +8 -0
  17. package/dist/DateInput/DateInput.d.ts +24 -0
  18. package/dist/DateInput/DateInput.js +511 -0
  19. package/dist/DateInput/index.d.ts +1 -0
  20. package/dist/DateInput/index.js +8 -0
  21. package/dist/DropDownMenu/DropDownMenu.d.ts +36 -0
  22. package/dist/DropDownMenu/DropDownMenu.js +212 -0
  23. package/dist/DropDownMenu/index.d.ts +1 -0
  24. package/dist/DropDownMenu/index.js +8 -0
  25. package/dist/Error/Error.d.ts +4 -0
  26. package/dist/Error/Error.js +38 -0
  27. package/dist/Error/index.d.ts +1 -0
  28. package/dist/Error/index.js +8 -0
  29. package/dist/FieldLabel/FieldLabel.d.ts +19 -0
  30. package/dist/FieldLabel/FieldLabel.js +119 -0
  31. package/dist/FieldLabel/index.js +8 -0
  32. package/dist/FileInputField/FileInputField.d.ts +18 -0
  33. package/dist/FileInputField/FileInputField.js +116 -0
  34. package/dist/FileInputField/index.d.ts +1 -0
  35. package/dist/FileInputField/index.js +8 -0
  36. package/dist/Flyout/Flyout.d.ts +10 -0
  37. package/dist/Flyout/Flyout.js +111 -0
  38. package/dist/Flyout/FlyoutHeader.d.ts +5 -0
  39. package/dist/Flyout/FlyoutHeader.js +12 -0
  40. package/dist/Flyout/FlyoutTitle.d.ts +2 -0
  41. package/dist/Flyout/FlyoutTitle.js +13 -0
  42. package/dist/Flyout/index.d.ts +3 -0
  43. package/dist/Flyout/index.js +12 -0
  44. package/dist/FormSection/FormSection.d.ts +9 -0
  45. package/dist/FormSection/FormSection.js +51 -0
  46. package/dist/FormSection/index.d.ts +1 -0
  47. package/dist/FormSection/index.js +8 -0
  48. package/dist/Grid/Grid.d.ts +6 -0
  49. package/dist/Grid/Grid.js +15 -0
  50. package/dist/Grid/index.d.ts +1 -0
  51. package/dist/Grid/index.js +8 -0
  52. package/dist/IconButton/IconButton.d.ts +5 -0
  53. package/dist/IconButton/IconButton.js +30 -0
  54. package/dist/IconButton/index.d.ts +1 -0
  55. package/dist/IconButton/index.js +8 -0
  56. package/dist/Input/Input.d.ts +21 -0
  57. package/dist/Input/Input.js +148 -0
  58. package/dist/Input/index.js +8 -0
  59. package/dist/Modal/Modal.d.ts +14 -0
  60. package/dist/Modal/Modal.js +134 -0
  61. package/dist/Modal/index.d.ts +1 -0
  62. package/dist/Modal/index.js +8 -0
  63. package/dist/Pill/Pill.d.ts +11 -0
  64. package/dist/Pill/Pill.js +146 -0
  65. package/dist/Pill/index.js +8 -0
  66. package/dist/SelectBox/SelectBox.d.ts +45 -0
  67. package/dist/SelectBox/SelectBox.js +469 -0
  68. package/dist/SelectBox/index.d.ts +1 -0
  69. package/dist/SelectBox/index.js +8 -0
  70. package/dist/Switch/Switch.d.ts +18 -0
  71. package/dist/Switch/Switch.js +157 -0
  72. package/dist/Switch/index.d.ts +1 -0
  73. package/dist/Switch/index.js +8 -0
  74. package/dist/TagBox/TagBox.d.ts +38 -0
  75. package/dist/TagBox/TagBox.js +440 -0
  76. package/dist/TagBox/TagBoxStyles.d.ts +11 -0
  77. package/dist/TagBox/TagBoxStyles.js +113 -0
  78. package/dist/TagBox/index.d.ts +1 -0
  79. package/dist/TagBox/index.js +8 -0
  80. package/dist/TextArea/TextArea.d.ts +16 -0
  81. package/dist/TextArea/TextArea.js +80 -0
  82. package/dist/TextArea/index.js +8 -0
  83. package/dist/TextAreaInput/TextAreaInput.d.ts +12 -0
  84. package/dist/TextAreaInput/TextAreaInput.js +23 -0
  85. package/dist/TextAreaInput/index.js +8 -0
  86. package/dist/TextInput/TextInput.d.ts +12 -0
  87. package/dist/TextInput/TextInput.js +30 -0
  88. package/dist/TextInput/index.js +8 -0
  89. package/dist/Tooltip/Tooltip.d.ts +12 -0
  90. package/dist/Tooltip/Tooltip.js +53 -0
  91. package/dist/Tooltip/index.d.ts +1 -0
  92. package/dist/Tooltip/index.js +8 -0
  93. package/dist/core/ArrowButton.d.ts +6 -0
  94. package/dist/core/ArrowButton.js +48 -0
  95. package/dist/core/ClearButton.d.ts +6 -0
  96. package/dist/core/ClearButton.js +48 -0
  97. package/dist/core/StyledContent.d.ts +7 -0
  98. package/dist/core/StyledContent.js +46 -0
  99. package/dist/core/StyledFloatContainer.d.ts +2 -0
  100. package/dist/core/StyledFloatContainer.js +10 -0
  101. package/dist/core/Types/Size.d.ts +2 -0
  102. package/dist/core/Types/Size.js +2 -0
  103. package/dist/core/Types/Variant.d.ts +2 -0
  104. package/dist/core/Types/Variant.js +2 -0
  105. package/dist/core/index.d.ts +6 -0
  106. package/dist/core/index.js +14 -0
  107. package/dist/index.d.ts +22 -0
  108. package/dist/index.js +51 -0
  109. package/package.json +15 -20
  110. package/.gitattributes +0 -2
  111. package/rollup.config.js +0 -10
  112. package/src/components/ArrowButton/ArrowButton.tsx +0 -54
  113. package/src/components/ArrowButton/index.tsx +0 -1
  114. package/src/components/Button/Button.tsx +0 -278
  115. package/src/components/Button/index.ts +0 -1
  116. package/src/components/Calendar/Calendar.js +0 -365
  117. package/src/components/Calendar/calendarHelpers.js +0 -194
  118. package/src/components/DateInput/DateInput.js +0 -583
  119. package/src/components/FieldLabel/FieldLabel.tsx +0 -152
  120. package/src/components/FileInputField/FileInputField.js +0 -171
  121. package/src/components/Input/Input.tsx +0 -141
  122. package/src/components/Pill/Pill.tsx +0 -144
  123. package/src/components/SelectBox/SelectBox.js +0 -543
  124. package/src/components/TagBox/TagBox.js +0 -563
  125. package/src/components/TextArea/TextArea.tsx +0 -70
  126. package/src/components/TextAreaInput/TextAreaInput.tsx +0 -48
  127. package/src/components/TextInput/TextInput.tsx +0 -50
  128. package/src/components/core/index.js +0 -16
  129. package/src/components/index.ts +0 -7
  130. package/src/components/theme/breakpoints.js +0 -11
  131. package/src/components/theme/components.js +0 -140
  132. package/src/components/theme/index.js +0 -77
  133. package/src/components/theme/shadows.js +0 -33
  134. package/src/components/theme/typography.js +0 -58
  135. package/src/components/theme/variants.js +0 -235
  136. package/src/index.ts +0 -1
  137. package/tsconfig.json +0 -109
  138. /package/{src/components/FieldLabel/index.ts → dist/FieldLabel/index.d.ts} +0 -0
  139. /package/{src/components/Input/index.tsx → dist/Input/index.d.ts} +0 -0
  140. /package/{src/components/Pill/index.ts → dist/Pill/index.d.ts} +0 -0
  141. /package/{src/components/TextArea/index.ts → dist/TextArea/index.d.ts} +0 -0
  142. /package/{src/components/TextAreaInput/index.ts → dist/TextAreaInput/index.d.ts} +0 -0
  143. /package/{src/components/TextInput/index.tsx → dist/TextInput/index.d.ts} +0 -0
@@ -0,0 +1,38 @@
1
+ import { ReactNode } from "react";
2
+ import { Variant, Size } from "../core";
3
+ type Option = {
4
+ label: string;
5
+ value: any;
6
+ group?: string;
7
+ data: any;
8
+ };
9
+ interface TagBoxProps {
10
+ className?: string;
11
+ data?: Option[];
12
+ placeholder?: string;
13
+ arrow?: boolean;
14
+ defaultValue?: Option[];
15
+ grouped?: boolean;
16
+ searchFn?: (value: string) => void;
17
+ onChange?: (value: any[]) => void;
18
+ onScroll?: () => void;
19
+ onSearch?: (value: string) => void;
20
+ onItemAdded?: (value: any) => void;
21
+ size?: Size;
22
+ variant?: Variant;
23
+ width?: string;
24
+ allowCustomValue?: boolean;
25
+ searchable?: boolean;
26
+ clearable?: boolean;
27
+ label?: string;
28
+ description?: string;
29
+ required?: boolean;
30
+ error?: string;
31
+ loading?: boolean;
32
+ renderOption?: (item: Option | string) => ReactNode;
33
+ TooltipContent?: (props: {
34
+ data: any;
35
+ }) => JSX.Element;
36
+ }
37
+ declare const TagBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<TagBoxProps, never>> & string & Omit<({ className, data, placeholder, arrow, defaultValue, grouped, searchFn, onChange, onScroll, onSearch, onItemAdded, size, variant, width, allowCustomValue, searchable, clearable, label, description, required, error, loading, renderOption, TooltipContent, }: TagBoxProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
38
+ export default TagBox;
@@ -0,0 +1,440 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ const jsx_runtime_1 = require("react/jsx-runtime");
18
+ const styled_components_1 = __importDefault(require("styled-components"));
19
+ const react_1 = require("@floating-ui/react");
20
+ const react_2 = require("react");
21
+ const __1 = require("..");
22
+ const core_1 = require("../core");
23
+ const StyledInputContainer = styled_components_1.default.div `
24
+ position: relative;
25
+ cursor: pointer;
26
+
27
+ user-select: none;
28
+
29
+ display: flex;
30
+ flex-direction: row;
31
+ align-items: center;
32
+ user-select: none;
33
+
34
+ pointer-events: all;
35
+ outline: none;
36
+
37
+ border-radius: 5px;
38
+ transition: border 0.1s ease-in-out;
39
+ border: 1px solid
40
+ ${({ theme, variant }) => {
41
+ switch (variant) {
42
+ case "filled":
43
+ return "transparent";
44
+ case "outlined":
45
+ return theme.palette.input.border;
46
+ case "text":
47
+ return "transparent";
48
+ default:
49
+ return theme.palette.input.border;
50
+ }
51
+ }};
52
+ font-weight: 500;
53
+ color: ${(props) => props.theme.palette.text.primary};
54
+ font-size: ${({ size }) => size === "xs"
55
+ ? "12px"
56
+ : size === "sm"
57
+ ? "14px"
58
+ : size === "md"
59
+ ? "16px"
60
+ : size === "lg"
61
+ ? "18px"
62
+ : size === "xl"
63
+ ? "20px"
64
+ : "12px"};
65
+
66
+ width: 100%;
67
+ min-height: ${({ size }) => size === "xs"
68
+ ? "26px"
69
+ : size === "sm"
70
+ ? "30px"
71
+ : size === "md"
72
+ ? "36px"
73
+ : size === "lg"
74
+ ? "42px"
75
+ : size === "xl"
76
+ ? "50px"
77
+ : "26px"};
78
+
79
+ &[data-button-right="true"] {
80
+ padding-right: 36px;
81
+ }
82
+
83
+ background-color: ${({ theme, variant }) => {
84
+ switch (variant) {
85
+ case "filled":
86
+ return theme.palette.input.background;
87
+ case "outlined":
88
+ return theme.palette.input.background;
89
+ case "text":
90
+ return "transparent";
91
+ default:
92
+ return theme.palette.input.background;
93
+ }
94
+ }};
95
+
96
+ &[readOnly] {
97
+ cursor: pointer;
98
+ }
99
+
100
+ & [data-has-space="true"] {
101
+ padding-left: 4px;
102
+ }
103
+
104
+ & [data-selected="true"] {
105
+ background-color: ${(props) => props.theme.palette.primary.main}50;
106
+ }
107
+
108
+ &[data-empty="true"] {
109
+ color: ${(props) => props.theme.palette.input.placeholder};
110
+ div {
111
+ color: ${(props) => props.theme.palette.input.placeholder};
112
+ }
113
+ }
114
+
115
+ & [data-default-btn="true"] {
116
+ color: ${(props) => props.theme.palette.text.secondary};
117
+ div {
118
+ color: ${(props) => props.theme.palette.text.secondary};
119
+ }
120
+ }
121
+
122
+ &[data-open="true"] {
123
+ border: 1px solid ${(props) => props.theme.palette.primary.main};
124
+ }
125
+
126
+ &:focus-within {
127
+ border: 1px solid ${(props) => props.theme.palette.primary.main};
128
+ }
129
+
130
+ &:focus {
131
+ border: 1px solid ${(props) => props.theme.palette.primary.main};
132
+ }
133
+ `;
134
+ // styled input with forwardRef
135
+ const StyledInput = (0, styled_components_1.default)((_a) => {
136
+ var { className, inputRef } = _a, props = __rest(_a, ["className", "inputRef"]);
137
+ return ((0, jsx_runtime_1.jsx)(__1.Input, Object.assign({ ref: inputRef, className: className + " mfTagBox-input" }, props)));
138
+ }) `
139
+ &.mfTagBox-input {
140
+ pointer-events: all;
141
+ outline: none;
142
+ background: transparent;
143
+ flex: 1;
144
+ appearance: none;
145
+ border: 0;
146
+ color: inherit;
147
+
148
+ height: 100%;
149
+ width: 100%;
150
+
151
+ &:focus {
152
+ border: 0;
153
+ }
154
+ }
155
+ `;
156
+ const GroupTitle = (0, styled_components_1.default)((_a) => {
157
+ var { className, children } = _a, props = __rest(_a, ["className", "children"]);
158
+ return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: className }, props, { children: [(0, jsx_runtime_1.jsx)("div", { className: "group-line" }), (0, jsx_runtime_1.jsx)("div", { className: "group-label", children: children }), (0, jsx_runtime_1.jsx)("div", { className: "group-line" })] })));
159
+ }) `
160
+ display: flex;
161
+ flex-direction: row;
162
+ align-items: center;
163
+ justify-content: space-between;
164
+ gap: 10px;
165
+
166
+ color: ${(props) => props.theme.palette.text.secondary};
167
+
168
+ padding: ${({ size }) => size === "xs"
169
+ ? "2px 8px"
170
+ : size === "sm"
171
+ ? "4px 10px"
172
+ : size === "md"
173
+ ? "4px 12px"
174
+ : size === "lg"
175
+ ? "5px 14px"
176
+ : size === "xl"
177
+ ? "6px 16px"
178
+ : "2px 8px"};
179
+
180
+ .group-label {
181
+ white-space: nowrap;
182
+ overflow: hidden;
183
+ text-overflow: ellipsis;
184
+ width: fit-content;
185
+ min-width: fit-content;
186
+
187
+ font-weight: 500;
188
+
189
+ font-size: ${({ size }) => size === "xs"
190
+ ? "11px"
191
+ : size === "sm"
192
+ ? "13px"
193
+ : size === "md"
194
+ ? "15px"
195
+ : size === "lg"
196
+ ? "17px"
197
+ : size === "xl"
198
+ ? "19px"
199
+ : "11px"};
200
+ }
201
+
202
+ .group-line {
203
+ border-top: 1px solid ${(props) => props.theme.palette.divider};
204
+ width: 100%;
205
+ }
206
+ `;
207
+ const PillContainer = styled_components_1.default.div `
208
+ display: flex;
209
+ align-items: center;
210
+ gap: 5px;
211
+ flex-wrap: wrap;
212
+ flex-grow: 1;
213
+
214
+ padding: ${({ size }) => size === "xs"
215
+ ? "0px 8px"
216
+ : size === "sm"
217
+ ? "0px 10px"
218
+ : size === "md"
219
+ ? "0px 12px"
220
+ : size === "lg"
221
+ ? "0px 14px"
222
+ : size === "xl"
223
+ ? "0px 16px"
224
+ : "0px 8px"};
225
+
226
+ padding-top: 5px;
227
+
228
+ &[data-empty="true"] {
229
+ display: none;
230
+ }
231
+ `;
232
+ const StyledInnerContainer = styled_components_1.default.div `
233
+ display: flex;
234
+ flex-direction: column;
235
+ width: 100%;
236
+
237
+ &[data-button-right="true"] {
238
+ padding-right: 30px;
239
+ }
240
+ `;
241
+ const ExtendedStyledContent = (0, styled_components_1.default)(core_1.StyledContent) `
242
+ overflow-y: auto;
243
+ `;
244
+ const StyledItem = styled_components_1.default.div `
245
+ line-height: 1;
246
+ color: ${(props) => props.theme.palette.text.primary};
247
+ border-radius: 3px;
248
+ display: flex;
249
+ align-items: center;
250
+ min-height: 25px;
251
+ padding: 7px 10px;
252
+ position: relative;
253
+ user-select: none;
254
+ outline: none;
255
+
256
+ cursor: pointer;
257
+
258
+ font-family: "Arial", sans-serif;
259
+ font-size: ${({ size }) => size === "xs"
260
+ ? "11px"
261
+ : size === "sm"
262
+ ? "13px"
263
+ : size === "md"
264
+ ? "15px"
265
+ : size === "lg"
266
+ ? "17px"
267
+ : size === "xl"
268
+ ? "19px"
269
+ : "11px"};
270
+
271
+ &[data-disabled] {
272
+ color: ${(props) => props.theme.palette.text.secondary};
273
+ pointer-events: "none";
274
+ }
275
+
276
+ &:hover {
277
+ background-color: ${(props) => props.theme.palette.action.hover};
278
+ color: ${(props) => props.theme.palette.text.primary};
279
+ }
280
+
281
+ &[data-selected="true"] {
282
+ display: none;
283
+ color: ${(props) => props.theme.palette.primary.main};
284
+ }
285
+ `;
286
+ const TagBox = (0, styled_components_1.default)(({ className, data = [], placeholder = "Select or enter tags", arrow = true, defaultValue = [], grouped, searchFn, onChange, onScroll, onSearch, onItemAdded, size = "sm", variant = "filled", width = "100%", allowCustomValue = true, searchable = false, clearable = false, label, description, required = false, error, loading = false, renderOption, TooltipContent, }) => {
287
+ var _a, _b, _c, _d, _e, _f;
288
+ const isObjectArray = data.length > 0 && ((_a = data[0]) === null || _a === void 0 ? void 0 : _a.label) !== undefined;
289
+ const [isOpen, setIsOpen] = (0, react_2.useState)(false);
290
+ const [selectedItems, setSelectedItems] = (0, react_2.useState)(defaultValue);
291
+ const [searchValue, setSearchValue] = (0, react_2.useState)("");
292
+ const inputRef = (0, react_2.useRef)(null);
293
+ const scrollContainerRef = (0, react_2.useRef)(null);
294
+ const filteredItems = data
295
+ .filter((item) => {
296
+ const itemValue = (isObjectArray ? item.label : item);
297
+ return itemValue.toLowerCase().includes(searchValue.toLowerCase());
298
+ })
299
+ .sort((a, b) => {
300
+ if (grouped) {
301
+ const aValue = a.group;
302
+ const bValue = b.group;
303
+ return aValue.localeCompare(bValue);
304
+ }
305
+ // return current sort order
306
+ return 0;
307
+ });
308
+ const groupedItems = grouped
309
+ ? filteredItems.reduce((acc, item) => {
310
+ if (!item.group) {
311
+ item.group = "Other";
312
+ }
313
+ if (acc[item.group]) {
314
+ acc[item.group].push(item);
315
+ }
316
+ else {
317
+ acc[item.group] = [item];
318
+ }
319
+ return acc;
320
+ }, {})
321
+ : {};
322
+ const groups = grouped
323
+ ? Object.keys(groupedItems)
324
+ .map((group) => ({
325
+ label: group,
326
+ items: groupedItems[group],
327
+ }))
328
+ .sort((a, b) => a.label.localeCompare(b.label))
329
+ : [];
330
+ const { refs, floatingStyles, update } = (0, react_1.useFloating)({
331
+ open: isOpen,
332
+ onOpenChange: setIsOpen,
333
+ placement: "bottom-start",
334
+ strategy: "absolute",
335
+ // Handle collisions with the viewport
336
+ middleware: [(0, react_1.flip)(), (0, react_1.offset)(5)],
337
+ });
338
+ const toggleOpen = () => {
339
+ setIsOpen((prev) => {
340
+ var _a;
341
+ if (!prev) {
342
+ if (inputRef.current) {
343
+ const inputEl = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current;
344
+ (_a = inputEl === null || inputEl === void 0 ? void 0 : inputEl.focus) === null || _a === void 0 ? void 0 : _a.call(inputEl);
345
+ }
346
+ }
347
+ return !prev;
348
+ });
349
+ };
350
+ const handleClear = (e) => {
351
+ e.preventDefault();
352
+ e.stopPropagation();
353
+ if (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current)
354
+ inputRef.current.value = "";
355
+ onChange === null || onChange === void 0 ? void 0 : onChange([]);
356
+ setSelectedItems([]);
357
+ setSearchValue("");
358
+ searchFn === null || searchFn === void 0 ? void 0 : searchFn("");
359
+ setIsOpen(false);
360
+ };
361
+ const handleChangeSelection = (0, react_2.useCallback)((option) => {
362
+ setSelectedItems((prev) => {
363
+ onChange === null || onChange === void 0 ? void 0 : onChange([...prev, option]);
364
+ return [...prev, option];
365
+ });
366
+ }, [onChange]);
367
+ const handleItemClick = (item) => {
368
+ var _a;
369
+ if ((_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.value)
370
+ inputRef.current.value = "";
371
+ setSearchValue("");
372
+ handleChangeSelection(item);
373
+ };
374
+ const handleRemoveItem = (item) => {
375
+ setSelectedItems((prev) => {
376
+ const newItems = prev.filter((prevItem) => isObjectArray
377
+ ? prevItem.value !== item.value
378
+ : prevItem !== item);
379
+ onChange === null || onChange === void 0 ? void 0 : onChange(newItems);
380
+ return newItems;
381
+ });
382
+ };
383
+ const handleKeyDown = (e) => {
384
+ // Tab key
385
+ if (e.key === "Tab") {
386
+ setIsOpen(false);
387
+ }
388
+ };
389
+ // Close on outside click
390
+ (0, react_2.useEffect)(() => {
391
+ const close = (e) => {
392
+ var _a, _b;
393
+ const target = e.target;
394
+ const referenceElement = (_a = refs === null || refs === void 0 ? void 0 : refs.reference) === null || _a === void 0 ? void 0 : _a.current;
395
+ const floatingElement = (_b = refs === null || refs === void 0 ? void 0 : refs.floating) === null || _b === void 0 ? void 0 : _b.current;
396
+ if (floatingElement && // Check if the floating element exists
397
+ target !== referenceElement && // Check if the target is not the reference (input)
398
+ !referenceElement.contains(target) && // Check if the target is not inside the reference (input)
399
+ !floatingElement.contains(target) // Check if the target is not inside the floating element (content)
400
+ ) {
401
+ setIsOpen(false);
402
+ }
403
+ };
404
+ document.addEventListener("click", close);
405
+ return () => document.removeEventListener("click", close);
406
+ }, [refs.floating, refs.reference]);
407
+ // update when selection changes
408
+ (0, react_2.useEffect)(() => {
409
+ update();
410
+ }, [selectedItems]);
411
+ const referenceEl = (_b = refs === null || refs === void 0 ? void 0 : refs.reference) === null || _b === void 0 ? void 0 : _b.current;
412
+ const contentWidth = ((_e = (_d = (_c = referenceEl === null || referenceEl === void 0 ? void 0 : referenceEl.getClientRects) === null || _c === void 0 ? void 0 : _c.call(referenceEl)) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.width) || "100%";
413
+ const scrollEl = scrollContainerRef === null || scrollContainerRef === void 0 ? void 0 : scrollContainerRef.current;
414
+ const scrollActive = scrollEl
415
+ ? (scrollEl === null || scrollEl === void 0 ? void 0 : scrollEl.scrollHeight) > (scrollEl === null || scrollEl === void 0 ? void 0 : scrollEl.clientHeight)
416
+ : false;
417
+ return ((0, jsx_runtime_1.jsxs)("div", { className: className + " mfTagBox", children: [label && ((0, jsx_runtime_1.jsx)(__1.FieldLabel, { error: error, asterisk: required, size: size, description: description, children: label })), (0, jsx_runtime_1.jsxs)(StyledInputContainer, { ref: refs.setReference, onClick: toggleOpen, size: size, variant: variant, onKeyDown: handleKeyDown, "data-open": isOpen, children: [(0, jsx_runtime_1.jsxs)(StyledInnerContainer, { "data-button-right": arrow || clearable, children: [(0, jsx_runtime_1.jsx)(PillContainer, { size: size, "data-empty": (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) === 0, children: selectedItems.map((item, index) => ((0, jsx_runtime_1.jsx)(__1.Pill, { size: "xs", onRemove: () => handleRemoveItem(item), children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (item === null || item === void 0 ? void 0 : item.label) || item })) }, index))) }), (searchable || allowCustomValue || selectedItems.length === 0) && ((0, jsx_runtime_1.jsx)(StyledInput, { inputRef: inputRef, onChange: (e) => {
418
+ if (searchFn !== undefined) {
419
+ searchFn === null || searchFn === void 0 ? void 0 : searchFn(e.target.value);
420
+ }
421
+ else {
422
+ setSearchValue(e.target.value);
423
+ }
424
+ update();
425
+ }, placeholder: placeholder, size: size, readOnly: !(searchable || allowCustomValue), "data-button-right": arrow || clearable }))] }), clearable &&
426
+ (selectedItems.length > 0 || !!((_f = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _f === void 0 ? void 0 : _f.value)) ? ((0, jsx_runtime_1.jsx)(core_1.ClearButton, { onClick: handleClear })) : arrow ? ((0, jsx_runtime_1.jsx)(core_1.ArrowButton, {})) : null] }), isOpen && ((0, jsx_runtime_1.jsx)(core_1.StyledFloatContainer, { ref: refs.setFloating, style: floatingStyles, className: "mfFloating", children: (0, jsx_runtime_1.jsx)(ExtendedStyledContent, { className: "mfFloatingContent", style: { width: contentWidth, maxWidth: contentWidth }, variant: variant, onScroll: onScroll, "data-scroll-active": scrollActive, "data-empty": filteredItems.length === 0 ||
427
+ selectedItems.length === filteredItems.length, children: !loading && grouped
428
+ ? groups.map((group, index) => ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(GroupTitle, { size: size, children: group.label }), group.items.map((item, index) => {
429
+ return ((0, jsx_runtime_1.jsx)(__1.Tooltip, { content: TooltipContent ? ((0, jsx_runtime_1.jsx)(TooltipContent, { data: item.data })) : null, side: "left", children: (0, jsx_runtime_1.jsx)(StyledItem, { className: "mfFloatingItem", onClick: (e) => handleItemClick(item), "data-selected": selectedItems.some((selectedItem) => selectedItem.value ===
430
+ (item === null || item === void 0 ? void 0 : item.value) || selectedItem === item), size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (item === null || item === void 0 ? void 0 : item.label) || item })) }, index) }));
431
+ })] }, group.label)))
432
+ : filteredItems.map((item, index) => {
433
+ return ((0, jsx_runtime_1.jsx)(__1.Tooltip, { content: TooltipContent ? ((0, jsx_runtime_1.jsx)(TooltipContent, { data: item.data })) : null, side: "left", children: (0, jsx_runtime_1.jsx)(StyledItem, { className: "mfFloatingItem", onClick: (e) => handleItemClick(item), "data-selected": selectedItems.some((selectedItem) => selectedItem.value === (item === null || item === void 0 ? void 0 : item.value) ||
434
+ selectedItem === item), size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (item === null || item === void 0 ? void 0 : item.label) || item })) }, index) }, item.value || item));
435
+ }) }) }))] }));
436
+ }) `
437
+ position: relative;
438
+ cursor: pointer;
439
+ `;
440
+ exports.default = TagBox;
@@ -0,0 +1,11 @@
1
+ export declare const TagBoxContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
+ export declare const TagBoxInner: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
+ export declare const TagsContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
+ export declare const TagBoxInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>> & string;
5
+ export declare const Tag: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
6
+ export declare const TagText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
7
+ export declare const TagKillButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>, "ref"> & {
8
+ ref?: ((instance: SVGSVGElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<SVGSVGElement> | null | undefined;
9
+ }, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>, keyof import("react").Component<any, {}, any>>;
10
+ export declare const TagBoxOptions: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
11
+ export declare const TagBoxOption: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TagBoxOption = exports.TagBoxOptions = exports.TagKillButton = exports.TagText = exports.Tag = exports.TagBoxInput = exports.TagsContainer = exports.TagBoxInner = exports.TagBoxContainer = void 0;
7
+ const styled_components_1 = __importDefault(require("styled-components"));
8
+ const lucide_react_1 = require("lucide-react");
9
+ exports.TagBoxContainer = styled_components_1.default.div `
10
+ width: 100%;
11
+ `;
12
+ exports.TagBoxInner = styled_components_1.default.div `
13
+ height: 33px;
14
+ display: flex;
15
+ border: 1px solid ${(props) => props.theme.palette.input.border};
16
+ color: ${(props) => props.theme.palette.text.primary};
17
+ outline: none;
18
+ padding: 8px 8px;
19
+ width: 100%;
20
+ background-color: ${(props) => props.theme.palette.input.background};
21
+ border-radius: 5px;
22
+ transition: border 0.1s ease-in-out;
23
+ overflow-x: hidden;
24
+ &:focus {
25
+ border: 1px solid ${(props) => props.theme.palette.primary.main};
26
+ }
27
+ `;
28
+ exports.TagsContainer = styled_components_1.default.div `
29
+ display: flex;
30
+ -webkit-box-align: center;
31
+ align-items: center;
32
+ flex-wrap: nowrap;
33
+ margin-left: calc(-5px);
34
+ box-sizing: border-box;
35
+ `;
36
+ exports.TagBoxInput = styled_components_1.default.input `
37
+ border: none;
38
+ outline: none;
39
+ width: 100%;
40
+ min-width: 50px;
41
+ background-color: transparent;
42
+ color: ${(props) => props.theme.palette.text.primary};
43
+ &:focus {
44
+ border: none;
45
+ outline: none;
46
+ }
47
+ `;
48
+ exports.Tag = styled_components_1.default.div `
49
+ display: flex;
50
+ -webkit-box-align: center;
51
+ align-items: center;
52
+ background-color: rgb(26, 27, 30);
53
+ color: rgb(193, 194, 197);
54
+ height: 22px;
55
+ padding-left: 10px;
56
+ padding-right: 0px;
57
+ font-weight: 500;
58
+ font-size: 12px;
59
+ border-radius: 4px;
60
+ cursor: default;
61
+ user-select: none;
62
+ max-width: 120px;
63
+ margin: calc(3px) calc(5px);
64
+ `;
65
+ exports.TagText = styled_components_1.default.div `
66
+ display: flex;
67
+ -webkit-box-align: center;
68
+ align-items: center;
69
+ background-color: rgb(26, 27, 30);
70
+ color: rgb(193, 194, 197);
71
+ height: 22px;
72
+ padding-right: 0px;
73
+ font-weight: 500;
74
+ font-size: 12px;
75
+ border-radius: 4px;
76
+ cursor: default;
77
+ user-select: none;
78
+ max-width: 75px;
79
+ white-space: nowrap;
80
+ overflow: hidden;
81
+ text-overflow: ellipsis;
82
+ `;
83
+ exports.TagKillButton = (0, styled_components_1.default)(lucide_react_1.XIcon) `
84
+ -webkit-tap-highlight-color: transparent;
85
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
86
+ Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
87
+ cursor: pointer;
88
+ appearance: none;
89
+ text-align: left;
90
+ text-decoration: none;
91
+ box-sizing: border-box;
92
+ border: 1px solid transparent;
93
+ background-color: transparent;
94
+ position: relative;
95
+ height: 19px;
96
+ min-height: 19px;
97
+ width: 22px;
98
+ min-width: 19px;
99
+ border-radius: 2px;
100
+ line-height: 1;
101
+ display: flex;
102
+ -webkit-box-align: center;
103
+ align-items: center;
104
+ -webkit-box-pack: center;
105
+ justify-content: center;
106
+ color: rgb(193, 194, 197);
107
+ padding: 0px 3px;
108
+ &:hover {
109
+ color: rgb(255, 255, 255);
110
+ }
111
+ `;
112
+ exports.TagBoxOptions = styled_components_1.default.div ``;
113
+ exports.TagBoxOption = styled_components_1.default.div ``;
@@ -0,0 +1 @@
1
+ export { default } from "./TagBox";
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = void 0;
7
+ var TagBox_1 = require("./TagBox");
8
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(TagBox_1).default; } });
@@ -0,0 +1,16 @@
1
+ import { Size, Variant } from "../core";
2
+ interface TextAreaProps {
3
+ ref?: React.Ref<HTMLTextAreaElement>;
4
+ className?: string;
5
+ size?: Size;
6
+ variant?: Variant;
7
+ width?: string | number | null | undefined;
8
+ style?: React.CSSProperties;
9
+ placeholder?: string;
10
+ onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
11
+ onKeyUp?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
12
+ }
13
+ declare const TextArea: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("react-textarea-autosize").TextareaAutosizeProps & import("react").RefAttributes<HTMLTextAreaElement>, "ref"> & {
14
+ ref?: ((instance: HTMLTextAreaElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLTextAreaElement> | null | undefined;
15
+ }, TextAreaProps>> & string & Omit<import("react").ForwardRefExoticComponent<import("react-textarea-autosize").TextareaAutosizeProps & import("react").RefAttributes<HTMLTextAreaElement>>, keyof import("react").Component<any, {}, any>>;
16
+ export default TextArea;