@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,111 +0,0 @@
|
|
|
1
|
-
import classNames from "classnames";
|
|
2
|
-
import React, { useEffect, useRef, useState } from "react";
|
|
3
|
-
|
|
4
|
-
import useOutsideClick from "../../utils/useOutsideClick";
|
|
5
|
-
import Button from "../Button/Button";
|
|
6
|
-
import Checkbox from "../Checkbox/Checkbox";
|
|
7
|
-
import { IconProps } from "../Icons/types/IconProps.type";
|
|
8
|
-
import Text from "../Text/Text";
|
|
9
|
-
|
|
10
|
-
export interface ConfigurationItem {
|
|
11
|
-
itemId: string;
|
|
12
|
-
itemName: string;
|
|
13
|
-
on: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface SettingsMenuButtonProps {
|
|
17
|
-
configuration: ConfigurationItem[];
|
|
18
|
-
onConfigurationChange: (newConfig: ConfigurationItem) => void;
|
|
19
|
-
shiftMenuTo?: "right" | "right-md" | "left" | "left-md";
|
|
20
|
-
buttonTitle?: string;
|
|
21
|
-
menuTitle?: string;
|
|
22
|
-
iconComponent: React.FunctionComponent<IconProps>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const SettingsMenuButton = (props: SettingsMenuButtonProps): JSX.Element => {
|
|
26
|
-
const {
|
|
27
|
-
configuration: configFromProps = [],
|
|
28
|
-
onConfigurationChange,
|
|
29
|
-
shiftMenuTo,
|
|
30
|
-
buttonTitle,
|
|
31
|
-
iconComponent,
|
|
32
|
-
menuTitle,
|
|
33
|
-
} = props;
|
|
34
|
-
const [innerConfiguration, setInnerConfiguration] = useState(configFromProps);
|
|
35
|
-
const [showMenu, setShowMenu] = useState(false);
|
|
36
|
-
|
|
37
|
-
const menuRef = useRef<HTMLDivElement | null>(null);
|
|
38
|
-
|
|
39
|
-
useOutsideClick(menuRef, () => {
|
|
40
|
-
if (showMenu) {
|
|
41
|
-
setShowMenu(false);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
setInnerConfiguration(configFromProps);
|
|
47
|
-
}, [configFromProps]);
|
|
48
|
-
|
|
49
|
-
const handleShowMenu = () => {
|
|
50
|
-
setShowMenu(true);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const handleOnVibilitySwitchChanged = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
54
|
-
const { id, name, checked } = event.currentTarget;
|
|
55
|
-
|
|
56
|
-
const newConfig = innerConfiguration.find((config) => config.itemId === id && config.itemName === name) as ConfigurationItem;
|
|
57
|
-
|
|
58
|
-
onConfigurationChange({ ...newConfig, on: checked });
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
if (!iconComponent) {
|
|
62
|
-
console.error("A an icon component is required to use this component, please make sure to pass it as a prop. ");
|
|
63
|
-
return <span>Invalid props passed to this component.</span>;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<div onClick={handleShowMenu} className="relative">
|
|
68
|
-
<Button dynamicIcon={iconComponent} onClick={handleShowMenu} text={buttonTitle} role="tertiary" />
|
|
69
|
-
|
|
70
|
-
<div
|
|
71
|
-
ref={menuRef}
|
|
72
|
-
className={classNames(
|
|
73
|
-
"cursor-default transition-all transform duration-300",
|
|
74
|
-
"absolute -top-1 z-30",
|
|
75
|
-
"rounded w-80 max-h-78 overflow-y-auto",
|
|
76
|
-
"bg-white shadow-md",
|
|
77
|
-
"border border-slate-300",
|
|
78
|
-
{
|
|
79
|
-
"-left-54": shiftMenuTo === "left",
|
|
80
|
-
"-right-54": shiftMenuTo === "right",
|
|
81
|
-
"-left-68": shiftMenuTo === "left-md",
|
|
82
|
-
"-right-68": shiftMenuTo === "right-md",
|
|
83
|
-
"transform -translate-x-1/2 left-1/2": !shiftMenuTo, // centering the menu in the Y axis of the button
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"opacity-0 pointer-events-none": !showMenu,
|
|
87
|
-
"opacity-100": showMenu,
|
|
88
|
-
}
|
|
89
|
-
)}
|
|
90
|
-
>
|
|
91
|
-
{menuTitle && (
|
|
92
|
-
<div className="w-full p-3 h-11 bg-slate-50">
|
|
93
|
-
<Text type="sm" className="uppercase" text={menuTitle} />
|
|
94
|
-
</div>
|
|
95
|
-
)}
|
|
96
|
-
{innerConfiguration.map((innerConfig) => (
|
|
97
|
-
<div key={innerConfig.itemId} className="flex items-center justify-between w-full p-3 h-11">
|
|
98
|
-
<Text text={innerConfig.itemName} />
|
|
99
|
-
<Checkbox
|
|
100
|
-
name={innerConfig.itemName}
|
|
101
|
-
id={innerConfig.itemId}
|
|
102
|
-
type="switch"
|
|
103
|
-
isChecked={innerConfig.on}
|
|
104
|
-
onChange={handleOnVibilitySwitchChanged}
|
|
105
|
-
/>
|
|
106
|
-
</div>
|
|
107
|
-
))}
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
);
|
|
111
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
interface SpinnerProps {
|
|
4
|
-
className?: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const Spinner = (props: SpinnerProps): JSX.Element => {
|
|
8
|
-
return (
|
|
9
|
-
<svg
|
|
10
|
-
className={`w-5 h-5 animate-spin ${props.className}`}
|
|
11
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
-
fill="none"
|
|
13
|
-
viewBox="0 0 24 24"
|
|
14
|
-
>
|
|
15
|
-
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
|
|
16
|
-
<path
|
|
17
|
-
className="opacity-75"
|
|
18
|
-
fill="currentColor"
|
|
19
|
-
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
20
|
-
/>
|
|
21
|
-
</svg>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { Text } from "../Text/Text";
|
|
4
|
-
|
|
5
|
-
export interface StepProps {
|
|
6
|
-
title: string;
|
|
7
|
-
stepNumber: number;
|
|
8
|
-
active: boolean;
|
|
9
|
-
localization: { step: string };
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const Step = ({
|
|
13
|
-
title,
|
|
14
|
-
stepNumber,
|
|
15
|
-
active,
|
|
16
|
-
localization,
|
|
17
|
-
}: StepProps): JSX.Element => {
|
|
18
|
-
const barColor = active ? "bg-blue-800" : "bg-slate-200";
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<div className={"w-full"}>
|
|
22
|
-
<div className={`w-full h-1 mb-2 rounded ${barColor}`}></div>
|
|
23
|
-
<Text
|
|
24
|
-
text={`${localization.step} ${stepNumber}`}
|
|
25
|
-
type={"strong"}
|
|
26
|
-
color={active ? "blue-800" : "slate-500"}
|
|
27
|
-
/>
|
|
28
|
-
<Text text={title} type={"strong"} />
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { Step } from "./Step";
|
|
4
|
-
|
|
5
|
-
interface StepsProps {
|
|
6
|
-
orderedStepTitles: Array<string>;
|
|
7
|
-
currentStep: number; //start count from 1
|
|
8
|
-
className?: string;
|
|
9
|
-
localization: {step: string};
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const Steps = ({ orderedStepTitles, currentStep, className, localization }: StepsProps): JSX.Element => {
|
|
13
|
-
const renderedSteps = orderedStepTitles.map((stepTitle, index) => (
|
|
14
|
-
<Step
|
|
15
|
-
key={`step-${index}-${stepTitle.split(" ")[0]}`}
|
|
16
|
-
title={stepTitle}
|
|
17
|
-
stepNumber={index + 1}
|
|
18
|
-
active={index + 1 <= currentStep}
|
|
19
|
-
localization={localization}
|
|
20
|
-
/>
|
|
21
|
-
));
|
|
22
|
-
|
|
23
|
-
return <div className={`flex flex-row justify-items-stretch space-x-6 ${className}`}>{renderedSteps}</div>;
|
|
24
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import classNames from "classnames";
|
|
4
|
-
|
|
5
|
-
import SwitcherItem from "./SwitcherItem";
|
|
6
|
-
|
|
7
|
-
function Switcher({ selectedIndex = -1, onChange, className, itemClassName, items }) {
|
|
8
|
-
const [currentSelection, setCurrentSelection] = useState(selectedIndex);
|
|
9
|
-
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
setCurrentSelection(selectedIndex);
|
|
12
|
-
}, [selectedIndex]);
|
|
13
|
-
|
|
14
|
-
const handleItemSelect = (index) => {
|
|
15
|
-
onChange(index);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<ul
|
|
20
|
-
className={classNames("cweb-switcher", className, "flex list-none p-0 m-0")}
|
|
21
|
-
data-test-id={"switcher-container"}
|
|
22
|
-
>
|
|
23
|
-
{items.map((item, index) => {
|
|
24
|
-
return (
|
|
25
|
-
<SwitcherItem
|
|
26
|
-
key={JSON.stringify(item)}
|
|
27
|
-
name={item.name}
|
|
28
|
-
icon={item.icon}
|
|
29
|
-
index={index}
|
|
30
|
-
isSelected={currentSelection === index}
|
|
31
|
-
onSelect={handleItemSelect}
|
|
32
|
-
className={itemClassName}
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
35
|
-
})}
|
|
36
|
-
</ul>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
Switcher.propTypes = {
|
|
41
|
-
items: PropTypes.arrayOf(
|
|
42
|
-
PropTypes.shape({
|
|
43
|
-
name: PropTypes.string,
|
|
44
|
-
icon: PropTypes.shape({
|
|
45
|
-
default: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
46
|
-
active: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
47
|
-
showBadge: PropTypes.bool,
|
|
48
|
-
}),
|
|
49
|
-
key: PropTypes.string,
|
|
50
|
-
})
|
|
51
|
-
).isRequired,
|
|
52
|
-
onChange: PropTypes.func.isRequired,
|
|
53
|
-
selectedIndex: PropTypes.number,
|
|
54
|
-
className: PropTypes.string,
|
|
55
|
-
itemClassName: PropTypes.string,
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export default Switcher;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import classNames from "classnames";
|
|
4
|
-
|
|
5
|
-
import "./SwitcherItem.scss";
|
|
6
|
-
import { Text } from "../Text/Text";
|
|
7
|
-
|
|
8
|
-
SwitcherItem.propTypes = {
|
|
9
|
-
name: PropTypes.string,
|
|
10
|
-
icon: PropTypes.shape({
|
|
11
|
-
default: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
12
|
-
active: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
13
|
-
showBadge: PropTypes.bool,
|
|
14
|
-
}),
|
|
15
|
-
index: PropTypes.number.isRequired,
|
|
16
|
-
isSelected: PropTypes.bool,
|
|
17
|
-
onSelect: PropTypes.func.isRequired,
|
|
18
|
-
className: PropTypes.string,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
function SwitcherItem({ className, icon, index, isSelected = false, name, onSelect }) {
|
|
22
|
-
const handleItemClick = () => onSelect(index);
|
|
23
|
-
const itemClassName = classNames(
|
|
24
|
-
"",
|
|
25
|
-
className,
|
|
26
|
-
"flex flex-row h-11 p-2 items-center border-solid border-t border-b border-l border-slate-200 transition duration-300 cursor-pointer ",
|
|
27
|
-
"first:rounded-l-xl last:rounded-r-xl last:border-r",
|
|
28
|
-
{
|
|
29
|
-
"bg-slate-100 text-slate-500": isSelected,
|
|
30
|
-
"bg-slate-50 hover:bg-slate-100 hover:text-slate-500 text-slate-300": !isSelected,
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
let calculatedIcon;
|
|
35
|
-
if (icon && typeof icon.default === "string") {
|
|
36
|
-
calculatedIcon = isSelected ? (
|
|
37
|
-
<img alt="" className="" src={icon.active} />
|
|
38
|
-
) : (
|
|
39
|
-
<img alt="" className="" src={icon.default} />
|
|
40
|
-
);
|
|
41
|
-
} else if (icon) {
|
|
42
|
-
calculatedIcon = isSelected ? icon.active : icon.default;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<li className={itemClassName} onClick={handleItemClick}>
|
|
47
|
-
{
|
|
48
|
-
<span className="relative block">
|
|
49
|
-
{icon?.showBadge && (
|
|
50
|
-
<div className={"absolute top-0 right-0 w-2.5 h-2.5 bg-red-400 rounded-xl border-slate-50 border-2 "} />
|
|
51
|
-
)}
|
|
52
|
-
{calculatedIcon}
|
|
53
|
-
</span>
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
{name && <Text text={name} color={isSelected ? "base" : "gray-500"} />}
|
|
57
|
-
</li>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export default SwitcherItem;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
@import "../../styles/colors";
|
|
2
|
-
@import "../../styles/layout";
|
|
3
|
-
|
|
4
|
-
.cweb-switcher-item {
|
|
5
|
-
@include flexbox-layout(center, center);
|
|
6
|
-
|
|
7
|
-
.cweb-switcher-item-link {
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
text-decoration: none;
|
|
11
|
-
padding: 0.5rem 1rem;
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
|
|
14
|
-
.cweb-switcher-item-link-icon {
|
|
15
|
-
display: flex;
|
|
16
|
-
align-items: center;
|
|
17
|
-
|
|
18
|
-
.cweb-switcher-item-link-icon-default,
|
|
19
|
-
.cweb-switcher-item-link-icon-active {
|
|
20
|
-
width: 20px;
|
|
21
|
-
height: 20px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.cweb-switcher-item-link-icon-active {
|
|
25
|
-
display: none;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.cweb-switcher-item-link-text {
|
|
30
|
-
color: $color-text-lighter;
|
|
31
|
-
transition: color 0.4s ease;
|
|
32
|
-
padding-bottom: 0;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.cweb-switcher-item-link-icon + .cweb-switcher-item-link-text {
|
|
36
|
-
margin-left: 8px;
|
|
37
|
-
padding: 0;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&.is-selected,
|
|
42
|
-
&:hover,
|
|
43
|
-
&:active {
|
|
44
|
-
border-color: $color-primary;
|
|
45
|
-
z-index: 1;
|
|
46
|
-
|
|
47
|
-
.cweb-switcher-item-link {
|
|
48
|
-
.cweb-switcher-item-link-icon {
|
|
49
|
-
.cweb-switcher-item-link-icon-default {
|
|
50
|
-
display: none;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.cweb-switcher-item-link-icon-active {
|
|
54
|
-
display: inherit;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.cweb-switcher-item-link-text {
|
|
59
|
-
color: $color-primary;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
&.is-disabled {
|
|
65
|
-
pointer-events: none;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {Link, LinkGetProps, NavigateFn, WindowLocation} from "@reach/router";
|
|
3
|
-
|
|
4
|
-
import Select from "../Select/Select";
|
|
5
|
-
|
|
6
|
-
interface TabLinkItem {
|
|
7
|
-
url: URL;
|
|
8
|
-
text: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface TabLinksProps {
|
|
12
|
-
patientUuid: string;
|
|
13
|
-
items: Array<TabLinkItem>;
|
|
14
|
-
navigate: NavigateFn;
|
|
15
|
-
location: WindowLocation;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const TabLinksSelect = ({ items, navigate, location }: { items: Array<TabLinkItem>, navigate: NavigateFn, location: WindowLocation }): JSX.Element => {
|
|
19
|
-
const options = items.map(({ url, text }) => ({ value: url, label: text }));
|
|
20
|
-
|
|
21
|
-
const handleChange = (selected: any) => {
|
|
22
|
-
navigate(selected?.value?.href);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<Select
|
|
27
|
-
value={options.filter(({ value }) => location?.href === value?.href)}
|
|
28
|
-
options={options}
|
|
29
|
-
onChange={handleChange}
|
|
30
|
-
/>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const TabLinks = ({ patientUuid, items, navigate, location }: TabLinksProps): JSX.Element => {
|
|
35
|
-
const linkProps = ({ isCurrent }: LinkGetProps) => {
|
|
36
|
-
return isCurrent
|
|
37
|
-
? {
|
|
38
|
-
className:
|
|
39
|
-
"mr-2 bg-slate-100 is-selected py-3 px-4 rounded-lg text-sm font-semibold transition ease-in duration-150 text-slate-700 hover:text-slate-700 focus:text-slate-700 focus:outline-primary",
|
|
40
|
-
}
|
|
41
|
-
: {
|
|
42
|
-
className:
|
|
43
|
-
"mr-2 text-slate-500 py-3 px-4 text-sm hover:bg-slate-100 hover:text-slate-500 focus:text-slate-500 rounded-lg transition ease-in duration-150 focus:outline-primary",
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<>
|
|
49
|
-
<div className={"w-full block xl:hidden bg-white p-2"}>
|
|
50
|
-
<TabLinksSelect items={items} navigate={navigate} location={location}/>
|
|
51
|
-
</div>
|
|
52
|
-
<div className={"w-full hidden xl:flex bg-white p-2 rounded-xl"}>
|
|
53
|
-
{items.map(({ text, url }) => (
|
|
54
|
-
<Link key={`${patientUuid}_${text}`} to={url.pathname} getProps={linkProps}>
|
|
55
|
-
{text}
|
|
56
|
-
</Link>
|
|
57
|
-
))}
|
|
58
|
-
</div>
|
|
59
|
-
</>
|
|
60
|
-
);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export default TabLinks;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import classNames from "classnames";
|
|
2
|
-
import React, { useEffect, useState } from "react";
|
|
3
|
-
|
|
4
|
-
import TabbarItem, { TabItemDetails } from "./TabbarItem";
|
|
5
|
-
|
|
6
|
-
export interface TabbarProps {
|
|
7
|
-
tabs?: TabItemDetails[];
|
|
8
|
-
selectedIndex?: number;
|
|
9
|
-
onSelect?: (params: { index: number; selectedTab: TabItemDetails }) => void;
|
|
10
|
-
className?: string;
|
|
11
|
-
/**
|
|
12
|
-
* If this component is being used on a container that will handle spacing, this option disables the padding, allowing the container to take over spacing.
|
|
13
|
-
*/
|
|
14
|
-
withoutPadding?: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { TabItemDetails };
|
|
18
|
-
|
|
19
|
-
export const Tabbar = ({
|
|
20
|
-
tabs = [],
|
|
21
|
-
selectedIndex,
|
|
22
|
-
onSelect,
|
|
23
|
-
className = "",
|
|
24
|
-
withoutPadding = false,
|
|
25
|
-
}: TabbarProps): JSX.Element => {
|
|
26
|
-
const [innerSelectedIndex, setInnerSelectedIndex] = useState(selectedIndex);
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
setInnerSelectedIndex(selectedIndex);
|
|
30
|
-
}, [selectedIndex]);
|
|
31
|
-
|
|
32
|
-
function handleOnTabSelect(index: number) {
|
|
33
|
-
setInnerSelectedIndex(index);
|
|
34
|
-
onSelect?.({ index, selectedTab: tabs[index] });
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<div
|
|
39
|
-
className={classNames(
|
|
40
|
-
`flex flex-row w-full bg-white rounded-xl ${className}`,
|
|
41
|
-
{ "p-2": !withoutPadding }
|
|
42
|
-
)}
|
|
43
|
-
>
|
|
44
|
-
{tabs?.map((tabItemProps, index) => {
|
|
45
|
-
const itemProps = {
|
|
46
|
-
index,
|
|
47
|
-
onSelect: handleOnTabSelect,
|
|
48
|
-
isSelected: innerSelectedIndex === index,
|
|
49
|
-
...tabItemProps,
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<TabbarItem key={tabItemProps.dataTestId ?? index} {...itemProps} />
|
|
54
|
-
);
|
|
55
|
-
})}
|
|
56
|
-
</div>
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export default Tabbar;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import classNames from "classnames";
|
|
3
|
-
|
|
4
|
-
import { Text } from "../Text/Text";
|
|
5
|
-
import Badge from "../Badge/Badge";
|
|
6
|
-
import LoadingIndicator from "../LoadingIndicator/LoadingIndicator";
|
|
7
|
-
|
|
8
|
-
export interface TabItemDetails<T extends object = Record<string, unknown>> {
|
|
9
|
-
title: string | JSX.Element;
|
|
10
|
-
badgeCount?: number;
|
|
11
|
-
isLoading?: boolean;
|
|
12
|
-
dataTestId?: string;
|
|
13
|
-
extra?: T;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface TabbarItemProps extends TabItemDetails {
|
|
17
|
-
index: number;
|
|
18
|
-
isSelected?: boolean;
|
|
19
|
-
onSelect?: (index: number) => void;
|
|
20
|
-
className?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const TabbarItem = ({
|
|
24
|
-
title,
|
|
25
|
-
index,
|
|
26
|
-
isSelected,
|
|
27
|
-
onSelect,
|
|
28
|
-
className,
|
|
29
|
-
badgeCount = 0,
|
|
30
|
-
isLoading = false,
|
|
31
|
-
dataTestId = "",
|
|
32
|
-
}: TabbarItemProps): JSX.Element => {
|
|
33
|
-
const handleTabClick = () => onSelect && onSelect(index);
|
|
34
|
-
|
|
35
|
-
const itemClassName = classNames(
|
|
36
|
-
"flex first:ml-0 ml-2 flex-row cursor-pointer py-2 px-3 rounded-lg focus:outline-primary transition ease-in duration-150",
|
|
37
|
-
className,
|
|
38
|
-
{
|
|
39
|
-
"bg-slate-100 text-slate-700 hover:text-slate-700 focus:text-slate-700": isSelected,
|
|
40
|
-
"bg-slate-50 text-slate-500 hover:bg-slate-100 hover:text-slate-500 focus:text-slate-500 opacity-75": !isSelected,
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<div
|
|
46
|
-
className={itemClassName}
|
|
47
|
-
onClick={handleTabClick}
|
|
48
|
-
data-test-id={dataTestId}
|
|
49
|
-
>
|
|
50
|
-
{typeof title === "string" && (
|
|
51
|
-
<Text text={title} type={isSelected ? "strong" : "base"} inline />
|
|
52
|
-
)}
|
|
53
|
-
{typeof title !== "string" && title}
|
|
54
|
-
{badgeCount > 0 && <Badge className="ml-1" badgeCount={badgeCount} />}
|
|
55
|
-
{isLoading && (
|
|
56
|
-
<LoadingIndicator
|
|
57
|
-
asSpinner={true}
|
|
58
|
-
spinnerColor={"gray"}
|
|
59
|
-
className={"w-6"}
|
|
60
|
-
/>
|
|
61
|
-
)}
|
|
62
|
-
</div>
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export default TabbarItem;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
import classNames from "classnames";
|
|
3
|
-
|
|
4
|
-
import { PaginationMenuProps } from "../PaginationMenu/PaginationMenu.types";
|
|
5
|
-
|
|
6
|
-
import { TableHeader } from "./TableHeader";
|
|
7
|
-
import { TableBody } from "./TableBody";
|
|
8
|
-
import { TableFooter } from "./TableFooter";
|
|
9
|
-
import { TableFieldConfig } from "./Table.types";
|
|
10
|
-
|
|
11
|
-
export interface TableProps<Item>
|
|
12
|
-
extends React.HTMLAttributes<HTMLTableElement> {
|
|
13
|
-
items?: Item[];
|
|
14
|
-
fieldConfigurations: TableFieldConfig<Item>[];
|
|
15
|
-
emptyRowsText: string;
|
|
16
|
-
emptyFieldContentText?: string;
|
|
17
|
-
isLoading?: boolean;
|
|
18
|
-
showHeader?: boolean;
|
|
19
|
-
paginationMenuProps?: PaginationMenuProps;
|
|
20
|
-
onRowClick?: (item: Item) => void;
|
|
21
|
-
className?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function Table<Item>({
|
|
25
|
-
items,
|
|
26
|
-
fieldConfigurations,
|
|
27
|
-
emptyRowsText,
|
|
28
|
-
emptyFieldContentText,
|
|
29
|
-
isLoading = false,
|
|
30
|
-
showHeader = true,
|
|
31
|
-
paginationMenuProps,
|
|
32
|
-
onRowClick,
|
|
33
|
-
className,
|
|
34
|
-
...otherAttributes
|
|
35
|
-
}: TableProps<Item>): JSX.Element {
|
|
36
|
-
// For not displaying empty view at creation
|
|
37
|
-
const [isPristine, setIsPristine] = useState(true);
|
|
38
|
-
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
setIsPristine(false);
|
|
41
|
-
}, [items, isLoading]);
|
|
42
|
-
|
|
43
|
-
const showEmptyView =
|
|
44
|
-
!isPristine && !isLoading && !(items && items.length > 0);
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<table
|
|
48
|
-
className={classNames(
|
|
49
|
-
"w-full rounded-lg bg-white border-collapse table-auto",
|
|
50
|
-
className
|
|
51
|
-
)}
|
|
52
|
-
{...otherAttributes}
|
|
53
|
-
>
|
|
54
|
-
{showHeader ? (
|
|
55
|
-
<TableHeader
|
|
56
|
-
className="border-b border-slate-100"
|
|
57
|
-
fieldConfigurations={fieldConfigurations}
|
|
58
|
-
/>
|
|
59
|
-
) : null}
|
|
60
|
-
|
|
61
|
-
<TableBody
|
|
62
|
-
className={classNames({
|
|
63
|
-
"border-b border-slate-100":
|
|
64
|
-
!isLoading &&
|
|
65
|
-
!showEmptyView &&
|
|
66
|
-
paginationMenuProps &&
|
|
67
|
-
paginationMenuProps.currentPageNumber > 0 &&
|
|
68
|
-
paginationMenuProps.pageCount > 0,
|
|
69
|
-
})}
|
|
70
|
-
items={items}
|
|
71
|
-
fieldConfigurations={fieldConfigurations}
|
|
72
|
-
emptyItemsText={emptyRowsText}
|
|
73
|
-
emptyFieldContentText={emptyFieldContentText}
|
|
74
|
-
isLoading={isLoading}
|
|
75
|
-
showEmptyView={showEmptyView}
|
|
76
|
-
onRowClick={onRowClick}
|
|
77
|
-
/>
|
|
78
|
-
|
|
79
|
-
{!isLoading &&
|
|
80
|
-
!showEmptyView &&
|
|
81
|
-
paginationMenuProps &&
|
|
82
|
-
paginationMenuProps.currentPageNumber > 0 &&
|
|
83
|
-
paginationMenuProps.pageCount > 0 ? (
|
|
84
|
-
<TableFooter
|
|
85
|
-
colSpan={fieldConfigurations.length}
|
|
86
|
-
paginationMenuProps={paginationMenuProps}
|
|
87
|
-
/>
|
|
88
|
-
) : null}
|
|
89
|
-
</table>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { IconProps } from "../Icons/types/IconProps.type";
|
|
2
|
-
import { TagColorTheme } from "../Tag/Tag";
|
|
3
|
-
|
|
4
|
-
export interface TableFieldConfig<Item> {
|
|
5
|
-
key: string;
|
|
6
|
-
headerText?: string;
|
|
7
|
-
content: (item: Item) => TableFieldContent<Item>;
|
|
8
|
-
onlyShowContentOnHovering?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type TableFieldContent<Item> =
|
|
12
|
-
| TableFieldText
|
|
13
|
-
| [TableFieldAction<Item>?, TableFieldAction<Item>?];
|
|
14
|
-
|
|
15
|
-
export interface TableFieldText {
|
|
16
|
-
text: string;
|
|
17
|
-
breakAllWord?: boolean;
|
|
18
|
-
tag?: {
|
|
19
|
-
text: string;
|
|
20
|
-
color: TagColorTheme;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface TableFieldAction<Item> {
|
|
25
|
-
key: string;
|
|
26
|
-
icon: React.FunctionComponent<IconProps>;
|
|
27
|
-
handleClick: (item: Item) => void;
|
|
28
|
-
}
|