@konstructio/ui 0.1.2-alpha.59 → 0.1.2-alpha.60
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.
- package/dist/Modal--z642-Wv.js +112 -0
- package/dist/components/Modal/Modal.d.ts +5 -5
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Modal/Modal.types.d.ts +3 -3
- package/dist/components/Modal/components/Body/Body.d.ts +2 -2
- package/dist/components/Modal/components/Body/Body.types.d.ts +1 -1
- package/dist/components/Modal/components/Footer/Footer.d.ts +2 -2
- package/dist/components/Modal/components/Footer/Footer.js +10 -4
- package/dist/components/Modal/components/Footer/Footer.types.d.ts +1 -1
- package/dist/components/Modal/components/Header/Header.d.ts +2 -2
- package/dist/components/Modal/components/Header/Header.js +11 -5
- package/dist/components/Modal/components/Header/Header.types.d.ts +1 -1
- package/dist/components/Modal/components/Wrapper/Wrapper.d.ts +2 -2
- package/dist/components/Modal/components/Wrapper/Wrapper.js +1 -1
- package/dist/components/Modal/components/Wrapper/Wrapper.types.d.ts +2 -2
- package/dist/components/Modal/components/Wrapper/Wrapper.variants.js +13 -10
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/package.json +5 -5
- package/dist/styles.css +1 -1
- package/dist/utils/index.js +134 -134
- package/package.json +5 -5
- package/dist/Modal-CjC-CIJ8.js +0 -99
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Body as R } from "./components/Modal/components/Body/Body.js";
|
|
2
|
+
import { Footer as g } from "./components/Modal/components/Footer/Footer.js";
|
|
3
|
+
import { Header as k } from "./components/Modal/components/Header/Header.js";
|
|
4
|
+
import { jsx as n, jsxs as c, Fragment as v } from "react/jsx-runtime";
|
|
5
|
+
import { Children as d, isValidElement as m, useRef as w, useState as A, useEffect as b } from "react";
|
|
6
|
+
import { createPortal as F } from "react-dom";
|
|
7
|
+
import { R as N } from "./index-BKjcReYh.js";
|
|
8
|
+
import { R as x } from "./Combination-BtmnusWq.js";
|
|
9
|
+
import { cn as h } from "./utils/index.js";
|
|
10
|
+
import { buttonCloseVariants as B, modalVariants as C } from "./components/Modal/components/Wrapper/Wrapper.variants.js";
|
|
11
|
+
import { X as E } from "./x-Eoa9FJjA.js";
|
|
12
|
+
const H = ({
|
|
13
|
+
buttonCloseClassName: l,
|
|
14
|
+
children: r,
|
|
15
|
+
className: s,
|
|
16
|
+
showCloseButton: i = !0,
|
|
17
|
+
theme: f,
|
|
18
|
+
onClose: a
|
|
19
|
+
}) => {
|
|
20
|
+
const p = d.toArray(r).find(
|
|
21
|
+
(e) => m(e) && e.type === t.Header
|
|
22
|
+
), u = d.toArray(r).find(
|
|
23
|
+
(e) => m(e) && e.type === t.Body
|
|
24
|
+
), o = d.toArray(r).find(
|
|
25
|
+
(e) => m(e) && e.type === t.Footer
|
|
26
|
+
), y = d.toArray(r).filter(
|
|
27
|
+
(e) => !m(e) || ![t.Header, t.Body, t.Footer].includes(
|
|
28
|
+
e.type
|
|
29
|
+
)
|
|
30
|
+
);
|
|
31
|
+
return /* @__PURE__ */ n(x, { children: /* @__PURE__ */ c(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: "fixed inset-0 grid place-content-center",
|
|
35
|
+
"data-theme": f,
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ n(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: "absolute inset-0 bg-black opacity-70 dark:opacity-85 animate-in fade-in-0",
|
|
41
|
+
onClick: a,
|
|
42
|
+
role: "presentation"
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ c(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: h(
|
|
49
|
+
C({
|
|
50
|
+
className: s
|
|
51
|
+
})
|
|
52
|
+
),
|
|
53
|
+
role: "dialog",
|
|
54
|
+
"aria-modal": "true",
|
|
55
|
+
children: [
|
|
56
|
+
p,
|
|
57
|
+
i && /* @__PURE__ */ c(
|
|
58
|
+
"button",
|
|
59
|
+
{
|
|
60
|
+
className: h(
|
|
61
|
+
B({
|
|
62
|
+
className: l
|
|
63
|
+
})
|
|
64
|
+
),
|
|
65
|
+
onClick: a,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ n(E, {}),
|
|
68
|
+
/* @__PURE__ */ n(N, { children: "Dismiss modal" })
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
u ?? y,
|
|
73
|
+
o
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
) });
|
|
80
|
+
}, t = ({ isOpen: l, onClose: r, container: s, theme: i, ...f }) => {
|
|
81
|
+
const a = w(null), [p, u] = A(
|
|
82
|
+
null
|
|
83
|
+
);
|
|
84
|
+
return b(() => {
|
|
85
|
+
if (!a.current || i || s)
|
|
86
|
+
return;
|
|
87
|
+
const o = a.current.closest("[data-theme]");
|
|
88
|
+
o && u(o);
|
|
89
|
+
}, [i, s]), b(() => {
|
|
90
|
+
const o = new AbortController(), y = (e) => {
|
|
91
|
+
e.code === "Escape" && r?.();
|
|
92
|
+
};
|
|
93
|
+
return window.addEventListener("keydown", y, {
|
|
94
|
+
signal: o.signal
|
|
95
|
+
}), () => {
|
|
96
|
+
o.abort();
|
|
97
|
+
};
|
|
98
|
+
}, [r]), /* @__PURE__ */ c(v, { children: [
|
|
99
|
+
/* @__PURE__ */ n("span", { ref: a, "data-testid": "modal-anchor", hidden: !0 }),
|
|
100
|
+
l && F(
|
|
101
|
+
/* @__PURE__ */ n(H, { ...f, theme: i, onClose: r }),
|
|
102
|
+
s || p || document.body
|
|
103
|
+
)
|
|
104
|
+
] });
|
|
105
|
+
};
|
|
106
|
+
t.Header = k;
|
|
107
|
+
t.Body = R;
|
|
108
|
+
t.Footer = g;
|
|
109
|
+
export {
|
|
110
|
+
t as M,
|
|
111
|
+
H as W
|
|
112
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ChildProps, Props } from './Modal.types';
|
|
3
3
|
/**
|
|
4
4
|
* A modal dialog component with Header, Body, and Footer sub-components.
|
|
5
5
|
* Supports keyboard navigation (Escape to close) and portals to document.body.
|
|
@@ -26,9 +26,9 @@ import { ModalChildProps, ModalProps } from './Modal.types';
|
|
|
26
26
|
*
|
|
27
27
|
* @see {@link https://konstructio.github.io/konstruct-ui/?path=/docs/components-modal--docs Storybook}
|
|
28
28
|
*/
|
|
29
|
-
declare const Modal: FC<
|
|
30
|
-
Header: FC<
|
|
31
|
-
Body: FC<
|
|
32
|
-
Footer: FC<
|
|
29
|
+
declare const Modal: FC<Props> & {
|
|
30
|
+
Header: FC<ChildProps>;
|
|
31
|
+
Body: FC<ChildProps>;
|
|
32
|
+
Footer: FC<ChildProps>;
|
|
33
33
|
};
|
|
34
34
|
export { Modal };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-dom";
|
|
4
|
-
import { M as d } from "../../Modal-
|
|
4
|
+
import { M as d } from "../../Modal--z642-Wv.js";
|
|
5
5
|
import "./components/Header/Header.js";
|
|
6
6
|
import "./components/Body/Body.js";
|
|
7
7
|
import "./components/Footer/Footer.js";
|
|
@@ -16,7 +16,7 @@ import { Theme } from '../../domain/theme';
|
|
|
16
16
|
* </Modal>
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export type Props = PropsWithChildren & VariantProps<typeof modalVariants> & {
|
|
20
20
|
/** CSS classes for the close button */
|
|
21
21
|
buttonCloseClassName?: string;
|
|
22
22
|
/** Additional CSS classes for the modal */
|
|
@@ -31,11 +31,11 @@ export interface ModalProps extends PropsWithChildren, VariantProps<typeof modal
|
|
|
31
31
|
theme?: Theme;
|
|
32
32
|
/** Callback when modal is closed (Escape key or close button) */
|
|
33
33
|
onClose?: () => void;
|
|
34
|
-
}
|
|
34
|
+
};
|
|
35
35
|
/**
|
|
36
36
|
* Props for Modal sub-components (Header, Body, Footer).
|
|
37
37
|
*/
|
|
38
|
-
export type
|
|
38
|
+
export type ChildProps = {
|
|
39
39
|
/** Content of the modal section */
|
|
40
40
|
children: ReactNode;
|
|
41
41
|
/** Additional CSS classes */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export declare const Body: FC<
|
|
2
|
+
import { Props } from './Body.types';
|
|
3
|
+
export declare const Body: FC<Props>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export declare const Footer: FC<
|
|
2
|
+
import { Props } from './Footer.types';
|
|
3
|
+
export declare const Footer: FC<Props>;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
-
import { S as
|
|
3
|
-
import { cn as
|
|
4
|
-
const
|
|
2
|
+
import { S as e } from "../../../../index-BvoZGpli.js";
|
|
3
|
+
import { cn as n } from "../../../../utils/index.js";
|
|
4
|
+
const i = ({ children: o, asChild: r, className: t }) => /* @__PURE__ */ m(
|
|
5
|
+
r ? e : "div",
|
|
6
|
+
{
|
|
7
|
+
className: n("border-zinc-200 dark:border-metal-700", t),
|
|
8
|
+
children: o
|
|
9
|
+
}
|
|
10
|
+
);
|
|
5
11
|
export {
|
|
6
|
-
|
|
12
|
+
i as Footer
|
|
7
13
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export declare const Header: FC<
|
|
2
|
+
import { Props } from './Header.types';
|
|
3
|
+
export declare const Header: FC<Props>;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { S as
|
|
3
|
-
import { cn as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { S as m } from "../../../../index-BvoZGpli.js";
|
|
3
|
+
import { cn as n } from "../../../../utils/index.js";
|
|
4
|
+
const d = ({ children: o, asChild: r, className: t }) => /* @__PURE__ */ e(
|
|
5
|
+
r ? m : "div",
|
|
6
|
+
{
|
|
7
|
+
className: n("border-zinc-200 dark:border-metal-700", t),
|
|
8
|
+
children: o
|
|
9
|
+
}
|
|
10
|
+
);
|
|
5
11
|
export {
|
|
6
|
-
|
|
12
|
+
d as Header
|
|
7
13
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export declare const Wrapper: FC<
|
|
2
|
+
import { Props } from './Wrapper.types';
|
|
3
|
+
export declare const Wrapper: FC<Props>;
|
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "../../../../index-BKjcReYh.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "../../../../Combination-BtmnusWq.js";
|
|
5
|
-
import { W as f } from "../../../../Modal-
|
|
5
|
+
import { W as f } from "../../../../Modal--z642-Wv.js";
|
|
6
6
|
import "../../../../utils/index.js";
|
|
7
7
|
import "./Wrapper.variants.js";
|
|
8
8
|
import "../../../../x-Eoa9FJjA.js";
|
|
@@ -2,10 +2,10 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
import { Theme } from '../../../../domain/theme';
|
|
4
4
|
import { modalVariants } from './Wrapper.variants';
|
|
5
|
-
export
|
|
5
|
+
export type Props = PropsWithChildren & VariantProps<typeof modalVariants> & {
|
|
6
6
|
buttonCloseClassName?: string;
|
|
7
7
|
className?: string;
|
|
8
8
|
showCloseButton?: boolean;
|
|
9
9
|
theme?: Theme;
|
|
10
10
|
onClose?: () => void;
|
|
11
|
-
}
|
|
11
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { c as t } from "../../../../index-D29mdTf5.js";
|
|
2
|
-
const
|
|
3
|
-
"bg-metal-1000",
|
|
2
|
+
const a = t([
|
|
4
3
|
"bg-white",
|
|
5
|
-
"border
|
|
4
|
+
"border",
|
|
5
|
+
"border-transparent",
|
|
6
|
+
"dark:bg-metal-800",
|
|
7
|
+
"dark:border-slate-700",
|
|
6
8
|
"flex",
|
|
7
9
|
"flex-col",
|
|
8
10
|
"justify-between",
|
|
@@ -14,17 +16,18 @@ const i = t([
|
|
|
14
16
|
"animate-in",
|
|
15
17
|
"fade-in-0",
|
|
16
18
|
"zoom-in-95",
|
|
17
|
-
"duration-150"
|
|
18
|
-
|
|
19
|
-
]), o = t([
|
|
19
|
+
"duration-150"
|
|
20
|
+
]), r = t([
|
|
20
21
|
"absolute",
|
|
21
22
|
"right-1.5",
|
|
22
23
|
"top-1.5",
|
|
23
|
-
"text-inherit",
|
|
24
24
|
"cursor-pointer",
|
|
25
|
-
"text-
|
|
25
|
+
"text-slate-500",
|
|
26
|
+
"dark:text-slate-300",
|
|
27
|
+
"hover:text-slate-700",
|
|
28
|
+
"dark:hover:text-slate-100"
|
|
26
29
|
]);
|
|
27
30
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
r as buttonCloseVariants,
|
|
32
|
+
a as modalVariants
|
|
30
33
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Body as e } from "./Body/Body.js";
|
|
2
2
|
import { Footer as t } from "./Footer/Footer.js";
|
|
3
3
|
import { Header as m } from "./Header/Header.js";
|
|
4
|
-
import { W as a } from "../../../Modal-
|
|
4
|
+
import { W as a } from "../../../Modal--z642-Wv.js";
|
|
5
5
|
export {
|
|
6
6
|
e as Body,
|
|
7
7
|
t as Footer,
|
package/dist/components/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { Filter as A } from "./Filter/Filter.js";
|
|
|
17
17
|
import { ImageUpload as G } from "./ImageUpload/ImageUpload.js";
|
|
18
18
|
import { Input as y } from "./Input/Input.js";
|
|
19
19
|
import { Loading as O } from "./Loading/Loading.js";
|
|
20
|
-
import { M as W } from "../Modal-
|
|
20
|
+
import { M as W } from "../Modal--z642-Wv.js";
|
|
21
21
|
import { MultiSelectDropdown as q } from "./MultiSelectDropdown/MultiSelectDropdown.js";
|
|
22
22
|
import { PhoneNumberInput as H } from "./PhoneNumberInput/PhoneNumberInput.js";
|
|
23
23
|
import { PieChart as K } from "./PieChart/PieChart.js";
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import { DateRangeFilterDropdown as or } from "./components/Filter/components/Da
|
|
|
23
23
|
import { ImageUpload as tr } from "./components/ImageUpload/ImageUpload.js";
|
|
24
24
|
import { Input as ar } from "./components/Input/Input.js";
|
|
25
25
|
import { Loading as xr } from "./components/Loading/Loading.js";
|
|
26
|
-
import { M as ir } from "./Modal-
|
|
26
|
+
import { M as ir } from "./Modal--z642-Wv.js";
|
|
27
27
|
import { MultiSelectDropdown as sr } from "./components/MultiSelectDropdown/MultiSelectDropdown.js";
|
|
28
28
|
import { PhoneNumberInput as lr } from "./components/PhoneNumberInput/PhoneNumberInput.js";
|
|
29
29
|
import { PieChart as gr } from "./components/PieChart/PieChart.js";
|
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.
|
|
5
|
+
"version": "0.1.2-alpha.59",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "dist/index.js",
|
|
@@ -99,14 +99,14 @@
|
|
|
99
99
|
"google-libphonenumber": "^3.2.44",
|
|
100
100
|
"i18n-iso-countries": "^7.14.0",
|
|
101
101
|
"js-cookie": "^3.0.5",
|
|
102
|
-
"lucide-react": "^0.
|
|
102
|
+
"lucide-react": "^0.564.0",
|
|
103
103
|
"motion": "^12.34.0",
|
|
104
104
|
"react-chartjs-2": "^5.3.1",
|
|
105
105
|
"react-day-picker": "^9.13.2",
|
|
106
106
|
"react-feather": "^2.0.10",
|
|
107
107
|
"react-focus-lock": "^2.13.7",
|
|
108
108
|
"react-remove-scroll": "^2.7.2",
|
|
109
|
-
"tailwind-merge": "^3.4.
|
|
109
|
+
"tailwind-merge": "^3.4.1"
|
|
110
110
|
},
|
|
111
111
|
"peerDependencies": {
|
|
112
112
|
"@tanstack/react-query": "^5.90",
|
|
@@ -171,11 +171,11 @@
|
|
|
171
171
|
"glob": "^13.0.3",
|
|
172
172
|
"husky": "^9.1.7",
|
|
173
173
|
"jest-axe": "^10.0.0",
|
|
174
|
-
"jsdom": "^28.
|
|
174
|
+
"jsdom": "^28.1.0",
|
|
175
175
|
"lodash": "^4.17.23",
|
|
176
176
|
"postcss": "^8.5.6",
|
|
177
177
|
"prettier": "^3.8.1",
|
|
178
|
-
"rimraf": "^6.1.
|
|
178
|
+
"rimraf": "^6.1.3",
|
|
179
179
|
"storybook": "^10.2.8",
|
|
180
180
|
"tailwindcss": "^4.1.18",
|
|
181
181
|
"ts-node": "^10.9.2",
|