@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,33 @@
|
|
|
1
|
+
import {MouseEvent, FocusEvent} from "react";
|
|
2
|
+
|
|
3
|
+
interface NameValueInterface {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string|number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface DropdownFieldProps {
|
|
9
|
+
name?: string;
|
|
10
|
+
id?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
options: NameValueInterface[]|string[]
|
|
13
|
+
extraClass?: string;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
error?: boolean;
|
|
16
|
+
disabled?:boolean;
|
|
17
|
+
readonly?: boolean;
|
|
18
|
+
autoComplete?: boolean;
|
|
19
|
+
minLength?: number;
|
|
20
|
+
maxLength?: number;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
ariaLabel?: string;
|
|
23
|
+
ariaLabeledby?: string;
|
|
24
|
+
ariaDescribedby?: string;
|
|
25
|
+
onClick?: (e: MouseEvent) => void;
|
|
26
|
+
onChange?: (e: MouseEvent) => void;
|
|
27
|
+
onFocus?: (e: FocusEvent) => void;
|
|
28
|
+
onBlur?: (e: FocusEvent) => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type { NameValueInterface };
|
|
32
|
+
|
|
33
|
+
export default DropdownFieldProps;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import DropdownFieldSelectorProps from "./DropdownFieldSelectorProps";
|
|
3
|
+
import styles from './dropdown.module.scss';
|
|
4
|
+
|
|
5
|
+
const DropdownFieldSelector = (props: DropdownFieldSelectorProps) => {
|
|
6
|
+
|
|
7
|
+
const classes = [styles.dropdownSelector];
|
|
8
|
+
|
|
9
|
+
return <div className={cx(classes)}>
|
|
10
|
+
{props.children}
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default DropdownFieldSelector;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
.dropdown {
|
|
2
|
+
position: relative;
|
|
3
|
+
|
|
4
|
+
.control {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 48px;
|
|
10
|
+
padding: var(--space-unit) calc(var(--space-unit) * 3);
|
|
11
|
+
border: 1px solid var(--color-gray-300);
|
|
12
|
+
border-radius: 6px;
|
|
13
|
+
font-family: var(--font);
|
|
14
|
+
font-size: var(--font-size-input);
|
|
15
|
+
line-height: var(--line-height-input);
|
|
16
|
+
font-weight: var(--line-height-input);
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.disabled {
|
|
21
|
+
cursor: not-allowed;
|
|
22
|
+
opacity: 0.3;
|
|
23
|
+
pointer-events: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.label {
|
|
27
|
+
flex-grow: 1;
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
text-overflow: ellipsis;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
padding-right: calc(var(--space-unit) * 3);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.placeholder {
|
|
35
|
+
white-space: nowrap;
|
|
36
|
+
text-overflow: ellipsis;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
flex-grow: 1;
|
|
39
|
+
color: var(--color-gray-500);
|
|
40
|
+
font-size: var(--font-size-input);
|
|
41
|
+
line-height: var(--line-height-input);
|
|
42
|
+
font-weight: var(--font-weight-input);
|
|
43
|
+
padding-right: calc(var(--space-unit) * 3);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.chevron {
|
|
47
|
+
width: 16px;
|
|
48
|
+
height: 16px;
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
|
|
53
|
+
svg {
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: auto;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.dropdownSelector {
|
|
61
|
+
width: 100%;
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
position: absolute;
|
|
65
|
+
padding: calc(var(--space-unit) * 2) 0;
|
|
66
|
+
border-radius: 4px;
|
|
67
|
+
background-color: var(--color-white);
|
|
68
|
+
box-shadow: var(--drop-shadow-default);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.dropdownItem {
|
|
72
|
+
padding: calc(var(--space-unit) * 2);
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
|
|
75
|
+
&.active,
|
|
76
|
+
&:hover {
|
|
77
|
+
background-color: var(--color-gray-50);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import EmailField from './EmailField.tsx';
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Form / EmailField',
|
|
8
|
+
component: EmailField,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
},
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
} satisfies Meta<typeof EmailField>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof EmailField>;
|
|
17
|
+
|
|
18
|
+
export const Example: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
placeholder:"Placeholder",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import styles from '../inputs.module.scss' ;
|
|
3
|
+
import InputProps from "../InputProps";
|
|
4
|
+
|
|
5
|
+
const EmailField = (props: InputProps) => {
|
|
6
|
+
const {
|
|
7
|
+
name,
|
|
8
|
+
id,
|
|
9
|
+
value,
|
|
10
|
+
placeholder,
|
|
11
|
+
extraClass,
|
|
12
|
+
disabled,
|
|
13
|
+
error,
|
|
14
|
+
ariaLabel,
|
|
15
|
+
required,
|
|
16
|
+
readonly,
|
|
17
|
+
autoComplete,
|
|
18
|
+
...args
|
|
19
|
+
} = props;
|
|
20
|
+
|
|
21
|
+
const classes = [styles.input];
|
|
22
|
+
if (error) {
|
|
23
|
+
classes.push(styles.error);
|
|
24
|
+
}
|
|
25
|
+
if (extraClass) {
|
|
26
|
+
classes.push(extraClass);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return <input
|
|
30
|
+
className={cx(classes)}
|
|
31
|
+
id={id}
|
|
32
|
+
name={name}
|
|
33
|
+
type='email'
|
|
34
|
+
value={value}
|
|
35
|
+
placeholder={placeholder}
|
|
36
|
+
disabled={disabled}
|
|
37
|
+
readOnly={readonly}
|
|
38
|
+
required={required}
|
|
39
|
+
autoComplete={autoComplete ? "on" : "off"}
|
|
40
|
+
aria-label={ariaLabel ? ariaLabel : name}
|
|
41
|
+
aria-required={required ? "true" : "false"}
|
|
42
|
+
aria-invalid={error ? "true" : "false"}
|
|
43
|
+
aria-disabled={disabled ? "true" : "false"}
|
|
44
|
+
aria-readonly={readonly ? "true" : "false"}
|
|
45
|
+
aria-autocomplete={autoComplete ? "list" : "none"}
|
|
46
|
+
{...args}
|
|
47
|
+
/>
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
export default EmailField;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
import IconButton from "./IconButton";
|
|
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 / IconButton",
|
|
9
|
+
component: IconButton,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered",
|
|
12
|
+
},
|
|
13
|
+
tags: ["autodocs"],
|
|
14
|
+
} satisfies Meta<typeof IconButton>;
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof IconButton>;
|
|
18
|
+
|
|
19
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
20
|
+
export const Primary: Story = {
|
|
21
|
+
args: {
|
|
22
|
+
icon: <CalendarBank />,
|
|
23
|
+
style: "solid",
|
|
24
|
+
size: "default",
|
|
25
|
+
scheme: "primary",
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Secondary: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
icon: <CalendarBank />,
|
|
32
|
+
style: "hollow",
|
|
33
|
+
size: "default",
|
|
34
|
+
scheme: "primary",
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Borderless: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
icon: <CalendarBank type="bold" />,
|
|
41
|
+
style: "no-border",
|
|
42
|
+
size: "default",
|
|
43
|
+
scheme: "primary",
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import cx from "classnames";
|
|
2
|
+
import styles from "./iconButton.module.scss";
|
|
3
|
+
import IconButtonProps from "./IconButtonProps";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Primary UI component for user interaction
|
|
7
|
+
*/
|
|
8
|
+
const IconButton = (props: IconButtonProps) => {
|
|
9
|
+
const {
|
|
10
|
+
type = "button",
|
|
11
|
+
size = "default",
|
|
12
|
+
style,
|
|
13
|
+
disabled = false,
|
|
14
|
+
scheme,
|
|
15
|
+
icon,
|
|
16
|
+
...args
|
|
17
|
+
} = props;
|
|
18
|
+
|
|
19
|
+
const classes = [
|
|
20
|
+
"button",
|
|
21
|
+
"btn",
|
|
22
|
+
`btn-${size}`,
|
|
23
|
+
`btn-${style}`,
|
|
24
|
+
`btn-${scheme}`,
|
|
25
|
+
styles.iconButton,
|
|
26
|
+
];
|
|
27
|
+
if (size === "large") {
|
|
28
|
+
classes.push(styles.large);
|
|
29
|
+
} else if (size === "small") {
|
|
30
|
+
classes.push(styles.small);
|
|
31
|
+
} else if (size === "default") {
|
|
32
|
+
classes.push(styles.default);
|
|
33
|
+
}
|
|
34
|
+
if (style === "solid") {
|
|
35
|
+
classes.push(styles.solid);
|
|
36
|
+
classes.push(styles[`solid-${scheme}`]);
|
|
37
|
+
} else if (style === "hollow") {
|
|
38
|
+
classes.push(styles.hollow);
|
|
39
|
+
classes.push(styles[`hollow-${scheme}`]);
|
|
40
|
+
} else if (style === "no-border") {
|
|
41
|
+
classes.push(styles.noBorder);
|
|
42
|
+
classes.push(styles[`no-border-${scheme}`]);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (disabled === true) {
|
|
46
|
+
classes.push(styles.disabled);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
console.log(styles);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<button type={type} className={cx(classes)} disabled={disabled} {...args}>
|
|
53
|
+
{icon}
|
|
54
|
+
</button>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default IconButton;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
interface IconButtonProps {
|
|
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
|
+
onClick?: () => void;
|
|
11
|
+
onHover?: () => void;
|
|
12
|
+
onFocus?: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default IconButtonProps;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
@import "../../../variables";
|
|
2
|
+
|
|
3
|
+
.iconButton {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
border-width: 1px;
|
|
8
|
+
border-style: solid;
|
|
9
|
+
border-radius: 4px;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
transition: linear all 300ms;
|
|
12
|
+
font-family: var(--font);
|
|
13
|
+
|
|
14
|
+
svg {
|
|
15
|
+
width: 20px;
|
|
16
|
+
height: 20px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&:disabled {
|
|
20
|
+
cursor: not-allowed;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.disabled {
|
|
24
|
+
opacity: 0.3;
|
|
25
|
+
cursor: not-allowed;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.primaryIcon,
|
|
29
|
+
.secondaryIcon {
|
|
30
|
+
width: 20px;
|
|
31
|
+
height: 20px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&.solid {
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.hollow {
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.noBorder {
|
|
41
|
+
border-color: transparent;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&.default {
|
|
45
|
+
padding: calc(var(--space-unit) * 3);
|
|
46
|
+
min-height: 40px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.large {
|
|
50
|
+
padding: calc(var(--space-unit) * 4);
|
|
51
|
+
min-height: 48px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.small {
|
|
55
|
+
padding: calc(var(--space-unit) * 2);
|
|
56
|
+
min-height: 32px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@each $color in $colors {
|
|
60
|
+
&.solid-#{$color} {
|
|
61
|
+
color: var(--color-lite);
|
|
62
|
+
background-color: var(--color-#{$color}-500);
|
|
63
|
+
border-color: var(--color-#{$color}-500);
|
|
64
|
+
|
|
65
|
+
&:hover:enabled {
|
|
66
|
+
background-color: var(--color-#{$color}-300);
|
|
67
|
+
border-color: var(--color-#{$color}-300);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&:active:enabled {
|
|
71
|
+
background-color: var(--color-#{$color}-600);
|
|
72
|
+
border-color: var(--color-#{$color}-600);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@each $color in $colors {
|
|
78
|
+
&.hollow-#{$color} {
|
|
79
|
+
background: transparent;
|
|
80
|
+
color: var(--color-#{$color}-800);
|
|
81
|
+
border-color: var(--color-#{$color}-600);
|
|
82
|
+
|
|
83
|
+
&:hover:enabled {
|
|
84
|
+
background: var(--color-#{$color}-100);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&:active:enabled {
|
|
88
|
+
background: var(--color-#{$color}-100);
|
|
89
|
+
border-width: 2px;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@each $color in $colors {
|
|
95
|
+
&.no-border-#{$color} {
|
|
96
|
+
background: transparent;
|
|
97
|
+
color: var(--color-#{$color}-800);
|
|
98
|
+
border-color: transparent;
|
|
99
|
+
|
|
100
|
+
&:hover:enabled {
|
|
101
|
+
background-color: var(--color-#{$color}-200);
|
|
102
|
+
color: var(--color-#{$color}-800);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&:active:enabled {
|
|
106
|
+
background-color: var(--color-#{$color}-100);
|
|
107
|
+
color: var(--color-#{$color}-800);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {FocusEvent, ChangeEvent, MouseEvent} from "react";
|
|
2
|
+
|
|
3
|
+
interface InputProps {
|
|
4
|
+
name?: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
value?: string;
|
|
7
|
+
extraClass?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
error?: boolean;
|
|
10
|
+
disabled?:boolean;
|
|
11
|
+
readonly?: boolean;
|
|
12
|
+
autoComplete?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
ariaLabel?: string;
|
|
15
|
+
minLength?: number;
|
|
16
|
+
maxLength?: number;
|
|
17
|
+
ariaLabeledby?: string;
|
|
18
|
+
ariaDescribedby?: string;
|
|
19
|
+
onClick?: (e: MouseEvent) => void;
|
|
20
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
21
|
+
onFocus?: (e: FocusEvent) => void;
|
|
22
|
+
onBlur?: (e: FocusEvent) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default InputProps;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
import PasswordField from "./PasswordField.tsx";
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Form / PasswordField",
|
|
8
|
+
component: PasswordField,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: "centered",
|
|
11
|
+
},
|
|
12
|
+
tags: ["autodocs"],
|
|
13
|
+
} satisfies Meta<typeof PasswordField>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof PasswordField>;
|
|
17
|
+
|
|
18
|
+
export const Example: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
placeholder: "Placeholder",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import cx from "classnames";
|
|
2
|
+
import InputProps from "../InputProps";
|
|
3
|
+
import styles from "../inputs.module.scss";
|
|
4
|
+
import Eye from "../../Icons/Design/Eye/Eye";
|
|
5
|
+
import EyeSlash from "../../Icons/Design/EyeSlash/EyeSlash";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
|
|
8
|
+
const PasswordField = (props: InputProps) => {
|
|
9
|
+
const {
|
|
10
|
+
name,
|
|
11
|
+
id,
|
|
12
|
+
value,
|
|
13
|
+
placeholder,
|
|
14
|
+
extraClass,
|
|
15
|
+
disabled,
|
|
16
|
+
error,
|
|
17
|
+
ariaLabel,
|
|
18
|
+
required,
|
|
19
|
+
readonly,
|
|
20
|
+
autoComplete,
|
|
21
|
+
...args
|
|
22
|
+
} = props;
|
|
23
|
+
|
|
24
|
+
const [fieldType, setFieldType] = useState("password");
|
|
25
|
+
|
|
26
|
+
const onPasswordChange = () => {
|
|
27
|
+
setFieldType(fieldType === "password" ? "text" : "password");
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const classes = [styles.input];
|
|
31
|
+
if (error) {
|
|
32
|
+
classes.push(styles.error);
|
|
33
|
+
}
|
|
34
|
+
if (extraClass) {
|
|
35
|
+
classes.push(extraClass);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div className={styles.passwordCon}>
|
|
40
|
+
<input
|
|
41
|
+
className={cx(classes)}
|
|
42
|
+
id={id}
|
|
43
|
+
name={name}
|
|
44
|
+
type={fieldType}
|
|
45
|
+
value={value}
|
|
46
|
+
placeholder={placeholder}
|
|
47
|
+
disabled={disabled}
|
|
48
|
+
readOnly={readonly}
|
|
49
|
+
required={required}
|
|
50
|
+
autoComplete={autoComplete ? "on" : "off"}
|
|
51
|
+
aria-label={ariaLabel ? ariaLabel : name}
|
|
52
|
+
aria-required={required ? "true" : "false"}
|
|
53
|
+
aria-invalid={error ? "true" : "false"}
|
|
54
|
+
aria-disabled={disabled ? "true" : "false"}
|
|
55
|
+
aria-readonly={readonly ? "true" : "false"}
|
|
56
|
+
aria-autocomplete={autoComplete ? "list" : "none"}
|
|
57
|
+
{...args}
|
|
58
|
+
/>
|
|
59
|
+
<span onClick={onPasswordChange} className={styles.eyeicon}>
|
|
60
|
+
{fieldType == "password" ? (
|
|
61
|
+
<Eye type="regular" />
|
|
62
|
+
) : (
|
|
63
|
+
<EyeSlash type="regular" />
|
|
64
|
+
)}
|
|
65
|
+
</span>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default PasswordField;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import cx from "classnames";
|
|
2
|
+
import RadioButtonProps from "./RadioButtonProps";
|
|
3
|
+
import styles from "./radiobutton.module.scss";
|
|
4
|
+
import { useEffect, useState, MouseEvent } from "react";
|
|
5
|
+
|
|
6
|
+
const RadioButton = (props: RadioButtonProps) => {
|
|
7
|
+
const {
|
|
8
|
+
name,
|
|
9
|
+
checked,
|
|
10
|
+
id,
|
|
11
|
+
value,
|
|
12
|
+
placeholder,
|
|
13
|
+
extraClass,
|
|
14
|
+
disabled,
|
|
15
|
+
error,
|
|
16
|
+
ariaLabel,
|
|
17
|
+
required,
|
|
18
|
+
readonly,
|
|
19
|
+
onChange,
|
|
20
|
+
...args
|
|
21
|
+
} = props;
|
|
22
|
+
|
|
23
|
+
const [isChecked, setIsChecked] = useState(false);
|
|
24
|
+
|
|
25
|
+
const classes = ["radio", styles.radio];
|
|
26
|
+
|
|
27
|
+
if (extraClass) {
|
|
28
|
+
classes.push(extraClass);
|
|
29
|
+
}
|
|
30
|
+
if (error) {
|
|
31
|
+
classes.push(styles.error);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
setIsChecked(checked || false);
|
|
36
|
+
}, [checked]);
|
|
37
|
+
|
|
38
|
+
const handleClick = (e: MouseEvent) => {
|
|
39
|
+
setIsChecked(true);
|
|
40
|
+
if (onChange) {
|
|
41
|
+
onChange(e, true);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div className={cx(classes)}>
|
|
47
|
+
<input
|
|
48
|
+
id={id}
|
|
49
|
+
name={name}
|
|
50
|
+
checked={isChecked}
|
|
51
|
+
type={"radio"}
|
|
52
|
+
value={value}
|
|
53
|
+
placeholder={placeholder}
|
|
54
|
+
disabled={disabled}
|
|
55
|
+
readOnly={readonly}
|
|
56
|
+
required={required}
|
|
57
|
+
aria-label={ariaLabel ? ariaLabel : name}
|
|
58
|
+
aria-required={required ? "true" : "false"}
|
|
59
|
+
aria-invalid={error ? "true" : "false"}
|
|
60
|
+
aria-disabled={disabled ? "true" : "false"}
|
|
61
|
+
aria-readonly={readonly ? "true" : "false"}
|
|
62
|
+
onClick={handleClick}
|
|
63
|
+
{...args}
|
|
64
|
+
/>
|
|
65
|
+
<div className={styles.circle}></div>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default RadioButton;
|