doct-ui-auth-kit 1.0.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/README.md +266 -0
- package/dist/adapters/http-auth-adapter.d.ts +11 -0
- package/dist/adapters/index.d.ts +1 -0
- package/dist/auth-methods/apple.d.ts +19 -0
- package/dist/auth-methods/google.d.ts +65 -0
- package/dist/auth-methods/index.d.ts +2 -0
- package/dist/components/auth/repeat-login.d.ts +24 -0
- package/dist/components/form/rhf-doct-phone-input.d.ts +2 -0
- package/dist/components/form/rhf-input-field.d.ts +2 -0
- package/dist/components/form/rhf-otp-input-field.d.ts +2 -0
- package/dist/components/form/rhf-password-field.d.ts +2 -0
- package/dist/components/layout/auth-layout.d.ts +89 -0
- package/dist/components/layout/image-slider.d.ts +45 -0
- package/dist/components/layout/index.d.ts +6 -0
- package/dist/components/layout/main-layout.d.ts +74 -0
- package/dist/constants/demo-slider.d.ts +16 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/core/auth-api-adapter.d.ts +38 -0
- package/dist/core/auth-context.d.ts +67 -0
- package/dist/core/auth-flow.d.ts +5 -0
- package/dist/core/auth-provider.d.ts +39 -0
- package/dist/core/auth-types.d.ts +68 -0
- package/dist/core/device-detection.d.ts +23 -0
- package/dist/core/index.d.ts +11 -0
- package/dist/core/sso-session.d.ts +35 -0
- package/dist/core/use-auth-flow.d.ts +79 -0
- package/dist/docthub.svg +5 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/use-login-entry-form.d.ts +32 -0
- package/dist/hooks/use-otp-verification.d.ts +29 -0
- package/dist/hooks/use-signup-form.d.ts +37 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +7405 -0
- package/dist/logo.png +0 -0
- package/dist/pages/conflict.d.ts +12 -0
- package/dist/pages/foreign-email-collect.d.ts +16 -0
- package/dist/pages/index.d.ts +7 -0
- package/dist/pages/login-entry.d.ts +23 -0
- package/dist/pages/main-login.d.ts +26 -0
- package/dist/pages/otp-verification.d.ts +21 -0
- package/dist/pages/repeat-login.d.ts +20 -0
- package/dist/pages/signup.d.ts +17 -0
- package/dist/pages.js +10 -0
- package/dist/signup-Cnybfnhd.js +720 -0
- package/dist/slider/slide-1.png +0 -0
- package/dist/slider/slide-2.png +0 -0
- package/dist/slider/slide-3.png +0 -0
- package/dist/slider/slide-4.png +0 -0
- package/dist/slider/slide-5.png +0 -0
- package/dist/types/auth-layout-types.d.ts +94 -0
- package/dist/types/common.d.ts +25 -0
- package/dist/types/forms.d.ts +124 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/user.d.ts +31 -0
- package/dist/vite.svg +1 -0
- package/package.json +104 -0
package/README.md
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# doct-ui-auth-kit
|
|
2
|
+
|
|
3
|
+
A composable React auth SDK for building authentication and onboarding experiences. Built with React composition patterns for maximum flexibility and scalability.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install doct-ui-auth-kit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer dependencies (install in your app if not already present):
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install react react-dom docthub-core-components react-hook-form zod
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Consumer imports
|
|
18
|
+
|
|
19
|
+
Install the package and import components, layouts, and types from the library:
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import {
|
|
23
|
+
AuthLayout,
|
|
24
|
+
OtpVerification,
|
|
25
|
+
type OtpVerificationProps,
|
|
26
|
+
} from 'doct-ui-auth-kit';
|
|
27
|
+
|
|
28
|
+
function Example() {
|
|
29
|
+
const handleSubmit: OtpVerificationProps['onSubmit'] = (otp) => {
|
|
30
|
+
// handle OTP
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<AuthLayout.Root variant="mobile" maxWidth="sm">
|
|
35
|
+
<AuthLayout.Main>
|
|
36
|
+
<AuthLayout.Body>
|
|
37
|
+
<OtpVerification
|
|
38
|
+
mode="phone"
|
|
39
|
+
recipientDisplay="+91 9825910X0X"
|
|
40
|
+
onSubmit={handleSubmit}
|
|
41
|
+
/>
|
|
42
|
+
</AuthLayout.Body>
|
|
43
|
+
</AuthLayout.Main>
|
|
44
|
+
</AuthLayout.Root>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Components
|
|
50
|
+
|
|
51
|
+
### AuthLayout
|
|
52
|
+
|
|
53
|
+
A compound component system for authentication pages using composition pattern. Provides consistent spacing, responsive centering, and flexible content organization.
|
|
54
|
+
|
|
55
|
+
#### Design Philosophy
|
|
56
|
+
|
|
57
|
+
The `AuthLayout` uses compound components (slot-based pattern) to provide maximum flexibility. Each slot can be independently composed, reordered, or omitted based on your needs.
|
|
58
|
+
|
|
59
|
+
#### Usage
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import { AuthLayout } from '@/components/layout';
|
|
63
|
+
|
|
64
|
+
<AuthLayout.Root variant="desktop" maxWidth="md">
|
|
65
|
+
<AuthLayout.Header>
|
|
66
|
+
<EnterpriseLoginBadge />
|
|
67
|
+
</AuthLayout.Header>
|
|
68
|
+
<AuthLayout.Main>
|
|
69
|
+
<AuthLayout.Logo>
|
|
70
|
+
<img src="/logo.svg" alt="Docthub" />
|
|
71
|
+
</AuthLayout.Logo>
|
|
72
|
+
<AuthLayout.Title>
|
|
73
|
+
<h1>The Healthcare Career App</h1>
|
|
74
|
+
</AuthLayout.Title>
|
|
75
|
+
<AuthLayout.Description>
|
|
76
|
+
<p>Continue to Signup, If you already have an account we'll log you in.</p>
|
|
77
|
+
</AuthLayout.Description>
|
|
78
|
+
<AuthLayout.Body>
|
|
79
|
+
<button>Continue with Mobile</button>
|
|
80
|
+
<button>Continue with Email</button>
|
|
81
|
+
</AuthLayout.Body>
|
|
82
|
+
</AuthLayout.Main>
|
|
83
|
+
<AuthLayout.Footer>
|
|
84
|
+
<p>Terms and Privacy links</p>
|
|
85
|
+
</AuthLayout.Footer>
|
|
86
|
+
</AuthLayout.Root>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
#### Components
|
|
90
|
+
|
|
91
|
+
**`AuthLayout.Root`**
|
|
92
|
+
- Main container providing layout context to all child slots
|
|
93
|
+
- Props:
|
|
94
|
+
- `variant?: 'mobile' | 'desktop'` - Layout variant (default: 'mobile')
|
|
95
|
+
- `maxWidth?: 'sm' | 'md' | 'lg'` - Content width constraint (default: 'sm')
|
|
96
|
+
- `className?: string` - Additional root className
|
|
97
|
+
- `contentClassName?: string` - Additional content wrapper className
|
|
98
|
+
|
|
99
|
+
**`AuthLayout.Header`**
|
|
100
|
+
- Optional header slot, renders top-right in desktop variant, above logo in mobile
|
|
101
|
+
|
|
102
|
+
**`AuthLayout.Main`**
|
|
103
|
+
- Main content wrapper that centers and constrains width of inner slots
|
|
104
|
+
|
|
105
|
+
**`AuthLayout.Logo`**
|
|
106
|
+
- Logo slot with centered alignment
|
|
107
|
+
|
|
108
|
+
**`AuthLayout.Title`**
|
|
109
|
+
- Title slot with centered alignment
|
|
110
|
+
|
|
111
|
+
**`AuthLayout.Description`**
|
|
112
|
+
- Description slot with centered alignment
|
|
113
|
+
|
|
114
|
+
**`AuthLayout.Body`**
|
|
115
|
+
- Main content area for forms, buttons, etc. with vertical spacing
|
|
116
|
+
|
|
117
|
+
**`AuthLayout.Footer`**
|
|
118
|
+
- Optional footer slot for terms, privacy links, etc.
|
|
119
|
+
|
|
120
|
+
#### Benefits of Composition Pattern
|
|
121
|
+
|
|
122
|
+
- **Flexible ordering**: Rearrange slots as needed without prop drilling
|
|
123
|
+
- **Selective rendering**: Only include the slots you need
|
|
124
|
+
- **Type safety**: Each slot has its own typed props
|
|
125
|
+
- **Extensibility**: Easy to add custom slots without breaking existing APIs
|
|
126
|
+
- **Better DX**: Clear component hierarchy in JSX
|
|
127
|
+
|
|
128
|
+
### MainLayout
|
|
129
|
+
|
|
130
|
+
Two-panel layout for authentication pages with marketing content on the left and auth content on the right.
|
|
131
|
+
|
|
132
|
+
#### Usage
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
import { MainLayout } from '@/components/layout';
|
|
136
|
+
import { AuthLayout } from '@/components/layout';
|
|
137
|
+
|
|
138
|
+
<MainLayout
|
|
139
|
+
sliderImages={['/image1.jpg', '/image2.jpg', '/image3.jpg']}
|
|
140
|
+
sliderAutoPlayInterval={5000}
|
|
141
|
+
ctaText="Get Healthcare Career App Now!"
|
|
142
|
+
>
|
|
143
|
+
<AuthLayout.Root variant="desktop" maxWidth="sm" className="bg-transparent">
|
|
144
|
+
<AuthLayout.Header>
|
|
145
|
+
<EnterpriseLoginBadge />
|
|
146
|
+
</AuthLayout.Header>
|
|
147
|
+
<AuthLayout.Main>
|
|
148
|
+
<AuthLayout.Logo>...</AuthLayout.Logo>
|
|
149
|
+
<AuthLayout.Title>...</AuthLayout.Title>
|
|
150
|
+
<AuthLayout.Body>...</AuthLayout.Body>
|
|
151
|
+
</AuthLayout.Main>
|
|
152
|
+
<AuthLayout.Footer>...</AuthLayout.Footer>
|
|
153
|
+
</AuthLayout.Root>
|
|
154
|
+
</MainLayout>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
#### Props
|
|
158
|
+
|
|
159
|
+
- `sliderImages?: string[]` - Array of image URLs for the slider (default: [])
|
|
160
|
+
- `sliderAutoPlayInterval?: number` - Auto-play interval in milliseconds (default: 5000, 0 to disable)
|
|
161
|
+
- `ctaText?: ReactNode | null` - Call-to-action text, set to null to hide
|
|
162
|
+
- `className?: string` - Additional root className
|
|
163
|
+
- `marketingClassName?: string` - Additional className for left marketing panel
|
|
164
|
+
- `contentClassName?: string` - Additional className for right content panel
|
|
165
|
+
- `children: ReactNode` - Auth content (typically AuthLayout.Root)
|
|
166
|
+
|
|
167
|
+
### ImageSlider
|
|
168
|
+
|
|
169
|
+
Image carousel component with indicator dots. Supports both controlled and uncontrolled modes.
|
|
170
|
+
|
|
171
|
+
#### Usage (Uncontrolled)
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
import { ImageSlider } from '@/components/layout';
|
|
175
|
+
|
|
176
|
+
<ImageSlider
|
|
177
|
+
images={['/image1.jpg', '/image2.jpg']}
|
|
178
|
+
autoPlayInterval={3000}
|
|
179
|
+
onSlideChange={(index) => console.log('Slide changed to', index)}
|
|
180
|
+
/>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### Usage (Controlled)
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
import { ImageSlider } from '@/components/layout';
|
|
187
|
+
import { useState } from 'react';
|
|
188
|
+
|
|
189
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
190
|
+
|
|
191
|
+
<ImageSlider
|
|
192
|
+
images={['/image1.jpg', '/image2.jpg']}
|
|
193
|
+
activeIndex={activeIndex}
|
|
194
|
+
onSlideChange={setActiveIndex}
|
|
195
|
+
onNavigate={setActiveIndex}
|
|
196
|
+
autoPlayInterval={5000}
|
|
197
|
+
/>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
#### Props
|
|
201
|
+
|
|
202
|
+
- `images: string[]` - Array of image URLs
|
|
203
|
+
- `autoPlayInterval?: number` - Auto-play interval in ms (default: 5000, 0 to disable)
|
|
204
|
+
- `className?: string` - Additional root className
|
|
205
|
+
- `hideIndicators?: boolean` - Hide built-in indicators (default: false)
|
|
206
|
+
- `onSlideChange?: (index: number) => void` - Callback when slide changes
|
|
207
|
+
- `activeIndex?: number` - Controlled active index
|
|
208
|
+
- `onNavigate?: (index: number) => void` - Callback for manual navigation in controlled mode
|
|
209
|
+
|
|
210
|
+
## Migration Guide
|
|
211
|
+
|
|
212
|
+
If you were using the old prop-based `AuthLayout`, here's how to migrate:
|
|
213
|
+
|
|
214
|
+
### Before (Old API)
|
|
215
|
+
|
|
216
|
+
```tsx
|
|
217
|
+
<AuthLayout
|
|
218
|
+
header={<Header />}
|
|
219
|
+
logo={<Logo />}
|
|
220
|
+
title="Welcome"
|
|
221
|
+
description="Sign in to continue"
|
|
222
|
+
footer={<Footer />}
|
|
223
|
+
>
|
|
224
|
+
<LoginForm />
|
|
225
|
+
</AuthLayout>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### After (New Compound API)
|
|
229
|
+
|
|
230
|
+
```tsx
|
|
231
|
+
<AuthLayout.Root variant="mobile" maxWidth="sm">
|
|
232
|
+
<AuthLayout.Header>
|
|
233
|
+
<Header />
|
|
234
|
+
</AuthLayout.Header>
|
|
235
|
+
<AuthLayout.Main>
|
|
236
|
+
<AuthLayout.Logo>
|
|
237
|
+
<Logo />
|
|
238
|
+
</AuthLayout.Logo>
|
|
239
|
+
<AuthLayout.Title>Welcome</AuthLayout.Title>
|
|
240
|
+
<AuthLayout.Description>Sign in to continue</AuthLayout.Description>
|
|
241
|
+
<AuthLayout.Body>
|
|
242
|
+
<LoginForm />
|
|
243
|
+
</AuthLayout.Body>
|
|
244
|
+
</AuthLayout.Main>
|
|
245
|
+
<AuthLayout.Footer>
|
|
246
|
+
<Footer />
|
|
247
|
+
</AuthLayout.Footer>
|
|
248
|
+
</AuthLayout.Root>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Documentation
|
|
252
|
+
|
|
253
|
+
See Storybook for interactive examples and visual documentation:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
npm run storybook
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Publishing to npm
|
|
260
|
+
|
|
261
|
+
1. **Login** (one-time): `npm login`
|
|
262
|
+
2. **Build** (runs automatically on publish): `npm run build`
|
|
263
|
+
3. **Publish**:
|
|
264
|
+
- First release: `npm publish`
|
|
265
|
+
- Scoped package (if name is taken): set `"name": "@your-org/doct-ui-auth-kit"` then `npm publish --access public`
|
|
266
|
+
4. **Use in another project**: `npm install doct-ui-auth-kit`
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP adapter that calls a compatible auth API (e.g. doct-auth-mock-api).
|
|
3
|
+
* Use with SSOAuthProvider: apiAdapter: createHttpAuthAdapter('http://localhost:3001')
|
|
4
|
+
*/
|
|
5
|
+
import type { AuthApiAdapter } from '@/core/auth-api-adapter';
|
|
6
|
+
/**
|
|
7
|
+
* Creates an AuthApiAdapter that calls the given API base URL.
|
|
8
|
+
* Expects routes: POST /api/auth/send-otp, verify-otp, complete-profile,
|
|
9
|
+
* authenticate-provider, validate-session, refresh-session.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createHttpAuthAdapter(baseUrl: string): AuthApiAdapter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createHttpAuthAdapter } from './http-auth-adapter';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apple Sign-In (future-ready stub).
|
|
3
|
+
* Implement when backend supports Apple ID credential validation.
|
|
4
|
+
*/
|
|
5
|
+
export interface UseAppleSignInOptions {
|
|
6
|
+
/** Apple client ID (Services ID). */
|
|
7
|
+
clientId: string;
|
|
8
|
+
/** Redirect URI registered in Apple Developer. */
|
|
9
|
+
redirectUri: string;
|
|
10
|
+
/** Callback when user signs in; receives the authorization code or id_token. */
|
|
11
|
+
onCredential: (credential: string) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Stub: Apple Sign-In hook. Not implemented yet.
|
|
15
|
+
* Use adapter.authenticateWithProvider({ provider: 'apple', credential }) when you have the token.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useAppleSignIn(_options: UseAppleSignInOptions): {
|
|
18
|
+
triggerSignIn: () => void;
|
|
19
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
google?: {
|
|
6
|
+
accounts: {
|
|
7
|
+
id: {
|
|
8
|
+
initialize: (config: {
|
|
9
|
+
client_id: string;
|
|
10
|
+
callback: (response: {
|
|
11
|
+
credential: string;
|
|
12
|
+
}) => void;
|
|
13
|
+
auto_select?: boolean;
|
|
14
|
+
}) => void;
|
|
15
|
+
prompt: (momentListener?: (moment: {
|
|
16
|
+
getMomentType: () => string;
|
|
17
|
+
}) => void) => void;
|
|
18
|
+
renderButton: (element: HTMLElement, options: {
|
|
19
|
+
theme?: string;
|
|
20
|
+
size?: string;
|
|
21
|
+
type?: string;
|
|
22
|
+
text?: string;
|
|
23
|
+
}) => void;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export interface UseGoogleOneTapOptions {
|
|
30
|
+
/** Google OAuth 2.0 client ID. */
|
|
31
|
+
clientId: string;
|
|
32
|
+
/** Callback when user signs in with Google; receives the ID token (credential). */
|
|
33
|
+
onCredential: (credential: string) => void;
|
|
34
|
+
/** When true, show One Tap prompt after init. Default true. */
|
|
35
|
+
enabled?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Loads Google Identity Services and optionally shows One Tap prompt.
|
|
39
|
+
* Call onCredential with the ID token to pass to adapter.authenticateWithProvider.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useGoogleOneTap({ clientId, onCredential, enabled, }: UseGoogleOneTapOptions): {
|
|
42
|
+
triggerOneTap: () => void;
|
|
43
|
+
};
|
|
44
|
+
export interface GoogleSignInButtonProps {
|
|
45
|
+
/** Google OAuth 2.0 client ID. */
|
|
46
|
+
clientId: string;
|
|
47
|
+
/** Callback when user signs in; receives the ID token. */
|
|
48
|
+
onCredential: (credential: string) => void;
|
|
49
|
+
/** Optional container ref (when using the hook directly). */
|
|
50
|
+
containerRef?: React.RefObject<HTMLDivElement | null>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Hook: renders the Google Sign-In button into the given container.
|
|
54
|
+
* Ensure the container is in the DOM (e.g. use a ref on a div).
|
|
55
|
+
*/
|
|
56
|
+
export declare function useGoogleSignInButton({ clientId, onCredential, containerRef, }: GoogleSignInButtonProps): void;
|
|
57
|
+
export interface GoogleSignInButtonComponentProps {
|
|
58
|
+
clientId: string;
|
|
59
|
+
onCredential: (credential: string) => void;
|
|
60
|
+
children?: ReactNode;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Component: renders a div that is filled with the Google-branded sign-in button.
|
|
64
|
+
*/
|
|
65
|
+
export declare function GoogleSignInButton({ clientId, onCredential, }: GoogleSignInButtonComponentProps): React.ReactElement;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface RepeatLoginProps {
|
|
2
|
+
/**
|
|
3
|
+
* Last used authentication method shown in the description and primary button label.
|
|
4
|
+
* Example: "Mobile", "Email".
|
|
5
|
+
*
|
|
6
|
+
* @default "Mobile"
|
|
7
|
+
*/
|
|
8
|
+
lastUsedMethod?: string;
|
|
9
|
+
/** Handler for the primary action (continue with last used method). */
|
|
10
|
+
onContinueWithLastMethod?: () => void;
|
|
11
|
+
/** Handler for the secondary action (choose another method). */
|
|
12
|
+
onUseAnotherMethod?: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Repeat login experience for returning users.
|
|
16
|
+
*
|
|
17
|
+
* Renders the central auth card used in the "USER LOGIN SCREEN - REPEAT"
|
|
18
|
+
* Figma design, including title, description and two actions.
|
|
19
|
+
*
|
|
20
|
+
* This component is layout-aware and is intended to be used inside
|
|
21
|
+
* an existing `AuthLayout.Root` so that it can adapt between
|
|
22
|
+
* desktop and mobile variants.
|
|
23
|
+
*/
|
|
24
|
+
export declare function RepeatLogin({ lastUsedMethod, onContinueWithLastMethod, onUseAnotherMethod, }: Readonly<RepeatLoginProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { RHFDoctPhoneInputFieldProps } from '@/types/forms';
|
|
2
|
+
export declare function RHFDoctPhoneInputField({ name, label, placeholder, helperText, defaultCountry, variant, required, disabled, control, error, }: RHFDoctPhoneInputFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { RHFPasswordFieldProps } from '@/types/forms';
|
|
2
|
+
export declare function RHFPasswordField({ name, label, placeholder, className, control, required, showPassword: showPasswordProp, togglePasswordVisibility, }: RHFPasswordFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { AuthLayoutBodyProps, AuthLayoutDescriptionProps, AuthLayoutFooterProps, AuthLayoutHeaderProps, AuthLayoutLogoProps, AuthLayoutMainProps, AuthLayoutRootProps, AuthLayoutTitleProps } from '../../types/auth-layout-types';
|
|
2
|
+
/**
|
|
3
|
+
* Root container component for auth layouts.
|
|
4
|
+
* Provides layout context to child slot components.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <AuthLayout.Root variant="desktop" maxWidth="md">
|
|
9
|
+
* <AuthLayout.Header>...</AuthLayout.Header>
|
|
10
|
+
* <AuthLayout.Logo>...</AuthLayout.Logo>
|
|
11
|
+
* <AuthLayout.Title>...</AuthLayout.Title>
|
|
12
|
+
* <AuthLayout.Description>...</AuthLayout.Description>
|
|
13
|
+
* <AuthLayout.Body>...</AuthLayout.Body>
|
|
14
|
+
* <AuthLayout.Footer>...</AuthLayout.Footer>
|
|
15
|
+
* </AuthLayout.Root>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare function AuthLayoutRoot({ children, variant, maxWidth, className, contentClassName, }: Readonly<AuthLayoutRootProps>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* Header slot component - renders differently based on layout variant.
|
|
21
|
+
* In desktop variant, renders top-right. In mobile variant, renders above logo.
|
|
22
|
+
*/
|
|
23
|
+
declare function AuthLayoutHeader({ children, className, }: Readonly<AuthLayoutHeaderProps>): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* Logo slot component - alignment configurable via align prop
|
|
26
|
+
*/
|
|
27
|
+
declare function AuthLayoutLogo({ children, align, className, }: Readonly<AuthLayoutLogoProps>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
/**
|
|
29
|
+
* Title slot component - alignment configurable via align prop
|
|
30
|
+
*/
|
|
31
|
+
declare function AuthLayoutTitle({ children, align, className, }: Readonly<AuthLayoutTitleProps>): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* Description slot component - alignment configurable via align prop
|
|
34
|
+
*/
|
|
35
|
+
declare function AuthLayoutDescription({ children, align, className, }: Readonly<AuthLayoutDescriptionProps>): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
/**
|
|
37
|
+
* Body slot component - main content area with vertical spacing
|
|
38
|
+
*/
|
|
39
|
+
declare function AuthLayoutBody({ children, className, }: Readonly<AuthLayoutBodyProps>): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* Main content wrapper - centers and constrains width of inner slots
|
|
42
|
+
*/
|
|
43
|
+
declare function AuthLayoutMain({ children, sm, className, }: Readonly<AuthLayoutMainProps>): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
/**
|
|
45
|
+
* Footer slot component - centered with consistent spacing
|
|
46
|
+
*/
|
|
47
|
+
declare function AuthLayoutFooter({ children, className, }: Readonly<AuthLayoutFooterProps>): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
/**
|
|
49
|
+
* Compound component for authentication layouts.
|
|
50
|
+
* Uses composition pattern for maximum flexibility and scalability.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <AuthLayout.Root variant="desktop" maxWidth="md">
|
|
55
|
+
* <AuthLayout.Header>
|
|
56
|
+
* <EnterpriseHeader />
|
|
57
|
+
* </AuthLayout.Header>
|
|
58
|
+
* <AuthLayout.Main>
|
|
59
|
+
* <AuthLayout.Logo>
|
|
60
|
+
* <img src="/logo.svg" alt="Docthub" />
|
|
61
|
+
* </AuthLayout.Logo>
|
|
62
|
+
* <AuthLayout.Title>
|
|
63
|
+
* <h1>The Healthcare Career App</h1>
|
|
64
|
+
* </AuthLayout.Title>
|
|
65
|
+
* <AuthLayout.Description>
|
|
66
|
+
* <p>Continue to Signup</p>
|
|
67
|
+
* </AuthLayout.Description>
|
|
68
|
+
* <AuthLayout.Body>
|
|
69
|
+
* <button>Continue with Mobile</button>
|
|
70
|
+
* <button>Continue with Email</button>
|
|
71
|
+
* </AuthLayout.Body>
|
|
72
|
+
* </AuthLayout.Main>
|
|
73
|
+
* <AuthLayout.Footer>
|
|
74
|
+
* <p>Terms and Privacy</p>
|
|
75
|
+
* </AuthLayout.Footer>
|
|
76
|
+
* </AuthLayout.Root>
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare const AuthLayout: {
|
|
80
|
+
Root: typeof AuthLayoutRoot;
|
|
81
|
+
Header: typeof AuthLayoutHeader;
|
|
82
|
+
Main: typeof AuthLayoutMain;
|
|
83
|
+
Logo: typeof AuthLayoutLogo;
|
|
84
|
+
Title: typeof AuthLayoutTitle;
|
|
85
|
+
Description: typeof AuthLayoutDescription;
|
|
86
|
+
Body: typeof AuthLayoutBody;
|
|
87
|
+
Footer: typeof AuthLayoutFooter;
|
|
88
|
+
};
|
|
89
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for the ImageSlider component.
|
|
3
|
+
*/
|
|
4
|
+
export interface ImageSliderProps {
|
|
5
|
+
/** Array of image URLs to display */
|
|
6
|
+
images: string[];
|
|
7
|
+
/** Auto-play interval in milliseconds (0 to disable) */
|
|
8
|
+
autoPlayInterval?: number;
|
|
9
|
+
/** Additional className for the root container */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Whether to hide the built-in slider indicators */
|
|
12
|
+
hideIndicators?: boolean;
|
|
13
|
+
/** Optional callback fired whenever the active slide changes */
|
|
14
|
+
onSlideChange?: (index: number) => void;
|
|
15
|
+
/** Controlled active index (makes component controlled) */
|
|
16
|
+
activeIndex?: number;
|
|
17
|
+
/** Callback for manual slide navigation in controlled mode */
|
|
18
|
+
onNavigate?: (index: number) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Image slider component with indicator dots.
|
|
22
|
+
* Supports both controlled and uncontrolled modes.
|
|
23
|
+
*
|
|
24
|
+
* @example Uncontrolled mode (manages its own state)
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <ImageSlider
|
|
27
|
+
* images={['/image1.jpg', '/image2.jpg']}
|
|
28
|
+
* autoPlayInterval={3000}
|
|
29
|
+
* onSlideChange={(index) => console.log('Slide changed to', index)}
|
|
30
|
+
* />
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example Controlled mode (parent manages state)
|
|
34
|
+
* ```tsx
|
|
35
|
+
* const [activeIndex, setActiveIndex] = useState(0);
|
|
36
|
+
*
|
|
37
|
+
* <ImageSlider
|
|
38
|
+
* images={['/image1.jpg', '/image2.jpg']}
|
|
39
|
+
* activeIndex={activeIndex}
|
|
40
|
+
* onSlideChange={setActiveIndex}
|
|
41
|
+
* onNavigate={setActiveIndex}
|
|
42
|
+
* />
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function ImageSlider({ images, autoPlayInterval, className, hideIndicators, onSlideChange, activeIndex: controlledIndex, onNavigate, }: Readonly<ImageSliderProps>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { AuthLayoutAlign, AuthLayoutBodyProps, AuthLayoutDescriptionProps, AuthLayoutFooterProps, AuthLayoutHeaderProps, AuthLayoutLogoProps, AuthLayoutMainProps, AuthLayoutMaxWidth, AuthLayoutRootProps, AuthLayoutTitleProps, AuthLayoutVariant, } from '../../types/auth-layout-types';
|
|
2
|
+
export { AuthLayout } from './auth-layout';
|
|
3
|
+
export type { ImageSliderProps } from './image-slider';
|
|
4
|
+
export { ImageSlider } from './image-slider';
|
|
5
|
+
export type { MainLayoutProps, MarketingPanelProps } from './main-layout';
|
|
6
|
+
export { MainLayout, MarketingPanel } from './main-layout';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the MainLayout component.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This layout provides a two-panel authentication page structure:
|
|
7
|
+
* - Left panel: Marketing content with image slider, CTA, and image card
|
|
8
|
+
* - Right panel: Authentication content (provided as children)
|
|
9
|
+
*/
|
|
10
|
+
export interface MainLayoutProps {
|
|
11
|
+
/** Array of image URLs for the slider */
|
|
12
|
+
sliderImages?: string[];
|
|
13
|
+
/** Auto-play interval for slider in milliseconds (0 to disable) */
|
|
14
|
+
sliderAutoPlayInterval?: number;
|
|
15
|
+
/** Call-to-action text displayed above the image card. Set to null to hide */
|
|
16
|
+
ctaText?: ReactNode | null;
|
|
17
|
+
/** Per-slide title/CTA (overrides ctaText when provided; uses active slide index) */
|
|
18
|
+
sliderTitles?: (ReactNode | string)[] | undefined;
|
|
19
|
+
/** Additional className for the root container */
|
|
20
|
+
className?: string;
|
|
21
|
+
/** Additional className for the marketing panel (left side) */
|
|
22
|
+
marketingClassName?: string;
|
|
23
|
+
/** Additional className for the content panel (right side) */
|
|
24
|
+
contentClassName?: string;
|
|
25
|
+
/** Main authentication content (typically AuthLayout.Root with slots) */
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Props for the MarketingPanel component (left side)
|
|
30
|
+
*/
|
|
31
|
+
export interface MarketingPanelProps {
|
|
32
|
+
/** Array of image URLs for the slider */
|
|
33
|
+
sliderImages: string[];
|
|
34
|
+
/** Auto-play interval for slider in milliseconds */
|
|
35
|
+
sliderAutoPlayInterval: number;
|
|
36
|
+
/** Active slide index (controlled) */
|
|
37
|
+
activeSlideIndex: number;
|
|
38
|
+
/** Callback when slide changes */
|
|
39
|
+
onSlideChange: (index: number) => void;
|
|
40
|
+
/** Call-to-action text */
|
|
41
|
+
ctaText?: ReactNode | null;
|
|
42
|
+
/** Per-slide title/CTA (overrides ctaText when provided) */
|
|
43
|
+
sliderTitles?: (ReactNode | string)[] | undefined;
|
|
44
|
+
/** Additional className */
|
|
45
|
+
className?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Marketing panel component - displays CTA, image slider, and indicators
|
|
49
|
+
*/
|
|
50
|
+
declare function MarketingPanel({ sliderImages, sliderAutoPlayInterval, activeSlideIndex, onSlideChange, ctaText, sliderTitles, className, }: Readonly<MarketingPanelProps>): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
/**
|
|
52
|
+
* Main layout component - two-panel layout for authentication pages.
|
|
53
|
+
* Left panel displays marketing content, right panel displays auth content.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* <MainLayout
|
|
58
|
+
* sliderImages={['/image1.jpg', '/image2.jpg']}
|
|
59
|
+
* ctaText="Get Healthcare Career App Now!"
|
|
60
|
+
* >
|
|
61
|
+
* <AuthLayout.Root variant="desktop" maxWidth="md">
|
|
62
|
+
* <AuthLayout.Header>...</AuthLayout.Header>
|
|
63
|
+
* <AuthLayout.Main>
|
|
64
|
+
* <AuthLayout.Logo>...</AuthLayout.Logo>
|
|
65
|
+
* <AuthLayout.Title>...</AuthLayout.Title>
|
|
66
|
+
* <AuthLayout.Body>...</AuthLayout.Body>
|
|
67
|
+
* </AuthLayout.Main>
|
|
68
|
+
* <AuthLayout.Footer>...</AuthLayout.Footer>
|
|
69
|
+
* </AuthLayout.Root>
|
|
70
|
+
* </MainLayout>
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function MainLayout({ sliderImages, sliderAutoPlayInterval, ctaText, sliderTitles, className, marketingClassName, contentClassName, children, }: Readonly<MainLayoutProps>): import("react/jsx-runtime").JSX.Element;
|
|
74
|
+
export { MarketingPanel };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Demo data for MainLayout marketing slider.
|
|
3
|
+
* Used in Storybook and anywhere a consistent demo slider is needed.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Marketing slider images exported from Figma.
|
|
7
|
+
* These are static PNG images saved in /public/slider/.
|
|
8
|
+
*
|
|
9
|
+
* To update: Export frames from Figma (nodes 2179:2215, 2179:2226, 2179:2236, 2179:2246, 2179:2256)
|
|
10
|
+
* and save as slide-1.png through slide-5.png in the public/slider/ directory.
|
|
11
|
+
*/
|
|
12
|
+
export declare const DEMO_SLIDER_IMAGES: string[];
|
|
13
|
+
/** Default auto-play interval (ms) for the demo slider. */
|
|
14
|
+
export declare const DEMO_SLIDER_AUTO_PLAY_INTERVAL = 5000;
|
|
15
|
+
/** Per-slide CTA titles for the demo slider (Figma: "Get Healthcare Career App Now!"). */
|
|
16
|
+
export declare const DEMO_SLIDER_TITLES: string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DEMO_SLIDER_AUTO_PLAY_INTERVAL, DEMO_SLIDER_IMAGES, DEMO_SLIDER_TITLES, } from './demo-slider';
|