@better-auth-ui/heroui 1.6.21 → 1.6.22
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/plugins.js
CHANGED
|
@@ -731,17 +731,17 @@ function Vt({ value: e, onChange: t, currentSlug: n, variant: r, ...i }) {
|
|
|
731
731
|
//#endregion
|
|
732
732
|
//#region src/components/auth/organization/create-organization-dialog.tsx
|
|
733
733
|
function Ht({ isOpen: e, onOpenChange: t }) {
|
|
734
|
-
let { authClient: n, localization: r } = p(), { localization: i } = m($), [a, o] = q(""), [s, c] = q(""), { mutate:
|
|
734
|
+
let { authClient: n, localization: r } = p(), { localization: i } = m($), [a, o] = q(""), [s, c] = q(""), [l, u] = q(!1), { mutate: d, isPending: f } = y(n, { onSuccess: () => t(!1) });
|
|
735
735
|
return at(() => {
|
|
736
|
-
e || (c(""), o(""));
|
|
736
|
+
e || (c(""), o(""), u(!1));
|
|
737
737
|
}, [e]), at(() => {
|
|
738
|
-
c(Bt(a));
|
|
739
|
-
}, [a]), /* @__PURE__ */ Y(O.Backdrop, {
|
|
738
|
+
l || c(Bt(a));
|
|
739
|
+
}, [a, l]), /* @__PURE__ */ Y(O.Backdrop, {
|
|
740
740
|
isOpen: e,
|
|
741
741
|
onOpenChange: t,
|
|
742
742
|
children: /* @__PURE__ */ Y(O.Container, { children: /* @__PURE__ */ Y(O.Dialog, { children: /* @__PURE__ */ X(P, {
|
|
743
743
|
onSubmit: (e) => {
|
|
744
|
-
e.preventDefault(),
|
|
744
|
+
e.preventDefault(), d({
|
|
745
745
|
name: a,
|
|
746
746
|
slug: s
|
|
747
747
|
});
|
|
@@ -762,7 +762,7 @@ function Ht({ isOpen: e, onOpenChange: t }) {
|
|
|
762
762
|
/* @__PURE__ */ X(W, {
|
|
763
763
|
id: "name",
|
|
764
764
|
name: "name",
|
|
765
|
-
isDisabled:
|
|
765
|
+
isDisabled: f,
|
|
766
766
|
value: a,
|
|
767
767
|
onChange: o,
|
|
768
768
|
validate: (e) => {
|
|
@@ -781,8 +781,10 @@ function Ht({ isOpen: e, onOpenChange: t }) {
|
|
|
781
781
|
}),
|
|
782
782
|
/* @__PURE__ */ Y(Vt, {
|
|
783
783
|
value: s,
|
|
784
|
-
onChange:
|
|
785
|
-
|
|
784
|
+
onChange: (e) => {
|
|
785
|
+
c(e), u(!0);
|
|
786
|
+
},
|
|
787
|
+
isDisabled: f,
|
|
786
788
|
variant: "secondary"
|
|
787
789
|
})
|
|
788
790
|
]
|
|
@@ -790,12 +792,12 @@ function Ht({ isOpen: e, onOpenChange: t }) {
|
|
|
790
792
|
/* @__PURE__ */ X(O.Footer, { children: [/* @__PURE__ */ Y(k, {
|
|
791
793
|
slot: "close",
|
|
792
794
|
variant: "tertiary",
|
|
793
|
-
isDisabled:
|
|
795
|
+
isDisabled: f,
|
|
794
796
|
children: r.settings.cancel
|
|
795
797
|
}), /* @__PURE__ */ X(k, {
|
|
796
798
|
type: "submit",
|
|
797
|
-
isPending:
|
|
798
|
-
children: [
|
|
799
|
+
isPending: f,
|
|
800
|
+
children: [f && /* @__PURE__ */ Y(V, {
|
|
799
801
|
color: "current",
|
|
800
802
|
size: "sm"
|
|
801
803
|
}), i.createOrganization]
|
package/package.json
CHANGED
|
@@ -43,6 +43,7 @@ export function CreateOrganizationDialog({
|
|
|
43
43
|
|
|
44
44
|
const [name, setName] = useState("")
|
|
45
45
|
const [slug, setSlug] = useState("")
|
|
46
|
+
const [slugEdited, setSlugEdited] = useState(false)
|
|
46
47
|
|
|
47
48
|
const { mutate: createOrganization, isPending: isCreating } =
|
|
48
49
|
useCreateOrganization(authClient as OrganizationAuthClient, {
|
|
@@ -58,12 +59,14 @@ export function CreateOrganizationDialog({
|
|
|
58
59
|
if (!isOpen) {
|
|
59
60
|
setSlug("")
|
|
60
61
|
setName("")
|
|
62
|
+
setSlugEdited(false)
|
|
61
63
|
}
|
|
62
64
|
}, [isOpen])
|
|
63
65
|
|
|
64
66
|
useEffect(() => {
|
|
67
|
+
if (slugEdited) return
|
|
65
68
|
setSlug(sanitizeSlug(name))
|
|
66
|
-
}, [name])
|
|
69
|
+
}, [name, slugEdited])
|
|
67
70
|
|
|
68
71
|
return (
|
|
69
72
|
<AlertDialog.Backdrop isOpen={isOpen} onOpenChange={onOpenChange}>
|
|
@@ -111,7 +114,10 @@ export function CreateOrganizationDialog({
|
|
|
111
114
|
|
|
112
115
|
<SlugField
|
|
113
116
|
value={slug}
|
|
114
|
-
onChange={
|
|
117
|
+
onChange={(value) => {
|
|
118
|
+
setSlug(value)
|
|
119
|
+
setSlugEdited(true)
|
|
120
|
+
}}
|
|
115
121
|
isDisabled={isCreating}
|
|
116
122
|
variant="secondary"
|
|
117
123
|
/>
|