@razorpay/blade 6.2.1 → 6.2.3

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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # @razorpay/blade
2
2
 
3
+ ## 6.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - cbb1424b: fix: change import to default in package exports
8
+
9
+ Jest does not support the "import" condition in exports. This was causing tests to fail for Blade consumers. Changed "import" to "default" which is supported by all tools. Since Blade is not exporting a dual package, we don't need the "import" condition.
10
+
11
+ ## 6.2.2
12
+
13
+ ### Patch Changes
14
+
15
+ - 559d97d9: feat: support string array in children
16
+
17
+ Users can now use dynamic variables inside children and don't have to wrap it around with string literals
18
+
19
+ ```jsx
20
+ <Button onClick={}>{someVariable} hello</Button>
21
+ ```
22
+
3
23
  ## 6.2.1
4
24
 
5
25
  ### Patch Changes
@@ -293,6 +293,28 @@ type DotNotationColorStringToken<TokenType> = {
293
293
  : DotNotationColorStringToken<TokenType[K]>}`;
294
294
  }[keyof TokenType];
295
295
 
296
+ /**
297
+ * Use this when you want children to be string.
298
+ *
299
+ * This covers scenarios like
300
+ * ```jsx
301
+ * <Title>Hi</Title>
302
+ * <Title>{dynamicVariable} something</Title>
303
+ * ```
304
+ *
305
+ *
306
+ * ### Usage
307
+ *
308
+ * ```ts
309
+ * import type { StringChildrenType } from '~helpers/types';
310
+ *
311
+ * type MyProps = {
312
+ * children: StringChildrenType;
313
+ * }
314
+ * ```
315
+ */
316
+ type StringChildrenType = React__default.ReactText | React__default.ReactText[];
317
+
296
318
  /* eslint-disable @typescript-eslint/no-explicit-any */
297
319
 
298
320
 
@@ -1016,7 +1038,7 @@ declare const ActionListItemIcon: WithComponentId<{
1016
1038
  icon: IconComponent$1;
1017
1039
  }>;
1018
1040
  declare const ActionListItemText: WithComponentId<{
1019
- children: string;
1041
+ children: StringChildrenType;
1020
1042
  }>;
1021
1043
  /**
1022
1044
  * ### ActionListItem
@@ -1202,7 +1224,7 @@ declare type BadgeProps = {
1202
1224
  * Sets the label for the badge.
1203
1225
  *
1204
1226
  */
1205
- children: string;
1227
+ children: StringChildrenType;
1206
1228
  /**
1207
1229
  * Sets the variant of the badge.
1208
1230
  *
@@ -1331,11 +1353,11 @@ declare type LinkCommonProps = {
1331
1353
  };
1332
1354
  declare type LinkWithoutIconProps = LinkCommonProps & {
1333
1355
  icon?: undefined;
1334
- children: string;
1356
+ children: StringChildrenType;
1335
1357
  };
1336
1358
  declare type LinkWithIconProps = LinkCommonProps & {
1337
1359
  icon: IconComponent$1;
1338
- children?: string;
1360
+ children?: StringChildrenType;
1339
1361
  };
1340
1362
  declare type LinkPropsWithOrWithoutIcon = LinkWithIconProps | LinkWithoutIconProps;
1341
1363
  declare type LinkAnchorVariantProps = LinkPropsWithOrWithoutIcon & {
@@ -1373,11 +1395,11 @@ declare type ButtonCommonProps = {
1373
1395
  };
1374
1396
  declare type ButtonWithoutIconProps = ButtonCommonProps & {
1375
1397
  icon?: undefined;
1376
- children: string;
1398
+ children: StringChildrenType;
1377
1399
  };
1378
1400
  declare type ButtonWithIconProps = ButtonCommonProps & {
1379
1401
  icon: IconComponent$1;
1380
- children?: string;
1402
+ children?: StringChildrenType;
1381
1403
  };
1382
1404
  declare type ButtonProps = ButtonWithoutIconProps | ButtonWithIconProps;
1383
1405
  declare const Button: React__default.ForwardRefExoticComponent<ButtonProps & React__default.RefAttributes<BladeElementRef>>;
@@ -2835,7 +2857,7 @@ declare type IndicatorWithoutA11yLabel = {
2835
2857
  /**
2836
2858
  * A text label to show alongside the indicator dot
2837
2859
  */
2838
- children: string;
2860
+ children: StringChildrenType;
2839
2861
  /**
2840
2862
  * a11y label for screen readers
2841
2863
  */
@@ -2849,7 +2871,7 @@ declare type IndicatorWithA11yLabel = {
2849
2871
  /**
2850
2872
  * A text label to show alongside the indicator dot
2851
2873
  */
2852
- children?: string;
2874
+ children?: StringChildrenType;
2853
2875
  };
2854
2876
  declare type IndicatorProps = IndicatorCommonProps & (IndicatorWithA11yLabel | IndicatorWithoutA11yLabel);
2855
2877
  declare const Indicator: ({ accessibilityLabel, children, size, intent, }: IndicatorProps) => ReactElement;
@@ -2939,7 +2961,7 @@ declare type TitleProps = {
2939
2961
  size?: 'small' | 'medium' | 'large';
2940
2962
  contrast?: ColorContrastTypes;
2941
2963
  type?: TextTypes;
2942
- children: string;
2964
+ children: StringChildrenType;
2943
2965
  };
2944
2966
  declare const Title: ({ size, type, contrast, children, }: TitleProps) => ReactElement;
2945
2967
 
@@ -2948,7 +2970,7 @@ declare type HeadingSize = 'small' | 'medium' | 'large';
2948
2970
  declare type HeadingCommonProps = {
2949
2971
  type?: TextTypes;
2950
2972
  contrast?: ColorContrastTypes;
2951
- children: string;
2973
+ children: StringChildrenType;
2952
2974
  };
2953
2975
  declare type HeadingNormalVariant = HeadingCommonProps & {
2954
2976
  variant?: Exclude<HeadingVariant, 'subheading'>;
@@ -3047,7 +3069,7 @@ declare const Text: <T extends {
3047
3069
  }>({ variant, weight, size, type, contrast, truncateAfterLines, children, color, }: TextProps<T>) => ReactElement;
3048
3070
 
3049
3071
  declare type CodeProps = {
3050
- children: string;
3072
+ children: StringChildrenType;
3051
3073
  /**
3052
3074
  * Decides the fontSize and padding of Code
3053
3075
  *
@@ -3185,7 +3207,7 @@ declare type RadioProps = {
3185
3207
  /**
3186
3208
  * Sets the label text of the Radio
3187
3209
  */
3188
- children: string;
3210
+ children: StringChildrenType;
3189
3211
  /**
3190
3212
  * Help text for the Radio
3191
3213
  */
@@ -3323,7 +3345,7 @@ declare const Spinner: ({ label, labelPosition, accessibilityLabel, contrast, si
3323
3345
 
3324
3346
  declare type SkipNavLinkProps = {
3325
3347
  id?: string;
3326
- children?: string;
3348
+ children?: StringChildrenType;
3327
3349
  };
3328
3350
  declare const SkipNavLink: ({ id, children, }: SkipNavLinkProps) => JSX.Element;
3329
3351
  declare type SkipNavContentProps = {
@@ -293,6 +293,28 @@ type DotNotationColorStringToken<TokenType> = {
293
293
  : DotNotationColorStringToken<TokenType[K]>}`;
