@razorpay/blade 6.5.1 → 6.6.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 +18 -0
- package/build/components/index.d.ts +60 -8
- package/build/components/index.native.d.ts +60 -8
- package/build/components/index.native.js +7 -7
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.web.js +140 -99
- package/build/components/index.web.js.map +1 -1
- package/build/css/bankingThemeDarkDesktop.css +2 -1
- package/build/css/bankingThemeDarkMobile.css +2 -1
- package/build/css/bankingThemeLightDesktop.css +2 -1
- package/build/css/bankingThemeLightMobile.css +2 -1
- package/build/css/paymentThemeDarkDesktop.css +2 -1
- package/build/css/paymentThemeDarkMobile.css +2 -1
- package/build/css/paymentThemeLightDesktop.css +2 -1
- package/build/css/paymentThemeLightMobile.css +2 -1
- package/build/tokens/index.d.ts +19 -0
- package/build/tokens/index.native.d.ts +19 -0
- package/build/tokens/index.native.js +2 -2
- package/build/tokens/index.native.js.map +1 -1
- package/build/tokens/index.web.js +2 -0
- package/build/tokens/index.web.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @razorpay/blade
|
|
2
2
|
|
|
3
|
+
## 6.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5863f939: feat(OTPInput): add `onFocus` & `onBlur` props
|
|
8
|
+
- 75daaa3c: feat(theme): add `name` property in `theme` to watch on theme changes
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 6a8524ab: feat(Link): add `hitSlop` support for native
|
|
13
|
+
|
|
14
|
+
## 6.5.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 2700667f: fix(SelectInput): call user passed onBlur callback
|
|
19
|
+
- 3855a583: fix(Card): CardHeader title alignment when subtitle is not present
|
|
20
|
+
|
|
3
21
|
## 6.5.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -437,6 +437,7 @@ type Colors = {
|
|
|
437
437
|
type ColorsWithModes = Record<ColorSchemeModes, Colors>;
|
|
438
438
|
|
|
439
439
|
type ThemeTokens = {
|
|
440
|
+
name: 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete; // Can be used to watch over state changes between theme without watching over entire theme object
|
|
440
441
|
border: Border;
|
|
441
442
|
breakpoints: Breakpoints;
|
|
442
443
|
colors: ColorsWithModes;
|
|
@@ -935,6 +936,24 @@ type DotNotationSpacingStringToken = `spacing.${keyof Spacing}`;
|
|
|
935
936
|
*/
|
|
936
937
|
type StringChildrenType = React__default.ReactText | React__default.ReactText[];
|
|
937
938
|
|
|
939
|
+
/**
|
|
940
|
+
*
|
|
941
|
+
* When combined with union, this type utility will give you autocomplete of union while still supporting any string value as input
|
|
942
|
+
*
|
|
943
|
+
* ### Usage
|
|
944
|
+
*
|
|
945
|
+
* ```ts
|
|
946
|
+
* type ThemeName = 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete;
|
|
947
|
+
* ```
|
|
948
|
+
*
|
|
949
|
+
* This will show paymentTheme and bankingTheme in autocomplete but also allow any other string as value.
|
|
950
|
+
*
|
|
951
|
+
* More details - https://github.com/razorpay/blade/pull/1031/commits/86b6ee0facf45e7556739efcbfa5396b11b1b3c9#r1121298293
|
|
952
|
+
* Related TS Issue - https://github.com/microsoft/TypeScript/issues/29729
|
|
953
|
+
*
|
|
954
|
+
*/
|
|
955
|
+
type StringWithAutocomplete = string & Record<never, never>;
|
|
956
|
+
|
|
938
957
|
type TestID$1 = {
|
|
939
958
|
testID?: string;
|
|
940
959
|
};
|
|
@@ -993,6 +1012,7 @@ declare type ActionListProps = {
|
|
|
993
1012
|
declare const ActionList: ({ children, surfaceLevel, testID }: ActionListProps) => JSX.Element;
|
|
994
1013
|
|
|
995
1014
|
type Theme$1 = {
|
|
1015
|
+
name: ThemeTokens['name'];
|
|
996
1016
|
border: Border;
|
|
997
1017
|
breakpoints: Breakpoints;
|
|
998
1018
|
colors: Colors;
|
|
@@ -1705,6 +1725,7 @@ declare const ThemeContext: React$1.Context<ThemeContext>;
|
|
|
1705
1725
|
declare const useTheme: () => ThemeContext;
|
|
1706
1726
|
|
|
1707
1727
|
declare type Theme = {
|
|
1728
|
+
name: ThemeTokens['name'];
|
|
1708
1729
|
border: Border;
|
|
1709
1730
|
breakpoints: Breakpoints;
|
|
1710
1731
|
colors: Colors;
|
|
@@ -2348,7 +2369,25 @@ declare type LinkCommonProps = {
|
|
|
2348
2369
|
* @default medium
|
|
2349
2370
|
*/
|
|
2350
2371
|
size?: 'small' | 'medium';
|
|
2351
|
-
} & TestID$1 & StyledPropsBlade
|
|
2372
|
+
} & TestID$1 & StyledPropsBlade & Platform$1.Select<{
|
|
2373
|
+
native: {
|
|
2374
|
+
/**
|
|
2375
|
+
* Defines how far your touch can start away from the link
|
|
2376
|
+
*/
|
|
2377
|
+
hitSlop?: {
|
|
2378
|
+
top?: number;
|
|
2379
|
+
right?: number;
|
|
2380
|
+
bottom?: number;
|
|
2381
|
+
left?: number;
|
|
2382
|
+
} | number;
|
|
2383
|
+
};
|
|
2384
|
+
web: {
|
|
2385
|
+
/**
|
|
2386
|
+
* This is a react-native only prop and has no effect on web.
|
|
2387
|
+
*/
|
|
2388
|
+
hitSlop?: undefined;
|
|
2389
|
+
};
|
|
2390
|
+
}>;
|
|
2352
2391
|
declare type LinkWithoutIconProps = LinkCommonProps & {
|
|
2353
2392
|
icon?: undefined;
|
|
2354
2393
|
children: StringChildrenType;
|
|
@@ -2373,7 +2412,7 @@ declare type LinkButtonVariantProps = LinkPropsWithOrWithoutIcon & {
|
|
|
2373
2412
|
rel?: undefined;
|
|
2374
2413
|
};
|
|
2375
2414
|
declare type LinkProps = LinkAnchorVariantProps | LinkButtonVariantProps;
|
|
2376
|
-
declare const Link: ({ children, icon, iconPosition, isDisabled, onClick, variant, href, target, rel, accessibilityLabel, size, testID, ...styledProps }: LinkProps) => ReactElement;
|
|
2415
|
+
declare const Link: ({ children, icon, iconPosition, isDisabled, onClick, variant, href, target, rel, accessibilityLabel, size, testID, hitSlop, ...styledProps }: LinkProps) => ReactElement;
|
|
2377
2416
|
|
|
2378
2417
|
type BladeElementRef = Pick<HTMLElement, 'focus' | 'scrollIntoView'> | Pick<View, 'focus'>;
|
|
2379
2418
|
|
|
@@ -3878,7 +3917,7 @@ declare type TextInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' | '
|
|
|
3878
3917
|
*/
|
|
3879
3918
|
type?: Type;
|
|
3880
3919
|
} & StyledPropsBlade;
|
|
3881
|
-
declare const TextInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "name" | "testID" | "placeholder" | "label" | "value" | "onFocus" | "onBlur" | "onChange" | "onSubmit" | "autoFocus" | "defaultValue" | "prefix" | "autoCapitalize" | "isDisabled" | "labelPosition" | "
|
|
3920
|
+
declare const TextInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "name" | "testID" | "placeholder" | "label" | "value" | "onFocus" | "onBlur" | "onChange" | "onSubmit" | "autoFocus" | "defaultValue" | "prefix" | "autoCapitalize" | "isDisabled" | "labelPosition" | "helpText" | "errorText" | "successText" | "necessityIndicator" | "suffix" | "validationState" | "isRequired" | "maxCharacters" | "keyboardReturnKeyType" | "autoCompleteSuggestionType"> & {
|
|
3882
3921
|
/**
|
|
3883
3922
|
* Decides whether to render a clear icon button
|
|
3884
3923
|
*/
|
|
@@ -4012,7 +4051,7 @@ declare type PasswordInputExtraProps = {
|
|
|
4012
4051
|
autoCompleteSuggestionType?: Extract<BaseInputProps['autoCompleteSuggestionType'], 'none' | 'password' | 'newPassword'>;
|
|
4013
4052
|
};
|
|
4014
4053
|
declare type PasswordInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' | 'maxCharacters' | 'validationState' | 'errorText' | 'successText' | 'helpText' | 'isDisabled' | 'defaultValue' | 'placeholder' | 'isRequired' | 'value' | 'onChange' | 'onBlur' | 'onSubmit' | 'onFocus' | 'name' | 'autoFocus' | 'keyboardReturnKeyType' | 'autoCompleteSuggestionType' | 'testID'> & PasswordInputExtraProps & StyledPropsBlade;
|
|
4015
|
-
declare const PasswordInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "name" | "testID" | "placeholder" | "label" | "value" | "onFocus" | "onBlur" | "onChange" | "onSubmit" | "autoFocus" | "defaultValue" | "isDisabled" | "labelPosition" | "
|
|
4054
|
+
declare const PasswordInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "name" | "testID" | "placeholder" | "label" | "value" | "onFocus" | "onBlur" | "onChange" | "onSubmit" | "autoFocus" | "defaultValue" | "isDisabled" | "labelPosition" | "helpText" | "errorText" | "successText" | "validationState" | "isRequired" | "maxCharacters" | "keyboardReturnKeyType" | "autoCompleteSuggestionType"> & PasswordInputExtraProps & Partial<MakeObjectResponsive<{
|
|
4016
4055
|
margin: SpacingValueType | ArrayOfMaxLength4<SpacingValueType>;
|
|
4017
4056
|
marginX: SpacingValueType;
|
|
4018
4057
|
marginY: SpacingValueType;
|
|
@@ -4102,7 +4141,7 @@ declare type TextAreaProps = Pick<BaseInputProps, 'label' | 'labelPosition' | 'n
|
|
|
4102
4141
|
*/
|
|
4103
4142
|
onClearButtonClick?: () => void;
|
|
4104
4143
|
} & StyledPropsBlade;
|
|
4105
|
-
declare const TextArea: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "name" | "testID" | "placeholder" | "label" | "value" | "onFocus" | "onBlur" | "onChange" | "onSubmit" | "autoFocus" | "defaultValue" | "numberOfLines" | "isDisabled" | "labelPosition" | "
|
|
4144
|
+
declare const TextArea: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "name" | "testID" | "placeholder" | "label" | "value" | "onFocus" | "onBlur" | "onChange" | "onSubmit" | "autoFocus" | "defaultValue" | "numberOfLines" | "isDisabled" | "labelPosition" | "helpText" | "errorText" | "successText" | "necessityIndicator" | "validationState" | "isRequired" | "maxCharacters"> & {
|
|
4106
4145
|
/**
|
|
4107
4146
|
* Decides whether to render a clear icon button
|
|
4108
4147
|
*/
|
|
@@ -4191,6 +4230,11 @@ declare const TextArea: React__default.ForwardRefExoticComponent<Pick<BaseInputP
|
|
|
4191
4230
|
}> | undefined;
|
|
4192
4231
|
}, "gridColumnEnd" | "gridColumnStart" | "gridRowEnd" | "gridRowStart" | "gridArea" | "gridColumn" | "gridRow">> & React__default.RefAttributes<BladeElementRef>>;
|
|
4193
4232
|
|
|
4233
|
+
declare type FormInputOnEventWithIndex = ({ name, value, inputIndex, }: {
|
|
4234
|
+
name?: string;
|
|
4235
|
+
value?: string;
|
|
4236
|
+
inputIndex: number;
|
|
4237
|
+
}) => void;
|
|
4194
4238
|
declare type OTPInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' | 'validationState' | 'helpText' | 'errorText' | 'successText' | 'name' | 'onChange' | 'value' | 'isDisabled' | 'autoFocus' | 'keyboardReturnKeyType' | 'keyboardType' | 'placeholder' | 'testID'> & {
|
|
4195
4239
|
/**
|
|
4196
4240
|
* Determines the number of input fields to show for the OTP
|
|
@@ -4219,6 +4263,14 @@ declare type OTPInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' | 'v
|
|
|
4219
4263
|
*
|
|
4220
4264
|
*/
|
|
4221
4265
|
autoCompleteSuggestionType?: Extract<BaseInputProps['autoCompleteSuggestionType'], 'none' | 'oneTimeCode'>;
|
|
4266
|
+
/**
|
|
4267
|
+
* The callback function to be invoked when one of the input fields gets focus
|
|
4268
|
+
*/
|
|
4269
|
+
onFocus?: FormInputOnEventWithIndex;
|
|
4270
|
+
/**
|
|
4271
|
+
* The callback function to be invoked when one of the input fields is blurred
|
|
4272
|
+
*/
|
|
4273
|
+
onBlur?: FormInputOnEventWithIndex;
|
|
4222
4274
|
} & StyledPropsBlade;
|
|
4223
4275
|
/**
|
|
4224
4276
|
* OTPInput component can be used for accepting OTPs sent to users for authentication/verification purposes.
|
|
@@ -4234,7 +4286,7 @@ declare type OTPInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' | 'v
|
|
|
4234
4286
|
* />
|
|
4235
4287
|
* ```
|
|
4236
4288
|
*/
|
|
4237
|
-
declare const OTPInput: ({ autoFocus, errorText, helpText, isDisabled, keyboardReturnKeyType, keyboardType, label, labelPosition, name, onChange, onOTPFilled, otpLength, placeholder, successText, validationState, value, isMasked, autoCompleteSuggestionType, testID, ...styledProps }: OTPInputProps) => React__default.ReactElement;
|
|
4289
|
+
declare const OTPInput: ({ autoFocus, errorText, helpText, isDisabled, keyboardReturnKeyType, keyboardType, label, labelPosition, name, onChange, onFocus, onBlur, onOTPFilled, otpLength, placeholder, successText, validationState, value, isMasked, autoCompleteSuggestionType, testID, ...styledProps }: OTPInputProps) => React__default.ReactElement;
|
|
4238
4290
|
|
|
4239
4291
|
declare type SelectInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' | 'necessityIndicator' | 'validationState' | 'helpText' | 'errorText' | 'successText' | 'name' | 'isDisabled' | 'isRequired' | 'prefix' | 'suffix' | 'autoFocus' | 'onClick' | 'onFocus' | 'onBlur' | 'placeholder' | 'testID'> & {
|
|
4240
4292
|
icon?: IconComponent$1;
|
|
@@ -4270,7 +4322,7 @@ declare type SelectInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' |
|
|
|
4270
4322
|
*
|
|
4271
4323
|
* Checkout {@link https://blade.razorpay.com/?path=/docs/components-dropdown-with-select--with-single-select SelectInput Documentation}.
|
|
4272
4324
|
*/
|
|
4273
|
-
declare const SelectInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "name" | "testID" | "placeholder" | "label" | "onFocus" | "onBlur" | "onClick" | "autoFocus" | "prefix" | "isDisabled" | "labelPosition" | "
|
|
4325
|
+
declare const SelectInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "name" | "testID" | "placeholder" | "label" | "onFocus" | "onBlur" | "onClick" | "autoFocus" | "prefix" | "isDisabled" | "labelPosition" | "helpText" | "errorText" | "successText" | "necessityIndicator" | "suffix" | "validationState" | "isRequired"> & {
|
|
4274
4326
|
icon?: IconComponent$1 | undefined;
|
|
4275
4327
|
onChange?: (({ name, values }: {
|
|
4276
4328
|
name?: string | undefined;
|
|
@@ -5014,7 +5066,7 @@ declare const BaseBox: styled_components.StyledComponent<"div", styled_component
|
|
|
5014
5066
|
children?: React$1.ReactNode | React$1.ReactNode[];
|
|
5015
5067
|
} & TestID>, "backgroundColor" | "as"> & Partial<MakeObjectResponsive<{
|
|
5016
5068
|
borderRadius: "none" | "small" | "medium" | "large" | "max" | "round";
|
|
5017
|
-
backgroundColor: "feedback.background.neutral.lowContrast" | "feedback.background.neutral.highContrast" | "feedback.background.information.lowContrast" | "feedback.background.information.highContrast" | "feedback.background.negative.lowContrast" | "feedback.background.negative.highContrast" | "feedback.background.notice.lowContrast" | "feedback.background.notice.highContrast" | "feedback.background.positive.lowContrast" | "feedback.background.positive.highContrast" | "surface.background.level1.lowContrast" | "surface.background.level1.highContrast" | "surface.background.level2.lowContrast" | "surface.background.level2.highContrast" | "surface.background.level3.lowContrast" | "surface.background.level3.highContrast" | "action.background.primary.default" | "action.background.primary.disabled" | "action.background.primary.hover" | "action.background.primary.focus" | "action.background.primary.active" | "action.background.secondary.default" | "action.background.secondary.disabled" | "action.background.secondary.hover" | "action.background.secondary.focus" | "action.background.secondary.active" | "action.background.tertiary.default" | "action.background.tertiary.disabled" | "action.background.tertiary.hover" | "action.background.tertiary.focus" | "action.background.tertiary.active"
|
|
5069
|
+
backgroundColor: (string & Record<never, never>) | "feedback.background.neutral.lowContrast" | "feedback.background.neutral.highContrast" | "feedback.background.information.lowContrast" | "feedback.background.information.highContrast" | "feedback.background.negative.lowContrast" | "feedback.background.negative.highContrast" | "feedback.background.notice.lowContrast" | "feedback.background.notice.highContrast" | "feedback.background.positive.lowContrast" | "feedback.background.positive.highContrast" | "surface.background.level1.lowContrast" | "surface.background.level1.highContrast" | "surface.background.level2.lowContrast" | "surface.background.level2.highContrast" | "surface.background.level3.lowContrast" | "surface.background.level3.highContrast" | "action.background.primary.default" | "action.background.primary.disabled" | "action.background.primary.hover" | "action.background.primary.focus" | "action.background.primary.active" | "action.background.secondary.default" | "action.background.secondary.disabled" | "action.background.secondary.hover" | "action.background.secondary.focus" | "action.background.secondary.active" | "action.background.tertiary.default" | "action.background.tertiary.disabled" | "action.background.tertiary.hover" | "action.background.tertiary.focus" | "action.background.tertiary.active";
|
|
5018
5070
|
lineHeight: SpacingValueType;
|
|
5019
5071
|
} & Pick<styled_components.CSSObject, "border" | "transform" | "borderBottom" | "borderLeft" | "borderRight" | "borderTop">> & {
|
|
5020
5072
|
className?: string | undefined;
|
|
@@ -438,6 +438,7 @@ type Colors = {
|
|
|
438
438
|
type ColorsWithModes = Record<ColorSchemeModes, Colors>;
|
|
439
439
|
|
|
440
440
|
type ThemeTokens = {
|
|
441
|
+
name: 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete; // Can be used to watch over state changes between theme without watching over entire theme object
|
|
441
442
|
border: Border;
|
|
442
443
|
breakpoints: Breakpoints;
|
|
443
444
|
colors: ColorsWithModes;
|
|
@@ -936,6 +937,24 @@ type DotNotationSpacingStringToken = `spacing.${keyof Spacing}`;
|
|
|
936
937
|
*/
|
|
937
938
|
type StringChildrenType = React__default.ReactText | React__default.ReactText[];
|
|
938
939
|
|
|
940
|
+
/**
|
|
941
|
+
*
|
|
942
|
+
* When combined with union, this type utility will give you autocomplete of union while still supporting any string value as input
|
|
943
|
+
*
|
|
944
|
+
* ### Usage
|
|
945
|
+
*
|
|
946
|
+
* ```ts
|
|
947
|
+
* type ThemeName = 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete;
|
|
948
|
+
* ```
|
|
949
|
+
*
|
|
950
|
+
* This will show paymentTheme and bankingTheme in autocomplete but also allow any other string as value.
|
|
951
|
+
*
|
|
952
|
+
* More details - https://github.com/razorpay/blade/pull/1031/commits/86b6ee0facf45e7556739efcbfa5396b11b1b3c9#r1121298293
|
|
953
|
+
* Related TS Issue - https://github.com/microsoft/TypeScript/issues/29729
|
|
954
|
+
*
|
|
955
|
+
*/
|
|
956
|
+
type StringWithAutocomplete = string & Record<never, never>;
|
|
957
|
+
|
|
939
958
|
type TestID$1 = {
|
|
940
959
|
testID?: string;
|
|
941
960
|
};
|
|
@@ -994,6 +1013,7 @@ declare type ActionListProps = {
|
|
|
994
1013
|
declare const ActionList: ({ children, surfaceLevel, testID }: ActionListProps) => JSX.Element;
|
|
995
1014
|
|
|
996
1015
|
type Theme$1 = {
|
|
1016
|
+
name: ThemeTokens['name'];
|
|
997
1017
|
border: Border;
|
|
998
1018
|
breakpoints: Breakpoints;
|
|
999
1019
|
colors: Colors;
|
|
@@ -1711,6 +1731,7 @@ declare const ThemeContext: React$1.Context<ThemeContext>;
|
|
|
1711
1731
|
declare const useTheme: () => ThemeContext;
|
|
1712
1732
|
|
|
1713
1733
|
declare type Theme = {
|
|
1734
|
+
name: ThemeTokens['name'];
|
|
1714
1735
|
border: Border;
|
|
1715
1736
|
breakpoints: Breakpoints;
|
|
1716
1737
|
colors: Colors;
|
|
@@ -2354,7 +2375,25 @@ declare type LinkCommonProps = {
|
|
|
2354
2375
|
* @default medium
|
|
2355
2376
|
*/
|
|
2356
2377
|
size?: 'small' | 'medium';
|
|
2357
|
-
} & TestID$1 & StyledPropsBlade
|
|
2378
|
+
} & TestID$1 & StyledPropsBlade & Platform.Select<{
|
|
2379
|
+
native: {
|
|
2380
|
+
/**
|
|
2381
|
+
* Defines how far your touch can start away from the link
|
|
2382
|
+
*/
|
|
2383
|
+
hitSlop?: {
|
|
2384
|
+
top?: number;
|
|
2385
|
+
right?: number;
|
|
2386
|
+
bottom?: number;
|
|
2387
|
+
left?: number;
|
|
2388
|
+
} | number;
|
|
2389
|
+
};
|
|
2390
|
+
web: {
|
|
2391
|
+
/**
|
|
2392
|
+
* This is a react-native only prop and has no effect on web.
|
|
2393
|
+
*/
|
|
2394
|
+
hitSlop?: undefined;
|
|
2395
|
+
};
|
|
2396
|
+
}>;
|
|
2358
2397
|
declare type LinkWithoutIconProps = LinkCommonProps & {
|
|
2359
2398
|
icon?: undefined;
|
|
2360
2399
|
children: StringChildrenType;
|
|
@@ -2379,7 +2418,7 @@ declare type LinkButtonVariantProps = LinkPropsWithOrWithoutIcon & {
|
|
|
2379
2418
|
rel?: undefined;
|
|
2380
2419
|
};
|
|
2381
2420
|
declare type LinkProps = LinkAnchorVariantProps | LinkButtonVariantProps;
|
|
2382
|
-
declare const Link: ({ children, icon, iconPosition, isDisabled, onClick, variant, href, target, rel, accessibilityLabel, size, testID, ...styledProps }: LinkProps) => ReactElement;
|
|
2421
|
+
declare const Link: ({ children, icon, iconPosition, isDisabled, onClick, variant, href, target, rel, accessibilityLabel, size, testID, hitSlop, ...styledProps }: LinkProps) => ReactElement;
|
|
2383
2422
|
|
|
2384
2423
|
type BladeElementRef = Pick<HTMLElement, 'focus' | 'scrollIntoView'> | Pick<View, 'focus'>;
|
|
2385
2424
|
|
|
@@ -3812,7 +3851,7 @@ declare type TextInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' | '
|
|
|
3812
3851
|
*/
|
|
3813
3852
|
type?: Type;
|
|
3814
3853
|
} & StyledPropsBlade;
|
|
3815
|
-
declare const TextInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "placeholder" | "
|
|
3854
|
+
declare const TextInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "placeholder" | "name" | "label" | "value" | "onBlur" | "onFocus" | "defaultValue" | "prefix" | "autoCapitalize" | "onChange" | "onSubmit" | "isDisabled" | "autoFocus" | "labelPosition" | "helpText" | "errorText" | "successText" | "necessityIndicator" | "suffix" | "validationState" | "isRequired" | "maxCharacters" | "keyboardReturnKeyType" | "autoCompleteSuggestionType"> & {
|
|
3816
3855
|
/**
|
|
3817
3856
|
* Decides whether to render a clear icon button
|
|
3818
3857
|
*/
|
|
@@ -3901,7 +3940,7 @@ declare type PasswordInputExtraProps = {
|
|
|
3901
3940
|
autoCompleteSuggestionType?: Extract<BaseInputProps['autoCompleteSuggestionType'], 'none' | 'password' | 'newPassword'>;
|
|
3902
3941
|
};
|
|
3903
3942
|
declare type PasswordInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' | 'maxCharacters' | 'validationState' | 'errorText' | 'successText' | 'helpText' | 'isDisabled' | 'defaultValue' | 'placeholder' | 'isRequired' | 'value' | 'onChange' | 'onBlur' | 'onSubmit' | 'onFocus' | 'name' | 'autoFocus' | 'keyboardReturnKeyType' | 'autoCompleteSuggestionType' | 'testID'> & PasswordInputExtraProps & StyledPropsBlade;
|
|
3904
|
-
declare const PasswordInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "placeholder" | "
|
|
3943
|
+
declare const PasswordInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "placeholder" | "name" | "label" | "value" | "onBlur" | "onFocus" | "defaultValue" | "onChange" | "onSubmit" | "isDisabled" | "autoFocus" | "labelPosition" | "helpText" | "errorText" | "successText" | "validationState" | "isRequired" | "maxCharacters" | "keyboardReturnKeyType" | "autoCompleteSuggestionType"> & PasswordInputExtraProps & Partial<MakeObjectResponsive<{
|
|
3905
3944
|
margin: SpacingValueType | ArrayOfMaxLength4<SpacingValueType>;
|
|
3906
3945
|
marginX: SpacingValueType;
|
|
3907
3946
|
marginY: SpacingValueType;
|
|
@@ -3946,7 +3985,7 @@ declare type TextAreaProps = Pick<BaseInputProps, 'label' | 'labelPosition' | 'n
|
|
|
3946
3985
|
*/
|
|
3947
3986
|
onClearButtonClick?: () => void;
|
|
3948
3987
|
} & StyledPropsBlade;
|
|
3949
|
-
declare const TextArea: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "placeholder" | "
|
|
3988
|
+
declare const TextArea: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "placeholder" | "name" | "label" | "value" | "onBlur" | "onFocus" | "numberOfLines" | "defaultValue" | "onChange" | "onSubmit" | "isDisabled" | "autoFocus" | "labelPosition" | "helpText" | "errorText" | "successText" | "necessityIndicator" | "validationState" | "isRequired" | "maxCharacters"> & {
|
|
3950
3989
|
/**
|
|
3951
3990
|
* Decides whether to render a clear icon button
|
|
3952
3991
|
*/
|
|
@@ -3990,6 +4029,11 @@ declare const TextArea: React__default.ForwardRefExoticComponent<Pick<BaseInputP
|
|
|
3990
4029
|
gridTemplate?: undefined;
|
|
3991
4030
|
}, "gridColumnEnd" | "gridColumnStart" | "gridRowEnd" | "gridRowStart" | "gridArea" | "gridColumn" | "gridRow">> & React__default.RefAttributes<BladeElementRef>>;
|
|
3992
4031
|
|
|
4032
|
+
declare type FormInputOnEventWithIndex = ({ name, value, inputIndex, }: {
|
|
4033
|
+
name?: string;
|
|
4034
|
+
value?: string;
|
|
4035
|
+
inputIndex: number;
|
|
4036
|
+
}) => void;
|
|
3993
4037
|
declare type OTPInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' | 'validationState' | 'helpText' | 'errorText' | 'successText' | 'name' | 'onChange' | 'value' | 'isDisabled' | 'autoFocus' | 'keyboardReturnKeyType' | 'keyboardType' | 'placeholder' | 'testID'> & {
|
|
3994
4038
|
/**
|
|
3995
4039
|
* Determines the number of input fields to show for the OTP
|
|
@@ -4018,6 +4062,14 @@ declare type OTPInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' | 'v
|
|
|
4018
4062
|
*
|
|
4019
4063
|
*/
|
|
4020
4064
|
autoCompleteSuggestionType?: Extract<BaseInputProps['autoCompleteSuggestionType'], 'none' | 'oneTimeCode'>;
|
|
4065
|
+
/**
|
|
4066
|
+
* The callback function to be invoked when one of the input fields gets focus
|
|
4067
|
+
*/
|
|
4068
|
+
onFocus?: FormInputOnEventWithIndex;
|
|
4069
|
+
/**
|
|
4070
|
+
* The callback function to be invoked when one of the input fields is blurred
|
|
4071
|
+
*/
|
|
4072
|
+
onBlur?: FormInputOnEventWithIndex;
|
|
4021
4073
|
} & StyledPropsBlade;
|
|
4022
4074
|
/**
|
|
4023
4075
|
* OTPInput component can be used for accepting OTPs sent to users for authentication/verification purposes.
|
|
@@ -4033,7 +4085,7 @@ declare type OTPInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' | 'v
|
|
|
4033
4085
|
* />
|
|
4034
4086
|
* ```
|
|
4035
4087
|
*/
|
|
4036
|
-
declare const OTPInput: ({ autoFocus, errorText, helpText, isDisabled, keyboardReturnKeyType, keyboardType, label, labelPosition, name, onChange, onOTPFilled, otpLength, placeholder, successText, validationState, value, isMasked, autoCompleteSuggestionType, testID, ...styledProps }: OTPInputProps) => React__default.ReactElement;
|
|
4088
|
+
declare const OTPInput: ({ autoFocus, errorText, helpText, isDisabled, keyboardReturnKeyType, keyboardType, label, labelPosition, name, onChange, onFocus, onBlur, onOTPFilled, otpLength, placeholder, successText, validationState, value, isMasked, autoCompleteSuggestionType, testID, ...styledProps }: OTPInputProps) => React__default.ReactElement;
|
|
4037
4089
|
|
|
4038
4090
|
declare type SelectInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' | 'necessityIndicator' | 'validationState' | 'helpText' | 'errorText' | 'successText' | 'name' | 'isDisabled' | 'isRequired' | 'prefix' | 'suffix' | 'autoFocus' | 'onClick' | 'onFocus' | 'onBlur' | 'placeholder' | 'testID'> & {
|
|
4039
4091
|
icon?: IconComponent$1;
|
|
@@ -4069,7 +4121,7 @@ declare type SelectInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' |
|
|
|
4069
4121
|
*
|
|
4070
4122
|
* Checkout {@link https://blade.razorpay.com/?path=/docs/components-dropdown-with-select--with-single-select SelectInput Documentation}.
|
|
4071
4123
|
*/
|
|
4072
|
-
declare const SelectInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "placeholder" | "
|
|
4124
|
+
declare const SelectInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "placeholder" | "name" | "label" | "onBlur" | "onFocus" | "onClick" | "prefix" | "isDisabled" | "autoFocus" | "labelPosition" | "helpText" | "errorText" | "successText" | "necessityIndicator" | "suffix" | "validationState" | "isRequired"> & {
|
|
4073
4125
|
icon?: IconComponent$1 | undefined;
|
|
4074
4126
|
onChange?: (({ name, values }: {
|
|
4075
4127
|
name?: string | undefined;
|
|
@@ -4711,7 +4763,7 @@ declare const BaseBox: styled_components.StyledComponent<typeof View, styled_com
|
|
|
4711
4763
|
children?: React$1.ReactNode | React$1.ReactNode[];
|
|
4712
4764
|
} & TestID>, "backgroundColor" | "as"> & Partial<MakeObjectResponsive<{
|
|
4713
4765
|
borderRadius: "none" | "small" | "medium" | "large" | "max" | "round";
|
|
4714
|
-
backgroundColor: "feedback.background.neutral.lowContrast" | "feedback.background.neutral.highContrast" | "feedback.background.information.lowContrast" | "feedback.background.information.highContrast" | "feedback.background.negative.lowContrast" | "feedback.background.negative.highContrast" | "feedback.background.notice.lowContrast" | "feedback.background.notice.highContrast" | "feedback.background.positive.lowContrast" | "feedback.background.positive.highContrast" | "surface.background.level1.lowContrast" | "surface.background.level1.highContrast" | "surface.background.level2.lowContrast" | "surface.background.level2.highContrast" | "surface.background.level3.lowContrast" | "surface.background.level3.highContrast" | "action.background.primary.disabled" | "action.background.primary.default" | "action.background.primary.hover" | "action.background.primary.focus" | "action.background.primary.active" | "action.background.secondary.disabled" | "action.background.secondary.default" | "action.background.secondary.hover" | "action.background.secondary.focus" | "action.background.secondary.active" | "action.background.tertiary.disabled" | "action.background.tertiary.default" | "action.background.tertiary.hover" | "action.background.tertiary.focus" | "action.background.tertiary.active"
|
|
4766
|
+
backgroundColor: (string & Record<never, never>) | "feedback.background.neutral.lowContrast" | "feedback.background.neutral.highContrast" | "feedback.background.information.lowContrast" | "feedback.background.information.highContrast" | "feedback.background.negative.lowContrast" | "feedback.background.negative.highContrast" | "feedback.background.notice.lowContrast" | "feedback.background.notice.highContrast" | "feedback.background.positive.lowContrast" | "feedback.background.positive.highContrast" | "surface.background.level1.lowContrast" | "surface.background.level1.highContrast" | "surface.background.level2.lowContrast" | "surface.background.level2.highContrast" | "surface.background.level3.lowContrast" | "surface.background.level3.highContrast" | "action.background.primary.disabled" | "action.background.primary.default" | "action.background.primary.hover" | "action.background.primary.focus" | "action.background.primary.active" | "action.background.secondary.disabled" | "action.background.secondary.default" | "action.background.secondary.hover" | "action.background.secondary.focus" | "action.background.secondary.active" | "action.background.tertiary.disabled" | "action.background.tertiary.default" | "action.background.tertiary.hover" | "action.background.tertiary.focus" | "action.background.tertiary.active";
|
|
4715
4767
|
lineHeight: SpacingValueType;
|
|
4716
4768
|
} & Pick<styled_components.CSSObject, "border" | "transform" | "borderBottom" | "borderLeft" | "borderRight" | "borderTop">> & {
|
|
4717
4769
|
className?: string | undefined;
|
|
@@ -3250,7 +3250,7 @@ var StyledListBoxWrapper=styled(ScrollView)(function(props){return _extends({},g
|
|
|
3250
3250
|
|
|
3251
3251
|
var componentIds={DropdownOverlay:'DropdownOverlay',Dropdown:'Dropdown'};var SelectActions={Close:'Close',CloseSelect:'CloseSelect',First:'First',Last:'Last',Next:'Next',Open:'Open',PageDown:'PageDown',PageUp:'PageUp',Previous:'Previous',Select:'Select',Type:'Type'};function filterOptions(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var filter=arguments.length>1?arguments[1]:undefined;var exclude=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];return options.filter(function(option){var matches=option.toLowerCase().startsWith(filter.toLowerCase());return matches&&!exclude.includes(option);});}function getActionFromKey(e,isOpen){if(!e){return undefined;}var altKey=e.altKey,ctrlKey=e.ctrlKey,metaKey=e.metaKey;var key='';if('key'in e){key=e.key;}var openKeys=['ArrowDown','ArrowUp','Enter',' '];if(!key)return undefined;if(!isOpen&&key&&openKeys.includes(key)){return SelectActions.Open;}if(key==='Home'){return SelectActions.First;}if(key==='End'){return SelectActions.Last;}if(key==='Backspace'||key==='Clear'||key.length===1&&key!==' '&&!altKey&&!ctrlKey&&!metaKey){return SelectActions.Type;}if(isOpen){if(key==='ArrowUp'&&altKey){return SelectActions.CloseSelect;}else if(key==='ArrowDown'&&!altKey){return SelectActions.Next;}else if(key==='ArrowUp'){return SelectActions.Previous;}else if(key==='PageUp'){return SelectActions.PageUp;}else if(key==='PageDown'){return SelectActions.PageDown;}else if(key==='Escape'){return SelectActions.Close;}else if(key==='Enter'||key===' '){return SelectActions.CloseSelect;}}return undefined;}function getIndexByLetter(options,filter){var startIndex=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var orderedOptions=[].concat(_toConsumableArray(options.slice(startIndex)),_toConsumableArray(options.slice(0,startIndex)));var firstMatch=filterOptions(orderedOptions,filter)[0];var allSameLetter=function allSameLetter(array){return array.every(function(letter){return letter===array[0];});};if(firstMatch){return options.indexOf(firstMatch);}else if(allSameLetter(filter.split(''))){var matches=filterOptions(orderedOptions,filter[0]);return options.indexOf(matches[0]);}else {return -1;}}function getUpdatedIndex(currentIndex,maxIndex,action){var pageSize=10;switch(action){case SelectActions.First:return 0;case SelectActions.Last:return maxIndex;case SelectActions.Previous:return Math.max(0,currentIndex-1);case SelectActions.Next:return Math.min(maxIndex,currentIndex+1);case SelectActions.PageUp:return Math.max(0,currentIndex-pageSize);case SelectActions.PageDown:return Math.min(maxIndex,currentIndex+pageSize);default:return currentIndex;}}function isElementVisibleOnScreen(element){var bounding=element.getBoundingClientRect();return bounding.top>=0&&bounding.left>=0&&bounding.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&bounding.right<=(window.innerWidth||document.documentElement.clientWidth);}function isScrollable(element){return element&&element.clientHeight<element.scrollHeight;}var performAction=function performAction(action,e,actions){var event=e.event;switch(action){case SelectActions.Last:case SelectActions.First:actions.setIsOpen(true);case SelectActions.Next:case SelectActions.Previous:case SelectActions.PageUp:case SelectActions.PageDown:event.preventDefault();actions.onOptionChange(action);return true;case SelectActions.CloseSelect:event.preventDefault();actions.selectCurrentOption();return true;case SelectActions.Close:event.preventDefault();actions.setIsOpen(false);return true;case SelectActions.Type:actions.onComboType(event.key,action);return true;case SelectActions.Open:event.preventDefault();actions.setIsOpen(true);return true;}return false;};var ensureScrollVisiblity=function ensureScrollVisiblity(newActiveIndex,containerElement,options){if(containerElement){if(isScrollable(containerElement)){var optionEl=containerElement.querySelectorAll('[role="option"]');if(newActiveIndex>=0&&optionEl[newActiveIndex].dataset.value===options[newActiveIndex]){var activeElement=optionEl[newActiveIndex];var bodyRect=containerElement.getBoundingClientRect().top;var elementRect=activeElement.getBoundingClientRect().top;var elementPosition=elementRect-bodyRect;var offsetPosition=elementPosition;containerElement.scrollTo({top:offsetPosition});if(!isElementVisibleOnScreen(optionEl[newActiveIndex])){activeElement.scrollIntoView({behavior:'smooth'});}}}}};var makeInputValue=function makeInputValue(selectedIndices,options){if(options.length===0){return '';}return selectedIndices.map(function(selectedIndex){var _options$selectedInde;return (_options$selectedInde=options[selectedIndex])==null?void 0:_options$selectedInde.value;}).join(', ');};var makeInputDisplayValue=function makeInputDisplayValue(selectedIndices,options){if(options.length===0||selectedIndices.length===0){return '';}if(selectedIndices.length===1){return options[selectedIndices[0]].title;}return selectedIndices.length+" items selected";};
|
|
3252
3252
|
|
|
3253
|
-
var _excluded$4N=["isOpen","setIsOpen","selectedIndices","setSelectedIndices","activeIndex","setActiveIndex","shouldIgnoreBlur","setShouldIgnoreBlur","isKeydownPressed","setIsKeydownPressed","options","selectionType"];var noop=function noop(){};var DropdownContext=React__default.createContext({isOpen:false,setIsOpen:noop,selectedIndices:[],setSelectedIndices:noop,options:[],setOptions:noop,activeIndex:-1,setActiveIndex:noop,shouldIgnoreBlur:false,setShouldIgnoreBlur:noop,shouldIgnoreBlurAnimation:false,setShouldIgnoreBlurAnimation:noop,hasFooterAction:false,setHasFooterAction:noop,hasLabelOnLeft:false,setHasLabelOnLeft:noop,isKeydownPressed:false,setIsKeydownPressed:noop,dropdownBaseId:'',actionListItemRef:{current:null},triggererRef:{current:null}});var searchTimeout;var searchString='';var useDropdown=function useDropdown(){var _React$useContext=React__default.useContext(DropdownContext),isOpen=_React$useContext.isOpen,setIsOpen=_React$useContext.setIsOpen,selectedIndices=_React$useContext.selectedIndices,setSelectedIndices=_React$useContext.setSelectedIndices,activeIndex=_React$useContext.activeIndex,setActiveIndex=_React$useContext.setActiveIndex,shouldIgnoreBlur=_React$useContext.shouldIgnoreBlur,setShouldIgnoreBlur=_React$useContext.setShouldIgnoreBlur,isKeydownPressed=_React$useContext.isKeydownPressed,setIsKeydownPressed=_React$useContext.setIsKeydownPressed,options=_React$useContext.options,selectionType=_React$useContext.selectionType,rest=_objectWithoutProperties(_React$useContext,_excluded$4N);var selectOption=function selectOption(index){var properties=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{closeOnSelection:true};if(index<0||index>options.length-1){return;}if(selectionType==='multiple'){if(selectedIndices.includes(index)){var existingItemIndex=selectedIndices.indexOf(index);setSelectedIndices([].concat(_toConsumableArray(selectedIndices.slice(0,existingItemIndex)),_toConsumableArray(selectedIndices.slice(existingItemIndex+1))));}else {setSelectedIndices([].concat(_toConsumableArray(selectedIndices),[index]));}}else {setSelectedIndices([index]);}if(activeIndex!==index){setActiveIndex(index);}if(properties!=null&&properties.closeOnSelection&&selectionType!=='multiple'){setIsOpen(false);}};var onTriggerClick=function onTriggerClick(){setIsOpen(!isOpen);};var onTriggerBlur=function onTriggerBlur(){if(rest.hasFooterAction){setActiveIndex(-1);}if(shouldIgnoreBlur){setShouldIgnoreBlur(false);return;}if(isOpen){if(selectionType!=='multiple'){selectOption(activeIndex);}setIsOpen(false);}};var onOptionChange=function onOptionChange(actionType,index){var max=options.length-1;var newIndex=index!=null?index:activeIndex;setActiveIndex(getUpdatedIndex(newIndex,max,actionType));var optionValues=options.map(function(option){return option.value;});ensureScrollVisiblity(newIndex,rest.actionListItemRef.current,optionValues);};var onOptionClick=function onOptionClick(e,index){var actionType=getActionFromKey(e,isOpen);if(typeof actionType==='number'){onOptionChange(actionType,index);}selectOption(index);if(!isReactNative$4()){var _rest$triggererRef$cu;(_rest$triggererRef$cu=rest.triggererRef.current)==null?void 0:_rest$triggererRef$cu.focus();}};var onComboType=function onComboType(letter,actionType){setIsOpen(true);if(typeof searchTimeout==='number'){window.clearTimeout(searchTimeout);}searchTimeout=window.setTimeout(function(){searchString='';},500);searchString=searchString+letter;var optionTitles=options.map(function(option){return option.title;});var searchIndex=getIndexByLetter(optionTitles,searchString,activeIndex+1);if(searchIndex>=0){onOptionChange(actionType,searchIndex);}else {window.clearTimeout(searchTimeout);searchString='';}};var onTriggerKeydown=function onTriggerKeydown(e){if(e.event.key==='Tab'&&rest.hasFooterAction){setShouldIgnoreBlur(true);}if(!isKeydownPressed&&![' ','Enter','Escape','Meta'].includes(e.event.key)){setIsKeydownPressed(true);}var actionType=getActionFromKey(e.event,isOpen);if(actionType){performAction(actionType,e,{setIsOpen:setIsOpen,onOptionChange:onOptionChange,onComboType:onComboType,selectCurrentOption:function selectCurrentOption(){var _options$activeIndex;selectOption(activeIndex);if(rest.hasFooterAction&&!isReactNative$4()){var _rest$triggererRef$cu2;(_rest$triggererRef$cu2=rest.triggererRef.current)==null?void 0:_rest$triggererRef$cu2.focus();}var anchorLink=(_options$activeIndex=options[activeIndex])==null?void 0:_options$activeIndex.href;if(anchorLink){window.location.href=anchorLink;if(window.top){window.top.location.href=anchorLink;}}}});}};return _extends({isOpen:isOpen,setIsOpen:setIsOpen,selectedIndices:selectedIndices,setSelectedIndices:setSelectedIndices,onTriggerClick:onTriggerClick,onTriggerKeydown:onTriggerKeydown,onTriggerBlur:onTriggerBlur,onOptionClick:onOptionClick,activeIndex:activeIndex,setActiveIndex:setActiveIndex,shouldIgnoreBlur:shouldIgnoreBlur,setShouldIgnoreBlur:setShouldIgnoreBlur,isKeydownPressed:isKeydownPressed,setIsKeydownPressed:setIsKeydownPressed,options:options,value:makeInputValue(selectedIndices,options),displayValue:makeInputDisplayValue(selectedIndices,options),selectionType:selectionType},rest);};
|
|
3253
|
+
var _excluded$4N=["isOpen","setIsOpen","selectedIndices","setSelectedIndices","activeIndex","setActiveIndex","shouldIgnoreBlur","setShouldIgnoreBlur","isKeydownPressed","setIsKeydownPressed","options","selectionType"];var noop=function noop(){};var DropdownContext=React__default.createContext({isOpen:false,setIsOpen:noop,selectedIndices:[],setSelectedIndices:noop,options:[],setOptions:noop,activeIndex:-1,setActiveIndex:noop,shouldIgnoreBlur:false,setShouldIgnoreBlur:noop,shouldIgnoreBlurAnimation:false,setShouldIgnoreBlurAnimation:noop,hasFooterAction:false,setHasFooterAction:noop,hasLabelOnLeft:false,setHasLabelOnLeft:noop,isKeydownPressed:false,setIsKeydownPressed:noop,dropdownBaseId:'',actionListItemRef:{current:null},triggererRef:{current:null}});var searchTimeout;var searchString='';var useDropdown=function useDropdown(){var _React$useContext=React__default.useContext(DropdownContext),isOpen=_React$useContext.isOpen,setIsOpen=_React$useContext.setIsOpen,selectedIndices=_React$useContext.selectedIndices,setSelectedIndices=_React$useContext.setSelectedIndices,activeIndex=_React$useContext.activeIndex,setActiveIndex=_React$useContext.setActiveIndex,shouldIgnoreBlur=_React$useContext.shouldIgnoreBlur,setShouldIgnoreBlur=_React$useContext.setShouldIgnoreBlur,isKeydownPressed=_React$useContext.isKeydownPressed,setIsKeydownPressed=_React$useContext.setIsKeydownPressed,options=_React$useContext.options,selectionType=_React$useContext.selectionType,rest=_objectWithoutProperties(_React$useContext,_excluded$4N);var selectOption=function selectOption(index){var properties=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{closeOnSelection:true};if(index<0||index>options.length-1){return;}if(selectionType==='multiple'){if(selectedIndices.includes(index)){var existingItemIndex=selectedIndices.indexOf(index);setSelectedIndices([].concat(_toConsumableArray(selectedIndices.slice(0,existingItemIndex)),_toConsumableArray(selectedIndices.slice(existingItemIndex+1))));}else {setSelectedIndices([].concat(_toConsumableArray(selectedIndices),[index]));}}else {setSelectedIndices([index]);}if(activeIndex!==index){setActiveIndex(index);}if(properties!=null&&properties.closeOnSelection&&selectionType!=='multiple'){setIsOpen(false);}};var onTriggerClick=function onTriggerClick(){setIsOpen(!isOpen);};var onTriggerBlur=function onTriggerBlur(_ref){var name=_ref.name,value=_ref.value,onBlurCallback=_ref.onBlurCallback;if(rest.hasFooterAction){setActiveIndex(-1);}if(shouldIgnoreBlur){setShouldIgnoreBlur(false);return;}onBlurCallback==null?void 0:onBlurCallback({name:name,value:value});if(isOpen){if(selectionType!=='multiple'){selectOption(activeIndex);}setIsOpen(false);}};var onOptionChange=function onOptionChange(actionType,index){var max=options.length-1;var newIndex=index!=null?index:activeIndex;setActiveIndex(getUpdatedIndex(newIndex,max,actionType));var optionValues=options.map(function(option){return option.value;});ensureScrollVisiblity(newIndex,rest.actionListItemRef.current,optionValues);};var onOptionClick=function onOptionClick(e,index){var actionType=getActionFromKey(e,isOpen);if(typeof actionType==='number'){onOptionChange(actionType,index);}selectOption(index);if(!isReactNative$4()){var _rest$triggererRef$cu;(_rest$triggererRef$cu=rest.triggererRef.current)==null?void 0:_rest$triggererRef$cu.focus();}};var onComboType=function onComboType(letter,actionType){setIsOpen(true);if(typeof searchTimeout==='number'){window.clearTimeout(searchTimeout);}searchTimeout=window.setTimeout(function(){searchString='';},500);searchString=searchString+letter;var optionTitles=options.map(function(option){return option.title;});var searchIndex=getIndexByLetter(optionTitles,searchString,activeIndex+1);if(searchIndex>=0){onOptionChange(actionType,searchIndex);}else {window.clearTimeout(searchTimeout);searchString='';}};var onTriggerKeydown=function onTriggerKeydown(e){if(e.event.key==='Tab'&&rest.hasFooterAction){setShouldIgnoreBlur(true);}if(!isKeydownPressed&&![' ','Enter','Escape','Meta'].includes(e.event.key)){setIsKeydownPressed(true);}var actionType=getActionFromKey(e.event,isOpen);if(actionType){performAction(actionType,e,{setIsOpen:setIsOpen,onOptionChange:onOptionChange,onComboType:onComboType,selectCurrentOption:function selectCurrentOption(){var _options$activeIndex;selectOption(activeIndex);if(rest.hasFooterAction&&!isReactNative$4()){var _rest$triggererRef$cu2;(_rest$triggererRef$cu2=rest.triggererRef.current)==null?void 0:_rest$triggererRef$cu2.focus();}var anchorLink=(_options$activeIndex=options[activeIndex])==null?void 0:_options$activeIndex.href;if(anchorLink){window.location.href=anchorLink;if(window.top){window.top.location.href=anchorLink;}}}});}};return _extends({isOpen:isOpen,setIsOpen:setIsOpen,selectedIndices:selectedIndices,setSelectedIndices:setSelectedIndices,onTriggerClick:onTriggerClick,onTriggerKeydown:onTriggerKeydown,onTriggerBlur:onTriggerBlur,onOptionClick:onOptionClick,activeIndex:activeIndex,setActiveIndex:setActiveIndex,shouldIgnoreBlur:shouldIgnoreBlur,setShouldIgnoreBlur:setShouldIgnoreBlur,isKeydownPressed:isKeydownPressed,setIsKeydownPressed:setIsKeydownPressed,options:options,value:makeInputValue(selectedIndices,options),displayValue:makeInputDisplayValue(selectedIndices,options),selectionType:selectionType},rest);};
|
|
3254
3254
|
|
|
3255
3255
|
var ThemeContext=createContext({theme:null,colorScheme:'light',platform:'onDesktop',setColorScheme:function setColorScheme(){return null;}});var useTheme=function useTheme(){var themeContext=useContext(ThemeContext);if(!themeContext.theme){throw new Error("[@razorpay/blade:BladeProvider]: BladeProvider is missing theme");}if(themeContext===undefined){throw new Error("[@razorpay/blade:BladeProvider]: useTheme must be used within BladeProvider");}return themeContext;};
|
|
3256
3256
|
|
|
@@ -3950,11 +3950,11 @@ var _excluded$n=["variant","intent","contrast","size","icon","iconPosition","isD
|
|
|
3950
3950
|
|
|
3951
3951
|
var getStyledLinkStyles=function getStyledLinkStyles(_ref){var cursor=_ref.cursor;return {padding:0,backgroundColor:'transparent',outline:'none',textDecoration:'none',border:'none',cursor:cursor};};
|
|
3952
3952
|
|
|
3953
|
-
var StyledNativeLink=styled.Pressable(function(props){var styledPropsCSSObject=useStyledProps(props);return _extends({},getStyledLinkStyles({}),{alignSelf:'flex-start'},styledPropsCSSObject);});var openURL=function _callee(href){var canOpen;return _regeneratorRuntime.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return _regeneratorRuntime.awrap(Linking.canOpenURL(href));case 3:canOpen=_context.sent;if(!canOpen){_context.next=7;break;}_context.next=7;return _regeneratorRuntime.awrap(Linking.openURL(href));case 7:_context.next=12;break;case 9:_context.prev=9;_context.t0=_context["catch"](0);console.warn("[Blade: BaseLink]: Could not open the link \"href="+href+"\"");case 12:case"end":return _context.stop();}}},null,null,[[0,9]],Promise);};var StyledLink=function StyledLink(_ref){var variant=_ref.variant,disabled=_ref.disabled,href=_ref.href,onClick=_ref.onClick,children=_ref.children,setCurrentInteraction=_ref.setCurrentInteraction,accessibilityProps=_ref.accessibilityProps,style=_ref.style,testID=_ref.testID;var handleOnPress=function handleOnPress(event){if(href&&variant==='anchor'){void openURL(href);}if(onClick){onClick(event);}};return jsx(StyledNativeLink,_extends({},accessibilityProps,{disabled:disabled,onPress:handleOnPress,onPressIn:function onPressIn(){return setCurrentInteraction('active');},onPressOut:function onPressOut(){return setCurrentInteraction('default');},style:style,testID:testID,children:children}));};
|
|
3953
|
+
var StyledNativeLink=styled.Pressable(function(props){var styledPropsCSSObject=useStyledProps(props);return _extends({},getStyledLinkStyles({}),{alignSelf:'flex-start'},styledPropsCSSObject);});var openURL=function _callee(href){var canOpen;return _regeneratorRuntime.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return _regeneratorRuntime.awrap(Linking.canOpenURL(href));case 3:canOpen=_context.sent;if(!canOpen){_context.next=7;break;}_context.next=7;return _regeneratorRuntime.awrap(Linking.openURL(href));case 7:_context.next=12;break;case 9:_context.prev=9;_context.t0=_context["catch"](0);console.warn("[Blade: BaseLink]: Could not open the link \"href="+href+"\"");case 12:case"end":return _context.stop();}}},null,null,[[0,9]],Promise);};var StyledLink=function StyledLink(_ref){var variant=_ref.variant,disabled=_ref.disabled,href=_ref.href,onClick=_ref.onClick,children=_ref.children,setCurrentInteraction=_ref.setCurrentInteraction,accessibilityProps=_ref.accessibilityProps,style=_ref.style,testID=_ref.testID,hitSlop=_ref.hitSlop;var handleOnPress=function handleOnPress(event){if(href&&variant==='anchor'){void openURL(href);}if(onClick){onClick(event);}};return jsx(StyledNativeLink,_extends({},accessibilityProps,{disabled:disabled,onPress:handleOnPress,onPressIn:function onPressIn(){return setCurrentInteraction('active');},onPressOut:function onPressOut(){return setCurrentInteraction('default');},style:style,testID:testID,hitSlop:hitSlop,children:children}));};
|
|
3954
3954
|
|
|
3955
3955
|
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};};
|
|
3956
3956
|
|
|
3957
|
-
var _excluded$m=["children","icon","iconPosition","isDisabled","onClick","variant","href","target","rel","intent","contrast","accessibilityLabel","className","style","size","testID"],_excluded2=["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,lineHeight:size==='medium'?'m':'s',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,testID=_ref3.testID,styledProps=_objectWithoutProperties(_ref3,_excluded$m);var _useState=useState(false),_useState2=_slicedToArray(_useState,2),isVisited=_useState2[0],setIsVisited=_useState2[1];var childrenString=getStringFromReactText(children);var _useInteraction=useInteraction(),currentInteraction=_useInteraction.currentInteraction,setCurrentInteraction=_useInteraction.setCurrentInteraction,syntheticEvents=_objectWithoutProperties(_useInteraction,_excluded2);var _useTheme=useTheme(),theme=_useTheme.theme;if(!Icon&&!(childrenString!=null&&childrenString.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:childrenString,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,lineHeight=_getProps.lineHeight;var handleOnClick=function handleOnClick(event){if(!isVisited&&!intent&&variant==='anchor'){setIsVisited(true);}if(onClick){onClick(event);}};return jsx(StyledLink,_extends({},syntheticEvents,metaAttribute({name:MetaConstants.Link,testID:testID}),{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},styledProps,{className:className,style:style,children:jsxs(BaseBox,{display:"flex",flexDirection:"row",className:"content-container",alignItems:"center",children:[Icon&&iconPosition=='left'?jsx(BaseBox,{paddingRight:iconPadding,display:"flex",alignItems:"center",children:jsx(Icon,{color:iconColor,size:iconSize})}):null,jsx(BaseText,{textDecorationLine:textDecorationLine,color:textColor,fontSize:fontSize,lineHeight:lineHeight,textAlign:"center",fontWeight:"bold",children:children}),Icon&&iconPosition=='right'?jsx(BaseBox,{paddingLeft:iconPadding,display:"flex",alignItems:"center",children:jsx(Icon,{color:iconColor,size:iconSize})}):null]})}));};
|
|
3957
|
+
var _excluded$m=["children","icon","iconPosition","isDisabled","onClick","variant","href","target","rel","intent","contrast","accessibilityLabel","className","style","size","testID","hitSlop"],_excluded2=["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,lineHeight:size==='medium'?'m':'s',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,testID=_ref3.testID,hitSlop=_ref3.hitSlop,styledProps=_objectWithoutProperties(_ref3,_excluded$m);var _useState=useState(false),_useState2=_slicedToArray(_useState,2),isVisited=_useState2[0],setIsVisited=_useState2[1];var childrenString=getStringFromReactText(children);var _useInteraction=useInteraction(),currentInteraction=_useInteraction.currentInteraction,setCurrentInteraction=_useInteraction.setCurrentInteraction,syntheticEvents=_objectWithoutProperties(_useInteraction,_excluded2);var _useTheme=useTheme(),theme=_useTheme.theme;if(!Icon&&!(childrenString!=null&&childrenString.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:childrenString,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,lineHeight=_getProps.lineHeight;var handleOnClick=function handleOnClick(event){if(!isVisited&&!intent&&variant==='anchor'){setIsVisited(true);}if(onClick){onClick(event);}};return jsx(StyledLink,_extends({},syntheticEvents,metaAttribute({name:MetaConstants.Link,testID:testID}),{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},styledProps,{className:className,style:style,hitSlop:hitSlop,children:jsxs(BaseBox,{display:"flex",flexDirection:"row",className:"content-container",alignItems:"center",children:[Icon&&iconPosition=='left'?jsx(BaseBox,{paddingRight:iconPadding,display:"flex",alignItems:"center",children:jsx(Icon,{color:iconColor,size:iconSize})}):null,jsx(BaseText,{textDecorationLine:textDecorationLine,color:textColor,fontSize:fontSize,lineHeight:lineHeight,textAlign:"center",fontWeight:"bold",children:children}),Icon&&iconPosition=='right'?jsx(BaseBox,{paddingLeft:iconPadding,display:"flex",alignItems:"center",children:jsx(Icon,{color:iconColor,size:iconSize})}):null]})}));};
|
|
3958
3958
|
|
|
3959
3959
|
var _excluded$l=["description","title","isDismissible","onDismiss","contrast","isFullWidth","intent","actions","testID"];var isReactNative$3=getPlatformType()==='react-native';var CloseButtonWrapper=isReactNative$3?BaseBox:Fragment$1;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$isDismissible=_ref.isDismissible,isDismissible=_ref$isDismissible===void 0?true:_ref$isDismissible,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,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$l);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(BaseBox,{marginTop:iconOffset,display:"flex",children:jsx(Icon,{color:"feedback.icon."+intent+"."+contrastType,size:iconSize})});var _title=title?jsx(BaseBox,{marginBottom:"spacing.2",children:isFullWidth?jsx(Heading,{type:"subtle",size:"small",contrast:contrast,children:title}):jsx(Text,{type:"subtle",weight:"bold",contrast:contrast,children:title})}):null;var _description=jsx(BaseBox,{marginTop:title||isReactNative$3?'spacing.0':'spacing.1',children:jsx(Text,{type:"subtle",size:textSize,contrast:contrast,children:description})});var primaryAction=actions!=null&&actions.primary?jsx(BaseBox,{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(BaseBox,{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(BaseBox,{flexDirection:"row",alignItems:"center",children:[primaryAction,secondaryAction]}):null;var actionsVertical=!showActionsHorizontal&&(primaryAction||secondaryAction)?jsxs(BaseBox,{marginTop:"spacing.4",flexDirection:"row",alignItems:"center",children:[primaryAction,secondaryAction]}):null;var onClickDismiss=function onClickDismiss(){if(onDismiss){onDismiss();}setIsVisible(false);};var closeButton=isDismissible?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({name:MetaConstants.Alert,testID:testID}),getStyledProps(styledProps),{children:[icon,jsxs(BaseBox,{flex:1,paddingLeft:isFullWidth?'spacing.4':'spacing.3',paddingRight:showActionsHorizontal?'spacing.4':'spacing.2',children:[_title,_description,actionsVertical]}),actionsHorizontal,closeButton]}));};
|
|
3960
3960
|
|
|
@@ -3976,7 +3976,7 @@ var CardContext=React__default.createContext(null);var useVerifyInsideCard=funct
|
|
|
3976
3976
|
|
|
3977
3977
|
var _excluded$i=["children","surfaceLevel","testID"];var ComponentIds$1={CardHeader:'CardHeader',CardHeaderTrailing:'CardHeaderTrailing',CardHeaderLeading:'CardHeaderLeading',CardFooter:'CardFooter',CardFooterTrailing:'CardFooterTrailing',CardFooterLeading:'CardFooterLeading',CardBody:'CardBody',CardHeaderIcon:'CardHeaderIcon',CardHeaderCounter:'CardHeaderCounter',CardHeaderBadge:'CardHeaderBadge',CardHeaderText:'CardHeaderText',CardHeaderLink:'CardHeaderLink',CardHeaderIconButton:'CardHeaderIconButton'};var Card=function Card(_ref){var children=_ref.children,_ref$surfaceLevel=_ref.surfaceLevel,surfaceLevel=_ref$surfaceLevel===void 0?3:_ref$surfaceLevel,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$i);useVerifyAllowedComponents(children,'Card',[ComponentIds$1.CardHeader,ComponentIds$1.CardBody,ComponentIds$1.CardFooter]);return jsx(CardProvider,{children:jsx(CardSurface,_extends({},metaAttribute({name:MetaConstants.Card,testID:testID}),{paddingLeft:"spacing.7",paddingRight:"spacing.7",paddingTop:"spacing.6",paddingBottom:"spacing.6",borderRadius:"medium",surfaceLevel:surfaceLevel},getStyledProps(styledProps),{children:children}))});};var CardBody=function CardBody(_ref2){var children=_ref2.children,testID=_ref2.testID;useVerifyInsideCard('CardBody');return jsx(BaseBox,_extends({},metaAttribute({name:MetaConstants.CardBody,testID:testID}),{children:children}));};CardBody.componentId=ComponentIds$1.CardBody;
|
|
3978
3978
|
|
|
3979
|
-
var _excluded$h=["children","icon","iconPosition","isDisabled","onClick","variant","href","target","rel","accessibilityLabel","size","testID"];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,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$h);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,testID:testID},styledProps));};
|
|
3979
|
+
var _excluded$h=["children","icon","iconPosition","isDisabled","onClick","variant","href","target","rel","accessibilityLabel","size","testID","hitSlop"];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,testID=_ref.testID,hitSlop=_ref.hitSlop,styledProps=_objectWithoutProperties(_ref,_excluded$h);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,testID:testID,hitSlop:hitSlop},styledProps));};
|
|
3980
3980
|
|
|
3981
3981
|
var _excluded$g=["children","icon","iconPosition","isDisabled","isFullWidth","isLoading","onClick","size","type","variant","accessibilityLabel","testID"];var _Button=function _Button(_ref,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,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$g);return jsx(BaseButton,_extends({},icon?{icon:icon,children:children}:{children:children},styledProps,{ref:ref,accessibilityLabel:accessibilityLabel,iconPosition:iconPosition,isDisabled:isDisabled,isFullWidth:isFullWidth,onClick:onClick,size:size,type:type,variant:variant,isLoading:isLoading,testID:testID}));};var Button=React__default.forwardRef(_Button);Button.displayName='Button';
|
|
3982
3982
|
|
|
@@ -3990,7 +3990,7 @@ var StyledCounter=styled(BaseBox)(function(props){return _extends({},getStyledCo
|
|
|
3990
3990
|
|
|
3991
3991
|
var _excluded$f=["value","max","intent","contrast","size","testID"];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,testID=_ref2.testID,styledProps=_objectWithoutProperties(_ref2,_excluded$f);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 counterTextSizes={small:{variant:'body',size:'xsmall'},medium:{variant:'body',size:'small'},large:{variant:'body',size:'medium'}};return jsx(StyledCounter,_extends({backgroundColor:backgroundColor,size:size,platform:platform},getStyledProps(styledProps),{children:jsx(BaseBox,_extends({paddingRight:horizontalPadding[size],paddingLeft:horizontalPadding[size],paddingTop:verticalPadding[size],paddingBottom:verticalPadding[size],display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",overflow:"hidden"},metaAttribute({name:MetaConstants.Counter,testID:testID}),{children:jsx(Text,_extends({},counterTextSizes[size],{type:"normal",weight:"regular",truncateAfterLines:1,color:textColor,children:content}))}))}));};
|
|
3992
3992
|
|
|
3993
|
-
var CardHeaderIcon=function CardHeaderIcon(_ref){var Icon=_ref.icon;useVerifyInsideCard('CardHeaderIcon');return jsx(Icon,{color:"surface.text.normal.lowContrast",size:"xlarge"});};CardHeaderIcon.componentId=ComponentIds$1.CardHeaderIcon;var CardHeaderCounter=function CardHeaderCounter(props){useVerifyInsideCard('CardHeaderCounter');return jsx(Counter,_extends({},props));};CardHeaderCounter.componentId=ComponentIds$1.CardHeaderCounter;var CardHeaderBadge=function CardHeaderBadge(props){useVerifyInsideCard('CardHeaderBadge');return jsx(Badge,_extends({},props));};CardHeaderBadge.componentId=ComponentIds$1.CardHeaderBadge;var CardHeaderText=function CardHeaderText(props){useVerifyInsideCard('CardHeaderText');return jsx(Text,_extends({},props));};CardHeaderText.componentId=ComponentIds$1.CardHeaderText;var CardHeaderLink=function CardHeaderLink(props){useVerifyInsideCard('CardHeaderLink');return jsx(Link,_extends({},props));};CardHeaderLink.componentId=ComponentIds$1.CardHeaderLink;var CardHeaderIconButton=function CardHeaderIconButton(props){useVerifyInsideCard('CardHeaderIconButton');return jsx(BaseBox,{width:makeSpace(minHeight.xsmall),children:jsx(Button,_extends({},props,{variant:"tertiary",size:"xsmall",iconPosition:"left",isFullWidth:true}))});};CardHeaderIconButton.componentId=ComponentIds$1.CardHeaderIconButton;var CardHeader=function CardHeader(_ref2){var children=_ref2.children,testID=_ref2.testID;useVerifyInsideCard('CardHeader');useVerifyAllowedComponents(children,'CardHeader',[ComponentIds$1.CardHeaderLeading,ComponentIds$1.CardHeaderTrailing]);return jsxs(BaseBox,_extends({marginBottom:"spacing.7"},metaAttribute({name:MetaConstants.CardHeader,testID:testID}),{children:[jsx(BaseBox,{marginBottom:"spacing.7",display:"flex",flexDirection:"row",justifyContent:"space-between",children:children}),jsx(Divider,{})]}));};CardHeader.componentId=ComponentIds$1.CardHeader;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$1.CardHeaderIcon)){throw new Error("[Blade CardHeaderLeading]: Only `"+ComponentIds$1.CardHeaderIcon+"` component is accepted in prefix");}if(suffix&&!isValidAllowedChildren(suffix,ComponentIds$1.CardHeaderCounter)){throw new Error("[Blade CardHeaderLeading]: Only `"+ComponentIds$1.CardHeaderCounter+"` component is accepted in prefix");}return jsxs(BaseBox,{flex:1,display:"flex",flexDirection:"row",children:[jsx(BaseBox,{marginRight:"spacing.3",alignSelf:"center",display:"flex",children:prefix}),jsxs(BaseBox,{children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",alignItems:"center",flexWrap:"wrap",children:[jsx(Heading,{size:"small",variant:"regular",type:"normal",children:title}),jsx(BaseBox,{marginLeft:"spacing.3",children:suffix})]}),jsx(Text,{variant:"body",size:"small",weight:"regular",children:subtitle})]})]});};CardHeaderLeading.componentId=ComponentIds$1.CardHeaderLeading;var headerTrailingAllowedComponents=[ComponentIds$1.CardHeaderLink,ComponentIds$1.CardHeaderText,ComponentIds$1.CardHeaderIconButton,ComponentIds$1.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(BaseBox,{alignSelf:"center",children:visual});};CardHeaderTrailing.componentId=ComponentIds$1.CardHeaderTrailing;
|
|
3993
|
+
var CardHeaderIcon=function CardHeaderIcon(_ref){var Icon=_ref.icon;useVerifyInsideCard('CardHeaderIcon');return jsx(Icon,{color:"surface.text.normal.lowContrast",size:"xlarge"});};CardHeaderIcon.componentId=ComponentIds$1.CardHeaderIcon;var CardHeaderCounter=function CardHeaderCounter(props){useVerifyInsideCard('CardHeaderCounter');return jsx(Counter,_extends({},props));};CardHeaderCounter.componentId=ComponentIds$1.CardHeaderCounter;var CardHeaderBadge=function CardHeaderBadge(props){useVerifyInsideCard('CardHeaderBadge');return jsx(Badge,_extends({},props));};CardHeaderBadge.componentId=ComponentIds$1.CardHeaderBadge;var CardHeaderText=function CardHeaderText(props){useVerifyInsideCard('CardHeaderText');return jsx(Text,_extends({},props));};CardHeaderText.componentId=ComponentIds$1.CardHeaderText;var CardHeaderLink=function CardHeaderLink(props){useVerifyInsideCard('CardHeaderLink');return jsx(Link,_extends({},props));};CardHeaderLink.componentId=ComponentIds$1.CardHeaderLink;var CardHeaderIconButton=function CardHeaderIconButton(props){useVerifyInsideCard('CardHeaderIconButton');return jsx(BaseBox,{width:makeSpace(minHeight.xsmall),children:jsx(Button,_extends({},props,{variant:"tertiary",size:"xsmall",iconPosition:"left",isFullWidth:true}))});};CardHeaderIconButton.componentId=ComponentIds$1.CardHeaderIconButton;var CardHeader=function CardHeader(_ref2){var children=_ref2.children,testID=_ref2.testID;useVerifyInsideCard('CardHeader');useVerifyAllowedComponents(children,'CardHeader',[ComponentIds$1.CardHeaderLeading,ComponentIds$1.CardHeaderTrailing]);return jsxs(BaseBox,_extends({marginBottom:"spacing.7"},metaAttribute({name:MetaConstants.CardHeader,testID:testID}),{children:[jsx(BaseBox,{marginBottom:"spacing.7",display:"flex",flexDirection:"row",justifyContent:"space-between",children:children}),jsx(Divider,{})]}));};CardHeader.componentId=ComponentIds$1.CardHeader;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$1.CardHeaderIcon)){throw new Error("[Blade CardHeaderLeading]: Only `"+ComponentIds$1.CardHeaderIcon+"` component is accepted in prefix");}if(suffix&&!isValidAllowedChildren(suffix,ComponentIds$1.CardHeaderCounter)){throw new Error("[Blade CardHeaderLeading]: Only `"+ComponentIds$1.CardHeaderCounter+"` component is accepted in prefix");}return jsxs(BaseBox,{flex:1,display:"flex",flexDirection:"row",children:[jsx(BaseBox,{marginRight:"spacing.3",alignSelf:"center",display:"flex",children:prefix}),jsxs(BaseBox,{children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",alignItems:"center",flexWrap:"wrap",children:[jsx(Heading,{size:"small",variant:"regular",type:"normal",children:title}),jsx(BaseBox,{marginLeft:"spacing.3",children:suffix})]}),subtitle&&jsx(Text,{variant:"body",size:"small",weight:"regular",children:subtitle})]})]});};CardHeaderLeading.componentId=ComponentIds$1.CardHeaderLeading;var headerTrailingAllowedComponents=[ComponentIds$1.CardHeaderLink,ComponentIds$1.CardHeaderText,ComponentIds$1.CardHeaderIconButton,ComponentIds$1.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(BaseBox,{alignSelf:"center",children:visual});};CardHeaderTrailing.componentId=ComponentIds$1.CardHeaderTrailing;
|
|
3994
3994
|
|
|
3995
3995
|
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,testID=_ref.testID;var isMobile=useIsMobile();useVerifyInsideCard('CardFooter');useVerifyAllowedComponents(children,'CardFooter',[ComponentIds$1.CardFooterLeading,ComponentIds$1.CardFooterTrailing]);return jsxs(BaseBox,_extends({marginTop:"auto"},metaAttribute({name:MetaConstants.CardFooter,testID:testID}),{children:[jsx(BaseBox,{marginTop:"spacing.7"}),jsx(Divider,{}),jsx(BaseBox,{marginTop:"spacing.7",display:"flex",flexDirection:isMobile?'column':'row',justifyContent:"space-between",alignItems:isMobile?'stretch':'center',children:children})]}));};CardFooter.componentId=ComponentIds$1.CardFooter;var CardFooterLeading=function CardFooterLeading(_ref2){var title=_ref2.title,subtitle=_ref2.subtitle;useVerifyInsideCard('CardFooterLeading');return jsxs(BaseBox,{children:[title&&jsx(Text,{variant:"body",size:"medium",weight:"bold",children:title}),subtitle&&jsx(Text,{variant:"body",size:"small",weight:"regular",children:subtitle})]});};CardFooterLeading.componentId=ComponentIds$1.CardFooterLeading;var CardFooterTrailing=function CardFooterTrailing(_ref3){var actions=_ref3.actions;var isMobile=useIsMobile();useVerifyInsideCard('CardFooterTrailing');return jsxs(BaseBox,{display:"flex",flexDirection:"row",alignSelf:isMobile?'auto':'center',marginTop:isMobile?'spacing.5':'spacing.0',marginLeft:isMobile?'spacing.0':'spacing.5',children:[jsx(BaseBox,{flexGrow:1,children:actions!=null&&actions.secondary?jsx(Button,_extends({isFullWidth:true,size:"medium",variant:"secondary"},actions.secondary,{children:actions.secondary.text})):null}),jsx(BaseBox,{marginLeft:"spacing.5"}),jsx(BaseBox,{flexGrow:1,children:actions!=null&&actions.primary?jsx(Button,_extends({isFullWidth:true,size:"medium"},actions.primary,{children:actions.primary.text})):null})]});};CardFooterTrailing.componentId=ComponentIds$1.CardFooterTrailing;
|
|
3996
3996
|
|
|
@@ -4022,11 +4022,11 @@ var _excluded$8=["label","labelPosition","showRevealButton","maxCharacters","val
|
|
|
4022
4022
|
|
|
4023
4023
|
var _excluded$7=["label","labelPosition","necessityIndicator","errorText","helpText","successText","validationState","defaultValue","isDisabled","isRequired","name","onChange","onFocus","onBlur","onSubmit","placeholder","value","maxCharacters","showClearButton","onClearButtonClick","autoFocus","numberOfLines","testID"];var isReactNative$1=function isReactNative(_textInputRef){return getPlatformType()==='react-native';};var _TextArea=function _TextArea(_ref,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,_onChange=_ref.onChange,onFocus=_ref.onFocus,onBlur=_ref.onBlur,onSubmit=_ref.onSubmit,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,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$7);var inputRef=useBladeInnerRef(ref);var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),shouldShowClearButton=_React$useState2[0],setShouldShowClearButton=_React$useState2[1];React__default.useEffect(function(){setShouldShowClearButton(Boolean(showClearButton&&((value==null?void 0:value.length)||(defaultValue==null?void 0:defaultValue.length))));},[showClearButton,defaultValue,value]);var renderInteractionElement=function renderInteractionElement(){if(shouldShowClearButton){return jsx(BaseBox,{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,_extends({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,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});},onFocus:onFocus,onBlur:onBlur,onSubmit:onSubmit,trailingFooterSlot:function trailingFooterSlot(value){var _value$length;return maxCharacters?jsx(BaseBox,{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;},testID:testID},styledProps));};var TextArea=React__default.forwardRef(_TextArea);TextArea.displayName='TextArea';
|
|
4024
4024
|
|
|
4025
|
-
var _excluded$6=["autoFocus","errorText","helpText","isDisabled","keyboardReturnKeyType","keyboardType","label","labelPosition","name","onChange","onOTPFilled","otpLength","placeholder","successText","validationState","value","isMasked","autoCompleteSuggestionType","testID"];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,_ref$autoCompleteSugg=_ref.autoCompleteSuggestionType,autoCompleteSuggestionType=_ref$autoCompleteSugg===void 0?'oneTimeCode':_ref$autoCompleteSugg,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$6);var inputRefs=[];var _useState=useState(otpToArray(inputValue)),_useState2=_slicedToArray(_useState,2),otpValue=_useState2[0],setOtpValue=_useState2[1];var _useState3=useState([]),_useState4=_slicedToArray(_useState3,2),inputType=_useState4[0],setInputType=_useState4[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]);useEffect(function(){otpValue.forEach(function(otp,index){if(!isEmpty_1(otp)&&!inputType[index]&&isMasked){var newInputType=Array.from(inputType);newInputType[index]='password';setInputType(newInputType);}if(isEmpty_1(otp)&&inputType[index]){var _newInputType=Array.from(inputType);_newInputType[index]=undefined;setInputType(_newInputType);}});},[otpValue,inputType,isMasked]);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();var currentInputType=void 0;if(isMasked){currentInputType=inputValue?'password':inputType[index];}inputRefs.push(ref);inputs.push(jsx(BaseBox,{flex:1,marginLeft:index==0?'spacing.0':'spacing.3',maxWidth:platform==='onDesktop'?makeSize(size[36]):makeSize(size[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:autoCompleteSuggestionType,keyboardType:keyboardType,keyboardReturnKeyType:keyboardReturnKeyType,validationState:validationState,successText:successText,errorText:errorText,helpText:helpText,hideFormHint:true,type:currentInputType})},inputId+"-"+index));};for(var index=0;index<otpLength;index++){_loop(index);}return inputs;};return jsxs(BaseBox,_extends({},metaAttribute({name:MetaConstants.OTPInput,testID:testID}),getStyledProps(styledProps),{children:[jsxs(BaseBox,{display:"flex",flexDirection:isLabelLeftPositioned?'row':'column',alignItems:isLabelLeftPositioned?'center':undefined,position:"relative",children:[jsx(FormLabel,{as:"label",position:labelPosition,htmlFor:inputId,children:label}),jsxs(BaseBox,{display:"flex",flexDirection:"row",children:[getHiddenInput(),getOTPInputFields()]})]}),jsx(BaseBox,{marginLeft:makeSize(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})})]}));};
|
|
4025
|
+
var _excluded$6=["autoFocus","errorText","helpText","isDisabled","keyboardReturnKeyType","keyboardType","label","labelPosition","name","onChange","onFocus","onBlur","onOTPFilled","otpLength","placeholder","successText","validationState","value","isMasked","autoCompleteSuggestionType","testID"];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,_onFocus=_ref.onFocus,_onBlur=_ref.onBlur,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,_ref$autoCompleteSugg=_ref.autoCompleteSuggestionType,autoCompleteSuggestionType=_ref$autoCompleteSugg===void 0?'oneTimeCode':_ref$autoCompleteSugg,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$6);var inputRefs=[];var _useState=useState(otpToArray(inputValue)),_useState2=_slicedToArray(_useState,2),otpValue=_useState2[0],setOtpValue=_useState2[1];var _useState3=useState([]),_useState4=_slicedToArray(_useState3,2),inputType=_useState4[0],setInputType=_useState4[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]);useEffect(function(){otpValue.forEach(function(otp,index){if(!isEmpty_1(otp)&&!inputType[index]&&isMasked){var newInputType=Array.from(inputType);newInputType[index]='password';setInputType(newInputType);}if(isEmpty_1(otp)&&inputType[index]){var _newInputType=Array.from(inputType);_newInputType[index]=undefined;setInputType(_newInputType);}});},[otpValue,inputType,isMasked]);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();var currentInputType=void 0;if(isMasked){currentInputType=inputValue?'password':inputType[index];}inputRefs.push(ref);inputs.push(jsx(BaseBox,{flex:1,marginLeft:index==0?'spacing.0':'spacing.3',maxWidth:platform==='onDesktop'?makeSize(size[36]):makeSize(size[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,name:name,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}));},onFocus:function onFocus(formEvent){return _onFocus==null?void 0:_onFocus(_extends({},formEvent,{inputIndex:index}));},onBlur:function onBlur(formEvent){return _onBlur==null?void 0:_onBlur(_extends({},formEvent,{inputIndex: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:autoCompleteSuggestionType,keyboardType:keyboardType,keyboardReturnKeyType:keyboardReturnKeyType,validationState:validationState,successText:successText,errorText:errorText,helpText:helpText,hideFormHint:true,type:currentInputType})},inputId+"-"+index));};for(var index=0;index<otpLength;index++){_loop(index);}return inputs;};return jsxs(BaseBox,_extends({},metaAttribute({name:MetaConstants.OTPInput,testID:testID}),getStyledProps(styledProps),{children:[jsxs(BaseBox,{display:"flex",flexDirection:isLabelLeftPositioned?'row':'column',alignItems:isLabelLeftPositioned?'center':undefined,position:"relative",children:[jsx(FormLabel,{as:"label",position:labelPosition,htmlFor:inputId,children:label}),jsxs(BaseBox,{display:"flex",flexDirection:"row",children:[getHiddenInput(),getOTPInputFields()]})]}),jsx(BaseBox,{marginLeft:makeSize(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})})]}));};
|
|
4026
4026
|
|
|
4027
4027
|
var StyledChevronIconContainer=styled(TouchableOpacity)(function(_props){return {display:'flex',justifyContent:'center'};});var SelectChevronIcon=function SelectChevronIcon(props){var Icon=props.icon;return jsx(StyledChevronIconContainer,{accessibilityLabel:"Chevron Icon",onPress:props.onClick,children:jsx(Icon,{color:"surface.text.normal.lowContrast",size:"medium"})});};
|
|
4028
4028
|
|
|
4029
|
-
var _excluded$5=["icon","onChange","placeholder"];var _SelectInput=function _SelectInput(props,ref){var _useDropdown=useDropdown(),isOpen=_useDropdown.isOpen,value=_useDropdown.value,displayValue=_useDropdown.displayValue,onTriggerClick=_useDropdown.onTriggerClick,onTriggerKeydown=_useDropdown.onTriggerKeydown,onTriggerBlur=_useDropdown.onTriggerBlur,dropdownBaseId=_useDropdown.dropdownBaseId,activeIndex=_useDropdown.activeIndex,triggererRef=_useDropdown.triggererRef,hasFooterAction=_useDropdown.hasFooterAction,dropdownTriggerer=_useDropdown.dropdownTriggerer,shouldIgnoreBlurAnimation=_useDropdown.shouldIgnoreBlurAnimation,setHasLabelOnLeft=_useDropdown.setHasLabelOnLeft;var inputRef=useBladeInnerRef(ref,{onFocus:function onFocus(opts){var _triggererRef$current;(_triggererRef$current=triggererRef.current)==null?void 0:_triggererRef$current.focus(opts);}});var icon=props.icon,onChange=props.onChange,_props$placeholder=props.placeholder,placeholder=_props$placeholder===void 0?'Select Option':_props$placeholder,baseInputProps=_objectWithoutProperties(props,_excluded$5);React__default.useEffect(function(){onChange==null?void 0:onChange({name:props.name,values:value.split(', ')});},[value,props.name]);React__default.useEffect(function(){setHasLabelOnLeft(props.labelPosition==='left');},[props.labelPosition,setHasLabelOnLeft]);return jsxs(BaseBox,{position:"relative",children:[!isReactNative$4()?jsx(VisuallyHidden,{children:jsx("input",{ref:inputRef,tabIndex:-1,required:props.isRequired,name:props.name,value:value,onChange:function onChange(){},"aria-hidden":true})}):null,jsx(BaseInput,_extends({},baseInputProps,{as:"button",componentName:MetaConstants.SelectInput,ref:!isReactNative$4()?triggererRef:null,textAlign:"left",value:displayValue,placeholder:placeholder,id:dropdownBaseId+"-trigger",labelId:dropdownBaseId+"-label",leadingIcon:icon,hasPopup:getActionListContainerRole(hasFooterAction,dropdownTriggerer),isPopupExpanded:isOpen,onClick:onTriggerClick,onKeyDown:onTriggerKeydown,onBlur:onTriggerBlur,activeDescendant:activeIndex>=0?dropdownBaseId+"-"+activeIndex:undefined,popupId:dropdownBaseId+"-actionlist",shouldIgnoreBlurAnimation:shouldIgnoreBlurAnimation,interactionElement:jsx(SelectChevronIcon,{onClick:function onClick(){if(!isReactNative$4()){var _triggererRef$current2;(_triggererRef$current2=triggererRef.current)==null?void 0:_triggererRef$current2.focus();}onTriggerClick();},icon:isOpen?ChevronUpIcon:ChevronDownIcon}),testID:props.testID}))]});};var SelectInput=React__default.forwardRef(_SelectInput);SelectInput.componentId='SelectInput';
|
|
4029
|
+
var _excluded$5=["icon","onChange","placeholder","onBlur"];var _SelectInput=function _SelectInput(props,ref){var _useDropdown=useDropdown(),isOpen=_useDropdown.isOpen,value=_useDropdown.value,displayValue=_useDropdown.displayValue,onTriggerClick=_useDropdown.onTriggerClick,onTriggerKeydown=_useDropdown.onTriggerKeydown,onTriggerBlur=_useDropdown.onTriggerBlur,dropdownBaseId=_useDropdown.dropdownBaseId,activeIndex=_useDropdown.activeIndex,triggererRef=_useDropdown.triggererRef,hasFooterAction=_useDropdown.hasFooterAction,dropdownTriggerer=_useDropdown.dropdownTriggerer,shouldIgnoreBlurAnimation=_useDropdown.shouldIgnoreBlurAnimation,setHasLabelOnLeft=_useDropdown.setHasLabelOnLeft;var inputRef=useBladeInnerRef(ref,{onFocus:function onFocus(opts){var _triggererRef$current;(_triggererRef$current=triggererRef.current)==null?void 0:_triggererRef$current.focus(opts);}});var icon=props.icon,onChange=props.onChange,_props$placeholder=props.placeholder,placeholder=_props$placeholder===void 0?'Select Option':_props$placeholder,_onBlur=props.onBlur,baseInputProps=_objectWithoutProperties(props,_excluded$5);React__default.useEffect(function(){onChange==null?void 0:onChange({name:props.name,values:value.split(', ')});},[value,props.name]);React__default.useEffect(function(){setHasLabelOnLeft(props.labelPosition==='left');},[props.labelPosition,setHasLabelOnLeft]);return jsxs(BaseBox,{position:"relative",children:[!isReactNative$4()?jsx(VisuallyHidden,{children:jsx("input",{ref:inputRef,tabIndex:-1,required:props.isRequired,name:props.name,value:value,onChange:function onChange(){},"aria-hidden":true})}):null,jsx(BaseInput,_extends({},baseInputProps,{as:"button",componentName:MetaConstants.SelectInput,ref:!isReactNative$4()?triggererRef:null,textAlign:"left",value:displayValue,placeholder:placeholder,id:dropdownBaseId+"-trigger",labelId:dropdownBaseId+"-label",leadingIcon:icon,hasPopup:getActionListContainerRole(hasFooterAction,dropdownTriggerer),isPopupExpanded:isOpen,onClick:onTriggerClick,onKeyDown:onTriggerKeydown,onBlur:function onBlur(_ref){var name=_ref.name;onTriggerBlur==null?void 0:onTriggerBlur({name:name,value:value,onBlurCallback:_onBlur});},activeDescendant:activeIndex>=0?dropdownBaseId+"-"+activeIndex:undefined,popupId:dropdownBaseId+"-actionlist",shouldIgnoreBlurAnimation:shouldIgnoreBlurAnimation,interactionElement:jsx(SelectChevronIcon,{onClick:function onClick(){if(!isReactNative$4()){var _triggererRef$current2;(_triggererRef$current2=triggererRef.current)==null?void 0:_triggererRef$current2.focus();}onTriggerClick();},icon:isOpen?ChevronUpIcon:ChevronDownIcon}),testID:props.testID}))]});};var SelectInput=React__default.forwardRef(_SelectInput);SelectInput.componentId='SelectInput';
|
|
4030
4030
|
|
|
4031
4031
|
var _excluded$4=["accessibilityLabel","children","size","intent","testID"];var Indicator=function Indicator(_ref){var accessibilityLabel=_ref.accessibilityLabel,children=_ref.children,_ref$size=_ref.size,size$1=_ref$size===void 0?'medium':_ref$size,_ref$intent=_ref.intent,intent=_ref$intent===void 0?'neutral':_ref$intent,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded$4);var _useTheme=useTheme(),theme=_useTheme.theme;var childrenString=getStringFromReactText(children);var fillColor=theme.colors.feedback.background[intent].highContrast;var strokeColor=theme.colors.brand.gray.a100.highContrast;var getDimension=useCallback(function(){switch(size$1){case'small':return {svgSize:size[6],textSize:'small'};case'large':return {svgSize:size[10],textSize:'medium'};default:return {svgSize:size[8],textSize:'medium'};}},[size$1]);var dimensions=getDimension();var isReactNative=getPlatformType()==='react-native';var isWeb=!isReactNative;var a11yProps=makeAccessible(_extends({label:accessibilityLabel!=null?accessibilityLabel:childrenString},isWeb&&{role:'status'}));return jsxs(BaseBox,_extends({display:"flex",flexDirection:"row",alignItems:"center"},a11yProps,metaAttribute({name:MetaConstants.Indicator,testID:testID}),getStyledProps(styledProps),{children:[jsxs(Svg,{width:String(dimensions.svgSize),height:String(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(BaseBox,{marginLeft:"spacing.2",children:jsx(Text,{contrast:"low",type:"subtle",size:dimensions.textSize,children:children})})]}));};
|
|
4032
4032
|
|