@razorpay/blade 3.4.1 → 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.
@@ -6893,35 +6893,61 @@ var useCheckboxGroupContext = function useCheckboxGroupContext() {
6893
6893
  return context;
6894
6894
  };
6895
6895
 
6896
- var variants$3 = {
6897
- "default": {
6898
- border: {
6899
- checked: 'colors.brand.primary.500',
6900
- unchecked: 'colors.brand.gray.400'
6901
- },
6902
- background: {
6903
- checked: 'colors.brand.primary.500',
6904
- unchecked: 'colors.brand.gray.200'
6896
+ var checkboxSizes = {
6897
+ group: {
6898
+ gap: {
6899
+ small: {
6900
+ mobile: 'spacing.2',
6901
+ desktop: 'spacing.0'
6902
+ },
6903
+ medium: {
6904
+ mobile: 'spacing.3',
6905
+ desktop: 'spacing.2'
6906
+ }
6905
6907
  }
6906
6908
  },
6907
- disabled: {
6908
- border: {
6909
- checked: 'colors.brand.gray.300',
6910
- unchecked: 'colors.brand.gray.300'
6909
+ icon: {
6910
+ small: {
6911
+ width: 12,
6912
+ height: 12
6911
6913
  },
6912
- background: {
6913
- checked: 'colors.brand.gray.300',
6914
- unchecked: 'colors.brand.gray.300'
6914
+ medium: {
6915
+ width: 16,
6916
+ height: 16
6915
6917
  }
6916
- },
6917
- negative: {
6918
- border: {
6919
- checked: 'colors.feedback.border.negative.highContrast',
6920
- unchecked: 'colors.feedback.border.negative.highContrast'
6918
+ }
6919
+ };
6920
+ var checkboxIconColors = {
6921
+ variants: {
6922
+ "default": {
6923
+ border: {
6924
+ checked: 'colors.brand.primary.500',
6925
+ unchecked: 'colors.brand.gray.500'
6926
+ },
6927
+ background: {
6928
+ checked: 'colors.brand.primary.500',
6929
+ unchecked: 'transparent'
6930
+ }
6921
6931
  },
6922
- background: {
6923
- checked: 'colors.feedback.background.negative.highContrast',
6924
- unchecked: 'colors.feedback.background.negative.lowContrast'
6932
+ disabled: {
6933
+ border: {
6934
+ checked: 'transparent',
6935
+ unchecked: 'colors.brand.gray.a100'
6936
+ },
6937
+ background: {
6938
+ checked: 'colors.brand.gray.a100',
6939
+ unchecked: 'transparent'
6940
+ }
6941
+ },
6942
+ negative: {
6943
+ border: {
6944
+ checked: 'colors.feedback.border.negative.highContrast',
6945
+ unchecked: 'colors.feedback.border.negative.highContrast'
6946
+ },
6947
+ background: {
6948
+ checked: 'colors.feedback.background.negative.highContrast',
6949
+ unchecked: 'colors.feedback.background.negative.lowContrast'
6950
+ }
6925
6951
  }
6926
6952
  }
6927
6953
  };
@@ -6930,26 +6956,28 @@ var getCheckboxIconWrapperStyles = function getCheckboxIconWrapperStyles(_ref) {
6930
6956
  var theme = _ref.theme,
6931
6957
  isChecked = _ref.isChecked,
6932
6958
  isDisabled = _ref.isDisabled,
6933
- isNegative = _ref.isNegative;
6959
+ isNegative = _ref.isNegative,
6960
+ size = _ref.size;
6934
6961
  var variant = 'default';
6935
6962
  if (isDisabled) variant = 'disabled';
6936
6963
  if (isNegative) variant = 'negative';
6937
6964
  var checked = isChecked ? 'checked' : 'unchecked';
6938
- var backgroundColor = variants$3[variant].background[checked];
6939
- var borderColor = variants$3[variant].border[checked];
6965
+ var background = checkboxIconColors.variants[variant].background[checked];
6966
+ var border = checkboxIconColors.variants[variant].border[checked];
6967
+ var backgroundColor = background === 'transparent' ? background : get_1(theme, background);
6968
+ var borderColor = border === 'transparent' ? border : get_1(theme, border);
6940
6969
  return {
6941
6970
  display: 'flex',
6942
6971
  alignItems: 'center',
6943
6972
  justifyContent: 'center',
6944
- width: '16px',
6945
- height: '16px',
6946
- borderWidth: makeBorderSize(theme.border.width.thin),
6973
+ width: makeSpace(checkboxSizes.icon[size].width),
6974
+ height: makeSpace(checkboxSizes.icon[size].height),
6975
+ borderWidth: makeBorderSize(theme.border.width.thick),
6947
6976
  borderStyle: 'solid',
6948
- margin: makeSpace(theme.spacing[0]),
6977
+ margin: makeSpace(theme.spacing[1]),
6949
6978
  borderRadius: makeSize(theme.border.radius.small),
6950
- marginRight: makeSpace(theme.spacing[3]),
6951
- backgroundColor: get_1(theme, backgroundColor),
6952
- borderColor: get_1(theme, borderColor)
6979
+ backgroundColor: backgroundColor,
6980
+ borderColor: borderColor
6953
6981
  };
6954
6982
  };
6955
6983
 
@@ -6996,35 +7024,59 @@ var Fade$1 = function Fade(_ref2) {
6996
7024
  };
6997
7025
 
6998
7026
  /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
7027
+ var svgSize = {
7028
+ small: {
7029
+ width: 8,
7030
+ height: 8
7031
+ },
7032
+ medium: {
7033
+ width: 12,
7034
+ height: 12
7035
+ }
7036
+ };
6999
7037
 
7000
7038
  var CheckedIcon$1 = function CheckedIcon(_ref) {
7001
- var color = _ref.color;
7039
+ var color = _ref.color,
7040
+ size = _ref.size;
7041
+ var width = makeSpace(svgSize[size].width);
7042
+ var height = makeSpace(svgSize[size].height);
7002
7043
  return /*#__PURE__*/jsx(Svg, {
7003
- width: "16px",
7004
- height: "16px",
7005
- viewBox: "0 0 16 16",
7044
+ width: width,
7045
+ height: height,
7046
+ viewBox: "0 0 8 8",
7006
7047
  fill: "none",
7007
7048
  children: /*#__PURE__*/jsx(Path, {
7008
7049
  fillRule: "evenodd",
7009
7050
  clipRule: "evenodd",
7010
- d: "M12.3536 4.64645C12.5488 4.84171 12.5488 5.15829 12.3536 5.35355L6.85355 10.8536C6.65829 11.0488 6.34171 11.0488 6.14645 10.8536L3.64645 8.35355C3.45118 8.15829 3.45118 7.84171 3.64645 7.64645C3.84171 7.45118 4.15829 7.45118 4.35355 7.64645L6.5 9.79289L11.6464 4.64645C11.8417 4.45118 12.1583 4.45118 12.3536 4.64645Z",
7011
- fill: color
7051
+ 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",
7052
+ fill: color,
7053
+ stroke: "white",
7054
+ strokeWidth: "0.5",
7055
+ strokeLinecap: "round",
7056
+ strokeLinejoin: "round"
7012
7057
  })
7013
7058
  });
7014
7059
  };
7015
7060
 
7016
7061
  var IndeterminateIcon = function IndeterminateIcon(_ref2) {
7017
- var color = _ref2.color;
7062
+ var color = _ref2.color,
7063
+ size = _ref2.size;
7064
+ var width = "".concat(svgSize[size].width, "px");
7065
+ var height = "".concat(svgSize[size].height, "px");
7018
7066
  return /*#__PURE__*/jsx(Svg, {
7019
- width: "16px",
7020
- height: "16px",
7021
- viewBox: "0 0 16 16",
7067
+ width: width,
7068
+ height: height,
7069
+ viewBox: "0 0 8 8",
7022
7070
  fill: "none",
7023
7071
  children: /*#__PURE__*/jsx(Path, {
7024
7072
  fillRule: "evenodd",
7025
7073
  clipRule: "evenodd",
7026
- d: "M4 8C4 7.72386 4.22386 7.5 4.5 7.5H11.5C11.7761 7.5 12 7.72386 12 8C12 8.27614 11.7761 8.5 11.5 8.5H4.5C4.22386 8.5 4 8.27614 4 8Z",
7027
- fill: color
7074
+ 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",
7075
+ fill: color,
7076
+ stroke: "white",
7077
+ strokeWidth: "0.5",
7078
+ strokeLinecap: "round",
7079
+ strokeLinejoin: "round"
7028
7080
  })
7029
7081
  });
7030
7082
  };
@@ -7033,7 +7085,8 @@ var CheckboxIcon = function CheckboxIcon(_ref3) {
7033
7085
  var isChecked = _ref3.isChecked,
7034
7086
  isIndeterminate = _ref3.isIndeterminate,
7035
7087
  isDisabled = _ref3.isDisabled,
7036
- isNegative = _ref3.isNegative;
7088
+ isNegative = _ref3.isNegative,
7089
+ size = _ref3.size;
7037
7090
 
7038
7091
  var _useTheme = useTheme(),
7039
7092
  theme = _useTheme.theme;
@@ -7042,6 +7095,7 @@ var CheckboxIcon = function CheckboxIcon(_ref3) {
7042
7095
  var disabledIconColor = get_1(theme, 'colors.brand.gray.500');
7043
7096
  var iconColor = isDisabled ? disabledIconColor : defaultIconColor;
7044
7097
  return /*#__PURE__*/jsxs(CheckboxIconWrapper, {
7098
+ size: size,
7045
7099
  isIndeterminate: isIndeterminate,
7046
7100
  isDisabled: isDisabled,
7047
7101
  isNegative: isNegative,
@@ -7053,6 +7107,7 @@ var CheckboxIcon = function CheckboxIcon(_ref3) {
7053
7107
  display: 'flex'
7054
7108
  },
7055
7109
  children: /*#__PURE__*/jsx(IndeterminateIcon, {
7110
+ size: size,
7056
7111
  color: iconColor
7057
7112
  })
7058
7113
  }), /*#__PURE__*/jsx(Fade$1, {
@@ -7062,6 +7117,7 @@ var CheckboxIcon = function CheckboxIcon(_ref3) {
7062
7117
  display: 'flex'
7063
7118
  },
7064
7119
  children: isChecked ? /*#__PURE__*/jsx(CheckedIcon$1, {
7120
+ size: size,
7065
7121
  color: iconColor
7066
7122
  }) : null
7067
7123
  })]
@@ -7513,15 +7569,17 @@ var FormLabel = function FormLabel(_ref) {
7513
7569
  var StyledSelectorLabel = /*#__PURE__*/styled.label.withConfig({
7514
7570
  displayName: "SelectorLabelweb__StyledSelectorLabel",
7515
7571
  componentId: "sc-1yoi09a-0"
7516
- })({
7517
- display: 'flex',
7518
- // TODO: We don't have 2px spacing token
7519
- marginTop: makeSpace(2),
7520
- marginBottom: makeSpace(2)
7572
+ })(function (_ref) {
7573
+ var theme = _ref.theme;
7574
+ return {
7575
+ display: 'flex',
7576
+ marginTop: makeSpace(theme.spacing[1]),
7577
+ marginBottom: makeSpace(theme.spacing[1])
7578
+ };
7521
7579
  });
7522
7580
 
7523
- var SelectorLabel = function SelectorLabel(_ref) {
7524
- var children = _ref.children;
7581
+ var SelectorLabel = function SelectorLabel(_ref2) {
7582
+ var children = _ref2.children;
7525
7583
  return /*#__PURE__*/jsx(StyledSelectorLabel, {
7526
7584
  children: children
7527
7585
  });
@@ -7529,14 +7587,28 @@ var SelectorLabel = function SelectorLabel(_ref) {
7529
7587
 
7530
7588
  var SelectorTitle = function SelectorTitle(_ref) {
7531
7589
  var children = _ref.children,
7532
- isDisabled = _ref.isDisabled;
7533
- return /*#__PURE__*/jsx(BaseText, {
7534
- lineHeight: "l",
7535
- fontFamily: "text",
7536
- fontWeight: "regular",
7537
- color: isDisabled ? 'surface.text.placeholder.lowContrast' : 'surface.text.subtle.lowContrast',
7538
- fontSize: 100,
7539
- children: children
7590
+ isDisabled = _ref.isDisabled,
7591
+ _ref$size = _ref.size,
7592
+ size = _ref$size === void 0 ? 'medium' : _ref$size;
7593
+ var lineHeight = {
7594
+ small: 's',
7595
+ medium: 'l'
7596
+ };
7597
+ var fontSize = {
7598
+ small: 75,
7599
+ medium: 100
7600
+ };
7601
+ return /*#__PURE__*/jsxs(Fragment$1, {
7602
+ children: [/*#__PURE__*/jsx(Box, {
7603
+ marginLeft: "spacing.2"
7604
+ }), /*#__PURE__*/jsx(BaseText, {
7605
+ lineHeight: lineHeight[size],
7606
+ fontFamily: "text",
7607
+ fontWeight: "regular",
7608
+ fontSize: fontSize[size],
7609
+ color: isDisabled ? 'surface.text.placeholder.lowContrast' : 'surface.text.subtle.lowContrast',
7610
+ children: children
7611
+ })]
7540
7612
  });
7541
7613
  };
7542
7614
 
@@ -7559,11 +7631,15 @@ var SelectorSupportText = function SelectorSupportText(_ref) {
7559
7631
  function ownKeys$c(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7560
7632
 
7561
7633
  function _objectSpread$c(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys$c(Object(source), !0)).call(_context, function (key) { _defineProperty$1(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys$c(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
7562
- var variants$2 = {
7634
+ var variants = {
7563
7635
  "default": {
7564
7636
  background: {
7565
7637
  checked: 'colors.brand.primary.600',
7566
- unchecked: 'colors.brand.gray.400'
7638
+ unchecked: 'colors.brand.gray.a50'
7639
+ },
7640
+ border: {
7641
+ checked: 'colors.brand.primary.600',
7642
+ unchecked: 'colors.brand.gray.500'
7567
7643
  }
7568
7644
  }
7569
7645
  };
@@ -7575,9 +7651,10 @@ var getHoverStyles = function getHoverStyles(_ref) {
7575
7651
  isChecked = _ref.isChecked;
7576
7652
  if (isDisabled || isNegative) return {};
7577
7653
  var checked = isChecked ? 'checked' : 'unchecked';
7578
- var backgroundColor = variants$2["default"].background[checked];
7654
+ var backgroundColor = variants["default"].background[checked];
7655
+ var borderColor = variants["default"].border[checked];
7579
7656
  return {
7580
- borderColor: get_1(theme, backgroundColor),
7657
+ borderColor: get_1(theme, borderColor),
7581
7658
  backgroundColor: get_1(theme, backgroundColor),
7582
7659
  transitionTimingFunction: theme.motion.easing.standard.effective,
7583
7660
  transitionDuration: castWebType(makeMotionTime(theme.motion.duration['2xquick']))
@@ -7620,7 +7697,7 @@ var SelectorInput = function SelectorInput(_ref3) {
7620
7697
  };
7621
7698
 
7622
7699
  var Checkbox = function Checkbox(_ref) {
7623
- var _groupProps$state;
7700
+ var _groupProps$state, _groupProps$size;
7624
7701
 
7625
7702
  var defaultChecked = _ref.defaultChecked,
7626
7703
  validationState = _ref.validationState,
@@ -7633,7 +7710,9 @@ var Checkbox = function Checkbox(_ref) {
7633
7710
  value = _ref.value,
7634
7711
  children = _ref.children,
7635
7712
  helpText = _ref.helpText,
7636
- errorText = _ref.errorText;
7713
+ errorText = _ref.errorText,
7714
+ _ref$size = _ref.size,
7715
+ size = _ref$size === void 0 ? 'medium' : _ref$size;
7637
7716
  var groupProps = useCheckboxGroupContext(); // ban certain props in checkbox while inside group
7638
7717
 
7639
7718
  var hasValidationState = !isUndefined_1(validationState);
@@ -7663,9 +7742,12 @@ var Checkbox = function Checkbox(_ref) {
7663
7742
 
7664
7743
  var _name = name !== null && name !== void 0 ? name : groupProps === null || groupProps === void 0 ? void 0 : groupProps.name;
7665
7744
 
7666
- var _isChecked = isChecked !== null && isChecked !== void 0 ? isChecked : groupProps === null || groupProps === void 0 ? void 0 : (_groupProps$state = groupProps.state) === null || _groupProps$state === void 0 ? void 0 : _groupProps$state.isChecked(value); // only show error when the self validation is set to error
7667
- // Since we don't want to show errorText inside the group
7745
+ var _isChecked = isChecked !== null && isChecked !== void 0 ? isChecked : groupProps === null || groupProps === void 0 ? void 0 : (_groupProps$state = groupProps.state) === null || _groupProps$state === void 0 ? void 0 : _groupProps$state.isChecked(value);
7668
7746
 
7747
+ var _size = (_groupProps$size = groupProps.size) !== null && _groupProps$size !== void 0 ? _groupProps$size : size;
7748
+
7749
+ var isSmall = _size === 'small'; // only show error when the self validation is set to error
7750
+ // Since we don't want to show errorText inside the group
7669
7751
 
7670
7752
  var showSupportingText = validationState !== 'error' && helpText;
7671
7753
 
@@ -7723,16 +7805,18 @@ var Checkbox = function Checkbox(_ref) {
7723
7805
  isNegative: _hasError,
7724
7806
  inputProps: inputProps
7725
7807
  }), /*#__PURE__*/jsx(CheckboxIcon, {
7808
+ size: _size,
7726
7809
  isChecked: state.isChecked,
7727
7810
  isIndeterminate: isIndeterminate,
7728
7811
  isDisabled: _isDisabled,
7729
7812
  isNegative: _hasError
7730
7813
  }), /*#__PURE__*/jsx(SelectorTitle, {
7814
+ size: _size,
7731
7815
  isDisabled: _isDisabled,
7732
7816
  children: children
7733
7817
  })]
7734
7818
  }), /*#__PURE__*/jsx(Box, {
7735
- marginLeft: "spacing.7",
7819
+ marginLeft: isSmall ? 'spacing.6' : 'spacing.7',
7736
7820
  children: showSupportingText && /*#__PURE__*/jsx(SelectorSupportText, {
7737
7821
  id: ids === null || ids === void 0 ? void 0 : ids.helpTextId,
7738
7822
  children: helpText
@@ -7754,7 +7838,8 @@ var useCheckboxGroup = function useCheckboxGroup(_ref) {
7754
7838
  labelPosition = _ref.labelPosition,
7755
7839
  _onChange = _ref.onChange,
7756
7840
  validationState = _ref.validationState,
7757
- name = _ref.name;
7841
+ name = _ref.name,
7842
+ size = _ref.size;
7758
7843
 
7759
7844
  var _useTheme = useTheme(),
7760
7845
  platform = _useTheme.platform;
@@ -7833,9 +7918,10 @@ var useCheckboxGroup = function useCheckboxGroup(_ref) {
7833
7918
  isDisabled: isDisabled,
7834
7919
  labelPosition: platform === 'onMobile' ? 'top' : labelPosition,
7835
7920
  name: name,
7836
- state: state
7921
+ state: state,
7922
+ size: size
7837
7923
  };
7838
- }, [validationState, isDisabled, platform, labelPosition, name, state]);
7924
+ }, [validationState, isDisabled, platform, labelPosition, name, state, size]);
7839
7925
  return {
7840
7926
  state: state,
7841
7927
  contextValue: contextValue,
@@ -7871,7 +7957,7 @@ var SelectorGroupField = function SelectorGroupField(_ref) {
7871
7957
  };
7872
7958
 
7873
7959
  var CheckboxGroup = function CheckboxGroup(_ref) {
7874
- var _context;
7960
+ var _context, _context2;
7875
7961
 
7876
7962
  var children = _ref.children,
7877
7963
  label = _ref.label,
@@ -7886,7 +7972,9 @@ var CheckboxGroup = function CheckboxGroup(_ref) {
7886
7972
  name = _ref.name,
7887
7973
  defaultValue = _ref.defaultValue,
7888
7974
  onChange = _ref.onChange,
7889
- value = _ref.value;
7975
+ value = _ref.value,
7976
+ _ref$size = _ref.size,
7977
+ size = _ref$size === void 0 ? 'medium' : _ref$size;
7890
7978
 
7891
7979
  var _useCheckboxGroup = useCheckboxGroup({
7892
7980
  defaultValue: defaultValue,
@@ -7895,16 +7983,27 @@ var CheckboxGroup = function CheckboxGroup(_ref) {
7895
7983
  isDisabled: isDisabled,
7896
7984
  name: name,
7897
7985
  labelPosition: labelPosition,
7898
- validationState: validationState
7986
+ validationState: validationState,
7987
+ size: size
7899
7988
  }),
7900
7989
  contextValue = _useCheckboxGroup.contextValue,
7901
7990
  ids = _useCheckboxGroup.ids;
7902
7991
 
7992
+ var _useTheme = useTheme(),
7993
+ theme = _useTheme.theme;
7994
+
7903
7995
  var showError = validationState === 'error' && errorText;
7904
7996
  var showHelpText = !showError && helpText;
7905
7997
 
7906
7998
  var accessibilityText = _concatInstanceProperty(_context = ",".concat(showError ? errorText : '', " ")).call(_context, showHelpText ? helpText : '');
7907
7999
 
8000
+ var _useBreakpoint = useBreakpoint({
8001
+ breakpoints: theme.breakpoints
8002
+ }),
8003
+ matchedDeviceType = _useBreakpoint.matchedDeviceType;
8004
+
8005
+ var gap = checkboxSizes.group.gap[size][matchedDeviceType];
8006
+ var childCount = React__default.Children.count(children);
7908
8007
  return /*#__PURE__*/jsx(CheckboxGroupProvider, {
7909
8008
  value: contextValue,
7910
8009
  children: /*#__PURE__*/jsxs(SelectorGroupField, {
@@ -7921,8 +8020,12 @@ var CheckboxGroup = function CheckboxGroup(_ref) {
7921
8020
  children: [/*#__PURE__*/jsx(Box, {
7922
8021
  display: "flex",
7923
8022
  flexDirection: "column",
7924
- gap: 2,
7925
- children: children
8023
+ children: _mapInstanceProperty(_context2 = React__default.Children).call(_context2, children, function (child, index) {
8024
+ return /*#__PURE__*/jsx(Box, {
8025
+ marginBottom: index === childCount - 1 ? 0 : gap,
8026
+ children: child
8027
+ }, index);
8028
+ })
7926
8029
  }), /*#__PURE__*/jsx(FormHint, {
7927
8030
  errorText: errorText,
7928
8031
  helpText: helpText,
@@ -9696,67 +9799,110 @@ var useRadio = function useRadio(_ref) {
9696
9799
  };
9697
9800
  };
9698
9801
 
9699
- function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9700
-
9701
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys$1(Object(source), !0)).call(_context, function (key) { _defineProperty$1(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
9702
- var variants$1 = {
9703
- "default": {
9704
- border: {
9705
- checked: 'colors.brand.primary.500',
9706
- unchecked: 'colors.brand.gray.400'
9707
- },
9708
- background: {
9709
- checked: 'colors.brand.primary.500',
9710
- unchecked: 'colors.brand.gray.200'
9802
+ var radioSizes = {
9803
+ group: {
9804
+ gap: {
9805
+ small: {
9806
+ mobile: 'spacing.2',
9807
+ desktop: 'spacing.0'
9808
+ },
9809
+ medium: {
9810
+ mobile: 'spacing.3',
9811
+ desktop: 'spacing.2'
9812
+ }
9711
9813
  }
9712
9814
  },
9713
- disabled: {
9714
- border: {
9715
- checked: 'colors.brand.gray.300',
9716
- unchecked: 'colors.brand.gray.300'
9815
+ icon: {
9816
+ small: {
9817
+ width: 12,
9818
+ height: 12,
9819
+ dotRadius: 2
9717
9820
  },
9718
- background: {
9719
- checked: 'colors.brand.gray.300',
9720
- unchecked: 'colors.brand.gray.300'
9821
+ medium: {
9822
+ width: 16,
9823
+ height: 16,
9824
+ dotRadius: 3
9721
9825
  }
9722
- },
9723
- negative: {
9724
- border: {
9725
- checked: 'colors.feedback.border.negative.highContrast',
9726
- unchecked: 'colors.feedback.border.negative.highContrast'
9826
+ }
9827
+ };
9828
+ var radioIconColors = {
9829
+ variants: {
9830
+ "default": {
9831
+ dot: {
9832
+ checked: 'colors.brand.gray.200',
9833
+ unchecked: 'colors.brand.gray.200'
9834
+ },
9835
+ border: {
9836
+ checked: 'colors.brand.primary.500',
9837
+ unchecked: 'colors.brand.gray.500'
9838
+ },
9839
+ background: {
9840
+ checked: 'colors.brand.primary.500',
9841
+ unchecked: 'transparent'
9842
+ }
9727
9843
  },
9728
- background: {
9729
- checked: 'colors.feedback.background.negative.lowContrast',
9730
- unchecked: 'colors.feedback.background.negative.lowContrast'
9844
+ disabled: {
9845
+ dot: {
9846
+ checked: 'colors.brand.gray.200',
9847
+ unchecked: 'colors.brand.gray.200'
9848
+ },
9849
+ border: {
9850
+ checked: 'transparent',
9851
+ unchecked: 'colors.brand.gray.a100'
9852
+ },
9853
+ background: {
9854
+ checked: 'colors.brand.gray.a100',
9855
+ unchecked: 'transparent'
9856
+ }
9857
+ },
9858
+ negative: {
9859
+ dot: {
9860
+ checked: 'colors.brand.gray.200',
9861
+ unchecked: 'colors.brand.gray.200'
9862
+ },
9863
+ border: {
9864
+ checked: 'colors.feedback.border.negative.highContrast',
9865
+ unchecked: 'colors.feedback.border.negative.highContrast'
9866
+ },
9867
+ background: {
9868
+ checked: 'colors.feedback.background.negative.highContrast',
9869
+ unchecked: 'colors.feedback.background.negative.lowContrast'
9870
+ }
9731
9871
  }
9732
9872
  }
9733
9873
  };
9734
9874
 
9875
+ function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9876
+
9877
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys$1(Object(source), !0)).call(_context, function (key) { _defineProperty$1(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
9878
+
9735
9879
  var getRadioIconWrapperStyles = function getRadioIconWrapperStyles(_ref) {
9736
9880
  var theme = _ref.theme,
9737
9881
  isChecked = _ref.isChecked,
9738
9882
  isDisabled = _ref.isDisabled,
9739
- isNegative = _ref.isNegative;
9883
+ isNegative = _ref.isNegative,
9884
+ size = _ref.size;
9740
9885
  var isReactNative = getPlatformType() === 'react-native';
9741
9886
  var variant = 'default';
9742
9887
  if (isDisabled) variant = 'disabled';
9743
9888
  if (isNegative) variant = 'negative';
9744
9889
  var checked = isChecked ? 'checked' : 'unchecked';
9745
- var backgroundColor = variants$1[variant].background[checked];
9746
- var borderColor = variants$1[variant].border[checked];
9890
+ var background = radioIconColors.variants[variant].background[checked];
9891
+ var border = radioIconColors.variants[variant].border[checked];
9892
+ var backgroundColor = background === 'transparent' ? background : get_1(theme, background);
9893
+ var borderColor = border === 'transparent' ? border : get_1(theme, border);
9747
9894
  return _objectSpread$1({
9748
9895
  display: 'flex',
9749
9896
  alignItems: 'center',
9750
9897
  justifyContent: 'center',
9751
- width: '16px',
9752
- height: '16px',
9753
- borderWidth: makeBorderSize(theme.border.width.thin),
9898
+ width: makeSpace(radioSizes.icon[size].width),
9899
+ height: makeSpace(radioSizes.icon[size].height),
9900
+ borderWidth: makeBorderSize(theme.border.width.thick),
9754
9901
  borderStyle: 'solid',
9755
- margin: makeSpace(theme.spacing[0]),
9902
+ margin: makeSpace(theme.spacing[1]),
9756
9903
  borderRadius: makeSize(theme.border.radius.max),
9757
- marginRight: makeSpace(theme.spacing[3]),
9758
- backgroundColor: get_1(theme, backgroundColor),
9759
- borderColor: get_1(theme, borderColor)
9904
+ backgroundColor: backgroundColor,
9905
+ borderColor: borderColor
9760
9906
  }, !isReactNative && {
9761
9907
  transitionDuration: castWebType(makeMotionTime(theme.motion.duration.xquick)),
9762
9908
  transitionTimingFunction: castWebType(theme.motion.easing.exit.attentive)
@@ -9911,42 +10057,38 @@ var Circle = function Circle(_ref) {
9911
10057
  });
9912
10058
  };
9913
10059
 
9914
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
9915
-
9916
10060
  var CheckedIcon = function CheckedIcon(_ref) {
9917
- var color = _ref.color;
10061
+ var _context;
10062
+
10063
+ var color = _ref.color,
10064
+ size = _ref.size;
10065
+ var width = radioSizes.icon[size].width;
10066
+ var height = radioSizes.icon[size].height;
10067
+ var radius = radioSizes.icon[size].dotRadius;
10068
+
10069
+ var viewBox = _concatInstanceProperty(_context = "0 0 ".concat(width, " ")).call(_context, height);
10070
+
10071
+ var cx = "".concat(width / 2);
10072
+ var cy = "".concat(height / 2);
9918
10073
  return /*#__PURE__*/jsx(Svg, {
9919
- width: "16px",
9920
- height: "16px",
9921
- viewBox: "0 0 16 16",
10074
+ width: makeSpace(width),
10075
+ height: makeSpace(height),
10076
+ viewBox: viewBox,
9922
10077
  fill: "none",
9923
10078
  children: /*#__PURE__*/jsx(Circle, {
9924
- cx: "8",
9925
- cy: "8",
9926
- r: "4",
10079
+ cx: cx,
10080
+ cy: cy,
10081
+ r: "".concat(radius),
9927
10082
  fill: color
9928
10083
  })
9929
10084
  });
9930
10085
  };
9931
10086
 
9932
- // Radio icon center dot color
9933
- var variants = {
9934
- unchecked: {
9935
- "default": 'colors.brand.gray.200',
9936
- disabled: 'colors.brand.gray.300',
9937
- negative: 'colors.feedback.background.negative.lowContrast'
9938
- },
9939
- checked: {
9940
- "default": 'colors.brand.gray.200',
9941
- disabled: 'colors.brand.gray.400',
9942
- negative: 'colors.feedback.background.negative.highContrast'
9943
- }
9944
- };
9945
-
9946
10087
  var RadioIcon = function RadioIcon(_ref2) {
9947
10088
  var isChecked = _ref2.isChecked,
9948
10089
  isDisabled = _ref2.isDisabled,
9949
- isNegative = _ref2.isNegative;
10090
+ isNegative = _ref2.isNegative,
10091
+ size = _ref2.size;
9950
10092
 
9951
10093
  var _useTheme = useTheme(),
9952
10094
  theme = _useTheme.theme;
@@ -9956,8 +10098,9 @@ var RadioIcon = function RadioIcon(_ref2) {
9956
10098
  var variant = 'default';
9957
10099
  if (isDisabled) variant = 'disabled';
9958
10100
  if (isNegative) variant = 'negative';
9959
- var dotColor = get_1(theme, variants[state][variant]);
10101
+ var dotColor = get_1(theme, radioIconColors.variants[variant].dot[state]);
9960
10102
  return /*#__PURE__*/jsx(RadioIconWrapper, {
10103
+ size: size,
9961
10104
  isDisabled: isDisabled,
9962
10105
  isNegative: isNegative,
9963
10106
  isChecked: checked,
@@ -9968,6 +10111,7 @@ var RadioIcon = function RadioIcon(_ref2) {
9968
10111
  display: 'flex'
9969
10112
  },
9970
10113
  children: /*#__PURE__*/jsx(CheckedIcon, {
10114
+ size: size,
9971
10115
  color: dotColor
9972
10116
  })
9973
10117
  })
@@ -9986,12 +10130,14 @@ var useRadioGroupContext = function useRadioGroupContext() {
9986
10130
  /* eslint-disable @typescript-eslint/no-shadow */
9987
10131
 
9988
10132
  var Radio = function Radio(_ref) {
9989
- var _groupProps$state;
10133
+ var _groupProps$state, _groupProps$size;
9990
10134
 
9991
10135
  var value = _ref.value,
9992
10136
  children = _ref.children,
9993
10137
  helpText = _ref.helpText,
9994
- isDisabled = _ref.isDisabled;
10138
+ isDisabled = _ref.isDisabled,
10139
+ _ref$size = _ref.size,
10140
+ size = _ref$size === void 0 ? 'medium' : _ref$size;
9995
10141
  var groupProps = useRadioGroupContext();
9996
10142
  var isInsideGroup = !isEmpty_1(groupProps);
9997
10143
 
@@ -10010,6 +10156,10 @@ var Radio = function Radio(_ref) {
10010
10156
  var showHelpText = !hasError && helpText;
10011
10157
  var isReactNative = getPlatformType() === 'react-native';
10012
10158
 
10159
+ var _size = (_groupProps$size = groupProps.size) !== null && _groupProps$size !== void 0 ? _groupProps$size : size;
10160
+
10161
+ var isSmall = _size === 'small';
10162
+
10013
10163
  var handleChange = function handleChange(_ref2) {
10014
10164
  var isChecked = _ref2.isChecked,
10015
10165
  value = _ref2.value;
@@ -10050,19 +10200,22 @@ var Radio = function Radio(_ref) {
10050
10200
  flexDirection: "row",
10051
10201
  children: [/*#__PURE__*/jsx(SelectorInput, {
10052
10202
  isChecked: state.isChecked,
10053
- isDisabled: isDisabled,
10203
+ isDisabled: _isDisabled,
10054
10204
  isNegative: hasError // TODO: rename to hasError
10055
10205
  ,
10056
10206
  inputProps: inputProps
10057
10207
  }), /*#__PURE__*/jsx(RadioIcon, {
10208
+ size: _size,
10058
10209
  isChecked: state.isChecked,
10059
10210
  isDisabled: _isDisabled,
10060
10211
  isNegative: hasError
10061
10212
  }), /*#__PURE__*/jsx(SelectorTitle, {
10213
+ size: _size,
10214
+ isDisabled: _isDisabled,
10062
10215
  children: children
10063
10216
  })]
10064
10217
  }), /*#__PURE__*/jsx(Box, {
10065
- marginLeft: "spacing.7",
10218
+ marginLeft: isSmall ? 'spacing.6' : 'spacing.7',
10066
10219
  children: showHelpText && /*#__PURE__*/jsx(SelectorSupportText, {
10067
10220
  id: ids === null || ids === void 0 ? void 0 : ids.helpTextId,
10068
10221
  children: helpText
@@ -10080,7 +10233,8 @@ var useRadioGroup = function useRadioGroup(_ref) {
10080
10233
  _onChange = _ref.onChange,
10081
10234
  validationState = _ref.validationState,
10082
10235
  necessityIndicator = _ref.necessityIndicator,
10083
- name = _ref.name;
10236
+ name = _ref.name,
10237
+ size = _ref.size;
10084
10238
 
10085
10239
  var _useTheme = useTheme(),
10086
10240
  platform = _useTheme.platform;
@@ -10145,9 +10299,10 @@ var useRadioGroup = function useRadioGroup(_ref) {
10145
10299
  isDisabled: isDisabled,
10146
10300
  labelPosition: platform === 'onMobile' ? 'top' : labelPosition,
10147
10301
  name: fallbackName,
10148
- state: state
10302
+ state: state,
10303
+ size: size
10149
10304
  };
10150
- }, [validationState, isDisabled, platform, labelPosition, state, fallbackName, necessityIndicator]);
10305
+ }, [validationState, isDisabled, platform, labelPosition, state, fallbackName, necessityIndicator, size]);
10151
10306
  return {
10152
10307
  state: state,
10153
10308
  contextValue: contextValue,
@@ -10158,7 +10313,7 @@ var useRadioGroup = function useRadioGroup(_ref) {
10158
10313
  };
10159
10314
 
10160
10315
  var RadioGroup = function RadioGroup(_ref) {
10161
- var _context;
10316
+ var _context, _context2;
10162
10317
 
10163
10318
  var children = _ref.children,
10164
10319
  label = _ref.label,
@@ -10175,7 +10330,9 @@ var RadioGroup = function RadioGroup(_ref) {
10175
10330
  name = _ref.name,
10176
10331
  defaultValue = _ref.defaultValue,
10177
10332
  onChange = _ref.onChange,
10178
- value = _ref.value;
10333
+ value = _ref.value,
10334
+ _ref$size = _ref.size,
10335
+ size = _ref$size === void 0 ? 'medium' : _ref$size;
10179
10336
 
10180
10337
  var _useRadioGroup = useRadioGroup({
10181
10338
  defaultValue: defaultValue,
@@ -10184,17 +10341,28 @@ var RadioGroup = function RadioGroup(_ref) {
10184
10341
  name: name,
10185
10342
  onChange: onChange,
10186
10343
  validationState: validationState,
10187
- value: value
10344
+ value: value,
10345
+ size: size
10188
10346
  }),
10189
10347
  contextValue = _useRadioGroup.contextValue,
10190
10348
  ids = _useRadioGroup.ids;
10191
10349
 
10350
+ var _useTheme = useTheme(),
10351
+ theme = _useTheme.theme;
10352
+
10353
+ var _useBreakpoint = useBreakpoint({
10354
+ breakpoints: theme.breakpoints
10355
+ }),
10356
+ matchedDeviceType = _useBreakpoint.matchedDeviceType;
10357
+
10192
10358
  var showError = validationState === 'error' && errorText;
10193
10359
  var showHelpText = !showError && helpText;
10194
10360
 
10195
10361
  var accessibilityText = _concatInstanceProperty(_context = ",".concat(showError ? errorText : '', " ")).call(_context, showHelpText ? helpText : '');
10196
10362
 
10197
10363
  var isReactNative = getPlatformType() === 'react-native';
10364
+ var gap = radioSizes.group.gap[size][matchedDeviceType];
10365
+ var childCount = React__default.Children.count(children);
10198
10366
  return /*#__PURE__*/jsx(RadioGroupProvider, {
10199
10367
  value: contextValue,
10200
10368
  children: /*#__PURE__*/jsxs(SelectorGroupField, {
@@ -10212,8 +10380,12 @@ var RadioGroup = function RadioGroup(_ref) {
10212
10380
  children: [/*#__PURE__*/jsx(Box, {
10213
10381
  display: "flex",
10214
10382
  flexDirection: "column",
10215
- gap: 2,
10216
- children: children
10383
+ children: _mapInstanceProperty(_context2 = React__default.Children).call(_context2, children, function (child, index) {
10384
+ return /*#__PURE__*/jsx(Box, {
10385
+ marginBottom: index === childCount - 1 ? 0 : gap,
10386
+ children: child
10387
+ }, index);
10388
+ })
10217
10389
  }), /*#__PURE__*/jsx(FormHint, {
10218
10390
  type: validationState === 'error' ? 'error' : 'help',
10219
10391
  errorText: errorText,