@luscii-healthtech/web-ui 2.6.0 → 2.8.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.
- package/dist/components/CenteredHero/CenteredHero.d.ts +11 -21
- package/dist/components/CheckBoxListModal/CheckboxListModal.d.ts +32 -0
- package/dist/index.d.ts +1 -0
- package/dist/web-ui-tailwind.css +14 -11
- package/dist/web-ui.cjs.development.js +183 -47
- package/dist/web-ui.cjs.development.js.map +1 -1
- package/dist/web-ui.cjs.production.min.js +1 -1
- package/dist/web-ui.cjs.production.min.js.map +1 -1
- package/dist/web-ui.esm.js +183 -48
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CenteredHero/CenteredHero.tsx +63 -0
- package/src/components/CheckBoxListModal/CheckboxListModal.tsx +180 -0
- package/src/components/CheckboxList/CheckboxGroup.tsx +0 -1
- package/src/components/CheckboxList/CheckboxListItem.tsx +45 -41
- package/src/components/List/ListItem.tsx +1 -0
- package/src/components/LoadingIndicator/LoadingIndicator.tsx +1 -0
- package/src/components/Radio/RadioV2.tsx +1 -1
- package/src/index.tsx +5 -0
- package/src/components/CenteredHero/CenteredHero.js +0 -50
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export namespace propTypes {
|
|
11
|
-
export const title: PropTypes.Requireable<string>;
|
|
12
|
-
export const text: PropTypes.Requireable<string>;
|
|
13
|
-
export const image: PropTypes.Requireable<string>;
|
|
14
|
-
export const buttons: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
15
|
-
title: PropTypes.Validator<string>;
|
|
16
|
-
handleOnClick: PropTypes.Validator<(...args: any[]) => any>;
|
|
17
|
-
type: PropTypes.Validator<"primary" | "secondary">;
|
|
18
|
-
}> | null | undefined)[]>;
|
|
19
|
-
export const className: PropTypes.Requireable<string>;
|
|
20
|
-
}
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ButtonProps } from "../Button/Button.types";
|
|
3
|
+
export declare type BackgroundColor = "white" | "slate-50";
|
|
4
|
+
export interface CenteredHeroProps {
|
|
5
|
+
title: string;
|
|
6
|
+
text: string;
|
|
7
|
+
image: string;
|
|
8
|
+
buttons: ButtonProps[];
|
|
9
|
+
background?: BackgroundColor;
|
|
21
10
|
}
|
|
22
|
-
|
|
11
|
+
declare const CenteredHero: ({ title, text, image, buttons, background, }: CenteredHeroProps) => JSX.Element;
|
|
12
|
+
export default CenteredHero;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface Item {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
isChecked: boolean;
|
|
6
|
+
group?: string;
|
|
7
|
+
isPinned?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface Group {
|
|
10
|
+
title?: string;
|
|
11
|
+
items: Item[];
|
|
12
|
+
}
|
|
13
|
+
interface CheckboxListModalTexts {
|
|
14
|
+
title: string;
|
|
15
|
+
confirmLabel: string;
|
|
16
|
+
cancelLabel: string;
|
|
17
|
+
searchPlaceHolder?: string;
|
|
18
|
+
emptyState: string;
|
|
19
|
+
}
|
|
20
|
+
export interface CheckboxListModalProps {
|
|
21
|
+
texts: CheckboxListModalTexts;
|
|
22
|
+
initialItems: Array<Item>;
|
|
23
|
+
isLoadingInitialItems?: boolean;
|
|
24
|
+
isOpen: boolean;
|
|
25
|
+
onSave: (newItems: Item[]) => void;
|
|
26
|
+
onCloseClick: () => void;
|
|
27
|
+
filterItem: (item: Item, searchQuery: string) => boolean;
|
|
28
|
+
className?: string;
|
|
29
|
+
hasSearch: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare const CheckboxListModal: ({ texts, initialItems, isLoadingInitialItems, isOpen, onSave, onCloseClick, filterItem, className, hasSearch, }: CheckboxListModalProps) => JSX.Element;
|
|
32
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export { LoadingIndicator, LoadingIndicatorProps, } from "./components/LoadingIn
|
|
|
24
24
|
export { default as Menu } from "./components/Menu/Menu";
|
|
25
25
|
export { List, ListProps, ListItemProps, OnAssetLoadErrorPayload, } from "./components/List/List";
|
|
26
26
|
export { CheckboxList, CheckboxListProps, } from "./components/CheckboxList/CheckboxList";
|
|
27
|
+
export { CheckboxListModal, CheckboxListModalProps, } from "./components/CheckBoxListModal/CheckboxListModal";
|
|
27
28
|
export { MultiSelect } from "./components/MultiSelect/MultiSelect";
|
|
28
29
|
export { NavLayout, NavMenuLayoutProps } from "./components/NavMenu/NavLayout";
|
|
29
30
|
export { NavMenu, NavMenuElement } from "./components/NavMenu/NavMenu";
|
package/dist/web-ui-tailwind.css
CHANGED
|
@@ -1328,11 +1328,6 @@ video {
|
|
|
1328
1328
|
margin-bottom: 1rem;
|
|
1329
1329
|
}
|
|
1330
1330
|
|
|
1331
|
-
.my-6 {
|
|
1332
|
-
margin-top: 1.5rem;
|
|
1333
|
-
margin-bottom: 1.5rem;
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
1331
|
.mx-auto {
|
|
1337
1332
|
margin-left: auto;
|
|
1338
1333
|
margin-right: auto;
|
|
@@ -1382,6 +1377,10 @@ video {
|
|
|
1382
1377
|
margin-left: 0.75rem;
|
|
1383
1378
|
}
|
|
1384
1379
|
|
|
1380
|
+
.mt-4 {
|
|
1381
|
+
margin-top: 1rem;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1385
1384
|
.mr-4 {
|
|
1386
1385
|
margin-right: 1rem;
|
|
1387
1386
|
}
|
|
@@ -1406,10 +1405,6 @@ video {
|
|
|
1406
1405
|
margin-left: 1.5rem;
|
|
1407
1406
|
}
|
|
1408
1407
|
|
|
1409
|
-
.mt-8 {
|
|
1410
|
-
margin-top: 2rem;
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1413
1408
|
.ml-10 {
|
|
1414
1409
|
margin-left: 2.5rem;
|
|
1415
1410
|
}
|
|
@@ -1618,6 +1613,10 @@ video {
|
|
|
1618
1613
|
padding-left: 0.25rem;
|
|
1619
1614
|
}
|
|
1620
1615
|
|
|
1616
|
+
.pr-4 {
|
|
1617
|
+
padding-right: 1rem;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1621
1620
|
.pl-4 {
|
|
1622
1621
|
padding-left: 1rem;
|
|
1623
1622
|
}
|
|
@@ -2054,6 +2053,10 @@ video {
|
|
|
2054
2053
|
width: 6rem;
|
|
2055
2054
|
}
|
|
2056
2055
|
|
|
2056
|
+
.w-36 {
|
|
2057
|
+
width: 9rem;
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2057
2060
|
.w-46 {
|
|
2058
2061
|
width: 11.5rem;
|
|
2059
2062
|
}
|
|
@@ -2066,8 +2069,8 @@ video {
|
|
|
2066
2069
|
width: 26rem;
|
|
2067
2070
|
}
|
|
2068
2071
|
|
|
2069
|
-
.w-
|
|
2070
|
-
width:
|
|
2072
|
+
.w-130 {
|
|
2073
|
+
width: 32.5rem;
|
|
2071
2074
|
}
|
|
2072
2075
|
|
|
2073
2076
|
.w-auto {
|
|
@@ -18,6 +18,7 @@ var ClipboardJS = _interopDefault(require('clipboard'));
|
|
|
18
18
|
var ReactSelect = require('react-select');
|
|
19
19
|
var ReactSelect__default = _interopDefault(ReactSelect);
|
|
20
20
|
var dragula = _interopDefault(require('react-dragula'));
|
|
21
|
+
var groupBy = _interopDefault(require('lodash/groupBy'));
|
|
21
22
|
var debounce = _interopDefault(require('lodash.debounce'));
|
|
22
23
|
var ReactQuill = _interopDefault(require('react-quill'));
|
|
23
24
|
require('react-quill/dist/quill.snow.css');
|
|
@@ -1130,49 +1131,42 @@ Title.defaultProps = {
|
|
|
1130
1131
|
type: "base"
|
|
1131
1132
|
};
|
|
1132
1133
|
|
|
1133
|
-
CenteredHero
|
|
1134
|
-
title: PropTypes.string,
|
|
1135
|
-
text: PropTypes.string,
|
|
1136
|
-
image: PropTypes.string,
|
|
1137
|
-
buttons: /*#__PURE__*/PropTypes.arrayOf( /*#__PURE__*/PropTypes.shape({
|
|
1138
|
-
title: PropTypes.string.isRequired,
|
|
1139
|
-
handleOnClick: PropTypes.func.isRequired,
|
|
1140
|
-
type: /*#__PURE__*/PropTypes.oneOf([BUTTON_ROLES.PRIMARY, BUTTON_ROLES.SECONDARY]).isRequired
|
|
1141
|
-
})),
|
|
1142
|
-
className: PropTypes.string
|
|
1143
|
-
};
|
|
1144
|
-
|
|
1145
|
-
function CenteredHero(_ref) {
|
|
1134
|
+
var CenteredHero = function CenteredHero(_ref) {
|
|
1146
1135
|
var title = _ref.title,
|
|
1147
1136
|
text = _ref.text,
|
|
1148
1137
|
image = _ref.image,
|
|
1149
1138
|
buttons = _ref.buttons,
|
|
1150
|
-
|
|
1139
|
+
_ref$background = _ref.background,
|
|
1140
|
+
background = _ref$background === void 0 ? "slate-50" : _ref$background;
|
|
1151
1141
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
1152
|
-
className: classNames(
|
|
1142
|
+
className: classNames("p-6 flex flex-col items-center align-center w-full", {
|
|
1143
|
+
"bg-white": background === "white",
|
|
1144
|
+
"bg-slate-50": background === "slate-50"
|
|
1145
|
+
})
|
|
1153
1146
|
}, image && /*#__PURE__*/React__default.createElement("img", {
|
|
1154
|
-
src: image
|
|
1147
|
+
src: image,
|
|
1148
|
+
className: "h-36 w-36 mb-4"
|
|
1155
1149
|
}), title && /*#__PURE__*/React__default.createElement(Title, {
|
|
1156
|
-
className: "mt-8 mb-2",
|
|
1157
1150
|
text: title,
|
|
1158
1151
|
type: "base"
|
|
1159
1152
|
}), text && /*#__PURE__*/React__default.createElement(Text, {
|
|
1160
1153
|
text: text
|
|
1161
1154
|
}), (buttons == null ? void 0 : buttons.length) > 0 && /*#__PURE__*/React__default.createElement("div", {
|
|
1162
|
-
className: "flex flex-row mt-
|
|
1155
|
+
className: "flex flex-row mt-4"
|
|
1163
1156
|
}, buttons.filter(function (button) {
|
|
1164
1157
|
return button.title && button.handleOnClick && button.type;
|
|
1165
1158
|
}).map(function (button) {
|
|
1166
1159
|
return /*#__PURE__*/React__default.createElement(Button, {
|
|
1167
1160
|
className: "mr-4 last:mr-0",
|
|
1168
1161
|
key: button.title,
|
|
1169
|
-
role: button.
|
|
1162
|
+
role: button.role,
|
|
1163
|
+
type: button.type,
|
|
1170
1164
|
title: button.title,
|
|
1171
|
-
text: button.
|
|
1165
|
+
text: button.text,
|
|
1172
1166
|
onClick: button.handleOnClick
|
|
1173
1167
|
});
|
|
1174
1168
|
})));
|
|
1175
|
-
}
|
|
1169
|
+
};
|
|
1176
1170
|
|
|
1177
1171
|
var css_248z$5 = ".cweb-checkbox {\n outline: none;\n transition: all 0.3s ease;\n}\n\n.cweb-checkbox .cweb-checkbox-input {\n position: absolute;\n -webkit-appearance: none;\n height: 1px;\n opacity: 0;\n width: 1px;\n}\n\n.cweb-checkbox.type-regular .cweb-checkbox-label {\n display: flex;\n align-items: center;\n margin-bottom: 0;\n}\n\n.cweb-checkbox.type-regular .cweb-checkbox-icon-container {\n width: 16px;\n height: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n border: 1px solid #cccccc;\n border-radius: 4px;\n}\n\n.cweb-checkbox.type-regular.hasError .cweb-checkbox-icon-container {\n border: 1px solid #ff6266;\n}\n\n.cweb-checkbox.type-regular .cweb-checkbox-icon {\n display: block;\n}\n\n.cweb-checkbox.type-regular.is-focused .cweb-checkbox-icon-container {\n border-color: #0074dd;\n}\n\n.cweb-checkbox.type-regular.is-checked .cweb-checkbox-icon {\n width: 0.5rem;\n height: 0.5rem;\n padding: 4px;\n background: url(\"data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 width%3D%2210%22 height%3D%228%22 viewBox%3D%220 0 10 8%22 fill%3D%22none%22%3E %3Cpath d%3D%22M9.207 0.792787C9.39447 0.980314 9.49979 1.23462 9.49979 1.49979C9.49979 1.76495 9.39447 2.01926 9.207 2.20679L4.207 7.20679C4.01947 7.39426 3.76516 7.49957 3.5 7.49957C3.23484 7.49957 2.98053 7.39426 2.793 7.20679L0.793 5.20679C0.610842 5.01818 0.510047 4.76558 0.512326 4.50339C0.514604 4.24119 0.619773 3.99038 0.805181 3.80497C0.990589 3.61956 1.2414 3.51439 1.5036 3.51211C1.7658 3.50983 2.0184 3.61063 2.207 3.79279L3.5 5.08579L7.793 0.792787C7.98053 0.605316 8.23484 0.5 8.5 0.5C8.76516 0.5 9.01947 0.605316 9.207 0.792787Z%22 fill%3D%22white%22%2F%3E%3C%2Fsvg%3E\") no-repeat center;\n background-size: contain;\n}\n\n.cweb-checkbox.type-regular.is-indeterminate .cweb-checkbox-icon {\n width: 0.5rem;\n height: 0.5rem;\n padding: 4px;\n background: url(\"data:image/svg+xml,%3Csvg width%3D%2210%22 height%3D%222%22 viewBox%3D%220 0 10 2%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath d%3D%22M9 -4.37114e-08C9.55228 -1.95703e-08 10 0.447715 10 1C10 1.55228 9.55228 2 9 2L1 2C0.447716 2 -6.78525e-08 1.55228 -4.37114e-08 1C-1.95703e-08 0.447715 0.447715 -4.17544e-07 1 -3.93402e-07L9 -4.37114e-08Z%22 fill%3D%22white%22%2F%3E%3C%2Fsvg%3E\") no-repeat center;\n background-size: contain;\n}\n\n.cweb-checkbox.type-regular.is-disabled.show-cross-when-disabled .cweb-checkbox-icon {\n width: 10px;\n height: 10px;\n background: url(\"data:image/svg+xml,%3Csvg width%3D%2211px%22 height%3D%2211px%22 viewBox%3D%220 0 11 11%22 version%3D%221.1%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cg stroke%3D%22none%22 stroke-width%3D%221%22 fill%3D%22none%22 fill-rule%3D%22evenodd%22 stroke-linecap%3D%22round%22%3E %3Cg transform%3D%22translate(-6.000000%2C -7.000000)%22 stroke%3D%22%232D2D2D%22 stroke-width%3D%222%22%3E %3Cpath d%3D%22M7%2C17 L16%2C8 M16%2C17 L7%2C8%22 %2F%3E %3C%2Fg%3E %3C%2Fg%3E%3C%2Fsvg%3E\") no-repeat center;\n background-size: contain;\n opacity: 0.6;\n}\n\n.cweb-checkbox.type-switch .cweb-checkbox-label {\n display: flex;\n align-items: center;\n margin-bottom: 0;\n width: 56px;\n height: 28px;\n position: relative;\n}\n\n.cweb-checkbox.type-switch .cweb-checkbox-icon-container {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: #d1d5db;\n border-radius: 16px;\n}\n\n.cweb-checkbox.type-switch .cweb-checkbox-icon-container:after {\n position: relative;\n display: block;\n content: \"\";\n height: 20px;\n width: 20px;\n top: 4px;\n left: 4px;\n background-color: white;\n border-radius: 50%;\n transition: all 0.2s ease;\n}\n\n.cweb-checkbox.type-switch.is-checked .cweb-checkbox-icon-container {\n background-color: #6abfa6;\n}\n\n.cweb-checkbox.type-switch.is-checked .cweb-checkbox-icon-container:after {\n left: 32px;\n}\n";
|
|
1178
1172
|
styleInject(css_248z$5);
|
|
@@ -2289,6 +2283,7 @@ function LoadingIndicator(_ref) {
|
|
|
2289
2283
|
className: containerClassName
|
|
2290
2284
|
}), /*#__PURE__*/React__default.createElement("img", {
|
|
2291
2285
|
src: asSpinner ? spinnerToRender : img$e,
|
|
2286
|
+
"data-chromatic": "ignore",
|
|
2292
2287
|
className: classNames("text-gray-600 fill-current stroke-current", {
|
|
2293
2288
|
"h-4 w-4": asSpinner,
|
|
2294
2289
|
"h-12 w-12": !asSpinner
|
|
@@ -2920,6 +2915,7 @@ var ListItem = function ListItem(_ref) {
|
|
|
2920
2915
|
className: "w-6 h-6"
|
|
2921
2916
|
}), !loadIconError && icon && typeof icon === "string" && /*#__PURE__*/React__default.createElement("img", {
|
|
2922
2917
|
src: icon,
|
|
2918
|
+
"data-chromatic": "ignore",
|
|
2923
2919
|
alt: "list-item-icon",
|
|
2924
2920
|
className: "w-6 h-6 text-sm",
|
|
2925
2921
|
onLoad: onListItemIconLoad,
|
|
@@ -3285,7 +3281,7 @@ var CheckboxGroup = function CheckboxGroup(_ref) {
|
|
|
3285
3281
|
type: "strong",
|
|
3286
3282
|
text: groupTitle || "",
|
|
3287
3283
|
className: " ml-4"
|
|
3288
|
-
}), " "
|
|
3284
|
+
}), " "), /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
3289
3285
|
onChange: handleGroupClick,
|
|
3290
3286
|
className: "ml-auto",
|
|
3291
3287
|
isChecked: groupCheckboxState === CheckboxState.CHECKED,
|
|
@@ -3332,6 +3328,170 @@ var CheckboxList = function CheckboxList(_ref) {
|
|
|
3332
3328
|
}));
|
|
3333
3329
|
};
|
|
3334
3330
|
|
|
3331
|
+
var SearchIcon = function SearchIcon(props) {
|
|
3332
|
+
return /*#__PURE__*/React__default.createElement("svg", {
|
|
3333
|
+
className: props.className,
|
|
3334
|
+
onClick: props.onClick,
|
|
3335
|
+
role: props.onClick ? "button" : undefined,
|
|
3336
|
+
width: "24",
|
|
3337
|
+
height: "24",
|
|
3338
|
+
viewBox: "0 0 24 24",
|
|
3339
|
+
fill: "none",
|
|
3340
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
3341
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
3342
|
+
d: "M15.5 13.9996H14.71L14.43 13.7296C15.63 12.3296 16.25 10.4196 15.91 8.38965C15.44 5.60965 13.12 3.38965 10.32 3.04965C6.09001 2.52965 2.53002 6.08965 3.05002 10.3196C3.39002 13.1196 5.61002 15.4396 8.39002 15.9096C10.42 16.2496 12.33 15.6296 13.73 14.4296L14 14.7096V15.4996L18.25 19.7496C18.66 20.1596 19.33 20.1596 19.74 19.7496C20.15 19.3396 20.15 18.6696 19.74 18.2596L15.5 13.9996ZM9.50002 13.9996C7.01002 13.9996 5.00002 11.9896 5.00002 9.49965C5.00002 7.00965 7.01002 4.99965 9.50002 4.99965C11.99 4.99965 14 7.00965 14 9.49965C14 11.9896 11.99 13.9996 9.50002 13.9996Z",
|
|
3343
|
+
fill: "currentColor"
|
|
3344
|
+
}));
|
|
3345
|
+
};
|
|
3346
|
+
|
|
3347
|
+
var SearchInput = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
3348
|
+
return /*#__PURE__*/React__default.createElement(Input, Object.assign({}, props, {
|
|
3349
|
+
icon: SearchIcon,
|
|
3350
|
+
type: "text",
|
|
3351
|
+
clearable: true,
|
|
3352
|
+
ref: ref
|
|
3353
|
+
}));
|
|
3354
|
+
});
|
|
3355
|
+
|
|
3356
|
+
var transformToGroups = function transformToGroups(items) {
|
|
3357
|
+
var pinned = items.find(function (option) {
|
|
3358
|
+
return option.isPinned;
|
|
3359
|
+
});
|
|
3360
|
+
var itemsWithGroup = items.filter(function (option) {
|
|
3361
|
+
return option.group;
|
|
3362
|
+
});
|
|
3363
|
+
var groups = Object.entries(groupBy(itemsWithGroup, "group")).map(function (group) {
|
|
3364
|
+
return {
|
|
3365
|
+
title: group[0],
|
|
3366
|
+
items: group[1].sort(function (a, b) {
|
|
3367
|
+
return a.label > b.label ? 1 : b.label > a.label ? -1 : 0;
|
|
3368
|
+
})
|
|
3369
|
+
};
|
|
3370
|
+
});
|
|
3371
|
+
var itemsWithoutGroup = items.filter(function (option) {
|
|
3372
|
+
return !option.group;
|
|
3373
|
+
});
|
|
3374
|
+
var restGroup = {
|
|
3375
|
+
name: undefined,
|
|
3376
|
+
items: itemsWithoutGroup
|
|
3377
|
+
};
|
|
3378
|
+
|
|
3379
|
+
if (pinned) {
|
|
3380
|
+
var myGroup = {
|
|
3381
|
+
items: [pinned]
|
|
3382
|
+
};
|
|
3383
|
+
return [myGroup].concat(groups, [restGroup]);
|
|
3384
|
+
}
|
|
3385
|
+
|
|
3386
|
+
return [].concat(groups, [restGroup]);
|
|
3387
|
+
};
|
|
3388
|
+
|
|
3389
|
+
var CheckboxListModal = function CheckboxListModal(_ref) {
|
|
3390
|
+
var texts = _ref.texts,
|
|
3391
|
+
initialItems = _ref.initialItems,
|
|
3392
|
+
isLoadingInitialItems = _ref.isLoadingInitialItems,
|
|
3393
|
+
isOpen = _ref.isOpen,
|
|
3394
|
+
onSave = _ref.onSave,
|
|
3395
|
+
onCloseClick = _ref.onCloseClick,
|
|
3396
|
+
_ref$filterItem = _ref.filterItem,
|
|
3397
|
+
filterItem = _ref$filterItem === void 0 ? function () {
|
|
3398
|
+
return true;
|
|
3399
|
+
} : _ref$filterItem,
|
|
3400
|
+
className = _ref.className,
|
|
3401
|
+
_ref$hasSearch = _ref.hasSearch,
|
|
3402
|
+
hasSearch = _ref$hasSearch === void 0 ? false : _ref$hasSearch;
|
|
3403
|
+
var containerClassName = classNames(className);
|
|
3404
|
+
|
|
3405
|
+
var _useState = React.useState([]),
|
|
3406
|
+
items = _useState[0],
|
|
3407
|
+
setItems = _useState[1];
|
|
3408
|
+
|
|
3409
|
+
var _useState2 = React.useState([]),
|
|
3410
|
+
visibleItems = _useState2[0],
|
|
3411
|
+
setVisibleItems = _useState2[1];
|
|
3412
|
+
|
|
3413
|
+
var _useState3 = React.useState([]),
|
|
3414
|
+
groups = _useState3[0],
|
|
3415
|
+
setGroups = _useState3[1];
|
|
3416
|
+
|
|
3417
|
+
var _useState4 = React.useState(""),
|
|
3418
|
+
search = _useState4[0],
|
|
3419
|
+
setSearch = _useState4[1];
|
|
3420
|
+
|
|
3421
|
+
React.useEffect(function () {
|
|
3422
|
+
setItems(initialItems);
|
|
3423
|
+
}, [initialItems]);
|
|
3424
|
+
React.useEffect(function () {
|
|
3425
|
+
setVisibleItems(items.filter(function (item) {
|
|
3426
|
+
return filterItem(item, search);
|
|
3427
|
+
}));
|
|
3428
|
+
}, [items, search]);
|
|
3429
|
+
React.useEffect(function () {
|
|
3430
|
+
setGroups(transformToGroups(visibleItems));
|
|
3431
|
+
}, [visibleItems]);
|
|
3432
|
+
|
|
3433
|
+
var handleOnItemChange = function handleOnItemChange(event) {
|
|
3434
|
+
var updatedItems = [].concat(items);
|
|
3435
|
+
var index = updatedItems.findIndex(function (item) {
|
|
3436
|
+
return item.id === event.id;
|
|
3437
|
+
});
|
|
3438
|
+
updatedItems[index].isChecked = event.newCheckedValue;
|
|
3439
|
+
setItems(updatedItems);
|
|
3440
|
+
};
|
|
3441
|
+
|
|
3442
|
+
var handleOnCloseClick = function handleOnCloseClick(event) {
|
|
3443
|
+
event.stopPropagation();
|
|
3444
|
+
onCloseClick();
|
|
3445
|
+
};
|
|
3446
|
+
|
|
3447
|
+
var handleOnSaveClick = function handleOnSaveClick() {
|
|
3448
|
+
onSave(items.filter(function (item) {
|
|
3449
|
+
return item.isChecked;
|
|
3450
|
+
}));
|
|
3451
|
+
onCloseClick();
|
|
3452
|
+
};
|
|
3453
|
+
|
|
3454
|
+
var handleOnSearchChange = function handleOnSearchChange(event) {
|
|
3455
|
+
var _event$currentTarget$;
|
|
3456
|
+
|
|
3457
|
+
setSearch((_event$currentTarget$ = event.currentTarget.value) != null ? _event$currentTarget$ : "");
|
|
3458
|
+
};
|
|
3459
|
+
|
|
3460
|
+
var closeButton = /*#__PURE__*/React.createElement(SecondaryButton, {
|
|
3461
|
+
text: texts.cancelLabel,
|
|
3462
|
+
onClick: handleOnCloseClick,
|
|
3463
|
+
key: "close-checkbox-list-modal",
|
|
3464
|
+
className: "mr-2"
|
|
3465
|
+
});
|
|
3466
|
+
var saveButton = /*#__PURE__*/React.createElement(PrimaryButton, {
|
|
3467
|
+
text: texts.confirmLabel,
|
|
3468
|
+
onClick: handleOnSaveClick,
|
|
3469
|
+
key: "save-selected-checkbox-list-items"
|
|
3470
|
+
});
|
|
3471
|
+
return /*#__PURE__*/React.createElement(ModalWithButtons, {
|
|
3472
|
+
isOpen: isOpen,
|
|
3473
|
+
title: texts.title,
|
|
3474
|
+
onCloseClick: handleOnCloseClick,
|
|
3475
|
+
withPadding: true,
|
|
3476
|
+
shouldCloseOnOverlayClick: true,
|
|
3477
|
+
className: containerClassName,
|
|
3478
|
+
buttons: [closeButton, saveButton],
|
|
3479
|
+
buttonsAlignment: "justify-end"
|
|
3480
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3481
|
+
className: "max-h-135 overflow-y-auto pr-4"
|
|
3482
|
+
}, isLoadingInitialItems && /*#__PURE__*/React.createElement(LoadingIndicator, null), hasSearch && !isLoadingInitialItems && /*#__PURE__*/React.createElement(SearchInput, {
|
|
3483
|
+
className: "w-130 mb-2",
|
|
3484
|
+
value: search,
|
|
3485
|
+
placeholder: texts.searchPlaceHolder,
|
|
3486
|
+
onChange: handleOnSearchChange
|
|
3487
|
+
}), !isLoadingInitialItems && (items == null ? void 0 : items.length) > 0 && /*#__PURE__*/React.createElement(CheckboxList, {
|
|
3488
|
+
groups: groups,
|
|
3489
|
+
onChange: handleOnItemChange
|
|
3490
|
+
}), !isLoadingInitialItems && (items == null ? void 0 : items.length) === 0 && /*#__PURE__*/React.createElement(Text, {
|
|
3491
|
+
text: texts.emptyState
|
|
3492
|
+
})));
|
|
3493
|
+
};
|
|
3494
|
+
|
|
3335
3495
|
var TEXT_TYPE_OPTIONS = {
|
|
3336
3496
|
DEFAULT: "default",
|
|
3337
3497
|
STRONG: "strong",
|
|
@@ -5301,31 +5461,6 @@ function ViewItem(_ref) {
|
|
|
5301
5461
|
})));
|
|
5302
5462
|
}
|
|
5303
5463
|
|
|
5304
|
-
var SearchIcon = function SearchIcon(props) {
|
|
5305
|
-
return /*#__PURE__*/React__default.createElement("svg", {
|
|
5306
|
-
className: props.className,
|
|
5307
|
-
onClick: props.onClick,
|
|
5308
|
-
role: props.onClick ? "button" : undefined,
|
|
5309
|
-
width: "24",
|
|
5310
|
-
height: "24",
|
|
5311
|
-
viewBox: "0 0 24 24",
|
|
5312
|
-
fill: "none",
|
|
5313
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
5314
|
-
}, /*#__PURE__*/React__default.createElement("path", {
|
|
5315
|
-
d: "M15.5 13.9996H14.71L14.43 13.7296C15.63 12.3296 16.25 10.4196 15.91 8.38965C15.44 5.60965 13.12 3.38965 10.32 3.04965C6.09001 2.52965 2.53002 6.08965 3.05002 10.3196C3.39002 13.1196 5.61002 15.4396 8.39002 15.9096C10.42 16.2496 12.33 15.6296 13.73 14.4296L14 14.7096V15.4996L18.25 19.7496C18.66 20.1596 19.33 20.1596 19.74 19.7496C20.15 19.3396 20.15 18.6696 19.74 18.2596L15.5 13.9996ZM9.50002 13.9996C7.01002 13.9996 5.00002 11.9896 5.00002 9.49965C5.00002 7.00965 7.01002 4.99965 9.50002 4.99965C11.99 4.99965 14 7.00965 14 9.49965C14 11.9896 11.99 13.9996 9.50002 13.9996Z",
|
|
5316
|
-
fill: "currentColor"
|
|
5317
|
-
}));
|
|
5318
|
-
};
|
|
5319
|
-
|
|
5320
|
-
var SearchInput = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
5321
|
-
return /*#__PURE__*/React__default.createElement(Input, Object.assign({}, props, {
|
|
5322
|
-
icon: SearchIcon,
|
|
5323
|
-
type: "text",
|
|
5324
|
-
clearable: true,
|
|
5325
|
-
ref: ref
|
|
5326
|
-
}));
|
|
5327
|
-
});
|
|
5328
|
-
|
|
5329
5464
|
/**
|
|
5330
5465
|
* Decorator for any input component. Adds a label and additional information to be shown.
|
|
5331
5466
|
*
|
|
@@ -6362,6 +6497,7 @@ exports.ChatBoxIcon = ChatBoxIcon;
|
|
|
6362
6497
|
exports.CheckIcon = CheckIcon;
|
|
6363
6498
|
exports.Checkbox = Checkbox;
|
|
6364
6499
|
exports.CheckboxList = CheckboxList;
|
|
6500
|
+
exports.CheckboxListModal = CheckboxListModal;
|
|
6365
6501
|
exports.ChevronDoubleIcon = ChevronDoubleIcon;
|
|
6366
6502
|
exports.ConfirmationDialog = ConfirmationDialog;
|
|
6367
6503
|
exports.CrossIcon = CrossIcon;
|