@telefonica/mistica 10.1.0 → 10.4.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/CHANGELOG.md +36 -0
- package/README.md +2 -2
- package/dist/card.d.ts +1 -1
- package/dist/card.js +1 -1
- package/dist/card.js.flow +1 -1
- package/dist/icon-button.js +4 -6
- package/dist/list.js +9 -14
- package/dist/navigation-bar.d.ts +1 -0
- package/dist/navigation-bar.js +89 -95
- package/dist/navigation-bar.js.flow +1 -0
- package/dist/password-field.js +16 -8
- package/dist/select.js +67 -63
- package/dist/skins/movistar.js +1 -1
- package/dist/skins/o2-classic.js +1 -1
- package/dist/skins/o2.js +1 -1
- package/dist/skins/telefonica.js +1 -1
- package/dist/skins/vivo.js +1 -1
- package/dist/tabs.js +10 -8
- package/dist/text-field-base.js +60 -46
- package/dist/text-field-components.d.ts +1 -0
- package/dist/text-field-components.js +18 -9
- package/dist/text-field-components.js.flow +1 -0
- package/dist/text-link.js +20 -23
- package/dist/theme-context-provider.js +2 -2
- package/dist/theme.d.ts +1 -0
- package/dist/theme.js.flow +1 -0
- package/dist/utils/media-queries.d.ts +1 -0
- package/dist/utils/media-queries.js +6 -1
- package/dist/utils/media-queries.js.flow +1 -0
- package/dist-es/card.js +1 -1
- package/dist-es/icon-button.js +4 -5
- package/dist-es/list.js +9 -14
- package/dist-es/navigation-bar.js +89 -95
- package/dist-es/password-field.js +16 -8
- package/dist-es/select.js +67 -63
- package/dist-es/skins/movistar.js +1 -1
- package/dist-es/skins/o2-classic.js +1 -1
- package/dist-es/skins/o2.js +1 -1
- package/dist-es/skins/telefonica.js +1 -1
- package/dist-es/skins/vivo.js +1 -1
- package/dist-es/tabs.js +10 -8
- package/dist-es/text-field-base.js +60 -46
- package/dist-es/text-field-components.js +18 -9
- package/dist-es/text-link.js +7 -10
- package/dist-es/theme-context-provider.js +2 -2
- package/dist-es/utils/media-queries.js +6 -1
- package/package.json +1 -1
package/dist-es/select.js
CHANGED
|
@@ -27,7 +27,7 @@ import { isAndroid, isIos } from './utils/platform';
|
|
|
27
27
|
import { createUseStyles } from './jss';
|
|
28
28
|
import { cancelEvent } from './utils/dom';
|
|
29
29
|
var useStyles = createUseStyles(function (theme) {
|
|
30
|
-
var _selectContainer;
|
|
30
|
+
var _selectContainer, _menuItem;
|
|
31
31
|
|
|
32
32
|
return {
|
|
33
33
|
selectContainer: (_selectContainer = {
|
|
@@ -47,7 +47,8 @@ var useStyles = createUseStyles(function (theme) {
|
|
|
47
47
|
}), _selectContainer),
|
|
48
48
|
select: {
|
|
49
49
|
fontFamily: 'inherit',
|
|
50
|
-
backgroundColor:
|
|
50
|
+
backgroundColor: 'transparent',
|
|
51
|
+
// FieldContainer gives the correct background color
|
|
51
52
|
paddingTop: function paddingTop(_ref3) {
|
|
52
53
|
var label = _ref3.label;
|
|
53
54
|
return label ? 24 : 16;
|
|
@@ -66,19 +67,23 @@ var useStyles = createUseStyles(function (theme) {
|
|
|
66
67
|
height: '100%',
|
|
67
68
|
textOverflow: 'ellipsis',
|
|
68
69
|
'&:disabled': {
|
|
69
|
-
color: theme.colors.
|
|
70
|
+
color: theme.colors.textDisabled
|
|
70
71
|
},
|
|
71
72
|
appearance: 'none',
|
|
72
73
|
cursor: function cursor(_ref5) {
|
|
73
74
|
var disabled = _ref5.disabled;
|
|
74
|
-
return disabled ? '
|
|
75
|
+
return disabled ? 'inherit' : 'pointer';
|
|
75
76
|
}
|
|
76
77
|
},
|
|
77
78
|
arrowDown: {
|
|
78
79
|
position: 'absolute',
|
|
79
80
|
right: 16,
|
|
80
81
|
top: 'calc(50% - 12px)',
|
|
81
|
-
pointerEvents: 'none'
|
|
82
|
+
pointerEvents: 'none',
|
|
83
|
+
opacity: function opacity(_ref6) {
|
|
84
|
+
var disabled = _ref6.disabled;
|
|
85
|
+
return disabled ? 0.3 : 1;
|
|
86
|
+
}
|
|
82
87
|
},
|
|
83
88
|
selectText: {
|
|
84
89
|
position: 'absolute',
|
|
@@ -88,13 +93,13 @@ var useStyles = createUseStyles(function (theme) {
|
|
|
88
93
|
right: 48 + 1,
|
|
89
94
|
// 48 for icon and +1 for border
|
|
90
95
|
overflow: 'hidden',
|
|
91
|
-
top: function top(
|
|
92
|
-
var label =
|
|
96
|
+
top: function top(_ref7) {
|
|
97
|
+
var label = _ref7.label;
|
|
93
98
|
return label ? 27 : 17;
|
|
94
99
|
},
|
|
95
100
|
fontSize: 16,
|
|
96
|
-
color: function color(
|
|
97
|
-
var disabled =
|
|
101
|
+
color: function color(_ref8) {
|
|
102
|
+
var disabled = _ref8.disabled;
|
|
98
103
|
return disabled ? theme.colors.textDisabled : theme.colors.textPrimary;
|
|
99
104
|
},
|
|
100
105
|
maxWidth: '100%',
|
|
@@ -106,16 +111,16 @@ var useStyles = createUseStyles(function (theme) {
|
|
|
106
111
|
padding: 0,
|
|
107
112
|
listStyleType: 'none',
|
|
108
113
|
position: 'absolute',
|
|
109
|
-
top: function top(
|
|
110
|
-
var optionsComputedProps =
|
|
114
|
+
top: function top(_ref9) {
|
|
115
|
+
var optionsComputedProps = _ref9.optionsComputedProps;
|
|
111
116
|
return optionsComputedProps.top;
|
|
112
117
|
},
|
|
113
|
-
left: function left(
|
|
114
|
-
var optionsComputedProps =
|
|
118
|
+
left: function left(_ref10) {
|
|
119
|
+
var optionsComputedProps = _ref10.optionsComputedProps;
|
|
115
120
|
return optionsComputedProps.left;
|
|
116
121
|
},
|
|
117
|
-
minWidth: function minWidth(
|
|
118
|
-
var optionsComputedProps =
|
|
122
|
+
minWidth: function minWidth(_ref11) {
|
|
123
|
+
var optionsComputedProps = _ref11.optionsComputedProps;
|
|
119
124
|
return optionsComputedProps.width;
|
|
120
125
|
},
|
|
121
126
|
borderRadius: 4,
|
|
@@ -123,23 +128,23 @@ var useStyles = createUseStyles(function (theme) {
|
|
|
123
128
|
backgroundColor: theme.colors.backgroundContainer,
|
|
124
129
|
paddingTop: 8,
|
|
125
130
|
paddingBottom: 8,
|
|
126
|
-
transformOrigin: function transformOrigin(
|
|
127
|
-
var optionsComputedProps =
|
|
131
|
+
transformOrigin: function transformOrigin(_ref12) {
|
|
132
|
+
var optionsComputedProps = _ref12.optionsComputedProps;
|
|
128
133
|
return optionsComputedProps.transformOrigin;
|
|
129
134
|
},
|
|
130
135
|
transition: 'opacity .03s linear,transform .12s cubic-bezier(0,0,.2,1) .15s',
|
|
131
|
-
opacity: function opacity(
|
|
132
|
-
var animateShowOptions =
|
|
136
|
+
opacity: function opacity(_ref13) {
|
|
137
|
+
var animateShowOptions = _ref13.animateShowOptions;
|
|
133
138
|
return animateShowOptions ? 1 : 0;
|
|
134
139
|
},
|
|
135
|
-
transform: function transform(
|
|
136
|
-
var animateShowOptions =
|
|
140
|
+
transform: function transform(_ref14) {
|
|
141
|
+
var animateShowOptions = _ref14.animateShowOptions;
|
|
137
142
|
return animateShowOptions ? 'scale(1)' : 'scale(0)';
|
|
138
143
|
},
|
|
139
|
-
maxHeight: function maxHeight(
|
|
144
|
+
maxHeight: function maxHeight(_ref15) {
|
|
140
145
|
var _optionsComputedProps;
|
|
141
146
|
|
|
142
|
-
var optionsComputedProps =
|
|
147
|
+
var optionsComputedProps = _ref15.optionsComputedProps;
|
|
143
148
|
return (_optionsComputedProps = optionsComputedProps.maxHeight) !== null && _optionsComputedProps !== void 0 ? _optionsComputedProps : '416px';
|
|
144
149
|
},
|
|
145
150
|
overflowY: 'auto'
|
|
@@ -147,40 +152,38 @@ var useStyles = createUseStyles(function (theme) {
|
|
|
147
152
|
menuItemSelected: {
|
|
148
153
|
backgroundColor: 'rgba(0, 0, 0, 0.14)'
|
|
149
154
|
},
|
|
150
|
-
menuItem: {
|
|
155
|
+
menuItem: (_menuItem = {
|
|
151
156
|
color: theme.colors.textPrimary,
|
|
152
157
|
lineHeight: 1.5,
|
|
153
158
|
padding: '6px 16px',
|
|
154
159
|
height: 48,
|
|
155
|
-
transition: 'background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms'
|
|
160
|
+
transition: 'background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms'
|
|
161
|
+
}, _defineProperty(_menuItem, theme.mq.supportsHover, {
|
|
156
162
|
'&:hover': {
|
|
157
163
|
backgroundColor: 'rgba(0, 0, 0, 0.08)'
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
alignItems: 'center',
|
|
161
|
-
cursor: 'pointer'
|
|
162
|
-
}
|
|
164
|
+
}
|
|
165
|
+
}), _defineProperty(_menuItem, "display", 'flex'), _defineProperty(_menuItem, "alignItems", 'center'), _defineProperty(_menuItem, "cursor", 'pointer'), _menuItem)
|
|
163
166
|
};
|
|
164
167
|
});
|
|
165
168
|
|
|
166
|
-
var Select = function Select(
|
|
167
|
-
var
|
|
168
|
-
|
|
169
|
-
var id =
|
|
170
|
-
label =
|
|
171
|
-
helperTextProp =
|
|
172
|
-
valueProp =
|
|
173
|
-
onChangeValueProp =
|
|
174
|
-
name =
|
|
175
|
-
fullWidth =
|
|
176
|
-
options =
|
|
177
|
-
optional =
|
|
178
|
-
disabledProp =
|
|
179
|
-
errorProp =
|
|
180
|
-
_onBlur =
|
|
181
|
-
|
|
182
|
-
autoFocus =
|
|
183
|
-
native =
|
|
169
|
+
var Select = function Select(_ref16) {
|
|
170
|
+
var _ref20, _inputRef$current;
|
|
171
|
+
|
|
172
|
+
var id = _ref16.id,
|
|
173
|
+
label = _ref16.label,
|
|
174
|
+
helperTextProp = _ref16.helperText,
|
|
175
|
+
valueProp = _ref16.value,
|
|
176
|
+
onChangeValueProp = _ref16.onChangeValue,
|
|
177
|
+
name = _ref16.name,
|
|
178
|
+
fullWidth = _ref16.fullWidth,
|
|
179
|
+
options = _ref16.options,
|
|
180
|
+
optional = _ref16.optional,
|
|
181
|
+
disabledProp = _ref16.disabled,
|
|
182
|
+
errorProp = _ref16.error,
|
|
183
|
+
_onBlur = _ref16.onBlur,
|
|
184
|
+
_ref16$autoFocus = _ref16.autoFocus,
|
|
185
|
+
autoFocus = _ref16$autoFocus === void 0 ? false : _ref16$autoFocus,
|
|
186
|
+
native = _ref16.native;
|
|
184
187
|
var inputRef = React.useRef(null);
|
|
185
188
|
var focusableRef = React.useRef(null);
|
|
186
189
|
var fieldRef = React.useRef(null);
|
|
@@ -383,8 +386,8 @@ var Select = function Select(_ref15) {
|
|
|
383
386
|
var _options$value, _options;
|
|
384
387
|
|
|
385
388
|
cancelEvent(e);
|
|
386
|
-
var newTentativeValueState = (_options$value = (_options = options[options.findIndex(function (
|
|
387
|
-
var value =
|
|
389
|
+
var newTentativeValueState = (_options$value = (_options = options[options.findIndex(function (_ref17) {
|
|
390
|
+
var value = _ref17.value;
|
|
388
391
|
return value === tentativeValueState;
|
|
389
392
|
}) + operand]) === null || _options === void 0 ? void 0 : _options.value) !== null && _options$value !== void 0 ? _options$value : tentativeValueState;
|
|
390
393
|
setTentativeValueState(newTentativeValueState);
|
|
@@ -405,8 +408,8 @@ var Select = function Select(_ref15) {
|
|
|
405
408
|
if (e.keyCode === ENTER || e.keyCode === SPACE) {
|
|
406
409
|
cancelEvent(e);
|
|
407
410
|
|
|
408
|
-
if (options.findIndex(function (
|
|
409
|
-
var value =
|
|
411
|
+
if (options.findIndex(function (_ref18) {
|
|
412
|
+
var value = _ref18.value;
|
|
410
413
|
return value === tentativeValueState;
|
|
411
414
|
}) !== -1 && tentativeValueState !== valueState) {
|
|
412
415
|
setValue(tentativeValueState);
|
|
@@ -444,8 +447,8 @@ var Select = function Select(_ref15) {
|
|
|
444
447
|
var getOptionText = function getOptionText(val) {
|
|
445
448
|
var _options$find;
|
|
446
449
|
|
|
447
|
-
return val ? (_options$find = options.find(function (
|
|
448
|
-
var value =
|
|
450
|
+
return val ? (_options$find = options.find(function (_ref19) {
|
|
451
|
+
var value = _ref19.value;
|
|
449
452
|
return value === val;
|
|
450
453
|
})) === null || _options$find === void 0 ? void 0 : _options$find.text : '';
|
|
451
454
|
};
|
|
@@ -470,6 +473,7 @@ var Select = function Select(_ref15) {
|
|
|
470
473
|
}
|
|
471
474
|
};
|
|
472
475
|
return shouldUseNative ? /*#__PURE__*/React.createElement(FieldContainer, {
|
|
476
|
+
disabled: disabled,
|
|
473
477
|
helperText: /*#__PURE__*/React.createElement(HelperText, {
|
|
474
478
|
error: error,
|
|
475
479
|
leftText: helperText
|
|
@@ -479,7 +483,7 @@ var Select = function Select(_ref15) {
|
|
|
479
483
|
}, label && /*#__PURE__*/React.createElement(Label, {
|
|
480
484
|
error: error,
|
|
481
485
|
forId: inputId,
|
|
482
|
-
inputState: isFocused ? 'focused' : ((
|
|
486
|
+
inputState: isFocused ? 'focused' : ((_ref20 = value !== null && value !== void 0 ? value : valueState) !== null && _ref20 !== void 0 ? _ref20 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value) ? 'filled' : 'default',
|
|
483
487
|
disabled: disabled,
|
|
484
488
|
optional: optional
|
|
485
489
|
}, label), /*#__PURE__*/React.createElement("select", {
|
|
@@ -512,8 +516,8 @@ var Select = function Select(_ref15) {
|
|
|
512
516
|
// Without this fix, the label is invisible when disabled
|
|
513
517
|
opacity: 1
|
|
514
518
|
}
|
|
515
|
-
}, options.every(function (
|
|
516
|
-
var value =
|
|
519
|
+
}, options.every(function (_ref21) {
|
|
520
|
+
var value = _ref21.value;
|
|
517
521
|
return !!value;
|
|
518
522
|
}) &&
|
|
519
523
|
/*#__PURE__*/
|
|
@@ -524,9 +528,9 @@ var Select = function Select(_ref15) {
|
|
|
524
528
|
style: {
|
|
525
529
|
display: 'none'
|
|
526
530
|
}
|
|
527
|
-
}), options.map(function (
|
|
528
|
-
var val =
|
|
529
|
-
text =
|
|
531
|
+
}), options.map(function (_ref22) {
|
|
532
|
+
var val = _ref22.value,
|
|
533
|
+
text = _ref22.text;
|
|
530
534
|
return /*#__PURE__*/React.createElement("option", {
|
|
531
535
|
key: val,
|
|
532
536
|
value: val
|
|
@@ -570,9 +574,9 @@ var Select = function Select(_ref15) {
|
|
|
570
574
|
className: classes.optionsContainer,
|
|
571
575
|
role: "listbox",
|
|
572
576
|
ref: optionsMenuRef
|
|
573
|
-
}, options.map(function (
|
|
574
|
-
var val =
|
|
575
|
-
text =
|
|
577
|
+
}, options.map(function (_ref23) {
|
|
578
|
+
var val = _ref23.value,
|
|
579
|
+
text = _ref23.text;
|
|
576
580
|
return /*#__PURE__*/React.createElement("li", {
|
|
577
581
|
role: "option",
|
|
578
582
|
"aria-selected": val === (valueState !== null && valueState !== void 0 ? valueState : value),
|
|
@@ -127,7 +127,7 @@ export var getMovistarSkin = function getMovistarSkin(variant) {
|
|
|
127
127
|
textPrimaryInverse: palette.white,
|
|
128
128
|
textSecondary: palette.grey5,
|
|
129
129
|
textSecondaryInverse: palette.white,
|
|
130
|
-
textDisabled: palette.
|
|
130
|
+
textDisabled: palette.grey4,
|
|
131
131
|
textAmount: palette.movistarBlue,
|
|
132
132
|
// STATES
|
|
133
133
|
error: palette.pepper,
|
|
@@ -133,7 +133,7 @@ export var getO2ClassicSkin = function getO2ClassicSkin() {
|
|
|
133
133
|
textPrimaryInverse: palette.white,
|
|
134
134
|
textSecondary: palette.grey5,
|
|
135
135
|
textSecondaryInverse: palette.white,
|
|
136
|
-
textDisabled: palette.
|
|
136
|
+
textDisabled: palette.grey4,
|
|
137
137
|
textAmount: palette.o2SkyBlue,
|
|
138
138
|
// STATES
|
|
139
139
|
error: palette.pepper,
|
package/dist-es/skins/o2.js
CHANGED
|
@@ -133,7 +133,7 @@ export var getO2Skin = function getO2Skin() {
|
|
|
133
133
|
textPrimaryInverse: palette.white,
|
|
134
134
|
textSecondary: palette.grey5,
|
|
135
135
|
textSecondaryInverse: palette.white,
|
|
136
|
-
textDisabled: palette.
|
|
136
|
+
textDisabled: palette.grey4,
|
|
137
137
|
textAmount: palette.o2BluePrimary,
|
|
138
138
|
// STATES
|
|
139
139
|
error: palette.pepper,
|
|
@@ -127,7 +127,7 @@ export var getTelefonicaSkin = function getTelefonicaSkin() {
|
|
|
127
127
|
textPrimaryInverse: palette.white,
|
|
128
128
|
textSecondary: palette.grey5,
|
|
129
129
|
textSecondaryInverse: palette.white,
|
|
130
|
-
textDisabled: palette.
|
|
130
|
+
textDisabled: palette.grey4,
|
|
131
131
|
textAmount: palette.telefonicaBlue,
|
|
132
132
|
// STATES
|
|
133
133
|
error: palette.coral,
|
package/dist-es/skins/vivo.js
CHANGED
|
@@ -121,7 +121,7 @@ export var getVivoSkin = function getVivoSkin() {
|
|
|
121
121
|
textPrimaryInverse: palette.white,
|
|
122
122
|
textSecondary: palette.grey5,
|
|
123
123
|
textSecondaryInverse: palette.white,
|
|
124
|
-
textDisabled: palette.
|
|
124
|
+
textDisabled: palette.grey4,
|
|
125
125
|
textAmount: palette.vivoPurple,
|
|
126
126
|
// STATES
|
|
127
127
|
error: palette.pepper,
|
package/dist-es/tabs.js
CHANGED
|
@@ -25,6 +25,8 @@ var TAB_MAX_WIDTH = 284;
|
|
|
25
25
|
var TAB_HEIGHT = 56;
|
|
26
26
|
var LINE_ANIMATION_DURATION_MS = isRunningAcceptanceTest() ? 0 : 300;
|
|
27
27
|
var useStyles = createUseStyles(function (_ref) {
|
|
28
|
+
var _tab;
|
|
29
|
+
|
|
28
30
|
var colors = _ref.colors,
|
|
29
31
|
mq = _ref.mq;
|
|
30
32
|
return {
|
|
@@ -52,7 +54,7 @@ var useStyles = createUseStyles(function (_ref) {
|
|
|
52
54
|
height: TAB_HEIGHT,
|
|
53
55
|
display: 'flex'
|
|
54
56
|
},
|
|
55
|
-
tab:
|
|
57
|
+
tab: (_tab = {
|
|
56
58
|
flex: '1 0 80px',
|
|
57
59
|
display: 'inline-flex',
|
|
58
60
|
alignItems: 'center',
|
|
@@ -74,19 +76,19 @@ var useStyles = createUseStyles(function (_ref) {
|
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
return TAB_MAX_WIDTH;
|
|
77
|
-
}
|
|
79
|
+
}
|
|
80
|
+
}, _defineProperty(_tab, mq.supportsHover, {
|
|
78
81
|
'&:hover': {
|
|
79
82
|
color: colors.textPrimary
|
|
80
|
-
},
|
|
81
|
-
fallbacks: {
|
|
82
|
-
maxWidth: TAB_MAX_WIDTH // max() is not supported by all browsers
|
|
83
|
-
|
|
84
83
|
}
|
|
85
|
-
},
|
|
84
|
+
}), _defineProperty(_tab, "fallbacks", {
|
|
85
|
+
maxWidth: TAB_MAX_WIDTH // max() is not supported by all browsers
|
|
86
|
+
|
|
87
|
+
}), _defineProperty(_tab, mq.desktopOrBigger, {
|
|
86
88
|
flex: '0 1 208px',
|
|
87
89
|
padding: "16px 32px",
|
|
88
90
|
maxWidth: TAB_MAX_WIDTH
|
|
89
|
-
}),
|
|
91
|
+
}), _tab),
|
|
90
92
|
tabWithIcon: _defineProperty({
|
|
91
93
|
flexBasis: 112
|
|
92
94
|
}, mq.desktopOrBigger, {
|
|
@@ -79,7 +79,8 @@ var commonInputStyles = function commonInputStyles(theme) {
|
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
'&:disabled': {
|
|
82
|
-
color: theme.colors.
|
|
82
|
+
color: theme.colors.textDisabled,
|
|
83
|
+
cursor: 'not-allowed'
|
|
83
84
|
},
|
|
84
85
|
boxShadow: 'none' // reset FF red shadow styles for required inputs
|
|
85
86
|
|
|
@@ -177,7 +178,11 @@ var useStyles = createUseStyles(function (theme) {
|
|
|
177
178
|
paddingLeft: 8,
|
|
178
179
|
paddingRight: 16,
|
|
179
180
|
display: 'flex',
|
|
180
|
-
alignItems: 'center'
|
|
181
|
+
alignItems: 'center',
|
|
182
|
+
opacity: function opacity(_ref8) {
|
|
183
|
+
var disabled = _ref8.disabled;
|
|
184
|
+
return disabled ? 0.3 : 1;
|
|
185
|
+
}
|
|
181
186
|
},
|
|
182
187
|
startIcon: {
|
|
183
188
|
pointerEvents: 'none',
|
|
@@ -187,24 +192,31 @@ var useStyles = createUseStyles(function (theme) {
|
|
|
187
192
|
display: 'flex',
|
|
188
193
|
alignItems: 'center',
|
|
189
194
|
height: '100%',
|
|
190
|
-
position: 'absolute'
|
|
195
|
+
position: 'absolute',
|
|
196
|
+
opacity: function opacity(_ref9) {
|
|
197
|
+
var disabled = _ref9.disabled;
|
|
198
|
+
return disabled ? 0.3 : 1;
|
|
199
|
+
}
|
|
191
200
|
},
|
|
192
201
|
prefix: {
|
|
193
|
-
paddingTop: function paddingTop(
|
|
194
|
-
var hasLabel =
|
|
202
|
+
paddingTop: function paddingTop(_ref10) {
|
|
203
|
+
var hasLabel = _ref10.hasLabel;
|
|
195
204
|
return hasLabel ? 25 : 16;
|
|
196
205
|
},
|
|
197
|
-
paddingBottom: function paddingBottom(
|
|
198
|
-
var hasLabel =
|
|
206
|
+
paddingBottom: function paddingBottom(_ref11) {
|
|
207
|
+
var hasLabel = _ref11.hasLabel;
|
|
199
208
|
return hasLabel ? 8 : 16;
|
|
200
209
|
},
|
|
201
210
|
paddingLeft: 12,
|
|
202
211
|
paddingRight: 16,
|
|
203
212
|
display: 'flex',
|
|
204
213
|
alignItems: 'center',
|
|
205
|
-
color:
|
|
206
|
-
|
|
207
|
-
|
|
214
|
+
color: function color(_ref12) {
|
|
215
|
+
var disabled = _ref12.disabled;
|
|
216
|
+
return disabled ? theme.colors.textDisabled : theme.colors.textSecondary;
|
|
217
|
+
},
|
|
218
|
+
opacity: function opacity(_ref13) {
|
|
219
|
+
var inputState = _ref13.inputState;
|
|
208
220
|
return inputState === 'default' ? 0 : 1;
|
|
209
221
|
},
|
|
210
222
|
transition: 'opacity 150ms cubic-bezier(0.0, 0, 0.2, 1) 0ms'
|
|
@@ -216,33 +228,33 @@ var fixAutoComplete = function fixAutoComplete(platformOverrides, autoComplete)
|
|
|
216
228
|
return autoComplete === 'off' && isChrome(platformOverrides) ? 'nope' : autoComplete;
|
|
217
229
|
};
|
|
218
230
|
|
|
219
|
-
var TextFieldBaseComponent = /*#__PURE__*/React.forwardRef(function (
|
|
231
|
+
var TextFieldBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
|
|
220
232
|
var _defaultValue$length;
|
|
221
233
|
|
|
222
|
-
var error =
|
|
223
|
-
helperText =
|
|
224
|
-
label =
|
|
225
|
-
inputProps =
|
|
226
|
-
inputRef =
|
|
227
|
-
defaultValue =
|
|
228
|
-
value =
|
|
229
|
-
_onFocus =
|
|
230
|
-
_onBlur =
|
|
231
|
-
inputComponent =
|
|
232
|
-
prefix =
|
|
233
|
-
startIcon =
|
|
234
|
-
endIcon =
|
|
235
|
-
endIconOverlay =
|
|
236
|
-
shrinkLabelProp =
|
|
237
|
-
|
|
238
|
-
multiline =
|
|
239
|
-
focus =
|
|
240
|
-
fieldRef =
|
|
241
|
-
maxLength =
|
|
242
|
-
idProp =
|
|
243
|
-
autoCompleteProp =
|
|
244
|
-
fullWidth =
|
|
245
|
-
rest = _objectWithoutProperties(
|
|
234
|
+
var error = _ref14.error,
|
|
235
|
+
helperText = _ref14.helperText,
|
|
236
|
+
label = _ref14.label,
|
|
237
|
+
inputProps = _ref14.inputProps,
|
|
238
|
+
inputRef = _ref14.inputRef,
|
|
239
|
+
defaultValue = _ref14.defaultValue,
|
|
240
|
+
value = _ref14.value,
|
|
241
|
+
_onFocus = _ref14.onFocus,
|
|
242
|
+
_onBlur = _ref14.onBlur,
|
|
243
|
+
inputComponent = _ref14.inputComponent,
|
|
244
|
+
prefix = _ref14.prefix,
|
|
245
|
+
startIcon = _ref14.startIcon,
|
|
246
|
+
endIcon = _ref14.endIcon,
|
|
247
|
+
endIconOverlay = _ref14.endIconOverlay,
|
|
248
|
+
shrinkLabelProp = _ref14.shrinkLabel,
|
|
249
|
+
_ref14$multiline = _ref14.multiline,
|
|
250
|
+
multiline = _ref14$multiline === void 0 ? false : _ref14$multiline,
|
|
251
|
+
focus = _ref14.focus,
|
|
252
|
+
fieldRef = _ref14.fieldRef,
|
|
253
|
+
maxLength = _ref14.maxLength,
|
|
254
|
+
idProp = _ref14.id,
|
|
255
|
+
autoCompleteProp = _ref14.autoComplete,
|
|
256
|
+
fullWidth = _ref14.fullWidth,
|
|
257
|
+
rest = _objectWithoutProperties(_ref14, _excluded);
|
|
246
258
|
|
|
247
259
|
var id = useAriaId(idProp);
|
|
248
260
|
|
|
@@ -272,7 +284,8 @@ var TextFieldBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref11, ref
|
|
|
272
284
|
hasLabel: hasLabel,
|
|
273
285
|
prefix: prefix,
|
|
274
286
|
multiline: multiline,
|
|
275
|
-
type: rest.type
|
|
287
|
+
type: rest.type,
|
|
288
|
+
disabled: rest.disabled
|
|
276
289
|
});
|
|
277
290
|
React.useEffect(function () {
|
|
278
291
|
if (inputState !== 'focused' && value !== null && value !== void 0 && value.length) {
|
|
@@ -331,6 +344,7 @@ var TextFieldBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref11, ref
|
|
|
331
344
|
}
|
|
332
345
|
|
|
333
346
|
return /*#__PURE__*/React.createElement(FieldContainer, {
|
|
347
|
+
disabled: rest.disabled,
|
|
334
348
|
helperText: /*#__PURE__*/React.createElement(HelperText, {
|
|
335
349
|
error: error,
|
|
336
350
|
leftText: helperText,
|
|
@@ -423,10 +437,10 @@ var Autosuggest = /*#__PURE__*/React.lazy(function () {
|
|
|
423
437
|
/* webpackChunkName: "react-autosuggest" */
|
|
424
438
|
'react-autosuggest');
|
|
425
439
|
});
|
|
426
|
-
var TextFieldBase = /*#__PURE__*/React.forwardRef(function (
|
|
427
|
-
var getSuggestions =
|
|
428
|
-
idProp =
|
|
429
|
-
props = _objectWithoutProperties(
|
|
440
|
+
var TextFieldBase = /*#__PURE__*/React.forwardRef(function (_ref15, ref) {
|
|
441
|
+
var getSuggestions = _ref15.getSuggestions,
|
|
442
|
+
idProp = _ref15.id,
|
|
443
|
+
props = _objectWithoutProperties(_ref15, _excluded2);
|
|
430
444
|
|
|
431
445
|
var _React$useState5 = React.useState([]),
|
|
432
446
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
@@ -463,10 +477,10 @@ var TextFieldBase = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
|
|
|
463
477
|
id: id,
|
|
464
478
|
autoComplete: fixAutoComplete(platformOverrides, 'off'),
|
|
465
479
|
// @ts-expect-error Autosuggest expects slightly different types
|
|
466
|
-
onChange: function onChange(e,
|
|
480
|
+
onChange: function onChange(e, _ref16) {
|
|
467
481
|
var _props$onChange2;
|
|
468
482
|
|
|
469
|
-
var newValue =
|
|
483
|
+
var newValue = _ref16.newValue;
|
|
470
484
|
// hack to mutate event value
|
|
471
485
|
e.target = _objectSpread(_objectSpread({}, e.target), {}, {
|
|
472
486
|
value: newValue
|
|
@@ -483,8 +497,8 @@ var TextFieldBase = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
|
|
|
483
497
|
}));
|
|
484
498
|
},
|
|
485
499
|
suggestions: suggestions,
|
|
486
|
-
onSuggestionsFetchRequested: function onSuggestionsFetchRequested(
|
|
487
|
-
var value =
|
|
500
|
+
onSuggestionsFetchRequested: function onSuggestionsFetchRequested(_ref17) {
|
|
501
|
+
var value = _ref17.value;
|
|
488
502
|
return setSuggestions(getSuggestions(value));
|
|
489
503
|
},
|
|
490
504
|
onSuggestionsClearRequested: function onSuggestionsClearRequested() {
|
|
@@ -493,8 +507,8 @@ var TextFieldBase = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
|
|
|
493
507
|
getSuggestionValue: function getSuggestionValue(suggestion) {
|
|
494
508
|
return suggestion;
|
|
495
509
|
},
|
|
496
|
-
renderSuggestion: function renderSuggestion(suggestion,
|
|
497
|
-
var isHighlighted =
|
|
510
|
+
renderSuggestion: function renderSuggestion(suggestion, _ref18) {
|
|
511
|
+
var isHighlighted = _ref18.isHighlighted;
|
|
498
512
|
return /*#__PURE__*/React.createElement("div", {
|
|
499
513
|
role: "menuitem",
|
|
500
514
|
className: classNames(classes.menuItem, _defineProperty({}, classes.menuItemSelected, isHighlighted))
|
|
@@ -213,20 +213,29 @@ var useFieldContainerStyles = createUseStyles(function (theme) {
|
|
|
213
213
|
display: 'flex',
|
|
214
214
|
position: 'relative',
|
|
215
215
|
lineHeight: '16px',
|
|
216
|
-
backgroundColor:
|
|
216
|
+
backgroundColor: function backgroundColor(_ref10) {
|
|
217
|
+
var disabled = _ref10.disabled;
|
|
218
|
+
return disabled ? theme.colors.backgroundAlternative : theme.colors.backgroundContainer;
|
|
219
|
+
},
|
|
220
|
+
cursor: function cursor(_ref11) {
|
|
221
|
+
var disabled = _ref11.disabled;
|
|
222
|
+
return disabled ? 'not-allowed' : 'initial';
|
|
223
|
+
}
|
|
217
224
|
}
|
|
218
225
|
};
|
|
219
226
|
});
|
|
220
|
-
export var FieldContainer = function FieldContainer(
|
|
221
|
-
var multiline =
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
+
export var FieldContainer = function FieldContainer(_ref12) {
|
|
228
|
+
var multiline = _ref12.multiline,
|
|
229
|
+
disabled = _ref12.disabled,
|
|
230
|
+
children = _ref12.children,
|
|
231
|
+
helperText = _ref12.helperText,
|
|
232
|
+
className = _ref12.className,
|
|
233
|
+
fieldRef = _ref12.fieldRef,
|
|
234
|
+
fullWidth = _ref12.fullWidth;
|
|
227
235
|
var classes = useFieldContainerStyles({
|
|
228
236
|
multiline: multiline,
|
|
229
|
-
fullWidth: fullWidth
|
|
237
|
+
fullWidth: fullWidth,
|
|
238
|
+
disabled: disabled
|
|
230
239
|
});
|
|
231
240
|
return /*#__PURE__*/React.createElement("div", {
|
|
232
241
|
className: classes.fieldContainer
|
package/dist-es/text-link.js
CHANGED
|
@@ -2,12 +2,12 @@ var _excluded = ["children", "className", "small"];
|
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || 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); }
|
|
4
4
|
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
7
5
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
6
|
|
|
9
7
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
8
|
|
|
9
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
import { createUseStyles } from './jss';
|
|
13
13
|
import Touchable from './touchable';
|
|
@@ -15,20 +15,17 @@ import classnames from 'classnames';
|
|
|
15
15
|
import { useIsInverseVariant } from './theme-variant-context';
|
|
16
16
|
var useStyles = createUseStyles(function (theme) {
|
|
17
17
|
return {
|
|
18
|
-
textLink: {
|
|
18
|
+
textLink: _defineProperty({
|
|
19
19
|
width: 'auto',
|
|
20
20
|
lineHeight: 'inherit',
|
|
21
21
|
display: 'inline-block',
|
|
22
22
|
color: theme.colors.textLink,
|
|
23
|
-
wordBreak: 'break-word'
|
|
23
|
+
wordBreak: 'break-word'
|
|
24
|
+
}, theme.mq.supportsHover, {
|
|
24
25
|
'&:hover': {
|
|
25
|
-
textDecoration: 'underline'
|
|
26
|
-
// Revert hover effect in touch devices
|
|
27
|
-
'@media (pointer: coarse)': {
|
|
28
|
-
textDecoration: 'initial'
|
|
29
|
-
}
|
|
26
|
+
textDecoration: 'underline'
|
|
30
27
|
}
|
|
31
|
-
},
|
|
28
|
+
}),
|
|
32
29
|
inverse: {
|
|
33
30
|
color: theme.colors.textLinkInverse
|
|
34
31
|
},
|
|
@@ -96,7 +96,7 @@ var ThemeContextProvider = function ThemeContextProvider(_ref) {
|
|
|
96
96
|
}, []);
|
|
97
97
|
var isOsDarkModeEnabled = useIsOsDarkModeEnabled();
|
|
98
98
|
var contextTheme = React.useMemo(function () {
|
|
99
|
-
var _theme$colorScheme, _theme$Link;
|
|
99
|
+
var _theme$colorScheme, _theme$mediaQueries, _theme$Link;
|
|
100
100
|
|
|
101
101
|
// TODO: In next major version we could change this to "auto" by default
|
|
102
102
|
var colorScheme = (_theme$colorScheme = theme.colorScheme) !== null && _theme$colorScheme !== void 0 ? _theme$colorScheme : 'light';
|
|
@@ -123,7 +123,7 @@ var ThemeContextProvider = function ThemeContextProvider(_ref) {
|
|
|
123
123
|
}
|
|
124
124
|
}, theme.analytics),
|
|
125
125
|
dimensions: _objectSpread(_objectSpread({}, dimensions), theme.dimensions),
|
|
126
|
-
mq:
|
|
126
|
+
mq: createMediaQueries((_theme$mediaQueries = theme.mediaQueries) !== null && _theme$mediaQueries !== void 0 ? _theme$mediaQueries : mediaQueriesConfig),
|
|
127
127
|
colors: colors,
|
|
128
128
|
Link: (_theme$Link = theme.Link) !== null && _theme$Link !== void 0 ? _theme$Link : AnchorLink,
|
|
129
129
|
isDarkMode: isDarkModeEnabled,
|