@xqmsg/ui-core 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +181 -0
  3. package/dist/components/banner/Banner.stories.d.ts +5 -0
  4. package/dist/components/banner/index.d.ts +12 -0
  5. package/dist/components/breadcrumbs/Breadcrumbs.stories.d.ts +5 -0
  6. package/dist/components/breadcrumbs/components/icon/index.d.ts +9 -0
  7. package/dist/components/breadcrumbs/components/label/index.d.ts +8 -0
  8. package/dist/components/breadcrumbs/index.d.ts +14 -0
  9. package/dist/components/button/Button.stories.d.ts +5 -0
  10. package/dist/components/button/google/GoogleButton.stories.d.ts +5 -0
  11. package/dist/components/button/google/index.d.ts +8 -0
  12. package/dist/components/button/index.d.ts +20 -0
  13. package/dist/components/button/spinner/SpinnerButton.stories.d.ts +5 -0
  14. package/dist/components/button/spinner/index.d.ts +9 -0
  15. package/dist/components/form/Form.stories.d.ts +8 -0
  16. package/dist/components/form/FormTypes.d.ts +16 -0
  17. package/dist/components/form/hooks/useFormHandler.d.ts +10 -0
  18. package/dist/components/form/index.d.ts +12 -0
  19. package/dist/components/form/section/FormSection.stories.d.ts +9 -0
  20. package/dist/components/form/section/index.d.ts +28 -0
  21. package/dist/components/form/utils/formErrors.d.ts +6 -0
  22. package/dist/components/input/Input.stories.d.ts +8 -0
  23. package/dist/components/input/InputTypes.d.ts +27 -0
  24. package/dist/components/input/StackedCheckbox/StackedCheckboxGroup.d.ts +10 -0
  25. package/dist/components/input/StackedInput/StackedInput.d.ts +13 -0
  26. package/dist/components/input/StackedMultiSelect/components/MultiValue/index.d.ts +10 -0
  27. package/dist/components/input/StackedMultiSelect/index.d.ts +13 -0
  28. package/dist/components/input/StackedPilledInput/index.d.ts +12 -0
  29. package/dist/components/input/StackedRadio/StackedRadioGroup.d.ts +11 -0
  30. package/dist/components/input/StackedSelect/StackedSelect.d.ts +10 -0
  31. package/dist/components/input/StackedSwitch/index.d.ts +9 -0
  32. package/dist/components/input/StackedTextarea/StackedTextarea.d.ts +9 -0
  33. package/dist/components/input/components/InputTag/index.d.ts +7 -0
  34. package/dist/components/input/index.d.ts +26 -0
  35. package/dist/components/layout/BorderedBox/index.d.ts +9 -0
  36. package/dist/components/layout/Layout.stories.d.ts +5 -0
  37. package/dist/components/layout/index.d.ts +11 -0
  38. package/dist/components/loading/LoadingIndicator.stories.d.ts +5 -0
  39. package/dist/components/loading/index.d.ts +12 -0
  40. package/dist/components/table/Table.stories.d.ts +6 -0
  41. package/dist/components/table/TableTypes.d.ts +11 -0
  42. package/dist/components/table/index.d.ts +17 -0
  43. package/dist/components/table/loading/index.d.ts +10 -0
  44. package/dist/components/table/utils/generateTableColumns.d.ts +6 -0
  45. package/dist/components/tabs/TabsWrapper.stories.d.ts +6 -0
  46. package/dist/components/tabs/index.d.ts +10 -0
  47. package/dist/components/text/Text.stories.d.ts +5 -0
  48. package/dist/components/text/index.d.ts +19 -0
  49. package/dist/hooks/useDeepEffect.d.ts +5 -0
  50. package/dist/hooks/useDidMountEffect.d.ts +2 -0
  51. package/dist/index.d.ts +15 -0
  52. package/dist/index.js +8 -0
  53. package/dist/theme/components/alert.d.ts +46 -0
  54. package/dist/theme/components/badge.d.ts +32 -0
  55. package/dist/theme/components/button.d.ts +231 -0
  56. package/dist/theme/components/code.d.ts +27 -0
  57. package/dist/theme/components/form-error.d.ts +16 -0
  58. package/dist/theme/components/form-label.d.ts +15 -0
  59. package/dist/theme/components/form.d.ts +16 -0
  60. package/dist/theme/components/input.d.ts +182 -0
  61. package/dist/theme/components/link.d.ts +97 -0
  62. package/dist/theme/components/menu.d.ts +48 -0
  63. package/dist/theme/components/modal.d.ts +242 -0
  64. package/dist/theme/components/select.d.ts +191 -0
  65. package/dist/theme/components/switch.d.ts +76 -0
  66. package/dist/theme/components/tabs.d.ts +219 -0
  67. package/dist/theme/components/text.d.ts +1373 -0
  68. package/dist/theme/components/textarea.d.ts +137 -0
  69. package/dist/theme/customXQChakraTheme.d.ts +3 -0
  70. package/dist/theme/foundations/breakpoints.d.ts +3 -0
  71. package/dist/theme/foundations/colors.d.ts +126 -0
  72. package/dist/theme/foundations/shadows.d.ts +17 -0
  73. package/dist/theme/foundations/typography.d.ts +56 -0
  74. package/dist/theme/provider/index.d.ts +6 -0
  75. package/dist/theme/styles.d.ts +20 -0
  76. package/dist/ui-core.cjs.development.js +3034 -0
  77. package/dist/ui-core.cjs.development.js.map +1 -0
  78. package/dist/ui-core.cjs.production.min.js +2 -0
  79. package/dist/ui-core.cjs.production.min.js.map +1 -0
  80. package/dist/ui-core.esm.js +3013 -0
  81. package/dist/ui-core.esm.js.map +1 -0
  82. package/package.json +113 -0
  83. package/src/components/banner/Banner.stories.tsx +68 -0
  84. package/src/components/banner/assets/svg/error.svg +3 -0
  85. package/src/components/banner/assets/svg/neutral.svg +3 -0
  86. package/src/components/banner/assets/svg/positive.svg +3 -0
  87. package/src/components/banner/assets/svg/warning.svg +3 -0
  88. package/src/components/banner/index.tsx +63 -0
  89. package/src/components/breadcrumbs/Breadcrumbs.stories.tsx +66 -0
  90. package/src/components/breadcrumbs/components/icon/index.tsx +40 -0
  91. package/src/components/breadcrumbs/components/label/index.tsx +20 -0
  92. package/src/components/breadcrumbs/index.tsx +47 -0
  93. package/src/components/button/Button.stories.tsx +46 -0
  94. package/src/components/button/google/GoogleButton.stories.tsx +23 -0
  95. package/src/components/button/google/assets/GoogleLogo.svg +13 -0
  96. package/src/components/button/google/index.tsx +32 -0
  97. package/src/components/button/index.tsx +54 -0
  98. package/src/components/button/spinner/SpinnerButton.stories.tsx +60 -0
  99. package/src/components/button/spinner/index.tsx +42 -0
  100. package/src/components/form/Form.stories.tsx +62 -0
  101. package/src/components/form/FormTypes.ts +18 -0
  102. package/src/components/form/hooks/useFormHandler.tsx +74 -0
  103. package/src/components/form/index.tsx +25 -0
  104. package/src/components/form/section/FormSection.stories.tsx +109 -0
  105. package/src/components/form/section/index.tsx +81 -0
  106. package/src/components/form/utils/formErrors.ts +34 -0
  107. package/src/components/input/Input.stories.tsx +171 -0
  108. package/src/components/input/InputTypes.ts +71 -0
  109. package/src/components/input/StackedCheckbox/StackedCheckboxGroup.tsx +29 -0
  110. package/src/components/input/StackedInput/StackedInput.tsx +30 -0
  111. package/src/components/input/StackedMultiSelect/components/MultiValue/index.tsx +21 -0
  112. package/src/components/input/StackedMultiSelect/index.tsx +145 -0
  113. package/src/components/input/StackedPilledInput/index.tsx +169 -0
  114. package/src/components/input/StackedRadio/StackedRadioGroup.tsx +38 -0
  115. package/src/components/input/StackedSelect/StackedSelect.tsx +33 -0
  116. package/src/components/input/StackedSwitch/index.tsx +28 -0
  117. package/src/components/input/StackedTextarea/StackedTextarea.tsx +17 -0
  118. package/src/components/input/components/InputTag/index.tsx +24 -0
  119. package/src/components/input/index.tsx +271 -0
  120. package/src/components/layout/BorderedBox/index.tsx +30 -0
  121. package/src/components/layout/Layout.stories.tsx +40 -0
  122. package/src/components/layout/index.tsx +100 -0
  123. package/src/components/loading/LoadingIndicator.stories.tsx +45 -0
  124. package/src/components/loading/index.tsx +45 -0
  125. package/src/components/table/Table.stories.tsx +73 -0
  126. package/src/components/table/TableTypes.ts +35 -0
  127. package/src/components/table/index.tsx +88 -0
  128. package/src/components/table/loading/index.tsx +42 -0
  129. package/src/components/table/utils/generateTableColumns.ts +9 -0
  130. package/src/components/tabs/TabsWrapper.stories.tsx +85 -0
  131. package/src/components/tabs/index.tsx +39 -0
  132. package/src/components/text/Text.stories.tsx +59 -0
  133. package/src/components/text/index.tsx +45 -0
  134. package/src/hooks/useDeepEffect.tsx +22 -0
  135. package/src/hooks/useDidMountEffect.tsx +13 -0
  136. package/src/index.tsx +48 -0
  137. package/src/theme/components/alert.ts +60 -0
  138. package/src/theme/components/badge.ts +59 -0
  139. package/src/theme/components/button.ts +211 -0
  140. package/src/theme/components/code.ts +16 -0
  141. package/src/theme/components/form-error.ts +32 -0
  142. package/src/theme/components/form-label.ts +16 -0
  143. package/src/theme/components/form.ts +32 -0
  144. package/src/theme/components/input.ts +213 -0
  145. package/src/theme/components/link.ts +117 -0
  146. package/src/theme/components/menu.ts +70 -0
  147. package/src/theme/components/modal.ts +216 -0
  148. package/src/theme/components/select.ts +41 -0
  149. package/src/theme/components/switch.ts +89 -0
  150. package/src/theme/components/tabs.ts +255 -0
  151. package/src/theme/components/text.ts +46 -0
  152. package/src/theme/components/textarea.ts +54 -0
  153. package/src/theme/customXQChakraTheme.ts +52 -0
  154. package/src/theme/foundations/breakpoints.ts +18 -0
  155. package/src/theme/foundations/colors.ts +136 -0
  156. package/src/theme/foundations/shadows.ts +23 -0
  157. package/src/theme/foundations/typography.ts +62 -0
  158. package/src/theme/provider/index.tsx +16 -0
  159. package/src/theme/styles.ts +19 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 josh@xqmsg.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
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,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { BannerProps } from '.';
3
+ declare const meta: Meta<BannerProps>;
4
+ export default meta;
5
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, BannerProps>;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export declare type BannerVariant = 'positive' | 'warning' | 'error' | 'neutral';
3
+ export interface BannerProps {
4
+ variant: BannerVariant;
5
+ message: string;
6
+ buttonText?: string;
7
+ onClick?: () => void;
8
+ }
9
+ /**
10
+ * A functional React component utilized to render the `Banner` component
11
+ */
12
+ export declare const Banner: React.FC<BannerProps>;
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { BreadcrumbsProps } from '.';
3
+ declare const meta: Meta<BreadcrumbsProps>;
4
+ export default meta;
5
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, BreadcrumbsProps>;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export interface IconProps {
3
+ step: number;
4
+ status: 'complete' | 'active' | 'inactive';
5
+ }
6
+ /**
7
+ * A functional React component utilized to render the `Icon` for the `Breadcrumbs` component.
8
+ */
9
+ export declare const Icon: React.FC<IconProps>;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface LabelProps {
3
+ label: string;
4
+ }
5
+ /**
6
+ * A functional React component utilized to render the `Label` for the `Breadcrumbs` component.
7
+ */
8
+ export declare const Label: React.FC<LabelProps>;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ export interface BreadcrumbsProps {
3
+ steps: string[];
4
+ activeStepIndex: number;
5
+ orientation?: 'horizontal' | 'vertical';
6
+ }
7
+ /**
8
+ * A functional React component utilized to render the `Breadcrumbs` component.
9
+ *
10
+ * The component will render a list of steps, based on the `steps` array, displaying the completed,
11
+ * active, and incomplete steps. The orientation of the component may be either `horizontal` or
12
+ * `vertical`.
13
+ */
14
+ export declare const Breadcrumbs: React.FC<BreadcrumbsProps>;
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { ButtonProps } from '.';
3
+ declare const meta: Meta<ButtonProps>;
4
+ export default meta;
5
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ButtonProps>;
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { GoogleButtonProps } from '.';
3
+ declare const meta: Meta<GoogleButtonProps>;
4
+ export default meta;
5
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, GoogleButtonProps>;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface GoogleButtonProps {
3
+ onClick: () => void;
4
+ }
5
+ /**
6
+ * A functional React component utilized to render the `GoogleButton` component
7
+ */
8
+ export declare const GoogleButton: React.FC<GoogleButtonProps>;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { ButtonProps as ChakraButtonProps } from '@chakra-ui/react';
3
+ import buttonTheme from '../../theme/components/button';
4
+ export interface ButtonProps {
5
+ text: string;
6
+ onClick?: () => void;
7
+ variant?: keyof typeof buttonTheme.variants;
8
+ colorScheme?: string;
9
+ type: 'button' | 'submit' | 'reset' | undefined;
10
+ ariaLabel: string;
11
+ size?: 'sm' | 'md' | 'lg' | 'xs';
12
+ disabled?: boolean;
13
+ className?: string;
14
+ style?: React.CSSProperties;
15
+ width?: string | number;
16
+ }
17
+ /**
18
+ * A functional React component utilized to render the `Button` component
19
+ */
20
+ export declare const Button: React.FC<ButtonProps & ChakraButtonProps>;
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { SpinnerButtonProps } from '.';
3
+ declare const meta: Meta<SpinnerButtonProps>;
4
+ export default meta;
5
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, SpinnerButtonProps>;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ButtonProps } from '..';
3
+ export interface SpinnerButtonProps extends ButtonProps {
4
+ isLoading: boolean;
5
+ }
6
+ /**
7
+ * A functional React component utilized to render the `SpinnerButton` component
8
+ */
9
+ export declare const SpinnerButton: React.FC<SpinnerButtonProps>;
@@ -0,0 +1,8 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { FormProps } from 'src/components/form';
3
+ declare const meta: Meta<FormProps<StoryFormSchema>>;
4
+ interface StoryFormSchema {
5
+ prop?: string;
6
+ }
7
+ export default meta;
8
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, FormProps<StoryFormSchema>>;
@@ -0,0 +1,16 @@
1
+ import { FieldOptions, InputType } from '../input/InputTypes';
2
+ export interface FormInput {
3
+ label: string;
4
+ name: string;
5
+ ariaLabel: string;
6
+ inputType: InputType;
7
+ options?: FieldOptions;
8
+ placeholder?: string;
9
+ isRequired: boolean;
10
+ maxLength?: number;
11
+ disabled?: boolean;
12
+ defaultValue?: string;
13
+ }
14
+ export declare type FormStructure<K extends string | number | symbol> = {
15
+ [key in K]: FormInput[];
16
+ };
@@ -0,0 +1,10 @@
1
+ import { FormEvent } from 'react';
2
+ import { DeepPartial, FieldValues, UseFormReturn, ValidationMode } from 'react-hook-form';
3
+ import * as Yup from 'yup';
4
+ import { ErrorResponse } from 'src/components/form/utils/formErrors';
5
+ export declare type FormHandler<T extends FieldValues> = {
6
+ form: UseFormReturn<T, any>;
7
+ error?: ErrorResponse;
8
+ onSubmit: (e?: FormEvent) => Promise<void>;
9
+ };
10
+ export declare function useFormHandler<T extends FieldValues = Record<string, unknown>>(handleSubmit: (values: T) => void, defaultValues: DeepPartial<T>, schema: Yup.AnyObjectSchema, dontClearErrorsOnSuccess: boolean | undefined, mode: keyof ValidationMode): FormHandler<T>;
@@ -0,0 +1,12 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { FieldValues } from 'react-hook-form';
3
+ import { FormHandler } from '../../components/form/hooks/useFormHandler';
4
+ export interface FormProps<T extends FieldValues> {
5
+ formHandler: FormHandler<T>;
6
+ }
7
+ /**
8
+ * A functional React component utilized to render the `Form` component, a form wrapper for
9
+ * `react-hook-form`. The `Form` component is provided a `formHandler` and is used to wrap a container
10
+ * that contains a `FormSection` component.
11
+ */
12
+ export declare function Form<T extends FieldValues>({ formHandler, children, }: PropsWithChildren<FormProps<T>>): JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { FormSectionProps } from '.';
3
+ declare type FormSectionStoryValues = {
4
+ [k: string]: any;
5
+ };
6
+ declare const meta: Meta<FormSectionProps<'story', FormSectionStoryValues>>;
7
+ export default meta;
8
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, FormSectionProps<"story", FormSectionStoryValues>>;
9
+ export declare const formSectionStoryArgs: Partial<FormSectionProps<'story', FormSectionStoryValues>>;
@@ -0,0 +1,28 @@
1
+ /// <reference types="react" />
2
+ import { FieldValues, UseFormReturn } from 'react-hook-form';
3
+ import { FormStructure } from '../FormTypes';
4
+ /**
5
+ * @param T - represents the key/section in the `FormStructure`.
6
+ * @param U - is the form value types for the `useFormHandler` hook.
7
+ *
8
+ * @param formStructure - the form of type form structure with their respective `FormSteps`.
9
+ * @param section - the section (`FormStep`) we want to generate a section for.
10
+ * @param form - the overall form containing methods (generated by `useFormHandler` hook).
11
+ */
12
+ export interface FormSectionProps<T extends string | number | symbol, U extends FieldValues> {
13
+ formStructure: FormStructure<T>;
14
+ section: T;
15
+ form: UseFormReturn<U>;
16
+ className?: string;
17
+ columns?: number;
18
+ spacing?: number;
19
+ }
20
+ /**
21
+ *
22
+ * @param props - of type `FormSectionProps<T, U>` where `T` represents the key in `FormSteps`,
23
+ * can be generic key but is represented by value in `FormSteps` and `U` is the form value types for the
24
+ * `useFormHandler` hook.
25
+ *
26
+ * @returns a list of input's for a specific form section.
27
+ */
28
+ export declare function FormSection<T extends string | number | symbol, U extends FieldValues>({ formStructure, section, form, className, columns, spacing, }: FormSectionProps<T, U>): JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { AxiosError } from 'axios';
2
+ export declare type ErrorResponse = {
3
+ message: string;
4
+ };
5
+ export declare function formatErrorResponse(error: AxiosError): ErrorResponse;
6
+ export declare function formatErrorResponse(error: Error): ErrorResponse;
@@ -0,0 +1,8 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { InputProps } from '.';
3
+ declare const meta: Meta<InputProps<StoryFormSchema>>;
4
+ interface StoryFormSchema {
5
+ prop?: string;
6
+ }
7
+ export default meta;
8
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, InputProps<StoryFormSchema>>;
@@ -0,0 +1,27 @@
1
+ /// <reference types="react" />
2
+ import { TextareaProps, SelectProps } from '@chakra-ui/react';
3
+ import reactSelect from 'react-select';
4
+ import { InputProps } from '.';
5
+ export declare type FieldProps = {
6
+ rules?: ValidationProps;
7
+ isInvalid?: boolean;
8
+ errorText?: string;
9
+ };
10
+ export declare type InputType = 'text' | 'select' | 'multi-select' | 'pilled-text' | 'textarea' | 'radio' | 'checkbox' | 'switch';
11
+ export declare type FieldOptions = {
12
+ label: string;
13
+ value: string;
14
+ }[];
15
+ export interface ValidationProps {
16
+ isRequired: boolean;
17
+ isInvalid?: boolean;
18
+ errorText?: string;
19
+ }
20
+ export interface InputFieldProps extends Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, 'color' | 'height' | 'width' | 'size' | 'ref'>, FieldProps, Partial<InputProps> {
21
+ }
22
+ export interface TextareaFieldProps extends Omit<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, 'color' | 'height' | 'width' | 'size' | 'ref'>, FieldProps, Partial<TextareaProps> {
23
+ }
24
+ export interface SelectFieldProps extends Omit<React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, 'color' | 'height' | 'width' | 'size' | 'ref'>, FieldProps, Partial<SelectProps> {
25
+ }
26
+ export interface ReactSelectFieldProps extends Omit<React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, 'color' | 'height' | 'width' | 'size' | 'ref'>, FieldProps, Partial<reactSelect> {
27
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { FieldOptions, SelectFieldProps } from '../InputTypes';
3
+ export interface StackedCheckboxGroupProps extends SelectFieldProps {
4
+ options: FieldOptions;
5
+ }
6
+ /**
7
+ * A functional React component utilized to render the `StackedCheckbox` component.
8
+ */
9
+ declare const StackedCheckboxGroup: React.ForwardRefExoticComponent<StackedCheckboxGroupProps & React.RefAttributes<HTMLInputElement>>;
10
+ export default StackedCheckboxGroup;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { InputFieldProps } from '../InputTypes';
3
+ export interface StackedInputProps extends InputFieldProps {
4
+ label?: string;
5
+ isRequired?: boolean;
6
+ leftElement?: React.ReactNode;
7
+ rightElement?: React.ReactNode;
8
+ }
9
+ /**
10
+ * A functional React component utilized to render the `StackedInput` component.
11
+ */
12
+ declare const StackedInput: React.ForwardRefExoticComponent<StackedInputProps & React.RefAttributes<HTMLInputElement>>;
13
+ export default StackedInput;
@@ -0,0 +1,10 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ interface MultiValueProps extends PropsWithChildren {
3
+ clearValue: () => void;
4
+ }
5
+ /**
6
+ * A functional React Component utilized to render the custom `MultiValue` component for
7
+ * the `StackedMultiSelect` custom component.
8
+ */
9
+ declare const MultiValue: React.FC<MultiValueProps>;
10
+ export default MultiValue;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { FieldOptions, ReactSelectFieldProps } from '../InputTypes';
3
+ import { Control, FieldValues, UseFormSetValue } from 'react-hook-form';
4
+ export interface StackedMultiSelectProps extends ReactSelectFieldProps {
5
+ options: FieldOptions;
6
+ setValue: UseFormSetValue<FieldValues>;
7
+ control: Control<FieldValues, any>;
8
+ }
9
+ /**
10
+ * A functional React component utilized to render the `StackedMultiSelect` component.
11
+ */
12
+ declare const StackedMultiSelect: React.ForwardRefExoticComponent<StackedMultiSelectProps & React.RefAttributes<HTMLSelectElement>>;
13
+ export default StackedMultiSelect;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { InputFieldProps } from '../InputTypes';
3
+ import { Control, FieldValues, UseFormSetValue } from 'react-hook-form';
4
+ export interface StackedPilledInputProps extends InputFieldProps {
5
+ setValue: UseFormSetValue<FieldValues>;
6
+ control: Control<FieldValues, any>;
7
+ }
8
+ /**
9
+ * A functional React component utilized to render the `StackedPilledInput` component.
10
+ */
11
+ declare const StackedPilledInput: React.ForwardRefExoticComponent<StackedPilledInputProps & React.RefAttributes<HTMLInputElement>>;
12
+ export default StackedPilledInput;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { FieldOptions, SelectFieldProps } from '../InputTypes';
3
+ export interface StackedRadioGroupProps extends SelectFieldProps {
4
+ flexDirection?: 'row' | 'column';
5
+ options: FieldOptions;
6
+ }
7
+ /**
8
+ * A functional React component utilized to render the `StackedRadio` component.
9
+ */
10
+ declare const StackedRadioGroup: React.ForwardRefExoticComponent<StackedRadioGroupProps & React.RefAttributes<HTMLInputElement>>;
11
+ export default StackedRadioGroup;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { FieldOptions, SelectFieldProps } from '../InputTypes';
3
+ export interface StackedSelectProps extends SelectFieldProps {
4
+ options: FieldOptions;
5
+ }
6
+ /**
7
+ * A functional React component utilized to render the `StackedSelect` component.
8
+ */
9
+ declare const StackedSelect: React.ForwardRefExoticComponent<StackedSelectProps & React.RefAttributes<HTMLSelectElement>>;
10
+ export default StackedSelect;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { SwitchProps } from '@chakra-ui/react';
3
+ export interface StackedSwitchProps extends SwitchProps {
4
+ }
5
+ /**
6
+ * A functional React component utilized to render the `StackedSwitch` component.
7
+ */
8
+ declare const StackedSwitch: React.ForwardRefExoticComponent<StackedSwitchProps & React.RefAttributes<HTMLInputElement>>;
9
+ export default StackedSwitch;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { TextareaFieldProps } from '../InputTypes';
3
+ export interface StackedTextareaProps extends TextareaFieldProps {
4
+ }
5
+ /**
6
+ * A functional React component utilized to render the `StackedTextarea` component.
7
+ */
8
+ declare const StackedTextarea: React.ForwardRefExoticComponent<StackedTextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
9
+ export default StackedTextarea;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface InputTagProps {
3
+ value: any;
4
+ onDelete?: any;
5
+ }
6
+ declare const InputTag: React.FC<InputTagProps>;
7
+ export default InputTag;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { FieldOptions, ValidationProps, InputType } from './InputTypes';
3
+ import { Control, FieldValues, UseFormSetValue } from 'react-hook-form';
4
+ export interface InputProps<T extends FieldValues> extends ValidationProps {
5
+ inputType: InputType;
6
+ name: string;
7
+ ariaLabel: string;
8
+ placeholder?: string;
9
+ defaultValue?: string;
10
+ label?: string;
11
+ className?: string;
12
+ options?: FieldOptions;
13
+ maxLength?: number;
14
+ helperText?: React.ReactNode;
15
+ leftElement?: React.ReactNode;
16
+ rightElement?: React.ReactNode;
17
+ control?: Control<T, any>;
18
+ onChange?: (args?: any) => void;
19
+ disabled?: boolean;
20
+ setValue?: UseFormSetValue<T>;
21
+ }
22
+ /**
23
+ * A functional React component utilized to render the `Input` component. Utilizes a switch statement
24
+ * to render the correct input based on the `inputType`.
25
+ */
26
+ export declare function Input<T extends FieldValues>({ inputType, label, ariaLabel, className, placeholder, name, helperText, leftElement, rightElement, options, isInvalid, errorText, isRequired, maxLength, defaultValue, control, disabled, onChange, setValue, }: InputProps<T>): JSX.Element;
@@ -0,0 +1,9 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ export interface BorderBox extends PropsWithChildren {
3
+ boxShadow: string;
4
+ borderRadius?: string;
5
+ }
6
+ /**
7
+ * A functional React component utilized to render the `BorderedBox` component
8
+ */
9
+ export declare const BorderedBox: React.FC<BorderBox>;
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { LayoutProps } from '.';
3
+ declare const meta: Meta<LayoutProps>;
4
+ export default meta;
5
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, LayoutProps>;
@@ -0,0 +1,11 @@
1
+ import React, { ReactNode } from 'react';
2
+ export interface LayoutProps {
3
+ Navigation?: ReactNode;
4
+ Header?: ReactNode;
5
+ MainContent?: ReactNode;
6
+ navbarWidth?: string;
7
+ }
8
+ /**
9
+ * A functional React component utilized to render the `Layout` component
10
+ */
11
+ export declare const Layout: React.FC<LayoutProps>;