@synergy-design-system/components
Version:
This package provides the base of the Synergy Design System as native web components. It uses [lit](https://www.lit.dev) and parts of [shoelace](https://shoelace.style/). Synergy officially supports the latest two versions of all major browsers (as define
871 lines (860 loc) • 29.7 kB
JavaScript
import {
formatNumber
} from "./chunk.NFXT5LNY.js";
import {
input_custom_styles_default
} from "./chunk.K2O55TNU.js";
import {
input_styles_default
} from "./chunk.XAQKFEHH.js";
import {
SynDivider
} from "./chunk.YOAPSA7L.js";
import {
defaultValue
} from "./chunk.3NXKLKWH.js";
import {
form_control_custom_styles_default,
form_control_styles_default
} from "./chunk.G4URZQCL.js";
import {
FormControlController
} from "./chunk.HP2LEQRU.js";
import {
HasSlotController
} from "./chunk.WVVQK5TE.js";
import {
SynIcon
} from "./chunk.RCBSMXQH.js";
import {
LocalizeController
} from "./chunk.OAQRCZOO.js";
import {
enableDefaultSettings
} from "./chunk.HYFCK7MM.js";
import {
createNumericStrategy,
modernNumericStrategy,
nativeNumericStrategy
} from "./chunk.RB2JR2ND.js";
import {
watch
} from "./chunk.BVZQ6QSY.js";
import {
component_styles_default
} from "./chunk.NLYVOJGK.js";
import {
SynergyElement
} from "./chunk.3THJTCRO.js";
import {
__decorateClass,
__privateAdd,
__privateGet,
__privateMethod,
__privateSet,
__spreadValues
} from "./chunk.Z4XV3SMG.js";
// src/components/input/input.component.ts
import { classMap } from "lit/directives/class-map.js";
import { html } from "lit";
import { ifDefined } from "lit/directives/if-defined.js";
import { live } from "lit/directives/live.js";
import { property, query, state } from "lit/decorators.js";
// src/internal/longpress.ts
import { noChange, nothing } from "lit";
import {
AsyncDirective,
PartType,
directive
} from "lit/async-directive.js";
var LongPressDirective = class extends AsyncDirective {
constructor(part) {
super(part);
this.handlePointerDown = (event) => {
if (event.button !== 0 || this.host.disabled) {
return;
}
this.spinOnLongPressCallback(event);
};
this.handlePointerUp = (pointerUp) => {
pointerUp == null ? void 0 : pointerUp.preventDefault();
pointerUp == null ? void 0 : pointerUp.stopPropagation();
if (this.timeout) {
this.callbacks.start();
}
this.stopSpinningAndCleanUp();
this.callbacks.end();
document.removeEventListener("pointerup", this.handlePointerUp);
};
if (part.type !== PartType.ELEMENT || !(part.element instanceof HTMLButtonElement)) {
throw new Error("The `longPress` directive must be used on an HTMLButtonElement.");
}
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
render(_callback) {
return nothing;
}
update(part, [callbacks]) {
if (this.callbacks === void 0 && this.host === void 0) {
this.host = part.element;
this.callbacks = __spreadValues({}, callbacks);
this.host.addEventListener("pointerdown", this.handlePointerDown);
}
return noChange;
}
reconnected() {
this.host.addEventListener("pointerdown", this.handlePointerDown);
}
disconnected() {
this.stopSpinningAndCleanUp();
this.host.removeEventListener("pointerdown", this.handlePointerDown);
document.removeEventListener("pointerup", this.handlePointerUp);
}
/**
* Start spinning on long press clicks otherwise handle as single click event
*/
spinOnLongPressCallback(event) {
var _a;
event.preventDefault();
event.stopPropagation();
this.timeout = setTimeout(() => {
this.timeout = void 0;
this.interval = setInterval(() => {
this.callbacks.start();
}, 50);
}, 500);
document.addEventListener("pointerup", this.handlePointerUp);
(_a = this.observer) == null ? void 0 : _a.disconnect();
this.observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.attributeName === "disabled") {
this.stopSpinningAndCleanUp();
}
});
});
this.observer.observe(this.host, { attributes: true });
}
/**
* Stop the spinning and clean up all timer and observer
*/
stopSpinningAndCleanUp() {
var _a;
clearInterval(this.interval);
clearTimeout(this.timeout);
(_a = this.observer) == null ? void 0 : _a.disconnect();
}
};
var longPress = directive(LongPressDirective);
// src/components/input/input.component.ts
var _numericStrategy, _SynInput_instances, formatNumber_fn, isNumberFormattingEnabled_fn;
var SynInput = class extends SynergyElement {
constructor() {
super(...arguments);
__privateAdd(this, _SynInput_instances);
this.formControlController = new FormControlController(this, {
assumeInteractionOn: ["syn-blur", "syn-input"]
});
this.hasSlotController = new HasSlotController(this, "help-text", "label", "prefix", "suffix");
this.localize = new LocalizeController(this);
this.hasFocus = false;
this.title = "";
// make reactive to pass through
this.__numberInput = Object.assign(document.createElement("input"), { type: "number" });
this.__dateInput = Object.assign(document.createElement("input"), { type: "date" });
this.type = "text";
this.name = "";
this.value = "";
this.defaultValue = "";
this.size = "medium";
this.label = "";
this.helpText = "";
this.clearable = false;
this.disabled = false;
this.placeholder = "";
this.readonly = false;
this.passwordToggle = false;
this.passwordVisible = false;
this.noSpinButtons = false;
this.form = "";
this.required = false;
this.spellcheck = true;
__privateAdd(this, _numericStrategy, nativeNumericStrategy);
}
set numericStrategy(value) {
switch (typeof value) {
case "string":
__privateSet(this, _numericStrategy, value === "modern" ? modernNumericStrategy : nativeNumericStrategy);
break;
case "object":
__privateSet(this, _numericStrategy, createNumericStrategy(value));
break;
default:
__privateSet(this, _numericStrategy, nativeNumericStrategy);
}
}
/**
* @default nativeNumericStrategy
* @todo: This must be changed to "modern" in Synergy@3
*/
get numericStrategy() {
return __privateGet(this, _numericStrategy);
}
//
// NOTE: We use an in-memory input for these getters/setters instead of the one in the template because the properties
// can be set before the component is rendered.
//
/**
* Gets or sets the current value as a `Date` object. Returns `null` if the value can't be converted. This will use the native `<input type="{{type}}">` implementation and may result in an error.
*/
get valueAsDate() {
var _a;
this.__dateInput.type = this.type;
this.__dateInput.value = this.value;
return ((_a = this.input) == null ? void 0 : _a.valueAsDate) || this.__dateInput.valueAsDate;
}
set valueAsDate(newValue) {
this.__dateInput.type = this.type;
this.__dateInput.valueAsDate = newValue;
this.value = this.__dateInput.value;
}
/** Gets or sets the current value as a number. Returns `NaN` if the value can't be converted. */
get valueAsNumber() {
var _a;
this.__numberInput.value = this.value;
return ((_a = this.input) == null ? void 0 : _a.valueAsNumber) || this.__numberInput.valueAsNumber;
}
set valueAsNumber(newValue) {
this.__numberInput.valueAsNumber = newValue;
this.value = this.__numberInput.value;
}
/** Gets the validity state object */
get validity() {
return this.input.validity;
}
/** Gets the validation message */
get validationMessage() {
return this.input.validationMessage;
}
firstUpdated() {
this.formControlController.updateValidity();
}
handleBlur() {
this.hasFocus = false;
this.emit("syn-blur");
}
handleStep() {
this.handleInput();
this.input.focus();
}
handleStepUp() {
this.stepUp();
this.handleStep();
}
handleStepDown() {
this.stepDown();
this.handleStep();
}
isDecrementDisabled() {
if (this.disabled || this.readonly) {
return true;
}
if (this.min === void 0 || this.min === null) {
return false;
}
const min = typeof this.min === "string" ? parseFloat(this.min) : this.min;
return parseFloat(this.value) <= min;
}
isIncrementDisabled() {
if (this.disabled || this.readonly) {
return true;
}
if (this.max === void 0 || this.max === null) {
return false;
}
const max = typeof this.max === "string" ? parseFloat(this.max) : this.max;
return parseFloat(this.value) >= max;
}
handleNumericStrategyAutoClamp() {
const {
valueAsNumber,
max: initialMax,
min: initialMin
} = this;
if (!__privateGet(this, _numericStrategy).autoClamp) {
return {
eventObj: null,
shouldClamp: false,
nextValue: valueAsNumber
};
}
const min = typeof initialMin === "string" ? parseFloat(initialMin) : initialMin;
const max = typeof initialMax === "string" ? parseFloat(initialMax) : initialMax;
let nextValue = valueAsNumber;
let clampEvent = "";
if (nextValue < min) {
nextValue = min;
clampEvent = "min";
} else if (nextValue > max) {
nextValue = max;
clampEvent = "max";
}
const eventObj = clampEvent ? {
detail: {
clampedTo: clampEvent,
lastUserValue: valueAsNumber
}
} : null;
return {
eventObj,
shouldClamp: !!eventObj,
nextValue
};
}
handleChange() {
if (this.type === "number" && (__privateMethod(this, _SynInput_instances, isNumberFormattingEnabled_fn).call(this) || __privateGet(this, _numericStrategy).autoClamp)) {
const { eventObj, shouldClamp, nextValue } = this.handleNumericStrategyAutoClamp();
let initialNextValue = __privateGet(this, _numericStrategy).autoClamp ? nextValue : this.valueAsNumber;
if (isNaN(initialNextValue)) {
const { max, min } = this;
if (max !== void 0 && max !== null) {
initialNextValue = typeof max === "string" ? parseFloat(max) : +max;
} else if (min !== void 0 && min !== null) {
initialNextValue = typeof min === "string" ? parseFloat(min) : +min;
} else {
initialNextValue = 0;
}
}
this.value = __privateMethod(this, _SynInput_instances, isNumberFormattingEnabled_fn).call(this) ? __privateMethod(this, _SynInput_instances, formatNumber_fn).call(this, initialNextValue) : initialNextValue.toString();
this.updateComplete.then(() => {
if (shouldClamp && eventObj) {
this.emit("syn-clamp", eventObj);
}
this.formControlController.updateValidity();
this.emit("syn-change");
});
return;
}
this.value = this.input.value;
this.emit("syn-change");
}
handleClearClick(event) {
event.preventDefault();
if (this.value !== "") {
this.value = "";
this.emit("syn-clear");
this.emit("syn-input");
this.emit("syn-change");
}
this.input.focus();
}
handleFocus() {
this.hasFocus = true;
this.emit("syn-focus");
}
handleInput() {
this.value = this.input.value;
this.formControlController.updateValidity();
this.emit("syn-input");
}
handleInvalid(event) {
this.formControlController.setValidity(false);
this.formControlController.emitInvalidEvent(event);
}
handleKeyDown(event) {
if (__privateGet(this, _numericStrategy).noStepAlign && this.type === "number") {
const { key } = event;
if (key === "ArrowUp" || key === "ArrowDown") {
event.preventDefault();
event.stopPropagation();
if (key === "ArrowUp") {
this.handleStepUp();
} else if (key === "ArrowDown") {
this.handleStepDown();
}
this.handleChange();
return;
}
}
const hasModifier = event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;
if (event.key === "Enter" && !hasModifier) {
setTimeout(() => {
if (!event.defaultPrevented && !event.isComposing) {
this.formControlController.submit();
}
});
}
}
handlePasswordToggle() {
this.passwordVisible = !this.passwordVisible;
}
handleDisabledChange() {
this.formControlController.setValidity(this.disabled);
}
handleStepChange() {
if (__privateGet(this, _numericStrategy).noStepValidation) {
return;
}
this.input.step = String(this.step);
this.formControlController.updateValidity();
}
async handleValueChange() {
await this.updateComplete;
this.formControlController.updateValidity();
}
/** Sets focus on the input. */
focus(options) {
this.input.focus(options);
}
/** Removes focus from the input. */
blur() {
this.input.blur();
}
/** Selects all the text in the input. */
select() {
this.input.select();
}
/** Sets the start and end positions of the text selection (0-based). */
setSelectionRange(selectionStart, selectionEnd, selectionDirection = "none") {
this.input.setSelectionRange(selectionStart, selectionEnd, selectionDirection);
}
/** Replaces a range of text with a new string. */
setRangeText(replacement, start, end, selectMode = "preserve") {
const selectionStart = start != null ? start : this.input.selectionStart;
const selectionEnd = end != null ? end : this.input.selectionEnd;
this.input.setRangeText(replacement, selectionStart, selectionEnd, selectMode);
if (this.value !== this.input.value) {
this.value = this.input.value;
}
}
/** Displays the browser picker for an input element (only works if the browser supports it for the input type). */
showPicker() {
if ("showPicker" in HTMLInputElement.prototype) {
this.input.showPicker();
}
}
/** Increments the value of a numeric input type by the value of the step attribute. */
stepUp() {
if (__privateGet(this, _numericStrategy).noStepAlign) {
const { max, step, valueAsNumber } = this;
const usedInitialValue = Number.isNaN(valueAsNumber) ? 0 : valueAsNumber;
const usedMin = typeof this.min === "string" ? parseFloat(this.min) : this.min;
const usedMax = typeof max === "string" ? parseFloat(max) : max;
const usedStep = typeof step === "undefined" || step === null || step === "any" ? 1 : typeof step === "number" ? step : parseFloat(step);
let wantedNextValue = usedInitialValue + usedStep;
if (typeof usedMax === "number" && usedMax < wantedNextValue) {
wantedNextValue = usedMax;
} else if (typeof usedMin === "number" && usedMin > wantedNextValue) {
wantedNextValue = usedMin;
}
const finalStringValue = __privateMethod(this, _SynInput_instances, isNumberFormattingEnabled_fn).call(this) ? __privateMethod(this, _SynInput_instances, formatNumber_fn).call(this, wantedNextValue) : wantedNextValue.toString();
this.input.value = finalStringValue;
if (this.value !== this.input.value) {
this.value = this.input.value;
}
return;
}
this.input.stepUp();
if (this.value !== this.input.value) {
this.value = this.input.value;
}
}
/** Decrements the value of a numeric input type by the value of the step attribute. */
stepDown() {
if (__privateGet(this, _numericStrategy).noStepAlign) {
const { min, max, step, valueAsNumber } = this;
const usedInitialValue = Number.isNaN(valueAsNumber) ? 0 : valueAsNumber;
const usedMin = typeof min === "string" ? parseFloat(min) : min;
const usedMax = typeof max === "string" ? parseFloat(max) : max;
const usedStep = typeof step === "undefined" || step === null || step === "any" ? 1 : typeof step === "number" ? step : parseFloat(step);
let wantedNextValue = usedInitialValue - usedStep;
if (typeof usedMin === "number" && usedMin > wantedNextValue) {
wantedNextValue = usedMin;
} else if (typeof usedMax === "number" && usedMax < wantedNextValue) {
wantedNextValue = usedMax;
}
const finalStringValue = __privateMethod(this, _SynInput_instances, isNumberFormattingEnabled_fn).call(this) ? __privateMethod(this, _SynInput_instances, formatNumber_fn).call(this, wantedNextValue) : wantedNextValue.toString();
this.input.value = finalStringValue;
if (this.value !== this.input.value) {
this.value = this.input.value;
}
return;
}
this.input.stepDown();
if (this.value !== this.input.value) {
this.value = this.input.value;
}
}
/** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
checkValidity() {
return this.input.checkValidity();
}
/** Gets the associated form, if one exists. */
getForm() {
return this.formControlController.getForm();
}
/** Checks for validity and shows the browser's validation message if the control is invalid. */
reportValidity() {
return this.input.reportValidity();
}
/** Sets a custom validation message. Pass an empty string to restore validity. */
setCustomValidity(message) {
this.input.setCustomValidity(message);
this.formControlController.updateValidity();
}
render() {
const hasLabelSlot = this.hasSlotController.test("label");
const hasHelpTextSlot = this.hasSlotController.test("help-text");
const hasPrefixSlot = this.hasSlotController.test("prefix");
const hasSuffixSlot = this.hasSlotController.test("suffix");
const hasLabel = this.label ? true : !!hasLabelSlot;
const hasHelpText = this.helpText ? true : !!hasHelpTextSlot;
const hasClearIcon = this.clearable && !this.disabled && !this.readonly;
const isClearIconVisible = hasClearIcon && (typeof this.value === "number" || this.value.length > 0);
return html`
<div
part="form-control"
class=${classMap({
"form-control": true,
"form-control--small": this.size === "small",
"form-control--medium": this.size === "medium",
"form-control--large": this.size === "large",
"form-control--has-label": hasLabel,
"form-control--has-help-text": hasHelpText,
"form-control--has-prefix": hasPrefixSlot,
"form-control--has-suffix": hasSuffixSlot
})}
>
<label
part="form-control-label"
class="form-control__label"
for="input"
aria-hidden=${hasLabel ? "false" : "true"}
>
<slot name="label">${this.label}</slot>
</label>
<div part="form-control-input" class="form-control-input">
<div
part="base"
class=${classMap({
input: true,
// Sizes
"input--small": this.size === "small",
"input--medium": this.size === "medium",
"input--large": this.size === "large",
// States
"input--standard": !this.readonly,
"input--readonly": this.readonly,
"input--disabled": this.disabled,
"input--focused": this.hasFocus,
"input--empty": !this.value,
"input--no-spin-buttons": this.noSpinButtons
})}
>
<span part="prefix" class="input__prefix">
<slot name="prefix"></slot>
</span>
<input
part="input"
id="input"
class="input__control"
type=${this.type === "password" && this.passwordVisible ? "text" : this.type}
title=${this.title}
name=${ifDefined(this.name)}
?disabled=${this.disabled}
?readonly=${this.readonly}
?required=${this.required}
placeholder=${ifDefined(this.placeholder)}
minlength=${ifDefined(this.minlength)}
maxlength=${ifDefined(this.maxlength)}
min=${ifDefined(this.min)}
max=${ifDefined(this.max)}
step=${ifDefined(!__privateGet(this, _numericStrategy).noStepValidation ? this.step : "any")}
.value=${live(this.value)}
autocapitalize=${ifDefined(this.autocapitalize)}
autocomplete=${ifDefined(this.autocomplete)}
autocorrect=${ifDefined(this.autocorrect ? void 0 : "off")}
?autofocus=${this.autofocus}
spellcheck=${this.spellcheck}
pattern=${ifDefined(this.pattern)}
enterkeyhint=${ifDefined(this.enterkeyhint)}
inputmode=${ifDefined(this.inputmode)}
aria-describedby="help-text"
=${this.handleChange}
=${this.handleInput}
=${this.handleInvalid}
=${this.handleKeyDown}
=${this.handleFocus}
=${this.handleBlur}
/>
${isClearIconVisible ? html`
<button
part="clear-button"
class="input__clear"
type="button"
aria-label=${this.localize.term("clearEntry")}
=${this.handleClearClick}
tabindex="-1"
>
<slot name="clear-icon">
<syn-icon name="x-circle-fill" library="system"></syn-icon>
</slot>
</button>
` : ""}
${this.passwordToggle && !this.disabled ? html`
<button
part="password-toggle-button"
class="input__password-toggle"
type="button"
aria-label=${this.localize.term(this.passwordVisible ? "hidePassword" : "showPassword")}
=${this.handlePasswordToggle}
tabindex="-1"
>
${this.passwordVisible ? html`
<slot name="show-password-icon">
<syn-icon name="eye-slash" library="system"></syn-icon>
</slot>
` : html`
<slot name="hide-password-icon">
<syn-icon name="eye" library="system"></syn-icon>
</slot>
`}
</button>
` : ""}
<span part="suffix" class="input__suffix">
<slot name="suffix"></slot>
</span>
${this.type === "number" && !this.noSpinButtons ? html`
<div part="stepper" class="input__number-stepper">
<button
part="decrement-number-stepper"
class="input__number-stepper-button"
type="button"
?disabled=${this.isDecrementDisabled()}
aria-hidden="true"
${longPress({ start: () => this.handleStepDown(), end: () => this.handleChange() })}
tabindex="-1"
>
<slot name="decrement-number-stepper">
<syn-icon name="indeterminate" library="system"></syn-icon>
</slot>
</button>
<syn-divider class="input__number-divider" part="divider" vertical></syn-divider>
<button
part="increment-number-stepper"
class="input__number-stepper-button"
type="button"
?disabled=${this.isIncrementDisabled()}
aria-hidden="true"
${longPress({ start: () => this.handleStepUp(), end: () => this.handleChange() })}
tabindex="-1"
>
<slot name="increment-number-stepper">
<syn-icon name="add" library="system"></syn-icon>
</slot>
</button>
</div>
` : ""}
</div>
</div>
<div
part="form-control-help-text"
id="help-text"
class="form-control__help-text"
aria-hidden=${hasHelpText ? "false" : "true"}
>
<slot name="help-text">${this.helpText}</slot>
</div>
</div>
`;
}
};
_numericStrategy = new WeakMap();
_SynInput_instances = new WeakSet();
formatNumber_fn = function(value) {
return formatNumber(value, this.step, __spreadValues({
maximumFractionDigits: this.maxFractionDigits,
minimumFractionDigits: this.minFractionDigits
}, this.numberFormatterOptions));
};
isNumberFormattingEnabled_fn = function() {
var _a;
const {
numberFormatterOptions,
maxFractionDigits,
minFractionDigits,
step
} = this;
const hasMaxFractionDigits = typeof maxFractionDigits !== "undefined" && !Number.isNaN(maxFractionDigits);
const hasMinFractionDigits = typeof minFractionDigits !== "undefined" && !Number.isNaN(minFractionDigits);
if (hasMaxFractionDigits || hasMinFractionDigits) {
return true;
}
if (typeof numberFormatterOptions === "object") {
return true;
}
const stepToUse = step === "any" || !step ? 1 : +step;
const stepFractionDigits = ((_a = stepToUse.toString().split(".")[1]) == null ? void 0 : _a.length) || 0;
return stepFractionDigits > 0;
};
SynInput.styles = [component_styles_default, form_control_styles_default, input_styles_default, form_control_custom_styles_default, input_custom_styles_default];
SynInput.dependencies = {
"syn-icon": SynIcon,
"syn-divider": SynDivider
};
__decorateClass([
query(".input__control")
], SynInput.prototype, "input", 2);
__decorateClass([
state()
], SynInput.prototype, "hasFocus", 2);
__decorateClass([
property({ reflect: true })
], SynInput.prototype, "title", 2);
__decorateClass([
property({ reflect: true })
], SynInput.prototype, "type", 2);
__decorateClass([
property()
], SynInput.prototype, "name", 2);
__decorateClass([
property()
], SynInput.prototype, "value", 2);
__decorateClass([
defaultValue()
], SynInput.prototype, "defaultValue", 2);
__decorateClass([
property({ reflect: true })
], SynInput.prototype, "size", 2);
__decorateClass([
property()
], SynInput.prototype, "label", 2);
__decorateClass([
property({ attribute: "help-text" })
], SynInput.prototype, "helpText", 2);
__decorateClass([
property({ type: Boolean })
], SynInput.prototype, "clearable", 2);
__decorateClass([
property({ type: Boolean, reflect: true })
], SynInput.prototype, "disabled", 2);
__decorateClass([
property()
], SynInput.prototype, "placeholder", 2);
__decorateClass([
property({ type: Boolean, reflect: true })
], SynInput.prototype, "readonly", 2);
__decorateClass([
property({ attribute: "password-toggle", type: Boolean })
], SynInput.prototype, "passwordToggle", 2);
__decorateClass([
property({ attribute: "password-visible", type: Boolean })
], SynInput.prototype, "passwordVisible", 2);
__decorateClass([
property({ attribute: "no-spin-buttons", type: Boolean })
], SynInput.prototype, "noSpinButtons", 2);
__decorateClass([
property({ reflect: true })
], SynInput.prototype, "form", 2);
__decorateClass([
property({ type: Boolean, reflect: true })
], SynInput.prototype, "required", 2);
__decorateClass([
property()
], SynInput.prototype, "pattern", 2);
__decorateClass([
property({ type: Number })
], SynInput.prototype, "minlength", 2);
__decorateClass([
property({ type: Number })
], SynInput.prototype, "maxlength", 2);
__decorateClass([
property()
], SynInput.prototype, "min", 2);
__decorateClass([
property()
], SynInput.prototype, "max", 2);
__decorateClass([
property()
], SynInput.prototype, "step", 2);
__decorateClass([
property()
], SynInput.prototype, "autocapitalize", 2);
__decorateClass([
property({
attribute: "autocorrect",
reflect: true,
converter: {
fromAttribute: (value) => value === "" || value === "on",
toAttribute: (value) => value ? "on" : "off"
},
type: Boolean
})
], SynInput.prototype, "autocorrect", 2);
__decorateClass([
property()
], SynInput.prototype, "autocomplete", 2);
__decorateClass([
property({ type: Boolean })
], SynInput.prototype, "autofocus", 2);
__decorateClass([
property()
], SynInput.prototype, "enterkeyhint", 2);
__decorateClass([
property({
type: Boolean,
converter: {
// Allow "true|false" attribute values but keep the property boolean
fromAttribute: (value) => !value || value === "false" ? false : true,
toAttribute: (value) => value ? "true" : "false"
}
})
], SynInput.prototype, "spellcheck", 2);
__decorateClass([
property()
], SynInput.prototype, "inputmode", 2);
__decorateClass([
property({
attribute: false,
reflect: false,
type: Object
})
], SynInput.prototype, "numberFormatterOptions", 2);
__decorateClass([
property({
attribute: "min-fraction-digits",
type: Number
})
], SynInput.prototype, "minFractionDigits", 2);
__decorateClass([
property({
attribute: "max-fraction-digits",
type: Number
})
], SynInput.prototype, "maxFractionDigits", 2);
__decorateClass([
property({
attribute: "numeric-strategy",
converter: {
fromAttribute: (value) => {
return value === "modern" ? modernNumericStrategy : nativeNumericStrategy;
}
},
type: Object
})
], SynInput.prototype, "numericStrategy", 1);
__decorateClass([
watch("disabled", { waitUntilFirstUpdate: true })
], SynInput.prototype, "handleDisabledChange", 1);
__decorateClass([
watch("step", { waitUntilFirstUpdate: true })
], SynInput.prototype, "handleStepChange", 1);
__decorateClass([
watch("value", { waitUntilFirstUpdate: true })
], SynInput.prototype, "handleValueChange", 1);
SynInput = __decorateClass([
enableDefaultSettings("SynInput")
], SynInput);
export {
SynInput
};
//# sourceMappingURL=chunk.BNZ7BFBC.js.map