@protonradio/proton-ui 0.11.0-beta.19 → 0.11.0-beta.20

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 (47) hide show
  1. package/README.md +35 -115
  2. package/dist/constants.cjs.js +1 -1
  3. package/dist/constants.cjs.js.map +1 -1
  4. package/dist/constants.d.ts +149 -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/index.cjs.js +12 -12
  13. package/dist/index.cjs.js.map +1 -1
  14. package/dist/index.d.ts +353 -483
  15. package/dist/index.es.js +11614 -10122
  16. package/dist/index.es.js.map +1 -1
  17. package/dist/palettes-D006-kxf.mjs +174 -0
  18. package/dist/palettes-D006-kxf.mjs.map +1 -0
  19. package/dist/palettes-DfloGKJz.js +2 -0
  20. package/dist/palettes-DfloGKJz.js.map +1 -0
  21. package/dist/style.css +1 -1
  22. package/dist/utils.cjs.js +1 -1
  23. package/dist/utils.cjs.js.map +1 -1
  24. package/dist/utils.d.ts +45 -26
  25. package/dist/utils.es.js +457 -17
  26. package/dist/utils.es.js.map +1 -1
  27. package/package.json +4 -8
  28. package/dist/breakpoint-9y1_8U_b.mjs +0 -10
  29. package/dist/breakpoint-9y1_8U_b.mjs.map +0 -1
  30. package/dist/breakpoint-DtqbboOa.js +0 -2
  31. package/dist/breakpoint-DtqbboOa.js.map +0 -1
  32. package/dist/darkTheme-DUWn6YJ-.mjs +0 -345
  33. package/dist/darkTheme-DUWn6YJ-.mjs.map +0 -1
  34. package/dist/darkTheme-ann6VTfq.js +0 -2
  35. package/dist/darkTheme-ann6VTfq.js.map +0 -1
  36. package/dist/image-BlhKzTx8.js +0 -2
  37. package/dist/image-BlhKzTx8.js.map +0 -1
  38. package/dist/image-C8M6y5Op.mjs +0 -205
  39. package/dist/image-C8M6y5Op.mjs.map +0 -1
  40. package/dist/navigation-BB0MBIiR.js +0 -2
  41. package/dist/navigation-BB0MBIiR.js.map +0 -1
  42. package/dist/navigation-Bj7Pex9j.mjs +0 -43
  43. package/dist/navigation-Bj7Pex9j.mjs.map +0 -1
  44. package/dist/theme-DQsfWeLo.mjs +0 -12
  45. package/dist/theme-DQsfWeLo.mjs.map +0 -1
  46. package/dist/theme-Dc0Ahjq9.js +0 -2
  47. package/dist/theme-Dc0Ahjq9.js.map +0 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ProtonUI
1
+ # Proton UI
2
2
 
3
3
  ![](./.readme.gif)
4
4
 
@@ -6,148 +6,68 @@
6
6
  npm run storybook
7
7
  ```
8
8
 
9
- ## Installation
9
+ ### Publishing Updates to NPM
10
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
11
  ```
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
- }
12
+ npm run build
13
+ npm version <new_version> // increment version in package.json accordingly using semver
14
+ npm publish
44
15
  ```
45
16
 
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:
17
+ ### Themes
49
18
 
50
- - **Primary Scale**
51
- - **Secondary Scale**
52
- - **Brand Colors** [Partial ProtonColorScale]
53
- - **Gray Scale**
54
- - **Semantic Colors**
55
- - Success
56
- - Warning
57
- - Error
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.
58
20
 
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.
21
+ #### Adding a Theme
60
22
 
61
- To generate a new palette, use the `usePalette` hook:
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]`.
62
24
 
63
- ```jsx
64
- import { ThemeProvider, usePalette, THEMES } from "@protonradio/proton-ui";
25
+ #### Styling for a theme
65
26
 
66
- function AppWithCustomPalette(props) {
67
- const customPalette = usePalette(
68
- `https://example.com/${props.imgUrl}.jpg`,
69
- THEMES.DARK
70
- );
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.
71
28
 
72
- return (
73
- <ThemeProvider theme={THEMES.DARK} palette={customPalette}>
74
- <YourApp />
75
- </ThemeProvider>
76
- );
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;
77
33
  }
78
34
  ```
79
35
 
80
- ## Best Styling Practices
36
+ ### Implementing in your application
81
37
 
82
- Components use standardized _control_ variables defined in the theme config stylesheets for consistent styling across the design system:
38
+ #### Prerequisites
83
39
 
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
- ```
40
+ 1. Ensure you have access to Proton's `proton-ui` npm package
41
+ 2. Login to npm using `npm login`
94
42
 
95
- These control variables unify the styling system while powering theme-specific CSS customization, and follow the pattern `--proton-control__{style}-{property}`:
43
+ #### Install
96
44
 
