@marigold/components 0.5.1 → 0.8.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Marigold UI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.ts CHANGED
@@ -1,17 +1,21 @@
1
1
  import { Theme as Theme$1, ThemeProviderProps, BoxOwnProps, ResponsiveStyleValue, CSSObject } from '@marigold/system';
2
2
  export { Box, BoxOwnProps, BoxProps, StyleProps, ThemeProvider, useTheme } from '@marigold/system';
3
- import React from 'react';
4
- import { ComponentProps, PolymorphicPropsWithRef, PolymorphicComponentWithRef, PolymorphicProps, PolymorphicComponent } from '@marigold/types';
3
+ import React, { ReactChild } from 'react';
4
+ import { ComponentProps, PolymorphicPropsWithRef, PolymorphicComponentWithRef, PolymorphicProps, PolymorphicComponent, NonZeroPercentage } from '@marigold/types';
5
5
  import { ToggleProps } from '@react-types/checkbox';
6
6
  import { SeparatorProps } from '@react-aria/separator';
7
7
  import { AriaSelectProps } from '@react-types/select';
8
8
  import { SingleSelection } from '@react-types/shared';
9
+ import { AriaSwitchProps } from '@react-types/switch';
9
10
  import { AriaTextFieldProps } from '@react-types/textfield';
11
+ import { TooltipTriggerProps } from '@react-types/tooltip';
12
+ import { aspect, size } from '@marigold/tokens';
10
13
  import * as _react_stately_overlays from '@react-stately/overlays';
11
14
  import { OverlayProps } from '@react-aria/overlays';
12
15
  import { AriaDialogProps } from '@react-types/dialog';
13
16
  export { VisuallyHidden } from '@react-aria/visually-hidden';
14
17
  export { SSRProvider } from '@react-aria/ssr';
18
+ import { TooltipTriggerState } from '@react-stately/tooltip';
15
19
  export { Item, Section } from '@react-stately/collections';
16
20
 
17
21
  interface RootThemeExtension<Value> {
@@ -24,31 +28,6 @@ interface MarigoldProviderProps<T extends Theme$1> extends ThemeProviderProps<T>
24
28
  }
25
29
  declare function MarigoldProvider<T extends Theme$1>({ theme, children, }: MarigoldProviderProps<T>): JSX.Element;
26
30
 
