@obosbbl/grunnmuren-react 1.14.0-beta.2 → 1.14.0-beta.3

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,11 +1,17 @@
1
1
  /// <reference types="react" />
2
2
  export type FieldValues = Record<string, unknown>;
3
+ export declare function useFormContext(): {
4
+ activeStep: number;
5
+ formData: any;
6
+ };
3
7
  export declare function useFormStepContext<FormStepData extends FieldValues>(formStep: number): {
4
8
  isActive: boolean;
5
9
  activeStep: number;
6
10
  setActiveStep: (step: number) => void;
7
11
  previousFormStep: () => Promise<void>;
12
+ nextFormStep: () => void;
8
13
  submitAndNextFormStep: (formValues: FormStepData) => void;
14
+ setFormData: (formValues: FormStepData) => void;
9
15
  formData: any;
10
16
  };
11
17
  export declare function FormStepProvider({ children }: {
@@ -1,25 +1,25 @@
1
1
  'use client';
2
2
  import { jsx as o, jsxs as f, Fragment as O } from "react/jsx-runtime";
3
- import { createContext as N, useContext as A, useState as q, useCallback as I, useEffect as fe, useId as _, forwardRef as g, Children as Z, isValidElement as $, cloneElement as W, useRef as E, useMemo as C, useReducer as he } from "react";
4
- import { ChevronDown as ee, Warning as te, InfoCircle as re, LoadingSpinner as ge, CheckCircle as pe, MenuAlt as Ae, Close as xe, ChevronRight as ve, ChevronLeft as Ne } from "@obosbbl/grunnmuren-icons";
3
+ import { createContext as w, useContext as A, useState as q, useCallback as N, useEffect as fe, useId as $, forwardRef as h, Children as Z, isValidElement as ee, cloneElement as W, useRef as E, useMemo as C, useReducer as ge } from "react";
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 we } from "react-collapsed";
6
6
  import l from "clsx";
7
- import { useMediaQuery as ne, useUpdateEffect as ye } from "@react-hookz/web";
7
+ import { useMediaQuery as ae, useUpdateEffect as ye } from "@react-hookz/web";
8
8
  import K from "@react-hook/merged-ref";
9
- const y = () => {
9
+ const I = () => {
10
10
  }, Ie = 300, Ce = "duration-300", X = (e) => {
11
11
  const { className: r, ...t } = e;
12
12
  return /* @__PURE__ */ o("div", { className: l(r, "flex flex-col gap-2"), ...t });
13
- }, Y = N({
13
+ }, Y = w({
14
14
  isExpanded: !1,
15
- setExpanded: y,
15
+ setExpanded: I,
16
16
  // @ts-expect-error noop
17
- getCollapseProps: y,
17
+ getCollapseProps: I,
18
18
  // @ts-expect-error noop
19
- getToggleProps: y,
20
- onChange: y
19
+ getToggleProps: I,
20
+ onChange: I
21
21
  }), Ee = (e) => {
22
- const { className: r, defaultOpen: t, onChange: n = y, open: a, ...s } = e, i = we({
22
+ const { className: r, defaultOpen: t, onChange: n = I, open: a, ...s } = e, i = we({
23
23
  defaultExpanded: t,
24
24
  isExpanded: a,
25
25
  duration: Ie,
@@ -47,11 +47,11 @@ const y = () => {
47
47
  ),
48
48
  ...a,
49
49
  ...m,
50
- id: ae(m["aria-controls"]),
50
+ id: oe(m["aria-controls"]),
51
51
  children: [
52
52
  r,
53
53
  /* @__PURE__ */ o(
54
- ee,
54
+ te,
55
55
  {
56
56
  className: `shrink-0 text-sm ${Ce} group-aria-expanded:rotate-180`
57
57
  }
@@ -61,8 +61,8 @@ const y = () => {
61
61
  ) });
62
62
  }, ke = (e) => {
63
63
  const { getCollapseProps: r } = A(Y), { className: t, ...n } = e, a = r();
64
- return /* @__PURE__ */ o("div", { ...a, "aria-labelledby": ae(a.id), children: /* @__PURE__ */ o("div", { className: l(t, "p-5 pb-10"), ...n }) });
65
- }, ae = (e) => e + "toggle";
64
+ return /* @__PURE__ */ o("div", { ...a, "aria-labelledby": oe(a.id), children: /* @__PURE__ */ o("div", { className: l(t, "p-5 pb-10"), ...n }) });
65
+ }, oe = (e) => e + "toggle";
66
66
  X.Item = Ee;
67
67
  X.Header = Re;
68
68
  X.Content = ke;
@@ -92,8 +92,8 @@ const dt = (e) => {
92
92
  ] })
93
93
  }
94
94
  );
95
- }, Se = ({ severity: e, className: r }) => e === "alert" ? /* @__PURE__ */ o(te, { className: l(r, "text-red") }) : /* @__PURE__ */ o(re, { className: l(r, "text-orange") }), qe = "(prefers-reduced-motion: reduce)", ct = (e = !1) => ne(qe, { initializeWithValue: e });
96
- function oe(e) {
95
+ }, Se = ({ severity: e, className: r }) => e === "alert" ? /* @__PURE__ */ o(re, { className: l(r, "text-red") }) : /* @__PURE__ */ o(ne, { className: l(r, "text-orange") }), qe = "(prefers-reduced-motion: reduce)", ct = (e = !1) => ae(qe, { initializeWithValue: e });
96
+ function se(e) {
97
97
  switch (e) {
98
98
  case "gray":
99
99
  return "bg-gray-lightest";
@@ -107,16 +107,16 @@ function oe(e) {
107
107
  return "bg-sky-light";
108
108
  }
109
109
  }
110
- const Le = (e) => ne("(max-width: 767.9px)", { initializeWithValue: e });
110
+ const Le = (e) => ae("(max-width: 767.9px)", { initializeWithValue: e });
111
111
  function L(e, r = !0) {
112
- const [t, n] = q("indeterminate"), [a, s] = q(), i = I((d) => {
112
+ const [t, n] = q("indeterminate"), [a, s] = q(), i = N((d) => {
113
113
  d.target.checkValidity() && (n("valid"), s(void 0));
114
- }, []), c = I(
114
+ }, []), c = N(
115
115
  (d) => {
116
116
  t !== "indeterminate" && d.target.checkValidity() && (n("valid"), s(void 0));
117
117
  },
118
118
  [t]
119
- ), m = I((d) => {
119
+ ), m = N((d) => {
120
120
  d.preventDefault();
121
121
  const u = d.target.validationMessage;
122
122
  s(u), n("invalid");
@@ -131,7 +131,7 @@ function L(e, r = !0) {
131
131
  }, [r, c]), { validity: t, validationMessage: a };
132
132
  }
133
133
  function R(e) {
134
- const r = _();
134
+ const r = $();
135
135
  return e ?? r;
136
136
  }
137
137
  const mt = (e) => {
@@ -142,7 +142,7 @@ const mt = (e) => {
142
142
  heading: a,
143
143
  image: s,
144
144
  ...i
145
- } = e, c = oe(r);
145
+ } = e, c = se(r);
146
146
  return /* @__PURE__ */ o("article", { className: l(t, c, "px-4 py-8 md:py-14"), ...i, children: /* @__PURE__ */ f("div", { className: "container flex flex-col justify-center gap-4 md:flex-row md:gap-12", children: [
147
147
  s,
148
148
  /* @__PURE__ */ f("div", { className: "max-w-prose", children: [
@@ -167,7 +167,7 @@ const mt = (e) => {
167
167
  "white-secondary": "bg-transparent border-white text-white",
168
168
  "light-green-primary": "bg-green-light border-green-light text-black",
169
169
  "light-green-secondary": "bg-transparent border-green-light text-green-light"
170
- }, bt = g((e, r) => {
170
+ }, bt = h((e, r) => {
171
171
  const {
172
172
  children: t,
173
173
  className: n,
@@ -200,30 +200,30 @@ const mt = (e) => {
200
200
  }
201
201
  ) });
202
202
  }), Pe = (e) => /* @__PURE__ */ f(O, { children: [
203
- se(e.children),
203
+ ie(e.children),
204
204
  /* @__PURE__ */ o(
205
205
  "span",
206
206
  {
207
207
  className: "!visible absolute bottom-1 left-1 right-1 top-1 grid place-items-center overflow-hidden bg-inherit",
208
208
  "aria-hidden": !0,
209
- children: /* @__PURE__ */ o(ge, { className: "animate-spin" })
209
+ children: /* @__PURE__ */ o(he, { className: "animate-spin" })
210
210
  }
211
211
  )
212
212
  ] });
213
- function se(e) {
213
+ function ie(e) {
214
214
  return Z.map(e, (r) => {
215
- if (!$(r))
215
+ if (!ee(r))
216
216
  return typeof r == "string" ? /* @__PURE__ */ o("span", { children: r }) : r;
217
217
  if (r.props.children) {
218
218
  const t = {
219
- children: se(r.props.children)
219
+ children: ie(r.props.children)
220
220
  };
221
221
  r = W(r, t);
222
222
  }
223
223
  return r;
224
224
  });
225
225
  }
226
- const M = N("standard"), ie = N(!0), ze = (e, r) => {
226
+ const M = w("standard"), le = w(!0), ze = (e, r) => {
227
227
  const {
228
228
  as: t = "div",
229
229
  body: n,
@@ -242,12 +242,12 @@ const M = N("standard"), ie = N(!0), ze = (e, r) => {
242
242
  ...c,
243
243
  ref: r,
244
244
  children: [
245
- /* @__PURE__ */ o(ie.Provider, { value: i, children: s }),
245
+ /* @__PURE__ */ o(le.Provider, { value: i, children: s }),
246
246
  n
247
247
  ]
248
248
  }
249
249
  );
250
- }, Ve = g(ze), Te = g(
250
+ }, Ve = h(ze), Te = h(
251
251
  (e, r) => {
252
252
  const { className: t, ...n } = e;
253
253
  return /* @__PURE__ */ o(
@@ -259,14 +259,14 @@ const M = N("standard"), ie = N(!0), ze = (e, r) => {
259
259
  }
260
260
  );
261
261
  }
262
- ), Fe = g(
262
+ ), Fe = h(
263
263
  (e, r) => {
264
- const { className: t, children: n, ...a } = e, s = A(ie), i = l(
264
+ const { className: t, children: n, ...a } = e, s = A(le), i = l(
265
265
  t,
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 ($(n)) {
269
+ if (ee(n)) {
270
270
  const c = Z.only(n);
271
271
  return W(c, {
272
272
  // @ts-expect-error assume className prop is allowed
@@ -298,7 +298,7 @@ const M = N("standard"), ie = N(!0), ze = (e, r) => {
298
298
  ref: r
299
299
  }
300
300
  );
301
- }, ht = g(Je), gt = g(
301
+ }, gt = h(Je), ht = h(
302
302
  (e, r) => {
303
303
  const { className: t, ...n } = e;
304
304
  return /* @__PURE__ */ o(
@@ -311,9 +311,9 @@ const M = N("standard"), ie = N(!0), ze = (e, r) => {
311
311
  }
312
312
  );
313
313
  }
314
- ), pt = g(
314
+ ), pt = h(
315
315
  (e, r) => {
316
- const { bgColor: t, className: n, ...a } = e, s = oe(t);
316
+ const { bgColor: t, className: n, ...a } = e, s = se(t);
317
317
  return /* @__PURE__ */ o("div", { className: l(s, n), children: /* @__PURE__ */ o(
318
318
  "div",
319
319
  {
@@ -323,12 +323,12 @@ const M = N("standard"), ie = N(!0), ze = (e, r) => {
323
323
  }
324
324
  ) });
325
325
  }
326
- ), At = g(
326
+ ), At = h(
327
327
  (e, r) => {
328
328
  const { className: t, ...n } = e;
329
329
  return /* @__PURE__ */ o("div", { className: l(t, "p-8 md:px-10"), ...n, ref: r });
330
330
  }
331
- ), xt = g((e, r) => {
331
+ ), xt = h((e, r) => {
332
332
  const { className: t, ...n } = e;
333
333
  return /* @__PURE__ */ o(
334
334
  "a",
@@ -341,7 +341,7 @@ const M = N("standard"), ie = N(!0), ze = (e, r) => {
341
341
  ...n
342
342
  }
343
343
  );
344
- }), vt = g(
344
+ }), vt = h(
345
345
  (e, r) => {
346
346
  const {
347
347
  children: t,
@@ -353,13 +353,13 @@ const M = N("standard"), ie = N(!0), ze = (e, r) => {
353
353
  } = e, m = E(null), { validity: d, validationMessage: u } = L(
354
354
  m,
355
355
  !i
356
- ), h = R(s), b = h + "err", p = a || u;
356
+ ), g = R(s), b = g + "err", p = a || u;
357
357
  return /* @__PURE__ */ f("div", { className: "grid gap-2", children: [
358
358
  /* @__PURE__ */ f("label", { className: l(n, "flex cursor-pointer gap-2.5"), children: [
359
359
  /* @__PURE__ */ o(
360
360
  "input",
361
361
  {
362
- id: h,
362
+ id: g,
363
363
  className: l(
364
364
  "checkbox checked:bg-green checked:border-green grid h-[1.25em] w-[1.25em] flex-none translate-y-[0.1em] cursor-pointer appearance-none place-content-center rounded border-2 border-solid bg-white text-white focus:outline-none focus:ring-2",
365
365
  {
@@ -485,7 +485,7 @@ const M = N("standard"), ie = N(!0), ze = (e, r) => {
485
485
  "aria-live": "polite",
486
486
  ...n,
487
487
  children: [
488
- /* @__PURE__ */ o(te, { className: "text-red flex-shrink-0" }),
488
+ /* @__PURE__ */ o(re, { className: "text-red flex-shrink-0" }),
489
489
  r
490
490
  ]
491
491
  }
@@ -549,11 +549,17 @@ const M = N("standard"), ie = N(!0), ze = (e, r) => {
549
549
  type: "button",
550
550
  "aria-disabled": t,
551
551
  onClick: a,
552
- className: l(r, "w-full py-4 pl-4 md:py-8 ", {
553
- "bg-blue-dark": !t,
554
- "border-black bg-white": t && i !== "completed",
555
- "border-green bg-green text-white": t && i === "completed"
556
- }),
552
+ className: l(
553
+ r,
554
+ "border-blue-dark w-full rounded-t-lg border-2 py-4 pl-4 md:py-8 ",
555
+ {
556
+ "bg-blue-dark": !t,
557
+ "border-black bg-white": t && i !== "completed",
558
+ "border-green bg-green text-white": t && i === "completed",
559
+ "rounded-t-2xl md:rounded-t-3xl": n === 1,
560
+ "rounded-lg": t
561
+ }
562
+ ),
557
563
  children: /* @__PURE__ */ o(
558
564
  Ke,
559
565
  {
@@ -622,7 +628,7 @@ const M = N("standard"), ie = N(!0), ze = (e, r) => {
622
628
  ]
623
629
  }
624
630
  );
625
- }, le = N([
631
+ }, Q = w([
626
632
  {
627
633
  activeStep: 1,
628
634
  formData: {}
@@ -630,25 +636,41 @@ const M = N("standard"), ie = N(!0), ze = (e, r) => {
630
636
  () => {
631
637
  }
632
638
  ]);
639
+ function Et() {
640
+ const [e] = A(Q);
641
+ return {
642
+ activeStep: e.activeStep,
643
+ formData: e.formData
644
+ };
645
+ }
633
646
  function Xe(e) {
634
- const [r, t] = A(le), n = I(async () => {
647
+ const [r, t] = A(Q), n = N(async () => {
635
648
  t({ type: "PREV_STEP" });
636
- }, [t]), a = I(
637
- (s) => {
649
+ }, [t]), a = N(
650
+ (c) => {
638
651
  t({
639
652
  type: "SET_FORM_STEP_DATA",
640
653
  formId: `form${e}`,
641
- formValues: s
642
- }), t({ type: "NEXT_STEP" });
654
+ formValues: c
655
+ });
643
656
  },
644
657
  [t, e]
658
+ ), s = N(() => {
659
+ t({ type: "NEXT_STEP" });
660
+ }, [t]), i = N(
661
+ (c) => {
662
+ a(c), s();
663
+ },
664
+ [s, a]
645
665
  );
646
666
  return {
647
667
  isActive: r.activeStep === e,
648
668
  activeStep: r.activeStep,
649
- setActiveStep: (s) => t({ type: "SET_STEP", step: s }),
669
+ setActiveStep: (c) => t({ type: "SET_STEP", step: c }),
650
670
  previousFormStep: n,
651
- submitAndNextFormStep: a,
671
+ nextFormStep: s,
672
+ submitAndNextFormStep: i,
673
+ setFormData: a,
652
674
  formData: r.formData
653
675
  };
654
676
  }
@@ -679,14 +701,14 @@ function Ye(e, r) {
679
701
  };
680
702
  }
681
703
  }
682
- function Et({ children: e }) {
683
- const [r, t] = he(Ye, {
704
+ function Rt({ children: e }) {
705
+ const [r, t] = ge(Ye, {
684
706
  activeStep: 1,
685
707
  formData: {}
686
708
  }), n = C(() => [r, t], [r, t]);
687
- return /* @__PURE__ */ o(le.Provider, { value: n, children: e });
709
+ return /* @__PURE__ */ o(Q.Provider, { value: n, children: e });
688
710
  }
689
- const Rt = (e) => {
711
+ const kt = (e) => {
690
712
  const {
691
713
  children: r,
692
714
  heading: t,
@@ -695,25 +717,20 @@ const Rt = (e) => {
695
717
  onSubmit: s,
696
718
  className: i,
697
719
  ...c
698
- } = e, { isActive: m, setActiveStep: d, activeStep: u } = Xe(n), h = E(null), b = I(() => {
720
+ } = e, { isActive: m, setActiveStep: d, activeStep: u } = Xe(n), g = E(null), b = N(() => {
699
721
  n < u && d(n);
700
722
  }, [u, n, d]);
701
723
  return ye(() => {
702
724
  var p;
703
- m && ((p = h.current) == null || p.scrollIntoView({ behavior: "smooth" }));
725
+ m && ((p = g.current) == null || p.scrollIntoView({ behavior: "smooth" }));
704
726
  }, [m]), /* @__PURE__ */ f(
705
727
  "form",
706
728
  {
707
- className: l(
708
- "border-blue-dark relative block overflow-hidden rounded-lg border-2",
709
- i,
710
- {
711
- "rounded-t-2xl md:rounded-t-3xl": n === 1,
712
- "border-none": a === "completed" && !m
713
- }
714
- ),
729
+ className: l("block", i, {
730
+ "border-none": a === "completed" && !m
731
+ }),
715
732
  onSubmit: s,
716
- ref: h,
733
+ ref: g,
717
734
  ...c,
718
735
  children: [
719
736
  /* @__PURE__ */ o(
@@ -726,7 +743,7 @@ const Rt = (e) => {
726
743
  children: t
727
744
  }
728
745
  ),
729
- m && /* @__PURE__ */ o("div", { className: "p-6 md:p-10", children: r })
746
+ m && /* @__PURE__ */ o("div", { className: "border-blue-dark relative rounded-b-lg border-2 p-6 md:p-10", children: r })
730
747
  ]
731
748
  }
732
749
  );
@@ -734,7 +751,7 @@ const Rt = (e) => {
734
751
  function de(e) {
735
752
  return e !== "vertical-split" && e !== "below-center" && e !== "below-left";
736
753
  }
737
- const V = N({ bgColor: "white", contentPosition: "below-center", hasImage: !1 }), kt = g((e, r) => {
754
+ const V = w({ bgColor: "white", contentPosition: "below-center", hasImage: !1 }), St = h((e, r) => {
738
755
  const {
739
756
  bgColor: t = "white",
740
757
  children: n,
@@ -776,7 +793,7 @@ const V = N({ bgColor: "white", contentPosition: "below-center", hasImage: !1 })
776
793
  ) })
777
794
  }
778
795
  );
779
- }), St = g(
796
+ }), qt = h(
780
797
  (e, r) => {
781
798
  const { contentPosition: t } = A(V);
782
799
  return /* @__PURE__ */ f(
@@ -804,7 +821,7 @@ const V = N({ bgColor: "white", contentPosition: "below-center", hasImage: !1 })
804
821
  }
805
822
  );
806
823
  }
807
- ), qt = g(
824
+ ), Lt = h(
808
825
  (e, r) => {
809
826
  const { bgColor: t, contentPosition: n, hasImage: a } = A(V), { children: s, className: i, heading: c, description: m, ...d } = e, u = de(n);
810
827
  return /* @__PURE__ */ f(
@@ -848,7 +865,7 @@ const V = N({ bgColor: "white", contentPosition: "below-center", hasImage: !1 })
848
865
  }
849
866
  );
850
867
  }
851
- ), Lt = g(
868
+ ), Mt = h(
852
869
  (e, r) => {
853
870
  const { className: t, ...n } = e, { contentPosition: a } = A(V);
854
871
  return /* @__PURE__ */ o(
@@ -867,7 +884,7 @@ const V = N({ bgColor: "white", contentPosition: "below-center", hasImage: !1 })
867
884
  }
868
885
  );
869
886
  }
870
- ), ce = g((e, r) => {
887
+ ), ce = h((e, r) => {
871
888
  const {
872
889
  className: t,
873
890
  isInvalid: n,
@@ -877,7 +894,7 @@ const V = N({ bgColor: "white", contentPosition: "below-center", hasImage: !1 })
877
894
  rightAddon: c,
878
895
  leftAddon: m,
879
896
  ...d
880
- } = e, u = s ?? "input", h = Qe(u, i);
897
+ } = e, u = s ?? "input", g = Qe(u, i);
881
898
  return /* @__PURE__ */ f(
882
899
  "div",
883
900
  {
@@ -902,7 +919,7 @@ const V = N({ bgColor: "white", contentPosition: "below-center", hasImage: !1 })
902
919
  ref: r,
903
920
  className: "focus:none placeholder-gray w-full rounded-lg border-none px-4 py-3.5 focus:outline-none",
904
921
  size: a,
905
- type: h,
922
+ type: g,
906
923
  ...d
907
924
  }
908
925
  ),
@@ -917,18 +934,18 @@ function Qe(e, r) {
917
934
  if (e === "input")
918
935
  return "text";
919
936
  }
920
- const Mt = (e) => {
937
+ const Pt = (e) => {
921
938
  let r = "";
922
939
  return e.icon && (r = "inline-flex items-center gap-2"), /* @__PURE__ */ f("a", { className: r, href: e.href, children: [
923
940
  e.icon,
924
941
  e.children
925
942
  ] });
926
- }, S = N({
927
- setIsExpanded: y,
943
+ }, S = w({
944
+ setIsExpanded: I,
928
945
  isExpanded: !1,
929
946
  collapsibleId: ""
930
- }), Pt = (e) => {
931
- const { className: r, children: t, ...n } = e, a = _(), [s, i] = q(!1), c = C(
947
+ }), zt = (e) => {
948
+ const { className: r, children: t, ...n } = e, a = $(), [s, i] = q(!1), c = C(
932
949
  () => ({ isExpanded: s, setIsExpanded: i, collapsibleId: a }),
933
950
  [s, a]
934
951
  );
@@ -943,7 +960,7 @@ const Mt = (e) => {
943
960
  children: /* @__PURE__ */ o("div", { className: "container", children: t })
944
961
  }
945
962
  ) }) });
946
- }, zt = (e) => {
963
+ }, Vt = (e) => {
947
964
  const { className: r, children: t, ...n } = e, { isExpanded: a } = A(S);
948
965
  return /* @__PURE__ */ o(
949
966
  "nav",
@@ -959,7 +976,7 @@ const Mt = (e) => {
959
976
  children: t
960
977
  }
961
978
  );
962
- }, Vt = g(
979
+ }, Tt = h(
963
980
  (e, r) => {
964
981
  const { active: t, className: n, children: a, ...s } = e;
965
982
  return /* @__PURE__ */ o(
@@ -996,7 +1013,7 @@ const Mt = (e) => {
996
1013
  ]
997
1014
  }
998
1015
  );
999
- }, Tt = (e) => {
1016
+ }, Ft = (e) => {
1000
1017
  const { className: r, children: t, logo: n, ...a } = e;
1001
1018
  return /* @__PURE__ */ f(
1002
1019
  "div",
@@ -1010,7 +1027,7 @@ const Mt = (e) => {
1010
1027
  ]
1011
1028
  }
1012
1029
  );
1013
- }, Ft = (e) => {
1030
+ }, Jt = (e) => {
1014
1031
  const { className: r, children: t, ...n } = e, { collapsibleId: a, isExpanded: s } = A(S);
1015
1032
  return /* @__PURE__ */ o(
1016
1033
  "div",
@@ -1024,10 +1041,10 @@ const Mt = (e) => {
1024
1041
  children: t
1025
1042
  }
1026
1043
  );
1027
- }, Jt = (e) => {
1044
+ }, jt = (e) => {
1028
1045
  const { isExpanded: r } = A(S), t = Le(!1);
1029
1046
  return !r || !t ? null : /* @__PURE__ */ o(O, { children: e.children });
1030
- }, w = 2, T = N({ currentPage: 0, pageCount: 0 }), jt = (e) => {
1047
+ }, y = 2, T = w({ currentPage: 0, pageCount: 0 }), Ot = (e) => {
1031
1048
  const {
1032
1049
  className: r,
1033
1050
  page: t,
@@ -1044,7 +1061,7 @@ const Mt = (e) => {
1044
1061
  pageCount: Math.max(1, n)
1045
1062
  }),
1046
1063
  [t, n]
1047
- ), h = (b) => (p) => {
1064
+ ), g = (b) => (p) => {
1048
1065
  a && (p.preventDefault(), a(b));
1049
1066
  };
1050
1067
  return /* @__PURE__ */ o(T.Provider, { value: u, children: /* @__PURE__ */ f(
@@ -1058,7 +1075,7 @@ const Mt = (e) => {
1058
1075
  {
1059
1076
  "aria-label": m,
1060
1077
  href: s(t - 1),
1061
- onClick: h(t - 1)
1078
+ onClick: g(t - 1)
1062
1079
  }
1063
1080
  ),
1064
1081
  /* @__PURE__ */ o(
@@ -1066,17 +1083,17 @@ const Mt = (e) => {
1066
1083
  {
1067
1084
  page: 1,
1068
1085
  href: s(1),
1069
- onClick: h(1),
1086
+ onClick: g(1),
1070
1087
  "aria-label": i(1),
1071
1088
  selected: t === 1
1072
1089
  }
1073
1090
  ),
1074
- n > 2 + w * 2 && t > w + 2 && /* @__PURE__ */ o(Ge, {}),
1075
- /* @__PURE__ */ o(De, { children: (b) => /* @__PURE__ */ o(
1091
+ n > 2 + y * 2 && t > y + 2 && /* @__PURE__ */ o(De, {}),
1092
+ /* @__PURE__ */ o(Ge, { children: (b) => /* @__PURE__ */ o(
1076
1093
  G,
1077
1094
  {
1078
1095
  href: s(b),
1079
- onClick: h(b),
1096
+ onClick: g(b),
1080
1097
  "aria-label": i(b),
1081
1098
  page: b,
1082
1099
  selected: b === t
@@ -1088,16 +1105,16 @@ const Mt = (e) => {
1088
1105
  {
1089
1106
  "aria-label": c,
1090
1107
  href: s(t + 1),
1091
- onClick: h(t + 1)
1108
+ onClick: g(t + 1)
1092
1109
  }
1093
1110
  )
1094
1111
  ]
1095
1112
  }
1096
1113
  ) });
1097
- }, Be = g((e, r) => {
1114
+ }, Be = h((e, r) => {
1098
1115
  const { currentPage: t, pageCount: n } = A(T), a = t >= n;
1099
1116
  return /* @__PURE__ */ o(
1100
- Q,
1117
+ U,
1101
1118
  {
1102
1119
  "aria-hidden": a,
1103
1120
  className: a ? "invisible" : void 0,
@@ -1107,10 +1124,10 @@ const Mt = (e) => {
1107
1124
  children: /* @__PURE__ */ o(ve, {})
1108
1125
  }
1109
1126
  );
1110
- }), He = g((e, r) => {
1127
+ }), He = h((e, r) => {
1111
1128
  const { currentPage: t } = A(T), n = t <= 1;
1112
1129
  return /* @__PURE__ */ o(
1113
- Q,
1130
+ U,
1114
1131
  {
1115
1132
  "aria-hidden": n,
1116
1133
  className: n ? "invisible" : void 0,
@@ -1120,7 +1137,7 @@ const Mt = (e) => {
1120
1137
  children: /* @__PURE__ */ o(Ne, {})
1121
1138
  }
1122
1139
  );
1123
- }), Q = g((e, r) => {
1140
+ }), U = h((e, r) => {
1124
1141
  const { className: t, ...n } = e;
1125
1142
  return /* @__PURE__ */ o(
1126
1143
  "a",
@@ -1133,34 +1150,34 @@ const Mt = (e) => {
1133
1150
  ...n
1134
1151
  }
1135
1152
  );
1136
- }), Ge = () => /* @__PURE__ */ o("span", { className: "flex h-9 w-9 cursor-default items-center justify-center border-2 border-transparent sm:h-10 sm:w-10", children: "..." }), De = ({ children: e }) => {
1153
+ }), De = () => /* @__PURE__ */ o("span", { className: "flex h-9 w-9 cursor-default items-center justify-center border-2 border-transparent sm:h-10 sm:w-10", children: "..." }), Ge = ({ children: e }) => {
1137
1154
  const { currentPage: r, pageCount: t } = A(T), n = Math.min(
1138
- Math.max(2 + w * 2, r + w),
1155
+ Math.max(2 + y * 2, r + y),
1139
1156
  t
1140
1157
  );
1141
1158
  let a = Math.max(
1142
- Math.min(r - w, n - w * 2),
1159
+ Math.min(r - y, n - y * 2),
1143
1160
  1
1144
1161
  );
1145
- return a - w === 0 && (a = a - 1), Array.from({ length: n - a }, (i, c) => a + c + 1).map((i) => e(i));
1146
- }, G = g((e, r) => {
1162
+ return a - y === 0 && (a = a - 1), Array.from({ length: n - a }, (i, c) => a + c + 1).map((i) => e(i));
1163
+ }, G = h((e, r) => {
1147
1164
  const { page: t, selected: n, ...a } = e;
1148
- return /* @__PURE__ */ o(Q, { "aria-current": n ? "page" : void 0, ref: r, ...a, children: t });
1149
- }), me = N({
1165
+ return /* @__PURE__ */ o(U, { "aria-current": n ? "page" : void 0, ref: r, ...a, children: t });
1166
+ }), me = w({
1150
1167
  defaultValue: void 0,
1151
1168
  isControlled: !1,
1152
1169
  name: void 0,
1153
- onChange: y,
1170
+ onChange: I,
1154
1171
  required: !1,
1155
1172
  value: void 0,
1156
1173
  error: !1
1157
- }), Ot = g((e, r) => {
1158
- const { children: t, className: n, ...a } = e, { defaultValue: s, isControlled: i, name: c, onChange: m, required: d, value: u, error: h } = A(me);
1174
+ }), Zt = h((e, r) => {
1175
+ const { children: t, className: n, ...a } = e, { defaultValue: s, isControlled: i, name: c, onChange: m, required: d, value: u, error: g } = A(me);
1159
1176
  return /* @__PURE__ */ f("label", { className: l(n, "flex cursor-pointer gap-2.5"), children: [
1160
1177
  /* @__PURE__ */ o(
1161
1178
  "input",
1162
1179
  {
1163
- className: l("radio", h && "border-red"),
1180
+ className: l("radio", g && "border-red"),
1164
1181
  defaultChecked: i ? void 0 : a.value === s,
1165
1182
  checked: i ? a.value === u : void 0,
1166
1183
  name: c,
@@ -1173,7 +1190,7 @@ const Mt = (e) => {
1173
1190
  ),
1174
1191
  t
1175
1192
  ] });
1176
- }), Zt = g(
1193
+ }), Wt = h(
1177
1194
  (e, r) => {
1178
1195
  const t = "value" in e, {
1179
1196
  className: n,
@@ -1184,16 +1201,16 @@ const Mt = (e) => {
1184
1201
  children: m,
1185
1202
  label: d,
1186
1203
  name: u,
1187
- onChange: h,
1204
+ onChange: g,
1188
1205
  required: b,
1189
1206
  value: p,
1190
1207
  ...v
1191
- } = e, x = I(
1208
+ } = e, x = N(
1192
1209
  (ue) => {
1193
1210
  const be = ue.target.value;
1194
- h == null || h(be);
1211
+ g == null || g(be);
1195
1212
  },
1196
- [h]
1213
+ [g]
1197
1214
  ), F = C(
1198
1215
  () => ({
1199
1216
  defaultValue: a,
@@ -1205,30 +1222,30 @@ const Mt = (e) => {
1205
1222
  error: !!i
1206
1223
  }),
1207
1224
  [a, t, u, x, b, p, i]
1208
- ), J = R(c), U = `${J}:label`, B = `${J}:help`, H = J + "err", j = i;
1225
+ ), J = R(c), B = `${J}:label`, H = `${J}:help`, D = J + "err", j = i;
1209
1226
  return /* @__PURE__ */ o(me.Provider, { value: F, children: /* @__PURE__ */ f(
1210
1227
  "div",
1211
1228
  {
1212
1229
  "aria-describedby": l({
1213
- [H]: j,
1214
- [B]: s
1230
+ [D]: j,
1231
+ [H]: s
1215
1232
  }) || void 0,
1216
1233
  "aria-invalid": !!i,
1217
- "aria-labelledby": d ? U : void 0,
1234
+ "aria-labelledby": d ? B : void 0,
1218
1235
  className: l(n, "flex flex-col gap-4"),
1219
1236
  role: "radiogroup",
1220
1237
  ref: r,
1221
1238
  ...v,
1222
1239
  children: [
1223
- d && /* @__PURE__ */ o(z, { id: U, isRequired: b, isInvalid: !!i, children: d }),
1224
- s && /* @__PURE__ */ o(P, { id: B, children: s }),
1240
+ d && /* @__PURE__ */ o(z, { id: B, isRequired: b, isInvalid: !!i, children: d }),
1241
+ s && /* @__PURE__ */ o(P, { id: H, children: s }),
1225
1242
  m,
1226
- j && /* @__PURE__ */ o(k, { id: H, children: j })
1243
+ j && /* @__PURE__ */ o(k, { id: D, children: j })
1227
1244
  ]
1228
1245
  }
1229
1246
  ) });
1230
1247
  }
1231
- ), _e = g(
1248
+ ), _e = h(
1232
1249
  (e, r) => {
1233
1250
  const { children: t, className: n, isInvalid: a, size: s, ...i } = e, c = s === "small";
1234
1251
  return /* @__PURE__ */ f("div", { className: l(n, "relative", c && "text-sm"), children: [
@@ -1247,7 +1264,7 @@ const Mt = (e) => {
1247
1264
  }
1248
1265
  ),
1249
1266
  /* @__PURE__ */ o(
1250
- ee,
1267
+ te,
1251
1268
  {
1252
1269
  className: l(
1253
1270
  "pointer-events-none absolute bottom-0 top-0 my-auto",
@@ -1257,7 +1274,7 @@ const Mt = (e) => {
1257
1274
  )
1258
1275
  ] });
1259
1276
  }
1260
- ), Wt = g(
1277
+ ), Kt = h(
1261
1278
  (e, r) => {
1262
1279
  const {
1263
1280
  description: t,
@@ -1266,10 +1283,10 @@ const Mt = (e) => {
1266
1283
  label: s,
1267
1284
  disableValidation: i = !1,
1268
1285
  ...c
1269
- } = e, m = E(null), d = K(m, r), { validity: u, validationMessage: h } = L(
1286
+ } = e, m = E(null), d = K(m, r), { validity: u, validationMessage: g } = L(
1270
1287
  m,
1271
1288
  !i
1272
- ), b = R(a), p = b + "help", v = b + "err", x = n || h;
1289
+ ), b = R(a), p = b + "help", v = b + "err", x = n || g;
1273
1290
  return /* @__PURE__ */ f("div", { className: "grid gap-2", children: [
1274
1291
  /* @__PURE__ */ o(
1275
1292
  z,
@@ -1297,10 +1314,10 @@ const Mt = (e) => {
1297
1314
  x && /* @__PURE__ */ o(k, { id: v, children: x })
1298
1315
  ] });
1299
1316
  }
1300
- ), Kt = (e) => {
1317
+ ), Xt = (e) => {
1301
1318
  const { heading: r, children: t, closeSnackbar: n } = e, [a, s] = q(!1);
1302
1319
  return /* @__PURE__ */ o("div", { className: "container max-w-[59rem]", children: /* @__PURE__ */ o("div", { className: "bg-orange-light px-8 py-4 max-md:p-4", children: /* @__PURE__ */ f("div", { className: "snackbar grid items-center", children: [
1303
- /* @__PURE__ */ o(re, { className: "text-orange snackbar-icon mr-4 self-start md:mr-8 md:text-2xl" }),
1320
+ /* @__PURE__ */ o(ne, { className: "text-orange snackbar-icon mr-4 self-start md:mr-8 md:text-2xl" }),
1304
1321
  /* @__PURE__ */ o(
1305
1322
  "h3",
1306
1323
  {
@@ -1315,18 +1332,18 @@ const Mt = (e) => {
1315
1332
  ),
1316
1333
  /* @__PURE__ */ f("div", { className: "snackbar-actions flex justify-end gap-4 max-md:mt-3 md:ml-4", children: [
1317
1334
  /* @__PURE__ */ o(
1318
- D,
1335
+ _,
1319
1336
  {
1320
1337
  "aria-expanded": a,
1321
1338
  onClick: () => s(!a),
1322
1339
  children: a ? "Les mindre" : "Les mer"
1323
1340
  }
1324
1341
  ),
1325
- /* @__PURE__ */ o(D, { onClick: n, children: "Ok" })
1342
+ /* @__PURE__ */ o(_, { onClick: n, children: "Ok" })
1326
1343
  ] }),
1327
1344
  a && t
1328
1345
  ] }) }) });
1329
- }, D = (e) => /* @__PURE__ */ o(
1346
+ }, _ = (e) => /* @__PURE__ */ o(
1330
1347
  "button",
1331
1348
  {
1332
1349
  className: l(
@@ -1336,7 +1353,7 @@ const Mt = (e) => {
1336
1353
  ...e,
1337
1354
  children: e.children
1338
1355
  }
1339
- ), Xt = (e) => /* @__PURE__ */ o(
1356
+ ), Yt = (e) => /* @__PURE__ */ o(
1340
1357
  "div",
1341
1358
  {
1342
1359
  className: "snackbar-content my-4 max-h-[50vh] max-w-prose overflow-y-auto",
@@ -1380,7 +1397,7 @@ const Mt = (e) => {
1380
1397
  }
1381
1398
  );
1382
1399
  $e.Item = et;
1383
- const Yt = g(
1400
+ const Qt = h(
1384
1401
  (e, r) => {
1385
1402
  const {
1386
1403
  description: t,
@@ -1389,10 +1406,10 @@ const Yt = g(
1389
1406
  label: s,
1390
1407
  disableValidation: i = !1,
1391
1408
  ...c
1392
- } = e, m = E(null), d = K(m, r), { validity: u, validationMessage: h } = L(
1409
+ } = e, m = E(null), d = K(m, r), { validity: u, validationMessage: g } = L(
1393
1410
  m,
1394
1411
  !i
1395
- ), b = R(a), p = b + "help", v = b + "err", x = n || h;
1412
+ ), b = R(a), p = b + "help", v = b + "err", x = n || g;
1396
1413
  return /* @__PURE__ */ f("div", { className: "grid gap-2", children: [
1397
1414
  /* @__PURE__ */ o(
1398
1415
  z,
@@ -1421,7 +1438,7 @@ const Yt = g(
1421
1438
  x && /* @__PURE__ */ o(k, { id: v, children: x })
1422
1439
  ] });
1423
1440
  }
1424
- ), Qt = g(
1441
+ ), Ut = h(
1425
1442
  (e, r) => {
1426
1443
  const {
1427
1444
  description: t,
@@ -1431,10 +1448,10 @@ const Yt = g(
1431
1448
  type: i = "text",
1432
1449
  disableValidation: c = !1,
1433
1450
  ...m
1434
- } = e, d = E(null), { validity: u, validationMessage: h } = L(
1451
+ } = e, d = E(null), { validity: u, validationMessage: g } = L(
1435
1452
  d,
1436
1453
  !c
1437
- ), b = R(a), p = b + "help", v = b + "err", x = n || h, F = K(d, r);
1454
+ ), b = R(a), p = b + "help", v = b + "err", x = n || g, F = K(d, r);
1438
1455
  return /* @__PURE__ */ f("div", { className: "grid gap-2", children: [
1439
1456
  /* @__PURE__ */ o(
1440
1457
  z,
@@ -1475,9 +1492,9 @@ export {
1475
1492
  bt as Button,
1476
1493
  M as ButtonColorContext,
1477
1494
  ft as Campaign,
1478
- ht as Card,
1495
+ gt as Card,
1479
1496
  At as CardContent,
1480
- gt as CardImage,
1497
+ ht as CardImage,
1481
1498
  xt as CardLinkOverlay,
1482
1499
  pt as CardList,
1483
1500
  vt as Checkbox,
@@ -1489,37 +1506,38 @@ export {
1489
1506
  Ze as FormHeading,
1490
1507
  P as FormHelperText,
1491
1508
  z as FormLabel,
1492
- Rt as FormStep,
1509
+ kt as FormStep,
1493
1510
  We as FormStepHeader,
1494
1511
  Ke as FormStepHeaderContent,
1495
- Et as FormStepProvider,
1512
+ Rt as FormStepProvider,
1496
1513
  Ct as FormSuccess,
1497
- kt as Hero,
1498
- Lt as HeroActions,
1499
- qt as HeroContent,
1514
+ St as Hero,
1515
+ Mt as HeroActions,
1516
+ Lt as HeroContent,
1500
1517
  V as HeroContext,
1501
- St as HeroImage,
1518
+ qt as HeroImage,
1502
1519
  ce as Input,
1503
- Mt as Link,
1504
- Pt as Navbar,
1505
- Ft as NavbarCollapsible,
1506
- Tt as NavbarContent,
1507
- Jt as NavbarExpandedMobileContent,
1508
- Vt as NavbarItem,
1509
- zt as NavbarItems,
1510
- jt as Pagination,
1511
- Ot as Radio,
1512
- Zt as RadioGroup,
1513
- Wt as Select,
1514
- Kt as Snackbar,
1515
- D as SnackbarButton,
1516
- Xt as SnackbarContent,
1520
+ Pt as Link,
1521
+ zt as Navbar,
1522
+ Jt as NavbarCollapsible,
1523
+ Ft as NavbarContent,
1524
+ jt as NavbarExpandedMobileContent,
1525
+ Tt as NavbarItem,
1526
+ Vt as NavbarItems,
1527
+ Ot as Pagination,
1528
+ Zt as Radio,
1529
+ Wt as RadioGroup,
1530
+ Kt as Select,
1531
+ Xt as Snackbar,
1532
+ _ as SnackbarButton,
1533
+ Yt as SnackbarContent,
1517
1534
  $e as StepList,
1518
1535
  et as StepListItem,
1519
- Yt as TextArea,
1520
- Qt as TextField,
1521
- oe as useBlockBackgroundColor,
1536
+ Qt as TextArea,
1537
+ Ut as TextField,
1538
+ se as useBlockBackgroundColor,
1522
1539
  R as useFallbackId,
1540
+ Et as useFormContext,
1523
1541
  L as useFormControlValidity,
1524
1542
  Xe as useFormStepContext,
1525
1543
  ct as usePrefersReducedMotion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-react",
3
- "version": "1.14.0-beta.2",
3
+ "version": "1.14.0-beta.3",
4
4
  "description": "OBOS Grunnmuren design system React components",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,7 +17,6 @@
17
17
  ],
18
18
  "types": "./dist/index.d.ts",
19
19
  "devDependencies": {
20
- "@react-hookz/web": "23.0.0",
21
20
  "@storybook/addon-controls": "7.0.12",
22
21
  "@storybook/addon-docs": "7.0.12",
23
22
  "@storybook/addon-styling": "1.0.8",
@@ -41,6 +40,7 @@
41
40
  },
42
41
  "dependencies": {
43
42
  "@react-hook/merged-ref": "1.3.2",
43
+ "@react-hookz/web": "23.0.0",
44
44
  "clsx": "1.2.1",
45
45
  "react-collapsed": "4.0.2",
46
46
  "@obosbbl/grunnmuren-icons": "^0.6.0"