@artsy/palette 18.10.0 → 18.11.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 (39) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/elements/Dialog/Dialog.d.ts +1 -1
  3. package/dist/elements/Dialog/Dialog.js +1 -1
  4. package/dist/elements/Dialog/Dialog.js.map +1 -1
  5. package/dist/elements/Modal/Modal.d.ts +1 -0
  6. package/dist/elements/Modal/Modal.js +7 -15
  7. package/dist/elements/Modal/Modal.js.map +1 -1
  8. package/dist/elements/Modal/ModalBase.d.ts +1 -1
  9. package/dist/elements/Modal/ModalBase.js.map +1 -1
  10. package/dist/elements/ModalDialog/ModalDialog.d.ts +5 -0
  11. package/dist/elements/ModalDialog/ModalDialog.js +79 -0
  12. package/dist/elements/ModalDialog/ModalDialog.js.map +1 -0
  13. package/dist/elements/ModalDialog/ModalDialog.story.d.ts +6 -0
  14. package/dist/elements/ModalDialog/ModalDialog.story.js +122 -0
  15. package/dist/elements/ModalDialog/ModalDialog.story.js.map +1 -0
  16. package/dist/elements/ModalDialog/ModalDialogContent.d.ts +10 -0
  17. package/dist/elements/ModalDialog/ModalDialogContent.js +106 -0
  18. package/dist/elements/ModalDialog/ModalDialogContent.js.map +1 -0
  19. package/dist/elements/ModalDialog/ModalDialogContent.story.d.ts +6 -0
  20. package/dist/elements/ModalDialog/ModalDialogContent.story.js +76 -0
  21. package/dist/elements/ModalDialog/ModalDialogContent.story.js.map +1 -0
  22. package/dist/elements/ModalDialog/index.d.ts +2 -0
  23. package/dist/elements/ModalDialog/index.js +32 -0
  24. package/dist/elements/ModalDialog/index.js.map +1 -0
  25. package/dist/elements/index.d.ts +1 -0
  26. package/dist/elements/index.js +13 -0
  27. package/dist/elements/index.js.map +1 -1
  28. package/dist/utils/index.d.ts +2 -0
  29. package/dist/utils/index.js +26 -0
  30. package/dist/utils/index.js.map +1 -1
  31. package/dist/utils/useDidMount.d.ts +1 -0
  32. package/dist/utils/{useOnScroll.js → useDidMount.js} +12 -33
  33. package/dist/utils/useDidMount.js.map +1 -0
  34. package/dist/utils/useSentinelVisibility.d.ts +8 -0
  35. package/dist/utils/useSentinelVisibility.js +72 -0
  36. package/dist/utils/useSentinelVisibility.js.map +1 -0
  37. package/package.json +2 -2
  38. package/dist/utils/useOnScroll.d.ts +0 -8
  39. package/dist/utils/useOnScroll.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ # v18.11.0 (Wed Dec 08 2021)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - feat(modaldialog): implements new modal [#1083](https://github.com/artsy/palette/pull/1083) ([@dzucconi](https://github.com/dzucconi))