97
- ```css
98
- .myComponent {
99
- background-color: var(--proton-control__background-color);
100
- }
45
+ ```
46
+ npm install @protonradio/proton-ui --save
101
47
  ```
102
48
 
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}`:
49
+ #### Import the styles
50
+ Then import the styles into your main.css file.
104
51
 
105
52
  ```css
106
- .proton-ui__theme--dark .myComponent[active] {
107
- background-color: var(--proton-control__interactive-color);
108
- }
53
+ @import "@protonradio/proton-ui/styles";
109
54
  ```
110
55
 
111
- Palettes can also be accessed in JSX via the `useTheme` hook for more advanced use cases:
112
-
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.
113
58
 
114
59
  ```jsx
115
- import { useTheme } from "@protonradio/proton-ui";
116
-
117
- function MyComponent() {
118
- const { palette } = useTheme();
60
+ import { ThemeProvider, THEMES } from "@protonradio/proton-ui";
119
61
 
120
- // Prefer CSS selectors over programmatic styling
121
- return <Icon color={palette.BRAND.PRIMARY} />;
62
+ function MyApp({ Component, pageProps }) {
63
+ return (
64
+ <ThemeProvider theme={THEMES.DARK}>
65
+ <Component {...pageProps} />
66
+ </ThemeProvider>
67
+ );
122
68
  }
123
69
  ```
124
70
 
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
71
+ ### Recommended Reading
152
72
 
153
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-DfloGKJz.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\";\r\n\r\nexport * as COLORS from \"./colors\";\r\n\r\nexport * from \"./palettes\";\r\n\r\nexport const THEMES = {\r\n DARK: \"dark\",\r\n CUSTOM_DARK: \"custom-dark\",\r\n LIGHT: \"light\",\r\n} as const;\r\n\r\nexport type Theme = (typeof THEMES)[keyof typeof THEMES];\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\r\nexport const BREAKPOINTS = {\r\n SMALL: 576,\r\n MEDIUM: 768,\r\n LARGE: 992,\r\n X_LARGE: 1200,\r\n};\r\n\r\nexport type Breakpoint = (typeof BREAKPOINTS)[keyof typeof BREAKPOINTS];\r\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,12 @@
1
1
  import { Placement } from 'react-aria';
2
2
 
3
+ declare const BRAND: {
4
+ PRIMARY: string;
5
+ PRIMARY_LIGHT: string;
6
+ PRIMARY_SUPER_LIGHT: string;
7
+ SECONDARY: string;
8
+ };
9
+
3
10
  export declare type Breakpoint = (typeof BREAKPOINTS)[keyof typeof BREAKPOINTS];
4
11
 
