@uva-glass/component-library 3.13.0 → 3.14.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.
@@ -1 +1 @@
1
- ._page-overlay__container_1et9u_1{bottom:0;left:0;position:fixed;right:0;top:0;z-index:50}._page-overlay_1et9u_1{background:var(--color-white);display:flex;flex-direction:column;height:100dvh;width:100vw}._page-overlay__content_1et9u_20{background-color:var(--color-grey-100);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_1et9u_32{padding-bottom:1rem}._page-overlay__title_1et9u_36{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_1et9u_43{background-color:var(--color-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_1et9u_43: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_1et9u_69:before{opacity:1}._page-overlay__close_1et9u_73{position:absolute;right:1.5rem;top:1rem}
1
+ ._page-overlay__container_mxs4k_1{bottom:0;left:0;position:fixed;right:0;top:0;z-index:50}._page-overlay_mxs4k_1{background:var(--color-white);display:flex;flex-direction:column;height:100dvh}._page-overlay--full-screen_mxs4k_19{width:100vw}._page-overlay--with-gutters_mxs4k_23{margin:0 .75rem;max-width:87.5rem;width:100%}._page-overlay__content_mxs4k_29{background-color:var(--color-grey-100);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_mxs4k_41{padding-bottom:1rem}._page-overlay__title_mxs4k_45{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_mxs4k_52{background-color:var(--color-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_mxs4k_52: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_mxs4k_78:before{opacity:1}._page-overlay__close_mxs4k_82{position:relative;right:1rem;bottom:2.625rem}
@@ -20,6 +20,8 @@ export interface PageOverlayProps {
20
20
  title?: string;
21
21
  /** The contents of the dialog header. */
22
22
  headerContent?: ReactNode;
23
+ /** The variant styling of the dialog. */
24
+ variant?: 'full-screen' | 'with-gutters';
23
25
  }
24
26
  /** Represents a component for a modal dialog. */
25
- export declare function PageOverlay({ buttons, children, isLoading, spinnerAriaValueText, closeButtonAriaValueText, isOpen, noValidate, onClose, onSubmit, title, headerContent, }: PropsWithChildren<PageOverlayProps>): import("react/jsx-runtime").JSX.Element | null;
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;
@@ -1,88 +1,94 @@
1
- import { jsx as e, Fragment as m, jsxs as i } from "react/jsx-runtime";
2
- import { useDialog as j } from "@react-aria/dialog";
3
- import { FocusScope as k } from "@react-aria/focus";
4
- import { useModal as A, useOverlay as C, usePreventScroll as K, OverlayContainer as M } from "@react-aria/overlays";
5
- import { c as d } from "../../clsx-OuTLNxxd.js";
6
- import { useRef as y, useState as f, useEffect as U } from "react";
7
- import { OverlayCloseButton as V } from "../OverlayCloseButton/OverlayCloseButton.js";
8
- import { Spinner as q } from "../Spinner/Spinner.js";
1
+ import { jsx as e, Fragment as d, jsxs as _ } from "react/jsx-runtime";
2
+ import { useDialog as A } from "@react-aria/dialog";
3
+ import { FocusScope as C } from "@react-aria/focus";
4
+ import { useModal as K, useOverlay as M, usePreventScroll as U, OverlayContainer as V } from "@react-aria/overlays";
5
+ import { c as i } from "../../clsx-OuTLNxxd.js";
6
+ import { useRef as f, useState as h, 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";
9
10
  import '../../assets/PageOverlay.css';const o = {
10
- "page-overlay__container": "_page-overlay__container_1et9u_1",
11
- "page-overlay": "_page-overlay_1et9u_1",
12
- "page-overlay__content": "_page-overlay__content_1et9u_20",
13
- "page-overlay__children": "_page-overlay__children_1et9u_32",
14
- "page-overlay__title": "_page-overlay__title_1et9u_36",
15
- "page-overlay__buttons-bar": "_page-overlay__buttons-bar_1et9u_43",
16
- "page-overlay__buttons-bar--shadow": "_page-overlay__buttons-bar--shadow_1et9u_69",
17
- "page-overlay__close": "_page-overlay__close_1et9u_73"
11
+ "page-overlay__container": "_page-overlay__container_mxs4k_1",
12
+ "page-overlay": "_page-overlay_mxs4k_1",
13
+ "page-overlay--full-screen": "_page-overlay--full-screen_mxs4k_19",
14
+ "page-overlay--with-gutters": "_page-overlay--with-gutters_mxs4k_23",
15
+ "page-overlay__content": "_page-overlay__content_mxs4k_29",
16
+ "page-overlay__children": "_page-overlay__children_mxs4k_41",
17
+ "page-overlay__title": "_page-overlay__title_mxs4k_45",
18
+ "page-overlay__buttons-bar": "_page-overlay__buttons-bar_mxs4k_52",
19
+ "page-overlay__buttons-bar--shadow": "_page-overlay__buttons-bar--shadow_mxs4k_78",
20
+ "page-overlay__close": "_page-overlay__close_mxs4k_82"
18
21
  };
19
- function $({
22
+ function le({
20
23
  buttons: t,
21
- children: h,
22
- isLoading: b,
23
- spinnerAriaValueText: S = "Loading",
24
+ children: b,
25
+ isLoading: x,
26
+ spinnerAriaValueText: k = "Loading",
24
27
  closeButtonAriaValueText: w = "Close",
25
- isOpen: a,
26
- noValidate: N = !1,
27
- onClose: _,
28
+ isOpen: l,
29
+ noValidate: S = !1,
30
+ onClose: p,
28
31
  onSubmit: P,
29
32
  title: s,
30
- headerContent: n
33
+ headerContent: n,
34
+ variant: m = "full-screen"
31
35
  }) {
32
- const c = y(null), u = y(null), [T, E] = f(!1), [x, L] = f(!1), { dialogProps: F, titleProps: H } = j({ role: "dialog" }, c), { modalProps: z } = A({ isDisabled: !a }), { overlayProps: B } = C({ isOpen: a, onClose: _ }, c);
33
- K({ isDisabled: !a }), U(() => {
34
- const r = u.current;
36
+ const c = f(null), v = f(null), [N, T] = h(!1), [E, L] = h(!1), { dialogProps: B, titleProps: F } = A({ role: "dialog" }, c), { modalProps: H } = K({ isDisabled: !l }), { overlayProps: z, underlayProps: D } = M({ isOpen: l, onClose: p }, c);
37
+ U({ isDisabled: !l }), $(() => {
38
+ const r = v.current;
35
39
  if (!r) return;
36
- function p() {
37
- const v = r.scrollHeight, g = r.clientHeight, R = r.scrollTop;
38
- E(v > g), L(R + g >= v);
40
+ function g() {
41
+ const u = r.scrollHeight, y = r.clientHeight, j = r.scrollTop;
42
+ T(u > y), L(j + y >= u);
39
43
  }
40
- function l() {
41
- p();
44
+ function a() {
45
+ g();
42
46
  }
43
- r.addEventListener("scroll", l), window.addEventListener("resize", l);
44
- const I = setTimeout(() => {
45
- p();
47
+ r.addEventListener("scroll", a), window.addEventListener("resize", a);
48
+ const R = setTimeout(() => {
49
+ g();
46
50
  }, 0);
47
51
  return () => {
48
- r.removeEventListener("scroll", l), window.removeEventListener("resize", l), clearTimeout(I);
52
+ r.removeEventListener("scroll", a), window.removeEventListener("resize", a), clearTimeout(R);
49
53
  };
50
- }, [a, n]);
51
- function D(r) {
54
+ }, [l, n]);
55
+ function I(r) {
52
56
  r.stopPropagation();
53
57
  }
54
- return a ? /* @__PURE__ */ e(M, { className: o["page-overlay__container"], children: b ? /* @__PURE__ */ e(q, { ariaValueText: S }) : /* @__PURE__ */ e(m, { children: /* @__PURE__ */ e(k, { autoFocus: !0, contain: !0, restoreFocus: !0, children: /* @__PURE__ */ i(
58
+ return l ? /* @__PURE__ */ e(V, { className: o["page-overlay__container"], children: /* @__PURE__ */ e(J, { ...D, children: x ? /* @__PURE__ */ e(G, { ariaValueText: k }) : /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(C, { autoFocus: !0, contain: !0, restoreFocus: !0, children: /* @__PURE__ */ _(
55
59
  "div",
56
60
  {
57
- ...F,
58
- ...z,
59
61
  ...B,
60
- className: o["page-overlay"],
61
- onKeyUp: D,
62
+ ...H,
63
+ ...z,
64
+ className: i(o["page-overlay"], {
65
+ [o[`page-overlay--${m}`]]: m
66
+ }),
67
+ onKeyUp: I,
62
68
  role: "presentation",
63
69
  ref: c,
64
70
  children: [
65
- (s || n) && /* @__PURE__ */ i(m, { children: [
66
- s && /* @__PURE__ */ e("h1", { ...H, className: o["page-overlay__title"], children: s }),
71
+ (s || n) && /* @__PURE__ */ _(d, { children: [
72
+ s && /* @__PURE__ */ e("h1", { ...F, className: o["page-overlay__title"], children: s }),
67
73
  n,
68
- /* @__PURE__ */ e("span", { className: o["page-overlay__close"], children: /* @__PURE__ */ e(V, { "aria-label": w, onClick: _ }) })
74
+ /* @__PURE__ */ e("span", { className: o["page-overlay__close"], children: /* @__PURE__ */ e(q, { "aria-label": w, onClick: p }) })
69
75
  ] }),
70
- /* @__PURE__ */ i(
76
+ /* @__PURE__ */ _(
71
77
  "form",
72
78
  {
73
- className: d(o["page-overlay__content"], {
79
+ className: i(o["page-overlay__content"], {
74
80
  [o["page-overlay--content-with-buttons"]]: t
75
81
  }),
76
82
  onSubmit: P,
77
- noValidate: N,
78
- ref: u,
83
+ noValidate: S,
84
+ ref: v,
79
85
  children: [
80
- /* @__PURE__ */ e("div", { className: o["page-overlay__children"], children: h }),
86
+ /* @__PURE__ */ e("div", { className: o["page-overlay__children"], children: b }),
81
87
  t && /* @__PURE__ */ e(
82
88
  "div",
83
89
  {
84
- className: d(o["page-overlay__buttons-bar"], {
85
- [o["page-overlay__buttons-bar--shadow"]]: T && !x
90
+ className: i(o["page-overlay__buttons-bar"], {
91
+ [o["page-overlay__buttons-bar--shadow"]]: N && !E
86
92
  }),
87
93
  children: t
88
94
  }
@@ -92,9 +98,9 @@ function $({
92
98
  )
93
99
  ]
94
100
  }
95
- ) }) }) }) : null;
101
+ ) }) }) }) }) : null;
96
102
  }
97
103
  export {
98
- $ as PageOverlay
104
+ le as PageOverlay
99
105
  };
100
106
  //# 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 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';\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}\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}: 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 } = 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 {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={styles['page-overlay']}\n onKeyUp={onKeyUp}\n role=\"presentation\"\n ref={ref}\n >\n {(title || headerContent) && (\n <>\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 </>\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 </OverlayContainer>\n );\n}\n"],"names":["PageOverlay","buttons","children","isLoading","spinnerAriaValueText","closeButtonAriaValueText","isOpen","noValidate","onClose","onSubmit","title","headerContent","ref","useRef","formRef","isScrollable","setIsScrollable","useState","isScrolledToBottom","setIsScrolledToBottom","dialogProps","titleProps","useDialog","modalProps","useModal","overlayProps","useOverlay","usePreventScroll","useEffect","formElement","checkScrollable","scrollHeight","clientHeight","scrollTop","handleScrollAndResize","timeoutId","onKeyUp","event","jsx","OverlayContainer","styles","Spinner","Fragment","FocusScope","jsxs","OverlayCloseButton","classNames"],"mappings":";;;;;;;;;;;;;;;;;;AAqCO,SAASA,EAAY;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;AACF,GAAwC;AAChC,QAAAC,IAAMC,EAAuB,IAAI,GACjCC,IAAUD,EAAw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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}\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 <>\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 </>\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,MAAe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AAA,EAAA,GAEJ,EACF,CAAA,EAEJ,CAAA,GACF,IA7DkB;AA+DtB;"}
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.13.0",
5
+ "version": "3.14.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
@@ -64,7 +64,7 @@
64
64
  "@testing-library/jest-dom": "^6.6.3",
65
65
  "@testing-library/react": "^16.3.0",
66
66
  "@types/jest": "^29.5.14",
67
- "@types/node": "^22.14.1",
67
+ "@types/node": "^22.15.3",
68
68
  "@types/react-dom": "^19.1.2",
69
69
  "@types/react": "^19.1.2",
70
70
  "@uva-glass/eslint-config": "^1.3.10",
@@ -84,11 +84,11 @@
84
84
  "npm-run-all2": "^7.0.2",
85
85
  "react": "^19.1.0",
86
86
  "react-dom": "^19.1.0",
87
- "react-router": "^7.5.1",
87
+ "react-router": "^7.5.3",
88
88
  "semantic-release": "^24.2.3",
89
89
  "storybook": "^8.6.12",
90
- "style-dictionary": "^4.3.3",
91
- "stylelint": "^16.19.0",
90
+ "style-dictionary": "^4.4.0",
91
+ "stylelint": "^16.19.1",
92
92
  "stylelint-config-recommended": "^16.0.0",
93
93
  "stylelint-config-standard": "^38.0.0",
94
94
  "stylelint-order": "^7.0.0",
@@ -112,9 +112,9 @@
112
112
  "lexical": "^0.30.0"
113
113
  },
114
114
  "optionalDependencies": {
115
- "@rollup/rollup-linux-x64-gnu": "^4.40.0",
116
- "@rspack/binding-darwin-arm64": "1.3.6",
117
- "@rspack/binding-linux-x64-gnu": "1.3.6",
115
+ "@rollup/rollup-linux-x64-gnu": "^4.40.1",
116
+ "@rspack/binding-darwin-arm64": "1.3.8",
117
+ "@rspack/binding-linux-x64-gnu": "1.3.8",
118
118
  "@ast-grep/napi-linux-x64-gnu": "0.37.0"
119
119
  }
120
120
  }