6
+
7
+ #### 🐛 Bug Fix
8
+
9
+ - fix(modaldialog): addresses feedback ([@dzucconi](https://github.com/dzucconi))
10
+ - feat(modaldialog): implements transition ([@dzucconi](https://github.com/dzucconi))
11
+ - feat(modaldialog): implements new modal ([@dzucconi](https://github.com/dzucconi))
12
+
13
+ #### Authors: 1
14
+
15
+ - Damon ([@dzucconi](https://github.com/dzucconi))
16
+
17
+ ---
18
+
1
19
  # v18.10.0 (Tue Dec 07 2021)
2
20
 
3
21
  #### 🚀 Enhancement
@@ -13,7 +13,7 @@ interface DialogProps {
13
13
  }
14
14
  /**
15
15
  * Dialog.
16
- * Spec: https://app.zeplin.io/project/5acd19ff49a1429169c3128b/screen/5b9a7bdaa2fa5551fff7c014
16
+ * @deprecated: Use `ModalDialog` instead
17
17
  */
18
18
  export declare const Dialog: SFC<DialogProps>;
19
19
  export {};
@@ -23,7 +23,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
23
23
 
24
24
  /**
25
25
  * Dialog.
26
- * Spec: https://app.zeplin.io/project/5acd19ff49a1429169c3128b/screen/5b9a7bdaa2fa5551fff7c014
26
+ * @deprecated: Use `ModalDialog` instead
27
27
  */
28
28
  var Dialog = function Dialog(_ref) {
29
29
  var title = _ref.title,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/elements/Dialog/Dialog.tsx"],"names":["Dialog","title","detail","show","primaryCta","secondaryCta","onClose","StyledSans","Sans","ModalButton","props","ModalWidth","Narrow","action","text","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAgBA;AACA;AACA;AACA;AACO,IAAMA,MAAwB,GAAG,SAA3BA,MAA2B,OAOlC;AAAA,MANJC,KAMI,QANJA,KAMI;AAAA,MALJC,MAKI,QALJA,MAKI;AAAA,uBAJJC,IAII;AAAA,MAJJA,IAII,0BAJG,IAIH;AAAA,MAHJC,UAGI,QAHJA,UAGI;AAAA,MAFJC,YAEI,QAFJA,YAEI;AAAA,0BADJC,OACI;AAAA,MADJA,OACI,6BADM;AAAA,WAAM,IAAN;AAAA,GACN;AACJ,MAAMC,UAAU,GAAG,+BAAOC,gBAAP,CAAH;AAAA;AAAA;AAAA,iEAGL,oBAAM,WAAN,CAHK,CAAhB;;AAMA,MAAMC,WAGJ,GAAG,SAHCA,WAGD,CAACC,KAAD,EAAW;AACd,wBAAO,6BAAC,UAAD;AAAY,MAAA,EAAE,EAAE,CAAhB;AAAmB,MAAA,IAAI,EAAC,GAAxB;AAA4B,MAAA,MAAM,EAAC;AAAnC,OAAgDA,KAAhD,EAAP;AACD,GALD;;AAOA,sBACE,6BAAC,YAAD;AACE,IAAA,IAAI,EAAEP,IADR;AAEE,IAAA,OAAO,EAAEG,OAFX;AAGE,IAAA,UAAU,EAAEK,kBAAWC,MAHzB;AAIE,IAAA,eAAe;AAJjB,kBAME,yEACE,6BAAC,UAAD;AAAM,IAAA,aAAa,EAAC;AAApB,kBACE,6BAAC,gBAAD;AAAM,IAAA,IAAI,EAAC,GAAX;AAAe,IAAA,MAAM,EAAC,QAAtB;AAA+B,IAAA,EAAE,EAAE;AAAnC,KACGX,KADH,CADF,EAIGC,MAAM,iBACL,6BAAC,gBAAD;AAAM,IAAA,IAAI,EAAC,GAAX;AAAe,IAAA,KAAK,EAAC;AAArB,KACGA,MADH,CALJ,CADF,eAWE,6BAAC,UAAD;AAAM,IAAA,EAAE,EAAE,CAAV;AAAa,IAAA,cAAc,EAAC;AAA5B,KACGG,YAAY,iBACX,6BAAC,WAAD;AAAa,IAAA,SAAS,MAAtB;AAAuB,IAAA,OAAO,EAAEA,YAAY,CAACQ;AAA7C,KACGR,YAAY,CAACS,IADhB,CAFJ,eAME,6BAAC,WAAD;AAAa,IAAA,OAAO,EAAEV,UAAU,CAACS;AAAjC,KACGT,UAAU,CAACU,IADd,CANF,CAXF,CANF,CADF;AA+BD,CApDM;;;AAAMd,M;AAsDbA,MAAM,CAACe,WAAP,GAAqB,QAArB","sourcesContent":["import React, { SFC } from \"react\"\nimport styled from \"styled-components\"\nimport { color } from \"../../helpers\"\nimport { Flex } from \"../Flex\"\nimport { Modal, ModalWidth } from \"../Modal\"\nimport { Sans } from \"../Typography\"\n\ninterface CtaProps {\n action(): void\n text: React.ReactNode\n}\n\ninterface DialogProps {\n detail?: React.ReactNode\n primaryCta: CtaProps\n secondaryCta?: CtaProps\n onClose?: () => void\n show?: boolean\n title: string\n}\n\n/**\n * Dialog.\n * Spec: https://app.zeplin.io/project/5acd19ff49a1429169c3128b/screen/5b9a7bdaa2fa5551fff7c014\n */\nexport const Dialog: SFC<DialogProps> = ({\n title,\n detail,\n show = true,\n primaryCta,\n secondaryCta,\n onClose = () => null,\n}) => {\n const StyledSans = styled(Sans)`\n transition: color 0.14s ease;\n cursor: pointer;\n color: ${color(\"purple100\")};\n `\n\n const ModalButton: React.FC<{\n secondary?: boolean\n onClick: () => void\n }> = (props) => {\n return <StyledSans pl={4} size=\"3\" weight=\"medium\" {...props} />\n }\n\n return (\n <Modal\n show={show}\n onClose={onClose}\n modalWidth={ModalWidth.Narrow}\n hideCloseButton\n >\n <>\n <Flex flexDirection=\"column\">\n <Sans size=\"4\" weight=\"medium\" mb={10}>\n {title}\n </Sans>\n {detail && (\n <Sans size=\"3\" color=\"black60\">\n {detail}\n </Sans>\n )}\n </Flex>\n <Flex mt={3} justifyContent=\"flex-end\">\n {secondaryCta && (\n <ModalButton secondary onClick={secondaryCta.action}>\n {secondaryCta.text}\n </ModalButton>\n )}\n <ModalButton onClick={primaryCta.action}>\n {primaryCta.text}\n </ModalButton>\n </Flex>\n </>\n </Modal>\n )\n}\n\nDialog.displayName = \"Dialog\"\n"],"file":"Dialog.js"}
1
+ {"version":3,"sources":["../../../src/elements/Dialog/Dialog.tsx"],"names":["Dialog","title","detail","show","primaryCta","secondaryCta","onClose","StyledSans","Sans","ModalButton","props","ModalWidth","Narrow","action","text","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAgBA;AACA;AACA;AACA;AACO,IAAMA,MAAwB,GAAG,SAA3BA,MAA2B,OAOlC;AAAA,MANJC,KAMI,QANJA,KAMI;AAAA,MALJC,MAKI,QALJA,MAKI;AAAA,uBAJJC,IAII;AAAA,MAJJA,IAII,0BAJG,IAIH;AAAA,MAHJC,UAGI,QAHJA,UAGI;AAAA,MAFJC,YAEI,QAFJA,YAEI;AAAA,0BADJC,OACI;AAAA,MADJA,OACI,6BADM;AAAA,WAAM,IAAN;AAAA,GACN;AACJ,MAAMC,UAAU,GAAG,+BAAOC,gBAAP,CAAH;AAAA;AAAA;AAAA,iEAGL,oBAAM,WAAN,CAHK,CAAhB;;AAMA,MAAMC,WAGJ,GAAG,SAHCA,WAGD,CAACC,KAAD,EAAW;AACd,wBAAO,6BAAC,UAAD;AAAY,MAAA,EAAE,EAAE,CAAhB;AAAmB,MAAA,IAAI,EAAC,GAAxB;AAA4B,MAAA,MAAM,EAAC;AAAnC,OAAgDA,KAAhD,EAAP;AACD,GALD;;AAOA,sBACE,6BAAC,YAAD;AACE,IAAA,IAAI,EAAEP,IADR;AAEE,IAAA,OAAO,EAAEG,OAFX;AAGE,IAAA,UAAU,EAAEK,kBAAWC,MAHzB;AAIE,IAAA,eAAe;AAJjB,kBAME,yEACE,6BAAC,UAAD;AAAM,IAAA,aAAa,EAAC;AAApB,kBACE,6BAAC,gBAAD;AAAM,IAAA,IAAI,EAAC,GAAX;AAAe,IAAA,MAAM,EAAC,QAAtB;AAA+B,IAAA,EAAE,EAAE;AAAnC,KACGX,KADH,CADF,EAIGC,MAAM,iBACL,6BAAC,gBAAD;AAAM,IAAA,IAAI,EAAC,GAAX;AAAe,IAAA,KAAK,EAAC;AAArB,KACGA,MADH,CALJ,CADF,eAWE,6BAAC,UAAD;AAAM,IAAA,EAAE,EAAE,CAAV;AAAa,IAAA,cAAc,EAAC;AAA5B,KACGG,YAAY,iBACX,6BAAC,WAAD;AAAa,IAAA,SAAS,MAAtB;AAAuB,IAAA,OAAO,EAAEA,YAAY,CAACQ;AAA7C,KACGR,YAAY,CAACS,IADhB,CAFJ,eAME,6BAAC,WAAD;AAAa,IAAA,OAAO,EAAEV,UAAU,CAACS;AAAjC,KACGT,UAAU,CAACU,IADd,CANF,CAXF,CANF,CADF;AA+BD,CApDM;;;AAAMd,M;AAsDbA,MAAM,CAACe,WAAP,GAAqB,QAArB","sourcesContent":["import React, { SFC } from \"react\"\nimport styled from \"styled-components\"\nimport { color } from \"../../helpers\"\nimport { Flex } from \"../Flex\"\nimport { Modal, ModalWidth } from \"../Modal\"\nimport { Sans } from \"../Typography\"\n\ninterface CtaProps {\n action(): void\n text: React.ReactNode\n}\n\ninterface DialogProps {\n detail?: React.ReactNode\n primaryCta: CtaProps\n secondaryCta?: CtaProps\n onClose?: () => void\n show?: boolean\n title: string\n}\n\n/**\n * Dialog.\n * @deprecated: Use `ModalDialog` instead\n */\nexport const Dialog: SFC<DialogProps> = ({\n title,\n detail,\n show = true,\n primaryCta,\n secondaryCta,\n onClose = () => null,\n}) => {\n const StyledSans = styled(Sans)`\n transition: color 0.14s ease;\n cursor: pointer;\n color: ${color(\"purple100\")};\n `\n\n const ModalButton: React.FC<{\n secondary?: boolean\n onClick: () => void\n }> = (props) => {\n return <StyledSans pl={4} size=\"3\" weight=\"medium\" {...props} />\n }\n\n return (\n <Modal\n show={show}\n onClose={onClose}\n modalWidth={ModalWidth.Narrow}\n hideCloseButton\n >\n <>\n <Flex flexDirection=\"column\">\n <Sans size=\"4\" weight=\"medium\" mb={10}>\n {title}\n </Sans>\n {detail && (\n <Sans size=\"3\" color=\"black60\">\n {detail}\n </Sans>\n )}\n </Flex>\n <Flex mt={3} justifyContent=\"flex-end\">\n {secondaryCta && (\n <ModalButton secondary onClick={secondaryCta.action}>\n {secondaryCta.text}\n </ModalButton>\n )}\n <ModalButton onClick={primaryCta.action}>\n {primaryCta.text}\n </ModalButton>\n </Flex>\n </>\n </Modal>\n )\n}\n\nDialog.displayName = \"Dialog\"\n"],"file":"Dialog.js"}
@@ -22,6 +22,7 @@ export declare enum ModalWidth {
22
22
  /**
23
23
  * Modal.
24
24
  * Spec: https://www.figma.com/file/m6gDpKHEWDbYJyrwsVZDBr/Artsy-3.0-Design-System?node-id=6150%3A7290
25
+ * @deprecated: Use `ModalDialog` instead
25
26
  */
26
27
  export declare const Modal: FC<ModalProps>;
27
28
  export {};
@@ -29,7 +29,7 @@ var _Spacer = require("../Spacer");
29
29
 
30
30
  var _Text = require("../Text");
31
31
 
32
- var _useOnScroll2 = require("../../utils/useOnScroll");
32
+ var _useSentinelVisibility = require("../../utils/useSentinelVisibility");
33
33
 
34
34
  var _templateObject, _templateObject2;
35
35
 
@@ -57,6 +57,7 @@ var ModalWidth;
57
57
  /**
58
58
  * Modal.
59
59
  * Spec: https://www.figma.com/file/m6gDpKHEWDbYJyrwsVZDBr/Artsy-3.0-Design-System?node-id=6150%3A7290
60
+ * @deprecated: Use `ModalDialog` instead
60
61
  */
61
62
 
62
63
  exports.ModalWidth = ModalWidth;
@@ -84,9 +85,9 @@ var Modal = function Modal(_ref) {
84
85
  fadeIn = _useState2[0],
85
86
  setFadeIn = _useState2[1];
86
87
 
87
- var _useOnScroll = (0, _useOnScroll2.useOnScroll)(),
88
- isScrolled = _useOnScroll.isScrolled,
89
- elementRef = _useOnScroll.elementRef;
88
+ var _useSentinelVisibilit = (0, _useSentinelVisibility.useSentinelVisibility)(),
89
+ sentinel = _useSentinelVisibilit.sentinel,
90
+ isScrolled = _useSentinelVisibilit.isSentinelVisible;
90
91
 
91
92
  var handleEscapeKey = function handleEscapeKey(event) {
92
93
  if (event && event.key === "Escape") {
@@ -174,9 +175,7 @@ var Modal = function Modal(_ref) {
174
175
  px: 2,
175
176
  py: 1,
176
177
  pb: 2
177
- }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Sentinel, {
178
- ref: elementRef
179
- }), children)), FixedButton && /*#__PURE__*/_react.default.createElement(FixedButtonWrapper, {
178
+ }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, sentinel, children)), FixedButton && /*#__PURE__*/_react.default.createElement(FixedButtonWrapper, {
180
179
  isScrolled: isScrolled,
181
180
  p: 2
182
181
  }, FixedButton))))));
@@ -230,14 +229,7 @@ var CloseIconWrapper = (0, _styledComponents.default)(_Flex.Flex).withConfig({
230
229
  var Logo = (0, _styledComponents.default)(_ArtsyLogoBlackIcon.ArtsyLogoBlackIcon).withConfig({
231
230
  displayName: "Modal__Logo",
232
231
  componentId: "qjtwq0-8"
233
- })(["width:78px;"]); // This <div> is positioned such that when it leaves the top of
234
- // the ModalScrollContent we use IntersectionObserver within the hook
235
- // to switch on and of the shadows of the sticky elements
236
-
237
- var Sentinel = (0, _styledComponents.default)(_Box.Box).withConfig({
238
- displayName: "Modal__Sentinel",
239
- componentId: "qjtwq0-9"
240
- })(["position:relative;width:100%;height:0;"]);
232
+ })(["width:78px;"]);
241
233
  Modal.displayName = "Modal";
242
234
  ModalWrapper.displayName = "ModalWrapper";
243
235
  ModalScrollContent.displayName = "ModalScrollContent";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/elements/Modal/Modal.tsx"],"names":["ModalWidth","Modal","children","FixedButton","title","show","modalWidth","isWide","hasLogo","onClose","hideCloseButton","wrapperRef","fadeIn","setFadeIn","isScrolled","elementRef","handleEscapeKey","event","key","document","addEventListener","body","style","overflowY","removeEventListener","handleWrapperClick","target","current","FixedButtonWrapper","Flex","DROP_SHADOW","ModalOuterWrapper","Box","props","ModalWrapper","ModalElement","height","Wide","Normal","media","xs","ModalFlexContent","ModalStickyHeader","ModalScrollContent","CloseIconWrapper","Logo","ArtsyLogoBlackIcon","Sentinel","displayName"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;IAiCYA,U;AAMZ;AACA;AACA;AACA;;;;WATYA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;GAAAA,U,0BAAAA,U;;AAUL,IAAMC,KAAqB,GAAG,SAAxBA,KAAwB,OAU/B;AAAA,MATJC,QASI,QATJA,QASI;AAAA,MARJC,WAQI,QARJA,WAQI;AAAA,MAPJC,KAOI,QAPJA,KAOI;AAAA,MANJC,IAMI,QANJA,IAMI;AAAA,MALJC,UAKI,QALJA,UAKI;AAAA,MAJJC,MAII,QAJJA,MAII;AAAA,MAHJC,OAGI,QAHJA,OAGI;AAAA,MAFJC,OAEI,QAFJA,OAEI;AAAA,MADJC,eACI,QADJA,eACI;AACJ,MAAMC,UAAU,GAAG,mBAAO,IAAP,CAAnB;;AADI,kBAEwB,qBAAS,KAAT,CAFxB;AAAA;AAAA,MAEGC,MAFH;AAAA,MAEWC,SAFX;;AAAA,qBAG+B,gCAH/B;AAAA,MAGIC,UAHJ,gBAGIA,UAHJ;AAAA,MAGgBC,UAHhB,gBAGgBA,UAHhB;;AAKJ,MAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD,EAAW;AACjC,QAAIA,KAAK,IAAIA,KAAK,CAACC,GAAN,KAAc,QAA3B,EAAqC;AACnCT,MAAAA,OAAO;AACR;AACF,GAJD;;AAMA,wBAAU,YAAM;AACd,QAAIJ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AAH,SAAGA,UAAH;AAAA,SAAqBA,UAAU,GAAGgB,oBAAH,GAAiB,MAAhD;AAAA,CADO,CAAvB;AAKA,IAAMa,kBAAkB,GAAG,+BAAOd,UAAP,CAAH;AAAA;AAAA;AAAA,4CAAxB;AAKA,IAAMe,gBAAgB,GAAG,+BAAOf,UAAP,CAAH;AAAA;AAAA;AAAA,uBAAtB;AAIA,IAAMgB,IAAI,GAAG,+BAAOC,sCAAP,CAAH;AAAA;AAAA;AAAA,mBAAV,C,CAIA;AACA;AACA;;AACA,IAAMC,QAAQ,GAAG,+BAAOf,QAAP,CAAH;AAAA;AAAA;AAAA,8CAAd;AAMA/B,KAAK,CAAC+C,WAAN,GAAoB,OAApB;AACAd,YAAY,CAACc,WAAb,GAA2B,cAA3B;AACAL,kBAAkB,CAACK,WAAnB,GAAiC,oBAAjC","sourcesContent":["import { themeGet } from \"@styled-system/theme-get\"\nimport React, { FC, useEffect, useRef, useState } from \"react\"\nimport styled from \"styled-components\"\nimport { DROP_SHADOW, media } from \"../../helpers\"\nimport { CloseIcon } from \"../../svgs\"\nimport { ArtsyLogoBlackIcon } from \"../../svgs/ArtsyLogoBlackIcon\"\nimport { Box } from \"../Box\"\nimport { Flex } from \"../Flex\"\nimport { Join } from \"../Join\"\nimport { Spacer } from \"../Spacer\"\nimport { Text } from \"../Text\"\nimport { useOnScroll } from \"../../utils/useOnScroll\"\n\n/**\n * FIXME: This whole thing needs to be rebuilt from scratch\n */\n\ninterface ModalProps {\n FixedButton?: JSX.Element\n refreshModalContentKey?: string\n hasLogo?: boolean\n height?: string\n modalWidth?: ModalWidth\n isWide?: boolean\n onClose: () => void\n show?: boolean\n title?: string\n /*\n * Hide the X button if we don't want the user to be able to exit the modal without another action closing the modal\n */\n hideCloseButton?: boolean\n}\n\ninterface TransitionElementProps {\n isWide?: boolean\n show?: boolean\n modalWidth?: ModalWidth\n}\n\ninterface ModalScrollContentProps {\n hasLogo?: boolean\n modalWidth?: ModalWidth\n}\n\nexport enum ModalWidth {\n Narrow = \"300px\",\n Normal = \"440px\",\n Wide = \"900px\",\n}\n\n/**\n * Modal.\n * Spec: https://www.figma.com/file/m6gDpKHEWDbYJyrwsVZDBr/Artsy-3.0-Design-System?node-id=6150%3A7290\n */\nexport const Modal: FC<ModalProps> = ({\n children,\n FixedButton,\n title,\n show,\n modalWidth, // modalWidth overwrites isWide if present\n isWide,\n hasLogo,\n onClose,\n hideCloseButton,\n}) => {\n const wrapperRef = useRef(null)\n const [fadeIn, setFadeIn] = useState(false)\n const { isScrolled, elementRef } = useOnScroll()\n\n const handleEscapeKey = (event) => {\n if (event && event.key === \"Escape\") {\n onClose()\n }\n }\n\n useEffect(() => {\n if (show) {\n setFadeIn(true)\n\n if (!hideCloseButton) {\n // Binds key event for escape to close modal\n document.addEventListener(\"keyup\", handleEscapeKey, true)\n }\n // Fixes the body to disable scroll\n document.body.style.overflowY = \"hidden\"\n } else {\n setFadeIn(false)\n document.body.style.overflowY = \"visible\"\n document.removeEventListener(\"keyup\", handleEscapeKey, true)\n }\n\n return document.removeEventListener(\"keyup\", handleEscapeKey, true)\n }, [show])\n\n const handleWrapperClick = (event) => {\n // If modal X icon is hidden we don't want to close the modal when the wrapper is clicked\n if (!hideCloseButton && event.target === wrapperRef.current) {\n onClose()\n }\n }\n\n if (!show) {\n return null\n }\n\n return (\n <>\n <ModalOuterWrapper show={show} className={fadeIn ? \"fadeIn\" : \"\"}>\n <ModalWrapper ref={wrapperRef} onClick={handleWrapperClick}>\n <ModalElement\n modalWidth={modalWidth}\n isWide={isWide}\n show={show}\n className={fadeIn ? \"fadeIn\" : \"\"}\n >\n <ModalFlexContent>\n <ModalStickyHeader\n position=\"sticky\"\n top={0}\n display=\"flex\"\n justifyContent=\"center\"\n flexDirection=\"column\"\n isScrolled={isScrolled}\n px={2}\n >\n <Spacer my={1} />\n <Flex>\n <Box pr={6} flex={1}>\n <Join separator={<Spacer py={1} />}>\n {hasLogo && <Logo my={1} />}\n {title && (\n <Text\n variant=\"lg\"\n color=\"black100\"\n py={hasLogo ? 0 : 1}\n >\n {title}\n </Text>\n )}\n </Join>\n </Box>\n\n {!hideCloseButton && (\n <CloseIconWrapper my={1} onClick={() => onClose()}>\n <CloseIcon fill=\"black60\" />\n </CloseIconWrapper>\n )}\n </Flex>\n <Spacer py={1} />\n </ModalStickyHeader>\n\n <ModalScrollContent\n hasLogo={hasLogo}\n modalWidth={modalWidth}\n px={2}\n py={1}\n pb={2}\n >\n <>\n <Sentinel ref={elementRef} />\n {children}\n </>\n </ModalScrollContent>\n\n {FixedButton && (\n <FixedButtonWrapper isScrolled={isScrolled} p={2}>\n {FixedButton}\n </FixedButtonWrapper>\n )}\n </ModalFlexContent>\n </ModalElement>\n </ModalWrapper>\n </ModalOuterWrapper>\n </>\n )\n}\n\ninterface ShadowOnScroll {\n isScrolled?: boolean\n}\n\nconst FixedButtonWrapper = styled(Flex)<ShadowOnScroll>`\n box-shadow: ${({ isScrolled }) => (isScrolled ? DROP_SHADOW : \"none\")};\n flex: 0 0 auto;\n transition: box-shadow 250ms ease-in-out;\n`\n\nconst ModalOuterWrapper = styled(Box)<TransitionElementProps>`\n position: fixed;\n top: 0;\n left: 0;\n z-index: 9999;\n width: 100vw;\n height: 100vh;\n background-color: rgba(229, 229, 229, 0.5);\n opacity: 0;\n pointer-events: ${(props) => (props.show ? \"auto\" : \"none\")};\n\n &.fadeIn {\n transition: opacity 250ms ease;\n transition-delay: 1ms;\n opacity: 1;\n }\n`\n\nconst ModalWrapper = styled(Flex)`\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden;\n justify-content: center;\n align-items: center;\n`\n\nconst ModalElement = styled(Flex)<TransitionElementProps>`\n position: absolute;\n height: ${(props) => (props.height ? props.height : \"auto\") as any};\n max-height: calc(100vh - 80px);\n min-height: 58px;\n overflow: hidden;\n background-color: ${themeGet(\"colors.white100\")};\n box-shadow: ${DROP_SHADOW};\n width: ${(props) =>\n props.modalWidth || (props.isWide ? ModalWidth.Wide : ModalWidth.Normal)};\n\n ${media.xs`\n max-height: 100vh;\n height: calc(100vh - ${themeGet(\"space.4\")});\n width: calc(100vw - ${themeGet(\"space.4\")});\n `};\n\n transform: translateY(2000px);\n &.fadeIn {\n transition: all 400ms cubic-bezier(0.075, 0.82, 0.165, 1); /* easeOutCirc */\n transition-delay: 1ms;\n transform: translateY(0px);\n }\n`\n\nconst ModalFlexContent = styled(Flex)<ModalScrollContentProps>`\n position: relative;\n flex-direction: column;\n width: 100%;\n overflow: hidden;\n max-height: calc(100vh - 80px);\n ${media.xs`\n max-height: 100vh;\n `};\n`\n\nconst ModalStickyHeader = styled(Box)<ModalScrollContentProps & ShadowOnScroll>`\n box-shadow: ${({ isScrolled }) => (isScrolled ? DROP_SHADOW : \"none\")};\n transition: box-shadow 250ms ease-in-out;\n`\n\nconst ModalScrollContent = styled(Flex)<ModalScrollContentProps>`\n overflow: auto;\n flex-direction: column;\n`\n\nconst CloseIconWrapper = styled(Flex)`\n cursor: pointer;\n`\n\nconst Logo = styled(ArtsyLogoBlackIcon)`\n width: 78px;\n`\n\n// This <div> is positioned such that when it leaves the top of\n// the ModalScrollContent we use IntersectionObserver within the hook\n// to switch on and of the shadows of the sticky elements\nconst Sentinel = styled(Box)`\n position: relative;\n width: 100%;\n height: 0;\n`\n\nModal.displayName = \"Modal\"\nModalWrapper.displayName = \"ModalWrapper\"\nModalScrollContent.displayName = \"ModalScrollContent\"\n"],"file":"Modal.js"}
1
+ {"version":3,"sources":["../../../src/elements/Modal/Modal.tsx"],"names":["ModalWidth","Modal","children","FixedButton","title","show","modalWidth","isWide","hasLogo","onClose","hideCloseButton","wrapperRef","fadeIn","setFadeIn","sentinel","isScrolled","isSentinelVisible","handleEscapeKey","event","key","document","addEventListener","body","style","overflowY","removeEventListener","handleWrapperClick","target","current","FixedButtonWrapper","Flex","DROP_SHADOW","ModalOuterWrapper","Box","props","ModalWrapper","ModalElement","height","Wide","Normal","media","xs","ModalFlexContent","ModalStickyHeader","ModalScrollContent","Close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AAI,GAAG,+BAAOC,sCAAP,CAAH;AAAA;AAAA;AAAA,mBAAV;AAIA9C,KAAK,CAAC+C,WAAN,GAAoB,OAApB;AACAb,YAAY,CAACa,WAAb,GAA2B,cAA3B;AACAJ,kBAAkB,CAACI,WAAnB,GAAiC,oBAAjC","sourcesContent":["import { themeGet } from \"@styled-system/theme-get\"\nimport React, { FC, useEffect, useRef, useState } from \"react\"\nimport styled from \"styled-components\"\nimport { DROP_SHADOW, media } from \"../../helpers\"\nimport { CloseIcon } from \"../../svgs\"\nimport { ArtsyLogoBlackIcon } from \"../../svgs/ArtsyLogoBlackIcon\"\nimport { Box } from \"../Box\"\nimport { Flex } from \"../Flex\"\nimport { Join } from \"../Join\"\nimport { Spacer } from \"../Spacer\"\nimport { Text } from \"../Text\"\nimport { useSentinelVisibility } from \"../../utils/useSentinelVisibility\"\n\n/**\n * FIXME: This whole thing needs to be rebuilt from scratch\n */\n\ninterface ModalProps {\n FixedButton?: JSX.Element\n refreshModalContentKey?: string\n hasLogo?: boolean\n height?: string\n modalWidth?: ModalWidth\n isWide?: boolean\n onClose: () => void\n show?: boolean\n title?: string\n /*\n * Hide the X button if we don't want the user to be able to exit the modal without another action closing the modal\n */\n hideCloseButton?: boolean\n}\n\ninterface TransitionElementProps {\n isWide?: boolean\n show?: boolean\n modalWidth?: ModalWidth\n}\n\ninterface ModalScrollContentProps {\n hasLogo?: boolean\n modalWidth?: ModalWidth\n}\n\nexport enum ModalWidth {\n Narrow = \"300px\",\n Normal = \"440px\",\n Wide = \"900px\",\n}\n\n/**\n * Modal.\n * Spec: https://www.figma.com/file/m6gDpKHEWDbYJyrwsVZDBr/Artsy-3.0-Design-System?node-id=6150%3A7290\n * @deprecated: Use `ModalDialog` instead\n */\nexport const Modal: FC<ModalProps> = ({\n children,\n FixedButton,\n title,\n show,\n modalWidth, // modalWidth overwrites isWide if present\n isWide,\n hasLogo,\n onClose,\n hideCloseButton,\n}) => {\n const wrapperRef = useRef(null)\n const [fadeIn, setFadeIn] = useState(false)\n const { sentinel, isSentinelVisible: isScrolled } = useSentinelVisibility()\n\n const handleEscapeKey = (event) => {\n if (event && event.key === \"Escape\") {\n onClose()\n }\n }\n\n useEffect(() => {\n if (show) {\n setFadeIn(true)\n\n if (!hideCloseButton) {\n // Binds key event for escape to close modal\n document.addEventListener(\"keyup\", handleEscapeKey, true)\n }\n // Fixes the body to disable scroll\n document.body.style.overflowY = \"hidden\"\n } else {\n setFadeIn(false)\n document.body.style.overflowY = \"visible\"\n document.removeEventListener(\"keyup\", handleEscapeKey, true)\n }\n\n return document.removeEventListener(\"keyup\", handleEscapeKey, true)\n }, [show])\n\n const handleWrapperClick = (event) => {\n // If modal X icon is hidden we don't want to close the modal when the wrapper is clicked\n if (!hideCloseButton && event.target === wrapperRef.current) {\n onClose()\n }\n }\n\n if (!show) {\n return null\n }\n\n return (\n <>\n <ModalOuterWrapper show={show} className={fadeIn ? \"fadeIn\" : \"\"}>\n <ModalWrapper ref={wrapperRef} onClick={handleWrapperClick}>\n <ModalElement\n modalWidth={modalWidth}\n isWide={isWide}\n show={show}\n className={fadeIn ? \"fadeIn\" : \"\"}\n >\n <ModalFlexContent>\n <ModalStickyHeader\n position=\"sticky\"\n top={0}\n display=\"flex\"\n justifyContent=\"center\"\n flexDirection=\"column\"\n isScrolled={isScrolled}\n px={2}\n >\n <Spacer my={1} />\n <Flex>\n <Box pr={6} flex={1}>\n <Join separator={<Spacer py={1} />}>\n {hasLogo && <Logo my={1} />}\n {title && (\n <Text\n variant=\"lg\"\n color=\"black100\"\n py={hasLogo ? 0 : 1}\n >\n {title}\n </Text>\n )}\n </Join>\n </Box>\n\n {!hideCloseButton && (\n <CloseIconWrapper my={1} onClick={() => onClose()}>\n <CloseIcon fill=\"black60\" />\n </CloseIconWrapper>\n )}\n </Flex>\n <Spacer py={1} />\n </ModalStickyHeader>\n\n <ModalScrollContent\n hasLogo={hasLogo}\n modalWidth={modalWidth}\n px={2}\n py={1}\n pb={2}\n >\n <>\n {sentinel}\n {children}\n </>\n </ModalScrollContent>\n\n {FixedButton && (\n <FixedButtonWrapper isScrolled={isScrolled} p={2}>\n {FixedButton}\n </FixedButtonWrapper>\n )}\n </ModalFlexContent>\n </ModalElement>\n </ModalWrapper>\n </ModalOuterWrapper>\n </>\n )\n}\n\ninterface ShadowOnScroll {\n isScrolled?: boolean\n}\n\nconst FixedButtonWrapper = styled(Flex)<ShadowOnScroll>`\n box-shadow: ${({ isScrolled }) => (isScrolled ? DROP_SHADOW : \"none\")};\n flex: 0 0 auto;\n transition: box-shadow 250ms ease-in-out;\n`\n\nconst ModalOuterWrapper = styled(Box)<TransitionElementProps>`\n position: fixed;\n top: 0;\n left: 0;\n z-index: 9999;\n width: 100vw;\n height: 100vh;\n background-color: rgba(229, 229, 229, 0.5);\n opacity: 0;\n pointer-events: ${(props) => (props.show ? \"auto\" : \"none\")};\n\n &.fadeIn {\n transition: opacity 250ms ease;\n transition-delay: 1ms;\n opacity: 1;\n }\n`\n\nconst ModalWrapper = styled(Flex)`\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden;\n justify-content: center;\n align-items: center;\n`\n\nconst ModalElement = styled(Flex)<TransitionElementProps>`\n position: absolute;\n height: ${(props) => (props.height ? props.height : \"auto\") as any};\n max-height: calc(100vh - 80px);\n min-height: 58px;\n overflow: hidden;\n background-color: ${themeGet(\"colors.white100\")};\n box-shadow: ${DROP_SHADOW};\n width: ${(props) =>\n props.modalWidth || (props.isWide ? ModalWidth.Wide : ModalWidth.Normal)};\n\n ${media.xs`\n max-height: 100vh;\n height: calc(100vh - ${themeGet(\"space.4\")});\n width: calc(100vw - ${themeGet(\"space.4\")});\n `};\n\n transform: translateY(2000px);\n &.fadeIn {\n transition: all 400ms cubic-bezier(0.075, 0.82, 0.165, 1); /* easeOutCirc */\n transition-delay: 1ms;\n transform: translateY(0px);\n }\n`\n\nconst ModalFlexContent = styled(Flex)<ModalScrollContentProps>`\n position: relative;\n flex-direction: column;\n width: 100%;\n overflow: hidden;\n max-height: calc(100vh - 80px);\n ${media.xs`\n max-height: 100vh;\n `};\n`\n\nconst ModalStickyHeader = styled(Box)<ModalScrollContentProps & ShadowOnScroll>`\n box-shadow: ${({ isScrolled }) => (isScrolled ? DROP_SHADOW : \"none\")};\n transition: box-shadow 250ms ease-in-out;\n`\n\nconst ModalScrollContent = styled(Flex)<ModalScrollContentProps>`\n overflow: auto;\n flex-direction: column;\n`\n\nconst CloseIconWrapper = styled(Flex)`\n cursor: pointer;\n`\n\nconst Logo = styled(ArtsyLogoBlackIcon)`\n width: 78px;\n`\n\nModal.displayName = \"Modal\"\nModalWrapper.displayName = \"ModalWrapper\"\nModalScrollContent.displayName = \"ModalScrollContent\"\n"],"file":"Modal.js"}
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { ZIndexProps } from "styled-system";
3
3
  import { FlexProps } from "../Flex";
4
4
  /** BaseModal */
5
- export declare type ModalBaseProps = FlexProps & ZIndexProps & {
5
+ export declare type ModalBaseProps = React.HTMLAttributes<HTMLDivElement> & FlexProps & ZIndexProps & {
6
6
  children?: React.ReactNode;
7
7
  dialogProps?: FlexProps;
8
8
  onClose?(): void;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/elements/Modal/ModalBase.tsx"],"names":["ScrollIsolation","RemoveScroll","Container","Flex","systemZIndex","Dialog","attrs","role","DEFAULT_MODAL_Z_INDEX","ModalBase","children","zIndex","dialogProps","onClose","rest","appendEl","document","createElement","containerEl","scrollIsolationEl","handleMouseDown","event","target","current","body","appendChild","handleKeydown","key","preventDefault","stopPropagation","addEventListener","removeEventListener","window","innerHeight","maxHeight","setMaxHeight","updateMaxHeight","passive","displayName"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA,IAAMA,eAAe,GAAG,+BAAOC,+BAAP,CAAH;AAAA;AAAA;AAAA,sFAArB;AAQA,IAAMC,SAAS,GAAG,+BAA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\nimport { createPortal } from \"react-dom\"\nimport { RemoveScroll } from \"react-remove-scroll\"\nimport styled from \"styled-components\"\nimport { zIndex as systemZIndex, ZIndexProps } from \"styled-system\"\nimport { useFocusLock } from \"../../utils/useFocusLock\"\nimport { Flex, FlexProps } from \"../Flex\"\n\n// TODO: Update TypeScript definitions for this library\n// https://github.com/theKashey/react-remove-scroll\nconst ScrollIsolation = styled(RemoveScroll as any)`\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n`\n\nconst Container = styled(Flex)`\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n align-items: center;\n justify-content: center;\n ${systemZIndex}\n`\n\nconst Dialog = styled(Flex).attrs({ role: \"dialog\" })`\n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n\n > * {\n max-height: 100%;\n }\n`\n\n/** BaseModal */\nexport type ModalBaseProps = FlexProps &\n ZIndexProps & {\n children?: React.ReactNode\n dialogProps?: FlexProps\n onClose?(): void\n }\n\n/**\n * It seems we've landed on this value as the 'top'\n */\nexport const DEFAULT_MODAL_Z_INDEX = 9999\n\n/**\n * BaseModal\n * Low-level modal that has no opinions about layout/overlay\n * Modals content using a portal, locks scroll.\n */\nexport const ModalBase: React.FC<ModalBaseProps> = ({\n children,\n zIndex = DEFAULT_MODAL_Z_INDEX,\n dialogProps = {},\n onClose = () => null,\n ...rest\n}) => {\n const appendEl = useRef(document.createElement(\"div\"))\n const containerEl = useRef<HTMLDivElement | null>(null)\n const scrollIsolationEl = useRef<HTMLDivElement | null>(null)\n\n const handleMouseDown = (\n event: React.MouseEvent<HTMLDivElement, MouseEvent>\n ) => {\n if (event.target === scrollIsolationEl.current) {\n onClose()\n }\n }\n\n useFocusLock(containerEl)\n\n useEffect(() => {\n if (appendEl.current === null) return\n\n // Append the dialog\n document.body.appendChild(appendEl.current)\n }, [])\n\n useEffect(() => {\n const handleKeydown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"Escape\":\n // Prevent <esc> from interfering with the returned focus\n event.preventDefault()\n event.stopPropagation()\n\n // Handle close\n return onClose()\n default:\n break\n }\n }\n\n document.addEventListener(\"keydown\", handleKeydown)\n return () => {\n document.removeEventListener(\"keydown\", handleKeydown)\n }\n }, [onClose])\n\n // Sets to `innerHeight` so as to simulate `100vh` on iOS\n const [maxHeight, setMaxHeight] = useState(window.innerHeight)\n\n // Keeps `maxHeight` in sync\n useEffect(() => {\n const updateMaxHeight = () => {\n setMaxHeight(window.innerHeight)\n }\n\n window.addEventListener(\"resize\", updateMaxHeight, { passive: true })\n return () => {\n window.removeEventListener(\"resize\", updateMaxHeight)\n }\n }, [])\n\n return createPortal(\n <Container ref={containerEl as any} zIndex={zIndex} {...rest}>\n <ScrollIsolation\n ref={scrollIsolationEl as any}\n onMouseDown={handleMouseDown}\n >\n <Dialog maxHeight={maxHeight} {...dialogProps}>\n {children}\n </Dialog>\n </ScrollIsolation>\n </Container>,\n appendEl.current\n )\n}\n\nModalBase.displayName = \"ModalBase\"\n"],"file":"ModalBase.js"}
1
+ {"version":3,"sources":["../../../src/elements/Modal/ModalBase.tsx"],"names":["ScrollIsolation","RemoveScroll","Container","Flex","systemZIndex","Dialog","attrs","role","DEFAULT_MODAL_Z_INDEX","ModalBase","children","zIndex","dialogProps","onClose","rest","appendEl","document","createElement","containerEl","scrollIsolationEl","handleMouseDown","event","target","current","body","appendChild","handleKeydown","key","preventDefault","stopPropagation","addEventListener","removeEventListener","window","innerHeight","maxHeight","setMaxHeight","updateMaxHeight","passive","displayName"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA,IAAMA,eAAe,GAAG,+BAAOC,+BAAP,CAAH;AAAA;AAAA;AAAA,sFAArB;AAQA,IAAMC,SAAS,GAAG,+BAAOC,UAAP,CAAH;AAAA;AAAA;AAAA,oGAQXC,oBARW,CAAf;AAWA,IAAMC,MAAM,GAAG,+BAAOF,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,OAAO,EAAd;;AACF;AACE;AATJ;AAWD,KAZD;;AAcAG,IAAAA,QAAQ,CAACc,gBAAT,CAA0B,SAA1B,EAAqCJ,aAArC;AACA,WAAO,YAAM;AACXV,MAAAA,QAAQ,CAACe,mBAAT,CAA6B,SAA7B,EAAwCL,aAAxC;AACD,KAFD;AAGD,GAnBD,EAmBG,CAACb,OAAD,CAnBH,EAtBI,CA2CJ;;AA3CI,kBA4C8B,qBAASmB,MAAM,CAACC,WAAhB,CA5C9B;AAAA;AAAA,MA4CGC,SA5CH;AAAA,MA4CcC,YA5Cd,kBA8CJ;;;AACA,wBAAU,YAAM;AACd,QAAMC,eAAe,GAAG,SAAlBA,eAAkB,GAAM;AAC5BD,MAAAA,YAAY,CAACH,MAAM,CAACC,WAAR,CAAZ;AACD,KAFD;;AAIAD,IAAAA,MAAM,CAACF,gBAAP,CAAwB,QAAxB,EAAkCM,eAAlC,EAAmD;AAAEC,MAAAA,OAAO,EAAE;AAAX,KAAnD;AACA,WAAO,YAAM;AACXL,MAAAA,MAAM,CAACD,mBAAP,CAA2B,QAA3B,EAAqCK,eAArC;AACD,KAFD;AAGD,GATD,EASG,EATH;AAWA,sBAAO,0CACL,6BAAC,SAAD;AAAW,IAAA,GAAG,EAAElB,WAAhB;AAAoC,IAAA,MAAM,EAAEP;AAA5C,KAAwDG,IAAxD,gBACE,6BAAC,eAAD;AACE,IAAA,GAAG,EAAEK,iBADP;AAEE,IAAA,WAAW,EAAEC;AAFf,kBAIE,6BAAC,MAAD;AAAQ,IAAA,SAAS,EAAEc;AAAnB,KAAkCtB,WAAlC,GACGF,QADH,CAJF,CADF,CADK,EAWLK,QAAQ,CAACQ,OAXJ,CAAP;AAaD,CA7EM;;;AA+EPd,SAAS,CAAC6B,WAAV,GAAwB,WAAxB","sourcesContent":["import React, { useEffect, useRef, useState } from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { RemoveScroll } from \"react-remove-scroll\"\nimport styled from \"styled-components\"\nimport { zIndex as systemZIndex, ZIndexProps } from \"styled-system\"\nimport { useFocusLock } from \"../../utils/useFocusLock\"\nimport { Flex, FlexProps } from \"../Flex\"\n\n// TODO: Update TypeScript definitions for this library\n// https://github.com/theKashey/react-remove-scroll\nconst ScrollIsolation = styled(RemoveScroll as any)`\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n`\n\nconst Container = styled(Flex)`\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n align-items: center;\n justify-content: center;\n ${systemZIndex}\n`\n\nconst Dialog = styled(Flex).attrs({ role: \"dialog\" })`\n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n\n > * {\n max-height: 100%;\n }\n`\n\n/** BaseModal */\nexport type ModalBaseProps = React.HTMLAttributes<HTMLDivElement> &\n FlexProps &\n ZIndexProps & {\n children?: React.ReactNode\n dialogProps?: FlexProps\n onClose?(): void\n }\n\n/**\n * It seems we've landed on this value as the 'top'\n */\nexport const DEFAULT_MODAL_Z_INDEX = 9999\n\n/**\n * BaseModal\n * Low-level modal that has no opinions about layout/overlay\n * Modals content using a portal, locks scroll.\n */\nexport const ModalBase: React.FC<ModalBaseProps> = ({\n children,\n zIndex = DEFAULT_MODAL_Z_INDEX,\n dialogProps = {},\n onClose = () => null,\n ...rest\n}) => {\n const appendEl = useRef(document.createElement(\"div\"))\n const containerEl = useRef<HTMLDivElement | null>(null)\n const scrollIsolationEl = useRef<HTMLDivElement | null>(null)\n\n const handleMouseDown = (\n event: React.MouseEvent<HTMLDivElement, MouseEvent>\n ) => {\n if (event.target === scrollIsolationEl.current) {\n onClose()\n }\n }\n\n useFocusLock(containerEl)\n\n useEffect(() => {\n if (appendEl.current === null) return\n\n // Append the dialog\n document.body.appendChild(appendEl.current)\n }, [])\n\n useEffect(() => {\n const handleKeydown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"Escape\":\n // Prevent <esc> from interfering with the returned focus\n event.preventDefault()\n event.stopPropagation()\n\n // Handle close\n return onClose()\n default:\n break\n }\n }\n\n document.addEventListener(\"keydown\", handleKeydown)\n return () => {\n document.removeEventListener(\"keydown\", handleKeydown)\n }\n }, [onClose])\n\n // Sets to `innerHeight` so as to simulate `100vh` on iOS\n const [maxHeight, setMaxHeight] = useState(window.innerHeight)\n\n // Keeps `maxHeight` in sync\n useEffect(() => {\n const updateMaxHeight = () => {\n setMaxHeight(window.innerHeight)\n }\n\n window.addEventListener(\"resize\", updateMaxHeight, { passive: true })\n return () => {\n window.removeEventListener(\"resize\", updateMaxHeight)\n }\n }, [])\n\n return createPortal(\n <Container ref={containerEl as any} zIndex={zIndex} {...rest}>\n <ScrollIsolation\n ref={scrollIsolationEl as any}\n onMouseDown={handleMouseDown}\n >\n <Dialog maxHeight={maxHeight} {...dialogProps}>\n {children}\n </Dialog>\n </ScrollIsolation>\n </Container>,\n appendEl.current\n )\n}\n\nModalBase.displayName = \"ModalBase\"\n"],"file":"ModalBase.js"}
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { ModalBaseProps } from "../Modal";
3
+ import { ModalDialogContentProps } from "./ModalDialogContent";
4
+ export declare type ModalDialogProps = ModalBaseProps & ModalDialogContentProps;
5
+ export declare const ModalDialog: React.FC<ModalDialogProps>;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ModalDialog = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _Modal = require("../Modal");
11
+
12
+ var _ModalDialogContent = require("./ModalDialogContent");
13
+
14
+ var _Box = require("../Box");
15
+
16
+ var _useDidMount = require("../../utils/useDidMount");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
+
22
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
23
+
24
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
25
+
26
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
27
+
28
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
29
+
30
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
31
+
32
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
33
+
34
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
35
+
36
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
37
+
38
+ var ModalDialog = function ModalDialog(_ref) {
39
+ var children = _ref.children,
40
+ footer = _ref.footer,
41
+ hasLogo = _ref.hasLogo,
42
+ onClose = _ref.onClose,
43
+ title = _ref.title,
44
+ rest = _objectWithoutProperties(_ref, ["children", "footer", "hasLogo", "onClose", "title"]);
45
+
46
+ var isMounted = (0, _useDidMount.useDidMount)();
47
+
48
+ var _splitBoxProps = (0, _Box.splitBoxProps)(rest),
49
+ _splitBoxProps2 = _slicedToArray(_splitBoxProps, 2),
50
+ boxProps = _splitBoxProps2[0],
51
+ modalProps = _splitBoxProps2[1];
52
+
53
+ return /*#__PURE__*/_react.default.createElement(_Modal.ModalBase, _extends({
54
+ onClose: onClose,
55
+ style: isMounted ? {
56
+ backgroundColor: "rgba(229, 229, 229, 0.5)",
57
+ transition: "background-color 250ms"
58
+ } : {
59
+ backgroundColor: "transparent"
60
+ }
61
+ }, modalProps), /*#__PURE__*/_react.default.createElement(_ModalDialogContent.ModalDialogContent, _extends({
62
+ footer: footer,
63
+ hasLogo: hasLogo,
64
+ onClose: onClose,
65
+ title: title,
66
+ width: 440,
67
+ style: isMounted ? {
68
+ opacity: 1,
69
+ transition: "opacity 250ms, transform 250ms"
70
+ } : {
71
+ opacity: 0,
72
+ transform: "translateY(10px)"
73
+ }
74
+ }, boxProps), children));
75
+ };
76
+
77
+ exports.ModalDialog = ModalDialog;
78
+ ModalDialog.displayName = "ModalDialog";
79
+ //# sourceMappingURL=ModalDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/elements/ModalDialog/ModalDialog.tsx"],"names":["ModalDialog","children","footer","hasLogo","onClose","title","rest","isMounted","boxProps","modalProps","backgroundColor","transition","opacity","transform"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAIA;;AACA;;;;;;;;;;;;;;;;;;;;;;AAIO,IAAMA,WAAuC,GAAG,SAA1CA,WAA0C,OAOjD;AAAA,MANJC,QAMI,QANJA,QAMI;AAAA,MALJC,MAKI,QALJA,MAKI;AAAA,MAJJC,OAII,QAJJA,OAII;AAAA,MAHJC,OAGI,QAHJA,OAGI;AAAA,MAFJC,KAEI,QAFJA,KAEI;AAAA,MADDC,IACC;;AACJ,MAAMC,SAAS,GAAG,+BAAlB;;AADI,uBAE2B,wBAAcD,IAAd,CAF3B;AAAA;AAAA,MAEGE,QAFH;AAAA,MAEaC,UAFb;;AAIJ,sBACE,6BAAC,gBAAD;AACE,IAAA,OAAO,EAAEL,OADX;AAEE,IAAA,KAAK,EACHG,SAAS,GACL;AACEG,MAAAA,eAAe,EAAE,0BADnB;AAEEC,MAAAA,UAAU,EAAE;AAFd,KADK,GAKL;AAAED,MAAAA,eAAe,EAAE;AAAnB;AARR,KAUMD,UAVN,gBAYE,6BAAC,sCAAD;AACE,IAAA,MAAM,EAAEP,MADV;AAEE,IAAA,OAAO,EAAEC,OAFX;AAGE,IAAA,OAAO,EAAEC,OAHX;AAIE,IAAA,KAAK,EAAEC,KAJT;AAKE,IAAA,KAAK,EAAE,GALT;AAME,IAAA,KAAK,EACHE,SAAS,GACL;AACEK,MAAAA,OAAO,EAAE,CADX;AAEED,MAAAA,UAAU,EAAE;AAFd,KADK,GAKL;AAAEC,MAAAA,OAAO,EAAE,CAAX;AAAcC,MAAAA,SAAS,EAAE;AAAzB;AAZR,KAcML,QAdN,GAgBGP,QAhBH,CAZF,CADF;AAiCD,CA5CM;;;AAAMD,W","sourcesContent":["import React from \"react\"\nimport { ModalBase, ModalBaseProps } from \"../Modal\"\nimport {\n ModalDialogContent,\n ModalDialogContentProps,\n} from \"./ModalDialogContent\"\nimport { splitBoxProps } from \"../Box\"\nimport { useDidMount } from \"../../utils/useDidMount\"\n\nexport type ModalDialogProps = ModalBaseProps & ModalDialogContentProps\n\nexport const ModalDialog: React.FC<ModalDialogProps> = ({\n children,\n footer,\n hasLogo,\n onClose,\n title,\n ...rest\n}) => {\n const isMounted = useDidMount()\n const [boxProps, modalProps] = splitBoxProps(rest)\n\n return (\n <ModalBase\n onClose={onClose}\n style={\n isMounted\n ? {\n backgroundColor: \"rgba(229, 229, 229, 0.5)\",\n transition: \"background-color 250ms\",\n }\n : { backgroundColor: \"transparent\" }\n }\n {...modalProps}\n >\n <ModalDialogContent\n footer={footer}\n hasLogo={hasLogo}\n onClose={onClose}\n title={title}\n width={440}\n style={\n isMounted\n ? {\n opacity: 1,\n transition: \"opacity 250ms, transform 250ms\",\n }\n : { opacity: 0, transform: \"translateY(10px)\" }\n }\n {...boxProps}\n >\n {children}\n </ModalDialogContent>\n </ModalBase>\n )\n}\n"],"file":"ModalDialog.js"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const _default: {
3
+ title: string;
4
+ };
5
+ export default _default;
6
+ export declare const Default: () => JSX.Element;
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.Default = exports.default = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _storybookStates = require("storybook-states");
13
+
14
+ var _Text = require("../Text");
15
+
16
+ var _Button = require("../Button");
17
+
18
+ var _ModalDialog = require("./ModalDialog");
19
+
20
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
21
+
22
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+
24
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
25
+
26
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
27
+
28
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
29
+
30
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
31
+
32
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
33
+
34
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
35
+
36
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
37
+
38
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
39
+
40
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
41
+
42
+ var LOREM = "Lorem ipsum dolor sit amet consectetur, adipisicing elit. Doloribus sed iure repellendus animi, aliquid aut fuga maxime nemo minus quas. Error, incidunt fugit similique quidem culpa hic! Nemo, quas rerum. ";
43
+ var _default = {
44
+ title: "Components/ModalDialog"
45
+ };
46
+ exports.default = _default;
47
+
48
+ var Demo = function Demo(_ref) {
49
+ var children = _ref.children,
50
+ rest = _objectWithoutProperties(_ref, ["children"]);
51
+
52
+ var _useState = (0, _react.useState)(false),
53
+ _useState2 = _slicedToArray(_useState, 2),
54
+ open = _useState2[0],
55
+ setOpen = _useState2[1];
56
+
57
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.Button, {
58
+ onClick: function onClick() {
59
+ return setOpen(true);
60
+ }
61
+ }, "Open Modal"), open && /*#__PURE__*/_react.default.createElement(_ModalDialog.ModalDialog, _extends({
62
+ onClose: function onClose() {
63
+ return setOpen(false);
64
+ }
65
+ }, rest), children ? children : /*#__PURE__*/_react.default.createElement(_Text.Text, {
66
+ variant: "sm"
67
+ }, LOREM.repeat(15))));
68
+ };
69
+
70
+ var Default = function Default() {
71
+ return /*#__PURE__*/_react.default.createElement(_storybookStates.States, {
72
+ states: [{
73
+ children: /*#__PURE__*/_react.default.createElement(_Text.Text, {
74
+ variant: "sm"
75
+ }, LOREM)
76
+ }, {
77
+ title: "Modal Title"
78
+ }, {
79
+ title: "100% Width",
80
+ width: "100%"
81
+ }, {
82
+ title: "Responsive Width",
83
+ width: ["100%", 550]
84
+ }, {
85
+ title: "Modal Title with a longer title or headline text that runs on for mutliple lines"
86
+ }, {
87
+ hasLogo: true
88
+ }, {
89
+ title: "Modal Title",
90
+ hasLogo: true
91
+ }, {
92
+ children: /*#__PURE__*/_react.default.createElement(_Text.Text, {
93
+ variant: "sm"
94
+ }, LOREM),
95
+ footer: /*#__PURE__*/_react.default.createElement(_Button.Button, {
96
+ width: "100%"
97
+ }, "Confirm")
98
+ }, {
99
+ title: "Modal Title",
100
+ footer: /*#__PURE__*/_react.default.createElement(_Button.Button, {
101
+ width: "100%"
102
+ }, "Confirm")
103
+ }, {
104
+ title: "Modal Title with a longer title or headline text that runs on for mutliple lines",
105
+ footer: /*#__PURE__*/_react.default.createElement(_Button.Button, {
106
+ width: "100%"
107
+ }, "Confirm")
108
+ }, {
109
+ title: "Modal Title with a longer title or headline text that runs on for mutliple lines",
110
+ hasLogo: true,
111
+ footer: /*#__PURE__*/_react.default.createElement(_Button.Button, {
112
+ width: "100%"
113
+ }, "Confirm")
114
+ }]
115
+ }, function (props) {
116
+ return /*#__PURE__*/_react.default.createElement(Demo, props);
117
+ });
118
+ };
119
+
120
+ exports.Default = Default;
121
+ Default.displayName = "Default";
122
+ //# sourceMappingURL=ModalDialog.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/elements/ModalDialog/ModalDialog.story.tsx"],"names":["LOREM","title","Demo","children","rest","open","setOpen","repeat","Default","width","hasLogo","footer","props"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA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;AAAwBS,MAAAA,OAAO,EAAE;AAAjC,KAZM,EAaN;AACEP,MAAAA,QAAQ,eAAE,6BAAC,UAAD;AAAM,QAAA,OAAO,EAAC;AAAd,SAAoBH,KAApB,CADZ;AAEEW,MAAAA,MAAM,eAAE,6BAAC,cAAD;AAAQ,QAAA,KAAK,EAAC;AAAd;AAFV,KAbM,EAiBN;AAAEV,MAAAA,KAAK,EAAE,aAAT;AAAwBU,MAAAA,MAAM,eAAE,6BAAC,cAAD;AAAQ,QAAA,KAAK,EAAC;AAAd;AAAhC,KAjBM,EAkBN;AACEV,MAAAA,KAAK,EACH,kFAFJ;AAGEU,MAAAA,MAAM,eAAE,6BAAC,cAAD;AAAQ,QAAA,KAAK,EAAC;AAAd;AAHV,KAlBM,EAuBN;AACEV,MAAAA,KAAK,EACH,kFAFJ;AAGES,MAAAA,OAAO,EAAE,IAHX;AAIEC,MAAAA,MAAM,eAAE,6BAAC,cAAD;AAAQ,QAAA,KAAK,EAAC;AAAd;AAJV,KAvBM;AADV,KAgCG,UAACC,KAAD;AAAA,wBAAW,6BAAC,IAAD,EAAUA,KAAV,CAAX;AAAA,GAhCH,CADF;AAoCD,CArCM;;;AAAMJ,O","sourcesContent":["import React, { useState } from \"react\"\nimport { States } from \"storybook-states\"\nimport { Text } from \"../Text\"\nimport { Button } from \"../Button\"\nimport { ModalDialog, ModalDialogProps } from \"./ModalDialog\"\n\nconst LOREM =\n \"Lorem ipsum dolor sit amet consectetur, adipisicing elit. Doloribus sed iure repellendus animi, aliquid aut fuga maxime nemo minus quas. Error, incidunt fugit similique quidem culpa hic! Nemo, quas rerum. \"\n\nexport default {\n title: \"Components/ModalDialog\",\n}\n\nconst Demo = ({ children, ...rest }: Partial<ModalDialogProps>) => {\n const [open, setOpen] = useState(false)\n\n return (\n <>\n <Button onClick={() => setOpen(true)}>Open Modal</Button>\n\n {open && (\n <ModalDialog onClose={() => setOpen(false)} {...rest}>\n {children ? children : <Text variant=\"sm\">{LOREM.repeat(15)}</Text>}\n </ModalDialog>\n )}\n </>\n )\n}\n\nexport const Default = () => {\n return (\n <States<Partial<ModalDialogProps>>\n states={[\n {\n children: <Text variant=\"sm\">{LOREM}</Text>,\n },\n { title: \"Modal Title\" },\n { title: \"100% Width\", width: \"100%\" },\n { title: \"Responsive Width\", width: [\"100%\", 550] },\n {\n title:\n \"Modal Title with a longer title or headline text that runs on for mutliple lines\",\n },\n { hasLogo: true },\n { title: \"Modal Title\", hasLogo: true },\n {\n children: <Text variant=\"sm\">{LOREM}</Text>,\n footer: <Button width=\"100%\">Confirm</Button>,\n },\n { title: \"Modal Title\", footer: <Button width=\"100%\">Confirm</Button> },\n {\n title:\n \"Modal Title with a longer title or headline text that runs on for mutliple lines\",\n footer: <Button width=\"100%\">Confirm</Button>,\n },\n {\n title:\n \"Modal Title with a longer title or headline text that runs on for mutliple lines\",\n hasLogo: true,\n footer: <Button width=\"100%\">Confirm</Button>,\n },\n ]}\n >\n {(props) => <Demo {...props} />}\n </States>\n )\n}\n"],"file":"ModalDialog.story.js"}
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { BoxProps } from "../Box";
3
+ export interface ModalDialogContentProps extends BoxProps, React.HTMLAttributes<HTMLDivElement> {
4
+ children: React.ReactNode;
5
+ footer?: React.ReactNode;
6
+ hasLogo?: boolean;
7
+ onClose: () => void;
8
+ title?: string;
9
+ }
10
+ export declare const ModalDialogContent: React.FC<ModalDialogContentProps>;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ModalDialogContent = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _Clickable = require("../Clickable");
11
+
12
+ var _shadow = require("../../helpers/shadow");
13
+
14
+ var _Box = require("../Box");
15
+
16
+ var _Flex = require("../Flex");
17
+
18
+ var _Text = require("../Text");
19
+
20
+ var _CloseIcon = require("../../svgs/CloseIcon");
21
+
22
+ var _ArtsyLogoBlackIcon = require("../../svgs/ArtsyLogoBlackIcon");
23
+
24
+ var _useSentinelVisibility = require("../../utils/useSentinelVisibility");
25
+
26
+ var _Spacer = require("../Spacer");
27
+
28
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
+
30
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
31
+
32
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
33
+
34
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
35
+
36
+ var ModalDialogContent = function ModalDialogContent(_ref) {
37
+ var children = _ref.children,
38
+ footer = _ref.footer,
39
+ hasLogo = _ref.hasLogo,
40
+ onClose = _ref.onClose,
41
+ title = _ref.title,
42
+ rest = _objectWithoutProperties(_ref, ["children", "footer", "hasLogo", "onClose", "title"]);
43
+
44
+ var _useSentinelVisibilit = (0, _useSentinelVisibility.useSentinelVisibility)(),
45
+ topSentinel = _useSentinelVisibilit.sentinel,
46
+ isAtTop = _useSentinelVisibilit.isSentinelVisible;
47
+
48
+ var _useSentinelVisibilit2 = (0, _useSentinelVisibility.useSentinelVisibility)(),
49
+ bottomSentinel = _useSentinelVisibilit2.sentinel,
50
+ isAtBottom = _useSentinelVisibilit2.isSentinelVisible;
51
+
52
+ return /*#__PURE__*/_react.default.createElement(_Flex.Flex, _extends({
53
+ bg: "white100",
54
+ flexDirection: "column",
55
+ overflow: "hidden",
56
+ m: 2,
57
+ style: {
58
+ boxShadow: _shadow.DROP_SHADOW
59
+ }
60
+ }, rest), /*#__PURE__*/_react.default.createElement(_Flex.Flex, {
61
+ alignItems: "flex-start",
62
+ justifyContent: "space-between",
63
+ style: {
64
+ transition: "box-shadow 250ms",
65
+ boxShadow: isAtTop ? _shadow.DROP_SHADOW : undefined
66
+ }
67
+ }, (title || hasLogo) && /*#__PURE__*/_react.default.createElement(_Box.Box, {
68
+ m: 2
69
+ }, hasLogo && /*#__PURE__*/_react.default.createElement(_ArtsyLogoBlackIcon.ArtsyLogoBlackIcon, {
70
+ display: "block",
71
+ style: {
72
+ width: "75px",
73
+ height: "26px"
74
+ }
75
+ }), hasLogo && title && /*#__PURE__*/_react.default.createElement(_Spacer.Spacer, {
76
+ mt: 2
77
+ }), title && /*#__PURE__*/_react.default.createElement(_Text.Text, {
78
+ variant: "lg"
79
+ }, title)), /*#__PURE__*/_react.default.createElement(_Clickable.Clickable, {
80
+ p: 2,
81
+ ml: "auto",
82
+ onClick: onClose,
83
+ "aria-label": "Close"
84
+ }, /*#__PURE__*/_react.default.createElement(_CloseIcon.CloseIcon, {
85
+ fill: "black100",
86
+ display: "block"
87
+ }))), /*#__PURE__*/_react.default.createElement(_Box.Box, {
88
+ px: 2,
89
+ pb: 2,
90
+ flex: 1,
91
+ overflow: "auto",
92
+ style: {
93
+ WebkitOverflowScrolling: "touch"
94
+ }
95
+ }, topSentinel, children, bottomSentinel), footer && /*#__PURE__*/_react.default.createElement(_Box.Box, {
96
+ p: 2,
97
+ style: {
98
+ transition: "box-shadow 250ms",
99
+ boxShadow: isAtBottom ? _shadow.DROP_SHADOW : undefined
100
+ }
101
+ }, footer));
102
+ };
103
+
104
+ exports.ModalDialogContent = ModalDialogContent;
105
+ ModalDialogContent.displayName = "ModalDialogContent";
106
+ //# sourceMappingURL=ModalDialogContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/elements/ModalDialog/ModalDialogContent.tsx"],"names":["ModalDialogContent","children","footer","hasLogo","onClose","title","rest","topSentinel","sentinel","isAtTop","isSentinelVisible","bottomSentinel","isAtBottom","boxShadow","DROP_SHADOW","transition","undefined","width","height","WebkitOverflowScrolling"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAYO,IAAMA,kBAAqD,GAAG,SAAxDA,kBAAwD,OAO/D;AAAA,MANJC,QAMI,QANJA,QAMI;AAAA,MALJC,MAKI,QALJA,MAKI;AAAA,MAJJC,OAII,QAJJA,OAII;AAAA,MAHJC,OAGI,QAHJA,OAGI;AAAA,MAFJC,KAEI,QAFJA,KAEI;AAAA,MADDC,IACC;;AAAA,8BAIA,mDAJA;AAAA,MAEQC,WAFR,yBAEFC,QAFE;AAAA,MAGiBC,OAHjB,yBAGFC,iBAHE;;AAAA,+BASA,mDATA;AAAA,MAOQC,cAPR,0BAOFH,QAPE;AAAA,MAQiBI,UARjB,0BAQFF,iBARE;;AAWJ,sBACE,6BAAC,UAAD;AACE,IAAA,EAAE,EAAC,UADL;AAEE,IAAA,aAAa,EAAC,QAFhB;AAGE,IAAA,QAAQ,EAAC,QAHX;AAIE,IAAA,CAAC,EAAE,CAJL;AAKE,IAAA,KAAK,EAAE;AAAEG,MAAAA,SAAS,EAAEC;AAAb;AALT,KAMMR,IANN,gBAQE,6BAAC,UAAD;AACE,IAAA,UAAU,EAAC,YADb;AAEE,IAAA,cAAc,EAAC,eAFjB;AAGE,IAAA,KAAK,EAAE;AACLS,MAAAA,UAAU,EAAE,kBADP;AAELF,MAAAA,SAAS,EAAEJ,OAAO,GAAGK,mBAAH,GAAiBE;AAF9B;AAHT,KAQG,CAACX,KAAK,IAAIF,OAAV,kBACC,6BAAC,QAAD;AAAK,IAAA,CAAC,EAAE;AAAR,KACGA,OAAO,iBACN,6BAAC,sCAAD;AACE,IAAA,OAAO,EAAC,OADV;AAEE,IAAA,KAAK,EAAE;AAAEc,MAAAA,KAAK,EAAE,MAAT;AAAiBC,MAAAA,MAAM,EAAE;AAAzB;AAFT,IAFJ,EAQGf,OAAO,IAAIE,KAAX,iBAAoB,6BAAC,cAAD;AAAQ,IAAA,EAAE,EAAE;AAAZ,IARvB,EAUGA,KAAK,iBAAI,6BAAC,UAAD;AAAM,IAAA,OAAO,EAAC;AAAd,KAAoBA,KAApB,CAVZ,CATJ,eAuBE,6BAAC,oBAAD;AAAW,IAAA,CAAC,EAAE,CAAd;AAAiB,IAAA,EAAE,EAAC,MAApB;AAA2B,IAAA,OAAO,EAAED,OAApC;AAA6C,kBAAW;AAAxD,kBACE,6BAAC,oBAAD;AAAW,IAAA,IAAI,EAAC,UAAhB;AAA2B,IAAA,OAAO,EAAC;AAAnC,IADF,CAvBF,CARF,eAoCE,6BAAC,QAAD;AACE,IAAA,EAAE,EAAE,CADN;AAEE,IAAA,EAAE,EAAE,CAFN;AAGE,IAAA,IAAI,EAAE,CAHR;AAIE,IAAA,QAAQ,EAAC,MAJX;AAKE,IAAA,KAAK,EAAE;AAAEe,MAAAA,uBAAuB,EAAE;AAA3B;AALT,KAOGZ,WAPH,EAQGN,QARH,EASGU,cATH,CApCF,EAgDGT,MAAM,iBACL,6BAAC,QAAD;AACE,IAAA,CAAC,EAAE,CADL;AAEE,IAAA,KAAK,EAAE;AACLa,MAAAA,UAAU,EAAE,kBADP;AAELF,MAAAA,SAAS,EAAED,UAAU,GAAGE,mBAAH,GAAiBE;AAFjC;AAFT,KAOGd,MAPH,CAjDJ,CADF;AA8DD,CAhFM;;;AAAMF,kB","sourcesContent":["import React from \"react\"\nimport { Clickable } from \"../Clickable\"\nimport { DROP_SHADOW } from \"../../helpers/shadow\"\nimport { Box, BoxProps } from \"../Box\"\nimport { Flex } from \"../Flex\"\nimport { Text } from \"../Text\"\nimport { CloseIcon } from \"../../svgs/CloseIcon\"\nimport { ArtsyLogoBlackIcon } from \"../../svgs/ArtsyLogoBlackIcon\"\nimport { useSentinelVisibility } from \"../../utils/useSentinelVisibility\"\nimport { Spacer } from \"../Spacer\"\n\nexport interface ModalDialogContentProps\n extends BoxProps,\n React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n footer?: React.ReactNode\n hasLogo?: boolean\n onClose: () => void\n title?: string\n}\n\nexport const ModalDialogContent: React.FC<ModalDialogContentProps> = ({\n children,\n footer,\n hasLogo,\n onClose,\n title,\n ...rest\n}) => {\n const {\n sentinel: topSentinel,\n isSentinelVisible: isAtTop,\n } = useSentinelVisibility()\n\n const {\n sentinel: bottomSentinel,\n isSentinelVisible: isAtBottom,\n } = useSentinelVisibility()\n\n return (\n <Flex\n bg=\"white100\"\n flexDirection=\"column\"\n overflow=\"hidden\"\n m={2}\n style={{ boxShadow: DROP_SHADOW }}\n {...rest}\n >\n <Flex\n alignItems=\"flex-start\"\n justifyContent=\"space-between\"\n style={{\n transition: \"box-shadow 250ms\",\n boxShadow: isAtTop ? DROP_SHADOW : undefined,\n }}\n >\n {(title || hasLogo) && (\n <Box m={2}>\n {hasLogo && (\n <ArtsyLogoBlackIcon\n display=\"block\"\n style={{ width: \"75px\", height: \"26px\" }}\n />\n )}\n\n {hasLogo && title && <Spacer mt={2} />}\n\n {title && <Text variant=\"lg\">{title}</Text>}\n </Box>\n )}\n\n <Clickable p={2} ml=\"auto\" onClick={onClose} aria-label=\"Close\">\n <CloseIcon fill=\"black100\" display=\"block\" />\n </Clickable>\n </Flex>\n\n <Box\n px={2}\n pb={2}\n flex={1}\n overflow=\"auto\"\n style={{ WebkitOverflowScrolling: \"touch\" }}\n >\n {topSentinel}\n {children}\n {bottomSentinel}\n </Box>\n\n {footer && (\n <Box\n p={2}\n style={{\n transition: \"box-shadow 250ms\",\n boxShadow: isAtBottom ? DROP_SHADOW : undefined,\n }}\n >\n {footer}\n </Box>\n )}\n </Flex>\n )\n}\n"],"file":"ModalDialogContent.js"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const _default: {
3
+ title: string;
4
+ };
5
+ export default _default;
6
+ export declare const Default: () => JSX.Element;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Default = exports.default = void 0;
7
+
8
+ var _addonActions = require("@storybook/addon-actions");
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _storybookStates = require("storybook-states");
13
+
14
+ var _ModalDialogContent = require("./ModalDialogContent");
15
+
16
+ var _Text = require("../Text");
17
+
18
+ var _Button = require("../Button");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ var _default = {
23
+ title: "Components/ModalDialogContent"
24
+ };
25
+ exports.default = _default;
26
+
27
+ var Default = function Default() {
28
+ return /*#__PURE__*/_react.default.createElement(_storybookStates.States, {
29
+ states: [{
30
+ children: /*#__PURE__*/_react.default.createElement(_Text.Text, {
31
+ variant: "sm"
32
+ }, "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque, neque voluptates! Sapiente, sint magnam. Assumenda, hic eius asperiores iure explicabo itaque accusantium, consectetur aut sit maxime culpa ab aliquid consequatur?")
33
+ }, {
34
+ title: "Modal Title"
35
+ }, {
36
+ title: "Modal Title with a longer title or headline text that runs on for mutliple lines"
37
+ }, {
38
+ hasLogo: true
39
+ }, {
40
+ title: "Modal Title",
41
+ hasLogo: true
42
+ }, {
43
+ children: /*#__PURE__*/_react.default.createElement(_Text.Text, {
44
+ variant: "sm"
45
+ }, "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque, neque voluptates! Sapiente, sint magnam. Assumenda, hic eius asperiores iure explicabo itaque accusantium, consectetur aut sit maxime culpa ab aliquid consequatur?"),
46
+ footer: /*#__PURE__*/_react.default.createElement(_Button.Button, {
47
+ width: "100%"
48
+ }, "Confirm")
49
+ }, {
50
+ title: "Modal Title",
51
+ footer: /*#__PURE__*/_react.default.createElement(_Button.Button, {
52
+ width: "100%"
53
+ }, "Confirm")
54
+ }, {
55
+ title: "Modal Title with a longer title or headline text that runs on for mutliple lines",
56
+ footer: /*#__PURE__*/_react.default.createElement(_Button.Button, {
57
+ width: "100%"
58
+ }, "Confirm")
59
+ }, {
60
+ title: "Modal Title with a longer title or headline text that runs on for mutliple lines",
61
+ hasLogo: true,
62
+ footer: /*#__PURE__*/_react.default.createElement(_Button.Button, {
63
+ width: "100%"
64
+ }, "Confirm")
65
+ }]
66
+ }, /*#__PURE__*/_react.default.createElement(_ModalDialogContent.ModalDialogContent, {
67
+ onClose: (0, _addonActions.action)("onClose"),
68
+ maxHeight: 400
69
+ }, /*#__PURE__*/_react.default.createElement(_Text.Text, {
70
+ variant: "sm"
71
+ }, "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque, neque voluptates! Sapiente, sint magnam. Assumenda, hic eius asperiores iure explicabo itaque accusantium, consectetur aut sit maxime culpa ab aliquid consequatur? Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quam enim vel accusamus dolor voluptatibus? Cumque dicta blanditiis debitis rerum asperiores quae nihil minima praesentium, quaerat cupiditate amet dolor similique corporis? Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quibusdam, eaque placeat mollitia aliquam porro molestiae recusandae eos iusto obcaecati quo ducimus in iure tenetur vitae animi ullam nisi voluptatem inventore! Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque, neque voluptates! Sapiente, sint magnam. Assumenda, hic eius asperiores iure explicabo itaque accusantium, consectetur aut sit maxime culpa ab aliquid consequatur? Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quam enim vel accusamus dolor voluptatibus? Cumque dicta blanditiis debitis rerum asperiores quae nihil minima praesentium, quaerat cupiditate amet dolor similique corporis? Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quibusdam, eaque placeat mollitia aliquam porro molestiae recusandae eos iusto obcaecati quo ducimus in iure tenetur vitae animi ullam nisi voluptatem inventore! Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque, neque voluptates! Sapiente, sint magnam. Assumenda, hic eius asperiores iure explicabo itaque accusantium, consectetur aut sit maxime culpa ab aliquid consequatur? Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quam enim vel accusamus dolor voluptatibus? Cumque dicta blanditiis debitis rerum asperiores quae nihil minima praesentium, quaerat cupiditate amet dolor similique corporis? Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quibusdam, eaque placeat mollitia aliquam porro molestiae recusandae eos iusto obcaecati quo ducimus in iure tenetur vitae animi ullam nisi voluptatem inventore! Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque, neque voluptates! Sapiente, sint magnam. Assumenda, hic eius asperiores iure explicabo itaque accusantium, consectetur aut sit maxime culpa ab aliquid consequatur? Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quam enim vel accusamus dolor voluptatibus? Cumque dicta blanditiis debitis rerum asperiores quae nihil minima praesentium, quaerat cupiditate amet dolor similique corporis? Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quibusdam, eaque placeat mollitia aliquam porro molestiae recusandae eos iusto obcaecati quo ducimus in iure tenetur vitae animi ullam nisi voluptatem inventore!")));
72
+ };
73
+
74
+ exports.Default = Default;
75
+ Default.displayName = "Default";
76
+ //# sourceMappingURL=ModalDialogContent.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/elements/ModalDialog/ModalDialogContent.story.tsx"],"names":["title","Default","children","hasLogo","footer"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAIA;;AACA;;;;eAEe;AACbA,EAAAA,KAAK,EAAE;AADM,C;;;AAIR,IAAMC,OAAO,GAAG,SAAVA,OAAU,GAAM;AAC3B,sBACE,6BAAC,uBAAD;AACE,IAAA,MAAM,EAAE,CACN;AACEC,MAAAA,QAAQ,eACN,6BAAC,UAAD;AAAM,QAAA,OAAO,EAAC;AAAd;AAFJ,KADM,EAWN;AAAEF,MAAAA,KAAK,EAAE;AAAT,KAXM,EAYN;AACEA,MAAAA,KAAK,EACH;AAFJ,KAZM,EAgBN;AAAEG,MAAAA,OAAO,EAAE;AAAX,KAhBM,EAiBN;AAAEH,MAAAA,KAAK,EAAE,aAAT;AAAwBG,MAAAA,OAAO,EAAE;AAAjC,KAjBM,EAkBN;AACED,MAAAA,QAAQ,eACN,6BAAC,UAAD;AAAM,QAAA,OAAO,EAAC;AAAd,gPAFJ;AASEE,MAAAA,MAAM,eAAE,6BAAC,cAAD;AAAQ,QAAA,KAAK,EAAC;AAAd;AATV,KAlBM,EA6BN;AAAEJ,MAAAA,KAAK,EAAE,aAAT;AAAwBI,MAAAA,MAAM,eAAE,6BAAC,cAAD;AAAQ,QAAA,KAAK,EAAC;AAAd;AAAhC,KA7BM,EA8BN;AACEJ,MAAAA,KAAK,EACH,kFAFJ;AAGEI,MAAAA,MAAM,eAAE,6BAAC,cAAD;AAAQ,QAAA,KAAK,EAAC;AAAd;AAHV,KA9BM,EAmCN;AACEJ,MAAAA,KAAK,EACH,kFAFJ;AAGEG,MAAAA,OAAO,EAAE,IAHX;AAIEC,MAAAA,MAAM,eAAE,6BAAC,cAAD;AAAQ,QAAA,KAAK,EAAC;AAAd;AAJV,KAnCM;AADV,kBA4CE,6BAAC,sCAAD;AAAoB,IAAA,OAAO,EAAE,0BAAO,SAAP,CAA7B;AAAgD,IAAA,SAAS,EAAE;AAA3D,kBACE,6BAAC,UAAD;AAAM,IAAA,OAAO,EAAC;AAAd,2qFADF,CA5CF,CADF;AA4FD,CA7FM;;;AAAMH,O","sourcesContent":["import { action } from \"@storybook/addon-actions\"\nimport React from \"react\"\nimport { States } from \"storybook-states\"\nimport {\n ModalDialogContent,\n ModalDialogContentProps,\n} from \"./ModalDialogContent\"\nimport { Text } from \"../Text\"\nimport { Button } from \"../Button\"\n\nexport default {\n title: \"Components/ModalDialogContent\",\n}\n\nexport const Default = () => {\n return (\n <States<Partial<ModalDialogContentProps>>\n states={[\n {\n children: (\n <Text variant=\"sm\">\n Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque,\n neque voluptates! Sapiente, sint magnam. Assumenda, hic eius\n asperiores iure explicabo itaque accusantium, consectetur aut sit\n maxime culpa ab aliquid consequatur?\n </Text>\n ),\n },\n { title: \"Modal Title\" },\n {\n title:\n \"Modal Title with a longer title or headline text that runs on for mutliple lines\",\n },\n { hasLogo: true },\n { title: \"Modal Title\", hasLogo: true },\n {\n children: (\n <Text variant=\"sm\">\n Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque,\n neque voluptates! Sapiente, sint magnam. Assumenda, hic eius\n asperiores iure explicabo itaque accusantium, consectetur aut sit\n maxime culpa ab aliquid consequatur?\n </Text>\n ),\n footer: <Button width=\"100%\">Confirm</Button>,\n },\n { title: \"Modal Title\", footer: <Button width=\"100%\">Confirm</Button> },\n {\n title:\n \"Modal Title with a longer title or headline text that runs on for mutliple lines\",\n footer: <Button width=\"100%\">Confirm</Button>,\n },\n {\n title:\n \"Modal Title with a longer title or headline text that runs on for mutliple lines\",\n hasLogo: true,\n footer: <Button width=\"100%\">Confirm</Button>,\n },\n ]}\n >\n <ModalDialogContent onClose={action(\"onClose\")} maxHeight={400}>\n <Text variant=\"sm\">\n Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque, neque\n voluptates! Sapiente, sint magnam. Assumenda, hic eius asperiores iure\n explicabo itaque accusantium, consectetur aut sit maxime culpa ab\n aliquid consequatur? Lorem, ipsum dolor sit amet consectetur\n adipisicing elit. Quam enim vel accusamus dolor voluptatibus? Cumque\n dicta blanditiis debitis rerum asperiores quae nihil minima\n praesentium, quaerat cupiditate amet dolor similique corporis? Lorem,\n ipsum dolor sit amet consectetur adipisicing elit. Quibusdam, eaque\n placeat mollitia aliquam porro molestiae recusandae eos iusto\n obcaecati quo ducimus in iure tenetur vitae animi ullam nisi\n voluptatem inventore! Lorem ipsum, dolor sit amet consectetur\n adipisicing elit. Eaque, neque voluptates! Sapiente, sint magnam.\n Assumenda, hic eius asperiores iure explicabo itaque accusantium,\n consectetur aut sit maxime culpa ab aliquid consequatur? Lorem, ipsum\n dolor sit amet consectetur adipisicing elit. Quam enim vel accusamus\n dolor voluptatibus? Cumque dicta blanditiis debitis rerum asperiores\n quae nihil minima praesentium, quaerat cupiditate amet dolor similique\n corporis? Lorem, ipsum dolor sit amet consectetur adipisicing elit.\n Quibusdam, eaque placeat mollitia aliquam porro molestiae recusandae\n eos iusto obcaecati quo ducimus in iure tenetur vitae animi ullam nisi\n voluptatem inventore! Lorem ipsum, dolor sit amet consectetur\n adipisicing elit. Eaque, neque voluptates! Sapiente, sint magnam.\n Assumenda, hic eius asperiores iure explicabo itaque accusantium,\n consectetur aut sit maxime culpa ab aliquid consequatur? Lorem, ipsum\n dolor sit amet consectetur adipisicing elit. Quam enim vel accusamus\n dolor voluptatibus? Cumque dicta blanditiis debitis rerum asperiores\n quae nihil minima praesentium, quaerat cupiditate amet dolor similique\n corporis? Lorem, ipsum dolor sit amet consectetur adipisicing elit.\n Quibusdam, eaque placeat mollitia aliquam porro molestiae recusandae\n eos iusto obcaecati quo ducimus in iure tenetur vitae animi ullam nisi\n voluptatem inventore! Lorem ipsum, dolor sit amet consectetur\n adipisicing elit. Eaque, neque voluptates! Sapiente, sint magnam.\n Assumenda, hic eius asperiores iure explicabo itaque accusantium,\n consectetur aut sit maxime culpa ab aliquid consequatur? Lorem, ipsum\n dolor sit amet consectetur adipisicing elit. Quam enim vel accusamus\n dolor voluptatibus? Cumque dicta blanditiis debitis rerum asperiores\n quae nihil minima praesentium, quaerat cupiditate amet dolor similique\n corporis? Lorem, ipsum dolor sit amet consectetur adipisicing elit.\n Quibusdam, eaque placeat mollitia aliquam porro molestiae recusandae\n eos iusto obcaecati quo ducimus in iure tenetur vitae animi ullam nisi\n voluptatem inventore!\n </Text>\n </ModalDialogContent>\n </States>\n )\n}\n"],"file":"ModalDialogContent.story.js"}
@@ -0,0 +1,2 @@
1
+ export * from "./ModalDialog";
2
+ export * from "./ModalDialogContent";
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _ModalDialog = require("./ModalDialog");
8
+
9
+ Object.keys(_ModalDialog).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _ModalDialog[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _ModalDialog[key];
16
+ }
17
+ });
18
+ });
19
+
20
+ var _ModalDialogContent = require("./ModalDialogContent");
21
+
22
+ Object.keys(_ModalDialogContent).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _ModalDialogContent[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function get() {
28
+ return _ModalDialogContent[key];
29
+ }
30
+ });
31
+ });
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/elements/ModalDialog/index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./ModalDialog\"\nexport * from \"./ModalDialogContent\"\n"],"file":"index.js"}
@@ -34,6 +34,7 @@ export * from "./Link";
34
34
  export * from "./Menu";
