@razorpay/blade 5.2.1 → 5.4.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 +12 -0
- package/build/components/index.d.ts +334 -44
- package/build/components/index.native.d.ts +332 -42
- package/build/components/index.native.js +222 -32
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.web.js +918 -140
- 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 +1 -1
- package/build/tokens/index.native.js.map +1 -1
- package/build/tokens/index.web.js +1 -1
- package/build/tokens/index.web.js.map +1 -1
- package/build/utils/index.d.ts +23 -3
- package/build/utils/index.native.d.ts +23 -3
- package/build/utils/index.native.js +6 -4
- package/build/utils/index.native.js.map +1 -1
- package/build/utils/index.web.js +31 -3
- package/build/utils/index.web.js.map +1 -1
- package/package.json +1 -1
|
@@ -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 + '');
|
|
@@ -2512,7 +2512,9 @@ var Symbol = _Symbol;
|
|
|
2512
2512
|
var symbolProto = Symbol ? Symbol.prototype : undefined;
|
|
2513
2513
|
symbolProto ? symbolProto.valueOf : undefined;
|
|
2514
2514
|
|
|
2515
|
-
var
|
|
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
|
+
|
|
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'};
|
|
2516
2518
|
|
|
2517
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;};
|
|
2518
2520
|
|
|
@@ -2756,7 +2758,7 @@ var assignMergeValue$1 = _assignMergeValue,
|
|
|
2756
2758
|
isArrayLikeObject = isArrayLikeObject_1,
|
|
2757
2759
|
isBuffer = isBuffer$3.exports,
|
|
2758
2760
|
isFunction = isFunction_1,
|
|
2759
|
-
isObject$
|
|
2761
|
+
isObject$3 = isObject_1,
|
|
2760
2762
|
isPlainObject = isPlainObject_1,
|
|
2761
2763
|
isTypedArray = isTypedArray_1,
|
|
2762
2764
|
safeGet$1 = _safeGet,
|
|
@@ -2822,7 +2824,7 @@ function baseMergeDeep$1(object, source, key, srcIndex, mergeFunc, customizer, s
|
|
|
2822
2824
|
if (isArguments(objValue)) {
|
|
2823
2825
|
newValue = toPlainObject(objValue);
|
|
2824
2826
|
}
|
|
2825
|
-
else if (!isObject$
|
|
2827
|
+
else if (!isObject$3(objValue) || isFunction(objValue)) {
|
|
2826
2828
|
newValue = initCloneObject(srcValue);
|
|
2827
2829
|
}
|
|
2828
2830
|
}
|
|
@@ -2845,7 +2847,7 @@ var Stack = _Stack,
|
|
|
2845
2847
|
assignMergeValue = _assignMergeValue,
|
|
2846
2848
|
baseFor = _baseFor,
|
|
2847
2849
|
baseMergeDeep = _baseMergeDeep,
|
|
2848
|
-
isObject$
|
|
2850
|
+
isObject$2 = isObject_1,
|
|
2849
2851
|
keysIn = keysIn_1,
|
|
2850
2852
|
safeGet = _safeGet;
|
|
2851
2853
|
|
|
@@ -2866,7 +2868,7 @@ function baseMerge$1(object, source, srcIndex, customizer, stack) {
|
|
|
2866
2868
|
}
|
|
2867
2869
|
baseFor(source, function(srcValue, key) {
|
|
2868
2870
|
stack || (stack = new Stack);
|
|
2869
|
-
if (isObject$
|
|
2871
|
+
if (isObject$2(srcValue)) {
|
|
2870
2872
|
baseMergeDeep(object, source, key, srcIndex, baseMerge$1, customizer, stack);
|
|
2871
2873
|
}
|
|
2872
2874
|
else {
|
|
@@ -3093,7 +3095,7 @@ var _baseRest = baseRest$1;
|
|
|
3093
3095
|
var eq = eq_1,
|
|
3094
3096
|
isArrayLike = isArrayLike_1,
|
|
3095
3097
|
isIndex = _isIndex,
|
|
3096
|
-
isObject = isObject_1;
|
|
3098
|
+
isObject$1 = isObject_1;
|
|
3097
3099
|
|
|
3098
3100
|
/**
|
|
3099
3101
|
* Checks if the given arguments are from an iteratee call.
|
|
@@ -3106,7 +3108,7 @@ var eq = eq_1,
|
|
|
3106
3108
|
* else `false`.
|
|
3107
3109
|
*/
|
|
3108
3110
|
function isIterateeCall$1(value, index, object) {
|
|
3109
|
-
if (!isObject(object)) {
|
|
3111
|
+
if (!isObject$1(object)) {
|
|
3110
3112
|
return false;
|
|
3111
3113
|
}
|
|
3112
3114
|
var type = typeof index;
|
|
@@ -3325,13 +3327,13 @@ var StyledPressable$1=styled.Pressable({alignSelf:'center'});var StyledIconButto
|
|
|
3325
3327
|
|
|
3326
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});};
|
|
3327
3329
|
|
|
3328
|
-
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;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};};
|
|
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};};
|
|
3329
3331
|
|
|
3330
3332
|
var Box=styled.View(getBoxStyles);
|
|
3331
3333
|
|
|
3332
3334
|
var getBaseTextStyles=function getBaseTextStyles(_ref){var _ref$color=_ref.color,color=_ref$color===void 0?'surface.text.normal.lowContrast':_ref$color,_ref$fontFamily=_ref.fontFamily,fontFamily=_ref$fontFamily===void 0?'text':_ref$fontFamily,_ref$fontSize=_ref.fontSize,fontSize=_ref$fontSize===void 0?200:_ref$fontSize,_ref$fontWeight=_ref.fontWeight,fontWeight=_ref$fontWeight===void 0?'regular':_ref$fontWeight,_ref$fontStyle=_ref.fontStyle,fontStyle=_ref$fontStyle===void 0?'normal':_ref$fontStyle,_ref$textDecorationLi=_ref.textDecorationLine,textDecorationLine=_ref$textDecorationLi===void 0?'none':_ref$textDecorationLi,_ref$lineHeight=_ref.lineHeight,lineHeight=_ref$lineHeight===void 0?'l':_ref$lineHeight,textAlign=_ref.textAlign,theme=_ref.theme;var textColor=get_1(theme.colors,color);var themeFontFamily=theme.typography.fonts.family[fontFamily];var themeFontSize=makeTypographySize(theme.typography.fonts.size[fontSize]);var themeFontWeight=theme.typography.fonts.weight[fontWeight];var themeLineHeight=makeTypographySize(theme.typography.lineHeights[lineHeight]);return {color:textColor,fontFamily:themeFontFamily,fontSize:themeFontSize,fontWeight:themeFontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,lineHeight:themeLineHeight,textAlign:textAlign,margin:0,padding:0};};
|
|
3333
3335
|
|
|
3334
|
-
var _excluded$
|
|
3336
|
+
var _excluded$4=["color","fontFamily","fontSize","fontWeight","fontStyle","textDecorationLine","lineHeight","textAlign","as"];var StyledBaseText=styled.Text(function(_ref){var color=_ref.color,fontFamily=_ref.fontFamily,fontSize=_ref.fontSize,fontWeight=_ref.fontWeight,fontStyle=_ref.fontStyle,textDecorationLine=_ref.textDecorationLine,lineHeight=_ref.lineHeight,textAlign=_ref.textAlign,as=_ref.as,props=_objectWithoutProperties(_ref,_excluded$4);if(as){throw new Error("[Blade: BaseText]: \"as\" prop is not supported for BaseText on React Native");}else {return getBaseTextStyles({color:color,fontFamily:fontFamily,fontSize:fontSize,fontWeight:fontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,lineHeight:lineHeight,textAlign:textAlign,theme:props.theme});}});var BaseText=function BaseText(_ref2){var id=_ref2.id,color=_ref2.color,fontFamily=_ref2.fontFamily,fontSize=_ref2.fontSize,fontWeight=_ref2.fontWeight,fontStyle=_ref2.fontStyle,textDecorationLine=_ref2.textDecorationLine,lineHeight=_ref2.lineHeight,as=_ref2.as,textAlign=_ref2.textAlign,children=_ref2.children,truncateAfterLines=_ref2.truncateAfterLines,className=_ref2.className,style=_ref2.style,_ref2$accessibilityPr=_ref2.accessibilityProps,accessibilityProps=_ref2$accessibilityPr===void 0?{}:_ref2$accessibilityPr;_ref2.componentName;return jsx(StyledBaseText,_extends({color:color,fontFamily:fontFamily,fontSize:fontSize,fontWeight:fontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,lineHeight:lineHeight,as:as,textAlign:textAlign,numberOfLines:truncateAfterLines,className:className,style:style,id:id},makeAccessible(accessibilityProps),metaAttribute(),{children:children}));};
|
|
3335
3337
|
|
|
3336
3338
|
var getProps$3=function getProps(_ref){var size=_ref.size,type=_ref.type,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:600,fontWeight:'bold',fontStyle:'normal',lineHeight:'4xl',fontFamily:'text',accessibilityProps:isPlatformWeb?{}:{role:'heading'},componentName:'title'};if(size==='small'){props.fontSize=600;props.lineHeight='4xl';props.as=isPlatformWeb?'h3':undefined;}else if(size==='medium'){props.fontSize=700;props.lineHeight='4xl';props.as=isPlatformWeb?'h2':undefined;}else if(size==='large'){props.fontSize=1000;props.lineHeight='6xl';props.as=isPlatformWeb?'h1':undefined;}return props;};var Title=function Title(_ref2){var _ref2$size=_ref2.size,size=_ref2$size===void 0?'small':_ref2$size,_ref2$type=_ref2.type,type=_ref2$type===void 0?'normal':_ref2$type,_ref2$contrast=_ref2.contrast,contrast=_ref2$contrast===void 0?'low':_ref2$contrast,children=_ref2.children;var props=getProps$3({size:size,type:type,contrast:contrast});return jsx(BaseText,_extends({},props,{children:children}));};
|
|
3337
3339
|
|
|
@@ -3365,7 +3367,7 @@ var StyledNativeLink=styled.Pressable(_extends({},getStyledLinkStyles({}),{align
|
|
|
3365
3367
|
|
|
3366
3368
|
var useInteraction=function useInteraction(){var _useState=useState('default'),_useState2=_slicedToArray(_useState,2),currentInteraction=_useState2[0],setCurrentInteraction=_useState2[1];var onMouseEnter=function onMouseEnter(){if(currentInteraction!=='active')setCurrentInteraction('hover');};var onMouseLeave=function onMouseLeave(){if(currentInteraction!=='active')setCurrentInteraction('default');};var onFocus=function onFocus(){setCurrentInteraction('active');};var onBlur=function onBlur(){setCurrentInteraction('default');};return {onMouseEnter:onMouseEnter,onMouseLeave:onMouseLeave,onFocus:onFocus,onBlur:onBlur,currentInteraction:currentInteraction,setCurrentInteraction:setCurrentInteraction};};
|
|
3367
3369
|
|
|
3368
|
-
var _excluded$
|
|
3370
|
+
var _excluded$3=["currentInteraction","setCurrentInteraction"];var getColorToken=function getColorToken(_ref){var variant=_ref.variant,intent=_ref.intent,contrast=_ref.contrast,element=_ref.element,currentInteraction=_ref.currentInteraction,isDisabled=_ref.isDisabled,isVisited=_ref.isVisited;var state=currentInteraction;if(isDisabled&&variant=='button'){state='disabled';}if(isVisited&&variant=='anchor'&&!intent){state='visited';}if(intent&&state!=='visited'){return "feedback."+intent+".action."+element+".link."+state+"."+contrast+"Contrast";}return "action."+element+".link."+state;};var getProps=function getProps(_ref2){var theme=_ref2.theme,variant=_ref2.variant,currentInteraction=_ref2.currentInteraction,children=_ref2.children,isDisabled=_ref2.isDisabled,intent=_ref2.intent,contrast=_ref2.contrast,isVisited=_ref2.isVisited,target=_ref2.target,size=_ref2.size;var isButton=variant==='button';var props={as:isButton?'button':'a',textDecorationLine:!isButton&¤tInteraction!=='default'?'underline':'none',iconColor:getColorToken({variant:variant,intent:intent,contrast:contrast,element:'icon',currentInteraction:currentInteraction,isDisabled:isDisabled,isVisited:isVisited}),fontSize:size==='medium'?100:75,iconSize:size,iconPadding:children!=null&&children.trim()?'spacing.2':'spacing.0',textColor:getColorToken({variant:variant,intent:intent,contrast:contrast,element:'text',currentInteraction:currentInteraction,isDisabled:isDisabled,isVisited:isVisited}),focusRingColor:get_1(theme.colors,'brand.primary.400'),motionDuration:'duration.2xquick',motionEasing:'easing.standard.effective',cursor:isButton&&isDisabled?'not-allowed':'pointer',disabled:isButton&&isDisabled,role:isButton?'button':'link',defaultRel:target&&target==='_blank'?'noreferrer noopener':undefined,type:isButton?'button':undefined};return props;};var BaseLink=function BaseLink(_ref3){var children=_ref3.children,Icon=_ref3.icon,_ref3$iconPosition=_ref3.iconPosition,iconPosition=_ref3$iconPosition===void 0?'left':_ref3$iconPosition,_ref3$isDisabled=_ref3.isDisabled,isDisabled=_ref3$isDisabled===void 0?false:_ref3$isDisabled,onClick=_ref3.onClick,_ref3$variant=_ref3.variant,variant=_ref3$variant===void 0?'anchor':_ref3$variant,href=_ref3.href,target=_ref3.target,rel=_ref3.rel,intent=_ref3.intent,_ref3$contrast=_ref3.contrast,contrast=_ref3$contrast===void 0?'low':_ref3$contrast,accessibilityLabel=_ref3.accessibilityLabel,className=_ref3.className,style=_ref3.style,_ref3$size=_ref3.size,size=_ref3$size===void 0?'medium':_ref3$size;var _useState=useState(false),_useState2=_slicedToArray(_useState,2),isVisited=_useState2[0],setIsVisited=_useState2[1];var _useInteraction=useInteraction(),currentInteraction=_useInteraction.currentInteraction,setCurrentInteraction=_useInteraction.setCurrentInteraction,syntheticEvents=_objectWithoutProperties(_useInteraction,_excluded$3);var _useTheme=useTheme(),theme=_useTheme.theme;if(!Icon&&!(children!=null&&children.trim())){throw new Error("[Blade: BaseLink]: At least one of icon or text is required to render a link.");}var _getProps=getProps({theme:theme,variant:variant,currentInteraction:currentInteraction,children:children,isDisabled:isDisabled,intent:intent,contrast:contrast,isVisited:isVisited,target:target,size:size}),as=_getProps.as,textDecorationLine=_getProps.textDecorationLine,iconColor=_getProps.iconColor,iconPadding=_getProps.iconPadding,iconSize=_getProps.iconSize,fontSize=_getProps.fontSize,textColor=_getProps.textColor,focusRingColor=_getProps.focusRingColor,motionDuration=_getProps.motionDuration,motionEasing=_getProps.motionEasing,cursor=_getProps.cursor,disabled=_getProps.disabled,role=_getProps.role,defaultRel=_getProps.defaultRel,type=_getProps.type;var handleOnClick=function handleOnClick(event){if(!isVisited&&!intent&&variant==='anchor'){setIsVisited(true);}if(onClick){onClick(event);}};return jsx(StyledLink,_extends({},syntheticEvents,metaAttribute(),{accessibilityProps:_extends({},makeAccessible({role:role,label:accessibilityLabel,disabled:disabled})),variant:variant,as:as,href:href,target:target,rel:rel!=null?rel:defaultRel,onClick:handleOnClick,disabled:disabled,type:type,cursor:cursor,focusRingColor:focusRingColor,motionDuration:motionDuration,motionEasing:motionEasing,setCurrentInteraction:setCurrentInteraction,className:className,style:style,children:jsxs(Box,{display:"flex",flexDirection:"row",className:"content-container",alignItems:"center",children:[Icon&&iconPosition=='left'?jsx(Box,{paddingRight:iconPadding,display:"flex",alignItems:"center",children:jsx(Icon,{color:iconColor,size:iconSize})}):null,jsx(BaseText,{textDecorationLine:textDecorationLine,color:textColor,fontSize:fontSize,textAlign:"center",fontWeight:"bold",children:children}),Icon&&iconPosition=='right'?jsx(Box,{paddingLeft:iconPadding,display:"flex",alignItems:"center",children:jsx(Icon,{color:iconColor,size:iconSize})}):null]})}));};
|
|
3369
3371
|
|
|
3370
3372
|
var isReactNative$3=getPlatformType()==='react-native';var CloseButtonWrapper=isReactNative$3?Box:Fragment;var intentIconMap={positive:CheckCircleIcon,negative:AlertTriangleIcon,information:InfoIcon,neutral:InfoIcon,notice:AlertTriangleIcon$1};var Alert=function Alert(_ref){var description=_ref.description,title=_ref.title,_ref$isDismissable=_ref.isDismissable,isDismissable=_ref$isDismissable===void 0?true:_ref$isDismissable,onDismiss=_ref.onDismiss,_ref$contrast=_ref.contrast,contrast=_ref$contrast===void 0?'low':_ref$contrast,_ref$isFullWidth=_ref.isFullWidth,isFullWidth=_ref$isFullWidth===void 0?false:_ref$isFullWidth,_ref$intent=_ref.intent,intent=_ref$intent===void 0?'neutral':_ref$intent,actions=_ref.actions;if(!(actions!=null&&actions.primary)&&actions!=null&&actions.secondary){throw new Error('[Blade: Alert]: SecondaryAction is allowed only when PrimaryAction is defined.');}var _useTheme=useTheme(),theme=_useTheme.theme;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var isDesktop=matchedDeviceType==='desktop';var isMobile=!isDesktop;var _useState=useState(true),_useState2=_slicedToArray(_useState,2),isVisible=_useState2[0],setIsVisible=_useState2[1];var contrastType=contrast+"Contrast";var iconSize=isFullWidth?'large':'medium';var textSize=isFullWidth?'medium':'small';var Icon=intentIconMap[intent];var iconOffset='spacing.1';if(isReactNative$3){if(isFullWidth&&!title){iconOffset='spacing.1';}else if(!isFullWidth&&!title){iconOffset='spacing.0';}else if(!isFullWidth&&title){iconOffset='spacing.2';}}else if(isMobile){if(!isFullWidth&&title){iconOffset='spacing.2';}else if(isFullWidth&&!title){iconOffset='spacing.2';}}else if(isFullWidth){iconOffset='spacing.0';}var icon=jsx(Box,{marginTop:iconOffset,display:"flex",children:jsx(Icon,{color:"feedback.icon."+intent+"."+contrastType,size:iconSize})});var _title=title?jsx(Box,{marginBottom:"spacing.2",children:isFullWidth?jsx(Heading,{size:"small",contrast:contrast,children:title}):jsx(Text,{weight:"bold",contrast:contrast,children:title})}):null;var _description=jsx(Box,{marginTop:title||isReactNative$3?'spacing.0':'spacing.1',children:jsx(Text,{size:textSize,contrast:contrast,children:description})});var primaryAction=actions!=null&&actions.primary?jsx(Box,{marginRight:"spacing.5",display:isReactNative$3?'flex':'inline-flex',children:jsx(BaseButton,{size:textSize,onClick:actions.primary.onClick,intent:intent,contrast:contrast,children:actions.primary.text})}):null;var secondaryActionParams=actions!=null&&actions.secondary?{onClick:actions.secondary.onClick}:null;if(actions!=null&&actions.secondary&&secondaryActionParams&&'href'in actions.secondary){secondaryActionParams.href=actions.secondary.href;secondaryActionParams.target=actions.secondary.target;secondaryActionParams.rel=actions.secondary.rel;}var secondaryAction=actions!=null&&actions.secondary?jsx(Box,{marginRight:"spacing.4",display:isReactNative$3?'flex':'inline-flex',children:jsx(BaseLink,_extends({size:textSize,contrast:contrast,intent:intent},secondaryActionParams,{children:actions.secondary.text}))}):null;var showActionsHorizontal=isFullWidth&&isDesktop;var actionsHorizontal=showActionsHorizontal&&(primaryAction||secondaryAction)?jsxs(Box,{flexDirection:"row",alignItems:"center",children:[primaryAction,secondaryAction]}):null;var actionsVertical=!showActionsHorizontal&&(primaryAction||secondaryAction)?jsxs(Box,{marginTop:"spacing.4",flexDirection:"row",alignItems:"center",children:[primaryAction,secondaryAction]}):null;var onClickDismiss=function onClickDismiss(){if(onDismiss){onDismiss();}setIsVisible(false);};var closeButton=isDismissable?jsx(CloseButtonWrapper,{children:jsx(IconButton,{accessibilityLabel:"Dismiss alert",onClick:onClickDismiss,contrast:contrast,size:iconSize,icon:CloseIcon})}):null;var a11yProps=makeAccessible(_extends({role:isReactNative$3||intent==='negative'||intent==='notice'?'alert':'status'},intent==='notice'&&{liveRegion:'polite'}));if(!isVisible){return null;}return jsxs(StyledAlert,_extends({intent:intent,contrastType:contrastType,isFullWidth:isFullWidth,isDesktop:isDesktop},a11yProps,metaAttribute(),{children:[icon,jsxs(Box,{flex:1,paddingLeft:isFullWidth?'spacing.4':'spacing.3',paddingRight:showActionsHorizontal?'spacing.4':'spacing.2',children:[_title,_description,actionsVertical]}),actionsHorizontal,closeButton]}));};
|
|
3371
3373
|
|
|
@@ -3377,8 +3379,18 @@ var StyledBadge=styled.View(function(props){return _extends({},getStyledBadgeSty
|
|
|
3377
3379
|
|
|
3378
3380
|
var isFeedbackVariant=function isFeedbackVariant(variant){var feedbackVariants=['information','negative','neutral','notice','positive'];return feedbackVariants.includes(variant);};var getColorProps$1=function getColorProps(_ref){var variant=_ref.variant,contrast=_ref.contrast;var props={iconColor:'feedback.icon.neutral.lowContrast',textColor:'feedback.text.neutral.lowContrast',backgroundColor:'feedback.background.neutral.lowContrast'};if(isFeedbackVariant(variant)){props.iconColor="feedback.icon."+variant+"."+contrast+"Contrast";props.textColor="feedback.text."+variant+"."+contrast+"Contrast";props.backgroundColor="feedback.background."+variant+"."+contrast+"Contrast";}else {props.iconColor="badge.icon."+variant+"."+contrast+"Contrast";props.textColor="badge.text."+variant+"."+contrast+"Contrast";props.backgroundColor="badge.background."+variant+"."+contrast+"Contrast";}return props;};var Badge=function Badge(_ref2){var children=_ref2.children,_ref2$contrast=_ref2.contrast,contrast=_ref2$contrast===void 0?'low':_ref2$contrast,_ref2$fontWeight=_ref2.fontWeight,fontWeight=_ref2$fontWeight===void 0?'regular':_ref2$fontWeight,Icon=_ref2.icon,_ref2$size=_ref2.size,size=_ref2$size===void 0?'medium':_ref2$size,_ref2$variant=_ref2.variant,variant=_ref2$variant===void 0?'neutral':_ref2$variant;if(!(children!=null&&children.trim())){throw new Error('[Blade: Badge]: Text as children is required for Badge.');}var _useTheme=useTheme(),platform=_useTheme.platform;var _getColorProps=getColorProps$1({variant:variant,contrast:contrast}),backgroundColor=_getColorProps.backgroundColor,iconColor=_getColorProps.iconColor,textColor=_getColorProps.textColor;return jsx(StyledBadge,_extends({backgroundColor:backgroundColor,size:size,platform:platform},metaAttribute(),{children:jsxs(Box,{paddingRight:horizontalPadding$1[size],paddingLeft:horizontalPadding$1[size],paddingTop:verticalPadding$1[size],paddingBottom:verticalPadding$1[size],display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",overflow:"hidden",children:[Icon?jsx(Box,{paddingRight:Boolean(Icon)?iconPadding[size]:'spacing.0',display:"flex",children:jsx(Icon,{color:iconColor,size:iconSize[size]})}):null,jsx(Text,_extends({},size==='small'?{variant:'caption'}:{variant:'body',size:'small'},{type:"normal",weight:fontWeight,truncateAfterLines:1,color:textColor,children:children}))]})}));};
|
|
3379
3381
|
|
|
3382
|
+
var _excluded$2=["children","surfaceLevel"];var isAndroid=Platform.OS==='android';var androidShadow={color:undefined,elevation:2};var CardSurfaceStyled=styled(Box)(function(_ref){var surfaceLevel=_ref.surfaceLevel,theme=_ref.theme;var backgroundColor=theme.colors.surface.background["level"+surfaceLevel].lowContrast;return {width:'100%',display:'flex',flexDirection:'column',shadowOpacity:'1',shadowRadius:theme.shadows.blurRadius.level[1],shadowColor:isAndroid?androidShadow.color:theme.shadows.color.level[1],shadowOffset:"0px "+theme.shadows.offsetY.level[1]+"px",backgroundColor:backgroundColor};});var CardSurface=function CardSurface(_ref2){var children=_ref2.children,surfaceLevel=_ref2.surfaceLevel,props=_objectWithoutProperties(_ref2,_excluded$2);var _useTheme=useTheme(),theme=_useTheme.theme;return jsx(CardSurfaceStyled,_extends({},props,{surfaceLevel:surfaceLevel,elevation:isAndroid?androidShadow.elevation:theme.shadows.androidElevation.level[1],children:children}));};
|
|
3383
|
+
|
|
3384
|
+
var CardContext=React__default.createContext(null);var useVerifyInsideCard=function useVerifyInsideCard(componentName){var context=React__default.useContext(CardContext);if(!context){throw new Error("[Blade Card]: "+componentName+" cannot be used outside of Card component");}return true;};var CardProvider=function CardProvider(_ref){var children=_ref.children;return jsx(CardContext.Provider,{value:true,children:children});};
|
|
3385
|
+
|
|
3386
|
+
var Card=function Card(_ref){var children=_ref.children,_ref$surfaceLevel=_ref.surfaceLevel,surfaceLevel=_ref$surfaceLevel===void 0?3:_ref$surfaceLevel;return jsx(CardProvider,{children:jsx(CardSurface,_extends({},metaAttribute(),{paddingLeft:"spacing.7",paddingRight:"spacing.7",paddingTop:"spacing.6",paddingBottom:"spacing.6",borderRadius:"medium",surfaceLevel:surfaceLevel,children:children}))});};var CardBody=function CardBody(_ref2){var children=_ref2.children;useVerifyInsideCard('CardBody');return jsx(Box,_extends({},metaAttribute(),{children:children}));};
|
|
3387
|
+
|
|
3388
|
+
var Link=function Link(_ref){var children=_ref.children,icon=_ref.icon,_ref$iconPosition=_ref.iconPosition,iconPosition=_ref$iconPosition===void 0?'left':_ref$iconPosition,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,onClick=_ref.onClick,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'anchor':_ref$variant,href=_ref.href,target=_ref.target,rel=_ref.rel,accessibilityLabel=_ref.accessibilityLabel,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size;return jsx(BaseLink,_extends({},icon?{icon:icon,children:children}:{children:children},variant==='anchor'?{variant:variant,href:href,target:target,rel:rel}:{variant:variant,isDisabled:isDisabled},{iconPosition:iconPosition,onClick:onClick,accessibilityLabel:accessibilityLabel,size:size}));};
|
|
3389
|
+
|
|
3380
3390
|
var Button=function Button(_ref){var children=_ref.children,icon=_ref.icon,_ref$iconPosition=_ref.iconPosition,iconPosition=_ref$iconPosition===void 0?'left':_ref$iconPosition,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,_ref$isFullWidth=_ref.isFullWidth,isFullWidth=_ref$isFullWidth===void 0?false:_ref$isFullWidth,_ref$isLoading=_ref.isLoading,isLoading=_ref$isLoading===void 0?false:_ref$isLoading,onClick=_ref.onClick,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$type=_ref.type,type=_ref$type===void 0?'button':_ref$type,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'primary':_ref$variant,accessibilityLabel=_ref.accessibilityLabel;return jsx(BaseButton,_extends({},icon?{icon:icon,children:children}:{children:children},{accessibilityLabel:accessibilityLabel,iconPosition:iconPosition,isDisabled:isDisabled,isFullWidth:isFullWidth,onClick:onClick,size:size,type:type,variant:variant,isLoading:isLoading}));};
|
|
3381
3391
|
|
|
3392
|
+
var Divider=styled.View(function(_ref){var theme=_ref.theme;return {borderBottomWidth:makeSize(theme.border.width.thin),borderBottomStyle:'solid',borderColor:theme.colors.surface.border.normal.lowContrast};});
|
|
3393
|
+
|
|
3382
3394
|
var verticalPadding={small:'spacing.0',medium:'spacing.1',large:'spacing.1'};var horizontalPadding={small:'spacing.2',medium:'spacing.3',large:'spacing.3'};var maxWidth={onMobile:100,onDesktop:120};
|
|
3383
3395
|
|
|
3384
3396
|
var getStyledCounterStyles=function getStyledCounterStyles(_ref){var theme=_ref.theme,platform=_ref.platform,backgroundColor=_ref.backgroundColor;return {backgroundColor:get_1(theme.colors,backgroundColor),borderRadius:makeBorderSize(theme.border.radius.max),maxWidth:makeSize(maxWidth[platform]),display:'flex',flexWrap:'nowrap'};};
|
|
@@ -3387,6 +3399,10 @@ var StyledCounter=styled.View(function(props){return _extends({},getStyledCounte
|
|
|
3387
3399
|
|
|
3388
3400
|
var getColorProps=function getColorProps(_ref){var _ref$intent=_ref.intent,intent=_ref$intent===void 0?'neutral':_ref$intent,_ref$contrast=_ref.contrast,contrast=_ref$contrast===void 0?'low':_ref$contrast;var props={textColor:"feedback.text."+intent+"."+contrast+"Contrast",backgroundColor:"feedback.background."+intent+"."+contrast+"Contrast"};return props;};var Counter=function Counter(_ref2){var value=_ref2.value,max=_ref2.max,_ref2$intent=_ref2.intent,intent=_ref2$intent===void 0?'neutral':_ref2$intent,_ref2$contrast=_ref2.contrast,contrast=_ref2$contrast===void 0?'low':_ref2$contrast,_ref2$size=_ref2.size,size=_ref2$size===void 0?'medium':_ref2$size;var content=""+value;if(max&&value>max){content=max+"+";}var _useTheme=useTheme(),platform=_useTheme.platform;var _getColorProps=getColorProps({intent:intent,contrast:contrast}),backgroundColor=_getColorProps.backgroundColor,textColor=_getColorProps.textColor;var textSizes={small:{variant:'caption'},medium:{variant:'body',size:'small'},large:{variant:'body',size:'medium'}};return jsx(StyledCounter,{backgroundColor:backgroundColor,size:size,platform:platform,children:jsx(Box,_extends({paddingRight:horizontalPadding[size],paddingLeft:horizontalPadding[size],paddingTop:verticalPadding[size],paddingBottom:verticalPadding[size],display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",overflow:"hidden"},metaAttribute(),{children:jsx(Text,_extends({},textSizes[size],{type:"normal",weight:"regular",truncateAfterLines:1,color:textColor,children:content}))}))});};
|
|
3389
3401
|
|
|
3402
|
+
var ComponentIds={CardHeaderIcon:'CardHeaderIcon',CardHeaderCounter:'CardHeaderCounter',CardHeaderBadge:'CardHeaderBadge',CardHeaderText:'CardHeaderText',CardHeaderLink:'CardHeaderLink',CardHeaderIconButton:'CardHeaderIconButton'};var CardHeaderIcon=function CardHeaderIcon(_ref){var Icon=_ref.icon;useVerifyInsideCard('CardHeaderIcon');return jsx(Icon,{color:"surface.text.normal.lowContrast",size:"xlarge"});};CardHeaderIcon.componentId=ComponentIds.CardHeaderIcon;var CardHeaderCounter=function CardHeaderCounter(props){useVerifyInsideCard('CardHeaderCounter');return jsx(Counter,_extends({},props));};CardHeaderCounter.componentId=ComponentIds.CardHeaderCounter;var CardHeaderBadge=function CardHeaderBadge(props){useVerifyInsideCard('CardHeaderBadge');return jsx(Badge,_extends({},props));};CardHeaderBadge.componentId=ComponentIds.CardHeaderBadge;var CardHeaderText=function CardHeaderText(props){useVerifyInsideCard('CardHeaderText');return jsx(Text,_extends({},props));};CardHeaderText.componentId=ComponentIds.CardHeaderText;var CardHeaderLink=function CardHeaderLink(props){useVerifyInsideCard('CardHeaderLink');return jsx(Link,_extends({},props));};CardHeaderLink.componentId=ComponentIds.CardHeaderLink;var CardHeaderIconButton=function CardHeaderIconButton(props){useVerifyInsideCard('CardHeaderIconButton');return jsx(Box,{width:makeSpace(minHeight.xsmall),children:jsx(Button,_extends({},props,{variant:"tertiary",size:"xsmall",iconPosition:"left",isFullWidth:true}))});};CardHeaderIconButton.componentId=ComponentIds.CardHeaderIconButton;var CardHeader=function CardHeader(_ref2){var children=_ref2.children;useVerifyInsideCard('CardHeader');return jsxs(Box,_extends({marginBottom:"spacing.7"},metaAttribute(),{children:[jsx(Box,{marginBottom:"spacing.7",display:"flex",flexDirection:"row",justifyContent:"space-between",children:children}),jsx(Divider,{})]}));};var CardHeaderLeading=function CardHeaderLeading(_ref3){var title=_ref3.title,subtitle=_ref3.subtitle,prefix=_ref3.prefix,suffix=_ref3.suffix;useVerifyInsideCard('CardHeaderLeading');if(prefix&&!isValidAllowedChildren(prefix,ComponentIds.CardHeaderIcon)){throw new Error("[Blade CardHeaderLeading]: Only `"+ComponentIds.CardHeaderIcon+"` component is accepted in prefix");}if(suffix&&!isValidAllowedChildren(suffix,ComponentIds.CardHeaderCounter)){throw new Error("[Blade CardHeaderLeading]: Only `"+ComponentIds.CardHeaderCounter+"` component is accepted in prefix");}return jsxs(Box,{flex:1,display:"flex",flexDirection:"row",children:[jsx(Box,{marginRight:"spacing.3",alignSelf:"center",display:"flex",children:prefix}),jsxs(Box,{children:[jsxs(Box,{display:"flex",flexDirection:"row",alignItems:"center",flexWrap:"wrap",children:[jsx(Heading,{size:"small",variant:"regular",type:"normal",children:title}),jsx(Box,{marginLeft:"spacing.3",children:suffix})]}),jsx(Text,{variant:"body",size:"small",weight:"regular",children:subtitle})]})]});};var headerTrailingAllowedComponents=[ComponentIds.CardHeaderLink,ComponentIds.CardHeaderText,ComponentIds.CardHeaderIconButton,ComponentIds.CardHeaderBadge];var CardHeaderTrailing=function CardHeaderTrailing(_ref4){var visual=_ref4.visual;useVerifyInsideCard('CardHeaderTrailing');if(visual&&!headerTrailingAllowedComponents.includes(getComponentId(visual))){throw new Error("[Blade CardHeaderTrailing]: Only one of `"+headerTrailingAllowedComponents.join(', ')+"` component is accepted in visual");}return jsx(Box,{alignSelf:"center",children:visual});};
|
|
3403
|
+
|
|
3404
|
+
var useIsMobile=function useIsMobile(){var _useTheme=useTheme(),theme=_useTheme.theme;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;return matchedDeviceType==='mobile';};var CardFooter=function CardFooter(_ref){var children=_ref.children;var isMobile=useIsMobile();useVerifyInsideCard('CardFooter');return jsxs(Box,_extends({marginTop:"auto"},metaAttribute(),{children:[jsx(Box,{marginTop:"spacing.7"}),jsx(Divider,{}),jsx(Box,{marginTop:"spacing.7",display:"flex",flexDirection:isMobile?'column':'row',justifyContent:"space-between",alignItems:isMobile?'stretch':'center',children:children})]}));};var CardFooterLeading=function CardFooterLeading(_ref2){var title=_ref2.title,subtitle=_ref2.subtitle;useVerifyInsideCard('CardFooterLeading');return jsxs(Box,{children:[title&&jsx(Text,{variant:"body",size:"medium",weight:"bold",children:title}),subtitle&&jsx(Text,{variant:"body",size:"small",weight:"regular",children:subtitle})]});};var CardFooterTrailing=function CardFooterTrailing(_ref3){var actions=_ref3.actions;var isMobile=useIsMobile();useVerifyInsideCard('CardFooterTrailing');return jsxs(Box,{display:"flex",flexDirection:"row",alignSelf:isMobile?'auto':'center',marginTop:isMobile?'spacing.5':'spacing.0',marginLeft:isMobile?'spacing.0':'spacing.5',children:[jsx(Box,{flexGrow:1,children:actions!=null&&actions.secondary?jsx(Button,_extends({isFullWidth:true,size:"medium",variant:"secondary"},actions.secondary,{children:actions.secondary.text})):null}),jsx(Box,{marginLeft:"spacing.5"}),jsx(Box,{flexGrow:1,children:actions!=null&&actions.primary?jsx(Button,_extends({isFullWidth:true,size:"medium"},actions.primary,{children:actions.primary.text})):null})]});};
|
|
3405
|
+
|
|
3390
3406
|
/**
|
|
3391
3407
|
* Checks if `value` is `undefined`.
|
|
3392
3408
|
*
|
|
@@ -3441,7 +3457,7 @@ var screenReaderStyles={border:0,clip:'rect(0 0 0 0)',clipPath:'inset(50%)',heig
|
|
|
3441
3457
|
|
|
3442
3458
|
var StyledVisuallyHidden=styled.View(screenReaderStyles);var VisuallyHidden=function VisuallyHidden(_ref){var children=_ref.children;return jsx(StyledVisuallyHidden,{children:children});};
|
|
3443
3459
|
|
|
3444
|
-
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})});};
|
|
3445
3461
|
|
|
3446
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}));};
|
|
3447
3463
|
|
|
@@ -3489,7 +3505,181 @@ var Circle=function Circle(_ref){var cx=_ref.cx,cy=_ref.cy,x=_ref.x,y=_ref.y,r=_
|
|
|
3489
3505
|
|
|
3490
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})})]}));};
|
|
3491
3507
|
|
|
3492
|
-
|
|
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})})}))]});};
|
|
3493
3683
|
|
|
3494
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)};};
|
|
3495
3685
|
|
|
@@ -3513,5 +3703,5 @@ var RadioGroup=function RadioGroup(_ref){var children=_ref.children,label=_ref.l
|
|
|
3513
3703
|
|
|
3514
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');};
|
|
3515
3705
|
|
|
3516
|
-
export { Alert, AlertTriangleIcon as AlertOctagonIcon, AlertTriangleIcon$1 as AlertTriangleIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, ArrowUpRightIcon, Badge, BladeProvider, Button, 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 };
|
|
3517
3707
|
//# sourceMappingURL=index.native.js.map
|