Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rmwc/toggleable

Package Overview
Dependencies
Maintainers
1
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rmwc/toggleable - npm Package Compare versions

Comparing version 5.7.0 to 6.0.0-alpha.1

377

dist/index.d.ts
import * as React from 'react';
import { FoundationComponent, FoundationProps } from '@rmwc/base';
export interface ToggleableFoundationProps {

@@ -17,7 +16,373 @@ /** A DOM ID for the toggle. */

/** A reference to the native input. */
inputRef?: React.MutableRefObject<HTMLInputElement | null> | ((ref: HTMLInputElement | null) => void);
inputRef?: React.Ref<HTMLInputElement>;
}
export declare class ToggleableFoundationComponent<Foundation extends any, P extends ToggleableFoundationProps, S extends any = {}> extends FoundationComponent<Foundation, P & FoundationProps, S> {
generatedId: string;
renderToggle(toggle: React.ReactNode): {} | null | undefined;
}
export declare function useToggleFoundation(props: ToggleableFoundationProps & React.HTMLProps<any>): {
id: string;
renderToggle: (toggle: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) => JSX.Element;
toggleRootProps: {
disabled: boolean | undefined;
} | {
accept?: string | undefined;
acceptCharset?: string | undefined;
action?: string | undefined;
allowFullScreen?: boolean | undefined;
allowTransparency?: boolean | undefined;
alt?: string | undefined;
as?: string | undefined;
async?: boolean | undefined;
autoComplete?: string | undefined;
autoFocus?: boolean | undefined;
autoPlay?: boolean | undefined;
capture?: string | boolean | undefined;
cellPadding?: string | number | undefined;
cellSpacing?: string | number | undefined;
charSet?: string | undefined;
challenge?: string | undefined;
checked?: boolean | undefined;
cite?: string | undefined;
classID?: string | undefined;
cols?: number | undefined;
colSpan?: number | undefined;
content?: string | undefined;
controls?: boolean | undefined;
coords?: string | undefined;
crossOrigin?: string | undefined;
data?: string | undefined;
dateTime?: string | undefined;
default?: boolean | undefined;
defer?: boolean | undefined;
disabled: boolean | undefined;
download?: any;
encType?: string | undefined;
form?: string | undefined;
formAction?: string | undefined;
formEncType?: string | undefined;
formMethod?: string | undefined;
formNoValidate?: boolean | undefined;
formTarget?: string | undefined;
frameBorder?: string | number | undefined;
headers?: string | undefined;
height?: string | number | undefined;
high?: number | undefined;
href?: string | undefined;
hrefLang?: string | undefined;
htmlFor?: string | undefined;
httpEquiv?: string | undefined;
integrity?: string | undefined;
keyParams?: string | undefined;
keyType?: string | undefined;
kind?: string | undefined;
label?: string | undefined;
list?: string | undefined;
loop?: boolean | undefined;
low?: number | undefined;
manifest?: string | undefined;
marginHeight?: number | undefined;
marginWidth?: number | undefined;
max?: string | number | undefined;
maxLength?: number | undefined;
media?: string | undefined;
mediaGroup?: string | undefined;
method?: string | undefined;
min?: string | number | undefined;
minLength?: number | undefined;
multiple?: boolean | undefined;
muted?: boolean | undefined;
name?: string | undefined;
nonce?: string | undefined;
noValidate?: boolean | undefined;
open?: boolean | undefined;
optimum?: number | undefined;
pattern?: string | undefined;
placeholder?: string | undefined;
playsInline?: boolean | undefined;
poster?: string | undefined;
preload?: string | undefined;
readOnly?: boolean | undefined;
rel?: string | undefined;
required?: boolean | undefined;
reversed?: boolean | undefined;
rows?: number | undefined;
rowSpan?: number | undefined;
sandbox?: string | undefined;
scope?: string | undefined;
scoped?: boolean | undefined;
scrolling?: string | undefined;
seamless?: boolean | undefined;
selected?: boolean | undefined;
shape?: string | undefined;
size?: number | undefined;
sizes?: string | undefined;
span?: number | undefined;
src?: string | undefined;
srcDoc?: string | undefined;
srcLang?: string | undefined;
srcSet?: string | undefined;
start?: number | undefined;
step?: string | number | undefined;
summary?: string | undefined;
target?: string | undefined;
type?: string | undefined;
useMap?: string | undefined;
value?: string | number | string[] | undefined;
width?: string | number | undefined;
wmode?: string | undefined;
wrap?: string | undefined;
defaultChecked?: boolean | undefined;
defaultValue?: string | number | string[] | undefined;
suppressContentEditableWarning?: boolean | undefined;
suppressHydrationWarning?: boolean | undefined;
accessKey?: string | undefined;
className: string | undefined;
contentEditable?: boolean | undefined;
contextMenu?: string | undefined;
dir?: string | undefined;
draggable?: boolean | undefined;
hidden?: boolean | undefined;
id?: string | undefined;
lang?: string | undefined;
slot?: string | undefined;
spellCheck?: boolean | undefined;
style: React.CSSProperties | undefined;
tabIndex?: number | undefined;
title?: string | undefined;
radioGroup?: string | undefined;
role?: string | undefined;
about?: string | undefined;
datatype?: string | undefined;
inlist?: any;
prefix?: string | undefined;
property?: string | undefined;
resource?: string | undefined;
typeof?: string | undefined;
vocab?: string | undefined;
autoCapitalize?: string | undefined;
autoCorrect?: string | undefined;
autoSave?: string | undefined;
color?: string | undefined;
itemProp?: string | undefined;
itemScope?: boolean | undefined;
itemType?: string | undefined;
itemID?: string | undefined;
itemRef?: string | undefined;
results?: number | undefined;
security?: string | undefined;
unselectable?: "on" | "off" | undefined;
inputMode?: "url" | "text" | "search" | "none" | "tel" | "email" | "numeric" | "decimal" | undefined;
is?: string | undefined;
'aria-activedescendant'?: string | undefined;
'aria-atomic'?: boolean | "false" | "true" | undefined;
'aria-autocomplete'?: "list" | "none" | "inline" | "both" | undefined;
'aria-busy'?: boolean | "false" | "true" | undefined;
'aria-checked'?: boolean | "false" | "true" | "mixed" | undefined;
'aria-colcount'?: number | undefined;
'aria-colindex'?: number | undefined;
'aria-colspan'?: number | undefined;
'aria-controls'?: string | undefined;
'aria-current'?: boolean | "time" | "step" | "false" | "true" | "page" | "location" | "date" | undefined;
'aria-describedby'?: string | undefined;
'aria-details'?: string | undefined;
'aria-disabled'?: boolean | "false" | "true" | undefined;
'aria-dropeffect'?: "link" | "none" | "copy" | "execute" | "move" | "popup" | undefined;
'aria-errormessage'?: string | undefined;
'aria-expanded'?: boolean | "false" | "true" | undefined;
'aria-flowto'?: string | undefined;
'aria-grabbed'?: boolean | "false" | "true" | undefined;
'aria-haspopup'?: boolean | "dialog" | "menu" | "false" | "true" | "listbox" | "tree" | "grid" | undefined;
'aria-hidden'?: boolean | "false" | "true" | undefined;
'aria-invalid'?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
'aria-keyshortcuts'?: string | undefined;
'aria-label'?: string | undefined;
'aria-labelledby'?: string | undefined;
'aria-level'?: number | undefined;
'aria-live'?: "off" | "assertive" | "polite" | undefined;
'aria-modal'?: boolean | "false" | "true" | undefined;
'aria-multiline'?: boolean | "false" | "true" | undefined;
'aria-multiselectable'?: boolean | "false" | "true" | undefined;
'aria-orientation'?: "horizontal" | "vertical" | undefined;
'aria-owns'?: string | undefined;
'aria-placeholder'?: string | undefined;
'aria-posinset'?: number | undefined;
'aria-pressed'?: boolean | "false" | "true" | "mixed" | undefined;
'aria-readonly'?: boolean | "false" | "true" | undefined;
'aria-relevant'?: "text" | "additions" | "additions text" | "all" | "removals" | undefined;
'aria-required'?: boolean | "false" | "true" | undefined;
'aria-roledescription'?: string | undefined;
'aria-rowcount'?: number | undefined;
'aria-rowindex'?: number | undefined;
'aria-rowspan'?: number | undefined;
'aria-selected'?: boolean | "false" | "true" | undefined;
'aria-setsize'?: number | undefined;
'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
'aria-valuemax'?: number | undefined;
'aria-valuemin'?: number | undefined;
'aria-valuenow'?: number | undefined;
'aria-valuetext'?: string | undefined;
children?: React.ReactNode;
dangerouslySetInnerHTML?: {
__html: string;
} | undefined;
onCopy?: ((event: React.ClipboardEvent<any>) => void) | undefined;
onCopyCapture?: ((event: React.ClipboardEvent<any>) => void) | undefined;
onCut?: ((event: React.ClipboardEvent<any>) => void) | undefined;
onCutCapture?: ((event: React.ClipboardEvent<any>) => void) | undefined;
onPaste?: ((event: React.ClipboardEvent<any>) => void) | undefined;
onPasteCapture?: ((event: React.ClipboardEvent<any>) => void) | undefined;
onCompositionEnd?: ((event: React.CompositionEvent<any>) => void) | undefined;
onCompositionEndCapture?: ((event: React.CompositionEvent<any>) => void) | undefined;
onCompositionStart?: ((event: React.CompositionEvent<any>) => void) | undefined;
onCompositionStartCapture?: ((event: React.CompositionEvent<any>) => void) | undefined;
onCompositionUpdate?: ((event: React.CompositionEvent<any>) => void) | undefined;
onCompositionUpdateCapture?: ((event: React.CompositionEvent<any>) => void) | undefined;
onFocus?: ((event: React.FocusEvent<any>) => void) | undefined;
onFocusCapture?: ((event: React.FocusEvent<any>) => void) | undefined;
onBlur?: ((event: React.FocusEvent<any>) => void) | undefined;
onBlurCapture?: ((event: React.FocusEvent<any>) => void) | undefined;
onChange?: ((event: React.FormEvent<any>) => void) | undefined;
onChangeCapture?: ((event: React.FormEvent<any>) => void) | undefined;
onBeforeInput?: ((event: React.FormEvent<any>) => void) | undefined;
onBeforeInputCapture?: ((event: React.FormEvent<any>) => void) | undefined;
onInput?: ((event: React.FormEvent<any>) => void) | undefined;
onInputCapture?: ((event: React.FormEvent<any>) => void) | undefined;
onReset?: ((event: React.FormEvent<any>) => void) | undefined;
onResetCapture?: ((event: React.FormEvent<any>) => void) | undefined;
onSubmit?: ((event: React.FormEvent<any>) => void) | undefined;
onSubmitCapture?: ((event: React.FormEvent<any>) => void) | undefined;
onInvalid?: ((event: React.FormEvent<any>) => void) | undefined;
onInvalidCapture?: ((event: React.FormEvent<any>) => void) | undefined;
onLoad?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onLoadCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onError?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onErrorCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onKeyDown?: ((event: React.KeyboardEvent<any>) => void) | undefined;
onKeyDownCapture?: ((event: React.KeyboardEvent<any>) => void) | undefined;
onKeyPress?: ((event: React.KeyboardEvent<any>) => void) | undefined;
onKeyPressCapture?: ((event: React.KeyboardEvent<any>) => void) | undefined;
onKeyUp?: ((event: React.KeyboardEvent<any>) => void) | undefined;
onKeyUpCapture?: ((event: React.KeyboardEvent<any>) => void) | undefined;
onAbort?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onAbortCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onCanPlay?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onCanPlayCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onCanPlayThrough?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onCanPlayThroughCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onDurationChange?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onDurationChangeCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onEmptied?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onEmptiedCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onEncrypted?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onEncryptedCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onEnded?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onEndedCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onLoadedData?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onLoadedDataCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onLoadedMetadata?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onLoadedMetadataCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onLoadStart?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onLoadStartCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onPause?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onPauseCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onPlay?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onPlayCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onPlaying?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onPlayingCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onProgress?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onProgressCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onRateChange?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onRateChangeCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onSeeked?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onSeekedCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onSeeking?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onSeekingCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onStalled?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onStalledCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onSuspend?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onSuspendCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onTimeUpdate?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onTimeUpdateCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onVolumeChange?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onVolumeChangeCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onWaiting?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onWaitingCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onAuxClick?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onAuxClickCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onClick?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onClickCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onContextMenu?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onContextMenuCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onDoubleClick?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onDoubleClickCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onDrag?: ((event: React.DragEvent<any>) => void) | undefined;
onDragCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onDragEnd?: ((event: React.DragEvent<any>) => void) | undefined;
onDragEndCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onDragEnter?: ((event: React.DragEvent<any>) => void) | undefined;
onDragEnterCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onDragExit?: ((event: React.DragEvent<any>) => void) | undefined;
onDragExitCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onDragLeave?: ((event: React.DragEvent<any>) => void) | undefined;
onDragLeaveCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onDragOver?: ((event: React.DragEvent<any>) => void) | undefined;
onDragOverCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onDragStart?: ((event: React.DragEvent<any>) => void) | undefined;
onDragStartCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onDrop?: ((event: React.DragEvent<any>) => void) | undefined;
onDropCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onMouseDown?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseDownCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseEnter?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseLeave?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseMove?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseMoveCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseOut?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseOutCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseOver?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseOverCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseUp?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseUpCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onSelect?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onSelectCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onTouchCancel?: ((event: React.TouchEvent<any>) => void) | undefined;
onTouchCancelCapture?: ((event: React.TouchEvent<any>) => void) | undefined;
onTouchEnd?: ((event: React.TouchEvent<any>) => void) | undefined;
onTouchEndCapture?: ((event: React.TouchEvent<any>) => void) | undefined;
onTouchMove?: ((event: React.TouchEvent<any>) => void) | undefined;
onTouchMoveCapture?: ((event: React.TouchEvent<any>) => void) | undefined;
onTouchStart?: ((event: React.TouchEvent<any>) => void) | undefined;
onTouchStartCapture?: ((event: React.TouchEvent<any>) => void) | undefined;
onPointerDown?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerDownCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerMove?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerMoveCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerUp?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerUpCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerCancel?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerCancelCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerEnter?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerEnterCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerLeave?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerLeaveCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerOver?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerOverCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerOut?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerOutCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onGotPointerCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onGotPointerCaptureCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onLostPointerCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onLostPointerCaptureCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onScroll?: ((event: React.UIEvent<any>) => void) | undefined;
onScrollCapture?: ((event: React.UIEvent<any>) => void) | undefined;
onWheel?: ((event: React.WheelEvent<any>) => void) | undefined;
onWheelCapture?: ((event: React.WheelEvent<any>) => void) | undefined;
onAnimationStart?: ((event: React.AnimationEvent<any>) => void) | undefined;
onAnimationStartCapture?: ((event: React.AnimationEvent<any>) => void) | undefined;
onAnimationEnd?: ((event: React.AnimationEvent<any>) => void) | undefined;
onAnimationEndCapture?: ((event: React.AnimationEvent<any>) => void) | undefined;
onAnimationIteration?: ((event: React.AnimationEvent<any>) => void) | undefined;
onAnimationIterationCapture?: ((event: React.AnimationEvent<any>) => void) | undefined;
onTransitionEnd?: ((event: React.TransitionEvent<any>) => void) | undefined;
onTransitionEndCapture?: ((event: React.TransitionEvent<any>) => void) | undefined;
ref?: string | ((instance: any) => void) | React.RefObject<any> | null | undefined;
key?: string | number | undefined;
};
};

