@telefonica/mistica 10.15.0 → 10.19.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 +36 -0
- package/dist/card.d.ts +10 -1
- package/dist/card.js +4 -1
- package/dist/card.js.flow +16 -1
- 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 +2 -2
- 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/icons/icon-success.js +14 -6
- package/dist/image.d.ts +25 -4
- package/dist/image.js +67 -9
- package/dist/image.js.flow +33 -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/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/search-field.js +2 -2
- package/dist/section-title.d.ts +1 -3
- package/dist/section-title.js.flow +1 -2
- package/dist/select.js +2 -2
- package/dist/text-field-base.d.ts +3 -2
- package/dist/text-field-base.js +12 -16
- package/dist/text-field-base.js.flow +6 -2
- 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/video.d.ts +32 -0
- package/dist/video.js +161 -0
- package/dist/video.js.flow +50 -0
- package/dist-es/card.js +4 -1
- 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 +2 -2
- 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/icons/icon-success.js +14 -6
- package/dist-es/image.js +41 -8
- package/dist-es/index.js +3 -1
- package/dist-es/integer-field.js +2 -2
- 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/search-field.js +2 -2
- package/dist-es/select.js +2 -2
- package/dist-es/text-field-base.js +12 -15
- package/dist-es/text-field.js +9 -12
- package/dist-es/video.js +123 -0
- package/package.json +1 -1
package/dist-es/menu.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ESC, TAB } from './utils/key-codes';
|
|
4
|
-
import Overlay from './overlay';
|
|
5
4
|
import { createUseStyles } from './jss';
|
|
6
5
|
import { cancelEvent } from './utils/dom';
|
|
6
|
+
import Overlay from './overlay';
|
|
7
7
|
function _arrayWithHoles(arr) {
|
|
8
8
|
if (Array.isArray(arr)) return arr;
|
|
9
9
|
}
|
|
@@ -69,6 +69,7 @@ var useStyles = createUseStyles(function(param) {
|
|
|
69
69
|
var colors = param.colors;
|
|
70
70
|
return {
|
|
71
71
|
menuContainer: {
|
|
72
|
+
zIndex: 12,
|
|
72
73
|
margin: 0,
|
|
73
74
|
padding: 0,
|
|
74
75
|
listStyleType: 'none',
|
|
@@ -77,13 +78,17 @@ var useStyles = createUseStyles(function(param) {
|
|
|
77
78
|
var itemsComputedProps = param.itemsComputedProps;
|
|
78
79
|
return itemsComputedProps.top;
|
|
79
80
|
},
|
|
80
|
-
|
|
81
|
+
bottom: function(param) {
|
|
82
|
+
var itemsComputedProps = param.itemsComputedProps;
|
|
83
|
+
return itemsComputedProps.bottom;
|
|
84
|
+
},
|
|
85
|
+
right: function(param) {
|
|
81
86
|
var itemsComputedProps = param.itemsComputedProps;
|
|
82
|
-
return itemsComputedProps.
|
|
87
|
+
return itemsComputedProps.right;
|
|
83
88
|
},
|
|
84
89
|
width: function(param) {
|
|
85
|
-
var
|
|
86
|
-
return width !== null && width !== void 0 ? width :
|
|
90
|
+
var width = param.width;
|
|
91
|
+
return width !== null && width !== void 0 ? width : '100%';
|
|
87
92
|
},
|
|
88
93
|
borderRadius: 4,
|
|
89
94
|
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)',
|
|
@@ -124,28 +129,27 @@ var Menu = function(param) {
|
|
|
124
129
|
return;
|
|
125
130
|
}
|
|
126
131
|
var MARGIN_THRESHOLD = 12;
|
|
127
|
-
var topTarget = targetRect.top, widthTarget = targetRect.width,
|
|
132
|
+
var topTarget = targetRect.top, widthTarget = targetRect.width, height = targetRect.height;
|
|
128
133
|
var top = topTarget + height;
|
|
129
134
|
var ref;
|
|
130
135
|
var spaceTaken = (ref = parseInt(window.getComputedStyle(menu).getPropertyValue('height'))) !== null && ref !== void 0 ? ref : 0;
|
|
131
|
-
var
|
|
136
|
+
var rightDirection = position === 'left' ? 'auto' : "calc(100% - ".concat(widthTarget, "px)");
|
|
132
137
|
// if it doesn't fit on bottom
|
|
133
138
|
if (top + spaceTaken + MARGIN_THRESHOLD > window.innerHeight) {
|
|
134
139
|
var availableSpaceBottom = window.innerHeight - top;
|
|
135
140
|
if (topTarget /* this is the available space on top */ > availableSpaceBottom) {
|
|
136
|
-
var newTop = topTarget - spaceTaken;
|
|
137
141
|
setItemsComputedProps({
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
top:
|
|
141
|
-
maxHeight: topTarget
|
|
142
|
+
right: rightDirection,
|
|
143
|
+
bottom: '100%',
|
|
144
|
+
top: 'auto',
|
|
145
|
+
maxHeight: Math.min(topTarget, MAX_HEIGHT_DEFAULT),
|
|
142
146
|
transformOrigin: 'center bottom'
|
|
143
147
|
});
|
|
144
148
|
} else {
|
|
145
149
|
setItemsComputedProps({
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
150
|
+
top: '100%',
|
|
151
|
+
bottom: 'auto',
|
|
152
|
+
right: rightDirection,
|
|
149
153
|
maxHeight: Math.min(window.innerHeight - top - MARGIN_THRESHOLD, MAX_HEIGHT_DEFAULT),
|
|
150
154
|
transformOrigin: 'center top'
|
|
151
155
|
});
|
|
@@ -153,9 +157,9 @@ var Menu = function(param) {
|
|
|
153
157
|
} else {
|
|
154
158
|
// if it fits on bottom
|
|
155
159
|
setItemsComputedProps({
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
160
|
+
top: '100%',
|
|
161
|
+
bottom: 'auto',
|
|
162
|
+
right: rightDirection,
|
|
159
163
|
maxHeight: Math.min(window.innerHeight - top - MARGIN_THRESHOLD, MAX_HEIGHT_DEFAULT),
|
|
160
164
|
transformOrigin: 'center top'
|
|
161
165
|
});
|
|
@@ -223,20 +227,23 @@ var Menu = function(param) {
|
|
|
223
227
|
document.removeEventListener('keydown', handleKeyDown, false);
|
|
224
228
|
};
|
|
225
229
|
});
|
|
226
|
-
return(/*#__PURE__*/ _jsxs(
|
|
230
|
+
return(/*#__PURE__*/ _jsxs("div", {
|
|
231
|
+
style: {
|
|
232
|
+
position: 'relative'
|
|
233
|
+
},
|
|
227
234
|
children: [
|
|
228
|
-
renderTarget(_objectSpread({
|
|
229
|
-
}, targetProps, {
|
|
230
|
-
isMenuOpen: isMenuOpen
|
|
231
|
-
})),
|
|
232
235
|
isMenuOpen ? /*#__PURE__*/ _jsx(Overlay, {
|
|
233
236
|
onPress: function(e) {
|
|
234
|
-
setIsMenuOpen(false);
|
|
235
237
|
cancelEvent(e);
|
|
238
|
+
setIsMenuOpen(false);
|
|
236
239
|
},
|
|
237
|
-
disableScroll: true
|
|
238
|
-
|
|
239
|
-
|
|
240
|
+
disableScroll: true
|
|
241
|
+
}) : null,
|
|
242
|
+
renderTarget(_objectSpread({
|
|
243
|
+
}, targetProps, {
|
|
244
|
+
isMenuOpen: isMenuOpen
|
|
245
|
+
})),
|
|
246
|
+
isMenuOpen ? renderMenu(menuProps) : null
|
|
240
247
|
]
|
|
241
248
|
}));
|
|
242
249
|
};
|
package/dist-es/month-field.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useFieldProps } from './form-context';
|
|
4
|
-
import
|
|
4
|
+
import { TextFieldBaseAutosuggest } from './text-field-base';
|
|
5
5
|
import { isInputTypeSupported } from './utils/dom';
|
|
6
6
|
import { isServerSide } from './utils/environment';
|
|
7
7
|
import IconCalendarRegular from './generated/mistica-icons/icon-calendar-regular';
|
|
@@ -113,7 +113,7 @@ var DateField = function(_param) {
|
|
|
113
113
|
onChange: onChange,
|
|
114
114
|
onChangeValue: onChangeValue
|
|
115
115
|
});
|
|
116
|
-
var nativePicker = /*#__PURE__*/ _jsx(
|
|
116
|
+
var nativePicker = /*#__PURE__*/ _jsx(TextFieldBaseAutosuggest, _objectSpread({
|
|
117
117
|
}, rest, fieldProps, {
|
|
118
118
|
min: min ? getLocalYearMonthString(min) : undefined,
|
|
119
119
|
max: max ? getLocalYearMonthString(max) : undefined,
|
|
@@ -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.19.0';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useFieldProps } from './form-context';
|
|
4
|
-
import
|
|
4
|
+
import { TextFieldBaseAutosuggest } from './text-field-base';
|
|
5
5
|
import { useTheme } from './hooks';
|
|
6
6
|
import IconButton from './icon-button';
|
|
7
7
|
import Visibility from './icons/icon-visibility';
|
|
@@ -174,7 +174,7 @@ var PasswordField = function(_param) {
|
|
|
174
174
|
onChange: onChange,
|
|
175
175
|
onChangeValue: onChangeValue
|
|
176
176
|
});
|
|
177
|
-
return(/*#__PURE__*/ _jsx(
|
|
177
|
+
return(/*#__PURE__*/ _jsx(TextFieldBaseAutosuggest, _objectSpread({
|
|
178
178
|
}, rest, fieldProps, {
|
|
179
179
|
type: isVisible ? 'text' : 'password',
|
|
180
180
|
inputRef: function(field) {
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { useRifm } from 'rifm';
|
|
4
4
|
import { formatAsYouType, formatToE164, parse, getRegionCodeForCountryCode } from '@telefonica/libphonenumber';
|
|
5
5
|
import { useFieldProps } from './form-context';
|
|
6
|
-
import
|
|
6
|
+
import { TextFieldBaseAutosuggest } from './text-field-base';
|
|
7
7
|
import { useTheme } from './hooks';
|
|
8
8
|
import { createChangeEvent } from './utils/dom';
|
|
9
9
|
import { combineRefs } from './utils/common';
|
|
@@ -199,7 +199,7 @@ var PhoneNumberField = function(_param) {
|
|
|
199
199
|
onChange: onChange,
|
|
200
200
|
onChangeValue: onChangeValue
|
|
201
201
|
});
|
|
202
|
-
return(/*#__PURE__*/ _jsx(
|
|
202
|
+
return(/*#__PURE__*/ _jsx(TextFieldBaseAutosuggest, _objectSpread({
|
|
203
203
|
}, rest, fieldProps, {
|
|
204
204
|
type: "phone",
|
|
205
205
|
inputProps: {
|
package/dist-es/search-field.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useFieldProps } from './form-context';
|
|
4
|
-
import
|
|
4
|
+
import { TextFieldBaseAutosuggest } from './text-field-base';
|
|
5
5
|
import IconSearch from './icons/icon-search';
|
|
6
6
|
import IconCloseRegular from './generated/mistica-icons/icon-close-regular';
|
|
7
7
|
import IconButton from './icon-button';
|
|
@@ -139,7 +139,7 @@ var SearchField = function(_param) {
|
|
|
139
139
|
onChange: onChange,
|
|
140
140
|
onChangeValue: handleChangeValue
|
|
141
141
|
});
|
|
142
|
-
return(/*#__PURE__*/ _jsx(
|
|
142
|
+
return(/*#__PURE__*/ _jsx(TextFieldBaseAutosuggest, _objectSpread({
|
|
143
143
|
ref: inputRef,
|
|
144
144
|
startIcon: /*#__PURE__*/ _jsx(IconSearch, {
|
|
145
145
|
}),
|
package/dist-es/select.js
CHANGED
|
@@ -5,7 +5,7 @@ import { useAriaId, useTheme } from './hooks';
|
|
|
5
5
|
import { DOWN, ENTER, ESC, SPACE, TAB, UP } from './utils/key-codes';
|
|
6
6
|
import { FieldContainer, HelperText, Label } from './text-field-components';
|
|
7
7
|
import ChevronDownRegular from './generated/mistica-icons/icon-chevron-down-regular';
|
|
8
|
-
import
|
|
8
|
+
import { TextFieldBaseAutosuggest } from './text-field-base';
|
|
9
9
|
import Overlay from './overlay';
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import { isAndroid, isIos } from './utils/platform';
|
|
@@ -515,7 +515,7 @@ var Select = function(param) {
|
|
|
515
515
|
ref: focusableRef
|
|
516
516
|
}, !disabled && containerActiveProps, {
|
|
517
517
|
children: [
|
|
518
|
-
/*#__PURE__*/ _jsx(
|
|
518
|
+
/*#__PURE__*/ _jsx(TextFieldBaseAutosuggest, {
|
|
519
519
|
style: {
|
|
520
520
|
visibility: 'hidden'
|
|
521
521
|
},
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { createUseStyles } from './jss';
|
|
4
4
|
import { Label, HelperText, FieldContainer, LABEL_LEFT_POSITION, LABEL_SCALE_MOBILE, LABEL_SCALE_DESKTOP } from './text-field-components';
|
|
5
5
|
import { Text3 } from './text';
|
|
6
|
-
import { isIos, isRunningAcceptanceTest,
|
|
6
|
+
import { isIos, isRunningAcceptanceTest, isFirefox } from './utils/platform';
|
|
7
7
|
import { useAriaId, useTheme, useScreenSize } from './hooks';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import { combineRefs } from './utils/common';
|
|
@@ -281,16 +281,12 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
281
281
|
}), _defineProperty(_obj2, "transition", 'opacity 150ms cubic-bezier(0.0, 0, 0.2, 1) 0ms'), _obj2)
|
|
282
282
|
};
|
|
283
283
|
});
|
|
284
|
-
|
|
285
|
-
var fixAutoComplete = function(platformOverrides, autoComplete) {
|
|
286
|
-
return autoComplete === 'off' && isChrome(platformOverrides) ? 'nope' : autoComplete;
|
|
287
|
-
};
|
|
288
|
-
var TextFieldBaseComponent = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
284
|
+
var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
289
285
|
var error = _param.error, helperText = _param.helperText, label = _param.label, inputProps = _param.inputProps, inputRef = _param.inputRef, defaultValue = _param.defaultValue, value = _param.value, onFocus = _param.onFocus, onBlur = _param.onBlur, inputComponent = _param.inputComponent, prefix = _param.prefix, startIcon = _param.startIcon, endIcon = _param.endIcon, endIconOverlay = _param.endIconOverlay, shrinkLabelProp = _param.shrinkLabel, _multiline = _param.multiline, multiline = _multiline === void 0 ? false : _multiline, focus = _param.focus, fieldRef = _param.fieldRef, maxLength = _param.maxLength, idProp = _param.id, autoCompleteProp = _param.autoComplete, fullWidth = _param.fullWidth, rest = _objectWithoutProperties(_param, ["error", "helperText", "label", "inputProps", "inputRef", "defaultValue", "value", "onFocus", "onBlur", "inputComponent", "prefix", "startIcon", "endIcon", "endIconOverlay", "shrinkLabel", "multiline", "focus", "fieldRef", "maxLength", "id",
|
|
290
286
|
"autoComplete", "fullWidth"]);
|
|
291
287
|
var id = useAriaId(idProp);
|
|
292
288
|
var ref1 = _slicedToArray(React.useState((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.length) || (value === null || value === void 0 ? void 0 : value.length) ? 'filled' : 'default'), 2), inputState = ref1[0], setInputState = ref1[1];
|
|
293
|
-
var ref2 = useTheme(),
|
|
289
|
+
var ref2 = useTheme(), colors = ref2.colors;
|
|
294
290
|
var ref3 = useScreenSize(), isTabletOrSmaller = ref3.isTabletOrSmaller;
|
|
295
291
|
var ref4;
|
|
296
292
|
var ref5 = _slicedToArray(React.useState((ref4 = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.length) !== null && ref4 !== void 0 ? ref4 : 0), 2), characterCount = ref5[0], setCharacterCount = ref5[1];
|
|
@@ -347,7 +343,7 @@ var TextFieldBaseComponent = /*#__PURE__*/ React.forwardRef(function(_param, ref
|
|
|
347
343
|
var props = _objectSpread({
|
|
348
344
|
}, rest, {
|
|
349
345
|
maxLength: maxLength,
|
|
350
|
-
autoComplete:
|
|
346
|
+
autoComplete: autoCompleteProp
|
|
351
347
|
}, inputProps);
|
|
352
348
|
var isShrinked = shrinkLabel || inputState === 'focused' || inputState === 'filled';
|
|
353
349
|
var scale = isShrinked ? isTabletOrSmaller ? LABEL_SCALE_MOBILE : LABEL_SCALE_DESKTOP : 1;
|
|
@@ -437,6 +433,7 @@ var TextFieldBaseComponent = /*#__PURE__*/ React.forwardRef(function(_param, ref
|
|
|
437
433
|
]
|
|
438
434
|
}));
|
|
439
435
|
});
|
|
436
|
+
export { TextFieldBase };
|
|
440
437
|
var useSuggestionsStyles = createUseStyles(function() {
|
|
441
438
|
return {
|
|
442
439
|
menuItem: {
|
|
@@ -469,7 +466,7 @@ var useSuggestionsStyles = createUseStyles(function() {
|
|
|
469
466
|
var Autosuggest = /*#__PURE__*/ React.lazy(function() {
|
|
470
467
|
return import(/* webpackChunkName: "react-autosuggest" */ 'react-autosuggest');
|
|
471
468
|
});
|
|
472
|
-
var
|
|
469
|
+
var TextFieldBaseAutosuggest = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
473
470
|
var getSuggestions = _param.getSuggestions, idProp = _param.id, props = _objectWithoutProperties(_param, ["getSuggestions", "id"
|
|
474
471
|
]);
|
|
475
472
|
var ref1 = _slicedToArray(React.useState([]), 2), suggestions = ref1[0], setSuggestions = ref1[1];
|
|
@@ -482,13 +479,13 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
482
479
|
throw Error('Fields with suggestions must be used in controlled mode');
|
|
483
480
|
}
|
|
484
481
|
return getSuggestions ? /*#__PURE__*/ _jsx(React.Suspense, {
|
|
485
|
-
fallback: /*#__PURE__*/ _jsx(
|
|
482
|
+
fallback: /*#__PURE__*/ _jsx(TextFieldBase, _objectSpread({
|
|
486
483
|
}, props, {
|
|
487
484
|
// This label override while loading is needed in acceptance tests because
|
|
488
485
|
// while the test is typing, the component could be remounted.
|
|
489
486
|
// By hiding the label, we ensure that the test selects the loaded component
|
|
490
487
|
label: isRunningAcceptanceTest(platformOverrides) ? '' : props.label,
|
|
491
|
-
autoComplete:
|
|
488
|
+
autoComplete: "off",
|
|
492
489
|
ref: ref,
|
|
493
490
|
id: id
|
|
494
491
|
})),
|
|
@@ -497,7 +494,7 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
497
494
|
inputProps: _objectSpread({
|
|
498
495
|
}, props, {
|
|
499
496
|
id: id,
|
|
500
|
-
autoComplete:
|
|
497
|
+
autoComplete: 'off',
|
|
501
498
|
// @ts-expect-error Autosuggest expects slightly different types
|
|
502
499
|
onChange: function(e, param) {
|
|
503
500
|
var newValue = param.newValue;
|
|
@@ -515,7 +512,7 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
515
512
|
}
|
|
516
513
|
}),
|
|
517
514
|
renderInputComponent: function(inputProps) {
|
|
518
|
-
/*#__PURE__*/ return _jsx(
|
|
515
|
+
/*#__PURE__*/ return _jsx(TextFieldBase, _objectSpread({
|
|
519
516
|
}, inputProps, {
|
|
520
517
|
inputRef: combineRefs(inputRef, props.inputRef, ref)
|
|
521
518
|
}));
|
|
@@ -555,10 +552,10 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
555
552
|
}));
|
|
556
553
|
}
|
|
557
554
|
})
|
|
558
|
-
}) : /*#__PURE__*/ _jsx(
|
|
555
|
+
}) : /*#__PURE__*/ _jsx(TextFieldBase, _objectSpread({
|
|
559
556
|
}, props, {
|
|
560
557
|
id: id,
|
|
561
558
|
ref: ref
|
|
562
559
|
}));
|
|
563
560
|
});
|
|
564
|
-
export
|
|
561
|
+
export { TextFieldBaseAutosuggest };
|
package/dist-es/text-field.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useFieldProps } from './form-context';
|
|
4
|
-
import
|
|
4
|
+
import { TextFieldBaseAutosuggest } from './text-field-base';
|
|
5
|
+
import { combineRefs } from './utils/common';
|
|
5
6
|
function _defineProperty(obj, key, value) {
|
|
6
7
|
if (key in obj) {
|
|
7
8
|
Object.defineProperty(obj, key, {
|
|
@@ -61,10 +62,9 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
61
62
|
}
|
|
62
63
|
return target;
|
|
63
64
|
}
|
|
64
|
-
var TextField = function(_param) {
|
|
65
|
-
var disabled = _param.disabled, error = _param.error, helperText = _param.helperText, name = _param.name, optional = _param.optional, validate = _param.validate, onChangeValue = _param.onChangeValue, onChange = _param.onChange, value = _param.value, defaultValue = _param.defaultValue, onBlurProp = _param.onBlur, onFocusProp = _param.onFocus, rest = _objectWithoutProperties(_param, ["disabled", "error", "helperText", "name", "optional", "validate", "onChangeValue", "onChange", "value", "defaultValue", "onBlur",
|
|
66
|
-
"onFocus"
|
|
67
|
-
]);
|
|
65
|
+
var TextField = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
66
|
+
var disabled = _param.disabled, error = _param.error, helperText = _param.helperText, name = _param.name, optional = _param.optional, validate = _param.validate, onChangeValue = _param.onChangeValue, onChange = _param.onChange, value = _param.value, defaultValue = _param.defaultValue, onBlurProp = _param.onBlur, onFocusProp = _param.onFocus, onPress = _param.onPress, rest = _objectWithoutProperties(_param, ["disabled", "error", "helperText", "name", "optional", "validate", "onChangeValue", "onChange", "value", "defaultValue", "onBlur",
|
|
67
|
+
"onFocus", "onPress"]);
|
|
68
68
|
var inputRef = React.useRef(null);
|
|
69
69
|
var processValue = function(v) {
|
|
70
70
|
return v;
|
|
@@ -105,15 +105,12 @@ var TextField = function(_param) {
|
|
|
105
105
|
onChange: onChange,
|
|
106
106
|
onChangeValue: onChangeValue
|
|
107
107
|
});
|
|
108
|
-
|
|
109
|
-
inputRef.current = field;
|
|
110
|
-
fieldProps.inputRef(field);
|
|
111
|
-
};
|
|
112
|
-
return(/*#__PURE__*/ _jsx(TextFieldBase, _objectSpread({
|
|
108
|
+
return(/*#__PURE__*/ _jsx(TextFieldBaseAutosuggest, _objectSpread({
|
|
113
109
|
}, rest, fieldProps, {
|
|
114
|
-
|
|
110
|
+
onClick: onPress,
|
|
111
|
+
inputRef: combineRefs(inputRef, fieldProps.inputRef, ref),
|
|
115
112
|
onFocus: onFocus,
|
|
116
113
|
type: "text"
|
|
117
114
|
})));
|
|
118
|
-
};
|
|
115
|
+
});
|
|
119
116
|
export default TextField;
|
package/dist-es/video.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useDisableBorderRadius } from './image';
|
|
4
|
+
import { createUseStyles } from './jss';
|
|
5
|
+
import { combineRefs } from './utils/common';
|
|
6
|
+
function _objectWithoutProperties(source, excluded) {
|
|
7
|
+
if (source == null) return {
|
|
8
|
+
};
|
|
9
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
10
|
+
var key, i;
|
|
11
|
+
if (Object.getOwnPropertySymbols) {
|
|
12
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
13
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
14
|
+
key = sourceSymbolKeys[i];
|
|
15
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
16
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
17
|
+
target[key] = source[key];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return target;
|
|
21
|
+
}
|
|
22
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
23
|
+
if (source == null) return {
|
|
24
|
+
};
|
|
25
|
+
var target = {
|
|
26
|
+
};
|
|
27
|
+
var sourceKeys = Object.keys(source);
|
|
28
|
+
var key, i;
|
|
29
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
30
|
+
key = sourceKeys[i];
|
|
31
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
32
|
+
target[key] = source[key];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
}
|
|
36
|
+
export var RATIO = {
|
|
37
|
+
'1:1': 1,
|
|
38
|
+
'16:9': 16 / 9,
|
|
39
|
+
'12:5': 12 / 5
|
|
40
|
+
};
|
|
41
|
+
var useStyles = createUseStyles(function() {
|
|
42
|
+
return {
|
|
43
|
+
video: {
|
|
44
|
+
borderRadius: function(param) {
|
|
45
|
+
var noBorderRadius = param.noBorderRadius;
|
|
46
|
+
return noBorderRadius ? 0 : 4;
|
|
47
|
+
},
|
|
48
|
+
display: 'block',
|
|
49
|
+
maxWidth: '100%',
|
|
50
|
+
maxHeight: '100%',
|
|
51
|
+
objectFit: 'cover',
|
|
52
|
+
aspectRatio: function(param) {
|
|
53
|
+
var aspectRatio = param.aspectRatio;
|
|
54
|
+
return aspectRatio !== null && aspectRatio !== void 0 ? aspectRatio : 'unset';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
/** Transparent 1x1px PNG */ var TRANSPARENT_PIXEL = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAtJREFUGFdjYAACAAAFAAGq1chRAAAAAElFTkSuQmCC';
|
|
60
|
+
var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
61
|
+
var src = _param.src, poster = _param.poster, _autoPlay = _param.autoPlay, autoPlay = _autoPlay === void 0 ? true : _autoPlay, _muted = _param.muted, muted = _muted === void 0 ? true : _muted, _loop = _param.loop, loop = _loop === void 0 ? true : _loop, _preload = _param.preload, preload = _preload === void 0 ? 'none' : _preload, _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, props = _objectWithoutProperties(_param, ["src", "poster", "autoPlay", "muted", "loop", "preload", "aspectRatio"]);
|
|
62
|
+
var noBorderRadius = useDisableBorderRadius();
|
|
63
|
+
var classes = useStyles({
|
|
64
|
+
noBorderRadius: noBorderRadius,
|
|
65
|
+
aspectRatio: !props.width && !props.height ? RATIO[aspectRatio] : undefined
|
|
66
|
+
});
|
|
67
|
+
var videoRef = React.useRef(null);
|
|
68
|
+
React.useEffect(function() {
|
|
69
|
+
var video = videoRef.current;
|
|
70
|
+
if (video && autoPlay && video.paused) {
|
|
71
|
+
video.play();
|
|
72
|
+
}
|
|
73
|
+
}, [
|
|
74
|
+
autoPlay
|
|
75
|
+
]);
|
|
76
|
+
// normalize sources
|
|
77
|
+
var sources = (Array.isArray(src) ? src : [
|
|
78
|
+
src
|
|
79
|
+
]).map(function(source) {
|
|
80
|
+
if (typeof source === 'string') {
|
|
81
|
+
return {
|
|
82
|
+
src: source
|
|
83
|
+
};
|
|
84
|
+
} else {
|
|
85
|
+
return source;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
var width = props.width;
|
|
89
|
+
var height = props.height;
|
|
90
|
+
if (props.width !== undefined && props.height !== undefined) {
|
|
91
|
+
width = props.width;
|
|
92
|
+
height = props.height;
|
|
93
|
+
} else if (props.width !== undefined) {
|
|
94
|
+
height = props.width / RATIO[aspectRatio];
|
|
95
|
+
} else if (props.height !== undefined) {
|
|
96
|
+
width = props.height * RATIO[aspectRatio];
|
|
97
|
+
} else {
|
|
98
|
+
width = '100%';
|
|
99
|
+
}
|
|
100
|
+
return(/*#__PURE__*/ _jsx("video", {
|
|
101
|
+
ref: combineRefs(ref, videoRef),
|
|
102
|
+
playsInline: true,
|
|
103
|
+
disablePictureInPicture: true,
|
|
104
|
+
disableRemotePlayback: true,
|
|
105
|
+
autoPlay: autoPlay,
|
|
106
|
+
muted: muted,
|
|
107
|
+
loop: loop,
|
|
108
|
+
width: width,
|
|
109
|
+
height: height,
|
|
110
|
+
className: classes.video,
|
|
111
|
+
preload: preload,
|
|
112
|
+
// This transparent pixel fallback avoids showing the ugly "play" image in android webviews
|
|
113
|
+
poster: poster || TRANSPARENT_PIXEL,
|
|
114
|
+
children: sources.map(function(param, index) {
|
|
115
|
+
var src = param.src, type = param.type;
|
|
116
|
+
/*#__PURE__*/ return _jsx("source", {
|
|
117
|
+
src: src,
|
|
118
|
+
type: type
|
|
119
|
+
}, index);
|
|
120
|
+
})
|
|
121
|
+
}));
|
|
122
|
+
});
|
|
123
|
+
export default Video;
|