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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) 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/CheckBox/CheckBox.js +19 -36
  9. package/dist/DateInput/DateInput.js +143 -198
  10. package/dist/DropDownMenu/DropDownMenu.js +15 -25
  11. package/dist/DropDownMenu/components/MenuComponent.js +2 -8
  12. package/dist/DropDownMenu/components/MenuItem.d.ts +0 -2
  13. package/dist/DropDownMenu/components/MenuItem.js +21 -25
  14. package/dist/DropDownMenu/components/MenuItemList.d.ts +0 -3
  15. package/dist/DropDownMenu/components/MenuItemList.js +86 -192
  16. package/dist/DropDownMenu/components/StyledContent.js +2 -1
  17. package/dist/DropDownMenu/components/StyledFloatContainer.js +1 -1
  18. package/dist/DropDownMenu/types.d.ts +0 -3
  19. package/dist/FieldLabel/FieldLabel.js +12 -4
  20. package/dist/FileInputField/FileInputField.js +23 -4
  21. package/dist/FileViewer/viewers/ImageViewer.js +18 -75
  22. package/dist/FormSection/FormSection.js +25 -5
  23. package/dist/IconButton/IconButton.js +16 -2
  24. package/dist/Input/Input.js +56 -7
  25. package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +0 -1
  26. package/dist/Pill/Pill.js +79 -8
  27. package/dist/Popover/Popover.context.d.ts +1 -2
  28. package/dist/Popover/Popover.js +2 -5
  29. package/dist/Popover/Popover.styles.d.ts +6 -1
  30. package/dist/Popover/Popover.styles.js +28 -11
  31. package/dist/Popover/Popover.transitions.d.ts +2 -4
  32. package/dist/Popover/Popover.transitions.js +49 -23
  33. package/dist/Popover/PopoverDropdown.js +8 -6
  34. package/dist/Popover/PopoverTarget.js +3 -6
  35. package/dist/QueryFilter/DefaultOperators.d.ts +76 -0
  36. package/dist/QueryFilter/DefaultOperators.js +21 -0
  37. package/dist/QueryFilter/QueryFilter.d.ts +1 -1
  38. package/dist/QueryFilter/QueryFilter.js +303 -3
  39. package/dist/QueryFilter/index.d.ts +2 -3
  40. package/dist/QueryFilter/index.js +2 -3
  41. package/dist/QueryFilter/{QueryFilter.types.d.ts → types.d.ts} +2 -11
  42. package/dist/QueryFilter/useQueryFilter.d.ts +1 -1
  43. package/dist/QueryFilter/useQueryFilter.js +19 -23
  44. package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +15 -5
  45. package/dist/RichTextEditor/Plugins/UploadImagesPlugin.d.ts +0 -15
  46. package/dist/RichTextEditor/Plugins/UploadImagesPlugin.js +51 -115
  47. package/dist/RichTextEditor/Plugins/index.d.ts +0 -1
  48. package/dist/RichTextEditor/Plugins/index.js +0 -1
  49. package/dist/RichTextEditor/RichTextEditor.d.ts +2 -3
  50. package/dist/RichTextEditor/RichTextEditor.js +35 -309
  51. package/dist/RichTextEditor/Toolbar/Toolbar.js +2 -14
  52. package/dist/SegmentedControl/SegmentedControl.utils.d.ts +2 -2
  53. package/dist/SegmentedControl/SegmentedControl.utils.js +30 -3
  54. package/dist/SelectBox/SelectBox.js +5 -5
  55. package/dist/SelectBox/select-box.styled-components.d.ts +1 -4
  56. package/dist/SelectBox/select-box.styled-components.js +48 -11
  57. package/dist/SelectBox/types.d.ts +0 -1
  58. package/dist/Switch/Switch.d.ts +2 -2
  59. package/dist/Switch/Switch.js +83 -18
  60. package/dist/Table/ColumnResizer.d.ts +9 -6
  61. package/dist/Table/ColumnResizer.js +10 -30
  62. package/dist/Table/StateStorage.d.ts +0 -4
  63. package/dist/Table/StateStorage.js +0 -13
  64. package/dist/Table/Table.js +12 -160
  65. package/dist/Table/TableComponents.d.ts +0 -10
  66. package/dist/Table/TableComponents.js +10 -71
  67. package/dist/Table/TableDefaults.d.ts +0 -7
  68. package/dist/Table/TableDefaults.js +0 -7
  69. package/dist/Table/TableHeader.js +16 -31
  70. package/dist/Table/TableMenu/TableMenu.js +1 -1
  71. package/dist/Table/TableProvider.js +75 -354
  72. package/dist/Table/TableRow.js +16 -28
  73. package/dist/Table/Utils/index.d.ts +1 -0
  74. package/dist/Table/Utils/index.js +1 -0
  75. package/dist/Table/Utils/resizeHandler.d.ts +3 -0
  76. package/dist/Table/Utils/resizeHandler.js +84 -0
  77. package/dist/Table/types.d.ts +19 -70
  78. package/dist/Tabs/Tab.js +0 -8
  79. package/dist/TagBox/TagBox.d.ts +1 -1
  80. package/dist/TagBox/TagBox.js +208 -50
  81. package/dist/TagBox/types.d.ts +13 -1
  82. package/dist/TextArea/TextArea.js +23 -9
  83. package/dist/TextInput/TextInput.js +6 -12
  84. package/dist/Utilities/parseTimestamp.js +6 -11
  85. package/dist/core/ArrowButton.d.ts +0 -2
  86. package/dist/core/ArrowButton.js +3 -7
  87. package/dist/core/ClearButton.d.ts +0 -2
  88. package/dist/core/ClearButton.js +3 -7
  89. package/dist/core/controlSizes.d.ts +0 -26
  90. package/dist/core/controlSizes.js +0 -156
  91. package/dist/index.d.ts +0 -3
  92. package/dist/index.js +0 -2
  93. package/dist/theme/variants.js +0 -2
  94. package/package.json +18 -26
  95. package/dist/Charts/BarChart/BarChart.d.ts +0 -5
  96. package/dist/Charts/BarChart/BarChart.js +0 -549
  97. package/dist/Charts/BarChart/BarChart.lib.d.ts +0 -31
  98. package/dist/Charts/BarChart/BarChart.lib.js +0 -136
  99. package/dist/Charts/BarChart/BarChart.styled.d.ts +0 -51
  100. package/dist/Charts/BarChart/BarChart.styled.js +0 -115
  101. package/dist/Charts/BarChart/BarChart.types.d.ts +0 -171
  102. package/dist/Charts/BarChart/index.d.ts +0 -3
  103. package/dist/Charts/BarChart/index.js +0 -2
  104. package/dist/Charts/ChartPrimitives/ChartExportControl.d.ts +0 -11
  105. package/dist/Charts/ChartPrimitives/ChartExportControl.js +0 -29
  106. package/dist/Charts/ChartPrimitives/chartActions.styled.d.ts +0 -1
  107. package/dist/Charts/ChartPrimitives/chartActions.styled.js +0 -8
  108. package/dist/Charts/ChartPrimitives/chartLegend.styled.d.ts +0 -12
  109. package/dist/Charts/ChartPrimitives/chartLegend.styled.js +0 -52
  110. package/dist/Charts/ChartPrimitives/chartTooltip.styled.d.ts +0 -19
  111. package/dist/Charts/ChartPrimitives/chartTooltip.styled.js +0 -61
  112. package/dist/Charts/ChartPrimitives/index.d.ts +0 -4
  113. package/dist/Charts/ChartPrimitives/index.js +0 -4
  114. package/dist/Charts/ChartUtils/chartColors.d.ts +0 -8
  115. package/dist/Charts/ChartUtils/chartColors.js +0 -65
  116. package/dist/Charts/ChartUtils/chartExport.d.ts +0 -47
  117. package/dist/Charts/ChartUtils/chartExport.js +0 -311
  118. package/dist/Charts/ChartUtils/chartMath.d.ts +0 -3
  119. package/dist/Charts/ChartUtils/chartMath.js +0 -3
  120. package/dist/Charts/ChartUtils/index.d.ts +0 -3
  121. package/dist/Charts/ChartUtils/index.js +0 -3
  122. package/dist/Charts/HeatMap/HeatMap.d.ts +0 -5
  123. package/dist/Charts/HeatMap/HeatMap.js +0 -212
  124. package/dist/Charts/HeatMap/HeatMap.lib.d.ts +0 -30
  125. package/dist/Charts/HeatMap/HeatMap.lib.js +0 -115
  126. package/dist/Charts/HeatMap/HeatMap.styled.d.ts +0 -37
  127. package/dist/Charts/HeatMap/HeatMap.styled.js +0 -91
  128. package/dist/Charts/HeatMap/HeatMap.types.d.ts +0 -80
  129. package/dist/Charts/HeatMap/HeatMap.types.js +0 -1
  130. package/dist/Charts/HeatMap/index.d.ts +0 -3
  131. package/dist/Charts/HeatMap/index.js +0 -2
  132. package/dist/Charts/LineChart/LineChart.d.ts +0 -5
  133. package/dist/Charts/LineChart/LineChart.js +0 -529
  134. package/dist/Charts/LineChart/LineChart.lib.d.ts +0 -24
  135. package/dist/Charts/LineChart/LineChart.lib.js +0 -132
  136. package/dist/Charts/LineChart/LineChart.styled.d.ts +0 -59
  137. package/dist/Charts/LineChart/LineChart.styled.js +0 -147
  138. package/dist/Charts/LineChart/LineChart.types.d.ts +0 -193
  139. package/dist/Charts/LineChart/LineChart.types.js +0 -1
  140. package/dist/Charts/LineChart/index.d.ts +0 -3
  141. package/dist/Charts/LineChart/index.js +0 -2
  142. package/dist/Charts/PieChart/PieChart.d.ts +0 -4
  143. package/dist/Charts/PieChart/PieChart.js +0 -199
  144. package/dist/Charts/PieChart/PieChart.lib.d.ts +0 -5
  145. package/dist/Charts/PieChart/PieChart.lib.js +0 -19
  146. package/dist/Charts/PieChart/PieChart.styled.d.ts +0 -51
  147. package/dist/Charts/PieChart/PieChart.styled.js +0 -163
  148. package/dist/Charts/PieChart/PieChart.types.d.ts +0 -100
  149. package/dist/Charts/PieChart/PieChart.types.js +0 -1
  150. package/dist/Charts/PieChart/index.d.ts +0 -2
  151. package/dist/Charts/PieChart/index.js +0 -1
  152. package/dist/Charts/index.d.ts +0 -5
  153. package/dist/Charts/index.js +0 -4
  154. package/dist/QueryFilter/QueryFilter.constants.d.ts +0 -134
  155. package/dist/QueryFilter/QueryFilter.constants.js +0 -39
  156. package/dist/QueryFilter/QueryFilter.lib.d.ts +0 -14
  157. package/dist/QueryFilter/QueryFilter.lib.js +0 -84
  158. package/dist/QueryFilter/QueryFilter.styled.d.ts +0 -89
  159. package/dist/QueryFilter/QueryFilter.styled.js +0 -184
  160. package/dist/QueryFilter/QueryFilter.types.js +0 -1
  161. package/dist/QueryFilter/components/MultiSelectEditor.d.ts +0 -7
  162. package/dist/QueryFilter/components/MultiSelectEditor.js +0 -44
  163. package/dist/QueryFilter/components/RuleChip.d.ts +0 -8
  164. package/dist/QueryFilter/components/RuleChip.js +0 -37
  165. package/dist/QueryFilter/components/Rules.d.ts +0 -11
  166. package/dist/QueryFilter/components/Rules.js +0 -41
  167. package/dist/QueryFilter/components/UnavailableRuleChip.d.ts +0 -5
  168. package/dist/QueryFilter/components/UnavailableRuleChip.js +0 -7
  169. package/dist/QueryFilter/components/ValueEditor.d.ts +0 -7
  170. package/dist/QueryFilter/components/ValueEditor.js +0 -45
  171. package/dist/QueryFilter/components/ValueSelector.d.ts +0 -7
  172. package/dist/QueryFilter/components/ValueSelector.js +0 -34
  173. package/dist/QueryFilter/components/index.d.ts +0 -6
  174. package/dist/QueryFilter/components/index.js +0 -6
  175. package/dist/RichTextEditor/Plugins/ImageActionsPlugin.d.ts +0 -3
  176. package/dist/RichTextEditor/Plugins/ImageActionsPlugin.js +0 -241
  177. package/dist/SuperDatePicker/SuperDatePicker.constants.d.ts +0 -24
  178. package/dist/SuperDatePicker/SuperDatePicker.constants.js +0 -30
  179. package/dist/SuperDatePicker/SuperDatePicker.d.ts +0 -3
  180. package/dist/SuperDatePicker/SuperDatePicker.js +0 -31
  181. package/dist/SuperDatePicker/SuperDatePicker.lib.d.ts +0 -17
  182. package/dist/SuperDatePicker/SuperDatePicker.lib.js +0 -206
  183. package/dist/SuperDatePicker/SuperDatePicker.styled.d.ts +0 -60
  184. package/dist/SuperDatePicker/SuperDatePicker.styled.js +0 -256
  185. package/dist/SuperDatePicker/SuperDatePicker.types.d.ts +0 -48
  186. package/dist/SuperDatePicker/SuperDatePicker.types.js +0 -1
  187. package/dist/SuperDatePicker/components/CommonPresetGroups.d.ts +0 -7
  188. package/dist/SuperDatePicker/components/CommonPresetGroups.js +0 -6
  189. package/dist/SuperDatePicker/components/EndpointCalendarDropdown.d.ts +0 -10
  190. package/dist/SuperDatePicker/components/EndpointCalendarDropdown.js +0 -9
  191. package/dist/SuperDatePicker/components/EndpointDateInput.d.ts +0 -16
  192. package/dist/SuperDatePicker/components/EndpointDateInput.js +0 -26
  193. package/dist/SuperDatePicker/components/EndpointPopover.d.ts +0 -18
  194. package/dist/SuperDatePicker/components/EndpointPopover.js +0 -11
  195. package/dist/SuperDatePicker/components/QuickRangeDropdown.d.ts +0 -14
  196. package/dist/SuperDatePicker/components/QuickRangeDropdown.js +0 -19
  197. package/dist/SuperDatePicker/components/QuickRangePopover.d.ts +0 -18
  198. package/dist/SuperDatePicker/components/QuickRangePopover.js +0 -12
  199. package/dist/SuperDatePicker/components/index.d.ts +0 -6
  200. package/dist/SuperDatePicker/components/index.js +0 -6
  201. package/dist/SuperDatePicker/index.d.ts +0 -3
  202. package/dist/SuperDatePicker/index.js +0 -3
  203. package/dist/SuperDatePicker/useSuperDatePicker.d.ts +0 -32
  204. package/dist/SuperDatePicker/useSuperDatePicker.js +0 -125
  205. /package/dist/{Charts/BarChart/BarChart.types.js → QueryFilter/types.js} +0 -0
