@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.
Files changed (230) hide show
  1. package/.editorconfig +17 -0
  2. package/.eslintrc.cjs +14 -0
  3. package/.storybook/main.ts +23 -0
  4. package/.storybook/preview.ts +17 -0
  5. package/README.md +30 -0
  6. package/index.html +13 -0
  7. package/package.json +45 -0
  8. package/public/image/table-image.png +0 -0
  9. package/public/vite.svg +1 -0
  10. package/src/App.tsx +30 -0
  11. package/src/Components/DataDisplay/Accordion/Accordion.stories.tsx +57 -0
  12. package/src/Components/DataDisplay/Accordion/Accordion.tsx +14 -0
  13. package/src/Components/DataDisplay/Accordion/AccordionContext.tsx +11 -0
  14. package/src/Components/DataDisplay/Accordion/AccordionContextInterface.tsx +8 -0
  15. package/src/Components/DataDisplay/Accordion/AccordionItem.tsx +62 -0
  16. package/src/Components/DataDisplay/Accordion/AccordionItemProps.tsx +12 -0
  17. package/src/Components/DataDisplay/Accordion/AccordionProps.tsx +8 -0
  18. package/src/Components/DataDisplay/Accordion/AccordionProvider.tsx +65 -0
  19. package/src/Components/DataDisplay/Accordion/AccordionProviderInterface.tsx +8 -0
  20. package/src/Components/DataDisplay/Accordion/accordion.module.scss +56 -0
  21. package/src/Components/DataDisplay/Badge/Badge.stories.tsx +44 -0
  22. package/src/Components/DataDisplay/Badge/Badge.tsx +32 -0
  23. package/src/Components/DataDisplay/Badge/BadgeProps.tsx +6 -0
  24. package/src/Components/DataDisplay/Badge/badge.module.scss +42 -0
  25. package/src/Components/DataDisplay/Cards/BannerCard/BannerCard.stories.tsx +26 -0
  26. package/src/Components/DataDisplay/Cards/BannerCard/BannerCard.tsx +47 -0
  27. package/src/Components/DataDisplay/Cards/BannerCard/BannerCardInterface.tsx +15 -0
  28. package/src/Components/DataDisplay/Cards/BannerCard/banner-card.scss +54 -0
  29. package/src/Components/DataDisplay/Cards/PathwayCard/PathwayCard.stories.tsx +31 -0
  30. package/src/Components/DataDisplay/Cards/PathwayCard/PathwayCard.tsx +53 -0
  31. package/src/Components/DataDisplay/Cards/PathwayCard/PathwayCardInterface.tsx +17 -0
  32. package/src/Components/DataDisplay/Cards/PathwayCard/pathway-card-stories.scss +3 -0
  33. package/src/Components/DataDisplay/Cards/PathwayCard/pathway-card.scss +62 -0
  34. package/src/Components/DataDisplay/Media/Media.tsx +26 -0
  35. package/src/Components/DataDisplay/Media/MediaProps.tsx +9 -0
  36. package/src/Components/DataDisplay/Media/media.scss +0 -0
  37. package/src/Components/DataDisplay/Modal/Modal.tsx +5 -0
  38. package/src/Components/DataDisplay/Modal/ModalActions.tsx +5 -0
  39. package/src/Components/DataDisplay/Modal/ModalActionsLeft.tsx +5 -0
  40. package/src/Components/DataDisplay/Modal/ModalActionsRight.tsx +5 -0
  41. package/src/Components/DataDisplay/Modal/ModalBody.tsx +5 -0
  42. package/src/Components/DataDisplay/Modal/ModalCurtain.tsx +5 -0
  43. package/src/Components/DataDisplay/Modal/ModalHeader.tsx +5 -0
  44. package/src/Components/DataDisplay/NotificationsBell/NotificationBell.stories.tsx +27 -0
  45. package/src/Components/DataDisplay/NotificationsBell/NotificationsBell.tsx +51 -0
  46. package/src/Components/DataDisplay/NotificationsBell/NotificationsBellProps.tsx +9 -0
  47. package/src/Components/DataDisplay/NotificationsBell/notificationBell.module.scss +48 -0
  48. package/src/Components/DataDisplay/NotificationsPanel/Notification.stories.tsx +128 -0
  49. package/src/Components/DataDisplay/NotificationsPanel/Notification.tsx +59 -0
  50. package/src/Components/DataDisplay/NotificationsPanel/NotificationProps.tsx +11 -0
  51. package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroup.tsx +17 -0
  52. package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroupProps.tsx +8 -0
  53. package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroups.tsx +42 -0
  54. package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroupsProps.tsx +7 -0
  55. package/src/Components/DataDisplay/NotificationsPanel/NotificationsHeader.tsx +27 -0
  56. package/src/Components/DataDisplay/NotificationsPanel/NotificationsHeaderProps.tsx +9 -0
  57. package/src/Components/DataDisplay/NotificationsPanel/NotificationsNone.tsx +11 -0
  58. package/src/Components/DataDisplay/NotificationsPanel/NotificationsPanel.tsx +8 -0
  59. package/src/Components/DataDisplay/NotificationsPanel/NotificationsPanelProps.tsx +7 -0
  60. package/src/Components/DataDisplay/NotificationsPanel/notificationPanel.module.scss +196 -0
  61. package/src/Components/DataDisplay/Tab/Tab.stories.tsx +72 -0
  62. package/src/Components/DataDisplay/Tab/Tab.tsx +20 -0
  63. package/src/Components/DataDisplay/Tab/TabBody.tsx +6 -0
  64. package/src/Components/DataDisplay/Tab/TabBodyContent.tsx +15 -0
  65. package/src/Components/DataDisplay/Tab/TabBodyContentProps.tsx +9 -0
  66. package/src/Components/DataDisplay/Tab/TabBodyProps.tsx +8 -0
  67. package/src/Components/DataDisplay/Tab/TabContext.tsx +9 -0
  68. package/src/Components/DataDisplay/Tab/TabContextProps.tsx +6 -0
  69. package/src/Components/DataDisplay/Tab/TabNav.tsx +6 -0
  70. package/src/Components/DataDisplay/Tab/TabNavItem.tsx +49 -0
  71. package/src/Components/DataDisplay/Tab/TabNavItemProps.tsx +9 -0
  72. package/src/Components/DataDisplay/Tab/TabNavProps.tsx +8 -0
  73. package/src/Components/DataDisplay/Tab/TabProps.tsx +8 -0
  74. package/src/Components/DataDisplay/Tab/tab.module.scss +35 -0
  75. package/src/Components/DataDisplay/Tab/tab.stories.scss +3 -0
  76. package/src/Components/DataDisplay/Table/Table.stories.tsx +64 -0
  77. package/src/Components/DataDisplay/Table/Table.tsx +10 -0
  78. package/src/Components/DataDisplay/Table/TableBody.tsx +13 -0
  79. package/src/Components/DataDisplay/Table/TableBodyProps.tsx +8 -0
  80. package/src/Components/DataDisplay/Table/TableCell.tsx +30 -0
  81. package/src/Components/DataDisplay/Table/TableCellAction.tsx +27 -0
  82. package/src/Components/DataDisplay/Table/TableCellActionProps.tsx +11 -0
  83. package/src/Components/DataDisplay/Table/TableCellProps.tsx +11 -0
  84. package/src/Components/DataDisplay/Table/TableCellWithDesc.tsx +21 -0
  85. package/src/Components/DataDisplay/Table/TableCellWithDescProps.tsx +9 -0
  86. package/src/Components/DataDisplay/Table/TableCellWithImage.tsx +39 -0
  87. package/src/Components/DataDisplay/Table/TableCellWithImageProps.tsx +10 -0
  88. package/src/Components/DataDisplay/Table/TableFooter.tsx +5 -0
  89. package/src/Components/DataDisplay/Table/TableHead.tsx +11 -0
  90. package/src/Components/DataDisplay/Table/TableHeadProps.tsx +8 -0
  91. package/src/Components/DataDisplay/Table/TableHeaderCell.tsx +17 -0
  92. package/src/Components/DataDisplay/Table/TableHeaderCellProps.tsx +10 -0
  93. package/src/Components/DataDisplay/Table/TableProps.tsx +8 -0
  94. package/src/Components/DataDisplay/Table/TableRow.tsx +9 -0
  95. package/src/Components/DataDisplay/Table/TableRowProps.tsx +8 -0
  96. package/src/Components/DataDisplay/Table/table.module.scss +103 -0
  97. package/src/Components/Form/Button/Button.stories.tsx +66 -0
  98. package/src/Components/Form/Button/Button.tsx +64 -0
  99. package/src/Components/Form/Button/ButtonProps.tsx +18 -0
  100. package/src/Components/Form/Button/button.module.scss +142 -0
  101. package/src/Components/Form/Checkbox/Checkbox.stories.tsx +49 -0
  102. package/src/Components/Form/Checkbox/Checkbox.tsx +85 -0
  103. package/src/Components/Form/Checkbox/CheckboxProps.tsx +22 -0
  104. package/src/Components/Form/Checkbox/checkbox.module.scss +63 -0
  105. package/src/Components/Form/CheckboxSelect/CheckboxSelect.tsx +5 -0
  106. package/src/Components/Form/CheckboxSelect/CheckboxSelectItem.tsx +5 -0
  107. package/src/Components/Form/CheckboxSet/CheckboxSet.stories.tsx +93 -0
  108. package/src/Components/Form/CheckboxSet/CheckboxSet.tsx +14 -0
  109. package/src/Components/Form/CheckboxSet/CheckboxSetItem.tsx +88 -0
  110. package/src/Components/Form/CheckboxSet/CheckboxSetProps.tsx +9 -0
  111. package/src/Components/Form/CheckboxSet/checkboxSet.module.scss +13 -0
  112. package/src/Components/Form/CurrencyField/CurrenctField.stories.tsx +22 -0
  113. package/src/Components/Form/CurrencyField/CurrencyField.tsx +59 -0
  114. package/src/Components/Form/CurrencyField/CurrencyFieldProps.tsx +8 -0
  115. package/src/Components/Form/DateField/DateField.stories.tsx +22 -0
  116. package/src/Components/Form/DateField/DateField.tsx +58 -0
  117. package/src/Components/Form/DropdownBadge/DropdownBadge.stories.tsx +49 -0
  118. package/src/Components/Form/DropdownBadge/DropdownBadge.tsx +160 -0
  119. package/src/Components/Form/DropdownBadge/DropdownBadgeItem.tsx +40 -0
  120. package/src/Components/Form/DropdownBadge/DropdownBadgeItemProps.tsx +10 -0
  121. package/src/Components/Form/DropdownBadge/DropdownBadgeProps.tsx +31 -0
  122. package/src/Components/Form/DropdownBadge/DropdownBadgeSelector.tsx +11 -0
  123. package/src/Components/Form/DropdownBadge/DropdownBadgeSelectorProps.tsx +7 -0
  124. package/src/Components/Form/DropdownBadge/dropdownBadge.module.scss +105 -0
  125. package/src/Components/Form/DropdownField/DropdownField.stories.tsx +50 -0
  126. package/src/Components/Form/DropdownField/DropdownField.tsx +118 -0
  127. package/src/Components/Form/DropdownField/DropdownFieldItem.tsx +26 -0
  128. package/src/Components/Form/DropdownField/DropdownFieldItemProps.tsx +9 -0
  129. package/src/Components/Form/DropdownField/DropdownFieldProps.tsx +33 -0
  130. package/src/Components/Form/DropdownField/DropdownFieldSelector.tsx +15 -0
  131. package/src/Components/Form/DropdownField/DropdownFieldSelectorProps.tsx +7 -0
  132. package/src/Components/Form/DropdownField/dropdown.module.scss +79 -0
  133. package/src/Components/Form/EmailField/EmailField.stories.ts +23 -0
  134. package/src/Components/Form/EmailField/EmailField.tsx +51 -0
  135. package/src/Components/Form/ErrorMessage/ErrorMessage.tsx +5 -0
  136. package/src/Components/Form/FormFieldHolder/FormFieldHolder.tsx +5 -0
  137. package/src/Components/Form/IconButton/IconButton.stories.tsx +45 -0
  138. package/src/Components/Form/IconButton/IconButton.tsx +58 -0
  139. package/src/Components/Form/IconButton/IconButtonProps.tsx +15 -0
  140. package/src/Components/Form/IconButton/iconButton.module.scss +111 -0
  141. package/src/Components/Form/InputProps.tsx +25 -0
  142. package/src/Components/Form/MultiSelectField/MultiSelectField.tsx +5 -0
  143. package/src/Components/Form/MultiSelectField/MultiSelectFieldItem.tsx +5 -0
  144. package/src/Components/Form/MultiSelectField/MultiSelectFieldTag.tsx +5 -0
  145. package/src/Components/Form/PasswordField/PasswordField.stories.tsx +22 -0
  146. package/src/Components/Form/PasswordField/PasswordField.tsx +70 -0
  147. package/src/Components/Form/RadioButtons/RadioButton.tsx +70 -0
  148. package/src/Components/Form/RadioButtons/RadioButtonProps.tsx +22 -0
  149. package/src/Components/Form/RadioButtons/RadioButtons.stories.tsx +64 -0
  150. package/src/Components/Form/RadioButtons/RadioButtons.tsx +18 -0
  151. package/src/Components/Form/RadioButtons/RadioButtonsProps.tsx +10 -0
  152. package/src/Components/Form/RadioButtons/radioButton.stories.scss +3 -0
  153. package/src/Components/Form/RadioButtons/radiobutton.module.scss +63 -0
  154. package/src/Components/Form/TextField/TextField.stories.ts +23 -0
  155. package/src/Components/Form/TextField/TextField.tsx +52 -0
  156. package/src/Components/Form/Textarea/Textarea.stories.ts +31 -0
  157. package/src/Components/Form/Textarea/Textarea.tsx +71 -0
  158. package/src/Components/Form/Textarea/TextareaProps.tsx +27 -0
  159. package/src/Components/Form/Textarea/textarea.module.scss +49 -0
  160. package/src/Components/Form/TimeField/TimeField.stories.tsx +22 -0
  161. package/src/Components/Form/TimeField/TimeField.tsx +58 -0
  162. package/src/Components/Form/ToggleSwitch/ToggleSwitch.stories.tsx +49 -0
  163. package/src/Components/Form/ToggleSwitch/ToggleSwitch.tsx +87 -0
  164. package/src/Components/Form/ToggleSwitch/ToggleSwitchProps.tsx +22 -0
  165. package/src/Components/Form/ToggleSwitch/toggleSwitch.module.scss +82 -0
  166. package/src/Components/Form/inputs.module.scss +121 -0
  167. package/src/Components/Icons/Arrows/CaretDown/CaretDown.tsx +49 -0
  168. package/src/Components/Icons/Arrows/CaretUp/CaretUp.tsx +49 -0
  169. package/src/Components/Icons/Commerce/CurrencyDollarSimple/CurrencyDollarSimple.tsx +105 -0
  170. package/src/Components/Icons/Communication/AddressBook/AddressBook.stories.ts +28 -0
  171. package/src/Components/Icons/Communication/AddressBook/AddressBook.tsx +50 -0
  172. package/src/Components/Icons/Communication/Asterick/Asterisk.stories.ts +28 -0
  173. package/src/Components/Icons/Communication/Asterick/Asterisk.tsx +50 -0
  174. package/src/Components/Icons/Communication/AsterickSimple/AsteriskSimple.stories.ts +28 -0
  175. package/src/Components/Icons/Communication/AsterickSimple/AsteriskSimple.tsx +49 -0
  176. package/src/Components/Icons/Communication/At/At.stories.ts +28 -0
  177. package/src/Components/Icons/Communication/At/At.tsx +49 -0
  178. package/src/Components/Icons/Communication/Broadcast/Broadcast.stories.ts +27 -0
  179. package/src/Components/Icons/Communication/Broadcast/Broadcast.tsx +49 -0
  180. package/src/Components/Icons/Communication/Chat/Chat.stories.ts +28 -0
  181. package/src/Components/Icons/Communication/Chat/Chat.tsx +49 -0
  182. package/src/Components/Icons/Design/Eye/Eye.tsx +105 -0
  183. package/src/Components/Icons/Design/EyeSlash/EyeSlash.tsx +105 -0
  184. package/src/Components/Icons/IconProps.tsx +5 -0
  185. package/src/Components/Icons/MathAndFinance/XIcon/XIcon.tsx +107 -0
  186. package/src/Components/Icons/SystemAndDevice/Bell/Bell.tsx +49 -0
  187. package/src/Components/Icons/Time/CalendarBank/CalendarBank.tsx +105 -0
  188. package/src/Components/Icons/Time/Clock/Clock.tsx +105 -0
  189. package/src/Components/Layout/CalloutPopup/CalloutPopup.tsx +5 -0
  190. package/src/Components/Layout/Header/Header.tsx +5 -0
  191. package/src/Components/Layout/Header/HeaderLeft.tsx +5 -0
  192. package/src/Components/Layout/Header/HeaderRight.tsx +5 -0
  193. package/src/Components/Layout/Pagination/Pagination.tsx +5 -0
  194. package/src/Components/Layout/Pagination/PaginationFirst.tsx +5 -0
  195. package/src/Components/Layout/Pagination/PaginationLast.tsx +5 -0
  196. package/src/Components/Layout/Pagination/PaginationNext.tsx +5 -0
  197. package/src/Components/Layout/Pagination/PaginationNumber.tsx +5 -0
  198. package/src/Components/Layout/Pagination/PaginationPrevious.tsx +5 -0
  199. package/src/Components/Layout/ProfileAvatar/ProfileAvatar.tsx +5 -0
  200. package/src/Components/Layout/ProfileAvatar/ProfileAvatarProps.tsx +4 -0
  201. package/src/Components/Layout/ProfileDropdown/ProfileDropdown.tsx +5 -0
  202. package/src/Components/Layout/ProfileDropdown/ProfileHeader.tsx +5 -0
  203. package/src/Components/Layout/ProfileDropdown/ProfileLink.tsx +5 -0
  204. package/src/Components/Layout/ProfileDropdown/ProfileLinks.tsx +5 -0
  205. package/src/Components/Layout/ProfileDropdown/ProfileNavigationItem.tsx +5 -0
  206. package/src/Components/Layout/ProfileDropdown/ProfileSwitchPanel.tsx +5 -0
  207. package/src/Components/Layout/ProfileDropdown/ProfileSwitchUser.tsx +5 -0
  208. package/src/Components/Layout/Sidebar/Sidebar.tsx +5 -0
  209. package/src/Components/Layout/Sidebar/SidebarChevron.tsx +5 -0
  210. package/src/Components/Layout/Sidebar/SidebarNavigation.tsx +5 -0
  211. package/src/Components/Layout/Sidebar/SidebarNavigationItem.tsx +5 -0
  212. package/src/Components/Layout/Sidebar/SidebarSubNavigation.tsx +5 -0
  213. package/src/Notification/Notification.tsx +83 -0
  214. package/src/Notification/NotificationInterface.tsx +9 -0
  215. package/src/Notification/NotificationList.tsx +29 -0
  216. package/src/Notification/NotificationListHolder.tsx +14 -0
  217. package/src/Notification/NotificationListHolderInterface.tsx +8 -0
  218. package/src/Notification/NotificationListInterface.tsx +11 -0
  219. package/src/Notification/notification.scss +225 -0
  220. package/src/global.scss +231 -0
  221. package/src/main.tsx +9 -0
  222. package/src/variables.scss +2 -0
  223. package/src/vite-env.d.ts +1 -0
  224. package/tokens/color/color.mdx +82 -0
  225. package/tokens/shadow/shadow-panel.scss +12 -0
  226. package/tokens/shadow/shadow.mdx +34 -0
  227. package/tokens/typography/typography.mdx +31 -0
  228. package/tsconfig.json +25 -0
  229. package/tsconfig.node.json +10 -0
  230. package/vite.config.ts +7 -0
