@equinor/eds-core-react 0.13.1 → 0.14.1

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.
Files changed (31) hide show
  1. package/dist/core-react.cjs.js +860 -576
  2. package/dist/core-react.esm.js +861 -577
  3. package/dist/core-react.umd.js +860 -576
  4. package/dist/types/components/Accordion/Accordion.tokens.d.ts +1 -0
  5. package/dist/types/components/Banner/Banner.d.ts +4 -2
  6. package/dist/types/components/Banner/BannerActions.d.ts +5 -2
  7. package/dist/types/components/Banner/BannerIcon.d.ts +7 -2
  8. package/dist/types/components/Banner/BannerMessage.d.ts +5 -2
  9. package/dist/types/components/Combobox/Combobox.d.ts +55 -0
  10. package/dist/types/components/Combobox/Combobox.tokens.d.ts +3 -0
  11. package/dist/types/components/Combobox/index.d.ts +1 -0
  12. package/dist/types/components/Input/Input.d.ts +2 -2
  13. package/dist/types/components/Pagination/Pagination.d.ts +2 -2
  14. package/dist/types/components/Select/commonStyles.d.ts +3 -6
  15. package/dist/types/components/Snackbar/Snackbar.d.ts +4 -4
  16. package/dist/types/components/Snackbar/SnackbarAction.d.ts +1 -1
  17. package/dist/types/components/Switch/Switch.styles.d.ts +1 -0
  18. package/dist/types/components/Table/DataCell/DataCell.tokens.d.ts +5 -3
  19. package/dist/types/components/TextField/Field.d.ts +4 -4
  20. package/dist/types/components/TextField/Icon/Icon.d.ts +2 -5
  21. package/dist/types/components/TextField/{context.d.ts → TextField.context.d.ts} +0 -0
  22. package/dist/types/components/Textarea/Textarea.d.ts +2 -2
  23. package/dist/types/components/Tooltip/Tooltip.d.ts +2 -2
  24. package/dist/types/components/Typography/Typography.tokens.d.ts +48 -0
  25. package/dist/types/hooks/index.d.ts +1 -0
  26. package/dist/types/hooks/useHideBodyScroll.d.ts +1 -0
  27. package/dist/types/utils/index.d.ts +1 -0
  28. package/dist/types/utils/joinHandlers.d.ts +3 -0
  29. package/package.json +110 -108
  30. package/src/index.ts +37 -0
  31. package/CHANGELOG.md +0 -590
@@ -3,6 +3,7 @@ declare type AccordionToken = ComponentToken & {
3
3
  entities: {
4
4
  chevron: ComponentToken;
5
5
  header: ComponentToken;
6
+ icon: ComponentToken;
6
7
  };
7
8
  };
8
9
  export declare const accordion: AccordionToken;
@@ -1,5 +1,7 @@
1
- import { FC, HTMLAttributes, ReactNode } from 'react';
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
2
  export declare type BannerProps = {
3
3
  children: ReactNode;
4
4
  } & HTMLAttributes<HTMLDivElement>;
5
- export declare const Banner: FC<BannerProps>;
5
+ export declare const Banner: import("react").ForwardRefExoticComponent<{
6
+ children: ReactNode;
7
+ } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,8 +1,11 @@
1
- import { FC, HTMLAttributes, ReactNode } from 'react';
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
2
  declare type BannerActionsPlacement = 'bottom' | 'left';
3
3
  export declare type BannerActionsProps = {
4
4
  children: ReactNode;
5
5
  placement?: BannerActionsPlacement;
6
6
  } & HTMLAttributes<HTMLDivElement>;
7
- export declare const BannerActions: FC<BannerActionsProps>;
7
+ export declare const BannerActions: import("react").ForwardRefExoticComponent<{
8
+ children: ReactNode;
9
+ placement?: BannerActionsPlacement;
10
+ } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
8
11
  export {};
@@ -1,4 +1,4 @@
1
- import { FC, HTMLAttributes, ReactNode } from 'react';
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
2
  declare type BannerIconVariant = 'info' | 'warning';