35
35
  export * from "./Message";
36
36
  export * from "./Modal";
37
+ export * from "./ModalDialog";
37
38
  export * from "./MultiSelect";
38
39
  export * from "./Pagination";
39
40
  export * from "./PasswordInput";
@@ -472,6 +472,19 @@ Object.keys(_Modal).forEach(function (key) {
472
472
  });
473
473
  });
474
474
 
475
+ var _ModalDialog = require("./ModalDialog");
476
+
477
+ Object.keys(_ModalDialog).forEach(function (key) {
478
+ if (key === "default" || key === "__esModule") return;
479
+ if (key in exports && exports[key] === _ModalDialog[key]) return;
480
+ Object.defineProperty(exports, key, {
481
+ enumerable: true,
482
+ get: function get() {
483
+ return _ModalDialog[key];
484
+ }
485
+ });
486
+ });
487
+
475
488
  var _MultiSelect = require("./MultiSelect");
476
489
 
477
490
  Object.keys(_MultiSelect).forEach(function (key) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/elements/index.tsx"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./AutocompleteInput\"\nexport * from \"./Avatar\"\nexport * from \"./Banner\"\nexport * from \"./BaseTabs\"\nexport * from \"./BorderBox\"\nexport * from \"./BorderedRadio\"\nexport * from \"./Box\"\nexport * from \"./Breadcrumbs\"\nexport * from \"./Button\"\nexport * from \"./Cards\"\nexport * from \"./Carousel\"\nexport * from \"./CarouselBar\"\nexport * from \"./Checkbox\"\nexport * from \"./CleanTag\"\nexport * from \"./Clickable\"\nexport * from \"./Collapse\"\nexport * from \"./Colors\"\nexport * from \"./CSSGrid\"\nexport * from \"./Dialog\"\nexport * from \"./Dropdown\"\nexport * from \"./EntityHeader\"\nexport * from \"./Expandable\"\nexport * from \"./Flex\"\nexport * from \"./FullBleed\"\nexport * from \"./Grid\"\nexport * from \"./GridColumns\"\nexport * from \"./HorizontalOverflow\"\nexport * from \"./HTML\"\nexport * from \"./Image\"\nexport * from \"./Input\"\nexport * from \"./Join\"\nexport * from \"./LabeledInput\"\nexport * from \"./Link\"\nexport * from \"./Menu\"\nexport * from \"./Message\"\nexport * from \"./Modal\"\nexport * from \"./MultiSelect\"\nexport * from \"./Pagination\"\nexport * from \"./PasswordInput\"\nexport * from \"./Pill\"\nexport * from \"./Popover\"\nexport * from \"./ProgressBar\"\nexport * from \"./ProgressBarTimer\"\nexport * from \"./ProgressDots\"\nexport * from \"./Radio\"\nexport * from \"./RadioGroup\"\nexport * from \"./ReadMore\"\nexport * from \"./ResponsiveBox\"\nexport * from \"./Select\"\nexport * from \"./Separator\"\nexport * from \"./Shelf\"\nexport * from \"./Skeleton\"\nexport * from \"./Skip\"\nexport * from \"./Spacer\"\nexport * from \"./Spinner\"\nexport * from \"./StackableBorderBox\"\nexport * from \"./StaticCountdownTimer\"\nexport * from \"./Stepper\"\nexport * from \"./Sup\"\nexport * from \"./Swiper\"\nexport * from \"./Tabs\"\nexport * from \"./Tags\"\nexport * from \"./Text\"\nexport * from \"./TextArea\"\nexport * from \"./TimeRemaining\"\nexport * from \"./Toasts\"\nexport * from \"./Toggle\"\nexport * from \"./Tooltip\"\nexport * from \"./Typography\"\nexport * from \"./VisuallyHidden\"\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/elements/index.tsx"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAA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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./AutocompleteInput\"\nexport * from \"./Avatar\"\nexport * from \"./Banner\"\nexport * from \"./BaseTabs\"\nexport * from \"./BorderBox\"\nexport * from \"./BorderedRadio\"\nexport * from \"./Box\"\nexport * from \"./Breadcrumbs\"\nexport * from \"./Button\"\nexport * from \"./Cards\"\nexport * from \"./Carousel\"\nexport * from \"./CarouselBar\"\nexport * from \"./Checkbox\"\nexport * from \"./CleanTag\"\nexport * from \"./Clickable\"\nexport * from \"./Collapse\"\nexport * from \"./Colors\"\nexport * from \"./CSSGrid\"\nexport * from \"./Dialog\"\nexport * from \"./Dropdown\"\nexport * from \"./EntityHeader\"\nexport * from \"./Expandable\"\nexport * from \"./Flex\"\nexport * from \"./FullBleed\"\nexport * from \"./Grid\"\nexport * from \"./GridColumns\"\nexport * from \"./HorizontalOverflow\"\nexport * from \"./HTML\"\nexport * from \"./Image\"\nexport * from \"./Input\"\nexport * from \"./Join\"\nexport * from \"./LabeledInput\"\nexport * from \"./Link\"\nexport * from \"./Menu\"\nexport * from \"./Message\"\nexport * from \"./Modal\"\nexport * from \"./ModalDialog\"\nexport * from \"./MultiSelect\"\nexport * from \"./Pagination\"\nexport * from \"./PasswordInput\"\nexport * from \"./Pill\"\nexport * from \"./Popover\"\nexport * from \"./ProgressBar\"\nexport * from \"./ProgressBarTimer\"\nexport * from \"./ProgressDots\"\nexport * from \"./Radio\"\nexport * from \"./RadioGroup\"\nexport * from \"./ReadMore\"\nexport * from \"./ResponsiveBox\"\nexport * from \"./Select\"\nexport * from \"./Separator\"\nexport * from \"./Shelf\"\nexport * from \"./Skeleton\"\nexport * from \"./Skip\"\nexport * from \"./Spacer\"\nexport * from \"./Spinner\"\nexport * from \"./StackableBorderBox\"\nexport * from \"./StaticCountdownTimer\"\nexport * from \"./Stepper\"\nexport * from \"./Sup\"\nexport * from \"./Swiper\"\nexport * from \"./Tabs\"\nexport * from \"./Tags\"\nexport * from \"./Text\"\nexport * from \"./TextArea\"\nexport * from \"./TimeRemaining\"\nexport * from \"./Toasts\"\nexport * from \"./Toggle\"\nexport * from \"./Tooltip\"\nexport * from \"./Typography\"\nexport * from \"./VisuallyHidden\"\n"],"file":"index.js"}
