@konstructio/ui 0.1.2-alpha.117 → 0.1.2-alpha.118

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.
@@ -0,0 +1,84 @@
1
+ import { t as A } from "./x-Vur_9PXW.js";
2
+ import { t as H } from "./dist-C_jtUTU9.js";
3
+ import { t as h } from "./utils-DnIJruo0.js";
4
+ import { t as x } from "./Combination-CnMM05mt.js";
5
+ import { Body as B } from "./components/Modal/components/Body/Body.js";
6
+ import { Footer as C } from "./components/Modal/components/Footer/Footer.js";
7
+ import { Header as E } from "./components/Modal/components/Header/Header.js";
8
+ import { t as R } from "./es2015-B_07N-UL.js";
9
+ import { buttonCloseVariants as V, modalVariants as j } from "./components/Modal/components/Wrapper/Wrapper.variants.js";
10
+ import { Children as d, isValidElement as l, useEffect as g, useRef as D, useState as S } from "react";
11
+ import { createPortal as z } from "react-dom";
12
+ import { Fragment as I, jsx as a, jsxs as m } from "react/jsx-runtime";
13
+ import { motion as K } from "motion/react";
14
+ var L = ({ animateResize: c = !1, ariaLabel: n, ariaLabelledBy: s, autoFocus: i = !0, buttonCloseClassName: f, children: r, className: u, containerClassName: p, showCloseButton: o = !0, theme: y, transition: b, onClose: v }) => {
15
+ const F = d.toArray(r).find((e) => l(e) && e.type === t.Header), N = d.toArray(r).find((e) => l(e) && e.type === t.Body), k = d.toArray(r).find((e) => l(e) && e.type === t.Footer), w = d.toArray(r).filter((e) => !l(e) || ![
16
+ t.Header,
17
+ t.Body,
18
+ t.Footer
19
+ ].includes(e.type));
20
+ return /* @__PURE__ */ a(x, { children: /* @__PURE__ */ m("div", {
21
+ className: h("fixed inset-0 grid place-content-center", p),
22
+ "data-theme": y,
23
+ children: [/* @__PURE__ */ a("div", {
24
+ className: "absolute inset-0 bg-black opacity-70 dark:opacity-85 animate-in fade-in-0",
25
+ onClick: v,
26
+ role: "presentation"
27
+ }), /* @__PURE__ */ a(R, {
28
+ returnFocus: !0,
29
+ autoFocus: i,
30
+ className: "contents",
31
+ children: /* @__PURE__ */ m(K.div, {
32
+ className: h(j({ className: u })),
33
+ role: "dialog",
34
+ "aria-modal": "true",
35
+ "aria-label": n,
36
+ "aria-labelledby": s,
37
+ layout: c ? "size" : void 0,
38
+ transition: b ?? {
39
+ duration: 0.25,
40
+ ease: "easeInOut"
41
+ },
42
+ children: [
43
+ F,
44
+ o && /* @__PURE__ */ m("button", {
45
+ className: h(V({ className: f })),
46
+ onClick: v,
47
+ children: [/* @__PURE__ */ a(A, {}), /* @__PURE__ */ a(H, { children: "Dismiss modal" })]
48
+ }),
49
+ N ?? w,
50
+ k
51
+ ]
52
+ })
53
+ })]
54
+ }) });
55
+ }, t = ({ isOpen: c, onClose: n, container: s, theme: i, ...f }) => {
56
+ const r = D(null), [u, p] = S(null);
57
+ return g(() => {
58
+ if (!r.current || i || s) return;
59
+ const o = r.current.closest("[data-theme]");
60
+ o && p(o);
61
+ }, [i, s]), g(() => {
62
+ const o = new AbortController(), y = (b) => {
63
+ b.code === "Escape" && n?.();
64
+ };
65
+ return window.addEventListener("keydown", y, { signal: o.signal }), () => {
66
+ o.abort();
67
+ };
68
+ }, [n]), /* @__PURE__ */ m(I, { children: [/* @__PURE__ */ a("span", {
69
+ ref: r,
70
+ "data-testid": "modal-anchor",
71
+ hidden: !0
72
+ }), c && z(/* @__PURE__ */ a(L, {
73
+ ...f,
74
+ theme: i,
75
+ onClose: n
76
+ }), s || u || document.body)] });
77
+ };
78
+ t.Header = E;
79
+ t.Body = B;
80
+ t.Footer = C;
81
+ export {
82
+ L as n,
83
+ t
84
+ };
@@ -4,7 +4,7 @@ import { WarningIcon as T } from "../../assets/icons/components/Warning.js";
4
4
  import { Button as C } from "../Button/Button.js";
5
5
  import { Typography as d } from "../Typography/Typography.js";
