@telefonica/mistica 10.0.1 → 10.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/button-fixed-footer-layout.d.ts +2 -2
  3. package/dist/button-layout.d.ts +2 -2
  4. package/dist/button.d.ts +1 -1
  5. package/dist/callout.d.ts +4 -3
  6. package/dist/card.d.ts +9 -7
  7. package/dist/circle.d.ts +1 -1
  8. package/dist/dialog.d.ts +1 -1
  9. package/dist/double-field.d.ts +11 -1
  10. package/dist/double-field.js.flow +20 -20
  11. package/dist/empty-state-card.d.ts +1 -1
  12. package/dist/empty-state-card.js.flow +0 -1
  13. package/dist/empty-state.d.ts +1 -1
  14. package/dist/empty-state.js.flow +0 -1
  15. package/dist/feedback-screen.d.ts +4 -3
  16. package/dist/header.d.ts +7 -5
  17. package/dist/highlighted-card.d.ts +2 -2
  18. package/dist/icon-button.js +4 -6
  19. package/dist/list.js +9 -14
  20. package/dist/navigation-bar.d.ts +16 -4
  21. package/dist/navigation-bar.js +123 -88
  22. package/dist/navigation-bar.js.flow +20 -4
  23. package/dist/navigation-breadcrumbs.d.ts +1 -1
  24. package/dist/navigation-breadcrumbs.js.flow +1 -1
  25. package/dist/password-field.js +16 -8
  26. package/dist/radio-button.d.ts +1 -1
  27. package/dist/section-title.d.ts +2 -1
  28. package/dist/select.js +74 -65
  29. package/dist/skins/movistar.js +1 -1
  30. package/dist/skins/o2-classic.js +1 -1
  31. package/dist/skins/o2.js +1 -1
  32. package/dist/skins/telefonica.js +1 -1
  33. package/dist/skins/vivo.js +1 -1
  34. package/dist/switch-component.d.ts +1 -1
  35. package/dist/tabs.js +10 -8
  36. package/dist/tag.d.ts +2 -2
  37. package/dist/tag.js.flow +2 -2
  38. package/dist/text-field-base.js +80 -50
  39. package/dist/text-field-components.d.ts +1 -0
  40. package/dist/text-field-components.js +18 -9
  41. package/dist/text-field-components.js.flow +1 -0
  42. package/dist/text-link.d.ts +2 -2
  43. package/dist/text-link.js +20 -23
  44. package/dist/text-link.js.flow +2 -2
  45. package/dist/theme-context-provider.js +2 -2
  46. package/dist/theme.d.ts +2 -0
  47. package/dist/theme.js +8 -4
  48. package/dist/theme.js.flow +2 -0
  49. package/dist/utils/media-queries.d.ts +1 -0
  50. package/dist/utils/media-queries.js +6 -1
  51. package/dist/utils/media-queries.js.flow +1 -0
  52. package/dist-es/icon-button.js +4 -5
  53. package/dist-es/list.js +9 -14
  54. package/dist-es/navigation-bar.js +122 -88
  55. package/dist-es/password-field.js +16 -8
  56. package/dist-es/select.js +74 -65
  57. package/dist-es/skins/movistar.js +1 -1
  58. package/dist-es/skins/o2-classic.js +1 -1
  59. package/dist-es/skins/o2.js +1 -1
  60. package/dist-es/skins/telefonica.js +1 -1
  61. package/dist-es/skins/vivo.js +1 -1
  62. package/dist-es/tabs.js +10 -8
  63. package/dist-es/text-field-base.js +80 -50
  64. package/dist-es/text-field-components.js +18 -9
  65. package/dist-es/text-link.js +7 -10
  66. package/dist-es/theme-context-provider.js +2 -2
  67. package/dist-es/theme.js +8 -4
  68. package/dist-es/utils/media-queries.js +6 -1
  69. package/package.json +2 -1
@@ -28,9 +28,9 @@ import IconButton from './icon-button';
28
28
  import Visibility from './icons/icon-visibility';
29
29
  import VisibilityOff from './icons/icon-visibility-off';
30
30
  import { createUseStyles } from './jss';