@@ -1,8 +1,10 @@
1
1
  export * from "./useClickOutside";
2
2
  export * from "./useContainsFocus";
3
+ export * from "./useDidMount";
3
4
  export * from "./useFocusLock";
4
5
  export * from "./useIsomorphicLayoutEffect";
5
6
  export * from "./useMutationObserver";
6
7
  export * from "./usePosition";
8
+ export * from "./useSentinelVisibility";
7
9
  export * from "./useUpdateEffect";
8
10
  export * from "./useWidthOf";
@@ -30,6 +30,19 @@ Object.keys(_useContainsFocus).forEach(function (key) {
30
30
  });
31
31
  });
32
32
 
33
+ var _useDidMount = require("./useDidMount");
34
+
35
+ Object.keys(_useDidMount).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _useDidMount[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function get() {
41
+ return _useDidMount[key];
42
+ }
43
+ });
44
+ });
45
+
33
46
  var _useFocusLock = require("./useFocusLock");
34
47
 
35
48
  Object.keys(_useFocusLock).forEach(function (key) {
@@ -82,6 +95,19 @@ Object.keys(_usePosition).forEach(function (key) {
82
95
  });
83
96
  });
84
97
 
98
+ var _useSentinelVisibility = require("./useSentinelVisibility");
99
+
100
+ Object.keys(_useSentinelVisibility).forEach(function (key) {
101
+ if (key === "default" || key === "__esModule") return;
102
+ if (key in exports && exports[key] === _useSentinelVisibility[key]) return;
103
+ Object.defineProperty(exports, key, {
104
+ enumerable: true,
105
+ get: function get() {
106
+ return _useSentinelVisibility[key];
107
+ }
108
+ });
109
+ });
110
+
85
111
  var _useUpdateEffect = require("./useUpdateEffect");
