diff --git a/packages/changeset-form/addon/components/eui-changeset-form/fields/field-dual-range-slider/index.hbs b/packages/changeset-form/addon/components/eui-changeset-form/fields/field-dual-range-slider/index.hbs index 19836c90d..73c82dbbb 100644 --- a/packages/changeset-form/addon/components/eui-changeset-form/fields/field-dual-range-slider/index.hbs +++ b/packages/changeset-form/addon/components/eui-changeset-form/fields/field-dual-range-slider/index.hbs @@ -45,8 +45,8 @@ @inputRef={{@inputRef}} @controlOnly={{@controlOnly}} @autoSize={{@autoSize}} - @isFakePrependBlock={{not (has-block "prepend")}} - @isFakeAppendBlock={{not (has-block "append")}} + @isPrependProvided={{has-block "prepend"}} + @isAppendProvided={{has-block "append"}} @isFakeMinBlock={{not (has-block "min")}} @isFakeMaxBlock={{not (has-block "max")}} disabled={{@disabled}} @@ -67,4 +67,4 @@ -{{/let}} \ No newline at end of file +{{/let}} diff --git a/packages/changeset-form/addon/components/eui-changeset-form/fields/field-number/index.hbs b/packages/changeset-form/addon/components/eui-changeset-form/fields/field-number/index.hbs index 15507332a..54a32af20 100644 --- a/packages/changeset-form/addon/components/eui-changeset-form/fields/field-number/index.hbs +++ b/packages/changeset-form/addon/components/eui-changeset-form/fields/field-number/index.hbs @@ -34,8 +34,8 @@ {{!template-lint-disable}} @id={{theId}} @disabled={{@disabled}} - @isFakePrependBlock={{not (has-block "prepend")}} - @isFakeAppendBlock={{not (has-block "append")}} + @isPrependProvided={{has-block "prepend"}} + @isAppendProvided={{has-block "append"}} autofocus={{@autofocus}} placeholder={{@placeholder}} {{on "blur" this.validate}} @@ -50,4 +50,4 @@ -{{/let}} \ No newline at end of file +{{/let}} diff --git a/packages/changeset-form/addon/components/eui-changeset-form/fields/field-range-slider/index.hbs b/packages/changeset-form/addon/components/eui-changeset-form/fields/field-range-slider/index.hbs index 3a09f83fc..5702df43a 100644 --- a/packages/changeset-form/addon/components/eui-changeset-form/fields/field-range-slider/index.hbs +++ b/packages/changeset-form/addon/components/eui-changeset-form/fields/field-range-slider/index.hbs @@ -45,8 +45,8 @@ @inputRef={{@inputRef}} @controlOnly={{@controlOnly}} @autoSize={{@autoSize}} - @isFakePrependBlock={{not (has-block "prepend")}} - @isFakeAppendBlock={{not (has-block "append")}} + @isPrependProvided={{has-block "prepend"}} + @isAppendProvided={{has-block "append"}} @isFakeMinBlock={{not (has-block "min")}} @isFakeMaxBlock={{not (has-block "max")}} @isFakeValueBlock={{not (has-block "value")}} @@ -80,4 +80,4 @@ -{{/let}} \ No newline at end of file +{{/let}} diff --git a/packages/core/addon/components/eui-dual-range/index.hbs b/packages/core/addon/components/eui-dual-range/index.hbs index f2985712c..5ff4494a9 100644 --- a/packages/core/addon/components/eui-dual-range/index.hbs +++ b/packages/core/addon/components/eui-dual-range/index.hbs @@ -1,10 +1,9 @@ {{#let - (and (not (arg-or-default @isFakePrependBlock false)) (has-block "prepend")) - (and (not (arg-or-default @isFakeAppendBlock false)) (has-block "append")) + (and (arg-or-default @isPrependProvided true) (has-block "prepend")) + (and (arg-or-default @isAppendProvided true) (has-block "append")) (and (not (arg-or-default @isFakeMaxBlock false)) (has-block "max")) - (and - (not (arg-or-default @isFakeMinBlock false)) (has-block "min") - ) as |hasPrepend hasAppend hasMaxBlock hasMinBlock| + (and (not (arg-or-default @isFakeMinBlock false)) (has-block "min")) + as |hasPrepend hasAppend hasMaxBlock hasMinBlock| }} {{#if this.showInputOnly}} -
+ > + <:prepend as |classes|> + {{yield classes to="prepend"}} + + <:append as |classes|> + {{yield classes to="append"}} + + <:endControl as |classes|> -
+ > + <:prepend as |classes|> + {{yield classes to="prepend"}} + + <:append as |classes|> + {{yield classes to="append"}} + + <:append as |appendClasses|> {{yield appendClasses to="append"}} @@ -109,6 +120,7 @@ class="euiDualRange" @fullWidth={{this.fullWidth}} @compressed={{this.compressed}} + @showInput={{this.showInput}} > {{#if this.showLabels}} @@ -231,8 +243,8 @@ @readOnly={{@readOnly}} @fullWidth={{this.fullWidth}} @isInvalid={{@isInvalid}} - @isFakeAppendBlock={{true}} - @isFakePrependBlock={{true}} + @isPrependProvided={{false}} + @isAppendProvided={{false}} @controlOnly={{true}} @disable={{@disable}} ...attributes @@ -357,8 +369,8 @@ @fullWidth={{this.fullWidth}} @isInvalid={{@isInvalid}} @controlOnly={{this.showInputOnly}} - @isFakeAppendBlock={{true}} - @isFakePrependBlock={{true}} + @isPrependProvided={{false}} + @isAppendProvided={{false}} @disable={{@disable}} ...attributes {{on-key "_all" this.handleInputKeyDown}} @@ -369,4 +381,4 @@ {{/if}} {{/if}} -{{/let}} \ No newline at end of file +{{/let}} diff --git a/packages/core/addon/components/eui-dual-range/index.ts b/packages/core/addon/components/eui-dual-range/index.ts index f6dbc9f1b..b1fc6ee37 100644 --- a/packages/core/addon/components/eui-dual-range/index.ts +++ b/packages/core/addon/components/eui-dual-range/index.ts @@ -13,6 +13,7 @@ import { EuiRangeTick } from '../eui-range-ticks'; import { argOrDefaultDecorator as argOrDefault } from '../../helpers/arg-or-default'; import { later } from '@ember/runloop'; import { keys } from '../../utils/keys'; +import { EUI_THUMB_SIZE } from '../../utils/range'; type ValueMember = number | string; export interface EuiDualRangeArgs @@ -177,16 +178,28 @@ export default class EuiDualRangeComponent extends Component { // Determine thumb movement based on slider interaction if (!this.isValid) { // Non-standard positioning follows - this._determineInvalidThumbMovement(newVal, this.lowerValue, this.upperValue, e); + this._determineInvalidThumbMovement( + newVal, + this.lowerValue, + this.upperValue, + e + ); } else { // Standard positioning based on click event proximity to thumb locations - this._determineValidThumbMovement(newVal, this.lowerValue, this.upperValue, e); + this._determineValidThumbMovement( + newVal, + this.lowerValue, + this.upperValue, + e + ); } } @action _handleOnChange(lower: ValueMember, upper: ValueMember, e: Event): void { - const isValid = isWithinRange(this.min, upper, lower) && isWithinRange(lower, this.max, upper); + const isValid = + isWithinRange(this.min, upper, lower) && + isWithinRange(lower, this.max, upper); this.args.onChange([lower, upper], isValid, e); } @@ -198,15 +211,23 @@ export default class EuiDualRangeComponent extends Component { @action _resetToRangeEnds(e: KeyboardEvent): void { // Arbitrary decision to pass `min` instead of `max`. Result is the same. - this._determineInvalidThumbMovement(this.min, this.lowerValue, this.upperValue, e); + this._determineInvalidThumbMovement( + this.min, + this.lowerValue, + this.upperValue, + e + ); } @action _isDirectionalKeyPress(event: KeyboardEvent): boolean { return ( - [keys.ARROW_UP, keys.ARROW_RIGHT, keys.ARROW_DOWN, keys.ARROW_LEFT].indexOf( - event.key as keys - ) > -1 + [ + keys.ARROW_UP, + keys.ARROW_RIGHT, + keys.ARROW_DOWN, + keys.ARROW_LEFT + ].indexOf(event.key as keys) > -1 ); } @@ -303,7 +324,6 @@ export default class EuiDualRangeComponent extends Component { let valuePosition = decimal <= 1 ? decimal : 1; valuePosition = valuePosition >= 0 ? valuePosition : 0; - const EUI_THUMB_SIZE = 16; const trackWidth = this.args.showInput === 'inputWithPopover' && !!width ? width @@ -325,11 +345,17 @@ export default class EuiDualRangeComponent extends Component { } get calculateLowerValueThumbPositionStyle(): { left: string } { - return this.calculateThumbPositionStyle(Number(this.lowerValue) || this.min, this.rangeWidth); + return this.calculateThumbPositionStyle( + Number(this.lowerValue) || this.min, + this.rangeWidth + ); } get calculateUpperValueThumbPositionStyle(): { left: string } { - return this.calculateThumbPositionStyle(Number(this.upperValue) || this.max, this.rangeWidth); + return this.calculateThumbPositionStyle( + Number(this.upperValue) || this.max, + this.rangeWidth + ); } @action diff --git a/packages/core/addon/components/eui-field-number/index.hbs b/packages/core/addon/components/eui-field-number/index.hbs index 4a82186db..5ae0c973d 100644 --- a/packages/core/addon/components/eui-field-number/index.hbs +++ b/packages/core/addon/components/eui-field-number/index.hbs @@ -1,6 +1,6 @@ {{#let - (and (not (arg-or-default @isFakePrependBlock false)) (has-block "prepend")) - (and (not (arg-or-default @isFakeAppendBlock false)) (has-block "append")) + (and (arg-or-default @isPrependProvided true) (has-block "prepend")) + (and (arg-or-default @isAppendProvided true) (has-block "append")) (arg-or-default @id (unique-id)) as |hasPrepend hasAppend inputId| }} {{#let @@ -59,4 +59,4 @@ {{/if}} {{/let}} -{{/let}} \ No newline at end of file +{{/let}} diff --git a/packages/core/addon/components/eui-input-popover/index.ts b/packages/core/addon/components/eui-input-popover/index.ts index 8ba09b22f..4a7f51c0e 100644 --- a/packages/core/addon/components/eui-input-popover/index.ts +++ b/packages/core/addon/components/eui-input-popover/index.ts @@ -6,7 +6,8 @@ import { argOrDefaultDecorator as argOrDefault } from '../../helpers/arg-or-defa import { tabbable } from 'tabbable'; import { EuiPopoverArgs } from '../eui-popover'; -export interface EuiInputPopoverArgs extends Omit { +export interface EuiInputPopoverArgs + extends Omit { disableFocusTrap?: boolean; fullWidth?: boolean; input: EuiPopoverArgs['button']; @@ -44,8 +45,8 @@ export default class EuiInputPopoverComponent extends Component - <:prepend as |classes|> - {{yield classes to="prepend"}} - - <:append as |classes|> - {{yield classes to="append"}} - - \ No newline at end of file + }} + > + <:prepend as |classes|> + {{yield classes to="prepend"}} + + <:append as |classes|> + {{yield classes to="append"}} + + +{{/let}} diff --git a/packages/core/addon/components/eui-range-levels/index.hbs b/packages/core/addon/components/eui-range-levels/index.hbs index dcc1eb6c7..81f9cb486 100644 --- a/packages/core/addon/components/eui-range-levels/index.hbs +++ b/packages/core/addon/components/eui-range-levels/index.hbs @@ -2,7 +2,7 @@ class={{class-names "euiRangeLevels" (if @showTicks "euiRangeLevels--hasTicks") - (if @compresses "euiRangeLevels--compressed") + (if @compressed "euiRangeLevels--compressed") }} {{did-insert this.validateLevels}} {{did-update this.validateLevels @levels}} @@ -14,9 +14,9 @@ class="euiRangeLevel euiRangeLevel--{{level.color}}" {{simple-style (inline-styles - componentName="EuiRangeLevels" componentArgs=(hash level=level max=@max min=@min) + componentName="EuiRangeLevels" componentArgs=(hash level=level max=@max min=@min trackWidth=@trackWidth) ) }} > {{/each}} - \ No newline at end of file + diff --git a/packages/core/addon/components/eui-range-ticks/index.hbs b/packages/core/addon/components/eui-range-ticks/index.hbs index f9ad83cf3..5e114fe4e 100644 --- a/packages/core/addon/components/eui-range-ticks/index.hbs +++ b/packages/core/addon/components/eui-range-ticks/index.hbs @@ -5,7 +5,7 @@ > {{#each @tickSequence key="value" as |tickValue|}} {{#let - (get-range-tick @ticks tickValue @min @max this.percentageWidth) as |derivedState| + (get-range-tick @ticks tickValue @min @max this.percentageWidth @trackWidth) as |derivedState| }}