lumiverse-spindle-types 0.5.4 → 0.5.6
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/package.json +1 -1
- package/src/components.ts +91 -1
package/package.json
CHANGED
package/src/components.ts
CHANGED
|
@@ -169,6 +169,67 @@ export interface SpindleNumberStepperHandle extends SpindleMountedComponent<Spin
|
|
|
169
169
|
getValue(): number | null;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Declarative formatting for the value displayed in a range slider's header.
|
|
174
|
+
*
|
|
175
|
+
* Composed as `prefix + formatted-number + suffix`. The number portion respects
|
|
176
|
+
* `decimals` if provided; otherwise it follows the slider's `step` (integer
|
|
177
|
+
* sliders show whole numbers; floats show as many decimals as `step` implies).
|
|
178
|
+
*
|
|
179
|
+
* For more complex formatting (e.g. localized strings, range-dependent units),
|
|
180
|
+
* omit the `label` field and render your own header outside the slider while
|
|
181
|
+
* using {@link SpindleRangeSliderOptions.onDragValue} to track the live value.
|
|
182
|
+
*/
|
|
183
|
+
export interface SpindleRangeSliderFormat {
|
|
184
|
+
/** Number of decimal places to show. Defaults to whatever `step` implies. */
|
|
185
|
+
decimals?: number;
|
|
186
|
+
/** String appended after the value (e.g. `"%"`, `"ms"`, `" tokens"`). */
|
|
187
|
+
suffix?: string;
|
|
188
|
+
/** String prepended before the value. */
|
|
189
|
+
prefix?: string;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface SpindleRangeSliderOptions {
|
|
193
|
+
/** Inclusive lower bound. */
|
|
194
|
+
min: number;
|
|
195
|
+
/** Inclusive upper bound. */
|
|
196
|
+
max: number;
|
|
197
|
+
/** Initial committed value. Defaults to `min` if omitted. */
|
|
198
|
+
value?: number;
|
|
199
|
+
/** Snap increment. Default: `1`. */
|
|
200
|
+
step?: number;
|
|
201
|
+
/** Round to integers regardless of `step` formatting. Default: `false`. */
|
|
202
|
+
integer?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Fired once when a drag ends with a new value (mouse release, touch lift,
|
|
205
|
+
* or tap-to-jump). Not fired during the drag itself — that's `onDragValue`.
|
|
206
|
+
*/
|
|
207
|
+
onCommit?: (value: number) => void;
|
|
208
|
+
/**
|
|
209
|
+
* Fired with the live value during a gesture, and with `null` if the gesture
|
|
210
|
+
* ends without committing (e.g. cancelled touch). Use this to mirror the
|
|
211
|
+
* value into a sibling label or for previews; the host already updates the
|
|
212
|
+
* built-in header in real time when {@link label} is provided.
|
|
213
|
+
*/
|
|
214
|
+
onDragValue?: (value: number | null) => void;
|
|
215
|
+
/** Optional header label rendered above the track. */
|
|
216
|
+
label?: string;
|
|
217
|
+
/** Optional helper text rendered below the header. */
|
|
218
|
+
hint?: string;
|
|
219
|
+
/**
|
|
220
|
+
* Declarative formatting for the displayed value when {@link label} is
|
|
221
|
+
* provided. Ignored if no `label` is set.
|
|
222
|
+
*/
|
|
223
|
+
format?: SpindleRangeSliderFormat;
|
|
224
|
+
disabled?: boolean;
|
|
225
|
+
className?: string;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface SpindleRangeSliderHandle extends SpindleMountedComponent<SpindleRangeSliderOptions> {
|
|
229
|
+
/** Read the current committed value. */
|
|
230
|
+
getValue(): number;
|
|
231
|
+
}
|
|
232
|
+
|
|
172
233
|
// ──────────────────────────────────────────────────────────────────────────
|
|
173
234
|
// Boolean inputs
|
|
174
235
|
// ──────────────────────────────────────────────────────────────────────────
|
|
@@ -301,8 +362,29 @@ export interface SpindleSelectOptionsBase {
|
|
|
301
362
|
searchPlaceholder?: string;
|
|
302
363
|
/** Minimum option count before the search field is shown. Default: `8`. */
|
|
303
364
|
searchThreshold?: number;
|
|
304
|
-
/**
|
|
365
|
+
/**
|
|
366
|
+
* Message rendered when the option list itself is empty (i.e. no options
|
|
367
|
+
* were supplied). For "no matches against the current search" use
|
|
368
|
+
* {@link noResultsMessage} instead.
|
|
369
|
+
*/
|
|
305
370
|
emptyMessage?: string;
|
|
371
|
+
/** Message rendered when the search query has no matching options. */
|
|
372
|
+
noResultsMessage?: string;
|
|
373
|
+
/**
|
|
374
|
+
* Force a specific trigger label, ignoring whichever option is currently
|
|
375
|
+
* selected. Useful for "+ Add", "Filter…" style triggers.
|
|
376
|
+
*/
|
|
377
|
+
triggerLabel?: string;
|
|
378
|
+
/**
|
|
379
|
+
* Custom trigger icon. Replaces the default chevron. Accepts the same
|
|
380
|
+
* declarative shape as option leading cells — typically `{ type: "icon-svg" }`
|
|
381
|
+
* for a brand mark or chevron alternative.
|
|
382
|
+
*/
|
|
383
|
+
triggerIcon?: SpindleSelectOptionLeading;
|
|
384
|
+
/** Accessible label for the trigger button. Surfaces as `aria-label`. */
|
|
385
|
+
ariaLabel?: string;
|
|
386
|
+
/** Additional CSS class merged onto the trigger button. */
|
|
387
|
+
triggerClassName?: string;
|
|
306
388
|
/**
|
|
307
389
|
* Render the dropdown into a React portal anchored to `document.body` so it
|
|
308
390
|
* escapes containers with `overflow:hidden`. Default: `true`.
|
|
@@ -322,6 +404,13 @@ export interface SpindleSelectOptions extends SpindleSelectOptionsBase {
|
|
|
322
404
|
/** Initial value. */
|
|
323
405
|
value?: string;
|
|
324
406
|
onChange?: (value: string) => void;
|
|
407
|
+
/**
|
|
408
|
+
* Show a "None" / clear option pinned to the top of the dropdown. Selecting
|
|
409
|
+
* it emits `onChange("")`. Single-select only.
|
|
410
|
+
*/
|
|
411
|
+
clearable?: boolean;
|
|
412
|
+
/** Label shown for the clear option. Default: `"None"`. */
|
|
413
|
+
clearLabel?: string;
|
|
325
414
|
}
|
|
326
415
|
|
|
327
416
|
export interface SpindleSelectHandle extends SpindleMountedComponent<SpindleSelectOptions> {
|
|
@@ -548,6 +637,7 @@ export interface SpindleComponentsHelper {
|
|
|
548
637
|
// Numeric inputs
|
|
549
638
|
mountNumericInput(target: SpindleComponentTarget, options?: SpindleNumericInputOptions): SpindleNumericInputHandle;
|
|
550
639
|
mountNumberStepper(target: SpindleComponentTarget, options?: SpindleNumberStepperOptions): SpindleNumberStepperHandle;
|
|
640
|
+
mountRangeSlider(target: SpindleComponentTarget, options: SpindleRangeSliderOptions): SpindleRangeSliderHandle;
|
|
551
641
|
|
|
552
642
|
// Boolean inputs
|
|
553
643
|
mountCheckbox(target: SpindleComponentTarget, options?: SpindleCheckboxOptions): SpindleCheckboxHandle;
|