@ogcio/design-system-react 1.30.0 → 1.31.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/atoms/DsButton.js +3 -2
- package/dist/atoms/InsetText.d.ts +14 -0
- package/dist/atoms/InsetText.js +17 -0
- package/dist/atoms/icons/Close.js +9 -8
- package/dist/atoms/icons/KeyboardArrowDown.js +6 -5
- package/dist/atoms/icons/KeyboardArrowUp.js +6 -5
- package/dist/atoms/icons/Visibility.js +15 -14
- package/dist/atoms/icons/VisibilityOff.js +9 -8
- 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 +5 -5
- package/dist/atoms/index.d.ts +1 -0
- package/dist/atoms/index.js +12 -10
- 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/cookie-banner/cookie-banner.js +28 -20
- package/dist/details/details.js +43 -23
- package/dist/drawer/drawer.js +35 -32
- package/dist/footer/footer.js +54 -46
- package/dist/header/header-legacy.js +8 -8
- package/dist/hooks/use-aria-hider.d.ts +1 -1
- package/dist/hooks/use-aria-hider.js +14 -13
- package/dist/hooks/use-focus-trap.d.ts +1 -1
- package/dist/hooks/use-focus-trap.js +179 -179
- 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/logos/index.d.ts +1 -0
- package/dist/logos/index.js +14 -0
- package/dist/modal/modal.js +125 -128
- 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/styles.css +1 -1
- package/dist/table/table-row.js +14 -7
- package/dist/tabs/tab-panel.js +6 -6
- package/dist/tabs/tabs.js +19 -19
- package/package.json +10 -10
- 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
package/dist/modal/modal.js
CHANGED
|
@@ -1,130 +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
|
-
...
|
|
49
|
+
...t
|
|
50
50
|
}
|
|
51
51
|
);
|
|
52
|
-
},
|
|
52
|
+
}, ae = ({
|
|
53
53
|
closeButtonLabel: e,
|
|
54
|
-
modalTitle:
|
|
55
|
-
closeOnClick:
|
|
54
|
+
modalTitle: o,
|
|
55
|
+
closeOnClick: t,
|
|
56
56
|
onClose: n,
|
|
57
|
-
closeButtonSize:
|
|
57
|
+
closeButtonSize: a
|
|
58
58
|
}) => /* @__PURE__ */ y("div", { className: "gi-py-2 xs:gi-py-4", children: [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
o,
|
|
60
|
+
t && /* @__PURE__ */ l(
|
|
61
|
+
oe,
|
|
62
62
|
{
|
|
63
63
|
onClick: n,
|
|
64
64
|
label: e,
|
|
65
|
-
size:
|
|
65
|
+
size: a
|
|
66
66
|
}
|
|
67
67
|
)
|
|
68
|
-
] }),
|
|
68
|
+
] }), re = ({
|
|
69
69
|
position: e = "center",
|
|
70
|
-
size:
|
|
71
|
-
closeOnClick:
|
|
70
|
+
size: o = "lg",
|
|
71
|
+
closeOnClick: t = !0,
|
|
72
72
|
closeOnOverlayClick: n = !0,
|
|
73
|
-
isOpen:
|
|
74
|
-
onClose:
|
|
73
|
+
isOpen: a,
|
|
74
|
+
onClose: d,
|
|
75
75
|
closeButtonLabel: h,
|
|
76
|
-
className:
|
|
77
|
-
children:
|
|
78
|
-
closeButtonSize:
|
|
79
|
-
closeOnEscape:
|
|
76
|
+
className: s,
|
|
77
|
+
children: f,
|
|
78
|
+
closeButtonSize: r,
|
|
79
|
+
closeOnEscape: i,
|
|
80
80
|
dataTestId: c,
|
|
81
81
|
...v
|
|
82
82
|
}) => {
|
|
83
|
-
var
|
|
84
|
-
const M =
|
|
85
|
-
|
|
86
|
-
const [D,
|
|
87
|
-
() =>
|
|
83
|
+
var w;
|
|
84
|
+
const M = U(null);
|
|
85
|
+
Q(M, a);
|
|
86
|
+
const [D, R] = W(
|
|
87
|
+
() => O(v),
|
|
88
88
|
[v]
|
|
89
|
-
), F =
|
|
90
|
-
(p) =>
|
|
91
|
-
),
|
|
92
|
-
as:
|
|
93
|
-
id:
|
|
94
|
-
}) : null,
|
|
95
|
-
dataModalSize:
|
|
96
|
-
}) : null,
|
|
97
|
-
(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"])
|
|
98
98
|
);
|
|
99
99
|
C(() => {
|
|
100
|
-
if (!
|
|
100
|
+
if (!a || !i)
|
|
101
101
|
return;
|
|
102
102
|
const m = (p) => {
|
|
103
|
-
p.key === "Escape" && (p.stopPropagation(),
|
|
103
|
+
p.key === "Escape" && (p.stopPropagation(), d());
|
|
104
104
|
};
|
|
105
105
|
return document.addEventListener("keydown", m), () => {
|
|
106
106
|
document.removeEventListener("keydown", m);
|
|
107
107
|
};
|
|
108
|
-
}, [
|
|
109
|
-
if (!
|
|
108
|
+
}, [a, i, d]), C(() => {
|
|
109
|
+
if (!a || !t || !n)
|
|
110
110
|
return;
|
|
111
111
|
const m = (p) => {
|
|
112
112
|
var B;
|
|
113
|
-
const
|
|
113
|
+
const k = (B = M.current) == null ? void 0 : B.querySelector(
|
|
114
114
|
".gi-modal-container-control"
|
|
115
115
|
);
|
|
116
|
-
|
|
116
|
+
k && (k.contains(p.target) || d());
|
|
117
117
|
};
|
|
118
118
|
return document.addEventListener("pointerdown", m, !0), () => document.removeEventListener("pointerdown", m, !0);
|
|
119
|
-
}, [
|
|
120
|
-
const
|
|
119
|
+
}, [a, t, n, d]);
|
|
120
|
+
const q = /* @__PURE__ */ l(
|
|
121
121
|
"div",
|
|
122
122
|
{
|
|
123
|
-
...
|
|
123
|
+
...R,
|
|
124
124
|
ref: M,
|
|
125
125
|
className: u("gi-modal", {
|
|
126
|
-
"gi-modal-open":
|
|
127
|
-
"gi-modal-close": !
|
|
126
|
+
"gi-modal-open": a,
|
|
127
|
+
"gi-modal-close": !a
|
|
128
128
|
}),
|
|
129
129
|
"data-testid": c || "modal",
|
|
130
130
|
tabIndex: -1,
|
|
@@ -136,98 +136,98 @@ const I = {
|
|
|
136
136
|
"aria-modal": "true",
|
|
137
137
|
"aria-label": "dialog",
|
|
138
138
|
...D,
|
|
139
|
-
"data-size":
|
|
139
|
+
"data-size": o,
|
|
140
140
|
"data-position": e,
|
|
141
141
|
className: u(
|
|
142
142
|
"gi-modal-container-control",
|
|
143
143
|
{
|
|
144
|
-
"gi-modal-container": !
|
|
144
|
+
"gi-modal-container": !s,
|
|
145
145
|
"gi-modal-container-center": e === "center",
|
|
146
146
|
"gi-modal-container-left": e === "left",
|
|
147
147
|
"gi-modal-container-right": e === "right",
|
|
148
148
|
"gi-modal-container-bottom": e === "bottom"
|
|
149
149
|
},
|
|
150
|
-
|
|
150
|
+
s
|
|
151
151
|
),
|
|
152
152
|
children: [
|
|
153
|
-
/* @__PURE__ */
|
|
154
|
-
|
|
153
|
+
/* @__PURE__ */ l(
|
|
154
|
+
ae,
|
|
155
155
|
{
|
|
156
156
|
closeButtonLabel: h,
|
|
157
|
-
modalTitle:
|
|
158
|
-
closeOnClick:
|
|
159
|
-
onClose:
|
|
160
|
-
closeButtonSize:
|
|
157
|
+
modalTitle: H,
|
|
158
|
+
closeOnClick: t,
|
|
159
|
+
onClose: d,
|
|
160
|
+
closeButtonSize: r
|
|
161
161
|
}
|
|
162
162
|
),
|
|
163
|
-
/* @__PURE__ */ y("div", { className: u({ "gi-pb-6": !
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
/* @__PURE__ */ y("div", { className: u({ "gi-pb-6": !b }), children: [
|
|
164
|
+
V,
|
|
165
|
+
$
|
|
166
166
|
] })
|
|
167
167
|
]
|
|
168
168
|
}
|
|
169
169
|
)
|
|
170
170
|
}
|
|
171
171
|
);
|
|
172
|
-
return /* @__PURE__ */
|
|
173
|
-
}, 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 }) });
|
|
174
174
|
Object.defineProperty(P, "componentType", {
|
|
175
175
|
value: "ModalTitle",
|
|
176
176
|
writable: !1,
|
|
177
177
|
enumerable: !1
|
|
178
178
|
});
|
|
179
179
|
P.displayName = "ModalTitle";
|
|
180
|
-
const
|
|
180
|
+
const he = ({
|
|
181
181
|
children: e,
|
|
182
|
-
className:
|
|
183
|
-
includeModalClass:
|
|
184
|
-
}) => /* @__PURE__ */
|
|
182
|
+
className: o,
|
|
183
|
+
includeModalClass: t = !0
|
|
184
|
+
}) => /* @__PURE__ */ l(
|
|
185
185
|
"div",
|
|
186
186
|
{
|
|
187
187
|
"aria-label": "Modal content",
|
|
188
188
|
role: "document",
|
|
189
189
|
tabIndex: 0,
|
|
190
|
-
className: u(
|
|
190
|
+
className: u(t && "gi-modal-body", o),
|
|
191
191
|
children: e
|
|
192
192
|
}
|
|
193
193
|
), x = ({
|
|
194
194
|
className: e,
|
|
195
|
-
children:
|
|
196
|
-
orientation:
|
|
195
|
+
children: o,
|
|
196
|
+
orientation: t,
|
|
197
197
|
dataModalSize: n,
|
|
198
|
-
stacked:
|
|
198
|
+
stacked: a
|
|
199
199
|
}) => {
|
|
200
|
-
const
|
|
201
|
-
var
|
|
202
|
-
return
|
|
203
|
-
}).sort((
|
|
204
|
-
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";
|
|
205
205
|
return (I[c] || 0) - (I[v] || 0);
|
|
206
|
-
}),
|
|
207
|
-
"gi-justify-center sm:gi-justify-start": !
|
|
208
|
-
"gi-justify-center":
|
|
209
|
-
"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"
|
|
210
210
|
});
|
|
211
|
-
return /* @__PURE__ */
|
|
211
|
+
return /* @__PURE__ */ l(
|
|
212
212
|
"div",
|
|
213
213
|
{
|
|
214
214
|
className: u(e, {
|
|
215
|
-
"gi-pt-6":
|
|
216
|
-
"gi-modal-footer":
|
|
217
|
-
"gi-modal-footer-stacked":
|
|
215
|
+
"gi-pt-6": s.length === 0,
|
|
216
|
+
"gi-modal-footer": s.length,
|
|
217
|
+
"gi-modal-footer-stacked": a
|
|
218
218
|
}),
|
|
219
|
-
children:
|
|
219
|
+
children: s.length > 0 && /* @__PURE__ */ l(
|
|
220
220
|
"div",
|
|
221
221
|
{
|
|
222
|
-
"data-orientation":
|
|
222
|
+
"data-orientation": t || "unset",
|
|
223
223
|
"data-modal-size": n,
|
|
224
|
-
children:
|
|
225
|
-
(
|
|
224
|
+
children: s.map(
|
|
225
|
+
(r, i) => {
|
|
226
226
|
var c;
|
|
227
|
-
return T(
|
|
228
|
-
key:
|
|
229
|
-
id:
|
|
230
|
-
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)
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
233
|
) || null
|
|
@@ -242,37 +242,34 @@ Object.defineProperty(x, "componentType", {
|
|
|
242
242
|
enumerable: !1
|
|
243
243
|
});
|
|
244
244
|
x.displayName = "ModalFooter";
|
|
245
|
-
const
|
|
245
|
+
const ne = ({
|
|
246
246
|
children: e,
|
|
247
|
-
modalRef:
|
|
248
|
-
isOpen:
|
|
247
|
+
modalRef: o,
|
|
248
|
+
isOpen: t
|
|
249
249
|
}) => {
|
|
250
|
-
const [n,
|
|
250
|
+
const [n, a] = A(!1);
|
|
251
251
|
return C(() => {
|
|
252
|
-
|
|
253
|
-
}, []),
|
|
254
|
-
|
|
255
|
-
fallbackFocus: () => t == null ? void 0 : t.current
|
|
256
|
-
}), n ? J(e, document.body) : null;
|
|
257
|
-
}, vt = ({
|
|
252
|
+
a(!0);
|
|
253
|
+
}, []), X(o, t && n), n ? G(e, document.body) : null;
|
|
254
|
+
}, ve = ({
|
|
258
255
|
children: e,
|
|
259
|
-
triggerButton:
|
|
260
|
-
startsOpen:
|
|
256
|
+
triggerButton: o,
|
|
257
|
+
startsOpen: t,
|
|
261
258
|
...n
|
|
262
259
|
}) => {
|
|
263
|
-
const [
|
|
260
|
+
const [a, d] = A(!!t), h = () => d(!0), s = () => d(!1), f = T(o, {
|
|
264
261
|
"data-testid": "modal-trigger-button-container",
|
|
265
262
|
"aria-haspopup": "dialog",
|
|
266
263
|
onClick: h
|
|
267
264
|
});
|
|
268
265
|
return /* @__PURE__ */ y(j, { children: [
|
|
269
|
-
|
|
270
|
-
/* @__PURE__ */
|
|
271
|
-
|
|
266
|
+
f,
|
|
267
|
+
/* @__PURE__ */ l(
|
|
268
|
+
re,
|
|
272
269
|
{
|
|
273
|
-
onClose:
|
|
270
|
+
onClose: s,
|
|
274
271
|
position: "center",
|
|
275
|
-
isOpen:
|
|
272
|
+
isOpen: a,
|
|
276
273
|
...n,
|
|
277
274
|
children: e
|
|
278
275
|
}
|
|
@@ -280,9 +277,9 @@ const nt = ({
|
|
|
280
277
|
] });
|
|
281
278
|
};
|
|
282
279
|
export {
|
|
283
|
-
|
|
284
|
-
|
|
280
|
+
ve as Modal,
|
|
281
|
+
he as ModalBody,
|
|
285
282
|
x as ModalFooter,
|
|
286
283
|
P as ModalTitle,
|
|
287
|
-
|
|
284
|
+
re as ModalWrapper
|
|
288
285
|
};
|