@telefonica/mistica 10.5.1 → 10.9.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/button-group.d.ts +9 -0
  3. package/dist/button-group.js +67 -0
  4. package/dist/button-group.js.flow +11 -0
  5. package/dist/button.d.ts +1 -1
  6. package/dist/button.js +1 -1
  7. package/dist/button.js.flow +1 -1
  8. package/dist/callout.d.ts +2 -1
  9. package/dist/callout.js +15 -21
  10. package/dist/callout.js.flow +2 -3
  11. package/dist/card.d.ts +1 -1
  12. package/dist/card.js +41 -48
  13. package/dist/date-field.js +8 -0
  14. package/dist/date-time-field.js +8 -0
  15. package/dist/date-time-picker.d.ts +1 -0
  16. package/dist/date-time-picker.js +55 -20
  17. package/dist/date-time-picker.js.flow +1 -0
  18. package/dist/decimal-field.d.ts +1 -0
  19. package/dist/decimal-field.js.flow +1 -0
  20. package/dist/empty-state-card.d.ts +4 -3
  21. package/dist/empty-state-card.js +18 -24
  22. package/dist/empty-state-card.js.flow +2 -3
  23. package/dist/empty-state.d.ts +2 -2
  24. package/dist/empty-state.js +51 -9
  25. package/dist/feedback.d.ts +2 -7
  26. package/dist/feedback.js +38 -60
  27. package/dist/feedback.js.flow +2 -6
  28. package/dist/header.js +37 -67
  29. package/dist/index.d.ts +4 -1
  30. package/dist/index.js +28 -0
  31. package/dist/index.js.flow +4 -0
  32. package/dist/month-field.d.ts +9 -0
  33. package/dist/month-field.js +192 -0
  34. package/dist/month-field.js.flow +13 -0
  35. package/dist/navigation-bar.js +102 -72
  36. package/dist/progress-bar.d.ts +1 -0
  37. package/dist/progress-bar.js +11 -6
  38. package/dist/progress-bar.js.flow +4 -1
  39. package/dist/skins/blau.d.ts +37 -0
  40. package/dist/skins/blau.js +238 -0
  41. package/dist/skins/blau.js.flow +39 -0
  42. package/dist/skins/constants.d.ts +1 -0
  43. package/dist/skins/constants.js +4 -2
  44. package/dist/skins/constants.js.flow +1 -0
  45. package/dist/skins/telefonica.js +1 -1
  46. package/dist/skins/types.d.ts +1 -1
  47. package/dist/skins/types.js.flow +7 -1
  48. package/dist/skins/utils.js +5 -0
  49. package/dist/stepper.js +1 -1
  50. package/dist/text-field-base.js +8 -1
  51. package/dist/theme.d.ts +1 -0
  52. package/dist/theme.js +8 -4
  53. package/dist/theme.js.flow +1 -0
  54. package/dist/utils/time.d.ts +1 -0
  55. package/dist/utils/time.js +9 -1
  56. package/dist/utils/time.js.flow +1 -0
  57. package/dist-es/button-group.js +54 -0
  58. package/dist-es/button.js +1 -1
  59. package/dist-es/callout.js +15 -21
  60. package/dist-es/card.js +40 -47
  61. package/dist-es/date-field.js +7 -0
  62. package/dist-es/date-time-field.js +7 -0
  63. package/dist-es/date-time-picker.js +56 -22
  64. package/dist-es/empty-state-card.js +17 -23
  65. package/dist-es/empty-state.js +16 -9
  66. package/dist-es/feedback.js +37 -60
  67. package/dist-es/header.js +37 -67
  68. package/dist-es/index.js +4 -1
  69. package/dist-es/month-field.js +120 -0
  70. package/dist-es/navigation-bar.js +102 -72
  71. package/dist-es/progress-bar.js +11 -6
  72. package/dist-es/skins/blau.js +225 -0
  73. package/dist-es/skins/constants.js +2 -1
  74. package/dist-es/skins/telefonica.js +1 -1
  75. package/dist-es/skins/utils.js +5 -1
  76. package/dist-es/stepper.js +1 -1
  77. package/dist-es/text-field-base.js +8 -1
  78. package/dist-es/theme.js +8 -4
  79. package/dist-es/utils/time.js +5 -0
  80. package/package.json +1 -1
