@limetech/lime-elements 38.23.0 → 38.23.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 (130) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/{checkbox.template-f624966b.js → checkbox.template-92ae2e60.js} +3 -3
  3. package/dist/cjs/checkbox.template-92ae2e60.js.map +1 -0
  4. package/dist/cjs/limel-checkbox.cjs.entry.js +1 -1
  5. package/dist/cjs/limel-chip_2.cjs.entry.js +1 -1
  6. package/dist/cjs/limel-chip_2.cjs.entry.js.map +1 -1
  7. package/dist/cjs/limel-color-picker-palette.cjs.entry.js +1 -1
  8. package/dist/cjs/limel-color-picker-palette.cjs.entry.js.map +1 -1
  9. package/dist/cjs/limel-color-picker.cjs.entry.js +1 -1
  10. package/dist/cjs/limel-color-picker.cjs.entry.js.map +1 -1
  11. package/dist/cjs/limel-dynamic-label_4.cjs.entry.js +1 -1
  12. package/dist/cjs/limel-info-tile.cjs.entry.js +1 -1
  13. package/dist/cjs/limel-info-tile.cjs.entry.js.map +1 -1
  14. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +1 -1
  15. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
  16. package/dist/cjs/limel-slider.cjs.entry.js +1 -1
  17. package/dist/cjs/limel-slider.cjs.entry.js.map +1 -1
  18. package/dist/cjs/limel-switch.cjs.entry.js +2 -2
  19. package/dist/cjs/limel-switch.cjs.entry.js.map +1 -1
  20. package/dist/cjs/limel-text-editor.cjs.entry.js +2 -2
  21. package/dist/cjs/limel-text-editor.cjs.entry.js.map +1 -1
  22. package/dist/collection/components/action-bar/action-bar-item/action-bar-item.css +10 -0
  23. package/dist/collection/components/action-bar/action-bar.css +10 -0
  24. package/dist/collection/components/badge/badge.css +10 -0
  25. package/dist/collection/components/breadcrumbs/breadcrumbs.css +10 -0
  26. package/dist/collection/components/button/button.css +10 -0
  27. package/dist/collection/components/button-group/button-group.css +10 -0
  28. package/dist/collection/components/card/card.css +10 -0
  29. package/dist/collection/components/chart/chart.css +20 -0
  30. package/dist/collection/components/checkbox/checkbox.css +10 -0
  31. package/dist/collection/components/checkbox/checkbox.template.js +2 -2
  32. package/dist/collection/components/checkbox/checkbox.template.js.map +1 -1
  33. package/dist/collection/components/chip/chip.css +11 -1
  34. package/dist/collection/components/chip-set/chip-set.css +20 -0
  35. package/dist/collection/components/circular-progress/circular-progress.css +10 -0
  36. package/dist/collection/components/code-editor/code-editor.css +10 -0
  37. package/dist/collection/components/collapsible-section/collapsible-section.css +10 -0
  38. package/dist/collection/components/color-picker/color-picker-palette.css +21 -2
  39. package/dist/collection/components/color-picker/color-picker.css +11 -2
  40. package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.css +10 -0
  41. package/dist/collection/components/dialog/dialog.css +10 -0
  42. package/dist/collection/components/dock/dock-button/dock-button.css +10 -0
  43. package/dist/collection/components/dock/dock.css +10 -0
  44. package/dist/collection/components/file/file.css +10 -0
  45. package/dist/collection/components/file-viewer/file-viewer.css +10 -0
  46. package/dist/collection/components/form/form.css +10 -0
  47. package/dist/collection/components/header/header.css +10 -0
  48. package/dist/collection/components/help/help.css +10 -0
  49. package/dist/collection/components/help/limel-help-content.css +10 -0
  50. package/dist/collection/components/icon-button/icon-button.css +10 -0
  51. package/dist/collection/components/info-tile/info-tile.css +10 -0
  52. package/dist/collection/components/input-field/input-field.css +10 -0
  53. package/dist/collection/components/list/list.css +50 -0
  54. package/dist/collection/components/markdown/markdown.css +10 -0
  55. package/dist/collection/components/menu-list/menu-list.css +50 -0
  56. package/dist/collection/components/notched-outline/notched-outline.css +10 -0
  57. package/dist/collection/components/popover-surface/popover-surface.css +10 -0
  58. package/dist/collection/components/progress-flow/progress-flow-item/progress-flow-item.css +10 -0
  59. package/dist/collection/components/select/select.css +20 -0
  60. package/dist/collection/components/shortcut/shortcut.css +10 -0
  61. package/dist/collection/components/slider/slider.css +10 -0
  62. package/dist/collection/components/slider/slider.js +1 -1
  63. package/dist/collection/components/slider/slider.js.map +1 -1
  64. package/dist/collection/components/split-button/split-button.css +10 -0
  65. package/dist/collection/components/switch/switch.css +10 -0
  66. package/dist/collection/components/switch/switch.js +2 -2
  67. package/dist/collection/components/switch/switch.js.map +1 -1
  68. package/dist/collection/components/tab-bar/tab-bar.css +10 -0
  69. package/dist/collection/components/table/table.css +40 -0
  70. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.css +11 -1
  71. package/dist/collection/components/text-editor/text-editor.css +10 -0
  72. package/dist/collection/components/text-editor/text-editor.js +2 -2
  73. package/dist/collection/components/text-editor/text-editor.js.map +1 -1
  74. package/dist/collection/style/mixins.scss +54 -0
  75. package/dist/esm/{checkbox.template-890a59d7.js → checkbox.template-9acc6347.js} +3 -3
  76. package/dist/esm/checkbox.template-9acc6347.js.map +1 -0
  77. package/dist/esm/limel-checkbox.entry.js +1 -1
  78. package/dist/esm/limel-chip_2.entry.js +1 -1
  79. package/dist/esm/limel-chip_2.entry.js.map +1 -1
  80. package/dist/esm/limel-color-picker-palette.entry.js +1 -1
  81. package/dist/esm/limel-color-picker-palette.entry.js.map +1 -1
  82. package/dist/esm/limel-color-picker.entry.js +1 -1
  83. package/dist/esm/limel-color-picker.entry.js.map +1 -1
  84. package/dist/esm/limel-dynamic-label_4.entry.js +1 -1
  85. package/dist/esm/limel-info-tile.entry.js +1 -1
  86. package/dist/esm/limel-info-tile.entry.js.map +1 -1
  87. package/dist/esm/limel-prosemirror-adapter.entry.js +1 -1
  88. package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
  89. package/dist/esm/limel-slider.entry.js +1 -1
  90. package/dist/esm/limel-slider.entry.js.map +1 -1
  91. package/dist/esm/limel-switch.entry.js +2 -2
  92. package/dist/esm/limel-switch.entry.js.map +1 -1
  93. package/dist/esm/limel-text-editor.entry.js +2 -2
  94. package/dist/esm/limel-text-editor.entry.js.map +1 -1
  95. package/dist/lime-elements/lime-elements.esm.js +1 -1
  96. package/dist/lime-elements/{p-bf647874.entry.js → p-026417fa.entry.js} +2 -2
  97. package/dist/lime-elements/{p-a0fa40ee.entry.js → p-2116b3ce.entry.js} +2 -2
  98. package/dist/lime-elements/{p-a0fa40ee.entry.js.map → p-2116b3ce.entry.js.map} +1 -1
  99. package/dist/lime-elements/{p-45b6d10e.entry.js → p-250acfe4.entry.js} +2 -2
  100. package/dist/lime-elements/p-250acfe4.entry.js.map +1 -0
  101. package/dist/lime-elements/{p-549629d5.entry.js → p-51d475d8.entry.js} +2 -2
  102. package/dist/lime-elements/{p-549629d5.entry.js.map → p-51d475d8.entry.js.map} +1 -1
  103. package/dist/lime-elements/{p-51f9673e.entry.js → p-63f2f6b8.entry.js} +2 -2
  104. package/dist/lime-elements/{p-51f9673e.entry.js.map → p-63f2f6b8.entry.js.map} +1 -1
  105. package/dist/lime-elements/p-8ded6465.js +2 -0
  106. package/dist/lime-elements/p-8ded6465.js.map +1 -0
  107. package/dist/lime-elements/{p-9fd87a37.entry.js → p-9abbe61a.entry.js} +2 -2
  108. package/dist/lime-elements/{p-9fd87a37.entry.js.map → p-9abbe61a.entry.js.map} +1 -1
  109. package/dist/lime-elements/{p-bd37337a.entry.js → p-a7aa383b.entry.js} +2 -2
  110. package/dist/lime-elements/p-bc5bbdf6.entry.js +2 -0
  111. package/dist/lime-elements/p-bc5bbdf6.entry.js.map +1 -0
  112. package/dist/lime-elements/p-d7e93894.entry.js +2 -0
  113. package/dist/lime-elements/p-d7e93894.entry.js.map +1 -0
  114. package/dist/lime-elements/p-e6245ef7.entry.js +2 -0
  115. package/dist/lime-elements/{p-128eed56.entry.js.map → p-e6245ef7.entry.js.map} +1 -1
  116. package/dist/lime-elements/style/mixins.scss +54 -0
  117. package/dist/scss/mixins.scss +54 -0
  118. package/package.json +1 -1
  119. package/dist/cjs/checkbox.template-f624966b.js.map +0 -1
  120. package/dist/esm/checkbox.template-890a59d7.js.map +0 -1
  121. package/dist/lime-elements/p-128eed56.entry.js +0 -2
  122. package/dist/lime-elements/p-2c69d13e.js +0 -2
  123. package/dist/lime-elements/p-2c69d13e.js.map +0 -1
  124. package/dist/lime-elements/p-45b6d10e.entry.js.map +0 -1
  125. package/dist/lime-elements/p-6b1426df.entry.js +0 -2
  126. package/dist/lime-elements/p-6b1426df.entry.js.map +0 -1
  127. package/dist/lime-elements/p-76483b4b.entry.js +0 -2
  128. package/dist/lime-elements/p-76483b4b.entry.js.map +0 -1
  129. /package/dist/lime-elements/{p-bf647874.entry.js.map → p-026417fa.entry.js.map} +0 -0
  130. /package/dist/lime-elements/{p-bd37337a.entry.js.map → p-a7aa383b.entry.js.map} +0 -0