6
6
  import { CopyButton as V } from "../CopyButton/CopyButton.js";
7
- import { t as l } from "../../Modal-prJwxFba.js";
7
+ import { t as l } from "../../Modal-0Wp5szX4.js";
8
8
  import { useEffect as W, useId as A, useState as G } from "react";
9
9
  import { Fragment as J, jsx as e, jsxs as r } from "react/jsx-runtime";
10
10
  var L = ({ autoFocus: N, cancelLabel: v = "Cancel", children: k, className: I, confirmationInputClassName: w, confirmationInputLabel: B, confirmationPrompt: j, confirmationText: a, confirmLabel: n = "Confirm", containerClassName: D, copyLabel: F = "Copy", description: i, icon: c, isOpen: o, isPending: t = !1, pendingLabel: S, theme: $, title: M, variant: f = "danger", onClose: q, onConfirm: z }) => {
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { t } from "../../Modal-prJwxFba.js";
2
+ import { t } from "../../Modal-0Wp5szX4.js";
3
3
  export {
4
4
  t as Modal
5
5
  };
@@ -1,4 +1,4 @@
1
- import { n as p } from "../../../../Modal-prJwxFba.js";
1
+ import { n as p } from "../../../../Modal-0Wp5szX4.js";
2
2
  export {
3
3
  p as Wrapper
4
4
  };
@@ -1,7 +1,7 @@
1
1
  import { Body as o } from "./Body/Body.js";
2
2
  import { Footer as p } from "./Footer/Footer.js";
3
3
  import { Header as e } from "./Header/Header.js";
4
- import { n as i } from "../../../Modal-prJwxFba.js";
4
+ import { n as i } from "../../../Modal-0Wp5szX4.js";
5
5
  export {
6
6
  o as Body,
7
7
  p as Footer,
@@ -19,7 +19,7 @@ import { Card as _ } from "./Card/Card.js";
19
19
  import { CheckboxCard as y } from "./CheckboxCard/CheckboxCard.js";
20
20
  import { Collapse as M } from "./Collapse/Collapse.js";
21
21
  import { CopyButton as z } from "./CopyButton/CopyButton.js";
22
- import { t as W } from "../Modal-prJwxFba.js";
22
+ import { t as W } from "../Modal-0Wp5szX4.js";
23
23
  import { ConfirmDialog as j } from "./ConfirmDialog/ConfirmDialog.js";
24
24
  import { DatePicker as H } from "./Datepicker/DatePicker.js";
25
25
  import { Radio as K } from "./Radio/Radio.js";
package/dist/index.js CHANGED
@@ -24,7 +24,7 @@ import { Card as X } from "./components/Card/Card.js";
24
24
  import { CheckboxCard as q } from "./components/CheckboxCard/CheckboxCard.js";
25
25
  import { Collapse as K } from "./components/Collapse/Collapse.js";
26
26
  import { CopyButton as Z } from "./components/CopyButton/CopyButton.js";
27
- import { t as rr } from "./Modal-prJwxFba.js";
27
+ import { t as rr } from "./Modal-0Wp5szX4.js";
28
28
  import { ConfirmDialog as tr } from "./components/ConfirmDialog/ConfirmDialog.js";
29
29
  import { DatePicker as ir } from "./components/Datepicker/DatePicker.js";
30
30
  import { Radio as er } from "./components/Radio/Radio.js";
@@ -19,6 +19,8 @@ import { modalVariants } from './components/Wrapper/Wrapper.variants';
19
19
  */
20
20
  export type Props = PropsWithChildren & VariantProps<typeof modalVariants> & {
21
21
  /** CSS classes for the close button */
22
+ /** Animate height changes of the content, e.g. when a step is swapped. Defaults to false */
23
+ animateResize?: boolean;
22
24
  ariaLabel?: string;
23
25
  ariaLabelledBy?: string;
24
26
  /** Move focus to the first focusable element when the modal opens. Defaults to true */
@@ -36,7 +38,7 @@ export type Props = PropsWithChildren & VariantProps<typeof modalVariants> & {
36
38
  showCloseButton?: boolean;
37
39
  /** Theme override for this component */
38
40
  theme?: Theme;
39
- /** Motion transition config for the modal animation */
41
+ /** Motion transition used when `animateResize` is enabled */
40
42
  transition?: Transition;
41
43
  /** Callback when modal is closed (Escape key or close button) */
42
44
  onClose?: () => void;
@@ -4,6 +4,7 @@ import { PropsWithChildren } from 'react';
4
4
  import { Theme } from '../../../../domain/theme';
5
5
  import { modalVariants } from './Wrapper.variants';
6
6
  export type Props = PropsWithChildren & VariantProps<typeof modalVariants> & {
7
+ animateResize?: boolean;
7
8
  ariaLabel?: string;
8
9
  ariaLabelledBy?: string;
9
10
  autoFocus?: boolean;
package/dist/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@konstructio/ui",
3
3
  "description": "A set of reusable and customizable React components built for konstruct.io",
4
4
  "private": false,
5
- "version": "0.1.2-alpha.116",
5
+ "version": "0.1.2-alpha.117",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@konstructio/ui",
3
3
  "description": "A set of reusable and customizable React components built for konstruct.io",
4
4
  "private": false,
5
- "version": "0.1.2-alpha.117",
5
+ "version": "0.1.2-alpha.118",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
@@ -1,84 +0,0 @@
1
- import { t as w } from "./x-Vur_9PXW.js";
2
- import { t as A } from "./dist-C_jtUTU9.js";
3
- import { t as h } from "./utils-DnIJruo0.js";
4
- import { t as H } from "./Combination-CnMM05mt.js";
5
- import { Body as x } from "./components/Modal/components/Body/Body.js";
6
- import { Footer as B } from "./components/Modal/components/Footer/Footer.js";
7
- import { Header as C } from "./components/Modal/components/Header/Header.js";
8
- import { t as E } from "./es2015-B_07N-UL.js";
9
- import { buttonCloseVariants as R, modalVariants as V } from "./components/Modal/components/Wrapper/Wrapper.variants.js";
10
- import { Children as m, isValidElement as c, useEffect as g, useRef as j, useState as D } from "react";
11
- import { createPortal as S } from "react-dom";
12
- import { Fragment as z, jsx as o, jsxs as f } from "react/jsx-runtime";
13
- import { motion as I } from "motion/react";
14
- var K = ({ ariaLabel: u, ariaLabelledBy: n, autoFocus: s = !0, buttonCloseClassName: i, children: a, className: d, containerClassName: p, showCloseButton: y = !0, theme: r, transition: b, onClose: l }) => {
15
- const v = m.toArray(a).find((e) => c(e) && e.type === t.Header), F = m.toArray(a).find((e) => c(e) && e.type === t.Body), N = m.toArray(a).find((e) => c(e) && e.type === t.Footer), k = m.toArray(a).filter((e) => !c(e) || ![
16
- t.Header,
17
- t.Body,
18
- t.Footer
19
- ].includes(e.type));
20
- return /* @__PURE__ */ o(H, { children: /* @__PURE__ */ f("div", {
21
- className: h("fixed inset-0 grid place-content-center", p),
22
- "data-theme": r,
23
- children: [/* @__PURE__ */ o("div", {
24
- className: "absolute inset-0 bg-black opacity-70 dark:opacity-85 animate-in fade-in-0",
25
- onClick: l,
26
- role: "presentation"
27
- }), /* @__PURE__ */ o(E, {
28
- returnFocus: !0,
29
- autoFocus: s,
30
- className: "contents",
31
- children: /* @__PURE__ */ f(I.div, {
32
- className: h(V({ className: d })),
33
- role: "dialog",
34
- "aria-modal": "true",
35
- "aria-label": u,
36
- "aria-labelledby": n,
37
- layout: "size",
38
- transition: b ?? {
39
- duration: 0.25,
40
- ease: "easeInOut"
41
- },
42
- children: [
43
- v,
44
- y && /* @__PURE__ */ f("button", {
45
- className: h(R({ className: i })),
46
- onClick: l,
47
- children: [/* @__PURE__ */ o(w, {}), /* @__PURE__ */ o(A, { children: "Dismiss modal" })]
48
- }),
49
- F ?? k,
50
- N
51
- ]
52
- })
53
- })]
54
- }) });
55
- }, t = ({ isOpen: u, onClose: n, container: s, theme: i, ...a }) => {
56
- const d = j(null), [p, y] = D(null);
57
- return g(() => {
58
- if (!d.current || i || s) return;
59
- const r = d.current.closest("[data-theme]");
60
- r && y(r);
61
- }, [i, s]), g(() => {
62
- const r = new AbortController(), b = (l) => {
63
- l.code === "Escape" && n?.();
64
- };
65
- return window.addEventListener("keydown", b, { signal: r.signal }), () => {
66
- r.abort();
67
- };
68
- }, [n]), /* @__PURE__ */ f(z, { children: [/* @__PURE__ */ o("span", {
69
- ref: d,
70
- "data-testid": "modal-anchor",
71
- hidden: !0
72
- }), u && S(/* @__PURE__ */ o(K, {
73
- ...a,
74
- theme: i,
75
- onClose: n
76
- }), s || p || document.body)] });
77
- };
78
- t.Header = C;
79
- t.Body = x;
80
- t.Footer = B;
81
- export {
82
- K as n,
83
- t
84
- };