@fluidattacks/design 8.3.0 → 8.3.1
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/components/modal/columns-modal/index.js +32 -31
- package/dist/components/modal/dialog/index.d.ts +4 -0
- package/dist/components/modal/dialog/index.js +32 -0
- package/dist/components/modal/dialog/utils.d.ts +2 -0
- package/dist/components/modal/dialog/utils.js +26 -0
- package/dist/components/modal/index.js +71 -78
- package/dist/components/modal/types.d.ts +11 -1
- package/dist/components/table/table-column-toggle/index.js +4 -4
- package/package.json +1 -1
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t, jsxs as l } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as k, useState as j, useCallback as m } from "react";
|
|
3
3
|
import { createPortal as w } from "react-dom";
|
|
4
4
|
import { useTheme as H } from "styled-components";
|
|
5
|
-
import {
|
|
5
|
+
import { Dialog as S } from "../dialog/index.js";
|
|
6
|
+
import { ModalContainer as D } from "../styles.js";
|
|
6
7
|
import { Button as p } from "../../button/index.js";
|
|
7
8
|
import { Container as c } from "../../container/index.js";
|
|
8
9
|
import { Divider as d } from "../../divider/index.js";
|
|
9
|
-
import { IconButton as
|
|
10
|
-
import { PreviewPanel as
|
|
11
|
-
import { SearchPanel as
|
|
12
|
-
import { Heading as
|
|
10
|
+
import { IconButton as P } from "../../icon-button/index.js";
|
|
11
|
+
import { PreviewPanel as T } from "./preview-panel/index.js";
|
|
12
|
+
import { SearchPanel as z } from "./search-panel/index.js";
|
|
13
|
+
import { Heading as B } from "../../typography/heading/index.js";
|
|
13
14
|
import "../../typography/span/index.js";
|
|
14
15
|
import "../../typography/text/index.js";
|
|
15
|
-
const
|
|
16
|
+
const U = ({
|
|
16
17
|
_containerId: h = "portals",
|
|
17
18
|
title: y,
|
|
18
19
|
modalRef: e,
|
|
19
20
|
variant: f
|
|
20
21
|
}) => {
|
|
21
22
|
const a = H(), u = k(null), [o, g] = j(void 0), C = m(
|
|
22
|
-
(
|
|
23
|
-
const { checked: n, value:
|
|
23
|
+
(i) => {
|
|
24
|
+
const { checked: n, value: r } = i.target, x = e.columns.map((s) => s.name === r ? (s.toggleVisibility?.(n), { ...s, visible: n }) : s);
|
|
24
25
|
e.setColumns(x);
|
|
25
26
|
},
|
|
26
27
|
[e]
|
|
27
28
|
), b = m(
|
|
28
|
-
(
|
|
29
|
-
const n = e.columns.map((
|
|
29
|
+
(i) => {
|
|
30
|
+
const n = e.columns.map((r) => r.id === i ? (r.toggleVisibility?.(!1), { ...r, visible: !1 }) : r);
|
|
30
31
|
e.setColumns(n);
|
|
31
32
|
},
|
|
32
33
|
[e]
|
|
33
34
|
), v = m(() => {
|
|
34
|
-
const
|
|
35
|
-
o !==
|
|
35
|
+
const i = u.current?.scrollHeight;
|
|
36
|
+
o !== i && g(i);
|
|
36
37
|
}, [o]);
|
|
37
38
|
return e.isOpen ? w(
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
39
|
+
/* @__PURE__ */ t(S, { label: e.name, children: /* @__PURE__ */ l(D, { $size: "md", flexDirection: "column", children: [
|
|
40
|
+
/* @__PURE__ */ l(
|
|
40
41
|
c,
|
|
41
42
|
{
|
|
42
43
|
display: "flex",
|
|
@@ -44,9 +45,9 @@ const N = ({
|
|
|
44
45
|
px: 1.25,
|
|
45
46
|
py: 1.25,
|
|
46
47
|
children: [
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
|
|
48
|
+
/* @__PURE__ */ t(B, { size: "sm", children: y }),
|
|
49
|
+
/* @__PURE__ */ t(
|
|
50
|
+
P,
|
|
50
51
|
{
|
|
51
52
|
icon: "close",
|
|
52
53
|
iconColor: a.palette.gray[400],
|
|
@@ -63,8 +64,8 @@ const N = ({
|
|
|
63
64
|
]
|
|
64
65
|
}
|
|
65
66
|
),
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ t(d, { mb: 0, mt: 0 }),
|
|
68
|
+
/* @__PURE__ */ l(
|
|
68
69
|
c,
|
|
69
70
|
{
|
|
70
71
|
display: "flex",
|
|
@@ -75,8 +76,8 @@ const N = ({
|
|
|
75
76
|
scroll: "y",
|
|
76
77
|
width: "100%",
|
|
77
78
|
children: [
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
|
|
79
|
+
/* @__PURE__ */ t(
|
|
80
|
+
z,
|
|
80
81
|
{
|
|
81
82
|
columns: e.columns,
|
|
82
83
|
formId: "columns-visibility",
|
|
@@ -84,15 +85,15 @@ const N = ({
|
|
|
84
85
|
variant: f
|
|
85
86
|
}
|
|
86
87
|
),
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ t(
|
|
88
89
|
c,
|
|
89
90
|
{
|
|
90
91
|
borderLeft: `2px solid ${a.palette.gray[100]}`,
|
|
91
92
|
height: o ? `${o}px` : "auto"
|
|
92
93
|
}
|
|
93
94
|
),
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
|
|
95
|
+
/* @__PURE__ */ t(
|
|
96
|
+
T,
|
|
96
97
|
{
|
|
97
98
|
description: "Click and drag to reorder the columns",
|
|
98
99
|
items: e.columns,
|
|
@@ -104,8 +105,8 @@ const N = ({
|
|
|
104
105
|
]
|
|
105
106
|
}
|
|
106
107
|
),
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ t(d, { mb: 0, mt: 0 }),
|
|
109
|
+
/* @__PURE__ */ l(
|
|
109
110
|
c,
|
|
110
111
|
{
|
|
111
112
|
display: "flex",
|
|
@@ -113,7 +114,7 @@ const N = ({
|
|
|
113
114
|
px: 1.25,
|
|
114
115
|
py: 1.25,
|
|
115
116
|
children: [
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ t(
|
|
117
118
|
p,
|
|
118
119
|
{
|
|
119
120
|
disabled: !e.hasChanged,
|
|
@@ -126,7 +127,7 @@ const N = ({
|
|
|
126
127
|
children: "Reset to default"
|
|
127
128
|
}
|
|
128
129
|
),
|
|
129
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ t(
|
|
130
131
|
p,
|
|
131
132
|
{
|
|
132
133
|
id: "columns-modal-submit",
|
|
@@ -141,8 +142,8 @@ const N = ({
|
|
|
141
142
|
)
|
|
142
143
|
] }) }),
|
|
143
144
|
document.getElementById(h) ?? document.body
|
|
144
|
-
) : /* @__PURE__ */
|
|
145
|
+
) : /* @__PURE__ */ t("div", {});
|
|
145
146
|
};
|
|
146
147
|
export {
|
|
147
|
-
|
|
148
|
+
U as ColumnsModal
|
|
148
149
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as f, useState as c } from "react";
|
|
3
|
+
import { trapTabKey as o } from "./utils.js";
|
|
4
|
+
import { ModalWrapper as p } from "../styles.js";
|
|
5
|
+
import { useMountEffect as s } from "../../../hooks/use-mount-effect.js";
|
|
6
|
+
const w = ({
|
|
7
|
+
children: n = void 0,
|
|
8
|
+
id: a = void 0,
|
|
9
|
+
label: i
|
|
10
|
+
}) => {
|
|
11
|
+
const r = f(null), [t] = c(() => document.activeElement);
|
|
12
|
+
return s(() => {
|
|
13
|
+
const e = r.current;
|
|
14
|
+
return e?.contains(document.activeElement) !== !0 && e?.focus(), e?.addEventListener("keydown", o), () => {
|
|
15
|
+
e?.removeEventListener("keydown", o), t instanceof HTMLElement && t.focus();
|
|
16
|
+
};
|
|
17
|
+
}), /* @__PURE__ */ m(
|
|
18
|
+
p,
|
|
19
|
+
{
|
|
20
|
+
"aria-label": i,
|
|
21
|
+
"aria-modal": "true",
|
|
22
|
+
id: a,
|
|
23
|
+
ref: r,
|
|
24
|
+
role: "dialog",
|
|
25
|
+
tabIndex: -1,
|
|
26
|
+
children: n
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
w as Dialog
|
|
32
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const s = [
|
|
2
|
+
"a[href]",
|
|
3
|
+
"area[href]",
|
|
4
|
+
"button:not([disabled])",
|
|
5
|
+
"input:not([disabled]):not([type='hidden'])",
|
|
6
|
+
"select:not([disabled])",
|
|
7
|
+
"textarea:not([disabled])",
|
|
8
|
+
"iframe",
|
|
9
|
+
"[contenteditable='true']",
|
|
10
|
+
"[tabindex]:not([tabindex='-1'])"
|
|
11
|
+
].join(", "), c = (t) => Array.from(t.querySelectorAll(s)), d = (t) => {
|
|
12
|
+
const { currentTarget: n } = t;
|
|
13
|
+
if (t.key !== "Tab" || !(n instanceof HTMLElement)) return;
|
|
14
|
+
const e = c(n);
|
|
15
|
+
if (e.length === 0) {
|
|
16
|
+
t.preventDefault();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const a = e.findIndex(
|
|
20
|
+
(r) => r === document.activeElement
|
|
21
|
+
), o = t.shiftKey && a <= 0, i = !t.shiftKey && a === e.length - 1;
|
|
22
|
+
(o || i) && (t.preventDefault(), e[o ? e.length - 1 : 0].focus());
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
d as trapTabKey
|
|
26
|
+
};
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r, jsxs as v } from "react/jsx-runtime";
|
|
2
2
|
import o from "../../_virtual/lodash.js";
|
|
3
3
|
import { useState as E, useRef as y, useEffect as F } from "react";
|
|
4
4
|
import { createPortal as $ } from "react-dom";
|
|
5
5
|
import { useTheme as z } from "styled-components";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { Dialog as k } from "./dialog/index.js";
|
|
7
|
+
import { ModalFooter as A } from "./footer/index.js";
|
|
8
|
+
import { Header as D } from "./header/index.js";
|
|
9
|
+
import { ModalConfirm as si } from "./modal-confirm/index.js";
|
|
10
|
+
import { ModalContainer as I, ModalContent as w, ImageContainer as B } from "./styles.js";
|
|
10
11
|
import { CloudImage as N } from "../cloud-image/index.js";
|
|
11
12
|
import { Container as P } from "../container/index.js";
|
|
12
|
-
import { Tabs as
|
|
13
|
+
import { Tabs as _ } from "../tabs/index.js";
|
|
13
14
|
import "../typography/heading/index.js";
|
|
14
15
|
import "../typography/span/index.js";
|
|
15
|
-
import { Text as
|
|
16
|
-
import { ColumnsModal as
|
|
17
|
-
const
|
|
16
|
+
import { Text as q } from "../typography/text/index.js";
|
|
17
|
+
import { ColumnsModal as ai } from "./columns-modal/index.js";
|
|
18
|
+
const oi = ({
|
|
18
19
|
_portal: b = !0,
|
|
19
20
|
alert: C,
|
|
20
21
|
cancelButton: n = void 0,
|
|
21
22
|
children: l = void 0,
|
|
22
23
|
confirmButton: p = void 0,
|
|
23
|
-
content:
|
|
24
|
+
content: i = void 0,
|
|
24
25
|
description: M = void 0,
|
|
25
26
|
dismissable: O = !0,
|
|
26
27
|
modalRef: e,
|
|
@@ -31,84 +32,76 @@ const er = ({
|
|
|
31
32
|
size: H,
|
|
32
33
|
id: c = "modal-container"
|
|
33
34
|
}) => {
|
|
34
|
-
const f = z(), [
|
|
35
|
+
const f = z(), [g, u] = E(void 0), d = y(null), a = y(!1), m = Array.isArray(t) && t.length > 0, S = n ?? p;
|
|
35
36
|
F(() => {
|
|
36
|
-
if (m && !
|
|
37
|
-
const x =
|
|
38
|
-
x > 50 && (
|
|
37
|
+
if (m && !a.current && d.current) {
|
|
38
|
+
const x = d.current.getBoundingClientRect().height;
|
|
39
|
+
x > 50 && (u(x), a.current = !0);
|
|
39
40
|
}
|
|
40
|
-
e.isOpen || (
|
|
41
|
+
e.isOpen || (u(void 0), a.current = !1);
|
|
41
42
|
}, [m, e.isOpen]);
|
|
42
|
-
const h = /* @__PURE__ */
|
|
43
|
+
const h = /* @__PURE__ */ r(k, { id: "modal-wrapper", label: e.name, children: /* @__PURE__ */ v(
|
|
43
44
|
I,
|
|
44
45
|
{
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
cancelButton: n,
|
|
95
|
-
confirmButton: p,
|
|
96
|
-
modalRef: e
|
|
97
|
-
}
|
|
98
|
-
)
|
|
99
|
-
]
|
|
100
|
-
}
|
|
101
|
-
)
|
|
46
|
+
$size: H,
|
|
47
|
+
"data-testid": c,
|
|
48
|
+
flexDirection: "column",
|
|
49
|
+
id: c,
|
|
50
|
+
ref: m ? d : void 0,
|
|
51
|
+
style: m && g ? { height: g } : void 0,
|
|
52
|
+
children: [
|
|
53
|
+
!o.isEmpty(s) && !o.isNil(s) && /* @__PURE__ */ r(
|
|
54
|
+
D,
|
|
55
|
+
{
|
|
56
|
+
description: M,
|
|
57
|
+
dismissable: O,
|
|
58
|
+
modalRef: e,
|
|
59
|
+
onClose: j,
|
|
60
|
+
otherActions: T,
|
|
61
|
+
title: s
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
t && /* @__PURE__ */ r(
|
|
65
|
+
P,
|
|
66
|
+
{
|
|
67
|
+
borderTop: `1px solid ${f.palette.gray[300]}`,
|
|
68
|
+
display: "block",
|
|
69
|
+
mb: 1.25,
|
|
70
|
+
position: "sticky",
|
|
71
|
+
children: /* @__PURE__ */ r(_, { items: t })
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
(o.isObject(i) || l) && /* @__PURE__ */ v(
|
|
75
|
+
w,
|
|
76
|
+
{
|
|
77
|
+
style: S ? { borderBottom: `1px solid ${f.palette.gray[200]}` } : void 0,
|
|
78
|
+
children: [
|
|
79
|
+
l,
|
|
80
|
+
o.isObject(i) && o.isString(i.imageSrc) && /* @__PURE__ */ r(B, { $framed: i.imageFramed, children: /* @__PURE__ */ r(N, { alt: "modal-img", publicId: i.imageSrc }) }),
|
|
81
|
+
o.isObject(i) && o.isString(i.imageText) && /* @__PURE__ */ r(q, { size: "md", children: i.imageText })
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ r(
|
|
86
|
+
A,
|
|
87
|
+
{
|
|
88
|
+
alert: C,
|
|
89
|
+
cancelButton: n,
|
|
90
|
+
confirmButton: p,
|
|
91
|
+
modalRef: e
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
]
|
|
102
95
|
}
|
|
103
|
-
);
|
|
96
|
+
) });
|
|
104
97
|
return b && e.isOpen ? $(
|
|
105
98
|
h,
|
|
106
99
|
document.getElementById("portals") ?? document.body
|
|
107
100
|
) : e.isOpen ? h : null;
|
|
108
101
|
};
|
|
109
102
|
export {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
103
|
+
ai as ColumnsModal,
|
|
104
|
+
oi as Modal,
|
|
105
|
+
si as ModalConfirm,
|
|
106
|
+
A as ModalFooter
|
|
114
107
|
};
|
|
@@ -25,6 +25,16 @@ interface IModalContent {
|
|
|
25
25
|
imageFramed?: boolean;
|
|
26
26
|
imageText?: string;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Modal dialog props.
|
|
30
|
+
* @interface IDialogProps
|
|
31
|
+
* @property { string } [id] - The id of the dialog element.
|
|
32
|
+
* @property { string } label - The accessible name announced when the dialog takes focus.
|
|
33
|
+
*/
|
|
34
|
+
interface IDialogProps {
|
|
35
|
+
id?: string;
|
|
36
|
+
label: string;
|
|
37
|
+
}
|
|
28
38
|
/**
|
|
29
39
|
* Modal header component props.
|
|
30
40
|
* @interface IModalHeaderProps
|
|
@@ -92,4 +102,4 @@ interface IModalConfirmProps {
|
|
|
92
102
|
txtCancel?: string;
|
|
93
103
|
txtConfirm?: React.ReactNode | string;
|
|
94
104
|
}
|
|
95
|
-
export type { IModalProps, IModalContent, IModalConfirmProps, IModalFooterProps, IModalHeaderProps, TSize, };
|
|
105
|
+
export type { IDialogProps, IModalProps, IModalContent, IModalConfirmProps, IModalFooterProps, IModalHeaderProps, TSize, };
|
|
@@ -5,6 +5,7 @@ import { Button as f } from "../../button/index.js";
|
|
|
5
5
|
import "../../../_virtual/lodash.js";
|
|
6
6
|
import "react-dom";
|
|
7
7
|
import "styled-components";
|
|
8
|
+
import { useColumnsModal as b } from "../../../hooks/use-columns-modal.js";
|
|
8
9
|
import "../../container/index.js";
|
|
9
10
|
import "../../icon-button/index.js";
|
|
10
11
|
import "../../typography/heading/index.js";
|
|
@@ -14,8 +15,7 @@ import "../../cloud-image/index.js";
|
|
|
14
15
|
import "react-router";
|
|
15
16
|
import "../../notification-sign/index.js";
|
|
16
17
|
import "../../icon/index.js";
|
|
17
|
-
import { ColumnsModal as
|
|
18
|
-
import { useColumnsModal as C } from "../../../hooks/use-columns-modal.js";
|
|
18
|
+
import { ColumnsModal as C } from "../../modal/columns-modal/index.js";
|
|
19
19
|
const G = (s) => {
|
|
20
20
|
const { table: t } = s, { meta: m } = t.options, [, n] = t.getHeaderGroups(), a = t.getVisibleLeafColumns().filter((o) => o.id !== "selection").length, i = l(
|
|
21
21
|
() => t.getAllLeafColumns().filter((o) => o.id !== "selection"),
|
|
@@ -27,7 +27,7 @@ const G = (s) => {
|
|
|
27
27
|
name: typeof o.columnDef.header == "string" ? o.columnDef.header : o.columnDef.id ?? "",
|
|
28
28
|
toggleVisibility: o.toggleVisibility,
|
|
29
29
|
visible: o.getIsVisible()
|
|
30
|
-
})), [i]), e =
|
|
30
|
+
})), [i]), e = b({
|
|
31
31
|
columnOrder: m?.defaultColumnOrder ?? [],
|
|
32
32
|
items: d,
|
|
33
33
|
name: "table-column-management",
|
|
@@ -48,7 +48,7 @@ const G = (s) => {
|
|
|
48
48
|
}
|
|
49
49
|
),
|
|
50
50
|
/* @__PURE__ */ r(
|
|
51
|
-
|
|
51
|
+
C,
|
|
52
52
|
{
|
|
53
53
|
modalRef: e,
|
|
54
54
|
title: "Manage columns",
|
package/package.json
CHANGED