3
3
  export declare type BannerIconProps = {
4
4
  /** Which icon background and fill color to use. Info = green, warning = red */
@@ -6,5 +6,10 @@ export declare type BannerIconProps = {
6
6
  /** @ignore */
7
7
  children: ReactNode;
8
8
  } & HTMLAttributes<HTMLSpanElement>;
9
- export declare const BannerIcon: FC<BannerIconProps>;
9
+ export declare const BannerIcon: import("react").ForwardRefExoticComponent<{
10
+ /** Which icon background and fill color to use. Info = green, warning = red */
11
+ variant?: BannerIconVariant;
12
+ /** @ignore */
13
+ children: ReactNode;
14
+ } & HTMLAttributes<HTMLSpanElement> & import("react").RefAttributes<HTMLSpanElement>>;
10
15
  export {};
@@ -1,7 +1,10 @@
1
- import { FC } from 'react';
1
+ /// <reference types="react" />
2
2
  import { TypographyProps } from '../Typography/Typography';
3
3
  export declare type BannerMessageProps = {
4
4
  /** Text content */
5
5
  children: string;
6
6
  } & Omit<TypographyProps, 'children'>;
7
- export declare const BannerMessage: FC<BannerMessageProps>;
7
+ export declare const BannerMessage: import("react").ForwardRefExoticComponent<{
8
+ /** Text content */
9
+ children: string;
10
+ } & Omit<TypographyProps, "children"> & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,55 @@
1
+ import { SelectHTMLAttributes } from 'react';
2
+ export declare type ComboboxChanges = {
3
+ selectedItems: string[];
4
+ inputValue: string;
5
+ };
6
+ export declare type ComboboxProps = {
7
+ /** List of options to choose from */
8
+ items: string[];
9
+ /** Label for the select element */
10
+ label: string;
11
+ /** Array of initial selected items */
12
+ initialSelectedItems?: string[];
13
+ /** Meta text, for instance unit */
14
+ meta?: string;
15
+ /** Disabled state */
16
+ disabled?: boolean;
17
+ /** Read Only */
18
+ readOnly?: boolean;
19
+ /** If this prop is used, the select will become a controlled component. Use an empty
20
+ * array [] if there will be no initial selected items
21
+ * Note that this prop replaces the need for ```initialSelectedItems```
22
+ * The items that should be selected. */
23
+ selectedOptions?: string[];
24
+ /** Callback for the selected item change
25
+ * changes.selectedItem gives the selected item
26
+ */
27
+ handleSelectedItemsChange?: (changes: ComboboxChanges) => void;
28
+ /** Enable multiselect */
29
+ multiple?: boolean;
30
+ } & SelectHTMLAttributes<HTMLSelectElement>;
31
+ export declare const Combobox: import("react").ForwardRefExoticComponent<{
32
+ /** List of options to choose from */
33
+ items: string[];
34
+ /** Label for the select element */
35
+ label: string;
36
+ /** Array of initial selected items */
37
+ initialSelectedItems?: string[];
38
+ /** Meta text, for instance unit */
39
+ meta?: string;
40
+ /** Disabled state */
41
+ disabled?: boolean;
42
+ /** Read Only */
43
+ readOnly?: boolean;
44
+ /** If this prop is used, the select will become a controlled component. Use an empty
45
+ * array [] if there will be no initial selected items
46
+ * Note that this prop replaces the need for ```initialSelectedItems```
47
+ * The items that should be selected. */
48
+ selectedOptions?: string[];
49
+ /** Callback for the selected item change
50
+ * changes.selectedItem gives the selected item
51
+ */
52
+ handleSelectedItemsChange?: (changes: ComboboxChanges) => void;
53
+ /** Enable multiselect */
54
+ multiple?: boolean;
55
+ } & SelectHTMLAttributes<HTMLSelectElement> & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,3 @@
1
+ import type { ComponentToken } from '@equinor/eds-tokens';
2
+ export declare const selectTokens: ComponentToken;
3
+ export declare const multiSelect: ComponentToken;
@@ -0,0 +1 @@
1
+ export * from './Combobox';
@@ -10,7 +10,7 @@ export declare type InputProps = {
10
10
  /** Type */
11
11
  type?: string;
12
12
  /** Read Only */
13
- readonly?: boolean;
13
+ readOnly?: boolean;
14
14
  } & InputHTMLAttributes<HTMLInputElement>;
15
15
  export declare const Input: import("react").ForwardRefExoticComponent<{
16
16
  /** Placeholder */
@@ -22,5 +22,5 @@ export declare const Input: import("react").ForwardRefExoticComponent<{
22
22
  /** Type */
23
23
  type?: string;
24
24
  /** Read Only */
25
- readonly?: boolean;
25
+ readOnly?: boolean;
26
26
  } & InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>;
@@ -7,7 +7,7 @@ export declare type PaginationProps = {
7
7
  /** Choose number of items per page */
8
8
  itemsPerPage?: number;
9
9
  /** Callback fired on page change */
10
- onChange?: (event: MouseEvent | KeyboardEvent, page: number) => void;
10
+ onChange?: (event: MouseEvent | KeyboardEvent | null, page: number) => void;
11
11
  /** Default start page */
12
12
  defaultPage?: number;
13
13
  } & Omit<HTMLAttributes<HTMLElement>, 'onChange'>;
@@ -19,7 +19,7 @@ export declare const Pagination: import("react").ForwardRefExoticComponent<{
19
19
  /** Choose number of items per page */
20
20
  itemsPerPage?: number;
21
21
  /** Callback fired on page change */
22
- onChange?: (event: MouseEvent | KeyboardEvent, page: number) => void;
22
+ onChange?: (event: MouseEvent | KeyboardEvent | null, page: number) => void;
23
23
  /** Default start page */
24
24
  defaultPage?: number;
25
25
  } & Omit<HTMLAttributes<HTMLElement>, "onChange"> & import("react").RefAttributes<HTMLElement>>;
@@ -2,10 +2,7 @@ import { HTMLAttributes } from 'react';
2
2
  declare type ContainerProps = HTMLAttributes<HTMLDivElement>;
3
3
  declare type StyledListItemType = {
4
4
  highlighted: string;
5
- density: string;
6
- };
7
- declare type StyledButtonType = {
8
- density: string;
5
+ active?: string;
9
6
  };
10
7
  export declare const Container: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, ContainerProps, never>;
11
8
  export declare const PaddedInput: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<{
@@ -13,7 +10,7 @@ export declare const PaddedInput: import("styled-components").StyledComponent<im
13
10
  variant?: import("../TextField/types").Variants;
14
11
  disabled?: boolean;
15
12
  type?: string;
16
- readonly?: boolean;
13
+ readOnly?: boolean;
17
14
  } & import("react").InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>, import("styled-components").DefaultTheme, {}, never>;
18
15
  export declare const StyledList: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<{
19
16
  variant?: "bullet" | "numbered";
@@ -30,6 +27,6 @@ export declare const StyledButton: import("styled-components").StyledComponent<i
30
27
  as?: import("react").ElementType<any>;
31
28
  type?: string;
32
29
  fullWidth?: boolean;
33
- } & import("react").ButtonHTMLAttributes<HTMLButtonElement> & import("react").RefAttributes<HTMLButtonElement>>, import("styled-components").DefaultTheme, StyledButtonType, never>;
30
+ } & import("react").ButtonHTMLAttributes<HTMLButtonElement> & import("react").RefAttributes<HTMLButtonElement>>, import("styled-components").DefaultTheme, {}, never>;
34
31
  export declare const StyledInputWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
35
32
  export {};
@@ -6,8 +6,8 @@ export declare type SnackbarProps = {
6
6
  autoHideDuration?: number;
7
7
  /** Callback fired when the snackbar is closed by auto hide duration timeout */
8
8
  onClose?: () => void;
9
- /** Media query from which the snackbar will be horizontal centered */
10
- leftAlignFrom?: string;
9
+ /** Placement of the snackbar relative to the viewport */
10
+ placement?: 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'bottom-left' | 'top-right' | 'bottom-right';
11
11
  } & HTMLAttributes<HTMLDivElement>;
12
12
  export declare const Snackbar: import("react").ForwardRefExoticComponent<{
13
13
  /** Controls the visibility of the snackbar */
@@ -16,6 +16,6 @@ export declare const Snackbar: import("react").ForwardRefExoticComponent<{
16
16
  autoHideDuration?: number;
17
17
  /** Callback fired when the snackbar is closed by auto hide duration timeout */
18
18
  onClose?: () => void;
19
- /** Media query from which the snackbar will be horizontal centered */
20
- leftAlignFrom?: string;
19
+ /** Placement of the snackbar relative to the viewport */
20
+ placement?: 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'bottom-left' | 'top-right' | 'bottom-right';
21
21
  } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
@@ -2,4 +2,4 @@ import { ReactNode } from 'react';
2
2
  export declare type SnackbarActionProps = {
3
3
  children: ReactNode;
4
4
  };
5
- export declare const SnackbarAction: ({ children, }: SnackbarActionProps) => JSX.Element;
5
+ export declare const SnackbarAction: import("react").ForwardRefExoticComponent<SnackbarActionProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -2,3 +2,4 @@ export declare const BaseInputWrapper: import("styled-components").StyledCompone
2
2
  export declare const BaseInput: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, {
3
3
  type: string;
4
4
  }, "type">;
5
+ export declare const GridWrapper: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
@@ -1,13 +1,15 @@
1
1
  import type { ComponentToken } from '@equinor/eds-tokens';
2
+ import { Variants } from '../Table.types';
2
3
  declare type Validation = {
3
4
  error: Partial<ComponentToken>;
4
5
  };
5
- declare type Variants = {
6
+ declare type VariantsType = {
6
7
  numeric: Partial<ComponentToken>;
7
8
  };
8
9
  export declare type TableCellToken = ComponentToken & {
9
10
  validation: Validation;
10
- variants: Variants;
11
+ variants: VariantsType;
11
12
  };
12
- export declare const token: TableCellToken;
13
+ export declare const tableCell: TableCellToken;
14
+ export declare const applyVariant: (variant: Variants, token: TableCellToken) => TableCellToken;
13
15
  export {};
@@ -4,6 +4,7 @@ import type { TextFieldToken } from './TextField.tokens';
4
4
  declare type InputWrapperType = {
5
5
  isFocused: boolean;
6
6
  isDisabled: boolean;
7
+ isReadOnly: boolean;
7
8
  variant: string;
8
9
  token: TextFieldToken;
9
10
  inputIcon?: ReactNode;
@@ -11,7 +12,7 @@ declare type InputWrapperType = {
11
12
  multiline?: boolean;
12
13
  };
13
14
  export declare const InputWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, InputWrapperType, never>;
14
- declare type FieldProps = {
15
+ export declare const Field: import("react").ForwardRefExoticComponent<{
15
16
  /** Specifies if input should be multiline*/
16
17
  multiline?: boolean;
17
18
  /** Placeholder */
@@ -23,12 +24,11 @@ declare type FieldProps = {
23
24
  /** Type */
24
25
  type?: string;
25
26
  /** Read Only */
26
- readonly?: boolean;
27
+ readOnly?: boolean;
27
28
  /** Unit text */
28
29
  unit?: string;
29
30
  inputIcon?: ReactNode;
30
31
  /** Specifies max rows for multiline input */
31
32
  rowsMax?: number;
32
- };
33
- export declare const Field: import("react").ForwardRefExoticComponent<FieldProps & import("react").RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
33
+ } & import("react").HTMLAttributes<HTMLInputElement | HTMLTextAreaElement> & import("react").RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
34
34
  export {};
@@ -1,16 +1,13 @@
1
1
  import { HTMLAttributes } from 'react';
2
- import type { Spacing } from '@equinor/eds-tokens';
3
2
  import type { Variants, ColorStateProps } from '../types';
4
3
  declare const InputIcon: import("react").ForwardRefExoticComponent<{
5
4
  /** isDisabled */
6
5
  isDisabled?: boolean;
7
6
  /** Variant */
8
7
  variant?: Variants;
9
- /** Is the icon inside a text field */
10
- isInputIcon?: boolean;
11
- /** Spacing object, comfortable is default */
12
- spacings?: Spacing;
13
8
  /** Colors */
14
9
  colors?: ColorStateProps;
10
+ /** Size */
11
+ size?: 16 | 24;
15
12
  } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
16
13
  export { InputIcon as Icon };
@@ -10,7 +10,7 @@ export declare type TextareaProps = {
10
10
  /** Type */
11
11
  type?: string;
12
12
  /** Read Only */
13
- readonly?: boolean;
13
+ readOnly?: boolean;
14
14
  /** Specifies max rows for multiline input */
15
15
  rowsMax?: number;
16
16
  } & TextareaHTMLAttributes<HTMLTextAreaElement>;
@@ -24,7 +24,7 @@ export declare const Textarea: import("react").ForwardRefExoticComponent<{
24
24
  /** Type */
25
25
  type?: string;
26
26
  /** Read Only */
27
- readonly?: boolean;
27
+ readOnly?: boolean;
28
28
  /** Specifies max rows for multiline input */
29
29
  rowsMax?: number;
30
30
  } & TextareaHTMLAttributes<HTMLTextAreaElement> & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -6,7 +6,7 @@ export declare type TooltipProps = {
6
6
  /** Tooltip title */
7
7
  title?: string;
8
8
  /** Tooltip anchor element */
9
- children: React.ReactElement;
9
+ children: React.ReactElement & React.RefAttributes<HTMLElement>;
10
10
  /** Delay in ms, default 100 */
11
11
  enterDelay?: number;
12
12
  } & HTMLAttributes<HTMLDivElement>;
@@ -16,7 +16,7 @@ export declare const Tooltip: import("react").ForwardRefExoticComponent<{
16
16
  /** Tooltip title */
17
17
  title?: string;
18
18
  /** Tooltip anchor element */
19
- children: React.ReactElement;
19
+ children: React.ReactElement & React.RefAttributes<HTMLElement>;
20
20
  /** Delay in ms, default 100 */
21
21
  enterDelay?: number;
22
22
  } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
@@ -345,6 +345,54 @@ declare const typography: {
345
345
  textAlign: string;
346
346
  };
347
347
  };
348
+ _modes: {
349
+ compact: {
350
+ table: {
351
+ cell_header: {
352
+ color: string;
353
+ fontFamily: string;
354
+ fontSize: string;
355
+ fontWeight: number;
356
+ lineHeight: string;
357
+ textAlign: string;
358
+ };
359
+ cell_text: {
360
+ color: string;
361
+ fontFamily: string;
362
+ fontSize: string;
363
+ fontWeight: number;
364
+ lineHeight: string;
365
+ textAlign: string;
366
+ };
367
+ cell_text_bold: {
368
+ color: string;
369
+ fontFamily: string;
370
+ fontSize: string;
371
+ fontWeight: number;
372
+ lineHeight: string;
373
+ textAlign: string;
374
+ };
375
+ cell_text_link: {
376
+ color: string;
377
+ fontFamily: string;
378
+ fontSize: string;
379
+ fontWeight: number;
380
+ lineHeight: string;
381
+ textDecoration: string;
382
+ textAlign: string;
383
+ };
384
+ cell_numeric_monospaced: {
385
+ fontFeature: string;
386
+ color: string;
387
+ fontFamily: string;
388
+ fontSize: string;
389
+ fontWeight: number;
390
+ lineHeight: string;
391
+ textAlign: string;
392
+ };
393
+ };
394
+ };
395
+ };
348
396
  ui: {
349
397
  tooltip: {
350
398
  color: string;
@@ -6,3 +6,4 @@ export { useId } from './useId';
6
6
  export { useIsMounted } from './useMountedRef';
7
7
  export { useAutoResize } from './useAutoResize';
8
8
  export * from './useToken';
9
+ export { useHideBodyScroll } from './useHideBodyScroll';
@@ -0,0 +1 @@
1
+ export declare const useHideBodyScroll: (overflowState: string) => void;
@@ -1,3 +1,4 @@
1
1
  export * from './templates';
2
+ export { joinHandlers } from './joinHandlers';
2
3
  export { setReactInputValue } from './setReactInputValue';
3
4
  export declare const trimSpaces: (text: string) => string;
@@ -0,0 +1,3 @@
1
+ declare type Callback<T> = (e: T) => void;
2
+ export declare const joinHandlers: <T>(handler1?: Callback<T>, handler2?: Callback<T>) => Callback<T>;
3
+ export {};