78

dist/index.js
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {

@@ -37,42 +24,7 @@ __assign = Object.assign || function(t) {

var formfield_1 = require("@rmwc/formfield");
var ToggleableFoundationComponent = /** @class */ (function (_super) {
__extends(ToggleableFoundationComponent, _super);
function ToggleableFoundationComponent() {
var _this = _super !== null && _super.apply(this, arguments) || this;
// @ts-ignore
_this.generatedId = base_1.randomId(_this.constructor.displayName);
return _this;
}
Object.defineProperty(ToggleableFoundationComponent.prototype, "hasLabel", {
/** @internal */
get: function () {
return this.props.label || this.props.children;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ToggleableFoundationComponent.prototype, "id", {
/** @internal */
get: function () {
return this.props.id || this.generatedId;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ToggleableFoundationComponent.prototype, "toggleRootProps", {
/** @internal */
get: function () {
var _a = this.props, className = _a.className, style = _a.style, disabled = _a.disabled, _b = _a.rootProps, rootProps = _b === void 0 ? {} : _b;
if (this.hasLabel) {
// @ts-ignore
return this.root.props({ disabled: disabled });
}
return __assign({}, this.root.props(__assign({ className: className,
style: style,
disabled: disabled }, rootProps)));
},
enumerable: true,
configurable: true
});
ToggleableFoundationComponent.prototype.renderToggle = function (toggle) {
function useToggleFoundation(props) {
var className = props.className, style = props.style, rootProps = props.rootProps, label = props.label, children = props.children, disabled = props.disabled;
var hasLabel = props.label || props.children;
var id = base_1.useId('toggle-', props);
var renderToggle = function (toggle) {
/**

@@ -82,7 +34,6 @@ * We have to conditionally wrap our checkbox in a formfield

*/
var _a = this.props, className = _a.className, style = _a.style, rootProps = _a.rootProps, label = _a.label, children = _a.children;
if (this.hasLabel) {
if (hasLabel) {
return (React.createElement(formfield_1.FormField, __assign({}, rootProps, { className: className, style: style }),
toggle,
React.createElement("label", { id: this.id + 'label', htmlFor: this.id },
React.createElement("label", { id: id + 'label', htmlFor: id },
label,

@@ -95,4 +46,13 @@ children)));

};
return ToggleableFoundationComponent;
}(base_1.FoundationComponent));
exports.ToggleableFoundationComponent = ToggleableFoundationComponent;
var toggleRootProps = hasLabel
? { disabled: disabled }
: __assign({ className: className,
style: style,
disabled: disabled }, rootProps);
return {
id: id,
renderToggle: renderToggle,
toggleRootProps: toggleRootProps
};
}
exports.useToggleFoundation = useToggleFoundation;
{
"npm": {},
"typescript": {
"ToggleableFoundationComponent": {
"fileName": "src/toggleable/index.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "class",
"name": "ToggleableFoundationComponent",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L25",
"extends": [
"FoundationComponent<Foundation, P & FoundationProps, S>"
],
"methods": [
{
"fileName": "node_modules/@types/react/index.d.ts",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": true,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "UNSAFE_componentWillMount",
"inheritedFrom": "DeprecatedLifecycle.UNSAFE_componentWillMount",
"signatures": [
{
"documentation": {
"contents": [
"<p>Called immediately before mounting occurs, and before <code>Component#render</code>.\nAvoid introducing any side-effects or subscriptions in this method.</p>\n<p>This method will not stop working in React 17.</p>\n<p>Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.</p>\n",
{
"tag": "see",
"value": "https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state"
},
{
"tag": "see",
"value": "https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path"
}
],
"contentsRaw": "Called immediately before mounting occurs, and before `Component#render`.\nAvoid introducing any side-effects or subscriptions in this method.\n\nThis method will not stop working in React 17.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n\n\n@see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state\n@see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path",
"metadata": {}
},
"fileName": "node_modules/@types/react/index.d.ts",
"kind": "signature",
"name": "UNSAFE_componentWillMount",
"parameters": [],
"returnType": "void",
"type": "() => void"
}
]
},
{
"fileName": "node_modules/@types/react/index.d.ts",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": true,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "UNSAFE_componentWillReceiveProps",
"inheritedFrom": "DeprecatedLifecycle.UNSAFE_componentWillReceiveProps",
"signatures": [
{
"documentation": {
"contents": [
"<p>Called when the component may be receiving new props.\nReact may call this even if props have not changed, so be sure to compare new and existing\nprops if you only want to handle changes.</p>\n<p>Calling <code>Component#setState</code> generally does not trigger this method.</p>\n<p>This method will not stop working in React 17.</p>\n<p>Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.</p>\n",
{
"tag": "see",
"value": "https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props"
},
{
"tag": "see",
"value": "https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path"
}
],
"contentsRaw": "Called when the component may be receiving new props.\nReact may call this even if props have not changed, so be sure to compare new and existing\nprops if you only want to handle changes.\n\nCalling `Component#setState` generally does not trigger this method.\n\nThis method will not stop working in React 17.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n\n\n@see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props\n@see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path",
"metadata": {}
},
"fileName": "node_modules/@types/react/index.d.ts",
"kind": "signature",
"name": "UNSAFE_componentWillReceiveProps",
"parameters": [
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "nextProps",
"type": "Readonly<FoundationPropsT<P & FoundationProps>>"
},
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "nextContext",
"type": "any"
}
],
"returnType": "void",
"type": "(nextProps: Readonly<FoundationPropsT<P & FoundationProps>>, nextContext: any) => void"
}
]
},
{
"fileName": "node_modules/@types/react/index.d.ts",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": true,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "UNSAFE_componentWillUpdate",
"inheritedFrom": "DeprecatedLifecycle.UNSAFE_componentWillUpdate",
"signatures": [
{
"documentation": {
"contents": [
"<p>Called immediately before rendering when new props or state is received. Not called for the initial render.</p>\n<p>Note: You cannot call <code>Component#setState</code> here.</p>\n<p>This method will not stop working in React 17.</p>\n<p>Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.</p>\n",
{
"tag": "see",
"value": "https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update"
},
{
"tag": "see",
"value": "https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path"
}
],
"contentsRaw": "Called immediately before rendering when new props or state is received. Not called for the initial render.\n\nNote: You cannot call `Component#setState` here.\n\nThis method will not stop working in React 17.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n\n\n@see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update\n@see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path",
"metadata": {}
},
"fileName": "node_modules/@types/react/index.d.ts",
"kind": "signature",
"name": "UNSAFE_componentWillUpdate",
"parameters": [
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "nextProps",
"type": "Readonly<FoundationPropsT<P & FoundationProps>>"
},
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "nextState",
"type": "Readonly<FoundationStateT<S>>"
},
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "nextContext",
"type": "any"
}
],
"returnType": "void",
"type": "(nextProps: Readonly<FoundationPropsT<P & FoundationProps>>, nextState: Readonly<FoundationStateT<S>>, nextContext: any) => void"
}
]
},
{
"fileName": "node_modules/@types/react/index.d.ts",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": true,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "componentDidCatch",
"inheritedFrom": "ComponentLifecycle.componentDidCatch",
"signatures": [
{
"documentation": {
"contents": [
"<p>Catches exceptions generated in descendant components. Unhandled exceptions will cause\nthe entire component tree to unmount.</p>\n"
],
"contentsRaw": "Catches exceptions generated in descendant components. Unhandled exceptions will cause\nthe entire component tree to unmount.",
"metadata": {}
},
"fileName": "node_modules/@types/react/index.d.ts",
"kind": "signature",
"name": "componentDidCatch",
"parameters": [
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "error",
"type": "Error"
},
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "errorInfo",
"type": "ErrorInfo"
}
],
"returnType": "void",
"type": "(error: Error, errorInfo: ErrorInfo) => void"
}
]
},
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "componentDidMount",
"inheritedFrom": "FoundationComponent.componentDidMount",
"signatures": [
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"kind": "signature",
"name": "componentDidMount",
"parameters": [],
"returnType": "void",
"type": "() => void"
}
]
},
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "componentDidUpdate",
"inheritedFrom": "FoundationComponent.componentDidUpdate",
"signatures": [
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"kind": "signature",
"name": "componentDidUpdate",
"parameters": [
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "prevProps",
"type": "FoundationPropsT<P & FoundationProps>"
}
],
"returnType": "void",
"type": "(prevProps: FoundationPropsT<P & FoundationProps>) => void"
}
]
},
{
"fileName": "node_modules/@types/react/index.d.ts",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": true,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "componentWillMount",
"inheritedFrom": "DeprecatedLifecycle.componentWillMount",
"signatures": [
{
"documentation": {
"contents": [
"<p>Called immediately before mounting occurs, and before <code>Component#render</code>.\nAvoid introducing any side-effects or subscriptions in this method.</p>\n<p>Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.</p>\n",
{
"tag": "see",
"value": "https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state"
},
{
"tag": "see",
"value": "https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path"
}
],
"contentsRaw": "Called immediately before mounting occurs, and before `Component#render`.\nAvoid introducing any side-effects or subscriptions in this method.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n\n\n@see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state\n@see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path",
"metadata": {}
},
"fileName": "node_modules/@types/react/index.d.ts",
"kind": "signature",
"name": "componentWillMount",
"parameters": [],
"returnType": "void",
"type": "() => void"
}
]
},
{
"fileName": "node_modules/@types/react/index.d.ts",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": true,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "componentWillReceiveProps",
"inheritedFrom": "DeprecatedLifecycle.componentWillReceiveProps",
"signatures": [
{
"documentation": {
"contents": [
"<p>Called when the component may be receiving new props.\nReact may call this even if props have not changed, so be sure to compare new and existing\nprops if you only want to handle changes.</p>\n<p>Calling <code>Component#setState</code> generally does not trigger this method.</p>\n<p>Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.</p>\n",
{
"tag": "see",
"value": "https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props"
},
{
"tag": "see",
"value": "https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path"
}
],
"contentsRaw": "Called when the component may be receiving new props.\nReact may call this even if props have not changed, so be sure to compare new and existing\nprops if you only want to handle changes.\n\nCalling `Component#setState` generally does not trigger this method.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n\n\n@see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props\n@see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path",
"metadata": {}
},
"fileName": "node_modules/@types/react/index.d.ts",
"kind": "signature",
"name": "componentWillReceiveProps",
"parameters": [
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "nextProps",
"type": "Readonly<FoundationPropsT<P & FoundationProps>>"
},
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "nextContext",
"type": "any"
}
],
"returnType": "void",
"type": "(nextProps: Readonly<FoundationPropsT<P & FoundationProps>>, nextContext: any) => void"
}
]
},
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "componentWillUnmount",
"inheritedFrom": "FoundationComponent.componentWillUnmount",
"signatures": [
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"kind": "signature",
"name": "componentWillUnmount",
"parameters": [],
"returnType": "void",
"type": "() => void"
}
]
},
{
"fileName": "node_modules/@types/react/index.d.ts",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": true,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "componentWillUpdate",
"inheritedFrom": "DeprecatedLifecycle.componentWillUpdate",
"signatures": [
{
"documentation": {
"contents": [
"<p>Called immediately before rendering when new props or state is received. Not called for the initial render.</p>\n<p>Note: You cannot call <code>Component#setState</code> here.</p>\n<p>Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.</p>\n",
{
"tag": "see",
"value": "https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update"
},
{
"tag": "see",
"value": "https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path"
}
],
"contentsRaw": "Called immediately before rendering when new props or state is received. Not called for the initial render.\n\nNote: You cannot call `Component#setState` here.\n\nNote: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps\nprevents this from being invoked.\n\n\n@see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update\n@see https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path",
"metadata": {}
},
"fileName": "node_modules/@types/react/index.d.ts",
"kind": "signature",
"name": "componentWillUpdate",
"parameters": [
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "nextProps",
"type": "Readonly<FoundationPropsT<P & FoundationProps>>"
},
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "nextState",
"type": "Readonly<FoundationStateT<S>>"
},
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "nextContext",
"type": "any"
}
],
"returnType": "void",
"type": "(nextProps: Readonly<FoundationPropsT<P & FoundationProps>>, nextState: Readonly<FoundationStateT<S>>, nextContext: any) => void"
}
]
},
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "createElement",
"inheritedFrom": "FoundationComponent.createElement",
"signatures": [
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"kind": "signature",
"name": "createElement",
"parameters": [
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "elementName",
"type": "string"
}
],
"returnType": "FoundationElement<ExtractProps<ElementType>, ElementType>",
"type": "(elementName: string) => FoundationElement<ExtractProps<ElementType>, ElementType>"
}
]
},
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "emit",
"inheritedFrom": "FoundationComponent.emit",
"signatures": [
{
"documentation": {
"contents": [
"<p>Fires a cross-browser-compatible custom event from the component root of the given type,</p>\n"
],
"contentsRaw": "Fires a cross-browser-compatible custom event from the component root of the given type,",
"metadata": {}
},
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"kind": "signature",
"name": "emit",
"parameters": [
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "evtType",
"type": "string"
},
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "evtData",
"type": "any"
},
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "shouldBubble",
"defaultValue": "false",
"type": "boolean"
}
],
"returnType": "CustomEvent<any>",
"type": "(evtType: string, evtData: any, shouldBubble?: boolean) => CustomEvent<any>"
}
]
},
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "getDefaultFoundation",
"inheritedFrom": "FoundationComponent.getDefaultFoundation",
"signatures": [
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"kind": "signature",
"name": "getDefaultFoundation",
"parameters": [],
"returnType": "Foundation",
"type": "() => Foundation"
}
]
},
{
"fileName": "node_modules/@types/react/index.d.ts",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": true,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "getSnapshotBeforeUpdate",
"inheritedFrom": "NewLifecycle.getSnapshotBeforeUpdate",
"signatures": [
{
"documentation": {
"contents": [
"<p>Runs before React applies the result of <code>render</code> to the document, and\nreturns an object to be given to componentDidUpdate. Useful for saving\nthings such as scroll position before <code>render</code> causes changes to it.</p>\n<p>Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated\nlifecycle events from running.</p>\n"
],
"contentsRaw": "Runs before React applies the result of `render` to the document, and\nreturns an object to be given to componentDidUpdate. Useful for saving\nthings such as scroll position before `render` causes changes to it.\n\nNote: the presence of getSnapshotBeforeUpdate prevents any of the deprecated\nlifecycle events from running.",
"metadata": {}
},
"fileName": "node_modules/@types/react/index.d.ts",
"kind": "signature",
"name": "getSnapshotBeforeUpdate",
"parameters": [
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "prevProps",
"type": "Readonly<FoundationPropsT<P & FoundationProps>>"
},
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "prevState",
"type": "Readonly<FoundationStateT<S>>"
}
],
"returnType": "SS | null",
"type": "(prevProps: Readonly<FoundationPropsT<P & FoundationProps>>, prevState: Readonly<FoundationStateT<S>>) => SS | null"
}
]
},
{
"fileName": "src/toggleable/index.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "renderToggle",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L61",
"signatures": [
{
"fileName": "src/toggleable/index.tsx",
"kind": "signature",
"name": "renderToggle",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L61",
"parameters": [
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "toggle",
"type": "React.ReactNode"
}
],
"returnType": "undefined | null | {}",
"type": "(toggle: React.ReactNode) => undefined | null | {}"
}
]
},
{
"fileName": "node_modules/@types/react/index.d.ts",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": true,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "shouldComponentUpdate",
"inheritedFrom": "ComponentLifecycle.shouldComponentUpdate",
"signatures": [
{
"documentation": {
"contents": [
"<p>Called to determine whether the change in props and state should trigger a re-render.</p>\n<p><code>Component</code> always returns true.\n<code>PureComponent</code> implements a shallow comparison on props and state and returns true if any\nprops or states have changed.</p>\n<p>If false is returned, <code>Component#render</code>, <code>componentWillUpdate</code>\nand <code>componentDidUpdate</code> will not be called.</p>\n"
],
"contentsRaw": "Called to determine whether the change in props and state should trigger a re-render.\n\n`Component` always returns true.\n`PureComponent` implements a shallow comparison on props and state and returns true if any\nprops or states have changed.\n\nIf false is returned, `Component#render`, `componentWillUpdate`\nand `componentDidUpdate` will not be called.",
"metadata": {}
},
"fileName": "node_modules/@types/react/index.d.ts",
"kind": "signature",
"name": "shouldComponentUpdate",
"parameters": [
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "nextProps",
"type": "Readonly<FoundationPropsT<P & FoundationProps>>"
},
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "nextState",
"type": "Readonly<FoundationStateT<S>>"
},
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "nextContext",
"type": "any"
}
],
"returnType": "boolean",
"type": "(nextProps: Readonly<FoundationPropsT<P & FoundationProps>>, nextState: Readonly<FoundationStateT<S>>, nextContext: any) => boolean"
}
]
},
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "sync",
"inheritedFrom": "FoundationComponent.sync",
"signatures": [
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"kind": "signature",
"name": "sync",
"parameters": [
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "props",
"type": "any"
},
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": true,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "prevProps",
"type": "any"
}
],
"returnType": "void",
"type": "(props: any, prevProps?: any) => void"
}
]
},
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "syncProp",
"inheritedFrom": "FoundationComponent.syncProp",
"signatures": [
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"kind": "signature",
"name": "syncProp",
"parameters": [
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "prop",
"type": "any"
},
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "prevProp",
"type": "any"
},
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "callback",
"type": "() => void"
}
],
"returnType": "void",
"type": "(prop: any, prevProp: any, callback: () => void) => void"
}
]
},
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "method",
"name": "update",
"inheritedFrom": "FoundationComponent.update",
"signatures": [
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"kind": "signature",
"name": "update",
"parameters": [],
"returnType": "void",
"type": "() => void"
}
]
}
],
"properties": [
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": true
},
"kind": "property",
"name": "shouldDebounce",
"defaultValue": "false",
"inheritedFrom": "FoundationComponent.shouldDebounce",
"type": "boolean"
},
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "property",
"name": "elements",
"inheritedFrom": "FoundationComponent.elements",
"type": "{ [key: string]: FoundationElement<any, any> }"
},
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "property",
"name": "foundation",
"inheritedFrom": "FoundationComponent.foundation",
"type": "Foundation"
},
{
"fileName": "src/toggleable/index.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "property",
"name": "generatedId",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L31",
"defaultValue": " randomId(this.constructor.displayName)",
"type": "string"
}
],
"constructorType": {
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"flags": {
"isExported": true,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "constructor",
"name": "constructor",
"inheritedFrom": "FoundationComponent.__constructor",
"signatures": [
{
"fileName": "src/toggleable/node_modules/@rmwc/base/foundation-component.tsx",
"kind": "signature",
"name": "new ToggleableFoundationComponent",
"parameters": [
{
"flags": {
"isExported": false,
"isExternal": false,
"isOptional": false,
"isPrivate": false,
"isProtected": false,
"isPublic": false,
"isRest": false,
"isStatic": false
},
"kind": "parameter",
"name": "props",
"type": "any"
}
],
"returnType": "ToggleableFoundationComponent",
"type": "(props: any) => ToggleableFoundationComponent"
}
]
}
},
"ToggleableFoundationProps": {

@@ -1200,3 +18,3 @@ "fileName": "src/toggleable/index.tsx",

"name": "ToggleableFoundationProps",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L6",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L5",
"methods": [],

@@ -1225,3 +43,3 @@ "properties": [

"name": "checked",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L12",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L11",
"type": "undefined | false | true"

@@ -1250,3 +68,3 @@ },

"name": "disabled",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L10",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L9",
"type": "undefined | false | true"

@@ -1275,3 +93,3 @@ },

