@scania/tegel 1.23.0-value-prop.beta.2 → 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 (64) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/tds-block.cjs.entry.js +17 -13
  3. package/dist/cjs/tds-checkbox.cjs.entry.js +9 -2
  4. package/dist/cjs/tds-dropdown_2.cjs.entry.js +50 -33
  5. package/dist/cjs/tds-link.cjs.entry.js +5 -3
  6. package/dist/cjs/tds-popover-core.cjs.entry.js +1 -1
  7. package/dist/cjs/tds-slider.cjs.entry.js +33 -7
  8. package/dist/cjs/tegel.cjs.js +1 -1
  9. package/dist/collection/components/block/block.css +11 -5
  10. package/dist/collection/components/block/block.js +16 -12
  11. package/dist/collection/components/checkbox/checkbox.js +19 -3
  12. package/dist/collection/components/dropdown/dropdown.js +50 -33
  13. package/dist/collection/components/link/link.css +7 -1
  14. package/dist/collection/components/link/link.js +22 -2
  15. package/dist/collection/components/popover-core/tds-popover-core.css +36 -29
  16. package/dist/collection/components/slider/slider.js +34 -8
  17. package/dist/components/{p-e02b091c.js → p-5e1a9abc.js} +1 -1
  18. package/dist/components/{p-dcfecf4d.js → p-aea7fa6b.js} +1 -1
  19. package/dist/components/{p-4d8f8d5c.js → p-d8c96665.js} +50 -33
  20. package/dist/components/{p-e4d7c655.js → p-d921fe75.js} +10 -3
  21. package/dist/components/{p-462b77e8.js → p-e7868876.js} +1 -1
  22. package/dist/components/tds-block.js +17 -13
  23. package/dist/components/tds-checkbox.js +1 -1
  24. package/dist/components/tds-dropdown-option.js +1 -1
  25. package/dist/components/tds-dropdown.js +1 -1
  26. package/dist/components/tds-header-dropdown.js +2 -2
  27. package/dist/components/tds-header-launcher.js +2 -2
  28. package/dist/components/tds-link.js +7 -4
  29. package/dist/components/tds-popover-canvas.js +1 -1
  30. package/dist/components/tds-popover-core.js +1 -1
  31. package/dist/components/tds-popover-menu.js +1 -1
  32. package/dist/components/tds-slider.js +33 -7
  33. package/dist/components/tds-table-body-row.js +1 -1
  34. package/dist/components/tds-table-footer.js +3 -3
  35. package/dist/components/tds-table-header.js +1 -1
  36. package/dist/components/tds-tooltip.js +1 -1
  37. package/dist/esm/loader.js +1 -1
  38. package/dist/esm/tds-block.entry.js +17 -13
  39. package/dist/esm/tds-checkbox.entry.js +9 -2
  40. package/dist/esm/tds-dropdown_2.entry.js +50 -33
  41. package/dist/esm/tds-link.entry.js +5 -3
  42. package/dist/esm/tds-popover-core.entry.js +1 -1
  43. package/dist/esm/tds-slider.entry.js +34 -8
  44. package/dist/esm/tegel.js +1 -1
  45. package/dist/tegel/p-2557b79b.entry.js +1 -0
  46. package/dist/tegel/{p-590b5f55.entry.js → p-4e3e2601.entry.js} +1 -1
  47. package/dist/tegel/p-5bc85f3e.entry.js +1 -0
  48. package/dist/tegel/p-6a52ed63.entry.js +1 -0
  49. package/dist/tegel/p-9aefb942.entry.js +1 -0
  50. package/dist/tegel/p-e97a2700.entry.js +1 -0
  51. package/dist/tegel/tegel.css +2 -2
  52. package/dist/tegel/tegel.esm.js +1 -1
  53. package/dist/types/components/block/block.d.ts +1 -2
  54. package/dist/types/components/checkbox/checkbox.d.ts +2 -0
  55. package/dist/types/components/dropdown/dropdown.d.ts +3 -0
  56. package/dist/types/components/link/link.d.ts +2 -0
  57. package/dist/types/components/slider/slider.d.ts +7 -0
  58. package/dist/types/components.d.ts +8 -0
  59. package/package.json +1 -1
  60. package/dist/tegel/p-0c05887d.entry.js +0 -1
  61. package/dist/tegel/p-a464920f.entry.js +0 -1
  62. package/dist/tegel/p-c3513f1f.entry.js +0 -1
  63. package/dist/tegel/p-db00f607.entry.js +0 -1
  64. package/dist/tegel/p-f91c6e9d.entry.js +0 -1
