@lion/ui 0.15.4 → 0.15.5

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.
Files changed (66) hide show
  1. package/components/collapsible/src/LionCollapsible.js +0 -2
  2. package/components/collapsible/test/lion-collapsible.test.js +0 -9
  3. package/components/core/test-helpers/ssr-definitions/ScopedElementsHost.define.js +1 -0
  4. package/components/drawer/test/lion-drawer.test.js +0 -9
  5. package/components/form-core/src/choice-group/ChoiceGroupMixin.js +12 -2
  6. package/components/form-core/test-suites/choice-group/ChoiceGroupMixin.suite.js +48 -4
  7. package/components/input-tel/translations/es.js +1 -1
  8. package/components/overlays/test/OverlayController.test.js +3 -2
  9. package/dist-types/components/collapsible/src/LionCollapsible.d.ts.map +1 -1
  10. package/dist-types/components/core/test-helpers/ssr-definitions/ScopedElementsHost.define.d.ts +2 -0
  11. package/dist-types/components/core/test-helpers/ssr-definitions/ScopedElementsHost.define.d.ts.map +1 -0
  12. package/dist-types/components/form-core/src/choice-group/ChoiceGroupMixin.d.ts.map +1 -1
  13. package/dist-types/components/form-core/test-suites/choice-group/ChoiceGroupMixin.suite.d.ts.map +1 -1
  14. package/dist-types/components/overlays/test/OverlayController.test.d.ts.map +1 -1
  15. package/dist-types/tsconfig.tsbuildinfo +1 -1
  16. package/docs/components/checkbox-group/overview.md +2 -2
  17. package/docs/components/collapsible/overview.md +1 -1
  18. package/docs/components/combobox/overview.md +1 -1
  19. package/docs/components/combobox/use-cases.md +1 -1
  20. package/docs/components/dialog/overview.md +1 -1
  21. package/docs/components/fieldset/overview.md +5 -5
  22. package/docs/components/form/overview.md +3 -3
  23. package/docs/components/form/use-cases.md +2 -2
  24. package/docs/components/icon/use-cases.md +1 -1
  25. package/docs/components/input/overview.md +1 -1
  26. package/docs/components/input-amount/overview.md +3 -3
  27. package/docs/components/input-date/overview.md +3 -3
  28. package/docs/components/input-datepicker/overview.md +5 -5
  29. package/docs/components/input-email/overview.md +2 -2
  30. package/docs/components/input-file/overview.md +1 -1
  31. package/docs/components/input-iban/overview.md +2 -2
  32. package/docs/components/input-range/overview.md +2 -2
  33. package/docs/components/input-stepper/overview.md +1 -1
  34. package/docs/components/input-tel/overview.md +1 -1
  35. package/docs/components/input-tel/use-cases.md +6 -6
  36. package/docs/components/input-tel-dropdown/overview.md +1 -1
  37. package/docs/components/listbox/use-cases.md +1 -1
  38. package/docs/components/radio-group/overview.md +3 -3
  39. package/docs/components/select/use-cases.md +1 -1
  40. package/docs/components/select-rich/use-cases.md +2 -2
  41. package/docs/components/switch/use-cases.md +3 -3
  42. package/docs/components/tabs/examples.md +1 -1
  43. package/docs/fundamentals/index.md +4 -4
  44. package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
  45. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
  46. package/docs/fundamentals/rationales/TypeScript.md +46 -0
  47. package/docs/fundamentals/rationales/accessibility.md +1 -1
  48. package/docs/fundamentals/systems/core/SlotMixin.md +1 -1
  49. package/docs/fundamentals/systems/core/overview.md +1 -1
  50. package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
  51. package/docs/fundamentals/systems/form/model-value.md +1 -1
  52. package/docs/fundamentals/systems/form/overview.md +28 -28
  53. package/docs/fundamentals/systems/form/validate.md +2 -2
  54. package/docs/fundamentals/systems/localize/overview.md +4 -4
  55. package/docs/fundamentals/systems/overlays/configuration.md +2 -2
  56. package/docs/fundamentals/systems/overlays/overview.md +5 -5
  57. package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
  58. package/docs/fundamentals/tools/helpers/overview.md +1 -1
  59. package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
  60. package/docs/guides/how-to/create-a-custom-field.md +5 -5
  61. package/docs/guides/how-to/create-a-form.md +4 -4
  62. package/docs/guides/how-to/extend-a-native-input.md +2 -2
  63. package/docs/guides/index.md +8 -8
  64. package/docs/guides/principles/index.md +5 -5
  65. package/docs/guides/principles/styling.md +1 -1
  66. package/package.json +1 -1