31
- var usePasswordAdornmentStyles = createUseStyles(function () {
31
+ var usePasswordAdornmentStyles = createUseStyles(function (theme) {
32
32
  return {
33
- shadow: _defineProperty({}, '@media (hover: hover)', {
33
+ shadow: _defineProperty({}, theme.mq.supportsHover, {
34
34
  '&:hover': {
35
35
  backgroundColor: 'rgba(0, 0, 0, 0.08)'
36
36
  }
@@ -87,6 +87,8 @@ var PasswordField = function PasswordField(_ref2) {
87
87
  isVisible = _React$useState2[0],
88
88
  setIsVisible = _React$useState2[1];
89
89
 
90
+ var caretPositionRef = React.useRef(0);
91
+
90
92
  var _inputRef = React.useRef(null);
91
93
 
92
94
  var processValue = function processValue(value) {
@@ -97,16 +99,22 @@ var PasswordField = function PasswordField(_ref2) {
97
99
  var input = _inputRef.current;
98
100
 
99
101
  if (input) {
100
- input.focus(); // neeeded to place the caret at the end
102
+ if (input.selectionStart !== null) {
103
+ caretPositionRef.current = input.selectionStart;
104
+ }
101
105
 
102
- setTimeout(function () {
103
- var v = input.value;
104
- input.value = '';
105
- input.value = v;
106
- }, 0);
106
+ input.focus();
107
107
  }
108
108
  };
109
109
 
110
+ React.useEffect(function () {
111
+ var input = _inputRef.current;
112
+
113
+ if (input) {
114
+ input.selectionStart = caretPositionRef.current;
115
+ input.selectionEnd = caretPositionRef.current;
116
+ }
117
+ }, [isVisible, caretPositionRef, _inputRef]);
110
118
  var fieldProps = useFieldProps({
111
119
  name: name,
112
120
  value: value,
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: theme.colors.backgroundContainer,
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,51 +67,60 @@ var useStyles = createUseStyles(function (theme) {
66
67
  height: '100%',
67
68
  textOverflow: 'ellipsis',
68
69
  '&:disabled': {
69
- color: theme.colors.border
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 ? 'initial' : 'pointer';
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',
85
90
  pointerEvents: 'none',
86
- left: 12,
87
- top: function top(_ref6) {
88
- var label = _ref6.label;
91
+ left: 12 + 1,
92
+ // 12 for select paddingLeft and +1 for border
93
+ right: 48 + 1,
94
+ // 48 for icon and +1 for border
95
+ overflow: 'hidden',
96
+ top: function top(_ref7) {
97
+ var label = _ref7.label;
89
98
  return label ? 27 : 17;
90
99
  },
91
100
  fontSize: 16,
92
- color: function color(_ref7) {
93
- var disabled = _ref7.disabled;
101
+ color: function color(_ref8) {
102
+ var disabled = _ref8.disabled;
94
103
  return disabled ? theme.colors.textDisabled : theme.colors.textPrimary;
95
104
  },
96
105
  maxWidth: '100%',
97
- textOverflow: 'ellipsis'
106
+ textOverflow: 'ellipsis',
107
+ whiteSpace: 'nowrap'
98
108
  },
99
109
  optionsContainer: {
100
110
  margin: 0,
101
111
  padding: 0,
102
112
  listStyleType: 'none',
103
113
  position: 'absolute',
104
- top: function top(_ref8) {
105
- var optionsComputedProps = _ref8.optionsComputedProps;
114
+ top: function top(_ref9) {
115
+ var optionsComputedProps = _ref9.optionsComputedProps;
106
116
  return optionsComputedProps.top;
107
117
  },
108
- left: function left(_ref9) {
109
- var optionsComputedProps = _ref9.optionsComputedProps;
118
+ left: function left(_ref10) {
119
+ var optionsComputedProps = _ref10.optionsComputedProps;
110
120
  return optionsComputedProps.left;
111
121
  },
112
- width: function width(_ref10) {
113
- var optionsComputedProps = _ref10.optionsComputedProps;
122
+ minWidth: function minWidth(_ref11) {
123
+ var optionsComputedProps = _ref11.optionsComputedProps;
114
124
  return optionsComputedProps.width;
115
125
  },
116
126
  borderRadius: 4,
@@ -118,23 +128,23 @@ var useStyles = createUseStyles(function (theme) {
118
128
  backgroundColor: theme.colors.backgroundContainer,
119
129
  paddingTop: 8,
120
130
  paddingBottom: 8,
121
- transformOrigin: function transformOrigin(_ref11) {
122
- var optionsComputedProps = _ref11.optionsComputedProps;
131
+ transformOrigin: function transformOrigin(_ref12) {
132
+ var optionsComputedProps = _ref12.optionsComputedProps;
123
133
  return optionsComputedProps.transformOrigin;
124
134
  },
125
135
  transition: 'opacity .03s linear,transform .12s cubic-bezier(0,0,.2,1) .15s',
126
- opacity: function opacity(_ref12) {
127
- var animateShowOptions = _ref12.animateShowOptions;
136
+ opacity: function opacity(_ref13) {
137
+ var animateShowOptions = _ref13.animateShowOptions;
128
138
  return animateShowOptions ? 1 : 0;
129
139
  },
130
- transform: function transform(_ref13) {
131
- var animateShowOptions = _ref13.animateShowOptions;
140
+ transform: function transform(_ref14) {
141
+ var animateShowOptions = _ref14.animateShowOptions;
132
142
  return animateShowOptions ? 'scale(1)' : 'scale(0)';
133
143
  },
134
- maxHeight: function maxHeight(_ref14) {
144
+ maxHeight: function maxHeight(_ref15) {
135
145
  var _optionsComputedProps;
136
146
 
137
- var optionsComputedProps = _ref14.optionsComputedProps;
147
+ var optionsComputedProps = _ref15.optionsComputedProps;
138
148
  return (_optionsComputedProps = optionsComputedProps.maxHeight) !== null && _optionsComputedProps !== void 0 ? _optionsComputedProps : '416px';
139
149
  },
140
150
  overflowY: 'auto'
@@ -142,40 +152,38 @@ var useStyles = createUseStyles(function (theme) {
142
152
  menuItemSelected: {
143
153
  backgroundColor: 'rgba(0, 0, 0, 0.14)'
144
154
  },
145
- menuItem: {
155
+ menuItem: (_menuItem = {
146
156
  color: theme.colors.textPrimary,
147
157
  lineHeight: 1.5,
148
158
  padding: '6px 16px',
149
159
  height: 48,
150
- 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, {
151
162
  '&:hover': {
152
163
  backgroundColor: 'rgba(0, 0, 0, 0.08)'
153
- },
154
- display: 'flex',
155
- alignItems: 'center',
156
- cursor: 'pointer'
157
- }
164
+ }
165
+ }), _defineProperty(_menuItem, "display", 'flex'), _defineProperty(_menuItem, "alignItems", 'center'), _defineProperty(_menuItem, "cursor", 'pointer'), _menuItem)
158
166
  };
159
167
  });
160
168
 
161
- var Select = function Select(_ref15) {
162
- var _ref19, _inputRef$current;
163
-
164
- var id = _ref15.id,
165
- label = _ref15.label,
166
- helperTextProp = _ref15.helperText,
167
- valueProp = _ref15.value,
168
- onChangeValueProp = _ref15.onChangeValue,
169
- name = _ref15.name,
170
- fullWidth = _ref15.fullWidth,
171
- options = _ref15.options,
172
- optional = _ref15.optional,
173
- disabledProp = _ref15.disabled,
174
- errorProp = _ref15.error,
175
- _onBlur = _ref15.onBlur,
176
- _ref15$autoFocus = _ref15.autoFocus,
177
- autoFocus = _ref15$autoFocus === void 0 ? false : _ref15$autoFocus,
178
- native = _ref15.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;
179
187
  var inputRef = React.useRef(null);
180
188
  var focusableRef = React.useRef(null);
181
189
  var fieldRef = React.useRef(null);
@@ -378,8 +386,8 @@ var Select = function Select(_ref15) {
378
386
  var _options$value, _options;
379
387
 
380
388
  cancelEvent(e);
381
- var newTentativeValueState = (_options$value = (_options = options[options.findIndex(function (_ref16) {
382
- var value = _ref16.value;
389
+ var newTentativeValueState = (_options$value = (_options = options[options.findIndex(function (_ref17) {
390
+ var value = _ref17.value;
383
391
  return value === tentativeValueState;
384
392
  }) + operand]) === null || _options === void 0 ? void 0 : _options.value) !== null && _options$value !== void 0 ? _options$value : tentativeValueState;
385
393
  setTentativeValueState(newTentativeValueState);
@@ -400,8 +408,8 @@ var Select = function Select(_ref15) {
400
408
  if (e.keyCode === ENTER || e.keyCode === SPACE) {
401
409
  cancelEvent(e);
402
410
 
403
- if (options.findIndex(function (_ref17) {
404
- var value = _ref17.value;
411
+ if (options.findIndex(function (_ref18) {
412
+ var value = _ref18.value;
405
413
  return value === tentativeValueState;
406
414
  }) !== -1 && tentativeValueState !== valueState) {
407
415
  setValue(tentativeValueState);
@@ -439,8 +447,8 @@ var Select = function Select(_ref15) {
439
447
  var getOptionText = function getOptionText(val) {
440
448
  var _options$find;
441
449
 
442
- return val ? (_options$find = options.find(function (_ref18) {
443
- var value = _ref18.value;
450
+ return val ? (_options$find = options.find(function (_ref19) {
451
+ var value = _ref19.value;
444
452
  return value === val;
445
453
  })) === null || _options$find === void 0 ? void 0 : _options$find.text : '';
446
454
  };
@@ -465,6 +473,7 @@ var Select = function Select(_ref15) {
465
473
  }
466
474
  };
467
475
  return shouldUseNative ? /*#__PURE__*/React.createElement(FieldContainer, {
476
+ disabled: disabled,
468
477
  helperText: /*#__PURE__*/React.createElement(HelperText, {
469
478
  error: error,
470
479
  leftText: helperText
@@ -474,7 +483,7 @@ var Select = function Select(_ref15) {
474
483
  }, label && /*#__PURE__*/React.createElement(Label, {
475
484
  error: error,
476
485
  forId: inputId,
477
- inputState: isFocused ? 'focused' : ((_ref19 = value !== null && value !== void 0 ? value : valueState) !== null && _ref19 !== void 0 ? _ref19 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value) ? 'filled' : 'default',
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',
478
487
  disabled: disabled,
479
488
  optional: optional
480
489
  }, label), /*#__PURE__*/React.createElement("select", {
@@ -507,8 +516,8 @@ var Select = function Select(_ref15) {
507
516
  // Without this fix, the label is invisible when disabled
508
517
  opacity: 1
509
518
  }
510
- }, options.every(function (_ref20) {
511
- var value = _ref20.value;
519
+ }, options.every(function (_ref21) {
520
+ var value = _ref21.value;
512
521
  return !!value;
513
522
  }) &&
514
523
  /*#__PURE__*/
@@ -519,9 +528,9 @@ var Select = function Select(_ref15) {
519
528
  style: {
520
529
  display: 'none'
521
530
  }
522
- }), options.map(function (_ref21) {
523
- var val = _ref21.value,
524
- text = _ref21.text;
531
+ }), options.map(function (_ref22) {
532
+ var val = _ref22.value,
533
+ text = _ref22.text;
525
534
  return /*#__PURE__*/React.createElement("option", {
526
535
  key: val,
527
536
  value: val
@@ -565,9 +574,9 @@ var Select = function Select(_ref15) {
565
574
  className: classes.optionsContainer,
566
575
  role: "listbox",
567
576
  ref: optionsMenuRef
568
- }, options.map(function (_ref22) {
569
- var val = _ref22.value,
570
- text = _ref22.text;
577
+ }, options.map(function (_ref23) {
578
+ var val = _ref23.value,
579
+ text = _ref23.text;
571
580
  return /*#__PURE__*/React.createElement("li", {
572
581
  role: "option",
573
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.grey3,
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.grey3,
136
+ textDisabled: palette.grey4,
137
137
  textAmount: palette.o2SkyBlue,
138
138
  // STATES
139
139
  error: palette.pepper,
@@ -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.grey3,
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.grey3,
130
+ textDisabled: palette.grey4,
131
131
  textAmount: palette.telefonicaBlue,
132
132
  // STATES
133
133
  error: palette.coral,
@@ -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.grey3,
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: _defineProperty({
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
- }, mq.desktopOrBigger, {
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.border
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(_ref8) {
194
- var hasLabel = _ref8.hasLabel;
202
+ paddingTop: function paddingTop(_ref10) {
203
+ var hasLabel = _ref10.hasLabel;
195
204
  return hasLabel ? 25 : 16;
196
205
  },
197
- paddingBottom: function paddingBottom(_ref9) {
198
- var hasLabel = _ref9.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: theme.colors.textSecondary,
206
- opacity: function opacity(_ref10) {
207
- var inputState = _ref10.inputState;
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 (_ref11, ref) {
231
+ var TextFieldBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
220
232
  var _defaultValue$length;
221
233
 
222
- var error = _ref11.error,
223
- helperText = _ref11.helperText,
224
- label = _ref11.label,
225
- inputProps = _ref11.inputProps,
226
- inputRef = _ref11.inputRef,
227
- defaultValue = _ref11.defaultValue,
228
- value = _ref11.value,
229
- _onFocus = _ref11.onFocus,
230
- _onBlur = _ref11.onBlur,
231
- inputComponent = _ref11.inputComponent,
232
- prefix = _ref11.prefix,
233
- startIcon = _ref11.startIcon,
234
- endIcon = _ref11.endIcon,
235
- endIconOverlay = _ref11.endIconOverlay,
236
- shrinkLabelProp = _ref11.shrinkLabel,
237
- _ref11$multiline = _ref11.multiline,
238
- multiline = _ref11$multiline === void 0 ? false : _ref11$multiline,
239
- focus = _ref11.focus,
240
- fieldRef = _ref11.fieldRef,
241
- maxLength = _ref11.maxLength,
242
- idProp = _ref11.id,
243
- autoCompleteProp = _ref11.autoComplete,
244
- fullWidth = _ref11.fullWidth,
245
- rest = _objectWithoutProperties(_ref11, _excluded);
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) {
@@ -311,7 +324,27 @@ var TextFieldBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref11, ref
311
324
  autoComplete: fixAutoComplete(platformOverrides, autoCompleteProp)
312
325
  }, inputProps);
313
326
 
327
+ var labelStyle = {};
328
+ var isShrinked = shrinkLabel || inputState === 'focused' || inputState === 'filled';
329
+
330
+ if (startIcon) {
331
+ labelStyle = isShrinked ? {
332
+ left: 48,
333
+ right: 0,
334
+ width: 'auto'
335
+ } : {
336
+ left: 48,
337
+ right: 12,
338
+ width: 'auto'
339
+ };
340
+ } else if (endIcon && !isShrinked) {
341
+ labelStyle = {
342
+ paddingRight: 36
343
+ };
344
+ }
345
+
314
346
  return /*#__PURE__*/React.createElement(FieldContainer, {
347
+ disabled: rest.disabled,
315
348
  helperText: /*#__PURE__*/React.createElement(HelperText, {
316
349
  error: error,
317
350
  leftText: helperText,
@@ -357,10 +390,7 @@ var TextFieldBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref11, ref
357
390
  }, error && {
358
391
  'aria-invalid': true
359
392
  })), label && /*#__PURE__*/React.createElement(Label, {
360
- style: startIcon ? {
361
- marginLeft: 48,
362
- left: 0
363
- } : {},
393
+ style: labelStyle,
364
394
  error: error,
365
395
  forId: id,
366
396
  inputState: inputState,
@@ -407,10 +437,10 @@ var Autosuggest = /*#__PURE__*/React.lazy(function () {
407
437
  /* webpackChunkName: "react-autosuggest" */
408
438
  'react-autosuggest');
409
439
  });
410
- var TextFieldBase = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
411
- var getSuggestions = _ref12.getSuggestions,
412
- idProp = _ref12.id,
413
- props = _objectWithoutProperties(_ref12, _excluded2);
440
+ var TextFieldBase = /*#__PURE__*/React.forwardRef(function (_ref15, ref) {
441
+ var getSuggestions = _ref15.getSuggestions,
442
+ idProp = _ref15.id,
443
+ props = _objectWithoutProperties(_ref15, _excluded2);
414
444
 
415
445
  var _React$useState5 = React.useState([]),
416
446
  _React$useState6 = _slicedToArray(_React$useState5, 2),
@@ -447,10 +477,10 @@ var TextFieldBase = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
447
477
  id: id,
448
478
  autoComplete: fixAutoComplete(platformOverrides, 'off'),
449
479
  // @ts-expect-error Autosuggest expects slightly different types
450
- onChange: function onChange(e, _ref13) {
480
+ onChange: function onChange(e, _ref16) {
451
481
  var _props$onChange2;
452
482
 
453
- var newValue = _ref13.newValue;
483
+ var newValue = _ref16.newValue;
454
484
  // hack to mutate event value
455
485
  e.target = _objectSpread(_objectSpread({}, e.target), {}, {
456
486
  value: newValue
@@ -467,8 +497,8 @@ var TextFieldBase = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
467
497
  }));
468
498
  },
469
499
  suggestions: suggestions,
470
- onSuggestionsFetchRequested: function onSuggestionsFetchRequested(_ref14) {
471
- var value = _ref14.value;
500
+ onSuggestionsFetchRequested: function onSuggestionsFetchRequested(_ref17) {
501
+ var value = _ref17.value;
472
502
  return setSuggestions(getSuggestions(value));
473
503
  },
474
504
  onSuggestionsClearRequested: function onSuggestionsClearRequested() {
@@ -477,8 +507,8 @@ var TextFieldBase = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
477
507
  getSuggestionValue: function getSuggestionValue(suggestion) {
478
508
  return suggestion;
479
509
  },
480
- renderSuggestion: function renderSuggestion(suggestion, _ref15) {
481
- var isHighlighted = _ref15.isHighlighted;
510
+ renderSuggestion: function renderSuggestion(suggestion, _ref18) {
511
+ var isHighlighted = _ref18.isHighlighted;
482
512
  return /*#__PURE__*/React.createElement("div", {
483
513
  role: "menuitem",
484
514
  className: classNames(classes.menuItem, _defineProperty({}, classes.menuItemSelected, isHighlighted))