@spothero/ui 25.1.5 → 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
@@ -4198,7 +4198,7 @@ RadioGroup.propTypes = {
4198
4198
  direction: PropTypes__default.default.oneOf(['row', 'column'])
4199
4199
  };
4200
4200
 
4201
- 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"];
4202
4202
  const SelectionCard = /*#__PURE__*/React.forwardRef((_ref, ref) => {
4203
4203
  let {
4204
4204
  isChecked,
@@ -4212,15 +4212,23 @@ const SelectionCard = /*#__PURE__*/React.forwardRef((_ref, ref) => {
4212
4212
  isExpandable,
4213
4213
  size = 'md',
4214
4214
  expandableChildrenStyles = {},
4215
- topChild
4215
+ topChild,
4216
+ expandableContentKey = 'selection-card-content'
4216
4217
  } = _ref,
4217
4218
  props = _objectWithoutProperties(_ref, _excluded$5);
4218
4219
  const Component = isRadio ? Radio : Checkbox;
4219
4220
  const expandableTextSize = size === 'sm' || size === 'md' ? 'xs' : 'sm';
4220
4221
  const hasExpandableContent = isExpandable && isChecked && expandableChildren;
4221
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]);
4222
4231
  return /*#__PURE__*/React__namespace.default.createElement(react.Box, {
4223
- paddingBottom: hasExpandableContent ? 3 : 0,
4224
4232
  borderRadius: "lg",
4225
4233
  borderColor: isChecked ? 'primary.default' : 'gray.medium',
4226
4234
  borderWidth: "1px",
@@ -4243,21 +4251,34 @@ const SelectionCard = /*#__PURE__*/React.forwardRef((_ref, ref) => {
4243
4251
  width: "100%",
4244
4252
  paddingX: 4,
4245
4253
  paddingY: 3
4246
- }, props), label)), /*#__PURE__*/React__namespace.default.createElement(react.Box, {
4247
- overflow: "hidden",
4248
- display: "grid"
4249
- // Using this as a pseudo height transition to get around no height auto transition
4250
- ,
4251
- gridTemplateRows: hasExpandableContent ? '1fr' : '0fr',
4252
- opacity: hasExpandableContent ? '100%' : '0%',
4253
- transition: prefersReducedMotion ? '' : 'all 150ms ease-out'
4254
- }, /*#__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
+ },
4255
4275
  overflow: "hidden"
4256
- }, hasExpandableContent && /*#__PURE__*/React__namespace.default.createElement(react.Box, _extends$6({
4276
+ }, /*#__PURE__*/React__namespace.default.createElement(react.Box, _extends$6({
4257
4277
  color: "gray.600",
4258
4278
  fontSize: expandableTextSize,
4259
4279
  paddingTop: 3,
4260
- paddingX: 4
4280
+ paddingX: 4,
4281
+ paddingBottom: 3
4261
4282
  }, expandableChildrenStyles), expandableChildren))));
4262
4283
  });
4263
4284
  SelectionCard.propTypes = {
@@ -4272,7 +4293,8 @@ SelectionCard.propTypes = {
4272
4293
  isExpandable: PropTypes__default.default.bool,
4273
4294
  expandableChildrenStyles: PropTypes__default.default.object,
4274
4295
  size: PropTypes__default.default.oneOf(['sm', 'md', 'lg']),
4275
- topChild: PropTypes__default.default.element
4296
+ topChild: PropTypes__default.default.element,
4297
+ expandableContentKey: PropTypes__default.default.string
4276
4298
  };
4277
4299
 
4278
4300
  const _excluded$4 = ["variant", "colorScheme"];