@@ -69,6 +69,16 @@
69
69
  * to enable you to truncate a piece of text,
70
70
  * after a certain number of lines.
71
71
  */
72
+ /**
73
+ * This mixin will add a chessboard background pattern,
74
+ * typically used to visualize transparency.
75
+ */
76
+ /**
77
+ * Make a container resizable by the user.
78
+ * This is used in the documentations and examples
79
+ * of some components, to demonstrate how the component
80
+ * behaves in a resizable container.
81
+ */
72
82
  /**
73
83
  * The breakpoints below are used to create responsive designs
74
84
  * in Lime's products. Therefore, they are here to get distributed
@@ -3792,6 +3802,16 @@ img {
3792
3802
  * to enable you to truncate a piece of text,
3793
3803
  * after a certain number of lines.
3794
3804
  */
3805
+ /**
3806
+ * This mixin will add a chessboard background pattern,
3807
+ * typically used to visualize transparency.
3808
+ */
3809
+ /**
3810
+ * Make a container resizable by the user.
3811
+ * This is used in the documentations and examples
3812
+ * of some components, to demonstrate how the component
3813
+ * behaves in a resizable container.
3814
+ */
3795
3815
  /**
3796
3816
  * The breakpoints below are used to create responsive designs
3797
3817
  * in Lime's products. Therefore, they are here to get distributed
@@ -4090,6 +4110,16 @@ limel-dynamic-label {
4090
4110
  * to enable you to truncate a piece of text,
4091
4111
  * after a certain number of lines.
4092
4112
  */
4113
+ /**
4114
+ * This mixin will add a chessboard background pattern,
4115
+ * typically used to visualize transparency.
4116
+ */
4117
+ /**
4118
+ * Make a container resizable by the user.
4119
+ * This is used in the documentations and examples
4120
+ * of some components, to demonstrate how the component
4121
+ * behaves in a resizable container.
4122
+ */
4093
4123
  /**
4094
4124
  * The breakpoints below are used to create responsive designs
4095
4125
  * in Lime's products. Therefore, they are here to get distributed
@@ -4335,6 +4365,16 @@ label.boolean-input-label {
4335
4365
  * to enable you to truncate a piece of text,
4336
4366
  * after a certain number of lines.
4337
4367
  */
4368
+ /**
4369
+ * This mixin will add a chessboard background pattern,
4370
+ * typically used to visualize transparency.
4371
+ */
4372
+ /**
4373
+ * Make a container resizable by the user.
4374
+ * This is used in the documentations and examples
4375
+ * of some components, to demonstrate how the component
4376
+ * behaves in a resizable container.
4377
+ */
4338
4378
  /**
4339
4379
  * The breakpoints below are used to create responsive designs
4340
4380
  * in Lime's products. Therefore, they are here to get distributed
@@ -4457,6 +4497,16 @@ label.boolean-input-label {
4457
4497
  * to enable you to truncate a piece of text,
4458
4498
  * after a certain number of lines.
4459
4499
  */
4500
+ /**
4501
+ * This mixin will add a chessboard background pattern,
4502
+ * typically used to visualize transparency.
4503
+ */
4504
+ /**
4505
+ * Make a container resizable by the user.
4506
+ * This is used in the documentations and examples
4507
+ * of some components, to demonstrate how the component
4508
+ * behaves in a resizable container.
4509
+ */
4460
4510
  /**
4461
4511
  * The breakpoints below are used to create responsive designs
4462
4512
  * in Lime's products. Therefore, they are here to get distributed
@@ -57,6 +57,16 @@
57
57
  * to enable you to truncate a piece of text,
58
58
  * after a certain number of lines.
59
59
  */
60
+ /**
61
+ * This mixin will add a chessboard background pattern,
62
+ * typically used to visualize transparency.
63
+ */
64
+ /**
65
+ * Make a container resizable by the user.
66
+ * This is used in the documentations and examples
67
+ * of some components, to demonstrate how the component
68
+ * behaves in a resizable container.
69
+ */
60
70
  /**
61
71
  * The breakpoints below are used to create responsive designs
62
72
  * in Lime's products. Therefore, they are here to get distributed
@@ -63,6 +63,16 @@
63
63
  * to enable you to truncate a piece of text,
64
64
  * after a certain number of lines.
65
65
  */
66
+ /**
67
+ * This mixin will add a chessboard background pattern,
68
+ * typically used to visualize transparency.
69
+ */
70
+ /**
71
+ * Make a container resizable by the user.
72
+ * This is used in the documentations and examples
73
+ * of some components, to demonstrate how the component
74
+ * behaves in a resizable container.
75
+ */
66
76
  /**
67
77
  * The breakpoints below are used to create responsive designs
68
78
  * in Lime's products. Therefore, they are here to get distributed
@@ -57,6 +57,16 @@
57
57
  * to enable you to truncate a piece of text,
58
58
  * after a certain number of lines.
59
59
  */
60
+ /**
61
+ * This mixin will add a chessboard background pattern,
62
+ * typically used to visualize transparency.
63
+ */
64
+ /**
65
+ * Make a container resizable by the user.
66
+ * This is used in the documentations and examples
67
+ * of some components, to demonstrate how the component
68
+ * behaves in a resizable container.
69
+ */
60
70
  /**
61
71
  * The breakpoints below are used to create responsive designs
62
72
  * in Lime's products. Therefore, they are here to get distributed
@@ -63,6 +63,16 @@
63
63
  * to enable you to truncate a piece of text,
64
64
  * after a certain number of lines.
65
65
  */
66
+ /**
67
+ * This mixin will add a chessboard background pattern,
68
+ * typically used to visualize transparency.
69
+ */
70
+ /**
71
+ * Make a container resizable by the user.
72
+ * This is used in the documentations and examples
73
+ * of some components, to demonstrate how the component
74
+ * behaves in a resizable container.
75
+ */
66
76
  /**
67
77
  * The breakpoints below are used to create responsive designs
68
78
  * in Lime's products. Therefore, they are here to get distributed
@@ -1800,6 +1810,16 @@ select.limel-select__native-control {
1800
1810
  * to enable you to truncate a piece of text,
1801
1811
  * after a certain number of lines.
1802
1812
  */
1813
+ /**
1814
+ * This mixin will add a chessboard background pattern,
1815
+ * typically used to visualize transparency.
1816
+ */
1817
+ /**
1818
+ * Make a container resizable by the user.
1819
+ * This is used in the documentations and examples
1820
+ * of some components, to demonstrate how the component
1821
+ * behaves in a resizable container.
1822
+ */
1803
1823
  /**
1804
1824
  * The breakpoints below are used to create responsive designs
1805
1825
  * in Lime's products. Therefore, they are here to get distributed
@@ -57,6 +57,16 @@
57
57
  * to enable you to truncate a piece of text,
58
58
  * after a certain number of lines.
59
59
  */
