@monolith-forensics/monolith-ui 1.3.96 → 1.3.103
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/Alert/Alert.d.ts +8 -0
- package/dist/Alert/Alert.js +52 -0
- package/dist/Alert/index.d.ts +1 -0
- package/dist/Alert/index.js +1 -0
- package/dist/Button/Button.d.ts +1 -0
- package/dist/Button/Button.js +4 -4
- package/dist/Calendar/Calendar.js +77 -76
- package/dist/DateInput/DateInput.d.ts +3 -4
- package/dist/DateInput/DateInput.js +39 -73
- package/dist/DropDownMenu/DropDownMenu.d.ts +1 -2
- package/dist/DropDownMenu/DropDownMenu.js +7 -13
- package/dist/DropDownMenu/components/MenuComponent.js +2 -2
- package/dist/DropDownMenu/components/MenuItem.js +1 -1
- package/dist/DropDownMenu/components/MenuItemList.d.ts +6 -2
- package/dist/DropDownMenu/components/MenuItemList.js +99 -30
- package/dist/DropDownMenu/index.d.ts +1 -1
- package/dist/DropDownMenu/index.js +1 -1
- package/dist/DropDownMenu/types.d.ts +23 -8
- package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +35 -0
- package/dist/QueryFilter/QueryFilter.js +52 -43
- package/dist/QueryFilter/index.d.ts +0 -1
- package/dist/QueryFilter/index.js +0 -1
- package/dist/QueryFilter/types.d.ts +3 -5
- package/dist/RichTextEditor/Components/BubbleMenu.js +1 -1
- package/dist/RichTextEditor/Components/ColorPicker.js +4 -2
- package/dist/RichTextEditor/Toolbar/Toolbar.js +1 -1
- package/dist/SelectBox/SelectBox.js +31 -2
- package/dist/SelectBox/select-box.styled-components.js +6 -1
- package/dist/SelectBox/types.d.ts +4 -0
- package/dist/Switch/Switch.d.ts +3 -4
- package/dist/Switch/Switch.js +1 -2
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Switch/index.js +1 -1
- package/dist/Table/TableComponents.js +16 -0
- package/dist/Table/TableMenu/TableMenu.js +18 -4
- package/dist/Table/TableProvider.js +214 -139
- package/dist/Table/TableRow.js +3 -2
- package/dist/Table/types.d.ts +40 -6
- package/dist/TextAreaInput/TextAreaInput.d.ts +11 -9
- package/dist/TextAreaInput/TextAreaInput.js +106 -107
- package/dist/index.d.ts +3 -5
- package/dist/index.js +3 -3
- package/dist/theme/variants.js +66 -1
- package/package.json +3 -3
- package/dist/QueryFilter/useFilterHelper.d.ts +0 -20
- package/dist/QueryFilter/useFilterHelper.js +0 -61
- package/dist/SelectableTextArea/SelectableTextArea.d.ts +0 -28
- package/dist/SelectableTextArea/SelectableTextArea.js +0 -180
- package/dist/SelectableTextArea/index.d.ts +0 -2
- package/dist/SelectableTextArea/index.js +0 -1
|
@@ -10,7 +10,9 @@ import { StyledInputContainer, StyledInnerItemContainer, EmptyComponent, GroupTi
|
|
|
10
10
|
// Re-export for backward compatibility
|
|
11
11
|
export { StyledInputContainer };
|
|
12
12
|
export const SelectBox = ({ className, data = [], placeholder = "Select...", arrow = true, onChange, onSearch, searchFn, onScroll, loading, defaultValue, value, 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
|
|
13
|
-
DropDownProps = {}, debounceTime = 175, sort = false, disabled = false,
|
|
13
|
+
DropDownProps = {}, debounceTime = 175, sort = false, disabled = false,
|
|
14
|
+
// Enhanced focus control props
|
|
15
|
+
triggerFocus = false, triggerOpen = false, onFocused, onOpened, }) => {
|
|
14
16
|
var _a, _b, _c, _d, _e, _f;
|
|
15
17
|
// Component setup and data processing
|
|
16
18
|
const theme = useTheme();
|
|
@@ -193,6 +195,8 @@ DropDownProps = {}, debounceTime = 175, sort = false, disabled = false, }) => {
|
|
|
193
195
|
}, [onChange]);
|
|
194
196
|
const handleKeyDown = (e) => {
|
|
195
197
|
var _a;
|
|
198
|
+
if (disabled)
|
|
199
|
+
return;
|
|
196
200
|
// Escape key
|
|
197
201
|
if (e.key === KEYBOARD_KEYS.ESCAPE) {
|
|
198
202
|
const reference = (_a = refs === null || refs === void 0 ? void 0 : refs.reference) === null || _a === void 0 ? void 0 : _a.current;
|
|
@@ -336,6 +340,10 @@ DropDownProps = {}, debounceTime = 175, sort = false, disabled = false, }) => {
|
|
|
336
340
|
item.scrollIntoView({ block: "nearest" });
|
|
337
341
|
}
|
|
338
342
|
}, [_value]);
|
|
343
|
+
// ensure that the input value is updated when the value changes when in controlled mode
|
|
344
|
+
useEffect(() => {
|
|
345
|
+
setInputValue((_value === null || _value === void 0 ? void 0 : _value.label) || "");
|
|
346
|
+
}, [_value === null || _value === void 0 ? void 0 : _value.label]);
|
|
339
347
|
useEffect(() => {
|
|
340
348
|
if (bottomHeight < DEFAULT_DROPDOWN_HEIGHT) {
|
|
341
349
|
setPlacement("top-start");
|
|
@@ -351,9 +359,29 @@ DropDownProps = {}, debounceTime = 175, sort = false, disabled = false, }) => {
|
|
|
351
359
|
};
|
|
352
360
|
}, [topHeight, bottomHeight, isOpen]);
|
|
353
361
|
// ============================================================================
|
|
362
|
+
// Enhanced Focus Control Effects
|
|
363
|
+
// ============================================================================
|
|
364
|
+
// Handle triggerFocus prop
|
|
365
|
+
useEffect(() => {
|
|
366
|
+
if (triggerFocus && inputRef.current) {
|
|
367
|
+
inputRef.current.focus();
|
|
368
|
+
onFocused === null || onFocused === void 0 ? void 0 : onFocused();
|
|
369
|
+
}
|
|
370
|
+
}, [triggerFocus, onFocused]);
|
|
371
|
+
// Handle triggerOpen prop
|
|
372
|
+
useEffect(() => {
|
|
373
|
+
if (triggerOpen) {
|
|
374
|
+
setIsOpen(true);
|
|
375
|
+
if (inputRef.current) {
|
|
376
|
+
inputRef.current.focus();
|
|
377
|
+
}
|
|
378
|
+
onOpened === null || onOpened === void 0 ? void 0 : onOpened();
|
|
379
|
+
}
|
|
380
|
+
}, [triggerOpen, onOpened]);
|
|
381
|
+
// ============================================================================
|
|
354
382
|
// Render
|
|
355
383
|
// ============================================================================
|
|
356
|
-
return (_jsxs(StyledContainer, { className: className, children: [label && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, children: label })), _jsxs(StyledInputContainer, { ref: refs.setReference, onMouseDown: () => setIsOpen(true), width: width, onKeyDown: handleKeyDown, "data-open": isOpen, "data-disabled": disabled, children: [_jsx(Input, { ref: inputRef, value: inputValue, onChange: handleInputChange, onFocus: handleFocus, autoFocus: focused, placeholder: placeholder, size: size, readOnly: !searchable && !allowCustomValue, "data-button-right": arrow || clearable, style: isOpen ? { borderColor: theme.palette.primary.main } : {} }), renderActionButton()] }), isOpen && (_jsx(FloatingPortal, { preserveTabOrder: true, children: _jsx(StyledFloatContainer, { ref: (ref) => {
|
|
384
|
+
return (_jsxs(StyledContainer, { className: className, children: [label && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, children: label })), _jsxs(StyledInputContainer, { ref: refs.setReference, onMouseDown: () => setIsOpen(true), width: width, onKeyDown: handleKeyDown, "data-open": isOpen, "data-disabled": disabled, tabIndex: disabled ? -1 : 0, children: [_jsx(Input, { ref: inputRef, value: inputValue, onChange: handleInputChange, onFocus: handleFocus, autoFocus: focused, disabled: disabled, tabIndex: disabled ? -1 : 0, placeholder: placeholder, size: size, readOnly: !searchable && !allowCustomValue, "data-button-right": arrow || clearable, style: isOpen ? { borderColor: theme.palette.primary.main } : {} }), renderActionButton()] }), isOpen && (_jsx(FloatingPortal, { preserveTabOrder: true, children: _jsx(StyledFloatContainer, { ref: (ref) => {
|
|
357
385
|
containerRef.current = ref;
|
|
358
386
|
refs.setFloating(ref);
|
|
359
387
|
}, style: floatingStyles, className: "mfFloating", children: _jsxs(StyledContent, Object.assign({ className: "mfFloatingContent", style: {
|
|
@@ -369,3 +397,4 @@ DropDownProps = {}, debounceTime = 175, sort = false, disabled = false, }) => {
|
|
|
369
397
|
? groups.map((group, index) => (_jsxs("div", { children: [_jsx(GroupTitle, { size: size, children: group.label }), group.items.map((item, index) => renderOptionItem(item, index))] }, group.label)))
|
|
370
398
|
: filteredItems.map((item, index) => renderOptionItem(item, index)) }))] })) }) }))] }));
|
|
371
399
|
};
|
|
400
|
+
SelectBox.displayName = "SelectBox";
|
|
@@ -40,6 +40,11 @@ export const StyledInputContainer = styled.div `
|
|
|
40
40
|
pointer-events: none;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
|
|
44
|
+
input[disabled] {
|
|
45
|
+
opacity: 1 !important;
|
|
46
|
+
pointer-events: none !important;
|
|
47
|
+
}
|
|
43
48
|
`;
|
|
44
49
|
export const StyledInnerItemContainer = styled.div `
|
|
45
50
|
overflow-y: auto;
|
|
@@ -159,7 +164,7 @@ export const StyledItem = styled.div `
|
|
|
159
164
|
color: ${(props) => props.theme.palette.text.primary};
|
|
160
165
|
}
|
|
161
166
|
|
|
162
|
-
&[data-disabled] {
|
|
167
|
+
&[data-disabled="true"] {
|
|
163
168
|
color: ${(props) => props.theme.palette.text.secondary};
|
|
164
169
|
opacity: 0.5;
|
|
165
170
|
pointer-events: none;
|
|
@@ -42,4 +42,8 @@ export type SelectBoxProps = {
|
|
|
42
42
|
onSearch?: (value: string) => void;
|
|
43
43
|
searchFn?: (value: string) => void;
|
|
44
44
|
onItemAdded?: (item: Option | string) => void;
|
|
45
|
+
triggerFocus?: boolean;
|
|
46
|
+
triggerOpen?: boolean;
|
|
47
|
+
onFocused?: () => void;
|
|
48
|
+
onOpened?: () => void;
|
|
45
49
|
};
|
package/dist/Switch/Switch.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties } from "react";
|
|
2
2
|
import { Size } from "../core";
|
|
3
|
-
|
|
3
|
+
export type SwitchProps = {
|
|
4
4
|
className?: string;
|
|
5
5
|
onChange: (e: any) => void;
|
|
6
6
|
size?: Size;
|
|
@@ -13,6 +13,5 @@ interface SwitchProps {
|
|
|
13
13
|
defaultValue?: boolean;
|
|
14
14
|
value?: boolean;
|
|
15
15
|
style?: CSSProperties;
|
|
16
|
-
}
|
|
17
|
-
declare const Switch: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<SwitchProps, never>> & string & Omit<({ className, onChange, size, label, labelPosition, description, error, required, disabled, defaultValue, value, style, ...other }: SwitchProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
18
|
-
export default Switch;
|
|
16
|
+
};
|
|
17
|
+
export declare const Switch: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<SwitchProps, never>> & string & Omit<({ className, onChange, size, label, labelPosition, description, error, required, disabled, defaultValue, value, style, ...other }: SwitchProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
package/dist/Switch/Switch.js
CHANGED
|
@@ -118,7 +118,7 @@ const StyledThumb = styled(RadixSwitch.Thumb) `
|
|
|
118
118
|
: "translateX(17px)"};
|
|
119
119
|
}
|
|
120
120
|
`;
|
|
121
|
-
const Switch = styled((_a) => {
|
|
121
|
+
export const Switch = styled((_a) => {
|
|
122
122
|
var { className, onChange, size = "xs", label, labelPosition = "right", description, error, required, disabled = false, defaultValue, value, style = {} } = _a, other = __rest(_a, ["className", "onChange", "size", "label", "labelPosition", "description", "error", "required", "disabled", "defaultValue", "value", "style"]);
|
|
123
123
|
return (_jsxs("div", { className: className, children: [label && labelPosition === "left" && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, style: { margin: 0 }, children: label })), _jsx(StyledRoot, Object.assign({ size: size, className: "SwitchRoot", onCheckedChange: onChange, defaultChecked: defaultValue, checked: value, disabled: disabled, style: style }, other, { children: _jsx(StyledThumb, { size: size, className: "SwitchThumb" }) })), label && labelPosition === "right" && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, style: { margin: 0 }, children: label }))] }));
|
|
124
124
|
}) `
|
|
@@ -127,4 +127,3 @@ const Switch = styled((_a) => {
|
|
|
127
127
|
align-items: center;
|
|
128
128
|
gap: 10px;
|
|
129
129
|
`;
|
|
130
|
-
export default Switch;
|
package/dist/Switch/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./Switch";
|
package/dist/Switch/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./Switch";
|
|
@@ -29,6 +29,22 @@ export const TR = styled.div `
|
|
|
29
29
|
visibility: visible;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
&[data-focused="true"] {
|
|
33
|
+
border: 1px solid transparent;
|
|
34
|
+
outline: 1px solid ${({ theme }) => theme.palette.primary.main};
|
|
35
|
+
outline-offset: -1px;
|
|
36
|
+
|
|
37
|
+
.mfui-td {
|
|
38
|
+
border-bottom: 1px solid transparent;
|
|
39
|
+
background-color: ${({ theme }) => theme.palette.primary.main}20;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Select the row above the focused row
|
|
44
|
+
&:has(+ .mfui-tr[data-focused="true"]) .mfui-td {
|
|
45
|
+
border-bottom: 1px solid transparent;
|
|
46
|
+
}
|
|
47
|
+
|
|
32
48
|
&:hover > .mfui-td {
|
|
33
49
|
background-color: ${({ theme }) => theme.palette.action.hover};
|
|
34
50
|
}
|
|
@@ -3,7 +3,7 @@ import styled from "styled-components";
|
|
|
3
3
|
import { Button } from "../../Button";
|
|
4
4
|
import { TextInput } from "../../TextInput";
|
|
5
5
|
import { CheckSquareIcon, Columns3Icon, DownloadIcon, FilterIcon, Rows3Icon, Rows4Icon, } from "lucide-react";
|
|
6
|
-
import DropDownMenu from "../../DropDownMenu";
|
|
6
|
+
import { DropDownMenu } from "../../DropDownMenu";
|
|
7
7
|
import useTable from "../useTable";
|
|
8
8
|
import { TableExportOptions } from "../enums";
|
|
9
9
|
import { useDebouncedCallback } from "use-debounce";
|
|
@@ -12,6 +12,7 @@ import { QueryFilter, useQueryFilter, } from "../../QueryFilter";
|
|
|
12
12
|
import shortUUID from "short-uuid";
|
|
13
13
|
import { DefaultOperators } from "../../QueryFilter";
|
|
14
14
|
import { useEffect, useRef } from "react";
|
|
15
|
+
import { Switch } from "../..";
|
|
15
16
|
const StyledContainer = styled.div `
|
|
16
17
|
display: flex;
|
|
17
18
|
flex-direction: column;
|
|
@@ -33,7 +34,7 @@ const TableMenu = () => {
|
|
|
33
34
|
const inputRef = useRef(null);
|
|
34
35
|
if ((tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.enabled) !== true)
|
|
35
36
|
return null;
|
|
36
|
-
const { addButtonOptions, filterOptions, tableCountOptions, exportOptions, compactOptions, columnSelectorOptions, searchOptions, children, } = tableMenuOptions;
|
|
37
|
+
const { addButtonOptions, filterOptions, tableCountOptions, exportOptions, compactOptions, columnSelectorOptions, searchOptions, children, customMenuItems, } = tableMenuOptions;
|
|
37
38
|
const queryFilter = useQueryFilter({
|
|
38
39
|
defaultFilter: filterState,
|
|
39
40
|
filterDefinitions: (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.filterDefinitions) || [],
|
|
@@ -61,6 +62,19 @@ const TableMenu = () => {
|
|
|
61
62
|
label: item.label,
|
|
62
63
|
});
|
|
63
64
|
};
|
|
65
|
+
const renderCustomMenuItems = (args) => {
|
|
66
|
+
return customMenuItems === null || customMenuItems === void 0 ? void 0 : customMenuItems.filter((item) => (item.position || "left") === args.position).map((item, index) => {
|
|
67
|
+
if (item.type === "button") {
|
|
68
|
+
return _jsx(Button, Object.assign({ size: "xxs" }, item.options), index);
|
|
69
|
+
}
|
|
70
|
+
if (item.type === "menu") {
|
|
71
|
+
return (_jsx(DropDownMenu, Object.assign({ size: "xxs", arrow: true }, item.options), index));
|
|
72
|
+
}
|
|
73
|
+
if (item.type === "switch") {
|
|
74
|
+
return _jsx(Switch, Object.assign({ size: "xs" }, item.options), index);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
64
78
|
// simultate
|
|
65
79
|
useEffect(() => {
|
|
66
80
|
if (inputRef.current && searchState === "") {
|
|
@@ -83,8 +97,8 @@ const TableMenu = () => {
|
|
|
83
97
|
leftSection: _jsx(FilterIcon, { size: 12 }),
|
|
84
98
|
}, onItemSelect: handleSelectFilter, dropDownProps: {
|
|
85
99
|
style: { width: 175, maxWidth: 400 },
|
|
86
|
-
}, searchable: true, children: "Filter" })), (tableCountOptions === null || tableCountOptions === void 0 ? void 0 : tableCountOptions.recordsTotalEnabled) === true && (_jsx(InfoBadge, { total: totalRecords || data.length })), enableSelection === true &&
|
|
87
|
-
(tableCountOptions === null || tableCountOptions === void 0 ? void 0 : tableCountOptions.selectionTotalEnabled) === true && (_jsx(InfoBadge, { total: getCalculatedSelectionTotal(), hint: "Selected Items", icon: CheckSquareIcon })), children] }), _jsxs(FlexedRow, { children: [(exportOptions === null || exportOptions === void 0 ? void 0 : exportOptions.enabled) === true && (_jsx(DropDownMenu, { variant: "outlined", size: "xs", data: [
|
|
100
|
+
}, searchable: true, children: "Filter" })), renderCustomMenuItems({ position: "left" }), (tableCountOptions === null || tableCountOptions === void 0 ? void 0 : tableCountOptions.recordsTotalEnabled) === true && (_jsx(InfoBadge, { total: totalRecords || data.length })), enableSelection === true &&
|
|
101
|
+
(tableCountOptions === null || tableCountOptions === void 0 ? void 0 : tableCountOptions.selectionTotalEnabled) === true && (_jsx(InfoBadge, { total: getCalculatedSelectionTotal(), hint: "Selected Items", icon: CheckSquareIcon })), children] }), _jsxs(FlexedRow, { children: [renderCustomMenuItems({ position: "right" }), (exportOptions === null || exportOptions === void 0 ? void 0 : exportOptions.enabled) === true && (_jsx(DropDownMenu, { variant: "outlined", size: "xs", data: [
|
|
88
102
|
{
|
|
89
103
|
label: "Export Visible Columns",
|
|
90
104
|
value: TableExportOptions.ExportVisible,
|