@popsure/dirty-swan 0.28.10 → 0.29.0

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.
Files changed (36) hide show
  1. package/dist/cjs/index.js +26 -7
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/lib/components/button/index.d.ts +1 -1
  4. package/dist/cjs/lib/components/modal/index.d.ts +1 -1
  5. package/dist/esm/components/button/index.js +1 -0
  6. package/dist/esm/components/button/index.js.map +1 -1
  7. package/dist/esm/components/comparisonTable/components/TableArrows/index.js +1 -1
  8. package/dist/esm/components/input/currency/index.js +15 -3
  9. package/dist/esm/components/input/currency/index.js.map +1 -1
  10. package/dist/esm/components/input/currency/index.test.js +90 -0
  11. package/dist/esm/components/input/currency/index.test.js.map +1 -1
  12. package/dist/esm/components/modal/bottomModal/index.js +6 -2
  13. package/dist/esm/components/modal/bottomModal/index.js.map +1 -1
  14. package/dist/esm/components/modal/bottomOrRegularModal/index.js +1 -0
  15. package/dist/esm/components/modal/bottomOrRegularModal/index.js.map +1 -1
  16. package/dist/esm/components/modal/regularModal/index.js +6 -2
  17. package/dist/esm/components/modal/regularModal/index.js.map +1 -1
  18. package/dist/esm/lib/components/button/index.d.ts +1 -1
  19. package/dist/esm/lib/components/modal/index.d.ts +1 -1
  20. package/dist/index.css +11 -8
  21. package/dist/index.css.map +1 -1
  22. package/dist/lib/scss/private/components/_buttons.scss +5 -0
  23. package/package.json +1 -1
  24. package/src/lib/components/button/index.stories.mdx +21 -0
  25. package/src/lib/components/button/index.tsx +7 -1
  26. package/src/lib/components/comparisonTable/components/TableArrows/style.module.scss +1 -1
  27. package/src/lib/components/comparisonTable/index.stories.mdx +10 -0
  28. package/src/lib/components/input/currency/index.test.tsx +52 -0
  29. package/src/lib/components/input/currency/index.tsx +17 -1
  30. package/src/lib/components/modal/bottomModal/index.tsx +5 -1
  31. package/src/lib/components/modal/bottomModal/style.module.scss +0 -1
  32. package/src/lib/components/modal/index.ts +1 -1
  33. package/src/lib/components/modal/regularModal/index.tsx +6 -2
  34. package/src/lib/components/modal/regularModal/style.module.scss +0 -1
  35. package/src/lib/scss/private/components/_buttons.scss +5 -0
  36. package/src/lib/scss/private/components/button.stories.mdx +16 -0
package/dist/cjs/index.js CHANGED
@@ -8613,6 +8613,7 @@ styleInject(css_248z$m);
8613
8613
  var buttonTypeClassNameMap = {
8614
8614
  primary: 'p-btn--primary',
8615
8615
  secondary: 'p-btn--secondary',
8616
+ secondaryGrey: 'p-btn--secondary-grey',
8616
8617
  outline: 'p-btn--outline',
8617
8618
  outlineGrey: 'p-btn--outline-grey',
8618
8619
  };
