@symply.io/basic-components 1.7.0 → 1.7.1-alpha.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.
@@ -21,13 +21,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
21
21
|
return t;
|
22
22
|
};
|
23
23
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
24
|
+
import Grid from "@mui/material/Grid";
|
24
25
|
import Select from "@mui/material/Select";
|
25
26
|
import Tooltip from "@mui/material/Tooltip";
|
26
27
|
import Checkbox from "@mui/material/Checkbox";
|
27
28
|
import MenuItem from "@mui/material/MenuItem";
|
29
|
+
import IconButton from "@mui/material/IconButton";
|
28
30
|
import InputLabel from "@mui/material/InputLabel";
|
29
31
|
import FormControl from "@mui/material/FormControl";
|
30
|
-
import ListItemText from "@mui/material/ListItemText";
|
31
32
|
import FormHelperText from "@mui/material/FormHelperText";
|
32
33
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
33
34
|
import useInteractions from "./useInteractions";
|
@@ -55,8 +56,11 @@ function MultipleSelector(props) {
|
|
55
56
|
.join("; ");
|
56
57
|
}
|
57
58
|
: undefined }, { children: (options === null || options === void 0 ? void 0 : options.length) > 0 ? (options.map(function (option) {
|
58
|
-
var label = option.label, v = option.value;
|
59
|
-
return (_jsxs(MenuItem, __assign({ value: v }, { children: [showCheckmarks ? (_jsx(Checkbox, { checked: !!value.includes(v) })) : (_jsx(_Fragment, {})), _jsx(
|
59
|
+
var label = option.label, v = option.value, endIcon = option.endIcon, onEndIconClick = option.onEndIconClick;
|
60
|
+
return (_jsxs(MenuItem, __assign({ value: v }, { children: [showCheckmarks ? (_jsx(Checkbox, { checked: !!value.includes(v) })) : (_jsx(_Fragment, {})), _jsxs(Grid, __assign({ container: true, justifyContent: "space-between", direction: "row", columnSpacing: 0.5, alignItems: "center" }, { children: [_jsx(Grid, __assign({ item: true }, { children: label })), endIcon ? (_jsx(Grid, __assign({ item: true }, { children: onEndIconClick ? (_jsx(IconButton, __assign({ size: "small", onClick: function (ev) {
|
61
|
+
ev.stopPropagation();
|
62
|
+
onEndIconClick(ev);
|
63
|
+
} }, { children: endIcon }))) : (endIcon) }))) : (_jsx(_Fragment, {}))] }))] }), v));
|
60
64
|
})) : (_jsx(MenuItem, __assign({ value: "", disabled: true }, { children: "No Options" }))) })), !!helperText && showHelperText && (_jsx(FormHelperText, { children: showHelperText }))] })) })) })));
|
61
65
|
}
|
62
66
|
export default MultipleSelector;
|
@@ -20,10 +20,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
20
20
|
}
|
21
21
|
return t;
|
22
22
|
};
|
23
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
23
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
24
|
+
import Grid from "@mui/material/Grid";
|
24
25
|
import Select from "@mui/material/Select";
|
25
26
|
import Tooltip from "@mui/material/Tooltip";
|
26
27
|
import MenuItem from "@mui/material/MenuItem";
|
28
|
+
import IconButton from "@mui/material/IconButton";
|
27
29
|
import InputLabel from "@mui/material/InputLabel";
|
28
30
|
import FormControl from "@mui/material/FormControl";
|
29
31
|
import FormHelperText from "@mui/material/FormHelperText";
|
@@ -42,8 +44,11 @@ function SimpleSelector(props) {
|
|
42
44
|
onFocus: onOpenTooltip,
|
43
45
|
onBlur: onCloseTooltip,
|
44
46
|
}, label: label }, { children: (options === null || options === void 0 ? void 0 : options.length) > 0 ? (options.map(function (option) {
|
45
|
-
var label = option.label, v = option.value, disabled = option.disabled;
|
46
|
-
return (_jsx(MenuItem, __assign({ value: v, disabled: disabled }, { children: label }),
|
47
|
+
var label = option.label, v = option.value, disabled = option.disabled, endIcon = option.endIcon, onEndIconClick = option.onEndIconClick;
|
48
|
+
return (_jsx(MenuItem, __assign({ value: v, disabled: disabled }, { children: _jsxs(Grid, __assign({ container: true, justifyContent: "space-between", direction: "row", columnSpacing: 0.5, alignItems: "center" }, { children: [_jsx(Grid, __assign({ item: true }, { children: label })), endIcon ? (_jsx(Grid, __assign({ item: true }, { children: onEndIconClick ? (_jsx(IconButton, __assign({ size: "small", onClick: function (ev) {
|
49
|
+
ev.stopPropagation();
|
50
|
+
onEndIconClick(ev);
|
51
|
+
} }, { children: endIcon }))) : (endIcon) }))) : (_jsx(_Fragment, {}))] })) }), v));
|
47
52
|
})) : (_jsx(MenuItem, __assign({ value: "", disabled: true }, { children: "No Options" }))) })), !!helperText && showHelperText && (_jsx(FormHelperText, { children: showHelperText }))] })) })) })));
|
48
53
|
}
|
49
54
|
export default SimpleSelector;
|
package/FormSelector/types.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ReactNode, CSSProperties } from "react";
|
2
2
|
import { SelectProps } from "@mui/material/Select";
|
3
|
+
import { IconButtonProps } from "@mui/material/IconButton";
|
3
4
|
import { FormControlProps } from "@mui/material/FormControl";
|
4
5
|
interface SelectorBaseProps<T extends string | number> extends Omit<FormControlProps, "onChange"> {
|
5
6
|
label?: string;
|
@@ -14,6 +15,8 @@ interface SelectorBaseProps<T extends string | number> extends Omit<FormControlP
|
|
14
15
|
label: string;
|
15
16
|
value: T;
|
16
17
|
disabled?: boolean;
|
18
|
+
endIcon?: IconButtonProps["children"];
|
19
|
+
onEndIconClick?: IconButtonProps["onClick"];
|
17
20
|
}>;
|
18
21
|
}
|
19
22
|
export interface SimpleSelectorProps<T extends string | number> extends SelectorBaseProps<T> {
|
package/README.md
CHANGED
@@ -42,6 +42,7 @@
|
|
42
42
|
- [TextInput](#textinput)
|
43
43
|
- [ToastPrompt](#toastprompt)
|
44
44
|
- [VideoPlayerModal](#videoplayermodal)
|
45
|
+
- [VirtualDataTable](#virtualdatatable)
|
45
46
|
- [Changelog](#changelog)
|
46
47
|
|
47
48
|
|
@@ -576,11 +577,13 @@ import { MultipleSelector } from '@symply.io/basic-components/FormRadioGroup';
|
|
576
577
|
|
577
578
|
<h5>Selector Option Props</h5>
|
578
579
|
|
579
|
-
| Name
|
580
|
-
|
|
581
|
-
| disabled
|
582
|
-
|
|
583
|
-
|
|
580
|
+
| Name | Type | Default | Required | Description |
|
581
|
+
| -------------- | -------------------------- | ------- | -------- | ------------------------------------------- |
|
582
|
+
| disabled | bool | false | false | If `true`, the opiton would be disabled. |
|
583
|
+
| endIcon | ReactNode | | false | The customized icon. |
|
584
|
+
| label | string | | true | The label of the option. |
|
585
|
+
| value | T extends number \| string | | | The value of the option. |
|
586
|
+
| onEndIconClick | func | | false | Callback fired when the end icon is clicked |
|
584
587
|
|
585
588
|
<h5>Base Props</h5>
|
586
589
|
|
@@ -975,7 +978,7 @@ Reusable data table component with virtualizer
|
|
975
978
|
<h5>Import</h5>
|
976
979
|
|
977
980
|
```tsx
|
978
|
-
import {
|
981
|
+
import { VirtualDataTable } from '@symply.io/basic-components';
|
979
982
|
// or
|
980
983
|
import VirtualDataTable from '@symply.io/basic-components/VirtualDataTable';
|
981
984
|
```
|