@raqm/ui 0.0.0-stage → 0.1.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 (178) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE.md +28 -0
  4. package/README.md +126 -3
  5. package/combobox/README.md +17 -0
  6. package/fesm2022/raqm-ui-accordion.mjs +414 -0
  7. package/fesm2022/raqm-ui-accordion.mjs.map +1 -0
  8. package/fesm2022/raqm-ui-alert-dialog.mjs +457 -0
  9. package/fesm2022/raqm-ui-alert-dialog.mjs.map +1 -0
  10. package/fesm2022/raqm-ui-alert.mjs +195 -0
  11. package/fesm2022/raqm-ui-alert.mjs.map +1 -0
  12. package/fesm2022/raqm-ui-aspect-ratio.mjs +66 -0
  13. package/fesm2022/raqm-ui-aspect-ratio.mjs.map +1 -0
  14. package/fesm2022/raqm-ui-attachment.mjs +435 -0
  15. package/fesm2022/raqm-ui-attachment.mjs.map +1 -0
  16. package/fesm2022/raqm-ui-avatar.mjs +337 -0
  17. package/fesm2022/raqm-ui-avatar.mjs.map +1 -0
  18. package/fesm2022/raqm-ui-badge.mjs +68 -0
  19. package/fesm2022/raqm-ui-badge.mjs.map +1 -0
  20. package/fesm2022/raqm-ui-breadcrumb.mjs +309 -0
  21. package/fesm2022/raqm-ui-breadcrumb.mjs.map +1 -0
  22. package/fesm2022/raqm-ui-button-group.mjs +138 -0
  23. package/fesm2022/raqm-ui-button-group.mjs.map +1 -0
  24. package/fesm2022/raqm-ui-button.mjs +295 -0
  25. package/fesm2022/raqm-ui-button.mjs.map +1 -0
  26. package/fesm2022/raqm-ui-calendar.mjs +1394 -0
  27. package/fesm2022/raqm-ui-calendar.mjs.map +1 -0
  28. package/fesm2022/raqm-ui-card.mjs +331 -0
  29. package/fesm2022/raqm-ui-card.mjs.map +1 -0
  30. package/fesm2022/raqm-ui-carousel.mjs +410 -0
  31. package/fesm2022/raqm-ui-carousel.mjs.map +1 -0
  32. package/fesm2022/raqm-ui-checkbox.mjs +86 -0
  33. package/fesm2022/raqm-ui-checkbox.mjs.map +1 -0
  34. package/fesm2022/raqm-ui-collapsible.mjs +266 -0
  35. package/fesm2022/raqm-ui-collapsible.mjs.map +1 -0
  36. package/fesm2022/raqm-ui-combobox.mjs +1584 -0
  37. package/fesm2022/raqm-ui-combobox.mjs.map +1 -0
  38. package/fesm2022/raqm-ui-command.mjs +1210 -0
  39. package/fesm2022/raqm-ui-command.mjs.map +1 -0
  40. package/fesm2022/raqm-ui-context-menu.mjs +723 -0
  41. package/fesm2022/raqm-ui-context-menu.mjs.map +1 -0
  42. package/fesm2022/raqm-ui-dialog.mjs +1214 -0
  43. package/fesm2022/raqm-ui-dialog.mjs.map +1 -0
  44. package/fesm2022/raqm-ui-drawer.mjs +687 -0
  45. package/fesm2022/raqm-ui-drawer.mjs.map +1 -0
  46. package/fesm2022/raqm-ui-dropdown-menu.mjs +1168 -0
  47. package/fesm2022/raqm-ui-dropdown-menu.mjs.map +1 -0
  48. package/fesm2022/raqm-ui-empty.mjs +272 -0
  49. package/fesm2022/raqm-ui-empty.mjs.map +1 -0
  50. package/fesm2022/raqm-ui-field.mjs +517 -0
  51. package/fesm2022/raqm-ui-field.mjs.map +1 -0
  52. package/fesm2022/raqm-ui-hover-card.mjs +828 -0
  53. package/fesm2022/raqm-ui-hover-card.mjs.map +1 -0
  54. package/fesm2022/raqm-ui-input-group.mjs +270 -0
  55. package/fesm2022/raqm-ui-input-group.mjs.map +1 -0
  56. package/fesm2022/raqm-ui-input-otp.mjs +788 -0
  57. package/fesm2022/raqm-ui-input-otp.mjs.map +1 -0
  58. package/fesm2022/raqm-ui-input.mjs +73 -0
  59. package/fesm2022/raqm-ui-input.mjs.map +1 -0
  60. package/fesm2022/raqm-ui-item.mjs +495 -0
  61. package/fesm2022/raqm-ui-item.mjs.map +1 -0
  62. package/fesm2022/raqm-ui-kbd.mjs +80 -0
  63. package/fesm2022/raqm-ui-kbd.mjs.map +1 -0
  64. package/fesm2022/raqm-ui-label.mjs +44 -0
  65. package/fesm2022/raqm-ui-label.mjs.map +1 -0
  66. package/fesm2022/raqm-ui-menubar.mjs +536 -0
  67. package/fesm2022/raqm-ui-menubar.mjs.map +1 -0
  68. package/fesm2022/raqm-ui-native-select.mjs +131 -0
  69. package/fesm2022/raqm-ui-native-select.mjs.map +1 -0
  70. package/fesm2022/raqm-ui-navigation-menu.mjs +1399 -0
  71. package/fesm2022/raqm-ui-navigation-menu.mjs.map +1 -0
  72. package/fesm2022/raqm-ui-overlay-internal.mjs +185 -0
  73. package/fesm2022/raqm-ui-overlay-internal.mjs.map +1 -0
  74. package/fesm2022/raqm-ui-pagination.mjs +440 -0
  75. package/fesm2022/raqm-ui-pagination.mjs.map +1 -0
  76. package/fesm2022/raqm-ui-popover.mjs +1495 -0
  77. package/fesm2022/raqm-ui-popover.mjs.map +1 -0
  78. package/fesm2022/raqm-ui-progress.mjs +369 -0
  79. package/fesm2022/raqm-ui-progress.mjs.map +1 -0
  80. package/fesm2022/raqm-ui-questionnaire.mjs +1005 -0
  81. package/fesm2022/raqm-ui-questionnaire.mjs.map +1 -0
  82. package/fesm2022/raqm-ui-radio-group.mjs +151 -0
  83. package/fesm2022/raqm-ui-radio-group.mjs.map +1 -0
  84. package/fesm2022/raqm-ui-resizable.mjs +439 -0
  85. package/fesm2022/raqm-ui-resizable.mjs.map +1 -0
  86. package/fesm2022/raqm-ui-scroll-area.mjs +510 -0
  87. package/fesm2022/raqm-ui-scroll-area.mjs.map +1 -0
  88. package/fesm2022/raqm-ui-select.mjs +1073 -0
  89. package/fesm2022/raqm-ui-select.mjs.map +1 -0
  90. package/fesm2022/raqm-ui-separator.mjs +103 -0
  91. package/fesm2022/raqm-ui-separator.mjs.map +1 -0
  92. package/fesm2022/raqm-ui-sheet.mjs +411 -0
  93. package/fesm2022/raqm-ui-sheet.mjs.map +1 -0
  94. package/fesm2022/raqm-ui-sidebar.mjs +1784 -0
  95. package/fesm2022/raqm-ui-sidebar.mjs.map +1 -0
  96. package/fesm2022/raqm-ui-skeleton.mjs +50 -0
  97. package/fesm2022/raqm-ui-skeleton.mjs.map +1 -0
  98. package/fesm2022/raqm-ui-slider.mjs +609 -0
  99. package/fesm2022/raqm-ui-slider.mjs.map +1 -0
  100. package/fesm2022/raqm-ui-spinner.mjs +137 -0
  101. package/fesm2022/raqm-ui-spinner.mjs.map +1 -0
  102. package/fesm2022/raqm-ui-switch.mjs +109 -0
  103. package/fesm2022/raqm-ui-switch.mjs.map +1 -0
  104. package/fesm2022/raqm-ui-table.mjs +271 -0
  105. package/fesm2022/raqm-ui-table.mjs.map +1 -0
  106. package/fesm2022/raqm-ui-tabs.mjs +536 -0
  107. package/fesm2022/raqm-ui-tabs.mjs.map +1 -0
  108. package/fesm2022/raqm-ui-textarea.mjs +37 -0
  109. package/fesm2022/raqm-ui-textarea.mjs.map +1 -0
  110. package/fesm2022/raqm-ui-toast.mjs +918 -0
  111. package/fesm2022/raqm-ui-toast.mjs.map +1 -0
  112. package/fesm2022/raqm-ui-toggle-group.mjs +462 -0
  113. package/fesm2022/raqm-ui-toggle-group.mjs.map +1 -0
  114. package/fesm2022/raqm-ui-toggle.mjs +158 -0
  115. package/fesm2022/raqm-ui-toggle.mjs.map +1 -0
  116. package/fesm2022/raqm-ui-tooltip.mjs +1226 -0
  117. package/fesm2022/raqm-ui-tooltip.mjs.map +1 -0
  118. package/fesm2022/raqm-ui.mjs +50 -0
  119. package/input-otp/README.md +12 -0
  120. package/package.json +275 -3
  121. package/styles/theme.css +4324 -0
  122. package/types/raqm-ui-accordion.d.ts +124 -0
  123. package/types/raqm-ui-alert-dialog.d.ts +81 -0
  124. package/types/raqm-ui-alert.d.ts +29 -0
  125. package/types/raqm-ui-aspect-ratio.d.ts +13 -0
  126. package/types/raqm-ui-attachment.d.ts +72 -0
  127. package/types/raqm-ui-avatar.d.ts +67 -0
  128. package/types/raqm-ui-badge.d.ts +20 -0
  129. package/types/raqm-ui-breadcrumb.d.ts +35 -0
  130. package/types/raqm-ui-button-group.d.ts +27 -0
  131. package/types/raqm-ui-button.d.ts +80 -0
  132. package/types/raqm-ui-calendar.d.ts +359 -0
  133. package/types/raqm-ui-card.d.ts +34 -0
  134. package/types/raqm-ui-carousel.d.ts +81 -0
  135. package/types/raqm-ui-checkbox.d.ts +24 -0
  136. package/types/raqm-ui-collapsible.d.ts +72 -0
  137. package/types/raqm-ui-combobox.d.ts +405 -0
  138. package/types/raqm-ui-command.d.ts +256 -0
  139. package/types/raqm-ui-context-menu.d.ts +196 -0
  140. package/types/raqm-ui-dialog.d.ts +232 -0
  141. package/types/raqm-ui-drawer.d.ts +121 -0
  142. package/types/raqm-ui-dropdown-menu.d.ts +319 -0
  143. package/types/raqm-ui-empty.d.ts +35 -0
  144. package/types/raqm-ui-field.d.ts +88 -0
  145. package/types/raqm-ui-hover-card.d.ts +139 -0
  146. package/types/raqm-ui-input-group.d.ts +45 -0
  147. package/types/raqm-ui-input-otp.d.ts +197 -0
  148. package/types/raqm-ui-input.d.ts +16 -0
  149. package/types/raqm-ui-item.d.ts +71 -0
  150. package/types/raqm-ui-kbd.d.ts +12 -0
  151. package/types/raqm-ui-label.d.ts +6 -0
  152. package/types/raqm-ui-menubar.d.ts +159 -0
  153. package/types/raqm-ui-native-select.d.ts +23 -0
  154. package/types/raqm-ui-navigation-menu.d.ts +230 -0
  155. package/types/raqm-ui-overlay-internal.d.ts +5 -0
  156. package/types/raqm-ui-pagination.d.ts +84 -0
  157. package/types/raqm-ui-popover.d.ts +235 -0
  158. package/types/raqm-ui-progress.d.ts +79 -0
  159. package/types/raqm-ui-questionnaire.d.ts +217 -0
  160. package/types/raqm-ui-radio-group.d.ts +48 -0
  161. package/types/raqm-ui-resizable.d.ts +98 -0
  162. package/types/raqm-ui-scroll-area.d.ts +132 -0
  163. package/types/raqm-ui-select.d.ts +205 -0
  164. package/types/raqm-ui-separator.d.ts +21 -0
  165. package/types/raqm-ui-sheet.d.ts +79 -0
  166. package/types/raqm-ui-sidebar.d.ts +285 -0
  167. package/types/raqm-ui-skeleton.d.ts +6 -0
  168. package/types/raqm-ui-slider.d.ts +129 -0
  169. package/types/raqm-ui-spinner.d.ts +32 -0
  170. package/types/raqm-ui-switch.d.ts +32 -0
  171. package/types/raqm-ui-table.d.ts +36 -0
  172. package/types/raqm-ui-tabs.d.ts +154 -0
  173. package/types/raqm-ui-textarea.d.ts +6 -0
  174. package/types/raqm-ui-toast.d.ts +190 -0
  175. package/types/raqm-ui-toggle-group.d.ts +167 -0
  176. package/types/raqm-ui-toggle.d.ts +42 -0
  177. package/types/raqm-ui-tooltip.d.ts +207 -0
  178. package/types/raqm-ui.d.ts +50 -0