@@ -8692,7 +8693,9 @@ function reverseFormatInput(input) {
8692
8693
 
8693
8694
  var CurrencyInput = function (_a) {
8694
8695
  var value = _a.value, onChange = _a.onChange; _a.type; var props = __rest$1(_a, ["value", "onChange", "type"]);
8695
- var _b = require$$0.useState(''), shadowValue = _b[0], setShadowValue = _b[1];
8696
+ var inputRef = require$$0.useRef(null);
8697
+ var _b = require$$0.useState(null), cursor = _b[0], setCursor = _b[1];
8698
+ var _c = require$$0.useState(''), shadowValue = _c[0], setShadowValue = _c[1];
8696
8699
  var formattedShadowValue = formatInput(shadowValue
8697
8700
  .replace(/ /g, '') // remove all whitespace
8698
8701
  .replace(',', '.') // change commas to dot for decimal separator
@@ -8711,12 +8714,22 @@ var CurrencyInput = function (_a) {
8711
8714
  onChange === null || onChange === void 0 ? void 0 : onChange(reverseFormatInput(shadowValue));
8712
8715
  // eslint-disable-next-line
8713
8716
  }, [shadowValue]);
8714
- return (jsxRuntime.jsx(Input, __assign({ prefix: "\u20AC", type: "string", value: formattedShadowValue, onChange: function (e) {
8717
+ require$$0.useEffect(function () {
8718
+ if (!inputRef.current || !cursor) {
8719
+ return;
8720
+ }
8721
+ var cursorDiff = String(formattedShadowValue).length - String(shadowValue).length;
8722
+ var newCursor = cursorDiff + cursor;
8723
+ inputRef.current.selectionStart = newCursor;
8724
+ inputRef.current.selectionEnd = newCursor;
8725
+ }, [cursor, formattedShadowValue, shadowValue]);
8726
+ return (jsxRuntime.jsx(Input, __assign({ prefix: "\u20AC", ref: inputRef, type: "string", value: formattedShadowValue, onChange: function (e) {
8727
+ setCursor(e.target.selectionStart);
8715
8728
  setShadowValue(e.target.value);
8716
8729
  } }, props), void 0));
8717
8730
  };
8718
8731
 
8719
- var css_248z$k = "@keyframes style-module_fade-in__1GZgs {\n 0% {\n background-color: rgba(0, 0, 0, 0);\n }\n 100% {\n background-color: rgba(0, 0, 0, 0.3);\n }\n}\n@keyframes style-module_fade-out__30Bns {\n from {\n background-color: rgba(0, 0, 0, 0.3);\n }\n to {\n background-color: rgba(0, 0, 0, 0);\n }\n}\n@keyframes style-module_appear-in__3U2lu {\n 0% {\n transform: translateY(100%);\n }\n 80% {\n transform: translateY(-2%);\n }\n 100% {\n transform: translateY(0);\n }\n}\n@keyframes style-module_disappear-out__6pOVr {\n 0% {\n transform: translateY(0);\n }\n 100% {\n transform: translateY(100%);\n }\n}\n.style-module_close__1GERU {\n border: none;\n background-color: transparent;\n cursor: pointer;\n}\n\n.style-module_overlay__AlX2J, .style-module_overlay--close__3E9GY {\n position: fixed;\n z-index: 100;\n overflow: auto;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n animation: style-module_fade-in__1GZgs 0.3s both;\n}\n.style-module_overlay--close__3E9GY {\n animation-delay: 0.1s;\n animation: style-module_fade-out__30Bns 0.3s both;\n}\n\n.style-module_container__aOENo, .style-module_container--close__K506c {\n position: relative;\n background-color: white;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n width: 100%;\n animation-name: style-module_appear-in__3U2lu;\n animation-duration: 0.4s;\n animation-fill-mode: both;\n animation-timing-function: ease-out;\n top: 0;\n}\n.style-module_container--close__K506c {\n animation-name: style-module_disappear-out__6pOVr;\n animation-duration: 0.4s;\n animation-delay: 0s;\n animation-fill-mode: both;\n animation-timing-function: ease-out;\n}\n\n.style-module_header__10iiH {\n height: 60px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 16px;\n}";
8732
+ var css_248z$k = "@keyframes style-module_fade-in__1GZgs {\n 0% {\n background-color: rgba(0, 0, 0, 0);\n }\n 100% {\n background-color: rgba(0, 0, 0, 0.3);\n }\n}\n@keyframes style-module_fade-out__30Bns {\n from {\n background-color: rgba(0, 0, 0, 0.3);\n }\n to {\n background-color: rgba(0, 0, 0, 0);\n }\n}\n@keyframes style-module_appear-in__3U2lu {\n 0% {\n transform: translateY(100%);\n }\n 80% {\n transform: translateY(-2%);\n }\n 100% {\n transform: translateY(0);\n }\n}\n@keyframes style-module_disappear-out__6pOVr {\n 0% {\n transform: translateY(0);\n }\n 100% {\n transform: translateY(100%);\n }\n}\n.style-module_close__1GERU {\n border: none;\n background-color: transparent;\n cursor: pointer;\n}\n\n.style-module_overlay__AlX2J, .style-module_overlay--close__3E9GY {\n position: fixed;\n z-index: 100;\n overflow: auto;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n animation: style-module_fade-in__1GZgs 0.3s both;\n}\n.style-module_overlay--close__3E9GY {\n animation-delay: 0.1s;\n animation: style-module_fade-out__30Bns 0.3s both;\n}\n\n.style-module_container__aOENo, .style-module_container--close__K506c {\n position: relative;\n background-color: white;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n width: 100%;\n animation-name: style-module_appear-in__3U2lu;\n animation-duration: 0.4s;\n animation-fill-mode: both;\n animation-timing-function: ease-out;\n top: 0;\n}\n.style-module_container--close__K506c {\n animation-name: style-module_disappear-out__6pOVr;\n animation-duration: 0.4s;\n animation-delay: 0s;\n animation-fill-mode: both;\n animation-timing-function: ease-out;\n}\n\n.style-module_header__10iiH {\n height: 60px;\n display: flex;\n align-items: center;\n padding: 0 16px;\n}";
8720
8733
  var styles$j = {"close":"style-module_close__1GERU","overlay":"style-module_overlay__AlX2J","overlay--close":"style-module_overlay--close__3E9GY","fade-in":"style-module_fade-in__1GZgs","fade-out":"style-module_fade-out__30Bns","container":"style-module_container__aOENo","container--close":"style-module_container--close__K506c","appear-in":"style-module_appear-in__3U2lu","disappear-out":"style-module_disappear-out__6pOVr","header":"style-module_header__10iiH"};
8721
8734
  styleInject(css_248z$k);
8722
8735
 
@@ -8776,12 +8789,15 @@ var BottomModal = (function (_a) {
8776
8789
  if (!isOpen) {
8777
8790
  return jsxRuntime.jsx(jsxRuntime.Fragment, {}, void 0);
8778
8791
  }
8779
- return (jsxRuntime.jsx("div", __assign({ className: isClosing ? styles$j['overlay--close'] : styles$j.overlay, onClick: handleOnOverlayClick }, { children: jsxRuntime.jsxs("div", __assign({ className: (isClosing ? styles$j['container--close'] : styles$j.container) + " " + className, ref: containerRef, style: { top: containerXOffset + "px" }, onClick: handleContainerClick }, { children: [jsxRuntime.jsxs("div", __assign({ className: styles$j.header }, { children: [jsxRuntime.jsx("div", __assign({ className: "p-h4 " + styles$j.title }, { children: title }), void 0),
8792
+ return (jsxRuntime.jsx("div", __assign({ className: isClosing ? styles$j['overlay--close'] : styles$j.overlay, onClick: handleOnOverlayClick }, { children: jsxRuntime.jsxs("div", __assign({ className: (isClosing ? styles$j['container--close'] : styles$j.container) + " " + className, ref: containerRef, style: { top: containerXOffset + "px" }, onClick: handleContainerClick }, { children: [jsxRuntime.jsxs("div", __assign({ className: classNames(styles$j.header, {
8793
+ 'jc-between': !!title,
8794
+ 'jc-end': !title
8795
+ }) }, { children: [jsxRuntime.jsx("div", __assign({ className: "p-h4 " + styles$j.title }, { children: title }), void 0),
8780
8796
  dismissible && (jsxRuntime.jsx("button", __assign({ type: "button", className: styles$j.close, onClick: handleOnClose }, { children: jsxRuntime.jsx("img", { src: imageClose$1, alt: "Close" }, void 0) }), void 0))] }), void 0),
8781
8797
  jsxRuntime.jsx("div", __assign({ className: styles$j.content }, { children: children }), void 0)] }), void 0) }), void 0));
8782
8798
  });
8783
8799
 
8784
- var css_248z$j = "@keyframes style-module_fade-in__nLzzO {\n 0% {\n background-color: rgba(0, 0, 0, 0);\n visibility: hidden;\n }\n 100% {\n background-color: rgba(0, 0, 0, 0.3);\n visibility: visible;\n }\n}\n@keyframes style-module_fade-out__IuSV7 {\n from {\n background-color: rgba(0, 0, 0, 0.3);\n visibility: visible;\n }\n to {\n background-color: rgba(0, 0, 0, 0);\n visibility: hidden;\n }\n}\n@keyframes style-module_appear-in__2ZMqz {\n 0% {\n transform: translateY(24px);\n opacity: 0;\n visibility: hidden;\n }\n 100% {\n transform: translateY(0);\n opacity: 1;\n visibility: visible;\n }\n}\n@keyframes style-module_disappear-out__38TSV {\n 0% {\n transform: translateY(0);\n opacity: 1;\n visibility: visible;\n }\n 100% {\n transform: translateY(24px);\n opacity: 0;\n visibility: hidden;\n }\n}\n.style-module_overlay__1Zbce, .style-module_overlay--close__2dytn {\n position: fixed;\n z-index: 100;\n overflow: auto;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n animation: style-module_fade-in__nLzzO 0.3s both;\n}\n.style-module_overlay--close__2dytn {\n animation-delay: 0.1s;\n animation: style-module_fade-out__IuSV7 0.3s both;\n}\n\n.style-module_container__1XZj_, .style-module_container--close__3UYsJ {\n position: relative;\n display: flex;\n align-items: center;\n max-width: 592px;\n width: 100%;\n min-height: 100%;\n margin: 0 auto;\n animation-name: style-module_appear-in__2ZMqz;\n animation-duration: 0.4s;\n animation-fill-mode: both;\n animation-timing-function: ease-out;\n}\n.style-module_container--close__3UYsJ {\n animation-name: style-module_disappear-out__38TSV;\n animation-duration: 0.4s;\n animation-delay: 0s;\n animation-fill-mode: both;\n animation-timing-function: ease-out;\n}\n\n.style-module_body__lbUih {\n background-color: white;\n border-radius: 8px;\n margin: 80px auto;\n}\n\n.style-module_header__2oEKp {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 24px 24px 0 24px;\n}\n\n.style-module_close__p3Axi {\n border: none;\n background-color: transparent;\n cursor: pointer;\n}";
8800
+ var css_248z$j = "@keyframes style-module_fade-in__nLzzO {\n 0% {\n background-color: rgba(0, 0, 0, 0);\n visibility: hidden;\n }\n 100% {\n background-color: rgba(0, 0, 0, 0.3);\n visibility: visible;\n }\n}\n@keyframes style-module_fade-out__IuSV7 {\n from {\n background-color: rgba(0, 0, 0, 0.3);\n visibility: visible;\n }\n to {\n background-color: rgba(0, 0, 0, 0);\n visibility: hidden;\n }\n}\n@keyframes style-module_appear-in__2ZMqz {\n 0% {\n transform: translateY(24px);\n opacity: 0;\n visibility: hidden;\n }\n 100% {\n transform: translateY(0);\n opacity: 1;\n visibility: visible;\n }\n}\n@keyframes style-module_disappear-out__38TSV {\n 0% {\n transform: translateY(0);\n opacity: 1;\n visibility: visible;\n }\n 100% {\n transform: translateY(24px);\n opacity: 0;\n visibility: hidden;\n }\n}\n.style-module_overlay__1Zbce, .style-module_overlay--close__2dytn {\n position: fixed;\n z-index: 100;\n overflow: auto;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n animation: style-module_fade-in__nLzzO 0.3s both;\n}\n.style-module_overlay--close__2dytn {\n animation-delay: 0.1s;\n animation: style-module_fade-out__IuSV7 0.3s both;\n}\n\n.style-module_container__1XZj_, .style-module_container--close__3UYsJ {\n position: relative;\n display: flex;\n align-items: center;\n max-width: 592px;\n width: 100%;\n min-height: 100%;\n margin: 0 auto;\n animation-name: style-module_appear-in__2ZMqz;\n animation-duration: 0.4s;\n animation-fill-mode: both;\n animation-timing-function: ease-out;\n}\n.style-module_container--close__3UYsJ {\n animation-name: style-module_disappear-out__38TSV;\n animation-duration: 0.4s;\n animation-delay: 0s;\n animation-fill-mode: both;\n animation-timing-function: ease-out;\n}\n\n.style-module_body__lbUih {\n background-color: white;\n border-radius: 8px;\n margin: 80px auto;\n}\n\n.style-module_header__2oEKp {\n display: flex;\n align-items: center;\n padding: 24px 24px 0 24px;\n}\n\n.style-module_close__p3Axi {\n border: none;\n background-color: transparent;\n cursor: pointer;\n}";
8785
8801
  var styles$i = {"overlay":"style-module_overlay__1Zbce","overlay--close":"style-module_overlay--close__2dytn","fade-in":"style-module_fade-in__nLzzO","fade-out":"style-module_fade-out__IuSV7","container":"style-module_container__1XZj_","container--close":"style-module_container--close__3UYsJ","appear-in":"style-module_appear-in__2ZMqz","disappear-out":"style-module_disappear-out__38TSV","body":"style-module_body__lbUih","header":"style-module_header__2oEKp","close":"style-module_close__p3Axi"};
8786
8802
  styleInject(css_248z$j);
8787
8803
 
@@ -8793,7 +8809,10 @@ var RegularModal = (function (_a) {
8793
8809
  if (!isOpen) {
8794
8810
  return jsxRuntime.jsx(jsxRuntime.Fragment, {}, void 0);
8795
8811
  }
8796
- return (jsxRuntime.jsx("div", __assign({ className: isClosing ? styles$i['overlay--close'] : styles$i.overlay, onClick: handleOnOverlayClick }, { children: jsxRuntime.jsx("div", __assign({ className: (isClosing ? styles$i['container--close'] : styles$i.container) + " " + className }, { children: jsxRuntime.jsxs("div", __assign({ className: styles$i.body, onClick: handleContainerClick }, { children: [jsxRuntime.jsxs("div", __assign({ className: styles$i.header }, { children: [jsxRuntime.jsx("div", __assign({ className: "p-h2 " + styles$i.title }, { children: title }), void 0),
8812
+ return (jsxRuntime.jsx("div", __assign({ className: isClosing ? styles$i['overlay--close'] : styles$i.overlay, onClick: handleOnOverlayClick }, { children: jsxRuntime.jsx("div", __assign({ className: (isClosing ? styles$i['container--close'] : styles$i.container) + " " + className }, { children: jsxRuntime.jsxs("div", __assign({ className: styles$i.body, onClick: handleContainerClick }, { children: [jsxRuntime.jsxs("div", __assign({ className: classNames(styles$i.header, {
8813
+ 'jc-between': !!title,
8814
+ 'jc-end': !title
8815
+ }) }, { children: [title && jsxRuntime.jsx("div", __assign({ className: "p-h2 " + styles$i.title }, { children: title }), void 0),
8797
8816
  dismissible && (jsxRuntime.jsx("button", __assign({ type: "button", className: styles$i.close, onClick: handleOnClose }, { children: jsxRuntime.jsx("img", { src: imageClose, alt: "Close" }, void 0) }), void 0))] }), void 0), children] }), void 0) }), void 0) }), void 0));
8798
8817
  });
8799
8818
 
@@ -13647,7 +13666,7 @@ var ArrowIcon = function (_a) {
13647
13666
  return (jsxRuntime.jsx("svg", __assign({ width: "14", height: "8", viewBox: "0 0 14 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className }, { children: jsxRuntime.jsx("path", { d: "M1 1.00003L7 7.00003L13 1.00003", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, void 0) }), void 0));
13648
13667
  };
13649
13668
 
13650
- var css_248z$7 = ".style-module_container__3BxOi {\n position: absolute;\n width: 100%;\n height: 100%;\n padding: 0 16px;\n justify-content: space-between;\n align-items: center;\n z-index: 1;\n display: flex;\n}\n@media (min-width: 34rem) {\n .style-module_container__3BxOi {\n display: none;\n }\n}\n\n.style-module_next__3yJsi {\n transform: rotate(-90deg);\n}\n\n.style-module_prev__3rIR_ {\n transform: rotate(90deg);\n}\n\n.style-module_arrow__1tlbD {\n width: 32px;\n height: 32px;\n padding: 0;\n border-radius: 50%;\n background-color: #f5f5fa;\n justify-content: center;\n align-items: center;\n stroke: #e6e5ff;\n}\n.style-module_arrow__1tlbD:hover, .style-module_arrow__1tlbD:focus {\n background-color: #f5f5fa;\n cursor: not-allowed;\n}\n\n.style-module_active__2kklB {\n stroke: #8e8cee;\n}\n.style-module_active__2kklB:hover, .style-module_active__2kklB:focus {\n background-color: #f5f5fa;\n cursor: pointer;\n}";
13669
+ var css_248z$7 = ".style-module_container__3BxOi {\n position: absolute;\n width: 100%;\n height: 100%;\n padding: 0 16px;\n justify-content: space-between;\n align-items: center;\n display: flex;\n}\n@media (min-width: 34rem) {\n .style-module_container__3BxOi {\n display: none;\n }\n}\n\n.style-module_next__3yJsi {\n transform: rotate(-90deg);\n}\n\n.style-module_prev__3rIR_ {\n transform: rotate(90deg);\n}\n\n.style-module_arrow__1tlbD {\n width: 32px;\n height: 32px;\n z-index: 3;\n padding: 0;\n border-radius: 50%;\n background-color: #f5f5fa;\n justify-content: center;\n align-items: center;\n stroke: #e6e5ff;\n}\n.style-module_arrow__1tlbD:hover, .style-module_arrow__1tlbD:focus {\n background-color: #f5f5fa;\n cursor: not-allowed;\n}\n\n.style-module_active__2kklB {\n stroke: #8e8cee;\n}\n.style-module_active__2kklB:hover, .style-module_active__2kklB:focus {\n background-color: #f5f5fa;\n cursor: pointer;\n}";
13651
13670
  var styles$6 = {"container":"style-module_container__3BxOi","next":"style-module_next__3yJsi","prev":"style-module_prev__3rIR_","arrow":"style-module_arrow__1tlbD","active":"style-module_active__2kklB"};
13652
13671
  styleInject(css_248z$7);
13653
13672