@razorpay/blade 3.4.0 → 3.5.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/README.md +39 -0
- package/build/components/index.d.ts +33 -5
- package/build/components/index.native.d.ts +33 -5
- package/build/components/index.native.js +19 -13
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.web.js +353 -154
- 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 +4 -0
- package/build/tokens/index.native.d.ts +4 -0
- package/build/tokens/index.native.js +1 -1
- package/build/tokens/index.native.js.map +1 -1
- package/build/tokens/index.web.js +2 -1
- package/build/tokens/index.web.js.map +1 -1
- package/package.json +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @razorpay/blade
|
|
2
2
|
|
|
3
|
+
## 3.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8dc131d: feat(blade): added `small` variant in Checkbox/Radio
|
|
8
|
+
|
|
9
|
+
## 3.4.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 48c36af: feat: add README to npm
|
|
14
|
+
|
|
15
|
+
## 3.4.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 49894f2: feat: adding Link icon
|
|
20
|
+
|
|
3
21
|
## 3.4.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
Blade
|
|
3
|
+
</h1>
|
|
4
|
+
<p align="center">
|
|
5
|
+
<a href="https://github.com/styled-components/styled-components">
|
|
6
|
+
<img src="https://img.shields.io/badge/style-%F0%9F%92%85%20styled--components-orange.svg?colorB=daa357&colorA=db748e" alt="Blade is styled with styled-components" />
|
|
7
|
+
</a>
|
|
8
|
+
<a href="https://github.com/facebook/jest">
|
|
9
|
+
<img src="https://jestjs.io/img/jest-badge.svg" alt="Blade is tested with jest" />
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://github.com/razorpay/blade/blob/master/LICENSE.md">
|
|
12
|
+
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Blade is released under the MIT license." />
|
|
13
|
+
</a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
The Design System that powers Razorpay
|
|
18
|
+
<p align="center">
|
|
19
|
+
|
|
20
|
+
### [`@razorpay/blade`](https://github.com/razorpay/blade/tree/master/packages/blade)
|
|
21
|
+
|
|
22
|
+
This package is under active development.
|
|
23
|
+
|
|
24
|
+
- [Documentation](https://master--61c19ee8d3d282003ac1d81c.chromatic.com)
|
|
25
|
+
- [Installation Guide](https://master--61c19ee8d3d282003ac1d81c.chromatic.com/?path=/docs/guides-installation--page)
|
|
26
|
+
- [Contributing guidelines](https://github.com/razorpay/blade/blob/master/CONTRIBUTING.md)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
> **Note**
|
|
31
|
+
>
|
|
32
|
+
> The blade-old package has been moved to it's own repo.
|
|
33
|
+
> [github.com/razorpay/blade-old](https://github.com/razorpay/blade-old) (Only accessible to Razorpay employees)
|
|
34
|
+
>
|
|
35
|
+
> It is under **maintenance** and it won't have any major releases.
|
|
36
|
+
|
|
37
|
+
## 📝 License
|
|
38
|
+
|
|
39
|
+
Licensed under the [MIT License](https://github.com/razorpay/blade/blob/master/LICENSE.md).
|
|
@@ -24,6 +24,8 @@ type BorderWidth = Readonly<{
|
|
|
24
24
|
none: 0;
|
|
25
25
|
/** thin: 1(px/rem/pt) */
|
|
26
26
|
thin: 1;
|
|
27
|
+
/** thick: 1.5(px/rem/pt) */
|
|
28
|
+
thick: 1.5;
|
|
27
29
|
}>;
|
|
28
30
|
|
|
29
31
|
type Border = Readonly<{
|
|
@@ -1139,8 +1141,14 @@ declare type CheckboxProps = {
|
|
|
1139
1141
|
* and `invalid` attribute will be added
|
|
1140
1142
|
*/
|
|
1141
1143
|
validationState?: 'error' | 'none';
|
|
1144
|
+
/**
|
|
1145
|
+
* Size of the checkbox
|
|
1146
|
+
*
|
|
1147
|
+
* @default "medium"
|
|
1148
|
+
*/
|
|
1149
|
+
size?: 'small' | 'medium';
|
|
1142
1150
|
};
|
|
1143
|
-
declare const Checkbox: ({ defaultChecked, validationState, isChecked, isDisabled, isIndeterminate, isRequired, name, onChange, value, children, helpText, errorText, }: CheckboxProps) => React__default.ReactElement;
|
|
1151
|
+
declare const Checkbox: ({ defaultChecked, validationState, isChecked, isDisabled, isIndeterminate, isRequired, name, onChange, value, children, helpText, errorText, size, }: CheckboxProps) => React__default.ReactElement;
|
|
1144
1152
|
|
|
1145
1153
|
declare type CheckboxGroupProps = {
|
|
1146
1154
|
/**
|
|
@@ -1209,8 +1217,14 @@ declare type CheckboxGroupProps = {
|
|
|
1209
1217
|
* (Useful for form submission).
|
|
1210
1218
|
*/
|
|
1211
1219
|
name?: string;
|
|
1220
|
+
/**
|
|
1221
|
+
* Size of the checkbox
|
|
1222
|
+
*
|
|
1223
|
+
* @default "medium"
|
|
1224
|
+
*/
|
|
1225
|
+
size?: 'small' | 'medium';
|
|
1212
1226
|
};
|
|
1213
|
-
declare const CheckboxGroup: ({ children, label, helpText, isDisabled, necessityIndicator, labelPosition, validationState, errorText, name, defaultValue, onChange, value, }: CheckboxGroupProps) => React__default.ReactElement;
|
|
1227
|
+
declare const CheckboxGroup: ({ children, label, helpText, isDisabled, necessityIndicator, labelPosition, validationState, errorText, name, defaultValue, onChange, value, size, }: CheckboxGroupProps) => React__default.ReactElement;
|
|
1214
1228
|
|
|
1215
1229
|
declare const ArrowDownIcon: IconComponent;
|
|
1216
1230
|
|
|
@@ -1252,6 +1266,8 @@ declare const HomeIcon: IconComponent;
|
|
|
1252
1266
|
|
|
1253
1267
|
declare const InfoIcon: ({ size, color }: IconProps) => ReactElement;
|
|
1254
1268
|
|
|
1269
|
+
declare const LinkIcon: IconComponent;
|
|
1270
|
+
|
|
1255
1271
|
declare const PauseIcon: ({ size, color }: IconProps) => ReactElement;
|
|
1256
1272
|
|
|
1257
1273
|
declare const PlusIcon: ({ size, color }: IconProps) => ReactElement;
|
|
@@ -1688,8 +1704,14 @@ declare type RadioProps = {
|
|
|
1688
1704
|
* @default false
|
|
1689
1705
|
*/
|
|
1690
1706
|
isDisabled?: boolean;
|
|
1707
|
+
/**
|
|
1708
|
+
* Size of the radios
|
|
1709
|
+
*
|
|
1710
|
+
* @default "medium"
|
|
1711
|
+
*/
|
|
1712
|
+
size?: 'small' | 'medium';
|
|
1691
1713
|
};
|
|
1692
|
-
declare const Radio: ({ value, children, helpText, isDisabled }: RadioProps) => React__default.ReactElement;
|
|
1714
|
+
declare const Radio: ({ value, children, helpText, isDisabled, size, }: RadioProps) => React__default.ReactElement;
|
|
1693
1715
|
|
|
1694
1716
|
declare type RadioGroupProps = {
|
|
1695
1717
|
/**
|
|
@@ -1758,8 +1780,14 @@ declare type RadioGroupProps = {
|
|
|
1758
1780
|
* (Useful for form submission).
|
|
1759
1781
|
*/
|
|
1760
1782
|
name?: string;
|
|
1783
|
+
/**
|
|
1784
|
+
* Size of the radios
|
|
1785
|
+
*
|
|
1786
|
+
* @default "medium"
|
|
1787
|
+
*/
|
|
1788
|
+
size?: 'small' | 'medium';
|
|
1761
1789
|
};
|
|
1762
|
-
declare const RadioGroup: ({ children, label, helpText, isDisabled, necessityIndicator, labelPosition, validationState, errorText, name, defaultValue, onChange, value, }: RadioGroupProps) => React__default.ReactElement;
|
|
1790
|
+
declare const RadioGroup: ({ children, label, helpText, isDisabled, necessityIndicator, labelPosition, validationState, errorText, name, defaultValue, onChange, value, size, }: RadioGroupProps) => React__default.ReactElement;
|
|
1763
1791
|
|
|
1764
1792
|
declare type SpinnerProps = {
|
|
1765
1793
|
/**
|
|
@@ -1956,4 +1984,4 @@ declare const VisuallyHidden: ({ children }: VisuallyHiddenProps) => JSX.Element
|
|
|
1956
1984
|
|
|
1957
1985
|
declare const screenReaderStyles: CSSObject;
|
|
1958
1986
|
|
|
1959
|
-
export { Alert, AlertTriangleIcon as AlertOctagonIcon, AlertProps, AlertTriangleIcon$1 as AlertTriangleIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, ArrowUpRightIcon, Badge, BadgeProps, BladeProvider, BladeProviderProps, Button, ButtonProps, CheckCircleIcon, CheckIcon, Checkbox, CheckboxGroup, CheckboxGroupProps, CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, Code, CodeProps, CreditCardIcon, DollarIcon, DownloadIcon, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, Heading, HeadingProps, HelpCircleIcon, HistoryIcon, HomeIcon, IconComponent, IconProps, IconSize, InfoIcon, Link, LinkProps, MinusIcon, OTPInput, OTPInputProps, PasswordInput, PasswordInputProps, PauseIcon, PlusIcon, Radio, RadioGroup, RadioGroupProps, RadioProps, RefreshLeftIcon, RotateCounterClockWiseIcon, RupeeIcon, SearchIcon, SkipNavContent, SkipNavLink, Spinner, SpinnerProps, Text, TextArea, TextAreaProps, TextInput, TextInputProps, TextProps, TextVariant, Theme, Title, TitleProps, TrashIcon, TrendingDownIcon, TrendingUpIcon, VisuallyHidden, VisuallyHiddenProps, announce, clearAnnouncer, destroyAnnouncer, getTextProps, screenReaderStyles, useTheme };
|
|
1987
|
+
export { Alert, AlertTriangleIcon as AlertOctagonIcon, AlertProps, AlertTriangleIcon$1 as AlertTriangleIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, ArrowUpRightIcon, Badge, BadgeProps, BladeProvider, BladeProviderProps, Button, ButtonProps, CheckCircleIcon, CheckIcon, Checkbox, CheckboxGroup, CheckboxGroupProps, CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, Code, CodeProps, CreditCardIcon, DollarIcon, DownloadIcon, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, Heading, HeadingProps, HelpCircleIcon, HistoryIcon, HomeIcon, IconComponent, IconProps, IconSize, InfoIcon, Link, LinkIcon, LinkProps, MinusIcon, OTPInput, OTPInputProps, PasswordInput, PasswordInputProps, PauseIcon, PlusIcon, Radio, RadioGroup, RadioGroupProps, RadioProps, RefreshLeftIcon, RotateCounterClockWiseIcon, RupeeIcon, SearchIcon, SkipNavContent, SkipNavLink, Spinner, SpinnerProps, Text, TextArea, TextAreaProps, TextInput, TextInputProps, TextProps, TextVariant, Theme, Title, TitleProps, TrashIcon, TrendingDownIcon, TrendingUpIcon, VisuallyHidden, VisuallyHiddenProps, announce, clearAnnouncer, destroyAnnouncer, getTextProps, screenReaderStyles, useTheme };
|
|
@@ -24,6 +24,8 @@ type BorderWidth = Readonly<{
|
|
|
24
24
|
none: 0;
|
|
25
25
|
/** thin: 1(px/rem/pt) */
|
|
26
26
|
thin: 1;
|
|
27
|
+
/** thick: 1.5(px/rem/pt) */
|
|
28
|
+
thick: 1.5;
|
|
27
29
|
}>;
|
|
28
30
|
|
|
29
31
|
type Border = Readonly<{
|
|
@@ -1139,8 +1141,14 @@ declare type CheckboxProps = {
|
|
|
1139
1141
|
* and `invalid` attribute will be added
|
|
1140
1142
|
*/
|
|
1141
1143
|
validationState?: 'error' | 'none';
|
|
1144
|
+
/**
|
|
1145
|
+
* Size of the checkbox
|
|
1146
|
+
*
|
|
1147
|
+
* @default "medium"
|
|
1148
|
+
*/
|
|
1149
|
+
size?: 'small' | 'medium';
|
|
1142
1150
|
};
|
|
1143
|
-
declare const Checkbox: ({ defaultChecked, validationState, isChecked, isDisabled, isIndeterminate, isRequired, name, onChange, value, children, helpText, errorText, }: CheckboxProps) => React__default.ReactElement;
|
|
1151
|
+
declare const Checkbox: ({ defaultChecked, validationState, isChecked, isDisabled, isIndeterminate, isRequired, name, onChange, value, children, helpText, errorText, size, }: CheckboxProps) => React__default.ReactElement;
|
|
1144
1152
|
|
|
1145
1153
|
declare type CheckboxGroupProps = {
|
|
1146
1154
|
/**
|
|
@@ -1209,8 +1217,14 @@ declare type CheckboxGroupProps = {
|
|
|
1209
1217
|
* (Useful for form submission).
|
|
1210
1218
|
*/
|
|
1211
1219
|
name?: string;
|
|
1220
|
+
/**
|
|
1221
|
+
* Size of the checkbox
|
|
1222
|
+
*
|
|
1223
|
+
* @default "medium"
|
|
1224
|
+
*/
|
|
1225
|
+
size?: 'small' | 'medium';
|
|
1212
1226
|
};
|
|
1213
|
-
declare const CheckboxGroup: ({ children, label, helpText, isDisabled, necessityIndicator, labelPosition, validationState, errorText, name, defaultValue, onChange, value, }: CheckboxGroupProps) => React__default.ReactElement;
|
|
1227
|
+
declare const CheckboxGroup: ({ children, label, helpText, isDisabled, necessityIndicator, labelPosition, validationState, errorText, name, defaultValue, onChange, value, size, }: CheckboxGroupProps) => React__default.ReactElement;
|
|
1214
1228
|
|
|
1215
1229
|
declare const ArrowDownIcon: IconComponent;
|
|
1216
1230
|
|
|
@@ -1252,6 +1266,8 @@ declare const HomeIcon: IconComponent;
|
|
|
1252
1266
|
|
|
1253
1267
|
declare const InfoIcon: ({ size, color }: IconProps) => ReactElement;
|
|
1254
1268
|
|
|
1269
|
+
declare const LinkIcon: IconComponent;
|
|
1270
|
+
|
|
1255
1271
|
declare const PauseIcon: ({ size, color }: IconProps) => ReactElement;
|
|
1256
1272
|
|
|
1257
1273
|
declare const PlusIcon: ({ size, color }: IconProps) => ReactElement;
|
|
@@ -1679,8 +1695,14 @@ declare type RadioProps = {
|
|
|
1679
1695
|
* @default false
|
|
1680
1696
|
*/
|
|
1681
1697
|
isDisabled?: boolean;
|
|
1698
|
+
/**
|
|
1699
|
+
* Size of the radios
|
|
1700
|
+
*
|
|
1701
|
+
* @default "medium"
|
|
1702
|
+
*/
|
|
1703
|
+
size?: 'small' | 'medium';
|
|
1682
1704
|
};
|
|
1683
|
-
declare const Radio: ({ value, children, helpText, isDisabled }: RadioProps) => React__default.ReactElement;
|
|
1705
|
+
declare const Radio: ({ value, children, helpText, isDisabled, size, }: RadioProps) => React__default.ReactElement;
|
|
1684
1706
|
|
|
1685
1707
|
declare type RadioGroupProps = {
|
|
1686
1708
|
/**
|
|
@@ -1749,8 +1771,14 @@ declare type RadioGroupProps = {
|
|
|
1749
1771
|
* (Useful for form submission).
|
|
1750
1772
|
*/
|
|
1751
1773
|
name?: string;
|
|
1774
|
+
/**
|
|
1775
|
+
* Size of the radios
|
|
1776
|
+
*
|
|
1777
|
+
* @default "medium"
|
|
1778
|
+
*/
|
|
1779
|
+
size?: 'small' | 'medium';
|
|
1752
1780
|
};
|
|
1753
|
-
declare const RadioGroup: ({ children, label, helpText, isDisabled, necessityIndicator, labelPosition, validationState, errorText, name, defaultValue, onChange, value, }: RadioGroupProps) => React__default.ReactElement;
|
|
1781
|
+
declare const RadioGroup: ({ children, label, helpText, isDisabled, necessityIndicator, labelPosition, validationState, errorText, name, defaultValue, onChange, value, size, }: RadioGroupProps) => React__default.ReactElement;
|
|
1754
1782
|
|
|
1755
1783
|
declare type SpinnerProps = {
|
|
1756
1784
|
/**
|
|
@@ -1944,4 +1972,4 @@ declare const VisuallyHidden: ({ children }: VisuallyHiddenProps) => JSX.Element
|
|
|
1944
1972
|
|
|
1945
1973
|
declare const screenReaderStyles: CSSObject;
|
|
1946
1974
|
|
|
1947
|
-
export { Alert, AlertTriangleIcon as AlertOctagonIcon, AlertProps, AlertTriangleIcon$1 as AlertTriangleIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, ArrowUpRightIcon, Badge, BadgeProps, BladeProvider, BladeProviderProps, Button, ButtonProps, CheckCircleIcon, CheckIcon, Checkbox, CheckboxGroup, CheckboxGroupProps, CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, Code, CodeProps, CreditCardIcon, DollarIcon, DownloadIcon, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, Heading, HeadingProps, HelpCircleIcon, HistoryIcon, HomeIcon, IconComponent, IconProps, IconSize, InfoIcon, Link, LinkProps, MinusIcon, OTPInput, OTPInputProps, PasswordInput, PasswordInputProps, PauseIcon, PlusIcon, Radio, RadioGroup, RadioGroupProps, RadioProps, RefreshLeftIcon, RotateCounterClockWiseIcon, RupeeIcon, SearchIcon, SkipNavContent, SkipNavLink, Spinner, SpinnerProps, Text, TextArea, TextAreaProps, TextInput, TextInputProps, TextProps, TextVariant, Theme, Title, TitleProps, TrashIcon, TrendingDownIcon, TrendingUpIcon, VisuallyHidden, VisuallyHiddenProps, announce, clearAnnouncer, destroyAnnouncer, getTextProps, screenReaderStyles, useTheme };
|
|
1975
|
+
export { Alert, AlertTriangleIcon as AlertOctagonIcon, AlertProps, AlertTriangleIcon$1 as AlertTriangleIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, ArrowUpRightIcon, Badge, BadgeProps, BladeProvider, BladeProviderProps, Button, ButtonProps, CheckCircleIcon, CheckIcon, Checkbox, CheckboxGroup, CheckboxGroupProps, CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, Code, CodeProps, CreditCardIcon, DollarIcon, DownloadIcon, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, Heading, HeadingProps, HelpCircleIcon, HistoryIcon, HomeIcon, IconComponent, IconProps, IconSize, InfoIcon, Link, LinkIcon, LinkProps, MinusIcon, OTPInput, OTPInputProps, PasswordInput, PasswordInputProps, PauseIcon, PlusIcon, Radio, RadioGroup, RadioGroupProps, RadioProps, RefreshLeftIcon, RotateCounterClockWiseIcon, RupeeIcon, SearchIcon, SkipNavContent, SkipNavLink, Spinner, SpinnerProps, Text, TextArea, TextAreaProps, TextInput, TextInputProps, TextProps, TextVariant, Theme, Title, TitleProps, TrashIcon, TrendingDownIcon, TrendingUpIcon, VisuallyHidden, VisuallyHiddenProps, announce, clearAnnouncer, destroyAnnouncer, getTextProps, screenReaderStyles, useTheme };
|
|
@@ -3275,6 +3275,8 @@ var HomeIcon=function HomeIcon(_ref){var size=_ref.size,color=_ref.color;var _us
|
|
|
3275
3275
|
|
|
3276
3276
|
var InfoIcon=function InfoIcon(_ref){var size=_ref.size,color=_ref.color;var _useIconProps=useIconProps({size:size,color:color}),height=_useIconProps.height,width=_useIconProps.width,iconColor=_useIconProps.iconColor;return jsxs(Svg,{width:width,height:height,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M12 11C12.5523 11 13 11.4477 13 12V16C13 16.5523 12.5523 17 12 17C11.4477 17 11 16.5523 11 16V12C11 11.4477 11.4477 11 12 11Z",fill:iconColor}),jsx(Path,{d:"M12 7C11.4477 7 11 7.44772 11 8C11 8.55228 11.4477 9 12 9H12.01C12.5623 9 13.01 8.55228 13.01 8C13.01 7.44772 12.5623 7 12.01 7H12Z",fill:iconColor}),jsx(Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12ZM12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3Z",fill:iconColor})]});};
|
|
3277
3277
|
|
|
3278
|
+
var LinkIcon=function LinkIcon(_ref){var size=_ref.size,color=_ref.color;var _useIconProps=useIconProps({size:size,color:color}),height=_useIconProps.height,width=_useIconProps.width,iconColor=_useIconProps.iconColor;return jsxs(Svg,{height:height,width:width,viewBox:"0 0 22 22",fill:"none",children:[jsx(Path,{d:"M20.1863 1.82377C17.8719 -0.490636 14.1296 -0.523155 11.7753 1.75068L11.765 1.7608L10.045 3.4708C9.65336 3.86019 9.65151 4.49335 10.0409 4.88501C10.4303 5.27667 11.0634 5.27852 11.4551 4.88913L13.1697 3.18451C14.7395 1.67341 17.2307 1.69666 18.772 3.23798C20.313 4.77898 20.3366 7.26948 18.8265 8.83934L15.833 11.8329C15.0124 12.6537 13.8758 13.0778 12.7181 12.9949C11.5605 12.9119 10.496 12.3303 9.80083 11.401C9.47002 10.9587 8.84333 10.8684 8.40108 11.1992C7.95883 11.53 7.86849 12.1567 8.1993 12.5989C9.24204 13.993 10.8388 14.8654 12.5753 14.9897C14.3117 15.1141 16.0165 14.4782 17.2473 13.2469L20.2472 10.2471L20.2593 10.2347C22.5332 7.8804 22.5007 4.13817 20.1863 1.82377Z",fill:iconColor}),jsx(Path,{d:"M9.42474 7.01016C7.68837 6.8858 5.9836 7.52171 4.75285 8.75283L1.75285 11.7528L1.74067 11.7652C-0.533165 14.1195 -0.500646 17.8617 1.81376 20.1761C4.12816 22.4905 7.8704 22.5231 10.2247 20.2492L10.2371 20.237L11.9471 18.527C12.3376 18.1365 12.3376 17.5034 11.9471 17.1128C11.5565 16.7223 10.9234 16.7223 10.5329 17.1128L8.82933 18.8164C7.25947 20.3265 4.76897 20.3029 3.22797 18.7619C1.68697 17.2209 1.66341 14.7304 3.17354 13.1606L6.16719 10.1669C6.9877 9.34611 8.12425 8.92214 9.28187 9.00505C10.4395 9.08796 11.504 9.66956 12.1992 10.5989C12.53 11.0412 13.1567 11.1315 13.5989 10.8007C14.0412 10.4699 14.1315 9.84321 13.8007 9.40096C12.758 8.00693 11.1612 7.13452 9.42474 7.01016Z",fill:iconColor})]});};
|
|
3279
|
+
|
|
3278
3280
|
var PauseIcon=function PauseIcon(_ref){var size=_ref.size,color=_ref.color;var _useIconProps=useIconProps({size:size,color:color}),height=_useIconProps.height,width=_useIconProps.width,iconColor=_useIconProps.iconColor;return jsx(Svg,{width:width,height:height,viewBox:"0 0 24 24",fill:"none",children:jsx(Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M6 3a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H6Zm1 16V5h2v14H7ZM14 3a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1h-4Zm1 16V5h2v14h-2Z",fill:iconColor})});};
|
|
3279
3281
|
|
|
3280
3282
|
var PlusIcon=function PlusIcon(_ref){var size=_ref.size,color=_ref.color;var _useIconProps=useIconProps({size:size,color:color}),height=_useIconProps.height,width=_useIconProps.width,iconColor=_useIconProps.iconColor;return jsx(Svg,{width:width,height:height,viewBox:"0 0 24 24",fill:"none",children:jsx(Path,{d:"M13 5a1 1 0 1 0-2 0v6H5a1 1 0 1 0 0 2h6v6a1 1 0 1 0 2 0v-6h6a1 1 0 1 0 0-2h-6V5Z",fill:iconColor})});};
|
|
@@ -3389,13 +3391,15 @@ var isUndefined_1 = isUndefined;
|
|
|
3389
3391
|
|
|
3390
3392
|
var CheckboxGroupContext=React__default.createContext({});var CheckboxGroupProvider=CheckboxGroupContext.Provider;var useCheckboxGroupContext=function useCheckboxGroupContext(){var context=React__default.useContext(CheckboxGroupContext);return context;};
|
|
3391
3393
|
|
|
3392
|
-
var
|
|
3394
|
+
var checkboxSizes={group:{gap:{small:{mobile:'spacing.2',desktop:'spacing.0'},medium:{mobile:'spacing.3',desktop:'spacing.2'}}},icon:{small:{width:12,height:12},medium:{width:16,height:16}}};var checkboxIconColors={variants:{default:{border:{checked:'colors.brand.primary.500',unchecked:'colors.brand.gray.500'},background:{checked:'colors.brand.primary.500',unchecked:'transparent'}},disabled:{border:{checked:'transparent',unchecked:'colors.brand.gray.a100'},background:{checked:'colors.brand.gray.a100',unchecked:'transparent'}},negative:{border:{checked:'colors.feedback.border.negative.highContrast',unchecked:'colors.feedback.border.negative.highContrast'},background:{checked:'colors.feedback.background.negative.highContrast',unchecked:'colors.feedback.background.negative.lowContrast'}}}};
|
|
3395
|
+
|
|
3396
|
+
var getCheckboxIconWrapperStyles=function getCheckboxIconWrapperStyles(_ref){var theme=_ref.theme,isChecked=_ref.isChecked,isDisabled=_ref.isDisabled,isNegative=_ref.isNegative,size=_ref.size;var variant='default';if(isDisabled)variant='disabled';if(isNegative)variant='negative';var checked=isChecked?'checked':'unchecked';var background=checkboxIconColors.variants[variant].background[checked];var border=checkboxIconColors.variants[variant].border[checked];var backgroundColor=background==='transparent'?background:get_1(theme,background);var borderColor=border==='transparent'?border:get_1(theme,border);return {display:'flex',alignItems:'center',justifyContent:'center',width:makeSpace(checkboxSizes.icon[size].width),height:makeSpace(checkboxSizes.icon[size].height),borderWidth:makeBorderSize(theme.border.width.thick),borderStyle:'solid',margin:makeSpace(theme.spacing[1]),borderRadius:makeSize(theme.border.radius.small),backgroundColor:backgroundColor,borderColor:borderColor};};
|
|
3393
3397
|
|
|
3394
3398
|
var CheckboxIconWrapper=styled.View(function(props){return getCheckboxIconWrapperStyles(props);});
|
|
3395
3399
|
|
|
3396
3400
|
var StyledFade$1=styled(Animated.View)(function(_ref){var styles=_ref.styles;return _extends({},styles);});var Fade$1=function Fade(_ref2){var children=_ref2.children,show=_ref2.show,styles=_ref2.styles;var _useTheme=useTheme(),theme=_useTheme.theme;var fadeInEasing=theme.motion.easing.entrance.effective;var fadeOutEasing=theme.motion.easing.exit.effective;var fadeIn=new Keyframe({from:{transform:[{scale:0.6}],opacity:0,easing:fadeInEasing},to:{transform:[{scale:1}],opacity:1,easing:fadeInEasing}}).duration(theme.motion.duration.quick);var fadeOut=new Keyframe({from:{transform:[{scale:1}],opacity:1,easing:fadeOutEasing},to:{transform:[{scale:0.6}],opacity:0,easing:fadeOutEasing}}).duration(theme.motion.duration.quick);return show?jsx(StyledFade$1,{styles:styles,entering:fadeIn,exiting:fadeOut,children:children}):null;};
|
|
3397
3401
|
|
|
3398
|
-
var CheckedIcon$1=function CheckedIcon(_ref){var color=_ref.color;return jsx(Svg,{width:
|
|
3402
|
+
var svgSize={small:{width:8,height:8},medium:{width:12,height:12}};var CheckedIcon$1=function CheckedIcon(_ref){var color=_ref.color,size=_ref.size;var width=makeSpace(svgSize[size].width);var height=makeSpace(svgSize[size].height);return jsx(Svg,{width:width,height:height,viewBox:"0 0 8 8",fill:"none",children:jsx(Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M6.90237 1.76413C7.03254 1.89431 7.03254 2.10536 6.90237 2.23554L3.2357 5.90221C3.10553 6.03238 2.89447 6.03238 2.7643 5.90221L1.09763 4.23554C0.967456 4.10536 0.967456 3.89431 1.09763 3.76414C1.22781 3.63396 1.43886 3.63396 1.56904 3.76414L3 5.1951L6.43096 1.76413C6.56114 1.63396 6.77219 1.63396 6.90237 1.76413Z",fill:color,stroke:"white",strokeWidth:"0.5",strokeLinecap:"round",strokeLinejoin:"round"})});};var IndeterminateIcon=function IndeterminateIcon(_ref2){var color=_ref2.color,size=_ref2.size;var width=svgSize[size].width+"px";var height=svgSize[size].height+"px";return jsx(Svg,{width:width,height:height,viewBox:"0 0 8 8",fill:"none",children:jsx(Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M1.3335 3.99984C1.3335 3.81574 1.48273 3.6665 1.66683 3.6665H6.3335C6.51759 3.6665 6.66683 3.81574 6.66683 3.99984C6.66683 4.18393 6.51759 4.33317 6.3335 4.33317H1.66683C1.48273 4.33317 1.3335 4.18393 1.3335 3.99984Z",fill:color,stroke:"white",strokeWidth:"0.5",strokeLinecap:"round",strokeLinejoin:"round"})});};var CheckboxIcon=function CheckboxIcon(_ref3){var isChecked=_ref3.isChecked,isIndeterminate=_ref3.isIndeterminate,isDisabled=_ref3.isDisabled,isNegative=_ref3.isNegative,size=_ref3.size;var _useTheme=useTheme(),theme=_useTheme.theme;var defaultIconColor=get_1(theme,'colors.brand.gray.200');var disabledIconColor=get_1(theme,'colors.brand.gray.500');var iconColor=isDisabled?disabledIconColor:defaultIconColor;return jsxs(CheckboxIconWrapper,{size:size,isIndeterminate:isIndeterminate,isDisabled:isDisabled,isNegative:isNegative,isChecked:!!(isChecked||isIndeterminate),children:[jsx(Fade$1,{show:isIndeterminate,styles:{position:'absolute',display:'flex'},children:jsx(IndeterminateIcon,{size:size,color:iconColor})}),jsx(Fade$1,{show:Boolean(isChecked)&&!isIndeterminate,styles:{position:'absolute',display:'flex'},children:isChecked?jsx(CheckedIcon$1,{size:size,color:iconColor}):null})]});};
|
|
3399
3403
|
|
|
3400
3404
|
function useControllableState(props){var valueProp=props.value,defaultValue=props.defaultValue,onChange=props.onChange;var _React$useState=React.useState(defaultValue),_React$useState2=_slicedToArray(_React$useState,2),valueState=_React$useState2[0],setValue=_React$useState2[1];var _React$useRef=React.useRef(valueProp!==undefined),isControlled=_React$useRef.current;var value=isControlled&&typeof valueProp!=='undefined'?valueProp:valueState;var updateValue=React.useCallback(function(next){var nextValue=next(value);if(!isControlled)setValue(nextValue);onChange==null?void 0:onChange(nextValue);},[onChange,value]);return [value,updateValue];}
|
|
3401
3405
|
|
|
@@ -3417,21 +3421,21 @@ var StyledVisuallyHidden=styled.View(screenReaderStyles);var VisuallyHidden=func
|
|
|
3417
3421
|
|
|
3418
3422
|
var FormLabel=function FormLabel(_ref){var _ref$as=_ref.as,as=_ref$as===void 0?'span':_ref$as,_ref$position=_ref.position,position=_ref$position===void 0?'top':_ref$position,_ref$necessityIndicat=_ref.necessityIndicator,necessityIndicator=_ref$necessityIndicat===void 0?'none':_ref$necessityIndicat,accessibilityText=_ref.accessibilityText,children=_ref.children,id=_ref.id,htmlFor=_ref.htmlFor;var _useTheme=useTheme(),theme=_useTheme.theme;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var isDesktop=matchedDeviceType==='desktop';var isReactNative=getPlatformType()==='react-native';var necessityLabel=null;var isLabelLeftPositioned=position==='left'&&isDesktop;if(necessityIndicator==='optional'){necessityLabel=jsx(Text,{variant:"caption",weight:"regular",type:"placeholder",children:"(optional)"});}if(necessityIndicator==='required'){necessityLabel=jsx(BaseText,{lineHeight:"s",fontFamily:"text",fontStyle:"normal",fontSize:75,fontWeight:"bold",color:"feedback.text.negative.lowContrast",children:"*"});}var computedAccessibilityNode=jsxs(VisuallyHidden,{children:[necessityIndicator!=='none'&&jsx(Text,{children:necessityIndicator}),jsx(Text,{children:accessibilityText})]});var textNode=jsxs(Box,{gap:necessityIndicator==='optional'?'spacing.2':'spacing.0',display:"flex",flexDirection:"row",alignItems:"center",flexWrap:"wrap",children:[jsxs(Text,{type:"subdued",variant:"body",size:isLabelLeftPositioned?'medium':'small',weight:"bold",children:[children,computedAccessibilityNode]}),necessityLabel]});if(isReactNative){return jsx(Box,{marginRight:"spacing.5",marginBottom:"spacing.2",children:textNode});}var Component=as;var width=isLabelLeftPositioned&&isDesktop?'120px':'auto';return jsx(Component,{htmlFor:htmlFor,style:{width:width,flexShrink:0,marginRight:makeSpace(theme.spacing[5]),wordBreak:'break-all'},id:id,children:jsx(Box,{marginBottom:isLabelLeftPositioned?'spacing.0':'spacing.2',children:textNode})});};
|
|
3419
3423
|
|
|
3420
|
-
var StyledSelectorLabel=styled.Pressable({display:'flex',flexDirection:'row',marginTop:makeSpace(
|
|
3424
|
+
var StyledSelectorLabel=styled.Pressable(function(_ref){var theme=_ref.theme;return {display:'flex',flexDirection:'row',marginTop:makeSpace(theme.spacing[1]),marginBottom:makeSpace(theme.spacing[1])};});var SelectorLabel=function SelectorLabel(_ref2){var children=_ref2.children,inputProps=_ref2.inputProps;return jsx(StyledSelectorLabel,_extends({},inputProps,{children:children}));};
|
|
3421
3425
|
|
|
3422
|
-
var SelectorTitle=function SelectorTitle(_ref){var children=_ref.children,isDisabled=_ref.isDisabled;return jsx(
|
|
3426
|
+
var SelectorTitle=function SelectorTitle(_ref){var children=_ref.children,isDisabled=_ref.isDisabled,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size;var lineHeight={small:'s',medium:'l'};var fontSize={small:75,medium:100};return jsxs(Fragment$1,{children:[jsx(Box,{marginLeft:"spacing.2"}),jsx(BaseText,{lineHeight:lineHeight[size],fontFamily:"text",fontWeight:"regular",fontSize:fontSize[size],color:isDisabled?'surface.text.placeholder.lowContrast':'surface.text.subtle.lowContrast',children:children})]});};
|
|
3423
3427
|
|
|
3424
3428
|
var SelectorSupportText=function SelectorSupportText(_ref){var children=_ref.children,id=_ref.id;var isReactNative=getPlatformType()==='react-native';return jsx(BaseText,{id:id,as:isReactNative?undefined:'span',color:"surface.text.muted.lowContrast",fontSize:50,lineHeight:"s",fontStyle:"italic",fontFamily:"text",children:children});};
|
|
3425
3429
|
|
|
3426
3430
|
var SelectorInput=function SelectorInput(_props){return jsx(Fragment$1,{});};
|
|
3427
3431
|
|
|
3428
|
-
var Checkbox=function Checkbox(_ref){var _groupProps$state;var defaultChecked=_ref.defaultChecked,validationState=_ref.validationState,isChecked=_ref.isChecked,isDisabled=_ref.isDisabled,isIndeterminate=_ref.isIndeterminate,isRequired=_ref.isRequired,name=_ref.name,onChange=_ref.onChange,value=_ref.value,children=_ref.children,helpText=_ref.helpText,errorText=_ref.errorText;var groupProps=useCheckboxGroupContext();var hasValidationState=!isUndefined_1(validationState);var hasName=!isUndefined_1(name);var hasDefaultChecked=!isUndefined_1(defaultChecked);var hasIsChecked=!isUndefined_1(isChecked);var hasOnChange=!isUndefined_1(onChange);if((hasValidationState||hasName||hasDefaultChecked||hasIsChecked||hasOnChange)&&!isEmpty_1(groupProps)){var props=[hasValidationState?'validationState':undefined,hasName?'name':undefined,hasDefaultChecked?'defaultChecked':undefined,hasIsChecked?'isChecked':undefined,hasOnChange?'onChange':undefined].filter(Boolean).join(',');throw new Error("[Blade Checkbox]: Cannot set `"+props+"` on <Checkbox /> when it's inside <CheckboxGroup />, Please set it on the <CheckboxGroup /> itself");}if(!value&&!isEmpty_1(groupProps)){throw new Error("[Blade Checkbox]: <CheckboxGroup /> requires that you pass unique \"value\" prop to each <Checkbox />\n <CheckboxGroup>\n <Checkbox value=\"apple\">Apple</Checkbox>\n <Checkbox value=\"mango\">Mango</Checkbox>\n </CheckboxGroup>\n ");}var _validationState=validationState!=null?validationState:groupProps==null?void 0:groupProps.validationState;var _hasError=_validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _name=name!=null?name:groupProps==null?void 0:groupProps.name;var _isChecked=isChecked!=null?isChecked:groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var showSupportingText=validationState!=='error'&&helpText;var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,event=_ref2.event,value=_ref2.value;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.addValue(value);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue(value);}onChange==null?void 0:onChange({isChecked:isChecked,event:event,value:value});};var _useCheckbox=useCheckbox({defaultChecked:defaultChecked,isChecked:_isChecked,isIndeterminate:isIndeterminate,hasError:_hasError,hasHelperText:Boolean(showSupportingText),isDisabled:_isDisabled,isRequired:isRequired,name:_name,value:value,onChange:handleChange}),state=_useCheckbox.state,ids=_useCheckbox.ids,inputProps=_useCheckbox.inputProps;return jsxs(Box,{children:[jsx(SelectorLabel,{inputProps:state.isReactNative?inputProps:{},children:jsxs(Box,{display:"flex",flexDirection:"column",children:[jsxs(Box,{display:"flex",alignItems:"center",flexDirection:"row",children:[jsx(SelectorInput,{isChecked:state.isChecked||Boolean(isIndeterminate),isDisabled:_isDisabled,isNegative:_hasError,inputProps:inputProps}),jsx(CheckboxIcon,{isChecked:state.isChecked,isIndeterminate:isIndeterminate,isDisabled:_isDisabled,isNegative:_hasError}),jsx(SelectorTitle,{isDisabled:_isDisabled,children:children})]}),jsx(Box,{marginLeft:
|
|
3432
|
+
var Checkbox=function Checkbox(_ref){var _groupProps$state,_groupProps$size;var defaultChecked=_ref.defaultChecked,validationState=_ref.validationState,isChecked=_ref.isChecked,isDisabled=_ref.isDisabled,isIndeterminate=_ref.isIndeterminate,isRequired=_ref.isRequired,name=_ref.name,onChange=_ref.onChange,value=_ref.value,children=_ref.children,helpText=_ref.helpText,errorText=_ref.errorText,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size;var groupProps=useCheckboxGroupContext();var hasValidationState=!isUndefined_1(validationState);var hasName=!isUndefined_1(name);var hasDefaultChecked=!isUndefined_1(defaultChecked);var hasIsChecked=!isUndefined_1(isChecked);var hasOnChange=!isUndefined_1(onChange);if((hasValidationState||hasName||hasDefaultChecked||hasIsChecked||hasOnChange)&&!isEmpty_1(groupProps)){var props=[hasValidationState?'validationState':undefined,hasName?'name':undefined,hasDefaultChecked?'defaultChecked':undefined,hasIsChecked?'isChecked':undefined,hasOnChange?'onChange':undefined].filter(Boolean).join(',');throw new Error("[Blade Checkbox]: Cannot set `"+props+"` on <Checkbox /> when it's inside <CheckboxGroup />, Please set it on the <CheckboxGroup /> itself");}if(!value&&!isEmpty_1(groupProps)){throw new Error("[Blade Checkbox]: <CheckboxGroup /> requires that you pass unique \"value\" prop to each <Checkbox />\n <CheckboxGroup>\n <Checkbox value=\"apple\">Apple</Checkbox>\n <Checkbox value=\"mango\">Mango</Checkbox>\n </CheckboxGroup>\n ");}var _validationState=validationState!=null?validationState:groupProps==null?void 0:groupProps.validationState;var _hasError=_validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _name=name!=null?name:groupProps==null?void 0:groupProps.name;var _isChecked=isChecked!=null?isChecked:groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var _size=(_groupProps$size=groupProps.size)!=null?_groupProps$size:size;var isSmall=_size==='small';var showSupportingText=validationState!=='error'&&helpText;var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,event=_ref2.event,value=_ref2.value;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.addValue(value);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue(value);}onChange==null?void 0:onChange({isChecked:isChecked,event:event,value:value});};var _useCheckbox=useCheckbox({defaultChecked:defaultChecked,isChecked:_isChecked,isIndeterminate:isIndeterminate,hasError:_hasError,hasHelperText:Boolean(showSupportingText),isDisabled:_isDisabled,isRequired:isRequired,name:_name,value:value,onChange:handleChange}),state=_useCheckbox.state,ids=_useCheckbox.ids,inputProps=_useCheckbox.inputProps;return jsxs(Box,{children:[jsx(SelectorLabel,{inputProps:state.isReactNative?inputProps:{},children:jsxs(Box,{display:"flex",flexDirection:"column",children:[jsxs(Box,{display:"flex",alignItems:"center",flexDirection:"row",children:[jsx(SelectorInput,{isChecked:state.isChecked||Boolean(isIndeterminate),isDisabled:_isDisabled,isNegative:_hasError,inputProps:inputProps}),jsx(CheckboxIcon,{size:_size,isChecked:state.isChecked,isIndeterminate:isIndeterminate,isDisabled:_isDisabled,isNegative:_hasError}),jsx(SelectorTitle,{size:_size,isDisabled:_isDisabled,children:children})]}),jsx(Box,{marginLeft:isSmall?'spacing.6':'spacing.7',children:showSupportingText&&jsx(SelectorSupportText,{id:ids==null?void 0:ids.helpTextId,children:helpText})})]})}),jsx(FormHint,{errorText:errorText,errorTextId:ids==null?void 0:ids.errorTextId,type:validationState==='error'?'error':'help'})]});};
|
|
3429
3433
|
|
|
3430
|
-
var useCheckboxGroup=function useCheckboxGroup(_ref){var value=_ref.value,defaultValue=_ref.defaultValue,isDisabled=_ref.isDisabled,labelPosition=_ref.labelPosition,_onChange=_ref.onChange,validationState=_ref.validationState,name=_ref.name;var _useTheme=useTheme(),platform=_useTheme.platform;var _useFormId=useFormId('checkbox-group'),labelId=_useFormId.labelId;var _useControllableState=useControllableState({value:value,defaultValue:defaultValue||[],onChange:function onChange(values){return _onChange==null?void 0:_onChange({values:values,name:name});}}),_useControllableState2=_slicedToArray(_useControllableState,2),checkedValues=_useControllableState2[0],setValue=_useControllableState2[1];var state=React__default.useMemo(function(){return {value:checkedValues,setValue:function(_setValue){function setValue(_x){return _setValue.apply(this,arguments);}setValue.toString=function(){return _setValue.toString();};return setValue;}(function(value){if(isDisabled){return;}setValue(function(){return value;});}),isChecked:function isChecked(value){return checkedValues.includes(value);},addValue:function addValue(value){if(isDisabled){return;}if(!checkedValues.includes(value)){setValue(function(){return checkedValues.concat(value);});}},removeValue:function removeValue(value){if(isDisabled){return;}if(checkedValues.includes(value)){setValue(function(){return checkedValues.filter(function(existingValue){return existingValue!==value;});});}}};},[checkedValues,isDisabled,setValue]);var contextValue=React__default.useMemo(function(){return {validationState:validationState,isDisabled:isDisabled,labelPosition:platform==='onMobile'?'top':labelPosition,name:name,state:state};},[validationState,isDisabled,platform,labelPosition,name,state]);return {state:state,contextValue:contextValue,ids:{labelId:labelId}};};
|
|
3434
|
+
var useCheckboxGroup=function useCheckboxGroup(_ref){var value=_ref.value,defaultValue=_ref.defaultValue,isDisabled=_ref.isDisabled,labelPosition=_ref.labelPosition,_onChange=_ref.onChange,validationState=_ref.validationState,name=_ref.name,size=_ref.size;var _useTheme=useTheme(),platform=_useTheme.platform;var _useFormId=useFormId('checkbox-group'),labelId=_useFormId.labelId;var _useControllableState=useControllableState({value:value,defaultValue:defaultValue||[],onChange:function onChange(values){return _onChange==null?void 0:_onChange({values:values,name:name});}}),_useControllableState2=_slicedToArray(_useControllableState,2),checkedValues=_useControllableState2[0],setValue=_useControllableState2[1];var state=React__default.useMemo(function(){return {value:checkedValues,setValue:function(_setValue){function setValue(_x){return _setValue.apply(this,arguments);}setValue.toString=function(){return _setValue.toString();};return setValue;}(function(value){if(isDisabled){return;}setValue(function(){return value;});}),isChecked:function isChecked(value){return checkedValues.includes(value);},addValue:function addValue(value){if(isDisabled){return;}if(!checkedValues.includes(value)){setValue(function(){return checkedValues.concat(value);});}},removeValue:function removeValue(value){if(isDisabled){return;}if(checkedValues.includes(value)){setValue(function(){return checkedValues.filter(function(existingValue){return existingValue!==value;});});}}};},[checkedValues,isDisabled,setValue]);var contextValue=React__default.useMemo(function(){return {validationState:validationState,isDisabled:isDisabled,labelPosition:platform==='onMobile'?'top':labelPosition,name:name,state:state,size:size};},[validationState,isDisabled,platform,labelPosition,name,state,size]);return {state:state,contextValue:contextValue,ids:{labelId:labelId}};};
|
|
3431
3435
|
|
|
3432
3436
|
var SelectorGroupField=function SelectorGroupField(_ref){var children=_ref.children,labelledBy=_ref.labelledBy,position=_ref.position,_ref$accessibilityRol=_ref.accessibilityRole,accessibilityRole=_ref$accessibilityRol===void 0?'group':_ref$accessibilityRol;var isReactNative=getPlatformType()==='react-native';var labelPosition=position==='top'?'column':'row';if(isReactNative)labelPosition='column';var role=accessibilityRole==='group'&&isReactNative?undefined:accessibilityRole;return jsx(Box,_extends({display:"flex",flexDirection:labelPosition},makeAccessible({role:role,labelledBy:labelledBy}),{children:children}));};
|
|
3433
3437
|
|
|
3434
|
-
var CheckboxGroup=function CheckboxGroup(_ref){var children=_ref.children,label=_ref.label,helpText=_ref.helpText,isDisabled=_ref.isDisabled,_ref$necessityIndicat=_ref.necessityIndicator,necessityIndicator=_ref$necessityIndicat===void 0?'none':_ref$necessityIndicat,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,validationState=_ref.validationState,errorText=_ref.errorText,name=_ref.name,defaultValue=_ref.defaultValue,onChange=_ref.onChange,value=_ref.value;var _useCheckboxGroup=useCheckboxGroup({defaultValue:defaultValue,onChange:onChange,value:value,isDisabled:isDisabled,name:name,labelPosition:labelPosition,validationState:validationState}),contextValue=_useCheckboxGroup.contextValue,ids=_useCheckboxGroup.ids;var showError=validationState==='error'&&errorText;var showHelpText=!showError&&helpText;var accessibilityText=","+(showError?errorText:'')+" "+(showHelpText?helpText:'');return jsx(CheckboxGroupProvider,{value:contextValue,children:jsxs(SelectorGroupField,{position:labelPosition,labelledBy:ids.labelId,children:[jsx(FormLabel,{as:"span",necessityIndicator:necessityIndicator,position:labelPosition,id:ids.labelId,accessibilityText:accessibilityText,children:label}),jsxs(Box,{children:[jsx(Box,{display:"flex",flexDirection:"column",
|
|
3438
|
+
var CheckboxGroup=function CheckboxGroup(_ref){var children=_ref.children,label=_ref.label,helpText=_ref.helpText,isDisabled=_ref.isDisabled,_ref$necessityIndicat=_ref.necessityIndicator,necessityIndicator=_ref$necessityIndicat===void 0?'none':_ref$necessityIndicat,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,validationState=_ref.validationState,errorText=_ref.errorText,name=_ref.name,defaultValue=_ref.defaultValue,onChange=_ref.onChange,value=_ref.value,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size;var _useCheckboxGroup=useCheckboxGroup({defaultValue:defaultValue,onChange:onChange,value:value,isDisabled:isDisabled,name:name,labelPosition:labelPosition,validationState:validationState,size:size}),contextValue=_useCheckboxGroup.contextValue,ids=_useCheckboxGroup.ids;var _useTheme=useTheme(),theme=_useTheme.theme;var showError=validationState==='error'&&errorText;var showHelpText=!showError&&helpText;var accessibilityText=","+(showError?errorText:'')+" "+(showHelpText?helpText:'');var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var gap=checkboxSizes.group.gap[size][matchedDeviceType];var childCount=React__default.Children.count(children);return jsx(CheckboxGroupProvider,{value:contextValue,children:jsxs(SelectorGroupField,{position:labelPosition,labelledBy:ids.labelId,children:[jsx(FormLabel,{as:"span",necessityIndicator:necessityIndicator,position:labelPosition,id:ids.labelId,accessibilityText:accessibilityText,children:label}),jsxs(Box,{children:[jsx(Box,{display:"flex",flexDirection:"column",children:React__default.Children.map(children,function(child,index){return jsx(Box,{marginBottom:index===childCount-1?0:gap,children:child},index);})}),jsx(FormHint,{errorText:errorText,helpText:helpText,type:validationState==='error'?'error':'help'})]})]})});};
|
|
3435
3439
|
|
|
3436
3440
|
var getVisualContainerStyles=function getVisualContainerStyles(){return {display:'flex',flexDirection:'row',alignItems:'center'};};var getPrefixStyles=function getPrefixStyles(_ref){var hasLeadingIcon=_ref.hasLeadingIcon,hasPrefix=_ref.hasPrefix;if(hasPrefix&&hasLeadingIcon){return {paddingLeft:'spacing.2'};}if(hasPrefix&&!hasLeadingIcon){return {paddingLeft:'spacing.4'};}return {paddingLeft:'spacing.0'};};var getInteractionElementStyles=function getInteractionElementStyles(_ref2){var hasTrailingIcon=_ref2.hasTrailingIcon,hasInteractionElement=_ref2.hasInteractionElement,hasSuffix=_ref2.hasSuffix;if(hasInteractionElement&&(hasSuffix||hasTrailingIcon)){return {paddingRight:'spacing.2'};}if(hasInteractionElement&&!hasSuffix&&!hasTrailingIcon){return {paddingRight:'spacing.4'};}return {paddingRight:'spacing.0'};};var getSuffixStyles=function getSuffixStyles(_ref3){var hasTrailingIcon=_ref3.hasTrailingIcon,hasSuffix=_ref3.hasSuffix;if(hasSuffix&&hasTrailingIcon){return {paddingRight:'spacing.2'};}if(hasSuffix&&!hasTrailingIcon){return {paddingRight:'spacing.4'};}return {paddingRight:'spacing.0'};};var getInputVisualsToBeRendered=function getInputVisualsToBeRendered(_ref4){var leadingIcon=_ref4.leadingIcon,prefix=_ref4.prefix,interactionElement=_ref4.interactionElement,suffix=_ref4.suffix,trailingIcon=_ref4.trailingIcon;return {hasLeadingIcon:Boolean(leadingIcon),hasPrefix:Boolean(prefix),hasInteractionElement:Boolean(interactionElement),hasSuffix:Boolean(suffix),hasTrailingIcon:Boolean(trailingIcon)};};var BaseInputVisuals=function BaseInputVisuals(_ref5){var LeadingIcon=_ref5.leadingIcon,prefix=_ref5.prefix,interactionElement=_ref5.interactionElement,suffix=_ref5.suffix,TrailingIcon=_ref5.trailingIcon,isDisabled=_ref5.isDisabled;var _getInputVisualsToBeR=getInputVisualsToBeRendered({leadingIcon:LeadingIcon,prefix:prefix,interactionElement:interactionElement,suffix:suffix,trailingIcon:TrailingIcon}),hasLeadingIcon=_getInputVisualsToBeR.hasLeadingIcon,hasPrefix=_getInputVisualsToBeR.hasPrefix,hasInteractionElement=_getInputVisualsToBeR.hasInteractionElement,hasSuffix=_getInputVisualsToBeR.hasSuffix,hasTrailingIcon=_getInputVisualsToBeR.hasTrailingIcon;var hasLeadingVisuals=hasLeadingIcon||hasPrefix;var hasTrailingVisuals=hasInteractionElement||hasSuffix||hasTrailingIcon;if(hasLeadingVisuals){return jsxs(Box,_extends({},getVisualContainerStyles(),{children:[LeadingIcon?jsx(Box,{paddingLeft:"spacing.4",display:"flex",children:jsx(LeadingIcon,{size:"medium",color:isDisabled?'surface.text.placeholder.lowContrast':'surface.text.subtle.lowContrast'})}):null,hasPrefix?jsx(Box,_extends({},getPrefixStyles({hasLeadingIcon:hasLeadingIcon,hasPrefix:hasPrefix}),{children:jsx(Text,{size:"medium",variant:"body",weight:"regular",contrast:"low",type:isDisabled?'placeholder':'subtle',children:prefix})})):null]}));}if(hasTrailingVisuals){return jsxs(Box,_extends({},getVisualContainerStyles(),{children:[hasInteractionElement?jsx(Box,_extends({},getInteractionElementStyles({hasTrailingIcon:hasTrailingIcon,hasInteractionElement:hasInteractionElement,hasSuffix:hasSuffix}),{display:"flex",children:interactionElement})):null,hasSuffix?jsx(Box,_extends({},getSuffixStyles({hasTrailingIcon:hasTrailingIcon,hasSuffix:hasSuffix}),{children:jsx(Text,{size:"medium",variant:"body",weight:"regular",contrast:"low",type:isDisabled?'placeholder':'subtle',children:suffix})})):null,TrailingIcon?jsx(Box,{paddingRight:"spacing.4",display:"flex",children:jsx(TrailingIcon,{size:"medium",color:isDisabled?'surface.text.placeholder.lowContrast':'surface.text.subtle.lowContrast'})}):null]}));}return null;};
|
|
3437
3441
|
|
|
@@ -3461,7 +3465,9 @@ var Link=function Link(_ref){var children=_ref.children,icon=_ref.icon,_ref$icon
|
|
|
3461
3465
|
|
|
3462
3466
|
var useRadio=function useRadio(_ref){var isChecked=_ref.isChecked,defaultChecked=_ref.defaultChecked,isDisabled=_ref.isDisabled,isRequired=_ref.isRequired,hasError=_ref.hasError,onChange=_ref.onChange,name=_ref.name,value=_ref.value;var inputRef=React__default.useRef(null);var isReactNative=getPlatformType()==='react-native';if(isChecked&&defaultChecked){throw new Error("[Blade: Radio]: Do not provide both 'isChecked' and 'defaultChecked' to useRadio. Consider if you want this component to be controlled or uncontrolled.");}var _useControllableState=useControllableState({value:isChecked,defaultValue:defaultChecked!=null?defaultChecked:false}),_useControllableState2=_slicedToArray(_useControllableState,2),radioState=_useControllableState2[0],setRadioState=_useControllableState2[1];var handleOnChange=function handleOnChange(event){if(isDisabled){event.stopPropagation();event.preventDefault();return;}setRadioState(function(checked){if(checked===false){onChange==null?void 0:onChange({isChecked:true,event:event,value:value});return true;}return checked;});};var state={isChecked:radioState,setChecked:setRadioState};var idBase=useId('radio');var helpTextId=useId(idBase+"-helptext");var accessibilityProps=makeAccessible({role:'radio',required:Boolean(isRequired),hidden:!isReactNative,invalid:Boolean(hasError),disabled:Boolean(isDisabled),checked:radioState,describedBy:helpTextId});if(isReactNative){return {state:state,inputProps:_extends({onPress:handleOnChange,name:name,value:value},accessibilityProps)};}return {state:state,ids:{helpTextId:helpTextId},inputProps:_extends({ref:inputRef,onChange:handleOnChange,type:'radio',name:name,value:value,checked:radioState,disabled:isDisabled,required:isRequired},accessibilityProps)};};
|
|
3463
3467
|
|
|
3464
|
-
var
|
|
3468
|
+
var radioSizes={group:{gap:{small:{mobile:'spacing.2',desktop:'spacing.0'},medium:{mobile:'spacing.3',desktop:'spacing.2'}}},icon:{small:{width:12,height:12,dotRadius:2},medium:{width:16,height:16,dotRadius:3}}};var radioIconColors={variants:{default:{dot:{checked:'colors.brand.gray.200',unchecked:'colors.brand.gray.200'},border:{checked:'colors.brand.primary.500',unchecked:'colors.brand.gray.500'},background:{checked:'colors.brand.primary.500',unchecked:'transparent'}},disabled:{dot:{checked:'colors.brand.gray.200',unchecked:'colors.brand.gray.200'},border:{checked:'transparent',unchecked:'colors.brand.gray.a100'},background:{checked:'colors.brand.gray.a100',unchecked:'transparent'}},negative:{dot:{checked:'colors.brand.gray.200',unchecked:'colors.brand.gray.200'},border:{checked:'colors.feedback.border.negative.highContrast',unchecked:'colors.feedback.border.negative.highContrast'},background:{checked:'colors.feedback.background.negative.highContrast',unchecked:'colors.feedback.background.negative.lowContrast'}}}};
|
|
3469
|
+
|
|
3470
|
+
var getRadioIconWrapperStyles=function getRadioIconWrapperStyles(_ref){var theme=_ref.theme,isChecked=_ref.isChecked,isDisabled=_ref.isDisabled,isNegative=_ref.isNegative,size=_ref.size;var isReactNative=getPlatformType()==='react-native';var variant='default';if(isDisabled)variant='disabled';if(isNegative)variant='negative';var checked=isChecked?'checked':'unchecked';var background=radioIconColors.variants[variant].background[checked];var border=radioIconColors.variants[variant].border[checked];var backgroundColor=background==='transparent'?background:get_1(theme,background);var borderColor=border==='transparent'?border:get_1(theme,border);return _extends({display:'flex',alignItems:'center',justifyContent:'center',width:makeSpace(radioSizes.icon[size].width),height:makeSpace(radioSizes.icon[size].height),borderWidth:makeBorderSize(theme.border.width.thick),borderStyle:'solid',margin:makeSpace(theme.spacing[1]),borderRadius:makeSize(theme.border.radius.max),backgroundColor:backgroundColor,borderColor:borderColor},!isReactNative&&{transitionDuration:castWebType(makeMotionTime(theme.motion.duration.xquick)),transitionTimingFunction:castWebType(theme.motion.easing.exit.attentive)});};
|
|
3465
3471
|
|
|
3466
3472
|
var RadioIconWrapper=styled.View(function(props){return getRadioIconWrapperStyles(props);});
|
|
3467
3473
|
|
|
@@ -3469,19 +3475,19 @@ var StyledFade=styled(Animated.View)(function(_ref){var styles=_ref.styles;retur
|
|
|
3469
3475
|
|
|
3470
3476
|
var Circle=function Circle(_ref){var cx=_ref.cx,cy=_ref.cy,x=_ref.x,y=_ref.y,r=_ref.r,fill=_ref.fill,stroke=_ref.stroke;return jsx(Circle$1,{cx:cx,cy:cy,x:x,y:y,r:r,fill:fill,stroke:stroke});};
|
|
3471
3477
|
|
|
3472
|
-
var CheckedIcon=function CheckedIcon(_ref){var color=_ref.color;return jsx(Svg,{width:
|
|
3478
|
+
var CheckedIcon=function CheckedIcon(_ref){var color=_ref.color,size=_ref.size;var width=radioSizes.icon[size].width;var height=radioSizes.icon[size].height;var radius=radioSizes.icon[size].dotRadius;var viewBox="0 0 "+width+" "+height;var cx=""+width/2;var cy=""+height/2;return jsx(Svg,{width:makeSpace(width),height:makeSpace(height),viewBox:viewBox,fill:"none",children:jsx(Circle,{cx:cx,cy:cy,r:""+radius,fill:color})});};var RadioIcon=function RadioIcon(_ref2){var isChecked=_ref2.isChecked,isDisabled=_ref2.isDisabled,isNegative=_ref2.isNegative,size=_ref2.size;var _useTheme=useTheme(),theme=_useTheme.theme;var checked=Boolean(isChecked);var state=checked?'checked':'unchecked';var variant='default';if(isDisabled)variant='disabled';if(isNegative)variant='negative';var dotColor=get_1(theme,radioIconColors.variants[variant].dot[state]);return jsx(RadioIconWrapper,{size:size,isDisabled:isDisabled,isNegative:isNegative,isChecked:checked,children:jsx(Fade,{show:checked,styles:{position:'absolute',display:'flex'},children:jsx(CheckedIcon,{size:size,color:dotColor})})});};
|
|
3473
3479
|
|
|
3474
3480
|
var RadioGroupContext=React__default.createContext({});var RadioGroupProvider=RadioGroupContext.Provider;var useRadioGroupContext=function useRadioGroupContext(){var context=React__default.useContext(RadioGroupContext);return context;};
|
|
3475
3481
|
|
|
3476
|
-
var Radio=function Radio(_ref){var _groupProps$state;var value=_ref.value,children=_ref.children,helpText=_ref.helpText,isDisabled=_ref.isDisabled;var groupProps=useRadioGroupContext();var isInsideGroup=!isEmpty_1(groupProps);if(!isInsideGroup){throw new Error('[Blade Radio]: Cannot use <Radio /> outside of <RadioGroup />');}var isChecked=groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var defaultChecked=(groupProps==null?void 0:groupProps.defaultValue)===undefined?undefined:(groupProps==null?void 0:groupProps.defaultValue)===value;var validationState=groupProps==null?void 0:groupProps.validationState;var hasError=validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var name=groupProps==null?void 0:groupProps.name;var showHelpText=!hasError&&helpText;var isReactNative=getPlatformType()==='react-native';var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,value=_ref2.value;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.setValue(value);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue();}};var _useRadio=useRadio({defaultChecked:defaultChecked,isChecked:isChecked,hasError:hasError,isDisabled:_isDisabled,isRequired:groupProps.necessityIndicator==='required',name:name,value:value,onChange:handleChange}),state=_useRadio.state,ids=_useRadio.ids,inputProps=_useRadio.inputProps;return jsx(SelectorLabel,{inputProps:isReactNative?inputProps:{},children:jsxs(Box,{display:"flex",flexDirection:"column",children:[jsxs(Box,{display:"flex",alignItems:"center",flexDirection:"row",children:[jsx(SelectorInput,{isChecked:state.isChecked,isDisabled:
|
|
3482
|
+
var Radio=function Radio(_ref){var _groupProps$state,_groupProps$size;var value=_ref.value,children=_ref.children,helpText=_ref.helpText,isDisabled=_ref.isDisabled,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size;var groupProps=useRadioGroupContext();var isInsideGroup=!isEmpty_1(groupProps);if(!isInsideGroup){throw new Error('[Blade Radio]: Cannot use <Radio /> outside of <RadioGroup />');}var isChecked=groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var defaultChecked=(groupProps==null?void 0:groupProps.defaultValue)===undefined?undefined:(groupProps==null?void 0:groupProps.defaultValue)===value;var validationState=groupProps==null?void 0:groupProps.validationState;var hasError=validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var name=groupProps==null?void 0:groupProps.name;var showHelpText=!hasError&&helpText;var isReactNative=getPlatformType()==='react-native';var _size=(_groupProps$size=groupProps.size)!=null?_groupProps$size:size;var isSmall=_size==='small';var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,value=_ref2.value;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.setValue(value);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue();}};var _useRadio=useRadio({defaultChecked:defaultChecked,isChecked:isChecked,hasError:hasError,isDisabled:_isDisabled,isRequired:groupProps.necessityIndicator==='required',name:name,value:value,onChange:handleChange}),state=_useRadio.state,ids=_useRadio.ids,inputProps=_useRadio.inputProps;return jsx(SelectorLabel,{inputProps:isReactNative?inputProps:{},children:jsxs(Box,{display:"flex",flexDirection:"column",children:[jsxs(Box,{display:"flex",alignItems:"center",flexDirection:"row",children:[jsx(SelectorInput,{isChecked:state.isChecked,isDisabled:_isDisabled,isNegative:hasError,inputProps:inputProps}),jsx(RadioIcon,{size:_size,isChecked:state.isChecked,isDisabled:_isDisabled,isNegative:hasError}),jsx(SelectorTitle,{size:_size,isDisabled:_isDisabled,children:children})]}),jsx(Box,{marginLeft:isSmall?'spacing.6':'spacing.7',children:showHelpText&&jsx(SelectorSupportText,{id:ids==null?void 0:ids.helpTextId,children:helpText})})]})});};
|
|
3477
3483
|
|
|
3478
|
-
var useRadioGroup=function useRadioGroup(_ref){var value=_ref.value,defaultValue=_ref.defaultValue,isDisabled=_ref.isDisabled,labelPosition=_ref.labelPosition,_onChange=_ref.onChange,validationState=_ref.validationState,necessityIndicator=_ref.necessityIndicator,name=_ref.name;var _useTheme=useTheme(),platform=_useTheme.platform;var idBase=useId('radio-group');var labelId=idBase+"-label";var fallbackName=name!=null?name:idBase;var _useControllableState=useControllableState({value:value,defaultValue:defaultValue,onChange:function onChange(v){return _onChange==null?void 0:_onChange({value:v,name:fallbackName});}}),_useControllableState2=_slicedToArray(_useControllableState,2),checkedValue=_useControllableState2[0],setValue=_useControllableState2[1];var state=React__default.useMemo(function(){return {value:checkedValue,setValue:function(_setValue){function setValue(_x){return _setValue.apply(this,arguments);}setValue.toString=function(){return _setValue.toString();};return setValue;}(function(v){if(isDisabled){return;}setValue(function(){return v;});}),removeValue:function removeValue(){if(isDisabled){return;}setValue(undefined);},isChecked:function isChecked(v){if(isUndefined_1(v)||isUndefined_1(checkedValue))return false;return checkedValue===v;}};},[checkedValue,isDisabled,setValue]);var contextValue=React__default.useMemo(function(){return {necessityIndicator:necessityIndicator,validationState:validationState,isDisabled:isDisabled,labelPosition:platform==='onMobile'?'top':labelPosition,name:fallbackName,state:state};},[validationState,isDisabled,platform,labelPosition,state,fallbackName,necessityIndicator]);return {state:state,contextValue:contextValue,ids:{labelId:labelId}};};
|
|
3484
|
+
var useRadioGroup=function useRadioGroup(_ref){var value=_ref.value,defaultValue=_ref.defaultValue,isDisabled=_ref.isDisabled,labelPosition=_ref.labelPosition,_onChange=_ref.onChange,validationState=_ref.validationState,necessityIndicator=_ref.necessityIndicator,name=_ref.name,size=_ref.size;var _useTheme=useTheme(),platform=_useTheme.platform;var idBase=useId('radio-group');var labelId=idBase+"-label";var fallbackName=name!=null?name:idBase;var _useControllableState=useControllableState({value:value,defaultValue:defaultValue,onChange:function onChange(v){return _onChange==null?void 0:_onChange({value:v,name:fallbackName});}}),_useControllableState2=_slicedToArray(_useControllableState,2),checkedValue=_useControllableState2[0],setValue=_useControllableState2[1];var state=React__default.useMemo(function(){return {value:checkedValue,setValue:function(_setValue){function setValue(_x){return _setValue.apply(this,arguments);}setValue.toString=function(){return _setValue.toString();};return setValue;}(function(v){if(isDisabled){return;}setValue(function(){return v;});}),removeValue:function removeValue(){if(isDisabled){return;}setValue(undefined);},isChecked:function isChecked(v){if(isUndefined_1(v)||isUndefined_1(checkedValue))return false;return checkedValue===v;}};},[checkedValue,isDisabled,setValue]);var contextValue=React__default.useMemo(function(){return {necessityIndicator:necessityIndicator,validationState:validationState,isDisabled:isDisabled,labelPosition:platform==='onMobile'?'top':labelPosition,name:fallbackName,state:state,size:size};},[validationState,isDisabled,platform,labelPosition,state,fallbackName,necessityIndicator,size]);return {state:state,contextValue:contextValue,ids:{labelId:labelId}};};
|
|
3479
3485
|
|
|
3480
|
-
var RadioGroup=function RadioGroup(_ref){var children=_ref.children,label=_ref.label,helpText=_ref.helpText,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,_ref$necessityIndicat=_ref.necessityIndicator,necessityIndicator=_ref$necessityIndicat===void 0?'none':_ref$necessityIndicat,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,_ref$validationState=_ref.validationState,validationState=_ref$validationState===void 0?'none':_ref$validationState,errorText=_ref.errorText,name=_ref.name,defaultValue=_ref.defaultValue,onChange=_ref.onChange,value=_ref.value;var _useRadioGroup=useRadioGroup({defaultValue:defaultValue,isDisabled:isDisabled,labelPosition:labelPosition,name:name,onChange:onChange,validationState:validationState,value:value}),contextValue=_useRadioGroup.contextValue,ids=_useRadioGroup.ids;var showError=validationState==='error'&&errorText;var showHelpText=!showError&&helpText;var accessibilityText=","+(showError?errorText:'')+" "+(showHelpText?helpText:'');var isReactNative=getPlatformType()==='react-native';return jsx(RadioGroupProvider,{value:contextValue,children:jsxs(SelectorGroupField,{position:labelPosition,labelledBy:ids.labelId,accessibilityRole:isReactNative?'radiogroup':'group',children:[jsx(FormLabel,{as:"span",necessityIndicator:necessityIndicator,position:labelPosition,id:ids.labelId,accessibilityText:accessibilityText,children:label}),jsxs(Box,{children:[jsx(Box,{display:"flex",flexDirection:"column",
|
|
3486
|
+
var RadioGroup=function RadioGroup(_ref){var children=_ref.children,label=_ref.label,helpText=_ref.helpText,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,_ref$necessityIndicat=_ref.necessityIndicator,necessityIndicator=_ref$necessityIndicat===void 0?'none':_ref$necessityIndicat,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,_ref$validationState=_ref.validationState,validationState=_ref$validationState===void 0?'none':_ref$validationState,errorText=_ref.errorText,name=_ref.name,defaultValue=_ref.defaultValue,onChange=_ref.onChange,value=_ref.value,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size;var _useRadioGroup=useRadioGroup({defaultValue:defaultValue,isDisabled:isDisabled,labelPosition:labelPosition,name:name,onChange:onChange,validationState:validationState,value:value,size:size}),contextValue=_useRadioGroup.contextValue,ids=_useRadioGroup.ids;var _useTheme=useTheme(),theme=_useTheme.theme;var _useBreakpoint=useBreakpoint({breakpoints:theme.breakpoints}),matchedDeviceType=_useBreakpoint.matchedDeviceType;var showError=validationState==='error'&&errorText;var showHelpText=!showError&&helpText;var accessibilityText=","+(showError?errorText:'')+" "+(showHelpText?helpText:'');var isReactNative=getPlatformType()==='react-native';var gap=radioSizes.group.gap[size][matchedDeviceType];var childCount=React__default.Children.count(children);return jsx(RadioGroupProvider,{value:contextValue,children:jsxs(SelectorGroupField,{position:labelPosition,labelledBy:ids.labelId,accessibilityRole:isReactNative?'radiogroup':'group',children:[jsx(FormLabel,{as:"span",necessityIndicator:necessityIndicator,position:labelPosition,id:ids.labelId,accessibilityText:accessibilityText,children:label}),jsxs(Box,{children:[jsx(Box,{display:"flex",flexDirection:"column",children:React__default.Children.map(children,function(child,index){return jsx(Box,{marginBottom:index===childCount-1?0:gap,children:child},index);})}),jsx(FormHint,{type:validationState==='error'?'error':'help',errorText:errorText,helpText:helpText})]})]})});};
|
|
3481
3487
|
|
|
3482
3488
|
var Spinner=function Spinner(_ref){var _ref2;var label=_ref.label,labelPosition=_ref.labelPosition,accessibilityLabel=_ref.accessibilityLabel,_ref$contrast=_ref.contrast,contrast=_ref$contrast===void 0?'low':_ref$contrast,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size;return jsx(BaseSpinner,{label:label,labelPosition:labelPosition,accessibilityLabel:(_ref2=accessibilityLabel!=null?accessibilityLabel:label)!=null?_ref2:'Loading',contrast:contrast,size:size});};
|
|
3483
3489
|
|
|
3484
3490
|
var SkipNavLink=function SkipNavLink(_props){throw new Error('[Blade: SkipNav]: SkipNavLink is not available on React Native');};var SkipNavContent=function SkipNavContent(_props){throw new Error('[Blade: SkipNav]: SkipNavContent is not available on React Native');};
|
|
3485
3491
|
|
|
3486
|
-
export { Alert, AlertTriangleIcon as AlertOctagonIcon, AlertTriangleIcon$1 as AlertTriangleIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, ArrowUpRightIcon, Badge, BladeProvider, Button, CheckCircleIcon, CheckIcon, Checkbox, CheckboxGroup, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, Code, CreditCardIcon, DollarIcon, DownloadIcon, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, Heading, HelpCircleIcon, HistoryIcon, HomeIcon, InfoIcon, Link, MinusIcon, OTPInput, PasswordInput, PauseIcon, PlusIcon, Radio, RadioGroup, RefreshLeftIcon, RotateCounterClockWiseIcon, RupeeIcon, SearchIcon, SkipNavContent, SkipNavLink, Spinner, Text, TextArea, TextInput, Title, TrashIcon, TrendingDownIcon, TrendingUpIcon, VisuallyHidden, announce, clearAnnouncer, destroyAnnouncer, getTextProps, screenReaderStyles, useTheme };
|
|
3492
|
+
export { Alert, AlertTriangleIcon as AlertOctagonIcon, AlertTriangleIcon$1 as AlertTriangleIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, ArrowUpRightIcon, Badge, BladeProvider, Button, CheckCircleIcon, CheckIcon, Checkbox, CheckboxGroup, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, Code, CreditCardIcon, DollarIcon, DownloadIcon, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, Heading, HelpCircleIcon, HistoryIcon, HomeIcon, InfoIcon, Link, LinkIcon, MinusIcon, OTPInput, PasswordInput, PauseIcon, PlusIcon, Radio, RadioGroup, RefreshLeftIcon, RotateCounterClockWiseIcon, RupeeIcon, SearchIcon, SkipNavContent, SkipNavLink, Spinner, Text, TextArea, TextInput, Title, TrashIcon, TrendingDownIcon, TrendingUpIcon, VisuallyHidden, announce, clearAnnouncer, destroyAnnouncer, getTextProps, screenReaderStyles, useTheme };
|
|
3487
3493
|
//# sourceMappingURL=index.native.js.map
|