86
112
 
87
113
  Object.keys(_useUpdateEffect).forEach(function (key) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./useClickOutside\"\nexport * from \"./useContainsFocus\"\nexport * from \"./useFocusLock\"\nexport * from \"./useIsomorphicLayoutEffect\"\nexport * from \"./useMutationObserver\"\nexport * from \"./usePosition\"\nexport * from \"./useUpdateEffect\"\nexport * from \"./useWidthOf\"\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./useClickOutside\"\nexport * from \"./useContainsFocus\"\nexport * from \"./useDidMount\"\nexport * from \"./useFocusLock\"\nexport * from \"./useIsomorphicLayoutEffect\"\nexport * from \"./useMutationObserver\"\nexport * from \"./usePosition\"\nexport * from \"./useSentinelVisibility\"\nexport * from \"./useUpdateEffect\"\nexport * from \"./useWidthOf\"\n"],"file":"index.js"}
@@ -0,0 +1 @@
1
+ export declare const useDidMount: (defaultMounted?: boolean) => boolean;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useOnScroll = void 0;
6
+ exports.useDidMount = void 0;
7
7
 
8
8
  var _react = require("react");
9
9
 
@@ -19,40 +19,19 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
19
19
 
20
20
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
21
 
22
- /**
23
- * useOnScroll is used to track if an element is scrolled vertically or not
24
- */
25
- var useOnScroll = function useOnScroll() {
26
- var _useState = (0, _react.useState)(false),
22
+ var useDidMount = function useDidMount() {
23
+ var defaultMounted = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
24
+
25
+ var _useState = (0, _react.useState)(defaultMounted),
27
26
  _useState2 = _slicedToArray(_useState, 2),
28
- isScrolled = _useState2[0],
29
- setIsScrolled = _useState2[1];
27
+ isMounted = _useState2[0],
28
+ toggleMounted = _useState2[1];
30
29
 
31
- var elementRef = (0, _react.useRef)(null);
32
- var node = elementRef.current;
33
30
  (0, _react.useEffect)(function () {
34
- if (!("IntersectionObserver" in window)) return;
35
- if (!node) return;
36
- var observer = new IntersectionObserver(function (_ref) {
37
- var _ref2 = _slicedToArray(_ref, 1),
38
- entry = _ref2[0];
39
-
40
- setIsScrolled(!entry.isIntersecting);
41
- }, {
42
- root: null,
43
- rootMargin: "0px",
44
- threshold: 1.0
45
- });
46
- observer.observe(node);
47
- return function () {
48
- observer.unobserve(node);
49
- };
50
- }, [node, isScrolled]);
51
- return {
52
- isScrolled: isScrolled,
53
- elementRef: elementRef
54
- };
31
+ toggleMounted(true);
32
+ }, []);
33
+ return isMounted;
55
34
  };
