@spothero/ui 25.1.3 → 25.1.6

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/dist/index.cjs.js CHANGED
@@ -1025,18 +1025,20 @@ Button$1.defaultProps = {
1025
1025
  type: 'button'
1026
1026
  };
1027
1027
 
1028
- const _excluded$s = ["header", "children"];
1028
+ const _excluded$s = ["header", "drawerCloseButton", "children", "headerProps"];
1029
1029
  const Drawer = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1030
1030
  let {
1031
1031
  header,
1032
- children
1032
+ drawerCloseButton,
1033
+ children,
1034
+ headerProps
1033
1035
  } = _ref,
1034
1036
  props = _objectWithoutProperties(_ref, _excluded$s);
1035
1037
  return /*#__PURE__*/React__namespace.default.createElement(react.Drawer, _extends$6({
1036
1038
  placement: "right"
1037
1039
  }, props, {
1038
1040
  ref: ref
1039
- }), /*#__PURE__*/React__namespace.default.createElement(react.DrawerOverlay, null), /*#__PURE__*/React__namespace.default.createElement(react.DrawerContent, null, /*#__PURE__*/React__namespace.default.createElement(react.DrawerHeader, null, header, /*#__PURE__*/React__namespace.default.createElement(react.DrawerCloseButton, null)), children));
1041
+ }), /*#__PURE__*/React__namespace.default.createElement(react.DrawerOverlay, null), /*#__PURE__*/React__namespace.default.createElement(react.DrawerContent, null, /*#__PURE__*/React__namespace.default.createElement(react.DrawerHeader, headerProps, header, drawerCloseButton || /*#__PURE__*/React__namespace.default.createElement(react.DrawerCloseButton, null)), children));
1040
1042
  });
