nucleus-core-ts 0.8.7 → 0.8.9

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 (214) hide show
  1. package/dist/client.js +1 -1
  2. package/dist/fe/components/AbstractAnimatedBackground/index.js +437 -0
  3. package/dist/fe/components/AuthorizationPage/components/AuthorizationPage.js +841 -0
  4. package/dist/fe/components/AuthorizationPage/components/ClaimList.js +100 -0
  5. package/dist/fe/components/AuthorizationPage/components/RoleClaimEditor.js +232 -0
  6. package/dist/fe/components/AuthorizationPage/components/RoleList.js +115 -0
  7. package/dist/fe/components/AuthorizationPage/index.js +6 -0
  8. package/dist/fe/components/AuthorizationPage/store/index.js +117 -0
  9. package/dist/fe/components/AuthorizationPage/theme/index.js +137 -0
  10. package/dist/fe/components/AuthorizationPage/types/index.js +1 -0
  11. package/dist/fe/components/Button/components/Button.js +158 -0
  12. package/dist/fe/components/Button/components/ButtonSpinner.js +52 -0
  13. package/dist/fe/components/Button/index.js +3 -0
  14. package/dist/fe/components/Button/theme/index.js +186 -0
  15. package/dist/fe/components/Button/types/index.js +1 -0
  16. package/dist/fe/components/Button/utils/cn.js +5 -0
  17. package/dist/fe/components/Captcha/components/Captcha.js +311 -0
  18. package/dist/fe/components/Captcha/index.js +2 -0
  19. package/dist/fe/components/Captcha/theme.js +52 -0
  20. package/dist/fe/components/Captcha/types.js +1 -0
  21. package/dist/fe/components/ChangePasswordPage/components/ChangePasswordForm.js +242 -0
  22. package/dist/fe/components/ChangePasswordPage/components/ChangePasswordHeader.js +39 -0
  23. package/dist/fe/components/ChangePasswordPage/components/ChangePasswordPage.js +60 -0
  24. package/dist/fe/components/ChangePasswordPage/index.js +5 -0
  25. package/dist/fe/components/ChangePasswordPage/store/index.js +44 -0
  26. package/dist/fe/components/ChangePasswordPage/theme/index.js +87 -0
  27. package/dist/fe/components/ChangePasswordPage/types/index.js +1 -0
  28. package/dist/fe/components/Checkbox/components/Checkbox.js +115 -0
  29. package/dist/fe/components/Checkbox/components/CheckboxIcon.js +119 -0
  30. package/dist/fe/components/Checkbox/components/SwitchTrack.js +178 -0
  31. package/dist/fe/components/Checkbox/index.js +4 -0
  32. package/dist/fe/components/Checkbox/theme/index.js +221 -0
  33. package/dist/fe/components/Checkbox/types/index.js +1 -0
  34. package/dist/fe/components/Checkbox/utils/cn.js +5 -0
  35. package/dist/fe/components/DataTable/DataTable.js +225 -0
  36. package/dist/fe/components/DataTable/components/ActionCell.js +26 -0
  37. package/dist/fe/components/DataTable/components/DataCell.js +76 -0
  38. package/dist/fe/components/DataTable/components/EditableCell.js +221 -0
  39. package/dist/fe/components/DataTable/components/EmptyState.js +29 -0
  40. package/dist/fe/components/DataTable/components/HeaderCell.js +64 -0
  41. package/dist/fe/components/DataTable/components/InfiniteScrollTrigger.js +66 -0
  42. package/dist/fe/components/DataTable/components/LoadingSpinner.js +19 -0
  43. package/dist/fe/components/DataTable/components/ResizeHandle.js +41 -0
  44. package/dist/fe/components/DataTable/components/SelectionCell.js +105 -0
  45. package/dist/fe/components/DataTable/components/SkeletonRow.js +56 -0
  46. package/dist/fe/components/DataTable/components/SkeletonTable.js +83 -0
  47. package/dist/fe/components/DataTable/components/SortIcon.js +39 -0
  48. package/dist/fe/components/DataTable/components/TableHeader.js +49 -0
  49. package/dist/fe/components/DataTable/components/TableRow.js +118 -0
  50. package/dist/fe/components/DataTable/components/index.js +14 -0
  51. package/dist/fe/components/DataTable/hooks/index.js +2 -0
  52. package/dist/fe/components/DataTable/hooks/useAutoFitColumn.js +23 -0
  53. package/dist/fe/components/DataTable/hooks/useResizeColumn.js +122 -0
  54. package/dist/fe/components/DataTable/index.js +3 -0
  55. package/dist/fe/components/DataTable/store/index.js +97 -0
  56. package/dist/fe/components/DataTable/theme/index.js +144 -0
  57. package/dist/fe/components/DataTable/types/index.js +1 -0
  58. package/dist/fe/components/DataTable/utils/cn.js +5 -0
  59. package/dist/fe/components/DatePicker/components/CalendarGrid.js +95 -0
  60. package/dist/fe/components/DatePicker/components/CalendarHeader.js +152 -0
  61. package/dist/fe/components/DatePicker/components/DatePicker.js +381 -0
  62. package/dist/fe/components/DatePicker/components/MonthYearSelector.js +93 -0
  63. package/dist/fe/components/DatePicker/index.js +7 -0
  64. package/dist/fe/components/DatePicker/locales/index.js +1113 -0
  65. package/dist/fe/components/DatePicker/theme/index.js +315 -0
  66. package/dist/fe/components/DatePicker/types/index.js +1 -0
  67. package/dist/fe/components/DatePicker/utils/cn.js +5 -0
  68. package/dist/fe/components/DatePicker/utils/date.js +132 -0
  69. package/dist/fe/components/DevicesPage/components/DeviceCard.js +251 -0
  70. package/dist/fe/components/DevicesPage/components/DevicesHeader.js +42 -0
  71. package/dist/fe/components/DevicesPage/components/DevicesPage.js +450 -0
  72. package/dist/fe/components/DevicesPage/index.js +5 -0
  73. package/dist/fe/components/DevicesPage/store/index.js +55 -0
  74. package/dist/fe/components/DevicesPage/theme/index.js +131 -0
  75. package/dist/fe/components/DevicesPage/types/index.js +1 -0
  76. package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordForm.js +214 -0
  77. package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordHeader.js +42 -0
  78. package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordPage.js +59 -0
  79. package/dist/fe/components/ForgotPasswordPage/index.js +5 -0
  80. package/dist/fe/components/ForgotPasswordPage/store/index.js +28 -0
  81. package/dist/fe/components/ForgotPasswordPage/theme/index.js +87 -0
  82. package/dist/fe/components/ForgotPasswordPage/types/index.js +1 -0
  83. package/dist/fe/components/FormBuilder/components/FormBuilder.js +156 -0
  84. package/dist/fe/components/FormBuilder/components/FormField.js +218 -0
  85. package/dist/fe/components/FormBuilder/hooks/useFormBuilder.js +152 -0
  86. package/dist/fe/components/FormBuilder/index.js +4 -0
  87. package/dist/fe/components/FormBuilder/theme/index.js +134 -0
  88. package/dist/fe/components/FormBuilder/types/index.js +1 -0
  89. package/dist/fe/components/FormBuilder/utils/cn.js +5 -0
  90. package/dist/fe/components/FormBuilder/utils/fieldMapping.js +216 -0
  91. package/dist/fe/components/FormBuilder/utils/validation.js +78 -0
  92. package/dist/fe/components/LoginPage/components/LoginForm.js +214 -0
  93. package/dist/fe/components/LoginPage/components/LoginHeader.js +24 -0
  94. package/dist/fe/components/LoginPage/components/LoginPage.js +138 -0
  95. package/dist/fe/components/LoginPage/index.js +5 -0
  96. package/dist/fe/components/LoginPage/store/index.js +59 -0
  97. package/dist/fe/components/LoginPage/theme/index.js +98 -0
  98. package/dist/fe/components/LoginPage/types/index.js +1 -0
  99. package/dist/fe/components/MagicLinkVerifyPage/components/MagicLinkVerifyPage.js +200 -0
  100. package/dist/fe/components/MagicLinkVerifyPage/index.js +3 -0
  101. package/dist/fe/components/MagicLinkVerifyPage/store.js +20 -0
  102. package/dist/fe/components/MagicLinkVerifyPage/theme.js +36 -0
  103. package/dist/fe/components/MagicLinkVerifyPage/types.js +1 -0
  104. package/dist/fe/components/NucleusEntityShowcase.js +1409 -0
  105. package/dist/fe/components/NucleusTextInput/components/FloatingLabel.js +56 -0
  106. package/dist/fe/components/NucleusTextInput/components/InputIcons.js +258 -0
  107. package/dist/fe/components/NucleusTextInput/components/NucleusTextInput.js +321 -0
  108. package/dist/fe/components/NucleusTextInput/components/PasswordStrengthIndicator.js +104 -0
  109. package/dist/fe/components/NucleusTextInput/components/TypewriterText.js +56 -0
  110. package/dist/fe/components/NucleusTextInput/index.js +7 -0
  111. package/dist/fe/components/NucleusTextInput/theme/index.js +121 -0
  112. package/dist/fe/components/NucleusTextInput/types/index.js +1 -0
  113. package/dist/fe/components/NucleusTextInput/utils/cn.js +5 -0
  114. package/dist/fe/components/NucleusTextInput/utils/format.js +62 -0
  115. package/dist/fe/components/NucleusTextInput/utils/validation.js +191 -0
  116. package/dist/fe/components/ProfilePage/components/AddressCard.js +196 -0
  117. package/dist/fe/components/ProfilePage/components/PhoneCard.js +206 -0
  118. package/dist/fe/components/ProfilePage/components/ProfileHeader.js +150 -0
  119. package/dist/fe/components/ProfilePage/components/ProfilePage.js +1336 -0
  120. package/dist/fe/components/ProfilePage/index.js +6 -0
  121. package/dist/fe/components/ProfilePage/store/index.js +115 -0
  122. package/dist/fe/components/ProfilePage/theme/index.js +168 -0
  123. package/dist/fe/components/ProfilePage/types/index.js +1 -0
  124. package/dist/fe/components/RangePicker/components/RangePicker.js +338 -0
  125. package/dist/fe/components/RangePicker/components/RangeThumb.js +68 -0
  126. package/dist/fe/components/RangePicker/components/RangeTooltip.js +45 -0
  127. package/dist/fe/components/RangePicker/components/RangeTrack.js +32 -0
  128. package/dist/fe/components/RangePicker/index.js +5 -0
  129. package/dist/fe/components/RangePicker/theme/index.js +88 -0
  130. package/dist/fe/components/RangePicker/types/index.js +1 -0
  131. package/dist/fe/components/RangePicker/utils/cn.js +3 -0
  132. package/dist/fe/components/RegisterPage/components/PasswordStrengthIndicator.js +107 -0
  133. package/dist/fe/components/RegisterPage/components/RegisterForm.js +322 -0
  134. package/dist/fe/components/RegisterPage/components/RegisterHeader.js +23 -0
  135. package/dist/fe/components/RegisterPage/components/RegisterPage.js +85 -0
  136. package/dist/fe/components/RegisterPage/index.js +6 -0
  137. package/dist/fe/components/RegisterPage/store/index.js +106 -0
  138. package/dist/fe/components/RegisterPage/theme/index.js +128 -0
  139. package/dist/fe/components/RegisterPage/types/index.js +1 -0
  140. package/dist/fe/components/ResetPasswordPage/components/ResetPasswordForm.js +347 -0
  141. package/dist/fe/components/ResetPasswordPage/components/ResetPasswordHeader.js +42 -0
  142. package/dist/fe/components/ResetPasswordPage/components/ResetPasswordPage.js +61 -0
  143. package/dist/fe/components/ResetPasswordPage/index.js +5 -0
  144. package/dist/fe/components/ResetPasswordPage/store/index.js +36 -0
  145. package/dist/fe/components/ResetPasswordPage/theme/index.js +99 -0
  146. package/dist/fe/components/ResetPasswordPage/types/index.js +1 -0
  147. package/dist/fe/components/SearchBox/components/SearchBox.js +271 -0
  148. package/dist/fe/components/SearchBox/components/SearchBoxDropdown.js +87 -0
  149. package/dist/fe/components/SearchBox/index.js +5 -0
  150. package/dist/fe/components/SearchBox/theme/index.js +184 -0
  151. package/dist/fe/components/SearchBox/types/index.js +1 -0
  152. package/dist/fe/components/SearchBox/utils/cn.js +5 -0
  153. package/dist/fe/components/SearchBox/utils/debounce.js +22 -0
  154. package/dist/fe/components/SearchBox/utils/sanitize.js +48 -0
  155. package/dist/fe/components/SelectBox/components/SelectBox.js +364 -0
  156. package/dist/fe/components/SelectBox/components/SelectDropdown.js +92 -0
  157. package/dist/fe/components/SelectBox/components/SelectOptionItem.js +43 -0
  158. package/dist/fe/components/SelectBox/components/SelectTrigger.js +22 -0
  159. package/dist/fe/components/SelectBox/index.js +5 -0
  160. package/dist/fe/components/SelectBox/theme/index.js +98 -0
  161. package/dist/fe/components/SelectBox/types/index.js +1 -0
  162. package/dist/fe/components/SelectBox/utils/cn.js +3 -0
  163. package/dist/fe/components/SetPasswordPage/components/PasswordStrengthIndicator.js +107 -0
  164. package/dist/fe/components/SetPasswordPage/components/SetPasswordForm.js +142 -0
  165. package/dist/fe/components/SetPasswordPage/components/SetPasswordHeader.js +23 -0
  166. package/dist/fe/components/SetPasswordPage/components/SetPasswordPage.js +263 -0
  167. package/dist/fe/components/SetPasswordPage/index.js +7 -0
  168. package/dist/fe/components/SetPasswordPage/store/index.js +79 -0
  169. package/dist/fe/components/SetPasswordPage/theme/index.js +98 -0
  170. package/dist/fe/components/SetPasswordPage/types/index.js +12 -0
  171. package/dist/fe/components/UsersPage/components/InviteUserModal.js +262 -0
  172. package/dist/fe/components/UsersPage/components/Pagination.js +147 -0
  173. package/dist/fe/components/UsersPage/components/RoleAssignmentModal.js +186 -0
  174. package/dist/fe/components/UsersPage/components/StatsCards.js +124 -0
  175. package/dist/fe/components/UsersPage/components/UserDetailDrawer.js +444 -0
  176. package/dist/fe/components/UsersPage/components/UserFilters.js +142 -0
  177. package/dist/fe/components/UsersPage/components/UserListItem.js +125 -0
  178. package/dist/fe/components/UsersPage/components/UserListSkeleton.js +40 -0
  179. package/dist/fe/components/UsersPage/components/UsersPage.js +556 -0
  180. package/dist/fe/components/UsersPage/index.js +10 -0
  181. package/dist/fe/components/UsersPage/store/index.js +151 -0
  182. package/dist/fe/components/UsersPage/theme/index.js +231 -0
  183. package/dist/fe/components/UsersPage/types/index.js +1 -0
  184. package/dist/fe/components/VerifyEmailPage/components/VerifyEmailPage.js +290 -0
  185. package/dist/fe/components/VerifyEmailPage/index.js +3 -0
  186. package/dist/fe/components/VerifyEmailPage/store/index.js +45 -0
  187. package/dist/fe/components/VerifyEmailPage/theme/index.js +52 -0
  188. package/dist/fe/components/VerifyEmailPage/types/index.js +1 -0
  189. package/dist/fe/hooks/useNucleusEntity.js +247 -0
  190. package/dist/fe/index.js +28 -157
  191. package/dist/fe/types/index.js +1 -0
  192. package/dist/fe/utils/cn.js +5 -0
  193. package/dist/fe/utils/columnUtils.js +189 -0
  194. package/dist/fe/utils/endpointKeys.js +44 -0
  195. package/dist/index.js +1 -1
  196. package/dist/nucleus.config.d.ts +2 -0
  197. package/dist/src/Client/ApiCaller/client.js +1 -0
  198. package/dist/src/Client/ApiCaller/examples/usage.example.js +1 -0
  199. package/dist/src/Client/ApiCaller/generator.js +1 -0
  200. package/dist/src/Client/ApiCaller/index.js +1 -0
  201. package/dist/src/Client/ApiCaller/server.js +1 -0
  202. package/dist/src/Client/ApiCaller/system-tables.js +1 -0
  203. package/dist/src/Client/ApiCaller/types.js +1 -0
  204. package/dist/src/Client/Proxy/httpProxy.js +1 -0
  205. package/dist/src/Client/Proxy/index.js +1 -1
  206. package/dist/src/Client/Proxy/server.js +1 -0
  207. package/dist/src/Client/Proxy/types.js +1 -0
  208. package/dist/src/Client/Proxy/utils.js +1 -0
  209. package/dist/src/Client/Proxy/wsProxy.js +1 -0
  210. package/dist/src/Client/ServerFetch/index.js +1 -0
  211. package/dist/src/Client/ServerFetch/types.js +1 -0
  212. package/dist/src/Client/index.js +1 -0
  213. package/package.json +1 -1
  214. package/scripts/build.ts +41 -16
