@luscii-healthtech/web-ui 0.1.1 → 0.1.4

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 (35) hide show
  1. package/README.md +34 -155
  2. package/dist/components/Dropdown/Dropdown.d.ts +1 -1
  3. package/dist/components/Page/Page.d.ts +1 -1
  4. package/dist/components/Radio/Radio.d.ts +1 -1
  5. package/dist/components/RadioGroup/RadioGroup.d.ts +2 -3
  6. package/dist/components/Section/Section.d.ts +3 -4
  7. package/dist/components/Select/LegacySelect.d.ts +2 -3
  8. package/dist/components/Tabbar/Tabbar.d.ts +1 -1
  9. package/dist/components/Tabbar/TabbarItem.d.ts +1 -1
  10. package/dist/components/ViewItem/ViewItem.d.ts +2 -2
  11. package/dist/index.d.ts +51 -0
  12. package/dist/web-ui.cjs.development.css +1091 -0
  13. package/dist/web-ui.cjs.development.js +4064 -3
  14. package/dist/web-ui.cjs.development.js.map +1 -1
  15. package/dist/web-ui.cjs.production.min.css +1091 -0
  16. package/dist/web-ui.cjs.production.min.js +1 -1
  17. package/dist/web-ui.cjs.production.min.js.map +1 -1
  18. package/dist/web-ui.esm.css +1091 -0
  19. package/dist/web-ui.esm.js +4010 -4
  20. package/dist/web-ui.esm.js.map +1 -1
  21. package/package.json +13 -19
  22. package/src/assets/spinner.svg +1 -2
  23. package/src/assets/success-icon.svg +1 -2
  24. package/src/components/ListTable/ListTableCell.tsx +5 -3
  25. package/src/components/PaginationMenu/PaginationMenuLarge.tsx +6 -4
  26. package/src/components/PaginationMenu/PaginationMenuSmall.tsx +2 -2
  27. package/src/components/PreviewPhone/PreviewPhone.tsx +2 -3
  28. package/src/components/Section/Section.tsx +5 -9
  29. package/src/components/Select/Select.tsx +1 -1
  30. package/src/components/SettingsMenuButton/SettingsMenuButton.tsx +1 -1
  31. package/src/components/Tabbar/Tabbar.tsx +2 -2
  32. package/src/components/Tabbar/TabbarItem.tsx +3 -3
  33. package/src/components/ViewItem/ViewItem.tsx +2 -2
  34. package/src/custom.d.ts +4 -0
  35. package/src/index.tsx +55 -0
package/README.md CHANGED
@@ -1,181 +1,60 @@
1
- # TSDX React w/ Storybook User Guide
1
+ # web-ui
2
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.
3
+ The web-ui repository contains the web UI components for Luscii's front end projects. It is published to NPM for inclusion into our projects. It also uses storybook and is published to chromatic for easy review of changes.
4
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`.
5
+ ## Running locally
6
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:
7
+ If you want to run storybook locally you can use
26
8
 
27
9
  ```bash
10
+ yarn install
28
11
  yarn storybook
