@refinitiv-ui/elements 7.9.1 → 7.10.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.
@@ -1,469 +1,2 @@
1
- import { JSXInterface } from '../jsx';
2
- import { CSSResultGroup, ControlElement, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
3
- import '@refinitiv-ui/phrasebook/locale/en/slider.js';
4
- import { TranslateDirective } from '@refinitiv-ui/translate';
5
- import '../number-field/index.js';
6
- /**
7
- * Allows users to make selections from a range of values
8
- *
9
- * @attr {string} value - Value of slider. Not applicable in range mode.
10
- * @prop {string} [value="0"] - Value of slider. Not applicable in range mode.
11
- *
12
- * @attr {boolean} readonly - Set readonly state
13
- * @prop {boolean} [readonly=false] - Set readonly state
14
- *
15
- * @attr {boolean} disabled - Set disabled state
16
- * @prop {boolean} [disabled=false] - Set disabled state
17
- *
18
- * @fires value-changed - Fired when the user commits a value change. The event is not triggered if `value` property is changed programmatically.
19
- * @fires from-changed - Fired when the user changes from's value. The event is not triggered if `from` property is changed programmatically.
20
- * @fires to-changed - Fired when the user changes to's value. The event is not triggered if `to` property is changed programmatically.
21
- * @fires input - Fired with the value of the input in `e.detail.value` like another custom events when the user inputs a value by interacting with the slider or updating its input field.
22
- * @fires from-input - Fired when the user inputs from's value by interacting with the slider or updating its input field.
23
- * @fires to-input - Fired when the user inputs to's value by interacting with the slider or updating its input field.
24
- */
25
- export declare class Slider extends ControlElement {
26
- /**
27
- * Element version number
28
- * @returns version number
29
- */
30
- static get version(): string;
31
- /**
32
- * Define styles in a tagged template literal, using the css tag function.
33
- * @returns CSS template
34
- */
35
- static get styles(): CSSResultGroup;
36
- /**
37
- * Whether if the thumb is being drag
38
- */
39
- private dragging;
40
- private valuePrevious;
41
- private fromPrevious;
42
- private toPrevious;
43
- private valuePreviousInput;
44
- private fromPreviousInput;
45
- private toPreviousInput;
46
- /**
47
- * Specified size of increment or decrement jump between value.
48
- */
49
- step: string;
50
- /**
51
- * Set minimum value of slider.
52
- */
53
- min: string;
54
- /**
55
- * Set maximum value of slider.
56
- */
57
- max: string;
58
- /**
59
- * Uses with `range`. Low value of slider in range mode.
60
- */
61
- from: string;
62
- /**
63
- * Uses with `range`. High value of slider in range mode
64
- */
65
- to: string;
66
- /**
67
- * Set slider appearances to show pin mode.
68
- * @ignore
69
- * NOTE: Pin isn't applicable in Halo. Hide this from document
70
- */
71
- pin: boolean;
72
- /**
73
- * Set slider to range mode. Instead of a single value, slider will provide `from` and `to`.
74
- */
75
- range: boolean;
76
- /**
77
- * Show steps marker on slider.
78
- */
79
- showSteps: boolean;
80
- /**
81
- * Show input number field.
82
- */
83
- showInputField: 'readonly' | '' | null;
84
- /**
85
- * Uses with `range`. Set minimum allowance value (distance) between `from` and `to`.
86
- */
87
- minRange: string;
88
- /**
89
- * Slider internal translation strings
90
- */
91
- protected t: TranslateDirective;
92
- /**
93
- * Converts value from string to number for calculations
94
- * @returns value of input as a number
95
- */
96
- private get valueNumber();
97
- /**
98
- * Converts min value from string to number for calculations
99
- * @returns minimum value of slider as a number
100
- */
101
- private get minNumber();
102
- /**
103
- * Converts max value from string to number for calculations
104
- * @returns maximum value of slider as a number
105
- */
106
- private get maxNumber();
107
- /**
108
- * Converts step value from string to number for calculations
109
- * @returns step value of slider as a number
110
- */
111
- private get stepNumber();
112
- /**
113
- * Compute and normalise step value for calculations
114
- * @returns step value that should be inside the min / max boundary
115
- */
116
- private get stepRange();
117
- /**
118
- * Converts from value from string to number for calculations
119
- * @returns from value of slider as a number
120
- */
121
- private get fromNumber();
122
- /**
123
- * Converts to value from string to number for calculations
124
- * @returns to value of slider as a number
125
- */
126
- private get toNumber();
127
- /**
128
- * Converts min-range from string to number for calculations
129
- * @returns min-range of input as a number
130
- */
131
- private get minRangeNumber();
132
- /**
133
- * Number of decimal places used for displaying value
134
- * Based on step or min decimal places
135
- */
136
- private get decimalPlace();
137
- /**
138
- * Return hide/show input field state
139
- * @returns true if showInputField value is exist
140
- */
141
- private get isShowInputField();
142
- /**
143
- * Slider element reference
144
- */
145
- private sliderRef;
146
- /**
147
- * Slider's track reference
148
- */
149
- private trackRef;
150
- /**
151
- * From value thumb reference, rendered only in range mode
152
- */
153
- private fromThumbRef;
154
- /**
155
- * To value thumb reference, rendered only in range mode
156
- */
157
- private toThumbRef;
158
- /**
159
- * Value thumb reference
160
- */
161
- private valueThumbRef;
162
- /**
163
- * Number field for slider value
164
- */
165
- private valueInput;
166
- /**
167
- * Number field for from value in range mode
168
- */
169
- private fromInput;
170
- /**
171
- * Number field for to value in range mode
172
- */
173
- private toInput;
174
- /**
175
- * Current focused thumb
176
- */
177
- private activeThumb;
178
- /**
179
- * Thumb that may involves data changes
180
- */
181
- private changedThumb;
182
- constructor();
183
- /**
184
- * On first updated lifecycle
185
- * @param changedProperties changed properties
186
- * @returns {void}
187
- */
188
- protected firstUpdated(changedProperties: PropertyValues): void;
189
- /**
190
- * On willUpdate lifecycle
191
- * @param changedProperties changed properties
192
- * @returns {void}
193
- */
194
- protected willUpdate(changedProperties: PropertyValues): void;
195
- /**
196
- * On updated lifecycle
197
- * @param changedProperties changed properties
198
- * @returns {void}
199
- */
200
- protected updated(changedProperties: PropertyValues): void;
201
- /**
202
- * Show Warning a warning message invalid property
203
- * @param propName value for checking
204
- * @returns {void}
205
- */
206
- private showWarningInvalidProperty;
207
- /**
208
- * Initialises slider value properties
209
- * @returns {void}
210
- */
211
- private prepareValues;
212
- /**
213
- * Add event listeners to thumbs depending on mode
214
- * @returns {void}
215
- */
216
- private prepareThumbs;
217
- /**
218
- * Add or remove event listener on slider track depending on slider disabled and readonly state
219
- * @returns {void}
220
- */
221
- private prepareSliderTrack;
222
- /**
223
- * Get slider data name from keyboard event target
224
- * @param target target element
225
- * @returns Slider data name
226
- */
227
- private getThumbName;
228
- /**
229
- * Handles key down event on thumbs
230
- * @param event Keyboard event
231
- * @returns {void}
232
- */
233
- private onKeyDown;
234
- /**
235
- * Set thumb to minimum value possible
236
- * @param data type of data to change
237
- * @returns {void}
238
- */
239
- private onApplyMin;
240
- /**
241
- * Set thumb to maximum value possible
242
- * @param data type of data to change
243
- * @returns {void}
244
- */
245
- private onApplyMax;
246
- /**
247
- * Increase or decrease value depending on direction
248
- * Then fires value change event
249
- * @param direction Up or Down
250
- * @param data type of data to change
251
- * @returns {void}
252
- */
253
- private onApplyStep;
254
- /**
255
- * Calculate thumb position based on value and multiplier
256
- * @param value decimal fraction value
257
- * @param multiplier defaults to 100
258
- * @returns thumb position as a fraction of 100
259
- */
260
- private calculatePosition;
261
- /**
262
- * Adds active attribute used in styling
263
- * @param event focus event
264
- * @returns {void}
265
- */
266
- private onThumbFocus;
267
- /**
268
- * Removes active attribute used in styling
269
- * @param event focus event
270
- * @returns {void}
271
- */
272
- private onThumbBlur;
273
- /**
274
- * On number-field blur
275
- * @param event focus event
276
- * @returns {void}
277
- */
278
- private onNumberFieldBlur;
279
- /**
280
- * On number-field input
281
- * @param event input event
282
- * @returns {void}
283
- */
284
- private onNumberFieldInput;
285
- /**
286
- * On number-field keydown
287
- * @param event keyboard event
288
- * @returns {void}
289
- */
290
- private onNumberFieldKeyDown;
291
- /**
292
- * Update notify property by input name attribute
293
- * @param name name input attribute
294
- * @param value input value
295
- * @returns {void}
296
- */
297
- private updateNotifyProperty;
298
- /**
299
- * Dispatch data {value, from, to} changed event
300
- * @returns {void}
301
- */
302
- private dispatchDataChangedEvent;
303
- /**
304
- * Dispatch data {input, from-input, to-input} changing event
305
- * @returns {void}
306
- */
307
- private dispatchDataInputEvent;
308
- /**
309
- * Start dragging event on slider
310
- * @param event event dragstart
311
- * @returns {void}
312
- */
313
- private onDragStart;
314
- /**
315
- * Get mouse position in percentage value
316
- * @param event event mousemove and touchmove
317
- * @returns mouse position by percentage
318
- */
319
- private getMousePosition;
320
- /**
321
- * Dragging after on dragging start event
322
- * @param event event mousemove and touchmove
323
- * @returns {void}
324
- */
325
- private onDrag;
326
- /**
327
- * Saves changed data into correct field
328
- * @param value value of changed data
329
- * @returns {void}
330
- */
331
- private persistChangedData;
332
- /**
333
- * Validate and return FROM value within available range
334
- * @param value from value
335
- * @returns validated from value
336
- */
337
- private validateFrom;
338
- /**
339
- * Validate and return TO value within available range
340
- * @param value to value
341
- * @returns validated to value.
342
- */
343
- private validateTo;
344
- /**
345
- * Validate number field from changed thumb
346
- * @returns {void}
347
- */
348
- private validateNumberField;
349
- /**
350
- * Calculate the nearest possible step value depending on step interval
351
- * @param thumbPosition current thumb position in fraction
352
- * @returns nearest available slider step in fraction
353
- */
354
- private getNearestPossibleValue;
355
- /**
356
- * Get slider value from thumb position
357
- * @param position thumb position
358
- * @returns calculated value
359
- */
360
- private getValueFromPosition;
361
- /**
362
- * Format value to display in both integer and fraction cases
363
- * @param value value before use display
364
- * @returns formatted value
365
- */
366
- private format;
367
- /**
368
- * End dragging event and remove dragging event
369
- * @param event event mouseup and touchmove
370
- * @returns {void}
371
- */
372
- private onDragEnd;
373
- /**
374
- * Value observer
375
- * @returns {void}
376
- */
377
- private onValueChange;
378
- /**
379
- * From value observer
380
- * @returns {void}
381
- */
382
- private onFromValueChange;
383
- /**
384
- * Check if value is inside min / max boundary
385
- * @param value value is checking
386
- * @param valueFor notation variable binding if range === true
387
- * @returns true if value and step inside a boundary
388
- */
389
- private isValueInBoundary;
390
- /**
391
- * To value observer
392
- * @returns {void}
393
- */
394
- private onToValueChange;
395
- /**
396
- * Step observer
397
- * @returns {void}
398
- */
399
- private onStepChange;
400
- /**
401
- * Min range observer
402
- * @returns {void}
403
- */
404
- private onMinRangeChange;
405
- /**
406
- * Min observer
407
- * @param oldValue old value of min property
408
- * @returns {void}
409
- */
410
- private onMinChange;
411
- /**
412
- * Max observer
413
- * @param oldValue old value of max property
414
- * @returns {void}
415
- */
416
- private onMaxChange;
417
- /**
418
- * Implement `render` Track template.
419
- * @param range show range slider
420
- * @returns Track template
421
- */
422
- private renderTrack;
423
- /**
424
- * Implement `render` Thumb template.
425
- * @param value thumb value in track
426
- * @param thumbPosition thumb position in track
427
- * @param name name of thumb to render
428
- * @returns Thumb template
429
- */
430
- private thumbTemplate;
431
- /**
432
- * Renders thumb template depending on parameter
433
- * @param from thumb value start in track
434
- * @param to thumb value end in track (optional)
435
- * @returns Thumbs template
436
- */
437
- private renderThumb;
438
- /**
439
- * Implement `render` number field has template.
440
- * @param value value in the slider for binding in the input value
441
- * @param name name input value
442
- * @returns {TemplateResult} number field template
443
- */
444
- private renderNumberField;
445
- /**
446
- * Implement `render` slider template.
447
- * @returns Slider template
448
- */
449
- protected render(): TemplateResult;
450
- }
451
- declare global {
452
- interface HTMLElementTagNameMap {
453
- 'ef-slider': Slider;
454
- }
455
- }
456
-
457
- declare global {
458
- interface HTMLElementTagNameMap {
459
- 'ef-slider': Slider;
460
- }
461
-
462
- namespace JSX {
463
- interface IntrinsicElements {
464
- 'ef-slider': Partial<Slider> | JSXInterface.ControlHTMLAttributes<Slider>;
465
- }
466
- }
467
- }
468
-
469
- export {};
1
+ export { Slider } from './elements/slider.js';
2
+ export { SliderMarker } from './elements/slider-marker.js';