@monolith-forensics/monolith-ui 1.8.1-dev.4 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/dist/Button/Button.js +58 -9
  2. package/dist/Calendar/Calendar.d.ts +2 -7
  3. package/dist/Calendar/Calendar.js +49 -226
  4. package/dist/Calendar/CalendarStyles.d.ts +2 -6
  5. package/dist/Calendar/CalendarStyles.js +33 -153
  6. package/dist/Calendar/calendarHelpers.d.ts +2 -6
  7. package/dist/Calendar/calendarHelpers.js +5 -13
  8. package/dist/Charts/BarChart/BarChart.js +28 -14
  9. package/dist/Charts/BarChart/BarChart.styled.d.ts +7 -2
  10. package/dist/Charts/BarChart/BarChart.styled.js +5 -1
  11. package/dist/Charts/BarChart/BarChart.types.d.ts +13 -5
  12. package/dist/Charts/ChartUtils/chartSizing.d.ts +20 -0
  13. package/dist/Charts/ChartUtils/chartSizing.js +83 -0
  14. package/dist/Charts/ChartUtils/index.d.ts +1 -0
  15. package/dist/Charts/ChartUtils/index.js +1 -0
  16. package/dist/Charts/HeatMap/HeatMap.js +28 -7
  17. package/dist/Charts/HeatMap/HeatMap.styled.d.ts +6 -2
  18. package/dist/Charts/HeatMap/HeatMap.styled.js +3 -0
  19. package/dist/Charts/HeatMap/HeatMap.types.d.ts +7 -1
  20. package/dist/Charts/LineChart/LineChart.js +34 -15
  21. package/dist/Charts/LineChart/LineChart.styled.d.ts +7 -2
  22. package/dist/Charts/LineChart/LineChart.styled.js +5 -1
  23. package/dist/Charts/LineChart/LineChart.types.d.ts +13 -5
  24. package/dist/Charts/PieChart/PieChart.js +48 -33
  25. package/dist/Charts/PieChart/PieChart.styled.d.ts +7 -2
  26. package/dist/Charts/PieChart/PieChart.styled.js +6 -1
  27. package/dist/Charts/PieChart/PieChart.types.d.ts +7 -3
  28. package/dist/CheckBox/CheckBox.js +19 -36
  29. package/dist/DateInput/DateInput.js +143 -198
  30. package/dist/DropDownMenu/DropDownMenu.js +15 -25
  31. package/dist/DropDownMenu/components/MenuComponent.js +2 -8
  32. package/dist/DropDownMenu/components/MenuItem.d.ts +0 -2
  33. package/dist/DropDownMenu/components/MenuItem.js +21 -25
  34. package/dist/DropDownMenu/components/MenuItemList.d.ts +0 -3
  35. package/dist/DropDownMenu/components/MenuItemList.js +86 -192
  36. package/dist/DropDownMenu/components/StyledContent.js +2 -1
  37. package/dist/DropDownMenu/components/StyledFloatContainer.js +1 -1
  38. package/dist/DropDownMenu/types.d.ts +0 -3
  39. package/dist/FieldLabel/FieldLabel.js +12 -4
  40. package/dist/FileInputField/FileInputField.js +23 -4
  41. package/dist/FileViewer/viewers/ImageViewer.js +18 -75
  42. package/dist/FormSection/FormSection.js +25 -5
  43. package/dist/IconButton/IconButton.js +16 -2
  44. package/dist/Input/Input.js +56 -7
  45. package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +4 -1
  46. package/dist/Pill/Pill.js +79 -8
  47. package/dist/Popover/Popover.context.d.ts +1 -2
  48. package/dist/Popover/Popover.js +2 -5
  49. package/dist/Popover/Popover.styles.d.ts +6 -1
  50. package/dist/Popover/Popover.styles.js +28 -11
  51. package/dist/Popover/Popover.transitions.d.ts +2 -4
  52. package/dist/Popover/Popover.transitions.js +49 -23
  53. package/dist/Popover/PopoverDropdown.js +8 -6
  54. package/dist/Popover/PopoverTarget.js +3 -6
  55. package/dist/QueryFilter/DefaultOperators.d.ts +76 -0
  56. package/dist/QueryFilter/DefaultOperators.js +21 -0
  57. package/dist/QueryFilter/QueryFilter.d.ts +1 -1
  58. package/dist/QueryFilter/QueryFilter.js +303 -3
  59. package/dist/QueryFilter/index.d.ts +2 -3
  60. package/dist/QueryFilter/index.js +2 -3
  61. package/dist/QueryFilter/types.d.ts +52 -0
  62. package/dist/QueryFilter/types.js +1 -0
  63. package/dist/QueryFilter/useQueryFilter.d.ts +1 -1
  64. package/dist/QueryFilter/useQueryFilter.js +19 -23
  65. package/dist/RichTextEditor/Components/CodeBlockBaseButton.d.ts +18 -0
  66. package/dist/RichTextEditor/Components/CodeBlockBaseButton.js +6 -0
  67. package/dist/RichTextEditor/Components/CodeBlockCopyButton.d.ts +9 -0
  68. package/dist/RichTextEditor/Components/CodeBlockCopyButton.js +42 -0
  69. package/dist/RichTextEditor/Components/CodeBlockFormatButton.d.ts +10 -0
  70. package/dist/RichTextEditor/Components/CodeBlockFormatButton.js +60 -0
  71. package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.d.ts +9 -0
  72. package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.js +30 -0
  73. package/dist/RichTextEditor/Components/CodeBlockNodeView.d.ts +3 -0
  74. package/dist/RichTextEditor/Components/CodeBlockNodeView.js +28 -0
  75. package/dist/RichTextEditor/Components/CodeBlockWrapButton.d.ts +10 -0
  76. package/dist/RichTextEditor/Components/CodeBlockWrapButton.js +17 -0
  77. package/dist/RichTextEditor/Components/LinkEditor.d.ts +8 -0
  78. package/dist/RichTextEditor/Components/LinkEditor.js +94 -0
  79. package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.d.ts +2 -0
  80. package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.js +19 -0
  81. package/dist/RichTextEditor/Components/TableTools/TableInsertControls.d.ts +2 -0
  82. package/dist/RichTextEditor/Components/TableTools/TableInsertControls.js +24 -0
  83. package/dist/RichTextEditor/Components/TableTools/TableRails.d.ts +2 -0
  84. package/dist/RichTextEditor/Components/TableTools/TableRails.js +180 -0
  85. package/dist/RichTextEditor/Components/TableTools/TableToolMenu.d.ts +5 -0
  86. package/dist/RichTextEditor/Components/TableTools/TableToolMenu.js +6 -0
  87. package/dist/RichTextEditor/Components/TableTools/TableTools.actions.d.ts +5 -0
  88. package/dist/RichTextEditor/Components/TableTools/TableTools.actions.js +183 -0
  89. package/dist/RichTextEditor/Components/TableTools/TableTools.commands.d.ts +16 -0
  90. package/dist/RichTextEditor/Components/TableTools/TableTools.commands.js +217 -0
  91. package/dist/RichTextEditor/Components/TableTools/TableTools.constants.d.ts +8 -0
  92. package/dist/RichTextEditor/Components/TableTools/TableTools.constants.js +11 -0
  93. package/dist/RichTextEditor/Components/TableTools/TableTools.d.ts +3 -0
  94. package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.d.ts +23 -0
  95. package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.js +75 -0
  96. package/dist/RichTextEditor/Components/TableTools/TableTools.js +3 -0
  97. package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.d.ts +16 -0
  98. package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.js +53 -0
  99. package/dist/RichTextEditor/Components/TableTools/TableTools.styled.d.ts +40 -0
  100. package/dist/RichTextEditor/Components/TableTools/TableTools.styled.js +167 -0
  101. package/dist/RichTextEditor/Components/TableTools/TableTools.types.d.ts +76 -0
  102. package/dist/RichTextEditor/Components/TableTools/TableTools.types.js +1 -0
  103. package/dist/RichTextEditor/Components/TableTools/TableTools.utils.d.ts +4 -0
  104. package/dist/RichTextEditor/Components/TableTools/TableTools.utils.js +4 -0
  105. package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.d.ts +2 -0
  106. package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.js +12 -0
  107. package/dist/RichTextEditor/Components/TableTools/index.d.ts +3 -0
  108. package/dist/RichTextEditor/Components/TableTools/index.js +2 -0
  109. package/dist/RichTextEditor/Enums/HighlightColors.d.ts +9 -0
  110. package/dist/RichTextEditor/Enums/HighlightColors.js +10 -0
  111. package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +15 -5
  112. package/dist/RichTextEditor/Plugins/ImageActionsPlugin.js +4 -7
  113. package/dist/RichTextEditor/Plugins/UploadImagesPlugin.d.ts +0 -15
  114. package/dist/RichTextEditor/Plugins/UploadImagesPlugin.js +51 -115
  115. package/dist/RichTextEditor/Plugins/index.d.ts +0 -1
  116. package/dist/RichTextEditor/Plugins/index.js +0 -1
  117. package/dist/RichTextEditor/RichTextEditor.d.ts +2 -3
  118. package/dist/RichTextEditor/RichTextEditor.js +35 -309
  119. package/dist/RichTextEditor/Toolbar/Toolbar.js +2 -14
  120. package/dist/RichTextEditor/Utils/codeBlockUtils.d.ts +20 -0
  121. package/dist/RichTextEditor/Utils/codeBlockUtils.js +137 -0
  122. package/dist/RichTextEditor/Utils/codeUtils.d.ts +3 -0
  123. package/dist/RichTextEditor/Utils/codeUtils.js +12 -0
  124. package/dist/RichTextEditor/Utils/linkUtils.d.ts +19 -0
  125. package/dist/RichTextEditor/Utils/linkUtils.js +57 -0
  126. package/dist/RichTextEditor/Utils/tableUtils.d.ts +1 -0
  127. package/dist/RichTextEditor/Utils/tableUtils.js +1 -0
  128. package/dist/SegmentedControl/SegmentedControl.utils.d.ts +2 -2
  129. package/dist/SegmentedControl/SegmentedControl.utils.js +30 -3
  130. package/dist/SelectBox/SelectBox.js +5 -5
  131. package/dist/SelectBox/select-box.styled-components.d.ts +1 -4
  132. package/dist/SelectBox/select-box.styled-components.js +48 -11
  133. package/dist/SelectBox/types.d.ts +0 -1
  134. package/dist/Switch/Switch.d.ts +2 -2
  135. package/dist/Switch/Switch.js +83 -18
  136. package/dist/Table/ColumnResizer.d.ts +9 -6
  137. package/dist/Table/ColumnResizer.js +10 -30
  138. package/dist/Table/StateStorage.d.ts +0 -4
  139. package/dist/Table/StateStorage.js +0 -13
  140. package/dist/Table/Table.js +12 -160
  141. package/dist/Table/TableComponents.d.ts +0 -10
  142. package/dist/Table/TableComponents.js +10 -71
  143. package/dist/Table/TableDefaults.d.ts +0 -7
  144. package/dist/Table/TableDefaults.js +0 -7
  145. package/dist/Table/TableHeader.js +16 -31
  146. package/dist/Table/TableMenu/TableMenu.js +1 -1
  147. package/dist/Table/TableProvider.js +75 -354
  148. package/dist/Table/TableRow.js +16 -28
  149. package/dist/Table/Utils/index.d.ts +1 -0
  150. package/dist/Table/Utils/index.js +1 -0
  151. package/dist/Table/Utils/resizeHandler.d.ts +3 -0
  152. package/dist/Table/Utils/resizeHandler.js +84 -0
  153. package/dist/Table/types.d.ts +19 -70
  154. package/dist/TagBox/TagBox.d.ts +1 -1
  155. package/dist/TagBox/TagBox.js +80 -22
  156. package/dist/TagBox/types.d.ts +0 -1
  157. package/dist/TextArea/TextArea.js +23 -9
  158. package/dist/TextInput/TextInput.js +6 -12
  159. package/dist/Utilities/parseTimestamp.js +6 -11
  160. package/dist/core/ArrowButton.d.ts +0 -2
  161. package/dist/core/ArrowButton.js +3 -7
  162. package/dist/core/ClearButton.d.ts +0 -2
  163. package/dist/core/ClearButton.js +3 -7
  164. package/dist/core/controlSizes.js +9 -9
  165. package/dist/core/index.d.ts +0 -1
  166. package/dist/core/index.js +0 -1
  167. package/dist/index.d.ts +0 -3
  168. package/dist/index.js +0 -2
  169. package/dist/theme/variants.js +8 -2
  170. package/package.json +18 -26
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import styled from "styled-components";
3
3
  import * as Tooltip from "@radix-ui/react-tooltip";
