@monolith-forensics/monolith-ui 1.1.30 → 1.1.32

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.js +11 -16
  2. package/dist/Button/index.js +1 -8
  3. package/dist/Calendar/Calendar.js +38 -66
  4. package/dist/Calendar/CalendarStyles.js +19 -25
  5. package/dist/Calendar/calendarHelpers.js +34 -46
  6. package/dist/Calendar/index.js +1 -8
  7. package/dist/CheckBox/CheckBox.js +9 -14
  8. package/dist/CheckBox/index.js +1 -8
  9. package/dist/DateInput/DateInput.js +46 -51
  10. package/dist/DateInput/index.js +1 -8
  11. package/dist/DropDownMenu/DropDownMenu.js +27 -32
  12. package/dist/DropDownMenu/index.js +1 -8
  13. package/dist/Error/Error.js +10 -15
  14. package/dist/Error/index.js +1 -8
  15. package/dist/FieldLabel/FieldLabel.js +8 -37
  16. package/dist/FieldLabel/index.js +1 -8
  17. package/dist/FileInputField/FileInputField.js +11 -16
  18. package/dist/FileInputField/index.js +1 -8
  19. package/dist/Flyout/Flyout.js +14 -18
  20. package/dist/Flyout/FlyoutHeader.js +3 -8
  21. package/dist/Flyout/FlyoutTitle.js +3 -8
  22. package/dist/Flyout/index.js +3 -12
  23. package/dist/FormSection/FormSection.js +8 -13
  24. package/dist/FormSection/index.js +1 -8
  25. package/dist/Grid/Grid.js +5 -10
  26. package/dist/Grid/index.js +1 -8
  27. package/dist/IconButton/IconButton.js +4 -9
  28. package/dist/IconButton/index.js +1 -8
  29. package/dist/Input/Input.js +6 -11
  30. package/dist/Input/index.js +1 -8
  31. package/dist/Modal/Modal.js +16 -20
  32. package/dist/Modal/index.js +1 -8
  33. package/dist/MonolithUIProvider/GlobalStyle.js +3 -5
  34. package/dist/MonolithUIProvider/MonolithUIProvider.js +14 -19
  35. package/dist/MonolithUIProvider/index.js +3 -12
  36. package/dist/MonolithUIProvider/useMonolithUITheme.js +4 -6
  37. package/dist/Pill/Pill.js +9 -14
  38. package/dist/Pill/index.js +1 -8
  39. package/dist/SelectBox/SelectBox.js +44 -50
  40. package/dist/SelectBox/index.js +1 -8
  41. package/dist/Switch/Switch.js +12 -39
  42. package/dist/Switch/index.js +1 -8
  43. package/dist/Table/Table.js +70 -78
  44. package/dist/Table/index.js +2 -10
  45. package/dist/TagBox/TagBox.js +40 -45
  46. package/dist/TagBox/TagBoxStyles.js +11 -17
  47. package/dist/TagBox/index.js +1 -8
  48. package/dist/TextArea/TextArea.js +4 -9
  49. package/dist/TextArea/index.js +1 -8
  50. package/dist/TextAreaInput/TextAreaInput.js +5 -7
  51. package/dist/TextAreaInput/index.js +1 -8
  52. package/dist/TextInput/TextInput.js +7 -12
  53. package/dist/TextInput/index.js +1 -8
  54. package/dist/Tooltip/Tooltip.js +6 -34
  55. package/dist/Tooltip/index.js +1 -8
  56. package/dist/core/ArrowButton.js +8 -13
  57. package/dist/core/ClearButton.js +8 -13
  58. package/dist/core/StyledContent.js +3 -8
  59. package/dist/core/StyledFloatContainer.js +3 -8
  60. package/dist/core/Types/Size.js +1 -2
  61. package/dist/core/Types/Variant.js +1 -2
  62. package/dist/core/index.js +4 -14
  63. package/dist/index.js +26 -59
  64. package/dist/theme/index.js +5 -9
  65. package/dist/theme/typography.js +1 -3
  66. package/dist/theme/variants.js +8 -14
  67. package/package.json +1 -1
  68. package/dist/Button/Button.d.ts +0 -19
  69. package/dist/Button/index.d.ts +0 -2
  70. package/dist/Calendar/Calendar.d.ts +0 -15
  71. package/dist/Calendar/CalendarStyles.d.ts +0 -36
  72. package/dist/Calendar/calendarHelpers.d.ts +0 -53
  73. package/dist/Calendar/index.d.ts +0 -1
  74. package/dist/CheckBox/CheckBox.d.ts +0 -13
  75. package/dist/CheckBox/index.d.ts +0 -1
  76. package/dist/DateInput/DateInput.d.ts +0 -24
  77. package/dist/DateInput/index.d.ts +0 -1
  78. package/dist/DropDownMenu/DropDownMenu.d.ts +0 -36
  79. package/dist/DropDownMenu/index.d.ts +0 -1
  80. package/dist/Error/Error.d.ts +0 -4
  81. package/dist/Error/index.d.ts +0 -1
  82. package/dist/FieldLabel/FieldLabel.d.ts +0 -19
  83. package/dist/FieldLabel/index.d.ts +0 -1
  84. package/dist/FileInputField/FileInputField.d.ts +0 -19
  85. package/dist/FileInputField/index.d.ts +0 -1
  86. package/dist/Flyout/Flyout.d.ts +0 -11
  87. package/dist/Flyout/FlyoutHeader.d.ts +0 -5
  88. package/dist/Flyout/FlyoutTitle.d.ts +0 -2
  89. package/dist/Flyout/index.d.ts +0 -3
  90. package/dist/FormSection/FormSection.d.ts +0 -9
  91. package/dist/FormSection/index.d.ts +0 -1
  92. package/dist/Grid/Grid.d.ts +0 -8
  93. package/dist/Grid/index.d.ts +0 -1
  94. package/dist/IconButton/IconButton.d.ts +0 -5
  95. package/dist/IconButton/index.d.ts +0 -1
  96. package/dist/Input/Input.d.ts +0 -21
  97. package/dist/Input/index.d.ts +0 -1
  98. package/dist/Modal/Modal.d.ts +0 -14
  99. package/dist/Modal/index.d.ts +0 -1
  100. package/dist/MonolithUIProvider/GlobalStyle.d.ts +0 -4
  101. package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +0 -10
  102. package/dist/MonolithUIProvider/index.d.ts +0 -3
  103. package/dist/MonolithUIProvider/useMonolithUITheme.d.ts +0 -2
  104. package/dist/Pill/Pill.d.ts +0 -11
  105. package/dist/Pill/index.d.ts +0 -1
  106. package/dist/SelectBox/SelectBox.d.ts +0 -45
  107. package/dist/SelectBox/index.d.ts +0 -1
  108. package/dist/Switch/Switch.d.ts +0 -18
  109. package/dist/Switch/index.d.ts +0 -1
  110. package/dist/Table/Table.d.ts +0 -91
  111. package/dist/Table/index.d.ts +0 -2
  112. package/dist/TagBox/TagBox.d.ts +0 -39
  113. package/dist/TagBox/TagBoxStyles.d.ts +0 -11
  114. package/dist/TagBox/index.d.ts +0 -1
  115. package/dist/TextArea/TextArea.d.ts +0 -16
  116. package/dist/TextArea/index.d.ts +0 -1
  117. package/dist/TextAreaInput/TextAreaInput.d.ts +0 -19
  118. package/dist/TextAreaInput/index.d.ts +0 -1
  119. package/dist/TextInput/TextInput.d.ts +0 -13
  120. package/dist/TextInput/index.d.ts +0 -1
  121. package/dist/Tooltip/Tooltip.d.ts +0 -12
  122. package/dist/Tooltip/index.d.ts +0 -1
  123. package/dist/core/ArrowButton.d.ts +0 -6
  124. package/dist/core/ClearButton.d.ts +0 -6
  125. package/dist/core/MonolithThemeProvider.d.ts +0 -4
  126. package/dist/core/MonolithThemeProvider.js +0 -20
  127. package/dist/core/StyledContent.d.ts +0 -7
  128. package/dist/core/StyledFloatContainer.d.ts +0 -2
  129. package/dist/core/Types/Size.d.ts +0 -2
  130. package/dist/core/Types/Variant.d.ts +0 -2
  131. package/dist/core/index.d.ts +0 -6
  132. package/dist/index.d.ts +0 -26
  133. package/dist/theme/index.d.ts +0 -168
  134. package/dist/theme/typography.d.ts +0 -45
  135. package/dist/theme/variants.d.ts +0 -172
@@ -1,25 +1,20 @@
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 styled_components_1 = __importDefault(require("styled-components"));
8
- const react_1 = require("react");
9
- const fa_1 = require("react-icons/fa");
10
- const CheckBox = (0, styled_components_1.default)(({ className, defaultValue = false, value, partialCheck = false, onChange = () => { }, }) => {
11
- const [checkedState, setCheckedState] = (0, react_1.useState)(defaultValue);
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import styled from "styled-components";
3
+ import { useState, useEffect } from "react";
4
+ import { FaCheckSquare, FaRegSquare, FaRegMinusSquare } from "react-icons/fa";
5
+ const CheckBox = styled(({ className, defaultValue = false, value, partialCheck = false, onChange = () => { }, }) => {
6
+ const [checkedState, setCheckedState] = useState(defaultValue);
12
7
  const handleChange = (e) => {
13
8
  e.stopPropagation();
14
9
  setCheckedState(!checkedState);
15
10
  onChange(!checkedState);
16
11
  };
17
- (0, react_1.useEffect)(() => {
12
+ useEffect(() => {
18
13
  if (value !== undefined)
19
14
  setCheckedState(value);
20
15
  }, [value]);
21
16
  const _checked = value === undefined ? checkedState : value;
22
- return ((0, jsx_runtime_1.jsx)("div", { className: className, onClick: handleChange, children: partialCheck === true ? ((0, jsx_runtime_1.jsx)(fa_1.FaRegMinusSquare, { className: "checkbox partial" })) : _checked === true ? ((0, jsx_runtime_1.jsx)(fa_1.FaCheckSquare, { className: "checkbox checked" })) : ((0, jsx_runtime_1.jsx)(fa_1.FaRegSquare, { className: "checkbox unchecked" })) }));
17
+ return (_jsx("div", { className: className, onClick: handleChange, children: partialCheck === true ? (_jsx(FaRegMinusSquare, { className: "checkbox partial" })) : _checked === true ? (_jsx(FaCheckSquare, { className: "checkbox checked" })) : (_jsx(FaRegSquare, { className: "checkbox unchecked" })) }));
23
18
  }) `
24
19
  display: flex;
25
20
  align-items: center;
@@ -43,4 +38,4 @@ const CheckBox = (0, styled_components_1.default)(({ className, defaultValue = f
43
38
  }};
44
39
  }
45
40
  `;
46
- exports.default = CheckBox;
41
+ export default CheckBox;
@@ -1,8 +1 @@
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 CheckBox_1 = require("./CheckBox");
8
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(CheckBox_1).default; } });
1
+ export { default } from "./CheckBox";
@@ -1,16 +1,11 @@
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 moment_1 = __importDefault(require("moment"));
8
- const react_1 = require("@floating-ui/react");
9
- const react_2 = require("react");
10
- const styled_components_1 = __importDefault(require("styled-components"));
11
- const __1 = require("..");
12
- const core_1 = require("../core");
13
- const StyledInputContainer = styled_components_1.default.div `
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import moment from "moment";
3
+ import { useFloating, flip, offset, FloatingPortal } from "@floating-ui/react";
4
+ import { useEffect, useMemo, useRef, useState, } from "react";
5
+ import styled from "styled-components";
6
+ import { FieldLabel, Calendar } from "..";
7
+ import { StyledContent, StyledFloatContainer, ArrowButton, ClearButton, } from "../core";
8
+ const StyledInputContainer = styled.div `
14
9
  position: relative;
15
10
 
16
11
  caret-color: transparent;
@@ -127,7 +122,7 @@ const StyledInputContainer = styled_components_1.default.div `
127
122
  border: 1px solid ${(props) => props.theme.palette.primary.main};
128
123
  }
129
124
  `;
130
- const InputSegment = styled_components_1.default.div `
125
+ const InputSegment = styled.div `
131
126
  user-select: none;
132
127
  display: flex;
133
128
  flex-direction: row;
@@ -219,8 +214,8 @@ function parseTimestamp(timestamp, format, utc = false) {
219
214
  const { pattern, placeholder, type, momentType } = matchSegment(segment);
220
215
  const value = timestamp
221
216
  ? utc === true
222
- ? moment_1.default.utc(timestamp).format(pattern)
223
- : (0, moment_1.default)(timestamp).format(pattern)
217
+ ? moment.utc(timestamp).format(pattern)
218
+ : moment(timestamp).format(pattern)
224
219
  : placeholder;
225
220
  return {
226
221
  value,
@@ -233,27 +228,27 @@ function parseTimestamp(timestamp, format, utc = false) {
233
228
  });
234
229
  return segments;
235
230
  }
236
- const DateInput = (0, styled_components_1.default)(({ className, defaultValue, format = "YYYY-MM-DD HH:mm:ss", label, description, arrow = true, size = "sm", variant = "outlined", clearable = false, required = false, onChange = () => { }, min, max, error, enableCalendar = false, utc = false, closeOnSelect = true, }) => {
237
- const [value, setValue] = (0, react_2.useState)(defaultValue);
238
- const [selectedSegment, setSelectedSegment] = (0, react_2.useState)();
239
- const [isOpen, setIsOpen] = (0, react_2.useState)(false);
231
+ const DateInput = styled(({ className, defaultValue, format = "YYYY-MM-DD HH:mm:ss", label, description, arrow = true, size = "sm", variant = "outlined", clearable = false, required = false, onChange = () => { }, min, max, error, enableCalendar = false, utc = false, closeOnSelect = true, }) => {
232
+ const [value, setValue] = useState(defaultValue);
233
+ const [selectedSegment, setSelectedSegment] = useState();
234
+ const [isOpen, setIsOpen] = useState(false);
240
235
  // Check if format is date only and does not include time
241
236
  const isDateOnly = format.match(/(HH|h|mm|ss|SSS|A|Z)/) === null;
242
- const mainRef = (0, react_2.useRef)(null);
243
- const typedKeys = (0, react_2.useRef)("");
244
- const { refs, floatingStyles } = (0, react_1.useFloating)({
237
+ const mainRef = useRef(null);
238
+ const typedKeys = useRef("");
239
+ const { refs, floatingStyles } = useFloating({
245
240
  open: isOpen,
246
241
  onOpenChange: setIsOpen,
247
242
  placement: "bottom-start",
248
243
  strategy: "absolute",
249
244
  // Handle collisions with the viewport
250
- middleware: [(0, react_1.flip)(), (0, react_1.offset)(5)],
245
+ middleware: [flip(), offset(5)],
251
246
  });
252
- const segments = (0, react_2.useMemo)(() => parseTimestamp((0, moment_1.default)(value).toISOString(), format, utc), [value, format, utc]);
247
+ const segments = useMemo(() => parseTimestamp(moment(value).toISOString(), format, utc), [value, format, utc]);
253
248
  const checkValidRange = (value) => {
254
- if (min && (0, moment_1.default)(value).isBefore(min))
249
+ if (min && moment(value).isBefore(min))
255
250
  return false;
256
- if (max && (0, moment_1.default)(value).isAfter(max))
251
+ if (max && moment(value).isAfter(max))
257
252
  return false;
258
253
  return true;
259
254
  };
@@ -343,12 +338,12 @@ const DateInput = (0, styled_components_1.default)(({ className, defaultValue, f
343
338
  if (selectedSegment.type === "separator")
344
339
  return prev;
345
340
  let newValue = prev
346
- ? (0, moment_1.default)(prev).add(1, selectedSegment.type).toISOString()
347
- : (0, moment_1.default)().toISOString();
341
+ ? moment(prev).add(1, selectedSegment.type).toISOString()
342
+ : moment().toISOString();
348
343
  if (!checkValidRange(newValue))
349
344
  return prev;
350
345
  if (isDateOnly) {
351
- newValue = (0, moment_1.default)(newValue).format("YYYY-MM-DD");
346
+ newValue = moment(newValue).format("YYYY-MM-DD");
352
347
  }
353
348
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
354
349
  return newValue;
@@ -361,12 +356,12 @@ const DateInput = (0, styled_components_1.default)(({ className, defaultValue, f
361
356
  if (selectedSegment.type === "separator")
362
357
  return prev;
363
358
  let newValue = prev
364
- ? (0, moment_1.default)(prev).subtract(1, selectedSegment.type).toISOString()
365
- : (0, moment_1.default)().toISOString();
359
+ ? moment(prev).subtract(1, selectedSegment.type).toISOString()
360
+ : moment().toISOString();
366
361
  if (!checkValidRange(newValue))
367
362
  return prev;
368
363
  if (isDateOnly) {
369
- newValue = (0, moment_1.default)(newValue).format("YYYY-MM-DD");
364
+ newValue = moment(newValue).format("YYYY-MM-DD");
370
365
  }
371
366
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
372
367
  return newValue;
@@ -389,7 +384,7 @@ const DateInput = (0, styled_components_1.default)(({ className, defaultValue, f
389
384
  setValue((prev) => {
390
385
  if (!(selectedSegment === null || selectedSegment === void 0 ? void 0 : selectedSegment.momentType))
391
386
  return prev;
392
- const newValue = (0, moment_1.default)(prev)
387
+ const newValue = moment(prev)
393
388
  .set(selectedSegment.momentType, parseInt(tempValue, 10) -
394
389
  (selectedSegment.type === "month" ? 1 : 0))
395
390
  .toISOString();
@@ -413,8 +408,8 @@ const DateInput = (0, styled_components_1.default)(({ className, defaultValue, f
413
408
  if (selectedSegment.type === "separator")
414
409
  return prev;
415
410
  const newValue = prev
416
- ? (0, moment_1.default)(prev).subtract(1, selectedSegment.type).toISOString()
417
- : (0, moment_1.default)().toISOString();
411
+ ? moment(prev).subtract(1, selectedSegment.type).toISOString()
412
+ : moment().toISOString();
418
413
  if (!checkValidRange(newValue))
419
414
  return prev;
420
415
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
@@ -426,8 +421,8 @@ const DateInput = (0, styled_components_1.default)(({ className, defaultValue, f
426
421
  if (selectedSegment.type === "separator")
427
422
  return prev;
428
423
  const newValue = prev
429
- ? (0, moment_1.default)(prev).add(1, selectedSegment.type).toISOString()
430
- : (0, moment_1.default)().toISOString();
424
+ ? moment(prev).add(1, selectedSegment.type).toISOString()
425
+ : moment().toISOString();
431
426
  if (!checkValidRange(newValue))
432
427
  return prev;
433
428
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
@@ -442,13 +437,13 @@ const DateInput = (0, styled_components_1.default)(({ className, defaultValue, f
442
437
  if (!pastedText)
443
438
  return;
444
439
  // check if pasted text is a valid timestamp
445
- if (!(0, moment_1.default)(pastedText).isValid())
440
+ if (!moment(pastedText).isValid())
446
441
  return;
447
- const parsedTimestamp = moment_1.default.utc(pastedText).toISOString();
442
+ const parsedTimestamp = moment.utc(pastedText).toISOString();
448
443
  setValue(parsedTimestamp);
449
444
  };
450
445
  // Close on outside click
451
- (0, react_2.useEffect)(() => {
446
+ useEffect(() => {
452
447
  const close = (e) => {
453
448
  var _a, _b;
454
449
  const target = e.target;
@@ -467,7 +462,7 @@ const DateInput = (0, styled_components_1.default)(({ className, defaultValue, f
467
462
  return () => document.removeEventListener("click", close);
468
463
  }, [refs.floating]);
469
464
  // Global Wheel Event when segement selected
470
- (0, react_2.useEffect)(() => {
465
+ useEffect(() => {
471
466
  if (selectedSegment) {
472
467
  document.addEventListener("wheel", handleWheelEvent);
473
468
  }
@@ -475,7 +470,7 @@ const DateInput = (0, styled_components_1.default)(({ className, defaultValue, f
475
470
  document.removeEventListener("wheel", handleWheelEvent);
476
471
  };
477
472
  }, [selectedSegment]);
478
- return ((0, jsx_runtime_1.jsxs)("div", { className: className, 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: (ref) => {
473
+ return (_jsxs("div", { className: className, children: [label && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, children: label })), _jsxs(StyledInputContainer, { ref: (ref) => {
479
474
  mainRef.current = ref;
480
475
  refs.setReference(ref);
481
476
  }, onClick: handleContainerClick, onMouseDown: handleMouseDown, onKeyDown: handleKeyDown, onPaste: handlePaste, onFocus: (e) => {
@@ -483,22 +478,22 @@ const DateInput = (0, styled_components_1.default)(({ className, defaultValue, f
483
478
  setSelectedSegment(segments[0]);
484
479
  }, "data-empty": !value, role: "textbox", size: size, variant: variant, "data-button-right": arrow || clearable, children: [segments.map((segment, i) => {
485
480
  if (segment.type === "separator") {
486
- return ((0, jsx_runtime_1.jsx)("div", { className: "separator", tabIndex: -1, onClick: (e) => {
481
+ return (_jsx("div", { className: "separator", tabIndex: -1, onClick: (e) => {
487
482
  e.preventDefault();
488
483
  e.stopPropagation();
489
484
  }, onFocus: (e) => e.preventDefault(), onPointerDown: (e) => e.preventDefault(), "data-type": "separator", "data-identifier": segment.type, "data-has-space": segment.text.includes(" "), "data-placeholder": segment.placeholder, "data-value": segment.value, children: segment.text }, i));
490
485
  }
491
- return ((0, jsx_runtime_1.jsx)(InputSegment, { className: "input", contentEditable: true, suppressContentEditableWarning: true, tabIndex: i === 0 ? 0 : -1, onClick: (e) => handleSegmentClick(e, segment), "data-type": "input", size: size, "data-identifier": segment.type, "data-has-space": segment.text.includes(" "), "data-placeholder": segment.placeholder, "data-value": segment.value, "data-selected": (selectedSegment === null || selectedSegment === void 0 ? void 0 : selectedSegment.index) === segment.index, children: value ? segment.text : segment.placeholder }, i));
492
- }), utc && (0, jsx_runtime_1.jsx)("div", { style: { marginLeft: 5 }, children: "UTC" }), clearable && value ? ((0, jsx_runtime_1.jsx)(core_1.ClearButton, { onClick: handleClear })) : arrow ? ((0, jsx_runtime_1.jsx)(core_1.ArrowButton, {})) : null] }), enableCalendar && isOpen && ((0, jsx_runtime_1.jsx)(react_1.FloatingPortal, { preserveTabOrder: true, children: (0, jsx_runtime_1.jsx)(core_1.StyledFloatContainer, { ref: refs.setFloating, style: floatingStyles, children: (0, jsx_runtime_1.jsx)(core_1.StyledContent, { maxDropdownHeight: "fit-content", children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(__1.Calendar, { defaultValue: value ? (0, moment_1.default)(value).toDate() : undefined, clearable: false, min: min, max: max, onChange: (date) => {
486
+ return (_jsx(InputSegment, { className: "input", contentEditable: true, suppressContentEditableWarning: true, tabIndex: i === 0 ? 0 : -1, onClick: (e) => handleSegmentClick(e, segment), "data-type": "input", size: size, "data-identifier": segment.type, "data-has-space": segment.text.includes(" "), "data-placeholder": segment.placeholder, "data-value": segment.value, "data-selected": (selectedSegment === null || selectedSegment === void 0 ? void 0 : selectedSegment.index) === segment.index, children: value ? segment.text : segment.placeholder }, i));
487
+ }), utc && _jsx("div", { style: { marginLeft: 5 }, children: "UTC" }), clearable && value ? (_jsx(ClearButton, { onClick: handleClear })) : arrow ? (_jsx(ArrowButton, {})) : null] }), enableCalendar && isOpen && (_jsx(FloatingPortal, { preserveTabOrder: true, children: _jsx(StyledFloatContainer, { ref: refs.setFloating, style: floatingStyles, children: _jsx(StyledContent, { maxDropdownHeight: "fit-content", children: _jsx("div", { children: _jsx(Calendar, { defaultValue: value ? moment(value).toDate() : undefined, clearable: false, min: min, max: max, onChange: (date) => {
493
488
  setValue((prev) => {
494
489
  // make copy of prev variable
495
- const oldValue = (0, moment_1.default)(prev).toISOString();
496
- const result = `${(0, moment_1.default)(date).format("YYYY-MM-DD")}T${(0, moment_1.default)(prev || undefined).format("HH:mm:ss")}`;
497
- let isoResult = (0, moment_1.default)(result).toISOString();
490
+ const oldValue = moment(prev).toISOString();
491
+ const result = `${moment(date).format("YYYY-MM-DD")}T${moment(prev || undefined).format("HH:mm:ss")}`;
492
+ let isoResult = moment(result).toISOString();
498
493
  if (!checkValidRange(result))
499
494
  return oldValue;
500
495
  if (isDateOnly) {
501
- isoResult = (0, moment_1.default)(result).format("YYYY-MM-DD");
496
+ isoResult = moment(result).format("YYYY-MM-DD");
502
497
  }
503
498
  onChange === null || onChange === void 0 ? void 0 : onChange(isoResult);
504
499
  setIsOpen(closeOnSelect ? false : true);
@@ -506,4 +501,4 @@ const DateInput = (0, styled_components_1.default)(({ className, defaultValue, f
506
501
  });
507
502
  }, includeTime: false }, 1) }) }) }) }))] }));
508
503
  }) ``;
509
- exports.default = DateInput;
504
+ export default DateInput;
@@ -1,8 +1 @@
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 DateInput_1 = require("./DateInput");
8
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(DateInput_1).default; } });
1
+ export { default } from "./DateInput";
@@ -1,26 +1,21 @@
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 `
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { FloatingFocusManager, FloatingPortal, flip, useFloating, } from "@floating-ui/react";
3
+ import { forwardRef, useEffect, useRef, useState, } from "react";
4
+ import styled from "styled-components";
5
+ import { Button, Tooltip, CheckBox, Input } from "..";
6
+ import { useDebouncedCallback } from "use-debounce";
7
+ const StyledFloatContainer = styled.div `
13
8
  z-index: 1500;
14
9
  `;
15
- const StyledInnerItemContainer = styled_components_1.default.div `
10
+ const StyledInnerItemContainer = styled.div `
16
11
  overflow-y: auto;
17
12
 
18
13
  &[data-scroll-active="true"] {
19
14
  padding-right: 5px;
20
15
  }
21
16
  `;
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 `
17
+ const SearchInput = forwardRef((props, ref) => _jsx(Input, Object.assign({ ref: ref, style: { marginBottom: 8 } }, props)));
18
+ const StyledItem = styled.div `
24
19
  color: ${(props) => props.theme.palette.text.primary};
25
20
  border-radius: 3px;
26
21
  display: flex;
@@ -75,7 +70,7 @@ const StyledItem = styled_components_1.default.div `
75
70
  color: ${(props) => props.theme.palette.text.primary};
76
71
  }
77
72
  `;
78
- const StyledContent = styled_components_1.default.div `
73
+ const StyledContent = styled.div `
79
74
  position: relative;
80
75
  display: flex;
81
76
  flex-direction: column;
@@ -112,21 +107,21 @@ const StyledContent = styled_components_1.default.div `
112
107
  display: none;
113
108
  }
114
109
  `;
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, }) => {
110
+ const DropDownMenu = styled(({ className, children, data = [], variant = "outlined", defaultValue, multiselect = false, size = "xs", TooltipContent, renderOption, onChange, onItemSelect, onScroll, loading, arrow, searchable, dropDownProps, buttonProps, }) => {
116
111
  var _a, _b, _c;
117
112
  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)({
113
+ const [isOpen, setIsOpen] = useState(false);
114
+ const [selected, setSelected] = useState(defaultValue || []);
115
+ const [searchValue, setSearchValue] = useState("");
116
+ const scrollContainerRef = useRef(null);
117
+ const searchInputRef = useRef(null);
118
+ const { refs, floatingStyles, context } = useFloating({
124
119
  open: isOpen,
125
120
  onOpenChange: setIsOpen,
126
121
  placement: "bottom-start",
127
122
  strategy: "absolute",
128
123
  // Handle collisions with the viewport
129
- middleware: [(0, react_1.flip)()],
124
+ middleware: [flip()],
130
125
  });
131
126
  const handleAddItem = (item) => {
132
127
  setSelected((prev) => {
@@ -144,11 +139,11 @@ const DropDownMenu = (0, styled_components_1.default)(({ className, children, da
144
139
  return newSelected;
145
140
  });
146
141
  };
147
- const handleSearch = (0, use_debounce_1.useDebouncedCallback)((e) => {
142
+ const handleSearch = useDebouncedCallback((e) => {
148
143
  setSearchValue(e.target.value);
149
144
  }, 150);
150
145
  // Close on outside click
151
- (0, react_2.useEffect)(() => {
146
+ useEffect(() => {
152
147
  const close = (e) => {
153
148
  var _a, _b, _c, _d;
154
149
  const target = e.target;
@@ -165,7 +160,7 @@ const DropDownMenu = (0, styled_components_1.default)(({ className, children, da
165
160
  document.addEventListener("mousedown", close);
166
161
  return () => document.removeEventListener("mousdown", close);
167
162
  }, [refs.floating, refs.reference]);
168
- (0, react_2.useEffect)(() => {
163
+ useEffect(() => {
169
164
  var _a, _b;
170
165
  if (isOpen && searchable) {
171
166
  (_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);
@@ -176,9 +171,9 @@ const DropDownMenu = (0, styled_components_1.default)(({ className, children, da
176
171
  }, [isOpen, searchable]);
177
172
  const scrollActive = (((_b = scrollContainerRef === null || scrollContainerRef === void 0 ? void 0 : scrollContainerRef.current) === null || _b === void 0 ? void 0 : _b.scrollHeight) || 0) >
178
173
  (((_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) => {
174
+ return (_jsxs("div", { className: className + " mfDropDownMenu", children: [_jsx(Button, Object.assign({ ref: (ref) => {
180
175
  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 &&
176
+ }, onMouseDown: () => setIsOpen(!isOpen), rightSection: arrow ? _jsx("span", { children: "\u25BC" }) : null, size: size }, buttonProps, { children: children })), isOpen && (_jsx(FloatingPortal, { preserveTabOrder: true, children: _jsx(FloatingFocusManager, { context: context, modal: false, children: _jsx(StyledFloatContainer, { ref: refs.setFloating, style: floatingStyles, className: "mfFloating", children: _jsx(StyledContent, Object.assign({ className: "mfFloatingContent", style: { width: 150, maxWidth: 400 }, variant: variant }, dropDownProps, { children: _jsxs(StyledInnerItemContainer, { ref: scrollContainerRef, "data-scroll-active": scrollActive, onScroll: onScroll, children: [loading && _jsx("div", { children: "Loading..." }), searchable && (_jsx(SearchInput, { ref: searchInputRef, variant: "outlined", placeholder: "Search", onChange: handleSearch })), !loading &&
182
177
  data
183
178
  .filter((item) => {
184
179
  var _a, _b, _c;
@@ -195,7 +190,7 @@ const DropDownMenu = (0, styled_components_1.default)(({ className, children, da
195
190
  const isSelected = !!(selected === null || selected === void 0 ? void 0 : selected.find((s) => isObjectArray
196
191
  ? (s === null || s === void 0 ? void 0 : s.value) === (item === null || item === void 0 ? void 0 : item.value)
197
192
  : 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) => {
193
+ return (_jsx(Tooltip, { content: TooltipContent ? (_jsx(TooltipContent, { data: item.data })) : null, side: "left", children: _jsxs(StyledItem, { className: "mfFloatingItem", onClick: (e) => {
199
194
  e.preventDefault();
200
195
  e.stopPropagation();
201
196
  if (multiselect) {
@@ -207,7 +202,7 @@ const DropDownMenu = (0, styled_components_1.default)(({ className, children, da
207
202
  setIsOpen(false);
208
203
  }
209
204
  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));
205
+ }, "data-selected": isSelected, size: size, children: [multiselect && _jsx(CheckBox, { value: isSelected }), _jsx(_Fragment, { children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || (item === null || item === void 0 ? void 0 : item.label) || item })] }) }, index));
211
206
  })] }) })) }) }) }))] }));
212
207
  }) ``;
213
- exports.default = DropDownMenu;
208
+ export default DropDownMenu;
@@ -1,8 +1 @@
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; } });
1
+ export { default } from "./DropDownMenu";
@@ -1,13 +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
- 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 `
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import styled from "styled-components";
4
+ import { XIcon, ShieldAlert } from "lucide-react";
5
+ const ErrorContainer = styled.div `
11
6
  background-color: ${({ theme }) => theme.palette.error.main + "15"};
12
7
  color: ${({ theme }) => theme.palette.error.light};
13
8
  border: 1px solid #d93025;
@@ -18,21 +13,21 @@ const ErrorContainer = styled_components_1.default.div `
18
13
  border-radius: 5px;
19
14
  align-items: center;
20
15
  `;
21
- const CloseButton = styled_components_1.default.button `
16
+ const CloseButton = styled.button `
22
17
  background: none;
23
18
  border: none;
24
19
  color: ${({ theme }) => theme.palette.error.light};
25
20
  cursor: pointer;
26
21
  `;
27
- const ErrorText = styled_components_1.default.span `
22
+ const ErrorText = styled.span `
28
23
  margin-left: 10px;
29
24
  flex: 1;
30
25
  `;
31
26
  const ErrorComponent = ({ error }) => {
32
- const [isVisible, setIsVisible] = (0, react_1.useState)(true);
27
+ const [isVisible, setIsVisible] = useState(true);
33
28
  const handleClose = () => {
34
29
  setIsVisible(false);
35
30
  };
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 }) })] })) }));
31
+ return (_jsx(_Fragment, { children: isVisible && (_jsxs(ErrorContainer, { children: [_jsx(ShieldAlert, { size: 19 }), _jsx(ErrorText, { children: error }), _jsx(CloseButton, { onClick: handleClose, children: _jsx(XIcon, { size: 19 }) })] })) }));
37
32
  };
38
- exports.default = ErrorComponent;
33
+ export default ErrorComponent;
@@ -1,8 +1 @@
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; } });
1
+ export { default } from "./Error";
@@ -1,39 +1,10 @@
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 }) => {
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styled from "styled-components";
3
+ import * as Tooltip from "@radix-ui/react-tooltip";
4
+ export const InfoComponent = styled(({ className, children, description, label }) => {
34
5
  if (!description)
35
6
  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" })] }) })] }) }));
7
+ return (_jsx(Tooltip.Provider, { delayDuration: 800, skipDelayDuration: 0, disableHoverableContent: true, children: _jsxs(Tooltip.Root, { children: [_jsx(Tooltip.Trigger, { asChild: true, children: children }), _jsx(Tooltip.Portal, { children: _jsxs(Tooltip.Content, { className: className, side: "right", sideOffset: 15, align: "start", onClick: (e) => e.stopPropagation(), children: [_jsx("div", { className: "title", children: label || "Info" }), _jsx("div", { children: description || "N/A" })] }) })] }) }));
37
8
  }) `
38
9
  pointer-events: none;
39
10
  z-index: 999999;
@@ -53,8 +24,8 @@ exports.InfoComponent = (0, styled_components_1.default)(({ className, children,
53
24
  margin-bottom: 5px;
54
25
  }
55
26
  `;
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" }))] }));
27
+ const FieldLabel = styled(({ className, children, error, description, size = "sm", }) => {
28
+ return (_jsxs("div", { className: className + " FieldLabel", children: [_jsx(InfoComponent, { description: description, label: children, children: _jsx("div", { className: "label", children: children }) }), error && (_jsx("div", { className: "error", title: error, children: error || "Invalid Value" }))] }));
58
29
  }) `
59
30
  user-select: none;
60
31
  font-family: apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
@@ -116,4 +87,4 @@ const FieldLabel = (0, styled_components_1.default)(({ className, children, erro
116
87
  color: ${({ theme }) => theme.palette.error.light};
117
88
  }
118
89
  `;
119
- exports.default = FieldLabel;
90
+ export default FieldLabel;
@@ -1,8 +1 @@
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; } });
1
+ export { default } from "./FieldLabel";
@@ -1,16 +1,11 @@
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) => {
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useState } from "react";
3
+ import styled from "styled-components";
4
+ import { useDropzone } from "react-dropzone";
5
+ import { Pill, FieldLabel } from "..";
6
+ const FileInputField = styled(({ className, children, label, error, required, size, onChange, onFocus, dropZoneOptions = {}, colSpan, style = {}, }) => {
7
+ const [files, setFiles] = useState([]);
8
+ const onDrop = useCallback((acceptedFiles) => {
14
9
  setFiles(acceptedFiles);
15
10
  // Do something with the files
16
11
  onChange === null || onChange === void 0 ? void 0 : onChange(acceptedFiles);
@@ -18,8 +13,8 @@ const FileInputField = (0, styled_components_1.default)(({ className, children,
18
13
  const handleRemoveFile = (file) => {
19
14
  setFiles((prev) => prev.filter((f) => f !== file));
20
15
  };
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))) })] }));
16
+ const { getRootProps, getInputProps } = useDropzone(Object.assign({ onDrop }, dropZoneOptions));
17
+ return (_jsxs("div", { className: className, children: [label && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, children: label })), _jsxs("div", Object.assign({ className: "file-input-container" }, getRootProps(), { onFocus: onFocus, style: style, children: [_jsx("input", Object.assign({}, getInputProps())), children && children, !children && _jsx("div", { children: "Drop files here or click to select files ..." })] })), _jsx("div", { className: "file-selections", children: files.map((file, index) => (_jsx(Pill, { size: "sm", showRemoveIcon: true, onRemove: () => handleRemoveFile(file), children: file.name }, index))) })] }));
23
18
  }) `
24
19
  display: flex;
25
20
  flex-direction: column;
@@ -114,4 +109,4 @@ const FileInputField = (0, styled_components_1.default)(({ className, children,
114
109
  margin-top: 10px;
115
110
  }
116
111
  `;
117
- exports.default = FileInputField;
112
+ export default FileInputField;
@@ -1,8 +1 @@
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; } });
1
+ export { default } from "./FileInputField";