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

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 (56) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/tds-checkbox.cjs.entry.js +9 -2
  3. package/dist/cjs/tds-dropdown_2.cjs.entry.js +46 -31
  4. package/dist/cjs/tds-link.cjs.entry.js +5 -3
  5. package/dist/cjs/tds-popover-core.cjs.entry.js +1 -1
  6. package/dist/cjs/tds-slider.cjs.entry.js +33 -7
  7. package/dist/cjs/tegel.cjs.js +1 -1
  8. package/dist/collection/components/checkbox/checkbox.js +19 -3
  9. package/dist/collection/components/dropdown/dropdown.js +46 -31
  10. package/dist/collection/components/link/link.css +7 -1
  11. package/dist/collection/components/link/link.js +22 -2
  12. package/dist/collection/components/popover-core/tds-popover-core.css +18 -13
  13. package/dist/collection/components/slider/slider.js +34 -8
  14. package/dist/components/{p-dcfecf4d.js → p-5eaae628.js} +1 -1
  15. package/dist/components/{p-e02b091c.js → p-a7a89410.js} +1 -1
  16. package/dist/components/{p-4d8f8d5c.js → p-aa12ddb9.js} +46 -31
  17. package/dist/components/{p-e4d7c655.js → p-d921fe75.js} +10 -3
  18. package/dist/components/{p-462b77e8.js → p-e7868876.js} +1 -1
  19. package/dist/components/tds-checkbox.js +1 -1
  20. package/dist/components/tds-dropdown-option.js +1 -1
  21. package/dist/components/tds-dropdown.js +1 -1
  22. package/dist/components/tds-header-dropdown.js +2 -2
  23. package/dist/components/tds-header-launcher.js +2 -2
  24. package/dist/components/tds-link.js +7 -4
  25. package/dist/components/tds-popover-canvas.js +1 -1
  26. package/dist/components/tds-popover-core.js +1 -1
  27. package/dist/components/tds-popover-menu.js +1 -1
  28. package/dist/components/tds-slider.js +33 -7
  29. package/dist/components/tds-table-body-row.js +1 -1
  30. package/dist/components/tds-table-footer.js +3 -3
  31. package/dist/components/tds-table-header.js +1 -1
  32. package/dist/components/tds-tooltip.js +1 -1
  33. package/dist/esm/loader.js +1 -1
  34. package/dist/esm/tds-checkbox.entry.js +9 -2
  35. package/dist/esm/tds-dropdown_2.entry.js +46 -31
  36. package/dist/esm/tds-link.entry.js +5 -3
  37. package/dist/esm/tds-popover-core.entry.js +1 -1
  38. package/dist/esm/tds-slider.entry.js +34 -8
  39. package/dist/esm/tegel.js +1 -1
  40. package/dist/tegel/p-2557b79b.entry.js +1 -0
  41. package/dist/tegel/{p-590b5f55.entry.js → p-370f899b.entry.js} +1 -1
  42. package/dist/tegel/p-6a52ed63.entry.js +1 -0
  43. package/dist/tegel/p-be8d494d.entry.js +1 -0
  44. package/dist/tegel/p-e97a2700.entry.js +1 -0
  45. package/dist/tegel/tegel.css +1 -1
  46. package/dist/tegel/tegel.esm.js +1 -1
  47. package/dist/types/components/checkbox/checkbox.d.ts +2 -0
  48. package/dist/types/components/dropdown/dropdown.d.ts +3 -0
  49. package/dist/types/components/link/link.d.ts +2 -0
  50. package/dist/types/components/slider/slider.d.ts +7 -0
  51. package/dist/types/components.d.ts +8 -0
  52. package/package.json +1 -1
  53. package/dist/tegel/p-0c05887d.entry.js +0 -1
  54. package/dist/tegel/p-a464920f.entry.js +0 -1
  55. package/dist/tegel/p-c3513f1f.entry.js +0 -1
  56. package/dist/tegel/p-f91c6e9d.entry.js +0 -1
@@ -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",
@@ -1,6 +1,6 @@
1
1
  import { p as proxyCustomElement, H, h, c as Host } from './p-28ef5186.js';
2
2
  import { i as inheritAttributes } from './p-3fe9cbbf.js';
3
- import { d as defineCustomElement$1 } from './p-e02b091c.js';
3
+ import { d as defineCustomElement$1 } from './p-a7a89410.js';
4
4
 
5
5
  const popoverCanvasCss = ".tds-popover-canvas.sc-tds-popover-canvas{box-sizing:border-box;display:inline-block;color:var(--tds-popover-canvas-color);background-color:var(--tds-popover-canvas-background);box-shadow:0 3px 3px rgba(0, 0, 0, 0.15), 0 -1px 1px rgba(0, 0, 0, 0.1);border-radius:4px;z-index:900}.tds-popover-canvas.sc-tds-popover-canvas *.sc-tds-popover-canvas{box-sizing:border-box}";
6
6
  const TdsPopoverCanvasStyle0 = popoverCanvasCss;