@ids-group-ltd/ids-design-system 0.15.0 → 0.15.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 (187) hide show
  1. package/CHANGELOG.md +430 -0
  2. package/components.md +68 -37
  3. package/docs/agent/INDEX.md +3 -3
  4. package/docs/agent/charts/column-series-component.md +1 -1
  5. package/docs/agent/charts/ds-chart.md +1 -1
  6. package/docs/agent/charts/ds-column-chart.md +2 -1
  7. package/docs/agent/charts/ds-heatmap-chart.md +2 -1
  8. package/docs/agent/charts/ds-line-chart.md +3 -3
  9. package/docs/agent/charts/ds-pie-chart.md +3 -2
  10. package/docs/agent/charts/ds-scatter-chart.md +2 -1
  11. package/docs/agent/charts/ds-waterfall-chart.md +1 -1
  12. package/docs/agent/charts/line-series-component.md +1 -1
  13. package/docs/agent/feedback/ds-alert.md +1 -0
  14. package/docs/agent/feedback/ds-banner.md +1 -0
  15. package/docs/agent/feedback/ds-toast.md +2 -0
  16. package/docs/agent/forms/ds-autocomplete.md +1 -1
  17. package/docs/agent/forms/ds-button.md +1 -0
  18. package/docs/agent/forms/ds-checkbox.md +1 -1
  19. package/docs/agent/forms/ds-color-picker.md +1 -1
  20. package/docs/agent/forms/ds-date-picker.md +1 -1
  21. package/docs/agent/forms/ds-icon-button.md +1 -1
  22. package/docs/agent/forms/ds-input.md +1 -1
  23. package/docs/agent/forms/ds-multi-select.md +1 -1
  24. package/docs/agent/forms/ds-otp-input.md +1 -1
  25. package/docs/agent/forms/ds-radio-group.md +1 -1
  26. package/docs/agent/forms/ds-segmented.md +1 -1
  27. package/docs/agent/forms/ds-select.md +1 -1
  28. package/docs/agent/forms/ds-slider.md +1 -1
  29. package/docs/agent/forms/ds-switch.md +1 -1
  30. package/docs/agent/forms/ds-textarea.md +1 -1
  31. package/docs/agent/forms/ds-time-picker.md +1 -1
  32. package/docs/agent/forms/the-picker-family-ds-select-ds-multi-select-ds-autocomplete.md +1 -1
  33. package/docs/agent/foundations/global-helper-classes.md +1 -1
  34. package/docs/agent/foundations/tokens.md +1 -1
  35. package/docs/agent/navigation/ds-pagination.md +2 -1
  36. package/docs/agent/overlays/ds-definition-term.md +1 -1
  37. package/docs/agent/overlays/ds-info-hint.md +21 -2
  38. package/docs/agent/overlays/ds-tooltip-panel.md +1 -1
  39. package/docs/agent/overlays/ds-tooltip.md +1 -1
  40. package/docs/agent/tables/ds-table-columns.md +2 -0
  41. package/docs/agent/tables/ds-table.md +2 -1
  42. package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs +6 -3
  43. package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs.map +1 -1
  44. package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +10 -4
  45. package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -1
  46. package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs +6 -3
  47. package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs.map +1 -1
  48. package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs +2 -2
  49. package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs.map +1 -1
  50. package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +8 -9
  51. package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -1
  52. package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs +7 -17
  53. package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs.map +1 -1
  54. package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs +694 -77
  55. package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs.map +1 -1
  56. package/fesm2022/ids-group-ltd-ids-design-system-components-chart.mjs +2183 -1235
  57. package/fesm2022/ids-group-ltd-ids-design-system-components-chart.mjs.map +1 -1
  58. package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs +10 -5
  59. package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs.map +1 -1
  60. package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs +15 -5
  61. package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs.map +1 -1
  62. package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs +44 -5
  63. package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs.map +1 -1
  64. package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +22 -6
  65. package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -1
  66. package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs +1 -1
  67. package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs.map +1 -1
  68. package/fesm2022/ids-group-ltd-ids-design-system-components-field-message.mjs +44 -5
  69. package/fesm2022/ids-group-ltd-ids-design-system-components-field-message.mjs.map +1 -1
  70. package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs +4 -18
  71. package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs.map +1 -1
  72. package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs +49 -20
  73. package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs.map +1 -1
  74. package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs +5 -4
  75. package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs.map +1 -1
  76. package/fesm2022/ids-group-ltd-ids-design-system-components-info-hint.mjs +76 -10
  77. package/fesm2022/ids-group-ltd-ids-design-system-components-info-hint.mjs.map +1 -1
  78. package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs +11 -7
  79. package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs.map +1 -1
  80. package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs +33 -44
  81. package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs.map +1 -1
  82. package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs +50 -5
  83. package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs.map +1 -1
  84. package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs +10 -4
  85. package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs.map +1 -1
  86. package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs +10 -5
  87. package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs.map +1 -1
  88. package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs +14 -6
  89. package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs.map +1 -1
  90. package/fesm2022/ids-group-ltd-ids-design-system-components-pie-chart.mjs +102 -27
  91. package/fesm2022/ids-group-ltd-ids-design-system-components-pie-chart.mjs.map +1 -1
  92. package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs +5 -2
  93. package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs.map +1 -1
  94. package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs +11 -6
  95. package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs.map +1 -1
  96. package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs +123 -23
  97. package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs.map +1 -1
  98. package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs +10 -5
  99. package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs.map +1 -1
  100. package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs +10 -4
  101. package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs.map +1 -1
  102. package/fesm2022/ids-group-ltd-ids-design-system-components-show-dirty.mjs +55 -0
  103. package/fesm2022/ids-group-ltd-ids-design-system-components-show-dirty.mjs.map +1 -0
  104. package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs +10 -5
  105. package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs.map +1 -1
  106. package/fesm2022/ids-group-ltd-ids-design-system-components-sparkline.mjs +3 -2
  107. package/fesm2022/ids-group-ltd-ids-design-system-components-sparkline.mjs.map +1 -1
  108. package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs +10 -5
  109. package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs.map +1 -1
  110. package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs +32 -14
  111. package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs.map +1 -1
  112. package/fesm2022/ids-group-ltd-ids-design-system-components-table-export.mjs +2 -2
  113. package/fesm2022/ids-group-ltd-ids-design-system-components-table-export.mjs.map +1 -1
  114. package/fesm2022/ids-group-ltd-ids-design-system-components-table-resize.mjs +17 -0
  115. package/fesm2022/ids-group-ltd-ids-design-system-components-table-resize.mjs.map +1 -1
  116. package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +160 -201
  117. package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
  118. package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs +15 -5
  119. package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs.map +1 -1
  120. package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs +24 -7
  121. package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -1
  122. package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs +17 -2
  123. package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs.map +1 -1
  124. package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +32 -12
  125. package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -1
  126. package/fesm2022/ids-group-ltd-ids-design-system-components-waterfall-chart.mjs +10 -6
  127. package/fesm2022/ids-group-ltd-ids-design-system-components-waterfall-chart.mjs.map +1 -1
  128. package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +238 -67
  129. package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
  130. package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +9 -2
  131. package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
  132. package/fesm2022/ids-group-ltd-ids-design-system.mjs +1 -0
  133. package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
  134. package/migrations/0.15.0.json +1 -1
  135. package/migrations/0.15.1.json +738 -0
  136. package/package.json +9 -1
  137. package/schematics/check-overrides/surface.json +47 -2
  138. package/stylelint/deprecated-tokens.json +14 -0
  139. package/styles/_chart-frame.scss +14 -0
  140. package/styles/_chart-interactive.scss +26 -1
  141. package/styles/_chart-motion.scss +47 -8
  142. package/styles/_link.scss +35 -12
  143. package/styles/_tokens.scss +3 -0
  144. package/themes/README.md +53 -0
  145. package/themes/_semantic.scss +5 -8
  146. package/themes/dark/_theme.scss +5 -8
  147. package/types/ids-group-ltd-ids-design-system-components-alert.d.ts +1 -1
  148. package/types/ids-group-ltd-ids-design-system-components-autocomplete.d.ts +2 -0
  149. package/types/ids-group-ltd-ids-design-system-components-banner.d.ts +1 -1
  150. package/types/ids-group-ltd-ids-design-system-components-button.d.ts +5 -4
  151. package/types/ids-group-ltd-ids-design-system-components-chart-legend.d.ts +4 -4
  152. package/types/ids-group-ltd-ids-design-system-components-chart-tooltip.d.ts +51 -7
  153. package/types/ids-group-ltd-ids-design-system-components-chart.d.ts +200 -27
  154. package/types/ids-group-ltd-ids-design-system-components-checkbox.d.ts +2 -0
  155. package/types/ids-group-ltd-ids-design-system-components-color-picker.d.ts +2 -0
  156. package/types/ids-group-ltd-ids-design-system-components-column-chart.d.ts +27 -2
  157. package/types/ids-group-ltd-ids-design-system-components-date-picker.d.ts +3 -1
  158. package/types/ids-group-ltd-ids-design-system-components-field-message.d.ts +19 -2
  159. package/types/ids-group-ltd-ids-design-system-components-funnel-chart.d.ts +0 -3
  160. package/types/ids-group-ltd-ids-design-system-components-heatmap-chart.d.ts +21 -8
  161. package/types/ids-group-ltd-ids-design-system-components-icon-button.d.ts +3 -2
  162. package/types/ids-group-ltd-ids-design-system-components-info-hint.d.ts +13 -4
  163. package/types/ids-group-ltd-ids-design-system-components-input.d.ts +2 -0
  164. package/types/ids-group-ltd-ids-design-system-components-line-chart.d.ts +13 -7
  165. package/types/ids-group-ltd-ids-design-system-components-menu.d.ts +6 -0
  166. package/types/ids-group-ltd-ids-design-system-components-multi-select.d.ts +2 -0
  167. package/types/ids-group-ltd-ids-design-system-components-otp-input.d.ts +2 -0
  168. package/types/ids-group-ltd-ids-design-system-components-pagination.d.ts +5 -3
  169. package/types/ids-group-ltd-ids-design-system-components-pie-chart.d.ts +24 -7
  170. package/types/ids-group-ltd-ids-design-system-components-popover.d.ts +2 -1
  171. package/types/ids-group-ltd-ids-design-system-components-radio-group.d.ts +2 -0
  172. package/types/ids-group-ltd-ids-design-system-components-scatter-chart.d.ts +39 -7
  173. package/types/ids-group-ltd-ids-design-system-components-segmented.d.ts +2 -0
  174. package/types/ids-group-ltd-ids-design-system-components-select.d.ts +2 -0
  175. package/types/ids-group-ltd-ids-design-system-components-show-dirty.d.ts +29 -0
  176. package/types/ids-group-ltd-ids-design-system-components-slider.d.ts +2 -0
  177. package/types/ids-group-ltd-ids-design-system-components-switch.d.ts +2 -0
  178. package/types/ids-group-ltd-ids-design-system-components-table-resize.d.ts +2 -0
  179. package/types/ids-group-ltd-ids-design-system-components-table.d.ts +36 -29
  180. package/types/ids-group-ltd-ids-design-system-components-textarea.d.ts +2 -0
  181. package/types/ids-group-ltd-ids-design-system-components-time-picker.d.ts +3 -1
  182. package/types/ids-group-ltd-ids-design-system-components-toast.d.ts +2 -0
  183. package/types/ids-group-ltd-ids-design-system-components-tooltip.d.ts +8 -6
  184. package/types/ids-group-ltd-ids-design-system-components-waterfall-chart.d.ts +4 -1
  185. package/types/ids-group-ltd-ids-design-system-components.d.ts +110 -34
  186. package/types/ids-group-ltd-ids-design-system-core.d.ts +39 -12
  187. package/types/ids-group-ltd-ids-design-system.d.ts +3 -2
