hazo_auth 0.1.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.
Files changed (162) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +48 -0
  3. package/components.json +22 -0
  4. package/hazo_auth_config.example.ini +414 -0
  5. package/hazo_notify_config.example.ini +159 -0
  6. package/instrumentation.ts +32 -0
  7. package/migrations/001_add_token_type_to_refresh_tokens.sql +14 -0
  8. package/migrations/002_add_name_to_hazo_users.sql +7 -0
  9. package/next.config.mjs +55 -0
  10. package/package.json +114 -0
  11. package/postcss.config.mjs +8 -0
  12. package/public/file.svg +1 -0
  13. package/public/globe.svg +1 -0
  14. package/public/next.svg +1 -0
  15. package/public/vercel.svg +1 -0
  16. package/public/window.svg +1 -0
  17. package/scripts/apply_migration.ts +118 -0
  18. package/src/app/api/auth/change_password/route.ts +109 -0
  19. package/src/app/api/auth/forgot_password/route.ts +107 -0
  20. package/src/app/api/auth/library_photos/route.ts +70 -0
  21. package/src/app/api/auth/login/route.ts +155 -0
  22. package/src/app/api/auth/logout/route.ts +62 -0
  23. package/src/app/api/auth/me/route.ts +47 -0
  24. package/src/app/api/auth/profile_picture/[filename]/route.ts +67 -0
  25. package/src/app/api/auth/register/route.ts +106 -0
  26. package/src/app/api/auth/remove_profile_picture/route.ts +86 -0
  27. package/src/app/api/auth/resend_verification/route.ts +107 -0
  28. package/src/app/api/auth/reset_password/route.ts +107 -0
  29. package/src/app/api/auth/update_user/route.ts +126 -0
  30. package/src/app/api/auth/upload_profile_picture/route.ts +268 -0
  31. package/src/app/api/auth/validate_reset_token/route.ts +80 -0
  32. package/src/app/api/auth/verify_email/route.ts +85 -0
  33. package/src/app/api/migrations/apply/route.ts +91 -0
  34. package/src/app/favicon.ico +0 -0
  35. package/src/app/fonts/GeistMonoVF.woff +0 -0
  36. package/src/app/fonts/GeistVF.woff +0 -0
  37. package/src/app/forgot_password/forgot_password_page_client.tsx +60 -0
  38. package/src/app/forgot_password/page.tsx +24 -0
  39. package/src/app/globals.css +89 -0
  40. package/src/app/hazo_connect/api/sqlite/data/route.ts +197 -0
  41. package/src/app/hazo_connect/api/sqlite/schema/route.ts +35 -0
  42. package/src/app/hazo_connect/api/sqlite/tables/route.ts +26 -0
  43. package/src/app/hazo_connect/sqlite_admin/page.tsx +51 -0
  44. package/src/app/hazo_connect/sqlite_admin/sqlite-admin-client.tsx +947 -0
  45. package/src/app/layout.tsx +43 -0
  46. package/src/app/login/login_page_client.tsx +71 -0
  47. package/src/app/login/page.tsx +26 -0
  48. package/src/app/my_settings/my_settings_page_client.tsx +120 -0
  49. package/src/app/my_settings/page.tsx +40 -0
  50. package/src/app/page.tsx +170 -0
  51. package/src/app/register/page.tsx +26 -0
  52. package/src/app/register/register_page_client.tsx +72 -0
  53. package/src/app/reset_password/page.tsx +29 -0
  54. package/src/app/reset_password/reset_password_page_client.tsx +81 -0
  55. package/src/app/verify_email/page.tsx +24 -0
  56. package/src/app/verify_email/verify_email_page_client.tsx +60 -0
  57. package/src/components/layouts/email_verification/config/email_verification_field_config.ts +86 -0
  58. package/src/components/layouts/email_verification/hooks/use_email_verification.ts +291 -0
  59. package/src/components/layouts/email_verification/index.tsx +297 -0
  60. package/src/components/layouts/forgot_password/config/forgot_password_field_config.ts +58 -0
  61. package/src/components/layouts/forgot_password/hooks/use_forgot_password_form.ts +179 -0
  62. package/src/components/layouts/forgot_password/index.tsx +168 -0
  63. package/src/components/layouts/login/config/login_field_config.ts +67 -0
  64. package/src/components/layouts/login/hooks/use_login_form.ts +281 -0
  65. package/src/components/layouts/login/index.tsx +224 -0
  66. package/src/components/layouts/my_settings/components/editable_field.tsx +177 -0
  67. package/src/components/layouts/my_settings/components/password_change_dialog.tsx +301 -0
  68. package/src/components/layouts/my_settings/components/profile_picture_dialog.tsx +385 -0
  69. package/src/components/layouts/my_settings/components/profile_picture_display.tsx +66 -0
  70. package/src/components/layouts/my_settings/components/profile_picture_gravatar_tab.tsx +143 -0
  71. package/src/components/layouts/my_settings/components/profile_picture_library_tab.tsx +282 -0
  72. package/src/components/layouts/my_settings/components/profile_picture_upload_tab.tsx +341 -0
  73. package/src/components/layouts/my_settings/config/my_settings_field_config.ts +61 -0
  74. package/src/components/layouts/my_settings/hooks/use_my_settings.ts +458 -0
  75. package/src/components/layouts/my_settings/index.tsx +351 -0
  76. package/src/components/layouts/register/config/register_field_config.ts +101 -0
  77. package/src/components/layouts/register/hooks/use_register_form.ts +272 -0
  78. package/src/components/layouts/register/index.tsx +208 -0
  79. package/src/components/layouts/reset_password/config/reset_password_field_config.ts +86 -0
  80. package/src/components/layouts/reset_password/hooks/use_reset_password_form.ts +276 -0
  81. package/src/components/layouts/reset_password/index.tsx +294 -0
  82. package/src/components/layouts/shared/components/already_logged_in_guard.tsx +95 -0
  83. package/src/components/layouts/shared/components/field_error_message.tsx +29 -0
  84. package/src/components/layouts/shared/components/form_action_buttons.tsx +64 -0
  85. package/src/components/layouts/shared/components/form_field_wrapper.tsx +44 -0
  86. package/src/components/layouts/shared/components/form_header.tsx +36 -0
  87. package/src/components/layouts/shared/components/logout_button.tsx +76 -0
  88. package/src/components/layouts/shared/components/password_field.tsx +72 -0
  89. package/src/components/layouts/shared/components/sidebar_layout_wrapper.tsx +264 -0
  90. package/src/components/layouts/shared/components/two_column_auth_layout.tsx +44 -0
  91. package/src/components/layouts/shared/components/unauthorized_guard.tsx +78 -0
  92. package/src/components/layouts/shared/components/visual_panel.tsx +41 -0
  93. package/src/components/layouts/shared/config/layout_customization.ts +95 -0
  94. package/src/components/layouts/shared/data/layout_data_client.ts +19 -0
  95. package/src/components/layouts/shared/hooks/use_auth_status.ts +103 -0
  96. package/src/components/layouts/shared/utils/ip_address.ts +37 -0
  97. package/src/components/layouts/shared/utils/validation.ts +66 -0
  98. package/src/components/ui/avatar.tsx +50 -0
  99. package/src/components/ui/button.tsx +57 -0
  100. package/src/components/ui/dialog.tsx +122 -0
  101. package/src/components/ui/hazo_ui_tooltip.tsx +67 -0
  102. package/src/components/ui/input.tsx +22 -0
  103. package/src/components/ui/label.tsx +26 -0
  104. package/src/components/ui/separator.tsx +31 -0
  105. package/src/components/ui/sheet.tsx +139 -0
  106. package/src/components/ui/sidebar.tsx +773 -0
  107. package/src/components/ui/skeleton.tsx +15 -0
  108. package/src/components/ui/sonner.tsx +31 -0
  109. package/src/components/ui/switch.tsx +29 -0
  110. package/src/components/ui/tabs.tsx +55 -0
  111. package/src/components/ui/tooltip.tsx +32 -0
  112. package/src/components/ui/vertical-tabs.tsx +59 -0
  113. package/src/hooks/use-mobile.tsx +19 -0
  114. package/src/lib/already_logged_in_config.server.ts +46 -0
  115. package/src/lib/app_logger.ts +24 -0
  116. package/src/lib/auth/auth_utils.server.ts +196 -0
  117. package/src/lib/auth/server_auth.ts +88 -0
  118. package/src/lib/config/config_loader.server.ts +149 -0
  119. package/src/lib/email_verification_config.server.ts +32 -0
  120. package/src/lib/file_types_config.server.ts +25 -0
  121. package/src/lib/forgot_password_config.server.ts +32 -0
  122. package/src/lib/hazo_connect_instance.server.ts +77 -0
  123. package/src/lib/hazo_connect_setup.server.ts +181 -0
  124. package/src/lib/hazo_connect_setup.ts +54 -0
  125. package/src/lib/login_config.server.ts +46 -0
  126. package/src/lib/messages_config.server.ts +45 -0
  127. package/src/lib/migrations/apply_migration.ts +105 -0
  128. package/src/lib/my_settings_config.server.ts +135 -0
  129. package/src/lib/password_requirements_config.server.ts +39 -0
  130. package/src/lib/profile_picture_config.server.ts +56 -0
  131. package/src/lib/register_config.server.ts +57 -0
  132. package/src/lib/reset_password_config.server.ts +75 -0
  133. package/src/lib/services/email_service.ts +581 -0
  134. package/src/lib/services/email_verification_service.ts +264 -0
  135. package/src/lib/services/login_service.ts +118 -0
  136. package/src/lib/services/password_change_service.ts +154 -0
  137. package/src/lib/services/password_reset_service.ts +405 -0
  138. package/src/lib/services/profile_picture_remove_service.ts +120 -0
  139. package/src/lib/services/profile_picture_service.ts +215 -0
  140. package/src/lib/services/profile_picture_source_mapper.ts +62 -0
  141. package/src/lib/services/registration_service.ts +163 -0
  142. package/src/lib/services/token_service.ts +240 -0
  143. package/src/lib/services/user_update_service.ts +128 -0
  144. package/src/lib/ui_sizes_config.server.ts +37 -0
  145. package/src/lib/user_fields_config.server.ts +31 -0
  146. package/src/lib/utils/api_route_helpers.ts +60 -0
  147. package/src/lib/utils.ts +11 -0
  148. package/src/middleware.ts +91 -0
  149. package/src/server/config/config_loader.ts +496 -0
  150. package/src/server/index.ts +38 -0
  151. package/src/server/logging/logger_service.ts +56 -0
  152. package/src/server/routes/root_router.ts +16 -0
  153. package/src/server/server.ts +28 -0
  154. package/src/server/types/app_types.ts +74 -0
  155. package/src/server/types/express.d.ts +15 -0
  156. package/src/stories/email_verification_layout.stories.tsx +137 -0
  157. package/src/stories/forgot_password_layout.stories.tsx +85 -0
  158. package/src/stories/login_layout.stories.tsx +85 -0
  159. package/src/stories/project_overview.stories.tsx +33 -0
  160. package/src/stories/register_layout.stories.tsx +107 -0
  161. package/tailwind.config.ts +77 -0
  162. package/tsconfig.json +27 -0
