@uva-glass/component-library 3.21.0 → 3.21.1

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.
@@ -1 +1 @@
1
- ._page-overlay__container_g079c_1{bottom:0;left:0;position:fixed;right:0;top:0;z-index:50}._page-overlay_g079c_1{background:var(--new-color-uva-white);display:flex;flex-direction:column;height:100dvh}._page-overlay--full-screen_g079c_18{width:100vw}._page-overlay--with-gutters_g079c_22{max-width:87.5rem;width:100%}._page-overlay__content_g079c_27{background-color:var(--new-color-grey-300);display:flex;flex-direction:column;height:100svh;justify-content:space-between;overflow:hidden;overflow-y:auto;padding:0 1.5rem;width:100%}._page-overlay__children_g079c_39{padding-bottom:1rem}._page-overlay__title-wrapper_g079c_43{position:relative}._page-overlay__title_g079c_43{font-size:var(--font-size-s);line-height:var(--line-height-m);margin:0 1.5rem 0 0;padding:1rem 1.5rem}._page-overlay__buttons-bar_g079c_54{background-color:var(--new-color-uva-white);bottom:0;display:flex;flex-direction:column;gap:.75rem;justify-content:flex-start;margin:0 -1.5rem;padding:.5rem 1rem;position:sticky;right:0}._page-overlay__buttons-bar_g079c_54:before{background:linear-gradient(to top,#0000004d,#0000);bottom:100%;content:"";height:10px;left:0;opacity:0;pointer-events:none;position:absolute;right:0;transition:opacity .4s ease-out}._page-overlay__buttons-bar--shadow_g079c_80:before{opacity:1}._page-overlay__close_g079c_85{height:1.5rem;position:absolute;right:1rem;top:calc(50% - .125rem);transform:translateY(-50%)}@media (min-width: 28rem) and (min-height: 28rem){._page-overlay--with-gutters_g079c_22{margin:0 .75rem}}
1
+ ._page-overlay__container_1wy1h_1{bottom:0;left:0;position:fixed;right:0;top:0;z-index:50}._page-overlay_1wy1h_1{background:var(--new-color-uva-white);display:flex;flex-direction:column;height:100dvh}._page-overlay--full-screen_1wy1h_18{width:100vw}._page-overlay--with-gutters_1wy1h_22{max-width:87.5rem;width:100%}._page-overlay__content_1wy1h_27{display:flex;flex-direction:column;height:100svh;justify-content:space-between;overflow:hidden;overflow-y:auto;padding:0 1.5rem;width:100%}._page-overlay__content--grey_1wy1h_38{background-color:var(--new-color-grey-300)}._page-overlay__content--white_1wy1h_42{background-color:var(--new-color-uva-white)}._page-overlay__children_1wy1h_46{padding-bottom:1rem}._page-overlay__title-wrapper_1wy1h_50{position:relative}._page-overlay__title_1wy1h_50{font-size:var(--font-size-s);line-height:var(--line-height-m);margin:0 1.5rem 0 0;padding:1rem 1.5rem}._page-overlay__buttons-bar_1wy1h_61{background-color:var(--new-color-uva-white);bottom:0;display:flex;flex-direction:column;gap:.75rem;justify-content:flex-start;margin:0 -1.5rem;padding:.5rem 1rem;position:sticky;right:0}._page-overlay__buttons-bar_1wy1h_61:before{background:linear-gradient(to top,#0000004d,#0000);bottom:100%;content:"";height:10px;left:0;opacity:0;pointer-events:none;position:absolute;right:0;transition:opacity .4s ease-out}._page-overlay__buttons-bar--shadow_1wy1h_87:before{opacity:1}._page-overlay__close_1wy1h_92{height:1.5rem;position:absolute;right:1rem;top:calc(50% - .125rem);transform:translateY(-50%)}@media (min-width: 28rem) and (min-height: 28rem){._page-overlay--with-gutters_1wy1h_22{margin:0 .75rem}}
@@ -22,6 +22,8 @@ export interface PageOverlayProps {
22
22
  headerContent?: ReactNode;
23
23
  /** The variant styling of the dialog. */
24
24
  variant?: 'full-screen' | 'with-gutters';
25
+ /** The content background color of the dialog. Default grey-300*/
26
+ contentBackgroundColor?: 'grey' | 'white';
25
27
  }
26
28
  /** Represents a component for a modal dialog. */
27
- export declare function PageOverlay({ buttons, children, isLoading, spinnerAriaValueText, closeButtonAriaValueText, isOpen, noValidate, onClose, onSubmit, title, headerContent, variant, }: PropsWithChildren<PageOverlayProps>): import("react/jsx-runtime").JSX.Element | null;
29
+ export declare function PageOverlay({ buttons, children, isLoading, spinnerAriaValueText, closeButtonAriaValueText, isOpen, noValidate, onClose, onSubmit, title, headerContent, variant, contentBackgroundColor, }: PropsWithChildren<PageOverlayProps>): import("react/jsx-runtime").JSX.Element | null;
@@ -1,95 +1,102 @@
1
- import { jsx as o, Fragment as j, jsxs as _ } from "react/jsx-runtime";
1
+ import { jsx as o, Fragment as $, jsxs as c } from "react/jsx-runtime";
2
2
  import { useDialog as A } from "@react-aria/dialog";
3
3
  import { FocusScope as C } from "@react-aria/focus";
4
4
  import { useModal as K, useOverlay as M, usePreventScroll as U, OverlayContainer as V } from "@react-aria/overlays";
5
5
  import { c as i } from "../../clsx-OuTLNxxd.js";
6
- import { useRef as d, useState as f, useEffect as $ } from "react";
7
- import { OverlayCloseButton as q } from "../OverlayCloseButton/OverlayCloseButton.js";
8
- import { Spinner as G } from "../Spinner/Spinner.js";
9
- import { Backdrop as J } from "../Backdrop/Backdrop.js";
6
+ import { useRef as m, useState as d, useEffect as q } from "react";
7
+ import { OverlayCloseButton as G } from "../OverlayCloseButton/OverlayCloseButton.js";
8
+ import { Spinner as J } from "../Spinner/Spinner.js";
9
+ import { Backdrop as O } from "../Backdrop/Backdrop.js";
10
10
  import '../../assets/PageOverlay.css';const e = {
11
- "page-overlay__container": "_page-overlay__container_g079c_1",
12
- "page-overlay": "_page-overlay_g079c_1",
13
- "page-overlay--full-screen": "_page-overlay--full-screen_g079c_18",
14
- "page-overlay--with-gutters": "_page-overlay--with-gutters_g079c_22",
15
- "page-overlay__content": "_page-overlay__content_g079c_27",
16
- "page-overlay__children": "_page-overlay__children_g079c_39",
17
- "page-overlay__title-wrapper": "_page-overlay__title-wrapper_g079c_43",
18
- "page-overlay__title": "_page-overlay__title_g079c_43",
19
- "page-overlay__buttons-bar": "_page-overlay__buttons-bar_g079c_54",
20
- "page-overlay__buttons-bar--shadow": "_page-overlay__buttons-bar--shadow_g079c_80",
21
- "page-overlay__close": "_page-overlay__close_g079c_85"
11
+ "page-overlay__container": "_page-overlay__container_1wy1h_1",
12
+ "page-overlay": "_page-overlay_1wy1h_1",
13
+ "page-overlay--full-screen": "_page-overlay--full-screen_1wy1h_18",
14
+ "page-overlay--with-gutters": "_page-overlay--with-gutters_1wy1h_22",
15
+ "page-overlay__content": "_page-overlay__content_1wy1h_27",
16
+ "page-overlay__content--grey": "_page-overlay__content--grey_1wy1h_38",
17
+ "page-overlay__content--white": "_page-overlay__content--white_1wy1h_42",
18
+ "page-overlay__children": "_page-overlay__children_1wy1h_46",
19
+ "page-overlay__title-wrapper": "_page-overlay__title-wrapper_1wy1h_50",
20
+ "page-overlay__title": "_page-overlay__title_1wy1h_50",
21
+ "page-overlay__buttons-bar": "_page-overlay__buttons-bar_1wy1h_61",
22
+ "page-overlay__buttons-bar--shadow": "_page-overlay__buttons-bar--shadow_1wy1h_87",
23
+ "page-overlay__close": "_page-overlay__close_1wy1h_92"
22
24
  };
23
- function ae({
25
+ function le({
24
26
  buttons: t,
25
- children: h,
26
- isLoading: b,
27
- spinnerAriaValueText: w = "Loading",
27
+ children: f,
28
+ isLoading: w,
29
+ spinnerAriaValueText: b = "Loading",
28
30
  closeButtonAriaValueText: S = "Close",
29
31
  isOpen: a,
30
32
  noValidate: N = !1,
31
33
  onClose: p,
32
34
  onSubmit: P,
33
- title: s,
34
- headerContent: c,
35
- variant: g = "full-screen"
35
+ title: _,
36
+ headerContent: n,
37
+ variant: y = "full-screen",
38
+ contentBackgroundColor: T = "grey"
36
39
  }) {
37
- const n = d(null), v = d(null), [T, E] = f(!1), [x, L] = f(!1), { dialogProps: B, titleProps: F } = A({ role: "dialog" }, n), { modalProps: H } = K({ isDisabled: !a }), { overlayProps: k, underlayProps: z } = M({ isOpen: a, onClose: p }, n);
38
- U({ isDisabled: !a }), $(() => {
39
- const r = v.current;
40
+ const s = m(null), g = m(null), [E, x] = d(!1), [L, B] = d(!1), { dialogProps: F, titleProps: H } = A({ role: "dialog" }, s), { modalProps: k } = K({ isDisabled: !a }), { overlayProps: z, underlayProps: D } = M({ isOpen: a, onClose: p }, s);
41
+ U({ isDisabled: !a }), q(() => {
42
+ const r = g.current;
40
43
  if (!r) return;
41
- function u() {
42
- const y = r.scrollHeight, m = r.clientHeight, R = r.scrollTop;
43
- E(y > m), L(R + m >= y);
44
+ function v() {
45
+ const u = r.scrollHeight, h = r.clientHeight, j = r.scrollTop;
46
+ x(u > h), B(j + h >= u);
44
47
  }
45
48
  function l() {
46
- u();
49
+ v();
47
50
  }
48
51
  r.addEventListener("scroll", l), window.addEventListener("resize", l);
49
- const I = setTimeout(() => {
50
- u();
52
+ const R = setTimeout(() => {
53
+ v();
51
54
  }, 0);
52
55
  return () => {
53
- r.removeEventListener("scroll", l), window.removeEventListener("resize", l), clearTimeout(I);
56
+ r.removeEventListener("scroll", l), window.removeEventListener("resize", l), clearTimeout(R);
54
57
  };
55
- }, [a, c]);
56
- function D(r) {
58
+ }, [a, n]);
59
+ function I(r) {
57
60
  r.stopPropagation();
58
61
  }
59
- return a ? /* @__PURE__ */ o(V, { className: e["page-overlay__container"], children: /* @__PURE__ */ o(J, { ...z, children: b ? /* @__PURE__ */ o(G, { ariaValueText: w }) : /* @__PURE__ */ o(j, { children: /* @__PURE__ */ o(C, { autoFocus: !0, contain: !0, restoreFocus: !0, children: /* @__PURE__ */ _(
62
+ return a ? /* @__PURE__ */ o(V, { className: e["page-overlay__container"], children: /* @__PURE__ */ o(O, { ...D, children: w ? /* @__PURE__ */ o(J, { ariaValueText: b }) : /* @__PURE__ */ o($, { children: /* @__PURE__ */ o(C, { autoFocus: !0, contain: !0, restoreFocus: !0, children: /* @__PURE__ */ c(
60
63
  "div",
61
64
  {
62
- ...B,
63
- ...H,
65
+ ...F,
64
66
  ...k,
67
+ ...z,
65
68
  className: i(e["page-overlay"], {
66
- [e[`page-overlay--${g}`]]: g
69
+ [e[`page-overlay--${y}`]]: y
67
70
  }),
68
- onKeyUp: D,
71
+ onKeyUp: I,
69
72
  role: "presentation",
70
- ref: n,
73
+ ref: s,
71
74
  children: [
72
- (s || c) && /* @__PURE__ */ _("div", { className: e["page-overlay__title-wrapper"], children: [
73
- s && /* @__PURE__ */ o("h1", { ...F, className: e["page-overlay__title"], children: s }),
74
- c,
75
- /* @__PURE__ */ o("span", { className: e["page-overlay__close"], children: /* @__PURE__ */ o(q, { "aria-label": S, onClick: p }) })
75
+ (_ || n) && /* @__PURE__ */ c("div", { className: e["page-overlay__title-wrapper"], children: [
76
+ _ && /* @__PURE__ */ o("h1", { ...H, className: e["page-overlay__title"], children: _ }),
77
+ n,
78
+ /* @__PURE__ */ o("span", { className: e["page-overlay__close"], children: /* @__PURE__ */ o(G, { "aria-label": S, onClick: p }) })
76
79
  ] }),
77
- /* @__PURE__ */ _(
80
+ /* @__PURE__ */ c(
78
81
  "form",
79
82
  {
80
- className: i(e["page-overlay__content"], {
81
- [e["page-overlay--content-with-buttons"]]: t
82
- }),
83
+ className: i(
84
+ e["page-overlay__content"],
85
+ e[`page-overlay__content--${T}`],
86
+ {
87
+ [e["page-overlay--content-with-buttons"]]: t
88
+ }
89
+ ),
83
90
  onSubmit: P,
84
91
  noValidate: N,
85
- ref: v,
92
+ ref: g,
86
93
  children: [
87
- /* @__PURE__ */ o("div", { className: e["page-overlay__children"], children: h }),
94
+ /* @__PURE__ */ o("div", { className: e["page-overlay__children"], children: f }),
88
95
  t && /* @__PURE__ */ o(
89
96
  "div",
90
97
  {
91
98
  className: i(e["page-overlay__buttons-bar"], {
92
- [e["page-overlay__buttons-bar--shadow"]]: T && !x
99
+ [e["page-overlay__buttons-bar--shadow"]]: E && !L
93
100
  }),
94
101
  children: t
95
102
  }
@@ -102,6 +109,6 @@ function ae({
102
109
  ) }) }) }) }) : null;
103
110
  }
104
111
  export {
105
- ae as PageOverlay
112
+ le as PageOverlay
106
113
  };
107
114
  //# sourceMappingURL=PageOverlay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PageOverlay.js","sources":["../../../src/components/PageOverlay/PageOverlay.tsx"],"sourcesContent":["import { useDialog } from '@react-aria/dialog';\nimport { FocusScope } from '@react-aria/focus';\nimport { OverlayContainer, useModal, useOverlay, usePreventScroll } from '@react-aria/overlays';\nimport classNames, { clsx } from 'clsx';\nimport { useEffect, useRef, useState } from 'react';\n\nimport type { FormHTMLAttributes, KeyboardEvent, PropsWithChildren, ReactNode } from 'react';\n\nimport styles from './PageOverlay.module.css';\n\nimport { OverlayCloseButton } from 'components/OverlayCloseButton';\nimport { Spinner } from 'components/Spinner';\nimport { Backdrop } from 'components/Backdrop';\n\nexport interface PageOverlayProps {\n /** The buttons of the dialog. */\n buttons?: ReactNode;\n /** `true` to show a spinner, if the contents of the dialog is lazy loaded; otherwise, `false`. */\n isLoading?: boolean;\n /** The `aria-valuetext` value of the [Spinner](/story/atoms-spinner--spinner-example) component. Used together with `isLoading`. */\n spinnerAriaValueText?: string;\n /** The `aria-label` value of the [OverlayCloseButton](/story/atoms-overlayclosebutton--overlay-close-button-example) component. */\n closeButtonAriaValueText?: string;\n /** `true` to render the dialog opened; otherwise, `false`. */\n isOpen: boolean;\n /** `true` to disable form validation; otherwise, `false`. */\n noValidate?: boolean;\n /** The callback function that is invoked when the dialog is closed. */\n onClose?(): void;\n /** The callback function that is invoked when the form is submitted. */\n onSubmit?: FormHTMLAttributes<HTMLFormElement>['onSubmit'];\n /** The title of the dialog. */\n title?: string;\n /** The contents of the dialog header. */\n headerContent?: ReactNode;\n /** The variant styling of the dialog. */\n variant?: 'full-screen' | 'with-gutters';\n}\n\n/** Represents a component for a modal dialog. */\nexport function PageOverlay({\n buttons,\n children,\n isLoading,\n spinnerAriaValueText = 'Loading',\n closeButtonAriaValueText = 'Close',\n isOpen,\n noValidate = false,\n onClose,\n onSubmit,\n title,\n headerContent,\n variant = 'full-screen',\n}: PropsWithChildren<PageOverlayProps>) {\n const ref = useRef<HTMLDivElement>(null);\n const formRef = useRef<HTMLFormElement>(null);\n const [isScrollable, setIsScrollable] = useState(false);\n const [isScrolledToBottom, setIsScrolledToBottom] = useState(false);\n\n const { dialogProps, titleProps } = useDialog({ role: 'dialog' }, ref);\n const { modalProps } = useModal({ isDisabled: !isOpen });\n const { overlayProps, underlayProps } = useOverlay({ isOpen, onClose }, ref);\n\n usePreventScroll({ isDisabled: !isOpen });\n\n useEffect(() => {\n const formElement = formRef.current;\n\n if (!formElement) return;\n\n function checkScrollable() {\n const scrollHeight = formElement!.scrollHeight;\n const clientHeight = formElement!.clientHeight;\n const scrollTop = formElement!.scrollTop;\n\n setIsScrollable(scrollHeight > clientHeight);\n setIsScrolledToBottom(scrollTop + clientHeight >= scrollHeight);\n }\n\n function handleScrollAndResize() {\n checkScrollable();\n }\n\n formElement.addEventListener('scroll', handleScrollAndResize);\n window.addEventListener('resize', handleScrollAndResize);\n\n const timeoutId = setTimeout(() => {\n checkScrollable();\n }, 0);\n\n return () => {\n formElement.removeEventListener('scroll', handleScrollAndResize);\n\n window.removeEventListener('resize', handleScrollAndResize);\n clearTimeout(timeoutId);\n };\n }, [isOpen, headerContent]);\n\n function onKeyUp(event: KeyboardEvent) {\n event.stopPropagation();\n }\n\n if (!isOpen) return null;\n\n return (\n <OverlayContainer className={styles['page-overlay__container']}>\n <Backdrop {...underlayProps}>\n {isLoading ? (\n <Spinner ariaValueText={spinnerAriaValueText} />\n ) : (\n <>\n {/* eslint-disable-next-line jsx-a11y/no-autofocus */}\n <FocusScope autoFocus contain restoreFocus>\n <div\n {...dialogProps}\n {...modalProps}\n {...overlayProps}\n className={clsx(styles['page-overlay'], {\n [styles[`page-overlay--${variant}`]]: variant,\n })}\n onKeyUp={onKeyUp}\n role=\"presentation\"\n ref={ref}\n >\n {(title || headerContent) && (\n <div className={styles['page-overlay__title-wrapper']}>\n {title && (\n <h1 {...titleProps} className={styles['page-overlay__title']}>\n {title}\n </h1>\n )}\n {headerContent}\n {\n <span className={styles['page-overlay__close']}>\n <OverlayCloseButton aria-label={closeButtonAriaValueText} onClick={onClose} />\n </span>\n }\n </div>\n )}\n <form\n className={classNames(styles['page-overlay__content'], {\n [styles['page-overlay--content-with-buttons']]: buttons,\n })}\n onSubmit={onSubmit}\n noValidate={noValidate}\n ref={formRef}\n >\n <div className={styles['page-overlay__children']}>{children}</div>\n {buttons && (\n <div\n className={classNames(styles['page-overlay__buttons-bar'], {\n [styles['page-overlay__buttons-bar--shadow']]: isScrollable && !isScrolledToBottom,\n })}\n >\n {buttons}\n </div>\n )}\n </form>\n </div>\n </FocusScope>\n </>\n )}\n </Backdrop>\n </OverlayContainer>\n );\n}\n"],"names":["PageOverlay","buttons","children","isLoading","spinnerAriaValueText","closeButtonAriaValueText","isOpen","noValidate","onClose","onSubmit","title","headerContent","variant","ref","useRef","formRef","isScrollable","setIsScrollable","useState","isScrolledToBottom","setIsScrolledToBottom","dialogProps","titleProps","useDialog","modalProps","useModal","overlayProps","underlayProps","useOverlay","usePreventScroll","useEffect","formElement","checkScrollable","scrollHeight","clientHeight","scrollTop","handleScrollAndResize","timeoutId","onKeyUp","event","jsx","OverlayContainer","styles","Backdrop","Spinner","Fragment","FocusScope","jsxs","clsx","OverlayCloseButton","classNames"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwCO,SAASA,GAAY;AAAA,EAC1B,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,sBAAAC,IAAuB;AAAA,EACvB,0BAAAC,IAA2B;AAAA,EAC3B,QAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,eAAAC;AAAA,EACA,SAAAC,IAAU;AACZ,GAAwC;AAChC,QAAAC,IAAMC,EAAuB,IAAI,GACjCC,IAAUD,EAAwB,IAAI,GACtC,CAACE,GAAcC,CAAe,IAAIC,EAAS,EAAK,GAChD,CAACC,GAAoBC,CAAqB,IAAIF,EAAS,EAAK,GAE5D,EAAE,aAAAG,GAAa,YAAAC,MAAeC,EAAU,EAAE,MAAM,SAAS,GAAGV,CAAG,GAC/D,EAAE,YAAAW,MAAeC,EAAS,EAAE,YAAY,CAACnB,GAAQ,GACjD,EAAE,cAAAoB,GAAc,eAAAC,MAAkBC,EAAW,EAAE,QAAAtB,GAAQ,SAAAE,EAAQ,GAAGK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AAAA,MAAA,CACvC;AAAA,MACD,SAAA0B;AAAA,MACA,MAAK;AAAA,MACL,KAAAzB;AAAA,MAEE,UAAA;AAAA,SAAAH,KAASC,MACR,gBAAAoC,EAAA,OAAA,EAAI,WAAWL,EAAO,6BAA6B,GACjD,UAAA;AAAA,UACChC,KAAA,gBAAA8B,EAAC,QAAI,GAAGlB,GAAY,WAAWoB,EAAO,qBAAqB,GACxD,UACHhC,EAAA,CAAA;AAAA,UAEDC;AAAA,UAEE,gBAAA6B,EAAA,QAAA,EAAK,WAAWE,EAAO,qBAAqB,GAC3C,UAAC,gBAAAF,EAAAS,GAAA,EAAmB,cAAY5C,GAA0B,SAASG,EAAS,CAAA,EAC9E,CAAA;AAAA,QAAA,GAEJ;AAAA,QAEF,gBAAAuC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWG,EAAWR,EAAO,uBAAuB,GAAG;AAAA,cACrD,CAACA,EAAO,oCAAoC,CAAC,GAAGzC;AAAA,YAAA,CACjD;AAAA,YACD,UAAAQ;AAAA,YACA,YAAAF;AAAA,YACA,KAAKQ;AAAA,YAEL,UAAA;AAAA,cAAA,gBAAAyB,EAAC,OAAI,EAAA,WAAWE,EAAO,wBAAwB,GAAI,UAAAxC,GAAS;AAAA,cAC3DD,KACC,gBAAAuC;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAWU,EAAWR,EAAO,2BAA2B,GAAG;AAAA,oBACzD,CAACA,EAAO,mCAAmC,CAAC,GAAG1B,KAAgB,CAACG;AAAA,kBAAA,CACjE;AAAA,kBAEA,UAAAlB;AAAA,gBAAA;AAAA,cAAA;AAAA,YACH;AAAA,UAAA;AAAA,QAAA;AAAA,MAEJ;AAAA,IAAA;AAAA,EAAA,GAEJ,EACF,CAAA,EAEJ,CAAA,GACF,IA7DkB;AA+DtB;"}
1
+ {"version":3,"file":"PageOverlay.js","sources":["../../../src/components/PageOverlay/PageOverlay.tsx"],"sourcesContent":["import { useDialog } from '@react-aria/dialog';\nimport { FocusScope } from '@react-aria/focus';\nimport { OverlayContainer, useModal, useOverlay, usePreventScroll } from '@react-aria/overlays';\nimport classNames, { clsx } from 'clsx';\nimport { useEffect, useRef, useState } from 'react';\n\nimport type { FormHTMLAttributes, KeyboardEvent, PropsWithChildren, ReactNode } from 'react';\n\nimport styles from './PageOverlay.module.css';\n\nimport { OverlayCloseButton } from 'components/OverlayCloseButton';\nimport { Spinner } from 'components/Spinner';\nimport { Backdrop } from 'components/Backdrop';\n\nexport interface PageOverlayProps {\n /** The buttons of the dialog. */\n buttons?: ReactNode;\n /** `true` to show a spinner, if the contents of the dialog is lazy loaded; otherwise, `false`. */\n isLoading?: boolean;\n /** The `aria-valuetext` value of the [Spinner](/story/atoms-spinner--spinner-example) component. Used together with `isLoading`. */\n spinnerAriaValueText?: string;\n /** The `aria-label` value of the [OverlayCloseButton](/story/atoms-overlayclosebutton--overlay-close-button-example) component. */\n closeButtonAriaValueText?: string;\n /** `true` to render the dialog opened; otherwise, `false`. */\n isOpen: boolean;\n /** `true` to disable form validation; otherwise, `false`. */\n noValidate?: boolean;\n /** The callback function that is invoked when the dialog is closed. */\n onClose?(): void;\n /** The callback function that is invoked when the form is submitted. */\n onSubmit?: FormHTMLAttributes<HTMLFormElement>['onSubmit'];\n /** The title of the dialog. */\n title?: string;\n /** The contents of the dialog header. */\n headerContent?: ReactNode;\n /** The variant styling of the dialog. */\n variant?: 'full-screen' | 'with-gutters';\n /** The content background color of the dialog. Default grey-300*/\n contentBackgroundColor?: 'grey' | 'white';\n}\n\n/** Represents a component for a modal dialog. */\nexport function PageOverlay({\n buttons,\n children,\n isLoading,\n spinnerAriaValueText = 'Loading',\n closeButtonAriaValueText = 'Close',\n isOpen,\n noValidate = false,\n onClose,\n onSubmit,\n title,\n headerContent,\n variant = 'full-screen',\n contentBackgroundColor = 'grey',\n}: PropsWithChildren<PageOverlayProps>) {\n const ref = useRef<HTMLDivElement>(null);\n const formRef = useRef<HTMLFormElement>(null);\n const [isScrollable, setIsScrollable] = useState(false);\n const [isScrolledToBottom, setIsScrolledToBottom] = useState(false);\n\n const { dialogProps, titleProps } = useDialog({ role: 'dialog' }, ref);\n const { modalProps } = useModal({ isDisabled: !isOpen });\n const { overlayProps, underlayProps } = useOverlay({ isOpen, onClose }, ref);\n\n usePreventScroll({ isDisabled: !isOpen });\n\n useEffect(() => {\n const formElement = formRef.current;\n\n if (!formElement) return;\n\n function checkScrollable() {\n const scrollHeight = formElement!.scrollHeight;\n const clientHeight = formElement!.clientHeight;\n const scrollTop = formElement!.scrollTop;\n\n setIsScrollable(scrollHeight > clientHeight);\n setIsScrolledToBottom(scrollTop + clientHeight >= scrollHeight);\n }\n\n function handleScrollAndResize() {\n checkScrollable();\n }\n\n formElement.addEventListener('scroll', handleScrollAndResize);\n window.addEventListener('resize', handleScrollAndResize);\n\n const timeoutId = setTimeout(() => {\n checkScrollable();\n }, 0);\n\n return () => {\n formElement.removeEventListener('scroll', handleScrollAndResize);\n\n window.removeEventListener('resize', handleScrollAndResize);\n clearTimeout(timeoutId);\n };\n }, [isOpen, headerContent]);\n\n function onKeyUp(event: KeyboardEvent) {\n event.stopPropagation();\n }\n\n if (!isOpen) return null;\n\n return (\n <OverlayContainer className={styles['page-overlay__container']}>\n <Backdrop {...underlayProps}>\n {isLoading ? (\n <Spinner ariaValueText={spinnerAriaValueText} />\n ) : (\n <>\n {/* eslint-disable-next-line jsx-a11y/no-autofocus */}\n <FocusScope autoFocus contain restoreFocus>\n <div\n {...dialogProps}\n {...modalProps}\n {...overlayProps}\n className={clsx(styles['page-overlay'], {\n [styles[`page-overlay--${variant}`]]: variant,\n })}\n onKeyUp={onKeyUp}\n role=\"presentation\"\n ref={ref}\n >\n {(title || headerContent) && (\n <div className={styles['page-overlay__title-wrapper']}>\n {title && (\n <h1 {...titleProps} className={styles['page-overlay__title']}>\n {title}\n </h1>\n )}\n {headerContent}\n {\n <span className={styles['page-overlay__close']}>\n <OverlayCloseButton aria-label={closeButtonAriaValueText} onClick={onClose} />\n </span>\n }\n </div>\n )}\n <form\n className={classNames(\n styles['page-overlay__content'],\n styles[`page-overlay__content--${contentBackgroundColor}`],\n {\n [styles['page-overlay--content-with-buttons']]: buttons,\n }\n )}\n onSubmit={onSubmit}\n noValidate={noValidate}\n ref={formRef}\n >\n <div className={styles['page-overlay__children']}>{children}</div>\n {buttons && (\n <div\n className={classNames(styles['page-overlay__buttons-bar'], {\n [styles['page-overlay__buttons-bar--shadow']]: isScrollable && !isScrolledToBottom,\n })}\n >\n {buttons}\n </div>\n )}\n </form>\n </div>\n </FocusScope>\n </>\n )}\n </Backdrop>\n </OverlayContainer>\n );\n}\n"],"names":["PageOverlay","buttons","children","isLoading","spinnerAriaValueText","closeButtonAriaValueText","isOpen","noValidate","onClose","onSubmit","title","headerContent","variant","contentBackgroundColor","ref","useRef","formRef","isScrollable","setIsScrollable","useState","isScrolledToBottom","setIsScrolledToBottom","dialogProps","titleProps","useDialog","modalProps","useModal","overlayProps","underlayProps","useOverlay","usePreventScroll","useEffect","formElement","checkScrollable","scrollHeight","clientHeight","scrollTop","handleScrollAndResize","timeoutId","onKeyUp","event","jsx","OverlayContainer","styles","Backdrop","Spinner","Fragment","FocusScope","jsxs","clsx","OverlayCloseButton","classNames"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0CO,SAASA,GAAY;AAAA,EAC1B,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,sBAAAC,IAAuB;AAAA,EACvB,0BAAAC,IAA2B;AAAA,EAC3B,QAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,eAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,wBAAAC,IAAyB;AAC3B,GAAwC;AAChC,QAAAC,IAAMC,EAAuB,IAAI,GACjCC,IAAUD,EAAwB,IAAI,GACtC,CAACE,GAAcC,CAAe,IAAIC,EAAS,EAAK,GAChD,CA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AO,mCAAmC,CAAC,GAAG1B,KAAgB,CAACG;AAAA,kBAAA,CACjE;AAAA,kBAEA,UAAAnB;AAAA,gBAAA;AAAA,cAAA;AAAA,YACH;AAAA,UAAA;AAAA,QAAA;AAAA,MAEJ;AAAA,IAAA;AAAA,EAAA,GAEJ,EACF,CAAA,EAEJ,CAAA,GACF,IAjEkB;AAmEtB;"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uva-glass/component-library",
3
3
  "author": "Team Glass - Frontend vrienden",
4
4
  "private": false,
5
- "version": "3.21.0",
5
+ "version": "3.21.1",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",