@component-controls/blocks
TypeScript icon, indicating that this package has built-in type declarations

4.0.3 • Public • Published

Table of contents

Overview

Some of the guiding design goals for this library:

  • Most components should have a 'plain' and a 'block' version, where the block version adds a collapsible Box with a title.
  • There are two main categories of components:
    • that display story data (i.e. story source, story render)
    • that display component(s) data (i.e. prop tables, component sources)
  • Components accept a list of custom ActionItems to be extended.
  • Components that deal with source code (story or component source) display actions to browse their respective repositories.

List of components

getURL

react component

defined in @component-controls/blocks/ui/blocks/src/utils/url.ts

InvalidType

react component

error message when the control type is not found.

defined in @component-controls/blocks/ui/blocks/src/notifications/InvalidType.tsx

getStoryTitle

react type

defined in @component-controls/blocks/ui/blocks/src/utils/constants.ts

properties

Name Type Parent Description
title* string Document title of the document. If no 'route' parameter is specifified, the title is used to generate the document url. This is the only required field, to show the document in the menu structures.
type "story" | "blog" | "page" | "tags" | "author" | string Document document type - blogs, pages, stories and even custom ones. By default - story
route string Document if provided, will be used as the route for the page. if not provided, the title in lowercase will be used as the route
date string Document optional date the document was created. If not assigned, the instrumentation process will use birthtime
dateModified string Document optional date the document was last modified. If not assigned, the instrumentation process will use mtime
status "draft" | "published" Document if set to draft, the document will be hidden in production builds.
tags string[] Document comma-separated list of document tags, used for search and for SOE keywords unless keyswords are specified.
keywords string[] Document comma-separated list of SEO keywords
description string | JSX.Element Document documentation file description
image string Document link to an image for the document, will be used for SEO
author string Document document author
order number Document document order, used to sort documents within the same parent
menu string Document to which static menu to attach the document compatibility with docz
template
type
bind*: function (
props
name*: string
storyName: string
id: string
rawId: string
doc: string
storyFn: StoryRenderFn
description: string
arguments: StoryArguments
loc: CodeLocation
source: string
subtitle: string
dynamic: boolean
dynamicId: string
component
at*:
subcomponents: Record<string, (string, Record<string, unknown>, ElementType<Props>)>
controls: ComponentControls
smartControls: SmartControls
decorators: StoryRenderFn[]
plugins: any
category: string
) =>
Example<>
bind*: function (
props*:
) => Example<Props>
source: string
id: string
description: string
storyName: string
rawId: string
doc: string
storyFn: StoryRenderFn
loc: CodeLocation
subtitle: string
dynamic: boolean
dynamicId: string
component
at*:
subcomponents: Record<string, (string, Record<string, unknown>, ElementType<Props>)>
smartControls: SmartControls
decorators: StoryRenderFn[]
plugins: any
category: string
controls*:

