@ogcio/design-system-react 1.12.3 → 1.12.4
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.
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as o, jsxs as n } from "react/jsx-runtime";
|
|
3
3
|
import { S as g } from "../../index-ntYL1VRC.js";
|
|
4
|
-
import { createContext as x, Children as
|
|
4
|
+
import { createContext as x, Children as v, useContext as L, isValidElement as C } from "react";
|
|
5
5
|
import { cn as m } from "../../cn.js";
|
|
6
|
-
import { ErrorText as
|
|
7
|
-
import { HintText as
|
|
6
|
+
import { ErrorText as E } from "../../error-text/error-text.js";
|
|
7
|
+
import { HintText as N } from "../../hint-text/hint-text.js";
|
|
8
8
|
import { Label as T } from "../../label/label.js";
|
|
9
9
|
const c = x(null);
|
|
10
|
-
function
|
|
11
|
-
|
|
10
|
+
function s(e) {
|
|
11
|
+
L(c) || console.error(`[${e}] must be used within a <FormField>.`);
|
|
12
12
|
}
|
|
13
13
|
function a(e) {
|
|
14
14
|
var r, i;
|
|
15
|
-
return
|
|
15
|
+
return C(e) && (((r = e.type) == null ? void 0 : r.componentType) || ((i = e.props) == null ? void 0 : i.__mdxType)) || null;
|
|
16
16
|
}
|
|
17
17
|
function H(e) {
|
|
18
18
|
return ["FormFieldLabel", "FormFieldHint", "FormFieldError"].includes(
|
|
@@ -21,17 +21,17 @@ function H(e) {
|
|
|
21
21
|
}
|
|
22
22
|
const _ = (e) => ["error", "hint", "label"].some((l) => l in e) ? (console.warn(
|
|
23
23
|
"[FormField] Using legacy props. Please migrate to the new composable API."
|
|
24
|
-
), /* @__PURE__ */ o(c.Provider, { value: !0, children: /* @__PURE__ */ n(y, {
|
|
24
|
+
), /* @__PURE__ */ o(c.Provider, { value: !0, children: /* @__PURE__ */ n(y, { ...e, children: [
|
|
25
25
|
e.label && /* @__PURE__ */ o(F, { ...e.label }),
|
|
26
26
|
e.hint && /* @__PURE__ */ o(u, { ...e.hint }),
|
|
27
27
|
e.error && /* @__PURE__ */ o(f, { ...e.error }),
|
|
28
28
|
e.children
|
|
29
|
-
] }) })) : /* @__PURE__ */ o(c.Provider, { value: !0, children: /* @__PURE__ */ o(y, {
|
|
29
|
+
] }) })) : /* @__PURE__ */ o(c.Provider, { value: !0, children: /* @__PURE__ */ o(y, { ...e, children: e.children }) }), y = ({
|
|
30
30
|
children: e,
|
|
31
31
|
className: r,
|
|
32
32
|
...i
|
|
33
33
|
}) => {
|
|
34
|
-
const l =
|
|
34
|
+
const l = v.toArray(e), d = l.find(
|
|
35
35
|
(t) => a(t) === "FormFieldLabel"
|
|
36
36
|
), p = l.find(
|
|
37
37
|
(t) => a(t) === "FormFieldHint"
|
|
@@ -46,7 +46,7 @@ const _ = (e) => ["error", "hint", "label"].some((l) => l in e) ? (console.warn(
|
|
|
46
46
|
children: [
|
|
47
47
|
/* @__PURE__ */ n("div", { className: "gi-pb-3 gi-flex gi-flex-col gi-gap-1", children: [
|
|
48
48
|
/* @__PURE__ */ n("div", { children: [
|
|
49
|
-
|
|
49
|
+
d,
|
|
50
50
|
p
|
|
51
51
|
] }),
|
|
52
52
|
b
|
|
@@ -60,14 +60,14 @@ const _ = (e) => ["error", "hint", "label"].some((l) => l in e) ? (console.warn(
|
|
|
60
60
|
text: r,
|
|
61
61
|
size: i,
|
|
62
62
|
htmlFor: l,
|
|
63
|
-
className:
|
|
64
|
-
}) => (
|
|
63
|
+
className: d
|
|
64
|
+
}) => (s("FormFieldLabel"), /* @__PURE__ */ o(
|
|
65
65
|
T,
|
|
66
66
|
{
|
|
67
67
|
text: r,
|
|
68
68
|
size: i,
|
|
69
69
|
htmlFor: l,
|
|
70
|
-
className: m("gi-font-bold",
|
|
70
|
+
className: m("gi-font-bold", d),
|
|
71
71
|
children: e
|
|
72
72
|
}
|
|
73
73
|
));
|
|
@@ -77,7 +77,7 @@ Object.defineProperty(F, "componentType", {
|
|
|
77
77
|
enumerable: !1
|
|
78
78
|
});
|
|
79
79
|
F.displayName = "FormFieldLabel";
|
|
80
|
-
const u = ({ children: e, text: r, size: i, className: l }) => (
|
|
80
|
+
const u = ({ children: e, text: r, size: i, className: l }) => (s("FormFieldHint"), /* @__PURE__ */ o(N, { text: r, size: i, className: m("gi-mb-1", l), children: e }));
|
|
81
81
|
Object.defineProperty(u, "componentType", {
|
|
82
82
|
value: "FormFieldHint",
|
|
83
83
|
writable: !1,
|
|
@@ -89,7 +89,7 @@ const f = ({
|
|
|
89
89
|
text: r,
|
|
90
90
|
size: i,
|
|
91
91
|
className: l
|
|
92
|
-
}) => (
|
|
92
|
+
}) => (s("FormFieldError"), /* @__PURE__ */ o(E, { text: r, size: i, className: m("gi-mb-1", l), children: e }));
|
|
93
93
|
Object.defineProperty(f, "componentType", {
|
|
94
94
|
value: "FormFieldError",
|
|
95
95
|
writable: !1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ogcio/design-system-react",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.4",
|
|
4
4
|
"description": "The GOV IE design system React components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"@ogcio/design-system-eslint-config": "1.2.5",
|
|
54
54
|
"@ogcio/design-system-prettier-config": "1.0.5",
|
|
55
55
|
"@ogcio/design-system-tailwind": "1.11.0",
|
|
56
|
-
"@ogcio/theme-
|
|
57
|
-
"@ogcio/theme-
|
|
56
|
+
"@ogcio/theme-govie": "1.5.3",
|
|
57
|
+
"@ogcio/theme-doete": "1.0.0"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"format": "prettier 'src/**/*.{ts,tsx}' --write",
|