@webstudio-is/react-sdk 0.70.0 → 0.72.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/lib/cjs/components/component-meta.js +2 -1
- package/lib/cjs/embed-template.js +1 -0
- package/lib/cjs/index.js +4 -2
- package/lib/components/component-meta.js +2 -1
- package/lib/embed-template.js +1 -0
- package/lib/index.js +11 -4
- package/lib/types/components/component-meta.d.ts +4 -4
- package/lib/types/context.d.ts +1 -1
- package/lib/types/index.d.ts +3 -4
- package/lib/types/tree/create-elements-tree.d.ts +1 -1
- package/package.json +13 -28
- package/src/components/component-meta.ts +1 -0
- package/src/context.tsx +1 -1
- package/src/embed-template.ts +1 -0
- package/src/index.ts +7 -3
- package/src/tree/create-elements-tree.tsx +1 -1
- package/lib/cjs/components/__generated__/blockquote.props.js +0 -419
- package/lib/cjs/components/__generated__/body.props.js +0 -418
- package/lib/cjs/components/__generated__/bold.props.js +0 -418
- package/lib/cjs/components/__generated__/box.props.js +0 -436
- package/lib/cjs/components/__generated__/button.props.js +0 -440
- package/lib/cjs/components/__generated__/checkbox-field.props.js +0 -419
- package/lib/cjs/components/__generated__/checkbox.props.js +0 -459
- package/lib/cjs/components/__generated__/code-text.props.js +0 -425
- package/lib/cjs/components/__generated__/error-message.props.js +0 -418
- package/lib/cjs/components/__generated__/form.props.js +0 -426
- package/lib/cjs/components/__generated__/fragment.props.js +0 -24
- package/lib/cjs/components/__generated__/heading.props.js +0 -425
- package/lib/cjs/components/__generated__/html-embed.props.js +0 -31
- package/lib/cjs/components/__generated__/image.props.js +0 -462
- package/lib/cjs/components/__generated__/input.props.js +0 -465
- package/lib/cjs/components/__generated__/italic.props.js +0 -418
- package/lib/cjs/components/__generated__/label.props.js +0 -420
- package/lib/cjs/components/__generated__/link-block.props.js +0 -452
- package/lib/cjs/components/__generated__/link.props.js +0 -452
- package/lib/cjs/components/__generated__/list-item.props.js +0 -419
- package/lib/cjs/components/__generated__/list.props.js +0 -432
- package/lib/cjs/components/__generated__/paragraph.props.js +0 -418
- package/lib/cjs/components/__generated__/radio-button-field.props.js +0 -419
- package/lib/cjs/components/__generated__/radio-button.props.js +0 -459
- package/lib/cjs/components/__generated__/rich-text-link.props.js +0 -452
- package/lib/cjs/components/__generated__/separator.props.js +0 -418
- package/lib/cjs/components/__generated__/slot.props.js +0 -24
- package/lib/cjs/components/__generated__/span.props.js +0 -418
- package/lib/cjs/components/__generated__/subscript.props.js +0 -418
- package/lib/cjs/components/__generated__/success-message.props.js +0 -418
- package/lib/cjs/components/__generated__/superscript.props.js +0 -418
- package/lib/cjs/components/__generated__/text-block.props.js +0 -425
- package/lib/cjs/components/__generated__/textarea.props.js +0 -432
- package/lib/cjs/components/blockquote.js +0 -32
- package/lib/cjs/components/blockquote.ws.js +0 -94
- package/lib/cjs/components/body.js +0 -29
- package/lib/cjs/components/body.ws.js +0 -65
- package/lib/cjs/components/bold.js +0 -29
- package/lib/cjs/components/bold.ws.js +0 -41
- package/lib/cjs/components/box.js +0 -31
- package/lib/cjs/components/box.ws.js +0 -53
- package/lib/cjs/components/button.js +0 -36
- package/lib/cjs/components/button.ws.js +0 -49
- package/lib/cjs/components/checkbox-field.js +0 -29
- package/lib/cjs/components/checkbox-field.ws.js +0 -62
- package/lib/cjs/components/checkbox.js +0 -29
- package/lib/cjs/components/checkbox.ws.js +0 -58
- package/lib/cjs/components/code-text.js +0 -39
- package/lib/cjs/components/code-text.ws.js +0 -74
- package/lib/cjs/components/components.js +0 -88
- package/lib/cjs/components/error-message.js +0 -29
- package/lib/cjs/components/error-message.ws.js +0 -40
- package/lib/cjs/components/form.js +0 -29
- package/lib/cjs/components/form.ws.js +0 -82
- package/lib/cjs/components/fragment.js +0 -29
- package/lib/cjs/components/fragment.ws.js +0 -33
- package/lib/cjs/components/heading.js +0 -31
- package/lib/cjs/components/heading.ws.js +0 -56
- package/lib/cjs/components/html-embed.js +0 -80
- package/lib/cjs/components/html-embed.ws.js +0 -45
- package/lib/cjs/components/image.js +0 -77
- package/lib/cjs/components/image.ws.js +0 -66
- package/lib/cjs/components/index.js +0 -160
- package/lib/cjs/components/input.js +0 -29
- package/lib/cjs/components/input.ws.js +0 -55
- package/lib/cjs/components/italic.js +0 -29
- package/lib/cjs/components/italic.ws.js +0 -47
- package/lib/cjs/components/label.js +0 -29
- package/lib/cjs/components/label.ws.js +0 -63
- package/lib/cjs/components/link-block.js +0 -30
- package/lib/cjs/components/link-block.ws.js +0 -53
- package/lib/cjs/components/link.js +0 -49
- package/lib/cjs/components/link.ws.js +0 -79
- package/lib/cjs/components/list-item.js +0 -32
- package/lib/cjs/components/list-item.ws.js +0 -51
- package/lib/cjs/components/list.js +0 -31
- package/lib/cjs/components/list.ws.js +0 -73
- package/lib/cjs/components/paragraph.js +0 -29
- package/lib/cjs/components/paragraph.ws.js +0 -50
- package/lib/cjs/components/radio-button-field.js +0 -29
- package/lib/cjs/components/radio-button-field.ws.js +0 -62
- package/lib/cjs/components/radio-button.js +0 -29
- package/lib/cjs/components/radio-button.ws.js +0 -58
- package/lib/cjs/components/rich-text-link.js +0 -28
- package/lib/cjs/components/rich-text-link.ws.js +0 -39
- package/lib/cjs/components/separator.js +0 -32
- package/lib/cjs/components/separator.ws.js +0 -70
- package/lib/cjs/components/slot.js +0 -36
- package/lib/cjs/components/slot.ws.js +0 -36
- package/lib/cjs/components/span.js +0 -29
- package/lib/cjs/components/span.ws.js +0 -41
- package/lib/cjs/components/subscript.js +0 -29
- package/lib/cjs/components/subscript.ws.js +0 -41
- package/lib/cjs/components/success-message.js +0 -29
- package/lib/cjs/components/success-message.ws.js +0 -40
- package/lib/cjs/components/superscript.js +0 -29
- package/lib/cjs/components/superscript.ws.js +0 -41
- package/lib/cjs/components/text-block.js +0 -32
- package/lib/cjs/components/text-block.ws.js +0 -57
- package/lib/cjs/components/textarea.js +0 -29
- package/lib/cjs/components/textarea.ws.js +0 -59
- package/lib/components/__generated__/blockquote.props.js +0 -399
- package/lib/components/__generated__/body.props.js +0 -398
- package/lib/components/__generated__/bold.props.js +0 -398
- package/lib/components/__generated__/box.props.js +0 -416
- package/lib/components/__generated__/button.props.js +0 -420
- package/lib/components/__generated__/checkbox-field.props.js +0 -399
- package/lib/components/__generated__/checkbox.props.js +0 -439
- package/lib/components/__generated__/code-text.props.js +0 -405
- package/lib/components/__generated__/error-message.props.js +0 -398
- package/lib/components/__generated__/form.props.js +0 -406
- package/lib/components/__generated__/fragment.props.js +0 -4
- package/lib/components/__generated__/heading.props.js +0 -405
- package/lib/components/__generated__/html-embed.props.js +0 -11
- package/lib/components/__generated__/image.props.js +0 -442
- package/lib/components/__generated__/input.props.js +0 -445
- package/lib/components/__generated__/italic.props.js +0 -398
- package/lib/components/__generated__/label.props.js +0 -400
- package/lib/components/__generated__/link-block.props.js +0 -432
- package/lib/components/__generated__/link.props.js +0 -432
- package/lib/components/__generated__/list-item.props.js +0 -399
- package/lib/components/__generated__/list.props.js +0 -412
- package/lib/components/__generated__/paragraph.props.js +0 -398
- package/lib/components/__generated__/radio-button-field.props.js +0 -399
- package/lib/components/__generated__/radio-button.props.js +0 -439
- package/lib/components/__generated__/rich-text-link.props.js +0 -432
- package/lib/components/__generated__/separator.props.js +0 -398
- package/lib/components/__generated__/slot.props.js +0 -4
- package/lib/components/__generated__/span.props.js +0 -398
- package/lib/components/__generated__/subscript.props.js +0 -398
- package/lib/components/__generated__/success-message.props.js +0 -398
- package/lib/components/__generated__/superscript.props.js +0 -398
- package/lib/components/__generated__/text-block.props.js +0 -405
- package/lib/components/__generated__/textarea.props.js +0 -412
- package/lib/components/blockquote.js +0 -15
- package/lib/components/blockquote.ws.js +0 -76
- package/lib/components/body.js +0 -9
- package/lib/components/body.ws.js +0 -47
- package/lib/components/bold.js +0 -9
- package/lib/components/bold.ws.js +0 -23
- package/lib/components/box.js +0 -14
- package/lib/components/box.ws.js +0 -46
- package/lib/components/button.js +0 -16
- package/lib/components/button.ws.js +0 -31
- package/lib/components/checkbox-field.js +0 -9
- package/lib/components/checkbox-field.ws.js +0 -44
- package/lib/components/checkbox.js +0 -9
- package/lib/components/checkbox.ws.js +0 -40
- package/lib/components/code-text.js +0 -22
- package/lib/components/code-text.ws.js +0 -56
- package/lib/components/components.js +0 -68
- package/lib/components/error-message.js +0 -9
- package/lib/components/error-message.ws.js +0 -20
- package/lib/components/form.js +0 -9
- package/lib/components/form.ws.js +0 -64
- package/lib/components/fragment.js +0 -9
- package/lib/components/fragment.ws.js +0 -13
- package/lib/components/heading.js +0 -14
- package/lib/components/heading.ws.js +0 -38
- package/lib/components/html-embed.js +0 -65
- package/lib/components/html-embed.ws.js +0 -25
- package/lib/components/image.js +0 -63
- package/lib/components/image.ws.js +0 -48
- package/lib/components/index.js +0 -140
- package/lib/components/input.js +0 -9
- package/lib/components/input.ws.js +0 -37
- package/lib/components/italic.js +0 -9
- package/lib/components/italic.ws.js +0 -29
- package/lib/components/label.js +0 -9
- package/lib/components/label.ws.js +0 -45
- package/lib/components/link-block.js +0 -10
- package/lib/components/link-block.ws.js +0 -33
- package/lib/components/link.js +0 -29
- package/lib/components/link.ws.js +0 -61
- package/lib/components/list-item.js +0 -15
- package/lib/components/list-item.ws.js +0 -33
- package/lib/components/list.js +0 -14
- package/lib/components/list.ws.js +0 -55
- package/lib/components/paragraph.js +0 -9
- package/lib/components/paragraph.ws.js +0 -32
- package/lib/components/radio-button-field.js +0 -9
- package/lib/components/radio-button-field.ws.js +0 -44
- package/lib/components/radio-button.js +0 -9
- package/lib/components/radio-button.ws.js +0 -40
- package/lib/components/rich-text-link.js +0 -8
- package/lib/components/rich-text-link.ws.js +0 -19
- package/lib/components/separator.js +0 -15
- package/lib/components/separator.ws.js +0 -52
- package/lib/components/slot.js +0 -16
- package/lib/components/slot.ws.js +0 -16
- package/lib/components/span.js +0 -9
- package/lib/components/span.ws.js +0 -23
- package/lib/components/subscript.js +0 -9
- package/lib/components/subscript.ws.js +0 -23
- package/lib/components/success-message.js +0 -9
- package/lib/components/success-message.ws.js +0 -20
- package/lib/components/superscript.js +0 -9
- package/lib/components/superscript.ws.js +0 -23
- package/lib/components/text-block.js +0 -15
- package/lib/components/text-block.ws.js +0 -39
- package/lib/components/textarea.js +0 -9
- package/lib/components/textarea.ws.js +0 -41
- package/lib/types/components/__generated__/blockquote.props.d.ts +0 -2
- package/lib/types/components/__generated__/body.props.d.ts +0 -2
- package/lib/types/components/__generated__/bold.props.d.ts +0 -2
- package/lib/types/components/__generated__/box.props.d.ts +0 -2
- package/lib/types/components/__generated__/button.props.d.ts +0 -2
- package/lib/types/components/__generated__/checkbox-field.props.d.ts +0 -2
- package/lib/types/components/__generated__/checkbox.props.d.ts +0 -2
- package/lib/types/components/__generated__/code-text.props.d.ts +0 -2
- package/lib/types/components/__generated__/error-message.props.d.ts +0 -2
- package/lib/types/components/__generated__/form.props.d.ts +0 -2
- package/lib/types/components/__generated__/fragment.props.d.ts +0 -2
- package/lib/types/components/__generated__/heading.props.d.ts +0 -2
- package/lib/types/components/__generated__/html-embed.props.d.ts +0 -2
- package/lib/types/components/__generated__/image.props.d.ts +0 -2
- package/lib/types/components/__generated__/input.props.d.ts +0 -2
- package/lib/types/components/__generated__/italic.props.d.ts +0 -2
- package/lib/types/components/__generated__/label.props.d.ts +0 -2
- package/lib/types/components/__generated__/link-block.props.d.ts +0 -2
- package/lib/types/components/__generated__/link.props.d.ts +0 -2
- package/lib/types/components/__generated__/list-item.props.d.ts +0 -2
- package/lib/types/components/__generated__/list.props.d.ts +0 -2
- package/lib/types/components/__generated__/paragraph.props.d.ts +0 -2
- package/lib/types/components/__generated__/radio-button-field.props.d.ts +0 -2
- package/lib/types/components/__generated__/radio-button.props.d.ts +0 -2
- package/lib/types/components/__generated__/rich-text-link.props.d.ts +0 -2
- package/lib/types/components/__generated__/separator.props.d.ts +0 -2
- package/lib/types/components/__generated__/slot.props.d.ts +0 -2
- package/lib/types/components/__generated__/span.props.d.ts +0 -2
- package/lib/types/components/__generated__/subscript.props.d.ts +0 -2
- package/lib/types/components/__generated__/success-message.props.d.ts +0 -2
- package/lib/types/components/__generated__/superscript.props.d.ts +0 -2
- package/lib/types/components/__generated__/text-block.props.d.ts +0 -2
- package/lib/types/components/__generated__/textarea.props.d.ts +0 -2
- package/lib/types/components/blockquote.d.ts +0 -3
- package/lib/types/components/blockquote.stories.d.ts +0 -5
- package/lib/types/components/blockquote.ws.d.ts +0 -3
- package/lib/types/components/body.d.ts +0 -3
- package/lib/types/components/body.stories.d.ts +0 -6
- package/lib/types/components/body.ws.d.ts +0 -3
- package/lib/types/components/bold.d.ts +0 -3
- package/lib/types/components/bold.stories.d.ts +0 -5
- package/lib/types/components/bold.ws.d.ts +0 -3
- package/lib/types/components/box.d.ts +0 -7
- package/lib/types/components/box.stories.d.ts +0 -9
- package/lib/types/components/box.ws.d.ts +0 -3
- package/lib/types/components/button.d.ts +0 -7
- package/lib/types/components/button.stories.d.ts +0 -9
- package/lib/types/components/button.ws.d.ts +0 -3
- package/lib/types/components/checkbox-field.d.ts +0 -3
- package/lib/types/components/checkbox-field.ws.d.ts +0 -3
- package/lib/types/components/checkbox.d.ts +0 -3
- package/lib/types/components/checkbox.ws.d.ts +0 -3
- package/lib/types/components/code-text.d.ts +0 -9
- package/lib/types/components/code-text.stories.d.ts +0 -11
- package/lib/types/components/code-text.ws.d.ts +0 -3
- package/lib/types/components/components.d.ts +0 -40
- package/lib/types/components/error-message.d.ts +0 -3
- package/lib/types/components/error-message.ws.d.ts +0 -3
- package/lib/types/components/form.d.ts +0 -3
- package/lib/types/components/form.stories.d.ts +0 -5
- package/lib/types/components/form.ws.d.ts +0 -3
- package/lib/types/components/fragment.d.ts +0 -6
- package/lib/types/components/fragment.ws.d.ts +0 -3
- package/lib/types/components/heading.d.ts +0 -7
- package/lib/types/components/heading.stories.d.ts +0 -9
- package/lib/types/components/heading.ws.d.ts +0 -3
- package/lib/types/components/html-embed.d.ts +0 -7
- package/lib/types/components/html-embed.stories.d.ts +0 -11
- package/lib/types/components/html-embed.ws.d.ts +0 -3
- package/lib/types/components/image.d.ts +0 -7
- package/lib/types/components/image.stories.d.ts +0 -13
- package/lib/types/components/image.ws.d.ts +0 -3
- package/lib/types/components/index.d.ts +0 -3
- package/lib/types/components/input.d.ts +0 -5
- package/lib/types/components/input.stories.d.ts +0 -9
- package/lib/types/components/input.ws.d.ts +0 -3
- package/lib/types/components/italic.d.ts +0 -3
- package/lib/types/components/italic.stories.d.ts +0 -5
- package/lib/types/components/italic.ws.d.ts +0 -3
- package/lib/types/components/label.d.ts +0 -3
- package/lib/types/components/label.ws.d.ts +0 -3
- package/lib/types/components/link-block.d.ts +0 -3
- package/lib/types/components/link-block.stories.d.ts +0 -13
- package/lib/types/components/link-block.ws.d.ts +0 -3
- package/lib/types/components/link.d.ts +0 -9
- package/lib/types/components/link.stories.d.ts +0 -13
- package/lib/types/components/link.ws.d.ts +0 -3
- package/lib/types/components/list-item.d.ts +0 -3
- package/lib/types/components/list-item.stories.d.ts +0 -5
- package/lib/types/components/list-item.ws.d.ts +0 -3
- package/lib/types/components/list.d.ts +0 -9
- package/lib/types/components/list.stories.d.ts +0 -9
- package/lib/types/components/list.ws.d.ts +0 -3
- package/lib/types/components/paragraph.d.ts +0 -3
- package/lib/types/components/paragraph.stories.d.ts +0 -5
- package/lib/types/components/paragraph.ws.d.ts +0 -3
- package/lib/types/components/radio-button-field.d.ts +0 -3
- package/lib/types/components/radio-button-field.ws.d.ts +0 -3
- package/lib/types/components/radio-button.d.ts +0 -3
- package/lib/types/components/radio-button.ws.d.ts +0 -3
- package/lib/types/components/rich-text-link.d.ts +0 -2
- package/lib/types/components/rich-text-link.stories.d.ts +0 -13
- package/lib/types/components/rich-text-link.ws.d.ts +0 -3
- package/lib/types/components/separator.d.ts +0 -3
- package/lib/types/components/separator.stories.d.ts +0 -5
- package/lib/types/components/separator.ws.d.ts +0 -3
- package/lib/types/components/slot.d.ts +0 -6
- package/lib/types/components/slot.stories.d.ts +0 -9
- package/lib/types/components/slot.ws.d.ts +0 -3
- package/lib/types/components/span.d.ts +0 -3
- package/lib/types/components/span.stories.d.ts +0 -5
- package/lib/types/components/span.ws.d.ts +0 -3
- package/lib/types/components/subscript.d.ts +0 -3
- package/lib/types/components/subscript.stories.d.ts +0 -5
- package/lib/types/components/subscript.ws.d.ts +0 -3
- package/lib/types/components/success-message.d.ts +0 -3
- package/lib/types/components/success-message.ws.d.ts +0 -3
- package/lib/types/components/superscript.d.ts +0 -3
- package/lib/types/components/superscript.stories.d.ts +0 -5
- package/lib/types/components/superscript.ws.d.ts +0 -3
- package/lib/types/components/text-block.d.ts +0 -7
- package/lib/types/components/text-block.stories.d.ts +0 -9
- package/lib/types/components/text-block.ws.d.ts +0 -3
- package/lib/types/components/textarea.d.ts +0 -3
- package/lib/types/components/textarea.ws.d.ts +0 -3
- package/src/components/__generated__/blockquote.props.ts +0 -444
- package/src/components/__generated__/body.props.ts +0 -443
- package/src/components/__generated__/bold.props.ts +0 -443
- package/src/components/__generated__/box.props.ts +0 -461
- package/src/components/__generated__/button.props.ts +0 -465
- package/src/components/__generated__/checkbox-field.props.ts +0 -444
- package/src/components/__generated__/checkbox.props.ts +0 -484
- package/src/components/__generated__/code-text.props.ts +0 -450
- package/src/components/__generated__/error-message.props.ts +0 -443
- package/src/components/__generated__/form.props.ts +0 -451
- package/src/components/__generated__/fragment.props.ts +0 -3
- package/src/components/__generated__/heading.props.ts +0 -450
- package/src/components/__generated__/html-embed.props.ts +0 -10
- package/src/components/__generated__/image.props.ts +0 -487
- package/src/components/__generated__/input.props.ts +0 -490
- package/src/components/__generated__/italic.props.ts +0 -443
- package/src/components/__generated__/label.props.ts +0 -445
- package/src/components/__generated__/link-block.props.ts +0 -477
- package/src/components/__generated__/link.props.ts +0 -477
- package/src/components/__generated__/list-item.props.ts +0 -444
- package/src/components/__generated__/list.props.ts +0 -457
- package/src/components/__generated__/paragraph.props.ts +0 -443
- package/src/components/__generated__/radio-button-field.props.ts +0 -444
- package/src/components/__generated__/radio-button.props.ts +0 -484
- package/src/components/__generated__/rich-text-link.props.ts +0 -477
- package/src/components/__generated__/separator.props.ts +0 -443
- package/src/components/__generated__/slot.props.ts +0 -3
- package/src/components/__generated__/span.props.ts +0 -443
- package/src/components/__generated__/subscript.props.ts +0 -443
- package/src/components/__generated__/success-message.props.ts +0 -443
- package/src/components/__generated__/superscript.props.ts +0 -443
- package/src/components/__generated__/text-block.props.ts +0 -450
- package/src/components/__generated__/textarea.props.ts +0 -457
- package/src/components/blockquote.stories.tsx +0 -16
- package/src/components/blockquote.tsx +0 -18
- package/src/components/blockquote.ws.tsx +0 -81
- package/src/components/body.stories.tsx +0 -11
- package/src/components/body.tsx +0 -10
- package/src/components/body.ws.tsx +0 -51
- package/src/components/bold.stories.tsx +0 -16
- package/src/components/bold.tsx +0 -10
- package/src/components/bold.ws.tsx +0 -26
- package/src/components/box.stories.tsx +0 -17
- package/src/components/box.tsx +0 -31
- package/src/components/box.ws.ts +0 -52
- package/src/components/button.stories.tsx +0 -13
- package/src/components/button.tsx +0 -23
- package/src/components/button.ws.tsx +0 -34
- package/src/components/checkbox-field.tsx +0 -10
- package/src/components/checkbox-field.ws.tsx +0 -47
- package/src/components/checkbox.tsx +0 -13
- package/src/components/checkbox.ws.tsx +0 -43
- package/src/components/code-text.stories.tsx +0 -16
- package/src/components/code-text.tsx +0 -31
- package/src/components/code-text.ws.tsx +0 -58
- package/src/components/components.ts +0 -40
- package/src/components/error-message.tsx +0 -10
- package/src/components/error-message.ws.tsx +0 -24
- package/src/components/form.stories.tsx +0 -14
- package/src/components/form.tsx +0 -14
- package/src/components/form.ws.tsx +0 -67
- package/src/components/fragment.tsx +0 -11
- package/src/components/fragment.ws.ts +0 -12
- package/src/components/heading.stories.tsx +0 -16
- package/src/components/heading.tsx +0 -20
- package/src/components/heading.ws.tsx +0 -44
- package/src/components/html-embed.stories.tsx +0 -16
- package/src/components/html-embed.tsx +0 -96
- package/src/components/html-embed.ws.ts +0 -24
- package/src/components/image.stories.tsx +0 -15
- package/src/components/image.tsx +0 -80
- package/src/components/image.ws.tsx +0 -54
- package/src/components/index.ts +0 -143
- package/src/components/input.stories.tsx +0 -14
- package/src/components/input.tsx +0 -13
- package/src/components/input.ws.tsx +0 -40
- package/src/components/italic.stories.tsx +0 -16
- package/src/components/italic.tsx +0 -10
- package/src/components/italic.ws.tsx +0 -32
- package/src/components/label.tsx +0 -10
- package/src/components/label.ws.tsx +0 -48
- package/src/components/link-block.stories.tsx +0 -13
- package/src/components/link-block.tsx +0 -9
- package/src/components/link-block.ws.tsx +0 -38
- package/src/components/link.stories.tsx +0 -16
- package/src/components/link.tsx +0 -41
- package/src/components/link.ws.tsx +0 -64
- package/src/components/list-item.stories.tsx +0 -16
- package/src/components/list-item.tsx +0 -18
- package/src/components/list-item.ws.tsx +0 -36
- package/src/components/list.stories.tsx +0 -17
- package/src/components/list.tsx +0 -26
- package/src/components/list.ws.tsx +0 -58
- package/src/components/paragraph.stories.tsx +0 -16
- package/src/components/paragraph.tsx +0 -10
- package/src/components/paragraph.ws.tsx +0 -35
- package/src/components/radio-button-field.tsx +0 -10
- package/src/components/radio-button-field.ws.tsx +0 -47
- package/src/components/radio-button.tsx +0 -13
- package/src/components/radio-button.ws.tsx +0 -43
- package/src/components/rich-text-link.stories.tsx +0 -16
- package/src/components/rich-text-link.tsx +0 -8
- package/src/components/rich-text-link.ws.tsx +0 -19
- package/src/components/separator.stories.tsx +0 -14
- package/src/components/separator.tsx +0 -18
- package/src/components/separator.ws.tsx +0 -56
- package/src/components/slot.stories.tsx +0 -16
- package/src/components/slot.tsx +0 -17
- package/src/components/slot.ws.ts +0 -15
- package/src/components/span.stories.tsx +0 -16
- package/src/components/span.tsx +0 -10
- package/src/components/span.ws.tsx +0 -26
- package/src/components/subscript.stories.tsx +0 -16
- package/src/components/subscript.tsx +0 -10
- package/src/components/subscript.ws.tsx +0 -26
- package/src/components/success-message.tsx +0 -10
- package/src/components/success-message.ws.tsx +0 -24
- package/src/components/superscript.stories.tsx +0 -16
- package/src/components/superscript.tsx +0 -10
- package/src/components/superscript.ws.tsx +0 -26
- package/src/components/text-block.stories.tsx +0 -16
- package/src/components/text-block.tsx +0 -21
- package/src/components/text-block.ws.tsx +0 -42
- package/src/components/textarea.tsx +0 -13
- package/src/components/textarea.ws.tsx +0 -44
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { HeadingIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import type { ComponentProps } from "react";
|
|
3
|
-
import { h1, h2, h3, h4, h5, h6 } from "../css/normalize";
|
|
4
|
-
import {
|
|
5
|
-
defaultStates,
|
|
6
|
-
type PresetStyle,
|
|
7
|
-
type WsComponentMeta,
|
|
8
|
-
type WsComponentPropsMeta,
|
|
9
|
-
} from "./component-meta";
|
|
10
|
-
import type { Heading } from "./heading";
|
|
11
|
-
import { props } from "./__generated__/heading.props";
|
|
12
|
-
|
|
13
|
-
type HeadingTags = NonNullable<ComponentProps<typeof Heading>["tag"]>;
|
|
14
|
-
|
|
15
|
-
const presetStyle = {
|
|
16
|
-
h1,
|
|
17
|
-
h2,
|
|
18
|
-
h3,
|
|
19
|
-
h4,
|
|
20
|
-
h5,
|
|
21
|
-
h6,
|
|
22
|
-
} satisfies PresetStyle<HeadingTags>;
|
|
23
|
-
|
|
24
|
-
export const meta: WsComponentMeta = {
|
|
25
|
-
category: "text",
|
|
26
|
-
type: "rich-text",
|
|
27
|
-
label: "Heading",
|
|
28
|
-
icon: HeadingIcon,
|
|
29
|
-
states: defaultStates,
|
|
30
|
-
presetStyle,
|
|
31
|
-
template: [
|
|
32
|
-
{
|
|
33
|
-
type: "instance",
|
|
34
|
-
component: "Heading",
|
|
35
|
-
children: [{ type: "text", value: "Heading you can edit" }],
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
order: 1,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
42
|
-
props,
|
|
43
|
-
initialProps: ["tag"],
|
|
44
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
-
import { HtmlEmbed as HtmlEmbedPrimitive } from "./html-embed";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/HtmlEmbed",
|
|
6
|
-
component: HtmlEmbedPrimitive,
|
|
7
|
-
} as ComponentMeta<typeof HtmlEmbedPrimitive>;
|
|
8
|
-
|
|
9
|
-
const Template: ComponentStory<typeof HtmlEmbedPrimitive> = (args) => (
|
|
10
|
-
<HtmlEmbedPrimitive {...args} />
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
export const HtmlEmbed = Template.bind({});
|
|
14
|
-
HtmlEmbed.args = {
|
|
15
|
-
code: "<strong>custom code</strong>",
|
|
16
|
-
};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
forwardRef,
|
|
3
|
-
useContext,
|
|
4
|
-
useEffect,
|
|
5
|
-
useRef,
|
|
6
|
-
type ForwardedRef,
|
|
7
|
-
} from "react";
|
|
8
|
-
import { mergeRefs } from "@react-aria/utils";
|
|
9
|
-
import { ReactSdkContext } from "../context";
|
|
10
|
-
|
|
11
|
-
type Props = {
|
|
12
|
-
code: string;
|
|
13
|
-
executeScriptOnCanvas: boolean;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
type ChildProps = {
|
|
17
|
-
innerRef: ForwardedRef<HTMLDivElement>;
|
|
18
|
-
// code can be actually undefined when prop is not provided
|
|
19
|
-
code?: string;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Scripts are executed when rendered client side.
|
|
24
|
-
* Necessary on canvas which does not have server rendering.
|
|
25
|
-
*/
|
|
26
|
-
const ExecutableHtml = (props: ChildProps) => {
|
|
27
|
-
const { code, innerRef, ...rest } = props;
|
|
28
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
const container = containerRef.current;
|
|
32
|
-
if (container === null || code === undefined) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
// the trick to execute inserted scripts
|
|
36
|
-
// https://ghinda.net/article/script-tags
|
|
37
|
-
const range = document.createRange();
|
|
38
|
-
range.setStart(container, 0);
|
|
39
|
-
const fragment = range.createContextualFragment(code);
|
|
40
|
-
while (container.firstChild) {
|
|
41
|
-
container.removeChild(container.firstChild);
|
|
42
|
-
}
|
|
43
|
-
container.append(fragment);
|
|
44
|
-
}, [code]);
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<div
|
|
48
|
-
{...rest}
|
|
49
|
-
ref={mergeRefs(innerRef, containerRef)}
|
|
50
|
-
style={{ display: "contents" }}
|
|
51
|
-
/>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Scripts are executed when rendered server side
|
|
57
|
-
*/
|
|
58
|
-
const InnerHtml = (props: ChildProps) => {
|
|
59
|
-
const { code, innerRef, ...rest } = props;
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<div
|
|
63
|
-
{...rest}
|
|
64
|
-
ref={innerRef}
|
|
65
|
-
style={{ display: "contents" }}
|
|
66
|
-
dangerouslySetInnerHTML={{ __html: props.code ?? "" }}
|
|
67
|
-
/>
|
|
68
|
-
);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const Placeholder = (props: ChildProps) => {
|
|
72
|
-
const { code, innerRef, ...rest } = props;
|
|
73
|
-
return (
|
|
74
|
-
<div ref={innerRef} {...rest} style={{ padding: "20px" }}>
|
|
75
|
-
{'Open "Properties" panel to insert HTML code'}
|
|
76
|
-
</div>
|
|
77
|
-
);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const HtmlEmbed = forwardRef<HTMLDivElement, Props>((props, ref) => {
|
|
81
|
-
const { renderer } = useContext(ReactSdkContext);
|
|
82
|
-
const { code, executeScriptOnCanvas, ...rest } = props;
|
|
83
|
-
|
|
84
|
-
// code can be actually undefined when prop is not provided
|
|
85
|
-
if (code === undefined || code.trim().length === 0) {
|
|
86
|
-
return <Placeholder innerRef={ref} {...rest} />;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (renderer === "canvas" && executeScriptOnCanvas === true) {
|
|
90
|
-
return <ExecutableHtml innerRef={ref} code={code} {...rest} />;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return <InnerHtml innerRef={ref} code={code} {...rest} />;
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
HtmlEmbed.displayName = "HtmlEmbed";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { EmbedIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
|
|
3
|
-
import { props } from "./__generated__/html-embed.props";
|
|
4
|
-
|
|
5
|
-
export const meta: WsComponentMeta = {
|
|
6
|
-
category: "general",
|
|
7
|
-
type: "embed",
|
|
8
|
-
label: "HTML Embed",
|
|
9
|
-
icon: EmbedIcon,
|
|
10
|
-
stylable: false,
|
|
11
|
-
order: 7,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
15
|
-
props: {
|
|
16
|
-
...props,
|
|
17
|
-
code: {
|
|
18
|
-
required: true,
|
|
19
|
-
control: "code",
|
|
20
|
-
type: "string",
|
|
21
|
-
rows: 10,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ComponentMeta, ComponentStory } from "@storybook/react";
|
|
2
|
-
import { Image as ImagePrimitive } from "./image";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Image",
|
|
6
|
-
component: ImagePrimitive,
|
|
7
|
-
} as ComponentMeta<typeof ImagePrimitive>;
|
|
8
|
-
|
|
9
|
-
const Template: ComponentStory<typeof ImagePrimitive> = (args) => (
|
|
10
|
-
<ImagePrimitive {...args} />
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
export const Image = Template.bind({});
|
|
14
|
-
|
|
15
|
-
Image.args = {};
|
package/src/components/image.tsx
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ComponentPropsWithoutRef,
|
|
3
|
-
type ElementRef,
|
|
4
|
-
forwardRef,
|
|
5
|
-
useMemo,
|
|
6
|
-
} from "react";
|
|
7
|
-
import {
|
|
8
|
-
Image as WebstudioImage,
|
|
9
|
-
createImageLoader,
|
|
10
|
-
} from "@webstudio-is/image";
|
|
11
|
-
import { usePropAsset, getInstanceIdFromComponentProps } from "../props";
|
|
12
|
-
import { getParams } from "../app/params";
|
|
13
|
-
|
|
14
|
-
export const defaultTag = "img";
|
|
15
|
-
|
|
16
|
-
const imagePlaceholderSvg = `data:image/svg+xml;base64,${btoa(`<svg
|
|
17
|
-
width="140"
|
|
18
|
-
height="140"
|
|
19
|
-
viewBox="0 0 600 600"
|
|
20
|
-
fill="none"
|
|
21
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
22
|
-
>
|
|
23
|
-
<rect width="600" height="600" fill="#CCCCCC" />
|
|
24
|
-
<path
|
|
25
|
-
fill-rule="evenodd"
|
|
26
|
-
clip-rule="evenodd"
|
|
27
|
-
d="M450 170H150C141.716 170 135 176.716 135 185V415C135 423.284 141.716 430 150 430H450C458.284 430 465 423.284 465 415V185C465 176.716 458.284 170 450 170ZM150 145C127.909 145 110 162.909 110 185V415C110 437.091 127.909 455 150 455H450C472.091 455 490 437.091 490 415V185C490 162.909 472.091 145 450 145H150Z"
|
|
28
|
-
fill="#A2A2A2"
|
|
29
|
-
/>
|
|
30
|
-
<path
|
|
31
|
-
d="M237.135 235.012C237.135 255.723 220.345 272.512 199.635 272.512C178.924 272.512 162.135 255.723 162.135 235.012C162.135 214.301 178.924 197.512 199.635 197.512C220.345 197.512 237.135 214.301 237.135 235.012Z"
|
|
32
|
-
fill="#A2A2A2"
|
|
33
|
-
/>
|
|
34
|
-
<path
|
|
35
|
-
d="M160 405V367.205L221.609 306.364L256.552 338.628L358.161 234L440 316.043V405H160Z"
|
|
36
|
-
fill="#A2A2A2"
|
|
37
|
-
/>
|
|
38
|
-
</svg>`)}`;
|
|
39
|
-
|
|
40
|
-
type Props = ComponentPropsWithoutRef<typeof WebstudioImage>;
|
|
41
|
-
|
|
42
|
-
export const Image = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
|
43
|
-
(props, ref) => {
|
|
44
|
-
const asset = usePropAsset(getInstanceIdFromComponentProps(props), "src");
|
|
45
|
-
|
|
46
|
-
const loader = useMemo(() => {
|
|
47
|
-
const params = getParams();
|
|
48
|
-
return createImageLoader({ imageBaseUrl: params.imageBaseUrl });
|
|
49
|
-
}, []);
|
|
50
|
-
|
|
51
|
-
const src = asset?.name ?? props.src;
|
|
52
|
-
|
|
53
|
-
if (asset == null || loader == null) {
|
|
54
|
-
return (
|
|
55
|
-
<img key={src} {...props} src={src || imagePlaceholderSvg} ref={ref} />
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<WebstudioImage
|
|
61
|
-
/**
|
|
62
|
-
* `key` is needed to recreate the image in case of asset change in builder,
|
|
63
|
-
* this gives immediate feedback when an asset is changed.
|
|
64
|
-
* Also, it visually fixes image distortion when another asset has a seriously different aspectRatio
|
|
65
|
-
* (we change aspectRatio CSS prop on asset change)
|
|
66
|
-
*
|
|
67
|
-
* In non-builder mode, key on images are usually also a good idea,
|
|
68
|
-
* prevents showing outdated images on route change.
|
|
69
|
-
**/
|
|
70
|
-
key={src}
|
|
71
|
-
{...props}
|
|
72
|
-
loader={loader}
|
|
73
|
-
src={src}
|
|
74
|
-
ref={ref}
|
|
75
|
-
/>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
Image.displayName = "Image";
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { ImageIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import { img } from "../css/normalize";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates,
|
|
5
|
-
type PresetStyle,
|
|
6
|
-
type WsComponentMeta,
|
|
7
|
-
type WsComponentPropsMeta,
|
|
8
|
-
} from "./component-meta";
|
|
9
|
-
import type { defaultTag } from "./image";
|
|
10
|
-
import { props } from "./__generated__/image.props";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
img: [
|
|
14
|
-
...img,
|
|
15
|
-
|
|
16
|
-
// Otherwise on new image insert onto canvas it can overfit screen size multiple times
|
|
17
|
-
{
|
|
18
|
-
property: "maxWidth",
|
|
19
|
-
value: { type: "unit", unit: "%", value: 100 },
|
|
20
|
-
},
|
|
21
|
-
// inline | inline-block is not suitable because without line-height: 0 on the parent you get unsuitable spaces/margins
|
|
22
|
-
// see https://stackoverflow.com/questions/24771194/is-the-margin-of-inline-block-4px-is-static-for-all-browsers
|
|
23
|
-
{
|
|
24
|
-
property: "display",
|
|
25
|
-
value: { type: "keyword", value: "block" },
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
} satisfies PresetStyle<typeof defaultTag>;
|
|
29
|
-
|
|
30
|
-
export const meta: WsComponentMeta = {
|
|
31
|
-
category: "media",
|
|
32
|
-
type: "embed",
|
|
33
|
-
label: "Image",
|
|
34
|
-
icon: ImageIcon,
|
|
35
|
-
states: defaultStates,
|
|
36
|
-
presetStyle,
|
|
37
|
-
order: 0,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// "loader" is our internal prop not intended to show up in the props panel
|
|
41
|
-
const { loader, ...publicProps } = props;
|
|
42
|
-
|
|
43
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
44
|
-
props: {
|
|
45
|
-
...publicProps,
|
|
46
|
-
src: {
|
|
47
|
-
type: "string",
|
|
48
|
-
control: "file",
|
|
49
|
-
label: "Source",
|
|
50
|
-
required: false,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
initialProps: ["src", "width", "height", "alt", "loading"],
|
|
54
|
-
};
|
package/src/components/index.ts
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
|
|
2
|
-
import { meta as SlotMeta } from "./slot.ws";
|
|
3
|
-
import { meta as FragmentMeta } from "./fragment.ws";
|
|
4
|
-
import { meta as HtmlEmbedMeta } from "./html-embed.ws";
|
|
5
|
-
import { meta as BodyMeta } from "./body.ws";
|
|
6
|
-
import { meta as BoxMeta } from "./box.ws";
|
|
7
|
-
import { meta as TextBlockMeta } from "./text-block.ws";
|
|
8
|
-
import { meta as HeadingMeta } from "./heading.ws";
|
|
9
|
-
import { meta as ParagraphMeta } from "./paragraph.ws";
|
|
10
|
-
import { meta as LinkMeta } from "./link.ws";
|
|
11
|
-
import { meta as LinkBlockMeta } from "./link-block.ws";
|
|
12
|
-
import { meta as RichTextLinkMeta } from "./rich-text-link.ws";
|
|
13
|
-
import { meta as SpanMeta } from "./span.ws";
|
|
14
|
-
import { meta as BoldMeta } from "./bold.ws";
|
|
15
|
-
import { meta as ItalicMeta } from "./italic.ws";
|
|
16
|
-
import { meta as SuperscriptMeta } from "./superscript.ws";
|
|
17
|
-
import { meta as SubscriptMeta } from "./subscript.ws";
|
|
18
|
-
import { meta as ButtonMeta } from "./button.ws";
|
|
19
|
-
import { meta as InputMeta } from "./input.ws";
|
|
20
|
-
import { meta as FormMeta } from "./form.ws";
|
|
21
|
-
import { meta as ImageMeta } from "./image.ws";
|
|
22
|
-
import { meta as BlockquoteMeta } from "./blockquote.ws";
|
|
23
|
-
import { meta as ListMeta } from "./list.ws";
|
|
24
|
-
import { meta as ListItemMeta } from "./list-item.ws";
|
|
25
|
-
import { meta as SeparatorMeta } from "./separator.ws";
|
|
26
|
-
import { meta as CodeTextMeta } from "./code-text.ws";
|
|
27
|
-
import { meta as LabelMeta } from "./label.ws";
|
|
28
|
-
import { meta as SuccessMessageMeta } from "./success-message.ws";
|
|
29
|
-
import { meta as ErrorMessageMeta } from "./error-message.ws";
|
|
30
|
-
import { meta as TextareaMeta } from "./textarea.ws";
|
|
31
|
-
import { meta as RadioButtonFieldMeta } from "./radio-button-field.ws";
|
|
32
|
-
import { meta as RadioButtonMeta } from "./radio-button.ws";
|
|
33
|
-
import { meta as CheckboxFieldMeta } from "./checkbox-field.ws";
|
|
34
|
-
import { meta as CheckboxMeta } from "./checkbox.ws";
|
|
35
|
-
|
|
36
|
-
// these are huge JSON objects that we want to be tree-shaken when not used!
|
|
37
|
-
import { propsMeta as SlotMetaPropsMeta } from "./slot.ws";
|
|
38
|
-
import { propsMeta as FragmentMetaPropsMeta } from "./fragment.ws";
|
|
39
|
-
import { propsMeta as HtmlEmbedMetaPropsMeta } from "./html-embed.ws";
|
|
40
|
-
import { propsMeta as BodyMetaPropsMeta } from "./body.ws";
|
|
41
|
-
import { propsMeta as BoxMetaPropsMeta } from "./box.ws";
|
|
42
|
-
import { propsMeta as TextBlockMetaPropsMeta } from "./text-block.ws";
|
|
43
|
-
import { propsMeta as HeadingMetaPropsMeta } from "./heading.ws";
|
|
44
|
-
import { propsMeta as ParagraphMetaPropsMeta } from "./paragraph.ws";
|
|
45
|
-
import { propsMeta as LinkMetaPropsMeta } from "./link.ws";
|
|
46
|
-
import { propsMeta as LinkBlockPropsMeta } from "./link-block.ws";
|
|
47
|
-
import { propsMeta as RichTextLinkMetaPropsMeta } from "./rich-text-link.ws";
|
|
48
|
-
import { propsMeta as SpanMetaPropsMeta } from "./span.ws";
|
|
49
|
-
import { propsMeta as BoldMetaPropsMeta } from "./bold.ws";
|
|
50
|
-
import { propsMeta as ItalicMetaPropsMeta } from "./italic.ws";
|
|
51
|
-
import { propsMeta as SuperscriptMetaPropsMeta } from "./superscript.ws";
|
|
52
|
-
import { propsMeta as SubscriptMetaPropsMeta } from "./subscript.ws";
|
|
53
|
-
import { propsMeta as ButtonMetaPropsMeta } from "./button.ws";
|
|
54
|
-
import { propsMeta as InputMetaPropsMeta } from "./input.ws";
|
|
55
|
-
import { propsMeta as FormMetaPropsMeta } from "./form.ws";
|
|
56
|
-
import { propsMeta as ImageMetaPropsMeta } from "./image.ws";
|
|
57
|
-
import { propsMeta as BlockquotePropsMeta } from "./blockquote.ws";
|
|
58
|
-
import { propsMeta as ListPropsMeta } from "./list.ws";
|
|
59
|
-
import { propsMeta as ListItemPropsMeta } from "./list-item.ws";
|
|
60
|
-
import { propsMeta as SeparatorPropsMeta } from "./separator.ws";
|
|
61
|
-
import { propsMeta as CodeTextPropsMeta } from "./code-text.ws";
|
|
62
|
-
import { propsMeta as LabelPropsMeta } from "./label.ws";
|
|
63
|
-
import { propsMeta as SuccessMessagePropsMeta } from "./success-message.ws";
|
|
64
|
-
import { propsMeta as ErrorMessagePropsMeta } from "./error-message.ws";
|
|
65
|
-
import { propsMeta as TextareaPropsMeta } from "./textarea.ws";
|
|
66
|
-
import { propsMeta as RadioButtonFieldPropsMeta } from "./radio-button-field.ws";
|
|
67
|
-
import { propsMeta as RadioButtonPropsMeta } from "./radio-button.ws";
|
|
68
|
-
import { propsMeta as CheckboxFieldPropsMeta } from "./checkbox-field.ws";
|
|
69
|
-
import { propsMeta as CheckboxPropsMeta } from "./checkbox.ws";
|
|
70
|
-
|
|
71
|
-
// @todo this list should not be hardcoded!
|
|
72
|
-
export const defaultMetas: Record<string, WsComponentMeta> = {
|
|
73
|
-
Slot: SlotMeta,
|
|
74
|
-
Fragment: FragmentMeta,
|
|
75
|
-
HtmlEmbed: HtmlEmbedMeta,
|
|
76
|
-
Box: BoxMeta,
|
|
77
|
-
Body: BodyMeta,
|
|
78
|
-
TextBlock: TextBlockMeta,
|
|
79
|
-
Heading: HeadingMeta,
|
|
80
|
-
Paragraph: ParagraphMeta,
|
|
81
|
-
Link: LinkMeta,
|
|
82
|
-
LinkBlock: LinkBlockMeta,
|
|
83
|
-
RichTextLink: RichTextLinkMeta,
|
|
84
|
-
Span: SpanMeta,
|
|
85
|
-
Bold: BoldMeta,
|
|
86
|
-
Italic: ItalicMeta,
|
|
87
|
-
Superscript: SuperscriptMeta,
|
|
88
|
-
Subscript: SubscriptMeta,
|
|
89
|
-
Button: ButtonMeta,
|
|
90
|
-
Input: InputMeta,
|
|
91
|
-
Form: FormMeta,
|
|
92
|
-
Image: ImageMeta,
|
|
93
|
-
Blockquote: BlockquoteMeta,
|
|
94
|
-
List: ListMeta,
|
|
95
|
-
ListItem: ListItemMeta,
|
|
96
|
-
Separator: SeparatorMeta,
|
|
97
|
-
CodeText: CodeTextMeta,
|
|
98
|
-
Label: LabelMeta,
|
|
99
|
-
SuccessMessage: SuccessMessageMeta,
|
|
100
|
-
ErrorMessage: ErrorMessageMeta,
|
|
101
|
-
Textarea: TextareaMeta,
|
|
102
|
-
RadioButtonField: RadioButtonFieldMeta,
|
|
103
|
-
RadioButton: RadioButtonMeta,
|
|
104
|
-
CheckboxField: CheckboxFieldMeta,
|
|
105
|
-
Checkbox: CheckboxMeta,
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// @todo this list should not be hardcoded!
|
|
109
|
-
export const defaultPropsMetas: Record<string, WsComponentPropsMeta> = {
|
|
110
|
-
Slot: SlotMetaPropsMeta,
|
|
111
|
-
Fragment: FragmentMetaPropsMeta,
|
|
112
|
-
HtmlEmbed: HtmlEmbedMetaPropsMeta,
|
|
113
|
-
Box: BoxMetaPropsMeta,
|
|
114
|
-
Body: BodyMetaPropsMeta,
|
|
115
|
-
TextBlock: TextBlockMetaPropsMeta,
|
|
116
|
-
Heading: HeadingMetaPropsMeta,
|
|
117
|
-
Paragraph: ParagraphMetaPropsMeta,
|
|
118
|
-
Link: LinkMetaPropsMeta,
|
|
119
|
-
LinkBlock: LinkBlockPropsMeta,
|
|
120
|
-
RichTextLink: RichTextLinkMetaPropsMeta,
|
|
121
|
-
Span: SpanMetaPropsMeta,
|
|
122
|
-
Bold: BoldMetaPropsMeta,
|
|
123
|
-
Italic: ItalicMetaPropsMeta,
|
|
124
|
-
Superscript: SuperscriptMetaPropsMeta,
|
|
125
|
-
Subscript: SubscriptMetaPropsMeta,
|
|
126
|
-
Button: ButtonMetaPropsMeta,
|
|
127
|
-
Input: InputMetaPropsMeta,
|
|
128
|
-
Form: FormMetaPropsMeta,
|
|
129
|
-
Image: ImageMetaPropsMeta,
|
|
130
|
-
Blockquote: BlockquotePropsMeta,
|
|
131
|
-
List: ListPropsMeta,
|
|
132
|
-
ListItem: ListItemPropsMeta,
|
|
133
|
-
Separator: SeparatorPropsMeta,
|
|
134
|
-
CodeText: CodeTextPropsMeta,
|
|
135
|
-
Label: LabelPropsMeta,
|
|
136
|
-
SuccessMessage: SuccessMessagePropsMeta,
|
|
137
|
-
ErrorMessage: ErrorMessagePropsMeta,
|
|
138
|
-
Textarea: TextareaPropsMeta,
|
|
139
|
-
RadioButtonField: RadioButtonFieldPropsMeta,
|
|
140
|
-
RadioButton: RadioButtonPropsMeta,
|
|
141
|
-
CheckboxField: CheckboxFieldPropsMeta,
|
|
142
|
-
Checkbox: CheckboxPropsMeta,
|
|
143
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
-
import { Input as InputPrimitive } from "./input";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Input",
|
|
6
|
-
component: InputPrimitive,
|
|
7
|
-
} as ComponentMeta<typeof InputPrimitive>;
|
|
8
|
-
|
|
9
|
-
const Template: ComponentStory<typeof InputPrimitive> = (args) => (
|
|
10
|
-
<InputPrimitive {...args} />
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
export const Input = Template.bind({});
|
|
14
|
-
Input.args = {};
|
package/src/components/input.tsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
-
|
|
3
|
-
export const defaultTag = "input";
|
|
4
|
-
|
|
5
|
-
export const Input = forwardRef<
|
|
6
|
-
ElementRef<typeof defaultTag>,
|
|
7
|
-
ComponentProps<typeof defaultTag> & {
|
|
8
|
-
type?: "text" | "email" | "password" | "number" | "tel" | "url";
|
|
9
|
-
}
|
|
10
|
-
// Make sure children are not passed down to an input, because this will result in error.
|
|
11
|
-
>(({ children: _children, ...props }, ref) => <input {...props} ref={ref} />);
|
|
12
|
-
|
|
13
|
-
Input.displayName = "Input";
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { FormTextFieldIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import { input } from "../css/normalize";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates,
|
|
5
|
-
type PresetStyle,
|
|
6
|
-
type WsComponentMeta,
|
|
7
|
-
type WsComponentPropsMeta,
|
|
8
|
-
} from "./component-meta";
|
|
9
|
-
import type { defaultTag } from "./input";
|
|
10
|
-
import { props } from "./__generated__/input.props";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
input,
|
|
14
|
-
} satisfies PresetStyle<typeof defaultTag>;
|
|
15
|
-
|
|
16
|
-
export const meta: WsComponentMeta = {
|
|
17
|
-
category: "forms",
|
|
18
|
-
type: "control",
|
|
19
|
-
label: "Text Input",
|
|
20
|
-
icon: FormTextFieldIcon,
|
|
21
|
-
presetStyle,
|
|
22
|
-
order: 3,
|
|
23
|
-
states: [
|
|
24
|
-
...defaultStates,
|
|
25
|
-
{ selector: "::placeholder", label: "Placeholder" },
|
|
26
|
-
{ selector: ":valid", label: "Valid" },
|
|
27
|
-
{ selector: ":invalid", label: "Invalid" },
|
|
28
|
-
{ selector: ":required", label: "Required" },
|
|
29
|
-
{ selector: ":optional", label: "Optional" },
|
|
30
|
-
{ selector: ":disabled", label: "Disabled" },
|
|
31
|
-
{ selector: ":enabled", label: "Enabled" },
|
|
32
|
-
{ selector: ":read-only", label: "Read Only" },
|
|
33
|
-
{ selector: ":read-write", label: "Read Write" },
|
|
34
|
-
],
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
38
|
-
props,
|
|
39
|
-
initialProps: ["name", "type", "placeholder", "required", "autoFocus"],
|
|
40
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
-
import { Italic as ItalicPrimitive } from "./italic";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Italic",
|
|
6
|
-
component: ItalicPrimitive,
|
|
7
|
-
} as ComponentMeta<typeof ItalicPrimitive>;
|
|
8
|
-
|
|
9
|
-
const Template: ComponentStory<typeof ItalicPrimitive> = (args) => (
|
|
10
|
-
<ItalicPrimitive {...args} />
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
export const Italic = Template.bind({});
|
|
14
|
-
Italic.args = {
|
|
15
|
-
children: "some italic text",
|
|
16
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
-
|
|
3
|
-
export const defaultTag = "i";
|
|
4
|
-
|
|
5
|
-
export const Italic = forwardRef<
|
|
6
|
-
ElementRef<typeof defaultTag>,
|
|
7
|
-
ComponentProps<typeof defaultTag>
|
|
8
|
-
>((props, ref) => <i {...props} ref={ref} />);
|
|
9
|
-
|
|
10
|
-
Italic.displayName = "Italic";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { TextItalicIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import type { defaultTag } from "./italic";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates,
|
|
5
|
-
type PresetStyle,
|
|
6
|
-
type WsComponentMeta,
|
|
7
|
-
type WsComponentPropsMeta,
|
|
8
|
-
} from "./component-meta";
|
|
9
|
-
import { props } from "./__generated__/italic.props";
|
|
10
|
-
import { i } from "../css/normalize";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
i: [
|
|
14
|
-
...i,
|
|
15
|
-
{
|
|
16
|
-
property: "fontStyle",
|
|
17
|
-
value: { type: "keyword", value: "italic" },
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
} satisfies PresetStyle<typeof defaultTag>;
|
|
21
|
-
|
|
22
|
-
export const meta: WsComponentMeta = {
|
|
23
|
-
type: "rich-text-child",
|
|
24
|
-
label: "Italic Text",
|
|
25
|
-
icon: TextItalicIcon,
|
|
26
|
-
states: defaultStates,
|
|
27
|
-
presetStyle,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
31
|
-
props,
|
|
32
|
-
};
|
package/src/components/label.tsx
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
-
|
|
3
|
-
export const defaultTag = "label";
|
|
4
|
-
|
|
5
|
-
export const Label = forwardRef<
|
|
6
|
-
ElementRef<typeof defaultTag>,
|
|
7
|
-
ComponentProps<typeof defaultTag>
|
|
8
|
-
>((props, ref) => <label {...props} ref={ref} />);
|
|
9
|
-
|
|
10
|
-
Label.displayName = "Label";
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { TextBlockIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import {
|
|
3
|
-
type WsComponentMeta,
|
|
4
|
-
type WsComponentPropsMeta,
|
|
5
|
-
type PresetStyle,
|
|
6
|
-
defaultStates,
|
|
7
|
-
} from "./component-meta";
|
|
8
|
-
import { props } from "./__generated__/label.props";
|
|
9
|
-
import type { defaultTag } from "./label";
|
|
10
|
-
import { label } from "../css/normalize";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
label: [
|
|
14
|
-
...label,
|
|
15
|
-
{ property: "display", value: { type: "keyword", value: "block" } },
|
|
16
|
-
],
|
|
17
|
-
} satisfies PresetStyle<typeof defaultTag>;
|
|
18
|
-
|
|
19
|
-
export const meta: WsComponentMeta = {
|
|
20
|
-
category: "forms",
|
|
21
|
-
type: "rich-text",
|
|
22
|
-
label: "Input Label",
|
|
23
|
-
icon: TextBlockIcon,
|
|
24
|
-
states: defaultStates,
|
|
25
|
-
presetStyle,
|
|
26
|
-
order: 2,
|
|
27
|
-
template: [
|
|
28
|
-
{
|
|
29
|
-
type: "instance",
|
|
30
|
-
component: "Label",
|
|
31
|
-
children: [{ type: "text", value: "Form Label" }],
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
37
|
-
props: {
|
|
38
|
-
...props,
|
|
39
|
-
htmlFor: {
|
|
40
|
-
required: false,
|
|
41
|
-
control: "text",
|
|
42
|
-
type: "string",
|
|
43
|
-
rows: 0,
|
|
44
|
-
label: "For",
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
initialProps: ["htmlFor"],
|
|
48
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
-
import { Link as LinkPrimitive } from "./link";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Link Block",
|
|
6
|
-
component: LinkPrimitive,
|
|
7
|
-
} as ComponentMeta<typeof LinkPrimitive>;
|
|
8
|
-
|
|
9
|
-
const Template: ComponentStory<typeof LinkPrimitive> = (args) => (
|
|
10
|
-
<LinkPrimitive {...args} />
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
export const Link = Template.bind({});
|