nucleus-core-ts 0.8.6 → 0.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +1 -1
- package/dist/dist/index.d.ts +475 -12
- package/dist/fe/components/AbstractAnimatedBackground/index.js +437 -0
- package/dist/fe/components/AuthorizationPage/components/AuthorizationPage.js +841 -0
- package/dist/fe/components/AuthorizationPage/components/ClaimList.js +100 -0
- package/dist/fe/components/AuthorizationPage/components/RoleClaimEditor.js +232 -0
- package/dist/fe/components/AuthorizationPage/components/RoleList.js +115 -0
- package/dist/fe/components/AuthorizationPage/index.js +6 -0
- package/dist/fe/components/AuthorizationPage/store/index.js +117 -0
- package/dist/fe/components/AuthorizationPage/theme/index.js +137 -0
- package/dist/fe/components/AuthorizationPage/types/index.js +1 -0
- package/dist/fe/components/Button/components/Button.js +158 -0
- package/dist/fe/components/Button/components/ButtonSpinner.js +52 -0
- package/dist/fe/components/Button/index.js +3 -0
- package/dist/fe/components/Button/theme/index.js +186 -0
- package/dist/fe/components/Button/types/index.js +1 -0
- package/dist/fe/components/Button/utils/cn.js +5 -0
- package/dist/fe/components/Captcha/components/Captcha.js +311 -0
- package/dist/fe/components/Captcha/index.js +2 -0
- package/dist/fe/components/Captcha/theme.js +52 -0
- package/dist/fe/components/Captcha/types.js +1 -0
- package/dist/fe/components/ChangePasswordPage/components/ChangePasswordForm.js +242 -0
- package/dist/fe/components/ChangePasswordPage/components/ChangePasswordHeader.js +39 -0
- package/dist/fe/components/ChangePasswordPage/components/ChangePasswordPage.js +60 -0
- package/dist/fe/components/ChangePasswordPage/index.js +5 -0
- package/dist/fe/components/ChangePasswordPage/store/index.js +44 -0
- package/dist/fe/components/ChangePasswordPage/theme/index.js +87 -0
- package/dist/fe/components/ChangePasswordPage/types/index.js +1 -0
- package/dist/fe/components/Checkbox/components/Checkbox.js +115 -0
- package/dist/fe/components/Checkbox/components/CheckboxIcon.js +119 -0
- package/dist/fe/components/Checkbox/components/SwitchTrack.js +178 -0
- package/dist/fe/components/Checkbox/index.js +4 -0
- package/dist/fe/components/Checkbox/theme/index.js +221 -0
- package/dist/fe/components/Checkbox/types/index.js +1 -0
- package/dist/fe/components/Checkbox/utils/cn.js +5 -0
- package/dist/fe/components/DataTable/DataTable.js +225 -0
- package/dist/fe/components/DataTable/components/ActionCell.js +26 -0
- package/dist/fe/components/DataTable/components/DataCell.js +76 -0
- package/dist/fe/components/DataTable/components/EditableCell.js +221 -0
- package/dist/fe/components/DataTable/components/EmptyState.js +29 -0
- package/dist/fe/components/DataTable/components/HeaderCell.js +64 -0
- package/dist/fe/components/DataTable/components/InfiniteScrollTrigger.js +66 -0
- package/dist/fe/components/DataTable/components/LoadingSpinner.js +19 -0
- package/dist/fe/components/DataTable/components/ResizeHandle.js +41 -0
- package/dist/fe/components/DataTable/components/SelectionCell.js +105 -0
- package/dist/fe/components/DataTable/components/SkeletonRow.js +56 -0
- package/dist/fe/components/DataTable/components/SkeletonTable.js +83 -0
- package/dist/fe/components/DataTable/components/SortIcon.js +39 -0
- package/dist/fe/components/DataTable/components/TableHeader.js +49 -0
- package/dist/fe/components/DataTable/components/TableRow.js +118 -0
- package/dist/fe/components/DataTable/components/index.js +14 -0
- package/dist/fe/components/DataTable/hooks/index.js +2 -0
- package/dist/fe/components/DataTable/hooks/useAutoFitColumn.js +23 -0
- package/dist/fe/components/DataTable/hooks/useResizeColumn.js +122 -0
- package/dist/fe/components/DataTable/index.js +3 -0
- package/dist/fe/components/DataTable/store/index.js +97 -0
- package/dist/fe/components/DataTable/theme/index.js +144 -0
- package/dist/fe/components/DataTable/types/index.js +1 -0
- package/dist/fe/components/DataTable/utils/cn.js +5 -0
- package/dist/fe/components/DatePicker/components/CalendarGrid.js +95 -0
- package/dist/fe/components/DatePicker/components/CalendarHeader.js +152 -0
- package/dist/fe/components/DatePicker/components/DatePicker.js +381 -0
- package/dist/fe/components/DatePicker/components/MonthYearSelector.js +93 -0
- package/dist/fe/components/DatePicker/index.js +7 -0
- package/dist/fe/components/DatePicker/locales/index.js +1113 -0
- package/dist/fe/components/DatePicker/theme/index.js +315 -0
- package/dist/fe/components/DatePicker/types/index.js +1 -0
- package/dist/fe/components/DatePicker/utils/cn.js +5 -0
- package/dist/fe/components/DatePicker/utils/date.js +132 -0
- package/dist/fe/components/DevicesPage/components/DeviceCard.js +251 -0
- package/dist/fe/components/DevicesPage/components/DevicesHeader.js +42 -0
- package/dist/fe/components/DevicesPage/components/DevicesPage.js +450 -0
- package/dist/fe/components/DevicesPage/index.js +5 -0
- package/dist/fe/components/DevicesPage/store/index.js +55 -0
- package/dist/fe/components/DevicesPage/theme/index.js +131 -0
- package/dist/fe/components/DevicesPage/types/index.js +1 -0
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordForm.js +214 -0
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordHeader.js +42 -0
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordPage.js +59 -0
- package/dist/fe/components/ForgotPasswordPage/index.js +5 -0
- package/dist/fe/components/ForgotPasswordPage/store/index.js +28 -0
- package/dist/fe/components/ForgotPasswordPage/theme/index.js +87 -0
- package/dist/fe/components/ForgotPasswordPage/types/index.js +1 -0
- package/dist/fe/components/FormBuilder/components/FormBuilder.js +156 -0
- package/dist/fe/components/FormBuilder/components/FormField.js +218 -0
- package/dist/fe/components/FormBuilder/hooks/useFormBuilder.js +152 -0
- package/dist/fe/components/FormBuilder/index.js +4 -0
- package/dist/fe/components/FormBuilder/theme/index.js +134 -0
- package/dist/fe/components/FormBuilder/types/index.js +1 -0
- package/dist/fe/components/FormBuilder/utils/cn.js +5 -0
- package/dist/fe/components/FormBuilder/utils/fieldMapping.js +216 -0
- package/dist/fe/components/FormBuilder/utils/validation.js +78 -0
- package/dist/fe/components/LoginPage/components/LoginForm.js +214 -0
- package/dist/fe/components/LoginPage/components/LoginHeader.js +24 -0
- package/dist/fe/components/LoginPage/components/LoginPage.js +138 -0
- package/dist/fe/components/LoginPage/index.js +5 -0
- package/dist/fe/components/LoginPage/store/index.js +59 -0
- package/dist/fe/components/LoginPage/theme/index.js +98 -0
- package/dist/fe/components/LoginPage/types/index.js +1 -0
- package/dist/fe/components/MagicLinkVerifyPage/components/MagicLinkVerifyPage.js +200 -0
- package/dist/fe/components/MagicLinkVerifyPage/index.js +3 -0
- package/dist/fe/components/MagicLinkVerifyPage/store.js +20 -0
- package/dist/fe/components/MagicLinkVerifyPage/theme.js +36 -0
- package/dist/fe/components/MagicLinkVerifyPage/types.js +1 -0
- package/dist/fe/components/NucleusEntityShowcase.js +1409 -0
- package/dist/fe/components/NucleusTextInput/components/FloatingLabel.js +56 -0
- package/dist/fe/components/NucleusTextInput/components/InputIcons.js +258 -0
- package/dist/fe/components/NucleusTextInput/components/NucleusTextInput.js +321 -0
- package/dist/fe/components/NucleusTextInput/components/PasswordStrengthIndicator.js +104 -0
- package/dist/fe/components/NucleusTextInput/components/TypewriterText.js +56 -0
- package/dist/fe/components/NucleusTextInput/index.js +7 -0
- package/dist/fe/components/NucleusTextInput/theme/index.js +121 -0
- package/dist/fe/components/NucleusTextInput/types/index.js +1 -0
- package/dist/fe/components/NucleusTextInput/utils/cn.js +5 -0
- package/dist/fe/components/NucleusTextInput/utils/format.js +62 -0
- package/dist/fe/components/NucleusTextInput/utils/validation.js +191 -0
- package/dist/fe/components/ProfilePage/components/AddressCard.js +196 -0
- package/dist/fe/components/ProfilePage/components/PhoneCard.js +206 -0
- package/dist/fe/components/ProfilePage/components/ProfileHeader.js +150 -0
- package/dist/fe/components/ProfilePage/components/ProfilePage.js +1336 -0
- package/dist/fe/components/ProfilePage/index.js +6 -0
- package/dist/fe/components/ProfilePage/store/index.js +115 -0
- package/dist/fe/components/ProfilePage/theme/index.js +168 -0
- package/dist/fe/components/ProfilePage/types/index.js +1 -0
- package/dist/fe/components/RangePicker/components/RangePicker.js +338 -0
- package/dist/fe/components/RangePicker/components/RangeThumb.js +68 -0
- package/dist/fe/components/RangePicker/components/RangeTooltip.js +45 -0
- package/dist/fe/components/RangePicker/components/RangeTrack.js +32 -0
- package/dist/fe/components/RangePicker/index.js +5 -0
- package/dist/fe/components/RangePicker/theme/index.js +88 -0
- package/dist/fe/components/RangePicker/types/index.js +1 -0
- package/dist/fe/components/RangePicker/utils/cn.js +3 -0
- package/dist/fe/components/RegisterPage/components/PasswordStrengthIndicator.js +107 -0
- package/dist/fe/components/RegisterPage/components/RegisterForm.js +322 -0
- package/dist/fe/components/RegisterPage/components/RegisterHeader.js +23 -0
- package/dist/fe/components/RegisterPage/components/RegisterPage.js +85 -0
- package/dist/fe/components/RegisterPage/index.js +6 -0
- package/dist/fe/components/RegisterPage/store/index.js +106 -0
- package/dist/fe/components/RegisterPage/theme/index.js +128 -0
- package/dist/fe/components/RegisterPage/types/index.js +1 -0
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordForm.js +347 -0
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordHeader.js +42 -0
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordPage.js +61 -0
- package/dist/fe/components/ResetPasswordPage/index.js +5 -0
- package/dist/fe/components/ResetPasswordPage/store/index.js +36 -0
- package/dist/fe/components/ResetPasswordPage/theme/index.js +99 -0
- package/dist/fe/components/ResetPasswordPage/types/index.js +1 -0
- package/dist/fe/components/SearchBox/components/SearchBox.js +271 -0
- package/dist/fe/components/SearchBox/components/SearchBoxDropdown.js +87 -0
- package/dist/fe/components/SearchBox/index.js +5 -0
- package/dist/fe/components/SearchBox/theme/index.js +184 -0
- package/dist/fe/components/SearchBox/types/index.js +1 -0
- package/dist/fe/components/SearchBox/utils/cn.js +5 -0
- package/dist/fe/components/SearchBox/utils/debounce.js +22 -0
- package/dist/fe/components/SearchBox/utils/sanitize.js +48 -0
- package/dist/fe/components/SelectBox/components/SelectBox.js +364 -0
- package/dist/fe/components/SelectBox/components/SelectDropdown.js +92 -0
- package/dist/fe/components/SelectBox/components/SelectOptionItem.js +43 -0
- package/dist/fe/components/SelectBox/components/SelectTrigger.js +22 -0
- package/dist/fe/components/SelectBox/index.js +5 -0
- package/dist/fe/components/SelectBox/theme/index.js +98 -0
- package/dist/fe/components/SelectBox/types/index.js +1 -0
- package/dist/fe/components/SelectBox/utils/cn.js +3 -0
- package/dist/fe/components/SetPasswordPage/components/PasswordStrengthIndicator.js +107 -0
- package/dist/fe/components/SetPasswordPage/components/SetPasswordForm.js +142 -0
- package/dist/fe/components/SetPasswordPage/components/SetPasswordHeader.js +23 -0
- package/dist/fe/components/SetPasswordPage/components/SetPasswordPage.js +263 -0
- package/dist/fe/components/SetPasswordPage/index.js +7 -0
- package/dist/fe/components/SetPasswordPage/store/index.js +79 -0
- package/dist/fe/components/SetPasswordPage/theme/index.js +98 -0
- package/dist/fe/components/SetPasswordPage/types/index.js +12 -0
- package/dist/fe/components/UsersPage/components/InviteUserModal.js +262 -0
- package/dist/fe/components/UsersPage/components/Pagination.js +147 -0
- package/dist/fe/components/UsersPage/components/RoleAssignmentModal.js +186 -0
- package/dist/fe/components/UsersPage/components/StatsCards.js +124 -0
- package/dist/fe/components/UsersPage/components/UserDetailDrawer.js +444 -0
- package/dist/fe/components/UsersPage/components/UserFilters.js +142 -0
- package/dist/fe/components/UsersPage/components/UserListItem.js +125 -0
- package/dist/fe/components/UsersPage/components/UserListSkeleton.js +40 -0
- package/dist/fe/components/UsersPage/components/UsersPage.js +556 -0
- package/dist/fe/components/UsersPage/index.js +10 -0
- package/dist/fe/components/UsersPage/store/index.js +151 -0
- package/dist/fe/components/UsersPage/theme/index.js +231 -0
- package/dist/fe/components/UsersPage/types/index.js +1 -0
- package/dist/fe/components/VerifyEmailPage/components/VerifyEmailPage.js +290 -0
- package/dist/fe/components/VerifyEmailPage/index.js +3 -0
- package/dist/fe/components/VerifyEmailPage/store/index.js +45 -0
- package/dist/fe/components/VerifyEmailPage/theme/index.js +52 -0
- package/dist/fe/components/VerifyEmailPage/types/index.js +1 -0
- package/dist/fe/hooks/useNucleusEntity.js +247 -0
- package/dist/fe/index.js +28 -110
- package/dist/fe/types/index.js +1 -0
- package/dist/fe/utils/cn.js +5 -0
- package/dist/fe/utils/columnUtils.js +189 -0
- package/dist/fe/utils/endpointKeys.js +44 -0
- package/dist/index.js +1 -1
- package/dist/nucleus.config.d.ts +3 -0
- package/dist/src/Client/Proxy/httpProxy.js +1 -0
- package/dist/src/Client/Proxy/index.js +1 -1
- package/dist/src/Client/Proxy/server.js +1 -0
- package/dist/src/Client/Proxy/types.js +1 -0
- package/dist/src/Client/Proxy/utils.js +1 -0
- package/dist/src/Client/Proxy/wsProxy.js +1 -0
- package/package.json +1 -1
- package/scripts/build.ts +78 -8
- package/dist/dist/index-0yyw12k6.d.ts +0 -8
- package/dist/dist/index-tv67j5qd.d.ts +0 -488
- package/dist/index-0yyw12k6.js +0 -1
- package/dist/index-tv67j5qd.js +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { AddressCard } from "./components/AddressCard";
|
|
2
|
+
export { PhoneCard } from "./components/PhoneCard";
|
|
3
|
+
export { ProfileHeader } from "./components/ProfileHeader";
|
|
4
|
+
export { ProfilePage } from "./components/ProfilePage";
|
|
5
|
+
export { useProfileStore } from "./store";
|
|
6
|
+
export { extendProfilePageTheme, profilePageTheme } from "./theme";
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { batch, createStore } from "h-state";
|
|
3
|
+
const initialState = {
|
|
4
|
+
user: null,
|
|
5
|
+
profile: null,
|
|
6
|
+
addresses: [],
|
|
7
|
+
phones: [],
|
|
8
|
+
files: [],
|
|
9
|
+
roles: [],
|
|
10
|
+
profilePicture: null,
|
|
11
|
+
isEditingProfile: false
|
|
12
|
+
};
|
|
13
|
+
export const { useStore: useProfileStore } = createStore(initialState, {
|
|
14
|
+
setUser: (store)=>(user)=>{
|
|
15
|
+
store.user = user;
|
|
16
|
+
},
|
|
17
|
+
setProfile: (store)=>(profile)=>{
|
|
18
|
+
if (profile === null) {
|
|
19
|
+
store.profile = null;
|
|
20
|
+
} else if (store.profile) {
|
|
21
|
+
store.profile = {
|
|
22
|
+
...store.profile,
|
|
23
|
+
...profile
|
|
24
|
+
};
|
|
25
|
+
} else {
|
|
26
|
+
store.profile = profile;
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
setAddresses: (store)=>(addresses)=>{
|
|
30
|
+
store.addresses = addresses;
|
|
31
|
+
},
|
|
32
|
+
setPhones: (store)=>(phones)=>{
|
|
33
|
+
store.phones = phones;
|
|
34
|
+
},
|
|
35
|
+
setFiles: (store)=>(files)=>{
|
|
36
|
+
store.files = files;
|
|
37
|
+
},
|
|
38
|
+
setRoles: (store)=>(roles)=>{
|
|
39
|
+
store.roles = roles;
|
|
40
|
+
},
|
|
41
|
+
setProfilePicture: (store)=>(file)=>{
|
|
42
|
+
store.profilePicture = file;
|
|
43
|
+
},
|
|
44
|
+
setEditingProfile: (store)=>(value)=>{
|
|
45
|
+
store.isEditingProfile = value;
|
|
46
|
+
},
|
|
47
|
+
addAddress: (store)=>(address)=>{
|
|
48
|
+
store.addresses = [
|
|
49
|
+
...store.addresses,
|
|
50
|
+
address
|
|
51
|
+
];
|
|
52
|
+
},
|
|
53
|
+
updateAddress: (store)=>(address)=>{
|
|
54
|
+
store.addresses = store.addresses.map((a)=>a.id === address.id ? {
|
|
55
|
+
...a,
|
|
56
|
+
...address
|
|
57
|
+
} : a);
|
|
58
|
+
},
|
|
59
|
+
removeAddress: (store)=>(addressId)=>{
|
|
60
|
+
store.addresses = store.addresses.filter((a)=>a.id !== addressId);
|
|
61
|
+
},
|
|
62
|
+
addPhone: (store)=>(phone)=>{
|
|
63
|
+
store.phones = [
|
|
64
|
+
...store.phones,
|
|
65
|
+
phone
|
|
66
|
+
];
|
|
67
|
+
},
|
|
68
|
+
updatePhone: (store)=>(phone)=>{
|
|
69
|
+
store.phones = store.phones.map((p)=>p.id === phone.id ? {
|
|
70
|
+
...p,
|
|
71
|
+
...phone
|
|
72
|
+
} : p);
|
|
73
|
+
},
|
|
74
|
+
removePhone: (store)=>(phoneId)=>{
|
|
75
|
+
store.phones = store.phones.filter((p)=>p.id !== phoneId);
|
|
76
|
+
},
|
|
77
|
+
addFile: (store)=>(file)=>{
|
|
78
|
+
store.files = [
|
|
79
|
+
...store.files,
|
|
80
|
+
file
|
|
81
|
+
];
|
|
82
|
+
if (file.type === "profile_picture") {
|
|
83
|
+
const profilePics = store.files.filter((f)=>f.type === "profile_picture");
|
|
84
|
+
const latest = profilePics.sort((a, b)=>new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime())[0];
|
|
85
|
+
store.profilePicture = latest || file;
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
updateFile: (store)=>(file)=>{
|
|
89
|
+
store.files = store.files.map((f)=>f.id === file.id ? file : f);
|
|
90
|
+
if (file.type === "profile_picture") {
|
|
91
|
+
store.profilePicture = file;
|
|
92
|
+
} else if (store.profilePicture?.id === file.id) {
|
|
93
|
+
store.profilePicture = null;
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
removeFile: (store)=>(fileId)=>{
|
|
97
|
+
const file = store.files.find((f)=>f.id === fileId);
|
|
98
|
+
store.files = store.files.filter((f)=>f.id !== fileId);
|
|
99
|
+
if (file?.type === "profile_picture" && store.profilePicture?.id === fileId) {
|
|
100
|
+
store.profilePicture = null;
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
reset: (store)=>()=>{
|
|
104
|
+
batch(()=>{
|
|
105
|
+
store.user = null;
|
|
106
|
+
store.profile = null;
|
|
107
|
+
store.addresses = [];
|
|
108
|
+
store.phones = [];
|
|
109
|
+
store.files = [];
|
|
110
|
+
store.roles = [];
|
|
111
|
+
store.profilePicture = null;
|
|
112
|
+
store.isEditingProfile = false;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
export const profilePageTheme = {
|
|
2
|
+
container: {
|
|
3
|
+
base: "relative min-h-screen w-full",
|
|
4
|
+
wrapper: "relative z-10 w-full max-w-4xl mx-auto px-4 py-6 sm:px-6 sm:py-8 lg:px-8"
|
|
5
|
+
},
|
|
6
|
+
card: {
|
|
7
|
+
base: "w-full",
|
|
8
|
+
padding: "p-4 sm:p-6 lg:p-8",
|
|
9
|
+
background: "bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",
|
|
10
|
+
border: "border border-white/20 dark:border-zinc-800/50",
|
|
11
|
+
shadow: "shadow-xl shadow-black/5 dark:shadow-black/20",
|
|
12
|
+
rounded: "rounded-xl sm:rounded-2xl"
|
|
13
|
+
},
|
|
14
|
+
header: {
|
|
15
|
+
container: "flex flex-col sm:flex-row items-center sm:items-start gap-4 sm:gap-6 pb-6 border-b border-zinc-200 dark:border-zinc-700/50",
|
|
16
|
+
avatar: {
|
|
17
|
+
wrapper: "relative flex-shrink-0",
|
|
18
|
+
image: "w-20 h-20 sm:w-24 sm:h-24 rounded-full object-cover ring-4 ring-white dark:ring-zinc-800 shadow-lg",
|
|
19
|
+
placeholder: "w-20 h-20 sm:w-24 sm:h-24 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center text-white text-2xl sm:text-3xl font-bold ring-4 ring-white dark:ring-zinc-800 shadow-lg",
|
|
20
|
+
uploadButton: "absolute -bottom-1 -right-1 p-1.5 sm:p-2 bg-white dark:bg-zinc-800 rounded-full shadow-md border border-zinc-200 dark:border-zinc-700 hover:bg-zinc-50 dark:hover:bg-zinc-700 transition-colors cursor-pointer"
|
|
21
|
+
},
|
|
22
|
+
info: {
|
|
23
|
+
container: "flex-1 text-center sm:text-left",
|
|
24
|
+
name: "text-xl sm:text-2xl font-bold text-zinc-900 dark:text-white",
|
|
25
|
+
email: "text-sm sm:text-base text-zinc-600 dark:text-zinc-400 mt-1",
|
|
26
|
+
meta: "flex flex-wrap justify-center sm:justify-start gap-3 sm:gap-4 mt-3 text-xs sm:text-sm text-zinc-500 dark:text-zinc-400"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
section: {
|
|
30
|
+
container: "mt-6 sm:mt-8",
|
|
31
|
+
title: "text-base sm:text-lg font-semibold text-zinc-900 dark:text-white",
|
|
32
|
+
titleWrapper: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-4 mb-4",
|
|
33
|
+
addButton: "text-xs sm:text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors",
|
|
34
|
+
content: "space-y-3 sm:space-y-4",
|
|
35
|
+
empty: {
|
|
36
|
+
container: "flex flex-col items-center justify-center py-8 sm:py-12 text-center bg-zinc-50 dark:bg-zinc-800/30 rounded-xl",
|
|
37
|
+
icon: "w-10 h-10 sm:w-12 sm:h-12 text-zinc-300 dark:text-zinc-600 mb-3",
|
|
38
|
+
text: "text-sm text-zinc-500 dark:text-zinc-400"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
profileForm: {
|
|
42
|
+
container: "mt-4 sm:mt-6",
|
|
43
|
+
grid: "grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",
|
|
44
|
+
field: {
|
|
45
|
+
container: "space-y-1 sm:space-y-1.5",
|
|
46
|
+
label: "block text-xs sm:text-sm font-medium text-zinc-700 dark:text-zinc-300",
|
|
47
|
+
input: "w-full px-3 py-2 text-sm rounded-lg border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-800 text-zinc-900 dark:text-white placeholder-zinc-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all",
|
|
48
|
+
error: "text-xs text-red-500 mt-1"
|
|
49
|
+
},
|
|
50
|
+
actions: "flex flex-col-reverse sm:flex-row justify-end gap-2 sm:gap-3 mt-4 sm:mt-6"
|
|
51
|
+
},
|
|
52
|
+
itemCard: {
|
|
53
|
+
base: "group relative transition-all duration-200",
|
|
54
|
+
padding: "p-3 sm:p-4",
|
|
55
|
+
background: "bg-white dark:bg-zinc-800/60",
|
|
56
|
+
border: "border border-zinc-200 dark:border-zinc-700/50",
|
|
57
|
+
rounded: "rounded-lg sm:rounded-xl",
|
|
58
|
+
hover: "hover:shadow-md hover:border-zinc-300 dark:hover:border-zinc-600",
|
|
59
|
+
header: {
|
|
60
|
+
container: "flex items-start gap-3",
|
|
61
|
+
icon: "flex-shrink-0 w-8 h-8 sm:w-10 sm:h-10 rounded-lg bg-zinc-100 dark:bg-zinc-700 flex items-center justify-center text-zinc-500 dark:text-zinc-400",
|
|
62
|
+
title: "font-medium text-sm sm:text-base text-zinc-900 dark:text-white",
|
|
63
|
+
subtitle: "text-xs sm:text-sm text-zinc-500 dark:text-zinc-400 mt-0.5",
|
|
64
|
+
actions: "flex items-center gap-1 sm:gap-2 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"
|
|
65
|
+
},
|
|
66
|
+
details: {
|
|
67
|
+
container: "mt-2 sm:mt-3 space-y-1 sm:space-y-1.5 text-xs sm:text-sm",
|
|
68
|
+
row: "flex items-center justify-between",
|
|
69
|
+
label: "text-zinc-500 dark:text-zinc-400",
|
|
70
|
+
value: "text-zinc-700 dark:text-zinc-300 truncate ml-2 text-right"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
modal: {
|
|
74
|
+
overlay: "fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",
|
|
75
|
+
container: "bg-white dark:bg-zinc-800 rounded-xl sm:rounded-2xl shadow-2xl max-w-md w-full p-4 sm:p-6 max-h-[90vh] overflow-y-auto",
|
|
76
|
+
title: "text-base sm:text-lg font-semibold text-zinc-900 dark:text-white mb-4",
|
|
77
|
+
form: "space-y-3 sm:space-y-4",
|
|
78
|
+
actions: "flex flex-col-reverse sm:flex-row gap-2 sm:gap-3 justify-end mt-4 sm:mt-6"
|
|
79
|
+
},
|
|
80
|
+
loading: {
|
|
81
|
+
container: "flex flex-col items-center justify-center py-12 sm:py-16",
|
|
82
|
+
spinner: "w-8 h-8 border-2 border-zinc-200 border-t-blue-600 rounded-full animate-spin",
|
|
83
|
+
text: "mt-3 sm:mt-4 text-sm text-zinc-500 dark:text-zinc-400"
|
|
84
|
+
},
|
|
85
|
+
error: {
|
|
86
|
+
container: "p-3 sm:p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",
|
|
87
|
+
text: "text-xs sm:text-sm text-red-600 dark:text-red-400"
|
|
88
|
+
},
|
|
89
|
+
accountSettings: {
|
|
90
|
+
container: "space-y-2",
|
|
91
|
+
item: "w-full flex items-center justify-between p-3 rounded-lg border border-zinc-200 dark:border-zinc-700 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors text-left",
|
|
92
|
+
iconWrapper: "w-10 h-10 rounded-full flex items-center justify-center",
|
|
93
|
+
content: "flex items-center gap-3",
|
|
94
|
+
title: "text-sm font-medium text-zinc-900 dark:text-white",
|
|
95
|
+
description: "text-xs text-zinc-500 dark:text-zinc-400",
|
|
96
|
+
arrow: "w-5 h-5 text-zinc-400"
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
export function extendProfilePageTheme(overrides) {
|
|
100
|
+
return {
|
|
101
|
+
...profilePageTheme,
|
|
102
|
+
...overrides,
|
|
103
|
+
container: {
|
|
104
|
+
...profilePageTheme.container,
|
|
105
|
+
...overrides.container
|
|
106
|
+
},
|
|
107
|
+
card: {
|
|
108
|
+
...profilePageTheme.card,
|
|
109
|
+
...overrides.card
|
|
110
|
+
},
|
|
111
|
+
header: {
|
|
112
|
+
...profilePageTheme.header,
|
|
113
|
+
...overrides.header,
|
|
114
|
+
avatar: {
|
|
115
|
+
...profilePageTheme.header.avatar,
|
|
116
|
+
...overrides.header?.avatar
|
|
117
|
+
},
|
|
118
|
+
info: {
|
|
119
|
+
...profilePageTheme.header.info,
|
|
120
|
+
...overrides.header?.info
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
section: {
|
|
124
|
+
...profilePageTheme.section,
|
|
125
|
+
...overrides.section,
|
|
126
|
+
empty: {
|
|
127
|
+
...profilePageTheme.section.empty,
|
|
128
|
+
...overrides.section?.empty
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
profileForm: {
|
|
132
|
+
...profilePageTheme.profileForm,
|
|
133
|
+
...overrides.profileForm,
|
|
134
|
+
field: {
|
|
135
|
+
...profilePageTheme.profileForm.field,
|
|
136
|
+
...overrides.profileForm?.field
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
itemCard: {
|
|
140
|
+
...profilePageTheme.itemCard,
|
|
141
|
+
...overrides.itemCard,
|
|
142
|
+
header: {
|
|
143
|
+
...profilePageTheme.itemCard.header,
|
|
144
|
+
...overrides.itemCard?.header
|
|
145
|
+
},
|
|
146
|
+
details: {
|
|
147
|
+
...profilePageTheme.itemCard.details,
|
|
148
|
+
...overrides.itemCard?.details
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
modal: {
|
|
152
|
+
...profilePageTheme.modal,
|
|
153
|
+
...overrides.modal
|
|
154
|
+
},
|
|
155
|
+
loading: {
|
|
156
|
+
...profilePageTheme.loading,
|
|
157
|
+
...overrides.loading
|
|
158
|
+
},
|
|
159
|
+
error: {
|
|
160
|
+
...profilePageTheme.error,
|
|
161
|
+
...overrides.error
|
|
162
|
+
},
|
|
163
|
+
accountSettings: {
|
|
164
|
+
...profilePageTheme.accountSettings,
|
|
165
|
+
...overrides.accountSettings
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useGSAP } from "@gsap/react";
|
|
4
|
+
import gsap from "gsap";
|
|
5
|
+
import { useEffect, useRef, useState } from "react";
|
|
6
|
+
import { rangePickerTheme } from "../theme";
|
|
7
|
+
import { cn } from "../utils/cn";
|
|
8
|
+
import { RangeTrack } from "./RangeTrack";
|
|
9
|
+
gsap.registerPlugin(useGSAP);
|
|
10
|
+
const clamp = (value, min, max)=>Math.min(Math.max(value, min), max);
|
|
11
|
+
const snapToStep = (value, step, min)=>{
|
|
12
|
+
const steps = Math.round((value - min) / step);
|
|
13
|
+
return min + steps * step;
|
|
14
|
+
};
|
|
15
|
+
export function RangePicker({ value: controlledValue, defaultValue, min = 0, max = 100, step = 1, minRange = 0, disabled = false, readOnly = false, size = "md", variant = "default", orientation = "horizontal", showTooltip = false, showLabels = false, showTicks = false, tickCount = 5, debounceMs = 0, formatValue, onChange, onChangeCommit, label, minLabel, maxLabel, ariaLabel, ariaLabelMin, ariaLabelMax, className, ...props }) {
|
|
16
|
+
const theme = rangePickerTheme;
|
|
17
|
+
const containerRef = useRef(null);
|
|
18
|
+
const trackRef = useRef(null);
|
|
19
|
+
const minThumbRef = useRef(null);
|
|
20
|
+
const maxThumbRef = useRef(null);
|
|
21
|
+
const [internalValue, setInternalValue] = useState(defaultValue || {
|
|
22
|
+
min: min + (max - min) * 0.25,
|
|
23
|
+
max: min + (max - min) * 0.75
|
|
24
|
+
});
|
|
25
|
+
const [activeThumb, setActiveThumb] = useState(null);
|
|
26
|
+
const [isHovering, setIsHovering] = useState(null);
|
|
27
|
+
useGSAP(()=>{
|
|
28
|
+
if (minThumbRef.current) {
|
|
29
|
+
gsap.to(minThumbRef.current, {
|
|
30
|
+
scale: activeThumb === "min" ? 1.3 : isHovering === "min" ? 1.15 : 1,
|
|
31
|
+
duration: 0.2,
|
|
32
|
+
ease: activeThumb === "min" ? "power2.out" : "elastic.out(1, 0.4)"
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}, [
|
|
36
|
+
activeThumb,
|
|
37
|
+
isHovering
|
|
38
|
+
]);
|
|
39
|
+
useGSAP(()=>{
|
|
40
|
+
if (maxThumbRef.current) {
|
|
41
|
+
gsap.to(maxThumbRef.current, {
|
|
42
|
+
scale: activeThumb === "max" ? 1.3 : isHovering === "max" ? 1.15 : 1,
|
|
43
|
+
duration: 0.2,
|
|
44
|
+
ease: activeThumb === "max" ? "power2.out" : "elastic.out(1, 0.4)"
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}, [
|
|
48
|
+
activeThumb,
|
|
49
|
+
isHovering
|
|
50
|
+
]);
|
|
51
|
+
const value = controlledValue ?? internalValue;
|
|
52
|
+
const isControlled = controlledValue !== undefined;
|
|
53
|
+
const updateValue = (newValue)=>{
|
|
54
|
+
if (readOnly) return;
|
|
55
|
+
const clampedMin = clamp(snapToStep(newValue.min, step, min), min, newValue.max - minRange);
|
|
56
|
+
const clampedMax = clamp(snapToStep(newValue.max, step, min), newValue.min + minRange, max);
|
|
57
|
+
const finalValue = {
|
|
58
|
+
min: clampedMin,
|
|
59
|
+
max: clampedMax
|
|
60
|
+
};
|
|
61
|
+
if (!isControlled) {
|
|
62
|
+
setInternalValue(finalValue);
|
|
63
|
+
}
|
|
64
|
+
onChange?.(finalValue);
|
|
65
|
+
};
|
|
66
|
+
const getValueFromPosition = (clientX, clientY)=>{
|
|
67
|
+
if (!trackRef.current) return min;
|
|
68
|
+
const rect = trackRef.current.getBoundingClientRect();
|
|
69
|
+
const isHorizontal = orientation === "horizontal";
|
|
70
|
+
let percent;
|
|
71
|
+
if (isHorizontal) {
|
|
72
|
+
percent = (clientX - rect.left) / rect.width;
|
|
73
|
+
} else {
|
|
74
|
+
percent = 1 - (clientY - rect.top) / rect.height;
|
|
75
|
+
}
|
|
76
|
+
percent = clamp(percent, 0, 1);
|
|
77
|
+
return min + percent * (max - min);
|
|
78
|
+
};
|
|
79
|
+
const handleTrackClick = (e)=>{
|
|
80
|
+
if (disabled || readOnly) return;
|
|
81
|
+
const clickValue = getValueFromPosition(e.clientX, e.clientY);
|
|
82
|
+
const distToMin = Math.abs(clickValue - value.min);
|
|
83
|
+
const distToMax = Math.abs(clickValue - value.max);
|
|
84
|
+
if (distToMin <= distToMax) {
|
|
85
|
+
updateValue({
|
|
86
|
+
...value,
|
|
87
|
+
min: clickValue
|
|
88
|
+
});
|
|
89
|
+
} else {
|
|
90
|
+
updateValue({
|
|
91
|
+
...value,
|
|
92
|
+
max: clickValue
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const debounceRef = useRef(null);
|
|
97
|
+
const handleDragStart = (thumb)=>{
|
|
98
|
+
if (disabled || readOnly) return;
|
|
99
|
+
setActiveThumb(thumb);
|
|
100
|
+
};
|
|
101
|
+
const handleDragEnd = ()=>{
|
|
102
|
+
if (activeThumb) {
|
|
103
|
+
setActiveThumb(null);
|
|
104
|
+
if (debounceMs > 0) {
|
|
105
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
106
|
+
debounceRef.current = setTimeout(()=>{
|
|
107
|
+
onChangeCommit?.(value);
|
|
108
|
+
}, debounceMs);
|
|
109
|
+
} else {
|
|
110
|
+
onChangeCommit?.(value);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
useEffect(()=>{
|
|
115
|
+
if (!activeThumb) return;
|
|
116
|
+
const handleMove = (e)=>{
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
const clientX = "touches" in e ? e.touches[0]?.clientX ?? 0 : e.clientX;
|
|
119
|
+
const clientY = "touches" in e ? e.touches[0]?.clientY ?? 0 : e.clientY;
|
|
120
|
+
const newValue = getValueFromPosition(clientX, clientY);
|
|
121
|
+
if (activeThumb === "min") {
|
|
122
|
+
updateValue({
|
|
123
|
+
...value,
|
|
124
|
+
min: Math.min(newValue, value.max - minRange)
|
|
125
|
+
});
|
|
126
|
+
} else {
|
|
127
|
+
updateValue({
|
|
128
|
+
...value,
|
|
129
|
+
max: Math.max(newValue, value.min + minRange)
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const handleUp = ()=>{
|
|
134
|
+
handleDragEnd();
|
|
135
|
+
};
|
|
136
|
+
document.addEventListener("mousemove", handleMove);
|
|
137
|
+
document.addEventListener("mouseup", handleUp);
|
|
138
|
+
document.addEventListener("touchmove", handleMove, {
|
|
139
|
+
passive: false
|
|
140
|
+
});
|
|
141
|
+
document.addEventListener("touchend", handleUp);
|
|
142
|
+
return ()=>{
|
|
143
|
+
document.removeEventListener("mousemove", handleMove);
|
|
144
|
+
document.removeEventListener("mouseup", handleUp);
|
|
145
|
+
document.removeEventListener("touchmove", handleMove);
|
|
146
|
+
document.removeEventListener("touchend", handleUp);
|
|
147
|
+
};
|
|
148
|
+
}, [
|
|
149
|
+
activeThumb,
|
|
150
|
+
value,
|
|
151
|
+
min,
|
|
152
|
+
max,
|
|
153
|
+
minRange
|
|
154
|
+
]);
|
|
155
|
+
const handleKeyDown = (e, thumb)=>{
|
|
156
|
+
if (disabled || readOnly) return;
|
|
157
|
+
const currentValue = thumb === "min" ? value.min : value.max;
|
|
158
|
+
let newValue = currentValue;
|
|
159
|
+
switch(e.key){
|
|
160
|
+
case "ArrowRight":
|
|
161
|
+
case "ArrowUp":
|
|
162
|
+
newValue = currentValue + step;
|
|
163
|
+
break;
|
|
164
|
+
case "ArrowLeft":
|
|
165
|
+
case "ArrowDown":
|
|
166
|
+
newValue = currentValue - step;
|
|
167
|
+
break;
|
|
168
|
+
case "PageUp":
|
|
169
|
+
newValue = currentValue + step * 10;
|
|
170
|
+
break;
|
|
171
|
+
case "PageDown":
|
|
172
|
+
newValue = currentValue - step * 10;
|
|
173
|
+
break;
|
|
174
|
+
case "Home":
|
|
175
|
+
newValue = min;
|
|
176
|
+
break;
|
|
177
|
+
case "End":
|
|
178
|
+
newValue = max;
|
|
179
|
+
break;
|
|
180
|
+
default:
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
e.preventDefault();
|
|
184
|
+
if (thumb === "min") {
|
|
185
|
+
updateValue({
|
|
186
|
+
...value,
|
|
187
|
+
min: newValue
|
|
188
|
+
});
|
|
189
|
+
} else {
|
|
190
|
+
updateValue({
|
|
191
|
+
...value,
|
|
192
|
+
max: newValue
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
const minPercent = (value.min - min) / (max - min) * 100;
|
|
197
|
+
const maxPercent = (value.max - min) / (max - min) * 100;
|
|
198
|
+
const showMinTooltip = showTooltip && (activeThumb === "min" || isHovering === "min");
|
|
199
|
+
const showMaxTooltip = showTooltip && (activeThumb === "max" || isHovering === "max");
|
|
200
|
+
const ticks = showTicks ? Array.from({
|
|
201
|
+
length: tickCount
|
|
202
|
+
}, (_, i)=>min + i / (tickCount - 1) * (max - min)) : [];
|
|
203
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
204
|
+
ref: containerRef,
|
|
205
|
+
className: cn(theme.container.base, theme.container.orientation[orientation], disabled && theme.container.disabled, className),
|
|
206
|
+
...props,
|
|
207
|
+
children: [
|
|
208
|
+
label && /*#__PURE__*/ _jsx("span", {
|
|
209
|
+
className: cn(theme.label.base, theme.label.size[size]),
|
|
210
|
+
id: `${props.id || "range"}-label`,
|
|
211
|
+
children: label
|
|
212
|
+
}),
|
|
213
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
214
|
+
ref: trackRef,
|
|
215
|
+
className: "relative",
|
|
216
|
+
onClick: handleTrackClick,
|
|
217
|
+
"aria-hidden": "true",
|
|
218
|
+
children: [
|
|
219
|
+
/*#__PURE__*/ _jsx(RangeTrack, {
|
|
220
|
+
min: min,
|
|
221
|
+
max: max,
|
|
222
|
+
value: value,
|
|
223
|
+
size: size,
|
|
224
|
+
variant: variant,
|
|
225
|
+
orientation: orientation,
|
|
226
|
+
disabled: disabled
|
|
227
|
+
}),
|
|
228
|
+
/*#__PURE__*/ _jsx("div", {
|
|
229
|
+
ref: minThumbRef,
|
|
230
|
+
role: "slider",
|
|
231
|
+
tabIndex: disabled ? -1 : 0,
|
|
232
|
+
"aria-label": ariaLabelMin || ariaLabel || "Minimum value",
|
|
233
|
+
"aria-valuemin": min,
|
|
234
|
+
"aria-valuemax": value.max - minRange,
|
|
235
|
+
"aria-valuenow": value.min,
|
|
236
|
+
"aria-valuetext": formatValue ? formatValue(value.min) : String(value.min),
|
|
237
|
+
"aria-disabled": disabled,
|
|
238
|
+
"aria-orientation": orientation,
|
|
239
|
+
className: cn(theme.thumb.base, theme.thumb.size[size], theme.thumb.variant[variant], theme.thumb.shadow, !disabled && theme.thumb.states.hover, activeThumb === "min" && theme.thumb.states.active, disabled && theme.thumb.states.disabled),
|
|
240
|
+
style: {
|
|
241
|
+
left: `${minPercent}%`,
|
|
242
|
+
top: "50%",
|
|
243
|
+
transform: "translate(-50%, -50%)"
|
|
244
|
+
},
|
|
245
|
+
onMouseDown: (e)=>{
|
|
246
|
+
e.preventDefault();
|
|
247
|
+
e.stopPropagation();
|
|
248
|
+
handleDragStart("min");
|
|
249
|
+
},
|
|
250
|
+
onTouchStart: (e)=>{
|
|
251
|
+
e.stopPropagation();
|
|
252
|
+
handleDragStart("min");
|
|
253
|
+
},
|
|
254
|
+
onMouseEnter: ()=>setIsHovering("min"),
|
|
255
|
+
onMouseLeave: ()=>setIsHovering(null),
|
|
256
|
+
onKeyDown: (e)=>handleKeyDown(e, "min"),
|
|
257
|
+
onFocus: ()=>setIsHovering("min"),
|
|
258
|
+
onBlur: ()=>setIsHovering(null),
|
|
259
|
+
children: showMinTooltip && /*#__PURE__*/ _jsx("span", {
|
|
260
|
+
className: cn(theme.tooltip.base, theme.tooltip.size[size], theme.tooltip.arrow),
|
|
261
|
+
"aria-hidden": "true",
|
|
262
|
+
children: formatValue ? formatValue(value.min) : value.min
|
|
263
|
+
})
|
|
264
|
+
}),
|
|
265
|
+
/*#__PURE__*/ _jsx("div", {
|
|
266
|
+
ref: maxThumbRef,
|
|
267
|
+
role: "slider",
|
|
268
|
+
tabIndex: disabled ? -1 : 0,
|
|
269
|
+
"aria-label": ariaLabelMax || ariaLabel || "Maximum value",
|
|
270
|
+
"aria-valuemin": value.min + minRange,
|
|
271
|
+
"aria-valuemax": max,
|
|
272
|
+
"aria-valuenow": value.max,
|
|
273
|
+
"aria-valuetext": formatValue ? formatValue(value.max) : String(value.max),
|
|
274
|
+
"aria-disabled": disabled,
|
|
275
|
+
"aria-orientation": orientation,
|
|
276
|
+
className: cn(theme.thumb.base, theme.thumb.size[size], theme.thumb.variant[variant], theme.thumb.shadow, !disabled && theme.thumb.states.hover, activeThumb === "max" && theme.thumb.states.active, disabled && theme.thumb.states.disabled),
|
|
277
|
+
style: {
|
|
278
|
+
left: `${maxPercent}%`,
|
|
279
|
+
top: "50%",
|
|
280
|
+
transform: "translate(-50%, -50%)"
|
|
281
|
+
},
|
|
282
|
+
onMouseDown: (e)=>{
|
|
283
|
+
e.preventDefault();
|
|
284
|
+
e.stopPropagation();
|
|
285
|
+
handleDragStart("max");
|
|
286
|
+
},
|
|
287
|
+
onTouchStart: (e)=>{
|
|
288
|
+
e.stopPropagation();
|
|
289
|
+
handleDragStart("max");
|
|
290
|
+
},
|
|
291
|
+
onMouseEnter: ()=>setIsHovering("max"),
|
|
292
|
+
onMouseLeave: ()=>setIsHovering(null),
|
|
293
|
+
onKeyDown: (e)=>handleKeyDown(e, "max"),
|
|
294
|
+
onFocus: ()=>setIsHovering("max"),
|
|
295
|
+
onBlur: ()=>setIsHovering(null),
|
|
296
|
+
children: showMaxTooltip && /*#__PURE__*/ _jsx("span", {
|
|
297
|
+
className: cn(theme.tooltip.base, theme.tooltip.size[size], theme.tooltip.arrow),
|
|
298
|
+
"aria-hidden": "true",
|
|
299
|
+
children: formatValue ? formatValue(value.max) : value.max
|
|
300
|
+
})
|
|
301
|
+
})
|
|
302
|
+
]
|
|
303
|
+
}),
|
|
304
|
+
showTicks && /*#__PURE__*/ _jsx("div", {
|
|
305
|
+
className: theme.ticks.container,
|
|
306
|
+
style: {
|
|
307
|
+
top: "100%",
|
|
308
|
+
marginTop: "8px"
|
|
309
|
+
},
|
|
310
|
+
children: ticks.map((tick, i)=>/*#__PURE__*/ _jsxs("div", {
|
|
311
|
+
className: "flex flex-col items-center",
|
|
312
|
+
children: [
|
|
313
|
+
/*#__PURE__*/ _jsx("div", {
|
|
314
|
+
className: theme.ticks.tick
|
|
315
|
+
}),
|
|
316
|
+
/*#__PURE__*/ _jsx("span", {
|
|
317
|
+
className: theme.ticks.label,
|
|
318
|
+
children: formatValue ? formatValue(tick) : tick
|
|
319
|
+
})
|
|
320
|
+
]
|
|
321
|
+
}, i))
|
|
322
|
+
}),
|
|
323
|
+
showLabels && /*#__PURE__*/ _jsxs("div", {
|
|
324
|
+
className: theme.labels.container,
|
|
325
|
+
children: [
|
|
326
|
+
/*#__PURE__*/ _jsx("span", {
|
|
327
|
+
className: theme.labels.label,
|
|
328
|
+
children: minLabel || (formatValue ? formatValue(min) : min)
|
|
329
|
+
}),
|
|
330
|
+
/*#__PURE__*/ _jsx("span", {
|
|
331
|
+
className: theme.labels.label,
|
|
332
|
+
children: maxLabel || (formatValue ? formatValue(max) : max)
|
|
333
|
+
})
|
|
334
|
+
]
|
|
335
|
+
})
|
|
336
|
+
]
|
|
337
|
+
});
|
|
338
|
+
}
|