@monolith-forensics/monolith-ui 1.1.67 → 1.1.68
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/SelectBox/types.d.ts +10 -10
- package/dist/TagBox/TagBox.d.ts +2 -38
- package/dist/TagBox/TagBox.js +37 -25
- package/dist/TagBox/index.d.ts +1 -0
- package/dist/TagBox/types.d.ts +40 -0
- package/dist/TagBox/types.js +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -11,12 +11,8 @@ export interface SelectBoxProps {
|
|
|
11
11
|
data?: Option[] | string[];
|
|
12
12
|
placeholder?: string;
|
|
13
13
|
arrow?: boolean;
|
|
14
|
-
onChange?: (value: any, item: any) => void;
|
|
15
|
-
onSearch?: (value: string) => void;
|
|
16
|
-
searchFn?: (value: string) => void;
|
|
17
|
-
onScroll?: (e: any) => void;
|
|
18
14
|
loading?: boolean;
|
|
19
|
-
|
|
15
|
+
grouped?: boolean;
|
|
20
16
|
size?: Size;
|
|
21
17
|
variant?: Variant;
|
|
22
18
|
width?: string | number | null;
|
|
@@ -28,14 +24,18 @@ export interface SelectBoxProps {
|
|
|
28
24
|
required?: boolean;
|
|
29
25
|
error?: string;
|
|
30
26
|
openOnFocus?: boolean;
|
|
31
|
-
renderOption?: (item: Option | string) => React.ReactNode;
|
|
32
27
|
actionComponent?: JSX.Element;
|
|
33
28
|
focused?: boolean;
|
|
34
|
-
grouped?: boolean;
|
|
35
|
-
OptionTooltip?: React.FC<{
|
|
36
|
-
data: any;
|
|
37
|
-
}>;
|
|
38
29
|
DropDownProps?: any;
|
|
39
30
|
debounceTime?: number;
|
|
40
31
|
sort?: boolean;
|
|
32
|
+
renderOption?: (item: Option | string) => React.ReactNode;
|
|
33
|
+
OptionTooltip?: (props: {
|
|
34
|
+
data: any;
|
|
35
|
+
}) => JSX.Element;
|
|
36
|
+
onChange?: (value: any, item: any) => void;
|
|
37
|
+
onScroll?: (e: any) => void;
|
|
38
|
+
onSearch?: (value: string) => void;
|
|
39
|
+
searchFn?: (value: string) => void;
|
|
40
|
+
onItemAdded?: (item: any) => void;
|
|
41
41
|
}
|
package/dist/TagBox/TagBox.d.ts
CHANGED
|
@@ -1,39 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
type Option = {
|
|
4
|
-
label: string;
|
|
5
|
-
value: any;
|
|
6
|
-
group?: string;
|
|
7
|
-
data?: any;
|
|
8
|
-
};
|
|
9
|
-
interface TagBoxProps {
|
|
10
|
-
className?: string;
|
|
11
|
-
data?: Option[] | string[];
|
|
12
|
-
placeholder?: string;
|
|
13
|
-
arrow?: boolean;
|
|
14
|
-
defaultValue?: Option[];
|
|
15
|
-
grouped?: boolean;
|
|
16
|
-
searchFn?: (value: string) => void;
|
|
17
|
-
onChange?: (value: any[]) => void;
|
|
18
|
-
onScroll?: () => void;
|
|
19
|
-
onSearch?: (value: string) => void;
|
|
20
|
-
onItemAdded?: (value: any) => void;
|
|
21
|
-
size?: Size;
|
|
22
|
-
variant?: Variant;
|
|
23
|
-
width?: string;
|
|
24
|
-
allowCustomValue?: boolean;
|
|
25
|
-
searchable?: boolean;
|
|
26
|
-
clearable?: boolean;
|
|
27
|
-
openOnFocus?: boolean;
|
|
28
|
-
label?: string;
|
|
29
|
-
description?: string;
|
|
30
|
-
required?: boolean;
|
|
31
|
-
error?: string;
|
|
32
|
-
loading?: boolean;
|
|
33
|
-
renderOption?: (item: Option | string) => ReactNode;
|
|
34
|
-
TooltipContent?: (props: {
|
|
35
|
-
data: any;
|
|
36
|
-
}) => JSX.Element;
|
|
37
|
-
}
|
|
38
|
-
declare const TagBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<TagBoxProps, never>> & string & Omit<({ className, data, placeholder, arrow, defaultValue, grouped, searchFn, onChange, onScroll, onSearch, onItemAdded, size, variant, width, allowCustomValue, searchable, clearable, openOnFocus, label, description, required, error, loading, renderOption, TooltipContent, }: TagBoxProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
1
|
+
import { TagBoxProps } from "./types";
|
|
2
|
+
declare const TagBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<TagBoxProps, never>> & string & Omit<({ className, data, placeholder, arrow, defaultValue, grouped, searchFn, onChange, onScroll, onSearch, onItemAdded, size, variant, width, allowCustomValue, searchable, clearable, openOnFocus, label, description, required, error, loading, sort, renderOption, OptionTooltip, }: TagBoxProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
39
3
|
export default TagBox;
|
package/dist/TagBox/TagBox.js
CHANGED
|
@@ -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, autoUpdate } from "@floating-ui/react";
|
|
15
15
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
16
|
-
import { Input, Tooltip, FieldLabel, Pill } from "..";
|
|
16
|
+
import { Input, Tooltip, FieldLabel, Pill, Loader } from "..";
|
|
17
17
|
import { ArrowButton, ClearButton, StyledFloatContainer, StyledContent, } from "../core";
|
|
18
18
|
const StyledInputContainer = styled.div `
|
|
19
19
|
position: relative;
|
|
@@ -284,7 +284,15 @@ const StyledItem = styled.div `
|
|
|
284
284
|
color: ${(props) => props.theme.palette.text.primary};
|
|
285
285
|
}
|
|
286
286
|
`;
|
|
287
|
-
const
|
|
287
|
+
const EmptyComponent = styled.div `
|
|
288
|
+
display: flex;
|
|
289
|
+
align-items: center;
|
|
290
|
+
justify-content: center;
|
|
291
|
+
padding: 5px;
|
|
292
|
+
font-size: 1 rem;
|
|
293
|
+
color: ${(props) => props.theme.palette.text.secondary};
|
|
294
|
+
`;
|
|
295
|
+
const TagBox = styled(({ className, data = [], placeholder = "Select tags", arrow = true, defaultValue = [], grouped, searchFn, onChange, onScroll, onSearch, onItemAdded, size = "sm", variant = "outlined", width = "100%", allowCustomValue = false, searchable = false, clearable = false, openOnFocus = true, label, description, required = false, error, loading = false, sort = false, renderOption, OptionTooltip, }) => {
|
|
288
296
|
var _a, _b, _c, _d, _e, _f;
|
|
289
297
|
const isObjectArray = (_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("label");
|
|
290
298
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -312,8 +320,12 @@ const TagBox = styled(({ className, data = [], placeholder = "Select tags", arro
|
|
|
312
320
|
const bValue = b.group;
|
|
313
321
|
return aValue.localeCompare(bValue);
|
|
314
322
|
}
|
|
315
|
-
|
|
316
|
-
|
|
323
|
+
if (!sort)
|
|
324
|
+
return 0;
|
|
325
|
+
// Secondary sort by label/value to ensure consistent ordering
|
|
326
|
+
const aLabel = isObjectArray ? a.label : a;
|
|
327
|
+
const bLabel = isObjectArray ? b.label : b;
|
|
328
|
+
return aLabel.localeCompare(bLabel);
|
|
317
329
|
});
|
|
318
330
|
const groupedItems = grouped
|
|
319
331
|
? filteredItems.reduce((acc, item) => {
|
|
@@ -560,27 +572,27 @@ const TagBox = styled(({ className, data = [], placeholder = "Select tags", arro
|
|
|
560
572
|
e.preventDefault();
|
|
561
573
|
e.stopPropagation();
|
|
562
574
|
toggleOpen();
|
|
563
|
-
} })) : null] }), isOpen && (_jsx(StyledFloatContainer, { ref: refs.setFloating, style: floatingStyles, className: "mfFloating", children:
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
575
|
+
} })) : null] }), isOpen && (_jsx(StyledFloatContainer, { ref: refs.setFloating, style: floatingStyles, className: "mfFloating", children: _jsxs(ExtendedStyledContent, { className: "mfFloatingContent", style: { width: contentWidth, maxWidth: contentWidth }, variant: variant, onScroll: onScroll, "data-scroll-active": scrollActive, "data-empty": filteredItems.length === 0, children: [loading && _jsx(Loader, {}), !loading && filteredItems.length === 0 && (_jsx(EmptyComponent, { children: "No Items" })), !loading && grouped
|
|
576
|
+
? groups.map((group) => (_jsxs("div", { children: [_jsx(GroupTitle, { size: size, children: group.label }), group.items.map((item, index) => {
|
|
577
|
+
return (_jsx(Tooltip, { content: OptionTooltip ? (_jsx(OptionTooltip, { data: item.data })) : null, side: "left", children: _jsx(StyledItem, { className: "mfFloatingItem", onClick: (e) => {
|
|
578
|
+
e.preventDefault();
|
|
579
|
+
e.stopPropagation();
|
|
580
|
+
handleItemClick(item);
|
|
581
|
+
}, "data-highlighted": isObjectArray
|
|
582
|
+
? (preSelected === null || preSelected === void 0 ? void 0 : preSelected.value) ===
|
|
583
|
+
item.value
|
|
584
|
+
: preSelected === 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));
|
|
585
|
+
})] }, group.label)))
|
|
586
|
+
: filteredItems.map((item, index) => {
|
|
587
|
+
return (_jsx(Tooltip, { content: OptionTooltip ? (_jsx(OptionTooltip, { data: item.data })) : null, side: "left", children: _jsx(StyledItem, { className: "mfFloatingItem", onClick: (e) => {
|
|
588
|
+
e.preventDefault();
|
|
589
|
+
e.stopPropagation();
|
|
590
|
+
handleItemClick(item);
|
|
591
|
+
}, "data-highlighted": isObjectArray
|
|
592
|
+
? (preSelected === null || preSelected === void 0 ? void 0 : preSelected.value) ===
|
|
593
|
+
item.value
|
|
594
|
+
: preSelected === 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));
|
|
595
|
+
})] }) }))] }));
|
|
584
596
|
}) `
|
|
585
597
|
position: relative;
|
|
586
598
|
cursor: pointer;
|
package/dist/TagBox/index.d.ts
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Size, Variant } from "../core";
|
|
2
|
+
export type Option = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: any;
|
|
5
|
+
group?: string;
|
|
6
|
+
data?: any;
|
|
7
|
+
};
|
|
8
|
+
export interface TagBoxProps {
|
|
9
|
+
className?: string;
|
|
10
|
+
defaultValue?: Option[];
|
|
11
|
+
data?: Option[] | string[];
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
arrow?: boolean;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
grouped?: boolean;
|
|
16
|
+
size?: Size;
|
|
17
|
+
variant?: Variant;
|
|
18
|
+
width?: string | number | null;
|
|
19
|
+
allowCustomValue?: boolean;
|
|
20
|
+
searchable?: boolean;
|
|
21
|
+
clearable?: boolean;
|
|
22
|
+
label?: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
error?: string;
|
|
26
|
+
openOnFocus?: boolean;
|
|
27
|
+
focused?: boolean;
|
|
28
|
+
DropDownProps?: any;
|
|
29
|
+
debounceTime?: number;
|
|
30
|
+
sort?: boolean;
|
|
31
|
+
renderOption?: (item: Option | string) => React.ReactNode;
|
|
32
|
+
OptionTooltip?: (props: {
|
|
33
|
+
data: any;
|
|
34
|
+
}) => JSX.Element;
|
|
35
|
+
onChange?: (value: any[]) => void;
|
|
36
|
+
onScroll?: () => void;
|
|
37
|
+
onSearch?: (value: string) => void;
|
|
38
|
+
searchFn?: (value: string) => void;
|
|
39
|
+
onItemAdded?: (value: any) => void;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export { default as DateInput } from "./DateInput";
|
|
|
12
12
|
export { default as TextArea } from "./TextArea";
|
|
13
13
|
export { default as TextAreaInput } from "./TextAreaInput";
|
|
14
14
|
export { default as TagBox } from "./TagBox";
|
|
15
|
+
export type { TagBoxProps, TagboxOption } from "./TagBox";
|
|
15
16
|
export { default as FieldLabel } from "./FieldLabel";
|
|
16
17
|
export { default as Modal } from "./Modal";
|
|
17
18
|
export { default as Flyout } from "./Flyout";
|