@flodesk/grain 11.42.1 → 11.43.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.
@@ -0,0 +1,18 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import * as React from 'react';
4
+ import { jsx as ___EmotionJSX } from "@emotion/react";
5
+
6
+ const IconQr = props => ___EmotionJSX("svg", _extends({
7
+ viewBox: "0 0 32 36",
8
+ fill: "none",
9
+ xmlns: "http://www.w3.org/2000/svg"
10
+ }, props), ___EmotionJSX("path", {
11
+ fill: "currentColor",
12
+ fillRule: "evenodd",
13
+ d: "M11 6.5A1.5 1.5 0 0 0 9.5 5h-5A1.5 1.5 0 0 0 3 6.5v5A1.5 1.5 0 0 0 4.5 13h5a1.5 1.5 0 0 0 1.5-1.5zM9.5 2A4.5 4.5 0 0 1 14 6.5v5A4.5 4.5 0 0 1 9.5 16h-5A4.5 4.5 0 0 1 0 11.5v-5A4.5 4.5 0 0 1 4.5 2zM18 23v-2a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1m11 1a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2m-6 2v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1m-5 7v-2a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1m10 0a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1zM9.5 23a1.5 1.5 0 0 1 1.5 1.5v5A1.5 1.5 0 0 1 9.5 31h-5A1.5 1.5 0 0 1 3 29.5v-5A1.5 1.5 0 0 1 4.5 23zm4.5 1.5A4.5 4.5 0 0 0 9.5 20h-5A4.5 4.5 0 0 0 0 24.5v5A4.5 4.5 0 0 0 4.5 34h5a4.5 4.5 0 0 0 4.5-4.5zm15-18A1.5 1.5 0 0 0 27.5 5h-5A1.5 1.5 0 0 0 21 6.5v5a1.5 1.5 0 0 0 1.5 1.5h5a1.5 1.5 0 0 0 1.5-1.5zM27.5 2A4.5 4.5 0 0 1 32 6.5v5a4.5 4.5 0 0 1-4.5 4.5h-5a4.5 4.5 0 0 1-4.5-4.5v-5A4.5 4.5 0 0 1 22.5 2z",
14
+ clipRule: "evenodd"
15
+ }));
16
+
17
+ IconQr.viewBoxWidth = 32;
18
+ export default IconQr;
package/es/icons/index.js CHANGED
@@ -94,4 +94,5 @@ export { default as IconApple } from './icon-apple';
94
94
  export { default as IconBall } from './icon-ball';
95
95
  export { default as IconCar } from './icon-car';
96
96
  export { default as IconSymbols } from './icon-symbols';
97
- export { default as IconFlag } from './icon-flag';
97
+ export { default as IconFlag } from './icon-flag';
98
+ export { default as IconQr } from './icon-qr';
@@ -2,7 +2,7 @@ import type { FC } from 'react';
2
2
  import { BoxProps } from './box';
3
3
  import { DimensionPropType, AlignmentType, DirectionType } from '../shared';
4
4
 