29
12
  ```
30
13
 
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.
14
+ ## Contributing
34
15
 
35
- ### Example
16
+ Make sure you understand our design system and follow its guidelines. They are document in storybook. We value consistency, simplicity and usability highly. Don't mess it up.
36
17
 
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
18
+ If you want to add components, do so in
43
19
  ```
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
20
+ /src/components
86
21
  ```
22
+ Please stay vigilant when adding components that we implement them consistently in our projects and that it is clear when and where they have to be used. We want to avoid a lot of components that are similar.
87
23
 
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
- }
24
+ When you create new components, you must add them to storybook as well. Stories go in
121
25
  ```
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
26
+ /stories
148
27
  ```
149
28
 
150
- ## Named Exports
151
29
 
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.
30
+ ## CI setup
153
31
 
154
- ## Including Styles
32
+ #### Branching
155
33
 
156
- There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.
34
+ The `main` branch is our default branch. When you contribute, branch from there and name your branch
157
35
 
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.
36
+ ```
37
+ //Branch names convention (enforced)
38
+
39
+ major/* //for a new design system or changes that effect our foundations (typography, color)
40
+ minor/* //for new components and stories
41
+ patch/* //for small improvements to existing components, stories
42
+ bug/* //for bugs, fixes
43
+ ```
159
44
 
160
- ## Publishing to NPM
45
+ We have configured at lot of magic for your convenience.
161
46
 
162
- We recommend using [np](https://github.com/sindresorhus/np).
47
+ #### On every PR
48
+ 1. the module build, lint and tests are checked.
49
+ 2. The storybook build is published to chromatic.
50
+ 3. Labels are added based on the branch name and PR size.
51
+ 4. Branch names must follow the convention and are checked
52
+
163
53
 
164
- ## Usage with Lerna
165
54
 
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_.
55
+ #### On merge to main
167
56
 
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
- ```
57
+ 1. Draft a github release
58
+ 2. Version bump of the package
59
+ 3. Publish new package to NPM
180
60
 
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)
@@ -36,7 +36,7 @@ declare namespace Dropdown {
36
36
  title: PropTypes.Requireable<string>;
37
37
  groupKey: PropTypes.Validator<string>;
38
38
  }> | null | undefined)[]>;
39
- export const initialSelectedItemId: PropTypes.Requireable<React.Key>;
39
+ export const initialSelectedItemId: PropTypes.Requireable<string | number>;
40
40
  export const placeholder: PropTypes.Requireable<string>;
41
41
  export const className: PropTypes.Requireable<string>;
42
42
  export const onItemSelect: PropTypes.Validator<(...args: any[]) => any>;
@@ -7,7 +7,7 @@ export default Page;
7
7
  */
8
8
  export type Breadcrumb = {
9
9
  name?: string | undefined;
10
- icon?: string | Object | undefined;
10
+ icon?: string | any;
11
11
  link?: string | undefined;
12
12
  };
