@scania/tegel 1.23.0-value-prop.beta.3 → 1.23.0-value-prop.beta.4

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 (31) hide show
  1. package/dist/cjs/tds-block.cjs.entry.js +17 -13
  2. package/dist/cjs/tds-dropdown_2.cjs.entry.js +7 -5
  3. package/dist/cjs/tds-popover-core.cjs.entry.js +1 -1
  4. package/dist/collection/components/block/block.css +11 -5
  5. package/dist/collection/components/block/block.js +16 -12
  6. package/dist/collection/components/dropdown/dropdown.js +7 -5
  7. package/dist/collection/components/popover-core/tds-popover-core.css +18 -16
  8. package/dist/components/{p-a7a89410.js → p-5e1a9abc.js} +1 -1
  9. package/dist/components/{p-5eaae628.js → p-aea7fa6b.js} +1 -1
  10. package/dist/components/{p-aa12ddb9.js → p-d8c96665.js} +7 -5
  11. package/dist/components/tds-block.js +17 -13
  12. package/dist/components/tds-dropdown.js +1 -1
  13. package/dist/components/tds-header-dropdown.js +2 -2
  14. package/dist/components/tds-header-launcher.js +2 -2
  15. package/dist/components/tds-popover-canvas.js +1 -1
  16. package/dist/components/tds-popover-core.js +1 -1
  17. package/dist/components/tds-popover-menu.js +1 -1
  18. package/dist/components/tds-table-footer.js +1 -1
  19. package/dist/components/tds-tooltip.js +1 -1
  20. package/dist/esm/tds-block.entry.js +17 -13
  21. package/dist/esm/tds-dropdown_2.entry.js +7 -5
  22. package/dist/esm/tds-popover-core.entry.js +1 -1
  23. package/dist/tegel/{p-370f899b.entry.js → p-4e3e2601.entry.js} +1 -1
  24. package/dist/tegel/p-5bc85f3e.entry.js +1 -0
  25. package/dist/tegel/p-9aefb942.entry.js +1 -0
  26. package/dist/tegel/tegel.css +1 -1
  27. package/dist/tegel/tegel.esm.js +1 -1
  28. package/dist/types/components/block/block.d.ts +1 -2
  29. package/package.json +1 -1
  30. package/dist/tegel/p-be8d494d.entry.js +0 -1
  31. package/dist/tegel/p-db00f607.entry.js +0 -1
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-ca8040ad.js');
6
6
 
7
- const blockCss = ".tds-block{box-sizing:border-box;color:var(--tds-block-color);border-radius:4px;padding:16px;font:var(--tds-body-01);letter-spacing:var(--tds-body-01-ls);background-color:var(--tds-block-background)}.tds-block *{box-sizing:border-box}.tds-mode-variant-primary{--tds-block-background:var(--tds-block-background-primary);--tds-block-background-nested:var(--tds-block-background-nested-primary)}.tds-mode-variant-secondary{--tds-block-background:var(--tds-block-background-secondary);--tds-block-background-nested:var(--tds-block-background-nested-secondary)}";
7
+ const blockCss = ".tds-block{box-sizing:border-box;color:var(--tds-block-color);background-color:var(--tds-block-background);border-radius:4px;padding:16px;font:var(--tds-body-01);letter-spacing:var(--tds-body-01-ls)}.tds-block *{box-sizing:border-box}.tds-mode-variant-primary{background-color:var(--tds-block-background-primary)}.tds-mode-variant-secondary{background-color:var(--tds-block-background-secondary)}.tds-block-even{background-color:var(--tds-block-background-even)}.tds-block-odd{background-color:var(--tds-block-background-odd)}";
8
8
  const TdsBlockStyle0 = blockCss;
9
9
 
