@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 +54 -26
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +55 -27
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -9,7 +9,7 @@ import { accordionAnatomy, selectAnatomy } from '@chakra-ui/anatomy';
|
|
|
9
9
|
import template from 'lodash/template';
|
|
10
10
|
import cn from 'classnames';
|
|
11
11
|
import AsyncSelect from 'react-select/async';
|
|
12
|
-
import { motion } from 'framer-motion';
|
|
12
|
+
import { motion, AnimatePresence } from 'framer-motion';
|
|
13
13
|
import Creatable from 'react-select/creatable';
|
|
14
14
|
import { components as components$1 } from 'react-select';
|
|
15
15
|
|
|
@@ -997,18 +997,20 @@ Button$1.defaultProps = {
|
|
|
997
997
|
type: 'button'
|
|
998
998
|
};
|
|
999
999
|
|
|
1000
|
-
const _excluded$s = ["header", "children"];
|
|
1000
|
+
const _excluded$s = ["header", "drawerCloseButton", "children", "headerProps"];
|
|
1001
1001
|
const Drawer = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
1002
1002
|
let {
|
|
1003
1003
|
header,
|
|
1004
|
-
|
|
1004
|
+
drawerCloseButton,
|
|
1005
|
+
children,
|
|
1006
|
+
headerProps
|
|
1005
1007
|
} = _ref,
|
|
1006
1008
|
props = _objectWithoutProperties(_ref, _excluded$s);
|
|
1007
1009
|
return /*#__PURE__*/React__default.createElement(Drawer$1, _extends$6({
|
|
1008
1010
|
placement: "right"
|
|
1009
1011
|
}, props, {
|
|
1010
1012
|
ref: ref
|
|
1011
|
-
}), /*#__PURE__*/React__default.createElement(DrawerOverlay, null), /*#__PURE__*/React__default.createElement(DrawerContent, null, /*#__PURE__*/React__default.createElement(DrawerHeader,
|
|
1013
|
+
}), /*#__PURE__*/React__default.createElement(DrawerOverlay, null), /*#__PURE__*/React__default.createElement(DrawerContent, null, /*#__PURE__*/React__default.createElement(DrawerHeader, headerProps, header, drawerCloseButton || /*#__PURE__*/React__default.createElement(DrawerCloseButton, null)), children));
|
|
1012
1014
|
});
|
|
1013
1015
|
Drawer.propTypes = {
|
|
1014
1016
|
children: PropTypes.node.isRequired,
|
|
@@ -3814,7 +3816,7 @@ Select.propTypes = {
|
|
|
3814
3816
|
rightElementStyles: PropTypes.object
|
|
3815
3817
|
};
|
|
3816
3818
|
|
|
3817
|
-
const _excluded$8 = ["label", "helperText", "errorMessage", "isInvalid", "isDisabled", "isRequired", "rightElement", "leftElement", "rightElementStyles", "leftElementStyles", "buttonValue"];
|
|
3819
|
+
const _excluded$8 = ["label", "helperText", "errorMessage", "isInvalid", "isDisabled", "isRequired", "isHighlighted", "rightElement", "leftElement", "rightElementStyles", "leftElementStyles", "buttonValue"];
|
|
3818
3820
|
|
|
3819
3821
|
/**
|
|
3820
3822
|
* A component used in the homepage/midfunnel refresh of 2024
|
|
@@ -3831,6 +3833,7 @@ const Button = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
3831
3833
|
isInvalid,
|
|
3832
3834
|
isDisabled,
|
|
3833
3835
|
isRequired,
|
|
3836
|
+
isHighlighted,
|
|
3834
3837
|
rightElement,
|
|
3835
3838
|
leftElement,
|
|
3836
3839
|
rightElementStyles,
|
|
@@ -3864,10 +3867,13 @@ const Button = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
3864
3867
|
}, props, {
|
|
3865
3868
|
isDisabled: isDisabled,
|
|
3866
3869
|
color: isInvalid || !label ? 'gray.600' : 'black',
|
|
3867
|
-
borderColor: isInvalid ? 'error' : 'gray.200',
|
|
3870
|
+
borderColor: isInvalid ? 'error' : isHighlighted ? 'primary.default' : 'gray.200',
|
|
3868
3871
|
_focus: {
|
|
3869
3872
|
borderColor: isInvalid ? 'error' : 'primary.default'
|
|
3870
3873
|
},
|
|
3874
|
+
_hover: {
|
|
3875
|
+
borderColor: isHighlighted ? 'primary.default' : 'gray.300'
|
|
3876
|
+
},
|
|
3871
3877
|
paddingTop: label ? 'var(--chakra-sizes-5-5)' : '3',
|
|
3872
3878
|
textTransform: "none"
|
|
3873
3879
|
}), buttonValue));
|
|
@@ -4164,7 +4170,7 @@ RadioGroup.propTypes = {
|
|
|
4164
4170
|
direction: PropTypes.oneOf(['row', 'column'])
|
|
4165
4171
|
};
|
|
4166
4172
|
|
|
4167
|
-
const _excluded$5 = ["isChecked", "isDisabled", "value", "helperText", "expandableChildren", "defaultChecked", "isRadio", "label", "isExpandable", "size", "expandableChildrenStyles", "topChild"];
|
|
4173
|
+
const _excluded$5 = ["isChecked", "isDisabled", "value", "helperText", "expandableChildren", "defaultChecked", "isRadio", "label", "isExpandable", "size", "expandableChildrenStyles", "topChild", "expandableContentKey"];
|
|
4168
4174
|
const SelectionCard = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
4169
4175
|
let {
|
|
4170
4176
|
isChecked,
|
|
@@ -4178,15 +4184,23 @@ const SelectionCard = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
4178
4184
|
isExpandable,
|
|
4179
4185
|
size = 'md',
|
|
4180
4186
|
expandableChildrenStyles = {},
|
|
4181
|
-
topChild
|
|
4187
|
+
topChild,
|
|
4188
|
+
expandableContentKey = 'selection-card-content'
|
|
4182
4189
|
} = _ref,
|
|
4183
4190
|
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
4184
4191
|
const Component = isRadio ? Radio : Checkbox;
|
|
4185
4192
|
const expandableTextSize = size === 'sm' || size === 'md' ? 'xs' : 'sm';
|
|
4186
4193
|
const hasExpandableContent = isExpandable && isChecked && expandableChildren;
|
|
4187
4194
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
4195
|
+
|
|
4196
|
+
// Create a unique key based on the content to force re-animation
|
|
4197
|
+
const contentKey = React__default.useMemo(() => {
|
|
4198
|
+
if (typeof expandableChildren === 'string') {
|
|
4199
|
+
return expandableChildren;
|
|
4200
|
+
}
|
|
4201
|
+
return expandableContentKey || JSON.stringify(expandableChildren === null || expandableChildren === void 0 ? void 0 : expandableChildren.props) || Math.random();
|
|
4202
|
+
}, [expandableChildren, expandableContentKey]);
|
|
4188
4203
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
4189
|
-
paddingBottom: hasExpandableContent ? 3 : 0,
|
|
4190
4204
|
borderRadius: "lg",
|
|
4191
4205
|
borderColor: isChecked ? 'primary.default' : 'gray.medium',
|
|
4192
4206
|
borderWidth: "1px",
|
|
@@ -4209,21 +4223,34 @@ const SelectionCard = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
4209
4223
|
width: "100%",
|
|
4210
4224
|
paddingX: 4,
|
|
4211
4225
|
paddingY: 3
|
|
4212
|
-
}, props), label)), /*#__PURE__*/React__default.createElement(
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
,
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4226
|
+
}, props), label)), /*#__PURE__*/React__default.createElement(AnimatePresence, {
|
|
4227
|
+
mode: "wait"
|
|
4228
|
+
}, hasExpandableContent && /*#__PURE__*/React__default.createElement(Box, {
|
|
4229
|
+
as: motion.div,
|
|
4230
|
+
key: contentKey,
|
|
4231
|
+
initial: {
|
|
4232
|
+
height: 0,
|
|
4233
|
+
opacity: 0
|
|
4234
|
+
},
|
|
4235
|
+
animate: {
|
|
4236
|
+
height: 'auto',
|
|
4237
|
+
opacity: 1
|
|
4238
|
+
},
|
|
4239
|
+
exit: {
|
|
4240
|
+
height: 0,
|
|
4241
|
+
opacity: 0
|
|
4242
|
+
},
|
|
4243
|
+
transition: {
|
|
4244
|
+
duration: prefersReducedMotion ? 0 : 0.15,
|
|
4245
|
+
ease: 'easeOut'
|
|
4246
|
+
},
|
|
4221
4247
|
overflow: "hidden"
|
|
4222
|
-
},
|
|
4248
|
+
}, /*#__PURE__*/React__default.createElement(Box, _extends$6({
|
|
4223
4249
|
color: "gray.600",
|
|
4224
4250
|
fontSize: expandableTextSize,
|
|
4225
4251
|
paddingTop: 3,
|
|
4226
|
-
paddingX: 4
|
|
4252
|
+
paddingX: 4,
|
|
4253
|
+
paddingBottom: 3
|
|
4227
4254
|
}, expandableChildrenStyles), expandableChildren))));
|
|
4228
4255
|
});
|
|
4229
4256
|
SelectionCard.propTypes = {
|
|
@@ -4238,7 +4265,8 @@ SelectionCard.propTypes = {
|
|
|
4238
4265
|
isExpandable: PropTypes.bool,
|
|
4239
4266
|
expandableChildrenStyles: PropTypes.object,
|
|
4240
4267
|
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
4241
|
-
topChild: PropTypes.element
|
|
4268
|
+
topChild: PropTypes.element,
|
|
4269
|
+
expandableContentKey: PropTypes.string
|
|
4242
4270
|
};
|
|
4243
4271
|
|
|
4244
4272
|
const _excluded$4 = ["variant", "colorScheme"];
|
|
@@ -4623,14 +4651,16 @@ const ToggleButtonGroup = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
4623
4651
|
onChange,
|
|
4624
4652
|
value,
|
|
4625
4653
|
children,
|
|
4626
|
-
groupProps
|
|
4654
|
+
groupProps,
|
|
4655
|
+
buttonGroupStyles: _buttonGroupStyles = {},
|
|
4656
|
+
childrenStyles = {}
|
|
4627
4657
|
} = props;
|
|
4628
4658
|
if (!children) throw new Error('Children required');
|
|
4629
4659
|
|
|
4630
4660
|
// iterate over array of child nodes to apply extended props
|
|
4631
4661
|
return /*#__PURE__*/React__default.createElement(ButtonGroup, _extends$6({
|
|
4632
4662
|
ref: ref,
|
|
4633
|
-
sx: _objectSpread2({}, buttonGroupStyles)
|
|
4663
|
+
sx: _objectSpread2(_objectSpread2({}, buttonGroupStyles), _buttonGroupStyles)
|
|
4634
4664
|
}, groupProps), React__default.Children.map(children, CHILD => {
|
|
4635
4665
|
var _CHILD$props3;
|
|
4636
4666
|
return /*#__PURE__*/React__default.cloneElement(CHILD, _objectSpread2({
|
|
@@ -4639,10 +4669,8 @@ const ToggleButtonGroup = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
4639
4669
|
if (value === (CHILD === null || CHILD === void 0 || (_CHILD$props = CHILD.props) === null || _CHILD$props === void 0 ? void 0 : _CHILD$props.value)) return;
|
|
4640
4670
|
onChange(CHILD === null || CHILD === void 0 || (_CHILD$props2 = CHILD.props) === null || _CHILD$props2 === void 0 ? void 0 : _CHILD$props2.value);
|
|
4641
4671
|
}
|
|
4642
|
-
},
|
|
4643
|
-
sx: _objectSpread2(_objectSpread2({}, defaultStyles), inactiveStyles)
|
|
4644
|
-
} : {
|
|
4645
|
-
sx: _objectSpread2(_objectSpread2({}, defaultStyles), activeStyles)
|
|
4672
|
+
}, {
|
|
4673
|
+
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)
|
|
4646
4674
|
}));
|
|
4647
4675
|
}));
|
|
4648
4676
|
});
|