lithesome 0.22.3 → 0.23.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.
- package/README.md +43 -43
- package/dist/components/accordion/Accordion.svelte +33 -33
- package/dist/components/accordion/Accordion.svelte.d.ts +0 -2
- package/dist/components/accordion/AccordionButton.svelte +20 -20
- package/dist/components/accordion/AccordionButton.svelte.d.ts +0 -3
- package/dist/components/accordion/AccordionContent.svelte +20 -20
- package/dist/components/accordion/AccordionContent.svelte.d.ts +0 -2
- package/dist/components/accordion/AccordionHeading.svelte +26 -26
- package/dist/components/accordion/AccordionHeading.svelte.d.ts +0 -2
- package/dist/components/accordion/AccordionItem.svelte +28 -28
- package/dist/components/accordion/AccordionItem.svelte.d.ts +0 -3
- package/dist/components/accordion/state.svelte.d.ts +3 -17
- package/dist/components/accordion/state.svelte.js +0 -9
- package/dist/components/checkbox/CheckboxButton.svelte +57 -57
- package/dist/components/checkbox/CheckboxButton.svelte.d.ts +0 -3
- package/dist/components/checkbox/CheckboxGroup.svelte +35 -35
- package/dist/components/checkbox/CheckboxGroup.svelte.d.ts +0 -3
- package/dist/components/checkbox/CheckboxLabel.svelte +24 -24
- package/dist/components/checkbox/CheckboxLabel.svelte.d.ts +0 -3
- package/dist/components/checkbox/state.svelte.d.ts +4 -31
- package/dist/components/checkbox/state.svelte.js +0 -18
- package/dist/components/dropzone/Dropzone.svelte +48 -48
- package/dist/components/dropzone/Dropzone.svelte.d.ts +0 -3
- package/dist/components/dropzone/DropzoneInput.svelte +24 -24
- package/dist/components/dropzone/DropzoneInput.svelte.d.ts +1 -1
- package/dist/components/dropzone/state.svelte.d.ts +2 -11
- package/dist/components/dropzone/state.svelte.js +0 -6
- package/dist/components/hovercard/Hovercard.svelte +38 -38
- package/dist/components/hovercard/Hovercard.svelte.d.ts +1 -3
- package/dist/components/hovercard/HovercardArrow.svelte +23 -23
- package/dist/components/hovercard/HovercardArrow.svelte.d.ts +1 -1
- package/dist/components/hovercard/HovercardContent.svelte +23 -23
- package/dist/components/hovercard/HovercardContent.svelte.d.ts +0 -2
- package/dist/components/hovercard/HovercardTrigger.svelte +23 -23
- package/dist/components/hovercard/HovercardTrigger.svelte.d.ts +1 -1
- package/dist/components/hovercard/state.svelte.d.ts +5 -25
- package/dist/components/hovercard/state.svelte.js +0 -12
- package/dist/components/menu/Menu.svelte +36 -36
- package/dist/components/menu/Menu.svelte.d.ts +1 -3
- package/dist/components/menu/MenuArrow.svelte +17 -17
- package/dist/components/menu/MenuArrow.svelte.d.ts +1 -1
- package/dist/components/menu/MenuContent.svelte +23 -23
- package/dist/components/menu/MenuContent.svelte.d.ts +0 -2
- package/dist/components/menu/MenuItem.svelte +28 -28
- package/dist/components/menu/MenuItem.svelte.d.ts +0 -3
- package/dist/components/menu/MenuSub.svelte +38 -38
- package/dist/components/menu/MenuSub.svelte.d.ts +1 -3
- package/dist/components/menu/MenuSubContent.svelte +23 -23
- package/dist/components/menu/MenuSubContent.svelte.d.ts +0 -2
- package/dist/components/menu/MenuSubTrigger.svelte +23 -23
- package/dist/components/menu/MenuSubTrigger.svelte.d.ts +0 -4
- package/dist/components/menu/MenuTrigger.svelte +23 -23
- package/dist/components/menu/MenuTrigger.svelte.d.ts +0 -2
- package/dist/components/menu/state.svelte.d.ts +12 -67
- package/dist/components/menu/state.svelte.js +8 -46
- package/dist/components/modal/Modal.svelte +31 -32
- package/dist/components/modal/Modal.svelte.d.ts +1 -3
- package/dist/components/modal/ModalBackdrop.svelte +24 -24
- package/dist/components/modal/ModalBackdrop.svelte.d.ts +0 -2
- package/dist/components/modal/ModalContent.svelte +24 -24
- package/dist/components/modal/ModalContent.svelte.d.ts +1 -12
- package/dist/components/modal/ModalDescription.svelte +24 -24
- package/dist/components/modal/ModalDescription.svelte.d.ts +1 -1
- package/dist/components/modal/ModalTitle.svelte +24 -24
- package/dist/components/modal/ModalTitle.svelte.d.ts +1 -1
- package/dist/components/modal/ModalTrigger.svelte +24 -24
- package/dist/components/modal/ModalTrigger.svelte.d.ts +0 -2
- package/dist/components/modal/state.svelte.d.ts +5 -25
- package/dist/components/modal/state.svelte.js +0 -12
- package/dist/components/pin/Pin.svelte +41 -41
- package/dist/components/pin/Pin.svelte.d.ts +0 -2
- package/dist/components/pin/PinInput.svelte +17 -17
- package/dist/components/pin/PinInput.svelte.d.ts +1 -5
- package/dist/components/pin/state.svelte.d.ts +3 -18
- package/dist/components/pin/state.svelte.js +0 -9
- package/dist/components/radiogroup/RadioGroup.svelte +35 -35
- package/dist/components/radiogroup/RadioGroup.svelte.d.ts +0 -3
- package/dist/components/radiogroup/RadioGroupItem.svelte +28 -28
- package/dist/components/radiogroup/RadioGroupItem.svelte.d.ts +0 -3
- package/dist/components/radiogroup/state.svelte.d.ts +3 -21
- package/dist/components/radiogroup/state.svelte.js +1 -12
- package/dist/components/select/Select.svelte +47 -47
- package/dist/components/select/Select.svelte.d.ts +1 -3
- package/dist/components/select/SelectArrow.svelte +23 -23
- package/dist/components/select/SelectArrow.svelte.d.ts +1 -1
- package/dist/components/select/SelectContent.svelte +23 -23
- package/dist/components/select/SelectContent.svelte.d.ts +0 -2
- package/dist/components/select/SelectOption.svelte +29 -29
- package/dist/components/select/SelectOption.svelte.d.ts +0 -3
- package/dist/components/select/SelectTrigger.svelte +23 -23
- package/dist/components/select/SelectTrigger.svelte.d.ts +0 -2
- package/dist/components/select/SelectValue.svelte +25 -25
- package/dist/components/select/SelectValue.svelte.d.ts +2 -3
- package/dist/components/select/state.svelte.d.ts +7 -41
- package/dist/components/select/state.svelte.js +18 -32
- package/dist/components/slider/Slider.svelte +45 -45
- package/dist/components/slider/Slider.svelte.d.ts +1 -1
- package/dist/components/slider/SliderRange.svelte +17 -17
- package/dist/components/slider/SliderRange.svelte.d.ts +6 -2
- package/dist/components/slider/SliderThumb.svelte +17 -17
- package/dist/components/slider/SliderThumb.svelte.d.ts +7 -2
- package/dist/components/slider/SliderValue.svelte +17 -17
- package/dist/components/slider/SliderValue.svelte.d.ts +1 -4
- package/dist/components/stepper/Stepper.svelte +37 -38
- package/dist/components/stepper/Stepper.svelte.d.ts +1 -9
- package/dist/components/stepper/StepperItem.svelte +27 -27
- package/dist/components/stepper/StepperItem.svelte.d.ts +0 -3
- package/dist/components/stepper/StepperLink.svelte +30 -30
- package/dist/components/stepper/StepperLink.svelte.d.ts +0 -4
- package/dist/components/stepper/StepperNext.svelte +26 -26
- package/dist/components/stepper/StepperNext.svelte.d.ts +0 -3
- package/dist/components/stepper/StepperPrev.svelte +26 -26
- package/dist/components/stepper/StepperPrev.svelte.d.ts +0 -3
- package/dist/components/stepper/StepperSteps.svelte +23 -23
- package/dist/components/stepper/StepperSteps.svelte.d.ts +0 -2
- package/dist/components/stepper/index.d.ts +0 -1
- package/dist/components/stepper/index.js +0 -1
- package/dist/components/stepper/state.svelte.d.ts +9 -98
- package/dist/components/stepper/state.svelte.js +3 -67
- package/dist/components/tabs/Tabs.svelte +31 -31
- package/dist/components/tabs/Tabs.svelte.d.ts +0 -2
- package/dist/components/tabs/TabsButton.svelte +30 -30
- package/dist/components/tabs/TabsButton.svelte.d.ts +0 -2
- package/dist/components/tabs/TabsContent.svelte +25 -25
- package/dist/components/tabs/TabsContent.svelte.d.ts +0 -2
- package/dist/components/tabs/TabsList.svelte +17 -23
- package/dist/components/tabs/TabsList.svelte.d.ts +0 -2
- package/dist/components/tabs/state.svelte.d.ts +5 -25
- package/dist/components/tabs/state.svelte.js +0 -12
- package/dist/components/tags/Tags.svelte +37 -37
- package/dist/components/tags/Tags.svelte.d.ts +0 -3
- package/dist/components/tags/TagsDelete.svelte +26 -26
- package/dist/components/tags/TagsDelete.svelte.d.ts +1 -1
- package/dist/components/tags/TagsInput.svelte +17 -17
- package/dist/components/tags/TagsInput.svelte.d.ts +1 -3
- package/dist/components/tags/TagsItem.svelte +26 -26
- package/dist/components/tags/TagsItem.svelte.d.ts +0 -2
- package/dist/components/tags/state.svelte.d.ts +4 -31
- package/dist/components/tags/state.svelte.js +0 -20
- package/dist/components/tooltip/Tooltip.svelte +38 -38
- package/dist/components/tooltip/Tooltip.svelte.d.ts +1 -3
- package/dist/components/tooltip/TooltipArrow.svelte +23 -23
- package/dist/components/tooltip/TooltipArrow.svelte.d.ts +1 -1
- package/dist/components/tooltip/TooltipContent.svelte +23 -23
- package/dist/components/tooltip/TooltipContent.svelte.d.ts +0 -2
- package/dist/components/tooltip/TooltipTrigger.svelte +23 -23
- package/dist/components/tooltip/TooltipTrigger.svelte.d.ts +1 -1
- package/dist/components/tooltip/state.svelte.d.ts +5 -25
- package/dist/components/tooltip/state.svelte.js +0 -12
- package/dist/internals/components/Element.svelte +78 -78
- package/dist/internals/is.d.ts +0 -11
- package/dist/internals/is.js +0 -14
- package/dist/internals/types.d.ts +13 -2
- package/dist/internals/utils.svelte.d.ts +0 -19
- package/dist/internals/utils.svelte.js +6 -56
- package/dist/types/components/accordion.d.ts +43 -5
- package/dist/types/components/checkbox.d.ts +33 -3
- package/dist/types/components/dropzone.d.ts +13 -3
- package/dist/types/components/hovercard.d.ts +28 -4
- package/dist/types/components/menu.d.ts +69 -10
- package/dist/types/components/modal.d.ts +30 -6
- package/dist/types/components/pin.d.ts +22 -2
- package/dist/types/components/radiogroup.d.ts +22 -2
- package/dist/types/components/select.d.ts +51 -7
- package/dist/types/components/slider.d.ts +34 -4
- package/dist/types/components/stepper.d.ts +91 -15
- package/dist/types/components/tabs.d.ts +28 -4
- package/dist/types/components/tags.d.ts +35 -5
- package/dist/types/components/tooltip.d.ts +28 -4
- package/package.json +75 -75
- package/dist/components/stepper/StepperJump.svelte +0 -30
- package/dist/components/stepper/StepperJump.svelte.d.ts +0 -9
package/README.md
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
> [!WARNING]
|
|
2
|
-
> This library is still in very early development. Expect things to be broken.
|
|
3
|
-
|
|
4
|
-
# Lithesome
|
|
5
|
-
|
|
6
|
-
An unstyled component library for Svelte 5.
|
|
7
|
-
|
|
8
|
-
<br>
|
|
9
|
-
|
|
10
|
-
## Install
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
pnpm i -D lithesome
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Usage
|
|
17
|
-
|
|
18
|
-
```svelte
|
|
19
|
-
<script>
|
|
20
|
-
import { Menu, MenuContent, MenuItem, MenuTrigger } from 'lithesome';
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<Menu>
|
|
24
|
-
<MenuTrigger>
|
|
25
|
-
<button>Auth</button>
|
|
26
|
-
</MenuTrigger>
|
|
27
|
-
<MenuContent>
|
|
28
|
-
<MenuItem>My Profile</MenuItem>
|
|
29
|
-
<MenuItem>Account Settings</MenuItem>
|
|
30
|
-
<MenuItem>Logout</MenuItem>
|
|
31
|
-
</MenuContent>
|
|
32
|
-
</Menu>
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
<br>
|
|
36
|
-
|
|
37
|
-
## Docs
|
|
38
|
-
|
|
39
|
-
View more information at: https://lithesome.dev
|
|
40
|
-
|
|
41
|
-
## License
|
|
42
|
-
|
|
43
|
-
See the [LICENSE](https://github.com/Gibbu/lithesome/blob/main/LICENSE.md) file for license rights and limitations (MIT).
|
|
1
|
+
> [!WARNING]
|
|
2
|
+
> This library is still in very early development. Expect things to be broken.
|
|
3
|
+
|
|
4
|
+
# Lithesome
|
|
5
|
+
|
|
6
|
+
An unstyled component library for Svelte 5.
|
|
7
|
+
|
|
8
|
+
<br>
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm i -D lithesome
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```svelte
|
|
19
|
+
<script>
|
|
20
|
+
import { Menu, MenuContent, MenuItem, MenuTrigger } from 'lithesome';
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<Menu>
|
|
24
|
+
<MenuTrigger>
|
|
25
|
+
<button>Auth</button>
|
|
26
|
+
</MenuTrigger>
|
|
27
|
+
<MenuContent>
|
|
28
|
+
<MenuItem>My Profile</MenuItem>
|
|
29
|
+
<MenuItem>Account Settings</MenuItem>
|
|
30
|
+
<MenuItem>Logout</MenuItem>
|
|
31
|
+
</MenuContent>
|
|
32
|
+
</Menu>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
<br>
|
|
36
|
+
|
|
37
|
+
## Docs
|
|
38
|
+
|
|
39
|
+
View more information at: https://lithesome.dev
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
See the [LICENSE](https://github.com/Gibbu/lithesome/blob/main/LICENSE.md) file for license rights and limitations (MIT).
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { stateValue } from '../../internals/context.svelte.js';
|
|
3
|
-
import { Element, parseId } from '../../internals/index.js';
|
|
4
|
-
import { createAccordionRootContext } from './state.svelte.js';
|
|
5
|
-
|
|
6
|
-
import type { AccordionProps } from '../../types/index.js';
|
|
7
|
-
|
|
8
|
-
const uid = $props.id();
|
|
9
|
-
|
|
10
|
-
let {
|
|
11
|
-
id = parseId(uid),
|
|
12
|
-
ref = $bindable(),
|
|
13
|
-
value = $bindable(''),
|
|
14
|
-
children,
|
|
15
|
-
custom,
|
|
16
|
-
onChange,
|
|
17
|
-
...props
|
|
18
|
-
}: AccordionProps<typeof ctx.props
|
|
19
|
-
|
|
20
|
-
let ctx = createAccordionRootContext({
|
|
21
|
-
id: stateValue(() => id),
|
|
22
|
-
ref: stateValue(() => ref!),
|
|
23
|
-
value: stateValue(
|
|
24
|
-
() => value,
|
|
25
|
-
(v) => {
|
|
26
|
-
value = v;
|
|
27
|
-
onChange?.(v);
|
|
28
|
-
}
|
|
29
|
-
)
|
|
30
|
-
});
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<Element bind:ref {children} {custom} {ctx} {...props} />
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { stateValue } from '../../internals/context.svelte.js';
|
|
3
|
+
import { Element, parseId } from '../../internals/index.js';
|
|
4
|
+
import { createAccordionRootContext } from './state.svelte.js';
|
|
5
|
+
|
|
6
|
+
import type { AccordionProps } from '../../types/index.js';
|
|
7
|
+
|
|
8
|
+
const uid = $props.id();
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
id = parseId(uid),
|
|
12
|
+
ref = $bindable(),
|
|
13
|
+
value = $bindable(''),
|
|
14
|
+
children,
|
|
15
|
+
custom,
|
|
16
|
+
onChange,
|
|
17
|
+
...props
|
|
18
|
+
}: AccordionProps<typeof ctx.props> = $props();
|
|
19
|
+
|
|
20
|
+
let ctx = createAccordionRootContext({
|
|
21
|
+
id: stateValue(() => id),
|
|
22
|
+
ref: stateValue(() => ref!),
|
|
23
|
+
value: stateValue(
|
|
24
|
+
() => value,
|
|
25
|
+
(v) => {
|
|
26
|
+
value = v;
|
|
27
|
+
onChange?.(v);
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
});
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<Element bind:ref {children} {custom} {ctx} {...props} />
|
|
@@ -2,8 +2,6 @@ import type { AccordionProps } from '../../types/index.js';
|
|
|
2
2
|
declare const Accordion: import("svelte").Component<AccordionProps<{
|
|
3
3
|
id: string;
|
|
4
4
|
"data-accordion-root": string;
|
|
5
|
-
}, {
|
|
6
|
-
value: string | string[];
|
|
7
5
|
}>, {}, "ref" | "value">;
|
|
8
6
|
type Accordion = ReturnType<typeof Accordion>;
|
|
9
7
|
export default Accordion;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Element, parseId, stateValue } from '../../internals/index.js';
|
|
3
|
-
import { useAccordionButton } from './state.svelte.js';
|
|
4
|
-
|
|
5
|
-
import type { AccordionButtonProps } from '../../types/index.js';
|
|
6
|
-
|
|
7
|
-
const uid = $props.id();
|
|
8
|
-
|
|
9
|
-
let {
|
|
10
|
-
id = parseId(uid),
|
|
11
|
-
children,
|
|
12
|
-
custom,
|
|
13
|
-
ref = $bindable(),
|
|
14
|
-
...props
|
|
15
|
-
}: AccordionButtonProps<typeof ctx.props
|
|
16
|
-
|
|
17
|
-
let ctx = useAccordionButton({ id: stateValue(() => id), ref: stateValue(() => ref!) });
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<Element bind:ref {children} {custom} {ctx} as="button" {...props} />
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Element, parseId, stateValue } from '../../internals/index.js';
|
|
3
|
+
import { useAccordionButton } from './state.svelte.js';
|
|
4
|
+
|
|
5
|
+
import type { AccordionButtonProps } from '../../types/index.js';
|
|
6
|
+
|
|
7
|
+
const uid = $props.id();
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
id = parseId(uid),
|
|
11
|
+
children,
|
|
12
|
+
custom,
|
|
13
|
+
ref = $bindable(),
|
|
14
|
+
...props
|
|
15
|
+
}: AccordionButtonProps<typeof ctx.props> = $props();
|
|
16
|
+
|
|
17
|
+
let ctx = useAccordionButton({ id: stateValue(() => id), ref: stateValue(() => ref!) });
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<Element bind:ref {children} {custom} {ctx} as="button" {...props} />
|
|
@@ -6,9 +6,6 @@ declare const AccordionButton: import("svelte").Component<AccordionButtonProps<{
|
|
|
6
6
|
readonly 'aria-expanded': boolean;
|
|
7
7
|
readonly 'aria-controls': string | undefined;
|
|
8
8
|
readonly tabindex: 0 | -1;
|
|
9
|
-
}, {
|
|
10
|
-
active: boolean;
|
|
11
|
-
disabled: boolean;
|
|
12
9
|
}>, {}, "ref">;
|
|
13
10
|
type AccordionButton = ReturnType<typeof AccordionButton>;
|
|
14
11
|
export default AccordionButton;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Element, parseId, stateValue } from '../../internals/index.js';
|
|
3
|
-
import { useAccordionContent } from './state.svelte.js';
|
|
4
|
-
|
|
5
|
-
import type { AccordionContentProps } from '../../types/index.js';
|
|
6
|
-
|
|
7
|
-
const uid = $props.id();
|
|
8
|
-
|
|
9
|
-
let {
|
|
10
|
-
id = parseId(uid),
|
|
11
|
-
children,
|
|
12
|
-
custom,
|
|
13
|
-
ref = $bindable(),
|
|
14
|
-
...props
|
|
15
|
-
}: AccordionContentProps<typeof ctx.props
|
|
16
|
-
|
|
17
|
-
let ctx = useAccordionContent({ id: stateValue(() => id), ref: stateValue(() => ref!) });
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<Element bind:ref {children} {custom} {ctx} visible={ctx._item.Active} {...props} />
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Element, parseId, stateValue } from '../../internals/index.js';
|
|
3
|
+
import { useAccordionContent } from './state.svelte.js';
|
|
4
|
+
|
|
5
|
+
import type { AccordionContentProps } from '../../types/index.js';
|
|
6
|
+
|
|
7
|
+
const uid = $props.id();
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
id = parseId(uid),
|
|
11
|
+
children,
|
|
12
|
+
custom,
|
|
13
|
+
ref = $bindable(),
|
|
14
|
+
...props
|
|
15
|
+
}: AccordionContentProps<typeof ctx.props> = $props();
|
|
16
|
+
|
|
17
|
+
let ctx = useAccordionContent({ id: stateValue(() => id), ref: stateValue(() => ref!) });
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<Element bind:ref {children} {custom} {ctx} visible={ctx._item.Active} {...props} />
|
|
@@ -2,8 +2,6 @@ import type { AccordionContentProps } from '../../types/index.js';
|
|
|
2
2
|
declare const AccordionContent: import("svelte").Component<AccordionContentProps<{
|
|
3
3
|
id: string;
|
|
4
4
|
"data-accordion-content": string;
|
|
5
|
-
}, {
|
|
6
|
-
active: boolean;
|
|
7
5
|
}>, {}, "ref">;
|
|
8
6
|
type AccordionContent = ReturnType<typeof AccordionContent>;
|
|
9
7
|
export default AccordionContent;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { stateValue } from '../../internals/context.svelte.js';
|
|
3
|
-
import { Element, parseId } from '../../internals/index.js';
|
|
4
|
-
import { useAccordionHeading } from './state.svelte.js';
|
|
5
|
-
|
|
6
|
-
import type { AccordionHeadingProps } from '../../types/index.js';
|
|
7
|
-
|
|
8
|
-
const uid = $props.id();
|
|
9
|
-
|
|
10
|
-
let {
|
|
11
|
-
id = parseId(uid),
|
|
12
|
-
children,
|
|
13
|
-
custom,
|
|
14
|
-
ref = $bindable(),
|
|
15
|
-
level = 3,
|
|
16
|
-
...props
|
|
17
|
-
}: AccordionHeadingProps<typeof ctx.props
|
|
18
|
-
|
|
19
|
-
let ctx = useAccordionHeading({
|
|
20
|
-
id: stateValue(() => id),
|
|
21
|
-
ref: stateValue(() => ref!),
|
|
22
|
-
level: stateValue(() => level)
|
|
23
|
-
});
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<Element bind:ref {children} {custom} {ctx} {...props} />
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { stateValue } from '../../internals/context.svelte.js';
|
|
3
|
+
import { Element, parseId } from '../../internals/index.js';
|
|
4
|
+
import { useAccordionHeading } from './state.svelte.js';
|
|
5
|
+
|
|
6
|
+
import type { AccordionHeadingProps } from '../../types/index.js';
|
|
7
|
+
|
|
8
|
+
const uid = $props.id();
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
id = parseId(uid),
|
|
12
|
+
children,
|
|
13
|
+
custom,
|
|
14
|
+
ref = $bindable(),
|
|
15
|
+
level = 3,
|
|
16
|
+
...props
|
|
17
|
+
}: AccordionHeadingProps<typeof ctx.props> = $props();
|
|
18
|
+
|
|
19
|
+
let ctx = useAccordionHeading({
|
|
20
|
+
id: stateValue(() => id),
|
|
21
|
+
ref: stateValue(() => ref!),
|
|
22
|
+
level: stateValue(() => level)
|
|
23
|
+
});
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<Element bind:ref {children} {custom} {ctx} {...props} />
|
|
@@ -4,8 +4,6 @@ declare const AccordionHeading: import("svelte").Component<AccordionHeadingProps
|
|
|
4
4
|
"data-accordion-heading": string;
|
|
5
5
|
role: string;
|
|
6
6
|
'aria-level': 2 | 1 | 3 | 4 | 5 | 6;
|
|
7
|
-
}, {
|
|
8
|
-
active: boolean;
|
|
9
7
|
}>, {}, "ref">;
|
|
10
8
|
type AccordionHeading = ReturnType<typeof AccordionHeading>;
|
|
11
9
|
export default AccordionHeading;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { stateValue } from '../../internals/context.svelte.js';
|
|
3
|
-
import { Element, parseId } from '../../internals/index.js';
|
|
4
|
-
import { createAccordionItemContext } from './state.svelte.js';
|
|
5
|
-
|
|
6
|
-
import type { AccordionItemProps } from '../../types/index.js';
|
|
7
|
-
|
|
8
|
-
const uid = $props.id();
|
|
9
|
-
|
|
10
|
-
let {
|
|
11
|
-
id = parseId(uid),
|
|
12
|
-
ref = $bindable(),
|
|
13
|
-
disabled = $bindable(false),
|
|
14
|
-
value,
|
|
15
|
-
children,
|
|
16
|
-
custom,
|
|
17
|
-
...props
|
|
18
|
-
}: AccordionItemProps<typeof ctx.props
|
|
19
|
-
|
|
20
|
-
let ctx = createAccordionItemContext({
|
|
21
|
-
id: stateValue(() => id),
|
|
22
|
-
ref: stateValue(() => ref!),
|
|
23
|
-
value: stateValue(() => value),
|
|
24
|
-
disabled: stateValue(() => disabled)
|
|
25
|
-
});
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<Element bind:ref {children} {custom} {ctx} {...props} />
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { stateValue } from '../../internals/context.svelte.js';
|
|
3
|
+
import { Element, parseId } from '../../internals/index.js';
|
|
4
|
+
import { createAccordionItemContext } from './state.svelte.js';
|
|
5
|
+
|
|
6
|
+
import type { AccordionItemProps } from '../../types/index.js';
|
|
7
|
+
|
|
8
|
+
const uid = $props.id();
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
id = parseId(uid),
|
|
12
|
+
ref = $bindable(),
|
|
13
|
+
disabled = $bindable(false),
|
|
14
|
+
value,
|
|
15
|
+
children,
|
|
16
|
+
custom,
|
|
17
|
+
...props
|
|
18
|
+
}: AccordionItemProps<typeof ctx.props> = $props();
|
|
19
|
+
|
|
20
|
+
let ctx = createAccordionItemContext({
|
|
21
|
+
id: stateValue(() => id),
|
|
22
|
+
ref: stateValue(() => ref!),
|
|
23
|
+
value: stateValue(() => value),
|
|
24
|
+
disabled: stateValue(() => disabled)
|
|
25
|
+
});
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<Element bind:ref {children} {custom} {ctx} {...props} />
|
|
@@ -3,9 +3,6 @@ declare const AccordionItem: import("svelte").Component<AccordionItemProps<{
|
|
|
3
3
|
id: string;
|
|
4
4
|
"data-accordion-item": string;
|
|
5
5
|
'data-value': string;
|
|
6
|
-
}, {
|
|
7
|
-
active: boolean;
|
|
8
|
-
disabled: boolean;
|
|
9
6
|
}>, {}, "disabled" | "ref">;
|
|
10
7
|
type AccordionItem = ReturnType<typeof AccordionItem>;
|
|
11
8
|
export default AccordionItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteMap } from 'svelte/reactivity';
|
|
2
2
|
import type { GetInternalProps } from '../../internals/types.js';
|
|
3
|
-
import type { AccordionButtonProps, AccordionContentProps, AccordionHeadingProps, AccordionItemProps, AccordionProps } from '../../types/index.js';
|
|
3
|
+
import type { AccordionButtonProps, AccordionContentProps, AccordionHeadingProps, AccordionItemProps, AccordionItemState, AccordionProps, AccordionState } from '../../types/index.js';
|
|
4
4
|
type RootProps = GetInternalProps<AccordionProps>;
|
|
5
5
|
export declare class AccordionRoot {
|
|
6
6
|
$$: RootProps;
|
|
@@ -12,12 +12,7 @@ export declare class AccordionRoot {
|
|
|
12
12
|
id: string;
|
|
13
13
|
"data-accordion-root": string;
|
|
14
14
|
};
|
|
15
|
-
state:
|
|
16
|
-
/**
|
|
17
|
-
* The current value.
|
|
18
|
-
*/
|
|
19
|
-
value: string | string[];
|
|
20
|
-
};
|
|
15
|
+
state: AccordionState;
|
|
21
16
|
}
|
|
22
17
|
type ItemProps = GetInternalProps<AccordionItemProps>;
|
|
23
18
|
declare class AccordionItem {
|
|
@@ -31,16 +26,7 @@ declare class AccordionItem {
|
|
|
31
26
|
"data-accordion-item": string;
|
|
32
27
|
'data-value': string;
|
|
33
28
|
};
|
|
34
|
-
state:
|
|
35
|
-
/**
|
|
36
|
-
* True if the item is active.
|
|
37
|
-
*/
|
|
38
|
-
active: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* True the item is disabled.
|
|
41
|
-
*/
|
|
42
|
-
disabled: boolean;
|
|
43
|
-
};
|
|
29
|
+
state: AccordionItemState;
|
|
44
30
|
}
|
|
45
31
|
type HeadingProps = GetInternalProps<AccordionHeadingProps>;
|
|
46
32
|
declare class AccordionHeading {
|
|
@@ -31,9 +31,6 @@ export class AccordionRoot {
|
|
|
31
31
|
[attrs.root]: ''
|
|
32
32
|
}));
|
|
33
33
|
state = $derived.by(() => ({
|
|
34
|
-
/**
|
|
35
|
-
* The current value.
|
|
36
|
-
*/
|
|
37
34
|
value: this.$$.value.val
|
|
38
35
|
}));
|
|
39
36
|
}
|
|
@@ -53,13 +50,7 @@ class AccordionItem {
|
|
|
53
50
|
'data-value': this.$$.value.val
|
|
54
51
|
}));
|
|
55
52
|
state = $derived.by(() => ({
|
|
56
|
-
/**
|
|
57
|
-
* True if the item is active.
|
|
58
|
-
*/
|
|
59
53
|
active: this.Active,
|
|
60
|
-
/**
|
|
61
|
-
* True the item is disabled.
|
|
62
|
-
*/
|
|
63
54
|
disabled: this.$$.disabled.val
|
|
64
55
|
}));
|
|
65
56
|
}
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { stateValue } from '../../internals/context.svelte.js';
|
|
3
|
-
import { Element, parseId, styleObjectToString, visuallyHidden } from '../../internals/index.js';
|
|
4
|
-
import { useCheckboxButton } from './state.svelte.js';
|
|
5
|
-
|
|
6
|
-
import type { CheckboxButtonProps } from '../../types/index.js';
|
|
7
|
-
|
|
8
|
-
const uid = $props.id();
|
|
9
|
-
|
|
10
|
-
let {
|
|
11
|
-
id = parseId(uid),
|
|
12
|
-
ref = $bindable(),
|
|
13
|
-
checked = $bindable(false),
|
|
14
|
-
disabled = $bindable(false),
|
|
15
|
-
required,
|
|
16
|
-
name,
|
|
17
|
-
value,
|
|
18
|
-
onCheckedChange,
|
|
19
|
-
children,
|
|
20
|
-
custom,
|
|
21
|
-
...props
|
|
22
|
-
}: CheckboxButtonProps<typeof ctx.props
|
|
23
|
-
|
|
24
|
-
let ctx = useCheckboxButton({
|
|
25
|
-
id: stateValue(() => id),
|
|
26
|
-
ref: stateValue(() => ref!),
|
|
27
|
-
checked: stateValue(
|
|
28
|
-
() => checked,
|
|
29
|
-
(v) => {
|
|
30
|
-
checked = v;
|
|
31
|
-
onCheckedChange?.(v);
|
|
32
|
-
}
|
|
33
|
-
),
|
|
34
|
-
disabled: stateValue(
|
|
35
|
-
() => disabled,
|
|
36
|
-
(v) => (disabled = v)
|
|
37
|
-
),
|
|
38
|
-
value: stateValue(() => value!),
|
|
39
|
-
name: stateValue(() => name!),
|
|
40
|
-
required: stateValue(() => required!)
|
|
41
|
-
});
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
<Element bind:ref as="button" {children} {custom} {ctx} {...props} />
|
|
45
|
-
|
|
46
|
-
{#if name}
|
|
47
|
-
<input
|
|
48
|
-
type="checkbox"
|
|
49
|
-
bind:checked={ctx.CheckedBool}
|
|
50
|
-
{name}
|
|
51
|
-
{required}
|
|
52
|
-
value={value || 'on'}
|
|
53
|
-
aria-hidden="true"
|
|
54
|
-
tabindex="-1"
|
|
55
|
-
style={styleObjectToString(visuallyHidden)}
|
|
56
|
-
/>
|
|
57
|
-
{/if}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { stateValue } from '../../internals/context.svelte.js';
|
|
3
|
+
import { Element, parseId, styleObjectToString, visuallyHidden } from '../../internals/index.js';
|
|
4
|
+
import { useCheckboxButton } from './state.svelte.js';
|
|
5
|
+
|
|
6
|
+
import type { CheckboxButtonProps } from '../../types/index.js';
|
|
7
|
+
|
|
8
|
+
const uid = $props.id();
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
id = parseId(uid),
|
|
12
|
+
ref = $bindable(),
|
|
13
|
+
checked = $bindable(false),
|
|
14
|
+
disabled = $bindable(false),
|
|
15
|
+
required,
|
|
16
|
+
name,
|
|
17
|
+
value,
|
|
18
|
+
onCheckedChange,
|
|
19
|
+
children,
|
|
20
|
+
custom,
|
|
21
|
+
...props
|
|
22
|
+
}: CheckboxButtonProps<typeof ctx.props> = $props();
|
|
23
|
+
|
|
24
|
+
let ctx = useCheckboxButton({
|
|
25
|
+
id: stateValue(() => id),
|
|
26
|
+
ref: stateValue(() => ref!),
|
|
27
|
+
checked: stateValue(
|
|
28
|
+
() => checked,
|
|
29
|
+
(v) => {
|
|
30
|
+
checked = v;
|
|
31
|
+
onCheckedChange?.(v);
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
disabled: stateValue(
|
|
35
|
+
() => disabled,
|
|
36
|
+
(v) => (disabled = v)
|
|
37
|
+
),
|
|
38
|
+
value: stateValue(() => value!),
|
|
39
|
+
name: stateValue(() => name!),
|
|
40
|
+
required: stateValue(() => required!)
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<Element bind:ref as="button" {children} {custom} {ctx} {...props} />
|
|
45
|
+
|
|
46
|
+
{#if name}
|
|
47
|
+
<input
|
|
48
|
+
type="checkbox"
|
|
49
|
+
bind:checked={ctx.CheckedBool}
|
|
50
|
+
{name}
|
|
51
|
+
{required}
|
|
52
|
+
value={value || 'on'}
|
|
53
|
+
aria-hidden="true"
|
|
54
|
+
tabindex="-1"
|
|
55
|
+
style={styleObjectToString(visuallyHidden)}
|
|
56
|
+
/>
|
|
57
|
+
{/if}
|
|
@@ -8,9 +8,6 @@ declare const CheckboxButton: import("svelte").Component<CheckboxButtonProps<{
|
|
|
8
8
|
'aria-required': true | undefined;
|
|
9
9
|
'aria-labelledby': string | undefined;
|
|
10
10
|
disabled: true | undefined;
|
|
11
|
-
}, {
|
|
12
|
-
checked: import("../../types/index.js").CheckboxChecked;
|
|
13
|
-
disabled: boolean;
|
|
14
11
|
}>, {}, "disabled" | "ref" | "checked">;
|
|
15
12
|
type CheckboxButton = ReturnType<typeof CheckboxButton>;
|
|
16
13
|
export default CheckboxButton;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { stateValue } from '../../internals/context.svelte.js';
|
|
3
|
-
import { Element, parseId } from '../../internals/index.js';
|
|
4
|
-
import { createCheckboxGroupContext } from './state.svelte.js';
|
|
5
|
-
|
|
6
|
-
import type { CheckboxGroupProps } from '../../types/index.js';
|
|
7
|
-
|
|
8
|
-
const uid = $props.id();
|
|
9
|
-
|
|
10
|
-
let {
|
|
11
|
-
id = parseId(uid),
|
|
12
|
-
ref = $bindable(),
|
|
13
|
-
checked = $bindable(false),
|
|
14
|
-
disabled = $bindable(false),
|
|
15
|
-
onCheckedChange,
|
|
16
|
-
children,
|
|
17
|
-
custom,
|
|
18
|
-
...props
|
|
19
|
-
}: CheckboxGroupProps<typeof ctx.props
|
|
20
|
-
|
|
21
|
-
let ctx = createCheckboxGroupContext({
|
|
22
|
-
id: stateValue(() => id),
|
|
23
|
-
ref: stateValue(() => ref!),
|
|
24
|
-
checked: stateValue(
|
|
25
|
-
() => checked,
|
|
26
|
-
(v) => {
|
|
27
|
-
checked = v;
|
|
28
|
-
onCheckedChange?.(v);
|
|
29
|
-
}
|
|
30
|
-
),
|
|
31
|
-
disabled: stateValue(() => disabled)
|
|
32
|
-
});
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
<Element bind:ref {children} {custom} {ctx} {...props} />
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { stateValue } from '../../internals/context.svelte.js';
|
|
3
|
+
import { Element, parseId } from '../../internals/index.js';
|
|
4
|
+
import { createCheckboxGroupContext } from './state.svelte.js';
|
|
5
|
+
|
|
6
|
+
import type { CheckboxGroupProps } from '../../types/index.js';
|
|
7
|
+
|
|
8
|
+
const uid = $props.id();
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
id = parseId(uid),
|
|
12
|
+
ref = $bindable(),
|
|
13
|
+
checked = $bindable(false),
|
|
14
|
+
disabled = $bindable(false),
|
|
15
|
+
onCheckedChange,
|
|
16
|
+
children,
|
|
17
|
+
custom,
|
|
18
|
+
...props
|
|
19
|
+
}: CheckboxGroupProps<typeof ctx.props> = $props();
|
|
20
|
+
|
|
21
|
+
let ctx = createCheckboxGroupContext({
|
|
22
|
+
id: stateValue(() => id),
|
|
23
|
+
ref: stateValue(() => ref!),
|
|
24
|
+
checked: stateValue(
|
|
25
|
+
() => checked,
|
|
26
|
+
(v) => {
|
|
27
|
+
checked = v;
|
|
28
|
+
onCheckedChange?.(v);
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
disabled: stateValue(() => disabled)
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<Element bind:ref {children} {custom} {ctx} {...props} />
|