56
35
 
57
- exports.useOnScroll = useOnScroll;
58
- //# sourceMappingURL=useOnScroll.js.map
36
+ exports.useDidMount = useDidMount;
37
+ //# sourceMappingURL=useDidMount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/useDidMount.ts"],"names":["useDidMount","defaultMounted","isMounted","toggleMounted"],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;AAEO,IAAMA,WAAW,GAAG,SAAdA,WAAc,GAA4B;AAAA,MAA3BC,cAA2B,uEAAV,KAAU;;AAAA,kBAClB,qBAASA,cAAT,CADkB;AAAA;AAAA,MAC9CC,SAD8C;AAAA,MACnCC,aADmC;;AAGrD,wBAAU,YAAM;AACdA,IAAAA,aAAa,CAAC,IAAD,CAAb;AACD,GAFD,EAEG,EAFH;AAIA,SAAOD,SAAP;AACD,CARM","sourcesContent":["import { useEffect, useState } from \"react\"\n\nexport const useDidMount = (defaultMounted = false) => {\n const [isMounted, toggleMounted] = useState(defaultMounted)\n\n useEffect(() => {\n toggleMounted(true)\n }, [])\n\n return isMounted\n}\n"],"file":"useDidMount.js"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Used to track if the returned sentinel is in the viewport or not
4
+ */
5
+ export declare const useSentinelVisibility: () => {
6
+ isSentinelVisible: boolean;
7
+ sentinel: JSX.Element;
8
+ };
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.useSentinelVisibility = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _Box = require("../elements/Box");
13
+
14
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
15
+
16
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+
18
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
19
+
20
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
+
22
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
23
+
24
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
25
+
26
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
27
+
28
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
+
30
+ /**
31
+ * Used to track if the returned sentinel is in the viewport or not
32
+ */
33
+ var useSentinelVisibility = function useSentinelVisibility() {
34
+ var _useState = (0, _react.useState)(false),
35
+ _useState2 = _slicedToArray(_useState, 2),
36
+ isSentinelVisible = _useState2[0],
37
+ setSentinelVisibility = _useState2[1];
38
+
39
+ var ref = (0, _react.useRef)(null);
40
+ (0, _react.useEffect)(function () {
41
+ if (!("IntersectionObserver" in window)) return; // Unsupported
42
+
43
+ var element = ref.current;
44
+ if (!element) return;
45
+ var observer = new IntersectionObserver(function (_ref) {
46
+ var _ref2 = _slicedToArray(_ref, 1),
47
+ entry = _ref2[0];
48
+
49
+ setSentinelVisibility(!entry.isIntersecting);
50
+ }, {
51
+ root: null,
52
+ rootMargin: "0px",
53
+ threshold: 1.0
54
+ });
55
+ observer.observe(element);
56
+ return function () {
57
+ observer.unobserve(element);
58
+ };
59
+ }, [isSentinelVisible]);
60
+ return {
61
+ isSentinelVisible: isSentinelVisible,
62
+ sentinel: /*#__PURE__*/_react.default.createElement(_Box.Box, {
63
+ ref: ref,
64
+ position: "relative",
65
+ width: "100%",
66
+ height: 0
67
+ })
68
+ };
69
+ };
70
+
71
+ exports.useSentinelVisibility = useSentinelVisibility;
72
+ //# sourceMappingURL=useSentinelVisibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/useSentinelVisibility.tsx"],"names":["useSentinelVisibility","isSentinelVisible","setSentinelVisibility","ref","window","element","current","observer","IntersectionObserver","entry","isIntersecting","root","rootMargin","threshold","observe","unobserve","sentinel"],"mappings":";;;;;;;;;AAAA;;AACA;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACO,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAwB,GAAM;AAAA,kBACU,qBAAS,KAAT,CADV;AAAA;AAAA,MAClCC,iBADkC;AAAA,MACfC,qBADe;;AAEzC,MAAMC,GAAG,GAAG,mBAA2B,IAA3B,CAAZ;AAEA,wBAAU,YAAM;AACd,QAAI,EAAE,0BAA0BC,MAA5B,CAAJ,EAAyC,OAD3B,CACkC;;AAEhD,QAAMC,OAAO,GAAGF,GAAG,CAACG,OAApB;AACA,QAAI,CAACD,OAAL,EAAc;AAEd,QAAME,QAAQ,GAAG,IAAIC,oBAAJ,CACf,gBAAa;AAAA;AAAA,UAAXC,KAAW;;AACXP,MAAAA,qBAAqB,CAAC,CAACO,KAAK,CAACC,cAAR,CAArB;AACD,KAHc,EAIf;AACEC,MAAAA,IAAI,EAAE,IADR;AAEEC,MAAAA,UAAU,EAAE,KAFd;AAGEC,MAAAA,SAAS,EAAE;AAHb,KAJe,CAAjB;AAWAN,IAAAA,QAAQ,CAACO,OAAT,CAAiBT,OAAjB;AAEA,WAAO,YAAM;AACXE,MAAAA,QAAQ,CAACQ,SAAT,CAAmBV,OAAnB;AACD,KAFD;AAGD,GAtBD,EAsBG,CAACJ,iBAAD,CAtBH;AAwBA,SAAO;AACLA,IAAAA,iBAAiB,EAAjBA,iBADK;AAELe,IAAAA,QAAQ,eACN,6BAAC,QAAD;AAAK,MAAA,GAAG,EAAEb,GAAV;AAAsB,MAAA,QAAQ,EAAC,UAA/B;AAA0C,MAAA,KAAK,EAAC,MAAhD;AAAuD,MAAA,MAAM,EAAE;AAA/D;AAHG,GAAP;AAMD,CAlCM","sourcesContent":["import React, { useEffect, useState, useRef } from \"react\"\nimport { Box } from \"../elements/Box\"\n\n/**\n * Used to track if the returned sentinel is in the viewport or not\n */\nexport const useSentinelVisibility = () => {\n const [isSentinelVisible, setSentinelVisibility] = useState(false)\n const ref = useRef<HTMLElement | null>(null)\n\n useEffect(() => {\n if (!(\"IntersectionObserver\" in window)) return // Unsupported\n\n const element = ref.current\n if (!element) return\n\n const observer = new IntersectionObserver(\n ([entry]) => {\n setSentinelVisibility(!entry.isIntersecting)\n },\n {\n root: null,\n rootMargin: \"0px\",\n threshold: 1.0,\n }\n )\n\n observer.observe(element)\n\n return () => {\n observer.unobserve(element)\n }\n }, [isSentinelVisible])\n\n return {\n isSentinelVisible,\n sentinel: (\n <Box ref={ref as any} position=\"relative\" width=\"100%\" height={0} />\n ),\n }\n}\n"],"file":"useSentinelVisibility.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/palette",
3
- "version": "18.10.0",
3
+ "version": "18.11.0",
4
4
  "description": "Design system library for react components",
