@rcarls/rc-range-slider 0.6.0 → 0.7.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.
@@ -1,4 +1,5 @@
1
1
  import { LitElement, nothing } from 'lit';
2
+ import { FlowController } from '@rcarls/rc-common';
2
3
  export interface RCRangeSliderValueEvent {
3
4
  /** Current [low, high] value tuple. */
4
5
  value: [number, number];
@@ -13,6 +14,19 @@ declare global {
13
14
  }
14
15
  }
15
16
  type DisplayValue = 'float' | 'inline-start' | 'inline-end' | null;
17
+ /** Built-in text of `rc-range-slider`. */
18
+ export interface RCRangeSliderMessages {
19
+ /** Default name of the low thumb, when neither its input nor `low-label` names it. */
20
+ low: string;
21
+ /** Default name of the high thumb, when neither its input nor `high-label` names it. */
22
+ high: string;
23
+ }
24
+ export declare const DEFAULT_RANGE_SLIDER_MESSAGES: Readonly<RCRangeSliderMessages>;
25
+ declare module '@rcarls/rc-common' {
26
+ interface RcMessageCatalog {
27
+ 'rc-range-slider': RCRangeSliderMessages;
28
+ }
29
+ }
16
30
  /**
17
31
  * Two-thumb range slider backed by native range inputs for min/max values, following the
18
32
  * WAI-ARIA Multi-Thumb Slider pattern.
@@ -24,6 +38,10 @@ type DisplayValue = 'float' | 'inline-start' | 'inline-end' | null;
24
38
  *
25
39
  * Form participation is handled natively by each input's `name` attribute.
26
40
  *
41
+ * Built-in text (the default thumb names) follows the element's own `lang`, else
42
+ * `<html lang>`: per element through `messages`, or for every instance
43
+ * through `registerMessages()` from `@rcarls/rc-common` under `rc-range-slider`.
44
+ *
27
45
  * @see {@link https://richardcarls.github.io/rc-webcomponents/components/rc-range-slider rc-range-slider docs}
28
46
  * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/slider-multithumb/ WAI-ARIA Multi-Thumb Slider pattern}
29
47
  *
@@ -41,15 +59,18 @@ type DisplayValue = 'float' | 'inline-start' | 'inline-end' | null;
41
59
  * @attr disabled - Disables both thumbs and their hidden native input reflectors.
42
60
  * @attr readonly - Prevents edits while preserving normal focus and display.
43
61
  * @attr low-label - Accessible label for the low (min) thumb when the input does not provide one.
62
+ * Defaults to the `low` message.
44
63
  * @attr high-label - Accessible label for the high (max) thumb when the input does not provide
45
- * one.
64
+ * one. Defaults to the `high` message.
46
65
  * @attr low-value-text - Formatted screen-reader text for the low value. Falls back to the raw
47
66
  * number.
48
67
  * @attr high-value-text - Formatted screen-reader text for the high value. Falls back to the raw
49
68
  * number.
50
69
  * @attr display - Controls the live value display: absent (none), `float`, `inline-start`, or
51
70
  * `inline-end`.
52
- * @attr orientation - Orientation, forwarded to the custom thumbs: `horizontal` or `vertical`.
71
+ * @attr orientation - `horizontal` runs along the inline axis like a native range input: right to
72
+ * left in RTL, and vertical in vertical text, where the thumbs report `aria-orientation` of
73
+ * `vertical`. `vertical` runs along the block axis, so it renders horizontally in vertical text.
53
74
  *
54
75
  * @cssprop [--rc-range-slider-accent=Highlight] - Accent color for selected range, thumb border, focus, hover, and active states.
55
76
  * @cssprop [--rc-range-slider-gap=var(--rc-control-gap)] - Gap between track and inline value display.
@@ -110,10 +131,19 @@ export declare class RCRangeSlider extends LitElement {
110
131
  disabled: boolean;
111
132
  /** Prevents edits while preserving normal focus and display. */
112
133
  readonly: boolean;
113
- /** Accessible label for the low (min) thumb when the input does not provide one. */
114
- lowLabel: string;
115
- /** Accessible label for the high (max) thumb when the input does not provide one. */
116
- highLabel: string;
134
+ /** Built-in text overrides; unset keys fall back to registered text, then English. */
135
+ messages: Partial<RCRangeSliderMessages> | undefined;
136
+ private readonly _messages;
137
+ /**
138
+ * Accessible label for the low (min) thumb when the input does not provide one.
139
+ * Defaults to the `low` message.
140
+ */
141
+ lowLabel: string | undefined;
142
+ /**
143
+ * Accessible label for the high (max) thumb when the input does not provide one.
144
+ * Defaults to the `high` message.
145
+ */
146
+ highLabel: string | undefined;
117
147
  /** Formatted screen-reader text for the low value. Falls back to the raw number. */
118
148
  lowValueText: string;
119
149
  /** Formatted screen-reader text for the high value. Falls back to the raw number. */
@@ -129,6 +159,8 @@ export declare class RCRangeSlider extends LitElement {
129
159
  display: DisplayValue;
130
160
  /** Orientation; reflected as an attribute and forwarded to custom thumbs. */
131
161
  orientation: 'horizontal' | 'vertical';
162
+ /** Keeps the thumbs' aria-orientation on the orientation actually rendered. */
163
+ protected readonly _flow: FlowController;
132
164
  private _lowValue;
133
165
  private _highValue;
134
166
  private _$lowInput;
@@ -140,7 +172,7 @@ export declare class RCRangeSlider extends LitElement {
140
172
  connectedCallback(): void;
141
173
  disconnectedCallback(): void;
142
174
  updated(): void;
143
- render(): typeof nothing | import('lit').TemplateResult<1>;
175
+ render(): typeof nothing | import('lit-html').TemplateResult<1>;
144
176
  private _renderThumb;
145
177
  /**
146
178
  * Finds the first two child `<input type="range">` elements and wires them.
@@ -179,6 +211,18 @@ export declare class RCRangeSlider extends LitElement {
179
211
  private _thumbStyle;
180
212
  private _thumbCenterStyle;
181
213
  private _floatStyle;
214
+ /**
215
+ * How far along the layout axis a pointer is, 0 at its logical start.
216
+ * Horizontal layout uses the inline axis; vertical layout uses block.
217
+ */
218
+ private _axisFraction;
219
+ /**
220
+ * The arrow keys that raise and lower the value, matching a native range
221
+ * input. The keys along the rendered track move the thumb the way it moves
222
+ * on screen. The cross-axis keys keep the native range convention: Up or
223
+ * Right raises the value.
224
+ */
225
+ private _valueKeys;
182
226
  private _normalizeValue;
183
227
  private _min;
184
228
  private _max;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.6.0",
6
+ "version": "0.7.0",
7
7
  "description": "Two-thumb range slider backed by native range inputs for min/max values.",
8
8
  "repository": {
9
9
  "type": "git",
@@ -57,7 +57,7 @@
57
57
  "vitest-browser-lit": "^1.0.1"
58
58
  },
59
59
  "dependencies": {
60
- "@rcarls/rc-common": "0.6.0"
60
+ "@rcarls/rc-common": "0.7.0"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "lit": "^3.0.0"