294
294
  }[keyof TokenType];
295
295
 
296
+ /**
297
+ * Use this when you want children to be string.
298
+ *
299
+ * This covers scenarios like
300
+ * ```jsx
301
+ * <Title>Hi</Title>
302
+ * <Title>{dynamicVariable} something</Title>
303
+ * ```
304
+ *
305
+ *
306
+ * ### Usage
307
+ *
308
+ * ```ts
309
+ * import type { StringChildrenType } from '~helpers/types';
310
+ *
311
+ * type MyProps = {
312
+ * children: StringChildrenType;
313
+ * }
314
+ * ```
315
+ */
316
+ type StringChildrenType = React__default.ReactText | React__default.ReactText[];
317
+
296
318
  /* eslint-disable @typescript-eslint/no-explicit-any */
297
319
 
298
320
 
@@ -1016,7 +1038,7 @@ declare const ActionListItemIcon: WithComponentId<{
1016
1038
  icon: IconComponent$1;
1017
1039
  }>;
1018
1040
  declare const ActionListItemText: WithComponentId<{
1019
- children: string;
1041
+ children: StringChildrenType;
1020
1042
  }>;
1021
1043
  /**
1022
1044
  * ### ActionListItem
@@ -1207,7 +1229,7 @@ declare type BadgeProps = {
1207
1229
  * Sets the label for the badge.
1208
1230
  *
1209
1231
  */
