@obosbbl/grunnmuren-react 1.14.7 → 1.14.8
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/grunnmuren.js +48 -45
- package/package.json +1 -1
package/dist/grunnmuren.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as o, jsxs as f, Fragment as O } from "react/jsx-runtime";
|
|
3
|
-
import { createContext as y, useContext as A, useState as q, useCallback as N, useEffect as fe, useId as
|
|
3
|
+
import { createContext as y, useContext as A, useState as q, useCallback as N, useEffect as fe, useId as ee, forwardRef as h, Children as Z, isValidElement as W, cloneElement as K, useRef as E, useMemo as C, useReducer as ge } from "react";
|
|
4
4
|
import { ChevronDown as te, Warning as re, InfoCircle as ne, LoadingSpinner as he, CheckCircle as pe, MenuAlt as Ae, Close as xe, ChevronRight as ve, ChevronLeft as Ne } from "@obosbbl/grunnmuren-icons";
|
|
5
5
|
import { useCollapse as ye } from "react-collapsed";
|
|
6
6
|
import c from "clsx";
|
|
7
7
|
import { useMediaQuery as ae, useUpdateEffect as we } from "@react-hookz/web";
|
|
8
|
-
import { mergeRefs as
|
|
8
|
+
import { mergeRefs as X } from "react-merge-refs";
|
|
9
9
|
const I = () => {
|
|
10
|
-
}, Ie = 300, Ce = "duration-300",
|
|
10
|
+
}, Ie = 300, Ce = "duration-300", Y = (e) => {
|
|
11
11
|
const { className: r, ...t } = e;
|
|
12
12
|
return /* @__PURE__ */ o("div", { className: c(r, "flex flex-col gap-2"), ...t });
|
|
13
|
-
},
|
|
13
|
+
}, Q = y({
|
|
14
14
|
isExpanded: !1,
|
|
15
15
|
setExpanded: I,
|
|
16
16
|
// @ts-expect-error noop
|
|
@@ -25,7 +25,7 @@ const I = () => {
|
|
|
25
25
|
duration: Ie,
|
|
26
26
|
easing: "cubic-bezier(0.25, 0.1, 0.25, 1)"
|
|
27
27
|
});
|
|
28
|
-
return /* @__PURE__ */ o(
|
|
28
|
+
return /* @__PURE__ */ o(Q.Provider, { value: { onChange: n, ...i }, children: /* @__PURE__ */ o(
|
|
29
29
|
"div",
|
|
30
30
|
{
|
|
31
31
|
className: c(
|
|
@@ -37,7 +37,7 @@ const I = () => {
|
|
|
37
37
|
}
|
|
38
38
|
) });
|
|
39
39
|
}, Se = (e) => {
|
|
40
|
-
const { children: r, className: t, as: n = "h3", ...a } = e, { getToggleProps: s, onChange: i, isExpanded: d } = A(
|
|
40
|
+
const { children: r, className: t, as: n = "h3", ...a } = e, { getToggleProps: s, onChange: i, isExpanded: d } = A(Q), u = s({ onClick: () => i(!d) });
|
|
41
41
|
return /* @__PURE__ */ o(n, { children: /* @__PURE__ */ f(
|
|
42
42
|
"button",
|
|
43
43
|
{
|
|
@@ -60,12 +60,12 @@ const I = () => {
|
|
|
60
60
|
}
|
|
61
61
|
) });
|
|
62
62
|
}, Re = (e) => {
|
|
63
|
-
const { getCollapseProps: r } = A(
|
|
63
|
+
const { getCollapseProps: r } = A(Q), { className: t, ...n } = e, a = r();
|
|
64
64
|
return /* @__PURE__ */ o("div", { ...a, "aria-labelledby": oe(a.id), children: /* @__PURE__ */ o("div", { className: c(t, "p-5 pb-10"), ...n }) });
|
|
65
65
|
}, oe = (e) => e + "toggle";
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
Y.Item = Ee;
|
|
67
|
+
Y.Header = Se;
|
|
68
|
+
Y.Content = Re;
|
|
69
69
|
const ct = (e) => {
|
|
70
70
|
const { className: r, children: t, heading: n, severity: a = "alert", ...s } = e;
|
|
71
71
|
return /* @__PURE__ */ o(
|
|
@@ -131,7 +131,7 @@ function P(e, r = !0) {
|
|
|
131
131
|
}, [r, d]), { validity: t, validationMessage: a };
|
|
132
132
|
}
|
|
133
133
|
function S(e) {
|
|
134
|
-
const r =
|
|
134
|
+
const r = ee();
|
|
135
135
|
return e ?? r;
|
|
136
136
|
}
|
|
137
137
|
const mt = (e) => {
|
|
@@ -212,13 +212,13 @@ const mt = (e) => {
|
|
|
212
212
|
] });
|
|
213
213
|
function ie(e) {
|
|
214
214
|
return Z.map(e, (r) => {
|
|
215
|
-
if (!
|
|
215
|
+
if (!W(r))
|
|
216
216
|
return typeof r == "string" ? /* @__PURE__ */ o("span", { children: r }) : r;
|
|
217
217
|
if (r.props.children) {
|
|
218
218
|
const t = {
|
|
219
219
|
children: ie(r.props.children)
|
|
220
220
|
};
|
|
221
|
-
r =
|
|
221
|
+
r = K(r, t);
|
|
222
222
|
}
|
|
223
223
|
return r;
|
|
224
224
|
});
|
|
@@ -266,9 +266,9 @@ const L = y("standard"), le = y(!0), ze = (e, r) => {
|
|
|
266
266
|
"max-md:rounded-b-3xl w-full",
|
|
267
267
|
s ? "md:rounded-r-3xl" : "md:rounded-l-3xl md:order-1"
|
|
268
268
|
);
|
|
269
|
-
if (
|
|
269
|
+
if (W(n)) {
|
|
270
270
|
const d = Z.only(n);
|
|
271
|
-
return
|
|
271
|
+
return K(d, {
|
|
272
272
|
// @ts-expect-error assume className prop is allowed
|
|
273
273
|
className: i,
|
|
274
274
|
ref: r,
|
|
@@ -628,7 +628,7 @@ const L = y("standard"), le = y(!0), ze = (e, r) => {
|
|
|
628
628
|
]
|
|
629
629
|
}
|
|
630
630
|
);
|
|
631
|
-
},
|
|
631
|
+
}, U = y([
|
|
632
632
|
{
|
|
633
633
|
activeStep: 1,
|
|
634
634
|
formData: {}
|
|
@@ -637,7 +637,7 @@ const L = y("standard"), le = y(!0), ze = (e, r) => {
|
|
|
637
637
|
}
|
|
638
638
|
]);
|
|
639
639
|
function Et() {
|
|
640
|
-
const [e, r] = A(
|
|
640
|
+
const [e, r] = A(U);
|
|
641
641
|
return {
|
|
642
642
|
activeStep: e.activeStep,
|
|
643
643
|
formData: e.formData,
|
|
@@ -645,7 +645,7 @@ function Et() {
|
|
|
645
645
|
};
|
|
646
646
|
}
|
|
647
647
|
function Xe(e) {
|
|
648
|
-
const [r, t] = A(
|
|
648
|
+
const [r, t] = A(U), n = N(async () => {
|
|
649
649
|
t({ type: "PREV_STEP" });
|
|
650
650
|
}, [t]), a = N(
|
|
651
651
|
(d) => {
|
|
@@ -707,7 +707,7 @@ function St({ children: e }) {
|
|
|
707
707
|
activeStep: 1,
|
|
708
708
|
formData: {}
|
|
709
709
|
}), n = C(() => [r, t], [r, t]);
|
|
710
|
-
return /* @__PURE__ */ o(
|
|
710
|
+
return /* @__PURE__ */ o(U.Provider, { value: n, children: e });
|
|
711
711
|
}
|
|
712
712
|
const Rt = (e) => {
|
|
713
713
|
const {
|
|
@@ -947,7 +947,7 @@ const Mt = (e) => {
|
|
|
947
947
|
isExpanded: !1,
|
|
948
948
|
collapsibleId: ""
|
|
949
949
|
}), zt = (e) => {
|
|
950
|
-
const { className: r, children: t, ...n } = e, a =
|
|
950
|
+
const { className: r, children: t, ...n } = e, a = ee(), [s, i] = q(!1), d = C(
|
|
951
951
|
() => ({ isExpanded: s, setIsExpanded: i, collapsibleId: a }),
|
|
952
952
|
[s, a]
|
|
953
953
|
);
|
|
@@ -1081,7 +1081,7 @@ const Mt = (e) => {
|
|
|
1081
1081
|
}
|
|
1082
1082
|
),
|
|
1083
1083
|
/* @__PURE__ */ o(
|
|
1084
|
-
|
|
1084
|
+
_,
|
|
1085
1085
|
{
|
|
1086
1086
|
page: 1,
|
|
1087
1087
|
href: s(1),
|
|
@@ -1092,7 +1092,7 @@ const Mt = (e) => {
|
|
|
1092
1092
|
),
|
|
1093
1093
|
n > 2 + w * 2 && t > w + 2 && /* @__PURE__ */ o(He, {}),
|
|
1094
1094
|
/* @__PURE__ */ o(Ge, { children: (b) => /* @__PURE__ */ o(
|
|
1095
|
-
|
|
1095
|
+
_,
|
|
1096
1096
|
{
|
|
1097
1097
|
href: s(b),
|
|
1098
1098
|
onClick: g(b),
|
|
@@ -1116,7 +1116,7 @@ const Mt = (e) => {
|
|
|
1116
1116
|
}, Be = h((e, r) => {
|
|
1117
1117
|
const { currentPage: t, pageCount: n } = A(T), a = t >= n;
|
|
1118
1118
|
return /* @__PURE__ */ o(
|
|
1119
|
-
|
|
1119
|
+
B,
|
|
1120
1120
|
{
|
|
1121
1121
|
"aria-hidden": a,
|
|
1122
1122
|
className: a ? "invisible" : void 0,
|
|
@@ -1129,7 +1129,7 @@ const Mt = (e) => {
|
|
|
1129
1129
|
}), De = h((e, r) => {
|
|
1130
1130
|
const { currentPage: t } = A(T), n = t <= 1;
|
|
1131
1131
|
return /* @__PURE__ */ o(
|
|
1132
|
-
|
|
1132
|
+
B,
|
|
1133
1133
|
{
|
|
1134
1134
|
"aria-hidden": n,
|
|
1135
1135
|
className: n ? "invisible" : void 0,
|
|
@@ -1139,7 +1139,7 @@ const Mt = (e) => {
|
|
|
1139
1139
|
children: /* @__PURE__ */ o(Ne, {})
|
|
1140
1140
|
}
|
|
1141
1141
|
);
|
|
1142
|
-
}),
|
|
1142
|
+
}), B = h((e, r) => {
|
|
1143
1143
|
const { className: t, ...n } = e;
|
|
1144
1144
|
return /* @__PURE__ */ o(
|
|
1145
1145
|
"a",
|
|
@@ -1162,9 +1162,9 @@ const Mt = (e) => {
|
|
|
1162
1162
|
1
|
|
1163
1163
|
);
|
|
1164
1164
|
return a - w === 0 && (a = a - 1), Array.from({ length: n - a }, (i, d) => a + d + 1).map((i) => e(i));
|
|
1165
|
-
},
|
|
1165
|
+
}, _ = h((e, r) => {
|
|
1166
1166
|
const { page: t, selected: n, ...a } = e;
|
|
1167
|
-
return /* @__PURE__ */ o(
|
|
1167
|
+
return /* @__PURE__ */ o(B, { "aria-current": n ? "page" : void 0, ref: r, ...a, children: t });
|
|
1168
1168
|
}), me = y({
|
|
1169
1169
|
defaultValue: void 0,
|
|
1170
1170
|
isControlled: !1,
|
|
@@ -1224,25 +1224,25 @@ const Mt = (e) => {
|
|
|
1224
1224
|
error: !!i
|
|
1225
1225
|
}),
|
|
1226
1226
|
[a, t, m, v, b, p, i]
|
|
1227
|
-
), J = S(d),
|
|
1227
|
+
), J = S(d), D = `${J}:label`, H = `${J}:help`, G = J + "err", j = i;
|
|
1228
1228
|
return /* @__PURE__ */ o(me.Provider, { value: F, children: /* @__PURE__ */ f(
|
|
1229
1229
|
"div",
|
|
1230
1230
|
{
|
|
1231
1231
|
"aria-describedby": c({
|
|
1232
|
-
[
|
|
1233
|
-
[
|
|
1232
|
+
[G]: j,
|
|
1233
|
+
[H]: s
|
|
1234
1234
|
}) || void 0,
|
|
1235
1235
|
"aria-invalid": !!i,
|
|
1236
|
-
"aria-labelledby": l ?
|
|
1236
|
+
"aria-labelledby": l ? D : void 0,
|
|
1237
1237
|
className: c(n, "flex flex-col gap-4"),
|
|
1238
1238
|
role: "radiogroup",
|
|
1239
1239
|
ref: r,
|
|
1240
1240
|
...x,
|
|
1241
1241
|
children: [
|
|
1242
|
-
l && /* @__PURE__ */ o(z, { id:
|
|
1243
|
-
s && /* @__PURE__ */ o(M, { id:
|
|
1242
|
+
l && /* @__PURE__ */ o(z, { id: D, isRequired: b, isInvalid: !!i, children: l }),
|
|
1243
|
+
s && /* @__PURE__ */ o(M, { id: H, children: s }),
|
|
1244
1244
|
u,
|
|
1245
|
-
j && /* @__PURE__ */ o(R, { id:
|
|
1245
|
+
j && /* @__PURE__ */ o(R, { id: G, children: j })
|
|
1246
1246
|
]
|
|
1247
1247
|
}
|
|
1248
1248
|
) });
|
|
@@ -1285,7 +1285,7 @@ const Mt = (e) => {
|
|
|
1285
1285
|
label: s,
|
|
1286
1286
|
disableValidation: i = !1,
|
|
1287
1287
|
...d
|
|
1288
|
-
} = e, u = E(null), l =
|
|
1288
|
+
} = e, u = E(null), l = X([u, r]), { validity: m, validationMessage: g } = P(
|
|
1289
1289
|
u,
|
|
1290
1290
|
!i
|
|
1291
1291
|
), b = S(a), p = b + "help", x = b + "err", v = n || g;
|
|
@@ -1334,18 +1334,18 @@ const Mt = (e) => {
|
|
|
1334
1334
|
),
|
|
1335
1335
|
/* @__PURE__ */ f("div", { className: "snackbar-actions flex justify-end gap-4 max-md:mt-3 md:ml-4", children: [
|
|
1336
1336
|
/* @__PURE__ */ o(
|
|
1337
|
-
|
|
1337
|
+
$,
|
|
1338
1338
|
{
|
|
1339
1339
|
"aria-expanded": a,
|
|
1340
1340
|
onClick: () => s(!a),
|
|
1341
1341
|
children: a ? "Les mindre" : "Les mer"
|
|
1342
1342
|
}
|
|
1343
1343
|
),
|
|
1344
|
-
/* @__PURE__ */ o(
|
|
1344
|
+
/* @__PURE__ */ o($, { onClick: n, children: "Ok" })
|
|
1345
1345
|
] }),
|
|
1346
1346
|
a && t
|
|
1347
1347
|
] }) }) });
|
|
1348
|
-
},
|
|
1348
|
+
}, $ = (e) => /* @__PURE__ */ o(
|
|
1349
1349
|
"button",
|
|
1350
1350
|
{
|
|
1351
1351
|
className: c(
|
|
@@ -1364,9 +1364,12 @@ const Mt = (e) => {
|
|
|
1364
1364
|
}
|
|
1365
1365
|
), $e = (e) => {
|
|
1366
1366
|
const { align: r = "center", children: t, className: n, ...a } = e;
|
|
1367
|
-
return /* @__PURE__ */ o("ol", { className: c(n, "flex flex-col gap-8 md:gap-12"), ...a, children: Z.map(t, (s) =>
|
|
1368
|
-
|
|
1369
|
-
|
|
1367
|
+
return /* @__PURE__ */ o("ol", { className: c(n, "flex flex-col gap-8 md:gap-12"), ...a, children: Z.map(t, (s) => {
|
|
1368
|
+
if (W(s))
|
|
1369
|
+
return K(s, {
|
|
1370
|
+
align: r
|
|
1371
|
+
});
|
|
1372
|
+
}) });
|
|
1370
1373
|
}, et = (e) => {
|
|
1371
1374
|
const { className: r, children: t, bullet: n, align: a = "center", ...s } = e;
|
|
1372
1375
|
return /* @__PURE__ */ f(
|
|
@@ -1408,7 +1411,7 @@ const Qt = h(
|
|
|
1408
1411
|
label: s,
|
|
1409
1412
|
disableValidation: i = !1,
|
|
1410
1413
|
...d
|
|
1411
|
-
} = e, u = E(null), l =
|
|
1414
|
+
} = e, u = E(null), l = X([u, r]), { validity: m, validationMessage: g } = P(
|
|
1412
1415
|
u,
|
|
1413
1416
|
!i
|
|
1414
1417
|
), b = S(a), p = b + "help", x = b + "err", v = n || g;
|
|
@@ -1453,7 +1456,7 @@ const Qt = h(
|
|
|
1453
1456
|
} = e, l = E(null), { validity: m, validationMessage: g } = P(
|
|
1454
1457
|
l,
|
|
1455
1458
|
!d
|
|
1456
|
-
), b = S(a), p = b + "help", x = b + "err", v = n || g, F =
|
|
1459
|
+
), b = S(a), p = b + "help", x = b + "err", v = n || g, F = X([l, r]);
|
|
1457
1460
|
return /* @__PURE__ */ f("div", { className: "grid gap-2", children: [
|
|
1458
1461
|
/* @__PURE__ */ o(
|
|
1459
1462
|
z,
|
|
@@ -1484,7 +1487,7 @@ const Qt = h(
|
|
|
1484
1487
|
}
|
|
1485
1488
|
);
|
|
1486
1489
|
export {
|
|
1487
|
-
|
|
1490
|
+
Y as Accordion,
|
|
1488
1491
|
Re as AccordionContent,
|
|
1489
1492
|
Se as AccordionHeader,
|
|
1490
1493
|
Ee as AccordionItem,
|
|
@@ -1533,7 +1536,7 @@ export {
|
|
|
1533
1536
|
Wt as RadioGroup,
|
|
1534
1537
|
Kt as Select,
|
|
1535
1538
|
Xt as Snackbar,
|
|
1536
|
-
|
|
1539
|
+
$ as SnackbarButton,
|
|
1537
1540
|
Yt as SnackbarContent,
|
|
1538
1541
|
$e as StepList,
|
|
1539
1542
|
et as StepListItem,
|