@protonradio/proton-ui 0.10.13 → 0.10.15
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 +73 -73
- package/dist/constants.cjs.js +1 -1
- package/dist/constants.cjs.js.map +1 -1
- package/dist/constants.d.ts +2 -2
- package/dist/constants.es.js +1 -1
- package/dist/constants.es.js.map +1 -1
- package/dist/icons.svg +10 -10
- package/dist/index.cjs.js +12 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +20 -38
- package/dist/index.es.js +3693 -3980
- package/dist/index.es.js.map +1 -1
- package/dist/{palettes-BZQ9UVED.js → palettes-BX86v-qb.js} +2 -2
- package/dist/palettes-BX86v-qb.js.map +1 -0
- package/dist/{palettes-BDp2VnQU.mjs → palettes-BgYtmc18.mjs} +4 -4
- package/dist/palettes-BgYtmc18.mjs.map +1 -0
- package/dist/style.css +1 -1
- package/dist/useBreakpoint-Du8PkzTj.js.map +1 -1
- package/dist/useBreakpoint-y9OWm50p.mjs.map +1 -1
- package/dist/utils-BOQ-r-2W.js +2 -0
- package/dist/utils-BOQ-r-2W.js.map +1 -0
- package/dist/{utils-OggAvvvN.mjs → utils-BiD166LN.mjs} +150 -136
- package/dist/utils-BiD166LN.mjs.map +1 -0
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.d.ts +4 -8
- package/dist/utils.es.js +4 -5
- package/package.json +99 -99
- package/dist/palettes-BDp2VnQU.mjs.map +0 -1
- package/dist/palettes-BZQ9UVED.js.map +0 -1
- package/dist/utils-DdC7qBKJ.js +0 -2
- package/dist/utils-DdC7qBKJ.js.map +0 -1
- package/dist/utils-OggAvvvN.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
# Proton UI
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
npm run storybook
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
### Publishing Updates to NPM
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
npm run build
|
|
13
|
-
npm version <new_version> // increment version in package.json accordingly using semver
|
|
14
|
-
npm publish
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Themes
|
|
18
|
-
|
|
19
|
-
This library supports themes for the various applications that use it. Ideally, we would unify our app designs, but until then themes is a way to support different design patterns using the same api.
|
|
20
|
-
|
|
21
|
-
#### Adding a Theme
|
|
22
|
-
|
|
23
|
-
The current supported themes can be found in the `src/themes/config.ts`. To add a new theme, create a new attribute on the `THEMES` object following the pattern `[themeName]: [themeClassName]`.
|
|
24
|
-
|
|
25
|
-
#### Styling for a theme
|
|
26
|
-
|
|
27
|
-
To apply theme specific styles in a component, we set theme specific css variables in the `src/themes/config.ts` file, in `generateThemeCssVariables` function. If you need more control, you can add either use the `useTheme` hook to manipulate the DOM, or you can use css selectors that reference the wrapping theme class.
|
|
28
|
-
|
|
29
|
-
For example, to apply a style to the dark theme, you can use the following css.
|
|
30
|
-
```css
|
|
31
|
-
.proton-ui__theme--dark .myComponent {
|
|
32
|
-
background-color: red;
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Implementing in your application
|
|
37
|
-
|
|
38
|
-
#### Prerequisites
|
|
39
|
-
|
|
40
|
-
1. Ensure you have access to Proton's `proton-ui` npm package
|
|
41
|
-
2. Login to npm using `npm login`
|
|
42
|
-
|
|
43
|
-
#### Install
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
npm install @protonradio/proton-ui --save
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
#### Import the styles
|
|
50
|
-
Then import the styles into your main.css file.
|
|
51
|
-
|
|
52
|
-
```css
|
|
53
|
-
@import "@protonradio/proton-ui/styles";
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
#### Setup the theme provider
|
|
57
|
-
When applying to a project, you can import available themes using `THEMES` from this library and apply the theme an outer div on the application. See below for an example.
|
|
58
|
-
|
|
59
|
-
```jsx
|
|
60
|
-
import { ThemeProvider, THEMES } from "@protonradio/proton-ui";
|
|
61
|
-
|
|
62
|
-
function MyApp({ Component, pageProps }) {
|
|
63
|
-
return (
|
|
64
|
-
<ThemeProvider theme={THEMES.DARK}>
|
|
65
|
-
<Component {...pageProps} />
|
|
66
|
-
</ThemeProvider>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Recommended Reading
|
|
72
|
-
|
|
73
|
-
- https://www.gabe.pizza/notes-on-component-libraries/
|
|
1
|
+
# Proton UI
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm run storybook
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
### Publishing Updates to NPM
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
npm run build
|
|
13
|
+
npm version <new_version> // increment version in package.json accordingly using semver
|
|
14
|
+
npm publish
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Themes
|
|
18
|
+
|
|
19
|
+
This library supports themes for the various applications that use it. Ideally, we would unify our app designs, but until then themes is a way to support different design patterns using the same api.
|
|
20
|
+
|
|
21
|
+
#### Adding a Theme
|
|
22
|
+
|
|
23
|
+
The current supported themes can be found in the `src/themes/config.ts`. To add a new theme, create a new attribute on the `THEMES` object following the pattern `[themeName]: [themeClassName]`.
|
|
24
|
+
|
|
25
|
+
#### Styling for a theme
|
|
26
|
+
|
|
27
|
+
To apply theme specific styles in a component, we set theme specific css variables in the `src/themes/config.ts` file, in `generateThemeCssVariables` function. If you need more control, you can add either use the `useTheme` hook to manipulate the DOM, or you can use css selectors that reference the wrapping theme class.
|
|
28
|
+
|
|
29
|
+
For example, to apply a style to the dark theme, you can use the following css.
|
|
30
|
+
```css
|
|
31
|
+
.proton-ui__theme--dark .myComponent {
|
|
32
|
+
background-color: red;
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Implementing in your application
|
|
37
|
+
|
|
38
|
+
#### Prerequisites
|
|
39
|
+
|
|
40
|
+
1. Ensure you have access to Proton's `proton-ui` npm package
|
|
41
|
+
2. Login to npm using `npm login`
|
|
42
|
+
|
|
43
|
+
#### Install
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
npm install @protonradio/proton-ui --save
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
#### Import the styles
|
|
50
|
+
Then import the styles into your main.css file.
|
|
51
|
+
|
|
52
|
+
```css
|
|
53
|
+
@import "@protonradio/proton-ui/styles";
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### Setup the theme provider
|
|
57
|
+
When applying to a project, you can import available themes using `THEMES` from this library and apply the theme an outer div on the application. See below for an example.
|
|
58
|
+
|
|
59
|
+
```jsx
|
|
60
|
+
import { ThemeProvider, THEMES } from "@protonradio/proton-ui";
|
|
61
|
+
|
|
62
|
+
function MyApp({ Component, pageProps }) {
|
|
63
|
+
return (
|
|
64
|
+
<ThemeProvider theme={THEMES.DARK}>
|
|
65
|
+
<Component {...pageProps} />
|
|
66
|
+
</ThemeProvider>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Recommended Reading
|
|
72
|
+
|
|
73
|
+
- https://www.gabe.pizza/notes-on-component-libraries/
|
package/dist/constants.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./palettes-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./palettes-BX86v-qb.js"),o={DARK:"dark",CUSTOM_DARK:"custom-dark",LIGHT:"light"},e=["bottom","bottom left","bottom right","bottom start","bottom end","top","top left","top right","top start","top end","left","left top","left bottom","start","start top","start bottom","right","right top","right bottom","end","end top","end bottom"],r={SMALL:576,MEDIUM:768,LARGE:992,X_LARGE:1200};exports.COLORS=t.colors;exports.DARK_MODE=t.DARK_MODE;exports.DEFAULT_BLACK_BACKGROUND=t.DEFAULT_BLACK_BACKGROUND;exports.DEFAULT_WHITE_BACKGROUND=t.DEFAULT_WHITE_BACKGROUND;exports.LIGHT_MODE=t.LIGHT_MODE;exports.BREAKPOINTS=r;exports.THEMES=o;exports.placements=e;
|
|
2
2
|
//# sourceMappingURL=constants.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs.js","sources":["../src/constants/index.ts"],"sourcesContent":["import { Placement } from \"react-aria\";\
|
|
1
|
+
{"version":3,"file":"constants.cjs.js","sources":["../src/constants/index.ts"],"sourcesContent":["import { Placement } from \"react-aria\";\n\nexport * as COLORS from \"./colors\";\n\nexport * from \"./palettes\";\n\nexport const THEMES = {\n DARK: \"dark\",\n CUSTOM_DARK: \"custom-dark\",\n LIGHT: \"light\",\n} as const;\n\nexport type Theme = (typeof THEMES)[keyof typeof THEMES];\n\nexport const placements: Placement[] = [\n \"bottom\",\n \"bottom left\",\n \"bottom right\",\n \"bottom start\",\n \"bottom end\",\n \"top\",\n \"top left\",\n \"top right\",\n \"top start\",\n \"top end\",\n \"left\",\n \"left top\",\n \"left bottom\",\n \"start\",\n \"start top\",\n \"start bottom\",\n \"right\",\n \"right top\",\n \"right bottom\",\n \"end\",\n \"end top\",\n \"end bottom\",\n];\n\nexport const BREAKPOINTS = {\n SMALL: 576,\n MEDIUM: 768,\n LARGE: 992,\n X_LARGE: 1200,\n};\n\nexport type Breakpoint = (typeof BREAKPOINTS)[keyof typeof BREAKPOINTS];\n"],"names":["THEMES","placements","BREAKPOINTS"],"mappings":"0HAMaA,EAAS,CACpB,KAAM,OACN,YAAa,cACb,MAAO,OACT,EAIaC,EAA0B,CACrC,SACA,cACA,eACA,eACA,aACA,MACA,WACA,YACA,YACA,UACA,OACA,WACA,cACA,QACA,YACA,eACA,QACA,YACA,eACA,MACA,UACA,YACF,EAEaC,EAAc,CACzB,MAAO,IACP,OAAQ,IACR,MAAO,IACP,QAAS,IACX"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -61,9 +61,9 @@ declare const DARK_SECONDARY: {
|
|
|
61
61
|
SECONDARY_SUPER_LIGHT: string;
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
export declare const DEFAULT_BLACK_BACKGROUND = "
|
|
64
|
+
export declare const DEFAULT_BLACK_BACKGROUND = "#121212";
|
|
65
65
|
|
|
66
|
-
export declare const DEFAULT_WHITE_BACKGROUND = "
|
|
66
|
+
export declare const DEFAULT_WHITE_BACKGROUND = "#ffffff";
|
|
67
67
|
|
|
68
68
|
declare const GRAYSCALE: {
|
|
69
69
|
GRAY_SUPER_DARK: string;
|
package/dist/constants.es.js
CHANGED
package/dist/constants.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.es.js","sources":["../src/constants/index.ts"],"sourcesContent":["import { Placement } from \"react-aria\";\
|
|
1
|
+
{"version":3,"file":"constants.es.js","sources":["../src/constants/index.ts"],"sourcesContent":["import { Placement } from \"react-aria\";\n\nexport * as COLORS from \"./colors\";\n\nexport * from \"./palettes\";\n\nexport const THEMES = {\n DARK: \"dark\",\n CUSTOM_DARK: \"custom-dark\",\n LIGHT: \"light\",\n} as const;\n\nexport type Theme = (typeof THEMES)[keyof typeof THEMES];\n\nexport const placements: Placement[] = [\n \"bottom\",\n \"bottom left\",\n \"bottom right\",\n \"bottom start\",\n \"bottom end\",\n \"top\",\n \"top left\",\n \"top right\",\n \"top start\",\n \"top end\",\n \"left\",\n \"left top\",\n \"left bottom\",\n \"start\",\n \"start top\",\n \"start bottom\",\n \"right\",\n \"right top\",\n \"right bottom\",\n \"end\",\n \"end top\",\n \"end bottom\",\n];\n\nexport const BREAKPOINTS = {\n SMALL: 576,\n MEDIUM: 768,\n LARGE: 992,\n X_LARGE: 1200,\n};\n\nexport type Breakpoint = (typeof BREAKPOINTS)[keyof typeof BREAKPOINTS];\n"],"names":["THEMES","placements","BREAKPOINTS"],"mappings":";AAMO,MAAMA,IAAS;AAAA,EACpB,MAAM;AAAA,EACN,aAAa;AAAA,EACb,OAAO;AACT,GAIaC,IAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEaC,IAAc;AAAA,EACzB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AACX;"}
|
package/dist/icons.svg
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
2
|
-
<defs>
|
|
3
|
-
<symbol id="external-link" viewBox="0 0 512 512">
|
|
4
|
-
<path d="M384 224v184a40 40 0 01-40 40H104a40 40 0 01-40-40V168a40 40 0 0140-40h167.48M336 64h112v112M224 288L440 72" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/>
|
|
5
|
-
</symbol>
|
|
6
|
-
|
|
7
|
-
<symbol id="caret-down" viewBox="0 0 512 512">
|
|
8
|
-
<path fill="currentColor" d="M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7L86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"/>
|
|
9
|
-
</symbol>
|
|
10
|
-
</defs>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
2
|
+
<defs>
|
|
3
|
+
<symbol id="external-link" viewBox="0 0 512 512">
|
|
4
|
+
<path d="M384 224v184a40 40 0 01-40 40H104a40 40 0 01-40-40V168a40 40 0 0140-40h167.48M336 64h112v112M224 288L440 72" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/>
|
|
5
|
+
</symbol>
|
|
6
|
+
|
|
7
|
+
<symbol id="caret-down" viewBox="0 0 512 512">
|
|
8
|
+
<path fill="currentColor" d="M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7L86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"/>
|
|
9
|
+
</symbol>
|
|
10
|
+
</defs>
|
|
11
11
|
</svg>
|