@monolith-forensics/monolith-ui 1.1.63 → 1.1.65
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.
- package/dist/Loader/Loader.d.ts +3 -0
- package/dist/Loader/Loader.js +40 -0
- package/dist/Loader/index.d.ts +2 -0
- package/dist/Loader/index.js +1 -0
- package/dist/Loader/types.d.ts +7 -0
- package/dist/Loader/types.js +1 -0
- package/dist/SelectBox/SelectBox.d.ts +1 -1
- package/dist/SelectBox/SelectBox.js +17 -15
- package/dist/SelectBox/types.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +4 -5
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
const Loader = styled(({ className, style }) => {
|
|
4
|
+
return (_jsx("div", { className: className + " mf-Loader", style: style, children: _jsx("span", { className: "mf-Loader-root" }) }));
|
|
5
|
+
}) `
|
|
6
|
+
display: inline-block;
|
|
7
|
+
margin: auto;
|
|
8
|
+
|
|
9
|
+
.mf-Loader-root {
|
|
10
|
+
display: inline-block;
|
|
11
|
+
width: ${({ size }) => size || 20}px;
|
|
12
|
+
height: ${({ size }) => size || 20}px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.mf-Loader-root:after {
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
content: "";
|
|
18
|
+
display: block;
|
|
19
|
+
width: ${({ size }) => size || 20}px;
|
|
20
|
+
height: ${({ size }) => size || 20}px;
|
|
21
|
+
border-radius: 50%;
|
|
22
|
+
border-width: calc(${({ size }) => size || 20}px / 10);
|
|
23
|
+
border-style: solid;
|
|
24
|
+
border-color: ${({ color, theme }) => color || theme.palette.primary.main}
|
|
25
|
+
${({ color, theme }) => color || theme.palette.primary.main}
|
|
26
|
+
${({ color, theme }) => color || theme.palette.primary.main} transparent;
|
|
27
|
+
|
|
28
|
+
animation: spin ${({ speed }) => speed || 600}ms linear infinite;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@keyframes spin {
|
|
32
|
+
0% {
|
|
33
|
+
transform: rotate(0deg);
|
|
34
|
+
}
|
|
35
|
+
100% {
|
|
36
|
+
transform: rotate(360deg);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
export default Loader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Loader";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,5 +2,5 @@ import { SelectBoxProps } from "..";
|
|
|
2
2
|
export declare const StyledInputContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
3
3
|
width?: string | number | null;
|
|
4
4
|
}>> & string;
|
|
5
|
-
declare const SelectBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<SelectBoxProps, never>> & string & Omit<({ className, data, placeholder, arrow, onChange, onSearch, searchFn, onScroll, loading, defaultValue, onItemAdded, size, variant, width, allowCustomValue, searchable, clearable, label, description, required, error, openOnFocus, renderOption, actionComponent, focused, grouped, OptionTooltip, DropDownProps, debounceTime, }: SelectBoxProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
5
|
+
declare const SelectBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<SelectBoxProps, never>> & string & Omit<({ className, data, placeholder, arrow, onChange, onSearch, searchFn, onScroll, loading, defaultValue, onItemAdded, size, variant, width, allowCustomValue, searchable, clearable, label, description, required, error, openOnFocus, renderOption, actionComponent, focused, grouped, OptionTooltip, DropDownProps, debounceTime, sort, }: SelectBoxProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
6
6
|
export default SelectBox;
|
|
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
13
13
|
import styled from "styled-components";
|
|
14
14
|
import { useFloating, flip, offset, FloatingPortal, autoUpdate, } from "@floating-ui/react";
|
|
15
15
|
import { useCallback, useEffect, useRef, useState, } from "react";
|
|
16
|
-
import { Input, FieldLabel, Tooltip } from "..";
|
|
16
|
+
import { Input, FieldLabel, Tooltip, Loader } from "..";
|
|
17
17
|
import { useDebouncedCallback } from "use-debounce";
|
|
18
18
|
import { StyledContent, StyledFloatContainer, ArrowButton, ClearButton, } from "../core";
|
|
19
19
|
export const StyledInputContainer = styled.div `
|
|
@@ -153,7 +153,7 @@ const StyledItem = styled.div `
|
|
|
153
153
|
}
|
|
154
154
|
`;
|
|
155
155
|
const SelectBox = styled(({ className, data = [], placeholder = "Select...", arrow = true, onChange, onSearch, searchFn, onScroll, loading, defaultValue, onItemAdded, size = "sm", variant = "outlined", width = "100%", allowCustomValue = false, searchable = false, clearable = false, label, description, required = false, error, openOnFocus = true, renderOption, actionComponent, focused, grouped, OptionTooltip, // Custom tooltip component for search menu items
|
|
156
|
-
DropDownProps = {}, debounceTime = 300, }) => {
|
|
156
|
+
DropDownProps = {}, debounceTime = 300, sort = false, }) => {
|
|
157
157
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
158
158
|
const isObjectArray = (_a = Object.keys((data === null || data === void 0 ? void 0 : data[0]) || {})) === null || _a === void 0 ? void 0 : _a.includes("label");
|
|
159
159
|
const [inputValue, setInputValue] = useState("");
|
|
@@ -183,6 +183,8 @@ DropDownProps = {}, debounceTime = 300, }) => {
|
|
|
183
183
|
const bValue = b.group;
|
|
184
184
|
return aValue.localeCompare(bValue);
|
|
185
185
|
}
|
|
186
|
+
if (!sort)
|
|
187
|
+
return 0;
|
|
186
188
|
// Secondary sort by label/value to ensure consistent ordering
|
|
187
189
|
const aLabel = isObjectArray ? a.label : a;
|
|
188
190
|
const bLabel = isObjectArray ? b.label : b;
|
|
@@ -463,19 +465,19 @@ DropDownProps = {}, debounceTime = 300, }) => {
|
|
|
463
465
|
maxHeight: DropDownProps.autoHeight
|
|
464
466
|
? (dropDownHeight || 250) - 10
|
|
465
467
|
: "",
|
|
466
|
-
}, variant: variant, "data-empty": filteredItems.length === 0 }, DropDownProps, { children: [actionComponent && _jsx(ActionMenu, { children: actionComponent }),
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
468
|
+
}, variant: variant, "data-empty": filteredItems.length === 0 }, DropDownProps, { children: [loading && _jsx(Loader, {}), !loading && actionComponent && (_jsx(ActionMenu, { children: actionComponent })), !loading && (_jsx(StyledInnerItemContainer, { ref: scrollContainerRef, "data-scroll-active": scrollActive, onScroll: onScroll, children: grouped
|
|
469
|
+
? groups.map((group, index) => (_jsxs("div", { children: [_jsx(GroupTitle, { size: size, children: group.label }), group.items.map((item, index) => {
|
|
470
|
+
return (_jsx(Tooltip, { content: OptionTooltip ? (_jsx(OptionTooltip, { data: item.data })) : null, side: "left", children: _jsx(StyledItem, { className: "mfFloatingItem", onClick: (e) => handleItemClick(e, item), "data-selected": isObjectArray
|
|
471
|
+
? (selected === null || selected === void 0 ? void 0 : selected.value) ===
|
|
472
|
+
item.value
|
|
473
|
+
: selected === item, size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || (_jsx(_Fragment, { children: (item === null || item === void 0 ? void 0 : item.label) || item })) }, index) }, index));
|
|
474
|
+
})] }, group.label)))
|
|
475
|
+
: filteredItems.map((item, index) => {
|
|
476
|
+
return (_jsx(Tooltip, { content: OptionTooltip ? (_jsx(OptionTooltip, { data: item.data })) : null, side: "left", children: _jsx(StyledItem, { className: "mfFloatingItem", onClick: (e) => handleItemClick(e, item), "data-selected": isObjectArray
|
|
477
|
+
? (selected === null || selected === void 0 ? void 0 : selected.value) ===
|
|
478
|
+
(item === null || item === void 0 ? void 0 : item.value)
|
|
479
|
+
: selected === item, size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || (_jsx(_Fragment, { children: (item === null || item === void 0 ? void 0 : item.label) || item })) }, index) }, index));
|
|
480
|
+
}) }))] })) }) }))] }));
|
|
479
481
|
}) `
|
|
480
482
|
position: relative;
|
|
481
483
|
cursor: pointer;
|
package/dist/index.d.ts
CHANGED
|
@@ -29,3 +29,5 @@ export { default as MonolithUIProvider } from "./MonolithUIProvider";
|
|
|
29
29
|
export { useMonolithUITheme } from "./MonolithUIProvider";
|
|
30
30
|
export { default as RichTextEditor, Extensions, SlashCommands, Controls, } from "./RichTextEditor";
|
|
31
31
|
export type { CustomItem, ToolbarOptions } from "./RichTextEditor";
|
|
32
|
+
export { default as Loader } from "./Loader";
|
|
33
|
+
export type { LoaderProps } from "./Loader";
|
package/dist/index.js
CHANGED
|
@@ -25,3 +25,4 @@ export { Column } from "./Table";
|
|
|
25
25
|
export { default as MonolithUIProvider } from "./MonolithUIProvider";
|
|
26
26
|
export { useMonolithUITheme } from "./MonolithUIProvider";
|
|
27
27
|
export { default as RichTextEditor, Extensions, SlashCommands, Controls, } from "./RichTextEditor";
|
|
28
|
+
export { default as Loader } from "./Loader";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monolith-forensics/monolith-ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.65",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Matt Danner (Monolith Forensics LLC)",
|
|
@@ -18,10 +18,9 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"clean": "rm -r ./dist",
|
|
20
20
|
"build": "tsc",
|
|
21
|
-
"patch": "yarn version --patch",
|
|
22
|
-
"minor": "yarn version --minor",
|
|
23
|
-
"major": "yarn version --major"
|
|
24
|
-
"release-patch": "yarn version --patch --deferred && yarn build && npm publish && yarn clean"
|
|
21
|
+
"release-patch": "yarn version --patch --deferred && yarn build && npm publish && yarn clean",
|
|
22
|
+
"release-minor": "yarn version --minor --deferred && yarn build && npm publish && yarn clean",
|
|
23
|
+
"release-major": "yarn version --major --deferred && yarn build && npm publish && yarn clean"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
27
26
|
"@floating-ui/react": "^0.26.16",
|