@omnibase/shadcn 0.3.0 → 0.4.0

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/index.cjs CHANGED
@@ -32,7 +32,8 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  CustomFlowForm: () => CustomFlowForm,
34
34
  PricingTable: () => PricingTable,
35
- SwitchActiveTenant: () => SwitchActiveTenant
35
+ SwitchActiveTenant: () => SwitchActiveTenant,
36
+ TenantCreator: () => TenantCreator
36
37
  });
37
38
  module.exports = __toCommonJS(index_exports);
38
39
 
@@ -939,9 +940,169 @@ function PricingTable({
939
940
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "hidden lg:block", children: sortedProducts.length <= 3 ? staticLayout : desktopCarousel })
940
941
  ] });
941
942
  }
943
+
944
+ // src/tenant-creator/index.tsx
945
+ var import_react = require("react");
946
+ var import_jsx_runtime11 = require("react/jsx-runtime");
947
+ function TenantCreator({
948
+ config = {},
949
+ formActions = {},
950
+ className
951
+ }) {
952
+ const [mode, setMode] = (0, import_react.useState)(
953
+ config.defaultMode || "create"
954
+ );
955
+ const [isLoading, setIsLoading] = (0, import_react.useState)(false);
956
+ const [organizationName, setOrganizationName] = (0, import_react.useState)(
957
+ config.createForm?.organizationName?.defaultValue || ""
958
+ );
959
+ const [billingEmail, setBillingEmail] = (0, import_react.useState)(
960
+ config.createForm?.billingEmail?.defaultValue || ""
961
+ );
962
+ const [token, setToken] = (0, import_react.useState)(
963
+ config.joinForm?.token?.defaultValue || ""
964
+ );
965
+ const handleCreateSubmit = async (e) => {
966
+ e.preventDefault();
967
+ if (!formActions.onCreateOrganization) return;
968
+ setIsLoading(true);
969
+ try {
970
+ await formActions.onCreateOrganization({
971
+ organizationName,
972
+ billingEmail
973
+ });
974
+ } finally {
975
+ setIsLoading(false);
976
+ }
977
+ };
978
+ const handleJoinSubmit = async (e) => {
979
+ e.preventDefault();
980
+ if (!formActions.onJoinOrganization) return;
981
+ setIsLoading(true);
982
+ try {
983
+ await formActions.onJoinOrganization({
984
+ token
985
+ });
986
+ } finally {
987
+ setIsLoading(false);
988
+ }
989
+ };
990
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Card, { className: cn("w-full max-w-md mx-auto", className), children: [
991
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(CardHeader, { children: [
992
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CardTitle, { children: "Organization Setup" }),
993
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CardDescription, { children: "Choose how you want to get started with your organization." })
994
+ ] }),
995
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(CardContent, { className: "space-y-6", children: [
996
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "grid grid-cols-2 rounded-lg bg-muted p-1", children: [
997
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
998
+ "label",
999
+ {
1000
+ className: cn(
1001
+ "flex cursor-pointer items-center justify-center rounded-md px-3 py-2 text-sm font-medium transition-all",
1002
+ mode === "create" ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground",
1003
+ isLoading && "pointer-events-none opacity-50"
1004
+ ),
1005
+ children: [
1006
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1007
+ "input",
1008
+ {
1009
+ type: "radio",
1010
+ name: "mode",
1011
+ value: "create",
1012
+ checked: mode === "create",
1013
+ onChange: () => setMode("create"),
1014
+ className: "sr-only",
1015
+ disabled: isLoading
1016
+ }
1017
+ ),
1018
+ config.createOrganizationText || "Create Organization"
1019
+ ]
1020
+ }
1021
+ ),
1022
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1023
+ "label",
1024
+ {
1025
+ className: cn(
1026
+ "flex cursor-pointer items-center justify-center rounded-md px-3 py-2 text-sm font-medium transition-all",
1027
+ mode === "join" ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground",
1028
+ isLoading && "pointer-events-none opacity-50"
1029
+ ),
1030
+ children: [
1031
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1032
+ "input",
1033
+ {
1034
+ type: "radio",
1035
+ name: "mode",
1036
+ value: "join",
1037
+ checked: mode === "join",
1038
+ onChange: () => setMode("join"),
1039
+ className: "sr-only",
1040
+ disabled: isLoading
1041
+ }
1042
+ ),
1043
+ config.joinOrganizationText || "Join Organization"
1044
+ ]
1045
+ }
1046
+ )
1047
+ ] }),
1048
+ mode === "create" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("form", { onSubmit: handleCreateSubmit, className: "space-y-4", children: [
1049
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-2", children: [
1050
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Label, { htmlFor: "organizationName", children: config.createForm?.organizationName?.label || "Organization Name" }),
1051
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1052
+ Input,
1053
+ {
1054
+ id: "organizationName",
1055
+ type: "text",
1056
+ placeholder: config.createForm?.organizationName?.placeholder || "Enter organization name",
1057
+ value: organizationName,
1058
+ onChange: (e) => setOrganizationName(e.target.value),
1059
+ required: true,
1060
+ disabled: isLoading
1061
+ }
1062
+ )
1063
+ ] }),
1064
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-2", children: [
1065
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Label, { htmlFor: "billingEmail", children: config.createForm?.billingEmail?.label || "Billing Email" }),
1066
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1067
+ Input,
1068
+ {
1069
+ id: "billingEmail",
1070
+ type: "email",
1071
+ placeholder: config.createForm?.billingEmail?.placeholder || "Enter billing email",
1072
+ value: billingEmail,
1073
+ onChange: (e) => setBillingEmail(e.target.value),
1074
+ required: true,
1075
+ disabled: isLoading
1076
+ }
1077
+ )
1078
+ ] }),
1079
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { type: "submit", className: "w-full", disabled: isLoading, children: isLoading ? "Creating..." : "Create Organization" })
1080
+ ] }),
1081
+ mode === "join" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("form", { onSubmit: handleJoinSubmit, className: "space-y-4", children: [
1082
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-2", children: [
1083
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Label, { htmlFor: "token", children: config.joinForm?.token?.label || "Invitation Token" }),
1084
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1085
+ Input,
1086
+ {
1087
+ id: "token",
1088
+ type: "text",
1089
+ placeholder: config.joinForm?.token?.placeholder || "Enter invitation token",
1090
+ value: token,
1091
+ onChange: (e) => setToken(e.target.value),
1092
+ required: true,
1093
+ disabled: isLoading
1094
+ }
1095
+ )
1096
+ ] }),
1097
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { type: "submit", className: "w-full", disabled: isLoading, children: isLoading ? "Joining..." : "Join Organization" })
1098
+ ] })
1099
+ ] })
1100
+ ] });
1101
+ }
942
1102
  // Annotate the CommonJS export names for ESM import in node:
943
1103
  0 && (module.exports = {
944
1104
  CustomFlowForm,
945
1105
  PricingTable,
946
- SwitchActiveTenant
1106
+ SwitchActiveTenant,
1107
+ TenantCreator
947
1108
  });
package/dist/index.d.cts CHANGED
@@ -49,4 +49,44 @@ interface PricingTableProps {
49
49
  }
50
50
  declare function PricingTable({ products, selectedPriceId, onPriceSelect, className, showPricingToggle, defaultInterval, }: PricingTableProps): react_jsx_runtime.JSX.Element;
51
51
 
52
- export { CustomFlowForm, type CustomFormProps, type FlowType, PricingTable, type PricingTableProps, SwitchActiveTenant, type SwitchActiveTenantProps };
52
+ interface TenantCreatorConfig {
53
+ createOrganizationText?: string;
54
+ joinOrganizationText?: string;
55
+ defaultMode?: "create" | "join";
56
+ createForm?: {
57
+ organizationName?: {
58
+ label?: string;
59
+ placeholder?: string;
60
+ defaultValue?: string;
61
+ };
62
+ billingEmail?: {
63
+ label?: string;
64
+ placeholder?: string;
65
+ defaultValue?: string;
66
+ };
67
+ };
68
+ joinForm?: {
69
+ token?: {
70
+ label?: string;
71
+ placeholder?: string;
72
+ defaultValue?: string;
73
+ };
74
+ };
75
+ }
76
+ interface TenantCreatorFormActions {
77
+ onCreateOrganization?: (data: {
78
+ organizationName: string;
79
+ billingEmail: string;
80
+ }) => void | Promise<void>;
81
+ onJoinOrganization?: (data: {
82
+ token: string;
83
+ }) => void | Promise<void>;
84
+ }
85
+ interface TenantCreatorProps {
86
+ config?: TenantCreatorConfig;
87
+ formActions?: TenantCreatorFormActions;
88
+ className?: string;
89
+ }
90
+ declare function TenantCreator({ config, formActions, className, }: TenantCreatorProps): react_jsx_runtime.JSX.Element;
91
+
92
+ export { CustomFlowForm, type CustomFormProps, type FlowType, PricingTable, type PricingTableProps, SwitchActiveTenant, type SwitchActiveTenantProps, TenantCreator, type TenantCreatorConfig, type TenantCreatorFormActions, type TenantCreatorProps };
package/dist/index.d.ts CHANGED
@@ -49,4 +49,44 @@ interface PricingTableProps {
49
49
  }
