@ogcio/design-system-react 1.32.0 → 1.33.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/accordion/accordion-item.js +62 -57
- package/dist/alert/alert.js +37 -39
- package/dist/alert/variants.d.ts +49 -52
- package/dist/alert/variants.js +17 -18
- package/dist/atoms/Button.d.ts +2 -2
- package/dist/atoms/Button.js +2 -1
- package/dist/button/button.d.ts +2 -9
- package/dist/button/button.js +65 -32
- package/dist/button/helpers.d.ts +2 -1
- package/dist/button/types.d.ts +25 -8
- package/dist/button-group/button-group.js +43 -45
- package/dist/button-group/types.d.ts +5 -5
- package/dist/card/card-legacy.js +1 -1
- package/dist/card/types.d.ts +1 -1
- package/dist/combo-box/dropdown-item.js +1 -1
- package/dist/cookie-banner/cookie-banner.d.ts +1 -1
- package/dist/data-table/data-table-header.js +1 -1
- package/dist/drawer/drawer.d.ts +1 -1
- package/dist/drawer/drawer.js +17 -17
- package/dist/error-text/error-text.js +28 -27
- package/dist/forms/form-field/form-field.js +24 -25
- package/dist/header/components/header-search.js +2 -2
- package/dist/hint-text/hint-text.js +26 -20
- package/dist/icon-button/icon-button.d.ts +3 -5
- package/dist/index.d.ts +1 -1
- package/dist/label/label.d.ts +78 -30
- package/dist/label/label.js +29 -14
- package/dist/modal/modal.content.js +1 -1
- package/dist/modal/modal.js +38 -38
- package/dist/modal/types.d.ts +5 -4
- package/dist/pagination/pagination.js +27 -28
- package/dist/score-select/type.d.ts +2 -2
- package/dist/select/select-next.js +87 -87
- package/dist/side-nav/side-nav.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tabs/tab-item.js +53 -71
- package/dist/tabs/variants.d.ts +269 -0
- package/dist/tabs/variants.js +87 -0
- package/dist/tooltip/tooltip.js +27 -35
- package/dist/tooltip/variants.d.ts +115 -0
- package/dist/tooltip/variants.js +59 -0
- package/package.json +2 -2
package/dist/button/helpers.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IconButtonProps } from '../icon-button/icon-button.js';
|
|
1
2
|
import { ButtonAppearance, ButtonVariant, ButtonSize } from './types.js';
|
|
2
3
|
export declare const getVariantAppearanceClass: ({ disabled, variant, appearance, }: {
|
|
3
4
|
disabled?: boolean;
|
|
@@ -5,7 +6,7 @@ export declare const getVariantAppearanceClass: ({ disabled, variant, appearance
|
|
|
5
6
|
appearance?: ButtonAppearance;
|
|
6
7
|
}) => string | undefined;
|
|
7
8
|
export declare const getSizeClass: (size?: ButtonSize) => "gi-btn-small" | "gi-btn-large" | "gi-btn-regular";
|
|
8
|
-
export declare const getButtonIconSizeClass: (size?:
|
|
9
|
+
export declare const getButtonIconSizeClass: (size?: IconButtonProps["size"]) => "gi-icon-btn-small" | "gi-icon-btn-large" | "gi-icon-btn-extra-large" | "gi-icon-btn-regular";
|
|
9
10
|
export declare const isButtonDisabled: ({ disabled, variant, appearance, }: {
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
variant?: ButtonVariant;
|
package/dist/button/types.d.ts
CHANGED
|
@@ -1,13 +1,30 @@
|
|
|
1
|
+
import { Props as GiButtonProps } from '../atoms/Button.js';
|
|
2
|
+
import * as React from 'react';
|
|
1
3
|
export declare const ButtonVariants: readonly ["primary", "secondary", "flat"];
|
|
2
4
|
export type ButtonVariant = (typeof ButtonVariants)[number];
|
|
3
5
|
export type ButtonAppearance = 'default' | 'dark' | 'light';
|
|
4
|
-
export type ButtonSize = 'medium' | 'small' | 'large'
|
|
5
|
-
export type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
6
|
-
|
|
7
|
-
appearance?: ButtonAppearance;
|
|
8
|
-
size?: ButtonSize;
|
|
9
|
-
form?: string;
|
|
10
|
-
value?: string;
|
|
11
|
-
className?: string;
|
|
6
|
+
export type ButtonSize = 'medium' | 'small' | 'large';
|
|
7
|
+
export type ButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-checked' | 'aria-pressed' | 'aria-expanded' | 'aria-controls' | 'aria-haspopup' | 'aria-busy'> & GiButtonProps & {
|
|
8
|
+
/** @deprecated Use dataTestId instead */
|
|
12
9
|
dataTestid?: string;
|
|
10
|
+
/** @deprecated Use dataTestId instead */
|
|
11
|
+
'data-testid'?: string;
|
|
12
|
+
/** @deprecated Use ariaLabel instead */
|
|
13
|
+
'aria-label'?: string;
|
|
14
|
+
/** @deprecated Use ariaLabelledBy instead */
|
|
15
|
+
'aria-labelledby'?: string;
|
|
16
|
+
/** @deprecated Use ariaDescribedBy instead */
|
|
17
|
+
'aria-describedby'?: string;
|
|
18
|
+
/** @deprecated Use ariaChecked instead */
|
|
19
|
+
'aria-checked'?: boolean | 'true' | 'false' | 'mixed';
|
|
20
|
+
/** @deprecated Use ariaPressed instead */
|
|
21
|
+
'aria-pressed'?: boolean | 'true' | 'false' | 'mixed';
|
|
22
|
+
/** @deprecated Use ariaExpanded instead */
|
|
23
|
+
'aria-expanded'?: boolean | 'true' | 'false';
|
|
24
|
+
/** @deprecated Use ariaControls instead */
|
|
25
|
+
'aria-controls'?: string;
|
|
26
|
+
/** @deprecated Use ariaHasPopup instead */
|
|
27
|
+
'aria-haspopup'?: boolean | 'true' | 'false' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
|
|
28
|
+
/** @deprecated Use ariaBusy instead */
|
|
29
|
+
'aria-busy'?: boolean | 'true' | 'false';
|
|
13
30
|
};
|
|
@@ -1,95 +1,93 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
3
3
|
import { createContext as G, useState as V, useEffect as k, useContext as w } from "react";
|
|
4
|
-
import
|
|
4
|
+
import S from "../atoms/Button.js";
|
|
5
5
|
import { cn as g } from "../cn.js";
|
|
6
6
|
import { useDomId as j } from "../hooks/use-dom-id.js";
|
|
7
|
-
const
|
|
7
|
+
const y = G(
|
|
8
8
|
void 0
|
|
9
9
|
), D = ({
|
|
10
|
-
value:
|
|
10
|
+
value: o,
|
|
11
11
|
children: s,
|
|
12
12
|
role: d,
|
|
13
13
|
"aria-checked": e,
|
|
14
|
-
"aria-label":
|
|
15
|
-
...t
|
|
14
|
+
"aria-label": n
|
|
16
15
|
}) => {
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
16
|
+
const t = w(y);
|
|
17
|
+
if (!t)
|
|
19
18
|
throw new Error("ButtonGroupItem must be used within a ButtonGroup");
|
|
20
19
|
const {
|
|
21
|
-
selectedValue:
|
|
22
|
-
setSelectedValue:
|
|
23
|
-
size:
|
|
24
|
-
onChange:
|
|
20
|
+
selectedValue: a,
|
|
21
|
+
setSelectedValue: u,
|
|
22
|
+
size: l,
|
|
23
|
+
onChange: r,
|
|
25
24
|
groupId: m,
|
|
26
25
|
appearance: p
|
|
27
|
-
} =
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
return /* @__PURE__ */
|
|
26
|
+
} = t, i = a === o, c = () => {
|
|
27
|
+
u(o), r == null || r(o);
|
|
28
|
+
}, b = `${m}-${o}`;
|
|
29
|
+
return /* @__PURE__ */ f(
|
|
31
30
|
S,
|
|
32
31
|
{
|
|
33
32
|
variant: i ? "primary" : "secondary",
|
|
34
|
-
size:
|
|
33
|
+
size: l,
|
|
35
34
|
appearance: p,
|
|
36
|
-
onClick:
|
|
37
|
-
id:
|
|
35
|
+
onClick: c,
|
|
36
|
+
id: b,
|
|
38
37
|
role: d || "radio",
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
ariaChecked: e === void 0 ? i : e,
|
|
39
|
+
ariaLabel: n,
|
|
41
40
|
type: "button",
|
|
42
|
-
...t,
|
|
43
41
|
children: s
|
|
44
42
|
}
|
|
45
43
|
);
|
|
46
44
|
}, N = ({
|
|
47
|
-
name:
|
|
45
|
+
name: o,
|
|
48
46
|
size: s = "medium",
|
|
49
47
|
appearance: d = "dark",
|
|
50
48
|
onChange: e,
|
|
51
|
-
defaultValue:
|
|
49
|
+
defaultValue: n,
|
|
52
50
|
value: t,
|
|
53
|
-
children:
|
|
54
|
-
role:
|
|
51
|
+
children: a,
|
|
52
|
+
role: u,
|
|
55
53
|
"aria-labelledby": l,
|
|
56
|
-
"aria-describedby":
|
|
57
|
-
className:
|
|
58
|
-
...
|
|
54
|
+
"aria-describedby": r,
|
|
55
|
+
className: m,
|
|
56
|
+
...p
|
|
59
57
|
}) => {
|
|
60
|
-
const [
|
|
61
|
-
|
|
62
|
-
), b = t === void 0 ?
|
|
58
|
+
const [i, c] = V(
|
|
59
|
+
n
|
|
60
|
+
), b = t === void 0 ? i : t;
|
|
63
61
|
k(() => {
|
|
64
|
-
t !== void 0 &&
|
|
62
|
+
t !== void 0 && c(t);
|
|
65
63
|
}, [t]);
|
|
66
|
-
const
|
|
67
|
-
t === void 0 &&
|
|
64
|
+
const I = (x) => {
|
|
65
|
+
t === void 0 && c(x), e == null || e(x);
|
|
68
66
|
}, B = j();
|
|
69
|
-
return /* @__PURE__ */
|
|
70
|
-
|
|
67
|
+
return /* @__PURE__ */ f(
|
|
68
|
+
y.Provider,
|
|
71
69
|
{
|
|
72
70
|
value: {
|
|
73
71
|
selectedValue: b,
|
|
74
|
-
setSelectedValue:
|
|
75
|
-
name:
|
|
72
|
+
setSelectedValue: I,
|
|
73
|
+
name: o,
|
|
76
74
|
size: s,
|
|
77
75
|
onChange: e,
|
|
78
76
|
groupId: B,
|
|
79
77
|
appearance: d,
|
|
80
|
-
...
|
|
78
|
+
...p
|
|
81
79
|
},
|
|
82
|
-
children: /* @__PURE__ */
|
|
80
|
+
children: /* @__PURE__ */ f(
|
|
83
81
|
"div",
|
|
84
82
|
{
|
|
85
83
|
className: g(
|
|
86
84
|
"gi-flex gi-flex-wrap gi-gap-3 [&_button]:gi-min-w-12 [&_button]:gi-justify-center",
|
|
87
|
-
|
|
85
|
+
m
|
|
88
86
|
),
|
|
89
|
-
role:
|
|
87
|
+
role: u || "radiogroup",
|
|
90
88
|
"aria-labelledby": l,
|
|
91
|
-
"aria-describedby":
|
|
92
|
-
children:
|
|
89
|
+
"aria-describedby": r,
|
|
90
|
+
children: a
|
|
93
91
|
}
|
|
94
92
|
)
|
|
95
93
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Props as ButtonProps } from '../atoms/Button';
|
|
3
3
|
export type ButtonGroupProps = PropsWithChildren<{
|
|
4
4
|
name: string;
|
|
5
|
-
size?:
|
|
6
|
-
appearance?:
|
|
5
|
+
size?: ButtonProps['size'];
|
|
6
|
+
appearance?: ButtonProps['appearance'];
|
|
7
7
|
onChange?: (value: string) => void;
|
|
8
8
|
defaultValue?: string;
|
|
9
9
|
value?: string;
|
|
@@ -22,8 +22,8 @@ export type ButtonGroupContextType = {
|
|
|
22
22
|
selectedValue?: string;
|
|
23
23
|
setSelectedValue: (value: string) => void;
|
|
24
24
|
name: string;
|
|
25
|
-
size:
|
|
26
|
-
appearance?:
|
|
25
|
+
size: ButtonProps['size'];
|
|
26
|
+
appearance?: ButtonProps['appearance'];
|
|
27
27
|
onChange?: (value: string) => void;
|
|
28
28
|
groupId: string;
|
|
29
29
|
};
|
package/dist/card/card-legacy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import k from "../atoms/Button.js";
|
|
3
3
|
import { translate as c } from "../i18n/utility.js";
|
|
4
4
|
import { Link as u } from "../link/link.js";
|
|
5
5
|
import { CardNext as b, CardMedia as L, CardContainer as T, CardHeader as V, CardTitle as $, CardSubtitle as j, CardTag as A, CardDescription as B, CardAction as H } from "./card-next.js";
|
package/dist/card/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ReactElement } from 'react';
|
|
2
|
-
import { ButtonProps } from '../
|
|
2
|
+
import { Props as ButtonProps } from '../atoms/Button';
|
|
3
3
|
import { IconProps } from '../icon/icon.js';
|
|
4
4
|
import { LinkProps } from '../link/link.js';
|
|
5
5
|
import { TagProps } from '../tag/tag.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as n, jsx as a } from "react/jsx-runtime";
|
|
3
3
|
import { useState as u, useId as j, useEffect as q } from "react";
|
|
4
|
-
import
|
|
4
|
+
import B from "../atoms/Button.js";
|
|
5
5
|
import { cn as x } from "../cn.js";
|
|
6
6
|
import { translate as N } from "../i18n/utility.js";
|
|
7
7
|
import { Icon as D } from "../icon/icon.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as d, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as A, Children as L, isValidElement as O } from "react";
|
|
3
3
|
import { c as P } from "../index-CB-zPpNk.js";
|
|
4
|
-
import
|
|
4
|
+
import w from "../atoms/Button.js";
|
|
5
5
|
import { Chip as S } from "../chip/chip.js";
|
|
6
6
|
import { cn as n } from "../cn.js";
|
|
7
7
|
import { translate as x } from "../i18n/utility.js";
|
package/dist/drawer/drawer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, ReactElement } from 'react';
|
|
2
|
-
import { ButtonProps } from '../
|
|
2
|
+
import { Props as ButtonProps } from '../atoms/Button';
|
|
3
3
|
import { ModalProps, ModalWrapperProps } from '../modal/types.js';
|
|
4
4
|
type DrawerChildren = Array<ReactElement<typeof DrawerBody | typeof DrawerBody>> | ReactElement<typeof Fragment>;
|
|
5
5
|
export type DrawerPosition = 'left' | 'right' | 'bottom';
|
package/dist/drawer/drawer.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx as a, jsxs as x, Fragment as C } from "react/jsx-runtime";
|
|
|
3
3
|
import { useState as D, cloneElement as O } from "react";
|
|
4
4
|
import { cn as l } from "../cn.js";
|
|
5
5
|
import { ModalBody as u, ModalFooter as j, ModalWrapper as v } from "../modal/modal.js";
|
|
6
|
-
const
|
|
6
|
+
const T = ({
|
|
7
7
|
children: o,
|
|
8
8
|
className: e,
|
|
9
9
|
...r
|
|
@@ -15,29 +15,29 @@ const h = ({
|
|
|
15
15
|
...r,
|
|
16
16
|
children: o
|
|
17
17
|
}
|
|
18
|
-
),
|
|
18
|
+
), h = ({
|
|
19
19
|
children: o,
|
|
20
20
|
triggerButton: e,
|
|
21
21
|
startsOpen: r,
|
|
22
|
-
closeButtonLabel:
|
|
22
|
+
closeButtonLabel: i,
|
|
23
23
|
position: t = "right",
|
|
24
24
|
className: f
|
|
25
25
|
}) => {
|
|
26
26
|
const [d, s] = D(!!r), m = () => s(!0), w = () => s(!1), b = O(e, {
|
|
27
|
-
|
|
27
|
+
dataTestId: "drawer-trigger-button-container",
|
|
28
28
|
onClick: (y) => {
|
|
29
|
-
var c,
|
|
30
|
-
const n = typeof ((c = e == null ? void 0 : e.props) == null ? void 0 : c.onClick) == "function" ? (
|
|
29
|
+
var c, p;
|
|
30
|
+
const n = typeof ((c = e == null ? void 0 : e.props) == null ? void 0 : c.onClick) == "function" ? (p = e == null ? void 0 : e.props) == null ? void 0 : p.onClick : void 0;
|
|
31
31
|
n && n(y), m();
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
return /* @__PURE__ */ x(C, { children: [
|
|
35
35
|
b,
|
|
36
36
|
/* @__PURE__ */ a(
|
|
37
|
-
|
|
37
|
+
T,
|
|
38
38
|
{
|
|
39
39
|
children: o,
|
|
40
|
-
closeButtonLabel:
|
|
40
|
+
closeButtonLabel: i,
|
|
41
41
|
position: t,
|
|
42
42
|
className: f,
|
|
43
43
|
isOpen: d,
|
|
@@ -46,12 +46,12 @@ const h = ({
|
|
|
46
46
|
)
|
|
47
47
|
] });
|
|
48
48
|
};
|
|
49
|
-
Object.defineProperty(
|
|
49
|
+
Object.defineProperty(h, "componentType", {
|
|
50
50
|
value: "Drawer",
|
|
51
51
|
writable: !1,
|
|
52
52
|
enumerable: !1
|
|
53
53
|
});
|
|
54
|
-
const
|
|
54
|
+
const k = ({ children: o, className: e }) => /* @__PURE__ */ a(
|
|
55
55
|
u,
|
|
56
56
|
{
|
|
57
57
|
includeModalClass: !1,
|
|
@@ -62,24 +62,24 @@ const F = ({ children: o, className: e }) => /* @__PURE__ */ a(
|
|
|
62
62
|
children: o
|
|
63
63
|
}
|
|
64
64
|
);
|
|
65
|
-
Object.defineProperty(
|
|
65
|
+
Object.defineProperty(k, "componentType", {
|
|
66
66
|
value: "DrawerBody",
|
|
67
67
|
writable: !1,
|
|
68
68
|
enumerable: !1
|
|
69
69
|
});
|
|
70
|
-
const
|
|
70
|
+
const F = ({
|
|
71
71
|
children: o,
|
|
72
72
|
className: e,
|
|
73
73
|
stacked: r
|
|
74
74
|
}) => /* @__PURE__ */ a(j, { stacked: r, className: l("gi-drawer-footer", e), children: o });
|
|
75
|
-
Object.defineProperty(
|
|
75
|
+
Object.defineProperty(F, "componentType", {
|
|
76
76
|
value: "DrawerFooter",
|
|
77
77
|
writable: !1,
|
|
78
78
|
enumerable: !1
|
|
79
79
|
});
|
|
80
80
|
export {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
h as Drawer,
|
|
82
|
+
k as DrawerBody,
|
|
83
|
+
F as DrawerFooter,
|
|
84
|
+
T as DrawerWrapper
|
|
85
85
|
};
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
const
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { c as s } from "../index-CB-zPpNk.js";
|
|
3
|
+
const l = {
|
|
4
4
|
Small: "sm",
|
|
5
5
|
Medium: "md",
|
|
6
6
|
Large: "lg"
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
variants: {
|
|
10
|
-
size: {
|
|
11
|
-
sm: "gi-error-text-sm",
|
|
12
|
-
md: "gi-error-text-md",
|
|
13
|
-
lg: "gi-error-text-lg"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
defaultVariants: {
|
|
17
|
-
size: "md"
|
|
18
|
-
}
|
|
19
|
-
}), x = ({
|
|
20
|
-
text: r,
|
|
7
|
+
}, d = ({
|
|
8
|
+
text: t,
|
|
21
9
|
className: e,
|
|
22
|
-
size:
|
|
10
|
+
size: r = l.Medium,
|
|
23
11
|
dataTestid: i,
|
|
24
|
-
children:
|
|
25
|
-
...
|
|
26
|
-
}) => /* @__PURE__ */
|
|
12
|
+
children: a,
|
|
13
|
+
...o
|
|
14
|
+
}) => /* @__PURE__ */ m(
|
|
27
15
|
"div",
|
|
28
16
|
{
|
|
29
17
|
role: "alert",
|
|
30
|
-
className:
|
|
18
|
+
className: n({ size: r, className: e }),
|
|
31
19
|
"data-testid": i,
|
|
32
|
-
...
|
|
33
|
-
children:
|
|
20
|
+
...o,
|
|
21
|
+
children: a ?? t
|
|
34
22
|
}
|
|
35
23
|
);
|
|
36
|
-
|
|
24
|
+
d.displayName = "ErrorText";
|
|
25
|
+
const n = s({
|
|
26
|
+
base: "gi-font-normal gi-text-color-text-intent-error-default",
|
|
27
|
+
variants: {
|
|
28
|
+
size: {
|
|
29
|
+
sm: "gi-text-sm",
|
|
30
|
+
md: "gi-text-md",
|
|
31
|
+
lg: "gi-text-lg"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
size: "md"
|
|
36
|
+
}
|
|
37
|
+
});
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
l as ErrorSize,
|
|
40
|
+
d as ErrorText
|
|
40
41
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as l, jsxs as
|
|
2
|
+
import { jsx as l, jsxs as d, Fragment as x } from "react/jsx-runtime";
|
|
3
3
|
import { S as p } from "../../index-D_wwt4P0.js";
|
|
4
|
-
import { createContext as
|
|
5
|
-
import { cn as
|
|
4
|
+
import { createContext as v, useContext as N, Children as C } from "react";
|
|
5
|
+
import { cn as s } from "../../cn.js";
|
|
6
6
|
import { ErrorText as L } from "../../error-text/error-text.js";
|
|
7
7
|
import { HintText as E } from "../../hint-text/hint-text.js";
|
|
8
8
|
import { Label as H, styles as P } from "../../label/label.js";
|
|
9
9
|
import { getSpecialComponentType as F, isSpecialComponent as w } from "../../utils/utilities.js";
|
|
10
|
-
const f =
|
|
10
|
+
const f = v(null);
|
|
11
11
|
function b(e) {
|
|
12
|
-
|
|
12
|
+
N(f) || console.error(`[${e}] must be used within a <FormField>.`);
|
|
13
13
|
}
|
|
14
14
|
const U = (e) => ["error", "hint", "label"].some((r) => r in e) ? (console.warn(
|
|
15
15
|
"[FormField] Using legacy props. Please migrate to the new composable API."
|
|
16
|
-
), /* @__PURE__ */ l(f.Provider, { value: !0, children: /* @__PURE__ */
|
|
16
|
+
), /* @__PURE__ */ l(f.Provider, { value: !0, children: /* @__PURE__ */ d(y, { ...e, children: [
|
|
17
17
|
e.label && /* @__PURE__ */ l(u, { ...e.label }),
|
|
18
18
|
e.hint && /* @__PURE__ */ l(h, { ...e.hint }),
|
|
19
19
|
e.error && /* @__PURE__ */ l(g, { ...e.error }),
|
|
@@ -25,31 +25,31 @@ const U = (e) => ["error", "hint", "label"].some((r) => r in e) ? (console.warn(
|
|
|
25
25
|
}) => {
|
|
26
26
|
const r = C.toArray(e), n = r.find(
|
|
27
27
|
(t) => F(t) === "FormFieldLabel"
|
|
28
|
-
),
|
|
28
|
+
), m = r.find(
|
|
29
29
|
(t) => F(t) === "FormFieldHint"
|
|
30
30
|
), a = r.find(
|
|
31
31
|
(t) => F(t) === "FormFieldError"
|
|
32
|
-
),
|
|
32
|
+
), c = r.filter(
|
|
33
33
|
(t) => !w(t, [
|
|
34
34
|
"FormFieldLabel",
|
|
35
35
|
"FormFieldHint",
|
|
36
36
|
"FormFieldError"
|
|
37
37
|
])
|
|
38
38
|
);
|
|
39
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ d(
|
|
40
40
|
"fieldset",
|
|
41
41
|
{
|
|
42
|
-
className:
|
|
42
|
+
className: s({ "gi-error-state": !!a }, i),
|
|
43
43
|
...o,
|
|
44
44
|
children: [
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ d("div", { className: "gi-pb-3 gi-flex gi-flex-col gi-gap-1", children: [
|
|
46
|
+
/* @__PURE__ */ d("div", { children: [
|
|
47
47
|
n,
|
|
48
|
-
|
|
48
|
+
m
|
|
49
49
|
] }),
|
|
50
50
|
a
|
|
51
51
|
] }),
|
|
52
|
-
/* @__PURE__ */ l(p, { children:
|
|
52
|
+
/* @__PURE__ */ l(p, { children: c })
|
|
53
53
|
]
|
|
54
54
|
}
|
|
55
55
|
);
|
|
@@ -59,32 +59,31 @@ const U = (e) => ["error", "hint", "label"].some((r) => r in e) ? (console.warn(
|
|
|
59
59
|
size: o,
|
|
60
60
|
htmlFor: r,
|
|
61
61
|
className: n,
|
|
62
|
-
secondaryLabel:
|
|
62
|
+
secondaryLabel: m,
|
|
63
63
|
...a
|
|
64
64
|
}) => {
|
|
65
65
|
b("FormFieldLabel");
|
|
66
|
-
const
|
|
66
|
+
const c = /* @__PURE__ */ d(x, { children: [
|
|
67
67
|
i ?? e,
|
|
68
|
-
|
|
68
|
+
m ? /* @__PURE__ */ l("span", { className: "gi-secondary-label", children: m }) : null
|
|
69
69
|
] });
|
|
70
70
|
return r ? /* @__PURE__ */ l(
|
|
71
71
|
H,
|
|
72
72
|
{
|
|
73
73
|
size: o,
|
|
74
74
|
htmlFor: r,
|
|
75
|
-
className:
|
|
75
|
+
className: s("gi-font-bold", n),
|
|
76
76
|
...a,
|
|
77
|
-
children:
|
|
77
|
+
children: c
|
|
78
78
|
}
|
|
79
79
|
) : /* @__PURE__ */ l(
|
|
80
80
|
"legend",
|
|
81
81
|
{
|
|
82
|
-
className: P({
|
|
83
|
-
|
|
84
|
-
className: d("gi-font-bold", n)
|
|
82
|
+
className: P({ size: o }).base({
|
|
83
|
+
className: s("gi-font-bold", n)
|
|
85
84
|
}),
|
|
86
85
|
...a,
|
|
87
|
-
children:
|
|
86
|
+
children: c
|
|
88
87
|
}
|
|
89
88
|
);
|
|
90
89
|
};
|
|
@@ -94,7 +93,7 @@ Object.defineProperty(u, "componentType", {
|
|
|
94
93
|
enumerable: !1
|
|
95
94
|
});
|
|
96
95
|
u.displayName = "FormFieldLabel";
|
|
97
|
-
const h = ({ children: e, text: i, size: o, className: r }) => (b("FormFieldHint"), /* @__PURE__ */ l(E, { text: i, size: o, className:
|
|
96
|
+
const h = ({ children: e, text: i, size: o, className: r }) => (b("FormFieldHint"), /* @__PURE__ */ l(E, { text: i, size: o, className: r, children: e }));
|
|
98
97
|
Object.defineProperty(h, "componentType", {
|
|
99
98
|
value: "FormFieldHint",
|
|
100
99
|
writable: !1,
|
|
@@ -112,7 +111,7 @@ const g = ({
|
|
|
112
111
|
{
|
|
113
112
|
text: i,
|
|
114
113
|
size: o,
|
|
115
|
-
className:
|
|
114
|
+
className: s("gi-mb-1", r),
|
|
116
115
|
...n,
|
|
117
116
|
children: e
|
|
118
117
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import c from "../../Heading.js";
|
|
3
|
-
import
|
|
3
|
+
import h from "../../atoms/Button.js";
|
|
4
4
|
import { translate as a } from "../../i18n/utility.js";
|
|
5
5
|
import { IconButton as d } from "../../icon-button/icon-button.js";
|
|
6
6
|
import { InputText as m } from "../../input-text/input-text.js";
|
|
@@ -35,7 +35,7 @@ function b({
|
|
|
35
35
|
/* @__PURE__ */ e("div", { className: "gi-ml-1 gi-flex-none gi-hidden md:gi-block", children: /* @__PURE__ */ e(
|
|
36
36
|
h,
|
|
37
37
|
{
|
|
38
|
-
|
|
38
|
+
ariaLabel: a("header.submitSearch", {
|
|
39
39
|
defaultValue: "Submit Search"
|
|
40
40
|
}),
|
|
41
41
|
children: a("header.search", { defaultValue: "Search" })
|
|
@@ -1,30 +1,36 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
const
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { c as o } from "../index-CB-zPpNk.js";
|
|
3
|
+
const n = {
|
|
4
4
|
Small: "sm",
|
|
5
5
|
Medium: "md",
|
|
6
6
|
Large: "lg"
|
|
7
|
-
},
|
|
8
|
-
|
|
7
|
+
}, r = ({
|
|
8
|
+
text: t,
|
|
9
|
+
children: e,
|
|
10
|
+
className: i,
|
|
11
|
+
size: m = n.Medium,
|
|
12
|
+
...s
|
|
13
|
+
}) => /* @__PURE__ */ a(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
className: l({ size: m, className: i }),
|
|
17
|
+
"data-testid": "hint-text",
|
|
18
|
+
...s,
|
|
19
|
+
children: e ?? t
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
r.displayName = "HintText";
|
|
23
|
+
const l = o({
|
|
24
|
+
base: "gi-font-normal gi-text-color-text-system-neutral-muted gi-stroke-color-text-system-neutral-muted gi-mb-0",
|
|
9
25
|
variants: {
|
|
10
26
|
size: {
|
|
11
|
-
sm: "gi-
|
|
12
|
-
md: "gi-
|
|
13
|
-
lg: "gi-
|
|
27
|
+
sm: "gi-text-sm",
|
|
28
|
+
md: "gi-text-md",
|
|
29
|
+
lg: "gi-text-lg"
|
|
14
30
|
}
|
|
15
|
-
},
|
|
16
|
-
defaultVariants: {
|
|
17
|
-
size: "md"
|
|
18
31
|
}
|
|
19
|
-
})
|
|
20
|
-
text: t,
|
|
21
|
-
children: i,
|
|
22
|
-
className: e,
|
|
23
|
-
size: m = d.Medium,
|
|
24
|
-
...s
|
|
25
|
-
}) => /* @__PURE__ */ n("div", { className: l({ size: m, className: e }), ...s, children: i ?? t });
|
|
26
|
-
r.displayName = "HintText";
|
|
32
|
+
});
|
|
27
33
|
export {
|
|
28
|
-
|
|
34
|
+
n as HintSize,
|
|
29
35
|
r as HintText
|
|
30
36
|
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { ButtonProps } from '../button/types.js';
|
|
2
2
|
import { IconProps } from '../icon/icon.js';
|
|
3
|
-
export type IconButtonProps = Omit<ButtonProps, 'children'> & {
|
|
3
|
+
export type IconButtonProps = Omit<ButtonProps, 'children' | 'size'> & {
|
|
4
4
|
icon: Omit<IconProps, 'size'>;
|
|
5
5
|
className?: string;
|
|
6
|
+
size?: 'medium' | 'small' | 'large' | 'extraLarge';
|
|
6
7
|
};
|
|
7
|
-
export declare const IconButton: import('react').ForwardRefExoticComponent<Omit<
|
|
8
|
-
icon: Omit<IconProps, "size">;
|
|
9
|
-
className?: string;
|
|
10
|
-
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
export declare const IconButton: import('react').ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export { type BreadcrumbLinkProps, type BreadcrumbProps, } from './breadcrumbs/t
|
|
|
11
11
|
export { ButtonGroup, ButtonGroupItem } from './button-group/button-group.js';
|
|
12
12
|
export * from './button-group/types.js';
|
|
13
13
|
export { Button } from './button/button.js';
|
|
14
|
-
export {
|
|
14
|
+
export type { ButtonProps } from './button/types';
|
|
15
15
|
export { CardAction, CardContainer, CardDescription, CardHeader, CardMedia, CardSubtitle, CardTag, CardTitle, } from './card/card-next.js';
|
|
16
16
|
export { Card } from './card/card.js';
|
|
17
17
|
export type { CardActionProps, CardContainerProps, CardDescriptionProps, CardHeaderProps, CardMediaProps, CardProps, } from './card/types.js';
|