@ogcio/design-system-react 1.30.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.
Files changed (70) hide show
  1. package/dist/atoms/DsButton.js +3 -2
  2. package/dist/atoms/InsetText.d.ts +14 -0
  3. package/dist/atoms/InsetText.js +17 -0
  4. package/dist/atoms/icons/Close.js +9 -8
  5. package/dist/atoms/icons/KeyboardArrowDown.js +6 -5
  6. package/dist/atoms/icons/KeyboardArrowUp.js +6 -5
  7. package/dist/atoms/icons/Visibility.js +15 -14
  8. package/dist/atoms/icons/VisibilityOff.js +9 -8
  9. package/dist/atoms/icons/logos/LogoBlack.d.ts +3 -0
  10. package/dist/atoms/icons/logos/LogoBlack.js +327 -0
  11. package/dist/atoms/icons/logos/LogoGoldGreen.d.ts +3 -0
  12. package/dist/atoms/icons/logos/LogoGoldGreen.js +327 -0
  13. package/dist/atoms/icons/logos/LogoGoldWhite.d.ts +3 -0
  14. package/dist/atoms/icons/logos/LogoGoldWhite.js +87 -0
  15. package/dist/atoms/icons/logos/LogoHarpBlack.d.ts +3 -0
  16. package/dist/atoms/icons/logos/LogoHarpBlack.js +68 -0
  17. package/dist/atoms/icons/logos/LogoHarpWhite.d.ts +3 -0
  18. package/dist/{assets/logos/LogoHarpBlack.js → atoms/icons/logos/LogoHarpWhite.js} +33 -31
  19. package/dist/atoms/icons/logos/LogoWhite.d.ts +3 -0
  20. package/dist/atoms/icons/logos/LogoWhite.js +327 -0
  21. package/dist/atoms/icons/logos/index.d.ts +6 -0
  22. package/dist/atoms/icons/logos/index.js +14 -0
  23. package/dist/atoms/icons/types.d.ts +5 -5
  24. package/dist/atoms/index.d.ts +1 -0
  25. package/dist/atoms/index.js +12 -10
  26. package/dist/blockquote/blockquote.d.ts +4 -1
  27. package/dist/blockquote/blockquote.js +18 -4
  28. package/dist/breadcrumbs/breadcrumbs.js +54 -33
  29. package/dist/button-group/button-group.js +31 -28
  30. package/dist/character-count/character-count.js +5 -5
  31. package/dist/chip/chip.js +41 -19
  32. package/dist/combo-box/combo-box.js +6 -13
  33. package/dist/cookie-banner/cookie-banner.js +28 -20
  34. package/dist/details/details.js +43 -23
  35. package/dist/drawer/drawer.js +35 -32
  36. package/dist/footer/footer.js +54 -46
  37. package/dist/header/header-legacy.js +8 -8
  38. package/dist/hooks/use-aria-hider.d.ts +1 -1
  39. package/dist/hooks/use-aria-hider.js +14 -13
  40. package/dist/hooks/use-focus-trap.d.ts +1 -1
  41. package/dist/hooks/use-focus-trap.js +179 -179
  42. package/dist/icons/index.d.ts +1 -0
  43. package/dist/icons/index.js +12 -0
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.js +144 -142
  46. package/dist/input-file/input-file.js +15 -12
  47. package/dist/logos/index.d.ts +1 -0
  48. package/dist/logos/index.js +14 -0
  49. package/dist/modal/modal.js +125 -128
  50. package/dist/popover/popover.js +67 -64
  51. package/dist/score-select/score-select.js +20 -20
  52. package/dist/select/select-next.js +45 -45
  53. package/dist/styles.css +1 -1
  54. package/dist/table/table-row.js +14 -7
  55. package/dist/tabs/tab-panel.js +6 -6
  56. package/dist/tabs/tabs.js +19 -19
  57. package/package.json +10 -10
  58. package/dist/assets/logos/LogoBlack.d.ts +0 -3
  59. package/dist/assets/logos/LogoBlack.js +0 -322
  60. package/dist/assets/logos/LogoGoldGreen.d.ts +0 -3
  61. package/dist/assets/logos/LogoGoldGreen.js +0 -322
  62. package/dist/assets/logos/LogoGoldWhite.d.ts +0 -3
  63. package/dist/assets/logos/LogoGoldWhite.js +0 -82
  64. package/dist/assets/logos/LogoHarpBlack.d.ts +0 -3
  65. package/dist/assets/logos/LogoHarpWhite.d.ts +0 -3
  66. package/dist/assets/logos/LogoHarpWhite.js +0 -60
  67. package/dist/assets/logos/LogoWhite.d.ts +0 -3
  68. package/dist/assets/logos/LogoWhite.js +0 -322
  69. package/dist/assets/logos/index.d.ts +0 -6
  70. package/dist/assets/logos/index.js +0 -14
@@ -1,130 +1,130 @@
1
1
  "use client";
