@skeletonlabs/skeleton 2.3.0-dev.853e711a → 2.4.0-dev.4fe5e62f
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/dist/actions/Filters/filter.test.d.ts +1 -0
- package/dist/actions/Filters/filter.test.js +36 -0
- package/dist/components/Accordion/Accordion.test.d.ts +1 -0
- package/dist/components/Accordion/Accordion.test.js +25 -0
- package/dist/components/Accordion/AccordionItem.test.d.ts +1 -0
- package/dist/components/Accordion/AccordionItem.test.js +22 -0
- package/dist/components/AppBar/AppBar.test.d.ts +1 -0
- package/dist/components/AppBar/AppBar.test.js +28 -0
- package/dist/components/AppRail/AppRail.test.d.ts +1 -0
- package/dist/components/AppRail/AppRail.test.js +28 -0
- package/dist/components/AppRail/AppRailTile.svelte +9 -5
- package/dist/components/AppRail/AppRailTile.svelte.d.ts +0 -1
- package/dist/components/AppRail/AppRailTile.test.d.ts +1 -0
- package/dist/components/AppRail/AppRailTile.test.js +27 -0
- package/dist/components/AppShell/AppShell.test.d.ts +1 -0
- package/dist/components/AppShell/AppShell.test.js +23 -0
- package/dist/components/Autocomplete/Autocomplete.svelte +2 -1
- package/dist/components/Autocomplete/Autocomplete.svelte.d.ts +2 -0
- package/dist/components/Autocomplete/Autocomplete.test.d.ts +1 -0
- package/dist/components/Autocomplete/Autocomplete.test.js +125 -0
- package/dist/components/Avatar/Avatar.test.d.ts +1 -0
- package/dist/components/Avatar/Avatar.test.js +35 -0
- package/dist/components/ConicGradient/ConicGradient.test.d.ts +1 -0
- package/dist/components/ConicGradient/ConicGradient.test.js +23 -0
- package/dist/components/FileButton/FileButton.test.d.ts +1 -0
- package/dist/components/FileButton/FileButton.test.js +29 -0
- package/dist/components/FileDropzone/FileDropzone.test.d.ts +1 -0
- package/dist/components/FileDropzone/FileDropzone.test.js +29 -0
- package/dist/components/ListBox/ListBox.test.d.ts +1 -0
- package/dist/components/ListBox/ListBox.test.js +42 -0
- package/dist/components/ListBox/ListBoxItem.test.d.ts +1 -0
- package/dist/components/ListBox/ListBoxItem.test.js +29 -0
- package/dist/components/Paginator/Paginator.test.d.ts +1 -0
- package/dist/components/Paginator/Paginator.test.js +26 -0
- package/dist/components/ProgressBar/ProgressBar.svelte +3 -2
- package/dist/components/ProgressBar/ProgressBar.svelte.d.ts +4 -2
- package/dist/components/ProgressBar/ProgressBar.test.d.ts +1 -0
- package/dist/components/ProgressBar/ProgressBar.test.js +24 -0
- package/dist/components/ProgressRadial/ProgressRadial.svelte +3 -2
- package/dist/components/ProgressRadial/ProgressRadial.svelte.d.ts +2 -0
- package/dist/components/ProgressRadial/ProgressRadial.test.d.ts +1 -0
- package/dist/components/ProgressRadial/ProgressRadial.test.js +24 -0
- package/dist/components/Radio/RadioGroup.test.d.ts +1 -0
- package/dist/components/Radio/RadioGroup.test.js +27 -0
- package/dist/components/Radio/RadioItem.test.d.ts +1 -0
- package/dist/components/Radio/RadioItem.test.js +24 -0
- package/dist/components/RangeSlider/RangeSlider.test.d.ts +1 -0
- package/dist/components/RangeSlider/RangeSlider.test.js +38 -0
- package/dist/components/Ratings/Ratings.test.d.ts +1 -0
- package/dist/components/Ratings/Ratings.test.js +20 -0
- package/dist/components/SlideToggle/SlideToggle.test.d.ts +1 -0
- package/dist/components/SlideToggle/SlideToggle.test.js +21 -0
- package/dist/components/Stepper/Step.test.d.ts +1 -0
- package/dist/components/Stepper/Step.test.js +21 -0
- package/dist/components/Stepper/Stepper.test.d.ts +1 -0
- package/dist/components/Stepper/Stepper.test.js +26 -0
- package/dist/components/Tab/Tab.test.d.ts +1 -0
- package/dist/components/Tab/Tab.test.js +30 -0
- package/dist/components/Tab/TabGroup.test.d.ts +1 -0
- package/dist/components/Tab/TabGroup.test.js +26 -0
- package/dist/components/Table/Table.svelte +4 -4
- package/dist/components/TreeView/RecursiveTreeView.svelte +21 -2
- package/dist/components/TreeView/RecursiveTreeView.svelte.d.ts +5 -0
- package/dist/components/TreeView/RecursiveTreeViewItem.svelte +48 -21
- package/dist/components/TreeView/RecursiveTreeViewItem.svelte.d.ts +3 -0
- package/dist/components/TreeView/TreeView.test.d.ts +1 -0
- package/dist/components/TreeView/TreeView.test.js +28 -0
- package/dist/components/TreeView/TreeViewItem.svelte +9 -13
- package/dist/components/TreeView/TreeViewItem.test.d.ts +1 -0
- package/dist/components/TreeView/TreeViewItem.test.js +26 -0
- package/dist/components/TreeView/types.d.ts +9 -4
- package/dist/utilities/CodeBlock/CodeBlock.test.d.ts +1 -0
- package/dist/utilities/CodeBlock/CodeBlock.test.js +24 -0
- package/dist/utilities/Drawer/Drawer.svelte +4 -3
- package/dist/utilities/Drawer/Drawer.test.d.ts +1 -0
- package/dist/utilities/Drawer/Drawer.test.js +13 -0
- package/dist/utilities/LightSwitch/LightSwitch.test.d.ts +1 -0
- package/dist/utilities/LightSwitch/LightSwitch.test.js +16 -0
- package/dist/utilities/Modal/Modal.test.d.ts +1 -0
- package/dist/utilities/Modal/Modal.test.js +39 -0
- package/dist/utilities/Modal/stores.d.ts +1 -1
- package/dist/utilities/Modal/stores.js +1 -1
- package/dist/utilities/Toast/Toast.test.d.ts +1 -0
- package/dist/utilities/Toast/Toast.test.js +23 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import Paginator from './Paginator.svelte';
|
|
4
|
+
describe('Paginator.svelte', () => {
|
|
5
|
+
it('Renders with minimal props', async () => {
|
|
6
|
+
const { getByTestId } = render(Paginator);
|
|
7
|
+
expect(getByTestId('paginator')).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
it('Renders with all props', async () => {
|
|
10
|
+
const { getByTestId } = render(Paginator, {
|
|
11
|
+
props: {
|
|
12
|
+
offset: 1,
|
|
13
|
+
limit: 50,
|
|
14
|
+
size: 100,
|
|
15
|
+
amounts: [1, 5, 10, 50, 100],
|
|
16
|
+
// ---
|
|
17
|
+
justify: 'justify-between',
|
|
18
|
+
text: 'text-xs',
|
|
19
|
+
select: 'bg-primary-500',
|
|
20
|
+
// ---
|
|
21
|
+
buttons: { variant: 'filled-primary' }
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
expect(getByTestId('paginator')).toBeTruthy();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -3,6 +3,7 @@ export let min = 0;
|
|
|
3
3
|
export let max = 100;
|
|
4
4
|
export let height = "h-2";
|
|
5
5
|
export let rounded = "rounded-token";
|
|
6
|
+
export let transition = "transition-[width]";
|
|
6
7
|
export let meter = "bg-surface-900-50-token";
|
|
7
8
|
export let track = "bg-surface-200-700-token";
|
|
8
9
|
export let labelledby = "";
|
|
@@ -15,9 +16,9 @@ $:
|
|
|
15
16
|
$:
|
|
16
17
|
classesIndeterminate = indeterminate ? "animIndeterminate" : "";
|
|
17
18
|
$:
|
|
18
|
-
classesTrack = `${cTrack} ${
|
|
19
|
+
classesTrack = `${cTrack} ${track} ${height} ${rounded} ${$$props.class ?? ""}`;
|
|
19
20
|
$:
|
|
20
|
-
classesMeter = `${cMeter} ${rounded} ${classesIndeterminate} ${
|
|
21
|
+
classesMeter = `${cMeter} ${meter} ${rounded} ${classesIndeterminate} ${transition}`;
|
|
21
22
|
</script>
|
|
22
23
|
|
|
23
24
|
<!-- Track -->
|
|
@@ -12,9 +12,11 @@ declare const __propDef: {
|
|
|
12
12
|
height?: string | undefined;
|
|
13
13
|
/** Provide classes to set rounded styles.*/
|
|
14
14
|
rounded?: string | undefined;
|
|
15
|
-
/** Provide
|
|
15
|
+
/** Provide classes to set the meter transition styles.*/
|
|
16
|
+
transition?: string | undefined;
|
|
17
|
+
/** Sets the base classes of the meter element.*/
|
|
16
18
|
meter?: string | undefined;
|
|
17
|
-
/**
|
|
19
|
+
/** Sets the base classes of the track element.*/
|
|
18
20
|
track?: string | undefined;
|
|
19
21
|
/** Provide the ARIA labelledby value.*/
|
|
20
22
|
labelledby?: string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import ProgressBar from './ProgressBar.svelte';
|
|
4
|
+
describe('ProgressBar.svelte', () => {
|
|
5
|
+
it('Renders with minimal props', async () => {
|
|
6
|
+
const { getByTestId } = render(ProgressBar);
|
|
7
|
+
expect(getByTestId('progress-bar')).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
it('Renders with all props', () => {
|
|
10
|
+
const { getByTestId } = render(ProgressBar, {
|
|
11
|
+
props: {
|
|
12
|
+
label: 'Test',
|
|
13
|
+
min: 10,
|
|
14
|
+
value: 50,
|
|
15
|
+
max: 100,
|
|
16
|
+
height: 'h-1',
|
|
17
|
+
rounded: 'rounded-none',
|
|
18
|
+
meter: 'bg-warning-500',
|
|
19
|
+
track: 'bg-warning-500/30'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
expect(getByTestId('progress-bar')).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -4,6 +4,7 @@ export let value = void 0;
|
|
|
4
4
|
export let stroke = 40;
|
|
5
5
|
export let font = 56;
|
|
6
6
|
export let strokeLinecap = "butt";
|
|
7
|
+
export let transition = "transition-[stroke-dashoffset]";
|
|
7
8
|
export let width = "w-36";
|
|
8
9
|
export let meter = "stroke-surface-900 dark:stroke-surface-50";
|
|
9
10
|
export let track = "stroke-surface-500/30";
|
|
@@ -11,7 +12,7 @@ export let fill = "fill-token";
|
|
|
11
12
|
export let labelledby = "";
|
|
12
13
|
const cBase = "progress-radial relative overflow-hidden";
|
|
13
14
|
const cBaseTrack = "fill-transparent";
|
|
14
|
-
const cBaseMeter = "fill-transparent
|
|
15
|
+
const cBaseMeter = "fill-transparent -rotate-90 origin-[50%_50%]";
|
|
15
16
|
const baseSize = 512;
|
|
16
17
|
const radius = baseSize / 2 - stroke / 2;
|
|
17
18
|
let circumference = radius;
|
|
@@ -45,7 +46,7 @@ $:
|
|
|
45
46
|
|
|
46
47
|
<!-- Meter -->
|
|
47
48
|
<circle
|
|
48
|
-
class="progress-radial-meter {cBaseMeter} {meter}"
|
|
49
|
+
class="progress-radial-meter {cBaseMeter} {meter} {transition}"
|
|
49
50
|
stroke-width={stroke}
|
|
50
51
|
r={radius}
|
|
51
52
|
cx="50%"
|
|
@@ -10,6 +10,8 @@ declare const __propDef: {
|
|
|
10
10
|
font?: number | undefined;
|
|
11
11
|
/** Sets the stoke-linecap value*/
|
|
12
12
|
strokeLinecap?: "butt" | "round" | "square" | undefined;
|
|
13
|
+
/** Provide classes to set the meter transition styles.*/
|
|
14
|
+
transition?: string | undefined;
|
|
13
15
|
/** Provide classes to set the width.*/
|
|
14
16
|
width?: string | undefined;
|
|
15
17
|
/** Provide classes to set meter color.*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import ProgressRadial from './ProgressRadial.svelte';
|
|
4
|
+
describe('ProgressRadial.svelte', () => {
|
|
5
|
+
it('Renders with minimal props', async () => {
|
|
6
|
+
const { getByTestId } = render(ProgressRadial);
|
|
7
|
+
expect(getByTestId('progress-radial')).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
it('Renders with all props', () => {
|
|
10
|
+
const { getByTestId } = render(ProgressRadial, {
|
|
11
|
+
props: {
|
|
12
|
+
value: 50,
|
|
13
|
+
stroke: 20,
|
|
14
|
+
track: 'stroke-surface-300 dark:stroke-surface-700',
|
|
15
|
+
meter: 'stroke-black dark:stroke-white',
|
|
16
|
+
color: 'fill-black dark:fill-white',
|
|
17
|
+
font: 56,
|
|
18
|
+
label: 'testProgressRadial1',
|
|
19
|
+
roundedLineCap: true
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
expect(getByTestId('progress-radial')).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import RadioGroup from './RadioGroup.svelte';
|
|
4
|
+
describe('RadioGroup.svelte', () => {
|
|
5
|
+
it('Renders with minimal props', async () => {
|
|
6
|
+
const { getByTestId } = render(RadioGroup, {
|
|
7
|
+
props: {}
|
|
8
|
+
});
|
|
9
|
+
expect(getByTestId('radio-group')).toBeTruthy();
|
|
10
|
+
});
|
|
11
|
+
it('Renders with all props', () => {
|
|
12
|
+
const { getByTestId } = render(RadioGroup, {
|
|
13
|
+
props: {
|
|
14
|
+
display: 'inline-flex',
|
|
15
|
+
background: 'bg-surface-300 dark:bg-surface-700',
|
|
16
|
+
hover: 'hover:bg-primary-500/10',
|
|
17
|
+
accent: 'bg-primary-500 !text-white',
|
|
18
|
+
color: 'text-white',
|
|
19
|
+
fill: 'fill-white',
|
|
20
|
+
rounded: 'rounded',
|
|
21
|
+
// A11y
|
|
22
|
+
label: 'testRadioGroup'
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
expect(getByTestId('radio-group')).toBeTruthy();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import RadioItem from './RadioItem.svelte';
|
|
4
|
+
describe('RadioItem.svelte', () => {
|
|
5
|
+
it('Renders with minimal props', async () => {
|
|
6
|
+
const { getByTestId } = render(RadioItem, {
|
|
7
|
+
group: 'testGroup',
|
|
8
|
+
name: 'testName',
|
|
9
|
+
value: 'testValue'
|
|
10
|
+
});
|
|
11
|
+
expect(getByTestId('radio-item')).toBeTruthy();
|
|
12
|
+
});
|
|
13
|
+
it('Renders with all props', () => {
|
|
14
|
+
const { getByTestId } = render(RadioItem, {
|
|
15
|
+
props: {
|
|
16
|
+
group: 'testGroup',
|
|
17
|
+
name: 'testName',
|
|
18
|
+
value: 'testValue',
|
|
19
|
+
label: 'testLabel'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
expect(getByTestId('radio-item')).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import RangeSlider from './RangeSlider.svelte';
|
|
4
|
+
describe('RangeSlider.svelte', () => {
|
|
5
|
+
it('Renders with minimal props', async () => {
|
|
6
|
+
const { getByTestId } = render(RangeSlider, { props: { name: 'testRangeSlider' } });
|
|
7
|
+
expect(getByTestId('range-slider')).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
it('Renders with all props', async () => {
|
|
10
|
+
const { getByTestId } = render(RangeSlider, {
|
|
11
|
+
props: {
|
|
12
|
+
min: 0,
|
|
13
|
+
max: 20,
|
|
14
|
+
step: 5,
|
|
15
|
+
value: 10,
|
|
16
|
+
ticked: true,
|
|
17
|
+
accent: 'bg-primary-500',
|
|
18
|
+
// a11y
|
|
19
|
+
id: 'testRangeSlider1',
|
|
20
|
+
name: 'testRangeSlider1',
|
|
21
|
+
label: 'testRangeSliderLabel1'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
expect(getByTestId('range-slider')).toBeTruthy();
|
|
25
|
+
});
|
|
26
|
+
it('Ticks enabled', async () => {
|
|
27
|
+
const { getByTestId } = render(RangeSlider, {
|
|
28
|
+
props: { name: 'testName', ticked: true }
|
|
29
|
+
});
|
|
30
|
+
expect(getByTestId('range-slider').querySelector('datalist')).toBeTruthy();
|
|
31
|
+
});
|
|
32
|
+
it('Disabled state', async () => {
|
|
33
|
+
const { getByTestId } = render(RangeSlider, {
|
|
34
|
+
props: { name: 'testName', disabled: true }
|
|
35
|
+
});
|
|
36
|
+
expect(getByTestId('range-slider').querySelector('input')?.disabled).eq(true);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import Ratings from './Ratings.svelte';
|
|
4
|
+
describe('RatingBar.svelte', () => {
|
|
5
|
+
it('Renders with minimal props', async () => {
|
|
6
|
+
const { getByTestId } = render(Ratings);
|
|
7
|
+
expect(getByTestId('rating-bar')).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
it('Renders with all props', () => {
|
|
10
|
+
const { getByTestId } = render(Ratings, {
|
|
11
|
+
props: {
|
|
12
|
+
max: 10,
|
|
13
|
+
value: 5.5,
|
|
14
|
+
justify: 'justify-center',
|
|
15
|
+
spacing: 'space-x-4'
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
expect(getByTestId('rating-bar')).toBeTruthy();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import SliderToggle from './SlideToggle.svelte';
|
|
4
|
+
describe('SliderToggle.svelte', () => {
|
|
5
|
+
it('Renders with minimal props', async () => {
|
|
6
|
+
const { getByTestId } = render(SliderToggle, { props: { name: 'testName' } });
|
|
7
|
+
expect(getByTestId('slide-toggle')).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
it('Renders with all props', async () => {
|
|
10
|
+
const { getByTestId } = render(SliderToggle, {
|
|
11
|
+
props: {
|
|
12
|
+
name: 'testName',
|
|
13
|
+
checked: true,
|
|
14
|
+
accent: 'bg-primary-500',
|
|
15
|
+
size: 'lg',
|
|
16
|
+
label: 'testSlideToggle1'
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
expect(getByTestId('slide-toggle')).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import { writable } from 'svelte/store';
|
|
4
|
+
import Step from './Step.svelte';
|
|
5
|
+
const mockState = writable({ current: 1, total: 1 }); // NOTE: current/total must match!
|
|
6
|
+
describe('Step.svelte', () => {
|
|
7
|
+
it('Renders with mininal props', async () => {
|
|
8
|
+
const { getByTestId } = render(Step, { props: { state: mockState, index: 0 } });
|
|
9
|
+
expect(getByTestId('step')).toBeTruthy();
|
|
10
|
+
});
|
|
11
|
+
it('Renders with all props', () => {
|
|
12
|
+
const { getByTestId } = render(Step, {
|
|
13
|
+
props: {
|
|
14
|
+
state: mockState,
|
|
15
|
+
index: 0,
|
|
16
|
+
locked: false
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
expect(getByTestId('step')).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import { writable } from 'svelte/store';
|
|
4
|
+
import Stepper from './Stepper.svelte';
|
|
5
|
+
describe('Stepper.svelte', () => {
|
|
6
|
+
it('Renders with minimal props', () => {
|
|
7
|
+
const { getByTestId } = render(Stepper);
|
|
8
|
+
expect(getByTestId('stepper')).toBeTruthy();
|
|
9
|
+
});
|
|
10
|
+
it('Renders with all props', () => {
|
|
11
|
+
const { getByTestId } = render(Stepper, {
|
|
12
|
+
props: {
|
|
13
|
+
active: writable(0),
|
|
14
|
+
length: 0,
|
|
15
|
+
// Props (timeline)
|
|
16
|
+
color: 'text-white',
|
|
17
|
+
background: 'bg-secondary-500 text-white',
|
|
18
|
+
// Props (buttons)
|
|
19
|
+
buttonBack: {},
|
|
20
|
+
buttonNext: {},
|
|
21
|
+
buttonComplete: {}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
expect(getByTestId('stepper')).toBeTruthy();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import Tab from './Tab.svelte';
|
|
4
|
+
describe('Tab.svelte', () => {
|
|
5
|
+
it('Renders with minimal props', async () => {
|
|
6
|
+
const { getByTestId } = render(Tab, {
|
|
7
|
+
props: {
|
|
8
|
+
group: 'testGroup',
|
|
9
|
+
name: 'testName',
|
|
10
|
+
value: 'testValue'
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
expect(getByTestId('tab')).toBeTruthy();
|
|
14
|
+
});
|
|
15
|
+
it('Renders with all props', async () => {
|
|
16
|
+
const { getByTestId } = render(Tab, {
|
|
17
|
+
props: {
|
|
18
|
+
group: 'testGroup',
|
|
19
|
+
name: 'testName',
|
|
20
|
+
value: 'testValue',
|
|
21
|
+
// ---
|
|
22
|
+
borderWidth: 'border-b-2',
|
|
23
|
+
borderColor: 'border-primary-500',
|
|
24
|
+
color: 'text-primary-500',
|
|
25
|
+
fill: 'fill-primary-500'
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
expect(getByTestId('tab')).toBeTruthy();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import { writable } from 'svelte/store';
|
|
4
|
+
import TabGroup from './TabGroup.svelte';
|
|
5
|
+
describe('TabGroup.svelte', () => {
|
|
6
|
+
it('Renders with minimal props', async () => {
|
|
7
|
+
const { getByTestId } = render(TabGroup, { props: { selected: writable(0) } });
|
|
8
|
+
expect(getByTestId('tab-group')).toBeTruthy();
|
|
9
|
+
});
|
|
10
|
+
it('Renders with minimal props', async () => {
|
|
11
|
+
const { getByTestId } = render(TabGroup, {
|
|
12
|
+
props: {
|
|
13
|
+
selected: writable(0),
|
|
14
|
+
justify: 'justify-start',
|
|
15
|
+
borderWidth: 'border-b-2',
|
|
16
|
+
borderColor: 'border-primary-500',
|
|
17
|
+
color: 'text-primary-500',
|
|
18
|
+
fill: 'fill-primary-500',
|
|
19
|
+
hover: 'hover:bg-primary-500/10',
|
|
20
|
+
labelledby: 'testTabGroupLabel1',
|
|
21
|
+
label: 'testTabGroup1'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
expect(getByTestId('tab-group')).toBeTruthy();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -36,7 +36,7 @@ $:
|
|
|
36
36
|
<table
|
|
37
37
|
class="{classesTable}"
|
|
38
38
|
class:table-interactive={interactive}
|
|
39
|
-
role="grid"
|
|
39
|
+
role={interactive ? "grid" : "table"}
|
|
40
40
|
use:tableA11y
|
|
41
41
|
>
|
|
42
42
|
<!-- on:keydown={(e) => onTableKeydown(elemTable, e)} -->
|
|
@@ -44,7 +44,7 @@ $:
|
|
|
44
44
|
<thead class="table-head {regionHead}">
|
|
45
45
|
<tr>
|
|
46
46
|
{#each source.head as heading }
|
|
47
|
-
<th class="{regionHeadCell}">{@html heading}</th>
|
|
47
|
+
<th class="{regionHeadCell}" role="columnheader">{@html heading}</th>
|
|
48
48
|
{/each}
|
|
49
49
|
</tr>
|
|
50
50
|
</thead>
|
|
@@ -63,9 +63,9 @@ $:
|
|
|
63
63
|
<!-- prettier-ignore -->
|
|
64
64
|
<td
|
|
65
65
|
class="{regionCell}"
|
|
66
|
-
role="gridcell"
|
|
66
|
+
role={interactive ? "gridcell" : "cell"}
|
|
67
67
|
aria-colindex={cellIndex + 1}
|
|
68
|
-
tabindex={cellIndex === 0 ? 0 : -1}
|
|
68
|
+
tabindex={cellIndex === 0 && interactive ? 0 : -1}
|
|
69
69
|
>
|
|
70
70
|
{@html Number(cell) === 0 ? cell : (cell ? cell : '-')}
|
|
71
71
|
</td>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { setContext } from "svelte";
|
|
1
|
+
<script>import { createEventDispatcher, setContext } from "svelte";
|
|
2
2
|
import RecursiveTreeViewItem from "./RecursiveTreeViewItem.svelte";
|
|
3
3
|
export let selection = false;
|
|
4
4
|
export let multiple = false;
|
|
@@ -38,6 +38,17 @@ setContext("hyphenOpacity", hyphenOpacity);
|
|
|
38
38
|
setContext("regionSummary", regionSummary);
|
|
39
39
|
setContext("regionSymbol", regionSymbol);
|
|
40
40
|
setContext("regionChildren", regionChildren);
|
|
41
|
+
const dispatch = createEventDispatcher();
|
|
42
|
+
function onClick(event) {
|
|
43
|
+
dispatch("click", {
|
|
44
|
+
id: event.detail.id
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function onToggle(event) {
|
|
48
|
+
dispatch("toggle", {
|
|
49
|
+
id: event.detail.id
|
|
50
|
+
});
|
|
51
|
+
}
|
|
41
52
|
$:
|
|
42
53
|
classesBase = `${width} ${spacing} ${$$props.class ?? ""}`;
|
|
43
54
|
</script>
|
|
@@ -51,6 +62,14 @@ $:
|
|
|
51
62
|
aria-disabled={disabled}
|
|
52
63
|
>
|
|
53
64
|
{#if nodes && nodes.length > 0}
|
|
54
|
-
<RecursiveTreeViewItem
|
|
65
|
+
<RecursiveTreeViewItem
|
|
66
|
+
{nodes}
|
|
67
|
+
bind:expandedNodes
|
|
68
|
+
bind:disabledNodes
|
|
69
|
+
bind:checkedNodes
|
|
70
|
+
bind:indeterminateNodes
|
|
71
|
+
on:click={onClick}
|
|
72
|
+
on:toggle={onToggle}
|
|
73
|
+
/>
|
|
55
74
|
{/if}
|
|
56
75
|
</div>
|
|
@@ -50,6 +50,11 @@ declare const __propDef: {
|
|
|
50
50
|
labelledby?: string | undefined;
|
|
51
51
|
};
|
|
52
52
|
events: {
|
|
53
|
+
/** {{id:string}} click - Fires on tree item click*/
|
|
54
|
+
click: CustomEvent<any>;
|
|
55
|
+
/** {{id:string}} toggle - Fires on tree item toggle*/
|
|
56
|
+
toggle: CustomEvent<any>;
|
|
57
|
+
} & {
|
|
53
58
|
[evt: string]: CustomEvent<any>;
|
|
54
59
|
};
|
|
55
60
|
slots: {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import TreeViewItem from "./TreeViewItem.svelte";
|
|
2
2
|
import RecursiveTreeViewItem from "./RecursiveTreeViewItem.svelte";
|
|
3
|
-
import { getContext, onMount
|
|
3
|
+
import { createEventDispatcher, getContext, onMount } from "svelte";
|
|
4
4
|
export let nodes = [];
|
|
5
5
|
export let expandedNodes = [];
|
|
6
6
|
export let disabledNodes = [];
|
|
@@ -9,9 +9,9 @@ export let indeterminateNodes = [];
|
|
|
9
9
|
let selection = getContext("selection");
|
|
10
10
|
let multiple = getContext("multiple");
|
|
11
11
|
let relational = getContext("relational");
|
|
12
|
-
let
|
|
13
|
-
let group;
|
|
12
|
+
let group = multiple ? [] : "";
|
|
14
13
|
let name = "";
|
|
14
|
+
const dispatch = createEventDispatcher();
|
|
15
15
|
function toggleNode(node, open) {
|
|
16
16
|
if (!node.children?.length)
|
|
17
17
|
return;
|
|
@@ -51,27 +51,29 @@ function checkNode(node, checked, indeterminate) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
if (selection) {
|
|
55
|
+
if (multiple) {
|
|
56
|
+
nodes.forEach((node) => {
|
|
57
|
+
if (!Array.isArray(group))
|
|
58
|
+
return;
|
|
59
|
+
if (checkedNodes.includes(node.id) && !group.includes(node.id)) {
|
|
60
|
+
group.push(node.id);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
group = group;
|
|
64
|
+
} else {
|
|
65
|
+
nodes.forEach((node) => {
|
|
66
|
+
if (checkedNodes.includes(node.id) && group !== node.id) {
|
|
67
|
+
group = node.id;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
55
72
|
onMount(async () => {
|
|
56
73
|
if (selection) {
|
|
57
74
|
name = String(Math.random());
|
|
58
|
-
if (group === void 0) {
|
|
59
|
-
if (multiple) {
|
|
60
|
-
group = [];
|
|
61
|
-
nodes.forEach((node) => {
|
|
62
|
-
if (checkedNodes.includes(node.id) && Array.isArray(group))
|
|
63
|
-
group.push(node.id);
|
|
64
|
-
});
|
|
65
|
-
group = group;
|
|
66
|
-
} else if (!nodes.some((node) => checkedNodes.includes(node.id))) {
|
|
67
|
-
group = "";
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
75
|
if (!relational)
|
|
71
76
|
treeItems = [];
|
|
72
|
-
checkedNodes = [];
|
|
73
|
-
await tick();
|
|
74
|
-
checkedNodes = [...tempCheckedNodes];
|
|
75
77
|
}
|
|
76
78
|
});
|
|
77
79
|
export let treeItems = [];
|
|
@@ -94,10 +96,27 @@ let children = [];
|
|
|
94
96
|
indeterminate={indeterminateNodes.includes(node.id)}
|
|
95
97
|
on:toggle={(e) => toggleNode(node, e.detail.open)}
|
|
96
98
|
on:groupChange={(e) => checkNode(node, e.detail.checked, e.detail.indeterminate)}
|
|
99
|
+
on:click={() =>
|
|
100
|
+
dispatch('click', {
|
|
101
|
+
id: node.id
|
|
102
|
+
})}
|
|
103
|
+
on:toggle={() => {
|
|
104
|
+
dispatch('toggle', {
|
|
105
|
+
id: node.id
|
|
106
|
+
});
|
|
107
|
+
}}
|
|
97
108
|
>
|
|
98
|
-
{
|
|
109
|
+
{#if typeof node.content === 'string'}
|
|
110
|
+
{@html node.content}
|
|
111
|
+
{:else}
|
|
112
|
+
<svelte:component this={node.content} {...node.contentProps} />
|
|
113
|
+
{/if}
|
|
99
114
|
<svelte:fragment slot="lead">
|
|
100
|
-
{
|
|
115
|
+
{#if typeof node.lead === 'string'}
|
|
116
|
+
{@html node.lead}
|
|
117
|
+
{:else}
|
|
118
|
+
<svelte:component this={node.lead} {...node.leadProps} />
|
|
119
|
+
{/if}
|
|
101
120
|
</svelte:fragment>
|
|
102
121
|
<svelte:fragment slot="children">
|
|
103
122
|
<RecursiveTreeViewItem
|
|
@@ -107,6 +126,14 @@ let children = [];
|
|
|
107
126
|
bind:checkedNodes
|
|
108
127
|
bind:indeterminateNodes
|
|
109
128
|
bind:treeItems={children[i]}
|
|
129
|
+
on:click={(e) =>
|
|
130
|
+
dispatch('click', {
|
|
131
|
+
id: e.detail.id
|
|
132
|
+
})}
|
|
133
|
+
on:toggle={(e) =>
|
|
134
|
+
dispatch('toggle', {
|
|
135
|
+
id: e.detail.id
|
|
136
|
+
})}
|
|
110
137
|
/>
|
|
111
138
|
</svelte:fragment>
|
|
112
139
|
</TreeViewItem>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|