@popsure/dirty-swan 0.54.12 → 0.54.14
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/cjs/index.js +36 -13
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/autocompleteAddress/index.d.ts +3 -2
- package/dist/cjs/lib/components/autocompleteAddress/index.stories.d.ts +1 -1
- package/dist/cjs/lib/components/modal/genericModal/index.d.ts +1 -1
- package/dist/cjs/lib/components/modal/hooks/useOnClose.d.ts +1 -1
- package/dist/cjs/lib/components/modal/index.d.ts +1 -0
- package/dist/cjs/lib/components/modal/index.stories.d.ts +8 -1
- package/dist/esm/components/autocompleteAddress/index.js +8 -8
- package/dist/esm/components/autocompleteAddress/index.js.map +1 -1
- package/dist/esm/components/modal/genericModal/index.js +30 -7
- package/dist/esm/components/modal/genericModal/index.js.map +1 -1
- package/dist/esm/components/modal/index.stories.js +9 -2
- package/dist/esm/components/modal/index.stories.js.map +1 -1
- package/dist/esm/lib/components/autocompleteAddress/index.d.ts +3 -2
- package/dist/esm/lib/components/autocompleteAddress/index.stories.d.ts +1 -1
- package/dist/esm/lib/components/modal/genericModal/index.d.ts +1 -1
- package/dist/esm/lib/components/modal/hooks/useOnClose.d.ts +1 -1
- package/dist/esm/lib/components/modal/index.d.ts +1 -0
- package/dist/esm/lib/components/modal/index.stories.d.ts +8 -1
- package/package.json +1 -1
- package/src/lib/components/autocompleteAddress/index.tsx +4 -2
- package/src/lib/components/modal/genericModal/index.tsx +44 -14
- package/src/lib/components/modal/hooks/useOnClose.ts +1 -1
- package/src/lib/components/modal/index.stories.tsx +9 -0
- package/src/lib/components/modal/index.ts +1 -0
package/dist/cjs/index.js
CHANGED
|
@@ -5043,19 +5043,19 @@ var loadGoogleMapsApiDynamically = function (callback, apiKey) {
|
|
|
5043
5043
|
};
|
|
5044
5044
|
var AutocompleteAddress = function (_a) {
|
|
5045
5045
|
var _b;
|
|
5046
|
-
var apiKey = _a.apiKey, initialAddress = _a.address, onAddressChange = _a.onAddressChange, placeholders = _a.placeholders, manualAddressEntryTexts = _a.manualAddressEntryTexts, inputProps = _a.inputProps;
|
|
5047
|
-
var
|
|
5048
|
-
var
|
|
5046
|
+
var apiKey = _a.apiKey, initialAddress = _a.address, onAddressChange = _a.onAddressChange, placeholders = _a.placeholders, manualAddressEntryTexts = _a.manualAddressEntryTexts, inputProps = _a.inputProps, _c = _a.countryCode, countryCode = _c === void 0 ? GERMANY_ALPHA_CODE : _c;
|
|
5047
|
+
var _d = require$$0.useState(false), manualAddressEntry = _d[0], setManualAddressEntry = _d[1];
|
|
5048
|
+
var _e = require$$0.useState(false), isLoading = _e[0], setIsLoading = _e[1];
|
|
5049
5049
|
var autocomplete = require$$0.useRef(null);
|
|
5050
5050
|
var autocompleteElement = require$$0.useRef(null);
|
|
5051
5051
|
var map = require$$0.useRef(null);
|
|
5052
5052
|
var marker = require$$0.useRef(null);
|
|
5053
|
-
var
|
|
5054
|
-
var
|
|
5053
|
+
var _f = require$$0.useState(initialAddress), address = _f[0], setAddress = _f[1];
|
|
5054
|
+
var _g = require$$0.useState(window.google !== undefined), hasLoadedGoogleAPI = _g[0], setHasLoadedGoogleAPI = _g[1];
|
|
5055
5055
|
loadGoogleMapsApiDynamically(function () {
|
|
5056
5056
|
setHasLoadedGoogleAPI(true);
|
|
5057
5057
|
}, apiKey);
|
|
5058
|
-
var
|
|
5058
|
+
var _h = require$$0.useState(null), place = _h[0], setPlace = _h[1];
|
|
5059
5059
|
require$$0.useEffect(function () {
|
|
5060
5060
|
if (address) {
|
|
5061
5061
|
if (autocompleteElement.current && address.street) {
|
|
@@ -5071,7 +5071,7 @@ var AutocompleteAddress = function (_a) {
|
|
|
5071
5071
|
var reference = document.getElementById('autocomplete');
|
|
5072
5072
|
autocomplete.current = new google.maps.places.Autocomplete(reference, {
|
|
5073
5073
|
types: ['address'],
|
|
5074
|
-
componentRestrictions: { country:
|
|
5074
|
+
componentRestrictions: { country: countryCode },
|
|
5075
5075
|
});
|
|
5076
5076
|
autocomplete.current.addListener('place_changed', onPlaceChanged);
|
|
5077
5077
|
map.current = new google.maps.Map(document.getElementById('map'), MAP_CONFIG_OBJ);
|
|
@@ -5135,7 +5135,7 @@ var AutocompleteAddress = function (_a) {
|
|
|
5135
5135
|
var _b = _a === void 0 ? { updatePlace: true } : _a, updatePlace = _b.updatePlace;
|
|
5136
5136
|
return function (e) {
|
|
5137
5137
|
var _a;
|
|
5138
|
-
var newAddress = __assign(__assign({}, address), (_a = {}, _a[e.target.name] = e.target.value, _a.country =
|
|
5138
|
+
var newAddress = __assign(__assign({}, address), (_a = {}, _a[e.target.name] = e.target.value, _a.country = countryCode, _a));
|
|
5139
5139
|
setAddress(newAddress);
|
|
5140
5140
|
onAddressChange(newAddress);
|
|
5141
5141
|
if (updatePlace) {
|
|
@@ -8663,12 +8663,27 @@ var css_248z$u = "@keyframes style-module_fade-in__f_VRg {\n 0% {\n backgrou
|
|
|
8663
8663
|
var styles$t = {"overlay":"style-module_overlay__2f00R","fade-in":"style-module_fade-in__f_VRg","overlayClose":"style-module_overlayClose__1p313","fade-out":"style-module_fade-out__1tEwS","header":"style-module_header__284Rz","closeButton":"style-module_closeButton__1AbX8","body":"style-module_body__QtlTn","footer":"style-module_footer__Sh5bv"};
|
|
8664
8664
|
styleInject(css_248z$u);
|
|
8665
8665
|
|
|
8666
|
-
var
|
|
8666
|
+
var InnerModal = function (_a) {
|
|
8667
8667
|
var _b;
|
|
8668
8668
|
var _c, _d;
|
|
8669
|
-
var title = _a.title,
|
|
8670
|
-
var
|
|
8671
|
-
|
|
8669
|
+
var title = _a.title, children = _a.children, classNames = _a.classNames, _e = _a.dismissible, dismissible = _e === void 0 ? true : _e, footer = _a.footer, _f = _a.titleSize, titleSize = _f === void 0 ? 'default' : _f, isClosing = _a.isClosing, onModalScroll = _a.onModalScroll, handleContainerClick = _a.handleContainerClick, handleOnCloseAnimationEnded = _a.handleOnCloseAnimationEnded, handleOnClose = _a.handleOnClose, handleOnOverlayClick = _a.handleOnOverlayClick;
|
|
8670
|
+
var modalBodyRef = require$$0.useRef(null);
|
|
8671
|
+
require$$0.useEffect(function () {
|
|
8672
|
+
if (!modalBodyRef.current || !onModalScroll) {
|
|
8673
|
+
return;
|
|
8674
|
+
}
|
|
8675
|
+
var handleOnScroll = function () {
|
|
8676
|
+
if (modalBodyRef.current) {
|
|
8677
|
+
onModalScroll(modalBodyRef.current.scrollTop, modalBodyRef.current);
|
|
8678
|
+
}
|
|
8679
|
+
};
|
|
8680
|
+
modalBodyRef.current.addEventListener('scroll', handleOnScroll);
|
|
8681
|
+
return function () {
|
|
8682
|
+
var _a;
|
|
8683
|
+
(_a = modalBodyRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', handleOnScroll);
|
|
8684
|
+
};
|
|
8685
|
+
}, []);
|
|
8686
|
+
return (jsxRuntime.jsx("div", { className: classNames$1(classNames === null || classNames === void 0 ? void 0 : classNames.overlay, styles$t.overlay, (_b = {},
|
|
8672
8687
|
_b[styles$t.overlayClose] = isClosing,
|
|
8673
8688
|
_b)), onAnimationEnd: handleOnCloseAnimationEnded, onClick: handleOnOverlayClick, children: jsxRuntime.jsx("div", { className: typeof (classNames === null || classNames === void 0 ? void 0 : classNames.wrapper) === 'string'
|
|
8674
8689
|
? classNames === null || classNames === void 0 ? void 0 : classNames.wrapper
|
|
@@ -8677,7 +8692,15 @@ var GenericModal = function (_a) {
|
|
|
8677
8692
|
: (_d = classNames === null || classNames === void 0 ? void 0 : classNames.container) === null || _d === void 0 ? void 0 : _d.call(classNames, { isClosing: isClosing }), onClick: handleContainerClick, children: [jsxRuntime.jsxs("div", { className: classNames$1('bg-white d-flex ai-center w100 px24 pt24 pb16', styles$t.header, {
|
|
8678
8693
|
'jc-between': !!title,
|
|
8679
8694
|
'jc-end': !title,
|
|
8680
|
-
}), children: [title && (jsxRuntime.jsx("div", { className: classNames$1(styles$t.title, titleSize === 'small' ? 'p-h4' : 'p-h2'), children: title })), dismissible && (jsxRuntime.jsx(Button, { hideLabel: true, leftIcon: jsxRuntime.jsx(XIcon, { color: "grey-700" }), onClick: handleOnClose, type: "button", variant: "textColor", className: classNames$1(classNames === null || classNames === void 0 ? void 0 : classNames.closeButton, 'p0', styles$t.closeButton), children: "Close modal" }))] }), jsxRuntime.jsx("div", { className: classNames$1('w100', classNames === null || classNames === void 0 ? void 0 : classNames.body, styles$t.body), children: children }), footer && (jsxRuntime.jsx("div", { className: classNames$1(classNames === null || classNames === void 0 ? void 0 : classNames.footer, 'w100 bg-white', styles$t.footer), children: jsxRuntime.jsx("div", { className: "p24 pt16", children: footer }) }))] }) }) }));
|
|
8695
|
+
}), children: [title && (jsxRuntime.jsx("div", { className: classNames$1(styles$t.title, titleSize === 'small' ? 'p-h4' : 'p-h2'), children: title })), dismissible && (jsxRuntime.jsx(Button, { hideLabel: true, leftIcon: jsxRuntime.jsx(XIcon, { color: "grey-700" }), onClick: handleOnClose, type: "button", variant: "textColor", className: classNames$1(classNames === null || classNames === void 0 ? void 0 : classNames.closeButton, 'p0', styles$t.closeButton), children: "Close modal" }))] }), jsxRuntime.jsx("div", { className: classNames$1('w100', classNames === null || classNames === void 0 ? void 0 : classNames.body, styles$t.body), ref: modalBodyRef, children: children }), footer && (jsxRuntime.jsx("div", { className: classNames$1(classNames === null || classNames === void 0 ? void 0 : classNames.footer, 'w100 bg-white', styles$t.footer), children: jsxRuntime.jsx("div", { className: "p24 pt16", children: footer }) }))] }) }) }));
|
|
8696
|
+
};
|
|
8697
|
+
var GenericModal = function (props) {
|
|
8698
|
+
var isOpen = props.isOpen, onClose = props.onClose, _a = props.dismissible, dismissible = _a === void 0 ? true : _a;
|
|
8699
|
+
var _b = useOnClose(onClose, isOpen, dismissible), isVisible = _b.isVisible, rest = __rest$1(_b, ["isVisible"]);
|
|
8700
|
+
if (!isVisible) {
|
|
8701
|
+
return null;
|
|
8702
|
+
}
|
|
8703
|
+
return jsxRuntime.jsx(InnerModal, __assign({}, props, { isVisible: isVisible }, rest));
|
|
8681
8704
|
};
|
|
8682
8705
|
|
|
8683
8706
|
var BottomModal = function (_a) {
|