Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(language-selector): remove internal decorator #11069

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 6 additions & 26 deletions packages/carbon-web-components/src/components/input/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ export default class BXInput extends ValidityMixin(FormMixin(LitElement)) {
*/
protected _value = '';

/**
* Set initial value of input
*/
@property({ reflect: true })
value = '';

/**
* Handles `oninput` event on the `<input>`.
*
Expand Down Expand Up @@ -198,32 +204,6 @@ export default class BXInput extends ValidityMixin(FormMixin(LitElement)) {
@property({ attribute: 'validity-message' })
validityMessage = '';

/**
* The value of the input.
*/
@property({ reflect: true })
get value() {
// FIXME: Figure out how to deal with TS2611
// once we have the input we can directly query for the value
if (this._input) {
return this._input.value;
}
// but before then _value will work fine
return this._value;
}

set value(value) {
const oldValue = this._value;
this._value = value;
// make sure that lit-element updates the right properties
this.requestUpdate('value', oldValue);
// we set the value directly on the input (when available)
// so that programatic manipulation updates the UI correctly
if (this._input) {
this._input.value = value;
}
}

createRenderRoot() {
return this.attachShadow({
mode: 'open',
Expand Down
7 changes: 4 additions & 3 deletions packages/web-components/src/components/footer/combo-box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { TemplateResult } from 'lit-html';
import { html, property, query } from 'lit-element';
import BXComboBoxItem from '../../internal/vendor/@carbon/web-components/components/combo-box/combo-box-item.js';
import Close16 from '../../internal/vendor/@carbon/web-components/icons/close/16.js';
import ddsSettings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';
import ddsSettings from '../../internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings';
import { findIndex, forEach } from '../../globals/internal/collection-helpers';
import DDSDropdown, { DROPDOWN_KEYBOARD_ACTION } from './dropdown';
import { carbonElement as customElement } from '../../internal/vendor/@carbon/web-components/globals/decorators/carbon-element.js';
Expand Down Expand Up @@ -58,7 +58,7 @@ class DDSComboBox extends DDSDropdown {
* The `<input>` for filtering.
*/
@query('input')
private _filterInputNode!: HTMLInputElement;
protected _filterInputNode!: HTMLInputElement;

/**
* @param item A combo box item.
Expand Down Expand Up @@ -226,7 +226,8 @@ class DDSComboBox extends DDSDropdown {
return true;
}

updated() {
updated(changedProperties) {
super.updated(changedProperties);
const { _listBoxNode: listBoxNode } = this;
if (listBoxNode) {
listBoxNode.classList.add(`${prefix}--combo-box`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const { stablePrefix: ddsPrefix } = ddsSettings;
* The API for language selection is still subject to change.
*
* @element dds-language-selector-desktop
* @internal
*/
@customElement(`${ddsPrefix}-language-selector-desktop`)
class DDSLanguageSelectorDesktop extends HostListenerMixin(DDSComboBox) {
Expand All @@ -39,7 +38,7 @@ class DDSLanguageSelectorDesktop extends HostListenerMixin(DDSComboBox) {
* The `<input>` for filtering.
*/
@query('input')
private _filterInputNode!: HTMLInputElement;
protected _filterInputNode!: HTMLInputElement;

/**
* Reverts input value to last chosen valid language.
Expand Down Expand Up @@ -134,9 +133,8 @@ class DDSLanguageSelectorDesktop extends HostListenerMixin(DDSComboBox) {
@property({ reflect: true })
slot = 'language-selector';

// @ts-ignore
updated(changedProperties) {
super.updated();
super.updated(changedProperties);
if (changedProperties.has('value')) {
this._lastValidLang = this.value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const { stablePrefix: ddsPrefix } = ddsSettings;
* The API for language selection is still subject to change.
*
* @element dds-language-selector-mobile
* @internal
*/
@customElement(`${ddsPrefix}-language-selector-mobile`)
class DDSLanguageSelectorMobile extends BXSelect {
Expand Down
Loading