@@ -54,12 +54,10 @@ export class LionCollapsible extends LitElement {
54
54
  if (this._invokerNode) {
55
55
  this._invokerNode.addEventListener('click', this.toggle);
56
56
  this._invokerNode.setAttribute('aria-expanded', `${this.opened}`);
57
- this._invokerNode.setAttribute('id', `collapsible-invoker-${uid}`);
58
57
  this._invokerNode.setAttribute('aria-controls', `collapsible-content-${uid}`);
59
58
  }
60
59
 
61
60
  if (this._contentNode) {
62
- this._contentNode.setAttribute('aria-labelledby', `collapsible-invoker-${uid}`);
63
61
  this._contentNode.setAttribute('id', `collapsible-content-${uid}`);
64
62
  }
65
63
 
@@ -136,14 +136,5 @@ describe('<lion-collapsible>', () => {
136
136
  expect(invoker).to.have.attribute('aria-expanded', 'true');
137
137
  });
138
138
  });
139
-
140
- describe('Contents', () => {
141
- it('adds aria-labelledby referring to invoker id', async () => {
142
- const collapsibleElement = await fixture(defaultCollapsible);
143
- const invoker = collapsibleElement.querySelector('[slot=invoker]');
144
- const content = collapsibleElement.querySelector('[slot=content]');
145
- expect(content).to.have.attribute('aria-labelledby', invoker?.id);
146
- });
147
- });
148
139
  });
149
140
  });
@@ -0,0 +1 @@
1
+ // ... empty file needed for '@lit-labs/testing/fixtures.js'
@@ -96,14 +96,5 @@ describe('<lion-drawer>', () => {
96
96
  expect(invoker).to.have.attribute('aria-expanded', 'true');
97
97
  });
98
98
  });
99
-
100
- describe('Contents', () => {
101
- it('adds aria-labelledby referring to invoker id', async () => {
102
- const drawerElement = await fixture(template);
103
- const invoker = drawerElement.querySelector('[slot=invoker]');
104
- const content = drawerElement.querySelector('[slot=content]');
105
- expect(content).to.have.attribute('aria-labelledby', invoker?.id);
106
- });
107
- });
108
99
  });
109
100
  });
@@ -1,6 +1,6 @@
1
1
  import { dedupeMixin } from '@open-wc/dedupe-mixin';
2
- import { FormRegistrarMixin } from '../registration/FormRegistrarMixin.js';
3
2
  import { InteractionStateMixin } from '../InteractionStateMixin.js';
3
+ import { FormRegistrarMixin } from '../registration/FormRegistrarMixin.js';
4
4
  import { ValidateMixin } from '../validate/ValidateMixin.js';
5
5
 
