@konstructio/ui 0.1.2-alpha.68 → 0.1.2-alpha.69

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,120 @@
1
+ import { Body as k } from "./components/Modal/components/Body/Body.js";
2
+ import { Footer as v } from "./components/Modal/components/Footer/Footer.js";
3
+ import { Header as w } from "./components/Modal/components/Header/Header.js";
4
+ import { jsx as a, jsxs as l, Fragment as A } from "react/jsx-runtime";
5
+ import { Children as m, isValidElement as c, useRef as F, useState as N, useEffect as R } from "react";
6
+ import { createPortal as x } from "react-dom";
7
+ import { R as B } from "./index-BKjcReYh.js";
8
+ import { R as C } from "./Combination-BtmnusWq.js";
9
+ import { cn as h } from "./utils/index.js";
10
+ import { buttonCloseVariants as E, modalVariants as H } from "./components/Modal/components/Wrapper/Wrapper.variants.js";
11
+ import { m as V } from "./proxy-CngVm5qA.js";
12
+ import { X as j } from "./x-Eoa9FJjA.js";
13
+ const D = ({
14
+ buttonCloseClassName: f,
15
+ children: o,
16
+ className: n,
17
+ containerClassName: s,
18
+ showCloseButton: p = !0,
19
+ theme: i,
20
+ transition: u,
21
+ onClose: d
22
+ }) => {
23
+ const r = m.toArray(o).find(
24
+ (e) => c(e) && e.type === t.Header
25
+ ), y = m.toArray(o).find(
26
+ (e) => c(e) && e.type === t.Body
27
+ ), b = m.toArray(o).find(
28
+ (e) => c(e) && e.type === t.Footer
29
+ ), g = m.toArray(o).filter(
30
+ (e) => !c(e) || ![t.Header, t.Body, t.Footer].includes(
31
+ e.type
32
+ )
33
+ );
34
+ return /* @__PURE__ */ a(C, { children: /* @__PURE__ */ l(
35
+ "div",
36
+ {
37
+ className: h(
38
+ "fixed inset-0 grid place-content-center",
39
+ s
40
+ ),
41
+ "data-theme": i,
42
+ children: [
43
+ /* @__PURE__ */ a(
44
+ "div",
45
+ {
46
+ className: "absolute inset-0 bg-black opacity-70 dark:opacity-85 animate-in fade-in-0",
47
+ onClick: d,
48
+ role: "presentation"
49
+ }
50
+ ),
51
+ /* @__PURE__ */ l(
52
+ V.div,
53
+ {
54
+ className: h(
55
+ H({
56
+ className: n
57
+ })
58
+ ),
59
+ role: "dialog",
60
+ "aria-modal": "true",
61
+ layout: "size",
62
+ transition: u ?? { duration: 0.25, ease: "easeInOut" },
63
+ children: [
64
+ r,
65
+ p && /* @__PURE__ */ l(
66
+ "button",
67
+ {
68
+ className: h(
69
+ E({
70
+ className: f
71
+ })
72
+ ),
73
+ onClick: d,
74
+ children: [
75
+ /* @__PURE__ */ a(j, {}),
76
+ /* @__PURE__ */ a(B, { children: "Dismiss modal" })
77
+ ]
78
+ }
79
+ ),
80
+ y ?? g,
81
+ b
82
+ ]
83
+ }
84
+ )
85
+ ]
86
+ }
87
+ ) });
88
+ }, t = ({ isOpen: f, onClose: o, container: n, theme: s, ...p }) => {
89
+ const i = F(null), [u, d] = N(
90
+ null
91
+ );
92
+ return R(() => {
93
+ if (!i.current || s || n)
94
+ return;
95
+ const r = i.current.closest("[data-theme]");
96
+ r && d(r);
97
+ }, [s, n]), R(() => {
98
+ const r = new AbortController(), y = (b) => {
99
+ b.code === "Escape" && o?.();
100
+ };
101
+ return window.addEventListener("keydown", y, {
102
+ signal: r.signal
103
+ }), () => {
104
+ r.abort();
105
+ };
106
+ }, [o]), /* @__PURE__ */ l(A, { children: [
107
+ /* @__PURE__ */ a("span", { ref: i, "data-testid": "modal-anchor", hidden: !0 }),
108
+ f && x(
109
+ /* @__PURE__ */ a(D, { ...p, theme: s, onClose: o }),
110
+ n || u || document.body
111
+ )
112
+ ] });
113
+ };
114
+ t.Header = w;
115
+ t.Body = k;
116
+ t.Footer = v;
117
+ export {
118
+ t as M,
119
+ D as W
120
+ };
@@ -4,7 +4,7 @@ import { cn as n } from "../../utils/index.js";
4
4
  import { buttonGroupPillVariants as z, buttonGroupVariants as A, buttonGroupWrapperVariants as E } from "./ButtonGroup.variants.js";
