@monolith-forensics/monolith-ui 1.1.29 → 1.1.30

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 (135) 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/dist/Calendar/CalendarStyles.js +170 -0
  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 +13 -0
  14. package/dist/CheckBox/CheckBox.js +46 -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 +509 -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 +213 -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.d.ts +1 -0
  32. package/dist/FieldLabel/index.js +8 -0
  33. package/dist/FileInputField/FileInputField.d.ts +19 -0
  34. package/dist/FileInputField/FileInputField.js +117 -0
  35. package/dist/FileInputField/index.d.ts +1 -0
  36. package/dist/FileInputField/index.js +8 -0
  37. package/dist/Flyout/Flyout.d.ts +11 -0
  38. package/dist/Flyout/Flyout.js +111 -0
  39. package/dist/Flyout/FlyoutHeader.d.ts +5 -0
  40. package/dist/Flyout/FlyoutHeader.js +12 -0
  41. package/dist/Flyout/FlyoutTitle.d.ts +2 -0
  42. package/dist/Flyout/FlyoutTitle.js +13 -0
  43. package/dist/Flyout/index.d.ts +3 -0
  44. package/dist/Flyout/index.js +12 -0
  45. package/dist/FormSection/FormSection.d.ts +9 -0
  46. package/dist/FormSection/FormSection.js +51 -0
  47. package/dist/FormSection/index.d.ts +1 -0
  48. package/dist/FormSection/index.js +8 -0
  49. package/dist/Grid/Grid.d.ts +8 -0
  50. package/dist/Grid/Grid.js +18 -0
  51. package/dist/Grid/index.d.ts +1 -0
  52. package/dist/Grid/index.js +8 -0
  53. package/dist/IconButton/IconButton.d.ts +5 -0
  54. package/dist/IconButton/IconButton.js +30 -0
  55. package/dist/IconButton/index.d.ts +1 -0
  56. package/dist/IconButton/index.js +8 -0
  57. package/dist/Input/Input.d.ts +21 -0
  58. package/dist/Input/Input.js +149 -0
  59. package/dist/Input/index.d.ts +1 -0
  60. package/dist/Input/index.js +8 -0
  61. package/dist/Modal/Modal.d.ts +14 -0
  62. package/dist/Modal/Modal.js +110 -0
  63. package/dist/Modal/index.d.ts +1 -0
  64. package/dist/Modal/index.js +8 -0
  65. package/dist/MonolithUIProvider/GlobalStyle.d.ts +4 -0
  66. package/dist/MonolithUIProvider/GlobalStyle.js +53 -0
  67. package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +10 -0
  68. package/dist/MonolithUIProvider/MonolithUIProvider.js +29 -0
  69. package/dist/MonolithUIProvider/index.d.ts +3 -0
  70. package/dist/MonolithUIProvider/index.js +12 -0
  71. package/dist/MonolithUIProvider/useMonolithUITheme.d.ts +2 -0
  72. package/dist/MonolithUIProvider/useMonolithUITheme.js +12 -0
  73. package/dist/Pill/Pill.d.ts +11 -0
  74. package/dist/Pill/Pill.js +152 -0
  75. package/dist/Pill/index.d.ts +1 -0
  76. package/dist/Pill/index.js +8 -0
  77. package/dist/SelectBox/SelectBox.d.ts +45 -0
  78. package/dist/SelectBox/SelectBox.js +477 -0
  79. package/dist/SelectBox/index.d.ts +1 -0
  80. package/dist/SelectBox/index.js +8 -0
  81. package/dist/Switch/Switch.d.ts +18 -0
  82. package/dist/Switch/Switch.js +157 -0
  83. package/dist/Switch/index.d.ts +1 -0
  84. package/dist/Switch/index.js +8 -0
  85. package/dist/Table/Table.d.ts +91 -0
  86. package/dist/Table/Table.js +715 -0
  87. package/dist/Table/index.d.ts +2 -0
  88. package/dist/Table/index.js +10 -0
  89. package/dist/TagBox/TagBox.d.ts +39 -0
  90. package/dist/TagBox/TagBox.js +590 -0
  91. package/dist/TagBox/TagBoxStyles.d.ts +11 -0
  92. package/dist/TagBox/TagBoxStyles.js +113 -0
  93. package/dist/TagBox/index.d.ts +1 -0
  94. package/dist/TagBox/index.js +8 -0
  95. package/dist/TextArea/TextArea.d.ts +16 -0
  96. package/dist/TextArea/TextArea.js +81 -0
  97. package/dist/TextArea/index.d.ts +1 -0
  98. package/dist/TextArea/index.js +8 -0
  99. package/dist/TextAreaInput/TextAreaInput.d.ts +19 -0
  100. package/dist/TextAreaInput/TextAreaInput.js +11 -0
  101. package/dist/TextAreaInput/index.d.ts +1 -0
  102. package/dist/TextAreaInput/index.js +8 -0
  103. package/dist/TextInput/TextInput.d.ts +13 -0
  104. package/dist/TextInput/TextInput.js +31 -0
  105. package/dist/TextInput/index.d.ts +1 -0
  106. package/dist/TextInput/index.js +8 -0
  107. package/dist/Tooltip/Tooltip.d.ts +12 -0
  108. package/dist/Tooltip/Tooltip.js +53 -0
  109. package/dist/Tooltip/index.d.ts +1 -0
  110. package/dist/Tooltip/index.js +8 -0
  111. package/dist/core/ArrowButton.d.ts +6 -0
  112. package/dist/core/ArrowButton.js +48 -0
  113. package/dist/core/ClearButton.d.ts +6 -0
  114. package/dist/core/ClearButton.js +48 -0
  115. package/dist/core/MonolithThemeProvider.d.ts +4 -0
  116. package/dist/core/MonolithThemeProvider.js +20 -0
  117. package/dist/core/StyledContent.d.ts +7 -0
  118. package/dist/core/StyledContent.js +47 -0
  119. package/dist/core/StyledFloatContainer.d.ts +2 -0
  120. package/dist/core/StyledFloatContainer.js +10 -0
  121. package/dist/core/Types/Size.d.ts +2 -0
  122. package/dist/core/Types/Size.js +2 -0
  123. package/dist/core/Types/Variant.d.ts +2 -0
  124. package/dist/core/Types/Variant.js +2 -0
  125. package/dist/core/index.d.ts +6 -0
  126. package/dist/core/index.js +14 -0
  127. package/dist/index.d.ts +26 -0
  128. package/dist/index.js +59 -0
  129. package/dist/theme/index.d.ts +168 -0
  130. package/dist/theme/index.js +14 -0
  131. package/dist/theme/typography.d.ts +45 -0
  132. package/dist/theme/typography.js +59 -0
  133. package/dist/theme/variants.d.ts +172 -0
  134. package/dist/theme/variants.js +276 -0
  135. package/package.json +1 -1
