@spectrum-web-components/number-field 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["NumberField.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { NumberFormatter, NumberParser } from '@internationalized/number';\nimport {\n CSSResultArray,\n html,\n nothing,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { streamingListener } from '@spectrum-web-components/base/src/streaming-listener.js';\nimport {\n LanguageResolutionController,\n languageResolverUpdatedSymbol,\n} from '@spectrum-web-components/reactive-controllers/src/LanguageResolution.js';\n\nimport chevronStyles from '@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron100.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron200.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron50.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron75.js';\nimport '@spectrum-web-components/infield-button/sp-infield-button.js';\nimport {\n isAndroid,\n isIOS,\n isIPhone,\n} from '@spectrum-web-components/shared/src/platform.js';\nimport { TextfieldBase } from '@spectrum-web-components/textfield';\nimport chevronIconOverrides from '@spectrum-web-components/icon/src/icon-chevron-overrides.css.js';\nimport styles from './number-field.css.js';\n\nexport const FRAMES_PER_CHANGE = 5;\n// Debounce duration for inserting a `change` event after a batch of `wheel` originating `input` events.\nexport const CHANGE_DEBOUNCE_MS = 100;\nexport const indeterminatePlaceholder = '-';\nexport const remapMultiByteCharacters: Record<string, string> = {\n '\uFF11': '1',\n '\uFF12': '2',\n '\uFF13': '3',\n '\uFF14': '4',\n '\uFF15': '5',\n '\uFF16': '6',\n '\uFF17': '7',\n '\uFF18': '8',\n '\uFF19': '9',\n '\uFF10': '0',\n '\u3001': ',',\n '\uFF0C': ',',\n '\u3002': '.',\n '\uFF0E': '.',\n '\uFF05': '%',\n '\uFF0B': '+',\n \u30FC: '-',\n \u4E00: '1',\n \u4E8C: '2',\n \u4E09: '3',\n \u56DB: '4',\n \u4E94: '5',\n \u516D: '6',\n \u4E03: '7',\n \u516B: '8',\n \u4E5D: '9',\n \u96F6: '0',\n};\nconst chevronIcon: Record<string, (dir: 'Down' | 'Up') => TemplateResult> = {\n s: (dir) => html`\n <sp-icon-chevron50\n class=\"stepper-icon spectrum-UIIcon-Chevron${dir}50\"\n ></sp-icon-chevron50>\n `,\n m: (dir) => html`\n <sp-icon-chevron75\n class=\"stepper-icon spectrum-UIIcon-Chevron${dir}75\"\n ></sp-icon-chevron75>\n `,\n l: (dir) => html`\n <sp-icon-chevron100\n class=\"stepper-icon spectrum-UIIcon-Chevron${dir}100\"\n ></sp-icon-chevron100>\n `,\n xl: (dir) => html`\n <sp-icon-chevron200\n class=\"stepper-icon spectrum-UIIcon-Chevron${dir}200\"\n ></sp-icon-chevron200>\n `,\n};\n\n/**\n * @element sp-number-field\n * @slot help-text - default or non-negative help text to associate to your form element\n * @slot negative-help-text - negative help text to associate to your form element when `invalid`\n */\nexport class NumberField extends TextfieldBase {\n public static override get styles(): CSSResultArray {\n return [...super.styles, styles, chevronStyles, chevronIconOverrides];\n }\n\n @query('.buttons')\n private buttons!: HTMLDivElement;\n\n @property({ type: Boolean, reflect: true })\n public override focused = false;\n\n _forcedUnit = '';\n\n /**\n * An `&lt;sp-number-field&gt;` element will process its numeric value with\n * `new Intl.NumberFormat(this.resolvedLanguage, this.formatOptions).format(this.valueAsNumber)`\n * in order to prepare it for visual delivery in the input. In order to customize this\n * processing supply your own `Intl.NumberFormatOptions` object here.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat\n */\n @property({ type: Object, attribute: 'format-options' })\n public formatOptions: Intl.NumberFormatOptions = {};\n\n /**\n * Whether the stepper UI is hidden or not.\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-stepper' })\n public hideStepper = false;\n\n @property({ type: Boolean, reflect: true })\n public indeterminate = false;\n\n @property({ type: Boolean, reflect: true, attribute: 'keyboard-focused' })\n public keyboardFocused = false;\n\n @property({ type: Number })\n public max?: number;\n\n @property({ type: Number })\n public min?: number;\n\n /**\n * The distance by which to alter the value of the element when taking a \"step\".\n *\n * When `this.formatOptions.style === 'percentage'` the default step will be\n * set to 0.01 unless otherwise supplied to the element.\n */\n @property({ type: Number })\n public step?: number;\n\n public managedInput = false;\n\n @property({ type: Number, reflect: true, attribute: 'step-modifier' })\n public stepModifier = 10;\n\n @property({ type: Number })\n public override set value(rawValue: number) {\n const value = this.validateInput(rawValue);\n if (value === this.value) {\n return;\n }\n this.lastCommitedValue = value;\n const oldValue = this._value;\n this._value = value;\n this.requestUpdate('value', oldValue);\n }\n\n public override get value(): number {\n return this._value;\n }\n\n private get inputValue(): string {\n return this.indeterminate\n ? this.formattedValue\n : this.inputElement.value;\n }\n\n public override _value = NaN;\n private _trackingValue = '';\n private lastCommitedValue?: number;\n\n private setValue(newValue: number = this.value): void {\n // Capture previous value for accurate IME change detection\n const previousValue = this.lastCommitedValue;\n\n this.value = newValue;\n\n if (\n typeof previousValue === 'undefined' ||\n previousValue === this.value\n ) {\n // Do not announce when the value is unchanged.\n return;\n }\n\n this.lastCommitedValue = this.value;\n\n this.dispatchEvent(\n new Event('change', { bubbles: true, composed: true })\n );\n }\n\n /**\n * Retreive the value of the element parsed to a Number.\n */\n public get valueAsString(): string {\n return this._value.toString();\n }\n\n public set valueAsString(value: string) {\n this.value = this.numberParser.parse(value);\n }\n\n public get formattedValue(): string {\n if (isNaN(this.value)) return '';\n return (\n this.numberFormatter.format(this.value) +\n (this.focused ? '' : this._forcedUnit)\n );\n }\n\n private decimalsChars = new Set(['.', ',']);\n private valueBeforeFocus: string = '';\n private isIntentDecimal: boolean = false;\n\n private convertValueToNumber(inputValue: string): number {\n // Normalize full-width characters to their ASCII equivalents\n let normalizedValue = inputValue\n .split('')\n .map((char) => remapMultiByteCharacters[char] || char)\n .join('');\n\n const separators = this.valueBeforeFocus\n .split('')\n .filter((char) => this.decimalsChars.has(char));\n const uniqueSeparators = new Set(separators);\n\n if (\n isIOS() &&\n this.inputElement.inputMode === 'decimal' &&\n normalizedValue !== this.valueBeforeFocus\n ) {\n const parts = this.numberFormatter.formatToParts(1000.1);\n\n const replacementDecimal = parts.find(\n (part) => part.type === 'decimal'\n )!.value;\n\n for (const separator of uniqueSeparators) {\n const isDecimalSeparator = separator === replacementDecimal;\n if (!isDecimalSeparator && !this.isIntentDecimal) {\n normalizedValue = normalizedValue.replace(\n new RegExp(separator, 'g'),\n ''\n );\n }\n }\n\n let hasReplacedDecimal = false;\n const valueChars = normalizedValue.split('');\n for (let index = valueChars.length - 1; index >= 0; index--) {\n const char = valueChars[index];\n if (this.decimalsChars.has(char)) {\n if (!hasReplacedDecimal) {\n valueChars[index] = replacementDecimal;\n hasReplacedDecimal = true;\n } else valueChars[index] = '';\n }\n }\n normalizedValue = valueChars.join('');\n }\n return this.numberParser.parse(normalizedValue);\n }\n private get _step(): number {\n if (typeof this.step !== 'undefined') {\n return this.step;\n }\n if (this.formatOptions?.style === 'percent') {\n return 0.01;\n }\n return 1;\n }\n\n private nextChange!: number;\n private changeCount = 0;\n private findChange!: (event: PointerEvent) => void;\n private change!: (event: PointerEvent) => void;\n private safty!: number;\n private languageResolver = new LanguageResolutionController(this);\n\n private handlePointerdown(event: PointerEvent): void {\n if (event.button !== 0) {\n event.preventDefault();\n return;\n }\n this.managedInput = true;\n this.buttons.setPointerCapture(event.pointerId);\n const stepUpRect = this.buttons.children[0].getBoundingClientRect();\n const stepDownRect = this.buttons.children[1].getBoundingClientRect();\n this.findChange = (event: PointerEvent) => {\n if (\n event.clientX >= stepUpRect.x &&\n event.clientY >= stepUpRect.y &&\n event.clientX <= stepUpRect.x + stepUpRect.width &&\n event.clientY <= stepUpRect.y + stepUpRect.height\n ) {\n this.change = (event: PointerEvent) =>\n this.increment(event.shiftKey ? this.stepModifier : 1);\n } else if (\n event.clientX >= stepDownRect.x &&\n event.clientY >= stepDownRect.y &&\n event.clientX <= stepDownRect.x + stepDownRect.width &&\n event.clientY <= stepDownRect.y + stepDownRect.height\n ) {\n this.change = (event: PointerEvent) =>\n this.decrement(event.shiftKey ? this.stepModifier : 1);\n }\n };\n this.findChange(event);\n this.startChange(event);\n }\n\n private startChange(event: PointerEvent): void {\n this.changeCount = 0;\n this.doChange(event);\n this.safty = setTimeout(() => {\n this.doNextChange(event);\n }, 400) as unknown as number;\n }\n\n private doChange(event: PointerEvent): void {\n this.change(event);\n }\n\n private handlePointermove(event: PointerEvent): void {\n this.findChange(event);\n }\n\n private handlePointerup(event: PointerEvent): void {\n this.buttons.releasePointerCapture(event.pointerId);\n cancelAnimationFrame(this.nextChange);\n clearTimeout(this.safty);\n this.managedInput = false;\n this.setValue();\n }\n\n private doNextChange(event: PointerEvent): number {\n this.changeCount += 1;\n if (this.changeCount % FRAMES_PER_CHANGE === 0) {\n this.doChange(event);\n }\n return requestAnimationFrame(() => {\n this.nextChange = this.doNextChange(event);\n });\n }\n\n private stepBy(count: number): void {\n if (this.disabled || this.readonly) {\n return;\n }\n const min = typeof this.min !== 'undefined' ? this.min : 0;\n let value = this.value;\n value += count * this._step;\n if (isNaN(this.value)) {\n value = min;\n }\n value = this.valueWithLimits(value);\n\n this.requestUpdate();\n this._value = this.validateInput(value);\n this.inputElement.value = this.numberFormatter.format(value);\n\n this.inputElement.dispatchEvent(\n new Event('input', { bubbles: true, composed: true })\n );\n this.indeterminate = false;\n this.focus();\n }\n\n private increment(factor = 1): void {\n this.stepBy(1 * factor);\n }\n\n private decrement(factor = 1): void {\n this.stepBy(-1 * factor);\n }\n\n private handleKeydown(event: KeyboardEvent): void {\n if (this.isComposing) return;\n switch (event.code) {\n case 'ArrowUp':\n event.preventDefault();\n this.increment(event.shiftKey ? this.stepModifier : 1);\n this.setValue();\n break;\n case 'ArrowDown':\n event.preventDefault();\n this.decrement(event.shiftKey ? this.stepModifier : 1);\n this.setValue();\n break;\n }\n }\n\n private queuedChangeEvent!: number;\n\n protected onScroll(event: WheelEvent): void {\n event.preventDefault();\n this.managedInput = true;\n const direction = event.shiftKey\n ? event.deltaX / Math.abs(event.deltaX)\n : event.deltaY / Math.abs(event.deltaY);\n if (direction !== 0 && !isNaN(direction)) {\n this.stepBy(direction * (event.shiftKey ? this.stepModifier : 1));\n clearTimeout(this.queuedChangeEvent);\n this.queuedChangeEvent = setTimeout(() => {\n this.setValue();\n }, CHANGE_DEBOUNCE_MS) as unknown as number;\n }\n this.managedInput = false;\n }\n\n protected override onFocus(): void {\n super.onFocus();\n this._trackingValue = this.inputValue;\n this.keyboardFocused = !this.readonly && true;\n this.addEventListener('wheel', this.onScroll, { passive: false });\n this.valueBeforeFocus = this.inputElement.value;\n }\n\n protected override onBlur(_event: FocusEvent): void {\n super.onBlur(_event);\n this.keyboardFocused = !this.readonly && false;\n this.removeEventListener('wheel', this.onScroll);\n this.isIntentDecimal = false;\n }\n\n private handleFocusin(): void {\n this.focused = !this.readonly && true;\n this.keyboardFocused = !this.readonly && true;\n }\n\n private handleFocusout(): void {\n this.focused = !this.readonly && false;\n this.keyboardFocused = !this.readonly && false;\n }\n\n private wasIndeterminate = false;\n private indeterminateValue?: number;\n\n protected override handleChange(): void {\n const value = this.convertValueToNumber(this.inputValue);\n if (this.wasIndeterminate) {\n this.wasIndeterminate = false;\n this.indeterminateValue = undefined;\n if (isNaN(value)) {\n this.indeterminate = true;\n return;\n }\n }\n this.setValue(value);\n this.inputElement.value = this.formattedValue;\n }\n\n protected handleCompositionStart(): void {\n this.isComposing = true;\n }\n\n protected handleCompositionEnd(): void {\n this.isComposing = false;\n requestAnimationFrame(() => {\n this.inputElement.dispatchEvent(\n new Event('input', {\n composed: true,\n bubbles: true,\n })\n );\n });\n }\n\n private hasRecentlyReceivedPointerDown = false;\n\n protected override handleInputElementPointerdown(): void {\n this.hasRecentlyReceivedPointerDown = true;\n this.updateComplete.then(() => {\n requestAnimationFrame(() => {\n this.hasRecentlyReceivedPointerDown = false;\n });\n });\n }\n\n protected override handleInput(event: InputEvent): void {\n if (this.isComposing) {\n event.stopPropagation();\n return;\n }\n if (this.indeterminate) {\n this.wasIndeterminate = true;\n this.indeterminateValue = this.value;\n this.inputElement.value = this.inputElement.value.replace(\n indeterminatePlaceholder,\n ''\n );\n }\n if (event.data && this.decimalsChars.has(event.data))\n this.isIntentDecimal = true;\n\n const { value: originalValue, selectionStart } = this.inputElement;\n const value = originalValue\n .split('')\n .map((char) => remapMultiByteCharacters[char] || char)\n .join('');\n\n if (this.numberParser.isValidPartialNumber(value)) {\n // Use starting value as this.value is the `input` value.\n this.lastCommitedValue = this.lastCommitedValue ?? this.value;\n const valueAsNumber = this.convertValueToNumber(value);\n if (!value && this.indeterminateValue) {\n this.indeterminate = true;\n this._value = this.indeterminateValue;\n } else {\n this.indeterminate = false;\n this._value = this.validateInput(valueAsNumber);\n }\n this._trackingValue = value;\n this.inputElement.value = value;\n this.inputElement.setSelectionRange(selectionStart, selectionStart);\n return;\n } else {\n this.inputElement.value = this.indeterminate\n ? indeterminatePlaceholder\n : this._trackingValue;\n }\n const currentLength = value.length;\n const previousLength = this._trackingValue.length;\n const nextSelectStart =\n (selectionStart || currentLength) -\n (currentLength - previousLength);\n this.inputElement.setSelectionRange(nextSelectStart, nextSelectStart);\n }\n\n private valueWithLimits(nextValue: number): number {\n let value = nextValue;\n if (typeof this.min !== 'undefined') {\n value = Math.max(this.min, value);\n }\n if (typeof this.max !== 'undefined') {\n value = Math.min(this.max, value);\n }\n return value;\n }\n\n private validateInput(value: number): number {\n value = this.valueWithLimits(value);\n const signMultiplier = value < 0 ? -1 : 1; // 'signMultiplier' adjusts 'value' for 'validateInput' and reverts it before returning.\n value *= signMultiplier;\n\n // Step shouldn't validate when 0...\n if (this.step) {\n const min = typeof this.min !== 'undefined' ? this.min : 0;\n const moduloStep = parseFloat(\n this.valueFormatter.format((value - min) % this.step)\n );\n const fallsOnStep = moduloStep === 0;\n if (!fallsOnStep) {\n const overUnder = Math.round(moduloStep / this.step);\n if (overUnder === 1) {\n value += this.step - moduloStep;\n } else {\n value -= moduloStep;\n }\n }\n if (typeof this.max !== 'undefined') {\n while (value > this.max) {\n value -= this.step;\n }\n }\n value = parseFloat(this.valueFormatter.format(value));\n }\n value *= signMultiplier;\n return value;\n }\n\n protected override get displayValue(): string {\n const indeterminateValue = this.focused ? '' : indeterminatePlaceholder;\n return this.indeterminate ? indeterminateValue : this.formattedValue;\n }\n\n protected clearNumberFormatterCache(): void {\n this._numberFormatter = undefined;\n this._numberParser = undefined;\n }\n\n protected get numberFormatter(): NumberFormatter {\n if (!this._numberFormatter || !this._numberFormatterFocused) {\n const {\n style,\n unit,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n unitDisplay,\n ...formatOptionsNoUnit\n } = this.formatOptions;\n if (style !== 'unit') {\n (formatOptionsNoUnit as Intl.NumberFormatOptions).style = style;\n }\n this._numberFormatterFocused = new NumberFormatter(\n this.languageResolver.language,\n formatOptionsNoUnit\n );\n try {\n this._numberFormatter = new NumberFormatter(\n this.languageResolver.language,\n this.formatOptions\n );\n this._forcedUnit = '';\n this._numberFormatter.format(1);\n } catch (error) {\n if (style === 'unit') {\n this._forcedUnit = unit as string;\n }\n this._numberFormatter = this._numberFormatterFocused;\n }\n }\n return this.focused\n ? this._numberFormatterFocused\n : this._numberFormatter;\n }\n\n protected clearValueFormatterCache(): void {\n this._valueFormatter = undefined;\n }\n protected get valueFormatter(): NumberFormatter {\n if (!this._valueFormatter) {\n const digitsAfterDecimal = this.step\n ? this.step != Math.floor(this.step)\n ? this.step.toString().split('.')[1].length\n : 0\n : 0;\n this._valueFormatter = new NumberFormatter('en', {\n useGrouping: false,\n maximumFractionDigits: digitsAfterDecimal,\n });\n }\n\n return this._valueFormatter;\n }\n private _numberFormatter?: NumberFormatter;\n private _numberFormatterFocused?: NumberFormatter;\n private _valueFormatter?: NumberFormatter;\n protected get numberParser(): NumberParser {\n if (!this._numberParser || !this._numberParserFocused) {\n const {\n style,\n unit,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n unitDisplay,\n ...formatOptionsNoUnit\n } = this.formatOptions;\n if (style !== 'unit') {\n (formatOptionsNoUnit as Intl.NumberFormatOptions).style = style;\n }\n this._numberParserFocused = new NumberParser(\n this.languageResolver.language,\n formatOptionsNoUnit\n );\n try {\n this._numberParser = new NumberParser(\n this.languageResolver.language,\n this.formatOptions\n );\n this._forcedUnit = '';\n this._numberParser.parse('0');\n } catch (error) {\n if (style === 'unit') {\n this._forcedUnit = unit as string;\n }\n this._numberParser = this._numberParserFocused;\n }\n }\n return this.focused ? this._numberParserFocused : this._numberParser;\n }\n\n applyFocusElementLabel = (value?: string): void => {\n this.appliedLabel = value;\n };\n\n private _numberParser?: NumberParser;\n private _numberParserFocused?: NumberParser;\n\n protected override renderField(): TemplateResult {\n this.autocomplete = 'off';\n return html`\n ${super.renderField()}\n ${this.hideStepper\n ? nothing\n : html`\n <span\n class=\"buttons\"\n @focusin=${this.handleFocusin}\n @focusout=${this.handleFocusout}\n ${streamingListener({\n start: ['pointerdown', this.handlePointerdown],\n streamInside: [\n [\n 'pointermove',\n 'pointerenter',\n 'pointerleave',\n 'pointerover',\n 'pointerout',\n ],\n this.handlePointermove,\n ],\n end: [\n [\n 'pointerup',\n 'pointercancel',\n 'pointerleave',\n ],\n this.handlePointerup,\n ],\n })}\n >\n <sp-infield-button\n inline=\"end\"\n block=\"start\"\n class=\"button step-up\"\n aria-describedby=${this.helpTextId}\n label=${'Increase ' + this.appliedLabel}\n size=${this.size}\n tabindex=\"-1\"\n ?focused=${this.focused}\n ?disabled=${this.disabled ||\n this.readonly ||\n (typeof this.max !== 'undefined' &&\n this.value === this.max)}\n ?quiet=${this.quiet}\n >\n ${chevronIcon[this.size]('Up')}\n </sp-infield-button>\n <sp-infield-button\n inline=\"end\"\n block=\"end\"\n class=\"button step-down\"\n aria-describedby=${this.helpTextId}\n label=${'Decrease ' + this.appliedLabel}\n size=${this.size}\n tabindex=\"-1\"\n ?focused=${this.focused}\n ?disabled=${this.disabled ||\n this.readonly ||\n (typeof this.min !== 'undefined' &&\n this.value === this.min)}\n ?quiet=${this.quiet}\n >\n ${chevronIcon[this.size]('Down')}\n </sp-infield-button>\n </span>\n `}\n `;\n }\n\n protected override update(changes: PropertyValues): void {\n if (changes.has('formatOptions') || changes.has('resolvedLanguage')) {\n this.clearNumberFormatterCache();\n }\n if (changes.has('value') || changes.has('max') || changes.has('min')) {\n const value = this.numberParser.parse(\n this.formattedValue.replace(this._forcedUnit, '')\n );\n this.value = value;\n }\n if (changes.has('step')) {\n this.clearValueFormatterCache();\n }\n super.update(changes);\n }\n\n public override willUpdate(changes: PropertyValues): void {\n this.multiline = false;\n if (changes.has(languageResolverUpdatedSymbol)) {\n this.clearNumberFormatterCache();\n }\n }\n\n private isComposing = false;\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.addEventListener('keydown', this.handleKeydown);\n this.addEventListener('compositionstart', this.handleCompositionStart);\n this.addEventListener('compositionend', this.handleCompositionEnd);\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n if (!this.inputElement || !this.isConnected) {\n // Prevent race conditions if inputElement is removed from DOM while a queued update is still running.\n return;\n }\n\n if (changes.has('min') || changes.has('formatOptions')) {\n const hasOnlyPositives =\n typeof this.min !== 'undefined' && this.min >= 0;\n\n const { maximumFractionDigits } =\n this.numberFormatter.resolvedOptions();\n const hasDecimals =\n maximumFractionDigits && maximumFractionDigits > 0;\n\n let inputMode = 'numeric';\n /* c8 ignore next 5 */\n // iPhone doesn't have a minus sign in either numeric or decimal.\n if (isIPhone() && !hasOnlyPositives) inputMode = 'text';\n else if (isIOS() && hasDecimals) inputMode = 'decimal';\n // Android numeric has both a decimal point and minus key. Decimal does not have a minus key.\n else if (isAndroid() && hasDecimals && hasOnlyPositives)\n inputMode = 'decimal';\n\n this.inputElement.inputMode = inputMode;\n }\n if (\n changes.has('focused') &&\n this.focused &&\n !this.hasRecentlyReceivedPointerDown &&\n !!this.formatOptions.unit\n ) {\n // Normalize keyboard focus entry between unit and non-unit bearing Number Fields\n this.setSelectionRange(0, this.displayValue.length);\n }\n }\n}\n"],
5
- "mappings": "qNAYA,OAAS,mBAAAA,EAAiB,gBAAAC,MAAoB,4BAC9C,OAEI,QAAAC,EACA,WAAAC,MAGG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDACP,OAAS,qBAAAC,MAAyB,0DAClC,OACI,gCAAAC,EACA,iCAAAC,MACG,0EAEP,OAAOC,MAAmB,iEAC1B,MAAO,gEACP,MAAO,gEACP,MAAO,+DACP,MAAO,+DACP,MAAO,+DACP,OACI,aAAAC,EACA,SAAAC,EACA,YAAAC,MACG,kDACP,OAAS,iBAAAC,MAAqB,qCAC9B,OAAOC,MAA0B,kEACjC,OAAOC,MAAY,wBAEZ,aAAM,kBAAoB,EAEpB,mBAAqB,IACrB,yBAA2B,IAC3B,yBAAmD,CAC5D,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,OAAG,IACH,OAAG,IACH,OAAG,IACH,OAAG,IACH,OAAG,IACH,OAAG,IACH,OAAG,IACH,OAAG,IACH,OAAG,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KAAM,QAAS,QAAS,GAAM,UAAW,cAAe,CAAC,GA3B5D,YA4BF,2BAGA4D,EAAA,CADN5D,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GA9BjC,YA+BF,6BAGA4D,EAAA,CADN5D,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,kBAAmB,CAAC,GAjChE,YAkCF,+BAGA4D,EAAA,CADN5D,EAAS,CAAE,KAAM,MAAO,CAAC,GApCjB,YAqCF,mBAGA4D,EAAA,CADN5D,EAAS,CAAE,KAAM,MAAO,CAAC,GAvCjB,YAwCF,mBASA4D,EAAA,CADN5D,EAAS,CAAE,KAAM,MAAO,CAAC,GAhDjB,YAiDF,oBAKA4D,EAAA,CADN5D,EAAS,CAAE,KAAM,OAAQ,QAAS,GAAM,UAAW,eAAgB,CAAC,GArD5D,YAsDF,4BAGa4D,EAAA,CADnB5D,EAAS,CAAE,KAAM,MAAO,CAAC,GAxDjB,YAyDW",
6
- "names": ["NumberFormatter", "NumberParser", "html", "nothing", "property", "query", "streamingListener", "LanguageResolutionController", "languageResolverUpdatedSymbol", "chevronStyles", "isAndroid", "isIOS", "isIPhone", "TextfieldBase", "chevronIconOverrides", "styles", "chevronIcon", "dir", "value", "rawValue", "oldValue", "newValue", "previousValue", "inputValue", "normalizedValue", "char", "separators", "uniqueSeparators", "replacementDecimal", "part", "separator", "hasReplacedDecimal", "valueChars", "index", "_a", "event", "stepUpRect", "stepDownRect", "count", "min", "factor", "direction", "_event", "originalValue", "selectionStart", "valueAsNumber", "currentLength", "previousLength", "nextSelectStart", "nextValue", "signMultiplier", "moduloStep", "indeterminateValue", "style", "unit", "unitDisplay", "formatOptionsNoUnit", "error", "digitsAfterDecimal", "changes", "hasOnlyPositives", "maximumFractionDigits", "hasDecimals", "inputMode", "__decorateClass"]
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { NumberFormatter, NumberParser } from '@internationalized/number';\nimport {\n CSSResultArray,\n html,\n nothing,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { streamingListener } from '@spectrum-web-components/base/src/streaming-listener.js';\nimport {\n LanguageResolutionController,\n languageResolverUpdatedSymbol,\n} from '@spectrum-web-components/reactive-controllers/src/LanguageResolution.js';\n\nimport chevronStyles from '@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron100.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron200.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron50.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron75.js';\nimport '@spectrum-web-components/infield-button/sp-infield-button.js';\nimport {\n isAndroid,\n isIOS,\n isIPhone,\n} from '@spectrum-web-components/shared/src/platform.js';\nimport { TextfieldBase } from '@spectrum-web-components/textfield';\nimport chevronIconOverrides from '@spectrum-web-components/icon/src/icon-chevron-overrides.css.js';\nimport styles from './number-field.css.js';\n\nexport const FRAMES_PER_CHANGE = 5;\n// Debounce duration for inserting a `change` event after a batch of `wheel` originating `input` events.\nexport const CHANGE_DEBOUNCE_MS = 100;\nexport const indeterminatePlaceholder = '-';\nexport const remapMultiByteCharacters: Record<string, string> = {\n '\uFF11': '1',\n '\uFF12': '2',\n '\uFF13': '3',\n '\uFF14': '4',\n '\uFF15': '5',\n '\uFF16': '6',\n '\uFF17': '7',\n '\uFF18': '8',\n '\uFF19': '9',\n '\uFF10': '0',\n '\u3001': ',',\n '\uFF0C': ',',\n '\u3002': '.',\n '\uFF0E': '.',\n '\uFF05': '%',\n '\uFF0B': '+',\n \u30FC: '-',\n \u4E00: '1',\n \u4E8C: '2',\n \u4E09: '3',\n \u56DB: '4',\n \u4E94: '5',\n \u516D: '6',\n \u4E03: '7',\n \u516B: '8',\n \u4E5D: '9',\n \u96F6: '0',\n};\nconst chevronIcon: Record<string, (dir: 'Down' | 'Up') => TemplateResult> = {\n s: (dir) => html`\n <sp-icon-chevron50\n class=\"stepper-icon spectrum-UIIcon-Chevron${dir}50\"\n ></sp-icon-chevron50>\n `,\n m: (dir) => html`\n <sp-icon-chevron75\n class=\"stepper-icon spectrum-UIIcon-Chevron${dir}75\"\n ></sp-icon-chevron75>\n `,\n l: (dir) => html`\n <sp-icon-chevron100\n class=\"stepper-icon spectrum-UIIcon-Chevron${dir}100\"\n ></sp-icon-chevron100>\n `,\n xl: (dir) => html`\n <sp-icon-chevron200\n class=\"stepper-icon spectrum-UIIcon-Chevron${dir}200\"\n ></sp-icon-chevron200>\n `,\n};\n\n/**\n * @element sp-number-field\n * @slot help-text - default or non-negative help text to associate to your form element\n * @slot negative-help-text - negative help text to associate to your form element when `invalid`\n */\nexport class NumberField extends TextfieldBase {\n public static override get styles(): CSSResultArray {\n return [...super.styles, styles, chevronStyles, chevronIconOverrides];\n }\n\n @query('.buttons')\n private buttons!: HTMLDivElement;\n\n @property({ type: Boolean, reflect: true })\n public override focused = false;\n\n _forcedUnit = '';\n\n /**\n * An `&lt;sp-number-field&gt;` element will process its numeric value with\n * `new Intl.NumberFormat(this.resolvedLanguage, this.formatOptions).format(this.valueAsNumber)`\n * in order to prepare it for visual delivery in the input. In order to customize this\n * processing supply your own `Intl.NumberFormatOptions` object here.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat\n */\n @property({ type: Object, attribute: 'format-options' })\n public formatOptions: Intl.NumberFormatOptions = {};\n\n /**\n * Whether the stepper UI is hidden or not.\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-stepper' })\n public hideStepper = false;\n\n @property({ type: Boolean, reflect: true })\n public indeterminate = false;\n\n @property({ type: Boolean, reflect: true, attribute: 'keyboard-focused' })\n public keyboardFocused = false;\n\n @property({ type: Number })\n public max?: number;\n\n @property({ type: Number })\n public min?: number;\n\n /**\n * The distance by which to alter the value of the element when taking a \"step\".\n *\n * When `this.formatOptions.style === 'percentage'` the default step will be\n * set to 0.01 unless otherwise supplied to the element.\n */\n @property({ type: Number })\n public step?: number;\n\n public managedInput = false;\n\n @property({ type: Number, reflect: true, attribute: 'step-modifier' })\n public stepModifier = 10;\n\n @property({ type: Number })\n public override set value(rawValue: number) {\n const value = this.validateInput(rawValue);\n if (value === this.value) {\n return;\n }\n this.lastCommitedValue = value;\n const oldValue = this._value;\n this._value = value;\n this.requestUpdate('value', oldValue);\n }\n\n public override get value(): number {\n return this._value;\n }\n\n private get inputValue(): string {\n return this.indeterminate\n ? this.formattedValue\n : this.inputElement.value;\n }\n\n public override _value = NaN;\n private _trackingValue = '';\n private lastCommitedValue?: number;\n\n private setValue(newValue: number = this.value): void {\n // Capture previous value for accurate IME change detection\n const previousValue = this.lastCommitedValue;\n\n this.value = newValue;\n\n if (\n typeof previousValue === 'undefined' ||\n previousValue === this.value\n ) {\n // Do not announce when the value is unchanged.\n return;\n }\n\n this.lastCommitedValue = this.value;\n\n this.dispatchEvent(\n new Event('change', { bubbles: true, composed: true })\n );\n }\n\n /**\n * Retreive the value of the element parsed to a Number.\n */\n public get valueAsString(): string {\n return this._value.toString();\n }\n\n public set valueAsString(value: string) {\n this.value = this.numberParser.parse(value);\n }\n\n public get formattedValue(): string {\n if (isNaN(this.value)) return '';\n return (\n this.numberFormatter.format(this.value) +\n (this.focused ? '' : this._forcedUnit)\n );\n }\n\n private decimalsChars = new Set(['.', ',']);\n private valueBeforeFocus: string = '';\n private isIntentDecimal: boolean = false;\n\n private convertValueToNumber(inputValue: string): number {\n // Normalize full-width characters to their ASCII equivalents\n let normalizedValue = inputValue\n .split('')\n .map((char) => remapMultiByteCharacters[char] || char)\n .join('');\n\n const separators = this.valueBeforeFocus\n .split('')\n .filter((char) => this.decimalsChars.has(char));\n const uniqueSeparators = new Set(separators);\n\n if (\n isIOS() &&\n this.inputElement.inputMode === 'decimal' &&\n normalizedValue !== this.valueBeforeFocus\n ) {\n const parts = this.numberFormatter.formatToParts(1000.1);\n\n const replacementDecimal = parts.find(\n (part) => part.type === 'decimal'\n )!.value;\n\n for (const separator of uniqueSeparators) {\n const isDecimalSeparator = separator === replacementDecimal;\n if (!isDecimalSeparator && !this.isIntentDecimal) {\n normalizedValue = normalizedValue.replace(\n new RegExp(separator, 'g'),\n ''\n );\n }\n }\n\n let hasReplacedDecimal = false;\n const valueChars = normalizedValue.split('');\n for (let index = valueChars.length - 1; index >= 0; index--) {\n const char = valueChars[index];\n if (this.decimalsChars.has(char)) {\n if (!hasReplacedDecimal) {\n valueChars[index] = replacementDecimal;\n hasReplacedDecimal = true;\n } else valueChars[index] = '';\n }\n }\n normalizedValue = valueChars.join('');\n }\n return this.numberParser.parse(normalizedValue);\n }\n private get _step(): number {\n if (typeof this.step !== 'undefined') {\n return this.step;\n }\n if (this.formatOptions?.style === 'percent') {\n return 0.01;\n }\n return 1;\n }\n\n private nextChange!: number;\n private changeCount = 0;\n private findChange!: (event: PointerEvent) => void;\n private change!: (event: PointerEvent) => void;\n private safty!: number;\n private languageResolver = new LanguageResolutionController(this);\n\n private handlePointerdown(event: PointerEvent): void {\n if (event.button !== 0) {\n event.preventDefault();\n return;\n }\n this.managedInput = true;\n this.buttons.setPointerCapture(event.pointerId);\n const stepUpRect = this.buttons.children[0].getBoundingClientRect();\n const stepDownRect = this.buttons.children[1].getBoundingClientRect();\n this.findChange = (event: PointerEvent) => {\n if (\n event.clientX >= stepUpRect.x &&\n event.clientY >= stepUpRect.y &&\n event.clientX <= stepUpRect.x + stepUpRect.width &&\n event.clientY <= stepUpRect.y + stepUpRect.height\n ) {\n this.change = (event: PointerEvent) =>\n this.increment(event.shiftKey ? this.stepModifier : 1);\n } else if (\n event.clientX >= stepDownRect.x &&\n event.clientY >= stepDownRect.y &&\n event.clientX <= stepDownRect.x + stepDownRect.width &&\n event.clientY <= stepDownRect.y + stepDownRect.height\n ) {\n this.change = (event: PointerEvent) =>\n this.decrement(event.shiftKey ? this.stepModifier : 1);\n }\n };\n this.findChange(event);\n this.startChange(event);\n }\n\n private startChange(event: PointerEvent): void {\n this.changeCount = 0;\n this.doChange(event);\n this.safty = setTimeout(() => {\n this.doNextChange(event);\n }, 400) as unknown as number;\n }\n\n private doChange(event: PointerEvent): void {\n this.change(event);\n }\n\n private handlePointermove(event: PointerEvent): void {\n this.findChange(event);\n }\n\n private handlePointerup(event: PointerEvent): void {\n this.buttons.releasePointerCapture(event.pointerId);\n cancelAnimationFrame(this.nextChange);\n clearTimeout(this.safty);\n this.managedInput = false;\n this.setValue();\n }\n\n private doNextChange(event: PointerEvent): number {\n this.changeCount += 1;\n if (this.changeCount % FRAMES_PER_CHANGE === 0) {\n this.doChange(event);\n }\n return requestAnimationFrame(() => {\n this.nextChange = this.doNextChange(event);\n });\n }\n\n private stepBy(count: number): void {\n if (this.disabled || this.readonly) {\n return;\n }\n const min = typeof this.min !== 'undefined' ? this.min : 0;\n let value = this.value;\n value += count * this._step;\n if (isNaN(this.value)) {\n value = min;\n }\n value = this.valueWithLimits(value);\n\n this.requestUpdate();\n this._value = this.validateInput(value);\n this.inputElement.value = this.numberFormatter.format(value);\n\n this.inputElement.dispatchEvent(\n new Event('input', { bubbles: true, composed: true })\n );\n this.indeterminate = false;\n this.focus();\n }\n\n private increment(factor = 1): void {\n this.stepBy(1 * factor);\n }\n\n private decrement(factor = 1): void {\n this.stepBy(-1 * factor);\n }\n\n private handleKeydown(event: KeyboardEvent): void {\n if (this.isComposing) return;\n switch (event.code) {\n case 'ArrowUp':\n event.preventDefault();\n this.increment(event.shiftKey ? this.stepModifier : 1);\n this.setValue();\n break;\n case 'ArrowDown':\n event.preventDefault();\n this.decrement(event.shiftKey ? this.stepModifier : 1);\n this.setValue();\n break;\n }\n }\n\n private queuedChangeEvent!: number;\n\n protected onScroll(event: WheelEvent): void {\n event.preventDefault();\n this.managedInput = true;\n const direction = event.shiftKey\n ? event.deltaX / Math.abs(event.deltaX)\n : event.deltaY / Math.abs(event.deltaY);\n if (direction !== 0 && !isNaN(direction)) {\n this.stepBy(direction * (event.shiftKey ? this.stepModifier : 1));\n clearTimeout(this.queuedChangeEvent);\n this.queuedChangeEvent = setTimeout(() => {\n this.setValue();\n }, CHANGE_DEBOUNCE_MS) as unknown as number;\n }\n this.managedInput = false;\n }\n\n protected override onFocus(): void {\n super.onFocus();\n this._trackingValue = this.inputValue;\n this.keyboardFocused = !this.readonly && true;\n this.addEventListener('wheel', this.onScroll, { passive: false });\n this.valueBeforeFocus = this.inputElement.value;\n }\n\n protected override onBlur(_event: FocusEvent): void {\n super.onBlur(_event);\n this.keyboardFocused = !this.readonly && false;\n this.removeEventListener('wheel', this.onScroll);\n this.isIntentDecimal = false;\n }\n\n private handleFocusin(): void {\n this.focused = !this.readonly && true;\n this.keyboardFocused = !this.readonly && true;\n }\n\n private handleFocusout(): void {\n this.focused = !this.readonly && false;\n this.keyboardFocused = !this.readonly && false;\n }\n\n private wasIndeterminate = false;\n private indeterminateValue?: number;\n\n protected override handleChange(): void {\n const value = this.convertValueToNumber(this.inputValue);\n if (this.wasIndeterminate) {\n this.wasIndeterminate = false;\n this.indeterminateValue = undefined;\n if (isNaN(value)) {\n this.indeterminate = true;\n return;\n }\n }\n this.setValue(value);\n this.inputElement.value = this.formattedValue;\n }\n\n protected handleCompositionStart(): void {\n this.isComposing = true;\n }\n\n protected handleCompositionEnd(): void {\n this.isComposing = false;\n requestAnimationFrame(() => {\n this.inputElement.dispatchEvent(\n new Event('input', {\n composed: true,\n bubbles: true,\n })\n );\n });\n }\n\n private hasRecentlyReceivedPointerDown = false;\n\n protected override handleInputElementPointerdown(): void {\n this.hasRecentlyReceivedPointerDown = true;\n this.updateComplete.then(() => {\n requestAnimationFrame(() => {\n this.hasRecentlyReceivedPointerDown = false;\n });\n });\n }\n\n protected override handleInput(event: InputEvent): void {\n if (this.isComposing) {\n // If user actually types a new character.\n if (event.data) {\n // Don't allow non-numeric characters even in composing mode.\n const partialValue = this.convertValueToNumber(event.data);\n\n if (Number.isNaN(partialValue)) {\n this.inputElement.value = this.indeterminate\n ? indeterminatePlaceholder\n : this._trackingValue;\n\n this.isComposing = false;\n }\n }\n\n event.stopPropagation();\n return;\n }\n if (this.indeterminate) {\n this.wasIndeterminate = true;\n this.indeterminateValue = this.value;\n this.inputElement.value = this.inputElement.value.replace(\n indeterminatePlaceholder,\n ''\n );\n }\n if (event.data && this.decimalsChars.has(event.data))\n this.isIntentDecimal = true;\n\n const { value: originalValue, selectionStart } = this.inputElement;\n const value = originalValue\n .split('')\n .map((char) => remapMultiByteCharacters[char] || char)\n .join('');\n\n if (this.numberParser.isValidPartialNumber(value)) {\n // Use starting value as this.value is the `input` value.\n this.lastCommitedValue = this.lastCommitedValue ?? this.value;\n const valueAsNumber = this.convertValueToNumber(value);\n if (!value && this.indeterminateValue) {\n this.indeterminate = true;\n this._value = this.indeterminateValue;\n } else {\n this.indeterminate = false;\n this._value = this.validateInput(valueAsNumber);\n }\n this._trackingValue = value;\n this.inputElement.value = value;\n this.inputElement.setSelectionRange(selectionStart, selectionStart);\n return;\n } else {\n this.inputElement.value = this.indeterminate\n ? indeterminatePlaceholder\n : this._trackingValue;\n\n // Don't emit input event when the character is invalid.\n event.stopPropagation();\n }\n const currentLength = value.length;\n const previousLength = this._trackingValue.length;\n const nextSelectStart =\n (selectionStart || currentLength) -\n (currentLength - previousLength);\n this.inputElement.setSelectionRange(nextSelectStart, nextSelectStart);\n }\n\n private valueWithLimits(nextValue: number): number {\n let value = nextValue;\n if (typeof this.min !== 'undefined') {\n value = Math.max(this.min, value);\n }\n if (typeof this.max !== 'undefined') {\n value = Math.min(this.max, value);\n }\n return value;\n }\n\n private validateInput(value: number): number {\n value = this.valueWithLimits(value);\n const signMultiplier = value < 0 ? -1 : 1; // 'signMultiplier' adjusts 'value' for 'validateInput' and reverts it before returning.\n value *= signMultiplier;\n\n // Step shouldn't validate when 0...\n if (this.step) {\n const min = typeof this.min !== 'undefined' ? this.min : 0;\n const moduloStep = parseFloat(\n this.valueFormatter.format((value - min) % this.step)\n );\n const fallsOnStep = moduloStep === 0;\n if (!fallsOnStep) {\n const overUnder = Math.round(moduloStep / this.step);\n if (overUnder === 1) {\n value += this.step - moduloStep;\n } else {\n value -= moduloStep;\n }\n }\n if (typeof this.max !== 'undefined') {\n while (value > this.max) {\n value -= this.step;\n }\n }\n value = parseFloat(this.valueFormatter.format(value));\n }\n value *= signMultiplier;\n return value;\n }\n\n protected override get displayValue(): string {\n const indeterminateValue = this.focused ? '' : indeterminatePlaceholder;\n return this.indeterminate ? indeterminateValue : this.formattedValue;\n }\n\n protected clearNumberFormatterCache(): void {\n this._numberFormatter = undefined;\n this._numberParser = undefined;\n }\n\n protected get numberFormatter(): NumberFormatter {\n if (!this._numberFormatter || !this._numberFormatterFocused) {\n const {\n style,\n unit,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n unitDisplay,\n ...formatOptionsNoUnit\n } = this.formatOptions;\n if (style !== 'unit') {\n (formatOptionsNoUnit as Intl.NumberFormatOptions).style = style;\n }\n this._numberFormatterFocused = new NumberFormatter(\n this.languageResolver.language,\n formatOptionsNoUnit\n );\n try {\n this._numberFormatter = new NumberFormatter(\n this.languageResolver.language,\n this.formatOptions\n );\n this._forcedUnit = '';\n this._numberFormatter.format(1);\n } catch (error) {\n if (style === 'unit') {\n this._forcedUnit = unit as string;\n }\n this._numberFormatter = this._numberFormatterFocused;\n }\n }\n return this.focused\n ? this._numberFormatterFocused\n : this._numberFormatter;\n }\n\n protected clearValueFormatterCache(): void {\n this._valueFormatter = undefined;\n }\n protected get valueFormatter(): NumberFormatter {\n if (!this._valueFormatter) {\n const digitsAfterDecimal = this.step\n ? this.step != Math.floor(this.step)\n ? this.step.toString().split('.')[1].length\n : 0\n : 0;\n this._valueFormatter = new NumberFormatter('en', {\n useGrouping: false,\n maximumFractionDigits: digitsAfterDecimal,\n });\n }\n\n return this._valueFormatter;\n }\n private _numberFormatter?: NumberFormatter;\n private _numberFormatterFocused?: NumberFormatter;\n private _valueFormatter?: NumberFormatter;\n protected get numberParser(): NumberParser {\n if (!this._numberParser || !this._numberParserFocused) {\n const {\n style,\n unit,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n unitDisplay,\n ...formatOptionsNoUnit\n } = this.formatOptions;\n if (style !== 'unit') {\n (formatOptionsNoUnit as Intl.NumberFormatOptions).style = style;\n }\n this._numberParserFocused = new NumberParser(\n this.languageResolver.language,\n formatOptionsNoUnit\n );\n try {\n this._numberParser = new NumberParser(\n this.languageResolver.language,\n this.formatOptions\n );\n this._forcedUnit = '';\n this._numberParser.parse('0');\n } catch (error) {\n if (style === 'unit') {\n this._forcedUnit = unit as string;\n }\n this._numberParser = this._numberParserFocused;\n }\n }\n return this.focused ? this._numberParserFocused : this._numberParser;\n }\n\n applyFocusElementLabel = (value?: string): void => {\n this.appliedLabel = value;\n };\n\n private _numberParser?: NumberParser;\n private _numberParserFocused?: NumberParser;\n\n protected override renderField(): TemplateResult {\n this.autocomplete = 'off';\n return html`\n ${super.renderField()}\n ${this.hideStepper\n ? nothing\n : html`\n <span\n class=\"buttons\"\n @focusin=${this.handleFocusin}\n @focusout=${this.handleFocusout}\n ${streamingListener({\n start: ['pointerdown', this.handlePointerdown],\n streamInside: [\n [\n 'pointermove',\n 'pointerenter',\n 'pointerleave',\n 'pointerover',\n 'pointerout',\n ],\n this.handlePointermove,\n ],\n end: [\n [\n 'pointerup',\n 'pointercancel',\n 'pointerleave',\n ],\n this.handlePointerup,\n ],\n })}\n >\n <sp-infield-button\n inline=\"end\"\n block=\"start\"\n class=\"button step-up\"\n aria-hidden=\"true\"\n label=${'Increase ' + this.appliedLabel}\n size=${this.size}\n tabindex=\"-1\"\n ?focused=${this.focused}\n ?disabled=${this.disabled ||\n this.readonly ||\n (typeof this.max !== 'undefined' &&\n this.value === this.max)}\n ?quiet=${this.quiet}\n >\n ${chevronIcon[this.size]('Up')}\n </sp-infield-button>\n <sp-infield-button\n inline=\"end\"\n block=\"end\"\n class=\"button step-down\"\n aria-hidden=\"true\"\n label=${'Decrease ' + this.appliedLabel}\n size=${this.size}\n tabindex=\"-1\"\n ?focused=${this.focused}\n ?disabled=${this.disabled ||\n this.readonly ||\n (typeof this.min !== 'undefined' &&\n this.value === this.min)}\n ?quiet=${this.quiet}\n >\n ${chevronIcon[this.size]('Down')}\n </sp-infield-button>\n </span>\n `}\n `;\n }\n\n protected override update(changes: PropertyValues): void {\n if (changes.has('formatOptions') || changes.has('resolvedLanguage')) {\n this.clearNumberFormatterCache();\n }\n if (\n changes.has('value') ||\n changes.has('max') ||\n changes.has('min') ||\n changes.has('step')\n ) {\n const value = this.numberParser.parse(\n this.formattedValue.replace(this._forcedUnit, '')\n );\n this.value = value;\n this.clearValueFormatterCache();\n }\n super.update(changes);\n }\n\n public override willUpdate(changes: PropertyValues): void {\n this.multiline = false;\n if (changes.has(languageResolverUpdatedSymbol)) {\n this.clearNumberFormatterCache();\n }\n }\n\n private isComposing = false;\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.addEventListener('keydown', this.handleKeydown);\n this.addEventListener('compositionstart', this.handleCompositionStart);\n this.addEventListener('compositionend', this.handleCompositionEnd);\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n if (!this.inputElement || !this.isConnected) {\n // Prevent race conditions if inputElement is removed from DOM while a queued update is still running.\n return;\n }\n\n if (changes.has('min') || changes.has('formatOptions')) {\n const hasOnlyPositives =\n typeof this.min !== 'undefined' && this.min >= 0;\n\n const { maximumFractionDigits } =\n this.numberFormatter.resolvedOptions();\n const hasDecimals =\n maximumFractionDigits && maximumFractionDigits > 0;\n\n let inputMode = 'numeric';\n /* c8 ignore next 5 */\n // iPhone doesn't have a minus sign in either numeric or decimal.\n if (isIPhone() && !hasOnlyPositives) inputMode = 'text';\n else if (isIOS() && hasDecimals) inputMode = 'decimal';\n // Android numeric has both a decimal point and minus key. Decimal does not have a minus key.\n else if (isAndroid() && hasDecimals && hasOnlyPositives)\n inputMode = 'decimal';\n\n this.inputElement.inputMode = inputMode;\n }\n if (\n changes.has('focused') &&\n this.focused &&\n !this.hasRecentlyReceivedPointerDown &&\n !!this.formatOptions.unit\n ) {\n // Normalize keyboard focus entry between unit and non-unit bearing Number Fields\n this.setSelectionRange(0, this.displayValue.length);\n }\n }\n}\n"],
5
+ "mappings": "qNAYA,OAAS,mBAAAA,EAAiB,gBAAAC,MAAoB,4BAC9C,OAEI,QAAAC,EACA,WAAAC,MAGG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDACP,OAAS,qBAAAC,MAAyB,0DAClC,OACI,gCAAAC,EACA,iCAAAC,MACG,0EAEP,OAAOC,MAAmB,iEAC1B,MAAO,gEACP,MAAO,gEACP,MAAO,+DACP,MAAO,+DACP,MAAO,+DACP,OACI,aAAAC,EACA,SAAAC,EACA,YAAAC,MACG,kDACP,OAAS,iBAAAC,MAAqB,qCAC9B,OAAOC,MAA0B,kEACjC,OAAOC,MAAY,wBAEZ,aAAM,kBAAoB,EAEpB,mBAAqB,IACrB,yBAA2B,IAC3B,yBAAmD,CAC5D,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,OAAG,IACH,OAAG,IACH,OAAG,IACH,OAAG,IACH,OAAG,IACH,OAAG,IACH,OAAG,IACH,OAAG,IACH,OAAG,IACH,OAAG,IACH,OAAG,GACP,EACA,MAAMC,EAAsE,CACxE,EAAIC,GAAQf;AAAA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AAE,KAAM,OAAQ,UAAW,gBAAiB,CAAC,GArB9C,YAsBF,6BAMA6D,EAAA,CADN7D,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,cAAe,CAAC,GA3B5D,YA4BF,2BAGA6D,EAAA,CADN7D,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GA9BjC,YA+BF,6BAGA6D,EAAA,CADN7D,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,kBAAmB,CAAC,GAjChE,YAkCF,+BAGA6D,EAAA,CADN7D,EAAS,CAAE,KAAM,MAAO,CAAC,GApCjB,YAqCF,mBAGA6D,EAAA,CADN7D,EAAS,CAAE,KAAM,MAAO,CAAC,GAvCjB,YAwCF,mBASA6D,EAAA,CADN7D,EAAS,CAAE,KAAM,MAAO,CAAC,GAhDjB,YAiDF,oBAKA6D,EAAA,CADN7D,EAAS,CAAE,KAAM,OAAQ,QAAS,GAAM,UAAW,eAAgB,CAAC,GArD5D,YAsDF,4BAGa6D,EAAA,CADnB7D,EAAS,CAAE,KAAM,MAAO,CAAC,GAxDjB,YAyDW",
6
+ "names": ["NumberFormatter", "NumberParser", "html", "nothing", "property", "query", "streamingListener", "LanguageResolutionController", "languageResolverUpdatedSymbol", "chevronStyles", "isAndroid", "isIOS", "isIPhone", "TextfieldBase", "chevronIconOverrides", "styles", "chevronIcon", "dir", "value", "rawValue", "oldValue", "newValue", "previousValue", "inputValue", "normalizedValue", "char", "separators", "uniqueSeparators", "replacementDecimal", "part", "separator", "hasReplacedDecimal", "valueChars", "index", "_a", "event", "stepUpRect", "stepDownRect", "count", "min", "factor", "direction", "_event", "partialValue", "originalValue", "selectionStart", "valueAsNumber", "currentLength", "previousLength", "nextSelectStart", "nextValue", "signMultiplier", "moduloStep", "indeterminateValue", "style", "unit", "unitDisplay", "formatOptionsNoUnit", "error", "digitsAfterDecimal", "changes", "hasOnlyPositives", "maximumFractionDigits", "hasDecimals", "inputMode", "__decorateClass"]
7
7
  }