@@ -0,0 +1,225 @@
1
+ import { applyAlpha } from '../utils/color';
2
+ import { BLAU_SKIN } from './constants';
3
+ export var palette = {
4
+ blauBluePrimary: '#00B6F1',
5
+ blauBluePrimary10: '#F7FDFF',
6
+ blauBluePrimary20: '#E5F6FD',
7
+ blauBluePrimary30: '#B3E9FB',
8
+ blauBlueSecondary: '#0072BC',
9
+ blauBlueSecondary10: '#E5F1F9',
10
+ blauBlueSecondary20: '#B2D4EC',
11
+ blauBlueSecondary30: '#80B7DF',
12
+ blauBlueSecondary60: '#005A99',
13
+ blauPurple: '#7814B3',
14
+ blauPurple10: '#F1E7F7',
15
+ blauPurple30: '#BB89D9',
16
+ blauYellow: '#FFA922',
17
+ blauYellow10: '#FFF6E9',
18
+ blauYellow60: '#F09500',
19
+ blauYellow70: '#996614',
20
+ blauRed: '#F64417',
21
+ blauRed10: '#FEECE8',
22
+ blauRed20: '#FCC7B9',
23
+ blauRed30: '#FA9E87',
24
+ blauRed70: '#C93712',
25
+ blauGreen: '#30D300',
26
+ blauGreen10: '#EAFBE5',
27
+ blauGreen70: '#1D7F00',
28
+ grey1: '#F5F9FA',
29
+ grey2: '#E7E7E7',
30
+ grey3: '#B8B8B8',
31
+ grey4: '#A0A0A0',
32
+ grey5: '#808285',
33
+ grey6: '#000000',
34
+ white: '#FFFFFF',
35
+ // specific for dark mode:
36
+ darkModeBlack: '#191919',
37
+ darkModeGrey: '#242424'
38
+ };
39
+ export var getBlauSkin = function getBlauSkin() {
40
+ return {
41
+ name: BLAU_SKIN,
42
+ colors: {
43
+ // BACKGROUNDS
44
+ appBarBackground: palette.white,
45
+ background: palette.white,
46
+ backgroundContainer: palette.white,
47
+ backgroundBrand: palette.blauBluePrimary,
48
+ backgroundOverlay: applyAlpha(palette.blauBlueSecondary, 0.75),
49
+ backgroundSkeleton: palette.grey2,
50
+ backgroundSkeletonInverse: palette.white,
51
+ navigationBarBackground: palette.blauBluePrimary,
52
+ backgroundAlternative: palette.blauBluePrimary20,
53
+ backgroundFeedbackBottom: palette.blauBluePrimary,
54
+ skeletonWave: palette.grey2,
55
+ // BORDERS
56
+ borderLight: palette.grey1,
57
+ border: palette.grey2,
58
+ borderDark: palette.grey5,
59
+ borderSelected: palette.blauBlueSecondary60,
60
+ // BUTTONS
61
+ buttonDangerBackground: palette.blauRed,
62
+ buttonDangerBackgroundDisabled: palette.blauRed20,
63
+ buttonDangerBackgroundSelected: palette.blauRed70,
64
+ buttonDangerBackgroundHover: palette.blauRed70,
65
+ buttonLinkBackgroundSelected: palette.blauPurple10,
66
+ buttonLinkBackgroundSelectedInverse: applyAlpha(palette.white, 0.3),
67
+ buttonPrimaryBackground: palette.blauBlueSecondary,
68
+ buttonPrimaryBackgroundDisabled: palette.blauBlueSecondary20,
69
+ buttonPrimaryBackgroundDisabledInverse: palette.blauBlueSecondary30,
70
+ buttonPrimaryBackgroundInverse: palette.white,
71
+ buttonPrimaryBackgroundSelected: palette.blauBlueSecondary60,
72
+ buttonPrimaryBackgroundHover: palette.blauBlueSecondary60,
73
+ buttonPrimaryBackgroundSelectedInverse: palette.blauBluePrimary30,
74
+ buttonSecondaryBackground: palette.blauBlueSecondary,
75
+ buttonSecondaryBackgroundDisabled: palette.blauBlueSecondary20,
76
+ buttonSecondaryBackgroundSelected: palette.blauBlueSecondary60,
77
+ buttonSecondaryBorderDisabledInverse: palette.blauBlueSecondary20,
78
+ buttonSecondaryBorderInverse: palette.white,
79
+ buttonSecondaryBorderSelectedInverse: palette.blauBluePrimary30,
80
+ textButtonPrimary: palette.white,
81
+ textButtonPrimaryDisabled: palette.white,
82
+ textButtonPrimaryInverse: palette.blauBlueSecondary,
83
+ textButtonPrimaryInverseDisabled: palette.blauBluePrimary10,
84
+ textButtonPrimaryInverseSelected: palette.blauBlueSecondary60,
85
+ textButtonSecondary: palette.blauBlueSecondary,
86
+ textButtonSecondaryDisabled: palette.blauBlueSecondary30,
87
+ textButtonSecondarySelected: palette.blauBlueSecondary60,
88
+ textButtonSecondaryInverse: palette.white,
89
+ textButtonSecondaryInverseDisabled: palette.blauBlueSecondary20,
90
+ textButtonSecondaryInverseSelected: palette.white,
91
+ textLink: palette.blauPurple,
92
+ textLinkInverse: palette.white,
93
+ textLinkDanger: palette.blauRed,
94
+ textLinkDangerDisabled: palette.blauRed20,
95
+ textLinkDisabled: palette.blauPurple30,
96
+ textLinkSnackbar: palette.blauPurple30,
97
+ // CONTROLS
98
+ control: palette.grey2,
99
+ controlActivated: palette.blauBlueSecondary,
100
+ controlError: palette.blauRed,
101
+ loadingBar: palette.blauBlueSecondary,
102
+ loadingBarBackground: palette.blauBlueSecondary10,
103
+ loadingBarInverse: palette.blauBlueSecondary,
104
+ // Deprecated. Remove
105
+ loadingBarBackgroundInverse: palette.blauBlueSecondary10,
106
+ // Deprecated. Remove
107
+ toggleAndroidInactive: palette.grey2,
108
+ toggleAndroidBackgroundActive: palette.blauBlueSecondary10,
109
+ iosControlKnob: palette.white,
110
+ // DIVIDERS
111
+ divider: palette.grey2,
112
+ dividerInverse: applyAlpha(palette.white, 0.2),
113
+ navigationBarDivider: palette.blauBluePrimary,
114
+ // FEEDBACKS
115
+ badge: palette.blauRed,
116
+ feedbackErrorBackground: palette.blauRed,
117
+ feedbackInfoBackground: palette.grey6,
118
+ // GLOBAL
119
+ brand: palette.blauBluePrimary,
120
+ brandDark: palette.blauBlueSecondary,
121
+ inverse: palette.white,
122
+ neutralHigh: palette.grey6,
123
+ neutralMedium: palette.grey5,
124
+ neutralLow: palette.grey2,
125
+ textPrimary: palette.grey6,
126
+ textPrimaryInverse: palette.white,
127
+ textSecondary: palette.grey5,
128
+ textSecondaryInverse: palette.white,
129
+ textDisabled: palette.grey3,
130
+ textAmount: palette.blauBlueSecondary,
131
+ // STATES
132
+ error: palette.blauRed,
133
+ success: palette.blauGreen,
134
+ warning: palette.blauYellow,
135
+ promo: palette.blauPurple,
136
+ highlight: palette.blauBluePrimary,
137
+ // BARS TEXTS
138
+ textNavigationBarPrimary: palette.white,
139
+ textNavigationBarSecondary: palette.blauBlueSecondary20,
140
+ textNavigationSearchBarHint: palette.blauBlueSecondary20,
141
+ textNavigationSearchBarText: palette.white,
142
+ textAppBar: palette.grey5,
143
+ textAppBarSelected: palette.blauBlueSecondary60
144
+ },
145
+ darkModeColors: {
146
+ // BACKGROUNDS
147
+ backgroundBrand: palette.darkModeBlack,
148
+ background: palette.darkModeBlack,
149
+ appBarBackground: palette.darkModeGrey,
150
+ backgroundContainer: palette.darkModeGrey,
151
+ backgroundAlternative: palette.darkModeGrey,
152
+ backgroundOverlay: applyAlpha(palette.darkModeGrey, 0.8),
153
+ backgroundSkeleton: palette.darkModeGrey,
154
+ backgroundSkeletonInverse: palette.darkModeGrey,
155
+ backgroundFeedbackBottom: palette.darkModeBlack,
156
+ navigationBarBackground: palette.darkModeBlack,
157
+ skeletonWave: palette.grey5,
158
+ // BORDERS
159
+ borderLight: palette.darkModeBlack,
160
+ border: palette.darkModeGrey,
161
+ // BUTTONS
162
+ buttonDangerBackgroundDisabled: palette.darkModeGrey,
163
+ buttonLinkBackgroundSelected: applyAlpha(palette.blauPurple, 0.3),
164
+ buttonLinkBackgroundSelectedInverse: applyAlpha(palette.blauPurple, 0.3),
165
+ buttonPrimaryBackgroundDisabled: palette.darkModeGrey,
166
+ buttonPrimaryBackgroundDisabledInverse: palette.darkModeGrey,
167
+ buttonPrimaryBackgroundInverse: palette.blauBlueSecondary,
168
+ buttonPrimaryBackgroundSelected: palette.blauBlueSecondary60,
169
+ buttonSecondaryBackgroundDisabled: palette.darkModeGrey,
170
+ buttonSecondaryBorderDisabledInverse: palette.darkModeGrey,
171
+ buttonSecondaryBorderInverse: palette.blauBluePrimary,
172
+ buttonSecondaryBorderSelectedInverse: palette.blauBlueSecondary60,
173
+ textButtonPrimary: palette.grey2,
174
+ textButtonPrimaryDisabled: palette.grey5,
175
+ textButtonPrimaryInverse: palette.grey2,
176
+ textButtonPrimaryInverseDisabled: palette.grey5,
177
+ textButtonPrimaryInverseSelected: palette.grey2,
178
+ textButtonSecondary: palette.grey2,
179
+ textButtonSecondaryDisabled: palette.grey5,
180
+ textButtonSecondarySelected: palette.blauBlueSecondary60,
181
+ textButtonSecondaryInverse: palette.grey2,
182
+ textButtonSecondaryInverseDisabled: palette.grey5,
183
+ textButtonSecondaryInverseSelected: palette.blauBlueSecondary60,
184
+ textLink: palette.blauPurple30,
185
+ textLinkInverse: palette.blauPurple30,
186
+ textLinkDisabled: palette.grey5,
187
+ textLinkDangerDisabled: palette.grey5,
188
+ // CONTROLS
189
+ control: palette.darkModeGrey,
190
+ loadingBar: palette.blauBluePrimary,
191
+ loadingBarBackground: palette.darkModeGrey,
192
+ toggleAndroidInactive: palette.grey5,
193
+ // web only
194
+ toggleAndroidBackgroundActive: palette.blauBlueSecondary30,
195
+ // web only
196
+ iosControlKnob: palette.grey2,
197
+ // web only
198
+ // DIVIDERS
199
+ divider: applyAlpha(palette.white, 0.05),
200
+ dividerInverse: applyAlpha(palette.white, 0.05),
201
+ navigationBarDivider: palette.darkModeBlack,
202
+ // GLOBAL
203
+ brand: palette.blauBluePrimary,
204
+ brandDark: palette.grey5,
205
+ inverse: palette.grey2,
206
+ neutralHigh: palette.grey2,
207
+ neutralMedium: palette.grey5,
208
+ neutralLow: palette.darkModeGrey,
209
+ textPrimary: palette.grey2,
210
+ textPrimaryInverse: palette.grey2,
211
+ textSecondary: palette.grey4,
212
+ textSecondaryInverse: palette.grey4,
213
+ textDisabled: palette.grey5,
214
+ textAmount: palette.blauBlueSecondary,
215
+ textNavigationBarPrimary: palette.grey2,
216
+ textNavigationBarSecondary: palette.grey4,
217
+ textNavigationSearchBarHint: palette.grey4,
218
+ // iOS
219
+ textNavigationSearchBarText: palette.grey2,
220
+ // iOS
221
+ textAppBar: palette.grey5,
222
+ textAppBarSelected: palette.grey2
223
+ }
224
+ };
225
+ };
@@ -2,4 +2,5 @@ export var MOVISTAR_SKIN = 'Movistar';
2
2
  export var O2_SKIN = 'O2';
