@protonradio/proton-ui 0.1.39 → 0.1.40

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
@@ -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/
@@ -1,8 +1,9 @@
1
+ import type { AriaDialogProps } from 'react-aria';
1
2
  import type { AriaPopoverProps } from 'react-aria';
2
- import { AriaSelectOptions } from 'react-aria';
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 type { OverlayTriggerState } from 'react-stately';
6
+ import { OverlayTriggerState } from 'react-stately';
6
7
  import { PressEvent } from 'react-aria';
7
8
  import { default as React_2 } from 'react';
8
9
  import { Row } from '@react-stately/table';
@@ -87,6 +88,16 @@ export declare const Cell: <T>(props: ProtonColumnProps<T>) => JSX_2.Element;
87
88
 
88
89
  export declare const Column: <T>(props: ProtonColumnProps<T>) => JSX_2.Element;
89
90
 
91
+ /**
92
+ * Intended use in overlay containers such as modals or popovers.
93
+ */
94
+ export declare function Dialog({ title, children, ...props }: DialogProps): JSX_2.Element;
95
+
96
+ declare interface DialogProps extends AriaDialogProps {
97
+ title?: React.ReactNode;
98
+ children: React.ReactNode;
99
+ }
100
+
90
101
  export declare function Icon(props: IconProps): JSX_2.Element;
91
102
 
92
103
  declare type IconID = "external-link" | "caret-down" | "chevron-down";
@@ -106,13 +117,29 @@ declare interface IconProps {
106
117
  color?: string;
107
118
  }
108
119
 
109
- export declare function Popover({ children, state, ...props }: PopoverProps): JSX_2.Element;
120
+ export declare function Popover({ children, state, arrow, offset, ...props }: PopoverProps): JSX_2.Element;
110
121
 
122
+ /**
123
+ * Popover is an unstyled popover component that handles positioning. It should be used
124
+ * with the Dialog component to provide a styled popover.
125
+ */
111
126
  declare interface PopoverProps extends Omit<AriaPopoverProps, "popoverRef"> {
127
+ /**
128
+ * Content to display within the popover.
129
+ */
112
130
  children: React_2.ReactNode;
113
- __INTERNAL_ONLY_className?: string;
131
+ /**
132
+ * The `isOpen` state of the popover and the methods to toggle it.
133
+ */
114
134
  state: OverlayTriggerState;
135
+ /**
136
+ * Can optionally forward the ref to the popover.
137
+ */
115
138
  popoverRef?: React_2.RefObject<HTMLDivElement>;
139
+ /**
140
+ * Whether to show an arrow on the popover.
141
+ */
142
+ arrow?: boolean;
116
143
  }
117
144
 
118
145
  export declare interface ProtonColumnProps<T> extends ColumnProps<T> {
@@ -130,10 +157,9 @@ export declare const Select: {
130
157
 
131
158
  declare function SelectMenu<T extends object>(props: SelectProps<T>): JSX_2.Element;
132
159
 
133
- declare interface SelectProps<T> extends Omit<AriaSelectOptions<T>, "children"> {
160
+ declare interface SelectProps<T> extends AriaSelectProps<T> {
134
161
  label?: string;
135
162
  name: string;
136
- children: React_2.ReactNode | ((item: T) => React_2.ReactNode);
137
163
  }
138
164
 
139
165
  export declare function Switch(props: SwitchProps): JSX_2.Element;