@atlaskit/textfield 6.8.3 → 8.0.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.
@@ -1,174 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
- import { media } from '@atlaskit/primitives';
6
- import { B200, N0, N10, N100, N200, N30, N70, N900, R400 } from '@atlaskit/theme/colors';
7
- var backgroundColor = {
8
- standard: "var(--ds-background-input, ".concat(N10, ")"),
9
- subtle: 'transparent',
10
- none: 'transparent'
11
- };
12
- var backgroundColorFocus = {
13
- standard: "var(--ds-background-input-pressed, ".concat(N0, ")"),
14
- subtle: "var(--ds-background-input-pressed, ".concat(N0, ")"),
15
- none: 'transparent'
16
- };
17
- var backgroundColorHover = {
18
- standard: "var(--ds-background-input-hovered, ".concat(N30, ")"),
19
- subtle: "var(--ds-background-input-hovered, ".concat(N30, ")"),
20
- none: 'transparent'
21
- };
22
- var borderColor = {
23
- standard: "var(--ds-border-input, ".concat(N100, ")"),
24
- subtle: 'transparent',
25
- none: 'transparent'
26
- };
27
- var borderColorFocus = {
28
- standard: "var(--ds-border-focused, ".concat(B200, ")"),
29
- subtle: "var(--ds-border-focused, ".concat(B200, ")"),
30
- none: 'transparent'
31
- };
32
- var borderColorHover = {
33
- standard: "var(--ds-border-input, ".concat(N100, ")"),
34
- subtle: "var(--ds-border-input, transparent)",
35
- none: 'transparent'
36
- };
37
- var getContainerTextBgAndBorderColor = function getContainerTextBgAndBorderColor(appearance) {
38
- return {
39
- backgroundColor: backgroundColor[appearance],
40
- borderColor: borderColor[appearance],
41
- color: "var(--ds-text, ".concat(N900, ")"),
42
- cursor: 'text',
43
- '&:hover:not([data-disabled])': {
44
- backgroundColor: backgroundColorHover[appearance],
45
- borderColor: borderColorHover[appearance]
46
- },
47
- '&:focus-within:not([data-disabled])': {
48
- backgroundColor: backgroundColorFocus[appearance],
49
- borderColor: borderColorFocus[appearance],
50
- boxShadow: "inset 0 0 0 ".concat("var(--ds-border-width, 1px)", " ", borderColorFocus[appearance])
51
- },
52
- '&[data-disabled]': _objectSpread({
53
- color: "var(--ds-text-disabled, ".concat(N70, ")"),
54
- cursor: 'not-allowed'
55
- }, appearance === 'standard' && {
56
- backgroundColor: "var(--ds-background-disabled, ".concat(N10, ")"),
57
- borderColor: "var(--ds-background-disabled, ".concat(N10, ")")
58
- }),
59
- '&[data-invalid], &[data-invalid]:hover': {
60
- borderColor: "var(--ds-border-danger, ".concat(R400, ")"),
61
- boxShadow: "inset 0 0 0 ".concat("var(--ds-border-width, 1px)", " ", "var(--ds-border-danger, ".concat(R400, ")"))
62
- },
63
- '&[data-invalid]:focus-within': {
64
- backgroundColor: "var(--ds-background-input-pressed, ".concat(N0, ")"),
65
- borderColor: "var(--ds-border-focused, ".concat(B200, ")"),
66
- boxShadow: "inset 0 0 0 ".concat("var(--ds-border-width, 1px)", " ", "var(--ds-border-focused, ".concat(B200, ")"))
67
- },
68
- '@media screen and (-ms-high-contrast: active)': {
69
- '&[data-invalid]:focus-within': {
70
- borderColor: 'Highlight'
71
- },
72
- '&:focus-within': {
73
- borderColor: 'Highlight'
74
- },
75
- '&[data-disabled]': {
76
- borderColor: 'GrayText'
77
- }
78
- }
79
- };
80
- };
81
- var widthMap = {
82
- xsmall: 80,
83
- small: 160,
84
- medium: 240,
85
- large: 320,
86
- xlarge: 480
87
- };
88
- var getMaxWidth = function getMaxWidth(width) {
89
- return !width ? "100%" : width in widthMap ? widthMap[width] : +width;
90
- };
91
- export var containerStyles = function containerStyles(appearance, width) {
92
- return _objectSpread(_objectSpread(_objectSpread({
93
- alignItems: 'center'
94
- }, getContainerTextBgAndBorderColor(appearance)), {}, {
95
- borderRadius: 3,
96
- borderWidth: "var(--ds-border-width, 1px)"
97
- }, appearance !== 'none' ? {
98
- padding: "var(--ds-border-width, 1px)".concat(" 0")
99
- } : {}), {}, {
100
- borderStyle: appearance === 'none' ? 'none' : 'solid',
101
- boxSizing: 'border-box',
102
- display: 'flex',
103
- flex: '1 1 100%',
104
- font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
105
- justifyContent: 'space-between',
106
- maxWidth: getMaxWidth(width),
107
- overflow: 'hidden',
108
- transition: "background-color 0.2s ease-in-out, border-color 0.2s ease-in-out",
109
- wordWrap: 'break-word',
110
- verticalAlign: 'top',
111
- pointerEvents: 'auto'
112
- });
113
- };
114
- export var inputStyles = function inputStyles() {
115
- return _defineProperty({
116
- backgroundColor: 'transparent',
117
- border: 0,
118
- boxSizing: 'border-box',
119
- color: 'inherit',
120
- cursor: 'inherit',
121
- font: fg('platform_design_system_team_safari_input_fix') ? "var(--ds-font-body-large, normal 400 16px/24px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)" : "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
122
- minWidth: '0',
123
- outline: 'none',
124
- width: '100%',
125
- '&[data-monospaced]': _defineProperty({
126
- fontFamily: "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)"
127
- }, media.above.xs, {
128
- // Reapply the monospaced font family as the font declaration in a breakpoint on the root will override it otherwise
129
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
130
- fontFamily: fg('platform_design_system_team_safari_input_fix') ? "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)" : undefined
131
- }),
132
- '&[data-compact]': {
133
- padding: fg('platform_design_system_team_safari_input_fix') ? "var(--ds-space-025, 2px)".concat(" ", "var(--ds-space-075, 6px)") : "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-075, 6px)")
134
- },
135
- '&:not([data-compact])': {
136
- padding: fg('platform_design_system_team_safari_input_fix') ? "var(--ds-space-075, 6px)".concat(" ", "var(--ds-space-075, 6px)") : "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-075, 6px)")
137
- },
138
- '&[disabled]': {
139
- // Safari (WebKit) adds a -webkit-text-fill-color style to disabled inputs
140
- // which takes priority over color and makes the text unreadable. Need to
141
- // override it with the color we want.
142
- WebkitTextFillColor: "var(--ds-text-disabled, ".concat(N70, ")")
143
- },
144
- // Hide the clear indicator on Edge (Windows only)
145
- '&::-ms-clear': {
146
- display: 'none'
147
- },
148
- '&:invalid': {
149
- boxShadow: 'none'
150
- },
151
- '&:placeholder-shown': {
152
- textOverflow: 'ellipsis'
153
- },
154
- '&::placeholder': {
155
- color: "var(--ds-text-subtlest, ".concat(N200, ")"),
156
- '&:disabled': {
157
- color: "var(--ds-text-disabled, ".concat(N70, ")")
158
- }
159
- },
160
- '@media screen and (-ms-high-contrast: active)': {
161
- '&[disabled]': {
162
- color: 'GrayText'
163
- }
164
- }
165
- }, media.above.xs, {
166
- font: fg('platform_design_system_team_safari_input_fix') ? "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)" : undefined,
167
- '&[data-compact]': {
168
- padding: fg('platform_design_system_team_safari_input_fix') ? "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-075, 6px)") : undefined
169
- },
170
- '&:not([data-compact])': {
171
- padding: fg('platform_design_system_team_safari_input_fix') ? "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-075, 6px)") : undefined
172
- }
173
- });
174
- };
@@ -1,113 +0,0 @@
1
- import { type Appearance } from './types';
2
- export declare const containerStyles: (appearance: Appearance, width?: string | number) => {
3
- readonly borderStyle: "none" | "solid";
4
- readonly boxSizing: "border-box";
5
- readonly display: "flex";
6
- readonly flex: "1 1 100%";
7
- readonly font: "var(--ds-font-body)";
8
- readonly justifyContent: "space-between";
9
- readonly maxWidth: string | number;
10
- readonly overflow: "hidden";
11
- readonly transition: "background-color 0.2s ease-in-out, border-color 0.2s ease-in-out";
12
- readonly wordWrap: "break-word";
13
- readonly verticalAlign: "top";
14
- readonly pointerEvents: "auto";
15
- readonly padding?: string | undefined;
16
- readonly borderRadius: 3;
17
- readonly borderWidth: "var(--ds-border-width)";
18
- readonly backgroundColor: string;
19
- readonly borderColor: string;
20
- readonly color: "var(--ds-text)";
21
- readonly cursor: string;
22
- readonly '&:hover:not([data-disabled])': {
23
- backgroundColor: string;
24
- borderColor: string;
25
- };
26
- readonly '&:focus-within:not([data-disabled])': {
27
- backgroundColor: string;
28
- borderColor: string;
29
- boxShadow: string;
30
- };
31
- readonly '&[data-disabled]': {
32
- backgroundColor?: "var(--ds-background-disabled)" | undefined;
33
- borderColor?: "var(--ds-background-disabled)" | undefined;
34
- color: "var(--ds-text-disabled)";
35
- cursor: string;
36
- };
37
- readonly '&[data-invalid], &[data-invalid]:hover': {
38
- borderColor: "var(--ds-border-danger)";
39
- boxShadow: string;
40
- };
41
- readonly '&[data-invalid]:focus-within': {
42
- backgroundColor: "var(--ds-background-input-pressed)";
43
- borderColor: "var(--ds-border-focused)";
44
- boxShadow: string;
45
- };
46
- readonly '@media screen and (-ms-high-contrast: active)': {
47
- '&[data-invalid]:focus-within': {
48
- borderColor: string;
49
- };
50
- '&:focus-within': {
51
- borderColor: string;
52
- };
53
- '&[data-disabled]': {
54
- borderColor: string;
55
- };
56
- };
57
- readonly alignItems: "center";
58
- };
59
- export declare const inputStyles: () => {
60
- readonly backgroundColor: "transparent";
61
- readonly border: 0;
62
- readonly boxSizing: "border-box";
63
- readonly color: "inherit";
64
- readonly cursor: "inherit";
65
- readonly font: "var(--ds-font-body)" | "var(--ds-font-body-large)";
66
- readonly minWidth: "0";
67
- readonly outline: "none";
68
- readonly width: "100%";
69
- readonly '&[data-monospaced]': {
70
- readonly fontFamily: "var(--ds-font-family-code)";
71
- readonly "@media (min-width: 30rem)": {
72
- readonly fontFamily: "var(--ds-font-family-code)" | undefined;
73
- };
74
- };
75
- readonly '&[data-compact]': {
76
- readonly padding: string;
77
- };
78
- readonly '&:not([data-compact])': {
79
- readonly padding: string;
80
- };
81
- readonly '&[disabled]': {
82
- readonly WebkitTextFillColor: "var(--ds-text-disabled)";
83
- };
84
- readonly '&::-ms-clear': {
85
- readonly display: "none";
86
- };
87
- readonly '&:invalid': {
88
- readonly boxShadow: "none";
89
- };
90
- readonly '&:placeholder-shown': {
91
- readonly textOverflow: "ellipsis";
92
- };
93
- readonly '&::placeholder': {
94
- readonly color: "var(--ds-text-subtlest)";
95
- readonly '&:disabled': {
96
- readonly color: "var(--ds-text-disabled)";
97
- };
98
- };
99
- readonly '@media screen and (-ms-high-contrast: active)': {
100
- readonly '&[disabled]': {
101
- readonly color: "GrayText";
102
- };
103
- };
104
- readonly "@media (min-width: 30rem)": {
105
- readonly font: "var(--ds-font-body)" | undefined;
106
- readonly '&[data-compact]': {
107
- readonly padding: string | undefined;
108
- };
109
- readonly '&:not([data-compact])': {
110
- readonly padding: string | undefined;
111
- };
112
- };
113
- };
@@ -1,113 +0,0 @@
1
- import { type Appearance } from './types';
2
- export declare const containerStyles: (appearance: Appearance, width?: string | number) => {
3
- readonly borderStyle: "none" | "solid";
4
- readonly boxSizing: "border-box";
5
- readonly display: "flex";
6
- readonly flex: "1 1 100%";
7
- readonly font: "var(--ds-font-body)";
8
- readonly justifyContent: "space-between";
9
- readonly maxWidth: string | number;
10
- readonly overflow: "hidden";
11
- readonly transition: "background-color 0.2s ease-in-out, border-color 0.2s ease-in-out";
12
- readonly wordWrap: "break-word";
13
- readonly verticalAlign: "top";
14
- readonly pointerEvents: "auto";
15
- readonly padding?: string | undefined;
16
- readonly borderRadius: 3;
17
- readonly borderWidth: "var(--ds-border-width)";
18
- readonly backgroundColor: string;
19
- readonly borderColor: string;
20
- readonly color: "var(--ds-text)";
21
- readonly cursor: string;
22
- readonly '&:hover:not([data-disabled])': {
23
- backgroundColor: string;
24
- borderColor: string;
25
- };
26
- readonly '&:focus-within:not([data-disabled])': {
27
- backgroundColor: string;
28
- borderColor: string;
29
- boxShadow: string;
30
- };
31
- readonly '&[data-disabled]': {
32
- backgroundColor?: "var(--ds-background-disabled)" | undefined;
33
- borderColor?: "var(--ds-background-disabled)" | undefined;
34
- color: "var(--ds-text-disabled)";
35
- cursor: string;
36
- };
37
- readonly '&[data-invalid], &[data-invalid]:hover': {
38
- borderColor: "var(--ds-border-danger)";
39
- boxShadow: string;
40
- };
41
- readonly '&[data-invalid]:focus-within': {
42
- backgroundColor: "var(--ds-background-input-pressed)";
43
- borderColor: "var(--ds-border-focused)";
44
- boxShadow: string;
45
- };
46
- readonly '@media screen and (-ms-high-contrast: active)': {
47
- '&[data-invalid]:focus-within': {
48
- borderColor: string;
49
- };
50
- '&:focus-within': {
51
- borderColor: string;
52
- };
53
- '&[data-disabled]': {
54
- borderColor: string;
55
- };
56
- };
57
- readonly alignItems: "center";
58
- };
59
- export declare const inputStyles: () => {
60
- readonly backgroundColor: "transparent";
61
- readonly border: 0;
62
- readonly boxSizing: "border-box";
63
- readonly color: "inherit";
64
- readonly cursor: "inherit";
65
- readonly font: "var(--ds-font-body)" | "var(--ds-font-body-large)";
66
- readonly minWidth: "0";
67
- readonly outline: "none";
68
- readonly width: "100%";
69
- readonly '&[data-monospaced]': {
70
- readonly fontFamily: "var(--ds-font-family-code)";
71
- readonly "@media (min-width: 30rem)": {
72
- readonly fontFamily: "var(--ds-font-family-code)" | undefined;
73
- };
74
- };
75
- readonly '&[data-compact]': {
76
- readonly padding: string;
77
- };
78
- readonly '&:not([data-compact])': {
79
- readonly padding: string;
80
- };
81
- readonly '&[disabled]': {
82
- readonly WebkitTextFillColor: "var(--ds-text-disabled)";
83
- };
84
- readonly '&::-ms-clear': {
85
- readonly display: "none";
86
- };
87
- readonly '&:invalid': {
88
- readonly boxShadow: "none";
89
- };
90
- readonly '&:placeholder-shown': {
91
- readonly textOverflow: "ellipsis";
92
- };
93
- readonly '&::placeholder': {
94
- readonly color: "var(--ds-text-subtlest)";
95
- readonly '&:disabled': {
96
- readonly color: "var(--ds-text-disabled)";
97
- };
98
- };
99
- readonly '@media screen and (-ms-high-contrast: active)': {
100
- readonly '&[disabled]': {
101
- readonly color: "GrayText";
102
- };
103
- };
104
- readonly "@media (min-width: 30rem)": {
105
- readonly font: "var(--ds-font-body)" | undefined;
106
- readonly '&[data-compact]': {
107
- readonly padding: string | undefined;
108
- };
109
- readonly '&:not([data-compact])': {
110
- readonly padding: string | undefined;
111
- };
112
- };
113
- };