@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.
Files changed (55) hide show
  1. package/dist/autocomplete/autocomplete.d.ts +21 -3
  2. package/dist/autocomplete/autocomplete.js +208 -159
  3. package/dist/autocomplete/types.d.ts +8 -4
  4. package/dist/autocomplete/types.js +2 -1
  5. package/dist/autocomplete/use-autocomplete-controller.d.ts +4 -2
  6. package/dist/autocomplete/use-autocomplete-controller.js +123 -79
  7. package/dist/button/button.js +27 -22
  8. package/dist/data-grid/data-grid-footer.d.ts +12 -0
  9. package/dist/data-grid/data-grid-footer.js +66 -0
  10. package/dist/data-grid/data-grid-header.d.ts +12 -0
  11. package/dist/data-grid/data-grid-header.js +82 -0
  12. package/dist/header/components/header-slot.js +34 -31
  13. package/dist/header/helper.d.ts +0 -1
  14. package/dist/header/helper.js +37 -62
  15. package/dist/hooks/use-combined-refs.d.ts +5 -0
  16. package/dist/hooks/use-combined-refs.js +10 -0
  17. package/dist/hooks/use-scroll-highlighted-item.d.ts +1 -0
  18. package/dist/hooks/use-scroll-highlighted-item.js +16 -0
  19. package/dist/icon/icon.js +15 -15
  20. package/dist/icon-button/icon-button.js +14 -12
  21. package/dist/index.d.ts +5 -2
  22. package/dist/index.js +68 -63
  23. package/dist/list/list.js +1 -1
  24. package/dist/modal/modal.d.ts +8 -2
  25. package/dist/modal/modal.js +155 -134
  26. package/dist/popover/popover.d.ts +1 -1
  27. package/dist/popover/popover.js +296 -286
  28. package/dist/popover/types.d.ts +1 -0
  29. package/dist/popover/utilities.d.ts +2 -0
  30. package/dist/popover/utilities.js +16 -0
  31. package/dist/primitives/button.d.ts +3 -0
  32. package/dist/primitives/button.js +9 -0
  33. package/dist/select/select-menu.d.ts +2 -2
  34. package/dist/select/select-menu.js +96 -99
  35. package/dist/select/select-next.d.ts +13 -2
  36. package/dist/select/select-next.js +182 -167
  37. package/dist/select/select-search.js +17 -17
  38. package/dist/select/types.d.ts +3 -1
  39. package/dist/styles.css +1 -1
  40. package/dist/table/table-data.js +1 -1
  41. package/dist/tabs/scrollable-tab-list.d.ts +9 -0
  42. package/dist/tabs/scrollable-tab-list.js +84 -0
  43. package/dist/tabs/tab-item.d.ts +9 -15
  44. package/dist/tabs/tab-item.js +85 -38
  45. package/dist/tabs/tab-list.d.ts +2 -5
  46. package/dist/tabs/tab-list.js +83 -49
  47. package/dist/tabs/tab-panel.d.ts +2 -7
  48. package/dist/tabs/tab-panel.js +2 -5
  49. package/dist/tabs/tabs.d.ts +2 -7
  50. package/dist/tabs/tabs.js +24 -20
  51. package/dist/tabs/types.d.ts +64 -0
  52. package/dist/tabs/types.js +1 -0
  53. package/dist/textarea/textarea.d.ts +1 -2
  54. package/dist/textarea/textarea.js +60 -61
  55. package/package.json +4 -4
