@ogcio/design-system-react 1.28.0 → 1.30.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/README.md +11 -33
- package/dist/alert/variants.d.ts +78 -2
- package/dist/assets/logos/LogoBlack.d.ts +3 -0
- package/dist/assets/logos/LogoBlack.js +322 -0
- package/dist/assets/logos/LogoGoldGreen.d.ts +3 -0
- package/dist/assets/logos/LogoGoldGreen.js +322 -0
- package/dist/assets/logos/LogoGoldWhite.d.ts +3 -0
- package/dist/assets/logos/LogoGoldWhite.js +82 -0
- package/dist/assets/logos/LogoHarpBlack.d.ts +3 -0
- package/dist/assets/logos/{harp/harp-white.js → LogoHarpBlack.js} +24 -21
- package/dist/assets/logos/LogoHarpWhite.d.ts +3 -0
- package/dist/assets/logos/LogoHarpWhite.js +60 -0
- package/dist/assets/logos/LogoWhite.d.ts +3 -0
- package/dist/assets/logos/LogoWhite.js +322 -0
- package/dist/assets/logos/index.d.ts +6 -0
- package/dist/assets/logos/index.js +14 -0
- package/dist/atoms/DsButton.d.ts +194 -0
- package/dist/atoms/DsButton.js +329 -0
- package/dist/atoms/icons/Close.d.ts +3 -0
- package/dist/atoms/icons/Close.js +22 -0
- package/dist/atoms/icons/KeyboardArrowDown.d.ts +3 -0
- package/dist/atoms/icons/KeyboardArrowDown.js +22 -0
- package/dist/atoms/icons/KeyboardArrowUp.d.ts +3 -0
- package/dist/atoms/icons/KeyboardArrowUp.js +22 -0
- package/dist/atoms/icons/Visibility.d.ts +3 -0
- package/dist/atoms/icons/Visibility.js +22 -0
- package/dist/atoms/icons/VisibilityOff.d.ts +3 -0
- package/dist/atoms/icons/VisibilityOff.js +22 -0
- package/dist/atoms/icons/index.d.ts +6 -0
- package/dist/atoms/icons/index.js +12 -0
- package/dist/atoms/icons/types.d.ts +10 -0
- package/dist/atoms/icons/types.js +1 -0
- package/dist/atoms/index.d.ts +2 -0
- package/dist/atoms/index.js +14 -0
- package/dist/autocomplete/autocomplete.js +131 -115
- package/dist/combo-box/dropdown-item.js +39 -40
- package/dist/data-table/data-table-footer.js +57 -51
- package/dist/data-table/data-table-header.d.ts +7 -7
- package/dist/data-table/data-table-header.js +97 -110
- package/dist/data-table/data-table-selected-rows.d.ts +1 -0
- package/dist/data-table/data-table-selected-rows.js +15 -19
- package/dist/footer/footer.js +9 -9
- package/dist/forms/form-field/form-field.d.ts +2 -2
- package/dist/forms/form-field/form-field.js +40 -30
- package/dist/forms/form-field/types.d.ts +10 -3
- package/dist/header/components/header-slot.js +33 -32
- package/dist/header/header-legacy.js +41 -41
- package/dist/header/variants.d.ts +220 -20
- package/dist/heading/heading.d.ts +70 -2
- package/dist/hooks/use-breakpoint.js +15 -12
- package/dist/icon/icon.d.ts +10 -0
- package/dist/icon/icon.js +64 -52
- package/dist/icon/icons.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +174 -171
- package/dist/input-password/input-password.js +13 -12
- package/dist/input-text/input-text.js +18 -16
- package/dist/label/label.d.ts +43 -0
- package/dist/label/label.js +7 -6
- package/dist/modal/modal.js +8 -7
- package/dist/spinner/spinner.d.ts +30 -2
- package/dist/styles.css +12 -2
- package/dist/table/table.d.ts +22 -2
- package/dist/tabs/tab-item.d.ts +2 -2
- package/dist/text-input/text-input.d.ts +1 -1
- package/dist/textarea/textarea.js +27 -28
- package/dist/toast/ds-toast.d.ts +78 -2
- package/dist/utils/placeholder.d.ts +2 -0
- package/dist/utils/placeholder.js +24 -0
- package/fonts.css +10 -0
- package/package.json +21 -8
- package/dist/assets/logos/gov-of-ireland/harp-black.d.ts +0 -2
- package/dist/assets/logos/gov-of-ireland/harp-black.js +0 -322
- package/dist/assets/logos/gov-of-ireland/harp-gold-text-green.d.ts +0 -2
- package/dist/assets/logos/gov-of-ireland/harp-gold-text-green.js +0 -322
- package/dist/assets/logos/gov-of-ireland/harp-white.d.ts +0 -2
- package/dist/assets/logos/gov-of-ireland/harp-white.js +0 -322
- package/dist/assets/logos/harp/harp-black.d.ts +0 -2
- package/dist/assets/logos/harp/harp-black.js +0 -63
- package/dist/assets/logos/harp/harp-white.d.ts +0 -2
|
@@ -7,13 +7,6 @@ interface DataTableHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
showHeader?: boolean;
|
|
8
8
|
showFilter?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export declare const DataTableHeader: React.FC<DataTableHeaderProps>;
|
|
11
|
-
export declare const DataTableHeaderSearch: React.FC<DataTableHeaderTypeProps>;
|
|
12
|
-
export declare const DataTableHeaderActions: React.FC<DataTableHeaderTypeProps>;
|
|
13
|
-
export declare const DataTableHeaderFilter: React.FC<DataTableHeaderTypeProps>;
|
|
14
|
-
export declare const DataTableHeaderFilterContent: React.FC<DataTableHeaderTypeProps>;
|
|
15
|
-
export declare const DataTableHeaderFilterContentTitle: React.FC<DataTableHeaderTypeProps>;
|
|
16
|
-
export declare const DataTableHeaderFilterActions: React.FC<DataTableHeaderTypeProps>;
|
|
17
10
|
type DataTableHeaderFilterListProps = {
|
|
18
11
|
filters: {
|
|
19
12
|
id: string;
|
|
@@ -23,5 +16,12 @@ type DataTableHeaderFilterListProps = {
|
|
|
23
16
|
onClear?: () => void;
|
|
24
17
|
className?: string;
|
|
25
18
|
};
|
|
19
|
+
export declare const DataTableHeader: React.FC<DataTableHeaderProps>;
|
|
20
|
+
export declare const DataTableHeaderSearch: React.FC<DataTableHeaderTypeProps>;
|
|
21
|
+
export declare const DataTableHeaderActions: React.FC<DataTableHeaderTypeProps>;
|
|
22
|
+
export declare const DataTableHeaderFilter: React.FC<DataTableHeaderTypeProps>;
|
|
23
|
+
export declare const DataTableHeaderFilterContent: React.FC<DataTableHeaderTypeProps>;
|
|
24
|
+
export declare const DataTableHeaderFilterContentTitle: React.FC<DataTableHeaderTypeProps>;
|
|
25
|
+
export declare const DataTableHeaderFilterActions: React.FC<DataTableHeaderTypeProps>;
|
|
26
26
|
export declare const DataTableHeaderFilterList: React.FC<DataTableHeaderFilterListProps>;
|
|
27
27
|
export {};
|
|
@@ -1,137 +1,124 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { jsxs as d, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as A, Children as L, isValidElement as O } from "react";
|
|
3
|
+
import { c as P } from "../index-CB-zPpNk.js";
|
|
4
|
+
import { Button as w } from "../button/button.js";
|
|
5
|
+
import { Chip as S } from "../chip/chip.js";
|
|
6
|
+
import { cn as n } from "../cn.js";
|
|
7
|
+
import { translate as x } from "../i18n/utility.js";
|
|
8
|
+
const N = ({
|
|
8
9
|
children: e,
|
|
9
|
-
className:
|
|
10
|
-
showHeader:
|
|
11
|
-
showFilter:
|
|
12
|
-
...
|
|
10
|
+
className: t,
|
|
11
|
+
showHeader: a = !0,
|
|
12
|
+
showFilter: c = !0,
|
|
13
|
+
...p
|
|
13
14
|
}) => {
|
|
14
|
-
const { search:
|
|
15
|
-
let
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
}), { search:
|
|
15
|
+
const { search: s, filter: j, filterList: T, actions: C } = A(() => {
|
|
16
|
+
let b = null, y = null, H = null, D = null;
|
|
17
|
+
return L.forEach(e, (r) => {
|
|
18
|
+
o(r, f) ? b = r : o(r, g) ? y = r : o(r, u) ? H = r : o(r, m) && (D = r);
|
|
19
|
+
}), { search: b, filter: y, filterList: H, actions: D };
|
|
19
20
|
}, [e]);
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
return /* @__PURE__ */ d("div", { ...p, className: n(l.root(), t), children: [
|
|
22
|
+
a && /* @__PURE__ */ d("div", { className: l.headerRow(), children: [
|
|
23
|
+
s,
|
|
23
24
|
j,
|
|
24
|
-
|
|
25
|
+
C
|
|
25
26
|
] }),
|
|
26
|
-
|
|
27
|
+
T && c && /* @__PURE__ */ i("div", { className: l.filterListWrapper(), children: T })
|
|
27
28
|
] });
|
|
28
|
-
},
|
|
29
|
+
}, f = ({
|
|
29
30
|
children: e,
|
|
30
|
-
className:
|
|
31
|
-
...
|
|
32
|
-
}) => /* @__PURE__ */
|
|
31
|
+
className: t,
|
|
32
|
+
...a
|
|
33
|
+
}) => /* @__PURE__ */ i("div", { className: n(l.search(), t), ...a, children: e }), m = ({
|
|
33
34
|
children: e,
|
|
34
|
-
className:
|
|
35
|
-
...
|
|
36
|
-
}) => /* @__PURE__ */
|
|
35
|
+
className: t,
|
|
36
|
+
...a
|
|
37
|
+
}) => /* @__PURE__ */ i("div", { className: n(l.actions(), t), ...a, children: e }), g = ({
|
|
37
38
|
children: e,
|
|
38
|
-
className:
|
|
39
|
-
...
|
|
40
|
-
}) => /* @__PURE__ */
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
n.id
|
|
78
|
-
)),
|
|
79
|
-
/* @__PURE__ */ l(
|
|
80
|
-
x,
|
|
81
|
-
{
|
|
82
|
-
appearance: "dark",
|
|
83
|
-
size: "medium",
|
|
84
|
-
variant: "flat",
|
|
85
|
-
onClick: () => {
|
|
86
|
-
t == null || t();
|
|
87
|
-
},
|
|
88
|
-
children: g("dataTableHeader.clearAllFilters", {
|
|
89
|
-
defaultValue: "Clear all filters"
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
)
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
|
-
h.displayName = "DataTableHeader";
|
|
97
|
-
p.displayName = "DataTableHeaderSearch";
|
|
98
|
-
b.displayName = "DataTableHeaderActions";
|
|
99
|
-
m.displayName = "DataTableHeaderFilter";
|
|
100
|
-
T.displayName = "DataTableHeaderFilterList";
|
|
101
|
-
N.displayName = "DataTableHeaderFilterContent";
|
|
102
|
-
F.displayName = "DataTableHeaderFilterContentTitle";
|
|
103
|
-
v.displayName = "DataTableHeaderFilterActions";
|
|
104
|
-
Object.defineProperty(h, "componentType", {
|
|
39
|
+
className: t,
|
|
40
|
+
...a
|
|
41
|
+
}) => /* @__PURE__ */ i("div", { className: n(l.filter(), t), ...a, children: e }), F = ({ children: e, className: t, ...a }) => /* @__PURE__ */ i("div", { className: n(l.filterContent(), t), ...a, children: e }), v = ({ children: e, className: t, ...a }) => /* @__PURE__ */ i("div", { className: n(l.filterContentTitle(), t), ...a, children: e }), h = ({ children: e, className: t, ...a }) => /* @__PURE__ */ i("div", { className: n(l.filterActions(), t), ...a, children: e }), u = ({ filters: e, onRemove: t, onClear: a, className: c, ...p }) => !e || e.length === 0 ? null : /* @__PURE__ */ d("div", { className: n(l.filterList(), c), ...p, children: [
|
|
42
|
+
/* @__PURE__ */ i("span", { className: "gi-text-sm", children: x("dataTableHeader.filtersApplied", {
|
|
43
|
+
length: e.length,
|
|
44
|
+
defaultValue: `Filters applied ${e.length}:`
|
|
45
|
+
}) }),
|
|
46
|
+
e.map((s) => /* @__PURE__ */ i(
|
|
47
|
+
S,
|
|
48
|
+
{
|
|
49
|
+
onClose: () => t == null ? void 0 : t(s.id),
|
|
50
|
+
label: s.label
|
|
51
|
+
},
|
|
52
|
+
s.id
|
|
53
|
+
)),
|
|
54
|
+
/* @__PURE__ */ i(
|
|
55
|
+
w,
|
|
56
|
+
{
|
|
57
|
+
appearance: "dark",
|
|
58
|
+
size: "medium",
|
|
59
|
+
variant: "flat",
|
|
60
|
+
onClick: () => {
|
|
61
|
+
a == null || a();
|
|
62
|
+
},
|
|
63
|
+
children: x("dataTableHeader.clearAllFilters", {
|
|
64
|
+
defaultValue: "Clear all filters"
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] });
|
|
69
|
+
N.displayName = "DataTableHeader";
|
|
70
|
+
f.displayName = "DataTableHeaderSearch";
|
|
71
|
+
m.displayName = "DataTableHeaderActions";
|
|
72
|
+
g.displayName = "DataTableHeaderFilter";
|
|
73
|
+
u.displayName = "DataTableHeaderFilterList";
|
|
74
|
+
F.displayName = "DataTableHeaderFilterContent";
|
|
75
|
+
v.displayName = "DataTableHeaderFilterContentTitle";
|
|
76
|
+
h.displayName = "DataTableHeaderFilterActions";
|
|
77
|
+
Object.defineProperty(N, "componentType", {
|
|
105
78
|
value: "DataTableHeader"
|
|
106
79
|
});
|
|
107
|
-
Object.defineProperty(
|
|
80
|
+
Object.defineProperty(f, "componentType", {
|
|
108
81
|
value: "DataTableHeaderSearch"
|
|
109
82
|
});
|
|
110
|
-
Object.defineProperty(
|
|
83
|
+
Object.defineProperty(m, "componentType", {
|
|
111
84
|
value: "DataTableHeaderActions"
|
|
112
85
|
});
|
|
113
|
-
Object.defineProperty(
|
|
86
|
+
Object.defineProperty(g, "componentType", {
|
|
114
87
|
value: "DataTableHeaderFilter"
|
|
115
88
|
});
|
|
116
|
-
Object.defineProperty(
|
|
89
|
+
Object.defineProperty(u, "componentType", {
|
|
117
90
|
value: "DataTableHeaderFilterList"
|
|
118
91
|
});
|
|
119
|
-
Object.defineProperty(
|
|
92
|
+
Object.defineProperty(F, "componentType", {
|
|
120
93
|
value: "DataTableHeaderFilterContent"
|
|
121
94
|
});
|
|
122
|
-
Object.defineProperty(
|
|
95
|
+
Object.defineProperty(v, "componentType", {
|
|
123
96
|
value: "DataTableHeaderFilterContentTitle"
|
|
124
97
|
});
|
|
125
|
-
Object.defineProperty(
|
|
98
|
+
Object.defineProperty(h, "componentType", {
|
|
126
99
|
value: "DataTableHeaderFilterActions"
|
|
127
100
|
});
|
|
101
|
+
const l = P({
|
|
102
|
+
slots: {
|
|
103
|
+
root: "gi-flex gi-flex-wrap gi-items-center gi-w-full gi-gap-4 gi-mb-2",
|
|
104
|
+
headerRow: "gi-flex gi-flex-1 gi-gap-4 gi-items-center",
|
|
105
|
+
search: "gi-flex gi-flex-1",
|
|
106
|
+
filter: "gi-flex gi-items-center",
|
|
107
|
+
actions: "gi-flex gi-items-center gi-ml-auto gi-gap-4 gi-flex-shrink",
|
|
108
|
+
filterListWrapper: "gi-w-full",
|
|
109
|
+
filterList: "gi-flex gi-items-center gi-gap-2 gi-flex-wrap",
|
|
110
|
+
filterContentTitle: "gi-py-2 gi-font-medium",
|
|
111
|
+
filterContent: "gi-flex gi-flex-col gi-gap-2 gi-px-6 gi-py-4 gi-flex-1 gi-overflow-auto",
|
|
112
|
+
filterActions: "gi-flex gi-justify-end gi-gap-2 gi-p-6"
|
|
113
|
+
}
|
|
114
|
+
})(), o = (e, t) => O(e) && e.type === t;
|
|
128
115
|
export {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
116
|
+
N as DataTableHeader,
|
|
117
|
+
m as DataTableHeaderActions,
|
|
118
|
+
g as DataTableHeaderFilter,
|
|
119
|
+
h as DataTableHeaderFilterActions,
|
|
120
|
+
F as DataTableHeaderFilterContent,
|
|
121
|
+
v as DataTableHeaderFilterContentTitle,
|
|
122
|
+
u as DataTableHeaderFilterList,
|
|
123
|
+
f as DataTableHeaderSearch
|
|
137
124
|
};
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import { jsxs as r, jsx as
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { c as o } from "../index-CB-zPpNk.js";
|
|
2
3
|
import { cn as g } from "../cn.js";
|
|
3
|
-
import { translate as
|
|
4
|
-
const
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
count: e,
|
|
15
|
-
defaultValue: ` (${e} Row${e === 1 ? "" : "s"} selected)`
|
|
16
|
-
}) }),
|
|
17
|
-
/* @__PURE__ */ i("div", { className: "gi-flex gi-gap-4", children: t })
|
|
18
|
-
]
|
|
4
|
+
import { translate as m } from "../i18n/utility.js";
|
|
5
|
+
const p = ({ selectedCount: e, actions: s, className: a, ...l }) => /* @__PURE__ */ r("div", { className: g(i.root(), a), ...l, children: [
|
|
6
|
+
/* @__PURE__ */ t("span", { className: i.label(), children: m("dataTable.selectedRows", {
|
|
7
|
+
count: e,
|
|
8
|
+
defaultValue: ` (${e} Row${e === 1 ? "" : "s"} selected)`
|
|
9
|
+
}) }),
|
|
10
|
+
/* @__PURE__ */ t("div", { className: "gi-flex gi-gap-4", children: s })
|
|
11
|
+
] }), i = o({
|
|
12
|
+
slots: {
|
|
13
|
+
root: "gi-w-full gi-flex gi-items-center gi-justify-between gi-px-3 gi-py-2 gi-bg-gray-900 gi-rounded-md",
|
|
14
|
+
label: "gi-text-sm gi-font-medium gi-text-white"
|
|
19
15
|
}
|
|
20
|
-
);
|
|
16
|
+
})();
|
|
21
17
|
export {
|
|
22
|
-
|
|
18
|
+
p as DataTableSelectedRowsBanner
|
|
23
19
|
};
|
package/dist/footer/footer.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as i, jsx as t, Fragment as u } from "react/jsx-runtime";
|
|
3
3
|
import { renderToStaticMarkup as c } from "react-dom/server";
|
|
4
|
-
import h from "../assets/logos/
|
|
5
|
-
import
|
|
4
|
+
import { LogoGoldGreen as h } from "../assets/logos/LogoGoldGreen.js";
|
|
5
|
+
import { LogoHarpWhite as g } from "../assets/logos/LogoHarpWhite.js";
|
|
6
6
|
import { cn as v } from "../cn.js";
|
|
7
7
|
import { Container as b } from "../container/container.js";
|
|
8
8
|
import { translate as a } from "../i18n/utility.js";
|
|
9
|
-
import
|
|
10
|
-
import { SectionBreak as
|
|
9
|
+
import p from "../primitives/anchor.js";
|
|
10
|
+
import { SectionBreak as L } from "../section-break/section-break.js";
|
|
11
11
|
function l({ logo: e }) {
|
|
12
|
-
const n = `data:image/svg+xml;base64,${btoa(c(/* @__PURE__ */ t(
|
|
12
|
+
const n = `data:image/svg+xml;base64,${btoa(c(/* @__PURE__ */ t(g, {})))}`, s = `data:image/svg+xml;base64,${btoa(
|
|
13
13
|
c(/* @__PURE__ */ t(h, {}))
|
|
14
14
|
)}`;
|
|
15
15
|
return /* @__PURE__ */ i("picture", { children: [
|
|
@@ -24,7 +24,7 @@ function l({ logo: e }) {
|
|
|
24
24
|
)
|
|
25
25
|
] });
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function M({
|
|
28
28
|
primarySlot: e,
|
|
29
29
|
secondarySlot: o,
|
|
30
30
|
utilitySlot: n,
|
|
@@ -35,7 +35,7 @@ function H({
|
|
|
35
35
|
}) {
|
|
36
36
|
const f = () => /* @__PURE__ */ i(u, { children: [
|
|
37
37
|
(r == null ? void 0 : r.href) && /* @__PURE__ */ t(
|
|
38
|
-
|
|
38
|
+
p,
|
|
39
39
|
{
|
|
40
40
|
href: r.href,
|
|
41
41
|
"aria-label": a("footer.goToHomePage", {
|
|
@@ -69,7 +69,7 @@ function H({
|
|
|
69
69
|
}
|
|
70
70
|
),
|
|
71
71
|
e && o && /* @__PURE__ */ t(
|
|
72
|
-
|
|
72
|
+
L,
|
|
73
73
|
{
|
|
74
74
|
color: "gi-border-color-border-system-neutral-subtle",
|
|
75
75
|
size: "lg"
|
|
@@ -104,5 +104,5 @@ function H({
|
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
export {
|
|
107
|
-
|
|
107
|
+
M as Footer
|
|
108
108
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ErrorTextProps } from '../../error-text/types.js';
|
|
2
2
|
import { HintTextProps } from '../../hint-text/types.js';
|
|
3
|
-
import {
|
|
3
|
+
import { FormFieldLabelProps, FormFieldProps } from './types.js';
|
|
4
4
|
declare const FormField: (props: FormFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
declare const FormFieldLabel: {
|
|
6
|
-
({ children, text, size, htmlFor, className, secondaryLabel, ...props }:
|
|
6
|
+
({ children, text, size, htmlFor, className, secondaryLabel, ...props }: FormFieldLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
declare const FormFieldHint: {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as l, jsxs as
|
|
3
|
-
import { S as
|
|
4
|
-
import { createContext as
|
|
5
|
-
import { cn as
|
|
2
|
+
import { jsx as l, jsxs as m, Fragment as x } from "react/jsx-runtime";
|
|
3
|
+
import { S as p } from "../../index-D_wwt4P0.js";
|
|
4
|
+
import { createContext as N, useContext as v, Children as C } from "react";
|
|
5
|
+
import { cn as d } 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
|
-
import { Label as H } from "../../label/label.js";
|
|
9
|
-
import { getSpecialComponentType as F, isSpecialComponent as
|
|
10
|
-
const f =
|
|
8
|
+
import { Label as H, styles as P } from "../../label/label.js";
|
|
9
|
+
import { getSpecialComponentType as F, isSpecialComponent as w } from "../../utils/utilities.js";
|
|
10
|
+
const f = N(null);
|
|
11
11
|
function b(e) {
|
|
12
|
-
|
|
12
|
+
v(f) || console.error(`[${e}] must be used within a <FormField>.`);
|
|
13
13
|
}
|
|
14
|
-
const
|
|
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__ */ m(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 I = (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
|
+
), c = r.find(
|
|
29
29
|
(t) => F(t) === "FormFieldHint"
|
|
30
|
-
),
|
|
30
|
+
), a = r.find(
|
|
31
31
|
(t) => F(t) === "FormFieldError"
|
|
32
32
|
), s = r.filter(
|
|
33
|
-
(t) => !
|
|
33
|
+
(t) => !w(t, [
|
|
34
34
|
"FormFieldLabel",
|
|
35
35
|
"FormFieldHint",
|
|
36
36
|
"FormFieldError"
|
|
37
37
|
])
|
|
38
38
|
);
|
|
39
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ m(
|
|
40
40
|
"fieldset",
|
|
41
41
|
{
|
|
42
|
-
className:
|
|
42
|
+
className: d({ "gi-error-state": !!a }, i),
|
|
43
43
|
...o,
|
|
44
44
|
children: [
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ m("div", { className: "gi-pb-3 gi-flex gi-flex-col gi-gap-1", children: [
|
|
46
|
+
/* @__PURE__ */ m("div", { children: [
|
|
47
47
|
n,
|
|
48
|
-
|
|
48
|
+
c
|
|
49
49
|
] }),
|
|
50
|
-
|
|
50
|
+
a
|
|
51
51
|
] }),
|
|
52
|
-
/* @__PURE__ */ l(
|
|
52
|
+
/* @__PURE__ */ l(p, { children: s })
|
|
53
53
|
]
|
|
54
54
|
}
|
|
55
55
|
);
|
|
@@ -59,21 +59,31 @@ const I = (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:
|
|
63
|
-
...
|
|
62
|
+
secondaryLabel: c,
|
|
63
|
+
...a
|
|
64
64
|
}) => {
|
|
65
65
|
b("FormFieldLabel");
|
|
66
|
-
const s = /* @__PURE__ */
|
|
66
|
+
const s = /* @__PURE__ */ m(x, { children: [
|
|
67
67
|
i ?? e,
|
|
68
|
-
|
|
68
|
+
c ? /* @__PURE__ */ l("span", { className: "gi-secondary-label", children: c }) : null
|
|
69
69
|
] });
|
|
70
|
-
return /* @__PURE__ */ l(
|
|
70
|
+
return r ? /* @__PURE__ */ l(
|
|
71
71
|
H,
|
|
72
72
|
{
|
|
73
73
|
size: o,
|
|
74
74
|
htmlFor: r,
|
|
75
|
-
className:
|
|
76
|
-
...
|
|
75
|
+
className: d("gi-font-bold", n),
|
|
76
|
+
...a,
|
|
77
|
+
children: s
|
|
78
|
+
}
|
|
79
|
+
) : /* @__PURE__ */ l(
|
|
80
|
+
"legend",
|
|
81
|
+
{
|
|
82
|
+
className: P({
|
|
83
|
+
size: o,
|
|
84
|
+
className: d("gi-font-bold", n)
|
|
85
|
+
}),
|
|
86
|
+
...a,
|
|
77
87
|
children: s
|
|
78
88
|
}
|
|
79
89
|
);
|
|
@@ -84,7 +94,7 @@ Object.defineProperty(u, "componentType", {
|
|
|
84
94
|
enumerable: !1
|
|
85
95
|
});
|
|
86
96
|
u.displayName = "FormFieldLabel";
|
|
87
|
-
const h = ({ children: e, text: i, size: o, className: r }) => (b("FormFieldHint"), /* @__PURE__ */ l(E, { text: i, size: o, className:
|
|
97
|
+
const h = ({ children: e, text: i, size: o, className: r }) => (b("FormFieldHint"), /* @__PURE__ */ l(E, { text: i, size: o, className: d("gi-mb-1", r), children: e }));
|
|
88
98
|
Object.defineProperty(h, "componentType", {
|
|
89
99
|
value: "FormFieldHint",
|
|
90
100
|
writable: !1,
|
|
@@ -102,7 +112,7 @@ const g = ({
|
|
|
102
112
|
{
|
|
103
113
|
text: i,
|
|
104
114
|
size: o,
|
|
105
|
-
className:
|
|
115
|
+
className: d("gi-mb-1", r),
|
|
106
116
|
...n,
|
|
107
117
|
children: e
|
|
108
118
|
}
|
|
@@ -114,7 +124,7 @@ Object.defineProperty(g, "componentType", {
|
|
|
114
124
|
});
|
|
115
125
|
g.displayName = "FormFieldError";
|
|
116
126
|
export {
|
|
117
|
-
|
|
127
|
+
U as FormField,
|
|
118
128
|
g as FormFieldError,
|
|
119
129
|
h as FormFieldHint,
|
|
120
130
|
u as FormFieldLabel
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { FieldsetHTMLAttributes } from 'react';
|
|
1
|
+
import { FieldsetHTMLAttributes, PropsWithChildren } from 'react';
|
|
2
2
|
import { ErrorTextProps } from '../../error-text/types.js';
|
|
3
3
|
import { HintTextProps } from '../../hint-text/types.js';
|
|
4
|
-
import { LabelTextProps } from '../../label/types.js';
|
|
5
|
-
export type
|
|
4
|
+
import { LabelSizeType, LabelTextProps } from '../../label/types.js';
|
|
5
|
+
export type LegendProps = PropsWithChildren<React.HTMLAttributes<HTMLLegendElement> & {
|
|
6
|
+
text?: string | React.ReactElement;
|
|
7
|
+
size?: LabelSizeType;
|
|
8
|
+
secondaryLabel?: React.ReactNode;
|
|
9
|
+
htmlFor?: never;
|
|
10
|
+
}>;
|
|
11
|
+
export type LabelProps = LabelTextProps & {
|
|
6
12
|
secondaryLabel?: React.ReactNode;
|
|
7
13
|
};
|
|
14
|
+
export type FormFieldLabelProps = LabelProps | LegendProps;
|
|
8
15
|
export type FormFieldProps = {
|
|
9
16
|
/** @deprecated Use <FormFieldError> instead */
|
|
10
17
|
error?: ErrorTextProps;
|