kopia lustrzana https://github.com/shoelace-style/shoelace
Move bindings from constructor to connectedCallback
rodzic
206ecccce5
commit
ce30c35663
|
|
@ -21,11 +21,6 @@ import { focusVisible } from '../../utilities/focus-visible';
|
|||
shadow: true
|
||||
})
|
||||
export class Tab {
|
||||
constructor() {
|
||||
this.handleCloseClick = this.handleCloseClick.bind(this);
|
||||
this.handleTransitionEnd = this.handleTransitionEnd.bind(this);
|
||||
}
|
||||
|
||||
alert: HTMLElement;
|
||||
|
||||
@Element() host: HTMLSlAlertElement;
|
||||
|
|
@ -56,6 +51,11 @@ export class Tab {
|
|||
/** Emitted after the alert closes and all transitions are complete. */
|
||||
@Event() slAfterHide: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.handleCloseClick = this.handleCloseClick.bind(this);
|
||||
this.handleTransitionEnd = this.handleTransitionEnd.bind(this);
|
||||
}
|
||||
|
||||
componentDidLoad() {
|
||||
focusVisible.observe(this.alert);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@ import { Component, Prop, State, h } from '@stencil/core';
|
|||
shadow: true
|
||||
})
|
||||
export class Avatar {
|
||||
constructor() {
|
||||
this.handleImageError = this.handleImageError.bind(this);
|
||||
}
|
||||
|
||||
@State() hasError = false;
|
||||
|
||||
/** The image source to use for the avatar. */
|
||||
|
|
@ -36,6 +32,10 @@ export class Avatar {
|
|||
/** Initials to use as a fallback when no image is available (1-2 characters max recommended). */
|
||||
@Prop() shape: 'circle' | 'square' | 'rounded' = 'circle';
|
||||
|
||||
connectedCallback() {
|
||||
this.handleImageError = this.handleImageError.bind(this);
|
||||
}
|
||||
|
||||
handleImageError() {
|
||||
this.hasError = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,12 +21,6 @@ import { Component, Event, EventEmitter, Method, Prop, State, h } from '@stencil
|
|||
shadow: true
|
||||
})
|
||||
export class Button {
|
||||
constructor() {
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
}
|
||||
|
||||
button: HTMLButtonElement;
|
||||
|
||||
@State() hasFocus = false;
|
||||
|
|
@ -67,6 +61,12 @@ export class Button {
|
|||
/** Emitted when the button gains focus. */
|
||||
@Event() slFocus: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
}
|
||||
|
||||
/** Sets focus on the button. */
|
||||
@Method()
|
||||
async setFocus() {
|
||||
|
|
|
|||
|
|
@ -21,13 +21,6 @@ let id = 0;
|
|||
shadow: true
|
||||
})
|
||||
export class Checkbox {
|
||||
constructor() {
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleMouseDown = this.handleMouseDown.bind(this);
|
||||
}
|
||||
|
||||
inputId = `checkbox-${++id}`;
|
||||
labelId = `checkbox-label-${id}`;
|
||||
input: HTMLInputElement;
|
||||
|
|
@ -66,6 +59,13 @@ export class Checkbox {
|
|||
this.slChange.emit();
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleMouseDown = this.handleMouseDown.bind(this);
|
||||
}
|
||||
|
||||
componentDidLoad() {
|
||||
this.input.indeterminate = this.indeterminate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,29 +24,6 @@ import { clamp } from '../../utilities/math';
|
|||
shadow: true
|
||||
})
|
||||
export class ColorPicker {
|
||||
constructor() {
|
||||
this.handleAlphaDrag = this.handleAlphaDrag.bind(this);
|
||||
this.handleAlphaInput = this.handleAlphaInput.bind(this);
|
||||
this.handleAlphaKeyDown = this.handleAlphaKeyDown.bind(this);
|
||||
this.handleCopy = this.handleCopy.bind(this);
|
||||
this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);
|
||||
this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
|
||||
this.handleDrag = this.handleDrag.bind(this);
|
||||
this.handleDropdownAfterHide = this.handleDropdownAfterHide.bind(this);
|
||||
this.handleDropdownAfterShow = this.handleDropdownAfterShow.bind(this);
|
||||
this.handleDropdownHide = this.handleDropdownHide.bind(this);
|
||||
this.handleDropdownShow = this.handleDropdownShow.bind(this);
|
||||
this.handleGridDrag = this.handleGridDrag.bind(this);
|
||||
this.handleGridKeyDown = this.handleGridKeyDown.bind(this);
|
||||
this.handleHueDrag = this.handleHueDrag.bind(this);
|
||||
this.handleHueInput = this.handleHueInput.bind(this);
|
||||
this.handleHueKeyDown = this.handleHueKeyDown.bind(this);
|
||||
this.handleLightnessInput = this.handleLightnessInput.bind(this);
|
||||
this.handleSaturationInput = this.handleSaturationInput.bind(this);
|
||||
this.handleTextInputChange = this.handleTextInputChange.bind(this);
|
||||
this.handleTextInputKeyDown = this.handleTextInputKeyDown.bind(this);
|
||||
}
|
||||
|
||||
bypassValueParse = false;
|
||||
copyButton: HTMLSlButtonElement;
|
||||
dropdown: HTMLSlDropdownElement;
|
||||
|
|
@ -149,6 +126,29 @@ export class ColorPicker {
|
|||
}
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
this.handleAlphaDrag = this.handleAlphaDrag.bind(this);
|
||||
this.handleAlphaInput = this.handleAlphaInput.bind(this);
|
||||
this.handleAlphaKeyDown = this.handleAlphaKeyDown.bind(this);
|
||||
this.handleCopy = this.handleCopy.bind(this);
|
||||
this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);
|
||||
this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
|
||||
this.handleDrag = this.handleDrag.bind(this);
|
||||
this.handleDropdownAfterHide = this.handleDropdownAfterHide.bind(this);
|
||||
this.handleDropdownAfterShow = this.handleDropdownAfterShow.bind(this);
|
||||
this.handleDropdownHide = this.handleDropdownHide.bind(this);
|
||||
this.handleDropdownShow = this.handleDropdownShow.bind(this);
|
||||
this.handleGridDrag = this.handleGridDrag.bind(this);
|
||||
this.handleGridKeyDown = this.handleGridKeyDown.bind(this);
|
||||
this.handleHueDrag = this.handleHueDrag.bind(this);
|
||||
this.handleHueInput = this.handleHueInput.bind(this);
|
||||
this.handleHueKeyDown = this.handleHueKeyDown.bind(this);
|
||||
this.handleLightnessInput = this.handleLightnessInput.bind(this);
|
||||
this.handleSaturationInput = this.handleSaturationInput.bind(this);
|
||||
this.handleTextInputChange = this.handleTextInputChange.bind(this);
|
||||
this.handleTextInputKeyDown = this.handleTextInputKeyDown.bind(this);
|
||||
}
|
||||
|
||||
componentWillLoad() {
|
||||
if (!this.setColor(this.value)) {
|
||||
this.setColor(`#ffff`);
|
||||
|
|
|
|||
|
|
@ -22,13 +22,6 @@ let id = 0;
|
|||
shadow: true
|
||||
})
|
||||
export class Details {
|
||||
constructor() {
|
||||
this.handleBodyTransitionEnd = this.handleBodyTransitionEnd.bind(this);
|
||||
|
||||
this.handleSummaryClick = this.handleSummaryClick.bind(this);
|
||||
this.handleSummaryKeyDown = this.handleSummaryKeyDown.bind(this);
|
||||
}
|
||||
|
||||
details: HTMLElement;
|
||||
header: HTMLElement;
|
||||
id = `details-${++id}`;
|
||||
|
|
@ -60,6 +53,12 @@ export class Details {
|
|||
/** Emitted after the details closes and all transitions are complete. */
|
||||
@Event() slAfterHide: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.handleBodyTransitionEnd = this.handleBodyTransitionEnd.bind(this);
|
||||
this.handleSummaryClick = this.handleSummaryClick.bind(this);
|
||||
this.handleSummaryKeyDown = this.handleSummaryKeyDown.bind(this);
|
||||
}
|
||||
|
||||
componentDidLoad() {
|
||||
focusVisible.observe(this.details);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,14 +27,6 @@ let id = 0;
|
|||
shadow: true
|
||||
})
|
||||
export class Dialog {
|
||||
constructor() {
|
||||
this.handleDocumentFocusIn = this.handleDocumentFocusIn.bind(this);
|
||||
this.handleCloseClick = this.handleCloseClick.bind(this);
|
||||
this.handleTransitionEnd = this.handleTransitionEnd.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
this.handleOverlayClick = this.handleOverlayClick.bind(this);
|
||||
}
|
||||
|
||||
panel: HTMLElement;
|
||||
dialog: HTMLElement;
|
||||
id = `dialog-${++id}`;
|
||||
|
|
@ -79,6 +71,14 @@ export class Dialog {
|
|||
/** Emitted when the overlay is clicked. Calling `event.preventDefault()` will prevent the dialog from closing. */
|
||||
@Event() slOverlayDismiss: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.handleDocumentFocusIn = this.handleDocumentFocusIn.bind(this);
|
||||
this.handleCloseClick = this.handleCloseClick.bind(this);
|
||||
this.handleTransitionEnd = this.handleTransitionEnd.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
this.handleOverlayClick = this.handleOverlayClick.bind(this);
|
||||
}
|
||||
|
||||
componentDidLoad() {
|
||||
focusVisible.observe(this.dialog);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,14 +26,6 @@ let id = 0;
|
|||
shadow: true
|
||||
})
|
||||
export class Drawer {
|
||||
constructor() {
|
||||
this.handleCloseClick = this.handleCloseClick.bind(this);
|
||||
this.handleTransitionEnd = this.handleTransitionEnd.bind(this);
|
||||
this.handleDocumentFocusIn = this.handleDocumentFocusIn.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
this.handleOverlayClick = this.handleOverlayClick.bind(this);
|
||||
}
|
||||
|
||||
panel: HTMLElement;
|
||||
drawer: HTMLElement;
|
||||
id = `drawer-${++id}`;
|
||||
|
|
@ -87,6 +79,14 @@ export class Drawer {
|
|||
/** Emitted when the overlay is clicked. Calling `event.preventDefault()` will prevent the dialog from closing. */
|
||||
@Event() slOverlayDismiss: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.handleCloseClick = this.handleCloseClick.bind(this);
|
||||
this.handleTransitionEnd = this.handleTransitionEnd.bind(this);
|
||||
this.handleDocumentFocusIn = this.handleDocumentFocusIn.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
this.handleOverlayClick = this.handleOverlayClick.bind(this);
|
||||
}
|
||||
|
||||
componentDidLoad() {
|
||||
focusVisible.observe(this.drawer);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,14 +21,6 @@ let id = 0;
|
|||
shadow: true
|
||||
})
|
||||
export class Dropdown {
|
||||
constructor() {
|
||||
this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);
|
||||
this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
|
||||
this.handlePanelSelect = this.handlePanelSelect.bind(this);
|
||||
this.handleTriggerKeyDown = this.handleTriggerKeyDown.bind(this);
|
||||
this.togglePanel = this.togglePanel.bind(this);
|
||||
}
|
||||
|
||||
id = `dropdown-${++id}`;
|
||||
ignoreMouseEvents = false;
|
||||
ignoreMouseTimeout: any;
|
||||
|
|
@ -98,6 +90,14 @@ export class Dropdown {
|
|||
this.popover.setOptions({ placement: this.placement });
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);
|
||||
this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
|
||||
this.handlePanelSelect = this.handlePanelSelect.bind(this);
|
||||
this.handleTriggerKeyDown = this.handleTriggerKeyDown.bind(this);
|
||||
this.togglePanel = this.togglePanel.bind(this);
|
||||
}
|
||||
|
||||
componentDidLoad() {
|
||||
this.popover = new Popover(this.trigger, this.panel, {
|
||||
placement: this.placement,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,10 @@ export class Form {
|
|||
form: HTMLElement;
|
||||
formControls: FormControl[];
|
||||
|
||||
constructor() {
|
||||
/** Emitted when the form is submitted. */
|
||||
@Event() slSubmit: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.formControls = [
|
||||
{
|
||||
tag: 'button',
|
||||
|
|
@ -163,9 +166,6 @@ export class Form {
|
|||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
}
|
||||
|
||||
/** Emitted when the form is submitted. */
|
||||
@Event() slSubmit: EventEmitter;
|
||||
|
||||
/** Serializes all form controls elements and returns a `FormData` object. */
|
||||
@Method()
|
||||
async getFormData() {
|
||||
|
|
|
|||
|
|
@ -30,16 +30,6 @@ let id = 0;
|
|||
shadow: true
|
||||
})
|
||||
export class Input {
|
||||
constructor() {
|
||||
this.handleChange = this.handleChange.bind(this);
|
||||
this.handleInput = this.handleInput.bind(this);
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleClearClick = this.handleClearClick.bind(this);
|
||||
this.handleMouseDown = this.handleMouseDown.bind(this);
|
||||
this.handlePasswordToggle = this.handlePasswordToggle.bind(this);
|
||||
}
|
||||
|
||||
inputId = `input-${++id}`;
|
||||
labelId = `input-label-${id}`;
|
||||
helpTextId = `input-help-text-${id}`;
|
||||
|
|
@ -137,6 +127,16 @@ export class Input {
|
|||
/** Emitted when the control loses focus. */
|
||||
@Event() slBlur: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.handleChange = this.handleChange.bind(this);
|
||||
this.handleInput = this.handleInput.bind(this);
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleClearClick = this.handleClearClick.bind(this);
|
||||
this.handleMouseDown = this.handleMouseDown.bind(this);
|
||||
this.handlePasswordToggle = this.handlePasswordToggle.bind(this);
|
||||
}
|
||||
|
||||
/** Sets focus on the input. */
|
||||
@Method()
|
||||
async setFocus() {
|
||||
|
|
|
|||
|
|
@ -17,15 +17,6 @@ import { getTextContent } from '../../utilities/slot';
|
|||
shadow: true
|
||||
})
|
||||
export class Menu {
|
||||
constructor() {
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
this.handleMouseOver = this.handleMouseOver.bind(this);
|
||||
this.handleMouseOut = this.handleMouseOut.bind(this);
|
||||
}
|
||||
|
||||
ignoreMouseEvents = false;
|
||||
ignoreMouseTimeout: any;
|
||||
menu: HTMLElement;
|
||||
|
|
@ -41,6 +32,15 @@ export class Menu {
|
|||
/** Emitted when a menu item is selected. */
|
||||
@Event() slSelect: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
this.handleMouseOver = this.handleMouseOver.bind(this);
|
||||
this.handleMouseOut = this.handleMouseOut.bind(this);
|
||||
}
|
||||
|
||||
/** Sets focus on the menu. */
|
||||
@Method()
|
||||
async setFocus() {
|
||||
|
|
|
|||
|
|
@ -20,14 +20,6 @@ let id = 0;
|
|||
shadow: true
|
||||
})
|
||||
export class Radio {
|
||||
constructor() {
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
this.handleMouseDown = this.handleMouseDown.bind(this);
|
||||
}
|
||||
|
||||
inputId = `radio-${++id}`;
|
||||
labelId = `radio-label-${id}`;
|
||||
input: HTMLInputElement;
|
||||
|
|
@ -66,6 +58,14 @@ export class Radio {
|
|||
/** Emitted when the control gains focus. */
|
||||
@Event() slFocus: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
this.handleMouseDown = this.handleMouseDown.bind(this);
|
||||
}
|
||||
|
||||
/** Sets focus on the radio. */
|
||||
@Method()
|
||||
async setFocus() {
|
||||
|
|
|
|||
|
|
@ -16,12 +16,6 @@ import ResizeObserver from 'resize-observer-polyfill';
|
|||
shadow: true
|
||||
})
|
||||
export class Range {
|
||||
constructor() {
|
||||
this.handleInput = this.handleInput.bind(this);
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
}
|
||||
|
||||
input: HTMLInputElement;
|
||||
output: HTMLElement;
|
||||
resizeObserver: any;
|
||||
|
|
@ -61,6 +55,12 @@ export class Range {
|
|||
/** Emitted when the control gains focus. */
|
||||
@Event() slFocus: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.handleInput = this.handleInput.bind(this);
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
}
|
||||
|
||||
componentWillLoad() {
|
||||
if (this.value === undefined || this.value === null) this.value = this.min;
|
||||
if (this.value < this.min) this.value = this.min;
|
||||
|
|
|
|||
|
|
@ -15,14 +15,6 @@ import { clamp } from '../../utilities/math';
|
|||
shadow: true
|
||||
})
|
||||
export class Rating {
|
||||
constructor() {
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
this.handleMouseEnter = this.handleMouseEnter.bind(this);
|
||||
this.handleMouseLeave = this.handleMouseLeave.bind(this);
|
||||
this.handleMouseMove = this.handleMouseMove.bind(this);
|
||||
}
|
||||
|
||||
rating: HTMLElement;
|
||||
|
||||
@Element() host: HTMLSlRatingElement;
|
||||
|
|
@ -58,6 +50,14 @@ export class Rating {
|
|||
/** Emitted when the rating's value changes. */
|
||||
@Event() slChange: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
this.handleMouseEnter = this.handleMouseEnter.bind(this);
|
||||
this.handleMouseLeave = this.handleMouseLeave.bind(this);
|
||||
this.handleMouseMove = this.handleMouseMove.bind(this);
|
||||
}
|
||||
|
||||
/** Sets focus on the rating. */
|
||||
@Method()
|
||||
async setFocus() {
|
||||
|
|
|
|||
|
|
@ -24,18 +24,6 @@ let id = 0;
|
|||
shadow: true
|
||||
})
|
||||
export class Select {
|
||||
constructor() {
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
this.handleLabelClick = this.handleLabelClick.bind(this);
|
||||
this.handleMenuKeyDown = this.handleMenuKeyDown.bind(this);
|
||||
this.handleMenuHide = this.handleMenuHide.bind(this);
|
||||
this.handleMenuShow = this.handleMenuShow.bind(this);
|
||||
this.handleMenuSelect = this.handleMenuSelect.bind(this);
|
||||
this.handleSlotChange = this.handleSlotChange.bind(this);
|
||||
}
|
||||
|
||||
dropdown: HTMLSlDropdownElement;
|
||||
input: HTMLSlInputElement;
|
||||
inputId = `select-${++id}`;
|
||||
|
|
@ -111,6 +99,18 @@ export class Select {
|
|||
/** Emitted when the control loses focus */
|
||||
@Event() slBlur: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
this.handleLabelClick = this.handleLabelClick.bind(this);
|
||||
this.handleMenuKeyDown = this.handleMenuKeyDown.bind(this);
|
||||
this.handleMenuHide = this.handleMenuHide.bind(this);
|
||||
this.handleMenuShow = this.handleMenuShow.bind(this);
|
||||
this.handleMenuSelect = this.handleMenuSelect.bind(this);
|
||||
this.handleSlotChange = this.handleSlotChange.bind(this);
|
||||
}
|
||||
|
||||
componentDidLoad() {
|
||||
this.menu.querySelector('slot').addEventListener('slotchange', this.handleSlotChange);
|
||||
this.resizeObserver = new ResizeObserver(() => this.resizeMenu());
|
||||
|
|
|
|||
|
|
@ -20,14 +20,6 @@ let id = 0;
|
|||
shadow: true
|
||||
})
|
||||
export class Switch {
|
||||
constructor() {
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
this.handleMouseDown = this.handleMouseDown.bind(this);
|
||||
}
|
||||
|
||||
switchId = `switch-${++id}`;
|
||||
labelId = `switch-label-${id}`;
|
||||
input: HTMLInputElement;
|
||||
|
|
@ -61,6 +53,14 @@ export class Switch {
|
|||
/** Emitted when the control gains focus. */
|
||||
@Event() slFocus: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
this.handleMouseDown = this.handleMouseDown.bind(this);
|
||||
}
|
||||
|
||||
/** Sets focus on the switch. */
|
||||
@Method()
|
||||
async setFocus() {
|
||||
|
|
|
|||
|
|
@ -23,11 +23,6 @@ import { focusVisible } from '../../utilities/focus-visible';
|
|||
shadow: true
|
||||
})
|
||||
export class TabGroup {
|
||||
constructor() {
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
}
|
||||
|
||||
activeTab: HTMLSlTabElement;
|
||||
activeTabIndicator: HTMLElement;
|
||||
body: HTMLElement;
|
||||
|
|
@ -52,6 +47,11 @@ export class TabGroup {
|
|||
/** Emitted when a tab is hidden. */
|
||||
@Event() slTabHide: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
}
|
||||
|
||||
componentDidLoad() {
|
||||
// Set initial tab state
|
||||
this.setAriaLabels();
|
||||
|
|
|
|||
|
|
@ -17,10 +17,6 @@ import { Component, Event, EventEmitter, Prop, h } from '@stencil/core';
|
|||
shadow: true
|
||||
})
|
||||
export class Tag {
|
||||
constructor() {
|
||||
this.handleClearClick = this.handleClearClick.bind(this);
|
||||
}
|
||||
|
||||
tag: HTMLElement;
|
||||
|
||||
/** The tag's type. */
|
||||
|
|
@ -38,6 +34,10 @@ export class Tag {
|
|||
/** Emitted when the clear button is activated. */
|
||||
@Event() slClear: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.handleClearClick = this.handleClearClick.bind(this);
|
||||
}
|
||||
|
||||
handleClearClick() {
|
||||
this.slClear.emit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,13 +22,6 @@ let id = 0;
|
|||
shadow: true
|
||||
})
|
||||
export class Textarea {
|
||||
constructor() {
|
||||
this.handleChange = this.handleChange.bind(this);
|
||||
this.handleInput = this.handleInput.bind(this);
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
}
|
||||
|
||||
textareaId = `textarea-${++id}`;
|
||||
labelId = `textarea-label-${id}`;
|
||||
helpTextId = `textarea-help-text-${id}`;
|
||||
|
|
@ -108,6 +101,13 @@ export class Textarea {
|
|||
this.setTextareaHeight();
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
this.handleChange = this.handleChange.bind(this);
|
||||
this.handleInput = this.handleInput.bind(this);
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
}
|
||||
|
||||
componentDidLoad() {
|
||||
this.setTextareaHeight();
|
||||
this.resizeObserver = new ResizeObserver(() => this.setTextareaHeight());
|
||||
|
|
|
|||
|
|
@ -18,15 +18,6 @@ let id = 0;
|
|||
shadow: true
|
||||
})
|
||||
export class Tooltip {
|
||||
constructor() {
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleMouseOver = this.handleMouseOver.bind(this);
|
||||
this.handleMouseOut = this.handleMouseOut.bind(this);
|
||||
this.handleSlotChange = this.handleSlotChange.bind(this);
|
||||
}
|
||||
|
||||
id = `tooltip-${++id}`;
|
||||
popover: Popover;
|
||||
target: HTMLElement;
|
||||
|
|
@ -91,6 +82,15 @@ export class Tooltip {
|
|||
/** Emitted after the tooltip has hidden and all transitions are complete. */
|
||||
@Event() slAfterHide: EventEmitter;
|
||||
|
||||
connectedCallback() {
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
this.handleFocus = this.handleFocus.bind(this);
|
||||
this.handleMouseOver = this.handleMouseOver.bind(this);
|
||||
this.handleMouseOut = this.handleMouseOut.bind(this);
|
||||
this.handleSlotChange = this.handleSlotChange.bind(this);
|
||||
}
|
||||
|
||||
componentDidLoad() {
|
||||
const slot = this.host.shadowRoot.querySelector('slot');
|
||||
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue