@ogcio/design-system-react 1.17.2 → 1.18.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.
- package/dist/button-group/button-group.d.ts +2 -20
- package/dist/button-group/button-group.js +51 -45
- package/dist/button-group/types.d.ts +29 -0
- package/dist/button-group/types.js +1 -0
- package/dist/data-table/data-table-footer.d.ts +2 -1
- package/dist/data-table/data-table-footer.js +38 -38
- package/dist/data-table/data-table-header.d.ts +3 -3
- package/dist/data-table/data-table-header.js +73 -76
- package/dist/header/components/header-menu.d.ts +1 -2
- package/dist/header/components/header-menu.js +42 -73
- package/dist/header/components/header-slot.js +19 -19
- package/dist/header/types.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/input-text/input-text.js +11 -10
- package/dist/score-select/score-select.js +94 -54
- package/dist/score-select/type.d.ts +4 -0
- package/dist/styles.css +1 -1
- package/dist/table/table-data.d.ts +3 -1
- package/dist/table/table-data.js +39 -37
- package/dist/table/table-header.d.ts +3 -1
- package/dist/table/table-header.js +31 -29
- package/dist/table/table-pagination.js +38 -38
- package/package.json +3 -3
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { TdHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { TableAlign, VerticalAlign } from './table.js';
|
|
3
|
+
type TableDataSize = 'xs-fixed' | 'sm-fixed' | 'md-fixed' | 'lg-flex' | 'fluid';
|
|
3
4
|
interface TableDataProps extends TdHTMLAttributes<HTMLTableCellElement> {
|
|
4
5
|
align?: TableAlign;
|
|
5
6
|
valign?: VerticalAlign;
|
|
6
7
|
tableCellClassName?: string;
|
|
8
|
+
size?: TableDataSize;
|
|
7
9
|
children: any;
|
|
8
10
|
}
|
|
9
11
|
type TableCellProps = {
|
|
@@ -15,7 +17,7 @@ type TableExpandIconProps = {
|
|
|
15
17
|
onClick: any;
|
|
16
18
|
};
|
|
17
19
|
type TableDataSlotProps = Omit<TableDataProps, 'align' | 'valign'>;
|
|
18
|
-
export declare function TableData({ align, valign, className, children, tableCellClassName, ...props }: TableDataProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function TableData({ align, valign, size, className, children, tableCellClassName, ...props }: TableDataProps): import("react/jsx-runtime").JSX.Element;
|
|
19
21
|
export declare const TableCell: ({ children, className }: TableCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
22
|
export declare const TableExpandIcon: ({ expanded, onClick, }: TableExpandIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
23
|
export declare const TableDataSlot: ({ children, className, ...props }: TableDataSlotProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/table/table-data.js
CHANGED
|
@@ -1,56 +1,58 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { IconButton as
|
|
6
|
-
function
|
|
3
|
+
import { useRef as g, useState as u, useEffect as f } from "react";
|
|
4
|
+
import { cn as m } from "../cn.js";
|
|
5
|
+
import { IconButton as v } from "../icon-button/icon-button.js";
|
|
6
|
+
function S({
|
|
7
7
|
align: t = "left",
|
|
8
8
|
valign: e = "middle",
|
|
9
|
-
|
|
9
|
+
size: l,
|
|
10
|
+
className: s,
|
|
10
11
|
children: o,
|
|
11
|
-
tableCellClassName:
|
|
12
|
-
...
|
|
12
|
+
tableCellClassName: d,
|
|
13
|
+
...a
|
|
13
14
|
}) {
|
|
14
|
-
const
|
|
15
|
+
const r = {
|
|
15
16
|
left: "gi-text-left",
|
|
16
17
|
center: "gi-text-center",
|
|
17
18
|
right: "gi-text-right"
|
|
18
|
-
}[t],
|
|
19
|
+
}[t], i = {
|
|
19
20
|
top: "gi-align-top",
|
|
20
21
|
middle: "gi-align-middle",
|
|
21
22
|
bottom: "gi-align-bottom"
|
|
22
|
-
}[e], l =
|
|
23
|
-
return
|
|
24
|
-
if (!
|
|
23
|
+
}[e], p = l ? `gi-table-td-${l}` : void 0, c = g(null), [b, w] = u(!1);
|
|
24
|
+
return f(() => {
|
|
25
|
+
if (!c.current)
|
|
25
26
|
return;
|
|
26
|
-
const
|
|
27
|
-
|
|
27
|
+
const x = c.current.querySelectorAll("input, select, button");
|
|
28
|
+
w(x.length > 0);
|
|
28
29
|
}, []), /* @__PURE__ */ n(
|
|
29
30
|
"td",
|
|
30
31
|
{
|
|
31
|
-
ref:
|
|
32
|
-
className:
|
|
32
|
+
ref: c,
|
|
33
|
+
className: m(
|
|
33
34
|
"gi-table-td",
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
p,
|
|
36
|
+
r,
|
|
37
|
+
i,
|
|
38
|
+
s
|
|
37
39
|
),
|
|
38
|
-
...
|
|
39
|
-
children:
|
|
40
|
+
...a,
|
|
41
|
+
children: b ? o : /* @__PURE__ */ n(z, { className: d, children: o })
|
|
40
42
|
}
|
|
41
43
|
);
|
|
42
44
|
}
|
|
43
|
-
const
|
|
45
|
+
const z = ({ children: t, className: e }) => /* @__PURE__ */ n("div", { className: m("gi-table-data-cell", e), children: t }), k = ({
|
|
44
46
|
expanded: t,
|
|
45
47
|
onClick: e
|
|
46
48
|
}) => {
|
|
47
|
-
const [
|
|
48
|
-
return
|
|
49
|
-
var
|
|
50
|
-
const a = (
|
|
51
|
-
|
|
52
|
-
}, []), /* @__PURE__ */ n("div", { ref:
|
|
53
|
-
|
|
49
|
+
const [l, s] = u("md"), o = g(null);
|
|
50
|
+
return f(() => {
|
|
51
|
+
var i;
|
|
52
|
+
const a = (i = o.current) == null ? void 0 : i.closest(".gi-table"), r = a == null ? void 0 : a.getAttribute("data-row-size");
|
|
53
|
+
r && s(r);
|
|
54
|
+
}, []), /* @__PURE__ */ n("div", { ref: o, className: "gi-table-expand-icon-container", children: /* @__PURE__ */ n(
|
|
55
|
+
v,
|
|
54
56
|
{
|
|
55
57
|
variant: "flat",
|
|
56
58
|
appearance: "dark",
|
|
@@ -58,7 +60,7 @@ const x = ({ children: t, className: e }) => /* @__PURE__ */ n("div", { classNam
|
|
|
58
60
|
sm: "medium",
|
|
59
61
|
md: "large",
|
|
60
62
|
lg: "extraLarge"
|
|
61
|
-
}[
|
|
63
|
+
}[l],
|
|
62
64
|
icon: {
|
|
63
65
|
icon: t ? "keyboard_arrow_up" : "keyboard_arrow_down"
|
|
64
66
|
},
|
|
@@ -69,14 +71,14 @@ const x = ({ children: t, className: e }) => /* @__PURE__ */ n("div", { classNam
|
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
) });
|
|
72
|
-
},
|
|
74
|
+
}, T = ({
|
|
73
75
|
children: t,
|
|
74
76
|
className: e,
|
|
75
|
-
...
|
|
76
|
-
}) => /* @__PURE__ */ n("td", { className: "gi-table-td", ...
|
|
77
|
+
...l
|
|
78
|
+
}) => /* @__PURE__ */ n("td", { className: "gi-table-td", ...l, children: /* @__PURE__ */ n("div", { className: m("gi-table-data-slot-container", e), children: t }) });
|
|
77
79
|
export {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
z as TableCell,
|
|
81
|
+
S as TableData,
|
|
82
|
+
T as TableDataSlot,
|
|
83
|
+
k as TableExpandIcon
|
|
82
84
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ThHTMLAttributes } from 'react';
|
|
2
2
|
import { TableAlign, VerticalAlign } from './table.js';
|
|
3
3
|
type SortedType = 'asc' | 'desc' | false;
|
|
4
|
+
export type TableHeaderSize = 'xs-fixed' | 'sm-fixed' | 'md-fixed' | 'lg-flex' | 'fluid';
|
|
4
5
|
interface TableHeaderProps extends ThHTMLAttributes<HTMLTableCellElement> {
|
|
5
6
|
align?: TableAlign;
|
|
6
7
|
valign?: VerticalAlign;
|
|
7
8
|
sorted?: SortedType;
|
|
8
9
|
onSort?: (event: React.MouseEvent) => void;
|
|
10
|
+
size?: TableHeaderSize;
|
|
9
11
|
}
|
|
10
|
-
export declare function TableHeader({ align, valign, className, sorted, onSort, children, ...props }: TableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function TableHeader({ align, valign, className, sorted, onSort, children, size, ...props }: TableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
export {};
|
|
@@ -1,69 +1,71 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as o, jsxs as
|
|
3
|
-
import { Children as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { Icon as
|
|
6
|
-
const
|
|
7
|
-
|
|
2
|
+
import { jsx as o, jsxs as b } from "react/jsx-runtime";
|
|
3
|
+
import { Children as C } from "react";
|
|
4
|
+
import { cn as m } from "../cn.js";
|
|
5
|
+
import { Icon as u } from "../icon/icon.js";
|
|
6
|
+
const j = (e, r) => e ? r ? /* @__PURE__ */ o(
|
|
7
|
+
u,
|
|
8
8
|
{
|
|
9
9
|
inline: !0,
|
|
10
10
|
icon: r === "asc" ? "arrow_upward" : "arrow_downward",
|
|
11
11
|
size: "sm"
|
|
12
12
|
}
|
|
13
|
-
) : /* @__PURE__ */ o(
|
|
14
|
-
function
|
|
13
|
+
) : /* @__PURE__ */ o(u, { inline: !0, icon: "swap_vert", size: "sm" }) : null;
|
|
14
|
+
function _({
|
|
15
15
|
align: e = "left",
|
|
16
16
|
valign: r = "middle",
|
|
17
|
-
className:
|
|
17
|
+
className: h,
|
|
18
18
|
sorted: a = !1,
|
|
19
19
|
onSort: i,
|
|
20
20
|
children: l,
|
|
21
|
-
|
|
21
|
+
size: c,
|
|
22
|
+
...p
|
|
22
23
|
}) {
|
|
23
|
-
const t = typeof l == "string",
|
|
24
|
+
const t = typeof l == "string", g = {
|
|
24
25
|
left: "gi-text-left",
|
|
25
26
|
center: "gi-text-center",
|
|
26
27
|
right: "gi-text-right"
|
|
27
|
-
}[e],
|
|
28
|
+
}[e], w = {
|
|
28
29
|
top: "gi-align-top",
|
|
29
30
|
middle: "gi-align-middle",
|
|
30
31
|
bottom: "gi-align-bottom"
|
|
31
|
-
}[r],
|
|
32
|
+
}[r], x = c ? `gi-table-th-${c}` : void 0, f = (n) => {
|
|
32
33
|
i && t && (n.preventDefault(), i(n));
|
|
33
|
-
},
|
|
34
|
-
n.key === "Enter" &&
|
|
35
|
-
},
|
|
34
|
+
}, d = (n) => {
|
|
35
|
+
n.key === "Enter" && f(n);
|
|
36
|
+
}, y = C.count(l) > 0;
|
|
36
37
|
let s;
|
|
37
|
-
return a && t ? s = "button" :
|
|
38
|
+
return a && t ? s = "button" : y || (s = "cell"), /* @__PURE__ */ o(
|
|
38
39
|
"th",
|
|
39
40
|
{
|
|
40
|
-
className:
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
className: m(
|
|
42
|
+
g,
|
|
43
|
+
w,
|
|
43
44
|
"gi-table-th",
|
|
44
|
-
|
|
45
|
+
x,
|
|
46
|
+
h,
|
|
45
47
|
{ "gi-w-12": !t }
|
|
46
48
|
),
|
|
47
49
|
role: s,
|
|
48
50
|
"data-sorted": !!i,
|
|
49
51
|
"data-header-string": t,
|
|
50
52
|
tabIndex: i && t ? 0 : -1,
|
|
51
|
-
onKeyDown:
|
|
52
|
-
...
|
|
53
|
-
children: /* @__PURE__ */
|
|
53
|
+
onKeyDown: d,
|
|
54
|
+
...p,
|
|
55
|
+
children: /* @__PURE__ */ b(
|
|
54
56
|
"div",
|
|
55
57
|
{
|
|
56
|
-
className:
|
|
58
|
+
className: m(g, {
|
|
57
59
|
"gi-flex gi-gap-1 gi-h-full gi-items-center": t,
|
|
58
60
|
"gi-justify-center": e === "center",
|
|
59
61
|
"gi-justify-start": e === "left",
|
|
60
62
|
"gi-justify-end": e === "right"
|
|
61
63
|
}),
|
|
62
|
-
onClick:
|
|
63
|
-
onKeyDown:
|
|
64
|
+
onClick: f,
|
|
65
|
+
onKeyDown: d,
|
|
64
66
|
children: [
|
|
65
67
|
l,
|
|
66
|
-
!!i &&
|
|
68
|
+
!!i && j(t, a)
|
|
67
69
|
]
|
|
68
70
|
}
|
|
69
71
|
)
|
|
@@ -71,5 +73,5 @@ function K({
|
|
|
71
73
|
);
|
|
72
74
|
}
|
|
73
75
|
export {
|
|
74
|
-
|
|
76
|
+
_ as TableHeader
|
|
75
77
|
};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { jsxs as o, jsx as
|
|
2
|
-
import { cn as
|
|
1
|
+
import { jsxs as o, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { cn as p } from "../cn.js";
|
|
3
3
|
import { translate as s } from "../i18n/utility.js";
|
|
4
|
-
import { IconButton as
|
|
4
|
+
import { IconButton as t } from "../icon-button/icon-button.js";
|
|
5
5
|
import { SelectNative as f, SelectItem as v } from "../select/select-native.js";
|
|
6
6
|
const j = ({
|
|
7
|
-
currentPage:
|
|
8
|
-
totalPages:
|
|
9
|
-
onPageChange:
|
|
10
|
-
align:
|
|
7
|
+
currentPage: i,
|
|
8
|
+
totalPages: e,
|
|
9
|
+
onPageChange: l,
|
|
10
|
+
align: n = "end"
|
|
11
11
|
}) => {
|
|
12
12
|
const d = () => {
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
|
|
13
|
+
i > 1 && l(i - 1);
|
|
14
|
+
}, m = () => {
|
|
15
|
+
i < e && l(i + 1);
|
|
16
16
|
};
|
|
17
17
|
return /* @__PURE__ */ o(
|
|
18
18
|
"div",
|
|
19
19
|
{
|
|
20
|
-
className:
|
|
20
|
+
className: p(
|
|
21
21
|
{
|
|
22
|
-
"gi-justify-first":
|
|
23
|
-
"gi-justify-center":
|
|
24
|
-
"gi-justify-end":
|
|
22
|
+
"gi-justify-first": n === "start",
|
|
23
|
+
"gi-justify-center": n === "center",
|
|
24
|
+
"gi-justify-end": n === "end"
|
|
25
25
|
},
|
|
26
26
|
"gi-table-pagination"
|
|
27
27
|
),
|
|
28
28
|
children: [
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
|
|
29
|
+
/* @__PURE__ */ a(
|
|
30
|
+
t,
|
|
31
31
|
{
|
|
32
|
-
disabled:
|
|
33
|
-
onClick: () =>
|
|
32
|
+
disabled: i === 1,
|
|
33
|
+
onClick: () => l(1),
|
|
34
34
|
appearance: "dark",
|
|
35
35
|
variant: "flat",
|
|
36
36
|
className: "gi-mr-2",
|
|
@@ -39,10 +39,10 @@ const j = ({
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
),
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
|
|
42
|
+
/* @__PURE__ */ a(
|
|
43
|
+
t,
|
|
44
44
|
{
|
|
45
|
-
disabled:
|
|
45
|
+
disabled: i === 1,
|
|
46
46
|
onClick: d,
|
|
47
47
|
appearance: "dark",
|
|
48
48
|
variant: "flat",
|
|
@@ -58,31 +58,31 @@ const j = ({
|
|
|
58
58
|
className: "gi-table-pagination-label gi-space-x-2",
|
|
59
59
|
"aria-live": "polite",
|
|
60
60
|
children: [
|
|
61
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ a("span", { children: s("table.pagination.page", {
|
|
62
62
|
defaultValue: "Page"
|
|
63
63
|
}) }),
|
|
64
|
-
/* @__PURE__ */
|
|
64
|
+
/* @__PURE__ */ a(
|
|
65
65
|
f,
|
|
66
66
|
{
|
|
67
67
|
"aria-label": "Select page",
|
|
68
|
-
value:
|
|
69
|
-
className: "!gi-min-w-12",
|
|
70
|
-
onChange: (
|
|
71
|
-
children: Array.from({ length:
|
|
68
|
+
value: i,
|
|
69
|
+
className: "!gi-min-w-12 !gi-border-color-border-system-neutral-interactive-muted",
|
|
70
|
+
onChange: (c) => l(Number(c.target.value)),
|
|
71
|
+
children: Array.from({ length: e }, (c, r) => /* @__PURE__ */ a(v, { value: r + 1, children: r + 1 }, r + 1))
|
|
72
72
|
}
|
|
73
73
|
),
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
totalPages:
|
|
76
|
-
defaultValue: `of ${
|
|
74
|
+
/* @__PURE__ */ a("span", { children: s("table.pagination.ofTotal", {
|
|
75
|
+
totalPages: e,
|
|
76
|
+
defaultValue: `of ${e}`
|
|
77
77
|
}) })
|
|
78
78
|
]
|
|
79
79
|
}
|
|
80
80
|
),
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
|
|
81
|
+
/* @__PURE__ */ a(
|
|
82
|
+
t,
|
|
83
83
|
{
|
|
84
|
-
onClick:
|
|
85
|
-
disabled:
|
|
84
|
+
onClick: m,
|
|
85
|
+
disabled: i === e,
|
|
86
86
|
appearance: "dark",
|
|
87
87
|
variant: "flat",
|
|
88
88
|
className: "gi-ml-2",
|
|
@@ -91,11 +91,11 @@ const j = ({
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
),
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
|
|
94
|
+
/* @__PURE__ */ a(
|
|
95
|
+
t,
|
|
96
96
|
{
|
|
97
|
-
disabled:
|
|
98
|
-
onClick: () => e
|
|
97
|
+
disabled: i === e,
|
|
98
|
+
onClick: () => l(e),
|
|
99
99
|
appearance: "dark",
|
|
100
100
|
variant: "flat",
|
|
101
101
|
className: "gi-ml-2",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ogcio/design-system-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.1",
|
|
4
4
|
"description": "The GOV IE design system React components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -52,9 +52,9 @@
|
|
|
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.3",
|
|
56
55
|
"@ogcio/theme-doete": "1.0.0",
|
|
57
|
-
"@ogcio/
|
|
56
|
+
"@ogcio/design-system-tailwind": "1.15.1",
|
|
57
|
+
"@ogcio/theme-govie": "1.7.1"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"format": "prettier 'src/**/*.{ts,tsx}' --write",
|