3
3
  export var O2_CLASSIC_SKIN = 'O2-classic';
4
4
  export var VIVO_SKIN = 'Vivo';
5
- export var TELEFONICA_SKIN = 'Telefonica';
5
+ export var TELEFONICA_SKIN = 'Telefonica';
6
+ export var BLAU_SKIN = 'Blau';
@@ -188,7 +188,7 @@ export var getTelefonicaSkin = function getTelefonicaSkin() {
188
188
  textLink: palette.telefonicaBlue,
189
189
  textLinkInverse: palette.telefonicaBlue,
190
190
  textLinkDisabled: palette.grey6,
191
- control: palette.grey6,
191
+ control: palette.darkModeGrey,
192
192
  controlActivated: palette.telefonicaBlue,
193
193
  loadingBar: palette.telefonicaBlue,
194
194
  loadingBarBackground: applyAlpha(palette.white, 0.05),
@@ -1,4 +1,5 @@
1
- import { TELEFONICA_SKIN, VIVO_SKIN, O2_SKIN, O2_CLASSIC_SKIN, MOVISTAR_SKIN } from './constants';
1
+ import { BLAU_SKIN, TELEFONICA_SKIN, VIVO_SKIN, O2_SKIN, O2_CLASSIC_SKIN, MOVISTAR_SKIN } from './constants';
2
+ import { getBlauSkin } from './blau';
2
3
  import { getTelefonicaSkin } from './telefonica';
3
4
  import { getVivoSkin } from './vivo';
4
5
  import { getO2Skin } from './o2';
@@ -6,6 +7,9 @@ import { getO2ClassicSkin } from './o2-classic';
6
7
  import { getMovistarSkin } from './movistar';
7
8
  export var getSkinByName = function getSkinByName(name, variant) {
8
9
  switch (name) {
10
+ case BLAU_SKIN:
11
+ return getBlauSkin(variant);
12
+
9
13
  case TELEFONICA_SKIN:
10
14
  return getTelefonicaSkin(variant);
11
15
 
@@ -100,7 +100,7 @@ var useStyles = createUseStyles(function (_ref) {
100
100
  height: 4,
101
101
  width: '100%',
102
102
  margin: '0 8px',
103
- background: colors.border,
103
+ background: colors.control,
104
104
  borderRadius: 4,
105
105
  overflow: 'hidden',
106
106
  '&:last-child': {
@@ -150,6 +150,10 @@ var useStyles = createUseStyles(function (theme) {
150
150
  // Chrome: hide value if not valid or focused
151
151
  // `opacity: 0` is needed when min/max is set and some parts of the date are disabled
152
152
  // be sure to check that case when updating these styles
153
+ '&[type="month"]:not(:valid):not(:focus)::-webkit-datetime-edit': {
154
+ color: 'transparent',
155
+ opacity: 0
156
+ },
153
157
  '&[type="date"]:not(:valid):not(:focus)::-webkit-datetime-edit': {
154
158
  color: 'transparent',
155
159
  opacity: 0
@@ -160,6 +164,9 @@ var useStyles = createUseStyles(function (theme) {
160
164
  },
161
165
  // Firefox: hide value if not valid or focused
162
166
  // Only apply when Firefox, otherwise it breaks styles in safari mobile
167
+ '&[type="month"]:not(:valid):not(:focus)': isFirefox() ? {
168
+ color: 'transparent'
169
+ } : {},
163
170
  '&[type="date"]:not(:valid):not(:focus)': isFirefox() ? {
164
171
  color: 'transparent'
165
172
  } : {},
@@ -274,7 +281,7 @@ var TextFieldBaseComponent = /*#__PURE__*/React.forwardRef(function (_ref14, ref
274
281
  var hasLabel = !!label || !rest.required; // this shrinkLabel override is a workaround because I was unable to find a way to hide date
275
282
  // and date-time native placeholders when the input is not required
276
283
 
277
- var shrinkLabel = shrinkLabelProp || (rest.type === 'date' || rest.type === 'datetime-local') && !rest.required;
284
+ var shrinkLabel = shrinkLabelProp || (rest.type === 'date' || rest.type === 'datetime-local' || rest.type === 'month') && !rest.required;
278
285
  var classes = useStyles({
279
286
  inputState: inputState,
280
287
  error: error,
package/dist-es/theme.js CHANGED
@@ -34,7 +34,8 @@ var TEXTS_ES = {
34
34
  menuLabelSuffix: 'menú',
35
35
  openNavigationMenu: 'Abrir menú de navegación',
36
36
  closeNavigationMenu: 'Cerrar menú de navegación',
37
- backNavigationBar: 'Atrás'
37
+ backNavigationBar: 'Atrás',
38
+ clearButton: 'Borrar'
38
39
  };
39
40
  var TEXTS_EN = {
40
41
  expirationDatePlaceholder: 'MM/YY',
@@ -63,7 +64,8 @@ var TEXTS_EN = {
63
64
  menuLabelSuffix: 'menu',
64
65
  openNavigationMenu: 'Open navigation menu',
65
66
  closeNavigationMenu: 'Close navigation menu',
66
- backNavigationBar: 'Back'
67
+ backNavigationBar: 'Back',
68
+ clearButton: 'Clear'
67
69
  };
68
70
  var TEXTS_DE = {
69
71
  expirationDatePlaceholder: 'MM/JJ',
@@ -92,7 +94,8 @@ var TEXTS_DE = {
92
94
  menuLabelSuffix: 'Menü',
93
95
  openNavigationMenu: 'Navigationsmenü öffnen',
94
96
  closeNavigationMenu: 'Navigationsmenü schließen',
95
- backNavigationBar: 'Zurück'
97
+ backNavigationBar: 'Zurück',
98
+ clearButton: 'Löschen'
96
99
  };
97
100
  var TEXTS_PT = {
98
101
  expirationDatePlaceholder: 'MM/AA',
@@ -121,7 +124,8 @@ var TEXTS_PT = {
121
124
  menuLabelSuffix: 'menu',
122
125
  openNavigationMenu: 'Abrir menu de navegação',
123
126
  closeNavigationMenu: 'Fechar menu de navegação',
124
- backNavigationBar: 'Voltar'
127
+ backNavigationBar: 'Voltar',
128
+ clearButton: 'Apagar'
125
129
  };
126
130
  export var getTexts = function getTexts(locale) {
127
131
  var lang = locale.toLocaleLowerCase().split(/[-_]/)[0];
@@ -4,6 +4,11 @@ export var getLocalDateString = function getLocalDateString(date) {
4
4
  var dd = String(date.getDate()).padStart(2, '0');
5
5
  return "".concat(yyyy, "-").concat(mm, "-").concat(dd);
6
6
  };
7
+ export var getLocalYearMonthString = function getLocalYearMonthString(date) {
8
+ var yyyy = date.getFullYear();
9
+ var mm = String(date.getMonth() + 1).padStart(2, '0');
10
+ return "".concat(yyyy, "-").concat(mm);
11
+ };
7
12
  export var getLocalDateTimeString = function getLocalDateTimeString(date) {
8
13
  var h = String(date.getHours()).padStart(2, '0');
9
14
  var m = String(date.getMinutes()).padStart(2, '0');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telefonica/mistica",
3
- "version": "10.5.1",
3
+ "version": "10.9.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",