@protonradio/proton-ui 0.5.3 → 0.5.4

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>
@@ -111,7 +111,7 @@ export declare const BRAND: {
111
111
  SECONDARY: string;
112
112
  };
113
113
 
114
- export declare function Button({ variant, href, onPress, type, isDisabled, dataTestId, children, }: ButtonProps): JSX_2.Element;
114
+ export declare function Button({ variant, ...props }: ButtonProps): JSX_2.Element;
115
115
 
116
116
  export declare function ButtonGroup(props: ButtonGroupProps): JSX_2.Element;
117
117
 
@@ -151,36 +151,25 @@ declare interface ButtonGroupProps {
151
151
  children?: React.ReactNode;
152
152
  }
153
153
 
154
- /** Properties for the Button component
155
- * @interface ButtonProps
156
- */
157
154
  declare interface ButtonProps {
158
- /** The button's visual aesthetic
159
- * @param {ButtonVariant} variant
155
+ /**
156
+ * The button's visual aesthetic.
160
157
  */
161
158
  variant?: ButtonVariant;
162
- /** Should the button be non-interactive?
163
- * @param {boolean} isDisabled
159
+ /**
160
+ * Should the button be non-interactive?
164
161
  */
165
162
  isDisabled?: boolean;
166
- /** The URL that the button should link to. Turns the element into an `a` tag
167
- * @param {string} href
163
+ /**
164
+ * The URL that the button should link to. Turns the element into an `a` tag.
168
165
  */
169
166
  href?: string;
170
- /** Called when the button is pressed (on release, not keydown)
171
- * @param {(e: PressEvent) => void} onPress
167
+ /**
168
+ * Called when the button is pressed (on release, not keydown).
172
169
  */
173
170
  onPress?: (e: PressEvent) => void;
174
- /** The type of button
175
- * @param {"button" | "submit" | "reset"} type
176
- */
177
- type?: "button" | "submit" | "reset";
178
- /** The test ID for the button
179
- * @param {string} dataTestId
180
- */
181
- dataTestId?: string;
182
- /** The content to display within the button
183
- * @param {React.ReactNode} children
171
+ /**
172
+ * The content to display within the button.
184
173
  */
185
174
  children?: React.ReactNode;
186
175
  }
@@ -280,6 +269,69 @@ export declare type RGBArray = [number, number, number];
280
269
 
281
270
  export { Row }
282
271
 
272
+ export declare const SearchInput: default_2.FC<SearchInputProps>;
273
+
274
+ /** Properties for the SearchInput component
275
+ * @interface SearchInputProps
276
+ */
277
+ declare interface SearchInputProps {
278
+ /**
279
+ * The controlled value of the search input.
280
+ * If you provide a value, you should typically also provide an onChange handler to update it.
281
+ * @param {string} value
282
+ */
283
+ defaultValue?: string;
284
+ /**
285
+ * Should the browser's autocomplete be enabled?
286
+ * @param {boolean} autoComplete
287
+ */
288
+ autoComplete?: boolean;
289
+ /**
290
+ * The name attribute of the input element.
291
+ * @param {string} name
292
+ */
293
+ name?: string;
294
+ /**
295
+ * The placeholder text to display when the input is empty.
296
+ * @param {string} placeholder
297
+ */
298
+ placeholder?: string;
299
+ /**
300
+ * Should the clear button be shown when there is text?
301
+ * @param {boolean} isClearable
302
+ */
303
+ isClearable?: boolean;
304
+ /**
305
+ * Called when the clear button is clicked.
306
+ * @param {() => void} onClear
307
+ */
308
+ onClear?: () => void;
309
+ /**
310
+ * Called when the input value changes. Required when using the input as a controlled component.
311
+ * @param {(event: { target: { value: string } }) => void} onChange
312
+ */
313
+ onChange?: (event: {
314
+ target: {
315
+ value: string;
316
+ };
317
+ }) => void;
318
+ /**
319
+ * URL search parameter key to sync the input value with.
320
+ * @param {string} urlSearchParam
321
+ */
322
+ urlSearchParam?: string;
323
+ /**
324
+ * Error state that changes the input's visual style.
325
+ * @param {React.ReactNode | string} error
326
+ */
327
+ error?: default_2.ReactNode | string;
328
+ /**
329
+ * Test ID for the component.
330
+ * @param {string} data-testid
331
+ */
332
+ "data-testid"?: string;
333
+ }
334
+
283
335
  export { Section }
284
336
 
285
337
  export declare const Select: {