4
- import { getControlSizeTokens } from "../core";
5
4
  export const InfoComponent = styled(({ className, children, description, label }) => {
6
5
  if (!description)
7
6
  return children;
@@ -57,8 +56,17 @@ const FieldLabel = styled(({ className, children, error, description, size = "sm
57
56
  margin-left: 8px;
58
57
  }
59
58
 
60
- font-size: ${({ size = "sm" }) => `${getControlSizeTokens(size).labelFontSize}px`};
61
- line-height: 1.3;
59
+ font-size: ${({ size = "sm" }) => size === "xs"
60
+ ? "10px"
61
+ : size === "sm"
62
+ ? "12px"
63
+ : size === "md"
64
+ ? "14px"
65
+ : size === "lg"
66
+ ? "16px"
67
+ : size === "xl"
68
+ ? "18px"
69
+ : "12px"};
62
70
 
63
71
  transition: all 0.2s ease;
64
72
  color: ${({ theme, error }) => theme.palette.text.secondary};
@@ -84,7 +92,7 @@ const FieldLabel = styled(({ className, children, error, description, size = "sm
84
92
  transition: all 0.2s ease;
85
93
  cursor: pointer;
86
94
  color: ${({ theme }) => theme.palette.error.main};
87
- font-size: ${({ size = "sm" }) => `${getControlSizeTokens(size).supportingFontSize}px`};
95
+ font-size: 10px;
88
96
  max-width: 85%;
89
97
  white-space: nowrap;
90
98
  overflow: hidden;
@@ -3,7 +3,6 @@ import { useCallback, useState } from "react";
3
3
  import styled from "styled-components";
4
4
  import { useDropzone } from "react-dropzone";
5
5
  import { Pill, FieldLabel } from "..";
6
- import { getControlSizeTokens } from "../core";
7
6
  const FileInputField = styled(({ className, children, label, error, required, size, onChange, onFocus, dropZoneOptions = {}, colSpan, style = {}, }) => {
8
7
  const [files, setFiles] = useState([]);
9
8
  const onDrop = useCallback((acceptedFiles) => {
@@ -15,7 +14,7 @@ const FileInputField = styled(({ className, children, label, error, required, si
15
14
  setFiles((prev) => prev.filter((f) => f !== file));
16
15
  };
17
16
  const { getRootProps, getInputProps } = useDropzone(Object.assign({ onDrop }, dropZoneOptions));
18
- 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: size, showRemoveIcon: true, onRemove: () => handleRemoveFile(file), children: file.name }, index))) })] }));
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))) })] }));
19
18
  }) `
20
19
  display: flex;
21
20
  flex-direction: column;
@@ -34,7 +33,17 @@ const FileInputField = styled(({ className, children, label, error, required, si
34
33
 
35
34
  color: ${({ theme }) => theme.palette.text.secondary};
36
35
 
37
- font-size: ${({ size }) => `${getControlSizeTokens(size).fontSize}px`};
36
+ font-size: ${({ size }) => size === "xs"
37
+ ? "12px"
38
+ : size === "sm"
39
+ ? "14px"
40
+ : size === "md"
41
+ ? "16px"
42
+ : size === "lg"
43
+ ? "18px"
44
+ : size === "xl"
45
+ ? "20px"
46
+ : "12px"};
38
47
 
39
48
  background-color: ${({ theme, variant }) => {
40
49
  switch (variant) {
@@ -68,7 +77,17 @@ const FileInputField = styled(({ className, children, label, error, required, si
68
77
  }
69
78
  }};
70
79
 
71
- padding: ${({ size }) => `0px ${getControlSizeTokens(size).inputPaddingX}px`};
80
+ padding: ${({ size }) => size === "xs"
81
+ ? "0px 8px"
82
+ : size === "sm"
83
+ ? "0px 10px"
84
+ : size === "md"
85
+ ? "0px 12px"
86
+ : size === "lg"
87
+ ? "0px 14px"
88
+ : size === "xl"
89
+ ? "0px 16px"
90
+ : "0px 8px"};
72
91
 
73
92
  max-width: 100%;
74
93
 
@@ -1,26 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useMemo, useRef, useState } from "react";
2
+ import { useEffect, useState } from "react";
3
3
  import styled from "styled-components";
4
4
  import Loader from "../../Loader";
5
- const IMAGE_VIEWER_PADDING = 10;
6
5
  const ImageViewerContainer = styled.div `