10
10
  const TdsBlock = class {
@@ -12,21 +12,25 @@ const TdsBlock = class {
12
12
  index.registerInstance(this, hostRef);
13
13
  this.modeVariant = null;
14
14
  }
15
- setModeVariantOnChildBlocks() {
16
- var _a;
17
- this.children = Array.from(this.host.children).filter((item) => item.tagName === 'TDS-BLOCK');
18
- (_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach((item) => {
19
- if (!this.modeVariant) {
20
- item.setAttribute('mode-variant', 'secondary');
15
+ getNestingLevel() {
16
+ let level = 0;
17
+ let parent = this.host.parentElement;
18
+ while (parent) {
19
+ if (parent.tagName.toLowerCase() === 'tds-block') {
20
+ level++;
21
21
  }
22
- else {
23
- item.setAttribute('mode-variant', this.modeVariant === 'primary' ? 'secondary' : 'primary');
24
- }
25
- });
22
+ parent = parent.parentElement;
23
+ }
24
+ return level;
26
25
  }
27
26
  render() {
28
- this.setModeVariantOnChildBlocks();
29
- return (index.h("div", { key: 'a40067afde48258475108cb9785555e7c2bd0a47', class: `tds-block ${this.modeVariant !== null ? `tds-mode-variant-${this.modeVariant}` : ''}` }, index.h("slot", { key: 'aaf62c59a3a01a0c41a594c15257e4746a049418' })));
27
+ const nestingLevel = this.getNestingLevel();
28
+ const evenOddClass = this.modeVariant === null
29
+ ? nestingLevel % 2 === 0
30
+ ? 'tds-block-even'
31
+ : 'tds-block-odd'
32
+ : '';
33
+ return (index.h("div", { key: '5f22f1b8ae254a577a151563deadd969e90e3d20', class: `tds-block ${evenOddClass} ${this.modeVariant !== null ? `tds-mode-variant-${this.modeVariant}` : ''}` }, index.h("slot", { key: '52367d3055296ebd2b6e8291786554f34253750f' })));
30
34
  }
31
35
  get host() { return index.getElement(this); }
32
36
  };
@@ -175,8 +175,10 @@ const TdsDropdown = class {
175
175
  this.handleFilterReset = () => {
176
176
  this.reset();
177
177
  this.inputElement.value = '';
178
- this.handleFilter({ target: { value: this.inputElement.value } });
178
+ this.handleFilter({ target: { value: '' } });
179
179
  this.inputElement.focus();
180
+ // Add this line to ensure internal value is cleared
181
+ this.internalValue = '';
180
182
  };
181
183
  this.handleFocus = (event) => {
182
184
  this.open = true;
@@ -353,7 +355,7 @@ const TdsDropdown = class {
353
355
  handleOpenState() {
354
356
  if (this.filter && this.multiselect) {
355
357
  if (!this.open) {
356
- this.inputElement.value = this.getValue();
358
+ this.inputElement.value = this.selectedOptions.length ? this.getValue() : '';
357
359
  }
358
360
  }
359
361
  }
@@ -393,7 +395,7 @@ const TdsDropdown = class {
393
395
  }
394
396
  render() {
395
397
  appendHiddenInput(this.host, this.name, this.selectedOptions.join(','), this.disabled);
396
- return (index.h(index.Host, { key: 'b80b938a7e06df4883e939cf9cf06cbb5d2dc12b', role: "select", class: `${this.modeVariant ? `tds-mode-variant-${this.modeVariant}` : ''}` }, this.label && this.labelPosition === 'outside' && (index.h("div", { key: '75172f55ac3adc34a050bbeba543165b6c6ec445', class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), index.h("div", { key: 'd0498b07c2446b7ccde5bd09a95157454ffc2331', class: `dropdown-select ${this.size} ${this.disabled ? 'disabled' : ''}` }, this.filter ? (index.h("div", { class: {
398
+ return (index.h(index.Host, { key: '198e38f89945016a0305584262b751053a00ac2e', role: "select", class: `${this.modeVariant ? `tds-mode-variant-${this.modeVariant}` : ''}` }, this.label && this.labelPosition === 'outside' && (index.h("div", { key: 'f785bd85282f653e9da367ced8aac22b62061b6d', class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), index.h("div", { key: '9a93fa9b9c343bb748de3324cf3fda0839d24b5b', class: `dropdown-select ${this.size} ${this.disabled ? 'disabled' : ''}` }, this.filter ? (index.h("div", { class: {
397
399
  filter: true,
398
400
  focus: this.filterFocus,
399
401
  disabled: this.disabled,
@@ -435,7 +437,7 @@ const TdsDropdown = class {
435
437
  label-inside-as-placeholder
436
438
  ${this.size}
437
439
  ${this.selectedOptions.length ? 'selected' : ''}
438
- ` }, this.label)), index.h("div", { class: `placeholder ${this.size}` }, this.selectedOptions.length ? this.getValue() : this.placeholder), index.h("tds-icon", { "aria-label": "Open/Close dropdown", svgTitle: "Open/Close dropdown", class: `menu-icon ${this.open ? 'open' : 'closed'}`, name: "chevron_down", size: "16px" }))))), index.h("div", { key: '999a08cee6035f37217270681b58411badc1596d', ref: (element) => (this.dropdownList = element), class: {
440
+ ` }, this.label)), index.h("div", { class: `placeholder ${this.size}` }, this.selectedOptions.length ? this.getValue() : this.placeholder), index.h("tds-icon", { "aria-label": "Open/Close dropdown", svgTitle: "Open/Close dropdown", class: `menu-icon ${this.open ? 'open' : 'closed'}`, name: "chevron_down", size: "16px" }))))), index.h("div", { key: '38ea3153aa17144d03c3472600f7c22b9e7d1ee8', ref: (element) => (this.dropdownList = element), class: {
439
441
  'dropdown-list': true,
440
442
  [this.size]: true,
441
443
  [this.getOpenDirection()]: true,
@@ -444,7 +446,7 @@ const TdsDropdown = class {
444
446
  'closed': !this.open,
445
447
  [`animation-enter-${this.animation}`]: this.animation !== 'none' && this.open,
446
448
  [`animation-exit-${this.animation}`]: this.animation !== 'none' && !this.open,
447
- } }, index.h("slot", { key: 'f6e55be5581a1b5a24da4643508c4fe76767c9c7', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (index.h("div", { key: '6184dce7e827ee6c2c0403e8531ea8ac782e3073', class: `no-result ${this.size}` }, this.noResultText))), this.helper && (index.h("div", { key: '33bd5d3695247cfaaa66bb67b6ac6a5ced795c72', class: `helper ${this.error ? 'error' : ''} ${this.disabled ? 'disabled' : ''}` }, this.error && index.h("tds-icon", { key: '6f3681a038fc95bb90e7877c54eff0b4c807b877', name: "error", size: "16px" }), this.helper))));
449
+ } }, index.h("slot", { key: 'dfe65bc02f12a01b4ef4d710c3e8fabe68d36530', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (index.h("div", { key: '5d4d52a9dc9a1ac4c35ae62a2543c15d8f252a08', class: `no-result ${this.size}` }, this.noResultText))), this.helper && (index.h("div", { key: 'f48a3d2320ebe64c439127898eb4540ccd21b421', class: `helper ${this.error ? 'error' : ''} ${this.disabled ? 'disabled' : ''}` }, this.error && index.h("tds-icon", { key: 'ca396e64d54c1f4fe95b0407eab80e78a7249c43', name: "error", size: "16px" }), this.helper))));
448
450
  }
449
451
  get host() { return index.getElement(this); }
450
452
  static get watchers() { return {