@@ -1,193 +1,202 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as g, Fragment as B } from "react/jsx-runtime";
3
- import { useState as x, cloneElement as f, isValidElement as b, useRef as I, Children as E } from "react";
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 A } from "../button/button.js";
6
- import { cn as c } from "../cn.js";
7
- import { Heading as O } from "../heading/heading.js";
8
- import { useAriaHider as P } from "../hooks/use-aria-hider.js";
9
- import { useFocusTrap as S } from "../hooks/use-focus-trap.js";
10
- import { Icon as V } from "../icon/icon.js";
11
- import { IconButton as _ } from "../icon-button/icon-button.js";
12
- const h = (o, t, a) => {
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
- return b(a) ? a.type === o || ((l = a == null ? void 0 : a._owner) == null ? void 0 : l.name) === t : !1;
15
- }, T = {
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
- }, w = ({
23
+ }, W = ({
20
24
  label: o,
21
- size: t = "small",
22
- ...a
25
+ size: e = "small",
26
+ ...t
23
27
  }) => {
24
- let n = "sm";
25
- return (t === "large" || t === "medium") && (n = "md"), o ? /* @__PURE__ */ e(
26
- A,
28
+ let r = "sm";
29
+ return (e === "large" || e === "medium") && (r = "md"), o ? /* @__PURE__ */ n(
30
+ B,
27
31
  {
28
- onClick: a.onClick,
32
+ onClick: t.onClick,
29
33
  variant: "flat",
30
- size: t,
34
+ size: e,
31
35
  appearance: "dark",
32
36
  className: "gi-modal-icon",
33
37
  "aria-label": o,
34
- ...a,
35
- children: /* @__PURE__ */ g(B, { children: [
38
+ ...t,
39
+ children: /* @__PURE__ */ f(F, { children: [
36
40
  o,
37
- /* @__PURE__ */ e(V, { icon: "close", size: n })
41
+ /* @__PURE__ */ n($, { icon: "close", size: r })
38
42
  ] })
39
43
  }
40
- ) : /* @__PURE__ */ e(
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: a.onClick,
52
+ onClick: t.onClick,
49
53
  variant: "flat",
50
- size: t,
54
+ size: e,
51
55
  appearance: "dark",
52
- ...a
56
+ ...t
53
57
  }
54
58
  );
55
- }, D = ({
59
+ }, q = ({
56
60
  position: o = "center",
57
- size: t = "lg",
58
- closeOnClick: a = !0,
59
- closeOnOverlayClick: n = !0,
61
+ size: e = "lg",
62
+ closeOnClick: t = !0,
63
+ closeOnOverlayClick: r = !0,
60
64
  isOpen: l,
61
- onClose: d,
62
- closeButtonLabel: s,
63
- className: m,
64
- children: r,
65
- closeButtonSize: u,
66
- dataTestId: p,
67
- ...y
65
+ onClose: u,
66
+ closeButtonLabel: d,
67
+ className: p,
68
+ children: a,
69
+ closeButtonSize: i,
70
+ dataTestId: s,
71
+ ...M
68
72
  }) => {
69
- const C = I(null);
70
- P(C.current, l);
71
- const v = E.toArray(r), k = v.find(
72
- (i) => h(N, "ModalTitle", i)
73
- ), M = v.find(
74
- (i) => h(W, "ModalFooter", i)
75
- ), F = k ? f(k, {
76
- as: t === "sm" ? "h5" : "h4"
77
- }) : null, j = v.map(
78
- (i) => M ? f(i, {
79
- dataModalSize: t
80
- }) : i
81
- ).filter((i) => !h(N, "ModalTitle", i));
82
- return /* @__PURE__ */ e(q, { modalRef: C, isOpen: l, children: /* @__PURE__ */ e(
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
- ...y,
86
- ref: C,
87
- className: c("gi-modal", {
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": p || "modal",
92
- onClick: (i) => {
93
- i.currentTarget === i.target && a && n && d();
95
+ "data-testid": s || "modal",
96
+ onClick: (c) => {
97
+ c.currentTarget === c.target && t && r && u();
94
98
  },
95
- children: /* @__PURE__ */ g(
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": t,
106
+ "data-size": e,
103
107
  "data-position": o,
104
- className: c(
108
+ className: m(
105
109
  "gi-modal-container-control",
106
110
  {
107
- "gi-modal-container": !m,
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
- m
117
+ p
114
118
  ),
115
119
  children: [
116
- /* @__PURE__ */ g("div", { children: [
117
- F,
118
- a && /* @__PURE__ */ e(
119
- w,
120
+ /* @__PURE__ */ f("div", { children: [
121
+ I,
122
+ t && /* @__PURE__ */ n(
123
+ W,
120
124
  {
121
- onClick: d,
122
- label: s,
123
- size: u
125
+ onClick: u,
126
+ label: d,
127
+ size: i
124
128
  }
125
129
  )
126
130
  ] }),
127
- /* @__PURE__ */ e(
128
- "div",
129
- {
130
- className: c({
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
- }, N = ({ children: o, as: t = "h4", ...a }) => /* @__PURE__ */ e("div", { className: "gi-flex-1", id: a.id, "aria-label": o == null ? void 0 : o.toString(), children: /* @__PURE__ */ e(O, { as: t, ...a, children: o }) }), R = ({
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: t
144
- }) => /* @__PURE__ */ e(
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: c(
156
+ className: m(
151
157
  {
152
- "gi-modal-body": !t
158
+ "gi-modal-body": !e
153
159
  },
154
- t
160
+ e
155
161
  ),
156
162
  children: o
157
163
  }
158
- ), W = ({
164
+ ), C = ({
159
165
  className: o,
160
- children: t,
161
- orientation: a,
162
- dataModalSize: n
166
+ children: e,
167
+ orientation: t,
168
+ dataModalSize: r
163
169
  }) => {
164
- const s = (Array.isArray(t) ? t : [t]).filter(
165
- (r) => b(r) && r.type === A
166
- ).sort((r, u) => {
167
- const p = r.props.variant ?? "primary", y = u.props.variant ?? "primary";
168
- return (T[p] || 0) - (T[y] || 0);
169
- }), m = c({
170
- "gi-justify-center sm:gi-justify-start": !a && n !== "sm",
171
- "gi-justify-center": a === "vertical" || n === "sm",
172
- "gi-justify-start": a === "horizontal"
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__ */ e(
181
+ return /* @__PURE__ */ n(
175
182
  "div",
176
183
  {
177
- className: c(o, {
178
- "gi-pt-6": s.length === 0,
179
- "gi-modal-footer": s.length
184
+ className: m(o, {
185
+ "gi-pt-6": d.length === 0,
186
+ "gi-modal-footer": d.length
180
187
  }),
181
- children: s.length > 0 && /* @__PURE__ */ e(
188
+ children: d.length > 0 && /* @__PURE__ */ n(
182
189
  "div",
183
190
  {
184
- "data-orientation": a || "unset",
185
- "data-modal-size": n,
186
- children: s.map(
187
- (r) => {
188
- var u;
189
- return f(r, {
190
- className: c((u = r == null ? void 0 : r.props) == null ? void 0 : u.className, m)
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
- }, q = ({
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: t,
201
- isOpen: a
202
- }) => (S(t == null ? void 0 : t.current, a, {
203
- initialFocus: !1,
204
- fallbackFocus: () => t == null ? void 0 : t.current
205
- }), typeof document > "u" ? null : H(o, document.body)), tt = ({
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: t,
208
- startsOpen: a,
209
- ...n
228
+ triggerButton: e,
229
+ startsOpen: t,
230
+ ...r
210
231
  }) => {
211
- const [l, d] = x(!!a), s = () => d(!0), m = () => d(!1), r = f(t, {
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: s
235
+ onClick: d
215
236
  });
216
- return /* @__PURE__ */ g(B, { children: [
217
- r,
218
- /* @__PURE__ */ e(
219
- D,
237
+ return /* @__PURE__ */ f(F, { children: [
238
+ a,
239
+ /* @__PURE__ */ n(
240
+ q,
220
241
  {
221
- onClose: m,
242
+ onClose: p,
222
243
  position: "center",
223
244
  isOpen: l,
224
- ...n,
245
+ ...r,
225
246
  children: o
226
247
  }
227
248
  )
228
249
  ] });
229
250
  };
230
251
  export {
231
- tt as Modal,
232
- R as ModalBody,
233
- W as ModalFooter,
234
- N as ModalTitle,
235
- D as ModalWrapper
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;