@razorpay/blade 8.10.0 → 8.10.2
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/build/components/index.d.ts +118 -96
- package/build/components/index.native.d.ts +56 -34
- package/build/components/index.native.js +8 -6
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.web.js +179 -113
- package/build/components/index.web.js.map +1 -1
- package/build/css/bankingThemeDarkDesktop.css +1 -1
- package/build/css/bankingThemeDarkMobile.css +1 -1
- package/build/css/bankingThemeLightDesktop.css +1 -1
- package/build/css/bankingThemeLightMobile.css +1 -1
- package/build/css/paymentThemeDarkDesktop.css +1 -1
- package/build/css/paymentThemeDarkMobile.css +1 -1
- package/build/css/paymentThemeLightDesktop.css +1 -1
- package/build/css/paymentThemeLightMobile.css +1 -1
- package/build/utils/index.d.ts +4 -1
- package/build/utils/index.native.d.ts +4 -1
- package/build/utils/index.native.js +3 -1
- package/build/utils/index.native.js.map +1 -1
- package/build/utils/index.web.js +14 -1
- package/build/utils/index.web.js.map +1 -1
- package/package.json +3 -3
|
@@ -2331,6 +2331,14 @@ declare const Box: React__default.ForwardRefExoticComponent<Partial<PaddingProps
|
|
|
2331
2331
|
readonly l?: "none" | "flex" | undefined;
|
|
2332
2332
|
readonly xl?: "none" | "flex" | undefined;
|
|
2333
2333
|
} | undefined;
|
|
2334
|
+
overflow?: "hidden" | "scroll" | "visible" | {
|
|
2335
|
+
readonly base?: "hidden" | "scroll" | "visible" | undefined;
|
|
2336
|
+
readonly xs?: "hidden" | "scroll" | "visible" | undefined;
|
|
2337
|
+
readonly s?: "hidden" | "scroll" | "visible" | undefined;
|
|
2338
|
+
readonly m?: "hidden" | "scroll" | "visible" | undefined;
|
|
2339
|
+
readonly l?: "hidden" | "scroll" | "visible" | undefined;
|
|
2340
|
+
readonly xl?: "hidden" | "scroll" | "visible" | undefined;
|
|
2341
|
+
} | undefined;
|
|
2334
2342
|
height: SpacingValueType | {
|
|
2335
2343
|
readonly base?: SpacingValueType | undefined;
|
|
2336
2344
|
readonly xs?: SpacingValueType | undefined;
|
|
@@ -2374,14 +2382,6 @@ declare const Box: React__default.ForwardRefExoticComponent<Partial<PaddingProps
|
|
|
2374
2382
|
overflowX: never;
|
|
2375
2383
|
overflowY: never;
|
|
2376
2384
|
textAlign: never;
|
|
2377
|
-
overflow?: "hidden" | "scroll" | "visible" | {
|
|
2378
|
-
readonly base?: "hidden" | "scroll" | "visible" | undefined;
|
|
2379
|
-
readonly xs?: "hidden" | "scroll" | "visible" | undefined;
|
|
2380
|
-
readonly s?: "hidden" | "scroll" | "visible" | undefined;
|
|
2381
|
-
readonly m?: "hidden" | "scroll" | "visible" | undefined;
|
|
2382
|
-
readonly l?: "hidden" | "scroll" | "visible" | undefined;
|
|
2383
|
-
readonly xl?: "hidden" | "scroll" | "visible" | undefined;
|
|
2384
|
-
} | undefined;
|
|
2385
2385
|
__brand__?: "platform-native" | {
|
|
2386
2386
|
readonly base?: "platform-native" | undefined;
|
|
2387
2387
|
readonly xs?: "platform-native" | undefined;
|
|
@@ -2391,6 +2391,7 @@ declare const Box: React__default.ForwardRefExoticComponent<Partial<PaddingProps
|
|
|
2391
2391
|
readonly xl?: "platform-native" | undefined;
|
|
2392
2392
|
} | undefined;
|
|
2393
2393
|
} & {
|
|
2394
|
+
order: never;
|
|
2394
2395
|
alignContent?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | {
|
|
2395
2396
|
readonly base?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | undefined;
|
|
2396
2397
|
readonly xs?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | undefined;
|
|
@@ -2473,7 +2474,6 @@ declare const Box: React__default.ForwardRefExoticComponent<Partial<PaddingProps
|
|
|
2473
2474
|
} | undefined;
|
|
2474
2475
|
justifyItems: never;
|
|
2475
2476
|
justifySelf: never;
|
|
2476
|
-
order: never;
|
|
2477
2477
|
rowGap: SpacingValueType | {
|
|
2478
2478
|
readonly base?: SpacingValueType | undefined;
|
|
2479
2479
|
readonly xs?: SpacingValueType | undefined;
|
|
@@ -2941,6 +2941,21 @@ type BadgeTextColors$1 = `badge.text.${DotNotationColorStringToken<
|
|
|
2941
2941
|
Theme$1['colors']['badge']['text']
|
|
2942
2942
|
>}`;
|
|
2943
2943
|
|
|
2944
|
+
type As$1 =
|
|
2945
|
+
| 'code'
|
|
2946
|
+
| 'h1'
|
|
2947
|
+
| 'h2'
|
|
2948
|
+
| 'h3'
|
|
2949
|
+
| 'h4'
|
|
2950
|
+
| 'h5'
|
|
2951
|
+
| 'h6'
|
|
2952
|
+
| 'p'
|
|
2953
|
+
| 'span'
|
|
2954
|
+
| 'abbr'
|
|
2955
|
+
| 'q'
|
|
2956
|
+
| 'cite'
|
|
2957
|
+
| 'figcaption'
|
|
2958
|
+
| 'div';
|
|
2944
2959
|
type BaseTextProps$1 = {
|
|
2945
2960
|
id?: string;
|
|
2946
2961
|
color?: ActionColors$1 | FeedbackColors$1 | SurfaceColors$1 | FeedbackActionColors$1 | BadgeTextColors$1;
|
|
@@ -2953,7 +2968,7 @@ type BaseTextProps$1 = {
|
|
|
2953
2968
|
/**
|
|
2954
2969
|
* Web only
|
|
2955
2970
|
*/
|
|
2956
|
-
as?:
|
|
2971
|
+
as?: As$1;
|
|
2957
2972
|
textAlign?: 'center' | 'justify' | 'left' | 'right';
|
|
2958
2973
|
truncateAfterLines?: number;
|
|
2959
2974
|
className?: string;
|
|
@@ -2971,11 +2986,13 @@ type BaseTextProps$1 = {
|
|
|
2971
2986
|
/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
|
|
2972
2987
|
|
|
2973
2988
|
|
|
2989
|
+
declare const validAsValues$3 = ['p', 'span', 'div', 'abbr', 'figcaption', 'cite', 'q'] as const;
|
|
2974
2990
|
type TextCommonProps$1 = {
|
|
2991
|
+
as?: typeof validAsValues$3[number];
|
|
2975
2992
|
type?: TextTypes;
|
|
2976
2993
|
contrast?: ColorContrastTypes;
|
|
2977
2994
|
truncateAfterLines?: number;
|
|
2978
|
-
children:
|
|
2995
|
+
children: React__default.ReactNode;
|
|
2979
2996
|
weight?: keyof Theme$1['typography']['fonts']['weight'];
|
|
2980
2997
|
/**
|
|
2981
2998
|
* Overrides the color of the Text component.
|
|
@@ -3287,6 +3304,7 @@ declare const Checkbox: React__default.ForwardRefExoticComponent<{
|
|
|
3287
3304
|
*/
|
|
3288
3305
|
tabIndex?: number | undefined;
|
|
3289
3306
|
} & TestID & Partial<Omit<MarginProps & Pick<{
|
|
3307
|
+
order: never;
|
|
3290
3308
|
alignContent?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | {
|
|
3291
3309
|
readonly base?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | undefined;
|
|
3292
3310
|
readonly xs?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | undefined;
|
|
@@ -3369,7 +3387,6 @@ declare const Checkbox: React__default.ForwardRefExoticComponent<{
|
|
|
3369
3387
|
} | undefined;
|
|
3370
3388
|
justifyItems: never;
|
|
3371
3389
|
justifySelf: never;
|
|
3372
|
-
order: never;
|
|
3373
3390
|
rowGap: SpacingValueType | {
|
|
3374
3391
|
readonly base?: SpacingValueType | undefined;
|
|
3375
3392
|
readonly xs?: SpacingValueType | undefined;
|
|
@@ -3403,7 +3420,7 @@ declare const Checkbox: React__default.ForwardRefExoticComponent<{
|
|
|
3403
3420
|
readonly l?: "platform-native" | undefined;
|
|
3404
3421
|
readonly xl?: "platform-native" | undefined;
|
|
3405
3422
|
} | undefined;
|
|
3406
|
-
}, "
|
|
3423
|
+
}, "order" | "alignSelf" | "justifySelf" | "placeSelf"> & {
|
|
3407
3424
|
bottom: SpacingValueType | {
|
|
3408
3425
|
readonly base?: SpacingValueType | undefined;
|
|
3409
3426
|
readonly xs?: SpacingValueType | undefined;
|
|
@@ -4457,7 +4474,7 @@ declare type TextInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' | '
|
|
|
4457
4474
|
*/
|
|
4458
4475
|
type?: Type;
|
|
4459
4476
|
} & StyledPropsBlade;
|
|
4460
|
-
declare const TextInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "name" | "placeholder" | "label" | "value" | "prefix" | "
|
|
4477
|
+
declare const TextInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "name" | "placeholder" | "label" | "value" | "prefix" | "onBlur" | "onFocus" | "onChange" | "onSubmit" | "defaultValue" | "autoCapitalize" | "autoFocus" | "isDisabled" | "labelPosition" | "validationState" | "helpText" | "errorText" | "necessityIndicator" | "successText" | "isRequired" | "suffix" | "maxCharacters" | "keyboardReturnKeyType" | "autoCompleteSuggestionType"> & {
|
|
4461
4478
|
/**
|
|
4462
4479
|
* Decides whether to render a clear icon button
|
|
4463
4480
|
*/
|
|
@@ -4489,6 +4506,7 @@ declare const TextInput: React__default.ForwardRefExoticComponent<Pick<BaseInput
|
|
|
4489
4506
|
*/
|
|
4490
4507
|
type?: Type;
|
|
4491
4508
|
} & Partial<Omit<MarginProps & Pick<{
|
|
4509
|
+
order: never;
|
|
4492
4510
|
alignContent?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | {
|
|
4493
4511
|
readonly base?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | undefined;
|
|
4494
4512
|
readonly xs?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | undefined;
|
|
@@ -4571,7 +4589,6 @@ declare const TextInput: React__default.ForwardRefExoticComponent<Pick<BaseInput
|
|
|
4571
4589
|
} | undefined;
|
|
4572
4590
|
justifyItems: never;
|
|
4573
4591
|
justifySelf: never;
|
|
4574
|
-
order: never;
|
|
4575
4592
|
rowGap: SpacingValueType | {
|
|
4576
4593
|
readonly base?: SpacingValueType | undefined;
|
|
4577
4594
|
readonly xs?: SpacingValueType | undefined;
|
|
@@ -4605,7 +4622,7 @@ declare const TextInput: React__default.ForwardRefExoticComponent<Pick<BaseInput
|
|
|
4605
4622
|
readonly l?: "platform-native" | undefined;
|
|
4606
4623
|
readonly xl?: "platform-native" | undefined;
|
|
4607
4624
|
} | undefined;
|
|
4608
|
-
}, "
|
|
4625
|
+
}, "order" | "alignSelf" | "justifySelf" | "placeSelf"> & {
|
|
4609
4626
|
bottom: SpacingValueType | {
|
|
4610
4627
|
readonly base?: SpacingValueType | undefined;
|
|
4611
4628
|
readonly xs?: SpacingValueType | undefined;
|
|
@@ -4719,7 +4736,8 @@ declare type PasswordInputExtraProps = {
|
|
|
4719
4736
|
autoCompleteSuggestionType?: Extract<BaseInputProps['autoCompleteSuggestionType'], 'none' | 'password' | 'newPassword'>;
|
|
4720
4737
|
};
|
|
4721
4738
|
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;
|
|
4722
|
-
declare const PasswordInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "name" | "placeholder" | "label" | "value" | "
|
|
4739
|
+
declare const PasswordInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "name" | "placeholder" | "label" | "value" | "onBlur" | "onFocus" | "onChange" | "onSubmit" | "defaultValue" | "autoFocus" | "isDisabled" | "labelPosition" | "validationState" | "helpText" | "errorText" | "successText" | "isRequired" | "maxCharacters" | "keyboardReturnKeyType" | "autoCompleteSuggestionType"> & PasswordInputExtraProps & Partial<Omit<MarginProps & Pick<{
|
|
4740
|
+
order: never;
|
|
4723
4741
|
alignContent?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | {
|
|
4724
4742
|
readonly base?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | undefined;
|
|
4725
4743
|
readonly xs?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | undefined;
|
|
@@ -4802,7 +4820,6 @@ declare const PasswordInput: React__default.ForwardRefExoticComponent<Pick<BaseI
|
|
|
4802
4820
|
} | undefined;
|
|
4803
4821
|
justifyItems: never;
|
|
4804
4822
|
justifySelf: never;
|
|
4805
|
-
order: never;
|
|
4806
4823
|
rowGap: SpacingValueType | {
|
|
4807
4824
|
readonly base?: SpacingValueType | undefined;
|
|
4808
4825
|
readonly xs?: SpacingValueType | undefined;
|
|
@@ -4836,7 +4853,7 @@ declare const PasswordInput: React__default.ForwardRefExoticComponent<Pick<BaseI
|
|
|
4836
4853
|
readonly l?: "platform-native" | undefined;
|
|
4837
4854
|
readonly xl?: "platform-native" | undefined;
|
|
4838
4855
|
} | undefined;
|
|
4839
|
-
}, "
|
|
4856
|
+
}, "order" | "alignSelf" | "justifySelf" | "placeSelf"> & {
|
|
4840
4857
|
bottom: SpacingValueType | {
|
|
4841
4858
|
readonly base?: SpacingValueType | undefined;
|
|
4842
4859
|
readonly xs?: SpacingValueType | undefined;
|
|
@@ -4929,7 +4946,7 @@ declare type TextAreaProps = Pick<BaseInputProps, 'label' | 'labelPosition' | 'n
|
|
|
4929
4946
|
*/
|
|
4930
4947
|
onClearButtonClick?: () => void;
|
|
4931
4948
|
} & StyledPropsBlade;
|
|
4932
|
-
declare const TextArea: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "name" | "placeholder" | "label" | "value" | "numberOfLines" | "
|
|
4949
|
+
declare const TextArea: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "name" | "placeholder" | "label" | "value" | "numberOfLines" | "onBlur" | "onFocus" | "onChange" | "onSubmit" | "defaultValue" | "autoFocus" | "isDisabled" | "labelPosition" | "validationState" | "helpText" | "errorText" | "necessityIndicator" | "successText" | "isRequired" | "maxCharacters"> & {
|
|
4933
4950
|
/**
|
|
4934
4951
|
* Decides whether to render a clear icon button
|
|
4935
4952
|
*/
|
|
@@ -4939,6 +4956,7 @@ declare const TextArea: React__default.ForwardRefExoticComponent<Pick<BaseInputP
|
|
|
4939
4956
|
*/
|
|
4940
4957
|
onClearButtonClick?: (() => void) | undefined;
|
|
4941
4958
|
} & Partial<Omit<MarginProps & Pick<{
|
|
4959
|
+
order: never;
|
|
4942
4960
|
alignContent?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | {
|
|
4943
4961
|
readonly base?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | undefined;
|
|
4944
4962
|
readonly xs?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | undefined;
|
|
@@ -5021,7 +5039,6 @@ declare const TextArea: React__default.ForwardRefExoticComponent<Pick<BaseInputP
|
|
|
5021
5039
|
} | undefined;
|
|
5022
5040
|
justifyItems: never;
|
|
5023
5041
|
justifySelf: never;
|
|
5024
|
-
order: never;
|
|
5025
5042
|
rowGap: SpacingValueType | {
|
|
5026
5043
|
readonly base?: SpacingValueType | undefined;
|
|
5027
5044
|
readonly xs?: SpacingValueType | undefined;
|
|
@@ -5055,7 +5072,7 @@ declare const TextArea: React__default.ForwardRefExoticComponent<Pick<BaseInputP
|
|
|
5055
5072
|
readonly l?: "platform-native" | undefined;
|
|
5056
5073
|
readonly xl?: "platform-native" | undefined;
|
|
5057
5074
|
} | undefined;
|
|
5058
|
-
}, "
|
|
5075
|
+
}, "order" | "alignSelf" | "justifySelf" | "placeSelf"> & {
|
|
5059
5076
|
bottom: SpacingValueType | {
|
|
5060
5077
|
readonly base?: SpacingValueType | undefined;
|
|
5061
5078
|
readonly xs?: SpacingValueType | undefined;
|
|
@@ -5240,7 +5257,7 @@ declare type SelectInputProps = Pick<BaseInputProps, 'label' | 'labelPosition' |
|
|
|
5240
5257
|
*
|
|
5241
5258
|
* Checkout {@link https://blade.razorpay.com/?path=/docs/components-dropdown-with-select--with-single-select SelectInput Documentation}.
|
|
5242
5259
|
*/
|
|
5243
|
-
declare const SelectInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "name" | "placeholder" | "label" | "prefix" | "
|
|
5260
|
+
declare const SelectInput: React__default.ForwardRefExoticComponent<Pick<BaseInputProps, "testID" | "name" | "placeholder" | "label" | "prefix" | "onBlur" | "onFocus" | "onClick" | "autoFocus" | "isDisabled" | "labelPosition" | "validationState" | "helpText" | "errorText" | "necessityIndicator" | "successText" | "isRequired" | "suffix"> & {
|
|
5244
5261
|
icon?: IconComponent$1 | undefined;
|
|
5245
5262
|
/**
|
|
5246
5263
|
* Controlled value of the Select. Use it in combination of `onChange`.
|
|
@@ -5352,6 +5369,7 @@ declare type FeedbackActionColors = `feedback.${Feedback}.action.text.${DotNotat
|
|
|
5352
5369
|
declare type SurfaceColors = `surface.text.${DotNotationColorStringToken<Theme$1['colors']['surface']['text']>}`;
|
|
5353
5370
|
declare type ActionColors = `action.text.${DotNotationColorStringToken<Theme$1['colors']['action']['text']>}`;
|
|
5354
5371
|
declare type BadgeTextColors = `badge.text.${DotNotationColorStringToken<Theme$1['colors']['badge']['text']>}`;
|
|
5372
|
+
declare type As = 'code' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'abbr' | 'q' | 'cite' | 'figcaption' | 'div';
|
|
5355
5373
|
declare type BaseTextProps = {
|
|
5356
5374
|
id?: string;
|
|
5357
5375
|
color?: ActionColors | FeedbackColors | SurfaceColors | FeedbackActionColors | BadgeTextColors;
|
|
@@ -5364,7 +5382,7 @@ declare type BaseTextProps = {
|
|
|
5364
5382
|
/**
|
|
5365
5383
|
* Web only
|
|
5366
5384
|
*/
|
|
5367
|
-
as?:
|
|
5385
|
+
as?: As;
|
|
5368
5386
|
textAlign?: 'center' | 'justify' | 'left' | 'right';
|
|
5369
5387
|
truncateAfterLines?: number;
|
|
5370
5388
|
className?: string;
|
|
@@ -5378,7 +5396,9 @@ declare type BaseTextProps = {
|
|
|
5378
5396
|
componentName?: 'text' | 'title' | 'heading' | 'code';
|
|
5379
5397
|
} & TestID & StyledPropsBlade;
|
|
5380
5398
|
|
|
5399
|
+
declare const validAsValues$2: readonly ["span", "h1", "h2", "h3", "h4", "h5", "h6"];
|
|
5381
5400
|
declare type TitleProps = {
|
|
5401
|
+
as?: typeof validAsValues$2[number];
|
|
5382
5402
|
/**
|
|
5383
5403
|
* Overrides the color of the Title component.
|
|
5384
5404
|
*
|
|
@@ -5389,12 +5409,15 @@ declare type TitleProps = {
|
|
|
5389
5409
|
contrast?: ColorContrastTypes;
|
|
5390
5410
|
type?: TextTypes;
|
|
5391
5411
|
children: StringChildrenType;
|
|
5412
|
+
textAlign?: BaseTextProps['textAlign'];
|
|
5392
5413
|
} & TestID & StyledPropsBlade;
|
|
5393
|
-
declare const Title: ({ size, type, contrast, color, children, testID, ...styledProps }: TitleProps) => ReactElement;
|
|
5414
|
+
declare const Title: ({ as, size, type, contrast, color, children, testID, textAlign, ...styledProps }: TitleProps) => ReactElement;
|
|
5394
5415
|
|
|
5395
5416
|
declare type HeadingVariant = 'regular' | 'subheading';
|
|
5396
5417
|
declare type HeadingSize = 'small' | 'medium' | 'large';
|
|
5418
|
+
declare const validAsValues$1: readonly ["span", "h1", "h2", "h3", "h4", "h5", "h6"];
|
|
5397
5419
|
declare type HeadingCommonProps = {
|
|
5420
|
+
as?: typeof validAsValues$1[number];
|
|
5398
5421
|
/**
|
|
5399
5422
|
* Overrides the color of the Heading component.
|
|
5400
5423
|
*
|
|
@@ -5432,13 +5455,15 @@ declare type HeadingProps<T> = T extends {
|
|
|
5432
5455
|
} ? Variant extends Exclude<HeadingVariant, 'subheading'> ? HeadingNormalVariant : Variant extends 'subheading' ? HeadingSubHeadingVariant : T : T;
|
|
5433
5456
|
declare const Heading: <T extends {
|
|
5434
5457
|
variant: HeadingVariant;
|
|
5435
|
-
}>({ variant, size, type, weight, contrast, color, children, testID, textAlign, ...styledProps }: HeadingProps<T>) => ReactElement;
|
|
5458
|
+
}>({ as, variant, size, type, weight, contrast, color, children, testID, textAlign, ...styledProps }: HeadingProps<T>) => ReactElement;
|
|
5436
5459
|
|
|
5460
|
+
declare const validAsValues: readonly ["p", "span", "div", "abbr", "figcaption", "cite", "q"];
|
|
5437
5461
|
declare type TextCommonProps = {
|
|
5462
|
+
as?: typeof validAsValues[number];
|
|
5438
5463
|
type?: TextTypes;
|
|
5439
5464
|
contrast?: ColorContrastTypes;
|
|
5440
5465
|
truncateAfterLines?: number;
|
|
5441
|
-
children:
|
|
5466
|
+
children: React__default.ReactNode;
|
|
5442
5467
|
weight?: keyof Theme$1['typography']['fonts']['weight'];
|
|
5443
5468
|
/**
|
|
5444
5469
|
* Overrides the color of the Text component.
|
|
@@ -5464,10 +5489,7 @@ declare type TextCaptionVariant = TextCommonProps & {
|
|
|
5464
5489
|
declare type TextProps<T> = T extends {
|
|
5465
5490
|
variant: infer Variant;
|
|
5466
5491
|
} ? Variant extends 'caption' ? TextCaptionVariant : Variant extends 'body' ? TextBodyVariant : T : T;
|
|
5467
|
-
declare type
|
|
5468
|
-
forwardedAs?: BaseTextProps['as'];
|
|
5469
|
-
};
|
|
5470
|
-
declare type GetTextPropsReturn = Omit<BaseTextProps, 'children'> & TextForwardedAs;
|
|
5492
|
+
declare type GetTextPropsReturn = Omit<BaseTextProps, 'children'>;
|
|
5471
5493
|
declare type GetTextProps<T extends {
|
|
5472
5494
|
variant: TextVariant;
|
|
5473
5495
|
}> = Pick<TextProps<T>, 'type' | 'variant' | 'weight' | 'size' | 'contrast' | 'color' | 'testID' | 'textAlign'>;
|
|
@@ -5476,7 +5498,7 @@ declare const getTextProps: <T extends {
|
|
|
5476
5498
|
}>({ variant, type, weight, size, color, contrast, testID, textAlign, }: GetTextProps<T>) => GetTextPropsReturn;
|
|
5477
5499
|
declare const Text: <T extends {
|
|
5478
5500
|
variant: TextVariant;
|
|
5479
|
-
}>({ variant, weight, size, type, contrast, truncateAfterLines, children, color, testID, textAlign, ...styledProps }: TextProps<T>) => ReactElement;
|
|
5501
|
+
}>({ as, variant, weight, size, type, contrast, truncateAfterLines, children, color, testID, textAlign, ...styledProps }: TextProps<T>) => ReactElement;
|
|
5480
5502
|
|
|
5481
5503
|
declare type CodeCommonProps = {
|
|
5482
5504
|
/**
|
|
@@ -5747,6 +5769,7 @@ declare const Radio: React__default.ForwardRefExoticComponent<{
|
|
|
5747
5769
|
*/
|
|
5748
5770
|
size?: "small" | "medium" | undefined;
|
|
5749
5771
|
} & TestID & Partial<Omit<MarginProps & Pick<{
|
|
5772
|
+
order: never;
|
|
5750
5773
|
alignContent?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | {
|
|
5751
5774
|
readonly base?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | undefined;
|
|
5752
5775
|
readonly xs?: "center" | "flex-end" | "flex-start" | "stretch" | "space-around" | "space-between" | undefined;
|
|
@@ -5829,7 +5852,6 @@ declare const Radio: React__default.ForwardRefExoticComponent<{
|
|
|
5829
5852
|
} | undefined;
|
|
5830
5853
|
justifyItems: never;
|
|
5831
5854
|
justifySelf: never;
|
|
5832
|
-
order: never;
|
|
5833
5855
|
rowGap: SpacingValueType | {
|
|
5834
5856
|
readonly base?: SpacingValueType | undefined;
|
|
5835
5857
|
readonly xs?: SpacingValueType | undefined;
|
|
@@ -5863,7 +5885,7 @@ declare const Radio: React__default.ForwardRefExoticComponent<{
|
|
|
5863
5885
|
readonly l?: "platform-native" | undefined;
|
|
5864
5886
|
readonly xl?: "platform-native" | undefined;
|
|
5865
5887
|
} | undefined;
|
|
5866
|
-
}, "
|
|
5888
|
+
}, "order" | "alignSelf" | "justifySelf" | "placeSelf"> & {
|
|
5867
5889
|
bottom: SpacingValueType | {
|
|
5868
5890
|
readonly base?: SpacingValueType | undefined;
|
|
5869
5891
|
readonly xs?: SpacingValueType | undefined;
|
|
@@ -3270,7 +3270,7 @@ var BottomSheetContext=React__default.createContext({headerHeight:0,contentHeigh
|
|
|
3270
3270
|
|
|
3271
3271
|
var _excluded$4U=["isOpen","setIsOpen","close","selectedIndices","setSelectedIndices","activeIndex","setActiveIndex","shouldIgnoreBlur","setShouldIgnoreBlur","isKeydownPressed","setIsKeydownPressed","options","selectionType","changeCallbackTriggerer","setChangeCallbackTriggerer","isControlled","setControlledValueIndices"];var noop=function noop(){};var DropdownContext=React__default.createContext({isOpen:false,setIsOpen:noop,close:noop,selectedIndices:[],setSelectedIndices:noop,controlledValueIndices:[],setControlledValueIndices: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,changeCallbackTriggerer:0,setChangeCallbackTriggerer:noop,isControlled:false,setIsControlled: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,close=_React$useContext.close,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,changeCallbackTriggerer=_React$useContext.changeCallbackTriggerer,setChangeCallbackTriggerer=_React$useContext.setChangeCallbackTriggerer,isControlled=_React$useContext.isControlled,setControlledValueIndices=_React$useContext.setControlledValueIndices,rest=_objectWithoutProperties(_React$useContext,_excluded$4U);var bottomSheetAndDropdownGlue=useBottomSheetAndDropdownGlue();var setIndices=function setIndices(indices){if(isControlled){setControlledValueIndices(indices);}else {setSelectedIndices(indices);}};var selectOption=function selectOption(index){var properties=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{closeOnSelection:true};var isSelected=false;if(index<0||index>options.length-1){return isSelected;}if(selectionType==='multiple'){if(selectedIndices.includes(index)){var existingItemIndex=selectedIndices.indexOf(index);setIndices([].concat(_toConsumableArray(selectedIndices.slice(0,existingItemIndex)),_toConsumableArray(selectedIndices.slice(existingItemIndex+1))));isSelected=false;}else {setIndices([].concat(_toConsumableArray(selectedIndices),[index]));isSelected=true;}}else {setIndices([index]);isSelected=true;}setChangeCallbackTriggerer(changeCallbackTriggerer+1);if(activeIndex!==index){setActiveIndex(index);}if(properties!=null&&properties.closeOnSelection&&selectionType!=='multiple'){close();}return isSelected;};var onTriggerClick=function onTriggerClick(){if(isOpen){close();}else {setIsOpen(true);}};var onTriggerBlur=function onTriggerBlur(_ref){var name=_ref.name,value=_ref.value,onBlurCallback=_ref.onBlurCallback;if(rest.hasFooterAction){setActiveIndex(-1);}if(bottomSheetAndDropdownGlue!=null&&bottomSheetAndDropdownGlue.dropdownHasBottomSheet){setShouldIgnoreBlur(true);return;}if(shouldIgnoreBlur){setShouldIgnoreBlur(false);return;}onBlurCallback==null?void 0:onBlurCallback({name:name,value:value});if(isOpen){if(selectionType!=='multiple'){selectOption(activeIndex);}if(!(bottomSheetAndDropdownGlue!=null&&bottomSheetAndDropdownGlue.dropdownHasBottomSheet)){close();}}};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(bottomSheetAndDropdownGlue!=null&&bottomSheetAndDropdownGlue.dropdownHasBottomSheet){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,close:close,onOptionChange:onOptionChange,onComboType:onComboType,selectCurrentOption:function selectCurrentOption(){var _options$activeIndex$,_options$activeIndex;var isSelected=selectOption(activeIndex);if(rest.hasFooterAction&&!isReactNative$4()){var _rest$triggererRef$cu2;(_rest$triggererRef$cu2=rest.triggererRef.current)==null?void 0:_rest$triggererRef$cu2.focus();}(_options$activeIndex$=(_options$activeIndex=options[activeIndex]).onClickTrigger)==null?void 0:_options$activeIndex$.call(_options$activeIndex,isSelected);}});}};return _extends({isOpen:isOpen,setIsOpen:setIsOpen,close:close,selectedIndices:selectedIndices,setSelectedIndices:setSelectedIndices,setControlledValueIndices:setControlledValueIndices,onTriggerClick:onTriggerClick,onTriggerKeydown:onTriggerKeydown,onTriggerBlur:onTriggerBlur,onOptionClick:onOptionClick,activeIndex:activeIndex,setActiveIndex:setActiveIndex,shouldIgnoreBlur:shouldIgnoreBlur,setShouldIgnoreBlur:setShouldIgnoreBlur,isKeydownPressed:isKeydownPressed,setIsKeydownPressed:setIsKeydownPressed,changeCallbackTriggerer:changeCallbackTriggerer,setChangeCallbackTriggerer:setChangeCallbackTriggerer,isControlled:isControlled,options:options,value:makeInputValue(selectedIndices,options),displayValue:makeInputDisplayValue(selectedIndices,options),selectionType:selectionType},rest);};
|
|
3272
3272
|
|
|
3273
|
-
var getBaseTextStyles=function getBaseTextStyles(_ref){var _ref$color=_ref.color,color=_ref$color===void 0?'surface.text.normal.lowContrast':_ref$color,_ref$fontFamily=_ref.fontFamily,fontFamily=_ref$fontFamily===void 0?'text':_ref$fontFamily,_ref$fontSize=_ref.fontSize,fontSize=_ref$fontSize===void 0?200:_ref$fontSize,_ref$fontWeight=_ref.fontWeight,fontWeight=_ref$fontWeight===void 0?'regular':_ref$fontWeight,_ref$fontStyle=_ref.fontStyle,fontStyle=_ref$fontStyle===void 0?'normal':_ref$fontStyle,_ref$textDecorationLi=_ref.textDecorationLine,textDecorationLine=_ref$textDecorationLi===void 0?'none':_ref$textDecorationLi,_ref$lineHeight=_ref.lineHeight,lineHeight=_ref$lineHeight===void 0?100:_ref$lineHeight,textAlign=_ref.textAlign,theme=_ref.theme;var textColor=get_1(theme.colors,color);var themeFontFamily=theme.typography.fonts.family[fontFamily];var themeFontSize=makeTypographySize(theme.typography.fonts.size[fontSize]);var themeFontWeight=theme.typography.fonts.weight[fontWeight];var themeLineHeight=makeTypographySize(theme.typography.lineHeights[lineHeight]);return {color:textColor,fontFamily:themeFontFamily,fontSize:themeFontSize,fontWeight:themeFontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,lineHeight:themeLineHeight,textAlign:textAlign,margin:0,padding:0};};
|
|
3273
|
+
var getBaseTextStyles=function getBaseTextStyles(_ref){var _ref$color=_ref.color,color=_ref$color===void 0?'surface.text.normal.lowContrast':_ref$color,_ref$fontFamily=_ref.fontFamily,fontFamily=_ref$fontFamily===void 0?'text':_ref$fontFamily,_ref$fontSize=_ref.fontSize,fontSize=_ref$fontSize===void 0?200:_ref$fontSize,_ref$fontWeight=_ref.fontWeight,fontWeight=_ref$fontWeight===void 0?'regular':_ref$fontWeight,_ref$fontStyle=_ref.fontStyle,fontStyle=_ref$fontStyle===void 0?'normal':_ref$fontStyle,_ref$textDecorationLi=_ref.textDecorationLine,textDecorationLine=_ref$textDecorationLi===void 0?'none':_ref$textDecorationLi,numberOfLines=_ref.numberOfLines,_ref$lineHeight=_ref.lineHeight,lineHeight=_ref$lineHeight===void 0?100:_ref$lineHeight,textAlign=_ref.textAlign,theme=_ref.theme;var textColor=get_1(theme.colors,color);var themeFontFamily=theme.typography.fonts.family[fontFamily];var themeFontSize=makeTypographySize(theme.typography.fonts.size[fontSize]);var themeFontWeight=theme.typography.fonts.weight[fontWeight];var themeLineHeight=makeTypographySize(theme.typography.lineHeights[lineHeight]);var truncateStyles={};if(numberOfLines!==undefined){if(isReactNative$4()){truncateStyles={};}truncateStyles={overflow:'hidden',display:'-webkit-box','line-clamp':""+numberOfLines,'-webkit-line-clamp':""+numberOfLines,'-webkit-box-orient':'vertical'};}return _extends({color:textColor,fontFamily:themeFontFamily,fontSize:themeFontSize,fontWeight:themeFontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,lineHeight:themeLineHeight,textAlign:textAlign,margin:0,padding:0},truncateStyles);};
|
|
3274
3274
|
|
|
3275
3275
|
var removeUndefinedStyledProps=function removeUndefinedStyledProps(obj){var onlyDefinedStyledProps={};for(var key in obj){if(obj[key]!==undefined){onlyDefinedStyledProps[key]=obj[key];}}return onlyDefinedStyledProps;};var makeStyledProps=function makeStyledProps(props){return {alignSelf:props.alignSelf,justifySelf:props.justifySelf,placeSelf:props.placeSelf,order:props.order,position:props.position,zIndex:props.zIndex,gridColumn:props.gridColumn,gridColumnStart:props.gridColumnStart,gridColumnEnd:props.gridColumnEnd,gridRow:props.gridRow,gridRowStart:props.gridRowStart,gridRowEnd:props.gridRowEnd,gridArea:props.gridArea,margin:props.margin,marginX:props.marginX,marginY:props.marginY,marginBottom:props.marginBottom,marginTop:props.marginTop,marginRight:props.marginRight,marginLeft:props.marginLeft,top:props.top,right:props.right,bottom:props.bottom,left:props.left};};var getStyledProps=function getStyledProps(props){return removeUndefinedStyledProps(makeStyledProps(props));};
|
|
3276
3276
|
|
|
@@ -3278,13 +3278,15 @@ var useMemoizedStyles=function useMemoizedStyles(boxProps){return getBaseBoxStyl
|
|
|
3278
3278
|
|
|
3279
3279
|
var useStyledProps=function useStyledProps(props){var styledPropsStyles=getStyledProps(props);var styledPropsCSSObject=useMemoizedStyles(_extends({},styledPropsStyles,{theme:props.theme}));var styledPropsWithoutUndefined=removeUndefinedStyledProps(styledPropsCSSObject);return styledPropsWithoutUndefined;};
|
|
3280
3280
|
|
|
3281
|
-
var _excluded$4T=["color","fontFamily","fontSize","fontWeight","fontStyle","textDecorationLine","lineHeight","textAlign","as"],_excluded2$1=["id","color","fontFamily","fontSize","fontWeight","fontStyle","textDecorationLine","lineHeight","
|
|
3281
|
+
var _excluded$4T=["color","fontFamily","fontSize","fontWeight","fontStyle","textDecorationLine","numberOfLines","lineHeight","textAlign","as"],_excluded2$1=["id","color","fontFamily","fontSize","fontWeight","fontStyle","textDecorationLine","lineHeight","textAlign","children","truncateAfterLines","className","style","accessibilityProps","componentName","testID"];var StyledBaseText=styled.Text(function(_ref){var color=_ref.color,fontFamily=_ref.fontFamily,fontSize=_ref.fontSize,fontWeight=_ref.fontWeight,fontStyle=_ref.fontStyle,textDecorationLine=_ref.textDecorationLine,numberOfLines=_ref.numberOfLines,lineHeight=_ref.lineHeight,textAlign=_ref.textAlign;_ref.as;var props=_objectWithoutProperties(_ref,_excluded$4T);var styledPropsCSSObject=useStyledProps(props);return _extends({},getBaseTextStyles({color:color,fontFamily:fontFamily,fontSize:fontSize,fontWeight:fontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,numberOfLines:numberOfLines,lineHeight:lineHeight,textAlign:textAlign,theme:props.theme}),styledPropsCSSObject);});var BaseText=function BaseText(_ref2){var id=_ref2.id,color=_ref2.color,fontFamily=_ref2.fontFamily,fontSize=_ref2.fontSize,fontWeight=_ref2.fontWeight,fontStyle=_ref2.fontStyle,textDecorationLine=_ref2.textDecorationLine,lineHeight=_ref2.lineHeight,textAlign=_ref2.textAlign,children=_ref2.children,truncateAfterLines=_ref2.truncateAfterLines,className=_ref2.className,style=_ref2.style,_ref2$accessibilityPr=_ref2.accessibilityProps,accessibilityProps=_ref2$accessibilityPr===void 0?{}:_ref2$accessibilityPr,componentName=_ref2.componentName,testID=_ref2.testID,styledProps=_objectWithoutProperties(_ref2,_excluded2$1);return jsx(StyledBaseText,_extends({},styledProps,{color:color,fontFamily:fontFamily,fontSize:fontSize,fontWeight:fontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,lineHeight:lineHeight,as:undefined,textAlign:textAlign,numberOfLines:truncateAfterLines,className:className,style:style,id:id},makeAccessible(accessibilityProps),metaAttribute({name:componentName,testID:testID}),{children:children}));};
|
|
3282
3282
|
|
|
3283
|
-
var
|
|
3283
|
+
var useValidateAsProp=function useValidateAsProp(_ref){var as=_ref.as,componentName=_ref.componentName,validAsValues=_ref.validAsValues;React__default.useEffect(function(){if(as&&!validAsValues.includes(as)){throw new Error("[Blade "+componentName+"]: Invalid `as` prop value - "+as+". Only "+validAsValues.join(', ')+" are accepted");}},[as,componentName,validAsValues]);};
|
|
3284
3284
|
|
|
3285
|
-
var _excluded$
|
|
3285
|
+
var _excluded$4S=["as","size","type","contrast","color","children","testID","textAlign"];var validAsValues$2=['span','h1','h2','h3','h4','h5','h6'];var getProps$3=function getProps(_ref){var as=_ref.as,size=_ref.size,type=_ref.type,contrast=_ref.contrast,color=_ref.color,testID=_ref.testID;var isPlatformWeb=getPlatformType()==='browser'||getPlatformType()==='node';var colorContrast=contrast?contrast+"Contrast":'lowContrast';var props={color:color!=null?color:"surface.text."+(type!=null?type:'normal')+"."+colorContrast,fontSize:600,fontWeight:'bold',fontStyle:'normal',lineHeight:700,fontFamily:'text',accessibilityProps:isPlatformWeb?{}:{role:'heading'},componentName:'title',testID:testID};if(size==='small'){props.fontSize=600;props.lineHeight=500;props.as=isPlatformWeb?'h3':undefined;}else if(size==='medium'){props.fontSize=700;props.lineHeight=600;props.as=isPlatformWeb?'h2':undefined;}else if(size==='large'){props.fontSize=800;props.lineHeight=700;props.as=isPlatformWeb?'h1':undefined;}else if(size==='xlarge'){props.fontSize=1000;props.lineHeight=800;props.as=isPlatformWeb?'h1':undefined;}props.as=as||props.as;return props;};var Title=function Title(_ref2){var as=_ref2.as,_ref2$size=_ref2.size,size=_ref2$size===void 0?'small':_ref2$size,_ref2$type=_ref2.type,type=_ref2$type===void 0?'normal':_ref2$type,_ref2$contrast=_ref2.contrast,contrast=_ref2$contrast===void 0?'low':_ref2$contrast,color=_ref2.color,children=_ref2.children,testID=_ref2.testID,textAlign=_ref2.textAlign,styledProps=_objectWithoutProperties(_ref2,_excluded$4S);useValidateAsProp({componentName:'Title',as:as,validAsValues:validAsValues$2});var props=getProps$3({as:as,size:size,type:type,contrast:contrast,color:color,testID:testID});return jsx(BaseText,_extends({},props,{textAlign:textAlign},getStyledProps(styledProps),{children:children}));};
|
|
3286
3286
|
|
|
3287
|
-
var _excluded$
|
|
3287
|
+
var _excluded$4R=["as","variant","size","type","weight","contrast","color","children","testID","textAlign"];var validAsValues$1=['span','h1','h2','h3','h4','h5','h6'];var getProps$2=function getProps(_ref){var as=_ref.as,variant=_ref.variant,size=_ref.size,type=_ref.type,weight=_ref.weight,contrast=_ref.contrast,color=_ref.color,testID=_ref.testID;var colorContrast=contrast?contrast+"Contrast":'lowContrast';var props={color:color!=null?color:"surface.text."+(type!=null?type:'normal')+"."+colorContrast,fontSize:200,fontWeight:weight!=null?weight:'bold',fontStyle:'normal',lineHeight:300,fontFamily:'text',accessibilityProps:isReactNative$4()?{role:'heading'}:{},componentName:'heading',testID:testID};if(variant==='regular'){if(!size||size==='small'){props.fontSize=200;props.lineHeight=300;props.as='h6';}else if(size==='medium'){props.fontSize=300;props.lineHeight=200;props.as='h5';}else if(size==='large'){props.fontSize=400;props.lineHeight=400;props.as='h4';}}else if(variant==='subheading'){if(weight==='regular'){throw new Error("[Blade: Heading]: weight cannot be 'regular' when variant is 'subheading'");}if(size){throw new Error("[Blade: Heading]: size prop cannot be added when variant is 'subheading'. Use variant 'regular' or remove size prop");}props.fontSize=75;props.lineHeight=50;props.as='p';}props.as=as||props.as;return props;};var Heading=function Heading(_ref2){var as=_ref2.as,_ref2$variant=_ref2.variant,variant=_ref2$variant===void 0?'regular':_ref2$variant,size=_ref2.size,_ref2$type=_ref2.type,type=_ref2$type===void 0?'normal':_ref2$type,_ref2$weight=_ref2.weight,weight=_ref2$weight===void 0?'bold':_ref2$weight,_ref2$contrast=_ref2.contrast,contrast=_ref2$contrast===void 0?'low':_ref2$contrast,color=_ref2.color,children=_ref2.children,testID=_ref2.testID,textAlign=_ref2.textAlign,styledProps=_objectWithoutProperties(_ref2,_excluded$4R);useValidateAsProp({componentName:'Heading',as:as,validAsValues:validAsValues$1});var props=getProps$2({as:as,variant:variant,size:size,type:type,weight:weight,color:color,contrast:contrast,testID:testID});return jsx(BaseText,_extends({},props,{textAlign:textAlign},getStyledProps(styledProps),{children:children}));};
|
|
3288
|
+
|
|
3289
|
+
var _excluded$4Q=["as","variant","weight","size","type","contrast","truncateAfterLines","children","color","testID","textAlign"];var validAsValues=['p','span','div','abbr','figcaption','cite','q'];var getTextProps=function getTextProps(_ref){var variant=_ref.variant,type=_ref.type,weight=_ref.weight,size=_ref.size,color=_ref.color,contrast=_ref.contrast,testID=_ref.testID,textAlign=_ref.textAlign;var colorContrast=contrast?contrast+"Contrast":'lowContrast';var props={color:color!=null?color:"surface.text."+(type!=null?type:'normal')+"."+colorContrast,fontSize:100,fontWeight:weight!=null?weight:'regular',fontStyle:'normal',lineHeight:100,fontFamily:'text',componentName:'text',testID:testID,textAlign:textAlign};if(variant==='body'){if(size==='xsmall'){props.fontSize=25;props.lineHeight=50;}if(size==='small'){props.fontSize=75;props.lineHeight=50;}if(size==='medium'){props.fontSize=100;props.lineHeight=100;}if(size==='large'){props.fontSize=200;props.lineHeight=300;}}if(variant==='caption'){if(size==='medium'){props.fontSize=50;props.lineHeight=50;}else {throw new Error("[Blade: Text]: size cannot be '"+size+"' when variant is 'caption'");}props.fontStyle='italic';}return props;};var _Text=function _Text(_ref2){var _ref2$as=_ref2.as,as=_ref2$as===void 0?'p':_ref2$as,_ref2$variant=_ref2.variant,variant=_ref2$variant===void 0?'body':_ref2$variant,_ref2$weight=_ref2.weight,weight=_ref2$weight===void 0?'regular':_ref2$weight,_ref2$size=_ref2.size,size=_ref2$size===void 0?'medium':_ref2$size,_ref2$type=_ref2.type,type=_ref2$type===void 0?'normal':_ref2$type,_ref2$contrast=_ref2.contrast,contrast=_ref2$contrast===void 0?'low':_ref2$contrast,truncateAfterLines=_ref2.truncateAfterLines,children=_ref2.children,color=_ref2.color,testID=_ref2.testID,textAlign=_ref2.textAlign,styledProps=_objectWithoutProperties(_ref2,_excluded$4Q);var props=_extends({as:as,truncateAfterLines:truncateAfterLines},getTextProps({variant:variant,type:type,weight:weight,color:color,size:size,contrast:contrast,testID:testID,textAlign:textAlign}));useValidateAsProp({componentName:'Text',as:as,validAsValues:validAsValues});return jsx(BaseText,_extends({},props,getStyledProps(styledProps),{children:children}));};var Text=assignWithoutSideEffects(_Text,{displayName:'Text',componentId:'Text'});
|
|
3288
3290
|
|
|
3289
3291
|
var _excluded$4P=["children","size","weight","isHighlighted","color","testID"];var platformType=getPlatformType();var isPlatformWeb=platformType==='browser'||platformType==='node';var getCodeFontSizeAndLineHeight=function getCodeFontSizeAndLineHeight(size){switch(size){case'medium':return {fontSize:75,lineHeight:75};case'small':return {fontSize:25,lineHeight:25};default:throw new Error("[Blade Code]: Unexpected size: "+size);}};var CodeContainer=styled(BaseBox)(function(props){var padding=makeSpace(props.theme.spacing[0])+" "+makeSpace(props.theme.spacing[2]);return {padding:padding,backgroundColor:props.isHighlighted?props.theme.colors.brand.gray.a100.lowContrast:undefined,borderRadius:props.theme.border.radius.medium,display:isPlatformWeb?'inline-block':'flex',alignSelf:isPlatformWeb?undefined:'center',verticalAlign:'middle',lineHeight:makeTypographySize(props.theme.typography.lineHeights[0])};});var getCodeColor=function getCodeColor(_ref){var isHighlighted=_ref.isHighlighted,color=_ref.color;if(isHighlighted){if(color){throw new Error('[Blade: Code]: `color` prop cannot be used without `isHighlighted={false}`');}return 'surface.text.subtle.lowContrast';}if(color){return color;}return 'surface.text.normal.lowContrast';};var Code=function Code(_ref2){var children=_ref2.children,_ref2$size=_ref2.size,size=_ref2$size===void 0?'small':_ref2$size,_ref2$weight=_ref2.weight,weight=_ref2$weight===void 0?'regular':_ref2$weight,_ref2$isHighlighted=_ref2.isHighlighted,isHighlighted=_ref2$isHighlighted===void 0?true:_ref2$isHighlighted,color=_ref2.color,testID=_ref2.testID,styledProps=_objectWithoutProperties(_ref2,_excluded$4P);var _getCodeFontSizeAndLi=getCodeFontSizeAndLineHeight(size),fontSize=_getCodeFontSizeAndLi.fontSize,lineHeight=_getCodeFontSizeAndLi.lineHeight;var codeTextColor=React__default.useMemo(function(){return getCodeColor({isHighlighted:isHighlighted,color:color});},[isHighlighted,color]);return jsx(CodeContainer,_extends({size:size,isHighlighted:isHighlighted,as:isPlatformWeb?'span':undefined},metaAttribute({name:MetaConstants.Code,testID:testID}),getStyledProps(styledProps),{children:jsx(BaseText,{color:codeTextColor,fontFamily:"code",fontSize:fontSize,fontWeight:weight,as:isPlatformWeb?'code':undefined,lineHeight:lineHeight,children:children})}));};
|
|
3290
3292
|
|
|
@@ -3964,7 +3966,7 @@ var StyledNativeLink=styled.Pressable(function(props){var styledPropsCSSObject=u
|
|
|
3964
3966
|
|
|
3965
3967
|
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};};
|
|
3966
3968
|
|
|
3967
|
-
var _excluded$t=["children","icon","iconPosition","isDisabled","onClick","onKeyDown","variant","href","target","rel","intent","contrast","accessibilityLabel","className","style","size","testID","hitSlop","htmlTitle","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd"],_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 textSizes={fontSize:{xsmall:25,small:75,medium:100,large:200},lineHeight:{xsmall:50,small:50,medium:100,large:300}};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:textSizes.fontSize[size],lineHeight:textSizes.lineHeight[size],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,ref){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,onKeyDown=_ref3.onKeyDown,_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,htmlTitle=_ref3.htmlTitle,_onBlur=_ref3.onBlur,_onFocus=_ref3.onFocus,_onMouseLeave=_ref3.onMouseLeave,onMouseMove=_ref3.onMouseMove,onPointerDown=_ref3.onPointerDown,onPointerEnter=_ref3.onPointerEnter,onTouchStart=_ref3.onTouchStart,onTouchEnd=_ref3.onTouchEnd,styledProps=_objectWithoutProperties(_ref3,_excluded$t);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({ref:ref},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},syntheticEvents,{onBlur:function onBlur(event){_onBlur==null?void 0:_onBlur(event);syntheticEvents.onBlur();},onFocus:function onFocus(event){_onFocus==null?void 0:_onFocus(event);syntheticEvents.onFocus();},onMouseLeave:function onMouseLeave(event){if(_onMouseLeave){_onMouseLeave(event);}syntheticEvents.onMouseLeave();},onMouseMove:onMouseMove,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onTouchStart:onTouchStart,onTouchEnd:onTouchEnd,onKeyDown:onKeyDown,disabled:disabled,type:type,cursor:cursor,focusRingColor:focusRingColor,motionDuration:motionDuration,motionEasing:motionEasing,setCurrentInteraction:setCurrentInteraction},styledProps,{className:className,style:style,hitSlop:hitSlop,title:htmlTitle,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]})}));};var BaseLink=assignWithoutSideEffects(React__default.forwardRef(_BaseLink),{displayName:'BaseLink',componentId:'BaseLink'});
|
|
3969
|
+
var _excluded$t=["children","icon","iconPosition","isDisabled","onClick","onKeyDown","variant","href","target","rel","intent","contrast","accessibilityLabel","className","style","size","testID","hitSlop","htmlTitle","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd"],_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 textSizes={fontSize:{xsmall:25,small:75,medium:100,large:200},lineHeight:{xsmall:50,small:50,medium:100,large:300}};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:textSizes.fontSize[size],lineHeight:textSizes.lineHeight[size],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,ref){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,onKeyDown=_ref3.onKeyDown,_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,htmlTitle=_ref3.htmlTitle,_onBlur=_ref3.onBlur,_onFocus=_ref3.onFocus,_onMouseLeave=_ref3.onMouseLeave,onMouseMove=_ref3.onMouseMove,onPointerDown=_ref3.onPointerDown,onPointerEnter=_ref3.onPointerEnter,onTouchStart=_ref3.onTouchStart,onTouchEnd=_ref3.onTouchEnd,styledProps=_objectWithoutProperties(_ref3,_excluded$t);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);}};var asProp=isReactNative$4()?undefined:'span';return jsx(StyledLink,_extends({ref:ref},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},syntheticEvents,{onBlur:function onBlur(event){_onBlur==null?void 0:_onBlur(event);syntheticEvents.onBlur();},onFocus:function onFocus(event){_onFocus==null?void 0:_onFocus(event);syntheticEvents.onFocus();},onMouseLeave:function onMouseLeave(event){if(_onMouseLeave){_onMouseLeave(event);}syntheticEvents.onMouseLeave();},onMouseMove:onMouseMove,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onTouchStart:onTouchStart,onTouchEnd:onTouchEnd,onKeyDown:onKeyDown,disabled:disabled,type:type,cursor:cursor,focusRingColor:focusRingColor,motionDuration:motionDuration,motionEasing:motionEasing,setCurrentInteraction:setCurrentInteraction},styledProps,{className:className,style:style,hitSlop:hitSlop,title:htmlTitle,children:jsxs(BaseBox,{as:asProp,display:"flex",flexDirection:"row",className:"content-container",alignItems:"center",children:[Icon&&iconPosition=='left'?jsx(BaseBox,{as:asProp,paddingRight:iconPadding,display:"flex",alignItems:"center",children:jsx(Icon,{color:iconColor,size:iconSize})}):null,jsx(BaseText,{as:asProp,textDecorationLine:textDecorationLine,color:textColor,fontSize:fontSize,lineHeight:lineHeight,textAlign:"center",fontWeight:"bold",children:children}),Icon&&iconPosition=='right'?jsx(BaseBox,{as:asProp,paddingLeft:iconPadding,display:"flex",alignItems:"center",children:jsx(Icon,{color:iconColor,size:iconSize})}):null]})}));};var BaseLink=assignWithoutSideEffects(React__default.forwardRef(_BaseLink),{displayName:'BaseLink',componentId:'BaseLink'});
|
|
3968
3970
|
|
|
3969
3971
|
var _excluded$s=["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$s);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?castNativeType('flex'):castWebType('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?castNativeType('flex'):castWebType('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,textAlign:'left'},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]}));};
|
|
3970
3972
|
|