2
- import { jsx as i, jsxs as y, Fragment as j } from "react/jsx-runtime";
3
- import { isValidElement as U, cloneElement as T, useState as A, useRef as W, useMemo as _, Children as z, useId as G, useEffect as C } from "react";
4
- import { createPortal as J } from "react-dom";
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 Q } from "../heading/heading.js";
8
- import { useAriaHider as X } from "../hooks/use-aria-hider.js";
9
- import { useFocusTrap as Y } from "../hooks/use-focus-trap.js";
10
- import { Icon as Z } from "../icon/icon.js";
11
- import { IconButton as O } from "../icon-button/icon-button.js";
12
- import { splitAriaProps as R, isSpecialComponent as tt, getSpecialComponentType as et } from "../utils/utilities.js";
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
- }, ot = ({
17
+ }, oe = ({
18
18
  label: e,
19
- size: t = "small",
20
- ...o
19
+ size: o = "small",
20
+ ...t
21
21
  }) => {
22
22
  let n = "sm";
23
- return (t === "large" || t === "medium") && (n = "md"), e ? /* @__PURE__ */ i(
23
+ return (o === "large" || o === "medium") && (n = "md"), e ? /* @__PURE__ */ l(
24
24
  E,
25
25
  {
26
- onClick: o.onClick,
26
+ onClick: t.onClick,
27
27
  variant: "flat",
28
- size: t,
28
+ size: o,
29
29
  appearance: "dark",
30
30
  className: "gi-modal-icon",
31
31
  "aria-label": e,
32
- ...o,
32
+ ...t,
33
33
  children: /* @__PURE__ */ y(j, { children: [
34
34
  e,
35
- /* @__PURE__ */ i(Z, { icon: "close", size: n })
35
+ /* @__PURE__ */ l(Y, { icon: "close", size: n })
36
36
  ] })
37
37
  }
38
- ) : /* @__PURE__ */ i(
39
- O,
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: o.onClick,
44
+ onClick: t.onClick,
45
45
  variant: "flat",
46
- size: t,
46
+ size: o,
47
47
  appearance: "dark",
48
48
  dataTestid: "modal-close-button",
49
- ...o
49
+ ...t
50
50
  }
51
51
  );
52
- }, rt = ({
52
+ }, ae = ({
53
53
  closeButtonLabel: e,
54
- modalTitle: t,
55
- closeOnClick: o,
54
+ modalTitle: o,
55
+ closeOnClick: t,
56
56
  onClose: n,
57
- closeButtonSize: r
57
+ closeButtonSize: a
58
58
  }) => /* @__PURE__ */ y("div", { className: "gi-py-2 xs:gi-py-4", children: [
59
- t,
60
- o && /* @__PURE__ */ i(
61
- ot,
59
+ o,
60
+ t && /* @__PURE__ */ l(
61
+ oe,
62
62
  {
63
63
  onClick: n,
64
64
  label: e,
65
- size: r
65
+ size: a
66
66
  }
67
67
  )
68
- ] }), at = ({
68
+ ] }), re = ({
69
69
  position: e = "center",
70
- size: t = "lg",
71
- closeOnClick: o = !0,
70
+ size: o = "lg",
71
+ closeOnClick: t = !0,
72
72
  closeOnOverlayClick: n = !0,
73
- isOpen: r,
74
- onClose: s,
73
+ isOpen: a,
74
+ onClose: d,
75
75
  closeButtonLabel: h,
76
- className: d,
77
- children: g,
78
- closeButtonSize: a,
79
- closeOnEscape: l,
76
+ className: s,
77
+ children: f,
78
+ closeButtonSize: r,
79
+ closeOnEscape: i,
80
80
  dataTestId: c,
81
81
  ...v
82
82
  }) => {
83
- var k;
84
- const M = W(null);
85
- X(M.current, r);
86
- const [D, S] = _(
87
- () => R(v),
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 = z.toArray(g), b = (m) => F.find(
90
- (p) => et(p) === m
91
- ), f = b("ModalTitle"), N = b("ModalFooter") || b("DrawerFooter"), L = G(), H = ((k = f == null ? void 0 : f.props) == null ? void 0 : k.id) || `gi-modal-title-${L}`, $ = f ? T(f, {
92
- as: t === "sm" ? "h5" : "h4",
93
- id: H
94
- }) : null, V = N ? T(N, {
95
- dataModalSize: t
96
- }) : null, q = F.filter(
97
- (m) => !tt(m, ["ModalTitle", "ModalFooter", "DrawerFooter"])
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 (!r || !l)
100
+ if (!a || !i)
101
101
  return;
102
102
  const m = (p) => {
103
- p.key === "Escape" && (p.stopPropagation(), s());
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
- }, [r, l, s]), C(() => {
109
- if (!r || !o || !n)
108
+ }, [a, i, d]), C(() => {
109
+ if (!a || !t || !n)
110
110
  return;
111
111
  const m = (p) => {
112
112
  var B;
113
- const w = (B = M.current) == null ? void 0 : B.querySelector(
113
+ const k = (B = M.current) == null ? void 0 : B.querySelector(
114
114
  ".gi-modal-container-control"
115
115
  );
116
- w && (w.contains(p.target) || s());
116
+ k && (k.contains(p.target) || d());
117
117
  };
118
118
  return document.addEventListener("pointerdown", m, !0), () => document.removeEventListener("pointerdown", m, !0);
119
- }, [r, o, n, s]);
120
- const K = /* @__PURE__ */ i(
119
+ }, [a, t, n, d]);
120
+ const q = /* @__PURE__ */ l(
121
121
  "div",
122
122
  {
123
- ...S,
123
+ ...R,
124
124
  ref: M,
125
125
  className: u("gi-modal", {
126
- "gi-modal-open": r,
127
- "gi-modal-close": !r
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": t,
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": !d,
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
- d
150
+ s
151
151
  ),
152
152
  children: [
153
- /* @__PURE__ */ i(
154
- rt,
153
+ /* @__PURE__ */ l(
154
+ ae,
155
155
  {
156
156
  closeButtonLabel: h,
157
- modalTitle: $,
158
- closeOnClick: o,
159
- onClose: s,
160
- closeButtonSize: a
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": !N }), children: [
164
- q,
165
- V
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__ */ i(nt, { modalRef: M, isOpen: r, children: K });
173
- }, P = ({ children: e, as: t = "h4", ...o }) => /* @__PURE__ */ i("div", { className: "gi-flex-1", id: o.id, "aria-label": e == null ? void 0 : e.toString(), children: /* @__PURE__ */ i(Q, { as: t, ...o, children: e }) });
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 ht = ({
180
+ const he = ({
181
181
  children: e,
182
- className: t,
183
- includeModalClass: o = !0
184
- }) => /* @__PURE__ */ i(
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(o && "gi-modal-body", t),
190
+ className: u(t && "gi-modal-body", o),
191
191
  children: e
192
192
  }
193
193
  ), x = ({
194
194
  className: e,
195
- children: t,
196
- orientation: o,
195
+ children: o,
196
+ orientation: t,
197
197
  dataModalSize: n,
198
- stacked: r
198
+ stacked: a
199
199
  }) => {
200
- const d = (Array.isArray(t) ? t : [t]).filter((a) => {
201
- var l, c;
202
- return U(a) && (a.type === E || ((l = a.type) == null ? void 0 : l.displayName) === "Button" || ((c = a.props) == null ? void 0 : c["data-button"]));
203
- }).sort((a, l) => {
204
- const c = a.props.variant ?? "primary", v = l.props.variant ?? "primary";
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
- }), g = u({
207
- "gi-justify-center sm:gi-justify-start": !o && n !== "sm" && !r,
208
- "gi-justify-center": o === "vertical" || n === "sm" || r,
209
- "gi-justify-start": o === "horizontal"
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__ */ i(
211
+ return /* @__PURE__ */ l(
212
212
  "div",
213
213
  {
214
214
  className: u(e, {
215
- "gi-pt-6": d.length === 0,
216
- "gi-modal-footer": d.length,
217
- "gi-modal-footer-stacked": r
215
+ "gi-pt-6": s.length === 0,
216
+ "gi-modal-footer": s.length,
217
+ "gi-modal-footer-stacked": a
218
218
  }),
219
- children: d.length > 0 && /* @__PURE__ */ i(
219
+ children: s.length > 0 && /* @__PURE__ */ l(
220
220
  "div",
221
221
  {
222
- "data-orientation": o || "unset",
222
+ "data-orientation": t || "unset",
223
223
  "data-modal-size": n,
224
- children: d.map(
225
- (a, l) => {
224
+ children: s.map(
225
+ (r, i) => {
226
226
  var c;
227
- return T(a, {
228
- key: a.key || a.props.id || a.props.dataTestid || `modal-footer-button-${l}`,
229
- id: a.props.id || `modal-footer-button-${l}`,
230
- className: u((c = a == null ? void 0 : a.props) == null ? void 0 : c.className, g)
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 nt = ({
245
+ const ne = ({
246
246
  children: e,
247
- modalRef: t,
248
- isOpen: o
247
+ modalRef: o,
248
+ isOpen: t
249
249
  }) => {
250
- const [n, r] = A(!1);
250
+ const [n, a] = A(!1);
251
251
  return C(() => {
252
- r(!0);
253
- }, []), Y(t == null ? void 0 : t.current, o && n, {
254
- initialFocus: (t == null ? void 0 : t.current) ?? !0,
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: t,
260
- startsOpen: o,
256
+ triggerButton: o,
257
+ startsOpen: t,
261
258
  ...n
262
259
  }) => {
263
- const [r, s] = A(!!o), h = () => s(!0), d = () => s(!1), g = T(t, {
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
- g,
270
- /* @__PURE__ */ i(
271
- at,
266
+ f,
267
+ /* @__PURE__ */ l(
268
+ re,
272
269
  {
273
- onClose: d,
270
+ onClose: s,
274
271
  position: "center",
275
- isOpen: r,
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
- vt as Modal,
284
- ht as ModalBody,
280
+ ve as Modal,
281
+ he as ModalBody,
285
282
  x as ModalFooter,
286
283
  P as ModalTitle,
287
- at as ModalWrapper
284
+ re as ModalWrapper
288
285
  };