@@ -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] {
@@ -38,7 +38,6 @@ export interface MonolithDefaultTheme {
38
38
  alt: string;
39
39
  secondary: string;
40
40
  gradient: string;
41
- subtle: string;
42
41
  };
43
42
  menu: {
44
43
  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
  };
@@ -1,37 +1,63 @@
1
- import { useTransitionStyles } from "@floating-ui/react";
1
+ import { useEffect, useRef, useState } from "react";
2
2
  const TRANSITION_PRESETS = {
3
3
  fade: {
4
- initial: { opacity: 0 },
5
- open: { opacity: 1 },
4
+ from: { opacity: 0 },
5
+ to: { opacity: 1 },
6
6
  },
7
7
  scale: {
8
- initial: { opacity: 0, transform: "scale(0.85)" },
9
- open: { opacity: 1, transform: "scale(1)" },
8
+ from: { opacity: 0, scale: "0.85" },
9
+ to: { opacity: 1, scale: "1" },
10
10
  },
11
11
  "scale-y": {
12
- initial: { opacity: 0, transform: "scaleY(0.7)" },
13
- open: { opacity: 1, transform: "scaleY(1)" },
12
+ from: { opacity: 0, scale: "1 0.7" },
13
+ to: { opacity: 1, scale: "1 1" },
14
14
  },
15
15
  pop: {
16
- initial: { opacity: 0, transform: "scale(0.6)" },
17
- open: { opacity: 1, transform: "scale(1)" },
16
+ from: { opacity: 0, scale: "0.6" },
17
+ to: { opacity: 1, scale: "1" },
18
18
  },
19
19
  };
20
- export function usePopoverTransition(context, { transition = "fade", duration = 150, timingFunction = "ease", }) {
21
- var _a;
20
+ export function usePopoverTransition(opened, { transition = "fade", duration = 150, timingFunction = "ease" }) {
21
+ const [mounted, setMounted] = useState(opened);
22
+ const [transitionEnabled, setTransitionEnabled] = useState(false);
23
+ const [phase, setPhase] = useState(opened ? "enter" : "exit");
24
+ const frameRef = useRef(0);
25
+ useEffect(() => {
26
+ cancelAnimationFrame(frameRef.current);
27
+ if (opened) {
28
+ setMounted(true);
29
+ setTransitionEnabled(false);
30
+ setPhase("exit");
31
+ frameRef.current = requestAnimationFrame(() => {
32
+ frameRef.current = requestAnimationFrame(() => {
33
+ setTransitionEnabled(true);
34
+ setPhase("enter");
35
+ });
36
+ });
37
+ }
38
+ else {
39
+ setTransitionEnabled(true);
40
+ setPhase("exit");
41
+ const timer = setTimeout(() => {
42
+ setMounted(false);
43
+ setTransitionEnabled(false);
44
+ }, duration);
45
+ return () => clearTimeout(timer);
46
+ }
47
+ }, [opened, duration]);
48
+ useEffect(() => {
49
+ return () => cancelAnimationFrame(frameRef.current);
50
+ }, []);
22
51
  const preset = TRANSITION_PRESETS[transition];
23
- const { isMounted, styles } = useTransitionStyles(context, {
24
- duration,
25
- initial: preset.initial,
26
- open: preset.open,
27
- close: (_a = preset.close) !== null && _a !== void 0 ? _a : preset.initial,
28
- common: {
29
- transitionTimingFunction: timingFunction,
30
- willChange: transition === "fade" ? "opacity" : "opacity, transform",
31
- },
32
- });
52
+ const transitionStyles = phase === "enter" ? preset.to : preset.from;
53
+ const properties = [
54
+ ...new Set([...Object.keys(preset.from), ...Object.keys(preset.to)]),
55
+ ];
56
+ const transitionValue = properties
57
+ .map((prop) => `${prop} ${duration}ms ${timingFunction}`)
58
+ .join(", ");
33
59
  return {
34
- mounted: isMounted,
35
- styles,
60
+ mounted: mounted || opened,
61
+ styles: Object.assign(Object.assign({}, transitionStyles), (transitionEnabled ? { transition: transitionValue } : {})),
36
62
  };
37
63
  }