@ogcio/design-system-react 1.13.0 → 1.14.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/autocomplete/autocomplete.d.ts +21 -3
- package/dist/autocomplete/autocomplete.js +208 -159
- package/dist/autocomplete/types.d.ts +8 -4
- package/dist/autocomplete/types.js +2 -1
- package/dist/autocomplete/use-autocomplete-controller.d.ts +4 -2
- package/dist/autocomplete/use-autocomplete-controller.js +123 -79
- package/dist/button/button.js +27 -22
- package/dist/hooks/use-combined-refs.d.ts +5 -0
- package/dist/hooks/use-combined-refs.js +10 -0
- package/dist/hooks/use-scroll-highlighted-item.d.ts +1 -0
- package/dist/hooks/use-scroll-highlighted-item.js +16 -0
- package/dist/icon/icon.js +14 -14
- package/dist/icon-button/icon-button.js +14 -12
- package/dist/index.d.ts +3 -2
- package/dist/list/list.js +1 -1
- package/dist/modal/modal.d.ts +8 -2
- package/dist/modal/modal.js +155 -134
- package/dist/popover/popover.d.ts +1 -1
- package/dist/popover/popover.js +296 -286
- package/dist/popover/types.d.ts +1 -0
- package/dist/popover/utilities.d.ts +2 -0
- package/dist/popover/utilities.js +16 -0
- package/dist/primitives/button.d.ts +3 -0
- package/dist/primitives/button.js +9 -0
- package/dist/select/select-menu.d.ts +2 -2
- package/dist/select/select-menu.js +96 -99
- package/dist/select/select-next.d.ts +13 -2
- package/dist/select/select-next.js +182 -167
- package/dist/select/select-search.js +17 -17
- package/dist/select/types.d.ts +3 -1
- package/dist/styles.css +1 -1
- package/dist/tabs/scrollable-tab-list.d.ts +9 -0
- package/dist/tabs/scrollable-tab-list.js +84 -0
- package/dist/tabs/tab-item.d.ts +9 -15
- package/dist/tabs/tab-item.js +85 -38
- package/dist/tabs/tab-list.d.ts +2 -5
- package/dist/tabs/tab-list.js +83 -49
- package/dist/tabs/tab-panel.d.ts +2 -7
- package/dist/tabs/tab-panel.js +2 -5
- package/dist/tabs/tabs.d.ts +2 -7
- package/dist/tabs/tabs.js +24 -20
- package/dist/tabs/types.d.ts +64 -0
- package/dist/tabs/types.js +1 -0
- package/dist/textarea/textarea.d.ts +1 -2
- package/dist/textarea/textarea.js +60 -61
- package/package.json +3 -3
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx as d, jsxs as E } from "react/jsx-runtime";
|
|
2
|
+
import { useState as y, useRef as g, Children as l, useEffect as I, isValidElement as p, useLayoutEffect as L } from "react";
|
|
3
|
+
import { cn as k } from "../cn.js";
|
|
4
|
+
import { InternalTabItem as D } from "./tab-item.js";
|
|
5
|
+
const K = ({
|
|
6
|
+
children: r,
|
|
7
|
+
tabName: w,
|
|
8
|
+
className: R = "",
|
|
9
|
+
appearance: i = "default"
|
|
10
|
+
}) => {
|
|
11
|
+
const [n, a] = y(0), [f, T] = y({ left: 0, width: 0 }), u = g([]), m = g(null), b = l.count(r);
|
|
12
|
+
I(() => {
|
|
13
|
+
for (const t of l.toArray(r))
|
|
14
|
+
if (p(t)) {
|
|
15
|
+
if ((t == null ? void 0 : t.props).checked)
|
|
16
|
+
break;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
}, [r]), L(() => {
|
|
20
|
+
const t = u.current[n], e = m.current;
|
|
21
|
+
if (!t || !e)
|
|
22
|
+
return;
|
|
23
|
+
const o = t.getBoundingClientRect(), s = e.getBoundingClientRect();
|
|
24
|
+
requestAnimationFrame(() => {
|
|
25
|
+
T({
|
|
26
|
+
left: o.left - s.left + e.scrollLeft,
|
|
27
|
+
width: o.width
|
|
28
|
+
}), t.scrollIntoView({ behavior: "smooth", inline: "center" });
|
|
29
|
+
});
|
|
30
|
+
}, [n]);
|
|
31
|
+
const A = (t, e) => (o) => {
|
|
32
|
+
a(t), e && e(o);
|
|
33
|
+
const s = o.currentTarget.getAttribute("aria-controls");
|
|
34
|
+
if (s)
|
|
35
|
+
for (const c of document.querySelectorAll('[role="tabpanel"]'))
|
|
36
|
+
c instanceof HTMLElement && (c.style.display = c.id === s ? "block" : "none");
|
|
37
|
+
}, C = (t) => {
|
|
38
|
+
if (t.key === "ArrowLeft" || t.key === "ArrowRight") {
|
|
39
|
+
let e = n + (t.key === "ArrowRight" ? 1 : -1);
|
|
40
|
+
e < 0 && (e = 0), e >= b && (e = b - 1), a(e), t.preventDefault();
|
|
41
|
+
}
|
|
42
|
+
}, h = l.map(r, (t, e) => p(t) ? /* @__PURE__ */ d(
|
|
43
|
+
D,
|
|
44
|
+
{
|
|
45
|
+
...t == null ? void 0 : t.props,
|
|
46
|
+
appearance: i,
|
|
47
|
+
index: e,
|
|
48
|
+
checked: n === e,
|
|
49
|
+
onTabClick: A(e, t.props.onTabClick),
|
|
50
|
+
onTabKeyDown: C,
|
|
51
|
+
ref: (o) => {
|
|
52
|
+
u.current[e] = o;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
) : null), S = {
|
|
56
|
+
left: f.left,
|
|
57
|
+
width: f.width
|
|
58
|
+
};
|
|
59
|
+
return /* @__PURE__ */ E(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
id: w,
|
|
63
|
+
ref: m,
|
|
64
|
+
role: "tablist",
|
|
65
|
+
className: k("gi-tab-list ", R),
|
|
66
|
+
children: [
|
|
67
|
+
h,
|
|
68
|
+
/* @__PURE__ */ d(
|
|
69
|
+
"span",
|
|
70
|
+
{
|
|
71
|
+
className: k("gi-tab-indicator", {
|
|
72
|
+
"gi-bg-color-border-system-neutral-interactive-default": i === "dark",
|
|
73
|
+
"gi-bg-color-border-tone-primary-accent-selected": i === "default"
|
|
74
|
+
}),
|
|
75
|
+
style: S
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
export {
|
|
83
|
+
K as ScrollableTabs
|
|
84
|
+
};
|
package/dist/tabs/tab-item.d.ts
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
href?: string;
|
|
6
|
-
checked?: boolean;
|
|
7
|
-
ariaLabel?: string;
|
|
8
|
-
ariaLabelledby?: string;
|
|
9
|
-
onTabClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
10
|
-
};
|
|
11
|
-
export type InternalTabItemProps = TabItemProps & {
|
|
12
|
-
onTabClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { TabItemProps } from './types.js';
|
|
3
|
+
export declare const TabItem: FC<TabItemProps>;
|
|
4
|
+
export declare const InternalTabItem: import('react').ForwardRefExoticComponent<TabItemProps & {
|
|
13
5
|
onTabKeyDown?: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
14
6
|
index: number;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
appearance?: "default" | "dark";
|
|
8
|
+
size?: "md" | "sm";
|
|
9
|
+
stretch?: boolean;
|
|
10
|
+
labelAlignment?: "center" | "end" | "start";
|
|
11
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
package/dist/tabs/tab-item.js
CHANGED
|
@@ -1,42 +1,89 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"aria-controls": `tab-panel-${o}`,
|
|
26
|
-
className: `gi-tab-item ${e ? "gi-tab-item-checked" : ""}`,
|
|
27
|
-
onClick: (t) => {
|
|
28
|
-
var u;
|
|
29
|
-
c.current = !0, l && l(t), (u = a.current) == null || u.blur();
|
|
30
|
-
},
|
|
31
|
-
onKeyDown: (t) => {
|
|
32
|
-
n && n(t);
|
|
33
|
-
},
|
|
34
|
-
children: s ? /* @__PURE__ */ r("a", { href: s, className: "gi-decoration-xs", children: i }) : /* @__PURE__ */ r("span", { className: "gi-decoration-xs", children: i })
|
|
2
|
+
import { jsx as i, jsxs as I, Fragment as N } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as v, useRef as d, useEffect as R } from "react";
|
|
4
|
+
import { c as j } from "../index-CB-zPpNk.js";
|
|
5
|
+
import { cn as z } from "../cn.js";
|
|
6
|
+
import { Button as B } from "../primitives/button.js";
|
|
7
|
+
import { slugify as T } from "../utilities.js";
|
|
8
|
+
const V = j({
|
|
9
|
+
base: "gi-tab-item",
|
|
10
|
+
variants: {
|
|
11
|
+
size: {
|
|
12
|
+
md: "gi-text-md gi-py-4",
|
|
13
|
+
sm: "gi-text-sm gi-py-2"
|
|
14
|
+
},
|
|
15
|
+
checked: {
|
|
16
|
+
true: "gi-tab-item-checked"
|
|
17
|
+
},
|
|
18
|
+
stretch: {
|
|
19
|
+
true: "gi-flex-1"
|
|
20
|
+
},
|
|
21
|
+
labelAlignment: {
|
|
22
|
+
start: "gi-text-start",
|
|
23
|
+
center: "gi-text-center",
|
|
24
|
+
end: "gi-text-end"
|
|
35
25
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
size: "md"
|
|
29
|
+
}
|
|
30
|
+
}), $ = () => null, w = v(
|
|
31
|
+
({
|
|
32
|
+
value: g,
|
|
33
|
+
href: s,
|
|
34
|
+
checked: e = !1,
|
|
35
|
+
children: n,
|
|
36
|
+
onTabClick: o,
|
|
37
|
+
onTabKeyDown: l,
|
|
38
|
+
size: b = "md",
|
|
39
|
+
appearance: c = "default",
|
|
40
|
+
labelAlignment: p = "center",
|
|
41
|
+
stretch: x,
|
|
42
|
+
...y
|
|
43
|
+
}, r) => {
|
|
44
|
+
const m = T(g), a = d(null), u = d(!1);
|
|
45
|
+
return R(() => {
|
|
46
|
+
var t;
|
|
47
|
+
e && !u.current && ((t = a.current) == null || t.click());
|
|
48
|
+
}, [e]), /* @__PURE__ */ i(
|
|
49
|
+
B,
|
|
50
|
+
{
|
|
51
|
+
id: `tab-${m}`,
|
|
52
|
+
ref: (t) => {
|
|
53
|
+
a.current = t, typeof r == "function" ? r(t) : r && (r.current = t);
|
|
54
|
+
},
|
|
55
|
+
...y,
|
|
56
|
+
role: "tab",
|
|
57
|
+
"aria-roledescription": "tab",
|
|
58
|
+
"aria-selected": e ? "true" : "false",
|
|
59
|
+
"aria-controls": `tab-panel-${m}`,
|
|
60
|
+
className: V({ size: b, checked: e, stretch: x, labelAlignment: p }),
|
|
61
|
+
onClick: (t) => {
|
|
62
|
+
var f;
|
|
63
|
+
u.current = !0, o && o(t), (f = a.current) == null || f.blur();
|
|
64
|
+
},
|
|
65
|
+
onKeyDown: (t) => {
|
|
66
|
+
l && l(t);
|
|
67
|
+
},
|
|
68
|
+
children: s ? /* @__PURE__ */ i("a", { href: s, className: "gi-decoration-xs", children: n }) : /* @__PURE__ */ I(N, { children: [
|
|
69
|
+
n,
|
|
70
|
+
/* @__PURE__ */ i(
|
|
71
|
+
"div",
|
|
72
|
+
{
|
|
73
|
+
className: z("gi-tab-item-border", {
|
|
74
|
+
"gi-bg-color-text-system-neutral-interactive-default": e && c === "dark",
|
|
75
|
+
"gi-bg-color-border-tone-primary-accent-selected": e && c === "default"
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
] })
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
w.displayName = "InternalTabItem";
|
|
85
|
+
$.displayName = "TabItem";
|
|
39
86
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
87
|
+
w as InternalTabItem,
|
|
88
|
+
$ as TabItem
|
|
42
89
|
};
|
package/dist/tabs/tab-list.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const TabList: ({ children, tabName, }:
|
|
3
|
-
tabName?: string;
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { TabListProps } from './types.js';
|
|
2
|
+
export declare const TabList: ({ children, tabName, appearance, size, ariaLabelledBy, stretch, padding, labelAlignment, }: TabListProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/tabs/tab-list.js
CHANGED
|
@@ -1,62 +1,96 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
3
|
+
import { useState as S, Children as s, useEffect as $, isValidElement as A } from "react";
|
|
4
|
+
import { cn as q } from "../cn.js";
|
|
5
|
+
import { InternalTabItem as D } from "./tab-item.js";
|
|
6
|
+
const j = ({
|
|
7
|
+
children: c,
|
|
8
|
+
tabName: b,
|
|
9
|
+
appearance: C,
|
|
10
|
+
size: m,
|
|
11
|
+
ariaLabelledBy: I,
|
|
12
|
+
stretch: p,
|
|
13
|
+
padding: f = !0,
|
|
14
|
+
labelAlignment: w
|
|
8
15
|
}) => {
|
|
9
|
-
const [
|
|
10
|
-
|
|
11
|
-
let
|
|
12
|
-
s.forEach(
|
|
13
|
-
|
|
14
|
-
}),
|
|
16
|
+
const [d, l] = S(null), y = s.count(c);
|
|
17
|
+
$(() => {
|
|
18
|
+
let t = !1, r = 0;
|
|
19
|
+
s.forEach(c, (e, o) => {
|
|
20
|
+
A(e) && "checked" in e.props && e.props.checked === !0 && (r = o, t = !0);
|
|
21
|
+
}), l(t ? r : 0);
|
|
15
22
|
}, []);
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
...document.querySelector(`#${
|
|
23
|
+
const k = (t, r) => (e) => {
|
|
24
|
+
l(t);
|
|
25
|
+
const T = [
|
|
26
|
+
...document.querySelector(`#${b}`).querySelectorAll("[role=tabpanel]")
|
|
20
27
|
];
|
|
21
|
-
for (const
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
28
|
+
for (const h of T)
|
|
29
|
+
h.style.display = "none";
|
|
30
|
+
const n = e.currentTarget.getAttribute("aria-controls");
|
|
31
|
+
if (!n)
|
|
25
32
|
return;
|
|
26
|
-
const
|
|
27
|
-
`#${
|
|
33
|
+
const u = document.querySelector(
|
|
34
|
+
`#${n}`
|
|
28
35
|
);
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
u.style.display = "block", r && r(e);
|
|
37
|
+
}, x = (t) => {
|
|
38
|
+
let r = 0;
|
|
39
|
+
if (t.key === "ArrowLeft" ? r = -1 : t.key === "ArrowRight" && (r = 1), r === 0)
|
|
40
|
+
return;
|
|
41
|
+
let o = (d ?? 0) + r;
|
|
42
|
+
o < 0 && (o = 0), o >= y && (o = y - 1);
|
|
43
|
+
const n = s.toArray(c)[o];
|
|
44
|
+
if (!n)
|
|
45
|
+
return;
|
|
46
|
+
l(o);
|
|
47
|
+
const u = {
|
|
48
|
+
currentTarget: {
|
|
49
|
+
getAttribute: (a) => {
|
|
50
|
+
var i;
|
|
51
|
+
return a === "aria-controls" ? `tab-panel-${(i = n == null ? void 0 : n.props) == null ? void 0 : i.value}` : null;
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
bubbles: !0,
|
|
55
|
+
isTrusted: !0
|
|
56
|
+
};
|
|
57
|
+
k(o, () => {
|
|
58
|
+
var a, i;
|
|
59
|
+
return r === -1 ? (i = (a = n.props) == null ? void 0 : a.onTabClick) == null ? void 0 : i.call(a, t) : t;
|
|
60
|
+
})(u), t.stopPropagation(), t.preventDefault();
|
|
61
|
+
}, E = s.map(c, (t, r) => {
|
|
62
|
+
var e;
|
|
63
|
+
return A(t) ? /* @__PURE__ */ g(
|
|
64
|
+
D,
|
|
49
65
|
{
|
|
50
|
-
...
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
66
|
+
...t.props,
|
|
67
|
+
appearance: C,
|
|
68
|
+
stretch: p,
|
|
69
|
+
labelAlignment: w,
|
|
70
|
+
size: m,
|
|
71
|
+
index: r,
|
|
72
|
+
checked: d === r,
|
|
73
|
+
onTabKeyDown: x,
|
|
74
|
+
onTabClick: k(r, (e = t == null ? void 0 : t.props) == null ? void 0 : e.onTabClick)
|
|
55
75
|
}
|
|
56
76
|
) : null;
|
|
57
77
|
});
|
|
58
|
-
return /* @__PURE__ */
|
|
78
|
+
return /* @__PURE__ */ g(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
role: "tablist",
|
|
82
|
+
"aria-orientation": "horizontal",
|
|
83
|
+
className: q("gi-tab-list", {
|
|
84
|
+
"gi-tab-list-stretch": p,
|
|
85
|
+
"gi-gap-4": f,
|
|
86
|
+
"gi-gap-0": !f
|
|
87
|
+
}),
|
|
88
|
+
"aria-labelledby": I,
|
|
89
|
+
id: `${b}-list`,
|
|
90
|
+
children: E
|
|
91
|
+
}
|
|
92
|
+
);
|
|
59
93
|
};
|
|
60
94
|
export {
|
|
61
|
-
|
|
95
|
+
j as TabList
|
|
62
96
|
};
|
package/dist/tabs/tab-panel.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function TabPanel({ value, children
|
|
3
|
-
value: string;
|
|
4
|
-
ariaLabel?: string;
|
|
5
|
-
ariaLabelledby?: string;
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { TabPanelProps } from './types.js';
|
|
2
|
+
export declare function TabPanel({ value, children }: TabPanelProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/tabs/tab-panel.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { slugify as n } from "../utilities.js";
|
|
3
|
-
function i({
|
|
4
|
-
value: e,
|
|
5
|
-
children: l
|
|
6
|
-
}) {
|
|
3
|
+
function i({ value: e, children: l }) {
|
|
7
4
|
const a = n(e);
|
|
8
5
|
return /* @__PURE__ */ t(
|
|
9
6
|
"div",
|
|
10
7
|
{
|
|
11
8
|
role: "tabpanel",
|
|
12
|
-
"aria-labelledby": `tab-${a}`,
|
|
9
|
+
"aria-labelledby": `tab-panel-${a}`,
|
|
13
10
|
id: `tab-panel-${a}`,
|
|
14
11
|
tabIndex: 0,
|
|
15
12
|
className: "gi-tab-panel",
|
package/dist/tabs/tabs.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
ariaLabelledBy: string;
|
|
4
|
-
dataTestid?: string;
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
};
|
|
7
|
-
export declare function Tabs({ id, ariaLabelledBy, dataTestid, children, }: TabsProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { TabsProps } from './types.js';
|
|
2
|
+
export declare function Tabs({ appearance, size, stretch, padding, labelAlignment, id, ariaLabelledBy, dataTestid, children, }: TabsProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/tabs/tabs.js
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Children as
|
|
3
|
-
import { generateRandomId as
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { Children as f, isValidElement as u, cloneElement as p } from "react";
|
|
3
|
+
import { generateRandomId as h } from "../utilities.js";
|
|
4
|
+
function x({
|
|
5
|
+
appearance: e = "default",
|
|
6
|
+
size: a = "md",
|
|
7
|
+
stretch: i = !1,
|
|
8
|
+
padding: n = !0,
|
|
9
|
+
labelAlignment: m = "center",
|
|
10
|
+
id: t = h(),
|
|
11
|
+
ariaLabelledBy: o,
|
|
12
|
+
dataTestid: d,
|
|
13
|
+
children: s
|
|
9
14
|
}) {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
);
|
|
15
|
+
const l = f.map(s, (r) => u(r) ? p(r, {
|
|
16
|
+
tabName: t,
|
|
17
|
+
appearance: e,
|
|
18
|
+
size: a,
|
|
19
|
+
ariaLabelledBy: o,
|
|
20
|
+
stretch: i,
|
|
21
|
+
padding: n,
|
|
22
|
+
labelAlignment: m
|
|
23
|
+
}) : r);
|
|
24
|
+
return /* @__PURE__ */ c("div", { className: "gi-tabs", id: t, "data-testid": d, children: l });
|
|
21
25
|
}
|
|
22
26
|
export {
|
|
23
|
-
|
|
27
|
+
x as Tabs
|
|
24
28
|
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type TabAppearanceType = 'default' | 'dark';
|
|
3
|
+
type TabLabelAlignmentType = 'start' | 'end' | 'center';
|
|
4
|
+
export type TabsProps = {
|
|
5
|
+
/** ID of the tabs container */
|
|
6
|
+
id?: string;
|
|
7
|
+
/** ID of the element that labels the tabs (required for accessibility) */
|
|
8
|
+
ariaLabelledBy: string;
|
|
9
|
+
/** Test ID for the tabs container */
|
|
10
|
+
dataTestid?: string;
|
|
11
|
+
/** Visual appearance of the tabs. */
|
|
12
|
+
appearance?: TabAppearanceType;
|
|
13
|
+
/** Size of the tabs. Default: md */
|
|
14
|
+
size?: 'sm' | 'md';
|
|
15
|
+
/** if true all the tabs will space equally covering full available width. Default: false */
|
|
16
|
+
stretch?: boolean;
|
|
17
|
+
/** if true all the tabs will space equally covering full available width. Default: true */
|
|
18
|
+
padding?: boolean;
|
|
19
|
+
/** Property to set the label alignment. Default: start */
|
|
20
|
+
labelAlignment?: TabLabelAlignmentType;
|
|
21
|
+
/** TabList, TabItem, and TabPanel components */
|
|
22
|
+
children: React.ReactNode;
|
|
23
|
+
};
|
|
24
|
+
export type TabItemProps = {
|
|
25
|
+
/** Optional href to render the tab as a link */
|
|
26
|
+
href?: string;
|
|
27
|
+
/** Whether the tab is currently selected */
|
|
28
|
+
checked?: boolean;
|
|
29
|
+
/** Accessible label for the tab */
|
|
30
|
+
ariaLabel?: string;
|
|
31
|
+
/** ID of the element that labels the tab */
|
|
32
|
+
ariaLabelledby?: string;
|
|
33
|
+
/** Unique identifier for the tab */
|
|
34
|
+
value: string;
|
|
35
|
+
/** Tab label text */
|
|
36
|
+
children: string;
|
|
37
|
+
/** Optional click event handler for the tab */
|
|
38
|
+
onTabClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
39
|
+
};
|
|
40
|
+
export type TabPanelProps = {
|
|
41
|
+
/** The value used to associate the panel with its corresponding tab */
|
|
42
|
+
value: string;
|
|
43
|
+
/** Content to be rendered inside the tab panel */
|
|
44
|
+
children: React.ReactNode;
|
|
45
|
+
};
|
|
46
|
+
export type TabListProps = {
|
|
47
|
+
tabName?: string;
|
|
48
|
+
appearance?: TabAppearanceType;
|
|
49
|
+
size?: 'sm' | 'md';
|
|
50
|
+
ariaLabelledBy?: string;
|
|
51
|
+
stretch?: boolean;
|
|
52
|
+
padding?: boolean;
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
labelAlignment?: TabLabelAlignmentType;
|
|
55
|
+
};
|
|
56
|
+
export type InternalTabItemProps = TabItemProps & {
|
|
57
|
+
onTabKeyDown?: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
58
|
+
index: number;
|
|
59
|
+
appearance?: TabAppearanceType;
|
|
60
|
+
size?: 'md' | 'sm';
|
|
61
|
+
stretch?: boolean;
|
|
62
|
+
labelAlignment?: TabLabelAlignmentType;
|
|
63
|
+
};
|
|
64
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { default as React, TextareaHTMLAttributes } from 'react';
|
|
2
2
|
import { IconId } from '../icon/icon.js';
|
|
3
3
|
export type TextAreaProps = React.DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement> & {
|
|
4
|
-
ref?: React.Ref<HTMLTextAreaElement>;
|
|
5
4
|
rows?: number;
|
|
6
5
|
cols?: number;
|
|
7
6
|
autoComplete?: string;
|
|
@@ -10,4 +9,4 @@ export type TextAreaProps = React.DetailedHTMLProps<TextareaHTMLAttributes<HTMLT
|
|
|
10
9
|
iconStart?: IconId;
|
|
11
10
|
clearButtonEnabled?: boolean;
|
|
12
11
|
};
|
|
13
|
-
export declare const TextArea: React.ForwardRefExoticComponent<Omit<TextAreaProps, "ref"> & React.RefAttributes<
|
|
12
|
+
export declare const TextArea: React.ForwardRefExoticComponent<Omit<TextAreaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
|