@@ -0,0 +1,15 @@
1
+ // file_description: augment express request with hazo_auth context
2
+ import type { app_context } from "./app_types";
3
+
4
+ declare global {
5
+ namespace Express {
6
+ interface Request {
7
+ context: app_context;
8
+ }
9
+ }
10
+ }
11
+
12
+ export {};
13
+
14
+
15
+
@@ -0,0 +1,137 @@
1
+ // file_description: showcase the email_verification_layout component within storybook for review and testing
2
+ // section: imports
3
+ import type { Meta, StoryObj } from "@storybook/react";
4
+ import EmailVerificationLayout from "@/components/layouts/email_verification";
5
+ import { createLayoutDataClient } from "@/components/layouts/shared/data/layout_data_client";
6
+
7
+ // section: metadata
8
+ const meta: Meta<typeof EmailVerificationLayout> = {
9
+ title: "layouts/email_verification_layout",
10
+ id: "forms-email-verification-form",
11
+ component: EmailVerificationLayout,
12
+ parameters: {
13
+ layout: "centered",
14
+ },
15
+ };
16
+
17
+ export default meta;
18
+
19
+ // section: helpers
20
+ // Create mock hazo_connect instance for Storybook (browser environment)
21
+ // Note: Real SQLite database cannot be used in browser/Storybook context
22
+ // This mock satisfies the LayoutDataClient interface requirements
23
+ const create_storybook_hazo_connect = () => {
24
+ return {
25
+ healthCheck: async () => {
26
+ // Mock health check for Storybook - no-op in browser context
27
+ return Promise.resolve();
28
+ },
29
+ };
30
+ };
31
+
32
+ // section: stories
33
+ type story = StoryObj<typeof EmailVerificationLayout>;
34
+
35
+ // section: verifying_state_story
36
+ export const verifying_state: story = {
37
+ name: "verifying_state",
38
+ args: {
39
+ image_src: "/globe.svg",
40
+ image_alt:
41
+ "Decorative globe illustrating the global reach of the hazo authentication platform",
42
+ image_background_color: "#e2e8f0",
43
+ data_client: createLayoutDataClient(create_storybook_hazo_connect()),
44
+ },
45
+ parameters: {
46
+ docs: {
47
+ description: {
48
+ story:
49
+ "Loading state shown while verifying the email verification token. Note: In Storybook, this will attempt to verify a token from the URL query string.",
50
+ },
51
+ },
52
+ },
53
+ };
54
+
55
+ // section: success_state_story
56
+ export const success_state: story = {
57
+ name: "success_state",
58
+ args: {
59
+ image_src: "/globe.svg",
60
+ image_alt:
61
+ "Decorative globe illustrating the global reach of the hazo authentication platform",
62
+ image_background_color: "#e2e8f0",
63
+ data_client: createLayoutDataClient(create_storybook_hazo_connect()),
64
+ },
65
+ parameters: {
66
+ docs: {
67
+ description: {
68
+ story:
69
+ "Success state shown after email verification is complete, with redirect countdown.",
70
+ },
71
+ },
72
+ },
73
+ };
74
+
75
+ // section: error_state_story
76
+ export const error_state: story = {
77
+ name: "error_state",
78
+ args: {
79
+ image_src: "/globe.svg",
80
+ image_alt:
81
+ "Decorative globe illustrating the global reach of the hazo authentication platform",
82
+ image_background_color: "#e2e8f0",
83
+ data_client: createLayoutDataClient(create_storybook_hazo_connect()),
84
+ },
85
+ parameters: {
86
+ docs: {
87
+ description: {
88
+ story:
89
+ "Error state shown when verification fails, with form to resend verification email.",
90
+ },
91
+ },
92
+ },
93
+ };
94
+
95
+ // section: custom_configuration_story
96
+ export const custom_configuration: story = {
97
+ name: "custom_configuration",
98
+ args: {
99
+ image_src: "/globe.svg",
100
+ image_alt:
101
+ "Decorative globe illustrating the global reach of the hazo authentication platform",
102
+ image_background_color: "#dbeafe",
103
+ data_client: createLayoutDataClient(create_storybook_hazo_connect()),
104
+ labels: {
105
+ heading: "Verify your email",
106
+ subHeading: "Please wait while we verify your email address.",
107
+ submitButton: "Resend email",
108
+ cancelButton: "Back to login",
109
+ },
110
+ success_labels: {
111
+ heading: "Email confirmed!",
112
+ message: "Your email address has been successfully verified.",
113
+ redirectMessage: "You will be redirected in",
114
+ goToLoginButton: "Continue to login",
115
+ },
116
+ error_labels: {
117
+ heading: "Verification link expired",
118
+ message: "The verification link is no longer valid.",
119
+ resendFormHeading: "Get a new verification link",
120
+ },
121
+ button_colors: {
122
+ submitBackground: "#5b21b6",
123
+ submitText: "#ffffff",
124
+ cancelBorder: "#7c3aed",
125
+ cancelText: "#5b21b6",
126
+ },
127
+ },
128
+ parameters: {
129
+ docs: {
130
+ description: {
131
+ story:
132
+ "Demonstrates how teams can customise labels, button styling, and background images for alternative email verification flows.",
133
+ },
134
+ },
135
+ },
136
+ };
137
+
@@ -0,0 +1,85 @@
1
+ // file_description: showcase the forgot_password_layout component within storybook for review and testing
2
+ // section: imports
3
+ import type { Meta, StoryObj } from "@storybook/react";
4
+ import ForgotPasswordLayout from "@/components/layouts/forgot_password";
5
+ import { createLayoutDataClient } from "@/components/layouts/shared/data/layout_data_client";
6
+
7
+ // section: metadata
8
+ const meta: Meta<typeof ForgotPasswordLayout> = {
9
+ title: "layouts/forgot_password_layout",
10
+ id: "forms-forgot-password-form",
11
+ component: ForgotPasswordLayout,
12
+ parameters: {
13
+ layout: "centered",
14
+ },
15
+ };
16
+
17
+ export default meta;
18
+
19
+ // section: helpers
20
+ // Create mock hazo_connect instance for Storybook (browser environment)
21
+ // Note: Real SQLite database cannot be used in browser/Storybook context
22
+ // This mock satisfies the LayoutDataClient interface requirements
23
+ const create_storybook_hazo_connect = () => {
24
+ return {
25
+ healthCheck: async () => {
26
+ // Mock health check for Storybook - no-op in browser context
27
+ return Promise.resolve();
28
+ },
29
+ };
30
+ };
31
+
32
+ // section: stories
33
+ type story = StoryObj<typeof ForgotPasswordLayout>;
34
+
35
+ // section: default_story
36
+ export const default_state: story = {
37
+ name: "default_state",
38
+ args: {
39
+ image_src: "/globe.svg",
40
+ image_alt:
41
+ "Decorative globe illustrating the global reach of the hazo authentication platform",
42
+ image_background_color: "#e2e8f0",
43
+ data_client: createLayoutDataClient(create_storybook_hazo_connect()),
44
+ },
45
+ parameters: {
46
+ docs: {
47
+ description: {
48
+ story:
49
+ "Default presentation of the forgot password layout with email field.",
50
+ },
51
+ },
52
+ },
53
+ };
54
+
55
+ export const custom_configuration: story = {
56
+ name: "custom_configuration",
57
+ args: {
58
+ image_src: "/globe.svg",
59
+ image_alt:
60
+ "Decorative globe illustrating the global reach of the hazo authentication platform",
61
+ image_background_color: "#dbeafe",
62
+ data_client: createLayoutDataClient(create_storybook_hazo_connect()),
63
+ labels: {
64
+ heading: "Reset your password",
65
+ subHeading: "We'll send you a secure link to reset your password.",
66
+ submitButton: "Send reset email",
67
+ cancelButton: "Back to login",
68
+ },
69
+ button_colors: {
70
+ submitBackground: "#5b21b6",
71
+ submitText: "#ffffff",
72
+ cancelBorder: "#7c3aed",
73
+ cancelText: "#5b21b6",
74
+ },
75
+ },
76
+ parameters: {
77
+ docs: {
78
+ description: {
79
+ story:
80
+ "Demonstrates how teams can customise labels, button styling, and background images for alternative forgot password flows.",
81
+ },
82
+ },
83
+ },
84
+ };
85
+
@@ -0,0 +1,85 @@
1
+ // file_description: showcase the login_layout component within storybook for review and testing
2
+ // section: imports
3
+ import type { Meta, StoryObj } from "@storybook/react";
4
+ import LoginLayout from "@/components/layouts/login";
5
+ import { createLayoutDataClient } from "@/components/layouts/shared/data/layout_data_client";
6
+
7
+ // section: metadata
8
+ const meta: Meta<typeof LoginLayout> = {
9
+ title: "layouts/login_layout",
10
+ id: "forms-login-form",
11
+ component: LoginLayout,
12
+ parameters: {
13
+ layout: "centered",
14
+ },
15
+ };
16
+
17
+ export default meta;
18
+
19
+ // section: helpers
20
+ // Create mock hazo_connect instance for Storybook (browser environment)
21
+ // Note: Real SQLite database cannot be used in browser/Storybook context
22
+ // This mock satisfies the LayoutDataClient interface requirements
23
+ const create_storybook_hazo_connect = () => {
24
+ return {
25
+ healthCheck: async () => {
26
+ // Mock health check for Storybook - no-op in browser context
27
+ return Promise.resolve();
28
+ },
29
+ };
30
+ };
31
+
32
+ // section: stories
33
+ type story = StoryObj<typeof LoginLayout>;
34
+
35
+ // section: default_story
36
+ export const default_state: story = {
37
+ name: "default_state",
38
+ args: {
39
+ image_src: "/globe.svg",
40
+ image_alt:
41
+ "Decorative globe illustrating the global reach of the hazo authentication platform",
42
+ image_background_color: "#e2e8f0",
43
+ data_client: createLayoutDataClient(create_storybook_hazo_connect()),
44
+ },
45
+ parameters: {
46
+ docs: {
47
+ description: {
48
+ story:
49
+ "Default presentation of the login layout with email and password fields.",
50
+ },
51
+ },
52
+ },
53
+ };
54
+
55
+ export const custom_configuration: story = {
56
+ name: "custom_configuration",
57
+ args: {
58
+ image_src: "/globe.svg",
59
+ image_alt:
60
+ "Decorative globe illustrating the global reach of the hazo authentication platform",
61
+ image_background_color: "#dbeafe",
62
+ data_client: createLayoutDataClient(create_storybook_hazo_connect()),
63
+ labels: {
64
+ heading: "Welcome back to hazo",
65
+ subHeading: "Sign in to continue to your secure workspace.",
66
+ submitButton: "Sign in",
67
+ cancelButton: "Cancel",
68
+ },
69
+ button_colors: {
70
+ submitBackground: "#5b21b6",
71
+ submitText: "#ffffff",
72
+ cancelBorder: "#7c3aed",
73
+ cancelText: "#5b21b6",
74
+ },
75
+ },
76
+ parameters: {
77
+ docs: {
78
+ description: {
79
+ story:
80
+ "Demonstrates how teams can customise labels, button styling, and background images for alternative login flows.",
81
+ },
82
+ },
83
+ },
84
+ };
85
+
@@ -0,0 +1,33 @@
1
+ // file_description: provide a high level story describing the purpose of the ui_component workspace
2
+ import type { Meta, StoryObj } from "@storybook/nextjs";
3
+
4
+ // section: story_configuration
5
+ const story_meta: Meta = {
6
+ title: "foundations/project_overview",
7
+ parameters: {
8
+ layout: "centered",
9
+ },
10
+ };
11
+
12
+ export default story_meta;
13
+
14
+ type Story = StoryObj;
15
+
16
+ // section: story_definitions
17
+ export const DefaultView: Story = {
18
+ name: "workspace overview",
19
+ render: () => (
20
+ <div className="cls_story_overview flex max-w-xl flex-col items-center justify-center gap-4 rounded-lg border border-slate-200 bg-white p-8 text-center shadow-sm">
21
+ <h2 className="cls_story_heading text-2xl font-semibold text-slate-900">
22
+ build reusable components with confidence
23
+ </h2>
24
+ <p className="cls_story_body text-base leading-relaxed text-slate-600">
25
+ This Storybook workspace pairs shadcn primitives with hazo_config and
26
+ hazo_connect so the design system can stay aligned with platform
27
+ standards. Add new stories to document upcoming components as
28
+ requirements arrive.
29
+ </p>
30
+ </div>
31
+ ),
32
+ };
33
+
@@ -0,0 +1,107 @@
1
+ // file_description: showcase the register_layout component within storybook for review and testing
2
+ // section: imports
3
+ import type { Meta, StoryObj } from "@storybook/react";
4
+ import RegisterLayout from "@/components/layouts/register";
5
+ import { createLayoutDataClient } from "@/components/layouts/shared/data/layout_data_client";
6
+
7
+ // section: metadata
8
+ const meta: Meta<typeof RegisterLayout> = {
9
+ title: "layouts/register_layout",
10
+ id: "forms-register-form",
11
+ component: RegisterLayout,
12
+ parameters: {
13
+ layout: "centered",
14
+ },
15
+ };
16
+
17
+ export default meta;
18
+
19
+ // section: helpers
20
+ // Create mock hazo_connect instance for Storybook (browser environment)
21
+ // Note: Real SQLite database cannot be used in browser/Storybook context
22
+ // This mock satisfies the LayoutDataClient interface requirements
23
+ const create_storybook_hazo_connect = () => {
24
+ return {
25
+ healthCheck: async () => {
26
+ // Mock health check for Storybook - no-op in browser context
27
+ return Promise.resolve();
28
+ },
29
+ };
30
+ };
31
+
32
+ // section: stories
33
+ type story = StoryObj<typeof RegisterLayout>;
34
+
35
+ // section: default_story
36
+ export const default_state: story = {
37
+ name: "default_state",
38
+ args: {
39
+ image_src: "/globe.svg",
40
+ image_alt:
41
+ "Decorative globe illustrating the global reach of the hazo authentication platform",
42
+ image_background_color: "#e2e8f0",
43
+ data_client: createLayoutDataClient(create_storybook_hazo_connect()),
44
+ },
45
+ parameters: {
46
+ docs: {
47
+ description: {
48
+ story:
49
+ "Default presentation of the register layout with all fields locked until edited with the pencil toggles.",
50
+ },
51
+ },
52
+ },
53
+ };
54
+
55
+ export const custom_configuration: story = {
56
+ name: "custom_configuration",
57
+ args: {
58
+ image_src: "/globe.svg",
59
+ image_alt:
60
+ "Decorative globe illustrating the global reach of the hazo authentication platform",
61
+ image_background_color: "#dbeafe",
62
+ show_name_field: false,
63
+ data_client: createLayoutDataClient(create_storybook_hazo_connect()),
64
+ labels: {
65
+ heading: "Join the hazo beta now",
66
+ subHeading: "Configure your secure workspace credentials in minutes.",
67
+ submitButton: "Create account",
68
+ cancelButton: "Cancel setup",
69
+ },
70
+ field_overrides: {
71
+ email_address: {
72
+ label: "Work email",
73
+ placeholder: "Enter your work email",
74
+ },
75
+ password: {
76
+ label: "Create password",
77
+ placeholder: "Choose a strong password now",
78
+ },
79
+ confirm_password: {
80
+ label: "Confirm password",
81
+ placeholder: "Re-enter the password",
82
+ },
83
+ },
84
+ password_requirements: {
85
+ minimum_length: 12,
86
+ require_uppercase: true,
87
+ require_lowercase: true,
88
+ require_number: true,
89
+ require_special: true,
90
+ },
91
+ button_colors: {
92
+ submitBackground: "#5b21b6",
93
+ submitText: "#ffffff",
94
+ cancelBorder: "#7c3aed",
95
+ cancelText: "#5b21b6",
96
+ },
97
+ },
98
+ parameters: {
99
+ docs: {
100
+ description: {
101
+ story:
102
+ "Demonstrates how teams can toggle the full name field, customise button styling, and adjust password policy messaging for alternative onboarding flows.",
103
+ },
104
+ },
105
+ },
106
+ };
107
+
@@ -0,0 +1,77 @@
1
+ // file_description: configure tailwindcss for the ui_component project
2
+ import type { Config } from "tailwindcss";
3
+
4
+ // section: tailwind_configuration
5
+ const tailwind_config: Config = {
6
+ darkMode: ["class"],
7
+ content: [
8
+ "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
9
+ "./src/components/**/*.{js,ts,jsx,tsx,mdx}",
10
+ "./src/app/**/*.{js,ts,jsx,tsx,mdx}",
11
+ "./src/stories/**/*.{js,ts,jsx,tsx,mdx}",
12
+ ],
13
+ theme: {
14
+ extend: {
15
+ colors: {
16
+ background: 'hsl(var(--background))',
17
+ foreground: 'hsl(var(--foreground))',
18
+ card: {
19
+ DEFAULT: 'hsl(var(--card))',
20
+ foreground: 'hsl(var(--card-foreground))'
21
+ },
22
+ popover: {
23
+ DEFAULT: 'hsl(var(--popover))',
24
+ foreground: 'hsl(var(--popover-foreground))'
25
+ },
26
+ primary: {
27
+ DEFAULT: 'hsl(var(--primary))',
28
+ foreground: 'hsl(var(--primary-foreground))'
29
+ },
30
+ secondary: {
31
+ DEFAULT: 'hsl(var(--secondary))',
32
+ foreground: 'hsl(var(--secondary-foreground))'
33
+ },
34
+ muted: {
35
+ DEFAULT: 'hsl(var(--muted))',
36
+ foreground: 'hsl(var(--muted-foreground))'
37
+ },
38
+ accent: {
39
+ DEFAULT: 'hsl(var(--accent))',
40
+ foreground: 'hsl(var(--accent-foreground))'
41
+ },
42
+ destructive: {
43
+ DEFAULT: 'hsl(var(--destructive))',
44
+ foreground: 'hsl(var(--destructive-foreground))'
45
+ },
46
+ border: 'hsl(var(--border))',
47
+ input: 'hsl(var(--input))',
48
+ ring: 'hsl(var(--ring))',
49
+ chart: {
50
+ '1': 'hsl(var(--chart-1))',
51
+ '2': 'hsl(var(--chart-2))',
52
+ '3': 'hsl(var(--chart-3))',
53
+ '4': 'hsl(var(--chart-4))',
54
+ '5': 'hsl(var(--chart-5))'
55
+ },
56
+ sidebar: {
57
+ DEFAULT: 'hsl(var(--sidebar-background))',
58
+ foreground: 'hsl(var(--sidebar-foreground))',
59
+ primary: 'hsl(var(--sidebar-primary))',
60
+ 'primary-foreground': 'hsl(var(--sidebar-primary-foreground))',
61
+ accent: 'hsl(var(--sidebar-accent))',
62
+ 'accent-foreground': 'hsl(var(--sidebar-accent-foreground))',
63
+ border: 'hsl(var(--sidebar-border))',
64
+ ring: 'hsl(var(--sidebar-ring))'
65
+ }
66
+ },
67
+ borderRadius: {
68
+ lg: 'var(--radius)',
69
+ md: 'calc(var(--radius) - 2px)',
70
+ sm: 'calc(var(--radius) - 4px)'
71
+ }
72
+ }
73
+ },
74
+ plugins: [require("tailwindcss-animate")],
75
+ };
76
+
77
+ export default tailwind_config;
package/tsconfig.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2017",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "noEmit": true,
9
+ "esModuleInterop": true,
10
+ "module": "esnext",
11
+ "moduleResolution": "bundler",
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "jsx": "preserve",
15
+ "incremental": true,
16
+ "plugins": [
17
+ {
18
+ "name": "next"
19
+ }
20
+ ],
21
+ "paths": {
22
+ "@/*": ["./src/*"]
23
+ }
24
+ },
25
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
26
+ "exclude": ["node_modules"]
27
+ }