@lion/ui 0.5.1 → 0.5.2

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 (62) hide show
  1. package/components/overlays/src/OverlayController.js +1 -1
  2. package/components/overlays/src/configurations/visibility-trigger-partials/withHoverInteraction.js +2 -4
  3. package/components/tabs/src/LionTabs.js +4 -0
  4. package/components/tabs/test/lion-tabs.test.js +8 -0
  5. package/components/tooltip/test/lion-tooltip.test.js +30 -0
  6. package/custom-elements.json +6 -6
  7. package/dist-types/components/overlays/src/configurations/visibility-trigger-partials/withHoverInteraction.d.ts.map +1 -1
  8. package/dist-types/components/tabs/src/LionTabs.d.ts +1 -0
  9. package/dist-types/components/tabs/src/LionTabs.d.ts.map +1 -1
  10. package/dist-types/tsconfig.tsbuildinfo +1 -1
  11. package/docs/components/checkbox-group/overview.md +2 -2
  12. package/docs/components/collapsible/overview.md +1 -1
  13. package/docs/components/combobox/overview.md +1 -1
  14. package/docs/components/combobox/use-cases.md +1 -1
  15. package/docs/components/dialog/overview.md +1 -1
  16. package/docs/components/fieldset/overview.md +5 -5
  17. package/docs/components/form/overview.md +3 -3
  18. package/docs/components/icon/use-cases.md +1 -1
  19. package/docs/components/input/overview.md +1 -1
  20. package/docs/components/input-amount/overview.md +3 -3
  21. package/docs/components/input-date/overview.md +3 -3
  22. package/docs/components/input-datepicker/overview.md +5 -5
  23. package/docs/components/input-email/overview.md +2 -2
  24. package/docs/components/input-file/overview.md +1 -1
  25. package/docs/components/input-iban/overview.md +2 -2
  26. package/docs/components/input-range/overview.md +2 -2
  27. package/docs/components/input-stepper/overview.md +1 -1
  28. package/docs/components/input-tel/overview.md +1 -1
  29. package/docs/components/input-tel/use-cases.md +6 -6
  30. package/docs/components/input-tel-dropdown/overview.md +1 -1
  31. package/docs/components/radio-group/overview.md +3 -3
  32. package/docs/components/select-rich/use-cases.md +1 -1
  33. package/docs/components/tabs/examples.md +1 -1
  34. package/docs/fundamentals/index.md +4 -4
  35. package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +1 -1
  36. package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +1 -1
  37. package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +1 -1
  38. package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +1 -1
  39. package/docs/fundamentals/node-tools/providence-analytics/overview.md +3 -3
  40. package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
  41. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
  42. package/docs/fundamentals/rationales/accessibility.md +1 -1
  43. package/docs/fundamentals/systems/core/SlotMixin.md +1 -1
  44. package/docs/fundamentals/systems/core/overview.md +1 -1
  45. package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
  46. package/docs/fundamentals/systems/form/model-value.md +1 -1
  47. package/docs/fundamentals/systems/form/overview.md +28 -28
  48. package/docs/fundamentals/systems/form/validate.md +1 -1
  49. package/docs/fundamentals/systems/localize/overview.md +4 -4
  50. package/docs/fundamentals/systems/overlays/configuration.md +2 -2
  51. package/docs/fundamentals/systems/overlays/overview.md +5 -5
  52. package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
  53. package/docs/fundamentals/tools/ajax/overview.md +107 -2
  54. package/docs/fundamentals/tools/helpers/overview.md +1 -1
  55. package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
  56. package/docs/guides/how-to/create-a-custom-field.md +5 -5
  57. package/docs/guides/how-to/create-a-form.md +4 -4
  58. package/docs/guides/how-to/extend-a-native-input.md +2 -2
  59. package/docs/guides/index.md +8 -8
  60. package/docs/guides/principles/index.md +5 -5
  61. package/docs/guides/principles/styling.md +1 -1
  62. package/package.json +1 -1
