lithesome 0.23.2 → 0.23.3
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/AccordionButton.svelte +20 -20
- package/dist/components/accordion/AccordionContent.svelte +20 -20
- package/dist/components/accordion/AccordionHeading.svelte +26 -26
- package/dist/components/accordion/AccordionItem.svelte +28 -28
- package/dist/components/checkbox/CheckboxButton.svelte +57 -57
- package/dist/components/checkbox/CheckboxGroup.svelte +35 -35
- package/dist/components/checkbox/CheckboxLabel.svelte +24 -24
- package/dist/components/dropzone/Dropzone.svelte +48 -48
- package/dist/components/dropzone/DropzoneInput.svelte +24 -24
- package/dist/components/hovercard/Hovercard.svelte +38 -38
- package/dist/components/hovercard/HovercardArrow.svelte +23 -23
- package/dist/components/hovercard/HovercardContent.svelte +23 -23
- package/dist/components/hovercard/HovercardTrigger.svelte +23 -23
- package/dist/components/menu/Menu.svelte +36 -36
- package/dist/components/menu/MenuArrow.svelte +17 -17
- package/dist/components/menu/MenuContent.svelte +23 -23
- package/dist/components/menu/MenuItem.svelte +28 -28
- package/dist/components/menu/MenuSub.svelte +38 -38
- package/dist/components/menu/MenuSubContent.svelte +23 -23
- package/dist/components/menu/MenuSubTrigger.svelte +23 -23
- package/dist/components/menu/MenuTrigger.svelte +23 -23
- package/dist/components/modal/Modal.svelte +31 -31
- package/dist/components/modal/ModalBackdrop.svelte +24 -24
- package/dist/components/modal/ModalContent.svelte +24 -24
- package/dist/components/modal/ModalDescription.svelte +24 -24
- package/dist/components/modal/ModalTitle.svelte +24 -24
- package/dist/components/modal/ModalTrigger.svelte +24 -24
- package/dist/components/pin/Pin.svelte +41 -41
- package/dist/components/pin/PinInput.svelte +17 -17
- package/dist/components/radiogroup/RadioGroup.svelte +35 -35
- package/dist/components/radiogroup/RadioGroupItem.svelte +28 -28
- package/dist/components/select/Select.svelte +47 -47
- package/dist/components/select/SelectArrow.svelte +23 -23
- package/dist/components/select/SelectContent.svelte +23 -23
- package/dist/components/select/SelectOption.svelte +29 -29
- package/dist/components/select/SelectTrigger.svelte +23 -23
- package/dist/components/select/SelectValue.svelte +25 -25
- package/dist/components/slider/Slider.svelte +45 -45
- package/dist/components/slider/SliderRange.svelte +17 -17
- package/dist/components/slider/SliderThumb.svelte +17 -17
- package/dist/components/slider/SliderValue.svelte +17 -17
- package/dist/components/stepper/Stepper.svelte +37 -37
- package/dist/components/stepper/StepperItem.svelte +27 -27
- package/dist/components/stepper/StepperLink.svelte +30 -30
- package/dist/components/stepper/StepperNext.svelte +26 -26
- package/dist/components/stepper/StepperPrev.svelte +26 -26
- package/dist/components/stepper/StepperSteps.svelte +23 -23
- package/dist/components/tabs/Tabs.svelte +31 -31
- package/dist/components/tabs/TabsButton.svelte +30 -30
- package/dist/components/tabs/TabsContent.svelte +25 -25
- package/dist/components/tabs/TabsList.svelte +17 -17
- package/dist/components/tags/Tags.svelte +37 -37
- package/dist/components/tags/TagsDelete.svelte +26 -26
- package/dist/components/tags/TagsInput.svelte +17 -17
- package/dist/components/tags/TagsItem.svelte +26 -26
- package/dist/components/tooltip/Tooltip.svelte +38 -38
- package/dist/components/tooltip/TooltipArrow.svelte +23 -23
- package/dist/components/tooltip/TooltipContent.svelte +23 -23
- package/dist/components/tooltip/TooltipTrigger.svelte +23 -23
- package/dist/internals/components/Element.svelte +78 -78
- package/package.json +75 -75
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> = $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} />
|
|
@@ -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> = $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} />
|
|
@@ -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> = $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} />
|
|
@@ -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> = $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} />
|
|
@@ -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> = $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} />
|
|
@@ -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> = $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}
|
|
@@ -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> = $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} />
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { stateValue } from '../../internals/context.svelte.js';
|
|
3
|
-
import { Element, parseId } from '../../internals/index.js';
|
|
4
|
-
import { useCheckboxLabel } from './state.svelte.js';
|
|
5
|
-
|
|
6
|
-
import type { CheckboxLabelProps } from '../../types/index.js';
|
|
7
|
-
|
|
8
|
-
const uid = $props.id();
|
|
9
|
-
|
|
10
|
-
let {
|
|
11
|
-
id = parseId(uid),
|
|
12
|
-
ref = $bindable(),
|
|
13
|
-
children,
|
|
14
|
-
custom,
|
|
15
|
-
...props
|
|
16
|
-
}: CheckboxLabelProps<typeof ctx.props> = $props();
|
|
17
|
-
|
|
18
|
-
let ctx = useCheckboxLabel({
|
|
19
|
-
id: stateValue(() => id),
|
|
20
|
-
ref: stateValue(() => ref!)
|
|
21
|
-
});
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<Element bind:ref as="label" {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 { useCheckboxLabel } from './state.svelte.js';
|
|
5
|
+
|
|
6
|
+
import type { CheckboxLabelProps } from '../../types/index.js';
|
|
7
|
+
|
|
8
|
+
const uid = $props.id();
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
id = parseId(uid),
|
|
12
|
+
ref = $bindable(),
|
|
13
|
+
children,
|
|
14
|
+
custom,
|
|
15
|
+
...props
|
|
16
|
+
}: CheckboxLabelProps<typeof ctx.props> = $props();
|
|
17
|
+
|
|
18
|
+
let ctx = useCheckboxLabel({
|
|
19
|
+
id: stateValue(() => id),
|
|
20
|
+
ref: stateValue(() => ref!)
|
|
21
|
+
});
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Element bind:ref as="label" {children} {custom} {ctx} {...props} />
|