50
50
  declare function PricingTable({ products, selectedPriceId, onPriceSelect, className, showPricingToggle, defaultInterval, }: PricingTableProps): react_jsx_runtime.JSX.Element;
51
51
 
52
- export { CustomFlowForm, type CustomFormProps, type FlowType, PricingTable, type PricingTableProps, SwitchActiveTenant, type SwitchActiveTenantProps };
52
+ interface TenantCreatorConfig {
53
+ createOrganizationText?: string;
54
+ joinOrganizationText?: string;
55
+ defaultMode?: "create" | "join";
56
+ createForm?: {
57
+ organizationName?: {
58
+ label?: string;
59
+ placeholder?: string;
60
+ defaultValue?: string;
61
+ };
62
+ billingEmail?: {
63
+ label?: string;
64
+ placeholder?: string;
65
+ defaultValue?: string;
66
+ };
67
+ };
68
+ joinForm?: {
69
+ token?: {
70
+ label?: string;
71
+ placeholder?: string;
72
+ defaultValue?: string;
73
+ };
74
+ };
75
+ }
76
+ interface TenantCreatorFormActions {
77
+ onCreateOrganization?: (data: {
78
+ organizationName: string;
79
+ billingEmail: string;
80
+ }) => void | Promise<void>;
81
+ onJoinOrganization?: (data: {
82
+ token: string;
83
+ }) => void | Promise<void>;
84
+ }
85
+ interface TenantCreatorProps {
86
+ config?: TenantCreatorConfig;
87
+ formActions?: TenantCreatorFormActions;
88
+ className?: string;
89
+ }
90
+ declare function TenantCreator({ config, formActions, className, }: TenantCreatorProps): react_jsx_runtime.JSX.Element;
91
+
92
+ export { CustomFlowForm, type CustomFormProps, type FlowType, PricingTable, type PricingTableProps, SwitchActiveTenant, type SwitchActiveTenantProps, TenantCreator, type TenantCreatorConfig, type TenantCreatorFormActions, type TenantCreatorProps };
package/dist/index.js CHANGED
@@ -901,8 +901,168 @@ function PricingTable({
901
901
  /* @__PURE__ */ jsx10("div", { className: "hidden lg:block", children: sortedProducts.length <= 3 ? staticLayout : desktopCarousel })
902
902
  ] });
903
903
  }
