@ogcio/design-system-react 1.16.0 → 1.17.1

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 (38) hide show
  1. package/dist/accordion/accordion-item.js +0 -1
  2. package/dist/alert/alert.d.ts +2 -1
  3. package/dist/alert/alert.js +32 -31
  4. package/dist/autocomplete/use-autocomplete-controller.js +55 -54
  5. package/dist/breadcrumbs/breadcrumbs.js +29 -23
  6. package/dist/card/card-next.js +1 -1
  7. package/dist/data-table/data-table-footer.d.ts +12 -0
  8. package/dist/data-table/data-table-footer.js +66 -0
  9. package/dist/data-table/data-table-header.d.ts +28 -0
  10. package/dist/data-table/data-table-header.js +157 -0
  11. package/dist/data-table/data-table-selected-rows.d.ts +6 -0
  12. package/dist/data-table/data-table-selected-rows.js +23 -0
  13. package/dist/{data-grid → data-table}/tanstack/tanstack-helpers.d.ts +1 -0
  14. package/dist/{data-grid → data-table}/tanstack/tanstack-helpers.js +27 -25
  15. package/dist/drawer/drawer.js +19 -12
  16. package/dist/forms/form-field/form-field.js +18 -18
  17. package/dist/header/components/header-menu.js +26 -27
  18. package/dist/icon-button/icon-button.js +18 -16
  19. package/dist/index.d.ts +4 -4
  20. package/dist/index.js +43 -43
  21. package/dist/input-radio/input-radio.js +31 -31
  22. package/dist/modal/modal.d.ts +2 -1
  23. package/dist/modal/modal.js +162 -149
  24. package/dist/popover/popover.js +10 -1
  25. package/dist/select/select-menu.js +27 -27
  26. package/dist/styles.css +1 -1
  27. package/dist/table/table-pagination.js +2 -2
  28. package/dist/utils/utilities.d.ts +2 -0
  29. package/dist/utils/utilities.js +26 -15
  30. package/package.json +4 -4
  31. package/dist/data-grid/data-grid-footer.d.ts +0 -12
  32. package/dist/data-grid/data-grid-footer.js +0 -66
  33. package/dist/data-grid/data-grid-header.d.ts +0 -12
  34. package/dist/data-grid/data-grid-header.js +0 -82
  35. /package/dist/{data-grid → data-table}/editable-table-cell.d.ts +0 -0
  36. /package/dist/{data-grid → data-table}/editable-table-cell.js +0 -0
  37. /package/dist/{data-grid → data-table}/types.d.ts +0 -0
  38. /package/dist/{data-grid → data-table}/types.js +0 -0
@@ -33,7 +33,7 @@ const j = ({
33
33
  onClick: () => e(1),
34
34
  appearance: "dark",
35
35
  variant: "flat",
36
- className: "gi-mr-4",
36
+ className: "gi-mr-2",
37
37
  icon: {
38
38
  icon: "first_page"
39
39
  }
@@ -98,7 +98,7 @@ const j = ({
98
98
  onClick: () => e(l),
99
99
  appearance: "dark",
100
100
  variant: "flat",
101
- className: "gi-ml-4",
101
+ className: "gi-ml-2",
102
102
  icon: {
103
103
  icon: "last_page"
104
104
  }
@@ -21,4 +21,6 @@ type DisplayPage = number | -1 | -2;
21
21
  * - For `currentPage = 3`, `totalPages = 3`, and `breakpoint = SM`, the output would be `[1, 2, 3]`.
22
22
  */
23
23
  export declare const getDisplayPages: (currentPage: number, totalPages: number, breakpoint: BreakpointType) => DisplayPage[];
24
+ export declare const safeCloneElement: (element: React.ReactElement, props?: Record<string, any>) => import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>>;
25
+ export declare const splitAriaProps: (props?: any) => readonly [Record<string, unknown>, Record<string, unknown>];
24
26
  export {};
@@ -1,20 +1,31 @@
1
- import { Breakpoint as u } from "../hooks/use-breakpoint.js";
2
- const x = (p, f, d) => {
3
- if (d === u.Small || d === u.Medium) {
4
- const i = [];
5
- if (f <= 3) {
6
- for (let s = 1; s <= f; s++)
7
- i.push(s);
8
- return i;
1
+ import { cloneElement as d } from "react";
2
+ import { Breakpoint as n } from "../hooks/use-breakpoint.js";
3
+ const r = (i, s, h) => {
4
+ if (h === n.Small || h === n.Medium) {
5
+ const f = [];
6
+ if (s <= 3) {
7
+ for (let o = 1; o <= s; o++)
8
+ f.push(o);
9
+ return f;
9
10
  }
10
- return i.push(1), p > 2 && i.push(-1), p > 1 && p < f && i.push(p), p < f - 1 && i.push(-2), f > 1 && i.push(f), i;
11
+ return f.push(1), i > 2 && f.push(-1), i > 1 && i < s && f.push(i), i < s - 1 && f.push(-2), s > 1 && f.push(s), f;
11
12
  }
12
- const h = [];
13
- p > 3 && h.push(1), p > 4 && h.push(-1);
14
- for (let i = p - 2; i <= p + 2; i++)
15
- i >= 1 && i <= f && h.push(i);
16
- return p < f - 3 && h.push(-2), p < f - 2 && h.push(f), h;
13
+ const p = [];
14
+ i > 3 && p.push(1), i > 4 && p.push(-1);
15
+ for (let f = i - 2; f <= i + 2; f++)
16
+ f >= 1 && f <= s && p.push(f);
17
+ return i < s - 3 && p.push(-2), i < s - 2 && p.push(s), p;
18
+ }, y = (i, s = {}) => {
19
+ const { __type: h, ...p } = i.props;
20
+ return d(i, { ...p, ...s });
21
+ }, l = (i = {}) => {
22
+ const s = {}, h = {};
23
+ for (const p in i)
24
+ p === "role" || p.startsWith("aria-") ? s[p] = i[p] : h[p] = i[p];
25
+ return [s, h];
17
26
  };
18
27
  export {
19
- x as getDisplayPages
28
+ r as getDisplayPages,
29
+ y as safeCloneElement,
30
+ l as splitAriaProps
20
31
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ogcio/design-system-react",
3
- "version": "1.16.0",
3
+ "version": "1.17.1",
4
4
  "description": "The GOV IE design system React components.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -52,7 +52,7 @@
52
52
  "react-dom": "19.0.0",
53
53
  "@ogcio/design-system-eslint-config": "1.2.6",
54
54
  "@ogcio/design-system-prettier-config": "1.0.6",
55
- "@ogcio/design-system-tailwind": "1.14.0",
55
+ "@ogcio/design-system-tailwind": "1.14.2",
56
56
  "@ogcio/theme-doete": "1.0.0",
57
57
  "@ogcio/theme-govie": "1.7.0"
58
58
  },
@@ -68,8 +68,8 @@
68
68
  "build:ts": "vite build",
69
69
  "storybook:dev": "storybook dev -p 6006",
70
70
  "storybook:build": "storybook build --stats-json",
71
- "storybook:test": "vitest --project=storybook",
72
- "storybook:coverage": "vitest --project=storybook --coverage",
71
+ "playwright:test": "playwright test",
72
+ "playwright:update-snapshots": "playwright test --update-snapshots",
73
73
  "percy": "pnpm storybook:build && percy storybook ./storybook-static --config percy.yaml",
74
74
  "typecheck": "tsc -p tsconfig.json --noEmit"
75
75
  }
@@ -1,12 +0,0 @@
1
- import { default as React } from 'react';
2
- interface DataGridFooterTypeProps extends React.HTMLAttributes<HTMLDivElement> {
3
- children: React.ReactNode;
4
- }
5
- interface DataGridFooterProps extends React.HTMLAttributes<HTMLDivElement> {
6
- children?: React.ReactNode;
7
- }
8
- export type { DataGridFooterProps, DataGridFooterTypeProps };
9
- export declare const DataGridFooterStart: React.FC<DataGridFooterTypeProps>;
10
- export declare const DataGridFooterCenter: React.FC<DataGridFooterTypeProps>;
11
- export declare const DataGridFooterEnd: React.FC<DataGridFooterTypeProps>;
12
- export declare const DataGridFooter: React.FC<DataGridFooterProps>;
@@ -1,66 +0,0 @@
1
- import { jsx as s, jsxs as E } from "react/jsx-runtime";
2
- import i from "react";
3
- import { cn as l } from "../cn.js";
4
- const n = (t, e) => i.isValidElement(t) && t.type === e, o = (t, e, a) => t ? /* @__PURE__ */ s(
5
- "div",
6
- {
7
- className: l(
8
- e,
9
- a,
10
- t.props.className
11
- ),
12
- style: t.props.style,
13
- children: t.props.children
14
- }
15
- ) : null, F = ({
16
- children: t,
17
- ...e
18
- }) => /* @__PURE__ */ s("div", { ...e, children: t });
19
- F.displayName = "DataGridFooterStart";
20
- const D = ({
21
- children: t,
22
- ...e
23
- }) => /* @__PURE__ */ s("div", { ...e, children: t });
24
- D.displayName = "DataGridFooterCenter";
25
- const G = ({
26
- children: t,
27
- ...e
28
- }) => /* @__PURE__ */ s("div", { ...e, children: t });
29
- G.displayName = "DataGridFooterEnd";
30
- const N = ({
31
- children: t,
32
- className: e,
33
- ...a
34
- }) => {
35
- const C = i.useMemo(() => {
36
- let f = null, u = null, y = null;
37
- return i.Children.forEach(t, (r) => {
38
- n(r, F) ? f = r : n(r, D) ? u = r : n(r, G) && (y = r);
39
- }), { start: f, center: u, end: y };
40
- }, [t]), { start: d, center: c, end: m } = C, p = !!!d && !!!c && !!m, g = "gi-grow gi-basis-0 gi-min-w-0", S = `${g} gi-text-center`, x = l("gi-min-w-0", {
41
- "gi-basis-1/2 gi-text-right": !p
42
- });
43
- return /* @__PURE__ */ E(
44
- "div",
45
- {
46
- ...a,
47
- className: l(
48
- "gi-flex gi-flex-row gi-w-full gi-items-center gi-py-2",
49
- p ? "gi-justify-end" : "gi-gap-2",
50
- e
51
- ),
52
- children: [
53
- o(d, g),
54
- o(c, S),
55
- o(m, x)
56
- ]
57
- }
58
- );
59
- };
60
- N.displayName = "DataGridFooter";
61
- export {
62
- N as DataGridFooter,
63
- D as DataGridFooterCenter,
64
- G as DataGridFooterEnd,
65
- F as DataGridFooterStart
66
- };
@@ -1,12 +0,0 @@
1
- import { default as React } from 'react';
2
- interface DataGridHeaderTypeProps extends React.HTMLAttributes<HTMLDivElement> {
3
- children: React.ReactNode;
4
- }
5
- interface DataGridHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
6
- children?: React.ReactNode;
7
- }
8
- export declare const DataGridHeader: React.FC<DataGridHeaderProps>;
9
- export declare const DataGridHeaderSearch: React.FC<DataGridHeaderTypeProps>;
10
- export declare const DataGridHeaderFilter: React.FC<DataGridHeaderTypeProps>;
11
- export declare const DataGridHeaderActions: React.FC<DataGridHeaderTypeProps>;
12
- export {};
@@ -1,82 +0,0 @@
1
- import { jsxs as D, jsx as n } from "react/jsx-runtime";
2
- import s from "react";
3
- import { cn as i } from "../cn.js";
4
- const l = (e, a) => s.isValidElement(e) && e.type === a, u = ({
5
- children: e,
6
- className: a,
7
- ...r
8
- }) => {
9
- const { search: g, filter: b, actions: y } = s.useMemo(() => {
10
- let f = null, m = null, p = null;
11
- return s.Children.forEach(e, (t) => {
12
- l(t, o) ? f = t : l(t, d) ? m = t : l(t, c) && (p = t);
13
- }), { search: f, filter: m, actions: p };
14
- }, [e]);
15
- return /* @__PURE__ */ D(
16
- "div",
17
- {
18
- ...r,
19
- className: i(
20
- "gi-flex gi-flex-wrap gi-items-center gi-w-full gi-gap-4 gi-mb-2",
21
- a
22
- ),
23
- children: [
24
- g,
25
- b,
26
- y
27
- ]
28
- }
29
- );
30
- };
31
- u.displayName = "DataGridHeader";
32
- Object.defineProperty(u, "componentType", {
33
- value: "DataGridHeader",
34
- writable: !1,
35
- enumerable: !1
36
- });
37
- const o = ({
38
- children: e,
39
- className: a,
40
- ...r
41
- }) => /* @__PURE__ */ n("div", { className: i("gi-flex gi-flex-1", a), ...r, children: e });
42
- o.displayName = "DataGridHeaderSearch";
43
- Object.defineProperty(o, "componentType", {
44
- value: "DataGridHeaderSearch",
45
- writable: !1,
46
- enumerable: !1
47
- });
48
- const d = ({
49
- children: e,
50
- className: a,
51
- ...r
52
- }) => /* @__PURE__ */ n("div", { className: i("gi-flex gi-items-center", a), ...r, children: e });
53
- d.displayName = "DataGridHeaderFilter";
54
- Object.defineProperty(d, "componentType", {
55
- value: "DataGridHeaderFilter",
56
- writable: !1,
57
- enumerable: !1
58
- });
59
- const c = ({
60
- children: e,
61
- className: a,
62
- ...r
63
- }) => /* @__PURE__ */ n(
64
- "div",
65
- {
66
- className: i("gi-flex gi-items-center gi-ml-auto", a),
67
- ...r,
68
- children: e
69
- }
70
- );
71
- c.displayName = "DataGridHeaderActions";
72
- Object.defineProperty(c, "componentType", {
73
- value: "DataGridHeaderActions",
74
- writable: !1,
75
- enumerable: !1
76
- });
77
- export {
78
- u as DataGridHeader,
79
- c as DataGridHeaderActions,
80
- d as DataGridHeaderFilter,
81
- o as DataGridHeaderSearch
82
- };
File without changes
File without changes