@equinor/eds-core-react 0.24.0 → 0.26.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.
Files changed (71) hide show
  1. package/dist/eds-core-react.cjs.js +1820 -1633
  2. package/dist/esm/components/Autocomplete/Autocomplete.js +64 -70
  3. package/dist/esm/components/Autocomplete/Autocomplete.tokens.js +1 -0
  4. package/dist/esm/components/Button/Button.js +1 -1
  5. package/dist/esm/components/Input/Input.js +129 -32
  6. package/dist/esm/components/Input/Input.tokens.js +84 -56
  7. package/dist/esm/components/InputWrapper/HelperText/HelperText.js +49 -0
  8. package/dist/esm/components/InputWrapper/HelperText/HelperText.token.js +28 -0
  9. package/dist/esm/components/InputWrapper/InputWrapper.js +68 -0
  10. package/dist/esm/components/InputWrapper/InputWrapper.tokens.js +164 -0
  11. package/dist/esm/components/Menu/Menu.js +2 -2
  12. package/dist/esm/components/Pagination/Pagination.js +3 -3
  13. package/dist/esm/components/Popover/Popover.js +71 -56
  14. package/dist/esm/components/Popover/Popover.tokens.js +17 -2
  15. package/dist/esm/components/Search/Search.js +60 -187
  16. package/dist/esm/components/SideBar/SideBar.context.js +53 -0
  17. package/dist/esm/components/SideBar/SideBar.js +79 -0
  18. package/dist/esm/components/SideBar/SideBar.tokens.js +110 -0
  19. package/dist/esm/components/SideBar/SideBarButton/index.js +86 -0
  20. package/dist/esm/components/SideBar/SideBarContent.js +27 -0
  21. package/dist/esm/components/SideBar/SideBarFooter.js +27 -0
  22. package/dist/esm/components/SideBar/SideBarToggle.js +57 -0
  23. package/dist/esm/components/SideBar/SidebarLink/index.js +106 -0
  24. package/dist/esm/components/SideBar/index.js +20 -0
  25. package/dist/esm/components/TextField/TextField.js +52 -46
  26. package/dist/esm/components/Textarea/Textarea.js +26 -43
  27. package/dist/esm/components/Tooltip/Tooltip.js +38 -37
  28. package/dist/esm/components/TopBar/Header.js +1 -1
  29. package/dist/esm/index.js +3 -0
  30. package/dist/types/components/Input/Input.d.ts +22 -15
  31. package/dist/types/components/InputWrapper/HelperText/HelperText.d.ts +18 -0
  32. package/dist/types/components/{TextField → InputWrapper}/HelperText/HelperText.token.d.ts +0 -5
  33. package/dist/types/components/InputWrapper/HelperText/index.d.ts +1 -0
  34. package/dist/types/components/InputWrapper/InputWrapper.d.ts +41 -0
  35. package/dist/types/components/InputWrapper/InputWrapper.tokens.d.ts +12 -0
  36. package/dist/types/components/InputWrapper/index.d.ts +2 -0
  37. package/dist/types/components/Popover/Popover.d.ts +10 -0
  38. package/dist/types/components/Search/Search.d.ts +2 -2
  39. package/dist/types/components/Select/commonStyles.d.ts +1 -7
  40. package/dist/types/components/SideBar/SideBar.context.d.ts +15 -0
  41. package/dist/types/components/SideBar/SideBar.d.ts +5 -0
  42. package/dist/types/components/SideBar/SideBar.tokens.d.ts +2 -0
  43. package/dist/types/components/SideBar/SideBarButton/index.d.ts +8 -0
  44. package/dist/types/components/SideBar/SideBarContent.d.ts +4 -0
  45. package/dist/types/components/SideBar/SideBarFooter.d.ts +4 -0
  46. package/dist/types/components/SideBar/SideBarToggle.d.ts +4 -0
  47. package/dist/types/components/SideBar/SidebarLink/index.d.ts +18 -0
  48. package/dist/types/components/SideBar/index.d.ts +17 -0
  49. package/dist/types/components/TextField/TextField.d.ts +15 -21
  50. package/dist/types/components/Textarea/Textarea.d.ts +3 -3
  51. package/dist/types/components/types.d.ts +1 -0
  52. package/dist/types/index.d.ts +2 -0
  53. package/package.json +3 -3
  54. package/dist/esm/components/Search/Search.tokens.js +0 -83
  55. package/dist/esm/components/TextField/Field.js +0 -151
  56. package/dist/esm/components/TextField/HelperText/HelperText.js +0 -89
  57. package/dist/esm/components/TextField/HelperText/HelperText.token.js +0 -45
  58. package/dist/esm/components/TextField/Icon/Icon.js +0 -65
  59. package/dist/esm/components/TextField/Icon/Icon.tokens.js +0 -42
  60. package/dist/esm/components/TextField/TextField.context.js +0 -48
  61. package/dist/esm/components/TextField/TextField.tokens.js +0 -120
  62. package/dist/types/components/Search/Search.tokens.d.ts +0 -4
  63. package/dist/types/components/TextField/Field.d.ts +0 -34
  64. package/dist/types/components/TextField/HelperText/HelperText.d.ts +0 -14
  65. package/dist/types/components/TextField/HelperText/index.d.ts +0 -1
  66. package/dist/types/components/TextField/Icon/Icon.d.ts +0 -13
  67. package/dist/types/components/TextField/Icon/Icon.tokens.d.ts +0 -14
  68. package/dist/types/components/TextField/Icon/index.d.ts +0 -1
  69. package/dist/types/components/TextField/TextField.context.d.ts +0 -17
  70. package/dist/types/components/TextField/TextField.tokens.d.ts +0 -10
  71. package/dist/types/components/TextField/types.d.ts +0 -6
