@divayth/brick-ui 0.6.1 → 0.8.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.
- package/dist/app/ModalProvider.d.ts.map +1 -0
- package/dist/{ui/Modal → app}/ModalProvider.js +1 -1
- package/dist/app/Provider.d.ts +9 -8
- package/dist/app/Provider.d.ts.map +1 -1
- package/dist/app/Provider.js +16 -57
- package/dist/app/ThemeProvider.d.ts +14 -0
- package/dist/app/ThemeProvider.d.ts.map +1 -0
- package/dist/app/ThemeProvider.js +43 -0
- package/dist/app/index.d.ts +1 -1
- package/dist/app/index.d.ts.map +1 -1
- package/dist/index.js +60 -56
- package/dist/lib/locale.d.ts +2 -0
- package/dist/lib/locale.d.ts.map +1 -1
- package/dist/lib/locale.js +2 -0
- package/dist/styles.css +1 -1
- package/dist/ui/Date/DateInput.d.ts +1 -1
- package/dist/ui/Date/DateInput.d.ts.map +1 -1
- package/dist/ui/Date/DateInput.js +14 -14
- package/dist/ui/DropdownMenu/DropdownMenu.d.ts +17 -0
- package/dist/ui/DropdownMenu/DropdownMenu.d.ts.map +1 -0
- package/dist/ui/DropdownMenu/DropdownMenu.js +34 -0
- package/dist/ui/DropdownMenu/DropdownMenu.module.css.js +11 -0
- package/dist/ui/DropdownMenu/index.d.ts +2 -0
- package/dist/ui/DropdownMenu/index.d.ts.map +1 -0
- package/dist/ui/Field/Field.d.ts +1 -1
- package/dist/ui/Field/Field.d.ts.map +1 -1
- package/dist/ui/Flex/Flex.d.ts +3 -3
- package/dist/ui/Flex/Flex.d.ts.map +1 -1
- package/dist/ui/Flex/Flex.js +12 -14
- package/dist/ui/Flex/constants.d.ts +1 -1
- package/dist/ui/Flex/constants.d.ts.map +1 -1
- package/dist/ui/Flex/index.d.ts +2 -0
- package/dist/ui/Flex/index.d.ts.map +1 -0
- package/dist/ui/Grid/Grid.types.d.ts +2 -2
- package/dist/ui/Grid/Grid.types.d.ts.map +1 -1
- package/dist/ui/IconButton/IconButton.d.ts +2 -1
- package/dist/ui/IconButton/IconButton.d.ts.map +1 -1
- package/dist/ui/IconButton/IconButton.js +61 -56
- package/dist/ui/IconButton/IconButton.module.css.js +24 -24
- package/dist/ui/IconButton/index.d.ts +2 -0
- package/dist/ui/IconButton/index.d.ts.map +1 -0
- package/dist/ui/Input/Input.d.ts +1 -1
- package/dist/ui/Input/Input.d.ts.map +1 -1
- package/dist/ui/Input/Input.js +31 -27
- package/dist/ui/Input/index.d.ts +2 -0
- package/dist/ui/Input/index.d.ts.map +1 -0
- package/dist/ui/Modal/Modal.d.ts +9 -6
- package/dist/ui/Modal/Modal.d.ts.map +1 -1
- package/dist/ui/Modal/Modal.js +85 -101
- package/dist/ui/Modal/Modal.module.css.js +17 -17
- package/dist/ui/Modal/ModalContext.js +2 -2
- package/dist/ui/Modal/index.d.ts +4 -0
- package/dist/ui/Modal/index.d.ts.map +1 -0
- package/dist/ui/MultipleChip/MultipleChip.d.ts +1 -1
- package/dist/ui/MultipleChip/MultipleChip.d.ts.map +1 -1
- package/dist/ui/NoData/NoData.d.ts +1 -1
- package/dist/ui/NoData/NoData.d.ts.map +1 -1
- package/dist/ui/Select/Select.types.d.ts +1 -1
- package/dist/ui/Select/Select.types.d.ts.map +1 -1
- package/dist/ui/Select/SelectOptions.js +1 -1
- package/dist/ui/Sticky/Sticky.d.ts +1 -1
- package/dist/ui/Sticky/Sticky.d.ts.map +1 -1
- package/dist/ui/Tabs/TabsList.d.ts +1 -1
- package/dist/ui/Tabs/TabsList.d.ts.map +1 -1
- package/dist/ui/Textarea/Textarea.d.ts +1 -1
- package/dist/ui/Textarea/Textarea.d.ts.map +1 -1
- package/dist/ui/Tooltip/Tooltip.js +15 -15
- package/dist/ui/index.d.ts +5 -6
- package/dist/ui/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/ui/Modal/ModalProvider.d.ts.map +0 -1
- /package/dist/{ui/Modal → app}/ModalProvider.d.ts +0 -0
- /package/dist/app/{Provider.module.css.js → ThemeProvider.module.css.js} +0 -0
|
@@ -1,65 +1,70 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
import { jsxs as S, jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { CircularLoading as g } from "../CircularLoading/CircularLoading.js";
|
|
4
|
+
import { cn as j } from "../../lib/cn.js";
|
|
5
|
+
import t from "./IconButton.module.css.js";
|
|
6
|
+
const v = {
|
|
7
|
+
xs: "rounded-xs",
|
|
8
|
+
sm: "rounded-sm",
|
|
9
|
+
md: "rounded-md",
|
|
10
|
+
lg: "rounded-lg",
|
|
11
|
+
xl: "rounded-xl",
|
|
12
|
+
full: "rounded-full"
|
|
13
|
+
}, O = ({
|
|
14
|
+
color: u = "primary",
|
|
15
|
+
variant: c = "transparent",
|
|
16
|
+
size: a = "md",
|
|
17
|
+
rounded: m = "full",
|
|
18
|
+
disabled: p = !1,
|
|
19
|
+
isLoading: n = !1,
|
|
20
|
+
component: b,
|
|
21
|
+
children: f,
|
|
22
|
+
className: y,
|
|
23
|
+
type: x = "button",
|
|
24
|
+
onClick: D,
|
|
25
|
+
onKeyDown: l,
|
|
26
|
+
tabIndex: h,
|
|
27
|
+
"aria-disabled": k,
|
|
28
|
+
"aria-busy": C,
|
|
29
|
+
...B
|
|
22
30
|
}) => {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
const d = b ?? "button", r = p || n, e = d === "button", s = !e && r, N = (o) => {
|
|
32
|
+
o.preventDefault();
|
|
33
|
+
}, E = (o) => {
|
|
34
|
+
if (o.key === "Enter" || o.key === " ") {
|
|
35
|
+
o.preventDefault();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
l?.(o);
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ S(
|
|
41
|
+
d,
|
|
26
42
|
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
disabled:
|
|
30
|
-
"aria-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{ [
|
|
39
|
-
|
|
43
|
+
type: e ? x : void 0,
|
|
44
|
+
disabled: e ? r : void 0,
|
|
45
|
+
"aria-disabled": r || k,
|
|
46
|
+
"aria-busy": n || C,
|
|
47
|
+
tabIndex: s ? -1 : h,
|
|
48
|
+
className: j(
|
|
49
|
+
t.root,
|
|
50
|
+
t[u],
|
|
51
|
+
t[c],
|
|
52
|
+
t[a],
|
|
53
|
+
v[m],
|
|
54
|
+
{ [t.disabled]: r },
|
|
55
|
+
y
|
|
40
56
|
),
|
|
41
|
-
onClick:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
y?.(t);
|
|
47
|
-
},
|
|
48
|
-
onKeyDown: (t) => {
|
|
49
|
-
if (a && (t.key === "Enter" || t.key === " ")) {
|
|
50
|
-
t.preventDefault(), t.stopPropagation();
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
h?.(t);
|
|
54
|
-
},
|
|
57
|
+
onClick: s ? N : D,
|
|
58
|
+
onKeyDown: s ? E : l,
|
|
59
|
+
...B,
|
|
55
60
|
children: [
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
/* @__PURE__ */ i("span", { className: t.content, style: { opacity: n ? 0 : 1 }, children: f }),
|
|
62
|
+
n && /* @__PURE__ */ i(
|
|
63
|
+
g,
|
|
59
64
|
{
|
|
60
|
-
size:
|
|
65
|
+
size: a,
|
|
61
66
|
style: { width: "1em", height: "1em" },
|
|
62
|
-
className:
|
|
67
|
+
className: t.loading,
|
|
63
68
|
"aria-hidden": "true"
|
|
64
69
|
}
|
|
65
70
|
)
|
|
@@ -68,5 +73,5 @@ const E = ({
|
|
|
68
73
|
);
|
|
69
74
|
};
|
|
70
75
|
export {
|
|
71
|
-
|
|
76
|
+
O as IconButton
|
|
72
77
|
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
const
|
|
2
|
-
root:
|
|
1
|
+
const t = "_root_1tkxq_2", _ = "_xs_1tkxq_24", o = "_sm_1tkxq_29", n = "_md_1tkxq_34", s = "_lg_1tkxq_39", d = "_xl_1tkxq_44", l = "_primary_1tkxq_49", c = "_secondary_1tkxq_57", x = "_danger_1tkxq_66", e = "_outlined_1tkxq_75", a = "_filled_1tkxq_79", r = "_disabled_1tkxq_109", i = "_content_1tkxq_122", k = "_loading_1tkxq_130", q = {
|
|
2
|
+
root: t,
|
|
3
3
|
xs: _,
|
|
4
4
|
sm: o,
|
|
5
5
|
md: n,
|
|
6
|
-
lg:
|
|
7
|
-
xl:
|
|
8
|
-
primary:
|
|
9
|
-
secondary:
|
|
10
|
-
danger:
|
|
11
|
-
outlined:
|
|
12
|
-
filled:
|
|
13
|
-
disabled:
|
|
14
|
-
content:
|
|
15
|
-
loading:
|
|
6
|
+
lg: s,
|
|
7
|
+
xl: d,
|
|
8
|
+
primary: l,
|
|
9
|
+
secondary: c,
|
|
10
|
+
danger: x,
|
|
11
|
+
outlined: e,
|
|
12
|
+
filled: a,
|
|
13
|
+
disabled: r,
|
|
14
|
+
content: i,
|
|
15
|
+
loading: k
|
|
16
16
|
};
|
|
17
17
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
i as content,
|
|
19
|
+
x as danger,
|
|
20
|
+
q as default,
|
|
21
|
+
r as disabled,
|
|
22
|
+
a as filled,
|
|
23
|
+
s as lg,
|
|
24
|
+
k as loading,
|
|
25
25
|
n as md,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
e as outlined,
|
|
27
|
+
l as primary,
|
|
28
|
+
t as root,
|
|
29
|
+
c as secondary,
|
|
30
30
|
o as sm,
|
|
31
|
-
|
|
31
|
+
d as xl,
|
|
32
32
|
_ as xs
|
|
33
33
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/IconButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,iBAAiB,CAAC"}
|
package/dist/ui/Input/Input.d.ts
CHANGED
|
@@ -10,5 +10,5 @@ export interface InputControlProps {
|
|
|
10
10
|
fullWidth?: boolean;
|
|
11
11
|
}
|
|
12
12
|
export type InputProps = InputControlProps & Omit<ComponentProps<'input'>, 'size'>;
|
|
13
|
-
export declare const Input: ({ id: idProps, label, error, size, fullWidth, className, startIcon, endIcon, ...inputProps }: InputProps) => import("react").JSX.Element;
|
|
13
|
+
export declare const Input: ({ id: idProps, label, error, size, fullWidth, className, startIcon, endIcon, "aria-describedby": describedBy, "aria-invalid": ariaInvalid, ...inputProps }: InputProps) => import("react").JSX.Element;
|
|
14
14
|
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/ui/Input/Input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAS,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/ui/Input/Input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAS,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,KAAK,WAAW,EAAS,MAAM,oBAAoB,CAAC;AAK7D,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,UAAU,GAAG,iBAAiB,GACtC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC;AAE1C,eAAO,MAAM,KAAK,GAAI,4JAYnB,UAAU,gCA6BZ,CAAC"}
|
package/dist/ui/Input/Input.js
CHANGED
|
@@ -1,44 +1,48 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useId as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
const
|
|
2
|
+
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { useId as I } from "react";
|
|
4
|
+
import { Field as i } from "../Field/Field.js";
|
|
5
|
+
import { cn as j } from "../../lib/cn.js";
|
|
6
|
+
import t from "./Input.module.css.js";
|
|
7
|
+
const g = ({
|
|
8
8
|
id: l,
|
|
9
|
-
label:
|
|
10
|
-
error:
|
|
11
|
-
size:
|
|
9
|
+
label: a,
|
|
10
|
+
error: o,
|
|
11
|
+
size: m = "md",
|
|
12
12
|
fullWidth: p = !1,
|
|
13
13
|
className: f,
|
|
14
|
-
startIcon:
|
|
15
|
-
endIcon:
|
|
16
|
-
|
|
14
|
+
startIcon: n,
|
|
15
|
+
endIcon: d,
|
|
16
|
+
"aria-describedby": u,
|
|
17
|
+
"aria-invalid": h,
|
|
18
|
+
...b
|
|
17
19
|
}) => {
|
|
18
|
-
const
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
|
|
20
|
+
const v = I(), e = l ?? v, s = o ? `${e}-error` : void 0, w = [u, s].filter(Boolean).join(" ") || void 0;
|
|
21
|
+
return /* @__PURE__ */ c(i.Root, { className: p ? "w-full" : "w-auto", children: [
|
|
22
|
+
a && /* @__PURE__ */ r(i.Label, { htmlFor: e, label: a }),
|
|
23
|
+
/* @__PURE__ */ c(i.Control, { size: m, children: [
|
|
24
|
+
n && /* @__PURE__ */ r(i.Icon, { icon: n }),
|
|
23
25
|
/* @__PURE__ */ r(
|
|
24
26
|
"input",
|
|
25
27
|
{
|
|
26
|
-
id:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
id: e,
|
|
29
|
+
"aria-invalid": o ? !0 : h,
|
|
30
|
+
"aria-describedby": w,
|
|
31
|
+
className: j(
|
|
32
|
+
t.input,
|
|
33
|
+
o && t.error,
|
|
34
|
+
n && t.withStartIcon,
|
|
35
|
+
d && t.withEndIcon,
|
|
32
36
|
f
|
|
33
37
|
),
|
|
34
|
-
...
|
|
38
|
+
...b
|
|
35
39
|
}
|
|
36
40
|
),
|
|
37
|
-
|
|
41
|
+
d && /* @__PURE__ */ r(i.Icon, { icon: d, position: "end" })
|
|
38
42
|
] }),
|
|
39
|
-
|
|
43
|
+
o && /* @__PURE__ */ r(i.Error, { id: s, error: o })
|
|
40
44
|
] });
|
|
41
45
|
};
|
|
42
46
|
export {
|
|
43
|
-
|
|
47
|
+
g as Input
|
|
44
48
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/Input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/ui/Modal/Modal.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
2
|
import { type ButtonProps } from '../Button/index.js';
|
|
3
|
-
import { type FlexProps } from '../Flex/
|
|
3
|
+
import { type FlexProps } from '../Flex/index.js';
|
|
4
4
|
export declare const MODAL_SIZE: {
|
|
5
5
|
readonly xs: "xs";
|
|
6
6
|
readonly sm: "sm";
|
|
@@ -14,18 +14,21 @@ export interface ModalRootProps {
|
|
|
14
14
|
size?: ModalSize;
|
|
15
15
|
className?: string;
|
|
16
16
|
closeDisabled?: boolean;
|
|
17
|
+
open?: boolean;
|
|
18
|
+
onOpenChange?: (open: boolean) => void;
|
|
17
19
|
'aria-label'?: string;
|
|
18
20
|
}
|
|
19
21
|
interface HeaderProps extends FlexProps {
|
|
22
|
+
text: string | ReactElement;
|
|
20
23
|
closeLabel?: string;
|
|
21
24
|
startIcon?: ReactNode;
|
|
22
25
|
withCloseButton?: boolean;
|
|
23
26
|
}
|
|
24
27
|
export declare const Modal: {
|
|
25
|
-
Root: ({ children, size, className, closeDisabled, "aria-label": ariaLabel, }: ModalRootProps) => import("react").JSX.Element;
|
|
26
|
-
Header: ({ children, startIcon, withCloseButton, closeLabel, ...props }: HeaderProps) => import("react").JSX.Element;
|
|
27
|
-
Content: ({
|
|
28
|
-
|
|
28
|
+
Root: ({ children, size, className, closeDisabled, open, onOpenChange, "aria-label": ariaLabel, }: ModalRootProps) => import("react").JSX.Element;
|
|
29
|
+
Header: ({ text, children, startIcon, withCloseButton, closeLabel, ...props }: HeaderProps) => import("react").JSX.Element;
|
|
30
|
+
Content: ({ className, ...props }: FlexProps) => import("react").JSX.Element;
|
|
31
|
+
Actions: (props: FlexProps) => import("react").JSX.Element;
|
|
29
32
|
Cancel: ({ children, onClick, disabled, ...props }: ButtonProps) => import("react").JSX.Element;
|
|
30
33
|
Confirm: ({ children, type, ...props }: ButtonProps) => import("react").JSX.Element;
|
|
31
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/ui/Modal/Modal.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/ui/Modal/Modal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAMf,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAShD,eAAO,MAAM,UAAU;;;;;;CAMb,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAWrE,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AA6DD,UAAU,WAAY,SAAQ,SAAS;IACrC,IAAI,EAAE,MAAM,GAAG,YAAY,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAwED,eAAO,MAAM,KAAK;uGAhIf,cAAc;mFAiEd,WAAW;uCA0B4B,SAAS;qBAI3B,SAAS;wDAI0B,WAAW;4CAoBZ,WAAW;CASG,CAAC"}
|
package/dist/ui/Modal/Modal.js
CHANGED
|
@@ -1,130 +1,114 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { useProvider as
|
|
7
|
-
import { Button as
|
|
8
|
-
import { Flex as
|
|
9
|
-
import { IconButton as
|
|
10
|
-
import { Text as
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
2
|
+
import { jsx as o, jsxs as x } from "react/jsx-runtime";
|
|
3
|
+
import { useContext as M, useRef as h, useCallback as E, useMemo as N, createContext as P } from "react";
|
|
4
|
+
import { X as R } from "lucide-react";
|
|
5
|
+
import { Dialog as u } from "radix-ui";
|
|
6
|
+
import { useProvider as v } from "../../app/Provider.js";
|
|
7
|
+
import { Button as g } from "../Button/Button.js";
|
|
8
|
+
import { Flex as f } from "../Flex/Flex.js";
|
|
9
|
+
import { IconButton as j } from "../IconButton/IconButton.js";
|
|
10
|
+
import { Text as A } from "../Text/Text.js";
|
|
11
|
+
import { cn as y } from "../../lib/cn.js";
|
|
12
|
+
import { useModal as D } from "./ModalContext.js";
|
|
13
|
+
import a from "./Modal.module.css.js";
|
|
13
14
|
const F = {
|
|
14
15
|
xs: "xs",
|
|
15
16
|
sm: "sm",
|
|
16
17
|
md: "md",
|
|
17
18
|
lg: "lg",
|
|
18
19
|
xl: "xl"
|
|
19
|
-
},
|
|
20
|
+
}, C = P(
|
|
20
21
|
{}
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
const L = () => (g === 0 && (w = document.body.style.overflow, C = document.documentElement.style.overflow, document.body.style.overflow = "hidden", document.documentElement.style.overflow = "hidden"), g += 1, () => {
|
|
24
|
-
g -= 1, g === 0 && (document.body.style.overflow = w, document.documentElement.style.overflow = C);
|
|
25
|
-
}), Y = ({
|
|
26
|
-
children: o,
|
|
22
|
+
), I = ({
|
|
23
|
+
children: e,
|
|
27
24
|
size: n = F.md,
|
|
28
|
-
className:
|
|
29
|
-
closeDisabled:
|
|
30
|
-
|
|
25
|
+
className: s,
|
|
26
|
+
closeDisabled: t = !1,
|
|
27
|
+
open: m = !0,
|
|
28
|
+
onOpenChange: r,
|
|
29
|
+
"aria-label": i
|
|
31
30
|
}) => {
|
|
32
|
-
const { closeModal:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const e = i.current;
|
|
38
|
-
if (!e) return;
|
|
39
|
-
e.showModal();
|
|
40
|
-
const y = L();
|
|
41
|
-
return () => {
|
|
42
|
-
e.close(), y();
|
|
43
|
-
};
|
|
44
|
-
}, []);
|
|
45
|
-
const f = (e) => {
|
|
46
|
-
if (e.target !== e.currentTarget) return !1;
|
|
47
|
-
const { left: y, right: k, top: I, bottom: O } = e.currentTarget.getBoundingClientRect();
|
|
48
|
-
return e.clientX < y || e.clientX > k || e.clientY < I || e.clientY > O;
|
|
49
|
-
};
|
|
50
|
-
return /* @__PURE__ */ s(x.Provider, { value: u, children: /* @__PURE__ */ s(
|
|
51
|
-
"dialog",
|
|
31
|
+
const { closeModal: l } = D(), d = h(null), p = E(() => {
|
|
32
|
+
r ? r(!1) : l();
|
|
33
|
+
}, [r, l]), b = N(() => ({ closeDisabled: t, closeModal: p }), [t, p]);
|
|
34
|
+
return /* @__PURE__ */ o(C.Provider, { value: b, children: /* @__PURE__ */ o(
|
|
35
|
+
u.Root,
|
|
52
36
|
{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"aria-labelledby": c ? void 0 : d,
|
|
57
|
-
"aria-label": c,
|
|
58
|
-
onCancel: (e) => {
|
|
59
|
-
e.preventDefault(), r || a();
|
|
60
|
-
},
|
|
61
|
-
onPointerDown: (e) => {
|
|
62
|
-
t.current = f(e);
|
|
63
|
-
},
|
|
64
|
-
onClick: (e) => {
|
|
65
|
-
!r && t.current && f(e) && a(), t.current = !1;
|
|
37
|
+
open: m,
|
|
38
|
+
onOpenChange: (c) => {
|
|
39
|
+
!c && !t && p();
|
|
66
40
|
},
|
|
67
|
-
children: /* @__PURE__ */
|
|
41
|
+
children: /* @__PURE__ */ x(u.Portal, { children: [
|
|
42
|
+
/* @__PURE__ */ o(u.Overlay, { className: a.overlay }),
|
|
43
|
+
/* @__PURE__ */ o(
|
|
44
|
+
u.Content,
|
|
45
|
+
{
|
|
46
|
+
className: y(a.root, a[n], s),
|
|
47
|
+
"aria-describedby": void 0,
|
|
48
|
+
"aria-label": i,
|
|
49
|
+
onEscapeKeyDown: (c) => {
|
|
50
|
+
t && c.preventDefault();
|
|
51
|
+
},
|
|
52
|
+
onInteractOutside: (c) => {
|
|
53
|
+
t && c.preventDefault();
|
|
54
|
+
},
|
|
55
|
+
onOpenAutoFocus: () => {
|
|
56
|
+
d.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
57
|
+
},
|
|
58
|
+
onCloseAutoFocus: (c) => {
|
|
59
|
+
d.current?.isConnected && (c.preventDefault(), d.current.focus());
|
|
60
|
+
},
|
|
61
|
+
...i ? { "aria-labelledby": void 0 } : {},
|
|
62
|
+
children: /* @__PURE__ */ o(f, { direction: "col", gap: "md", className: a.layout, children: e })
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
] })
|
|
68
66
|
}
|
|
69
67
|
) });
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
}, k = ({
|
|
69
|
+
text: e,
|
|
70
|
+
children: n,
|
|
71
|
+
startIcon: s,
|
|
72
|
+
withCloseButton: t = !0,
|
|
73
|
+
closeLabel: m,
|
|
74
|
+
...r
|
|
76
75
|
}) => {
|
|
77
|
-
const { messages:
|
|
78
|
-
return /* @__PURE__ */
|
|
76
|
+
const { messages: i } = v(), { closeDisabled: l, closeModal: d } = M(C);
|
|
77
|
+
return /* @__PURE__ */ x(f, { justifyContent: "between", alignItems: "start", ...r, children: [
|
|
78
|
+
s,
|
|
79
|
+
/* @__PURE__ */ o(u.Title, { asChild: !0, children: typeof e == "string" ? /* @__PURE__ */ o(A, { size: "xl", weight: "medium", children: e }) : e }),
|
|
79
80
|
n,
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
|
|
82
|
-
A,
|
|
81
|
+
t && /* @__PURE__ */ o(
|
|
82
|
+
j,
|
|
83
83
|
{
|
|
84
|
-
className:
|
|
84
|
+
className: a.close,
|
|
85
85
|
color: "secondary",
|
|
86
|
-
"aria-label":
|
|
87
|
-
disabled:
|
|
88
|
-
onClick:
|
|
89
|
-
children: /* @__PURE__ */
|
|
86
|
+
"aria-label": m ?? i.close,
|
|
87
|
+
disabled: l,
|
|
88
|
+
onClick: d,
|
|
89
|
+
children: /* @__PURE__ */ o(R, {})
|
|
90
90
|
}
|
|
91
91
|
)
|
|
92
92
|
] });
|
|
93
|
-
},
|
|
94
|
-
const
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
if (!t) return;
|
|
98
|
-
const d = () => i(t.scrollHeight > t.clientHeight), u = new ResizeObserver(d);
|
|
99
|
-
return u.observe(t), Array.from(t.children).forEach((f) => u.observe(f)), d(), () => u.disconnect();
|
|
100
|
-
}, [o]), /* @__PURE__ */ s(
|
|
101
|
-
v,
|
|
102
|
-
{
|
|
103
|
-
ref: c,
|
|
104
|
-
className: E(m.content, { [m.scrollable]: a }, n),
|
|
105
|
-
...r,
|
|
106
|
-
children: o
|
|
107
|
-
}
|
|
108
|
-
);
|
|
109
|
-
}, _ = ({ children: o, justifyContent: n = "end", ...l }) => /* @__PURE__ */ s(v, { direction: "row", justifyContent: n, ...l, children: o }), q = ({ children: o, onClick: n, disabled: l, ...r }) => {
|
|
110
|
-
const { messages: c } = p(), { closeModal: a } = h(), { closeDisabled: i } = M(x);
|
|
111
|
-
return /* @__PURE__ */ s(
|
|
112
|
-
S,
|
|
93
|
+
}, w = ({ className: e, ...n }) => /* @__PURE__ */ o(f, { className: y(a.content, e), ...n }), O = (e) => /* @__PURE__ */ o(f, { justifyContent: "end", gap: "sm", ...e }), T = ({ children: e, onClick: n, disabled: s, ...t }) => {
|
|
94
|
+
const { messages: m } = v(), { closeDisabled: r, closeModal: i } = M(C);
|
|
95
|
+
return /* @__PURE__ */ o(
|
|
96
|
+
g,
|
|
113
97
|
{
|
|
114
98
|
variant: "outlined",
|
|
115
|
-
disabled:
|
|
116
|
-
onClick: (
|
|
117
|
-
|
|
99
|
+
disabled: s || r,
|
|
100
|
+
onClick: (l) => {
|
|
101
|
+
r || (n?.(l), l.defaultPrevented || i());
|
|
118
102
|
},
|
|
119
|
-
...
|
|
120
|
-
children:
|
|
103
|
+
...t,
|
|
104
|
+
children: e === void 0 ? m.cancel : e
|
|
121
105
|
}
|
|
122
106
|
);
|
|
123
|
-
},
|
|
124
|
-
const { messages:
|
|
125
|
-
return /* @__PURE__ */
|
|
126
|
-
},
|
|
107
|
+
}, B = ({ children: e, type: n = "submit", ...s }) => {
|
|
108
|
+
const { messages: t } = v();
|
|
109
|
+
return /* @__PURE__ */ o(g, { type: n, ...s, children: e === void 0 ? t.confirm : e });
|
|
110
|
+
}, Q = { Root: I, Header: k, Content: w, Actions: O, Cancel: T, Confirm: B };
|
|
127
111
|
export {
|
|
128
112
|
F as MODAL_SIZE,
|
|
129
|
-
|
|
113
|
+
Q as Modal
|
|
130
114
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
const o = "
|
|
1
|
+
const o = "_root_1oqf7_2", _ = "_overlay_1oqf7_21", t = "_layout_1oqf7_28", s = "_content_1oqf7_32", c = "_xs_1oqf7_40", l = "_sm_1oqf7_41", n = "_md_1oqf7_42", e = "_lg_1oqf7_43", f = "_xl_1oqf7_44", q = "_close_1oqf7_46", a = {
|
|
2
2
|
root: o,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
xs:
|
|
3
|
+
overlay: _,
|
|
4
|
+
layout: t,
|
|
5
|
+
content: s,
|
|
6
|
+
xs: c,
|
|
7
7
|
sm: l,
|
|
8
|
-
md:
|
|
9
|
-
lg:
|
|
10
|
-
xl:
|
|
11
|
-
close:
|
|
8
|
+
md: n,
|
|
9
|
+
lg: e,
|
|
10
|
+
xl: f,
|
|
11
|
+
close: q
|
|
12
12
|
};
|
|
13
13
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
q as close,
|
|
15
|
+
s as content,
|
|
16
16
|
a as default,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
t as layout,
|
|
18
|
+
e as lg,
|
|
19
|
+
n as md,
|
|
20
|
+
_ as overlay,
|
|
20
21
|
o as root,
|
|
21
|
-
s as scrollable,
|
|
22
22
|
l as sm,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
f as xl,
|
|
24
|
+
c as xs
|
|
25
25
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/Modal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,KAAK,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultipleChip.d.ts","sourceRoot":"","sources":["../../../src/ui/MultipleChip/MultipleChip.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"MultipleChip.d.ts","sourceRoot":"","sources":["../../../src/ui/MultipleChip/MultipleChip.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAGhD,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IACpE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,YAAY,GAAI,0IAY1B,iBAAiB,gCA2DnB,CAAC"}
|