5
12
  export declare const BREAKPOINTS: {
@@ -9,18 +16,156 @@ export declare const BREAKPOINTS: {
9
16
  X_LARGE: number;
10
17
  };
11
18
 
19
+ export declare namespace COLORS {
20
+ export {
21
+ BRAND,
22
+ DANGER,
23
+ WARNING,
24
+ SUCCESS,
25
+ GRAYSCALE,
26
+ SECONDARY,
27
+ DARK_GRAYSCALE,
28
+ DARK_SECONDARY
29
+ }
30
+ }
31
+
32
+ declare const DANGER: {
33
+ SUPER_DARK: string;
34
+ DARK: string;
35
+ MEDIUM: string;
36
+ LIGHT: string;
37
+ SUPER_LIGHT: string;
38
+ };
39
+
40
+ declare const DARK_GRAYSCALE: {
41
+ GRAY_SUPER_DARK: string;
42
+ GRAY_DARK: string;
43
+ GRAY_MEDIUM: string;
44
+ GRAY_MEDIUM_LIGHT: string;
45
+ GRAY_LIGHT: string;
46
+ GRAY_LIGHTEST: string;
47
+ GRAY_SUPER_LIGHT: string;
48
+ WHITE: string;
49
+ BORDER: string;
50
+ ELEVATION: string;
51
+ };
52
+
53
+ export declare const DARK_MODE: Palette;
54
+
55
+ declare const DARK_SECONDARY: {
56
+ SECONDARY_SUPER_DARK: string;
57
+ SECONDARY_DARK: string;
58
+ SECONDARY_MEDIUM: string;
59
+ SECONDARY_MEDIUM_LIGHT: string;
60
+ SECONDARY_LIGHT: string;
61
+ SECONDARY_LIGHTEST: string;
62
+ SECONDARY_SUPER_LIGHT: string;
63
+ };
64
+
65
+ export declare const DEFAULT_BLACK_BACKGROUND = "#121212";
66
+
67
+ export declare const DEFAULT_WHITE_BACKGROUND = "#ffffff";
68
+
69
+ declare const GRAYSCALE: {
70
+ GRAY_SUPER_DARK: string;
71
+ GRAY_DARK: string;
72
+ GRAY_MEDIUM: string;
73
+ GRAY_MEDIUM_LIGHT: string;
74
+ GRAY_LIGHT: string;
75
+ GRAY_LIGHTEST: string;
76
+ GRAY_SUPER_LIGHT: string;
77
+ WHITE: string;
78
+ BORDER: string;
79
+ ELEVATION: string;
80
+ };
81
+
82
+ export declare const LIGHT_MODE: Palette;
83
+
84
+ export declare type Palette = {
85
+ BASE_COLOR: string;
86
+ BRAND: {
87
+ PRIMARY: string;
88
+ PRIMARY_LIGHT: string;
89
+ PRIMARY_SUPER_LIGHT: string;
90
+ SECONDARY: string;
91
+ };
92
+ PRIMARY: {
93
+ PRIMARY_SUPER_DARK: string;
94
+ PRIMARY_DARK: string;
95
+ PRIMARY_MEDIUM: string;
96
+ PRIMARY_MEDIUM_LIGHT: string;
97
+ PRIMARY_LIGHT: string;
98
+ PRIMARY_LIGHTEST: string;
99
+ PRIMARY_SUPER_LIGHT: string;
100
+ };
101
+ SECONDARY: {
102
+ SECONDARY_SUPER_DARK: string;
103
+ SECONDARY_DARK: string;
104
+ SECONDARY_MEDIUM: string;
105
+ SECONDARY_MEDIUM_LIGHT: string;
106
+ SECONDARY_LIGHT: string;
107
+ SECONDARY_LIGHTEST: string;
108
+ SECONDARY_SUPER_LIGHT: string;
109
+ };
110
+ SUCCESS: {
111
+ SUCCESS_DARK: string;
112
+ SUCCESS_MEDIUM: string;
113
+ SUCCESS_LIGHT: string;
114
+ SUCCESS_SUPER_LIGHT: string;
115
+ };
116
+ WARNING: {
117
+ WARNING_DARK: string;
118
+ WARNING_MEDIUM: string;
119
+ WARNING_LIGHT: string;
120
+ WARNING_SUPER_LIGHT: string;
121
+ };
122
+ DANGER: {
123
+ DANGER_SUPER_DARK: string;
124
+ DANGER_DARK: string;
125
+ DANGER_MEDIUM: string;
126
+ DANGER_LIGHT: string;
127
+ DANGER_SUPER_LIGHT: string;
128
+ };
129
+ };
130
+
12
131
  export declare const placements: Placement[];
13
132
 
14
- export declare type Theme = (typeof THEMES)[keyof typeof THEMES];
133
+ declare const SECONDARY: {
134
+ SUPER_DARK: string;
135
+ DARK: string;
136
+ MEDIUM: string;
137
+ MEDIUM_LIGHT: string;
138
+ LIGHT: string;
139
+ LIGHTEST: string;
140
+ SUPER_LIGHT: string;
141
+ WHITE: string;
142
+ };
15
143
 
16
- export declare const THEME_CLASSES: {
17
- dark: string;
18
- light: string;
144
+ declare const SUCCESS: {
145
+ DARK: string;
146
+ MEDIUM: string;
147
+ LIGHT: string;
148
+ SUPER_LIGHT: string;
19
149
  };
20
150
 
151
+ export declare type Theme = (typeof THEMES)[keyof typeof THEMES];
152
+
21
153
  export declare const THEMES: {
22
154
  readonly DARK: "dark";
155
+ readonly CUSTOM_DARK: "custom-dark";
23
156
  readonly LIGHT: "light";
24
157
  };
25
158
 
159
+ declare const WARNING: {
160
+ DARK: string;
161
+ MEDIUM: string;
162
+ LIGHT: string;
163
+ SUPER_LIGHT: string;
164
+ };
165
+
26
166
  export { }
167
+
168
+
169
+ declare namespace ButtonGroup {
170
+ var Option: (props: ButtonGroupOptionProps) => import("react/jsx-runtime").JSX.Element;
171
+ }
@@ -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-D006-kxf.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\";\r\n\r\nexport * as COLORS from \"./colors\";\r\n\r\nexport * from \"./palettes\";\r\n\r\nexport const THEMES = {\r\n DARK: \"dark\",\r\n CUSTOM_DARK: \"custom-dark\",\r\n LIGHT: \"light\",\r\n} as const;\r\n\r\nexport type Theme = (typeof THEMES)[keyof typeof THEMES];\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\r\nexport const BREAKPOINTS = {\r\n SMALL: 576,\r\n MEDIUM: 768,\r\n LARGE: 992,\r\n X_LARGE: 1200,\r\n};\r\n\r\nexport type Breakpoint = (typeof BREAKPOINTS)[keyof typeof BREAKPOINTS];\r\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":";"}