@npm_leadtech/legal-contracts-ui 0.62.0 → 0.62.1

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,9 +1,9 @@
1
1
  import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
- import { Select as t } from "./Select.js";
3
- import { Textarea as i } from "./Textarea.js";
4
- import { Checkbox as l } from "./Checkbox.js";
5
- import { CommunicationIcon as n } from "./CommunicationIcon.js";
2
+ import { Textarea as t } from "./Textarea.js";
3
+ import { Checkbox as i } from "./Checkbox.js";
4
+ import { CommunicationIcon as l } from "./CommunicationIcon.js";
6
5
  import { Input as a } from "./Input.js";
6
+ import { Select as n } from "./Select.js";
7
7
  import { Item as o } from "./Item.js";
8
8
  import { Button as s } from "./Button.js";
9
9
  const c = [
@@ -31,7 +31,7 @@ const c = [
31
31
  }
32
32
  ),
33
33
  /* @__PURE__ */ e(
34
- t,
34
+ n,
35
35
  {
36
36
  label: "Subject",
37
37
  id: "subject",
@@ -41,9 +41,9 @@ const c = [
41
41
  required: !0
42
42
  }
43
43
  ),
44
- /* @__PURE__ */ e(i, { label: "Your Message", id: "message", name: "message", placeholder: "Write your message here", required: !0 }),
44
+ /* @__PURE__ */ e(t, { label: "Your Message", id: "message", name: "message", placeholder: "Write your message here", required: !0 }),
45
45
  /* @__PURE__ */ e("p", { className: "text-small text-neutral-600", children: "* Required fields" }),
46
- /* @__PURE__ */ e(l, { id: "privacy", name: "privacy", required: !0, children: /* @__PURE__ */ r("span", { children: [
46
+ /* @__PURE__ */ e(i, { id: "privacy", name: "privacy", required: !0, children: /* @__PURE__ */ r("span", { children: [
47
47
  "I have read and accept the",
48
48
  " ",
49
49
  /* @__PURE__ */ e(
@@ -61,7 +61,7 @@ const c = [
61
61
  o,
62
62
  {
63
63
  id: "ID",
64
- image: /* @__PURE__ */ e(n, { className: "size-5", "aria-hidden": "true" }),
64
+ image: /* @__PURE__ */ e(l, { className: "size-5", "aria-hidden": "true" }),
65
65
  description: "This information is required for the security verification process.",
66
66
  className: "text-small flex items-start gap-3 rounded bg-neutral-50 p-4 text-neutral-600"
67
67
  }
@@ -1,30 +1,93 @@
1
- import { jsx as l, jsxs as s, Fragment as a } from "react/jsx-runtime";
2
- import { TrustedBadge as n } from "./TrustedBadge.js";
3
- import { PreformOption as p } from "./PreformOption.js";
4
- import { Input as o } from "./Input.js";
5
- import { LinkWrapper as t } from "./LinkWrapper.js";
6
- const b = ({ trustedBadge: c, cta: x, inputFieldData: e, radioFieldData: r }) => /* @__PURE__ */ l("section", { className: "bg-neutral-25 pt-10 text-neutral-800 sm:px-6 lg:px-8 xl:px-30", children: /* @__PURE__ */ s("div", { className: "relative mx-auto flex max-w-300 flex-col gap-6 rounded bg-white px-6 pt-8 pb-6 shadow-md sm:items-center sm:gap-8 lg:px-26 xl:px-10", children: [
7
- /* @__PURE__ */ l(n, { ...c }),
8
- r?.isVisible && /* @__PURE__ */ s(a, { children: [
9
- /* @__PURE__ */ l("h2", { className: "text-medium sm:text-large font-bold", children: r.label }),
10
- /* @__PURE__ */ s("div", { className: "flex w-full max-w-272 flex-wrap justify-center gap-2 sm:gap-4", children: [
11
- r.options.map((m) => /* @__PURE__ */ l(
1
+ "use client";
2
+ import { jsxs as r, Fragment as a, jsx as l } from "react/jsx-runtime";
3
+ import { useState as g, useRef as w, useEffect as u } from "react";
4
+ import { PreformOption as N } from "./PreformOption.js";
5
+ import { Input as m } from "./Input.js";
6
+ import { TrustedBadge as i } from "./TrustedBadge.js";
7
+ import { Select as C } from "./Select.js";
8
+ import { LinkWrapper as d } from "./LinkWrapper.js";
9
+ const P = ({ trustedBadge: o, cta: h, inputFieldData: e, radioFieldData: n }) => {
10
+ const [f, v] = g(!1), x = w(null);
11
+ u(() => {
12
+ const s = x.current;
13
+ if (!s) return;
14
+ const c = new IntersectionObserver(
15
+ ([p]) => {
16
+ v(!p.isIntersecting);
17
+ },
18
+ { threshold: 0 }
19
+ );
20
+ return c.observe(s), () => {
21
+ c.disconnect();
22
+ };
23
+ }, []);
24
+ const t = (s) => /* @__PURE__ */ r("div", { className: `flex flex-col bg-white px-6 py-4 ${s ? "shadow" : ""}`, children: [
25
+ /* @__PURE__ */ l(
26
+ "label",
27
+ {
28
+ htmlFor: `${n?.name ?? ""}-${s ? "sticky" : "desktop"}`,
29
+ className: "text-medium mb-4 font-bold text-neutral-800",
30
+ children: n?.label
31
+ }
32
+ ),
33
+ /* @__PURE__ */ r("div", { className: `flex items-center gap-4 ${s ? "flex-row" : "flex-col"}`, children: [
34
+ n?.isVisible && /* @__PURE__ */ l(
35
+ C,
36
+ {
37
+ id: `${n.name}-${s ? "sticky" : "desktop"}`,
38
+ name: n.name,
39
+ value: n.radioSelected,
40
+ options: n.options,
41
+ containerClassName: "w-full relative",
42
+ onChange: (c) => {
43
+ n.onClick(c.target.value);
44
+ }
45
+ }
46
+ ),
47
+ e?.isVisible && !s && /* @__PURE__ */ l("div", { className: "flex justify-center", children: /* @__PURE__ */ l(
48
+ m,
49
+ {
50
+ id: e.id,
51
+ label: e.label,
52
+ name: e.name,
53
+ placeholder: e.placeholder,
54
+ value: e.value,
55
+ onInputChange: e.onChange
56
+ }
57
+ ) }, e.name),
58
+ /* @__PURE__ */ l(d, { variant: "primary-green", className: s ? "w-fit text-nowrap" : "w-full", children: h })
59
+ ] }),
60
+ e?.isVisible && s && /* @__PURE__ */ l("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ l(
61
+ m,
62
+ {
63
+ id: `${e.id}-sticky`,
64
+ label: e.label,
65
+ name: e.name,
66
+ placeholder: e.placeholder,
67
+ value: e.value,
68
+ onInputChange: e.onChange
69
+ }
70
+ ) }, e.name)
71
+ ] }), b = n?.isVisible && /* @__PURE__ */ r(a, { children: [
72
+ /* @__PURE__ */ l("h2", { className: "text-medium sm:text-large font-bold", children: n.label }),
73
+ /* @__PURE__ */ r("div", { className: "flex w-full max-w-272 flex-wrap justify-center gap-2 sm:gap-4", children: [
74
+ n.options.map((s) => /* @__PURE__ */ l(
12
75
  "div",
13
76
  {
14
77
  className: "w-[calc(50%-4px)] sm:w-[calc(25%-12px)] lg:w-[calc(20%-13px)] xl:w-[calc(16.66%-14px)]",
15
78
  children: /* @__PURE__ */ l(
16
- p,
79
+ N,
17
80
  {
18
- ...m,
19
- selected: m.value === r.radioSelected,
20
- onClick: r.onClick
81
+ ...s,
82
+ selected: s.value === n.radioSelected,
83
+ onClick: n.onClick
21
84
  }
22
85
  )
23
86
  },
24
- m.value
87
+ s.value
25
88
  )),
26
89
  e?.isVisible && /* @__PURE__ */ l("div", { className: "mt-4 flex basis-full justify-center md:mt-0", children: /* @__PURE__ */ l(
27
- o,
90
+ m,
28
91
  {
29
92
  id: e.id,
30
93
  label: e.label,
@@ -35,9 +98,20 @@ const b = ({ trustedBadge: c, cta: x, inputFieldData: e, radioFieldData: r }) =>
35
98
  }
36
99
  ) }, e.name)
37
100
  ] })
38
- ] }),
39
- /* @__PURE__ */ l(t, { variant: "primary-green", children: x })
40
- ] }) });
101
+ ] });
102
+ return /* @__PURE__ */ r(a, { children: [
103
+ /* @__PURE__ */ l("section", { className: "bg-neutral-25 hidden pt-10 text-neutral-800 sm:block sm:px-6 lg:px-8 xl:px-30", children: /* @__PURE__ */ r("div", { className: "relative mx-auto flex max-w-300 flex-col gap-6 rounded bg-white px-6 pt-8 pb-6 shadow-md sm:items-center sm:gap-8 lg:px-26 xl:px-10", children: [
104
+ /* @__PURE__ */ l(i, { ...o }),
105
+ b,
106
+ /* @__PURE__ */ l(d, { variant: "primary-green", children: h })
107
+ ] }) }),
108
+ /* @__PURE__ */ l("section", { className: "bg-neutral-25 pt-10 text-neutral-800 sm:hidden", children: /* @__PURE__ */ r("div", { className: "relative mx-auto flex max-w-300 flex-col rounded bg-white pt-8 shadow-md", children: [
109
+ /* @__PURE__ */ l("div", { className: "px-6", children: /* @__PURE__ */ l(i, { ...o }) }),
110
+ /* @__PURE__ */ l("div", { ref: x, className: f ? "invisible" : void 0, children: t(!1) })
111
+ ] }) }),
112
+ f && /* @__PURE__ */ l("div", { className: "fixed bottom-0 left-0 z-50 w-full sm:hidden", children: t(!0) })
113
+ ] });
114
+ };
41
115
  export {
42
- b as Preform
116
+ P as Preform
43
117
  };
@@ -3,7 +3,7 @@ import { FC } from 'react';
3
3
  export declare const Select: FC<SelectProps>;
4
4
 
5
5
  export declare interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
6
- label: string;
6
+ label?: string;
7
7
  id: string;
8
8
  name: string;
9
9
  required?: boolean;
@@ -12,5 +12,6 @@ export declare interface SelectProps extends React.SelectHTMLAttributes<HTMLSele
12
12
  label: string;
13
13
  value: string;
14
14
  }[];
15
+ containerClassName?: string;
15
16
  }
16
17
 
@@ -1,19 +1,28 @@
1
1
  import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
- const o = ({ label: a, id: t, name: u, required: s = !1, placeholder: d, options: n, ...c }) => /* @__PURE__ */ l("div", { className: "flex flex-col gap-2", children: [
3
- /* @__PURE__ */ l("label", { htmlFor: t, className: "text-medium font-bold text-neutral-800", children: [
4
- a,
2
+ const m = ({
3
+ label: t,
4
+ id: a,
5
+ name: u,
6
+ required: s = !1,
7
+ placeholder: d,
8
+ options: n,
9
+ containerClassName: c = "",
10
+ ...i
11
+ }) => /* @__PURE__ */ l("div", { className: `flex flex-col gap-2 ${c}`, children: [
12
+ t && /* @__PURE__ */ l("label", { htmlFor: a, className: "text-medium font-bold text-neutral-800", children: [
13
+ t,
5
14
  " ",
6
15
  s && /* @__PURE__ */ r("span", { className: "text-red-500", children: "*" })
7
16
  ] }),
8
17
  /* @__PURE__ */ l(
9
18
  "select",
10
19
  {
11
- id: t,
20
+ id: a,
12
21
  name: u,
13
22
  required: !0,
14
23
  defaultValue: "",
15
24
  className: "bg-neutral-25 text-small focus-visible:outline-primary-500 w-full rounded border border-neutral-200 px-4 py-2 text-neutral-800 placeholder:text-neutral-400 focus-visible:outline-2",
16
- ...c,
25
+ ...i,
17
26
  children: [
18
27
  /* @__PURE__ */ r("option", { value: "", disabled: !0, children: d }),
19
28
  n.map((e) => /* @__PURE__ */ r("option", { value: e.value, children: e.label }, e.value))
@@ -22,5 +31,5 @@ const o = ({ label: a, id: t, name: u, required: s = !1, placeholder: d, options
22
31
  )
23
32
  ] });
24
33
  export {
25
- o as Select
34
+ m as Select
26
35
  };