feat(checkbox-group): add types for checkbox-group
This commit is contained in:
parent
857206548c
commit
9263f39740
6 changed files with 33 additions and 13 deletions
5
.changeset/shaggy-dolls-trade.md
Normal file
5
.changeset/shaggy-dolls-trade.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@lion/checkbox-group': minor
|
||||
---
|
||||
|
||||
Added types for checkbox-group package.
|
||||
|
|
@ -1,6 +1,12 @@
|
|||
module.exports = {
|
||||
extends: ['@open-wc/eslint-config', 'eslint-config-prettier'].map(require.resolve),
|
||||
overrides: [
|
||||
{
|
||||
files: ['**/*.js'],
|
||||
rules: {
|
||||
'wc/guard-super-call': 'off', // types will prevent you from calling the super if it's not in the base class, making the guard unnecessary
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'**/test-suites/**/*.js',
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { ChoiceInputMixin } from '@lion/form-core';
|
|||
|
||||
export class LionCheckbox extends ChoiceInputMixin(LionInput) {
|
||||
connectedCallback() {
|
||||
if (super.connectedCallback) super.connectedCallback();
|
||||
super.connectedCallback();
|
||||
this.type = 'checkbox';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@ import { ChoiceGroupMixin, FormGroupMixin } from '@lion/form-core';
|
|||
|
||||
/**
|
||||
* A wrapper around multiple checkboxes
|
||||
*
|
||||
* @extends {LionFieldset}
|
||||
*/
|
||||
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/40110
|
||||
export class LionCheckboxGroup extends ChoiceGroupMixin(FormGroupMixin(LitElement)) {
|
||||
constructor() {
|
||||
super();
|
||||
this.multipleChoice = true;
|
||||
}
|
||||
|
||||
/** @param {import('lit-element').PropertyValues } changedProperties */
|
||||
updated(changedProperties) {
|
||||
super.updated(changedProperties);
|
||||
if (changedProperties.has('name') && !String(this.name).match(/\[\]$/)) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,15 @@
|
|||
import { localizeTearDown } from '@lion/localize/test-helpers.js';
|
||||
import { expect, fixture, html } from '@open-wc/testing';
|
||||
import { expect, fixture as _fixture, html } from '@open-wc/testing';
|
||||
import '../lion-checkbox-group.js';
|
||||
import '../lion-checkbox.js';
|
||||
|
||||
/**
|
||||
* @typedef {import('../src/LionCheckboxGroup').LionCheckboxGroup} LionCheckboxGroup
|
||||
* @typedef {import('lit-html').TemplateResult} TemplateResult
|
||||
*/
|
||||
|
||||
const fixture = /** @type {(arg: TemplateResult) => Promise<LionCheckboxGroup>} */ (_fixture);
|
||||
|
||||
beforeEach(() => {
|
||||
localizeTearDown();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,17 +16,19 @@
|
|||
},
|
||||
"include": [
|
||||
"packages/accordion/**/*.js",
|
||||
"packages/core/**/*.js",
|
||||
"packages/tabs/**/*.js",
|
||||
"packages/singleton-manager/**/*.js",
|
||||
"packages/localize/**/*.js",
|
||||
"packages/form-core/**/*.js",
|
||||
"packages/overlays/**/*.js",
|
||||
"packages/tooltip/**/*.js",
|
||||
"packages/button/src/**/*.js",
|
||||
"packages/listbox/src/*.js",
|
||||
"packages/checkbox-group/**/*.js",
|
||||
"packages/core/**/*.js",
|
||||
"packages/form-core/**/*.js",
|
||||
"packages/input/**/*.js",
|
||||
"packages/input-amount/**/*.js"
|
||||
"packages/input-amount/**/*.js",
|
||||
"packages/listbox/src/*.js",
|
||||
"packages/localize/**/*.js",
|
||||
"packages/overlays/**/*.js",
|
||||
"packages/radio-group/**/*.js",
|
||||
"packages/singleton-manager/**/*.js",
|
||||
"packages/tabs/**/*.js",
|
||||
"packages/tooltip/**/*.js"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
|
|
|
|||
Loading…
Reference in a new issue