@better-auth-ui/heroui 1.6.7 → 1.6.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.
- package/dist/components/auth/additional-field.d.ts +2 -2
- package/dist/components/auth/additional-field.js +133 -266
- package/dist/components/auth/api-key/api-key-skeleton.js +4 -20
- package/dist/components/auth/api-key/api-key.d.ts +6 -2
- package/dist/components/auth/api-key/api-key.js +16 -54
- package/dist/components/auth/api-key/api-keys-empty.d.ts +3 -1
- package/dist/components/auth/api-key/api-keys-empty.js +8 -34
- package/dist/components/auth/api-key/api-keys.d.ts +10 -2
- package/dist/components/auth/api-key/api-keys.js +21 -40
- package/dist/components/auth/api-key/create-api-key-dialog.d.ts +3 -1
- package/dist/components/auth/api-key/create-api-key-dialog.js +43 -73
- package/dist/components/auth/api-key/delete-api-key-dialog.d.ts +4 -2
- package/dist/components/auth/api-key/delete-api-key-dialog.js +16 -50
- package/dist/components/auth/api-key/new-api-key-dialog.js +23 -59
- package/dist/components/auth/api-key/organization-api-keys.d.ts +14 -0
- package/dist/components/auth/api-key/organization-api-keys.js +22 -0
- package/dist/components/auth/auth-provider.d.ts +1 -1
- package/dist/components/auth/auth-provider.js +10 -16
- package/dist/components/auth/auth.d.ts +3 -3
- package/dist/components/auth/auth.js +86 -61
- package/dist/components/auth/delete-user/danger-zone.d.ts +3 -3
- package/dist/components/auth/delete-user/danger-zone.js +11 -17
- package/dist/components/auth/delete-user/delete-account.d.ts +9 -0
- package/dist/components/auth/delete-user/delete-account.js +50 -0
- package/dist/components/auth/email/email-changed-email.d.ts +2 -2
- package/dist/components/auth/email/email-changed-email.js +22 -29
- package/dist/components/auth/email/email-verification-email.d.ts +2 -2
- package/dist/components/auth/email/email-verification-email.js +22 -29
- package/dist/components/auth/email/magic-link-email.d.ts +2 -2
- package/dist/components/auth/email/magic-link-email.js +22 -29
- package/dist/components/auth/email/new-device-email.d.ts +2 -2
- package/dist/components/auth/email/new-device-email.js +22 -29
- package/dist/components/auth/email/organization-invitation-email.d.ts +3 -0
- package/dist/components/auth/email/organization-invitation-email.js +23 -0
- package/dist/components/auth/email/otp-email.d.ts +2 -2
- package/dist/components/auth/email/otp-email.js +21 -28
- package/dist/components/auth/email/password-changed-email.d.ts +2 -2
- package/dist/components/auth/email/password-changed-email.js +22 -29
- package/dist/components/auth/email/reset-password-email.d.ts +2 -2
- package/dist/components/auth/email/reset-password-email.js +22 -29
- package/dist/components/auth/error-toaster.js +32 -16
- package/dist/components/auth/field-separator.d.ts +1 -1
- package/dist/components/auth/field-separator.js +4 -17
- package/dist/components/auth/forgot-password.d.ts +1 -1
- package/dist/components/auth/forgot-password.js +36 -88
- package/dist/components/auth/magic-link/magic-link-button.d.ts +1 -1
- package/dist/components/auth/magic-link/magic-link-button.js +33 -19
- package/dist/components/auth/magic-link/magic-link.d.ts +2 -2
- package/dist/components/auth/magic-link/magic-link.js +39 -86
- package/dist/components/auth/multi-session/manage-account.d.ts +1 -1
- package/dist/components/auth/multi-session/manage-account.js +32 -48
- package/dist/components/auth/multi-session/manage-accounts.d.ts +1 -1
- package/dist/components/auth/multi-session/manage-accounts.js +32 -33
- package/dist/components/auth/multi-session/switch-account-submenu-content.d.ts +3 -1
- package/dist/components/auth/multi-session/switch-account-submenu-content.js +24 -27
- package/dist/components/auth/multi-session/switch-account-submenu-item.d.ts +3 -2
- package/dist/components/auth/multi-session/switch-account-submenu-item.js +16 -19
- package/dist/components/auth/multi-session/switch-account-submenu.d.ts +2 -1
- package/dist/components/auth/multi-session/switch-account-submenu.js +23 -23
- package/dist/components/auth/organization/change-organization-logo.d.ts +4 -0
- package/dist/components/auth/organization/change-organization-logo.js +69 -0
- package/dist/components/auth/organization/create-organization-dialog.d.ts +13 -0
- package/dist/components/auth/organization/create-organization-dialog.js +37 -0
- package/dist/components/auth/organization/delete-organization-dialog.d.ts +7 -0
- package/dist/components/auth/organization/delete-organization-dialog.js +25 -0
- package/dist/components/auth/organization/delete-organization-skeleton.d.ts +4 -0
- package/dist/components/auth/organization/delete-organization-skeleton.js +8 -0
- package/dist/components/auth/organization/delete-organization.d.ts +5 -0
- package/dist/components/auth/organization/delete-organization.js +27 -0
- package/dist/components/auth/organization/invite-member-dialog.d.ts +13 -0
- package/dist/components/auth/organization/invite-member-dialog.js +47 -0
- package/dist/components/auth/organization/leave-organization-dialog.d.ts +7 -0
- package/dist/components/auth/organization/leave-organization-dialog.js +21 -0
- package/dist/components/auth/organization/leave-organization.d.ts +4 -0
- package/dist/components/auth/organization/leave-organization.js +16 -0
- package/dist/components/auth/organization/organization-danger-zone.d.ts +16 -0
- package/dist/components/auth/organization/organization-danger-zone.js +23 -0
- package/dist/components/auth/organization/organization-invitation-row-skeleton.d.ts +5 -0
- package/dist/components/auth/organization/organization-invitation-row-skeleton.js +9 -0
- package/dist/components/auth/organization/organization-invitation-row.d.ts +5 -0
- package/dist/components/auth/organization/organization-invitation-row.js +31 -0
- package/dist/components/auth/organization/organization-invitations-empty.d.ts +8 -0
- package/dist/components/auth/organization/organization-invitations-empty.js +13 -0
- package/dist/components/auth/organization/organization-invitations.d.ts +9 -0
- package/dist/components/auth/organization/organization-invitations.js +66 -0
- package/dist/components/auth/organization/organization-logo.d.ts +15 -0
- package/dist/components/auth/organization/organization-logo.js +14 -0
- package/dist/components/auth/organization/organization-member-row-skeleton.d.ts +4 -0
- package/dist/components/auth/organization/organization-member-row-skeleton.js +9 -0
- package/dist/components/auth/organization/organization-member-row.d.ts +9 -0
- package/dist/components/auth/organization/organization-member-row.js +34 -0
- package/dist/components/auth/organization/organization-members.d.ts +9 -0
- package/dist/components/auth/organization/organization-members.js +67 -0
- package/dist/components/auth/organization/organization-people.d.ts +10 -0
- package/dist/components/auth/organization/organization-people.js +11 -0
- package/dist/components/auth/organization/organization-profile.d.ts +9 -0
- package/dist/components/auth/organization/organization-profile.js +34 -0
- package/dist/components/auth/organization/organization-row.d.ts +8 -0
- package/dist/components/auth/organization/organization-row.js +31 -0
- package/dist/components/auth/organization/organization-settings.d.ts +12 -0
- package/dist/components/auth/organization/organization-settings.js +13 -0
- package/dist/components/auth/organization/organization-switcher.d.ts +20 -0
- package/dist/components/auth/organization/organization-switcher.js +48 -0
- package/dist/components/auth/organization/organization-view-skeleton.d.ts +6 -0
- package/dist/components/auth/organization/organization-view-skeleton.js +9 -0
- package/dist/components/auth/organization/organization-view.d.ts +15 -0
- package/dist/components/auth/organization/organization-view.js +31 -0
- package/dist/components/auth/organization/organization.d.ts +17 -0
- package/dist/components/auth/organization/organization.js +60 -0
- package/dist/components/auth/organization/organizations-empty.d.ts +4 -0
- package/dist/components/auth/organization/organizations-empty.js +9 -0
- package/dist/components/auth/organization/organizations-settings.d.ts +17 -0
- package/dist/components/auth/organization/organizations-settings.js +17 -0
- package/dist/components/auth/organization/organizations.d.ts +10 -0
- package/dist/components/auth/organization/organizations.js +21 -0
- package/dist/components/auth/organization/remove-member-dialog.d.ts +9 -0
- package/dist/components/auth/organization/remove-member-dialog.js +20 -0
- package/dist/components/auth/organization/slug-field.d.ts +19 -0
- package/dist/components/auth/organization/slug-field.js +38 -0
- package/dist/components/auth/organization/user-invitation-row-skeleton.d.ts +4 -0
- package/dist/components/auth/organization/user-invitation-row-skeleton.js +8 -0
- package/dist/components/auth/organization/user-invitation-row.d.ts +10 -0
- package/dist/components/auth/organization/user-invitation-row.js +22 -0
- package/dist/components/auth/organization/user-invitations-empty.d.ts +4 -0
- package/dist/components/auth/organization/user-invitations-empty.js +12 -0
- package/dist/components/auth/organization/user-invitations.d.ts +10 -0
- package/dist/components/auth/organization/user-invitations.js +18 -0
- package/dist/components/auth/passkey/add-passkey-dialog.d.ts +5 -0
- package/dist/components/auth/passkey/add-passkey-dialog.js +22 -0
- package/dist/components/auth/passkey/delete-passkey-dialog.d.ts +11 -0
- package/dist/components/auth/passkey/delete-passkey-dialog.js +14 -0
- package/dist/components/auth/passkey/passkey-button.d.ts +1 -1
- package/dist/components/auth/passkey/passkey-button.js +24 -23
- package/dist/components/auth/passkey/passkey-skeleton.d.ts +1 -0
- package/dist/components/auth/passkey/passkey-skeleton.js +5 -0
- package/dist/components/auth/passkey/passkey.d.ts +2 -5
- package/dist/components/auth/passkey/passkey.js +16 -44
- package/dist/components/auth/passkey/passkeys-empty.d.ts +4 -0
- package/dist/components/auth/passkey/passkeys-empty.js +9 -0
- package/dist/components/auth/passkey/passkeys.d.ts +1 -1
- package/dist/components/auth/passkey/passkeys.js +15 -105
- package/dist/components/auth/provider-button.d.ts +2 -2
- package/dist/components/auth/provider-button.js +28 -24
- package/dist/components/auth/provider-buttons.js +28 -18
- package/dist/components/auth/reset-password.d.ts +1 -1
- package/dist/components/auth/reset-password.js +56 -146
- package/dist/components/auth/settings/account/account-settings.d.ts +2 -2
- package/dist/components/auth/settings/account/account-settings.js +21 -19
- package/dist/components/auth/settings/account/change-avatar.js +53 -88
- package/dist/components/auth/settings/account/change-email.d.ts +1 -1
- package/dist/components/auth/settings/account/change-email.js +27 -53
- package/dist/components/auth/settings/account/user-profile.d.ts +1 -1
- package/dist/components/auth/settings/account/user-profile.js +64 -85
- package/dist/components/auth/settings/security/active-session.d.ts +1 -1
- package/dist/components/auth/settings/security/active-session.js +50 -57
- package/dist/components/auth/settings/security/active-sessions.d.ts +1 -1
- package/dist/components/auth/settings/security/active-sessions.js +21 -32
- package/dist/components/auth/settings/security/change-password.d.ts +1 -1
- package/dist/components/auth/settings/security/change-password.js +76 -186
- package/dist/components/auth/settings/security/linked-account.d.ts +1 -1
- package/dist/components/auth/settings/security/linked-account.js +37 -55
- package/dist/components/auth/settings/security/linked-accounts.d.ts +1 -1
- package/dist/components/auth/settings/security/linked-accounts.js +34 -43
- package/dist/components/auth/settings/security/security-settings.d.ts +2 -2
- package/dist/components/auth/settings/security/security-settings.js +19 -21
- package/dist/components/auth/settings/settings.d.ts +4 -4
- package/dist/components/auth/settings/settings.js +52 -44
- package/dist/components/auth/sign-in.d.ts +2 -2
- package/dist/components/auth/sign-in.js +63 -132
- package/dist/components/auth/sign-out.js +32 -26
- package/dist/components/auth/sign-up.d.ts +2 -2
- package/dist/components/auth/sign-up.js +97 -211
- package/dist/components/auth/theme/appearance.d.ts +1 -1
- package/dist/components/auth/theme/appearance.js +23 -71
- package/dist/components/auth/theme/theme-toggle-item.js +56 -61
- package/dist/components/auth/user/user-avatar.d.ts +4 -4
- package/dist/components/auth/user/user-avatar.js +31 -28
- package/dist/components/auth/user/user-button.d.ts +6 -7
- package/dist/components/auth/user/user-button.js +38 -72
- package/dist/components/auth/user/user-view.d.ts +13 -7
- package/dist/components/auth/user/user-view.js +26 -36
- package/dist/components/auth/username/sign-in-username.d.ts +2 -2
- package/dist/components/auth/username/sign-in-username.js +87 -147
- package/dist/components/auth/username/username-field.d.ts +1 -1
- package/dist/components/auth/username/username-field.js +44 -52
- package/dist/email.d.ts +8 -7
- package/dist/email.js +8 -8
- package/dist/index.d.ts +21 -21
- package/dist/index.js +21 -22
- package/dist/lib/auth/api-key-plugin.d.ts +7 -4
- package/dist/lib/auth/api-key-plugin.js +12 -10
- package/dist/lib/auth/auth-plugin.d.ts +10 -6
- package/dist/lib/auth/auth-plugin.js +1 -0
- package/dist/lib/auth/delete-user-plugin.d.ts +6 -6
- package/dist/lib/auth/delete-user-plugin.js +6 -9
- package/dist/lib/auth/magic-link-plugin.d.ts +5 -5
- package/dist/lib/auth/magic-link-plugin.js +17 -12
- package/dist/lib/auth/multi-session-plugin.d.ts +5 -5
- package/dist/lib/auth/multi-session-plugin.js +8 -11
- package/dist/lib/auth/organization-plugin.d.ts +37 -0
- package/dist/lib/auth/organization-plugin.js +19 -0
- package/dist/lib/auth/passkey-plugin.d.ts +9 -6
- package/dist/lib/auth/passkey-plugin.js +8 -11
- package/dist/lib/auth/theme-plugin.d.ts +6 -6
- package/dist/lib/auth/theme-plugin.js +25 -22
- package/dist/lib/auth/username-plugin.d.ts +11 -11
- package/dist/lib/auth/username-plugin.js +18 -17
- package/dist/plugins.d.ts +46 -22
- package/dist/plugins.js +47 -22
- package/package.json +25 -19
- package/src/components/auth/api-key/api-key.tsx +25 -16
- package/src/components/auth/api-key/api-keys-empty.tsx +8 -4
- package/src/components/auth/api-key/api-keys.tsx +52 -14
- package/src/components/auth/api-key/create-api-key-dialog.tsx +17 -4
- package/src/components/auth/api-key/delete-api-key-dialog.tsx +10 -2
- package/src/components/auth/api-key/organization-api-keys.tsx +55 -0
- package/src/components/auth/delete-user/danger-zone.tsx +3 -3
- package/src/components/auth/delete-user/{delete-user.tsx → delete-account.tsx} +9 -9
- package/src/components/auth/email/organization-invitation-email.tsx +38 -0
- package/src/components/auth/error-toaster.tsx +28 -10
- package/src/components/auth/forgot-password.tsx +10 -2
- package/src/components/auth/multi-session/manage-accounts.tsx +1 -1
- package/src/components/auth/multi-session/switch-account-submenu-content.tsx +7 -2
- package/src/components/auth/multi-session/switch-account-submenu-item.tsx +4 -2
- package/src/components/auth/multi-session/switch-account-submenu.tsx +8 -4
- package/src/components/auth/organization/change-organization-logo.tsx +171 -0
- package/src/components/auth/organization/create-organization-dialog.tsx +133 -0
- package/src/components/auth/organization/delete-organization-dialog.tsx +97 -0
- package/src/components/auth/organization/delete-organization-skeleton.tsx +17 -0
- package/src/components/auth/organization/delete-organization.tsx +77 -0
- package/src/components/auth/organization/invite-member-dialog.tsx +177 -0
- package/src/components/auth/organization/leave-organization-dialog.tsx +95 -0
- package/src/components/auth/organization/leave-organization.tsx +59 -0
- package/src/components/auth/organization/organization-danger-zone.tsx +68 -0
- package/src/components/auth/organization/organization-invitation-row-skeleton.tsx +29 -0
- package/src/components/auth/organization/organization-invitation-row.tsx +97 -0
- package/src/components/auth/organization/organization-invitations-empty.tsx +39 -0
- package/src/components/auth/organization/organization-invitations.tsx +351 -0
- package/src/components/auth/organization/organization-logo.tsx +64 -0
- package/src/components/auth/organization/organization-member-row-skeleton.tsx +24 -0
- package/src/components/auth/organization/organization-member-row.tsx +157 -0
- package/src/components/auth/organization/organization-members.tsx +284 -0
- package/src/components/auth/organization/organization-people.tsx +26 -0
- package/src/components/auth/organization/organization-profile.tsx +141 -0
- package/src/components/auth/organization/organization-row.tsx +66 -0
- package/src/components/auth/organization/organization-settings.tsx +38 -0
- package/src/components/auth/organization/organization-switcher.tsx +233 -0
- package/src/components/auth/organization/organization-view-skeleton.tsx +36 -0
- package/src/components/auth/organization/organization-view.tsx +109 -0
- package/src/components/auth/organization/organization.tsx +162 -0
- package/src/components/auth/organization/organizations-empty.tsx +35 -0
- package/src/components/auth/organization/organizations-settings.tsx +36 -0
- package/src/components/auth/organization/organizations.tsx +80 -0
- package/src/components/auth/organization/remove-member-dialog.tsx +95 -0
- package/src/components/auth/organization/slug-field.tsx +111 -0
- package/src/components/auth/organization/user-invitation-row-skeleton.tsx +17 -0
- package/src/components/auth/organization/user-invitation-row.tsx +90 -0
- package/src/components/auth/organization/user-invitations-empty.tsx +30 -0
- package/src/components/auth/organization/user-invitations.tsx +59 -0
- package/src/components/auth/passkey/add-passkey-dialog.tsx +109 -0
- package/src/components/auth/passkey/delete-passkey-dialog.tsx +95 -0
- package/src/components/auth/passkey/passkey-skeleton.tsx +16 -0
- package/src/components/auth/passkey/passkey.tsx +23 -22
- package/src/components/auth/passkey/passkeys-empty.tsx +35 -0
- package/src/components/auth/passkey/passkeys.tsx +33 -154
- package/src/components/auth/settings/account/change-email.tsx +1 -1
- package/src/components/auth/settings/account/user-profile.tsx +5 -5
- package/src/components/auth/settings/security/active-sessions.tsx +6 -4
- package/src/components/auth/settings/security/linked-accounts.tsx +2 -2
- package/src/components/auth/settings/settings.tsx +77 -14
- package/src/components/auth/user/user-avatar.tsx +4 -1
- package/src/components/auth/user/user-button.tsx +14 -11
- package/src/components/auth/user/user-view.tsx +32 -12
- package/src/email.ts +1 -0
- package/src/lib/auth/api-key-plugin.ts +10 -4
- package/src/lib/auth/auth-plugin.ts +6 -1
- package/src/lib/auth/organization-plugin.tsx +32 -0
- package/src/plugins.ts +25 -1
- package/dist/components/auth/delete-user/delete-user.d.ts +0 -9
- package/dist/components/auth/delete-user/delete-user.js +0 -95
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdditionalFieldProps } from
|
|
2
|
-
export type { AdditionalFieldProps } from
|
|
1
|
+
import type { AdditionalFieldProps } from "../../lib/auth/auth-plugin";
|
|
2
|
+
export type { AdditionalFieldProps } from "../../lib/auth/auth-plugin";
|
|
3
3
|
/** Renders a single additional user field via HeroUI v3 components. */
|
|
4
4
|
export declare function AdditionalField({ name, field, isPending, variant }: AdditionalFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,270 +1,137 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { resolveInputType } from "@better-auth-ui/core";
|
|
3
|
+
import { useAuth } from "@better-auth-ui/react";
|
|
4
|
+
import { Check, Copy } from "@gravity-ui/icons";
|
|
5
|
+
import { Button, Calendar, Checkbox, ComboBox, DateField, DatePicker, FieldError, Input, InputGroup, Label, ListBox, NumberField, Select, Slider, Switch, TextArea, TextField, TimeField, toast } from "@heroui/react";
|
|
6
|
+
import { fromDate, getLocalTimeZone, parseDate, parseDateTime, toCalendarDate, toCalendarDateTime } from "@internationalized/date";
|
|
7
|
+
import { useRef, useState } from "react";
|
|
8
|
+
/** Convert a `defaultValue` into a `CalendarDate` for HeroUI date inputs. */
|
|
9
|
+
function toDateValue(value) {
|
|
10
|
+
if (value instanceof Date) {
|
|
11
|
+
return toCalendarDate(fromDate(value, getLocalTimeZone()));
|
|
12
|
+
}
|
|
13
|
+
if (typeof value === "string") {
|
|
14
|
+
try {
|
|
15
|
+
return parseDate(value.slice(0, 10));
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
16
22
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
/** Convert a `defaultValue` into a `CalendarDateTime` for datetime inputs. */
|
|
24
|
+
function toDateTimeValue(value) {
|
|
25
|
+
if (value instanceof Date) {
|
|
26
|
+
return toCalendarDateTime(fromDate(value, getLocalTimeZone()));
|
|
27
|
+
}
|
|
28
|
+
if (typeof value === "string") {
|
|
29
|
+
try {
|
|
30
|
+
// Strip trailing `Z` or timezone offset for `parseDateTime`.
|
|
31
|
+
return parseDateTime(value.replace(/(Z|[+-]\d{2}:?\d{2})$/, ""));
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
24
38
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Icon-only copy button used as an `InputGroup.Suffix`. `getValue` is invoked
|
|
41
|
+
* lazily on click so the button copies the input's *live* value rather than a
|
|
42
|
+
* stale snapshot — important when paired with editable inputs.
|
|
43
|
+
*/
|
|
44
|
+
function CopyButton({ getValue, isDisabled }) {
|
|
45
|
+
const { localization } = useAuth();
|
|
46
|
+
const [copied, setCopied] = useState(false);
|
|
47
|
+
async function handleCopy() {
|
|
48
|
+
const value = getValue();
|
|
49
|
+
if (!value)
|
|
50
|
+
return;
|
|
51
|
+
try {
|
|
52
|
+
await navigator.clipboard.writeText(value);
|
|
53
|
+
setCopied(true);
|
|
54
|
+
setTimeout(() => setCopied(false), 1500);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
toast.danger(error instanceof Error ? error.message : String(error));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return (_jsx(Button, { isIconOnly: true, "aria-label": localization.settings.copyToClipboard, size: "sm", variant: "ghost", isDisabled: isDisabled, onPress: handleCopy, children: copied ? _jsx(Check, { className: "size-4" }) : _jsx(Copy, { className: "size-4" }) }));
|
|
44
61
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
children: [/* @__PURE__ */ M(v.Control, { children: /* @__PURE__ */ M(v.Thumb, {}) }), /* @__PURE__ */ M(p, { children: r.label })]
|
|
121
|
-
});
|
|
122
|
-
if (w === "checkbox") return /* @__PURE__ */ N(o, {
|
|
123
|
-
name: n,
|
|
124
|
-
defaultSelected: r.defaultValue === !0 || r.defaultValue === "true",
|
|
125
|
-
isDisabled: i,
|
|
126
|
-
isReadOnly: r.readOnly,
|
|
127
|
-
isRequired: r.required,
|
|
128
|
-
variant: T,
|
|
129
|
-
children: [/* @__PURE__ */ M(o.Control, { children: /* @__PURE__ */ M(o.Indicator, {}) }), /* @__PURE__ */ M(o.Content, { children: /* @__PURE__ */ M(p, { children: r.label }) })]
|
|
130
|
-
});
|
|
131
|
-
if (w === "select") return /* @__PURE__ */ N(g, {
|
|
132
|
-
className: "[&[data-required=true]>.label]:after:content-none",
|
|
133
|
-
name: n,
|
|
134
|
-
defaultValue: r.defaultValue == null ? void 0 : String(r.defaultValue),
|
|
135
|
-
placeholder: r.placeholder,
|
|
136
|
-
isDisabled: i || r.readOnly,
|
|
137
|
-
isRequired: r.required,
|
|
138
|
-
variant: T,
|
|
139
|
-
fullWidth: !0,
|
|
140
|
-
children: [
|
|
141
|
-
/* @__PURE__ */ M(p, { children: r.label }),
|
|
142
|
-
/* @__PURE__ */ N(g.Trigger, { children: [/* @__PURE__ */ M(g.Value, {}), /* @__PURE__ */ M(g.Indicator, {})] }),
|
|
143
|
-
/* @__PURE__ */ M(g.Popover, { children: /* @__PURE__ */ M(m, { children: r.options?.map((e) => /* @__PURE__ */ N(m.Item, {
|
|
144
|
-
id: e.value,
|
|
145
|
-
textValue: typeof e.label == "string" ? e.label : e.value,
|
|
146
|
-
children: [e.label, /* @__PURE__ */ M(m.ItemIndicator, {})]
|
|
147
|
-
}, e.value)) }) }),
|
|
148
|
-
/* @__PURE__ */ M(u, {})
|
|
149
|
-
]
|
|
150
|
-
});
|
|
151
|
-
if (w === "combobox") return /* @__PURE__ */ N(s, {
|
|
152
|
-
className: "[&[data-required=true]>.label]:after:content-none",
|
|
153
|
-
name: n,
|
|
154
|
-
defaultSelectedKey: r.defaultValue == null ? void 0 : String(r.defaultValue),
|
|
155
|
-
isDisabled: i,
|
|
156
|
-
isReadOnly: r.readOnly,
|
|
157
|
-
isRequired: r.required,
|
|
158
|
-
variant: T,
|
|
159
|
-
fullWidth: !0,
|
|
160
|
-
children: [
|
|
161
|
-
/* @__PURE__ */ M(p, { children: r.label }),
|
|
162
|
-
/* @__PURE__ */ N(s.InputGroup, { children: [/* @__PURE__ */ M(d, { placeholder: r.placeholder }), /* @__PURE__ */ M(s.Trigger, {})] }),
|
|
163
|
-
/* @__PURE__ */ M(s.Popover, { children: /* @__PURE__ */ M(m, { children: r.options?.map((e) => /* @__PURE__ */ N(m.Item, {
|
|
164
|
-
id: e.value,
|
|
165
|
-
textValue: typeof e.label == "string" ? e.label : e.value,
|
|
166
|
-
children: [e.label, /* @__PURE__ */ M(m.ItemIndicator, {})]
|
|
167
|
-
}, e.value)) }) }),
|
|
168
|
-
/* @__PURE__ */ M(u, {})
|
|
169
|
-
]
|
|
170
|
-
});
|
|
171
|
-
if (w === "date" || w === "datetime") {
|
|
172
|
-
let e = w === "datetime";
|
|
173
|
-
return /* @__PURE__ */ M(l, {
|
|
174
|
-
className: "w-full [&[data-required=true]>.label]:after:content-none",
|
|
175
|
-
name: n,
|
|
176
|
-
defaultValue: e ? F(r.defaultValue) : P(r.defaultValue),
|
|
177
|
-
granularity: e ? "minute" : "day",
|
|
178
|
-
isDisabled: i,
|
|
179
|
-
isReadOnly: r.readOnly,
|
|
180
|
-
isRequired: r.required,
|
|
181
|
-
children: ({ state: t }) => /* @__PURE__ */ N(j, { children: [
|
|
182
|
-
/* @__PURE__ */ M(p, { children: r.label }),
|
|
183
|
-
/* @__PURE__ */ N(c.Group, {
|
|
184
|
-
variant: T,
|
|
185
|
-
fullWidth: !0,
|
|
186
|
-
children: [/* @__PURE__ */ M(c.Input, { children: (e) => /* @__PURE__ */ M(c.Segment, { segment: e }) }), /* @__PURE__ */ M(c.Suffix, { children: /* @__PURE__ */ M(l.Trigger, { children: /* @__PURE__ */ M(l.TriggerIndicator, {}) }) })]
|
|
187
|
-
}),
|
|
188
|
-
/* @__PURE__ */ M(u, {}),
|
|
189
|
-
/* @__PURE__ */ N(l.Popover, {
|
|
190
|
-
className: "flex flex-col gap-3",
|
|
191
|
-
children: [/* @__PURE__ */ N(a, {
|
|
192
|
-
"aria-label": typeof r.label == "string" ? r.label : n,
|
|
193
|
-
children: [
|
|
194
|
-
/* @__PURE__ */ N(a.Header, { children: [
|
|
195
|
-
/* @__PURE__ */ N(a.YearPickerTrigger, { children: [/* @__PURE__ */ M(a.YearPickerTriggerHeading, {}), /* @__PURE__ */ M(a.YearPickerTriggerIndicator, {})] }),
|
|
196
|
-
/* @__PURE__ */ M(a.NavButton, { slot: "previous" }),
|
|
197
|
-
/* @__PURE__ */ M(a.NavButton, { slot: "next" })
|
|
198
|
-
] }),
|
|
199
|
-
/* @__PURE__ */ N(a.Grid, { children: [/* @__PURE__ */ M(a.GridHeader, { children: (e) => /* @__PURE__ */ M(a.HeaderCell, { children: e }) }), /* @__PURE__ */ M(a.GridBody, { children: (e) => /* @__PURE__ */ M(a.Cell, { date: e }) })] }),
|
|
200
|
-
/* @__PURE__ */ M(a.YearPickerGrid, { children: /* @__PURE__ */ M(a.YearPickerGridBody, { children: ({ year: e }) => /* @__PURE__ */ M(a.YearPickerCell, { year: e }) }) })
|
|
201
|
-
]
|
|
202
|
-
}), e && /* @__PURE__ */ N("div", {
|
|
203
|
-
className: "flex items-center justify-between",
|
|
204
|
-
children: [/* @__PURE__ */ M(p, { children: C.settings.time }), /* @__PURE__ */ M(x, {
|
|
205
|
-
"aria-label": C.settings.time,
|
|
206
|
-
granularity: "minute",
|
|
207
|
-
value: t.timeValue,
|
|
208
|
-
onChange: (e) => t.setTimeValue(e),
|
|
209
|
-
children: /* @__PURE__ */ M(x.Group, {
|
|
210
|
-
variant: "secondary",
|
|
211
|
-
children: /* @__PURE__ */ M(x.Input, { children: (e) => /* @__PURE__ */ M(x.Segment, { segment: e }) })
|
|
212
|
-
})
|
|
213
|
-
})]
|
|
214
|
-
})]
|
|
215
|
-
})
|
|
216
|
-
] })
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
let D = r.prefix != null, O = r.suffix != null || r.copyable, A = r.type === "number", L = r.formatOptions?.maximumFractionDigits, R = A ? "number" : void 0, z = A ? L ? "decimal" : "numeric" : void 0, B = L ? 1 / 10 ** L : void 0;
|
|
220
|
-
return D || O ? /* @__PURE__ */ N(b, {
|
|
221
|
-
name: n,
|
|
222
|
-
defaultValue: r.defaultValue == null ? void 0 : String(r.defaultValue),
|
|
223
|
-
isDisabled: i,
|
|
224
|
-
isReadOnly: r.readOnly,
|
|
225
|
-
children: [
|
|
226
|
-
/* @__PURE__ */ M(p, { children: r.label }),
|
|
227
|
-
/* @__PURE__ */ N(f, {
|
|
228
|
-
variant: T,
|
|
229
|
-
children: [
|
|
230
|
-
D && /* @__PURE__ */ M(f.Prefix, { children: r.prefix }),
|
|
231
|
-
/* @__PURE__ */ M(f.Input, {
|
|
232
|
-
ref: E,
|
|
233
|
-
placeholder: r.placeholder,
|
|
234
|
-
required: r.required,
|
|
235
|
-
type: R,
|
|
236
|
-
inputMode: z,
|
|
237
|
-
step: B
|
|
238
|
-
}),
|
|
239
|
-
r.copyable ? /* @__PURE__ */ M(f.Suffix, {
|
|
240
|
-
className: "px-0",
|
|
241
|
-
children: /* @__PURE__ */ M(I, {
|
|
242
|
-
getValue: () => E.current?.value,
|
|
243
|
-
isDisabled: i
|
|
244
|
-
})
|
|
245
|
-
}) : r.suffix != null && /* @__PURE__ */ M(f.Suffix, { children: r.suffix })
|
|
246
|
-
]
|
|
247
|
-
}),
|
|
248
|
-
/* @__PURE__ */ M(u, {})
|
|
249
|
-
]
|
|
250
|
-
}) : /* @__PURE__ */ N(b, {
|
|
251
|
-
name: n,
|
|
252
|
-
defaultValue: r.defaultValue == null ? void 0 : String(r.defaultValue),
|
|
253
|
-
isDisabled: i,
|
|
254
|
-
isReadOnly: r.readOnly,
|
|
255
|
-
children: [
|
|
256
|
-
/* @__PURE__ */ M(p, { children: r.label }),
|
|
257
|
-
/* @__PURE__ */ M(d, {
|
|
258
|
-
placeholder: r.placeholder,
|
|
259
|
-
required: r.required,
|
|
260
|
-
variant: T,
|
|
261
|
-
type: R,
|
|
262
|
-
inputMode: z,
|
|
263
|
-
step: B
|
|
264
|
-
}),
|
|
265
|
-
/* @__PURE__ */ M(u, {})
|
|
266
|
-
]
|
|
267
|
-
});
|
|
62
|
+
/** Renders a single additional user field via HeroUI v3 components. */
|
|
63
|
+
export function AdditionalField({ name, field, isPending, variant }) {
|
|
64
|
+
const { localization } = useAuth();
|
|
65
|
+
const inputType = resolveInputType(field);
|
|
66
|
+
const inputVariant = variant === "transparent" ? "primary" : "secondary";
|
|
67
|
+
// Used by `inputType: "input"` with `copyable: true` so the copy button
|
|
68
|
+
// reads the input's *live* value rather than a stale `defaultValue`.
|
|
69
|
+
const inputRef = useRef(null);
|
|
70
|
+
if (field.render) {
|
|
71
|
+
return _jsx(_Fragment, { children: field.render({ name, field, isPending, variant }) });
|
|
72
|
+
}
|
|
73
|
+
if (inputType === "hidden") {
|
|
74
|
+
return (_jsx("input", { type: "hidden", name: name, value: field.defaultValue == null
|
|
75
|
+
? ""
|
|
76
|
+
: field.defaultValue instanceof Date
|
|
77
|
+
? field.defaultValue.toISOString()
|
|
78
|
+
: String(field.defaultValue) }));
|
|
79
|
+
}
|
|
80
|
+
if (inputType === "textarea") {
|
|
81
|
+
return (_jsxs(TextField, { name: name, defaultValue: field.defaultValue == null ? undefined : String(field.defaultValue), isDisabled: isPending, isReadOnly: field.readOnly, children: [_jsx(Label, { children: field.label }), _jsx(TextArea, { placeholder: field.placeholder, required: field.required, variant: inputVariant }), _jsx(FieldError, {})] }));
|
|
82
|
+
}
|
|
83
|
+
if (inputType === "number") {
|
|
84
|
+
const maxFractionDigits = field.formatOptions?.maximumFractionDigits;
|
|
85
|
+
return (_jsxs(NumberField, { name: name, defaultValue: typeof field.defaultValue === "number"
|
|
86
|
+
? field.defaultValue
|
|
87
|
+
: field.defaultValue != null && field.defaultValue !== ""
|
|
88
|
+
? Number(field.defaultValue)
|
|
89
|
+
: undefined, minValue: field.min, maxValue: field.max, step: field.step ?? (maxFractionDigits ? 1 / 10 ** maxFractionDigits : 1), formatOptions: field.formatOptions, isDisabled: isPending, isReadOnly: field.readOnly, variant: inputVariant, children: [_jsx(Label, { children: field.label }), _jsxs(NumberField.Group, { children: [_jsx(NumberField.DecrementButton, {}), _jsx(NumberField.Input, { placeholder: field.placeholder, required: field.required }), _jsx(NumberField.IncrementButton, {})] }), _jsx(FieldError, {})] }));
|
|
90
|
+
}
|
|
91
|
+
if (inputType === "slider") {
|
|
92
|
+
const maxFractionDigits = field.formatOptions?.maximumFractionDigits;
|
|
93
|
+
return (_jsxs(Slider, { defaultValue: typeof field.defaultValue === "number"
|
|
94
|
+
? field.defaultValue
|
|
95
|
+
: field.defaultValue != null
|
|
96
|
+
? Number(field.defaultValue)
|
|
97
|
+
: undefined, minValue: field.min ?? 0, maxValue: field.max ?? 100, step: field.step ?? (maxFractionDigits ? 1 / 10 ** maxFractionDigits : 1), formatOptions: field.formatOptions, isDisabled: isPending || field.readOnly, className: "flex flex-col gap-2", children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx(Label, { children: field.label }), _jsx(Slider.Output, { className: "text-sm text-muted" })] }), _jsxs(Slider.Track, { children: [_jsx(Slider.Fill, {}), _jsx(Slider.Thumb, { name: name })] })] }));
|
|
98
|
+
}
|
|
99
|
+
if (inputType === "switch") {
|
|
100
|
+
return (_jsxs(Switch, { name: name, defaultSelected: field.defaultValue === true || field.defaultValue === "true", isDisabled: isPending, isReadOnly: field.readOnly, children: [_jsx(Switch.Control, { children: _jsx(Switch.Thumb, {}) }), _jsx(Label, { children: field.label })] }));
|
|
101
|
+
}
|
|
102
|
+
if (inputType === "checkbox") {
|
|
103
|
+
return (_jsxs(Checkbox, { name: name, defaultSelected: field.defaultValue === true || field.defaultValue === "true", isDisabled: isPending, isReadOnly: field.readOnly, isRequired: field.required, variant: inputVariant, children: [_jsx(Checkbox.Control, { children: _jsx(Checkbox.Indicator, {}) }), _jsx(Checkbox.Content, { children: _jsx(Label, { children: field.label }) })] }));
|
|
104
|
+
}
|
|
105
|
+
if (inputType === "select") {
|
|
106
|
+
return (_jsxs(Select, { className: "[&[data-required=true]>.label]:after:content-none", name: name, defaultValue: field.defaultValue != null ? String(field.defaultValue) : undefined, placeholder: field.placeholder, isDisabled: isPending || field.readOnly, isRequired: field.required, variant: inputVariant, fullWidth: true, children: [_jsx(Label, { children: field.label }), _jsxs(Select.Trigger, { children: [_jsx(Select.Value, {}), _jsx(Select.Indicator, {})] }), _jsx(Select.Popover, { children: _jsx(ListBox, { children: field.options?.map((option) => (_jsxs(ListBox.Item, { id: option.value, textValue: typeof option.label === "string" ? option.label : option.value, children: [option.label, _jsx(ListBox.ItemIndicator, {})] }, option.value))) }) }), _jsx(FieldError, {})] }));
|
|
107
|
+
}
|
|
108
|
+
if (inputType === "combobox") {
|
|
109
|
+
return (_jsxs(ComboBox, { className: "[&[data-required=true]>.label]:after:content-none", name: name, defaultSelectedKey: field.defaultValue != null ? String(field.defaultValue) : undefined, isDisabled: isPending, isReadOnly: field.readOnly, isRequired: field.required, variant: inputVariant, fullWidth: true, children: [_jsx(Label, { children: field.label }), _jsxs(ComboBox.InputGroup, { children: [_jsx(Input, { placeholder: field.placeholder }), _jsx(ComboBox.Trigger, {})] }), _jsx(ComboBox.Popover, { children: _jsx(ListBox, { children: field.options?.map((option) => (_jsxs(ListBox.Item, { id: option.value, textValue: typeof option.label === "string" ? option.label : option.value, children: [option.label, _jsx(ListBox.ItemIndicator, {})] }, option.value))) }) }), _jsx(FieldError, {})] }));
|
|
110
|
+
}
|
|
111
|
+
if (inputType === "date" || inputType === "datetime") {
|
|
112
|
+
const isDateTime = inputType === "datetime";
|
|
113
|
+
const defaultValue = isDateTime
|
|
114
|
+
? toDateTimeValue(field.defaultValue)
|
|
115
|
+
: toDateValue(field.defaultValue);
|
|
116
|
+
return (_jsx(DatePicker, { className: "w-full [&[data-required=true]>.label]:after:content-none", name: name, defaultValue: defaultValue, granularity: isDateTime ? "minute" : "day", isDisabled: isPending, isReadOnly: field.readOnly, isRequired: field.required, children: ({ state }) => (_jsxs(_Fragment, { children: [_jsx(Label, { children: field.label }), _jsxs(DateField.Group, { variant: inputVariant, fullWidth: true, children: [_jsx(DateField.Input, { children: (segment) => _jsx(DateField.Segment, { segment: segment }) }), _jsx(DateField.Suffix, { children: _jsx(DatePicker.Trigger, { children: _jsx(DatePicker.TriggerIndicator, {}) }) })] }), _jsx(FieldError, {}), _jsxs(DatePicker.Popover, { className: "flex flex-col gap-3", children: [_jsxs(Calendar, { "aria-label": typeof field.label === "string" ? field.label : name, children: [_jsxs(Calendar.Header, { children: [_jsxs(Calendar.YearPickerTrigger, { children: [_jsx(Calendar.YearPickerTriggerHeading, {}), _jsx(Calendar.YearPickerTriggerIndicator, {})] }), _jsx(Calendar.NavButton, { slot: "previous" }), _jsx(Calendar.NavButton, { slot: "next" })] }), _jsxs(Calendar.Grid, { children: [_jsx(Calendar.GridHeader, { children: (day) => _jsx(Calendar.HeaderCell, { children: day }) }), _jsx(Calendar.GridBody, { children: (date) => _jsx(Calendar.Cell, { date: date }) })] }), _jsx(Calendar.YearPickerGrid, { children: _jsx(Calendar.YearPickerGridBody, { children: ({ year }) => _jsx(Calendar.YearPickerCell, { year: year }) }) })] }), isDateTime && (_jsxs("div", { className: "flex items-center justify-between", children: [_jsx(Label, { children: localization.settings.time }), _jsx(TimeField, { "aria-label": localization.settings.time, granularity: "minute", value: state.timeValue, onChange: (v) => state.setTimeValue(v), children: _jsx(TimeField.Group, { variant: "secondary", children: _jsx(TimeField.Input, { children: (segment) => _jsx(TimeField.Segment, { segment: segment }) }) }) })] }))] })] })) }));
|
|
117
|
+
}
|
|
118
|
+
// inputType === "input"
|
|
119
|
+
const hasPrefix = field.prefix != null;
|
|
120
|
+
const hasSuffix = field.suffix != null || field.copyable;
|
|
121
|
+
// When `inputType: "input"` is paired with `type: "number"`, restrict the
|
|
122
|
+
// native input to numbers. `formatOptions.maximumFractionDigits` enables
|
|
123
|
+
// fractional input via `step`.
|
|
124
|
+
const isNumeric = field.type === "number";
|
|
125
|
+
const maxFractionDigits = field.formatOptions?.maximumFractionDigits;
|
|
126
|
+
const nativeInputType = isNumeric ? "number" : undefined;
|
|
127
|
+
const nativeInputMode = isNumeric
|
|
128
|
+
? maxFractionDigits
|
|
129
|
+
? "decimal"
|
|
130
|
+
: "numeric"
|
|
131
|
+
: undefined;
|
|
132
|
+
const nativeStep = maxFractionDigits ? 1 / 10 ** maxFractionDigits : undefined;
|
|
133
|
+
if (hasPrefix || hasSuffix) {
|
|
134
|
+
return (_jsxs(TextField, { name: name, defaultValue: field.defaultValue == null ? undefined : String(field.defaultValue), isDisabled: isPending, isReadOnly: field.readOnly, children: [_jsx(Label, { children: field.label }), _jsxs(InputGroup, { variant: inputVariant, children: [hasPrefix && _jsx(InputGroup.Prefix, { children: field.prefix }), _jsx(InputGroup.Input, { ref: inputRef, placeholder: field.placeholder, required: field.required, type: nativeInputType, inputMode: nativeInputMode, step: nativeStep }), field.copyable ? (_jsx(InputGroup.Suffix, { className: "px-0", children: _jsx(CopyButton, { getValue: () => inputRef.current?.value, isDisabled: isPending }) })) : (field.suffix != null && (_jsx(InputGroup.Suffix, { children: field.suffix })))] }), _jsx(FieldError, {})] }));
|
|
135
|
+
}
|
|
136
|
+
return (_jsxs(TextField, { name: name, defaultValue: field.defaultValue == null ? undefined : String(field.defaultValue), isDisabled: isPending, isReadOnly: field.readOnly, children: [_jsx(Label, { children: field.label }), _jsx(Input, { placeholder: field.placeholder, required: field.required, variant: inputVariant, type: nativeInputType, inputMode: nativeInputMode, step: nativeStep }), _jsx(FieldError, {})] }));
|
|
268
137
|
}
|
|
269
|
-
//#endregion
|
|
270
|
-
export { L as AdditionalField };
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return /* @__PURE__ */ t("div", {
|
|
6
|
-
className: "flex items-center justify-between",
|
|
7
|
-
children: /* @__PURE__ */ n("div", {
|
|
8
|
-
className: "flex items-center gap-3",
|
|
9
|
-
children: [/* @__PURE__ */ t(e, { className: "size-10 rounded-xl" }), /* @__PURE__ */ n("div", {
|
|
10
|
-
className: "flex flex-col gap-1",
|
|
11
|
-
children: [
|
|
12
|
-
/* @__PURE__ */ t(e, { className: "h-4 w-28 rounded-lg" }),
|
|
13
|
-
/* @__PURE__ */ t(e, { className: "h-3 w-36 rounded-lg" }),
|
|
14
|
-
/* @__PURE__ */ t(e, { className: "h-3 w-32 rounded-lg" })
|
|
15
|
-
]
|
|
16
|
-
})]
|
|
17
|
-
})
|
|
18
|
-
});
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Skeleton } from "@heroui/react";
|
|
3
|
+
export function ApiKeySkeleton() {
|
|
4
|
+
return (_jsx("div", { className: "flex items-center justify-between", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Skeleton, { className: "size-10 rounded-xl" }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx(Skeleton, { className: "h-4 w-28 rounded-lg" }), _jsx(Skeleton, { className: "h-3 w-36 rounded-lg" }), _jsx(Skeleton, { className: "h-3 w-32 rounded-lg" })] })] }) }));
|
|
19
5
|
}
|
|
20
|
-
//#endregion
|
|
21
|
-
export { r as ApiKeySkeleton };
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { ListedApiKey } from
|
|
1
|
+
import { type ListedApiKey } from "@better-auth-ui/react";
|
|
2
2
|
export type ApiKeyProps = {
|
|
3
3
|
apiKey: ListedApiKey;
|
|
4
|
+
/** Hide the row's delete button (e.g., when caller lacks `apiKey:delete`). */
|
|
5
|
+
hideDelete?: boolean;
|
|
6
|
+
/** Scope the delete payload to an organization (sets `configId`). */
|
|
7
|
+
organizationId?: string;
|
|
4
8
|
};
|
|
5
|
-
export declare function ApiKey({ apiKey }: ApiKeyProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function ApiKey({ apiKey, hideDelete, organizationId }: ApiKeyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,55 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}),
|
|
18
|
-
/* @__PURE__ */ l("div", {
|
|
19
|
-
className: "flex flex-col min-w-0",
|
|
20
|
-
children: [
|
|
21
|
-
/* @__PURE__ */ c("span", {
|
|
22
|
-
className: "text-sm font-medium leading-tight truncate",
|
|
23
|
-
children: u.name || f.apiKey
|
|
24
|
-
}),
|
|
25
|
-
/* @__PURE__ */ c("span", {
|
|
26
|
-
className: "text-xs text-muted font-mono truncate",
|
|
27
|
-
children: h
|
|
28
|
-
}),
|
|
29
|
-
/* @__PURE__ */ c("span", {
|
|
30
|
-
className: "text-xs text-muted",
|
|
31
|
-
children: new Date(u.createdAt).toLocaleString(void 0, {
|
|
32
|
-
dateStyle: "medium",
|
|
33
|
-
timeStyle: "short"
|
|
34
|
-
})
|
|
35
|
-
})
|
|
36
|
-
]
|
|
37
|
-
}),
|
|
38
|
-
/* @__PURE__ */ l(o, {
|
|
39
|
-
className: "ml-auto shrink-0",
|
|
40
|
-
variant: "outline",
|
|
41
|
-
size: "sm",
|
|
42
|
-
onPress: () => m(!0),
|
|
43
|
-
"aria-label": f.deleteApiKey,
|
|
44
|
-
children: [/* @__PURE__ */ c(a, {}), d.settings.delete]
|
|
45
|
-
}),
|
|
46
|
-
/* @__PURE__ */ c(t, {
|
|
47
|
-
isOpen: p,
|
|
48
|
-
onOpenChange: m,
|
|
49
|
-
apiKey: u
|
|
50
|
-
})
|
|
51
|
-
]
|
|
52
|
-
});
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useAuth, useAuthPlugin } from "@better-auth-ui/react";
|
|
3
|
+
import { Key, Xmark } from "@gravity-ui/icons";
|
|
4
|
+
import { Button } from "@heroui/react";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { apiKeyPlugin } from "../../../lib/auth/api-key-plugin";
|
|
7
|
+
import { DeleteApiKeyDialog } from "./delete-api-key-dialog";
|
|
8
|
+
export function ApiKey({ apiKey, hideDelete, organizationId }) {
|
|
9
|
+
const { localization } = useAuth();
|
|
10
|
+
const { localization: apiKeyLocalization } = useAuthPlugin(apiKeyPlugin);
|
|
11
|
+
const [deleteOpen, setDeleteOpen] = useState(false);
|
|
12
|
+
const preview = `${apiKey.start}${"*".repeat(16)}`;
|
|
13
|
+
return (_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary", children: _jsx(Key, { className: "size-4.5" }) }), _jsxs("div", { className: "flex flex-col min-w-0", children: [_jsx("span", { className: "text-sm font-medium leading-tight truncate", children: apiKey.name || apiKeyLocalization.apiKey }), _jsx("span", { className: "text-xs text-muted font-mono truncate", children: preview }), _jsx("span", { className: "text-xs text-muted", children: new Date(apiKey.createdAt).toLocaleString(undefined, {
|
|
14
|
+
dateStyle: "medium",
|
|
15
|
+
timeStyle: "short"
|
|
16
|
+
}) })] }), !hideDelete && (_jsxs(_Fragment, { children: [_jsxs(Button, { className: "ml-auto shrink-0", variant: "outline", size: "sm", onPress: () => setDeleteOpen(true), "aria-label": apiKeyLocalization.deleteApiKey, children: [_jsx(Xmark, {}), localization.settings.delete] }), _jsx(DeleteApiKeyDialog, { isOpen: deleteOpen, onOpenChange: setDeleteOpen, apiKey: apiKey, organizationId: organizationId })] }))] }));
|
|
53
17
|
}
|
|
54
|
-
//#endregion
|
|
55
|
-
export { u as ApiKey };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export type ApiKeysEmptyProps = {
|
|
2
2
|
onCreatePress: () => void;
|
|
3
|
+
/** Hide the empty-state "Create API key" button. */
|
|
4
|
+
hideCreate?: boolean;
|
|
3
5
|
};
|
|
4
|
-
export declare function ApiKeysEmpty({ onCreatePress }: ApiKeysEmptyProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function ApiKeysEmpty({ onCreatePress, hideCreate }: ApiKeysEmptyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,35 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useAuthPlugin
|
|
3
|
-
import { Key
|
|
4
|
-
import { Button
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return /* @__PURE__ */ a("div", {
|
|
10
|
-
className: "flex flex-col items-center justify-center gap-4",
|
|
11
|
-
children: [
|
|
12
|
-
/* @__PURE__ */ i("div", {
|
|
13
|
-
className: "flex size-10 items-center justify-center rounded-xl bg-surface-secondary",
|
|
14
|
-
children: /* @__PURE__ */ i(n, { className: "size-4.5" })
|
|
15
|
-
}),
|
|
16
|
-
/* @__PURE__ */ a("div", {
|
|
17
|
-
className: "flex flex-col items-center justify-center gap-1 text-center",
|
|
18
|
-
children: [/* @__PURE__ */ i("p", {
|
|
19
|
-
className: "text-sm font-semibold",
|
|
20
|
-
children: s.noApiKeys
|
|
21
|
-
}), /* @__PURE__ */ i("p", {
|
|
22
|
-
className: "text-muted text-xs",
|
|
23
|
-
children: s.apiKeysDescription
|
|
24
|
-
})]
|
|
25
|
-
}),
|
|
26
|
-
/* @__PURE__ */ i(r, {
|
|
27
|
-
size: "sm",
|
|
28
|
-
onPress: o,
|
|
29
|
-
children: s.createApiKey
|
|
30
|
-
})
|
|
31
|
-
]
|
|
32
|
-
});
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useAuthPlugin } from "@better-auth-ui/react";
|
|
3
|
+
import { Key } from "@gravity-ui/icons";
|
|
4
|
+
import { Button } from "@heroui/react";
|
|
5
|
+
import { apiKeyPlugin } from "../../../lib/auth/api-key-plugin";
|
|
6
|
+
export function ApiKeysEmpty({ onCreatePress, hideCreate }) {
|
|
7
|
+
const { localization: apiKeyLocalization } = useAuthPlugin(apiKeyPlugin);
|
|
8
|
+
return (_jsxs("div", { className: "flex flex-col items-center justify-center gap-4", children: [_jsx("div", { className: "flex size-10 items-center justify-center rounded-xl bg-surface-secondary", children: _jsx(Key, { className: "size-4.5" }) }), _jsxs("div", { className: "flex flex-col items-center justify-center gap-1 text-center", children: [_jsx("p", { className: "text-sm font-semibold", children: apiKeyLocalization.noApiKeys }), _jsx("p", { className: "text-muted text-xs", children: apiKeyLocalization.apiKeysDescription })] }), !hideCreate && (_jsx(Button, { size: "sm", onPress: onCreatePress, children: apiKeyLocalization.createApiKey }))] }));
|
|
33
9
|
}
|
|
34
|
-
//#endregion
|
|
35
|
-
export { o as ApiKeysEmpty };
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import { CardProps } from
|
|
1
|
+
import { type CardProps } from "@heroui/react";
|
|
2
2
|
export type ApiKeysProps = {
|
|
3
3
|
className?: string;
|
|
4
4
|
variant?: CardProps["variant"];
|
|
5
|
+
/** Scope the list and create payload to an organization. */
|
|
6
|
+
organizationId?: string;
|
|
7
|
+
/** Force the loading skeleton and disable the list query. */
|
|
8
|
+
isPending?: boolean;
|
|
9
|
+
/** Hide the "Create API key" button (header + empty state). */
|
|
10
|
+
hideCreate?: boolean;
|
|
11
|
+
/** Hide the per-row delete button on listed keys. */
|
|
12
|
+
hideDelete?: boolean;
|
|
5
13
|
};
|
|
6
|
-
export declare function ApiKeys({ className, variant }: ApiKeysProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function ApiKeys({ className, variant, organizationId, isPending: isPendingProp, hideCreate, hideDelete }: ApiKeysProps): import("react/jsx-runtime").JSX.Element;
|