@@ -5150,40 +5150,42 @@ html {
5150
5150
  :root,
5151
5151
  .tds-mode-light {
5152
5152
  --tds-block-color: var(--tds-grey-985);
5153
+ --tds-block-background: var(--tds-grey-50);
5153
5154
  --tds-block-background-primary: var(--tds-grey-50);
5154
- --tds-block-background-nested-primary: var(--tds-white);
5155
5155
  --tds-block-background-secondary: var(--tds-white);
5156
- --tds-block-background-nested-secondary: var(--tds-grey-50);
5157
- --tds-block-background: var(--tds-block-background-primary);
5158
- --tds-block-background-nested: var(--tds-block-background-nested-primary);
5156
+ --tds-block-background-even: var(--tds-grey-50);
5157
+ --tds-block-background-odd: var(--tds-white);
5159
5158
  }
5160
5159
  :root .tds-mode-variant-primary,
5161
5160
  .tds-mode-light .tds-mode-variant-primary {
5162
- --tds-block-background: var(--tds-block-background-primary);
5163
- --tds-block-background-nested: var(--tds-block-background-nested-primary);
5161
+ --tds-block-background: var(--tds-grey-50);
5162
+ --tds-block-background-even: var(--tds-grey-50);
5163
+ --tds-block-background-odd: var(--tds-white);
5164
5164
  }
5165
5165
  :root .tds-mode-variant-secondary,
5166
5166
  .tds-mode-light .tds-mode-variant-secondary {
5167
- --tds-block-background: var(--tds-block-background-secondary);
5168
- --tds-block-background-nested: var(--tds-block-background-nested-secondary);
5167
+ --tds-block-background: var(--tds-white);
5168
+ --tds-block-background-even: var(--tds-white);
5169
+ --tds-block-background-odd: var(--tds-grey-50);
5169
5170
  }
5170
5171
 
5171
5172
  .tds-mode-dark {
5172
5173
  --tds-block-color: var(--tds-grey-50);
5174
+ --tds-block-background: var(--tds-grey-900);
5173
5175
  --tds-block-background-primary: var(--tds-grey-900);
5174
- --tds-block-background-nested-primary: var(--tds-grey-868);
5175
5176
  --tds-block-background-secondary: var(--tds-grey-868);
5176
- --tds-block-background-nested-secondary: var(--tds-grey-900);
5177
- --tds-block-background: var(--tds-block-background-primary);
5178
- --tds-block-background-nested: var(--tds-block-background-nested-primary);
5177
+ --tds-block-background-even: var(--tds-grey-900);
5178
+ --tds-block-background-odd: var(--tds-grey-868);
5179
5179
  }
5180
5180
  .tds-mode-dark .tds-mode-variant-primary {
5181
- --tds-block-background: var(--tds-block-background-primary);
5182
- --tds-block-background-nested: var(--tds-block-background-nested-primary);
5181
+ --tds-block-background: var(--tds-grey-900);
5182
+ --tds-block-background-even: var(--tds-grey-900);
5183
+ --tds-block-background-odd: var(--tds-grey-868);
5183
5184
  }
5184
5185
  .tds-mode-dark .tds-mode-variant-secondary {
5185
- --tds-block-background: var(--tds-block-background-secondary);
5186
- --tds-block-background-nested: var(--tds-block-background-nested-secondary);
5186
+ --tds-block-background: var(--tds-grey-868);
5187
+ --tds-block-background-even: var(--tds-grey-868);
5188
+ --tds-block-background-odd: var(--tds-grey-900);
5187
5189
  }
5188
5190
 
5189
5191
  :root,
@@ -6098,34 +6100,39 @@ html {
6098
6100
 
6099
6101
  :root,
6100
6102
  .tds-mode-light {
6101
- --tds-link: var(--tds-blue-500);
6103
+ --tds-link: var(--tds-blue-400);
6102
6104
  --tds-link-hover: var(--tds-blue-400);
6103
6105
  --tds-link-focus: var(--tds-blue-400);
6104
- --tds-link-visited: var(--tds-grey-900);
6106
+ --tds-link-visited: var(--tds-blue-700);
6105
6107
  --tds-link-disabled: var(--tds-grey-400);
6106
6108
  }
6107
6109
  :root tds-toast,
6108
6110
  .tds-mode-light tds-toast {
6109
- --tds-link: var(--tds-blue-300);
6111
+ --tds-link: var(--tds-blue-400);
6110
6112
  --tds-link-hover: var(--tds-blue-400);
6111
6113
  --tds-link-focus: var(--tds-blue-400);
6112
- --tds-link-visited: var(--tds-blue-100);
6113
- --tds-link-disabled: var(--tds-grey-800);
6114
+ --tds-link-visited: var(--tds-blue-700);
6115
+ --tds-link-disabled: var(--tds-grey-400);
6114
6116
  }
6115
6117
 
6116
6118
  .tds-mode-dark {
6117
6119
  --tds-link: var(--tds-blue-300);
6118
- --tds-link-hover: var(--tds-blue-400);
6119
- --tds-link-focus: var(--tds-blue-400);
6120
+ --tds-link-hover: var(--tds-blue-300);
6121
+ --tds-link-focus: var(--tds-blue-300);
6120
6122
  --tds-link-visited: var(--tds-blue-100);
6121
- --tds-link-disabled: var(--tds-grey-800);
6123
+ --tds-link-disabled: var(--tds-grey-700);
6122
6124
  }
6123
6125
  .tds-mode-dark tds-toast {
6124
- --tds-link: var(--tds-blue-500);
6125
- --tds-link-hover: var(--tds-blue-400);
6126
- --tds-link-focus: var(--tds-blue-400);
6127
- --tds-link-visited: var(--tds-grey-900);
6128
- --tds-link-disabled: var(--tds-grey-400);
6126
+ --tds-link: var(--tds-blue-300);
6127
+ --tds-link-hover: var(--tds-blue-300);
6128
+ --tds-link-focus: var(--tds-blue-300);
6129
+ --tds-link-visited: var(--tds-blue-100);
6130
+ --tds-link-disabled: var(--tds-grey-700);
6131
+ }
6132
+
6133
+ tds-link tds-icon {
6134
+ padding-bottom: 4px;
6135
+ padding-left: 5px;
6129
6136
  }
6130
6137
 
6131
6138
  :root,
@@ -1,4 +1,4 @@
1
- import { h } from "@stencil/core";
1
+ import { h, } from "@stencil/core";
2
2
  import generateUniqueId from "../../utils/generateUniqueId";
3
3
  export class TdsSlider {
4
4
  constructor() {
@@ -16,6 +16,11 @@ export class TdsSlider {
16
16
  this.useSnapping = false;
17
17
  this.supposedValueSlot = -1;
18
18
  this.resizeObserverAdded = false;
19
+ this.resetEventListenerAdded = false;
20
+ this.resetToInitialValue = () => {
21
+ this.forceValueUpdate(this.initialValue);
22
+ this.reset();
23
+ };
19
24
  this.label = '';
20
25
  this.value = '0';
21
26
  this.min = '0';
@@ -295,26 +300,46 @@ export class TdsSlider {
295
300
  }
296
301
  this.calculateThumbLeftFromValue(this.value);
297
302
  this.updateTrack();
303
+ // Only set the initial value once:
304
+ if (!this.initialValue) {
305
+ this.initialValue = this.value;
306
+ }
307
+ }
308
+ componentDidRender() {
309
+ // Only add the event listener once:
310
+ if (!this.resetEventListenerAdded) {
311
+ this.formElement = this.host.closest('form');
312
+ if (this.formElement) {
313
+ this.formElement.addEventListener('reset', this.resetToInitialValue);
314
+ this.resetEventListenerAdded = true;
315
+ }
316
+ }
317
+ }
318
+ disconnectedCallback() {
319
+ if (this.resetEventListenerAdded && this.formElement) {
320
+ this.formElement.removeEventListener('reset', this.resetToInitialValue);
321
+ this.resetEventListenerAdded = false;
322
+ }
298
323
  }
299
324
  render() {
300
- return (h("div", { key: 'fd7d051192c33b19e8c68cbeaa50ea43149457bb', class: {
325
+ return (h("div", { key: 'ed4c71d1701e0711d8b01c015f137f6a3f10457e', class: {
301
326
  'tds-slider-wrapper': true,
302
327
  'read-only': this.readOnly,
303
- } }, h("input", { key: 'd2fe02893f865f5791736cb5f05b5bcd2494e471', class: "tds-slider-native-element", type: "range", name: this.name, min: this.min, max: this.max, value: this.value, disabled: this.disabled }), h("div", { key: '2d436a5654cb20923cd20ed61f9449bd0705edd2', class: {
328
+ } }, h("input", { key: '7d85ba109ec41e45a4ced646cfe092832b2013a7', class: "tds-slider-native-element", type: "range", name: this.name, min: this.min, max: this.max, value: this.value, disabled: this.disabled }), h("div", { key: '7c32efe653a6437068026e0b612bd1cdb0fd580d', class: {
304
329
  'tds-slider': true,
305
330
  'disabled': this.disabled,
306
331
  'tds-slider-small': this.useSmall,
307
332
  }, ref: (el) => {
308
333
  this.wrapperElement = el;
309
- } }, h("label", { key: 'd9d444d15acabbbc23c7b7633e5312f405ff9120', class: this.showTickNumbers && 'offset' }, this.label), this.useInput && (h("div", { key: '2f0d0419138851724891e2ab04fef2f3b3e099f1', class: "tds-slider__input-values" }, h("div", { key: '7f23007c0f4a1aa6358ffa7c5aaae027d0927b63', class: "tds-slider__input-value min-value" }, this.min))), this.useControls && (h("div", { key: 'df4a00a40c541b83aa8459dfcdaf22c348e2c80a', class: "tds-slider__controls" }, h("div", { key: '96cc419d369098137895b725f97a8fa3d7d50dfc', class: "tds-slider__control tds-slider__control-minus", onClick: (event) => this.stepLeft(event) }, h("tds-icon", { key: '09ed43c9f2fe81baeada6a07e4cba18027f04ba1', name: "minus", size: "16px" })))), h("div", { key: '402647683b57076bd4ac3ce3d754585a89a48e08', class: "tds-slider-inner" }, this.tickValues.length > 0 && (h("div", { key: 'd80c648eca47c7e52725e967a32fe4a4692a5729', class: "tds-slider__value-dividers-wrapper" }, h("div", { key: '030106df49f12a55c1b32a9c1c257f449629644a', class: "tds-slider__value-dividers" }, this.tickValues.map((value) => (h("div", { class: "tds-slider__value-divider" }, this.showTickNumbers && h("span", null, value))))))), h("div", { key: 'fef7013f82a191c32bc3a4d297f5e10a4db127a1', class: "tds-slider__track", ref: (el) => {
334
+ } }, h("label", { key: '5561410214fda42ddb4553084f312de9943f825b', class: this.showTickNumbers && 'offset' }, this.label), this.useInput && (h("div", { key: '37340de05febbca285f031bd8df7d9c2588e315d', class: "tds-slider__input-values" }, h("div", { key: 'e973831529eb93eb0b0da6c5f92bd838dfb9bcdb', class: "tds-slider__input-value min-value" }, this.min))), this.useControls && (h("div", { key: '1a710d2d1ffac7533f9bae2908d4341d3b40e2f0', class: "tds-slider__controls" }, h("div", { key: '0a741834782d8e69a7d55e6cd87a3fdf4938d744', class: "tds-slider__control tds-slider__control-minus", onClick: (event) => this.stepLeft(event) }, h("tds-icon", { key: '8c67943ac2e15d742726e76c2b4c029d15c20f32', name: "minus", size: "16px" })))), h("div", { key: '96c4229007fbe882e106bcc3deb34f504c9604e3', class: "tds-slider-inner" }, this.tickValues.length > 0 && (h("div", { key: '905fc1a02070f5419f76ec5d60d8f55d89d4650b', class: "tds-slider__value-dividers-wrapper" }, h("div", { key: 'd2ccbea1b6e26ab1855c81e71730bebea0da37d8', class: "tds-slider__value-dividers" }, this.tickValues.map((value) => (h("div", { class: "tds-slider__value-divider" }, this.showTickNumbers && h("span", null, value))))))), h("div", { key: '30c9b4bb6f59631d443345ee6d1edf1973a83d0b', class: "tds-slider__track", ref: (el) => {
310
335
  this.trackElement = el;
311
- }, tabindex: this.disabled ? '-1' : '0' }, h("div", { key: '24a583182c45114d1e011bffef0f81f1e4f93a36', class: "tds-slider__track-fill", ref: (el) => {
336
+ }, tabindex: this.disabled ? '-1' : '0' }, h("div", { key: '7acbccae98c481c4cfaeb2dc66d67a2e19575b93', class: "tds-slider__track-fill", ref: (el) => {
312
337
  this.trackFillElement = el;
313
- } }), h("div", { key: '3bea53237beb92f41264386fb5ac181d1e9966a4', class: "tds-slider__thumb", ref: (el) => {
338
+ } }), h("div", { key: '46a5c3135c5f765d5fb0845372dc3854586fa44d', class: "tds-slider__thumb", ref: (el) => {
314
339
  this.thumbElement = el;
315
- }, onMouseDown: () => this.grabThumb(), onTouchStart: () => this.grabThumb() }, this.tooltip && (h("div", { key: '3ac44629cad3b03524602f9babe7fa4582b38660', class: "tds-slider__value" }, this.value, h("svg", { key: '5adbbcc274555d14454c5329f0eea8c072a3db2c', width: "18", height: "14", viewBox: "0 0 18 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: '248b1f8521b89be4214631e411c0ba9c7bcc07a8', d: "M8.15882 12.6915L0.990487 1.54076C0.562658 0.875246 1.0405 0 1.83167 0H16.1683C16.9595 0 17.4373 0.875246 17.0095 1.54076L9.84118 12.6915C9.44754 13.3038 8.55246 13.3038 8.15882 12.6915Z", fill: "currentColor" })))), h("div", { key: 'bc778a9ccd25a5229aa7685cc6c22ed5385b9d98', class: "tds-slider__thumb-inner", ref: (el) => {
340
+ }, onMouseDown: () => this.grabThumb(), onTouchStart: () => this.grabThumb() }, this.tooltip && (h("div", { key: 'd39cd29d1e6302f8bd4a3d827797f8822e24b84d', class: "tds-slider__value" }, this.value, h("svg", { key: '5946f90b70b2afb2efc7f3a3bc5817a82ac3ca4a', width: "18", height: "14", viewBox: "0 0 18 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: '9456df642aca39b94b17bb529ca02e2d6a2fde6c', d: "M8.15882 12.6915L0.990487 1.54076C0.562658 0.875246 1.0405 0 1.83167 0H16.1683C16.9595 0 17.4373 0.875246 17.0095 1.54076L9.84118 12.6915C9.44754 13.3038 8.55246 13.3038 8.15882 12.6915Z", fill: "currentColor" })))), h("div", { key: 'b4ca73a085f837d7e87e3334b8e58e5638125118', class: "tds-slider__thumb-inner", ref: (el) => {
316
341
  this.thumbInnerElement = el;
317
- } })))), this.useInput && (h("div", { key: '077ffffeb0986504a2c9fc4e1b08095ec689402c', class: "tds-slider__input-values" }, h("div", { key: '74a528a286e2b49a6739c5817cca8a0436b908b9', class: "tds-slider__input-value", onClick: (event) => this.stepLeft(event) }, this.max), h("div", { key: 'af2a647636c8eecba19637aa92ddda37adc52a1b', class: "tds-slider__input-field-wrapper" }, h("input", { key: '02701d15de6119994f7be13b9c9ac69ae6f2269b', size: this.calculateInputSizeFromMax(), class: "tds-slider__input-field", value: this.value, readOnly: this.readOnly, onBlur: (event) => this.updateSliderValueOnInputChange(event), onKeyDown: (event) => this.handleInputFieldEnterPress(event), type: "number", min: this.min, max: this.max })))), this.useControls && (h("div", { key: 'ef215ef613c381601674d4bb7dbea583a3ddde2a', class: "tds-slider__controls" }, h("div", { key: '4e553194348daf32529c9c8cedc32b0686ac32ff', class: "tds-slider__control tds-slider__control-plus", onClick: (event) => this.stepRight(event) }, h("tds-icon", { key: 'd5d67ea7ff64ed19d28bd078acad56ebda742f93', name: "plus", size: "16px" })))))));
342
+ } })))), this.useInput && (h("div", { key: '6574286ac7764807fd1e18875d6fa39ab7f7b304', class: "tds-slider__input-values" }, h("div", { key: '57a92adf59551f551c4ae06355c276a69b34028a', class: "tds-slider__input-value", onClick: (event) => this.stepLeft(event) }, this.max), h("div", { key: '0e1632ca8c9510177d349147749e3162aa46f219', class: "tds-slider__input-field-wrapper" }, h("input", { key: '094d194bce54d1073a5d657f7bc3f30107f5fe41', size: this.calculateInputSizeFromMax(), class: "tds-slider__input-field", value: this.value, readOnly: this.readOnly, onBlur: (event) => this.updateSliderValueOnInputChange(event), onKeyDown: (event) => this.handleInputFieldEnterPress(event), type: "number", min: this.min, max: this.max })))), this.useControls && (h("div", { key: '207398a3fd02e11f09c70ebbb8b293d6c16afd1f', class: "tds-slider__controls" }, h("div", { key: 'ca93ce9a55d0db25a3eaefd6e4dbc53106afc895', class: "tds-slider__control tds-slider__control-plus", onClick: (event) => this.stepRight(event) }, h("tds-icon", { key: '6ab123f8701fdd93580a61c500ae6da658b547fd', name: "plus", size: "16px" })))))));
318
343
  }
319
344
  static get is() { return "tds-slider"; }
320
345
  static get originalStyleUrls() {
@@ -673,6 +698,7 @@ export class TdsSlider {
673
698
  }
674
699
  };
675
700
  }
701
+ static get elementRef() { return "host"; }
676
702
  static get watchers() {
677
703
  return [{
678
704
  "propName": "value",