4.0.3 • Published 2 years ago

@component-controls/viewport-plugin v4.0.3

Weekly downloads
528
License
MIT
Repository
github
Last release
2 years ago

Table of contents

In action

Example site

Overview

inspired by the playroom project, this addon contains a ViewportBlock that you can integrate into any page, as well as a standalone ViewportPage

Getting Started

Install

yarn add @component-controls/viewport-plugin --dev

Configure route

in .config/buildtime.js

    const { defaultBuildConfig } = require('@component-controls/core');

    module.exports = {
      stories: [
        ...
      ],
      pages: {
        story: {
          tabs: [
            ...defaultBuildConfig.pages.story.tabs,
            { route: 'viewport' },
          ],
        },
      },
    }

Configure page display

in .config/runtime.tsx

    import React from 'react';
    import { RuntimeConfiguration, defaultRunConfig } from "@component-controls/core";
    import { ViewportPage } from "@component-controls/viewport-plugin";

    const config: RuntimeConfiguration = {
      pages: {
        story: {
          tabs: [
            ...defaultRunConfig.pages.story.tabs,
            { title: 'Viewport', render: () => <ViewportPage /> },
          ],
        },
      },

    };

    export default config;

API

ViewportBlock

react component

defined in @component-controls/viewport-plugin/plugins/addon-stats/src/ViewportBlock/ViewportBlock.tsx

properties

NameTypeParentDescription
sizesRecord<string, number>'320px'*: number'375px'*: number'768px'*: number'1024px'*: numberViewportBlockOwnProps
sxContainerThemeUICSSObject | ThemeDerivedStylesViewportBlockOwnPropsThe ThemeUIStyleObject extends [style props](https://emotion.sh/docs/object-styles) such that properties that are part of the Theme will be transformed to their corresponding values. Other valid CSS properties are also allowed.
titlestringBlockContainerOwnPropsoptional section title for the block.
descriptionstringBlockContainerOwnPropsoptional markdown description.
idstringBlockContainerOwnPropsoptional id to be used for the block if no id is provided, one will be calculated automatically from the title.
collapsiblebooleanBlockContainerOwnPropsif false, will nothave a collapsible frame.
data-testidstringBlockContainerOwnPropstesting id
plainbooleanBlockContainerOwnPropsinner container variant or plain
slotstring | undefinedHTMLAttributes
styleCSSProperties | undefinedHTMLAttributes
keyKey | null | undefinedAttributes
sxThemeUICSSObject | ThemeDerivedStylesAttributesThe ThemeUIStyleObject extends [style props](https://emotion.sh/docs/object-styles) such that properties that are part of the Theme will be transformed to their corresponding values. Other valid CSS properties are also allowed.
defaultCheckedboolean | undefinedHTMLAttributes
defaultValuestring | number | ReadonlyArray<string> | undefinedHTMLAttributes
suppressContentEditableWarningboolean | undefinedHTMLAttributes
suppressHydrationWarningboolean | undefinedHTMLAttributes
accessKeystring | undefinedHTMLAttributes
classNamestring | undefinedHTMLAttributes
contentEditableBooleanish | "inherit" | undefinedHTMLAttributes
contextMenustring | undefinedHTMLAttributes
dirstring | undefinedHTMLAttributes
draggableBooleanish | undefinedHTMLAttributes
hiddenboolean | undefinedHTMLAttributes
langstring | undefinedHTMLAttributes
placeholderstring | undefinedHTMLAttributes
spellCheckBooleanish | undefinedHTMLAttributes
tabIndexnumber | undefinedHTMLAttributes
translate"yes" | "no" | undefinedHTMLAttributes
radioGroupstring | undefinedHTMLAttributes
roleAriaRole | undefinedHTMLAttributes
aboutstring | undefinedHTMLAttributes
datatypestring | undefinedHTMLAttributes
inlistanyHTMLAttributes
prefixstring | undefinedHTMLAttributes
propertystring | undefinedHTMLAttributes
resourcestring | undefinedHTMLAttributes
typeofstring | undefinedHTMLAttributes
vocabstring | undefinedHTMLAttributes
autoCapitalizestring | undefinedHTMLAttributes
autoCorrectstring | undefinedHTMLAttributes
autoSavestring | undefinedHTMLAttributes
colorstring | undefinedHTMLAttributes
itemPropstring | undefinedHTMLAttributes
itemScopeboolean | undefinedHTMLAttributes
itemTypestring | undefinedHTMLAttributes
itemIDstring | undefinedHTMLAttributes
itemRefstring | undefinedHTMLAttributes
resultsnumber | undefinedHTMLAttributes
securitystring | undefinedHTMLAttributes
unselectable"on" | "off" | undefinedHTMLAttributes
inputMode"none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefinedHTMLAttributesHints at the type of data that might be entered by the user while editing the element or its contents
isstring | undefinedHTMLAttributesSpecify that a standard HTML element should behave like a defined custom built-in element
aria-activedescendantstring | undefinedAriaAttributesIdentifies the currently active element when DOM focus is on a composite widget, textbox, group, or application.
aria-atomicboolean | "false" | "true" | undefinedAriaAttributesIndicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.
aria-autocomplete"none" | "inline" | "list" | "both" | undefinedAriaAttributesIndicates 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 presented if they are made.
aria-busyboolean | "false" | "true" | undefinedAriaAttributesIndicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user.
aria-checkedboolean | "false" | "mixed" | "true" | undefinedAriaAttributesIndicates the current "checked" state of checkboxes, radio buttons, and other widgets.
aria-colcountnumber | undefinedAriaAttributesDefines the total number of columns in a table, grid, or treegrid.
aria-colindexnumber | undefinedAriaAttributesDefines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
aria-colspannumber | undefinedAriaAttributesDefines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
aria-controlsstring | undefinedAriaAttributesIdentifies the element (or elements) whose contents or presence are controlled by the current element.
aria-currentboolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefinedAriaAttributesIndicates the element that represents the current item within a container or set of related elements.
aria-describedbystring | undefinedAriaAttributesIdentifies the element (or elements) that describes the object.
aria-detailsstring | undefinedAriaAttributesIdentifies the element that provides a detailed, extended description for the object.
aria-disabledboolean | "false" | "true" | undefinedAriaAttributesIndicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
aria-dropeffect"none" | "copy" | "execute" | "link" | "move" | "popup" | undefinedAriaAttributesIndicates what functions can be performed when a dragged object is released on the drop target.
aria-errormessagestring | undefinedAriaAttributesIdentifies the element that provides an error message for the object.
aria-expandedboolean | "false" | "true" | undefinedAriaAttributesIndicates whether the element, or another grouping element it controls, is currently expanded or collapsed.
aria-flowtostring | undefinedAriaAttributesIdentifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, allows assistive technology to override the general default of reading in document source order.
aria-grabbedboolean | "false" | "true" | undefinedAriaAttributesIndicates an element's "grabbed" state in a drag-and-drop operation.
aria-haspopupboolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefinedAriaAttributesIndicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.
aria-hiddenboolean | "false" | "true" | undefinedAriaAttributesIndicates whether the element is exposed to an accessibility API.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefinedAriaAttributesIndicates the entered value does not conform to the format expected by the application.
aria-keyshortcutsstring | undefinedAriaAttributesIndicates keyboard shortcuts that an author has implemented to activate or give focus to an element.
aria-labelstring | undefinedAriaAttributesDefines a string value that labels the current element.
aria-labelledbystring | undefinedAriaAttributesIdentifies the element (or elements) that labels the current element.
aria-levelnumber | undefinedAriaAttributesDefines the hierarchical level of an element within a structure.
aria-live"off" | "assertive" | "polite" | undefinedAriaAttributesIndicates 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.
aria-modalboolean | "false" | "true" | undefinedAriaAttributesIndicates whether an element is modal when displayed.
aria-multilineboolean | "false" | "true" | undefinedAriaAttributesIndicates whether a text box accepts multiple lines of input or only a single line.
aria-multiselectableboolean | "false" | "true" | undefinedAriaAttributesIndicates that the user may select more than one item from the current selectable descendants.
aria-orientation"horizontal" | "vertical" | undefinedAriaAttributesIndicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.
aria-ownsstring | undefinedAriaAttributesIdentifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship between DOM elements where the DOM hierarchy cannot be used to represent the relationship.
aria-placeholderstring | undefinedAriaAttributesDefines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format.
aria-posinsetnumber | undefinedAriaAttributesDefines 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.
aria-pressedboolean | "false" | "mixed" | "true" | undefinedAriaAttributesIndicates the current "pressed" state of toggle buttons.
aria-readonlyboolean | "false" | "true" | undefinedAriaAttributesIndicates that the element is not editable, but is otherwise operable.
aria-relevant"additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefinedAriaAttributesIndicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
aria-requiredboolean | "false" | "true" | undefinedAriaAttributesIndicates that user input is required on the element before a form may be submitted.
aria-roledescriptionstring | undefinedAriaAttributesDefines a human-readable, author-localized description for the role of an element.
aria-rowcountnumber | undefined
4.0.3

2 years ago

3.15.0

3 years ago

3.13.1

3 years ago

3.12.0

3 years ago

3.14.1

3 years ago

3.14.0

3 years ago

3.10.4

3 years ago

3.14.3

3 years ago

3.14.2

3 years ago

3.14.5

3 years ago

3.14.4

3 years ago

3.14.6

3 years ago

3.13.0

3 years ago

3.11.4

3 years ago

3.11.3

3 years ago

3.9.1

3 years ago

3.9.0

3 years ago

3.10.1

3 years ago

3.8.0

3 years ago

3.10.0

3 years ago

3.10.3

3 years ago

3.10.2

3 years ago

3.8.3

3 years ago

3.8.2

3 years ago

3.8.1

3 years ago

3.11.0

3 years ago

3.7.0

3 years ago

3.11.2

3 years ago

3.11.1

3 years ago

3.6.3

3 years ago

3.6.2

3 years ago

3.6.1

3 years ago

3.6.0

3 years ago

3.5.5

3 years ago

3.5.4

3 years ago

3.5.3

3 years ago

3.5.2

3 years ago

3.5.1

3 years ago

3.5.0

3 years ago

3.4.4

3 years ago

3.4.3

3 years ago

3.4.5

3 years ago

3.4.2

3 years ago

3.4.1

3 years ago

3.4.0

3 years ago

3.2.0

3 years ago

3.1.3

3 years ago

3.1.6

3 years ago

3.1.5

3 years ago

3.1.4

3 years ago

3.3.0

3 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

2.13.0

3 years ago

2.12.0

3 years ago

2.11.3

3 years ago

2.11.2

3 years ago

2.11.0

3 years ago

2.11.1

3 years ago

2.10.5

3 years ago

2.10.4

3 years ago

2.10.3

3 years ago

2.10.2

3 years ago

2.10.1

3 years ago

2.10.0

3 years ago

2.9.1

3 years ago

2.9.0

3 years ago

2.8.1

3 years ago

2.8.0

3 years ago

2.7.0

3 years ago

2.6.5

3 years ago

2.6.4

3 years ago

2.6.3

3 years ago

2.6.2

3 years ago

2.6.1

3 years ago

2.6.0

3 years ago

2.5.3

3 years ago

2.5.2

3 years ago

2.5.0

3 years ago

2.5.1

3 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.4.2

3 years ago

2.3.0

3 years ago

2.2.4

3 years ago

2.2.3

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.44.1

3 years ago

1.44.0

3 years ago

1.43.0

3 years ago

1.42.12

3 years ago

1.42.9

3 years ago

1.42.4

3 years ago

1.42.6

3 years ago

1.42.2

3 years ago

1.42.1

3 years ago

1.42.0

3 years ago

1.41.1

3 years ago

1.41.0

3 years ago

1.40.5

3 years ago

1.40.2

3 years ago

1.40.4

3 years ago

1.40.3

3 years ago

1.40.1

3 years ago

1.39.3

3 years ago

1.39.4

3 years ago

1.39.2

3 years ago

1.39.0

3 years ago

1.38.2

3 years ago

1.38.0

4 years ago

1.37.0

4 years ago

1.36.14

4 years ago

1.36.13

4 years ago

1.36.12

4 years ago

1.36.8

4 years ago

1.36.11

4 years ago

1.36.6

4 years ago

1.36.7

4 years ago

1.36.5

4 years ago

1.36.4

4 years ago

1.36.3

4 years ago

1.36.2

4 years ago

1.36.1

4 years ago

1.36.0

4 years ago

1.35.1

4 years ago

1.35.0

4 years ago

1.34.0

4 years ago

1.33.1

4 years ago

1.32.4

4 years ago

1.32.5

4 years ago

1.32.2

4 years ago

1.32.3

4 years ago

1.32.1

4 years ago

1.31.3

4 years ago

1.31.2

4 years ago

1.30.0

4 years ago

1.29.0

4 years ago

1.28.0

4 years ago

1.27.3

4 years ago

1.27.2

4 years ago

1.27.1

4 years ago

1.27.0

4 years ago

1.26.0

4 years ago

1.25.3

4 years ago

1.25.2

4 years ago

1.25.1

4 years ago

1.25.0

4 years ago

1.24.7

4 years ago

1.24.6

4 years ago

1.24.5

4 years ago

1.24.3

4 years ago

1.24.1

4 years ago

1.24.2

4 years ago

1.23.0

4 years ago

1.24.0

4 years ago

1.22.1

4 years ago

1.22.0

4 years ago

1.21.0

4 years ago