@televet/kibble-ui 0.1.0-beta.9 → 1.0.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 +37 -230
- package/build/components/Banner/index.d.ts +3 -0
- package/build/components/Input/index.d.ts +3 -0
- package/build/index.d.ts +2 -1
- package/build/index.js +86 -2258
- package/build/index.js.map +1 -1
- package/build/theme/index.d.ts +16 -17
- package/build/theme/{colors.d.ts → tokens/colors.d.ts} +32 -31
- package/package.json +26 -25
- package/build/index.es.js +0 -13886
- package/build/index.es.js.map +0 -1
- package/build/providers/ThemeProvider/ThemeProvider.d.ts +0 -5
- package/build/theme/breakpoints.d.ts +0 -9
- package/build/theme/pallette.d.ts +0 -23
- package/build/theme/theme.d.ts +0 -3
- package/build/theme/tokens/colors/colors.d.ts +0 -190
- package/build/theme/tokens/fonts/fonts.d.ts +0 -6
- /package/build/theme/{blur.d.ts → tokens/blur.d.ts} +0 -0
- /package/build/theme/{borders.d.ts → tokens/borders.d.ts} +0 -0
- /package/build/theme/{fontSizes.d.ts → tokens/fontSizes.d.ts} +0 -0
- /package/build/theme/{fontWeights.d.ts → tokens/fontWeights.d.ts} +0 -0
- /package/build/theme/{fonts.d.ts → tokens/fonts.d.ts} +0 -0
- /package/build/theme/{letterSpacings.d.ts → tokens/letterSpacings.d.ts} +0 -0
- /package/build/theme/{lineHeights.d.ts → tokens/lineHeights.d.ts} +0 -0
- /package/build/theme/{radii.d.ts → tokens/radii.d.ts} +0 -0
- /package/build/theme/{shadows.d.ts → tokens/shadows.d.ts} +0 -0
- /package/build/theme/{sizes.d.ts → tokens/sizes.d.ts} +0 -0
- /package/build/theme/{space.d.ts → tokens/space.d.ts} +0 -0
- /package/build/theme/{transition.d.ts → tokens/transition.d.ts} +0 -0
- /package/build/theme/{zIndeces.d.ts → tokens/zIndeces.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -8,16 +8,17 @@ https://televet.github.io/kibble-ui/
|
|
|
8
8
|
|
|
9
9
|
### New Project Setup
|
|
10
10
|
|
|
11
|
-
If your project does not include a
|
|
11
|
+
If your project does not include a `.npmrc`, create it and add the following:
|
|
12
12
|
|
|
13
13
|
`//registry.npmjs.org/:_authToken=${NPM_TOKEN}`
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Then add the NPM_TOKEN environment variable to your .bash_profile or .zshrc
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
`export NPM_TOKEN=SOME_TOKEN`
|
|
17
|
+
`export NPM_TOKEN=${SOME_TOKEN}`
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
Note: The NPM token can be found here in our [shared accounts table](https://www.notion.so/televet/Shared-Accounts-c691ae4e0dc8482c876aa0f4a56d8ea7)
|
|
20
|
+
|
|
21
|
+
### Install in project
|
|
21
22
|
|
|
22
23
|
`npm i --save @televet/kibble-ui`
|
|
23
24
|
|
|
@@ -30,41 +31,49 @@ import {
|
|
|
30
31
|
} from 'kibble-ui';
|
|
31
32
|
```
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
`$ npm i` - Install dependencies.
|
|
36
|
-
`npm run start` runs CRA in development mode with hot reloading. Open http://localhost:3000 to see your code live.
|
|
34
|
+
## Development Setup
|
|
37
35
|
|
|
38
|
-
|
|
36
|
+
### Linking Projects for Local Development
|
|
39
37
|
|
|
40
38
|
```
|
|
41
|
-
cd
|
|
42
|
-
|
|
43
|
-
npm
|
|
39
|
+
$ cd kibble-ui # navigate into the package directory
|
|
40
|
+
$ rm -rf node_modules # remove existing node_modules
|
|
41
|
+
$ npm run build # ensure there are build files available for the package to reference
|
|
44
42
|
|
|
45
|
-
#
|
|
43
|
+
# Update your library's package.json so that react and react-dom are pointing to your projects node_modules versions of these two packages. See reference to mutliple versions of react error here for more info on why this is necessary: https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react
|
|
46
44
|
|
|
47
|
-
#
|
|
48
|
-
# "
|
|
45
|
+
# "react": "../clinic-web/node_modules/react"
|
|
46
|
+
# "react-dom": "../clinic-web/node_modules/react-dom"
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
npm
|
|
48
|
+
$ npm i # install packages
|
|
49
|
+
$ npm run start # start the development server
|
|
52
50
|
|
|
53
|
-
#
|
|
54
|
-
|
|
51
|
+
# Navigate to project directory and update package.json to point to your local copy of your library
|
|
52
|
+
# "@televet/kibble-ui": "./../kibble-ui"
|
|
55
53
|
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
$ cd clinic-web # go into a project directory
|
|
55
|
+
$ rm -rf node_modules # remove existing node_modules
|
|
56
|
+
$ npm install # fresh install with local version of kibble ui
|
|
57
|
+
$ npm run start # start the development server
|
|
58
|
+
|
|
59
|
+
# When linking local packages like this your text editor may display errors saying the package cannot be found, however, if you restart your editor these errors should dissapear.
|
|
58
60
|
```
|
|
59
61
|
|
|
60
|
-
|
|
62
|
+
### Unlinking Projects after Local Development is Complete
|
|
61
63
|
|
|
62
64
|
```
|
|
63
|
-
#
|
|
64
|
-
|
|
65
|
+
# Inside of library
|
|
66
|
+
$ git checkout package.json
|
|
67
|
+
$ rm -rf node_modules
|
|
68
|
+
$ npm install
|
|
69
|
+
|
|
70
|
+
# Inside of project
|
|
71
|
+
$ git checkout package.json
|
|
72
|
+
$ rm -rf node_modules
|
|
73
|
+
$ npm install
|
|
65
74
|
```
|
|
66
75
|
|
|
67
|
-
|
|
76
|
+
### `src` directory structure
|
|
68
77
|
|
|
69
78
|
Development takes place inside `src` directory. This is where your library code should live, this code will be bundled with rollup and published to NPM. Exports from `src/index.js` will be included in the library. Files with the `.stories.*` extension will be compiled and built to the `docs` folder and deployed with github pages.
|
|
70
79
|
|
|
@@ -102,10 +111,9 @@ Development takes place inside `src` directory. This is where your library code
|
|
|
102
111
|
|
|
103
112
|
## Build
|
|
104
113
|
|
|
105
|
-
|
|
114
|
+
This site uses [Storybook](https://storybook.js.org/) configuration to handle documentation and examples.
|
|
106
115
|
|
|
107
116
|
```bash
|
|
108
|
-
npm run start # starts Storybook in development mode, http://localhost:6006/
|
|
109
117
|
npm run build # bundles library code to `build` folder, and documentation code to `docs` folder in the root of project.
|
|
110
118
|
```
|
|
111
119
|
|
|
@@ -113,7 +121,7 @@ You can view live documentation here after deploying: https://televet.github.io/
|
|
|
113
121
|
|
|
114
122
|
## Deploy and Publish
|
|
115
123
|
|
|
116
|
-
1. Update npm version number with [
|
|
124
|
+
1. Update npm version number with `npm version <patch, major, or minor>`. Read more about [the version options](https://docs.npmjs.com/updating-your-published-package-version-number) here.
|
|
117
125
|
2. Run `npm run build`
|
|
118
126
|
3. Commit changes to git.
|
|
119
127
|
4. When pushing to master, GitHub will publish the package to npm with latest changes.
|
|
@@ -175,207 +183,6 @@ Template includes [stylelint](https://stylelint.io/), to check CSS/SASS/LESS fil
|
|
|
175
183
|
|
|
176
184
|
Stylelint errors don't prevent build of application in development mode.
|
|
177
185
|
|
|
178
|
-
## Style options
|
|
179
|
-
|
|
180
|
-
### CSS modules
|
|
181
|
-
|
|
182
|
-
Template uses vanilla CSS with `autoprefixer` enabled. To avoid classname collisions and reduce nesting we are using `css-modules`. To make css-modules work, stylesheet file name should have `.module` suffix.
|
|
183
|
-
|
|
184
|
-
```jsx
|
|
185
|
-
import React from 'react';
|
|
186
|
-
import classes from './Component.module.css';
|
|
187
|
-
|
|
188
|
-
const Component = () => <div className={classes.wrapper}>Component</div>;
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Add SASS/SCSS
|
|
192
|
-
|
|
193
|
-
SASS/SCSS support comes "out of the box" in CRA. To enable it:
|
|
194
|
-
|
|
195
|
-
1. Install `node-sass`
|
|
196
|
-
|
|
197
|
-
```shell script
|
|
198
|
-
yarn add node-sass gatsby-plugin-sass --dev
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
2. Change `.lintstagedrc` to lint `scss` files instead of `css`.
|
|
202
|
-
|
|
203
|
-
```json
|
|
204
|
-
{
|
|
205
|
-
"*.js": ["eslint --fix"],
|
|
206
|
-
"*.scss": ["stylelint --fix"]
|
|
207
|
-
}
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
3. Change `rollup.config.js` to support `scss` files:
|
|
211
|
-
|
|
212
|
-
```js
|
|
213
|
-
postcss({
|
|
214
|
-
extract: process.env.REACT_APP_PKG_STYLE || pkg.style,
|
|
215
|
-
inline: false,
|
|
216
|
-
plugins: postcssPlugins,
|
|
217
|
-
extensions: ['scss'], // <=== here
|
|
218
|
-
}),
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
4. Add scss support to Docz. Create `gatsby-config.js` in the root of project.
|
|
222
|
-
|
|
223
|
-
```js
|
|
224
|
-
// gatsby-config.js
|
|
225
|
-
module.exports = {
|
|
226
|
-
plugins: [
|
|
227
|
-
{
|
|
228
|
-
resolve: `gatsby-plugin-sass`,
|
|
229
|
-
options: {
|
|
230
|
-
// Override the file regex for SASS
|
|
231
|
-
sassRuleTest: /\.s(a|c)ss$/,
|
|
232
|
-
// Override the file regex for CSS modules
|
|
233
|
-
sassRuleModulesTest: /\.module\.s(a|c)ss$/,
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
],
|
|
237
|
-
};
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
5. Import `scss` files straight into Component.
|
|
241
|
-
|
|
242
|
-
```jsx
|
|
243
|
-
import React from 'react';
|
|
244
|
-
import classes from './Component.module.scss'; // note the changed extension
|
|
245
|
-
|
|
246
|
-
const Component = () => <div className={classes.wrapper}>Component</div>;
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
You can see all changes required to enable SASS/SCSS in [corresponding PR](https://github.com/morewings/cra-template-npm-library/pull/11).
|
|
250
|
-
|
|
251
|
-
### Add PostCSS
|
|
252
|
-
|
|
253
|
-
1. Install `postcss-cli` and related plugins:
|
|
254
|
-
```shell script
|
|
255
|
-
yarn add --dev postcss-nested postcss-cli postcss-preset-env npm-run-all
|
|
256
|
-
```
|
|
257
|
-
2. Modify package scripts:
|
|
258
|
-
|
|
259
|
-
```json
|
|
260
|
-
{
|
|
261
|
-
"build:style": "postcss src/**/*.pcss --dir src --base src --ext css",
|
|
262
|
-
"watch:style": "yarn build:style -w",
|
|
263
|
-
"start": "npm-run-all -p watch:style start:js",
|
|
264
|
-
"start:js": "react-scripts start",
|
|
265
|
-
"build:js": "react-scripts build",
|
|
266
|
-
"build": "npm-run-all build:style build:js"
|
|
267
|
-
}
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
3. Add postcss support to Docz. Create `gatsby-config.js` in the root of project.
|
|
271
|
-
|
|
272
|
-
```js
|
|
273
|
-
// gatsby-config.js
|
|
274
|
-
module.exports = {
|
|
275
|
-
plugins: [`gatsby-plugin-postcss`],
|
|
276
|
-
};
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
4. Add `postcss.config.js` file in the root folder. With following configuration:
|
|
280
|
-
|
|
281
|
-
```js
|
|
282
|
-
const pkg = require('./package.json');
|
|
283
|
-
|
|
284
|
-
module.exports = {
|
|
285
|
-
plugins: [
|
|
286
|
-
require('postcss-nested'), // handle nested selectors, like LESS or SASS
|
|
287
|
-
require('postcss-preset-env')({
|
|
288
|
-
browsers: pkg.browserslist.production, // use browsers list from production mode
|
|
289
|
-
stage: 1,
|
|
290
|
-
}),
|
|
291
|
-
],
|
|
292
|
-
};
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
5. Add rule to `.gitignore` and `.stylelintrc` to ignore all css files, since we are generating them.
|
|
296
|
-
|
|
297
|
-
#### .gitignore
|
|
298
|
-
|
|
299
|
-
```gitignore
|
|
300
|
-
# css
|
|
301
|
-
*.css
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
#### .stylelintrc
|
|
305
|
-
|
|
306
|
-
```json
|
|
307
|
-
{
|
|
308
|
-
"ignoreFiles": ["**/*.snap", "**/*.css"]
|
|
309
|
-
}
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
6. Change `.lintstagedrc` to lint `pcss` files instead of `css`.
|
|
313
|
-
|
|
314
|
-
```json
|
|
315
|
-
{
|
|
316
|
-
"*.js": ["eslint --fix"],
|
|
317
|
-
"*.pcss": ["stylelint --fix"]
|
|
318
|
-
}
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
You can see all changes required to enable PostCSS in [corresponding PR](https://github.com/morewings/cra-template-npm-library/pull/12).
|
|
322
|
-
|
|
323
|
-
### Add Less
|
|
324
|
-
|
|
325
|
-
1. Install `less` and related plugins:
|
|
326
|
-
```shell script
|
|
327
|
-
yarn add --dev less less-watch-compiler gatsby-plugin-less npm-run-all
|
|
328
|
-
```
|
|
329
|
-
2. Modify package scripts:
|
|
330
|
-
|
|
331
|
-
```json
|
|
332
|
-
{
|
|
333
|
-
"build:style": "yarn watch:style --run-once",
|
|
334
|
-
"watch:style": "less-watch-compiler src src",
|
|
335
|
-
"start": "npm-run-all -p watch:style start:js",
|
|
336
|
-
"start:js": "react-scripts start",
|
|
337
|
-
"build:js": "react-scripts build",
|
|
338
|
-
"build": "npm-run-all build:style build:js"
|
|
339
|
-
}
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
3. Add less support to Docz. Create `gatsby-config.js` in the root of project.
|
|
343
|
-
|
|
344
|
-
```js
|
|
345
|
-
// gatsby-config.js
|
|
346
|
-
module.exports = {
|
|
347
|
-
plugins: [`gatsby-plugin-less`],
|
|
348
|
-
};
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
4. Add rule to `.gitignore` and `.stylelintrc` to ignore all css files, since we are generating them.
|
|
352
|
-
|
|
353
|
-
#### .gitignore
|
|
354
|
-
|
|
355
|
-
```gitignore
|
|
356
|
-
# css
|
|
357
|
-
*.css
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
#### .stylelintrc
|
|
361
|
-
|
|
362
|
-
```json
|
|
363
|
-
{
|
|
364
|
-
"ignoreFiles": ["**/*.snap", "**/*.css"]
|
|
365
|
-
}
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
5. Change `.lintstagedrc` to lint `less` files instead of `css`.
|
|
369
|
-
|
|
370
|
-
```json
|
|
371
|
-
{
|
|
372
|
-
"*.js": ["eslint --fix"],
|
|
373
|
-
"*.less": ["stylelint --fix"]
|
|
374
|
-
}
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
You can see all changes required to enable Less in [corresponding PR](https://github.com/morewings/cra-template-npm-library/pull/10).
|
|
378
|
-
|
|
379
186
|
## Peer Dependencies
|
|
380
187
|
|
|
381
188
|
Please see below. These must be dependencies in your project to use this library
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import theme, { ITheme } from './theme';
|
|
2
2
|
import KibbleThemeProvider from './providers/ThemeProvider';
|
|
3
3
|
import Button from './components/Button';
|
|
4
|
-
|
|
4
|
+
import Banner from './components/Banner';
|
|
5
|
+
export { theme, ITheme, KibbleThemeProvider, Button, Banner };
|