@telefonica/mistica 10.14.2 → 10.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/button.js +16 -26
- package/dist/card.d.ts +10 -1
- package/dist/card.js +4 -1
- package/dist/card.js.flow +16 -1
- package/dist/checkbox.js +11 -7
- package/dist/credit-card-expiration-field.js +2 -7
- package/dist/credit-card-number-field.js +2 -2
- package/dist/cvv-field.js +2 -2
- package/dist/date-field.js +2 -2
- package/dist/date-time-field.js +2 -2
- package/dist/date-time-picker.js +12 -6
- package/dist/decimal-field.js +2 -7
- package/dist/email-field.js +2 -7
- package/dist/feedback.js +5 -8
- package/dist/iban-field.js +2 -7
- package/dist/image.d.ts +25 -4
- package/dist/image.js +64 -7
- package/dist/image.js.flow +30 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.js +20 -0
- package/dist/index.js.flow +3 -1
- package/dist/integer-field.js +2 -7
- package/dist/list.d.ts +1 -0
- package/dist/list.js +63 -26
- package/dist/list.js.flow +1 -0
- package/dist/menu.d.ts +1 -1
- package/dist/menu.js +34 -27
- package/dist/menu.js.flow +1 -1
- package/dist/month-field.js +2 -2
- package/dist/package-version.js +1 -1
- package/dist/password-field.js +2 -2
- package/dist/phone-number-field.js +2 -7
- package/dist/radio-button.js +13 -9
- package/dist/search-field.js +2 -2
- package/dist/select.js +7 -18
- package/dist/skins/blau.js +0 -24
- package/dist/skins/movistar.js +0 -23
- package/dist/skins/o2-classic.js +0 -24
- package/dist/skins/o2.js +0 -23
- package/dist/skins/types.d.ts +0 -12
- package/dist/skins/types.js.flow +0 -12
- package/dist/skins/vivo.js +0 -23
- package/dist/switch-component.js +12 -9
- package/dist/text-field-base.d.ts +3 -2
- package/dist/text-field-base.js +15 -33
- package/dist/text-field-base.js.flow +6 -2
- package/dist/text-field-components.d.ts +0 -1
- package/dist/text-field-components.js +8 -15
- package/dist/text-field-components.js.flow +0 -1
- package/dist/text-field.d.ts +2 -1
- package/dist/text-field.js +10 -16
- package/dist/text-field.js.flow +5 -1
- package/dist/text-link.d.ts +1 -0
- package/dist/text-link.js +16 -9
- package/dist/text-link.js.flow +1 -0
- package/dist/touchable.js +2 -3
- package/dist/video.d.ts +32 -0
- package/dist/video.js +161 -0
- package/dist/video.js.flow +50 -0
- package/dist-es/button.js +16 -26
- package/dist-es/card.js +4 -1
- package/dist-es/checkbox.js +11 -7
- package/dist-es/credit-card-expiration-field.js +2 -2
- package/dist-es/credit-card-number-field.js +2 -2
- package/dist-es/cvv-field.js +2 -2
- package/dist-es/date-field.js +2 -2
- package/dist-es/date-time-field.js +2 -2
- package/dist-es/date-time-picker.js +12 -6
- package/dist-es/decimal-field.js +2 -2
- package/dist-es/email-field.js +2 -2
- package/dist-es/feedback.js +5 -8
- package/dist-es/iban-field.js +2 -2
- package/dist-es/image.js +38 -6
- package/dist-es/index.js +3 -1
- package/dist-es/integer-field.js +2 -2
- package/dist-es/list.js +63 -26
- package/dist-es/menu.js +35 -28
- package/dist-es/month-field.js +2 -2
- package/dist-es/package-version.js +1 -1
- package/dist-es/password-field.js +2 -2
- package/dist-es/phone-number-field.js +2 -2
- package/dist-es/radio-button.js +13 -9
- package/dist-es/search-field.js +2 -2
- package/dist-es/select.js +7 -18
- package/dist-es/skins/blau.js +0 -24
- package/dist-es/skins/movistar.js +0 -23
- package/dist-es/skins/o2-classic.js +0 -24
- package/dist-es/skins/o2.js +0 -23
- package/dist-es/skins/vivo.js +0 -23
- package/dist-es/switch-component.js +12 -9
- package/dist-es/text-field-base.js +15 -32
- package/dist-es/text-field-components.js +8 -15
- package/dist-es/text-field.js +9 -12
- package/dist-es/text-link.js +14 -8
- package/dist-es/touchable.js +2 -3
- package/dist-es/video.js +123 -0
- package/package.json +2 -2
package/dist/image.js
CHANGED
|
@@ -2,9 +2,33 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports.default = void 0;
|
|
5
|
+
exports.default = exports.useDisableBorderRadius = exports.RATIO = exports.DisableBorderRadiusProvider = void 0;
|
|
6
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
7
8
|
var _jss = require("./jss");
|
|
9
|
+
function _interopRequireWildcard(obj) {
|
|
10
|
+
if (obj && obj.__esModule) {
|
|
11
|
+
return obj;
|
|
12
|
+
} else {
|
|
13
|
+
var newObj = {
|
|
14
|
+
};
|
|
15
|
+
if (obj != null) {
|
|
16
|
+
for(var key in obj){
|
|
17
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
18
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
|
|
19
|
+
};
|
|
20
|
+
if (desc.get || desc.set) {
|
|
21
|
+
Object.defineProperty(newObj, key, desc);
|
|
22
|
+
} else {
|
|
23
|
+
newObj[key] = obj[key];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
newObj.default = obj;
|
|
29
|
+
return newObj;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
8
32
|
function _objectWithoutProperties(source, excluded) {
|
|
9
33
|
if (source == null) return {
|
|
10
34
|
};
|
|
@@ -35,14 +59,37 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
35
59
|
}
|
|
36
60
|
return target;
|
|
37
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* This context is used internally to disable the border radius. This is useful for example
|
|
64
|
+
* when using the Image component inside a Card
|
|
65
|
+
*/ var DisableBorderRadiusContext = /*#__PURE__*/ React.createContext(false);
|
|
66
|
+
var useDisableBorderRadius = function useDisableBorderRadius() {
|
|
67
|
+
return React.useContext(DisableBorderRadiusContext);
|
|
68
|
+
};
|
|
69
|
+
exports.useDisableBorderRadius = useDisableBorderRadius;
|
|
70
|
+
var DisableBorderRadiusProvider = function DisableBorderRadiusProvider(param) {
|
|
71
|
+
var children = param.children;
|
|
72
|
+
/*#__PURE__*/ return (0, _jsxRuntime).jsx(DisableBorderRadiusContext.Provider, {
|
|
73
|
+
value: true,
|
|
74
|
+
children: children
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
exports.DisableBorderRadiusProvider = DisableBorderRadiusProvider;
|
|
38
78
|
var useStyles = (0, _jss).createUseStyles(function() {
|
|
39
79
|
return {
|
|
40
80
|
image: {
|
|
41
|
-
borderRadius:
|
|
81
|
+
borderRadius: function borderRadius(param) {
|
|
82
|
+
var noBorderRadius = param.noBorderRadius;
|
|
83
|
+
return noBorderRadius ? 0 : 4;
|
|
84
|
+
},
|
|
42
85
|
display: 'block',
|
|
43
86
|
objectFit: 'cover',
|
|
44
87
|
maxWidth: '100%',
|
|
45
|
-
maxHeight: '100%'
|
|
88
|
+
maxHeight: '100%',
|
|
89
|
+
aspectRatio: function aspectRatio(param) {
|
|
90
|
+
var aspectRatio1 = param.aspectRatio;
|
|
91
|
+
return aspectRatio1 !== null && aspectRatio1 !== void 0 ? aspectRatio1 : 'unset';
|
|
92
|
+
}
|
|
46
93
|
}
|
|
47
94
|
};
|
|
48
95
|
});
|
|
@@ -51,19 +98,29 @@ var RATIO = {
|
|
|
51
98
|
'16:9': 16 / 9,
|
|
52
99
|
'7:10': 7 / 10
|
|
53
100
|
};
|
|
101
|
+
exports.RATIO = RATIO;
|
|
54
102
|
var Image = function Image(_param) {
|
|
55
|
-
var
|
|
56
|
-
"url",
|
|
103
|
+
var _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, _alt = _param.alt, alt = _alt === void 0 ? '' : _alt, props = _objectWithoutProperties(_param, [
|
|
57
104
|
"aspectRatio",
|
|
58
105
|
"alt"
|
|
59
106
|
]);
|
|
60
|
-
var
|
|
107
|
+
var noBorderRadius = useDisableBorderRadius();
|
|
108
|
+
var classes = useStyles({
|
|
109
|
+
noBorderRadius: noBorderRadius,
|
|
110
|
+
aspectRatio: !props.width && !props.height ? RATIO[aspectRatio] : undefined
|
|
111
|
+
});
|
|
112
|
+
var url = props.src || props.url;
|
|
61
113
|
var width = props.width;
|
|
62
114
|
var height = props.height;
|
|
63
|
-
if (props.width !== undefined) {
|
|
115
|
+
if (props.width !== undefined && props.height !== undefined) {
|
|
116
|
+
width = props.width;
|
|
117
|
+
height = props.height;
|
|
118
|
+
} else if (props.width !== undefined) {
|
|
64
119
|
height = props.width / RATIO[aspectRatio];
|
|
65
120
|
} else if (props.height !== undefined) {
|
|
66
121
|
width = props.height * RATIO[aspectRatio];
|
|
122
|
+
} else {
|
|
123
|
+
width = '100%';
|
|
67
124
|
}
|
|
68
125
|
return(/*#__PURE__*/ (0, _jsxRuntime).jsx("img", {
|
|
69
126
|
src: url,
|
package/dist/image.js.flow
CHANGED
|
@@ -1,13 +1,39 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
declare
|
|
5
|
-
declare
|
|
4
|
+
declare export var useDisableBorderRadius: () => boolean;
|
|
5
|
+
declare export var DisableBorderRadiusProvider: React.ComponentType<{}>;
|
|
6
|
+
export type AspectRatio = "1:1" | "16:9" | "7:10";
|
|
7
|
+
declare export var RATIO: {
|
|
8
|
+
"1:1": number,
|
|
9
|
+
"16:9": number,
|
|
10
|
+
"7:10": number,
|
|
11
|
+
};
|
|
12
|
+
export type ImageProps = {
|
|
13
|
+
src: string,
|
|
14
|
+
/**
|
|
15
|
+
* defaults to 100% when no width and no height are given
|
|
16
|
+
*/
|
|
17
|
+
width?: number,
|
|
18
|
+
height?: number,
|
|
19
|
+
/**
|
|
20
|
+
* defaults to 1:1, if both width and height are given, aspectRatio is ignored
|
|
21
|
+
*/
|
|
22
|
+
aspectRatio?: AspectRatio,
|
|
23
|
+
/**
|
|
24
|
+
* defaults to empty string
|
|
25
|
+
*/
|
|
26
|
+
alt?: string,
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated
|
|
30
|
+
*/
|
|
31
|
+
declare type DeprecatedImageProps = {
|
|
6
32
|
url: string,
|
|
7
33
|
width?: number,
|
|
8
34
|
height?: number,
|
|
9
35
|
/**
|
|
10
|
-
* defaults to 1:1
|
|
36
|
+
* defaults to 1:1, if both width and height are given, aspectRatio is ignored
|
|
11
37
|
*/
|
|
12
38
|
aspectRatio?: AspectRatio,
|
|
13
39
|
/**
|
|
@@ -15,5 +41,5 @@ declare type Props = {
|
|
|
15
41
|
*/
|
|
16
42
|
alt?: string,
|
|
17
43
|
};
|
|
18
|
-
declare var Image: React.ComponentType<
|
|
44
|
+
declare var Image: React.ComponentType<ImageProps | DeprecatedImageProps>;
|
|
19
45
|
declare export default typeof Image;
|
package/dist/index.d.ts
CHANGED
|
@@ -55,9 +55,11 @@ export { default as Callout } from './callout';
|
|
|
55
55
|
export { useModalState } from './modal-context-provider';
|
|
56
56
|
export { NavigationBar, MainNavigationBar, FunnelNavigationBar, NavigationBarActionGroup, NavigationBarAction, NavigationBarLogo, } from './navigation-bar';
|
|
57
57
|
export { default as Image } from './image';
|
|
58
|
+
export { default as Video } from './video';
|
|
58
59
|
export { default as Form } from './form';
|
|
59
60
|
export { default as Select } from './select';
|
|
60
61
|
export { default as TextField } from './text-field';
|
|
62
|
+
export { TextFieldBase } from './text-field-base';
|
|
61
63
|
export { default as SearchField } from './search-field';
|
|
62
64
|
export { default as EmailField } from './email-field';
|
|
63
65
|
export { default as PhoneNumberField } from './phone-number-field';
|
|
@@ -73,7 +75,7 @@ export { default as DecimalField } from './decimal-field';
|
|
|
73
75
|
export { default as PasswordField } from './password-field';
|
|
74
76
|
export { default as DoubleField } from './double-field';
|
|
75
77
|
export { default as IbanField } from './iban-field';
|
|
76
|
-
export { useForm } from './form-context';
|
|
78
|
+
export { useForm, useFieldProps } from './form-context';
|
|
77
79
|
export { default as IconClose } from './icons/icon-close';
|
|
78
80
|
export { default as IconInfo } from './icons/icon-info';
|
|
79
81
|
export { default as IconArrowDown } from './icons/icon-arrow-down';
|
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, "Video", {
|
|
570
|
+
enumerable: true,
|
|
571
|
+
get: function() {
|
|
572
|
+
return _video.default;
|
|
573
|
+
}
|
|
574
|
+
});
|
|
569
575
|
Object.defineProperty(exports, "Form", {
|
|
570
576
|
enumerable: true,
|
|
571
577
|
get: function() {
|
|
@@ -584,6 +590,12 @@ Object.defineProperty(exports, "TextField", {
|
|
|
584
590
|
return _textField.default;
|
|
585
591
|
}
|
|
586
592
|
});
|
|
593
|
+
Object.defineProperty(exports, "TextFieldBase", {
|
|
594
|
+
enumerable: true,
|
|
595
|
+
get: function() {
|
|
596
|
+
return _textFieldBase.TextFieldBase;
|
|
597
|
+
}
|
|
598
|
+
});
|
|
587
599
|
Object.defineProperty(exports, "SearchField", {
|
|
588
600
|
enumerable: true,
|
|
589
601
|
get: function() {
|
|
@@ -680,6 +692,12 @@ Object.defineProperty(exports, "useForm", {
|
|
|
680
692
|
return _formContext.useForm;
|
|
681
693
|
}
|
|
682
694
|
});
|
|
695
|
+
Object.defineProperty(exports, "useFieldProps", {
|
|
696
|
+
enumerable: true,
|
|
697
|
+
get: function() {
|
|
698
|
+
return _formContext.useFieldProps;
|
|
699
|
+
}
|
|
700
|
+
});
|
|
683
701
|
Object.defineProperty(exports, "IconClose", {
|
|
684
702
|
enumerable: true,
|
|
685
703
|
get: function() {
|
|
@@ -8286,9 +8304,11 @@ var _callout = _interopRequireDefault(require("./callout"));
|
|
|
8286
8304
|
var _modalContextProvider = require("./modal-context-provider");
|
|
8287
8305
|
var _navigationBar = require("./navigation-bar");
|
|
8288
8306
|
var _image = _interopRequireDefault(require("./image"));
|
|
8307
|
+
var _video = _interopRequireDefault(require("./video"));
|
|
8289
8308
|
var _form = _interopRequireDefault(require("./form"));
|
|
8290
8309
|
var _select = _interopRequireDefault(require("./select"));
|
|
8291
8310
|
var _textField = _interopRequireDefault(require("./text-field"));
|
|
8311
|
+
var _textFieldBase = require("./text-field-base");
|
|
8292
8312
|
var _searchField = _interopRequireDefault(require("./search-field"));
|
|
8293
8313
|
var _emailField = _interopRequireDefault(require("./email-field"));
|
|
8294
8314
|
var _phoneNumberField = _interopRequireDefault(require("./phone-number-field"));
|
package/dist/index.js.flow
CHANGED
|
@@ -98,9 +98,11 @@ declare export {
|
|
|
98
98
|
NavigationBarLogo,
|
|
99
99
|
} from "./navigation-bar";
|
|
100
100
|
declare export { default as Image } from "./image";
|
|
101
|
+
declare export { default as Video } from "./video";
|
|
101
102
|
declare export { default as Form } from "./form";
|
|
102
103
|
declare export { default as Select } from "./select";
|
|
103
104
|
declare export { default as TextField } from "./text-field";
|
|
105
|
+
declare export { TextFieldBase } from "./text-field-base";
|
|
104
106
|
declare export { default as SearchField } from "./search-field";
|
|
105
107
|
declare export { default as EmailField } from "./email-field";
|
|
106
108
|
declare export { default as PhoneNumberField } from "./phone-number-field";
|
|
@@ -116,7 +118,7 @@ declare export { default as DecimalField } from "./decimal-field";
|
|
|
116
118
|
declare export { default as PasswordField } from "./password-field";
|
|
117
119
|
declare export { default as DoubleField } from "./double-field";
|
|
118
120
|
declare export { default as IbanField } from "./iban-field";
|
|
119
|
-
declare export { useForm } from "./form-context";
|
|
121
|
+
declare export { useForm, useFieldProps } from "./form-context";
|
|
120
122
|
declare export { default as IconClose } from "./icons/icon-close";
|
|
121
123
|
declare export { default as IconInfo } from "./icons/icon-info";
|
|
122
124
|
declare export { default as IconArrowDown } from "./icons/icon-arrow-down";
|
package/dist/integer-field.js
CHANGED
|
@@ -6,12 +6,7 @@ exports.default = exports.IntegerInput = void 0;
|
|
|
6
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
7
|
var _formContext = require("./form-context");
|
|
8
8
|
var _hooks = require("./hooks");
|
|
9
|
-
var _textFieldBase =
|
|
10
|
-
function _interopRequireDefault(obj) {
|
|
11
|
-
return obj && obj.__esModule ? obj : {
|
|
12
|
-
default: obj
|
|
13
|
-
};
|
|
14
|
-
}
|
|
9
|
+
var _textFieldBase = require("./text-field-base");
|
|
15
10
|
function _defineProperty(obj, key, value) {
|
|
16
11
|
if (key in obj) {
|
|
17
12
|
Object.defineProperty(obj, key, {
|
|
@@ -137,7 +132,7 @@ var IntegerField = function IntegerField(_param) {
|
|
|
137
132
|
onChange: onChange,
|
|
138
133
|
onChangeValue: onChangeValue
|
|
139
134
|
});
|
|
140
|
-
return(/*#__PURE__*/ (0, _jsxRuntime).jsx(_textFieldBase.
|
|
135
|
+
return(/*#__PURE__*/ (0, _jsxRuntime).jsx(_textFieldBase.TextFieldBaseAutosuggest, _objectSpread({
|
|
141
136
|
}, rest, fieldProps, {
|
|
142
137
|
inputComponent: IntegerInput
|
|
143
138
|
})));
|
package/dist/list.d.ts
CHANGED
package/dist/list.js
CHANGED
|
@@ -16,7 +16,7 @@ var _hooks = require("./hooks");
|
|
|
16
16
|
var _themeVariantContext = require("./theme-variant-context");
|
|
17
17
|
var _iconChevron = _interopRequireDefault(require("./icons/icon-chevron"));
|
|
18
18
|
var _switchComponent = _interopRequireDefault(require("./switch-component"));
|
|
19
|
-
var _radioButton =
|
|
19
|
+
var _radioButton = _interopRequireWildcard(require("./radio-button"));
|
|
20
20
|
var _checkbox = _interopRequireDefault(require("./checkbox"));
|
|
21
21
|
var _boxed = require("./boxed");
|
|
22
22
|
var _divider = _interopRequireDefault(require("./divider"));
|
|
@@ -113,18 +113,24 @@ function _slicedToArray(arr, i) {
|
|
|
113
113
|
var useStyles = (0, _jss).createUseStyles(function(param) {
|
|
114
114
|
var colors = param.colors, mq = param.mq;
|
|
115
115
|
return {
|
|
116
|
+
disabled: {
|
|
117
|
+
opacity: 0.5
|
|
118
|
+
},
|
|
116
119
|
hover: _defineProperty({
|
|
117
120
|
}, mq.supportsHover, {
|
|
118
121
|
'&:hover': {
|
|
119
122
|
background: function background(param) {
|
|
120
|
-
var isInverse = param.isInverse;
|
|
121
|
-
return isInverse ? 'initial' : colors.backgroundAlternative;
|
|
123
|
+
var isInverse = param.isInverse, disabled = param.disabled;
|
|
124
|
+
return isInverse || disabled ? 'initial' : colors.backgroundAlternative;
|
|
122
125
|
}
|
|
123
126
|
}
|
|
124
127
|
}),
|
|
125
128
|
rowContent: {
|
|
126
129
|
width: '100%',
|
|
127
|
-
cursor:
|
|
130
|
+
cursor: function cursor(param) {
|
|
131
|
+
var disabled = param.disabled;
|
|
132
|
+
return disabled ? 'default' : 'pointer';
|
|
133
|
+
}
|
|
128
134
|
},
|
|
129
135
|
hoverDisabled: {
|
|
130
136
|
cursor: 'initial',
|
|
@@ -195,8 +201,9 @@ var useStyles = (0, _jss).createUseStyles(function(param) {
|
|
|
195
201
|
}
|
|
196
202
|
};
|
|
197
203
|
});
|
|
204
|
+
var _obj;
|
|
198
205
|
var Content = function Content(param) {
|
|
199
|
-
var headline = param.headline, title = param.title, titleLinesMax = param.titleLinesMax, subtitle = param.subtitle, subtitleLinesMax = param.subtitleLinesMax, description = param.description, descriptionLinesMax = param.descriptionLinesMax, asset = param.asset, _type = param.type, type = _type === void 0 ? 'basic' : _type, badge = param.badge, right = param.right, extra = param.extra, labelId = param.labelId;
|
|
206
|
+
var headline = param.headline, title = param.title, titleLinesMax = param.titleLinesMax, subtitle = param.subtitle, subtitleLinesMax = param.subtitleLinesMax, description = param.description, descriptionLinesMax = param.descriptionLinesMax, asset = param.asset, _type = param.type, type = _type === void 0 ? 'basic' : _type, badge = param.badge, right = param.right, extra = param.extra, labelId = param.labelId, disabled = param.disabled;
|
|
200
207
|
var isInverse = (0, _themeVariantContext).useIsInverseVariant();
|
|
201
208
|
var classes = useStyles({
|
|
202
209
|
isInverse: isInverse
|
|
@@ -217,7 +224,8 @@ var Content = function Content(param) {
|
|
|
217
224
|
return(/*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
|
|
218
225
|
paddingLeft: 16,
|
|
219
226
|
children: /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
220
|
-
className: (0, _classnames).default(classes.center, classes.badge
|
|
227
|
+
className: (0, _classnames).default(classes.center, classes.badge, _defineProperty({
|
|
228
|
+
}, classes.disabled, disabled)),
|
|
221
229
|
children: badge === true ? /*#__PURE__*/ (0, _jsxRuntime).jsx(_badge.default, {
|
|
222
230
|
}) : /*#__PURE__*/ (0, _jsxRuntime).jsx(_badge.default, {
|
|
223
231
|
value: badge
|
|
@@ -225,21 +233,49 @@ var Content = function Content(param) {
|
|
|
225
233
|
})
|
|
226
234
|
}));
|
|
227
235
|
};
|
|
236
|
+
var renderRight = function renderRight() {
|
|
237
|
+
switch(type){
|
|
238
|
+
case 'chevron':
|
|
239
|
+
return(/*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
|
|
240
|
+
paddingLeft: 16,
|
|
241
|
+
className: (0, _classnames).default(classes.center, _defineProperty({
|
|
242
|
+
}, classes.disabled, disabled)),
|
|
243
|
+
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconChevron.default, {
|
|
244
|
+
color: isInverse ? colors.inverse : colors.neutralMedium,
|
|
245
|
+
direction: "right"
|
|
246
|
+
})
|
|
247
|
+
}));
|
|
248
|
+
case 'control':
|
|
249
|
+
return(/*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
250
|
+
className: classes.right,
|
|
251
|
+
children: right
|
|
252
|
+
}));
|
|
253
|
+
case 'custom':
|
|
254
|
+
return(/*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
255
|
+
className: (0, _classnames).default(classes.right, _defineProperty({
|
|
256
|
+
}, classes.disabled, disabled)),
|
|
257
|
+
children: right
|
|
258
|
+
}));
|
|
259
|
+
default:
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
};
|
|
228
263
|
return(/*#__PURE__*/ (0, _jsxRuntime).jsxs(_box.default, {
|
|
229
264
|
paddingY: 16,
|
|
230
265
|
className: classes.content,
|
|
231
266
|
children: [
|
|
232
267
|
asset && /*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
|
|
233
268
|
paddingRight: 16,
|
|
234
|
-
className: (0, _classnames).default(
|
|
235
|
-
}, classes.center, shouldCenter)),
|
|
269
|
+
className: (0, _classnames).default((_obj = {
|
|
270
|
+
}, _defineProperty(_obj, classes.center, shouldCenter), _defineProperty(_obj, classes.disabled, disabled), _obj)),
|
|
236
271
|
children: /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
237
272
|
className: classes.asset,
|
|
238
273
|
children: asset
|
|
239
274
|
})
|
|
240
275
|
}),
|
|
241
276
|
/*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
242
|
-
className: classes.rowBody,
|
|
277
|
+
className: (0, _classnames).default(classes.rowBody, _defineProperty({
|
|
278
|
+
}, classes.disabled, disabled)),
|
|
243
279
|
style: {
|
|
244
280
|
justifyContent: shouldCenter ? 'center' : 'flex-start'
|
|
245
281
|
},
|
|
@@ -284,17 +320,7 @@ var Content = function Content(param) {
|
|
|
284
320
|
})
|
|
285
321
|
}),
|
|
286
322
|
renderBadge(),
|
|
287
|
-
|
|
288
|
-
paddingLeft: 16,
|
|
289
|
-
className: classes.center,
|
|
290
|
-
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconChevron.default, {
|
|
291
|
-
color: isInverse ? colors.inverse : colors.neutralMedium,
|
|
292
|
-
direction: "right"
|
|
293
|
-
})
|
|
294
|
-
}) : right ? /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
295
|
-
className: classes.right,
|
|
296
|
-
children: right
|
|
297
|
-
}) : null
|
|
323
|
+
renderRight()
|
|
298
324
|
]
|
|
299
325
|
}));
|
|
300
326
|
};
|
|
@@ -324,10 +350,13 @@ var useControlState = function useControlState(param) {
|
|
|
324
350
|
var RowContent = /*#__PURE__*/ React.forwardRef(function(props, ref5) {
|
|
325
351
|
var titleId = (0, _hooks).useAriaId();
|
|
326
352
|
var isInverse = (0, _themeVariantContext).useIsInverseVariant();
|
|
353
|
+
var asset = props.asset, headline = props.headline, title = props.title, titleLinesMax = props.titleLinesMax, subtitle = props.subtitle, subtitleLinesMax = props.subtitleLinesMax, description = props.description, descriptionLinesMax = props.descriptionLinesMax, badge = props.badge, role = props.role, extra = props.extra, dataAttributes = props.dataAttributes;
|
|
354
|
+
var radioContext = (0, _radioButton).useRadioContext();
|
|
355
|
+
var disabled = props.disabled || props.radioValue !== undefined && radioContext.disabled;
|
|
327
356
|
var classes = useStyles({
|
|
328
|
-
isInverse: isInverse
|
|
357
|
+
isInverse: isInverse,
|
|
358
|
+
disabled: disabled
|
|
329
359
|
});
|
|
330
|
-
var asset = props.asset, headline = props.headline, title = props.title, titleLinesMax = props.titleLinesMax, subtitle = props.subtitle, subtitleLinesMax = props.subtitleLinesMax, description = props.description, descriptionLinesMax = props.descriptionLinesMax, badge = props.badge, role = props.role, extra = props.extra, dataAttributes = props.dataAttributes;
|
|
331
360
|
var ref1 = _slicedToArray(useControlState(props.switch || props.checkbox || {
|
|
332
361
|
}), 2), isChecked = ref1[0], toggle = ref1[1];
|
|
333
362
|
var renderContent = function renderContent(param) {
|
|
@@ -345,7 +374,8 @@ var RowContent = /*#__PURE__*/ React.forwardRef(function(props, ref5) {
|
|
|
345
374
|
type: type,
|
|
346
375
|
right: right,
|
|
347
376
|
extra: extra,
|
|
348
|
-
labelId: labelId
|
|
377
|
+
labelId: labelId,
|
|
378
|
+
disabled: disabled
|
|
349
379
|
});
|
|
350
380
|
};
|
|
351
381
|
var renderTouchableContent = function renderTouchableContent(props) {
|
|
@@ -373,6 +403,7 @@ var RowContent = /*#__PURE__*/ React.forwardRef(function(props, ref5) {
|
|
|
373
403
|
onPress: props.onPress,
|
|
374
404
|
role: role,
|
|
375
405
|
dataAttributes: dataAttributes,
|
|
406
|
+
disabled: disabled,
|
|
376
407
|
children: renderTouchableContent(props)
|
|
377
408
|
}));
|
|
378
409
|
}
|
|
@@ -384,6 +415,7 @@ var RowContent = /*#__PURE__*/ React.forwardRef(function(props, ref5) {
|
|
|
384
415
|
fullPageOnWebView: props.fullPageOnWebView,
|
|
385
416
|
role: role,
|
|
386
417
|
dataAttributes: dataAttributes,
|
|
418
|
+
disabled: disabled,
|
|
387
419
|
children: renderTouchableContent(props)
|
|
388
420
|
}));
|
|
389
421
|
}
|
|
@@ -395,6 +427,7 @@ var RowContent = /*#__PURE__*/ React.forwardRef(function(props, ref5) {
|
|
|
395
427
|
newTab: props.newTab,
|
|
396
428
|
role: role,
|
|
397
429
|
dataAttributes: dataAttributes,
|
|
430
|
+
disabled: disabled,
|
|
398
431
|
children: renderTouchableContent(props)
|
|
399
432
|
}));
|
|
400
433
|
}
|
|
@@ -406,19 +439,22 @@ var RowContent = /*#__PURE__*/ React.forwardRef(function(props, ref5) {
|
|
|
406
439
|
className: classes.dualActionContainer,
|
|
407
440
|
children: [
|
|
408
441
|
/*#__PURE__*/ (0, _jsxRuntime).jsx(_touchable.default, {
|
|
442
|
+
disabled: disabled,
|
|
409
443
|
onPress: props.onPress,
|
|
410
444
|
role: role,
|
|
411
445
|
className: (0, _classnames).default(classes.dualActionLeft, classes.hover),
|
|
412
446
|
children: renderContent({
|
|
413
|
-
type: '
|
|
447
|
+
type: 'basic',
|
|
414
448
|
labelId: titleId
|
|
415
449
|
})
|
|
416
450
|
}),
|
|
417
451
|
/*#__PURE__*/ (0, _jsxRuntime).jsx(_touchable.default, {
|
|
452
|
+
disabled: disabled,
|
|
418
453
|
className: classes.dualActionRight,
|
|
419
454
|
onPress: toggle,
|
|
420
455
|
dataAttributes: dataAttributes,
|
|
421
456
|
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(Control, {
|
|
457
|
+
disabled: disabled,
|
|
422
458
|
name: name,
|
|
423
459
|
checked: isChecked,
|
|
424
460
|
"aria-labelledby": titleId,
|
|
@@ -431,6 +467,7 @@ var RowContent = /*#__PURE__*/ React.forwardRef(function(props, ref5) {
|
|
|
431
467
|
}) : /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
432
468
|
className: (0, _classnames).default(classes.rowContent, classes.hover),
|
|
433
469
|
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(Control, {
|
|
470
|
+
disabled: disabled,
|
|
434
471
|
dataAttributes: dataAttributes,
|
|
435
472
|
name: name,
|
|
436
473
|
checked: isChecked,
|
|
@@ -441,7 +478,7 @@ var RowContent = /*#__PURE__*/ React.forwardRef(function(props, ref5) {
|
|
|
441
478
|
role: role,
|
|
442
479
|
children: renderContent({
|
|
443
480
|
labelId: labelId,
|
|
444
|
-
type: '
|
|
481
|
+
type: 'control',
|
|
445
482
|
right: /*#__PURE__*/ (0, _jsxRuntime).jsx(_stack.default, {
|
|
446
483
|
space: "around",
|
|
447
484
|
children: control
|
|
@@ -471,7 +508,7 @@ var RowContent = /*#__PURE__*/ React.forwardRef(function(props, ref5) {
|
|
|
471
508
|
/*#__PURE__*/ return (0, _jsxRuntime).jsx(_box.default, {
|
|
472
509
|
paddingX: 16,
|
|
473
510
|
children: renderContent({
|
|
474
|
-
type: '
|
|
511
|
+
type: 'control',
|
|
475
512
|
right: /*#__PURE__*/ (0, _jsxRuntime).jsx(_stack.default, {
|
|
476
513
|
space: "around",
|
|
477
514
|
children: radio
|
package/dist/list.js.flow
CHANGED
package/dist/menu.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare type MenuRenderProps = {
|
|
|
6
6
|
};
|
|
7
7
|
declare type TargetRenderProps = {
|
|
8
8
|
ref: (element: HTMLElement | null) => void;
|
|
9
|
-
onPress: (
|
|
9
|
+
onPress: () => void;
|
|
10
10
|
isMenuOpen: boolean;
|
|
11
11
|
};
|
|
12
12
|
export declare type MenuProps = {
|
package/dist/menu.js
CHANGED
|
@@ -6,9 +6,9 @@ exports.default = void 0;
|
|
|
6
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _keyCodes = require("./utils/key-codes");
|
|
9
|
-
var _overlay = _interopRequireDefault(require("./overlay"));
|
|
10
9
|
var _jss = require("./jss");
|
|
11
10
|
var _dom = require("./utils/dom");
|
|
11
|
+
var _overlay = _interopRequireDefault(require("./overlay"));
|
|
12
12
|
function _interopRequireDefault(obj) {
|
|
13
13
|
return obj && obj.__esModule ? obj : {
|
|
14
14
|
default: obj
|
|
@@ -103,6 +103,7 @@ var useStyles = (0, _jss).createUseStyles(function(param) {
|
|
|
103
103
|
var colors = param.colors;
|
|
104
104
|
return {
|
|
105
105
|
menuContainer: {
|
|
106
|
+
zIndex: 12,
|
|
106
107
|
margin: 0,
|
|
107
108
|
padding: 0,
|
|
108
109
|
listStyleType: 'none',
|
|
@@ -111,13 +112,17 @@ var useStyles = (0, _jss).createUseStyles(function(param) {
|
|
|
111
112
|
var itemsComputedProps = param.itemsComputedProps;
|
|
112
113
|
return itemsComputedProps.top;
|
|
113
114
|
},
|
|
114
|
-
|
|
115
|
+
bottom: function bottom(param) {
|
|
116
|
+
var itemsComputedProps = param.itemsComputedProps;
|
|
117
|
+
return itemsComputedProps.bottom;
|
|
118
|
+
},
|
|
119
|
+
right: function right(param) {
|
|
115
120
|
var itemsComputedProps = param.itemsComputedProps;
|
|
116
|
-
return itemsComputedProps.
|
|
121
|
+
return itemsComputedProps.right;
|
|
117
122
|
},
|
|
118
123
|
width: function width(param) {
|
|
119
|
-
var
|
|
120
|
-
return width1 !== null && width1 !== void 0 ? width1 :
|
|
124
|
+
var width1 = param.width;
|
|
125
|
+
return width1 !== null && width1 !== void 0 ? width1 : '100%';
|
|
121
126
|
},
|
|
122
127
|
borderRadius: 4,
|
|
123
128
|
boxShadow: '0px 5px 5px -3px rgba(0,0,0,0.2), 0px 8px 10px 1px rgba(0,0,0,0.14), 0px 3px 14px 2px rgba(0,0,0,0.12)',
|
|
@@ -158,28 +163,27 @@ var Menu = function Menu(param) {
|
|
|
158
163
|
return;
|
|
159
164
|
}
|
|
160
165
|
var MARGIN_THRESHOLD = 12;
|
|
161
|
-
var topTarget = targetRect.top, widthTarget = targetRect.width,
|
|
166
|
+
var topTarget = targetRect.top, widthTarget = targetRect.width, height = targetRect.height;
|
|
162
167
|
var top = topTarget + height;
|
|
163
168
|
var ref;
|
|
164
169
|
var spaceTaken = (ref = parseInt(window.getComputedStyle(menu).getPropertyValue('height'))) !== null && ref !== void 0 ? ref : 0;
|
|
165
|
-
var
|
|
170
|
+
var rightDirection = position === 'left' ? 'auto' : "calc(100% - ".concat(widthTarget, "px)");
|
|
166
171
|
// if it doesn't fit on bottom
|
|
167
172
|
if (top + spaceTaken + MARGIN_THRESHOLD > window.innerHeight) {
|
|
168
173
|
var availableSpaceBottom = window.innerHeight - top;
|
|
169
174
|
if (topTarget /* this is the available space on top */ > availableSpaceBottom) {
|
|
170
|
-
var newTop = topTarget - spaceTaken;
|
|
171
175
|
setItemsComputedProps({
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
top:
|
|
175
|
-
maxHeight: topTarget
|
|
176
|
+
right: rightDirection,
|
|
177
|
+
bottom: '100%',
|
|
178
|
+
top: 'auto',
|
|
179
|
+
maxHeight: Math.min(topTarget, MAX_HEIGHT_DEFAULT),
|
|
176
180
|
transformOrigin: 'center bottom'
|
|
177
181
|
});
|
|
178
182
|
} else {
|
|
179
183
|
setItemsComputedProps({
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
184
|
+
top: '100%',
|
|
185
|
+
bottom: 'auto',
|
|
186
|
+
right: rightDirection,
|
|
183
187
|
maxHeight: Math.min(window.innerHeight - top - MARGIN_THRESHOLD, MAX_HEIGHT_DEFAULT),
|
|
184
188
|
transformOrigin: 'center top'
|
|
185
189
|
});
|
|
@@ -187,9 +191,9 @@ var Menu = function Menu(param) {
|
|
|
187
191
|
} else {
|
|
188
192
|
// if it fits on bottom
|
|
189
193
|
setItemsComputedProps({
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
top: '100%',
|
|
195
|
+
bottom: 'auto',
|
|
196
|
+
right: rightDirection,
|
|
193
197
|
maxHeight: Math.min(window.innerHeight - top - MARGIN_THRESHOLD, MAX_HEIGHT_DEFAULT),
|
|
194
198
|
transformOrigin: 'center top'
|
|
195
199
|
});
|
|
@@ -257,20 +261,23 @@ var Menu = function Menu(param) {
|
|
|
257
261
|
document.removeEventListener('keydown', handleKeyDown, false);
|
|
258
262
|
};
|
|
259
263
|
});
|
|
260
|
-
return(/*#__PURE__*/ (0, _jsxRuntime).jsxs(
|
|
264
|
+
return(/*#__PURE__*/ (0, _jsxRuntime).jsxs("div", {
|
|
265
|
+
style: {
|
|
266
|
+
position: 'relative'
|
|
267
|
+
},
|
|
261
268
|
children: [
|
|
262
|
-
renderTarget(_objectSpread({
|
|
263
|
-
}, targetProps, {
|
|
264
|
-
isMenuOpen: isMenuOpen
|
|
265
|
-
})),
|
|
266
269
|
isMenuOpen ? /*#__PURE__*/ (0, _jsxRuntime).jsx(_overlay.default, {
|
|
267
270
|
onPress: function onPress(e) {
|
|
268
|
-
setIsMenuOpen(false);
|
|
269
271
|
(0, _dom).cancelEvent(e);
|
|
272
|
+
setIsMenuOpen(false);
|
|
270
273
|
},
|
|
271
|
-
disableScroll: true
|
|
272
|
-
|
|
273
|
-
|
|
274
|
+
disableScroll: true
|
|
275
|
+
}) : null,
|
|
276
|
+
renderTarget(_objectSpread({
|
|
277
|
+
}, targetProps, {
|
|
278
|
+
isMenuOpen: isMenuOpen
|
|
279
|
+
})),
|
|
280
|
+
isMenuOpen ? renderMenu(menuProps) : null
|
|
274
281
|
]
|
|
275
282
|
}));
|
|
276
283
|
};
|
package/dist/menu.js.flow
CHANGED
|
@@ -8,7 +8,7 @@ declare type MenuRenderProps = {
|
|
|
8
8
|
};
|
|
9
9
|
declare type TargetRenderProps = {
|
|
10
10
|
ref: (element: HTMLElement | null) => void,
|
|
11
|
-
onPress: (
|
|
11
|
+
onPress: () => void,
|
|
12
12
|
isMenuOpen: boolean,
|
|
13
13
|
};
|
|
14
14
|
export type MenuProps = {
|