13
13
  /**
@@ -6,7 +6,7 @@ declare class Radio extends React.PureComponent<any, any, any> {
6
6
  isChecked: PropTypes.Validator<boolean>;
7
7
  isDisabled: PropTypes.Requireable<boolean>;
8
8
  name: PropTypes.Validator<string>;
9
- value: PropTypes.Requireable<React.Key>;
9
+ value: PropTypes.Requireable<string | number>;
10
10
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
11
  };
12
12
  constructor(props: any);
@@ -16,16 +16,15 @@ declare namespace RadioGroup {
16
16
  export const className: PropTypes.Requireable<string>;
17
17
  export const radioClassName: PropTypes.Requireable<string>;
18
18
  export const name: PropTypes.Requireable<string>;
19
- export const selectedOption: PropTypes.Requireable<React.Key>;
19
+ export const selectedOption: PropTypes.Requireable<string | number>;
20
20
  export const isVertical: PropTypes.Requireable<boolean>;
21
21
  export const radioOptions: PropTypes.Validator<(PropTypes.InferProps<{
22
22
  text: PropTypes.Requireable<string>;
23
23
  info: PropTypes.Requireable<string>;
24
24
  isDisabled: PropTypes.Requireable<boolean>;
25
- value: PropTypes.Requireable<React.Key>;
25
+ value: PropTypes.Requireable<string | number>;
26
26
  }> | null | undefined)[]>;
27
27
  export const onChange: PropTypes.Requireable<(...args: any[]) => any>;
28
28
  }
29
29
  }
30
30
  import PropTypes from "prop-types";
31
- import React from "react";
@@ -3,13 +3,12 @@ import { ButtonProps } from "../Button/Button.types";
3
3
  import { LoadingIndicatorProps } from "../LoadingIndicator/LoadingIndicator";
4
4
  import { RestPropped } from "../../types/general.types";
5
5
  import "./Section.scss";
6
- export interface SectionProps<TitleType, FooterType> extends RestPropped {
7
- title?: string | TitleType;
6
+ export interface SectionProps extends RestPropped {
7
+ title?: string;
8
8
  buttons?: ButtonProps[];
9
- footer?: FooterType;
10
9
  className?: string;
11
10
  isLoading?: boolean;
12
11
  loadingIndicatorProps?: LoadingIndicatorProps;
13
12
  }
14
- export declare function Section<TitleType = unknown, FooterType = unknown>({ title, buttons, footer, children, className, isLoading, loadingIndicatorProps, ...restProps }: React.PropsWithChildren<SectionProps<TitleType, FooterType>>): JSX.Element;
13
+ export declare function Section({ title, buttons, children, className, isLoading, loadingIndicatorProps, ...restProps }: React.PropsWithChildren<SectionProps>): JSX.Element;
15
14
  export default Section;
@@ -17,11 +17,11 @@ declare function LegacySelect({ className, value, name, placeholder, options, on
17
17
  declare namespace LegacySelect {
18
18
  export namespace propTypes {
19
19
  export const className: PropTypes.Requireable<string>;
20
- export const value: PropTypes.Requireable<React.Key>;
20
+ export const value: PropTypes.Requireable<string | number>;
21
21
  export const name: PropTypes.Validator<string>;
22
22
  export const placeholder: PropTypes.Requireable<string>;
23
23
  export const options: PropTypes.Validator<(PropTypes.InferProps<{
24
- value: PropTypes.Validator<React.Key>;
24
+ value: PropTypes.Validator<string | number>;
25
25
  text: PropTypes.Validator<string>;
26
26
  disabled: PropTypes.Requireable<boolean>;
27
27
  }> | null | undefined)[]>;
@@ -29,4 +29,3 @@ declare namespace LegacySelect {
29
29
  }
30
30
  }
31
31
  import PropTypes from "prop-types";
32
- import React from "react";
@@ -3,7 +3,7 @@ import { TabItemDetails } from "./TabbarItem";
3
3
  interface TabbarProps {
4
4
  tabs?: TabItemDetails[];
5
5
  selectedIndex?: number;
6
- onSelect?(index: number): void;
6
+ onSelect?: (index: number) => void;
7
7
  className?: string;
8
8
  }
9
9
  export declare const Tabbar: ({ tabs, selectedIndex, onSelect, className }: TabbarProps) => JSX.Element;
@@ -8,7 +8,7 @@ export interface TabItemDetails {
8
8
  interface TabbarItemProps extends TabItemDetails {
9
9
  index: number;
10
10
  isSelected?: boolean;
11
- onSelect(index: number): void;
11
+ onSelect?: (index: number) => void;
12
12
  className?: string;
13
13
  }
14
14
  declare const TabbarItem: ({ title, index, isSelected, onSelect, className, badgeCount, isLoading, dataTestId, }: TabbarItemProps) => JSX.Element;
@@ -2,7 +2,7 @@
2
2
  import { TextProps } from "../Text/Text";
3
3
  import { RestPropped } from "../../types/general.types";
4
4
  import { ButtonProps } from "../Button/Button.types";
5
- export interface ViewItemProps<AccessoryType> extends RestPropped {
5
+ export interface ViewItemProps<AccessoryType extends JSX.Element> extends RestPropped {
6
6
  titleProps?: TextProps;
7
7
  title?: string;
8
8
  titleAccessory?: AccessoryType;
@@ -12,5 +12,5 @@ export interface ViewItemProps<AccessoryType> extends RestPropped {
12
12
  className?: string;
13
13
  buttons?: ButtonProps[];
14
14
  }
15
- export declare function ViewItem<AccessoryType>({ titleProps, title, titleAccessory, contentProps, content, defaultContent, className, buttons, ...restProps }: ViewItemProps<AccessoryType>): JSX.Element;
15
+ export declare function ViewItem<AccessoryType extends JSX.Element>({ titleProps, title, titleAccessory, contentProps, content, defaultContent, className, buttons, ...restProps }: ViewItemProps<AccessoryType>): JSX.Element;
16
16
  export default ViewItem;
package/dist/index.d.ts CHANGED
@@ -1 +1,52 @@
1
+ export { default as Acknowledgement, ACKNOWLEDGEMENT_TYPE_OPTIONS } from "./components/Acknowledgement/Acknowledgement";
2
+ export { default as Avatar } from "./components/Avatar/Avatar";
3
+ export { default as Badge } from "./components/Badge/Badge";
4
+ export { default as Button } from "./components/Button/Button";
5
+ export { BUTTON_ROLES, ButtonProps, BUTTON_TYPE, ButtonType } from "./components/Button/Button.types";
6
+ export { ButtonIcon } from "./components/Button/ButtonIcon";
7
+ export { PrimaryButton, PrimaryButtonProps } from "./components/ButtonV2/PrimaryButton";
8
+ export { SecondaryButton, SecondaryButtonProps } from "./components/ButtonV2/SecondaryButton";
9
+ export { TertiaryButton, TertiaryButtonProps } from "./components/ButtonV2/TertiaryButton";
10
+ export { default as Carousel } from "./components/Carousel/Carousel";
11
+ export { default as CenteredHero } from "./components/CenteredHero/CenteredHero";
12
+ export { default as Checkbox } from "./components/Checkbox/Checkbox";
13
+ export { ConfirmationDialog } from "./components/ConfirmationDialog/ConfirmationDialog";
14
+ export { default as DatePicker } from "./components/Datepicker/Datepicker";
15
+ export { default as Dropdown } from "./components/Dropdown/Dropdown";
16
+ export { EmptyListMessage } from "./components/EmptyListMessage/EmptyListMessage";
17
+ export { default as ErrorBlock } from "./components/ErrorBlock/ErrorBlock";
18
+ export { default as InfoBlock } from "./components/InfoBlock/InfoBlock";
19
+ export { InfoField } from "./components/InfoField/InfoField";
20
+ export { INPUT_TYPES, default as Input } from "./components/Input/Input";
21
+ export { default as Line } from "./components/Line/Line";
22
+ export { default as ListItem, ListItemProps } from "./components/ListItem/ListItem";
23
+ export { ListTable, ListTableProps, ListTablePropsConfiguration, ListTablePropsConfigurationField } from "./components/ListTable/ListTable";
24
+ export { LoadingIndicator, LoadingIndicatorProps } from "./components/LoadingIndicator/LoadingIndicator";
25
+ export { default as Menu } from "./components/Menu/Menu";
26
+ export { MultiSelect } from "./components/MultiSelect/MultiSelect";
27
+ export { NavLayout, NavMenuLayoutProps } from "./components/NavMenu/NavLayout";
28
+ export { NavMenu } from "./components/NavMenu/NavMenu";
29
+ export { NotificationBanner, NotificationBannerColor, NotificationBannerLinkProps } from "./components/NotificationBanner/NotificationBanner";
30
+ export { default as Page } from "./components/Page/Page";
31
+ export { default as CRUDPage } from "./components/Page/CRUDPage";
32
+ export { default as PaginationMenu } from "./components/PaginationMenu/PaginationMenu";
33
+ export { default as PreviewPhone } from "./components/PreviewPhone/PreviewPhone";
34
+ export { default as Radio } from "./components/Radio/Radio";
35
+ export { default as RadioGroup } from "./components/RadioGroup/RadioGroup";
36
+ export { default as Section } from "./components/Section/Section";
37
+ export { SettingsMenuButton, SettingsMenuButtonProps } from "./components/SettingsMenuButton/SettingsMenuButton";
38
+ export { Spinner } from "./components/Spinner/Spinner";
39
+ export { Steps } from "./components/Steps/Steps";
40
+ export { default as Switcher } from "./components/Switcher/Switcher";
41
+ export { default as Tabbar } from "./components/Tabbar/Tabbar";
42
+ export { default as TabLinks } from "./components/TabLinks/TabLinks";
43
+ export { default as Tag } from "./components/Tag/Tag";
44
+ export { default as TagGroup } from "./components/Tag/TagGroup";
45
+ export { default as TextArea } from "./components/Textarea/Textarea";
46
+ export { default as TextEditor } from "./components/TextEditor/TextEditor";
47
+ export { default as TextEditorV2 } from "./components/TextEditorV2/TextEditorV2";
48
+ export { TextLink, TextLinkProps } from "./components/TextLink/TextLink";
49
+ export { default as TextListItem } from "./components/TextListItem/TextListItem";
50
+ export { Title, TitleStyle } from "./components/Title/Title";
51
+ export { ViewItem, ViewItemProps } from "./components/ViewItem/ViewItem";
1
52
  export { default as Text } from "./components/Text/Text";