@telefonica/mistica 12.6.0 → 12.8.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/dist/carousel.d.ts +2 -0
- package/dist/carousel.js +23 -6
- package/dist/carousel.js.flow +2 -0
- package/dist/fixed-footer-layout.js +31 -9
- package/dist/generated/mistica-icons/icon-buy-data-light.js +5 -11
- package/dist/generated/mistica-icons/icon-buy-data-regular.js +1 -1
- package/dist/generated/mistica-icons/icon-eco-light.js +1 -1
- package/dist/generated/mistica-icons/icon-justice-regular.js +1 -1
- package/dist/generated/mistica-icons/icon-tokens-filled.d.ts +4 -0
- package/dist/generated/mistica-icons/icon-tokens-filled.js +109 -0
- package/dist/generated/mistica-icons/icon-tokens-filled.js.flow +6 -0
- package/dist/generated/mistica-icons/icon-tokens-light.d.ts +4 -0
- package/dist/generated/mistica-icons/icon-tokens-light.js +109 -0
- package/dist/generated/mistica-icons/icon-tokens-light.js.flow +6 -0
- package/dist/generated/mistica-icons/icon-tokens-regular.d.ts +4 -0
- package/dist/generated/mistica-icons/icon-tokens-regular.js +109 -0
- package/dist/generated/mistica-icons/icon-tokens-regular.js.flow +6 -0
- package/dist/hooks.d.ts +3 -0
- package/dist/hooks.js +16 -3
- package/dist/hooks.js.flow +3 -0
- package/dist/image.d.ts +2 -0
- package/dist/image.js +118 -80
- package/dist/image.js.flow +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +21 -0
- package/dist/index.js.flow +3 -0
- package/dist/list.d.ts +1 -0
- package/dist/list.js +4 -2
- package/dist/list.js.flow +1 -0
- package/dist/package-version.js +1 -1
- package/dist/skeletons.d.ts +5 -2
- package/dist/skeletons.js +50 -87
- package/dist/skeletons.js.flow +4 -4
- package/dist/skins/o2.js +1 -1
- package/dist/text-field-base.d.ts +0 -1
- package/dist/text-field-base.js +2 -0
- package/dist/text-field-base.js.flow +0 -1
- package/dist/text-field-components.d.ts +1 -0
- package/dist/text-field-components.js +7 -3
- package/dist/text-field-components.js.flow +1 -0
- package/dist/utils/aspect-ratio-support.d.ts +10 -0
- package/dist/utils/aspect-ratio-support.js +115 -1
- package/dist/utils/aspect-ratio-support.js.flow +14 -0
- package/dist/video.js +20 -79
- package/dist-es/carousel.js +23 -6
- package/dist-es/fixed-footer-layout.js +32 -10
- package/dist-es/generated/mistica-icons/icon-buy-data-light.js +6 -12
- package/dist-es/generated/mistica-icons/icon-buy-data-regular.js +1 -1
- package/dist-es/generated/mistica-icons/icon-eco-light.js +1 -1
- package/dist-es/generated/mistica-icons/icon-justice-regular.js +1 -1
- package/dist-es/generated/mistica-icons/icon-tokens-filled.js +85 -0
- package/dist-es/generated/mistica-icons/icon-tokens-light.js +85 -0
- package/dist-es/generated/mistica-icons/icon-tokens-regular.js +85 -0
- package/dist-es/hooks.js +14 -2
- package/dist-es/image.js +115 -83
- package/dist-es/index.js +3 -0
- package/dist-es/list.js +4 -2
- package/dist-es/package-version.js +1 -1
- package/dist-es/skeletons.js +50 -87
- package/dist-es/skins/o2.js +1 -1
- package/dist-es/text-field-base.js +2 -0
- package/dist-es/text-field-components.js +7 -3
- package/dist-es/utils/aspect-ratio-support.js +112 -0
- package/dist-es/video.js +21 -81
- package/package.json +1 -1
package/dist-es/image.js
CHANGED
|
@@ -99,11 +99,17 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
99
99
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
100
100
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
101
101
|
}
|
|
102
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
102
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
103
103
|
import * as React from "react";
|
|
104
104
|
import { createUseStyles } from "./jss";
|
|
105
|
-
import {
|
|
105
|
+
import { SkeletonRectangle } from "./skeletons";
|
|
106
|
+
import { AspectRatioElement } from "./utils/aspect-ratio-support";
|
|
106
107
|
import { getPrefixedDataAttributes } from "./utils/dom";
|
|
108
|
+
import IconImageRegular from "./generated/mistica-icons/icon-image-regular";
|
|
109
|
+
import { useIsInverseVariant } from "./theme-variant-context";
|
|
110
|
+
import { useTheme } from "./hooks";
|
|
111
|
+
import { VIVO_SKIN } from "./skins/constants";
|
|
112
|
+
var FADE_IN_DURATION_MS = 300;
|
|
107
113
|
/**
|
|
108
114
|
* This context is used internally to disable the border radius. This is useful for example
|
|
109
115
|
* when using the Image component inside a Card
|
|
@@ -118,59 +124,74 @@ export var DisableBorderRadiusProvider = function(param) {
|
|
|
118
124
|
children: children
|
|
119
125
|
});
|
|
120
126
|
};
|
|
127
|
+
var VivoLogo = function(param) {
|
|
128
|
+
var style = param.style;
|
|
129
|
+
var colors = useTheme().colors;
|
|
130
|
+
return /*#__PURE__*/ _jsx("svg", {
|
|
131
|
+
width: "48",
|
|
132
|
+
height: "48",
|
|
133
|
+
viewBox: "0 0 48 48",
|
|
134
|
+
fill: "none",
|
|
135
|
+
style: style,
|
|
136
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
137
|
+
d: "M24.021 35.7235C24.8145 35.7694 25.0467 36.1913 25.3157 36.5138C25.586 36.8362 29.515 41.551 29.7823 41.8569C30.0475 42.1662 30.7822 42.7329 31.5901 42.8405C32.3967 42.9473 33.282 42.7842 33.8484 42.3748C34.4135 41.965 35.1313 41.4073 35.3833 41.0356C35.6337 40.6638 36.061 40.1302 35.9823 39.2534C35.9028 38.3783 35.7112 37.9204 35.0268 37.1691C34.3433 36.4185 30.2992 31.6657 29.5382 30.7537C29.5382 30.7537 28.8467 29.9423 28.9469 28.7956C29.0476 27.6468 29.567 27.1343 30.6608 26.8487C31.7534 26.5647 36.0267 25.5306 36.0267 25.5306C36.0267 25.5306 38.4728 24.3723 37.9182 22.0776L37.5997 20.904C37.5997 20.904 37.0672 18.2264 33.5519 19.0556C30.0344 19.8869 28.0803 20.377 28.0803 20.377C28.0803 20.377 26.9602 20.4838 26.7999 19.744C26.6417 19.0038 26.8494 18.6218 27.3443 18.4156C27.8387 18.209 30.9611 16.7175 31.3617 12.6853C31.7652 8.65158 28.3882 5.06573 24.0091 5.08104C19.6288 5.0976 16.4594 8.39988 16.4725 11.8185C16.4856 15.2387 18.7033 17.5144 20.4079 18.3638C21.3752 18.8453 21.0656 19.7122 21.0656 19.7122C21.0656 19.7122 20.8334 20.5554 19.8153 20.3311C18.7972 20.1025 13.8657 18.9736 13.8657 18.9736C13.8657 18.9736 10.8914 18.4226 10.1732 21.359C9.4541 24.2978 11.1261 25.4143 12.3532 25.6908C13.5798 25.9669 17.7296 26.9716 17.7296 26.9716C17.7296 26.9716 18.9643 27.581 19.0125 28.8308C19.0425 29.5697 19.0438 30.1824 18.266 31.2832C17.4894 32.3835 12.6598 38.0148 12.6598 38.0148C12.6598 38.0148 10.9997 39.9862 13.4051 41.763C15.8106 43.5401 17.1641 43.1262 18.5921 41.4889C20.0188 39.852 22.8383 36.4243 22.8383 36.4243C22.8383 36.4243 23.2275 35.6788 24.021 35.7235Z",
|
|
138
|
+
stroke: colors.brand,
|
|
139
|
+
strokeWidth: "2"
|
|
140
|
+
})
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
var ImageError = function() {
|
|
144
|
+
var isInverse = useIsInverseVariant();
|
|
145
|
+
var ref = useTheme(), colors = ref.colors, skinName = ref.skinName;
|
|
146
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
147
|
+
style: {
|
|
148
|
+
height: "100%",
|
|
149
|
+
width: "100%",
|
|
150
|
+
display: "flex",
|
|
151
|
+
alignItems: "center",
|
|
152
|
+
justifyContent: "center",
|
|
153
|
+
backgroundColor: isInverse ? colors.backgroundSkeletonInverse : colors.backgroundSkeleton,
|
|
154
|
+
borderRadius: 8
|
|
155
|
+
},
|
|
156
|
+
children: skinName === VIVO_SKIN ? /*#__PURE__*/ _jsx(VivoLogo, {
|
|
157
|
+
style: {
|
|
158
|
+
width: "10%",
|
|
159
|
+
minWidth: 24,
|
|
160
|
+
maxWidth: 48
|
|
161
|
+
}
|
|
162
|
+
}) : /*#__PURE__*/ _jsx(IconImageRegular, {
|
|
163
|
+
color: isInverse ? colors.inverse : colors.neutralMedium,
|
|
164
|
+
size: "",
|
|
165
|
+
style: {
|
|
166
|
+
width: "10%",
|
|
167
|
+
minWidth: 24,
|
|
168
|
+
maxWidth: 48
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
});
|
|
172
|
+
};
|
|
121
173
|
var useStyles = createUseStyles(function() {
|
|
122
174
|
return {
|
|
123
175
|
image: {
|
|
176
|
+
// needeed because images with aspect-ratio 0 and position absolute does not work
|
|
177
|
+
position: function(param) {
|
|
178
|
+
var ratio = param.ratio;
|
|
179
|
+
return ratio !== 0 ? "absolute" : "static";
|
|
180
|
+
},
|
|
181
|
+
top: 0,
|
|
182
|
+
left: 0,
|
|
124
183
|
display: "block",
|
|
125
184
|
objectFit: "cover",
|
|
185
|
+
width: "100%",
|
|
186
|
+
height: "100%",
|
|
126
187
|
maxWidth: "100%",
|
|
127
188
|
maxHeight: "100%",
|
|
128
189
|
borderRadius: function(param) {
|
|
129
190
|
var noBorderRadius = param.noBorderRadius;
|
|
130
191
|
return noBorderRadius ? 0 : 8;
|
|
131
192
|
},
|
|
132
|
-
"
|
|
133
|
-
|
|
134
|
-
var aspectRatio = param.aspectRatio;
|
|
135
|
-
return aspectRatio !== null && aspectRatio !== void 0 ? aspectRatio : "unset";
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
"$wrapper &": {
|
|
139
|
-
borderRadius: 0,
|
|
140
|
-
position: function(param) {
|
|
141
|
-
var aspectRatio = param.aspectRatio;
|
|
142
|
-
return(// when aspectRatio is 0, we want the video to use the original aspect ratio
|
|
143
|
-
aspectRatio ? "absolute" : "static");
|
|
144
|
-
},
|
|
145
|
-
width: "100%",
|
|
146
|
-
height: "100%",
|
|
147
|
-
top: 0,
|
|
148
|
-
left: 0
|
|
149
|
-
},
|
|
150
|
-
opacity: function(param) {
|
|
151
|
-
var isError = param.isError;
|
|
152
|
-
return isError ? 0 : 1;
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
wrapper: {
|
|
156
|
-
borderRadius: function(param) {
|
|
157
|
-
var noBorderRadius = param.noBorderRadius;
|
|
158
|
-
return noBorderRadius ? 0 : 8;
|
|
159
|
-
},
|
|
160
|
-
overflow: "hidden",
|
|
161
|
-
maxWidth: "100%",
|
|
162
|
-
maxHeight: "100%",
|
|
163
|
-
position: "relative",
|
|
164
|
-
paddingTop: function(param) {
|
|
165
|
-
var aspectRatio = param.aspectRatio, width = param.width;
|
|
166
|
-
if (!aspectRatio) {
|
|
167
|
-
return 0;
|
|
168
|
-
}
|
|
169
|
-
if (width && typeof width === "string" && width.endsWith("%")) {
|
|
170
|
-
return "".concat(Number(width.replace("%", "")) / aspectRatio, "%");
|
|
171
|
-
}
|
|
172
|
-
return "".concat(100 / aspectRatio, "%");
|
|
173
|
-
}
|
|
193
|
+
transition: "opacity ".concat(FADE_IN_DURATION_MS, "ms"),
|
|
194
|
+
zIndex: 1
|
|
174
195
|
}
|
|
175
196
|
};
|
|
176
197
|
});
|
|
@@ -181,74 +202,85 @@ export var RATIO = {
|
|
|
181
202
|
"4:3": 4 / 3
|
|
182
203
|
};
|
|
183
204
|
var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
184
|
-
var _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? "1:1" : _aspectRatio, _alt = _param.alt, alt = _alt === void 0 ? "" : _alt, dataAttributes = _param.dataAttributes, noBorderRadius = _param.noBorderRadius, src = _param.src, onError = _param.onError, onLoad = _param.onLoad, props = _objectWithoutProperties(_param, [
|
|
205
|
+
var _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? "1:1" : _aspectRatio, _alt = _param.alt, alt = _alt === void 0 ? "" : _alt, dataAttributes = _param.dataAttributes, noBorderRadius = _param.noBorderRadius, src = _param.src, onError = _param.onError, onLoad = _param.onLoad, _loadingFallback = _param.loadingFallback, loadingFallback = _loadingFallback === void 0 ? true : _loadingFallback, _errorFallback = _param.errorFallback, errorFallback = _errorFallback === void 0 ? true : _errorFallback, props = _objectWithoutProperties(_param, [
|
|
185
206
|
"aspectRatio",
|
|
186
207
|
"alt",
|
|
187
208
|
"dataAttributes",
|
|
188
209
|
"noBorderRadius",
|
|
189
210
|
"src",
|
|
190
211
|
"onError",
|
|
191
|
-
"onLoad"
|
|
212
|
+
"onLoad",
|
|
213
|
+
"loadingFallback",
|
|
214
|
+
"errorFallback"
|
|
192
215
|
]);
|
|
193
|
-
var supportsAspectRatio = useSupportsAspectRatio();
|
|
194
216
|
var noBorderRadiusContext = useDisableBorderRadius();
|
|
195
217
|
var noBorderSetting = noBorderRadius !== null && noBorderRadius !== void 0 ? noBorderRadius : noBorderRadiusContext;
|
|
196
218
|
var _$ref = _slicedToArray(React.useState(false), 2), isError = _$ref[0], setIsError = _$ref[1];
|
|
219
|
+
var _$ref1 = _slicedToArray(React.useState(true), 2), isLoading = _$ref1[0], setIsLoading = _$ref1[1];
|
|
220
|
+
var _$ref2 = _slicedToArray(React.useState(false), 2), hideLoadingFallback = _$ref2[0], setHideLoadingFallback = _$ref2[1];
|
|
197
221
|
var ratio = typeof aspectRatio === "number" ? aspectRatio : RATIO[aspectRatio];
|
|
198
|
-
// if width or height are numeric, we can calculate the other with the ratio without css.
|
|
199
|
-
// if aspect ratio is 0, we use the original image proportions
|
|
200
|
-
var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number" && ratio !== 0;
|
|
201
222
|
var classes = useStyles({
|
|
202
223
|
noBorderRadius: noBorderSetting,
|
|
203
|
-
|
|
204
|
-
width: props.width,
|
|
205
|
-
isError: isError
|
|
224
|
+
ratio: ratio
|
|
206
225
|
});
|
|
207
|
-
var
|
|
208
|
-
var
|
|
209
|
-
if (props.width !== undefined && props.height !== undefined) {
|
|
210
|
-
width = props.width;
|
|
211
|
-
height = props.height;
|
|
212
|
-
} else if (typeof props.width === "number") {
|
|
213
|
-
height = ratio ? props.width / ratio : undefined;
|
|
214
|
-
} else if (typeof props.height === "number") {
|
|
215
|
-
width = ratio ? props.height * ratio : undefined;
|
|
216
|
-
} else {
|
|
217
|
-
width = props.width || "100%";
|
|
218
|
-
}
|
|
219
|
-
var needsWrapper = withCssAspectRatio && !supportsAspectRatio;
|
|
226
|
+
var withLoadingFallback = loadingFallback && !!(ratio !== 0 || props.width && props.height);
|
|
227
|
+
var withErrorFallback = errorFallback && !!(ratio !== 0 || props.width && props.height);
|
|
220
228
|
var img = // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/309
|
|
221
229
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
222
230
|
/*#__PURE__*/ _jsx("img", _objectSpread({}, getPrefixedDataAttributes(dataAttributes), {
|
|
231
|
+
style: _objectSpread({}, isLoading && withLoadingFallback ? {
|
|
232
|
+
opacity: 0
|
|
233
|
+
} : {
|
|
234
|
+
opacity: 1
|
|
235
|
+
}),
|
|
223
236
|
ref: ref,
|
|
224
237
|
src: src,
|
|
225
238
|
className: classes.image,
|
|
226
239
|
alt: alt,
|
|
227
240
|
onError: function(event) {
|
|
228
241
|
setIsError(true);
|
|
242
|
+
setIsLoading(false);
|
|
243
|
+
setHideLoadingFallback(true);
|
|
229
244
|
onError === null || onError === void 0 ? void 0 : onError(event);
|
|
230
245
|
},
|
|
231
246
|
onLoad: function(event) {
|
|
232
247
|
setIsError(false);
|
|
248
|
+
setIsLoading(false);
|
|
249
|
+
setTimeout(function() {
|
|
250
|
+
setHideLoadingFallback(true);
|
|
251
|
+
}, FADE_IN_DURATION_MS);
|
|
233
252
|
onLoad === null || onLoad === void 0 ? void 0 : onLoad(event);
|
|
234
253
|
}
|
|
235
|
-
}, needsWrapper ? {
|
|
236
|
-
width: "100%"
|
|
237
|
-
} : {
|
|
238
|
-
width: width,
|
|
239
|
-
height: height
|
|
240
254
|
}));
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
255
|
+
return /*#__PURE__*/ _jsxs(AspectRatioElement, {
|
|
256
|
+
style: {
|
|
257
|
+
position: "relative"
|
|
258
|
+
},
|
|
259
|
+
aspectRatio: ratio,
|
|
260
|
+
width: props.width,
|
|
261
|
+
height: props.height,
|
|
262
|
+
children: [
|
|
263
|
+
withLoadingFallback && !hideLoadingFallback && /*#__PURE__*/ _jsx("div", {
|
|
264
|
+
style: {
|
|
265
|
+
position: "absolute",
|
|
266
|
+
width: "100%",
|
|
267
|
+
height: "100%"
|
|
268
|
+
},
|
|
269
|
+
children: /*#__PURE__*/ _jsx(SkeletonRectangle, {
|
|
270
|
+
width: props.width,
|
|
271
|
+
height: props.height
|
|
272
|
+
})
|
|
273
|
+
}),
|
|
274
|
+
isError && withErrorFallback && /*#__PURE__*/ _jsx("div", {
|
|
275
|
+
style: {
|
|
276
|
+
position: "absolute",
|
|
277
|
+
width: "100%",
|
|
278
|
+
height: "100%"
|
|
279
|
+
},
|
|
280
|
+
children: /*#__PURE__*/ _jsx(ImageError, {})
|
|
281
|
+
}),
|
|
282
|
+
!isError && img
|
|
283
|
+
]
|
|
284
|
+
});
|
|
253
285
|
});
|
|
254
286
|
export default Image;
|
package/dist-es/index.js
CHANGED
|
@@ -1600,6 +1600,9 @@ export { default as IconTipsAndTricksRegular } from "./generated/mistica-icons/i
|
|
|
1600
1600
|
export { default as IconTkFilled } from "./generated/mistica-icons/icon-tk-filled";
|
|
1601
1601
|
export { default as IconTkLight } from "./generated/mistica-icons/icon-tk-light";
|
|
1602
1602
|
export { default as IconTkRegular } from "./generated/mistica-icons/icon-tk-regular";
|
|
1603
|
+
export { default as IconTokensFilled } from "./generated/mistica-icons/icon-tokens-filled";
|
|
1604
|
+
export { default as IconTokensLight } from "./generated/mistica-icons/icon-tokens-light";
|
|
1605
|
+
export { default as IconTokensRegular } from "./generated/mistica-icons/icon-tokens-regular";
|
|
1603
1606
|
export { default as IconTongueFilled } from "./generated/mistica-icons/icon-tongue-filled";
|
|
1604
1607
|
export { default as IconTongueLight } from "./generated/mistica-icons/icon-tongue-light";
|
|
1605
1608
|
export { default as IconTongueRegular } from "./generated/mistica-icons/icon-tongue-regular";
|
package/dist-es/list.js
CHANGED
|
@@ -536,7 +536,9 @@ export var Row = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
536
536
|
}));
|
|
537
537
|
});
|
|
538
538
|
export var RowList = function(param) {
|
|
539
|
-
var children = param.children, ariaLabelledby = param.ariaLabelledby, role = param.role, dataAttributes = param.dataAttributes;
|
|
539
|
+
var children = param.children, ariaLabelledby = param.ariaLabelledby, role = param.role, dataAttributes = param.dataAttributes, noLastDivider = param.noLastDivider;
|
|
540
|
+
var lastIndex = React.Children.count(children) - 1;
|
|
541
|
+
var showLastDivider = !noLastDivider;
|
|
540
542
|
return /*#__PURE__*/ _jsx("div", _objectSpread({
|
|
541
543
|
role: role,
|
|
542
544
|
"aria-labelledby": ariaLabelledby
|
|
@@ -545,7 +547,7 @@ export var RowList = function(param) {
|
|
|
545
547
|
return /*#__PURE__*/ _jsxs(React.Fragment, {
|
|
546
548
|
children: [
|
|
547
549
|
child,
|
|
548
|
-
/*#__PURE__*/ _jsx(Box, {
|
|
550
|
+
(index < lastIndex || showLastDivider) && /*#__PURE__*/ _jsx(Box, {
|
|
549
551
|
paddingX: 16,
|
|
550
552
|
children: /*#__PURE__*/ _jsx(Divider, {})
|
|
551
553
|
})
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// DO NOT EDIT THIS FILE. It's autogenerated by set-version.js
|
|
2
|
-
export var PACKAGE_VERSION = "12.
|
|
2
|
+
export var PACKAGE_VERSION = "12.8.0";
|
package/dist-es/skeletons.js
CHANGED
|
@@ -32,12 +32,13 @@ import * as React from "react";
|
|
|
32
32
|
import SkeletonBase from "./skeleton-base";
|
|
33
33
|
import { createUseStyles } from "./jss";
|
|
34
34
|
import Stack from "./stack";
|
|
35
|
-
import classNames from "classnames";
|
|
36
35
|
import { getPrefixedDataAttributes } from "./utils/dom";
|
|
37
36
|
var transition = "1.5s linear";
|
|
38
37
|
var useAnimation = createUseStyles(function() {
|
|
39
38
|
return {
|
|
40
39
|
animation: {
|
|
40
|
+
width: "100%",
|
|
41
|
+
height: "100%",
|
|
41
42
|
animation: "$pulse ".concat(transition, " infinite")
|
|
42
43
|
},
|
|
43
44
|
"@keyframes pulse": {
|
|
@@ -53,73 +54,50 @@ var useAnimation = createUseStyles(function() {
|
|
|
53
54
|
}
|
|
54
55
|
};
|
|
55
56
|
});
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
wrap: {
|
|
59
|
-
borderRadius: 8,
|
|
60
|
-
height: function(param) {
|
|
61
|
-
var _height = param.height, height = _height === void 0 ? 8 : _height;
|
|
62
|
-
return height;
|
|
63
|
-
},
|
|
64
|
-
width: function(param) {
|
|
65
|
-
var _width = param.width, width = _width === void 0 ? "100%" : _width;
|
|
66
|
-
return width;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
});
|
|
71
|
-
export var SkeletonLine = function(param) {
|
|
72
|
-
var _width = param.width, width = _width === void 0 ? "100%" : _width, ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
|
|
57
|
+
var SkeletonAnimation = function(param) {
|
|
58
|
+
var children = param.children, ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
|
|
73
59
|
var animationClasses = useAnimation();
|
|
74
|
-
var styleClass = useSkeletonStyles({
|
|
75
|
-
width: width
|
|
76
|
-
});
|
|
77
60
|
return /*#__PURE__*/ _jsx("div", _objectSpread({
|
|
78
|
-
className:
|
|
61
|
+
className: animationClasses.animation,
|
|
79
62
|
role: "status",
|
|
63
|
+
"aria-busy": true,
|
|
80
64
|
"aria-hidden": ariaLabel === undefined,
|
|
81
|
-
"aria-busy": ariaLabel !== undefined,
|
|
82
65
|
"aria-label": ariaLabel
|
|
83
66
|
}, getPrefixedDataAttributes(dataAttributes), {
|
|
84
|
-
children:
|
|
67
|
+
children: children
|
|
68
|
+
}));
|
|
69
|
+
};
|
|
70
|
+
export var SkeletonLine = function(param) {
|
|
71
|
+
var _width = param.width, width = _width === void 0 ? "100%" : _width, ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
|
|
72
|
+
return /*#__PURE__*/ _jsx(SkeletonAnimation, _objectSpread({
|
|
73
|
+
ariaLabel: ariaLabel
|
|
74
|
+
}, getPrefixedDataAttributes(dataAttributes), {
|
|
75
|
+
children: /*#__PURE__*/ _jsx(SkeletonBase, {
|
|
76
|
+
width: width
|
|
77
|
+
})
|
|
85
78
|
}));
|
|
86
79
|
};
|
|
87
80
|
export var SkeletonText = function(param) {
|
|
88
81
|
var ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
height: "fit-content"
|
|
92
|
-
});
|
|
93
|
-
return /*#__PURE__*/ _jsxs(Stack, _objectSpread({
|
|
94
|
-
className: "".concat(animationClasses.animation, " ").concat(styleClass.wrap),
|
|
95
|
-
space: 16,
|
|
96
|
-
role: "status",
|
|
97
|
-
"aria-hidden": ariaLabel === undefined,
|
|
98
|
-
"aria-busy": ariaLabel !== undefined,
|
|
99
|
-
"aria-label": ariaLabel
|
|
82
|
+
return /*#__PURE__*/ _jsx(SkeletonAnimation, _objectSpread({
|
|
83
|
+
ariaLabel: ariaLabel
|
|
100
84
|
}, getPrefixedDataAttributes(dataAttributes), {
|
|
101
|
-
children:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
85
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
86
|
+
space: 16,
|
|
87
|
+
children: [
|
|
88
|
+
/*#__PURE__*/ _jsx(SkeletonBase, {}),
|
|
89
|
+
/*#__PURE__*/ _jsx(SkeletonBase, {}),
|
|
90
|
+
/*#__PURE__*/ _jsx(SkeletonBase, {
|
|
91
|
+
width: "75%"
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
})
|
|
108
95
|
}));
|
|
109
96
|
};
|
|
110
97
|
export var SkeletonCircle = function(param) {
|
|
111
98
|
var ariaLabel = param.ariaLabel, _size = param.size, size = _size === void 0 ? 40 : _size, dataAttributes = param.dataAttributes;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
width: size,
|
|
115
|
-
height: size
|
|
116
|
-
});
|
|
117
|
-
return /*#__PURE__*/ _jsx("div", _objectSpread({
|
|
118
|
-
className: classNames(animationClasses.animation, styleClass.wrap),
|
|
119
|
-
role: "status",
|
|
120
|
-
"aria-hidden": ariaLabel === undefined,
|
|
121
|
-
"aria-busy": ariaLabel !== undefined,
|
|
122
|
-
"aria-label": ariaLabel
|
|
99
|
+
return /*#__PURE__*/ _jsx(SkeletonAnimation, _objectSpread({
|
|
100
|
+
ariaLabel: ariaLabel
|
|
123
101
|
}, getPrefixedDataAttributes(dataAttributes), {
|
|
124
102
|
children: /*#__PURE__*/ _jsx(SkeletonBase, {
|
|
125
103
|
height: size,
|
|
@@ -147,46 +125,31 @@ var useSkeletonRowStyles = createUseStyles(function() {
|
|
|
147
125
|
});
|
|
148
126
|
export var SkeletonRow = function(param) {
|
|
149
127
|
var _width = param.width, width = _width === void 0 ? "100%" : _width, ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
|
|
150
|
-
var animationClasses = useAnimation();
|
|
151
|
-
var styleClass = useSkeletonStyles({
|
|
152
|
-
width: width,
|
|
153
|
-
height: "100%"
|
|
154
|
-
});
|
|
155
128
|
var rowClass = useSkeletonRowStyles();
|
|
156
|
-
return /*#__PURE__*/
|
|
157
|
-
|
|
158
|
-
role: "status",
|
|
159
|
-
"aria-hidden": ariaLabel === undefined,
|
|
160
|
-
"aria-busy": ariaLabel !== undefined,
|
|
161
|
-
"aria-label": ariaLabel
|
|
129
|
+
return /*#__PURE__*/ _jsx(SkeletonAnimation, _objectSpread({
|
|
130
|
+
ariaLabel: ariaLabel
|
|
162
131
|
}, getPrefixedDataAttributes(dataAttributes), {
|
|
163
|
-
children:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
132
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
133
|
+
className: rowClass.row,
|
|
134
|
+
children: [
|
|
135
|
+
/*#__PURE__*/ _jsx(SkeletonBase, {
|
|
136
|
+
height: 40,
|
|
137
|
+
width: 40,
|
|
138
|
+
radius: "50%",
|
|
139
|
+
className: rowClass.circle
|
|
140
|
+
}),
|
|
141
|
+
/*#__PURE__*/ _jsx(SkeletonBase, {
|
|
142
|
+
width: width,
|
|
143
|
+
className: rowClass.line
|
|
144
|
+
})
|
|
145
|
+
]
|
|
146
|
+
})
|
|
175
147
|
}));
|
|
176
148
|
};
|
|
177
149
|
export var SkeletonRectangle = function(param) {
|
|
178
150
|
var _width = param.width, width = _width === void 0 ? "100%" : _width, _height = param.height, height = _height === void 0 ? "100%" : _height, ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
width: width,
|
|
182
|
-
height: "100%"
|
|
183
|
-
});
|
|
184
|
-
return /*#__PURE__*/ _jsx("div", _objectSpread({
|
|
185
|
-
className: classNames(animationClasses.animation, styleClass.wrap),
|
|
186
|
-
role: "status",
|
|
187
|
-
"aria-hidden": true,
|
|
188
|
-
"aria-busy": true,
|
|
189
|
-
"aria-label": ariaLabel
|
|
151
|
+
return /*#__PURE__*/ _jsx(SkeletonAnimation, _objectSpread({
|
|
152
|
+
ariaLabel: ariaLabel
|
|
190
153
|
}, getPrefixedDataAttributes(dataAttributes), {
|
|
191
154
|
children: /*#__PURE__*/ _jsx(SkeletonBase, {
|
|
192
155
|
height: height,
|
package/dist-es/skins/o2.js
CHANGED
|
@@ -69,7 +69,7 @@ export var getO2Skin = function() {
|
|
|
69
69
|
buttonDangerBackground: palette.pepper,
|
|
70
70
|
buttonDangerBackgroundSelected: palette.pepper60,
|
|
71
71
|
buttonDangerBackgroundHover: palette.pepper60,
|
|
72
|
-
buttonLinkBackgroundSelected: palette.
|
|
72
|
+
buttonLinkBackgroundSelected: palette.o2BluePrimary10,
|
|
73
73
|
buttonLinkBackgroundSelectedInverse: applyAlpha(palette.white, 0.2),
|
|
74
74
|
buttonPrimaryBackground: palette.o2BluePrimary,
|
|
75
75
|
buttonPrimaryBackgroundInverse: palette.white,
|
|
@@ -173,6 +173,7 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
173
173
|
},
|
|
174
174
|
textArea: _objectSpread((_obj = {
|
|
175
175
|
resize: "none",
|
|
176
|
+
padding: 0,
|
|
176
177
|
marginTop: function(param) {
|
|
177
178
|
var hasLabel = param.hasLabel;
|
|
178
179
|
return hasLabel ? 28 : 16;
|
|
@@ -409,6 +410,7 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
409
410
|
multiline: multiline,
|
|
410
411
|
fullWidth: fullWidth,
|
|
411
412
|
fieldRef: fieldRef,
|
|
413
|
+
readOnly: rest.readOnly,
|
|
412
414
|
children: [
|
|
413
415
|
startIcon && /*#__PURE__*/ _jsx("div", {
|
|
414
416
|
className: classes.startIcon,
|
|
@@ -260,15 +260,19 @@ var useFieldContainerStyles = createUseStyles(function(theme) {
|
|
|
260
260
|
var multiline = param.multiline;
|
|
261
261
|
return multiline ? 152 : 56;
|
|
262
262
|
}
|
|
263
|
-
}), _defineProperty(_obj1, "display", "flex"), _defineProperty(_obj1, "position", "relative"), _defineProperty(_obj1, "backgroundColor",
|
|
263
|
+
}), _defineProperty(_obj1, "display", "flex"), _defineProperty(_obj1, "position", "relative"), _defineProperty(_obj1, "backgroundColor", function(param) {
|
|
264
|
+
var readOnly = param.readOnly;
|
|
265
|
+
return readOnly ? theme.colors.neutralLow : theme.colors.backgroundContainer;
|
|
266
|
+
}), _obj1)
|
|
264
267
|
};
|
|
265
268
|
});
|
|
266
269
|
export var FieldContainer = function(param) {
|
|
267
|
-
var multiline = param.multiline, disabled = param.disabled, children = param.children, helperText = param.helperText, className = param.className, fieldRef = param.fieldRef, fullWidth = param.fullWidth;
|
|
270
|
+
var multiline = param.multiline, disabled = param.disabled, children = param.children, helperText = param.helperText, className = param.className, fieldRef = param.fieldRef, fullWidth = param.fullWidth, readOnly = param.readOnly;
|
|
268
271
|
var classes = useFieldContainerStyles({
|
|
269
272
|
multiline: multiline,
|
|
270
273
|
fullWidth: fullWidth,
|
|
271
|
-
disabled: disabled
|
|
274
|
+
disabled: disabled,
|
|
275
|
+
readOnly: readOnly
|
|
272
276
|
});
|
|
273
277
|
return /*#__PURE__*/ _jsxs("div", {
|
|
274
278
|
className: classes.fieldContainer,
|