@hellobetterdigitalnz/betterui 0.0.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/.editorconfig +17 -0
- package/.eslintrc.cjs +14 -0
- package/.storybook/main.ts +23 -0
- package/.storybook/preview.ts +17 -0
- package/README.md +30 -0
- package/index.html +13 -0
- package/package.json +45 -0
- package/public/image/table-image.png +0 -0
- package/public/vite.svg +1 -0
- package/src/App.tsx +30 -0
- package/src/Components/DataDisplay/Accordion/Accordion.stories.tsx +57 -0
- package/src/Components/DataDisplay/Accordion/Accordion.tsx +14 -0
- package/src/Components/DataDisplay/Accordion/AccordionContext.tsx +11 -0
- package/src/Components/DataDisplay/Accordion/AccordionContextInterface.tsx +8 -0
- package/src/Components/DataDisplay/Accordion/AccordionItem.tsx +62 -0
- package/src/Components/DataDisplay/Accordion/AccordionItemProps.tsx +12 -0
- package/src/Components/DataDisplay/Accordion/AccordionProps.tsx +8 -0
- package/src/Components/DataDisplay/Accordion/AccordionProvider.tsx +65 -0
- package/src/Components/DataDisplay/Accordion/AccordionProviderInterface.tsx +8 -0
- package/src/Components/DataDisplay/Accordion/accordion.module.scss +56 -0
- package/src/Components/DataDisplay/Badge/Badge.stories.tsx +44 -0
- package/src/Components/DataDisplay/Badge/Badge.tsx +32 -0
- package/src/Components/DataDisplay/Badge/BadgeProps.tsx +6 -0
- package/src/Components/DataDisplay/Badge/badge.module.scss +42 -0
- package/src/Components/DataDisplay/Cards/BannerCard/BannerCard.stories.tsx +26 -0
- package/src/Components/DataDisplay/Cards/BannerCard/BannerCard.tsx +47 -0
- package/src/Components/DataDisplay/Cards/BannerCard/BannerCardInterface.tsx +15 -0
- package/src/Components/DataDisplay/Cards/BannerCard/banner-card.scss +54 -0
- package/src/Components/DataDisplay/Cards/PathwayCard/PathwayCard.stories.tsx +31 -0
- package/src/Components/DataDisplay/Cards/PathwayCard/PathwayCard.tsx +53 -0
- package/src/Components/DataDisplay/Cards/PathwayCard/PathwayCardInterface.tsx +17 -0
- package/src/Components/DataDisplay/Cards/PathwayCard/pathway-card-stories.scss +3 -0
- package/src/Components/DataDisplay/Cards/PathwayCard/pathway-card.scss +62 -0
- package/src/Components/DataDisplay/Media/Media.tsx +26 -0
- package/src/Components/DataDisplay/Media/MediaProps.tsx +9 -0
- package/src/Components/DataDisplay/Media/media.scss +0 -0
- package/src/Components/DataDisplay/Modal/Modal.tsx +5 -0
- package/src/Components/DataDisplay/Modal/ModalActions.tsx +5 -0
- package/src/Components/DataDisplay/Modal/ModalActionsLeft.tsx +5 -0
- package/src/Components/DataDisplay/Modal/ModalActionsRight.tsx +5 -0
- package/src/Components/DataDisplay/Modal/ModalBody.tsx +5 -0
- package/src/Components/DataDisplay/Modal/ModalCurtain.tsx +5 -0
- package/src/Components/DataDisplay/Modal/ModalHeader.tsx +5 -0
- package/src/Components/DataDisplay/NotificationsBell/NotificationBell.stories.tsx +27 -0
- package/src/Components/DataDisplay/NotificationsBell/NotificationsBell.tsx +51 -0
- package/src/Components/DataDisplay/NotificationsBell/NotificationsBellProps.tsx +9 -0
- package/src/Components/DataDisplay/NotificationsBell/notificationBell.module.scss +48 -0
- package/src/Components/DataDisplay/NotificationsPanel/Notification.stories.tsx +128 -0
- package/src/Components/DataDisplay/NotificationsPanel/Notification.tsx +59 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationProps.tsx +11 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroup.tsx +17 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroupProps.tsx +8 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroups.tsx +42 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroupsProps.tsx +7 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsHeader.tsx +27 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsHeaderProps.tsx +9 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsNone.tsx +11 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsPanel.tsx +8 -0
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsPanelProps.tsx +7 -0
- package/src/Components/DataDisplay/NotificationsPanel/notificationPanel.module.scss +196 -0
- package/src/Components/DataDisplay/Tab/Tab.stories.tsx +72 -0
- package/src/Components/DataDisplay/Tab/Tab.tsx +20 -0
- package/src/Components/DataDisplay/Tab/TabBody.tsx +6 -0
- package/src/Components/DataDisplay/Tab/TabBodyContent.tsx +15 -0
- package/src/Components/DataDisplay/Tab/TabBodyContentProps.tsx +9 -0
- package/src/Components/DataDisplay/Tab/TabBodyProps.tsx +8 -0
- package/src/Components/DataDisplay/Tab/TabContext.tsx +9 -0
- package/src/Components/DataDisplay/Tab/TabContextProps.tsx +6 -0
- package/src/Components/DataDisplay/Tab/TabNav.tsx +6 -0
- package/src/Components/DataDisplay/Tab/TabNavItem.tsx +49 -0
- package/src/Components/DataDisplay/Tab/TabNavItemProps.tsx +9 -0
- package/src/Components/DataDisplay/Tab/TabNavProps.tsx +8 -0
- package/src/Components/DataDisplay/Tab/TabProps.tsx +8 -0
- package/src/Components/DataDisplay/Tab/tab.module.scss +35 -0
- package/src/Components/DataDisplay/Tab/tab.stories.scss +3 -0
- package/src/Components/DataDisplay/Table/Table.stories.tsx +64 -0
- package/src/Components/DataDisplay/Table/Table.tsx +10 -0
- package/src/Components/DataDisplay/Table/TableBody.tsx +13 -0
- package/src/Components/DataDisplay/Table/TableBodyProps.tsx +8 -0
- package/src/Components/DataDisplay/Table/TableCell.tsx +30 -0
- package/src/Components/DataDisplay/Table/TableCellAction.tsx +27 -0
- package/src/Components/DataDisplay/Table/TableCellActionProps.tsx +11 -0
- package/src/Components/DataDisplay/Table/TableCellProps.tsx +11 -0
- package/src/Components/DataDisplay/Table/TableCellWithDesc.tsx +21 -0
- package/src/Components/DataDisplay/Table/TableCellWithDescProps.tsx +9 -0
- package/src/Components/DataDisplay/Table/TableCellWithImage.tsx +39 -0
- package/src/Components/DataDisplay/Table/TableCellWithImageProps.tsx +10 -0
- package/src/Components/DataDisplay/Table/TableFooter.tsx +5 -0
- package/src/Components/DataDisplay/Table/TableHead.tsx +11 -0
- package/src/Components/DataDisplay/Table/TableHeadProps.tsx +8 -0
- package/src/Components/DataDisplay/Table/TableHeaderCell.tsx +17 -0
- package/src/Components/DataDisplay/Table/TableHeaderCellProps.tsx +10 -0
- package/src/Components/DataDisplay/Table/TableProps.tsx +8 -0
- package/src/Components/DataDisplay/Table/TableRow.tsx +9 -0
- package/src/Components/DataDisplay/Table/TableRowProps.tsx +8 -0
- package/src/Components/DataDisplay/Table/table.module.scss +103 -0
- package/src/Components/Form/Button/Button.stories.tsx +66 -0
- package/src/Components/Form/Button/Button.tsx +64 -0
- package/src/Components/Form/Button/ButtonProps.tsx +18 -0
- package/src/Components/Form/Button/button.module.scss +142 -0
- package/src/Components/Form/Checkbox/Checkbox.stories.tsx +49 -0
- package/src/Components/Form/Checkbox/Checkbox.tsx +85 -0
- package/src/Components/Form/Checkbox/CheckboxProps.tsx +22 -0
- package/src/Components/Form/Checkbox/checkbox.module.scss +63 -0
- package/src/Components/Form/CheckboxSelect/CheckboxSelect.tsx +5 -0
- package/src/Components/Form/CheckboxSelect/CheckboxSelectItem.tsx +5 -0
- package/src/Components/Form/CheckboxSet/CheckboxSet.stories.tsx +93 -0
- package/src/Components/Form/CheckboxSet/CheckboxSet.tsx +14 -0
- package/src/Components/Form/CheckboxSet/CheckboxSetItem.tsx +88 -0
- package/src/Components/Form/CheckboxSet/CheckboxSetProps.tsx +9 -0
- package/src/Components/Form/CheckboxSet/checkboxSet.module.scss +13 -0
- package/src/Components/Form/CurrencyField/CurrenctField.stories.tsx +22 -0
- package/src/Components/Form/CurrencyField/CurrencyField.tsx +59 -0
- package/src/Components/Form/CurrencyField/CurrencyFieldProps.tsx +8 -0
- package/src/Components/Form/DateField/DateField.stories.tsx +22 -0
- package/src/Components/Form/DateField/DateField.tsx +58 -0
- package/src/Components/Form/DropdownBadge/DropdownBadge.stories.tsx +49 -0
- package/src/Components/Form/DropdownBadge/DropdownBadge.tsx +160 -0
- package/src/Components/Form/DropdownBadge/DropdownBadgeItem.tsx +40 -0
- package/src/Components/Form/DropdownBadge/DropdownBadgeItemProps.tsx +10 -0
- package/src/Components/Form/DropdownBadge/DropdownBadgeProps.tsx +31 -0
- package/src/Components/Form/DropdownBadge/DropdownBadgeSelector.tsx +11 -0
- package/src/Components/Form/DropdownBadge/DropdownBadgeSelectorProps.tsx +7 -0
- package/src/Components/Form/DropdownBadge/dropdownBadge.module.scss +105 -0
- package/src/Components/Form/DropdownField/DropdownField.stories.tsx +50 -0
- package/src/Components/Form/DropdownField/DropdownField.tsx +118 -0
- package/src/Components/Form/DropdownField/DropdownFieldItem.tsx +26 -0
- package/src/Components/Form/DropdownField/DropdownFieldItemProps.tsx +9 -0
- package/src/Components/Form/DropdownField/DropdownFieldProps.tsx +33 -0
- package/src/Components/Form/DropdownField/DropdownFieldSelector.tsx +15 -0
- package/src/Components/Form/DropdownField/DropdownFieldSelectorProps.tsx +7 -0
- package/src/Components/Form/DropdownField/dropdown.module.scss +79 -0
- package/src/Components/Form/EmailField/EmailField.stories.ts +23 -0
- package/src/Components/Form/EmailField/EmailField.tsx +51 -0
- package/src/Components/Form/ErrorMessage/ErrorMessage.tsx +5 -0
- package/src/Components/Form/FormFieldHolder/FormFieldHolder.tsx +5 -0
- package/src/Components/Form/IconButton/IconButton.stories.tsx +45 -0
- package/src/Components/Form/IconButton/IconButton.tsx +58 -0
- package/src/Components/Form/IconButton/IconButtonProps.tsx +15 -0
- package/src/Components/Form/IconButton/iconButton.module.scss +111 -0
- package/src/Components/Form/InputProps.tsx +25 -0
- package/src/Components/Form/MultiSelectField/MultiSelectField.tsx +5 -0
- package/src/Components/Form/MultiSelectField/MultiSelectFieldItem.tsx +5 -0
- package/src/Components/Form/MultiSelectField/MultiSelectFieldTag.tsx +5 -0
- package/src/Components/Form/PasswordField/PasswordField.stories.tsx +22 -0
- package/src/Components/Form/PasswordField/PasswordField.tsx +70 -0
- package/src/Components/Form/RadioButtons/RadioButton.tsx +70 -0
- package/src/Components/Form/RadioButtons/RadioButtonProps.tsx +22 -0
- package/src/Components/Form/RadioButtons/RadioButtons.stories.tsx +64 -0
- package/src/Components/Form/RadioButtons/RadioButtons.tsx +18 -0
- package/src/Components/Form/RadioButtons/RadioButtonsProps.tsx +10 -0
- package/src/Components/Form/RadioButtons/radioButton.stories.scss +3 -0
- package/src/Components/Form/RadioButtons/radiobutton.module.scss +63 -0
- package/src/Components/Form/TextField/TextField.stories.ts +23 -0
- package/src/Components/Form/TextField/TextField.tsx +52 -0
- package/src/Components/Form/Textarea/Textarea.stories.ts +31 -0
- package/src/Components/Form/Textarea/Textarea.tsx +71 -0
- package/src/Components/Form/Textarea/TextareaProps.tsx +27 -0
- package/src/Components/Form/Textarea/textarea.module.scss +49 -0
- package/src/Components/Form/TimeField/TimeField.stories.tsx +22 -0
- package/src/Components/Form/TimeField/TimeField.tsx +58 -0
- package/src/Components/Form/ToggleSwitch/ToggleSwitch.stories.tsx +49 -0
- package/src/Components/Form/ToggleSwitch/ToggleSwitch.tsx +87 -0
- package/src/Components/Form/ToggleSwitch/ToggleSwitchProps.tsx +22 -0
- package/src/Components/Form/ToggleSwitch/toggleSwitch.module.scss +82 -0
- package/src/Components/Form/inputs.module.scss +121 -0
- package/src/Components/Icons/Arrows/CaretDown/CaretDown.tsx +49 -0
- package/src/Components/Icons/Arrows/CaretUp/CaretUp.tsx +49 -0
- package/src/Components/Icons/Commerce/CurrencyDollarSimple/CurrencyDollarSimple.tsx +105 -0
- package/src/Components/Icons/Communication/AddressBook/AddressBook.stories.ts +28 -0
- package/src/Components/Icons/Communication/AddressBook/AddressBook.tsx +50 -0
- package/src/Components/Icons/Communication/Asterick/Asterisk.stories.ts +28 -0
- package/src/Components/Icons/Communication/Asterick/Asterisk.tsx +50 -0
- package/src/Components/Icons/Communication/AsterickSimple/AsteriskSimple.stories.ts +28 -0
- package/src/Components/Icons/Communication/AsterickSimple/AsteriskSimple.tsx +49 -0
- package/src/Components/Icons/Communication/At/At.stories.ts +28 -0
- package/src/Components/Icons/Communication/At/At.tsx +49 -0
- package/src/Components/Icons/Communication/Broadcast/Broadcast.stories.ts +27 -0
- package/src/Components/Icons/Communication/Broadcast/Broadcast.tsx +49 -0
- package/src/Components/Icons/Communication/Chat/Chat.stories.ts +28 -0
- package/src/Components/Icons/Communication/Chat/Chat.tsx +49 -0
- package/src/Components/Icons/Design/Eye/Eye.tsx +105 -0
- package/src/Components/Icons/Design/EyeSlash/EyeSlash.tsx +105 -0
- package/src/Components/Icons/IconProps.tsx +5 -0
- package/src/Components/Icons/MathAndFinance/XIcon/XIcon.tsx +107 -0
- package/src/Components/Icons/SystemAndDevice/Bell/Bell.tsx +49 -0
- package/src/Components/Icons/Time/CalendarBank/CalendarBank.tsx +105 -0
- package/src/Components/Icons/Time/Clock/Clock.tsx +105 -0
- package/src/Components/Layout/CalloutPopup/CalloutPopup.tsx +5 -0
- package/src/Components/Layout/Header/Header.tsx +5 -0
- package/src/Components/Layout/Header/HeaderLeft.tsx +5 -0
- package/src/Components/Layout/Header/HeaderRight.tsx +5 -0
- package/src/Components/Layout/Pagination/Pagination.tsx +5 -0
- package/src/Components/Layout/Pagination/PaginationFirst.tsx +5 -0
- package/src/Components/Layout/Pagination/PaginationLast.tsx +5 -0
- package/src/Components/Layout/Pagination/PaginationNext.tsx +5 -0
- package/src/Components/Layout/Pagination/PaginationNumber.tsx +5 -0
- package/src/Components/Layout/Pagination/PaginationPrevious.tsx +5 -0
- package/src/Components/Layout/ProfileAvatar/ProfileAvatar.tsx +5 -0
- package/src/Components/Layout/ProfileAvatar/ProfileAvatarProps.tsx +4 -0
- package/src/Components/Layout/ProfileDropdown/ProfileDropdown.tsx +5 -0
- package/src/Components/Layout/ProfileDropdown/ProfileHeader.tsx +5 -0
- package/src/Components/Layout/ProfileDropdown/ProfileLink.tsx +5 -0
- package/src/Components/Layout/ProfileDropdown/ProfileLinks.tsx +5 -0
- package/src/Components/Layout/ProfileDropdown/ProfileNavigationItem.tsx +5 -0
- package/src/Components/Layout/ProfileDropdown/ProfileSwitchPanel.tsx +5 -0
- package/src/Components/Layout/ProfileDropdown/ProfileSwitchUser.tsx +5 -0
- package/src/Components/Layout/Sidebar/Sidebar.tsx +5 -0
- package/src/Components/Layout/Sidebar/SidebarChevron.tsx +5 -0
- package/src/Components/Layout/Sidebar/SidebarNavigation.tsx +5 -0
- package/src/Components/Layout/Sidebar/SidebarNavigationItem.tsx +5 -0
- package/src/Components/Layout/Sidebar/SidebarSubNavigation.tsx +5 -0
- package/src/Notification/Notification.tsx +83 -0
- package/src/Notification/NotificationInterface.tsx +9 -0
- package/src/Notification/NotificationList.tsx +29 -0
- package/src/Notification/NotificationListHolder.tsx +14 -0
- package/src/Notification/NotificationListHolderInterface.tsx +8 -0
- package/src/Notification/NotificationListInterface.tsx +11 -0
- package/src/Notification/notification.scss +225 -0
- package/src/global.scss +231 -0
- package/src/main.tsx +9 -0
- package/src/variables.scss +2 -0
- package/src/vite-env.d.ts +1 -0
- package/tokens/color/color.mdx +82 -0
- package/tokens/shadow/shadow-panel.scss +12 -0
- package/tokens/shadow/shadow.mdx +34 -0
- package/tokens/typography/typography.mdx +31 -0
- package/tsconfig.json +25 -0
- package/tsconfig.node.json +10 -0
- package/vite.config.ts +7 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.tab {
|
|
2
|
+
width: 100%;
|
|
3
|
+
|
|
4
|
+
.tabNav {
|
|
5
|
+
display: flex;
|
|
6
|
+
width: 100%;
|
|
7
|
+
border-bottom: 1px solid var(--color-gray-300);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.tabNavItem {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: flex-start;
|
|
14
|
+
min-height: 54px;
|
|
15
|
+
border-width: 0 0 3px 0;
|
|
16
|
+
border-style: solid;
|
|
17
|
+
border-color: transparent;
|
|
18
|
+
transition: 0.4s;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
margin-right: var(--spacing-2);
|
|
21
|
+
|
|
22
|
+
&.active,
|
|
23
|
+
&:hover {
|
|
24
|
+
background: var(--color-table);
|
|
25
|
+
border-color: var(--color-primary-400);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.item {
|
|
30
|
+
padding-left: calc(var(--spacing) * 2.25);
|
|
31
|
+
font-size: var(--font-size-h4);
|
|
32
|
+
line-height: var(--line-height-h4);
|
|
33
|
+
font-weight: var(--font-weight-h4);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Table from "./Table";
|
|
3
|
+
import TableHead from "./TableHead";
|
|
4
|
+
import TableHeaderCell from "./TableHeaderCell";
|
|
5
|
+
import TableRow from "./TableRow";
|
|
6
|
+
import TableBody from "./TableBody";
|
|
7
|
+
import TableCell from "./TableCell";
|
|
8
|
+
import TableCellWithDesc from "./TableCellWithDesc";
|
|
9
|
+
import TableCellWithImage from "./TableCellWithImage";
|
|
10
|
+
|
|
11
|
+
const meta: Meta = {
|
|
12
|
+
title: "Data Display / Table",
|
|
13
|
+
component: Table,
|
|
14
|
+
tags: ["autodocs"],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
|
|
21
|
+
const TableTemplate: Story = {
|
|
22
|
+
render: ({ items, ...args }) => {
|
|
23
|
+
return (
|
|
24
|
+
<Table {...args}>
|
|
25
|
+
<TableHead>
|
|
26
|
+
<TableRow>
|
|
27
|
+
<TableHeaderCell>Lorem ipsum</TableHeaderCell>
|
|
28
|
+
<TableHeaderCell>Lorem ipsum</TableHeaderCell>
|
|
29
|
+
<TableHeaderCell>Lorem ipsum</TableHeaderCell>
|
|
30
|
+
<TableHeaderCell>Lorem ipsum</TableHeaderCell>
|
|
31
|
+
</TableRow>
|
|
32
|
+
</TableHead>
|
|
33
|
+
<TableBody>
|
|
34
|
+
<TableRow>
|
|
35
|
+
<TableCellWithImage
|
|
36
|
+
image={"./image/table-image.png"}
|
|
37
|
+
heading={"Lorem ipsum"}
|
|
38
|
+
description={"Lorem ipsum"}
|
|
39
|
+
/>
|
|
40
|
+
<TableCellWithDesc
|
|
41
|
+
heading={"Lorem ipsum"}
|
|
42
|
+
description={"Lorem ipsum"}
|
|
43
|
+
/>
|
|
44
|
+
<TableCell>desc</TableCell>
|
|
45
|
+
<TableCell>desc</TableCell>
|
|
46
|
+
</TableRow>
|
|
47
|
+
<TableRow>
|
|
48
|
+
<TableCell>Lorem ipsum</TableCell>
|
|
49
|
+
<TableCellWithDesc
|
|
50
|
+
heading={"Lorem ipsum"}
|
|
51
|
+
description={"Lorem ipsum"}
|
|
52
|
+
/>
|
|
53
|
+
<TableCell>desc</TableCell>
|
|
54
|
+
<TableCell>desc</TableCell>
|
|
55
|
+
</TableRow>
|
|
56
|
+
</TableBody>
|
|
57
|
+
</Table>
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const Example = {
|
|
63
|
+
...TableTemplate,
|
|
64
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import TableProps from "./TableProps";
|
|
2
|
+
import styles from "./table.module.scss";
|
|
3
|
+
|
|
4
|
+
const Table = (props: TableProps) => {
|
|
5
|
+
const { children, extraClass } = props;
|
|
6
|
+
|
|
7
|
+
return <table className={`${styles.table} ${extraClass}`}>{children}</table>;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default Table;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import TableBodyProps from "./TableBodyProps";
|
|
2
|
+
import styles from "./table.module.scss";
|
|
3
|
+
|
|
4
|
+
const TableBody = (props: TableBodyProps) => {
|
|
5
|
+
const { children, extraClass = "" } = props;
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<tbody className={`${styles.tableBody} ${extraClass} `}>{children}</tbody>
|
|
9
|
+
</>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default TableBody;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import TableCellProps from "./TableCellProps";
|
|
2
|
+
import styles from "./table.module.scss";
|
|
3
|
+
import cx from "classnames";
|
|
4
|
+
|
|
5
|
+
const TableCell = (props: TableCellProps) => {
|
|
6
|
+
const { children, rowspan, colspan, extraClass, align } = props;
|
|
7
|
+
const dataType = typeof children;
|
|
8
|
+
|
|
9
|
+
let tableCell = styles.tableCellAlignLeft;
|
|
10
|
+
|
|
11
|
+
if (align === "center") {
|
|
12
|
+
tableCell = styles.tableCellAlignCenter;
|
|
13
|
+
}
|
|
14
|
+
if (align === "right") {
|
|
15
|
+
tableCell = styles.tableCellAlignRight;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const combinedClassNames = cx(tableCell, extraClass);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<td rowSpan={rowspan} colSpan={colspan} className={combinedClassNames}>
|
|
22
|
+
<>
|
|
23
|
+
{dataType === "string" && <p>{children}</p>}
|
|
24
|
+
{dataType !== "string" && <>{children}</>}
|
|
25
|
+
</>
|
|
26
|
+
</td>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default TableCell;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import TableCellActionProps from "./TableCellActionProps";
|
|
2
|
+
import styles from "./table.module.scss";
|
|
3
|
+
|
|
4
|
+
const TableCellActions = (props: TableCellActionProps) => {
|
|
5
|
+
const { children, extraClass, rowspan, colspan, align } = props;
|
|
6
|
+
|
|
7
|
+
let tableCell = styles.tableCellAlignLeft;
|
|
8
|
+
|
|
9
|
+
if (align === "center") {
|
|
10
|
+
tableCell = styles.tableCellAlignCenter;
|
|
11
|
+
}
|
|
12
|
+
if (align === "right") {
|
|
13
|
+
tableCell = styles.tableCellAlignRight;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<td
|
|
18
|
+
rowSpan={rowspan}
|
|
19
|
+
colSpan={colspan}
|
|
20
|
+
className={`${styles.tableCell} ${extraClass} ${styles.tableCellActions}`}
|
|
21
|
+
>
|
|
22
|
+
<div className={tableCell}>{children}</div>
|
|
23
|
+
</td>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default TableCellActions;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import TableCellWithDescProps from "./TableCellWithDescProps";
|
|
2
|
+
import styles from "./table.module.scss";
|
|
3
|
+
|
|
4
|
+
const TableCellWithDesc = (props: TableCellWithDescProps) => {
|
|
5
|
+
const { heading, description, extraClass, rowspan, colspan } = props;
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<td
|
|
9
|
+
rowSpan={rowspan}
|
|
10
|
+
colSpan={colspan}
|
|
11
|
+
className={`${styles.tableCell} ${extraClass}`}
|
|
12
|
+
>
|
|
13
|
+
<div>
|
|
14
|
+
{!!heading && <p className={styles.descTitle}>{heading}</p>}
|
|
15
|
+
{!!description && <p className={styles.smallDesc}>{description}</p>}
|
|
16
|
+
</div>
|
|
17
|
+
</td>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default TableCellWithDesc;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import TableCellWithImageProps from "./TableCellWithImageProps";
|
|
2
|
+
import styles from "./table.module.scss";
|
|
3
|
+
|
|
4
|
+
const TableCellWithImage = (props: TableCellWithImageProps) => {
|
|
5
|
+
const { image, heading, description, extraClass, rowspan, colspan } = props;
|
|
6
|
+
|
|
7
|
+
const imageType = typeof image;
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<td
|
|
11
|
+
rowSpan={rowspan}
|
|
12
|
+
colSpan={colspan}
|
|
13
|
+
className={`${styles.tableCell} ${extraClass}`}
|
|
14
|
+
>
|
|
15
|
+
<div className={`${styles.cellWithPicture}`}>
|
|
16
|
+
{imageType === "string" && (
|
|
17
|
+
<div className={`${styles.cellImage} cellImage`}>
|
|
18
|
+
<img src={image ? `${image}` : ""} alt={image} />
|
|
19
|
+
</div>
|
|
20
|
+
)}
|
|
21
|
+
{imageType !== "string" && (
|
|
22
|
+
<div className={`${styles.cellImage} cellImage`}>{image}</div>
|
|
23
|
+
)}
|
|
24
|
+
<div>
|
|
25
|
+
{!!heading && (
|
|
26
|
+
<p className={`${styles.descTitle} descTitle`}>{heading}</p>
|
|
27
|
+
)}
|
|
28
|
+
{!!description && (
|
|
29
|
+
<p className={`${styles.smallDesc} smallDesc`}>
|
|
30
|
+
<small>{description}</small>
|
|
31
|
+
</p>
|
|
32
|
+
)}
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</td>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default TableCellWithImage;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import TableHeadProps from "./TableHeadProps";
|
|
2
|
+
import styles from "./table.module.scss";
|
|
3
|
+
|
|
4
|
+
const TableHead = (props: TableHeadProps) => {
|
|
5
|
+
const { children, extraClass = "" } = props;
|
|
6
|
+
return (
|
|
7
|
+
<thead className={`${styles.tableHead} ${extraClass}`}>{children}</thead>
|
|
8
|
+
);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default TableHead;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import TableHeaderCellProps from "./TableHeaderCellProps";
|
|
2
|
+
import styles from "./table.module.scss";
|
|
3
|
+
|
|
4
|
+
const TableHeaderCell = (props: TableHeaderCellProps) => {
|
|
5
|
+
const { children, extraClass, rowspan, colspan } = props;
|
|
6
|
+
return (
|
|
7
|
+
<th
|
|
8
|
+
rowSpan={rowspan}
|
|
9
|
+
colSpan={colspan}
|
|
10
|
+
className={`${styles.tableCellHeading} ${extraClass}`}
|
|
11
|
+
>
|
|
12
|
+
{children}
|
|
13
|
+
</th>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default TableHeaderCell;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import TableRowProps from "./TableRowProps";
|
|
2
|
+
import styles from "./table.module.scss";
|
|
3
|
+
|
|
4
|
+
const TableRow = (props: TableRowProps) => {
|
|
5
|
+
const { children, extraClass } = props;
|
|
6
|
+
return <tr className={`${styles.tableRow} ${extraClass}`}>{children}</tr>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default TableRow;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
.table {
|
|
2
|
+
width: 100%;
|
|
3
|
+
border-collapse: collapse;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.tableBody {
|
|
7
|
+
width: 100%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.tableRow {
|
|
11
|
+
border-bottom: 1px solid var(--color-gray-300);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.tableCellHeading {
|
|
15
|
+
text-align: left;
|
|
16
|
+
font-size: var(--font-size-body-sm);
|
|
17
|
+
line-height: var(--line-height-body-sm);
|
|
18
|
+
font-weight: var(--font-weight-body-sm);
|
|
19
|
+
padding: calc(var(--space-unit) * 5) calc(var(--space-unit) * 2)
|
|
20
|
+
calc(var(--space-unit) * 5) 0px;
|
|
21
|
+
color: var(--color-gray-600);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.tableCell {
|
|
25
|
+
font-size: var(--font-size-body-regular);
|
|
26
|
+
line-height: var(--line-height-body-regular);
|
|
27
|
+
font-weight: var(--font-weight-body-regular);
|
|
28
|
+
min-height: 60px;
|
|
29
|
+
height: 60px;
|
|
30
|
+
vertical-align: middle;
|
|
31
|
+
padding: calc(var(--space-unit) * 2) calc(var(--space-unit) * 2)
|
|
32
|
+
calc(var(--space-unit) * 2) 0px;
|
|
33
|
+
|
|
34
|
+
&.tableCellAlignLeft {
|
|
35
|
+
text-align: left;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.tableCellAlignCenter {
|
|
39
|
+
text-align: center;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.tableCellAlignRight {
|
|
43
|
+
text-align: right;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.tableCellActions {
|
|
48
|
+
> div {
|
|
49
|
+
display: flex;
|
|
50
|
+
justify-content: flex-end;
|
|
51
|
+
margin: 0 calc(-1 * var(--space-unit));
|
|
52
|
+
|
|
53
|
+
&.tableCellAlignLeft {
|
|
54
|
+
justify-content: flex-start;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&.tableCellAlignCenter {
|
|
58
|
+
justify-content: center;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.tableCellAlignRight {
|
|
62
|
+
justify-content: flex-end;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
> * {
|
|
66
|
+
margin: 0 var(--space-unit);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
a,
|
|
70
|
+
button {
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.smallDesc {
|
|
77
|
+
font-size: var(--font-size-body-sm);
|
|
78
|
+
line-height: var(--line-height-body-sm);
|
|
79
|
+
font-weight: var(--font-weight-body-sm);
|
|
80
|
+
color: var(--color-gray-600);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.cellWithPicture {
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: row;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.cellImage {
|
|
89
|
+
position: relative;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
width: 40px;
|
|
92
|
+
height: 40px;
|
|
93
|
+
border-radius: 4px;
|
|
94
|
+
margin-right: calc(var(--space-unit) * 2);
|
|
95
|
+
flex-shrink: 0;
|
|
96
|
+
|
|
97
|
+
img {
|
|
98
|
+
object-fit: cover;
|
|
99
|
+
object-position: center;
|
|
100
|
+
height: 100%;
|
|
101
|
+
width: 100%;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
import Button from "./Button";
|
|
4
|
+
import CalendarBank from "../../Icons/Time/CalendarBank/CalendarBank";
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
7
|
+
const meta = {
|
|
8
|
+
title: "Form / Button",
|
|
9
|
+
component: Button,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered",
|
|
12
|
+
},
|
|
13
|
+
tags: ["autodocs"],
|
|
14
|
+
} satisfies Meta<typeof Button>;
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof Button>;
|
|
18
|
+
|
|
19
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
20
|
+
export const Primary: Story = {
|
|
21
|
+
args: {
|
|
22
|
+
label: "Button Text",
|
|
23
|
+
style: "solid",
|
|
24
|
+
size: "default",
|
|
25
|
+
scheme: "primary",
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Secondary: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
label: "Button Text",
|
|
32
|
+
style: "hollow",
|
|
33
|
+
size: "default",
|
|
34
|
+
scheme: "primary",
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Borderless: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
label: "Button Text",
|
|
41
|
+
style: "no-border",
|
|
42
|
+
size: "default",
|
|
43
|
+
scheme: "primary",
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const WithPrimaryIcon: Story = {
|
|
48
|
+
args: {
|
|
49
|
+
label: "Button Text",
|
|
50
|
+
style: "solid",
|
|
51
|
+
size: "default",
|
|
52
|
+
scheme: "primary",
|
|
53
|
+
primaryIcon: <CalendarBank />,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const WithPrimaryIconAndSecondaryIcon: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
label: "Button Text",
|
|
60
|
+
style: "solid",
|
|
61
|
+
size: "default",
|
|
62
|
+
scheme: "primary",
|
|
63
|
+
primaryIcon: <CalendarBank />,
|
|
64
|
+
secondaryIcon: <CalendarBank />,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import cx from "classnames";
|
|
2
|
+
import ButtonProps from "./ButtonProps";
|
|
3
|
+
import styles from "./button.module.scss";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Primary UI component for user interaction
|
|
7
|
+
*/
|
|
8
|
+
const Button = (props: ButtonProps) => {
|
|
9
|
+
const {
|
|
10
|
+
type = "button",
|
|
11
|
+
size = "default",
|
|
12
|
+
style,
|
|
13
|
+
disabled = false,
|
|
14
|
+
scheme,
|
|
15
|
+
label,
|
|
16
|
+
primaryIcon,
|
|
17
|
+
secondaryIcon,
|
|
18
|
+
...args
|
|
19
|
+
} = props;
|
|
20
|
+
|
|
21
|
+
const classes = [
|
|
22
|
+
"button",
|
|
23
|
+
"btn",
|
|
24
|
+
`btn-${size}`,
|
|
25
|
+
`btn-${style}`,
|
|
26
|
+
`btn-${scheme}`,
|
|
27
|
+
styles.button,
|
|
28
|
+
];
|
|
29
|
+
if (size === "large") {
|
|
30
|
+
classes.push(styles.large);
|
|
31
|
+
} else if (size === "small") {
|
|
32
|
+
classes.push(styles.small);
|
|
33
|
+
} else if (size === "default") {
|
|
34
|
+
classes.push(styles.default);
|
|
35
|
+
}
|
|
36
|
+
if (style === "solid") {
|
|
37
|
+
classes.push(styles.solid);
|
|
38
|
+
classes.push(styles[`solid-${scheme}`]);
|
|
39
|
+
} else if (style === "hollow") {
|
|
40
|
+
classes.push(styles.hollow);
|
|
41
|
+
classes.push(styles[`hollow-${scheme}`]);
|
|
42
|
+
} else if (style === "no-border") {
|
|
43
|
+
classes.push(styles.noBorder);
|
|
44
|
+
classes.push(styles[`no-border-${scheme}`]);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (disabled === true) {
|
|
48
|
+
classes.push(styles.disabled);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
console.log(styles);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<button type={type} className={cx(classes)} disabled={disabled} {...args}>
|
|
55
|
+
{primaryIcon && <div className={styles.primaryIcon}>{primaryIcon}</div>}
|
|
56
|
+
{label}
|
|
57
|
+
{secondaryIcon && (
|
|
58
|
+
<div className={styles.secondaryIcon}>{primaryIcon}</div>
|
|
59
|
+
)}
|
|
60
|
+
</button>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default Button;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
interface ButtonProps {
|
|
4
|
+
type?: "button" | "submit" | "reset";
|
|
5
|
+
size?: "default" | "large" | "small";
|
|
6
|
+
style?: "solid" | "hollow" | "no-border";
|
|
7
|
+
scheme?: "primary" | "secondary" | "gray";
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
// icon?: ReactNode;
|
|
10
|
+
primaryIcon?: ReactNode;
|
|
11
|
+
secondaryIcon?: ReactNode;
|
|
12
|
+
label: string;
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
onHover?: () => void;
|
|
15
|
+
onFocus?: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default ButtonProps;
|