@axos-web-dev/shared-components 2.0.0-dev.4-fix-0 → 2.0.0-dev.6

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.
@@ -4,6 +4,8 @@ export type BoatMooringLocationInputs = {
4
4
  email: string;
5
5
  firstName: string;
6
6
  lastName: string;
7
+ boatOwnedByLlc: "Yes" | "No";
8
+ llcName: string;
7
9
  boatName: string;
8
10
  marinaAddress: string;
9
11
  marinaAddress2: string;
@@ -55,6 +55,8 @@ const BoatMooringLocation = ({
55
55
  email: z.string().email({ message: "Email is required." }).refine(cachedEmailValidator, { message: "Invalid email address." }),
56
56
  firstName: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g).trim().min(1, { message: "First Name is required." }),
57
57
  lastName: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g).trim().min(1, { message: "First Name is required." }),
58
+ boatOwnedByLlc: z.string().trim().optional().or(z.literal("")),
59
+ llcName: z.string().trim().optional().or(z.literal("")),
58
60
  boatName: z.string().trim(),
59
61
  marinaAddress: z.string().trim(),
60
62
  marinaAddress2: z.string().trim().optional().or(z.literal("")),
@@ -80,6 +82,13 @@ const BoatMooringLocation = ({
80
82
  message: "fields are not valid."
81
83
  });
82
84
  }
85
+ if (data.boatOwnedByLlc === "Yes" && !String(data.llcName ?? "").trim()) {
86
+ ctx.addIssue({
87
+ code: z.ZodIssueCode.custom,
88
+ message: "Name of LLC is required.",
89
+ path: ["llcName"]
90
+ });
91
+ }
83
92
  });
84
93
  const methods = useForm({
85
94
  resolver: zodResolver(gen_schema),
@@ -97,8 +106,10 @@ const BoatMooringLocation = ({
97
106
  } = methods;
98
107
  const seasonMove = watch("seasonallyMove");
99
108
  const isCharter = watch("charter");
109
+ const boatOwnedByLlc = watch("boatOwnedByLlc");
100
110
  const renderExtraFields = seasonMove === "Yes";
101
111
  const renderCharterFields = isCharter === "Yes";
112
+ const renderLlcNameField = boatOwnedByLlc === "Yes";
102
113
  const submitForm = async (data) => {
103
114
  await onSubmit(data);
104
115
  };
@@ -160,6 +171,51 @@ const BoatMooringLocation = ({
160
171
  variant
161
172
  }
162
173
  ) }),
174
+ /* @__PURE__ */ jsx("div", { className: fullRowForm, children: /* @__PURE__ */ jsxs(
175
+ RadioButtonSet,
176
+ {
177
+ id: "boatOwnedByLlc",
178
+ label: "Is your boat owned by an LLC?",
179
+ sizes: "medium",
180
+ required: true,
181
+ error: !!errors.boatOwnedByLlc,
182
+ helperText: errors.boatOwnedByLlc?.message,
183
+ variant,
184
+ children: [
185
+ /* @__PURE__ */ jsx(
186
+ RadioButton,
187
+ {
188
+ ...register("boatOwnedByLlc"),
189
+ value: "Yes",
190
+ radioText: "Yes",
191
+ groupName: "boatOwnedByLlc"
192
+ }
193
+ ),
194
+ /* @__PURE__ */ jsx(
195
+ RadioButton,
196
+ {
197
+ ...register("boatOwnedByLlc"),
198
+ value: "No",
199
+ radioText: "No",
200
+ groupName: "boatOwnedByLlc"
201
+ }
202
+ )
203
+ ]
204
+ }
205
+ ) }),
206
+ renderLlcNameField && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
207
+ Input,
208
+ {
209
+ id: "llcName",
210
+ ...register("llcName"),
211
+ label: "Name of LLC",
212
+ sizes: "medium",
213
+ required: true,
214
+ error: !!errors.llcName,
215
+ helperText: errors.llcName?.message,
216
+ variant
217
+ }
218
+ ) }),
163
219
  /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
164
220
  Input,
165
221
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@axos-web-dev/shared-components",
3
3
  "description": "Axos shared components library for web.",
4
- "version": "2.0.0-dev.4-fix-0",
4
+ "version": "2.0.0-dev.6",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "module": "dist/main.js",