@thecb/components 6.4.0 → 7.0.0-beta.1
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 +43 -0
- package/dist/index.cjs.js +12076 -11826
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +308 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +4176 -3929
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -2
- package/src/components/atoms/button-with-action/index.d.ts +17 -0
- package/src/components/atoms/button-with-link/index.d.ts +14 -0
- package/src/components/atoms/card/Card.js +87 -0
- package/src/components/atoms/card/Card.theme.js +14 -0
- package/src/components/atoms/card/CardHeader.js +28 -0
- package/src/components/atoms/card/CardImage.styled.js +9 -0
- package/src/components/atoms/card/CardText.js +46 -0
- package/src/components/atoms/card/CardText.theme.js +12 -0
- package/src/components/atoms/card/index.d.ts +32 -0
- package/src/components/atoms/card/index.js +3 -0
- package/src/components/atoms/{welcome-card/Card.theme.js → card-registry/CardRegistry.theme.js} +0 -0
- package/src/components/atoms/{welcome-card/Card.js → card-registry/CardRegistryCard.js} +7 -3
- package/src/components/atoms/{welcome-card → card-registry}/index.js +4 -4
- package/src/components/atoms/display-card/DisplayCard.js +1 -1
- package/src/components/atoms/index.d.ts +11 -0
- package/src/components/atoms/index.js +3 -1
- package/src/components/atoms/layouts/Box.d.ts +32 -0
- package/src/components/atoms/layouts/Center.d.ts +11 -0
- package/src/components/atoms/layouts/Cluster.d.ts +19 -0
- package/src/components/atoms/layouts/Cover.d.ts +14 -0
- package/src/components/atoms/layouts/Stack.d.ts +27 -0
- package/src/components/atoms/layouts/Switcher.d.ts +17 -0
- package/src/components/atoms/layouts/index.d.ts +6 -0
- package/src/components/atoms/link/ExternalLink.d.ts +18 -0
- package/src/components/atoms/link/InternalLink.d.ts +19 -0
- package/src/components/atoms/link/index.d.ts +2 -0
- package/src/components/atoms/nav-footer/index.d.ts +17 -0
- package/src/components/atoms/nav-header/index.d.ts +16 -0
- package/src/components/atoms/nav-tabs/NavTab.js +47 -0
- package/src/components/atoms/nav-tabs/NavTab.theme.js +11 -0
- package/src/components/atoms/nav-tabs/NavTabs.js +24 -0
- package/src/components/atoms/nav-tabs/index.d.ts +10 -0
- package/src/components/atoms/nav-tabs/index.js +3 -0
- package/src/components/atoms/paragraph/index.d.ts +15 -0
- package/src/components/atoms/text/index.d.ts +16 -0
- package/src/components/atoms/title/index.d.ts +17 -0
- package/src/components/index.d.ts +3 -0
- package/src/components/molecules/footer-with-subfooter/FooterWithSubfooter.js +42 -0
- package/src/components/molecules/footer-with-subfooter/FooterWithSubfooter.theme.js +8 -0
- package/src/components/molecules/footer-with-subfooter/index.d.ts +14 -0
- package/src/components/molecules/footer-with-subfooter/index.js +3 -0
- package/src/components/molecules/index.d.ts +1 -0
- package/src/components/molecules/index.js +1 -0
- package/src/components/molecules/modal/Modal.js +7 -1
- package/src/components/molecules/popover/Popover.js +1 -1
- package/src/components/templates/default-page-template/DefaultPageTemplate.js +7 -2
- package/src/components/templates/default-page-template/index.d.ts +16 -0
- package/src/components/templates/index.d.ts +1 -0
- package/src/index.d.ts +1 -0
- package/src/util/expand.d.ts +3 -0
package/README.md
CHANGED
|
@@ -63,6 +63,41 @@ Please include new component stories as this library will also be a sandbox.
|
|
|
63
63
|
|
|
64
64
|
- If a non-form component contains integration with application state, or business logic specific to a particular application, breaking the component up into styled/layout atoms and an application specific molecule that consumes them is the best practice. An example of this can be observed with the `Header` and `Footer` molecules in Navigate Frontend. Both of these molcules make use of component library atoms such as `NavHeader` to layout out content. NFE then has `Header` and `Footer` molecules which live in the NFE components directory and use NFE specific business logic to provide content to these atoms, resulting in a complete `Header` and `Footer`.
|
|
65
65
|
|
|
66
|
+
## Adding Typescript declarations
|
|
67
|
+
|
|
68
|
+
Any components used in a Typescript app need a declaration file.
|
|
69
|
+
|
|
70
|
+
1. Create a `index.d.ts` file in the directory for that component that exports the typed component constant.
|
|
71
|
+
Use the `Expand` interface found in `./src/util/expand` so the full props will appear on hover in VSCode. Extend `React.HTMLAttributes<HTMLElement>>` to add all html props and event handlers. e.g.:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import React from "react";
|
|
75
|
+
import Expand from "../../../util/expand";
|
|
76
|
+
|
|
77
|
+
export interface ButtonWithActionProps {
|
|
78
|
+
action?: React.SyntheticEvent;
|
|
79
|
+
variant?: string;
|
|
80
|
+
text?: string;
|
|
81
|
+
textWrap?: boolean;
|
|
82
|
+
isLoading?: boolean;
|
|
83
|
+
textExtraStyles?: string;
|
|
84
|
+
contentOverride?: boolean;
|
|
85
|
+
extraStyles?: string;
|
|
86
|
+
tabIndex?: number;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const ButtonWithAction: React.FC<Expand<ButtonWithActionProps> &
|
|
90
|
+
React.HTMLAttributes<HTMLElement>>;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
2. Export the component from the `index.d.ts` in the top-level directory for your component, i.e. `src/components/atoms/index.d.ts`. e.g:
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
...
|
|
97
|
+
export * from "./button-with-action";
|
|
98
|
+
...
|
|
99
|
+
```
|
|
100
|
+
|
|
66
101
|
## Version bumping and publishing
|
|
67
102
|
|
|
68
103
|
### Version bumping and Publishing to NPM
|
|
@@ -120,6 +155,10 @@ Next go to the `@thecb/components` and in the command line
|
|
|
120
155
|
|
|
121
156
|
Now the package is unlinked, and you’re using the version on NPM.
|
|
122
157
|
|
|
158
|
+
### Yalc
|
|
159
|
+
|
|
160
|
+
If you encounter issues using `yarn link`, a nice alternative is `yalc`. See [https://github.com/wclr/yalc](https://github.com/wclr/yalc) for usage instructions.
|
|
161
|
+
|
|
123
162
|
### Importing and using components
|
|
124
163
|
|
|
125
164
|
To use components, you need to import the desired components inside the file you’d like them in. For example, to import the `<ButtonWithAction />` component into a file
|
|
@@ -133,3 +172,7 @@ You can alias the component by
|
|
|
133
172
|
To import multiple components
|
|
134
173
|
|
|
135
174
|
- `import { ButtonWithAction, LoginForm, Box, Stack, Cluster } from "@thecb/components";`
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
```
|