@btst/stack 1.8.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/packages/better-stack/src/plugins/cms/api/plugin.cjs +445 -16
  2. package/dist/packages/better-stack/src/plugins/cms/api/plugin.mjs +445 -16
  3. package/dist/packages/better-stack/src/plugins/cms/client/components/forms/content-form.cjs +28 -11
  4. package/dist/packages/better-stack/src/plugins/cms/client/components/forms/content-form.mjs +26 -9
  5. package/dist/packages/better-stack/src/plugins/cms/client/components/forms/relation-field.cjs +224 -0
  6. package/dist/packages/better-stack/src/plugins/cms/client/components/forms/relation-field.mjs +222 -0
  7. package/dist/packages/better-stack/src/plugins/cms/client/components/inverse-relations-panel.cjs +243 -0
  8. package/dist/packages/better-stack/src/plugins/cms/client/components/inverse-relations-panel.mjs +241 -0
  9. package/dist/packages/better-stack/src/plugins/cms/client/components/pages/content-editor-page.internal.cjs +56 -2
  10. package/dist/packages/better-stack/src/plugins/cms/client/components/pages/content-editor-page.internal.mjs +56 -2
  11. package/dist/packages/better-stack/src/plugins/cms/client/hooks/cms-hooks.cjs +190 -0
  12. package/dist/packages/better-stack/src/plugins/cms/client/hooks/cms-hooks.mjs +187 -1
  13. package/dist/packages/better-stack/src/plugins/cms/db.cjs +38 -0
  14. package/dist/packages/better-stack/src/plugins/cms/db.mjs +38 -0
  15. package/dist/packages/better-stack/src/plugins/form-builder/client/components/forms/form-renderer.cjs +2 -2
  16. package/dist/packages/better-stack/src/plugins/form-builder/client/components/forms/form-renderer.mjs +1 -1
  17. package/dist/packages/ui/src/components/auto-form/fields/array.cjs +2 -2
  18. package/dist/packages/ui/src/components/auto-form/fields/array.mjs +1 -1
  19. package/dist/packages/ui/src/components/auto-form/fields/date.cjs +2 -2
  20. package/dist/packages/ui/src/components/auto-form/fields/date.mjs +1 -1
  21. package/dist/packages/ui/src/components/auto-form/fields/enum.cjs +2 -2
  22. package/dist/packages/ui/src/components/auto-form/fields/enum.mjs +1 -1
  23. package/dist/packages/ui/src/components/auto-form/fields/object.cjs +88 -8
  24. package/dist/packages/ui/src/components/auto-form/fields/object.mjs +82 -2
  25. package/dist/packages/ui/src/components/auto-form/fields/radio-group.cjs +2 -2
  26. package/dist/packages/ui/src/components/auto-form/fields/radio-group.mjs +1 -1
  27. package/dist/packages/ui/src/components/auto-form/index.cjs +5 -5
  28. package/dist/packages/ui/src/components/auto-form/index.mjs +1 -1
  29. package/dist/packages/ui/src/components/button.cjs +4 -2
  30. package/dist/packages/ui/src/components/button.mjs +4 -2
  31. package/dist/packages/ui/src/components/dialog.cjs +7 -1
  32. package/dist/packages/ui/src/components/dialog.mjs +7 -2
  33. package/dist/packages/ui/src/components/form-builder/edit-field-dialog.cjs +2 -2
  34. package/dist/packages/ui/src/components/form-builder/edit-field-dialog.mjs +1 -1
  35. package/dist/packages/ui/src/components/form-builder/form-preview.cjs +5 -5
  36. package/dist/packages/ui/src/components/form-builder/form-preview.mjs +1 -1
  37. package/dist/packages/ui/src/components/select.cjs +9 -2
  38. package/dist/packages/ui/src/components/select.mjs +9 -2
  39. package/dist/plugins/blog/api/index.d.cts +1 -1
  40. package/dist/plugins/blog/api/index.d.mts +1 -1
  41. package/dist/plugins/blog/api/index.d.ts +1 -1
  42. package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
  43. package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
  44. package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
  45. package/dist/plugins/blog/client/index.d.cts +1 -1
  46. package/dist/plugins/blog/client/index.d.mts +1 -1
  47. package/dist/plugins/blog/client/index.d.ts +1 -1
  48. package/dist/plugins/blog/query-keys.d.cts +2 -2
  49. package/dist/plugins/blog/query-keys.d.mts +2 -2
  50. package/dist/plugins/blog/query-keys.d.ts +2 -2
  51. package/dist/plugins/cms/api/index.d.cts +66 -2
  52. package/dist/plugins/cms/api/index.d.mts +66 -2
  53. package/dist/plugins/cms/api/index.d.ts +66 -2
  54. package/dist/plugins/cms/client/hooks/index.cjs +4 -0
  55. package/dist/plugins/cms/client/hooks/index.d.cts +82 -3
  56. package/dist/plugins/cms/client/hooks/index.d.mts +82 -3
  57. package/dist/plugins/cms/client/hooks/index.d.ts +82 -3
  58. package/dist/plugins/cms/client/hooks/index.mjs +1 -1
  59. package/dist/plugins/cms/client/index.d.cts +2 -2
  60. package/dist/plugins/cms/client/index.d.mts +2 -2
  61. package/dist/plugins/cms/client/index.d.ts +2 -2
  62. package/dist/plugins/cms/query-keys.d.cts +1 -1
  63. package/dist/plugins/cms/query-keys.d.mts +1 -1
  64. package/dist/plugins/cms/query-keys.d.ts +1 -1
  65. package/dist/plugins/form-builder/client/components/index.d.cts +1 -1
  66. package/dist/plugins/form-builder/client/components/index.d.mts +1 -1
  67. package/dist/plugins/form-builder/client/components/index.d.ts +1 -1
  68. package/dist/plugins/form-builder/client/index.d.cts +2 -2
  69. package/dist/plugins/form-builder/client/index.d.mts +2 -2
  70. package/dist/plugins/form-builder/client/index.d.ts +2 -2
  71. package/dist/shared/{stack.AX5nZ6A3.d.ts → stack.Co034Fpm.d.cts} +0 -21
  72. package/dist/shared/{stack.AX5nZ6A3.d.cts → stack.Co034Fpm.d.mts} +0 -21
  73. package/dist/shared/{stack.AX5nZ6A3.d.mts → stack.Co034Fpm.d.ts} +0 -21
  74. package/dist/shared/{stack.BIh2AXaW.d.cts → stack.DGjhPqmF.d.cts} +0 -9
  75. package/dist/shared/{stack.BIh2AXaW.d.mts → stack.DGjhPqmF.d.mts} +0 -9
  76. package/dist/shared/{stack.BIh2AXaW.d.ts → stack.DGjhPqmF.d.ts} +0 -9
  77. package/dist/shared/{stack.L-UFwz2G.d.mts → stack.oGOteE6g.d.cts} +27 -5
  78. package/dist/shared/{stack.L-UFwz2G.d.cts → stack.oGOteE6g.d.mts} +27 -5
  79. package/dist/shared/{stack.L-UFwz2G.d.ts → stack.oGOteE6g.d.ts} +27 -5
  80. package/package.json +1 -1
  81. package/src/plugins/cms/api/plugin.ts +667 -21
  82. package/src/plugins/cms/client/components/forms/content-form.tsx +62 -20
  83. package/src/plugins/cms/client/components/forms/relation-field.tsx +299 -0
  84. package/src/plugins/cms/client/components/inverse-relations-panel.tsx +329 -0
  85. package/src/plugins/cms/client/components/pages/content-editor-page.internal.tsx +127 -1
  86. package/src/plugins/cms/client/hooks/cms-hooks.tsx +344 -0
  87. package/src/plugins/cms/db.ts +38 -0
  88. package/src/plugins/cms/types.ts +99 -10
  89. package/src/plugins/form-builder/client/components/forms/form-renderer.tsx +1 -1
  90. package/dist/packages/ui/src/components/auto-form/{utils.cjs → helpers.cjs} +0 -0
  91. package/dist/packages/ui/src/components/auto-form/{utils.mjs → helpers.mjs} +0 -0
  92. package/dist/shared/{stack.DLhzx1-D.d.mts → stack.CcI4sYJP.d.cts} +1 -1
  93. package/dist/shared/{stack.DLhzx1-D.d.cts → stack.CcI4sYJP.d.mts} +1 -1
  94. package/dist/shared/{stack.DLhzx1-D.d.ts → stack.CcI4sYJP.d.ts} +1 -1