7
- box-sizing: border-box;
8
6
  height: 100%;
9
- padding: ${IMAGE_VIEWER_PADDING}px;
10
- overflow: auto;
11
- `;
12
- const ImageCanvas = styled.div `
13
- display: flex;
14
- align-items: center;
15
- justify-content: center;
16
- flex: 0 0 auto;
17
- min-width: 100%;
18
- min-height: 100%;
7
+
8
+ text-align: center;
9
+ padding: 10px;
19
10
  `;
11
+ // Updated Image styled-component to remove max-width and max-height
20
12
  const Image = styled.img `
21
- box-sizing: border-box;
22
- display: block;
23
- flex: 0 0 auto;
24
13
  object-fit: contain;
25
14
 
26
15
  // set orientation
@@ -37,79 +26,33 @@ const StyledLoader = styled.div `
37
26
  height: 100%;
38
27
  `;
39
28
  export const ImageViewer = ({ file, zoomFactor = 1, isPending }) => {
40
- const containerRef = useRef(null);
41
29
  const [imageLoaded, setImageLoaded] = useState(false);
42
- const [containerSize, setContainerSize] = useState({
43
- width: 0,
44
- height: 0,
45
- });
46
30
  const [originalDimensions, setOriginalDimensions] = useState({
47
31
  naturalWidth: 0,
48
32
  naturalHeight: 0,
33
+ width: 0,
34
+ height: 0,
49
35
  });
50
- const fittedDimensions = useMemo(() => {
51
- const { naturalWidth, naturalHeight } = originalDimensions;
52
- if (naturalWidth === 0 ||
53
- naturalHeight === 0 ||
54
- containerSize.width === 0 ||
55
- containerSize.height === 0) {
56
- return {
57
- width: naturalWidth,
58
- height: naturalHeight,
59
- };
60
- }
61
- const fitScale = Math.min(containerSize.width / naturalWidth, containerSize.height / naturalHeight);
62
- return {
63
- width: naturalWidth * fitScale * zoomFactor,
64
- height: naturalHeight * fitScale * zoomFactor,
65
- };
66
- }, [containerSize, originalDimensions, zoomFactor]);
67
- useEffect(() => {
36
+ const handleImageLoad = (e) => {
37
+ setOriginalDimensions((prev) => (Object.assign(Object.assign({}, prev), { width: e.target.clientWidth, height: e.target.offsetHeight })));
38
+ };
39
+ const loadImage = () => {
68
40
  if (!file.url)
69
41
  return;
70
- let loading = true;
71
- setImageLoaded(false);
72
42
  const img = document.createElement("img");
73
43
  img.src = file.url;
74
44
  img.onload = () => {
75
- if (!loading)
76
- return;
77
- setOriginalDimensions({
78
- naturalWidth: img.naturalWidth,
79
- naturalHeight: img.naturalHeight,
80
- });
45
+ setOriginalDimensions((prev) => (Object.assign(Object.assign({}, prev), { naturalWidth: img.naturalWidth, naturalHeight: img.naturalHeight })));
81
46
  setImageLoaded(true);
82
47
  };
83
- return () => {
84
- loading = false;
85
- };
86
- }, [file.url]);
48
+ };
87
49
  useEffect(() => {
88
- const container = containerRef.current;
89
- if (!container)
90
- return;
91
- const updateContainerSize = () => {
92
- setContainerSize({
93
- width: Math.max(0, container.clientWidth - IMAGE_VIEWER_PADDING * 2),
94
- height: Math.max(0, container.clientHeight - IMAGE_VIEWER_PADDING * 2),
95
- });
96
- };
97
- updateContainerSize();
98
- const resizeObserver = new ResizeObserver(updateContainerSize);
99
- resizeObserver.observe(container);
100
- return () => resizeObserver.disconnect();
101
- }, []);
102
- const showImage = imageLoaded && containerSize.width > 0 && containerSize.height > 0;
50
+ loadImage();
51
+ }, [file.url]);
103
52
  if (isPending) {
104
53
  return (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading Image..." })] }));
105
54
  }
106
- return (_jsxs(ImageViewerContainer, { ref: containerRef, className: "mfui-ImageViewer", children: [!showImage && (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading Image..." })] })), showImage && (_jsx(ImageCanvas, { style: {
107
- width: fittedDimensions.width,
108
- height: fittedDimensions.height,
109
- }, children: _jsx(Image, { src: file.url, alt: file.name ? file.name : "Image", style: {
110
- width: fittedDimensions.width,
111
- height: fittedDimensions.height,
112
- }, onClick: (e) => {
113
- e.stopPropagation();
114
- } }) }))] }));
55
+ return (_jsxs(ImageViewerContainer, { className: "mfui-ImageViewer", children: [!imageLoaded && (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading Image..." })] })), imageLoaded && (_jsx(Image, { src: file.url, alt: file.name ? file.name : "Image", zoomFactor: zoomFactor, onLoad: handleImageLoad, height: zoomFactor === 1 ? "100%" : originalDimensions.height * zoomFactor, onClick: (e) => {
56
+ e.stopPropagation();
57
+ } }))] }));
115
58
  };
@@ -2,14 +2,21 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ChevronDownIcon } from "lucide-react";
3
3
  import { useState } from "react";
4
4
  import styled from "styled-components";
5
- import { getControlSizeTokens } from "../core";
6
5
  const StyledContainer = styled.div `
7
6
  display: flex;
8
7
  flex-direction: column;
9
8
 
10
9
  h3 {
11
10
  margin: 0;
12
- font-size: ${({ size = "md" }) => `${getControlSizeTokens(size).sectionTitleFontSize}px`};
11
+ font-size: ${({ size = "md" }) => size === "xs"
12
+ ? "x-small"
13
+ : size === "sm"
14
+ ? "small"
15
+ : size === "md"
16
+ ? "medium"
17
+ : size === "lg"
18
+ ? "large"
19
+ : "x-large"};
13
20
  }
14
21
 
15
22
  .section-header {
@@ -49,8 +56,21 @@ const StyledContainer = styled.div `
49
56
  }
50
57
  }
51
58
  `;
52
- const resolveIconSize = (size = "md") => {
53
- return getControlSizeTokens(size).sectionIconSize;
59
+ const resolveIconSize = (size) => {
60
+ switch (size) {
61
+ case "xs":
62
+ return 12;
63
+ case "sm":
64
+ return 14;
65
+ case "md":
66
+ return 18;
67
+ case "lg":
68
+ return 24;
69
+ case "xl":
70
+ return 28;
71
+ default:
72
+ return 18;
73
+ }
54
74
  };
55
75
  export const FormSection = ({ title, children, open, defaultOpen = true, onOpenChange, allowCollapse = true, size, style, icon: Icon, iconColor, }) => {
56
76
  const [_open, setOpen] = useState(defaultOpen);
@@ -60,5 +80,5 @@ export const FormSection = ({ title, children, open, defaultOpen = true, onOpenC
60
80
  setOpen(!openState);
61
81
  onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(!openState);
62
82
  }
63
- }, children: [Icon && _jsx(Icon, { size: resolveIconSize(size), color: iconColor }), _jsx("h3", { children: title }), _jsx("div", { className: "section-line" }), !!allowCollapse ? (_jsx(ChevronDownIcon, { size: resolveIconSize(size), className: openState ? "open" : "" })) : ("")] }), _jsx("div", { className: "section-content", "data-open": openState, children: children })] }));
83
+ }, children: [Icon && _jsx(Icon, { size: resolveIconSize(size), color: iconColor }), _jsx("h3", { children: title }), _jsx("div", { className: "section-line" }), !!allowCollapse ? (_jsx(ChevronDownIcon, { size: 18, className: openState ? "open" : "" })) : ("")] }), _jsx("div", { className: "section-content", "data-open": openState, children: children })] }));
64
84
  };
@@ -1,11 +1,25 @@
1
1
  import styled from "styled-components";
2
2
  import { Button } from "..";
3
- import { getControlSizeTokens } from "../core";
4
3
  const IconButton = styled(Button) `