5
- export interface ArrangeProps extends BoxProps {
5
+ export interface ArrangeProps extends Omit<BoxProps, 'rows'> {
6
6
  gap?: DimensionPropType;
7
7
  columnGap?: DimensionPropType;
8
8
  rowGap?: DimensionPropType;
@@ -1,5 +1,5 @@
1
1
  import type { FC } from 'react';
2
- import { ColorPropType } from '../shared';
2
+ import { ColorPropType, ComponentBaseProps } from '../shared';
3
3
  import { MenuPlacement } from '../foundational/menu';
4
4
 
5
5
  export interface Autocomplete2Option {
@@ -15,7 +15,7 @@ export interface Autocomplete2Option {
15
15
  isDisabled?: boolean;
16
16
  }
17
17
 
18
- export interface Autocomplete2Props {
18
+ export interface Autocomplete2Props extends Omit<ComponentBaseProps, 'onChange' | 'label'> {
19
19
  children?: React.ReactNode;
20
20
  options: Autocomplete2Option[];
21
21
  value?: string;
@@ -1,4 +1,4 @@
1
- import type { FC, DOMAttributes, PropsWithChildren, RefAttributes } from 'react';
1
+ import type { FC } from 'react';
2
2
  import {
3
3
  ColorPropType,
4
4
  DimensionPropType,
@@ -10,14 +10,11 @@ import {
10
10
  TransitionPropType,
11
11
  CursorPropType,
12
12
  AlignSelfPropType,
13
+ ComponentBaseProps,
13
14
  } from '../shared';
14
15
  import { ShadowTokens } from '../tokens';
15
16
 
16
- export interface BoxProps
17
- extends PropsWithChildren,
18
- RefAttributes<HTMLDivElement>,
19
- Partial<HTMLDivElement>,
20
- DOMAttributes<HTMLDivElement> {
17
+ export interface BoxProps extends Omit<ComponentBaseProps, 'height' | 'width'> {
21
18
  children?: React.ReactNode;
22
19
  color?: ColorPropType;
23
20
  colorHover?: ColorPropType;
@@ -1,9 +1,10 @@
1
1
  import type { FC } from 'react';
2
+ import { ComponentBaseProps } from '../shared';
2
3
 
3
4
  export type ButtonVariant = 'neutral' | 'accent' | 'danger';
4
5
  export type ButtonTag = 'button' | 'a' | 'span';
5
6
 
6
- export interface ButtonProps {
7
+ export interface ButtonProps extends ComponentBaseProps {
7
8
  children?: React.ReactNode;
8
9
  variant?: ButtonVariant;
9
10
  isDisabled?: boolean;
@@ -13,7 +14,9 @@ export interface ButtonProps {
13
14
  hasSpinner?: boolean;
14
15
  type?: 'button' | 'submit' | 'reset';
15
16
  tag?: ButtonTag;
16
- onClick?: (_event: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
17
+ onClick?: (
18
+ event: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLSpanElement>,
19
+ ) => void;
17
20
  }
18
21
 
19
22
  export const Button: FC<ButtonProps>;
@@ -2,7 +2,7 @@ import type { FC, InputHTMLAttributes, LabelHTMLAttributes } from 'react';
2
2
 
3
3
  export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
4
4
  id: string;
5
- onChange?: (_event: React.ChangeEvent<HTMLInputElement>) => void;
5
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
6
6
  isDisabled?: boolean;
7
7
  isChecked?: boolean;
8
8
  isIndeterminate?: boolean;
@@ -11,7 +11,7 @@ export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement
11
11
  }
12
12
 
13
13
  export interface CheckboxBoxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
14
- onChange?: (_event: React.ChangeEvent<HTMLInputElement>) => void;
14
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
15
15
  isDisabled?: boolean;
16
16
  isChecked?: boolean;
17
17
  isIndeterminate?: boolean;
@@ -1,5 +1,5 @@
1
- import type { FC, SelectHTMLAttributes } from 'react';
2
- import { ColorPropType } from '../shared';
1
+ import type { FC } from 'react';
2
+ import { ColorPropType, ComponentBaseProps } from '../shared';
3
3
 
4
4
  export interface SelectOption {
5
5
  value: string;
@@ -7,7 +7,7 @@ export interface SelectOption {
7
7
  isDisabled?: boolean;
8
8
  }
9
9
 
10
- export interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'onChange'> {
10
+ export interface SelectProps extends Omit<ComponentBaseProps, 'onChange' | 'label'> {
11
11
  children?: React.ReactNode;
12
12
  id?: string;
13
13
  value?: string;
@@ -22,6 +22,10 @@ export interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement
22
22
  isDisabled?: boolean;
23
23
  isReadOnly?: boolean;
24
24
  backgroundColor?: ColorPropType;
25
+ menuWidth?: string | number;
26
+ menuMaxHeight?: string | number;
25
27
  }
26
28
 
27
- export const Select: FC<SelectProps>;
29
+ export const Select: FC<SelectProps> & {
30
+ Trigger: React.ComponentType<any>;
31
+ };
@@ -8,9 +8,9 @@ export interface SliderProps extends HTMLAttributes<HTMLDivElement> {
8
8
  min?: number;
9
9
  max?: number;
10
10
  step?: number;
11
- onChange?: (_value: number) => void;
12
- onChangeEnd?: (_value: number) => void;
13
- isDisabled?: boolean;
11
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
12
+ onChangeEnd?: (event: React.ChangeEvent<HTMLInputElement>) => void;
13
+ disabled?: boolean;
14
14
  label?: React.ReactNode;
15
15
  hint?: React.ReactNode;
16
16
  hasError?: boolean;
@@ -3,8 +3,8 @@ import type { FC, InputHTMLAttributes } from 'react';
3
3
  export interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
4
4
  children?: React.ReactNode;
5
5
  id: string;
6
- isChecked?: boolean;
7
- onChange?: (_event: React.ChangeEvent<HTMLInputElement>) => void;
6
+ isActive?: boolean;
7
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
8
8
  isDisabled?: boolean;
9
9
  label?: string;
10
10
  hint?: React.ReactNode;
@@ -6,7 +6,7 @@ export interface TextareaProps
6
6
  children?: React.ReactNode;
7
7
  value?: string;
8
8
  defaultValue?: string;
9
- onChange?: (_event: React.ChangeEvent<HTMLTextAreaElement>) => void;
9
+ onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
10
10
  placeholder?: string;
11
11
  label?: React.ReactNode;
12
12
  hint?: React.ReactNode;
@@ -1,12 +1,18 @@
1
- import type { FC, ButtonHTMLAttributes, AnchorHTMLAttributes } from 'react';
1
+ import type { FC } from 'react';
2
+ import { ComponentBaseProps } from '../shared';
3
+ import { ButtonTag } from './button';
2
4
 
3
- export interface TextButtonProps extends HTMLAttributes<HTMLButtonElement> {
5
+ export interface TextButtonProps extends ComponentBaseProps {
4
6
  children?: React.ReactNode;
5
7
  variant?: 'neutral' | 'accent' | 'danger';
6
8
  isDisabled?: boolean;
7
9
  type?: 'button' | 'submit' | 'reset';
8
- tag?: 'button' | 'a' | 'span';
9
- onClick?: (_event: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
10
+ tag?: ButtonTag;
11
+ onClick?: (
12
+ event: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLSpanElement>,
13
+ ) => void;
14
+ icon?: React.ReactNode;
15
+ iconPosition?: 'left' | 'right';
10
16
  }
11
17
 
12
18
  export const TextButton: FC<TextButtonProps>;
@@ -4,9 +4,9 @@ export interface TextInputProps extends React.InputHTMLAttributes<HTMLInputEleme
4
4
  id?: string;
5
5
  value?: string;
6
6
  defaultValue?: string;
7
- onChange?: (_event: React.ChangeEvent<HTMLInputElement>) => void;
8
- onFocus?: (_event: React.FocusEvent<HTMLInputElement>) => void;
9
- onBlur?: (_event: React.FocusEvent<HTMLInputElement>) => void;
7
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
8
+ onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
9
+ onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
10
10
  type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'url';
11
11
  placeholder?: string;
12
12
  label?: React.ReactNode;
@@ -1,10 +1,12 @@
1
- import type { FC, HTMLAttributes } from 'react';
1
+ import type { FC } from 'react';
2
+ import { ComponentBaseProps } from '../shared';
2
3
 
3
- export interface TextToggleGroupProps extends HTMLAttributes<HTMLDivElement> {
4
+ export interface TextToggleGroupProps extends ComponentBaseProps {
4
5
  children?: React.ReactNode;
6
+ hasFullWidth?: boolean;
5
7
  }
6
8
 
7
- export interface TextToggleProps extends HTMLAttributes<HTMLButtonElement> {
9
+ export interface TextToggleProps extends ComponentBaseProps {
8
10
  children?: React.ReactNode;
9
11
  isActive?: boolean;
10
12
  }
@@ -1,18 +1,12 @@
1
- import type { FC, HTMLAttributes } from 'react';
2
- import { DimensionPropType } from '../shared';
1
+ import type { FC, HTMLAttributes, ReactNode } from 'react';
3
2
 
4
3
  export interface ToastProps extends HTMLAttributes<HTMLDivElement> {
5
- children?: React.ReactNode;
6
- isOpen: boolean;
7
- onClose: () => void;
8
- title?: React.ReactNode;
9
- description?: React.ReactNode;
10
- duration?: number;
11
- hasCloseButton?: boolean;
12
- variant?: 'neutral' | 'success' | 'warning' | 'danger';
13
- position?: 'top' | 'bottom';
14
- offset?: DimensionPropType;
4
+ children: ReactNode;
15
5
  zIndex?: number;
6
+ isOpen?: boolean;
7
+ variant?: 'success' | 'danger' | 'neutral';
8
+ dismissTimeout?: number;
9
+ onDismiss?: () => void;
16
10
  }
17
11
 
18
12
  export const Toast: FC<ToastProps>;
@@ -1,7 +1,7 @@
1
1
  import type { FC } from 'react';
2
- import { ColorPropType, DimensionPropType } from '../shared';
2
+ import { ColorPropType, ComponentBaseProps, DimensionPropType } from '../shared';
3
3
 
4
- export interface InputFieldProps {
4
+ export interface InputFieldProps extends ComponentBaseProps {
5
5
  paddingLeft?: DimensionPropType;
6
6
  paddingRight?: DimensionPropType;
7
7
  hasError?: boolean;
@@ -10,16 +10,16 @@ export interface InputFieldProps {
10
10
  backgroundColor?: ColorPropType;
11
11
  }
12
12
 
13
- export interface FieldLabelProps {
13
+ export interface FieldLabelProps extends ComponentBaseProps {
14
14
  children?: React.ReactNode;
15
15
  htmlFor?: string;
16
16
  }
17
17
 
18
- export interface FieldHintProps {
18
+ export interface FieldHintProps extends ComponentBaseProps {
19
19
  children?: React.ReactNode;
20
20
  }
21
21
 
22
- export interface FieldClearButtonProps {
22
+ export interface FieldClearButtonProps extends ComponentBaseProps {
23
23
  onClick?: () => void;
24
24
  tag?: 'button' | 'a' | 'span';
25
25
  }
@@ -21,6 +21,8 @@ import {
21
21
  textDisplays,
22
22
  textAlignments,
23
23
  } from '../types';
24
+ import { AllHTMLAttributes, RefAttributes } from 'react';
25
+ import { SerializedStyles } from '@emotion/react';
24
26
 
25
27
  export type OverflowPropType = (typeof overflows)[number];
26
28
  export type DimensionPropType = number | string | object | keyof SpaceTokens;
@@ -42,3 +44,9 @@ export type TextTransformType = (typeof textTransforms)[number];
42
44
  export type TextDisplayType = (typeof textDisplays)[number];
43
45
  export type TextAlignType = (typeof textAlignments)[number];
44
46
  export type IconSizePropType = number | string | keyof IconTokens;
47
+
48
+ export interface ComponentBaseProps
49
+ extends AllHTMLAttributes<HTMLElement>,
50
+ RefAttributes<HTMLElement> {
51
+ css?: SerializedStyles | false;
52
+ }
@@ -1,4 +1,4 @@
1
- import { ColorTokens } from '../tokens';
1
+ import { ColorTokens, WeightTokens } from '../tokens';
2
2
 
3
3
  export interface Texts {
4
4
  s: string;
@@ -29,8 +29,8 @@ export interface Spaces {
29
29
  }
30
30
 
31
31
  export interface Weights {
32
- normal: string;
33
- medium: string;
32
+ normal: keyof WeightTokens;
33
+ medium: keyof WeightTokens;
34
34
  }
35
35
 
36
36
  export interface Radii {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flodesk/grain",
3
- "version": "11.42.1",
3
+ "version": "11.43.0",
4
4
  "description": "Flodesk design system",
5
5
  "module": "es/index.js",
6
6
  "types": "es/types/index.d.ts",
@@ -54,6 +54,8 @@
54
54
  "@semantic-release/git": "^10.0.1",
55
55
  "@semantic-release/gitlab": "^9.3.1",
56
56
  "@semantic-release/npm": "^9.0.1",
57
+ "@types/react": "^16.14.62",
58
+ "@types/react-dom": "^16.9.25",
57
59
  "colord": "^2.9.2",
58
60
  "cross-env": "^7.0.3",
59
61
  "del-cli": "^4.0.1",