@molecule/app-price-range-slider-angular 0.0.0-stage → 1.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,359 @@
1
- # Temporary Holding Version
1
+ <!--
2
+ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
+ Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
+ Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
+ To change this document, edit the module-level JSDoc in src/index.ts.
6
+ Generated: 2026-11-15T07:09:54.562Z
7
+ -->
2
8
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
9
+ # @molecule/app-price-range-slider-angular
10
+
11
+ Angular numeric min/max range picker — the Angular counterpart of
12
+ `@molecule/app-price-range-slider-react`: the same props and the same DOM
13
+ for the same input.
14
+
15
+ Exports `<PriceRangeSlider>` — TWO native `<input type="range">` controls
16
+ rendered side by side (min slider + max slider) with formatted endpoint
17
+ labels. The handles clamp against each other so `low <= high` always holds.
18
+ It is not a single-track dual-thumb slider.
19
+
20
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
21
+ > It is written to be read by coding agents as much as by people, and is generated from this
22
+ > package's source — edit `src/index.ts` JSDoc, not this file.
23
+
24
+ ## Quick Start
25
+
26
+ ```ts
27
+ import { Component } from '@angular/core'
28
+ import { PriceRangeSlider } from '@molecule/app-price-range-slider-angular'
29
+
30
+ @Component({
31
+ selector: 'price-filter',
32
+ standalone: true,
33
+ imports: [PriceRangeSlider],
34
+ template: `
35
+ <div
36
+ mol-price-range-slider
37
+ [min]="0"
38
+ [max]="1000"
39
+ [value]="[50, 500]"
40
+ [step]="10"
41
+ [onChange]="setRange"
42
+ >
43
+ <strong slot="label">Price range</strong>
44
+ </div>
45
+ `,
46
+ })
47
+ export class PriceFilter {}
48
+ ```
49
+
50
+ ## Type
51
+
52
+ `feature`
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ npm install @molecule/app-price-range-slider-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-ui @molecule/app-ui-angular
58
+ ```
59
+
60
+ ## API
61
+
62
+ ### Interfaces
63
+
64
+ #### `PriceRangeSliderProps`
65
+
66
+ Props accepted by {@link PriceRangeSlider} — the same props
67
+ `@molecule/app-price-range-slider-react` accepts. Node props (`label`) are
68
+ projected content in Angular (an input cannot carry a node), so they are
69
+ typed `unknown`: pass them in the host template, not as values.
70
+
71
+ ```typescript
72
+ interface PriceRangeSliderProps {
73
+ /** Minimum possible value. */
74
+ min: number
75
+ /** Maximum possible value. */
76
+ max: number
77
+ /** Current [low, high] tuple. If only one value is relevant, set low === min. */
78
+ value: [number, number]
79
+ /** Called whenever either handle moves. */
80
+ onChange: (value: [number, number]) => void
81
+ /** Step increment. Defaults to 1. */
82
+ step?: number
83
+ /** Called to format each endpoint label — defaults to USD currency formatting. */
84
+ formatValue?: (n: number) => string
85
+ /** Optional label above, projected as `[slot=label]` content (or a string input). */
86
+ label?: unknown
87
+ /** Extra classes. */
88
+ className?: string
89
+ }
90
+ ```
91
+
92
+ ### Classes
93
+
94
+ #### `PriceRangeSlider`
95
+
96
+ PriceRangeSlider component.
97
+
98
+ Dual-handle numeric range slider using two native `<input type="range">`
99
+ controls. Apps supply min/max/step and a `formatValue` to render the
100
+ endpoint labels (typical use: currency-formatted prices). The handles clamp
101
+ against each other so `low <= high` always holds. The host IS the outer
102
+ `<div>` (`div[mol-price-range-slider]`), matching React's root exactly. The
103
+ optional `label` is projected `[slot=label]` content (or a string input).
104
+
105
+ Angular projection needs an always-mounted `<ng-content>` capture point, so
106
+ the label wrapper lives in the template unconditionally and
107
+ {@link PriceRangeSlider.ngDoCheck} reconciles it against React's DOM (which
108
+ omits the `<span>` entirely when there is no label).
109
+
110
+ ```typescript
111
+ @Component({
112
+ selector: 'div[mol-price-range-slider]',
113
+ standalone: true,
114
+ imports: [],
115
+ inputs: ['min', 'max', 'value', 'step', 'formatValue', 'label', 'className', 'onChange'],
116
+ host: {
117
+ '[class]': 'classes()',
118
+ },
119
+ template: `<span #labelWrap [class]="labelClasses()"
120
+ ><ng-content select="[slot=label]"></ng-content>{{ labelText() }}</span
121
+ >
122
+ <div [class]="rowClasses()">
123
+ <span [class]="endpointClasses()">{{ fmt(low()) }}</span
124
+ ><input
125
+ type="range"
126
+ aria-label="Minimum"
127
+ [attr.min]="min"
128
+ [attr.max]="max"
129
+ [attr.step]="stepValue()"
130
+ [attr.value]="low()"
131
+ (input)="onMinInput($event)"
132
+ [class]="endpointInputClasses()"
133
+ /><input
134
+ type="range"
135
+ aria-label="Maximum"
136
+ [attr.min]="min"
137
+ [attr.max]="max"
138
+ [attr.step]="stepValue()"
139
+ [attr.value]="high()"
140
+ (input)="onMaxInput($event)"
141
+ [class]="endpointInputClasses()"
142
+ /><span [class]="endpointClasses()">{{ fmt(high()) }}</span>
143
+ </div>`,
144
+ })
145
+ export class PriceRangeSlider implements AfterViewInit, DoCheck {
146
+ /** Minimum possible value. */
147
+ min?: number
148
+ /** Maximum possible value. */
149
+ max?: number
150
+ /** Current [low, high] tuple. */
151
+ value?: [number, number]
152
+ /** Step increment (defaults to `'1'` at read time). */
153
+ step?: number
154
+ /** Called to format each endpoint label — defaults to USD currency formatting. */
155
+ formatValue?: (n: number) => string
156
+ /** Optional label above: a string input, or projected `[slot=label]` content. */
157
+ label?: unknown
158
+ /** Extra classes. */
159
+ className?: string
160
+ /** Called whenever either handle moves. */
161
+ onChange?: (value: [number, number]) => void
162
+
163
+ /** The label capture wrapper, detached when there is no label. */
164
+ @ViewChild('labelWrap') labelWrap?: ElementRef<HTMLElement>
165
+
166
+ private readonly host: HTMLElement = inject(ElementRef).nativeElement
167
+
168
+ /**
169
+ * The current class map.
170
+ * @returns The UIClassMap.
171
+ */
172
+ cm(): UIClassMap {
173
+ return getClassMap()
174
+ }
175
+
176
+ /**
177
+ * Computes the wrapper class list (`cm.stack(2)` + `className`).
178
+ * @returns The class string.
179
+ */
180
+ classes(): string {
181
+ return this.cm().cn(this.cm().stack(2), this.className)
182
+ }
183
+
184
+ /**
185
+ * Computes the label class list (`cm.textSize('xs')` + `cm.fontWeight('semibold')`).
186
+ * @returns The class string.
187
+ */
188
+ labelClasses(): string {
189
+ return this.cm().cn(this.cm().textSize('xs'), this.cm().fontWeight('semibold'))
190
+ }
191
+
192
+ /**
193
+ * Computes the slider row class (`cm.flex({ align: 'center', gap: 'sm' })`).
194
+ * @returns The class string.
195
+ */
196
+ rowClasses(): string {
197
+ return this.cm().flex({ align: 'center', gap: 'sm' })
198
+ }
199
+
200
+ /**
201
+ * Computes an endpoint label's class (`cm.textSize('sm')`, through `cn` so
202
+ * an `[class]` binding never receives a non-string member).
203
+ * @returns The class string.
204
+ */
205
+ endpointClasses(): string {
206
+ return this.cm().cn(this.cm().textSize('sm'))
207
+ }
208
+
209
+ /**
210
+ * Computes a range input's class (`cm.flex1`, through `cn` for the same
211
+ * reason).
212
+ * @returns The class string.
213
+ */
214
+ endpointInputClasses(): string {
215
+ return this.cm().cn(this.cm().flex1)
216
+ }
217
+
218
+ /**
219
+ * The step in effect (React's default parameter: an `undefined` binding must
220
+ * not erase the `1` default).
221
+ * @returns The step.
222
+ */
223
+ stepValue(): number {
224
+ return this.step ?? 1
225
+ }
226
+
227
+ /**
228
+ * The low endpoint of the current value tuple.
229
+ * @returns The low value.
230
+ */
231
+ low(): number {
232
+ return this.value?.[0] ?? 0
233
+ }
234
+
235
+ /**
236
+ * The high endpoint of the current value tuple.
237
+ * @returns The high value.
238
+ */
239
+ high(): number {
240
+ return this.value?.[1] ?? 0
241
+ }
242
+
243
+ /**
244
+ * Formats an endpoint label: the caller's `formatValue`, else the USD
245
+ * default (`$1,000`).
246
+ * @param n - The endpoint value.
247
+ * @returns The formatted label.
248
+ */
249
+ fmt(n: number): string {
250
+ return this.formatValue ? this.formatValue(n) : `$${n.toLocaleString()}`
251
+ }
252
+
253
+ /**
254
+ * The label input's text (a string input renders as text; a projected node
255
+ * label renders through the capture point instead).
256
+ * @returns The label text, or `''` when absent.
257
+ */
258
+ labelText(): string {
259
+ return typeof this.label === 'string' ? this.label : ''
260
+ }
261
+
262
+ /** Reads slot presence (view queries resolve only at view init). */
263
+ ngAfterViewInit(): void {
264
+ this.reconcile()
265
+ this.syncInputs()
266
+ }
267
+
268
+ /** Re-reconciles on later passes (a string `label` input or the tuple may change). */
269
+ ngDoCheck(): void {
270
+ this.reconcile()
271
+ this.syncInputs()
272
+ }
273
+
274
+ /**
275
+ * Keeps the two inputs' live values on React's controlled values. The
276
+ * attribute binding alone does not re-write the live property after a user
277
+ * edit, and React re-writes the property on every re-render.
278
+ */
279
+ private syncInputs(): void {
280
+ const minEl = this.host.querySelector<HTMLInputElement>('input[aria-label="Minimum"]')
281
+ const maxEl = this.host.querySelector<HTMLInputElement>('input[aria-label="Maximum"]')
282
+ if (minEl && minEl.value !== String(this.low())) minEl.value = String(this.low())
283
+ if (maxEl && maxEl.value !== String(this.high())) maxEl.value = String(this.high())
284
+ }
285
+
286
+ /** Applies React's condition: no `<span>` at all when there is no label. */
287
+ private reconcile(): void {
288
+ const wrap = this.labelWrap?.nativeElement
289
+ if (!wrap) return
290
+ if (this.hasLabel() || hasNodes(wrap)) {
291
+ if (wrap.parentNode !== this.host) this.host.insertBefore(wrap, this.host.firstChild)
292
+ } else if (wrap.parentNode === this.host) {
293
+ this.host.removeChild(wrap)
294
+ }
295
+ }
296
+
297
+ /**
298
+ * Whether a string label input is present (a projected node label is not).
299
+ * @returns True when the label input renders as text.
300
+ */
301
+ private hasLabel(): boolean {
302
+ return this.label !== undefined && this.label !== null && this.label !== ''
303
+ }
304
+
305
+ /**
306
+ * Handles the minimum handle's move (React's `onChange` fires on the native
307
+ * `input` event): clamps against `high`, publishes the tuple, then restores
308
+ * the controlled value — React restores a controlled input right after the
309
+ * change handler returns.
310
+ *
311
+ * @param event - The input event.
312
+ */
313
+ onMinInput(event: Event): void {
314
+ const element = event.target as HTMLInputElement
315
+ this.onChange?.([Math.min(Number(element.value), this.high()), this.high()])
316
+ element.value = String(this.low())
317
+ }
318
+
319
+ /**
320
+ * Handles the maximum handle's move: clamps against `low`, publishes the
321
+ * tuple, then restores the controlled value.
322
+ *
323
+ * @param event - The input event.
324
+ */
325
+ onMaxInput(event: Event): void {
326
+ const element = event.target as HTMLInputElement
327
+ this.onChange?.([this.low(), Math.max(Number(element.value), this.low())])
328
+ element.value = String(this.high())
329
+ }
330
+ }
331
+ ```
332
+
333
+ ## Injection Notes
334
+
335
+ ### Requirements
336
+
337
+ Peer dependencies:
338
+
339
+ - `@angular/common` ^22.0.0
340
+ - `@angular/core` ^22.0.0
341
+ - `@angular/platform-browser` ^22.0.0
342
+ - `@molecule/app-angular` ^3.5.0
343
+ - `@molecule/app-ui` ^1.0.1
344
+ - `@molecule/app-ui-angular` ^1.1.0
345
+
346
+ ### Runtime Dependencies
347
+
348
+ - `@angular/common`
349
+ - `@angular/core`
350
+ - `@angular/platform-browser`
351
+ - `@molecule/app-angular`
352
+ - `@molecule/app-ui`
353
+ - `@molecule/app-ui-angular`
354
+
355
+ The default `formatValue` renders US-style dollars (`$1,000`) — always pass
356
+ your own formatter for non-USD apps. The two sliders carry fixed English
357
+ aria-labels ("Minimum"/"Maximum"); there is no locale bond. Requires a
358
+ wired ClassMap bond (`getClassMap()`). The optional `label` is projected
359
+ `[slot=label]` content (or a string `label` input).
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Angular numeric min/max range picker — the Angular counterpart of
3
+ * `@molecule/app-price-range-slider-react`: the same props and the same DOM
4
+ * for the same input.
5
+ *
6
+ * Exports `<PriceRangeSlider>` — TWO native `<input type="range">` controls
7
+ * rendered side by side (min slider + max slider) with formatted endpoint
8
+ * labels. The handles clamp against each other so `low <= high` always holds.
9
+ * It is not a single-track dual-thumb slider.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { Component } from '@angular/core'
14
+ * import { PriceRangeSlider } from '@molecule/app-price-range-slider-angular'
15
+ *
16
+ * @Component({
17
+ * selector: 'price-filter',
18
+ * standalone: true,
19
+ * imports: [PriceRangeSlider],
20
+ * template: `
21
+ * <div
22
+ * mol-price-range-slider
23
+ * [min]="0"
24
+ * [max]="1000"
25
+ * [value]="[50, 500]"
26
+ * [step]="10"
27
+ * [onChange]="setRange"
28
+ * >
29
+ * <strong slot="label">Price range</strong>
30
+ * </div>
31
+ * `,
32
+ * })
33
+ * export class PriceFilter {}
34
+ * ```
35
+ *
36
+ * @remarks
37
+ * The default `formatValue` renders US-style dollars (`$1,000`) — always pass
38
+ * your own formatter for non-USD apps. The two sliders carry fixed English
39
+ * aria-labels ("Minimum"/"Maximum"); there is no locale bond. Requires a
40
+ * wired ClassMap bond (`getClassMap()`). The optional `label` is projected
41
+ * `[slot=label]` content (or a string `label` input).
42
+ *
43
+ * @module
44
+ */
45
+ export * from './price-range-slider.component.js';
46
+ export * from './types.js';
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,cAAc,mCAAmC,CAAA;AACjD,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Angular numeric min/max range picker — the Angular counterpart of
3
+ * `@molecule/app-price-range-slider-react`: the same props and the same DOM
4
+ * for the same input.
5
+ *
6
+ * Exports `<PriceRangeSlider>` — TWO native `<input type="range">` controls
7
+ * rendered side by side (min slider + max slider) with formatted endpoint
8
+ * labels. The handles clamp against each other so `low <= high` always holds.
9
+ * It is not a single-track dual-thumb slider.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { Component } from '@angular/core'
14
+ * import { PriceRangeSlider } from '@molecule/app-price-range-slider-angular'
15
+ *
16
+ * @Component({
17
+ * selector: 'price-filter',
18
+ * standalone: true,
19
+ * imports: [PriceRangeSlider],
20
+ * template: `
21
+ * <div
22
+ * mol-price-range-slider
23
+ * [min]="0"
24
+ * [max]="1000"
25
+ * [value]="[50, 500]"
26
+ * [step]="10"
27
+ * [onChange]="setRange"
28
+ * >
29
+ * <strong slot="label">Price range</strong>
30
+ * </div>
31
+ * `,
32
+ * })
33
+ * export class PriceFilter {}
34
+ * ```
35
+ *
36
+ * @remarks
37
+ * The default `formatValue` renders US-style dollars (`$1,000`) — always pass
38
+ * your own formatter for non-USD apps. The two sliders carry fixed English
39
+ * aria-labels ("Minimum"/"Maximum"); there is no locale bond. Requires a
40
+ * wired ClassMap bond (`getClassMap()`). The optional `label` is projected
41
+ * `[slot=label]` content (or a string `label` input).
42
+ *
43
+ * @module
44
+ */
45
+ export * from './price-range-slider.component.js';
46
+ export * from './types.js';
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,cAAc,mCAAmC,CAAA;AACjD,cAAc,YAAY,CAAA"}
@@ -0,0 +1,141 @@
1
+ /**
2
+ * PriceRangeSlider component (React parity).
3
+ *
4
+ * @module
5
+ */
6
+ import { type AfterViewInit, type DoCheck, ElementRef } from '@angular/core';
7
+ import type { UIClassMap } from '@molecule/app-ui';
8
+ import * as i0 from "@angular/core";
9
+ /**
10
+ * PriceRangeSlider component.
11
+ *
12
+ * Dual-handle numeric range slider using two native `<input type="range">`
13
+ * controls. Apps supply min/max/step and a `formatValue` to render the
14
+ * endpoint labels (typical use: currency-formatted prices). The handles clamp
15
+ * against each other so `low <= high` always holds. The host IS the outer
16
+ * `<div>` (`div[mol-price-range-slider]`), matching React's root exactly. The
17
+ * optional `label` is projected `[slot=label]` content (or a string input).
18
+ *
19
+ * Angular projection needs an always-mounted `<ng-content>` capture point, so
20
+ * the label wrapper lives in the template unconditionally and
21
+ * {@link PriceRangeSlider.ngDoCheck} reconciles it against React's DOM (which
22
+ * omits the `<span>` entirely when there is no label).
23
+ */
24
+ export declare class PriceRangeSlider implements AfterViewInit, DoCheck {
25
+ /** Minimum possible value. */
26
+ min?: number;
27
+ /** Maximum possible value. */
28
+ max?: number;
29
+ /** Current [low, high] tuple. */
30
+ value?: [number, number];
31
+ /** Step increment (defaults to `'1'` at read time). */
32
+ step?: number;
33
+ /** Called to format each endpoint label — defaults to USD currency formatting. */
34
+ formatValue?: (n: number) => string;
35
+ /** Optional label above: a string input, or projected `[slot=label]` content. */
36
+ label?: unknown;
37
+ /** Extra classes. */
38
+ className?: string;
39
+ /** Called whenever either handle moves. */
40
+ onChange?: (value: [number, number]) => void;
41
+ /** The label capture wrapper, detached when there is no label. */
42
+ labelWrap?: ElementRef<HTMLElement>;
43
+ private readonly host;
44
+ /**
45
+ * The current class map.
46
+ * @returns The UIClassMap.
47
+ */
48
+ cm(): UIClassMap;
49
+ /**
50
+ * Computes the wrapper class list (`cm.stack(2)` + `className`).
51
+ * @returns The class string.
52
+ */
53
+ classes(): string;
54
+ /**
55
+ * Computes the label class list (`cm.textSize('xs')` + `cm.fontWeight('semibold')`).
56
+ * @returns The class string.
57
+ */
58
+ labelClasses(): string;
59
+ /**
60
+ * Computes the slider row class (`cm.flex({ align: 'center', gap: 'sm' })`).
61
+ * @returns The class string.
62
+ */
63
+ rowClasses(): string;
64
+ /**
65
+ * Computes an endpoint label's class (`cm.textSize('sm')`, through `cn` so
66
+ * an `[class]` binding never receives a non-string member).
67
+ * @returns The class string.
68
+ */
69
+ endpointClasses(): string;
70
+ /**
71
+ * Computes a range input's class (`cm.flex1`, through `cn` for the same
72
+ * reason).
73
+ * @returns The class string.
74
+ */
75
+ endpointInputClasses(): string;
76
+ /**
77
+ * The step in effect (React's default parameter: an `undefined` binding must
78
+ * not erase the `1` default).
79
+ * @returns The step.
80
+ */
81
+ stepValue(): number;
82
+ /**
83
+ * The low endpoint of the current value tuple.
84
+ * @returns The low value.
85
+ */
86
+ low(): number;
87
+ /**
88
+ * The high endpoint of the current value tuple.
89
+ * @returns The high value.
90
+ */
91
+ high(): number;
92
+ /**
93
+ * Formats an endpoint label: the caller's `formatValue`, else the USD
94
+ * default (`$1,000`).
95
+ * @param n - The endpoint value.
96
+ * @returns The formatted label.
97
+ */
98
+ fmt(n: number): string;
99
+ /**
100
+ * The label input's text (a string input renders as text; a projected node
101
+ * label renders through the capture point instead).
102
+ * @returns The label text, or `''` when absent.
103
+ */
104
+ labelText(): string;
105
+ /** Reads slot presence (view queries resolve only at view init). */
106
+ ngAfterViewInit(): void;
107
+ /** Re-reconciles on later passes (a string `label` input or the tuple may change). */
108
+ ngDoCheck(): void;
109
+ /**
110
+ * Keeps the two inputs' live values on React's controlled values. The
111
+ * attribute binding alone does not re-write the live property after a user
112
+ * edit, and React re-writes the property on every re-render.
113
+ */
114
+ private syncInputs;
115
+ /** Applies React's condition: no `<span>` at all when there is no label. */
116
+ private reconcile;
117
+ /**
118
+ * Whether a string label input is present (a projected node label is not).
119
+ * @returns True when the label input renders as text.
120
+ */
121
+ private hasLabel;
122
+ /**
123
+ * Handles the minimum handle's move (React's `onChange` fires on the native
124
+ * `input` event): clamps against `high`, publishes the tuple, then restores
125
+ * the controlled value — React restores a controlled input right after the
126
+ * change handler returns.
127
+ *
128
+ * @param event - The input event.
129
+ */
130
+ onMinInput(event: Event): void;
131
+ /**
132
+ * Handles the maximum handle's move: clamps against `low`, publishes the
133
+ * tuple, then restores the controlled value.
134
+ *
135
+ * @param event - The input event.
136
+ */
137
+ onMaxInput(event: Event): void;
138
+ static ɵfac: i0.ɵɵFactoryDeclaration<PriceRangeSlider, never>;
139
+ static ɵcmp: i0.ɵɵComponentDeclaration<PriceRangeSlider, "div[mol-price-range-slider]", never, { "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "value": { "alias": "value"; "required": false; }; "step": { "alias": "step"; "required": false; }; "formatValue": { "alias": "formatValue"; "required": false; }; "label": { "alias": "label"; "required": false; }; "className": { "alias": "className"; "required": false; }; "onChange": { "alias": "onChange"; "required": false; }; }, {}, never, ["[slot=label]"], true, never>;
140
+ }
141
+ //# sourceMappingURL=price-range-slider.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-range-slider.component.d.ts","sourceRoot":"","sources":["../src/price-range-slider.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,OAAO,EACZ,UAAU,EAGX,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAkBlD;;;;;;;;;;;;;;GAcG;AACH,qBAkCa,gBAAiB,YAAW,aAAa,EAAE,OAAO;IAC7D,8BAA8B;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,8BAA8B;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,iCAAiC;IACjC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxB,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kFAAkF;IAClF,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IACnC,iFAAiF;IACjF,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAA;IAE5C,kEAAkE;IAC1C,SAAS,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,CAAA;IAE3D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAgD;IAErE;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAItB;;;OAGG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;OAIG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;OAIG;IACH,oBAAoB,IAAI,MAAM;IAI9B;;;;OAIG;IACH,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,GAAG,IAAI,MAAM;IAIb;;;OAGG;IACH,IAAI,IAAI,MAAM;IAId;;;;;OAKG;IACH,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAItB;;;;OAIG;IACH,SAAS,IAAI,MAAM;IAInB,oEAAoE;IACpE,eAAe,IAAI,IAAI;IAKvB,sFAAsF;IACtF,SAAS,IAAI,IAAI;IAKjB;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAOlB,4EAA4E;IAC5E,OAAO,CAAC,SAAS;IAUjB;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAIhB;;;;;;;OAOG;IACH,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAM9B;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;yCApLnB,gBAAgB;2CAAhB,gBAAgB;CAyL5B"}
@@ -0,0 +1,303 @@
1
+ /**
2
+ * PriceRangeSlider component (React parity).
3
+ *
4
+ * @module
5
+ */
6
+ import { Component, ElementRef, inject, ViewChild, } from '@angular/core';
7
+ import { getClassMap } from '@molecule/app-ui';
8
+ import * as i0 from "@angular/core";
9
+ const _c0 = ["labelWrap"];
10
+ const _c1 = [[["", "slot", "label"]]];
11
+ const _c2 = ["[slot=label]"];
12
+ /**
13
+ * Whether an ng-content capture point received any element or text node.
14
+ *
15
+ * @param el - The capture element.
16
+ * @returns True when at least one rendered node exists.
17
+ */
18
+ const hasNodes = (el) => {
19
+ if (!el)
20
+ return false;
21
+ for (const node of Array.from(el.childNodes)) {
22
+ if (node.nodeType === Node.ELEMENT_NODE)
23
+ return true;
24
+ if (node.nodeType === Node.TEXT_NODE && (node.textContent ?? '').trim())
25
+ return true;
26
+ }
27
+ return false;
28
+ };
29
+ /**
30
+ * PriceRangeSlider component.
31
+ *
32
+ * Dual-handle numeric range slider using two native `<input type="range">`
33
+ * controls. Apps supply min/max/step and a `formatValue` to render the
34
+ * endpoint labels (typical use: currency-formatted prices). The handles clamp
35
+ * against each other so `low <= high` always holds. The host IS the outer
36
+ * `<div>` (`div[mol-price-range-slider]`), matching React's root exactly. The
37
+ * optional `label` is projected `[slot=label]` content (or a string input).
38
+ *
39
+ * Angular projection needs an always-mounted `<ng-content>` capture point, so
40
+ * the label wrapper lives in the template unconditionally and
41
+ * {@link PriceRangeSlider.ngDoCheck} reconciles it against React's DOM (which
42
+ * omits the `<span>` entirely when there is no label).
43
+ */
44
+ export class PriceRangeSlider {
45
+ /** Minimum possible value. */
46
+ min;
47
+ /** Maximum possible value. */
48
+ max;
49
+ /** Current [low, high] tuple. */
50
+ value;
51
+ /** Step increment (defaults to `'1'` at read time). */
52
+ step;
53
+ /** Called to format each endpoint label — defaults to USD currency formatting. */
54
+ formatValue;
55
+ /** Optional label above: a string input, or projected `[slot=label]` content. */
56
+ label;
57
+ /** Extra classes. */
58
+ className;
59
+ /** Called whenever either handle moves. */
60
+ onChange;
61
+ /** The label capture wrapper, detached when there is no label. */
62
+ labelWrap;
63
+ host = inject(ElementRef).nativeElement;
64
+ /**
65
+ * The current class map.
66
+ * @returns The UIClassMap.
67
+ */
68
+ cm() {
69
+ return getClassMap();
70
+ }
71
+ /**
72
+ * Computes the wrapper class list (`cm.stack(2)` + `className`).
73
+ * @returns The class string.
74
+ */
75
+ classes() {
76
+ return this.cm().cn(this.cm().stack(2), this.className);
77
+ }
78
+ /**
79
+ * Computes the label class list (`cm.textSize('xs')` + `cm.fontWeight('semibold')`).
80
+ * @returns The class string.
81
+ */
82
+ labelClasses() {
83
+ return this.cm().cn(this.cm().textSize('xs'), this.cm().fontWeight('semibold'));
84
+ }
85
+ /**
86
+ * Computes the slider row class (`cm.flex({ align: 'center', gap: 'sm' })`).
87
+ * @returns The class string.
88
+ */
89
+ rowClasses() {
90
+ return this.cm().flex({ align: 'center', gap: 'sm' });
91
+ }
92
+ /**
93
+ * Computes an endpoint label's class (`cm.textSize('sm')`, through `cn` so
94
+ * an `[class]` binding never receives a non-string member).
95
+ * @returns The class string.
96
+ */
97
+ endpointClasses() {
98
+ return this.cm().cn(this.cm().textSize('sm'));
99
+ }
100
+ /**
101
+ * Computes a range input's class (`cm.flex1`, through `cn` for the same
102
+ * reason).
103
+ * @returns The class string.
104
+ */
105
+ endpointInputClasses() {
106
+ return this.cm().cn(this.cm().flex1);
107
+ }
108
+ /**
109
+ * The step in effect (React's default parameter: an `undefined` binding must
110
+ * not erase the `1` default).
111
+ * @returns The step.
112
+ */
113
+ stepValue() {
114
+ return this.step ?? 1;
115
+ }
116
+ /**
117
+ * The low endpoint of the current value tuple.
118
+ * @returns The low value.
119
+ */
120
+ low() {
121
+ return this.value?.[0] ?? 0;
122
+ }
123
+ /**
124
+ * The high endpoint of the current value tuple.
125
+ * @returns The high value.
126
+ */
127
+ high() {
128
+ return this.value?.[1] ?? 0;
129
+ }
130
+ /**
131
+ * Formats an endpoint label: the caller's `formatValue`, else the USD
132
+ * default (`$1,000`).
133
+ * @param n - The endpoint value.
134
+ * @returns The formatted label.
135
+ */
136
+ fmt(n) {
137
+ return this.formatValue ? this.formatValue(n) : `$${n.toLocaleString()}`;
138
+ }
139
+ /**
140
+ * The label input's text (a string input renders as text; a projected node
141
+ * label renders through the capture point instead).
142
+ * @returns The label text, or `''` when absent.
143
+ */
144
+ labelText() {
145
+ return typeof this.label === 'string' ? this.label : '';
146
+ }
147
+ /** Reads slot presence (view queries resolve only at view init). */
148
+ ngAfterViewInit() {
149
+ this.reconcile();
150
+ this.syncInputs();
151
+ }
152
+ /** Re-reconciles on later passes (a string `label` input or the tuple may change). */
153
+ ngDoCheck() {
154
+ this.reconcile();
155
+ this.syncInputs();
156
+ }
157
+ /**
158
+ * Keeps the two inputs' live values on React's controlled values. The
159
+ * attribute binding alone does not re-write the live property after a user
160
+ * edit, and React re-writes the property on every re-render.
161
+ */
162
+ syncInputs() {
163
+ const minEl = this.host.querySelector('input[aria-label="Minimum"]');
164
+ const maxEl = this.host.querySelector('input[aria-label="Maximum"]');
165
+ if (minEl && minEl.value !== String(this.low()))
166
+ minEl.value = String(this.low());
167
+ if (maxEl && maxEl.value !== String(this.high()))
168
+ maxEl.value = String(this.high());
169
+ }
170
+ /** Applies React's condition: no `<span>` at all when there is no label. */
171
+ reconcile() {
172
+ const wrap = this.labelWrap?.nativeElement;
173
+ if (!wrap)
174
+ return;
175
+ if (this.hasLabel() || hasNodes(wrap)) {
176
+ if (wrap.parentNode !== this.host)
177
+ this.host.insertBefore(wrap, this.host.firstChild);
178
+ }
179
+ else if (wrap.parentNode === this.host) {
180
+ this.host.removeChild(wrap);
181
+ }
182
+ }
183
+ /**
184
+ * Whether a string label input is present (a projected node label is not).
185
+ * @returns True when the label input renders as text.
186
+ */
187
+ hasLabel() {
188
+ return this.label !== undefined && this.label !== null && this.label !== '';
189
+ }
190
+ /**
191
+ * Handles the minimum handle's move (React's `onChange` fires on the native
192
+ * `input` event): clamps against `high`, publishes the tuple, then restores
193
+ * the controlled value — React restores a controlled input right after the
194
+ * change handler returns.
195
+ *
196
+ * @param event - The input event.
197
+ */
198
+ onMinInput(event) {
199
+ const element = event.target;
200
+ this.onChange?.([Math.min(Number(element.value), this.high()), this.high()]);
201
+ element.value = String(this.low());
202
+ }
203
+ /**
204
+ * Handles the maximum handle's move: clamps against `low`, publishes the
205
+ * tuple, then restores the controlled value.
206
+ *
207
+ * @param event - The input event.
208
+ */
209
+ onMaxInput(event) {
210
+ const element = event.target;
211
+ this.onChange?.([this.low(), Math.max(Number(element.value), this.low())]);
212
+ element.value = String(this.high());
213
+ }
214
+ static ɵfac = function PriceRangeSlider_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PriceRangeSlider)(); };
215
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PriceRangeSlider, selectors: [["div", "mol-price-range-slider", ""]], viewQuery: function PriceRangeSlider_Query(rf, ctx) { if (rf & 1) {
216
+ i0.ɵɵviewQuery(_c0, 5);
217
+ } if (rf & 2) {
218
+ let _t;
219
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.labelWrap = _t.first);
220
+ } }, hostVars: 2, hostBindings: function PriceRangeSlider_HostBindings(rf, ctx) { if (rf & 2) {
221
+ i0.ɵɵclassMap(ctx.classes());
222
+ } }, inputs: { min: "min", max: "max", value: "value", step: "step", formatValue: "formatValue", label: "label", className: "className", onChange: "onChange" }, ngContentSelectors: _c2, decls: 11, vars: 23, consts: [["labelWrap", ""], ["type", "range", "aria-label", "Minimum", 3, "input"], ["type", "range", "aria-label", "Maximum", 3, "input"]], template: function PriceRangeSlider_Template(rf, ctx) { if (rf & 1) {
223
+ i0.ɵɵprojectionDef(_c1);
224
+ i0.ɵɵdomElementStart(0, "span", null, 0);
225
+ i0.ɵɵprojection(2);
226
+ i0.ɵɵtext(3);
227
+ i0.ɵɵdomElementEnd();
228
+ i0.ɵɵdomElementStart(4, "div")(5, "span");
229
+ i0.ɵɵtext(6);
230
+ i0.ɵɵdomElementEnd();
231
+ i0.ɵɵdomElementStart(7, "input", 1);
232
+ i0.ɵɵdomListener("input", function PriceRangeSlider_Template_input_input_7_listener($event) { return ctx.onMinInput($event); });
233
+ i0.ɵɵdomElementEnd();
234
+ i0.ɵɵdomElementStart(8, "input", 2);
235
+ i0.ɵɵdomListener("input", function PriceRangeSlider_Template_input_input_8_listener($event) { return ctx.onMaxInput($event); });
236
+ i0.ɵɵdomElementEnd();
237
+ i0.ɵɵdomElementStart(9, "span");
238
+ i0.ɵɵtext(10);
239
+ i0.ɵɵdomElementEnd()();
240
+ } if (rf & 2) {
241
+ i0.ɵɵclassMap(ctx.labelClasses());
242
+ i0.ɵɵadvance(3);
243
+ i0.ɵɵtextInterpolate(ctx.labelText());
244
+ i0.ɵɵadvance();
245
+ i0.ɵɵclassMap(ctx.rowClasses());
246
+ i0.ɵɵadvance();
247
+ i0.ɵɵclassMap(ctx.endpointClasses());
248
+ i0.ɵɵadvance();
249
+ i0.ɵɵtextInterpolate(ctx.fmt(ctx.low()));
250
+ i0.ɵɵadvance();
251
+ i0.ɵɵclassMap(ctx.endpointInputClasses());
252
+ i0.ɵɵattribute("min", ctx.min)("max", ctx.max)("step", ctx.stepValue())("value", ctx.low());
253
+ i0.ɵɵadvance();
254
+ i0.ɵɵclassMap(ctx.endpointInputClasses());
255
+ i0.ɵɵattribute("min", ctx.min)("max", ctx.max)("step", ctx.stepValue())("value", ctx.high());
256
+ i0.ɵɵadvance();
257
+ i0.ɵɵclassMap(ctx.endpointClasses());
258
+ i0.ɵɵadvance();
259
+ i0.ɵɵtextInterpolate(ctx.fmt(ctx.high()));
260
+ } }, encapsulation: 2 });
261
+ }
262
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PriceRangeSlider, [{
263
+ type: Component,
264
+ args: [{
265
+ selector: 'div[mol-price-range-slider]',
266
+ standalone: true,
267
+ imports: [],
268
+ inputs: ['min', 'max', 'value', 'step', 'formatValue', 'label', 'className', 'onChange'],
269
+ host: {
270
+ '[class]': 'classes()',
271
+ },
272
+ template: `<span #labelWrap [class]="labelClasses()"
273
+ ><ng-content select="[slot=label]"></ng-content>{{ labelText() }}</span
274
+ >
275
+ <div [class]="rowClasses()">
276
+ <span [class]="endpointClasses()">{{ fmt(low()) }}</span
277
+ ><input
278
+ type="range"
279
+ aria-label="Minimum"
280
+ [attr.min]="min"
281
+ [attr.max]="max"
282
+ [attr.step]="stepValue()"
283
+ [attr.value]="low()"
284
+ (input)="onMinInput($event)"
285
+ [class]="endpointInputClasses()"
286
+ /><input
287
+ type="range"
288
+ aria-label="Maximum"
289
+ [attr.min]="min"
290
+ [attr.max]="max"
291
+ [attr.step]="stepValue()"
292
+ [attr.value]="high()"
293
+ (input)="onMaxInput($event)"
294
+ [class]="endpointInputClasses()"
295
+ /><span [class]="endpointClasses()">{{ fmt(high()) }}</span>
296
+ </div>`,
297
+ }]
298
+ }], null, { labelWrap: [{
299
+ type: ViewChild,
300
+ args: ['labelWrap']
301
+ }] }); })();
302
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PriceRangeSlider, { className: "PriceRangeSlider", filePath: "price-range-slider.component.ts", lineNumber: 83 }); })();
303
+ //# sourceMappingURL=price-range-slider.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-range-slider.component.js","sourceRoot":"","sources":["../src/price-range-slider.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,SAAS,EAET,UAAU,EACV,MAAM,EACN,SAAS,GACV,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;;;;;AAE9C;;;;;GAKG;AACH,MAAM,QAAQ,GAAG,CAAC,EAA8B,EAAW,EAAE;IAC3D,IAAI,CAAC,EAAE;QAAE,OAAO,KAAK,CAAA;IACrB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7C,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;YAAE,OAAO,IAAI,CAAA;QACpD,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;YAAE,OAAO,IAAI,CAAA;IACtF,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED;;;;;;;;;;;;;;GAcG;AAmCH,MAAM,OAAO,gBAAgB;IAC3B,8BAA8B;IA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,SAAS,EAAE,WAAW;iBACvB;gBACD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;WAwBD;aACV;;kBAoBE,SAAS;mBAAC,WAAW;;kFAnBX,gBAAgB"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Types of `@molecule/app-price-range-slider-angular` — the Angular
3
+ * counterpart of `@molecule/app-price-range-slider-react`, same props and DOM.
4
+ *
5
+ * @module
6
+ */
7
+ /**
8
+ * Props accepted by {@link PriceRangeSlider} — the same props
9
+ * `@molecule/app-price-range-slider-react` accepts. Node props (`label`) are
10
+ * projected content in Angular (an input cannot carry a node), so they are
11
+ * typed `unknown`: pass them in the host template, not as values.
12
+ */
13
+ export interface PriceRangeSliderProps {
14
+ /** Minimum possible value. */
15
+ min: number;
16
+ /** Maximum possible value. */
17
+ max: number;
18
+ /** Current [low, high] tuple. If only one value is relevant, set low === min. */
19
+ value: [number, number];
20
+ /** Called whenever either handle moves. */
21
+ onChange: (value: [number, number]) => void;
22
+ /** Step increment. Defaults to 1. */
23
+ step?: number;
24
+ /** Called to format each endpoint label — defaults to USD currency formatting. */
25
+ formatValue?: (n: number) => string;
26
+ /** Optional label above, projected as `[slot=label]` content (or a string input). */
27
+ label?: unknown;
28
+ /** Extra classes. */
29
+ className?: string;
30
+ }
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,iFAAiF;IACjF,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACvB,2CAA2C;IAC3C,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAA;IAC3C,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kFAAkF;IAClF,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IACnC,qFAAqF;IACrF,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types of `@molecule/app-price-range-slider-angular` — the Angular
3
+ * counterpart of `@molecule/app-price-range-slider-react`, same props and DOM.
4
+ *
5
+ * @module
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json CHANGED
@@ -1,6 +1,71 @@
1
1
  {
2
2
  "name": "@molecule/app-price-range-slider-angular",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0",
4
+ "description": "Single- or dual-handle range slider with formatted labels",
5
+ "homepage": "https://www.molecule.dev/packages/app-price-range-slider-angular",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "ngc",
21
+ "dev": "ngc --watch",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest"
24
+ },
25
+ "keywords": [
26
+ "molecule",
27
+ "price-range-slider",
28
+ "angular"
29
+ ],
30
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
31
+ "license": "Apache-2.0",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/molecule-dev/molecule.git",
35
+ "directory": "packages/app/features/price-range-slider-angular"
36
+ },
37
+ "engines": {
38
+ "node": ">=20"
39
+ },
40
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "peerDependencies": {
45
+ "@angular/common": "^22.0.0",
46
+ "@angular/core": "^22.0.0",
47
+ "@angular/platform-browser": "^22.0.0",
48
+ "@molecule/app-angular": "^3.5.0",
49
+ "@molecule/app-ui": "^1.0.1",
50
+ "@molecule/app-ui-angular": "^1.1.0"
51
+ },
52
+ "devDependencies": {
53
+ "@angular/common": "22.2.3",
54
+ "@angular/compiler": "22.2.3",
55
+ "@angular/compiler-cli": "22.2.3",
56
+ "@angular/core": "22.2.3",
57
+ "@angular/platform-browser": "22.2.3",
58
+ "@molecule/app-angular": "3.7.1",
59
+ "@molecule/app-framework-conformance": "0.0.0",
60
+ "@molecule/app-i18n": "1.2.2",
61
+ "@molecule/app-icons": "1.0.4",
62
+ "@molecule/app-ui": "1.4.0",
63
+ "@molecule/app-ui-angular": "1.2.0",
64
+ "@types/node": "26.6.5",
65
+ "jsdom": "30.1.3",
66
+ "rxjs": "7.8.2",
67
+ "typescript": "6.0.3",
68
+ "vitest": "4.1.12",
69
+ "zone.js": "0.16.3"
70
+ }
71
+ }