5
4
  padding: ${({ size, variant }) => {
6
5
  if (variant === "text")
7
6
  return `0px 0px`;
8
- return `0px ${getControlSizeTokens(size).iconButtonPaddingX}px`;
7
+ switch (size) {
8
+ case "xxs":
9
+ return `0px 4px`;
10
+ case "xs":
11
+ return `0px 4px`;
12
+ case "sm":
13
+ return `0px 6px`;
14
+ case "md":
15
+ return `0px 8px`;
16
+ case "lg":
17
+ return `0px 10px`;
18
+ case "xl":
19
+ return `0px 12px`;
20
+ default:
21
+ return `0px 6px`;
22
+ }
9
23
  }};
10
24
  `;
11
25
  export default IconButton;
@@ -11,7 +11,6 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import styled from "styled-components";
14
- import { getControlSizeTokens, } from "../core";
15
14
  import { forwardRef } from "react";
16
15
  const StyledInput = styled.input `
17
16
  font-family: ${({ theme }) => theme.typography.fontFamily};
@@ -21,11 +20,41 @@ const StyledInput = styled.input `
21
20
  box-sizing: border-box;
22
21
 
23
22
  color: ${({ theme }) => theme.palette.text.primary};
24
- font-size: ${({ size }) => `${getControlSizeTokens(size).fontSize}px`};
23
+ font-size: ${({ size }) => size === "xs"
24
+ ? "11px"
25
+ : size === "sm"
26
+ ? "13px"
27
+ : size === "md"
28
+ ? "15px"
29
+ : size === "lg"
30
+ ? "17px"
31
+ : size === "xl"
32
+ ? "19px"
33
+ : "13px"};
25
34
 
26
- height: ${({ size }) => `${getControlSizeTokens(size).height}px`};
35
+ height: ${({ size }) => size === "xs"
36
+ ? "26px"
37
+ : size === "sm"
38
+ ? "30px"
39
+ : size === "md"
40
+ ? "36px"
41
+ : size === "lg"
42
+ ? "42px"
43
+ : size === "xl"
44
+ ? "50px"
45
+ : "30px"};
27
46
 
28
- min-height: ${({ size }) => `${getControlSizeTokens(size).height}px`};
47
+ min-height: ${({ size }) => size === "xs"
48
+ ? "26px"
49
+ : size === "sm"
50
+ ? "30px"
51
+ : size === "md"
52
+ ? "36px"
53
+ : size === "lg"
54
+ ? "42px"
55
+ : size === "xl"
56
+ ? "50px"
57
+ : "30px"};
29
58
 
30
59
  transition: border 0.1s ease-in-out;
31
60
  border-radius: 4px;
@@ -45,7 +74,17 @@ const StyledInput = styled.input `
45
74
  }
46
75
  }};
47
76
 
48
- padding: ${({ size }) => `0px ${getControlSizeTokens(size).inputPaddingX}px`};
77
+ padding: ${({ size }) => size === "xs"
78
+ ? "0px 8px"
79
+ : size === "sm"
80
+ ? "0px 10px"
81
+ : size === "md"
82
+ ? "0px 12px"
83
+ : size === "lg"
84
+ ? "0px 14px"
85
+ : size === "xl"
86
+ ? "0px 16px"
87
+ : "0px 10px"};
49
88
 
50
89
  width: ${({ width }) => {
51
90
  if (typeof width === "undefined")
@@ -74,7 +113,17 @@ const StyledInput = styled.input `
74
113
  }};
75
114
 
76
115
  ::placeholder {
77
- font-size: ${({ size }) => `${getControlSizeTokens(size).placeholderFontSize}px`};
116
+ font-size: ${({ size }) => size === "xs"
117
+ ? "10px"
118
+ : size === "sm"
119
+ ? "12px"
120
+ : size === "md"
121
+ ? "14px"
122
+ : size === "lg"
123
+ ? "16px"
124
+ : size === "xl"
125
+ ? "18px"
126
+ : "12px"};
78
127
  }
79
128
 
80
129
  &:focus {
@@ -82,7 +131,7 @@ const StyledInput = styled.input `
82
131
  }
83
132
 
84
133
  &[data-button-right="true"] {
85
- padding-right: ${({ size }) => `${getControlSizeTokens(size).adornmentWidth}px`};
134
+ padding-right: 36px;
86
135
  }
87
136
 
88
137
  &[readOnly] {
@@ -32,13 +32,16 @@ export interface MonolithDefaultTheme {
32
32
  main: string;
33
33
  contrastText: string;
34
34
  };
35
+ warning: {
36
+ main: string;
37
+ contrastText: string;
38
+ };
35
39
  background: {
36
40
  default: string;
37
41
  paper: string;
38
42
  alt: string;
39
43
  secondary: string;
40
44
  gradient: string;
41
- subtle: string;
42
45
  };
43
46
  menu: {
44
47
  background: string;
package/dist/Pill/Pill.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import styled from "styled-components";
3
3
  import { X } from "lucide-react";
4
- import { getControlSizeTokens } from "../core";
5
4
  const StyledButton = styled.button `
6
5
  background-color: transparent;
7
6
  border: none;
@@ -36,7 +35,7 @@ const Pill = styled(({ className, children, title, size = "md", showRemoveIcon =
36
35
  flex-direction: row;
37
36
  width: fit-content;
38
37
  max-width: 250px;
39
- gap: ${({ size }) => `${getControlSizeTokens(size).pillGap}px`};
38
+ gap: 5px;
40
39
  flex: 0;
41
40
 
42
41
  font-weight: 500;
@@ -46,12 +45,55 @@ const Pill = styled(({ className, children, title, size = "md", showRemoveIcon =
46
45
  if (showRemoveIcon !== false) {
47
46
  return "0px";
48
47
  }
49
- return `${getControlSizeTokens(size).pillPaddingX}px`;
48
+ switch (size) {
49
+ case "xs":
50
+ return "8px";
51
+ case "sm":
52
+ return "10px";
53
+ case "md":
54
+ return "12px";
55
+ case "lg":
56
+ return "14px";
57
+ case "xl":
58
+ return "16px";
59
+ default:
60
+ return "10px";
61
+ }
50
62
  }};
51
63
 
52
- padding-inline-start: ${({ size }) => `${getControlSizeTokens(size).pillPaddingX}px`};
64
+ padding-inline-start: ${({ size }) => {
65
+ switch (size) {
66
+ case "xs":
67
+ return "8px";
68
+ case "sm":
69
+ return "10px";
70
+ case "md":
71
+ return "12px";
72
+ case "lg":
73
+ return "14px";
74
+ case "xl":
75
+ return "16px";
76
+ default:
77
+ return "10px";
78
+ }
79
+ }};
53
80
 
54
- height: ${({ size }) => `${getControlSizeTokens(size).pillHeight}px`};
81
+ height: ${({ size }) => {
82
+ switch (size) {
83
+ case "xs":
84
+ return "20px";
85
+ case "sm":
86
+ return "22px";
87
+ case "md":
88
+ return "24px";
89
+ case "lg":
90
+ return "26px";
91
+ case "xl":
92
+ return "28px";
93
+ default:
94
+ return "22px";
95
+ }
96
+ }};
55
97
 
56
98
  border: 1px solid ${({ theme }) => theme.palette.divider};
57
99
  border-radius: 1000px;
@@ -63,14 +105,43 @@ const Pill = styled(({ className, children, title, size = "md", showRemoveIcon =
63
105
  overflow: hidden;
64
106
  text-overflow: ellipsis;
65
107
 
66
- font-size: ${({ size }) => `${getControlSizeTokens(size).pillFontSize}px`};
108
+ font-size: ${({ size }) => {
109
+ switch (size) {
110
+ case "xs":
111
+ return "10px";
112
+ case "sm":
113
+ return "12px";
114
+ case "md":
115
+ return "14px";
116
+ case "lg":
117
+ return "16px";
118
+ case "xl":
119
+ return "18px";
120
+ default:
121
+ return "12px";
122
+ }
123
+ }};
67
124
  }
68
125
 
69
126
  svg {
70
127
  color: ${({ theme }) => theme.palette.text.primary};
71
128
 
72
- width: ${({ size }) => `${getControlSizeTokens(size).pillIconSize}px`};
73
- height: ${({ size }) => `${getControlSizeTokens(size).pillIconSize}px`};
129
+ width: ${({ size }) => {
130
+ switch (size) {
131
+ case "xs":
132
+ return "12px";
133
+ case "sm":
134
+ return "14px";
135
+ case "md":
136
+ return "16px";
137
+ case "lg":
138
+ return "18px";
139
+ case "xl":
140
+ return "20px";
141
+ default:
142
+ return "14px";
143
+ }
144
+ }};
74
145
  }
75
146
  `;
76
147
  export default Pill;
@@ -10,13 +10,12 @@ export interface PopoverContextValue {
10
10
  withArrow: boolean;
11
11
  arrowSize: number;
12
12
  arrowRadius: number;
13
- arrowRef: React.MutableRefObject<SVGSVGElement | null>;
13
+ arrowRef: React.MutableRefObject<HTMLDivElement | null>;
14
14
  withinPortal: boolean;
15
15
  trapFocus: boolean;
16
16
  returnFocus: boolean;
17
17
  keepMounted: boolean;
18
18
  zIndex: number;
19
- role: "dialog" | "menu" | "tooltip";
20
19
  dropdownId: string;
21
20
  transitionProps: PopoverTransitionProps;
22
21
  }
@@ -23,9 +23,8 @@ const PopoverRoot = ({ children, opened, defaultOpened = false, onChange, trigge
23
23
  }
24
24
  },
25
25
  placement: position,
26
- transform: false,
27
26
  middleware: [
28
- offset(offsetValue + (withArrow ? resolvedArrowSize : 0)),
27
+ offset(offsetValue + (withArrow ? resolvedArrowSize / 2 : 0)),
29
28
  flip({ padding: flipPadding }),
30
29
  shift({ padding: shiftPadding }),
31
30
  size({
@@ -43,7 +42,7 @@ const PopoverRoot = ({ children, opened, defaultOpened = false, onChange, trigge
43
42
  ? [
44
43
  arrow({
45
44
  element: arrowRef,
46
- padding: Math.max(8, resolvedArrowSize),
45
+ padding: 8,
47
46
  }),
48
47
  ]
49
48
  : []),
@@ -93,7 +92,6 @@ const PopoverRoot = ({ children, opened, defaultOpened = false, onChange, trigge
93
92
  returnFocus,
94
93
  keepMounted,
95
94
  zIndex,
96
- role,
97
95
  dropdownId,
98
96
  transitionProps,
99
97
  }), [
@@ -111,7 +109,6 @@ const PopoverRoot = ({ children, opened, defaultOpened = false, onChange, trigge
111
109
  returnFocus,
112
110
  keepMounted,
113
111
  zIndex,
114
- role,
115
112
  dropdownId,
116
113
  transitionProps,
117
114
  ]);
@@ -1,2 +1,7 @@
1
1
  export declare const StyledDropdown: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
- export declare const StyledArrow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("@floating-ui/react").FloatingArrowProps, "ref"> & import("react").RefAttributes<SVGSVGElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<import("@floating-ui/react").FloatingArrowProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>, keyof import("react").Component<any, {}, any>>;
2
+ export declare const ARROW_STYLES: Record<"top" | "right" | "bottom" | "left", {
3
+ clipPath: string;
4
+ borderTransparent: string[];
5
+ radiusCorner: string;
6
+ staticProp: string;
7
+ }>;
@@ -1,14 +1,10 @@
1
- import { FloatingArrow } from "@floating-ui/react";
2
1
  import styled from "styled-components";
3
2
  export const StyledDropdown = styled.div `
4
- --mf-popover-arrow-fill: ${({ theme }) => theme.palette.background.default};
5
- --mf-popover-arrow-border: ${({ theme }) => theme.palette.divider};
6
-
7
3
  position: relative;
8
4
  min-width: 180px;
9
5
  border-radius: 8px;
10
- border: 1px solid var(--mf-popover-arrow-border);
11
- background-color: var(--mf-popover-arrow-fill);
6
+ border: 1px solid ${({ theme }) => theme.palette.divider};
7
+ background-color: ${({ theme }) => theme.palette.background.default};
12
8
  color: ${({ theme }) => theme.palette.text.primary};
13
9
  box-shadow:
14
10
  rgba(15, 23, 42, 0.1) 0px 10px 15px -3px,
@@ -16,8 +12,29 @@ export const StyledDropdown = styled.div `
16
12
  padding: 10px 12px;
17
13
  outline: none;
18
14
  `;
19
- export const StyledArrow = styled(FloatingArrow) `
20
- display: block;
21
- overflow: visible;
22
- z-index: 1;
23
- `;
15
+ export const ARROW_STYLES = {
16
+ bottom: {
17
+ clipPath: "polygon(0 100%, 0 0, 100% 0)",
18
+ borderTransparent: ["borderBottomColor", "borderRightColor"],
19
+ radiusCorner: "borderTopLeftRadius",
20
+ staticProp: "top",
21
+ },
22
+ top: {
23
+ clipPath: "polygon(0 100%, 100% 100%, 100% 0)",
24
+ borderTransparent: ["borderTopColor", "borderLeftColor"],
25
+ radiusCorner: "borderBottomRightRadius",
26
+ staticProp: "bottom",
27
+ },
28
+ left: {
29
+ clipPath: "polygon(100% 0, 0 0, 100% 100%)",
30
+ borderTransparent: ["borderLeftColor", "borderBottomColor"],
31
+ radiusCorner: "borderTopRightRadius",
32
+ staticProp: "right",
33
+ },
34
+ right: {
35
+ clipPath: "polygon(0 100%, 0 0, 100% 100%)",
36
+ borderTransparent: ["borderRightColor", "borderTopColor"],
37
+ radiusCorner: "borderBottomLeftRadius",
38
+ staticProp: "left",
39
+ },
40
+ };
@@ -1,7 +1,5 @@
1
- import { FloatingContext } from "@floating-ui/react";
2
- import { CSSProperties } from "react";
3
1
  import { PopoverTransitionProps } from "./Popover.types";
4
- export declare function usePopoverTransition(context: FloatingContext, { transition, duration, timingFunction, }: PopoverTransitionProps): {
2
+ export declare function usePopoverTransition(opened: boolean, { transition, duration, timingFunction }: PopoverTransitionProps): {
5
3
  mounted: boolean;
6
- styles: CSSProperties;
4
+ styles: React.CSSProperties;
7
5
  };