@protonradio/proton-ui 0.11.0-beta.18 → 0.11.0-beta.2

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 (50) hide show
  1. package/README.md +73 -153
  2. package/dist/constants.cjs.js +1 -1
  3. package/dist/constants.cjs.js.map +1 -1
  4. package/dist/constants.d.ts +147 -4
  5. package/dist/constants.es.js +19 -7
  6. package/dist/constants.es.js.map +1 -1
  7. package/dist/hooks.cjs.js +1 -1
  8. package/dist/hooks.cjs.js.map +1 -1
  9. package/dist/hooks.d.ts +5 -34
  10. package/dist/hooks.es.js +4 -36
  11. package/dist/hooks.es.js.map +1 -1
  12. package/dist/icons.svg +10 -10
  13. package/dist/index.cjs.js +12 -12
  14. package/dist/index.cjs.js.map +1 -1
  15. package/dist/index.d.ts +296 -500
  16. package/dist/index.es.js +11462 -10177
  17. package/dist/index.es.js.map +1 -1
  18. package/dist/palettes-BX86v-qb.js +2 -0
  19. package/dist/palettes-BX86v-qb.js.map +1 -0
  20. package/dist/palettes-mcF0lNKY.mjs +171 -0
  21. package/dist/palettes-mcF0lNKY.mjs.map +1 -0
  22. package/dist/style.css +1 -1
  23. package/dist/useBreakpoint-CjRyGKN-.mjs.map +1 -1
  24. package/dist/useBreakpoint-DA-JqOu3.js.map +1 -1
  25. package/dist/utils.cjs.js +1 -1
  26. package/dist/utils.cjs.js.map +1 -1
  27. package/dist/utils.d.ts +44 -32
  28. package/dist/utils.es.js +451 -17
  29. package/dist/utils.es.js.map +1 -1
  30. package/package.json +100 -104
  31. package/dist/breakpoint-9y1_8U_b.mjs +0 -10
  32. package/dist/breakpoint-9y1_8U_b.mjs.map +0 -1
  33. package/dist/breakpoint-DtqbboOa.js +0 -2
  34. package/dist/breakpoint-DtqbboOa.js.map +0 -1
  35. package/dist/darkTheme-DUWn6YJ-.mjs +0 -345
  36. package/dist/darkTheme-DUWn6YJ-.mjs.map +0 -1
  37. package/dist/darkTheme-ann6VTfq.js +0 -2
  38. package/dist/darkTheme-ann6VTfq.js.map +0 -1
  39. package/dist/image-BlhKzTx8.js +0 -2
  40. package/dist/image-BlhKzTx8.js.map +0 -1
  41. package/dist/image-C8M6y5Op.mjs +0 -205
  42. package/dist/image-C8M6y5Op.mjs.map +0 -1
  43. package/dist/navigation-BB0MBIiR.js +0 -2
  44. package/dist/navigation-BB0MBIiR.js.map +0 -1
  45. package/dist/navigation-Bj7Pex9j.mjs +0 -43
  46. package/dist/navigation-Bj7Pex9j.mjs.map +0 -1
  47. package/dist/theme-DQsfWeLo.mjs +0 -12
  48. package/dist/theme-DQsfWeLo.mjs.map +0 -1
  49. package/dist/theme-Dc0Ahjq9.js +0 -2
  50. package/dist/theme-Dc0Ahjq9.js.map +0 -1