27
- declare const ICON_MAP: {
28
- readonly success: ({ className, ...props }: {
29
- [x: string]: any;
30
- className?: string | undefined;
31
- }) => JSX.Element;
32
- readonly warning: ({ className, ...props }: {
33
- [x: string]: any;
34
- className?: string | undefined;
35
- }) => JSX.Element;
36
- readonly error: ({ className, ...props }: {
37
- [x: string]: any;
38
- className?: string | undefined;
39
- }) => JSX.Element;
40
- };
41
- declare type AlertVariants = keyof typeof ICON_MAP;
42
- interface AlertThemeExtension<Value> {
43
- alert?: {
44
- [key in AlertVariants]?: Value;
45
- };
46
- }
47
- interface AlertProps extends ComponentProps<'div'> {
48
- variant?: AlertVariants;
49
- }
50
- declare const Alert: React.FC<AlertProps>;
51
-
52
31
  interface BadgeThemeExtension<Value> {
53
32
  badge?: {
54
33
  [key: string]: Value;
@@ -86,6 +65,7 @@ interface CheckboxIconProps {
86
65
  variant?: string;
87
66
  checked?: boolean;
88
67
  disabled?: boolean;
68
+ indeterminated?: boolean;
89
69
  error?: boolean;
90
70
  }
91
71
 
@@ -151,27 +131,10 @@ interface LabelProps extends LabelBaseProps {
151
131
  }
152
132
  declare const Label: React.FC<LabelProps>;
153
133
 
154
- interface TextThemeExtension<Value> {
155
- text?: {
156
- [key: string]: Value;
157
- };
158
- }
159
- interface TextOwnProps extends BoxOwnProps {
160
- align?: ResponsiveStyleValue<string>;
161
- color?: ResponsiveStyleValue<string>;
162
- cursor?: ResponsiveStyleValue<string>;
163
- size?: ResponsiveStyleValue<keyof Theme$1['fontSizes'] | string>;
164
- outline?: ResponsiveStyleValue<string>;
165
- userSelect?: ResponsiveStyleValue<string>;
166
- }
167
- interface TextProps extends PolymorphicPropsWithRef<TextOwnProps, 'span'> {
168
- }
169
- declare const Text: PolymorphicComponentWithRef<TextOwnProps, 'span'>;
170
-
171
134
  interface LinkThemeExtension<Value> {
172
135
  link?: Value;
173
136
  }
174
- interface LinkOwnProps extends TextOwnProps {
137
+ interface LinkOwnProps extends BoxOwnProps {
175
138
  disabled?: boolean;
176
139
  }
177
140
  interface LinkProps extends PolymorphicProps<LinkOwnProps, 'a'> {
@@ -267,6 +230,35 @@ interface SliderProps extends ComponentProps<'input'> {
267
230
  }
268
231
  declare const Slider: React.FC<SliderProps>;
269
232
 
233
+ interface SwitchThemeExtension<Value> {
234
+ switch?: {
235
+ [key: string]: Value;
236
+ };
237
+ }
238
+ declare type SwitchProps = {
239
+ variant?: string;
240
+ labelVariant?: string;
241
+ disabled?: boolean;
242
+ } & AriaSwitchProps & ToggleProps & ComponentProps<'input'>;
243
+ declare const Switch: React.FC<SwitchProps>;
244
+
245
+ interface TextThemeExtension<Value> {
246
+ text?: {
247
+ [key: string]: Value;
248
+ };
249
+ }
250
+ interface TextOwnProps extends BoxOwnProps {
251
+ align?: ResponsiveStyleValue<string>;
252
+ color?: ResponsiveStyleValue<string>;
253
+ cursor?: ResponsiveStyleValue<string>;
254
+ size?: ResponsiveStyleValue<keyof Theme$1['fontSizes'] | string>;
255
+ outline?: ResponsiveStyleValue<string>;
256
+ userSelect?: ResponsiveStyleValue<string>;
257
+ }
258
+ interface TextProps extends PolymorphicPropsWithRef<TextOwnProps, 'span'> {
259
+ }
260
+ declare const Text: PolymorphicComponentWithRef<TextOwnProps, 'span'>;
261
+
270
262
  interface TextareaThemeExtension<Value> {
271
263
  textarea?: {
272
264
  [key: string]: Value;
@@ -280,6 +272,21 @@ declare type TextareaProps = {
280
272
  } & AriaTextFieldProps & ComponentProps<'textarea'>;
281
273
  declare const Textarea: React.FC<TextareaProps>;
282
274
 
275
+ interface TooltipThemeExtension<Value> {
276
+ tooltip?: {
277
+ [key: string]: Value;
278
+ };
279
+ }
280
+ interface TooltipProps extends TooltipTriggerProps {
281
+ variant?: string;
282
+ }
283
+ declare const Tooltip: React.FC<TooltipProps>;
284
+
285
+ declare const TooltipContext: React.Context<{
286
+ state?: TooltipTriggerState | undefined;
287
+ }>;
288
+ declare const TooltipTrigger: React.FC;
289
+
283
290
  interface ValidationMessageThemeExtension<Value> {
284
291
  validation?: {
285
292
  [key: string]: Value;
@@ -290,7 +297,7 @@ interface ValidationMessageProps extends ComponentProps<'span'> {
290
297
  }
291
298
  declare const ValidationMessage: React.FC<ValidationMessageProps>;
292
299
 
293
- interface Theme extends Theme$1, RootThemeExtension<CSSObject>, AlertThemeExtension<CSSObject>, BadgeThemeExtension<CSSObject>, ButtonThemeExtension<CSSObject>, CardThemeExtension<CSSObject>, CheckboxThemeExtension<CSSObject>, DividerThemeExtension<CSSObject>, ImageThemeExtension<CSSObject>, InputThemeExtension<CSSObject>, LabelThemeExtension<CSSObject>, LinkThemeExtension<CSSObject>, MenuThemeExtension<CSSObject>, MenuItemThemeExtension<CSSObject>, MessageThemeExtension<CSSObject>, RadioThemeExtension<CSSObject>, SelectThemeExtension<CSSObject>, SliderThemeExtension<CSSObject>, TextThemeExtension<CSSObject>, TextareaThemeExtension<CSSObject>, ValidationMessageThemeExtension<CSSObject> {
300
+ interface Theme extends Theme$1, RootThemeExtension<CSSObject>, BadgeThemeExtension<CSSObject>, ButtonThemeExtension<CSSObject>, CardThemeExtension<CSSObject>, CheckboxThemeExtension<CSSObject>, DividerThemeExtension<CSSObject>, ImageThemeExtension<CSSObject>, InputThemeExtension<CSSObject>, LabelThemeExtension<CSSObject>, LinkThemeExtension<CSSObject>, MenuThemeExtension<CSSObject>, MenuItemThemeExtension<CSSObject>, MessageThemeExtension<CSSObject>, RadioThemeExtension<CSSObject>, SelectThemeExtension<CSSObject>, SliderThemeExtension<CSSObject>, SwitchThemeExtension<CSSObject>, TextThemeExtension<CSSObject>, TextareaThemeExtension<CSSObject>, TooltipThemeExtension<CSSObject>, ValidationMessageThemeExtension<CSSObject> {
294
301
  }
295
302
 
296
303
  interface ActionGroupProps extends ComponentProps<'div'> {
@@ -299,18 +306,43 @@ interface ActionGroupProps extends ComponentProps<'div'> {
299
306
  }
300
307
  declare const ActionGroup: React.FC<ActionGroupProps>;
301
308
 
302
- declare type WidthValues = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
303
- interface ColumnProps {
304
- className?: string;
305
- width?: WidthValues | WidthValues[];
309
+ interface AsideProps {
310
+ children: [ReactChild, ReactChild];
311
+ side?: 'left' | 'right';
312
+ sideWidth?: ResponsiveStyleValue<string>;
313
+ space?: ResponsiveStyleValue<string>;
314
+ stretch?: boolean;
315
+ wrap?: NonZeroPercentage;
316
+ }
317
+ declare const Aside: ({ children, sideWidth, space, side, stretch, wrap, }: AsideProps) => JSX.Element;
318
+
319
+ /**
320
+ * Based on https://theme-ui.com/components/aspect-ratio
321
+ */
322
+
323
+ interface AspectProps extends ComponentProps<'div'> {
324
+ ratio?: keyof typeof aspect;
325
+ maxWidth?: string;
326
+ }
327
+ declare const Aspect: React.FC<AspectProps>;
328
+
329
+ interface BreakoutProps extends ComponentProps<'div'> {
330
+ horizontalAlign?: 'top' | 'bottom' | 'center';
331
+ verticalAlign?: 'left' | 'right' | 'center';
306
332
  }
307
- declare const Column: React.FC<ColumnProps>;
333
+ declare const Breakout: React.FC<BreakoutProps>;
334
+
335
+ interface CenterProps extends ComponentProps<'div'> {
336
+ maxWidth?: string;
337
+ space?: ResponsiveStyleValue<string>;
338
+ }
339
+ declare const Center: React.FC<CenterProps>;
308
340
 
309
341
  interface ColumnsProps {
310
- className?: string;
342
+ columns: Array<number>;
311
343
  space?: ResponsiveStyleValue<string>;
312
- horizontalAlign?: 'left' | 'right' | 'center';
313
- verticalAlign?: 'top' | 'bottom' | 'center';
344
+ columnLimit?: number;
345
+ collapseAt?: string;
314
346
  }
315
347
  declare const Columns: React.FC<ColumnsProps>;
316
348
 
@@ -350,13 +382,24 @@ interface InlineProps {
350
382
  declare const Inline: React.FC<InlineProps>;
351
383
 
352
384
  interface StackProps {
385
+ as?: 'div' | 'ul' | 'ol';
353
386
  space?: ResponsiveStyleValue<string>;
354
387
  align?: 'left' | 'right' | 'center';
355
388
  }
356
389
  declare const Stack: React.FC<StackProps>;
357
390
 
391
+ interface TilesProps {
392
+ space?: ResponsiveStyleValue<string>;
393
+ itemMinWidth?: ResponsiveStyleValue<string>;
394
+ }
395
+ declare const Tiles: React.FC<TilesProps>;
396
+
358
397
  interface ContainerProps extends ComponentProps<'div'> {
398
+ contentType?: 'content' | 'header';
399
+ size?: keyof typeof size.content | keyof typeof size.header;
400
+ align?: 'left' | 'right' | 'center';
401
+ alignContainer?: 'left' | 'right' | 'center';
359
402
  }
360
403
  declare const Container: React.FC<ContainerProps>;
361
404
 
362
- export { ActionGroup, ActionGroupProps, Alert, AlertProps, AlertThemeExtension, AlertVariants, Badge, BadgeProps, BadgeThemeExtension, Button, ButtonProps, ButtonThemeExtension, Card, CardProps, CardThemeExtension, Checkbox, CheckboxProps, CheckboxThemeExtension, Column, ColumnProps, Columns, ColumnsProps, Container, ContainerProps, Dialog, DialogProps, Divider, DividerProps, DividerThemeExtension, Field, FieldProps, Image, ImageProps, ImageThemeExtension, Inline, InlineProps, Input, InputProps, InputThemeExtension, Label, LabelBase, LabelBaseProps, LabelProps, LabelThemeExtension, Link, LinkOwnProps, LinkProps, LinkThemeExtension, MarigoldProvider, MarigoldProviderProps, Menu, MenuItem, MenuItemProps, MenuItemThemeExtension, MenuProps, MenuThemeExtension, Message, MessageProps, MessageThemeExtension, Radio, RadioProps, RadioThemeExtension, RootThemeExtension, Select, SelectProps, SelectThemeExtension, Slider, SliderProps, SliderThemeExtension, Stack, StackProps, Text, TextOwnProps, TextProps, TextThemeExtension, Textarea, TextareaProps, TextareaThemeExtension, Theme, ValidationMessage, ValidationMessageProps, ValidationMessageThemeExtension, useDialogButtonProps };
405
+ export { ActionGroup, ActionGroupProps, Aside, AsideProps, Aspect, AspectProps, Badge, BadgeProps, BadgeThemeExtension, Breakout, BreakoutProps, Button, ButtonProps, ButtonThemeExtension, Card, CardProps, CardThemeExtension, Center, CenterProps, Checkbox, CheckboxProps, CheckboxThemeExtension, Columns, ColumnsProps, Container, ContainerProps, Dialog, DialogProps, Divider, DividerProps, DividerThemeExtension, Field, FieldProps, Image, ImageProps, ImageThemeExtension, Inline, InlineProps, Input, InputProps, InputThemeExtension, Label, LabelBase, LabelBaseProps, LabelProps, LabelThemeExtension, Link, LinkOwnProps, LinkProps, LinkThemeExtension, MarigoldProvider, MarigoldProviderProps, Menu, MenuItem, MenuItemProps, MenuItemThemeExtension, MenuProps, MenuThemeExtension, Message, MessageProps, MessageThemeExtension, Radio, RadioProps, RadioThemeExtension, RootThemeExtension, Select, SelectProps, SelectThemeExtension, Slider, SliderProps, SliderThemeExtension, Stack, StackProps, Switch, SwitchProps, SwitchThemeExtension, Text, TextOwnProps, TextProps, TextThemeExtension, Textarea, TextareaProps, TextareaThemeExtension, Theme, Tiles, TilesProps, Tooltip, TooltipContext, TooltipProps, TooltipThemeExtension, TooltipTrigger, ValidationMessage, ValidationMessageProps, ValidationMessageThemeExtension, useDialogButtonProps };