5
5
  import { useButtonGroup as H } from "./hooks/useButtonGroup.js";
6
6
  import { ButtonGroupLabel as J } from "./components/ButtonGroupLabel/ButtonGroupLabel.js";
7
- import { m as Q } from "../../proxy-BIRlSMN_.js";
7
+ import { m as Q } from "../../proxy-CngVm5qA.js";
8
8
  import { ButtonGroupItem as T } from "./components/ButtonGroupItem/ButtonGroupItem.js";
9
9
  import { ButtonGroupMessage as U } from "./components/ButtonGroupMessage/ButtonGroupMessage.js";
10
10
  const X = ({
@@ -2,7 +2,7 @@ import { jsx as s, jsxs as a } from "react/jsx-runtime";
2
2
  import { memo as L } from "react";
3
3
  import { cn as t } from "../../../../utils/index.js";
4
4
  import { buttonGroupLabelVariants as u, buttonGroupDescriptionVariants as V, buttonGroupItemContentVariants as g, buttonGroupItemVariants as w } from "./ButtonGroupItem.variants.js";
5
- import { m as j } from "../../../../proxy-BIRlSMN_.js";
5
+ import { m as j } from "../../../../proxy-CngVm5qA.js";
6
6
  const k = (r, n) => n === "none" ? r ? "inset(0 0 0 0)" : "inset(0 100% 0 0)" : r ? "inset(0 0 0 0)" : n === "right" ? "inset(0 0 0 100%)" : "inset(0 100% 0 0)", B = L(
7
7
  ({
8
8
  animationDirection: r,
@@ -7,7 +7,7 @@ import { CalendarDivider as tt } from "../CalendarDivider/CalendarDivider.js";
7
7
  import { CalendarMonth as d } from "../CalendarMonth/CalendarMonth.js";
8
8
  import { NavigationButton as g } from "../NavigationButton/NavigationButton.js";
9
9
  import { useIndependentCarousel as nt } from "../../hooks/useIndependentCarousel.js";
10
- import { m as et } from "../../../../../../proxy-BIRlSMN_.js";
10
+ import { m as et } from "../../../../../../proxy-CngVm5qA.js";
11
11
  const at = ({
12
12
  className: b,
13
13
  calendarWidth: x = 550,
@@ -6,7 +6,7 @@ import { CalendarDivider as F } from "../CalendarDivider/CalendarDivider.js";
6
6
  import { CalendarMonth as G } from "../CalendarMonth/CalendarMonth.js";
7
7
  import { NavigationButton as m } from "../NavigationButton/NavigationButton.js";
8
8
  import { useTogetherCarousel as H } from "../../hooks/useTogetherCarousel.js";
9
- import { m as R } from "../../../../../../proxy-BIRlSMN_.js";
9
+ import { m as R } from "../../../../../../proxy-CngVm5qA.js";
10
10
  const S = ({
11
11
  className: s,
12
12
  calendarWidth: h = 550,
@@ -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-mwLmWbnA.js";
4
+ import { M as d } from "../../Modal-BGcucTHv.js";
5
5
  import "./components/Header/Header.js";
6
6
  import "./components/Body/Body.js";
7
7
  import "./components/Footer/Footer.js";
@@ -1,7 +1,8 @@
1
- import { PropsWithChildren, ReactNode } from 'react';
2
1
  import { VariantProps } from 'class-variance-authority';
3
- import { modalVariants } from './components/Wrapper/Wrapper.variants';
2
+ import { Transition } from 'motion/react';
3
+ import { PropsWithChildren, ReactNode } from 'react';
4
4
  import { Theme } from '../../domain/theme';
5
+ import { modalVariants } from './components/Wrapper/Wrapper.variants';
5
6
  /**
6
7
  * Props for the Modal component.
7
8
  *
@@ -21,6 +22,8 @@ export type Props = PropsWithChildren & VariantProps<typeof modalVariants> & {
21
22
  buttonCloseClassName?: string;
22
23
  /** Additional CSS classes for the modal */
23
24
  className?: string;
25
+ /** CSS classes for the outer container (the overlay grid wrapper) */
26
+ containerClassName?: string;
24
27
  /** DOM element to portal the modal into (defaults to document.body) */
25
28
  container?: Element | DocumentFragment;
26
29
  /** Whether the modal is open */
@@ -29,6 +32,8 @@ export type Props = PropsWithChildren & VariantProps<typeof modalVariants> & {
29
32
  showCloseButton?: boolean;
30
33
  /** Theme override for this component */
31
34
  theme?: Theme;
35
+ /** Motion transition config for the modal animation */
36
+ transition?: Transition;
32
37
  /** Callback when modal is closed (Escape key or close button) */
33
38
  onClose?: () => void;
34
39
  };
@@ -2,10 +2,10 @@ import "react/jsx-runtime";
2
2
  import "../../../../index-BKjcReYh.js";
3
3
  import "react";
4
4
  import "../../../../Combination-BtmnusWq.js";
5
- import { W as s } from "../../../../Modal-mwLmWbnA.js";
5
+ import { W as s } from "../../../../Modal-BGcucTHv.js";
6
6
  import "../../../../utils/index.js";
7
7
  import "./Wrapper.variants.js";
8
- import "../../../../proxy-BIRlSMN_.js";
8
+ import "../../../../proxy-CngVm5qA.js";
9
9
  import "../../../../x-Eoa9FJjA.js";
10
10
  export {
11
11
  s as Wrapper
@@ -1,11 +1,14 @@
1
1
  import { VariantProps } from 'class-variance-authority';
2
+ import { Transition } from 'motion/react';
2
3
  import { PropsWithChildren } from 'react';
3
4
  import { Theme } from '../../../../domain/theme';
4
5
  import { modalVariants } from './Wrapper.variants';
5
6
  export type Props = PropsWithChildren & VariantProps<typeof modalVariants> & {
6
7
  buttonCloseClassName?: string;
7
8
  className?: string;
9
+ containerClassName?: string;
8
10
  showCloseButton?: boolean;
9
11
  theme?: Theme;
12
+ transition?: Transition;
10
13
  onClose?: () => void;
11
14
  };
@@ -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-mwLmWbnA.js";
4
+ import { W as a } from "../../../Modal-BGcucTHv.js";
5
5
  export {
6
6
  e as Body,
7
7
  t as Footer,
@@ -1,23 +1,23 @@
1
1
  import { jsx as r, jsxs as v } from "react/jsx-runtime";
2
2
  import { forwardRef as N, useMemo as O } from "react";
3
- import { cn as l } from "../../utils/index.js";
3
+ import { cn as a } from "../../utils/index.js";
4
4
  import { i as g } from "../../AdditionalOptions-C2FDVZhu.js";
5
5
  import { SelectProvider as j } from "./contexts/select.provider.js";
6
- import { Wrapper as w } from "./components/Wrapper.js";
6
+ import { Wrapper as k } from "./components/Wrapper.js";
7
7
  const W = N(
8
8
  ({
9
9
  error: e,
10
10
  errorClassName: m,
11
- helperText: a,
11
+ helperText: l,
12
12
  helperTextClassName: n,
13
13
  highlightSearch: o,
14
14
  mainWrapperClassName: p,
15
15
  name: s,
16
16
  value: c,
17
17
  options: t,
18
- onChange: f,
18
+ onChange: d,
19
19
  onBlur: i,
20
- ...d
20
+ ...f
21
21
  }, x) => {
22
22
  const u = O(() => t.length ? g(t.at(0)) ? t.flatMap((h) => h.options) : t : [], [t]);
23
23
  return /* @__PURE__ */ r(
@@ -28,30 +28,39 @@ const W = N(
28
28
  value: c,
29
29
  options: u,
30
30
  onBlur: i,
31
- onChange: f,
32
- children: /* @__PURE__ */ v("div", { className: l("relative w-full", p), children: [
31
+ onChange: d,
32
+ children: /* @__PURE__ */ v("div", { className: a("relative w-full", p), children: [
33
33
  /* @__PURE__ */ r(
34
- w,
34
+ k,
35
35
  {
36
36
  error: e,
37
37
  name: s,
38
38
  ref: x,
39
39
  onBlur: i,
40
40
  groupedOptions: t,
41
- ...d
41
+ ...f
42
42
  }
43
43
  ),
44
44
  e ? /* @__PURE__ */ r(
45
45
  "span",
46
46
  {
47
- className: l(
47
+ className: a(
48
48
  "text-xs text-red-700 dark:text-red-400",
49
49
  m
50
50
  ),
51
51
  children: e
52
52
  }
53
53
  ) : null,
54
- !e && a ? /* @__PURE__ */ r("span", { className: l("text-xs text-metal-600", n), children: a }) : null
54
+ !e && l ? /* @__PURE__ */ r(
55
+ "span",
56
+ {
57
+ className: a(
58
+ "text-xs text-slate-600 dark:text-slate-200",
59
+ n
60
+ ),
61
+ children: l
62
+ }
63
+ ) : null
55
64
  ] })
56
65
  }
57
66
  );
@@ -11,7 +11,7 @@ const a = e(
11
11
  "px-3",
12
12
  "py-1",
13
13
  "relative",
14
- "rounded-md",
14
+ "rounded",
15
15
  "transition-all",
16
16
  "w-full",
17
17
  "outline-none",
@@ -21,7 +21,7 @@ const r = t([
21
21
  "flex-col",
22
22
  "mt-1",
23
23
  "overflow-hidden",
24
- "rounded-md",
24
+ "rounded",
25
25
  "shadow-2xs",
26
26
  "top-full",
27
27
  "w-full",
@@ -17,7 +17,7 @@ import { Filter as k } from "./Filter/Filter.js";
17
17
  import { ImageUpload as F } from "./ImageUpload/ImageUpload.js";
18
18
  import { Input as M } from "./Input/Input.js";
19
19
  import { Loading as y } from "./Loading/Loading.js";
20
- import { M as U } from "../Modal-mwLmWbnA.js";
20
+ import { M as U } from "../Modal-BGcucTHv.js";
21
21
  import { MultiSelectDropdown as j } 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
@@ -26,7 +26,7 @@ import { Input as _ } from "./components/Input/Input.js";
26
26
  import { List as rr } from "./components/Tabs/components/List.js";
27
27
  import { Loading as er } from "./components/Loading/Loading.js";
28
28
  import { Logo as pr } from "./components/Sidebar/components/Logo/Logo.js";
29
- import { M as mr } from "./Modal-mwLmWbnA.js";
29
+ import { M as mr } from "./Modal-BGcucTHv.js";
30
30
  import { MultiSelectDropdown as fr } from "./components/MultiSelectDropdown/MultiSelectDropdown.js";
31
31
  import { Navigation as ir } from "./components/Sidebar/components/Navigation/Navigation.js";
32
32
  import { NavigationGroup as dr } from "./components/Sidebar/components/NavigationGroup/NavigationGroup.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.67",
5
+ "version": "0.1.2-alpha.68",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
@@ -100,7 +100,7 @@
100
100
  "i18n-iso-countries": "^7.14.0",
101
101
  "js-cookie": "^3.0.5",
102
102
  "lucide-react": "^0.576.0",
103
- "motion": "^12.34.3",
103
+ "motion": "^12.34.5",
104
104
  "react-chartjs-2": "^5.3.1",
105
105
  "react-day-picker": "^9.14.0",
106
106
  "react-feather": "^2.0.10",
@@ -173,7 +173,7 @@
173
173
  "jest-axe": "^10.0.0",
174
174
  "jsdom": "^28.1.0",
175
175
  "lodash": "^4.17.23",
176
- "postcss": "^8.5.6",
176
+ "postcss": "^8.5.8",
177
177
  "prettier": "^3.8.1",
178
178
  "rimraf": "^6.1.3",
179
179
  "storybook": "^10.2.14",