@stacksjs/components 0.2.92 → 0.2.94

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 (188) hide show
  1. package/dist/{Sidebar-yb115a2w.stx → Sidebar-4hn7vw4n.stx} +18 -0
  2. package/dist/index.js +5 -5
  3. package/package.json +5 -6
  4. package/src/components/CodeBlock.stx +0 -54
  5. package/src/components/Footer.stx +0 -66
  6. package/src/components/Hero.stx +0 -25
  7. package/src/components/Installation.stx +0 -37
  8. package/src/components/index.ts +0 -4
  9. package/src/composables/index.ts +0 -4
  10. package/src/composables/useCopyCode.ts +0 -73
  11. package/src/composables/useDarkMode.ts +0 -100
  12. package/src/composables/useSEO.ts +0 -230
  13. package/src/composables/utilities/index.ts +0 -7
  14. package/src/composables/utilities/useClickOutside.ts +0 -72
  15. package/src/composables/utilities/useFocusTrap.ts +0 -159
  16. package/src/composables/utilities/useKeyboard.ts +0 -124
  17. package/src/composables/utilities/useLocalStorage.ts +0 -132
  18. package/src/composables/utilities/useMediaQuery.ts +0 -118
  19. package/src/index.ts +0 -99
  20. package/src/stx.d.ts +0 -4
  21. package/src/ui/accordion/Accordion.stx +0 -146
  22. package/src/ui/accordion/AccordionItem.stx +0 -37
  23. package/src/ui/accordion/index.ts +0 -47
  24. package/src/ui/audio/Audio.stx +0 -50
  25. package/src/ui/audio/README.md +0 -41
  26. package/src/ui/audio/index.ts +0 -13
  27. package/src/ui/auth/Login.stx +0 -161
  28. package/src/ui/auth/README.md +0 -142
  29. package/src/ui/auth/Signup.stx +0 -159
  30. package/src/ui/auth/TwoFactorChallenge.stx +0 -111
  31. package/src/ui/auth/index.ts +0 -32
  32. package/src/ui/avatar/Avatar.stx +0 -77
  33. package/src/ui/avatar/index.ts +0 -12
  34. package/src/ui/badge/Badge.stx +0 -62
  35. package/src/ui/badge/index.ts +0 -10
  36. package/src/ui/breadcrumb/Breadcrumb.stx +0 -79
  37. package/src/ui/breadcrumb/index.ts +0 -15
  38. package/src/ui/button/Button.stx +0 -74
  39. package/src/ui/button/README.md +0 -80
  40. package/src/ui/button/index.ts +0 -85
  41. package/src/ui/calendar/Calendar.stx +0 -189
  42. package/src/ui/calendar/README.md +0 -254
  43. package/src/ui/calendar/index.ts +0 -14
  44. package/src/ui/card/Card.stx +0 -68
  45. package/src/ui/card/index.ts +0 -13
  46. package/src/ui/checkbox/Checkbox.stx +0 -86
  47. package/src/ui/checkbox/index.ts +0 -16
  48. package/src/ui/combobox/Combobox.stx +0 -96
  49. package/src/ui/combobox/ComboboxButton.stx +0 -25
  50. package/src/ui/combobox/ComboboxInput.stx +0 -32
  51. package/src/ui/combobox/ComboboxOption.stx +0 -49
  52. package/src/ui/combobox/ComboboxOptions.stx +0 -16
  53. package/src/ui/combobox/README.md +0 -150
  54. package/src/ui/combobox/index.ts +0 -40
  55. package/src/ui/command-palette/CommandPalette.stx +0 -81
  56. package/src/ui/command-palette/CommandPaletteItem.stx +0 -27
  57. package/src/ui/command-palette/README.md +0 -42
  58. package/src/ui/command-palette/index.ts +0 -15
  59. package/src/ui/dialog/Dialog.stx +0 -41
  60. package/src/ui/dialog/DialogBackdrop.stx +0 -9
  61. package/src/ui/dialog/DialogDescription.stx +0 -11
  62. package/src/ui/dialog/DialogPanel.stx +0 -16
  63. package/src/ui/dialog/DialogTitle.stx +0 -11
  64. package/src/ui/dialog/README.md +0 -121
  65. package/src/ui/dialog/index.ts +0 -32
  66. package/src/ui/drawer/Drawer.stx +0 -120
  67. package/src/ui/drawer/README.md +0 -90
  68. package/src/ui/drawer/index.ts +0 -9
  69. package/src/ui/dropdown/Dropdown.stx +0 -82
  70. package/src/ui/dropdown/DropdownButton.stx +0 -29
  71. package/src/ui/dropdown/DropdownItem.stx +0 -35
  72. package/src/ui/dropdown/DropdownItems.stx +0 -18
  73. package/src/ui/dropdown/README.md +0 -114
  74. package/src/ui/dropdown/index.ts +0 -29
  75. package/src/ui/form/Form.stx +0 -95
  76. package/src/ui/form/index.ts +0 -67
  77. package/src/ui/heatmap/Heatmap.stx +0 -294
  78. package/src/ui/image/Image.stx +0 -165
  79. package/src/ui/image/README.md +0 -164
  80. package/src/ui/image/index.ts +0 -22
  81. package/src/ui/input/EmailInput.stx +0 -30
  82. package/src/ui/input/NumberInput.stx +0 -126
  83. package/src/ui/input/PasswordInput.stx +0 -143
  84. package/src/ui/input/SearchInput.stx +0 -44
  85. package/src/ui/input/TextInput.stx +0 -132
  86. package/src/ui/input/index.ts +0 -180
  87. package/src/ui/listbox/Listbox.stx +0 -101
  88. package/src/ui/listbox/ListboxButton.stx +0 -28
  89. package/src/ui/listbox/ListboxLabel.stx +0 -11
  90. package/src/ui/listbox/ListboxOption.stx +0 -49
  91. package/src/ui/listbox/ListboxOptions.stx +0 -16
  92. package/src/ui/listbox/README.md +0 -135
  93. package/src/ui/listbox/index.ts +0 -39
  94. package/src/ui/navigator/Navigator.stx +0 -113
  95. package/src/ui/navigator/README.md +0 -352
  96. package/src/ui/navigator/index.ts +0 -20
  97. package/src/ui/notification/Notification.stx +0 -117
  98. package/src/ui/notification/README.md +0 -114
  99. package/src/ui/notification/index.ts +0 -12
  100. package/src/ui/pagination/Pagination.stx +0 -150
  101. package/src/ui/pagination/index.ts +0 -11
  102. package/src/ui/payment/Checkout.stx +0 -31
  103. package/src/ui/payment/DefaultPaymentMethod.stx +0 -62
  104. package/src/ui/payment/PaymentMethods.stx +0 -104
  105. package/src/ui/payment/README.md +0 -345
  106. package/src/ui/payment/SubscriptionCheckout.stx +0 -323
  107. package/src/ui/payment/index.ts +0 -59
  108. package/src/ui/popover/Popover.stx +0 -60
  109. package/src/ui/popover/PopoverButton.stx +0 -29
  110. package/src/ui/popover/PopoverPanel.stx +0 -23
  111. package/src/ui/popover/README.md +0 -91
  112. package/src/ui/popover/index.ts +0 -22
  113. package/src/ui/portal/Portal.stx +0 -57
  114. package/src/ui/portal/index.ts +0 -6
  115. package/src/ui/progress/Progress.stx +0 -131
  116. package/src/ui/progress/index.ts +0 -12
  117. package/src/ui/radio/Radio.stx +0 -77
  118. package/src/ui/radio/index.ts +0 -15
  119. package/src/ui/radio-group/README.md +0 -139
  120. package/src/ui/radio-group/RadioGroup.stx +0 -60
  121. package/src/ui/radio-group/RadioGroupDescription.stx +0 -11
  122. package/src/ui/radio-group/RadioGroupLabel.stx +0 -11
  123. package/src/ui/radio-group/RadioGroupOption.stx +0 -58
  124. package/src/ui/radio-group/index.ts +0 -30
  125. package/src/ui/select/README.md +0 -180
  126. package/src/ui/select/Select.stx +0 -82
  127. package/src/ui/select/index.ts +0 -21
  128. package/src/ui/sidebar/Sidebar.stx +0 -458
  129. package/src/ui/sidebar/SidebarFooter.stx +0 -71
  130. package/src/ui/sidebar/SidebarHeader.stx +0 -103
  131. package/src/ui/sidebar/SidebarItem.stx +0 -86
  132. package/src/ui/sidebar/SidebarSection.stx +0 -83
  133. package/src/ui/sidebar/index.ts +0 -153
  134. package/src/ui/sidebar/themes.ts +0 -240
  135. package/src/ui/skeleton/Skeleton.stx +0 -48
  136. package/src/ui/skeleton/index.ts +0 -11
  137. package/src/ui/spinner/Spinner.stx +0 -109
  138. package/src/ui/spinner/index.ts +0 -9
  139. package/src/ui/stepper/README.md +0 -36
  140. package/src/ui/stepper/Stepper.stx +0 -17
  141. package/src/ui/stepper/StepperStep.stx +0 -57
  142. package/src/ui/stepper/index.ts +0 -19
  143. package/src/ui/storage/README.md +0 -193
  144. package/src/ui/storage/index.ts +0 -347
  145. package/src/ui/switch/README.md +0 -114
  146. package/src/ui/switch/Switch.stx +0 -72
  147. package/src/ui/switch/index.ts +0 -10
  148. package/src/ui/table/README.md +0 -39
  149. package/src/ui/table/Table.stx +0 -14
  150. package/src/ui/table/TableBody.stx +0 -10
  151. package/src/ui/table/TableCell.stx +0 -10
  152. package/src/ui/table/TableHead.stx +0 -10
  153. package/src/ui/table/TableHeader.stx +0 -20
  154. package/src/ui/table/TableRow.stx +0 -11
  155. package/src/ui/table/index.ts +0 -35
  156. package/src/ui/tabs/TabPanel.stx +0 -25
  157. package/src/ui/tabs/Tabs.stx +0 -202
  158. package/src/ui/tabs/index.ts +0 -50
  159. package/src/ui/teleport/Teleport.stx +0 -65
  160. package/src/ui/teleport/index.ts +0 -7
  161. package/src/ui/textarea/Textarea.stx +0 -108
  162. package/src/ui/textarea/index.ts +0 -20
  163. package/src/ui/tooltip/Tooltip.stx +0 -71
  164. package/src/ui/tooltip/index.ts +0 -10
  165. package/src/ui/transition/README.md +0 -30
  166. package/src/ui/transition/Transition.stx +0 -102
  167. package/src/ui/transition/index.ts +0 -25
  168. package/src/ui/video/README.md +0 -47
  169. package/src/ui/video/Video.stx +0 -45
  170. package/src/ui/video/index.ts +0 -16
  171. package/src/ui/virtual-list/VirtualList.stx +0 -67
  172. package/src/ui/virtual-list/index.ts +0 -10
  173. package/src/ui/virtual-table/VirtualTable.stx +0 -103
  174. package/src/ui/virtual-table/index.ts +0 -21
  175. package/src/utils/PROP_VALIDATION.md +0 -458
  176. package/src/utils/THEME_SYSTEM.md +0 -702
  177. package/src/utils/accessibility.ts +0 -841
  178. package/src/utils/animation/easing.ts +0 -368
  179. package/src/utils/animation/helpers.ts +0 -223
  180. package/src/utils/animation/index.ts +0 -5
  181. package/src/utils/animation/keyframes.ts +0 -230
  182. package/src/utils/error-handling.ts +0 -475
  183. package/src/utils/highlighter.ts +0 -93
  184. package/src/utils/i18n.ts +0 -634
  185. package/src/utils/keep-alive.ts +0 -819
  186. package/src/utils/lazy-loading.ts +0 -530
  187. package/src/utils/prop-validation.ts +0 -478
  188. package/src/utils/theme.ts +0 -626
