sve-ui 0.3.0 → 0.3.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.
@@ -20,10 +20,20 @@
20
20
  step?: number;
21
21
  disabled?: boolean;
22
22
  orientation?: 'horizontal' | 'vertical';
23
+ /**
24
+ * Accessible name for the thumb(s). The `role="slider"` element needs a name;
25
+ * in `multiple` mode each thumb gets the label suffixed with its position.
26
+ */
27
+ thumbLabel?: string;
23
28
  class?: string;
24
29
  }
25
30
 
26
- let { type = 'single', class: cls, ...rest }: Props = $props();
31
+ let { type = 'single', thumbLabel, class: cls, ...rest }: Props = $props();
32
+
33
+ function thumbName(index: number): string | undefined {
34
+ if (!thumbLabel) return undefined;
35
+ return type === 'multiple' ? `${thumbLabel} ${index + 1}` : thumbLabel;
36
+ }
27
37
 
28
38
  const className = $derived(['sve-slider', cls].filter(Boolean).join(' '));
29
39
 
@@ -36,7 +46,7 @@
36
46
  <Slider.Range class="sve-slider__range" />
37
47
  </span>
38
48
  {#each thumbItems as thumb (thumb.index)}
39
- <Slider.Thumb index={thumb.index} class="sve-slider__thumb" />
49
+ <Slider.Thumb index={thumb.index} class="sve-slider__thumb" aria-label={thumbName(thumb.index)} />
40
50
  {/each}
41
51
  {/snippet}
42
52
  </Root>
@@ -18,6 +18,11 @@ interface Props extends Omit<HTMLAttributes<HTMLSpanElement>, 'class'> {
18
18
  step?: number;
19
19
  disabled?: boolean;
20
20
  orientation?: 'horizontal' | 'vertical';
21
+ /**
22
+ * Accessible name for the thumb(s). The `role="slider"` element needs a name;
23
+ * in `multiple` mode each thumb gets the label suffixed with its position.
24
+ */
25
+ thumbLabel?: string;
21
26
  class?: string;
22
27
  }
23
28
  declare const Slider: Component<Props, {}, "">;
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Slider/Slider.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAA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C1B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACnD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAkCH,QAAA,MAAM,MAAM,0BAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sve-ui",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "description": "Styled, accessible Svelte 5 components built on Bits UI. No Tailwind, no config — install, import, and theme with CSS variables. Light and dark out of the box.",
6
6
  "author": "Rodrigo Abregu <me@rodriab.io> (https://rodriab.io/)",
@@ -50,13 +50,13 @@
50
50
  },
51
51
  "devDependencies": {
52
52
  "@internationalized/date": "^3.8.1",
53
- "jsdom": "^26.0.0",
54
53
  "@sveltejs/kit": "^2.66.0",
55
54
  "@sveltejs/package": "^2.5.8",
56
55
  "@sveltejs/vite-plugin-svelte": "^7.1.2",
57
56
  "@testing-library/svelte": "^5.3.1",
58
57
  "eslint": "^10.5.0",
59
58
  "eslint-plugin-svelte": "^3.19.0",
59
+ "jsdom": "^26.0.0",
60
60
  "publint": "^0.3.21",
61
61
  "svelte": "^5.56.3",
62
62
  "svelte-check": "^4.0.0",
@@ -64,6 +64,7 @@
64
64
  "typescript-eslint": "^8.61.1",
65
65
  "vite": "^8.0.16",
66
66
  "vitest": "^4.1.9",
67
+ "vitest-axe": "^0.1.0",
67
68
  "@repo/eslint-config": "0.0.0",
68
69
  "@repo/typescript-config": "0.0.0"
69
70
  },