@contember/react-client
Advanced tools
Comparing version 1.0.0-rc.23 to 1.0.0-rc.24
{ | ||
"name": "@contember/react-client", | ||
"license": "Apache-2.0", | ||
"version": "1.0.0-rc.23", | ||
"version": "1.0.0-rc.24", | ||
"type": "module", | ||
@@ -22,3 +22,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@contember/client": "1.0.0-rc.23" | ||
"@contember/client": "1.0.0-rc.24" | ||
}, | ||
@@ -29,5 +29,7 @@ "peerDependencies": { | ||
"scripts": { | ||
"build": "vite build --mode development && vite build --mode production" | ||
"build": "pnpm run build:js:dev && pnpm run build:js:prod", | ||
"build:js:dev": "vite build --mode development", | ||
"build:js:prod": "vite build --mode production" | ||
}, | ||
"readme": "# `@contember/react-client`\n\n## Usage\n\nIf you wish to communicate with any Contember API, wrap your code with the `ContemberClient` component:\n\n```tsx\nimport { ContemberClient } from '@contember/react-client'\n\n<ContemberClient\n\tapiBaseUrl=\"https://api.example.com\"\n\tproject=\"PROJECT-SLUG\"\n\tsessionToken=\"SESSION-TOKEN\"\n\tstage=\"STAGE-SLUG\"\n>\n\t...\n</ContemberClient>\n```\n\n## Notable APIs\n\nYou'll have to look at the code for now, sorry.\n\n- `<RichTextRenderer />`\n- `useFileUpload`\n- `useContentApiRequest` / `useTenantApiRequest` / `useSystemApiRequest`\n\n## RichTextRenderer\n\nHere is simple exmaple of how to use the `RichTextRenderer` component with custom references and elements.\n\n```tsx\nimport { RichTextRenderer } from '@contember/react-client'\nimport Image from './myComponents/Image'\nimport Gallery from './myComponents/Gallery'\nimport Quote from './myComponents/Quote'\nimport Link from './myComponents/Link'\n\n<RichTextRenderer\n\tsourceField=\"json\"\n\trenderElement={(props) => {\n\t\tif (props.element.type === 'link' && props.reference) {\n\t\t\treturn <Link label={props.element.children[0].text} url={props.reference.target} />\n\t\t}\n\n\t\treturn props.fallback\n\t}}\n\treferenceRenderers={{\n\t\timage: (reference) => <Image reference={reference} />,\n\t\tgallery: (reference) => <Gallery reference={reference} />,\n\t\tquote: (reference) => <Quote reference={reference} />,\n\t}}\n/>\n```\n\n| Prop | Description |\n| -------------------- | ----------------------------------------------------- |\n| `sourceField` | The field in the GraphQL that contains the rich text. |\n| `renderElement` | Function that renders an element. |\n| `referenceRenderers` | Object that maps reference types to renderers. |\n" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
427112
+ Added@contember/client@1.0.0-rc.24(transitive)
- Removed@contember/client@1.0.0-rc.23(transitive)