diff --git a/.changeset/dirty-rules-wash.md b/.changeset/dirty-rules-wash.md new file mode 100644 index 000000000..0f40dfc80 --- /dev/null +++ b/.changeset/dirty-rules-wash.md @@ -0,0 +1,11 @@ +--- +'@lion/button': patch +'@lion/calendar': patch +'@lion/input-date': patch +'@lion/input-datepicker': patch +'@lion/input': patch +'@lion/select-rich': patch +'@lion/select': patch +--- + +fix: expose members as protected for extension compat. till v1 diff --git a/packages/button/src/LionButton.js b/packages/button/src/LionButton.js index e313efa0b..49ec88ec0 100644 --- a/packages/button/src/LionButton.js +++ b/packages/button/src/LionButton.js @@ -240,8 +240,10 @@ export class LionButton extends DisabledWithTabIndexMixin(SlotMixin(LitElement)) * of the form, and firing click on this button. This will fire the form submit * without side effects caused by the click bubbling back up to lion-button. * @param {Event} ev - * @private + * @protected + * @returns {Promise} */ + // TODO: rename to _clickDelegationHandler in v1 async __clickDelegationHandler(ev) { // Wait for updateComplete if form is not yet available if (!this._form) { diff --git a/packages/calendar/src/LionCalendar.js b/packages/calendar/src/LionCalendar.js index 69d4a3127..cf47a9e4d 100644 --- a/packages/calendar/src/LionCalendar.js +++ b/packages/calendar/src/LionCalendar.js @@ -466,8 +466,9 @@ export class LionCalendar extends LocalizeMixin(LitElement) { * @param {string} type * @param {string} previousMonth * @param {number} previousYear - * @private + * @protected */ + // TODO: rename to _previousButtonTemplate in v1. Also see: https://github.com/ing-bank/lion/discussions/591 __renderPreviousButton(type, previousMonth, previousYear) { const { disabled, month } = this.__getPreviousDisabled(type, previousMonth, previousYear); const previousButtonTitle = this.__getNavigationLabel('previous', type, month, previousYear); @@ -496,8 +497,9 @@ export class LionCalendar extends LocalizeMixin(LitElement) { * @param {string} type * @param {string} nextMonth * @param {number} nextYear - * @private + * @protected */ + // TODO: rename to _nextButtonTemplate in v1. Also see: https://github.com/ing-bank/lion/discussions/591 __renderNextButton(type, nextMonth, nextYear) { const { disabled, month } = this.__getNextDisabled(type, nextMonth, nextYear); const nextButtonTitle = this.__getNavigationLabel('next', type, month, nextYear); diff --git a/packages/form-core/src/FormatMixin.js b/packages/form-core/src/FormatMixin.js index 35c494b9f..cf2b611ab 100644 --- a/packages/form-core/src/FormatMixin.js +++ b/packages/form-core/src/FormatMixin.js @@ -219,12 +219,12 @@ const FormatMixinImplementation = superclass => /** @type {?} */ this.modelValue = this.deserializer(this.serializedValue); } else if (source === 'formatted') { - this.modelValue = this.__callParser(); + this.modelValue = this._callParser(); } } if (source !== 'formatted') { /** @type {string} */ - this.formattedValue = this.__callFormatter(); + this.formattedValue = this._callFormatter(); } if (source !== 'serialized') { /** @type {string} */ @@ -239,7 +239,7 @@ const FormatMixinImplementation = superclass => * @return {?} * @private */ - __callParser(value = this.formattedValue) { + _callParser(value = this.formattedValue) { // A) check if we need to parse at all // A.1) The end user had no intention to parse @@ -277,7 +277,7 @@ const FormatMixinImplementation = superclass => * @returns {string|undefined} * @private */ - __callFormatter() { + _callFormatter() { // - Why check for this.hasError? // We only want to format values that are considered valid. For best UX, // we only 'reward' valid inputs. @@ -350,7 +350,7 @@ const FormatMixinImplementation = superclass => if (!this.__isHandlingComposition) { this.value = this.preprocessor(this.value); } - this.modelValue = this.__callParser(this.value); + this.modelValue = this._callParser(this.value); } /** diff --git a/packages/form-core/types/FormatMixinTypes.d.ts b/packages/form-core/types/FormatMixinTypes.d.ts index 9414cbb0a..1c19c336c 100644 --- a/packages/form-core/types/FormatMixinTypes.d.ts +++ b/packages/form-core/types/FormatMixinTypes.d.ts @@ -27,10 +27,10 @@ export declare class FormatHost { protected _reflectBackOn(): boolean; protected _proxyInputEvent(): void; protected _onUserInputChanged(): void; + protected _callParser(value: string | undefined): object; + protected _callFormatter(): string; private __preventRecursiveTrigger: boolean; - private __callParser(value: string | undefined): object; - private __callFormatter(): string; } export declare function FormatImplementation>( diff --git a/packages/input-amount/src/LionInputAmount.js b/packages/input-amount/src/LionInputAmount.js index 0d9e8f2b4..2045a9201 100644 --- a/packages/input-amount/src/LionInputAmount.js +++ b/packages/input-amount/src/LionInputAmount.js @@ -10,8 +10,6 @@ import { parseAmount } from './parsers.js'; * * @customElement lion-input-amount */ -// TODO: make __callParser protected => _callParser -// @ts-ignore [allow-private]: __callParser export class LionInputAmount extends LocalizeMixin(LionInput) { /** @type {any} */ static get properties() { @@ -104,15 +102,15 @@ export class LionInputAmount extends LocalizeMixin(LionInput) { /** * @override of FormatMixin - * @private + * @protected */ - __callParser(value = this.formattedValue) { + _callParser(value = this.formattedValue) { // TODO: (@daKmor) input and change events both trigger parsing therefore we need to handle the second parse this.__parserCallcountSincePaste += 1; this.__isPasting = this.__parserCallcountSincePaste === 2; this.formatOptions.mode = this.__isPasting === true ? 'pasted' : 'auto'; - // @ts-ignore [allow-private] - return super.__callParser(value); + // @ts-ignore [allow-protected] + return super._callParser(value); } /** diff --git a/packages/input-datepicker/src/LionInputDatepicker.js b/packages/input-datepicker/src/LionInputDatepicker.js index 294685ce3..b7c4c6066 100644 --- a/packages/input-datepicker/src/LionInputDatepicker.js +++ b/packages/input-datepicker/src/LionInputDatepicker.js @@ -157,10 +157,17 @@ export class LionInputDatepicker extends ScopedElementsMixin( ]; } + /** + * @protected + */ get _invokerNode() { return /** @type {HTMLElement} */ (this.querySelector(`#${this.__invokerId}`)); } + /** + * @type {LionCalendar} + * @protected + */ get _calendarNode() { return /** @type {LionCalendar} */ (this._overlayCtrl.contentNode.querySelector( '[slot="content"]', diff --git a/packages/input-datepicker/test-helpers/DatepickerInputObject.js b/packages/input-datepicker/test-helpers/DatepickerInputObject.js index f92df2c4e..7e156e966 100644 --- a/packages/input-datepicker/test-helpers/DatepickerInputObject.js +++ b/packages/input-datepicker/test-helpers/DatepickerInputObject.js @@ -44,6 +44,7 @@ export class DatepickerInputObject { */ get invokerEl() { + // @ts-ignore [allow-protected] in test return this.el._invokerNode; } @@ -63,6 +64,7 @@ export class DatepickerInputObject { } get calendarEl() { + // @ts-ignore [allow-protected] in test return /** @type {import('@lion/calendar').LionCalendar} */ (this.el && this.el._calendarNode); } diff --git a/packages/select-rich/src/LionSelectRich.js b/packages/select-rich/src/LionSelectRich.js index 303e4fd51..c89f0ec48 100644 --- a/packages/select-rich/src/LionSelectRich.js +++ b/packages/select-rich/src/LionSelectRich.js @@ -462,8 +462,9 @@ export class LionSelectRich extends SlotMixin(ScopedElementsMixin(OverlayMixin(L /** * @param {KeyboardEvent} ev - * @private + * @protected */ + // TODO: rename to _onKeyUp in v1 __onKeyUp(ev) { if (this.disabled) { return;