@telefonica/mistica 10.21.0 → 10.22.3
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 +28 -0
- package/dist/button-layout.js +3 -1
- package/dist/chip.d.ts +9 -0
- package/dist/chip.js +111 -0
- package/dist/chip.js.flow +11 -0
- package/dist/form.js +2 -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-es/button-layout.js +3 -1
- package/dist-es/chip.js +100 -0
- package/dist-es/form.js +2 -1
- package/dist-es/index.js +1 -0
- package/dist-es/package-version.js +1 -1
- package/dist-es/select.js +15 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## [10.22.3](https://github.com/Telefonica/mistica-web/compare/v10.22.2...v10.22.3) (2022-02-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **Form:** handle undefined rawValue ([#410](https://github.com/Telefonica/mistica-web/issues/410)) ([6363328](https://github.com/Telefonica/mistica-web/commit/63633288d1a9a1781b9bf350c4923af101a72312))
|
|
7
|
+
|
|
8
|
+
## [10.22.2](https://github.com/Telefonica/mistica-web/compare/v10.22.1...v10.22.2) (2022-02-07)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **Select:** set rawValue on init ([#409](https://github.com/Telefonica/mistica-web/issues/409)) ([d72cbd1](https://github.com/Telefonica/mistica-web/commit/d72cbd179e930712ef54c5e483e08c922a857059))
|
|
14
|
+
|
|
15
|
+
## [10.22.1](https://github.com/Telefonica/mistica-web/compare/v10.22.0...v10.22.1) (2022-02-03)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **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))
|
|
21
|
+
|
|
22
|
+
# [10.22.0](https://github.com/Telefonica/mistica-web/compare/v10.21.0...v10.22.0) (2022-02-02)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **Chip:** new component ([#395](https://github.com/Telefonica/mistica-web/issues/395)) ([37f1be2](https://github.com/Telefonica/mistica-web/commit/37f1be2322ad3913b3084fb6a14539629a9a81b4))
|
|
28
|
+
|
|
1
29
|
# [10.21.0](https://github.com/Telefonica/mistica-web/compare/v10.20.0...v10.21.0) (2022-01-27)
|
|
2
30
|
|
|
3
31
|
|
package/dist/button-layout.js
CHANGED
|
@@ -270,7 +270,9 @@ var ButtonLayout = function ButtonLayout(param) {
|
|
|
270
270
|
isMeasuring: true,
|
|
271
271
|
buttonWidth: 0
|
|
272
272
|
});
|
|
273
|
-
},
|
|
273
|
+
}, 5, {
|
|
274
|
+
maxWait: 50
|
|
275
|
+
});
|
|
274
276
|
}, []);
|
|
275
277
|
useOnChildrenChangeEffect(wrapperElRef.current, calcLayout);
|
|
276
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
|
@@ -179,10 +179,11 @@ var Form = function Form(param) {
|
|
|
179
179
|
for(var _iterator = fieldRegistrations.current[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
180
180
|
var _value = _slicedToArray(_step.value, 2), name = _value[0], ref = _value[1], input = ref.input, validator = ref.validator;
|
|
181
181
|
if (input) {
|
|
182
|
+
var ref;
|
|
182
183
|
if (input.disabled) {
|
|
183
184
|
continue;
|
|
184
185
|
}
|
|
185
|
-
if (input.required && !
|
|
186
|
+
if (input.required && !((ref = rawValues[name]) === null || ref === void 0 ? void 0 : ref.trim())) {
|
|
186
187
|
errors[name] = texts.formFieldErrorIsMandatory;
|
|
187
188
|
} else {
|
|
188
189
|
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,
|
package/dist-es/button-layout.js
CHANGED
|
@@ -237,7 +237,9 @@ var ButtonLayout = function(param) {
|
|
|
237
237
|
isMeasuring: true,
|
|
238
238
|
buttonWidth: 0
|
|
239
239
|
});
|
|
240
|
-
},
|
|
240
|
+
}, 5, {
|
|
241
|
+
maxWait: 50
|
|
242
|
+
});
|
|
241
243
|
}, []);
|
|
242
244
|
useOnChildrenChangeEffect(wrapperElRef.current, calcLayout);
|
|
243
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
|
@@ -143,10 +143,11 @@ var Form = function(param) {
|
|
|
143
143
|
for(var _iterator = fieldRegistrations.current[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
144
144
|
var _value = _slicedToArray(_step.value, 2), name = _value[0], ref = _value[1], input = ref.input, validator = ref.validator;
|
|
145
145
|
if (input) {
|
|
146
|
+
var ref;
|
|
146
147
|
if (input.disabled) {
|
|
147
148
|
continue;
|
|
148
149
|
}
|
|
149
|
-
if (input.required && !
|
|
150
|
+
if (input.required && !((ref = rawValues[name]) === null || ref === void 0 ? void 0 : ref.trim())) {
|
|
150
151
|
errors[name] = texts.formFieldErrorIsMandatory;
|
|
151
152
|
} else {
|
|
152
153
|
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.3';
|
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,
|