@@ -933,7 +933,7 @@ export class OverlayController extends EventTarget {
933
933
 
934
934
  if (this.elementToFocusAfterHide) {
935
935
  this.elementToFocusAfterHide.focus();
936
- this.elementToFocusAfterHide.scrollIntoView({ block: 'center' });
936
+ this.elementToFocusAfterHide.scrollIntoView({ block: 'nearest' });
937
937
  } else {
938
938
  /** @type {HTMLElement} */ (this.__activeElementRightBeforeHide).blur();
939
939
  }
@@ -32,15 +32,13 @@ export function withHoverInteraction({ delayIn = 0, delayOut = 300 }) {
32
32
  */
33
33
  function handleOpenClosed(event) {
34
34
  const { type } = event;
35
- if (controller._hasDisabledInvoker()) {
36
- return;
37
- }
35
+
38
36
  clearTimeout(delayTimeout);
39
37
  isFocused = type === 'focusout' ? false : isFocused || type === 'focusin';
40
38
  isHovered = type === 'mouseleave' ? false : isHovered || type === 'mouseenter';
41
39
  const shouldOpen = isFocused || isHovered;
42
40
 
43
- if (shouldOpen) {
41
+ if (shouldOpen && !controller._hasDisabledInvoker()) {
44
42
  delayTimeout = setTimeout(() => {
45
43
  controller.show();
46
44
  }, delayIn);
@@ -356,7 +356,11 @@ export class LionTabs extends LitElement {
356
356
  * @param {number} value The new index
357
357
  */
358
358
  set selectedIndex(value) {
359
+ if (value === this.__selectedIndex) {
360
+ return;
361
+ }
359
362
  const stale = this.__selectedIndex;
363
+ /** @type {number | undefined} */
360
364
  this.__selectedIndex = value;
361
365
  this.__updateSelected(false);
362
366
  this.dispatchEvent(new Event('selected-changed'));
@@ -75,6 +75,14 @@ describe('<lion-tabs>', () => {
75
75
  expect(spy).to.have.been.calledOnce;
76
76
  });
77
77
 
78
+ it('does not send event "selected-changed" after selecting currently selected tab', async () => {
79
+ const el = /** @type {LionTabs} */ (await fixture(basicTabs));
80
+ const spy = sinon.spy();
81
+ el.addEventListener('selected-changed', spy);
82
+ el.selectedIndex = 0;
83
+ expect(spy).not.to.have.been.called;
84
+ });
85
+
78
86
  it('logs warning if unequal amount of tabs and panels', async () => {
79
87
  const stub = sinon.stub(console, 'warn');
80
88
  await fixture(html`
@@ -182,6 +182,36 @@ describe('lion-tooltip', () => {
182
182
  expect(el._overlayCtrl.isShown).to.equal(false);
183
183
  });
184
184
 
185
+ it('gets hidden when invoker gets disabled', async () => {
186
+ const el = /** @type {LionTooltip} */ (
187
+ await fixture(html`
188
+ <lion-tooltip>
189
+ <div slot="content">Hey there</div>
190
+ <button slot="invoker">Tooltip button</button>
191
+ </lion-tooltip>
192
+ `)
193
+ );
194
+ const invoker = /** @type {HTMLButtonElement} */ (
195
+ Array.from(el.children).find(child => child.slot === 'invoker')
196
+ );
197
+ const eventFocusIn = new Event('focusin');
198
+ invoker.dispatchEvent(eventFocusIn);
199
+ clock.tick(300);
200
+ await el.updateComplete;
201
+ // @ts-expect-error [allow-protected-in-tests]
202
+ expect(el._overlayCtrl.isShown).to.equal(true);
203
+
204
+ invoker.setAttribute('disabled', '');
205
+
206
+ const eventFocusOut = new Event('focusout');
207
+ invoker.dispatchEvent(eventFocusOut);
208
+ clock.tick(300);
209
+ await el.updateComplete;
210
+ await el.updateComplete; // webkit needs longer
211
+ // @ts-expect-error [allow-protected-in-tests]
212
+ expect(el._overlayCtrl.isShown).to.equal(false);
213
+ });
214
+
185
215
  it('contains html when specified in tooltip content body', async () => {
186
216
  const el = /** @type {LionTooltip} */ (
187
217
  await fixture(html`
@@ -63249,12 +63249,6 @@
63249
63249
  }
63250
63250
  ]
63251
63251
  },
63252
- {
63253
- "kind": "javascript-module",
63254
- "path": "components/input-file/types/input-file.ts",
63255
- "declarations": [],
63256
- "exports": []
63257
- },
63258
63252
  {
63259
63253
  "kind": "javascript-module",
63260
63254
  "path": "components/input-file/translations/bg-BG.js",
@@ -63745,6 +63739,12 @@
63745
63739
  }
63746
63740
  ]
63747
63741
  },
63742
+ {
63743
+ "kind": "javascript-module",
63744
+ "path": "components/input-file/types/input-file.ts",
63745
+ "declarations": [],
63746
+ "exports": []
63747
+ },
63748
63748
  {
63749
63749
  "kind": "javascript-module",
63750
63750
  "path": "components/input-iban/src/LionInputIban.js",
@@ -1 +1 @@
1
- {"version":3,"file":"withHoverInteraction.d.ts","sourceRoot":"","sources":["../../../../../../components/overlays/src/configurations/visibility-trigger-partials/withHoverInteraction.js"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;GAMG;AACH,4DAHW;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAG,GACtC,QAAQ,aAAa,CAAC,CA+DlC;4BA1EY,OAAO,4BAA4B,EAAE,aAAa;gCAClD,OAAO,sBAAsB,EAAE,iBAAiB"}
1
+ {"version":3,"file":"withHoverInteraction.d.ts","sourceRoot":"","sources":["../../../../../../components/overlays/src/configurations/visibility-trigger-partials/withHoverInteraction.js"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;GAMG;AACH,4DAHW;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAG,GACtC,QAAQ,aAAa,CAAC,CA6DlC;4BAxEY,OAAO,4BAA4B,EAAE,aAAa;gCAClD,OAAO,sBAAsB,EAAE,iBAAiB"}
@@ -52,6 +52,7 @@ export class LionTabs extends LitElement {
52
52
  * @private
53
53
  */
54
54
  private __handleButtonKeyup;
55
+ /** @type {number | undefined} */
55
56
  __selectedIndex: number | undefined;
56
57
  /**
57
58
  * @param {number} value The new index for focus
@@ -1 +1 @@
1
- {"version":3,"file":"LionTabs.d.ts","sourceRoot":"","sources":["../../../../components/tabs/src/LionTabs.js"],"names":[],"mappings":"AAqGA;IACE;;;;;;MAQC;IAED,+CA0BC;IAED,+CASC;IA6MD;;OAEG;IACH,+BAMC;IAhBD;;OAEG;IACH,4BAEC;IAxLD,gCAIC;IAED,4BAIC;IAED,eAAe;IACf,qBAaC;IAED,eAAe;IACf,qBAiCC;IAhCC,2BAA2B;IAC3B,kCAAiB;IAiCnB,eAAe;IACf,qBAQC;IAED;;;;;;OAMG;IACH,gCAUC;IAED;;;;;OAKG;IACH,gCAuBC;IAED;;;;OAIG;IACH,mCAIC;IAED;;;OAGG;IACH,4BAqCC;IAcC,oCAA4B;IAM9B;;;OAGG;IACH,4CAHW,MAAM,QAYhB;IAED,iBAAiB;IACjB,mCAEC;IAED,eAAe;IACf,yBAqBC;CACF;;;;;QAnZa,WAAW;;;;SACX,MAAM;;;;YACN,WAAW;;;;WACX,WAAW;;;;0BACH,KAAK,KAAK,OAAO;;;;4BACjB,KAAK,KAAK,OAAO;;;;0BACjB,KAAK,KAAK,OAAO"}
1
+ {"version":3,"file":"LionTabs.d.ts","sourceRoot":"","sources":["../../../../components/tabs/src/LionTabs.js"],"names":[],"mappings":"AAqGA;IACE;;;;;;MAQC;IAED,+CA0BC;IAED,+CASC;IA6MD;;OAEG;IACH,+BAUC;IApBD;;OAEG;IACH,4BAEC;IAxLD,gCAIC;IAED,4BAIC;IAED,eAAe;IACf,qBAaC;IAED,eAAe;IACf,qBAiCC;IAhCC,2BAA2B;IAC3B,kCAAiB;IAiCnB,eAAe;IACf,qBAQC;IAED;;;;;;OAMG;IACH,gCAUC;IAED;;;;;OAKG;IACH,gCAuBC;IAED;;;;OAIG;IACH,mCAIC;IAED;;;OAGG;IACH,4BAqCC;IAiBC,iCAAiC;IACjC,iBADW,MAAM,GAAG,SAAS,CACD;IAM9B;;;OAGG;IACH,4CAHW,MAAM,QAYhB;IAED,iBAAiB;IACjB,mCAEC;IAED,eAAe;IACf,yBAqBC;CACF;;;;;QAvZa,WAAW;;;;SACX,MAAM;;;;YACN,WAAW;;;;WACX,WAAW;;;;0BACH,KAAK,KAAK,OAAO;;;;4BACjB,KAAK,KAAK,OAAO;;;;0BACjB,KAAK,KAAK,OAAO"}