@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/select.js
CHANGED
|
@@ -132,7 +132,7 @@ function _defineProperty(obj, key, value) {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
var useStyles = (0, _jss.createUseStyles)(function (theme) {
|
|
135
|
-
var _selectContainer;
|
|
135
|
+
var _selectContainer, _menuItem;
|
|
136
136
|
|
|
137
137
|
return {
|
|
138
138
|
selectContainer: (_selectContainer = {
|
|
@@ -152,7 +152,8 @@ var useStyles = (0, _jss.createUseStyles)(function (theme) {
|
|
|
152
152
|
}), _selectContainer),
|
|
153
153
|
select: {
|
|
154
154
|
fontFamily: 'inherit',
|
|
155
|
-
backgroundColor:
|
|
155
|
+
backgroundColor: 'transparent',
|
|
156
|
+
// FieldContainer gives the correct background color
|
|
156
157
|
paddingTop: function paddingTop(_ref3) {
|
|
157
158
|
var label = _ref3.label;
|
|
158
159
|
return label ? 24 : 16;
|
|
@@ -171,19 +172,23 @@ var useStyles = (0, _jss.createUseStyles)(function (theme) {
|
|
|
171
172
|
height: '100%',
|
|
172
173
|
textOverflow: 'ellipsis',
|
|
173
174
|
'&:disabled': {
|
|
174
|
-
color: theme.colors.
|
|
175
|
+
color: theme.colors.textDisabled
|
|
175
176
|
},
|
|
176
177
|
appearance: 'none',
|
|
177
178
|
cursor: function cursor(_ref5) {
|
|
178
179
|
var disabled = _ref5.disabled;
|
|
179
|
-
return disabled ? '
|
|
180
|
+
return disabled ? 'inherit' : 'pointer';
|
|
180
181
|
}
|
|
181
182
|
},
|
|
182
183
|
arrowDown: {
|
|
183
184
|
position: 'absolute',
|
|
184
185
|
right: 16,
|
|
185
186
|
top: 'calc(50% - 12px)',
|
|
186
|
-
pointerEvents: 'none'
|
|
187
|
+
pointerEvents: 'none',
|
|
188
|
+
opacity: function opacity(_ref6) {
|
|
189
|
+
var disabled = _ref6.disabled;
|
|
190
|
+
return disabled ? 0.3 : 1;
|
|
191
|
+
}
|
|
187
192
|
},
|
|
188
193
|
selectText: {
|
|
189
194
|
position: 'absolute',
|
|
@@ -193,13 +198,13 @@ var useStyles = (0, _jss.createUseStyles)(function (theme) {
|
|
|
193
198
|
right: 48 + 1,
|
|
194
199
|
// 48 for icon and +1 for border
|
|
195
200
|
overflow: 'hidden',
|
|
196
|
-
top: function top(
|
|
197
|
-
var label =
|
|
201
|
+
top: function top(_ref7) {
|
|
202
|
+
var label = _ref7.label;
|
|
198
203
|
return label ? 27 : 17;
|
|
199
204
|
},
|
|
200
205
|
fontSize: 16,
|
|
201
|
-
color: function color(
|
|
202
|
-
var disabled =
|
|
206
|
+
color: function color(_ref8) {
|
|
207
|
+
var disabled = _ref8.disabled;
|
|
203
208
|
return disabled ? theme.colors.textDisabled : theme.colors.textPrimary;
|
|
204
209
|
},
|
|
205
210
|
maxWidth: '100%',
|
|
@@ -211,16 +216,16 @@ var useStyles = (0, _jss.createUseStyles)(function (theme) {
|
|
|
211
216
|
padding: 0,
|
|
212
217
|
listStyleType: 'none',
|
|
213
218
|
position: 'absolute',
|
|
214
|
-
top: function top(
|
|
215
|
-
var optionsComputedProps =
|
|
219
|
+
top: function top(_ref9) {
|
|
220
|
+
var optionsComputedProps = _ref9.optionsComputedProps;
|
|
216
221
|
return optionsComputedProps.top;
|
|
217
222
|
},
|
|
218
|
-
left: function left(
|
|
219
|
-
var optionsComputedProps =
|
|
223
|
+
left: function left(_ref10) {
|
|
224
|
+
var optionsComputedProps = _ref10.optionsComputedProps;
|
|
220
225
|
return optionsComputedProps.left;
|
|
221
226
|
},
|
|
222
|
-
minWidth: function minWidth(
|
|
223
|
-
var optionsComputedProps =
|
|
227
|
+
minWidth: function minWidth(_ref11) {
|
|
228
|
+
var optionsComputedProps = _ref11.optionsComputedProps;
|
|
224
229
|
return optionsComputedProps.width;
|
|
225
230
|
},
|
|
226
231
|
borderRadius: 4,
|
|
@@ -228,23 +233,23 @@ var useStyles = (0, _jss.createUseStyles)(function (theme) {
|
|
|
228
233
|
backgroundColor: theme.colors.backgroundContainer,
|
|
229
234
|
paddingTop: 8,
|
|
230
235
|
paddingBottom: 8,
|
|
231
|
-
transformOrigin: function transformOrigin(
|
|
232
|
-
var optionsComputedProps =
|
|
236
|
+
transformOrigin: function transformOrigin(_ref12) {
|
|
237
|
+
var optionsComputedProps = _ref12.optionsComputedProps;
|
|
233
238
|
return optionsComputedProps.transformOrigin;
|
|
234
239
|
},
|
|
235
240
|
transition: 'opacity .03s linear,transform .12s cubic-bezier(0,0,.2,1) .15s',
|
|
236
|
-
opacity: function opacity(
|
|
237
|
-
var animateShowOptions =
|
|
241
|
+
opacity: function opacity(_ref13) {
|
|
242
|
+
var animateShowOptions = _ref13.animateShowOptions;
|
|
238
243
|
return animateShowOptions ? 1 : 0;
|
|
239
244
|
},
|
|
240
|
-
transform: function transform(
|
|
241
|
-
var animateShowOptions =
|
|
245
|
+
transform: function transform(_ref14) {
|
|
246
|
+
var animateShowOptions = _ref14.animateShowOptions;
|
|
242
247
|
return animateShowOptions ? 'scale(1)' : 'scale(0)';
|
|
243
248
|
},
|
|
244
|
-
maxHeight: function maxHeight(
|
|
249
|
+
maxHeight: function maxHeight(_ref15) {
|
|
245
250
|
var _optionsComputedProps;
|
|
246
251
|
|
|
247
|
-
var optionsComputedProps =
|
|
252
|
+
var optionsComputedProps = _ref15.optionsComputedProps;
|
|
248
253
|
return (_optionsComputedProps = optionsComputedProps.maxHeight) !== null && _optionsComputedProps !== void 0 ? _optionsComputedProps : '416px';
|
|
249
254
|
},
|
|
250
255
|
overflowY: 'auto'
|
|
@@ -252,40 +257,38 @@ var useStyles = (0, _jss.createUseStyles)(function (theme) {
|
|
|
252
257
|
menuItemSelected: {
|
|
253
258
|
backgroundColor: 'rgba(0, 0, 0, 0.14)'
|
|
254
259
|
},
|
|
255
|
-
menuItem: {
|
|
260
|
+
menuItem: (_menuItem = {
|
|
256
261
|
color: theme.colors.textPrimary,
|
|
257
262
|
lineHeight: 1.5,
|
|
258
263
|
padding: '6px 16px',
|
|
259
264
|
height: 48,
|
|
260
|
-
transition: 'background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms'
|
|
265
|
+
transition: 'background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms'
|
|
266
|
+
}, _defineProperty(_menuItem, theme.mq.supportsHover, {
|
|
261
267
|
'&:hover': {
|
|
262
268
|
backgroundColor: 'rgba(0, 0, 0, 0.08)'
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
alignItems: 'center',
|
|
266
|
-
cursor: 'pointer'
|
|
267
|
-
}
|
|
269
|
+
}
|
|
270
|
+
}), _defineProperty(_menuItem, "display", 'flex'), _defineProperty(_menuItem, "alignItems", 'center'), _defineProperty(_menuItem, "cursor", 'pointer'), _menuItem)
|
|
268
271
|
};
|
|
269
272
|
});
|
|
270
273
|
|
|
271
|
-
var Select = function Select(
|
|
272
|
-
var
|
|
273
|
-
|
|
274
|
-
var id =
|
|
275
|
-
label =
|
|
276
|
-
helperTextProp =
|
|
277
|
-
valueProp =
|
|
278
|
-
onChangeValueProp =
|
|
279
|
-
name =
|
|
280
|
-
fullWidth =
|
|
281
|
-
options =
|
|
282
|
-
optional =
|
|
283
|
-
disabledProp =
|
|
284
|
-
errorProp =
|
|
285
|
-
_onBlur =
|
|
286
|
-
|
|
287
|
-
autoFocus =
|
|
288
|
-
native =
|
|
274
|
+
var Select = function Select(_ref16) {
|
|
275
|
+
var _ref20, _inputRef$current;
|
|
276
|
+
|
|
277
|
+
var id = _ref16.id,
|
|
278
|
+
label = _ref16.label,
|
|
279
|
+
helperTextProp = _ref16.helperText,
|
|
280
|
+
valueProp = _ref16.value,
|
|
281
|
+
onChangeValueProp = _ref16.onChangeValue,
|
|
282
|
+
name = _ref16.name,
|
|
283
|
+
fullWidth = _ref16.fullWidth,
|
|
284
|
+
options = _ref16.options,
|
|
285
|
+
optional = _ref16.optional,
|
|
286
|
+
disabledProp = _ref16.disabled,
|
|
287
|
+
errorProp = _ref16.error,
|
|
288
|
+
_onBlur = _ref16.onBlur,
|
|
289
|
+
_ref16$autoFocus = _ref16.autoFocus,
|
|
290
|
+
autoFocus = _ref16$autoFocus === void 0 ? false : _ref16$autoFocus,
|
|
291
|
+
native = _ref16.native;
|
|
289
292
|
var inputRef = React.useRef(null);
|
|
290
293
|
var focusableRef = React.useRef(null);
|
|
291
294
|
var fieldRef = React.useRef(null);
|
|
@@ -488,8 +491,8 @@ var Select = function Select(_ref15) {
|
|
|
488
491
|
var _options$value, _options;
|
|
489
492
|
|
|
490
493
|
(0, _dom.cancelEvent)(e);
|
|
491
|
-
var newTentativeValueState = (_options$value = (_options = options[options.findIndex(function (
|
|
492
|
-
var value =
|
|
494
|
+
var newTentativeValueState = (_options$value = (_options = options[options.findIndex(function (_ref17) {
|
|
495
|
+
var value = _ref17.value;
|
|
493
496
|
return value === tentativeValueState;
|
|
494
497
|
}) + operand]) === null || _options === void 0 ? void 0 : _options.value) !== null && _options$value !== void 0 ? _options$value : tentativeValueState;
|
|
495
498
|
setTentativeValueState(newTentativeValueState);
|
|
@@ -510,8 +513,8 @@ var Select = function Select(_ref15) {
|
|
|
510
513
|
if (e.keyCode === _keyCodes.ENTER || e.keyCode === _keyCodes.SPACE) {
|
|
511
514
|
(0, _dom.cancelEvent)(e);
|
|
512
515
|
|
|
513
|
-
if (options.findIndex(function (
|
|
514
|
-
var value =
|
|
516
|
+
if (options.findIndex(function (_ref18) {
|
|
517
|
+
var value = _ref18.value;
|
|
515
518
|
return value === tentativeValueState;
|
|
516
519
|
}) !== -1 && tentativeValueState !== valueState) {
|
|
517
520
|
setValue(tentativeValueState);
|
|
@@ -549,8 +552,8 @@ var Select = function Select(_ref15) {
|
|
|
549
552
|
var getOptionText = function getOptionText(val) {
|
|
550
553
|
var _options$find;
|
|
551
554
|
|
|
552
|
-
return val ? (_options$find = options.find(function (
|
|
553
|
-
var value =
|
|
555
|
+
return val ? (_options$find = options.find(function (_ref19) {
|
|
556
|
+
var value = _ref19.value;
|
|
554
557
|
return value === val;
|
|
555
558
|
})) === null || _options$find === void 0 ? void 0 : _options$find.text : '';
|
|
556
559
|
};
|
|
@@ -575,6 +578,7 @@ var Select = function Select(_ref15) {
|
|
|
575
578
|
}
|
|
576
579
|
};
|
|
577
580
|
return shouldUseNative ? /*#__PURE__*/React.createElement(_textFieldComponents.FieldContainer, {
|
|
581
|
+
disabled: disabled,
|
|
578
582
|
helperText: /*#__PURE__*/React.createElement(_textFieldComponents.HelperText, {
|
|
579
583
|
error: error,
|
|
580
584
|
leftText: helperText
|
|
@@ -584,7 +588,7 @@ var Select = function Select(_ref15) {
|
|
|
584
588
|
}, label && /*#__PURE__*/React.createElement(_textFieldComponents.Label, {
|
|
585
589
|
error: error,
|
|
586
590
|
forId: inputId,
|
|
587
|
-
inputState: isFocused ? 'focused' : ((
|
|
591
|
+
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',
|
|
588
592
|
disabled: disabled,
|
|
589
593
|
optional: optional
|
|
590
594
|
}, label), /*#__PURE__*/React.createElement("select", {
|
|
@@ -617,8 +621,8 @@ var Select = function Select(_ref15) {
|
|
|
617
621
|
// Without this fix, the label is invisible when disabled
|
|
618
622
|
opacity: 1
|
|
619
623
|
}
|
|
620
|
-
}, options.every(function (
|
|
621
|
-
var value =
|
|
624
|
+
}, options.every(function (_ref21) {
|
|
625
|
+
var value = _ref21.value;
|
|
622
626
|
return !!value;
|
|
623
627
|
}) &&
|
|
624
628
|
/*#__PURE__*/
|
|
@@ -629,9 +633,9 @@ var Select = function Select(_ref15) {
|
|
|
629
633
|
style: {
|
|
630
634
|
display: 'none'
|
|
631
635
|
}
|
|
632
|
-
}), options.map(function (
|
|
633
|
-
var val =
|
|
634
|
-
text =
|
|
636
|
+
}), options.map(function (_ref22) {
|
|
637
|
+
var val = _ref22.value,
|
|
638
|
+
text = _ref22.text;
|
|
635
639
|
return /*#__PURE__*/React.createElement("option", {
|
|
636
640
|
key: val,
|
|
637
641
|
value: val
|
|
@@ -675,9 +679,9 @@ var Select = function Select(_ref15) {
|
|
|
675
679
|
className: classes.optionsContainer,
|
|
676
680
|
role: "listbox",
|
|
677
681
|
ref: optionsMenuRef
|
|
678
|
-
}, options.map(function (
|
|
679
|
-
var val =
|
|
680
|
-
text =
|
|
682
|
+
}, options.map(function (_ref23) {
|
|
683
|
+
var val = _ref23.value,
|
|
684
|
+
text = _ref23.text;
|
|
681
685
|
return /*#__PURE__*/React.createElement("li", {
|
|
682
686
|
role: "option",
|
|
683
687
|
"aria-selected": val === (valueState !== null && valueState !== void 0 ? valueState : value),
|
package/dist/skins/movistar.js
CHANGED
|
@@ -138,7 +138,7 @@ var getMovistarSkin = function getMovistarSkin(variant) {
|
|
|
138
138
|
textPrimaryInverse: palette.white,
|
|
139
139
|
textSecondary: palette.grey5,
|
|
140
140
|
textSecondaryInverse: palette.white,
|
|
141
|
-
textDisabled: palette.
|
|
141
|
+
textDisabled: palette.grey4,
|
|
142
142
|
textAmount: palette.movistarBlue,
|
|
143
143
|
// STATES
|
|
144
144
|
error: palette.pepper,
|
package/dist/skins/o2-classic.js
CHANGED
|
@@ -144,7 +144,7 @@ var getO2ClassicSkin = function getO2ClassicSkin() {
|
|
|
144
144
|
textPrimaryInverse: palette.white,
|
|
145
145
|
textSecondary: palette.grey5,
|
|
146
146
|
textSecondaryInverse: palette.white,
|
|
147
|
-
textDisabled: palette.
|
|
147
|
+
textDisabled: palette.grey4,
|
|
148
148
|
textAmount: palette.o2SkyBlue,
|
|
149
149
|
// STATES
|
|
150
150
|
error: palette.pepper,
|
package/dist/skins/o2.js
CHANGED
|
@@ -144,7 +144,7 @@ var getO2Skin = function getO2Skin() {
|
|
|
144
144
|
textPrimaryInverse: palette.white,
|
|
145
145
|
textSecondary: palette.grey5,
|
|
146
146
|
textSecondaryInverse: palette.white,
|
|
147
|
-
textDisabled: palette.
|
|
147
|
+
textDisabled: palette.grey4,
|
|
148
148
|
textAmount: palette.o2BluePrimary,
|
|
149
149
|
// STATES
|
|
150
150
|
error: palette.pepper,
|
package/dist/skins/telefonica.js
CHANGED
|
@@ -138,7 +138,7 @@ var getTelefonicaSkin = function getTelefonicaSkin() {
|
|
|
138
138
|
textPrimaryInverse: palette.white,
|
|
139
139
|
textSecondary: palette.grey5,
|
|
140
140
|
textSecondaryInverse: palette.white,
|
|
141
|
-
textDisabled: palette.
|
|
141
|
+
textDisabled: palette.grey4,
|
|
142
142
|
textAmount: palette.telefonicaBlue,
|
|
143
143
|
// STATES
|
|
144
144
|
error: palette.coral,
|
package/dist/skins/vivo.js
CHANGED
|
@@ -132,7 +132,7 @@ var getVivoSkin = function getVivoSkin() {
|
|
|
132
132
|
textPrimaryInverse: palette.white,
|
|
133
133
|
textSecondary: palette.grey5,
|
|
134
134
|
textSecondaryInverse: palette.white,
|
|
135
|
-
textDisabled: palette.
|
|
135
|
+
textDisabled: palette.grey4,
|
|
136
136
|
textAmount: palette.vivoPurple,
|
|
137
137
|
// STATES
|
|
138
138
|
error: palette.pepper,
|
package/dist/tabs.js
CHANGED
|
@@ -111,6 +111,8 @@ var TAB_MAX_WIDTH = 284;
|
|
|
111
111
|
var TAB_HEIGHT = 56;
|
|
112
112
|
var LINE_ANIMATION_DURATION_MS = (0, _platform.isRunningAcceptanceTest)() ? 0 : 300;
|
|
113
113
|
var useStyles = (0, _jss.createUseStyles)(function (_ref) {
|
|
114
|
+
var _tab;
|
|
115
|
+
|
|
114
116
|
var colors = _ref.colors,
|
|
115
117
|
mq = _ref.mq;
|
|
116
118
|
return {
|
|
@@ -138,7 +140,7 @@ var useStyles = (0, _jss.createUseStyles)(function (_ref) {
|
|
|
138
140
|
height: TAB_HEIGHT,
|
|
139
141
|
display: 'flex'
|
|
140
142
|
},
|
|
141
|
-
tab:
|
|
143
|
+
tab: (_tab = {
|
|
142
144
|
flex: '1 0 80px',
|
|
143
145
|
display: 'inline-flex',
|
|
144
146
|
alignItems: 'center',
|
|
@@ -160,19 +162,19 @@ var useStyles = (0, _jss.createUseStyles)(function (_ref) {
|
|
|
160
162
|
}
|
|
161
163
|
|
|
162
164
|
return TAB_MAX_WIDTH;
|
|
163
|
-
}
|
|
165
|
+
}
|
|
166
|
+
}, _defineProperty(_tab, mq.supportsHover, {
|
|
164
167
|
'&:hover': {
|
|
165
168
|
color: colors.textPrimary
|
|
166
|
-
},
|
|
167
|
-
fallbacks: {
|
|
168
|
-
maxWidth: TAB_MAX_WIDTH // max() is not supported by all browsers
|
|
169
|
-
|
|
170
169
|
}
|
|
171
|
-
},
|
|
170
|
+
}), _defineProperty(_tab, "fallbacks", {
|
|
171
|
+
maxWidth: TAB_MAX_WIDTH // max() is not supported by all browsers
|
|
172
|
+
|
|
173
|
+
}), _defineProperty(_tab, mq.desktopOrBigger, {
|
|
172
174
|
flex: '0 1 208px',
|
|
173
175
|
padding: "16px 32px",
|
|
174
176
|
maxWidth: TAB_MAX_WIDTH
|
|
175
|
-
}),
|
|
177
|
+
}), _tab),
|
|
176
178
|
tabWithIcon: _defineProperty({
|
|
177
179
|
flexBasis: 112
|
|
178
180
|
}, mq.desktopOrBigger, {
|
package/dist/text-field-base.js
CHANGED
|
@@ -244,7 +244,8 @@ var commonInputStyles = function commonInputStyles(theme) {
|
|
|
244
244
|
}
|
|
245
245
|
},
|
|
246
246
|
'&:disabled': {
|
|
247
|
-
color: theme.colors.
|
|
247
|
+
color: theme.colors.textDisabled,
|
|
248
|
+
cursor: 'not-allowed'
|
|
248
249
|
},
|
|
249
250
|
boxShadow: 'none' // reset FF red shadow styles for required inputs
|
|
250
251
|
|
|
@@ -342,7 +343,11 @@ var useStyles = (0, _jss.createUseStyles)(function (theme) {
|
|
|
342
343
|
paddingLeft: 8,
|
|
343
344
|
paddingRight: 16,
|
|
344
345
|
display: 'flex',
|
|
345
|
-
alignItems: 'center'
|
|
346
|
+
alignItems: 'center',
|
|
347
|
+
opacity: function opacity(_ref8) {
|
|
348
|
+
var disabled = _ref8.disabled;
|
|
349
|
+
return disabled ? 0.3 : 1;
|
|
350
|
+
}
|
|
346
351
|
},
|
|
347
352
|
startIcon: {
|
|
348
353
|
pointerEvents: 'none',
|
|
@@ -352,24 +357,31 @@ var useStyles = (0, _jss.createUseStyles)(function (theme) {
|
|
|
352
357
|
display: 'flex',
|
|
353
358
|
alignItems: 'center',
|
|
354
359
|
height: '100%',
|
|
355
|
-
position: 'absolute'
|
|
360
|
+
position: 'absolute',
|
|
361
|
+
opacity: function opacity(_ref9) {
|
|
362
|
+
var disabled = _ref9.disabled;
|
|
363
|
+
return disabled ? 0.3 : 1;
|
|
364
|
+
}
|
|
356
365
|
},
|
|
357
366
|
prefix: {
|
|
358
|
-
paddingTop: function paddingTop(
|
|
359
|
-
var hasLabel =
|
|
367
|
+
paddingTop: function paddingTop(_ref10) {
|
|
368
|
+
var hasLabel = _ref10.hasLabel;
|
|
360
369
|
return hasLabel ? 25 : 16;
|
|
361
370
|
},
|
|
362
|
-
paddingBottom: function paddingBottom(
|
|
363
|
-
var hasLabel =
|
|
371
|
+
paddingBottom: function paddingBottom(_ref11) {
|
|
372
|
+
var hasLabel = _ref11.hasLabel;
|
|
364
373
|
return hasLabel ? 8 : 16;
|
|
365
374
|
},
|
|
366
375
|
paddingLeft: 12,
|
|
367
376
|
paddingRight: 16,
|
|
368
377
|
display: 'flex',
|
|
369
378
|
alignItems: 'center',
|
|
370
|
-
color:
|
|
371
|
-
|
|
372
|
-
|
|
379
|
+
color: function color(_ref12) {
|
|
380
|
+
var disabled = _ref12.disabled;
|
|
381
|
+
return disabled ? theme.colors.textDisabled : theme.colors.textSecondary;
|
|
382
|
+
},
|
|
383
|
+
opacity: function opacity(_ref13) {
|
|
384
|
+
var inputState = _ref13.inputState;
|
|
373
385
|
return inputState === 'default' ? 0 : 1;
|
|
374
386
|
},
|
|
375
387
|
transition: 'opacity 150ms cubic-bezier(0.0, 0, 0.2, 1) 0ms'
|
|
@@ -381,33 +393,33 @@ var fixAutoComplete = function fixAutoComplete(platformOverrides, autoComplete)
|
|
|
381
393
|
return autoComplete === 'off' && (0, _platform.isChrome)(platformOverrides) ? 'nope' : autoComplete;
|
|
382
394
|
};
|
|
383
395
|
|
|
384
|
-
var TextFieldBaseComponent = /*#__PURE__*/React.forwardRef(function (
|
|
396
|
+
var TextFieldBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
|
|
385
397
|
var _defaultValue$length;
|
|
386
398
|
|
|
387
|
-
var error =
|
|
388
|
-
helperText =
|
|
389
|
-
label =
|
|
390
|
-
inputProps =
|
|
391
|
-
inputRef =
|
|
392
|
-
defaultValue =
|
|
393
|
-
value =
|
|
394
|
-
_onFocus =
|
|
395
|
-
_onBlur =
|
|
396
|
-
inputComponent =
|
|
397
|
-
prefix =
|
|
398
|
-
startIcon =
|
|
399
|
-
endIcon =
|
|
400
|
-
endIconOverlay =
|
|
401
|
-
shrinkLabelProp =
|
|
402
|
-
|
|
403
|
-
multiline =
|
|
404
|
-
focus =
|
|
405
|
-
fieldRef =
|
|
406
|
-
maxLength =
|
|
407
|
-
idProp =
|
|
408
|
-
autoCompleteProp =
|
|
409
|
-
fullWidth =
|
|
410
|
-
rest = _objectWithoutProperties(
|
|
399
|
+
var error = _ref14.error,
|
|
400
|
+
helperText = _ref14.helperText,
|
|
401
|
+
label = _ref14.label,
|
|
402
|
+
inputProps = _ref14.inputProps,
|
|
403
|
+
inputRef = _ref14.inputRef,
|
|
404
|
+
defaultValue = _ref14.defaultValue,
|
|
405
|
+
value = _ref14.value,
|
|
406
|
+
_onFocus = _ref14.onFocus,
|
|
407
|
+
_onBlur = _ref14.onBlur,
|
|
408
|
+
inputComponent = _ref14.inputComponent,
|
|
409
|
+
prefix = _ref14.prefix,
|
|
410
|
+
startIcon = _ref14.startIcon,
|
|
411
|
+
endIcon = _ref14.endIcon,
|
|
412
|
+
endIconOverlay = _ref14.endIconOverlay,
|
|
413
|
+
shrinkLabelProp = _ref14.shrinkLabel,
|
|
414
|
+
_ref14$multiline = _ref14.multiline,
|
|
415
|
+
multiline = _ref14$multiline === void 0 ? false : _ref14$multiline,
|
|
416
|
+
focus = _ref14.focus,
|
|
417
|
+
fieldRef = _ref14.fieldRef,
|
|
418
|
+
maxLength = _ref14.maxLength,
|
|
419
|
+
idProp = _ref14.id,
|
|
420
|
+
autoCompleteProp = _ref14.autoComplete,
|
|
421
|
+
fullWidth = _ref14.fullWidth,
|
|
422
|
+
rest = _objectWithoutProperties(_ref14, _excluded);
|
|
411
423
|
|
|
412
424
|
var id = (0, _hooks.useAriaId)(idProp);
|
|
413
425
|
|
|
@@ -437,7 +449,8 @@ var TextFieldBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref11, ref
|
|
|
437
449
|
hasLabel: hasLabel,
|
|
438
450
|
prefix: prefix,
|
|
439
451
|
multiline: multiline,
|
|
440
|
-
type: rest.type
|
|
452
|
+
type: rest.type,
|
|
453
|
+
disabled: rest.disabled
|
|
441
454
|
});
|
|
442
455
|
React.useEffect(function () {
|
|
443
456
|
if (inputState !== 'focused' && value !== null && value !== void 0 && value.length) {
|
|
@@ -496,6 +509,7 @@ var TextFieldBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref11, ref
|
|
|
496
509
|
}
|
|
497
510
|
|
|
498
511
|
return /*#__PURE__*/React.createElement(_textFieldComponents.FieldContainer, {
|
|
512
|
+
disabled: rest.disabled,
|
|
499
513
|
helperText: /*#__PURE__*/React.createElement(_textFieldComponents.HelperText, {
|
|
500
514
|
error: error,
|
|
501
515
|
leftText: helperText,
|
|
@@ -588,10 +602,10 @@ var Autosuggest = /*#__PURE__*/React.lazy(function () {
|
|
|
588
602
|
/* webpackChunkName: "react-autosuggest" */
|
|
589
603
|
'react-autosuggest');
|
|
590
604
|
});
|
|
591
|
-
var TextFieldBase = /*#__PURE__*/React.forwardRef(function (
|
|
592
|
-
var getSuggestions =
|
|
593
|
-
idProp =
|
|
594
|
-
props = _objectWithoutProperties(
|
|
605
|
+
var TextFieldBase = /*#__PURE__*/React.forwardRef(function (_ref15, ref) {
|
|
606
|
+
var getSuggestions = _ref15.getSuggestions,
|
|
607
|
+
idProp = _ref15.id,
|
|
608
|
+
props = _objectWithoutProperties(_ref15, _excluded2);
|
|
595
609
|
|
|
596
610
|
var _React$useState5 = React.useState([]),
|
|
597
611
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
@@ -628,10 +642,10 @@ var TextFieldBase = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
|
|
|
628
642
|
id: id,
|
|
629
643
|
autoComplete: fixAutoComplete(platformOverrides, 'off'),
|
|
630
644
|
// @ts-expect-error Autosuggest expects slightly different types
|
|
631
|
-
onChange: function onChange(e,
|
|
645
|
+
onChange: function onChange(e, _ref16) {
|
|
632
646
|
var _props$onChange2;
|
|
633
647
|
|
|
634
|
-
var newValue =
|
|
648
|
+
var newValue = _ref16.newValue; // hack to mutate event value
|
|
635
649
|
|
|
636
650
|
e.target = _objectSpread(_objectSpread({}, e.target), {}, {
|
|
637
651
|
value: newValue
|
|
@@ -648,8 +662,8 @@ var TextFieldBase = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
|
|
|
648
662
|
}));
|
|
649
663
|
},
|
|
650
664
|
suggestions: suggestions,
|
|
651
|
-
onSuggestionsFetchRequested: function onSuggestionsFetchRequested(
|
|
652
|
-
var value =
|
|
665
|
+
onSuggestionsFetchRequested: function onSuggestionsFetchRequested(_ref17) {
|
|
666
|
+
var value = _ref17.value;
|
|
653
667
|
return setSuggestions(getSuggestions(value));
|
|
654
668
|
},
|
|
655
669
|
onSuggestionsClearRequested: function onSuggestionsClearRequested() {
|
|
@@ -658,8 +672,8 @@ var TextFieldBase = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
|
|
|
658
672
|
getSuggestionValue: function getSuggestionValue(suggestion) {
|
|
659
673
|
return suggestion;
|
|
660
674
|
},
|
|
661
|
-
renderSuggestion: function renderSuggestion(suggestion,
|
|
662
|
-
var isHighlighted =
|
|
675
|
+
renderSuggestion: function renderSuggestion(suggestion, _ref18) {
|
|
676
|
+
var isHighlighted = _ref18.isHighlighted;
|
|
663
677
|
return /*#__PURE__*/React.createElement("div", {
|
|
664
678
|
role: "menuitem",
|
|
665
679
|
className: (0, _classnames.default)(classes.menuItem, _defineProperty({}, classes.menuItemSelected, isHighlighted))
|
|
@@ -21,6 +21,7 @@ declare type HelperTextProps = {
|
|
|
21
21
|
export declare const HelperText: React.FC<HelperTextProps>;
|
|
22
22
|
declare type FieldContainerProps = {
|
|
23
23
|
multiline?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
24
25
|
children: React.ReactNode;
|
|
25
26
|
helperText?: React.ReactNode;
|
|
26
27
|
className?: string;
|
|
@@ -336,21 +336,30 @@ var useFieldContainerStyles = (0, _jss.createUseStyles)(function (theme) {
|
|
|
336
336
|
display: 'flex',
|
|
337
337
|
position: 'relative',
|
|
338
338
|
lineHeight: '16px',
|
|
339
|
-
backgroundColor:
|
|
339
|
+
backgroundColor: function backgroundColor(_ref10) {
|
|
340
|
+
var disabled = _ref10.disabled;
|
|
341
|
+
return disabled ? theme.colors.backgroundAlternative : theme.colors.backgroundContainer;
|
|
342
|
+
},
|
|
343
|
+
cursor: function cursor(_ref11) {
|
|
344
|
+
var disabled = _ref11.disabled;
|
|
345
|
+
return disabled ? 'not-allowed' : 'initial';
|
|
346
|
+
}
|
|
340
347
|
}
|
|
341
348
|
};
|
|
342
349
|
});
|
|
343
350
|
|
|
344
|
-
var FieldContainer = function FieldContainer(
|
|
345
|
-
var multiline =
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
+
var FieldContainer = function FieldContainer(_ref12) {
|
|
352
|
+
var multiline = _ref12.multiline,
|
|
353
|
+
disabled = _ref12.disabled,
|
|
354
|
+
children = _ref12.children,
|
|
355
|
+
helperText = _ref12.helperText,
|
|
356
|
+
className = _ref12.className,
|
|
357
|
+
fieldRef = _ref12.fieldRef,
|
|
358
|
+
fullWidth = _ref12.fullWidth;
|
|
351
359
|
var classes = useFieldContainerStyles({
|
|
352
360
|
multiline: multiline,
|
|
353
|
-
fullWidth: fullWidth
|
|
361
|
+
fullWidth: fullWidth,
|
|
362
|
+
disabled: disabled
|
|
354
363
|
});
|
|
355
364
|
return /*#__PURE__*/React.createElement("div", {
|
|
356
365
|
className: classes.fieldContainer
|
|
@@ -22,6 +22,7 @@ declare type HelperTextProps = {
|
|
|
22
22
|
declare export var HelperText: React.ComponentType<HelperTextProps>;
|
|
23
23
|
declare type FieldContainerProps = {
|
|
24
24
|
multiline?: boolean,
|
|
25
|
+
disabled?: boolean,
|
|
25
26
|
children: React.Node,
|
|
26
27
|
helperText?: React.Node,
|
|
27
28
|
className?: string,
|