@@ -0,0 +1,609 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, booleanAttribute, computed, inject, input, output, signal, viewChildren } from "@angular/core";
3
+ function decimalPrecision(value) {
4
+ if (value === 0) return 0;
5
+ if (Math.abs(value) < 1) {
6
+ const [mantissa, exponent] = value.toExponential().split("e-");
7
+ const fraction = mantissa.split(".")[1];
8
+ return (fraction ? fraction.length : 0) + Number.parseInt(exponent ?? "0", 10);
9
+ }
10
+ const fraction = value.toString().split(".")[1];
11
+ return fraction ? fraction.length : 0;
12
+ }
13
+ function clamp(value, lower, upper) {
14
+ return Math.min(Math.max(value, lower), upper);
15
+ }
16
+ function roundToStep(value, step, min) {
17
+ const nearest = Math.round((value - min) / step) * step + min;
18
+ return Number(nearest.toFixed(Math.max(decimalPrecision(step), decimalPrecision(min))));
19
+ }
20
+ function pushThumbValues(values, index, nextValue, min, max, initialValues) {
21
+ const next = values.slice();
22
+ const lastIndex = next.length - 1;
23
+ next[index] = clamp(nextValue, min, max);
24
+ for (let position = index + 1; position <= lastIndex; position += 1) {
25
+ const lower = next[position - 1];
26
+ const initial = initialValues[position] ?? next[position];
27
+ const candidate = Math.max(next[position], lower);
28
+ next[position] = clamp(initial < candidate ? Math.max(initial, lower) : candidate, lower, max);
29
+ }
30
+ for (let position = index - 1; position >= 0; position -= 1) {
31
+ const upper = next[position + 1];
32
+ const initial = initialValues[position] ?? next[position];
33
+ const candidate = Math.min(next[position], upper);
34
+ next[position] = clamp(initial > candidate ? Math.min(initial, upper) : candidate, min, upper);
35
+ }
36
+ return next.map((value) => Number(value.toFixed(12)));
37
+ }
38
+ function offsetExpression(ratio) {
39
+ return `calc(var(--raqm-slider-thumb-size) / 2 + (100% - var(--raqm-slider-thumb-size)) * ${ratio})`;
40
+ }
41
+ function spanExpression(span) {
42
+ return `calc((100% - var(--raqm-slider-thumb-size)) * ${span})`;
43
+ }
44
+ var RaqmSliderKeyboard = class {
45
+ host;
46
+ constructor(host) {
47
+ this.host = host;
48
+ }
49
+ onKeydown(event, index) {
50
+ const values = this.host.values();
51
+ const current = values[index] ?? this.host.min();
52
+ const increment = event.shiftKey ? 10 : this.host.stepSize();
53
+ const rtl = this.host.direction() === "rtl";
54
+ const min = this.host.min();
55
+ const max = Math.max(this.host.max(), min);
56
+ let next;
57
+ switch (event.key) {
58
+ case "ArrowRight":
59
+ next = current + (rtl ? -increment : increment);
60
+ break;
61
+ case "ArrowLeft":
62
+ next = current + (rtl ? increment : -increment);
63
+ break;
64
+ case "ArrowUp":
65
+ next = current + increment;
66
+ break;
67
+ case "ArrowDown":
68
+ next = current - increment;
69
+ break;
70
+ case "PageUp":
71
+ next = current + 10;
72
+ break;
73
+ case "PageDown":
74
+ next = current - 10;
75
+ break;
76
+ case "Home":
77
+ next = values[index - 1] ?? min;
78
+ break;
79
+ case "End":
80
+ next = values[index + 1] ?? max;
81
+ break;
82
+ default: return;
83
+ }
84
+ event.preventDefault();
85
+ const input = event.currentTarget;
86
+ if (!input.matches(":focus-visible")) {
87
+ input.blur();
88
+ input.focus({ preventScroll: true });
89
+ }
90
+ this.host.setLastUsed(index);
91
+ this.host.applyClamped(index, next);
92
+ }
93
+ };
94
+ var RaqmSliderPointer = class {
95
+ host;
96
+ dragValues = null;
97
+ dragIndex = -1;
98
+ dragOffset = 0;
99
+ dragPointerId = null;
100
+ dragControl = null;
101
+ constructor(host) {
102
+ this.host = host;
103
+ }
104
+ onPointerDown(event) {
105
+ if (this.host.disabled() || event.button !== 0 || !event.isPrimary) return;
106
+ const pressed = this.pressedThumb(event);
107
+ if (pressed === null) return;
108
+ event.preventDefault();
109
+ this.dragValues = this.host.values().slice();
110
+ this.dragIndex = pressed.index;
111
+ this.dragOffset = pressed.offset;
112
+ this.dragPointerId = event.pointerId;
113
+ this.dragControl = event.currentTarget;
114
+ this.host.setActive(pressed.index);
115
+ this.host.setLastUsed(pressed.index);
116
+ this.focusThumb(pressed.index);
117
+ this.setFromPointer(event, pressed.index);
118
+ document.addEventListener("pointermove", this.onPointerMove);
119
+ document.addEventListener("pointerup", this.onPointerUp);
120
+ document.addEventListener("pointercancel", this.onPointerUp);
121
+ }
122
+ endPointerInteraction() {
123
+ document.removeEventListener("pointermove", this.onPointerMove);
124
+ document.removeEventListener("pointerup", this.onPointerUp);
125
+ document.removeEventListener("pointercancel", this.onPointerUp);
126
+ this.dragValues = null;
127
+ this.dragIndex = -1;
128
+ this.dragOffset = 0;
129
+ this.dragPointerId = null;
130
+ this.dragControl = null;
131
+ this.host.setActive(-1);
132
+ }
133
+ pressedThumb(event) {
134
+ const vertical = this.host.vertical();
135
+ const coordinate = vertical ? event.clientY : event.clientX;
136
+ const target = event.target instanceof Element ? event.target.closest(".raqm-slider-thumb") : null;
137
+ if (target !== null) {
138
+ const index = Number(target.dataset["raqmIndex"] ?? "-1");
139
+ if (index < 0) return null;
140
+ const rect = target.getBoundingClientRect();
141
+ return {
142
+ index,
143
+ offset: coordinate - (vertical ? rect.top + rect.height / 2 : rect.left + rect.width / 2)
144
+ };
145
+ }
146
+ let closest = -1;
147
+ let distance = Number.POSITIVE_INFINITY;
148
+ this.host.thumbElements().forEach((thumb, index) => {
149
+ const rect = thumb.nativeElement.getBoundingClientRect();
150
+ const center = vertical ? rect.top + rect.height / 2 : rect.left + rect.width / 2;
151
+ const delta = Math.abs(coordinate - center);
152
+ if (delta <= distance) {
153
+ closest = index;
154
+ distance = delta;
155
+ }
156
+ });
157
+ return closest < 0 ? null : {
158
+ index: closest,
159
+ offset: 0
160
+ };
161
+ }
162
+ setFromPointer(event, index) {
163
+ const control = this.dragControl;
164
+ if (control === null) return;
165
+ const value = this.valueFromPointer(event, control, index);
166
+ if (value === null) return;
167
+ const values = this.host.values();
168
+ if (values.length <= 1) {
169
+ this.host.setValues([value]);
170
+ return;
171
+ }
172
+ this.host.setValues(pushThumbValues(values, index, value, this.host.min(), Math.max(this.host.max(), this.host.min()), this.dragValues ?? values));
173
+ }
174
+ valueFromPointer(event, control, index) {
175
+ const thumb = this.host.thumbElements()[index]?.nativeElement;
176
+ if (thumb === void 0) return null;
177
+ const vertical = this.host.vertical();
178
+ const controlRect = control.getBoundingClientRect();
179
+ const thumbRect = thumb.getBoundingClientRect();
180
+ const thumbSize = vertical ? thumbRect.height : thumbRect.width;
181
+ const controlSize = (vertical ? controlRect.height : controlRect.width) - thumbSize;
182
+ if (controlSize <= 0) return null;
183
+ const coordinate = (vertical ? event.clientY : event.clientX) - this.dragOffset;
184
+ const position = clamp(((vertical ? controlRect.bottom - coordinate : this.host.direction() === "rtl" ? controlRect.right - coordinate : coordinate - controlRect.left) - thumbSize / 2) / controlSize, 0, 1);
185
+ const min = this.host.min();
186
+ return this.host.round(min + (Math.max(this.host.max(), min) - min) * position);
187
+ }
188
+ onPointerMove = (event) => {
189
+ if (event.pointerId !== this.dragPointerId) return;
190
+ if (this.host.disabled()) {
191
+ this.endPointerInteraction();
192
+ return;
193
+ }
194
+ if (event.buttons === 0) {
195
+ this.endPointerInteraction();
196
+ return;
197
+ }
198
+ this.setFromPointer(event, this.dragIndex);
199
+ };
200
+ onPointerUp = (event) => {
201
+ if (event.pointerId === this.dragPointerId) this.endPointerInteraction();
202
+ };
203
+ focusThumb(index) {
204
+ this.host.thumbInputs()[index]?.nativeElement.focus({ preventScroll: true });
205
+ }
206
+ };
207
+ var RaqmSlider = class RaqmSlider {
208
+ value = input(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
209
+ defaultValue = input(null, ...ngDevMode ? [{ debugName: "defaultValue" }] : /* istanbul ignore next */ []);
210
+ min = input(0, ...ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []);
211
+ max = input(100, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
212
+ step = input(1, ...ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []);
213
+ vertical = input(false, {
214
+ ...ngDevMode ? { debugName: "vertical" } : /* istanbul ignore next */ {},
215
+ transform: booleanAttribute
216
+ });
217
+ disabled = input(false, {
218
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
219
+ transform: booleanAttribute
220
+ });
221
+ name = input(null, ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
222
+ form = input(null, ...ngDevMode ? [{ debugName: "form" }] : /* istanbul ignore next */ []);
223
+ id = input(null, ...ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []);
224
+ thumbLabels = input(null, ...ngDevMode ? [{ debugName: "thumbLabels" }] : /* istanbul ignore next */ []);
225
+ valueChange = output();
226
+ host = inject(ElementRef);
227
+ destroyRef = inject(DestroyRef);
228
+ uncontrolled = signal(null, ...ngDevMode ? [{ debugName: "uncontrolled" }] : /* istanbul ignore next */ []);
229
+ activeIndex = signal(-1, ...ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []);
230
+ lastUsedIndex = signal(-1, ...ngDevMode ? [{ debugName: "lastUsedIndex" }] : /* istanbul ignore next */ []);
231
+ thumbElements = viewChildren("thumbEl", ...ngDevMode ? [{ debugName: "thumbElements" }] : /* istanbul ignore next */ []);
232
+ thumbInputs = viewChildren("thumbInput", ...ngDevMode ? [{ debugName: "thumbInputs" }] : /* istanbul ignore next */ []);
233
+ orientation = computed(() => this.vertical() ? "vertical" : "horizontal", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
234
+ values = computed(() => {
235
+ const raw = this.value() ?? this.uncontrolled() ?? this.defaultValue() ?? this.min();
236
+ const list = (Array.isArray(raw) ? raw : [raw]).slice();
237
+ return (list.length > 0 ? list : [this.min()]).map((entry) => this.round(entry));
238
+ }, ...ngDevMode ? [{ debugName: "values" }] : /* istanbul ignore next */ []);
239
+ thumbs = computed(() => {
240
+ const vertical = this.vertical();
241
+ const active = this.activeIndex();
242
+ const lastUsed = this.lastUsedIndex();
243
+ return this.values().map((value, index) => {
244
+ const position = offsetExpression(this.ratio(value));
245
+ const stack = active === index ? "2" : lastUsed === index ? "1" : "";
246
+ return {
247
+ index,
248
+ value,
249
+ style: vertical ? {
250
+ "inset-block-end": position,
251
+ "inset-inline-start": "50%",
252
+ "z-index": stack
253
+ } : {
254
+ "inset-inline-start": position,
255
+ "inset-block-start": "50%",
256
+ "z-index": stack
257
+ }
258
+ };
259
+ });
260
+ }, ...ngDevMode ? [{ debugName: "thumbs" }] : /* istanbul ignore next */ []);
261
+ rangeStyle = computed(() => {
262
+ const values = this.values();
263
+ const vertical = this.vertical();
264
+ const first = this.ratio(values[0] ?? this.min());
265
+ if (values.length <= 1) {
266
+ const size = offsetExpression(first);
267
+ return vertical ? {
268
+ "inset-block-end": "0",
269
+ "block-size": size
270
+ } : {
271
+ "inset-inline-start": "0",
272
+ "inline-size": size
273
+ };
274
+ }
275
+ const last = this.ratio(values[values.length - 1] ?? this.min());
276
+ const start = offsetExpression(first);
277
+ const size = spanExpression(Number((last - first).toFixed(6)));
278
+ return vertical ? {
279
+ "inset-block-end": start,
280
+ "block-size": size
281
+ } : {
282
+ "inset-inline-start": start,
283
+ "inline-size": size
284
+ };
285
+ }, ...ngDevMode ? [{ debugName: "rangeStyle" }] : /* istanbul ignore next */ []);
286
+ pointer = new RaqmSliderPointer({
287
+ disabled: () => this.disabled(),
288
+ vertical: () => this.vertical(),
289
+ values: () => this.values(),
290
+ min: () => this.min(),
291
+ max: () => this.max(),
292
+ round: (value) => this.round(value),
293
+ direction: () => this.direction(),
294
+ thumbElements: () => this.thumbElements(),
295
+ thumbInputs: () => this.thumbInputs(),
296
+ setValues: (values) => this.setValues(values),
297
+ setActive: (index) => this.activeIndex.set(index),
298
+ setLastUsed: (index) => this.lastUsedIndex.set(index)
299
+ });
300
+ keyboard = new RaqmSliderKeyboard({
301
+ values: () => this.values(),
302
+ min: () => this.min(),
303
+ max: () => this.max(),
304
+ stepSize: () => this.stepSize(),
305
+ direction: () => this.direction(),
306
+ setLastUsed: (index) => this.lastUsedIndex.set(index),
307
+ applyClamped: (index, next) => this.applyClamped(index, next)
308
+ });
309
+ constructor() {
310
+ this.destroyRef.onDestroy(() => this.pointer.endPointerInteraction());
311
+ }
312
+ inputId(index) {
313
+ return index === 0 ? this.id() : null;
314
+ }
315
+ thumbLabel(index) {
316
+ return this.thumbLabels()?.[index] ?? null;
317
+ }
318
+ onFocus(index) {
319
+ this.activeIndex.set(index);
320
+ this.lastUsedIndex.set(index);
321
+ }
322
+ onBlur() {
323
+ this.activeIndex.set(-1);
324
+ }
325
+ onInput(event, index) {
326
+ const input = event.target;
327
+ if (Number.isFinite(input.valueAsNumber)) this.applyClamped(index, input.valueAsNumber);
328
+ }
329
+ onKeydown(event, index) {
330
+ this.keyboard.onKeydown(event, index);
331
+ }
332
+ onPointerDown(event) {
333
+ this.pointer.onPointerDown(event);
334
+ }
335
+ round(value) {
336
+ const min = this.min();
337
+ const max = Math.max(this.max(), min);
338
+ return clamp(roundToStep(Number.isFinite(value) ? value : min, this.stepSize(), min), min, max);
339
+ }
340
+ stepSize() {
341
+ return this.step() > 0 ? this.step() : 1;
342
+ }
343
+ ratio(value) {
344
+ const span = this.max() - this.min();
345
+ return span > 0 ? Number(((value - this.min()) / span).toFixed(6)) : 0;
346
+ }
347
+ applyClamped(index, next) {
348
+ const values = this.values().slice();
349
+ if (index < 0 || index >= values.length) return;
350
+ values[index] = this.round(clamp(next, values[index - 1] ?? -Infinity, values[index + 1] ?? Infinity));
351
+ this.setValues(values);
352
+ }
353
+ setValues(next) {
354
+ const current = this.values();
355
+ if (next.length === current.length && next.every((value, index) => value === current[index])) return;
356
+ if (this.value() === null) this.uncontrolled.set(next);
357
+ this.valueChange.emit(next.length === 1 ? next[0] : next);
358
+ }
359
+ direction() {
360
+ return getComputedStyle(this.host.nativeElement).direction === "rtl" ? "rtl" : "ltr";
361
+ }
362
+ static ɵfac = i0.ɵɵngDeclareFactory({
363
+ minVersion: "12.0.0",
364
+ version: "22.2.2",
365
+ ngImport: i0,
366
+ type: RaqmSlider,
367
+ deps: [],
368
+ target: i0.ɵɵFactoryTarget.Component
369
+ });
370
+ static ɵcmp = i0.ɵɵngDeclareComponent({
371
+ minVersion: "17.0.0",
372
+ version: "22.2.2",
373
+ type: RaqmSlider,
374
+ isStandalone: true,
375
+ selector: "raqm-slider",
376
+ inputs: {
377
+ value: {
378
+ classPropertyName: "value",
379
+ publicName: "value",
380
+ isSignal: true,
381
+ isRequired: false,
382
+ transformFunction: null
383
+ },
384
+ defaultValue: {
385
+ classPropertyName: "defaultValue",
386
+ publicName: "defaultValue",
387
+ isSignal: true,
388
+ isRequired: false,
389
+ transformFunction: null
390
+ },
391
+ min: {
392
+ classPropertyName: "min",
393
+ publicName: "min",
394
+ isSignal: true,
395
+ isRequired: false,
396
+ transformFunction: null
397
+ },
398
+ max: {
399
+ classPropertyName: "max",
400
+ publicName: "max",
401
+ isSignal: true,
402
+ isRequired: false,
403
+ transformFunction: null
404
+ },
405
+ step: {
406
+ classPropertyName: "step",
407
+ publicName: "step",
408
+ isSignal: true,
409
+ isRequired: false,
410
+ transformFunction: null
411
+ },
412
+ vertical: {
413
+ classPropertyName: "vertical",
414
+ publicName: "vertical",
415
+ isSignal: true,
416
+ isRequired: false,
417
+ transformFunction: null
418
+ },
419
+ disabled: {
420
+ classPropertyName: "disabled",
421
+ publicName: "disabled",
422
+ isSignal: true,
423
+ isRequired: false,
424
+ transformFunction: null
425
+ },
426
+ name: {
427
+ classPropertyName: "name",
428
+ publicName: "name",
429
+ isSignal: true,
430
+ isRequired: false,
431
+ transformFunction: null
432
+ },
433
+ form: {
434
+ classPropertyName: "form",
435
+ publicName: "form",
436
+ isSignal: true,
437
+ isRequired: false,
438
+ transformFunction: null
439
+ },
440
+ id: {
441
+ classPropertyName: "id",
442
+ publicName: "id",
443
+ isSignal: true,
444
+ isRequired: false,
445
+ transformFunction: null
446
+ },
447
+ thumbLabels: {
448
+ classPropertyName: "thumbLabels",
449
+ publicName: "thumbLabels",
450
+ isSignal: true,
451
+ isRequired: false,
452
+ transformFunction: null
453
+ }
454
+ },
455
+ outputs: { valueChange: "valueChange" },
456
+ host: {
457
+ attributes: { "role": "group" },
458
+ properties: {
459
+ "attr.data-raqm-vertical": "vertical() ? '' : null",
460
+ "attr.data-raqm-disabled": "disabled() ? '' : null",
461
+ "attr.id": "null"
462
+ },
463
+ classAttribute: "raqm-slider"
464
+ },
465
+ viewQueries: [{
466
+ propertyName: "thumbElements",
467
+ predicate: ["thumbEl"],
468
+ descendants: true,
469
+ isSignal: true
470
+ }, {
471
+ propertyName: "thumbInputs",
472
+ predicate: ["thumbInput"],
473
+ descendants: true,
474
+ isSignal: true
475
+ }],
476
+ ngImport: i0,
477
+ template: "<!-- The host is the group; each thumb hosts a native range input that owns focus, ARIA and form value. -->\r\n<div\r\n class=\"raqm-slider-control\"\r\n [attr.data-raqm-disabled]=\"disabled() ? '' : null\"\r\n (pointerdown)=\"onPointerDown($event)\"\r\n>\r\n <div class=\"raqm-slider-track\">\r\n <div class=\"raqm-slider-range\" [style]=\"rangeStyle()\"></div>\r\n </div>\r\n @for (thumb of thumbs(); track thumb.index) {\r\n <div\r\n #thumbEl\r\n class=\"raqm-slider-thumb\"\r\n [attr.data-raqm-index]=\"thumb.index\"\r\n [style]=\"thumb.style\"\r\n >\r\n <input\r\n #thumbInput\r\n type=\"range\"\r\n class=\"raqm-slider-input\"\r\n [attr.id]=\"inputId(thumb.index)\"\r\n [attr.name]=\"name()\"\r\n [attr.form]=\"form()\"\r\n [attr.aria-label]=\"thumbLabel(thumb.index)\"\r\n [attr.aria-orientation]=\"orientation()\"\r\n [attr.aria-valuemin]=\"min()\"\r\n [attr.aria-valuemax]=\"max()\"\r\n [attr.aria-valuenow]=\"thumb.value\"\r\n [min]=\"min()\"\r\n [max]=\"max()\"\r\n [step]=\"step()\"\r\n [value]=\"thumb.value\"\r\n [disabled]=\"disabled()\"\r\n (input)=\"onInput($event, thumb.index)\"\r\n (keydown)=\"onKeydown($event, thumb.index)\"\r\n (focus)=\"onFocus(thumb.index)\"\r\n (blur)=\"onBlur()\"\r\n />\r\n </div>\r\n }\r\n</div>\r\n",
478
+ styles: [":host{display:block;--raqm-slider-thumb-size: calc(var(--raqm-spacing) * 3)}:host(:not([data-raqm-vertical])){inline-size:100%}:host([data-raqm-vertical]){block-size:100%}.raqm-slider-control{position:relative;display:flex;align-items:center;inline-size:100%;touch-action:none;-webkit-user-select:none;user-select:none}:host([data-raqm-vertical]) .raqm-slider-control{flex-direction:column;inline-size:auto;block-size:100%;min-block-size:calc(var(--raqm-spacing) * 40)}.raqm-slider-control[data-raqm-disabled]{opacity:var(--raqm-disabled-opacity)}.raqm-slider-track{position:relative;flex-grow:1;overflow:hidden;border-radius:9999px;background-color:var(--raqm-muted);-webkit-user-select:none;user-select:none}:host(:not([data-raqm-vertical])) .raqm-slider-track{block-size:calc(var(--raqm-spacing) * 1);inline-size:100%}:host([data-raqm-vertical]) .raqm-slider-track{block-size:100%;inline-size:calc(var(--raqm-spacing) * 1)}.raqm-slider-range{background-color:var(--raqm-primary);-webkit-user-select:none;user-select:none}:host(:not([data-raqm-vertical])) .raqm-slider-range{position:relative;block-size:100%}:host([data-raqm-vertical]) .raqm-slider-range{position:absolute;inline-size:100%}.raqm-slider-thumb{position:absolute;box-sizing:border-box;inline-size:var(--raqm-slider-thumb-size);block-size:var(--raqm-slider-thumb-size);margin:calc(var(--raqm-slider-thumb-size) / -2);border:1px solid var(--raqm-ring);border-radius:9999px;background-color:var(--raqm-white);-webkit-user-select:none;user-select:none;transition-property:color,box-shadow;transition-duration:var(--raqm-duration-base);transition-timing-function:var(--raqm-ease-standard)}.raqm-slider-thumb:after{content:\"\";position:absolute;inset:calc(var(--raqm-spacing) * -2)}:host(:not([data-raqm-disabled])) .raqm-slider-thumb:hover,:host(:not([data-raqm-disabled])) .raqm-slider-thumb:active,.raqm-slider-thumb:has(.raqm-slider-input:focus-visible){box-shadow:0 0 0 var(--raqm-focus-ring-width) var(--raqm-focus-ring-color)}.raqm-slider-thumb:has(.raqm-slider-input:focus-visible){outline:2px solid transparent;outline-offset:2px}.raqm-slider-input{position:absolute;inset:0;inline-size:100%;block-size:100%;margin:0;padding:0;border:0;opacity:0;pointer-events:none}:host([data-raqm-vertical]) .raqm-slider-input:dir(rtl){writing-mode:vertical-rl}\n"],
479
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
480
+ });
481
+ };
482
+ i0.ɵɵngDeclareClassMetadata({
483
+ minVersion: "12.0.0",
484
+ version: "22.2.2",
485
+ ngImport: i0,
486
+ type: RaqmSlider,
487
+ decorators: [{
488
+ type: Component,
489
+ args: [{
490
+ selector: "raqm-slider",
491
+ changeDetection: ChangeDetectionStrategy.OnPush,
492
+ host: {
493
+ class: "raqm-slider",
494
+ role: "group",
495
+ "[attr.data-raqm-vertical]": "vertical() ? '' : null",
496
+ "[attr.data-raqm-disabled]": "disabled() ? '' : null",
497
+ "[attr.id]": "null"
498
+ },
499
+ template: "<!-- The host is the group; each thumb hosts a native range input that owns focus, ARIA and form value. -->\r\n<div\r\n class=\"raqm-slider-control\"\r\n [attr.data-raqm-disabled]=\"disabled() ? '' : null\"\r\n (pointerdown)=\"onPointerDown($event)\"\r\n>\r\n <div class=\"raqm-slider-track\">\r\n <div class=\"raqm-slider-range\" [style]=\"rangeStyle()\"></div>\r\n </div>\r\n @for (thumb of thumbs(); track thumb.index) {\r\n <div\r\n #thumbEl\r\n class=\"raqm-slider-thumb\"\r\n [attr.data-raqm-index]=\"thumb.index\"\r\n [style]=\"thumb.style\"\r\n >\r\n <input\r\n #thumbInput\r\n type=\"range\"\r\n class=\"raqm-slider-input\"\r\n [attr.id]=\"inputId(thumb.index)\"\r\n [attr.name]=\"name()\"\r\n [attr.form]=\"form()\"\r\n [attr.aria-label]=\"thumbLabel(thumb.index)\"\r\n [attr.aria-orientation]=\"orientation()\"\r\n [attr.aria-valuemin]=\"min()\"\r\n [attr.aria-valuemax]=\"max()\"\r\n [attr.aria-valuenow]=\"thumb.value\"\r\n [min]=\"min()\"\r\n [max]=\"max()\"\r\n [step]=\"step()\"\r\n [value]=\"thumb.value\"\r\n [disabled]=\"disabled()\"\r\n (input)=\"onInput($event, thumb.index)\"\r\n (keydown)=\"onKeydown($event, thumb.index)\"\r\n (focus)=\"onFocus(thumb.index)\"\r\n (blur)=\"onBlur()\"\r\n />\r\n </div>\r\n }\r\n</div>\r\n",
500
+ styles: [":host{display:block;--raqm-slider-thumb-size: calc(var(--raqm-spacing) * 3)}:host(:not([data-raqm-vertical])){inline-size:100%}:host([data-raqm-vertical]){block-size:100%}.raqm-slider-control{position:relative;display:flex;align-items:center;inline-size:100%;touch-action:none;-webkit-user-select:none;user-select:none}:host([data-raqm-vertical]) .raqm-slider-control{flex-direction:column;inline-size:auto;block-size:100%;min-block-size:calc(var(--raqm-spacing) * 40)}.raqm-slider-control[data-raqm-disabled]{opacity:var(--raqm-disabled-opacity)}.raqm-slider-track{position:relative;flex-grow:1;overflow:hidden;border-radius:9999px;background-color:var(--raqm-muted);-webkit-user-select:none;user-select:none}:host(:not([data-raqm-vertical])) .raqm-slider-track{block-size:calc(var(--raqm-spacing) * 1);inline-size:100%}:host([data-raqm-vertical]) .raqm-slider-track{block-size:100%;inline-size:calc(var(--raqm-spacing) * 1)}.raqm-slider-range{background-color:var(--raqm-primary);-webkit-user-select:none;user-select:none}:host(:not([data-raqm-vertical])) .raqm-slider-range{position:relative;block-size:100%}:host([data-raqm-vertical]) .raqm-slider-range{position:absolute;inline-size:100%}.raqm-slider-thumb{position:absolute;box-sizing:border-box;inline-size:var(--raqm-slider-thumb-size);block-size:var(--raqm-slider-thumb-size);margin:calc(var(--raqm-slider-thumb-size) / -2);border:1px solid var(--raqm-ring);border-radius:9999px;background-color:var(--raqm-white);-webkit-user-select:none;user-select:none;transition-property:color,box-shadow;transition-duration:var(--raqm-duration-base);transition-timing-function:var(--raqm-ease-standard)}.raqm-slider-thumb:after{content:\"\";position:absolute;inset:calc(var(--raqm-spacing) * -2)}:host(:not([data-raqm-disabled])) .raqm-slider-thumb:hover,:host(:not([data-raqm-disabled])) .raqm-slider-thumb:active,.raqm-slider-thumb:has(.raqm-slider-input:focus-visible){box-shadow:0 0 0 var(--raqm-focus-ring-width) var(--raqm-focus-ring-color)}.raqm-slider-thumb:has(.raqm-slider-input:focus-visible){outline:2px solid transparent;outline-offset:2px}.raqm-slider-input{position:absolute;inset:0;inline-size:100%;block-size:100%;margin:0;padding:0;border:0;opacity:0;pointer-events:none}:host([data-raqm-vertical]) .raqm-slider-input:dir(rtl){writing-mode:vertical-rl}\n"]
501
+ }]
502
+ }],
503
+ ctorParameters: () => [],
504
+ propDecorators: {
505
+ value: [{
506
+ type: i0.Input,
507
+ args: [{
508
+ isSignal: true,
509
+ alias: "value",
510
+ required: false
511
+ }]
512
+ }],
513
+ defaultValue: [{
514
+ type: i0.Input,
515
+ args: [{
516
+ isSignal: true,
517
+ alias: "defaultValue",
518
+ required: false
519
+ }]
520
+ }],
521
+ min: [{
522
+ type: i0.Input,
523
+ args: [{
524
+ isSignal: true,
525
+ alias: "min",
526
+ required: false
527
+ }]
528
+ }],
529
+ max: [{
530
+ type: i0.Input,
531
+ args: [{
532
+ isSignal: true,
533
+ alias: "max",
534
+ required: false
535
+ }]
536
+ }],
537
+ step: [{
538
+ type: i0.Input,
539
+ args: [{
540
+ isSignal: true,
541
+ alias: "step",
542
+ required: false
543
+ }]
544
+ }],
545
+ vertical: [{
546
+ type: i0.Input,
547
+ args: [{
548
+ isSignal: true,
549
+ alias: "vertical",
550
+ required: false
551
+ }]
552
+ }],
553
+ disabled: [{
554
+ type: i0.Input,
555
+ args: [{
556
+ isSignal: true,
557
+ alias: "disabled",
558
+ required: false
559
+ }]
560
+ }],
561
+ name: [{
562
+ type: i0.Input,
563
+ args: [{
564
+ isSignal: true,
565
+ alias: "name",
566
+ required: false
567
+ }]
568
+ }],
569
+ form: [{
570
+ type: i0.Input,
571
+ args: [{
572
+ isSignal: true,
573
+ alias: "form",
574
+ required: false
575
+ }]
576
+ }],
577
+ id: [{
578
+ type: i0.Input,
579
+ args: [{
580
+ isSignal: true,
581
+ alias: "id",
582
+ required: false
583
+ }]
584
+ }],
585
+ thumbLabels: [{
586
+ type: i0.Input,
587
+ args: [{
588
+ isSignal: true,
589
+ alias: "thumbLabels",
590
+ required: false
591
+ }]
592
+ }],
593
+ valueChange: [{
594
+ type: i0.Output,
595
+ args: ["valueChange"]
596
+ }],
597
+ thumbElements: [{
598
+ type: i0.ViewChildren,
599
+ args: ["thumbEl", { isSignal: true }]
600
+ }],
601
+ thumbInputs: [{
602
+ type: i0.ViewChildren,
603
+ args: ["thumbInput", { isSignal: true }]
604
+ }]
605
+ }
606
+ });
607
+ export { RaqmSlider };
608
+
609
+ //# sourceMappingURL=raqm-ui-slider.mjs.map