@openvoxproject/voxblocks 0.12.0 → 0.15.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.
@@ -0,0 +1,56 @@
1
+ import { type PropertyValues } from 'lit';
2
+ import { VoxFieldElement } from '../../internal/field.js';
3
+ /**
4
+ * A text input that filters a list of options as you type. Options are
5
+ * provided as light-DOM `<option>` children, the same as `<vox-select>`:
6
+ *
7
+ * ```html
8
+ * <vox-combobox label="Module">
9
+ * <option value="nginx">puppet-nginx</option>
10
+ * <option value="apache">puppet-apache</option>
11
+ * </vox-combobox>
12
+ * ```
13
+ *
14
+ * Implements the ARIA 1.2 combobox pattern: focus stays on the input and the
15
+ * active option is tracked with `aria-activedescendant`.
16
+ * Participates in native form submission via ElementInternals.
17
+ */
18
+ export declare class VoxCombobox extends VoxFieldElement {
19
+ /** The selected option's value. */
20
+ value: string;
21
+ placeholder?: string;
22
+ /** Accept text that doesn't match any option. */
23
+ allowCustom: boolean;
24
+ /** Message shown when the filter matches nothing. */
25
+ emptyText: string;
26
+ /** Text currently in the input. Drives filtering. */
27
+ private query;
28
+ private open;
29
+ private activeIndex;
30
+ private options;
31
+ private inputEl;
32
+ private listboxEl;
33
+ static styles: import("lit").CSSResult[];
34
+ private get filtered();
35
+ private get selectedLabel();
36
+ willUpdate(changed: PropertyValues<this>): void;
37
+ formResetCallback(): void;
38
+ updated(): void;
39
+ focus(options?: FocusOptions): void;
40
+ private readOptions;
41
+ private openList;
42
+ private close;
43
+ private select;
44
+ private moveActive;
45
+ private scrollActiveIntoView;
46
+ private handleInput;
47
+ private handleKeydown;
48
+ private handleBlur;
49
+ private optionId;
50
+ render(): import("lit-html").TemplateResult<1>;
51
+ }
52
+ declare global {
53
+ interface HTMLElementTagNameMap {
54
+ 'vox-combobox': VoxCombobox;
55
+ }
56
+ }
@@ -1,6 +1,8 @@
1
1
  import { VoxFieldElement } from '../../internal/field.js';
2
2
  /**
3
- * A single-line text input with label and help note.
3
+ * A single-line input with label and help note. Accepts any native input
4
+ * type; `min`/`max`/`step`/`pattern` make the numeric, date and pattern
5
+ * types enforceable.
4
6
  * Participates in native form submission via ElementInternals.
5
7
  */
6
8
  export declare class VoxInput extends VoxFieldElement {
@@ -9,7 +11,22 @@ export declare class VoxInput extends VoxFieldElement {
9
11
  placeholder?: string;
10
12
  autocomplete?: string;
11
13
  readonly: boolean;
14
+ /**
15
+ * Bounds and granularity for the numeric and date-like types. Left as
16
+ * strings so date types can take `min="2026-01-01"` and number types
17
+ * `min="0"` through the same attribute.
18
+ */
19
+ min?: string;
20
+ max?: string;
21
+ step?: string;
22
+ /** Constraints for the text-like types. */
23
+ pattern?: string;
24
+ minlength?: string;
25
+ maxlength?: string;
26
+ /** On-screen keyboard hint for touch devices. */
27
+ inputmode?: string;
12
28
  static styles: import("lit").CSSResult;
29
+ private get accessibleName();
13
30
  formResetCallback(): void;
14
31
  updated(): void;
15
32
  focus(options?: FocusOptions): void;
@@ -0,0 +1,36 @@
1
+ import { VoxFieldElement } from '../../internal/field.js';
2
+ /**
3
+ * A slider for picking a number from a range. Built on a native
4
+ * `<input type="range">` so keyboard interaction, the `slider` role and
5
+ * screen-reader value announcements come from the platform.
6
+ * Participates in native form submission via ElementInternals.
7
+ */
8
+ export declare class VoxRange extends VoxFieldElement {
9
+ value: string;
10
+ min: string;
11
+ max: string;
12
+ step: string;
13
+ /** Show the current value beside the label. */
14
+ showValue: boolean;
15
+ /**
16
+ * Unit appended to the displayed value and to the spoken value. Use for
17
+ * things the number alone doesn't convey, e.g. "%" or "MB".
18
+ */
19
+ unit: string;
20
+ private inputEl;
21
+ /** Value to restore on form reset, per the native reset behaviour. */
22
+ private defaultValue;
23
+ static styles: import("lit").CSSResult[];
24
+ connectedCallback(): void;
25
+ formResetCallback(): void;
26
+ updated(): void;
27
+ focus(options?: FocusOptions): void;
28
+ private handleInput;
29
+ private handleChange;
30
+ render(): import("lit-html").TemplateResult<1>;
31
+ }
32
+ declare global {
33
+ interface HTMLElementTagNameMap {
34
+ 'vox-range': VoxRange;
35
+ }
36
+ }
@@ -9,14 +9,31 @@ import { VoxFieldElement } from '../../internal/field.js';
9
9
  * <option value="rpm">RHEL</option>
10
10
  * </vox-select>
11
11
  * ```
12
+ *
13
+ * Add `multiple` for a list that accepts more than one selection; read the
14
+ * result from `values` rather than `value`.
12
15
  */
13
16
  export declare class VoxSelect extends VoxFieldElement {
14
17
  value: string;
18
+ /** Accept more than one selection, rendering as a scrolling list box. */
19
+ multiple: boolean;
20
+ /** Rows shown when `multiple` is set. */
21
+ size?: number;
22
+ /** Selected values. Only meaningful when `multiple` is set. */
23
+ values: string[];
15
24
  private selectEl;
16
25
  static styles: import("lit").CSSResult[];
17
26
  formResetCallback(): void;
18
27
  updated(): void;
28
+ focus(options?: FocusOptions): void;
29
+ /**
30
+ * A multi-select submits one entry per selection, which only FormData can
31
+ * express. Without a `name` there is nothing to key them on, so submit
32
+ * nothing — matching a native select with no name.
33
+ */
34
+ private formData;
19
35
  private syncOptions;
36
+ private selected;
20
37
  private handleChange;
21
38
  render(): import("lit-html").TemplateResult<1>;
22
39
  }
@@ -6,11 +6,13 @@ export { VoxCta } from './components/cta/vox-cta.js';
6
6
  export { VoxThemeToggle } from './components/theme-toggle/vox-theme-toggle.js';
7
7
  export { VoxIcon } from './components/icon/vox-icon.js';
8
8
  export { VoxCheckbox } from './components/checkbox/vox-checkbox.js';
9
+ export { VoxCombobox } from './components/combobox/vox-combobox.js';
9
10
  export { VoxFileInput } from './components/file-input/vox-file-input.js';
10
11
  export { VoxInput } from './components/input/vox-input.js';
11
12
  export { VoxInputGroup } from './components/input-group/vox-input-group.js';
12
13
  export { VoxRadio } from './components/radio/vox-radio.js';
13
14
  export { VoxRadioGroup } from './components/radio/vox-radio-group.js';
15
+ export { VoxRange } from './components/range/vox-range.js';
14
16
  export { VoxSelect } from './components/select/vox-select.js';
15
17
  export { VoxSwitch } from './components/switch/vox-switch.js';
16
18
  export { VoxTextarea } from './components/textarea/vox-textarea.js';