@telefonica/mistica 10.20.0 → 10.22.2
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 +34 -0
- package/dist/button-layout.js +30 -17
- package/dist/chip.d.ts +9 -0
- package/dist/chip.js +111 -0
- package/dist/chip.js.flow +11 -0
- package/dist/form.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.flow +1 -0
- package/dist/package-version.js +1 -1
- package/dist/select.js +15 -0
- package/dist/theme-context-provider.js +8 -2
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js.flow +2 -0
- package/dist/touchable.js +3 -2
- package/dist-es/button-layout.js +30 -17
- package/dist-es/chip.js +100 -0
- package/dist-es/form.js +1 -1
- package/dist-es/index.js +1 -0
- package/dist-es/package-version.js +1 -1
- package/dist-es/select.js +15 -0
- package/dist-es/theme-context-provider.js +8 -2
- package/dist-es/touchable.js +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
## [10.22.2](https://github.com/Telefonica/mistica-web/compare/v10.22.1...v10.22.2) (2022-02-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **Select:** set rawValue on init ([#409](https://github.com/Telefonica/mistica-web/issues/409)) ([d72cbd1](https://github.com/Telefonica/mistica-web/commit/d72cbd179e930712ef54c5e483e08c922a857059))
|
|
7
|
+
|
|
8
|
+
## [10.22.1](https://github.com/Telefonica/mistica-web/compare/v10.22.0...v10.22.1) (2022-02-03)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **Form fields:** use rawValue to check if a form field is empty ([#408](https://github.com/Telefonica/mistica-web/issues/408)) ([50a5d37](https://github.com/Telefonica/mistica-web/commit/50a5d37179903ed69f1aa33ac6b7e5d6b1f10a6f))
|
|
14
|
+
|
|
15
|
+
# [10.22.0](https://github.com/Telefonica/mistica-web/compare/v10.21.0...v10.22.0) (2022-02-02)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **Chip:** new component ([#395](https://github.com/Telefonica/mistica-web/issues/395)) ([37f1be2](https://github.com/Telefonica/mistica-web/commit/37f1be2322ad3913b3084fb6a14539629a9a81b4))
|
|
21
|
+
|
|
22
|
+
# [10.21.0](https://github.com/Telefonica/mistica-web/compare/v10.20.0...v10.21.0) (2022-01-27)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **ButtonLayout:** missed button press in button layout when gaining focus ([#396](https://github.com/Telefonica/mistica-web/issues/396)) ([9f3bba5](https://github.com/Telefonica/mistica-web/commit/9f3bba57affeac7b89c7dc831d00ce4ef33cdb5f))
|
|
28
|
+
* **ButtonLayout:** unstable in acceptance tests ([#404](https://github.com/Telefonica/mistica-web/issues/404)) ([11d4772](https://github.com/Telefonica/mistica-web/commit/11d4772c49d5f35bfcfa4ead6826782eccde5a18))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
* **Touchable:** WEB-435 add hrefDecorator to theme ([#401](https://github.com/Telefonica/mistica-web/issues/401)) ([21a45ee](https://github.com/Telefonica/mistica-web/commit/21a45ee84259af4ccca2a5adf2a7242b442d2874))
|
|
34
|
+
|
|
1
35
|
# [10.20.0](https://github.com/Telefonica/mistica-web/compare/v10.19.0...v10.20.0) (2022-01-24)
|
|
2
36
|
|
|
3
37
|
|
package/dist/button-layout.js
CHANGED
|
@@ -9,6 +9,7 @@ var _jss = require("./jss");
|
|
|
9
9
|
var _hooks = require("./hooks");
|
|
10
10
|
var _button = require("./button");
|
|
11
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
12
13
|
function _interopRequireDefault(obj) {
|
|
13
14
|
return obj && obj.__esModule ? obj : {
|
|
14
15
|
default: obj
|
|
@@ -207,28 +208,29 @@ var buttonsRange = [
|
|
|
207
208
|
var ButtonLayout = function ButtonLayout(param) {
|
|
208
209
|
var children = param.children, _align = param.align, align = _align === void 0 ? 'full-width' : _align, link = param.link, _withMargins = param.withMargins, withMargins = _withMargins === void 0 ? false : _withMargins;
|
|
209
210
|
var ref = (0, _hooks).useScreenSize(), isTabletOrSmaller = ref.isTabletOrSmaller;
|
|
210
|
-
var ref1 = _slicedToArray(React.useState(true), 2), isMeasuring = ref1[0], setIsMeasuring = ref1[1];
|
|
211
211
|
var childrenCount = React.Children.count(children);
|
|
212
|
-
var
|
|
213
|
-
|
|
212
|
+
var ref1 = _slicedToArray(React.useState({
|
|
213
|
+
isMeasuring: true,
|
|
214
|
+
buttonWidth: 0
|
|
215
|
+
}), 2), buttonStatus = ref1[0], setButtonStatus = ref1[1];
|
|
216
|
+
var updateButtonStatus = function updateButtonStatus(param) {
|
|
217
|
+
var isMeasuring = param.isMeasuring, buttonWidth = param.buttonWidth;
|
|
214
218
|
if (process.env.NODE_ENV !== 'test') {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if (process.env.NODE_ENV !== 'test') {
|
|
220
|
-
setIsMeasuring(isMeasuring);
|
|
219
|
+
setButtonStatus({
|
|
220
|
+
isMeasuring: isMeasuring,
|
|
221
|
+
buttonWidth: buttonWidth
|
|
222
|
+
});
|
|
221
223
|
}
|
|
222
224
|
};
|
|
223
225
|
var classes = useStyles({
|
|
224
|
-
buttonWidth: buttonWidth,
|
|
226
|
+
buttonWidth: buttonStatus.buttonWidth,
|
|
225
227
|
isTabletOrSmaller: isTabletOrSmaller,
|
|
226
228
|
align: align,
|
|
227
229
|
childrenCount: childrenCount
|
|
228
230
|
});
|
|
229
231
|
var wrapperElRef = React.useRef(null);
|
|
230
232
|
(0, _hooks).useIsomorphicLayoutEffect(function() {
|
|
231
|
-
if (isMeasuring) {
|
|
233
|
+
if (buttonStatus.isMeasuring) {
|
|
232
234
|
var req = window.requestAnimationFrame(function() {
|
|
233
235
|
if (wrapperElRef.current) {
|
|
234
236
|
var childrenWidths = Array.from(wrapperElRef.current.children).map(function(el) {
|
|
@@ -243,8 +245,10 @@ var ButtonLayout = function ButtonLayout(param) {
|
|
|
243
245
|
var maxChildWidth = Math.ceil((_Math = Math).max.apply(_Math, _toConsumableArray(childrenWidths).concat([
|
|
244
246
|
_button.BUTTON_MIN_WIDTH
|
|
245
247
|
])));
|
|
246
|
-
|
|
247
|
-
|
|
248
|
+
updateButtonStatus({
|
|
249
|
+
isMeasuring: false,
|
|
250
|
+
buttonWidth: maxChildWidth
|
|
251
|
+
});
|
|
248
252
|
}
|
|
249
253
|
});
|
|
250
254
|
return function() {
|
|
@@ -255,11 +259,20 @@ var ButtonLayout = function ButtonLayout(param) {
|
|
|
255
259
|
};
|
|
256
260
|
}, [
|
|
257
261
|
classes.link,
|
|
258
|
-
|
|
262
|
+
buttonStatus
|
|
259
263
|
]);
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
264
|
+
/**
|
|
265
|
+
* Multiple calls to calcLayout are debounced to workaround an issue that can be reproduced in chrome when pressing
|
|
266
|
+
* the button during a focus/visibility change. For example, pressing the button having the focus on the devTools.
|
|
267
|
+
*/ var calcLayout = React.useMemo(function() {
|
|
268
|
+
return (0, _debounce).default(function() {
|
|
269
|
+
updateButtonStatus({
|
|
270
|
+
isMeasuring: true,
|
|
271
|
+
buttonWidth: 0
|
|
272
|
+
});
|
|
273
|
+
}, 5, {
|
|
274
|
+
maxWait: 50
|
|
275
|
+
});
|
|
263
276
|
}, []);
|
|
264
277
|
useOnChildrenChangeEffect(wrapperElRef.current, calcLayout);
|
|
265
278
|
useOnFontsReadyEffect(calcLayout);
|
package/dist/chip.d.ts
ADDED
package/dist/chip.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.default = void 0;
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
var _jss = require("./jss");
|
|
8
|
+
var _hooks = require("./hooks");
|
|
9
|
+
var _box = _interopRequireDefault(require("./box"));
|
|
10
|
+
var _text = require("./text");
|
|
11
|
+
var _iconButton = _interopRequireDefault(require("./icon-button"));
|
|
12
|
+
var _iconCloseRegular = _interopRequireDefault(require("./generated/mistica-icons/icon-close-regular"));
|
|
13
|
+
var _css = require("./utils/css");
|
|
14
|
+
function _interopRequireDefault(obj) {
|
|
15
|
+
return obj && obj.__esModule ? obj : {
|
|
16
|
+
default: obj
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function _defineProperty(obj, key, value) {
|
|
20
|
+
if (key in obj) {
|
|
21
|
+
Object.defineProperty(obj, key, {
|
|
22
|
+
value: value,
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
obj[key] = value;
|
|
29
|
+
}
|
|
30
|
+
return obj;
|
|
31
|
+
}
|
|
32
|
+
var useStyles = (0, _jss).createUseStyles(function(param) {
|
|
33
|
+
var colors = param.colors, mq = param.mq;
|
|
34
|
+
return {
|
|
35
|
+
container: _defineProperty({
|
|
36
|
+
display: 'inline-flex',
|
|
37
|
+
justifyContent: 'center',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
border: "1px solid ".concat(colors.border),
|
|
40
|
+
borderRadius: 20,
|
|
41
|
+
backgroundColor: colors.backgroundContainer,
|
|
42
|
+
minHeight: 32,
|
|
43
|
+
minWidth: 56,
|
|
44
|
+
cursor: 'default',
|
|
45
|
+
color: colors.neutralMedium,
|
|
46
|
+
'& > span': {
|
|
47
|
+
color: colors.textPrimary
|
|
48
|
+
}
|
|
49
|
+
}, mq.supportsHover, {
|
|
50
|
+
'&:hover': {
|
|
51
|
+
borderColor: function borderColor(param) {
|
|
52
|
+
var isDarkMode = param.isDarkMode;
|
|
53
|
+
return isDarkMode ? colors.background : colors.tagBackgroundActive;
|
|
54
|
+
},
|
|
55
|
+
color: colors.controlActivated,
|
|
56
|
+
backgroundColor: colors.tagBackgroundActive
|
|
57
|
+
},
|
|
58
|
+
'&:hover > span': {
|
|
59
|
+
color: colors.textLink
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
var Chip = function Chip(param) {
|
|
65
|
+
var children = param.children, Icon = param.Icon, onClose = param.onClose;
|
|
66
|
+
var ref = (0, _hooks).useTheme(), texts = ref.texts, isDarkMode = ref.isDarkMode;
|
|
67
|
+
var classes = useStyles({
|
|
68
|
+
isDarkMode: isDarkMode
|
|
69
|
+
});
|
|
70
|
+
return(/*#__PURE__*/ (0, _jsxRuntime).jsxs(_box.default, {
|
|
71
|
+
className: classes.container,
|
|
72
|
+
paddingLeft: Icon ? 8 : 12,
|
|
73
|
+
paddingRight: onClose ? 0 : 12,
|
|
74
|
+
children: [
|
|
75
|
+
Icon && /*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
|
|
76
|
+
paddingRight: 4,
|
|
77
|
+
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(Icon, {
|
|
78
|
+
color: "currentColor",
|
|
79
|
+
size: (0, _css).pxToRem(16)
|
|
80
|
+
})
|
|
81
|
+
}),
|
|
82
|
+
/*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text2, {
|
|
83
|
+
medium: true,
|
|
84
|
+
truncate: 1,
|
|
85
|
+
color: "currentColor",
|
|
86
|
+
children: children
|
|
87
|
+
}),
|
|
88
|
+
onClose ? /*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
|
|
89
|
+
paddingLeft: 4,
|
|
90
|
+
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconButton.default, {
|
|
91
|
+
size: 24,
|
|
92
|
+
style: {
|
|
93
|
+
display: 'flex',
|
|
94
|
+
justifyContent: 'center',
|
|
95
|
+
alignItems: 'center'
|
|
96
|
+
},
|
|
97
|
+
"aria-label": texts.closeButtonLabel,
|
|
98
|
+
onPress: function onPress() {
|
|
99
|
+
return onClose();
|
|
100
|
+
},
|
|
101
|
+
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconCloseRegular.default, {
|
|
102
|
+
size: 16,
|
|
103
|
+
color: "currentColor"
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
}) : null
|
|
107
|
+
]
|
|
108
|
+
}));
|
|
109
|
+
};
|
|
110
|
+
var _default = Chip;
|
|
111
|
+
exports.default = _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import type { IconProps } from "./utils/types";
|
|
5
|
+
declare type ChipProps = {
|
|
6
|
+
children: string,
|
|
7
|
+
Icon?: React.ComponentType<IconProps>,
|
|
8
|
+
onClose?: () => void,
|
|
9
|
+
};
|
|
10
|
+
declare var Chip: React.ComponentType<ChipProps>;
|
|
11
|
+
declare export default typeof Chip;
|
package/dist/form.js
CHANGED
|
@@ -182,7 +182,7 @@ var Form = function Form(param) {
|
|
|
182
182
|
if (input.disabled) {
|
|
183
183
|
continue;
|
|
184
184
|
}
|
|
185
|
-
if (input.required && !
|
|
185
|
+
if (input.required && !rawValues[name].trim()) {
|
|
186
186
|
errors[name] = texts.formFieldErrorIsMandatory;
|
|
187
187
|
} else {
|
|
188
188
|
var error = validator === null || validator === void 0 ? void 0 : validator(values[name], rawValues[name]);
|
package/dist/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export { default as Callout } from './callout';
|
|
|
56
56
|
export { useModalState } from './modal-context-provider';
|
|
57
57
|
export { NavigationBar, MainNavigationBar, FunnelNavigationBar, NavigationBarActionGroup, NavigationBarAction, NavigationBarLogo, } from './navigation-bar';
|
|
58
58
|
export { default as Image } from './image';
|
|
59
|
+
export { default as Chip } from './chip';
|
|
59
60
|
export { default as Video } from './video';
|
|
60
61
|
export { default as Form } from './form';
|
|
61
62
|
export { default as Select } from './select';
|
package/dist/index.js
CHANGED
|
@@ -566,6 +566,12 @@ Object.defineProperty(exports, "Image", {
|
|
|
566
566
|
return _image.default;
|
|
567
567
|
}
|
|
568
568
|
});
|
|
569
|
+
Object.defineProperty(exports, "Chip", {
|
|
570
|
+
enumerable: true,
|
|
571
|
+
get: function() {
|
|
572
|
+
return _chip.default;
|
|
573
|
+
}
|
|
574
|
+
});
|
|
569
575
|
Object.defineProperty(exports, "Video", {
|
|
570
576
|
enumerable: true,
|
|
571
577
|
get: function() {
|
|
@@ -8304,6 +8310,7 @@ var _callout = _interopRequireDefault(require("./callout"));
|
|
|
8304
8310
|
var _modalContextProvider = require("./modal-context-provider");
|
|
8305
8311
|
var _navigationBar = require("./navigation-bar");
|
|
8306
8312
|
var _image = _interopRequireDefault(require("./image"));
|
|
8313
|
+
var _chip = _interopRequireDefault(require("./chip"));
|
|
8307
8314
|
var _video = _interopRequireDefault(require("./video"));
|
|
8308
8315
|
var _form = _interopRequireDefault(require("./form"));
|
|
8309
8316
|
var _select = _interopRequireDefault(require("./select"));
|
package/dist/index.js.flow
CHANGED
|
@@ -99,6 +99,7 @@ declare export {
|
|
|
99
99
|
NavigationBarLogo,
|
|
100
100
|
} from "./navigation-bar";
|
|
101
101
|
declare export { default as Image } from "./image";
|
|
102
|
+
declare export { default as Chip } from "./chip";
|
|
102
103
|
declare export { default as Video } from "./video";
|
|
103
104
|
declare export { default as Form } from "./form";
|
|
104
105
|
declare export { default as Select } from "./select";
|
package/dist/package-version.js
CHANGED
package/dist/select.js
CHANGED
|
@@ -354,6 +354,21 @@ var Select = function Select(param) {
|
|
|
354
354
|
};
|
|
355
355
|
var focusableElement = focusableRef.current;
|
|
356
356
|
var inputElement = inputRef.current;
|
|
357
|
+
React.useEffect(function() {
|
|
358
|
+
setRawValue({
|
|
359
|
+
name: name,
|
|
360
|
+
value: value
|
|
361
|
+
});
|
|
362
|
+
formSetValue({
|
|
363
|
+
name: name,
|
|
364
|
+
value: value
|
|
365
|
+
});
|
|
366
|
+
}, [
|
|
367
|
+
name,
|
|
368
|
+
setRawValue,
|
|
369
|
+
formSetValue,
|
|
370
|
+
value
|
|
371
|
+
]);
|
|
357
372
|
React.useEffect(function() {
|
|
358
373
|
register(name, {
|
|
359
374
|
input: inputRef.current,
|
|
@@ -148,6 +148,11 @@ var generateId = function() {
|
|
|
148
148
|
// in frontend, use the same generator for all JssProvider renders, this way we avoid classname collisions
|
|
149
149
|
return (0, _jss).createGenerateId();
|
|
150
150
|
}();
|
|
151
|
+
var useDefaultHrefDecorator = function useDefaultHrefDecorator() {
|
|
152
|
+
return function(href) {
|
|
153
|
+
return href;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
151
156
|
var ThemeContextProvider = function ThemeContextProvider(param) {
|
|
152
157
|
var theme = param.theme, children = param.children;
|
|
153
158
|
var classNamePrefix = React.useMemo(// we'll have missmatches when rendering client side. The disadvantage of this is that we can only have one instance of
|
|
@@ -173,7 +178,7 @@ var ThemeContextProvider = function ThemeContextProvider(param) {
|
|
|
173
178
|
platform: (0, _platform).getPlatform(),
|
|
174
179
|
insideNovumNativeApp: (0, _platform).isInsideNovumNativeApp()
|
|
175
180
|
}, theme.platformOverrides);
|
|
176
|
-
var _mediaQueries1, _Link;
|
|
181
|
+
var _mediaQueries1, _Link, _useHrefDecorator;
|
|
177
182
|
return {
|
|
178
183
|
skinName: theme.skin.name,
|
|
179
184
|
i18n: theme.i18n,
|
|
@@ -191,7 +196,8 @@ var ThemeContextProvider = function ThemeContextProvider(param) {
|
|
|
191
196
|
colors: colors,
|
|
192
197
|
Link: (_Link = theme.Link) !== null && _Link !== void 0 ? _Link : _theme.AnchorLink,
|
|
193
198
|
isDarkMode: isDarkModeEnabled,
|
|
194
|
-
isIos: (0, _platform).getPlatform(platformOverrides) === 'ios'
|
|
199
|
+
isIos: (0, _platform).getPlatform(platformOverrides) === 'ios',
|
|
200
|
+
useHrefDecorator: (_useHrefDecorator = theme.useHrefDecorator) !== null && _useHrefDecorator !== void 0 ? _useHrefDecorator : useDefaultHrefDecorator
|
|
195
201
|
};
|
|
196
202
|
}, [
|
|
197
203
|
theme,
|
package/dist/theme.d.ts
CHANGED
|
@@ -98,6 +98,7 @@ export declare type ThemeConfig = {
|
|
|
98
98
|
desktopOrTabletMinHeight: number;
|
|
99
99
|
};
|
|
100
100
|
Link?: LinkComponent;
|
|
101
|
+
useHrefDecorator?: () => (href: string) => string;
|
|
101
102
|
enableTabFocus?: boolean;
|
|
102
103
|
};
|
|
103
104
|
export declare type Theme = {
|
|
@@ -132,5 +133,6 @@ export declare type Theme = {
|
|
|
132
133
|
Link: LinkComponent;
|
|
133
134
|
isDarkMode: boolean;
|
|
134
135
|
isIos: boolean;
|
|
136
|
+
useHrefDecorator: () => (href: string) => string;
|
|
135
137
|
};
|
|
136
138
|
export {};
|
package/dist/theme.js.flow
CHANGED
|
@@ -102,6 +102,7 @@ export type ThemeConfig = {
|
|
|
102
102
|
desktopOrTabletMinHeight: number,
|
|
103
103
|
},
|
|
104
104
|
Link?: LinkComponent,
|
|
105
|
+
useHrefDecorator?: () => (href: string) => string,
|
|
105
106
|
enableTabFocus?: boolean,
|
|
106
107
|
};
|
|
107
108
|
export type Theme = {
|
|
@@ -136,6 +137,7 @@ export type Theme = {
|
|
|
136
137
|
Link: LinkComponent,
|
|
137
138
|
isDarkMode: boolean,
|
|
138
139
|
isIos: boolean,
|
|
140
|
+
useHrefDecorator: () => (href: string) => string,
|
|
139
141
|
};
|
|
140
142
|
declare export {};
|
|
141
143
|
|
package/dist/touchable.js
CHANGED
|
@@ -114,7 +114,8 @@ var useStyles = (0, _jss).createUseStyles(function() {
|
|
|
114
114
|
};
|
|
115
115
|
});
|
|
116
116
|
var Touchable = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
117
|
-
var ref1 = (0, _hooks).useTheme(), texts = ref1.texts, analytics = ref1.analytics, platformOverrides = ref1.platformOverrides, Link = ref1.Link;
|
|
117
|
+
var ref1 = (0, _hooks).useTheme(), texts = ref1.texts, analytics = ref1.analytics, platformOverrides = ref1.platformOverrides, Link = ref1.Link, useHrefDecorator = ref1.useHrefDecorator;
|
|
118
|
+
var hrefDecorator = useHrefDecorator();
|
|
118
119
|
var classes = useStyles();
|
|
119
120
|
var isClicked = React.useRef(false);
|
|
120
121
|
var trackingEvents = [];
|
|
@@ -150,7 +151,7 @@ var Touchable = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
150
151
|
};
|
|
151
152
|
var getHref = function getHref() {
|
|
152
153
|
if (props.href) {
|
|
153
|
-
return props.href;
|
|
154
|
+
return hrefDecorator(props.href);
|
|
154
155
|
}
|
|
155
156
|
if (props.to && props.fullPageOnWebView) {
|
|
156
157
|
if (typeof props.to === 'string') {
|
package/dist-es/button-layout.js
CHANGED
|
@@ -4,6 +4,7 @@ import { createUseStyles } from './jss';
|
|
|
4
4
|
import { useScreenSize, useIsomorphicLayoutEffect } from './hooks';
|
|
5
5
|
import { BUTTON_MIN_WIDTH, ButtonPrimary, ButtonSecondary, ButtonDanger } from './button';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
+
import debounce from 'lodash/debounce';
|
|
7
8
|
function _arrayWithHoles(arr) {
|
|
8
9
|
if (Array.isArray(arr)) return arr;
|
|
9
10
|
}
|
|
@@ -174,28 +175,29 @@ var buttonsRange = [
|
|
|
174
175
|
var ButtonLayout = function(param) {
|
|
175
176
|
var children = param.children, _align = param.align, align = _align === void 0 ? 'full-width' : _align, link = param.link, _withMargins = param.withMargins, withMargins = _withMargins === void 0 ? false : _withMargins;
|
|
176
177
|
var ref = useScreenSize(), isTabletOrSmaller = ref.isTabletOrSmaller;
|
|
177
|
-
var ref1 = _slicedToArray(React.useState(true), 2), isMeasuring = ref1[0], setIsMeasuring = ref1[1];
|
|
178
178
|
var childrenCount = React.Children.count(children);
|
|
179
|
-
var
|
|
180
|
-
|
|
179
|
+
var ref1 = _slicedToArray(React.useState({
|
|
180
|
+
isMeasuring: true,
|
|
181
|
+
buttonWidth: 0
|
|
182
|
+
}), 2), buttonStatus = ref1[0], setButtonStatus = ref1[1];
|
|
183
|
+
var updateButtonStatus = function(param) {
|
|
184
|
+
var isMeasuring = param.isMeasuring, buttonWidth = param.buttonWidth;
|
|
181
185
|
if (process.env.NODE_ENV !== 'test') {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (process.env.NODE_ENV !== 'test') {
|
|
187
|
-
setIsMeasuring(isMeasuring);
|
|
186
|
+
setButtonStatus({
|
|
187
|
+
isMeasuring: isMeasuring,
|
|
188
|
+
buttonWidth: buttonWidth
|
|
189
|
+
});
|
|
188
190
|
}
|
|
189
191
|
};
|
|
190
192
|
var classes = useStyles({
|
|
191
|
-
buttonWidth: buttonWidth,
|
|
193
|
+
buttonWidth: buttonStatus.buttonWidth,
|
|
192
194
|
isTabletOrSmaller: isTabletOrSmaller,
|
|
193
195
|
align: align,
|
|
194
196
|
childrenCount: childrenCount
|
|
195
197
|
});
|
|
196
198
|
var wrapperElRef = React.useRef(null);
|
|
197
199
|
useIsomorphicLayoutEffect(function() {
|
|
198
|
-
if (isMeasuring) {
|
|
200
|
+
if (buttonStatus.isMeasuring) {
|
|
199
201
|
var req = window.requestAnimationFrame(function() {
|
|
200
202
|
if (wrapperElRef.current) {
|
|
201
203
|
var childrenWidths = Array.from(wrapperElRef.current.children).map(function(el) {
|
|
@@ -210,8 +212,10 @@ var ButtonLayout = function(param) {
|
|
|
210
212
|
var maxChildWidth = Math.ceil((_Math = Math).max.apply(_Math, _toConsumableArray(childrenWidths).concat([
|
|
211
213
|
BUTTON_MIN_WIDTH
|
|
212
214
|
])));
|
|
213
|
-
|
|
214
|
-
|
|
215
|
+
updateButtonStatus({
|
|
216
|
+
isMeasuring: false,
|
|
217
|
+
buttonWidth: maxChildWidth
|
|
218
|
+
});
|
|
215
219
|
}
|
|
216
220
|
});
|
|
217
221
|
return function() {
|
|
@@ -222,11 +226,20 @@ var ButtonLayout = function(param) {
|
|
|
222
226
|
};
|
|
223
227
|
}, [
|
|
224
228
|
classes.link,
|
|
225
|
-
|
|
229
|
+
buttonStatus
|
|
226
230
|
]);
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
231
|
+
/**
|
|
232
|
+
* Multiple calls to calcLayout are debounced to workaround an issue that can be reproduced in chrome when pressing
|
|
233
|
+
* the button during a focus/visibility change. For example, pressing the button having the focus on the devTools.
|
|
234
|
+
*/ var calcLayout = React.useMemo(function() {
|
|
235
|
+
return debounce(function() {
|
|
236
|
+
updateButtonStatus({
|
|
237
|
+
isMeasuring: true,
|
|
238
|
+
buttonWidth: 0
|
|
239
|
+
});
|
|
240
|
+
}, 5, {
|
|
241
|
+
maxWait: 50
|
|
242
|
+
});
|
|
230
243
|
}, []);
|
|
231
244
|
useOnChildrenChangeEffect(wrapperElRef.current, calcLayout);
|
|
232
245
|
useOnFontsReadyEffect(calcLayout);
|
package/dist-es/chip.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createUseStyles } from './jss';
|
|
3
|
+
import { useTheme } from './hooks';
|
|
4
|
+
import Box from './box';
|
|
5
|
+
import { Text2 } from './text';
|
|
6
|
+
import IconButton from './icon-button';
|
|
7
|
+
import IconCloseRegular from './generated/mistica-icons/icon-close-regular';
|
|
8
|
+
import { pxToRem } from './utils/css';
|
|
9
|
+
function _defineProperty(obj, key, value) {
|
|
10
|
+
if (key in obj) {
|
|
11
|
+
Object.defineProperty(obj, key, {
|
|
12
|
+
value: value,
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
obj[key] = value;
|
|
19
|
+
}
|
|
20
|
+
return obj;
|
|
21
|
+
}
|
|
22
|
+
var useStyles = createUseStyles(function(param) {
|
|
23
|
+
var colors = param.colors, mq = param.mq;
|
|
24
|
+
return {
|
|
25
|
+
container: _defineProperty({
|
|
26
|
+
display: 'inline-flex',
|
|
27
|
+
justifyContent: 'center',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
border: "1px solid ".concat(colors.border),
|
|
30
|
+
borderRadius: 20,
|
|
31
|
+
backgroundColor: colors.backgroundContainer,
|
|
32
|
+
minHeight: 32,
|
|
33
|
+
minWidth: 56,
|
|
34
|
+
cursor: 'default',
|
|
35
|
+
color: colors.neutralMedium,
|
|
36
|
+
'& > span': {
|
|
37
|
+
color: colors.textPrimary
|
|
38
|
+
}
|
|
39
|
+
}, mq.supportsHover, {
|
|
40
|
+
'&:hover': {
|
|
41
|
+
borderColor: function(param) {
|
|
42
|
+
var isDarkMode = param.isDarkMode;
|
|
43
|
+
return isDarkMode ? colors.background : colors.tagBackgroundActive;
|
|
44
|
+
},
|
|
45
|
+
color: colors.controlActivated,
|
|
46
|
+
backgroundColor: colors.tagBackgroundActive
|
|
47
|
+
},
|
|
48
|
+
'&:hover > span': {
|
|
49
|
+
color: colors.textLink
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
var Chip = function(param) {
|
|
55
|
+
var children = param.children, Icon = param.Icon, onClose = param.onClose;
|
|
56
|
+
var ref = useTheme(), texts = ref.texts, isDarkMode = ref.isDarkMode;
|
|
57
|
+
var classes = useStyles({
|
|
58
|
+
isDarkMode: isDarkMode
|
|
59
|
+
});
|
|
60
|
+
return(/*#__PURE__*/ _jsxs(Box, {
|
|
61
|
+
className: classes.container,
|
|
62
|
+
paddingLeft: Icon ? 8 : 12,
|
|
63
|
+
paddingRight: onClose ? 0 : 12,
|
|
64
|
+
children: [
|
|
65
|
+
Icon && /*#__PURE__*/ _jsx(Box, {
|
|
66
|
+
paddingRight: 4,
|
|
67
|
+
children: /*#__PURE__*/ _jsx(Icon, {
|
|
68
|
+
color: "currentColor",
|
|
69
|
+
size: pxToRem(16)
|
|
70
|
+
})
|
|
71
|
+
}),
|
|
72
|
+
/*#__PURE__*/ _jsx(Text2, {
|
|
73
|
+
medium: true,
|
|
74
|
+
truncate: 1,
|
|
75
|
+
color: "currentColor",
|
|
76
|
+
children: children
|
|
77
|
+
}),
|
|
78
|
+
onClose ? /*#__PURE__*/ _jsx(Box, {
|
|
79
|
+
paddingLeft: 4,
|
|
80
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
81
|
+
size: 24,
|
|
82
|
+
style: {
|
|
83
|
+
display: 'flex',
|
|
84
|
+
justifyContent: 'center',
|
|
85
|
+
alignItems: 'center'
|
|
86
|
+
},
|
|
87
|
+
"aria-label": texts.closeButtonLabel,
|
|
88
|
+
onPress: function() {
|
|
89
|
+
return onClose();
|
|
90
|
+
},
|
|
91
|
+
children: /*#__PURE__*/ _jsx(IconCloseRegular, {
|
|
92
|
+
size: 16,
|
|
93
|
+
color: "currentColor"
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
}) : null
|
|
97
|
+
]
|
|
98
|
+
}));
|
|
99
|
+
};
|
|
100
|
+
export default Chip;
|
package/dist-es/form.js
CHANGED
|
@@ -146,7 +146,7 @@ var Form = function(param) {
|
|
|
146
146
|
if (input.disabled) {
|
|
147
147
|
continue;
|
|
148
148
|
}
|
|
149
|
-
if (input.required && !
|
|
149
|
+
if (input.required && !rawValues[name].trim()) {
|
|
150
150
|
errors[name] = texts.formFieldErrorIsMandatory;
|
|
151
151
|
} else {
|
|
152
152
|
var error = validator === null || validator === void 0 ? void 0 : validator(values[name], rawValues[name]);
|
package/dist-es/index.js
CHANGED
|
@@ -56,6 +56,7 @@ export { default as Callout } from './callout';
|
|
|
56
56
|
export { useModalState } from './modal-context-provider';
|
|
57
57
|
export { NavigationBar, MainNavigationBar, FunnelNavigationBar, NavigationBarActionGroup, NavigationBarAction, NavigationBarLogo } from './navigation-bar';
|
|
58
58
|
export { default as Image } from './image';
|
|
59
|
+
export { default as Chip } from './chip';
|
|
59
60
|
export { default as Video } from './video';
|
|
60
61
|
// Forms
|
|
61
62
|
export { default as Form } from './form';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// DO NOT EDIT THIS FILE. It's autogenerated by set-version.js
|
|
2
|
-
export var PACKAGE_VERSION = '10.
|
|
2
|
+
export var PACKAGE_VERSION = '10.22.2';
|
package/dist-es/select.js
CHANGED
|
@@ -320,6 +320,21 @@ var Select = function(param) {
|
|
|
320
320
|
};
|
|
321
321
|
var focusableElement = focusableRef.current;
|
|
322
322
|
var inputElement = inputRef.current;
|
|
323
|
+
React.useEffect(function() {
|
|
324
|
+
setRawValue({
|
|
325
|
+
name: name,
|
|
326
|
+
value: value
|
|
327
|
+
});
|
|
328
|
+
formSetValue({
|
|
329
|
+
name: name,
|
|
330
|
+
value: value
|
|
331
|
+
});
|
|
332
|
+
}, [
|
|
333
|
+
name,
|
|
334
|
+
setRawValue,
|
|
335
|
+
formSetValue,
|
|
336
|
+
value
|
|
337
|
+
]);
|
|
323
338
|
React.useEffect(function() {
|
|
324
339
|
register(name, {
|
|
325
340
|
input: inputRef.current,
|
|
@@ -113,6 +113,11 @@ var generateId = function() {
|
|
|
113
113
|
// in frontend, use the same generator for all JssProvider renders, this way we avoid classname collisions
|
|
114
114
|
return createGenerateId();
|
|
115
115
|
}();
|
|
116
|
+
var useDefaultHrefDecorator = function() {
|
|
117
|
+
return function(href) {
|
|
118
|
+
return href;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
116
121
|
var ThemeContextProvider = function(param) {
|
|
117
122
|
var theme = param.theme, children = param.children;
|
|
118
123
|
var classNamePrefix = React.useMemo(// Always start the counter in 0 in server side, otherwise every new request to the server will inclrement the counter and
|
|
@@ -139,7 +144,7 @@ var ThemeContextProvider = function(param) {
|
|
|
139
144
|
platform: getPlatform(),
|
|
140
145
|
insideNovumNativeApp: isInsideNovumNativeApp()
|
|
141
146
|
}, theme.platformOverrides);
|
|
142
|
-
var _mediaQueries, _Link;
|
|
147
|
+
var _mediaQueries, _Link, _useHrefDecorator;
|
|
143
148
|
return {
|
|
144
149
|
skinName: theme.skin.name,
|
|
145
150
|
i18n: theme.i18n,
|
|
@@ -157,7 +162,8 @@ var ThemeContextProvider = function(param) {
|
|
|
157
162
|
colors: colors,
|
|
158
163
|
Link: (_Link = theme.Link) !== null && _Link !== void 0 ? _Link : AnchorLink,
|
|
159
164
|
isDarkMode: isDarkModeEnabled,
|
|
160
|
-
isIos: getPlatform(platformOverrides) === 'ios'
|
|
165
|
+
isIos: getPlatform(platformOverrides) === 'ios',
|
|
166
|
+
useHrefDecorator: (_useHrefDecorator = theme.useHrefDecorator) !== null && _useHrefDecorator !== void 0 ? _useHrefDecorator : useDefaultHrefDecorator
|
|
161
167
|
};
|
|
162
168
|
}, [
|
|
163
169
|
theme,
|
package/dist-es/touchable.js
CHANGED
|
@@ -80,7 +80,8 @@ var useStyles = createUseStyles(function() {
|
|
|
80
80
|
};
|
|
81
81
|
});
|
|
82
82
|
var Touchable = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
83
|
-
var ref1 = useTheme(), texts = ref1.texts, analytics = ref1.analytics, platformOverrides = ref1.platformOverrides, Link = ref1.Link;
|
|
83
|
+
var ref1 = useTheme(), texts = ref1.texts, analytics = ref1.analytics, platformOverrides = ref1.platformOverrides, Link = ref1.Link, useHrefDecorator = ref1.useHrefDecorator;
|
|
84
|
+
var hrefDecorator = useHrefDecorator();
|
|
84
85
|
var classes = useStyles();
|
|
85
86
|
var isClicked = React.useRef(false);
|
|
86
87
|
var trackingEvents = [];
|
|
@@ -116,7 +117,7 @@ var Touchable = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
116
117
|
};
|
|
117
118
|
var getHref = function() {
|
|
118
119
|
if (props.href) {
|
|
119
|
-
return props.href;
|
|
120
|
+
return hrefDecorator(props.href);
|
|
120
121
|
}
|
|
121
122
|
if (props.to && props.fullPageOnWebView) {
|
|
122
123
|
if (typeof props.to === 'string') {
|