@hellobetterdigitalnz/betterui 0.0.0 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -30
- package/package.json +48 -45
- package/src/App.tsx +30 -30
- package/src/Components/DataDisplay/Accordion/Accordion.stories.tsx +57 -57
- package/src/Components/DataDisplay/Accordion/Accordion.tsx +14 -14
- package/src/Components/DataDisplay/Accordion/AccordionContext.tsx +11 -11
- package/src/Components/DataDisplay/Accordion/AccordionContextInterface.tsx +8 -8
- package/src/Components/DataDisplay/Accordion/AccordionItem.tsx +62 -62
- package/src/Components/DataDisplay/Accordion/AccordionItemProps.tsx +12 -12
- package/src/Components/DataDisplay/Accordion/AccordionProps.tsx +8 -8
- package/src/Components/DataDisplay/Accordion/AccordionProvider.tsx +65 -65
- package/src/Components/DataDisplay/Accordion/AccordionProviderInterface.tsx +8 -8
- package/src/Components/DataDisplay/Accordion/accordion.module.scss +56 -56
- package/src/Components/DataDisplay/Badge/Badge.stories.tsx +44 -44
- package/src/Components/DataDisplay/Badge/Badge.tsx +32 -32
- package/src/Components/DataDisplay/Badge/BadgeProps.tsx +6 -6
- package/src/Components/DataDisplay/Badge/badge.module.scss +42 -42
- package/src/Components/DataDisplay/Cards/BannerCard/BannerCard.stories.tsx +26 -26
- package/src/Components/DataDisplay/Cards/BannerCard/BannerCard.tsx +47 -47
- package/src/Components/DataDisplay/Cards/BannerCard/BannerCardInterface.tsx +15 -15
- package/src/Components/DataDisplay/Cards/BannerCard/banner-card.scss +54 -54
- package/src/Components/DataDisplay/Cards/PathwayCard/PathwayCard.stories.tsx +31 -31
- package/src/Components/DataDisplay/Cards/PathwayCard/PathwayCard.tsx +53 -53
- package/src/Components/DataDisplay/Cards/PathwayCard/PathwayCardInterface.tsx +17 -17
- package/src/Components/DataDisplay/Cards/PathwayCard/pathway-card-stories.scss +3 -3
- package/src/Components/DataDisplay/Cards/PathwayCard/pathway-card.scss +62 -62
- package/src/Components/DataDisplay/Media/Media.stories.tsx +30 -0
- package/src/Components/DataDisplay/Media/Media.tsx +28 -7
- package/src/Components/DataDisplay/Media/media.module.scss +8 -0
- package/src/Components/DataDisplay/Modal/Modal.stories.tsx +27 -0
- package/src/Components/DataDisplay/Modal/Modal.tsx +16 -5
- package/src/Components/DataDisplay/Modal/ModalActions.tsx +5 -5
- package/src/Components/DataDisplay/Modal/ModalActionsLeft.tsx +5 -5
- package/src/Components/DataDisplay/Modal/ModalActionsRight.tsx +5 -5
- package/src/Components/DataDisplay/Modal/ModalBody.tsx +15 -5
- package/src/Components/DataDisplay/Modal/ModalBodyProps.tsx +7 -0
- package/src/Components/DataDisplay/Modal/ModalCurtain.tsx +5 -5
- package/src/Components/DataDisplay/Modal/ModalHeader.tsx +32 -5
- package/src/Components/DataDisplay/Modal/ModalHeaderProps.tsx +8 -0
- package/src/Components/DataDisplay/Modal/ModalProps.tsx +8 -0
- package/src/Components/DataDisplay/Modal/modal.module.scss +58 -0
- package/src/Components/DataDisplay/NotificationsBell/NotificationBell.stories.tsx +27 -27
- package/src/Components/DataDisplay/NotificationsBell/NotificationsBell.tsx +51 -51
- package/src/Components/DataDisplay/NotificationsBell/notificationBell.module.scss +47 -47
- package/src/Components/DataDisplay/NotificationsPanel/Notification.stories.tsx +128 -128
- package/src/Components/DataDisplay/NotificationsPanel/Notification.tsx +59 -59
- package/src/Components/DataDisplay/NotificationsPanel/NotificationProps.tsx +11 -11
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroup.tsx +17 -17
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroupProps.tsx +8 -8
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroups.tsx +42 -42
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroupsProps.tsx +7 -7
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsHeader.tsx +27 -27
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsHeaderProps.tsx +7 -9
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsNone.tsx +11 -11
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsPanel.tsx +8 -8
- package/src/Components/DataDisplay/NotificationsPanel/NotificationsPanelProps.tsx +6 -6
- package/src/Components/DataDisplay/NotificationsPanel/notificationPanel.module.scss +196 -196
- package/src/Components/DataDisplay/Tab/Tab.stories.tsx +72 -72
- package/src/Components/DataDisplay/Tab/Tab.tsx +20 -20
- package/src/Components/DataDisplay/Tab/TabBody.tsx +6 -6
- package/src/Components/DataDisplay/Tab/TabBodyContent.tsx +15 -15
- package/src/Components/DataDisplay/Tab/TabBodyContentProps.tsx +9 -9
- package/src/Components/DataDisplay/Tab/TabBodyProps.tsx +8 -8
- package/src/Components/DataDisplay/Tab/TabContext.tsx +9 -9
- package/src/Components/DataDisplay/Tab/TabContextProps.tsx +6 -6
- package/src/Components/DataDisplay/Tab/TabNav.tsx +6 -6
- package/src/Components/DataDisplay/Tab/TabNavItem.tsx +49 -49
- package/src/Components/DataDisplay/Tab/TabNavItemProps.tsx +9 -9
- package/src/Components/DataDisplay/Tab/TabNavProps.tsx +8 -8
- package/src/Components/DataDisplay/Tab/TabProps.tsx +8 -8
- package/src/Components/DataDisplay/Tab/tab.module.scss +35 -35
- package/src/Components/DataDisplay/Tab/tab.stories.scss +3 -3
- package/src/Components/DataDisplay/Table/Table.stories.tsx +64 -64
- package/src/Components/DataDisplay/Table/Table.tsx +10 -10
- package/src/Components/DataDisplay/Table/TableBody.tsx +13 -13
- package/src/Components/DataDisplay/Table/TableBodyProps.tsx +8 -8
- package/src/Components/DataDisplay/Table/TableCell.tsx +30 -30
- package/src/Components/DataDisplay/Table/TableCellAction.tsx +27 -27
- package/src/Components/DataDisplay/Table/TableCellActionProps.tsx +11 -11
- package/src/Components/DataDisplay/Table/TableCellProps.tsx +11 -11
- package/src/Components/DataDisplay/Table/TableCellWithDesc.tsx +21 -21
- package/src/Components/DataDisplay/Table/TableCellWithDescProps.tsx +9 -9
- package/src/Components/DataDisplay/Table/TableCellWithImage.tsx +39 -39
- package/src/Components/DataDisplay/Table/TableCellWithImageProps.tsx +10 -10
- package/src/Components/DataDisplay/Table/TableFooter.tsx +5 -5
- package/src/Components/DataDisplay/Table/TableHead.tsx +11 -11
- package/src/Components/DataDisplay/Table/TableHeadProps.tsx +8 -8
- package/src/Components/DataDisplay/Table/TableHeaderCell.tsx +17 -17
- package/src/Components/DataDisplay/Table/TableHeaderCellProps.tsx +10 -10
- package/src/Components/DataDisplay/Table/TableProps.tsx +8 -8
- package/src/Components/DataDisplay/Table/TableRow.tsx +9 -9
- package/src/Components/DataDisplay/Table/TableRowProps.tsx +8 -8
- package/src/Components/DataDisplay/Table/table.module.scss +103 -103
- package/src/Components/Form/Button/Button.stories.tsx +66 -66
- package/src/Components/Form/Button/Button.tsx +64 -64
- package/src/Components/Form/Button/ButtonProps.tsx +18 -18
- package/src/Components/Form/Button/button.module.scss +142 -142
- package/src/Components/Form/Checkbox/Checkbox.stories.tsx +49 -49
- package/src/Components/Form/Checkbox/Checkbox.tsx +85 -85
- package/src/Components/Form/Checkbox/CheckboxProps.tsx +22 -22
- package/src/Components/Form/Checkbox/checkbox.module.scss +63 -63
- package/src/Components/Form/CheckboxSelect/CheckboxSelect.tsx +5 -5
- package/src/Components/Form/CheckboxSelect/CheckboxSelectItem.tsx +5 -5
- package/src/Components/Form/CheckboxSet/CheckboxSet.stories.tsx +93 -93
- package/src/Components/Form/CheckboxSet/CheckboxSet.tsx +14 -14
- package/src/Components/Form/CheckboxSet/CheckboxSetItem.tsx +88 -88
- package/src/Components/Form/CheckboxSet/CheckboxSetProps.tsx +9 -9
- package/src/Components/Form/CheckboxSet/checkboxSet.module.scss +13 -13
- package/src/Components/Form/CurrencyField/CurrenctField.stories.tsx +22 -22
- package/src/Components/Form/CurrencyField/CurrencyField.tsx +59 -59
- package/src/Components/Form/CurrencyField/CurrencyFieldProps.tsx +8 -8
- package/src/Components/Form/DateField/DateField.stories.tsx +22 -22
- package/src/Components/Form/DateField/DateField.tsx +58 -58
- package/src/Components/Form/DropdownBadge/DropdownBadge.stories.tsx +49 -49
- package/src/Components/Form/DropdownBadge/DropdownBadge.tsx +160 -160
- package/src/Components/Form/DropdownBadge/DropdownBadgeItem.tsx +40 -40
- package/src/Components/Form/DropdownBadge/DropdownBadgeItemProps.tsx +10 -10
- package/src/Components/Form/DropdownBadge/DropdownBadgeProps.tsx +31 -31
- package/src/Components/Form/DropdownBadge/DropdownBadgeSelector.tsx +11 -11
- package/src/Components/Form/DropdownBadge/DropdownBadgeSelectorProps.tsx +7 -7
- package/src/Components/Form/DropdownBadge/dropdownBadge.module.scss +105 -105
- package/src/Components/Form/DropdownField/DropdownField.stories.tsx +50 -50
- package/src/Components/Form/DropdownField/DropdownField.tsx +118 -118
- package/src/Components/Form/DropdownField/DropdownFieldItem.tsx +26 -26
- package/src/Components/Form/DropdownField/DropdownFieldItemProps.tsx +9 -9
- package/src/Components/Form/DropdownField/DropdownFieldProps.tsx +33 -33
- package/src/Components/Form/DropdownField/DropdownFieldSelector.tsx +15 -15
- package/src/Components/Form/DropdownField/DropdownFieldSelectorProps.tsx +7 -7
- package/src/Components/Form/DropdownField/dropdown.module.scss +79 -79
- package/src/Components/Form/EmailField/EmailField.stories.ts +23 -23
- package/src/Components/Form/EmailField/EmailField.tsx +51 -51
- package/src/Components/Form/ErrorMessage/ErrorMessage.tsx +5 -5
- package/src/Components/Form/FormFieldHolder/FormFieldHolder.stories.tsx +30 -0
- package/src/Components/Form/FormFieldHolder/FormFieldHolder.tsx +40 -5
- package/src/Components/Form/FormFieldHolder/FormFieldHolderProps.tsx +12 -0
- package/src/Components/Form/FormFieldHolder/formHolder.module.scss +56 -0
- package/src/Components/Form/IconButton/IconButton.stories.tsx +45 -45
- package/src/Components/Form/IconButton/IconButton.tsx +58 -58
- package/src/Components/Form/IconButton/IconButtonProps.tsx +15 -15
- package/src/Components/Form/IconButton/iconButton.module.scss +111 -111
- package/src/Components/Form/InputProps.tsx +25 -25
- package/src/Components/Form/MultiSelectField/MultiSelectField.tsx +5 -5
- package/src/Components/Form/MultiSelectField/MultiSelectFieldItem.tsx +5 -5
- package/src/Components/Form/MultiSelectField/MultiSelectFieldTag.tsx +5 -5
- package/src/Components/Form/PasswordField/PasswordField.stories.tsx +22 -22
- package/src/Components/Form/PasswordField/PasswordField.tsx +70 -70
- package/src/Components/Form/RadioButtons/RadioButton.tsx +70 -70
- package/src/Components/Form/RadioButtons/RadioButtonProps.tsx +22 -22
- package/src/Components/Form/RadioButtons/RadioButtons.stories.tsx +64 -64
- package/src/Components/Form/RadioButtons/RadioButtons.tsx +18 -18
- package/src/Components/Form/RadioButtons/RadioButtonsProps.tsx +10 -10
- package/src/Components/Form/RadioButtons/radioButton.stories.scss +3 -3
- package/src/Components/Form/RadioButtons/radiobutton.module.scss +63 -63
- package/src/Components/Form/TextField/TextField.stories.ts +22 -23
- package/src/Components/Form/TextField/TextField.tsx +56 -52
- package/src/Components/Form/TextField/TextFieldProps.tsx +8 -0
- package/src/Components/Form/Textarea/Textarea.stories.ts +31 -31
- package/src/Components/Form/Textarea/Textarea.tsx +71 -71
- package/src/Components/Form/Textarea/TextareaProps.tsx +27 -27
- package/src/Components/Form/Textarea/textarea.module.scss +49 -49
- package/src/Components/Form/TimeField/TimeField.stories.tsx +22 -22
- package/src/Components/Form/TimeField/TimeField.tsx +58 -58
- package/src/Components/Form/ToggleSwitch/ToggleSwitch.stories.tsx +49 -49
- package/src/Components/Form/ToggleSwitch/ToggleSwitch.tsx +87 -87
- package/src/Components/Form/ToggleSwitch/ToggleSwitchProps.tsx +22 -22
- package/src/Components/Form/ToggleSwitch/toggleSwitch.module.scss +82 -82
- package/src/Components/Form/inputs.module.scss +129 -121
- package/src/Components/Icons/Arrows/CaretDown/CaretDown.tsx +49 -49
- package/src/Components/Icons/Arrows/CaretLeft/CaretLeft.tsx +102 -0
- package/src/Components/Icons/Arrows/CaretRight/CaretRight.tsx +102 -0
- package/src/Components/Icons/Arrows/CaretUp/CaretUp.tsx +49 -49
- package/src/Components/Icons/Brand/WindowLogo/WindowLogo.tsx +105 -0
- package/src/Components/Icons/Commerce/CurrencyDollarSimple/CurrencyDollarSimple.tsx +105 -105
- package/src/Components/Icons/Communication/AddressBook/AddressBook.stories.ts +28 -28
- package/src/Components/Icons/Communication/AddressBook/AddressBook.tsx +50 -50
- package/src/Components/Icons/Communication/Asterick/Asterisk.stories.ts +28 -28
- package/src/Components/Icons/Communication/Asterick/Asterisk.tsx +50 -50
- package/src/Components/Icons/Communication/AsterickSimple/AsteriskSimple.stories.ts +28 -28
- package/src/Components/Icons/Communication/AsterickSimple/AsteriskSimple.tsx +49 -49
- package/src/Components/Icons/Communication/At/At.stories.ts +28 -28
- package/src/Components/Icons/Communication/At/At.tsx +49 -49
- package/src/Components/Icons/Communication/Broadcast/Broadcast.stories.ts +27 -27
- package/src/Components/Icons/Communication/Broadcast/Broadcast.tsx +49 -49
- package/src/Components/Icons/Communication/Chat/Chat.stories.ts +28 -28
- package/src/Components/Icons/Communication/Chat/Chat.tsx +49 -49
- package/src/Components/Icons/Design/Eye/Eye.tsx +105 -105
- package/src/Components/Icons/Design/EyeSlash/EyeSlash.tsx +105 -105
- package/src/Components/Icons/IconProps.tsx +5 -5
- package/src/Components/Icons/SecurityAndWarnings/WarningCircle/WarningCircle.tsx +105 -0
- package/src/Components/Icons/SystemAndDevice/Bell/Bell.tsx +49 -49
- package/src/Components/Icons/SystemAndDevice/MagnifyingGlass/MagnifyingGlass.tsx +105 -0
- package/src/Components/Icons/Time/CalendarBank/CalendarBank.tsx +105 -105
- package/src/Components/Icons/Time/Clock/Clock.tsx +105 -105
- package/src/Components/Layout/CalloutPopup/CalloutPopup.tsx +5 -5
- package/src/Components/Layout/Header/Header.tsx +5 -5
- package/src/Components/Layout/Header/HeaderLeft.tsx +5 -5
- package/src/Components/Layout/Header/HeaderRight.tsx +5 -5
- package/src/Components/Layout/Pagination/Pagination.tsx +5 -5
- package/src/Components/Layout/Pagination/PaginationFirst.tsx +5 -5
- package/src/Components/Layout/Pagination/PaginationLast.tsx +5 -5
- package/src/Components/Layout/Pagination/PaginationNext.tsx +5 -5
- package/src/Components/Layout/Pagination/PaginationNumber.tsx +5 -5
- package/src/Components/Layout/Pagination/PaginationPrevious.tsx +5 -5
- package/src/Components/Layout/ProfileAvatar/ProfileAvatar.stories.tsx +22 -0
- package/src/Components/Layout/ProfileAvatar/ProfileAvatar.tsx +31 -5
- package/src/Components/Layout/ProfileAvatar/ProfileAvatarProps.tsx +10 -4
- package/src/Components/Layout/ProfileAvatar/profileAvatar.module.scss +35 -0
- package/src/Components/Layout/ProfileDropdown/ProfileDropdown.stories.tsx +67 -0
- package/src/Components/Layout/ProfileDropdown/ProfileDropdown.tsx +12 -5
- package/src/Components/Layout/ProfileDropdown/ProfileDropdownProps.tsx +8 -0
- package/src/Components/Layout/ProfileDropdown/ProfileHeader.tsx +24 -5
- package/src/Components/Layout/ProfileDropdown/ProfileHeaderProps.tsx +8 -0
- package/src/Components/Layout/ProfileDropdown/ProfileLink.tsx +10 -5
- package/src/Components/Layout/ProfileDropdown/ProfileLinkProps.tsx +7 -0
- package/src/Components/Layout/ProfileDropdown/ProfileLinks.tsx +14 -5
- package/src/Components/Layout/ProfileDropdown/ProfileLinksProps.tsx +7 -0
- package/src/Components/Layout/ProfileDropdown/ProfileNavigationItem.tsx +29 -5
- package/src/Components/Layout/ProfileDropdown/ProfileNavigationItemProps.tsx +10 -0
- package/src/Components/Layout/ProfileDropdown/ProfileSwitchPanel.tsx +79 -5
- package/src/Components/Layout/ProfileDropdown/ProfileSwitchPanelProps.tsx +10 -0
- package/src/Components/Layout/ProfileDropdown/ProfileSwitchUser.tsx +22 -5
- package/src/Components/Layout/ProfileDropdown/ProfileSwitchUserProps.tsx +7 -0
- package/src/Components/Layout/ProfileDropdown/profileDropdown.module.scss +207 -0
- package/src/Components/Layout/Sidebar/Sidebar.tsx +5 -5
- package/src/Components/Layout/Sidebar/SidebarChevron.tsx +5 -5
- package/src/Components/Layout/Sidebar/SidebarNavigation.tsx +5 -5
- package/src/Components/Layout/Sidebar/SidebarNavigationItem.tsx +5 -5
- package/src/Components/Layout/Sidebar/SidebarSubNavigation.tsx +5 -5
- package/src/Notification/Notification.tsx +83 -83
- package/src/Notification/NotificationList.tsx +47 -22
- package/src/global.scss +224 -231
- package/src/main.tsx +10 -9
- package/src/variables.scss +2 -2
- package/.editorconfig +0 -17
- package/.eslintrc.cjs +0 -14
- package/.storybook/main.ts +0 -23
- package/.storybook/preview.ts +0 -17
- package/index.html +0 -13
- package/public/image/table-image.png +0 -0
- package/public/vite.svg +0 -1
- package/src/Components/DataDisplay/Media/media.scss +0 -0
- package/tokens/color/color.mdx +0 -82
- package/tokens/shadow/shadow-panel.scss +0 -12
- package/tokens/shadow/shadow.mdx +0 -34
- package/tokens/typography/typography.mdx +0 -31
- package/tsconfig.json +0 -25
- package/tsconfig.node.json +0 -10
- package/vite.config.ts +0 -7
package/README.md
CHANGED
|
@@ -1,30 +1,23 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
}
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
|
|
29
|
-
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
|
|
30
|
-
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
|
|
1
|
+
# BetterUI
|
|
2
|
+
|
|
3
|
+
A reusable Rect component library by [Hello Better](https://hellobetterdigital.com).
|
|
4
|
+
|
|
5
|
+
We at Hello Better builds many web applications using React + Typescript and headless APIs. We make use of Figma design systems and have our own component library that we have shared here.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
To install simply use
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
npm install @hellobetterdigitalnz/betteru
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
or if you are using yarn
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
yarn add @hellobetterdigitalnz/betteru
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Using components
|
|
22
|
+
|
|
23
|
+
Components are used from the libraries root entry.
|
package/package.json
CHANGED
|
@@ -1,45 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@hellobetterdigitalnz/betterui",
|
|
3
|
-
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite",
|
|
8
|
-
"build": "tsc && vite build",
|
|
9
|
-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
10
|
-
"preview": "vite preview",
|
|
11
|
-
"storybook": "storybook dev -p 6006",
|
|
12
|
-
"build-storybook": "storybook build"
|
|
13
|
-
},
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"@floating-ui/react": "^0.26.4",
|
|
16
|
-
"classnames": "^2.4.0",
|
|
17
|
-
"react": "^18.2.0",
|
|
18
|
-
"react-dom": "^18.2.0"
|
|
19
|
-
},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@storybook/addon-essentials": "7.6.5",
|
|
22
|
-
"@storybook/addon-interactions": "7.6.5",
|
|
23
|
-
"@storybook/addon-links": "7.6.5",
|
|
24
|
-
"@storybook/addon-mdx-gfm": "7.6.5",
|
|
25
|
-
"@storybook/addon-onboarding": "1.0.10",
|
|
26
|
-
"@storybook/addon-styling-webpack": "0.0.5",
|
|
27
|
-
"@storybook/blocks": "7.6.5",
|
|
28
|
-
"@storybook/react": "7.6.5",
|
|
29
|
-
"@storybook/react-vite": "7.6.5",
|
|
30
|
-
"@storybook/test": "7.6.5",
|
|
31
|
-
"@types/react": "^18.2.37",
|
|
32
|
-
"@types/react-dom": "^18.2.15",
|
|
33
|
-
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
|
34
|
-
"@typescript-eslint/parser": "^6.10.0",
|
|
35
|
-
"@vitejs/plugin-react": "^4.2.0",
|
|
36
|
-
"eslint": "^8.53.0",
|
|
37
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
38
|
-
"eslint-plugin-react-refresh": "^0.4.4",
|
|
39
|
-
"eslint-plugin-storybook": "^0.6.15",
|
|
40
|
-
"sass": "^1.69.5",
|
|
41
|
-
"storybook": "7.6.5",
|
|
42
|
-
"typescript": "^5.2.2",
|
|
43
|
-
"vite": "^5.0.0"
|
|
44
|
-
}
|
|
45
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@hellobetterdigitalnz/betterui",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.0.2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "tsc && vite build",
|
|
9
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
10
|
+
"preview": "vite preview",
|
|
11
|
+
"storybook": "storybook dev -p 6006",
|
|
12
|
+
"build-storybook": "storybook build"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@floating-ui/react": "^0.26.4",
|
|
16
|
+
"classnames": "^2.4.0",
|
|
17
|
+
"react": "^18.2.0",
|
|
18
|
+
"react-dom": "^18.2.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@storybook/addon-essentials": "7.6.5",
|
|
22
|
+
"@storybook/addon-interactions": "7.6.5",
|
|
23
|
+
"@storybook/addon-links": "7.6.5",
|
|
24
|
+
"@storybook/addon-mdx-gfm": "7.6.5",
|
|
25
|
+
"@storybook/addon-onboarding": "1.0.10",
|
|
26
|
+
"@storybook/addon-styling-webpack": "0.0.5",
|
|
27
|
+
"@storybook/blocks": "7.6.5",
|
|
28
|
+
"@storybook/react": "7.6.5",
|
|
29
|
+
"@storybook/react-vite": "7.6.5",
|
|
30
|
+
"@storybook/test": "7.6.5",
|
|
31
|
+
"@types/react": "^18.2.37",
|
|
32
|
+
"@types/react-dom": "^18.2.15",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
|
34
|
+
"@typescript-eslint/parser": "^6.10.0",
|
|
35
|
+
"@vitejs/plugin-react": "^4.2.0",
|
|
36
|
+
"eslint": "^8.53.0",
|
|
37
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
38
|
+
"eslint-plugin-react-refresh": "^0.4.4",
|
|
39
|
+
"eslint-plugin-storybook": "^0.6.15",
|
|
40
|
+
"sass": "^1.69.5",
|
|
41
|
+
"storybook": "7.6.5",
|
|
42
|
+
"typescript": "^5.2.2",
|
|
43
|
+
"vite": "^5.0.0"
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"src/"
|
|
47
|
+
]
|
|
48
|
+
}
|
package/src/App.tsx
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { useState } from 'react'
|
|
2
|
-
import viteLogo from '/vite.svg'
|
|
3
|
-
|
|
4
|
-
function App() {
|
|
5
|
-
const [count, setCount] = useState(0)
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
<>
|
|
9
|
-
<div>
|
|
10
|
-
<a href="https://vitejs.dev" target="_blank">
|
|
11
|
-
<img src={viteLogo} className="logo" alt="Vite logo" />
|
|
12
|
-
</a>
|
|
13
|
-
</div>
|
|
14
|
-
<h1>Vite + React</h1>
|
|
15
|
-
<div className="card">
|
|
16
|
-
<button onClick={() => setCount((count) => count + 1)}>
|
|
17
|
-
count is {count}
|
|
18
|
-
</button>
|
|
19
|
-
<p>
|
|
20
|
-
Edit <code>src/App.tsx</code> and save to test HMR
|
|
21
|
-
</p>
|
|
22
|
-
</div>
|
|
23
|
-
<p className="read-the-docs">
|
|
24
|
-
Click on the Vite and React logos to learn more
|
|
25
|
-
</p>
|
|
26
|
-
</>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default App
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import viteLogo from '/vite.svg'
|
|
3
|
+
|
|
4
|
+
function App() {
|
|
5
|
+
const [count, setCount] = useState(0)
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<>
|
|
9
|
+
<div>
|
|
10
|
+
<a href="https://vitejs.dev" target="_blank">
|
|
11
|
+
<img src={viteLogo} className="logo" alt="Vite logo" />
|
|
12
|
+
</a>
|
|
13
|
+
</div>
|
|
14
|
+
<h1>Vite + React</h1>
|
|
15
|
+
<div className="card">
|
|
16
|
+
<button onClick={() => setCount((count) => count + 1)}>
|
|
17
|
+
count is {count}
|
|
18
|
+
</button>
|
|
19
|
+
<p>
|
|
20
|
+
Edit <code>src/App.tsx</code> and save to test HMR
|
|
21
|
+
</p>
|
|
22
|
+
</div>
|
|
23
|
+
<p className="read-the-docs">
|
|
24
|
+
Click on the Vite and React logos to learn more
|
|
25
|
+
</p>
|
|
26
|
+
</>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default App
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import {Meta, StoryObj} from '@storybook/react';
|
|
2
|
-
import Accordion from './Accordion.tsx';
|
|
3
|
-
import AccordionItem from './AccordionItem.tsx';
|
|
4
|
-
|
|
5
|
-
const meta: Meta = {
|
|
6
|
-
title: 'Data Display / Accordion',
|
|
7
|
-
component: Accordion,
|
|
8
|
-
tags: ['autodocs'],
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default meta;
|
|
12
|
-
|
|
13
|
-
type Story = StoryObj<typeof meta>;
|
|
14
|
-
|
|
15
|
-
const AccordionTemplate: Story = {
|
|
16
|
-
render: ({items, ...args}) => {
|
|
17
|
-
return (
|
|
18
|
-
<Accordion {...args}>
|
|
19
|
-
{items.map((item: any) => (
|
|
20
|
-
<AccordionItem index={item.index} title={item.title}>
|
|
21
|
-
{item.children}
|
|
22
|
-
</AccordionItem>
|
|
23
|
-
))}
|
|
24
|
-
</Accordion>
|
|
25
|
-
);
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const Example = {
|
|
30
|
-
...AccordionTemplate,
|
|
31
|
-
args: {
|
|
32
|
-
allowMultiple:true,
|
|
33
|
-
items: [
|
|
34
|
-
{
|
|
35
|
-
index:'1',
|
|
36
|
-
title: 'Lorem ipsum dolor',
|
|
37
|
-
children: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincidunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus id et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
index:'2',
|
|
41
|
-
title: 'Lorem ipsum dolor',
|
|
42
|
-
children: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincidunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus id et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
index:'3',
|
|
46
|
-
title: 'Lorem ipsum dolor',
|
|
47
|
-
children: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincidunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus id et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
index:'4',
|
|
51
|
-
title: 'Lorem ipsum dolor',
|
|
52
|
-
children: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincidunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus id et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
|
|
1
|
+
import {Meta, StoryObj} from '@storybook/react';
|
|
2
|
+
import Accordion from './Accordion.tsx';
|
|
3
|
+
import AccordionItem from './AccordionItem.tsx';
|
|
4
|
+
|
|
5
|
+
const meta: Meta = {
|
|
6
|
+
title: 'Data Display / Accordion',
|
|
7
|
+
component: Accordion,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
|
|
15
|
+
const AccordionTemplate: Story = {
|
|
16
|
+
render: ({items, ...args}) => {
|
|
17
|
+
return (
|
|
18
|
+
<Accordion {...args}>
|
|
19
|
+
{items.map((item: any) => (
|
|
20
|
+
<AccordionItem index={item.index} title={item.title}>
|
|
21
|
+
{item.children}
|
|
22
|
+
</AccordionItem>
|
|
23
|
+
))}
|
|
24
|
+
</Accordion>
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Example = {
|
|
30
|
+
...AccordionTemplate,
|
|
31
|
+
args: {
|
|
32
|
+
allowMultiple:true,
|
|
33
|
+
items: [
|
|
34
|
+
{
|
|
35
|
+
index:'1',
|
|
36
|
+
title: 'Lorem ipsum dolor',
|
|
37
|
+
children: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincidunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus id et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
index:'2',
|
|
41
|
+
title: 'Lorem ipsum dolor',
|
|
42
|
+
children: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincidunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus id et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
index:'3',
|
|
46
|
+
title: 'Lorem ipsum dolor',
|
|
47
|
+
children: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincidunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus id et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
index:'4',
|
|
51
|
+
title: 'Lorem ipsum dolor',
|
|
52
|
+
children: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincidunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus id et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import AccordionProvider from "./AccordionProvider";
|
|
2
|
-
import AccordionProps from "./AccordionProps.tsx";
|
|
3
|
-
|
|
4
|
-
const Accordion = (props: AccordionProps) => {
|
|
5
|
-
const {children, allowMultiple} = props
|
|
6
|
-
|
|
7
|
-
return <AccordionProvider allowMultiple={allowMultiple ? allowMultiple : false}>
|
|
8
|
-
<>
|
|
9
|
-
{children}
|
|
10
|
-
</>
|
|
11
|
-
</AccordionProvider>
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default Accordion;
|
|
1
|
+
import AccordionProvider from "./AccordionProvider";
|
|
2
|
+
import AccordionProps from "./AccordionProps.tsx";
|
|
3
|
+
|
|
4
|
+
const Accordion = (props: AccordionProps) => {
|
|
5
|
+
const {children, allowMultiple} = props
|
|
6
|
+
|
|
7
|
+
return <AccordionProvider allowMultiple={allowMultiple ? allowMultiple : false}>
|
|
8
|
+
<>
|
|
9
|
+
{children}
|
|
10
|
+
</>
|
|
11
|
+
</AccordionProvider>
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default Accordion;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {createContext} from "react";
|
|
2
|
-
import AccordionContextInterface from "./AccordionContextInterface.tsx";
|
|
3
|
-
|
|
4
|
-
const AccordionContext = createContext<AccordionContextInterface>({
|
|
5
|
-
handleClick: (index: number) => { console.log(`Handling click for index ${index}`); },
|
|
6
|
-
isOpened: (index: number) => { console.log(`Handle index ${index} is opened`); return false; },
|
|
7
|
-
allowMultiple: false,
|
|
8
|
-
openedList: []
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export default AccordionContext;
|
|
1
|
+
import {createContext} from "react";
|
|
2
|
+
import AccordionContextInterface from "./AccordionContextInterface.tsx";
|
|
3
|
+
|
|
4
|
+
const AccordionContext = createContext<AccordionContextInterface>({
|
|
5
|
+
handleClick: (index: number) => { console.log(`Handling click for index ${index}`); },
|
|
6
|
+
isOpened: (index: number) => { console.log(`Handle index ${index} is opened`); return false; },
|
|
7
|
+
allowMultiple: false,
|
|
8
|
+
openedList: []
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export default AccordionContext;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
interface AccordionContextInterface {
|
|
2
|
-
handleClick: (index: number) => void;
|
|
3
|
-
isOpened: (index: number) => boolean;
|
|
4
|
-
allowMultiple?: boolean;
|
|
5
|
-
openedList: any[];
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default AccordionContextInterface
|
|
1
|
+
interface AccordionContextInterface {
|
|
2
|
+
handleClick: (index: number) => void;
|
|
3
|
+
isOpened: (index: number) => boolean;
|
|
4
|
+
allowMultiple?: boolean;
|
|
5
|
+
openedList: any[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default AccordionContextInterface
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { useContext } from "react";
|
|
2
|
-
import AccordionContext from "./AccordionContext";
|
|
3
|
-
import AccordionItemProps from "./AccordionItemProps.tsx";
|
|
4
|
-
import styles from './accordion.module.scss';
|
|
5
|
-
import CaretUp from "../../Icons/Arrows/CaretUp/CaretUp";
|
|
6
|
-
import CaretDown from "../../Icons/Arrows/CaretDown/CaretDown";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const AccordionItem = (props: AccordionItemProps) => {
|
|
10
|
-
const {
|
|
11
|
-
index,
|
|
12
|
-
title,
|
|
13
|
-
children,
|
|
14
|
-
onAfterOpened,
|
|
15
|
-
onAfterClosed,
|
|
16
|
-
onBeforeClosed,
|
|
17
|
-
} = props;
|
|
18
|
-
|
|
19
|
-
const itemIndex = typeof index === 'string' ? parseInt(index) : index;
|
|
20
|
-
const context = useContext(AccordionContext);
|
|
21
|
-
|
|
22
|
-
const handleClick = () => {
|
|
23
|
-
if (context.isOpened(itemIndex)) {
|
|
24
|
-
let canClose = true;
|
|
25
|
-
if (onBeforeClosed) {
|
|
26
|
-
canClose = onBeforeClosed();
|
|
27
|
-
}
|
|
28
|
-
if (canClose) {
|
|
29
|
-
context.handleClick(itemIndex);
|
|
30
|
-
}
|
|
31
|
-
if (onAfterClosed) {
|
|
32
|
-
onAfterClosed();
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
context.handleClick(itemIndex);
|
|
36
|
-
if (onAfterOpened) {
|
|
37
|
-
onAfterOpened();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<div className={styles.accordion}>
|
|
44
|
-
<div onClick={() => handleClick()} className={styles.header}>
|
|
45
|
-
<div className={styles.title}>
|
|
46
|
-
<h4>{title}</h4>
|
|
47
|
-
</div>
|
|
48
|
-
<div className={styles.icon}>
|
|
49
|
-
{context.isOpened(itemIndex) ? <CaretUp /> : <CaretDown />}
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
<div
|
|
53
|
-
className={`${styles.body} ${
|
|
54
|
-
context.isOpened(itemIndex) ? `${styles.bodyOpened}` : ``
|
|
55
|
-
}`}>
|
|
56
|
-
<div className={`${styles.bodyInner}`}>{children}</div>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export default AccordionItem;
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import AccordionContext from "./AccordionContext";
|
|
3
|
+
import AccordionItemProps from "./AccordionItemProps.tsx";
|
|
4
|
+
import styles from './accordion.module.scss';
|
|
5
|
+
import CaretUp from "../../Icons/Arrows/CaretUp/CaretUp";
|
|
6
|
+
import CaretDown from "../../Icons/Arrows/CaretDown/CaretDown";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const AccordionItem = (props: AccordionItemProps) => {
|
|
10
|
+
const {
|
|
11
|
+
index,
|
|
12
|
+
title,
|
|
13
|
+
children,
|
|
14
|
+
onAfterOpened,
|
|
15
|
+
onAfterClosed,
|
|
16
|
+
onBeforeClosed,
|
|
17
|
+
} = props;
|
|
18
|
+
|
|
19
|
+
const itemIndex = typeof index === 'string' ? parseInt(index) : index;
|
|
20
|
+
const context = useContext(AccordionContext);
|
|
21
|
+
|
|
22
|
+
const handleClick = () => {
|
|
23
|
+
if (context.isOpened(itemIndex)) {
|
|
24
|
+
let canClose = true;
|
|
25
|
+
if (onBeforeClosed) {
|
|
26
|
+
canClose = onBeforeClosed();
|
|
27
|
+
}
|
|
28
|
+
if (canClose) {
|
|
29
|
+
context.handleClick(itemIndex);
|
|
30
|
+
}
|
|
31
|
+
if (onAfterClosed) {
|
|
32
|
+
onAfterClosed();
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
context.handleClick(itemIndex);
|
|
36
|
+
if (onAfterOpened) {
|
|
37
|
+
onAfterOpened();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className={styles.accordion}>
|
|
44
|
+
<div onClick={() => handleClick()} className={styles.header}>
|
|
45
|
+
<div className={styles.title}>
|
|
46
|
+
<h4>{title}</h4>
|
|
47
|
+
</div>
|
|
48
|
+
<div className={styles.icon}>
|
|
49
|
+
{context.isOpened(itemIndex) ? <CaretUp /> : <CaretDown />}
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
<div
|
|
53
|
+
className={`${styles.body} ${
|
|
54
|
+
context.isOpened(itemIndex) ? `${styles.bodyOpened}` : ``
|
|
55
|
+
}`}>
|
|
56
|
+
<div className={`${styles.bodyInner}`}>{children}</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default AccordionItem;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {ReactNode} from "react";
|
|
2
|
-
|
|
3
|
-
interface AccordionItemProps {
|
|
4
|
-
index: string | number;
|
|
5
|
-
title: string;
|
|
6
|
-
children: string | ReactNode;
|
|
7
|
-
onAfterOpened?: () => void;
|
|
8
|
-
onAfterClosed?: () => void;
|
|
9
|
-
onBeforeClosed?: () => boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default AccordionItemProps;
|
|
1
|
+
import {ReactNode} from "react";
|
|
2
|
+
|
|
3
|
+
interface AccordionItemProps {
|
|
4
|
+
index: string | number;
|
|
5
|
+
title: string;
|
|
6
|
+
children: string | ReactNode;
|
|
7
|
+
onAfterOpened?: () => void;
|
|
8
|
+
onAfterClosed?: () => void;
|
|
9
|
+
onBeforeClosed?: () => boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default AccordionItemProps;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {ReactNode} from "react";
|
|
2
|
-
|
|
3
|
-
interface AccordionProps {
|
|
4
|
-
allowMultiple?: boolean;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default AccordionProps;
|
|
1
|
+
import {ReactNode} from "react";
|
|
2
|
+
|
|
3
|
+
interface AccordionProps {
|
|
4
|
+
allowMultiple?: boolean;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default AccordionProps;
|