@ogcio/design-system-react 1.17.2 → 1.18.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.
- 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/index.d.ts +1 -0
- 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/package.json +3 -3
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
import { FC
|
|
2
|
-
import {
|
|
3
|
-
type ButtonGroupItemProps = PropsWithChildren<{
|
|
4
|
-
value: string;
|
|
5
|
-
role?: string;
|
|
6
|
-
'aria-checked'?: boolean;
|
|
7
|
-
'aria-label'?: string;
|
|
8
|
-
}>;
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ButtonGroupItemProps, ButtonGroupProps } from './types.js';
|
|
9
3
|
export declare const ButtonGroupItem: FC<ButtonGroupItemProps>;
|
|
10
|
-
type ButtonGroupProps = PropsWithChildren<{
|
|
11
|
-
name: string;
|
|
12
|
-
size?: ButtonSize;
|
|
13
|
-
appearance?: ButtonAppearance;
|
|
14
|
-
onChange?: (value: string) => void;
|
|
15
|
-
defaultValue?: string;
|
|
16
|
-
value?: string;
|
|
17
|
-
role?: string;
|
|
18
|
-
'aria-labelledby'?: string;
|
|
19
|
-
'aria-describedby'?: string;
|
|
20
|
-
}>;
|
|
21
4
|
export declare const ButtonGroup: FC<ButtonGroupProps>;
|
|
22
|
-
export {};
|
|
@@ -1,92 +1,98 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { Button as
|
|
5
|
-
import {
|
|
6
|
-
|
|
2
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as G, useState as V, useEffect as k, useContext as S } from "react";
|
|
4
|
+
import { Button as w } from "../button/button.js";
|
|
5
|
+
import { cn as E } from "../cn.js";
|
|
6
|
+
import { useDomId as $ } from "../hooks/use-dom-id.js";
|
|
7
|
+
const x = G(
|
|
7
8
|
void 0
|
|
8
|
-
),
|
|
9
|
+
), P = ({
|
|
9
10
|
value: r,
|
|
10
11
|
children: d,
|
|
11
12
|
role: s,
|
|
12
13
|
"aria-checked": e,
|
|
13
|
-
"aria-label": a
|
|
14
|
+
"aria-label": a,
|
|
15
|
+
...t
|
|
14
16
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
+
const c = S(x);
|
|
18
|
+
if (!c)
|
|
17
19
|
throw new Error("ButtonGroupItem must be used within a ButtonGroup");
|
|
18
20
|
const {
|
|
19
21
|
selectedValue: n,
|
|
20
22
|
setSelectedValue: l,
|
|
21
23
|
size: u,
|
|
22
24
|
onChange: o,
|
|
23
|
-
groupId:
|
|
24
|
-
appearance:
|
|
25
|
-
} =
|
|
25
|
+
groupId: m,
|
|
26
|
+
appearance: p
|
|
27
|
+
} = c, i = n === r, b = () => {
|
|
26
28
|
l(r), o == null || o(r);
|
|
27
|
-
},
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
|
|
29
|
+
}, f = `${m}-${r}`;
|
|
30
|
+
return /* @__PURE__ */ y(
|
|
31
|
+
w,
|
|
30
32
|
{
|
|
31
|
-
variant:
|
|
33
|
+
variant: i ? "primary" : "secondary",
|
|
32
34
|
size: u,
|
|
33
|
-
appearance:
|
|
34
|
-
onClick:
|
|
35
|
-
id:
|
|
35
|
+
appearance: p,
|
|
36
|
+
onClick: b,
|
|
37
|
+
id: f,
|
|
36
38
|
role: s || "radio",
|
|
37
|
-
"aria-checked": e === void 0 ?
|
|
39
|
+
"aria-checked": e === void 0 ? i : e,
|
|
38
40
|
"aria-label": a,
|
|
39
41
|
type: "button",
|
|
42
|
+
...t,
|
|
40
43
|
children: d
|
|
41
44
|
}
|
|
42
45
|
);
|
|
43
|
-
},
|
|
46
|
+
}, q = ({
|
|
44
47
|
name: r,
|
|
45
48
|
size: d = "medium",
|
|
46
49
|
appearance: s = "dark",
|
|
47
50
|
onChange: e,
|
|
48
51
|
defaultValue: a,
|
|
49
52
|
value: t,
|
|
50
|
-
children:
|
|
51
|
-
role:
|
|
52
|
-
"aria-labelledby":
|
|
53
|
-
"aria-describedby":
|
|
53
|
+
children: c,
|
|
54
|
+
role: n,
|
|
55
|
+
"aria-labelledby": l,
|
|
56
|
+
"aria-describedby": u,
|
|
57
|
+
className: o,
|
|
58
|
+
...m
|
|
54
59
|
}) => {
|
|
55
|
-
const [p, i] =
|
|
60
|
+
const [p, i] = V(
|
|
56
61
|
a
|
|
57
|
-
),
|
|
58
|
-
|
|
62
|
+
), b = t === void 0 ? p : t;
|
|
63
|
+
k(() => {
|
|
59
64
|
t !== void 0 && i(t);
|
|
60
65
|
}, [t]);
|
|
61
|
-
const
|
|
62
|
-
t === void 0 && i(
|
|
63
|
-
},
|
|
64
|
-
return /* @__PURE__ */
|
|
65
|
-
|
|
66
|
+
const f = (I) => {
|
|
67
|
+
t === void 0 && i(I), e == null || e(I);
|
|
68
|
+
}, B = $();
|
|
69
|
+
return /* @__PURE__ */ y(
|
|
70
|
+
x.Provider,
|
|
66
71
|
{
|
|
67
72
|
value: {
|
|
68
|
-
selectedValue:
|
|
69
|
-
setSelectedValue:
|
|
73
|
+
selectedValue: b,
|
|
74
|
+
setSelectedValue: f,
|
|
70
75
|
name: r,
|
|
71
76
|
size: d,
|
|
72
77
|
onChange: e,
|
|
73
|
-
groupId:
|
|
74
|
-
appearance: s
|
|
78
|
+
groupId: B,
|
|
79
|
+
appearance: s,
|
|
80
|
+
...m
|
|
75
81
|
},
|
|
76
|
-
children: /* @__PURE__ */
|
|
82
|
+
children: /* @__PURE__ */ y(
|
|
77
83
|
"div",
|
|
78
84
|
{
|
|
79
|
-
className: "gi-btn-group",
|
|
80
|
-
role:
|
|
81
|
-
"aria-labelledby":
|
|
82
|
-
"aria-describedby":
|
|
83
|
-
children:
|
|
85
|
+
className: E("gi-btn-group", o),
|
|
86
|
+
role: n || "radiogroup",
|
|
87
|
+
"aria-labelledby": l,
|
|
88
|
+
"aria-describedby": u,
|
|
89
|
+
children: c
|
|
84
90
|
}
|
|
85
91
|
)
|
|
86
92
|
}
|
|
87
93
|
);
|
|
88
94
|
};
|
|
89
95
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
96
|
+
q as ButtonGroup,
|
|
97
|
+
P as ButtonGroupItem
|
|
92
98
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { ButtonAppearance, ButtonSize } from '../button/types.js';
|
|
3
|
+
export type ButtonGroupProps = PropsWithChildren<{
|
|
4
|
+
name: string;
|
|
5
|
+
size?: ButtonSize;
|
|
6
|
+
appearance?: ButtonAppearance;
|
|
7
|
+
onChange?: (value: string) => void;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
role?: string;
|
|
11
|
+
'aria-labelledby'?: string;
|
|
12
|
+
'aria-describedby'?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
}>;
|
|
15
|
+
export type ButtonGroupItemProps = PropsWithChildren<{
|
|
16
|
+
value: string;
|
|
17
|
+
role?: string;
|
|
18
|
+
'aria-checked'?: boolean;
|
|
19
|
+
'aria-label'?: string;
|
|
20
|
+
}>;
|
|
21
|
+
export type ButtonGroupContextType = {
|
|
22
|
+
selectedValue?: string;
|
|
23
|
+
setSelectedValue: (value: string) => void;
|
|
24
|
+
name: string;
|
|
25
|
+
size: ButtonSize;
|
|
26
|
+
appearance?: ButtonAppearance;
|
|
27
|
+
onChange?: (value: string) => void;
|
|
28
|
+
groupId: string;
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { Blockquote, type BlockquoteProps } from './blockquote/blockquote.js';
|
|
|
7
7
|
export { BreadcrumbCurrentLink, BreadcrumbEllipsis, BreadcrumbLink, Breadcrumbs, } from './breadcrumbs/breadcrumbs.js';
|
|
8
8
|
export { type BreadcrumbLinkProps, type BreadcrumbProps, } from './breadcrumbs/types.js';
|
|
9
9
|
export { ButtonGroup, ButtonGroupItem } from './button-group/button-group.js';
|
|
10
|
+
export * from './button-group/types.js';
|
|
10
11
|
export { Button } from './button/button.js';
|
|
11
12
|
export { type ButtonProps } from './button/types.js';
|
|
12
13
|
export { CardAction, CardContainer, CardDescription, CardHeader, CardMedia, CardSubtitle, CardTag, CardTitle, } from './card/card-next.js';
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
4
|
-
import { ButtonGroup as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
import { jsxs as a, jsx as s, Fragment as F } from "react/jsx-runtime";
|
|
3
|
+
import { useId as G } from "react";
|
|
4
|
+
import { ButtonGroup as j, ButtonGroupItem as w } from "../button-group/button-group.js";
|
|
5
|
+
import { cn as o } from "../cn.js";
|
|
6
|
+
import { FormField as O, FormFieldLabel as V, FormFieldHint as E } from "../forms/form-field/form-field.js";
|
|
7
|
+
import { useBreakpoint as H, Breakpoint as $ } from "../hooks/use-breakpoint.js";
|
|
8
|
+
const K = ({
|
|
9
|
+
name: B,
|
|
10
|
+
size: x = "medium",
|
|
11
|
+
orientation: t = "horizontal",
|
|
12
|
+
wrapInMobile: I = !0,
|
|
13
|
+
value: m,
|
|
14
|
+
label: N,
|
|
15
|
+
hint: d,
|
|
16
|
+
leftLabel: i,
|
|
17
|
+
rightLabel: c,
|
|
18
|
+
onChange: v,
|
|
19
|
+
type: f
|
|
16
20
|
}) => {
|
|
17
|
-
|
|
18
|
-
const o = k.useId(), v = `${o}-label`, b = i ? `${o}-hint` : void 0;
|
|
21
|
+
const h = G(), b = `${h}-label`, n = d ? `${h}-hint` : void 0, { breakpoint: p } = H(), g = p === $.ExtraSmall || p === $.Small;
|
|
19
22
|
let l = [];
|
|
20
|
-
switch (
|
|
23
|
+
switch (f) {
|
|
21
24
|
case "1-5": {
|
|
22
25
|
l = [
|
|
23
26
|
{ value: "1", label: "1" },
|
|
@@ -57,48 +60,88 @@ const _ = ({
|
|
|
57
60
|
break;
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
i &&
|
|
63
|
-
/* @__PURE__ */ u(
|
|
63
|
+
const u = t === "vertical" || g && !I, y = () => u ? "gi-score-select-button-group-vertical" : "gi-score-select-button-group-horizontal", z = () => {
|
|
64
|
+
var e, r;
|
|
65
|
+
return i && c && l.length > 2 && t === "horizontal" && !u && /* @__PURE__ */ a(
|
|
64
66
|
"div",
|
|
65
67
|
{
|
|
66
|
-
className: "gi-score-select-
|
|
67
|
-
|
|
68
|
-
"aria-labelledby": v,
|
|
69
|
-
"aria-describedby": b,
|
|
68
|
+
className: o("gi-score-select-labels-responsive"),
|
|
69
|
+
"aria-hidden": "true",
|
|
70
70
|
children: [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
71
|
+
/* @__PURE__ */ a("div", { children: [
|
|
72
|
+
(e = l[0]) == null ? void 0 : e.label,
|
|
73
|
+
" – ",
|
|
74
|
+
i
|
|
75
|
+
] }),
|
|
76
|
+
/* @__PURE__ */ a("div", { children: [
|
|
77
|
+
(r = l.at(-1)) == null ? void 0 : r.label,
|
|
78
|
+
" – ",
|
|
79
|
+
c
|
|
80
|
+
] })
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
}, S = () => {
|
|
85
|
+
var e, r;
|
|
86
|
+
return (i || c) && /* @__PURE__ */ s(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
className: o("gi-score-select-labels", {
|
|
90
|
+
"gi-score-select-labels-vertical": u
|
|
91
|
+
}),
|
|
92
|
+
"aria-hidden": "true",
|
|
93
|
+
children: t === "horizontal" && g ? /* @__PURE__ */ a(F, { children: [
|
|
94
|
+
/* @__PURE__ */ a("div", { children: [
|
|
95
|
+
(e = l[0]) == null ? void 0 : e.label,
|
|
96
|
+
" – ",
|
|
97
|
+
i
|
|
82
98
|
] }),
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
|
|
99
|
+
/* @__PURE__ */ a("div", { children: [
|
|
100
|
+
(r = l.at(-1)) == null ? void 0 : r.label,
|
|
101
|
+
" – ",
|
|
102
|
+
c
|
|
103
|
+
] })
|
|
104
|
+
] }) : /* @__PURE__ */ a(F, { children: [
|
|
105
|
+
/* @__PURE__ */ s("div", { children: i }),
|
|
106
|
+
/* @__PURE__ */ s("div", { children: c })
|
|
107
|
+
] })
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
return /* @__PURE__ */ a(O, { className: "gi-w-full", children: [
|
|
112
|
+
/* @__PURE__ */ s(V, { id: b, children: N }),
|
|
113
|
+
d && /* @__PURE__ */ s(E, { id: n, children: d }),
|
|
114
|
+
/* @__PURE__ */ a(
|
|
115
|
+
"div",
|
|
116
|
+
{
|
|
117
|
+
className: o("gi-score-select-button-group", y()),
|
|
118
|
+
role: "group",
|
|
119
|
+
"aria-labelledby": b,
|
|
120
|
+
"aria-describedby": n,
|
|
121
|
+
children: [
|
|
122
|
+
z(),
|
|
123
|
+
/* @__PURE__ */ s(
|
|
124
|
+
j,
|
|
85
125
|
{
|
|
86
|
-
name:
|
|
87
|
-
size:
|
|
88
|
-
defaultValue:
|
|
89
|
-
onChange: (e) =>
|
|
126
|
+
name: B,
|
|
127
|
+
size: x,
|
|
128
|
+
defaultValue: m,
|
|
129
|
+
onChange: (e) => v == null ? void 0 : v(e),
|
|
90
130
|
role: "radiogroup",
|
|
91
|
-
"aria-labelledby":
|
|
92
|
-
"aria-describedby":
|
|
131
|
+
"aria-labelledby": b,
|
|
132
|
+
"aria-describedby": n,
|
|
133
|
+
className: o({
|
|
134
|
+
"gi-flex-col gi-items-start": u
|
|
135
|
+
}),
|
|
93
136
|
children: l.map((e) => {
|
|
94
|
-
var
|
|
95
|
-
return /* @__PURE__ */
|
|
96
|
-
|
|
137
|
+
var r, k;
|
|
138
|
+
return /* @__PURE__ */ s(
|
|
139
|
+
w,
|
|
97
140
|
{
|
|
98
141
|
value: e.value,
|
|
99
142
|
role: "radio",
|
|
100
|
-
"aria-checked":
|
|
101
|
-
"aria-label": `${e.label}${
|
|
143
|
+
"aria-checked": m === e.value,
|
|
144
|
+
"aria-label": `${e.label}${i && e.value === ((r = l[0]) == null ? void 0 : r.value) ? ` - ${i}` : ""}${c && e.value === ((k = l.at(-1)) == null ? void 0 : k.value) ? ` - ${c}` : ""}`,
|
|
102
145
|
children: e.label
|
|
103
146
|
},
|
|
104
147
|
e.value
|
|
@@ -106,15 +149,12 @@ const _ = ({
|
|
|
106
149
|
})
|
|
107
150
|
}
|
|
108
151
|
),
|
|
109
|
-
(
|
|
110
|
-
/* @__PURE__ */ d("div", { children: a }),
|
|
111
|
-
/* @__PURE__ */ d("div", { children: r })
|
|
112
|
-
] })
|
|
152
|
+
S()
|
|
113
153
|
]
|
|
114
154
|
}
|
|
115
155
|
)
|
|
116
156
|
] });
|
|
117
157
|
};
|
|
118
158
|
export {
|
|
119
|
-
|
|
159
|
+
K as ScoreSelect
|
|
120
160
|
};
|
|
@@ -9,6 +9,10 @@ export type ScoreSelectProps = {
|
|
|
9
9
|
leftLabel?: string;
|
|
10
10
|
rightLabel?: string;
|
|
11
11
|
type: ScoreSelectType;
|
|
12
|
+
orientation?: 'vertical' | 'horizontal';
|
|
13
|
+
startLabel?: string;
|
|
14
|
+
endLabel?: string;
|
|
15
|
+
wrapInMobile?: boolean;
|
|
12
16
|
onChange?: (value: string) => void;
|
|
13
17
|
};
|
|
14
18
|
export {};
|