@televet/kibble-ui 0.1.0-beta.21 → 0.1.0-beta.3
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 +230 -37
- package/build/index.d.ts +1 -2
- package/build/index.es.js +13886 -0
- package/build/index.es.js.map +1 -0
- package/build/index.js +1989 -13469
- package/build/index.js.map +1 -1
- package/build/providers/ThemeProvider/ThemeProvider.d.ts +5 -0
- package/build/theme/breakpoints.d.ts +9 -0
- package/build/theme/{tokens/colors.d.ts → colors.d.ts} +31 -32
- package/build/theme/index.d.ts +15 -16
- package/build/theme/theme.d.ts +3 -0
- package/build/theme/tokens/colors/colors.d.ts +190 -0
- package/build/theme/tokens/fonts/fonts.d.ts +6 -0
- package/package.json +28 -17
- package/build/components/Banner/index.d.ts +0 -3
- package/build/components/Input/index.d.ts +0 -3
- /package/build/theme/{tokens/blur.d.ts → blur.d.ts} +0 -0
- /package/build/theme/{tokens/borders.d.ts → borders.d.ts} +0 -0
- /package/build/theme/{tokens/fontSizes.d.ts → fontSizes.d.ts} +0 -0
- /package/build/theme/{tokens/fontWeights.d.ts → fontWeights.d.ts} +0 -0
- /package/build/theme/{tokens/fonts.d.ts → fonts.d.ts} +0 -0
- /package/build/theme/{tokens/letterSpacings.d.ts → letterSpacings.d.ts} +0 -0
- /package/build/theme/{tokens/lineHeights.d.ts → lineHeights.d.ts} +0 -0
- /package/build/theme/{tokens/radii.d.ts → radii.d.ts} +0 -0
- /package/build/theme/{tokens/shadows.d.ts → shadows.d.ts} +0 -0
- /package/build/theme/{tokens/sizes.d.ts → sizes.d.ts} +0 -0
- /package/build/theme/{tokens/space.d.ts → space.d.ts} +0 -0
- /package/build/theme/{tokens/transition.d.ts → transition.d.ts} +0 -0
- /package/build/theme/{tokens/zIndeces.d.ts → zIndeces.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -8,17 +8,16 @@ 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
|
+
#### Add NPM_TOKEN environment variable
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
In your .bash_profile or .zshrc
|
|
18
|
+
`export NPM_TOKEN=SOME_TOKEN`
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
### Install in project
|
|
20
|
+
#### Install in project
|
|
22
21
|
|
|
23
22
|
`npm i --save @televet/kibble-ui`
|
|
24
23
|
|
|
@@ -31,49 +30,41 @@ import {
|
|
|
31
30
|
} from 'kibble-ui';
|
|
32
31
|
```
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
### Linking Projects for Local Development
|
|
33
|
+
### Development Setup
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
$ rm -rf node_modules # remove existing node_modules
|
|
41
|
-
$ npm run build # ensure there are build files available for the package to reference
|
|
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.
|
|
42
37
|
|
|
43
|
-
|
|
38
|
+
#### Linking Projects for Local Development
|
|
44
39
|
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
```
|
|
41
|
+
cd ~/kibble-ui # go into the package directory
|
|
42
|
+
npm run build # ensure there are build files available for the package to reference
|
|
43
|
+
npm link ../clinic-web/node_modules/react # links kibble-ui react to clinic-web react to prevent two versions of react. See reference to this error here: https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
$ npm run start # start the development server
|
|
45
|
+
# You may need to run the link commands using sudo if you get a permissions error
|
|
50
46
|
|
|
51
|
-
# Navigate to project directory and update package.json to point to your local copy of
|
|
47
|
+
# Navigate to project directory and update package.json to point to your local copy of kibble-ui
|
|
52
48
|
# "@televet/kibble-ui": "./../kibble-ui"
|
|
53
49
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
$ npm install # fresh install with local version of kibble ui
|
|
57
|
-
$ npm run start # start the development server
|
|
50
|
+
cd ~/clinic-web # go into a project directory
|
|
51
|
+
npm install # fresh install without kibble ui
|
|
58
52
|
|
|
59
|
-
#
|
|
53
|
+
# To see what links you've created globally you can run the following command
|
|
54
|
+
npm list -g
|
|
55
|
+
|
|
56
|
+
# To see what links an individual project is currently using run the following command from within that projects root folder
|
|
57
|
+
npm list -link
|
|
60
58
|
```
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
#### Unlinking Projects after Local Development is Complete
|
|
63
61
|
|
|
64
62
|
```
|
|
65
|
-
#
|
|
66
|
-
|
|
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
|
|
63
|
+
# remove link to local files
|
|
64
|
+
npm install --save @televet/kibble-ui # re-install published project
|
|
74
65
|
```
|
|
75
66
|
|
|
76
|
-
|
|
67
|
+
#### `src` directory structure
|
|
77
68
|
|
|
78
69
|
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.
|
|
79
70
|
|
|
@@ -111,9 +102,10 @@ Development takes place inside `src` directory. This is where your library code
|
|
|
111
102
|
|
|
112
103
|
## Build
|
|
113
104
|
|
|
114
|
-
|
|
105
|
+
Template has [Storybook](https://storybook.js.org/) configuration to handle documentation and examples.
|
|
115
106
|
|
|
116
107
|
```bash
|
|
108
|
+
npm run start # starts Storybook in development mode, http://localhost:6006/
|
|
117
109
|
npm run build # bundles library code to `build` folder, and documentation code to `docs` folder in the root of project.
|
|
118
110
|
```
|
|
119
111
|
|
|
@@ -121,7 +113,7 @@ You can view live documentation here after deploying: https://televet.github.io/
|
|
|
121
113
|
|
|
122
114
|
## Deploy and Publish
|
|
123
115
|
|
|
124
|
-
1. Update npm version number with
|
|
116
|
+
1. Update npm version number with [one of these commands](https://docs.npmjs.com/updating-your-published-package-version-number).
|
|
125
117
|
2. Run `npm run build`
|
|
126
118
|
3. Commit changes to git.
|
|
127
119
|
4. When pushing to master, GitHub will publish the package to npm with latest changes.
|
|
@@ -183,6 +175,207 @@ Template includes [stylelint](https://stylelint.io/), to check CSS/SASS/LESS fil
|
|
|
183
175
|
|
|
184
176
|
Stylelint errors don't prevent build of application in development mode.
|
|
185
177
|
|
|
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
|
+
|
|
186
379
|
## Peer Dependencies
|
|
187
380
|
|
|
188
381
|
Please see below. These must be dependencies in your project to use this library
|
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import theme, { ITheme } from './theme';
|
|
2
2
|
import KibbleThemeProvider from './providers/ThemeProvider';
|
|
3
3
|
import Button from './components/Button';
|
|
4
|
-
|
|
5
|
-
export { theme, ITheme, KibbleThemeProvider, Button, Banner };
|
|
4
|
+
export { theme, ITheme, KibbleThemeProvider, Button };
|