mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-08 04:55:06 +09:00
Separator component (#1099)
## Description ## Steps for reproduction 1. Add separator 2. Paste `---` for markdown ## Code Review - [ ] hi @TrySound , I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env.example` and the `builder/env-check.js` if mandatory
This commit is contained in:
1 parent
9d4db831d3
commit
fe82cd441e
13 files changed
+947
No files matched your search
@@ -0,0 +1,4 @@
|
||||
<svg width="22" height="22" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.9961 2.01802C13.4004 2.10788 13.6554 2.50851 13.5655 2.91286L9.89885 19.4129C9.80899 19.8172 9.40836 20.0722 9.00401 19.9823C8.59966 19.8924 8.34471 19.4918 8.43457 19.0875L12.1012 2.58746C12.1911 2.18311 12.5917 1.92816 12.9961 2.01802ZM6.94704 5.8865C7.23993 6.17939 7.23993 6.65426 6.94704 6.94716L2.89403 11.0002L6.94704 15.0532C7.23993 15.3461 7.23993 15.8209 6.94704 16.1138C6.65414 16.4067 6.17927 16.4067 5.88638 16.1138L1.30304 11.5305C1.01015 11.2376 1.01015 10.7627 1.30304 10.4698L5.88638 5.8865C6.17927 5.5936 6.65414 5.5936 6.94704 5.8865ZM15.053 5.8865C15.3459 5.5936 15.8208 5.5936 16.1137 5.8865L20.697 10.4698C20.9899 10.7627 20.9899 11.2376 20.697 11.5305L16.1137 16.1138C15.8208 16.4067 15.3459 16.4067 15.053 16.1138C14.7602 15.8209 14.7602 15.3461 15.053 15.0532L19.106 11.0002L15.053 6.94716C14.7602 6.65426 14.7602 6.17939 15.053 5.8865Z" />
|
||||
</svg>
|
||||
|
||||
|
After Width: | Height: | Size: 1014 B |
@@ -0,0 +1,4 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 8C3 7.44772 3.44772 7 4 7H12C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9H4C3.44772 9 3 8.55228 3 8Z"/>
|
||||
</svg>
|
||||
|
||||
|
After Width: | Height: | Size: 258 B |
+15
@@ -0,0 +1,15 @@
|
||||
// Generated from icons/code.svg
|
||||
|
||||
import { forwardRef } from "react";
|
||||
import type { IconProps } from "../types";
|
||||
|
||||
// prettier-ignore
|
||||
export const CodeIcon = forwardRef<SVGSVGElement, IconProps>(
|
||||
({ color = "currentColor", size = 16, ...props }, forwardedRef) => {
|
||||
return (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path fillRule="evenodd" d="M12.996 2.018c.404.09.66.49.57.895l-3.667 16.5a.75.75 0 0 1-1.464-.326l3.666-16.5a.75.75 0 0 1 .895-.569ZM6.947 5.887a.75.75 0 0 1 0 1.06L2.894 11l4.053 4.053a.75.75 0 1 1-1.06 1.06l-4.584-4.582a.75.75 0 0 1 0-1.061l4.583-4.584a.75.75 0 0 1 1.061 0Zm8.106 0a.75.75 0 0 1 1.06 0l4.584 4.583a.75.75 0 0 1 0 1.06l-4.583 4.584a.75.75 0 0 1-1.061-1.06L19.106 11l-4.053-4.053a.75.75 0 0 1 0-1.06Z" clipRule="evenodd" /></svg>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
CodeIcon.displayName = "CodeIcon";
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// Generated from icons/dash.svg
|
||||
|
||||
import { forwardRef } from "react";
|
||||
import type { IconProps } from "../types";
|
||||
|
||||
// prettier-ignore
|
||||
export const DashIcon = forwardRef<SVGSVGElement, IconProps>(
|
||||
({ color = "currentColor", size = 16, ...props }, forwardedRef) => {
|
||||
return (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path fillRule="evenodd" d="M3 8a1 1 0 0 1 1-1h8a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1Z" clipRule="evenodd" /></svg>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
DashIcon.displayName = "DashIcon";
|
||||
+2
@@ -8,6 +8,8 @@ export * from "./chevron-filled-down";
|
||||
export * from "./chevron-filled-left";
|
||||
export * from "./chevron-filled-right";
|
||||
export * from "./chevron-filled-up";
|
||||
export * from "./code";
|
||||
export * from "./dash";
|
||||
export * from "./dot";
|
||||
export * from "./eyecon-closed";
|
||||
export * from "./eyecon-open";
|
||||
|
||||
@@ -0,0 +1,743 @@
|
||||
{
|
||||
"slot": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"style": {
|
||||
"type": {
|
||||
"name": "CSSProperties",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"title": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"defaultChecked": {
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"defaultValue": {
|
||||
"type": {
|
||||
"name": "string | number | readonly string[]",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"suppressContentEditableWarning": {
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"suppressHydrationWarning": {
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"accessKey": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"className": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"contentEditable": {
|
||||
"type": {
|
||||
"name": "Booleanish | \"inherit\"",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"contextMenu": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"dir": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"draggable": {
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"hidden": {
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"lang": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"placeholder": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"spellCheck": {
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"tabIndex": {
|
||||
"type": {
|
||||
"name": "number",
|
||||
"required": false
|
||||
},
|
||||
"control": "number"
|
||||
},
|
||||
"translate": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": {
|
||||
"type": "radio",
|
||||
"options": ["yes", "no"]
|
||||
}
|
||||
},
|
||||
"radioGroup": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"role": {
|
||||
"type": {
|
||||
"name": "AriaRole",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"about": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"datatype": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"inlist": {
|
||||
"type": {
|
||||
"name": "any",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"prefix": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"property": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"resource": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"typeof": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"vocab": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"autoCapitalize": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"autoCorrect": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"autoSave": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"color": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "color"
|
||||
},
|
||||
"itemProp": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"itemScope": {
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"itemType": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"itemID": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"itemRef": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"results": {
|
||||
"type": {
|
||||
"name": "number",
|
||||
"required": false
|
||||
},
|
||||
"control": "number"
|
||||
},
|
||||
"security": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"unselectable": {
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": {
|
||||
"type": "radio",
|
||||
"options": ["on", "off"]
|
||||
}
|
||||
},
|
||||
"inputMode": {
|
||||
"description": "Hints at the type of data that might be entered by the user while editing the element or its contents\n@see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": {
|
||||
"type": "select",
|
||||
"options": [
|
||||
"text",
|
||||
"none",
|
||||
"search",
|
||||
"tel",
|
||||
"url",
|
||||
"email",
|
||||
"numeric",
|
||||
"decimal"
|
||||
]
|
||||
}
|
||||
},
|
||||
"is": {
|
||||
"description": "Specify that a standard HTML element should behave like a defined custom built-in element\n@see https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-activedescendant": {
|
||||
"description": "Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-atomic": {
|
||||
"description": "Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.",
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"aria-autocomplete": {
|
||||
"description": "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": {
|
||||
"type": "radio",
|
||||
"options": ["list", "none", "inline", "both"]
|
||||
}
|
||||
},
|
||||
"aria-busy": {
|
||||
"description": "Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user.",
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"aria-checked": {
|
||||
"description": "Indicates the current \"checked\" state of checkboxes, radio buttons, and other widgets.\n@see aria-pressed\n@see aria-selected.",
|
||||
"type": {
|
||||
"name": "boolean | \"true\" | \"false\" | \"mixed\"",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-colcount": {
|
||||
"description": "Defines the total number of columns in a table, grid, or treegrid.\n@see aria-colindex.",
|
||||
"type": {
|
||||
"name": "number",
|
||||
"required": false
|
||||
},
|
||||
"control": "number"
|
||||
},
|
||||
"aria-colindex": {
|
||||
"description": "Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.\n@see aria-colcount\n@see aria-colspan.",
|
||||
"type": {
|
||||
"name": "number",
|
||||
"required": false
|
||||
},
|
||||
"control": "number"
|
||||
},
|
||||
"aria-colspan": {
|
||||
"description": "Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.\n@see aria-colindex\n@see aria-rowspan.",
|
||||
"type": {
|
||||
"name": "number",
|
||||
"required": false
|
||||
},
|
||||
"control": "number"
|
||||
},
|
||||
"aria-controls": {
|
||||
"description": "Identifies the element (or elements) whose contents or presence are controlled by the current element.\n@see aria-owns.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-current": {
|
||||
"description": "Indicates the element that represents the current item within a container or set of related elements.",
|
||||
"type": {
|
||||
"name": "boolean | \"time\" | \"true\" | \"false\" | \"page\" | \"step\" | \"location\" | \"date\"",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-describedby": {
|
||||
"description": "Identifies the element (or elements) that describes the object.\n@see aria-labelledby",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-details": {
|
||||
"description": "Identifies the element that provides a detailed, extended description for the object.\n@see aria-describedby.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-disabled": {
|
||||
"description": "Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.\n@see aria-hidden\n@see aria-readonly.",
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"aria-dropeffect": {
|
||||
"description": "Indicates what functions can be performed when a dragged object is released on the drop target.\n@deprecated in ARIA 1.1",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": {
|
||||
"type": "select",
|
||||
"options": ["link", "none", "copy", "execute", "move", "popup"]
|
||||
}
|
||||
},
|
||||
"aria-errormessage": {
|
||||
"description": "Identifies the element that provides an error message for the object.\n@see aria-invalid\n@see aria-describedby.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-expanded": {
|
||||
"description": "Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed.",
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"aria-flowto": {
|
||||
"description": "Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,\nallows assistive technology to override the general default of reading in document source order.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-grabbed": {
|
||||
"description": "Indicates an element's \"grabbed\" state in a drag-and-drop operation.\n@deprecated in ARIA 1.1",
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"aria-haspopup": {
|
||||
"description": "Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.",
|
||||
"type": {
|
||||
"name": "boolean | \"dialog\" | \"menu\" | \"true\" | \"false\" | \"grid\" | \"listbox\" | \"tree\"",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-hidden": {
|
||||
"description": "Indicates whether the element is exposed to an accessibility API.\n@see aria-disabled.",
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"aria-invalid": {
|
||||
"description": "Indicates the entered value does not conform to the format expected by the application.\n@see aria-errormessage.",
|
||||
"type": {
|
||||
"name": "boolean | \"true\" | \"false\" | \"grammar\" | \"spelling\"",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-keyshortcuts": {
|
||||
"description": "Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-label": {
|
||||
"description": "Defines a string value that labels the current element.\n@see aria-labelledby.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-labelledby": {
|
||||
"description": "Identifies the element (or elements) that labels the current element.\n@see aria-describedby.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-level": {
|
||||
"description": "Defines the hierarchical level of an element within a structure.",
|
||||
"type": {
|
||||
"name": "number",
|
||||
"required": false
|
||||
},
|
||||
"control": "number"
|
||||
},
|
||||
"aria-live": {
|
||||
"description": "Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": {
|
||||
"type": "radio",
|
||||
"options": ["off", "assertive", "polite"]
|
||||
}
|
||||
},
|
||||
"aria-modal": {
|
||||
"description": "Indicates whether an element is modal when displayed.",
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"aria-multiline": {
|
||||
"description": "Indicates whether a text box accepts multiple lines of input or only a single line.",
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"aria-multiselectable": {
|
||||
"description": "Indicates that the user may select more than one item from the current selectable descendants.",
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"aria-orientation": {
|
||||
"description": "Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": {
|
||||
"type": "radio",
|
||||
"options": ["horizontal", "vertical"]
|
||||
}
|
||||
},
|
||||
"aria-owns": {
|
||||
"description": "Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship\nbetween DOM elements where the DOM hierarchy cannot be used to represent the relationship.\n@see aria-controls.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-placeholder": {
|
||||
"description": "Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value.\nA hint could be a sample value or a brief description of the expected format.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-posinset": {
|
||||
"description": "Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.\n@see aria-setsize.",
|
||||
"type": {
|
||||
"name": "number",
|
||||
"required": false
|
||||
},
|
||||
"control": "number"
|
||||
},
|
||||
"aria-pressed": {
|
||||
"description": "Indicates the current \"pressed\" state of toggle buttons.\n@see aria-checked\n@see aria-selected.",
|
||||
"type": {
|
||||
"name": "boolean | \"true\" | \"false\" | \"mixed\"",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-readonly": {
|
||||
"description": "Indicates that the element is not editable, but is otherwise operable.\n@see aria-disabled.",
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"aria-relevant": {
|
||||
"description": "Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.\n@see aria-atomic.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": {
|
||||
"type": "select",
|
||||
"options": [
|
||||
"text",
|
||||
"additions",
|
||||
"additions removals",
|
||||
"additions text",
|
||||
"all",
|
||||
"removals",
|
||||
"removals additions",
|
||||
"removals text",
|
||||
"text additions",
|
||||
"text removals"
|
||||
]
|
||||
}
|
||||
},
|
||||
"aria-required": {
|
||||
"description": "Indicates that user input is required on the element before a form may be submitted.",
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"aria-roledescription": {
|
||||
"description": "Defines a human-readable, author-localized description for the role of an element.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
},
|
||||
"aria-rowcount": {
|
||||
"description": "Defines the total number of rows in a table, grid, or treegrid.\n@see aria-rowindex.",
|
||||
"type": {
|
||||
"name": "number",
|
||||
"required": false
|
||||
},
|
||||
"control": "number"
|
||||
},
|
||||
"aria-rowindex": {
|
||||
"description": "Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.\n@see aria-rowcount\n@see aria-rowspan.",
|
||||
"type": {
|
||||
"name": "number",
|
||||
"required": false
|
||||
},
|
||||
"control": "number"
|
||||
},
|
||||
"aria-rowspan": {
|
||||
"description": "Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.\n@see aria-rowindex\n@see aria-colspan.",
|
||||
"type": {
|
||||
"name": "number",
|
||||
"required": false
|
||||
},
|
||||
"control": "number"
|
||||
},
|
||||
"aria-selected": {
|
||||
"description": "Indicates the current \"selected\" state of various widgets.\n@see aria-checked\n@see aria-pressed.",
|
||||
"type": {
|
||||
"name": "boolean",
|
||||
"required": false
|
||||
},
|
||||
"control": "boolean"
|
||||
},
|
||||
"aria-setsize": {
|
||||
"description": "Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.\n@see aria-posinset.",
|
||||
"type": {
|
||||
"name": "number",
|
||||
"required": false
|
||||
},
|
||||
"control": "number"
|
||||
},
|
||||
"aria-sort": {
|
||||
"description": "Indicates if items in a table or grid are sorted in ascending or descending order.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": {
|
||||
"type": "radio",
|
||||
"options": ["none", "ascending", "descending", "other"]
|
||||
}
|
||||
},
|
||||
"aria-valuemax": {
|
||||
"description": "Defines the maximum allowed value for a range widget.",
|
||||
"type": {
|
||||
"name": "number",
|
||||
"required": false
|
||||
},
|
||||
"control": "number"
|
||||
},
|
||||
"aria-valuemin": {
|
||||
"description": "Defines the minimum allowed value for a range widget.",
|
||||
"type": {
|
||||
"name": "number",
|
||||
"required": false
|
||||
},
|
||||
"control": "number"
|
||||
},
|
||||
"aria-valuenow": {
|
||||
"description": "Defines the current value for a range widget.\n@see aria-valuetext.",
|
||||
"type": {
|
||||
"name": "number",
|
||||
"required": false
|
||||
},
|
||||
"control": "number"
|
||||
},
|
||||
"aria-valuetext": {
|
||||
"description": "Defines the human readable text alternative of aria-valuenow for a range widget.",
|
||||
"type": {
|
||||
"name": "string",
|
||||
"required": false
|
||||
},
|
||||
"control": "text"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
||||
import { Code as CodePrimitive } from "./code";
|
||||
|
||||
export default {
|
||||
title: "Components/Code",
|
||||
component: CodePrimitive,
|
||||
} as ComponentMeta<typeof CodePrimitive>;
|
||||
|
||||
const Template: ComponentStory<typeof CodePrimitive> = (args) => (
|
||||
<CodePrimitive {...args} />
|
||||
);
|
||||
|
||||
export const Code = Template.bind({});
|
||||
Code.args = {
|
||||
children: "alert('Hello World!')",
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
import {
|
||||
forwardRef,
|
||||
createElement,
|
||||
type ElementRef,
|
||||
type ComponentProps,
|
||||
} from "react";
|
||||
|
||||
const defaultTag = "code";
|
||||
|
||||
type Props = ComponentProps<typeof defaultTag>;
|
||||
|
||||
export const Code = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
||||
(props, ref) => {
|
||||
return createElement(defaultTag, { ...props, ref });
|
||||
}
|
||||
);
|
||||
|
||||
Code.displayName = "Code";
|
||||
@@ -0,0 +1,55 @@
|
||||
import { CodeIcon } from "@webstudio-is/icons";
|
||||
import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
|
||||
import props from "./__generated__/heading.props.json";
|
||||
|
||||
const presetStyle = {
|
||||
paddingTop: {
|
||||
type: "keyword",
|
||||
value: "0.2em",
|
||||
},
|
||||
paddingBottom: {
|
||||
type: "keyword",
|
||||
value: "0.2em",
|
||||
},
|
||||
paddingLeft: {
|
||||
type: "keyword",
|
||||
value: "0.4em",
|
||||
},
|
||||
paddingRight: {
|
||||
type: "keyword",
|
||||
value: "0.4em",
|
||||
},
|
||||
margin: {
|
||||
type: "keyword",
|
||||
value: "0",
|
||||
},
|
||||
whiteSpace: {
|
||||
type: "keyword",
|
||||
value: "break-spaces",
|
||||
},
|
||||
backgroundColor: {
|
||||
type: "keyword",
|
||||
value: "#eee",
|
||||
},
|
||||
borderRadius: {
|
||||
type: "keyword",
|
||||
value: "3px",
|
||||
},
|
||||
fontFamily: {
|
||||
type: "keyword",
|
||||
value: "monospace",
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const meta: WsComponentMeta = {
|
||||
type: "rich-text",
|
||||
label: "Code",
|
||||
Icon: CodeIcon,
|
||||
presetStyle,
|
||||
children: ["Code you can edit"],
|
||||
};
|
||||
|
||||
export const propsMeta = {
|
||||
props,
|
||||
initialProps: [],
|
||||
} as WsComponentPropsMeta;
|
||||
@@ -20,6 +20,8 @@ import { meta as ImageMeta } from "./image.ws";
|
||||
import { meta as BlockquoteMeta } from "./blockquote.ws";
|
||||
import { meta as ListMeta } from "./list.ws";
|
||||
import { meta as ListItemMeta } from "./list-item.ws";
|
||||
import { meta as SeparatorMeta } from "./separator.ws";
|
||||
import { meta as CodeMeta } from "./code.ws";
|
||||
|
||||
// these are huge JSON objects that we want to be tree-shaken when not used!
|
||||
import { propsMeta as BodyMetaPropsMeta } from "./body.ws";
|
||||
@@ -41,6 +43,8 @@ import { propsMeta as ImageMetaPropsMeta } from "./image.ws";
|
||||
import { propsMeta as BlockquotePropsMeta } from "./blockquote.ws";
|
||||
import { propsMeta as ListPropsMeta } from "./list.ws";
|
||||
import { propsMeta as ListItemPropsMeta } from "./list-item.ws";
|
||||
import { propsMeta as SeparatorPropsMeta } from "./separator.ws";
|
||||
import { propsMeta as CodePropsMeta } from "./code.ws";
|
||||
|
||||
import { Body } from "./body";
|
||||
import { Box } from "./box";
|
||||
@@ -61,6 +65,8 @@ import { Image } from "./image";
|
||||
import { Blockquote } from "./blockquote";
|
||||
import { List } from "./list";
|
||||
import { ListItem } from "./list-item";
|
||||
import { Separator } from "./separator";
|
||||
import { Code } from "./code";
|
||||
|
||||
const defaultMetas: Record<string, WsComponentMeta> = {
|
||||
Box: BoxMeta,
|
||||
@@ -82,6 +88,8 @@ const defaultMetas: Record<string, WsComponentMeta> = {
|
||||
Blockquote: BlockquoteMeta,
|
||||
List: ListMeta,
|
||||
ListItem: ListItemMeta,
|
||||
Separator: SeparatorMeta,
|
||||
Code: CodeMeta,
|
||||
};
|
||||
|
||||
let currentMetas = defaultMetas;
|
||||
@@ -120,6 +128,8 @@ const defaultPropsMetas: Record<string, WsComponentPropsMeta> = {
|
||||
Blockquote: BlockquotePropsMeta,
|
||||
List: ListPropsMeta,
|
||||
ListItem: ListItemPropsMeta,
|
||||
Separator: SeparatorPropsMeta,
|
||||
Code: CodePropsMeta,
|
||||
};
|
||||
|
||||
let registeredPropsMetas: Record<string, Partial<WsComponentPropsMeta>> = {};
|
||||
@@ -177,6 +187,8 @@ const defaultComponents = {
|
||||
Blockquote,
|
||||
List,
|
||||
ListItem,
|
||||
Separator,
|
||||
Code,
|
||||
} as const;
|
||||
|
||||
export type ComponentName = keyof typeof defaultComponents;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
||||
import { Separator as SeparatorPrimitive } from "./separator";
|
||||
|
||||
export default {
|
||||
title: "Components/Separator",
|
||||
component: SeparatorPrimitive,
|
||||
} as ComponentMeta<typeof SeparatorPrimitive>;
|
||||
|
||||
const Template: ComponentStory<typeof SeparatorPrimitive> = (args) => (
|
||||
<SeparatorPrimitive {...args} />
|
||||
);
|
||||
|
||||
export const Separator = Template.bind({});
|
||||
Separator.args = {};
|
||||
@@ -0,0 +1,18 @@
|
||||
import {
|
||||
forwardRef,
|
||||
createElement,
|
||||
type ElementRef,
|
||||
type ComponentProps,
|
||||
} from "react";
|
||||
|
||||
const defaultTag = "hr";
|
||||
|
||||
type Props = ComponentProps<typeof defaultTag>;
|
||||
|
||||
export const Separator = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
||||
(props, ref) => {
|
||||
return createElement(defaultTag, { ...props, ref });
|
||||
}
|
||||
);
|
||||
|
||||
Separator.displayName = "Separator";
|
||||
@@ -0,0 +1,31 @@
|
||||
import { DashIcon } from "@webstudio-is/icons";
|
||||
import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
|
||||
import props from "./__generated__/blockquote.props.json";
|
||||
|
||||
const presetStyle = {
|
||||
height: {
|
||||
type: "keyword",
|
||||
value: "1px",
|
||||
},
|
||||
backgroundColor: {
|
||||
type: "keyword",
|
||||
value: "gray",
|
||||
},
|
||||
border: {
|
||||
type: "keyword",
|
||||
value: "none",
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const meta: WsComponentMeta = {
|
||||
type: "embed",
|
||||
label: "Separator",
|
||||
Icon: DashIcon,
|
||||
presetStyle,
|
||||
children: [],
|
||||
};
|
||||
|
||||
export const propsMeta = {
|
||||
props,
|
||||
initialProps: [],
|
||||
} as WsComponentPropsMeta;
|
||||
Reference in new issue
Block a user