@@ -3,7 +3,7 @@ import { inject, model, input, numberAttribute, booleanAttribute, viewChild, com
3
3
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
4
  import { DS_INTL } from '@ids-group-ltd/ids-design-system/core';
5
5
  import { DsControlValueAccessor, nextControlId, resolveFieldMessage } from '@ids-group-ltd/ids-design-system/components';
6
- import { FieldMessageComponent } from '@ids-group-ltd/ids-design-system/components/field-message';
6
+ import { FieldMessageComponent, FieldStatusComponent } from '@ids-group-ltd/ids-design-system/components/field-message';
7
7
 
8
8
  class SliderComponent extends DsControlValueAccessor {
9
9
  intl = inject(DS_INTL);
@@ -24,8 +24,11 @@ class SliderComponent extends DsControlValueAccessor {
24
24
  track = viewChild.required('track');
25
25
  dragging = -1;
26
26
  uid = nextControlId('ds-slider');
27
- hintId = computed(() => this.message().text ? `${this.uid}-hint` : null, ...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
27
+ hintId = computed(() => this.message().text || this.changedShown() ? `${this.uid}-hint` : null, ...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
28
28
  fieldMessage = resolveFieldMessage({
29
+ pending: this.pending,
30
+ dirty: this.dirty,
31
+ showDirty: this.showDirtyResolved,
29
32
  disabled: () => this.isDisabled(),
30
33
  hint: this.hint,
31
34
  warning: this.warning,
@@ -36,6 +39,8 @@ class SliderComponent extends DsControlValueAccessor {
36
39
  touched: this.touched,
37
40
  });
38
41
  message = this.fieldMessage.message;
42
+ pendingShown = this.fieldMessage.pending;
43
+ changedShown = this.fieldMessage.changed;
39
44
  invalidResolved = this.fieldMessage.invalid;
40
45
  isDisabled = computed(() => this.disabled() || this.formDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
41
46
  thumbValues = computed(() => {
@@ -180,11 +185,11 @@ class SliderComponent extends DsControlValueAccessor {
180
185
  useExisting: forwardRef(() => SliderComponent),
181
186
  multi: true,
182
187
  },
183
- ], viewQueries: [{ propertyName: "track", first: true, predicate: ["track"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div\n #track\n class=\"track\"\n (pointerdown)=\"onTrackPointerDown($event)\"\n (pointermove)=\"onTrackPointerMove($event)\"\n (pointerup)=\"onTrackPointerUp($event)\"\n (pointercancel)=\"onTrackPointerUp($event)\">\n <span\n class=\"fill\"\n [style.left.%]=\"fill().left\"\n [style.width.%]=\"fill().width\">\n </span>\n\n @for (thumbValue of thumbValues(); track $index; let i = $index) {\n <span\n class=\"thumb\"\n role=\"slider\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n [style.left.%]=\"percent(thumbValue)\"\n [attr.aria-valuemin]=\"thumbMin(i)\"\n [attr.aria-valuemax]=\"thumbMax(i)\"\n [attr.aria-valuenow]=\"thumbValue\"\n [attr.aria-orientation]=\"'horizontal'\"\n [attr.aria-label]=\"thumbAriaLabel(i)\"\n [attr.aria-disabled]=\"isDisabled() ? 'true' : null\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n (keydown)=\"onThumbKeydown($event, i)\">\n </span>\n }\n</div>\n\n<ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [reserve]=\"reserveMessageResolved()\" />\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}:host{--_slider-track-height: var(--ds-slider-track-height, var(--slider-track-h));--_slider-thumb-size: var(--ds-slider-thumb-size, var(--slider-thumb-size));--_slider-thumb-border-width: var(--ds-slider-thumb-border-width, var(--slider-thumb-border-width));--_slider-fill-color: var(--ds-slider-fill-color, var(--accent));--_slider-track-color: var(--ds-slider-track-color, var(--surface-muted));--_slider-thumb-color: var(--ds-slider-thumb-color, var(--surface-default));--_slider-thumb-border-color: var(--ds-slider-thumb-border-color, var(--accent));display:flex;flex-direction:column;padding-block:calc((var(--_slider-thumb-size) - var(--_slider-track-height)) / 2);gap:calc((var(--_slider-thumb-size) - var(--_slider-track-height)) / 2 + var(--space-1-5))}.track{position:relative;height:var(--_slider-track-height);background-color:var(--_slider-track-color);border-radius:var(--radius-pill);cursor:pointer;touch-action:none}.fill{position:absolute;top:0;height:100%;background-color:var(--_slider-fill-color);border-radius:var(--radius-pill)}.thumb{position:absolute;top:50%;transform:translate(-50%,-50%);width:var(--_slider-thumb-size);height:var(--_slider-thumb-size);border-radius:var(--radius-pill);background-color:var(--_slider-thumb-color);border:var(--_slider-thumb-border-width) solid var(--_slider-thumb-border-color);box-shadow:var(--shadow-card);cursor:grab;touch-action:none}.thumb:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.thumb:active{cursor:grabbing}:host(.disabled) .track{cursor:not-allowed}:host(.disabled) .fill{background-color:var(--border-strong)}:host(.disabled) .thumb{border-color:var(--border-strong);cursor:not-allowed}:host(.invalid) .fill{background-color:var(--error)}:host(.invalid) .thumb{border-color:var(--error)}\n"], dependencies: [{ kind: "component", type: FieldMessageComponent, selector: "ds-field-message", inputs: ["text", "state", "messageId", "icon", "reserve"] }] });
188
+ ], viewQueries: [{ propertyName: "track", first: true, predicate: ["track"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div\n #track\n class=\"track\"\n (pointerdown)=\"onTrackPointerDown($event)\"\n (pointermove)=\"onTrackPointerMove($event)\"\n (pointerup)=\"onTrackPointerUp($event)\"\n (pointercancel)=\"onTrackPointerUp($event)\">\n <span\n class=\"fill\"\n [style.left.%]=\"fill().left\"\n [style.width.%]=\"fill().width\">\n </span>\n\n @for (thumbValue of thumbValues(); track $index; let i = $index) {\n <span\n class=\"thumb\"\n role=\"slider\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n [style.left.%]=\"percent(thumbValue)\"\n [attr.aria-valuemin]=\"thumbMin(i)\"\n [attr.aria-valuemax]=\"thumbMax(i)\"\n [attr.aria-valuenow]=\"thumbValue\"\n [attr.aria-orientation]=\"'horizontal'\"\n [attr.aria-label]=\"thumbAriaLabel(i)\"\n [attr.aria-disabled]=\"isDisabled() ? 'true' : null\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n (keydown)=\"onThumbKeydown($event, i)\">\n </span>\n }\n</div>\n\n<ds-field-status\n [pending]=\"pendingShown()\"\n [changed]=\"changedShown()\" />\n\n<ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [reserve]=\"reserveMessageResolved()\"\n [changed]=\"changedShown()\" />\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}:host{--_slider-track-height: var(--ds-slider-track-height, var(--slider-track-h));--_slider-thumb-size: var(--ds-slider-thumb-size, var(--slider-thumb-size));--_slider-thumb-border-width: var(--ds-slider-thumb-border-width, var(--slider-thumb-border-width));--_slider-fill-color: var(--ds-slider-fill-color, var(--accent));--_slider-track-color: var(--ds-slider-track-color, var(--surface-muted));--_slider-thumb-color: var(--ds-slider-thumb-color, var(--surface-default));--_slider-thumb-border-color: var(--ds-slider-thumb-border-color, var(--accent));display:flex;flex-direction:column;padding-block:calc((var(--_slider-thumb-size) - var(--_slider-track-height)) / 2);gap:calc((var(--_slider-thumb-size) - var(--_slider-track-height)) / 2 + var(--space-1-5))}.track{position:relative;height:var(--_slider-track-height);background-color:var(--_slider-track-color);border-radius:var(--radius-pill);cursor:pointer;touch-action:none}.fill{position:absolute;top:0;height:100%;background-color:var(--_slider-fill-color);border-radius:var(--radius-pill)}.thumb{position:absolute;top:50%;transform:translate(-50%,-50%);width:var(--_slider-thumb-size);height:var(--_slider-thumb-size);border-radius:var(--radius-pill);background-color:var(--_slider-thumb-color);border:var(--_slider-thumb-border-width) solid var(--_slider-thumb-border-color);box-shadow:var(--shadow-card);cursor:grab;touch-action:none}.thumb:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.thumb:active{cursor:grabbing}:host(.disabled) .track{cursor:not-allowed}:host(.disabled) .fill{background-color:var(--border-strong)}:host(.disabled) .thumb{border-color:var(--border-strong);cursor:not-allowed}:host(.invalid) .fill{background-color:var(--error)}:host(.invalid) .thumb{border-color:var(--error)}\n"], dependencies: [{ kind: "component", type: FieldMessageComponent, selector: "ds-field-message", inputs: ["text", "state", "messageId", "icon", "reserve", "changed"] }, { kind: "component", type: FieldStatusComponent, selector: "ds-field-status", inputs: ["pending", "changed"] }] });
184
189
  }
185
190
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: SliderComponent, decorators: [{
186
191
  type: Component,
187
- args: [{ selector: 'ds-slider', standalone: true, imports: [FieldMessageComponent], encapsulation: ViewEncapsulation.Emulated, providers: [
192
+ args: [{ selector: 'ds-slider', standalone: true, imports: [FieldMessageComponent, FieldStatusComponent], encapsulation: ViewEncapsulation.Emulated, providers: [
188
193
  {
189
194
  provide: NG_VALUE_ACCESSOR,
190
195
  useExisting: forwardRef(() => SliderComponent),
@@ -194,7 +199,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
194
199
  '[class.range]': 'range()',
195
200
  '[class.disabled]': 'isDisabled()',
196
201
  '[class.invalid]': 'invalidResolved()',
197
- }, template: "<div\n #track\n class=\"track\"\n (pointerdown)=\"onTrackPointerDown($event)\"\n (pointermove)=\"onTrackPointerMove($event)\"\n (pointerup)=\"onTrackPointerUp($event)\"\n (pointercancel)=\"onTrackPointerUp($event)\">\n <span\n class=\"fill\"\n [style.left.%]=\"fill().left\"\n [style.width.%]=\"fill().width\">\n </span>\n\n @for (thumbValue of thumbValues(); track $index; let i = $index) {\n <span\n class=\"thumb\"\n role=\"slider\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n [style.left.%]=\"percent(thumbValue)\"\n [attr.aria-valuemin]=\"thumbMin(i)\"\n [attr.aria-valuemax]=\"thumbMax(i)\"\n [attr.aria-valuenow]=\"thumbValue\"\n [attr.aria-orientation]=\"'horizontal'\"\n [attr.aria-label]=\"thumbAriaLabel(i)\"\n [attr.aria-disabled]=\"isDisabled() ? 'true' : null\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n (keydown)=\"onThumbKeydown($event, i)\">\n </span>\n }\n</div>\n\n<ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [reserve]=\"reserveMessageResolved()\" />\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}:host{--_slider-track-height: var(--ds-slider-track-height, var(--slider-track-h));--_slider-thumb-size: var(--ds-slider-thumb-size, var(--slider-thumb-size));--_slider-thumb-border-width: var(--ds-slider-thumb-border-width, var(--slider-thumb-border-width));--_slider-fill-color: var(--ds-slider-fill-color, var(--accent));--_slider-track-color: var(--ds-slider-track-color, var(--surface-muted));--_slider-thumb-color: var(--ds-slider-thumb-color, var(--surface-default));--_slider-thumb-border-color: var(--ds-slider-thumb-border-color, var(--accent));display:flex;flex-direction:column;padding-block:calc((var(--_slider-thumb-size) - var(--_slider-track-height)) / 2);gap:calc((var(--_slider-thumb-size) - var(--_slider-track-height)) / 2 + var(--space-1-5))}.track{position:relative;height:var(--_slider-track-height);background-color:var(--_slider-track-color);border-radius:var(--radius-pill);cursor:pointer;touch-action:none}.fill{position:absolute;top:0;height:100%;background-color:var(--_slider-fill-color);border-radius:var(--radius-pill)}.thumb{position:absolute;top:50%;transform:translate(-50%,-50%);width:var(--_slider-thumb-size);height:var(--_slider-thumb-size);border-radius:var(--radius-pill);background-color:var(--_slider-thumb-color);border:var(--_slider-thumb-border-width) solid var(--_slider-thumb-border-color);box-shadow:var(--shadow-card);cursor:grab;touch-action:none}.thumb:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.thumb:active{cursor:grabbing}:host(.disabled) .track{cursor:not-allowed}:host(.disabled) .fill{background-color:var(--border-strong)}:host(.disabled) .thumb{border-color:var(--border-strong);cursor:not-allowed}:host(.invalid) .fill{background-color:var(--error)}:host(.invalid) .thumb{border-color:var(--error)}\n"] }]
202
+ }, template: "<div\n #track\n class=\"track\"\n (pointerdown)=\"onTrackPointerDown($event)\"\n (pointermove)=\"onTrackPointerMove($event)\"\n (pointerup)=\"onTrackPointerUp($event)\"\n (pointercancel)=\"onTrackPointerUp($event)\">\n <span\n class=\"fill\"\n [style.left.%]=\"fill().left\"\n [style.width.%]=\"fill().width\">\n </span>\n\n @for (thumbValue of thumbValues(); track $index; let i = $index) {\n <span\n class=\"thumb\"\n role=\"slider\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n [style.left.%]=\"percent(thumbValue)\"\n [attr.aria-valuemin]=\"thumbMin(i)\"\n [attr.aria-valuemax]=\"thumbMax(i)\"\n [attr.aria-valuenow]=\"thumbValue\"\n [attr.aria-orientation]=\"'horizontal'\"\n [attr.aria-label]=\"thumbAriaLabel(i)\"\n [attr.aria-disabled]=\"isDisabled() ? 'true' : null\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n (keydown)=\"onThumbKeydown($event, i)\">\n </span>\n }\n</div>\n\n<ds-field-status\n [pending]=\"pendingShown()\"\n [changed]=\"changedShown()\" />\n\n<ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [reserve]=\"reserveMessageResolved()\"\n [changed]=\"changedShown()\" />\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}:host{--_slider-track-height: var(--ds-slider-track-height, var(--slider-track-h));--_slider-thumb-size: var(--ds-slider-thumb-size, var(--slider-thumb-size));--_slider-thumb-border-width: var(--ds-slider-thumb-border-width, var(--slider-thumb-border-width));--_slider-fill-color: var(--ds-slider-fill-color, var(--accent));--_slider-track-color: var(--ds-slider-track-color, var(--surface-muted));--_slider-thumb-color: var(--ds-slider-thumb-color, var(--surface-default));--_slider-thumb-border-color: var(--ds-slider-thumb-border-color, var(--accent));display:flex;flex-direction:column;padding-block:calc((var(--_slider-thumb-size) - var(--_slider-track-height)) / 2);gap:calc((var(--_slider-thumb-size) - var(--_slider-track-height)) / 2 + var(--space-1-5))}.track{position:relative;height:var(--_slider-track-height);background-color:var(--_slider-track-color);border-radius:var(--radius-pill);cursor:pointer;touch-action:none}.fill{position:absolute;top:0;height:100%;background-color:var(--_slider-fill-color);border-radius:var(--radius-pill)}.thumb{position:absolute;top:50%;transform:translate(-50%,-50%);width:var(--_slider-thumb-size);height:var(--_slider-thumb-size);border-radius:var(--radius-pill);background-color:var(--_slider-thumb-color);border:var(--_slider-thumb-border-width) solid var(--_slider-thumb-border-color);box-shadow:var(--shadow-card);cursor:grab;touch-action:none}.thumb:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.thumb:active{cursor:grabbing}:host(.disabled) .track{cursor:not-allowed}:host(.disabled) .fill{background-color:var(--border-strong)}:host(.disabled) .thumb{border-color:var(--border-strong);cursor:not-allowed}:host(.invalid) .fill{background-color:var(--error)}:host(.invalid) .thumb{border-color:var(--error)}\n"] }]
198
203
  }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], range: [{ type: i0.Input, args: [{ isSignal: true, alias: "range", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], track: [{ type: i0.ViewChild, args: ['track', { isSignal: true }] }] } });
199
204
 
200
205
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ids-group-ltd-ids-design-system-components-slider.mjs","sources":["../../../src/lib/components/slider/slider.component.ts","../../../src/lib/components/slider/slider.component.html","../../../src/lib/components/slider/ids-group-ltd-ids-design-system-components-slider.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n forwardRef,\n inject,\n input,\n model,\n numberAttribute,\n viewChild,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { DS_INTL } from '@ids-group-ltd/ids-design-system/core';\nimport { DsControlValueAccessor } from '@ids-group-ltd/ids-design-system/components';\nimport { FieldMessageComponent } from '@ids-group-ltd/ids-design-system/components/field-message';\nimport { resolveFieldMessage } from '@ids-group-ltd/ids-design-system/components';\nimport { nextControlId } from '@ids-group-ltd/ids-design-system/components';\n\ntype SliderValue = number | readonly [number, number];\n\n@Component({\n selector: 'ds-slider',\n standalone: true,\n imports: [FieldMessageComponent],\n templateUrl: './slider.component.html',\n styleUrl: './slider.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SliderComponent),\n multi: true,\n },\n ],\n host: {\n '[class.range]': 'range()',\n '[class.disabled]': 'isDisabled()',\n '[class.invalid]': 'invalidResolved()',\n },\n})\nexport class SliderComponent extends DsControlValueAccessor<SliderValue> {\n protected readonly intl = inject(DS_INTL);\n /** Current value, or `[low, high]` when `range`. */\n readonly value = model<SliderValue>(0);\n /** Minimum selectable value. */\n readonly min = input(0, { transform: numberAttribute });\n /** Maximum selectable value. */\n readonly max = input(100, { transform: numberAttribute });\n /** Snap increment for dragging and arrow keys. */\n readonly step = input(1, { transform: numberAttribute });\n /** Two-thumb mode: `value` becomes a `[low, high]` tuple. */\n readonly range = input(false, { transform: booleanAttribute });\n /** Disables the slider and blocks all interaction. */\n readonly disabled = input(false, { transform: booleanAttribute });\n /** Accessible name of the thumb(s); suffixed \"minimum\"/\"maximum\" in `range` mode. */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly track = viewChild.required<ElementRef<HTMLElement>>('track');\n private dragging = -1;\n\n protected readonly uid = nextControlId('ds-slider');\n protected readonly hintId = computed(() =>\n this.message().text ? `${this.uid}-hint` : null,\n );\n private readonly fieldMessage = resolveFieldMessage({\n disabled: () => this.isDisabled(),\n hint: this.hint,\n warning: this.warning,\n error: this.error,\n errors: this.errors,\n invalid: this.invalid,\n touchedSelf: this.touchedSelf,\n touched: this.touched,\n });\n protected readonly message = this.fieldMessage.message;\n protected readonly invalidResolved = this.fieldMessage.invalid;\n\n protected readonly isDisabled = computed(\n () => this.disabled() || this.formDisabled(),\n );\n\n protected readonly thumbValues = computed<number[]>(() => {\n const value = this.value();\n if (this.range()) {\n const [low, high] = value as readonly [number, number];\n\n return [low, high];\n }\n\n return [value as number];\n });\n\n protected readonly fill = computed<{ left: number; width: number }>(() => {\n const values = this.thumbValues();\n if (this.range()) {\n const low = this.percent(values[0]);\n const high = this.percent(values[1]);\n\n return { left: low, width: high - low };\n }\n\n return { left: 0, width: this.percent(values[0]) };\n });\n\n protected percent(value: number): number {\n const min = this.min();\n const max = this.max();\n\n return max === min ? 0 : ((value - min) / (max - min)) * 100;\n }\n\n protected thumbMin(index: number): number {\n return this.range() && index === 1 ? this.thumbValues()[0] : this.min();\n }\n\n protected thumbMax(index: number): number {\n return this.range() && index === 0 ? this.thumbValues()[1] : this.max();\n }\n\n protected onTrackPointerDown(event: PointerEvent): void {\n if (this.isDisabled()) {\n return;\n }\n const track = this.track().nativeElement;\n track.setPointerCapture(event.pointerId);\n this.dragging = this.nearestThumb(event.clientX);\n this.updateFromClientX(event.clientX);\n track.querySelectorAll<HTMLElement>('.thumb')[this.dragging]?.focus();\n }\n\n protected onTrackPointerMove(event: PointerEvent): void {\n if (this.dragging < 0) {\n return;\n }\n this.updateFromClientX(event.clientX);\n }\n\n // Bound to pointerup and pointercancel: touch interventions fire pointercancel, and without it\n // the drag state leaks and keeps moving the thumb with no pointer down.\n protected onTrackPointerUp(event: PointerEvent): void {\n if (this.dragging < 0) {\n return;\n }\n const track = this.track().nativeElement;\n if (track.hasPointerCapture(event.pointerId)) {\n track.releasePointerCapture(event.pointerId);\n }\n this.dragging = -1;\n this.markTouched();\n }\n\n protected thumbAriaLabel(index: number): string | null {\n const base = this.ariaLabel();\n if (!this.range()) {\n return base;\n }\n\n return index === 0\n ? this.intl().slider.rangeStart(base ?? '')\n : this.intl().slider.rangeEnd(base ?? '');\n }\n\n protected onThumbKeydown(event: KeyboardEvent, index: number): void {\n if (this.isDisabled()) {\n return;\n }\n const step = this.step() || 1;\n let delta = 0;\n let absolute: number | null = null;\n switch (event.key) {\n case 'ArrowRight':\n case 'ArrowUp':\n delta = step;\n break;\n case 'ArrowLeft':\n case 'ArrowDown':\n delta = -step;\n break;\n case 'PageUp':\n delta = step * 10;\n break;\n case 'PageDown':\n delta = -step * 10;\n break;\n case 'Home':\n absolute = this.thumbMin(index);\n break;\n case 'End':\n absolute = this.thumbMax(index);\n break;\n default:\n return;\n }\n event.preventDefault();\n const current = this.thumbValues()[index];\n this.setThumb(index, absolute ?? this.snap(current + delta));\n }\n\n private nearestThumb(clientX: number): number {\n if (!this.range()) {\n return 0;\n }\n const value = this.valueFromClientX(clientX);\n const [low, high] = this.thumbValues();\n\n return Math.abs(value - low) <= Math.abs(value - high) ? 0 : 1;\n }\n\n private updateFromClientX(clientX: number): void {\n this.setThumb(this.dragging, this.snap(this.valueFromClientX(clientX)));\n }\n\n private valueFromClientX(clientX: number): number {\n const rect = this.track().nativeElement.getBoundingClientRect();\n if (rect.width === 0) {\n return this.min();\n }\n const ratio = Math.min(1, Math.max(0, (clientX - rect.left) / rect.width));\n\n return this.min() + ratio * (this.max() - this.min());\n }\n\n private setThumb(index: number, next: number): void {\n if (this.range()) {\n const [low, high] = this.thumbValues();\n this.value.set(\n index === 0 ? [Math.min(next, high), high] : [low, Math.max(next, low)],\n );\n } else {\n this.value.set(next);\n }\n }\n\n private snap(raw: number): number {\n const step = this.step() || 1;\n const min = this.min();\n const snapped = Math.round((raw - min) / step) * step + min;\n\n return Math.min(this.max(), Math.max(min, snapped));\n }\n}\n","<div\n #track\n class=\"track\"\n (pointerdown)=\"onTrackPointerDown($event)\"\n (pointermove)=\"onTrackPointerMove($event)\"\n (pointerup)=\"onTrackPointerUp($event)\"\n (pointercancel)=\"onTrackPointerUp($event)\">\n <span\n class=\"fill\"\n [style.left.%]=\"fill().left\"\n [style.width.%]=\"fill().width\">\n </span>\n\n @for (thumbValue of thumbValues(); track $index; let i = $index) {\n <span\n class=\"thumb\"\n role=\"slider\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n [style.left.%]=\"percent(thumbValue)\"\n [attr.aria-valuemin]=\"thumbMin(i)\"\n [attr.aria-valuemax]=\"thumbMax(i)\"\n [attr.aria-valuenow]=\"thumbValue\"\n [attr.aria-orientation]=\"'horizontal'\"\n [attr.aria-label]=\"thumbAriaLabel(i)\"\n [attr.aria-disabled]=\"isDisabled() ? 'true' : null\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n (keydown)=\"onThumbKeydown($event, i)\">\n </span>\n }\n</div>\n\n<ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [reserve]=\"reserveMessageResolved()\" />\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA0CM,MAAO,eAAgB,SAAQ,sBAAmC,CAAA;AACnD,IAAA,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC;;AAEhC,IAAA,K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A,QAAA,EAAA,isCAAA,EAAA,MAAA,EAAA,CAAA,g/EAAA,CAAA,EAAA;yuBAmBoE,OAAO,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE3D9E;;AAEG;;;;"}
1
+ {"version":3,"file":"ids-group-ltd-ids-design-system-components-slider.mjs","sources":["../../../src/lib/components/slider/slider.component.ts","../../../src/lib/components/slider/slider.component.html","../../../src/lib/components/slider/ids-group-ltd-ids-design-system-components-slider.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n forwardRef,\n inject,\n input,\n model,\n numberAttribute,\n viewChild,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { DS_INTL } from '@ids-group-ltd/ids-design-system/core';\nimport { DsControlValueAccessor } from '@ids-group-ltd/ids-design-system/components';\nimport {\n FieldMessageComponent,\n FieldStatusComponent,\n} from '@ids-group-ltd/ids-design-system/components/field-message';\nimport { resolveFieldMessage } from '@ids-group-ltd/ids-design-system/components';\nimport { nextControlId } from '@ids-group-ltd/ids-design-system/components';\n\ntype SliderValue = number | readonly [number, number];\n\n@Component({\n selector: 'ds-slider',\n standalone: true,\n imports: [FieldMessageComponent, FieldStatusComponent],\n templateUrl: './slider.component.html',\n styleUrl: './slider.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SliderComponent),\n multi: true,\n },\n ],\n host: {\n '[class.range]': 'range()',\n '[class.disabled]': 'isDisabled()',\n '[class.invalid]': 'invalidResolved()',\n },\n})\nexport class SliderComponent extends DsControlValueAccessor<SliderValue> {\n protected readonly intl = inject(DS_INTL);\n /** Current value, or `[low, high]` when `range`. */\n readonly value = model<SliderValue>(0);\n /** Minimum selectable value. */\n readonly min = input(0, { transform: numberAttribute });\n /** Maximum selectable value. */\n readonly max = input(100, { transform: numberAttribute });\n /** Snap increment for dragging and arrow keys. */\n readonly step = input(1, { transform: numberAttribute });\n /** Two-thumb mode: `value` becomes a `[low, high]` tuple. */\n readonly range = input(false, { transform: booleanAttribute });\n /** Disables the slider and blocks all interaction. */\n readonly disabled = input(false, { transform: booleanAttribute });\n /** Accessible name of the thumb(s); suffixed \"minimum\"/\"maximum\" in `range` mode. */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly track = viewChild.required<ElementRef<HTMLElement>>('track');\n private dragging = -1;\n\n protected readonly uid = nextControlId('ds-slider');\n protected readonly hintId = computed(() =>\n this.message().text || this.changedShown() ? `${this.uid}-hint` : null,\n );\n private readonly fieldMessage = resolveFieldMessage({\n pending: this.pending,\n dirty: this.dirty,\n showDirty: this.showDirtyResolved,\n disabled: () => this.isDisabled(),\n hint: this.hint,\n warning: this.warning,\n error: this.error,\n errors: this.errors,\n invalid: this.invalid,\n touchedSelf: this.touchedSelf,\n touched: this.touched,\n });\n protected readonly message = this.fieldMessage.message;\n protected readonly pendingShown = this.fieldMessage.pending;\n protected readonly changedShown = this.fieldMessage.changed;\n protected readonly invalidResolved = this.fieldMessage.invalid;\n\n protected readonly isDisabled = computed(\n () => this.disabled() || this.formDisabled(),\n );\n\n protected readonly thumbValues = computed<number[]>(() => {\n const value = this.value();\n if (this.range()) {\n const [low, high] = value as readonly [number, number];\n\n return [low, high];\n }\n\n return [value as number];\n });\n\n protected readonly fill = computed<{ left: number; width: number }>(() => {\n const values = this.thumbValues();\n if (this.range()) {\n const low = this.percent(values[0]);\n const high = this.percent(values[1]);\n\n return { left: low, width: high - low };\n }\n\n return { left: 0, width: this.percent(values[0]) };\n });\n\n protected percent(value: number): number {\n const min = this.min();\n const max = this.max();\n\n return max === min ? 0 : ((value - min) / (max - min)) * 100;\n }\n\n protected thumbMin(index: number): number {\n return this.range() && index === 1 ? this.thumbValues()[0] : this.min();\n }\n\n protected thumbMax(index: number): number {\n return this.range() && index === 0 ? this.thumbValues()[1] : this.max();\n }\n\n protected onTrackPointerDown(event: PointerEvent): void {\n if (this.isDisabled()) {\n return;\n }\n const track = this.track().nativeElement;\n track.setPointerCapture(event.pointerId);\n this.dragging = this.nearestThumb(event.clientX);\n this.updateFromClientX(event.clientX);\n track.querySelectorAll<HTMLElement>('.thumb')[this.dragging]?.focus();\n }\n\n protected onTrackPointerMove(event: PointerEvent): void {\n if (this.dragging < 0) {\n return;\n }\n this.updateFromClientX(event.clientX);\n }\n\n // Bound to pointerup and pointercancel: touch interventions fire pointercancel, and without it\n // the drag state leaks and keeps moving the thumb with no pointer down.\n protected onTrackPointerUp(event: PointerEvent): void {\n if (this.dragging < 0) {\n return;\n }\n const track = this.track().nativeElement;\n if (track.hasPointerCapture(event.pointerId)) {\n track.releasePointerCapture(event.pointerId);\n }\n this.dragging = -1;\n this.markTouched();\n }\n\n protected thumbAriaLabel(index: number): string | null {\n const base = this.ariaLabel();\n if (!this.range()) {\n return base;\n }\n\n return index === 0\n ? this.intl().slider.rangeStart(base ?? '')\n : this.intl().slider.rangeEnd(base ?? '');\n }\n\n protected onThumbKeydown(event: KeyboardEvent, index: number): void {\n if (this.isDisabled()) {\n return;\n }\n const step = this.step() || 1;\n let delta = 0;\n let absolute: number | null = null;\n switch (event.key) {\n case 'ArrowRight':\n case 'ArrowUp':\n delta = step;\n break;\n case 'ArrowLeft':\n case 'ArrowDown':\n delta = -step;\n break;\n case 'PageUp':\n delta = step * 10;\n break;\n case 'PageDown':\n delta = -step * 10;\n break;\n case 'Home':\n absolute = this.thumbMin(index);\n break;\n case 'End':\n absolute = this.thumbMax(index);\n break;\n default:\n return;\n }\n event.preventDefault();\n const current = this.thumbValues()[index];\n this.setThumb(index, absolute ?? this.snap(current + delta));\n }\n\n private nearestThumb(clientX: number): number {\n if (!this.range()) {\n return 0;\n }\n const value = this.valueFromClientX(clientX);\n const [low, high] = this.thumbValues();\n\n return Math.abs(value - low) <= Math.abs(value - high) ? 0 : 1;\n }\n\n private updateFromClientX(clientX: number): void {\n this.setThumb(this.dragging, this.snap(this.valueFromClientX(clientX)));\n }\n\n private valueFromClientX(clientX: number): number {\n const rect = this.track().nativeElement.getBoundingClientRect();\n if (rect.width === 0) {\n return this.min();\n }\n const ratio = Math.min(1, Math.max(0, (clientX - rect.left) / rect.width));\n\n return this.min() + ratio * (this.max() - this.min());\n }\n\n private setThumb(index: number, next: number): void {\n if (this.range()) {\n const [low, high] = this.thumbValues();\n this.value.set(\n index === 0 ? [Math.min(next, high), high] : [low, Math.max(next, low)],\n );\n } else {\n this.value.set(next);\n }\n }\n\n private snap(raw: number): number {\n const step = this.step() || 1;\n const min = this.min();\n const snapped = Math.round((raw - min) / step) * step + min;\n\n return Math.min(this.max(), Math.max(min, snapped));\n }\n}\n","<div\n #track\n class=\"track\"\n (pointerdown)=\"onTrackPointerDown($event)\"\n (pointermove)=\"onTrackPointerMove($event)\"\n (pointerup)=\"onTrackPointerUp($event)\"\n (pointercancel)=\"onTrackPointerUp($event)\">\n <span\n class=\"fill\"\n [style.left.%]=\"fill().left\"\n [style.width.%]=\"fill().width\">\n </span>\n\n @for (thumbValue of thumbValues(); track $index; let i = $index) {\n <span\n class=\"thumb\"\n role=\"slider\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n [style.left.%]=\"percent(thumbValue)\"\n [attr.aria-valuemin]=\"thumbMin(i)\"\n [attr.aria-valuemax]=\"thumbMax(i)\"\n [attr.aria-valuenow]=\"thumbValue\"\n [attr.aria-orientation]=\"'horizontal'\"\n [attr.aria-label]=\"thumbAriaLabel(i)\"\n [attr.aria-disabled]=\"isDisabled() ? 'true' : null\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n (keydown)=\"onThumbKeydown($event, i)\">\n </span>\n }\n</div>\n\n<ds-field-status\n [pending]=\"pendingShown()\"\n [changed]=\"changedShown()\" />\n\n<ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [re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CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,oBAAoB,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;4FAiB1C,eAAe,EAAA,UAAA,EAAA,CAAA;kBApB3B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,WAAW,EAAA,UAAA,EACT,IAAI,EAAA,OAAA,EACP,CAAC,qBAAqB,EAAE,oBAAoB,CAAC,EAAA,aAAA,EAGvC,iBAAiB,CAAC,QAAQ,EAAA,SAAA,EAC9B;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,qBAAqB,CAAC;AAC9C,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;qBACF,EAAA,IAAA,EACK;AACJ,wBAAA,eAAe,EAAE,SAAS;AAC1B,wBAAA,kBAAkB,EAAE,cAAc;AAClC,wBAAA,iBAAiB,EAAE,mBAAmB;AACvC,qBAAA,EAAA,QAAA,EAAA,wzCAAA,EAAA,MAAA,EAAA,CAAA,g/EAAA,CAAA,EAAA;yuBAmBoE,OAAO,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE9D9E;;AAEG;;;;"}
@@ -1,5 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, booleanAttribute, inject, LOCALE_ID, viewChild, computed, signal, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
2
+ import { input, booleanAttribute, viewChild, computed, signal, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
3
+ import { injectDsLocale } from '@ids-group-ltd/ids-design-system/core';
3
4
  import { ChartTooltipDirective } from '@ids-group-ltd/ids-design-system/components/chart-tooltip';
4
5
 
5
6
  /** Positions in percent of the box, x across the readings and y down from the top of the scale.
@@ -63,7 +64,7 @@ class SparklineComponent {
63
64
  tooltip = input(true, { ...(ngDevMode ? { debugName: "tooltip" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
64
65
  /** Formats the value the tooltip prints. Unset, the locale's plain number format. */
65
66
  valueFormat = input(null, ...(ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []));
66
- locale = inject(LOCALE_ID);
67
+ locale = injectDsLocale();
67
68
  canvas = viewChild.required('canvas');
68
69
  focusable = computed(() => this.tooltip() && this.label() !== null, ...(ngDevMode ? [{ debugName: "focusable" }] : /* istanbul ignore next */ []));
69
70
  geometry = computed(() => sparklineGeometry(this.data(), this.scale()), ...(ngDevMode ? [{ debugName: "geometry" }] : /* istanbul ignore next */ []));
@@ -1 +1 @@
1
- {"version":3,"file":"ids-group-ltd-ids-design-system-components-sparkline.mjs","sources":["../../../src/lib/components/sparkline/sparkline.math.ts","../../../src/lib/components/sparkline/sparkline.component.ts","../../../src/lib/components/sparkline/sparkline.component.html","../../../src/lib/components/sparkline/ids-group-ltd-ids-design-system-components-sparkline.ts"],"sourcesContent":["import type { SparklineScale } from './sparkline.types';\n\nexport interface SparklinePoint {\n readonly index: number;\n readonly x: number;\n readonly y: number;\n}\n\nexport interface SparklineGeometry {\n readonly path: string;\n /** Each unbroken run of the line closed down to the baseline: zero on the `'zero'` scale, the\n * foot of the box on `'data'`. */\n readonly areaPath: string;\n readonly points: readonly SparklinePoint[];\n}\n\n/** Positions in percent of the box, x across the readings and y down from the top of the scale.\n * A flat series on the `'data'` scale draws through the middle. A `null` breaks the line. */\nexport function sparklineGeometry(\n data: readonly (number | null)[],\n scale: SparklineScale,\n): SparklineGeometry {\n const finite = data.filter(\n (value): value is number => value !== null && Number.isFinite(value),\n );\n if (finite.length === 0) {\n return { path: '', areaPath: '', points: [] };\n }\n const floor = scale === 'zero' ? Math.min(0, ...finite) : Math.min(...finite);\n const ceiling =\n scale === 'zero' ? Math.max(0, ...finite) : Math.max(...finite);\n const span = ceiling - floor;\n const lastIndex = data.length - 1;\n const baseline = scale === 'zero' && span > 0 ? (ceiling / span) * 100 : 100;\n const points: SparklinePoint[] = [];\n const runs: SparklinePoint[][] = [];\n let path = '';\n let penDown = false;\n data.forEach((value, index) => {\n if (value === null || !Number.isFinite(value)) {\n penDown = false;\n\n return;\n }\n const x = lastIndex === 0 ? 50 : (index / lastIndex) * 100;\n const y = span === 0 ? 50 : ((ceiling - value) / span) * 100;\n const point = { index, x, y };\n points.push(point);\n if (penDown) {\n runs[runs.length - 1].push(point);\n } else {\n runs.push([point]);\n }\n path += `${penDown ? 'L' : 'M'}${x} ${y}`;\n penDown = true;\n });\n const areaPath = runs\n .map(\n (run) =>\n `M${run[0].x} ${baseline}` +\n run.map((point) => `L${point.x} ${point.y}`).join('') +\n `L${run[run.length - 1].x} ${baseline}Z`,\n )\n .join('');\n\n return { path, areaPath, points };\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\nimport { ChartTooltipDirective } from '@ids-group-ltd/ids-design-system/components/chart-tooltip';\nimport type {\n ChartTooltipContext,\n ChartTooltipOrigin,\n} from '@ids-group-ltd/ids-design-system/components/chart-tooltip';\nimport { sparklineGeometry } from './sparkline.math';\nimport type { SparklinePoint } from './sparkline.math';\nimport type { SparklineScale } from './sparkline.types';\n\n/** A word-sized trend line: no axes, legend or frame, a dot on the last reading, and a tooltip.\n * Sized by `--ds-sparkline-width` and `--ds-sparkline-height`. */\n@Component({\n selector: 'ds-sparkline',\n standalone: true,\n imports: [ChartTooltipDirective],\n templateUrl: './sparkline.component.html',\n styleUrl: './sparkline.component.scss',\n host: {\n '[attr.role]': \"label() ? 'img' : null\",\n '[attr.aria-label]': 'label()',\n '[attr.aria-hidden]': \"label() ? null : 'true'\",\n '[attr.tabindex]': 'focusable() ? 0 : null',\n '(focus)': 'onFocus()',\n '(blur)': 'clearActive()',\n '(keydown)': 'onKeydown($event)',\n },\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SparklineComponent {\n /** Fills the band under the line down to the baseline. The colour is\n * `--ds-sparkline-area-color`, the line's own by default, at `--ds-sparkline-area-opacity`. */\n readonly area = input(false, { transform: booleanAttribute });\n\n /** One reading per step, oldest first. `null` breaks the line. */\n readonly data = input<readonly (number | null)[]>([]);\n\n /** What each reading is, for the tooltip. Left out, the tooltip prints the value alone. */\n readonly categories = input<readonly string[]>([]);\n\n /** Accessible name, and the series name in the tooltip. Left out, the sparkline is decorative\n * and hidden from assistive technology. */\n readonly label = input<string | null>(null);\n\n readonly scale = input<SparklineScale>('data');\n\n /** Shows the reading under the pointer, and under the keyboard where `label` makes the sparkline\n * focusable: focus opens the last reading; arrows, Home and End move. */\n readonly tooltip = input(true, { transform: booleanAttribute });\n\n /** Formats the value the tooltip prints. Unset, the locale's plain number format. */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n private readonly locale = inject(LOCALE_ID);\n\n private readonly canvas =\n viewChild.required<ElementRef<SVGSVGElement>>('canvas');\n\n protected readonly focusable = computed(\n () => this.tooltip() && this.label() !== null,\n );\n\n protected readonly geometry = computed(() =>\n sparklineGeometry(this.data(), this.scale()),\n );\n\n protected readonly activePoint = signal<SparklinePoint | null>(null);\n\n protected readonly shownPoint = computed(\n () => this.activePoint() ?? this.geometry().points.at(-1) ?? null,\n );\n\n protected readonly tooltipOrigin = signal<ChartTooltipOrigin | null>(null);\n\n protected readonly tooltipContext = computed<ChartTooltipContext | null>(\n () => {\n const point = this.activePoint();\n const value = point ? this.data()[point.index] : null;\n if (!point || value == null || !this.tooltip()) {\n return null;\n }\n const format =\n this.valueFormat() ??\n ((reading: number) => reading.toLocaleString(this.locale));\n\n return {\n category: this.categories()[point.index] ?? '',\n entries: [\n {\n label: this.label() ?? '',\n value,\n formatted: format(value),\n color:\n 'var(--ds-sparkline-line-color, var(--ds-chart-series-1-color))',\n },\n ],\n };\n },\n );\n\n protected onPointerMove(event: PointerEvent): void {\n const points = this.geometry().points;\n if (!this.tooltip() || points.length === 0) {\n return;\n }\n const box = this.canvas().nativeElement.getBoundingClientRect();\n const across = ((event.clientX - box.left) / box.width) * 100;\n this.activate(\n points.reduce((best, point) =>\n Math.abs(point.x - across) < Math.abs(best.x - across) ? point : best,\n ),\n );\n }\n\n protected onFocus(): void {\n const last = this.geometry().points.at(-1);\n if (this.focusable() && last) {\n this.activate(last);\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const points = this.geometry().points;\n const current = this.activePoint();\n if (!this.focusable() || !current) {\n return;\n }\n const position = points.indexOf(current);\n const target = {\n ArrowLeft: position - 1,\n ArrowRight: position + 1,\n Home: 0,\n End: points.length - 1,\n }[event.key];\n if (target === undefined) {\n return;\n }\n event.preventDefault();\n this.activate(points[Math.min(Math.max(target, 0), points.length - 1)]);\n }\n\n protected clearActive(): void {\n this.activePoint.set(null);\n this.tooltipOrigin.set(null);\n }\n\n private activate(point: SparklinePoint): void {\n if (point === this.activePoint()) {\n return;\n }\n const box = this.canvas().nativeElement.getBoundingClientRect();\n this.activePoint.set(point);\n this.tooltipOrigin.set({\n x: box.left + (point.x / 100) * box.width,\n y: box.top + (point.y / 100) * box.height,\n });\n }\n}\n","<svg\n #canvas\n class=\"sparkline\"\n aria-hidden=\"true\"\n [dsChartTooltip]=\"tooltipContext()\"\n [dsChartTooltipOrigin]=\"tooltipOrigin()\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerleave)=\"clearActive()\">\n <svg\n viewBox=\"0 0 100 100\"\n preserveAspectRatio=\"none\"\n width=\"100%\"\n height=\"100%\"\n overflow=\"visible\">\n @if (area()) {\n <path\n class=\"area\"\n [attr.d]=\"geometry().areaPath\" />\n }\n\n <path\n class=\"line\"\n [attr.d]=\"geometry().path\" />\n </svg>\n\n @if (shownPoint(); as point) {\n <circle\n class=\"dot\"\n [attr.cx]=\"point.x + '%'\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CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDLY,qBAAqB,EAAA,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,CAAA,gBAAA,EAAA,sBAAA,EAAA,wBAAA,EAAA,wBAAA,EAAA,sBAAA,EAAA,wBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAepB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAlB9B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,cAAc,cACZ,IAAI,EAAA,OAAA,EACP,CAAC,qBAAqB,CAAC,EAAA,IAAA,EAG1B;AACJ,wBAAA,aAAa,EAAE,wBAAwB;AACvC,wBAAA,mBAAmB,EAAE,SAAS;AAC9B,wBAAA,oBAAoB,EAAE,yBAAyB;AAC/C,wBAAA,iBAAiB,EAAE,wBAAwB;AAC3C,wBAAA,SAAS,EAAE,WAAW;AACtB,wBAAA,QAAQ,EAAE,eAAe;AACzB,wBAAA,WAAW,EAAE,mBAAmB;AACjC,qBAAA,EAAA,aAAA,EACc,iBAAiB,CAAC,QAAQ,EAAA,eAAA,EACxB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,itBAAA,EAAA,MAAA,EAAA,CAAA,s4DAAA,CAAA,EAAA;gtBA6BC,QAAQ,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AErE1D;;AAEG;;;;"}
1
+ {"version":3,"file":"ids-group-ltd-ids-design-system-components-sparkline.mjs","sources":["../../../src/lib/components/sparkline/sparkline.math.ts","../../../src/lib/components/sparkline/sparkline.component.ts","../../../src/lib/components/sparkline/sparkline.component.html","../../../src/lib/components/sparkline/ids-group-ltd-ids-design-system-components-sparkline.ts"],"sourcesContent":["import type { SparklineScale } from './sparkline.types';\n\nexport interface SparklinePoint {\n readonly index: number;\n readonly x: number;\n readonly y: number;\n}\n\nexport interface SparklineGeometry {\n readonly path: string;\n /** Each unbroken run of the line closed down to the baseline: zero on the `'zero'` scale, the\n * foot of the box on `'data'`. */\n readonly areaPath: string;\n readonly points: readonly SparklinePoint[];\n}\n\n/** Positions in percent of the box, x across the readings and y down from the top of the scale.\n * A flat series on the `'data'` scale draws through the middle. A `null` breaks the line. */\nexport function sparklineGeometry(\n data: readonly (number | null)[],\n scale: SparklineScale,\n): SparklineGeometry {\n const finite = data.filter(\n (value): value is number => value !== null && Number.isFinite(value),\n );\n if (finite.length === 0) {\n return { path: '', areaPath: '', points: [] };\n }\n const floor = scale === 'zero' ? Math.min(0, ...finite) : Math.min(...finite);\n const ceiling =\n scale === 'zero' ? Math.max(0, ...finite) : Math.max(...finite);\n const span = ceiling - floor;\n const lastIndex = data.length - 1;\n const baseline = scale === 'zero' && span > 0 ? (ceiling / span) * 100 : 100;\n const points: SparklinePoint[] = [];\n const runs: SparklinePoint[][] = [];\n let path = '';\n let penDown = false;\n data.forEach((value, index) => {\n if (value === null || !Number.isFinite(value)) {\n penDown = false;\n\n return;\n }\n const x = lastIndex === 0 ? 50 : (index / lastIndex) * 100;\n const y = span === 0 ? 50 : ((ceiling - value) / span) * 100;\n const point = { index, x, y };\n points.push(point);\n if (penDown) {\n runs[runs.length - 1].push(point);\n } else {\n runs.push([point]);\n }\n path += `${penDown ? 'L' : 'M'}${x} ${y}`;\n penDown = true;\n });\n const areaPath = runs\n .map(\n (run) =>\n `M${run[0].x} ${baseline}` +\n run.map((point) => `L${point.x} ${point.y}`).join('') +\n `L${run[run.length - 1].x} ${baseline}Z`,\n )\n .join('');\n\n return { path, areaPath, points };\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n input,\n signal,\n viewChild,\n} from '@angular/core';\nimport { injectDsLocale } from '@ids-group-ltd/ids-design-system/core';\nimport { ChartTooltipDirective } from '@ids-group-ltd/ids-design-system/components/chart-tooltip';\nimport type {\n ChartTooltipContext,\n ChartTooltipOrigin,\n} from '@ids-group-ltd/ids-design-system/components/chart-tooltip';\nimport { sparklineGeometry } from './sparkline.math';\nimport type { SparklinePoint } from './sparkline.math';\nimport type { SparklineScale } from './sparkline.types';\n\n/** A word-sized trend line: no axes, legend or frame, a dot on the last reading, and a tooltip.\n * Sized by `--ds-sparkline-width` and `--ds-sparkline-height`. */\n@Component({\n selector: 'ds-sparkline',\n standalone: true,\n imports: [ChartTooltipDirective],\n templateUrl: './sparkline.component.html',\n styleUrl: './sparkline.component.scss',\n host: {\n '[attr.role]': \"label() ? 'img' : null\",\n '[attr.aria-label]': 'label()',\n '[attr.aria-hidden]': \"label() ? null : 'true'\",\n '[attr.tabindex]': 'focusable() ? 0 : null',\n '(focus)': 'onFocus()',\n '(blur)': 'clearActive()',\n '(keydown)': 'onKeydown($event)',\n },\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SparklineComponent {\n /** Fills the band under the line down to the baseline. The colour is\n * `--ds-sparkline-area-color`, the line's own by default, at `--ds-sparkline-area-opacity`. */\n readonly area = input(false, { transform: booleanAttribute });\n\n /** One reading per step, oldest first. `null` breaks the line. */\n readonly data = input<readonly (number | null)[]>([]);\n\n /** What each reading is, for the tooltip. Left out, the tooltip prints the value alone. */\n readonly categories = input<readonly string[]>([]);\n\n /** Accessible name, and the series name in the tooltip. Left out, the sparkline is decorative\n * and hidden from assistive technology. */\n readonly label = input<string | null>(null);\n\n readonly scale = input<SparklineScale>('data');\n\n /** Shows the reading under the pointer, and under the keyboard where `label` makes the sparkline\n * focusable: focus opens the last reading; arrows, Home and End move. */\n readonly tooltip = input(true, { transform: booleanAttribute });\n\n /** Formats the value the tooltip prints. Unset, the locale's plain number format. */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n private readonly locale = injectDsLocale();\n\n private readonly canvas =\n viewChild.required<ElementRef<SVGSVGElement>>('canvas');\n\n protected readonly focusable = computed(\n () => this.tooltip() && this.label() !== null,\n );\n\n protected readonly geometry = computed(() =>\n sparklineGeometry(this.data(), this.scale()),\n );\n\n protected readonly activePoint = signal<SparklinePoint | null>(null);\n\n protected readonly shownPoint = computed(\n () => this.activePoint() ?? this.geometry().points.at(-1) ?? null,\n );\n\n protected readonly tooltipOrigin = signal<ChartTooltipOrigin | null>(null);\n\n protected readonly tooltipContext = computed<ChartTooltipContext | null>(\n () => {\n const point = this.activePoint();\n const value = point ? this.data()[point.index] : null;\n if (!point || value == null || !this.tooltip()) {\n return null;\n }\n const format =\n this.valueFormat() ??\n ((reading: number) => reading.toLocaleString(this.locale));\n\n return {\n category: this.categories()[point.index] ?? '',\n entries: [\n {\n label: this.label() ?? '',\n value,\n formatted: format(value),\n color:\n 'var(--ds-sparkline-line-color, var(--ds-chart-series-1-color))',\n },\n ],\n };\n },\n );\n\n protected onPointerMove(event: PointerEvent): void {\n const points = this.geometry().points;\n if (!this.tooltip() || points.length === 0) {\n return;\n }\n const box = this.canvas().nativeElement.getBoundingClientRect();\n const across = ((event.clientX - box.left) / box.width) * 100;\n this.activate(\n points.reduce((best, point) =>\n Math.abs(point.x - across) < Math.abs(best.x - across) ? point : best,\n ),\n );\n }\n\n protected onFocus(): void {\n const last = this.geometry().points.at(-1);\n if (this.focusable() && last) {\n this.activate(last);\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const points = this.geometry().points;\n const current = this.activePoint();\n if (!this.focusable() || !current) {\n return;\n }\n const position = points.indexOf(current);\n const target = {\n ArrowLeft: position - 1,\n ArrowRight: position + 1,\n Home: 0,\n End: points.length - 1,\n }[event.key];\n if (target === undefined) {\n return;\n }\n event.preventDefault();\n this.activate(points[Math.min(Math.max(target, 0), points.length - 1)]);\n }\n\n protected clearActive(): void {\n this.activePoint.set(null);\n this.tooltipOrigin.set(null);\n }\n\n private activate(point: SparklinePoint): void {\n if (point === this.activePoint()) {\n return;\n }\n const box = this.canvas().nativeElement.getBoundingClientRect();\n this.activePoint.set(point);\n this.tooltipOrigin.set({\n x: box.left + (point.x / 100) * box.width,\n y: box.top + (point.y / 100) * box.height,\n });\n }\n}\n","<svg\n #canvas\n class=\"sparkline\"\n aria-hidden=\"true\"\n [dsChartTooltip]=\"tooltipContext()\"\n [dsChartTooltipOrigin]=\"tooltipOrigin()\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerleave)=\"clearActive()\">\n <svg\n viewBox=\"0 0 100 100\"\n preserveAspectRatio=\"none\"\n width=\"100%\"\n height=\"100%\"\n overflow=\"visible\">\n @if (area()) {\n <path\n class=\"area\"\n [attr.d]=\"geometry().areaPath\" />\n }\n\n <path\n class=\"line\"\n [attr.d]=\"geometry().path\" />\n </svg>\n\n @if (shownPoint(); as point) {\n <circle\n class=\"dot\"\n [attr.cx]=\"point.x + '%'\"\n [attr.cy]=\"point.y + '%'\" />\n }\n</svg>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAgBA;AAC8F;AACxF,SAAU,iBAAiB,CAC/B,IAAgC,EAChC,KAAqB,EAAA;IAErB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CACxB,CAAC,KAAK,KAAsB,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CACrE;AACD,IAAA,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;AACvB,QAAA,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;IAC/C;IACA,MAAM,KAAK,GAAG,KAAK,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IAC7E,MAAM,OAAO,GACX,KAAK,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,G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AiB,CAAC,QAAQ,EAAA,eAAA,EACxB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,itBAAA,EAAA,MAAA,EAAA,CAAA,s4DAAA,CAAA,EAAA;gtBA6BC,QAAQ,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AEpE1D;;AAEG;;;;"}
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { model, input, booleanAttribute, output, computed, forwardRef, ViewEncapsulation, Component } from '@angular/core';
3
3
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
4
  import { DsBooleanControlValueAccessor, nextControlId, resolveFieldMessage } from '@ids-group-ltd/ids-design-system/components';
5
- import { FieldMessageComponent } from '@ids-group-ltd/ids-design-system/components/field-message';
5
+ import { FieldMessageComponent, FieldStatusComponent } from '@ids-group-ltd/ids-design-system/components/field-message';
6
6
  import { resolveWithConfig } from '@ids-group-ltd/ids-design-system/core';
7
7
 
8
8
  class SwitchComponent extends DsBooleanControlValueAccessor {
@@ -36,8 +36,11 @@ class SwitchComponent extends DsBooleanControlValueAccessor {
36
36
  isDisabled = computed(() => this.disabled() || this.formDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
37
37
  uid = nextControlId('ds-switch');
38
38
  controlId = computed(() => this.inputId() ?? this.uid, ...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
39
- hintId = computed(() => this.message().text ? `${this.uid}-hint` : null, ...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
39
+ hintId = computed(() => this.message().text || this.changedShown() ? `${this.uid}-hint` : null, ...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
40
40
  fieldMessage = resolveFieldMessage({
41
+ pending: this.pending,
42
+ dirty: this.dirty,
43
+ showDirty: this.showDirtyResolved,
41
44
  disabled: () => this.isDisabled(),
42
45
  hint: this.hint,
43
46
  warning: this.warning,
@@ -48,6 +51,8 @@ class SwitchComponent extends DsBooleanControlValueAccessor {
48
51
  touched: this.touched,
49
52
  });
50
53
  message = this.fieldMessage.message;
54
+ pendingShown = this.fieldMessage.pending;
55
+ changedShown = this.fieldMessage.changed;
51
56
  resolvedAriaLabel = computed(() => this.label() ? null : this.ariaLabel() || null, ...(ngDevMode ? [{ debugName: "resolvedAriaLabel" }] : /* istanbul ignore next */ []));
52
57
  invalidResolved = this.fieldMessage.invalid;
53
58
  switchClasses = computed(() => {
@@ -72,17 +77,17 @@ class SwitchComponent extends DsBooleanControlValueAccessor {
72
77
  useExisting: forwardRef(() => SwitchComponent),
73
78
  multi: true,
74
79
  },
75
- ], usesInheritance: true, ngImport: i0, template: "<div [class]=\"fieldClass()\">\n <span\n class=\"control-line\"\n [class.is-disabled]=\"isDisabled()\">\n <input\n type=\"checkbox\"\n role=\"switch\"\n [class]=\"switchClasses()\"\n [checked]=\"checked()\"\n [attr.aria-checked]=\"checked()\"\n [disabled]=\"isDisabled()\"\n [attr.name]=\"name()\"\n [attr.id]=\"controlId()\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n (click)=\"onClick($event)\"\n (change)=\"onCheckedChange($event)\"\n (blur)=\"markTouched()\" />\n\n <label\n class=\"control-text\"\n [attr.for]=\"controlId()\">\n @if (label()) {\n {{ label() }}\n @if (required()) {\n <span\n class=\"req\"\n aria-hidden=\"true\">\n *\n </span>\n }\n } @else {\n <ng-content></ng-content>\n }\n </label>\n </span>\n\n <ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [reserve]=\"reserveMessageResolved()\" />\n</div>\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}:host{--_switch-track-w: var(--switch-track-w);--_switch-track-h: var(--switch-track-h);--_switch-thumb-size: var(--switch-thumb-size);--_switch-thumb-pad: var(--switch-thumb-pad);--_switch-label-fs: var(--font-size-s);--_switch-track-on-bg-color: var(--ds-switch-track-on-bg-color, var(--accent));--_switch-track-off-bg-color: var(--ds-switch-track-off-bg-color, var(--border-strong));--_switch-thumb-bg-color: var(--ds-switch-thumb-bg-color, var(--surface-default));display:inline-flex}.switch-field{display:inline-flex;flex-direction:column;align-items:flex-start;gap:var(--field-label-gap)}.switch-field.size-sm{--_switch-track-w: 26px;--_switch-track-h: 14px;--_switch-thumb-size: 10px;--_switch-thumb-pad: var(--switch-thumb-pad);--_switch-label-fs: var(--font-size-xs)}.switch-field.size-lg{--_switch-track-w: 48px;--_switch-track-h: 26px;--_switch-thumb-size: 22px;--_switch-thumb-pad: var(--switch-thumb-pad);--_switch-label-fs: var(--font-size-m)}.control-line:has(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}@media not (forced-colors:active){.control-line .switch:where(:focus-visible){outline:none}}.control-line{border-radius:var(--focus-ring-radius)}.control-line:has(.control-text:empty){--focus-ring-offset: var(--space-1-5)}.control-line{display:inline-flex;align-items:center}.control-line .control-text{padding-inline-start:var(--space-2);padding-block:var(--space-1);margin-block:calc(var(--space-1) * -1);font:var(--font-weight-regular) var(--ds-switch-label-font-size, var(--_switch-label-fs))/var(--line-height-base) var(--font-sans);color:var(--ds-switch-label-color, var(--text-primary));cursor:pointer;-webkit-user-select:none;user-select:none}.control-line .control-text:empty{display:none}.control-line .control-text .req{color:var(--error);font-weight:var(--font-weight-semibold);margin-inline-start:var(--space-1)}.control-line.is-disabled .control-text{color:var(--text-disabled);cursor:not-allowed}.switch{appearance:none;width:var(--_switch-track-w);height:var(--_switch-track-h);background:var(--_switch-track-off-bg-color);border-radius:var(--radius-pill);position:relative;cursor:pointer;flex-shrink:0;margin:0;transition:background-color var(--duration-base) var(--ease-standard)}.switch:after{content:\"\";position:absolute;top:var(--_switch-thumb-pad);left:var(--_switch-thumb-pad);width:var(--_switch-thumb-size);height:var(--_switch-thumb-size);background:var(--_switch-thumb-bg-color);border-radius:var(--radius-pill);box-shadow:var(--shadow-1);transition:transform var(--duration-base) var(--ease-standard),box-shadow var(--duration-base) var(--ease-standard)}.switch:checked{background:var(--_switch-track-on-bg-color)}.switch:checked:after{transform:translate(calc(var(--_switch-track-w) - var(--_switch-thumb-size) - 2 * var(--_switch-thumb-pad)))}.switch:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.switch:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.switch.success:checked{background:var(--success)}.switch.error:checked{background:var(--error)}\n"], dependencies: [{ kind: "component", type: FieldMessageComponent, selector: "ds-field-message", inputs: ["text", "state", "messageId", "icon", "reserve"] }] });
80
+ ], usesInheritance: true, ngImport: i0, template: "<div [class]=\"fieldClass()\">\n <span\n class=\"control-line\"\n [class.is-disabled]=\"isDisabled()\">\n <input\n type=\"checkbox\"\n role=\"switch\"\n [class]=\"switchClasses()\"\n [checked]=\"checked()\"\n [attr.aria-checked]=\"checked()\"\n [disabled]=\"isDisabled()\"\n [attr.name]=\"name()\"\n [attr.id]=\"controlId()\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n (click)=\"onClick($event)\"\n (change)=\"onCheckedChange($event)\"\n (blur)=\"markTouched()\" />\n\n <label\n class=\"control-text\"\n [attr.for]=\"controlId()\">\n @if (label()) {\n {{ label() }}\n @if (required()) {\n <span\n class=\"req\"\n aria-hidden=\"true\">\n *\n </span>\n }\n } @else {\n <ng-content></ng-content>\n }\n </label>\n\n <ds-field-status\n [pending]=\"pendingShown()\"\n [changed]=\"changedShown()\" />\n </span>\n\n <ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [reserve]=\"reserveMessageResolved()\"\n [changed]=\"changedShown()\" />\n</div>\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}:host{--_switch-track-w: var(--switch-track-w);--_switch-track-h: var(--switch-track-h);--_switch-thumb-size: var(--switch-thumb-size);--_switch-thumb-pad: var(--switch-thumb-pad);--_switch-label-fs: var(--font-size-s);--_switch-track-on-bg-color: var(--ds-switch-track-on-bg-color, var(--accent));--_switch-track-off-bg-color: var(--ds-switch-track-off-bg-color, var(--border-strong));--_switch-thumb-bg-color: var(--ds-switch-thumb-bg-color, var(--surface-default));display:inline-flex}.switch-field{display:inline-flex;flex-direction:column;align-items:flex-start;gap:var(--field-label-gap)}.switch-field.size-sm{--_switch-track-w: 26px;--_switch-track-h: 14px;--_switch-thumb-size: 10px;--_switch-thumb-pad: var(--switch-thumb-pad);--_switch-label-fs: var(--font-size-xs)}.switch-field.size-lg{--_switch-track-w: 48px;--_switch-track-h: 26px;--_switch-thumb-size: 22px;--_switch-thumb-pad: var(--switch-thumb-pad);--_switch-label-fs: var(--font-size-m)}.control-line:has(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}@media not (forced-colors:active){.control-line .switch:where(:focus-visible){outline:none}}.control-line{border-radius:var(--focus-ring-radius)}.control-line:has(.control-text:empty){--focus-ring-offset: var(--space-1-5)}.control-line{display:inline-flex;align-items:center}.control-line .control-text{padding-inline-start:var(--space-2);padding-block:var(--space-1);margin-block:calc(var(--space-1) * -1);font:var(--font-weight-regular) var(--ds-switch-label-font-size, var(--_switch-label-fs))/var(--line-height-base) var(--font-sans);color:var(--ds-switch-label-color, var(--text-primary));cursor:pointer;-webkit-user-select:none;user-select:none}.control-line .control-text:empty{display:none}.control-line .control-text .req{color:var(--error);font-weight:var(--font-weight-semibold);margin-inline-start:var(--space-1)}.control-line.is-disabled .control-text{color:var(--text-disabled);cursor:not-allowed}.control-line ds-field-status{margin-inline-start:var(--space-2)}.switch{appearance:none;width:var(--_switch-track-w);height:var(--_switch-track-h);background:var(--_switch-track-off-bg-color);border-radius:var(--radius-pill);position:relative;cursor:pointer;flex-shrink:0;margin:0;transition:background-color var(--duration-base) var(--ease-standard)}.switch:after{content:\"\";position:absolute;top:var(--_switch-thumb-pad);left:var(--_switch-thumb-pad);width:var(--_switch-thumb-size);height:var(--_switch-thumb-size);background:var(--_switch-thumb-bg-color);border-radius:var(--radius-pill);box-shadow:var(--shadow-1);transition:transform var(--duration-base) var(--ease-standard),box-shadow var(--duration-base) var(--ease-standard)}.switch:checked{background:var(--_switch-track-on-bg-color)}.switch:checked:after{transform:translate(calc(var(--_switch-track-w) - var(--_switch-thumb-size) - 2 * var(--_switch-thumb-pad)))}.switch:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.switch:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.switch.success:checked{background:var(--success)}.switch.error:checked{background:var(--error)}\n"], dependencies: [{ kind: "component", type: FieldMessageComponent, selector: "ds-field-message", inputs: ["text", "state", "messageId", "icon", "reserve", "changed"] }, { kind: "component", type: FieldStatusComponent, selector: "ds-field-status", inputs: ["pending", "changed"] }] });
76
81
  }
77
82
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: SwitchComponent, decorators: [{
78
83
  type: Component,
79
- args: [{ selector: 'ds-switch', standalone: true, imports: [FieldMessageComponent], encapsulation: ViewEncapsulation.Emulated, providers: [
84
+ args: [{ selector: 'ds-switch', standalone: true, imports: [FieldMessageComponent, FieldStatusComponent], encapsulation: ViewEncapsulation.Emulated, providers: [
80
85
  {
81
86
  provide: NG_VALUE_ACCESSOR,
82
87
  useExisting: forwardRef(() => SwitchComponent),
83
88
  multi: true,
84
89
  },
85
- ], template: "<div [class]=\"fieldClass()\">\n <span\n class=\"control-line\"\n [class.is-disabled]=\"isDisabled()\">\n <input\n type=\"checkbox\"\n role=\"switch\"\n [class]=\"switchClasses()\"\n [checked]=\"checked()\"\n [attr.aria-checked]=\"checked()\"\n [disabled]=\"isDisabled()\"\n [attr.name]=\"name()\"\n [attr.id]=\"controlId()\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n (click)=\"onClick($event)\"\n (change)=\"onCheckedChange($event)\"\n (blur)=\"markTouched()\" />\n\n <label\n class=\"control-text\"\n [attr.for]=\"controlId()\">\n @if (label()) {\n {{ label() }}\n @if (required()) {\n <span\n class=\"req\"\n aria-hidden=\"true\">\n *\n </span>\n }\n } @else {\n <ng-content></ng-content>\n }\n </label>\n </span>\n\n <ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [reserve]=\"reserveMessageResolved()\" />\n</div>\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}:host{--_switch-track-w: var(--switch-track-w);--_switch-track-h: var(--switch-track-h);--_switch-thumb-size: var(--switch-thumb-size);--_switch-thumb-pad: var(--switch-thumb-pad);--_switch-label-fs: var(--font-size-s);--_switch-track-on-bg-color: var(--ds-switch-track-on-bg-color, var(--accent));--_switch-track-off-bg-color: var(--ds-switch-track-off-bg-color, var(--border-strong));--_switch-thumb-bg-color: var(--ds-switch-thumb-bg-color, var(--surface-default));display:inline-flex}.switch-field{display:inline-flex;flex-direction:column;align-items:flex-start;gap:var(--field-label-gap)}.switch-field.size-sm{--_switch-track-w: 26px;--_switch-track-h: 14px;--_switch-thumb-size: 10px;--_switch-thumb-pad: var(--switch-thumb-pad);--_switch-label-fs: var(--font-size-xs)}.switch-field.size-lg{--_switch-track-w: 48px;--_switch-track-h: 26px;--_switch-thumb-size: 22px;--_switch-thumb-pad: var(--switch-thumb-pad);--_switch-label-fs: var(--font-size-m)}.control-line:has(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}@media not (forced-colors:active){.control-line .switch:where(:focus-visible){outline:none}}.control-line{border-radius:var(--focus-ring-radius)}.control-line:has(.control-text:empty){--focus-ring-offset: var(--space-1-5)}.control-line{display:inline-flex;align-items:center}.control-line .control-text{padding-inline-start:var(--space-2);padding-block:var(--space-1);margin-block:calc(var(--space-1) * -1);font:var(--font-weight-regular) var(--ds-switch-label-font-size, var(--_switch-label-fs))/var(--line-height-base) var(--font-sans);color:var(--ds-switch-label-color, var(--text-primary));cursor:pointer;-webkit-user-select:none;user-select:none}.control-line .control-text:empty{display:none}.control-line .control-text .req{color:var(--error);font-weight:var(--font-weight-semibold);margin-inline-start:var(--space-1)}.control-line.is-disabled .control-text{color:var(--text-disabled);cursor:not-allowed}.switch{appearance:none;width:var(--_switch-track-w);height:var(--_switch-track-h);background:var(--_switch-track-off-bg-color);border-radius:var(--radius-pill);position:relative;cursor:pointer;flex-shrink:0;margin:0;transition:background-color var(--duration-base) var(--ease-standard)}.switch:after{content:\"\";position:absolute;top:var(--_switch-thumb-pad);left:var(--_switch-thumb-pad);width:var(--_switch-thumb-size);height:var(--_switch-thumb-size);background:var(--_switch-thumb-bg-color);border-radius:var(--radius-pill);box-shadow:var(--shadow-1);transition:transform var(--duration-base) var(--ease-standard),box-shadow var(--duration-base) var(--ease-standard)}.switch:checked{background:var(--_switch-track-on-bg-color)}.switch:checked:after{transform:translate(calc(var(--_switch-track-w) - var(--_switch-thumb-size) - 2 * var(--_switch-thumb-pad)))}.switch:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.switch:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.switch.success:checked{background:var(--success)}.switch.error:checked{background:var(--error)}\n"] }]
90
+ ], template: "<div [class]=\"fieldClass()\">\n <span\n class=\"control-line\"\n [class.is-disabled]=\"isDisabled()\">\n <input\n type=\"checkbox\"\n role=\"switch\"\n [class]=\"switchClasses()\"\n [checked]=\"checked()\"\n [attr.aria-checked]=\"checked()\"\n [disabled]=\"isDisabled()\"\n [attr.name]=\"name()\"\n [attr.id]=\"controlId()\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n (click)=\"onClick($event)\"\n (change)=\"onCheckedChange($event)\"\n (blur)=\"markTouched()\" />\n\n <label\n class=\"control-text\"\n [attr.for]=\"controlId()\">\n @if (label()) {\n {{ label() }}\n @if (required()) {\n <span\n class=\"req\"\n aria-hidden=\"true\">\n *\n </span>\n }\n } @else {\n <ng-content></ng-content>\n }\n </label>\n\n <ds-field-status\n [pending]=\"pendingShown()\"\n [changed]=\"changedShown()\" />\n </span>\n\n <ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [reserve]=\"reserveMessageResolved()\"\n [changed]=\"changedShown()\" />\n</div>\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}:host{--_switch-track-w: var(--switch-track-w);--_switch-track-h: var(--switch-track-h);--_switch-thumb-size: var(--switch-thumb-size);--_switch-thumb-pad: var(--switch-thumb-pad);--_switch-label-fs: var(--font-size-s);--_switch-track-on-bg-color: var(--ds-switch-track-on-bg-color, var(--accent));--_switch-track-off-bg-color: var(--ds-switch-track-off-bg-color, var(--border-strong));--_switch-thumb-bg-color: var(--ds-switch-thumb-bg-color, var(--surface-default));display:inline-flex}.switch-field{display:inline-flex;flex-direction:column;align-items:flex-start;gap:var(--field-label-gap)}.switch-field.size-sm{--_switch-track-w: 26px;--_switch-track-h: 14px;--_switch-thumb-size: 10px;--_switch-thumb-pad: var(--switch-thumb-pad);--_switch-label-fs: var(--font-size-xs)}.switch-field.size-lg{--_switch-track-w: 48px;--_switch-track-h: 26px;--_switch-thumb-size: 22px;--_switch-thumb-pad: var(--switch-thumb-pad);--_switch-label-fs: var(--font-size-m)}.control-line:has(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}@media not (forced-colors:active){.control-line .switch:where(:focus-visible){outline:none}}.control-line{border-radius:var(--focus-ring-radius)}.control-line:has(.control-text:empty){--focus-ring-offset: var(--space-1-5)}.control-line{display:inline-flex;align-items:center}.control-line .control-text{padding-inline-start:var(--space-2);padding-block:var(--space-1);margin-block:calc(var(--space-1) * -1);font:var(--font-weight-regular) var(--ds-switch-label-font-size, var(--_switch-label-fs))/var(--line-height-base) var(--font-sans);color:var(--ds-switch-label-color, var(--text-primary));cursor:pointer;-webkit-user-select:none;user-select:none}.control-line .control-text:empty{display:none}.control-line .control-text .req{color:var(--error);font-weight:var(--font-weight-semibold);margin-inline-start:var(--space-1)}.control-line.is-disabled .control-text{color:var(--text-disabled);cursor:not-allowed}.control-line ds-field-status{margin-inline-start:var(--space-2)}.switch{appearance:none;width:var(--_switch-track-w);height:var(--_switch-track-h);background:var(--_switch-track-off-bg-color);border-radius:var(--radius-pill);position:relative;cursor:pointer;flex-shrink:0;margin:0;transition:background-color var(--duration-base) var(--ease-standard)}.switch:after{content:\"\";position:absolute;top:var(--_switch-thumb-pad);left:var(--_switch-thumb-pad);width:var(--_switch-thumb-size);height:var(--_switch-thumb-size);background:var(--_switch-thumb-bg-color);border-radius:var(--radius-pill);box-shadow:var(--shadow-1);transition:transform var(--duration-base) var(--ease-standard),box-shadow var(--duration-base) var(--ease-standard)}.switch:checked{background:var(--_switch-track-on-bg-color)}.switch:checked:after{transform:translate(calc(var(--_switch-track-w) - var(--_switch-thumb-size) - 2 * var(--_switch-thumb-pad)))}.switch:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.switch:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.switch.success:checked{background:var(--success)}.switch.error:checked{background:var(--error)}\n"] }]
86
91
  }], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], controlled: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlled", required: false }] }], checkedRequested: [{ type: i0.Output, args: ["checkedRequested"] }] } });
87
92
 
88
93
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ids-group-ltd-ids-design-system-components-switch.mjs","sources":["../../../src/lib/components/switch/switch.component.ts","../../../src/lib/components/switch/switch.component.html","../../../src/lib/components/switch/ids-group-ltd-ids-design-system-components-switch.ts"],"sourcesContent":["import {\n Component,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n forwardRef,\n input,\n model,\n output,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { DsBooleanControlValueAccessor } from '@ids-group-ltd/ids-design-system/components';\nimport { FieldMessageComponent } from '@ids-group-ltd/ids-design-system/components/field-message';\nimport { resolveFieldMessage } from '@ids-group-ltd/ids-design-system/components';\nimport { nextControlId } from '@ids-group-ltd/ids-design-system/components';\nimport type { DsSize } from '@ids-group-ltd/ids-design-system/core';\nimport { resolveWithConfig } from '@ids-group-ltd/ids-design-system/core';\n\n@Component({\n selector: 'ds-switch',\n standalone: true,\n imports: [FieldMessageComponent],\n templateUrl: './switch.component.html',\n styleUrl: './switch.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SwitchComponent),\n multi: true,\n },\n ],\n})\nexport class SwitchComponent extends DsBooleanControlValueAccessor {\n /** On/off state, two-way bound. */\n readonly checked = model<boolean>(false);\n /** Disables the switch and blocks all interaction. */\n readonly disabled = input(false, { transform: booleanAttribute });\n /** Native `name` attribute. */\n readonly name = input<string | null>(null);\n /** Track colour when checked. */\n readonly variant = input<'default' | 'success' | 'error'>('default');\n /** Overrides the generated id of the native `<input>` and its `<label for>`. */\n readonly inputId = input<string | null>(null);\n /** Unset falls back to `DS_CONFIG.control.size`, then `'md'`. */\n readonly size = input<DsSize | null>(null);\n readonly sizeResolved = resolveWithConfig(\n this.size,\n (config) => config.control?.size,\n 'md' as DsSize,\n );\n /** Shows an asterisk and sets `aria-required`. */\n readonly required = input(false, { transform: booleanAttribute });\n /** Label beside the track, wired via for/id. Omit to bring your own <label>. */\n readonly label = input<string>('');\n /** Accessible name for a control with no visible label; overrides `label` when both are set. */\n readonly ariaLabel = input<string | null>(null);\n /**\n * The switch never flips itself: a click or Space cancels the native toggle and\n * `checkedRequested` carries the value the user asked for. It moves only when\n * `checked` changes from outside, so a cancelled confirmation changes nothing.\n */\n readonly controlled = input(false, { transform: booleanAttribute });\n /** The value the user asked for, emitted in place of a flip when `controlled`. Silent otherwise. */\n readonly checkedRequested = output<boolean>();\n\n protected readonly isDisabled = computed(\n () => this.disabled() || this.formDisabled(),\n );\n\n protected readonly uid = nextControlId('ds-switch');\n protected readonly controlId = computed(() => this.inputId() ?? this.uid);\n protected readonly hintId = computed(() =>\n this.message().text ? `${this.uid}-hint` : null,\n );\n private readonly fieldMessage = resolveFieldMessage({\n disabled: () => this.isDisabled(),\n hint: this.hint,\n warning: this.warning,\n error: this.error,\n errors: this.errors,\n invalid: this.invalid,\n touchedSelf: this.touchedSelf,\n touched: this.touched,\n });\n protected readonly message = this.fieldMessage.message;\n protected readonly resolvedAriaLabel = computed(() =>\n this.label() ? null : this.ariaLabel() || null,\n );\n protected readonly invalidResolved = this.fieldMessage.invalid;\n\n protected readonly switchClasses = computed(() => {\n const variant = this.variant();\n\n return variant === 'default' ? 'switch' : `switch ${variant}`;\n });\n\n protected readonly fieldClass = computed(\n () => `switch-field size-${this.sizeResolved()}`,\n );\n\n protected onCheckedChange(event: Event): void {\n this.checked.set((event.target as HTMLInputElement).checked);\n }\n\n protected onClick(event: MouseEvent): void {\n if (!this.controlled()) {\n return;\n }\n event.preventDefault();\n this.checkedRequested.emit(!this.checked());\n }\n}\n","<div [class]=\"fieldClass()\">\n <span\n class=\"control-line\"\n [class.is-disabled]=\"isDisabled()\">\n <input\n type=\"checkbox\"\n role=\"switch\"\n [class]=\"switchClasses()\"\n [checked]=\"checked()\"\n [attr.aria-checked]=\"checked()\"\n [disabled]=\"isDisabled()\"\n [attr.name]=\"name()\"\n [attr.id]=\"controlId()\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n (click)=\"onClick($event)\"\n (change)=\"onCheckedChange($event)\"\n (blur)=\"markTouched()\" />\n\n <label\n class=\"control-text\"\n [attr.for]=\"controlId()\">\n @if (label()) {\n {{ label() }}\n @if (required()) {\n <span\n class=\"req\"\n aria-hidden=\"true\">\n *\n </span>\n }\n } @else {\n <ng-content></ng-content>\n }\n </label>\n </span>\n\n <ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [reserve]=\"reserveMessageResolved()\" />\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAiCM,MAAO,eAAgB,SAAQ,6BAA6B,CAAA;;AAEvD,IAAA,OAAO,GAAG,KAAK,CAAU,KAAK,8EAAC;;IAE/B,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;AAExD,IAAA,IAAI,GAAG,KAAK,CAAgB,IAAI,2EAAC;;AAEjC,IAAA,OAAO,GAAG,KAAK,CAAkC,SAAS,8EAAC;;AAE3D,IAAA,OAAO,GAAG,KAAK,CAAgB,IAAI,8EAAC;;AAEpC,IAAA,IAAI,GAAG,KAAK,CAAgB,IAAI,2EAAC;IACjC,YAAY,GAAG,iBAAiB,CACvC,IAAI,CAAC,IAAI,EACT,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO,EAAE,IAAI,EAChC,IAAc,CACf;;IAEQ,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;AAExD,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,4EAAC;;AAEzB,IAAA,SAAS,GAAG,KAAK,CAAgB,IAAI,gFAAC;AAC/C;;;;AAIG;IACM,UAAU,GAAG,KAAK,CAAC,KAAK,kFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAE1D,gBAAgB,GAAG,MAAM,EAAW;AAE1B,IAAA,UAAU,GAAG,QAAQ,CACtC,MAAM,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,YAAY,EAAE,iFAC7C;AAEkB,IAAA,GAAG,GAAG,aAAa,CAAC,WAAW,CAAC;AAChC,IAAA,SAAS,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,IAAI,IAAI,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A,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,OAAA,EAAA,WAAA,EAAA,MAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;4FAYpB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAf3B,SAAS;+BACE,WAAW,EAAA,UAAA,EACT,IAAI,EAAA,OAAA,EACP,CAAC,qBAAqB,CAAC,EAAA,aAAA,EAGjB,iBAAiB,CAAC,QAAQ,EAAA,SAAA,EAC9B;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,qBAAqB,CAAC;AAC9C,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA,EAAA,QAAA,EAAA,2vCAAA,EAAA,MAAA,EAAA,CAAA,k1HAAA,CAAA,EAAA;;;AE/BH;;AAEG;;;;"}
1
+ {"version":3,"file":"ids-group-ltd-ids-design-system-components-switch.mjs","sources":["../../../src/lib/components/switch/switch.component.ts","../../../src/lib/components/switch/switch.component.html","../../../src/lib/components/switch/ids-group-ltd-ids-design-system-components-switch.ts"],"sourcesContent":["import {\n Component,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n forwardRef,\n input,\n model,\n output,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { DsBooleanControlValueAccessor } from '@ids-group-ltd/ids-design-system/components';\nimport {\n FieldMessageComponent,\n FieldStatusComponent,\n} from '@ids-group-ltd/ids-design-system/components/field-message';\nimport { resolveFieldMessage } from '@ids-group-ltd/ids-design-system/components';\nimport { nextControlId } from '@ids-group-ltd/ids-design-system/components';\nimport type { DsSize } from '@ids-group-ltd/ids-design-system/core';\nimport { resolveWithConfig } from '@ids-group-ltd/ids-design-system/core';\n\n@Component({\n selector: 'ds-switch',\n standalone: true,\n imports: [FieldMessageComponent, FieldStatusComponent],\n templateUrl: './switch.component.html',\n styleUrl: './switch.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SwitchComponent),\n multi: true,\n },\n ],\n})\nexport class SwitchComponent extends DsBooleanControlValueAccessor {\n /** On/off state, two-way bound. */\n readonly checked = model<boolean>(false);\n /** Disables the switch and blocks all interaction. */\n readonly disabled = input(false, { transform: booleanAttribute });\n /** Native `name` attribute. */\n readonly name = input<string | null>(null);\n /** Track colour when checked. */\n readonly variant = input<'default' | 'success' | 'error'>('default');\n /** Overrides the generated id of the native `<input>` and its `<label for>`. */\n readonly inputId = input<string | null>(null);\n /** Unset falls back to `DS_CONFIG.control.size`, then `'md'`. */\n readonly size = input<DsSize | null>(null);\n readonly sizeResolved = resolveWithConfig(\n this.size,\n (config) => config.control?.size,\n 'md' as DsSize,\n );\n /** Shows an asterisk and sets `aria-required`. */\n readonly required = input(false, { transform: booleanAttribute });\n /** Label beside the track, wired via for/id. Omit to bring your own <label>. */\n readonly label = input<string>('');\n /** Accessible name for a control with no visible label; overrides `label` when both are set. */\n readonly ariaLabel = input<string | null>(null);\n /**\n * The switch never flips itself: a click or Space cancels the native toggle and\n * `checkedRequested` carries the value the user asked for. It moves only when\n * `checked` changes from outside, so a cancelled confirmation changes nothing.\n */\n readonly controlled = input(false, { transform: booleanAttribute });\n /** The value the user asked for, emitted in place of a flip when `controlled`. Silent otherwise. */\n readonly checkedRequested = output<boolean>();\n\n protected readonly isDisabled = computed(\n () => this.disabled() || this.formDisabled(),\n );\n\n protected readonly uid = nextControlId('ds-switch');\n protected readonly controlId = computed(() => this.inputId() ?? this.uid);\n protected readonly hintId = computed(() =>\n this.message().text || this.changedShown() ? `${this.uid}-hint` : null,\n );\n private readonly fieldMessage = resolveFieldMessage({\n pending: this.pending,\n dirty: this.dirty,\n showDirty: this.showDirtyResolved,\n disabled: () => this.isDisabled(),\n hint: this.hint,\n warning: this.warning,\n error: this.error,\n errors: this.errors,\n invalid: this.invalid,\n touchedSelf: this.touchedSelf,\n touched: this.touched,\n });\n protected readonly message = this.fieldMessage.message;\n protected readonly pendingShown = this.fieldMessage.pending;\n protected readonly changedShown = this.fieldMessage.changed;\n protected readonly resolvedAriaLabel = computed(() =>\n this.label() ? null : this.ariaLabel() || null,\n );\n protected readonly invalidResolved = this.fieldMessage.invalid;\n\n protected readonly switchClasses = computed(() => {\n const variant = this.variant();\n\n return variant === 'default' ? 'switch' : `switch ${variant}`;\n });\n\n protected readonly fieldClass = computed(\n () => `switch-field size-${this.sizeResolved()}`,\n );\n\n protected onCheckedChange(event: Event): void {\n this.checked.set((event.target as HTMLInputElement).checked);\n }\n\n protected onClick(event: MouseEvent): void {\n if (!this.controlled()) {\n return;\n }\n event.preventDefault();\n this.checkedRequested.emit(!this.checked());\n }\n}\n","<div [class]=\"fieldClass()\">\n <span\n class=\"control-line\"\n [class.is-disabled]=\"isDisabled()\">\n <input\n type=\"checkbox\"\n role=\"switch\"\n [class]=\"switchClasses()\"\n [checked]=\"checked()\"\n [attr.aria-checked]=\"checked()\"\n [disabled]=\"isDisabled()\"\n [attr.name]=\"name()\"\n [attr.id]=\"controlId()\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n (click)=\"onClick($event)\"\n (change)=\"onCheckedChange($event)\"\n (blur)=\"markTouched()\" />\n\n <label\n class=\"control-text\"\n [attr.for]=\"controlId()\">\n @if (label()) {\n {{ label() }}\n @if (required()) {\n <span\n class=\"req\"\n aria-hidden=\"true\">\n *\n </span>\n }\n } @else {\n <ng-content></ng-content>\n }\n </label>\n\n <ds-field-status\n [pending]=\"pendingShown()\"\n [changed]=\"changedShown()\" />\n </span>\n\n <ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [reserve]=\"reserveMessageResolved()\"\n [changed]=\"changedShown()\" />\n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QAAA,EAAA,EAAA,EAAA,QAAA,EClCH,g4CAmDA,EAAA,MAAA,EAAA,CAAA,m5HAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,ED3BY,qBAAqB,EAAA,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,OAAA,EAAA,WAAA,EAAA,MAAA,EAAA,SAAA,EAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,oBAAoB,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;4FAY1C,eAAe,EAAA,UAAA,EAAA,CAAA;kBAf3B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,WAAW,EAAA,UAAA,EACT,IAAI,EAAA,OAAA,EACP,CAAC,qBAAqB,EAAE,oBAAoB,CAAC,EAAA,aAAA,EAGvC,iBAAiB,CAAC,QAAQ,EAAA,SAAA,EAC9B;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,qBAAqB,CAAC;AAC9C,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA,EAAA,QAAA,EAAA,g4CAAA,EAAA,MAAA,EAAA,CAAA,m5HAAA,CAAA,EAAA;;;AElCH;;AAEG;;;;"}
@@ -1,11 +1,12 @@
1
1
  import { CdkDrag, CdkDragHandle, CdkDropList, moveItemInArray } from '@angular/cdk/drag-drop';
2
2
  import * as i0 from '@angular/core';
3
- import { input, inject, model, output, viewChild, computed, Component, booleanAttribute, signal, effect, DestroyRef, Directive } from '@angular/core';
3
+ import { input, inject, model, output, viewChild, computed, Component, booleanAttribute, signal, effect, untracked, DestroyRef, Directive } from '@angular/core';
4
4
  import { DsTableLayout } from '@ids-group-ltd/ids-design-system/components/table';
5
5
  import { NgTemplateOutlet } from '@angular/common';
6
6
  import { BottomSheetComponent } from '@ids-group-ltd/ids-design-system/components/bottom-sheet';
7
7
  import { PopoverComponent } from '@ids-group-ltd/ids-design-system/components/popover';
8
8
  import { DS_INTL } from '@ids-group-ltd/ids-design-system/core';
9
+ import { focusRescue } from '@ids-group-ltd/ids-design-system/components';
9
10
  import { IconComponent } from '@ids-group-ltd/ids-design-system/icons';
10
11
 
11
12
  /**
@@ -22,6 +23,7 @@ class TableColumnsPanelComponent {
22
23
  isVisible = input.required(...(ngDevMode ? [{ debugName: "isVisible" }] : /* istanbul ignore next */ []));
23
24
  isLocked = input.required(...(ngDevMode ? [{ debugName: "isLocked" }] : /* istanbul ignore next */ []));
24
25
  intl = inject(DS_INTL);
26
+ rescueFocus = focusRescue();
25
27
  sheetOpen = model(false, ...(ngDevMode ? [{ debugName: "sheetOpen" }] : /* istanbul ignore next */ []));
26
28
  toggled = output();
27
29
  moved = output();
@@ -31,6 +33,16 @@ class TableColumnsPanelComponent {
31
33
  opened = computed(() => this.coarsePointer()
32
34
  ? this.sheetOpen()
33
35
  : (this.popover()?.opened() ?? false), ...(ngDevMode ? [{ debugName: "opened" }] : /* istanbul ignore next */ []));
36
+ // A moved row is re-inserted, or its button disabled at an end, under focus.
37
+ move(column, delta, list) {
38
+ this.moved.emit({ column, delta });
39
+ this.rescueFocus(() => {
40
+ const index = this.columns().findIndex((candidate) => candidate.key === column.key);
41
+ const [up, down] = Array.from(list.children[index]?.querySelectorAll('.col-move-btn') ?? []);
42
+ const same = delta < 0 ? up : down;
43
+ return same?.disabled ? (delta < 0 ? down : up) : same;
44
+ });
45
+ }
34
46
  toggle(trigger) {
35
47
  if (this.coarsePointer()) {
36
48
  this.sheetOpen.set(true);
@@ -56,6 +68,7 @@ class TableColumnsPanelComponent {
56
68
 
57
69
  <ng-template #panel>
58
70
  <div
71
+ #list
59
72
  class="col-picker"
60
73
  cdkDropList
61
74
  (cdkDropListDropped)="dropped.emit($event)">
@@ -98,7 +111,7 @@ class TableColumnsPanelComponent {
98
111
  class="col-move-btn"
99
112
  [attr.aria-label]="intl().tableColumns.moveUp"
100
113
  [disabled]="first"
101
- (click)="moved.emit({ column: col, delta: -1 })">
114
+ (click)="move(col, -1, list)">
102
115
  <ds-icon name="chevronUp" [size]="14" />
103
116
  </button>
104
117
 
@@ -107,7 +120,7 @@ class TableColumnsPanelComponent {
107
120
  class="col-move-btn"
108
121
  [attr.aria-label]="intl().tableColumns.moveDown"
109
122
  [disabled]="last"
110
- (click)="moved.emit({ column: col, delta: 1 })">
123
+ (click)="move(col, 1, list)">
111
124
  <ds-icon name="chevronDown" [size]="14" />
112
125
  </button>
113
126
  </span>
@@ -149,6 +162,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
149
162
 
150
163
  <ng-template #panel>
151
164
  <div
165
+ #list
152
166
  class="col-picker"
153
167
  cdkDropList
154
168
  (cdkDropListDropped)="dropped.emit($event)">
@@ -191,7 +205,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
191
205
  class="col-move-btn"
192
206
  [attr.aria-label]="intl().tableColumns.moveUp"
193
207
  [disabled]="first"
194
- (click)="moved.emit({ column: col, delta: -1 })">
208
+ (click)="move(col, -1, list)">
195
209
  <ds-icon name="chevronUp" [size]="14" />
196
210
  </button>
197
211
 
@@ -200,7 +214,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
200
214
  class="col-move-btn"
201
215
  [attr.aria-label]="intl().tableColumns.moveDown"
202
216
  [disabled]="last"
203
- (click)="moved.emit({ column: col, delta: 1 })">
217
+ (click)="move(col, 1, list)">
204
218
  <ds-icon name="chevronDown" [size]="14" />
205
219
  </button>
206
220
  </span>
@@ -322,14 +336,15 @@ class DsTableColumns {
322
336
  });
323
337
  const trigger = this.layout.view().anchor('header-utility');
324
338
  const overlays = this.layout.view().anchor('overlays');
325
- let panel = null;
326
- let button = null;
339
+ const panelRef = signal(null, ...(ngDevMode ? [{ debugName: "panelRef" }] : /* istanbul ignore next */ []));
340
+ const buttonRef = signal(null, ...(ngDevMode ? [{ debugName: "buttonRef" }] : /* istanbul ignore next */ []));
327
341
  effect(() => {
328
342
  const host = overlays();
329
- if (!host || panel) {
343
+ if (!host || untracked(panelRef)) {
330
344
  return;
331
345
  }
332
- panel = host.createComponent((TableColumnsPanelComponent));
346
+ const panel = host.createComponent((TableColumnsPanelComponent));
347
+ panelRef.set(panel);
333
348
  panel.instance.toggled.subscribe((column) => this.toggleColumn(column));
334
349
  panel.instance.moved.subscribe(({ column, delta }) => this.moveColumn(column, delta));
335
350
  panel.instance.dropped.subscribe((event) => this.onDrop(event));
@@ -337,15 +352,18 @@ class DsTableColumns {
337
352
  });
338
353
  effect(() => {
339
354
  const host = trigger();
340
- if (!host || button) {
355
+ if (!host || untracked(buttonRef)) {
341
356
  return;
342
357
  }
343
- button = host.createComponent(TableColumnsTriggerComponent);
344
- button.instance.pressed.subscribe((event) => panel?.instance.toggle(event.currentTarget));
358
+ const button = host.createComponent(TableColumnsTriggerComponent);
359
+ buttonRef.set(button);
360
+ button.instance.pressed.subscribe((event) => panelRef()?.instance.toggle(event.currentTarget));
345
361
  });
346
362
  // Separate views, not reached by the host's change detection: every input has to be written
347
363
  // when it moves.
348
364
  effect(() => {
365
+ const panel = panelRef();
366
+ const button = buttonRef();
349
367
  panel?.setInput('columns', this.ordered());
350
368
  panel?.setInput('reorderable', this.reorderableColumns());
351
369
  panel?.setInput('coarsePointer', this.coarsePointer());
@@ -362,8 +380,8 @@ class DsTableColumns {
362
380
  inject(DestroyRef).onDestroy(() => query.removeEventListener('change', sync));
363
381
  }
364
382
  inject(DestroyRef).onDestroy(() => {
365
- panel?.destroy();
366
- button?.destroy();
383
+ panelRef()?.destroy();
384
+ buttonRef()?.destroy();
367
385
  });
368
386
  }
369
387
  isVisible(column) {