package/README.md CHANGED
@@ -1,153 +1,73 @@
1
- # ProtonUI
2
-
3
- ![](./.readme.gif)
4
-
5
- ```
6
- npm run storybook
7
- ```
8
-
9
- ## Installation
10
-
11
- ### Prerequisites
12
-
13
- 1. Ensure you have access to `@protonradio/proton-ui` [npm package](https://www.npmjs.com/package/@protonradio/proton-ui)
14
- 2. Login using `npm login`
15
-
16
- ### Install
17
-
18
- ```bash
19
- npm install @protonradio/proton-ui --save
20
- ```
21
-
22
- ### Import Styles
23
-
24
- Import the styles into your main CSS file:
25
-
26
- ```css
27
- @import "@protonradio/proton-ui/styles";
28
- ```
29
-
30
- ### Setup ThemeProvider
31
-
32
- Wrap your application with the `ThemeProvider` to enable theming:
33
-
34
- ```jsx
35
- import { ThemeProvider, THEMES } from "@protonradio/proton-ui";
36
-
37
- function MyApp({ Component, pageProps }) {
38
- return (
39
- <ThemeProvider theme={THEMES.DARK}>
40
- <Component {...pageProps} />
41
- </ThemeProvider>
42
- );
43
- }
44
- ```
45
-
46
- ### Custom Color Palettes
47
-
48
- Each theme has a `ProtonPalette` with colors tailored for UI design. Palettes are made up of `ProtonColorScale`s that have shades from super_light to super_dark:
49
-
50
- - **Primary Scale**
51
- - **Secondary Scale**
52
- - **Brand Colors** [Partial ProtonColorScale]
53
- - **Gray Scale**
54
- - **Semantic Colors**
55
- - Success
56
- - Warning
57
- - Error
58
-
59
- When you pass a custom palette to the ThemeProvider, these five scales are updated with colors based on the background image you gave it. This is useful for designing UIs around individual releases, labels and artists. All generated scales are designed with accessibility in mind, ensuring proper contrast ratios and visual hierarchy.
60
-
61
- To generate a new palette, use the `usePalette` hook:
62
-
63
- ```jsx
64
- import { ThemeProvider, usePalette, THEMES } from "@protonradio/proton-ui";
65
-
66
- function AppWithCustomPalette(props) {
67
- const customPalette = usePalette(
68
- `https://example.com/${props.imgUrl}.jpg`,
69
- THEMES.DARK
70
- );
71
-
72
- return (
73
- <ThemeProvider theme={THEMES.DARK} palette={customPalette}>
74
- <YourApp />
75
- </ThemeProvider>
76
- );
77
- }
78
- ```
79
-
80
- ## Best Styling Practices
81
-
82
- Components use standardized _control_ variables defined in the theme config stylesheets for consistent styling across the design system:
83
-
84
- ```typescript
85
- export interface ProtonStyleSheet {
86
- "--proton-control__background-color": string;
87
- "--proton-control__background-color-light": string;
88
- "--proton-control__text-color": string;
89
- "--proton-control__title-color": string;
90
- "--proton-control__border-color": string;
91
- "--proton-control__shadow-color": string;
92
- // ... etc
93
- ```
94
-
95
- These control variables unify the styling system while powering theme-specific CSS customization, and follow the pattern `--proton-control__{style}-{property}`:
96
-
97
- ```css
98
- .myComponent {
99
- background-color: var(--proton-control__background-color);
100
- }
101
- ```
102
-
103
- For more advanced theme overrides we utilize the theme class names. The `ThemeProvider` applies the appropriate theme class to its container, making it available to all child components. Theme class names follow the pattern `proton-ui__theme--{themeName}`:
104
-
105
- ```css
106
- .proton-ui__theme--dark .myComponent[active] {
107
- background-color: var(--proton-control__interactive-color);
108
- }
109
- ```
110
-
111
- Palettes can also be accessed in JSX via the `useTheme` hook for more advanced use cases:
112
-
113
-
114
- ```jsx
115
- import { useTheme } from "@protonradio/proton-ui";
116
-
117
- function MyComponent() {
118
- const { palette } = useTheme();
119
-
120
- // Prefer CSS selectors over programmatic styling
121
- return <Icon color={palette.BRAND.PRIMARY} />;
122
- }
123
- ```
124
-
125
- ## Publishing Updates to NPM
126
-
127
- We follow semantic versioning and use automated CI/CD for releases:
128
-
129
- **For Beta Releases (Testing):**
130
-
131
- ```bash
132
- npm run build
133
- npm run publish-beta # Automated versioning with beta tag
134
- ```
135
-
136
- **For Production Releases:**
137
-
138
- ```bash
139
- npm run build
140
- npm version <patch|minor|major> # Semantic versioning
141
- npm publish
142
- ```
143
-
144
- **Best Practices:**
145
-
146
- - Always publish beta releases first for testing across platforms
147
- - Test on all supported environments before production release
148
- - Use semantic versioning (patch for bug fixes, minor for features, major for breaking changes)
149
- - Our GitHub Actions [NPM Version](https://github.com/protonradio/proton-ui/actions/workflows/npm_release.yml) tool automatically handles versioning and deployment workflows
150
-
151
- ## Recommended Reading
152
-
153
- - https://www.gabe.pizza/notes-on-component-libraries/
1
+ # Proton UI
2
+
3
+ ![](./.readme.gif)
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,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./breakpoint-DtqbboOa.js"),t=require("./theme-Dc0Ahjq9.js"),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"];exports.BREAKPOINTS=o.BREAKPOINTS;exports.THEMES=t.THEMES;exports.THEME_CLASSES=t.THEME_CLASSES;exports.placements=e;
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/placement.ts"],"sourcesContent":["import { Placement } from \"react-aria\";\r\n\r\nexport const placements: Placement[] = [\r\n \"bottom\",\r\n \"bottom left\",\r\n \"bottom right\",\r\n \"bottom start\",\r\n \"bottom end\",\r\n \"top\",\r\n \"top left\",\r\n \"top right\",\r\n \"top start\",\r\n \"top end\",\r\n \"left\",\r\n \"left top\",\r\n \"left bottom\",\r\n \"start\",\r\n \"start top\",\r\n \"start bottom\",\r\n \"right\",\r\n \"right top\",\r\n \"right bottom\",\r\n \"end\",\r\n \"end top\",\r\n \"end bottom\",\r\n];\r\n"],"names":["placements"],"mappings":"6JAEaA,EAA0B,CACrC,SACA,cACA,eACA,eACA,aACA,MACA,WACA,YACA,YACA,UACA,OACA,WACA,cACA,QACA,YACA,eACA,QACA,YACA,eACA,MACA,UACA,YACF"}
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"}
@@ -1,5 +1,11 @@
1
1
  import { Placement } from 'react-aria';
2
2
 
3
+ declare const BRAND: {
4
+ PRIMARY: string;
5
+ PRIMARY_LIGHT: string;
6
+ SECONDARY: string;
7
+ };
8
+
3
9
  export declare type Breakpoint = (typeof BREAKPOINTS)[keyof typeof BREAKPOINTS];
4
10
 
5
11
  export declare const BREAKPOINTS: {
@@ -9,18 +15,155 @@ export declare const BREAKPOINTS: {
9
15
  X_LARGE: number;
10
16
  };
11
17
 
18
+ export declare namespace COLORS {
19
+ export {
20
+ BRAND,
21
+ DANGER,
22
+ WARNING,
23
+ SUCCESS,
24
+ GRAYSCALE,
25
+ SECONDARY,
26
+ DARK_GRAYSCALE,
27
+ DARK_SECONDARY
28
+ }
29
+ }
30
+
31
+ declare const DANGER: {
32
+ SUPER_DARK: string;
33
+ DARK: string;
34
+ MEDIUM: string;
35
+ LIGHT: string;
36
+ SUPER_LIGHT: string;
37
+ };
38
+
39
+ declare const DARK_GRAYSCALE: {
40
+ GRAY_SUPER_DARK: string;
41
+ GRAY_DARK: string;
42
+ GRAY_MEDIUM: string;
43
+ GRAY_MEDIUM_LIGHT: string;
44
+ GRAY_LIGHT: string;
45
+ GRAY_LIGHTEST: string;
46
+ GRAY_SUPER_LIGHT: string;
47
+ WHITE: string;
48
+ BORDER: string;
49
+ ELEVATION: string;
50
+ };
51
+
52
+ export declare const DARK_MODE: Palette;
53
+
54
+ declare const DARK_SECONDARY: {
55
+ SECONDARY_SUPER_DARK: string;
56
+ SECONDARY_DARK: string;
57
+ SECONDARY_MEDIUM: string;
58
+ SECONDARY_MEDIUM_LIGHT: string;
59
+ SECONDARY_LIGHT: string;
60
+ SECONDARY_LIGHTEST: string;
61
+ SECONDARY_SUPER_LIGHT: string;
62
+ };
63
+
64
+ export declare const DEFAULT_BLACK_BACKGROUND = "#121212";
65
+
66
+ export declare const DEFAULT_WHITE_BACKGROUND = "#ffffff";
67
+
68
+ declare const GRAYSCALE: {
69
+ GRAY_SUPER_DARK: string;
70
+ GRAY_DARK: string;
71
+ GRAY_MEDIUM: string;
72
+ GRAY_MEDIUM_LIGHT: string;
73
+ GRAY_LIGHT: string;
74
+ GRAY_LIGHTEST: string;
75
+ GRAY_SUPER_LIGHT: string;
76
+ WHITE: string;
77
+ BORDER: string;
78
+ ELEVATION: string;
79
+ };
80
+
81
+ export declare const LIGHT_MODE: Palette;
82
+
83
+ export declare type Palette = {
84
+ BASE_COLOR: string;
85
+ BRAND: {
86
+ PRIMARY: string;
87
+ PRIMARY_LIGHT: string;
88
+ SECONDARY: string;
89
+ };
90
+ PRIMARY: {
91
+ PRIMARY_SUPER_DARK: string;
92
+ PRIMARY_DARK: string;
93
+ PRIMARY_MEDIUM: string;
94
+ PRIMARY_MEDIUM_LIGHT: string;
95
+ PRIMARY_LIGHT: string;
96
+ PRIMARY_LIGHTEST: string;
97
+ PRIMARY_SUPER_LIGHT: string;
98
+ };
99
+ SECONDARY: {
100
+ SECONDARY_SUPER_DARK: string;
101
+ SECONDARY_DARK: string;
102
+ SECONDARY_MEDIUM: string;
103
+ SECONDARY_MEDIUM_LIGHT: string;
104
+ SECONDARY_LIGHT: string;
105
+ SECONDARY_LIGHTEST: string;
106
+ SECONDARY_SUPER_LIGHT: string;
107
+ };
108
+ SUCCESS: {
109
+ SUCCESS_DARK: string;
110
+ SUCCESS_MEDIUM: string;
111
+ SUCCESS_LIGHT: string;
112
+ SUCCESS_SUPER_LIGHT: string;
113
+ };
114
+ WARNING: {
115
+ WARNING_DARK: string;
116
+ WARNING_MEDIUM: string;
117
+ WARNING_LIGHT: string;
118
+ WARNING_SUPER_LIGHT: string;
119
+ };
120
+ DANGER: {
121
+ DANGER_SUPER_DARK: string;
122
+ DANGER_DARK: string;
123
+ DANGER_MEDIUM: string;
124
+ DANGER_LIGHT: string;
125
+ DANGER_SUPER_LIGHT: string;
126
+ };
127
+ };
128
+
12
129
  export declare const placements: Placement[];
13
130
 
14
- export declare type Theme = (typeof THEMES)[keyof typeof THEMES];
131
+ declare const SECONDARY: {
132
+ SUPER_DARK: string;
133
+ DARK: string;
134
+ MEDIUM: string;
135
+ MEDIUM_LIGHT: string;
136
+ LIGHT: string;
137
+ LIGHTEST: string;
138
+ SUPER_LIGHT: string;
139
+ WHITE: string;
140
+ };
15
141
 
16
- export declare const THEME_CLASSES: {
17
- dark: string;
18
- light: string;
142
+ declare const SUCCESS: {
143
+ DARK: string;
144
+ MEDIUM: string;
145
+ LIGHT: string;
146
+ SUPER_LIGHT: string;
19
147
  };
20
148
 
149
+ export declare type Theme = (typeof THEMES)[keyof typeof THEMES];
150
+
21
151
  export declare const THEMES: {
22
152
  readonly DARK: "dark";
153
+ readonly CUSTOM_DARK: "custom-dark";
23
154
  readonly LIGHT: "light";
24
155
  };
25
156
 
157
+ declare const WARNING: {
158
+ DARK: string;
159
+ MEDIUM: string;
160
+ LIGHT: string;
161
+ SUPER_LIGHT: string;
162
+ };
163
+
26
164
  export { }
165
+
166
+
167
+ declare namespace ButtonGroup {
168
+ var Option: (props: ButtonGroupOptionProps) => import("react/jsx-runtime").JSX.Element;
169
+ }
@@ -1,6 +1,9 @@
1
- import { B as r } from "./breakpoint-9y1_8U_b.mjs";
2
- import { T as m, a } from "./theme-DQsfWeLo.mjs";
3
- const t = [
1
+ import { c as e, b as m, a as p, D as A, L as D } from "./palettes-mcF0lNKY.mjs";
2
+ const t = {
3
+ DARK: "dark",
4
+ CUSTOM_DARK: "custom-dark",
5
+ LIGHT: "light"
6
+ }, o = [
4
7
  "bottom",
5
8
  "bottom left",
6
9
  "bottom right",
@@ -23,11 +26,20 @@ const t = [
23
26
  "end",
24
27
  "end top",
25
28
  "end bottom"
26
- ];
29
+ ], r = {
30
+ SMALL: 576,
31
+ MEDIUM: 768,
32
+ LARGE: 992,
33
+ X_LARGE: 1200
34
+ };
27
35
  export {
28
36
  r as BREAKPOINTS,
29
- m as THEMES,
30
- a as THEME_CLASSES,
31
- t as placements
37
+ e as COLORS,
38
+ m as DARK_MODE,
39
+ p as DEFAULT_BLACK_BACKGROUND,
40
+ A as DEFAULT_WHITE_BACKGROUND,
41
+ D as LIGHT_MODE,
42
+ t as THEMES,
43
+ o as placements
32
44
  };
33
45
  //# sourceMappingURL=constants.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.es.js","sources":["../src/constants/placement.ts"],"sourcesContent":["import { Placement } from \"react-aria\";\r\n\r\nexport const placements: Placement[] = [\r\n \"bottom\",\r\n \"bottom left\",\r\n \"bottom right\",\r\n \"bottom start\",\r\n \"bottom end\",\r\n \"top\",\r\n \"top left\",\r\n \"top right\",\r\n \"top start\",\r\n \"top end\",\r\n \"left\",\r\n \"left top\",\r\n \"left bottom\",\r\n \"start\",\r\n \"start top\",\r\n \"start bottom\",\r\n \"right\",\r\n \"right top\",\r\n \"right bottom\",\r\n \"end\",\r\n \"end top\",\r\n \"end bottom\",\r\n];\r\n"],"names":["placements"],"mappings":";;AAEO,MAAMA,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;"}
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/hooks.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./useBreakpoint-DA-JqOu3.js"),t=require("./darkTheme-ann6VTfq.js"),s=require("react"),i=require("./image-BlhKzTx8.js"),T=require("./theme-Dc0Ahjq9.js"),P=(e,a)=>{const[l,o]=s.useState(t.LIGHT_PALETTE),c=s.useCallback(async()=>{if(!e)return t.LIGHT_PALETTE;try{const r=await i.getDominantColor(e);return i.generatePalette(r)}catch(r){return console.error("Failed to generate palette:",r),t.LIGHT_PALETTE}},[e]);return s.useEffect(()=>{(async()=>{if(e){const u=await c();o(u);return}if(a===T.THEMES.DARK){o(t.DARK_PALETTE);return}o(t.LIGHT_PALETTE)})()},[e,a,c]),s.useMemo(()=>l,[l])};exports.useBreakpoint=n.useBreakpoint;exports.useIsClosing=n.useIsClosing;exports.useLockBodyScroll=n.useLockBodyScroll;exports.usePalette=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useBreakpoint-DA-JqOu3.js");exports.useBreakpoint=e.useBreakpoint;exports.useIsClosing=e.useIsClosing;exports.useLockBodyScroll=e.useLockBodyScroll;
2
2
  //# sourceMappingURL=hooks.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.cjs.js","sources":["../src/hooks/usePalette.tsx"],"sourcesContent":["import { THEMES } from \"../constants\";\r\nimport { DARK_PALETTE } from \"../design/darkTheme\";\r\nimport { LIGHT_PALETTE } from \"../design/lightTheme\";\r\nimport { generatePalette, getDominantColor } from \"../utils\";\r\nimport { ProtonPalette } from \"../design/types\";\r\nimport { useEffect, useState, useCallback, useMemo } from \"react\";\r\n\r\n/**\r\n * Generates a palette based on a background image or theme.\r\n * @param backgroundImage - The URL of the background image to generate a palette from.\r\n * @param theme - The theme to generate a palette for.\r\n * @returns A Palette object containing the generated palette.\r\n */\r\nexport const usePalette = (\r\n backgroundImage: HTMLImageElement | string | null,\r\n theme: string\r\n): ProtonPalette => {\r\n const [palette, setPalette] = useState<ProtonPalette>(LIGHT_PALETTE);\r\n\r\n const getPalette = useCallback(async () => {\r\n if (!backgroundImage) return LIGHT_PALETTE;\r\n\r\n try {\r\n const baseColor = await getDominantColor(\r\n backgroundImage as HTMLImageElement & string\r\n );\r\n const newPalette = generatePalette(baseColor);\r\n\r\n return newPalette;\r\n } catch (error) {\r\n console.error(\"Failed to generate palette:\", error);\r\n return LIGHT_PALETTE;\r\n }\r\n }, [backgroundImage]);\r\n\r\n useEffect(() => {\r\n const fetchPalette = async () => {\r\n if (backgroundImage) {\r\n const newPalette = await getPalette();\r\n setPalette(newPalette);\r\n return;\r\n }\r\n\r\n if (theme === THEMES.DARK) {\r\n setPalette(DARK_PALETTE);\r\n return;\r\n }\r\n\r\n setPalette(LIGHT_PALETTE);\r\n };\r\n\r\n fetchPalette();\r\n }, [backgroundImage, theme, getPalette]);\r\n\r\n return useMemo(() => palette, [palette]);\r\n};\r\n"],"names":["usePalette","backgroundImage","theme","palette","setPalette","useState","LIGHT_PALETTE","getPalette","useCallback","baseColor","getDominantColor","generatePalette","error","useEffect","newPalette","THEMES","DARK_PALETTE","useMemo"],"mappings":"yPAaaA,EAAa,CACxBC,EACAC,IACkB,CAClB,KAAM,CAACC,EAASC,CAAU,EAAIC,WAAwBC,EAAa,aAAA,EAE7DC,EAAaC,EAAAA,YAAY,SAAY,CACrC,GAAA,CAACP,EAAwB,OAAAK,gBAEzB,GAAA,CACF,MAAMG,EAAY,MAAMC,EAAA,iBACtBT,CAAA,EAIK,OAFYU,kBAAgBF,CAAS,QAGrCG,EAAO,CACN,eAAA,MAAM,8BAA+BA,CAAK,EAC3CN,eACT,CAAA,EACC,CAACL,CAAe,CAAC,EAEpBY,OAAAA,EAAAA,UAAU,IAAM,EACO,SAAY,CAC/B,GAAIZ,EAAiB,CACb,MAAAa,EAAa,MAAMP,IACzBH,EAAWU,CAAU,EACrB,MACF,CAEI,GAAAZ,IAAUa,SAAO,KAAM,CACzBX,EAAWY,EAAY,YAAA,EACvB,MACF,CAEAZ,EAAWE,EAAa,aAAA,CAAA,IAIzB,EAAA,CAACL,EAAiBC,EAAOK,CAAU,CAAC,EAEhCU,EAAQ,QAAA,IAAMd,EAAS,CAACA,CAAO,CAAC,CACzC"}
1
+ {"version":3,"file":"hooks.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/hooks.d.ts CHANGED
@@ -11,32 +11,6 @@ declare const BREAKPOINTS: {
11
11
  X_LARGE: number;
12
12
  };
13
13
 
14
- declare type ProtonColorScale = {
15
- SUPER_DARK: string;
16
- DARK: string;
17
- MEDIUM: string;
18
- MEDIUM_LIGHT: string;
19
- LIGHT: string;
20
- LIGHTEST: string;
21
- SUPER_LIGHT: string;
22
- WHITE: string;
23
- };
24
-
25
- declare type ProtonPalette = {
26
- BASE_COLOR: string;
27
- BRAND: {
28
- PRIMARY: string;
29
- PRIMARY_LIGHT: string;
30
- PRIMARY_SUPER_LIGHT: string;
31
- SECONDARY: string;
32
- SECONDARY_LIGHT: string;
33
- SECONDARY_SUPER_LIGHT: string;
34
- };
35
- PRIMARY: ProtonColorScale;
36
- SECONDARY: ProtonColorScale;
37
- GRAYSCALE: ProtonColorScale;
38
- };
39
-
40
14
  export declare function useBreakpoint(breakpoint: Breakpoint, direction?: BreakpointDirection): boolean;
41
15
 
42
16
  /**
@@ -71,12 +45,9 @@ declare interface UseIsClosingOptions {
71
45
  */
72
46
  export declare function useLockBodyScroll(isActive?: boolean): void;
73
47
 
74
- /**
75
- * Generates a palette based on a background image or theme.
76
- * @param backgroundImage - The URL of the background image to generate a palette from.
77
- * @param theme - The theme to generate a palette for.
78
- * @returns A Palette object containing the generated palette.
79
- */
80
- export declare const usePalette: (backgroundImage: HTMLImageElement | string | null, theme: string) => ProtonPalette;
81
-
82
48
  export { }
49
+
50
+
51
+ declare namespace ButtonGroup {
52
+ var Option: (props: ButtonGroupOptionProps) => import("react/jsx-runtime").JSX.Element;
53
+ }
package/dist/hooks.es.js CHANGED
@@ -1,39 +1,7 @@
1
- import { b as S, a as h, u as x } from "./useBreakpoint-CjRyGKN-.mjs";
2
- import { L as r, D as c } from "./darkTheme-DUWn6YJ-.mjs";
3
- import { useState as i, useCallback as f, useEffect as u, useMemo as P } from "react";
4
- import { a as p, g as E } from "./image-C8M6y5Op.mjs";
5
- import { T } from "./theme-DQsfWeLo.mjs";
6
- const A = (t, s) => {
7
- const [a, o] = i(r), n = f(async () => {
8
- if (!t) return r;
9
- try {
10
- const e = await p(
11
- t
12
- );
13
- return E(e);
14
- } catch (e) {
15
- return console.error("Failed to generate palette:", e), r;
16
- }
17
- }, [t]);
18
- return u(() => {
19
- (async () => {
20
- if (t) {
21
- const l = await n();
22
- o(l);
23
- return;
24
- }
25
- if (s === T.DARK) {
26
- o(c);
27
- return;
28
- }
29
- o(r);
30
- })();
31
- }, [t, s, n]), P(() => a, [a]);
32
- };
1
+ import { b as a, a as e, u as r } from "./useBreakpoint-CjRyGKN-.mjs";
33
2
  export {
34
- S as useBreakpoint,
35
- h as useIsClosing,
36
- x as useLockBodyScroll,
37
- A as usePalette
3
+ a as useBreakpoint,
4
+ e as useIsClosing,
5
+ r as useLockBodyScroll
38
6
  };
39
7
  //# sourceMappingURL=hooks.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.es.js","sources":["../src/hooks/usePalette.tsx"],"sourcesContent":["import { THEMES } from \"../constants\";\r\nimport { DARK_PALETTE } from \"../design/darkTheme\";\r\nimport { LIGHT_PALETTE } from \"../design/lightTheme\";\r\nimport { generatePalette, getDominantColor } from \"../utils\";\r\nimport { ProtonPalette } from \"../design/types\";\r\nimport { useEffect, useState, useCallback, useMemo } from \"react\";\r\n\r\n/**\r\n * Generates a palette based on a background image or theme.\r\n * @param backgroundImage - The URL of the background image to generate a palette from.\r\n * @param theme - The theme to generate a palette for.\r\n * @returns A Palette object containing the generated palette.\r\n */\r\nexport const usePalette = (\r\n backgroundImage: HTMLImageElement | string | null,\r\n theme: string\r\n): ProtonPalette => {\r\n const [palette, setPalette] = useState<ProtonPalette>(LIGHT_PALETTE);\r\n\r\n const getPalette = useCallback(async () => {\r\n if (!backgroundImage) return LIGHT_PALETTE;\r\n\r\n try {\r\n const baseColor = await getDominantColor(\r\n backgroundImage as HTMLImageElement & string\r\n );\r\n const newPalette = generatePalette(baseColor);\r\n\r\n return newPalette;\r\n } catch (error) {\r\n console.error(\"Failed to generate palette:\", error);\r\n return LIGHT_PALETTE;\r\n }\r\n }, [backgroundImage]);\r\n\r\n useEffect(() => {\r\n const fetchPalette = async () => {\r\n if (backgroundImage) {\r\n const newPalette = await getPalette();\r\n setPalette(newPalette);\r\n return;\r\n }\r\n\r\n if (theme === THEMES.DARK) {\r\n setPalette(DARK_PALETTE);\r\n return;\r\n }\r\n\r\n setPalette(LIGHT_PALETTE);\r\n };\r\n\r\n fetchPalette();\r\n }, [backgroundImage, theme, getPalette]);\r\n\r\n return useMemo(() => palette, [palette]);\r\n};\r\n"],"names":["usePalette","backgroundImage","theme","palette","setPalette","useState","LIGHT_PALETTE","getPalette","useCallback","baseColor","getDominantColor","generatePalette","error","useEffect","newPalette","THEMES","DARK_PALETTE","useMemo"],"mappings":";;;;;AAaa,MAAAA,IAAa,CACxBC,GACAC,MACkB;AAClB,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAwBC,CAAa,GAE7DC,IAAaC,EAAY,YAAY;AACrC,QAAA,CAACP,EAAwB,QAAAK;AAEzB,QAAA;AACF,YAAMG,IAAY,MAAMC;AAAA,QACtBT;AAAA,MAAA;AAIK,aAFYU,EAAgBF,CAAS;AAAA,aAGrCG,GAAO;AACN,qBAAA,MAAM,+BAA+BA,CAAK,GAC3CN;AAAA,IACT;AAAA,EAAA,GACC,CAACL,CAAe,CAAC;AAEpB,SAAAY,EAAU,MAAM;AAgBD,KAfQ,YAAY;AAC/B,UAAIZ,GAAiB;AACb,cAAAa,IAAa,MAAMP;AACzB,QAAAH,EAAWU,CAAU;AACrB;AAAA,MACF;AAEI,UAAAZ,MAAUa,EAAO,MAAM;AACzB,QAAAX,EAAWY,CAAY;AACvB;AAAA,MACF;AAEA,MAAAZ,EAAWE,CAAa;AAAA,IAAA;EAIzB,GAAA,CAACL,GAAiBC,GAAOK,CAAU,CAAC,GAEhCU,EAAQ,MAAMd,GAAS,CAACA,CAAO,CAAC;AACzC;"}
1
+ {"version":3,"file":"hooks.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
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>