@luscii-healthtech/web-ui 2.9.0 → 2.10.2
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/Avatar/Avatar.d.ts +11 -11
- package/dist/components/CenteredHero/CenteredHero.d.ts +1 -1
- package/dist/components/Container/types/FlexContainerProps.type.d.ts +3 -2
- package/dist/components/Datepicker/Datepicker.d.ts +12 -11
- package/dist/components/Dropdown/Dropdown.d.ts +17 -7
- package/dist/components/ErrorBlock/ErrorBlock.d.ts +3 -3
- package/dist/components/Form/form.transformer.d.ts +3 -20
- package/dist/components/Form/form.types.d.ts +5 -5
- package/dist/components/InfoBlock/InfoBlock.d.ts +4 -4
- package/dist/components/Input/SearchInput.d.ts +1 -1
- package/dist/components/Line/Line.d.ts +4 -4
- package/dist/components/Menu/Menu.d.ts +6 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +7 -7
- package/dist/components/Page/CRUDPage.d.ts +13 -13
- package/dist/components/Page/Page.d.ts +13 -13
- package/dist/components/PaginationMenu/PaginationMenu.utils.d.ts +1 -1
- package/dist/components/Radio/Radio.d.ts +5 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +9 -10
- package/dist/components/Select/LegacySelect.d.ts +8 -9
- package/dist/components/Select/SelectV2.d.ts +1 -1
- package/dist/components/Switcher/Switcher.d.ts +6 -6
- package/dist/components/Switcher/SwitcherItem.d.ts +7 -7
- package/dist/components/Text/LegacyText.d.ts +18 -18
- package/dist/components/TextEditor/TextEditor.d.ts +4 -4
- package/dist/components/Textarea/Textarea.d.ts +16 -16
- package/dist/components/Title/LegacyTitle.d.ts +10 -10
- package/dist/web-ui-tailwind.css +8 -0
- package/dist/web-ui.cjs.development.js +81 -74
- 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 +81 -74
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +7 -3
- package/src/assets/add.svg +0 -5
- package/src/assets/add_hover.svg +0 -4
- package/src/assets/arrow-down-icon.svg +0 -3
- package/src/assets/big-menu-icon-hover.svg +0 -6
- package/src/assets/big-menu-icon.svg +0 -6
- package/src/assets/check-cross-icon.svg +0 -7
- package/src/assets/check-icon-primary.svg +0 -5
- package/src/assets/check-icon.svg +0 -3
- package/src/assets/chevron-double.svg +0 -3
- package/src/assets/close.svg +0 -3
- package/src/assets/color-variant-cross.svg +0 -3
- package/src/assets/cross-dark.svg +0 -3
- package/src/assets/delete.svg +0 -4
- package/src/assets/delete_hover.svg +0 -4
- package/src/assets/edit.svg +0 -6
- package/src/assets/edit_hover.svg +0 -6
- package/src/assets/error-icon.svg +0 -7
- package/src/assets/grid-view-icon-active.svg +0 -6
- package/src/assets/grid-view-icon.svg +0 -6
- package/src/assets/groups.svg +0 -3
- package/src/assets/hamburger.svg +0 -5
- package/src/assets/happy-star.svg +0 -9
- package/src/assets/hcps.svg +0 -3
- package/src/assets/indeterminate-icon.svg +0 -3
- package/src/assets/info-icon.svg +0 -6
- package/src/assets/left-arrow-blue.svg +0 -3
- package/src/assets/left-arrow-grey.svg +0 -3
- package/src/assets/list-view-icon-active.svg +0 -3
- package/src/assets/list-view-icon.svg +0 -3
- package/src/assets/loading.svg +0 -16
- package/src/assets/modal-close-icon-active.svg +0 -9
- package/src/assets/modal-close-icon.svg +0 -9
- package/src/assets/no-open-alerts.svg +0 -19
- package/src/assets/patients.svg +0 -3
- package/src/assets/phone-mockup.svg +0 -9
- package/src/assets/programs.svg +0 -3
- package/src/assets/right-arrow-blue.svg +0 -3
- package/src/assets/right-arrow-grey.svg +0 -3
- package/src/assets/search-cancel.svg +0 -3
- package/src/assets/search-not-found.svg +0 -70
- package/src/assets/search.svg +0 -3
- package/src/assets/spinner-gray.svg +0 -6
- package/src/assets/spinner.svg +0 -5
- package/src/assets/starIcon.svg +0 -3
- package/src/assets/success-icon.svg +0 -6
- package/src/components/Accordion/Accordion.tsx +0 -33
- package/src/components/Accordion/AccordionItem.tsx +0 -50
- package/src/components/Avatar/Avatar.js +0 -81
- package/src/components/Avatar/Avatar.scss +0 -153
- package/src/components/Badge/Badge.tsx +0 -23
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +0 -46
- package/src/components/Button/Button.examples.md +0 -46
- package/src/components/Button/Button.tsx +0 -200
- package/src/components/Button/Button.types.ts +0 -41
- package/src/components/Button/ButtonIcon.tsx +0 -42
- package/src/components/ButtonV2/ButtonProps.type.ts +0 -44
- package/src/components/ButtonV2/ButtonV2.tsx +0 -97
- package/src/components/ButtonV2/PrimaryButton.tsx +0 -25
- package/src/components/ButtonV2/SecondaryButton.tsx +0 -26
- package/src/components/ButtonV2/TertiaryButton.tsx +0 -26
- package/src/components/Carousel/Carousel.tsx +0 -52
- package/src/components/Carousel/GliderContainer.scss +0 -13
- package/src/components/Carousel/GliderContainer.tsx +0 -22
- package/src/components/CenteredHero/CenteredHero.tsx +0 -63
- package/src/components/CheckBoxListModal/CheckboxListModal.tsx +0 -180
- package/src/components/Checkbox/Checkbox.scss +0 -125
- package/src/components/Checkbox/Checkbox.tsx +0 -147
- package/src/components/CheckboxList/CheckboxGroup.tsx +0 -120
- package/src/components/CheckboxList/CheckboxList.tsx +0 -46
- package/src/components/CheckboxList/CheckboxList.types.ts +0 -47
- package/src/components/CheckboxList/CheckboxListItem.tsx +0 -54
- package/src/components/ConfirmationDialog/ConfirmationDialog.scss +0 -15
- package/src/components/ConfirmationDialog/ConfirmationDialog.tsx +0 -84
- package/src/components/Container/FlexColumn.tsx +0 -18
- package/src/components/Container/FlexContainer.tsx +0 -46
- package/src/components/Container/FlexRow.tsx +0 -18
- package/src/components/Container/types/FlexContainerProps.type.ts +0 -18
- package/src/components/Datepicker/Datepicker.js +0 -96
- package/src/components/Datepicker/Datepicker.scss +0 -332
- package/src/components/Dropdown/Dropdown.js +0 -416
- package/src/components/Dropdown/Dropdown.scss +0 -83
- package/src/components/EmptyListMessage/EmptyListMessage.tsx +0 -34
- package/src/components/ErrorBlock/ErrorBlock.js +0 -24
- package/src/components/ErrorBlock/ErrorBlock.scss +0 -20
- package/src/components/Form/Form.tsx +0 -138
- package/src/components/Form/FormFieldDecorator.tsx +0 -66
- package/src/components/Form/FormInput.tsx +0 -47
- package/src/components/Form/FormRadioGroup.tsx +0 -23
- package/src/components/Form/FormSelect.tsx +0 -32
- package/src/components/Form/form.transformer.ts +0 -9
- package/src/components/Form/form.types.ts +0 -139
- package/src/components/Icons/AddIcon.tsx +0 -29
- package/src/components/Icons/AlertsIcon.tsx +0 -39
- package/src/components/Icons/BellIcon.tsx +0 -39
- package/src/components/Icons/ChartIcon.tsx +0 -22
- package/src/components/Icons/ChatBoxIcon.tsx +0 -23
- package/src/components/Icons/CheckIcon.tsx +0 -26
- package/src/components/Icons/ChevronDoubleIcon.tsx +0 -25
- package/src/components/Icons/ChevronDownIcon.tsx +0 -20
- package/src/components/Icons/ChevronRightIcon.tsx +0 -20
- package/src/components/Icons/CrossIcon.tsx +0 -24
- package/src/components/Icons/DeleteIcon.tsx +0 -23
- package/src/components/Icons/DownArrowIcon.tsx +0 -23
- package/src/components/Icons/DragIcon.tsx +0 -25
- package/src/components/Icons/DynamicIcon.tsx +0 -25
- package/src/components/Icons/EditIcon.tsx +0 -23
- package/src/components/Icons/EmptyIcon.tsx +0 -29
- package/src/components/Icons/EmptyStateDashboardIcon.tsx +0 -130
- package/src/components/Icons/ExclamationMarkIcon.tsx +0 -23
- package/src/components/Icons/EyeIcon.tsx +0 -23
- package/src/components/Icons/GearIcon.tsx +0 -23
- package/src/components/Icons/GroupIcon.tsx +0 -23
- package/src/components/Icons/HamburgerIcon.tsx +0 -31
- package/src/components/Icons/HeartIcon.tsx +0 -23
- package/src/components/Icons/ImageIcon.tsx +0 -23
- package/src/components/Icons/LeftArrowIcon.tsx +0 -23
- package/src/components/Icons/LightBulbIcon.tsx +0 -31
- package/src/components/Icons/LockIcon.tsx +0 -23
- package/src/components/Icons/MessagesIcon.tsx +0 -23
- package/src/components/Icons/NotesIcon.tsx +0 -23
- package/src/components/Icons/PinIcon.tsx +0 -23
- package/src/components/Icons/PrintIcon.tsx +0 -22
- package/src/components/Icons/RightArrowIcon.tsx +0 -23
- package/src/components/Icons/SearchCancelIcon.tsx +0 -23
- package/src/components/Icons/SearchIcon.tsx +0 -23
- package/src/components/Icons/SmallCircleIcon.tsx +0 -21
- package/src/components/Icons/SmallDiamondIcon.tsx +0 -31
- package/src/components/Icons/SmallSquareIcon.tsx +0 -21
- package/src/components/Icons/SpaceRocketIcon.tsx +0 -23
- package/src/components/Icons/StarIcon.tsx +0 -23
- package/src/components/Icons/WarningIcon.tsx +0 -24
- package/src/components/Icons/types/IconProps.type.ts +0 -5
- package/src/components/InfoBlock/InfoBlock.js +0 -24
- package/src/components/InfoBlock/InfoBlock.scss +0 -20
- package/src/components/InfoField/InfoField.tsx +0 -94
- package/src/components/Input/Input.css +0 -3
- package/src/components/Input/Input.tsx +0 -211
- package/src/components/Input/SearchInput.tsx +0 -24
- package/src/components/Line/Line.js +0 -38
- package/src/components/List/List.scss +0 -23
- package/src/components/List/List.tsx +0 -138
- package/src/components/List/List.types.ts +0 -41
- package/src/components/List/ListItem.tsx +0 -89
- package/src/components/List/ListItemSkeleton.tsx +0 -26
- package/src/components/List/ListSkeleton.scss +0 -5
- package/src/components/List/ListSkeleton.tsx +0 -30
- package/src/components/LoadingIndicator/LoadingIndicator.scss +0 -50
- package/src/components/LoadingIndicator/LoadingIndicator.tsx +0 -46
- package/src/components/Menu/Menu.js +0 -74
- package/src/components/Menu/Menu.scss +0 -27
- package/src/components/Modal/Modal.scss +0 -117
- package/src/components/Modal/Modal.tsx +0 -104
- package/src/components/Modal/ModalWithButtons.tsx +0 -34
- package/src/components/MultiSelect/MultiSelect.js +0 -117
- package/src/components/MultiSelect/MultiSelect.scss +0 -29
- package/src/components/MultiSelect/MultiSelectUtils.js +0 -23
- package/src/components/NavMenu/NavLayout.tsx +0 -40
- package/src/components/NavMenu/NavMenu.tsx +0 -39
- package/src/components/NavMenu/NavMenu.utils.ts +0 -6
- package/src/components/NavMenu/NavMenuContent.tsx +0 -23
- package/src/components/NavMenu/NavMenuItem.tsx +0 -102
- package/src/components/NotificationBanner/NotificationBanner.tsx +0 -104
- package/src/components/Page/CRUDPage.js +0 -123
- package/src/components/Page/CRUDPage.scss +0 -32
- package/src/components/Page/Page.js +0 -102
- package/src/components/Page/Page.scss +0 -59
- package/src/components/PageHeader/PageHeader.tsx +0 -51
- package/src/components/PaginationMenu/PaginationMenu.tsx +0 -47
- package/src/components/PaginationMenu/PaginationMenu.types.ts +0 -46
- package/src/components/PaginationMenu/PaginationMenu.utils.ts +0 -49
- package/src/components/PaginationMenu/PaginationMenuLarge.tsx +0 -96
- package/src/components/PaginationMenu/PaginationMenuSmall.tsx +0 -43
- package/src/components/PreviewPhone/PreviewPhone.tsx +0 -52
- package/src/components/PreviewPhone/useWindowDimensions.js +0 -26
- package/src/components/Radio/Radio.js +0 -102
- package/src/components/Radio/Radio.scss +0 -58
- package/src/components/Radio/RadioV2.css +0 -15
- package/src/components/Radio/RadioV2.tsx +0 -87
- package/src/components/RadioGroup/RadioGroup.js +0 -66
- package/src/components/RadioGroup/RadioGroup.scss +0 -37
- package/src/components/RadioGroup/RadioGroupV2.tsx +0 -35
- package/src/components/Section/Section.scss +0 -74
- package/src/components/Section/Section.tsx +0 -68
- package/src/components/Section/SectionItem.scss +0 -20
- package/src/components/Section/SectionItem.tsx +0 -26
- package/src/components/Section/SectionItemWithContent.tsx +0 -30
- package/src/components/Select/LegacySelect.js +0 -114
- package/src/components/Select/Select.scss +0 -29
- package/src/components/Select/Select.tsx +0 -151
- package/src/components/Select/SelectV2.tsx +0 -171
- package/src/components/Select/options.transformer.ts +0 -36
- package/src/components/Select/select.utils.spec.ts +0 -63
- package/src/components/Select/select.utils.ts +0 -45
- package/src/components/SettingsMenuButton/SettingsMenuButton.tsx +0 -111
- package/src/components/Spinner/Spinner.tsx +0 -23
- package/src/components/Steps/Step.tsx +0 -31
- package/src/components/Steps/Steps.tsx +0 -24
- package/src/components/Switcher/Switcher.js +0 -58
- package/src/components/Switcher/SwitcherItem.js +0 -61
- package/src/components/Switcher/SwitcherItem.scss +0 -67
- package/src/components/TabLinks/TabLinks.tsx +0 -63
- package/src/components/Tabbar/Tabbar.tsx +0 -60
- package/src/components/Tabbar/TabbarItem.tsx +0 -66
- package/src/components/Table/Table.tsx +0 -91
- package/src/components/Table/Table.types.ts +0 -28
- package/src/components/Table/Table.utils.ts +0 -23
- package/src/components/Table/TableBody.tsx +0 -57
- package/src/components/Table/TableBodyRow.tsx +0 -47
- package/src/components/Table/TableBodyRowDataCell.tsx +0 -76
- package/src/components/Table/TableFooter.tsx +0 -21
- package/src/components/Table/TableHeader.tsx +0 -28
- package/src/components/Tag/Tag.tsx +0 -58
- package/src/components/Tag/Tag.utils.ts +0 -4
- package/src/components/Tag/TagGroup.tsx +0 -29
- package/src/components/Text/LegacyText.js +0 -78
- package/src/components/Text/Text.scss +0 -67
- package/src/components/Text/Text.tsx +0 -131
- package/src/components/TextEditor/TextEditor.js +0 -61
- package/src/components/TextEditor/TextEditor.scss +0 -14
- package/src/components/TextEditorV2/TextEditorV2.js +0 -52
- package/src/components/TextEditorV2/TextEditorV2.scss +0 -110
- package/src/components/TextLink/TextLink.tsx +0 -42
- package/src/components/Textarea/Textarea.js +0 -108
- package/src/components/Textarea/Textarea.scss +0 -56
- package/src/components/Timeline/Timeline.tsx +0 -28
- package/src/components/Timeline/TimelineStep.tsx +0 -36
- package/src/components/Title/LegacyTitle.js +0 -64
- package/src/components/Title/Title.scss +0 -6
- package/src/components/Title/Title.tsx +0 -62
- package/src/components/Toaster/Toaster.scss +0 -57
- package/src/components/Toaster/Toaster.tsx +0 -100
- package/src/components/Toaster/toast-elements-getter.ts +0 -72
- package/src/components/Toaster/toast-progress-animator.ts +0 -53
- package/src/components/Toaster/toast.ts +0 -112
- package/src/components/ViewItem/ViewItem.tsx +0 -85
- package/src/custom.d.ts +0 -4
- package/src/index.tsx +0 -170
- package/src/styles/_colors.scss +0 -59
- package/src/styles/_layout.scss +0 -64
- package/src/styles/_shadows.scss +0 -19
- package/src/styles/_skeleton.scss +0 -63
- package/src/styles/_typography.scss +0 -8
- package/src/styles/_utils.scss +0 -45
- package/src/styles/fonts/avenir/3A0AF8_0_0.eot +0 -0
- package/src/styles/fonts/avenir/3A0AF8_0_0.ttf +0 -0
- package/src/styles/fonts/avenir/3A0AF8_0_0.woff +0 -0
- package/src/styles/fonts/avenir/3A0AF8_0_0.woff2 +0 -0
- package/src/styles/fonts/avenir/3A0AF8_1_0.eot +0 -0
- package/src/styles/fonts/avenir/3A0AF8_1_0.ttf +0 -0
- package/src/styles/fonts/avenir/3A0AF8_1_0.woff +0 -0
- package/src/styles/fonts/avenir/3A0AF8_1_0.woff2 +0 -0
- package/src/types/general.types.ts +0 -11
- package/src/utils/useOutsideClick.js +0 -19
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from "react";
|
|
2
|
-
import classNames from "classnames";
|
|
3
|
-
import dragula from "react-dragula";
|
|
4
|
-
|
|
5
|
-
import { Title } from "../Title/Title";
|
|
6
|
-
import Text from "../Text/Text";
|
|
7
|
-
|
|
8
|
-
import { ListItem } from "./ListItem";
|
|
9
|
-
import {
|
|
10
|
-
ListProps,
|
|
11
|
-
ListItemProps,
|
|
12
|
-
OnAssetLoadErrorPayload,
|
|
13
|
-
} from "./List.types";
|
|
14
|
-
import { ListSkeleton } from "./ListSkeleton";
|
|
15
|
-
|
|
16
|
-
import "./List.scss";
|
|
17
|
-
|
|
18
|
-
export { ListProps, ListItemProps, OnAssetLoadErrorPayload };
|
|
19
|
-
|
|
20
|
-
export const List = ({
|
|
21
|
-
title,
|
|
22
|
-
headerButton,
|
|
23
|
-
headerTransparent,
|
|
24
|
-
items,
|
|
25
|
-
onAssetLoadError,
|
|
26
|
-
onDragEnd,
|
|
27
|
-
emptyStateMessage,
|
|
28
|
-
isLoading,
|
|
29
|
-
}: ListProps): JSX.Element => {
|
|
30
|
-
const listRef = useRef<HTMLUListElement | null>(null);
|
|
31
|
-
const dragulaRef = useRef<dragula.Drake | null>(null);
|
|
32
|
-
const hasHeader = !!(title || headerButton);
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
dragulaRef.current?.destroy?.();
|
|
36
|
-
if (listRef.current && onDragEnd && items.length) {
|
|
37
|
-
dragulaRef.current = setupDragging();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return () => {
|
|
41
|
-
dragulaRef.current?.destroy?.();
|
|
42
|
-
};
|
|
43
|
-
}, [items, listRef]);
|
|
44
|
-
|
|
45
|
-
const handleDragEnd = (element: HTMLElement) => {
|
|
46
|
-
const draggedItemId = element.dataset["id"];
|
|
47
|
-
|
|
48
|
-
if (listRef.current && draggedItemId) {
|
|
49
|
-
const itemIdsWithOldOrder = items.map((item) => item.itemId.toString());
|
|
50
|
-
const itemIdsWithNewOrder = Array.from(listRef.current.children)
|
|
51
|
-
.map((child) => (child as HTMLElement).dataset["id"])
|
|
52
|
-
.filter((itemId): itemId is string => !!itemId);
|
|
53
|
-
|
|
54
|
-
const oldIndexOfDraggedItemId =
|
|
55
|
-
itemIdsWithOldOrder.indexOf(draggedItemId);
|
|
56
|
-
const newIndexOfDraggedItemId =
|
|
57
|
-
itemIdsWithNewOrder.indexOf(draggedItemId);
|
|
58
|
-
|
|
59
|
-
if (oldIndexOfDraggedItemId !== newIndexOfDraggedItemId) {
|
|
60
|
-
onDragEnd?.(draggedItemId, newIndexOfDraggedItemId);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const setupDragging = (): dragula.Drake | null => {
|
|
66
|
-
if (!listRef.current) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
const dragulaInstance = dragula([listRef.current], {
|
|
70
|
-
revertOnSpill: true,
|
|
71
|
-
});
|
|
72
|
-
dragulaInstance.on("dragend", handleDragEnd as (Element) => void);
|
|
73
|
-
|
|
74
|
-
return dragulaInstance;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const roundTop = !hasHeader || (hasHeader && headerTransparent);
|
|
78
|
-
|
|
79
|
-
if (isLoading) {
|
|
80
|
-
return <ListSkeleton items={items.length} />;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<div data-test-id="list-component">
|
|
85
|
-
{(title || headerButton) && (
|
|
86
|
-
<div
|
|
87
|
-
data-test-id="list-header"
|
|
88
|
-
className={classNames(
|
|
89
|
-
"flex rounded-t flex-row items-center space-x-4",
|
|
90
|
-
{
|
|
91
|
-
"py-4": !headerButton,
|
|
92
|
-
"py-2": headerButton,
|
|
93
|
-
"bg-white border-b border-slate-100 px-4": !headerTransparent,
|
|
94
|
-
"mb-px": headerTransparent,
|
|
95
|
-
"justify-between": title && headerButton,
|
|
96
|
-
"justify-start": title && !headerButton,
|
|
97
|
-
"justify-end": !title && headerButton,
|
|
98
|
-
}
|
|
99
|
-
)}
|
|
100
|
-
>
|
|
101
|
-
{title && <Title type="xs" text={title} />}
|
|
102
|
-
{!!headerButton && (
|
|
103
|
-
<div className="space-x-3">
|
|
104
|
-
{React.createElement(
|
|
105
|
-
headerButton.buttonType,
|
|
106
|
-
headerButton.buttonProps
|
|
107
|
-
)}
|
|
108
|
-
</div>
|
|
109
|
-
)}
|
|
110
|
-
</div>
|
|
111
|
-
)}
|
|
112
|
-
|
|
113
|
-
<ul ref={listRef}>
|
|
114
|
-
{items.map((item) => (
|
|
115
|
-
<ListItem
|
|
116
|
-
{...item}
|
|
117
|
-
roundTop={roundTop}
|
|
118
|
-
key={item.itemId}
|
|
119
|
-
onAssetLoadError={onAssetLoadError}
|
|
120
|
-
isDraggable={!!onDragEnd}
|
|
121
|
-
/>
|
|
122
|
-
))}
|
|
123
|
-
</ul>
|
|
124
|
-
|
|
125
|
-
{items.length === 0 && emptyStateMessage && (
|
|
126
|
-
<div
|
|
127
|
-
className={classNames("p-4 bg-white rounded-b", {
|
|
128
|
-
"first:rounded-t": roundTop,
|
|
129
|
-
})}
|
|
130
|
-
>
|
|
131
|
-
<Text text={emptyStateMessage} />
|
|
132
|
-
</div>
|
|
133
|
-
)}
|
|
134
|
-
</div>
|
|
135
|
-
);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
export default List;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { ButtonDefinition } from "../ButtonV2/ButtonProps.type";
|
|
4
|
-
import { IconProps } from "../Icons/types/IconProps.type";
|
|
5
|
-
import { PrimaryButtonProps } from "../../index";
|
|
6
|
-
|
|
7
|
-
export interface ListItemProps {
|
|
8
|
-
itemId: string | number;
|
|
9
|
-
title: string;
|
|
10
|
-
subtitle?: string;
|
|
11
|
-
icon?: React.FunctionComponent<IconProps> | string;
|
|
12
|
-
accessories?: JSX.Element[];
|
|
13
|
-
handleItemClick?: () => void;
|
|
14
|
-
onAssetLoadError?: (payload: OnAssetLoadErrorPayload) => void;
|
|
15
|
-
tooltipId?: string;
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* If the parent list component can have a header,
|
|
19
|
-
* the list items don't need to add a border radius on top of the first item.
|
|
20
|
-
*
|
|
21
|
-
* The header is an optional <li> on top that contains the title and accessories (buttons)
|
|
22
|
-
*/
|
|
23
|
-
roundTop?: boolean;
|
|
24
|
-
isDraggable?: boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type OnAssetLoadErrorPayload = Pick<
|
|
28
|
-
ListItemProps,
|
|
29
|
-
"itemId" | "subtitle" | "title" | "icon"
|
|
30
|
-
>;
|
|
31
|
-
|
|
32
|
-
export type ListProps = {
|
|
33
|
-
title?: string;
|
|
34
|
-
headerButton?: ButtonDefinition<PrimaryButtonProps>;
|
|
35
|
-
headerTransparent?: boolean;
|
|
36
|
-
items: ListItemProps[];
|
|
37
|
-
onAssetLoadError?: (payload: OnAssetLoadErrorPayload) => void;
|
|
38
|
-
onDragEnd?: (itemId: string | number, newIndex: number) => void;
|
|
39
|
-
emptyStateMessage?: string;
|
|
40
|
-
isLoading?: boolean;
|
|
41
|
-
};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import classNames from "classnames";
|
|
3
|
-
|
|
4
|
-
import Text from "../Text/Text";
|
|
5
|
-
import { DragIcon } from "../Icons/DragIcon";
|
|
6
|
-
import { ImageIcon } from "../Icons/ImageIcon";
|
|
7
|
-
|
|
8
|
-
import { ListItemProps } from "./List.types";
|
|
9
|
-
|
|
10
|
-
export const ListItem = ({
|
|
11
|
-
icon,
|
|
12
|
-
subtitle,
|
|
13
|
-
title,
|
|
14
|
-
accessories,
|
|
15
|
-
tooltipId,
|
|
16
|
-
onAssetLoadError,
|
|
17
|
-
roundTop,
|
|
18
|
-
...restProps
|
|
19
|
-
}: ListItemProps): JSX.Element => {
|
|
20
|
-
const [loadIconError, setLoadIconError] = useState(false);
|
|
21
|
-
|
|
22
|
-
function onListItemIconLoadError() {
|
|
23
|
-
console.error({
|
|
24
|
-
message:
|
|
25
|
-
"Url from icon failed to load, please check the props passed to `ListItem`.",
|
|
26
|
-
icon,
|
|
27
|
-
title,
|
|
28
|
-
subtitle,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
setLoadIconError(true);
|
|
32
|
-
|
|
33
|
-
onAssetLoadError?.({
|
|
34
|
-
title,
|
|
35
|
-
subtitle: subtitle,
|
|
36
|
-
itemId: restProps.itemId,
|
|
37
|
-
icon,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function onListItemIconLoad() {
|
|
42
|
-
setLoadIconError(false);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<li
|
|
47
|
-
className={classNames(
|
|
48
|
-
"flex last:rounded-b flex-row items-center space-x-4 bg-white",
|
|
49
|
-
"p-4 border-b last:border-b-0 border-slate-100",
|
|
50
|
-
{
|
|
51
|
-
"first:rounded-t": roundTop,
|
|
52
|
-
"cursor-pointer": restProps.handleItemClick,
|
|
53
|
-
"hover:bg-blue-50 transition-colors ease-in-out duration-300":
|
|
54
|
-
restProps.handleItemClick,
|
|
55
|
-
}
|
|
56
|
-
)}
|
|
57
|
-
onClick={restProps.handleItemClick}
|
|
58
|
-
data-id={restProps.itemId}
|
|
59
|
-
data-tip={restProps.itemId}
|
|
60
|
-
data-for={tooltipId}
|
|
61
|
-
>
|
|
62
|
-
{restProps.isDraggable && <DragIcon className="text-slate-300" />}
|
|
63
|
-
{/* If the icon is a react component, render it as so */}
|
|
64
|
-
{icon &&
|
|
65
|
-
typeof icon === "function" &&
|
|
66
|
-
React.createElement(icon, { className: "w-6 h-6" })}
|
|
67
|
-
{/* If the icon is a string url, load it in a vanilla img element */}
|
|
68
|
-
{!loadIconError && icon && typeof icon === "string" && (
|
|
69
|
-
<img
|
|
70
|
-
src={icon}
|
|
71
|
-
data-chromatic="ignore"
|
|
72
|
-
alt="list-item-icon"
|
|
73
|
-
className="w-6 h-6 text-sm"
|
|
74
|
-
onLoad={onListItemIconLoad}
|
|
75
|
-
onError={onListItemIconLoadError}
|
|
76
|
-
/>
|
|
77
|
-
)}
|
|
78
|
-
{loadIconError && <ImageIcon className="w-6 h-6 text-slate-300" />}
|
|
79
|
-
<div>
|
|
80
|
-
<Text text={title} />
|
|
81
|
-
{subtitle && <Text text={subtitle} type={"sm"} />}
|
|
82
|
-
</div>
|
|
83
|
-
<div className={"flex-grow"} />
|
|
84
|
-
{accessories}
|
|
85
|
-
</li>
|
|
86
|
-
);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export default ListItem;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
export const ListItemSkeleton = (): JSX.Element => {
|
|
4
|
-
return (
|
|
5
|
-
<div className="flex flex-row items-center p-4">
|
|
6
|
-
<div
|
|
7
|
-
className="skeleton-box is-circle mr-2"
|
|
8
|
-
style={{ width: `${32}px`, height: `${32}px` }}
|
|
9
|
-
/>
|
|
10
|
-
<div className="flex flex-col">
|
|
11
|
-
<div
|
|
12
|
-
className="skeleton-box mb-1"
|
|
13
|
-
style={{ width: `${160}px`, height: `${14}px` }}
|
|
14
|
-
/>
|
|
15
|
-
<div
|
|
16
|
-
className="skeleton-box"
|
|
17
|
-
style={{ width: `${110}px`, height: `${14}px` }}
|
|
18
|
-
/>
|
|
19
|
-
</div>
|
|
20
|
-
<div
|
|
21
|
-
className="skeleton-box is-button ml-auto rounded-full"
|
|
22
|
-
style={{ width: `${24}px`, height: `${24}px` }}
|
|
23
|
-
/>
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import "./ListSkeleton.scss";
|
|
4
|
-
import { ListItemSkeleton } from "./ListItemSkeleton";
|
|
5
|
-
|
|
6
|
-
type ListSkeletonProps = {
|
|
7
|
-
items: number;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const ListSkeleton = ({ items }: ListSkeletonProps): JSX.Element => {
|
|
11
|
-
const skeletonItems = Array.from({ length: items || 5 }, (_, i) => {
|
|
12
|
-
return <ListItemSkeleton key={i} />;
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<div className="flex flex-col divide-y divide-slate-200 bg-white border-slate-50 border rounded-lg shadow list-skeleton">
|
|
17
|
-
<div className="flex flex-row items-center px-4 py-2">
|
|
18
|
-
<div
|
|
19
|
-
className="skeleton-box"
|
|
20
|
-
style={{ width: `${160}px`, height: `${14}px` }}
|
|
21
|
-
/>
|
|
22
|
-
<div
|
|
23
|
-
className="skeleton-box is-button ml-auto"
|
|
24
|
-
style={{ width: `${110}px`, height: `${44}px` }}
|
|
25
|
-
/>
|
|
26
|
-
</div>
|
|
27
|
-
{skeletonItems}
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
@import "../../styles/colors";
|
|
2
|
-
|
|
3
|
-
.cweb-loading {
|
|
4
|
-
display: flex;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
align-items: center;
|
|
7
|
-
|
|
8
|
-
.cweb-loading-text {
|
|
9
|
-
margin-bottom: 24px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
&.as-modal {
|
|
13
|
-
$border-radius: 4px;
|
|
14
|
-
|
|
15
|
-
position: fixed;
|
|
16
|
-
left: 0;
|
|
17
|
-
right: 0;
|
|
18
|
-
top: 0;
|
|
19
|
-
bottom: 0;
|
|
20
|
-
z-index: 9999;
|
|
21
|
-
background-color: rgba($color-white, 0.6);
|
|
22
|
-
|
|
23
|
-
.cweb-loading-panel {
|
|
24
|
-
position: relative;
|
|
25
|
-
width: 320px;
|
|
26
|
-
min-height: 120px;
|
|
27
|
-
border-radius: $border-radius;
|
|
28
|
-
padding: 16px;
|
|
29
|
-
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.36);
|
|
30
|
-
background-color: #ffffff;
|
|
31
|
-
display: flex;
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
justify-content: flex-start;
|
|
34
|
-
align-items: center;
|
|
35
|
-
|
|
36
|
-
&:before {
|
|
37
|
-
position: absolute;
|
|
38
|
-
content: "";
|
|
39
|
-
top: 0;
|
|
40
|
-
left: 0;
|
|
41
|
-
right: 0;
|
|
42
|
-
z-index: 1;
|
|
43
|
-
height: 3px;
|
|
44
|
-
background-color: $color-branding-support-1;
|
|
45
|
-
border-top-left-radius: $border-radius;
|
|
46
|
-
border-top-right-radius: $border-radius;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import classNames from "classnames";
|
|
3
|
-
|
|
4
|
-
import loadingImage from "../../assets/loading.svg";
|
|
5
|
-
import spinner from "../../assets/spinner.svg";
|
|
6
|
-
import graySpinner from "../../assets/spinner-gray.svg";
|
|
7
|
-
import { RestPropped } from "../../types/general.types";
|
|
8
|
-
|
|
9
|
-
import "./LoadingIndicator.scss";
|
|
10
|
-
|
|
11
|
-
export interface LoadingIndicatorProps extends RestPropped {
|
|
12
|
-
asModal?: boolean;
|
|
13
|
-
asSpinner?: boolean;
|
|
14
|
-
className?: string;
|
|
15
|
-
spinnerColor?: "blue" | "gray";
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function LoadingIndicator({
|
|
19
|
-
asModal = false,
|
|
20
|
-
asSpinner = false,
|
|
21
|
-
className = "",
|
|
22
|
-
spinnerColor = "blue",
|
|
23
|
-
|
|
24
|
-
...restProps
|
|
25
|
-
}: LoadingIndicatorProps): JSX.Element {
|
|
26
|
-
const spinnerToRender = spinnerColor === "blue" ? spinner : graySpinner;
|
|
27
|
-
|
|
28
|
-
const containerClassName = classNames("cweb-loading", className, {
|
|
29
|
-
"as-modal": asModal,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<div {...restProps} className={containerClassName}>
|
|
34
|
-
<img
|
|
35
|
-
src={asSpinner ? spinnerToRender : loadingImage}
|
|
36
|
-
data-chromatic="ignore"
|
|
37
|
-
className={classNames("text-gray-600 fill-current stroke-current", {
|
|
38
|
-
"h-4 w-4": asSpinner,
|
|
39
|
-
"h-12 w-12": !asSpinner,
|
|
40
|
-
})}
|
|
41
|
-
/>
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export default LoadingIndicator;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import React, { PureComponent } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import classNames from "classnames";
|
|
4
|
-
|
|
5
|
-
import Button from "../Button/Button";
|
|
6
|
-
|
|
7
|
-
import "./Menu.scss";
|
|
8
|
-
|
|
9
|
-
class Menu extends PureComponent {
|
|
10
|
-
static propTypes = {
|
|
11
|
-
children: PropTypes.node.isRequired,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
constructor(props) {
|
|
15
|
-
super(props);
|
|
16
|
-
|
|
17
|
-
this.state = {
|
|
18
|
-
isOpen: false,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
componentDidMount() {
|
|
23
|
-
document.addEventListener("mousedown", this.handleClickOutside);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
componentWillUnmount() {
|
|
27
|
-
document.removeEventListener("mousedown", this.handleClickOutside);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
handleClickOutside = (event) => {
|
|
31
|
-
if (this.rootRef && !this.rootRef.contains(event.target)) {
|
|
32
|
-
this.closeMenu();
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
handleIconClick = (event) => {
|
|
37
|
-
event.preventDefault();
|
|
38
|
-
event.stopPropagation();
|
|
39
|
-
this.openMenu();
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
openMenu = () => {
|
|
43
|
-
this.setState({
|
|
44
|
-
isOpen: true,
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
closeMenu = () => {
|
|
49
|
-
this.setState({
|
|
50
|
-
isOpen: false,
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
render() {
|
|
55
|
-
const { children, className } = this.props;
|
|
56
|
-
const { isOpen } = this.state;
|
|
57
|
-
|
|
58
|
-
const containerClassName = classNames("cweb-menu", className, {
|
|
59
|
-
"is-open": isOpen,
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<div className={containerClassName} ref={(element) => (this.rootRef = element)}>
|
|
64
|
-
{isOpen ? (
|
|
65
|
-
<div className="p-6 border shadow-md cweb-menu-content border-slate-300">{children}</div>
|
|
66
|
-
) : (
|
|
67
|
-
<Button role="tertiary" onClick={this.handleIconClick} className="chart-button" />
|
|
68
|
-
)}
|
|
69
|
-
</div>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export default Menu;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
@import "../../styles/colors";
|
|
2
|
-
@import "../../styles/layout";
|
|
3
|
-
|
|
4
|
-
.cweb-menu {
|
|
5
|
-
> .cweb-menu-content {
|
|
6
|
-
min-width: 300px;
|
|
7
|
-
border-radius: 4px;
|
|
8
|
-
background-color: $color-white;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
> .cweb-menu-button {
|
|
12
|
-
@include flexbox-layout();
|
|
13
|
-
|
|
14
|
-
width: 44px;
|
|
15
|
-
height: 44px;
|
|
16
|
-
background: url("../../assets/big-menu-icon.svg") no-repeat center;
|
|
17
|
-
transition: 0.2s ease;
|
|
18
|
-
background-size: contain;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
> .cweb-menu-button:hover {
|
|
22
|
-
width: 44px;
|
|
23
|
-
height: 44px;
|
|
24
|
-
background: url("../../assets/big-menu-icon-hover.svg") no-repeat center;
|
|
25
|
-
transition: 0.2s ease;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
@import "../../styles/colors";
|
|
2
|
-
@import "../../styles/layout";
|
|
3
|
-
@import "../../styles/utils";
|
|
4
|
-
@import "../../styles/shadows";
|
|
5
|
-
|
|
6
|
-
.cweb-modal-overlay {
|
|
7
|
-
$modal-horizontal-distance: 8px;
|
|
8
|
-
$modal-vertical-distance: 60px;
|
|
9
|
-
|
|
10
|
-
position: fixed;
|
|
11
|
-
left: 0;
|
|
12
|
-
top: 0;
|
|
13
|
-
bottom: 0;
|
|
14
|
-
right: 0;
|
|
15
|
-
overflow-x: hidden;
|
|
16
|
-
overflow-y: auto;
|
|
17
|
-
padding: $modal-vertical-distance $modal-horizontal-distance;
|
|
18
|
-
background-color: rgba(0, 0, 0, 0.25);
|
|
19
|
-
z-index: 20;
|
|
20
|
-
|
|
21
|
-
&.no-title-bar {
|
|
22
|
-
background-color: rgba(0, 0, 0, 0.75);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
> .cweb-modal {
|
|
26
|
-
@include box-shadow-2dp();
|
|
27
|
-
position: relative;
|
|
28
|
-
margin: 0 auto;
|
|
29
|
-
background: white;
|
|
30
|
-
outline: none;
|
|
31
|
-
border-radius: 8px;
|
|
32
|
-
|
|
33
|
-
&.type-default {
|
|
34
|
-
max-width: 580px;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&.type-extra-small {
|
|
38
|
-
max-width: 444px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&.type-wide {
|
|
42
|
-
max-width: 748px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&.type-wider {
|
|
46
|
-
max-width: 868px;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
&.has-padded-body {
|
|
50
|
-
.cweb-modal-content {
|
|
51
|
-
padding: 1.5rem;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.cweb-modal-no-title-section {
|
|
56
|
-
height: 0;
|
|
57
|
-
width: 100%;
|
|
58
|
-
position: relative;
|
|
59
|
-
|
|
60
|
-
> .cweb-modal-close-button {
|
|
61
|
-
position: absolute;
|
|
62
|
-
top: 16px;
|
|
63
|
-
right: 24px;
|
|
64
|
-
|
|
65
|
-
width: 44px;
|
|
66
|
-
height: 44px;
|
|
67
|
-
background: url("../../assets/modal-close-icon.svg") no-repeat center;
|
|
68
|
-
background-size: contain;
|
|
69
|
-
|
|
70
|
-
&:hover,
|
|
71
|
-
&:active,
|
|
72
|
-
&:focus {
|
|
73
|
-
background: url("../../assets/modal-close-icon-active.svg") no-repeat center;
|
|
74
|
-
background-size: contain;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.cweb-modal-title-section {
|
|
80
|
-
display: flex;
|
|
81
|
-
flex-direction: row;
|
|
82
|
-
align-items: center;
|
|
83
|
-
border-bottom: 1px solid $color-chrome;
|
|
84
|
-
padding: 24px;
|
|
85
|
-
|
|
86
|
-
> .cweb-modal-title {
|
|
87
|
-
width: 100%;
|
|
88
|
-
|
|
89
|
-
justify-content: flex-start;
|
|
90
|
-
color: $color-secondary;
|
|
91
|
-
font-weight: normal;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
> .cweb-modal-close-button {
|
|
95
|
-
transition: opacity 0.3s ease-in-out;
|
|
96
|
-
outline: none;
|
|
97
|
-
width: 2rem;
|
|
98
|
-
height: 2rem;
|
|
99
|
-
background: url("../../assets/cross-dark.svg") no-repeat center;
|
|
100
|
-
background-size: contain;
|
|
101
|
-
|
|
102
|
-
opacity: 0.75;
|
|
103
|
-
|
|
104
|
-
&:hover,
|
|
105
|
-
&:active,
|
|
106
|
-
&:focus {
|
|
107
|
-
opacity: 1;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
> .cweb-modal-content {
|
|
112
|
-
margin: 24px;
|
|
113
|
-
overflow-y: auto;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|