@@ -0,0 +1,68 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useGSAP } from "@gsap/react";
4
+ import gsap from "gsap";
5
+ import { forwardRef, useRef } from "react";
6
+ import { rangePickerTheme } from "../theme";
7
+ import { cn } from "../utils/cn";
8
+ gsap.registerPlugin(useGSAP);
9
+ export const RangeThumb = /*#__PURE__*/ forwardRef(({ position, value, min, max, size, variant, disabled, isDragging, onDragStart, onDragEnd, ariaLabel, ariaValueText }, ref)=>{
10
+ const theme = rangePickerTheme;
11
+ const thumbRef = useRef(null);
12
+ const percent = (value - min) / (max - min) * 100;
13
+ useGSAP(()=>{
14
+ if (!thumbRef.current) return;
15
+ if (isDragging) {
16
+ gsap.to(thumbRef.current, {
17
+ scale: 1.2,
18
+ duration: 0.15,
19
+ ease: "power2.out"
20
+ });
21
+ } else {
22
+ gsap.to(thumbRef.current, {
23
+ scale: 1,
24
+ duration: 0.2,
25
+ ease: "elastic.out(1, 0.5)"
26
+ });
27
+ }
28
+ }, [
29
+ isDragging
30
+ ]);
31
+ return /*#__PURE__*/ _jsx("div", {
32
+ ref: (node)=>{
33
+ thumbRef.current = node;
34
+ if (typeof ref === "function") {
35
+ ref(node);
36
+ } else if (ref) {
37
+ ref.current = node;
38
+ }
39
+ },
40
+ role: "slider",
41
+ tabIndex: disabled ? -1 : 0,
42
+ "aria-label": ariaLabel || `${position} value`,
43
+ "aria-valuemin": min,
44
+ "aria-valuemax": max,
45
+ "aria-valuenow": value,
46
+ "aria-valuetext": ariaValueText || String(value),
47
+ "aria-disabled": disabled,
48
+ "data-position": position,
49
+ className: cn(theme.thumb.base, theme.thumb.size[size], theme.thumb.variant[variant], theme.thumb.shadow, !disabled && theme.thumb.states.hover, isDragging && theme.thumb.states.active, disabled && theme.thumb.states.disabled),
50
+ style: {
51
+ left: `${percent}%`
52
+ },
53
+ onMouseDown: (e)=>{
54
+ e.preventDefault();
55
+ if (!disabled) onDragStart();
56
+ },
57
+ onTouchStart: (e)=>{
58
+ e.preventDefault();
59
+ if (!disabled) onDragStart();
60
+ },
61
+ onMouseUp: onDragEnd,
62
+ onTouchEnd: onDragEnd,
63
+ onKeyDown: ()=>{
64
+ if (disabled) return;
65
+ }
66
+ });
67
+ });
68
+ RangeThumb.displayName = "RangeThumb";
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useGSAP } from "@gsap/react";
4
+ import gsap from "gsap";
5
+ import { useRef } from "react";
6
+ import { rangePickerTheme } from "../theme";
7
+ import { cn } from "../utils/cn";
8
+ gsap.registerPlugin(useGSAP);
9
+ export function RangeTooltip({ value, visible, size, formatValue }) {
10
+ const theme = rangePickerTheme;
11
+ const tooltipRef = useRef(null);
12
+ useGSAP(()=>{
13
+ if (!tooltipRef.current) return;
14
+ if (visible) {
15
+ gsap.to(tooltipRef.current, {
16
+ opacity: 1,
17
+ y: 0,
18
+ scale: 1,
19
+ duration: 0.2,
20
+ ease: "power2.out"
21
+ });
22
+ } else {
23
+ gsap.to(tooltipRef.current, {
24
+ opacity: 0,
25
+ y: 4,
26
+ scale: 0.95,
27
+ duration: 0.15,
28
+ ease: "power2.in"
29
+ });
30
+ }
31
+ }, [
32
+ visible
33
+ ]);
34
+ const displayValue = formatValue ? formatValue(value) : String(value);
35
+ return /*#__PURE__*/ _jsx("div", {
36
+ ref: tooltipRef,
37
+ className: cn(theme.tooltip.base, theme.tooltip.size[size], theme.tooltip.arrow),
38
+ style: {
39
+ opacity: 0,
40
+ transform: "translateX(-50%) translateY(4px) scale(0.95)"
41
+ },
42
+ "aria-hidden": "true",
43
+ children: displayValue
44
+ });
45
+ }
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { forwardRef } from "react";
4
+ import { rangePickerTheme } from "../theme";
5
+ import { cn } from "../utils/cn";
6
+ export const RangeTrack = /*#__PURE__*/ forwardRef(({ min, max, value, size, variant, orientation, disabled }, ref)=>{
7
+ const theme = rangePickerTheme;
8
+ const range = max - min;
9
+ const minPercent = (value.min - min) / range * 100;
10
+ const maxPercent = (value.max - min) / range * 100;
11
+ const isHorizontal = orientation === "horizontal";
12
+ return /*#__PURE__*/ _jsxs("div", {
13
+ ref: ref,
14
+ className: cn(theme.track.container.base, theme.track.container.size[size], theme.track.container.orientation[orientation]),
15
+ children: [
16
+ /*#__PURE__*/ _jsx("div", {
17
+ className: cn(theme.track.background.base, theme.track.background.variant[variant], disabled && theme.track.background.disabled)
18
+ }),
19
+ /*#__PURE__*/ _jsx("div", {
20
+ className: cn(theme.track.range.base, theme.track.range.variant[variant], disabled && theme.track.range.disabled, isHorizontal ? "top-0 bottom-0" : "left-0 right-0"),
21
+ style: isHorizontal ? {
22
+ left: `${minPercent}%`,
23
+ right: `${100 - maxPercent}%`
24
+ } : {
25
+ bottom: `${minPercent}%`,
26
+ top: `${100 - maxPercent}%`
27
+ }
28
+ })
29
+ ]
30
+ });
31
+ });
32
+ RangeTrack.displayName = "RangeTrack";
@@ -0,0 +1,5 @@
1
+ export { RangePicker } from "./components/RangePicker";
2
+ export { RangeThumb } from "./components/RangeThumb";
3
+ export { RangeTooltip } from "./components/RangeTooltip";
4
+ export { RangeTrack } from "./components/RangeTrack";
5
+ export { rangePickerTheme } from "./theme";
@@ -0,0 +1,88 @@
1
+ export const rangePickerTheme = {
2
+ container: {
3
+ base: "relative w-full select-none",
4
+ orientation: {
5
+ horizontal: "py-2",
6
+ vertical: "px-2 h-32"
7
+ },
8
+ disabled: "opacity-40 pointer-events-none"
9
+ },
10
+ label: {
11
+ base: "block font-medium text-zinc-700 dark:text-zinc-300 mb-3",
12
+ size: {
13
+ sm: "text-xs",
14
+ md: "text-sm",
15
+ lg: "text-base"
16
+ }
17
+ },
18
+ track: {
19
+ container: {
20
+ base: "relative cursor-pointer",
21
+ size: {
22
+ sm: "h-0.5",
23
+ md: "h-1",
24
+ lg: "h-1.5"
25
+ },
26
+ orientation: {
27
+ horizontal: "w-full",
28
+ vertical: "h-full w-1"
29
+ }
30
+ },
31
+ background: {
32
+ base: "absolute inset-0 rounded-full",
33
+ variant: {
34
+ default: "bg-zinc-200 dark:bg-zinc-700",
35
+ filled: "bg-zinc-300 dark:bg-zinc-600",
36
+ minimal: "bg-zinc-100 dark:bg-zinc-800"
37
+ },
38
+ disabled: "bg-zinc-100 dark:bg-zinc-800"
39
+ },
40
+ range: {
41
+ base: "absolute rounded-full",
42
+ variant: {
43
+ default: "bg-zinc-900 dark:bg-white",
44
+ filled: "bg-zinc-800 dark:bg-zinc-100",
45
+ minimal: "bg-zinc-600 dark:bg-zinc-400"
46
+ },
47
+ disabled: "bg-zinc-400 dark:bg-zinc-500"
48
+ }
49
+ },
50
+ thumb: {
51
+ base: "absolute rounded-full cursor-grab active:cursor-grabbing touch-none z-10",
52
+ size: {
53
+ sm: "w-2.5 h-2.5",
54
+ md: "w-3.5 h-3.5",
55
+ lg: "w-4 h-4"
56
+ },
57
+ variant: {
58
+ default: "bg-zinc-900 dark:bg-white",
59
+ filled: "bg-zinc-800 dark:bg-zinc-100",
60
+ minimal: "bg-white dark:bg-zinc-900 border border-zinc-300 dark:border-zinc-600"
61
+ },
62
+ states: {
63
+ hover: "",
64
+ active: "",
65
+ focus: "outline-none ring-2 ring-zinc-400/50 dark:ring-zinc-500/50",
66
+ disabled: "cursor-not-allowed"
67
+ },
68
+ shadow: "shadow-sm"
69
+ },
70
+ tooltip: {
71
+ base: "absolute pointer-events-none bg-zinc-900 dark:bg-white text-white dark:text-zinc-900 font-medium rounded whitespace-nowrap left-1/2 -translate-x-1/2",
72
+ size: {
73
+ sm: "px-1.5 py-0.5 text-[10px] -top-6",
74
+ md: "px-2 py-0.5 text-xs -top-7",
75
+ lg: "px-2 py-1 text-xs -top-8"
76
+ },
77
+ arrow: "after:absolute after:top-full after:left-1/2 after:-translate-x-1/2 after:border-4 after:border-transparent after:border-t-zinc-900 dark:after:border-t-white"
78
+ },
79
+ ticks: {
80
+ container: "absolute inset-x-0 flex justify-between pointer-events-none mt-2",
81
+ tick: "w-px h-1 bg-zinc-300 dark:bg-zinc-600",
82
+ label: "text-[10px] text-zinc-400 dark:text-zinc-500 mt-0.5"
83
+ },
84
+ labels: {
85
+ container: "flex justify-between mt-1.5",
86
+ label: "text-[10px] text-zinc-400 dark:text-zinc-500"
87
+ }
88
+ };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,3 @@
1
+ import { clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+ export const cn = (...inputs)=>twMerge(clsx(inputs));
@@ -0,0 +1,107 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cn } from "../../../utils/cn";
4
+ import { registerPageTheme } from "../theme";
5
+ const CheckIcon = ()=>/*#__PURE__*/ _jsx("svg", {
6
+ className: "w-3 h-3",
7
+ fill: "currentColor",
8
+ viewBox: "0 0 20 20",
9
+ "aria-hidden": "true",
10
+ children: /*#__PURE__*/ _jsx("path", {
11
+ fillRule: "evenodd",
12
+ d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
13
+ clipRule: "evenodd"
14
+ })
15
+ });
16
+ const CrossIcon = ()=>/*#__PURE__*/ _jsx("svg", {
17
+ className: "w-3 h-3",
18
+ fill: "currentColor",
19
+ viewBox: "0 0 20 20",
20
+ "aria-hidden": "true",
21
+ children: /*#__PURE__*/ _jsx("path", {
22
+ fillRule: "evenodd",
23
+ d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
24
+ clipRule: "evenodd"
25
+ })
26
+ });
27
+ export function PasswordStrengthIndicator({ strength, showRequirements = true, passwordMinLength = 8, requireUppercase = true, requireLowercase = true, requireNumber = true, requireSpecialChar = true }) {
28
+ const theme = registerPageTheme.passwordStrength;
29
+ const getStrengthColor = (index)=>{
30
+ if (index >= strength.score) return theme.bar.inactive;
31
+ if (strength.score === 1) return theme.bar.active.weak;
32
+ if (strength.score === 2) return theme.bar.active.fair;
33
+ if (strength.score === 3) return theme.bar.active.good;
34
+ if (strength.score === 4) return theme.bar.active.strong;
35
+ return theme.bar.active.veryStrong;
36
+ };
37
+ const requirements = [
38
+ {
39
+ key: "minLength",
40
+ label: `At least ${passwordMinLength} characters`,
41
+ met: strength.hasMinLength,
42
+ show: true
43
+ },
44
+ {
45
+ key: "uppercase",
46
+ label: "One uppercase letter",
47
+ met: strength.hasUppercase,
48
+ show: requireUppercase
49
+ },
50
+ {
51
+ key: "lowercase",
52
+ label: "One lowercase letter",
53
+ met: strength.hasLowercase,
54
+ show: requireLowercase
55
+ },
56
+ {
57
+ key: "number",
58
+ label: "One number",
59
+ met: strength.hasNumber,
60
+ show: requireNumber
61
+ },
62
+ {
63
+ key: "special",
64
+ label: "One special character",
65
+ met: strength.hasSpecialChar,
66
+ show: requireSpecialChar
67
+ }
68
+ ].filter((req)=>req.show);
69
+ return /*#__PURE__*/ _jsxs("div", {
70
+ className: theme.container,
71
+ children: [
72
+ /*#__PURE__*/ _jsx("div", {
73
+ className: theme.bar.wrapper,
74
+ role: "progressbar",
75
+ "aria-valuenow": strength.score,
76
+ "aria-valuemin": 0,
77
+ "aria-valuemax": 5,
78
+ "aria-label": "Password strength",
79
+ children: [
80
+ 0,
81
+ 1,
82
+ 2,
83
+ 3,
84
+ 4
85
+ ].map((index)=>/*#__PURE__*/ _jsx("div", {
86
+ className: cn(theme.bar.segment, getStrengthColor(index))
87
+ }, index))
88
+ }),
89
+ showRequirements && /*#__PURE__*/ _jsx("ul", {
90
+ className: theme.requirements.container,
91
+ "aria-label": "Password requirements",
92
+ children: requirements.map((req)=>/*#__PURE__*/ _jsxs("li", {
93
+ className: cn(theme.requirements.item, req.met ? theme.requirements.met : theme.requirements.unmet),
94
+ children: [
95
+ /*#__PURE__*/ _jsx("span", {
96
+ className: req.met ? theme.requirements.icon.met : theme.requirements.icon.unmet,
97
+ children: req.met ? /*#__PURE__*/ _jsx(CheckIcon, {}) : /*#__PURE__*/ _jsx(CrossIcon, {})
98
+ }),
99
+ /*#__PURE__*/ _jsx("span", {
100
+ children: req.label
101
+ })
102
+ ]
103
+ }, req.key))
104
+ })
105
+ ]
106
+ });
107
+ }
@@ -0,0 +1,322 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useGSAP } from "@gsap/react";
4
+ import gsap from "gsap";
5
+ import { useRef } from "react";
6
+ import { Button } from "../../Button";
7
+ import { Checkbox } from "../../Checkbox";
8
+ import { NucleusTextInput } from "../../NucleusTextInput";
9
+ import { useRegisterStore } from "../store";
10
+ import { registerPageTheme } from "../theme";
11
+ import { PasswordStrengthIndicator } from "./PasswordStrengthIndicator";
12
+ gsap.registerPlugin(useGSAP);
13
+ export function RegisterForm({ registerAction, showFirstName = false, showLastName = false, showTerms = true, showSignIn = true, termsHref, privacyHref, signInHref, onTermsClick, onPrivacyClick, onSignIn, onSuccess, passwordMinLength = 8, requireUppercase = true, requireLowercase = true, requireNumber = true, requireSpecialChar = false, createProfileOnRegister = false }) {
14
+ const theme = registerPageTheme;
15
+ const formRef = useRef(null);
16
+ const store = useRegisterStore();
17
+ const { contextSafe } = useGSAP({
18
+ scope: formRef
19
+ });
20
+ const isLoading = registerAction.state.isPending;
21
+ const validateForm = ()=>{
22
+ if (!store.email) {
23
+ return "Email is required";
24
+ }
25
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
26
+ if (!emailRegex.test(store.email)) {
27
+ return "Please enter a valid email address";
28
+ }
29
+ if (!store.password) {
30
+ return "Password is required";
31
+ }
32
+ if (store.password.length < passwordMinLength) {
33
+ return `Password must be at least ${passwordMinLength} characters`;
34
+ }
35
+ if (requireUppercase && !store.passwordStrength.hasUppercase) {
36
+ return "Password must contain at least one uppercase letter";
37
+ }
38
+ if (requireLowercase && !store.passwordStrength.hasLowercase) {
39
+ return "Password must contain at least one lowercase letter";
40
+ }
41
+ if (requireNumber && !store.passwordStrength.hasNumber) {
42
+ return "Password must contain at least one number";
43
+ }
44
+ if (requireSpecialChar && !store.passwordStrength.hasSpecialChar) {
45
+ return "Password must contain at least one special character";
46
+ }
47
+ if (!store.confirmPassword) {
48
+ return "Please confirm your password";
49
+ }
50
+ if (store.password !== store.confirmPassword) {
51
+ return "Passwords do not match";
52
+ }
53
+ if (showTerms && !store.acceptTerms) {
54
+ return "You must accept the terms and conditions";
55
+ }
56
+ return null;
57
+ };
58
+ const handleSubmit = contextSafe((e)=>{
59
+ e.preventDefault();
60
+ const validationError = validateForm();
61
+ if (validationError) {
62
+ store.setError(validationError);
63
+ shakeForm();
64
+ return;
65
+ }
66
+ store.setError(null);
67
+ registerAction.start({
68
+ payload: {
69
+ email: store.email,
70
+ password: store.password,
71
+ ...showFirstName && store.firstName ? {
72
+ firstName: store.firstName
73
+ } : {},
74
+ ...showLastName && store.lastName ? {
75
+ lastName: store.lastName
76
+ } : {},
77
+ ...createProfileOnRegister ? {
78
+ createProfile: true
79
+ } : {}
80
+ },
81
+ onAfterHandle: ()=>{
82
+ store.reset();
83
+ onSuccess?.();
84
+ },
85
+ onErrorHandle: (err)=>{
86
+ let errorMessage = "Registration failed. Please try again.";
87
+ if (err && typeof err === "object") {
88
+ if ("message" in err && typeof err.message === "string") {
89
+ // Try to parse JSON message from backend
90
+ try {
91
+ const parsed = JSON.parse(err.message);
92
+ errorMessage = parsed.message || parsed.error || err.message;
93
+ } catch {
94
+ errorMessage = err.message;
95
+ }
96
+ } else if ("error" in err && typeof err.error === "string") {
97
+ errorMessage = err.error;
98
+ }
99
+ } else if (err instanceof Error) {
100
+ errorMessage = err.message;
101
+ }
102
+ store.setError(errorMessage);
103
+ shakeForm();
104
+ }
105
+ });
106
+ });
107
+ const shakeForm = contextSafe(()=>{
108
+ if (!formRef.current) return;
109
+ gsap.fromTo(formRef.current, {
110
+ x: -10
111
+ }, {
112
+ x: 10,
113
+ duration: 0.08,
114
+ repeat: 5,
115
+ yoyo: true,
116
+ ease: "power2.inOut",
117
+ onComplete: ()=>{
118
+ gsap.set(formRef.current, {
119
+ x: 0
120
+ });
121
+ }
122
+ });
123
+ });
124
+ const handleTermsClick = ()=>{
125
+ if (onTermsClick) {
126
+ onTermsClick();
127
+ } else if (termsHref) {
128
+ window.location.href = termsHref;
129
+ }
130
+ };
131
+ const handlePrivacyClick = ()=>{
132
+ if (onPrivacyClick) {
133
+ onPrivacyClick();
134
+ } else if (privacyHref) {
135
+ window.location.href = privacyHref;
136
+ }
137
+ };
138
+ const handleSignInClick = ()=>{
139
+ if (onSignIn) {
140
+ onSignIn();
141
+ } else if (signInHref) {
142
+ window.location.href = signInHref;
143
+ }
144
+ };
145
+ return /*#__PURE__*/ _jsxs("form", {
146
+ ref: formRef,
147
+ onSubmit: handleSubmit,
148
+ className: theme.form.container,
149
+ noValidate: true,
150
+ children: [
151
+ store.error && /*#__PURE__*/ _jsx("div", {
152
+ className: theme.error.container,
153
+ role: "alert",
154
+ children: /*#__PURE__*/ _jsx("p", {
155
+ className: theme.error.text,
156
+ children: store.error
157
+ })
158
+ }),
159
+ /*#__PURE__*/ _jsxs("div", {
160
+ className: theme.form.spacing,
161
+ children: [
162
+ (showFirstName || showLastName) && /*#__PURE__*/ _jsxs("div", {
163
+ className: theme.form.row,
164
+ children: [
165
+ showFirstName && /*#__PURE__*/ _jsx("div", {
166
+ className: theme.input.wrapper,
167
+ children: /*#__PURE__*/ _jsx(NucleusTextInput, {
168
+ type: "text",
169
+ label: "First Name",
170
+ placeholder: "John",
171
+ value: store.firstName,
172
+ onChange: store.setFirstName,
173
+ disabled: isLoading,
174
+ enableValidation: false,
175
+ fullWidth: true,
176
+ wrapperClassName: "!bg-transparent border-zinc-300 dark:border-zinc-600",
177
+ inputClassName: "placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"
178
+ })
179
+ }),
180
+ showLastName && /*#__PURE__*/ _jsx("div", {
181
+ className: theme.input.wrapper,
182
+ children: /*#__PURE__*/ _jsx(NucleusTextInput, {
183
+ type: "text",
184
+ label: "Last Name",
185
+ placeholder: "Doe",
186
+ value: store.lastName,
187
+ onChange: store.setLastName,
188
+ disabled: isLoading,
189
+ enableValidation: false,
190
+ fullWidth: true,
191
+ wrapperClassName: "!bg-transparent border-zinc-300 dark:border-zinc-600",
192
+ inputClassName: "placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"
193
+ })
194
+ })
195
+ ]
196
+ }),
197
+ /*#__PURE__*/ _jsx("div", {
198
+ className: theme.input.wrapper,
199
+ children: /*#__PURE__*/ _jsx(NucleusTextInput, {
200
+ type: "email",
201
+ label: "Email",
202
+ placeholder: "you@example.com",
203
+ value: store.email,
204
+ onChange: store.setEmail,
205
+ disabled: isLoading,
206
+ enableValidation: false,
207
+ fullWidth: true,
208
+ wrapperClassName: "!bg-transparent border-zinc-300 dark:border-zinc-600",
209
+ inputClassName: "placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"
210
+ })
211
+ }),
212
+ /*#__PURE__*/ _jsxs("div", {
213
+ className: theme.input.wrapper,
214
+ children: [
215
+ /*#__PURE__*/ _jsx(NucleusTextInput, {
216
+ type: "password",
217
+ label: "Password",
218
+ placeholder: "••••••••",
219
+ value: store.password,
220
+ onChange: (value)=>store.setPassword(value, passwordMinLength),
221
+ disabled: isLoading,
222
+ enableValidation: false,
223
+ fullWidth: true,
224
+ wrapperClassName: "!bg-transparent border-zinc-300 dark:border-zinc-600",
225
+ inputClassName: "placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"
226
+ }),
227
+ store.password && /*#__PURE__*/ _jsx(PasswordStrengthIndicator, {
228
+ strength: store.passwordStrength,
229
+ passwordMinLength: passwordMinLength,
230
+ requireUppercase: requireUppercase,
231
+ requireLowercase: requireLowercase,
232
+ requireNumber: requireNumber,
233
+ requireSpecialChar: requireSpecialChar
234
+ })
235
+ ]
236
+ }),
237
+ /*#__PURE__*/ _jsx("div", {
238
+ className: theme.input.wrapper,
239
+ children: /*#__PURE__*/ _jsx(NucleusTextInput, {
240
+ type: "password",
241
+ label: "Confirm Password",
242
+ placeholder: "••••••••",
243
+ value: store.confirmPassword,
244
+ onChange: store.setConfirmPassword,
245
+ disabled: isLoading,
246
+ enableValidation: false,
247
+ fullWidth: true,
248
+ wrapperClassName: "!bg-transparent border-zinc-300 dark:border-zinc-600",
249
+ inputClassName: "placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"
250
+ })
251
+ }),
252
+ showTerms && /*#__PURE__*/ _jsxs("div", {
253
+ className: theme.checkbox.wrapper,
254
+ children: [
255
+ /*#__PURE__*/ _jsx(Checkbox, {
256
+ checked: store.acceptTerms,
257
+ onChange: store.setAcceptTerms,
258
+ disabled: isLoading,
259
+ size: "sm"
260
+ }),
261
+ /*#__PURE__*/ _jsxs("span", {
262
+ className: theme.checkbox.label,
263
+ children: [
264
+ "I agree to the",
265
+ " ",
266
+ /*#__PURE__*/ _jsx("button", {
267
+ type: "button",
268
+ onClick: handleTermsClick,
269
+ className: theme.links.terms,
270
+ children: "Terms of Service"
271
+ }),
272
+ (privacyHref || onPrivacyClick) && /*#__PURE__*/ _jsxs(_Fragment, {
273
+ children: [
274
+ " ",
275
+ "and",
276
+ " ",
277
+ /*#__PURE__*/ _jsx("button", {
278
+ type: "button",
279
+ onClick: handlePrivacyClick,
280
+ className: theme.links.terms,
281
+ children: "Privacy Policy"
282
+ })
283
+ ]
284
+ })
285
+ ]
286
+ })
287
+ ]
288
+ }),
289
+ /*#__PURE__*/ _jsx("div", {
290
+ className: theme.button.wrapper,
291
+ children: /*#__PURE__*/ _jsx(Button, {
292
+ type: "submit",
293
+ variant: "nucleus",
294
+ size: "lg",
295
+ fullWidth: true,
296
+ loading: isLoading,
297
+ disabled: isLoading,
298
+ children: "Create Account"
299
+ })
300
+ }),
301
+ showSignIn && /*#__PURE__*/ _jsx("div", {
302
+ className: theme.links.signIn.wrapper,
303
+ children: /*#__PURE__*/ _jsxs("span", {
304
+ className: theme.links.signIn.text,
305
+ children: [
306
+ "Already have an account?",
307
+ " ",
308
+ /*#__PURE__*/ _jsx("button", {
309
+ type: "button",
310
+ onClick: handleSignInClick,
311
+ className: theme.links.signIn.link,
312
+ disabled: isLoading,
313
+ children: "Sign in"
314
+ })
315
+ ]
316
+ })
317
+ })
318
+ ]
319
+ })
320
+ ]
321
+ });
322
+ }