package/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
@@ -1,29 +0,0 @@
1
- "use strict";
2
- import { html } from "@spectrum-web-components/base";
3
- import "@spectrum-web-components/number-field/sp-number-field.js";
4
- import "@spectrum-web-components/field-label/sp-field-label.js";
5
- import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
6
- export default {
7
- component: "sp-number-field",
8
- title: "Number Field/Sizes"
9
- };
10
- const template = ({
11
- size
12
- } = {}) => {
13
- return html`
14
- <sp-field-label for="name" size=${ifDefined(size)}>
15
- Pick a number
16
- </sp-field-label>
17
- <sp-number-field
18
- id="name"
19
- size=${ifDefined(size)}
20
- value="100"
21
- ></sp-number-field>
22
- `;
23
- };
24
- export const s = () => template({ size: "s" });
25
- export const noSize = () => template();
26
- export const m = () => template({ size: "m" });
27
- export const l = () => template({ size: "l" });
28
- export const XL = () => template({ size: "xl" });
29
- //# sourceMappingURL=number-field-sizes.stories.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["number-field-sizes.stories.ts"],
4
- "sourcesContent": ["/*\nCopyright 2018 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/number-field/sp-number-field.js';\nimport '@spectrum-web-components/field-label/sp-field-label.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nexport default {\n component: 'sp-number-field',\n title: 'Number Field/Sizes',\n};\n\nconst template = ({\n size,\n}: {\n size?: 's' | 'm' | 'l' | 'xl';\n} = {}): TemplateResult => {\n return html`\n <sp-field-label for=\"name\" size=${ifDefined(size)}>\n Pick a number\n </sp-field-label>\n <sp-number-field\n id=\"name\"\n size=${ifDefined(size)}\n value=\"100\"\n ></sp-number-field>\n `;\n};\n\nexport const s = (): TemplateResult => template({ size: 's' });\nexport const noSize = (): TemplateResult => template();\nexport const m = (): TemplateResult => template({ size: 'm' });\nexport const l = (): TemplateResult => template({ size: 'l' });\nexport const XL = (): TemplateResult => template({ size: 'xl' });\n"],
5
- "mappings": ";AAWA,SAAS,YAA4B;AAErC,OAAO;AACP,OAAO;AACP,SAAS,iBAAiB;AAE1B,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AACX;AAEA,MAAM,WAAW,CAAC;AAAA,EACd;AACJ,IAEI,CAAC,MAAsB;AACvB,SAAO;AAAA,0CAC+B,UAAU,IAAI,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,mBAKtC,UAAU,IAAI,CAAC;AAAA;AAAA;AAAA;AAIlC;AAEO,aAAM,IAAI,MAAsB,SAAS,EAAE,MAAM,IAAI,CAAC;AACtD,aAAM,SAAS,MAAsB,SAAS;AAC9C,aAAM,IAAI,MAAsB,SAAS,EAAE,MAAM,IAAI,CAAC;AACtD,aAAM,IAAI,MAAsB,SAAS,EAAE,MAAM,IAAI,CAAC;AACtD,aAAM,KAAK,MAAsB,SAAS,EAAE,MAAM,KAAK,CAAC;",
6
- "names": []
7
- }