@puckeditor/cli 0.24.0-canary.301a0304
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/LICENSE +21 -0
- package/README.md +45 -0
- package/dist/bin.mjs +7304 -0
- package/dist/docs/api-reference/actions.md +63 -0
- package/dist/docs/api-reference/components/action-bar-action.md +35 -0
- package/dist/docs/api-reference/components/action-bar-group.md +24 -0
- package/dist/docs/api-reference/components/action-bar-label.md +25 -0
- package/dist/docs/api-reference/components/action-bar-separator.md +16 -0
- package/dist/docs/api-reference/components/action-bar.md +32 -0
- package/dist/docs/api-reference/components/auto-field.md +63 -0
- package/dist/docs/api-reference/components/drawer-item.md +75 -0
- package/dist/docs/api-reference/components/drawer.md +29 -0
- package/dist/docs/api-reference/components/drop-zone.md +232 -0
- package/dist/docs/api-reference/components/field-label.md +138 -0
- package/dist/docs/api-reference/components/inline-text-field.md +77 -0
- package/dist/docs/api-reference/components/puck-components.md +19 -0
- package/dist/docs/api-reference/components/puck-fields.md +39 -0
- package/dist/docs/api-reference/components/puck-layout.md +27 -0
- package/dist/docs/api-reference/components/puck-outline.md +19 -0
- package/dist/docs/api-reference/components/puck-preview.md +39 -0
- package/dist/docs/api-reference/components/puck.md +561 -0
- package/dist/docs/api-reference/components/render.md +94 -0
- package/dist/docs/api-reference/components/rich-text-menu-control.md +87 -0
- package/dist/docs/api-reference/components/rich-text-menu-group.md +27 -0
- package/dist/docs/api-reference/components/rich-text-menu.md +99 -0
- package/dist/docs/api-reference/components.md +32 -0
- package/dist/docs/api-reference/configuration/component-config.md +569 -0
- package/dist/docs/api-reference/configuration/config.md +108 -0
- package/dist/docs/api-reference/configuration.md +4 -0
- package/dist/docs/api-reference/data-model/app-state.md +168 -0
- package/dist/docs/api-reference/data-model/component-data.md +62 -0
- package/dist/docs/api-reference/data-model/data.md +95 -0
- package/dist/docs/api-reference/data-model/item-selector.md +34 -0
- package/dist/docs/api-reference/data-model/root-data.md +59 -0
- package/dist/docs/api-reference/data-model.md +8 -0
- package/dist/docs/api-reference/dictionary.md +172 -0
- package/dist/docs/api-reference/field-transforms.md +51 -0
- package/dist/docs/api-reference/fields/array.md +211 -0
- package/dist/docs/api-reference/fields/base.md +96 -0
- package/dist/docs/api-reference/fields/custom.md +193 -0
- package/dist/docs/api-reference/fields/external.md +413 -0
- package/dist/docs/api-reference/fields/number.md +132 -0
- package/dist/docs/api-reference/fields/object.md +78 -0
- package/dist/docs/api-reference/fields/radio.md +82 -0
- package/dist/docs/api-reference/fields/richtext.md +422 -0
- package/dist/docs/api-reference/fields/select.md +79 -0
- package/dist/docs/api-reference/fields/slot.md +302 -0
- package/dist/docs/api-reference/fields/text.md +93 -0
- package/dist/docs/api-reference/fields/textarea.md +93 -0
- package/dist/docs/api-reference/fields.md +16 -0
- package/dist/docs/api-reference/functions/migrate.md +204 -0
- package/dist/docs/api-reference/functions/register-overlay-portal.md +45 -0
- package/dist/docs/api-reference/functions/resolve-all-data.md +27 -0
- package/dist/docs/api-reference/functions/set-deep.md +55 -0
- package/dist/docs/api-reference/functions/transform-props.md +51 -0
- package/dist/docs/api-reference/functions/use-get-puck.md +24 -0
- package/dist/docs/api-reference/functions/use-puck.md +43 -0
- package/dist/docs/api-reference/functions/walk-tree.md +88 -0
- package/dist/docs/api-reference/functions.md +8 -0
- package/dist/docs/api-reference/overrides/action-bar.md +35 -0
- package/dist/docs/api-reference/overrides/component-overlay.md +41 -0
- package/dist/docs/api-reference/overrides/drawer-item.md +24 -0
- package/dist/docs/api-reference/overrides/drawer.md +19 -0
- package/dist/docs/api-reference/overrides/field-label.md +18 -0
- package/dist/docs/api-reference/overrides/field-types.md +51 -0
- package/dist/docs/api-reference/overrides/fields.md +19 -0
- package/dist/docs/api-reference/overrides/header-actions.md +24 -0
- package/dist/docs/api-reference/overrides/header.md +29 -0
- package/dist/docs/api-reference/overrides/iframe.md +32 -0
- package/dist/docs/api-reference/overrides/outline.md +19 -0
- package/dist/docs/api-reference/overrides/preview.md +19 -0
- package/dist/docs/api-reference/overrides/puck.md +19 -0
- package/dist/docs/api-reference/overrides.md +28 -0
- package/dist/docs/api-reference/permissions.md +55 -0
- package/dist/docs/api-reference/plugin.md +112 -0
- package/dist/docs/api-reference/plugins/blocks-plugin.md +57 -0
- package/dist/docs/api-reference/plugins/fields-plugin.md +68 -0
- package/dist/docs/api-reference/plugins/legacy-side-bar-plugin.md +54 -0
- package/dist/docs/api-reference/plugins/outline-plugin.md +57 -0
- package/dist/docs/api-reference/puck-api.md +278 -0
- package/dist/docs/api-reference/theming/action-bar.md +32 -0
- package/dist/docs/api-reference/theming/button.md +65 -0
- package/dist/docs/api-reference/theming/canvas.md +20 -0
- package/dist/docs/api-reference/theming/computed-values.md +194 -0
- package/dist/docs/api-reference/theming/drawer.md +34 -0
- package/dist/docs/api-reference/theming/fields.md +70 -0
- package/dist/docs/api-reference/theming/global.md +127 -0
- package/dist/docs/api-reference/theming/header.md +19 -0
- package/dist/docs/api-reference/theming/icon-button.md +28 -0
- package/dist/docs/api-reference/theming/outline.md +35 -0
- package/dist/docs/api-reference/theming/plugin-bar.md +24 -0
- package/dist/docs/api-reference/theming/sidebar.md +19 -0
- package/dist/docs/api-reference/theming/slot.md +27 -0
- package/dist/docs/cli.md +201 -0
- package/dist/docs/extending-puck/composition.md +54 -0
- package/dist/docs/extending-puck/custom-fields.md +133 -0
- package/dist/docs/extending-puck/field-transforms.md +89 -0
- package/dist/docs/extending-puck/internal-puck-api.md +96 -0
- package/dist/docs/extending-puck/plugins.md +159 -0
- package/dist/docs/extending-puck/theming.md +88 -0
- package/dist/docs/extending-puck/ui-overrides.md +134 -0
- package/dist/docs/getting-started.md +68 -0
- package/dist/docs/guides/migrations/dropzones-to-slots.md +138 -0
- package/dist/docs/index.json +466 -0
- package/dist/docs/index.md +37 -0
- package/dist/docs/integrating-puck/categories.md +92 -0
- package/dist/docs/integrating-puck/component-configuration.md +159 -0
- package/dist/docs/integrating-puck/data-migration.md +86 -0
- package/dist/docs/integrating-puck/dynamic-fields.md +86 -0
- package/dist/docs/integrating-puck/dynamic-props.md +137 -0
- package/dist/docs/integrating-puck/external-data-sources.md +149 -0
- package/dist/docs/integrating-puck/feature-toggling.md +121 -0
- package/dist/docs/integrating-puck/localization.md +228 -0
- package/dist/docs/integrating-puck/multi-column-layouts.md +226 -0
- package/dist/docs/integrating-puck/overlay-portals.md +25 -0
- package/dist/docs/integrating-puck/rich-text-editing.md +230 -0
- package/dist/docs/integrating-puck/root-configuration.md +171 -0
- package/dist/docs/integrating-puck/server-components.md +199 -0
- package/dist/docs/integrating-puck/styling.md +117 -0
- package/dist/docs/integrating-puck/viewports.md +75 -0
- package/dist/templates/astro/README.md +52 -0
- package/dist/templates/astro/_gitignore +24 -0
- package/dist/templates/astro/astro.config.mjs +14 -0
- package/dist/templates/astro/database.json +1 -0
- package/dist/templates/astro/package.json +25 -0
- package/dist/templates/astro/public/favicon.svg +9 -0
- package/dist/templates/astro/src/lib/pages.ts +21 -0
- package/dist/templates/astro/src/lib/resolve-puck-path.ts +19 -0
- package/dist/templates/astro/src/pages/[...puckPath].astro +25 -0
- package/dist/templates/astro/src/pages/api/pages.ts +18 -0
- package/dist/templates/astro/src/puck/editor.tsx +32 -0
- package/dist/templates/astro/src/puck/pages.ts +15 -0
- package/dist/templates/astro/src/puck/render.tsx +9 -0
- package/dist/templates/astro/src/puck.config.tsx +23 -0
- package/dist/templates/astro/tsconfig.json +14 -0
- package/dist/templates/astro-ai/README.md +64 -0
- package/dist/templates/astro-ai/_gitignore +24 -0
- package/dist/templates/astro-ai/astro.config.mjs +21 -0
- package/dist/templates/astro-ai/database.json +1 -0
- package/dist/templates/astro-ai/package.json +27 -0
- package/dist/templates/astro-ai/public/favicon.svg +9 -0
- package/dist/templates/astro-ai/src/lib/pages.ts +21 -0
- package/dist/templates/astro-ai/src/lib/resolve-puck-path.ts +19 -0
- package/dist/templates/astro-ai/src/pages/[...puckPath].astro +25 -0
- package/dist/templates/astro-ai/src/pages/api/pages.ts +18 -0
- package/dist/templates/astro-ai/src/pages/api/puck/[...all].ts +36 -0
- package/dist/templates/astro-ai/src/puck/editor.tsx +53 -0
- package/dist/templates/astro-ai/src/puck/pages.ts +15 -0
- package/dist/templates/astro-ai/src/puck/render.tsx +10 -0
- package/dist/templates/astro-ai/src/puck.config.tsx +23 -0
- package/dist/templates/astro-ai/tsconfig.json +14 -0
- package/dist/templates/express/README.md +66 -0
- package/dist/templates/express/_gitignore +16 -0
- package/dist/templates/express/database.json +1 -0
- package/dist/templates/express/package.json +20 -0
- package/dist/templates/express/src/index.ts +15 -0
- package/dist/templates/express/src/puck/pages.ts +39 -0
- package/dist/templates/express/tsconfig.json +12 -0
- package/dist/templates/express-ai/README.md +81 -0
- package/dist/templates/express-ai/_gitignore +16 -0
- package/dist/templates/express-ai/database.json +1 -0
- package/dist/templates/express-ai/package.json +22 -0
- package/dist/templates/express-ai/src/index.ts +17 -0
- package/dist/templates/express-ai/src/puck/cloud.ts +71 -0
- package/dist/templates/express-ai/src/puck/pages.ts +39 -0
- package/dist/templates/express-ai/tsconfig.json +12 -0
- package/dist/templates/hono/README.md +66 -0
- package/dist/templates/hono/_gitignore +32 -0
- package/dist/templates/hono/database.json +1 -0
- package/dist/templates/hono/package.json +20 -0
- package/dist/templates/hono/src/index.ts +21 -0
- package/dist/templates/hono/src/puck/pages.ts +32 -0
- package/dist/templates/hono/tsconfig.json +13 -0
- package/dist/templates/hono-ai/README.md +81 -0
- package/dist/templates/hono-ai/_gitignore +32 -0
- package/dist/templates/hono-ai/database.json +1 -0
- package/dist/templates/hono-ai/package.json +22 -0
- package/dist/templates/hono-ai/src/index.ts +23 -0
- package/dist/templates/hono-ai/src/puck/cloud.ts +30 -0
- package/dist/templates/hono-ai/src/puck/pages.ts +32 -0
- package/dist/templates/hono-ai/tsconfig.json +13 -0
- package/dist/templates/manifest.json +4 -0
- package/dist/templates/next/README.md +112 -0
- package/dist/templates/next/_gitignore +35 -0
- package/dist/templates/next/app/[...puckPath]/client.tsx +9 -0
- package/dist/templates/next/app/[...puckPath]/page.tsx +49 -0
- package/dist/templates/next/app/favicon.ico +0 -0
- package/dist/templates/next/app/layout.tsx +13 -0
- package/dist/templates/next/app/page.tsx +1 -0
- package/dist/templates/next/app/puck/[...puckPath]/client.tsx +20 -0
- package/dist/templates/next/app/puck/[...puckPath]/page.tsx +55 -0
- package/dist/templates/next/app/puck/api/route.ts +25 -0
- package/dist/templates/next/app/puck/page.tsx +3 -0
- package/dist/templates/next/app/styles.css +3 -0
- package/dist/templates/next/database.json +1 -0
- package/dist/templates/next/lib/get-page.ts +11 -0
- package/dist/templates/next/next.config.js +3 -0
- package/dist/templates/next/package.json +25 -0
- package/dist/templates/next/proxy.ts +27 -0
- package/dist/templates/next/puck.config.tsx +25 -0
- package/dist/templates/next/tsconfig/base.json +20 -0
- package/dist/templates/next/tsconfig/nextjs.json +21 -0
- package/dist/templates/next/tsconfig.json +8 -0
- package/dist/templates/next-ai/README.md +169 -0
- package/dist/templates/next-ai/_gitignore +35 -0
- package/dist/templates/next-ai/app/[...puckPath]/client.tsx +12 -0
- package/dist/templates/next-ai/app/[...puckPath]/page.tsx +49 -0
- package/dist/templates/next-ai/app/api/pages/route.ts +26 -0
- package/dist/templates/next-ai/app/api/puck/[...all]/route.ts +31 -0
- package/dist/templates/next-ai/app/layout.tsx +13 -0
- package/dist/templates/next-ai/app/page.tsx +1 -0
- package/dist/templates/next-ai/app/puck/[...puckPath]/client.tsx +38 -0
- package/dist/templates/next-ai/app/puck/[...puckPath]/page.tsx +57 -0
- package/dist/templates/next-ai/app/puck/page.tsx +3 -0
- package/dist/templates/next-ai/app/styles.css +3 -0
- package/dist/templates/next-ai/database.json +1 -0
- package/dist/templates/next-ai/lib/get-page.ts +11 -0
- package/dist/templates/next-ai/next.config.js +3 -0
- package/dist/templates/next-ai/package.json +27 -0
- package/dist/templates/next-ai/proxy.ts +27 -0
- package/dist/templates/next-ai/public/favicon.ico +0 -0
- package/dist/templates/next-ai/puck.config.tsx +25 -0
- package/dist/templates/next-ai/tsconfig/base.json +20 -0
- package/dist/templates/next-ai/tsconfig/nextjs.json +21 -0
- package/dist/templates/next-ai/tsconfig.json +8 -0
- package/dist/templates/react-router/README.md +113 -0
- package/dist/templates/react-router/_gitignore +6 -0
- package/dist/templates/react-router/app/components/puck-render.tsx +8 -0
- package/dist/templates/react-router/app/lib/pages.server.ts +29 -0
- package/dist/templates/react-router/app/lib/resolve-puck-path.server.ts +19 -0
- package/dist/templates/react-router/app/root.tsx +65 -0
- package/dist/templates/react-router/app/routes/_index.tsx +31 -0
- package/dist/templates/react-router/app/routes/puck-splat.tsx +95 -0
- package/dist/templates/react-router/app/routes.ts +7 -0
- package/dist/templates/react-router/database.json +1 -0
- package/dist/templates/react-router/package.json +33 -0
- package/dist/templates/react-router/public/favicon.ico +0 -0
- package/dist/templates/react-router/puck.config.tsx +23 -0
- package/dist/templates/react-router/react-router.config.ts +7 -0
- package/dist/templates/react-router/tsconfig.json +29 -0
- package/dist/templates/react-router/vite.config.ts +10 -0
- package/dist/templates/react-router-ai/README.md +172 -0
- package/dist/templates/react-router-ai/_gitignore +6 -0
- package/dist/templates/react-router-ai/app/components/puck-render.tsx +11 -0
- package/dist/templates/react-router-ai/app/lib/pages.server.ts +29 -0
- package/dist/templates/react-router-ai/app/lib/resolve-puck-path.server.ts +19 -0
- package/dist/templates/react-router-ai/app/root.tsx +65 -0
- package/dist/templates/react-router-ai/app/routes/_index.tsx +31 -0
- package/dist/templates/react-router-ai/app/routes/api.puck.ts +34 -0
- package/dist/templates/react-router-ai/app/routes/puck-splat.tsx +119 -0
- package/dist/templates/react-router-ai/app/routes.ts +8 -0
- package/dist/templates/react-router-ai/database.json +1 -0
- package/dist/templates/react-router-ai/package.json +35 -0
- package/dist/templates/react-router-ai/public/favicon.ico +0 -0
- package/dist/templates/react-router-ai/puck.config.tsx +25 -0
- package/dist/templates/react-router-ai/react-router.config.ts +7 -0
- package/dist/templates/react-router-ai/tsconfig.json +29 -0
- package/dist/templates/react-router-ai/vite.config.ts +10 -0
- package/dist/templates/tanstack-start/README.md +113 -0
- package/dist/templates/tanstack-start/_gitignore +12 -0
- package/dist/templates/tanstack-start/database.json +1 -0
- package/dist/templates/tanstack-start/package.json +26 -0
- package/dist/templates/tanstack-start/puck.config.tsx +23 -0
- package/dist/templates/tanstack-start/src/components/puck-render.tsx +8 -0
- package/dist/templates/tanstack-start/src/lib/pages.server.ts +26 -0
- package/dist/templates/tanstack-start/src/lib/pages.ts +39 -0
- package/dist/templates/tanstack-start/src/lib/resolve-puck-path.ts +19 -0
- package/dist/templates/tanstack-start/src/routeTree.gen.ts +86 -0
- package/dist/templates/tanstack-start/src/router.tsx +19 -0
- package/dist/templates/tanstack-start/src/routes/$.tsx +41 -0
- package/dist/templates/tanstack-start/src/routes/__root.tsx +42 -0
- package/dist/templates/tanstack-start/src/routes/index.tsx +18 -0
- package/dist/templates/tanstack-start/src/styles.css +13 -0
- package/dist/templates/tanstack-start/tsconfig.json +24 -0
- package/dist/templates/tanstack-start/vite.config.ts +15 -0
- package/dist/templates/tanstack-start-ai/README.md +171 -0
- package/dist/templates/tanstack-start-ai/_gitignore +12 -0
- package/dist/templates/tanstack-start-ai/database.json +1 -0
- package/dist/templates/tanstack-start-ai/package.json +28 -0
- package/dist/templates/tanstack-start-ai/puck.config.tsx +23 -0
- package/dist/templates/tanstack-start-ai/src/components/puck-render.tsx +11 -0
- package/dist/templates/tanstack-start-ai/src/lib/pages.server.ts +26 -0
- package/dist/templates/tanstack-start-ai/src/lib/pages.ts +39 -0
- package/dist/templates/tanstack-start-ai/src/lib/resolve-puck-path.ts +19 -0
- package/dist/templates/tanstack-start-ai/src/routeTree.gen.ts +104 -0
- package/dist/templates/tanstack-start-ai/src/router.tsx +19 -0
- package/dist/templates/tanstack-start-ai/src/routes/$.tsx +73 -0
- package/dist/templates/tanstack-start-ai/src/routes/__root.tsx +42 -0
- package/dist/templates/tanstack-start-ai/src/routes/api/puck/$.ts +39 -0
- package/dist/templates/tanstack-start-ai/src/routes/index.tsx +18 -0
- package/dist/templates/tanstack-start-ai/src/styles.css +13 -0
- package/dist/templates/tanstack-start-ai/tsconfig.json +24 -0
- package/dist/templates/tanstack-start-ai/vite.config.ts +15 -0
- package/dist/templates/vinext/README.md +112 -0
- package/dist/templates/vinext/_gitignore +33 -0
- package/dist/templates/vinext/app/[...puckPath]/client.tsx +9 -0
- package/dist/templates/vinext/app/[...puckPath]/page.tsx +49 -0
- package/dist/templates/vinext/app/favicon.ico +0 -0
- package/dist/templates/vinext/app/layout.tsx +13 -0
- package/dist/templates/vinext/app/page.tsx +1 -0
- package/dist/templates/vinext/app/puck/[...puckPath]/client.tsx +20 -0
- package/dist/templates/vinext/app/puck/[...puckPath]/page.tsx +55 -0
- package/dist/templates/vinext/app/puck/api/route.ts +25 -0
- package/dist/templates/vinext/app/puck/page.tsx +3 -0
- package/dist/templates/vinext/app/styles.css +3 -0
- package/dist/templates/vinext/database.json +1 -0
- package/dist/templates/vinext/lib/get-page.ts +11 -0
- package/dist/templates/vinext/package.json +30 -0
- package/dist/templates/vinext/proxy.ts +27 -0
- package/dist/templates/vinext/puck.config.tsx +25 -0
- package/dist/templates/vinext/tsconfig.json +30 -0
- package/dist/templates/vinext/vite.config.ts +6 -0
- package/dist/templates/vinext-ai/README.md +169 -0
- package/dist/templates/vinext-ai/_gitignore +33 -0
- package/dist/templates/vinext-ai/app/[...puckPath]/client.tsx +12 -0
- package/dist/templates/vinext-ai/app/[...puckPath]/page.tsx +49 -0
- package/dist/templates/vinext-ai/app/api/pages/route.ts +26 -0
- package/dist/templates/vinext-ai/app/api/puck/[...all]/route.ts +31 -0
- package/dist/templates/vinext-ai/app/layout.tsx +13 -0
- package/dist/templates/vinext-ai/app/page.tsx +1 -0
- package/dist/templates/vinext-ai/app/puck/[...puckPath]/client.tsx +38 -0
- package/dist/templates/vinext-ai/app/puck/[...puckPath]/page.tsx +57 -0
- package/dist/templates/vinext-ai/app/puck/page.tsx +3 -0
- package/dist/templates/vinext-ai/app/styles.css +3 -0
- package/dist/templates/vinext-ai/database.json +1 -0
- package/dist/templates/vinext-ai/lib/get-page.ts +11 -0
- package/dist/templates/vinext-ai/package.json +32 -0
- package/dist/templates/vinext-ai/proxy.ts +27 -0
- package/dist/templates/vinext-ai/public/favicon.ico +0 -0
- package/dist/templates/vinext-ai/puck.config.tsx +25 -0
- package/dist/templates/vinext-ai/tsconfig.json +30 -0
- package/dist/templates/vinext-ai/vite.config.ts +9 -0
- package/dist/templates/vite/README.md +56 -0
- package/dist/templates/vite/_gitignore +24 -0
- package/dist/templates/vite/database.json +1 -0
- package/dist/templates/vite/index.html +12 -0
- package/dist/templates/vite/package.json +29 -0
- package/dist/templates/vite/server/index.ts +13 -0
- package/dist/templates/vite/server/prod.ts +18 -0
- package/dist/templates/vite/server/puck/pages.ts +32 -0
- package/dist/templates/vite/src/App.tsx +11 -0
- package/dist/templates/vite/src/main.tsx +12 -0
- package/dist/templates/vite/src/puck/editor.tsx +28 -0
- package/dist/templates/vite/src/puck/page.tsx +27 -0
- package/dist/templates/vite/src/puck/pages.ts +15 -0
- package/dist/templates/vite/src/puck/root.tsx +27 -0
- package/dist/templates/vite/src/puck.config.tsx +23 -0
- package/dist/templates/vite/tsconfig.app.json +26 -0
- package/dist/templates/vite/tsconfig.json +7 -0
- package/dist/templates/vite/tsconfig.node.json +23 -0
- package/dist/templates/vite/vite.config.ts +14 -0
- package/dist/templates/vite-ai/README.md +67 -0
- package/dist/templates/vite-ai/_gitignore +24 -0
- package/dist/templates/vite-ai/database.json +1 -0
- package/dist/templates/vite-ai/index.html +12 -0
- package/dist/templates/vite-ai/package.json +31 -0
- package/dist/templates/vite-ai/server/index.ts +15 -0
- package/dist/templates/vite-ai/server/prod.ts +18 -0
- package/dist/templates/vite-ai/server/puck/cloud.ts +30 -0
- package/dist/templates/vite-ai/server/puck/pages.ts +32 -0
- package/dist/templates/vite-ai/src/App.tsx +11 -0
- package/dist/templates/vite-ai/src/main.tsx +12 -0
- package/dist/templates/vite-ai/src/puck/editor.tsx +49 -0
- package/dist/templates/vite-ai/src/puck/page.tsx +28 -0
- package/dist/templates/vite-ai/src/puck/pages.ts +15 -0
- package/dist/templates/vite-ai/src/puck/root.tsx +27 -0
- package/dist/templates/vite-ai/src/puck.config.tsx +23 -0
- package/dist/templates/vite-ai/tsconfig.app.json +26 -0
- package/dist/templates/vite-ai/tsconfig.json +7 -0
- package/dist/templates/vite-ai/tsconfig.node.json +23 -0
- package/dist/templates/vite-ai/vite.config.ts +14 -0
- package/package.json +51 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
# External
|
|
2
|
+
|
|
3
|
+
Select data from a list, typically populated via a third-party API. Extends [Base](/docs/api-reference/fields/base).
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const config = {
|
|
7
|
+
components: {
|
|
8
|
+
Example: {
|
|
9
|
+
fields: {
|
|
10
|
+
data: {
|
|
11
|
+
type: "external",
|
|
12
|
+
fetchList: async () => {
|
|
13
|
+
// ... fetch data from a third party API, or other async source
|
|
14
|
+
|
|
15
|
+
return [
|
|
16
|
+
{ title: "Hello, world", description: "Lorem ipsum 1" },
|
|
17
|
+
{ title: "Goodbye, world", description: "Lorem ipsum 2" },
|
|
18
|
+
];
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
render: ({ data }) => {
|
|
23
|
+
return <p>{data?.title || "No data selected"}</p>;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Params
|
|
31
|
+
|
|
32
|
+
| Param | Example | Type | Status |
|
|
33
|
+
| ----------------------------------------- | -------------------------------------------- | ---------- | -------- |
|
|
34
|
+
| [`type`](#type) | `type: "external"` | "external" | Required |
|
|
35
|
+
| [`fetchList()`](#fetchlistqueryparams) | `fetchList: async () => []` | Function | Required |
|
|
36
|
+
| [`cache`](#cache) | `cache: { enabled: true }` | Object | - |
|
|
37
|
+
| [`filterFields`](#filterfields) | `{ "rating": { type: "number" } }` | Object | - |
|
|
38
|
+
| [`getItemSummary()`](#getitemsummaryitem) | `getItemSummary: async ({ title }) => title` | Function | - |
|
|
39
|
+
| [`initialFilters`](#initialfilters) | `{ "rating": 1 }` | Object | - |
|
|
40
|
+
| [`initialQuery`](#initialquery) | `initialQuery: "Hello, world"` | String | - |
|
|
41
|
+
| [`mapProp()`](#mappropitem) | `mapProp: async ({ title }) => title` | Function | - |
|
|
42
|
+
| [`mapRow()`](#maprowitem) | `mapRow: async ({ title }) => title` | Function | - |
|
|
43
|
+
| [`placeholder`](#placeholder) | `placeholder: "Select content"` | String | - |
|
|
44
|
+
| [`renderFooter()`](#renderfooterprops) | `renderFooter: (props) => <p>Hello</p>` | Function | - |
|
|
45
|
+
| [`showSearch`](#showsearch) | `showSearch: true` | Boolean | - |
|
|
46
|
+
|
|
47
|
+
## Required params
|
|
48
|
+
|
|
49
|
+
### `type`
|
|
50
|
+
|
|
51
|
+
The type of the field. Must be `"external"` for Array fields.
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
const config = {
|
|
55
|
+
components: {
|
|
56
|
+
Example: {
|
|
57
|
+
fields: {
|
|
58
|
+
data: {
|
|
59
|
+
type: "external",
|
|
60
|
+
fetchList: async () => {
|
|
61
|
+
return [
|
|
62
|
+
{ title: "Hello, world", description: "Lorem ipsum 1" },
|
|
63
|
+
{ title: "Goodbye, world", description: "Lorem ipsum 2" },
|
|
64
|
+
];
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
// ...
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### `fetchList(queryParams)`
|
|
75
|
+
|
|
76
|
+
Return a promise with a list of objects to be rendered in a tabular format via the external input modal.
|
|
77
|
+
|
|
78
|
+
The table will only render strings and numbers.
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
const config = {
|
|
82
|
+
components: {
|
|
83
|
+
Example: {
|
|
84
|
+
fields: {
|
|
85
|
+
data: {
|
|
86
|
+
type: "external",
|
|
87
|
+
fetchList: async () => {
|
|
88
|
+
// ... fetch data from a third party API, or other async source
|
|
89
|
+
|
|
90
|
+
return [
|
|
91
|
+
{ title: "Hello, world", description: "Lorem ipsum 1" },
|
|
92
|
+
{ title: "Goodbye, world", description: "Lorem ipsum 2" },
|
|
93
|
+
];
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
// ...
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### `queryParams`
|
|
104
|
+
|
|
105
|
+
The parameters passed to the `fetchList` method based on your field configuration.
|
|
106
|
+
|
|
107
|
+
| Param | Example | Type |
|
|
108
|
+
| --------------------- | ------------------- | ------ |
|
|
109
|
+
| [`query`](#query) | `"My Query"` | String |
|
|
110
|
+
| [`filters`](#filters) | `"{ "rating": 1 }"` | Object |
|
|
111
|
+
|
|
112
|
+
##### `query`
|
|
113
|
+
|
|
114
|
+
The search query when using [`showSearch`](#showsearch).
|
|
115
|
+
|
|
116
|
+
##### `filters`
|
|
117
|
+
|
|
118
|
+
An object describing the filters configured by [`filterFields`](#filterfields).
|
|
119
|
+
|
|
120
|
+
## Optional params
|
|
121
|
+
|
|
122
|
+
### `cache`
|
|
123
|
+
|
|
124
|
+
Puck will automatically cache the output of the [`fetchList()`](#fetchlistqueryparams) function in memory.
|
|
125
|
+
|
|
126
|
+
You can disable this behaviour by setting `cache: { enabled: false }` on your field.
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
const config = {
|
|
130
|
+
components: {
|
|
131
|
+
Example: {
|
|
132
|
+
fields: {
|
|
133
|
+
data: {
|
|
134
|
+
type: "external",
|
|
135
|
+
cache: { enabled: true },
|
|
136
|
+
fetchList: async () => {
|
|
137
|
+
// ... fetch data from a third party API, or other async source
|
|
138
|
+
|
|
139
|
+
return [
|
|
140
|
+
{ title: "Hello, world", description: "Lorem ipsum 1" },
|
|
141
|
+
{ title: "Goodbye, world", description: "Lorem ipsum 2" },
|
|
142
|
+
];
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
// ...
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### `filterFields`
|
|
153
|
+
|
|
154
|
+
An object describing filters for your query using the [Fields API](/docs/api-reference/fields)
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
const config = {
|
|
158
|
+
components: {
|
|
159
|
+
Example: {
|
|
160
|
+
fields: {
|
|
161
|
+
data: {
|
|
162
|
+
type: "external",
|
|
163
|
+
fetchList: async ({ filters }) => {
|
|
164
|
+
return [
|
|
165
|
+
{ title: "Apple", description: "Lorem ipsum 1", rating: 5 },
|
|
166
|
+
{ title: "Orange", description: "Lorem ipsum 2", rating: 3 },
|
|
167
|
+
].filter((item) => item.rating >= (filters.rating || 0));
|
|
168
|
+
},
|
|
169
|
+
filterFields: {
|
|
170
|
+
rating: {
|
|
171
|
+
type: "number",
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
// ...
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### `getItemSummary(item)`
|
|
183
|
+
|
|
184
|
+
Get the label to show once the item is selected. Returns a [ReactNode](https://react.dev/learn/typescript#typing-children).
|
|
185
|
+
|
|
186
|
+
> **Warning:** Avoid using interactive HTML elements like `<button>`, `<input>`, or `<a>` inside `getItemSummary`. These elements can interfere with the array field's built-in interactions (such as drag-and-drop reordering and item expansion). Stick to non-interactive elements like `<div>`, `<span>`, `<p>`, or plain text for summaries.
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
const config = {
|
|
190
|
+
components: {
|
|
191
|
+
Example: {
|
|
192
|
+
fields: {
|
|
193
|
+
data: {
|
|
194
|
+
type: "external",
|
|
195
|
+
fetchList: async () => {
|
|
196
|
+
return [
|
|
197
|
+
{ title: "Hello, world", description: "Lorem ipsum 1" },
|
|
198
|
+
{ title: "Goodbye, world", description: "Lorem ipsum 2" },
|
|
199
|
+
];
|
|
200
|
+
},
|
|
201
|
+
getItemSummary: (item) => item.title,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
// ...
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### `initialFilters`
|
|
211
|
+
|
|
212
|
+
The initial filter values when using [`filterFields`](#filterfields).
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
const config = {
|
|
216
|
+
components: {
|
|
217
|
+
Example: {
|
|
218
|
+
fields: {
|
|
219
|
+
data: {
|
|
220
|
+
type: "external",
|
|
221
|
+
fetchList: async ({ filters }) => {
|
|
222
|
+
return [
|
|
223
|
+
{ title: "Apple", description: "Lorem ipsum 1", rating: 5 },
|
|
224
|
+
{ title: "Orange", description: "Lorem ipsum 2", rating: 3 },
|
|
225
|
+
].filter((item) => item.rating >= (filters.rating || 0));
|
|
226
|
+
},
|
|
227
|
+
filterFields: {
|
|
228
|
+
rating: {
|
|
229
|
+
type: "number",
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
initialFilters: {
|
|
233
|
+
rating: 1,
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
// ...
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### `initialQuery`
|
|
244
|
+
|
|
245
|
+
Set an initial query when using showing a search input with [`showSearch`](#showsearch).
|
|
246
|
+
|
|
247
|
+
```tsx
|
|
248
|
+
const config = {
|
|
249
|
+
components: {
|
|
250
|
+
Example: {
|
|
251
|
+
fields: {
|
|
252
|
+
data: {
|
|
253
|
+
type: "external",
|
|
254
|
+
fetchList: async ({ query }) => {
|
|
255
|
+
return [
|
|
256
|
+
{ title: "Apple", description: "Lorem ipsum 1" },
|
|
257
|
+
{ title: "Orange", description: "Lorem ipsum 2" },
|
|
258
|
+
].filter((item) => {
|
|
259
|
+
// ...
|
|
260
|
+
});
|
|
261
|
+
},
|
|
262
|
+
showSearch: true,
|
|
263
|
+
initialQuery: "Apple",
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
// ...
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### `mapProp(item)`
|
|
273
|
+
|
|
274
|
+
Modify the shape of the item selected by the user in the table before writing to the page data.
|
|
275
|
+
|
|
276
|
+
```tsx
|
|
277
|
+
const config = {
|
|
278
|
+
components: {
|
|
279
|
+
Example: {
|
|
280
|
+
fields: {
|
|
281
|
+
data: {
|
|
282
|
+
type: "external",
|
|
283
|
+
fetchList: async () => {
|
|
284
|
+
return [
|
|
285
|
+
{ title: "Hello, world", description: "Lorem ipsum 1" },
|
|
286
|
+
{ title: "Goodbye, world", description: "Lorem ipsum 2" },
|
|
287
|
+
];
|
|
288
|
+
},
|
|
289
|
+
mapProp: (item) => item.description,
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
render: ({ data }) => {
|
|
293
|
+
return <p>{data || "No data selected"}</p>;
|
|
294
|
+
},
|
|
295
|
+
// ...
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
};
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### `mapRow(item)`
|
|
302
|
+
|
|
303
|
+
Modify the shape of the item before rendering it in the table. This will not affect the selected data.
|
|
304
|
+
|
|
305
|
+
```tsx
|
|
306
|
+
const config = {
|
|
307
|
+
components: {
|
|
308
|
+
Example: {
|
|
309
|
+
fields: {
|
|
310
|
+
data: {
|
|
311
|
+
type: "external",
|
|
312
|
+
fetchList: async () => {
|
|
313
|
+
return [
|
|
314
|
+
{ title: "Hello, world", description: "Lorem ipsum 1" },
|
|
315
|
+
{ title: "Goodbye, world", description: "Lorem ipsum 2" },
|
|
316
|
+
];
|
|
317
|
+
},
|
|
318
|
+
mapRow: (item) => ({ ...item, title: item.title.toUpperCase() }),
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
render: ({ data }) => {
|
|
322
|
+
return <p>{data || "No data selected"}</p>;
|
|
323
|
+
},
|
|
324
|
+
// ...
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
};
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### `placeholder`
|
|
331
|
+
|
|
332
|
+
Set the placeholder text when no item is selected.
|
|
333
|
+
|
|
334
|
+
```tsx
|
|
335
|
+
const config = {
|
|
336
|
+
components: {
|
|
337
|
+
Example: {
|
|
338
|
+
fields: {
|
|
339
|
+
data: {
|
|
340
|
+
type: "external",
|
|
341
|
+
fetchList: async () => {
|
|
342
|
+
return [
|
|
343
|
+
{ title: "Apple", description: "Lorem ipsum 1" },
|
|
344
|
+
{ title: "Orange", description: "Lorem ipsum 2" },
|
|
345
|
+
];
|
|
346
|
+
},
|
|
347
|
+
placeholder: "Pick your favorite fruit",
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
// ...
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
};
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### `renderFooter(props)`
|
|
357
|
+
|
|
358
|
+
Customize what will be displayed in the footer of the modal.
|
|
359
|
+
|
|
360
|
+
```tsx
|
|
361
|
+
const config = {
|
|
362
|
+
components: {
|
|
363
|
+
Example: {
|
|
364
|
+
fields: {
|
|
365
|
+
data: {
|
|
366
|
+
type: "external",
|
|
367
|
+
fetchList: async () => {
|
|
368
|
+
return [
|
|
369
|
+
{ title: "Hello, world", description: "Lorem ipsum 1" },
|
|
370
|
+
{ title: "Goodbye, world", description: "Lorem ipsum 2" },
|
|
371
|
+
];
|
|
372
|
+
},
|
|
373
|
+
renderFooter: ({ items }) => (
|
|
374
|
+
<b>Custom footer with {items.length} results</b>
|
|
375
|
+
),
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
render: ({ data }) => {
|
|
379
|
+
return <p>{data || "No data selected"}</p>;
|
|
380
|
+
},
|
|
381
|
+
// ...
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
};
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### `showSearch`
|
|
388
|
+
|
|
389
|
+
Show a search input, the value of which will be passed to `fetchList` as the `query` param.
|
|
390
|
+
|
|
391
|
+
```tsx
|
|
392
|
+
const config = {
|
|
393
|
+
components: {
|
|
394
|
+
Example: {
|
|
395
|
+
fields: {
|
|
396
|
+
data: {
|
|
397
|
+
type: "external",
|
|
398
|
+
fetchList: async ({ query }) => {
|
|
399
|
+
return [
|
|
400
|
+
{ title: "Apple", description: "Lorem ipsum 1" },
|
|
401
|
+
{ title: "Orange", description: "Lorem ipsum 2" },
|
|
402
|
+
].filter((item) => {
|
|
403
|
+
// ...
|
|
404
|
+
});
|
|
405
|
+
},
|
|
406
|
+
showSearch: true,
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
// ...
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
};
|
|
413
|
+
```
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Number
|
|
2
|
+
|
|
3
|
+
Render a `number` input. Extends [Base](/docs/api-reference/fields/base).
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const config = {
|
|
7
|
+
components: {
|
|
8
|
+
Example: {
|
|
9
|
+
fields: {
|
|
10
|
+
myNumber: {
|
|
11
|
+
type: "number",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
render: ({ myNumber }) => {
|
|
15
|
+
return <div>{myNumber}</div>;
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Params
|
|
23
|
+
|
|
24
|
+
| Param | Example | Type | Status |
|
|
25
|
+
| ----------------------------- | ------------------------------- | -------- | -------- |
|
|
26
|
+
| [`type`](#type) | `type: "number"` | "number" | Required |
|
|
27
|
+
| [`max`](#max) | `max: 10` | number | - |
|
|
28
|
+
| [`min`](#min) | `min: 0` | number | - |
|
|
29
|
+
| [`placeholder`](#placeholder) | `placeholder: "Lorem ipsum..."` | String | - |
|
|
30
|
+
|
|
31
|
+
## Required params
|
|
32
|
+
|
|
33
|
+
### `type`
|
|
34
|
+
|
|
35
|
+
The type of the field. Must be `"number"` for Number fields.
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
const config = {
|
|
39
|
+
components: {
|
|
40
|
+
Example: {
|
|
41
|
+
fields: {
|
|
42
|
+
myNumber: {
|
|
43
|
+
type: "number",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
// ...
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Optional params
|
|
53
|
+
|
|
54
|
+
### `max`
|
|
55
|
+
|
|
56
|
+
The maximum numeric value allowed.
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
const config = {
|
|
60
|
+
components: {
|
|
61
|
+
Example: {
|
|
62
|
+
fields: {
|
|
63
|
+
myNumber: {
|
|
64
|
+
type: "number",
|
|
65
|
+
max: 10,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
// ...
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### `min`
|
|
75
|
+
|
|
76
|
+
The minimum numeric value allowed.
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
const config = {
|
|
80
|
+
components: {
|
|
81
|
+
Example: {
|
|
82
|
+
fields: {
|
|
83
|
+
myNumber: {
|
|
84
|
+
type: "number",
|
|
85
|
+
min: 0,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
// ...
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Placeholder
|
|
95
|
+
|
|
96
|
+
The placeholder text to display when the field is empty.
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
const config = {
|
|
100
|
+
components: {
|
|
101
|
+
Example: {
|
|
102
|
+
fields: {
|
|
103
|
+
myNumber: {
|
|
104
|
+
type: "number",
|
|
105
|
+
placeholder: "Lorem ipsum...",
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
// ...
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### `step`
|
|
115
|
+
|
|
116
|
+
The stepping interval when interacting with the field.
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
const config = {
|
|
120
|
+
components: {
|
|
121
|
+
Example: {
|
|
122
|
+
fields: {
|
|
123
|
+
myNumber: {
|
|
124
|
+
type: "number",
|
|
125
|
+
step: 0.1,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
// ...
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
```
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Object
|
|
2
|
+
|
|
3
|
+
Render an object with a subset of fields. Extends [Base](/docs/api-reference/fields/base).
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const config = {
|
|
7
|
+
components: {
|
|
8
|
+
Example: {
|
|
9
|
+
fields: {
|
|
10
|
+
params: {
|
|
11
|
+
type: "object",
|
|
12
|
+
objectFields: {
|
|
13
|
+
title: { type: "text" },
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
render: ({ params }) => {
|
|
18
|
+
return <p>{params.title}</p>;
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Params
|
|
26
|
+
|
|
27
|
+
| Param | Example | Type | Status |
|
|
28
|
+
| ------------------------------- | ------------------------------------------- | ------- | -------- |
|
|
29
|
+
| [`type`](#type) | `type: "array"` | "array" | Required |
|
|
30
|
+
| [`objectFields`](#objectfields) | `objectFields: { title: { type: "text" } }` | Object | Required |
|
|
31
|
+
|
|
32
|
+
## Required params
|
|
33
|
+
|
|
34
|
+
### `type`
|
|
35
|
+
|
|
36
|
+
The type of the field. Must be `"object"` for Object fields.
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
const config = {
|
|
40
|
+
components: {
|
|
41
|
+
Example: {
|
|
42
|
+
fields: {
|
|
43
|
+
items: {
|
|
44
|
+
type: "object",
|
|
45
|
+
objectFields: {
|
|
46
|
+
title: { type: "text" },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
// ...
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### `objectFields`
|
|
57
|
+
|
|
58
|
+
Describe the fields for the object. Shares an API with `fields`.
|
|
59
|
+
|
|
60
|
+
Can include any field type, including nested object fields.
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
const config = {
|
|
64
|
+
components: {
|
|
65
|
+
Example: {
|
|
66
|
+
fields: {
|
|
67
|
+
items: {
|
|
68
|
+
type: "object",
|
|
69
|
+
objectFields: {
|
|
70
|
+
title: { type: "text" },
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
// ...
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
```
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Radio
|
|
2
|
+
|
|
3
|
+
Render a `radio` input with a list of options. Extends [Base](/docs/api-reference/fields/base).
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const config = {
|
|
7
|
+
components: {
|
|
8
|
+
Example: {
|
|
9
|
+
fields: {
|
|
10
|
+
textAlign: {
|
|
11
|
+
type: "radio",
|
|
12
|
+
options: [
|
|
13
|
+
{ label: "Left", value: "left" },
|
|
14
|
+
{ label: "Right", value: "right" },
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultProps: {
|
|
19
|
+
textAlign: "left",
|
|
20
|
+
},
|
|
21
|
+
render: ({ textAlign }) => {
|
|
22
|
+
return <p style={{ textAlign }}>Hello, world</p>;
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Params
|
|
30
|
+
|
|
31
|
+
| Param | Example | Type | Status |
|
|
32
|
+
| --------------------- | ----------------------------------------------------- | -------- | -------- |
|
|
33
|
+
| [`type`](#type) | `type: "radio"` | "radio" | Required |
|
|
34
|
+
| [`options`](#options) | `options: [{ label: "Option 1", value: "option-1" }]` | Object[] | Required |
|
|
35
|
+
|
|
36
|
+
## Required params
|
|
37
|
+
|
|
38
|
+
### `type`
|
|
39
|
+
|
|
40
|
+
The type of the field. Must be `"radio"` for Array fields.
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
const config = {
|
|
44
|
+
components: {
|
|
45
|
+
Example: {
|
|
46
|
+
fields: {
|
|
47
|
+
textAlign: {
|
|
48
|
+
type: "radio",
|
|
49
|
+
options: [
|
|
50
|
+
{ label: "Left", value: "left" },
|
|
51
|
+
{ label: "Right", value: "right" },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
// ...
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### `options`
|
|
62
|
+
|
|
63
|
+
The options for the radio field. The `value` can be a String, Number or Boolean.
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
const config = {
|
|
67
|
+
components: {
|
|
68
|
+
Example: {
|
|
69
|
+
fields: {
|
|
70
|
+
textAlign: {
|
|
71
|
+
type: "radio",
|
|
72
|
+
options: [
|
|
73
|
+
{ label: "Left", value: "left" },
|
|
74
|
+
{ label: "Right", value: "right" },
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
// ...
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
```
|