@equinor/eds-core-react 0.24.0-dev.20221007 → 0.25.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/dist/eds-core-react.cjs.js +1027 -1321
- package/dist/esm/components/Accordion/AccordionHeader.js +10 -5
- package/dist/esm/components/Autocomplete/Autocomplete.js +62 -67
- package/dist/esm/components/Autocomplete/Autocomplete.tokens.js +1 -0
- package/dist/esm/components/Input/Input.js +129 -32
- package/dist/esm/components/Input/Input.tokens.js +84 -56
- package/dist/esm/components/InputWrapper/HelperText/HelperText.js +49 -0
- package/dist/esm/components/InputWrapper/HelperText/HelperText.token.js +28 -0
- package/dist/esm/components/InputWrapper/InputWrapper.js +68 -0
- package/dist/esm/components/InputWrapper/InputWrapper.tokens.js +164 -0
- package/dist/esm/components/Popover/Popover.js +69 -54
- package/dist/esm/components/Popover/Popover.tokens.js +17 -2
- package/dist/esm/components/Search/Search.js +60 -187
- package/dist/esm/components/TextField/TextField.js +52 -46
- package/dist/esm/components/Textarea/Textarea.js +26 -43
- package/dist/esm/components/Tooltip/Tooltip.js +37 -36
- package/dist/esm/index.js +1 -0
- package/dist/types/components/Input/Input.d.ts +22 -15
- package/dist/types/components/InputWrapper/HelperText/HelperText.d.ts +18 -0
- package/dist/types/components/{TextField → InputWrapper}/HelperText/HelperText.token.d.ts +0 -5
- package/dist/types/components/InputWrapper/HelperText/index.d.ts +1 -0
- package/dist/types/components/InputWrapper/InputWrapper.d.ts +41 -0
- package/dist/types/components/InputWrapper/InputWrapper.tokens.d.ts +12 -0
- package/dist/types/components/InputWrapper/index.d.ts +2 -0
- package/dist/types/components/Popover/Popover.d.ts +10 -0
- package/dist/types/components/Search/Search.d.ts +2 -2
- package/dist/types/components/Select/commonStyles.d.ts +1 -7
- package/dist/types/components/TextField/TextField.d.ts +15 -21
- package/dist/types/components/Textarea/Textarea.d.ts +3 -3
- package/dist/types/components/types.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +4 -4
- package/dist/esm/components/Search/Search.tokens.js +0 -83
- package/dist/esm/components/TextField/Field.js +0 -151
- package/dist/esm/components/TextField/HelperText/HelperText.js +0 -89
- package/dist/esm/components/TextField/HelperText/HelperText.token.js +0 -45
- package/dist/esm/components/TextField/Icon/Icon.js +0 -65
- package/dist/esm/components/TextField/Icon/Icon.tokens.js +0 -42
- package/dist/esm/components/TextField/TextField.context.js +0 -48
- package/dist/esm/components/TextField/TextField.tokens.js +0 -120
- package/dist/types/components/Search/Search.tokens.d.ts +0 -4
- package/dist/types/components/TextField/Field.d.ts +0 -34
- package/dist/types/components/TextField/HelperText/HelperText.d.ts +0 -14
- package/dist/types/components/TextField/HelperText/index.d.ts +0 -1
- package/dist/types/components/TextField/Icon/Icon.d.ts +0 -13
- package/dist/types/components/TextField/Icon/Icon.tokens.d.ts +0 -14
- package/dist/types/components/TextField/Icon/index.d.ts +0 -1
- package/dist/types/components/TextField/TextField.context.d.ts +0 -17
- package/dist/types/components/TextField/TextField.tokens.d.ts +0 -10
- package/dist/types/components/TextField/types.d.ts +0 -6
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
export declare type HelperTextProps = {
|
|
3
|
+
/** Helper text */
|
|
4
|
+
text?: string;
|
|
5
|
+
/** Icon */
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
/** Color */
|
|
8
|
+
color?: string;
|
|
9
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
10
|
+
declare const TextfieldHelperText: import("react").ForwardRefExoticComponent<{
|
|
11
|
+
/** Helper text */
|
|
12
|
+
text?: string;
|
|
13
|
+
/** Icon */
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
/** Color */
|
|
16
|
+
color?: string;
|
|
17
|
+
} & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export { TextfieldHelperText as HelperText };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Spacing, Typography } from '@equinor/eds-tokens';
|
|
2
|
-
import { ColorStateProps } from '../types';
|
|
3
2
|
export declare type HelperTextProps = {
|
|
4
3
|
background: string;
|
|
5
4
|
typography: Typography;
|
|
@@ -7,9 +6,5 @@ export declare type HelperTextProps = {
|
|
|
7
6
|
comfortable: Spacing;
|
|
8
7
|
compact: Spacing;
|
|
9
8
|
};
|
|
10
|
-
default: ColorStateProps;
|
|
11
|
-
error: ColorStateProps;
|
|
12
|
-
warning: ColorStateProps;
|
|
13
|
-
success: ColorStateProps;
|
|
14
9
|
};
|
|
15
10
|
export declare const helperText: HelperTextProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './HelperText';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { LabelProps } from '../Label';
|
|
3
|
+
import { HelperTextProps } from './HelperText';
|
|
4
|
+
import { Variants } from '../types';
|
|
5
|
+
export declare type InputWrapperProps = {
|
|
6
|
+
/** Label */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Disabled state */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Read Only */
|
|
11
|
+
readOnly?: boolean;
|
|
12
|
+
/** Highlight color */
|
|
13
|
+
color?: Variants;
|
|
14
|
+
/** Label props */
|
|
15
|
+
labelProps?: LabelProps;
|
|
16
|
+
/** Helpertext props */
|
|
17
|
+
helperProps?: HelperTextProps;
|
|
18
|
+
/** Helper Icon */
|
|
19
|
+
helperIcon?: ReactNode;
|
|
20
|
+
/** Input or Textarea element */
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
23
|
+
/** InputWrapper is a internal skeleton component for structuring input elements */
|
|
24
|
+
export declare const InputWrapper: import("react").ForwardRefExoticComponent<{
|
|
25
|
+
/** Label */
|
|
26
|
+
label?: string;
|
|
27
|
+
/** Disabled state */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/** Read Only */
|
|
30
|
+
readOnly?: boolean;
|
|
31
|
+
/** Highlight color */
|
|
32
|
+
color?: Variants;
|
|
33
|
+
/** Label props */
|
|
34
|
+
labelProps?: LabelProps;
|
|
35
|
+
/** Helpertext props */
|
|
36
|
+
helperProps?: HelperTextProps;
|
|
37
|
+
/** Helper Icon */
|
|
38
|
+
helperIcon?: ReactNode;
|
|
39
|
+
/** Input or Textarea element */
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
} & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ComponentToken } from '@equinor/eds-tokens';
|
|
2
|
+
export declare type InputToken = ComponentToken;
|
|
3
|
+
export declare const input: InputToken;
|
|
4
|
+
export declare const error: InputToken;
|
|
5
|
+
export declare const warning: InputToken;
|
|
6
|
+
export declare const success: InputToken;
|
|
7
|
+
export declare const inputToken: {
|
|
8
|
+
input: ComponentToken;
|
|
9
|
+
error: ComponentToken;
|
|
10
|
+
warning: ComponentToken;
|
|
11
|
+
success: ComponentToken;
|
|
12
|
+
};
|
|
@@ -9,6 +9,11 @@ export declare type PopoverProps = {
|
|
|
9
9
|
anchorEl?: HTMLElement | null;
|
|
10
10
|
/** Is Popover open */
|
|
11
11
|
open: boolean;
|
|
12
|
+
/** initializes react portal for dropdown, default to false. */
|
|
13
|
+
withinPortal?: boolean;
|
|
14
|
+
/** Determines whether focus should be trapped within dropdown,
|
|
15
|
+
* default to false. */
|
|
16
|
+
trapFocus?: boolean;
|
|
12
17
|
} & HTMLAttributes<HTMLDivElement>;
|
|
13
18
|
export declare const Popover: import("react").ForwardRefExoticComponent<{
|
|
14
19
|
/** Popover placement relative to anchor */
|
|
@@ -19,4 +24,9 @@ export declare const Popover: import("react").ForwardRefExoticComponent<{
|
|
|
19
24
|
anchorEl?: HTMLElement | null;
|
|
20
25
|
/** Is Popover open */
|
|
21
26
|
open: boolean;
|
|
27
|
+
/** initializes react portal for dropdown, default to false. */
|
|
28
|
+
withinPortal?: boolean;
|
|
29
|
+
/** Determines whether focus should be trapped within dropdown,
|
|
30
|
+
* default to false. */
|
|
31
|
+
trapFocus?: boolean;
|
|
22
32
|
} & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { InputHTMLAttributes
|
|
1
|
+
import { InputHTMLAttributes } from 'react';
|
|
2
2
|
export declare type SearchProps = InputHTMLAttributes<HTMLInputElement>;
|
|
3
|
-
export declare const Search: import("react").ForwardRefExoticComponent<SearchProps & RefAttributes<HTMLInputElement>>;
|
|
3
|
+
export declare const Search: import("react").ForwardRefExoticComponent<SearchProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -5,13 +5,7 @@ declare type StyledListItemType = {
|
|
|
5
5
|
active?: string;
|
|
6
6
|
};
|
|
7
7
|
export declare const Container: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, ContainerProps, never>;
|
|
8
|
-
export declare const PaddedInput: import("styled-components").StyledComponent<import("
|
|
9
|
-
placeholder?: string;
|
|
10
|
-
variant?: import("../TextField/types").Variants;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
type?: string;
|
|
13
|
-
readOnly?: boolean;
|
|
14
|
-
} & import("react").InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>, import("styled-components").DefaultTheme, {}, never>;
|
|
8
|
+
export declare const PaddedInput: import("styled-components").StyledComponent<import("@equinor/eds-utils").OverridableComponent<import("../Input").InputProps, HTMLInputElement>, import("styled-components").DefaultTheme, {}, never>;
|
|
15
9
|
export declare const StyledList: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<{
|
|
16
10
|
variant?: "bullet" | "numbered";
|
|
17
11
|
start?: string;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { ReactNode, InputHTMLAttributes, TextareaHTMLAttributes,
|
|
2
|
-
import type { Variants } from '
|
|
3
|
-
|
|
4
|
-
/** @ignore */
|
|
5
|
-
className?: string;
|
|
1
|
+
import { ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, ForwardedRef } from 'react';
|
|
2
|
+
import type { Variants } from '../types';
|
|
3
|
+
declare type SharedTextFieldProps = {
|
|
6
4
|
/** Variants */
|
|
7
5
|
variant?: Variants;
|
|
8
|
-
/** Input unique id */
|
|
6
|
+
/** Input unique id. This is required to ensure accesibility */
|
|
9
7
|
id: string;
|
|
10
8
|
/** Label text */
|
|
11
9
|
label?: string;
|
|
@@ -15,23 +13,19 @@ export declare type TextFieldProps = {
|
|
|
15
13
|
unit?: string;
|
|
16
14
|
/** Helper text */
|
|
17
15
|
helperText?: string;
|
|
18
|
-
/** Placeholder text */
|
|
19
|
-
placeholder?: string;
|
|
20
|
-
/** Disabled */
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
/** Multiline input */
|
|
23
|
-
multiline?: boolean;
|
|
24
|
-
/** Specifies max rows for multiline input */
|
|
25
|
-
rowsMax?: number;
|
|
26
|
-
/** Input ref */
|
|
27
|
-
inputRef?: Ref<HTMLInputElement> | Ref<HTMLTextAreaElement>;
|
|
28
16
|
/** InputIcon */
|
|
29
17
|
inputIcon?: ReactNode;
|
|
30
18
|
/** HelperIcon */
|
|
31
19
|
helperIcon?: ReactNode;
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
|
|
20
|
+
/** Maximum number of rows if `multiline` is set to `true` */
|
|
21
|
+
rowsMax?: number;
|
|
22
|
+
/** Input ref */
|
|
23
|
+
inputRef?: ForwardedRef<HTMLInputElement>;
|
|
24
|
+
/** Textarea ref when multiline is set to `true` */
|
|
25
|
+
textareaRef?: ForwardedRef<HTMLTextAreaElement>;
|
|
26
|
+
/** If `true` a `textarea` is rendered for multiline support. Make sure to use `textareaRef` if you need to access reference element */
|
|
27
|
+
multiline?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare type TextFieldProps = SharedTextFieldProps & (TextareaHTMLAttributes<HTMLTextAreaElement> | InputHTMLAttributes<HTMLInputElement>);
|
|
37
30
|
export declare const TextField: import("react").ForwardRefExoticComponent<TextFieldProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
31
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TextareaHTMLAttributes } from 'react';
|
|
2
|
-
import type { Variants } from '../
|
|
2
|
+
import type { Variants } from '../types';
|
|
3
3
|
export declare type TextareaProps = {
|
|
4
4
|
/** Placeholder */
|
|
5
5
|
placeholder?: string;
|
|
@@ -11,7 +11,7 @@ export declare type TextareaProps = {
|
|
|
11
11
|
type?: string;
|
|
12
12
|
/** Read Only */
|
|
13
13
|
readOnly?: boolean;
|
|
14
|
-
/** Specifies max rows for multiline
|
|
14
|
+
/** Specifies max rows for multiline */
|
|
15
15
|
rowsMax?: number;
|
|
16
16
|
} & TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
17
17
|
export declare const Textarea: import("react").ForwardRefExoticComponent<{
|
|
@@ -25,6 +25,6 @@ export declare const Textarea: import("react").ForwardRefExoticComponent<{
|
|
|
25
25
|
type?: string;
|
|
26
26
|
/** Read Only */
|
|
27
27
|
readOnly?: boolean;
|
|
28
|
-
/** Specifies max rows for multiline
|
|
28
|
+
/** Specifies max rows for multiline */
|
|
29
29
|
rowsMax?: number;
|
|
30
30
|
} & TextareaHTMLAttributes<HTMLTextAreaElement> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type Variants = 'error' | 'warning' | 'success';
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/eds-core-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "The React implementation of the Equinor Design System",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css"
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@babel/runtime": "^7.19.0",
|
|
82
|
-
"@equinor/eds-icons": "0.15.0
|
|
83
|
-
"@equinor/eds-tokens": "0.
|
|
84
|
-
"@equinor/eds-utils": "0.
|
|
82
|
+
"@equinor/eds-icons": "0.15.0",
|
|
83
|
+
"@equinor/eds-tokens": "0.9.0",
|
|
84
|
+
"@equinor/eds-utils": "0.6.0",
|
|
85
85
|
"@floating-ui/react-dom-interactions": "^0.10.1",
|
|
86
86
|
"downshift": "^6.1.12"
|
|
87
87
|
},
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { tokens } from '@equinor/eds-tokens';
|
|
2
|
-
|
|
3
|
-
var _tokens$colors = tokens.colors,
|
|
4
|
-
background = _tokens$colors.ui.background__light.rgba,
|
|
5
|
-
_tokens$colors$intera = _tokens$colors.interactive,
|
|
6
|
-
primaryHoverAlt = _tokens$colors$intera.primary__hover_alt.rgba,
|
|
7
|
-
primaryColor = _tokens$colors$intera.primary__resting.rgba,
|
|
8
|
-
placeholderColor = _tokens$colors.text.static_icons__tertiary.rgba,
|
|
9
|
-
small = tokens.spacings.comfortable.small,
|
|
10
|
-
typography = tokens.typography.input.text,
|
|
11
|
-
shape = tokens.shape;
|
|
12
|
-
var search = {
|
|
13
|
-
background: background,
|
|
14
|
-
typography: typography,
|
|
15
|
-
height: '36px',
|
|
16
|
-
clickbound: {
|
|
17
|
-
offset: {
|
|
18
|
-
top: '6px'
|
|
19
|
-
},
|
|
20
|
-
height: '48px'
|
|
21
|
-
},
|
|
22
|
-
spacings: {
|
|
23
|
-
left: small,
|
|
24
|
-
right: small
|
|
25
|
-
},
|
|
26
|
-
border: {
|
|
27
|
-
type: 'border',
|
|
28
|
-
width: '1px',
|
|
29
|
-
style: 'solid',
|
|
30
|
-
color: 'transparent'
|
|
31
|
-
},
|
|
32
|
-
states: {
|
|
33
|
-
focus: {
|
|
34
|
-
border: {
|
|
35
|
-
type: 'border',
|
|
36
|
-
width: '1px',
|
|
37
|
-
style: 'solid',
|
|
38
|
-
color: primaryColor
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
entities: {
|
|
43
|
-
placeholder: {
|
|
44
|
-
typography: {
|
|
45
|
-
color: placeholderColor
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
icon: {
|
|
49
|
-
typography: {
|
|
50
|
-
color: placeholderColor
|
|
51
|
-
},
|
|
52
|
-
border: {
|
|
53
|
-
type: 'border',
|
|
54
|
-
radius: '50%'
|
|
55
|
-
},
|
|
56
|
-
states: {
|
|
57
|
-
hover: {
|
|
58
|
-
background: primaryHoverAlt
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
clickbound: {
|
|
62
|
-
offset: {
|
|
63
|
-
top: '6px'
|
|
64
|
-
},
|
|
65
|
-
height: '36px'
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
button: {
|
|
69
|
-
height: '24px',
|
|
70
|
-
width: '24px',
|
|
71
|
-
spacings: {
|
|
72
|
-
right: small
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
modes: {
|
|
77
|
-
compact: {
|
|
78
|
-
height: shape._modes.compact.straight.minHeight
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export { search };
|
|
@@ -1,151 +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 { useTextField } from './TextField.context.js';
|
|
5
|
-
import styled, { css } from 'styled-components';
|
|
6
|
-
import { typographyTemplate, outlineTemplate } from '@equinor/eds-utils';
|
|
7
|
-
import * as TextField_tokens from './TextField.tokens.js';
|
|
8
|
-
import { textfield as textfield$1 } from './TextField.tokens.js';
|
|
9
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
-
import { Input } from '../Input/Input.js';
|
|
11
|
-
import { Textarea } from '../Textarea/Textarea.js';
|
|
12
|
-
import { Icon as InputIcon } from './Icon/Icon.js';
|
|
13
|
-
import { useEds } from '../EdsProvider/eds.context.js';
|
|
14
|
-
|
|
15
|
-
var _excluded = ["multiline", "variant", "disabled", "readOnly", "type", "unit", "inputIcon", "rowsMax", "onBlur", "onFocus"];
|
|
16
|
-
var textfield = textfield$1;
|
|
17
|
-
|
|
18
|
-
var Variation = function Variation(_ref) {
|
|
19
|
-
var _token$border, _token$border2, _token$border3, _token$border4;
|
|
20
|
-
|
|
21
|
-
var variant = _ref.variant,
|
|
22
|
-
isFocused = _ref.isFocused,
|
|
23
|
-
token = _ref.token;
|
|
24
|
-
|
|
25
|
-
if (!variant) {
|
|
26
|
-
return "";
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return css(["box-shadow:", ";", ""], isFocused ? "none" : variant === 'default' ? "inset 0 -1px 0 0 ".concat(((_token$border = token.border) === null || _token$border === void 0 ? void 0 : _token$border.type) === 'border' && ((_token$border2 = token.border) === null || _token$border2 === void 0 ? void 0 : _token$border2.color)) : "0 0 0 1px ".concat(((_token$border3 = token.border) === null || _token$border3 === void 0 ? void 0 : _token$border3.type) === 'border' && ((_token$border4 = token.border) === null || _token$border4 === void 0 ? void 0 : _token$border4.color)), isFocused && outlineTemplate(token.states.focus.outline));
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
var StrippedInput = styled(Input).withConfig({
|
|
33
|
-
displayName: "Field__StrippedInput",
|
|
34
|
-
componentId: "sc-455b88-0"
|
|
35
|
-
})(["outline:none;&:active,&:focus{outline:none;box-shadow:none;}"]);
|
|
36
|
-
var StrippedTextarea = styled(Textarea).withConfig({
|
|
37
|
-
displayName: "Field__StrippedTextarea",
|
|
38
|
-
componentId: "sc-455b88-1"
|
|
39
|
-
})(["outline:none;&:active,&:focus{outline:none;box-shadow:none;}"]);
|
|
40
|
-
var InputWrapper = styled.div.withConfig({
|
|
41
|
-
displayName: "Field__InputWrapper",
|
|
42
|
-
componentId: "sc-455b88-2"
|
|
43
|
-
})(function (_ref2) {
|
|
44
|
-
var inputIcon = _ref2.inputIcon,
|
|
45
|
-
unit = _ref2.unit,
|
|
46
|
-
isDisabled = _ref2.isDisabled,
|
|
47
|
-
isReadOnly = _ref2.isReadOnly,
|
|
48
|
-
multiline = _ref2.multiline,
|
|
49
|
-
variant = _ref2.variant;
|
|
50
|
-
return css(["", " ", " ", " ", " ", ""], Variation, (inputIcon || unit) && css(["display:flex;align-items:center;background:", ";padding-right:", ";"], textfield.background, textfield.spacings.right), isReadOnly && css(["box-shadow:", ";background:", ";"], textfield.states.readOnly.boxShadow, textfield.states.readOnly.background), isDisabled && css(["box-shadow:none;cursor:not-allowed;outline:none;"]), multiline && variant === 'default' && !inputIcon && !unit && css(["box-shadow:none;"]));
|
|
51
|
-
});
|
|
52
|
-
var Unit = styled.span.withConfig({
|
|
53
|
-
displayName: "Field__Unit",
|
|
54
|
-
componentId: "sc-455b88-3"
|
|
55
|
-
})(["", ";display:inline-block;margin-top:3px;", ""], typographyTemplate(textfield.entities.unit.typography), function (_ref3) {
|
|
56
|
-
var isDisabled = _ref3.isDisabled;
|
|
57
|
-
return isDisabled && {
|
|
58
|
-
color: textfield.entities.unit.states.disabled.typography.color
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
var Adornments = styled.div.withConfig({
|
|
62
|
-
displayName: "Field__Adornments",
|
|
63
|
-
componentId: "sc-455b88-4"
|
|
64
|
-
})(["display:flex;align-items:center;justify-content:center;height:100%;margin-left:", ";& div:nth-child(2){margin-left:", ";}", ""], textfield.spacings.left, textfield.spacings.left, function (_ref4) {
|
|
65
|
-
var multiline = _ref4.multiline,
|
|
66
|
-
theme = _ref4.theme;
|
|
67
|
-
return multiline && {
|
|
68
|
-
marginTop: theme.spacings.top,
|
|
69
|
-
alignSelf: 'start'
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
var Field = /*#__PURE__*/forwardRef(function Field(_ref5, ref) {
|
|
73
|
-
var multiline = _ref5.multiline,
|
|
74
|
-
variant = _ref5.variant,
|
|
75
|
-
disabled = _ref5.disabled,
|
|
76
|
-
readOnly = _ref5.readOnly,
|
|
77
|
-
type = _ref5.type,
|
|
78
|
-
unit = _ref5.unit,
|
|
79
|
-
inputIcon = _ref5.inputIcon,
|
|
80
|
-
rowsMax = _ref5.rowsMax,
|
|
81
|
-
onBlur = _ref5.onBlur,
|
|
82
|
-
onFocus = _ref5.onFocus,
|
|
83
|
-
other = _objectWithoutProperties(_ref5, _excluded);
|
|
84
|
-
|
|
85
|
-
var _useTextField = useTextField(),
|
|
86
|
-
handleFocus = _useTextField.handleFocus,
|
|
87
|
-
handleBlur = _useTextField.handleBlur,
|
|
88
|
-
isFocused = _useTextField.isFocused;
|
|
89
|
-
|
|
90
|
-
var _useEds = useEds(),
|
|
91
|
-
density = _useEds.density;
|
|
92
|
-
|
|
93
|
-
var iconSize = density === 'compact' ? 16 : 24;
|
|
94
|
-
var actualVariant = variant === 'default' ? 'textfield' : variant;
|
|
95
|
-
var inputVariant = TextField_tokens[actualVariant];
|
|
96
|
-
var isError = actualVariant === 'error';
|
|
97
|
-
|
|
98
|
-
var focusHandler = function focusHandler(e) {
|
|
99
|
-
handleFocus();
|
|
100
|
-
onFocus && onFocus(e);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
var blurHandler = function blurHandler(e) {
|
|
104
|
-
handleBlur();
|
|
105
|
-
onBlur && onBlur(e);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
var inputWrapperProps = {
|
|
109
|
-
isFocused: isFocused,
|
|
110
|
-
isDisabled: disabled,
|
|
111
|
-
isReadOnly: readOnly,
|
|
112
|
-
variant: variant,
|
|
113
|
-
token: inputVariant,
|
|
114
|
-
inputIcon: inputIcon,
|
|
115
|
-
unit: unit,
|
|
116
|
-
multiline: multiline
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
var inputProps = _objectSpread({
|
|
120
|
-
ref: ref,
|
|
121
|
-
'aria-invalid': isError,
|
|
122
|
-
type: type,
|
|
123
|
-
disabled: disabled,
|
|
124
|
-
readOnly: readOnly,
|
|
125
|
-
variant: variant,
|
|
126
|
-
onBlur: blurHandler,
|
|
127
|
-
onFocus: focusHandler
|
|
128
|
-
}, other);
|
|
129
|
-
|
|
130
|
-
var textareaProps = _objectSpread(_objectSpread({}, inputProps), {}, {
|
|
131
|
-
rowsMax: rowsMax,
|
|
132
|
-
ref: ref
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
return /*#__PURE__*/jsxs(InputWrapper, _objectSpread(_objectSpread({}, inputWrapperProps), {}, {
|
|
136
|
-
children: [multiline ? /*#__PURE__*/jsx(StrippedTextarea, _objectSpread({}, textareaProps)) : /*#__PURE__*/jsx(StrippedInput, _objectSpread({}, inputProps)), (inputIcon || unit) && /*#__PURE__*/jsxs(Adornments, {
|
|
137
|
-
multiline: multiline,
|
|
138
|
-
children: [unit && /*#__PURE__*/jsx(Unit, {
|
|
139
|
-
isDisabled: disabled,
|
|
140
|
-
children: unit
|
|
141
|
-
}), inputIcon && /*#__PURE__*/jsx(InputIcon, {
|
|
142
|
-
isDisabled: disabled,
|
|
143
|
-
variant: variant,
|
|
144
|
-
size: iconSize,
|
|
145
|
-
children: inputIcon
|
|
146
|
-
})]
|
|
147
|
-
})]
|
|
148
|
-
}));
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
export { Field, InputWrapper };
|
|
@@ -1,89 +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 { typographyTemplate } from '@equinor/eds-utils';
|
|
6
|
-
import { helperText } from './HelperText.token.js';
|
|
7
|
-
import { useTextField } from '../TextField.context.js';
|
|
8
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
9
|
-
import { Icon as InputIcon } from '../Icon/Icon.js';
|
|
10
|
-
|
|
11
|
-
var _excluded = ["helperText", "icon", "variant", "disabled"];
|
|
12
|
-
|
|
13
|
-
var Variation = function Variation(_ref) {
|
|
14
|
-
var variant = _ref.variant,
|
|
15
|
-
isFocused = _ref.isFocused,
|
|
16
|
-
isDisabled = _ref.isDisabled;
|
|
17
|
-
|
|
18
|
-
if (!variant) {
|
|
19
|
-
return "";
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var focusColor = variant.focusColor,
|
|
23
|
-
color = variant.color,
|
|
24
|
-
disabledColor = variant.disabledColor;
|
|
25
|
-
|
|
26
|
-
if (isDisabled) {
|
|
27
|
-
return css(["color:", ";"], disabledColor);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (isFocused) {
|
|
31
|
-
return css(["color:", ";"], focusColor);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return css(["color:", ";"], color);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
var Container = styled.div.withConfig({
|
|
38
|
-
displayName: "HelperText__Container",
|
|
39
|
-
componentId: "sc-1kfkyxg-0"
|
|
40
|
-
})(["display:flex;align-items:flex-start;margin-top:", ";"], function (_ref2) {
|
|
41
|
-
var spacings = _ref2.spacings;
|
|
42
|
-
return spacings.top;
|
|
43
|
-
});
|
|
44
|
-
var Text = styled.p.withConfig({
|
|
45
|
-
displayName: "HelperText__Text",
|
|
46
|
-
componentId: "sc-1kfkyxg-1"
|
|
47
|
-
})(["", " margin:0 0 0 ", ";", ""], typographyTemplate(helperText.typography), function (_ref3) {
|
|
48
|
-
var spacings = _ref3.spacings;
|
|
49
|
-
return spacings.left;
|
|
50
|
-
}, Variation);
|
|
51
|
-
var TextfieldHelperText = /*#__PURE__*/forwardRef(function TextfieldHelperText(_ref4, ref) {
|
|
52
|
-
var helperText$1 = _ref4.helperText,
|
|
53
|
-
icon = _ref4.icon,
|
|
54
|
-
_ref4$variant = _ref4.variant,
|
|
55
|
-
variant = _ref4$variant === void 0 ? 'default' : _ref4$variant,
|
|
56
|
-
isDisabled = _ref4.disabled,
|
|
57
|
-
rest = _objectWithoutProperties(_ref4, _excluded);
|
|
58
|
-
|
|
59
|
-
var helperVariant = helperText[variant];
|
|
60
|
-
var spacings = helperText.spacings.comfortable;
|
|
61
|
-
|
|
62
|
-
var _useTextField = useTextField(),
|
|
63
|
-
isFocused = _useTextField.isFocused;
|
|
64
|
-
|
|
65
|
-
var colors = {
|
|
66
|
-
color: helperVariant.color,
|
|
67
|
-
disabledColor: helperVariant.disabledColor,
|
|
68
|
-
focusColor: helperVariant.focusColor
|
|
69
|
-
};
|
|
70
|
-
return /*#__PURE__*/jsxs(Container, _objectSpread(_objectSpread({
|
|
71
|
-
ref: ref
|
|
72
|
-
}, rest), {}, {
|
|
73
|
-
spacings: spacings,
|
|
74
|
-
children: [icon && /*#__PURE__*/jsx(InputIcon, {
|
|
75
|
-
isDisabled: isDisabled,
|
|
76
|
-
colors: colors,
|
|
77
|
-
size: 16,
|
|
78
|
-
children: icon
|
|
79
|
-
}), /*#__PURE__*/jsx(Text, {
|
|
80
|
-
variant: helperVariant,
|
|
81
|
-
isFocused: isFocused,
|
|
82
|
-
isDisabled: isDisabled,
|
|
83
|
-
spacings: spacings,
|
|
84
|
-
children: helperText$1
|
|
85
|
-
})]
|
|
86
|
-
}));
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
export { TextfieldHelperText as HelperText };
|
|
@@ -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 };
|