5
5
  "main": "dist/index.js",
6
6
  "publishConfig": {
@@ -174,5 +174,5 @@
174
174
  "<rootDir>/www/"
175
175
  ]
176
176
  },
177
- "gitHead": "5ed1b8df888f52c51ada1bce88adb179d66f88ad"
177
+ "gitHead": "21c3fa9a5b40f0cdec18ececfd229635f30ec9ea"
178
178
  }
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- /**
3
- * useOnScroll is used to track if an element is scrolled vertically or not
4
- */
5
- export declare const useOnScroll: () => {
6
- isScrolled: boolean;
7
- elementRef: import("react").MutableRefObject<null>;
8
- };
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/useOnScroll.ts"],"names":["useOnScroll","isScrolled","setIsScrolled","elementRef","node","current","window","observer","IntersectionObserver","entry","isIntersecting","root","rootMargin","threshold","observe","unobserve"],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;AAEA;AACA;AACA;AACO,IAAMA,WAAW,GAAG,SAAdA,WAAc,GAAM;AAAA,kBACK,qBAAS,KAAT,CADL;AAAA;AAAA,MACxBC,UADwB;AAAA,MACZC,aADY;;AAE/B,MAAMC,UAAU,GAAG,mBAAO,IAAP,CAAnB;AACA,MAAMC,IAAI,GAAGD,UAAU,CAACE,OAAxB;AAEA,wBAAU,YAAM;AACd,QAAI,EAAE,0BAA0BC,MAA5B,CAAJ,EAAyC;AACzC,QAAI,CAACF,IAAL,EAAW;AAEX,QAAMG,QAAQ,GAAG,IAAIC,oBAAJ,CACf,gBAAa;AAAA;AAAA,UAAXC,KAAW;;AACXP,MAAAA,aAAa,CAAC,CAACO,KAAK,CAACC,cAAR,CAAb;AACD,KAHc,EAIf;AACEC,MAAAA,IAAI,EAAE,IADR;AAEEC,MAAAA,UAAU,EAAE,KAFd;AAGEC,MAAAA,SAAS,EAAE;AAHb,KAJe,CAAjB;AAWAN,IAAAA,QAAQ,CAACO,OAAT,CAAiBV,IAAjB;AAEA,WAAO,YAAM;AACXG,MAAAA,QAAQ,CAACQ,SAAT,CAAmBX,IAAnB;AACD,KAFD;AAGD,GApBD,EAoBG,CAACA,IAAD,EAAOH,UAAP,CApBH;AAsBA,SAAO;AAAEA,IAAAA,UAAU,EAAVA,UAAF;AAAcE,IAAAA,UAAU,EAAVA;AAAd,GAAP;AACD,CA5BM","sourcesContent":["import { useEffect, useState, useRef } from \"react\"\n\n/**\n * useOnScroll is used to track if an element is scrolled vertically or not\n */\nexport const useOnScroll = () => {\n const [isScrolled, setIsScrolled] = useState(false)\n const elementRef = useRef(null)\n const node = elementRef.current\n\n useEffect(() => {\n if (!(\"IntersectionObserver\" in window)) return\n if (!node) return\n\n const observer = new IntersectionObserver(\n ([entry]) => {\n setIsScrolled(!entry.isIntersecting)\n },\n {\n root: null,\n rootMargin: \"0px\",\n threshold: 1.0,\n }\n )\n\n observer.observe(node)\n\n return () => {\n observer.unobserve(node)\n }\n }, [node, isScrolled])\n\n return { isScrolled, elementRef }\n}\n"],"file":"useOnScroll.js"}