@ogcio/design-system-react 1.18.1 → 1.20.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 (98) hide show
  1. package/dist/accordion/accordion-item.js +15 -14
  2. package/dist/alert/alert.d.ts +1 -1
  3. package/dist/alert/alert.js +36 -27
  4. package/dist/autocomplete/autocomplete.js +3 -2
  5. package/dist/browser-support/runtime.d.ts +43 -0
  6. package/dist/browser-support/runtime.js +283 -0
  7. package/dist/button/button.js +12 -11
  8. package/dist/button-group/button-group.js +5 -4
  9. package/dist/card/card-next.js +16 -15
  10. package/dist/checkbox/checkbox-group.js +4 -3
  11. package/dist/checkbox/checkbox.js +5 -4
  12. package/dist/chip/chip.js +12 -11
  13. package/dist/combo-box/dropdown-item.js +3 -2
  14. package/dist/cookie-banner/cookie-banner.js +7 -6
  15. package/dist/data-table/editable-table-cell.js +3 -2
  16. package/dist/details/details.js +7 -6
  17. package/dist/drawer/drawer.js +7 -6
  18. package/dist/footer/footer.js +3 -2
  19. package/dist/forms/form-field/form-field.js +60 -61
  20. package/dist/header/components/header-menu.d.ts +1 -2
  21. package/dist/header/components/header-menu.js +18 -17
  22. package/dist/header/header-legacy.d.ts +2 -0
  23. package/dist/header/header-legacy.js +223 -0
  24. package/dist/header/header-next/components/header-logo.d.ts +2 -0
  25. package/dist/header/header-next/components/header-logo.js +19 -0
  26. package/dist/header/header-next/components/header-title.d.ts +2 -0
  27. package/dist/header/header-next/components/header-title.js +29 -0
  28. package/dist/header/header-next/components/menu/components/header-menu-item-button.d.ts +2 -0
  29. package/dist/header/header-next/components/menu/components/header-menu-item-button.js +42 -0
  30. package/dist/header/header-next/components/menu/components/header-menu-item-link.d.ts +8 -0
  31. package/dist/header/header-next/components/menu/components/header-menu-item-link.js +72 -0
  32. package/dist/header/header-next/components/menu/components/header-menu-item-separator.d.ts +3 -0
  33. package/dist/header/header-next/components/menu/components/header-menu-item-separator.js +34 -0
  34. package/dist/header/header-next/components/menu/components/header-menu-item-slot.d.ts +5 -0
  35. package/dist/header/header-next/components/menu/components/header-menu-item-slot.js +42 -0
  36. package/dist/header/header-next/components/menu/header-menu-context.d.ts +7 -0
  37. package/dist/header/header-next/components/menu/header-menu-context.js +23 -0
  38. package/dist/header/header-next/components/menu/header-primary-menu.d.ts +3 -0
  39. package/dist/header/header-next/components/menu/header-primary-menu.js +63 -0
  40. package/dist/header/header-next/components/menu/header-secondary-menu.d.ts +3 -0
  41. package/dist/header/header-next/components/menu/header-secondary-menu.js +52 -0
  42. package/dist/header/header-next/header-context.d.ts +13 -0
  43. package/dist/header/header-next/header-context.js +31 -0
  44. package/dist/header/header-next/header-next.d.ts +7 -0
  45. package/dist/header/header-next/header-next.js +75 -0
  46. package/dist/header/header-next/index.d.ts +11 -0
  47. package/dist/header/header-next/index.js +27 -0
  48. package/dist/header/header.d.ts +2 -2
  49. package/dist/header/header.js +17 -218
  50. package/dist/header/types.d.ts +84 -4
  51. package/dist/header/variants.d.ts +2 -2
  52. package/dist/header/variants.js +1 -1
  53. package/dist/hooks/use-breakpoint.js +8 -7
  54. package/dist/hooks/use-toggle-map.d.ts +15 -0
  55. package/dist/hooks/use-toggle-map.js +45 -0
  56. package/dist/icon/icon.js +3 -2
  57. package/dist/icon/icons.d.ts +2 -2
  58. package/dist/icon/icons.js +2 -0
  59. package/dist/icon-button/icon-button.js +5 -4
  60. package/dist/index.d.ts +2 -0
  61. package/dist/index.js +205 -178
  62. package/dist/input-checkbox/input-checkbox.d.ts +1 -1
  63. package/dist/input-checkbox/input-checkbox.js +66 -48
  64. package/dist/input-checkbox-group/input-checkbox-group.js +10 -9
  65. package/dist/input-password/input-password.js +1 -0
  66. package/dist/input-radio/input-radio.d.ts +1 -1
  67. package/dist/input-radio/input-radio.js +52 -44
  68. package/dist/input-radio-group/input-radio-group.js +9 -8
  69. package/dist/input-text/input-text.js +3 -2
  70. package/dist/list-item/list-item.d.ts +3 -2
  71. package/dist/list-item/list-item.js +15 -6
  72. package/dist/modal/modal.js +5 -4
  73. package/dist/modal/types.d.ts +5 -3
  74. package/dist/pagination/pagination.js +26 -25
  75. package/dist/phase-banner/phase-banner.js +3 -2
  76. package/dist/popover/popover.js +3 -2
  77. package/dist/radio/radio-group.js +1 -0
  78. package/dist/radio/radio.js +1 -0
  79. package/dist/score-select/score-select.js +4 -3
  80. package/dist/select/select-menu.js +16 -15
  81. package/dist/select/select-next.js +3 -2
  82. package/dist/select/select.js +4 -3
  83. package/dist/side-nav/side-nav.js +10 -9
  84. package/dist/spinner/spinner.js +3 -2
  85. package/dist/stack/stack.js +21 -20
  86. package/dist/styles.css +2 -2
  87. package/dist/table/table-data.js +12 -11
  88. package/dist/table/table-header.js +3 -2
  89. package/dist/tabs/tab-item.js +7 -6
  90. package/dist/tabs/tab-list.js +3 -2
  91. package/dist/text-input/text-input.js +1 -0
  92. package/dist/textarea/textarea.js +13 -12
  93. package/dist/toast/ds-toast.js +3 -2
  94. package/dist/toast/toast.js +12 -11
  95. package/dist/tooltip/tooltip.js +13 -12
  96. package/dist/utils/utilities.d.ts +3 -0
  97. package/dist/utils/utilities.js +34 -25
  98. package/package.json +6 -4
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import "@ogcio/design-system-react/browser-check";
2
3
  import { jsx as dt } from "react/jsx-runtime";