1210
- children: string;
1232
+ children: StringChildrenType;
1211
1233
  /**
1212
1234
  * Sets the variant of the badge.
1213
1235
  *
@@ -1336,11 +1358,11 @@ declare type LinkCommonProps = {
1336
1358
  };
1337
1359
  declare type LinkWithoutIconProps = LinkCommonProps & {
1338
1360
  icon?: undefined;
1339
- children: string;
1361
+ children: StringChildrenType;
1340
1362
  };
1341
1363
  declare type LinkWithIconProps = LinkCommonProps & {
1342
1364
  icon: IconComponent$1;
1343
- children?: string;
1365
+ children?: StringChildrenType;
1344
1366
  };
1345
1367
  declare type LinkPropsWithOrWithoutIcon = LinkWithIconProps | LinkWithoutIconProps;
1346
1368
  declare type LinkAnchorVariantProps = LinkPropsWithOrWithoutIcon & {
@@ -1378,11 +1400,11 @@ declare type ButtonCommonProps = {
1378
1400
  };
1379
1401
  declare type ButtonWithoutIconProps = ButtonCommonProps & {
1380
1402
  icon?: undefined;
1381
- children: string;
1403
+ children: StringChildrenType;
1382
1404
  };
1383
1405
  declare type ButtonWithIconProps = ButtonCommonProps & {
1384
1406
  icon: IconComponent$1;
1385
- children?: string;
1407
+ children?: StringChildrenType;
1386
1408
  };
1387
1409
  declare type ButtonProps = ButtonWithoutIconProps | ButtonWithIconProps;
1388
1410
  declare const Button: React__default.ForwardRefExoticComponent<ButtonProps & React__default.RefAttributes<BladeElementRef>>;
@@ -2841,7 +2863,7 @@ declare type IndicatorWithoutA11yLabel = {
2841
2863
  /**
2842
2864
  * A text label to show alongside the indicator dot
2843
2865
  */
2844
- children: string;
2866
+ children: StringChildrenType;
2845
2867
  /**
2846
2868
  * a11y label for screen readers
2847
2869
  */
@@ -2855,7 +2877,7 @@ declare type IndicatorWithA11yLabel = {
2855
2877
  /**
2856
2878
  * A text label to show alongside the indicator dot
2857
2879
  */
2858
- children?: string;
2880
+ children?: StringChildrenType;
2859
2881
  };
2860
2882
  declare type IndicatorProps = IndicatorCommonProps & (IndicatorWithA11yLabel | IndicatorWithoutA11yLabel);
2861
2883
  declare const Indicator: ({ accessibilityLabel, children, size, intent, }: IndicatorProps) => ReactElement;
@@ -2945,7 +2967,7 @@ declare type TitleProps = {
2945
2967
  size?: 'small' | 'medium' | 'large';
2946
2968
  contrast?: ColorContrastTypes;
2947
2969
  type?: TextTypes;
2948
- children: string;
2970
+ children: StringChildrenType;
2949
2971
  };
2950
2972
  declare const Title: ({ size, type, contrast, children, }: TitleProps) => ReactElement;
2951
2973
 
@@ -2954,7 +2976,7 @@ declare type HeadingSize = 'small' | 'medium' | 'large';
2954
2976
  declare type HeadingCommonProps = {
2955
2977
  type?: TextTypes;
2956
2978
  contrast?: ColorContrastTypes;
2957
- children: string;
2979
+ children: StringChildrenType;
2958
2980
  };
2959
2981
  declare type HeadingNormalVariant = HeadingCommonProps & {
2960
2982
  variant?: Exclude<HeadingVariant, 'subheading'>;
@@ -3053,7 +3075,7 @@ declare const Text: <T extends {
3053
3075
  }>({ variant, weight, size, type, contrast, truncateAfterLines, children, color, }: TextProps<T>) => ReactElement;
3054
3076
 
3055
3077
  declare type CodeProps = {
3056
- children: string;
3078
+ children: StringChildrenType;
3057
3079
  /**
3058
3080
  * Decides the fontSize and padding of Code
3059
3081
  *
@@ -3182,7 +3204,7 @@ declare type RadioProps = {
3182
3204
  /**
3183
3205
  * Sets the label text of the Radio
3184
3206
  */
3185
- children: string;
3207
+ children: StringChildrenType;
3186
3208
  /**
3187
3209
  * Help text for the Radio
3188
3210
  */
@@ -3320,7 +3342,7 @@ declare const Spinner: ({ label, labelPosition, accessibilityLabel, contrast, si
3320
3342
 
3321
3343
  declare type SkipNavLinkProps = {
3322
3344
  id?: string;
3323
- children?: string;
3345
+ children?: StringChildrenType;
3324
3346
  };
3325
3347
  declare const SkipNavLink: (_props: SkipNavLinkProps) => never;
3326
3348
  declare const SkipNavContent: (_props: SkipNavLinkProps) => never;