@monolith-forensics/monolith-ui 1.0.12 → 1.1.0

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 (189) hide show
  1. package/Button/Button.tsx +382 -0
  2. package/Button/index.ts +2 -0
  3. package/{src/components/Calendar/Calendar.js → Calendar/Calendar.tsx} +104 -93
  4. package/{src/components/Calendar/CalendarStyles.js → Calendar/CalendarStyles.tsx} +26 -36
  5. package/{src/components/Calendar/calendarHelpers.js → Calendar/calendarHelpers.ts} +10 -8
  6. package/Calendar/index.ts +1 -0
  7. package/CheckBox/CheckBox.tsx +61 -0
  8. package/CheckBox/index.ts +1 -0
  9. package/{src/components/DateInput/DateInput.js → DateInput/DateInput.tsx} +227 -93
  10. package/DateInput/index.ts +1 -0
  11. package/DropDownMenu/DropDownMenu.tsx +402 -0
  12. package/DropDownMenu/index.ts +1 -0
  13. package/Error/Error.tsx +51 -0
  14. package/Error/index.ts +1 -0
  15. package/{src/components/FieldLabel → FieldLabel}/FieldLabel.tsx +25 -22
  16. package/{src/components/FileInputField/FileInputField.js → FileInputField/FileInputField.tsx} +23 -15
  17. package/FileInputField/index.ts +1 -0
  18. package/Flyout/Flyout.tsx +172 -0
  19. package/Flyout/FlyoutHeader.tsx +14 -0
  20. package/Flyout/FlyoutTitle.tsx +10 -0
  21. package/Flyout/index.ts +3 -0
  22. package/FormSection/FormSection.tsx +71 -0
  23. package/FormSection/index.ts +1 -0
  24. package/Grid/Grid.tsx +18 -0
  25. package/Grid/index.ts +1 -0
  26. package/IconButton/IconButton.tsx +27 -0
  27. package/IconButton/index.ts +1 -0
  28. package/{src/components/Input → Input}/Input.tsx +57 -34
  29. package/Modal/Modal.tsx +172 -0
  30. package/Modal/index.ts +1 -0
  31. package/{src/components/Pill → Pill}/Pill.tsx +41 -11
  32. package/SelectBox/SelectBox.tsx +745 -0
  33. package/SelectBox/index.ts +1 -0
  34. package/Switch/Switch.tsx +204 -0
  35. package/Switch/index.ts +1 -0
  36. package/TagBox/TagBox.tsx +694 -0
  37. package/TagBox/TagBoxStyles.tsx +116 -0
  38. package/TagBox/index.ts +1 -0
  39. package/{src/components/TextArea → TextArea}/TextArea.tsx +35 -13
  40. package/{src/components/TextAreaInput → TextAreaInput}/TextAreaInput.tsx +11 -13
  41. package/{src/components/TextInput → TextInput}/TextInput.tsx +11 -13
  42. package/Tooltip/Tooltip.tsx +68 -0
  43. package/Tooltip/index.ts +1 -0
  44. package/{src/components/ArrowButton → core}/ArrowButton.tsx +17 -20
  45. package/core/ClearButton.tsx +51 -0
  46. package/core/StyledContent.tsx +50 -0
  47. package/core/StyledFloatContainer.tsx +7 -0
  48. package/core/Types/Size.ts +3 -0
  49. package/core/Types/Variant.ts +10 -0
  50. package/core/index.ts +6 -0
  51. package/dist/Button/Button.d.ts +19 -0
  52. package/dist/Button/Button.js +332 -0
  53. package/dist/Button/index.d.ts +2 -0
  54. package/dist/Button/index.js +8 -0
  55. package/dist/Calendar/Calendar.d.ts +15 -0
  56. package/dist/Calendar/Calendar.js +232 -0
  57. package/dist/Calendar/CalendarStyles.d.ts +36 -0
  58. package/dist/Calendar/CalendarStyles.js +170 -0
  59. package/dist/Calendar/calendarHelpers.d.ts +53 -0
  60. package/dist/Calendar/calendarHelpers.js +181 -0
  61. package/dist/Calendar/index.d.ts +1 -0
  62. package/dist/Calendar/index.js +8 -0
  63. package/dist/CheckBox/CheckBox.d.ts +11 -0
  64. package/dist/CheckBox/CheckBox.js +34 -0
  65. package/dist/CheckBox/index.d.ts +1 -0
  66. package/dist/CheckBox/index.js +8 -0
  67. package/dist/DateInput/DateInput.d.ts +24 -0
  68. package/dist/DateInput/DateInput.js +511 -0
  69. package/dist/DateInput/index.d.ts +1 -0
  70. package/dist/DateInput/index.js +8 -0
  71. package/dist/DropDownMenu/DropDownMenu.d.ts +36 -0
  72. package/dist/DropDownMenu/DropDownMenu.js +212 -0
  73. package/dist/DropDownMenu/index.d.ts +1 -0
  74. package/dist/DropDownMenu/index.js +8 -0
  75. package/dist/Error/Error.d.ts +4 -0
  76. package/dist/Error/Error.js +38 -0
  77. package/dist/Error/index.d.ts +1 -0
  78. package/dist/Error/index.js +8 -0
  79. package/dist/FieldLabel/FieldLabel.d.ts +19 -0
  80. package/dist/FieldLabel/FieldLabel.js +119 -0
  81. package/dist/FieldLabel/index.d.ts +1 -0
  82. package/dist/FieldLabel/index.js +8 -0
  83. package/dist/FileInputField/FileInputField.d.ts +18 -0
  84. package/dist/FileInputField/FileInputField.js +116 -0
  85. package/dist/FileInputField/index.d.ts +1 -0
  86. package/dist/FileInputField/index.js +8 -0
  87. package/dist/Flyout/Flyout.d.ts +10 -0
  88. package/dist/Flyout/Flyout.js +111 -0
  89. package/dist/Flyout/FlyoutHeader.d.ts +5 -0
  90. package/dist/Flyout/FlyoutHeader.js +12 -0
  91. package/dist/Flyout/FlyoutTitle.d.ts +2 -0
  92. package/dist/Flyout/FlyoutTitle.js +13 -0
  93. package/dist/Flyout/index.d.ts +3 -0
  94. package/dist/Flyout/index.js +12 -0
  95. package/dist/FormSection/FormSection.d.ts +9 -0
  96. package/dist/FormSection/FormSection.js +51 -0
  97. package/dist/FormSection/index.d.ts +1 -0
  98. package/dist/FormSection/index.js +8 -0
  99. package/dist/Grid/Grid.d.ts +6 -0
  100. package/dist/Grid/Grid.js +15 -0
  101. package/dist/Grid/index.d.ts +1 -0
  102. package/dist/Grid/index.js +8 -0
  103. package/dist/IconButton/IconButton.d.ts +5 -0
  104. package/dist/IconButton/IconButton.js +30 -0
  105. package/dist/IconButton/index.d.ts +1 -0
  106. package/dist/IconButton/index.js +8 -0
  107. package/dist/Input/Input.d.ts +21 -0
  108. package/dist/Input/Input.js +148 -0
  109. package/dist/Input/index.d.ts +1 -0
  110. package/dist/Input/index.js +8 -0
  111. package/dist/Modal/Modal.d.ts +14 -0
  112. package/dist/Modal/Modal.js +134 -0
  113. package/dist/Modal/index.d.ts +1 -0
  114. package/dist/Modal/index.js +8 -0
  115. package/dist/Pill/Pill.d.ts +11 -0
  116. package/dist/Pill/Pill.js +146 -0
  117. package/dist/Pill/index.d.ts +1 -0
  118. package/dist/Pill/index.js +8 -0
  119. package/dist/SelectBox/SelectBox.d.ts +45 -0
  120. package/dist/SelectBox/SelectBox.js +469 -0
  121. package/dist/SelectBox/index.d.ts +1 -0
  122. package/dist/SelectBox/index.js +8 -0
  123. package/dist/Switch/Switch.d.ts +18 -0
  124. package/dist/Switch/Switch.js +157 -0
  125. package/dist/Switch/index.d.ts +1 -0
  126. package/dist/Switch/index.js +8 -0
  127. package/dist/TagBox/TagBox.d.ts +38 -0
  128. package/dist/TagBox/TagBox.js +440 -0
  129. package/dist/TagBox/TagBoxStyles.d.ts +11 -0
  130. package/dist/TagBox/TagBoxStyles.js +113 -0
  131. package/dist/TagBox/index.d.ts +1 -0
  132. package/dist/TagBox/index.js +8 -0
  133. package/dist/TextArea/TextArea.d.ts +16 -0
  134. package/dist/TextArea/TextArea.js +80 -0
  135. package/dist/TextArea/index.d.ts +1 -0
  136. package/dist/TextArea/index.js +8 -0
  137. package/dist/TextAreaInput/TextAreaInput.d.ts +12 -0
  138. package/dist/TextAreaInput/TextAreaInput.js +23 -0
  139. package/dist/TextAreaInput/index.d.ts +1 -0
  140. package/dist/TextAreaInput/index.js +8 -0
  141. package/dist/TextInput/TextInput.d.ts +12 -0
  142. package/dist/TextInput/TextInput.js +30 -0
  143. package/dist/TextInput/index.d.ts +1 -0
  144. package/dist/TextInput/index.js +8 -0
  145. package/dist/Tooltip/Tooltip.d.ts +12 -0
  146. package/dist/Tooltip/Tooltip.js +53 -0
  147. package/dist/Tooltip/index.d.ts +1 -0
  148. package/dist/Tooltip/index.js +8 -0
  149. package/dist/core/ArrowButton.d.ts +6 -0
  150. package/dist/core/ArrowButton.js +48 -0
  151. package/dist/core/ClearButton.d.ts +6 -0
  152. package/dist/core/ClearButton.js +48 -0
  153. package/dist/core/StyledContent.d.ts +7 -0
  154. package/dist/core/StyledContent.js +46 -0
  155. package/dist/core/StyledFloatContainer.d.ts +2 -0
  156. package/dist/core/StyledFloatContainer.js +10 -0
  157. package/dist/core/Types/Size.d.ts +2 -0
  158. package/dist/core/Types/Size.js +2 -0
  159. package/dist/core/Types/Variant.d.ts +2 -0
  160. package/dist/core/Types/Variant.js +2 -0
  161. package/dist/core/index.d.ts +6 -0
  162. package/dist/core/index.js +14 -0
  163. package/dist/index.d.ts +22 -0
  164. package/dist/index.js +51 -0
  165. package/index.ts +22 -0
  166. package/package.json +12 -20
  167. package/{src/components/theme → theme}/components.js +0 -2
  168. package/{src/components/theme → theme}/index.js +0 -1
  169. package/{src/components/theme → theme}/variants.js +0 -1
  170. package/tsconfig.json +11 -11
  171. package/.gitattributes +0 -2
  172. package/rollup.config.js +0 -10
  173. package/src/components/ArrowButton/index.tsx +0 -1
  174. package/src/components/Button/Button.tsx +0 -278
  175. package/src/components/Button/index.ts +0 -1
  176. package/src/components/SelectBox/SelectBox.js +0 -543
  177. package/src/components/TagBox/TagBox.js +0 -563
  178. package/src/components/index.ts +0 -7
  179. package/src/index.ts +0 -1
  180. /package/{src/components/FieldLabel → FieldLabel}/index.ts +0 -0
  181. /package/{src/components/Input/index.tsx → Input/index.ts} +0 -0
  182. /package/{src/components/Pill → Pill}/index.ts +0 -0
  183. /package/{src/components/TextArea → TextArea}/index.ts +0 -0
  184. /package/{src/components/TextAreaInput → TextAreaInput}/index.ts +0 -0
  185. /package/{src/components/TextInput/index.tsx → TextInput/index.ts} +0 -0
  186. /package/{src/components/core/index.js → core/MonolithThemeProvider.js} +0 -0
  187. /package/{src/components/theme → theme}/breakpoints.js +0 -0
  188. /package/{src/components/theme → theme}/shadows.js +0 -0
  189. /package/{src/components/theme → theme}/typography.js +0 -0