@@ -0,0 +1,213 @@
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
+ box-sizing: border-box;
83
+ overflow-y: hidden;
84
+ overflow-x: hidden;
85
+
86
+ max-height: ${({ maxDropdownHeight }) => Number.isInteger(maxDropdownHeight)
87
+ ? `${maxDropdownHeight}px`
88
+ : maxDropdownHeight || "250px"};
89
+
90
+ background-color: ${(props) => props.theme.palette.background.default};
91
+ background-color: ${({ theme, variant }) => {
92
+ switch (variant) {
93
+ case "filled":
94
+ return theme.palette.input.background;
95
+ case "outlined":
96
+ return theme.palette.input.background;
97
+ case "text":
98
+ return "transparent";
99
+ default:
100
+ return theme.palette.input.background;
101
+ }
102
+ }};
103
+
104
+ border-radius: 5px;
105
+ border: 1px solid ${(props) => props.theme.palette.divider};
106
+ padding: 5px;
107
+ animation-duration: 400ms;
108
+ animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
109
+ will-change: transform, opacity;
110
+
111
+ &[data-empty="true"] {
112
+ display: none;
113
+ }
114
+ `;
115
+ 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, }) => {
116
+ var _a, _b, _c;
117
+ const isObjectArray = (_a = Object.keys((data === null || data === void 0 ? void 0 : data[0]) || {})) === null || _a === void 0 ? void 0 : _a.includes("label");
118
+ const [isOpen, setIsOpen] = (0, react_2.useState)(false);
119
+ const [selected, setSelected] = (0, react_2.useState)(defaultValue || []);
120
+ const [searchValue, setSearchValue] = (0, react_2.useState)("");
121
+ const scrollContainerRef = (0, react_2.useRef)(null);
122
+ const searchInputRef = (0, react_2.useRef)(null);
123
+ const { refs, floatingStyles, context } = (0, react_1.useFloating)({
124
+ open: isOpen,
125
+ onOpenChange: setIsOpen,
126
+ placement: "bottom-start",
127
+ strategy: "absolute",
128
+ // Handle collisions with the viewport
129
+ middleware: [(0, react_1.flip)()],
130
+ });
131
+ const handleAddItem = (item) => {
132
+ setSelected((prev) => {
133
+ let newSelected = [...prev, item];
134
+ 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));
135
+ onChange === null || onChange === void 0 ? void 0 : onChange(newSelected, diff);
136
+ return newSelected;
137
+ });
138
+ };
139
+ const handleRemoveItem = (item) => {
140
+ setSelected((prev) => {
141
+ 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);
142
+ 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));
143
+ onChange === null || onChange === void 0 ? void 0 : onChange(newSelected, diff);
144
+ return newSelected;
145
+ });
146
+ };
147
+ const handleSearch = (0, use_debounce_1.useDebouncedCallback)((e) => {
148
+ setSearchValue(e.target.value);
149
+ }, 150);
150
+ // Close on outside click
151
+ (0, react_2.useEffect)(() => {
152
+ const close = (e) => {
153
+ var _a, _b, _c, _d;
154
+ const target = e.target;
155
+ const referenceElement = (_a = refs === null || refs === void 0 ? void 0 : refs.reference) === null || _a === void 0 ? void 0 : _a.current;
156
+ const floatingElement = (_b = refs === null || refs === void 0 ? void 0 : refs.floating) === null || _b === void 0 ? void 0 : _b.current;
157
+ if (floatingElement && // Check if the floating element exists
158
+ e.target !== referenceElement && // Check if the target is not the reference (input)
159
+ !((_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)
160
+ !((_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)
161
+ ) {
162
+ setIsOpen(false);
163
+ }
164
+ };
165
+ document.addEventListener("mousedown", close);
166
+ return () => document.removeEventListener("mousdown", close);
167
+ }, [refs.floating, refs.reference]);
168
+ (0, react_2.useEffect)(() => {
169
+ var _a, _b;
170
+ if (isOpen && searchable) {
171
+ (_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);
172
+ }
173
+ if (!isOpen) {
174
+ setSearchValue("");
175
+ }
176
+ }, [isOpen, searchable]);
177
+ const scrollActive = (((_b = scrollContainerRef === null || scrollContainerRef === void 0 ? void 0 : scrollContainerRef.current) === null || _b === void 0 ? void 0 : _b.scrollHeight) || 0) >
178
+ (((_c = scrollContainerRef === null || scrollContainerRef === void 0 ? void 0 : scrollContainerRef.current) === null || _c === void 0 ? void 0 : _c.clientHeight) || 0);
179
+ return ((0, jsx_runtime_1.jsxs)("div", { className: className + " mfDropDownMenu", children: [(0, jsx_runtime_1.jsx)(__1.Button, Object.assign({ ref: (ref) => {
180
+ refs.setReference(ref);
181
+ }, 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 &&
182
+ data
183
+ .filter((item) => {
184
+ var _a, _b, _c;
185
+ if (!searchable)
186
+ return true;
187
+ if (isObjectArray) {
188
+ return (((_a = item === null || item === void 0 ? void 0 : item.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchValue.toLowerCase())) ||
189
+ ((_b = item === null || item === void 0 ? void 0 : item.value) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchValue.toLowerCase())));
190
+ }
191
+ return (_c = item
192
+ .toLowerCase) === null || _c === void 0 ? void 0 : _c.call(item).includes(searchValue.toLowerCase());
193
+ })
194
+ .map((item, index) => {
195
+ const isSelected = !!(selected === null || selected === void 0 ? void 0 : selected.find((s) => isObjectArray
196
+ ? (s === null || s === void 0 ? void 0 : s.value) === (item === null || item === void 0 ? void 0 : item.value)
197
+ : s === item));
198
+ 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) => {
199
+ e.preventDefault();
200
+ e.stopPropagation();
201
+ if (multiselect) {
202
+ isSelected
203
+ ? handleRemoveItem(item)
204
+ : handleAddItem(item);
205
+ }
206
+ else {
207
+ setIsOpen(false);
208
+ }
209
+ onItemSelect === null || onItemSelect === void 0 ? void 0 : onItemSelect(item);
210
+ }, "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));
211
+ })] }) })) }) }) }))] }));
212
+ }) ``;
213
+ 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 = "sm" }) => 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
+ : "12px"};
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,19 @@
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
+ colSpan?: number;
16
+ style?: HTMLAttributes<HTMLDivElement>;
17
+ }
18
+ 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, colSpan, style, }: FileInputFieldProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
19
+ export default FileInputField;
@@ -0,0 +1,117 @@
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 = {}, colSpan, 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
+ grid-column: span ${({ colSpan }) => colSpan || 1};
27
+
28
+ .file-input-container {
29
+ user-select: none;
30
+ cursor: pointer;
31
+ outline: none;
32
+
33
+ display: flex;
34
+ flex-direction: column;
35
+ align-items: center;
36
+ justify-content: center;
37
+ height: 75px;
38
+
39
+ color: ${({ theme }) => theme.palette.text.secondary};
40
+
41
+ font-size: ${({ size }) => size === "xs"
42
+ ? "12px"
43
+ : size === "sm"
44
+ ? "14px"
45
+ : size === "md"
46
+ ? "16px"
47
+ : size === "lg"
48
+ ? "18px"
49
+ : size === "xl"
50
+ ? "20px"
51
+ : "12px"};
52
+
53
+ background-color: ${({ theme, variant }) => {
54
+ switch (variant) {
55
+ case "contained":
56
+ return theme.palette.input.background;
57
+ case "filled":
58
+ return theme.palette.input.background;
59
+ case "outlined":
60
+ return theme.palette.input.background;
61
+ case "text":
62
+ return "transparent";
63
+ default:
64
+ return theme.palette.input.background;
65
+ }
66
+ }};
67
+
68
+ border-radius: 4px;
69
+ border: 1px solid
70
+ ${({ theme, variant }) => {
71
+ switch (variant) {
72
+ case "contained":
73
+ return "transparent";
74
+ case "filled":
75
+ return "transparent";
76
+ case "outlined":
77
+ return theme.palette.input.border;
78
+ case "text":
79
+ return "transparent";
80
+ default:
81
+ return theme.palette.input.border;
82
+ }
83
+ }};
84
+
85
+ padding: ${({ size }) => size === "xs"
86
+ ? "0px 8px"
87
+ : size === "sm"
88
+ ? "0px 10px"
89
+ : size === "md"
90
+ ? "0px 12px"
91
+ : size === "lg"
92
+ ? "0px 14px"
93
+ : size === "xl"
94
+ ? "0px 16px"
95
+ : "0px 8px"};
96
+
97
+ max-width: 100%;
98
+
99
+ transition: border 0.2s;
100
+
101
+ &:hover {
102
+ border: 1px solid ${({ theme }) => theme.palette.primary.main};
103
+ }
104
+
105
+ &:focus {
106
+ border: 1px solid ${({ theme }) => theme.palette.primary.main};
107
+ }
108
+ }
109
+
110
+ .file-selections {
111
+ display: flex;
112
+ flex-wrap: wrap;
113
+ gap: 10px;
114
+ margin-top: 10px;
115
+ }
116
+ `;
117
+ 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,11 @@
1
+ import React from "react";
2
+ interface FlyoutProps {
3
+ children: React.ReactNode;
4
+ open?: boolean;
5
+ onClose?: () => void;
6
+ style?: React.CSSProperties;
7
+ closeOnOutsideClick?: boolean;
8
+ showCloseButton?: boolean;
9
+ }
10
+ declare const Flyout: React.FC<FlyoutProps>;
11
+ export default Flyout;