1041
1043
  Drawer.propTypes = {
1042
1044
  children: PropTypes__default.default.node.isRequired,
@@ -3842,7 +3844,7 @@ Select.propTypes = {
3842
3844
  rightElementStyles: PropTypes__default.default.object
3843
3845
  };
3844
3846
 
3845
- const _excluded$8 = ["label", "helperText", "errorMessage", "isInvalid", "isDisabled", "isRequired", "rightElement", "leftElement", "rightElementStyles", "leftElementStyles", "buttonValue"];
3847
+ const _excluded$8 = ["label", "helperText", "errorMessage", "isInvalid", "isDisabled", "isRequired", "isHighlighted", "rightElement", "leftElement", "rightElementStyles", "leftElementStyles", "buttonValue"];
3846
3848
 
3847
3849
  /**
3848
3850
  * A component used in the homepage/midfunnel refresh of 2024
@@ -3859,6 +3861,7 @@ const Button = /*#__PURE__*/React.forwardRef((_ref, ref) => {
3859
3861
  isInvalid,
3860
3862
  isDisabled,
3861
3863
  isRequired,
3864
+ isHighlighted,
3862
3865
  rightElement,
3863
3866
  leftElement,
3864
3867
  rightElementStyles,
@@ -3892,10 +3895,13 @@ const Button = /*#__PURE__*/React.forwardRef((_ref, ref) => {
3892
3895
  }, props, {
3893
3896
  isDisabled: isDisabled,
3894
3897
  color: isInvalid || !label ? 'gray.600' : 'black',
3895
- borderColor: isInvalid ? 'error' : 'gray.200',
3898
+ borderColor: isInvalid ? 'error' : isHighlighted ? 'primary.default' : 'gray.200',
3896
3899
  _focus: {
3897
3900
  borderColor: isInvalid ? 'error' : 'primary.default'
3898
3901
  },
3902
+ _hover: {
3903
+ borderColor: isHighlighted ? 'primary.default' : 'gray.300'
3904
+ },
3899
3905
  paddingTop: label ? 'var(--chakra-sizes-5-5)' : '3',
3900
3906
  textTransform: "none"
3901
3907
  }), buttonValue));
@@ -4192,7 +4198,7 @@ RadioGroup.propTypes = {
4192
4198
  direction: PropTypes__default.default.oneOf(['row', 'column'])
4193
4199
  };
4194
4200
 
4195
- const _excluded$5 = ["isChecked", "isDisabled", "value", "helperText", "expandableChildren", "defaultChecked", "isRadio", "label", "isExpandable", "size", "expandableChildrenStyles", "topChild"];
4201
+ const _excluded$5 = ["isChecked", "isDisabled", "value", "helperText", "expandableChildren", "defaultChecked", "isRadio", "label", "isExpandable", "size", "expandableChildrenStyles", "topChild", "expandableContentKey"];
4196
4202
  const SelectionCard = /*#__PURE__*/React.forwardRef((_ref, ref) => {
4197
4203
  let {
4198
4204
  isChecked,
@@ -4206,15 +4212,23 @@ const SelectionCard = /*#__PURE__*/React.forwardRef((_ref, ref) => {
4206
4212
  isExpandable,
4207
4213
  size = 'md',
4208
4214
  expandableChildrenStyles = {},
4209
- topChild
4215
+ topChild,
4216
+ expandableContentKey = 'selection-card-content'
4210
4217
  } = _ref,
4211
4218
  props = _objectWithoutProperties(_ref, _excluded$5);
4212
4219
  const Component = isRadio ? Radio : Checkbox;
4213
4220
  const expandableTextSize = size === 'sm' || size === 'md' ? 'xs' : 'sm';
4214
4221
  const hasExpandableContent = isExpandable && isChecked && expandableChildren;
4215
4222
  const prefersReducedMotion = react.usePrefersReducedMotion();
4223
+
4224
+ // Create a unique key based on the content to force re-animation
4225
+ const contentKey = React__namespace.default.useMemo(() => {
4226
+ if (typeof expandableChildren === 'string') {
4227
+ return expandableChildren;
4228
+ }
4229
+ return expandableContentKey || JSON.stringify(expandableChildren === null || expandableChildren === void 0 ? void 0 : expandableChildren.props) || Math.random();
4230
+ }, [expandableChildren, expandableContentKey]);
4216
4231
  return /*#__PURE__*/React__namespace.default.createElement(react.Box, {
4217
- paddingBottom: hasExpandableContent ? 3 : 0,
4218
4232
  borderRadius: "lg",
4219
4233
  borderColor: isChecked ? 'primary.default' : 'gray.medium',
4220
4234
  borderWidth: "1px",
@@ -4237,21 +4251,34 @@ const SelectionCard = /*#__PURE__*/React.forwardRef((_ref, ref) => {
4237
4251
  width: "100%",
4238
4252
  paddingX: 4,
4239
4253
  paddingY: 3
4240
- }, props), label)), /*#__PURE__*/React__namespace.default.createElement(react.Box, {
4241
- overflow: "hidden",
4242
- display: "grid"
4243
- // Using this as a pseudo height transition to get around no height auto transition
4244
- ,
4245
- gridTemplateRows: hasExpandableContent ? '1fr' : '0fr',
4246
- opacity: hasExpandableContent ? '100%' : '0%',
4247
- transition: prefersReducedMotion ? '' : 'all 150ms ease-out'
4248
- }, /*#__PURE__*/React__namespace.default.createElement(react.Box, {
4254
+ }, props), label)), /*#__PURE__*/React__namespace.default.createElement(framerMotion.AnimatePresence, {
4255
+ mode: "wait"
4256
+ }, hasExpandableContent && /*#__PURE__*/React__namespace.default.createElement(react.Box, {
4257
+ as: framerMotion.motion.div,
4258
+ key: contentKey,
4259
+ initial: {
4260
+ height: 0,
4261
+ opacity: 0
4262
+ },
4263
+ animate: {
4264
+ height: 'auto',
4265
+ opacity: 1
4266
+ },
4267
+ exit: {
4268
+ height: 0,
4269
+ opacity: 0
4270
+ },
4271
+ transition: {
4272
+ duration: prefersReducedMotion ? 0 : 0.15,
4273
+ ease: 'easeOut'
4274
+ },
4249
4275
  overflow: "hidden"
4250
- }, hasExpandableContent && /*#__PURE__*/React__namespace.default.createElement(react.Box, _extends$6({
4276
+ }, /*#__PURE__*/React__namespace.default.createElement(react.Box, _extends$6({
4251
4277
  color: "gray.600",
4252
4278
  fontSize: expandableTextSize,
4253
4279
  paddingTop: 3,
4254
- paddingX: 4
4280
+ paddingX: 4,
4281
+ paddingBottom: 3
4255
4282
  }, expandableChildrenStyles), expandableChildren))));
4256
4283
  });
4257
4284
  SelectionCard.propTypes = {
@@ -4266,7 +4293,8 @@ SelectionCard.propTypes = {
4266
4293
  isExpandable: PropTypes__default.default.bool,
4267
4294
  expandableChildrenStyles: PropTypes__default.default.object,
4268
4295
  size: PropTypes__default.default.oneOf(['sm', 'md', 'lg']),
4269
- topChild: PropTypes__default.default.element
4296
+ topChild: PropTypes__default.default.element,
4297
+ expandableContentKey: PropTypes__default.default.string
4270
4298
  };
4271
4299
 
4272
4300
  const _excluded$4 = ["variant", "colorScheme"];
@@ -4651,14 +4679,16 @@ const ToggleButtonGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
4651
4679
  onChange,
4652
4680
  value,
4653
4681
  children,
4654
- groupProps
4682
+ groupProps,
4683
+ buttonGroupStyles: _buttonGroupStyles = {},
4684
+ childrenStyles = {}
4655
4685
  } = props;
4656
4686
  if (!children) throw new Error('Children required');
4657
4687
 
4658
4688
  // iterate over array of child nodes to apply extended props
4659
4689
  return /*#__PURE__*/React__namespace.default.createElement(react.ButtonGroup, _extends$6({
4660
4690
  ref: ref,
4661
- sx: _objectSpread2({}, buttonGroupStyles)
4691
+ sx: _objectSpread2(_objectSpread2({}, buttonGroupStyles), _buttonGroupStyles)
4662
4692
  }, groupProps), React__namespace.default.Children.map(children, CHILD => {
4663
4693
  var _CHILD$props3;
4664
4694
  return /*#__PURE__*/React__namespace.default.cloneElement(CHILD, _objectSpread2({
@@ -4667,10 +4697,8 @@ const ToggleButtonGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
4667
4697
  if (value === (CHILD === null || CHILD === void 0 || (_CHILD$props = CHILD.props) === null || _CHILD$props === void 0 ? void 0 : _CHILD$props.value)) return;
4668
4698
  onChange(CHILD === null || CHILD === void 0 || (_CHILD$props2 = CHILD.props) === null || _CHILD$props2 === void 0 ? void 0 : _CHILD$props2.value);
4669
4699
  }
4670
- }, value !== (CHILD === null || CHILD === void 0 || (_CHILD$props3 = CHILD.props) === null || _CHILD$props3 === void 0 ? void 0 : _CHILD$props3.value) ? {
4671
- sx: _objectSpread2(_objectSpread2({}, defaultStyles), inactiveStyles)
4672
- } : {
4673
- sx: _objectSpread2(_objectSpread2({}, defaultStyles), activeStyles)
4700
+ }, {
4701
+ sx: _objectSpread2(_objectSpread2(_objectSpread2({}, defaultStyles), value !== (CHILD === null || CHILD === void 0 || (_CHILD$props3 = CHILD.props) === null || _CHILD$props3 === void 0 ? void 0 : _CHILD$props3.value) ? inactiveStyles : activeStyles), childrenStyles)
4674
4702
  }));
4675
4703
  }));
4676
4704
  });