@stackshift-ui/signin-signup 6.0.14 → 7.0.0-beta.0
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/package.json +18 -18
- package/src/signin-signup.test.tsx +2 -2
- package/src/signin_signup_a.tsx +42 -33
- package/src/signin_signup_b.tsx +43 -30
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackshift-ui/signin-signup",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "7.0.0-beta.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -29,32 +29,32 @@
|
|
|
29
29
|
"typescript": "^5.6.2",
|
|
30
30
|
"vite-tsconfig-paths": "^5.0.1",
|
|
31
31
|
"vitest": "^2.1.1",
|
|
32
|
-
"@stackshift-ui/
|
|
33
|
-
"@stackshift-ui/
|
|
32
|
+
"@stackshift-ui/eslint-config": "6.0.10",
|
|
33
|
+
"@stackshift-ui/typescript-config": "6.0.10"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"classnames": "^2.5.1",
|
|
37
|
-
"@stackshift-ui/
|
|
38
|
-
"@stackshift-ui/card": "
|
|
39
|
-
"@stackshift-ui/heading": "
|
|
40
|
-
"@stackshift-ui/
|
|
41
|
-
"@stackshift-ui/
|
|
42
|
-
"@stackshift-ui/
|
|
43
|
-
"@stackshift-ui/
|
|
44
|
-
"@stackshift-ui/form": "
|
|
45
|
-
"@stackshift-ui/
|
|
46
|
-
"@stackshift-ui/
|
|
47
|
-
"@stackshift-ui/
|
|
48
|
-
"@stackshift-ui/
|
|
49
|
-
"@stackshift-ui/
|
|
50
|
-
"@stackshift-ui/
|
|
37
|
+
"@stackshift-ui/system": "6.1.0-beta.0",
|
|
38
|
+
"@stackshift-ui/card": "7.0.0-beta.0",
|
|
39
|
+
"@stackshift-ui/heading": "7.0.0-beta.0",
|
|
40
|
+
"@stackshift-ui/button": "6.1.0-beta.0",
|
|
41
|
+
"@stackshift-ui/input": "7.0.0-beta.0",
|
|
42
|
+
"@stackshift-ui/scripts": "6.1.0-beta.0",
|
|
43
|
+
"@stackshift-ui/text": "7.0.0-beta.0",
|
|
44
|
+
"@stackshift-ui/form": "7.0.0-beta.0",
|
|
45
|
+
"@stackshift-ui/link": "6.0.12-beta.0",
|
|
46
|
+
"@stackshift-ui/image": "6.1.0-beta.0",
|
|
47
|
+
"@stackshift-ui/form-field": "7.0.0-beta.0",
|
|
48
|
+
"@stackshift-ui/section": "7.0.0-beta.0",
|
|
49
|
+
"@stackshift-ui/container": "7.0.0-beta.0",
|
|
50
|
+
"@stackshift-ui/flex": "7.0.0-beta.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@types/react": "16.8 - 19",
|
|
54
54
|
"next": "10 - 14",
|
|
55
55
|
"react": "16.8 - 19",
|
|
56
56
|
"react-dom": "16.8 - 19",
|
|
57
|
-
"@stackshift-ui/system": ">=6.0.
|
|
57
|
+
"@stackshift-ui/system": ">=6.1.0-beta.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependenciesMeta": {
|
|
60
60
|
"next": {
|
|
@@ -7,7 +7,7 @@ describe.concurrent("signin-signup", () => {
|
|
|
7
7
|
|
|
8
8
|
test.skip("Dummy test - test if renders without errors", ({ expect }) => {
|
|
9
9
|
const clx = "my-class";
|
|
10
|
-
render(<SigninSignup />);
|
|
11
|
-
expect(screen.getByTestId("
|
|
10
|
+
render(<SigninSignup data-testid="signin-signup" />);
|
|
11
|
+
expect(screen.getByTestId("signin-signup").classList).toContain(clx);
|
|
12
12
|
});
|
|
13
13
|
});
|
package/src/signin_signup_a.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import { Section } from "@stackshift-ui/section";
|
|
|
11
11
|
import { Text } from "@stackshift-ui/text";
|
|
12
12
|
import React from "react";
|
|
13
13
|
|
|
14
|
+
import { buildSanityLink } from "@stackshift-ui/system";
|
|
14
15
|
import { SignUpFormProps } from ".";
|
|
15
16
|
import { logoLink, thankYouPageLink } from "./helper";
|
|
16
17
|
import { LabeledRoute, LabeledRouteWithKey, Logo, Form as iForm } from "./types";
|
|
@@ -104,9 +105,8 @@ function SignupForm({
|
|
|
104
105
|
<div className="text-center">
|
|
105
106
|
{form?.buttonLabel && (
|
|
106
107
|
<Button
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
ariaLabel={form?.buttonLabel ?? "Sign Up form submit button"}
|
|
108
|
+
variant="default"
|
|
109
|
+
aria-label={form?.buttonLabel ?? "Sign Up form submit button"}
|
|
110
110
|
className="w-full py-4 text-sm font-bold tex-gray-50"
|
|
111
111
|
type="submit">
|
|
112
112
|
{form?.buttonLabel}
|
|
@@ -134,14 +134,11 @@ function FormFields({
|
|
|
134
134
|
<div className="w-full px-2 mb-3 lg:w-1/2" key={index}>
|
|
135
135
|
{formFields.type === "inputText" ? (
|
|
136
136
|
<Input
|
|
137
|
-
textSize="sm"
|
|
138
|
-
variant="primary"
|
|
139
|
-
noLabel
|
|
140
137
|
placeholder={formFields?.placeholder}
|
|
141
138
|
required={formFields?.isRequired}
|
|
142
139
|
className="w-full py-4 text-xs bg-white"
|
|
143
140
|
name={formFields?.name}
|
|
144
|
-
|
|
141
|
+
aria-label={formFields?.label}
|
|
145
142
|
{...formFields}
|
|
146
143
|
type="text"
|
|
147
144
|
/>
|
|
@@ -193,16 +190,23 @@ function FormFields({
|
|
|
193
190
|
function SignInLink({ signInLink }: { signInLink?: LabeledRoute }) {
|
|
194
191
|
if (!signInLink?.label) return null;
|
|
195
192
|
|
|
193
|
+
const link = buildSanityLink({
|
|
194
|
+
type: signInLink?.type ?? "",
|
|
195
|
+
internalLink: signInLink?.internalLink ?? "",
|
|
196
|
+
externalLink: signInLink?.externalLink ?? "",
|
|
197
|
+
});
|
|
198
|
+
|
|
196
199
|
return (
|
|
197
200
|
<div className="w-full text-center mt-3">
|
|
198
201
|
<span className="text-xs text-gray-500">Already have an account? </span>
|
|
199
202
|
<Button
|
|
200
|
-
as="link"
|
|
201
203
|
variant="link"
|
|
202
|
-
link={signInLink}
|
|
203
204
|
className="text-xs text-primary cursor-pointer hover:underline"
|
|
204
|
-
|
|
205
|
-
|
|
205
|
+
aria-label={signInLink?.label}
|
|
206
|
+
asChild>
|
|
207
|
+
<Link href={link.href} target={link.target} rel={link.rel}>
|
|
208
|
+
{signInLink?.label}
|
|
209
|
+
</Link>
|
|
206
210
|
</Button>
|
|
207
211
|
</div>
|
|
208
212
|
);
|
|
@@ -221,10 +225,7 @@ function PasswordField({
|
|
|
221
225
|
<div className="flex flex-col sm:flex-row gap-2 sm:items-center">
|
|
222
226
|
<Input
|
|
223
227
|
className="py-4"
|
|
224
|
-
textSize="sm"
|
|
225
|
-
noLabel
|
|
226
228
|
aria-label={formFields?.placeholder ?? formFields?.name}
|
|
227
|
-
variant="primary"
|
|
228
229
|
type={showPassword ? "text" : "password"}
|
|
229
230
|
placeholder={formFields?.placeholder}
|
|
230
231
|
name={formFields?.name}
|
|
@@ -233,8 +234,7 @@ function PasswordField({
|
|
|
233
234
|
{/* SVG icon on the right of the password input field */}
|
|
234
235
|
<Button
|
|
235
236
|
variant="unstyled"
|
|
236
|
-
|
|
237
|
-
ariaLabel={showPassword ? "Show password" : "Hide password"}
|
|
237
|
+
aria-label={showPassword ? "Show password" : "Hide password"}
|
|
238
238
|
className="focus:outline-none"
|
|
239
239
|
type="button"
|
|
240
240
|
onClick={togglePassword}>
|
|
@@ -252,23 +252,32 @@ function FormLinks({ formLinks }: { formLinks?: LabeledRouteWithKey[] }) {
|
|
|
252
252
|
|
|
253
253
|
return (
|
|
254
254
|
<p className="mt-10 lg:mt-3 text-xs text-center text-gray-700">
|
|
255
|
-
{formLinks?.map((link: any, index: number, { length }: any) =>
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
255
|
+
{formLinks?.map((link: any, index: number, { length }: any) => {
|
|
256
|
+
const linkObj = buildSanityLink({
|
|
257
|
+
type: link?.type ?? "",
|
|
258
|
+
internalLink: link?.internalLink ?? "",
|
|
259
|
+
externalLink: link?.externalLink ?? "",
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
return (
|
|
263
|
+
<span key={index}>
|
|
264
|
+
<Button
|
|
265
|
+
variant="link"
|
|
266
|
+
className="text-xs text-primary cursor-pointer hover:underline"
|
|
267
|
+
aria-label={link?.label}
|
|
268
|
+
asChild>
|
|
269
|
+
<Link href={linkObj.href} target={linkObj.target} rel={linkObj.rel}>
|
|
270
|
+
{link?.label}
|
|
271
|
+
</Link>
|
|
272
|
+
</Button>
|
|
273
|
+
{index === length - 1 ? null : index === length - 2 ? (
|
|
274
|
+
<span> and </span>
|
|
275
|
+
) : (
|
|
276
|
+
<span> , </span>
|
|
277
|
+
)}
|
|
278
|
+
</span>
|
|
279
|
+
);
|
|
280
|
+
})}
|
|
272
281
|
</p>
|
|
273
282
|
);
|
|
274
283
|
}
|
package/src/signin_signup_b.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { Image } from "@stackshift-ui/image";
|
|
|
9
9
|
import { Input } from "@stackshift-ui/input";
|
|
10
10
|
import { Link } from "@stackshift-ui/link";
|
|
11
11
|
import { Section } from "@stackshift-ui/section";
|
|
12
|
+
import { buildSanityLink } from "@stackshift-ui/system";
|
|
12
13
|
import { Text } from "@stackshift-ui/text";
|
|
13
14
|
import React from "react";
|
|
14
15
|
import { SignUpFormProps } from ".";
|
|
@@ -21,7 +22,7 @@ export default function SigninSignup_B({ logo, form, formLinks, signInLink }: Si
|
|
|
21
22
|
<Container maxWidth={1280}>
|
|
22
23
|
<Container maxWidth={576}>
|
|
23
24
|
<LogoSection logo={logo} />
|
|
24
|
-
<Card
|
|
25
|
+
<Card className="p-6 mb-6 bg-white lg:mb-10 lg:p-12 rounded-md">
|
|
25
26
|
<SubtitleAndHeadingText form={form} />
|
|
26
27
|
<SignupForm form={form} signInLink={signInLink} />
|
|
27
28
|
</Card>
|
|
@@ -167,9 +168,7 @@ function PasswordField({
|
|
|
167
168
|
return (
|
|
168
169
|
<div className="flex flex-col sm:flex-row gap-2 items-center">
|
|
169
170
|
<Input
|
|
170
|
-
|
|
171
|
-
ariaLabel={formFields?.placeholder ?? formFields?.name}
|
|
172
|
-
variant="secondary"
|
|
171
|
+
aria-label={formFields?.placeholder ?? formFields?.name}
|
|
173
172
|
type={showPassword ? "text" : "password"}
|
|
174
173
|
placeholder={formFields?.placeholder}
|
|
175
174
|
name={formFields?.name}
|
|
@@ -178,8 +177,7 @@ function PasswordField({
|
|
|
178
177
|
{/* SVG icon on the right of the password input field */}
|
|
179
178
|
<Button
|
|
180
179
|
variant="unstyled"
|
|
181
|
-
|
|
182
|
-
ariaLabel={showPassword ? "Show password" : "Hide password"}
|
|
180
|
+
aria-label={showPassword ? "Show password" : "Hide password"}
|
|
183
181
|
className="focus:outline-none"
|
|
184
182
|
type="button"
|
|
185
183
|
onClick={togglePassword}>
|
|
@@ -197,10 +195,9 @@ function FormButtonLabel({ form }: { form?: iForm }) {
|
|
|
197
195
|
|
|
198
196
|
return (
|
|
199
197
|
<Button
|
|
200
|
-
as="button"
|
|
201
198
|
className="w-full py-4 mb-3"
|
|
202
|
-
|
|
203
|
-
variant="
|
|
199
|
+
aria-label={form?.buttonLabel ?? "Sign Up form submit button"}
|
|
200
|
+
variant="default"
|
|
204
201
|
type="submit">
|
|
205
202
|
{form?.buttonLabel}
|
|
206
203
|
</Button>
|
|
@@ -210,16 +207,23 @@ function FormButtonLabel({ form }: { form?: iForm }) {
|
|
|
210
207
|
function SigninLink({ signInLink }: { signInLink?: LabeledRoute }) {
|
|
211
208
|
if (!signInLink?.label) return null;
|
|
212
209
|
|
|
210
|
+
const link = buildSanityLink({
|
|
211
|
+
type: signInLink?.type ?? "",
|
|
212
|
+
internalLink: signInLink?.internalLink ?? "",
|
|
213
|
+
externalLink: signInLink?.externalLink ?? "",
|
|
214
|
+
});
|
|
215
|
+
|
|
213
216
|
return (
|
|
214
217
|
<span className="text-xs text-gray-900">
|
|
215
218
|
<span>Already have an account?</span>{" "}
|
|
216
219
|
<Button
|
|
217
|
-
as="link"
|
|
218
220
|
variant="link"
|
|
219
|
-
link={signInLink}
|
|
220
221
|
className="text-xs text-primary hover:underline"
|
|
221
|
-
|
|
222
|
-
|
|
222
|
+
aria-label={signInLink?.label}
|
|
223
|
+
asChild>
|
|
224
|
+
<Link href={link.href} target={link.target} rel={link.rel}>
|
|
225
|
+
{signInLink?.label}
|
|
226
|
+
</Link>
|
|
223
227
|
</Button>
|
|
224
228
|
</span>
|
|
225
229
|
);
|
|
@@ -230,23 +234,32 @@ function FormLinks({ formLinks }: { formLinks?: LabeledRoute[] }) {
|
|
|
230
234
|
|
|
231
235
|
return (
|
|
232
236
|
<p className="text-xs text-center text-secondary-foreground">
|
|
233
|
-
{formLinks?.map((link, index, { length }) =>
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
237
|
+
{formLinks?.map((link, index, { length }) => {
|
|
238
|
+
const linkObj = buildSanityLink({
|
|
239
|
+
type: link?.type ?? "",
|
|
240
|
+
internalLink: link?.internalLink ?? "",
|
|
241
|
+
externalLink: link?.externalLink ?? "",
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
return (
|
|
245
|
+
<span key={index}>
|
|
246
|
+
<Button
|
|
247
|
+
variant="link"
|
|
248
|
+
className="text-xs underline text-secondary-foreground hover:text-gray-50"
|
|
249
|
+
aria-label={link?.label}
|
|
250
|
+
asChild>
|
|
251
|
+
<Link href={linkObj?.href} target={linkObj?.target} rel={linkObj?.rel}>
|
|
252
|
+
{link?.label}
|
|
253
|
+
</Link>
|
|
254
|
+
</Button>
|
|
255
|
+
{index === length - 1 ? null : index === length - 2 ? (
|
|
256
|
+
<span> and </span>
|
|
257
|
+
) : (
|
|
258
|
+
<span> , </span>
|
|
259
|
+
)}
|
|
260
|
+
</span>
|
|
261
|
+
);
|
|
262
|
+
})}
|
|
250
263
|
</p>
|
|
251
264
|
);
|
|
252
265
|
}
|