@protonradio/proton-ui 0.4.2 → 0.5.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 CHANGED
@@ -1,50 +1,50 @@
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
- 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.
26
-
27
- ```jsx
28
- function MyApp({ Component, pageProps }) {
29
- return (
30
- <ThemeProvider theme={THEMES.DARK}>
31
- <Component {...pageProps} />
32
- </ThemeProvider>
33
- );
34
- }
35
- ```
36
-
37
- #### Styling for a theme
38
-
39
- 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.
40
-
41
- For example, to apply a style to the dark theme, you can use the following css.
42
- ```css
43
- .proton-ui__theme--dark .myComponent {
44
- background-color: red;
45
- }
46
- ```
47
-
48
- ### Recommended Reading
49
-
50
- - 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
+ 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.
26
+
27
+ ```jsx
28
+ function MyApp({ Component, pageProps }) {
29
+ return (
30
+ <ThemeProvider theme={THEMES.DARK}>
31
+ <Component {...pageProps} />
32
+ </ThemeProvider>
33
+ );
34
+ }
35
+ ```
36
+
37
+ #### Styling for a theme
38
+
39
+ 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.
40
+
41
+ For example, to apply a style to the dark theme, you can use the following css.
42
+ ```css
43
+ .proton-ui__theme--dark .myComponent {
44
+ background-color: red;
45
+ }
46
+ ```
47
+
48
+ ### Recommended Reading
49
+
50
+ - https://www.gabe.pizza/notes-on-component-libraries/
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>
@@ -35,14 +35,7 @@ export declare interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>
35
35
 
36
36
  export declare type BadgeVariant = "primary" | "secondary" | "transparent" | "success" | "warning" | "danger";
37
37
 
38
- export declare const BadgeVariants: {
39
- readonly primary: "primary";
40
- readonly secondary: "secondary";
41
- readonly transparent: "transparent";
42
- readonly success: "success";
43
- readonly warning: "warning";
44
- readonly danger: "danger";
45
- };
38
+ export declare const BadgeVariants: Record<BadgeVariant, BadgeVariant>;
46
39
 
47
40
  export declare const Banner: {
48
41
  ({ variant, rounded, icon, compact, children, ...props }: BannerProps): JSX_2.Element;
@@ -171,10 +164,6 @@ declare interface ButtonProps {
171
164
  * The URL that the button should link to. Turns the element into an `a` tag.
172
165
  */
173
166
  href?: string;
174
- /**
175
- * Should the button show an external link icon?
176
- */
177
- external?: boolean;
178
167
  /**
179
168
  * Called when the button is pressed (on release, not keydown).
180
169
  */
@@ -185,7 +174,7 @@ declare interface ButtonProps {
185
174
  children?: React.ReactNode;
186
175
  }
187
176
 
188
- export declare type ButtonVariant = "primary" | "secondary" | "danger" | "translucent";
177
+ export declare type ButtonVariant = "primary" | "secondary" | "success" | "danger" | "translucent";
189
178
 
190
179
  export declare const Cell: <T>(props: ProtonColumnProps<T>) => JSX.Element;
191
180
 
@@ -339,19 +328,25 @@ export { TableHeader }
339
328
 
340
329
  declare type TableProps = AriaTableProps & TableStateProps<object>;
341
330
 
342
- export declare const TextEmphasis: {
343
- ({ to, children, ...props }: TextEmphasisProps): JSX_2.Element;
344
- Tooltip: ({ to, children, tooltipProps, ...props }: TextEmphasisTooltipProps) => JSX_2.Element;
345
- };
331
+ export declare const TextEmphasis: ({ to, children, tooltipProps, "data-testid": testId, }: TextEmphasisProps) => JSX_2.Element;
346
332
 
347
333
  declare interface TextEmphasisProps extends React.HTMLAttributes<HTMLSpanElement> {
334
+ /**
335
+ * The URL that the text emphasis should link to. Turns the element into an `a` tag.
336
+ */
348
337
  to?: string;
349
- onClick?: () => void;
338
+ /**
339
+ * The content to display within the text emphasis.
340
+ */
350
341
  children: ReactNode;
351
- }
352
-
353
- declare interface TextEmphasisTooltipProps extends TextEmphasisProps {
342
+ /**
343
+ * Props to pass to the tooltip trigger. When provided, the text emphasis will be wrapped in a tooltip trigger.
344
+ */
354
345
  tooltipProps?: Omit<TooltipTriggerProps, "children">;
346
+ /**
347
+ * A test ID.
348
+ */
349
+ "data-testid"?: string;
355
350
  }
356
351
 
357
352
  export declare type Theme = (typeof THEMES)[keyof typeof THEMES];
@@ -437,4 +432,3 @@ export { }
437
432
  declare namespace ButtonGroup {
438
433
  var Option: (props: ButtonGroupOptionProps) => import("react/jsx-runtime").JSX.Element;
439
434
  }
440
-