@@ -1,161 +0,0 @@
1
- <script server>
2
- export const showLogo = $props.showLogo ?? true
3
- export const headingText = $props.headingText || 'Sign in to your account'
4
- export const showSocialLogin = $props.showSocialLogin ?? true
5
- export const showRememberMe = $props.showRememberMe ?? true
6
- export const showForgotPassword = $props.showForgotPassword ?? true
7
- export const showSignup = $props.showSignup ?? true
8
- export const signupText = $props.signupText || 'Start a 14 day free trial'
9
- export const className = $props.className || ''
10
-
11
- export const containerClasses = `min-h-full flex flex-col justify-center py-12 lg:px-8 sm:px-6 dark:bg-blue-gray-900 ${className}`.trim()
12
- </script>
13
-
14
- <script client>
15
- const emit = defineEmits()
16
-
17
- function onSubmit(event) {
18
- event.preventDefault()
19
- const formData = new FormData(event.target)
20
- const email = formData.get('email')
21
- const password = formData.get('password')
22
- emit('submit', { email, password })
23
- setTimeout(() => {
24
- const pw = event.target.querySelector('#password')
25
- if (pw) pw.value = ''
26
- }, 1000)
27
- }
28
- </script>
29
-
30
- <div class="{{ containerClasses }}">
31
- <div class="sm:mx-auto sm:max-w-md sm:w-full">
32
- @if(showLogo)
33
- <img src="/logo.svg" alt="Logo" class="mx-auto h-11 w-auto" />
34
- @endif
35
- <h2 class="mt-6 text-center text-2xl text-gray-900 dark:text-gray-100 font-bold leading-9 tracking-tight">
36
- {{ headingText }}
37
- </h2>
38
- </div>
39
-
40
- <form @submit="onSubmit($event)">
41
- <div class="mt-10 sm:mx-auto sm:max-w-[480px] sm:w-full">
42
- <div class="bg-white dark:bg-blue-gray-800 px-6 py-12 shadow sm:rounded-lg sm:px-12">
43
- <div class="space-y-6">
44
- <div>
45
- <label for="email" class="block text-sm text-gray-900 dark:text-gray-100 font-medium leading-6">
46
- Email address
47
- </label>
48
- <div class="mt-2">
49
- <input
50
- id="email"
51
- name="email"
52
- type="email"
53
- autocomplete="email"
54
- required
55
- class="block w-full border-0 rounded-md py-1.5 text-gray-900 dark:text-gray-100 shadow-sm ring-1 ring-gray-300 dark:ring-gray-600 ring-inset sm:text-sm placeholder:text-gray-400 dark:placeholder:text-gray-500 sm:leading-6 focus:ring-2 focus:ring-indigo-600 focus:ring-inset dark:bg-blue-gray-700"
56
- />
57
- </div>
58
- </div>
59
-
60
- <div>
61
- <label for="password" class="block text-sm text-gray-900 dark:text-gray-100 font-medium leading-6">
62
- Password
63
- </label>
64
- <div class="mt-2">
65
- <input
66
- id="password"
67
- name="password"
68
- type="password"
69
- autocomplete="current-password"
70
- required
71
- class="block w-full border-0 rounded-md py-1.5 text-gray-900 dark:text-gray-100 shadow-sm ring-1 ring-gray-300 dark:ring-gray-600 ring-inset sm:text-sm placeholder:text-gray-400 dark:placeholder:text-gray-500 sm:leading-6 focus:ring-2 focus:ring-indigo-600 focus:ring-inset dark:bg-blue-gray-700"
72
- />
73
- </div>
74
- </div>
75
-
76
- <div class="flex items-center justify-between">
77
- @if(showRememberMe)
78
- <div class="flex items-center">
79
- <input
80
- id="remember-me"
81
- name="remember-me"
82
- type="checkbox"
83
- class="h-4 w-4 border-gray-300 dark:border-gray-600 rounded text-indigo-600 focus:ring-indigo-600 dark:bg-blue-gray-700"
84
- />
85
- <label for="remember-me" class="ml-3 block text-sm text-gray-900 dark:text-gray-100 leading-6">
86
- Remember me
87
- </label>
88
- </div>
89
- @endif
90
-
91
- @if(showForgotPassword)
92
- <div class="text-sm leading-6">
93
- <a href="#" class="text-indigo-600 dark:text-indigo-400 font-semibold hover:text-indigo-500 dark:hover:text-indigo-300">
94
- Forgot password?
95
- </a>
96
- </div>
97
- @endif
98
- </div>
99
-
100
- <div>
101
- <button
102
- type="submit"
103
- class="w-full flex justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm text-white font-semibold leading-6 shadow-sm hover:bg-indigo-500 focus-visible:outline-2 focus-visible:outline-indigo-600 focus-visible:outline-offset-2 focus-visible:outline"
104
- >
105
- Sign in
106
- </button>
107
- </div>
108
- </div>
109
-
110
- @if(showSocialLogin)
111
- <div>
112
- <div class="relative mt-10">
113
- <div class="absolute inset-0 flex items-center" aria-hidden="true">
114
- <div class="w-full border-t border-gray-200 dark:border-gray-600"></div>
115
- </div>
116
- <div class="relative flex justify-center text-sm font-medium leading-6">
117
- <span class="bg-white dark:bg-blue-gray-800 px-6 text-gray-900 dark:text-gray-100">
118
- Or continue with
119
- </span>
120
- </div>
121
- </div>
122
-
123
- <div class="grid grid-cols-2 mt-6 gap-4">
124
- <a
125
- href="#"
126
- class="w-full flex items-center justify-center gap-3 rounded-md bg-white dark:bg-blue-gray-700 px-3 py-2 text-sm text-gray-900 dark:text-gray-100 font-semibold shadow-sm ring-1 ring-gray-300 dark:ring-gray-600 ring-inset hover:bg-gray-50 dark:hover:bg-blue-gray-600 focus-visible:ring-transparent"
127
- >
128
- <svg class="h-5 w-5" viewBox="0 0 24 24" aria-hidden="true">
129
- <path d="M12.0003 4.75C13.7703 4.75 15.3553 5.36002 16.6053 6.54998L20.0303 3.125C17.9502 1.19 15.2353 0 12.0003 0C7.31028 0 3.25527 2.69 1.28027 6.60998L5.27028 9.70498C6.21525 6.86002 8.87028 4.75 12.0003 4.75Z" fill="#EA4335" />
130
- <path d="M23.49 12.275C23.49 11.49 23.415 10.73 23.3 10H12V14.51H18.47C18.18 15.99 17.34 17.25 16.08 18.1L19.945 21.1C22.2 19.01 23.49 15.92 23.49 12.275Z" fill="#4285F4" />
131
- <path d="M5.26498 14.2949C5.02498 13.5699 4.88501 12.7999 4.88501 11.9999C4.88501 11.1999 5.01998 10.4299 5.26498 9.7049L1.275 6.60986C0.46 8.22986 0 10.0599 0 11.9999C0 13.9399 0.46 15.7699 1.28 17.3899L5.26498 14.2949Z" fill="#FBBC05" />
132
- <path d="M12.0004 24.0001C15.2404 24.0001 17.9654 22.935 19.9454 21.095L16.0804 18.095C15.0054 18.82 13.6204 19.245 12.0004 19.245C8.8704 19.245 6.21537 17.135 5.2654 14.29L1.27539 17.385C3.25539 21.31 7.3104 24.0001 12.0004 24.0001Z" fill="#34A853" />
133
- </svg>
134
- <span class="text-sm font-semibold leading-6">Google</span>
135
- </a>
136
-
137
- <a
138
- href="#"
139
- class="w-full flex items-center justify-center gap-3 rounded-md bg-white dark:bg-blue-gray-700 px-3 py-2 text-sm text-gray-900 dark:text-gray-100 font-semibold shadow-sm ring-1 ring-gray-300 dark:ring-gray-600 ring-inset hover:bg-gray-50 dark:hover:bg-blue-gray-600 focus-visible:ring-transparent"
140
- >
141
- <svg class="h-5 w-5 fill-[#24292F]" fill="currentColor" viewBox="0 0 20 20" aria-hidden="true">
142
- <path fill-rule="evenodd" d="M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z" clip-rule="evenodd" />
143
- </svg>
144
- <span class="text-sm font-semibold leading-6">GitHub</span>
145
- </a>
146
- </div>
147
- </div>
148
- @endif
149
- </div>
150
-
151
- @if(showSignup)
152
- <p class="mt-10 text-center text-sm text-gray-500 dark:text-gray-400">
153
- Not a member?
154
- <a href="#" class="text-indigo-600 dark:text-indigo-400 font-semibold leading-6 hover:text-indigo-500 dark:hover:text-indigo-300">
155
- {{ signupText }}
156
- </a>
157
- </p>
158
- @endif
159
- </div>
160
- </form>
161
- </div>
@@ -1,142 +0,0 @@
1
- # Auth Components
2
-
3
- Authentication UI components including Login, Signup, and Two-Factor Authentication.
4
-
5
- ## Components
6
-
7
- ### Login
8
- A full-featured login form with email/password and optional social login.
9
-
10
- ### Signup
11
- A registration form with name, email, email confirmation, and password fields.
12
-
13
- ### TwoFactorChallenge
14
- A 2FA code entry component with auto-focus and recovery code option.
15
-
16
- ## Installation
17
-
18
- ```bash
19
- bun add @stacksjs/components
20
- ```
21
-
22
- ## Usage
23
-
24
- ### Login Component
25
-
26
- ```stx
27
- <script server>
28
- const handleLogin = (data) => {
29
- console.log('Login:', data.email, data.password)
30
- }
31
- </script>
32
-
33
- <Login
34
- showLogo
35
- headingText="Sign in to your account"
36
- showSocialLogin
37
- showRememberMe
38
- showForgotPassword
39
- showSignup
40
- signupText="Start a 14 day free trial"
41
- :onSubmit="handleLogin"
42
- />
43
- ```
44
-
45
- ### Signup Component
46
-
47
- ```stx
48
- <script server>
49
- const handleSignup = (data) => {
50
- console.log('Signup:', data.name, data.email, data.password)
51
- }
52
- </script>
53
-
54
- <Signup
55
- headingText="Sign up for Stacks"
56
- showSocialSignup
57
- :onSubmit="handleSignup"
58
- />
59
- ```
60
-
61
- ### TwoFactorChallenge Component
62
-
63
- ```stx
64
- <script server>
65
- const handleVerify = (code) => {
66
- console.log('2FA Code:', code)
67
- }
68
-
69
- const handleRecoveryCode = () => {
70
- console.log('Using recovery code')
71
- }
72
- </script>
73
-
74
- <TwoFactorChallenge
75
- headingText="Two Factor Authentication"
76
- labelText="Authentication code"
77
- instructionText="Open your 2FA app to view your authentication code."
78
- :codeLength="6"
79
- :onSubmit="handleVerify"
80
- :onUseRecoveryCode="handleRecoveryCode"
81
- />
82
- ```
83
-
84
- ## Props
85
-
86
- ### Login Props
87
-
88
- | Prop | Type | Default | Description |
89
- |------|------|---------|-------------|
90
- | `showLogo` | `boolean` | `true` | Show logo at top |
91
- | `headingText` | `string` | `'Sign in to your account'` | Heading text |
92
- | `showSocialLogin` | `boolean` | `true` | Show social login buttons |
93
- | `showRememberMe` | `boolean` | `true` | Show remember me checkbox |
94
- | `showForgotPassword` | `boolean` | `true` | Show forgot password link |
95
- | `showSignup` | `boolean` | `true` | Show signup link at bottom |
96
- | `signupText` | `string` | `'Start a 14 day free trial'` | Signup link text |
97
- | `onSubmit` | `function` | - | Callback when form submitted |
98
- | `className` | `string` | `''` | Additional CSS classes |
99
-
100
- ### Signup Props
101
-
102
- | Prop | Type | Default | Description |
103
- |------|------|---------|-------------|
104
- | `headingText` | `string` | `'Sign up for Stacks'` | Heading text |
105
- | `showSocialSignup` | `boolean` | `true` | Show social signup buttons |
106
- | `onSubmit` | `function` | - | Callback when form submitted |
107
- | `className` | `string` | `''` | Additional CSS classes |
108
-
109
- ### TwoFactorChallenge Props
110
-
111
- | Prop | Type | Default | Description |
112
- |------|------|---------|-------------|
113
- | `headingText` | `string` | `'Two Factor Authentication'` | Heading text |
114
- | `labelText` | `string` | `'Authentication code'` | Input label |
115
- | `instructionText` | `string` | `'Open your Symantec 2FA app...'` | Instructions |
116
- | `codeLength` | `number` | `6` | Number of code digits |
117
- | `onSubmit` | `function` | - | Callback with complete code |
118
- | `onUseRecoveryCode` | `function` | - | Callback for recovery code |
119
- | `className` | `string` | `''` | Additional CSS classes |
120
-
121
- ## Features
122
-
123
- - **Modern ES module exports** - Clean, modern JavaScript
124
- - **Dark mode support** - All components support dark mode
125
- - **Fully accessible** - Proper labels, ARIA attributes
126
- - **Social login** - Google and GitHub integration
127
- - **Auto-focus** - 2FA inputs auto-focus next field
128
- - **Validation** - Email confirmation validation in Signup
129
- - **TypeScript** - Full type definitions
130
- - **Headwind styling** - Utility-first CSS classes
131
-
132
- ## Accessibility
133
-
134
- - Proper label associations
135
- - ARIA attributes where needed
136
- - Keyboard navigation support
137
- - Focus management in 2FA component
138
- - Required field indicators
139
-
140
- ## Customization
141
-
142
- All components accept a `className` prop for additional styling and support full customization through props.
@@ -1,159 +0,0 @@
1
- <script server>
2
- export const headingText = $props.headingText || 'Sign up for Stacks'
3
- export const showSocialSignup = $props.showSocialSignup ?? true
4
- export const className = $props.className || ''
5
-
6
- export const containerClasses = `min-h-full flex flex-col justify-center py-12 lg:px-8 sm:px-6 dark:bg-blue-gray-900 ${className}`.trim()
7
- </script>
8
-
9
- <script client>
10
- const emit = defineEmits()
11
-
12
- function onSubmit(event) {
13
- event.preventDefault()
14
- const formData = new FormData(event.target)
15
- const name = formData.get('name')
16
- const email = formData.get('email')
17
- const confirmEmail = formData.get('confirm_email')
18
- const password = formData.get('password')
19
-
20
- if (email !== confirmEmail) {
21
- emit('error', { message: 'Emails do not match' })
22
- return
23
- }
24
-
25
- emit('submit', { name, email, password })
26
-
27
- setTimeout(() => {
28
- event.target.querySelector('#password')?.setAttribute('value', '')
29
- event.target.querySelector('#confirm_email')?.setAttribute('value', '')
30
- }, 1000)
31
- }
32
- </script>
33
-
34
- <div class="{{ containerClasses }}">
35
- <div class="sm:mx-auto sm:max-w-md sm:w-full">
36
- <h2 class="mt-6 text-center text-2xl text-gray-900 dark:text-gray-100 font-bold leading-9 tracking-tight">
37
- {{ headingText }}
38
- </h2>
39
- </div>
40
-
41
- <div class="mt-10 sm:mx-auto sm:max-w-[480px] sm:w-full">
42
- <div class="bg-white dark:bg-blue-gray-800 px-6 py-12 shadow sm:rounded-lg sm:px-12">
43
- <form class="space-y-6" @submit="onSubmit($event)">
44
- <div>
45
- <label for="name" class="block text-sm text-gray-900 dark:text-gray-100 font-medium leading-6">
46
- Full Name
47
- </label>
48
- <div class="mt-2">
49
- <input
50
- id="name"
51
- name="name"
52
- type="text"
53
- autocomplete="name"
54
- required
55
- class="block w-full border-0 rounded-md p-2 py-1.5 text-gray-900 dark:text-gray-100 shadow-sm ring-1 ring-gray-300 dark:ring-gray-600 ring-inset sm:text-sm placeholder:text-gray-400 dark:placeholder:text-gray-500 sm:leading-6 focus:ring-2 focus:ring-teal-600 focus:ring-inset dark:bg-blue-gray-700"
56
- />
57
- </div>
58
- </div>
59
-
60
- <div>
61
- <label for="email" class="block text-sm text-gray-900 dark:text-gray-100 font-medium leading-6">
62
- Email address
63
- </label>
64
- <div class="mt-2">
65
- <input
66
- id="email"
67
- name="email"
68
- type="email"
69
- autocomplete="email"
70
- required
71
- class="block w-full border-0 rounded-md p-2 py-1.5 text-gray-900 dark:text-gray-100 shadow-sm ring-1 ring-gray-300 dark:ring-gray-600 ring-inset sm:text-sm placeholder:text-gray-400 dark:placeholder:text-gray-500 sm:leading-6 focus:ring-2 focus:ring-teal-600 focus:ring-inset dark:bg-blue-gray-700"
72
- />
73
- </div>
74
- </div>
75
-
76
- <div>
77
- <label for="confirm_email" class="block text-sm text-gray-900 dark:text-gray-100 font-medium leading-6">
78
- Confirm Email
79
- </label>
80
- <div class="mt-2">
81
- <input
82
- id="confirm_email"
83
- name="confirm_email"
84
- type="email"
85
- autocomplete="email"
86
- required
87
- class="block w-full border-0 rounded-md p-2 py-1.5 text-gray-900 dark:text-gray-100 shadow-sm ring-1 ring-gray-300 dark:ring-gray-600 ring-inset sm:text-sm placeholder:text-gray-400 dark:placeholder:text-gray-500 sm:leading-6 focus:ring-2 focus:ring-teal-600 focus:ring-inset dark:bg-blue-gray-700"
88
- />
89
- </div>
90
- </div>
91
-
92
- <div>
93
- <label for="password" class="block text-sm text-gray-900 dark:text-gray-100 font-medium leading-6">
94
- Password
95
- </label>
96
- <div class="mt-2">
97
- <input
98
- id="password"
99
- name="password"
100
- type="password"
101
- autocomplete="new-password"
102
- required
103
- class="block w-full border-0 rounded-md p-2 py-1.5 text-gray-900 dark:text-gray-100 shadow-sm ring-1 ring-gray-300 dark:ring-gray-600 ring-inset sm:text-sm placeholder:text-gray-400 dark:placeholder:text-gray-500 sm:leading-6 focus:ring-2 focus:ring-teal-600 focus:ring-inset dark:bg-blue-gray-700"
104
- />
105
- </div>
106
- </div>
107
-
108
- <div>
109
- <button
110
- type="submit"
111
- class="w-full flex justify-center rounded-md bg-teal-600 px-3 py-1.5 text-sm text-white font-semibold leading-6 shadow-sm hover:bg-teal-500 focus-visible:outline-2 focus-visible:outline-teal-600 focus-visible:outline-offset-2 focus-visible:outline"
112
- >
113
- Sign up
114
- </button>
115
- </div>
116
- </form>
117
-
118
- @if(showSocialSignup)
119
- <div>
120
- <div class="relative mt-10">
121
- <div class="absolute inset-0 flex items-center" aria-hidden="true">
122
- <div class="w-full border-t border-gray-200 dark:border-gray-600"></div>
123
- </div>
124
- <div class="relative flex justify-center text-sm font-medium leading-6">
125
- <span class="bg-white dark:bg-blue-gray-800 px-6 text-gray-900 dark:text-gray-100">
126
- Or signup with
127
- </span>
128
- </div>
129
- </div>
130
-
131
- <div class="grid grid-cols-2 mt-6 gap-4">
132
- <a
133
- href="#"
134
- class="w-full flex items-center justify-center gap-3 rounded-md bg-white dark:bg-blue-gray-700 px-3 py-2 text-sm text-gray-900 dark:text-gray-100 font-semibold shadow-sm ring-1 ring-gray-300 dark:ring-gray-600 ring-inset hover:bg-gray-50 dark:hover:bg-blue-gray-600 focus-visible:ring-transparent"
135
- >
136
- <svg class="h-5 w-5" viewBox="0 0 24 24" aria-hidden="true">
137
- <path d="M12.0003 4.75C13.7703 4.75 15.3553 5.36002 16.6053 6.54998L20.0303 3.125C17.9502 1.19 15.2353 0 12.0003 0C7.31028 0 3.25527 2.69 1.28027 6.60998L5.27028 9.70498C6.21525 6.86002 8.87028 4.75 12.0003 4.75Z" fill="#EA4335" />
138
- <path d="M23.49 12.275C23.49 11.49 23.415 10.73 23.3 10H12V14.51H18.47C18.18 15.99 17.34 17.25 16.08 18.1L19.945 21.1C22.2 19.01 23.49 15.92 23.49 12.275Z" fill="#4285F4" />
139
- <path d="M5.26498 14.2949C5.02498 13.5699 4.88501 12.7999 4.88501 11.9999C4.88501 11.1999 5.01998 10.4299 5.26498 9.7049L1.275 6.60986C0.46 8.22986 0 10.0599 0 11.9999C0 13.9399 0.46 15.7699 1.28 17.3899L5.26498 14.2949Z" fill="#FBBC05" />
140
- <path d="M12.0004 24.0001C15.2404 24.0001 17.9654 22.935 19.9454 21.095L16.0804 18.095C15.0054 18.82 13.6204 19.245 12.0004 19.245C8.8704 19.245 6.21537 17.135 5.2654 14.29L1.27539 17.385C3.25539 21.31 7.3104 24.0001 12.0004 24.0001Z" fill="#34A853" />
141
- </svg>
142
- <span class="text-sm font-semibold leading-6">Google</span>
143
- </a>
144
-
145
- <a
146
- href="#"
147
- class="w-full flex items-center justify-center gap-3 rounded-md bg-white dark:bg-blue-gray-700 px-3 py-2 text-sm text-gray-900 dark:text-gray-100 font-semibold shadow-sm ring-1 ring-gray-300 dark:ring-gray-600 ring-inset hover:bg-gray-50 dark:hover:bg-blue-gray-600 focus-visible:ring-transparent"
148
- >
149
- <svg class="h-5 w-5 fill-[#24292F] dark:fill-white" fill="currentColor" viewBox="0 0 20 20" aria-hidden="true">
150
- <path fill-rule="evenodd" d="M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z" clip-rule="evenodd" />
151
- </svg>
152
- <span class="text-sm font-semibold leading-6">GitHub</span>
153
- </a>
154
- </div>
155
- </div>
156
- @endif
157
- </div>
158
- </div>
159
- </div>
@@ -1,111 +0,0 @@
1
- <script server>
2
- export const headingText = $props.headingText || 'Two Factor Authentication'
3
- export const labelText = $props.labelText || 'Authentication code'
4
- export const instructionText = $props.instructionText || 'Open your Symantec 2FA app to view your authentication code.'
5
- export const codeLength = $props.codeLength || 6
6
- export const showRecoveryCode = $props.showRecoveryCode ?? true
7
- export const className = $props.className || ''
8
-
9
- export const containerClasses = `py-32 dark:bg-blue-gray-900 ${className}`.trim()
10
- </script>
11
-
12
- <script client>
13
- const emit = defineEmits()
14
- const codeLength = {{ codeLength }}
15
-
16
- function onCodeInput(event, index) {
17
- const input = event.target
18
- const value = input.value
19
- if (!/^\d*$/.test(value)) {
20
- input.value = ''
21
- return
22
- }
23
- if (value.length === 1 && index < codeLength - 1) {
24
- document.getElementById(`code-${index + 1}`)?.focus()
25
- }
26
- }
27
-
28
- function onKeyDown(event, index) {
29
- if (event.key === 'Backspace' && !event.target.value && index > 0) {
30
- document.getElementById(`code-${index - 1}`)?.focus()
31
- }
32
- }
33
-
34
- function onSubmit(event) {
35
- event.preventDefault()
36
- const code = []
37
- for (let i = 0; i < codeLength; i++) {
38
- const input = document.getElementById(`code-${i}`)
39
- if (input?.value) code.push(input.value)
40
- }
41
- if (code.length === codeLength) {
42
- emit('submit', code.join(''))
43
- }
44
- else {
45
- emit('error', { message: 'Please enter all digits' })
46
- }
47
- }
48
-
49
- function onRecoveryCode(event) {
50
- event.preventDefault()
51
- emit('useRecoveryCode')
52
- }
53
- </script>
54
-
55
- <div class="{{ containerClasses }}">
56
- <div class="mx-auto max-w-sm rounded-md px-8 py-4 shadow-md bg-white dark:bg-blue-gray-800">
57
- <div class="card-body">
58
- <div>
59
- <h3 class="text-center text-sm text-gray-900 dark:text-gray-100 font-semibold">
60
- {{ headingText }}
61
- </h3>
62
- <label for="code-0" class="mt-4 block text-sm text-gray-900 dark:text-gray-100 font-medium leading-6">
63
- {{ labelText }}
64
- </label>
65
- <form @submit="onSubmit($event)">
66
- <div class="mt-2 flex rounded-md shadow-sm space-x-2">
67
- @for(i in Array(codeLength).keys())
68
- <input
69
- id="code-{{ i }}"
70
- type="text"
71
- maxlength="1"
72
- name="code-{{ i }}"
73
- placeholder="-"
74
- class="block w-full border-0 rounded-md px-2 py-2 text-center text-gray-900 dark:text-gray-100 ring-1 ring-gray-300 dark:ring-gray-600 ring-inset sm:text-sm placeholder:text-gray-400 dark:placeholder:text-gray-500 sm:leading-6 focus:ring-2 focus:ring-indigo-600 focus:ring-inset dark:bg-blue-gray-700"
75
- @input="onCodeInput($event, {{ i }})"
76
- @keydown="onKeyDown($event, {{ i }})"
77
- />
78
- @endfor
79
- </div>
80
- <div class="py-4">
81
- <button
82
- type="submit"
83
- class="relative h-8 w-full flex items-center justify-center rounded-full bg-teal-600 px-4 text-white font-semibold hover:bg-teal-500 focus:outline-none focus:ring-2 focus:ring-teal-600 focus:ring-offset-2"
84
- >
85
- Verify
86
- </button>
87
- </div>
88
- </form>
89
- <div>
90
- <p class="text-xs text-gray-700 dark:text-gray-300 font-semibold">
91
- {{ instructionText }}
92
- </p>
93
- </div>
94
- @if(showRecoveryCode)
95
- <div class="mt-4">
96
- <p class="text-xs text-gray-700 dark:text-gray-300 font-semibold">
97
- Having Problems?
98
- </p>
99
- <a
100
- href="#"
101
- @click="onRecoveryCode($event)"
102
- class="text-xs text-blue-500 hover:underline"
103
- >
104
- Use recovery code instead
105
- </a>
106
- </div>
107
- @endif
108
- </div>
109
- </div>
110
- </div>
111
- </div>
@@ -1,32 +0,0 @@
1
- export { default as Login } from './Login.stx'
2
- export { default as Signup } from './Signup.stx'
3
- export { default as TwoFactorChallenge } from './TwoFactorChallenge.stx'
4
-
5
- export interface LoginProps {
6
- showLogo?: boolean
7
- headingText?: string
8
- showSocialLogin?: boolean
9
- showRememberMe?: boolean
10
- showForgotPassword?: boolean
11
- showSignup?: boolean
12
- signupText?: string
13
- onSubmit?: (data: { email: string, password: string }) => void
14
- className?: string
15
- }
16
-
17
- export interface SignupProps {
18
- headingText?: string
19
- showSocialSignup?: boolean
20
- onSubmit?: (data: { name: string, email: string, password: string }) => void
21
- className?: string
22
- }
23
-
24
- export interface TwoFactorChallengeProps {
25
- headingText?: string
26
- labelText?: string
27
- instructionText?: string
28
- codeLength?: number
29
- onSubmit?: (code: string) => void
30
- onUseRecoveryCode?: () => void
31
- className?: string
32
- }