@ogcio/design-system-react 1.22.1 → 1.24.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 (95) hide show
  1. package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
  2. package/dist/accordion/accordion-item.d.ts +3 -5
  3. package/dist/accordion/accordion-item.js +32 -28
  4. package/dist/accordion/accordion.d.ts +3 -5
  5. package/dist/accordion/accordion.js +22 -33
  6. package/dist/alert/alert.js +19 -20
  7. package/dist/autocomplete/autocomplete.js +167 -169
  8. package/dist/autocomplete/use-autocomplete-controller.js +1 -1
  9. package/dist/browser-support/runtime.js +2 -3
  10. package/dist/button/button.js +11 -12
  11. package/dist/button-group/button-group.js +4 -5
  12. package/dist/card/card-next.js +122 -125
  13. package/dist/card/card.js +4 -5
  14. package/dist/checkbox/checkbox-group.js +3 -4
  15. package/dist/checkbox/checkbox.js +4 -5
  16. package/dist/chip/chip.js +11 -12
  17. package/dist/clsx-OuTLNxxd.js +16 -0
  18. package/dist/cn.js +4 -16
  19. package/dist/combo-box/dropdown-item.js +2 -3
  20. package/dist/cookie-banner/cookie-banner.js +6 -7
  21. package/dist/data-table/editable-table-cell.js +3 -4
  22. package/dist/data-table/index.d.ts +7 -0
  23. package/dist/data-table/index.js +20 -0
  24. package/dist/details/details.js +6 -7
  25. package/dist/drawer/drawer.js +18 -19
  26. package/dist/footer/footer.js +2 -3
  27. package/dist/forms/form-field/form-field.js +2 -3
  28. package/dist/header/components/header-menu.js +17 -18
  29. package/dist/header/header-legacy.js +2 -3
  30. package/dist/header/header-next/components/header-logo.js +3 -4
  31. package/dist/header/header-next/components/header-title.js +0 -1
  32. package/dist/header/header-next/components/menu/components/header-menu-item-button.js +4 -5
  33. package/dist/header/header-next/components/menu/components/header-menu-item-link.js +0 -1
  34. package/dist/header/header-next/components/menu/components/header-menu-item-separator.js +4 -5
  35. package/dist/header/header-next/components/menu/components/header-menu-item-slot.js +0 -1
  36. package/dist/header/header-next/components/menu/header-menu-context.js +9 -10
  37. package/dist/header/header-next/components/menu/header-primary-menu.js +4 -5
  38. package/dist/header/header-next/components/menu/header-secondary-menu.js +0 -1
  39. package/dist/header/header-next/header-context.js +4 -5
  40. package/dist/header/header-next/header-next.js +2 -3
  41. package/dist/hooks/use-breakpoint.js +7 -8
  42. package/dist/hooks/use-toggle-map.js +12 -13
  43. package/dist/i18n/config.d.ts +1 -1
  44. package/dist/i18n/config.js +14 -11
  45. package/dist/i18n/utility.js +1 -1
  46. package/dist/i18nInstance-D_96ADqd.js +48 -0
  47. package/dist/i18next-B_GQfCrJ.js +1362 -0
  48. package/dist/icon/icon.d.ts +16 -4
  49. package/dist/icon/icon.js +79 -167
  50. package/dist/icon-button/icon-button.js +4 -5
  51. package/dist/index.d.ts +2 -5
  52. package/dist/index.js +231 -220
  53. package/dist/input-checkbox/input-checkbox.js +15 -16
  54. package/dist/input-checkbox-group/input-checkbox-group.js +9 -10
  55. package/dist/input-password/input-password.js +0 -1
  56. package/dist/input-radio/input-radio.js +11 -12
  57. package/dist/input-radio-group/input-radio-group.js +8 -9
  58. package/dist/input-text/input-text.js +2 -3
  59. package/dist/{lodash-D1c5hFAM.js → lodash-LsP9-6SV.js} +1343 -1342
  60. package/dist/modal/modal.js +4 -5
  61. package/dist/pagination/pagination.js +713 -58
  62. package/dist/phase-banner/phase-banner.js +2 -3
  63. package/dist/popover/popover.js +2 -3
  64. package/dist/radio/radio-group.js +0 -1
  65. package/dist/radio/radio.js +0 -1
  66. package/dist/score-select/score-select.js +3 -4
  67. package/dist/select/select-menu.js +43 -41
  68. package/dist/select/select-next.js +193 -161
  69. package/dist/select/select.js +3 -4
  70. package/dist/side-nav/side-nav.js +9 -10
  71. package/dist/spinner/spinner.js +2 -3
  72. package/dist/stack/stack.js +20 -21
  73. package/dist/styles.css +1 -1
  74. package/dist/summary-list/summary-list-action.js +6 -7
  75. package/dist/summary-list/summary-list-context.js +4 -5
  76. package/dist/summary-list/summary-list-header.js +12 -13
  77. package/dist/summary-list/summary-list-row.js +17 -18
  78. package/dist/summary-list/summary-list-value.js +0 -1
  79. package/dist/summary-list/summary-list.js +4 -5
  80. package/dist/table/table-data.js +11 -12
  81. package/dist/table/table-header.js +2 -3
  82. package/dist/tabs/tab-item.d.ts +1 -1
  83. package/dist/tabs/tab-item.js +0 -1
  84. package/dist/tabs/tab-list.js +23 -24
  85. package/dist/tag/tag.d.ts +9 -3
  86. package/dist/tag/tag.js +35 -18
  87. package/dist/text-input/text-input.js +0 -1
  88. package/dist/textarea/textarea.js +12 -13
  89. package/dist/toast/ds-toast.js +10 -11
  90. package/dist/toast/toast.js +15 -16
  91. package/dist/tooltip/tooltip.js +12 -13
  92. package/dist/utilities.d.ts +4 -1
  93. package/dist/utilities.js +29 -16
  94. package/package.json +6 -5
  95. package/dist/i18next-DxWa09nx.js +0 -1395
