@razorpay/blade 3.4.1 → 3.5.1

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