904
+
905
+ // src/tenant-creator/index.tsx
906
+ import { useState as useState3 } from "react";
907
+ import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
908
+ function TenantCreator({
909
+ config = {},
910
+ formActions = {},
911
+ className
912
+ }) {
913
+ const [mode, setMode] = useState3(
914
+ config.defaultMode || "create"
915
+ );
916
+ const [isLoading, setIsLoading] = useState3(false);
917
+ const [organizationName, setOrganizationName] = useState3(
918
+ config.createForm?.organizationName?.defaultValue || ""
919
+ );
920
+ const [billingEmail, setBillingEmail] = useState3(
921
+ config.createForm?.billingEmail?.defaultValue || ""
922
+ );
923
+ const [token, setToken] = useState3(
924
+ config.joinForm?.token?.defaultValue || ""
925
+ );
926
+ const handleCreateSubmit = async (e) => {
927
+ e.preventDefault();
928
+ if (!formActions.onCreateOrganization) return;
929
+ setIsLoading(true);
930
+ try {
931
+ await formActions.onCreateOrganization({
932
+ organizationName,
933
+ billingEmail
934
+ });
935
+ } finally {
936
+ setIsLoading(false);
937
+ }
938
+ };
939
+ const handleJoinSubmit = async (e) => {
940
+ e.preventDefault();
941
+ if (!formActions.onJoinOrganization) return;
942
+ setIsLoading(true);
943
+ try {
944
+ await formActions.onJoinOrganization({
945
+ token
946
+ });
947
+ } finally {
948
+ setIsLoading(false);
949
+ }
950
+ };
951
+ return /* @__PURE__ */ jsxs5(Card, { className: cn("w-full max-w-md mx-auto", className), children: [
952
+ /* @__PURE__ */ jsxs5(CardHeader, { children: [
953
+ /* @__PURE__ */ jsx11(CardTitle, { children: "Organization Setup" }),
954
+ /* @__PURE__ */ jsx11(CardDescription, { children: "Choose how you want to get started with your organization." })
955
+ ] }),
956
+ /* @__PURE__ */ jsxs5(CardContent, { className: "space-y-6", children: [
957
+ /* @__PURE__ */ jsxs5("div", { className: "grid grid-cols-2 rounded-lg bg-muted p-1", children: [
958
+ /* @__PURE__ */ jsxs5(
959
+ "label",
960
+ {
961
+ className: cn(
962
+ "flex cursor-pointer items-center justify-center rounded-md px-3 py-2 text-sm font-medium transition-all",
963
+ mode === "create" ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground",
964
+ isLoading && "pointer-events-none opacity-50"
965
+ ),
966
+ children: [
967
+ /* @__PURE__ */ jsx11(
968
+ "input",
969
+ {
970
+ type: "radio",
971
+ name: "mode",
972
+ value: "create",
973
+ checked: mode === "create",
974
+ onChange: () => setMode("create"),
975
+ className: "sr-only",
976
+ disabled: isLoading
977
+ }
978
+ ),
979
+ config.createOrganizationText || "Create Organization"
980
+ ]
981
+ }
982
+ ),
983
+ /* @__PURE__ */ jsxs5(
984
+ "label",
985
+ {
986
+ className: cn(
987
+ "flex cursor-pointer items-center justify-center rounded-md px-3 py-2 text-sm font-medium transition-all",
988
+ mode === "join" ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground",
989
+ isLoading && "pointer-events-none opacity-50"
990
+ ),
991
+ children: [
992
+ /* @__PURE__ */ jsx11(
993
+ "input",
994
+ {
995
+ type: "radio",
996
+ name: "mode",
997
+ value: "join",
998
+ checked: mode === "join",
999
+ onChange: () => setMode("join"),
1000
+ className: "sr-only",
1001
+ disabled: isLoading
1002
+ }
1003
+ ),
1004
+ config.joinOrganizationText || "Join Organization"
1005
+ ]
1006
+ }
1007
+ )
1008
+ ] }),
1009
+ mode === "create" && /* @__PURE__ */ jsxs5("form", { onSubmit: handleCreateSubmit, className: "space-y-4", children: [
1010
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
1011
+ /* @__PURE__ */ jsx11(Label, { htmlFor: "organizationName", children: config.createForm?.organizationName?.label || "Organization Name" }),
1012
+ /* @__PURE__ */ jsx11(
1013
+ Input,
1014
+ {
1015
+ id: "organizationName",
1016
+ type: "text",
1017
+ placeholder: config.createForm?.organizationName?.placeholder || "Enter organization name",
1018
+ value: organizationName,
1019
+ onChange: (e) => setOrganizationName(e.target.value),
1020
+ required: true,
1021
+ disabled: isLoading
1022
+ }
1023
+ )
1024
+ ] }),
1025
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
1026
+ /* @__PURE__ */ jsx11(Label, { htmlFor: "billingEmail", children: config.createForm?.billingEmail?.label || "Billing Email" }),
1027
+ /* @__PURE__ */ jsx11(
1028
+ Input,
1029
+ {
1030
+ id: "billingEmail",
1031
+ type: "email",
1032
+ placeholder: config.createForm?.billingEmail?.placeholder || "Enter billing email",
1033
+ value: billingEmail,
1034
+ onChange: (e) => setBillingEmail(e.target.value),
1035
+ required: true,
1036
+ disabled: isLoading
1037
+ }
1038
+ )
1039
+ ] }),
1040
+ /* @__PURE__ */ jsx11(Button, { type: "submit", className: "w-full", disabled: isLoading, children: isLoading ? "Creating..." : "Create Organization" })
1041
+ ] }),
1042
+ mode === "join" && /* @__PURE__ */ jsxs5("form", { onSubmit: handleJoinSubmit, className: "space-y-4", children: [
1043
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
1044
+ /* @__PURE__ */ jsx11(Label, { htmlFor: "token", children: config.joinForm?.token?.label || "Invitation Token" }),
1045
+ /* @__PURE__ */ jsx11(
1046
+ Input,
1047
+ {
1048
+ id: "token",
1049
+ type: "text",
1050
+ placeholder: config.joinForm?.token?.placeholder || "Enter invitation token",
1051
+ value: token,
1052
+ onChange: (e) => setToken(e.target.value),
1053
+ required: true,
1054
+ disabled: isLoading
1055
+ }
1056
+ )
1057
+ ] }),
1058
+ /* @__PURE__ */ jsx11(Button, { type: "submit", className: "w-full", disabled: isLoading, children: isLoading ? "Joining..." : "Join Organization" })
1059
+ ] })
1060
+ ] })
1061
+ ] });
1062
+ }
904
1063
  export {
905
1064
  CustomFlowForm,
906
1065
  PricingTable,
907
- SwitchActiveTenant
1066
+ SwitchActiveTenant,
1067
+ TenantCreator
908
1068
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnibase/shadcn",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "OmniBase ShadCN UI Package",
5
5
  "type": "module",
6
6
  "exports": {