@@ -6,7 +6,7 @@ const form = require('../../form.cjs');
6
6
  const reactHookForm = require('react-hook-form');
7
7
  const z = require('zod');
8
8
  const config = require('../config.cjs');
9
- const utils = require('../utils.cjs');
9
+ const helpers = require('../helpers.cjs');
10
10
  const array = require('./array.cjs');
11
11
  const dependencies = require('../dependencies.cjs');
12
12
 
@@ -38,7 +38,7 @@ function AutoFormObject({
38
38
  if (!schema) {
39
39
  return null;
40
40
  }
41
- const { shape } = utils.getBaseSchema(schema) || {};
41
+ const { shape } = helpers.getBaseSchema(schema) || {};
42
42
  if (!shape) {
43
43
  return null;
44
44
  }
@@ -55,12 +55,12 @@ function AutoFormObject({
55
55
  }
56
56
  return item;
57
57
  };
58
- const sortedFieldKeys = utils.sortFieldsByOrder(fieldConfig, Object.keys(shape));
58
+ const sortedFieldKeys = helpers.sortFieldsByOrder(fieldConfig, Object.keys(shape));
59
59
  return /* @__PURE__ */ jsxRuntime.jsx(accordion.Accordion, { type: "multiple", className: "space-y-5 border-none", children: sortedFieldKeys.map((name) => {
60
60
  let item = shape[name];
61
61
  item = handleIfZodNumber(item);
62
- const zodBaseType = utils.getBaseType(item);
63
- const itemName = utils.beautifyObjectName(name);
62
+ const zodBaseType = helpers.getBaseType(item);
63
+ const itemName = helpers.beautifyObjectName(name);
64
64
  const key = [...path, name].join(".");
65
65
  const {
66
66
  isHidden,
@@ -72,6 +72,46 @@ function AutoFormObject({
72
72
  return null;
73
73
  }
74
74
  if (zodBaseType === "ZodObject") {
75
+ const objectFieldConfig = fieldConfig?.[name] ?? {};
76
+ if (typeof objectFieldConfig.fieldType === "function") {
77
+ const zodInputProps2 = helpers.zodToHtmlInputProps(item);
78
+ let isRequired2 = isRequiredByDependency || zodInputProps2.required || false;
79
+ if (objectFieldConfig.inputProps?.required !== void 0) {
80
+ isRequired2 = objectFieldConfig.inputProps.required;
81
+ }
82
+ const CustomComponent = objectFieldConfig.fieldType;
83
+ const ParentElement = objectFieldConfig.renderParent ?? DefaultParent;
84
+ return /* @__PURE__ */ jsxRuntime.jsx(
85
+ form.FormField,
86
+ {
87
+ control: form$1.control,
88
+ name: key,
89
+ render: ({ field }) => {
90
+ const fieldProps = {
91
+ ...zodInputProps2,
92
+ ...field,
93
+ ...objectFieldConfig.inputProps,
94
+ disabled: objectFieldConfig.inputProps?.disabled || isDisabled,
95
+ ref: void 0,
96
+ value: field.value
97
+ };
98
+ return /* @__PURE__ */ jsxRuntime.jsx(ParentElement, { children: /* @__PURE__ */ jsxRuntime.jsx(
99
+ CustomComponent,
100
+ {
101
+ zodInputProps: zodInputProps2,
102
+ field,
103
+ fieldConfigItem: objectFieldConfig,
104
+ label: objectFieldConfig.label || itemName,
105
+ isRequired: isRequired2,
106
+ zodItem: item,
107
+ fieldProps
108
+ }
109
+ ) }, `${key}.parent`);
110
+ }
111
+ },
112
+ key
113
+ );
114
+ }
75
115
  return /* @__PURE__ */ jsxRuntime.jsxs(accordion.AccordionItem, { value: name, className: "border-none", children: [
76
116
  /* @__PURE__ */ jsxRuntime.jsx(accordion.AccordionTrigger, { children: itemName }),
77
117
  /* @__PURE__ */ jsxRuntime.jsx(accordion.AccordionContent, { className: "p-2", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -86,20 +126,60 @@ function AutoFormObject({
86
126
  ] }, key);
87
127
  }
88
128
  if (zodBaseType === "ZodArray") {
129
+ const arrayFieldConfig = fieldConfig?.[name] ?? {};
130
+ if (typeof arrayFieldConfig.fieldType === "function") {
131
+ const zodInputProps2 = helpers.zodToHtmlInputProps(item);
132
+ let isRequired2 = isRequiredByDependency || zodInputProps2.required || false;
133
+ if (arrayFieldConfig.inputProps?.required !== void 0) {
134
+ isRequired2 = arrayFieldConfig.inputProps.required;
135
+ }
136
+ const CustomComponent = arrayFieldConfig.fieldType;
137
+ const ParentElement = arrayFieldConfig.renderParent ?? DefaultParent;
138
+ return /* @__PURE__ */ jsxRuntime.jsx(
139
+ form.FormField,
140
+ {
141
+ control: form$1.control,
142
+ name: key,
143
+ render: ({ field }) => {
144
+ const fieldProps = {
145
+ ...zodInputProps2,
146
+ ...field,
147
+ ...arrayFieldConfig.inputProps,
148
+ disabled: arrayFieldConfig.inputProps?.disabled || isDisabled,
149
+ ref: void 0,
150
+ value: field.value
151
+ };
152
+ return /* @__PURE__ */ jsxRuntime.jsx(ParentElement, { children: /* @__PURE__ */ jsxRuntime.jsx(
153
+ CustomComponent,
154
+ {
155
+ zodInputProps: zodInputProps2,
156
+ field,
157
+ fieldConfigItem: arrayFieldConfig,
158
+ label: arrayFieldConfig.label || itemName,
159
+ isRequired: isRequired2,
160
+ zodItem: item,
161
+ fieldProps
162
+ }
163
+ ) }, `${key}.parent`);
164
+ }
165
+ },
166
+ key
167
+ );
168
+ }
89
169
  return /* @__PURE__ */ jsxRuntime.jsx(
90
170
  array,
91
171
  {
92
172
  name,
93
173
  item,
94
174
  form: form$1,
95
- fieldConfig: fieldConfig?.[name] ?? {},
175
+ fieldConfig: arrayFieldConfig,
96
176
  path: [...path, name]
97
177
  },
98
178
  key
99
179
  );
100
180
  }
101
181
  const fieldConfigItem = fieldConfig?.[name] ?? {};
102
- const zodInputProps = utils.zodToHtmlInputProps(item);
182
+ const zodInputProps = helpers.zodToHtmlInputProps(item);
103
183
  let isRequired = isRequiredByDependency || zodInputProps.required || false;
104
184
  if (fieldConfigItem.inputProps?.required !== void 0) {
105
185
  isRequired = fieldConfigItem.inputProps.required;
@@ -119,7 +199,7 @@ function AutoFormObject({
119
199
  const defaultValue = fieldConfigItem.inputProps?.defaultValue;
120
200
  const value = field.value ?? defaultValue ?? "";
121
201
  const fieldProps = {
122
- ...utils.zodToHtmlInputProps(item),
202
+ ...helpers.zodToHtmlInputProps(item),
123
203
  ...field,
124
204
  ...fieldConfigItem.inputProps,
125
205
  disabled: fieldConfigItem.inputProps?.disabled || isDisabled,
@@ -4,7 +4,7 @@ import { FormField } from '../../form.mjs';
4
4
  import { useFormContext } from 'react-hook-form';
5
5
  import * as z from 'zod';
6
6
  import { DEFAULT_ZOD_HANDLERS, INPUT_COMPONENTS } from '../config.mjs';
7
- import { getBaseSchema, sortFieldsByOrder, getBaseType, beautifyObjectName, zodToHtmlInputProps } from '../utils.mjs';
7
+ import { getBaseSchema, sortFieldsByOrder, getBaseType, beautifyObjectName, zodToHtmlInputProps } from '../helpers.mjs';
8
8
  import AutoFormArray from './array.mjs';
9
9
  import resolveDependencies from '../dependencies.mjs';
10
10
 
@@ -56,6 +56,46 @@ function AutoFormObject({
56
56
  return null;
57
57
  }
58
58
  if (zodBaseType === "ZodObject") {
59
+ const objectFieldConfig = fieldConfig?.[name] ?? {};
60
+ if (typeof objectFieldConfig.fieldType === "function") {
61
+ const zodInputProps2 = zodToHtmlInputProps(item);
62
+ let isRequired2 = isRequiredByDependency || zodInputProps2.required || false;
63
+ if (objectFieldConfig.inputProps?.required !== void 0) {
64
+ isRequired2 = objectFieldConfig.inputProps.required;
65
+ }
66
+ const CustomComponent = objectFieldConfig.fieldType;
67
+ const ParentElement = objectFieldConfig.renderParent ?? DefaultParent;
68
+ return /* @__PURE__ */ jsx(
69
+ FormField,
70
+ {
71
+ control: form.control,
72
+ name: key,
73
+ render: ({ field }) => {
74
+ const fieldProps = {
75
+ ...zodInputProps2,
76
+ ...field,
77
+ ...objectFieldConfig.inputProps,
78
+ disabled: objectFieldConfig.inputProps?.disabled || isDisabled,
79
+ ref: void 0,
80
+ value: field.value
81
+ };
82
+ return /* @__PURE__ */ jsx(ParentElement, { children: /* @__PURE__ */ jsx(
83
+ CustomComponent,
84
+ {
85
+ zodInputProps: zodInputProps2,
86
+ field,
87
+ fieldConfigItem: objectFieldConfig,
88
+ label: objectFieldConfig.label || itemName,
89
+ isRequired: isRequired2,
90
+ zodItem: item,
91
+ fieldProps
92
+ }
93
+ ) }, `${key}.parent`);
94
+ }
95
+ },
96
+ key
97
+ );
98
+ }
59
99
  return /* @__PURE__ */ jsxs(AccordionItem, { value: name, className: "border-none", children: [
60
100
  /* @__PURE__ */ jsx(AccordionTrigger, { children: itemName }),
61
101
  /* @__PURE__ */ jsx(AccordionContent, { className: "p-2", children: /* @__PURE__ */ jsx(
@@ -70,13 +110,53 @@ function AutoFormObject({
70
110
  ] }, key);
71
111
  }
72
112
  if (zodBaseType === "ZodArray") {
113
+ const arrayFieldConfig = fieldConfig?.[name] ?? {};
114
+ if (typeof arrayFieldConfig.fieldType === "function") {
115
+ const zodInputProps2 = zodToHtmlInputProps(item);
116
+ let isRequired2 = isRequiredByDependency || zodInputProps2.required || false;
117
+ if (arrayFieldConfig.inputProps?.required !== void 0) {
118
+ isRequired2 = arrayFieldConfig.inputProps.required;
119
+ }
120
+ const CustomComponent = arrayFieldConfig.fieldType;
121
+ const ParentElement = arrayFieldConfig.renderParent ?? DefaultParent;
122
+ return /* @__PURE__ */ jsx(
123
+ FormField,
124
+ {
125
+ control: form.control,
126
+ name: key,
127
+ render: ({ field }) => {
128
+ const fieldProps = {
129
+ ...zodInputProps2,
130
+ ...field,
131
+ ...arrayFieldConfig.inputProps,
132
+ disabled: arrayFieldConfig.inputProps?.disabled || isDisabled,
133
+ ref: void 0,
134
+ value: field.value
135
+ };
136
+ return /* @__PURE__ */ jsx(ParentElement, { children: /* @__PURE__ */ jsx(
137
+ CustomComponent,
138
+ {
139
+ zodInputProps: zodInputProps2,
140
+ field,
141
+ fieldConfigItem: arrayFieldConfig,
142
+ label: arrayFieldConfig.label || itemName,
143
+ isRequired: isRequired2,
144
+ zodItem: item,
145
+ fieldProps
146
+ }
147
+ ) }, `${key}.parent`);
148
+ }
149
+ },
150
+ key
151
+ );
152
+ }
73
153
  return /* @__PURE__ */ jsx(
74
154
  AutoFormArray,
75
155
  {
76
156
  name,
77
157
  item,
78
158
  form,
79
- fieldConfig: fieldConfig?.[name] ?? {},
159
+ fieldConfig: arrayFieldConfig,
80
160
  path: [...path, name]
81
161
  },
82
162
  key
@@ -5,7 +5,7 @@ const form = require('../../form.cjs');
5
5
  const radioGroup = require('../../radio-group.cjs');
6
6
  const label = require('../common/label.cjs');
7
7
  const tooltip = require('../common/tooltip.cjs');
8
- const utils = require('../utils.cjs');
8
+ const helpers = require('../helpers.cjs');
9
9
 
10
10
  function getEnumValues(schema) {
11
11
  if (Array.isArray(schema.options)) {
@@ -28,7 +28,7 @@ function AutoFormRadioGroup({
28
28
  fieldProps,
29
29
  fieldConfigItem
30
30
  }) {
31
- const baseSchema = utils.getBaseSchema(zodItem);
31
+ const baseSchema = helpers.getBaseSchema(zodItem);
32
32
  const values = getEnumValues(baseSchema);
33
33
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
34
34
  /* @__PURE__ */ jsxRuntime.jsxs(form.FormItem, { children: [
@@ -3,7 +3,7 @@ import { FormItem, FormControl, FormLabel, FormMessage } from '../../form.mjs';
3
3
  import { RadioGroup, RadioGroupItem } from '../../radio-group.mjs';
4
4
  import AutoFormLabel from '../common/label.mjs';
5
5
  import AutoFormTooltip from '../common/tooltip.mjs';
6
- import { getBaseSchema } from '../utils.mjs';
6
+ import { getBaseSchema } from '../helpers.mjs';
7
7
 
8
8
  function getEnumValues(schema) {
9
9
  if (Array.isArray(schema.options)) {
@@ -6,10 +6,10 @@ const form = require('../form.cjs');
6
6
  const React = require('react');
7
7
  const reactHookForm = require('react-hook-form');
8
8
  require('../button.cjs');
9
- const utils$1 = require('../../lib/utils.cjs');
9
+ const utils = require('../../lib/utils.cjs');
10
10
  const zod = require('@hookform/resolvers/zod');
11
11
  const object = require('./fields/object.cjs');
12
- const utils = require('./utils.cjs');
12
+ const helpers = require('./helpers.cjs');
13
13
 
14
14
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
15
15
 
@@ -26,8 +26,8 @@ function AutoForm({
26
26
  className,
27
27
  dependencies
28
28
  }) {
29
- const objectFormSchema = utils.getObjectFormSchema(formSchema);
30
- const defaultValues = utils.getDefaultValues(objectFormSchema, fieldConfig);
29
+ const objectFormSchema = helpers.getObjectFormSchema(formSchema);
30
+ const defaultValues = helpers.getDefaultValues(objectFormSchema, fieldConfig);
31
31
  const form$1 = reactHookForm.useForm({
32
32
  // Cast to any to handle Zod v4 type compatibility with @hookform/resolvers
33
33
  resolver: zod.zodResolver(formSchema),
@@ -57,7 +57,7 @@ function AutoForm({
57
57
  onSubmit: (e) => {
58
58
  form$1.handleSubmit(onSubmit)(e);
59
59
  },
60
- className: utils$1.cn("space-y-5", className),
60
+ className: utils.cn("space-y-5", className),
61
61
  children: [
62
62
  /* @__PURE__ */ jsxRuntime.jsx(
63
63
  object,
@@ -7,7 +7,7 @@ import '../button.mjs';
7
7
  import { cn } from '../../lib/utils.mjs';
8
8
  import { zodResolver } from '@hookform/resolvers/zod';
9
9
  import AutoFormObject from './fields/object.mjs';
10
- import { getObjectFormSchema, getDefaultValues } from './utils.mjs';
10
+ import { getObjectFormSchema, getDefaultValues } from './helpers.mjs';
11
11
 
12
12
  function AutoForm({
13
13
  formSchema,
@@ -34,8 +34,8 @@ const buttonVariants = classVarianceAuthority.cva(
34
34
  );
35
35
  function Button({
36
36
  className,
37
- variant,
38
- size,
37
+ variant = "default",
38
+ size = "default",
39
39
  asChild = false,
40
40
  ...props
41
41
  }) {
@@ -44,6 +44,8 @@ function Button({
44
44
  Comp,
45
45
  {
46
46
  "data-slot": "button",
47
+ "data-variant": variant,
48
+ "data-size": size,
47
49
  className: utils.cn(buttonVariants({ variant, size, className })),
48
50
  ...props
49
51
  }
@@ -32,8 +32,8 @@ const buttonVariants = cva(
32
32
  );
33
33
  function Button({
34
34
  className,
35
- variant,
36
- size,
35
+ variant = "default",
36
+ size = "default",
37
37
  asChild = false,
38
38
  ...props
39
39
  }) {
@@ -42,6 +42,8 @@ function Button({
42
42
  Comp,
43
43
  {
44
44
  "data-slot": "button",
45
+ "data-variant": variant,
46
+ "data-size": size,
45
47
  className: cn(buttonVariants({ variant, size, className })),
46
48
  ...props
47
49
  }
@@ -25,6 +25,11 @@ function Dialog({
25
25
  }) {
26
26
  return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Root, { "data-slot": "dialog", ...props });
27
27
  }
28
+ function DialogTrigger({
29
+ ...props
30
+ }) {
31
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Trigger, { "data-slot": "dialog-trigger", ...props });
32
+ }
28
33
  function DialogPortal({
29
34
  ...props
30
35
  }) {
@@ -59,7 +64,7 @@ function DialogContent({
59
64
  {
60
65
  "data-slot": "dialog-content",
61
66
  className: utils.cn(
62
- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
67
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",
63
68
  className
64
69
  ),
65
70
  ...props,
@@ -139,3 +144,4 @@ exports.DialogHeader = DialogHeader;
139
144
  exports.DialogOverlay = DialogOverlay;
140
145
  exports.DialogPortal = DialogPortal;
141
146
  exports.DialogTitle = DialogTitle;
147
+ exports.DialogTrigger = DialogTrigger;
@@ -9,6 +9,11 @@ function Dialog({
9
9
  }) {
10
10
  return /* @__PURE__ */ jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
11
11
  }
12
+ function DialogTrigger({
13
+ ...props
14
+ }) {
15
+ return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
16
+ }
12
17
  function DialogPortal({
13
18
  ...props
14
19
  }) {
@@ -43,7 +48,7 @@ function DialogContent({
43
48
  {
44
49
  "data-slot": "dialog-content",
45
50
  className: cn(
46
- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
51
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",
47
52
  className
48
53
  ),
49
54
  ...props,
@@ -115,4 +120,4 @@ function DialogDescription({
115
120
  );
116
121
  }
117
122
 
118
- export { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle };
123
+ export { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
@@ -4,7 +4,7 @@
4
4
  const jsxRuntime = require('react/jsx-runtime');
5
5
  const React = require('react');
6
6
  const index = require('../auto-form/index.cjs');
7
- const utils = require('../auto-form/utils.cjs');
7
+ const helpers = require('../auto-form/helpers.cjs');
8
8
  const input = require('../input.cjs');
9
9
  const label = require('../label.cjs');
10
10
  const button = require('../button.cjs');
@@ -68,7 +68,7 @@ function EditFieldDialog({
68
68
  }
69
69
  const Icon = component.icon;
70
70
  const jsonSchema = component.propertiesSchema.toJSONSchema();
71
- const fieldConfig = utils.buildFieldConfigFromJsonSchema(jsonSchema);
71
+ const fieldConfig = helpers.buildFieldConfigFromJsonSchema(jsonSchema);
72
72
  return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogContent, { className: "max-w-md max-h-[90vh] overflow-y-auto", children: [
73
73
  /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogHeader, { children: [
74
74
  /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogTitle, { className: "flex items-center gap-2", children: [
@@ -2,7 +2,7 @@
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { useMemo, useState, useCallback } from 'react';
4
4
  import AutoForm from '../auto-form/index.mjs';
5
- import { buildFieldConfigFromJsonSchema } from '../auto-form/utils.mjs';
5
+ import { buildFieldConfigFromJsonSchema } from '../auto-form/helpers.mjs';
6
6
  import { Input } from '../input.mjs';
7
7
  import { Label } from '../label.mjs';
8
8
  import { Button } from '../button.mjs';
@@ -4,9 +4,9 @@
4
4
  const jsxRuntime = require('react/jsx-runtime');
5
5
  const React = require('react');
6
6
  const steppedAutoForm = require('../auto-form/stepped-auto-form.cjs');
7
- const utils = require('../auto-form/utils.cjs');
7
+ const helpers = require('../auto-form/helpers.cjs');
8
8
  const button = require('../button.cjs');
9
- const utils$1 = require('../../lib/utils.cjs');
9
+ const utils = require('../../lib/utils.cjs');
10
10
  const schemaConverter = require('../../lib/schema-converter.cjs');
11
11
 
12
12
  function FormPreview({ schema, className, fieldComponents, defaultValues }) {
@@ -25,7 +25,7 @@ function FormPreview({ schema, className, fieldComponents, defaultValues }) {
25
25
  const mergedFieldComponents = React.useMemo(() => fieldComponents ?? {}, [fieldComponents]);
26
26
  const fieldConfig = React.useMemo(() => {
27
27
  try {
28
- return utils.buildFieldConfigFromJsonSchema(
28
+ return helpers.buildFieldConfigFromJsonSchema(
29
29
  schema,
30
30
  mergedFieldComponents
31
31
  );
@@ -41,12 +41,12 @@ function FormPreview({ schema, className, fieldComponents, defaultValues }) {
41
41
  setSubmittedValues(null);
42
42
  };
43
43
  if (!zodSchema) {
44
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils$1.cn("p-8 text-center text-muted-foreground", className), children: [
44
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils.cn("p-8 text-center text-muted-foreground", className), children: [
45
45
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-medium mb-2", children: "No fields to preview" }),
46
46
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", children: "Add some fields to your form to see a preview" })
47
47
  ] });
48
48
  }
49
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils$1.cn("p-4 md:p-6", className), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-2xl mx-auto", children: submittedValues ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
49
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils.cn("p-4 md:p-6", className), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-2xl mx-auto", children: submittedValues ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
50
50
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
51
51
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold", children: "Submitted Values" }),
52
52
  /* @__PURE__ */ jsxRuntime.jsx(button.Button, { variant: "outline", onClick: handleReset, children: "Try Again" })
@@ -2,7 +2,7 @@
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { useState, useMemo } from 'react';
4
4
  import SteppedAutoForm from '../auto-form/stepped-auto-form.mjs';
5
- import { buildFieldConfigFromJsonSchema } from '../auto-form/utils.mjs';
5
+ import { buildFieldConfigFromJsonSchema } from '../auto-form/helpers.mjs';
6
6
  import { Button } from '../button.mjs';
7
7
  import { cn } from '../../lib/utils.mjs';
8
8
  import { formSchemaToZod } from '../../lib/schema-converter.mjs';
@@ -42,7 +42,7 @@ function SelectTrigger({
42
42
  function SelectContent({
43
43
  className,
44
44
  children,
45
- position = "popper",
45
+ position = "item-aligned",
46
46
  align = "center",
47
47
  ...props
48
48
  }) {
@@ -90,7 +90,14 @@ function SelectItem({
90
90
  ),
91
91
  ...props,
92
92
  children: [
93
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(index.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4" }) }) }),
93
+ /* @__PURE__ */ jsxRuntime.jsx(
94
+ "span",
95
+ {
96
+ "data-slot": "select-item-indicator",
97
+ className: "absolute right-2 flex size-3.5 items-center justify-center",
98
+ children: /* @__PURE__ */ jsxRuntime.jsx(index.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4" }) })
99
+ }
100
+ ),
94
101
  /* @__PURE__ */ jsxRuntime.jsx(index.ItemText, { children })
95
102
  ]
96
103
  }
@@ -40,7 +40,7 @@ function SelectTrigger({
40
40
  function SelectContent({
41
41
  className,
42
42
  children,
43
- position = "popper",
43
+ position = "item-aligned",
44
44
  align = "center",
45
45
  ...props
46
46
  }) {
@@ -88,7 +88,14 @@ function SelectItem({
88
88
  ),
89
89
  ...props,
90
90
  children: [
91
- /* @__PURE__ */ jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) }) }),
91
+ /* @__PURE__ */ jsx(
92
+ "span",
93
+ {
94
+ "data-slot": "select-item-indicator",
95
+ className: "absolute right-2 flex size-3.5 items-center justify-center",
96
+ children: /* @__PURE__ */ jsx(ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) })
97
+ }
98
+ ),
92
99
  /* @__PURE__ */ jsx(ItemText, { children })
93
100
  ]
94
101
  }
@@ -2,6 +2,6 @@ export { B as BlogApiContext, c as BlogApiRouter, a as BlogBackendHooks, N as Ne
2
2
  import '@btst/stack/plugins/api';
3
3
  import 'better-call';
4
4
  import 'zod';
5
- import '../../../shared/stack.DLhzx1-D.cjs';
5
+ import '../../../shared/stack.CcI4sYJP.cjs';
6
6
  import '@tanstack/react-query';
7
7
  import '@btst/stack/plugins/client';
@@ -2,6 +2,6 @@ export { B as BlogApiContext, c as BlogApiRouter, a as BlogBackendHooks, N as Ne
2
2
  import '@btst/stack/plugins/api';
3
3
  import 'better-call';
4
4
  import 'zod';
5
- import '../../../shared/stack.DLhzx1-D.mjs';
5
+ import '../../../shared/stack.CcI4sYJP.mjs';
6
6
  import '@tanstack/react-query';
7
7
  import '@btst/stack/plugins/client';
@@ -2,6 +2,6 @@ export { B as BlogApiContext, c as BlogApiRouter, a as BlogBackendHooks, N as Ne
2
2
  import '@btst/stack/plugins/api';
3
3
  import 'better-call';
4
4
  import 'zod';
5
- import '../../../shared/stack.DLhzx1-D.js';
5
+ import '../../../shared/stack.CcI4sYJP.js';
6
6
  import '@tanstack/react-query';
7
7
  import '@btst/stack/plugins/client';
@@ -1,5 +1,5 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from '../../../../shared/stack.DLhzx1-D.cjs';
2
+ import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from '../../../../shared/stack.CcI4sYJP.cjs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -128,8 +128,8 @@ declare function useSuspenseTags(): {
128
128
  };
129
129
  /** Create a new post */
130
130
  declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
131
- title: string;
132
131
  published: boolean;
132
+ title: string;
133
133
  content: string;
134
134
  excerpt: string;
135
135
  tags: ({
@@ -1,5 +1,5 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from '../../../../shared/stack.DLhzx1-D.mjs';
2
+ import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from '../../../../shared/stack.CcI4sYJP.mjs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -128,8 +128,8 @@ declare function useSuspenseTags(): {
128
128
  };
129
129
  /** Create a new post */
130
130
  declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
131
- title: string;
132
131
  published: boolean;
132
+ title: string;
133
133
  content: string;
134
134
  excerpt: string;
135
135
  tags: ({
@@ -1,5 +1,5 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from '../../../../shared/stack.DLhzx1-D.js';
2
+ import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from '../../../../shared/stack.CcI4sYJP.js';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -128,8 +128,8 @@ declare function useSuspenseTags(): {
128
128
  };
129
129
  /** Create a new post */
130
130
  declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
131
- title: string;
132
131
  published: boolean;
132
+ title: string;
133
133
  content: string;
134
134
  excerpt: string;
135
135
  tags: ({
@@ -3,7 +3,7 @@ import * as react from 'react';
3
3
  import { ComponentType } from 'react';
4
4
  import * as _btst_yar from '@btst/yar';
5
5
  import { QueryClient } from '@tanstack/react-query';
6
- import { P as Post, S as SerializedPost } from '../../../shared/stack.DLhzx1-D.cjs';
6
+ import { P as Post, S as SerializedPost } from '../../../shared/stack.CcI4sYJP.cjs';
7
7
  export { UsePostsOptions, UsePostsResult } from './hooks/index.cjs';
8
8
  import 'zod';
9
9