source: string
id: string
description: string
storyName: string
rawId: string
doc: string
storyFn: function (
controlValues
[string]: any
context: any
) => Promise | any
loc
start*
line*: number
column*: number
end*
line*: number
column*: number
subtitle: string
dynamic: boolean
dynamicId: string
component: string | Record<string, unknown> | ElementType<Props>
subcomponents: Record<string, (string, Record<string, unknown>, ElementType<Props>)>
smartControls
smart: boolean
include: string[] | IncludeFn
exclude: string[] | IncludeFn
decorators: StoryRenderFn[]
plugins: any
category: string
controls
[string]: ComponentControl<ExampleControls> | any
Document template component to be linked to document stories
stories string[] Document list of story ids contained in the document.
source string Document source code of the entire file of stories
fileName string Document file name of the file of stories
package string Document lookup into the global store of PackageInfo package.json
testFiles string[] Document optional specify which test files are asociated with the document
testCoverage string[] Document optional specify which files to use for test coverage
testData string Document optional test data file
renderFn function (
props*
story*
name*: string
storyName: string
id: string
rawId: string
doc: string
storyFn: StoryRenderFn
description: string
arguments: StoryArguments
loc: CodeLocation
source: string
subtitle: string
dynamic: boolean
dynamicId: string
component: string | Record<string, unknown> | ElementType<Props>
subcomponents: Record<string, (string, Record<string, unknown>, ElementType<Props>)>
controls: ComponentControls
smartControls: SmartControls
decorators: StoryRenderFn[]
plugins: any
category: string
doc
title*:
type*:
route*:
date*:
dateModified*:
status*:
tags*:
keywords*:
description*:
image*:
author*:
order*:
menu*:
template*:
stories*:
source*:
fileName*:
package*:
testFiles*:
testCoverage*:
testData*:
renderFn*:
data*:
componentsLookup*:
MDXPage*:
isMDXComponent*:
parameters*:
component*:
subcomponents*:
controls*:
smartControls*:
decorators*:
plugins*:
category*:
navSidebar*:
contextSidebar*:
fullPage*:
values: ExampleControls
options: any
) => any
Document render function by framework. By default 'react'
data
DocumentData
[string]:
type
[string]: ComponentControl<ExampleControls> | any
Document records of storyid/data pairs, to be associated with documents
componentsLookup
type
[string]: string
Document lookup into the global store.components since multiple components of the same name can be used example: ['Button']: 'c:/myapp/Button.tsx'
MDXPage any Document for MDX documents, this is an MDXContent function, to be rendered inside a MDXProvider
isMDXComponent boolean Document custom prop set by mdxjs
parameters any Document storybook compatibility field
component string | Record<string, unknown> | ElementType<Props> StoryProps id for component associated with the story
subcomponents Record<string, (string, Record<string, unknown>, ElementType<Props>)> StoryProps multiple components option
controls
ComponentControls<>
[string]: ComponentControlText | ComponentControlBoolean | ComponentControlColor | ComponentControlDate | ComponentControlObject<> | ComponentControlButton<> | ComponentControlOptions<> | ComponentControlNumber | ComponentControlArray | ComponentControlFiles
StoryProps ComponentControls are defined in key value pairs the name of the property is the key and the value is the ComponentControl
smartControls
SmartControls
smart: boolean
include: string[] | IncludeFn
exclude: string[] | IncludeFn
StoryProps "smart" controls options
decorators StoryRenderFn[] StoryProps array of wrapper functions (decorators) to be called when rendering each individual story.
plugins any StoryProps plugins configuration settings
category string StoryProps category string - can be used for cleanly separating stories/components
navSidebar boolean PageLayoutProps whether to add navigation sidebar to the page
contextSidebar boolean PageLayoutProps whether to add conext sidebar to navigate the sections of the current document
fullPage boolean PageLayoutProps whether to take a fullpage theme option

repositoryActions

react function

defined in @component-controls/blocks/ui/blocks/src/utils/repositoryActions.tsx

parameters

Name Type Description
packageInfo
PackageInfo
fileHash*: string
name: string
version: string
dependencies
[string]: PackageDependency
devDependencies
[string]: PackageDependency
peerDependencies
[string]: PackageDependency
privateNpm: boolean
repository*
browse: string
docs: string
issues: string
package.json information about the repository of the stories and components
returns ActionItem[] | undefined

ComponentStats

react component

defined in @component-controls/blocks/ui/blocks/src/ComponentStats/ComponentStats.tsx

properties