6
6
  /**
@@ -260,7 +260,17 @@ const ChoiceGroupMixinImplementation = superclass =>
260
260
  ) {
261
261
  return this[property];
262
262
  }
263
- return this.formElements.filter(el => _filterFn(el, property)).map(el => el.property);
263
+
264
+ // TODO: consider a shared approach for all value getters
265
+ const filteredFnElements = this.formElements.filter(el => _filterFn(el, property));
266
+
267
+ if (property === '_initialModelValue') {
268
+ return this.multipleChoice
269
+ ? filteredFnElements.filter(el => el[property].checked).map(el => el[property].value)
270
+ : filteredFnElements.find(el => el[property].checked)?.value;
271
+ }
272
+
273
+ return filteredFnElements.map(el => el[property]);
264
274
  }
265
275
 
266
276
  /**
@@ -1,15 +1,15 @@
1
- import { LitElement } from 'lit';
2
- import '@lion/ui/define/lion-fieldset.js';
3
1
  import '@lion/ui/define/lion-checkbox-group.js';
4
2
  import '@lion/ui/define/lion-checkbox.js';
3
+ import '@lion/ui/define/lion-fieldset.js';
5
4
  import {
6
- FormGroupMixin,
7
- Required,
8
5
  ChoiceGroupMixin,
9
6
  ChoiceInputMixin,
7
+ FormGroupMixin,
8
+ Required,
10
9
  } from '@lion/ui/form-core.js';
11
10
  import { LionInput } from '@lion/ui/input.js';
12
11
  import { expect, fixture, fixtureSync, html, unsafeStatic } from '@open-wc/testing';
12
+ import { LitElement } from 'lit';
13
13
  import sinon from 'sinon';
14
14
 
15
15
  class ChoiceInputFoo extends ChoiceInputMixin(LionInput) {}
@@ -45,6 +45,28 @@ export function runChoiceGroupMixinSuite({ parentTagString, childTagString, choi
45
45
 
46
46
  describe(`ChoiceGroupMixin: ${cfg.parentTagString}`, () => {
47
47
  if (cfg.choiceType === 'single') {
48
+ it('has a single modelValue representing initial checked values', async () => {
49
+ const el = /** @type {ChoiceInputGroup} */ (
50
+ await fixture(html`
51
+ <${parentTag} name="gender[]">
52
+ <${childTag} .choiceValue=${'male'}></${childTag}>
53
+ <${childTag} .choiceValue=${'female'} checked></${childTag}>
54
+ <${childTag} .choiceValue=${'other'}></${childTag}>
55
+ </${parentTag}>
56
+ `)
57
+ );
58
+
59
+ // @ts-ignore protected members allowed in test
60
+ expect(el._initialModelValue).to.eql('female');
61
+ expect(el.modelValue).to.eql('female');
62
+
63
+ el.formElements[0].checked = true;
64
+
65
+ // @ts-ignore protected members allowed in test
66
+ expect(el._initialModelValue).to.eql('female');
67
+ expect(el.modelValue).to.eql('male');
68
+ });
69
+
48
70
  it('has a single modelValue representing the currently checked radio value', async () => {
49
71
  const el = /** @type {ChoiceInputGroup} */ (
50
72
  await fixture(html`
@@ -585,6 +607,28 @@ export function runChoiceGroupMixinSuite({ parentTagString, childTagString, choi
585
607
  });
586
608
 
587
609
  describe('multipleChoice', () => {
610
+ it('has multiple _initialModelValue representing initial checked values', async () => {
611
+ const el = /** @type {ChoiceInputGroup} */ (
612
+ await fixture(html`
613
+ <${parentTag} multiple-choice name="animals[]">
614
+ <${childTag} .choiceValue=${'dog'} checked></${childTag}>
615
+ <${childTag} .choiceValue=${'cat'} checked></${childTag}>
616
+ <${childTag} .choiceValue=${'lion'}></${childTag}>
617
+ </${parentTag}>
618
+ `)
619
+ );
620
+
621
+ // @ts-ignore protected members allowed in test
622
+ expect(el._initialModelValue).to.eql(['dog', 'cat']);
623
+ expect(el.modelValue).to.eql(['dog', 'cat']);
624
+
625
+ el.formElements[2].checked = true;
626
+
627
+ // @ts-ignore protected members allowed in test
628
+ expect(el._initialModelValue).to.eql(['dog', 'cat']);
629
+ expect(el.modelValue).to.eql(['dog', 'cat', 'lion']);
630
+ });
631
+
588
632
  it('has a single modelValue representing all currently checked values', async () => {
589
633
  const el = /** @type {ChoiceInputGroup} */ (
590
634
  await fixture(html`
@@ -1,5 +1,5 @@
1
1
  export default {
2
- allCountries: 'Pays suggérés',
2
+ allCountries: 'Todos los países',
3
3
  phoneNumber: 'Número de teléfono',
4
4
  selectCountry: 'Seleccione país',
5
5
  suggestedCountries: 'Países sugeridos',
@@ -11,6 +11,7 @@ import {
11
11
  fixture,
12
12
  expect,
13
13
  html,
14
+ waitUntil,
14
15
  } from '@open-wc/testing';
15
16
 
16
17
  import { isActiveElement } from '../../core/test-helpers/isActiveElement.js';
@@ -815,8 +816,8 @@ describe('OverlayController', () => {
815
816
  // without this line, the test is unstable on FF sometimes
816
817
  await aTimeout(100);
817
818
 
818
- expect(parentOverlay.isShown).to.be.false;
819
- expect(childOverlay.isShown).to.be.true;
819
+ await waitUntil(() => !parentOverlay.isShown);
820
+ await waitUntil(() => childOverlay.isShown);
820
821
 
821
822
  await childOverlay.teardown();
822
823
  await parentOverlay.teardown();
@@ -1 +1 @@
1
- {"version":3,"file":"LionCollapsible.d.ts","sourceRoot":"","sources":["../../../../components/collapsible/src/LionCollapsible.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH;IACE,+CAYC;IAED;;;;;MAOC;IAED,+CAKC;IAIC,gBAAmB;IA8DrB;;;OAGG;IACH,sBAGC;IA3BD;;;OAGG;IACH,oBAIC;IAED;;;OAGG;IACH,oBAIC;IAWD;;;;OAIG;IAEH,+BAJW,MAAM,iBAIY;IAE7B;;;;OAIG;IAEH,+BAJW,MAAM,iBAIY;IAE7B;;OAEG;IACH,sDAIC;IAED;;OAEG;IACH,sDAIC;IAED;;OAEG;IACH,uCAGC;IAED;;;OAGG;IACH,wBAMC;IAED;;;OAGG;IACH,4BAUC;IAED;;;OAGG;IACH,0BAIC;CACF"}
1
+ {"version":3,"file":"LionCollapsible.d.ts","sourceRoot":"","sources":["../../../../components/collapsible/src/LionCollapsible.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH;IACE,+CAYC;IAED;;;;;MAOC;IAED,+CAKC;IAIC,gBAAmB;IA4DrB;;;OAGG;IACH,sBAGC;IA3BD;;;OAGG;IACH,oBAIC;IAED;;;OAGG;IACH,oBAIC;IAWD;;;;OAIG;IAEH,+BAJW,MAAM,iBAIY;IAE7B;;;;OAIG;IAEH,+BAJW,MAAM,iBAIY;IAE7B;;OAEG;IACH,sDAIC;IAED;;OAEG;IACH,sDAIC;IAED;;OAEG;IACH,uCAGC;IAED;;;OAGG;IACH,wBAMC;IAED;;;OAGG;IACH,4BAUC;IAED;;;OAGG;IACH,0BAIC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ScopedElementsHost.define.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScopedElementsHost.define.d.ts","sourceRoot":"","sources":["../../../../../components/core/test-helpers/ssr-definitions/ScopedElementsHost.define.js"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceGroupMixin.d.ts","sourceRoot":"","sources":["../../../../../components/form-core/src/choice-group/ChoiceGroupMixin.js"],"names":[],"mappings":"+BAMa,OAAO,mDAAmD,EAAE,gBAAgB;AAmZzF,4HAA4E;8BAlZ/D,OAAO,sCAAsC,EAAE,eAAe;yCAC9D,OAAO,qDAAqD,EAAE,0BAA0B;0BACxF,OAAO,+CAA+C,EAAE,WAAW;8BACnE,OAAO,mDAAmD,EAAE,eAAe;wBAC3E,OAAO,0BAA0B,EAAE,SAAS"}
1
+ {"version":3,"file":"ChoiceGroupMixin.d.ts","sourceRoot":"","sources":["../../../../../components/form-core/src/choice-group/ChoiceGroupMixin.js"],"names":[],"mappings":"+BAMa,OAAO,mDAAmD,EAAE,gBAAgB;AA6ZzF,4HAA4E;8BA5Z/D,OAAO,sCAAsC,EAAE,eAAe;yCAC9D,OAAO,qDAAqD,EAAE,0BAA0B;0BACxF,OAAO,+CAA+C,EAAE,WAAW;8BACnE,OAAO,mDAAmD,EAAE,eAAe;wBAC3E,OAAO,0BAA0B,EAAE,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceGroupMixin.suite.d.ts","sourceRoot":"","sources":["../../../../../components/form-core/test-suites/choice-group/ChoiceGroupMixin.suite.js"],"names":[],"mappings":"AA4BA;;GAEG;AACH,2FAFW;IAAE,eAAe,CAAC,EAAC,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAC,QAktBlF"}
1
+ {"version":3,"file":"ChoiceGroupMixin.suite.d.ts","sourceRoot":"","sources":["../../../../../components/form-core/test-suites/choice-group/ChoiceGroupMixin.suite.js"],"names":[],"mappings":"AA4BA;;GAEG;AACH,2FAFW;IAAE,eAAe,CAAC,EAAC,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAC,QA8vBlF"}
@@ -1 +1 @@
1
- {"version":3,"file":"OverlayController.test.d.ts","sourceRoot":"","sources":["../../../../components/overlays/test/OverlayController.test.js"],"names":[],"mappings":"gCAsBa,OAAO,2BAA2B,EAAE,iBAAiB;4BACrD,OAAO,2BAA2B,EAAE,aAAa"}
1
+ {"version":3,"file":"OverlayController.test.d.ts","sourceRoot":"","sources":["../../../../components/overlays/test/OverlayController.test.js"],"names":[],"mappings":"gCAuBa,OAAO,2BAA2B,EAAE,iBAAiB;4BACrD,OAAO,2BAA2B,EAAE,aAAa"}