"name": "id",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L8",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L7",
"type": "undefined | string"

@@ -1300,4 +118,4 @@ },

"name": "inputRef",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L20",
"type": "MutableRefObject<HTMLInputElement | null> | (ref: HTMLInputElement | null) => void"
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L19",
"type": "React.Ref<HTMLInputElement>"
},

@@ -1325,3 +143,3 @@ {

"name": "label",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L16",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L15",
"type": "React.ReactNode"

@@ -1350,3 +168,3 @@ },

"name": "rootProps",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L18",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L17",
"type": "React.HTMLProps<any>"

@@ -1375,3 +193,3 @@ },

"name": "value",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L14",
"sourceUrl": "https://github.com/jamesmfriedman/rmwc/blob/master/src/toggleable/index.tsx#L13",
"type": "string | number | string[]"

@@ -1378,0 +196,0 @@ }

import * as React from 'react';
import { FoundationComponent, FoundationProps } from '@rmwc/base';
export interface ToggleableFoundationProps {

@@ -17,7 +16,373 @@ /** A DOM ID for the toggle. */

/** A reference to the native input. */
inputRef?: React.MutableRefObject<HTMLInputElement | null> | ((ref: HTMLInputElement | null) => void);
inputRef?: React.Ref<HTMLInputElement>;
}
export declare class ToggleableFoundationComponent<Foundation extends any, P extends ToggleableFoundationProps, S extends any = {}> extends FoundationComponent<Foundation, P & FoundationProps, S> {
generatedId: string;
renderToggle(toggle: React.ReactNode): {} | null | undefined;
}
export declare function useToggleFoundation(props: ToggleableFoundationProps & React.HTMLProps<any>): {
id: string;
renderToggle: (toggle: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) => JSX.Element;
toggleRootProps: {
disabled: boolean | undefined;
} | {
accept?: string | undefined;
acceptCharset?: string | undefined;
action?: string | undefined;
allowFullScreen?: boolean | undefined;
allowTransparency?: boolean | undefined;
alt?: string | undefined;
as?: string | undefined;
async?: boolean | undefined;
autoComplete?: string | undefined;
autoFocus?: boolean | undefined;
autoPlay?: boolean | undefined;
capture?: string | boolean | undefined;
cellPadding?: string | number | undefined;
cellSpacing?: string | number | undefined;
charSet?: string | undefined;
challenge?: string | undefined;
checked?: boolean | undefined;
cite?: string | undefined;
classID?: string | undefined;
cols?: number | undefined;
colSpan?: number | undefined;
content?: string | undefined;
controls?: boolean | undefined;
coords?: string | undefined;
crossOrigin?: string | undefined;
data?: string | undefined;
dateTime?: string | undefined;
default?: boolean | undefined;
defer?: boolean | undefined;
disabled: boolean | undefined;
download?: any;
encType?: string | undefined;
form?: string | undefined;
formAction?: string | undefined;
formEncType?: string | undefined;
formMethod?: string | undefined;
formNoValidate?: boolean | undefined;
formTarget?: string | undefined;
frameBorder?: string | number | undefined;
headers?: string | undefined;
height?: string | number | undefined;
high?: number | undefined;
href?: string | undefined;
hrefLang?: string | undefined;
htmlFor?: string | undefined;
httpEquiv?: string | undefined;
integrity?: string | undefined;
keyParams?: string | undefined;
keyType?: string | undefined;
kind?: string | undefined;
label?: string | undefined;
list?: string | undefined;
loop?: boolean | undefined;
low?: number | undefined;
manifest?: string | undefined;
marginHeight?: number | undefined;
marginWidth?: number | undefined;
max?: string | number | undefined;
maxLength?: number | undefined;
media?: string | undefined;
mediaGroup?: string | undefined;
method?: string | undefined;
min?: string | number | undefined;
minLength?: number | undefined;
multiple?: boolean | undefined;
muted?: boolean | undefined;
name?: string | undefined;
nonce?: string | undefined;
noValidate?: boolean | undefined;
open?: boolean | undefined;
optimum?: number | undefined;
pattern?: string | undefined;
placeholder?: string | undefined;
playsInline?: boolean | undefined;
poster?: string | undefined;
preload?: string | undefined;
readOnly?: boolean | undefined;
rel?: string | undefined;
required?: boolean | undefined;
reversed?: boolean | undefined;
rows?: number | undefined;
rowSpan?: number | undefined;
sandbox?: string | undefined;
scope?: string | undefined;
scoped?: boolean | undefined;
scrolling?: string | undefined;
seamless?: boolean | undefined;
selected?: boolean | undefined;
shape?: string | undefined;
size?: number | undefined;
sizes?: string | undefined;
span?: number | undefined;
src?: string | undefined;
srcDoc?: string | undefined;
srcLang?: string | undefined;
srcSet?: string | undefined;
start?: number | undefined;
step?: string | number | undefined;
summary?: string | undefined;
target?: string | undefined;
type?: string | undefined;
useMap?: string | undefined;
value?: string | number | string[] | undefined;
width?: string | number | undefined;
wmode?: string | undefined;
wrap?: string | undefined;
defaultChecked?: boolean | undefined;
defaultValue?: string | number | string[] | undefined;
suppressContentEditableWarning?: boolean | undefined;
suppressHydrationWarning?: boolean | undefined;
accessKey?: string | undefined;
className: string | undefined;
contentEditable?: boolean | undefined;
contextMenu?: string | undefined;
dir?: string | undefined;
draggable?: boolean | undefined;
hidden?: boolean | undefined;
id?: string | undefined;
lang?: string | undefined;
slot?: string | undefined;
spellCheck?: boolean | undefined;
style: React.CSSProperties | undefined;
tabIndex?: number | undefined;
title?: string | undefined;
radioGroup?: string | undefined;
role?: string | undefined;
about?: string | undefined;
datatype?: string | undefined;
inlist?: any;
prefix?: string | undefined;
property?: string | undefined;
resource?: string | undefined;
typeof?: string | undefined;
vocab?: string | undefined;
autoCapitalize?: string | undefined;
autoCorrect?: string | undefined;
autoSave?: string | undefined;
color?: string | undefined;
itemProp?: string | undefined;
itemScope?: boolean | undefined;
itemType?: string | undefined;
itemID?: string | undefined;
itemRef?: string | undefined;
results?: number | undefined;
security?: string | undefined;
unselectable?: "on" | "off" | undefined;
inputMode?: "url" | "text" | "search" | "none" | "tel" | "email" | "numeric" | "decimal" | undefined;
is?: string | undefined;
'aria-activedescendant'?: string | undefined;
'aria-atomic'?: boolean | "false" | "true" | undefined;
'aria-autocomplete'?: "list" | "none" | "inline" | "both" | undefined;
'aria-busy'?: boolean | "false" | "true" | undefined;
'aria-checked'?: boolean | "false" | "true" | "mixed" | undefined;
'aria-colcount'?: number | undefined;
'aria-colindex'?: number | undefined;
'aria-colspan'?: number | undefined;
'aria-controls'?: string | undefined;
'aria-current'?: boolean | "time" | "step" | "false" | "true" | "page" | "location" | "date" | undefined;
'aria-describedby'?: string | undefined;
'aria-details'?: string | undefined;
'aria-disabled'?: boolean | "false" | "true" | undefined;
'aria-dropeffect'?: "link" | "none" | "copy" | "execute" | "move" | "popup" | undefined;
'aria-errormessage'?: string | undefined;
'aria-expanded'?: boolean | "false" | "true" | undefined;
'aria-flowto'?: string | undefined;
'aria-grabbed'?: boolean | "false" | "true" | undefined;
'aria-haspopup'?: boolean | "dialog" | "menu" | "false" | "true" | "listbox" | "tree" | "grid" | undefined;
'aria-hidden'?: boolean | "false" | "true" | undefined;
'aria-invalid'?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
'aria-keyshortcuts'?: string | undefined;
'aria-label'?: string | undefined;
'aria-labelledby'?: string | undefined;
'aria-level'?: number | undefined;
'aria-live'?: "off" | "assertive" | "polite" | undefined;
'aria-modal'?: boolean | "false" | "true" | undefined;
'aria-multiline'?: boolean | "false" | "true" | undefined;
'aria-multiselectable'?: boolean | "false" | "true" | undefined;
'aria-orientation'?: "horizontal" | "vertical" | undefined;
'aria-owns'?: string | undefined;
'aria-placeholder'?: string | undefined;
'aria-posinset'?: number | undefined;
'aria-pressed'?: boolean | "false" | "true" | "mixed" | undefined;
'aria-readonly'?: boolean | "false" | "true" | undefined;
'aria-relevant'?: "text" | "additions" | "additions text" | "all" | "removals" | undefined;
'aria-required'?: boolean | "false" | "true" | undefined;
'aria-roledescription'?: string | undefined;
'aria-rowcount'?: number | undefined;
'aria-rowindex'?: number | undefined;
'aria-rowspan'?: number | undefined;
'aria-selected'?: boolean | "false" | "true" | undefined;
'aria-setsize'?: number | undefined;
'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
'aria-valuemax'?: number | undefined;
'aria-valuemin'?: number | undefined;
'aria-valuenow'?: number | undefined;
'aria-valuetext'?: string | undefined;
children?: React.ReactNode;
dangerouslySetInnerHTML?: {
__html: string;
} | undefined;
onCopy?: ((event: React.ClipboardEvent<any>) => void) | undefined;
onCopyCapture?: ((event: React.ClipboardEvent<any>) => void) | undefined;
onCut?: ((event: React.ClipboardEvent<any>) => void) | undefined;
onCutCapture?: ((event: React.ClipboardEvent<any>) => void) | undefined;
onPaste?: ((event: React.ClipboardEvent<any>) => void) | undefined;
onPasteCapture?: ((event: React.ClipboardEvent<any>) => void) | undefined;
onCompositionEnd?: ((event: React.CompositionEvent<any>) => void) | undefined;
onCompositionEndCapture?: ((event: React.CompositionEvent<any>) => void) | undefined;
onCompositionStart?: ((event: React.CompositionEvent<any>) => void) | undefined;
onCompositionStartCapture?: ((event: React.CompositionEvent<any>) => void) | undefined;
onCompositionUpdate?: ((event: React.CompositionEvent<any>) => void) | undefined;
onCompositionUpdateCapture?: ((event: React.CompositionEvent<any>) => void) | undefined;
onFocus?: ((event: React.FocusEvent<any>) => void) | undefined;
onFocusCapture?: ((event: React.FocusEvent<any>) => void) | undefined;
onBlur?: ((event: React.FocusEvent<any>) => void) | undefined;
onBlurCapture?: ((event: React.FocusEvent<any>) => void) | undefined;
onChange?: ((event: React.FormEvent<any>) => void) | undefined;
onChangeCapture?: ((event: React.FormEvent<any>) => void) | undefined;
onBeforeInput?: ((event: React.FormEvent<any>) => void) | undefined;
onBeforeInputCapture?: ((event: React.FormEvent<any>) => void) | undefined;
onInput?: ((event: React.FormEvent<any>) => void) | undefined;
onInputCapture?: ((event: React.FormEvent<any>) => void) | undefined;
onReset?: ((event: React.FormEvent<any>) => void) | undefined;
onResetCapture?: ((event: React.FormEvent<any>) => void) | undefined;
onSubmit?: ((event: React.FormEvent<any>) => void) | undefined;
onSubmitCapture?: ((event: React.FormEvent<any>) => void) | undefined;
onInvalid?: ((event: React.FormEvent<any>) => void) | undefined;
onInvalidCapture?: ((event: React.FormEvent<any>) => void) | undefined;
onLoad?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onLoadCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onError?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onErrorCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onKeyDown?: ((event: React.KeyboardEvent<any>) => void) | undefined;
onKeyDownCapture?: ((event: React.KeyboardEvent<any>) => void) | undefined;
onKeyPress?: ((event: React.KeyboardEvent<any>) => void) | undefined;
onKeyPressCapture?: ((event: React.KeyboardEvent<any>) => void) | undefined;
onKeyUp?: ((event: React.KeyboardEvent<any>) => void) | undefined;
onKeyUpCapture?: ((event: React.KeyboardEvent<any>) => void) | undefined;
onAbort?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onAbortCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onCanPlay?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onCanPlayCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onCanPlayThrough?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onCanPlayThroughCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onDurationChange?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onDurationChangeCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onEmptied?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onEmptiedCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onEncrypted?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onEncryptedCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onEnded?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onEndedCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onLoadedData?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onLoadedDataCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onLoadedMetadata?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onLoadedMetadataCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onLoadStart?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onLoadStartCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onPause?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onPauseCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onPlay?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onPlayCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onPlaying?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onPlayingCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onProgress?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onProgressCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onRateChange?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onRateChangeCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onSeeked?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onSeekedCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onSeeking?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onSeekingCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onStalled?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onStalledCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onSuspend?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onSuspendCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onTimeUpdate?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onTimeUpdateCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onVolumeChange?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onVolumeChangeCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onWaiting?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onWaitingCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onAuxClick?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onAuxClickCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onClick?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onClickCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onContextMenu?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onContextMenuCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onDoubleClick?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onDoubleClickCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onDrag?: ((event: React.DragEvent<any>) => void) | undefined;
onDragCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onDragEnd?: ((event: React.DragEvent<any>) => void) | undefined;
onDragEndCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onDragEnter?: ((event: React.DragEvent<any>) => void) | undefined;
onDragEnterCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onDragExit?: ((event: React.DragEvent<any>) => void) | undefined;
onDragExitCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onDragLeave?: ((event: React.DragEvent<any>) => void) | undefined;
onDragLeaveCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onDragOver?: ((event: React.DragEvent<any>) => void) | undefined;
onDragOverCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onDragStart?: ((event: React.DragEvent<any>) => void) | undefined;
onDragStartCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onDrop?: ((event: React.DragEvent<any>) => void) | undefined;
onDropCapture?: ((event: React.DragEvent<any>) => void) | undefined;
onMouseDown?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseDownCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseEnter?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseLeave?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseMove?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseMoveCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseOut?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseOutCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseOver?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseOverCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseUp?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onMouseUpCapture?: ((event: React.MouseEvent<any, MouseEvent>) => void) | undefined;
onSelect?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onSelectCapture?: ((event: React.SyntheticEvent<any, Event>) => void) | undefined;
onTouchCancel?: ((event: React.TouchEvent<any>) => void) | undefined;
onTouchCancelCapture?: ((event: React.TouchEvent<any>) => void) | undefined;
onTouchEnd?: ((event: React.TouchEvent<any>) => void) | undefined;
onTouchEndCapture?: ((event: React.TouchEvent<any>) => void) | undefined;
onTouchMove?: ((event: React.TouchEvent<any>) => void) | undefined;
onTouchMoveCapture?: ((event: React.TouchEvent<any>) => void) | undefined;
onTouchStart?: ((event: React.TouchEvent<any>) => void) | undefined;
onTouchStartCapture?: ((event: React.TouchEvent<any>) => void) | undefined;
onPointerDown?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerDownCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerMove?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerMoveCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerUp?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerUpCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerCancel?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerCancelCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerEnter?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerEnterCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerLeave?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerLeaveCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerOver?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerOverCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerOut?: ((event: React.PointerEvent<any>) => void) | undefined;
onPointerOutCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onGotPointerCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onGotPointerCaptureCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onLostPointerCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onLostPointerCaptureCapture?: ((event: React.PointerEvent<any>) => void) | undefined;
onScroll?: ((event: React.UIEvent<any>) => void) | undefined;
onScrollCapture?: ((event: React.UIEvent<any>) => void) | undefined;
onWheel?: ((event: React.WheelEvent<any>) => void) | undefined;
onWheelCapture?: ((event: React.WheelEvent<any>) => void) | undefined;
onAnimationStart?: ((event: React.AnimationEvent<any>) => void) | undefined;
onAnimationStartCapture?: ((event: React.AnimationEvent<any>) => void) | undefined;
onAnimationEnd?: ((event: React.AnimationEvent<any>) => void) | undefined;
onAnimationEndCapture?: ((event: React.AnimationEvent<any>) => void) | undefined;
onAnimationIteration?: ((event: React.AnimationEvent<any>) => void) | undefined;
onAnimationIterationCapture?: ((event: React.AnimationEvent<any>) => void) | undefined;
onTransitionEnd?: ((event: React.TransitionEvent<any>) => void) | undefined;
onTransitionEndCapture?: ((event: React.TransitionEvent<any>) => void) | undefined;
ref?: string | ((instance: any) => void) | React.RefObject<any> | null | undefined;
key?: string | number | undefined;
};
};