Name Type Parent Description
component
Component
name*: string
importedName: "default" | "namespace" | string
from: string
request: string
fileName: string
propsInfoFile: string
loc
start*
line*:
column*:
end*
line*:
column*:
package: string
source: string
info
displayName*: string
description: string
props*
[string]: PropType
externalDependencies
[string]: (Omit<ImportType, "from">)[]
localDependencies
[string]: (Omit<ImportType, "from">)[]
jsx: JSXNode[]
fileInfo
dateCreated: string
dateModified: string
commits: Commits
sloc
block*:
blockEmpty*:
comment*:
empty*:
mixed*:
single*:
source*:
todo*:
total*:
jest
results*: JestResult[]
coverage*: Record<string, JestCoverage>
component specified for stories or story files
slot string | undefined HTMLAttributes
style CSSProperties | undefined HTMLAttributes
title string | undefined HTMLAttributes
key Key | null | undefined Attributes
sx ThemeUICSSObject | ThemeDerivedStyles Attributes The 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.
defaultChecked boolean | undefined HTMLAttributes
defaultValue string | number | ReadonlyArray<string> | undefined HTMLAttributes
suppressContentEditableWarning boolean | undefined HTMLAttributes
suppressHydrationWarning boolean | undefined HTMLAttributes
accessKey string | undefined HTMLAttributes
className string | undefined HTMLAttributes
contentEditable Booleanish | "inherit" | undefined HTMLAttributes
contextMenu string | undefined HTMLAttributes
dir string | undefined HTMLAttributes
draggable Booleanish | undefined HTMLAttributes
hidden boolean | undefined HTMLAttributes
id string | undefined HTMLAttributes
lang string | undefined HTMLAttributes
placeholder string | undefined HTMLAttributes
spellCheck Booleanish | undefined HTMLAttributes
tabIndex number | undefined HTMLAttributes
translate "yes" | "no" | undefined HTMLAttributes
radioGroup string | undefined HTMLAttributes
role AriaRole | undefined HTMLAttributes
about string | undefined HTMLAttributes
datatype string | undefined HTMLAttributes
inlist any HTMLAttributes
prefix string | undefined HTMLAttributes
property string | undefined HTMLAttributes
resource string | undefined HTMLAttributes
typeof string | undefined HTMLAttributes
vocab string | undefined HTMLAttributes
autoCapitalize string | undefined HTMLAttributes
autoCorrect string | undefined HTMLAttributes
autoSave string | undefined HTMLAttributes
color string | undefined HTMLAttributes
itemProp string | undefined HTMLAttributes
itemScope boolean | undefined HTMLAttributes
itemType string | undefined HTMLAttributes
itemID string | undefined HTMLAttributes
itemRef string | undefined HTMLAttributes
results number | undefined HTMLAttributes
security string | undefined HTMLAttributes
unselectable "on" | "off" | undefined HTMLAttributes
inputMode "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined HTMLAttributes Hints at the type of data that might be entered by the user while editing the element or its contents
is string | undefined HTMLAttributes Specify that a standard HTML element should behave like a defined custom built-in element
aria-activedescendant string | undefined AriaAttributes Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application.
aria-atomic boolean | "false" | "true" | undefined AriaAttributes 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.
aria-autocomplete "none" | "inline" | "list" | "both" | undefined AriaAttributes 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 presented if they are made.
aria-busy boolean | "false" | "true" | undefined AriaAttributes 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.
aria-checked boolean | "false" | "mixed" | "true" | undefined AriaAttributes Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
aria-colcount number | undefined AriaAttributes Defines the total number of columns in a table, grid, or treegrid.
aria-colindex number | undefined AriaAttributes Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
aria-colspan number | undefined AriaAttributes Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
aria-controls string | undefined AriaAttributes Identifies the element (or elements) whose contents or presence are controlled by the current element.
aria-current boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined AriaAttributes Indicates the element that represents the current item within a container or set of related elements.
aria-describedby string | undefined AriaAttributes Identifies the element (or elements) that describes the object.
aria-details string | undefined AriaAttributes Identifies the element that provides a detailed, extended description for the object.
aria-disabled boolean | "false" | "true" | undefined AriaAttributes Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
aria-dropeffect "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined AriaAttributes Indicates what functions can be performed when a dragged object is released on the drop target.
aria-errormessage string | undefined AriaAttributes Identifies the element that provides an error message for the object.
aria-expanded boolean | "false" | "true" | undefined AriaAttributes Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed.
aria-flowto string | undefined AriaAttributes Identifies 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-grabbed boolean | "false" | "true" | undefined AriaAttributes Indicates an element's "grabbed" state in a drag-and-drop operation.
aria-haspopup boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined AriaAttributes Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.
aria-hidden boolean | "false" | "true" | undefined AriaAttributes Indicates whether the element is exposed to an accessibility API.
aria-invalid boolean | "false" | "true" | "grammar" | "spelling" | undefined AriaAttributes Indicates the entered value does not conform to the format expected by the application.
aria-keyshortcuts string | undefined AriaAttributes Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.
aria-label string | undefined AriaAttributes Defines a string value that labels the current element.
aria-labelledby string | undefined AriaAttributes Identifies the element (or elements) that labels the current element.
aria-level number | undefined AriaAttributes Defines the hierarchical level of an element within a structure.
aria-live "off" | "assertive" | "polite" | undefined AriaAttributes 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.
aria-modal boolean | "false" | "true" | undefined AriaAttributes Indicates whether an element is modal when displayed.
aria-multiline boolean | "false" | "true" | undefined AriaAttributes Indicates whether a text box accepts multiple lines of input or only a single line.
aria-multiselectable boolean | "false" | "true" | undefined AriaAttributes Indicates that the user may select more than one item from the current selectable descendants.
aria-orientation "horizontal" | "vertical" | undefined AriaAttributes Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.
aria-owns string | undefined AriaAttributes Identifies 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-placeholder string | undefined AriaAttributes Defines 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-posinset number | undefined AriaAttributes 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.
aria-pressed boolean | "false" | "mixed" | "true" | undefined AriaAttributes Indicates the current "pressed" state of toggle buttons.
aria-readonly boolean | "false" | "true" | undefined AriaAttributes Indicates 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" | undefined AriaAttributes Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
aria-required boolean | "false" | "true" | undefined AriaAttributes Indicates that user input is required on the element before a form may be submitted.
aria-roledescription string | undefined AriaAttributes Defines a human-readable, author-localized description for the role of an element.
aria-rowcount number | undefined AriaAttributes Defines the total number of rows in a table, grid, or treegrid.
aria-rowindex number | undefined AriaAttributes Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
aria-rowspan number | undefined AriaAttributes Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
aria-selected boolean | "false" | "true" | undefined AriaAttributes Indicates the current "selected" state of various widgets.
aria-setsize number | undefined AriaAttributes 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.
aria-sort "none" | "ascending" | "descending" | "other" | undefined AriaAttributes Indicates if items in a table or grid are sorted in ascending or descending order.
aria-valuemax number | undefined AriaAttributes Defines the maximum allowed value for a range widget.
aria-valuemin number | undefined AriaAttributes Defines the minimum allowed value for a range widget.
aria-valuenow number | undefined AriaAttributes Defines the current value for a range widget.
aria-valuetext string | undefined AriaAttributes Defines the human readable text alternative of aria-valuenow for a range widget.
dangerouslySetInnerHTML type | undefined DOMAttributes
onCopy ClipboardEventHandler | undefined DOMAttributes
onCopyCapture ClipboardEventHandler | undefined DOMAttributes
onCut ClipboardEventHandler | undefined DOMAttributes
onCutCapture ClipboardEventHandler | undefined DOMAttributes
onPaste ClipboardEventHandler | undefined DOMAttributes
onPasteCapture ClipboardEventHandler | undefined DOMAttributes
onCompositionEnd CompositionEventHandler | undefined DOMAttributes
onCompositionEndCapture CompositionEventHandler | undefined DOMAttributes
onCompositionStart CompositionEventHandler | undefined DOMAttributes
onCompositionStartCapture CompositionEventHandler | undefined DOMAttributes
onCompositionUpdate CompositionEventHandler | undefined DOMAttributes
onCompositionUpdateCapture CompositionEventHandler | undefined DOMAttributes
onFocus FocusEventHandler | undefined DOMAttributes
onFocusCapture FocusEventHandler | undefined DOMAttributes
onBlur FocusEventHandler | undefined DOMAttributes
onBlurCapture FocusEventHandler | undefined DOMAttributes
onChange FormEventHandler | undefined DOMAttributes
onChangeCapture FormEventHandler | undefined DOMAttributes
onBeforeInput FormEventHandler | undefined DOMAttributes
onBeforeInputCapture FormEventHandler | undefined DOMAttributes
onInput FormEventHandler | undefined DOMAttributes
onInputCapture FormEventHandler | undefined DOMAttributes
onReset FormEventHandler | undefined DOMAttributes
onResetCapture FormEventHandler | undefined DOMAttributes
onSubmit FormEventHandler | undefined DOMAttributes
onSubmitCapture FormEventHandler | undefined DOMAttributes
onInvalid FormEventHandler | undefined DOMAttributes
onInvalidCapture FormEventHandler | undefined DOMAttributes
onLoad ReactEventHandler | undefined DOMAttributes
onLoadCapture ReactEventHandler | undefined DOMAttributes
onError ReactEventHandler | undefined DOMAttributes
onErrorCapture ReactEventHandler | undefined DOMAttributes
onKeyDown KeyboardEventHandler | undefined DOMAttributes
onKeyDownCapture KeyboardEventHandler | undefined DOMAttributes

Readme

Keywords

none

Package Sidebar

Install

npm i @component-controls/blocks

Weekly Downloads

6

Version

4.0.3

License

MIT

Unpacked Size

11.4 MB

Total Files

168

Last publish

Collaborators

  • atanasster