@@ -0,0 +1,22 @@
1
+ import { FocusEvent, MouseEvent } from "react";
2
+
3
+ interface RadioButtonProps {
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
+ checked?: boolean;
13
+ required?: boolean;
14
+ ariaLabel?: string;
15
+ ariaLabeledby?: string;
16
+ ariaDescribedby?: string;
17
+ onChange?: (e: MouseEvent, checked?: boolean) => void;
18
+ onFocus?: (e: FocusEvent) => void;
19
+ onBlur?: (e: FocusEvent) => void;
20
+ }
21
+
22
+ export default RadioButtonProps;
@@ -0,0 +1,64 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import RadioButtons from "./RadioButtons";
3
+ import RadioButton from "./RadioButton";
4
+
5
+ import "./radioButton.stories.scss";
6
+
7
+ const meta: Meta = {
8
+ title: "Form / Radio Button",
9
+ component: RadioButton,
10
+ parameters: {
11
+ layout: "centered",
12
+ },
13
+ tags: ["autodocs"],
14
+ };
15
+
16
+ export default meta;
17
+
18
+ type Story = StoryObj<typeof meta>;
19
+
20
+ const RadioButtoTemplate: Story = {
21
+ render: ({ items, ...args }) => {
22
+ return (
23
+ <RadioButtons {...args}>
24
+ {items.map((item: any) => (
25
+ <RadioButton extraClass={"spacing"} name={item.name} id={item.id} />
26
+ ))}
27
+ </RadioButtons>
28
+ );
29
+ },
30
+ };
31
+
32
+ export const Default = {
33
+ ...RadioButtoTemplate,
34
+ args: {
35
+ columns: false,
36
+ items: [
37
+ {
38
+ id: "c-1",
39
+ name: "check-one",
40
+ disabled: false,
41
+ },
42
+ {
43
+ id: "c-2",
44
+ name: "check-one",
45
+ },
46
+ {
47
+ id: "c-3",
48
+ name: "check-one",
49
+ },
50
+ {
51
+ id: "c-4",
52
+ name: "check-one",
53
+ },
54
+ {
55
+ id: "c-5",
56
+ name: "check-one",
57
+ },
58
+ {
59
+ id: "c-6",
60
+ name: "check-one",
61
+ },
62
+ ],
63
+ },
64
+ };
@@ -0,0 +1,18 @@
1
+ import RadioButtonsProps from "./RadioButtonsProps";
2
+ import styles from "./radiobutton.module.scss";
3
+
4
+ const RadioButtons = (props: RadioButtonsProps) => {
5
+ const { children, error, columns, extraClass } = props;
6
+
7
+ return (
8
+ <div
9
+ className={`${styles.checkboxSet} ${extraClass} ${
10
+ columns ? styles.container : ""
11
+ }`}
12
+ >
13
+ {children}
14
+ </div>
15
+ );
16
+ };
17
+
18
+ export default RadioButtons;
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from "react";
2
+
3
+ interface RadioButtonsProps {
4
+ children: ReactNode;
5
+ error?: boolean;
6
+ columns?: boolean;
7
+ extraClass?: string;
8
+ }
9
+
10
+ export default RadioButtonsProps;
@@ -0,0 +1,3 @@
1
+ .spacing {
2
+ padding: 4px;
3
+ }
@@ -0,0 +1,63 @@
1
+ .checkboxSet {
2
+ display: flex;
3
+
4
+ &.container {
5
+ flex-direction: column;
6
+ }
7
+ }
8
+
9
+ .radio {
10
+ position: relative;
11
+ display: inline-flex;
12
+ justify-content: center;
13
+ flex-shrink: 0;
14
+ flex-grow: 0;
15
+
16
+ input[type="radio"] {
17
+ -webkit-appearance: none;
18
+ width: 20px;
19
+ height: 20px;
20
+ border-radius: 100%;
21
+ background-color: var(--color-white);
22
+ border: 1px solid var(--color-gray-500);
23
+ outline-offset: 2px;
24
+ outline: 2px solid transparent;
25
+ cursor: pointer;
26
+ transition: linear 0.3s;
27
+
28
+ &:checked + .circle {
29
+ opacity: 1;
30
+ }
31
+
32
+ &:hover {
33
+ border: 2px solid var(--color-gray-800);
34
+ }
35
+
36
+ &:focus {
37
+ outline: 2px solid var(--color-gray-800);
38
+ }
39
+
40
+ &:disabled {
41
+ background-color: var(--color-gray-200);
42
+
43
+ &:checked {
44
+ border-color: var(--color-gray-200);
45
+ }
46
+ }
47
+ }
48
+
49
+ .circle {
50
+ content: "";
51
+ position: absolute;
52
+ top: 50%;
53
+ left: 50%;
54
+ transform: translate(-50%, -50%);
55
+ width: 12px;
56
+ height: 12px;
57
+ border-radius: 100%;
58
+ background-color: var(--color-gray-800);
59
+ opacity: 0;
60
+ pointer-events: none;
61
+ transition: 0.3s;
62
+ }
63
+ }
@@ -0,0 +1,23 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import TextField from './TextField.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 / TextField',
8
+ component: TextField,
9
+ parameters: {
10
+ layout: 'centered',
11
+ },
12
+ tags: ['autodocs'],
13
+ } satisfies Meta<typeof TextField>;
14
+
15
+ export default meta;
16
+ type Story = StoryObj<typeof TextField>;
17
+
18
+ export const Example: Story = {
19
+ args: {
20
+ placeholder: 'Placeholder'
21
+ },
22
+ };
23
+
@@ -0,0 +1,52 @@
1
+ import cx from "classnames";
2
+ import InputProps from "../InputProps";
3
+ import styles from "../inputs.module.scss";
4
+
5
+ const TextField = (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 (
30
+ <input
31
+ className={cx(classes)}
32
+ id={id}
33
+ name={name}
34
+ type="text"
35
+ value={value}
36
+ placeholder={placeholder}
37
+ disabled={disabled}
38
+ readOnly={readonly}
39
+ required={required}
40
+ autoComplete={autoComplete ? "on" : "off"}
41
+ aria-label={ariaLabel ? ariaLabel : name}
42
+ aria-required={required ? "true" : "false"}
43
+ aria-invalid={error ? "true" : "false"}
44
+ aria-disabled={disabled ? "true" : "false"}
45
+ aria-readonly={readonly ? "true" : "false"}
46
+ aria-autocomplete={autoComplete ? "list" : "none"}
47
+ {...args}
48
+ />
49
+ );
50
+ };
51
+
52
+ export default TextField;
@@ -0,0 +1,31 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import Textarea from './Textarea.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 / Textarea',
8
+ component: Textarea,
9
+ parameters: {
10
+ layout: 'centered',
11
+ },
12
+ tags: ['autodocs'],
13
+ } satisfies Meta<typeof Textarea>;
14
+
15
+ export default meta;
16
+ type Story = StoryObj<typeof Textarea>;
17
+
18
+ export const Example:Story = {
19
+ args: {
20
+ placeholder: 'Placeholder'
21
+ },
22
+ };
23
+
24
+ export const MaxLength:Story = {
25
+ args: {
26
+ placeholder: 'Placeholder',
27
+ maxLength: 500,
28
+ displayChars: true
29
+ },
30
+ };
31
+
@@ -0,0 +1,71 @@
1
+ import React, {useState} from "react";
2
+ import cx from 'classnames';
3
+ import TextareaProps from "./TextareaProps";
4
+ import styles from './textarea.module.scss';
5
+
6
+ const Textarea = (props: TextareaProps) => {
7
+ const {
8
+ name,
9
+ id,
10
+ value,
11
+ placeholder,
12
+ extraClass,
13
+ disabled,
14
+ error,
15
+ ariaLabel,
16
+ required,
17
+ readonly,
18
+ autoComplete,
19
+ rows,
20
+ displayChars,
21
+ maxLength,
22
+ onChange,
23
+ ...args
24
+ } = props;
25
+
26
+
27
+ const [text, setText] = useState('');
28
+
29
+ const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
30
+ setText(e.target?.value);
31
+ if (onChange) {
32
+ onChange(e);
33
+ }
34
+ };
35
+
36
+ const classes = [styles.textarea];
37
+ if (error) {
38
+ classes.push(styles.error);
39
+ }
40
+ if (extraClass) {
41
+ classes.push(extraClass);
42
+ }
43
+
44
+ return <>
45
+ <textarea
46
+ className={cx(classes)}
47
+ id={id}
48
+ name={name}
49
+ value={value}
50
+ placeholder={placeholder}
51
+ rows={rows}
52
+ onChange={handleChange}
53
+ disabled={disabled}
54
+ readOnly={readonly}
55
+ required={required}
56
+ autoComplete={autoComplete ? "on" : "off"}
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
+ aria-autocomplete={autoComplete ? "list" : "none"}
63
+ {...args}
64
+ />
65
+ {!!displayChars && <p className={styles.length}>
66
+ {text.length} / {maxLength}
67
+ </p>}
68
+ </>
69
+ };
70
+
71
+ export default Textarea;
@@ -0,0 +1,27 @@
1
+ import {FocusEvent, MouseEvent, ChangeEvent} from 'react'
2
+
3
+ interface TextareaProps {
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
+ minLength?: number;
14
+ maxLength?: number;
15
+ required?: boolean;
16
+ ariaLabel?: string;
17
+ ariaLabeledby?: string;
18
+ ariaDescribedby?: string;
19
+ rows?: number,
20
+ displayChars?: boolean,
21
+ onClick?: (e: MouseEvent) => void;
22
+ onChange?: (e: ChangeEvent<HTMLTextAreaElement>) => void;
23
+ onFocus?: (e: FocusEvent) => void;
24
+ onBlur?: (e: FocusEvent) => void;
25
+ }
26
+
27
+ export default TextareaProps;
@@ -0,0 +1,49 @@
1
+ .textarea {
2
+ display: inline-block;
3
+ border: 1px solid var(--color-gray-300);
4
+ border-radius: 6px;
5
+ resize: none;
6
+ padding: calc(var(--space-unit) * 3);
7
+ width: 100%;
8
+ height: 96px;
9
+ font-family: var(--font);
10
+ font-size: var(--font-size-input);
11
+ line-height: var(--line-height-input);
12
+ font-weight: var(--font-weight-input);
13
+
14
+ &::placeholder {
15
+ font-family: var(--font);
16
+ color: var(--color-gray-500);
17
+ font-size: var(--font-size-input);
18
+ line-height: var(--line-height-input);
19
+ font-weight: var(--font-weight-input);
20
+ }
21
+
22
+ &:focus {
23
+ outline: none;
24
+ border: 2px solid var(--color-gray-900);
25
+ }
26
+
27
+ &:disabled{
28
+ cursor: not-allowed;
29
+ opacity: 0.3;
30
+ }
31
+
32
+ &.error {
33
+ border: 1px solid var(--color-error);
34
+ background: var(--color-error-lite);
35
+
36
+ &:focus {
37
+ border: 2px solid var(--color-error);
38
+ background: #ffffff;
39
+ }
40
+ }
41
+ }
42
+
43
+ .length {
44
+ display: flex;
45
+ justify-content: flex-end;
46
+ font-size: 12px;
47
+ }
48
+
49
+
@@ -0,0 +1,22 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+
3
+ import TimeField from "./TimeField";
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 / TimeField",
8
+ component: TimeField,
9
+ parameters: {
10
+ layout: "centered",
11
+ },
12
+ tags: ["autodocs"],
13
+ } satisfies Meta<typeof TimeField>;
14
+
15
+ export default meta;
16
+ type Story = StoryObj<typeof TimeField>;
17
+
18
+ export const Example: Story = {
19
+ args: {
20
+ placeholder: "Placeholder",
21
+ },
22
+ };
@@ -0,0 +1,58 @@
1
+ import cx from "classnames";
2
+ import InputProps from "../InputProps";
3
+ import styles from "../inputs.module.scss";
4
+ import Clock from "../../Icons/Time/Clock/Clock";
5
+
6
+ const TimeField = (props: InputProps) => {
7
+ const {
8
+ name,
9
+ id,
10
+ value,
11
+ placeholder,
12
+ extraClass,
13
+ disabled,
14
+ error,
15
+ ariaLabel,
16
+ required,
17
+ readonly,
18
+ autoComplete,
19
+ ...args
20
+ } = props;
21
+
22
+ const classes = [styles.input];
23
+ if (error) {
24
+ classes.push(styles.error);
25
+ }
26
+ if (extraClass) {
27
+ classes.push(extraClass);
28
+ }
29
+
30
+ return (
31
+ <div className={styles.time}>
32
+ <input
33
+ className={cx(classes)}
34
+ id={id}
35
+ name={name}
36
+ type="time"
37
+ value={value}
38
+ placeholder={placeholder}
39
+ disabled={disabled}
40
+ readOnly={readonly}
41
+ required={required}
42
+ autoComplete={autoComplete ? "on" : "off"}
43
+ aria-label={ariaLabel ? ariaLabel : name}
44
+ aria-required={required ? "true" : "false"}
45
+ aria-invalid={error ? "true" : "false"}
46
+ aria-disabled={disabled ? "true" : "false"}
47
+ aria-readonly={readonly ? "true" : "false"}
48
+ pattern="[0-2][0-9]:[0-5][0-9]" // 24-hour format pattern
49
+ {...args}
50
+ />
51
+ <div className={styles.clockIcon}>
52
+ <Clock type="light" />
53
+ </div>
54
+ </div>
55
+ );
56
+ };
57
+
58
+ export default TimeField;
@@ -0,0 +1,49 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import ToggleSwitch from "./ToggleSwitch";
3
+
4
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
5
+ const meta = {
6
+ title: "Form / ToggleSwitch",
7
+ component: ToggleSwitch,
8
+ parameters: {
9
+ layout: "centered",
10
+ },
11
+ tags: ["autodocs"],
12
+ } satisfies Meta<typeof ToggleSwitch>;
13
+
14
+ export default meta;
15
+ type Story = StoryObj<typeof ToggleSwitch>;
16
+
17
+ // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
18
+ export const Default: Story = {
19
+ args: {
20
+ checked: false,
21
+ },
22
+ };
23
+
24
+ export const On: Story = {
25
+ args: {
26
+ checked: true,
27
+ },
28
+ };
29
+
30
+ export const OffDisabled: Story = {
31
+ args: {
32
+ checked: false,
33
+ disabled: true,
34
+ },
35
+ };
36
+
37
+ export const OnDisabled: Story = {
38
+ args: {
39
+ checked: true,
40
+ disabled: true,
41
+ },
42
+ };
43
+
44
+ export const Error: Story = {
45
+ args: {
46
+ checked: true,
47
+ error: true,
48
+ },
49
+ };
@@ -0,0 +1,87 @@
1
+ import cx from "classnames";
2
+ import ToggleSwitchProps from "./ToggleSwitchProps";
3
+ import styles from "./toggleSwitch.module.scss";
4
+ import { useEffect, useState, MouseEvent } from "react";
5
+
6
+ const ToggleSwitch = (props: ToggleSwitchProps) => {
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 = ["switch", styles.switch];
26
+
27
+ if (extraClass) {
28
+ classes.push(extraClass);
29
+ }
30
+ if (error) {
31
+ classes.push(styles.error);
32
+ }
33
+
34
+ useEffect(() => {
35
+ setIsChecked(checked ? checked : false);
36
+ }, [checked]);
37
+
38
+ const handleClick = (e: MouseEvent) => {
39
+ setIsChecked(!isChecked);
40
+ if (onChange) {
41
+ onChange(e, isChecked);
42
+ }
43
+ };
44
+
45
+ return (
46
+ <div className={cx(classes)}>
47
+ <input
48
+ id={id}
49
+ name={name}
50
+ checked={isChecked}
51
+ type={"checkbox"}
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
+ <span className={`${styles.slider} ${styles.round}`}>
66
+ <span className={`${styles.circle}`}>
67
+ <svg
68
+ xmlns="http://www.w3.org/2000/svg"
69
+ width="12"
70
+ height="9"
71
+ viewBox="0 0 12 9"
72
+ fill="none"
73
+ >
74
+ <path
75
+ fill-rule="evenodd"
76
+ clip-rule="evenodd"
77
+ d="M11.5458 1.47502C11.7411 1.67029 11.7411 1.98687 11.5458 2.18213L5.18186 8.54609C4.9866 8.74135 4.67002 8.74135 4.47476 8.54609L0.939224 5.01056C0.743962 4.8153 0.743962 4.49871 0.939224 4.30345L1.64633 3.59635C1.84159 3.40108 2.15818 3.40108 2.35344 3.59635L4.82831 6.07122L10.1316 0.767918C10.3269 0.572656 10.6435 0.572656 10.8387 0.767918L11.5458 1.47502Z"
78
+ fill="currentColor"
79
+ />
80
+ </svg>
81
+ </span>
82
+ </span>
83
+ </div>
84
+ );
85
+ };
86
+
87
+ export default ToggleSwitch;
@@ -0,0 +1,22 @@
1
+ import { FocusEvent, MouseEvent } from "react";
2
+
3
+ interface ToggleSwitchProps {
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
+ checked?: boolean;
13
+ required?: boolean;
14
+ ariaLabel?: string;
15
+ ariaLabeledby?: string;
16
+ ariaDescribedby?: string;
17
+ onChange?: (e: MouseEvent, checked?: boolean) => void;
18
+ onFocus?: (e: FocusEvent) => void;
19
+ onBlur?: (e: FocusEvent) => void;
20
+ }
21
+
22
+ export default ToggleSwitchProps;