@politiet/sheriff-web-components 2.6.0 → 2.6.1

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 (95) hide show
  1. package/custom-elements.json +1270 -978
  2. package/dist/index.d.ts +2 -2
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/mixins/index.d.ts +3 -0
  6. package/dist/mixins/index.d.ts.map +1 -1
  7. package/dist/mixins/index.js +3 -0
  8. package/dist/mixins/index.js.map +1 -1
  9. package/dist/mixins/sds-dialog-target-mixin.d.ts +11 -0
  10. package/dist/mixins/sds-dialog-target-mixin.d.ts.map +1 -0
  11. package/dist/mixins/sds-dialog-target-mixin.js +95 -0
  12. package/dist/mixins/sds-dialog-target-mixin.js.map +1 -0
  13. package/dist/mixins/sds-form-control-mixin.d.ts +14 -0
  14. package/dist/mixins/sds-form-control-mixin.d.ts.map +1 -0
  15. package/dist/mixins/sds-form-control-mixin.js +40 -0
  16. package/dist/mixins/sds-form-control-mixin.js.map +1 -0
  17. package/dist/sds-button/sds-button.component.d.ts +3 -1
  18. package/dist/sds-button/sds-button.component.d.ts.map +1 -1
  19. package/dist/sds-button/sds-button.component.js +13 -3
  20. package/dist/sds-button/sds-button.component.js.map +1 -1
  21. package/dist/sds-checkbox/sds-checkbox.d.ts +8 -16
  22. package/dist/sds-checkbox/sds-checkbox.d.ts.map +1 -1
  23. package/dist/sds-checkbox/sds-checkbox.js +38 -51
  24. package/dist/sds-checkbox/sds-checkbox.js.map +1 -1
  25. package/dist/sds-checkbox/sds-checkbox.styles.d.ts.map +1 -1
  26. package/dist/sds-checkbox/sds-checkbox.styles.js +1 -0
  27. package/dist/sds-checkbox/sds-checkbox.styles.js.map +1 -1
  28. package/dist/sds-chip/sds-chip.d.ts +7 -15
  29. package/dist/sds-chip/sds-chip.d.ts.map +1 -1
  30. package/dist/sds-chip/sds-chip.js +16 -29
  31. package/dist/sds-chip/sds-chip.js.map +1 -1
  32. package/dist/sds-chip/sds-chip.styles.js +1 -1
  33. package/dist/sds-chip/sds-chip.styles.js.map +1 -1
  34. package/dist/sds-dialog/sds-dialog.component.d.ts +56 -0
  35. package/dist/sds-dialog/sds-dialog.component.d.ts.map +1 -0
  36. package/dist/sds-dialog/sds-dialog.component.js +181 -0
  37. package/dist/sds-dialog/sds-dialog.component.js.map +1 -0
  38. package/dist/sds-dialog/sds-dialog.d.ts +2 -52
  39. package/dist/sds-dialog/sds-dialog.d.ts.map +1 -1
  40. package/dist/sds-dialog/sds-dialog.js +2 -163
  41. package/dist/sds-dialog/sds-dialog.js.map +1 -1
  42. package/dist/sds-dialog/sds-dialog.spec.d.ts +2 -0
  43. package/dist/sds-dialog/sds-dialog.spec.d.ts.map +1 -0
  44. package/dist/sds-dialog/sds-dialog.spec.js +50 -0
  45. package/dist/sds-dialog/sds-dialog.spec.js.map +1 -0
  46. package/dist/sds-dialog/sds-dialog.styles.d.ts.map +1 -1
  47. package/dist/sds-dialog/sds-dialog.styles.js +1 -3
  48. package/dist/sds-dialog/sds-dialog.styles.js.map +1 -1
  49. package/dist/sds-radio/sds-radio.d.ts +14 -17
  50. package/dist/sds-radio/sds-radio.d.ts.map +1 -1
  51. package/dist/sds-radio/sds-radio.js +45 -61
  52. package/dist/sds-radio/sds-radio.js.map +1 -1
  53. package/dist/sds-select/sds-select.component.d.ts +54 -0
  54. package/dist/sds-select/sds-select.component.d.ts.map +1 -0
  55. package/dist/sds-select/sds-select.component.js +290 -0
  56. package/dist/sds-select/sds-select.component.js.map +1 -0
  57. package/dist/sds-select/sds-select.d.ts +2 -61
  58. package/dist/sds-select/sds-select.d.ts.map +1 -1
  59. package/dist/sds-select/sds-select.js +2 -298
  60. package/dist/sds-select/sds-select.js.map +1 -1
  61. package/dist/sds-select/sds-select.styles.js +1 -1
  62. package/dist/sds-select/sds-select.styles.js.map +1 -1
  63. package/dist/sds-stepper/sds-stepper.d.ts +0 -1
  64. package/dist/sds-stepper/sds-stepper.d.ts.map +1 -1
  65. package/dist/sds-stepper/sds-stepper.js +2 -3
  66. package/dist/sds-stepper/sds-stepper.js.map +1 -1
  67. package/dist/sds-stepper/sds-stepper.styles.d.ts.map +1 -1
  68. package/dist/sds-stepper/sds-stepper.styles.js +2 -1
  69. package/dist/sds-stepper/sds-stepper.styles.js.map +1 -1
  70. package/dist/sds-stepper-step/sds-stepper-step.styles.d.ts.map +1 -1
  71. package/dist/sds-stepper-step/sds-stepper-step.styles.js +7 -5
  72. package/dist/sds-stepper-step/sds-stepper-step.styles.js.map +1 -1
  73. package/dist/sds-switch/sds-switch.d.ts +5 -14
  74. package/dist/sds-switch/sds-switch.d.ts.map +1 -1
  75. package/dist/sds-switch/sds-switch.js +13 -26
  76. package/dist/sds-switch/sds-switch.js.map +1 -1
  77. package/dist/sds-switch/sds-switch.styles.js +1 -1
  78. package/dist/sds-switch/sds-switch.styles.js.map +1 -1
  79. package/dist/sds-textarea/sds-textarea.d.ts +12 -21
  80. package/dist/sds-textarea/sds-textarea.d.ts.map +1 -1
  81. package/dist/sds-textarea/sds-textarea.js +3 -20
  82. package/dist/sds-textarea/sds-textarea.js.map +1 -1
  83. package/dist/sds-textarea/sds-textarea.styles.d.ts.map +1 -1
  84. package/dist/sds-textarea/sds-textarea.styles.js +8 -5
  85. package/dist/sds-textarea/sds-textarea.styles.js.map +1 -1
  86. package/dist/sds-textfield/sds-textfield.d.ts +11 -20
  87. package/dist/sds-textfield/sds-textfield.d.ts.map +1 -1
  88. package/dist/sds-textfield/sds-textfield.js +4 -21
  89. package/dist/sds-textfield/sds-textfield.js.map +1 -1
  90. package/dist/sds-textfield/sds-textfield.styles.d.ts.map +1 -1
  91. package/dist/sds-textfield/sds-textfield.styles.js +5 -1
  92. package/dist/sds-textfield/sds-textfield.styles.js.map +1 -1
  93. package/dist/sheriff-web-components.js +186 -177
  94. package/package.json +1 -1
  95. package/web-types.json +1000 -853
@@ -2,9 +2,10 @@ import { css } from 'lit';
2
2
  export const styles = css `
3
3
  :host {
4
4
  /* Sizing */
5
- --_sds-stepper-step-circle-size: var(--sds-stepper-circle-size, 32px);
5
+ --_sds-stepper-step-circle-size: var(--sds-stepper-circle-size, 28px);
6
6
  --_sds-stepper-step-border-width: var(--sds-stepper-step-border-width, 2px);
7
7
  --_sds-stepper-step-radius: var(--sds-stepper-step-radius, var(--sds-radius-sm));
8
+ --_sds-stepper-step-gap: var(--sds-stepper-step-gap, var(--sds-spacing-3xs));
8
9
 
9
10
  /* Layout */
10
11
  --_sds-stepper-step-grid-template-rows: var(--sds-stepper-step-grid-template-rows, var(--_sds-stepper-step-circle-size) auto);
@@ -39,7 +40,8 @@ export const styles = css `
39
40
  --_sds-stepper-step-label-text-underline-offset: var(--sds-stepper-step-label-text-underline-offset, var(--sds-typography-link-text-underline-offset));
40
41
  --_sds-stepper-step-label-max-width: var(--sds-stepper-step-label-max-width, 24ch);
41
42
  --_sds-stepper-step-label-text-color: var(--sds-stepper-step-label-text-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));
42
- --_sds-stepper-step-label-text-decoration: var(--sds-stepper-step-label-text-decoration, var(--sds-typography-link-text-decoration));
43
+ --_sds-stepper-step-label-text-decoration: var(--sds-stepper-step-label-text-decoration, none);
44
+ --_sds-stepper-step-label-padding-inline: var(--sds-stepper-step-label-padding-inline, var(--sds-spacing-3xs));
43
45
 
44
46
  /* Counter */
45
47
  --_sds-stepper-step-counter-grid-area: var(--sds-stepper-step-counter-grid-area, circle / 2);
@@ -73,7 +75,7 @@ export const styles = css `
73
75
  display: grid;
74
76
  grid-template-columns: var(--_sds-stepper-step-grid-template-columns);
75
77
  grid-template-rows: var(--_sds-stepper-step-grid-template-rows);
76
- gap: var(--sds-spacing-xs);
78
+ gap: var(--_sds-stepper-step-gap);
77
79
  justify-items: flex-start;
78
80
  flex: 100%;
79
81
  padding-block-start: var(--_sds-stepper-step-border-width);
@@ -141,6 +143,7 @@ export const styles = css `
141
143
  min-width: fit-content;
142
144
  max-width: var(--_sds-stepper-step-label-max-width);
143
145
  text-align: left;
146
+ padding-inline: var(--_sds-stepper-step-label-padding-inline);
144
147
 
145
148
  color: var(--_sds-stepper-step-label-text-color);
146
149
  font-family: var(--sds-typography-font-family);