@@ -1,14 +0,1 @@

var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {

@@ -26,44 +13,9 @@ __assign = Object.assign || function(t) {

import * as React from 'react';
import { FoundationComponent, randomId } from '@rmwc/base';
import { useId } from '@rmwc/base';
import { FormField } from '@rmwc/formfield';
var ToggleableFoundationComponent = /** @class */ (function (_super) {
__extends(ToggleableFoundationComponent, _super);
function ToggleableFoundationComponent() {
var _this = _super !== null && _super.apply(this, arguments) || this;
// @ts-ignore
_this.generatedId = randomId(_this.constructor.displayName);
return _this;
}
Object.defineProperty(ToggleableFoundationComponent.prototype, "hasLabel", {
/** @internal */
get: function () {
return this.props.label || this.props.children;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ToggleableFoundationComponent.prototype, "id", {
/** @internal */
get: function () {
return this.props.id || this.generatedId;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ToggleableFoundationComponent.prototype, "toggleRootProps", {
/** @internal */
get: function () {
var _a = this.props, className = _a.className, style = _a.style, disabled = _a.disabled, _b = _a.rootProps, rootProps = _b === void 0 ? {} : _b;
if (this.hasLabel) {
// @ts-ignore
return this.root.props({ disabled: disabled });
}
return __assign({}, this.root.props(__assign({ className: className,
style: style,
disabled: disabled }, rootProps)));
},
enumerable: true,
configurable: true
});
ToggleableFoundationComponent.prototype.renderToggle = function (toggle) {
export function useToggleFoundation(props) {
var className = props.className, style = props.style, rootProps = props.rootProps, label = props.label, children = props.children, disabled = props.disabled;
var hasLabel = props.label || props.children;
var id = useId('toggle-', props);
var renderToggle = function (toggle) {
/**

@@ -73,7 +25,6 @@ * We have to conditionally wrap our checkbox in a formfield

*/
var _a = this.props, className = _a.className, style = _a.style, rootProps = _a.rootProps, label = _a.label, children = _a.children;
if (this.hasLabel) {
if (hasLabel) {
return (React.createElement(FormField, __assign({}, rootProps, { className: className, style: style }),
toggle,
React.createElement("label", { id: this.id + 'label', htmlFor: this.id },
React.createElement("label", { id: id + 'label', htmlFor: id },
label,

@@ -86,4 +37,12 @@ children)));

};
return ToggleableFoundationComponent;
}(FoundationComponent));
export { ToggleableFoundationComponent };
var toggleRootProps = hasLabel
? { disabled: disabled }
: __assign({ className: className,
style: style,
disabled: disabled }, rootProps);
return {
id: id,
renderToggle: renderToggle,
toggleRootProps: toggleRootProps
};
}
{
"name": "@rmwc/toggleable",
"version": "5.7.0",
"version": "6.0.0-alpha.1",
"description": "RMWC toggle module",

@@ -35,7 +35,7 @@ "main": "dist/index.js",

"dependencies": {
"@rmwc/base": "^5.7.0",
"@rmwc/formfield": "^5.7.0",
"@rmwc/types": "^5.6.0"
"@rmwc/base": "^6.0.0-alpha.1",
"@rmwc/formfield": "^6.0.0-alpha.1",
"@rmwc/types": "^6.0.0-alpha.0"
},
"gitHead": "cac77905430cfdcd487effe81a9b1d505a2525ef"
"gitHead": "ec5048e83770d083a1212c2778a59026bb377d58"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc