@ogcio/design-system-react 1.13.0 → 1.15.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/autocomplete/autocomplete.d.ts +21 -3
- package/dist/autocomplete/autocomplete.js +208 -159
- package/dist/autocomplete/types.d.ts +8 -4
- package/dist/autocomplete/types.js +2 -1
- package/dist/autocomplete/use-autocomplete-controller.d.ts +4 -2
- package/dist/autocomplete/use-autocomplete-controller.js +123 -79
- package/dist/button/button.js +27 -22
- package/dist/data-grid/data-grid-footer.d.ts +12 -0
- package/dist/data-grid/data-grid-footer.js +66 -0
- package/dist/data-grid/data-grid-header.d.ts +12 -0
- package/dist/data-grid/data-grid-header.js +82 -0
- package/dist/header/components/header-slot.js +34 -31
- package/dist/header/helper.d.ts +0 -1
- package/dist/header/helper.js +37 -62
- package/dist/hooks/use-combined-refs.d.ts +5 -0
- package/dist/hooks/use-combined-refs.js +10 -0
- package/dist/hooks/use-scroll-highlighted-item.d.ts +1 -0
- package/dist/hooks/use-scroll-highlighted-item.js +16 -0
- package/dist/icon/icon.js +15 -15
- package/dist/icon-button/icon-button.js +14 -12
- package/dist/index.d.ts +5 -2
- package/dist/index.js +68 -63
- package/dist/list/list.js +1 -1
- package/dist/modal/modal.d.ts +8 -2
- package/dist/modal/modal.js +155 -134
- package/dist/popover/popover.d.ts +1 -1
- package/dist/popover/popover.js +296 -286
- package/dist/popover/types.d.ts +1 -0
- package/dist/popover/utilities.d.ts +2 -0
- package/dist/popover/utilities.js +16 -0
- package/dist/primitives/button.d.ts +3 -0
- package/dist/primitives/button.js +9 -0
- package/dist/select/select-menu.d.ts +2 -2
- package/dist/select/select-menu.js +96 -99
- package/dist/select/select-next.d.ts +13 -2
- package/dist/select/select-next.js +182 -167
- package/dist/select/select-search.js +17 -17
- package/dist/select/types.d.ts +3 -1
- package/dist/styles.css +1 -1
- package/dist/table/table-data.js +1 -1
- package/dist/tabs/scrollable-tab-list.d.ts +9 -0
- package/dist/tabs/scrollable-tab-list.js +84 -0
- package/dist/tabs/tab-item.d.ts +9 -15
- package/dist/tabs/tab-item.js +85 -38
- package/dist/tabs/tab-list.d.ts +2 -5
- package/dist/tabs/tab-list.js +83 -49
- package/dist/tabs/tab-panel.d.ts +2 -7
- package/dist/tabs/tab-panel.js +2 -5
- package/dist/tabs/tabs.d.ts +2 -7
- package/dist/tabs/tabs.js +24 -20
- package/dist/tabs/types.d.ts +64 -0
- package/dist/tabs/types.js +1 -0
- package/dist/textarea/textarea.d.ts +1 -2
- package/dist/textarea/textarea.js +60 -61
- package/package.json +4 -4
package/dist/modal/modal.js
CHANGED
|
@@ -1,193 +1,202 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import {
|
|
2
|
+
import { jsx as n, jsxs as f, Fragment as F } from "react/jsx-runtime";
|
|
3
|
+
import { isValidElement as j, cloneElement as y, useState as A, useRef as P, Children as w, useEffect as x } from "react";
|
|
4
4
|
import { createPortal as H } from "react-dom";
|
|
5
|
-
import { Button as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Heading as
|
|
8
|
-
import { useAriaHider as
|
|
9
|
-
import { useFocusTrap as
|
|
10
|
-
import { Icon as
|
|
11
|
-
import { IconButton as
|
|
12
|
-
const
|
|
5
|
+
import { Button as B } from "../button/button.js";
|
|
6
|
+
import { cn as m } from "../cn.js";
|
|
7
|
+
import { Heading as S } from "../heading/heading.js";
|
|
8
|
+
import { useAriaHider as V } from "../hooks/use-aria-hider.js";
|
|
9
|
+
import { useFocusTrap as _ } from "../hooks/use-focus-trap.js";
|
|
10
|
+
import { Icon as $ } from "../icon/icon.js";
|
|
11
|
+
import { IconButton as D } from "../icon-button/icon-button.js";
|
|
12
|
+
const g = (o, e, t) => {
|
|
13
13
|
var l;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
if (!j(t))
|
|
15
|
+
return !1;
|
|
16
|
+
const r = t.type;
|
|
17
|
+
return r === o || // @ts-expect-error The TS error says there is no _owner but there is
|
|
18
|
+
((l = t == null ? void 0 : t._owner) == null ? void 0 : l.name) === e || r.componentType === e;
|
|
19
|
+
}, N = {
|
|
16
20
|
flat: 0,
|
|
17
21
|
secondary: 1,
|
|
18
22
|
primary: 2
|
|
19
|
-
},
|
|
23
|
+
}, W = ({
|
|
20
24
|
label: o,
|
|
21
|
-
size:
|
|
22
|
-
...
|
|
25
|
+
size: e = "small",
|
|
26
|
+
...t
|
|
23
27
|
}) => {
|
|
24
|
-
let
|
|
25
|
-
return (
|
|
26
|
-
|
|
28
|
+
let r = "sm";
|
|
29
|
+
return (e === "large" || e === "medium") && (r = "md"), o ? /* @__PURE__ */ n(
|
|
30
|
+
B,
|
|
27
31
|
{
|
|
28
|
-
onClick:
|
|
32
|
+
onClick: t.onClick,
|
|
29
33
|
variant: "flat",
|
|
30
|
-
size:
|
|
34
|
+
size: e,
|
|
31
35
|
appearance: "dark",
|
|
32
36
|
className: "gi-modal-icon",
|
|
33
37
|
"aria-label": o,
|
|
34
|
-
...
|
|
35
|
-
children: /* @__PURE__ */
|
|
38
|
+
...t,
|
|
39
|
+
children: /* @__PURE__ */ f(F, { children: [
|
|
36
40
|
o,
|
|
37
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ n($, { icon: "close", size: r })
|
|
38
42
|
] })
|
|
39
43
|
}
|
|
40
|
-
) : /* @__PURE__ */
|
|
41
|
-
|
|
44
|
+
) : /* @__PURE__ */ n(
|
|
45
|
+
D,
|
|
42
46
|
{
|
|
43
47
|
className: "gi-modal-icon",
|
|
44
48
|
icon: {
|
|
45
49
|
icon: "close"
|
|
46
50
|
},
|
|
47
51
|
"aria-label": "Close modal",
|
|
48
|
-
onClick:
|
|
52
|
+
onClick: t.onClick,
|
|
49
53
|
variant: "flat",
|
|
50
|
-
size:
|
|
54
|
+
size: e,
|
|
51
55
|
appearance: "dark",
|
|
52
|
-
...
|
|
56
|
+
...t
|
|
53
57
|
}
|
|
54
58
|
);
|
|
55
|
-
},
|
|
59
|
+
}, q = ({
|
|
56
60
|
position: o = "center",
|
|
57
|
-
size:
|
|
58
|
-
closeOnClick:
|
|
59
|
-
closeOnOverlayClick:
|
|
61
|
+
size: e = "lg",
|
|
62
|
+
closeOnClick: t = !0,
|
|
63
|
+
closeOnOverlayClick: r = !0,
|
|
60
64
|
isOpen: l,
|
|
61
|
-
onClose:
|
|
62
|
-
closeButtonLabel:
|
|
63
|
-
className:
|
|
64
|
-
children:
|
|
65
|
-
closeButtonSize:
|
|
66
|
-
dataTestId:
|
|
67
|
-
...
|
|
65
|
+
onClose: u,
|
|
66
|
+
closeButtonLabel: d,
|
|
67
|
+
className: p,
|
|
68
|
+
children: a,
|
|
69
|
+
closeButtonSize: i,
|
|
70
|
+
dataTestId: s,
|
|
71
|
+
...M
|
|
68
72
|
}) => {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
(
|
|
73
|
-
),
|
|
74
|
-
(
|
|
75
|
-
),
|
|
76
|
-
as:
|
|
77
|
-
}) : null,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
)
|
|
82
|
-
return /* @__PURE__ */
|
|
73
|
+
const T = P(null);
|
|
74
|
+
V(T.current, l);
|
|
75
|
+
const b = w.toArray(a), k = b.find(
|
|
76
|
+
(c) => g(v, "ModalTitle", c)
|
|
77
|
+
), h = b.find(
|
|
78
|
+
(c) => g(C, "ModalFooter", c)
|
|
79
|
+
), I = k ? y(k, {
|
|
80
|
+
as: e === "sm" ? "h5" : "h4"
|
|
81
|
+
}) : null, E = h ? y(h, {
|
|
82
|
+
dataModalSize: e
|
|
83
|
+
}) : null, O = b.filter(
|
|
84
|
+
(c) => !g(v, "ModalTitle", c) && !g(C, "ModalFooter", c)
|
|
85
|
+
);
|
|
86
|
+
return /* @__PURE__ */ n(z, { modalRef: T, isOpen: l, children: /* @__PURE__ */ n(
|
|
83
87
|
"div",
|
|
84
88
|
{
|
|
85
|
-
...
|
|
86
|
-
ref:
|
|
87
|
-
className:
|
|
89
|
+
...M,
|
|
90
|
+
ref: T,
|
|
91
|
+
className: m("gi-modal", {
|
|
88
92
|
"gi-modal-open": l,
|
|
89
93
|
"gi-modal-close": !l
|
|
90
94
|
}),
|
|
91
|
-
"data-testid":
|
|
92
|
-
onClick: (
|
|
93
|
-
|
|
95
|
+
"data-testid": s || "modal",
|
|
96
|
+
onClick: (c) => {
|
|
97
|
+
c.currentTarget === c.target && t && r && u();
|
|
94
98
|
},
|
|
95
|
-
children: /* @__PURE__ */
|
|
99
|
+
children: /* @__PURE__ */ f(
|
|
96
100
|
"div",
|
|
97
101
|
{
|
|
98
102
|
"data-testid": "modal-container",
|
|
99
103
|
role: "dialog",
|
|
100
104
|
"aria-modal": "true",
|
|
101
105
|
"aria-label": "dialog",
|
|
102
|
-
"data-size":
|
|
106
|
+
"data-size": e,
|
|
103
107
|
"data-position": o,
|
|
104
|
-
className:
|
|
108
|
+
className: m(
|
|
105
109
|
"gi-modal-container-control",
|
|
106
110
|
{
|
|
107
|
-
"gi-modal-container": !
|
|
111
|
+
"gi-modal-container": !p,
|
|
108
112
|
"gi-modal-container-center": o === "center",
|
|
109
113
|
"gi-modal-container-left": o === "left",
|
|
110
114
|
"gi-modal-container-right": o === "right",
|
|
111
115
|
"gi-modal-container-bottom": o === "bottom"
|
|
112
116
|
},
|
|
113
|
-
|
|
117
|
+
p
|
|
114
118
|
),
|
|
115
119
|
children: [
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
/* @__PURE__ */ f("div", { children: [
|
|
121
|
+
I,
|
|
122
|
+
t && /* @__PURE__ */ n(
|
|
123
|
+
W,
|
|
120
124
|
{
|
|
121
|
-
onClick:
|
|
122
|
-
label:
|
|
123
|
-
size:
|
|
125
|
+
onClick: u,
|
|
126
|
+
label: d,
|
|
127
|
+
size: i
|
|
124
128
|
}
|
|
125
129
|
)
|
|
126
130
|
] }),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
"gi-pb-6": !M
|
|
132
|
-
}),
|
|
133
|
-
children: j
|
|
134
|
-
}
|
|
135
|
-
)
|
|
131
|
+
/* @__PURE__ */ f("div", { className: m({ "gi-pb-6": !h }), children: [
|
|
132
|
+
O,
|
|
133
|
+
E
|
|
134
|
+
] })
|
|
136
135
|
]
|
|
137
136
|
}
|
|
138
137
|
)
|
|
139
138
|
}
|
|
140
139
|
) });
|
|
141
|
-
},
|
|
140
|
+
}, v = ({ children: o, as: e = "h4", ...t }) => /* @__PURE__ */ n("div", { className: "gi-flex-1", id: t.id, "aria-label": o == null ? void 0 : o.toString(), children: /* @__PURE__ */ n(S, { as: e, ...t, children: o }) });
|
|
141
|
+
Object.defineProperty(v, "componentType", {
|
|
142
|
+
value: "ModalTitle",
|
|
143
|
+
writable: !1,
|
|
144
|
+
enumerable: !1
|
|
145
|
+
});
|
|
146
|
+
v.displayName = "ModalTitle";
|
|
147
|
+
const te = ({
|
|
142
148
|
children: o,
|
|
143
|
-
className:
|
|
144
|
-
}) => /* @__PURE__ */
|
|
149
|
+
className: e
|
|
150
|
+
}) => /* @__PURE__ */ n(
|
|
145
151
|
"div",
|
|
146
152
|
{
|
|
147
153
|
id: "gi-modal-body",
|
|
148
154
|
"aria-label": "Modal content",
|
|
149
155
|
role: "document",
|
|
150
|
-
className:
|
|
156
|
+
className: m(
|
|
151
157
|
{
|
|
152
|
-
"gi-modal-body": !
|
|
158
|
+
"gi-modal-body": !e
|
|
153
159
|
},
|
|
154
|
-
|
|
160
|
+
e
|
|
155
161
|
),
|
|
156
162
|
children: o
|
|
157
163
|
}
|
|
158
|
-
),
|
|
164
|
+
), C = ({
|
|
159
165
|
className: o,
|
|
160
|
-
children:
|
|
161
|
-
orientation:
|
|
162
|
-
dataModalSize:
|
|
166
|
+
children: e,
|
|
167
|
+
orientation: t,
|
|
168
|
+
dataModalSize: r
|
|
163
169
|
}) => {
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
"gi-justify-center":
|
|
172
|
-
"gi-justify-
|
|
170
|
+
const d = (Array.isArray(e) ? e : [e]).filter((a) => {
|
|
171
|
+
var i, s;
|
|
172
|
+
return j(a) && (a.type === B || ((i = a.type) == null ? void 0 : i.displayName) === "Button" || ((s = a.props) == null ? void 0 : s["data-button"]));
|
|
173
|
+
}).sort((a, i) => {
|
|
174
|
+
const s = a.props.variant ?? "primary", M = i.props.variant ?? "primary";
|
|
175
|
+
return (N[s] || 0) - (N[M] || 0);
|
|
176
|
+
}), p = m({
|
|
177
|
+
"gi-justify-center sm:gi-justify-start": !t && r !== "sm",
|
|
178
|
+
"gi-justify-center": t === "vertical" || r === "sm",
|
|
179
|
+
"gi-justify-start": t === "horizontal"
|
|
173
180
|
});
|
|
174
|
-
return /* @__PURE__ */
|
|
181
|
+
return /* @__PURE__ */ n(
|
|
175
182
|
"div",
|
|
176
183
|
{
|
|
177
|
-
className:
|
|
178
|
-
"gi-pt-6":
|
|
179
|
-
"gi-modal-footer":
|
|
184
|
+
className: m(o, {
|
|
185
|
+
"gi-pt-6": d.length === 0,
|
|
186
|
+
"gi-modal-footer": d.length
|
|
180
187
|
}),
|
|
181
|
-
children:
|
|
188
|
+
children: d.length > 0 && /* @__PURE__ */ n(
|
|
182
189
|
"div",
|
|
183
190
|
{
|
|
184
|
-
"data-orientation":
|
|
185
|
-
"data-modal-size":
|
|
186
|
-
children:
|
|
187
|
-
(
|
|
188
|
-
var
|
|
189
|
-
return
|
|
190
|
-
|
|
191
|
+
"data-orientation": t || "unset",
|
|
192
|
+
"data-modal-size": r,
|
|
193
|
+
children: d.map(
|
|
194
|
+
(a, i) => {
|
|
195
|
+
var s;
|
|
196
|
+
return y(a, {
|
|
197
|
+
key: a.key || a.props.id || a.props.dataTestid || `modal-footer-button-${i}`,
|
|
198
|
+
id: a.props.id || `modal-footer-button-${i}`,
|
|
199
|
+
className: m((s = a == null ? void 0 : a.props) == null ? void 0 : s.className, p)
|
|
191
200
|
});
|
|
192
201
|
}
|
|
193
202
|
) || null
|
|
@@ -195,42 +204,54 @@ const h = (o, t, a) => {
|
|
|
195
204
|
)
|
|
196
205
|
}
|
|
197
206
|
);
|
|
198
|
-
}
|
|
207
|
+
};
|
|
208
|
+
Object.defineProperty(C, "componentType", {
|
|
209
|
+
value: "ModalFooter",
|
|
210
|
+
writable: !1,
|
|
211
|
+
enumerable: !1
|
|
212
|
+
});
|
|
213
|
+
C.displayName = "ModalFooter";
|
|
214
|
+
const z = ({
|
|
199
215
|
children: o,
|
|
200
|
-
modalRef:
|
|
201
|
-
isOpen:
|
|
202
|
-
}) =>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
216
|
+
modalRef: e,
|
|
217
|
+
isOpen: t
|
|
218
|
+
}) => {
|
|
219
|
+
const [r, l] = A(!1);
|
|
220
|
+
return x(() => {
|
|
221
|
+
l(!0);
|
|
222
|
+
}, []), _(e == null ? void 0 : e.current, t && r, {
|
|
223
|
+
initialFocus: !1,
|
|
224
|
+
fallbackFocus: () => e == null ? void 0 : e.current
|
|
225
|
+
}), r ? H(o, document.body) : null;
|
|
226
|
+
}, oe = ({
|
|
206
227
|
children: o,
|
|
207
|
-
triggerButton:
|
|
208
|
-
startsOpen:
|
|
209
|
-
...
|
|
228
|
+
triggerButton: e,
|
|
229
|
+
startsOpen: t,
|
|
230
|
+
...r
|
|
210
231
|
}) => {
|
|
211
|
-
const [l,
|
|
232
|
+
const [l, u] = A(!!t), d = () => u(!0), p = () => u(!1), a = y(e, {
|
|
212
233
|
"data-testid": "modal-trigger-button-container",
|
|
213
234
|
"aria-haspopup": "dialog",
|
|
214
|
-
onClick:
|
|
235
|
+
onClick: d
|
|
215
236
|
});
|
|
216
|
-
return /* @__PURE__ */
|
|
217
|
-
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
|
|
237
|
+
return /* @__PURE__ */ f(F, { children: [
|
|
238
|
+
a,
|
|
239
|
+
/* @__PURE__ */ n(
|
|
240
|
+
q,
|
|
220
241
|
{
|
|
221
|
-
onClose:
|
|
242
|
+
onClose: p,
|
|
222
243
|
position: "center",
|
|
223
244
|
isOpen: l,
|
|
224
|
-
...
|
|
245
|
+
...r,
|
|
225
246
|
children: o
|
|
226
247
|
}
|
|
227
248
|
)
|
|
228
249
|
] });
|
|
229
250
|
};
|
|
230
251
|
export {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
252
|
+
oe as Modal,
|
|
253
|
+
te as ModalBody,
|
|
254
|
+
C as ModalFooter,
|
|
255
|
+
v as ModalTitle,
|
|
256
|
+
q as ModalWrapper
|
|
236
257
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { PopoverProps } from './types.js';
|
|
2
|
-
export declare const Popover: ({ triggerRef, children, className, open, onOpenChange, options, extraRefs, }: PopoverProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
2
|
+
export declare const Popover: ({ triggerRef, children, className, open, onOpenChange, maxHeight, options, extraRefs, }: PopoverProps) => import("react/jsx-runtime").JSX.Element | null;
|