@thecb/components 6.3.1-beta.2 → 6.3.1-beta.5

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 (28) hide show
  1. package/README.md +39 -0
  2. package/dist/index.cjs.js +587 -414
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.d.ts +51 -24
  5. package/dist/index.esm.js +585 -411
  6. package/dist/index.esm.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/components/atoms/card/Card.js +60 -21
  9. package/src/components/atoms/card/Card.theme.js +9 -2
  10. package/src/components/atoms/card/CardHeader.js +27 -0
  11. package/src/components/atoms/card/CardImage.styled.js +9 -0
  12. package/src/components/atoms/card/CardText.js +41 -0
  13. package/src/components/{molecules/welcome-card/WelcomeCard.theme.js → atoms/card/CardText.theme.js} +3 -6
  14. package/src/components/atoms/card/index.d.ts +21 -1
  15. package/src/components/atoms/display-card/DisplayCard.js +1 -1
  16. package/src/components/atoms/index.d.ts +1 -0
  17. package/src/components/atoms/layouts/Switcher.d.ts +17 -0
  18. package/src/components/atoms/layouts/index.d.ts +1 -0
  19. package/src/components/atoms/text/index.d.ts +16 -0
  20. package/src/components/molecules/index.d.ts +0 -2
  21. package/src/components/molecules/index.js +0 -2
  22. package/src/components/molecules/card-with-header/CardWithHeader.js +0 -34
  23. package/src/components/molecules/card-with-header/CardWithHeader.theme.js +0 -9
  24. package/src/components/molecules/card-with-header/index.d.ts +0 -11
  25. package/src/components/molecules/card-with-header/index.js +0 -2
  26. package/src/components/molecules/welcome-card/WelcomeCard.js +0 -64
  27. package/src/components/molecules/welcome-card/index.d.ts +0 -15
  28. package/src/components/molecules/welcome-card/index.js +0 -3
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
+ ```
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
+ ```
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