@luscii-healthtech/web-ui 0.1.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/README.md +181 -0
- package/dist/components/Acknowledgement/Acknowledgement.d.ts +22 -0
- package/dist/components/Avatar/Avatar.d.ts +29 -0
- package/dist/components/Badge/Badge.d.ts +7 -0
- package/dist/components/Button/Button.d.ts +5 -0
- package/dist/components/Button/Button.types.d.ts +32 -0
- package/dist/components/Button/ButtonIcon.d.ts +7 -0
- package/dist/components/ButtonV2/ButtonV2.d.ts +13 -0
- package/dist/components/ButtonV2/PrimaryButton.d.ts +12 -0
- package/dist/components/ButtonV2/SecondaryButton.d.ts +8 -0
- package/dist/components/ButtonV2/TertiaryButton.d.ts +8 -0
- package/dist/components/Carousel/Carousel.d.ts +8 -0
- package/dist/components/Carousel/GliderContainer.d.ts +7 -0
- package/dist/components/CenteredHero/CenteredHero.d.ts +22 -0
- package/dist/components/Checkbox/Checkbox.d.ts +17 -0
- package/dist/components/ConfirmationDialog/ConfirmationDialog.d.ts +33 -0
- package/dist/components/Datepicker/Datepicker.d.ts +24 -0
- package/dist/components/Dropdown/Dropdown.d.ts +47 -0
- package/dist/components/EmptyListMessage/EmptyListMessage.d.ts +14 -0
- package/dist/components/ErrorBlock/ErrorBlock.d.ts +13 -0
- package/dist/components/Icons/AddIcon.d.ts +3 -0
- package/dist/components/Icons/AlertsIcon.d.ts +6 -0
- package/dist/components/Icons/BellIcon.d.ts +6 -0
- package/dist/components/Icons/ChartIcon.d.ts +3 -0
- package/dist/components/Icons/ChatBox.d.ts +5 -0
- package/dist/components/Icons/CheckIcon.d.ts +2 -0
- package/dist/components/Icons/ChevronIcon.d.ts +8 -0
- package/dist/components/Icons/CrossIcon.d.ts +7 -0
- package/dist/components/Icons/DeleteIcon.d.ts +6 -0
- package/dist/components/Icons/DownArrowIcon.d.ts +6 -0
- package/dist/components/Icons/DragIcon.d.ts +3 -0
- package/dist/components/Icons/EditIcon.d.ts +6 -0
- package/dist/components/Icons/EmptyStateDashboardIcon.d.ts +2 -0
- package/dist/components/Icons/ExclamationMarkIcon.d.ts +6 -0
- package/dist/components/Icons/EyeIcon.d.ts +3 -0
- package/dist/components/Icons/GearIcon.d.ts +3 -0
- package/dist/components/Icons/GroupIcon.d.ts +3 -0
- package/dist/components/Icons/HeartIcon.d.ts +6 -0
- package/dist/components/Icons/LeftArrowIcon.d.ts +6 -0
- package/dist/components/Icons/LightBulbIcon.d.ts +6 -0
- package/dist/components/Icons/LockIcon.d.ts +6 -0
- package/dist/components/Icons/MessagesIcon.d.ts +6 -0
- package/dist/components/Icons/NotesIcon.d.ts +6 -0
- package/dist/components/Icons/PinIcon.d.ts +6 -0
- package/dist/components/Icons/PrintIcon.d.ts +3 -0
- package/dist/components/Icons/RightArrowIcon.d.ts +6 -0
- package/dist/components/Icons/SmallCircleIcon.d.ts +6 -0
- package/dist/components/Icons/SmallDiamondIcon.d.ts +6 -0
- package/dist/components/Icons/SmallSquareIcon.d.ts +6 -0
- package/dist/components/Icons/SpaceRocketIcon.d.ts +6 -0
- package/dist/components/Icons/types/IconProps.type.d.ts +3 -0
- package/dist/components/InfoBlock/InfoBlock.d.ts +14 -0
- package/dist/components/InfoField/InfoField.d.ts +18 -0
- package/dist/components/Input/Input.d.ts +44 -0
- package/dist/components/Line/Line.d.ts +14 -0
- package/dist/components/ListItem/ListItem.d.ts +9 -0
- package/dist/components/ListTable/ListTable.d.ts +35 -0
- package/dist/components/ListTable/ListTableCell.d.ts +10 -0
- package/dist/components/ListTable/ListTableHeader.d.ts +7 -0
- package/dist/components/ListTable/ListTableRow.d.ts +9 -0
- package/dist/components/LoadingIndicator/LoadingIndicator.d.ts +11 -0
- package/dist/components/Menu/Menu.d.ts +14 -0
- package/dist/components/Modal/Modal.d.ts +31 -0
- package/dist/components/Modal/ModalWithButtons.d.ts +9 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +25 -0
- package/dist/components/MultiSelect/MultiSelectUtils.d.ts +1 -0
- package/dist/components/NavMenu/NavLayout.d.ts +20 -0
- package/dist/components/NavMenu/NavMenu.d.ts +1 -0
- package/dist/components/NavMenu/NavMenuContent.d.ts +7 -0
- package/dist/components/NavMenu/NavMenuItem.d.ts +15 -0
- package/dist/components/NotificationBanner/NotificationBanner.d.ts +22 -0
- package/dist/components/Page/CRUDPage.d.ts +43 -0
- package/dist/components/Page/Page.d.ts +58 -0
- package/dist/components/PaginationMenu/PaginationMenu.d.ts +20 -0
- package/dist/components/PaginationMenu/PaginationMenuLarge.d.ts +13 -0
- package/dist/components/PaginationMenu/PaginationMenuSmall.d.ts +8 -0
- package/dist/components/PreviewPhone/PreviewPhone.d.ts +7 -0
- package/dist/components/PreviewPhone/useWindowDimensions.d.ts +4 -0
- package/dist/components/Radio/Radio.d.ts +18 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +31 -0
- package/dist/components/Section/Section.d.ts +15 -0
- package/dist/components/Select/LegacySelect.d.ts +32 -0
- package/dist/components/Select/Select.d.ts +6 -0
- package/dist/components/Select/options.transformer.d.ts +14 -0
- package/dist/components/Select/select.utils.d.ts +7 -0
- package/dist/components/SettingsMenuButton/SettingsMenuButton.d.ts +16 -0
- package/dist/components/Spinner/Spinner.d.ts +6 -0
- package/dist/components/Steps/Step.d.ts +10 -0
- package/dist/components/Steps/Steps.d.ts +11 -0
- package/dist/components/Switcher/Switcher.d.ts +26 -0
- package/dist/components/Switcher/SwitcherItem.d.ts +24 -0
- package/dist/components/TabLinks/TabLinks.d.ts +14 -0
- package/dist/components/Tabbar/Tabbar.d.ts +10 -0
- package/dist/components/Tabbar/TabbarItem.d.ts +15 -0
- package/dist/components/Tag/Tag.d.ts +17 -0
- package/dist/components/Tag/TagGroup.d.ts +13 -0
- package/dist/components/Text/LegacyText.d.ts +37 -0
- package/dist/components/Text/Text.d.ts +27 -0
- package/dist/components/TextEditor/TextEditor.d.ts +14 -0
- package/dist/components/TextEditorV2/TextEditorV2.d.ts +6 -0
- package/dist/components/TextLink/TextLink.d.ts +11 -0
- package/dist/components/TextListItem/TextListItem.d.ts +12 -0
- package/dist/components/Textarea/Textarea.d.ts +22 -0
- package/dist/components/Title/LegacyTitle.d.ts +22 -0
- package/dist/components/Title/Title.d.ts +14 -0
- package/dist/components/ViewItem/ViewItem.d.ts +16 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/types/general.types.d.ts +7 -0
- package/dist/utils/useOutsideClick.d.ts +2 -0
- package/dist/web-ui.cjs.development.js +23 -0
- package/dist/web-ui.cjs.development.js.map +1 -0
- package/dist/web-ui.cjs.production.min.js +2 -0
- package/dist/web-ui.cjs.production.min.js.map +1 -0
- package/dist/web-ui.esm.js +17 -0
- package/dist/web-ui.esm.js.map +1 -0
- package/package.json +122 -0
- package/src/assets/add.svg +5 -0
- package/src/assets/add_hover.svg +4 -0
- package/src/assets/big-menu-icon-hover.svg +6 -0
- package/src/assets/big-menu-icon.svg +6 -0
- package/src/assets/check-cross-icon.svg +7 -0
- package/src/assets/check-icon-primary.svg +5 -0
- package/src/assets/check-icon.svg +3 -0
- package/src/assets/chevron-double.svg +3 -0
- package/src/assets/close.svg +3 -0
- package/src/assets/color-variant-cross.svg +3 -0
- package/src/assets/cross-dark.svg +3 -0
- package/src/assets/delete.svg +4 -0
- package/src/assets/delete_hover.svg +4 -0
- package/src/assets/edit.svg +6 -0
- package/src/assets/edit_hover.svg +6 -0
- package/src/assets/error-icon.svg +7 -0
- package/src/assets/grid-view-icon-active.svg +6 -0
- package/src/assets/grid-view-icon.svg +6 -0
- package/src/assets/groups.svg +3 -0
- package/src/assets/hamburger.svg +5 -0
- package/src/assets/happy-star.svg +9 -0
- package/src/assets/hcps.svg +3 -0
- package/src/assets/info-icon.svg +6 -0
- package/src/assets/left-arrow-blue.svg +3 -0
- package/src/assets/left-arrow-grey.svg +3 -0
- package/src/assets/list-view-icon-active.svg +3 -0
- package/src/assets/list-view-icon.svg +3 -0
- package/src/assets/loading.svg +16 -0
- package/src/assets/modal-close-icon-active.svg +9 -0
- package/src/assets/modal-close-icon.svg +9 -0
- package/src/assets/no-open-alerts.svg +19 -0
- package/src/assets/patients.svg +3 -0
- package/src/assets/phone-mockup.svg +9 -0
- package/src/assets/programs.svg +3 -0
- package/src/assets/right-arrow-blue.svg +3 -0
- package/src/assets/right-arrow-grey.svg +3 -0
- package/src/assets/search-cancel.svg +3 -0
- package/src/assets/search-not-found.svg +70 -0
- package/src/assets/search.svg +3 -0
- package/src/assets/spinner-gray.svg +6 -0
- package/src/assets/spinner.svg +6 -0
- package/src/assets/starIcon.svg +3 -0
- package/src/assets/success-icon.svg +7 -0
- package/src/components/Acknowledgement/Acknowledgement.js +61 -0
- package/src/components/Acknowledgement/Acknowledgement.scss +49 -0
- package/src/components/Avatar/Avatar.js +81 -0
- package/src/components/Avatar/Avatar.scss +153 -0
- package/src/components/Badge/Badge.tsx +23 -0
- package/src/components/Button/Button.examples.md +46 -0
- package/src/components/Button/Button.tsx +200 -0
- package/src/components/Button/Button.types.ts +41 -0
- package/src/components/Button/ButtonIcon.tsx +42 -0
- package/src/components/ButtonV2/ButtonV2.tsx +91 -0
- package/src/components/ButtonV2/PrimaryButton.tsx +43 -0
- package/src/components/ButtonV2/SecondaryButton.tsx +31 -0
- package/src/components/ButtonV2/TertiaryButton.tsx +31 -0
- package/src/components/Carousel/Carousel.tsx +52 -0
- package/src/components/Carousel/GliderContainer.scss +13 -0
- package/src/components/Carousel/GliderContainer.tsx +22 -0
- package/src/components/CenteredHero/CenteredHero.js +50 -0
- package/src/components/Checkbox/Checkbox.scss +115 -0
- package/src/components/Checkbox/Checkbox.tsx +114 -0
- package/src/components/ConfirmationDialog/ConfirmationDialog.scss +15 -0
- package/src/components/ConfirmationDialog/ConfirmationDialog.tsx +84 -0
- package/src/components/Datepicker/Datepicker.js +96 -0
- package/src/components/Datepicker/Datepicker.scss +331 -0
- package/src/components/Dropdown/Dropdown.js +364 -0
- package/src/components/Dropdown/Dropdown.scss +83 -0
- package/src/components/EmptyListMessage/EmptyListMessage.tsx +34 -0
- package/src/components/ErrorBlock/ErrorBlock.js +24 -0
- package/src/components/ErrorBlock/ErrorBlock.scss +20 -0
- package/src/components/Icons/AddIcon.tsx +27 -0
- package/src/components/Icons/AlertsIcon.tsx +26 -0
- package/src/components/Icons/BellIcon.tsx +26 -0
- package/src/components/Icons/ChartIcon.tsx +20 -0
- package/src/components/Icons/ChatBox.tsx +23 -0
- package/src/components/Icons/CheckIcon.tsx +23 -0
- package/src/components/Icons/ChevronIcon.tsx +30 -0
- package/src/components/Icons/CrossIcon.tsx +26 -0
- package/src/components/Icons/DeleteIcon.tsx +23 -0
- package/src/components/Icons/DownArrowIcon.tsx +17 -0
- package/src/components/Icons/DragIcon.tsx +23 -0
- package/src/components/Icons/EditIcon.tsx +23 -0
- package/src/components/Icons/EmptyStateDashboardIcon.tsx +130 -0
- package/src/components/Icons/ExclamationMarkIcon.tsx +23 -0
- package/src/components/Icons/EyeIcon.tsx +21 -0
- package/src/components/Icons/GearIcon.tsx +21 -0
- package/src/components/Icons/GroupIcon.tsx +21 -0
- package/src/components/Icons/HeartIcon.tsx +23 -0
- package/src/components/Icons/LeftArrowIcon.tsx +23 -0
- package/src/components/Icons/LightBulbIcon.tsx +28 -0
- package/src/components/Icons/LockIcon.tsx +23 -0
- package/src/components/Icons/MessagesIcon.tsx +23 -0
- package/src/components/Icons/NotesIcon.tsx +23 -0
- package/src/components/Icons/PinIcon.tsx +23 -0
- package/src/components/Icons/PrintIcon.tsx +15 -0
- package/src/components/Icons/RightArrowIcon.tsx +23 -0
- package/src/components/Icons/SmallCircleIcon.tsx +21 -0
- package/src/components/Icons/SmallDiamondIcon.tsx +31 -0
- package/src/components/Icons/SmallSquareIcon.tsx +21 -0
- package/src/components/Icons/SpaceRocketIcon.tsx +23 -0
- package/src/components/Icons/types/IconProps.type.ts +3 -0
- package/src/components/InfoBlock/InfoBlock.js +24 -0
- package/src/components/InfoBlock/InfoBlock.scss +20 -0
- package/src/components/InfoField/InfoField.tsx +86 -0
- package/src/components/Input/Input.examples.md +94 -0
- package/src/components/Input/Input.js +141 -0
- package/src/components/Line/Line.js +38 -0
- package/src/components/ListItem/ListItem.scss +20 -0
- package/src/components/ListItem/ListItem.tsx +26 -0
- package/src/components/ListTable/ListTable.tsx +157 -0
- package/src/components/ListTable/ListTableCell.tsx +67 -0
- package/src/components/ListTable/ListTableHeader.tsx +33 -0
- package/src/components/ListTable/ListTableRow.tsx +46 -0
- package/src/components/LoadingIndicator/LoadingIndicator.scss +50 -0
- package/src/components/LoadingIndicator/LoadingIndicator.tsx +44 -0
- package/src/components/Menu/Menu.js +74 -0
- package/src/components/Menu/Menu.scss +27 -0
- package/src/components/Modal/Modal.scss +117 -0
- package/src/components/Modal/Modal.tsx +104 -0
- package/src/components/Modal/ModalWithButtons.tsx +34 -0
- package/src/components/MultiSelect/MultiSelect.js +117 -0
- package/src/components/MultiSelect/MultiSelect.scss +29 -0
- package/src/components/MultiSelect/MultiSelectUtils.js +23 -0
- package/src/components/NavMenu/NavLayout.tsx +40 -0
- package/src/components/NavMenu/NavMenu.js +35 -0
- package/src/components/NavMenu/NavMenuContent.tsx +23 -0
- package/src/components/NavMenu/NavMenuItem.tsx +96 -0
- package/src/components/NotificationBanner/NotificationBanner.tsx +57 -0
- package/src/components/Page/CRUDPage.js +123 -0
- package/src/components/Page/CRUDPage.scss +32 -0
- package/src/components/Page/Page.js +102 -0
- package/src/components/Page/Page.scss +59 -0
- package/src/components/PaginationMenu/PaginationMenu.js +31 -0
- package/src/components/PaginationMenu/PaginationMenuLarge.tsx +94 -0
- package/src/components/PaginationMenu/PaginationMenuSmall.tsx +40 -0
- package/src/components/PreviewPhone/PreviewPhone.tsx +53 -0
- package/src/components/PreviewPhone/useWindowDimensions.js +26 -0
- package/src/components/Radio/Radio.js +99 -0
- package/src/components/Radio/Radio.scss +58 -0
- package/src/components/RadioGroup/RadioGroup.js +63 -0
- package/src/components/RadioGroup/RadioGroup.scss +37 -0
- package/src/components/Section/Section.scss +74 -0
- package/src/components/Section/Section.tsx +67 -0
- package/src/components/Select/LegacySelect.js +114 -0
- package/src/components/Select/Select.examples.md +161 -0
- package/src/components/Select/Select.tsx +136 -0
- package/src/components/Select/options.transformer.ts +36 -0
- package/src/components/Select/select.utils.spec.ts +63 -0
- package/src/components/Select/select.utils.ts +45 -0
- package/src/components/SettingsMenuButton/SettingsMenuButton.tsx +111 -0
- package/src/components/Spinner/Spinner.tsx +23 -0
- package/src/components/Steps/Step.tsx +22 -0
- package/src/components/Steps/Steps.tsx +24 -0
- package/src/components/Switcher/Switcher.js +58 -0
- package/src/components/Switcher/SwitcherItem.js +61 -0
- package/src/components/Switcher/SwitcherItem.scss +67 -0
- package/src/components/TabLinks/TabLinks.tsx +63 -0
- package/src/components/Tabbar/Tabbar.tsx +29 -0
- package/src/components/Tabbar/TabbarItem.tsx +53 -0
- package/src/components/Tag/Tag.tsx +39 -0
- package/src/components/Tag/TagGroup.tsx +25 -0
- package/src/components/Text/LegacyText.js +78 -0
- package/src/components/Text/Text.scss +67 -0
- package/src/components/Text/Text.tsx +81 -0
- package/src/components/TextEditor/TextEditor.js +61 -0
- package/src/components/TextEditor/TextEditor.scss +14 -0
- package/src/components/TextEditorV2/TextEditorV2.js +58 -0
- package/src/components/TextEditorV2/TextEditorV2.scss +110 -0
- package/src/components/TextLink/TextLink.tsx +42 -0
- package/src/components/TextListItem/TextListItem.js +31 -0
- package/src/components/TextListItem/TextListItem.scss +10 -0
- package/src/components/Textarea/Textarea.js +108 -0
- package/src/components/Textarea/Textarea.scss +56 -0
- package/src/components/Title/LegacyTitle.js +64 -0
- package/src/components/Title/Title.scss +65 -0
- package/src/components/Title/Title.tsx +57 -0
- package/src/components/ViewItem/ViewItem.tsx +73 -0
- package/src/index.tsx +14 -0
- package/src/styles/_colors.scss +59 -0
- package/src/styles/_layout.scss +64 -0
- package/src/styles/_shadows.scss +19 -0
- package/src/styles/_typography.scss +8 -0
- package/src/styles/_utils.scss +45 -0
- package/src/styles/fonts/avenir/3A0AF8_0_0.eot +0 -0
- package/src/styles/fonts/avenir/3A0AF8_0_0.ttf +0 -0
- package/src/styles/fonts/avenir/3A0AF8_0_0.woff +0 -0
- package/src/styles/fonts/avenir/3A0AF8_0_0.woff2 +0 -0
- package/src/styles/fonts/avenir/3A0AF8_1_0.eot +0 -0
- package/src/styles/fonts/avenir/3A0AF8_1_0.ttf +0 -0
- package/src/styles/fonts/avenir/3A0AF8_1_0.woff +0 -0
- package/src/styles/fonts/avenir/3A0AF8_1_0.woff2 +0 -0
- package/src/types/general.types.ts +11 -0
- package/src/utils/useOutsideClick.js +19 -0
package/README.md
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# TSDX React w/ Storybook User Guide
|
|
2
|
+
|
|
3
|
+
Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.
|
|
4
|
+
|
|
5
|
+
> This TSDX setup is meant for developing React component libraries (not apps!) that can be published to NPM. If you’re looking to build a React-based app, you should use `create-react-app`, `razzle`, `nextjs`, `gatsby`, or `react-static`.
|
|
6
|
+
|
|
7
|
+
> If you’re new to TypeScript and React, checkout [this handy cheatsheet](https://github.com/sw-yx/react-typescript-cheatsheet/)
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
TSDX scaffolds your new library inside `/src`, and also sets up a [Parcel-based](https://parceljs.org) playground for it inside `/example`.
|
|
12
|
+
|
|
13
|
+
The recommended workflow is to run TSDX in one terminal:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm start # or yarn start
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.
|
|
20
|
+
|
|
21
|
+
Then run either Storybook or the example playground:
|
|
22
|
+
|
|
23
|
+
### Storybook
|
|
24
|
+
|
|
25
|
+
Run inside another terminal:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
yarn storybook
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This loads the stories from `./stories`.
|
|
32
|
+
|
|
33
|
+
> NOTE: Stories should reference the components as if using the library, similar to the example playground. This means importing from the root project directory. This has been aliased in the tsconfig and the storybook webpack config as a helper.
|
|
34
|
+
|
|
35
|
+
### Example
|
|
36
|
+
|
|
37
|
+
Then run the example inside another:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
cd example
|
|
41
|
+
npm i # or yarn to install dependencies
|
|
42
|
+
npm start # or yarn start
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The default example imports and live reloads whatever is in `/dist`, so if you are seeing an out of date component, make sure TSDX is running in watch mode like we recommend above. **No symlinking required**, we use [Parcel's aliasing](https://parceljs.org/module_resolution.html#aliases).
|
|
46
|
+
|
|
47
|
+
To do a one-off build, use `npm run build` or `yarn build`.
|
|
48
|
+
|
|
49
|
+
To run tests, use `npm test` or `yarn test`.
|
|
50
|
+
|
|
51
|
+
## Configuration
|
|
52
|
+
|
|
53
|
+
Code quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly.
|
|
54
|
+
|
|
55
|
+
### Jest
|
|
56
|
+
|
|
57
|
+
Jest tests are set up to run with `npm test` or `yarn test`.
|
|
58
|
+
|
|
59
|
+
### Bundle analysis
|
|
60
|
+
|
|
61
|
+
Calculates the real cost of your library using [size-limit](https://github.com/ai/size-limit) with `npm run size` and visulize it with `npm run analyze`.
|
|
62
|
+
|
|
63
|
+
#### Setup Files
|
|
64
|
+
|
|
65
|
+
This is the folder structure we set up for you:
|
|
66
|
+
|
|
67
|
+
```txt
|
|
68
|
+
/example
|
|
69
|
+
index.html
|
|
70
|
+
index.tsx # test your component here in a demo app
|
|
71
|
+
package.json
|
|
72
|
+
tsconfig.json
|
|
73
|
+
/src
|
|
74
|
+
index.tsx # EDIT THIS
|
|
75
|
+
/test
|
|
76
|
+
blah.test.tsx # EDIT THIS
|
|
77
|
+
/stories
|
|
78
|
+
Thing.stories.tsx # EDIT THIS
|
|
79
|
+
/.storybook
|
|
80
|
+
main.js
|
|
81
|
+
preview.js
|
|
82
|
+
.gitignore
|
|
83
|
+
package.json
|
|
84
|
+
README.md # EDIT THIS
|
|
85
|
+
tsconfig.json
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### React Testing Library
|
|
89
|
+
|
|
90
|
+
We do not set up `react-testing-library` for you yet, we welcome contributions and documentation on this.
|
|
91
|
+
|
|
92
|
+
### Rollup
|
|
93
|
+
|
|
94
|
+
TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.
|
|
95
|
+
|
|
96
|
+
### TypeScript
|
|
97
|
+
|
|
98
|
+
`tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.
|
|
99
|
+
|
|
100
|
+
## Continuous Integration
|
|
101
|
+
|
|
102
|
+
### GitHub Actions
|
|
103
|
+
|
|
104
|
+
Two actions are added by default:
|
|
105
|
+
|
|
106
|
+
- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
|
|
107
|
+
- `size` which comments cost comparison of your library on every pull request using [size-limit](https://github.com/ai/size-limit)
|
|
108
|
+
|
|
109
|
+
## Optimizations
|
|
110
|
+
|
|
111
|
+
Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations:
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
// ./types/index.d.ts
|
|
115
|
+
declare var __DEV__: boolean;
|
|
116
|
+
|
|
117
|
+
// inside your code...
|
|
118
|
+
if (__DEV__) {
|
|
119
|
+
console.log('foo');
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions.
|
|
124
|
+
|
|
125
|
+
## Module Formats
|
|
126
|
+
|
|
127
|
+
CJS, ESModules, and UMD module formats are supported.
|
|
128
|
+
|
|
129
|
+
The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.
|
|
130
|
+
|
|
131
|
+
## Deploying the Example Playground
|
|
132
|
+
|
|
133
|
+
The Playground is just a simple [Parcel](https://parceljs.org) app, you can deploy it anywhere you would normally deploy that. Here are some guidelines for **manually** deploying with the Netlify CLI (`npm i -g netlify-cli`):
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
cd example # if not already in the example folder
|
|
137
|
+
npm run build # builds to dist
|
|
138
|
+
netlify deploy # deploy the dist folder
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Alternatively, if you already have a git repo connected, you can set up continuous deployment with Netlify:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
netlify init
|
|
145
|
+
# build command: yarn build && cd example && yarn && yarn build
|
|
146
|
+
# directory to deploy: example/dist
|
|
147
|
+
# pick yes for netlify.toml
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Named Exports
|
|
151
|
+
|
|
152
|
+
Per Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library.
|
|
153
|
+
|
|
154
|
+
## Including Styles
|
|
155
|
+
|
|
156
|
+
There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.
|
|
157
|
+
|
|
158
|
+
For vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so that it can be imported separately by your users and run through their bundler's loader.
|
|
159
|
+
|
|
160
|
+
## Publishing to NPM
|
|
161
|
+
|
|
162
|
+
We recommend using [np](https://github.com/sindresorhus/np).
|
|
163
|
+
|
|
164
|
+
## Usage with Lerna
|
|
165
|
+
|
|
166
|
+
When creating a new package with TSDX within a project set up with Lerna, you might encounter a `Cannot resolve dependency` error when trying to run the `example` project. To fix that you will need to make changes to the `package.json` file _inside the `example` directory_.
|
|
167
|
+
|
|
168
|
+
The problem is that due to the nature of how dependencies are installed in Lerna projects, the aliases in the example project's `package.json` might not point to the right place, as those dependencies might have been installed in the root of your Lerna project.
|
|
169
|
+
|
|
170
|
+
Change the `alias` to point to where those packages are actually installed. This depends on the directory structure of your Lerna project, so the actual path might be different from the diff below.
|
|
171
|
+
|
|
172
|
+
```diff
|
|
173
|
+
"alias": {
|
|
174
|
+
- "react": "../node_modules/react",
|
|
175
|
+
- "react-dom": "../node_modules/react-dom"
|
|
176
|
+
+ "react": "../../../node_modules/react",
|
|
177
|
+
+ "react-dom": "../../../node_modules/react-dom"
|
|
178
|
+
},
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
An alternative to fixing this problem would be to remove aliases altogether and define the dependencies referenced as aliases as dev dependencies instead. [However, that might cause other problems.](https://github.com/palmerhq/tsdx/issues/64)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export namespace ACKNOWLEDGEMENT_TYPE_OPTIONS {
|
|
2
|
+
export const SUCCESS: string;
|
|
3
|
+
export const FAILURE: string;
|
|
4
|
+
}
|
|
5
|
+
export default Acknowledgement;
|
|
6
|
+
declare function Acknowledgement({ message, type, isVisible, hasIcon, className, }: {
|
|
7
|
+
message?: string | undefined;
|
|
8
|
+
type?: string | undefined;
|
|
9
|
+
isVisible?: boolean | undefined;
|
|
10
|
+
hasIcon?: boolean | undefined;
|
|
11
|
+
className?: string | undefined;
|
|
12
|
+
}): JSX.Element;
|
|
13
|
+
declare namespace Acknowledgement {
|
|
14
|
+
export const propTypes: {
|
|
15
|
+
message: PropTypes.Requireable<string>;
|
|
16
|
+
type: PropTypes.Requireable<string>;
|
|
17
|
+
hasIcon: PropTypes.Requireable<boolean>;
|
|
18
|
+
isVisible: PropTypes.Requireable<boolean>;
|
|
19
|
+
className: PropTypes.Requireable<string>;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
import PropTypes from "prop-types";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function Avatar({ size, src, defaultImage, initials, className }: {
|
|
2
|
+
size: any;
|
|
3
|
+
src: any;
|
|
4
|
+
defaultImage: any;
|
|
5
|
+
initials: any;
|
|
6
|
+
className: any;
|
|
7
|
+
}): JSX.Element;
|
|
8
|
+
export namespace Avatar {
|
|
9
|
+
export namespace propTypes {
|
|
10
|
+
export const src: PropTypes.Requireable<string>;
|
|
11
|
+
export const initials: PropTypes.Validator<string>;
|
|
12
|
+
export const size: PropTypes.Requireable<string>;
|
|
13
|
+
export const defaultImage: PropTypes.Requireable<string>;
|
|
14
|
+
export const className: PropTypes.Requireable<string>;
|
|
15
|
+
}
|
|
16
|
+
export namespace defaultProps {
|
|
17
|
+
import size_1 = MEDIUM;
|
|
18
|
+
export { size_1 as size };
|
|
19
|
+
const defaultImage_1: null;
|
|
20
|
+
export { defaultImage_1 as defaultImage };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export default Avatar;
|
|
24
|
+
import PropTypes from "prop-types";
|
|
25
|
+
declare namespace AVATAR_SIZE_OPTIONS {
|
|
26
|
+
export const LARGE: string;
|
|
27
|
+
export const MEDIUM: string;
|
|
28
|
+
export const SMALL: string;
|
|
29
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { RestPropped } from "../../types/general.types";
|
|
3
|
+
import { IconProps } from "../Icons/types/IconProps.type";
|
|
4
|
+
export declare const BUTTON_ROLES: {
|
|
5
|
+
readonly PRIMARY: "primary";
|
|
6
|
+
readonly SECONDARY: "secondary";
|
|
7
|
+
readonly SECONDARY_DARK: "secondaryDark";
|
|
8
|
+
readonly TERTIARY: "tertiary";
|
|
9
|
+
readonly QUATERNARY: "quaternary";
|
|
10
|
+
readonly NEGATIVE: "negative";
|
|
11
|
+
readonly TEXT: "text";
|
|
12
|
+
readonly LINK: "link";
|
|
13
|
+
readonly ICON: "icon";
|
|
14
|
+
};
|
|
15
|
+
declare type BUTTON_KEYS = keyof typeof BUTTON_ROLES;
|
|
16
|
+
export declare type BUTTON_TYPE = typeof BUTTON_ROLES[BUTTON_KEYS];
|
|
17
|
+
export declare type ButtonType = "button" | "submit";
|
|
18
|
+
export interface ButtonProps extends RestPropped {
|
|
19
|
+
text?: string;
|
|
20
|
+
role?: BUTTON_TYPE;
|
|
21
|
+
type?: ButtonType;
|
|
22
|
+
title?: string;
|
|
23
|
+
link?: string;
|
|
24
|
+
isPending?: boolean;
|
|
25
|
+
isDisabled?: boolean;
|
|
26
|
+
onClick?: (arg: any) => void;
|
|
27
|
+
className?: string;
|
|
28
|
+
iconName?: string;
|
|
29
|
+
hasIcon?: boolean;
|
|
30
|
+
dynamicIcon?: React.FunctionComponent<IconProps>;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IconProps } from "../Icons/types/IconProps.type";
|
|
3
|
+
export declare type ButtonV2Type = "button" | "submit";
|
|
4
|
+
export interface ButtonV2Props {
|
|
5
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
6
|
+
type?: ButtonV2Type;
|
|
7
|
+
text?: string;
|
|
8
|
+
icon?: React.FunctionComponent<IconProps>;
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
isPending?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const ButtonV2: (props: ButtonV2Props) => JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IconProps } from "../Icons/types/IconProps.type";
|
|
3
|
+
import { ButtonV2Type } from "./ButtonV2";
|
|
4
|
+
export interface PrimaryButtonProps {
|
|
5
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
6
|
+
type?: ButtonV2Type;
|
|
7
|
+
text?: string;
|
|
8
|
+
icon?: React.FunctionComponent<IconProps>;
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
isPending?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const PrimaryButton: (props: PrimaryButtonProps) => JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IconProps } from "../Icons/types/IconProps.type";
|
|
3
|
+
export interface SecondaryButtonProps {
|
|
4
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
5
|
+
text?: string;
|
|
6
|
+
icon?: React.FunctionComponent<IconProps>;
|
|
7
|
+
}
|
|
8
|
+
export declare const SecondaryButton: (props: SecondaryButtonProps) => JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IconProps } from "../Icons/types/IconProps.type";
|
|
3
|
+
export interface TertiaryButtonProps {
|
|
4
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
5
|
+
text?: string;
|
|
6
|
+
icon?: React.FunctionComponent<IconProps>;
|
|
7
|
+
}
|
|
8
|
+
export declare const TertiaryButton: (props: TertiaryButtonProps) => JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default CenteredHero;
|
|
2
|
+
declare function CenteredHero({ title, text, image, buttons, className }: {
|
|
3
|
+
title: any;
|
|
4
|
+
text: any;
|
|
5
|
+
image: any;
|
|
6
|
+
buttons: any;
|
|
7
|
+
className: any;
|
|
8
|
+
}): JSX.Element;
|
|
9
|
+
declare namespace CenteredHero {
|
|
10
|
+
export namespace propTypes {
|
|
11
|
+
export const title: PropTypes.Requireable<string>;
|
|
12
|
+
export const text: PropTypes.Requireable<string>;
|
|
13
|
+
export const image: PropTypes.Requireable<string>;
|
|
14
|
+
export const buttons: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
15
|
+
title: PropTypes.Validator<string>;
|
|
16
|
+
handleOnClick: PropTypes.Validator<(...args: any[]) => any>;
|
|
17
|
+
type: PropTypes.Validator<"primary" | "secondary">;
|
|
18
|
+
}> | null | undefined)[]>;
|
|
19
|
+
export const className: PropTypes.Requireable<string>;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
import PropTypes from "prop-types";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./Checkbox.scss";
|
|
3
|
+
export interface CheckboxProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
text?: string;
|
|
6
|
+
explanation?: string;
|
|
7
|
+
type?: "regular" | "switch";
|
|
8
|
+
isChecked?: boolean;
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
name?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
13
|
+
className?: string;
|
|
14
|
+
error?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const Checkbox: ({ id, text, explanation, type, isChecked, isDisabled, name, value, onChange, className, error, }: CheckboxProps) => JSX.Element;
|
|
17
|
+
export default Checkbox;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./ConfirmationDialog.scss";
|
|
3
|
+
import { MODAL_SIZES_VALUES } from "../Modal/Modal";
|
|
4
|
+
import { BUTTON_TYPE } from "../Button/Button.types";
|
|
5
|
+
interface ConfirmationDialogTexts {
|
|
6
|
+
message: string;
|
|
7
|
+
confirmLabel: string;
|
|
8
|
+
cancelLabel: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
}
|
|
11
|
+
interface ConfirmationDialogProps {
|
|
12
|
+
texts: ConfirmationDialogTexts;
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
onCancel: () => void;
|
|
15
|
+
onConfirm: () => void;
|
|
16
|
+
isProcessing: boolean;
|
|
17
|
+
cancelButtonRole: BUTTON_TYPE;
|
|
18
|
+
confirmButtonRole: BUTTON_TYPE;
|
|
19
|
+
size: MODAL_SIZES_VALUES;
|
|
20
|
+
showHeader: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const ConfirmationDialog: {
|
|
24
|
+
(props: ConfirmationDialogProps): JSX.Element;
|
|
25
|
+
defaultProps: {
|
|
26
|
+
isProcessing: boolean;
|
|
27
|
+
cancelButtonRole: "secondary";
|
|
28
|
+
confirmButtonRole: "primary";
|
|
29
|
+
size: "default";
|
|
30
|
+
showHeader: boolean;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare class Datepicker extends React.Component<any, any, any> {
|
|
2
|
+
constructor(props: any);
|
|
3
|
+
constructor(props: any, context: any);
|
|
4
|
+
handleCloseButtonClick: (event: any) => void;
|
|
5
|
+
getDateFormat: () => "L LT" | "L";
|
|
6
|
+
datepickerRef: any;
|
|
7
|
+
}
|
|
8
|
+
declare namespace Datepicker {
|
|
9
|
+
export namespace propTypes {
|
|
10
|
+
export const className: PropTypes.Requireable<string>;
|
|
11
|
+
export const selected: PropTypes.Requireable<object>;
|
|
12
|
+
export const hasCloseButton: PropTypes.Requireable<boolean>;
|
|
13
|
+
export const closeButtonText: PropTypes.Requireable<string>;
|
|
14
|
+
export const onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
15
|
+
export const showMonthDropdown: PropTypes.Requireable<boolean>;
|
|
16
|
+
export const showYearDropdown: PropTypes.Requireable<boolean>;
|
|
17
|
+
export const minDate: PropTypes.Requireable<any>;
|
|
18
|
+
export const maxDate: PropTypes.Requireable<any>;
|
|
19
|
+
export const isDisabled: PropTypes.Requireable<boolean>;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export default Datepicker;
|
|
23
|
+
import React from "react";
|
|
24
|
+
import PropTypes from "prop-types";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export default Dropdown;
|
|
2
|
+
declare class Dropdown extends React.PureComponent<any, any, any> {
|
|
3
|
+
static addHighlightIndexToItems: (items: any) => any;
|
|
4
|
+
static getTotalItemCount: (items: any) => any;
|
|
5
|
+
static getDerivedStateFromProps(nextProps: any, prevState: any): any;
|
|
6
|
+
constructor(props: any);
|
|
7
|
+
handleClickOutside: (event: any) => void;
|
|
8
|
+
handleKeyDown: (event: any) => void;
|
|
9
|
+
findItem: (items: any, fieldName: any, fieldValue: any) => any;
|
|
10
|
+
openDropdown: () => void;
|
|
11
|
+
closeDropdown: () => void;
|
|
12
|
+
setSelectedItem: (item: any) => void;
|
|
13
|
+
findSelectedItem: (selectedIndex: any) => Element;
|
|
14
|
+
scrollToHighlightedItem: (selectedIndex: any) => void;
|
|
15
|
+
increaseHighlightIndexIfPossible: () => void;
|
|
16
|
+
decreaseHighlightIndexIfPossible: () => void;
|
|
17
|
+
selectItem: (item: any) => void;
|
|
18
|
+
renderIndividualItem: (item: any) => JSX.Element;
|
|
19
|
+
renderGroupedItems: (item: any) => JSX.Element;
|
|
20
|
+
renderItems: () => JSX.Element;
|
|
21
|
+
dropdownListRef: HTMLDivElement | null | undefined;
|
|
22
|
+
rootRef: HTMLDivElement | null | undefined;
|
|
23
|
+
}
|
|
24
|
+
declare namespace Dropdown {
|
|
25
|
+
export namespace propTypes {
|
|
26
|
+
export const items: PropTypes.Validator<(PropTypes.InferProps<{
|
|
27
|
+
id: PropTypes.Validator<string>;
|
|
28
|
+
text: PropTypes.Validator<string>;
|
|
29
|
+
key: PropTypes.Validator<string>;
|
|
30
|
+
}> | PropTypes.InferProps<{
|
|
31
|
+
subItems: PropTypes.Validator<(PropTypes.InferProps<{
|
|
32
|
+
id: PropTypes.Validator<string>;
|
|
33
|
+
text: PropTypes.Validator<string>;
|
|
34
|
+
key: PropTypes.Validator<string>;
|
|
35
|
+
}> | null | undefined)[]>;
|
|
36
|
+
title: PropTypes.Requireable<string>;
|
|
37
|
+
groupKey: PropTypes.Validator<string>;
|
|
38
|
+
}> | null | undefined)[]>;
|
|
39
|
+
export const initialSelectedItemId: PropTypes.Requireable<React.Key>;
|
|
40
|
+
export const placeholder: PropTypes.Requireable<string>;
|
|
41
|
+
export const className: PropTypes.Requireable<string>;
|
|
42
|
+
export const onItemSelect: PropTypes.Validator<(...args: any[]) => any>;
|
|
43
|
+
export const wider: PropTypes.Requireable<boolean>;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
import React from "react";
|
|
47
|
+
import PropTypes from "prop-types";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const imageSrc: {
|
|
3
|
+
"no-open-alerts": any;
|
|
4
|
+
"search-not-found": any;
|
|
5
|
+
"no-notes-found": any;
|
|
6
|
+
};
|
|
7
|
+
interface EmptyListMessageProps {
|
|
8
|
+
text: string;
|
|
9
|
+
imageName?: keyof typeof imageSrc;
|
|
10
|
+
dataTestId?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const EmptyListMessage: ({ text, imageName, dataTestId, className, }: EmptyListMessageProps) => JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default ErrorBlock;
|
|
2
|
+
declare function ErrorBlock({ message, className, ...otherProps }: {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
message: any;
|
|
5
|
+
className?: string | undefined;
|
|
6
|
+
}): JSX.Element;
|
|
7
|
+
declare namespace ErrorBlock {
|
|
8
|
+
export namespace propTypes {
|
|
9
|
+
export const message: PropTypes.Validator<string>;
|
|
10
|
+
export const className: PropTypes.Requireable<string>;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
import PropTypes from "prop-types";
|