3
4
  import { useRef as Ee, useEffect as Ae } from "react";
4
5
  import { cn as mt } from "../cn.js";
@@ -904,7 +905,7 @@ function br(e) {
904
905
  var wr = [Xt, sr, Ft, kt, or, er, ur, Wt, rr], xr = /* @__PURE__ */ br({
905
906
  defaultModifiers: wr
906
907
  });
907
- const Dr = ({
908
+ const Br = ({
908
909
  triggerRef: e,
909
910
  children: t,
910
911
  className: r,
@@ -1001,5 +1002,5 @@ const Dr = ({
1001
1002
  ) : null;
1002
1003
  };
1003
1004
  export {
1004
- Dr as Popover
1005
+ Br as Popover
1005
1006
  };
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import "@ogcio/design-system-react/browser-check";
2
3
  import { InputRadioGroup as o } from "../input-radio-group/input-radio-group.js";
3
4
  const p = o;
4
5
  p.displayName = "RadioGroup";
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import "@ogcio/design-system-react/browser-check";
2
3
  import { InputRadio as o } from "../input-radio/input-radio.js";
3
4
  const i = o;
4
5
  i.displayName = "Radio";
@@ -1,11 +1,12 @@
1
1
  "use client";
2
+ import "@ogcio/design-system-react/browser-check";
2
3
  import { jsxs as a, jsx as s, Fragment as F } from "react/jsx-runtime";
3
4
  import { useId as G } from "react";
4
5
  import { ButtonGroup as j, ButtonGroupItem as w } from "../button-group/button-group.js";
5
6
  import { cn as o } from "../cn.js";
6
7
  import { FormField as O, FormFieldLabel as V, FormFieldHint as E } from "../forms/form-field/form-field.js";
7
8
  import { useBreakpoint as H, Breakpoint as $ } from "../hooks/use-breakpoint.js";
8
- const K = ({
9
+ const P = ({
9
10
  name: B,
10
11
  size: x = "medium",
11
12
  orientation: t = "horizontal",
@@ -18,7 +19,7 @@ const K = ({
18
19
  onChange: v,
19
20
  type: f
20
21
  }) => {
21
- const h = G(), b = `${h}-label`, n = d ? `${h}-hint` : void 0, { breakpoint: p } = H(), g = p === $.ExtraSmall || p === $.Small;
22
+ const p = G(), b = `${p}-label`, n = d ? `${p}-hint` : void 0, { breakpoint: h } = H(), g = h === $.ExtraSmall || h === $.Small;
22
23
  let l = [];
23
24
  switch (f) {
24
25
  case "1-5": {
@@ -156,5 +157,5 @@ const K = ({
156
157
  ] });
157
158
  };
158
159
  export {
159
- K as ScoreSelect
160
+ P as ScoreSelect
160
161
  };
@@ -1,5 +1,6 @@
1
1
  "use client";
2
- import { jsxs as v, jsx as n } from "react/jsx-runtime";
2
+ import "@ogcio/design-system-react/browser-check";
3
+ import { jsxs as v, jsx as r } from "react/jsx-runtime";
3
4
  import { forwardRef as F, useState as $, useEffect as R, Children as z, isValidElement as A, cloneElement as h } from "react";
4
5
  import { cn as P } from "../cn.js";
5
6
  import { translate as K } from "../i18n/utility.js";
@@ -7,8 +8,8 @@ import { Icon as q } from "../icon/icon.js";
7
8
  import { InputText as H } from "../input-text/input-text.js";
8
9
  import { Label as J } from "../label/label.js";
9
10
  import { Spinner as Q } from "../spinner/spinner.js";
10
- const re = F(
11
- ({ children: o, className: i, onChange: l, enableSearch: r, isLoading: c, showNoData: d }, g) => {
11
+ const ie = F(
12
+ ({ children: o, className: i, onChange: l, enableSearch: n, isLoading: c, showNoData: d }, g) => {
12
13
  const [s, O] = $(""), [S, w] = $([]);
13
14
  R(() => {
14
15
  const u = z.toArray(o).filter(
@@ -24,7 +25,7 @@ const re = F(
24
25
  if (D.includes(x) || E.includes(x))
25
26
  return h(e, {
26
27
  onChange: l,
27
- enableSearch: r
28
+ enableSearch: n
28
29
  });
29
30
  }
30
31
  break;
@@ -54,11 +55,11 @@ const re = F(
54
55
  }, [o, s, l]);
55
56
  const y = (m) => {
56
57
  O(m.target.value);
57
- }, b = () => c ? /* @__PURE__ */ n("div", { className: "gi-select-menu-loading", children: /* @__PURE__ */ n(Q, { size: "md" }) }) : d ? /* @__PURE__ */ n("div", { className: "gi-select-menu-option-not-found", children: K("autocomplete.noData", {
58
+ }, b = () => c ? /* @__PURE__ */ r("div", { className: "gi-select-menu-loading", children: /* @__PURE__ */ r(Q, { size: "md" }) }) : d ? /* @__PURE__ */ r("div", { className: "gi-select-menu-option-not-found", children: K("autocomplete.noData", {
58
59
  defaultValue: "No data found."
59
- }) }) : /* @__PURE__ */ n("ul", { "aria-label": "options", role: "listbox", children: S });
60
+ }) }) : /* @__PURE__ */ r("ul", { "aria-label": "options", role: "listbox", children: S });
60
61
  return /* @__PURE__ */ v("div", { ref: g, className: P("gi-select-menu-container", i), children: [
61
- r && /* @__PURE__ */ n("div", { className: "gi-select-menu-input-container", children: /* @__PURE__ */ n(
62
+ n && /* @__PURE__ */ r("div", { className: "gi-select-menu-input-container", children: /* @__PURE__ */ r(
62
63
  H,
63
64
  {
64
65
  tabIndex: 0,
@@ -68,14 +69,14 @@ const re = F(
68
69
  value: s
69
70
  }
70
71
  ) }),
71
- /* @__PURE__ */ n("div", { className: "gi-select-menu-option-container", children: b() })
72
+ /* @__PURE__ */ r("div", { className: "gi-select-menu-option-container", children: b() })
72
73
  ] });
73
74
  }
74
75
  ), U = ({
75
76
  children: o,
76
77
  value: i,
77
78
  selected: l,
78
- onChange: r,
79
+ onChange: n,
79
80
  disabled: c,
80
81
  dataTestid: d,
81
82
  className: g,
@@ -86,9 +87,9 @@ const re = F(
86
87
  ...y
87
88
  }) => {
88
89
  const b = (u) => {
89
- (u.key === "Enter" || u.key === " ") && (u.preventDefault(), r == null || r(i));
90
+ (u.key === "Enter" || u.key === " ") && (u.preventDefault(), n == null || n(i));
90
91
  }, m = () => {
91
- c || r == null || r(i);
92
+ c || n == null || n(i);
92
93
  };
93
94
  return s ? null : /* @__PURE__ */ v(
94
95
  "li",
@@ -113,8 +114,8 @@ const re = F(
113
114
  "data-testid": d || `option-${i}`,
114
115
  ...y,
115
116
  children: [
116
- /* @__PURE__ */ n("span", { className: "gi-text-sm", children: o }),
117
- l && /* @__PURE__ */ n(q, { icon: "check" })
117
+ /* @__PURE__ */ r("span", { className: "gi-text-sm", children: o }),
118
+ l && /* @__PURE__ */ r(q, { icon: "check" })
118
119
  ]
119
120
  },
120
121
  `${o}-${i}`
@@ -130,7 +131,7 @@ const W = ({
130
131
  label: i,
131
132
  ...l
132
133
  }) => /* @__PURE__ */ v("div", { ...l, role: "group", className: "gi-px-3", children: [
133
- /* @__PURE__ */ n(J, { text: i, size: "sm", className: "gi-font-bold gi-pb-1" }),
134
+ /* @__PURE__ */ r(J, { text: i, size: "sm", className: "gi-font-bold gi-pb-1" }),
134
135
  o
135
136
  ] });
136
137
  Object.defineProperty(W, "componentType", {
@@ -139,7 +140,7 @@ Object.defineProperty(W, "componentType", {
139
140
  enumerable: !1
140
141
  });
141
142
  export {
142
- re as SelectMenu,
143
+ ie as SelectMenu,
143
144
  W as SelectMenuGroupItem,
144
145
  U as SelectMenuOption
145
146
  };
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import "@ogcio/design-system-react/browser-check";
2
3
  import { jsx as l, jsxs as V } from "react/jsx-runtime";
3
4
  import { forwardRef as W, useRef as b, useState as w, useImperativeHandle as X, Children as k, isValidElement as E, useEffect as M } from "react";
4
5
  import { cn as H } from "../cn.js";
@@ -227,7 +228,7 @@ Object.defineProperty(re, "componentType", {
227
228
  writable: !1,
228
229
  enumerable: !1
229
230
  });
230
- const fe = (S) => {
231
+ const me = (S) => {
231
232
  const { options: p, defaultValue: I, onChange: d, error: g } = S;
232
233
  return /* @__PURE__ */ l(
233
234
  ne,
@@ -245,5 +246,5 @@ export {
245
246
  re as SelectGroupItemNext,
246
247
  q as SelectItemNext,
247
248
  ne as SelectNext,
248
- fe as SelectNextTableCell
249
+ me as SelectNextTableCell
249
250
  };
@@ -1,11 +1,12 @@
1
1
  "use client";
2
+ import "@ogcio/design-system-react/browser-check";
2
3
  import { SelectNative as e } from "./select-native.js";
3
- import { SelectGroupItem as m, SelectItem as r, SelectTableCell as S } from "./select-native.js";
4
+ import { SelectGroupItem as r, SelectItem as p, SelectTableCell as S } from "./select-native.js";
4
5
  const t = e;
5
6
  t.displayName = "Select";
6
7
  export {
7
8
  t as Select,
8
- m as SelectGroupItem,
9
- r as SelectItem,
9
+ r as SelectGroupItem,
10
+ p as SelectItem,
10
11
  S as SelectTableCell
11
12
  };
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import "@ogcio/design-system-react/browser-check";
2
3
  import { jsxs as w, Fragment as V, jsx as s } from "react/jsx-runtime";
3
4
  import f, { memo as B, useEffect as q, useCallback as v, useState as _ } from "react";
4
5
  import { Button as A } from "../button/button.js";
@@ -45,18 +46,18 @@ const j = f.createContext(
45
46
  throw new Error("SideNavItem must be used within a SideNav");
46
47
  const {
47
48
  openItemIds: o,
48
- selectedItemId: S,
49
- setOpenItemIds: p,
49
+ selectedItemId: p,
50
+ setOpenItemIds: S,
50
51
  setSelectedItemId: C,
51
52
  navId: P
52
- } = l, I = o.includes(t), x = S === t;
53
+ } = l, I = o.includes(t), x = p === t;
53
54
  q(() => {
54
- r && p((d) => d.includes(t) ? d : [...d, t]);
55
- }, [r, p, t]);
55
+ r && S((d) => d.includes(t) ? d : [...d, t]);
56
+ }, [r, S, t]);
56
57
  const h = v(() => {
57
58
  const d = I ? o.filter((R) => R !== t) : [...o, t];
58
- p(d);
59
- }, [I, o, p, t]), k = v(() => {
59
+ S(d);
60
+ }, [I, o, S, t]), k = v(() => {
60
61
  C(t);
61
62
  }, [C, t]), E = `${P}-${t}`, O = i && e, b = m !== void 0, D = v(() => {
62
63
  i && e && h(), k();
@@ -139,8 +140,8 @@ const j = f.createContext(
139
140
  const [t, u] = _([]), [m, g] = _(
140
141
  a
141
142
  ), r = f.useId(), l = v(
142
- (S) => {
143
- g(S), e == null || e(S);
143
+ (p) => {
144
+ g(p), e == null || e(p);
144
145
  },
145
146
  [e]
146
147
  ), o = f.useMemo(
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import "@ogcio/design-system-react/browser-check";
2
3
  import { jsx as e, jsxs as i } from "react/jsx-runtime";
3
4
  import { c as o } from "../index-CB-zPpNk.js";
4
5
  import { cn as l } from "../cn.js";
@@ -12,7 +13,7 @@ const c = {
12
13
  size: c
13
14
  }
14
15
  });
15
- function g({
16
+ function f({
16
17
  size: t = "md",
17
18
  inline: s = !1,
18
19
  dataTestid: r
@@ -79,6 +80,6 @@ function g({
79
80
  );
80
81
  }
81
82
  export {
82
- g as Spinner,
83
+ f as Spinner,
83
84
  c as spinnerSizeVariants
84
85
  };
@@ -1,8 +1,9 @@
1
1
  "use client";
2
+ import "@ogcio/design-system-react/browser-check";
2
3
  import { jsx as C, jsxs as h } from "react/jsx-runtime";
3
4
  import { Children as R, Fragment as y, cloneElement as d, isValidElement as X } from "react";
4
- import { cn as c } from "../cn.js";
5
- const p = (l) => typeof l == "string" ? {} : {
5
+ import { cn as p } from "../cn.js";
6
+ const c = (l) => typeof l == "string" ? {} : {
6
7
  isBaseColumn: l.base === "column",
7
8
  isBaseRow: l.base === "row",
8
9
  isXsColumn: l.xs === "column",
@@ -27,8 +28,8 @@ const p = (l) => typeof l == "string" ? {} : {
27
28
  isBaseColumn: s,
28
29
  isBaseRow: g,
29
30
  isXsColumn: e,
30
- isXsRow: u,
31
- isSmColumn: r,
31
+ isXsRow: r,
32
+ isSmColumn: u,
32
33
  isSmRow: m,
33
34
  isMdColumn: x,
34
35
  isMdRow: t,
@@ -38,14 +39,14 @@ const p = (l) => typeof l == "string" ? {} : {
38
39
  isXlRow: n,
39
40
  is2xlColumn: o,
40
41
  is2xlRow: i
41
- } = p(l);
42
+ } = c(l);
42
43
  return {
43
44
  "gi-flex-row": g,
44
45
  "gi-flex-col": s,
45
- "xs:gi-flex-row": u,
46
+ "xs:gi-flex-row": r,
46
47
  "xs:gi-flex-col": e,
47
48
  "sm:gi-flex-row": m,
48
- "sm:gi-flex-col": r,
49
+ "sm:gi-flex-col": u,
49
50
  "md:gi-flex-row": t,
50
51
  "md:gi-flex-col": x,
51
52
  "lg:gi-flex-row": f,
@@ -67,8 +68,8 @@ const p = (l) => typeof l == "string" ? {} : {
67
68
  isBaseColumn: s,
68
69
  isBaseRow: g,
69
70
  isXsColumn: e,
70
- isXsRow: u,
71
- isSmColumn: r,
71
+ isXsRow: r,
72
+ isSmColumn: u,
72
73
  isSmRow: m,
73
74
  isMdColumn: x,
74
75
  isMdRow: t,
@@ -78,7 +79,7 @@ const p = (l) => typeof l == "string" ? {} : {
78
79
  isXlRow: n,
79
80
  is2xlColumn: o,
80
81
  is2xlRow: i
81
- } = p(l);
82
+ } = c(l);
82
83
  return {
83
84
  "gi-w-full": s,
84
85
  "gi-h-[1px]": s,
@@ -86,10 +87,10 @@ const p = (l) => typeof l == "string" ? {} : {
86
87
  "gi-w-[1px]": g,
87
88
  "xs:gi-w-full": e,
88
89
  "xs:gi-h-[1px]": e,
89
- "xs:gi-h-full": u,
90
- "xs:gi-w-[1px]": u,
91
- "sm:gi-w-full": r,
92
- "sm:gi-h-[1px]": r,
90
+ "xs:gi-h-full": r,
91
+ "xs:gi-w-[1px]": r,
92
+ "sm:gi-w-full": u,
93
+ "sm:gi-h-[1px]": u,
93
94
  "sm:gi-h-full": m,
94
95
  "sm:gi-w-[1px]": m,
95
96
  "md:gi-w-full": x,
@@ -132,7 +133,7 @@ const p = (l) => typeof l == "string" ? {} : {
132
133
  return /* @__PURE__ */ C(
133
134
  "div",
134
135
  {
135
- className: `${c(s)} gi-bg-gray-400`,
136
+ className: `${p(s)} gi-bg-gray-400`,
136
137
  "aria-hidden": "true"
137
138
  }
138
139
  );
@@ -141,19 +142,19 @@ const p = (l) => typeof l == "string" ? {} : {
141
142
  direction: s = "column",
142
143
  fixedHeight: g = "100%",
143
144
  gap: e = 0,
144
- hasDivider: u,
145
- itemsAlignment: r = "start",
145
+ hasDivider: r,
146
+ itemsAlignment: u = "start",
146
147
  itemsDistribution: m = "start",
147
148
  wrap: x = !1,
148
149
  className: t,
149
150
  ...w
150
151
  }) => {
151
- const f = c(
152
+ const f = p(
152
153
  t,
153
154
  "gi-flex",
154
155
  "gi-w-full",
155
156
  B(m),
156
- v(r),
157
+ v(u),
157
158
  j(s),
158
159
  L(e),
159
160
  $(x)
@@ -167,7 +168,7 @@ const p = (l) => typeof l == "string" ? {} : {
167
168
  "data-testid": `govie-stack-item-${i}`
168
169
  }
169
170
  ) : o,
170
- u && i < n.length - 1 && /* @__PURE__ */ C(M, { direction: s })
171
+ r && i < n.length - 1 && /* @__PURE__ */ C(M, { direction: s })
171
172
  ] }, `item_${i}`));
172
173
  })() });
173
174
  };