@spothero/ui 18.0.0 → 18.0.4
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/components/Modal/Modal.js +4 -1
- package/dist/components/Modal/Modal.stories.js +32 -4
- package/dist/components/Modal/index.js +2 -3
- package/dist/components/Modal/styles/body.js +4 -4
- package/dist/components/Modal/styles/closeButton.js +3 -3
- package/dist/components/Modal/styles/dialog.js +17 -11
- package/dist/components/Modal/styles/header.js +3 -3
- package/dist/components/Modal/styles/index.js +1 -1
- package/dist/components/Modal/styles/overlay.js +1 -2
- package/dist/components/index.js +8 -1
- package/dist/theme/base/colors.js +3 -1
- package/package.json +3 -3
- package/dist/components/Modal/ModalHeader.js +0 -18
|
@@ -18,6 +18,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
18
18
|
* @param {()=>void} [onClose] - Callback invoked to close the Modal. Not required, but strongly suggested.
|
|
19
19
|
* @param {('sm'|'md'|'lg')} [size] - The size of the modal. If unspecified, uses "md" styles.
|
|
20
20
|
* @param {object} [contentStyling] - Style props to be passed into the modal content
|
|
21
|
+
* @param {boolean} [hasHeader] - Whether or not ModalHeader is a child. Will change the styling
|
|
22
|
+
* @param {boolean} [hasFooter] - Whether or not ModalFooter is a child. Will change the styling
|
|
21
23
|
* @param {React.ReactNode} [hideCloseButton] - Whether or not to show the close button
|
|
22
24
|
* @returns {React.ReactElement} - The Modal component
|
|
23
25
|
*/
|
|
@@ -26,13 +28,14 @@ const Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
26
28
|
children,
|
|
27
29
|
isMobile,
|
|
28
30
|
hideCloseButton,
|
|
31
|
+
hasHeader,
|
|
29
32
|
contentStyling = {}
|
|
30
33
|
} = props;
|
|
31
34
|
return /*#__PURE__*/_react.default.createElement(_react2.Modal, (0, _extends2.default)({
|
|
32
35
|
motionPreset: isMobile ? 'slideInBottom' : 'scale'
|
|
33
36
|
}, props, {
|
|
34
37
|
ref: ref
|
|
35
|
-
}), /*#__PURE__*/_react.default.createElement(_react2.ModalOverlay, null), /*#__PURE__*/_react.default.createElement(_react2.ModalContent, contentStyling, hideCloseButton ? null : /*#__PURE__*/_react.default.createElement(_react2.ModalCloseButton, null), children));
|
|
38
|
+
}), /*#__PURE__*/_react.default.createElement(_react2.ModalOverlay, null), /*#__PURE__*/_react.default.createElement(_react2.ModalContent, contentStyling, !hasHeader ? /*#__PURE__*/_react.default.createElement(_react2.Box, (0, _header.default)(props)) : null, hideCloseButton ? null : /*#__PURE__*/_react.default.createElement(_react2.ModalCloseButton, null), children));
|
|
36
39
|
});
|
|
37
40
|
var _default = Modal;
|
|
38
41
|
exports.default = _default;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.default = exports.TransactionalWithExpandingContent = exports.Transactional = exports.Passive = void 0;
|
|
7
|
+
exports.default = exports.TransactionalWithExpandingContent = exports.Transactional = exports.Passive = exports.NoHeader = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _react2 = require("@chakra-ui/react");
|
|
@@ -52,11 +52,13 @@ const Transactional = props => {
|
|
|
52
52
|
});
|
|
53
53
|
return /*#__PURE__*/_react.default.createElement(_react2.Box, null, /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
54
54
|
marginBottom: 2
|
|
55
|
-
}, "A \"Transactional\" modal just refers to one with a
|
|
55
|
+
}, "A \"Transactional\" modal just refers to one with a footer. Be sure to use the ", /*#__PURE__*/_react.default.createElement("code", null, "hasFooter"), " prop for the styling to be right when a ModalFooter is present. Same goes with ", /*#__PURE__*/_react.default.createElement("code", null, "hasHeader"), "."), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
56
56
|
onClick: () => setOpen(true)
|
|
57
57
|
}, "Open Modal"), /*#__PURE__*/_react.default.createElement(_index.Modal, (0, _extends2.default)({}, props, {
|
|
58
58
|
isMobile: isMobile,
|
|
59
59
|
isOpen: open,
|
|
60
|
+
hasHeader: true,
|
|
61
|
+
hasFooter: true,
|
|
60
62
|
onClose: () => setOpen(false)
|
|
61
63
|
}), /*#__PURE__*/_react.default.createElement(_index.ModalHeader, null, "Transactional"), /*#__PURE__*/_react.default.createElement(_index.ModalBody, null, props.children), /*#__PURE__*/_react.default.createElement(_index.ModalFooter, null, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
62
64
|
onClick: () => setOpen(false),
|
|
@@ -80,11 +82,13 @@ const Passive = props => {
|
|
|
80
82
|
});
|
|
81
83
|
return /*#__PURE__*/_react.default.createElement(_react2.Box, null, /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
82
84
|
marginBottom: 2
|
|
83
|
-
}, "A \"Passive\" modal just refers to one with no
|
|
85
|
+
}, "A \"Passive\" modal just refers to one with no footer."), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
84
86
|
onClick: () => setOpen(true)
|
|
85
87
|
}, "Open Modal"), /*#__PURE__*/_react.default.createElement(_index.Modal, (0, _extends2.default)({}, props, {
|
|
86
88
|
isMobile: isMobile,
|
|
87
89
|
isOpen: open,
|
|
90
|
+
hasHeader: true,
|
|
91
|
+
hasFooter: false,
|
|
88
92
|
onClose: () => setOpen(false)
|
|
89
93
|
}), /*#__PURE__*/_react.default.createElement(_index.ModalHeader, null, "Passive"), /*#__PURE__*/_react.default.createElement(_index.ModalBody, null, props.children)));
|
|
90
94
|
};
|
|
@@ -92,6 +96,28 @@ exports.Passive = Passive;
|
|
|
92
96
|
Passive.args = {
|
|
93
97
|
children: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent tincidunt lectus et mauris viverra, nec tincidunt arcu rhoncus. Duis pellentesque vestibulum orci ut mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis vel malesuada ligula. Cras dapibus enim sem. Suspendisse potenti. Mauris tempus non tortor eu placerat. Pellentesque faucibus dui vitae purus iaculis, ac convallis turpis gravida. Ut ac massa pretium, finibus quam vitae, aliquet libero. orci ut mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis vel malesuada ligula. Cras dapibus enim sem. Suspendisse potenti. Mauris tempus non tortor eu placerat. Pellentesque faucibus dui vitae purus iaculis, ac convallis turpis gravida. Ut ac massa pretium, finibus quam vitae, aliquet libero.'
|
|
94
98
|
};
|
|
99
|
+
const NoHeader = props => {
|
|
100
|
+
const [open, setOpen] = (0, _react.useState)(false);
|
|
101
|
+
const isMobile = (0, _react2.useBreakpointValue)({
|
|
102
|
+
base: true,
|
|
103
|
+
tablet: false
|
|
104
|
+
});
|
|
105
|
+
return /*#__PURE__*/_react.default.createElement(_react2.Box, null, /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
106
|
+
marginBottom: 2
|
|
107
|
+
}, "A modal with no header"), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
108
|
+
onClick: () => setOpen(true)
|
|
109
|
+
}, "Open Modal"), /*#__PURE__*/_react.default.createElement(_index.Modal, (0, _extends2.default)({}, props, {
|
|
110
|
+
isMobile: isMobile,
|
|
111
|
+
hasHeader: false,
|
|
112
|
+
hasFooter: false,
|
|
113
|
+
isOpen: open,
|
|
114
|
+
onClose: () => setOpen(false)
|
|
115
|
+
}), /*#__PURE__*/_react.default.createElement(_index.ModalBody, null, props.children)));
|
|
116
|
+
};
|
|
117
|
+
exports.NoHeader = NoHeader;
|
|
118
|
+
NoHeader.args = {
|
|
119
|
+
children: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent tincidunt lectus et mauris viverra, nec tincidunt arcu rhoncus. Duis pellentesque vestibulum orci ut mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis vel malesuada ligula. Cras dapibus enim sem. Suspendisse potenti. Mauris tempus non tortor eu placerat. Pellentesque faucibus dui vitae purus iaculis, ac convallis turpis gravida. Ut ac massa pretium, finibus quam vitae, aliquet libero. orci ut mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis vel malesuada ligula. Cras dapibus enim sem. Suspendisse potenti. Mauris tempus non tortor eu placerat. Pellentesque faucibus dui vitae purus iaculis, ac convallis turpis gravida. Ut ac massa pretium, finibus quam vitae, aliquet libero.'
|
|
120
|
+
};
|
|
95
121
|
const TransactionalWithExpandingContent = props => {
|
|
96
122
|
const [open, setOpen] = (0, _react.useState)(false);
|
|
97
123
|
const accordionRefs = [/*#__PURE__*/_react.default.createRef(), /*#__PURE__*/_react.default.createRef()];
|
|
@@ -120,6 +146,8 @@ const TransactionalWithExpandingContent = props => {
|
|
|
120
146
|
onClick: () => setOpen(true)
|
|
121
147
|
}, "Open Modal"), /*#__PURE__*/_react.default.createElement(_index.Modal, (0, _extends2.default)({}, props, {
|
|
122
148
|
isMobile: isMobile,
|
|
149
|
+
hasHeader: true,
|
|
150
|
+
hasFooter: true,
|
|
123
151
|
isOpen: open,
|
|
124
152
|
onClose: () => setOpen(false)
|
|
125
153
|
}), /*#__PURE__*/_react.default.createElement(_index.ModalHeader, null, "Transactional with Expanding Content"), /*#__PURE__*/_react.default.createElement(_index.ModalBody, null, /*#__PURE__*/_react.default.createElement(_react2.Box, null, /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
@@ -153,5 +181,5 @@ const TransactionalWithExpandingContent = props => {
|
|
|
153
181
|
};
|
|
154
182
|
exports.TransactionalWithExpandingContent = TransactionalWithExpandingContent;
|
|
155
183
|
TransactionalWithExpandingContent.argTypes = {
|
|
156
|
-
...(0, _disableArgs.default)(['children', '
|
|
184
|
+
...(0, _disableArgs.default)(['children', 'hasHeader', 'hasFooter'])
|
|
157
185
|
};
|
|
@@ -25,9 +25,8 @@ Object.defineProperty(exports, "ModalFooter", {
|
|
|
25
25
|
Object.defineProperty(exports, "ModalHeader", {
|
|
26
26
|
enumerable: true,
|
|
27
27
|
get: function () {
|
|
28
|
-
return
|
|
28
|
+
return _react.ModalHeader;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
var _react = require("@chakra-ui/react");
|
|
32
|
-
var _Modal = _interopRequireDefault(require("./Modal"));
|
|
33
|
-
var _ModalHeader = _interopRequireDefault(require("./ModalHeader"));
|
|
32
|
+
var _Modal = _interopRequireDefault(require("./Modal"));
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _default = _ref => {
|
|
8
8
|
let {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
hasFooter,
|
|
10
|
+
hasHeader,
|
|
11
11
|
hideCloseButton
|
|
12
12
|
} = _ref;
|
|
13
|
-
const scrollingHeaderStyles =
|
|
13
|
+
const scrollingHeaderStyles = hasHeader || !hideCloseButton ? {
|
|
14
14
|
// The following adapted from https://lea.verou.me/2012/04/background-attachment-local/
|
|
15
15
|
background: 'linear-gradient(white 30%, white), linear-gradient(rgb(0 0 0 / 10%) 0%, white)',
|
|
16
16
|
backgroundRepeat: 'no-repeat',
|
|
@@ -19,7 +19,7 @@ var _default = _ref => {
|
|
|
19
19
|
backgroundAttachment: 'local, scroll'
|
|
20
20
|
} : {};
|
|
21
21
|
return {
|
|
22
|
-
borderBottomRadius:
|
|
22
|
+
borderBottomRadius: hasFooter ? null : 'md',
|
|
23
23
|
paddingX: 4,
|
|
24
24
|
paddingBottom: 4,
|
|
25
25
|
flex: 1,
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _default = _ref => {
|
|
8
8
|
let {
|
|
9
|
-
|
|
9
|
+
hasHeader
|
|
10
10
|
} = _ref;
|
|
11
11
|
return {
|
|
12
12
|
position: 'absolute',
|
|
13
|
-
top:
|
|
14
|
-
insetEnd:
|
|
13
|
+
top: hasHeader ? 4 : 2,
|
|
14
|
+
insetEnd: hasHeader ? 4 : 2,
|
|
15
15
|
color: 'gray.dark',
|
|
16
16
|
borderRadius: 'sm',
|
|
17
17
|
width: 8,
|
|
@@ -4,16 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _default = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
var _default = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
hasFooter
|
|
10
|
+
} = _ref;
|
|
11
|
+
return {
|
|
12
|
+
borderRadius: 'md',
|
|
13
|
+
borderBottomRadius: {
|
|
14
|
+
base: '0',
|
|
15
|
+
tablet: 'md'
|
|
16
|
+
},
|
|
17
|
+
background: 'white',
|
|
18
|
+
color: 'inherit',
|
|
19
|
+
marginY: 0,
|
|
20
|
+
zIndex: 'layer8',
|
|
21
|
+
boxShadow: 'lg',
|
|
22
|
+
paddingBottom: hasFooter ? 0 : 4
|
|
23
|
+
};
|
|
18
24
|
};
|
|
19
25
|
exports.default = _default;
|
|
@@ -7,14 +7,14 @@ exports.default = void 0;
|
|
|
7
7
|
var _default = _ref => {
|
|
8
8
|
let {
|
|
9
9
|
hideCloseButton,
|
|
10
|
-
|
|
10
|
+
hasHeader
|
|
11
11
|
} = _ref;
|
|
12
12
|
return {
|
|
13
|
-
padding: !hideCloseButton ||
|
|
13
|
+
padding: !hideCloseButton || hasHeader ? 4 : 2,
|
|
14
14
|
fontSize: 'xl',
|
|
15
15
|
fontWeight: 'semibold',
|
|
16
16
|
// If just close button, still have 'header' section at top
|
|
17
|
-
minHeight:
|
|
17
|
+
minHeight: hasHeader || hideCloseButton ? null : 12
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
exports.default = _default;
|
|
@@ -15,10 +15,10 @@ var _closeButton = _interopRequireDefault(require("./closeButton"));
|
|
|
15
15
|
var _body = _interopRequireDefault(require("./body"));
|
|
16
16
|
var _footer = _interopRequireDefault(require("./footer"));
|
|
17
17
|
const baseStyle = props => ({
|
|
18
|
-
dialog: _dialog.default,
|
|
19
18
|
overlay: _overlay.default,
|
|
20
19
|
dialogContainer: _dialogContainer.default,
|
|
21
20
|
header: (0, _header.default)(props),
|
|
21
|
+
dialog: (0, _dialog.default)(props),
|
|
22
22
|
closeButton: (0, _closeButton.default)(props),
|
|
23
23
|
body: (0, _body.default)(props),
|
|
24
24
|
footer: _footer.default
|
package/dist/components/index.js
CHANGED
|
@@ -66,7 +66,8 @@ var _exportNames = {
|
|
|
66
66
|
useControllableProp: true,
|
|
67
67
|
BasicInput: true,
|
|
68
68
|
useControllableState: true,
|
|
69
|
-
usePrefersReducedMotion: true
|
|
69
|
+
usePrefersReducedMotion: true,
|
|
70
|
+
keyframes: true
|
|
70
71
|
};
|
|
71
72
|
Object.defineProperty(exports, "Alert", {
|
|
72
73
|
enumerable: true,
|
|
@@ -380,6 +381,12 @@ Object.defineProperty(exports, "createIcon", {
|
|
|
380
381
|
return _react.createIcon;
|
|
381
382
|
}
|
|
382
383
|
});
|
|
384
|
+
Object.defineProperty(exports, "keyframes", {
|
|
385
|
+
enumerable: true,
|
|
386
|
+
get: function () {
|
|
387
|
+
return _react.keyframes;
|
|
388
|
+
}
|
|
389
|
+
});
|
|
383
390
|
Object.defineProperty(exports, "useBreakpointValue", {
|
|
384
391
|
enumerable: true,
|
|
385
392
|
get: function () {
|
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
const white = '#ffffff';
|
|
8
8
|
const black = '#000000';
|
|
9
9
|
const brandBlue = '#0082ff';
|
|
10
|
+
const modalOverlay = '#21212160';
|
|
10
11
|
const gray = {
|
|
11
12
|
50: '#f6f7f9',
|
|
12
13
|
100: '#e1e6ec',
|
|
@@ -129,7 +130,8 @@ const colors = {
|
|
|
129
130
|
},
|
|
130
131
|
white,
|
|
131
132
|
black,
|
|
132
|
-
brandBlue
|
|
133
|
+
brandBlue,
|
|
134
|
+
modalOverlay
|
|
133
135
|
};
|
|
134
136
|
var _default = colors;
|
|
135
137
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spothero/ui",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.4",
|
|
4
4
|
"description": "SpotHero's React component UI library.",
|
|
5
5
|
"main": "./dist/components/index.js",
|
|
6
6
|
"exports": "./dist/components/index.js",
|
|
@@ -135,8 +135,8 @@
|
|
|
135
135
|
"classnames": "^2.2.6",
|
|
136
136
|
"lodash": "4.17.21",
|
|
137
137
|
"prop-types": "^15.7.2",
|
|
138
|
-
"react": "
|
|
139
|
-
"react-dom": "
|
|
138
|
+
"react": "17.0.2",
|
|
139
|
+
"react-dom": "17.0.2",
|
|
140
140
|
"react-redux": ">=7.0.0",
|
|
141
141
|
"redux": ">=4.0.0"
|
|
142
142
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _react2 = require("@chakra-ui/react");
|
|
10
|
-
const ModalHeader = _ref => {
|
|
11
|
-
let {
|
|
12
|
-
children,
|
|
13
|
-
...props
|
|
14
|
-
} = _ref;
|
|
15
|
-
return children ? /*#__PURE__*/_react.default.createElement(_react2.ModalHeader, props, children) : /*#__PURE__*/_react.default.createElement(Box, props);
|
|
16
|
-
};
|
|
17
|
-
var _default = ModalHeader;
|
|
18
|
-
exports.default = _default;
|