@marigold/components 0.5.0 → 0.7.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;
@@ -82,12 +61,13 @@ interface CardProps extends ComponentProps<'div'> {
82
61
  }
83
62
  declare const Card: React.FC<CardProps>;
84
63
 
85
- declare type CheckboxIconProps = {
64
+ 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
 
92
72
  interface CheckboxThemeExtension<Value> {
93
73
  checkbox?: {
@@ -146,9 +126,9 @@ declare type LabelBaseProps = {
146
126
  color?: ResponsiveStyleValue<string>;
147
127
  } & ComponentProps<'label'>;
148
128
  declare const LabelBase: React.FC<LabelProps>;
149
- declare type LabelProps = {
129
+ interface LabelProps extends LabelBaseProps {
150
130
  required?: boolean;
151
- } & LabelBaseProps;
131
+ }
152
132
  declare const Label: React.FC<LabelProps>;
153
133
 
154
134
  interface TextThemeExtension<Value> {
@@ -212,12 +192,12 @@ interface MessageProps extends ComponentProps<'div'> {
212
192
  }
213
193
  declare const Message: React.FC<MessageProps>;
214
194
 
215
- declare type RadioIconProps = {
195
+ interface RadioIconProps {
216
196
  variant?: string;
217
197
  checked?: boolean;
218
198
  disabled?: boolean;
219
199
  error?: boolean;
220
- };
200
+ }
221
201
 
222
202
  interface RadioThemeExtension<Value> {
223
203
  radio?: {
@@ -267,6 +247,18 @@ interface SliderProps extends ComponentProps<'input'> {
267
247
  }
268
248
  declare const Slider: React.FC<SliderProps>;
269
249
 
250
+ interface SwitchThemeExtension<Value> {
251
+ switch?: {
252
+ [key: string]: Value;
253
+ };
254
+ }
255
+ declare type SwitchProps = {
256
+ variant?: string;
257
+ labelVariant?: string;
258
+ disabled?: boolean;
259
+ } & AriaSwitchProps & ToggleProps & ComponentProps<'input'>;
260
+ declare const Switch: React.FC<SwitchProps>;
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,6 +306,26 @@ interface ActionGroupProps extends ComponentProps<'div'> {
299
306
  }
300
307
  declare const ActionGroup: React.FC<ActionGroupProps>;
301
308
 
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
+
302
329
  declare type WidthValues = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
303
330
  interface ColumnProps {
304
331
  className?: string;
@@ -314,10 +341,10 @@ interface ColumnsProps {
314
341
  }
315
342
  declare const Columns: React.FC<ColumnsProps>;
316
343
 
317
- declare type ModalDialogProps = {
344
+ interface ModalDialogProps extends OverlayProps, AriaDialogProps {
318
345
  variant?: string;
319
346
  backdropVariant?: string;
320
- } & OverlayProps & AriaDialogProps;
347
+ }
321
348
 
322
349
  interface DialogProps extends ModalDialogProps, ComponentProps<'div'> {
323
350
  backdropVariant?: string;
@@ -355,8 +382,17 @@ interface StackProps {
355
382
  }
356
383
  declare const Stack: React.FC<StackProps>;
357
384
 
385
+ interface TilesProps {
386
+ space?: ResponsiveStyleValue<string>;
387
+ itemMinWidth?: ResponsiveStyleValue<string>;
388
+ }
389
+ declare const Tiles: React.FC<TilesProps>;
390
+
358
391
  interface ContainerProps extends ComponentProps<'div'> {
392
+ contentType?: 'content' | 'header';
393
+ size?: keyof typeof size.content | keyof typeof size.header;
394
+ align?: 'left' | 'right' | 'center';
359
395
  }
360
396
  declare const Container: React.FC<ContainerProps>;
361
397
 
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 };
398
+ export { ActionGroup, ActionGroupProps, Aside, AsideProps, Aspect, AspectProps, 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, Switch, SwitchProps, SwitchThemeExtension, Text, TextOwnProps, TextProps, TextThemeExtension, Textarea, TextareaProps, TextareaThemeExtension, Theme, Tiles, TilesProps, Tooltip, TooltipContext, TooltipProps, TooltipThemeExtension, TooltipTrigger, ValidationMessage, ValidationMessageProps, ValidationMessageThemeExtension, useDialogButtonProps };