@razorpay/blade 5.3.0 → 5.4.1
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 +12 -0
- package/build/components/index.d.ts +79 -1
- package/build/components/index.native.d.ts +79 -1
- package/build/components/index.native.js +208 -32
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.web.js +618 -186
- package/build/components/index.web.js.map +1 -1
- package/build/css/bankingThemeDarkDesktop.css +1 -1
- package/build/css/bankingThemeDarkMobile.css +1 -1
- package/build/css/bankingThemeLightDesktop.css +1 -1
- package/build/css/bankingThemeLightMobile.css +1 -1
- package/build/css/paymentThemeDarkDesktop.css +1 -1
- package/build/css/paymentThemeDarkMobile.css +1 -1
- package/build/css/paymentThemeLightDesktop.css +1 -1
- package/build/css/paymentThemeLightMobile.css +1 -1
- package/build/tokens/index.native.js.map +1 -1
- package/build/tokens/index.web.js.map +1 -1
- package/build/utils/index.d.ts +2 -1
- package/build/utils/index.native.d.ts +2 -1
- package/build/utils/index.native.js +2 -2
- package/build/utils/index.native.js.map +1 -1
- package/build/utils/index.web.js +1 -0
- package/build/utils/index.web.js.map +1 -1
- package/package.json +3 -4
|
@@ -5,7 +5,7 @@ import React__default, { useMemo, useCallback, useState, useEffect, useRef, crea
|
|
|
5
5
|
import styled, { ThemeProvider } from 'styled-components/native';
|
|
6
6
|
import { Appearance, Platform, Pressable, AccessibilityInfo, Linking, View } from 'react-native';
|
|
7
7
|
import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
|
|
8
|
-
import Animated, { Easing, useSharedValue, useAnimatedStyle, withTiming, withRepeat, cancelAnimation, Keyframe, interpolate } from 'react-native-reanimated';
|
|
8
|
+
import Animated, { Easing, useSharedValue, useAnimatedStyle, withTiming, withRepeat, cancelAnimation, Keyframe, interpolate, withSequence, withDelay } from 'react-native-reanimated';
|
|
9
9
|
import { ClipPath as ClipPath$1, Defs as Defs$1, G as G$1, Path as Path$1, Rect as Rect$1, Svg as Svg$1, Circle as Circle$1 } from 'react-native-svg';
|
|
10
10
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
11
11
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
@@ -439,15 +439,15 @@ var _baseGetTag = baseGetTag$6;
|
|
|
439
439
|
* // => false
|
|
440
440
|
*/
|
|
441
441
|
|
|
442
|
-
function isObject$
|
|
442
|
+
function isObject$8(value) {
|
|
443
443
|
var type = typeof value;
|
|
444
444
|
return value != null && (type == 'object' || type == 'function');
|
|
445
445
|
}
|
|
446
446
|
|
|
447
|
-
var isObject_1 = isObject$
|
|
447
|
+
var isObject_1 = isObject$8;
|
|
448
448
|
|
|
449
449
|
var baseGetTag$5 = _baseGetTag,
|
|
450
|
-
isObject$
|
|
450
|
+
isObject$7 = isObject_1;
|
|
451
451
|
|
|
452
452
|
/** `Object#toString` result references. */
|
|
453
453
|
var asyncTag = '[object AsyncFunction]',
|
|
@@ -473,7 +473,7 @@ var asyncTag = '[object AsyncFunction]',
|
|
|
473
473
|
* // => false
|
|
474
474
|
*/
|
|
475
475
|
function isFunction$3(value) {
|
|
476
|
-
if (!isObject$
|
|
476
|
+
if (!isObject$7(value)) {
|
|
477
477
|
return false;
|
|
478
478
|
}
|
|
479
479
|
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
@@ -542,7 +542,7 @@ var _toSource = toSource$2;
|
|
|
542
542
|
|
|
543
543
|
var isFunction$2 = isFunction_1,
|
|
544
544
|
isMasked = _isMasked,
|
|
545
|
-
isObject$
|
|
545
|
+
isObject$6 = isObject_1,
|
|
546
546
|
toSource$1 = _toSource;
|
|
547
547
|
|
|
548
548
|
/**
|
|
@@ -579,7 +579,7 @@ var reIsNative = RegExp('^' +
|
|
|
579
579
|
* else `false`.
|
|
580
580
|
*/
|
|
581
581
|
function baseIsNative$1(value) {
|
|
582
|
-
if (!isObject$
|
|
582
|
+
if (!isObject$6(value) || isMasked(value)) {
|
|
583
583
|
return false;
|
|
584
584
|
}
|
|
585
585
|
var pattern = isFunction$2(value) ? reIsNative : reIsHostCtor;
|
|
@@ -1706,7 +1706,7 @@ function nativeKeysIn$1(object) {
|
|
|
1706
1706
|
|
|
1707
1707
|
var _nativeKeysIn = nativeKeysIn$1;
|
|
1708
1708
|
|
|
1709
|
-
var isObject$
|
|
1709
|
+
var isObject$5 = isObject_1,
|
|
1710
1710
|
isPrototype$2 = _isPrototype,
|
|
1711
1711
|
nativeKeysIn = _nativeKeysIn;
|
|
1712
1712
|
|
|
@@ -1724,7 +1724,7 @@ var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
|
|
1724
1724
|
* @returns {Array} Returns the array of property names.
|
|
1725
1725
|
*/
|
|
1726
1726
|
function baseKeysIn$1(object) {
|
|
1727
|
-
if (!isObject$
|
|
1727
|
+
if (!isObject$5(object)) {
|
|
1728
1728
|
return nativeKeysIn(object);
|
|
1729
1729
|
}
|
|
1730
1730
|
var isProto = isPrototype$2(object),
|
|
@@ -1980,7 +1980,7 @@ function cloneTypedArray$1(typedArray, isDeep) {
|
|
|
1980
1980
|
|
|
1981
1981
|
var _cloneTypedArray = cloneTypedArray$1;
|
|
1982
1982
|
|
|
1983
|
-
var isObject$
|
|
1983
|
+
var isObject$4 = isObject_1;
|
|
1984
1984
|
|
|
1985
1985
|
/** Built-in value references. */
|
|
1986
1986
|
var objectCreate = Object.create;
|
|
@@ -1996,7 +1996,7 @@ var objectCreate = Object.create;
|
|
|
1996
1996
|
var baseCreate$1 = (function() {
|
|
1997
1997
|
function object() {}
|
|
1998
1998
|
return function(proto) {
|
|
1999
|
-
if (!isObject$
|
|
1999
|
+
if (!isObject$4(proto)) {
|
|
2000
2000
|
return {};
|
|
2001
2001
|
}
|
|
2002
2002
|
if (objectCreate) {
|
|
@@ -2067,15 +2067,15 @@ var symbolTag = '[object Symbol]';
|
|
|
2067
2067
|
* _.isSymbol('abc');
|
|
2068
2068
|
* // => false
|
|
2069
2069
|
*/
|
|
2070
|
-
function isSymbol$
|
|
2070
|
+
function isSymbol$4(value) {
|
|
2071
2071
|
return typeof value == 'symbol' ||
|
|
2072
2072
|
(isObjectLike$2(value) && baseGetTag$1(value) == symbolTag);
|
|
2073
2073
|
}
|
|
2074
2074
|
|
|
2075
|
-
var isSymbol_1 = isSymbol$
|
|
2075
|
+
var isSymbol_1 = isSymbol$4;
|
|
2076
2076
|
|
|
2077
2077
|
var isArray$4 = isArray_1,
|
|
2078
|
-
isSymbol$
|
|
2078
|
+
isSymbol$3 = isSymbol_1;
|
|
2079
2079
|
|
|
2080
2080
|
/** Used to match property names within property paths. */
|
|
2081
2081
|
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
@@ -2095,7 +2095,7 @@ function isKey$1(value, object) {
|
|
|
2095
2095
|
}
|
|
2096
2096
|
var type = typeof value;
|
|
2097
2097
|
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
2098
|
-
value == null || isSymbol$
|
|
2098
|
+
value == null || isSymbol$3(value)) {
|
|
2099
2099
|
return true;
|
|
2100
2100
|
}
|
|
2101
2101
|
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
@@ -2259,7 +2259,7 @@ var _arrayMap = arrayMap$1;
|
|
|
2259
2259
|
var Symbol$1 = _Symbol,
|
|
2260
2260
|
arrayMap = _arrayMap,
|
|
2261
2261
|
isArray$3 = isArray_1,
|
|
2262
|
-
isSymbol$
|
|
2262
|
+
isSymbol$2 = isSymbol_1;
|
|
2263
2263
|
|
|
2264
2264
|
/** Used as references for various `Number` constants. */
|
|
2265
2265
|
var INFINITY$1 = 1 / 0;
|
|
@@ -2285,7 +2285,7 @@ function baseToString$1(value) {
|
|
|
2285
2285
|
// Recursively convert values (susceptible to call stack limits).
|
|
2286
2286
|
return arrayMap(value, baseToString$1) + '';
|
|
2287
2287
|
}
|
|
2288
|
-
if (isSymbol$
|
|
2288
|
+
if (isSymbol$2(value)) {
|
|
2289
2289
|
return symbolToString ? symbolToString.call(value) : '';
|
|
2290
2290
|
}
|
|
2291
2291
|
var result = (value + '');
|
|
@@ -2345,7 +2345,7 @@ function castPath$1(value, object) {
|
|
|
2345
2345
|
|
|
2346
2346
|
var _castPath = castPath$1;
|
|
2347
2347
|
|
|
2348
|
-
var isSymbol = isSymbol_1;
|
|
2348
|
+
var isSymbol$1 = isSymbol_1;
|
|
2349
2349
|
|
|
2350
2350
|
/** Used as references for various `Number` constants. */
|
|
2351
2351
|
var INFINITY = 1 / 0;
|
|
@@ -2358,7 +2358,7 @@ var INFINITY = 1 / 0;
|
|
|
2358
2358
|
* @returns {string|symbol} Returns the key.
|
|
2359
2359
|
*/
|
|
2360
2360
|
function toKey$1(value) {
|
|
2361
|
-
if (typeof value == 'string' || isSymbol(value)) {
|
|
2361
|
+
if (typeof value == 'string' || isSymbol$1(value)) {
|
|
2362
2362
|
return value;
|
|
2363
2363
|
}
|
|
2364
2364
|
var result = (value + '');
|
|
@@ -2514,7 +2514,7 @@ var symbolProto = Symbol ? Symbol.prototype : undefined;
|
|
|
2514
2514
|
|
|
2515
2515
|
var getComponentId=function getComponentId(component){var _component$type;if(!React__default.isValidElement(component))return null;return (_component$type=component.type)==null?void 0:_component$type.componentId;};var isValidAllowedChildren=function isValidAllowedChildren(component,id){return getComponentId(component)===id;};
|
|
2516
2516
|
|
|
2517
|
-
var accessibilityValue={valueMax:'max',valueMin:'min',valueNow:'now',valueText:'text'};var accessibilityState={selected:'selected',disabled:'disabled',expanded:'expanded',busy:'busy',checked:'checked'};var accessibilityValueKeys=Object.keys(accessibilityValue);var accessibilityStateKeys=Object.keys(accessibilityState);var accessibilityMap=_extends({},accessibilityState,accessibilityValue,{activeDescendant:'accessibilityActiveDescendant',atomic:'accessibilityAtomic',autoComplete:'accessibilityAutoComplete',colCount:'accessibilityColCount',colIndex:'accessibilityColIndex',colSpan:'accessibilityColSpan',controls:'accessibilityControls',describedBy:'accessibilityDescribedBy',details:'accessibilityDetails',errorMessage:'accessibilityErrorMessage',flowTo:'accessibilityFlowTo',hasPopup:'accessibilityHasPopup',hidden:'accessibilityHidden',invalid:'accessibilityInvalid',keyShortcuts:'accessibilityKeyShortcuts',label:'accessibilityLabel',labelledBy:'accessibilityLabelledBy',liveRegion:'accessibilityLiveRegion',modal:'accessibilityModal',multiline:'accessibilityMultiline',multiSelectable:'accessibilityMultiSelectable',orientation:'accessibilityOrientation',owns:'accessibilityOwns',placeholder:'accessibilityPlaceholder',posInSet:'accessibilityPosInSet',pressed:'accessibilityPressed',readOnly:'accessibilityReadOnly',required:'accessibilityRequired',role:'accessibilityRole',roleDescription:'accessibilityRoleDescription',rowCount:'accessibilityRowCount',rowIndex:'accessibilityRowIndex',rowSpan:'accessibilityRowSpan',setSize:'accessibilitySetSize',sort:'accessibilitySort',current:'accessibilityCurrent',dropEffect:'accessibilityDropEffect',grabbed:'accessibilityGrabbed',level:'accessibilityLevel',relevant:'accessibilityRelevant'});var accessibilityRoleMap={alert:'alert',button:'button',checkbox:'checkbox',combobox:'combobox',image:'image',link:'link',menu:'menu',menubar:'menubar',menuitem:'menuitem',progressbar:'progressbar',radio:'radio',radiogroup:'radiogroup',scrollbar:'scrollbar',search:'search',spinbutton:'spinbutton',switch:'switch',tab:'tab',tablist:'tablist',timer:'timer',togglebutton:'togglebutton',toolbar:'toolbar',heading:'header',slider:'adjustable',img:'image',presentation:'none',region:'summary',imagebutton:'imagebutton',keyboardkey:'keyboardkey',label:'label',text:'text'};
|
|
2517
|
+
var accessibilityValue={valueMax:'max',valueMin:'min',valueNow:'now',valueText:'text'};var accessibilityState={selected:'selected',disabled:'disabled',expanded:'expanded',busy:'busy',checked:'checked'};var accessibilityValueKeys=Object.keys(accessibilityValue);var accessibilityStateKeys=Object.keys(accessibilityState);var accessibilityMap=_extends({},accessibilityState,accessibilityValue,{activeDescendant:'accessibilityActiveDescendant',atomic:'accessibilityAtomic',autoComplete:'accessibilityAutoComplete',colCount:'accessibilityColCount',colIndex:'accessibilityColIndex',colSpan:'accessibilityColSpan',controls:'accessibilityControls',describedBy:'accessibilityDescribedBy',details:'accessibilityDetails',errorMessage:'accessibilityErrorMessage',flowTo:'accessibilityFlowTo',hasPopup:'accessibilityHasPopup',hidden:'accessibilityHidden',invalid:'accessibilityInvalid',keyShortcuts:'accessibilityKeyShortcuts',label:'accessibilityLabel',labelledBy:'accessibilityLabelledBy',liveRegion:'accessibilityLiveRegion',modal:'accessibilityModal',multiline:'accessibilityMultiline',multiSelectable:'accessibilityMultiSelectable',orientation:'accessibilityOrientation',owns:'accessibilityOwns',placeholder:'accessibilityPlaceholder',posInSet:'accessibilityPosInSet',pressed:'accessibilityPressed',readOnly:'accessibilityReadOnly',required:'accessibilityRequired',role:'accessibilityRole',roleDescription:'accessibilityRoleDescription',rowCount:'accessibilityRowCount',rowIndex:'accessibilityRowIndex',rowSpan:'accessibilityRowSpan',setSize:'accessibilitySetSize',sort:'accessibilitySort',current:'accessibilityCurrent',dropEffect:'accessibilityDropEffect',grabbed:'accessibilityGrabbed',level:'accessibilityLevel',relevant:'accessibilityRelevant'});var accessibilityRoleMap={alert:'alert',button:'button',checkbox:'checkbox',combobox:'combobox',image:'image',link:'link',menu:'menu',menubar:'menubar',menuitem:'menuitem',progressbar:'progressbar',radio:'radio',radiogroup:'radiogroup',scrollbar:'scrollbar',search:'search',spinbutton:'spinbutton',switch:'switch',tab:'tab',tablist:'tablist',timer:'timer',togglebutton:'togglebutton',toolbar:'toolbar',heading:'header',slider:'adjustable',img:'image',presentation:'none',region:'summary',imagebutton:'imagebutton',keyboardkey:'keyboardkey',label:'label',text:'text',meter:'progressbar'};
|
|
2518
2518
|
|
|
2519
2519
|
var makeAccessible=function makeAccessible(props){var newProps={};for(var key in props){var propKey=key;var propValue=props[propKey];var accessibilityAttribute=accessibilityMap[propKey];if(accessibilityStateKeys.includes(propKey)){newProps.accessibilityState=_extends({},newProps.accessibilityState,_defineProperty$1({},accessibilityAttribute,propValue));continue;}if(accessibilityValueKeys.includes(propKey)){newProps.accessibilityValue=_extends({},newProps.accessibilityValue,_defineProperty$1({},accessibilityAttribute,propValue));continue;}if(propKey==='hidden'){if(propValue===true){newProps.accessibilityElementsHidden=true;newProps.importantForAccessibility='no-hide-descendants';}delete newProps.accessibilityHidden;continue;}if(accessibilityAttribute){newProps[accessibilityAttribute]=propValue;}else {console.warn("[Blade: makeAccessible]: No mapping found for "+propKey+". Make sure you have entered valid key");}}if(newProps.accessibilityRole){var role=accessibilityRoleMap[newProps.accessibilityRole];newProps.accessibilityRole=role;if(!role){var validRoles=Object.keys(accessibilityRoleMap).join(', ');console.log("[Blade: makeAccessible]: Unsupported accessibility role for react-native. Expected one of "+validRoles+" but found "+props.role);delete newProps.accessibilityRole;}}return newProps;};
|
|
2520
2520
|
|
|
@@ -2758,7 +2758,7 @@ var assignMergeValue$1 = _assignMergeValue,
|
|
|
2758
2758
|
isArrayLikeObject = isArrayLikeObject_1,
|
|
2759
2759
|
isBuffer = isBuffer$3.exports,
|
|
2760
2760
|
isFunction = isFunction_1,
|
|
2761
|
-
isObject$
|
|
2761
|
+
isObject$3 = isObject_1,
|
|
2762
2762
|
isPlainObject = isPlainObject_1,
|
|
2763
2763
|
isTypedArray = isTypedArray_1,
|
|
2764
2764
|
safeGet$1 = _safeGet,
|
|
@@ -2824,7 +2824,7 @@ function baseMergeDeep$1(object, source, key, srcIndex, mergeFunc, customizer, s
|
|
|
2824
2824
|
if (isArguments(objValue)) {
|
|
2825
2825
|
newValue = toPlainObject(objValue);
|
|
2826
2826
|
}
|
|
2827
|
-
else if (!isObject$
|
|
2827
|
+
else if (!isObject$3(objValue) || isFunction(objValue)) {
|
|
2828
2828
|
newValue = initCloneObject(srcValue);
|
|
2829
2829
|
}
|
|
2830
2830
|
}
|
|
@@ -2847,7 +2847,7 @@ var Stack = _Stack,
|
|
|
2847
2847
|
assignMergeValue = _assignMergeValue,
|
|
2848
2848
|
baseFor = _baseFor,
|
|
2849
2849
|
baseMergeDeep = _baseMergeDeep,
|
|
2850
|
-
isObject$
|
|
2850
|
+
isObject$2 = isObject_1,
|
|
2851
2851
|
keysIn = keysIn_1,
|
|
2852
2852
|
safeGet = _safeGet;
|
|
2853
2853
|
|
|
@@ -2868,7 +2868,7 @@ function baseMerge$1(object, source, srcIndex, customizer, stack) {
|
|
|
2868
2868
|
}
|
|
2869
2869
|
baseFor(source, function(srcValue, key) {
|
|
2870
2870
|
stack || (stack = new Stack);
|
|
2871
|
-
if (isObject$
|
|
2871
|
+
if (isObject$2(srcValue)) {
|
|
2872
2872
|
baseMergeDeep(object, source, key, srcIndex, baseMerge$1, customizer, stack);
|
|
2873
2873
|
}
|
|
2874
2874
|
else {
|
|
@@ -3095,7 +3095,7 @@ var _baseRest = baseRest$1;
|
|
|
3095
3095
|
var eq = eq_1,
|
|
3096
3096
|
isArrayLike = isArrayLike_1,
|
|
3097
3097
|
isIndex = _isIndex,
|
|
3098
|
-
isObject = isObject_1;
|
|
3098
|
+
isObject$1 = isObject_1;
|
|
3099
3099
|
|
|
3100
3100
|
/**
|
|
3101
3101
|
* Checks if the given arguments are from an iteratee call.
|
|
@@ -3108,7 +3108,7 @@ var eq = eq_1,
|
|
|
3108
3108
|
* else `false`.
|
|
3109
3109
|
*/
|
|
3110
3110
|
function isIterateeCall$1(value, index, object) {
|
|
3111
|
-
if (!isObject(object)) {
|
|
3111
|
+
if (!isObject$1(object)) {
|
|
3112
3112
|
return false;
|
|
3113
3113
|
}
|
|
3114
3114
|
var type = typeof index;
|
|
@@ -3327,7 +3327,7 @@ var StyledPressable$1=styled.Pressable({alignSelf:'center'});var StyledIconButto
|
|
|
3327
3327
|
|
|
3328
3328
|
var IconButton=function IconButton(_ref){var icon=_ref.icon,onClick=_ref.onClick,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$contrast=_ref.contrast,contrast=_ref$contrast===void 0?'low':_ref$contrast,accessibilityLabel=_ref.accessibilityLabel;return jsx(StyledIconButton,{onClick:onClick,contrast:contrast,size:size,icon:icon,accessibilityLabel:accessibilityLabel});};
|
|
3329
3329
|
|
|
3330
|
-
var getSpacingValue=function getSpacingValue(_ref){var value=_ref.value,theme=_ref.theme;if(value==='auto')return 'auto';if(typeof value==='number'){return makeSpace(value);}return value?makeSpace(get_1(theme,value)):undefined;};var getBoxStyles=function getBoxStyles(_ref2){var theme=_ref2.theme,display=_ref2.display,flex=_ref2.flex,flexWrap=_ref2.flexWrap,flexDirection=_ref2.flexDirection,flexGrow=_ref2.flexGrow,alignItems=_ref2.alignItems,alignContent=_ref2.alignContent,justifyContent=_ref2.justifyContent,alignSelf=_ref2.alignSelf,overflow=_ref2.overflow,paddingTop=_ref2.paddingTop,paddingBottom=_ref2.paddingBottom,paddingLeft=_ref2.paddingLeft,paddingRight=_ref2.paddingRight,marginTop=_ref2.marginTop,marginBottom=_ref2.marginBottom,marginLeft=_ref2.marginLeft,marginRight=_ref2.marginRight,gap=_ref2.gap,width=_ref2.width,height=_ref2.height,minHeight=_ref2.minHeight,minWidth=_ref2.minWidth,maxHeight=_ref2.maxHeight,maxWidth=_ref2.maxWidth,position=_ref2.position,transform=_ref2.transform,top=_ref2.top,left=_ref2.left,right=_ref2.right,bottom=_ref2.bottom,background=_ref2.background,zIndex=_ref2.zIndex,borderRadius=_ref2.borderRadius;return {display:display,flex:flex,flexWrap:flexWrap,flexGrow:flexGrow,flexDirection:flexDirection,alignItems:alignItems,alignContent:alignContent,justifyContent:justifyContent,alignSelf:alignSelf,overflow:overflow,position:position,top:top,right:right,bottom:bottom,left:left,paddingTop:getSpacingValue({value:paddingTop,theme:theme}),paddingBottom:getSpacingValue({value:paddingBottom,theme:theme}),paddingLeft:getSpacingValue({value:paddingLeft,theme:theme}),paddingRight:getSpacingValue({value:paddingRight,theme:theme}),marginTop:getSpacingValue({value:marginTop,theme:theme}),marginBottom:getSpacingValue({value:marginBottom,theme:theme}),marginLeft:getSpacingValue({value:marginLeft,theme:theme}),marginRight:getSpacingValue({value:marginRight,theme:theme}),gap:getSpacingValue({value:gap,theme:theme}),width:width,height:height,minHeight:minHeight?makeSize(minHeight):undefined,minWidth:minWidth?makeSize(minWidth):undefined,maxHeight:maxHeight?makeSize(maxHeight):undefined,maxWidth:maxWidth?makeSize(maxWidth):undefined,transform:transform,background:background,zIndex:zIndex,borderRadius:borderRadius?makeSize(get_1(theme,"border.radius."+borderRadius)):undefined};};
|
|
3330
|
+
var getSpacingValue=function getSpacingValue(_ref){var value=_ref.value,theme=_ref.theme;if(value==='auto')return 'auto';if(typeof value==='number'){return makeSpace(value);}return value?makeSpace(get_1(theme,value)):undefined;};var getBoxStyles=function getBoxStyles(_ref2){var theme=_ref2.theme,display=_ref2.display,flex=_ref2.flex,flexWrap=_ref2.flexWrap,flexDirection=_ref2.flexDirection,flexGrow=_ref2.flexGrow,alignItems=_ref2.alignItems,alignContent=_ref2.alignContent,justifyContent=_ref2.justifyContent,alignSelf=_ref2.alignSelf,overflow=_ref2.overflow,paddingTop=_ref2.paddingTop,paddingBottom=_ref2.paddingBottom,paddingLeft=_ref2.paddingLeft,paddingRight=_ref2.paddingRight,marginTop=_ref2.marginTop,marginBottom=_ref2.marginBottom,marginLeft=_ref2.marginLeft,marginRight=_ref2.marginRight,gap=_ref2.gap,width=_ref2.width,height=_ref2.height,minHeight=_ref2.minHeight,minWidth=_ref2.minWidth,maxHeight=_ref2.maxHeight,maxWidth=_ref2.maxWidth,position=_ref2.position,transform=_ref2.transform,top=_ref2.top,left=_ref2.left,right=_ref2.right,bottom=_ref2.bottom,background=_ref2.background,backgroundColor=_ref2.backgroundColor,zIndex=_ref2.zIndex,borderRadius=_ref2.borderRadius;return {display:display,flex:flex,flexWrap:flexWrap,flexGrow:flexGrow,flexDirection:flexDirection,alignItems:alignItems,alignContent:alignContent,justifyContent:justifyContent,alignSelf:alignSelf,overflow:overflow,position:position,top:top,right:right,bottom:bottom,left:left,paddingTop:getSpacingValue({value:paddingTop,theme:theme}),paddingBottom:getSpacingValue({value:paddingBottom,theme:theme}),paddingLeft:getSpacingValue({value:paddingLeft,theme:theme}),paddingRight:getSpacingValue({value:paddingRight,theme:theme}),marginTop:getSpacingValue({value:marginTop,theme:theme}),marginBottom:getSpacingValue({value:marginBottom,theme:theme}),marginLeft:getSpacingValue({value:marginLeft,theme:theme}),marginRight:getSpacingValue({value:marginRight,theme:theme}),gap:getSpacingValue({value:gap,theme:theme}),width:width,height:height,minHeight:minHeight?makeSize(minHeight):undefined,minWidth:minWidth?makeSize(minWidth):undefined,maxHeight:maxHeight?makeSize(maxHeight):undefined,maxWidth:maxWidth?makeSize(maxWidth):undefined,transform:transform,background:background,backgroundColor:backgroundColor,zIndex:zIndex,borderRadius:borderRadius?makeSize(get_1(theme,"border.radius."+borderRadius)):undefined};};
|
|
3331
3331
|
|
|
3332
3332
|
var Box=styled.View(getBoxStyles);
|
|
3333
3333
|
|
|
@@ -3341,7 +3341,7 @@ var getProps$2=function getProps(_ref){var variant=_ref.variant,size=_ref.size,t
|
|
|
3341
3341
|
|
|
3342
3342
|
var getTextProps=function getTextProps(_ref){var variant=_ref.variant,type=_ref.type,weight=_ref.weight,size=_ref.size,contrast=_ref.contrast;var isPlatformWeb=getPlatformType()==='browser'||getPlatformType()==='node';var colorContrast=contrast?contrast+"Contrast":'lowContrast';var props={color:"surface.text."+(type!=null?type:'normal')+"."+colorContrast,fontSize:100,fontWeight:weight!=null?weight:'regular',fontStyle:'normal',lineHeight:'l',fontFamily:'text',forwardedAs:isPlatformWeb?'p':undefined,componentName:'text'};if(variant==='body'){if(size==='small'){props.fontSize=75;props.lineHeight='s';}}else if(variant==='caption'){if(size==='small'){throw new Error("[Blade: Text]: size cannot be 'small' when variant is 'caption'");}props.fontSize=50;props.lineHeight='s';props.fontStyle='italic';}return props;};var StyledText=styled(BaseText)(function(_ref2){var truncateAfterLines=_ref2.truncateAfterLines;if(truncateAfterLines){if(getPlatformType()==='react-native'){return null;}return {overflow:'hidden',display:'-webkit-box','line-clamp':""+truncateAfterLines,'-webkit-line-clamp':""+truncateAfterLines,'-webkit-box-orient':'vertical'};}return {};});var Text=function Text(_ref3){var _ref3$variant=_ref3.variant,variant=_ref3$variant===void 0?'body':_ref3$variant,_ref3$weight=_ref3.weight,weight=_ref3$weight===void 0?'regular':_ref3$weight,_ref3$size=_ref3.size,size=_ref3$size===void 0?'medium':_ref3$size,_ref3$type=_ref3.type,type=_ref3$type===void 0?'normal':_ref3$type,_ref3$contrast=_ref3.contrast,contrast=_ref3$contrast===void 0?'low':_ref3$contrast,truncateAfterLines=_ref3.truncateAfterLines,children=_ref3.children,color=_ref3.color;var props=_extends({truncateAfterLines:truncateAfterLines},getTextProps({variant:variant,type:type,weight:weight,size:size,contrast:contrast}),color?{color:color}:{});return jsx(StyledText,_extends({},props,{children:children}));};
|
|
3343
3343
|
|
|
3344
|
-
var platformType=getPlatformType();var isPlatformWeb=platformType==='browser'||platformType==='node';var getCodeFontSize=function getCodeFontSize(size){switch(size){case'medium':return 100;default:return 75;}};var CodeContainer=styled(Box)(function(props){var padding=makeSpace(props.theme.spacing[0])+" "+makeSpace(props.theme.spacing[2]);return {padding:padding,backgroundColor:props.theme.colors.brand.gray
|
|
3344
|
+
var platformType=getPlatformType();var isPlatformWeb=platformType==='browser'||platformType==='node';var getCodeFontSize=function getCodeFontSize(size){switch(size){case'medium':return 100;default:return 75;}};var CodeContainer=styled(Box)(function(props){var padding=makeSpace(props.theme.spacing[0])+" "+makeSpace(props.theme.spacing[2]);return {padding:padding,backgroundColor:props.theme.colors.brand.gray.a50.lowContrast,borderRadius:props.theme.border.radius.medium,display:isPlatformWeb?'inline-block':undefined,lineHeight:makeTypographySize(props.theme.typography.lineHeights.s)};});var Code=function Code(_ref){var children=_ref.children,_ref$size=_ref.size,size=_ref$size===void 0?'small':_ref$size;return jsx(CodeContainer,_extends({size:size,as:isPlatformWeb?'span':undefined},metaAttribute(),{children:jsx(BaseText,{color:"surface.text.subtle.lowContrast",fontFamily:"code",fontSize:getCodeFontSize(size),as:isPlatformWeb?'code':undefined,children:children})}));};
|
|
3345
3345
|
|
|
3346
3346
|
var getBaseButtonStyles=function getBaseButtonStyles(_ref){var defaultBorderColor=_ref.defaultBorderColor,minHeight=_ref.minHeight,buttonPaddingTop=_ref.buttonPaddingTop,buttonPaddingBottom=_ref.buttonPaddingBottom,buttonPaddingLeft=_ref.buttonPaddingLeft,buttonPaddingRight=_ref.buttonPaddingRight,defaultBackgroundColor=_ref.defaultBackgroundColor,disabled=_ref.disabled,isFullWidth=_ref.isFullWidth,borderWidth=_ref.borderWidth,borderRadius=_ref.borderRadius;return {minHeight:minHeight,width:isFullWidth?'100%':'auto',cursor:disabled?'not-allowed':'pointer',backgroundColor:defaultBackgroundColor,borderColor:defaultBorderColor,borderWidth:borderWidth,borderRadius:borderRadius,borderStyle:'solid',paddingTop:buttonPaddingTop,paddingBottom:buttonPaddingBottom,paddingLeft:buttonPaddingLeft,paddingRight:buttonPaddingRight};};
|
|
3347
3347
|
|
|
@@ -3457,7 +3457,7 @@ var screenReaderStyles={border:0,clip:'rect(0 0 0 0)',clipPath:'inset(50%)',heig
|
|
|
3457
3457
|
|
|
3458
3458
|
var StyledVisuallyHidden=styled.View(screenReaderStyles);var VisuallyHidden=function VisuallyHidden(_ref){var children=_ref.children;return jsx(StyledVisuallyHidden,{children:children});};
|
|
3459
3459
|
|
|
3460
|
-
var FormLabel=function FormLabel(_ref){var _ref$as=_ref.as,as=_ref$as===void 0?'span':_ref$as,_ref$position=_ref.position,position=_ref$position===void 0?'top':_ref$position,_ref$necessityIndicat=_ref.necessityIndicator,necessityIndicator=_ref$necessityIndicat===void 0?'none':_ref$necessityIndicat,accessibilityText=_ref.accessibilityText,children=_ref.children,id=_ref.id,htmlFor=_ref.htmlFor;var _useTheme=useTheme(),theme=_useTheme.theme;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var isDesktop=matchedDeviceType==='desktop';var isReactNative=getPlatformType()==='react-native';var necessityLabel=null;var isLabelLeftPositioned=position==='left'&&isDesktop;if(necessityIndicator==='optional'){necessityLabel=jsx(Text,{variant:"caption",weight:"regular",type:"placeholder",children:"(optional)"});}if(necessityIndicator==='required'){necessityLabel=jsx(BaseText,{lineHeight:"s",fontFamily:"text",fontStyle:"normal",fontSize:75,fontWeight:"bold",color:"feedback.text.negative.lowContrast",children:"*"});}var computedAccessibilityNode=jsxs(VisuallyHidden,{children:[necessityIndicator!=='none'&&jsx(Text,{children:necessityIndicator}),jsx(Text,{children:accessibilityText})]});var textNode=jsxs(Box,{gap:necessityIndicator==='optional'?'spacing.2':'spacing.0',display:"flex",flexDirection:"row",alignItems:"center",flexWrap:"wrap",children:[jsx(Text,{type:"subdued",variant:"body",size:isLabelLeftPositioned?'medium':'small',weight:"bold",children:children}),computedAccessibilityNode,necessityLabel]});if(isReactNative){return jsx(Box,{marginRight:"spacing.5",marginBottom:"spacing.2",children:textNode});}var Component=as;var width=isLabelLeftPositioned&&isDesktop?'120px':'auto';return jsx(Component,{htmlFor:htmlFor,style:{width:width,flexShrink:0,marginRight:makeSpace(theme.spacing[5]),wordBreak:'break-all'},id:id,children:jsx(Box,{marginBottom:isLabelLeftPositioned?'spacing.0':'spacing.2',children:textNode})});};
|
|
3460
|
+
var FormLabel=function FormLabel(_ref){var _ref$as=_ref.as,as=_ref$as===void 0?'span':_ref$as,_ref$position=_ref.position,position=_ref$position===void 0?'top':_ref$position,_ref$necessityIndicat=_ref.necessityIndicator,necessityIndicator=_ref$necessityIndicat===void 0?'none':_ref$necessityIndicat,accessibilityText=_ref.accessibilityText,children=_ref.children,id=_ref.id,htmlFor=_ref.htmlFor,_ref$contrast=_ref.contrast,contrast=_ref$contrast===void 0?'low':_ref$contrast;var _useTheme=useTheme(),theme=_useTheme.theme;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var isDesktop=matchedDeviceType==='desktop';var isReactNative=getPlatformType()==='react-native';var necessityLabel=null;var isLabelLeftPositioned=position==='left'&&isDesktop;if(necessityIndicator==='optional'){necessityLabel=jsx(Text,{variant:"caption",weight:"regular",type:"placeholder",children:"(optional)"});}if(necessityIndicator==='required'){necessityLabel=jsx(BaseText,{lineHeight:"s",fontFamily:"text",fontStyle:"normal",fontSize:75,fontWeight:"bold",color:"feedback.text.negative.lowContrast",children:"*"});}var computedAccessibilityNode=jsxs(VisuallyHidden,{children:[necessityIndicator!=='none'&&jsx(Text,{children:necessityIndicator}),jsx(Text,{children:accessibilityText})]});var textNode=jsxs(Box,{gap:necessityIndicator==='optional'?'spacing.2':'spacing.0',display:"flex",flexDirection:"row",alignItems:"center",flexWrap:"wrap",children:[jsx(Text,{type:"subdued",variant:"body",contrast:contrast,size:isLabelLeftPositioned?'medium':'small',weight:"bold",children:children}),computedAccessibilityNode,necessityLabel]});if(isReactNative){return jsx(Box,{marginRight:"spacing.5",marginBottom:"spacing.2",children:textNode});}var Component=as;var width=isLabelLeftPositioned&&isDesktop?'120px':'auto';return jsx(Component,{htmlFor:htmlFor,style:{width:width,flexShrink:0,marginRight:makeSpace(theme.spacing[5]),wordBreak:'break-all'},id:id,children:jsx(Box,{marginBottom:isLabelLeftPositioned?'spacing.0':'spacing.2',children:textNode})});};
|
|
3461
3461
|
|
|
3462
3462
|
var StyledSelectorLabel=styled.Pressable(function(_ref){var theme=_ref.theme;return {display:'flex',flexDirection:'row',marginTop:makeSpace(theme.spacing[1]),marginBottom:makeSpace(theme.spacing[1])};});var SelectorLabel=function SelectorLabel(_ref2){var children=_ref2.children,inputProps=_ref2.inputProps;return jsx(StyledSelectorLabel,_extends({},inputProps,{children:children}));};
|
|
3463
3463
|
|
|
@@ -3499,12 +3499,188 @@ var PasswordInput=function PasswordInput(_ref){var label=_ref.label,_ref$labelPo
|
|
|
3499
3499
|
|
|
3500
3500
|
var isReactNative$1=function isReactNative(_textInputRef){return getPlatformType()==='react-native';};var TextArea=function TextArea(_ref){var label=_ref.label,labelPosition=_ref.labelPosition,necessityIndicator=_ref.necessityIndicator,errorText=_ref.errorText,helpText=_ref.helpText,successText=_ref.successText,validationState=_ref.validationState,defaultValue=_ref.defaultValue,isDisabled=_ref.isDisabled,isRequired=_ref.isRequired,name=_ref.name,onBlur=_ref.onBlur,_onChange=_ref.onChange,placeholder=_ref.placeholder,value=_ref.value,maxCharacters=_ref.maxCharacters,showClearButton=_ref.showClearButton,onClearButtonClick=_ref.onClearButtonClick,autoFocus=_ref.autoFocus,_ref$numberOfLines=_ref.numberOfLines,numberOfLines=_ref$numberOfLines===void 0?2:_ref$numberOfLines;var inputRef=React__default.useRef(null);var _React$useState=React__default.useState(Boolean(showClearButton&&((value==null?void 0:value.length)||(defaultValue==null?void 0:defaultValue.length)))),_React$useState2=_slicedToArray(_React$useState,2),shouldShowClearButton=_React$useState2[0],setShouldShowClearButton=_React$useState2[1];var renderInteractionElement=function renderInteractionElement(){if(shouldShowClearButton){return jsx(Box,{paddingTop:"spacing.3",marginTop:"spacing.1",children:jsx(IconButton,{icon:CloseIcon,accessibilityLabel:"Clear textarea content",onClick:function onClick(){var _inputRef$current;if(isEmpty_1(value)&&inputRef.current){if(isReactNative$1(inputRef.current)){inputRef.current.clear();inputRef.current.focus();}else if(inputRef.current instanceof HTMLTextAreaElement){inputRef.current.value='';inputRef.current.focus();}}onClearButtonClick==null?void 0:onClearButtonClick();inputRef==null?void 0:(_inputRef$current=inputRef.current)==null?void 0:_inputRef$current.focus();setShouldShowClearButton(false);}})});}return null;};return jsx(BaseInput,{as:"textarea",id:"textarea",componentName:"textarea",autoFocus:autoFocus,ref:inputRef,label:label,labelPosition:labelPosition,necessityIndicator:necessityIndicator,errorText:errorText,helpText:helpText,successText:successText,validationState:validationState,isDisabled:isDisabled,isRequired:isRequired,name:name,maxCharacters:maxCharacters,onBlur:onBlur,placeholder:placeholder,interactionElement:renderInteractionElement(),defaultValue:defaultValue,value:value,numberOfLines:numberOfLines,onChange:function onChange(_ref2){var name=_ref2.name,value=_ref2.value;if(showClearButton&&value!=null&&value.length){setShouldShowClearButton(true);}if(shouldShowClearButton&&!(value!=null&&value.length)){setShouldShowClearButton(false);}_onChange==null?void 0:_onChange({name:name,value:value});},trailingFooterSlot:function trailingFooterSlot(value){var _value$length;return maxCharacters?jsx(Box,{marginTop:"spacing.2",marginRight:"spacing.1",children:jsx(CharacterCounter,{currentCount:(_value$length=value==null?void 0:value.length)!=null?_value$length:0,maxCount:maxCharacters})}):null;}});};
|
|
3501
3501
|
|
|
3502
|
-
var isReactNative=getPlatformType()==='react-native';var otpToArray=function otpToArray(code){var _code$split;return (_code$split=code==null?void 0:code.split(''))!=null?_code$split:Array(6).fill('');};var OTPInput=function OTPInput(_ref){var autoFocus=_ref.autoFocus,errorText=_ref.errorText,helpText=_ref.helpText,isDisabled=_ref.isDisabled,keyboardReturnKeyType=_ref.keyboardReturnKeyType,_ref$keyboardType=_ref.keyboardType,keyboardType=_ref$keyboardType===void 0?'decimal':_ref$keyboardType,label=_ref.label,labelPosition=_ref.labelPosition,name=_ref.name,onChange=_ref.onChange,onOTPFilled=_ref.onOTPFilled,_ref$otpLength=_ref.otpLength,otpLength=_ref$otpLength===void 0?6:_ref$otpLength,placeholder=_ref.placeholder,successText=_ref.successText,validationState=_ref.validationState,inputValue=_ref.value,isMasked=_ref.isMasked;var inputRefs=[];var _useState=useState(otpToArray(inputValue)),_useState2=_slicedToArray(_useState,2),otpValue=_useState2[0],setOtpValue=_useState2[1];var isLabelLeftPositioned=labelPosition==='left';var _useFormId=useFormId('otp'),inputId=_useFormId.inputId,helpTextId=_useFormId.helpTextId,errorTextId=_useFormId.errorTextId,successTextId=_useFormId.successTextId;var _useTheme=useTheme(),platform=_useTheme.platform;useEffect(function(){if(inputValue&&inputValue.length>=otpLength){onOTPFilled==null?void 0:onOTPFilled({value:inputValue.slice(0,otpLength),name:name});}else if(!inputValue&&otpValue.join('').length>=otpLength){onOTPFilled==null?void 0:onOTPFilled({value:otpValue.slice(0,otpLength).join(''),name:name});}},[otpValue,otpLength,name,inputValue,onOTPFilled]);var setOtpValueByIndex=function setOtpValueByIndex(_ref2){var value=_ref2.value,index=_ref2.index;var newOtpValue=Array.from(otpValue);newOtpValue[index]=value;setOtpValue(newOtpValue);return newOtpValue.join('');};var focusOnOtpByIndex=function focusOnOtpByIndex(index){var _inputRefs$index,_inputRefs$index$curr;(_inputRefs$index=inputRefs[index])==null?void 0:(_inputRefs$index$curr=_inputRefs$index.current)==null?void 0:_inputRefs$index$curr.focus();if(!isReactNative){var _inputRefs$index2,_inputRefs$index2$cur;(_inputRefs$index2=inputRefs[index])==null?void 0:(_inputRefs$index2$cur=_inputRefs$index2.current)==null?void 0:_inputRefs$index2$cur.select();}};var handleOnChange=function handleOnChange(_ref3){var value=_ref3.value,currentOtpIndex=_ref3.currentOtpIndex;if(value&&value===' '){return;}if(inputValue&&inputValue.length>0){var newOtpValue=Array.from(inputValue);newOtpValue[currentOtpIndex]=value!=null?value:'';setOtpValue(newOtpValue);onChange==null?void 0:onChange({name:name,value:newOtpValue.join('')});}else if(value&&value.trim().length>1){setOtpValue(Array.from(value));onChange==null?void 0:onChange({name:name,value:value.trim().slice(0,otpLength)});}else if(otpValue[currentOtpIndex]!==(value==null?void 0:value.trim())){var _value$trim;var newValue=setOtpValueByIndex({value:(_value$trim=value==null?void 0:value.trim())!=null?_value$trim:'',index:currentOtpIndex});onChange==null?void 0:onChange({name:name,value:newValue});}};var handleOnInput=function handleOnInput(_ref4){var value=_ref4.value,currentOtpIndex=_ref4.currentOtpIndex;if(value&&value.trim().length===1){focusOnOtpByIndex(++currentOtpIndex);}};var handleOnKeyDown=function handleOnKeyDown(_ref5){var key=_ref5.key,code=_ref5.code,event=_ref5.event,currentOtpIndex=_ref5.currentOtpIndex;if(key==='Backspace'||code==='Backspace'||code==='Delete'||key==='Delete'){event.preventDefault==null?void 0:event.preventDefault();handleOnChange({value:'',currentOtpIndex:currentOtpIndex});focusOnOtpByIndex(--currentOtpIndex);}else if(key==='ArrowLeft'||code==='ArrowLeft'){event.preventDefault==null?void 0:event.preventDefault();focusOnOtpByIndex(--currentOtpIndex);}else if(key==='ArrowRight'||code==='ArrowRight'){event.preventDefault==null?void 0:event.preventDefault();focusOnOtpByIndex(++currentOtpIndex);}else if(key===' '||code==='Space'){event.preventDefault==null?void 0:event.preventDefault();}};var getHiddenInput=function getHiddenInput(){if(!isReactNative){var _ref6;return jsx("input",{hidden:true,id:inputId,name:name,value:(_ref6=inputValue!=null?inputValue:otpValue.join(''))!=null?_ref6:''});}return null;};var getOTPInputFields=function getOTPInputFields(){var inputs=[];var _loop=function _loop(index){var _otpValue$index,_Array$from$index;var currentValue=inputValue?otpToArray(inputValue)[index]||'':otpValue[index]||'';var ref=React__default.createRef();inputRefs.push(ref);inputs.push(jsx(Box,{flex:1,marginLeft:index==0?'spacing.0':'spacing.3',maxWidth:platform==='onDesktop'?36:40,children:jsx(BaseInput,{autoFocus:autoFocus&&index===0,accessibilityLabel:(index===0?label:'')+" character "+(index+1),label:label,hideLabelText:true,id:inputId+"-"+index,textAlign:"center",ref:ref,value:currentValue,maxCharacters:((_otpValue$index=otpValue[index])==null?void 0:_otpValue$index.length)>0?1:undefined,onChange:function onChange(formEvent){return handleOnChange(_extends({},formEvent,{currentOtpIndex:index}));},onInput:function onInput(formEvent){return handleOnInput(_extends({},formEvent,{currentOtpIndex:index}));},onKeyDown:function onKeyDown(keyboardEvent){return handleOnKeyDown(_extends({},keyboardEvent,{currentOtpIndex:index}));},isDisabled:isDisabled,placeholder:(_Array$from$index=Array.from(placeholder!=null?placeholder:'')[index])!=null?_Array$from$index:'',isRequired:true,autoCompleteSuggestionType:"oneTimeCode",keyboardType:keyboardType,keyboardReturnKeyType:keyboardReturnKeyType,validationState:validationState,successText:successText,errorText:errorText,helpText:helpText,hideFormHint:true,type:isMasked?'password':undefined})},inputId+"-"+index));};for(var index=0;index<otpLength;index++){_loop(index);}return inputs;};return jsxs(Box,_extends({},metaAttribute(),{children:[jsxs(Box,{display:"flex",flexDirection:isLabelLeftPositioned?'row':'column',alignItems:isLabelLeftPositioned?'center':undefined,position:"relative",children:[jsx(FormLabel,{as:"label",position:labelPosition,htmlFor:inputId,children:label}),jsxs(Box,{display:"flex",flexDirection:"row",children:[getHiddenInput(),getOTPInputFields()]})]}),jsx(Box,{marginLeft:isLabelLeftPositioned?136:0,children:jsx(FormHint,{type:getHintType({validationState:validationState,hasHelpText:Boolean(helpText)}),helpText:helpText,errorText:errorText,successText:successText,helpTextId:helpTextId,errorTextId:errorTextId,successTextId:successTextId})})]}));};
|
|
3502
|
+
var isReactNative=getPlatformType()==='react-native';var otpToArray=function otpToArray(code){var _code$split;return (_code$split=code==null?void 0:code.split(''))!=null?_code$split:Array(6).fill('');};var OTPInput=function OTPInput(_ref){var autoFocus=_ref.autoFocus,errorText=_ref.errorText,helpText=_ref.helpText,isDisabled=_ref.isDisabled,keyboardReturnKeyType=_ref.keyboardReturnKeyType,_ref$keyboardType=_ref.keyboardType,keyboardType=_ref$keyboardType===void 0?'decimal':_ref$keyboardType,label=_ref.label,labelPosition=_ref.labelPosition,name=_ref.name,onChange=_ref.onChange,onOTPFilled=_ref.onOTPFilled,_ref$otpLength=_ref.otpLength,otpLength=_ref$otpLength===void 0?6:_ref$otpLength,placeholder=_ref.placeholder,successText=_ref.successText,validationState=_ref.validationState,inputValue=_ref.value,isMasked=_ref.isMasked;var inputRefs=[];var _useState=useState(otpToArray(inputValue)),_useState2=_slicedToArray(_useState,2),otpValue=_useState2[0],setOtpValue=_useState2[1];var isLabelLeftPositioned=labelPosition==='left';var _useFormId=useFormId('otp'),inputId=_useFormId.inputId,helpTextId=_useFormId.helpTextId,errorTextId=_useFormId.errorTextId,successTextId=_useFormId.successTextId;var _useTheme=useTheme(),platform=_useTheme.platform;useEffect(function(){if(inputValue&&inputValue.length>=otpLength){onOTPFilled==null?void 0:onOTPFilled({value:inputValue.slice(0,otpLength),name:name});}else if(!inputValue&&otpValue.join('').length>=otpLength){onOTPFilled==null?void 0:onOTPFilled({value:otpValue.slice(0,otpLength).join(''),name:name});}},[otpValue,otpLength,name,inputValue,onOTPFilled]);var setOtpValueByIndex=function setOtpValueByIndex(_ref2){var value=_ref2.value,index=_ref2.index;var newOtpValue=Array.from(otpValue);newOtpValue[index]=value;setOtpValue(newOtpValue);return newOtpValue.join('');};var focusOnOtpByIndex=function focusOnOtpByIndex(index){var _inputRefs$index,_inputRefs$index$curr;(_inputRefs$index=inputRefs[index])==null?void 0:(_inputRefs$index$curr=_inputRefs$index.current)==null?void 0:_inputRefs$index$curr.focus();if(!isReactNative){var _inputRefs$index2,_inputRefs$index2$cur;(_inputRefs$index2=inputRefs[index])==null?void 0:(_inputRefs$index2$cur=_inputRefs$index2.current)==null?void 0:_inputRefs$index2$cur.select();}};var handleOnChange=function handleOnChange(_ref3){var value=_ref3.value,currentOtpIndex=_ref3.currentOtpIndex;if(value&&value===' '){return;}if(inputValue&&inputValue.length>0){var newOtpValue=Array.from(inputValue);newOtpValue[currentOtpIndex]=value!=null?value:'';setOtpValue(newOtpValue);onChange==null?void 0:onChange({name:name,value:newOtpValue.join('')});}else if(value&&value.trim().length>1){setOtpValue(Array.from(value));onChange==null?void 0:onChange({name:name,value:value.trim().slice(0,otpLength)});}else if(otpValue[currentOtpIndex]!==(value==null?void 0:value.trim())){var _value$trim;var newValue=setOtpValueByIndex({value:(_value$trim=value==null?void 0:value.trim())!=null?_value$trim:'',index:currentOtpIndex});onChange==null?void 0:onChange({name:name,value:newValue});}};var handleOnInput=function handleOnInput(_ref4){var value=_ref4.value,currentOtpIndex=_ref4.currentOtpIndex;if(value&&value.trim().length===1){focusOnOtpByIndex(++currentOtpIndex);}};var handleOnKeyDown=function handleOnKeyDown(_ref5){var key=_ref5.key,code=_ref5.code,event=_ref5.event,currentOtpIndex=_ref5.currentOtpIndex;if(key==='Backspace'||code==='Backspace'||code==='Delete'||key==='Delete'){event.preventDefault==null?void 0:event.preventDefault();handleOnChange({value:'',currentOtpIndex:currentOtpIndex});focusOnOtpByIndex(--currentOtpIndex);}else if(key==='ArrowLeft'||code==='ArrowLeft'){event.preventDefault==null?void 0:event.preventDefault();focusOnOtpByIndex(--currentOtpIndex);}else if(key==='ArrowRight'||code==='ArrowRight'){event.preventDefault==null?void 0:event.preventDefault();focusOnOtpByIndex(++currentOtpIndex);}else if(key===' '||code==='Space'){event.preventDefault==null?void 0:event.preventDefault();}};var getHiddenInput=function getHiddenInput(){if(!isReactNative){var _ref6;return jsx("input",{hidden:true,id:inputId,name:name,value:(_ref6=inputValue!=null?inputValue:otpValue.join(''))!=null?_ref6:'',readOnly:true});}return null;};var getOTPInputFields=function getOTPInputFields(){var inputs=[];var _loop=function _loop(index){var _otpValue$index,_Array$from$index;var currentValue=inputValue?otpToArray(inputValue)[index]||'':otpValue[index]||'';var ref=React__default.createRef();inputRefs.push(ref);inputs.push(jsx(Box,{flex:1,marginLeft:index==0?'spacing.0':'spacing.3',maxWidth:platform==='onDesktop'?36:40,children:jsx(BaseInput,{autoFocus:autoFocus&&index===0,accessibilityLabel:(index===0?label:'')+" character "+(index+1),label:label,hideLabelText:true,id:inputId+"-"+index,textAlign:"center",ref:ref,value:currentValue,maxCharacters:((_otpValue$index=otpValue[index])==null?void 0:_otpValue$index.length)>0?1:undefined,onChange:function onChange(formEvent){return handleOnChange(_extends({},formEvent,{currentOtpIndex:index}));},onInput:function onInput(formEvent){return handleOnInput(_extends({},formEvent,{currentOtpIndex:index}));},onKeyDown:function onKeyDown(keyboardEvent){return handleOnKeyDown(_extends({},keyboardEvent,{currentOtpIndex:index}));},isDisabled:isDisabled,placeholder:(_Array$from$index=Array.from(placeholder!=null?placeholder:'')[index])!=null?_Array$from$index:'',isRequired:true,autoCompleteSuggestionType:"oneTimeCode",keyboardType:keyboardType,keyboardReturnKeyType:keyboardReturnKeyType,validationState:validationState,successText:successText,errorText:errorText,helpText:helpText,hideFormHint:true,type:isMasked?'password':undefined})},inputId+"-"+index));};for(var index=0;index<otpLength;index++){_loop(index);}return inputs;};return jsxs(Box,_extends({},metaAttribute(),{children:[jsxs(Box,{display:"flex",flexDirection:isLabelLeftPositioned?'row':'column',alignItems:isLabelLeftPositioned?'center':undefined,position:"relative",children:[jsx(FormLabel,{as:"label",position:labelPosition,htmlFor:inputId,children:label}),jsxs(Box,{display:"flex",flexDirection:"row",children:[getHiddenInput(),getOTPInputFields()]})]}),jsx(Box,{marginLeft:isLabelLeftPositioned?136:0,children:jsx(FormHint,{type:getHintType({validationState:validationState,hasHelpText:Boolean(helpText)}),helpText:helpText,errorText:errorText,successText:successText,helpTextId:helpTextId,errorTextId:errorTextId,successTextId:successTextId})})]}));};
|
|
3503
3503
|
|
|
3504
3504
|
var Circle=function Circle(_ref){var cx=_ref.cx,cy=_ref.cy,x=_ref.x,y=_ref.y,r=_ref.r,fill=_ref.fill,stroke=_ref.stroke,strokeWidth=_ref.strokeWidth;return jsx(Circle$1,{cx:cx,cy:cy,x:x,y:y,r:r,fill:fill,stroke:stroke,strokeWidth:strokeWidth});};
|
|
3505
3505
|
|
|
3506
3506
|
var Indicator=function Indicator(_ref){var accessibilityLabel=_ref.accessibilityLabel,children=_ref.children,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$intent=_ref.intent,intent=_ref$intent===void 0?'neutral':_ref$intent;var _useTheme=useTheme(),theme=_useTheme.theme;var fillColor=theme.colors.feedback.background[intent].highContrast;var strokeColor=theme.colors.brand.gray.a100.highContrast;var getDimension=useCallback(function(){switch(size){case'small':return {svgSize:'6',textSize:'small'};case'large':return {svgSize:'10',textSize:'medium'};default:return {svgSize:'8',textSize:'medium'};}},[size]);var dimensions=getDimension();var isReactNative=getPlatformType()==='react-native';var isWeb=!isReactNative;var a11yProps=makeAccessible(_extends({label:accessibilityLabel!=null?accessibilityLabel:children},isWeb&&{role:'status'}));return jsxs(Box,_extends({display:"flex",flexDirection:"row",alignItems:"center"},a11yProps,metaAttribute(),{children:[jsxs(Svg,{width:dimensions.svgSize,height:dimensions.svgSize,viewBox:"0 0 10 10",fill:"none",children:[jsx(Circle,{cx:"5",cy:"5",r:"5",fill:fillColor}),jsx(Circle,{cx:"5",cy:"5",r:"4.75",stroke:strokeColor,strokeWidth:"0.5"})]}),jsx(Box,{marginLeft:"spacing.2",children:jsx(Text,{contrast:"low",type:"subtle",size:dimensions.textSize,children:children})})]}));};
|
|
3507
3507
|
|
|
3508
|
+
/**
|
|
3509
|
+
* The base implementation of `_.clamp` which doesn't coerce arguments.
|
|
3510
|
+
*
|
|
3511
|
+
* @private
|
|
3512
|
+
* @param {number} number The number to clamp.
|
|
3513
|
+
* @param {number} [lower] The lower bound.
|
|
3514
|
+
* @param {number} upper The upper bound.
|
|
3515
|
+
* @returns {number} Returns the clamped number.
|
|
3516
|
+
*/
|
|
3517
|
+
|
|
3518
|
+
function baseClamp$1(number, lower, upper) {
|
|
3519
|
+
if (number === number) {
|
|
3520
|
+
if (upper !== undefined) {
|
|
3521
|
+
number = number <= upper ? number : upper;
|
|
3522
|
+
}
|
|
3523
|
+
if (lower !== undefined) {
|
|
3524
|
+
number = number >= lower ? number : lower;
|
|
3525
|
+
}
|
|
3526
|
+
}
|
|
3527
|
+
return number;
|
|
3528
|
+
}
|
|
3529
|
+
|
|
3530
|
+
var _baseClamp = baseClamp$1;
|
|
3531
|
+
|
|
3532
|
+
/** Used to match a single whitespace character. */
|
|
3533
|
+
|
|
3534
|
+
var reWhitespace = /\s/;
|
|
3535
|
+
|
|
3536
|
+
/**
|
|
3537
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
3538
|
+
* character of `string`.
|
|
3539
|
+
*
|
|
3540
|
+
* @private
|
|
3541
|
+
* @param {string} string The string to inspect.
|
|
3542
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
3543
|
+
*/
|
|
3544
|
+
function trimmedEndIndex$1(string) {
|
|
3545
|
+
var index = string.length;
|
|
3546
|
+
|
|
3547
|
+
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
3548
|
+
return index;
|
|
3549
|
+
}
|
|
3550
|
+
|
|
3551
|
+
var _trimmedEndIndex = trimmedEndIndex$1;
|
|
3552
|
+
|
|
3553
|
+
var trimmedEndIndex = _trimmedEndIndex;
|
|
3554
|
+
|
|
3555
|
+
/** Used to match leading whitespace. */
|
|
3556
|
+
var reTrimStart = /^\s+/;
|
|
3557
|
+
|
|
3558
|
+
/**
|
|
3559
|
+
* The base implementation of `_.trim`.
|
|
3560
|
+
*
|
|
3561
|
+
* @private
|
|
3562
|
+
* @param {string} string The string to trim.
|
|
3563
|
+
* @returns {string} Returns the trimmed string.
|
|
3564
|
+
*/
|
|
3565
|
+
function baseTrim$1(string) {
|
|
3566
|
+
return string
|
|
3567
|
+
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
3568
|
+
: string;
|
|
3569
|
+
}
|
|
3570
|
+
|
|
3571
|
+
var _baseTrim = baseTrim$1;
|
|
3572
|
+
|
|
3573
|
+
var baseTrim = _baseTrim,
|
|
3574
|
+
isObject = isObject_1,
|
|
3575
|
+
isSymbol = isSymbol_1;
|
|
3576
|
+
|
|
3577
|
+
/** Used as references for various `Number` constants. */
|
|
3578
|
+
var NAN = 0 / 0;
|
|
3579
|
+
|
|
3580
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
3581
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
3582
|
+
|
|
3583
|
+
/** Used to detect binary string values. */
|
|
3584
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
3585
|
+
|
|
3586
|
+
/** Used to detect octal string values. */
|
|
3587
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
3588
|
+
|
|
3589
|
+
/** Built-in method references without a dependency on `root`. */
|
|
3590
|
+
var freeParseInt = parseInt;
|
|
3591
|
+
|
|
3592
|
+
/**
|
|
3593
|
+
* Converts `value` to a number.
|
|
3594
|
+
*
|
|
3595
|
+
* @static
|
|
3596
|
+
* @memberOf _
|
|
3597
|
+
* @since 4.0.0
|
|
3598
|
+
* @category Lang
|
|
3599
|
+
* @param {*} value The value to process.
|
|
3600
|
+
* @returns {number} Returns the number.
|
|
3601
|
+
* @example
|
|
3602
|
+
*
|
|
3603
|
+
* _.toNumber(3.2);
|
|
3604
|
+
* // => 3.2
|
|
3605
|
+
*
|
|
3606
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
3607
|
+
* // => 5e-324
|
|
3608
|
+
*
|
|
3609
|
+
* _.toNumber(Infinity);
|
|
3610
|
+
* // => Infinity
|
|
3611
|
+
*
|
|
3612
|
+
* _.toNumber('3.2');
|
|
3613
|
+
* // => 3.2
|
|
3614
|
+
*/
|
|
3615
|
+
function toNumber$1(value) {
|
|
3616
|
+
if (typeof value == 'number') {
|
|
3617
|
+
return value;
|
|
3618
|
+
}
|
|
3619
|
+
if (isSymbol(value)) {
|
|
3620
|
+
return NAN;
|
|
3621
|
+
}
|
|
3622
|
+
if (isObject(value)) {
|
|
3623
|
+
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
3624
|
+
value = isObject(other) ? (other + '') : other;
|
|
3625
|
+
}
|
|
3626
|
+
if (typeof value != 'string') {
|
|
3627
|
+
return value === 0 ? value : +value;
|
|
3628
|
+
}
|
|
3629
|
+
value = baseTrim(value);
|
|
3630
|
+
var isBinary = reIsBinary.test(value);
|
|
3631
|
+
return (isBinary || reIsOctal.test(value))
|
|
3632
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
3633
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
|
3634
|
+
}
|
|
3635
|
+
|
|
3636
|
+
var toNumber_1 = toNumber$1;
|
|
3637
|
+
|
|
3638
|
+
var baseClamp = _baseClamp,
|
|
3639
|
+
toNumber = toNumber_1;
|
|
3640
|
+
|
|
3641
|
+
/**
|
|
3642
|
+
* Clamps `number` within the inclusive `lower` and `upper` bounds.
|
|
3643
|
+
*
|
|
3644
|
+
* @static
|
|
3645
|
+
* @memberOf _
|
|
3646
|
+
* @since 4.0.0
|
|
3647
|
+
* @category Number
|
|
3648
|
+
* @param {number} number The number to clamp.
|
|
3649
|
+
* @param {number} [lower] The lower bound.
|
|
3650
|
+
* @param {number} upper The upper bound.
|
|
3651
|
+
* @returns {number} Returns the clamped number.
|
|
3652
|
+
* @example
|
|
3653
|
+
*
|
|
3654
|
+
* _.clamp(-10, -5, 5);
|
|
3655
|
+
* // => -5
|
|
3656
|
+
*
|
|
3657
|
+
* _.clamp(10, -5, 5);
|
|
3658
|
+
* // => 5
|
|
3659
|
+
*/
|
|
3660
|
+
function clamp(number, lower, upper) {
|
|
3661
|
+
if (upper === undefined) {
|
|
3662
|
+
upper = lower;
|
|
3663
|
+
lower = undefined;
|
|
3664
|
+
}
|
|
3665
|
+
if (upper !== undefined) {
|
|
3666
|
+
upper = toNumber(upper);
|
|
3667
|
+
upper = upper === upper ? upper : 0;
|
|
3668
|
+
}
|
|
3669
|
+
if (lower !== undefined) {
|
|
3670
|
+
lower = toNumber(lower);
|
|
3671
|
+
lower = lower === lower ? lower : 0;
|
|
3672
|
+
}
|
|
3673
|
+
return baseClamp(toNumber(number), lower, upper);
|
|
3674
|
+
}
|
|
3675
|
+
|
|
3676
|
+
var clamp_1 = clamp;
|
|
3677
|
+
|
|
3678
|
+
var indeterminateAnimation={scaleXInitial:1,scaleXMid:5,scaleXFinal:1,leftInitial:'-8%',leftMid:'50%',leftFinal:'103%',fillWidth:'5%'};var pulseAnimation={opacityInitial:0,opacityMid:0.25,opacityFinal:0,backgroundColor:'white'};
|
|
3679
|
+
|
|
3680
|
+
var ProgressBarIndeterminateFilledContainer=styled(Animated.View)(function(_ref){var backgroundColor=_ref.backgroundColor;return {backgroundColor:backgroundColor,height:'100%',width:indeterminateAnimation.fillWidth,position:'absolute'};});var ProgressBarDeterminateFilledContainer=styled(Animated.View)(function(_ref2){var backgroundColor=_ref2.backgroundColor,progress=_ref2.progress;return {backgroundColor:backgroundColor,height:'100%',width:progress+"%"};});var ProgressBarPulseAnimation=styled(Animated.View)({backgroundColor:pulseAnimation.backgroundColor,opacity:pulseAnimation.opacityInitial,width:'100%',height:'100%'});var ProgressBarFilled=function ProgressBarFilled(_ref3){var backgroundColor=_ref3.backgroundColor,progress=_ref3.progress,fillMotionDuration=_ref3.fillMotionDuration,motionEasing=_ref3.motionEasing,pulseMotionDuration=_ref3.pulseMotionDuration,pulseMotionDelay=_ref3.pulseMotionDelay,variant=_ref3.variant,isIndeterminate=_ref3.isIndeterminate,indeterminateMotionDuration=_ref3.indeterminateMotionDuration;var animatedWidth=useSharedValue(progress);var animatedOpacity=useSharedValue(pulseAnimation.opacityInitial);var animatedScaleX=useSharedValue(indeterminateAnimation.scaleXInitial);var animatedLeft=useSharedValue(indeterminateAnimation.leftInitial);var _useTheme=useTheme(),theme=_useTheme.theme;var fillAndPulseEasing=get_1(theme.motion,motionEasing);var pulseDuration=castNativeType(makeMotionTime(get_1(theme.motion,pulseMotionDuration)))/2;useEffect(function(){var fillDuration=castNativeType(makeMotionTime(get_1(theme.motion,fillMotionDuration)));animatedWidth.value=withTiming(progress,{duration:fillDuration,easing:fillAndPulseEasing});return function(){cancelAnimation(animatedWidth);};},[progress,animatedWidth,fillMotionDuration,theme,fillAndPulseEasing]);var progressFillAnimatedStyle=useAnimatedStyle(function(){var _f=function _f(){return {width:animatedWidth.value+"%"};};_f._closure={animatedWidth:animatedWidth};_f.asString="function _f(){const{animatedWidth}=jsThis._closure;{return{width:animatedWidth.value+\"%\"};}}";_f.__workletHash=1064279234695;_f.__location="/home/runner/work/blade/blade/packages/blade/src/components/ProgressBar/ProgressBarFilled.native.tsx (76:53)";_f.__optimalization=3;global.__reanimatedWorkletInit(_f);return _f;}());useEffect(function(){if(variant==='progress'&&isIndeterminate){var indeterminateDuration=castNativeType(makeMotionTime(get_1(theme.motion,indeterminateMotionDuration)));var indeterminateEasing=Easing.linear;animatedLeft.value=withRepeat(withTiming(indeterminateAnimation.leftFinal,{duration:indeterminateDuration,easing:indeterminateEasing}),-1);animatedScaleX.value=withRepeat(withSequence(withTiming(indeterminateAnimation.scaleXMid,{duration:indeterminateDuration/2,easing:indeterminateEasing}),withTiming(indeterminateAnimation.scaleXFinal,{duration:indeterminateDuration/2,easing:indeterminateEasing})),-1);}return function(){cancelAnimation(animatedLeft);cancelAnimation(animatedScaleX);};},[animatedLeft,animatedScaleX,indeterminateMotionDuration,isIndeterminate,theme,variant]);var indeterminateAnimatedStyle=useAnimatedStyle(function(){var _f=function _f(){return {left:animatedLeft.value,transform:[{scaleX:animatedScaleX.value}]};};_f._closure={animatedLeft:animatedLeft,animatedScaleX:animatedScaleX};_f.asString="function _f(){const{animatedLeft,animatedScaleX}=jsThis._closure;{return{left:animatedLeft.value,transform:[{scaleX:animatedScaleX.value}]};}}";_f.__workletHash=2119202994717;_f.__location="/home/runner/work/blade/blade/packages/blade/src/components/ProgressBar/ProgressBarFilled.native.tsx (122:54)";_f.__optimalization=3;global.__reanimatedWorkletInit(_f);return _f;}());useEffect(function(){var pulsatingAnimationTimingConfig={duration:pulseDuration,easing:fillAndPulseEasing};if(variant==='progress'){animatedOpacity.value=withDelay(castNativeType(makeMotionTime(get_1(theme.motion,pulseMotionDelay))),withRepeat(withSequence(withTiming(pulseAnimation.opacityMid,pulsatingAnimationTimingConfig),withTiming(pulseAnimation.opacityFinal,pulsatingAnimationTimingConfig)),-1));}return function(){cancelAnimation(animatedOpacity);};},[animatedOpacity,fillAndPulseEasing,pulseDuration,pulseMotionDelay,theme,variant]);var pulseAnimatedStyle=useAnimatedStyle(function(){var _f=function _f(){return {opacity:animatedOpacity.value};};_f._closure={animatedOpacity:animatedOpacity};_f.asString="function _f(){const{animatedOpacity}=jsThis._closure;{return{opacity:animatedOpacity.value};}}";_f.__workletHash=3015944804182;_f.__location="/home/runner/work/blade/blade/packages/blade/src/components/ProgressBar/ProgressBarFilled.native.tsx (154:46)";_f.__optimalization=3;global.__reanimatedWorkletInit(_f);return _f;}());var ProgressBarFilledContainer=isIndeterminate?ProgressBarIndeterminateFilledContainer:ProgressBarDeterminateFilledContainer;return jsx(ProgressBarFilledContainer,{style:isIndeterminate?indeterminateAnimatedStyle:progressFillAnimatedStyle,backgroundColor:backgroundColor,progress:progress,children:jsx(ProgressBarPulseAnimation,{style:pulseAnimatedStyle})});};
|
|
3681
|
+
|
|
3682
|
+
var progressBarHeight={small:2,medium:4};var ProgressBar=function ProgressBar(_ref){var _label$trim;var accessibilityLabel=_ref.accessibilityLabel,_ref$contrast=_ref.contrast,contrast=_ref$contrast===void 0?'low':_ref$contrast,intent=_ref.intent,_ref$isIndeterminate=_ref.isIndeterminate,isIndeterminate=_ref$isIndeterminate===void 0?false:_ref$isIndeterminate,label=_ref.label,_ref$showPercentage=_ref.showPercentage,showPercentage=_ref$showPercentage===void 0?true:_ref$showPercentage,_ref$size=_ref.size,size=_ref$size===void 0?'small':_ref$size,_ref$value=_ref.value,value=_ref$value===void 0?0:_ref$value,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'progress':_ref$variant,_ref$min=_ref.min,min=_ref$min===void 0?0:_ref$min,_ref$max=_ref.max,max=_ref$max===void 0?100:_ref$max;var _useTheme=useTheme(),theme=_useTheme.theme;var id=useId(variant);if(variant==='meter'&&isIndeterminate){throw new Error("[Blade: ProgressBar]: Cannot set 'isIndeterminate' when 'variant' is 'meter'.");}var unfilledBackgroundColor=theme.colors.brand.gray.a100[contrast+"Contrast"];var filledBackgroundColor=intent?theme.colors.feedback.background[intent].highContrast:theme.colors.brand.primary[500];var hasLabel=label&&((_label$trim=label.trim())==null?void 0:_label$trim.length)>0;var isMeter=variant==='meter';var progressValue=clamp_1(value,min,max);var percentageProgressValue=Math.floor((progressValue-min)*100/(max-min));var shouldShowPercentage=showPercentage&&!isMeter&&!isIndeterminate;var accessibilityProps={role:'progressbar',label:accessibilityLabel!=null?accessibilityLabel:label,valueNow:percentageProgressValue,valueText:percentageProgressValue+"%",valueMin:min,valueMax:max};if(isMeter){accessibilityProps.role='meter';accessibilityProps.valueNow=progressValue;accessibilityProps.valueText=""+progressValue;}if(isIndeterminate){accessibilityProps.valueNow=undefined;accessibilityProps.valueMin=undefined;accessibilityProps.valueMax=undefined;accessibilityProps.valueText=undefined;}return jsxs(Fragment$1,{children:[jsxs(Box,{display:"flex",flexDirection:"row",justifyContent:hasLabel?'space-between':'flex-end',children:[hasLabel?jsx(FormLabel,{as:"label",htmlFor:id,contrast:contrast,children:label}):null,shouldShowPercentage?jsx(Box,{marginBottom:"spacing.2",children:jsx(Text,{type:"subdued",variant:"body",contrast:contrast,size:"small",children:percentageProgressValue+"%"})}):null]}),jsx(Box,_extends({id:id},metaAttribute(),makeAccessible({role:accessibilityProps.role,label:accessibilityProps.label,valueNow:accessibilityProps.valueNow,valueText:accessibilityProps.valueText,valueMin:accessibilityProps.valueMin,valueMax:accessibilityProps.valueMax}),{children:jsx(Box,{backgroundColor:unfilledBackgroundColor,height:makeSize(progressBarHeight[size]),overflow:"hidden",position:"relative",children:jsx(ProgressBarFilled,{backgroundColor:filledBackgroundColor,progress:percentageProgressValue,fillMotionDuration:"duration.2xgentle",pulseMotionDuration:"duration.2xgentle",indeterminateMotionDuration:"duration.2xgentle",pulseMotionDelay:"delay.long",motionEasing:"easing.standard.revealing",variant:variant,isIndeterminate:isIndeterminate})})}))]});};
|
|
3683
|
+
|
|
3508
3684
|
var useRadio=function useRadio(_ref){var isChecked=_ref.isChecked,defaultChecked=_ref.defaultChecked,isDisabled=_ref.isDisabled,isRequired=_ref.isRequired,hasError=_ref.hasError,onChange=_ref.onChange,name=_ref.name,value=_ref.value;var inputRef=React__default.useRef(null);var isReactNative=getPlatformType()==='react-native';if(isChecked&&defaultChecked){throw new Error("[Blade: Radio]: Do not provide both 'isChecked' and 'defaultChecked' to useRadio. Consider if you want this component to be controlled or uncontrolled.");}var _useControllableState=useControllableState({value:isChecked,defaultValue:defaultChecked!=null?defaultChecked:false}),_useControllableState2=_slicedToArray(_useControllableState,2),radioState=_useControllableState2[0],setRadioState=_useControllableState2[1];var handleOnChange=function handleOnChange(event){if(isDisabled){event.stopPropagation();event.preventDefault();return;}setRadioState(function(checked){if(checked===false){onChange==null?void 0:onChange({isChecked:true,event:event,value:value});return true;}return checked;});};var state={isChecked:radioState,setChecked:setRadioState};var idBase=useId('radio');var helpTextId=useId(idBase+"-helptext");var accessibilityProps=makeAccessible({role:'radio',required:Boolean(isRequired),invalid:Boolean(hasError),disabled:Boolean(isDisabled),checked:radioState,describedBy:helpTextId});if(isReactNative){return {state:state,inputProps:_extends({onPress:handleOnChange,name:name,value:value},accessibilityProps)};}return {state:state,ids:{helpTextId:helpTextId},inputProps:_extends({ref:inputRef,onChange:handleOnChange,type:'radio',name:name,value:value,checked:radioState,disabled:isDisabled,required:isRequired},accessibilityProps)};};
|
|
3509
3685
|
|
|
3510
3686
|
var radioSizes={group:{gap:{small:{mobile:'spacing.2',desktop:'spacing.0'},medium:{mobile:'spacing.3',desktop:'spacing.2'}}},icon:{small:{width:12,height:12,dotRadius:2},medium:{width:16,height:16,dotRadius:3}}};var radioIconColors={variants:{default:{dot:{checked:'colors.brand.gray.200.lowContrast',unchecked:'colors.brand.gray.200.lowContrast'},border:{checked:'colors.brand.primary.500',unchecked:'colors.brand.gray.500.lowContrast'},background:{checked:'colors.brand.primary.500',unchecked:'transparent'}},disabled:{dot:{checked:'colors.brand.gray.200.lowContrast',unchecked:'colors.brand.gray.200.lowContrast'},border:{checked:'transparent',unchecked:'colors.brand.gray.a100.lowContrast'},background:{checked:'colors.brand.gray.a100.lowContrast',unchecked:'transparent'}},negative:{dot:{checked:'colors.brand.gray.200.lowContrast',unchecked:'colors.brand.gray.200.lowContrast'},border:{checked:'colors.feedback.border.negative.highContrast',unchecked:'colors.feedback.border.negative.highContrast'},background:{checked:'colors.feedback.background.negative.highContrast',unchecked:'colors.feedback.background.negative.lowContrast'}}}};
|
|
@@ -3523,9 +3699,9 @@ var Radio=function Radio(_ref){var _groupProps$state,_groupProps$size;var value=
|
|
|
3523
3699
|
|
|
3524
3700
|
var useRadioGroup=function useRadioGroup(_ref){var value=_ref.value,defaultValue=_ref.defaultValue,isDisabled=_ref.isDisabled,labelPosition=_ref.labelPosition,_onChange=_ref.onChange,validationState=_ref.validationState,necessityIndicator=_ref.necessityIndicator,name=_ref.name,size=_ref.size;var _useTheme=useTheme(),platform=_useTheme.platform;var idBase=useId('radio-group');var labelId=idBase+"-label";var fallbackName=name!=null?name:idBase;var _useControllableState=useControllableState({value:value,defaultValue:defaultValue,onChange:function onChange(v){return _onChange==null?void 0:_onChange({value:v,name:fallbackName});}}),_useControllableState2=_slicedToArray(_useControllableState,2),checkedValue=_useControllableState2[0],setValue=_useControllableState2[1];var state=React__default.useMemo(function(){return {value:checkedValue,setValue:function(_setValue){function setValue(_x){return _setValue.apply(this,arguments);}setValue.toString=function(){return _setValue.toString();};return setValue;}(function(v){if(isDisabled){return;}setValue(function(){return v;});}),removeValue:function removeValue(){if(isDisabled){return;}setValue(undefined);},isChecked:function isChecked(v){if(isUndefined_1(v)||isUndefined_1(checkedValue))return false;return checkedValue===v;}};},[checkedValue,isDisabled,setValue]);var contextValue=React__default.useMemo(function(){return {necessityIndicator:necessityIndicator,validationState:validationState,isDisabled:isDisabled,labelPosition:platform==='onMobile'?'top':labelPosition,name:fallbackName,state:state,size:size};},[validationState,isDisabled,platform,labelPosition,state,fallbackName,necessityIndicator,size]);return {state:state,contextValue:contextValue,ids:{labelId:labelId}};};
|
|
3525
3701
|
|
|
3526
|
-
var RadioGroup=function RadioGroup(_ref){var children=_ref.children,label=_ref.label,helpText=_ref.helpText,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,_ref$necessityIndicat=_ref.necessityIndicator,necessityIndicator=_ref$necessityIndicat===void 0?'none':_ref$necessityIndicat,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,_ref$validationState=_ref.validationState,validationState=_ref$validationState===void 0?'none':_ref$validationState,errorText=_ref.errorText,name=_ref.name,defaultValue=_ref.defaultValue,onChange=_ref.onChange,value=_ref.value,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size;var _useRadioGroup=useRadioGroup({defaultValue:defaultValue,isDisabled:isDisabled,labelPosition:labelPosition,name:name,onChange:onChange,validationState:validationState,value:value,size:size}),contextValue=_useRadioGroup.contextValue,ids=_useRadioGroup.ids;var _useTheme=useTheme(),theme=_useTheme.theme;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var showError=validationState==='error'&&errorText;var showHelpText=!showError&&helpText;var accessibilityText=
|
|
3702
|
+
var RadioGroup=function RadioGroup(_ref){var children=_ref.children,label=_ref.label,helpText=_ref.helpText,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,_ref$necessityIndicat=_ref.necessityIndicator,necessityIndicator=_ref$necessityIndicat===void 0?'none':_ref$necessityIndicat,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,_ref$validationState=_ref.validationState,validationState=_ref$validationState===void 0?'none':_ref$validationState,errorText=_ref.errorText,name=_ref.name,defaultValue=_ref.defaultValue,onChange=_ref.onChange,value=_ref.value,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size;var _useRadioGroup=useRadioGroup({defaultValue:defaultValue,isDisabled:isDisabled,labelPosition:labelPosition,name:name,onChange:onChange,validationState:validationState,value:value,size:size}),contextValue=_useRadioGroup.contextValue,ids=_useRadioGroup.ids;var _useTheme=useTheme(),theme=_useTheme.theme;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var showError=validationState==='error'&&errorText;var showHelpText=!showError&&helpText;var accessibilityText=((showError?errorText:'')+" "+(showHelpText?helpText:'')).trim();var isReactNative=getPlatformType()==='react-native';var gap=radioSizes.group.gap[size][matchedDeviceType];var childCount=React__default.Children.count(children);return jsx(RadioGroupProvider,{value:contextValue,children:jsxs(SelectorGroupField,{position:labelPosition,labelledBy:ids.labelId,accessibilityRole:isReactNative?'radiogroup':'group',componentName:"radio-group",children:[jsx(FormLabel,{as:"span",necessityIndicator:necessityIndicator,position:labelPosition,id:ids.labelId,accessibilityText:accessibilityText&&","+accessibilityText,children:label}),jsxs(Box,{children:[jsx(Box,{display:"flex",flexDirection:"column",children:React__default.Children.map(children,function(child,index){return jsx(Box,{marginBottom:index===childCount-1?0:gap,children:child},index);})}),jsx(FormHint,{type:validationState==='error'?'error':'help',errorText:errorText,helpText:helpText})]})]})});};
|
|
3527
3703
|
|
|
3528
3704
|
var SkipNavLink=function SkipNavLink(_props){throw new Error('[Blade: SkipNav]: SkipNavLink is not available on React Native');};var SkipNavContent=function SkipNavContent(_props){throw new Error('[Blade: SkipNav]: SkipNavContent is not available on React Native');};
|
|
3529
3705
|
|
|
3530
|
-
export { Alert, AlertTriangleIcon as AlertOctagonIcon, AlertTriangleIcon$1 as AlertTriangleIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, ArrowUpRightIcon, Badge, BladeProvider, Button, Card, CardBody, CardFooter, CardFooterLeading, CardFooterTrailing, CardHeader, CardHeaderBadge, CardHeaderCounter, CardHeaderIcon, CardHeaderIconButton, CardHeaderLeading, CardHeaderLink, CardHeaderText, CardHeaderTrailing, CheckCircleIcon, CheckIcon, Checkbox, CheckboxGroup, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, Code, Counter, CreditCardIcon, DollarIcon, DownloadIcon, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, FileTextIcon, Heading, HelpCircleIcon, HistoryIcon, HomeIcon, IconButton, Indicator, InfoIcon, Link, LinkIcon, LockIcon, MailIcon, MinusIcon, OTPInput, PasswordInput, PauseIcon, PlusIcon, Radio, RadioGroup, RefreshLeftIcon, RotateCounterClockWiseIcon, RupeeIcon, SearchIcon, SettingsIcon, SkipNavContent, SkipNavLink, SlashIcon, Spinner, Text, TextArea, TextInput, Title, TrashIcon, TrendingDownIcon, TrendingUpIcon, UsersIcon, VisuallyHidden, announce, clearAnnouncer, destroyAnnouncer, getTextProps, screenReaderStyles, useTheme };
|
|
3706
|
+
export { Alert, AlertTriangleIcon as AlertOctagonIcon, AlertTriangleIcon$1 as AlertTriangleIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, ArrowUpRightIcon, Badge, BladeProvider, Button, Card, CardBody, CardFooter, CardFooterLeading, CardFooterTrailing, CardHeader, CardHeaderBadge, CardHeaderCounter, CardHeaderIcon, CardHeaderIconButton, CardHeaderLeading, CardHeaderLink, CardHeaderText, CardHeaderTrailing, CheckCircleIcon, CheckIcon, Checkbox, CheckboxGroup, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, Code, Counter, CreditCardIcon, DollarIcon, DownloadIcon, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, FileTextIcon, Heading, HelpCircleIcon, HistoryIcon, HomeIcon, IconButton, Indicator, InfoIcon, Link, LinkIcon, LockIcon, MailIcon, MinusIcon, OTPInput, PasswordInput, PauseIcon, PlusIcon, ProgressBar, Radio, RadioGroup, RefreshLeftIcon, RotateCounterClockWiseIcon, RupeeIcon, SearchIcon, SettingsIcon, SkipNavContent, SkipNavLink, SlashIcon, Spinner, Text, TextArea, TextInput, Title, TrashIcon, TrendingDownIcon, TrendingUpIcon, UsersIcon, VisuallyHidden, announce, clearAnnouncer, destroyAnnouncer, getTextProps, screenReaderStyles, useTheme };
|
|
3531
3707
|
//# sourceMappingURL=index.native.js.map
|