@webstudio-is/sdk-components-react 0.70.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/LICENSE +21 -0
- package/README.md +3 -0
- package/lib/__generated__/blockquote.props.js +399 -0
- package/lib/__generated__/body.props.js +398 -0
- package/lib/__generated__/bold.props.js +398 -0
- package/lib/__generated__/box.props.js +416 -0
- package/lib/__generated__/button.props.js +420 -0
- package/lib/__generated__/checkbox-field.props.js +399 -0
- package/lib/__generated__/checkbox.props.js +439 -0
- package/lib/__generated__/code-text.props.js +405 -0
- package/lib/__generated__/error-message.props.js +398 -0
- package/lib/__generated__/form.props.js +406 -0
- package/lib/__generated__/fragment.props.js +4 -0
- package/lib/__generated__/heading.props.js +405 -0
- package/lib/__generated__/html-embed.props.js +11 -0
- package/lib/__generated__/image.props.js +442 -0
- package/lib/__generated__/input.props.js +445 -0
- package/lib/__generated__/italic.props.js +398 -0
- package/lib/__generated__/label.props.js +400 -0
- package/lib/__generated__/link-block.props.js +432 -0
- package/lib/__generated__/link.props.js +432 -0
- package/lib/__generated__/list-item.props.js +399 -0
- package/lib/__generated__/list.props.js +412 -0
- package/lib/__generated__/paragraph.props.js +398 -0
- package/lib/__generated__/radio-button-field.props.js +399 -0
- package/lib/__generated__/radio-button.props.js +439 -0
- package/lib/__generated__/rich-text-link.props.js +432 -0
- package/lib/__generated__/separator.props.js +398 -0
- package/lib/__generated__/slot.props.js +4 -0
- package/lib/__generated__/span.props.js +398 -0
- package/lib/__generated__/subscript.props.js +398 -0
- package/lib/__generated__/success-message.props.js +398 -0
- package/lib/__generated__/superscript.props.js +398 -0
- package/lib/__generated__/text-block.props.js +405 -0
- package/lib/__generated__/textarea.props.js +412 -0
- package/lib/blockquote.js +15 -0
- package/lib/blockquote.ws.js +76 -0
- package/lib/body.js +9 -0
- package/lib/body.ws.js +47 -0
- package/lib/bold.js +9 -0
- package/lib/bold.ws.js +23 -0
- package/lib/box.js +14 -0
- package/lib/box.ws.js +46 -0
- package/lib/button.js +16 -0
- package/lib/button.ws.js +31 -0
- package/lib/checkbox-field.js +9 -0
- package/lib/checkbox-field.ws.js +44 -0
- package/lib/checkbox.js +9 -0
- package/lib/checkbox.ws.js +40 -0
- package/lib/cjs/__generated__/blockquote.props.js +419 -0
- package/lib/cjs/__generated__/body.props.js +418 -0
- package/lib/cjs/__generated__/bold.props.js +418 -0
- package/lib/cjs/__generated__/box.props.js +436 -0
- package/lib/cjs/__generated__/button.props.js +440 -0
- package/lib/cjs/__generated__/checkbox-field.props.js +419 -0
- package/lib/cjs/__generated__/checkbox.props.js +459 -0
- package/lib/cjs/__generated__/code-text.props.js +425 -0
- package/lib/cjs/__generated__/error-message.props.js +418 -0
- package/lib/cjs/__generated__/form.props.js +426 -0
- package/lib/cjs/__generated__/fragment.props.js +24 -0
- package/lib/cjs/__generated__/heading.props.js +425 -0
- package/lib/cjs/__generated__/html-embed.props.js +31 -0
- package/lib/cjs/__generated__/image.props.js +462 -0
- package/lib/cjs/__generated__/input.props.js +465 -0
- package/lib/cjs/__generated__/italic.props.js +418 -0
- package/lib/cjs/__generated__/label.props.js +420 -0
- package/lib/cjs/__generated__/link-block.props.js +452 -0
- package/lib/cjs/__generated__/link.props.js +452 -0
- package/lib/cjs/__generated__/list-item.props.js +419 -0
- package/lib/cjs/__generated__/list.props.js +432 -0
- package/lib/cjs/__generated__/paragraph.props.js +418 -0
- package/lib/cjs/__generated__/radio-button-field.props.js +419 -0
- package/lib/cjs/__generated__/radio-button.props.js +459 -0
- package/lib/cjs/__generated__/rich-text-link.props.js +452 -0
- package/lib/cjs/__generated__/separator.props.js +418 -0
- package/lib/cjs/__generated__/slot.props.js +24 -0
- package/lib/cjs/__generated__/span.props.js +418 -0
- package/lib/cjs/__generated__/subscript.props.js +418 -0
- package/lib/cjs/__generated__/success-message.props.js +418 -0
- package/lib/cjs/__generated__/superscript.props.js +418 -0
- package/lib/cjs/__generated__/text-block.props.js +425 -0
- package/lib/cjs/__generated__/textarea.props.js +432 -0
- package/lib/cjs/blockquote.js +32 -0
- package/lib/cjs/blockquote.ws.js +94 -0
- package/lib/cjs/body.js +29 -0
- package/lib/cjs/body.ws.js +65 -0
- package/lib/cjs/bold.js +29 -0
- package/lib/cjs/bold.ws.js +41 -0
- package/lib/cjs/box.js +31 -0
- package/lib/cjs/box.ws.js +53 -0
- package/lib/cjs/button.js +36 -0
- package/lib/cjs/button.ws.js +49 -0
- package/lib/cjs/checkbox-field.js +29 -0
- package/lib/cjs/checkbox-field.ws.js +62 -0
- package/lib/cjs/checkbox.js +29 -0
- package/lib/cjs/checkbox.ws.js +58 -0
- package/lib/cjs/code-text.js +39 -0
- package/lib/cjs/code-text.ws.js +74 -0
- package/lib/cjs/components.js +88 -0
- package/lib/cjs/error-message.js +29 -0
- package/lib/cjs/error-message.ws.js +40 -0
- package/lib/cjs/form.js +29 -0
- package/lib/cjs/form.ws.js +82 -0
- package/lib/cjs/fragment.js +29 -0
- package/lib/cjs/fragment.ws.js +33 -0
- package/lib/cjs/heading.js +31 -0
- package/lib/cjs/heading.ws.js +56 -0
- package/lib/cjs/html-embed.js +80 -0
- package/lib/cjs/html-embed.ws.js +45 -0
- package/lib/cjs/image.js +76 -0
- package/lib/cjs/image.ws.js +66 -0
- package/lib/cjs/input.js +29 -0
- package/lib/cjs/input.ws.js +55 -0
- package/lib/cjs/italic.js +29 -0
- package/lib/cjs/italic.ws.js +47 -0
- package/lib/cjs/label.js +29 -0
- package/lib/cjs/label.ws.js +63 -0
- package/lib/cjs/link-block.js +30 -0
- package/lib/cjs/link-block.ws.js +53 -0
- package/lib/cjs/link.js +48 -0
- package/lib/cjs/link.ws.js +79 -0
- package/lib/cjs/list-item.js +32 -0
- package/lib/cjs/list-item.ws.js +51 -0
- package/lib/cjs/list.js +31 -0
- package/lib/cjs/list.ws.js +73 -0
- package/lib/cjs/metas.js +88 -0
- package/lib/cjs/package.json +1 -0
- package/lib/cjs/paragraph.js +29 -0
- package/lib/cjs/paragraph.ws.js +50 -0
- package/lib/cjs/props.js +88 -0
- package/lib/cjs/radio-button-field.js +29 -0
- package/lib/cjs/radio-button-field.ws.js +62 -0
- package/lib/cjs/radio-button.js +29 -0
- package/lib/cjs/radio-button.ws.js +58 -0
- package/lib/cjs/rich-text-link.js +28 -0
- package/lib/cjs/rich-text-link.ws.js +39 -0
- package/lib/cjs/separator.js +32 -0
- package/lib/cjs/separator.ws.js +70 -0
- package/lib/cjs/slot.js +36 -0
- package/lib/cjs/slot.ws.js +36 -0
- package/lib/cjs/span.js +29 -0
- package/lib/cjs/span.ws.js +41 -0
- package/lib/cjs/subscript.js +29 -0
- package/lib/cjs/subscript.ws.js +41 -0
- package/lib/cjs/success-message.js +29 -0
- package/lib/cjs/success-message.ws.js +40 -0
- package/lib/cjs/superscript.js +29 -0
- package/lib/cjs/superscript.ws.js +41 -0
- package/lib/cjs/text-block.js +32 -0
- package/lib/cjs/text-block.ws.js +57 -0
- package/lib/cjs/textarea.js +29 -0
- package/lib/cjs/textarea.ws.js +59 -0
- package/lib/code-text.js +22 -0
- package/lib/code-text.ws.js +56 -0
- package/lib/components.js +68 -0
- package/lib/error-message.js +9 -0
- package/lib/error-message.ws.js +20 -0
- package/lib/form.js +9 -0
- package/lib/form.ws.js +64 -0
- package/lib/fragment.js +9 -0
- package/lib/fragment.ws.js +13 -0
- package/lib/heading.js +14 -0
- package/lib/heading.ws.js +38 -0
- package/lib/html-embed.js +65 -0
- package/lib/html-embed.ws.js +25 -0
- package/lib/image.js +66 -0
- package/lib/image.ws.js +48 -0
- package/lib/input.js +9 -0
- package/lib/input.ws.js +37 -0
- package/lib/italic.js +9 -0
- package/lib/italic.ws.js +29 -0
- package/lib/label.js +9 -0
- package/lib/label.ws.js +45 -0
- package/lib/link-block.js +10 -0
- package/lib/link-block.ws.js +33 -0
- package/lib/link.js +32 -0
- package/lib/link.ws.js +61 -0
- package/lib/list-item.js +15 -0
- package/lib/list-item.ws.js +33 -0
- package/lib/list.js +14 -0
- package/lib/list.ws.js +55 -0
- package/lib/metas.js +68 -0
- package/lib/paragraph.js +9 -0
- package/lib/paragraph.ws.js +32 -0
- package/lib/props.js +68 -0
- package/lib/radio-button-field.js +9 -0
- package/lib/radio-button-field.ws.js +44 -0
- package/lib/radio-button.js +9 -0
- package/lib/radio-button.ws.js +40 -0
- package/lib/rich-text-link.js +8 -0
- package/lib/rich-text-link.ws.js +19 -0
- package/lib/separator.js +15 -0
- package/lib/separator.ws.js +52 -0
- package/lib/slot.js +16 -0
- package/lib/slot.ws.js +16 -0
- package/lib/span.js +9 -0
- package/lib/span.ws.js +23 -0
- package/lib/subscript.js +9 -0
- package/lib/subscript.ws.js +23 -0
- package/lib/success-message.js +9 -0
- package/lib/success-message.ws.js +20 -0
- package/lib/superscript.js +9 -0
- package/lib/superscript.ws.js +23 -0
- package/lib/text-block.js +15 -0
- package/lib/text-block.ws.js +39 -0
- package/lib/textarea.js +9 -0
- package/lib/textarea.ws.js +41 -0
- package/lib/types/__generated__/blockquote.props.d.ts +2 -0
- package/lib/types/__generated__/body.props.d.ts +2 -0
- package/lib/types/__generated__/bold.props.d.ts +2 -0
- package/lib/types/__generated__/box.props.d.ts +2 -0
- package/lib/types/__generated__/button.props.d.ts +2 -0
- package/lib/types/__generated__/checkbox-field.props.d.ts +2 -0
- package/lib/types/__generated__/checkbox.props.d.ts +2 -0
- package/lib/types/__generated__/code-text.props.d.ts +2 -0
- package/lib/types/__generated__/error-message.props.d.ts +2 -0
- package/lib/types/__generated__/form.props.d.ts +2 -0
- package/lib/types/__generated__/fragment.props.d.ts +2 -0
- package/lib/types/__generated__/heading.props.d.ts +2 -0
- package/lib/types/__generated__/html-embed.props.d.ts +2 -0
- package/lib/types/__generated__/image.props.d.ts +2 -0
- package/lib/types/__generated__/input.props.d.ts +2 -0
- package/lib/types/__generated__/italic.props.d.ts +2 -0
- package/lib/types/__generated__/label.props.d.ts +2 -0
- package/lib/types/__generated__/link-block.props.d.ts +2 -0
- package/lib/types/__generated__/link.props.d.ts +2 -0
- package/lib/types/__generated__/list-item.props.d.ts +2 -0
- package/lib/types/__generated__/list.props.d.ts +2 -0
- package/lib/types/__generated__/paragraph.props.d.ts +2 -0
- package/lib/types/__generated__/radio-button-field.props.d.ts +2 -0
- package/lib/types/__generated__/radio-button.props.d.ts +2 -0
- package/lib/types/__generated__/rich-text-link.props.d.ts +2 -0
- package/lib/types/__generated__/separator.props.d.ts +2 -0
- package/lib/types/__generated__/slot.props.d.ts +2 -0
- package/lib/types/__generated__/span.props.d.ts +2 -0
- package/lib/types/__generated__/subscript.props.d.ts +2 -0
- package/lib/types/__generated__/success-message.props.d.ts +2 -0
- package/lib/types/__generated__/superscript.props.d.ts +2 -0
- package/lib/types/__generated__/text-block.props.d.ts +2 -0
- package/lib/types/__generated__/textarea.props.d.ts +2 -0
- package/lib/types/blockquote.d.ts +3 -0
- package/lib/types/blockquote.stories.d.ts +5 -0
- package/lib/types/blockquote.ws.d.ts +3 -0
- package/lib/types/body.d.ts +3 -0
- package/lib/types/body.stories.d.ts +6 -0
- package/lib/types/body.ws.d.ts +3 -0
- package/lib/types/bold.d.ts +3 -0
- package/lib/types/bold.stories.d.ts +5 -0
- package/lib/types/bold.ws.d.ts +3 -0
- package/lib/types/box.d.ts +7 -0
- package/lib/types/box.stories.d.ts +9 -0
- package/lib/types/box.ws.d.ts +3 -0
- package/lib/types/button.d.ts +7 -0
- package/lib/types/button.stories.d.ts +9 -0
- package/lib/types/button.ws.d.ts +3 -0
- package/lib/types/checkbox-field.d.ts +3 -0
- package/lib/types/checkbox-field.ws.d.ts +3 -0
- package/lib/types/checkbox.d.ts +3 -0
- package/lib/types/checkbox.ws.d.ts +3 -0
- package/lib/types/code-text.d.ts +9 -0
- package/lib/types/code-text.stories.d.ts +11 -0
- package/lib/types/code-text.ws.d.ts +3 -0
- package/lib/types/components.d.ts +33 -0
- package/lib/types/error-message.d.ts +3 -0
- package/lib/types/error-message.ws.d.ts +3 -0
- package/lib/types/form.d.ts +3 -0
- package/lib/types/form.stories.d.ts +5 -0
- package/lib/types/form.ws.d.ts +3 -0
- package/lib/types/fragment.d.ts +6 -0
- package/lib/types/fragment.ws.d.ts +3 -0
- package/lib/types/heading.d.ts +7 -0
- package/lib/types/heading.stories.d.ts +9 -0
- package/lib/types/heading.ws.d.ts +3 -0
- package/lib/types/html-embed.d.ts +7 -0
- package/lib/types/html-embed.stories.d.ts +11 -0
- package/lib/types/html-embed.ws.d.ts +3 -0
- package/lib/types/image.d.ts +7 -0
- package/lib/types/image.stories.d.ts +13 -0
- package/lib/types/image.ws.d.ts +3 -0
- package/lib/types/input.d.ts +5 -0
- package/lib/types/input.stories.d.ts +9 -0
- package/lib/types/input.ws.d.ts +3 -0
- package/lib/types/italic.d.ts +3 -0
- package/lib/types/italic.stories.d.ts +5 -0
- package/lib/types/italic.ws.d.ts +3 -0
- package/lib/types/label.d.ts +3 -0
- package/lib/types/label.ws.d.ts +3 -0
- package/lib/types/link-block.d.ts +3 -0
- package/lib/types/link-block.stories.d.ts +13 -0
- package/lib/types/link-block.ws.d.ts +3 -0
- package/lib/types/link.d.ts +9 -0
- package/lib/types/link.stories.d.ts +13 -0
- package/lib/types/link.ws.d.ts +3 -0
- package/lib/types/list-item.d.ts +3 -0
- package/lib/types/list-item.stories.d.ts +5 -0
- package/lib/types/list-item.ws.d.ts +3 -0
- package/lib/types/list.d.ts +9 -0
- package/lib/types/list.stories.d.ts +9 -0
- package/lib/types/list.ws.d.ts +3 -0
- package/lib/types/metas.d.ts +33 -0
- package/lib/types/paragraph.d.ts +3 -0
- package/lib/types/paragraph.stories.d.ts +5 -0
- package/lib/types/paragraph.ws.d.ts +3 -0
- package/lib/types/props.d.ts +33 -0
- package/lib/types/radio-button-field.d.ts +3 -0
- package/lib/types/radio-button-field.ws.d.ts +3 -0
- package/lib/types/radio-button.d.ts +3 -0
- package/lib/types/radio-button.ws.d.ts +3 -0
- package/lib/types/rich-text-link.d.ts +2 -0
- package/lib/types/rich-text-link.stories.d.ts +13 -0
- package/lib/types/rich-text-link.ws.d.ts +3 -0
- package/lib/types/separator.d.ts +3 -0
- package/lib/types/separator.stories.d.ts +5 -0
- package/lib/types/separator.ws.d.ts +3 -0
- package/lib/types/slot.d.ts +6 -0
- package/lib/types/slot.stories.d.ts +9 -0
- package/lib/types/slot.ws.d.ts +3 -0
- package/lib/types/span.d.ts +3 -0
- package/lib/types/span.stories.d.ts +5 -0
- package/lib/types/span.ws.d.ts +3 -0
- package/lib/types/subscript.d.ts +3 -0
- package/lib/types/subscript.stories.d.ts +5 -0
- package/lib/types/subscript.ws.d.ts +3 -0
- package/lib/types/success-message.d.ts +3 -0
- package/lib/types/success-message.ws.d.ts +3 -0
- package/lib/types/superscript.d.ts +3 -0
- package/lib/types/superscript.stories.d.ts +5 -0
- package/lib/types/superscript.ws.d.ts +3 -0
- package/lib/types/text-block.d.ts +7 -0
- package/lib/types/text-block.stories.d.ts +9 -0
- package/lib/types/text-block.ws.d.ts +3 -0
- package/lib/types/textarea.d.ts +3 -0
- package/lib/types/textarea.ws.d.ts +3 -0
- package/package.json +69 -0
- package/src/__generated__/blockquote.props.ts +444 -0
- package/src/__generated__/body.props.ts +443 -0
- package/src/__generated__/bold.props.ts +443 -0
- package/src/__generated__/box.props.ts +461 -0
- package/src/__generated__/button.props.ts +465 -0
- package/src/__generated__/checkbox-field.props.ts +444 -0
- package/src/__generated__/checkbox.props.ts +484 -0
- package/src/__generated__/code-text.props.ts +450 -0
- package/src/__generated__/error-message.props.ts +443 -0
- package/src/__generated__/form.props.ts +451 -0
- package/src/__generated__/fragment.props.ts +3 -0
- package/src/__generated__/heading.props.ts +450 -0
- package/src/__generated__/html-embed.props.ts +10 -0
- package/src/__generated__/image.props.ts +487 -0
- package/src/__generated__/input.props.ts +490 -0
- package/src/__generated__/italic.props.ts +443 -0
- package/src/__generated__/label.props.ts +445 -0
- package/src/__generated__/link-block.props.ts +477 -0
- package/src/__generated__/link.props.ts +477 -0
- package/src/__generated__/list-item.props.ts +444 -0
- package/src/__generated__/list.props.ts +457 -0
- package/src/__generated__/paragraph.props.ts +443 -0
- package/src/__generated__/radio-button-field.props.ts +444 -0
- package/src/__generated__/radio-button.props.ts +484 -0
- package/src/__generated__/rich-text-link.props.ts +477 -0
- package/src/__generated__/separator.props.ts +443 -0
- package/src/__generated__/slot.props.ts +3 -0
- package/src/__generated__/span.props.ts +443 -0
- package/src/__generated__/subscript.props.ts +443 -0
- package/src/__generated__/success-message.props.ts +443 -0
- package/src/__generated__/superscript.props.ts +443 -0
- package/src/__generated__/text-block.props.ts +450 -0
- package/src/__generated__/textarea.props.ts +457 -0
- package/src/blockquote.stories.tsx +16 -0
- package/src/blockquote.tsx +18 -0
- package/src/blockquote.ws.tsx +81 -0
- package/src/body.stories.tsx +11 -0
- package/src/body.tsx +10 -0
- package/src/body.ws.tsx +51 -0
- package/src/bold.stories.tsx +16 -0
- package/src/bold.tsx +10 -0
- package/src/bold.ws.tsx +26 -0
- package/src/box.stories.tsx +17 -0
- package/src/box.tsx +31 -0
- package/src/box.ws.ts +52 -0
- package/src/button.stories.tsx +13 -0
- package/src/button.tsx +23 -0
- package/src/button.ws.tsx +34 -0
- package/src/checkbox-field.tsx +10 -0
- package/src/checkbox-field.ws.tsx +47 -0
- package/src/checkbox.tsx +13 -0
- package/src/checkbox.ws.tsx +43 -0
- package/src/code-text.stories.tsx +16 -0
- package/src/code-text.tsx +31 -0
- package/src/code-text.ws.tsx +58 -0
- package/src/components.ts +33 -0
- package/src/error-message.tsx +10 -0
- package/src/error-message.ws.tsx +24 -0
- package/src/form.stories.tsx +14 -0
- package/src/form.tsx +14 -0
- package/src/form.ws.tsx +67 -0
- package/src/fragment.tsx +11 -0
- package/src/fragment.ws.ts +15 -0
- package/src/heading.stories.tsx +16 -0
- package/src/heading.tsx +20 -0
- package/src/heading.ws.tsx +44 -0
- package/src/html-embed.stories.tsx +16 -0
- package/src/html-embed.tsx +96 -0
- package/src/html-embed.ws.ts +27 -0
- package/src/image.stories.tsx +15 -0
- package/src/image.tsx +83 -0
- package/src/image.ws.tsx +54 -0
- package/src/input.stories.tsx +14 -0
- package/src/input.tsx +13 -0
- package/src/input.ws.tsx +40 -0
- package/src/italic.stories.tsx +16 -0
- package/src/italic.tsx +10 -0
- package/src/italic.ws.tsx +32 -0
- package/src/label.tsx +10 -0
- package/src/label.ws.tsx +48 -0
- package/src/link-block.stories.tsx +16 -0
- package/src/link-block.tsx +9 -0
- package/src/link-block.ws.tsx +38 -0
- package/src/link.stories.tsx +16 -0
- package/src/link.tsx +44 -0
- package/src/link.ws.tsx +64 -0
- package/src/list-item.stories.tsx +16 -0
- package/src/list-item.tsx +18 -0
- package/src/list-item.ws.tsx +36 -0
- package/src/list.stories.tsx +17 -0
- package/src/list.tsx +26 -0
- package/src/list.ws.tsx +58 -0
- package/src/metas.ts +33 -0
- package/src/paragraph.stories.tsx +16 -0
- package/src/paragraph.tsx +10 -0
- package/src/paragraph.ws.tsx +35 -0
- package/src/props.ts +33 -0
- package/src/radio-button-field.tsx +10 -0
- package/src/radio-button-field.ws.tsx +47 -0
- package/src/radio-button.tsx +13 -0
- package/src/radio-button.ws.tsx +43 -0
- package/src/rich-text-link.stories.tsx +16 -0
- package/src/rich-text-link.tsx +8 -0
- package/src/rich-text-link.ws.tsx +22 -0
- package/src/separator.stories.tsx +14 -0
- package/src/separator.tsx +18 -0
- package/src/separator.ws.tsx +56 -0
- package/src/slot.stories.tsx +16 -0
- package/src/slot.tsx +17 -0
- package/src/slot.ws.ts +18 -0
- package/src/span.stories.tsx +16 -0
- package/src/span.tsx +10 -0
- package/src/span.ws.tsx +26 -0
- package/src/subscript.stories.tsx +16 -0
- package/src/subscript.tsx +10 -0
- package/src/subscript.ws.tsx +26 -0
- package/src/success-message.tsx +10 -0
- package/src/success-message.ws.tsx +24 -0
- package/src/superscript.stories.tsx +16 -0
- package/src/superscript.tsx +10 -0
- package/src/superscript.ws.tsx +26 -0
- package/src/text-block.stories.tsx +16 -0
- package/src/text-block.tsx +21 -0
- package/src/text-block.ws.tsx +42 -0
- package/src/textarea.tsx +13 -0
- package/src/textarea.ws.tsx +44 -0
package/src/bold.ws.tsx
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BoldIcon } from "@webstudio-is/icons/svg";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates,
|
|
4
|
+
type PresetStyle,
|
|
5
|
+
type WsComponentMeta,
|
|
6
|
+
type WsComponentPropsMeta,
|
|
7
|
+
} from "@webstudio-is/react-sdk";
|
|
8
|
+
import { b } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
+
import { props } from "./__generated__/bold.props";
|
|
10
|
+
import type { defaultTag } from "./bold";
|
|
11
|
+
|
|
12
|
+
const presetStyle = {
|
|
13
|
+
b,
|
|
14
|
+
} satisfies PresetStyle<typeof defaultTag>;
|
|
15
|
+
|
|
16
|
+
export const meta: WsComponentMeta = {
|
|
17
|
+
type: "rich-text-child",
|
|
18
|
+
label: "Bold Text",
|
|
19
|
+
icon: BoldIcon,
|
|
20
|
+
states: defaultStates,
|
|
21
|
+
presetStyle,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const propsMeta: WsComponentPropsMeta = {
|
|
25
|
+
props,
|
|
26
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { Box as BoxPrimitive } from "./box";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Box",
|
|
6
|
+
component: BoxPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof BoxPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof BoxPrimitive> = (args) => (
|
|
10
|
+
<BoxPrimitive
|
|
11
|
+
{...args}
|
|
12
|
+
style={{ minHeight: 20, outline: "1px solid black" }}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const Box = Template.bind({});
|
|
17
|
+
Box.args = {};
|
package/src/box.tsx
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createElement,
|
|
3
|
+
forwardRef,
|
|
4
|
+
type ElementRef,
|
|
5
|
+
type ComponentProps,
|
|
6
|
+
} from "react";
|
|
7
|
+
|
|
8
|
+
const defaultTag = "div";
|
|
9
|
+
|
|
10
|
+
// We don't want to enable all tags because Box is usually a container and we have specific components for many tags.
|
|
11
|
+
type Props = ComponentProps<typeof defaultTag> & {
|
|
12
|
+
tag?:
|
|
13
|
+
| "div"
|
|
14
|
+
| "header"
|
|
15
|
+
| "footer"
|
|
16
|
+
| "nav"
|
|
17
|
+
| "main"
|
|
18
|
+
| "section"
|
|
19
|
+
| "article"
|
|
20
|
+
| "aside"
|
|
21
|
+
| "address"
|
|
22
|
+
| "figure";
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const Box = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
|
26
|
+
({ tag = defaultTag, ...props }, ref) => {
|
|
27
|
+
return createElement(tag, { ...props, ref });
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
Box.displayName = "Box";
|
package/src/box.ws.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { BoxIcon } from "@webstudio-is/icons/svg";
|
|
3
|
+
import {
|
|
4
|
+
defaultStates,
|
|
5
|
+
type PresetStyle,
|
|
6
|
+
type WsComponentMeta,
|
|
7
|
+
type WsComponentPropsMeta,
|
|
8
|
+
} from "@webstudio-is/react-sdk";
|
|
9
|
+
import {
|
|
10
|
+
div,
|
|
11
|
+
address,
|
|
12
|
+
article,
|
|
13
|
+
aside,
|
|
14
|
+
figure,
|
|
15
|
+
footer,
|
|
16
|
+
header,
|
|
17
|
+
main,
|
|
18
|
+
nav,
|
|
19
|
+
section,
|
|
20
|
+
} from "@webstudio-is/react-sdk/css-normalize";
|
|
21
|
+
import { props } from "./__generated__/box.props";
|
|
22
|
+
import type { Box } from "./box";
|
|
23
|
+
|
|
24
|
+
type BoxTags = NonNullable<ComponentProps<typeof Box>["tag"]>;
|
|
25
|
+
|
|
26
|
+
const presetStyle = {
|
|
27
|
+
div,
|
|
28
|
+
address,
|
|
29
|
+
article,
|
|
30
|
+
aside,
|
|
31
|
+
figure,
|
|
32
|
+
footer,
|
|
33
|
+
header,
|
|
34
|
+
main,
|
|
35
|
+
nav,
|
|
36
|
+
section,
|
|
37
|
+
} satisfies PresetStyle<BoxTags>;
|
|
38
|
+
|
|
39
|
+
export const meta: WsComponentMeta = {
|
|
40
|
+
category: "general",
|
|
41
|
+
type: "container",
|
|
42
|
+
label: "Box",
|
|
43
|
+
icon: BoxIcon,
|
|
44
|
+
states: defaultStates,
|
|
45
|
+
presetStyle,
|
|
46
|
+
order: 0,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const propsMeta: WsComponentPropsMeta = {
|
|
50
|
+
props,
|
|
51
|
+
initialProps: ["tag"],
|
|
52
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentMeta, ComponentStory } from "@storybook/react";
|
|
2
|
+
import { Button as ButtonPrimitive } from "./button";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Button",
|
|
6
|
+
component: ButtonPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof ButtonPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof ButtonPrimitive> = (args) => (
|
|
10
|
+
<ButtonPrimitive {...args} />
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const Button = Template.bind({});
|
package/src/button.tsx
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
+
|
|
3
|
+
export const defaultTag = "button";
|
|
4
|
+
|
|
5
|
+
type ButtonProps = ComponentProps<typeof defaultTag> & { innerText?: string };
|
|
6
|
+
|
|
7
|
+
export const Button = forwardRef<ElementRef<typeof defaultTag>, ButtonProps>(
|
|
8
|
+
(
|
|
9
|
+
{
|
|
10
|
+
type = "submit",
|
|
11
|
+
innerText = "Edit Inner Text in Properties",
|
|
12
|
+
children,
|
|
13
|
+
...props
|
|
14
|
+
},
|
|
15
|
+
ref
|
|
16
|
+
) => (
|
|
17
|
+
<button type={type} {...props} ref={ref}>
|
|
18
|
+
{children ? children : innerText}
|
|
19
|
+
</button>
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
Button.displayName = "Button";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ButtonElementIcon } from "@webstudio-is/icons/svg";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates,
|
|
4
|
+
type PresetStyle,
|
|
5
|
+
type WsComponentMeta,
|
|
6
|
+
type WsComponentPropsMeta,
|
|
7
|
+
} from "@webstudio-is/react-sdk";
|
|
8
|
+
import { button } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
+
import { props } from "./__generated__/button.props";
|
|
10
|
+
import type { defaultTag } from "./button";
|
|
11
|
+
|
|
12
|
+
const presetStyle = {
|
|
13
|
+
button,
|
|
14
|
+
} satisfies PresetStyle<typeof defaultTag>;
|
|
15
|
+
|
|
16
|
+
export const meta: WsComponentMeta = {
|
|
17
|
+
category: "forms",
|
|
18
|
+
type: "container",
|
|
19
|
+
invalidAncestors: ["Button"],
|
|
20
|
+
label: "Button",
|
|
21
|
+
icon: ButtonElementIcon,
|
|
22
|
+
presetStyle,
|
|
23
|
+
states: [
|
|
24
|
+
...defaultStates,
|
|
25
|
+
{ selector: ":disabled", label: "Disabled" },
|
|
26
|
+
{ selector: ":enabled", label: "Enabled" },
|
|
27
|
+
],
|
|
28
|
+
order: 1,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const propsMeta: WsComponentPropsMeta = {
|
|
32
|
+
props,
|
|
33
|
+
initialProps: ["type", "innerText", "aria-label"],
|
|
34
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
+
|
|
3
|
+
export const defaultTag = "label";
|
|
4
|
+
|
|
5
|
+
export const CheckboxField = forwardRef<
|
|
6
|
+
ElementRef<typeof defaultTag>,
|
|
7
|
+
Omit<ComponentProps<typeof defaultTag>, "htmlFor">
|
|
8
|
+
>((props, ref) => <label {...props} ref={ref} />);
|
|
9
|
+
|
|
10
|
+
CheckboxField.displayName = "CheckboxField";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CheckboxCheckedIcon } from "@webstudio-is/icons/svg";
|
|
2
|
+
import {
|
|
3
|
+
type WsComponentMeta,
|
|
4
|
+
type WsComponentPropsMeta,
|
|
5
|
+
type PresetStyle,
|
|
6
|
+
defaultStates,
|
|
7
|
+
} from "@webstudio-is/react-sdk";
|
|
8
|
+
import { label } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
+
import { props } from "./__generated__/checkbox-field.props";
|
|
10
|
+
import type { defaultTag } from "./checkbox-field";
|
|
11
|
+
|
|
12
|
+
const presetStyle = {
|
|
13
|
+
label: [
|
|
14
|
+
...label,
|
|
15
|
+
{ property: "display", value: { type: "keyword", value: "flex" } },
|
|
16
|
+
],
|
|
17
|
+
} satisfies PresetStyle<typeof defaultTag>;
|
|
18
|
+
|
|
19
|
+
export const meta: WsComponentMeta = {
|
|
20
|
+
category: "forms",
|
|
21
|
+
type: "container",
|
|
22
|
+
label: "Checkbox",
|
|
23
|
+
icon: CheckboxCheckedIcon,
|
|
24
|
+
states: defaultStates,
|
|
25
|
+
presetStyle,
|
|
26
|
+
template: [
|
|
27
|
+
{
|
|
28
|
+
type: "instance",
|
|
29
|
+
component: "CheckboxField",
|
|
30
|
+
children: [
|
|
31
|
+
{ type: "instance", component: "Checkbox", children: [] },
|
|
32
|
+
{
|
|
33
|
+
type: "instance",
|
|
34
|
+
component: "TextBlock",
|
|
35
|
+
label: "Checkbox Label",
|
|
36
|
+
props: [],
|
|
37
|
+
children: [{ type: "text", value: "Checkbox" }],
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const propsMeta: WsComponentPropsMeta = {
|
|
45
|
+
props,
|
|
46
|
+
initialProps: [],
|
|
47
|
+
};
|
package/src/checkbox.tsx
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
+
|
|
3
|
+
export const defaultTag = "input";
|
|
4
|
+
|
|
5
|
+
export const Checkbox = forwardRef<
|
|
6
|
+
ElementRef<typeof defaultTag>,
|
|
7
|
+
Omit<ComponentProps<typeof defaultTag>, "type">
|
|
8
|
+
// Make sure children are not passed down to an input, because this will result in error.
|
|
9
|
+
>(({ children: _children, ...props }, ref) => (
|
|
10
|
+
<input {...props} type="checkbox" ref={ref} />
|
|
11
|
+
));
|
|
12
|
+
|
|
13
|
+
Checkbox.displayName = "Checkbox";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CheckboxCheckedIcon } from "@webstudio-is/icons/svg";
|
|
2
|
+
import {
|
|
3
|
+
type WsComponentMeta,
|
|
4
|
+
type WsComponentPropsMeta,
|
|
5
|
+
type PresetStyle,
|
|
6
|
+
defaultStates,
|
|
7
|
+
} from "@webstudio-is/react-sdk";
|
|
8
|
+
import { input } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
+
import type { defaultTag } from "./checkbox";
|
|
10
|
+
import { props } from "./__generated__/checkbox.props";
|
|
11
|
+
|
|
12
|
+
const presetStyle = {
|
|
13
|
+
input: [
|
|
14
|
+
...input,
|
|
15
|
+
{
|
|
16
|
+
property: "marginRight",
|
|
17
|
+
value: { type: "unit", unit: "em", value: 0.5 },
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
} satisfies PresetStyle<typeof defaultTag>;
|
|
21
|
+
|
|
22
|
+
export const meta: WsComponentMeta = {
|
|
23
|
+
type: "control",
|
|
24
|
+
label: "Checkbox Input",
|
|
25
|
+
icon: CheckboxCheckedIcon,
|
|
26
|
+
presetStyle,
|
|
27
|
+
order: 6,
|
|
28
|
+
states: [
|
|
29
|
+
...defaultStates,
|
|
30
|
+
{ selector: ":checked", label: "Checked" },
|
|
31
|
+
{ selector: ":required", label: "Required" },
|
|
32
|
+
{ selector: ":optional", label: "Optional" },
|
|
33
|
+
{ selector: ":disabled", label: "Disabled" },
|
|
34
|
+
{ selector: ":enabled", label: "Enabled" },
|
|
35
|
+
{ selector: ":read-only", label: "Read Only" },
|
|
36
|
+
{ selector: ":read-write", label: "Read Write" },
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const propsMeta: WsComponentPropsMeta = {
|
|
41
|
+
props,
|
|
42
|
+
initialProps: ["name"],
|
|
43
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { CodeText as CodeTextPrimitive } from "./code-text";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/CodeText",
|
|
6
|
+
component: CodeTextPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof CodeTextPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof CodeTextPrimitive> = (args) => (
|
|
10
|
+
<CodeTextPrimitive {...args} />
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const CodeText = Template.bind({});
|
|
14
|
+
CodeText.args = {
|
|
15
|
+
children: "alert('Hello World!')",
|
|
16
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
createElement,
|
|
4
|
+
type ElementRef,
|
|
5
|
+
type ComponentProps,
|
|
6
|
+
} from "react";
|
|
7
|
+
import { cssVars } from "@webstudio-is/css-vars";
|
|
8
|
+
|
|
9
|
+
export const defaultTag = "code";
|
|
10
|
+
|
|
11
|
+
export const displayVarNamespace = cssVars.unique("code-display");
|
|
12
|
+
|
|
13
|
+
const blockStyle = {
|
|
14
|
+
[cssVars.define(displayVarNamespace, true)]: "block",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type Props = Omit<ComponentProps<typeof defaultTag>, "inline"> & {
|
|
18
|
+
inline?: boolean;
|
|
19
|
+
meta?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const CodeText = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
|
23
|
+
({ inline = false, ...props }, ref) => {
|
|
24
|
+
// @todo in the future we should expose the inline prop a an attribute
|
|
25
|
+
// and define the display style in `presetStyle` in meta.
|
|
26
|
+
const style = inline ? undefined : blockStyle;
|
|
27
|
+
return createElement(defaultTag, { ...props, style, ref });
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
CodeText.displayName = "CodeText";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { CodeTextIcon } from "@webstudio-is/icons/svg";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates,
|
|
4
|
+
type PresetStyle,
|
|
5
|
+
type WsComponentMeta,
|
|
6
|
+
type WsComponentPropsMeta,
|
|
7
|
+
} from "@webstudio-is/react-sdk";
|
|
8
|
+
import { code } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
+
import { type defaultTag, displayVarNamespace } from "./code-text";
|
|
10
|
+
import { props } from "./__generated__/code-text.props";
|
|
11
|
+
|
|
12
|
+
const presetStyle = {
|
|
13
|
+
code: [
|
|
14
|
+
...code,
|
|
15
|
+
{
|
|
16
|
+
property: "display",
|
|
17
|
+
value: {
|
|
18
|
+
type: "var",
|
|
19
|
+
value: displayVarNamespace,
|
|
20
|
+
fallbacks: [{ type: "keyword", value: "inline-block" }],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
property: "paddingLeft",
|
|
25
|
+
value: { type: "unit", value: 0.2, unit: "em" },
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
property: "paddingRight",
|
|
29
|
+
value: { type: "unit", value: 0.2, unit: "em" },
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
property: "backgroundColor",
|
|
33
|
+
value: { type: "rgb", r: 238, g: 238, b: 238, alpha: 1 },
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
} satisfies PresetStyle<typeof defaultTag>;
|
|
37
|
+
|
|
38
|
+
export const meta: WsComponentMeta = {
|
|
39
|
+
category: "general",
|
|
40
|
+
type: "rich-text",
|
|
41
|
+
label: "Code Text",
|
|
42
|
+
icon: CodeTextIcon,
|
|
43
|
+
states: defaultStates,
|
|
44
|
+
presetStyle,
|
|
45
|
+
template: [
|
|
46
|
+
{
|
|
47
|
+
type: "instance",
|
|
48
|
+
component: "CodeText",
|
|
49
|
+
children: [{ type: "text", value: "Code you can edit" }],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
order: 8,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const propsMeta: WsComponentPropsMeta = {
|
|
56
|
+
props,
|
|
57
|
+
initialProps: ["inline", "lang", "meta"],
|
|
58
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { Slot } from "./slot";
|
|
2
|
+
export { Fragment } from "./fragment";
|
|
3
|
+
export { HtmlEmbed } from "./html-embed";
|
|
4
|
+
export { Body } from "./body";
|
|
5
|
+
export { Box } from "./box";
|
|
6
|
+
export { TextBlock } from "./text-block";
|
|
7
|
+
export { Heading } from "./heading";
|
|
8
|
+
export { Paragraph } from "./paragraph";
|
|
9
|
+
export { Link } from "./link";
|
|
10
|
+
export { LinkBlock } from "./link-block";
|
|
11
|
+
export { RichTextLink } from "./rich-text-link";
|
|
12
|
+
export { Span } from "./span";
|
|
13
|
+
export { Bold } from "./bold";
|
|
14
|
+
export { Italic } from "./italic";
|
|
15
|
+
export { Superscript } from "./superscript";
|
|
16
|
+
export { Subscript } from "./subscript";
|
|
17
|
+
export { Button } from "./button";
|
|
18
|
+
export { Input } from "./input";
|
|
19
|
+
export { Form } from "./form";
|
|
20
|
+
export { Image } from "./image";
|
|
21
|
+
export { Blockquote } from "./blockquote";
|
|
22
|
+
export { List } from "./list";
|
|
23
|
+
export { ListItem } from "./list-item";
|
|
24
|
+
export { Separator } from "./separator";
|
|
25
|
+
export { CodeText } from "./code-text";
|
|
26
|
+
export { Label } from "./label";
|
|
27
|
+
export { SuccessMessage } from "./success-message";
|
|
28
|
+
export { ErrorMessage } from "./error-message";
|
|
29
|
+
export { Textarea } from "./textarea";
|
|
30
|
+
export { RadioButtonField } from "./radio-button-field";
|
|
31
|
+
export { RadioButton } from "./radio-button";
|
|
32
|
+
export { CheckboxField } from "./checkbox-field";
|
|
33
|
+
export { Checkbox } from "./checkbox";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
+
|
|
3
|
+
export const defaultTag = "div";
|
|
4
|
+
|
|
5
|
+
export const ErrorMessage = forwardRef<
|
|
6
|
+
ElementRef<typeof defaultTag>,
|
|
7
|
+
ComponentProps<typeof defaultTag>
|
|
8
|
+
>((props, ref) => <div {...props} ref={ref} />);
|
|
9
|
+
|
|
10
|
+
ErrorMessage.displayName = "ErrorMessage";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BoxIcon } from "@webstudio-is/icons/svg";
|
|
2
|
+
import type {
|
|
3
|
+
WsComponentMeta,
|
|
4
|
+
WsComponentPropsMeta,
|
|
5
|
+
PresetStyle,
|
|
6
|
+
} from "@webstudio-is/react-sdk";
|
|
7
|
+
import { div } from "@webstudio-is/react-sdk/css-normalize";
|
|
8
|
+
import { props } from "./__generated__/error-message.props";
|
|
9
|
+
|
|
10
|
+
const presetStyle = {
|
|
11
|
+
div,
|
|
12
|
+
} satisfies PresetStyle<"div">;
|
|
13
|
+
|
|
14
|
+
export const meta: WsComponentMeta = {
|
|
15
|
+
type: "container",
|
|
16
|
+
label: "Error Message",
|
|
17
|
+
icon: BoxIcon,
|
|
18
|
+
presetStyle,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const propsMeta: WsComponentPropsMeta = {
|
|
22
|
+
props,
|
|
23
|
+
initialProps: [],
|
|
24
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { Form as FormPrimitive } from "./form";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Form",
|
|
6
|
+
component: FormPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof FormPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof FormPrimitive> = (args) => (
|
|
10
|
+
<FormPrimitive {...args} />
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const Form = Template.bind({});
|
|
14
|
+
Form.args = {};
|
package/src/form.tsx
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
+
|
|
3
|
+
export const defaultTag = "form";
|
|
4
|
+
|
|
5
|
+
export const Form = forwardRef<
|
|
6
|
+
ElementRef<typeof defaultTag>,
|
|
7
|
+
ComponentProps<typeof defaultTag>
|
|
8
|
+
>(({ children, ...props }, ref) => (
|
|
9
|
+
<form {...props} ref={ref}>
|
|
10
|
+
{children}
|
|
11
|
+
</form>
|
|
12
|
+
));
|
|
13
|
+
|
|
14
|
+
Form.displayName = "Form";
|
package/src/form.ws.tsx
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { FormIcon } from "@webstudio-is/icons/svg";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates,
|
|
4
|
+
type PresetStyle,
|
|
5
|
+
type WsComponentMeta,
|
|
6
|
+
type WsComponentPropsMeta,
|
|
7
|
+
} from "@webstudio-is/react-sdk";
|
|
8
|
+
import { form } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
+
import type { defaultTag } from "./form";
|
|
10
|
+
import { props } from "./__generated__/form.props";
|
|
11
|
+
|
|
12
|
+
const presetStyle = {
|
|
13
|
+
form: [
|
|
14
|
+
...form,
|
|
15
|
+
{ property: "minHeight", value: { type: "unit", unit: "px", value: 20 } },
|
|
16
|
+
],
|
|
17
|
+
} satisfies PresetStyle<typeof defaultTag>;
|
|
18
|
+
|
|
19
|
+
export const meta: WsComponentMeta = {
|
|
20
|
+
category: "forms",
|
|
21
|
+
type: "container",
|
|
22
|
+
label: "Form",
|
|
23
|
+
icon: FormIcon,
|
|
24
|
+
states: defaultStates,
|
|
25
|
+
presetStyle,
|
|
26
|
+
order: 0,
|
|
27
|
+
template: [
|
|
28
|
+
{
|
|
29
|
+
type: "instance",
|
|
30
|
+
component: "Form",
|
|
31
|
+
children: [
|
|
32
|
+
{
|
|
33
|
+
type: "instance",
|
|
34
|
+
component: "Label",
|
|
35
|
+
children: [{ type: "text", value: "Name" }],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: "instance",
|
|
39
|
+
component: "Input",
|
|
40
|
+
props: [{ type: "string", name: "name", value: "name" }],
|
|
41
|
+
children: [],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: "instance",
|
|
45
|
+
component: "Label",
|
|
46
|
+
children: [{ type: "text", value: "Email" }],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: "instance",
|
|
50
|
+
component: "Input",
|
|
51
|
+
props: [{ type: "string", name: "name", value: "email" }],
|
|
52
|
+
children: [],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: "instance",
|
|
56
|
+
component: "Button",
|
|
57
|
+
children: [{ type: "text", value: "Submit" }],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const propsMeta: WsComponentPropsMeta = {
|
|
65
|
+
props,
|
|
66
|
+
initialProps: [],
|
|
67
|
+
};
|
package/src/fragment.tsx
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { forwardRef, type ElementRef, type ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
type Props = {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export const Fragment = forwardRef<ElementRef<"div">, Props>((props, ref) => {
|
|
8
|
+
return <div {...props} ref={ref} style={{ display: "contents" }} />;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
Fragment.displayName = "Fragment";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
WsComponentMeta,
|
|
3
|
+
WsComponentPropsMeta,
|
|
4
|
+
} from "@webstudio-is/react-sdk";
|
|
5
|
+
|
|
6
|
+
export const meta: WsComponentMeta = {
|
|
7
|
+
type: "container",
|
|
8
|
+
label: "Fragment",
|
|
9
|
+
icon: "",
|
|
10
|
+
stylable: false,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const propsMeta: WsComponentPropsMeta = {
|
|
14
|
+
props: {},
|
|
15
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { Heading as HeadingPrimitive } from "./heading";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Heading",
|
|
6
|
+
component: HeadingPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof HeadingPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof HeadingPrimitive> = (args) => (
|
|
10
|
+
<HeadingPrimitive {...args} />
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const Heading = Template.bind({});
|
|
14
|
+
Heading.args = {
|
|
15
|
+
children: "Heading",
|
|
16
|
+
};
|
package/src/heading.tsx
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
createElement,
|
|
4
|
+
type ElementRef,
|
|
5
|
+
type ComponentProps,
|
|
6
|
+
} from "react";
|
|
7
|
+
|
|
8
|
+
const defaultTag = "h1";
|
|
9
|
+
|
|
10
|
+
type Props = ComponentProps<typeof defaultTag> & {
|
|
11
|
+
tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Heading = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
|
15
|
+
({ tag = defaultTag, ...props }, ref) => {
|
|
16
|
+
return createElement(tag, { ...props, ref });
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
Heading.displayName = "Heading";
|