@@ -0,0 +1,212 @@
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
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("@floating-ui/react");
8
+ const react_2 = require("react");
9
+ const styled_components_1 = __importDefault(require("styled-components"));
10
+ const __1 = require("..");
11
+ const use_debounce_1 = require("use-debounce");
12
+ const StyledFloatContainer = styled_components_1.default.div `
13
+ z-index: 1500;
14
+ `;
15
+ const StyledInnerItemContainer = styled_components_1.default.div `
16
+ overflow-y: auto;
17
+
18
+ &[data-scroll-active="true"] {
19
+ padding-right: 5px;
20
+ }
21
+ `;
22
+ const SearchInput = (0, react_2.forwardRef)((props, ref) => (0, jsx_runtime_1.jsx)(__1.Input, Object.assign({ ref: ref, style: { marginBottom: 8 } }, props)));
23
+ const StyledItem = styled_components_1.default.div `
24
+ color: ${(props) => props.theme.palette.text.primary};
25
+ border-radius: 3px;
26
+ display: flex;
27
+ flex-direction: row;
28
+ gap: 5px;
29
+ align-items: center;
30
+ min-height: 25px;
31
+ padding: 7px 10px;
32
+ position: relative;
33
+ user-select: none;
34
+ outline: none;
35
+
36
+ white-space: nowrap;
37
+ overflow: hidden;
38
+ text-overflow: ellipsis;
39
+
40
+ cursor: pointer;
41
+
42
+ font-family: ${({ theme }) => theme.typography.fontFamily};
43
+
44
+ font-size: ${({ size }) => size === "xs"
45
+ ? "11px"
46
+ : size === "sm"
47
+ ? "13px"
48
+ : size === "md"
49
+ ? "15px"
50
+ : size === "lg"
51
+ ? "17px"
52
+ : size === "xl"
53
+ ? "19px"
54
+ : "11px"};
55
+
56
+ padding: ${({ size }) => size === "xs"
57
+ ? "2px 8px"
58
+ : size === "sm"
59
+ ? "4px 10px"
60
+ : size === "md"
61
+ ? "4px 12px"
62
+ : size === "lg"
63
+ ? "5px 14px"
64
+ : size === "xl"
65
+ ? "6px 16px"
66
+ : "2px 8px"};
67
+
68
+ &[data-disabled] {
69
+ color: ${(props) => props.theme.palette.text.secondary};
70
+ pointer-events: "none";
71
+ }
72
+
73
+ &:hover {
74
+ background-color: ${(props) => props.theme.palette.action.hover};
75
+ color: ${(props) => props.theme.palette.text.primary};
76
+ }
77
+ `;
78
+ const StyledContent = styled_components_1.default.div `
79
+ position: relative;
80
+ display: flex;
81
+ flex-direction: column;
82
+ overflow-y: hidden;
83
+ overflow-x: hidden;
84
+
85
+ max-height: ${({ maxDropdownHeight }) => Number.isInteger(maxDropdownHeight)
86
+ ? `${maxDropdownHeight}px`
87
+ : maxDropdownHeight || "250px"};
88
+
89
+ background-color: ${(props) => props.theme.palette.background.default};
90
+ background-color: ${({ theme, variant }) => {
91
+ switch (variant) {
92
+ case "filled":
93
+ return theme.palette.input.background;
94
+ case "outlined":
95
+ return theme.palette.input.background;
96
+ case "text":
97
+ return "transparent";
98
+ default:
99
+ return theme.palette.input.background;
100
+ }
101
+ }};
102
+
103
+ border-radius: 5px;
104
+ border: 1px solid ${(props) => props.theme.palette.divider};
105
+ padding: 5px;
106
+ animation-duration: 400ms;
107
+ animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
108
+ will-change: transform, opacity;
109
+
110
+ &[data-empty="true"] {
111
+ display: none;
112
+ }
113
+ `;
114
+ const DropDownMenu = (0, styled_components_1.default)(({ className, children, data = [], variant = "outlined", defaultValue, multiselect = false, size = "xs", TooltipContent, renderOption, onChange, onItemSelect, onScroll, loading, arrow, searchable, dropDownProps, buttonProps, }) => {
115
+ var _a, _b, _c;
116
+ const isObjectArray = (_a = Object.keys((data === null || data === void 0 ? void 0 : data[0]) || {})) === null || _a === void 0 ? void 0 : _a.includes("label");
117
+ const [isOpen, setIsOpen] = (0, react_2.useState)(false);
118
+ const [selected, setSelected] = (0, react_2.useState)(defaultValue || []);
119
+ const [searchValue, setSearchValue] = (0, react_2.useState)("");
120
+ const scrollContainerRef = (0, react_2.useRef)(null);
121
+ const searchInputRef = (0, react_2.useRef)(null);
122
+ const { refs, floatingStyles, context } = (0, react_1.useFloating)({
123
+ open: isOpen,
124
+ onOpenChange: setIsOpen,
125
+ placement: "bottom-start",
126
+ strategy: "absolute",
127
+ // Handle collisions with the viewport
128
+ middleware: [(0, react_1.flip)()],
129
+ });
130
+ const handleAddItem = (item) => {
131
+ setSelected((prev) => {
132
+ let newSelected = [...prev, item];
133
+ const diff = data.filter((i) => !newSelected.find((s) => isObjectArray ? (s === null || s === void 0 ? void 0 : s.value) === (i === null || i === void 0 ? void 0 : i.value) : s === i));
134
+ onChange === null || onChange === void 0 ? void 0 : onChange(newSelected, diff);
135
+ return newSelected;
136
+ });
137
+ };
138
+ const handleRemoveItem = (item) => {
139
+ setSelected((prev) => {
140
+ let newSelected = prev.filter((i) => isObjectArray ? (i === null || i === void 0 ? void 0 : i.value) !== (item === null || item === void 0 ? void 0 : item.value) : i !== item);
141
+ const diff = data.filter((i) => !newSelected.find((s) => isObjectArray ? (s === null || s === void 0 ? void 0 : s.value) === (i === null || i === void 0 ? void 0 : i.value) : s === i));
142
+ onChange === null || onChange === void 0 ? void 0 : onChange(newSelected, diff);
143
+ return newSelected;
144
+ });
145
+ };
146
+ const handleSearch = (0, use_debounce_1.useDebouncedCallback)((e) => {
147
+ setSearchValue(e.target.value);
148
+ }, 150);
149
+ // Close on outside click
150
+ (0, react_2.useEffect)(() => {
151
+ const close = (e) => {
152
+ var _a, _b, _c, _d;
153
+ const target = e.target;
154
+ const referenceElement = (_a = refs === null || refs === void 0 ? void 0 : refs.reference) === null || _a === void 0 ? void 0 : _a.current;
155
+ const floatingElement = (_b = refs === null || refs === void 0 ? void 0 : refs.floating) === null || _b === void 0 ? void 0 : _b.current;
156
+ if (floatingElement && // Check if the floating element exists
157
+ e.target !== referenceElement && // Check if the target is not the reference (input)
158
+ !((_c = referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.contains) === null || _c === void 0 ? void 0 : _c.call(referenceElement, target)) && // Check if the target is not inside the reference (input)
159
+ !((_d = floatingElement === null || floatingElement === void 0 ? void 0 : floatingElement.contains) === null || _d === void 0 ? void 0 : _d.call(floatingElement, target)) // Check if the target is not inside the floating element (content)
160
+ ) {
161
+ setIsOpen(false);
162
+ }
163
+ };
164
+ document.addEventListener("mousedown", close);
165
+ return () => document.removeEventListener("mousdown", close);
166
+ }, [refs.floating, refs.reference]);
167
+ (0, react_2.useEffect)(() => {
168
+ var _a, _b;
169
+ if (isOpen && searchable) {
170
+ (_b = (_a = searchInputRef === null || searchInputRef === void 0 ? void 0 : searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
171
+ }
172
+ if (!isOpen) {
173
+ setSearchValue("");
174
+ }
175
+ }, [isOpen, searchable]);
176
+ const scrollActive = (((_b = scrollContainerRef === null || scrollContainerRef === void 0 ? void 0 : scrollContainerRef.current) === null || _b === void 0 ? void 0 : _b.scrollHeight) || 0) >
177
+ (((_c = scrollContainerRef === null || scrollContainerRef === void 0 ? void 0 : scrollContainerRef.current) === null || _c === void 0 ? void 0 : _c.clientHeight) || 0);
178
+ return ((0, jsx_runtime_1.jsxs)("div", { className: className + " mfDropDownMenu", children: [(0, jsx_runtime_1.jsx)(__1.Button, Object.assign({ ref: (ref) => {
179
+ refs.setReference(ref);
180
+ }, onMouseDown: () => setIsOpen(!isOpen), rightSection: arrow ? (0, jsx_runtime_1.jsx)("span", { children: "\u25BC" }) : null, size: size }, buttonProps, { children: children })), isOpen && ((0, jsx_runtime_1.jsx)(react_1.FloatingPortal, { preserveTabOrder: true, children: (0, jsx_runtime_1.jsx)(react_1.FloatingFocusManager, { context: context, modal: false, children: (0, jsx_runtime_1.jsx)(StyledFloatContainer, { ref: refs.setFloating, style: floatingStyles, className: "mfFloating", children: (0, jsx_runtime_1.jsx)(StyledContent, Object.assign({ className: "mfFloatingContent", style: { width: 150, maxWidth: 400 }, variant: variant }, dropDownProps, { children: (0, jsx_runtime_1.jsxs)(StyledInnerItemContainer, { ref: scrollContainerRef, "data-scroll-active": scrollActive, onScroll: onScroll, children: [loading && (0, jsx_runtime_1.jsx)("div", { children: "Loading..." }), searchable && ((0, jsx_runtime_1.jsx)(SearchInput, { ref: searchInputRef, variant: "outlined", placeholder: "Search", onChange: handleSearch })), !loading &&
181
+ data
182
+ .filter((item) => {
183
+ var _a, _b, _c;
184
+ if (!searchable)
185
+ return true;
186
+ if (isObjectArray) {
187
+ return (((_a = item === null || item === void 0 ? void 0 : item.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchValue.toLowerCase())) ||
188
+ ((_b = item === null || item === void 0 ? void 0 : item.value) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchValue.toLowerCase())));
189
+ }
190
+ return (_c = item
191
+ .toLowerCase) === null || _c === void 0 ? void 0 : _c.call(item).includes(searchValue.toLowerCase());
192
+ })
193
+ .map((item, index) => {
194
+ const isSelected = !!(selected === null || selected === void 0 ? void 0 : selected.find((s) => isObjectArray
195
+ ? (s === null || s === void 0 ? void 0 : s.value) === (item === null || item === void 0 ? void 0 : item.value)
196
+ : s === item));
197
+ 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.jsxs)(StyledItem, { className: "mfFloatingItem", onClick: (e) => {
198
+ e.preventDefault();
199
+ e.stopPropagation();
200
+ if (multiselect) {
201
+ isSelected
202
+ ? handleRemoveItem(item)
203
+ : handleAddItem(item);
204
+ }
205
+ else {
206
+ setIsOpen(false);
207
+ }
208
+ onItemSelect === null || onItemSelect === void 0 ? void 0 : onItemSelect(item);
209
+ }, "data-selected": isSelected, size: size, children: [multiselect && (0, jsx_runtime_1.jsx)(__1.CheckBox, { value: isSelected }), (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || (item === null || item === void 0 ? void 0 : item.label) || item })] }) }, index));
210
+ })] }) })) }) }) }))] }));
211
+ }) ``;
212
+ exports.default = DropDownMenu;
@@ -0,0 +1 @@
1
+ export { default } from "./DropDownMenu";
@@ -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 DropDownMenu_1 = require("./DropDownMenu");
8
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(DropDownMenu_1).default; } });
@@ -0,0 +1,4 @@
1
+ declare const ErrorComponent: ({ error }: {
2
+ error: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
4
+ export default ErrorComponent;
@@ -0,0 +1,38 @@
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
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("react");
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const lucide_react_1 = require("lucide-react");
10
+ const ErrorContainer = styled_components_1.default.div `
11
+ background-color: ${({ theme }) => theme.palette.error.main + "15"};
12
+ color: ${({ theme }) => theme.palette.error.light};
13
+ border: 1px solid #d93025;
14
+ padding: 10px;
15
+ margin-bottom: 10px;
16
+ display: flex;
17
+ justify-content: space-between;
18
+ border-radius: 5px;
19
+ align-items: center;
20
+ `;
21
+ const CloseButton = styled_components_1.default.button `
22
+ background: none;
23
+ border: none;
24
+ color: ${({ theme }) => theme.palette.error.light};
25
+ cursor: pointer;
26
+ `;
27
+ const ErrorText = styled_components_1.default.span `
28
+ margin-left: 10px;
29
+ flex: 1;
30
+ `;
31
+ const ErrorComponent = ({ error }) => {
32
+ const [isVisible, setIsVisible] = (0, react_1.useState)(true);
33
+ const handleClose = () => {
34
+ setIsVisible(false);
35
+ };
36
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isVisible && ((0, jsx_runtime_1.jsxs)(ErrorContainer, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.ShieldAlert, { size: 19 }), (0, jsx_runtime_1.jsx)(ErrorText, { children: error }), (0, jsx_runtime_1.jsx)(CloseButton, { onClick: handleClose, children: (0, jsx_runtime_1.jsx)(lucide_react_1.XIcon, { size: 19 }) })] })) }));
37
+ };
38
+ exports.default = ErrorComponent;
@@ -0,0 +1 @@
1
+ export { default } from "./Error";
@@ -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 Error_1 = require("./Error");
8
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Error_1).default; } });
@@ -0,0 +1,19 @@
1
+ import { ReactNode } from "react";
2
+ import { Size } from "../core";
3
+ interface InfoComponentProps {
4
+ className?: string;
5
+ children?: ReactNode;
6
+ description?: string;
7
+ label?: string | ReactNode;
8
+ }
9
+ export declare const InfoComponent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<InfoComponentProps, never>> & string & Omit<({ className, children, description, label }: InfoComponentProps) => string | number | boolean | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined, keyof import("react").Component<any, {}, any>>;
10
+ interface FieldLabelProps {
11
+ className?: string;
12
+ children?: ReactNode;
13
+ error?: string;
14
+ description?: string;
15
+ size?: Size;
16
+ asterisk?: boolean;
17
+ }
18
+ declare const FieldLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<FieldLabelProps, never>> & string & Omit<({ className, children, error, description, size, }: FieldLabelProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
19
+ export default FieldLabel;
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.InfoComponent = void 0;
30
+ const jsx_runtime_1 = require("react/jsx-runtime");
31
+ const styled_components_1 = __importDefault(require("styled-components"));
32
+ const Tooltip = __importStar(require("@radix-ui/react-tooltip"));
33
+ exports.InfoComponent = (0, styled_components_1.default)(({ className, children, description, label }) => {
34
+ if (!description)
35
+ return children;
36
+ return ((0, jsx_runtime_1.jsx)(Tooltip.Provider, { delayDuration: 800, skipDelayDuration: 0, disableHoverableContent: true, children: (0, jsx_runtime_1.jsxs)(Tooltip.Root, { children: [(0, jsx_runtime_1.jsx)(Tooltip.Trigger, { asChild: true, children: children }), (0, jsx_runtime_1.jsx)(Tooltip.Portal, { children: (0, jsx_runtime_1.jsxs)(Tooltip.Content, { className: className, side: "right", sideOffset: 15, align: "start", onClick: (e) => e.stopPropagation(), children: [(0, jsx_runtime_1.jsx)("div", { className: "title", children: label || "Info" }), (0, jsx_runtime_1.jsx)("div", { children: description || "N/A" })] }) })] }) }));
37
+ }) `
38
+ pointer-events: none;
39
+ z-index: 999999;
40
+ background-color: ${({ theme }) => theme.palette.background.default};
41
+ padding: 15px;
42
+ border-radius: 5px;
43
+ border: 1px solid ${({ theme }) => theme.palette.divider};
44
+ font-size: 0.75rem;
45
+ max-width: 350px;
46
+ width: 250px;
47
+
48
+ white-space: pre-wrap;
49
+
50
+ .title {
51
+ font-size: 0.85rem;
52
+ font-weight: 600;
53
+ margin-bottom: 5px;
54
+ }
55
+ `;
56
+ const FieldLabel = (0, styled_components_1.default)(({ className, children, error, description, size = "sm", }) => {
57
+ return ((0, jsx_runtime_1.jsxs)("div", { className: className + " FieldLabel", children: [(0, jsx_runtime_1.jsx)(exports.InfoComponent, { description: description, label: children, children: (0, jsx_runtime_1.jsx)("div", { className: "label", children: children }) }), error && ((0, jsx_runtime_1.jsx)("div", { className: "error", title: error, children: error || "Invalid Value" }))] }));
58
+ }) `
59
+ user-select: none;
60
+ font-family: apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
61
+ "Helvetica Neue", Arial, sans-serif;
62
+ user-select: none;
63
+ display: flex;
64
+ flex-direction: row;
65
+ align-items: baseline;
66
+ gap: 5px;
67
+
68
+ min-height: 15px;
69
+ font-weight: 400;
70
+ margin-bottom: 2.5px;
71
+
72
+ font-size: ${({ size }) => size === "xs"
73
+ ? "10px"
74
+ : size === "sm"
75
+ ? "12px"
76
+ : size === "md"
77
+ ? "14px"
78
+ : size === "lg"
79
+ ? "16px"
80
+ : size === "xl"
81
+ ? "18px"
82
+ : "10px"};
83
+
84
+ transition: all 0.2s ease;
85
+ color: ${({ theme, error }) => theme.palette.text.secondary};
86
+
87
+ .label {
88
+ width: fit-content;
89
+ min-width: fit-content;
90
+ }
91
+
92
+ .label::after {
93
+ content: ${(props) => (props.asterisk ? "'*'" : "")};
94
+ color: ${({ theme }) => theme.palette.error.main};
95
+ margin-left: 2px;
96
+ }
97
+
98
+ .label:hover {
99
+ cursor: ${({ description }) => (description ? "pointer" : "default")};
100
+ color: ${({ description, theme }) => description ? theme.palette.text.primary : theme.palette.text.secondary};
101
+ }
102
+
103
+ .error {
104
+ user-select: none;
105
+ transition: all 0.2s ease;
106
+ cursor: pointer;
107
+ color: ${({ theme }) => theme.palette.error.main};
108
+ font-size: 10px;
109
+ max-width: 85%;
110
+ white-space: nowrap;
111
+ overflow: hidden;
112
+ text-overflow: ellipsis;
113
+ }
114
+
115
+ .error:hover {
116
+ color: ${({ theme }) => theme.palette.error.light};
117
+ }
118
+ `;
119
+ exports.default = FieldLabel;
@@ -0,0 +1 @@
1
+ export { default } from "./FieldLabel";
@@ -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 FieldLabel_1 = require("./FieldLabel");
8
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(FieldLabel_1).default; } });
@@ -0,0 +1,18 @@
1
+ import { ReactNode, HTMLAttributes } from "react";
2
+ import { DropzoneOptions } from "react-dropzone";
3
+ import { Size, Variant } from "../core";
4
+ interface FileInputFieldProps {
5
+ className?: string;
6
+ children?: ReactNode;
7
+ variant?: Variant;
8
+ label?: string;
9
+ error?: string;
10
+ required?: boolean;
11
+ size?: Size;
12
+ onChange?: (files: File[]) => void;
13
+ onFocus?: () => void;
14
+ dropZoneOptions?: DropzoneOptions;
15
+ style?: HTMLAttributes<HTMLDivElement>;
16
+ }
17
+ declare const FileInputField: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<FileInputFieldProps, never>> & string & Omit<({ className, children, label, error, required, size, onChange, onFocus, dropZoneOptions, style, }: FileInputFieldProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
18
+ export default FileInputField;
@@ -0,0 +1,116 @@
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
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("react");
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const react_dropzone_1 = require("react-dropzone");
10
+ const __1 = require("..");
11
+ const FileInputField = (0, styled_components_1.default)(({ className, children, label, error, required, size, onChange, onFocus, dropZoneOptions = {}, style = {}, }) => {
12
+ const [files, setFiles] = (0, react_1.useState)([]);
13
+ const onDrop = (0, react_1.useCallback)((acceptedFiles) => {
14
+ setFiles(acceptedFiles);
15
+ // Do something with the files
16
+ onChange === null || onChange === void 0 ? void 0 : onChange(acceptedFiles);
17
+ }, []);
18
+ const handleRemoveFile = (file) => {
19
+ setFiles((prev) => prev.filter((f) => f !== file));
20
+ };
21
+ const { getRootProps, getInputProps } = (0, react_dropzone_1.useDropzone)(Object.assign({ onDrop }, dropZoneOptions));
22
+ return ((0, jsx_runtime_1.jsxs)("div", { className: className, children: [label && ((0, jsx_runtime_1.jsx)(__1.FieldLabel, { error: error, asterisk: required, size: size, children: label })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "file-input-container" }, getRootProps(), { onFocus: onFocus, style: style, children: [(0, jsx_runtime_1.jsx)("input", Object.assign({}, getInputProps())), children && children, !children && (0, jsx_runtime_1.jsx)("div", { children: "Drop files here or click to select files ..." })] })), (0, jsx_runtime_1.jsx)("div", { className: "file-selections", children: files.map((file, index) => ((0, jsx_runtime_1.jsx)(__1.Pill, { size: "sm", showRemoveIcon: true, onRemove: () => handleRemoveFile(file), children: file.name }, index))) })] }));
23
+ }) `
24
+ display: flex;
25
+ flex-direction: column;
26
+
27
+ .file-input-container {
28
+ user-select: none;
29
+ cursor: pointer;
30
+ outline: none;
31
+
32
+ display: flex;
33
+ flex-direction: column;
34
+ align-items: center;
35
+ justify-content: center;
36
+ height: 75px;
37
+
38
+ color: ${({ theme }) => theme.palette.text.secondary};
39
+
40
+ font-size: ${({ size }) => size === "xs"
41
+ ? "12px"
42
+ : size === "sm"
43
+ ? "14px"
44
+ : size === "md"
45
+ ? "16px"
46
+ : size === "lg"
47
+ ? "18px"
48
+ : size === "xl"
49
+ ? "20px"
50
+ : "12px"};
51
+
52
+ background-color: ${({ theme, variant }) => {
53
+ switch (variant) {
54
+ case "contained":
55
+ return theme.palette.input.background;
56
+ case "filled":
57
+ return theme.palette.input.background;
58
+ case "outlined":
59
+ return theme.palette.input.background;
60
+ case "text":
61
+ return "transparent";
62
+ default:
63
+ return theme.palette.input.background;
64
+ }
65
+ }};
66
+
67
+ border-radius: 4px;
68
+ border: 1px solid
69
+ ${({ theme, variant }) => {
70
+ switch (variant) {
71
+ case "contained":
72
+ return "transparent";
73
+ case "filled":
74
+ return "transparent";
75
+ case "outlined":
76
+ return theme.palette.input.border;
77
+ case "text":
78
+ return "transparent";
79
+ default:
80
+ return theme.palette.input.border;
81
+ }
82
+ }};
83
+
84
+ padding: ${({ size }) => size === "xs"
85
+ ? "0px 8px"
86
+ : size === "sm"
87
+ ? "0px 10px"
88
+ : size === "md"
89
+ ? "0px 12px"
90
+ : size === "lg"
91
+ ? "0px 14px"
92
+ : size === "xl"
93
+ ? "0px 16px"
94
+ : "0px 8px"};
95
+
96
+ max-width: 100%;
97
+
98
+ transition: border 0.2s;
99
+
100
+ &:hover {
101
+ border: 1px solid ${({ theme }) => theme.palette.primary.main};
102
+ }
103
+
104
+ &:focus {
105
+ border: 1px solid ${({ theme }) => theme.palette.primary.main};
106
+ }
107
+ }
108
+
109
+ .file-selections {
110
+ display: flex;
111
+ flex-wrap: wrap;
112
+ gap: 10px;
113
+ margin-top: 10px;
114
+ }
115
+ `;
116
+ exports.default = FileInputField;
@@ -0,0 +1 @@
1
+ export { default } from "./FileInputField";
@@ -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 FileInputField_1 = require("./FileInputField");
8
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(FileInputField_1).default; } });
@@ -0,0 +1,10 @@
1
+ interface FlyoutProps {
2
+ children: React.ReactNode;
3
+ open?: boolean;
4
+ onClose?: () => void;
5
+ style?: React.CSSProperties;
6
+ closeOnOutsideClick?: boolean;
7
+ showCloseButton?: boolean;
8
+ }
9
+ declare const Flyout: React.FC<FlyoutProps>;
10
+ export default Flyout;