@timeax/form-palette 0.0.14 → 0.0.15

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.d.mts CHANGED
@@ -3252,20 +3252,56 @@ interface CoreRootProps extends React.FormHTMLAttributes<HTMLFormElement> {
3252
3252
  declare function CoreRoot(props: CoreRootProps): react_jsx_runtime.JSX.Element;
3253
3253
 
3254
3254
  /**
3255
- * Combined provider + form-root wrapper.
3256
- *
3257
- * Usage:
3258
- * <CoreShell adapter="local" schema={schema} formProps={{ className: "space-y-4" }}>
3259
- * {...fields + buttons...}
3260
- * </CoreShell>
3255
+ * Shared base props for CoreShell, independent of wrapping behaviour.
3261
3256
  */
3262
- type CoreShellProps<V extends Dict = Dict, S extends z.ZodType | undefined = z.ZodType | undefined, K extends AdapterKey = "local"> = CoreProps<V, S, K> & {
3257
+ type CoreShellBaseProps<V extends Dict = Dict, S extends z.ZodType | undefined = z.ZodType | undefined, K extends AdapterKey = "local"> = CoreProps<V, S, K> & {
3263
3258
  /**
3264
3259
  * Props passed directly to the underlying <form> element via CoreRoot.
3265
3260
  */
3266
3261
  formProps?: CoreRootProps;
3267
3262
  children?: React.ReactNode;
3268
3263
  };
3264
+ /**
3265
+ * When `wrapped` is true, you can provide gap/contentClassName.
3266
+ */
3267
+ type CoreShellWrappedProps<V extends Dict = Dict, S extends z.ZodType | undefined = z.ZodType | undefined, K extends AdapterKey = "local"> = CoreShellBaseProps<V, S, K> & {
3268
+ wrapped: true;
3269
+ /**
3270
+ * Gap for the inner wrapper. You can still control layout
3271
+ * (flex/grid/etc.) via `contentClassName`.
3272
+ */
3273
+ gap?: React.CSSProperties["gap"];
3274
+ /**
3275
+ * Class applied to the wrapper around children.
3276
+ */
3277
+ contentClassName?: string;
3278
+ };
3279
+ /**
3280
+ * When `wrapped` is not true (false/undefined), gap/contentClassName
3281
+ * are not allowed.
3282
+ */
3283
+ type CoreShellUnwrappedProps<V extends Dict = Dict, S extends z.ZodType | undefined = z.ZodType | undefined, K extends AdapterKey = "local"> = CoreShellBaseProps<V, S, K> & {
3284
+ wrapped?: false | undefined;
3285
+ };
3286
+ type CoreShellProps<V extends Dict = Dict, S extends z.ZodType | undefined = z.ZodType | undefined, K extends AdapterKey = "local"> = CoreShellWrappedProps<V, S, K> | CoreShellUnwrappedProps<V, S, K>;
3287
+ /**
3288
+ * Combined provider + form-root wrapper.
3289
+ *
3290
+ * Usage:
3291
+ * <CoreShell adapter="local" schema={schema} formProps={{ className: "space-y-4" }}>
3292
+ * {...fields + buttons...}
3293
+ * </CoreShell>
3294
+ *
3295
+ * <CoreShell
3296
+ * adapter="local"
3297
+ * schema={schema}
3298
+ * wrapped
3299
+ * gap="1rem"
3300
+ * contentClassName="flex flex-col"
3301
+ * >
3302
+ * {...fields + buttons...}
3303
+ * </CoreShell>
3304
+ */
3269
3305
  declare function CoreShell<V extends Dict, S extends z.ZodType | undefined, K extends AdapterKey = "local">(props: CoreShellProps<V, S, K>): react_jsx_runtime.JSX.Element;
3270
3306
 
3271
3307
  interface UseButtonOptions {
package/dist/index.d.ts CHANGED
@@ -3252,20 +3252,56 @@ interface CoreRootProps extends React.FormHTMLAttributes<HTMLFormElement> {
3252
3252
  declare function CoreRoot(props: CoreRootProps): react_jsx_runtime.JSX.Element;
3253
3253
 
3254
3254
  /**
3255
- * Combined provider + form-root wrapper.
3256
- *
3257
- * Usage:
3258
- * <CoreShell adapter="local" schema={schema} formProps={{ className: "space-y-4" }}>
3259
- * {...fields + buttons...}
3260
- * </CoreShell>
3255
+ * Shared base props for CoreShell, independent of wrapping behaviour.
3261
3256
  */
3262
- type CoreShellProps<V extends Dict = Dict, S extends z.ZodType | undefined = z.ZodType | undefined, K extends AdapterKey = "local"> = CoreProps<V, S, K> & {
3257
+ type CoreShellBaseProps<V extends Dict = Dict, S extends z.ZodType | undefined = z.ZodType | undefined, K extends AdapterKey = "local"> = CoreProps<V, S, K> & {
3263
3258
  /**
3264
3259
  * Props passed directly to the underlying <form> element via CoreRoot.
3265
3260
  */
3266
3261
  formProps?: CoreRootProps;
3267
3262
  children?: React.ReactNode;
3268
3263
  };
3264
+ /**
3265
+ * When `wrapped` is true, you can provide gap/contentClassName.
3266
+ */
3267
+ type CoreShellWrappedProps<V extends Dict = Dict, S extends z.ZodType | undefined = z.ZodType | undefined, K extends AdapterKey = "local"> = CoreShellBaseProps<V, S, K> & {
3268
+ wrapped: true;
3269
+ /**
3270
+ * Gap for the inner wrapper. You can still control layout
3271
+ * (flex/grid/etc.) via `contentClassName`.
3272
+ */
3273
+ gap?: React.CSSProperties["gap"];
3274
+ /**
3275
+ * Class applied to the wrapper around children.
3276
+ */
3277
+ contentClassName?: string;
3278
+ };
3279
+ /**
3280
+ * When `wrapped` is not true (false/undefined), gap/contentClassName
3281
+ * are not allowed.
3282
+ */
3283
+ type CoreShellUnwrappedProps<V extends Dict = Dict, S extends z.ZodType | undefined = z.ZodType | undefined, K extends AdapterKey = "local"> = CoreShellBaseProps<V, S, K> & {
3284
+ wrapped?: false | undefined;
3285
+ };
3286
+ type CoreShellProps<V extends Dict = Dict, S extends z.ZodType | undefined = z.ZodType | undefined, K extends AdapterKey = "local"> = CoreShellWrappedProps<V, S, K> | CoreShellUnwrappedProps<V, S, K>;
3287
+ /**
3288
+ * Combined provider + form-root wrapper.
3289
+ *
3290
+ * Usage:
3291
+ * <CoreShell adapter="local" schema={schema} formProps={{ className: "space-y-4" }}>
3292
+ * {...fields + buttons...}
3293
+ * </CoreShell>
3294
+ *
3295
+ * <CoreShell
3296
+ * adapter="local"
3297
+ * schema={schema}
3298
+ * wrapped
3299
+ * gap="1rem"
3300
+ * contentClassName="flex flex-col"
3301
+ * >
3302
+ * {...fields + buttons...}
3303
+ * </CoreShell>
3304
+ */
3269
3305
  declare function CoreShell<V extends Dict, S extends z.ZodType | undefined, K extends AdapterKey = "local">(props: CoreShellProps<V, S, K>): react_jsx_runtime.JSX.Element;
3270
3306
 
3271
3307
  interface UseButtonOptions {
package/dist/index.js CHANGED
@@ -14090,6 +14090,26 @@ function CoreRoot(props) {
14090
14090
  ] });
14091
14091
  }
14092
14092
  function CoreShell(props) {
14093
+ if (props.wrapped) {
14094
+ const {
14095
+ formProps: formProps2,
14096
+ children: children2,
14097
+ wrapped,
14098
+ // eslint-disable-line @typescript-eslint/no-unused-vars
14099
+ gap,
14100
+ contentClassName,
14101
+ ...coreProps2
14102
+ } = props;
14103
+ const content = /* @__PURE__ */ jsxRuntime.jsx(
14104
+ "div",
14105
+ {
14106
+ className: contentClassName,
14107
+ style: gap !== void 0 ? { gap } : void 0,
14108
+ children: children2
14109
+ }
14110
+ );
14111
+ return /* @__PURE__ */ jsxRuntime.jsx(CoreProvider, { ...coreProps2, children: /* @__PURE__ */ jsxRuntime.jsx(CoreRoot, { ...formProps2 != null ? formProps2 : {}, children: content }) });
14112
+ }
14093
14113
  const { formProps, children, ...coreProps } = props;
14094
14114
  return /* @__PURE__ */ jsxRuntime.jsx(CoreProvider, { ...coreProps, children: /* @__PURE__ */ jsxRuntime.jsx(CoreRoot, { ...formProps != null ? formProps : {}, children }) });
14095
14115
  }