@@ -1,45 +0,0 @@
1
- import { tokens } from '@equinor/eds-tokens';
2
-
3
- var colors = tokens.colors,
4
- comfortable = tokens.spacings.comfortable,
5
- typography = tokens.typography;
6
- var helperText = {
7
- background: colors.ui.background__light.hex,
8
- typography: typography.input.helper,
9
- spacings: {
10
- comfortable: {
11
- left: comfortable.small,
12
- right: comfortable.small,
13
- top: comfortable.small,
14
- bottom: '6px'
15
- },
16
- compact: {
17
- left: comfortable.small,
18
- right: comfortable.small,
19
- top: comfortable.xx_small,
20
- bottom: '6px'
21
- }
22
- },
23
- "default": {
24
- color: colors.text.static_icons__tertiary.hex,
25
- disabledColor: colors.interactive.disabled__text.hex,
26
- focusColor: colors.text.static_icons__tertiary.hex
27
- },
28
- error: {
29
- color: colors.interactive.danger__text.hex,
30
- disabledColor: colors.interactive.disabled__text.hex,
31
- focusColor: colors.interactive.danger__hover.hex
32
- },
33
- warning: {
34
- color: colors.interactive.warning__text.hex,
35
- disabledColor: colors.interactive.disabled__text.hex,
36
- focusColor: colors.interactive.warning__hover.hex
37
- },
38
- success: {
39
- color: colors.interactive.success__text.hex,
40
- disabledColor: colors.interactive.disabled__text.hex,
41
- focusColor: colors.interactive.success__hover.hex
42
- }
43
- };
44
-
45
- export { helperText };
@@ -1,65 +0,0 @@
1
- import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
- import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
- import { forwardRef } from 'react';
4
- import styled, { css } from 'styled-components';
5
- import { useTextField } from '../TextField.context.js';
6
- import { input } from './Icon.tokens.js';
7
- import { jsx } from 'react/jsx-runtime';
8
-
9
- var _excluded = ["size", "variant", "isDisabled", "colors", "children"];
10
- var StyledIcon = styled.div.withConfig({
11
- displayName: "Icon__StyledIcon",
12
- componentId: "sc-jr0rqa-0"
13
- })(function (_ref) {
14
- var colors = _ref.colors,
15
- isDisabled = _ref.isDisabled,
16
- isFocused = _ref.isFocused,
17
- size = _ref.size;
18
- var focusColor = colors.focusColor,
19
- color = colors.color,
20
- disabledColor = colors.disabledColor;
21
- var fill = color;
22
-
23
- if (isDisabled) {
24
- fill = disabledColor;
25
- }
26
-
27
- if (isFocused) {
28
- fill = focusColor;
29
- }
30
-
31
- return css(["&,svg{fill:", ";width:", "px;height:", "px;}"], fill, size, size);
32
- });
33
- var InputIcon = /*#__PURE__*/forwardRef(function InputIcon(_ref2, ref) {
34
- var _ref2$size = _ref2.size,
35
- size = _ref2$size === void 0 ? 24 : _ref2$size,
36
- _ref2$variant = _ref2.variant,
37
- variant = _ref2$variant === void 0 ? 'default' : _ref2$variant,
38
- _ref2$isDisabled = _ref2.isDisabled,
39
- isDisabled = _ref2$isDisabled === void 0 ? false : _ref2$isDisabled,
40
- _ref2$colors = _ref2.colors,
41
- colors = _ref2$colors === void 0 ? {
42
- color: input[variant].color,
43
- disabledColor: input[variant].disabledColor,
44
- focusColor: input[variant].focusColor
45
- } : _ref2$colors,
46
- children = _ref2.children,
47
- other = _objectWithoutProperties(_ref2, _excluded);
48
-
49
- var _useTextField = useTextField(),
50
- isFocused = _useTextField.isFocused;
51
-
52
- var iconProps = {
53
- isDisabled: isDisabled,
54
- colors: colors,
55
- isFocused: isFocused,
56
- size: size
57
- };
58
- return /*#__PURE__*/jsx(StyledIcon, _objectSpread(_objectSpread(_objectSpread({
59
- ref: ref
60
- }, iconProps), other), {}, {
61
- children: children
62
- }));
63
- });
64
-
65
- export { InputIcon as Icon };
@@ -1,42 +0,0 @@
1
- import { tokens } from '@equinor/eds-tokens';
2
-
3
- var colors = tokens.colors,
4
- comfortable = tokens.spacings.comfortable;
5
- var input = {
6
- spacings: {
7
- comfortable: {
8
- left: comfortable.small,
9
- right: comfortable.small,
10
- top: '10px',
11
- bottom: '10px'
12
- },
13
- compact: {
14
- left: comfortable.small,
15
- right: comfortable.small,
16
- top: '10px',
17
- bottom: '10px'
18
- }
19
- },
20
- "default": {
21
- color: colors.text.static_icons__tertiary.hex,
22
- disabledColor: colors.interactive.disabled__fill.hex,
23
- focusColor: colors.interactive.primary__resting.hex
24
- },
25
- error: {
26
- color: colors.interactive.danger__resting.hex,
27
- disabledColor: colors.interactive.disabled__fill.hex,
28
- focusColor: colors.interactive.danger__hover.hex
29
- },
30
- warning: {
31
- color: colors.interactive.warning__resting.hex,
32
- disabledColor: colors.interactive.disabled__fill.hex,
33
- focusColor: colors.interactive.warning__hover.hex
34
- },
35
- success: {
36
- color: colors.interactive.success__resting.hex,
37
- disabledColor: colors.interactive.disabled__fill.hex,
38
- focusColor: colors.interactive.success__hover.hex
39
- }
40
- };
41
-
42
- export { input };
@@ -1,48 +0,0 @@
1
- import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
- import { useState, createContext, useContext } from 'react';
4
- import { jsx } from 'react/jsx-runtime';
5
-
6
- var initalState = {
7
- isFocused: false
8
- };
9
- var TextFieldContext = /*#__PURE__*/createContext(initalState);
10
- var TextFieldProvider = function TextFieldProvider(_ref) {
11
- var children = _ref.children;
12
-
13
- var _useState = useState(initalState),
14
- _useState2 = _slicedToArray(_useState, 2),
15
- state = _useState2[0],
16
- setState = _useState2[1];
17
-
18
- var handleFocus = function handleFocus() {
19
- setState(function (prevState) {
20
- return _objectSpread(_objectSpread({}, prevState), {}, {
21
- isFocused: true
22
- });
23
- });
24
- };
25
-
26
- var handleBlur = function handleBlur() {
27
- setState(function (prevState) {
28
- return _objectSpread(_objectSpread({}, prevState), {}, {
29
- isFocused: false
30
- });
31
- });
32
- };
33
-
34
- var value = {
35
- handleFocus: handleFocus,
36
- handleBlur: handleBlur,
37
- isFocused: state.isFocused
38
- };
39
- return /*#__PURE__*/jsx(TextFieldContext.Provider, {
40
- value: value,
41
- children: children
42
- });
43
- };
44
- var useTextField = function useTextField() {
45
- return useContext(TextFieldContext);
46
- };
47
-
48
- export { TextFieldProvider, useTextField };
@@ -1,120 +0,0 @@
1
- import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
- import { tokens as tokens$1 } from '@equinor/eds-tokens';
3
-
4
- var colors = tokens$1.colors,
5
- typography = tokens$1.typography,
6
- _tokens$spacings$comf = tokens$1.spacings.comfortable,
7
- small = _tokens$spacings$comf.small,
8
- x_small = _tokens$spacings$comf.x_small;
9
- var textfield = {
10
- background: colors.ui.background__light.hex,
11
- border: {
12
- type: 'border',
13
- radius: 0,
14
- width: '1px',
15
- color: colors.text.static_icons__tertiary.hex
16
- },
17
- spacings: {
18
- left: small,
19
- right: small,
20
- top: small
21
- },
22
- states: {
23
- focus: {
24
- outline: {
25
- width: '2px',
26
- color: colors.interactive.primary__resting.hex,
27
- style: 'solid',
28
- type: 'outline',
29
- offset: '0px'
30
- }
31
- },
32
- readOnly: {
33
- background: 'transparent',
34
- boxShadow: 'none'
35
- }
36
- },
37
- entities: {
38
- unit: {
39
- typography: _objectSpread(_objectSpread({}, typography.input.label), {}, {
40
- color: colors.text.static_icons__tertiary.hex
41
- }),
42
- states: {
43
- disabled: {
44
- typography: {
45
- color: colors.interactive.disabled__text.hex
46
- }
47
- }
48
- }
49
- }
50
- },
51
- modes: {
52
- compact: {
53
- spacings: {
54
- left: x_small,
55
- right: x_small,
56
- top: x_small,
57
- bottom: x_small
58
- }
59
- }
60
- }
61
- };
62
- var error = {
63
- border: {
64
- type: 'border',
65
- radius: 0,
66
- width: '1px',
67
- color: colors.interactive.danger__resting.hex
68
- },
69
- states: {
70
- focus: {
71
- outline: {
72
- width: '2px',
73
- color: colors.interactive.danger__hover.hex,
74
- style: 'solid',
75
- type: 'outline',
76
- offset: '0px'
77
- }
78
- }
79
- }
80
- };
81
- var warning = {
82
- border: {
83
- type: 'border',
84
- radius: 0,
85
- width: '1px',
86
- color: colors.interactive.warning__resting.hex
87
- },
88
- states: {
89
- focus: {
90
- outline: {
91
- width: '2px',
92
- color: colors.interactive.warning__hover.hex,
93
- style: 'solid',
94
- type: 'outline',
95
- offset: '0px'
96
- }
97
- }
98
- }
99
- };
100
- var success = {
101
- border: {
102
- type: 'border',
103
- radius: 0,
104
- width: '1px',
105
- color: colors.interactive.success__resting.hex
106
- },
107
- states: {
108
- focus: {
109
- outline: {
110
- width: '2px',
111
- color: colors.interactive.success__hover.hex,
112
- style: 'solid',
113
- type: 'outline',
114
- offset: '0px'
115
- }
116
- }
117
- }
118
- };
119
-
120
- export { error, success, textfield, warning };
@@ -1,4 +0,0 @@
1
- import type { ComponentToken } from '@equinor/eds-tokens';
2
- declare type SearchToken = ComponentToken;
3
- export declare const search: SearchToken;
4
- export {};
@@ -1,34 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import type { Variants } from './types';
3
- import type { TextFieldToken } from './TextField.tokens';
4
- declare type InputWrapperType = {
5
- isFocused: boolean;
6
- isDisabled: boolean;
7
- isReadOnly: boolean;
8
- variant: string;
9
- token: TextFieldToken;
10
- inputIcon?: ReactNode;
11
- unit?: string;
12
- multiline?: boolean;
13
- };
14
- export declare const InputWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, InputWrapperType, never>;
15
- export declare const Field: import("react").ForwardRefExoticComponent<{
16
- /** Specifies if input should be multiline*/
17
- multiline?: boolean;
18
- /** Placeholder */
19
- placeholder?: string;
20
- /** Variant */
21
- variant?: Variants;
22
- /** Disabled state */
23
- disabled?: boolean;
24
- /** Type */
25
- type?: string;
26
- /** Read Only */
27
- readOnly?: boolean;
28
- /** Unit text */
29
- unit?: string;
30
- inputIcon?: ReactNode;
31
- /** Specifies max rows for multiline input */
32
- rowsMax?: number;
33
- } & import("react").HTMLAttributes<HTMLInputElement | HTMLTextAreaElement> & import("react").RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
34
- export {};
@@ -1,14 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import type { Variants } from '../types';
3
- declare type TextfieldHelperTextProps = {
4
- /** Helper text */
5
- helperText?: string;
6
- /** Icon */
7
- icon?: ReactNode;
8
- /** Disabled */
9
- disabled?: boolean;
10
- /** Variant */
11
- variant: Variants;
12
- };
13
- declare const TextfieldHelperText: import("react").ForwardRefExoticComponent<TextfieldHelperTextProps & import("react").RefAttributes<HTMLDivElement>>;
14
- export { TextfieldHelperText as HelperText };
@@ -1 +0,0 @@
1
- export { HelperText } from './HelperText';
@@ -1,13 +0,0 @@
1
- import { HTMLAttributes } from 'react';
2
- import type { Variants, ColorStateProps } from '../types';
3
- declare const InputIcon: import("react").ForwardRefExoticComponent<{
4
- /** isDisabled */
5
- isDisabled?: boolean;
6
- /** Variant */
7
- variant?: Variants;
8
- /** Colors */
9
- colors?: ColorStateProps;
10
- /** Size */
11
- size?: 16 | 24;
12
- } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
13
- export { InputIcon as Icon };
@@ -1,14 +0,0 @@
1
- import type { Spacing } from '@equinor/eds-tokens';
2
- import { ColorStateProps } from '../types';
3
- declare type InputProps = {
4
- spacings: {
5
- comfortable: Spacing;
6
- compact: Spacing;
7
- };
8
- default: ColorStateProps;
9
- error: ColorStateProps;
10
- warning: ColorStateProps;
11
- success: ColorStateProps;
12
- };
13
- export declare const input: InputProps;
14
- export {};
@@ -1 +0,0 @@
1
- export { Icon } from './Icon';
@@ -1,17 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export declare const propsFor: {
3
- variants: string[];
4
- };
5
- declare type State = {
6
- isFocused: boolean;
7
- };
8
- declare type UseTextFieldProps<T> = {
9
- handleFocus: () => void;
10
- handleBlur: () => void;
11
- } & T;
12
- declare type ProviderProps = {
13
- children: ReactNode;
14
- };
15
- export declare const TextFieldProvider: ({ children }: ProviderProps) => JSX.Element;
16
- export declare const useTextField: () => UseTextFieldProps<State>;
17
- export {};
@@ -1,10 +0,0 @@
1
- import type { ComponentToken } from '@equinor/eds-tokens';
2
- export declare type TextFieldToken = ComponentToken & {
3
- entities?: {
4
- unit?: ComponentToken;
5
- };
6
- };
7
- export declare const textfield: TextFieldToken;
8
- export declare const error: TextFieldToken;
9
- export declare const warning: TextFieldToken;
10
- export declare const success: TextFieldToken;
@@ -1,6 +0,0 @@
1
- export declare type Variants = 'error' | 'warning' | 'success' | 'default';
2
- export declare type ColorStateProps = {
3
- color: string;
4
- disabledColor: string;
5
- focusColor: string;
6
- };