@ogcio/design-system-react 1.29.0 → 1.31.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/README.md +11 -33
- package/dist/alert/variants.d.ts +78 -2
- package/dist/atoms/DsButton.d.ts +194 -0
- package/dist/atoms/DsButton.js +330 -0
- package/dist/atoms/InsetText.d.ts +14 -0
- package/dist/atoms/InsetText.js +17 -0
- package/dist/atoms/icons/Close.d.ts +3 -0
- package/dist/atoms/icons/Close.js +23 -0
- package/dist/atoms/icons/KeyboardArrowDown.d.ts +3 -0
- package/dist/atoms/icons/KeyboardArrowDown.js +23 -0
- package/dist/atoms/icons/KeyboardArrowUp.d.ts +3 -0
- package/dist/atoms/icons/KeyboardArrowUp.js +23 -0
- package/dist/atoms/icons/Visibility.d.ts +3 -0
- package/dist/atoms/icons/Visibility.js +23 -0
- package/dist/atoms/icons/VisibilityOff.d.ts +3 -0
- package/dist/atoms/icons/VisibilityOff.js +23 -0
- package/dist/atoms/icons/index.d.ts +6 -0
- package/dist/atoms/icons/index.js +12 -0
- package/dist/atoms/icons/logos/LogoBlack.d.ts +3 -0
- package/dist/atoms/icons/logos/LogoBlack.js +327 -0
- package/dist/atoms/icons/logos/LogoGoldGreen.d.ts +3 -0
- package/dist/atoms/icons/logos/LogoGoldGreen.js +327 -0
- package/dist/atoms/icons/logos/LogoGoldWhite.d.ts +3 -0
- package/dist/atoms/icons/logos/LogoGoldWhite.js +87 -0
- package/dist/atoms/icons/logos/LogoHarpBlack.d.ts +3 -0
- package/dist/atoms/icons/logos/LogoHarpBlack.js +68 -0
- package/dist/atoms/icons/logos/LogoHarpWhite.d.ts +3 -0
- package/dist/{assets/logos/LogoHarpBlack.js → atoms/icons/logos/LogoHarpWhite.js} +33 -31
- package/dist/atoms/icons/logos/LogoWhite.d.ts +3 -0
- package/dist/atoms/icons/logos/LogoWhite.js +327 -0
- package/dist/atoms/icons/logos/index.d.ts +6 -0
- package/dist/atoms/icons/logos/index.js +14 -0
- package/dist/atoms/icons/types.d.ts +10 -0
- package/dist/atoms/icons/types.js +1 -0
- package/dist/atoms/index.d.ts +3 -0
- package/dist/atoms/index.js +16 -0
- package/dist/autocomplete/autocomplete.js +131 -115
- package/dist/blockquote/blockquote.d.ts +4 -1
- package/dist/blockquote/blockquote.js +18 -4
- package/dist/breadcrumbs/breadcrumbs.js +54 -33
- package/dist/button-group/button-group.js +31 -28
- package/dist/character-count/character-count.js +5 -5
- package/dist/chip/chip.js +41 -19
- package/dist/combo-box/combo-box.js +6 -13
- package/dist/combo-box/dropdown-item.js +39 -40
- package/dist/cookie-banner/cookie-banner.js +28 -20
- package/dist/data-table/data-table-footer.js +57 -51
- package/dist/data-table/data-table-header.d.ts +7 -7
- package/dist/data-table/data-table-header.js +97 -110
- package/dist/data-table/data-table-selected-rows.d.ts +1 -0
- package/dist/data-table/data-table-selected-rows.js +15 -19
- package/dist/details/details.js +43 -23
- package/dist/drawer/drawer.js +35 -32
- package/dist/footer/footer.js +54 -46
- package/dist/forms/form-field/form-field.d.ts +2 -2
- package/dist/forms/form-field/form-field.js +40 -30
- package/dist/forms/form-field/types.d.ts +10 -3
- package/dist/header/components/header-slot.js +33 -32
- package/dist/header/header-legacy.js +8 -8
- package/dist/header/variants.d.ts +220 -20
- package/dist/heading/heading.d.ts +70 -2
- package/dist/hooks/use-aria-hider.d.ts +1 -1
- package/dist/hooks/use-aria-hider.js +14 -13
- package/dist/hooks/use-breakpoint.js +15 -12
- package/dist/hooks/use-focus-trap.d.ts +1 -1
- package/dist/hooks/use-focus-trap.js +179 -179
- package/dist/icon/icon.d.ts +10 -0
- package/dist/icon/icon.js +64 -52
- package/dist/icon/icons.d.ts +1 -1
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +144 -142
- package/dist/input-file/input-file.js +15 -12
- package/dist/input-password/input-password.js +13 -12
- package/dist/input-text/input-text.js +18 -16
- package/dist/label/label.d.ts +43 -0
- package/dist/label/label.js +7 -6
- package/dist/logos/index.d.ts +1 -0
- package/dist/logos/index.js +14 -0
- package/dist/modal/modal.js +125 -127
- package/dist/popover/popover.js +67 -64
- package/dist/score-select/score-select.js +20 -20
- package/dist/select/select-next.js +45 -45
- package/dist/spinner/spinner.d.ts +30 -2
- package/dist/styles.css +12 -2
- package/dist/table/table-row.js +14 -7
- package/dist/table/table.d.ts +22 -2
- package/dist/tabs/tab-item.d.ts +2 -2
- package/dist/tabs/tab-panel.js +6 -6
- package/dist/tabs/tabs.js +19 -19
- package/dist/text-input/text-input.d.ts +1 -1
- package/dist/textarea/textarea.js +27 -28
- package/dist/toast/ds-toast.d.ts +78 -2
- package/fonts.css +10 -0
- package/package.json +17 -12
- package/dist/assets/logos/LogoBlack.d.ts +0 -3
- package/dist/assets/logos/LogoBlack.js +0 -322
- package/dist/assets/logos/LogoGoldGreen.d.ts +0 -3
- package/dist/assets/logos/LogoGoldGreen.js +0 -322
- package/dist/assets/logos/LogoGoldWhite.d.ts +0 -3
- package/dist/assets/logos/LogoGoldWhite.js +0 -82
- package/dist/assets/logos/LogoHarpBlack.d.ts +0 -3
- package/dist/assets/logos/LogoHarpWhite.d.ts +0 -3
- package/dist/assets/logos/LogoHarpWhite.js +0 -60
- package/dist/assets/logos/LogoWhite.d.ts +0 -3
- package/dist/assets/logos/LogoWhite.js +0 -322
- package/dist/assets/logos/index.d.ts +0 -6
- package/dist/assets/logos/index.js +0 -14
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { forwardRef as r, useState as
|
|
4
|
-
import { InputText as
|
|
5
|
-
const
|
|
2
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as r, useState as a } from "react";
|
|
4
|
+
import { InputText as c } from "../input-text/input-text.js";
|
|
5
|
+
const l = r(
|
|
6
6
|
(o, s) => {
|
|
7
|
-
const [t,
|
|
7
|
+
const [t, e] = a({
|
|
8
8
|
icon: "visibility",
|
|
9
9
|
type: "password"
|
|
10
|
-
}),
|
|
10
|
+
}), n = () => {
|
|
11
11
|
const i = t.type === "text";
|
|
12
|
-
|
|
12
|
+
e({
|
|
13
13
|
type: i ? "password" : "text",
|
|
14
14
|
icon: i ? "visibility" : "visibility_off"
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
|
|
17
|
+
return /* @__PURE__ */ p(
|
|
18
|
+
c,
|
|
19
19
|
{
|
|
20
20
|
...o,
|
|
21
21
|
type: t.type,
|
|
22
22
|
inputActionButton: {
|
|
23
23
|
icon: t.icon,
|
|
24
|
-
onClick:
|
|
24
|
+
onClick: n,
|
|
25
|
+
ariaLabel: t.type === "text" ? "show" : "hide"
|
|
25
26
|
},
|
|
26
27
|
ref: s
|
|
27
28
|
}
|
|
28
29
|
);
|
|
29
30
|
}
|
|
30
31
|
);
|
|
31
|
-
|
|
32
|
+
l.displayName = "InputPassword";
|
|
32
33
|
export {
|
|
33
|
-
|
|
34
|
+
l as InputPassword
|
|
34
35
|
};
|
|
@@ -24,7 +24,9 @@ const H = d(
|
|
|
24
24
|
__origin: "clear_button"
|
|
25
25
|
};
|
|
26
26
|
a && a(f);
|
|
27
|
-
}
|
|
27
|
+
},
|
|
28
|
+
ariaLabel: "Clear input"
|
|
29
|
+
// TODO I18N: translation
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
);
|
|
@@ -35,18 +37,18 @@ const H = d(
|
|
|
35
37
|
inputActionButton: e,
|
|
36
38
|
inputActionPosition: r = "beforeSuffix",
|
|
37
39
|
suffix: t,
|
|
38
|
-
halfFluid:
|
|
40
|
+
halfFluid: s = !1,
|
|
39
41
|
className: f,
|
|
40
42
|
type: g = "text",
|
|
41
43
|
iconStart: c,
|
|
42
44
|
iconStartClassName: v,
|
|
43
45
|
onIconStartClick: N,
|
|
44
|
-
iconEnd:
|
|
46
|
+
iconEnd: l,
|
|
45
47
|
iconEndClassName: T,
|
|
46
48
|
onIconEndClick: C,
|
|
47
49
|
disabled: i,
|
|
48
|
-
inputClassName:
|
|
49
|
-
iconEndRef:
|
|
50
|
+
inputClassName: b,
|
|
51
|
+
iconEndRef: w,
|
|
50
52
|
containerProps: k,
|
|
51
53
|
...o
|
|
52
54
|
}, z) => {
|
|
@@ -55,7 +57,7 @@ const H = d(
|
|
|
55
57
|
{
|
|
56
58
|
className: "gi-input-text-action-before-suffix",
|
|
57
59
|
"data-suffix": !!t,
|
|
58
|
-
"data-has-icon-end": !!
|
|
60
|
+
"data-has-icon-end": !!l,
|
|
59
61
|
children: /* @__PURE__ */ n(p, { ...e, disabled: i })
|
|
60
62
|
}
|
|
61
63
|
) : null, [e]);
|
|
@@ -70,7 +72,7 @@ const H = d(
|
|
|
70
72
|
"div",
|
|
71
73
|
{
|
|
72
74
|
className: u("gi-input-text-inner", {
|
|
73
|
-
"gi-input-half-width":
|
|
75
|
+
"gi-input-half-width": s
|
|
74
76
|
}),
|
|
75
77
|
children: [
|
|
76
78
|
c && /* @__PURE__ */ n(
|
|
@@ -94,26 +96,26 @@ const H = d(
|
|
|
94
96
|
{
|
|
95
97
|
type: g,
|
|
96
98
|
"data-icon-start": !!c,
|
|
97
|
-
"data-icon-end": !!
|
|
99
|
+
"data-icon-end": !!l,
|
|
98
100
|
"data-end-element": !!e,
|
|
99
101
|
"data-prefix": !!a,
|
|
100
102
|
"data-suffix": !!t,
|
|
101
103
|
"data-testid": o.dataTestId,
|
|
102
|
-
className: u("gi-input-text",
|
|
104
|
+
className: u("gi-input-text", b),
|
|
103
105
|
ref: z,
|
|
104
106
|
disabled: i,
|
|
105
107
|
...o
|
|
106
108
|
}
|
|
107
109
|
),
|
|
108
|
-
|
|
110
|
+
l && /* @__PURE__ */ n(
|
|
109
111
|
"div",
|
|
110
112
|
{
|
|
111
113
|
className: u("gi-input-text-icon-end", T),
|
|
112
114
|
"data-end-element": !!e && r === "afterSuffix",
|
|
113
115
|
"data-suffix": !!t,
|
|
114
116
|
onClick: C,
|
|
115
|
-
ref:
|
|
116
|
-
children: typeof
|
|
117
|
+
ref: w,
|
|
118
|
+
children: typeof l == "string" ? /* @__PURE__ */ n(x, { icon: l, size: "md", disabled: i }) : l
|
|
117
119
|
}
|
|
118
120
|
),
|
|
119
121
|
R
|
|
@@ -131,11 +133,11 @@ const H = d(
|
|
|
131
133
|
ariaLabel: e,
|
|
132
134
|
icon: r,
|
|
133
135
|
dataTestId: t,
|
|
134
|
-
...
|
|
136
|
+
...s
|
|
135
137
|
}) => /* @__PURE__ */ n(
|
|
136
138
|
O,
|
|
137
139
|
{
|
|
138
|
-
...
|
|
140
|
+
...s,
|
|
139
141
|
icon: {
|
|
140
142
|
icon: r
|
|
141
143
|
},
|
|
@@ -150,7 +152,7 @@ const H = d(
|
|
|
150
152
|
({ type: a = "text", clearButtonEnabled: e, ...r }, t) => e || a === "search" ? /* @__PURE__ */ n(H, { ref: t, type: a, ...r }) : /* @__PURE__ */ n(h, { ref: t, type: a, ...r })
|
|
151
153
|
);
|
|
152
154
|
I.displayName = "InputText";
|
|
153
|
-
const
|
|
155
|
+
const D = d(({ type: a = "text", error: e, ...r }, t) => /* @__PURE__ */ n(
|
|
154
156
|
I,
|
|
155
157
|
{
|
|
156
158
|
...r,
|
|
@@ -166,5 +168,5 @@ const F = d(({ type: a = "text", error: e, ...r }, t) => /* @__PURE__ */ n(
|
|
|
166
168
|
export {
|
|
167
169
|
p as InputActionButton,
|
|
168
170
|
I as InputText,
|
|
169
|
-
|
|
171
|
+
D as InputTextTableCell
|
|
170
172
|
};
|
package/dist/label/label.d.ts
CHANGED
|
@@ -3,6 +3,49 @@ export declare const LabelSize: {
|
|
|
3
3
|
readonly Medium: "md";
|
|
4
4
|
readonly Large: "lg";
|
|
5
5
|
};
|
|
6
|
+
export declare const styles: import('tailwind-variants').TVReturnType<{
|
|
7
|
+
size: {
|
|
8
|
+
sm: string;
|
|
9
|
+
md: string;
|
|
10
|
+
lg: string;
|
|
11
|
+
};
|
|
12
|
+
}, undefined, "gi-label", import('tailwind-variants/dist/config.js').TVConfig<{
|
|
13
|
+
size: {
|
|
14
|
+
sm: string;
|
|
15
|
+
md: string;
|
|
16
|
+
lg: string;
|
|
17
|
+
};
|
|
18
|
+
}, {
|
|
19
|
+
size: {
|
|
20
|
+
sm: string;
|
|
21
|
+
md: string;
|
|
22
|
+
lg: string;
|
|
23
|
+
};
|
|
24
|
+
}>, {
|
|
25
|
+
size: {
|
|
26
|
+
sm: string;
|
|
27
|
+
md: string;
|
|
28
|
+
lg: string;
|
|
29
|
+
};
|
|
30
|
+
}, undefined, import('tailwind-variants').TVReturnType<{
|
|
31
|
+
size: {
|
|
32
|
+
sm: string;
|
|
33
|
+
md: string;
|
|
34
|
+
lg: string;
|
|
35
|
+
};
|
|
36
|
+
}, undefined, "gi-label", import('tailwind-variants/dist/config.js').TVConfig<{
|
|
37
|
+
size: {
|
|
38
|
+
sm: string;
|
|
39
|
+
md: string;
|
|
40
|
+
lg: string;
|
|
41
|
+
};
|
|
42
|
+
}, {
|
|
43
|
+
size: {
|
|
44
|
+
sm: string;
|
|
45
|
+
md: string;
|
|
46
|
+
lg: string;
|
|
47
|
+
};
|
|
48
|
+
}>, unknown, unknown, undefined>>;
|
|
6
49
|
export declare const Label: import('react').ForwardRefExoticComponent<import('react').LabelHTMLAttributes<HTMLLabelElement> & {
|
|
7
50
|
text?: string | React.ReactElement;
|
|
8
51
|
size?: import('./types.js').LabelSizeType;
|
package/dist/label/label.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as r } from "react";
|
|
3
3
|
import { c as o } from "../index-CB-zPpNk.js";
|
|
4
4
|
const d = {
|
|
@@ -17,11 +17,12 @@ const d = {
|
|
|
17
17
|
defaultVariants: {
|
|
18
18
|
size: "md"
|
|
19
19
|
}
|
|
20
|
-
}),
|
|
21
|
-
({ text: e, size: a = d.Medium, className:
|
|
20
|
+
}), c = r(
|
|
21
|
+
({ text: e, size: a = d.Medium, className: m, children: s, ...t }, l) => /* @__PURE__ */ i("label", { className: g({ size: a, className: m }), ref: l, ...t, children: s ?? e })
|
|
22
22
|
);
|
|
23
|
-
|
|
23
|
+
c.displayName = "Label";
|
|
24
24
|
export {
|
|
25
|
-
|
|
26
|
-
d as LabelSize
|
|
25
|
+
c as Label,
|
|
26
|
+
d as LabelSize,
|
|
27
|
+
g as styles
|
|
27
28
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LogoBlack, LogoGoldGreen, LogoGoldWhite, LogoHarpBlack, LogoWhite, LogoHarpWhite, } from '../atoms/icons/logos';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as a } from "../atoms/icons/logos/LogoBlack.js";
|
|
2
|
+
import { default as t } from "../atoms/icons/logos/LogoGoldGreen.js";
|
|
3
|
+
import { default as l } from "../atoms/icons/logos/LogoGoldWhite.js";
|
|
4
|
+
import { default as p } from "../atoms/icons/logos/LogoHarpBlack.js";
|
|
5
|
+
import { default as m } from "../atoms/icons/logos/LogoHarpWhite.js";
|
|
6
|
+
import { default as u } from "../atoms/icons/logos/LogoWhite.js";
|
|
7
|
+
export {
|
|
8
|
+
a as LogoBlack,
|
|
9
|
+
t as LogoGoldGreen,
|
|
10
|
+
l as LogoGoldWhite,
|
|
11
|
+
p as LogoHarpBlack,
|
|
12
|
+
m as LogoHarpWhite,
|
|
13
|
+
u as LogoWhite
|
|
14
|
+
};
|
package/dist/modal/modal.js
CHANGED
|
@@ -1,129 +1,130 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { isValidElement as
|
|
4
|
-
import { createPortal as
|
|
2
|
+
import { jsx as l, jsxs as y, Fragment as j } from "react/jsx-runtime";
|
|
3
|
+
import { isValidElement as K, cloneElement as T, useState as A, useRef as U, useMemo as W, Children as _, useId as z, useEffect as C } from "react";
|
|
4
|
+
import { createPortal as G } from "react-dom";
|
|
5
5
|
import { Button as E } from "../button/button.js";
|
|
6
6
|
import { cn as u } from "../cn.js";
|
|
7
|
-
import { Heading as
|
|
8
|
-
import { useAriaHider as
|
|
9
|
-
import { useFocusTrap as
|
|
10
|
-
import { Icon as
|
|
11
|
-
import { IconButton as
|
|
12
|
-
import { splitAriaProps as
|
|
7
|
+
import { Heading as J } from "../heading/heading.js";
|
|
8
|
+
import { useAriaHider as Q } from "../hooks/use-aria-hider.js";
|
|
9
|
+
import { useFocusTrap as X } from "../hooks/use-focus-trap.js";
|
|
10
|
+
import { Icon as Y } from "../icon/icon.js";
|
|
11
|
+
import { IconButton as Z } from "../icon-button/icon-button.js";
|
|
12
|
+
import { splitAriaProps as O, isSpecialComponent as ee, getSpecialComponentType as te } from "../utils/utilities.js";
|
|
13
13
|
const I = {
|
|
14
14
|
flat: 0,
|
|
15
15
|
secondary: 1,
|
|
16
16
|
primary: 2
|
|
17
|
-
},
|
|
17
|
+
}, oe = ({
|
|
18
18
|
label: e,
|
|
19
|
-
size:
|
|
20
|
-
...
|
|
19
|
+
size: o = "small",
|
|
20
|
+
...t
|
|
21
21
|
}) => {
|
|
22
22
|
let n = "sm";
|
|
23
|
-
return (
|
|
23
|
+
return (o === "large" || o === "medium") && (n = "md"), e ? /* @__PURE__ */ l(
|
|
24
24
|
E,
|
|
25
25
|
{
|
|
26
|
-
onClick:
|
|
26
|
+
onClick: t.onClick,
|
|
27
27
|
variant: "flat",
|
|
28
|
-
size:
|
|
28
|
+
size: o,
|
|
29
29
|
appearance: "dark",
|
|
30
30
|
className: "gi-modal-icon",
|
|
31
31
|
"aria-label": e,
|
|
32
|
-
...
|
|
32
|
+
...t,
|
|
33
33
|
children: /* @__PURE__ */ y(j, { children: [
|
|
34
34
|
e,
|
|
35
|
-
/* @__PURE__ */
|
|
35
|
+
/* @__PURE__ */ l(Y, { icon: "close", size: n })
|
|
36
36
|
] })
|
|
37
37
|
}
|
|
38
|
-
) : /* @__PURE__ */
|
|
39
|
-
|
|
38
|
+
) : /* @__PURE__ */ l(
|
|
39
|
+
Z,
|
|
40
40
|
{
|
|
41
41
|
className: "gi-modal-icon",
|
|
42
42
|
icon: { icon: "close" },
|
|
43
43
|
"aria-label": "Close modal",
|
|
44
|
-
onClick:
|
|
44
|
+
onClick: t.onClick,
|
|
45
45
|
variant: "flat",
|
|
46
|
-
size:
|
|
46
|
+
size: o,
|
|
47
47
|
appearance: "dark",
|
|
48
|
-
|
|
48
|
+
dataTestid: "modal-close-button",
|
|
49
|
+
...t
|
|
49
50
|
}
|
|
50
51
|
);
|
|
51
|
-
},
|
|
52
|
+
}, ae = ({
|
|
52
53
|
closeButtonLabel: e,
|
|
53
|
-
modalTitle:
|
|
54
|
-
closeOnClick:
|
|
54
|
+
modalTitle: o,
|
|
55
|
+
closeOnClick: t,
|
|
55
56
|
onClose: n,
|
|
56
|
-
closeButtonSize:
|
|
57
|
+
closeButtonSize: a
|
|
57
58
|
}) => /* @__PURE__ */ y("div", { className: "gi-py-2 xs:gi-py-4", children: [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
o,
|
|
60
|
+
t && /* @__PURE__ */ l(
|
|
61
|
+
oe,
|
|
61
62
|
{
|
|
62
63
|
onClick: n,
|
|
63
64
|
label: e,
|
|
64
|
-
size:
|
|
65
|
+
size: a
|
|
65
66
|
}
|
|
66
67
|
)
|
|
67
|
-
] }),
|
|
68
|
+
] }), re = ({
|
|
68
69
|
position: e = "center",
|
|
69
|
-
size:
|
|
70
|
-
closeOnClick:
|
|
70
|
+
size: o = "lg",
|
|
71
|
+
closeOnClick: t = !0,
|
|
71
72
|
closeOnOverlayClick: n = !0,
|
|
72
|
-
isOpen:
|
|
73
|
-
onClose:
|
|
73
|
+
isOpen: a,
|
|
74
|
+
onClose: d,
|
|
74
75
|
closeButtonLabel: h,
|
|
75
|
-
className:
|
|
76
|
-
children:
|
|
77
|
-
closeButtonSize:
|
|
78
|
-
closeOnEscape:
|
|
76
|
+
className: s,
|
|
77
|
+
children: f,
|
|
78
|
+
closeButtonSize: r,
|
|
79
|
+
closeOnEscape: i,
|
|
79
80
|
dataTestId: c,
|
|
80
81
|
...v
|
|
81
82
|
}) => {
|
|
82
|
-
var
|
|
83
|
-
const M =
|
|
84
|
-
|
|
85
|
-
const [D,
|
|
86
|
-
() =>
|
|
83
|
+
var w;
|
|
84
|
+
const M = U(null);
|
|
85
|
+
Q(M, a);
|
|
86
|
+
const [D, R] = W(
|
|
87
|
+
() => O(v),
|
|
87
88
|
[v]
|
|
88
|
-
), F =
|
|
89
|
-
(p) =>
|
|
90
|
-
),
|
|
91
|
-
as:
|
|
92
|
-
id:
|
|
93
|
-
}) : null,
|
|
94
|
-
dataModalSize:
|
|
95
|
-
}) : null,
|
|
96
|
-
(m) => !
|
|
89
|
+
), F = _.toArray(f), N = (m) => F.find(
|
|
90
|
+
(p) => te(p) === m
|
|
91
|
+
), g = N("ModalTitle"), b = N("ModalFooter") || N("DrawerFooter"), S = z(), L = ((w = g == null ? void 0 : g.props) == null ? void 0 : w.id) || `gi-modal-title-${S}`, H = g ? T(g, {
|
|
92
|
+
as: o === "sm" ? "h5" : "h4",
|
|
93
|
+
id: L
|
|
94
|
+
}) : null, $ = b ? T(b, {
|
|
95
|
+
dataModalSize: o
|
|
96
|
+
}) : null, V = F.filter(
|
|
97
|
+
(m) => !ee(m, ["ModalTitle", "ModalFooter", "DrawerFooter"])
|
|
97
98
|
);
|
|
98
99
|
C(() => {
|
|
99
|
-
if (!
|
|
100
|
+
if (!a || !i)
|
|
100
101
|
return;
|
|
101
102
|
const m = (p) => {
|
|
102
|
-
p.key === "Escape" && (p.stopPropagation(),
|
|
103
|
+
p.key === "Escape" && (p.stopPropagation(), d());
|
|
103
104
|
};
|
|
104
105
|
return document.addEventListener("keydown", m), () => {
|
|
105
106
|
document.removeEventListener("keydown", m);
|
|
106
107
|
};
|
|
107
|
-
}, [
|
|
108
|
-
if (!
|
|
108
|
+
}, [a, i, d]), C(() => {
|
|
109
|
+
if (!a || !t || !n)
|
|
109
110
|
return;
|
|
110
111
|
const m = (p) => {
|
|
111
112
|
var B;
|
|
112
|
-
const
|
|
113
|
+
const k = (B = M.current) == null ? void 0 : B.querySelector(
|
|
113
114
|
".gi-modal-container-control"
|
|
114
115
|
);
|
|
115
|
-
|
|
116
|
+
k && (k.contains(p.target) || d());
|
|
116
117
|
};
|
|
117
118
|
return document.addEventListener("pointerdown", m, !0), () => document.removeEventListener("pointerdown", m, !0);
|
|
118
|
-
}, [
|
|
119
|
-
const
|
|
119
|
+
}, [a, t, n, d]);
|
|
120
|
+
const q = /* @__PURE__ */ l(
|
|
120
121
|
"div",
|
|
121
122
|
{
|
|
122
|
-
...
|
|
123
|
+
...R,
|
|
123
124
|
ref: M,
|
|
124
125
|
className: u("gi-modal", {
|
|
125
|
-
"gi-modal-open":
|
|
126
|
-
"gi-modal-close": !
|
|
126
|
+
"gi-modal-open": a,
|
|
127
|
+
"gi-modal-close": !a
|
|
127
128
|
}),
|
|
128
129
|
"data-testid": c || "modal",
|
|
129
130
|
tabIndex: -1,
|
|
@@ -135,98 +136,98 @@ const I = {
|
|
|
135
136
|
"aria-modal": "true",
|
|
136
137
|
"aria-label": "dialog",
|
|
137
138
|
...D,
|
|
138
|
-
"data-size":
|
|
139
|
+
"data-size": o,
|
|
139
140
|
"data-position": e,
|
|
140
141
|
className: u(
|
|
141
142
|
"gi-modal-container-control",
|
|
142
143
|
{
|
|
143
|
-
"gi-modal-container": !
|
|
144
|
+
"gi-modal-container": !s,
|
|
144
145
|
"gi-modal-container-center": e === "center",
|
|
145
146
|
"gi-modal-container-left": e === "left",
|
|
146
147
|
"gi-modal-container-right": e === "right",
|
|
147
148
|
"gi-modal-container-bottom": e === "bottom"
|
|
148
149
|
},
|
|
149
|
-
|
|
150
|
+
s
|
|
150
151
|
),
|
|
151
152
|
children: [
|
|
152
|
-
/* @__PURE__ */
|
|
153
|
-
|
|
153
|
+
/* @__PURE__ */ l(
|
|
154
|
+
ae,
|
|
154
155
|
{
|
|
155
156
|
closeButtonLabel: h,
|
|
156
|
-
modalTitle:
|
|
157
|
-
closeOnClick:
|
|
158
|
-
onClose:
|
|
159
|
-
closeButtonSize:
|
|
157
|
+
modalTitle: H,
|
|
158
|
+
closeOnClick: t,
|
|
159
|
+
onClose: d,
|
|
160
|
+
closeButtonSize: r
|
|
160
161
|
}
|
|
161
162
|
),
|
|
162
163
|
/* @__PURE__ */ y("div", { className: u({ "gi-pb-6": !b }), children: [
|
|
163
|
-
|
|
164
|
-
|
|
164
|
+
V,
|
|
165
|
+
$
|
|
165
166
|
] })
|
|
166
167
|
]
|
|
167
168
|
}
|
|
168
169
|
)
|
|
169
170
|
}
|
|
170
171
|
);
|
|
171
|
-
return /* @__PURE__ */
|
|
172
|
-
}, P = ({ children: e, as:
|
|
172
|
+
return /* @__PURE__ */ l(ne, { modalRef: M, isOpen: a, children: q });
|
|
173
|
+
}, P = ({ children: e, as: o = "h4", ...t }) => /* @__PURE__ */ l("div", { className: "gi-flex-1", id: t.id, "aria-label": e == null ? void 0 : e.toString(), children: /* @__PURE__ */ l(J, { as: o, ...t, children: e }) });
|
|
173
174
|
Object.defineProperty(P, "componentType", {
|
|
174
175
|
value: "ModalTitle",
|
|
175
176
|
writable: !1,
|
|
176
177
|
enumerable: !1
|
|
177
178
|
});
|
|
178
179
|
P.displayName = "ModalTitle";
|
|
179
|
-
const
|
|
180
|
+
const he = ({
|
|
180
181
|
children: e,
|
|
181
|
-
className:
|
|
182
|
-
includeModalClass:
|
|
183
|
-
}) => /* @__PURE__ */
|
|
182
|
+
className: o,
|
|
183
|
+
includeModalClass: t = !0
|
|
184
|
+
}) => /* @__PURE__ */ l(
|
|
184
185
|
"div",
|
|
185
186
|
{
|
|
186
187
|
"aria-label": "Modal content",
|
|
187
188
|
role: "document",
|
|
188
189
|
tabIndex: 0,
|
|
189
|
-
className: u(
|
|
190
|
+
className: u(t && "gi-modal-body", o),
|
|
190
191
|
children: e
|
|
191
192
|
}
|
|
192
193
|
), x = ({
|
|
193
194
|
className: e,
|
|
194
|
-
children:
|
|
195
|
-
orientation:
|
|
195
|
+
children: o,
|
|
196
|
+
orientation: t,
|
|
196
197
|
dataModalSize: n,
|
|
197
|
-
stacked:
|
|
198
|
+
stacked: a
|
|
198
199
|
}) => {
|
|
199
|
-
const
|
|
200
|
-
var
|
|
201
|
-
return
|
|
202
|
-
}).sort((
|
|
203
|
-
const c =
|
|
200
|
+
const s = (Array.isArray(o) ? o : [o]).filter((r) => {
|
|
201
|
+
var i, c;
|
|
202
|
+
return K(r) && (r.type === E || ((i = r.type) == null ? void 0 : i.displayName) === "Button" || ((c = r.props) == null ? void 0 : c["data-button"]));
|
|
203
|
+
}).sort((r, i) => {
|
|
204
|
+
const c = r.props.variant ?? "primary", v = i.props.variant ?? "primary";
|
|
204
205
|
return (I[c] || 0) - (I[v] || 0);
|
|
205
|
-
}),
|
|
206
|
-
"gi-justify-center sm:gi-justify-start": !
|
|
207
|
-
"gi-justify-center":
|
|
208
|
-
"gi-justify-start":
|
|
206
|
+
}), f = u({
|
|
207
|
+
"gi-justify-center sm:gi-justify-start": !t && n !== "sm" && !a,
|
|
208
|
+
"gi-justify-center": t === "vertical" || n === "sm" || a,
|
|
209
|
+
"gi-justify-start": t === "horizontal"
|
|
209
210
|
});
|
|
210
|
-
return /* @__PURE__ */
|
|
211
|
+
return /* @__PURE__ */ l(
|
|
211
212
|
"div",
|
|
212
213
|
{
|
|
213
214
|
className: u(e, {
|
|
214
|
-
"gi-pt-6":
|
|
215
|
-
"gi-modal-footer":
|
|
216
|
-
"gi-modal-footer-stacked":
|
|
215
|
+
"gi-pt-6": s.length === 0,
|
|
216
|
+
"gi-modal-footer": s.length,
|
|
217
|
+
"gi-modal-footer-stacked": a
|
|
217
218
|
}),
|
|
218
|
-
children:
|
|
219
|
+
children: s.length > 0 && /* @__PURE__ */ l(
|
|
219
220
|
"div",
|
|
220
221
|
{
|
|
221
|
-
"data-orientation":
|
|
222
|
+
"data-orientation": t || "unset",
|
|
222
223
|
"data-modal-size": n,
|
|
223
|
-
children:
|
|
224
|
-
(
|
|
224
|
+
children: s.map(
|
|
225
|
+
(r, i) => {
|
|
225
226
|
var c;
|
|
226
|
-
return
|
|
227
|
-
key:
|
|
228
|
-
id:
|
|
229
|
-
className: u((c =
|
|
227
|
+
return T(r, {
|
|
228
|
+
key: r.key || r.props.id || r.props.dataTestid || `modal-footer-button-${i}`,
|
|
229
|
+
id: r.props.id || `modal-footer-button-${i}`,
|
|
230
|
+
className: u((c = r == null ? void 0 : r.props) == null ? void 0 : c.className, f)
|
|
230
231
|
});
|
|
231
232
|
}
|
|
232
233
|
) || null
|
|
@@ -241,37 +242,34 @@ Object.defineProperty(x, "componentType", {
|
|
|
241
242
|
enumerable: !1
|
|
242
243
|
});
|
|
243
244
|
x.displayName = "ModalFooter";
|
|
244
|
-
const
|
|
245
|
+
const ne = ({
|
|
245
246
|
children: e,
|
|
246
|
-
modalRef:
|
|
247
|
-
isOpen:
|
|
247
|
+
modalRef: o,
|
|
248
|
+
isOpen: t
|
|
248
249
|
}) => {
|
|
249
|
-
const [n,
|
|
250
|
+
const [n, a] = A(!1);
|
|
250
251
|
return C(() => {
|
|
251
|
-
|
|
252
|
-
}, []),
|
|
253
|
-
|
|
254
|
-
fallbackFocus: () => t == null ? void 0 : t.current
|
|
255
|
-
}), n ? J(e, document.body) : null;
|
|
256
|
-
}, vt = ({
|
|
252
|
+
a(!0);
|
|
253
|
+
}, []), X(o, t && n), n ? G(e, document.body) : null;
|
|
254
|
+
}, ve = ({
|
|
257
255
|
children: e,
|
|
258
|
-
triggerButton:
|
|
259
|
-
startsOpen:
|
|
256
|
+
triggerButton: o,
|
|
257
|
+
startsOpen: t,
|
|
260
258
|
...n
|
|
261
259
|
}) => {
|
|
262
|
-
const [
|
|
260
|
+
const [a, d] = A(!!t), h = () => d(!0), s = () => d(!1), f = T(o, {
|
|
263
261
|
"data-testid": "modal-trigger-button-container",
|
|
264
262
|
"aria-haspopup": "dialog",
|
|
265
263
|
onClick: h
|
|
266
264
|
});
|
|
267
265
|
return /* @__PURE__ */ y(j, { children: [
|
|
268
|
-
|
|
269
|
-
/* @__PURE__ */
|
|
270
|
-
|
|
266
|
+
f,
|
|
267
|
+
/* @__PURE__ */ l(
|
|
268
|
+
re,
|
|
271
269
|
{
|
|
272
|
-
onClose:
|
|
270
|
+
onClose: s,
|
|
273
271
|
position: "center",
|
|
274
|
-
isOpen:
|
|
272
|
+
isOpen: a,
|
|
275
273
|
...n,
|
|
276
274
|
children: e
|
|
277
275
|
}
|
|
@@ -279,9 +277,9 @@ const nt = ({
|
|
|
279
277
|
] });
|
|
280
278
|
};
|
|
281
279
|
export {
|
|
282
|
-
|
|
283
|
-
|
|
280
|
+
ve as Modal,
|
|
281
|
+
he as ModalBody,
|
|
284
282
|
x as ModalFooter,
|
|
285
283
|
P as ModalTitle,
|
|
286
|
-
|
|
284
|
+
re as ModalWrapper
|
|
287
285
|
};
|