@@ -1,11 +1,10 @@
1
1
  "use client";
2
- import "@ogcio/design-system-react/browser-check";
3
2
  import { jsx as r, Fragment as T } from "react/jsx-runtime";
4
- import { useState as d, useEffect as u } from "react";
3
+ import { useState as i, useEffect as u } from "react";
5
4
  import { createPortal as $ } from "react-dom";
6
5
  import { cn as b } from "../cn.js";
7
- import { translate as p } from "../i18n/utility.js";
8
- import { Toast as w } from "./ds-toast.js";
6
+ import { translate as w } from "../i18n/utility.js";
7
+ import { Toast as p } from "./ds-toast.js";
9
8
  const E = [
10
9
  { x: "left", y: "top" },
11
10
  { x: "left", y: "bottom" },
@@ -15,8 +14,8 @@ const E = [
15
14
  { x: "right", y: "bottom" }
16
15
  ], f = {
17
16
  isMounted: !1
18
- }, L = () => {
19
- const [e, o] = d([]), [n, c] = d(!1);
17
+ }, I = () => {
18
+ const [e, o] = i([]), [n, c] = i(!1);
20
19
  return u(() => {
21
20
  c(!0);
22
21
  const t = (l) => {
@@ -32,8 +31,8 @@ const E = [
32
31
  }, []), n ? /* @__PURE__ */ r(T, { children: E.map((t) => {
33
32
  const l = e.filter(
34
33
  (a) => {
35
- var s, i;
36
- return ((s = a.position) == null ? void 0 : s.x) === t.x && ((i = a.position) == null ? void 0 : i.y) === t.y;
34
+ var s, d;
35
+ return ((s = a.position) == null ? void 0 : s.x) === t.x && ((d = a.position) == null ? void 0 : d.y) === t.y;
37
36
  }
38
37
  );
39
38
  return $(
@@ -42,7 +41,7 @@ const E = [
42
41
  {
43
42
  id: `toast-portal-${t.x}-${t.y}`,
44
43
  role: "region",
45
- "aria-label": p("toast.position", {
44
+ "aria-label": w("toast.position", {
46
45
  x: t.x,
47
46
  y: t.y,
48
47
  defaultValue: `Toasts-${t.y}-${t.x}`
@@ -56,7 +55,7 @@ const E = [
56
55
  document.body
57
56
  );
58
57
  }) }) : null;
59
- }, j = {
58
+ }, L = {
60
59
  create: ({ position: e, ...o }) => {
61
60
  if (f.isMounted) {
62
61
  const n = new CustomEvent("govie:add-toast", {
@@ -81,10 +80,10 @@ const E = [
81
80
  duration: l = 5e3,
82
81
  animation: a = "fadeinup",
83
82
  showIcon: s = !0,
84
- slotAction: i,
83
+ slotAction: d,
85
84
  ...g
86
85
  }) => {
87
- const [m, x] = d(!0), [y, h] = d(!1);
86
+ const [m, x] = i(!0), [y, h] = i(!1);
88
87
  u(() => {
89
88
  setTimeout(() => {
90
89
  v();
@@ -109,7 +108,7 @@ const E = [
109
108
  "aria-label": o,
110
109
  ...g,
111
110
  children: /* @__PURE__ */ r("div", { className: "gi-wrapper", children: /* @__PURE__ */ r("div", { className: "gi-message", children: /* @__PURE__ */ r(
112
- w,
111
+ p,
113
112
  {
114
113
  onClose: v,
115
114
  title: o,
@@ -117,7 +116,7 @@ const E = [
117
116
  variant: e,
118
117
  description: n,
119
118
  dismissible: t,
120
- slotAction: i,
119
+ slotAction: d,
121
120
  showIcon: s
122
121
  }
123
122
  ) }) })
@@ -126,6 +125,6 @@ const E = [
126
125
  };
127
126
  export {
128
127
  C as Toast,
129
- L as ToastProvider,
130
- j as toaster
128
+ I as ToastProvider,
129
+ L as toaster
131
130
  };
@@ -1,9 +1,8 @@
1
1
  "use client";
2
- import "@ogcio/design-system-react/browser-check";
3
2
  import { jsxs as b, jsx as g } from "react/jsx-runtime";
4
- import { useState as c, useId as h, useCallback as p, useEffect as v } from "react";
3
+ import { useState as c, useId as h, useCallback as d, useEffect as v } from "react";
5
4
  import { c as y } from "../index-CB-zPpNk.js";
6
- const F = ["top", "bottom", "left", "right"], E = y({
5
+ const T = ["top", "bottom", "left", "right"], E = y({
7
6
  base: "gi-tooltip",
8
7
  variants: {
9
8
  position: {
@@ -13,17 +12,17 @@ const F = ["top", "bottom", "left", "right"], E = y({
13
12
  bottom: "gi-tooltip-bottom"
14
13
  }
15
14
  }
16
- }), L = ({
15
+ }), F = ({
17
16
  text: o,
18
17
  position: i = "top",
19
- dataTestid: d,
18
+ dataTestid: p,
20
19
  children: u
21
20
  }) => {
22
- const [e, n] = c(!1), [m, a] = c(!1), l = h(), r = () => n(!0), t = p(() => {
21
+ const [e, n] = c(!1), [f, a] = c(!1), l = h(), r = () => n(!0), t = d(() => {
23
22
  n(!1), a(!1);
24
- }, []), s = p(
25
- (f) => {
26
- f.key === "Escape" && t();
23
+ }, []), s = d(
24
+ (m) => {
25
+ m.key === "Escape" && t();
27
26
  },
28
27
  [t]
29
28
  );
@@ -35,7 +34,7 @@ const F = ["top", "bottom", "left", "right"], E = y({
35
34
  className: "gi-tooltip-wrapper",
36
35
  onMouseEnter: r,
37
36
  onMouseLeave: () => {
38
- m || t();
37
+ f || t();
39
38
  },
40
39
  onFocus: () => {
41
40
  a(!0), r();
@@ -44,7 +43,7 @@ const F = ["top", "bottom", "left", "right"], E = y({
44
43
  t();
45
44
  },
46
45
  "aria-describedby": e ? l : void 0,
47
- "data-testid": d,
46
+ "data-testid": p,
48
47
  children: [
49
48
  u,
50
49
  e && /* @__PURE__ */ g(
@@ -63,6 +62,6 @@ const F = ["top", "bottom", "left", "right"], E = y({
63
62
  );
64
63
  };
65
64
  export {
66
- L as Tooltip,
67
- F as positionVariants
65
+ F as Tooltip,
66
+ T as positionVariants
68
67
  };
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { ReactElement, ReactNode } from 'react';
2
2
  /**
3
3
  * Returns a safe for url string representation.
4
4
  *
@@ -10,3 +10,6 @@ export declare function slugify(value?: string): string | undefined;
10
10
  export declare function generateRandomId(): string;
11
11
  export declare function getSpecialComponentType(child: ReactNode): string | null;
12
12
  export declare function isSpecialComponent(child: ReactNode, componentList?: Array<string>): boolean;
13
+ export declare const cycleEnabledIndex: (list: ReactElement<{
14
+ hidden?: boolean;
15
+ }>[], currentIndex: number, direction: 1 | -1) => number;
package/dist/utilities.js CHANGED
@@ -1,23 +1,36 @@
1
- import { isValidElement as r } from "react";
2
- function p(n) {
3
- if (!n)
4
- return n;
5
- let e = n.replaceAll(/^\s+|\s+$/g, "");
6
- return e = e.toLowerCase(), e = e.replaceAll(/[^\d a-z-]/g, "").replaceAll(/\s+/g, "-").replaceAll(/-+/g, "-"), e;
1
+ import { isValidElement as u } from "react";
2
+ function f(e) {
3
+ if (!e)
4
+ return e;
5
+ let n = e.replaceAll(/^\s+|\s+$/g, "");
6
+ return n = n.toLowerCase(), n = n.replaceAll(/[^\d a-z-]/g, "").replaceAll(/\s+/g, "-").replaceAll(/-+/g, "-"), n;
7
7
  }
8
- function i() {
8
+ function s() {
9
9
  return Math.random().toString(36).slice(2, 11);
10
10
  }
11
- function l(n) {
12
- var e, t;
13
- return r(n) && (((e = n.type) == null ? void 0 : e.componentType) || ((t = n.props) == null ? void 0 : t.__type)) || null;
11
+ function a(e) {
12
+ var n, r;
13
+ return u(e) && (((n = e.type) == null ? void 0 : n.componentType) || ((r = e.props) == null ? void 0 : r.__type)) || null;
14
14
  }
15
- function u(n, e = []) {
16
- return e.includes(l(n) ?? "");
15
+ function g(e, n = []) {
16
+ return n.includes(a(e) ?? "");
17
17
  }
18
+ const d = (e, n, r) => {
19
+ var l, p;
20
+ const t = e.length;
21
+ if (t === 0)
22
+ return -1;
23
+ for (let o = 1; o <= t; o++) {
24
+ const c = (n + r * o) % t;
25
+ if (!((p = (l = e == null ? void 0 : e.at(c)) == null ? void 0 : l.props) != null && p.hidden))
26
+ return (c + t) % t;
27
+ }
28
+ return -1;
29
+ };
18
30
  export {
19
- i as generateRandomId,
20
- l as getSpecialComponentType,
21
- u as isSpecialComponent,
22
- p as slugify
31
+ d as cycleEnabledIndex,
32
+ s as generateRandomId,
33
+ a as getSpecialComponentType,
34
+ g as isSpecialComponent,
35
+ f as slugify
23
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ogcio/design-system-react",
3
- "version": "1.22.1",
3
+ "version": "1.24.0",
4
4
  "description": "The GOV IE design system React components.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -33,6 +33,7 @@
33
33
  "@popperjs/core": "^2.11.8",
34
34
  "@radix-ui/react-slot": "^1.1.2",
35
35
  "clsx": "^2.1.1",
36
+ "react-i18next": "^16.3.3",
36
37
  "rollup-preserve-directives": "^1.1.2"
37
38
  },
38
39
  "devDependencies": {
@@ -47,16 +48,16 @@
47
48
  "eslint": "^9.23.0",
48
49
  "eslint-plugin-storybook": "^0.12.0",
49
50
  "glob": "^11.0.1",
50
- "i18next": "^24.2.2",
51
+ "i18next": "^25.6.2",
51
52
  "postcss": "^8.4.40",
52
53
  "postcss-import": "^16.1.0",
53
54
  "react": "19.0.0",
54
55
  "react-dom": "19.0.0",
55
56
  "@ogcio/design-system-eslint-config": "1.2.6",
56
57
  "@ogcio/design-system-prettier-config": "1.0.6",
57
- "@ogcio/design-system-tailwind": "1.18.0",
58
- "@ogcio/theme-govie": "1.18.0",
59
- "@ogcio/theme-doete": "1.0.0"
58
+ "@ogcio/design-system-tailwind": "1.20.0",
59
+ "@ogcio/theme-doete": "1.0.0",
60
+ "@ogcio/theme-govie": "1.20.0"
60
61
  },
61
62
  "scripts": {
62
63
  "format": "prettier 'src/**/*.{ts,tsx}' --write",