@@ -208,7 +211,7 @@ export const styles = css `
208
211
  --_sds-stepper-step-counter-border-color: var(--sds-stepper-step-counter-border-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));
209
212
  --_sds-stepper-step-counter-text-color: var(--sds-stepper-step-counter-text-color, var(--sds-color-main-action-contrast-default));
210
213
  --_sds-stepper-step-label-text-decoration: var(--sds-stepper-step-label-text-decoration, none);
211
- --_sds-stepper-step-label-text-color: var(--sds-stepper-step-label-text-color, var(--sds-color-text-default, var(--sds-color-main-text-default)));
214
+ --_sds-stepper-step-label-text-color: var(--sds-stepper-step-label-text-color, var(--sds-color-text-default, var(--sds-color-neutral-text-default)));
212
215
 
213
216
  pointer-events: none;
214
217
  }
@@ -216,7 +219,6 @@ export const styles = css `
216
219
  :host(:not([active])) .sds-stepper-step__step:hover {
217
220
  --_sds-stepper-step-label-text-color: var(--sds-stepper-step-label-text-color, var(--sds-color-action-hover, var(--sds-color-main-action-hover)));
218
221
  --_sds-stepper-step-label-text-decoration: var(--sds-stepper-step-label-text-decoration, var(--sds-typography-link-text-decoration));
219
- --_sds-stepper-step-label-text-decoration-thickness: var(--sds-stepper-step-label-text-decoration-thickness, calc(var(--sds-typography-link-text-decoration-thickness) + 1px));
220
222
  --_sds-stepper-step-counter-background-color: var(--sds-stepper-step-counter-background-color, var(--sds-color-action-contrast-subtle, var(--sds-color-main-action-contrast-subtle)));
221
223
  --_sds-stepper-step-counter-border-color: var(--sds-stepper-step-counter-border-color, var(--sds-color-action-hover, var(--sds-color-main-action-hover)));
222
224
  --_sds-stepper-step-counter-text-color: var(--sds-stepper-step-counter-text-color, var(--sds-color-action-hover, var(--sds-color-main-action-hover)));
@@ -1 +1 @@
1
- {"version":3,"file":"sds-stepper-step.styles.js","sourceRoot":"","sources":["../../src/sds-stepper-step/sds-stepper-step.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkQxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t:host {\n\t\t/* Sizing */\n\t\t--_sds-stepper-step-circle-size: var(--sds-stepper-circle-size, 32px);\n\t\t--_sds-stepper-step-border-width: var(--sds-stepper-step-border-width, 2px);\n\t\t--_sds-stepper-step-radius: var(--sds-stepper-step-radius, var(--sds-radius-sm));\n\n\t\t/* Layout */\n\t\t--_sds-stepper-step-grid-template-rows: var(--sds-stepper-step-grid-template-rows, var(--_sds-stepper-step-circle-size) auto);\n\t\t--_sds-stepper-step-grid-template-columns: var(\n\t\t\t--sds-stepper-step-grid-template-columns,\n\t\t\t[line-1-start] 1fr [step-start] auto [line-1-end] var(--_sds-stepper-step-circle-size) [line-2-start] auto [step-end] 1fr [line-2-end]\n\t\t);\n\n\t\t/* Button */\n\t\t--_sds-stepper-step-step-grid-template-rows: var(--sds-stepper-step-step-grid-template-rows, [circle] var(--_sds-stepper-step-circle-size) [content] auto);\n\t\t--_sds-stepper-step-step-grid-template-columns: var(--sds-stepper-step-step-grid-template-columns, [content-start] auto [circle] var(--_sds-stepper-step-circle-size) [content-end] auto);\n\t\t--_sds-stepper-step-step-grid-area: var(--sds-stepper-step-step-grid-area, 1 / step / -1);\n\t\t--_sds-stepper-step-step-gap: var(--sds-stepper-step-step-gap, var(--sds-spacing-3xs));\n\t\t--_sds-stepper-step-step-margin: var(--sds-stepper-step-step-margin, 0);\n\n\t\t/* Divider */\n\t\t--_sds-stepper-step-divider-color: var(--sds-stepper-step-divider-color, var(--sds-color-neutral-border-subtle));\n\t\t--_sds-stepper-step-divider-width: var(--sds-stepper-step-divider-width, 100%);\n\t\t--_sds-stepper-step-divider-height: var(--sds-stepper-step-divider-height, 1px);\n\t\t--_sds-stepper-step-divider-min-height: var(--sds-stepper-step-divider-min-height, auto);\n\t\t--_sds-stepper-step-divider-grid-row: var(--sds-stepper-step-divider-grid-row, 1);\n\t\t--_sds-stepper-step-divider-before-grid-column: var(--sds-stepper-step-divider-before-grid-column, line-1);\n\t\t--_sds-stepper-step-divider-before-visibility: var(--sds-stepper-step-divider-before-visibility, visible);\n\t\t--_sds-stepper-step-divider-before-display: var(--sds-stepper-step-divider-before-display, block);\n\t\t--_sds-stepper-step-divider-after-grid-column: var(--sds-stepper-step-divider-after-grid-column, line-2);\n\t\t--_sds-stepper-step-divider-after-visibility: var(--sds-stepper-step-divider-after-visibility, visible);\n\t\t--_sds-stepper-step-divider-after-display: var(--sds-stepper-step-divider-after-display, block);\n\n\t\t/* Content */\n\t\t--_sds-stepper-step-label-grid-area: var(--sds-stepper-step-label-grid-area, content / 1 / content / -1);\n\t\t--_sds-stepper-step-label-text-decoration-thickness: var(--sds-stepper-step-label-text-decoration-thickness, var(--sds-typography-link-text-decoration-thickness));\n\t\t--_sds-stepper-step-label-text-underline-offset: var(--sds-stepper-step-label-text-underline-offset, var(--sds-typography-link-text-underline-offset));\n\t\t--_sds-stepper-step-label-max-width: var(--sds-stepper-step-label-max-width, 24ch);\n\t\t--_sds-stepper-step-label-text-color: var(--sds-stepper-step-label-text-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-label-text-decoration: var(--sds-stepper-step-label-text-decoration, var(--sds-typography-link-text-decoration));\n\n\t\t/* Counter */\n\t\t--_sds-stepper-step-counter-grid-area: var(--sds-stepper-step-counter-grid-area, circle / 2);\n\t\t--_sds-stepper-step-counter-border-color: var(--sds-stepper-step-counter-border-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-counter-text-color: var(--sds-stepper-step-counter-text-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-counter-content: var(--sds-stepper-step-counter-content, counters(stepper, ''));\n\t\t--_sds-stepper-step-counter-background-color: var(\n\t\t\t--sds-stepper-step-counter-background-color,\n\t\t\tvar(--sds-color-background-action-contrast-default, var(--sds-color-main-background-action-contrast-default))\n\t\t);\n\t\t--_sds-stepper-step-counter-mask: var(--sds-stepper-step-counter-mask, none);\n\t\t--_sds-stepper-step-counter-mask-background-color: var(--sds-stepper-step-counter-mask-background-color, transparent);\n\n\t\t/* Focus */\n\t\t--_sds-stepper-step-focus-color: var(--sds-stepper-step-focus-color, var(--sds-color-states-focus-outer));\n\t\t--_sds-stepper-step-focus-inner-color: var(--sds-stepper-step-focus-inner-color, var(--sds-color-states-focus-inner));\n\t\t--_sds-stepper-step-focus-spacing: var(--sds-stepper-step-focus-spacing, var(--sds-color-states-focus-spacing));\n\n\t\twidth: fit-content;\n\t}\n\n\t:host(:first-child) {\n\t\t--_sds-stepper-step-divider-before-visibility: hidden;\n\t}\n\n\t:host(:last-child) {\n\t\t--_sds-stepper-step-divider-after-visibility: hidden;\n\t}\n\n\t.sds-stepper-step {\n\t\tdisplay: grid;\n\t\tgrid-template-columns: var(--_sds-stepper-step-grid-template-columns);\n\t\tgrid-template-rows: var(--_sds-stepper-step-grid-template-rows);\n\t\tgap: var(--sds-spacing-xs);\n\t\tjustify-items: flex-start;\n\t\tflex: 100%;\n\t\tpadding-block-start: var(--_sds-stepper-step-border-width);\n\t\tfont-family: var(--sds-typography-font-family);\n\t}\n\n\t.sds-stepper-step__divider {\n\t\tdisplay: block;\n\t\talign-self: center;\n\t\tjustify-self: center;\n\n\t\twidth: var(--_sds-stepper-step-divider-width);\n\t\theight: var(--_sds-stepper-step-divider-height);\n\t\tmin-height: var(--_sds-stepper-step-divider-min-height);\n\n\t\tgrid-row: var(--_sds-stepper-step-divider-grid-row);\n\t\tbackground-color: var(--_sds-stepper-step-divider-color);\n\n\t\t&.sds-stepper-step__divider--before {\n\t\t\tgrid-column: var(--_sds-stepper-step-divider-before-grid-column);\n\t\t\tvisibility: var(--_sds-stepper-step-divider-before-visibility);\n\t\t\tdisplay: var(--_sds-stepper-step-divider-before-display);\n\t\t}\n\n\t\t&.sds-stepper-step__divider--after {\n\t\t\tgrid-column: var(--_sds-stepper-step-divider-after-grid-column);\n\t\t\tvisibility: var(--_sds-stepper-step-divider-after-visibility);\n\t\t\tdisplay: var(--_sds-stepper-step-divider-after-display);\n\t\t}\n\t}\n\n\t.sds-stepper-step__step,\n\t.sds-stepper-step__step--static {\n\t\tdisplay: grid;\n\t\twidth: 100%;\n\n\t\tgrid-area: var(--_sds-stepper-step-step-grid-area);\n\t\tgrid-template-rows: var(--_sds-stepper-step-step-grid-template-rows);\n\t\tgrid-template-columns: var(--_sds-stepper-step-step-grid-template-columns);\n\t\tplace-items: center;\n\n\t\tgap: var(--_sds-stepper-step-step-gap);\n\t\tpadding: 0;\n\t\tmargin: var(--_sds-stepper-step-step-margin);\n\n\t\tborder: 0;\n\t\tbackground: none;\n\t\tborder-radius: var(--_sds-stepper-step-radius);\n\t}\n\n\t.sds-stepper-step__step {\n\t\tcursor: pointer;\n\n\t\t&:focus-visible {\n\t\t\tbox-shadow: 0 0 0 var(--sds-color-states-focus-spacing) var(--_sds-stepper-step-focus-inner-color);\n\t\t\toutline: 3px solid var(--_sds-stepper-step-focus-color);\n\t\t\toutline-offset: 3px;\n\t\t\tisolation: isolate;\n\t\t}\n\t}\n\n\t.sds-stepper-step__label {\n\t\tgrid-column: content;\n\t\tgrid-area: var(--_sds-stepper-step-label-grid-area);\n\t\tmin-width: fit-content;\n\t\tmax-width: var(--_sds-stepper-step-label-max-width);\n\t\ttext-align: left;\n\n\t\tcolor: var(--_sds-stepper-step-label-text-color);\n\t\tfont-family: var(--sds-typography-font-family);\n\t\tfont-size: var(--sds-typography-body-lg-strong-tall-desktop-font-size);\n\t\tfont-weight: var(--sds-typography-body-lg-strong-tall-desktop-font-weight);\n\t\tline-height: var(--sds-typography-body-lg-strong-tall-desktop-line-height);\n\n\t\ttext-decoration: var(--_sds-stepper-step-label-text-decoration);\n\t\ttext-decoration-thickness: var(--_sds-stepper-step-label-text-decoration-thickness);\n\t\ttext-underline-offset: var(--_sds-stepper-step-label-text-underline-offset);\n\t}\n\n\t.sds-stepper-step__counter {\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\n\t\tgrid-area: var(--_sds-stepper-step-counter-grid-area);\n\n\t\twidth: var(--_sds-stepper-step-circle-size);\n\t\theight: var(--_sds-stepper-step-circle-size);\n\n\t\tborder-radius: 50%;\n\t\tborder: var(--_sds-stepper-step-border-width) solid var(--_sds-stepper-step-counter-border-color);\n\t\tbackground-color: var(--_sds-stepper-step-counter-background-color);\n\n\t\tcounter-increment: stepper;\n\n\t\tcolor: var(--_sds-stepper-step-counter-text-color);\n\t\tfont-size: var(--sds-typography-body-md-strong-desktop-font-size);\n\t\tfont-weight: var(--sds-typography-body-md-strong-desktop-font-weight);\n\t\tline-height: var(--sds-typography-body-md-strong-desktop-line-height);\n\n\t\t&::before {\n\t\t\tcontent: var(--_sds-stepper-step-counter-content);\n\n\t\t\tdisplay: flex;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\n\t\t\tborder-radius: 50%;\n\t\t\tbackground-color: var(--_sds-stepper-step-counter-mask-background-color);\n\t\t\tmask: var(--_sds-stepper-step-counter-mask);\n\t\t}\n\t}\n\n\t:host([complete]) {\n\t\t--_sds-stepper-step-counter-background-color: var(--sds-stepper-step-counter-background-color, var(--sds-color-action-contrast-subtle, var(--sds-color-main-action-contrast-subtle)));\n\t\t--_sds-stepper-step-counter-border-color: var(--sds-stepper-step-counter-border-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-counter-text-color: var(--sds-stepper-step-counter-text-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-counter-content: var(--sds-stepper-step-counter-content, '');\n\t\t--_sds-stepper-step-counter-mask-background-color: var(--sds-stepper-step-counter-mask-background-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-counter-mask: var(\n\t\t\t--sds-stepper-step-counter-mask,\n\t\t\turl(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M378-232.43 140.43-470l57.14-57.13L378-346.7l383.43-383.43L818.57-673z'/%3E%3C/svg%3E\")\n\t\t\t\tno-repeat center / 24px 24px\n\t\t);\n\t}\n\n\t:host([active]) {\n\t\t--_sds-stepper-step-counter-background-color: var(--sds-stepper-step-counter-background-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-counter-border-color: var(--sds-stepper-step-counter-border-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-counter-text-color: var(--sds-stepper-step-counter-text-color, var(--sds-color-main-action-contrast-default));\n\t\t--_sds-stepper-step-label-text-decoration: var(--sds-stepper-step-label-text-decoration, none);\n\t\t--_sds-stepper-step-label-text-color: var(--sds-stepper-step-label-text-color, var(--sds-color-text-default, var(--sds-color-main-text-default)));\n\n\t\tpointer-events: none;\n\t}\n\n\t:host(:not([active])) .sds-stepper-step__step:hover {\n\t\t--_sds-stepper-step-label-text-color: var(--sds-stepper-step-label-text-color, var(--sds-color-action-hover, var(--sds-color-main-action-hover)));\n\t\t--_sds-stepper-step-label-text-decoration: var(--sds-stepper-step-label-text-decoration, var(--sds-typography-link-text-decoration));\n\t\t--_sds-stepper-step-label-text-decoration-thickness: var(--sds-stepper-step-label-text-decoration-thickness, calc(var(--sds-typography-link-text-decoration-thickness) + 1px));\n\t\t--_sds-stepper-step-counter-background-color: var(--sds-stepper-step-counter-background-color, var(--sds-color-action-contrast-subtle, var(--sds-color-main-action-contrast-subtle)));\n\t\t--_sds-stepper-step-counter-border-color: var(--sds-stepper-step-counter-border-color, var(--sds-color-action-hover, var(--sds-color-main-action-hover)));\n\t\t--_sds-stepper-step-counter-text-color: var(--sds-stepper-step-counter-text-color, var(--sds-color-action-hover, var(--sds-color-main-action-hover)));\n\t}\n\n\t:host(:not([active])[complete]) .sds-stepper-step__step:hover {\n\t\t--_sds-stepper-step-counter-mask-background-color: var(--sds-stepper-step-counter-mask-background-color, var(--sds-color-action-hover, var(--sds-color-main-action-hover)));\n\t\t--_sds-stepper-step-counter-mask: var(\n\t\t\t--sds-stepper-step-counter-mask,\n\t\t\turl(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M378-232.43 140.43-470l57.14-57.13L378-346.7l383.43-383.43L818.57-673z'/%3E%3C/svg%3E\")\n\t\t\t\tno-repeat center / 24px 24px\n\t\t);\n\t}\n\n\t:host(:not([active])) .sds-stepper-step__step:active {\n\t\t--_sds-stepper-step-label-text-color: var(--sds-stepper-step-label-text-color, var(--sds-color-action-active, var(--sds-color-main-action-active)));\n\t\t--_sds-stepper-step-counter-border-color: var(--sds-stepper-step-counter-border-color, var(--sds-color-action-active, var(--sds-color-main-action-active)));\n\t\t--_sds-stepper-step-counter-text-color: var(--sds-stepper-step-counter-text-color, var(--sds-color-action-active, var(--sds-color-main-action-active)));\n\t}\n\n\t:host(:not([active])[complete]) .sds-stepper-step__step:active {\n\t\t--_sds-stepper-step-counter-mask-background-color: var(--sds-stepper-step-counter-mask-background-color, var(--sds-color-action-active, var(--sds-color-main-action-active)));\n\t\t--_sds-stepper-step-counter-mask: var(\n\t\t\t--sds-stepper-step-counter-mask,\n\t\t\turl(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M378-232.43 140.43-470l57.14-57.13L378-346.7l383.43-383.43L818.57-673z'/%3E%3C/svg%3E\")\n\t\t\t\tno-repeat center / 24px 24px\n\t\t);\n\t}\n\n\t:host([active][complete]) {\n\t\t--_sds-stepper-step-counter-mask-background-color: var(--sds-stepper-step-counter-background-color, var(--sds-color-action-contrast-default, var(--sds-color-main-action-contrast-default)));\n\t}\n\n\t:host(:not([active]):not([interactive])) {\n\t\t--_sds-stepper-step-label-text-color: var(--sds-stepper-step-label-text-color, var(--sds-color-neutral-text-default));\n\t\t--_sds-stepper-step-label-text-decoration: var(--sds-stepper-step-label-text-decoration, none);\n\t\t--_sds-stepper-step-counter-background-color: var(--sds-stepper-step-counter-background-color, transparent);\n\t\t--_sds-stepper-step-counter-border-color: var(--sds-stepper-step-counter-border-color, var(--sds-color-neutral-border-strong));\n\t\t--_sds-stepper-step-counter-text-color: var(--sds-stepper-step-counter-text-color, var(--sds-color-neutral-text-default));\n\t}\n`;\n"]}
1
+ {"version":3,"file":"sds-stepper-step.styles.js","sourceRoot":"","sources":["../../src/sds-stepper-step/sds-stepper-step.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoQxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t:host {\n\t\t/* Sizing */\n\t\t--_sds-stepper-step-circle-size: var(--sds-stepper-circle-size, 28px);\n\t\t--_sds-stepper-step-border-width: var(--sds-stepper-step-border-width, 2px);\n\t\t--_sds-stepper-step-radius: var(--sds-stepper-step-radius, var(--sds-radius-sm));\n\t\t--_sds-stepper-step-gap: var(--sds-stepper-step-gap, var(--sds-spacing-3xs));\n\n\t\t/* Layout */\n\t\t--_sds-stepper-step-grid-template-rows: var(--sds-stepper-step-grid-template-rows, var(--_sds-stepper-step-circle-size) auto);\n\t\t--_sds-stepper-step-grid-template-columns: var(\n\t\t\t--sds-stepper-step-grid-template-columns,\n\t\t\t[line-1-start] 1fr [step-start] auto [line-1-end] var(--_sds-stepper-step-circle-size) [line-2-start] auto [step-end] 1fr [line-2-end]\n\t\t);\n\n\t\t/* Button */\n\t\t--_sds-stepper-step-step-grid-template-rows: var(--sds-stepper-step-step-grid-template-rows, [circle] var(--_sds-stepper-step-circle-size) [content] auto);\n\t\t--_sds-stepper-step-step-grid-template-columns: var(--sds-stepper-step-step-grid-template-columns, [content-start] auto [circle] var(--_sds-stepper-step-circle-size) [content-end] auto);\n\t\t--_sds-stepper-step-step-grid-area: var(--sds-stepper-step-step-grid-area, 1 / step / -1);\n\t\t--_sds-stepper-step-step-gap: var(--sds-stepper-step-step-gap, var(--sds-spacing-3xs));\n\t\t--_sds-stepper-step-step-margin: var(--sds-stepper-step-step-margin, 0);\n\n\t\t/* Divider */\n\t\t--_sds-stepper-step-divider-color: var(--sds-stepper-step-divider-color, var(--sds-color-neutral-border-subtle));\n\t\t--_sds-stepper-step-divider-width: var(--sds-stepper-step-divider-width, 100%);\n\t\t--_sds-stepper-step-divider-height: var(--sds-stepper-step-divider-height, 1px);\n\t\t--_sds-stepper-step-divider-min-height: var(--sds-stepper-step-divider-min-height, auto);\n\t\t--_sds-stepper-step-divider-grid-row: var(--sds-stepper-step-divider-grid-row, 1);\n\t\t--_sds-stepper-step-divider-before-grid-column: var(--sds-stepper-step-divider-before-grid-column, line-1);\n\t\t--_sds-stepper-step-divider-before-visibility: var(--sds-stepper-step-divider-before-visibility, visible);\n\t\t--_sds-stepper-step-divider-before-display: var(--sds-stepper-step-divider-before-display, block);\n\t\t--_sds-stepper-step-divider-after-grid-column: var(--sds-stepper-step-divider-after-grid-column, line-2);\n\t\t--_sds-stepper-step-divider-after-visibility: var(--sds-stepper-step-divider-after-visibility, visible);\n\t\t--_sds-stepper-step-divider-after-display: var(--sds-stepper-step-divider-after-display, block);\n\n\t\t/* Content */\n\t\t--_sds-stepper-step-label-grid-area: var(--sds-stepper-step-label-grid-area, content / 1 / content / -1);\n\t\t--_sds-stepper-step-label-text-decoration-thickness: var(--sds-stepper-step-label-text-decoration-thickness, var(--sds-typography-link-text-decoration-thickness));\n\t\t--_sds-stepper-step-label-text-underline-offset: var(--sds-stepper-step-label-text-underline-offset, var(--sds-typography-link-text-underline-offset));\n\t\t--_sds-stepper-step-label-max-width: var(--sds-stepper-step-label-max-width, 24ch);\n\t\t--_sds-stepper-step-label-text-color: var(--sds-stepper-step-label-text-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-label-text-decoration: var(--sds-stepper-step-label-text-decoration, none);\n\t\t--_sds-stepper-step-label-padding-inline: var(--sds-stepper-step-label-padding-inline, var(--sds-spacing-3xs));\n\n\t\t/* Counter */\n\t\t--_sds-stepper-step-counter-grid-area: var(--sds-stepper-step-counter-grid-area, circle / 2);\n\t\t--_sds-stepper-step-counter-border-color: var(--sds-stepper-step-counter-border-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-counter-text-color: var(--sds-stepper-step-counter-text-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-counter-content: var(--sds-stepper-step-counter-content, counters(stepper, ''));\n\t\t--_sds-stepper-step-counter-background-color: var(\n\t\t\t--sds-stepper-step-counter-background-color,\n\t\t\tvar(--sds-color-background-action-contrast-default, var(--sds-color-main-background-action-contrast-default))\n\t\t);\n\t\t--_sds-stepper-step-counter-mask: var(--sds-stepper-step-counter-mask, none);\n\t\t--_sds-stepper-step-counter-mask-background-color: var(--sds-stepper-step-counter-mask-background-color, transparent);\n\n\t\t/* Focus */\n\t\t--_sds-stepper-step-focus-color: var(--sds-stepper-step-focus-color, var(--sds-color-states-focus-outer));\n\t\t--_sds-stepper-step-focus-inner-color: var(--sds-stepper-step-focus-inner-color, var(--sds-color-states-focus-inner));\n\t\t--_sds-stepper-step-focus-spacing: var(--sds-stepper-step-focus-spacing, var(--sds-color-states-focus-spacing));\n\n\t\twidth: fit-content;\n\t}\n\n\t:host(:first-child) {\n\t\t--_sds-stepper-step-divider-before-visibility: hidden;\n\t}\n\n\t:host(:last-child) {\n\t\t--_sds-stepper-step-divider-after-visibility: hidden;\n\t}\n\n\t.sds-stepper-step {\n\t\tdisplay: grid;\n\t\tgrid-template-columns: var(--_sds-stepper-step-grid-template-columns);\n\t\tgrid-template-rows: var(--_sds-stepper-step-grid-template-rows);\n\t\tgap: var(--_sds-stepper-step-gap);\n\t\tjustify-items: flex-start;\n\t\tflex: 100%;\n\t\tpadding-block-start: var(--_sds-stepper-step-border-width);\n\t\tfont-family: var(--sds-typography-font-family);\n\t}\n\n\t.sds-stepper-step__divider {\n\t\tdisplay: block;\n\t\talign-self: center;\n\t\tjustify-self: center;\n\n\t\twidth: var(--_sds-stepper-step-divider-width);\n\t\theight: var(--_sds-stepper-step-divider-height);\n\t\tmin-height: var(--_sds-stepper-step-divider-min-height);\n\n\t\tgrid-row: var(--_sds-stepper-step-divider-grid-row);\n\t\tbackground-color: var(--_sds-stepper-step-divider-color);\n\n\t\t&.sds-stepper-step__divider--before {\n\t\t\tgrid-column: var(--_sds-stepper-step-divider-before-grid-column);\n\t\t\tvisibility: var(--_sds-stepper-step-divider-before-visibility);\n\t\t\tdisplay: var(--_sds-stepper-step-divider-before-display);\n\t\t}\n\n\t\t&.sds-stepper-step__divider--after {\n\t\t\tgrid-column: var(--_sds-stepper-step-divider-after-grid-column);\n\t\t\tvisibility: var(--_sds-stepper-step-divider-after-visibility);\n\t\t\tdisplay: var(--_sds-stepper-step-divider-after-display);\n\t\t}\n\t}\n\n\t.sds-stepper-step__step,\n\t.sds-stepper-step__step--static {\n\t\tdisplay: grid;\n\t\twidth: 100%;\n\n\t\tgrid-area: var(--_sds-stepper-step-step-grid-area);\n\t\tgrid-template-rows: var(--_sds-stepper-step-step-grid-template-rows);\n\t\tgrid-template-columns: var(--_sds-stepper-step-step-grid-template-columns);\n\t\tplace-items: center;\n\n\t\tgap: var(--_sds-stepper-step-step-gap);\n\t\tpadding: 0;\n\t\tmargin: var(--_sds-stepper-step-step-margin);\n\n\t\tborder: 0;\n\t\tbackground: none;\n\t\tborder-radius: var(--_sds-stepper-step-radius);\n\t}\n\n\t.sds-stepper-step__step {\n\t\tcursor: pointer;\n\n\t\t&:focus-visible {\n\t\t\tbox-shadow: 0 0 0 var(--sds-color-states-focus-spacing) var(--_sds-stepper-step-focus-inner-color);\n\t\t\toutline: 3px solid var(--_sds-stepper-step-focus-color);\n\t\t\toutline-offset: 3px;\n\t\t\tisolation: isolate;\n\t\t}\n\t}\n\n\t.sds-stepper-step__label {\n\t\tgrid-column: content;\n\t\tgrid-area: var(--_sds-stepper-step-label-grid-area);\n\t\tmin-width: fit-content;\n\t\tmax-width: var(--_sds-stepper-step-label-max-width);\n\t\ttext-align: left;\n\t\tpadding-inline: var(--_sds-stepper-step-label-padding-inline);\n\n\t\tcolor: var(--_sds-stepper-step-label-text-color);\n\t\tfont-family: var(--sds-typography-font-family);\n\t\tfont-size: var(--sds-typography-body-lg-strong-tall-desktop-font-size);\n\t\tfont-weight: var(--sds-typography-body-lg-strong-tall-desktop-font-weight);\n\t\tline-height: var(--sds-typography-body-lg-strong-tall-desktop-line-height);\n\n\t\ttext-decoration: var(--_sds-stepper-step-label-text-decoration);\n\t\ttext-decoration-thickness: var(--_sds-stepper-step-label-text-decoration-thickness);\n\t\ttext-underline-offset: var(--_sds-stepper-step-label-text-underline-offset);\n\t}\n\n\t.sds-stepper-step__counter {\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\n\t\tgrid-area: var(--_sds-stepper-step-counter-grid-area);\n\n\t\twidth: var(--_sds-stepper-step-circle-size);\n\t\theight: var(--_sds-stepper-step-circle-size);\n\n\t\tborder-radius: 50%;\n\t\tborder: var(--_sds-stepper-step-border-width) solid var(--_sds-stepper-step-counter-border-color);\n\t\tbackground-color: var(--_sds-stepper-step-counter-background-color);\n\n\t\tcounter-increment: stepper;\n\n\t\tcolor: var(--_sds-stepper-step-counter-text-color);\n\t\tfont-size: var(--sds-typography-body-md-strong-desktop-font-size);\n\t\tfont-weight: var(--sds-typography-body-md-strong-desktop-font-weight);\n\t\tline-height: var(--sds-typography-body-md-strong-desktop-line-height);\n\n\t\t&::before {\n\t\t\tcontent: var(--_sds-stepper-step-counter-content);\n\n\t\t\tdisplay: flex;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\n\t\t\tborder-radius: 50%;\n\t\t\tbackground-color: var(--_sds-stepper-step-counter-mask-background-color);\n\t\t\tmask: var(--_sds-stepper-step-counter-mask);\n\t\t}\n\t}\n\n\t:host([complete]) {\n\t\t--_sds-stepper-step-counter-background-color: var(--sds-stepper-step-counter-background-color, var(--sds-color-action-contrast-subtle, var(--sds-color-main-action-contrast-subtle)));\n\t\t--_sds-stepper-step-counter-border-color: var(--sds-stepper-step-counter-border-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-counter-text-color: var(--sds-stepper-step-counter-text-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-counter-content: var(--sds-stepper-step-counter-content, '');\n\t\t--_sds-stepper-step-counter-mask-background-color: var(--sds-stepper-step-counter-mask-background-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-counter-mask: var(\n\t\t\t--sds-stepper-step-counter-mask,\n\t\t\turl(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M378-232.43 140.43-470l57.14-57.13L378-346.7l383.43-383.43L818.57-673z'/%3E%3C/svg%3E\")\n\t\t\t\tno-repeat center / 24px 24px\n\t\t);\n\t}\n\n\t:host([active]) {\n\t\t--_sds-stepper-step-counter-background-color: var(--sds-stepper-step-counter-background-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-counter-border-color: var(--sds-stepper-step-counter-border-color, var(--sds-color-action-default, var(--sds-color-main-action-default)));\n\t\t--_sds-stepper-step-counter-text-color: var(--sds-stepper-step-counter-text-color, var(--sds-color-main-action-contrast-default));\n\t\t--_sds-stepper-step-label-text-decoration: var(--sds-stepper-step-label-text-decoration, none);\n\t\t--_sds-stepper-step-label-text-color: var(--sds-stepper-step-label-text-color, var(--sds-color-text-default, var(--sds-color-neutral-text-default)));\n\n\t\tpointer-events: none;\n\t}\n\n\t:host(:not([active])) .sds-stepper-step__step:hover {\n\t\t--_sds-stepper-step-label-text-color: var(--sds-stepper-step-label-text-color, var(--sds-color-action-hover, var(--sds-color-main-action-hover)));\n\t\t--_sds-stepper-step-label-text-decoration: var(--sds-stepper-step-label-text-decoration, var(--sds-typography-link-text-decoration));\n\t\t--_sds-stepper-step-counter-background-color: var(--sds-stepper-step-counter-background-color, var(--sds-color-action-contrast-subtle, var(--sds-color-main-action-contrast-subtle)));\n\t\t--_sds-stepper-step-counter-border-color: var(--sds-stepper-step-counter-border-color, var(--sds-color-action-hover, var(--sds-color-main-action-hover)));\n\t\t--_sds-stepper-step-counter-text-color: var(--sds-stepper-step-counter-text-color, var(--sds-color-action-hover, var(--sds-color-main-action-hover)));\n\t}\n\n\t:host(:not([active])[complete]) .sds-stepper-step__step:hover {\n\t\t--_sds-stepper-step-counter-mask-background-color: var(--sds-stepper-step-counter-mask-background-color, var(--sds-color-action-hover, var(--sds-color-main-action-hover)));\n\t\t--_sds-stepper-step-counter-mask: var(\n\t\t\t--sds-stepper-step-counter-mask,\n\t\t\turl(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M378-232.43 140.43-470l57.14-57.13L378-346.7l383.43-383.43L818.57-673z'/%3E%3C/svg%3E\")\n\t\t\t\tno-repeat center / 24px 24px\n\t\t);\n\t}\n\n\t:host(:not([active])) .sds-stepper-step__step:active {\n\t\t--_sds-stepper-step-label-text-color: var(--sds-stepper-step-label-text-color, var(--sds-color-action-active, var(--sds-color-main-action-active)));\n\t\t--_sds-stepper-step-counter-border-color: var(--sds-stepper-step-counter-border-color, var(--sds-color-action-active, var(--sds-color-main-action-active)));\n\t\t--_sds-stepper-step-counter-text-color: var(--sds-stepper-step-counter-text-color, var(--sds-color-action-active, var(--sds-color-main-action-active)));\n\t}\n\n\t:host(:not([active])[complete]) .sds-stepper-step__step:active {\n\t\t--_sds-stepper-step-counter-mask-background-color: var(--sds-stepper-step-counter-mask-background-color, var(--sds-color-action-active, var(--sds-color-main-action-active)));\n\t\t--_sds-stepper-step-counter-mask: var(\n\t\t\t--sds-stepper-step-counter-mask,\n\t\t\turl(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M378-232.43 140.43-470l57.14-57.13L378-346.7l383.43-383.43L818.57-673z'/%3E%3C/svg%3E\")\n\t\t\t\tno-repeat center / 24px 24px\n\t\t);\n\t}\n\n\t:host([active][complete]) {\n\t\t--_sds-stepper-step-counter-mask-background-color: var(--sds-stepper-step-counter-background-color, var(--sds-color-action-contrast-default, var(--sds-color-main-action-contrast-default)));\n\t}\n\n\t:host(:not([active]):not([interactive])) {\n\t\t--_sds-stepper-step-label-text-color: var(--sds-stepper-step-label-text-color, var(--sds-color-neutral-text-default));\n\t\t--_sds-stepper-step-label-text-decoration: var(--sds-stepper-step-label-text-decoration, none);\n\t\t--_sds-stepper-step-counter-background-color: var(--sds-stepper-step-counter-background-color, transparent);\n\t\t--_sds-stepper-step-counter-border-color: var(--sds-stepper-step-counter-border-color, var(--sds-color-neutral-border-strong));\n\t\t--_sds-stepper-step-counter-text-color: var(--sds-stepper-step-counter-text-color, var(--sds-color-neutral-text-default));\n\t}\n`;\n"]}
@@ -1,35 +1,26 @@
1
1
  import { LitElement } from 'lit';
2
2
  import { SDS_SIZES } from '../types';
3
+ import type { SDSFormControlProps } from '../mixins/sds-form-control-mixin';
3
4
  import '../sds-icon/sds-icon';
4
5
  type v2SwitchSizes = Extract<SDS_SIZES, 'sm' | 'md' | 'lg'>;
5
6
  type SwitchSize = v2SwitchSizes | 's' | 'l';
6
- export interface SDSSwitchProps {
7
- disabled?: boolean;
8
- label?: string;
7
+ export interface SDSSwitchProps extends SDSFormControlProps {
8
+ checked?: boolean;
9
9
  'hide-label'?: boolean;
10
- name?: string;
11
- readonly?: boolean;
10
+ label?: string;
12
11
  reverse?: boolean;
13
- checked?: boolean;
14
12
  size?: SwitchSize;
15
13
  }
16
- declare const SDSSwitch_base: import("../mixins/types").Constructable<import("../mixins/sds-event-dispatcher-mixin").SDSEventDispatcherMixinInterface> & typeof LitElement;
14
+ declare const SDSSwitch_base: import("../mixins/types").Constructable<import("../mixins/sds-delegate-interaction-mixin").DelegateInteractionMixinInterface> & import("../mixins/types").Constructable<import("../mixins/sds-event-dispatcher-mixin").SDSEventDispatcherMixinInterface> & import("../mixins/types").Constructable<import("../mixins/sds-form-control-mixin").SDSFormControlMixinInterface> & typeof LitElement;
17
15
  export declare class SDSSwitch extends SDSSwitch_base {
18
16
  static styles: import("lit").CSSResult[];
19
- disabled: boolean;
20
17
  label: string;
21
18
  hideLabel: boolean;
22
- name?: string;
23
19
  reverse: boolean;
24
20
  checked: boolean;
25
- readOnly: boolean;
26
21
  size: SwitchSize;
27
22
  control: HTMLInputElement;
28
- static formAssociated: boolean;
29
- readonly internals: ElementInternals;
30
- static shadowRootOptions: ShadowRootInit;
31
23
  private _initialChecked;
32
- constructor();
33
24
  connectedCallback(): void;
34
25
  updated(changedProperties: Map<string | number | symbol, unknown>): void;
35
26
  formResetCallback(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"sds-switch.d.ts","sourceRoot":"","sources":["../../src/sds-switch/sds-switch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAC;AAMhD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,sBAAsB,CAAC;AAE9B,KAAK,aAAa,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AAC5D,KAAK,UAAU,GAAG,aAAa,GAAG,GAAG,GAAG,GAAG,CAAC;AAE5C,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;CAClB;;AAED,qBACa,SAAU,SAAQ,cAAmC;IACjE,OAAgB,MAAM,4BAAY;IAEU,QAAQ,EAAE,OAAO,CAAS;IAC3B,KAAK,EAAE,MAAM,CAAM;IACO,SAAS,EAAE,OAAO,CAAS;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAS;IACzB,OAAO,EAAE,OAAO,CAAS;IACF,QAAQ,EAAE,OAAO,CAAS;IAClD,IAAI,EAAE,UAAU,CAAQ;IAEhD,OAAO,EAAG,gBAAgB,CAAC;IAE9C,MAAM,CAAC,cAAc,UAAQ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AClB,IAAI,CAAC,EAAE,UAAU,CAAC;CAClB;;AAED,qBACa,SAAU,SAAQ,cAAqF;IACnH,OAAgB,MAAM,4BAAY;IAES,KAAK,EAAE,MAAM,CAAM;IACO,SAAS,EAAE,OAAO,CAAS;IACpD,OAAO,EAAE,OAAO,CAAS;IACzB,OAAO,EAAE,OAAO,CAAS;IAC1B,IAAI,EAAE,UAAU,CAAQ;IAEhD,OAAO,EAAG,gBAAgB,CAAC;IAC9C,OAAO,CAAC,eAAe,CAAkB;IAEhC,iBAAiB,IAAI,IAAI;IAMzB,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC;IAS1E,iBAAiB;IAMjB,wBAAwB,CAAC,KAAK,EAAE,OAAO;IAIvC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAY5B;IAEF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAK3B;IAEF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAK1B;IAEF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAW1B;IAEF,IAAI,KAAK,IAAI,MAAM,CAElB;IAEQ,MAAM;CA4Bf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,YAAY,EAAE,SAAS,CAAC;KACxB;CACD"}
@@ -10,27 +10,28 @@ import { ifDefined } from 'lit/directives/if-defined.js';
10
10
  import { classMap } from 'lit/directives/class-map.js';
11
11
  import { guardedCustomElement } from '../utils/guarded-custom-element';
12
12
  import { styles } from './sds-switch.styles';
13
- import { SDSEventDispatcherMixin } from '../mixins/sds-event-dispatcher-mixin';
13
+ import { SDSEventDispatcherMixin, SDSDelegateInteractionMixin, SDSFormControlMixin } from '../mixins';
14
14
  import '../sds-icon/sds-icon';
15
- let SDSSwitch = class SDSSwitch extends SDSEventDispatcherMixin(LitElement) {
15
+ let SDSSwitch = class SDSSwitch extends SDSDelegateInteractionMixin(SDSEventDispatcherMixin(SDSFormControlMixin(LitElement))) {
16
16
  constructor() {
17
- super();
18
- this.disabled = false;
17
+ super(...arguments);
19
18
  this.label = '';
20
19
  this.hideLabel = false;
21
20
  this.reverse = false;
22
21
  this.checked = false;
23
- this.readOnly = false;
24
22
  this.size = 'md';
25
23
  this._initialChecked = false;
26
24
  this._handleChange = (event) => {
27
25
  event.stopImmediatePropagation();
28
- if (!this.disabled) {
29
- const elem = event.target;
30
- this.checked = elem.checked;
31
- this.internals.setFormValue(this.checked ? 'on' : 'off');
32
- this.dispatchSheriffEvent('change');
26
+ if (this.disabled || this.readOnly) {
27
+ event.target.checked = this.checked;
28
+ event.preventDefault();
29
+ return;
33
30
  }
31
+ const elem = event.target;
32
+ this.checked = elem.checked;
33
+ this.internals.setFormValue(this.checked ? 'on' : 'off');
34
+ this.dispatchSheriffEvent('change');
34
35
  };
35
36
  this._handleFocus = (event) => {
36
37
  event.stopImmediatePropagation();
@@ -40,7 +41,7 @@ let SDSSwitch = class SDSSwitch extends SDSEventDispatcherMixin(LitElement) {
40
41
  };
41
42
  this._handleBlur = (event) => {
42
43
  event.stopImmediatePropagation();
43
- if (!this.disabled && !this.disabled) {
44
+ if (!this.disabled) {
44
45
  this.dispatchSheriffEvent('blur');
45
46
  }
46
47
  };
@@ -56,7 +57,6 @@ let SDSSwitch = class SDSSwitch extends SDSEventDispatcherMixin(LitElement) {
56
57
  return 'sm';
57
58
  }
58
59
  };
59
- this.internals = this.attachInternals();
60
60
  }
61
61
  connectedCallback() {
62
62
  super.connectedCallback();
@@ -64,6 +64,7 @@ let SDSSwitch = class SDSSwitch extends SDSEventDispatcherMixin(LitElement) {
64
64
  this.internals.setFormValue(this.checked ? 'on' : 'off');
65
65
  }
66
66
  updated(changedProperties) {
67
+ super.updated(changedProperties);
67
68
  if (changedProperties.has('checked')) {
68
69
  this.control.checked = this.checked;
69
70
  this.internals.setFormValue(this.checked ? 'on' : 'off');
@@ -108,32 +109,18 @@ let SDSSwitch = class SDSSwitch extends SDSEventDispatcherMixin(LitElement) {
108
109
  }
109
110
  };
110
111
  SDSSwitch.styles = [styles];
111
- SDSSwitch.formAssociated = true;
112
- SDSSwitch.shadowRootOptions = {
113
- ...LitElement.shadowRootOptions,
114
- delegatesFocus: true,
115
- };
116
- __decorate([
117
- property({ type: Boolean, reflect: true })
118
- ], SDSSwitch.prototype, "disabled", void 0);
119
112
  __decorate([
120
113
  property({ type: String, reflect: true })
121
114
  ], SDSSwitch.prototype, "label", void 0);
122
115
  __decorate([
123
116
  property({ type: Boolean, reflect: true, attribute: 'hide-label' })
124
117
  ], SDSSwitch.prototype, "hideLabel", void 0);
125
- __decorate([
126
- property({ type: String, reflect: true })
127
- ], SDSSwitch.prototype, "name", void 0);
128
118
  __decorate([
129
119
  property({ type: Boolean, reflect: true })
130
120
  ], SDSSwitch.prototype, "reverse", void 0);
131
121
  __decorate([
132
122
  property({ type: Boolean, reflect: true })
133
123
  ], SDSSwitch.prototype, "checked", void 0);
134
- __decorate([
135
- property({ type: Boolean, attribute: 'readonly', reflect: true })
136
- ], SDSSwitch.prototype, "readOnly", void 0);
137
124
  __decorate([
138
125
  property({ type: String, reflect: true })
139
126
  ], SDSSwitch.prototype, "size", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"sds-switch.js","sourceRoot":"","sources":["../../src/sds-switch/sds-switch.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;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AAiB;IAC/B,cAAc,EAAE,IAAI;CACpB,AAHgC,CAG/B;AAjB0C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAA2B;AAC3B;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAAoB;AACO;IAApE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;4CAA4B;AACrD;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAAe;AACb;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAA0B;AACzB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAA0B;AACF;IAAlE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAA2B;AAClD;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAAyB;AAEhD;IAAlB,KAAK,CAAC,UAAU,CAAC;0CAA4B;AAZlC,SAAS;IADrB,oBAAoB,CAAC,YAAY,CAAC;GACtB,SAAS,CAwHrB","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { guardedCustomElement } from '../utils/guarded-custom-element';\nimport { styles } from './sds-switch.styles';\nimport { SDS_SIZES } from '../types';\nimport { SDSEventDispatcherMixin } from '../mixins/sds-event-dispatcher-mixin';\n\nimport '../sds-icon/sds-icon';\n\ntype v2SwitchSizes = Extract<SDS_SIZES, 'sm' | 'md' | 'lg'>;\ntype SwitchSize = v2SwitchSizes | 's' | 'l';\n\nexport interface SDSSwitchProps {\n\tdisabled?: boolean;\n\tlabel?: string;\n\t'hide-label'?: boolean;\n\tname?: string;\n\treadonly?: boolean;\n\treverse?: boolean;\n\tchecked?: boolean;\n\tsize?: SwitchSize;\n}\n\n@guardedCustomElement('sds-switch')\nexport class SDSSwitch extends SDSEventDispatcherMixin(LitElement) {\n\tstatic override styles = [styles];\n\n\t@property({ type: Boolean, reflect: true }) disabled: boolean = false;\n\t@property({ type: String, reflect: true }) label: string = '';\n\t@property({ type: Boolean, reflect: true, attribute: 'hide-label' }) hideLabel: boolean = false;\n\t@property({ type: String, reflect: true }) name?: string;\n\t@property({ type: Boolean, reflect: true }) reverse: boolean = false;\n\t@property({ type: Boolean, reflect: true }) checked: boolean = false;\n\t@property({ type: Boolean, attribute: 'readonly', reflect: true }) readOnly: boolean = false;\n\t@property({ type: String, reflect: true }) size: SwitchSize = 'md';\n\n\t@query('#control') control!: HTMLInputElement;\n\n\tstatic formAssociated = true;\n\tpublic readonly internals: ElementInternals;\n\n\tstatic override shadowRootOptions: ShadowRootInit = {\n\t\t...LitElement.shadowRootOptions,\n\t\tdelegatesFocus: true,\n\t};\n\tprivate _initialChecked: boolean = false;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.internals = this.attachInternals();\n\t}\n\n\toverride connectedCallback(): void {\n\t\tsuper.connectedCallback();\n\t\tthis._initialChecked = this.checked;\n\t\tthis.internals.setFormValue(this.checked ? 'on' : 'off');\n\t}\n\n\toverride updated(changedProperties: Map<string | number | symbol, unknown>) {\n\t\tif (changedProperties.has('checked')) {\n\t\t\tthis.control.checked = this.checked;\n\t\t\tthis.internals.setFormValue(this.checked ? 'on' : 'off');\n\t\t}\n\t}\n\n\tformResetCallback() {\n\t\tthis.checked = this._initialChecked;\n\t\tthis.control.checked = this._initialChecked;\n\t\tthis.internals.setFormValue(this._initialChecked ? 'on' : 'off');\n\t}\n\n\tformStateRestoreCallback(state: unknown) {\n\t\tthis.checked = state as boolean;\n\t}\n\n\tprivate readonly _handleChange = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tif (!this.disabled) {\n\t\t\tconst elem = event.target as HTMLInputElement;\n\t\t\tthis.checked = elem.checked;\n\t\t\tthis.internals.setFormValue(this.checked ? 'on' : 'off');\n\t\t\tthis.dispatchSheriffEvent('change');\n\t\t}\n\t};\n\n\tprivate readonly _handleFocus = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tif (!this.disabled) {\n\t\t\tthis.dispatchSheriffEvent('focus');\n\t\t}\n\t};\n\n\tprivate readonly _handleBlur = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tif (!this.disabled && !this.disabled) {\n\t\t\tthis.dispatchSheriffEvent('blur');\n\t\t}\n\t};\n\n\tprivate readonly getIconSize = (): v2SwitchSizes => {\n\t\tswitch (this.size) {\n\t\t\tcase 'sm':\n\t\t\tcase 'md':\n\t\t\tcase 'lg':\n\t\t\t\treturn this.size;\n\t\t\tcase 'l':\n\t\t\t\treturn 'lg';\n\t\t\tcase 's':\n\t\t\t\treturn 'sm';\n\t\t}\n\t};\n\n\tget value(): string {\n\t\treturn this.checked ? 'on' : 'off';\n\t}\n\n\toverride render() {\n\t\tconst switchClasses = {\n\t\t\t'sds-switch': true,\n\t\t};\n\n\t\tconst labelClasses = {\n\t\t\t'sds-switch__label': true,\n\t\t\t'sds-switch__label--hidden': this.hideLabel,\n\t\t};\n\n\t\tconst inputTemplate = html`<input\n\t\t\tclass=\"sds-switch__input\"\n\t\t\tid=\"control\"\n\t\t\ttype=\"checkbox\"\n\t\t\trole=\"switch\"\n\t\t\t?readonly=\"${this.readOnly}\"\n\t\t\t?disabled=\"${this.disabled}\"\n\t\t\t.checked=\"${this.checked}\"\n\t\t\t?checked=\"${this.checked}\"\n\t\t\tname=\"${ifDefined(this.name)}\"\n\t\t\t@change=\"${this._handleChange}\"\n\t\t\t@focus=\"${this._handleFocus}\"\n\t\t\t@blur=\"${this._handleBlur}\"\n\t\t/>`;\n\t\tconst iconTemplate = this.readOnly ? html`<sds-icon name=\"lock-material-filled\" size=\"${this.getIconSize()}\"></sds-icon>` : nothing;\n\t\tconst labelTemplate = html`<label class=\"${classMap(labelClasses)}\" for=\"control\">${iconTemplate}${this.label}</label>`;\n\t\treturn html`<div class=\"${classMap(switchClasses)}\">${this.reverse ? [labelTemplate, inputTemplate] : [inputTemplate, labelTemplate]}</div>`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-switch': SDSSwitch;\n\t}\n}\n"]}
1
+ {"version":3,"file":"sds-switch.js","sourceRoot":"","sources":["../../src/sds-switch/sds-switch.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGtG,OAAO,sBAAsB,CAAC;AAcvB,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,2BAA2B,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC;IAA7G;;QAGqC,UAAK,GAAW,EAAE,CAAC;QACO,cAAS,GAAY,KAAK,CAAC;QACpD,YAAO,GAAY,KAAK,CAAC;QACzB,YAAO,GAAY,KAAK,CAAC;QAC1B,SAAI,GA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Q,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAA0B;AAC1B;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAAyB;AAEhD;IAAlB,KAAK,CAAC,UAAU,CAAC;0CAA4B;AATlC,SAAS;IADrB,oBAAoB,CAAC,YAAY,CAAC;GACtB,SAAS,CA8GrB","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { guardedCustomElement } from '../utils/guarded-custom-element';\nimport { styles } from './sds-switch.styles';\nimport { SDS_SIZES } from '../types';\nimport { SDSEventDispatcherMixin, SDSDelegateInteractionMixin, SDSFormControlMixin } from '../mixins';\nimport type { SDSFormControlProps } from '../mixins/sds-form-control-mixin';\n\nimport '../sds-icon/sds-icon';\n\ntype v2SwitchSizes = Extract<SDS_SIZES, 'sm' | 'md' | 'lg'>;\ntype SwitchSize = v2SwitchSizes | 's' | 'l';\n\nexport interface SDSSwitchProps extends SDSFormControlProps {\n\tchecked?: boolean;\n\t'hide-label'?: boolean;\n\tlabel?: string;\n\treverse?: boolean;\n\tsize?: SwitchSize;\n}\n\n@guardedCustomElement('sds-switch')\nexport class SDSSwitch extends SDSDelegateInteractionMixin(SDSEventDispatcherMixin(SDSFormControlMixin(LitElement))) {\n\tstatic override styles = [styles];\n\n\t@property({ type: String, reflect: true }) label: string = '';\n\t@property({ type: Boolean, reflect: true, attribute: 'hide-label' }) hideLabel: boolean = false;\n\t@property({ type: Boolean, reflect: true }) reverse: boolean = false;\n\t@property({ type: Boolean, reflect: true }) checked: boolean = false;\n\t@property({ type: String, reflect: true }) size: SwitchSize = 'md';\n\n\t@query('#control') control!: HTMLInputElement;\n\tprivate _initialChecked: boolean = false;\n\n\toverride connectedCallback(): void {\n\t\tsuper.connectedCallback();\n\t\tthis._initialChecked = this.checked;\n\t\tthis.internals.setFormValue(this.checked ? 'on' : 'off');\n\t}\n\n\toverride updated(changedProperties: Map<string | number | symbol, unknown>) {\n\t\tsuper.updated(changedProperties);\n\n\t\tif (changedProperties.has('checked')) {\n\t\t\tthis.control.checked = this.checked;\n\t\t\tthis.internals.setFormValue(this.checked ? 'on' : 'off');\n\t\t}\n\t}\n\n\tformResetCallback() {\n\t\tthis.checked = this._initialChecked;\n\t\tthis.control.checked = this._initialChecked;\n\t\tthis.internals.setFormValue(this._initialChecked ? 'on' : 'off');\n\t}\n\n\tformStateRestoreCallback(state: unknown) {\n\t\tthis.checked = state as boolean;\n\t}\n\n\tprivate readonly _handleChange = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tif (this.disabled || this.readOnly) {\n\t\t\t(event.target as HTMLInputElement).checked = this.checked;\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tconst elem = event.target as HTMLInputElement;\n\t\tthis.checked = elem.checked;\n\t\tthis.internals.setFormValue(this.checked ? 'on' : 'off');\n\t\tthis.dispatchSheriffEvent('change');\n\t};\n\n\tprivate readonly _handleFocus = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tif (!this.disabled) {\n\t\t\tthis.dispatchSheriffEvent('focus');\n\t\t}\n\t};\n\n\tprivate readonly _handleBlur = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tif (!this.disabled) {\n\t\t\tthis.dispatchSheriffEvent('blur');\n\t\t}\n\t};\n\n\tprivate readonly getIconSize = (): v2SwitchSizes => {\n\t\tswitch (this.size) {\n\t\t\tcase 'sm':\n\t\t\tcase 'md':\n\t\t\tcase 'lg':\n\t\t\t\treturn this.size;\n\t\t\tcase 'l':\n\t\t\t\treturn 'lg';\n\t\t\tcase 's':\n\t\t\t\treturn 'sm';\n\t\t}\n\t};\n\n\tget value(): string {\n\t\treturn this.checked ? 'on' : 'off';\n\t}\n\n\toverride render() {\n\t\tconst switchClasses = {\n\t\t\t'sds-switch': true,\n\t\t};\n\n\t\tconst labelClasses = {\n\t\t\t'sds-switch__label': true,\n\t\t\t'sds-switch__label--hidden': this.hideLabel,\n\t\t};\n\n\t\tconst inputTemplate = html`<input\n\t\t\tclass=\"sds-switch__input\"\n\t\t\tid=\"control\"\n\t\t\ttype=\"checkbox\"\n\t\t\trole=\"switch\"\n\t\t\t?readonly=\"${this.readOnly}\"\n\t\t\t?disabled=\"${this.disabled}\"\n\t\t\t.checked=\"${this.checked}\"\n\t\t\t?checked=\"${this.checked}\"\n\t\t\tname=\"${ifDefined(this.name)}\"\n\t\t\t@change=\"${this._handleChange}\"\n\t\t\t@focus=\"${this._handleFocus}\"\n\t\t\t@blur=\"${this._handleBlur}\"\n\t\t/>`;\n\t\tconst iconTemplate = this.readOnly ? html`<sds-icon name=\"lock-material-filled\" size=\"${this.getIconSize()}\"></sds-icon>` : nothing;\n\t\tconst labelTemplate = html`<label class=\"${classMap(labelClasses)}\" for=\"control\">${iconTemplate}${this.label}</label>`;\n\t\treturn html`<div class=\"${classMap(switchClasses)}\">${this.reverse ? [labelTemplate, inputTemplate] : [inputTemplate, labelTemplate]}</div>`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-switch': SDSSwitch;\n\t}\n}\n"]}
@@ -48,7 +48,7 @@ export const styles = css `
48
48
  pointer-events: none;
49
49
  }
50
50
 
51
- :host([disabled]) {
51
+ :host(:disabled) {
52
52
  opacity: var(--_sds-switch-disabled-opacity);
53
53
  pointer-events: none;
54
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sds-switch.styles.js","sourceRoot":"","sources":["../../src/sds-switch/sds-switch.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsJxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t:host {\n\t\t--_sds-switch-background-color: var(--sds-switch-background-color, var(--sds-color-surface-default, var(--sds-color-neutral-surface-default)));\n\t\t--_sds-switch-text-color: var(--sds-switch-text-color, var(--sds-color-text-default, var(--sds-color-neutral-text-default)));\n\n\t\t--_sds-switch-transition-time: var(--sds-switch-transition-time, 200ms);\n\n\t\t--_sds-switch-border-color: var(--sds-switch-border-color, var(--sds-color-border-default, var(--sds-color-neutral-border-default)));\n\t\t--_sds-switch-border-width: var(--sds-switch-border-width, var(--sds-border-md));\n\t\t--_sds-switch-border-radius: var(--sds-switch-border-radius, var(--sds-radius-full));\n\n\t\t--_sds-switch-font-family: var(--sds-switch-font-family, var(--sds-typography-font-family-roboto));\n\t\t--_sds-switch-font-size: var(--sds-switch-font-size, var(--sds-components-font-size-content-md));\n\t\t--_sds-switch-font-weight: var(--sds-switch-font-weight, var(--sds-typography-font-weight-regular));\n\t\t--_sds-switch-line-height: var(--sds-switch-line-height, var(--sds-components-line-height-tall-content-md));\n\n\t\t--_sds-switch-gap: var(--sds-switch-gap, var(--sds-spacing-3xs));\n\t\t--_sds-switch-icon-gap: var(--sds-switch-icon-gap, var(--sds-spacing-4xs));\n\t\t--_sds-switch-width: var(--sds-switch-width, var(--sds-components-switch-length-md));\n\t\t--_sds-switch-height: var(--sds-switch-height, var(--sds-components-icon-md));\n\n\t\t--_sds-switch-button-color: var(--sds-switch-button-color, var(--sds-color-neutral-text-default));\n\t\t--_sds-switch-button-size: var(--sds-switch-button-size, var(--sds-components-switch-bulleye-md));\n\t\t--_sds-switch-button-gap: var(--sds-switch-button-gap, var(--sds-spacing-4xs));\n\t\t--_sds-switch-button-position: var(--sds-switch-button-position, calc(var(--_sds-switch-button-gap) - var(--_sds-switch-border-width)));\n\t\t--_sds-switch-button-radius: var(--sds-switch-button-radius, var(--sds-radius-full));\n\n\t\t--_sds-switch-focus-outline-width: var(--sds-switch-focus-outline-width, var(--sds-border-md));\n\t\t--_sds-switch-focus-outline-color: var(--sds-switch-focus-outline-color, var(--sds-color-states-focus-outer));\n\t\t--_sds-switch-focus-outline-offset: var(--sds-switch-focus-outline-offset, var(--sds-color-states-focus-spacing));\n\t\t--_sds-switch-focus-inner-color: var(--sds-switch-focus-inner-color, var(--sds-color-states-focus-inner));\n\n\t\t--_sds-switch-disabled-opacity: var(--sds-switch-disabled-opacity, var(--sds-color-states-disabled-opacity));\n\n\t\tbox-sizing: border-box;\n\t}\n\n\t:host([hidden]) {\n\t\tdisplay: none;\n\t}\n\n\t:host([readonly]) {\n\t\t--_sds-switch-background-color: var(--sds-switch-background-color, var(--sds-color-neutral-surface-tinted));\n\t\t--_sds-switch-button-color: var(--sds-switch-button-color, var(--sds-color-neutral-text-default));\n\t\t--_sds-switch-border-color: var(--sds-switch-border-color, var(--sds-color-neutral-border-subtle));\n\t\tcursor: default;\n\t\tpointer-events: none;\n\t}\n\n\t:host([disabled]) {\n\t\topacity: var(--_sds-switch-disabled-opacity);\n\t\tpointer-events: none;\n\t}\n\n\t:host([size='s']),\n\t:host([size='sm']) {\n\t\t--_sds-switch-width: var(--sds-switch-width, var(--sds-components-switch-length-sm));\n\t\t--_sds-switch-height: var(--sds-switch-height, var(--sds-components-icon-sm));\n\t\t--_sds-switch-button-size: var(--sds-switch-button-size, var(--sds-components-switch-bulleye-sm));\n\t\t--_sds-switch-font-size: var(--sds-switch-font-size, var(--sds-components-font-size-content-sm));\n\t\t--_sds-switch-line-height: var(--sds-switch-line-height, var(--sds-components-line-height-tall-content-sm));\n\t}\n\n\t:host([size='l']),\n\t:host([size='lg']) {\n\t\t--_sds-switch-width: var(--sds-switch-width, var(--sds-components-switch-length-lg));\n\t\t--_sds-switch-height: var(--sds-switch-height, var(--sds-components-icon-lg));\n\t\t--_sds-switch-button-size: var(--sds-switch-button-size, var(--sds-components-switch-bulleye-lg));\n\t\t--_sds-switch-font-size: var(--sds-switch-font-size, var(--sds-components-font-size-content-lg));\n\t\t--_sds-switch-line-height: var(--sds-switch-line-height, var(--sds-components-line-height-tall-content-lg));\n\t}\n\n\t.sds-switch {\n\t\tdisplay: flex;\n\t\tflex-direction: row;\n\t\talign-items: center;\n\t\tgap: var(--_sds-switch-gap);\n\t\tfont-family: var(--_sds-switch-font-family);\n\t}\n\n\t.sds-switch__label {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tcursor: pointer;\n\t\tuser-select: none;\n\t\tgap: var(--_sds-switch-icon-gap);\n\t\tcolor: var(--_sds-switch-text-color);\n\t\tfont-size: var(--_sds-switch-font-size);\n\t\tfont-weight: var(--_sds-switch-font-weight);\n\t\tline-height: var(--_sds-switch-line-height);\n\t}\n\n\t.sds-switch__label--hidden:not(:focus):not(:active):not(:focus-within) {\n\t\tclip-path: inset(50%);\n\t\theight: 1px;\n\t\toverflow: hidden;\n\t\tposition: absolute;\n\t\twhite-space: nowrap;\n\t\twidth: 1px;\n\t}\n\n\t.sds-switch__input {\n\t\tappearance: none;\n\t\tposition: relative;\n\t\tcursor: pointer;\n\t\tuser-select: none;\n\t\tmargin: 0;\n\n\t\twidth: var(--_sds-switch-width);\n\t\theight: var(--_sds-switch-height);\n\n\t\tbackground-color: var(--_sds-switch-background-color);\n\t\tborder: var(--_sds-switch-border-width) solid var(--_sds-switch-border-color);\n\t\tborder-radius: var(--_sds-switch-border-radius);\n\n\t\ttransition: background-color var(--_sds-switch-transition-time) ease;\n\t}\n\n\t.sds-switch__input::before {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\ttop: 50%;\n\t\ttransform: translateY(-50%) translateX(var(--_sds-switch-button-position));\n\n\t\twidth: var(--_sds-switch-button-size);\n\t\theight: var(--_sds-switch-button-size);\n\n\t\tbackground-color: var(--_sds-switch-button-color);\n\t\tborder-radius: var(--_sds-switch-button-radius);\n\n\t\ttransition:\n\t\t\ttransform var(--_sds-switch-transition-time) ease,\n\t\t\tbackground-color var(--_sds-switch-transition-time) ease;\n\t}\n\n\t.sds-switch__input:focus-visible {\n\t\tbox-shadow: 0 0 0 var(--sds-color-states-focus-spacing) var(--_sds-switch-focus-inner-color);\n\t\toutline: var(--_sds-switch-focus-outline-width) solid var(--_sds-switch-focus-outline-color);\n\t\toutline-offset: var(--_sds-switch-focus-outline-offset);\n\t}\n\n\t.sds-switch__input:checked:not([readonly]) {\n\t\t--_sds-switch-border-color: var(--sds-switch-border-color, var(--sds-color-main-action-default));\n\t\t--_sds-switch-background-color: var(--sds-switch-background-color-checked, var(--sds-color-main-action-default));\n\t\t--_sds-switch-button-color: var(--sds-switch-button-color, var(--sds-color-neutral-surface-default));\n\t}\n\n\t.sds-switch__input:checked::before {\n\t\t--_sds-switch-button-position: calc(var(--_sds-switch-width) - var(--_sds-switch-button-size) - var(--_sds-switch-button-gap) - var(--_sds-switch-border-width));\n\t}\n`;\n"]}
1
+ {"version":3,"file":"sds-switch.styles.js","sourceRoot":"","sources":["../../src/sds-switch/sds-switch.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsJxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t:host {\n\t\t--_sds-switch-background-color: var(--sds-switch-background-color, var(--sds-color-surface-default, var(--sds-color-neutral-surface-default)));\n\t\t--_sds-switch-text-color: var(--sds-switch-text-color, var(--sds-color-text-default, var(--sds-color-neutral-text-default)));\n\n\t\t--_sds-switch-transition-time: var(--sds-switch-transition-time, 200ms);\n\n\t\t--_sds-switch-border-color: var(--sds-switch-border-color, var(--sds-color-border-default, var(--sds-color-neutral-border-default)));\n\t\t--_sds-switch-border-width: var(--sds-switch-border-width, var(--sds-border-md));\n\t\t--_sds-switch-border-radius: var(--sds-switch-border-radius, var(--sds-radius-full));\n\n\t\t--_sds-switch-font-family: var(--sds-switch-font-family, var(--sds-typography-font-family-roboto));\n\t\t--_sds-switch-font-size: var(--sds-switch-font-size, var(--sds-components-font-size-content-md));\n\t\t--_sds-switch-font-weight: var(--sds-switch-font-weight, var(--sds-typography-font-weight-regular));\n\t\t--_sds-switch-line-height: var(--sds-switch-line-height, var(--sds-components-line-height-tall-content-md));\n\n\t\t--_sds-switch-gap: var(--sds-switch-gap, var(--sds-spacing-3xs));\n\t\t--_sds-switch-icon-gap: var(--sds-switch-icon-gap, var(--sds-spacing-4xs));\n\t\t--_sds-switch-width: var(--sds-switch-width, var(--sds-components-switch-length-md));\n\t\t--_sds-switch-height: var(--sds-switch-height, var(--sds-components-icon-md));\n\n\t\t--_sds-switch-button-color: var(--sds-switch-button-color, var(--sds-color-neutral-text-default));\n\t\t--_sds-switch-button-size: var(--sds-switch-button-size, var(--sds-components-switch-bulleye-md));\n\t\t--_sds-switch-button-gap: var(--sds-switch-button-gap, var(--sds-spacing-4xs));\n\t\t--_sds-switch-button-position: var(--sds-switch-button-position, calc(var(--_sds-switch-button-gap) - var(--_sds-switch-border-width)));\n\t\t--_sds-switch-button-radius: var(--sds-switch-button-radius, var(--sds-radius-full));\n\n\t\t--_sds-switch-focus-outline-width: var(--sds-switch-focus-outline-width, var(--sds-border-md));\n\t\t--_sds-switch-focus-outline-color: var(--sds-switch-focus-outline-color, var(--sds-color-states-focus-outer));\n\t\t--_sds-switch-focus-outline-offset: var(--sds-switch-focus-outline-offset, var(--sds-color-states-focus-spacing));\n\t\t--_sds-switch-focus-inner-color: var(--sds-switch-focus-inner-color, var(--sds-color-states-focus-inner));\n\n\t\t--_sds-switch-disabled-opacity: var(--sds-switch-disabled-opacity, var(--sds-color-states-disabled-opacity));\n\n\t\tbox-sizing: border-box;\n\t}\n\n\t:host([hidden]) {\n\t\tdisplay: none;\n\t}\n\n\t:host([readonly]) {\n\t\t--_sds-switch-background-color: var(--sds-switch-background-color, var(--sds-color-neutral-surface-tinted));\n\t\t--_sds-switch-button-color: var(--sds-switch-button-color, var(--sds-color-neutral-text-default));\n\t\t--_sds-switch-border-color: var(--sds-switch-border-color, var(--sds-color-neutral-border-subtle));\n\t\tcursor: default;\n\t\tpointer-events: none;\n\t}\n\n\t:host(:disabled) {\n\t\topacity: var(--_sds-switch-disabled-opacity);\n\t\tpointer-events: none;\n\t}\n\n\t:host([size='s']),\n\t:host([size='sm']) {\n\t\t--_sds-switch-width: var(--sds-switch-width, var(--sds-components-switch-length-sm));\n\t\t--_sds-switch-height: var(--sds-switch-height, var(--sds-components-icon-sm));\n\t\t--_sds-switch-button-size: var(--sds-switch-button-size, var(--sds-components-switch-bulleye-sm));\n\t\t--_sds-switch-font-size: var(--sds-switch-font-size, var(--sds-components-font-size-content-sm));\n\t\t--_sds-switch-line-height: var(--sds-switch-line-height, var(--sds-components-line-height-tall-content-sm));\n\t}\n\n\t:host([size='l']),\n\t:host([size='lg']) {\n\t\t--_sds-switch-width: var(--sds-switch-width, var(--sds-components-switch-length-lg));\n\t\t--_sds-switch-height: var(--sds-switch-height, var(--sds-components-icon-lg));\n\t\t--_sds-switch-button-size: var(--sds-switch-button-size, var(--sds-components-switch-bulleye-lg));\n\t\t--_sds-switch-font-size: var(--sds-switch-font-size, var(--sds-components-font-size-content-lg));\n\t\t--_sds-switch-line-height: var(--sds-switch-line-height, var(--sds-components-line-height-tall-content-lg));\n\t}\n\n\t.sds-switch {\n\t\tdisplay: flex;\n\t\tflex-direction: row;\n\t\talign-items: center;\n\t\tgap: var(--_sds-switch-gap);\n\t\tfont-family: var(--_sds-switch-font-family);\n\t}\n\n\t.sds-switch__label {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tcursor: pointer;\n\t\tuser-select: none;\n\t\tgap: var(--_sds-switch-icon-gap);\n\t\tcolor: var(--_sds-switch-text-color);\n\t\tfont-size: var(--_sds-switch-font-size);\n\t\tfont-weight: var(--_sds-switch-font-weight);\n\t\tline-height: var(--_sds-switch-line-height);\n\t}\n\n\t.sds-switch__label--hidden:not(:focus):not(:active):not(:focus-within) {\n\t\tclip-path: inset(50%);\n\t\theight: 1px;\n\t\toverflow: hidden;\n\t\tposition: absolute;\n\t\twhite-space: nowrap;\n\t\twidth: 1px;\n\t}\n\n\t.sds-switch__input {\n\t\tappearance: none;\n\t\tposition: relative;\n\t\tcursor: pointer;\n\t\tuser-select: none;\n\t\tmargin: 0;\n\n\t\twidth: var(--_sds-switch-width);\n\t\theight: var(--_sds-switch-height);\n\n\t\tbackground-color: var(--_sds-switch-background-color);\n\t\tborder: var(--_sds-switch-border-width) solid var(--_sds-switch-border-color);\n\t\tborder-radius: var(--_sds-switch-border-radius);\n\n\t\ttransition: background-color var(--_sds-switch-transition-time) ease;\n\t}\n\n\t.sds-switch__input::before {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\ttop: 50%;\n\t\ttransform: translateY(-50%) translateX(var(--_sds-switch-button-position));\n\n\t\twidth: var(--_sds-switch-button-size);\n\t\theight: var(--_sds-switch-button-size);\n\n\t\tbackground-color: var(--_sds-switch-button-color);\n\t\tborder-radius: var(--_sds-switch-button-radius);\n\n\t\ttransition:\n\t\t\ttransform var(--_sds-switch-transition-time) ease,\n\t\t\tbackground-color var(--_sds-switch-transition-time) ease;\n\t}\n\n\t.sds-switch__input:focus-visible {\n\t\tbox-shadow: 0 0 0 var(--sds-color-states-focus-spacing) var(--_sds-switch-focus-inner-color);\n\t\toutline: var(--_sds-switch-focus-outline-width) solid var(--_sds-switch-focus-outline-color);\n\t\toutline-offset: var(--_sds-switch-focus-outline-offset);\n\t}\n\n\t.sds-switch__input:checked:not([readonly]) {\n\t\t--_sds-switch-border-color: var(--sds-switch-border-color, var(--sds-color-main-action-default));\n\t\t--_sds-switch-background-color: var(--sds-switch-background-color-checked, var(--sds-color-main-action-default));\n\t\t--_sds-switch-button-color: var(--sds-switch-button-color, var(--sds-color-neutral-surface-default));\n\t}\n\n\t.sds-switch__input:checked::before {\n\t\t--_sds-switch-button-position: calc(var(--_sds-switch-width) - var(--_sds-switch-button-size) - var(--_sds-switch-button-gap) - var(--_sds-switch-border-width));\n\t}\n`;\n"]}
@@ -1,38 +1,33 @@
1
1
  import { LitElement } from 'lit';
2
+ import type { SDSFormControlProps } from '../mixins/sds-form-control-mixin';
2
3
  import '../sds-alert/sds-alert';
3
4
  import '../sds-icon/sds-icon';
4
5
  import { SDS_SIZES } from '../types';
5
6
  type InputSize = Extract<SDS_SIZES, 'lg' | 'md' | 'sm'>;
6
- export interface SDSTextAreaProps {
7
- value?: string;
8
- name?: string;
7
+ export interface SDSTextAreaProps extends SDSFormControlProps {
8
+ autocomplete?: HTMLTextAreaElement['autocomplete'];
9
+ cols?: number;
10
+ counter?: number;
11
+ 'error-message'?: string;
12
+ 'help-text'?: string;
9
13
  label?: string;
14
+ maxlength?: number;
15
+ minlength?: number;
10
16
  placeholder?: string;
11
- 'help-text'?: string;
12
- 'error-message'?: string;
13
- disabled?: boolean;
14
- readonly?: boolean;
15
- autocomplete?: HTMLTextAreaElement['autocomplete'];
16
17
  required?: boolean;
17
18
  rows?: number;
18
- cols?: number;
19
- wrap?: 'hard' | 'soft';
20
- minlength?: number;
21
- maxlength?: number;
22
- counter?: number;
23
19
  size?: InputSize;
20
+ value?: string;
21
+ wrap?: 'hard' | 'soft';
24
22
  }
25
- declare const SDSTextArea_base: import("../mixins/types").Constructable<import("../mixins/sds-delegate-interaction-mixin").DelegateInteractionMixinInterface> & import("../mixins/types").Constructable<import("../mixins/sds-event-dispatcher-mixin").SDSEventDispatcherMixinInterface> & typeof LitElement;
23
+ declare const SDSTextArea_base: import("../mixins/types").Constructable<import("../mixins/sds-delegate-interaction-mixin").DelegateInteractionMixinInterface> & import("../mixins/types").Constructable<import("../mixins/sds-event-dispatcher-mixin").SDSEventDispatcherMixinInterface> & import("../mixins/types").Constructable<import("../mixins/sds-form-control-mixin").SDSFormControlMixinInterface> & typeof LitElement;
26
24
  export declare class SDSTextArea extends SDSTextArea_base {
27
25
  static styles: import("lit").CSSResult[];
28
26
  value?: string;
29
- name?: SDSTextAreaProps['name'];
30
27
  label?: SDSTextAreaProps['label'];
31
28
  placeholder?: SDSTextAreaProps['placeholder'];
32
29
  helpText?: SDSTextAreaProps['help-text'];
33
30
  errorMessage?: SDSTextAreaProps['error-message'];
34
- disabled: SDSTextAreaProps['disabled'];
35
- readOnly: SDSTextAreaProps['readonly'];
36
31
  autocomplete?: SDSTextAreaProps['autocomplete'];
37
32
  required: SDSTextAreaProps['required'];
38
33
  rows?: SDSTextAreaProps['rows'];
@@ -43,11 +38,7 @@ export declare class SDSTextArea extends SDSTextArea_base {
43
38
  counter?: SDSTextAreaProps['counter'];
44
39
  size: SDSTextAreaProps['size'];
45
40
  control: HTMLTextAreaElement;
46
- static formAssociated: boolean;
47
- readonly internals: ElementInternals;
48
- static shadowRootOptions: ShadowRootInit;
49
41
  private _defaultValue;
50
- constructor();
51
42
  connectedCallback(): void;
52
43
  updated(changedProperties: Map<string | number | symbol, unknown>): void;
53
44
  private updateValidity;
@@ -1 +1 @@
1
- {"version":3,"file":"sds-textarea.d.ts","sourceRoot":"","sources":["../../src/sds-textarea/sds-textarea.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAC;AAQhD,OAAO,wBAAwB,CAAC;AAChC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,KAAK,SAAS,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AACxD,MAAM,WAAW,gBAAgB;IAChC,KAAK,CAAC,EAAE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,CAK5B;IAEF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAG3B;IAEF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAI1B;IAEF,iBAAiB;IASjB,MAAM,IAAI,IAAI;IAId,IAAI,IAAI,MAAM;IAId,IAAI,cAAc,IAAI,MAAM,GAAG,IAAI,CAElC;IAED,IAAI,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAItC;IAED,IAAI,YAAY,IAAI,MAAM,GAAG,IAAI,CAEhC;IACD,IAAI,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAIpC;IAED,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI;IAMhG,aAAa,IAAI,OAAO;IAIxB,cAAc,IAAI,OAAO;IAIzB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK/B,MAAM;CAyCf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,cAAc,EAAE,WAAW,CAAC;KAC5B;CACD"}
@@ -10,14 +10,12 @@ import { classMap } from 'lit/directives/class-map.js';
10
10
  import { ifDefined } from 'lit/directives/if-defined.js';
11
11
  import { guardedCustomElement } from '../utils/guarded-custom-element';
12
12
  import { styles } from './sds-textarea.styles';
13
- import { SDSDelegateInteractionMixin, SDSEventDispatcherMixin } from '../mixins';
13
+ import { SDSDelegateInteractionMixin, SDSEventDispatcherMixin, SDSFormControlMixin } from '../mixins';
14
14
  import '../sds-alert/sds-alert';
15
15
  import '../sds-icon/sds-icon';
16
- let SDSTextArea = class SDSTextArea extends SDSDelegateInteractionMixin(SDSEventDispatcherMixin(LitElement)) {
16
+ let SDSTextArea = class SDSTextArea extends SDSDelegateInteractionMixin(SDSEventDispatcherMixin(SDSFormControlMixin(LitElement))) {
17
17
  constructor() {
18
- super();
19
- this.disabled = false;
20
- this.readOnly = false;
18
+ super(...arguments);
21
19
  this.required = false;
22
20
  this.size = 'md';
23
21
  this._defaultValue = null;
@@ -46,7 +44,6 @@ let SDSTextArea = class SDSTextArea extends SDSDelegateInteractionMixin(SDSEvent
46
44
  this.updateValidity();
47
45
  this.dispatchSheriffEvent('blur');
48
46
  };
49
- this.internals = this.attachInternals();
50
47
  }
51
48
  connectedCallback() {
52
49
  super.connectedCallback();
@@ -176,17 +173,9 @@ let SDSTextArea = class SDSTextArea extends SDSDelegateInteractionMixin(SDSEvent
176
173
  };
177
174
  // Styling
178
175
  SDSTextArea.styles = [styles];
179
- SDSTextArea.formAssociated = true;
180
- SDSTextArea.shadowRootOptions = {
181
- ...LitElement.shadowRootOptions,
182
- delegatesFocus: true,
183
- };
184
176
  __decorate([
185
177
  property({ type: String })
186
178
  ], SDSTextArea.prototype, "value", void 0);
187
- __decorate([
188
- property({ type: String, reflect: true })
189
- ], SDSTextArea.prototype, "name", void 0);
190
179
  __decorate([
191
180
  property({ type: String, reflect: true })
192
181
  ], SDSTextArea.prototype, "label", void 0);
@@ -199,12 +188,6 @@ __decorate([
199
188
  __decorate([
200
189
  property({ type: String, attribute: 'error-message', reflect: true })
201
190
  ], SDSTextArea.prototype, "errorMessage", void 0);
202
- __decorate([
203
- property({ type: Boolean, reflect: true })
204
- ], SDSTextArea.prototype, "disabled", void 0);
205
- __decorate([
206
- property({ type: Boolean, attribute: 'readonly', reflect: true })
207
- ], SDSTextArea.prototype, "readOnly", void 0);
208
191
  __decorate([
209
192
  property({ type: String, reflect: true })
210
193
  ], SDSTextArea.prototype, "autocomplete", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"sds-textarea.js","sourceRoot":"","sources":["../../src/sds-textarea/sds-textarea.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;A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AAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAiC;AAChC;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAiC;AAChC;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAiC;AAChC;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAA2C;AAC1C;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAA2C;AAC1C;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAAuC;AACtC;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAuC;AAEzD;IAAvB,KAAK,CAAC,eAAe,CAAC;4CAA+B;AAtB1C,WAAW;IADvB,oBAAoB,CAAC,cAAc,CAAC;GACxB,WAAW,CAoNvB","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { guardedCustomElement } from '../utils/guarded-custom-element';\nimport { styles } from './sds-textarea.styles';\nimport { SDSDelegateInteractionMixin, SDSEventDispatcherMixin } from '../mixins';\n\nimport '../sds-alert/sds-alert';\nimport '../sds-icon/sds-icon';\nimport { SDS_SIZES } from '../types';\n\ntype InputSize = Extract<SDS_SIZES, 'lg' | 'md' | 'sm'>;\nexport interface SDSTextAreaProps {\n\tvalue?: string;\n\tname?: string;\n\tlabel?: string;\n\tplaceholder?: string;\n\t'help-text'?: string;\n\t'error-message'?: string;\n\tdisabled?: boolean;\n\treadonly?: boolean;\n\tautocomplete?: HTMLTextAreaElement['autocomplete'];\n\trequired?: boolean;\n\trows?: number;\n\tcols?: number;\n\twrap?: 'hard' | 'soft';\n\tminlength?: number;\n\tmaxlength?: number;\n\tcounter?: number;\n\tsize?: InputSize;\n}\n\n@guardedCustomElement('sds-textarea')\nexport class SDSTextArea extends SDSDelegateInteractionMixin(SDSEventDispatcherMixin(LitElement)) {\n\t// Styling\n\tstatic override styles = [styles];\n\n\t@property({ type: String }) value?: string;\n\t@property({ type: String, reflect: true }) name?: SDSTextAreaProps['name'];\n\t@property({ type: String, reflect: true }) label?: SDSTextAreaProps['label'];\n\t@property({ type: String, reflect: true }) placeholder?: SDSTextAreaProps['placeholder'];\n\t@property({ type: String, attribute: 'help-text', reflect: true }) helpText?: SDSTextAreaProps['help-text'];\n\t@property({ type: String, attribute: 'error-message', reflect: true }) errorMessage?: SDSTextAreaProps['error-message'];\n\t@property({ type: Boolean, reflect: true }) disabled: SDSTextAreaProps['disabled'] = false;\n\t@property({ type: Boolean, attribute: 'readonly', reflect: true }) readOnly: SDSTextAreaProps['readonly'] = false;\n\t@property({ type: String, reflect: true }) autocomplete?: SDSTextAreaProps['autocomplete'];\n\t@property({ type: Boolean, reflect: true }) required: SDSTextAreaProps['required'] = false;\n\t@property({ type: Number, reflect: true }) rows?: SDSTextAreaProps['rows'];\n\t@property({ type: Number, reflect: true }) cols?: SDSTextAreaProps['cols'];\n\t@property({ type: String, reflect: true }) wrap?: SDSTextAreaProps['wrap'];\n\t@property({ type: Number, reflect: true }) minlength?: SDSTextAreaProps['minlength'];\n\t@property({ type: Number, reflect: true }) maxlength?: SDSTextAreaProps['maxlength'];\n\t@property({ type: Number, reflect: true }) counter?: SDSTextAreaProps['counter'];\n\t@property({ type: String, reflect: true }) size: SDSTextAreaProps['size'] = 'md';\n\n\t@query('#sds-textarea') control!: HTMLTextAreaElement;\n\n\tstatic formAssociated = true;\n\tpublic readonly internals: ElementInternals;\n\n\tstatic override shadowRootOptions: ShadowRootInit = {\n\t\t...LitElement.shadowRootOptions,\n\t\tdelegatesFocus: true,\n\t};\n\n\tprivate _defaultValue: string | null = null;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.internals = this.attachInternals();\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback();\n\t\tthis._defaultValue = this.value ?? null;\n\t\tthis.internals.setFormValue(this._defaultValue);\n\t}\n\n\toverride updated(changedProperties: Map<string | number | symbol, unknown>) {\n\t\tsuper.updated(changedProperties);\n\n\t\tif (changedProperties.has('value')) {\n\t\t\tthis.internals.setFormValue(this.value ?? '');\n\n\t\t\tif (this.control) {\n\t\t\t\tthis.control.value = this.value ?? '';\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate updateValidity() {\n\t\tif (this.control.checkValidity()) {\n\t\t\tthis.internals.setValidity({});\n\t\t} else {\n\t\t\tthis.internals.setValidity({ customError: true }, this.control.validationMessage, this.control);\n\t\t}\n\t}\n\n\tprivate hasTypedTooManyCharacters() {\n\t\tif (!this.counter) {\n\t\t\treturn false;\n\t\t}\n\t\tconst currentLength = this.value?.length || 0;\n\t\treturn currentLength > this.counter;\n\t}\n\n\tprivate renderCharacterCounter() {\n\t\tif (this.counter === undefined) return nothing;\n\n\t\tconst currentLength = this.value?.length || 0;\n\t\tif (this.hasTypedTooManyCharacters()) {\n\t\t\treturn html`<sds-alert variant=\"secondary\" data-palette=\"danger\"\n\t\t\t\t><p class=\"sds-textarea__character-counter\" slot=\"message\">Du har ${currentLength - this.counter} tegn for mye</p></sds-alert\n\t\t\t>`;\n\t\t}\n\n\t\treturn html`<p class=\"sds-textarea__character-counter\">Du har ${this.counter - currentLength} tegn igjen</p>`;\n\t}\n\n\tprivate readonly _handleInputChange = (event: InputEvent) => {\n\t\tevent.stopImmediatePropagation();\n\t\tif (this.disabled || !(event.target instanceof HTMLTextAreaElement)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.value = event.target.value;\n\t\tthis.internals.setFormValue(this.value === '' ? null : this.value);\n\t\tthis.updateValidity();\n\t\tthis.dispatchSheriffEvent(event.type);\n\t};\n\n\tprivate readonly _handleSelect = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tif (!this.disabled) {\n\t\t\tthis.dispatchSheriffEvent('select');\n\t\t}\n\t};\n\n\tprivate readonly _handleFocus = (event: FocusEvent) => {\n\t\tevent.stopImmediatePropagation();\n\t\tthis.dispatchSheriffEvent('focus');\n\t};\n\n\tprivate readonly _handleBlur = (event: FocusEvent) => {\n\t\tevent.stopImmediatePropagation();\n\t\tthis.updateValidity();\n\t\tthis.dispatchSheriffEvent('blur');\n\t};\n\n\tformResetCallback() {\n\t\tthis.internals.setFormValue(this._defaultValue);\n\n\t\tconst newValue = this._defaultValue ?? '';\n\t\tthis.control.value = newValue;\n\t\tthis.value = newValue;\n\t\tthis.updateValidity();\n\t}\n\n\tselect(): void {\n\t\tif (!this.disabled) this.control.select();\n\t}\n\n\ttype(): string {\n\t\treturn 'textarea';\n\t}\n\n\tget selectionStart(): number | null {\n\t\treturn this.control ? this.control.selectionStart : null;\n\t}\n\n\tset selectionStart(value: number | null) {\n\t\tif (this.control && value !== null) {\n\t\t\tthis.control.selectionStart = value;\n\t\t}\n\t}\n\n\tget selectionEnd(): number | null {\n\t\treturn this.control ? this.control.selectionEnd : null;\n\t}\n\tset selectionEnd(value: number | null) {\n\t\tif (this.control && value !== null) {\n\t\t\tthis.control.selectionEnd = value;\n\t\t}\n\t}\n\n\tsetSelectionRange(start: number, end: number, direction?: 'forward' | 'backward' | 'none'): void {\n\t\tif (this.control) {\n\t\t\tthis.control.setSelectionRange(start, end, direction);\n\t\t}\n\t}\n\n\tcheckValidity(): boolean {\n\t\treturn this.control.checkValidity();\n\t}\n\n\treportValidity(): boolean {\n\t\treturn this.control.reportValidity();\n\t}\n\n\tsetCustomValidity(message: string): void {\n\t\tthis.control.setCustomValidity(message);\n\t\tthis.updateValidity();\n\t}\n\n\toverride render() {\n\t\tconst textareaClasses = {\n\t\t\t'sds-textarea': true,\n\t\t\t'sds-textarea--error': Boolean(this.errorMessage || this.hasTypedTooManyCharacters()),\n\t\t};\n\n\t\treturn html`\n\t\t\t<div class=\"${classMap(textareaClasses)}\">\n\t\t\t\t${this.label || this.helpText\n\t\t\t\t\t? html`<div>\n\t\t\t\t\t\t\t${this.label ? html`<label for=\"sds-textarea\" class=\"sds-textarea__label\">${this.label}</label>` : nothing}\n\t\t\t\t\t\t\t${this.helpText ? html`<p class=\"sds-textarea__help-text\">${this.helpText}</p>` : nothing}\n\t\t\t\t\t\t</div>`\n\t\t\t\t\t: nothing}\n\t\t\t\t<div class=\"sds-textarea__input-container\">\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tclass=\"sds-textarea__input\"\n\t\t\t\t\t\tid=\"sds-textarea\"\n\t\t\t\t\t\t?disabled=\"${this.disabled}\"\n\t\t\t\t\t\t?readonly=\"${this.readOnly}\"\n\t\t\t\t\t\tplaceholder=\"${ifDefined(this.placeholder)}\"\n\t\t\t\t\t\t.value=\"${this.value ?? ''}\"\n\t\t\t\t\t\t.autocomplete=\"${this.autocomplete}\"\n\t\t\t\t\t\tname=\"${ifDefined(this.name)}\"\n\t\t\t\t\t\t?required=\"${this.required}\"\n\t\t\t\t\t\trows=\"${ifDefined(this.rows)}\"\n\t\t\t\t\t\tcols=\"${ifDefined(this.cols)}\"\n\t\t\t\t\t\twrap=\"${ifDefined(this.wrap)}\"\n\t\t\t\t\t\tminlength=\"${ifDefined(this.minlength)}\"\n\t\t\t\t\t\tmaxlength=\"${ifDefined(this.maxlength)}\"\n\t\t\t\t\t\t@input=\"${this._handleInputChange}\"\n\t\t\t\t\t\t@change=\"${this._handleInputChange}\"\n\t\t\t\t\t\t@select=\"${this._handleSelect}\"\n\t\t\t\t\t\t@focus=\"${this._handleFocus}\"\n\t\t\t\t\t\t@blur=\"${this._handleBlur}\"\n\t\t\t\t\t></textarea>\n\t\t\t\t</div>\n\t\t\t\t${this.errorMessage ? html`<sds-alert variant=\"secondary\" data-palette=\"danger\"><p slot=\"message\">${this.errorMessage}</p></sds-alert>` : nothing} ${this.renderCharacterCounter()}\n\t\t\t</div>\n\t\t`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-textarea': SDSTextArea;\n\t}\n}\n"]}
1
+ {"version":3,"file":"sds-textarea.js","sourceRoot":"","sources":["../../src/sds-textarea/sds-textarea.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGtG,OAAO,wBAAwB,CAAC;AAChC,OAAO,sBAAsB,CAAC;AAuBvB,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,2BAA2B,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC;IAA/G;;QAUsC,aAAQ,GAAiC,KAAK,CAAC;QAOhD,SAAI,GAA6B,IAAI,CAAC;QAIzE,kBAAa,GAAkB,IAAI,CAAC;QAiD3B,uBAAkB,GAAG,CAAC,KAAiB,EAAE,EAAE;YAC3D,KAAK,CAAC,wBAAwB,EAAE,CAAC;YACjC,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,YAAY,mBAAmB,CAAC,EAAE,CAAC;gBACrE,OAAO;YACR,CAAC;YAED,IAAI,CAAC,KAAK,GAAG,KAAK,C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AAI,EAAE,CAAC;yCAAiC;AAChC;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAiC;AAChC;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAA2C;AAC1C;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAA2C;AAC1C;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAAuC;AACtC;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAuC;AAEzD;IAAvB,KAAK,CAAC,eAAe,CAAC;4CAA+B;AAnB1C,WAAW;IADvB,oBAAoB,CAAC,cAAc,CAAC;GACxB,WAAW,CAoMvB","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { guardedCustomElement } from '../utils/guarded-custom-element';\nimport { styles } from './sds-textarea.styles';\nimport { SDSDelegateInteractionMixin, SDSEventDispatcherMixin, SDSFormControlMixin } from '../mixins';\nimport type { SDSFormControlProps } from '../mixins/sds-form-control-mixin';\n\nimport '../sds-alert/sds-alert';\nimport '../sds-icon/sds-icon';\nimport { SDS_SIZES } from '../types';\n\ntype InputSize = Extract<SDS_SIZES, 'lg' | 'md' | 'sm'>;\n\nexport interface SDSTextAreaProps extends SDSFormControlProps {\n\tautocomplete?: HTMLTextAreaElement['autocomplete'];\n\tcols?: number;\n\tcounter?: number;\n\t'error-message'?: string;\n\t'help-text'?: string;\n\tlabel?: string;\n\tmaxlength?: number;\n\tminlength?: number;\n\tplaceholder?: string;\n\trequired?: boolean;\n\trows?: number;\n\tsize?: InputSize;\n\tvalue?: string;\n\twrap?: 'hard' | 'soft';\n}\n\n@guardedCustomElement('sds-textarea')\nexport class SDSTextArea extends SDSDelegateInteractionMixin(SDSEventDispatcherMixin(SDSFormControlMixin(LitElement))) {\n\t// Styling\n\tstatic override styles = [styles];\n\n\t@property({ type: String }) value?: string;\n\t@property({ type: String, reflect: true }) label?: SDSTextAreaProps['label'];\n\t@property({ type: String, reflect: true }) placeholder?: SDSTextAreaProps['placeholder'];\n\t@property({ type: String, attribute: 'help-text', reflect: true }) helpText?: SDSTextAreaProps['help-text'];\n\t@property({ type: String, attribute: 'error-message', reflect: true }) errorMessage?: SDSTextAreaProps['error-message'];\n\t@property({ type: String, reflect: true }) autocomplete?: SDSTextAreaProps['autocomplete'];\n\t@property({ type: Boolean, reflect: true }) required: SDSTextAreaProps['required'] = false;\n\t@property({ type: Number, reflect: true }) rows?: SDSTextAreaProps['rows'];\n\t@property({ type: Number, reflect: true }) cols?: SDSTextAreaProps['cols'];\n\t@property({ type: String, reflect: true }) wrap?: SDSTextAreaProps['wrap'];\n\t@property({ type: Number, reflect: true }) minlength?: SDSTextAreaProps['minlength'];\n\t@property({ type: Number, reflect: true }) maxlength?: SDSTextAreaProps['maxlength'];\n\t@property({ type: Number, reflect: true }) counter?: SDSTextAreaProps['counter'];\n\t@property({ type: String, reflect: true }) size: SDSTextAreaProps['size'] = 'md';\n\n\t@query('#sds-textarea') control!: HTMLTextAreaElement;\n\n\tprivate _defaultValue: string | null = null;\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback();\n\t\tthis._defaultValue = this.value ?? null;\n\t\tthis.internals.setFormValue(this._defaultValue);\n\t}\n\n\toverride updated(changedProperties: Map<string | number | symbol, unknown>) {\n\t\tsuper.updated(changedProperties);\n\n\t\tif (changedProperties.has('value')) {\n\t\t\tthis.internals.setFormValue(this.value ?? '');\n\n\t\t\tif (this.control) {\n\t\t\t\tthis.control.value = this.value ?? '';\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate updateValidity() {\n\t\tif (this.control.checkValidity()) {\n\t\t\tthis.internals.setValidity({});\n\t\t} else {\n\t\t\tthis.internals.setValidity({ customError: true }, this.control.validationMessage, this.control);\n\t\t}\n\t}\n\n\tprivate hasTypedTooManyCharacters() {\n\t\tif (!this.counter) {\n\t\t\treturn false;\n\t\t}\n\t\tconst currentLength = this.value?.length || 0;\n\t\treturn currentLength > this.counter;\n\t}\n\n\tprivate renderCharacterCounter() {\n\t\tif (this.counter === undefined) return nothing;\n\n\t\tconst currentLength = this.value?.length || 0;\n\t\tif (this.hasTypedTooManyCharacters()) {\n\t\t\treturn html`<sds-alert variant=\"secondary\" data-palette=\"danger\"\n\t\t\t\t><p class=\"sds-textarea__character-counter\" slot=\"message\">Du har ${currentLength - this.counter} tegn for mye</p></sds-alert\n\t\t\t>`;\n\t\t}\n\n\t\treturn html`<p class=\"sds-textarea__character-counter\">Du har ${this.counter - currentLength} tegn igjen</p>`;\n\t}\n\n\tprivate readonly _handleInputChange = (event: InputEvent) => {\n\t\tevent.stopImmediatePropagation();\n\t\tif (this.disabled || !(event.target instanceof HTMLTextAreaElement)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.value = event.target.value;\n\t\tthis.internals.setFormValue(this.value === '' ? null : this.value);\n\t\tthis.updateValidity();\n\t\tthis.dispatchSheriffEvent(event.type);\n\t};\n\n\tprivate readonly _handleSelect = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tif (!this.disabled) {\n\t\t\tthis.dispatchSheriffEvent('select');\n\t\t}\n\t};\n\n\tprivate readonly _handleFocus = (event: FocusEvent) => {\n\t\tevent.stopImmediatePropagation();\n\t\tthis.dispatchSheriffEvent('focus');\n\t};\n\n\tprivate readonly _handleBlur = (event: FocusEvent) => {\n\t\tevent.stopImmediatePropagation();\n\t\tthis.updateValidity();\n\t\tthis.dispatchSheriffEvent('blur');\n\t};\n\n\tformResetCallback() {\n\t\tthis.internals.setFormValue(this._defaultValue);\n\n\t\tconst newValue = this._defaultValue ?? '';\n\t\tthis.control.value = newValue;\n\t\tthis.value = newValue;\n\t\tthis.updateValidity();\n\t}\n\n\tselect(): void {\n\t\tif (!this.disabled) this.control.select();\n\t}\n\n\ttype(): string {\n\t\treturn 'textarea';\n\t}\n\n\tget selectionStart(): number | null {\n\t\treturn this.control ? this.control.selectionStart : null;\n\t}\n\n\tset selectionStart(value: number | null) {\n\t\tif (this.control && value !== null) {\n\t\t\tthis.control.selectionStart = value;\n\t\t}\n\t}\n\n\tget selectionEnd(): number | null {\n\t\treturn this.control ? this.control.selectionEnd : null;\n\t}\n\tset selectionEnd(value: number | null) {\n\t\tif (this.control && value !== null) {\n\t\t\tthis.control.selectionEnd = value;\n\t\t}\n\t}\n\n\tsetSelectionRange(start: number, end: number, direction?: 'forward' | 'backward' | 'none'): void {\n\t\tif (this.control) {\n\t\t\tthis.control.setSelectionRange(start, end, direction);\n\t\t}\n\t}\n\n\tcheckValidity(): boolean {\n\t\treturn this.control.checkValidity();\n\t}\n\n\treportValidity(): boolean {\n\t\treturn this.control.reportValidity();\n\t}\n\n\tsetCustomValidity(message: string): void {\n\t\tthis.control.setCustomValidity(message);\n\t\tthis.updateValidity();\n\t}\n\n\toverride render() {\n\t\tconst textareaClasses = {\n\t\t\t'sds-textarea': true,\n\t\t\t'sds-textarea--error': Boolean(this.errorMessage || this.hasTypedTooManyCharacters()),\n\t\t};\n\n\t\treturn html`\n\t\t\t<div class=\"${classMap(textareaClasses)}\">\n\t\t\t\t${this.label || this.helpText\n\t\t\t\t\t? html`<div>\n\t\t\t\t\t\t\t${this.label ? html`<label for=\"sds-textarea\" class=\"sds-textarea__label\">${this.label}</label>` : nothing}\n\t\t\t\t\t\t\t${this.helpText ? html`<p class=\"sds-textarea__help-text\">${this.helpText}</p>` : nothing}\n\t\t\t\t\t\t</div>`\n\t\t\t\t\t: nothing}\n\t\t\t\t<div class=\"sds-textarea__input-container\">\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tclass=\"sds-textarea__input\"\n\t\t\t\t\t\tid=\"sds-textarea\"\n\t\t\t\t\t\t?disabled=\"${this.disabled}\"\n\t\t\t\t\t\t?readonly=\"${this.readOnly}\"\n\t\t\t\t\t\tplaceholder=\"${ifDefined(this.placeholder)}\"\n\t\t\t\t\t\t.value=\"${this.value ?? ''}\"\n\t\t\t\t\t\t.autocomplete=\"${this.autocomplete}\"\n\t\t\t\t\t\tname=\"${ifDefined(this.name)}\"\n\t\t\t\t\t\t?required=\"${this.required}\"\n\t\t\t\t\t\trows=\"${ifDefined(this.rows)}\"\n\t\t\t\t\t\tcols=\"${ifDefined(this.cols)}\"\n\t\t\t\t\t\twrap=\"${ifDefined(this.wrap)}\"\n\t\t\t\t\t\tminlength=\"${ifDefined(this.minlength)}\"\n\t\t\t\t\t\tmaxlength=\"${ifDefined(this.maxlength)}\"\n\t\t\t\t\t\t@input=\"${this._handleInputChange}\"\n\t\t\t\t\t\t@change=\"${this._handleInputChange}\"\n\t\t\t\t\t\t@select=\"${this._handleSelect}\"\n\t\t\t\t\t\t@focus=\"${this._handleFocus}\"\n\t\t\t\t\t\t@blur=\"${this._handleBlur}\"\n\t\t\t\t\t></textarea>\n\t\t\t\t</div>\n\t\t\t\t${this.errorMessage ? html`<sds-alert variant=\"secondary\" data-palette=\"danger\"><p slot=\"message\">${this.errorMessage}</p></sds-alert>` : nothing} ${this.renderCharacterCounter()}\n\t\t\t</div>\n\t\t`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-textarea': SDSTextArea;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sds-textarea.styles.d.ts","sourceRoot":"","sources":["../../src/sds-textarea/sds-textarea.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAwLlB,CAAC"}
1
+ {"version":3,"file":"sds-textarea.styles.d.ts","sourceRoot":"","sources":["../../src/sds-textarea/sds-textarea.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBA2LlB,CAAC"}