60
+ /**
61
+ * This mixin will add a chessboard background pattern,
62
+ * typically used to visualize transparency.
63
+ */
64
+ /**
65
+ * Make a container resizable by the user.
66
+ * This is used in the documentations and examples
67
+ * of some components, to demonstrate how the component
68
+ * behaves in a resizable container.
69
+ */
60
70
  /**
61
71
  * The breakpoints below are used to create responsive designs
62
72
  * in Lime's products. Therefore, they are here to get distributed
@@ -772,6 +772,16 @@ div[slot=content] {
772
772
  * to enable you to truncate a piece of text,
773
773
  * after a certain number of lines.
774
774
  */
775
+ /**
776
+ * This mixin will add a chessboard background pattern,
777
+ * typically used to visualize transparency.
778
+ */
779
+ /**
780
+ * Make a container resizable by the user.
781
+ * This is used in the documentations and examples
782
+ * of some components, to demonstrate how the component
783
+ * behaves in a resizable container.
784
+ */
775
785
  /**
776
786
  * The breakpoints below are used to create responsive designs
777
787
  * in Lime's products. Therefore, they are here to get distributed
@@ -24,7 +24,7 @@ export class Slider {
24
24
  } }, this.renderSliderInput(inputProps), this.renderTrack(), this.renderThumb()));
25
25
  };
26
26
  this.renderSliderInput = (inputProps) => {
27
- return (h("input", Object.assign({ class: "mdc-slider__input", type: "range", min: this.multiplyByFactor(this.valuemin), max: this.multiplyByFactor(this.valuemax), value: this.multiplyByFactor(this.value), name: "volume", "aria-labelledby": this.labelId, "aria-controls": this.helperTextId }, inputProps)));
27
+ return (h("input", Object.assign({ class: "mdc-slider__input", type: "range", min: this.multiplyByFactor(this.valuemin), max: this.multiplyByFactor(this.valuemax), value: this.multiplyByFactor(this.value), name: "volume", "aria-labelledby": this.labelId, "aria-describedby": this.helperText ? this.helperTextId : undefined, "aria-controls": this.helperText ? this.helperTextId : undefined }, inputProps)));
28
28
  };
29
29
  this.renderTrack = () => {
30
30
  return (h("div", { class: "mdc-slider__track" }, h("div", { class: "mdc-slider__track--inactive" }), h("div", { class: "mdc-slider__track--active" }, h("div", { class: "mdc-slider__track--active_fill" }))));
@@ -1 +1 @@
1
- {"version":3,"file":"slider.js","sourceR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,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE/B,IAAI,IAAI,CAAC,gBAAgB,EAAE,EAAE;MACzB,OAAO;KACV;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;MACrC,OAAO;KACV;IAED,IAAI,CAAC,sBAAsB,EAAE,CAAC;EAClC,CAAC;EAgKO,gBAAgB;IACpB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAChE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC9D,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;EAC/B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+FJ","sourcesContent":["import { MDCSlider, MDCSliderChangeEventDetail } from '@material/slider';\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { getPercentageClass } from './get-percentage-class';\nimport { createRandomString } from '../../util/random-string';\n\nconst DEFAULT_FACTOR = 1;\nconst DEFAULT_MAX_VALUE = 100;\nconst DEFAULT_MIN_VALUE = 0;\n\n/**\n * @exampleComponent limel-example-slider-basic\n * @exampleComponent limel-example-slider-multiplier\n * @exampleComponent limel-example-slider-multiplier-percentage-colors\n * @exampleComponent limel-example-slider-composite\n */\n@Component({\n tag: 'limel-slider',\n shadow: true,\n styleUrl: 'slider.scss',\n})\nexport class Slider {\n /**\n * Disables the slider when `true`,\n * and visually shows that the field is editable but disabled.\n * This tells the users that if certain requirements are met,\n * the slider may become interactable.\n */\n @Prop({ reflect: true })\n public disabled = false;\n\n /**\n * Disables the slider when `true`. This visualizes the slider slightly differently.\n * But shows no visual sign indicating that the slider field\n * is disabled or can ever become interactable.\n */\n @Prop({ reflect: true })\n public readonly = false;\n\n /**\n * Default value: 1.\n * The factor that the properties `value`, `valuemax`, `valuemin`, and\n * `step` are multiplied by. On `change` divides the value by the factor,\n * so the original format stays the same.\n */\n @Prop({ reflect: true })\n public factor: number = DEFAULT_FACTOR;\n\n /**\n * Label to display next to the input\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Optional helper text to display below the slider\n */\n @Prop({ reflect: true })\n public helperText: string;\n\n /**\n * Set to `true` to indicate that the slider is required.\n */\n @Prop({ reflect: true })\n public required = false;\n\n /**\n * Set to `true` to indicate that the current value of the slider is invalid.\n */\n @Prop({ reflect: true })\n public invalid = false;\n\n /**\n * Unit to display next to the value\n */\n @Prop({ reflect: true })\n public unit: string = '';\n\n /**\n * The value of the input\n */\n @Prop({ reflect: true })\n public value: number;\n\n /**\n * The maximum value allowed\n */\n @Prop({ reflect: true })\n public valuemax: number = DEFAULT_MAX_VALUE;\n\n /**\n * The minimum value allowed\n */\n @Prop({ reflect: true })\n public valuemin: number = DEFAULT_MIN_VALUE;\n\n /**\n * The stepping interval to use when adjusting the value\n */\n @Prop({ reflect: true })\n public step: number;\n\n /**\n * Emitted when the value has been changed\n */\n @Event()\n private change: EventEmitter<number>;\n\n @Element()\n private rootElement: HTMLLimelSliderElement;\n\n @State()\n private percentageClass: string;\n\n private mdcSlider: MDCSlider;\n private labelId: string;\n private helperTextId: string;\n private observer: ResizeObserver;\n\n public constructor() {\n this.labelId = createRandomString();\n this.helperTextId = createRandomString();\n }\n\n public connectedCallback() {\n this.initialize();\n this.observer = new ResizeObserver(this.resizeObserverCallback);\n this.observer.observe(this.rootElement);\n }\n\n public componentWillLoad() {\n this.setPercentageClass(this.value);\n }\n\n public componentDidLoad() {\n this.initialize();\n }\n\n public disconnectedCallback() {\n this.destroyMDCSlider();\n this.observer.disconnect();\n }\n\n public render() {\n const inputProps: any = {};\n if (this.step) {\n inputProps.step = this.multiplyByFactor(this.step);\n }\n\n if (this.disabled || this.readonly) {\n inputProps.disabled = true;\n }\n\n return (\n <Host class={this.getContainerClassList()}>\n <limel-notched-outline\n labelId={this.labelId}\n label={this.label}\n required={this.required}\n invalid={this.invalid}\n disabled={this.disabled}\n readonly={this.readonly}\n hasValue={!!this.value}\n hasFloatingLabel={true}\n >\n <div slot=\"content\">\n {this.renderRangeContainer()}\n {this.renderSliderContainer(inputProps)}\n </div>\n </limel-notched-outline>\n {this.renderHelperLine()}\n </Host>\n );\n }\n\n @Watch('disabled')\n protected watchDisabled() {\n this.updateDisabledState();\n }\n\n @Watch('readonly')\n protected watchReadonly() {\n this.updateDisabledState();\n }\n\n @Watch('value')\n protected watchValue() {\n if (!this.mdcSlider) {\n return;\n }\n\n const value = this.multiplyByFactor(this.getValue());\n this.mdcSlider.setValue(value);\n\n if (this.isStepConfigured()) {\n return;\n }\n\n const step = this.multiplyByFactor(this.step);\n if (!this.isMultipleOfStep(value, step)) {\n return;\n }\n\n this.reCreateSliderWithStep();\n }\n\n private renderRangeContainer = () => {\n return (\n <div class=\"slider__content-range-container\">\n <span class=\"slider__content-min-label\">\n {this.multiplyByFactor(this.valuemin)}\n {this.unit}\n </span>\n <span class=\"slider__content-max-label\">\n {this.multiplyByFactor(this.valuemax)}\n {this.unit}\n </span>\n </div>\n );\n };\n\n private renderSliderContainer = (inputProps: any) => {\n return (\n <div\n class={{\n 'mdc-slider': true,\n 'mdc-slider--discrete': true,\n 'mdc-slider--disabled': this.disabled || this.readonly,\n }}\n >\n {this.renderSliderInput(inputProps)}\n {this.renderTrack()}\n {this.renderThumb()}\n </div>\n );\n };\n\n private renderSliderInput = (inputProps: any) => {\n return (\n <input\n class=\"mdc-slider__input\"\n type=\"range\"\n min={this.multiplyByFactor(this.valuemin)}\n max={this.multiplyByFactor(this.valuemax)}\n value={this.multiplyByFactor(this.value)}\n name=\"volume\"\n aria-labelledby={this.labelId}\n aria-controls={this.helperTextId}\n {...inputProps}\n />\n );\n };\n\n private renderTrack = () => {\n return (\n <div class=\"mdc-slider__track\">\n <div class=\"mdc-slider__track--inactive\" />\n <div class=\"mdc-slider__track--active\">\n <div class=\"mdc-slider__track--active_fill\" />\n </div>\n </div>\n );\n };\n\n private renderThumb = () => {\n return (\n <div class=\"mdc-slider__thumb\">\n <div\n class=\"mdc-slider__value-indicator-container\"\n aria-hidden=\"true\"\n >\n <div class=\"mdc-slider__value-indicator\">\n <span class=\"mdc-slider__value-indicator-text\">\n {this.multiplyByFactor(this.value)}\n </span>\n </div>\n </div>\n <div class=\"mdc-slider__thumb-knob\" />\n </div>\n );\n };\n\n private renderHelperLine = () => {\n if (!this.helperText) {\n return;\n }\n\n return (\n <limel-helper-line\n helperText={this.helperText}\n helperTextId={this.helperTextId}\n invalid={this.invalid}\n />\n );\n };\n\n private initialize = () => {\n const inputElement = this.getInputElement();\n if (!inputElement) {\n return;\n }\n\n const value = this.getValue();\n\n /*\n For some reason the input element's `value` attribute is removed\n (probably by Stencil) when the element is first rendered. But if the\n attribute is missing when MDCSlider is initialized (MDC v11.0.0),\n MDCSlider crashes.\n So we add the attribute right before initializing MDCSlider. /Ads\n */\n inputElement.setAttribute('value', `${this.multiplyByFactor(value)}`);\n\n /*\n When creating the `mdcSlider` component, its important that the value set in\n the input field obeys the range and the step size.\n\n The MDCSlider will throw an exception unless the value in the input element\n is dividible by the step value and is in the provided range.\n If an exception occurs, this component will crash and it will be impossible to change\n its value.\n The logic below ensures that the component will render even though the\n provided value is wrong.\n This could be considered wrong, but it at least fixes so that it's possible\n to change the value from the UI.\n */\n const greaterThanOrEqualMin = value >= this.valuemin;\n const lessThanOrEqualMax = value <= this.valuemax;\n\n if (!greaterThanOrEqualMin) {\n const newMin = this.multiplyByFactor(value);\n inputElement.setAttribute('min', `${newMin}`);\n }\n\n if (!lessThanOrEqualMax) {\n const newMax = this.multiplyByFactor(value);\n inputElement.setAttribute('max', `${newMax}`);\n }\n\n if (!this.isMultipleOfStep(value, this.step)) {\n inputElement.removeAttribute('step');\n }\n\n this.createMDCSlider();\n };\n\n private reCreateSliderWithStep = () => {\n const inputElement = this.getInputElement();\n const step = `${this.multiplyByFactor(this.step)}`;\n\n inputElement.setAttribute('step', step);\n\n this.destroyMDCSlider();\n this.createMDCSlider();\n };\n\n private createMDCSlider = () => {\n const element = this.getRootElement();\n\n this.mdcSlider = new MDCSlider(element);\n this.mdcSlider.listen('MDCSlider:change', this.changeHandler);\n this.mdcSlider.listen('MDCSlider:input', this.inputHandler);\n };\n\n private destroyMDCSlider() {\n this.mdcSlider.unlisten('MDCSlider:change', this.changeHandler);\n this.mdcSlider.unlisten('MDCSlider:input', this.inputHandler);\n this.mdcSlider.destroy();\n this.mdcSlider = undefined;\n }\n\n private changeHandler = (\n event: CustomEvent<MDCSliderChangeEventDetail>\n ) => {\n let value = event.detail.value;\n const step = this.multiplyByFactor(this.step);\n\n if (!this.isMultipleOfStep(value, step)) {\n value = this.roundToStep(value, step);\n }\n\n this.change.emit(value / this.factor);\n };\n\n private inputHandler = (event: CustomEvent<MDCSliderChangeEventDetail>) => {\n this.setPercentageClass(event.detail.value / this.factor);\n };\n\n private getContainerClassList = () => {\n return {\n [this.percentageClass]: true,\n disabled: this.disabled || this.readonly,\n readonly: this.readonly,\n };\n };\n\n private resizeObserverCallback = () => {\n this.mdcSlider?.layout();\n };\n\n private updateDisabledState = () => {\n if (!this.mdcSlider) {\n return;\n }\n\n this.mdcSlider?.setDisabled(this.disabled || this.readonly);\n };\n\n private multiplyByFactor = (value: number) => {\n return Math.round(value * this.factor);\n };\n\n private getValue = () => {\n let value = this.value;\n if (!Number.isFinite(value)) {\n value = this.valuemin;\n }\n\n return value;\n };\n\n private setPercentageClass = (value: number) => {\n this.percentageClass = getPercentageClass(\n (value - this.valuemin) / (this.valuemax - this.valuemin)\n );\n };\n\n private isMultipleOfStep = (value: number, step: number): boolean => {\n if (!step) {\n return true;\n }\n\n return value % step === 0;\n };\n\n private roundToStep = (value: number, step: number): number => {\n return Math.round(value / step) * step;\n };\n\n private getRootElement = (): HTMLElement | undefined => {\n return this.rootElement.shadowRoot.querySelector('.mdc-slider');\n };\n\n private getInputElement = (): HTMLInputElement | undefined => {\n const element = this.getRootElement();\n if (!element) {\n return;\n }\n\n return element.querySelector('input');\n };\n\n private isStepConfigured = (): boolean => {\n if (!this.step) {\n return true;\n }\n\n const input = this.getInputElement();\n if (!input) {\n return true;\n }\n\n return input.hasAttribute('step');\n };\n}\n"]}
1
+ {"version":3,"file":"slider.js","sourceRoot":"","sources":["../../../src/components/slider/slider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,MAAM,kBAAkB,CAAC;AACzE,OAAO,EACH,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAC9B,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B;;;;;GAKG;AAMH,MAAM,OAAO,MAAM;EAkGf;IAuFQ,yBAAoB,GAAG,GAAG,EAAE;MAChC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CAAC;EAClC,CAAC;EAmKO,gBAAgB;IACpB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAChE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC9D,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;EAC/B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+FJ","sourcesContent":["import { MDCSlider, MDCSliderChangeEventDetail } from '@material/slider';\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { getPercentageClass } from './get-percentage-class';\nimport { createRandomString } from '../../util/random-string';\n\nconst DEFAULT_FACTOR = 1;\nconst DEFAULT_MAX_VALUE = 100;\nconst DEFAULT_MIN_VALUE = 0;\n\n/**\n * @exampleComponent limel-example-slider-basic\n * @exampleComponent limel-example-slider-multiplier\n * @exampleComponent limel-example-slider-multiplier-percentage-colors\n * @exampleComponent limel-example-slider-composite\n */\n@Component({\n tag: 'limel-slider',\n shadow: true,\n styleUrl: 'slider.scss',\n})\nexport class Slider {\n /**\n * Disables the slider when `true`,\n * and visually shows that the field is editable but disabled.\n * This tells the users that if certain requirements are met,\n * the slider may become interactable.\n */\n @Prop({ reflect: true })\n public disabled = false;\n\n /**\n * Disables the slider when `true`. This visualizes the slider slightly differently.\n * But shows no visual sign indicating that the slider field\n * is disabled or can ever become interactable.\n */\n @Prop({ reflect: true })\n public readonly = false;\n\n /**\n * Default value: 1.\n * The factor that the properties `value`, `valuemax`, `valuemin`, and\n * `step` are multiplied by. On `change` divides the value by the factor,\n * so the original format stays the same.\n */\n @Prop({ reflect: true })\n public factor: number = DEFAULT_FACTOR;\n\n /**\n * Label to display next to the input\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Optional helper text to display below the slider\n */\n @Prop({ reflect: true })\n public helperText: string;\n\n /**\n * Set to `true` to indicate that the slider is required.\n */\n @Prop({ reflect: true })\n public required = false;\n\n /**\n * Set to `true` to indicate that the current value of the slider is invalid.\n */\n @Prop({ reflect: true })\n public invalid = false;\n\n /**\n * Unit to display next to the value\n */\n @Prop({ reflect: true })\n public unit: string = '';\n\n /**\n * The value of the input\n */\n @Prop({ reflect: true })\n public value: number;\n\n /**\n * The maximum value allowed\n */\n @Prop({ reflect: true })\n public valuemax: number = DEFAULT_MAX_VALUE;\n\n /**\n * The minimum value allowed\n */\n @Prop({ reflect: true })\n public valuemin: number = DEFAULT_MIN_VALUE;\n\n /**\n * The stepping interval to use when adjusting the value\n */\n @Prop({ reflect: true })\n public step: number;\n\n /**\n * Emitted when the value has been changed\n */\n @Event()\n private change: EventEmitter<number>;\n\n @Element()\n private rootElement: HTMLLimelSliderElement;\n\n @State()\n private percentageClass: string;\n\n private mdcSlider: MDCSlider;\n private labelId: string;\n private helperTextId: string;\n private observer: ResizeObserver;\n\n public constructor() {\n this.labelId = createRandomString();\n this.helperTextId = createRandomString();\n }\n\n public connectedCallback() {\n this.initialize();\n this.observer = new ResizeObserver(this.resizeObserverCallback);\n this.observer.observe(this.rootElement);\n }\n\n public componentWillLoad() {\n this.setPercentageClass(this.value);\n }\n\n public componentDidLoad() {\n this.initialize();\n }\n\n public disconnectedCallback() {\n this.destroyMDCSlider();\n this.observer.disconnect();\n }\n\n public render() {\n const inputProps: any = {};\n if (this.step) {\n inputProps.step = this.multiplyByFactor(this.step);\n }\n\n if (this.disabled || this.readonly) {\n inputProps.disabled = true;\n }\n\n return (\n <Host class={this.getContainerClassList()}>\n <limel-notched-outline\n labelId={this.labelId}\n label={this.label}\n required={this.required}\n invalid={this.invalid}\n disabled={this.disabled}\n readonly={this.readonly}\n hasValue={!!this.value}\n hasFloatingLabel={true}\n >\n <div slot=\"content\">\n {this.renderRangeContainer()}\n {this.renderSliderContainer(inputProps)}\n </div>\n </limel-notched-outline>\n {this.renderHelperLine()}\n </Host>\n );\n }\n\n @Watch('disabled')\n protected watchDisabled() {\n this.updateDisabledState();\n }\n\n @Watch('readonly')\n protected watchReadonly() {\n this.updateDisabledState();\n }\n\n @Watch('value')\n protected watchValue() {\n if (!this.mdcSlider) {\n return;\n }\n\n const value = this.multiplyByFactor(this.getValue());\n this.mdcSlider.setValue(value);\n\n if (this.isStepConfigured()) {\n return;\n }\n\n const step = this.multiplyByFactor(this.step);\n if (!this.isMultipleOfStep(value, step)) {\n return;\n }\n\n this.reCreateSliderWithStep();\n }\n\n private renderRangeContainer = () => {\n return (\n <div class=\"slider__content-range-container\">\n <span class=\"slider__content-min-label\">\n {this.multiplyByFactor(this.valuemin)}\n {this.unit}\n </span>\n <span class=\"slider__content-max-label\">\n {this.multiplyByFactor(this.valuemax)}\n {this.unit}\n </span>\n </div>\n );\n };\n\n private renderSliderContainer = (inputProps: any) => {\n return (\n <div\n class={{\n 'mdc-slider': true,\n 'mdc-slider--discrete': true,\n 'mdc-slider--disabled': this.disabled || this.readonly,\n }}\n >\n {this.renderSliderInput(inputProps)}\n {this.renderTrack()}\n {this.renderThumb()}\n </div>\n );\n };\n\n private renderSliderInput = (inputProps: any) => {\n return (\n <input\n class=\"mdc-slider__input\"\n type=\"range\"\n min={this.multiplyByFactor(this.valuemin)}\n max={this.multiplyByFactor(this.valuemax)}\n value={this.multiplyByFactor(this.value)}\n name=\"volume\"\n aria-labelledby={this.labelId}\n aria-describedby={\n this.helperText ? this.helperTextId : undefined\n }\n aria-controls={this.helperText ? this.helperTextId : undefined}\n {...inputProps}\n />\n );\n };\n\n private renderTrack = () => {\n return (\n <div class=\"mdc-slider__track\">\n <div class=\"mdc-slider__track--inactive\" />\n <div class=\"mdc-slider__track--active\">\n <div class=\"mdc-slider__track--active_fill\" />\n </div>\n </div>\n );\n };\n\n private renderThumb = () => {\n return (\n <div class=\"mdc-slider__thumb\">\n <div\n class=\"mdc-slider__value-indicator-container\"\n aria-hidden=\"true\"\n >\n <div class=\"mdc-slider__value-indicator\">\n <span class=\"mdc-slider__value-indicator-text\">\n {this.multiplyByFactor(this.value)}\n </span>\n </div>\n </div>\n <div class=\"mdc-slider__thumb-knob\" />\n </div>\n );\n };\n\n private renderHelperLine = () => {\n if (!this.helperText) {\n return;\n }\n\n return (\n <limel-helper-line\n helperText={this.helperText}\n helperTextId={this.helperTextId}\n invalid={this.invalid}\n />\n );\n };\n\n private initialize = () => {\n const inputElement = this.getInputElement();\n if (!inputElement) {\n return;\n }\n\n const value = this.getValue();\n\n /*\n For some reason the input element's `value` attribute is removed\n (probably by Stencil) when the element is first rendered. But if the\n attribute is missing when MDCSlider is initialized (MDC v11.0.0),\n MDCSlider crashes.\n So we add the attribute right before initializing MDCSlider. /Ads\n */\n inputElement.setAttribute('value', `${this.multiplyByFactor(value)}`);\n\n /*\n When creating the `mdcSlider` component, its important that the value set in\n the input field obeys the range and the step size.\n\n The MDCSlider will throw an exception unless the value in the input element\n is dividible by the step value and is in the provided range.\n If an exception occurs, this component will crash and it will be impossible to change\n its value.\n The logic below ensures that the component will render even though the\n provided value is wrong.\n This could be considered wrong, but it at least fixes so that it's possible\n to change the value from the UI.\n */\n const greaterThanOrEqualMin = value >= this.valuemin;\n const lessThanOrEqualMax = value <= this.valuemax;\n\n if (!greaterThanOrEqualMin) {\n const newMin = this.multiplyByFactor(value);\n inputElement.setAttribute('min', `${newMin}`);\n }\n\n if (!lessThanOrEqualMax) {\n const newMax = this.multiplyByFactor(value);\n inputElement.setAttribute('max', `${newMax}`);\n }\n\n if (!this.isMultipleOfStep(value, this.step)) {\n inputElement.removeAttribute('step');\n }\n\n this.createMDCSlider();\n };\n\n private reCreateSliderWithStep = () => {\n const inputElement = this.getInputElement();\n const step = `${this.multiplyByFactor(this.step)}`;\n\n inputElement.setAttribute('step', step);\n\n this.destroyMDCSlider();\n this.createMDCSlider();\n };\n\n private createMDCSlider = () => {\n const element = this.getRootElement();\n\n this.mdcSlider = new MDCSlider(element);\n this.mdcSlider.listen('MDCSlider:change', this.changeHandler);\n this.mdcSlider.listen('MDCSlider:input', this.inputHandler);\n };\n\n private destroyMDCSlider() {\n this.mdcSlider.unlisten('MDCSlider:change', this.changeHandler);\n this.mdcSlider.unlisten('MDCSlider:input', this.inputHandler);\n this.mdcSlider.destroy();\n this.mdcSlider = undefined;\n }\n\n private changeHandler = (\n event: CustomEvent<MDCSliderChangeEventDetail>\n ) => {\n let value = event.detail.value;\n const step = this.multiplyByFactor(this.step);\n\n if (!this.isMultipleOfStep(value, step)) {\n value = this.roundToStep(value, step);\n }\n\n this.change.emit(value / this.factor);\n };\n\n private inputHandler = (event: CustomEvent<MDCSliderChangeEventDetail>) => {\n this.setPercentageClass(event.detail.value / this.factor);\n };\n\n private getContainerClassList = () => {\n return {\n [this.percentageClass]: true,\n disabled: this.disabled || this.readonly,\n readonly: this.readonly,\n };\n };\n\n private resizeObserverCallback = () => {\n this.mdcSlider?.layout();\n };\n\n private updateDisabledState = () => {\n if (!this.mdcSlider) {\n return;\n }\n\n this.mdcSlider?.setDisabled(this.disabled || this.readonly);\n };\n\n private multiplyByFactor = (value: number) => {\n return Math.round(value * this.factor);\n };\n\n private getValue = () => {\n let value = this.value;\n if (!Number.isFinite(value)) {\n value = this.valuemin;\n }\n\n return value;\n };\n\n private setPercentageClass = (value: number) => {\n this.percentageClass = getPercentageClass(\n (value - this.valuemin) / (this.valuemax - this.valuemin)\n );\n };\n\n private isMultipleOfStep = (value: number, step: number): boolean => {\n if (!step) {\n return true;\n }\n\n return value % step === 0;\n };\n\n private roundToStep = (value: number, step: number): number => {\n return Math.round(value / step) * step;\n };\n\n private getRootElement = (): HTMLElement | undefined => {\n return this.rootElement.shadowRoot.querySelector('.mdc-slider');\n };\n\n private getInputElement = (): HTMLInputElement | undefined => {\n const element = this.getRootElement();\n if (!element) {\n return;\n }\n\n return element.querySelector('input');\n };\n\n private isStepConfigured = (): boolean => {\n if (!this.step) {\n return true;\n }\n\n const input = this.getInputElement();\n if (!input) {\n return true;\n }\n\n return input.hasAttribute('step');\n };\n}\n"]}
@@ -57,6 +57,16 @@
57
57
  * to enable you to truncate a piece of text,
58
58
  * after a certain number of lines.
59
59
  */
60
+ /**
61
+ * This mixin will add a chessboard background pattern,
62
+ * typically used to visualize transparency.
63
+ */
64
+ /**
65
+ * Make a container resizable by the user.
66
+ * This is used in the documentations and examples
67
+ * of some components, to demonstrate how the component
68
+ * behaves in a resizable container.
69
+ */
60
70
  /**
61
71
  * The breakpoints below are used to create responsive designs
62
72
  * in Lime's products. Therefore, they are here to get distributed
@@ -840,6 +840,16 @@ label {
840
840
  * to enable you to truncate a piece of text,
841
841
  * after a certain number of lines.
842
842
  */
843
+ /**
844
+ * This mixin will add a chessboard background pattern,
845
+ * typically used to visualize transparency.
846
+ */
847
+ /**
848
+ * Make a container resizable by the user.
849
+ * This is used in the documentations and examples
850
+ * of some components, to demonstrate how the component
851
+ * behaves in a resizable container.
852
+ */
843
853
  /**
844
854
  * The breakpoints below are used to create responsive designs
845
855
  * in Lime's products. Therefore, they are here to get distributed
@@ -76,7 +76,7 @@ export class Switch {
76
76
  };
77
77
  }
78
78
  return [
79
- h("limel-dynamic-label", { value: this.value, "aria-controls": this.helperTextId, defaultLabel: { text: this.label, icon: icon }, labels: this.readonlyLabels }),
79
+ h("limel-dynamic-label", { value: this.value, "aria-controls": this.helperText ? this.helperTextId : undefined, defaultLabel: { text: this.label, icon: icon }, labels: this.readonlyLabels }),
80
80
  this.renderHelperLine(),
81
81
  ];
82
82
  }
@@ -85,7 +85,7 @@ export class Switch {
85
85
  'mdc-switch': true,
86
86
  'mdc-switch--unselected': !this.value,
87
87
  'mdc-switch--selected': this.value,
88
- }, type: "button", role: "switch", "aria-checked": this.value, disabled: this.disabled, onClick: this.handleClick, "aria-controls": this.helperTextId }, h("div", { class: "mdc-switch__track" }), h("div", { class: "mdc-switch__handle-track" }, h("div", { class: "mdc-switch__handle" }, h("div", { class: "mdc-switch__shadow" }, h("div", { class: "mdc-elevation-overlay" })), h("div", { class: "mdc-switch__ripple" }), h("div", { class: "mdc-switch__icons" }, h("svg", { class: "mdc-switch__icon mdc-switch__icon--on", viewBox: "0 0 24 24" }, h("path", { d: "M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z" })), h("svg", { class: "mdc-switch__icon mdc-switch__icon--off", viewBox: "0 0 24 24" }, h("path", { d: "M20 13H4v-2h16v2z" })))))),
88
+ }, type: "button", role: "switch", "aria-checked": this.value, disabled: this.disabled, onClick: this.handleClick, "aria-controls": this.helperText ? this.helperTextId : undefined }, h("div", { class: "mdc-switch__track" }), h("div", { class: "mdc-switch__handle-track" }, h("div", { class: "mdc-switch__handle" }, h("div", { class: "mdc-switch__shadow" }, h("div", { class: "mdc-elevation-overlay" })), h("div", { class: "mdc-switch__ripple" }), h("div", { class: "mdc-switch__icons" }, h("svg", { class: "mdc-switch__icon mdc-switch__icon--on", viewBox: "0 0 24 24" }, h("path", { d: "M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z" })), h("svg", { class: "mdc-switch__icon mdc-switch__icon--off", viewBox: "0 0 24 24" }, h("path", { d: "M20 13H4v-2h16v2z" })))))),
89
89
  h("label", { class: `${this.disabled ? 'disabled' : ''}`, htmlFor: this.fieldId }, this.label),
90
90
  this.renderHelperLine(),
91
91
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/components/switch/switch.tsx"],"names":[],"mappings":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KAAK,EAAC,0BAA0B;UACjC,WAAK,KAAK,EAAC,oBAAoB;YAC3B,WAAK,KAAK,EAAC,oBAAoB;cAC3B,WAAK,KAAK,EAAC,uBAAuB,GAAO,CACvC;YACN,WAAK,KAAK,EAAC,oBAAoB,GAAO;YACtC,WAAK,KAAK,EAAC,mBAAmB;cAC1B,WACI,KAAK,EAAC,uCAAuC,EAC7C,OAAO,EAAC,WAAW;gBAEnB,YAAM,CAAC,EAAC,qEAAqE,GAAG,CAC9E;cACN,WACI,KAAK,EAAC,wCAAwC,EAC9C,OAAO,EAAC,WAAW;gBAEnB,YAAM,CAAC,EAAC,mBAAmB,GAAG,CAC5B,CACJ,CACJ,CACJ,CACD;MACT,aACI,KAAK,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,EAC3C,OAAO,EAAE,IAAI,CAAC,OAAO,IAEpB,IAAI,CAAC,KAAK,CACP;MACR,IAAI,CAAC,gBAAgB,EAAE;KAC1B,CAAC;EACN,CAAC;EAGS,YAAY,CAAC,QAAiB;IACpC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;MACjB,OAAO;KACV;IAED,IAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;EACvC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwBJ","sourcesContent":["import { MDCSwitch } from '@material/switch';\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { createRandomString } from '../../util/random-string';\nimport {\n makeEnterClickable,\n removeEnterClickable,\n} from '../../util/make-enter-clickable';\nimport { Label } from '../dynamic-label/label.types';\nimport { Icon } from '../../interface';\n\n/**\n * The Switch component is a fundamental element in UI design that serves as a toggle switch\n * to control the state of a specific setting or option in an application or website.\n * The two distinct positions of the Switch are visually indicative of the two states:\n * ON and OFF; making it easy for users to understand the current state of the controlled feature.\n *\n * The Switch component is widely used in user interfaces to enable users to\n * quickly and intuitively change binary settings.\n *\n * :::important\n * Checkboxes are sometimes used interchangeably with switches in user interfaces.\n * But there is an important difference between the two! Please read our guidelines about\n * [Switch vs. Checkbox](/#/DesignGuidelines/switch-vs-checkbox.md/).\n *\n * @exampleComponent limel-example-switch\n * @exampleComponent limel-example-switch-helper-text\n * @exampleComponent limel-example-switch-readonly\n */\n@Component({\n tag: 'limel-switch',\n shadow: true,\n styleUrl: 'switch.scss',\n})\nexport class Switch {\n /**\n * Label to display next to the switch\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Disables the switch when `true`,\n * and visually shows that the switch is editable but disabled.\n * This tells the users that if certain requirements are met,\n * the switch may become interactable.\n */\n @Prop({ reflect: true })\n public disabled = false;\n\n /**\n * Disables the switch when `true`. This visualizes the switch slightly differently.\n * But shows no visual sign indicating that the switch is disabled\n * or can ever become interactable.\n */\n @Prop({ reflect: true })\n public readonly = false;\n\n /**\n * Set to `true` to indicate that the current value is invalid.\n */\n @Prop({ reflect: true })\n public invalid: boolean;\n\n /**\n * The value of the switch\n */\n @Prop({ reflect: true })\n public value = false;\n\n /**\n * Optional helper text to display below the switch\n */\n @Prop({ reflect: true })\n public helperText: string;\n\n /**\n * The labels to use to clarify what kind of data is being visualized,\n * when the component is `readonly`.\n */\n @Prop()\n public readonlyLabels?: Array<Label<boolean>> = [];\n\n /**\n * Emitted when the value has changed\n */\n @Event()\n private change: EventEmitter<boolean>;\n\n @Element()\n private host: HTMLLimelSwitchElement;\n private helperTextId: string = createRandomString();\n\n @State()\n private fieldId = createRandomString();\n\n private mdcSwitch: MDCSwitch;\n\n public connectedCallback() {\n this.initialize();\n }\n\n public componentWillLoad() {\n makeEnterClickable(this.host);\n }\n\n public componentDidLoad() {\n this.initialize();\n }\n\n private initialize() {\n const element = this.host.shadowRoot.querySelector(\n '.mdc-switch'\n ) as HTMLButtonElement;\n if (!element) {\n return;\n }\n\n this.mdcSwitch = new MDCSwitch(element);\n }\n\n public disconnectedCallback() {\n removeEnterClickable(this.host);\n this.mdcSwitch?.destroy();\n }\n\n public render() {\n if (this.readonly) {\n let icon: string | Icon = 'minus';\n if (this.value) {\n icon = {\n name: 'ok',\n color: 'var(--lime-primary-color, var(--limel-theme-primary-color))',\n };\n }\n\n return [\n <limel-dynamic-label\n value={this.value}\n aria-controls={this.helperTextId}\n defaultLabel={{ text: this.label, icon: icon }}\n labels={this.readonlyLabels}\n />,\n this.renderHelperLine(),\n ];\n }\n\n return [\n <button\n id={this.fieldId}\n class={{\n 'mdc-switch': true,\n 'mdc-switch--unselected': !this.value,\n 'mdc-switch--selected': this.value,\n }}\n type=\"button\"\n role=\"switch\"\n aria-checked={this.value}\n disabled={this.disabled}\n onClick={this.handleClick}\n aria-controls={this.helperTextId}\n >\n <div class=\"mdc-switch__track\" />\n <div class=\"mdc-switch__handle-track\">\n <div class=\"mdc-switch__handle\">\n <div class=\"mdc-switch__shadow\">\n <div class=\"mdc-elevation-overlay\"></div>\n </div>\n <div class=\"mdc-switch__ripple\"></div>\n <div class=\"mdc-switch__icons\">\n <svg\n class=\"mdc-switch__icon mdc-switch__icon--on\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z\" />\n </svg>\n <svg\n class=\"mdc-switch__icon mdc-switch__icon--off\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M20 13H4v-2h16v2z\" />\n </svg>\n </div>\n </div>\n </div>\n </button>,\n <label\n class={`${this.disabled ? 'disabled' : ''}`}\n htmlFor={this.fieldId}\n >\n {this.label}\n </label>,\n this.renderHelperLine(),\n ];\n }\n\n @Watch('value')\n protected valueWatcher(newValue: boolean) {\n if (!this.mdcSwitch) {\n return;\n }\n\n this.mdcSwitch.selected = newValue;\n }\n\n private renderHelperLine = () => {\n if (!this.hasHelperText()) {\n return;\n }\n\n return (\n <limel-helper-line\n helperTextId={this.helperTextId}\n helperText={this.helperText}\n invalid={this.invalid}\n />\n );\n };\n\n private hasHelperText = () => {\n return this.helperText !== null && this.helperText !== undefined;\n };\n\n private handleClick = (event: MouseEvent) => {\n event.stopPropagation();\n this.change.emit(!this.value);\n };\n}\n"]}
1
+ {"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/components/switch/switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EACH,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,KAAK,EACL,KAAK,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EACH,kBAAkB,EAClB,oBAAoB,GACvB,MAAM,iCAAiC,CAAC;AAIzC;;;;;;;;;;;;;;;;;GAiBG;AAMH,MAAM,OAAO,MAAM;;IAyDP,iBAAY,GAAW,kBAAkB,EAAE,CAAC;IAoH5C,qBAAgB,GAAG,GAAG,EAAE;MAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE;QACvB,OAAO;OACV;MAED,OAAO,CACH,yBACI,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,OAAO,EAAE,IAAI,CAAC,OAAO,GACvB,CACL,CAAC;IACN,CAAC,CAAC;IAEM,kBAAa,GAAG,GAAG,EAAE;MACzB,OAAO,IAAI,CAAC,UAAU,KAAK,IAAI,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC;IACrE,CAAC,CAAC;IAEM,gBAAW,GAAG,CAAC,KAAiB,EAAE,EAAE;MACxC,KAAK,CAAC,eAAe,EAAE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AAO;KACV;IAED,IAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;EACvC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwBJ","sourcesContent":["import { MDCSwitch } from '@material/switch';\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { createRandomString } from '../../util/random-string';\nimport {\n makeEnterClickable,\n removeEnterClickable,\n} from '../../util/make-enter-clickable';\nimport { Label } from '../dynamic-label/label.types';\nimport { Icon } from '../../interface';\n\n/**\n * The Switch component is a fundamental element in UI design that serves as a toggle switch\n * to control the state of a specific setting or option in an application or website.\n * The two distinct positions of the Switch are visually indicative of the two states:\n * ON and OFF; making it easy for users to understand the current state of the controlled feature.\n *\n * The Switch component is widely used in user interfaces to enable users to\n * quickly and intuitively change binary settings.\n *\n * :::important\n * Checkboxes are sometimes used interchangeably with switches in user interfaces.\n * But there is an important difference between the two! Please read our guidelines about\n * [Switch vs. Checkbox](/#/DesignGuidelines/switch-vs-checkbox.md/).\n *\n * @exampleComponent limel-example-switch\n * @exampleComponent limel-example-switch-helper-text\n * @exampleComponent limel-example-switch-readonly\n */\n@Component({\n tag: 'limel-switch',\n shadow: true,\n styleUrl: 'switch.scss',\n})\nexport class Switch {\n /**\n * Label to display next to the switch\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Disables the switch when `true`,\n * and visually shows that the switch is editable but disabled.\n * This tells the users that if certain requirements are met,\n * the switch may become interactable.\n */\n @Prop({ reflect: true })\n public disabled = false;\n\n /**\n * Disables the switch when `true`. This visualizes the switch slightly differently.\n * But shows no visual sign indicating that the switch is disabled\n * or can ever become interactable.\n */\n @Prop({ reflect: true })\n public readonly = false;\n\n /**\n * Set to `true` to indicate that the current value is invalid.\n */\n @Prop({ reflect: true })\n public invalid: boolean;\n\n /**\n * The value of the switch\n */\n @Prop({ reflect: true })\n public value = false;\n\n /**\n * Optional helper text to display below the switch\n */\n @Prop({ reflect: true })\n public helperText: string;\n\n /**\n * The labels to use to clarify what kind of data is being visualized,\n * when the component is `readonly`.\n */\n @Prop()\n public readonlyLabels?: Array<Label<boolean>> = [];\n\n /**\n * Emitted when the value has changed\n */\n @Event()\n private change: EventEmitter<boolean>;\n\n @Element()\n private host: HTMLLimelSwitchElement;\n private helperTextId: string = createRandomString();\n\n @State()\n private fieldId = createRandomString();\n\n private mdcSwitch: MDCSwitch;\n\n public connectedCallback() {\n this.initialize();\n }\n\n public componentWillLoad() {\n makeEnterClickable(this.host);\n }\n\n public componentDidLoad() {\n this.initialize();\n }\n\n private initialize() {\n const element = this.host.shadowRoot.querySelector(\n '.mdc-switch'\n ) as HTMLButtonElement;\n if (!element) {\n return;\n }\n\n this.mdcSwitch = new MDCSwitch(element);\n }\n\n public disconnectedCallback() {\n removeEnterClickable(this.host);\n this.mdcSwitch?.destroy();\n }\n\n public render() {\n if (this.readonly) {\n let icon: string | Icon = 'minus';\n if (this.value) {\n icon = {\n name: 'ok',\n color: 'var(--lime-primary-color, var(--limel-theme-primary-color))',\n };\n }\n\n return [\n <limel-dynamic-label\n value={this.value}\n aria-controls={\n this.helperText ? this.helperTextId : undefined\n }\n defaultLabel={{ text: this.label, icon: icon }}\n labels={this.readonlyLabels}\n />,\n this.renderHelperLine(),\n ];\n }\n\n return [\n <button\n id={this.fieldId}\n class={{\n 'mdc-switch': true,\n 'mdc-switch--unselected': !this.value,\n 'mdc-switch--selected': this.value,\n }}\n type=\"button\"\n role=\"switch\"\n aria-checked={this.value}\n disabled={this.disabled}\n onClick={this.handleClick}\n aria-controls={this.helperText ? this.helperTextId : undefined}\n >\n <div class=\"mdc-switch__track\" />\n <div class=\"mdc-switch__handle-track\">\n <div class=\"mdc-switch__handle\">\n <div class=\"mdc-switch__shadow\">\n <div class=\"mdc-elevation-overlay\"></div>\n </div>\n <div class=\"mdc-switch__ripple\"></div>\n <div class=\"mdc-switch__icons\">\n <svg\n class=\"mdc-switch__icon mdc-switch__icon--on\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z\" />\n </svg>\n <svg\n class=\"mdc-switch__icon mdc-switch__icon--off\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M20 13H4v-2h16v2z\" />\n </svg>\n </div>\n </div>\n </div>\n </button>,\n <label\n class={`${this.disabled ? 'disabled' : ''}`}\n htmlFor={this.fieldId}\n >\n {this.label}\n </label>,\n this.renderHelperLine(),\n ];\n }\n\n @Watch('value')\n protected valueWatcher(newValue: boolean) {\n if (!this.mdcSwitch) {\n return;\n }\n\n this.mdcSwitch.selected = newValue;\n }\n\n private renderHelperLine = () => {\n if (!this.hasHelperText()) {\n return;\n }\n\n return (\n <limel-helper-line\n helperTextId={this.helperTextId}\n helperText={this.helperText}\n invalid={this.invalid}\n />\n );\n };\n\n private hasHelperText = () => {\n return this.helperText !== null && this.helperText !== undefined;\n };\n\n private handleClick = (event: MouseEvent) => {\n event.stopPropagation();\n this.change.emit(!this.value);\n };\n}\n"]}
@@ -522,6 +522,16 @@
522
522
  * to enable you to truncate a piece of text,
523
523
  * after a certain number of lines.
524
524
  */
525
+ /**
526
+ * This mixin will add a chessboard background pattern,
527
+ * typically used to visualize transparency.
528
+ */
529
+ /**
530
+ * Make a container resizable by the user.
531
+ * This is used in the documentations and examples
532
+ * of some components, to demonstrate how the component
533
+ * behaves in a resizable container.
534
+ */
525
535
  /**
526
536
  * The breakpoints below are used to create responsive designs
527
537
  * in Lime's products. Therefore, they are here to get distributed
@@ -57,6 +57,16 @@
57
57
  * to enable you to truncate a piece of text,
58
58
  * after a certain number of lines.
59
59
  */
60
+ /**
61
+ * This mixin will add a chessboard background pattern,
62
+ * typically used to visualize transparency.
63
+ */
64
+ /**
65
+ * Make a container resizable by the user.
66
+ * This is used in the documentations and examples
67
+ * of some components, to demonstrate how the component
68
+ * behaves in a resizable container.
69
+ */
60
70
  /**
61
71
  * The breakpoints below are used to create responsive designs
62
72
  * in Lime's products. Therefore, they are here to get distributed
@@ -1325,6 +1335,16 @@ limel-chip {
1325
1335
  * to enable you to truncate a piece of text,
1326
1336
  * after a certain number of lines.
1327
1337
  */
1338
+ /**
1339
+ * This mixin will add a chessboard background pattern,
1340
+ * typically used to visualize transparency.
1341
+ */
1342
+ /**
1343
+ * Make a container resizable by the user.
1344
+ * This is used in the documentations and examples
1345
+ * of some components, to demonstrate how the component
1346
+ * behaves in a resizable container.
1347
+ */
1328
1348
  /**
1329
1349
  * The breakpoints below are used to create responsive designs
1330
1350
  * in Lime's products. Therefore, they are here to get distributed
@@ -1551,6 +1571,16 @@ button.tabulator-page[data-page=first]:not([disabled]):hover:after, button.tabul
1551
1571
  * to enable you to truncate a piece of text,
1552
1572
  * after a certain number of lines.
1553
1573
  */
1574
+ /**
1575
+ * This mixin will add a chessboard background pattern,
1576
+ * typically used to visualize transparency.
1577
+ */
1578
+ /**
1579
+ * Make a container resizable by the user.
1580
+ * This is used in the documentations and examples
1581
+ * of some components, to demonstrate how the component
1582
+ * behaves in a resizable container.
1583
+ */
1554
1584
  /**
1555
1585
  * The breakpoints below are used to create responsive designs
1556
1586
  * in Lime's products. Therefore, they are here to get distributed
@@ -1735,6 +1765,16 @@ button.tabulator-page[data-page=first]:not([disabled]):hover:after, button.tabul
1735
1765
  * to enable you to truncate a piece of text,
1736
1766
  * after a certain number of lines.
1737
1767
  */
1768
+ /**
1769
+ * This mixin will add a chessboard background pattern,
1770
+ * typically used to visualize transparency.
1771
+ */
1772
+ /**
1773
+ * Make a container resizable by the user.
1774
+ * This is used in the documentations and examples
1775
+ * of some components, to demonstrate how the component
1776
+ * behaves in a resizable container.
1777
+ */
1738
1778
  /**
1739
1779
  * The breakpoints below are used to create responsive designs
1740
1780
  * in Lime's products. Therefore, they are here to get distributed
@@ -287,6 +287,16 @@ li {
287
287
  * to enable you to truncate a piece of text,
288
288
  * after a certain number of lines.
289
289
  */
290
+ /**
291
+ * This mixin will add a chessboard background pattern,
292
+ * typically used to visualize transparency.
293
+ */
294
+ /**
295
+ * Make a container resizable by the user.
296
+ * This is used in the documentations and examples
297
+ * of some components, to demonstrate how the component
298
+ * behaves in a resizable container.
299
+ */
290
300
  /**
291
301
  * The breakpoints below are used to create responsive designs
292
302
  * in Lime's products. Therefore, they are here to get distributed
@@ -411,7 +421,7 @@ img {
411
421
  transition: opacity 0.2s ease, scale 0.6s ease;
412
422
  }
413
423
  .image-wrapper.state-failed, .image-wrapper.state-loading {
414
- background: url("data:image/svg+xml;charset=utf-8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' style='fill-rule:evenodd;'><path fill='rgba(186,186,192,0.16)' d='M0 0h4v4H0zM4 4h4v4H4z'/></svg>");
424
+ background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%208%208%27%20style%3D%27fill-rule%3Aevenodd%3B%27%3E%3Cpath%20fill%3D%27rgba(186%2C186%2C192%2C0.16)%27%20d%3D%27M0%200h4v4H0zM4%204h4v4H4z%27%2F%3E%3C%2Fsvg%3E");
415
425
  background-size: 0.5rem;
416
426
  }
417
427
  .image-wrapper.state-failed img, .image-wrapper.state-loading img {
@@ -63,6 +63,16 @@
63
63
  * to enable you to truncate a piece of text,
64
64
  * after a certain number of lines.
65
65
  */
66
+ /**
67
+ * This mixin will add a chessboard background pattern,
68
+ * typically used to visualize transparency.
69
+ */
70
+ /**
71
+ * Make a container resizable by the user.
72
+ * This is used in the documentations and examples
73
+ * of some components, to demonstrate how the component
74
+ * behaves in a resizable container.
75
+ */
66
76
  /**
67
77
  * The breakpoints below are used to create responsive designs
68
78
  * in Lime's products. Therefore, they are here to get distributed
@@ -79,9 +79,9 @@ export class TextEditor {
79
79
  }
80
80
  renderEditor() {
81
81
  if (this.readonly) {
82
- return (h("limel-markdown", { slot: "content", value: this.value, "aria-controls": this.helperTextId, id: this.editorId }));
82
+ return (h("limel-markdown", { slot: "content", value: this.value, "aria-controls": this.helperText ? this.helperTextId : undefined, id: this.editorId }));
83
83
  }
84
- return (h("limel-prosemirror-adapter", { slot: "content", "aria-placeholder": this.placeholder, contentType: this.contentType, onChange: this.handleChange, onImagePasted: this.handleImagePasted, onImageRemoved: this.handleImageRemoved, onMetadataChange: this.handleMetadataChange, customElements: this.customElements, value: this.value, "aria-controls": this.helperTextId, id: this.editorId, "aria-disabled": this.disabled, "aria-invalid": this.invalid, "aria-required": this.required, language: this.language, triggerCharacters: this.triggers, disabled: this.disabled, ui: this.ui }));
84
+ return (h("limel-prosemirror-adapter", { slot: "content", "aria-placeholder": this.placeholder, contentType: this.contentType, onChange: this.handleChange, onImagePasted: this.handleImagePasted, onImageRemoved: this.handleImageRemoved, onMetadataChange: this.handleMetadataChange, customElements: this.customElements, value: this.value, "aria-controls": this.helperText ? this.helperTextId : undefined, id: this.editorId, "aria-disabled": this.disabled, "aria-invalid": this.invalid, "aria-required": this.required, language: this.language, triggerCharacters: this.triggers, disabled: this.disabled, ui: this.ui }));
85
85
  }
86
86
  renderPlaceholder() {
87
87
  if (!this.placeholder || this.value) {