@protonradio/proton-ui 0.1.39 → 0.1.41
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 +16 -0
- package/dist/proton-ui.es.d.ts +44 -6
- package/dist/proton-ui.es.js +1512 -1434
- package/dist/proton-ui.es.js.map +1 -1
- package/dist/proton-ui.umd.js +10 -10
- package/dist/proton-ui.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,5 +44,21 @@ Theme specific css should be placed in the `src/themes` directory in a unqiue fi
|
|
|
44
44
|
}
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
+
#### Overriding CSS Variables
|
|
48
|
+
Components reuse common colors across components and, in an attempt to unify these colors under common variables, common component attributes have been defined in globals.css and can be overridden at the theme level (ex: src/themes/release-links/index.css`.
|
|
49
|
+
|
|
50
|
+
These should be used where possible so that if we decide to change styling accross the component library we can do so in just a few places.
|
|
51
|
+
|
|
52
|
+
This also makes it easier for overriding some component styles from within a project to something more dynamic. In the case of the `ReleaseLinks` app, we calculate some background colors from the album artwork. Because of this we want to override the background color of certain elements in the `ReleaseLinks` theme with a css variable.
|
|
53
|
+
|
|
54
|
+
An example of this might look like:
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
document.documentElement.style.setProperty(
|
|
58
|
+
"--proton-control-background",
|
|
59
|
+
buttonBackgroundColor
|
|
60
|
+
);
|
|
61
|
+
```
|
|
62
|
+
|
|
47
63
|
### Recommended Reading
|
|
48
64
|
- https://www.gabe.pizza/notes-on-component-libraries/
|
package/dist/proton-ui.es.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { AriaDialogProps } from 'react-aria';
|
|
1
2
|
import type { AriaPopoverProps } from 'react-aria';
|
|
2
|
-
import {
|
|
3
|
+
import { AriaSelectProps } from 'react-aria';
|
|
3
4
|
import { ColumnProps } from '@react-stately/table';
|
|
4
5
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
5
|
-
import
|
|
6
|
+
import { OverlayTriggerProps } from 'react-stately';
|
|
7
|
+
import { OverlayTriggerState } from 'react-stately';
|
|
6
8
|
import { PressEvent } from 'react-aria';
|
|
7
9
|
import { default as React_2 } from 'react';
|
|
8
10
|
import { Row } from '@react-stately/table';
|
|
@@ -87,6 +89,16 @@ export declare const Cell: <T>(props: ProtonColumnProps<T>) => JSX_2.Element;
|
|
|
87
89
|
|
|
88
90
|
export declare const Column: <T>(props: ProtonColumnProps<T>) => JSX_2.Element;
|
|
89
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Intended use in overlay containers such as modals or popovers.
|
|
94
|
+
*/
|
|
95
|
+
export declare function Dialog({ title, children, ...props }: DialogProps): JSX_2.Element;
|
|
96
|
+
|
|
97
|
+
declare interface DialogProps extends AriaDialogProps {
|
|
98
|
+
title?: React.ReactNode;
|
|
99
|
+
children: React.ReactNode;
|
|
100
|
+
}
|
|
101
|
+
|
|
90
102
|
export declare function Icon(props: IconProps): JSX_2.Element;
|
|
91
103
|
|
|
92
104
|
declare type IconID = "external-link" | "caret-down" | "chevron-down";
|
|
@@ -106,13 +118,29 @@ declare interface IconProps {
|
|
|
106
118
|
color?: string;
|
|
107
119
|
}
|
|
108
120
|
|
|
109
|
-
export declare function Popover({ children, state, ...props }: PopoverProps): JSX_2.Element;
|
|
121
|
+
export declare function Popover({ children, state, arrow, offset, ...props }: PopoverProps): JSX_2.Element;
|
|
110
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Popover is an unstyled popover component that handles positioning. It should be used
|
|
125
|
+
* with the Dialog component to provide a styled popover.
|
|
126
|
+
*/
|
|
111
127
|
declare interface PopoverProps extends Omit<AriaPopoverProps, "popoverRef"> {
|
|
128
|
+
/**
|
|
129
|
+
* Content to display within the popover.
|
|
130
|
+
*/
|
|
112
131
|
children: React_2.ReactNode;
|
|
113
|
-
|
|
132
|
+
/**
|
|
133
|
+
* The `isOpen` state of the popover and the methods to toggle it.
|
|
134
|
+
*/
|
|
114
135
|
state: OverlayTriggerState;
|
|
136
|
+
/**
|
|
137
|
+
* Can optionally forward the ref to the popover.
|
|
138
|
+
*/
|
|
115
139
|
popoverRef?: React_2.RefObject<HTMLDivElement>;
|
|
140
|
+
/**
|
|
141
|
+
* Whether to show an arrow on the popover.
|
|
142
|
+
*/
|
|
143
|
+
arrow?: boolean;
|
|
116
144
|
}
|
|
117
145
|
|
|
118
146
|
export declare interface ProtonColumnProps<T> extends ColumnProps<T> {
|
|
@@ -130,10 +158,9 @@ export declare const Select: {
|
|
|
130
158
|
|
|
131
159
|
declare function SelectMenu<T extends object>(props: SelectProps<T>): JSX_2.Element;
|
|
132
160
|
|
|
133
|
-
declare interface SelectProps<T> extends
|
|
161
|
+
declare interface SelectProps<T> extends AriaSelectProps<T> {
|
|
134
162
|
label?: string;
|
|
135
163
|
name: string;
|
|
136
|
-
children: React_2.ReactNode | ((item: T) => React_2.ReactNode);
|
|
137
164
|
}
|
|
138
165
|
|
|
139
166
|
export declare function Switch(props: SwitchProps): JSX_2.Element;
|
|
@@ -184,4 +211,15 @@ export declare const THEME_CONFIG: {
|
|
|
184
211
|
readonly ProtonRadio: "client-theme";
|
|
185
212
|
};
|
|
186
213
|
|
|
214
|
+
/**
|
|
215
|
+
* Hook for creating a popover trigger. This hook manages the state and events for the popover
|
|
216
|
+
* and popover trigger. For examples see Popover.stories.tsx.
|
|
217
|
+
*/
|
|
218
|
+
export declare function usePopoverTrigger(props?: OverlayTriggerProps): {
|
|
219
|
+
buttonProps: any;
|
|
220
|
+
overlayProps: any;
|
|
221
|
+
buttonRef: React_2.MutableRefObject<HTMLButtonElement>;
|
|
222
|
+
state: any;
|
|
223
|
+
};
|
|
224
|
+
|
|
187
225
|
export { }
|