svelora 3.0.1 → 3.0.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/dist/Accordion/Accordion.svelte +66 -97
- package/dist/Alert/Alert.svelte +39 -64
- package/dist/Alert/Alert.svelte.d.ts +1 -1
- package/dist/Avatar/Avatar.svelte +35 -75
- package/dist/AvatarGroup/AvatarGroup.svelte +38 -55
- package/dist/Badge/Badge.svelte +28 -50
- package/dist/Banner/Banner.svelte +46 -41
- package/dist/Banner/Banner.svelte.d.ts +1 -1
- package/dist/Breadcrumb/Breadcrumb.svelte +32 -26
- package/dist/Button/Button.svelte +70 -138
- package/dist/Calendar/Calendar.svelte +94 -157
- package/dist/Calendar/Calendar.svelte.d.ts +1 -1
- package/dist/Card/Card.svelte +18 -31
- package/dist/Carousel/Carousel.svelte +118 -173
- package/dist/Checkbox/Checkbox.svelte +52 -97
- package/dist/CheckboxGroup/CheckboxGroup.svelte +62 -107
- package/dist/CheckboxGroup/CheckboxGroup.svelte.d.ts +1 -1
- package/dist/Chip/Chip.svelte +22 -34
- package/dist/CodeBlock/CodeBlock.svelte +42 -59
- package/dist/Collapsible/Collapsible.svelte +22 -38
- package/dist/Collapsible/Collapsible.svelte.d.ts +1 -1
- package/dist/Collapsible/CollapsibleTestWrapper.svelte +2 -5
- package/dist/Collapsible/CollapsibleTestWrapper.svelte.d.ts +1 -1
- package/dist/Command/Command.svelte +40 -77
- package/dist/Command/Command.svelte.d.ts +1 -1
- package/dist/Command/CommandTestWrapper.svelte +2 -10
- package/dist/Command/CommandTestWrapper.svelte.d.ts +1 -1
- package/dist/Container/Container.svelte +11 -14
- package/dist/ContextMenu/ContextMenu.svelte +51 -114
- package/dist/ContextMenu/ContextMenu.svelte.d.ts +1 -1
- package/dist/Drawer/Drawer.svelte +72 -110
- package/dist/Drawer/DrawerTriggerTestWrapper.svelte +1 -2
- package/dist/DropdownMenu/DropdownMenu.svelte +63 -124
- package/dist/DropdownMenu/DropdownMenu.svelte.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenuTriggerTestWrapper.svelte +2 -5
- package/dist/Editor/Editor.svelte +441 -576
- package/dist/Editor/Editor.svelte.d.ts +1 -1
- package/dist/Editor/EditorUrlPrompt.svelte +40 -53
- package/dist/Editor/SlashPopup.svelte +12 -24
- package/dist/Empty/Empty.svelte +32 -63
- package/dist/FieldGroup/FieldGroup.svelte +23 -38
- package/dist/FileUpload/FileUpload.svelte +242 -320
- package/dist/FileUpload/FileUpload.svelte.d.ts +1 -1
- package/dist/Fonts/Fonts.svelte +15 -37
- package/dist/Form/Form.svelte +112 -170
- package/dist/FormField/FormField.svelte +102 -135
- package/dist/Icon/Icon.svelte +7 -32
- package/dist/Input/Input.svelte +71 -141
- package/dist/Input/Input.svelte.d.ts +2 -2
- package/dist/Kbd/Kbd.svelte +18 -34
- package/dist/Link/Link.svelte +129 -196
- package/dist/LocaleButton/LocaleButton.svelte +165 -0
- package/dist/LocaleButton/LocaleButton.svelte.d.ts +5 -0
- package/dist/LocaleButton/index.d.ts +2 -0
- package/dist/LocaleButton/index.js +1 -0
- package/dist/LocaleButton/locale-button.types.d.ts +182 -0
- package/dist/LocaleButton/locale-button.types.js +1 -0
- package/dist/LocaleButton/locale-button.variants.d.ts +61 -0
- package/dist/LocaleButton/locale-button.variants.js +34 -0
- package/dist/Modal/Modal.svelte +52 -106
- package/dist/Modal/ModalTriggerTestWrapper.svelte +1 -2
- package/dist/Pagination/Pagination.svelte +48 -92
- package/dist/Pagination/pagination.variants.d.ts +1 -1
- package/dist/PinInput/PinInput.svelte +57 -111
- package/dist/PinInput/PinInput.svelte.d.ts +1 -1
- package/dist/Popover/Popover.svelte +28 -61
- package/dist/Popover/Popover.svelte.d.ts +1 -1
- package/dist/Progress/Progress.svelte +75 -94
- package/dist/RadioGroup/RadioGroup.svelte +54 -99
- package/dist/RadioGroup/RadioGroup.svelte.d.ts +1 -1
- package/dist/Select/Select.svelte +112 -269
- package/dist/Select/Select.svelte.d.ts +1 -1
- package/dist/SelectMenu/SelectMenu.svelte +211 -409
- package/dist/SelectMenu/SelectMenu.svelte.d.ts +1 -1
- package/dist/SelectMenu/SelectMenuFormFieldTestWrapper.svelte +3 -6
- package/dist/Separator/Separator.svelte +29 -44
- package/dist/Skeleton/Skeleton.svelte +11 -23
- package/dist/Slideover/Slideover.svelte +52 -106
- package/dist/Slideover/SlideoverTriggerTestWrapper.svelte +1 -2
- package/dist/Slider/Slider.svelte +48 -84
- package/dist/Slider/Slider.svelte.d.ts +1 -1
- package/dist/Stepper/Stepper.svelte +139 -132
- package/dist/Stepper/Stepper.svelte.d.ts +1 -1
- package/dist/Switch/Switch.svelte +62 -98
- package/dist/Table/Table.svelte +232 -283
- package/dist/Table/table.variants.d.ts +1 -1
- package/dist/Tabs/Tabs.svelte +96 -129
- package/dist/Tabs/Tabs.svelte.d.ts +1 -1
- package/dist/Textarea/Textarea.svelte +90 -173
- package/dist/Textarea/Textarea.svelte.d.ts +1 -1
- package/dist/ThemeModeButton/ThemeModeButton.svelte +16 -38
- package/dist/Timeline/Timeline.svelte +75 -54
- package/dist/Toast/Toaster.svelte +8 -25
- package/dist/Tooltip/Tooltip.svelte +34 -66
- package/dist/Tooltip/Tooltip.svelte.d.ts +1 -1
- package/dist/Tooltip/TooltipTestWrapper.svelte +2 -5
- package/dist/User/User.svelte +33 -49
- package/dist/docs/navigation.js +6 -0
- package/dist/hooks/HookContextProbe.svelte +2 -4
- package/dist/hooks/HookContextProvider.svelte +8 -6
- package/dist/hooks/HookEmitProbe.svelte +8 -11
- package/dist/i18n.d.ts +2 -0
- package/dist/i18n.js +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mcp/svelora-docs.data.json +4 -2
- package/dist/theme.css +2 -0
- package/package.json +16 -8
|
@@ -1,102 +1,57 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { CheckboxProps } from './checkbox.types.js'
|
|
3
|
-
|
|
4
|
-
export type Props = CheckboxProps
|
|
1
|
+
<script lang="ts" module>export {};
|
|
5
2
|
</script>
|
|
6
3
|
|
|
7
|
-
<script lang="ts">
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const ariaDescribedBy = $derived(
|
|
59
|
-
!formFieldContext
|
|
60
|
-
? undefined
|
|
61
|
-
: hasError
|
|
62
|
-
? `${formFieldContext.ariaId}-error`
|
|
63
|
-
: `${formFieldContext.ariaId}-description ${formFieldContext.ariaId}-help`
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
const resolvedIcon = $derived(loading ? loadingIcon : indeterminate ? indeterminateIcon : icon)
|
|
67
|
-
|
|
68
|
-
let containerRef: HTMLElement | null = null
|
|
69
|
-
|
|
70
|
-
function handleCardClick(e: MouseEvent) {
|
|
71
|
-
if (isDisabled) return
|
|
72
|
-
// Don't re-click when the event originated from the checkbox button itself
|
|
73
|
-
if ((e.target as Element).closest('button')) return
|
|
74
|
-
containerRef?.querySelector('button')?.click()
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const classes = $derived.by(() => {
|
|
78
|
-
const slots = checkboxVariants({
|
|
79
|
-
color: resolvedColor,
|
|
80
|
-
size: resolvedSize,
|
|
81
|
-
variant,
|
|
82
|
-
indicator,
|
|
83
|
-
loading,
|
|
84
|
-
required,
|
|
85
|
-
disabled: isDisabled ? true : undefined
|
|
86
|
-
})
|
|
87
|
-
return {
|
|
88
|
-
root: slots.root({ class: [config.slots.root, className, ui?.root] }),
|
|
89
|
-
base: slots.base({ class: [config.slots.base, ui?.base] }),
|
|
90
|
-
container: slots.container({ class: [config.slots.container, ui?.container] }),
|
|
91
|
-
indicator: slots.indicator({ class: [config.slots.indicator, ui?.indicator] }),
|
|
92
|
-
icon: slots.icon({ class: [config.slots.icon, ui?.icon] }),
|
|
93
|
-
wrapper: slots.wrapper({ class: [config.slots.wrapper, ui?.wrapper] }),
|
|
94
|
-
label: slots.label({ class: [config.slots.label, ui?.label] }),
|
|
95
|
-
description: slots.description({
|
|
96
|
-
class: [config.slots.description, ui?.description]
|
|
97
|
-
})
|
|
98
|
-
}
|
|
99
|
-
})
|
|
4
|
+
<script lang="ts">import { Checkbox, Label, useId } from "bits-ui";
|
|
5
|
+
import { getComponentConfig, iconsDefaults } from "../config.js";
|
|
6
|
+
import { useFormField, useFormFieldEmit } from "../hooks/useFormField.svelte.js";
|
|
7
|
+
import Icon from "../Icon/Icon.svelte";
|
|
8
|
+
import { checkboxDefaults, checkboxVariants } from "./checkbox.variants.js";
|
|
9
|
+
const config = getComponentConfig("checkbox", checkboxDefaults);
|
|
10
|
+
const icons = getComponentConfig("icons", iconsDefaults);
|
|
11
|
+
let { ref = $bindable(null), checked = $bindable(false), onCheckedChange, indeterminate = $bindable(false), onIndeterminateChange, ui, id, name, value, color = config.defaultVariants.color, size, variant = config.defaultVariants.variant, indicator = config.defaultVariants.indicator, disabled = false, required = false, loading = false, loadingIcon = icons.loading, icon = icons.check, indeterminateIcon = "lucide:minus", label, description, labelSlot, descriptionSlot, class: className, ...restProps } = $props();
|
|
12
|
+
const formFieldContext = useFormField();
|
|
13
|
+
const emit = useFormFieldEmit();
|
|
14
|
+
const hasError = $derived(formFieldContext?.error !== undefined && formFieldContext?.error !== false);
|
|
15
|
+
const resolvedSize = $derived(size ?? formFieldContext?.size ?? config.defaultVariants.size);
|
|
16
|
+
const resolvedColor = $derived(hasError ? "error" : color);
|
|
17
|
+
const autoId = useId();
|
|
18
|
+
const resolvedId = $derived(id ?? formFieldContext?.ariaId ?? autoId);
|
|
19
|
+
const resolvedName = $derived(name ?? formFieldContext?.name);
|
|
20
|
+
const isDisabled = $derived(disabled || loading);
|
|
21
|
+
const ariaDescribedBy = $derived(!formFieldContext ? undefined : hasError ? `${formFieldContext.ariaId}-error` : `${formFieldContext.ariaId}-description ${formFieldContext.ariaId}-help`);
|
|
22
|
+
const resolvedIcon = $derived(loading ? loadingIcon : indeterminate ? indeterminateIcon : icon);
|
|
23
|
+
let containerRef = null;
|
|
24
|
+
function handleCardClick(e) {
|
|
25
|
+
if (isDisabled) return;
|
|
26
|
+
// Don't re-click when the event originated from the checkbox button itself
|
|
27
|
+
if (e.target.closest("button")) return;
|
|
28
|
+
containerRef?.querySelector("button")?.click();
|
|
29
|
+
}
|
|
30
|
+
const classes = $derived.by(() => {
|
|
31
|
+
const slots = checkboxVariants({
|
|
32
|
+
color: resolvedColor,
|
|
33
|
+
size: resolvedSize,
|
|
34
|
+
variant,
|
|
35
|
+
indicator,
|
|
36
|
+
loading,
|
|
37
|
+
required,
|
|
38
|
+
disabled: isDisabled ? true : undefined
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
root: slots.root({ class: [
|
|
42
|
+
config.slots.root,
|
|
43
|
+
className,
|
|
44
|
+
ui?.root
|
|
45
|
+
] }),
|
|
46
|
+
base: slots.base({ class: [config.slots.base, ui?.base] }),
|
|
47
|
+
container: slots.container({ class: [config.slots.container, ui?.container] }),
|
|
48
|
+
indicator: slots.indicator({ class: [config.slots.indicator, ui?.indicator] }),
|
|
49
|
+
icon: slots.icon({ class: [config.slots.icon, ui?.icon] }),
|
|
50
|
+
wrapper: slots.wrapper({ class: [config.slots.wrapper, ui?.wrapper] }),
|
|
51
|
+
label: slots.label({ class: [config.slots.label, ui?.label] }),
|
|
52
|
+
description: slots.description({ class: [config.slots.description, ui?.description] })
|
|
53
|
+
};
|
|
54
|
+
});
|
|
100
55
|
</script>
|
|
101
56
|
|
|
102
57
|
<div
|
|
@@ -1,112 +1,67 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { CheckboxGroupProps } from './checkbox-group.types.js'
|
|
3
|
-
|
|
4
|
-
export type Props = CheckboxGroupProps
|
|
1
|
+
<script lang="ts" module>export {};
|
|
5
2
|
</script>
|
|
6
3
|
|
|
7
|
-
<script lang="ts">
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
size: resolvedSize,
|
|
69
|
-
variant,
|
|
70
|
-
indicator,
|
|
71
|
-
orientation,
|
|
72
|
-
loading,
|
|
73
|
-
required,
|
|
74
|
-
disabled: isDisabled ? true : undefined
|
|
75
|
-
})
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
const layoutClasses = $derived.by(() => ({
|
|
79
|
-
root: slots.root({ class: [config.slots.root, className, ui?.root] }),
|
|
80
|
-
fieldset: slots.fieldset({ class: [config.slots.fieldset, ui?.fieldset] }),
|
|
81
|
-
legend: slots.legend({ class: [config.slots.legend, ui?.legend] }),
|
|
82
|
-
item: slots.item({ class: [config.slots.item, ui?.item] }),
|
|
83
|
-
container: slots.container({ class: [config.slots.container, ui?.container] }),
|
|
84
|
-
wrapper: slots.wrapper({ class: [config.slots.wrapper, ui?.wrapper] })
|
|
85
|
-
}))
|
|
86
|
-
|
|
87
|
-
const elementClasses = $derived.by(() => ({
|
|
88
|
-
base: slots.base({ class: [config.slots.base, ui?.base] }),
|
|
89
|
-
indicator: slots.indicator({ class: [config.slots.indicator, ui?.indicator] }),
|
|
90
|
-
icon: slots.icon({ class: [config.slots.icon, ui?.icon] }),
|
|
91
|
-
label: slots.label({ class: [config.slots.label, ui?.label] }),
|
|
92
|
-
description: slots.description({ class: [config.slots.description, ui?.description] })
|
|
93
|
-
}))
|
|
94
|
-
|
|
95
|
-
function toggleItem(itemValue: string, checked: boolean) {
|
|
96
|
-
if (checked) {
|
|
97
|
-
value = [...value, itemValue]
|
|
98
|
-
} else {
|
|
99
|
-
value = value.filter((v) => v !== itemValue)
|
|
100
|
-
}
|
|
101
|
-
emit.onChange()
|
|
102
|
-
onValueChange?.(value)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function handleCardItemClick(e: MouseEvent, btnId: string, itemDisabled: boolean) {
|
|
106
|
-
if (itemDisabled) return
|
|
107
|
-
if ((e.target as Element).closest('button')) return
|
|
108
|
-
document.getElementById(btnId)?.click()
|
|
109
|
-
}
|
|
4
|
+
<script lang="ts">import { Checkbox, Label, useId } from "bits-ui";
|
|
5
|
+
import { getComponentConfig, iconsDefaults } from "../config.js";
|
|
6
|
+
import { useFormField, useFormFieldEmit } from "../hooks/useFormField.svelte.js";
|
|
7
|
+
import Icon from "../Icon/Icon.svelte";
|
|
8
|
+
import { checkboxGroupDefaults, checkboxGroupVariants } from "./checkbox-group.variants.js";
|
|
9
|
+
const config = getComponentConfig("checkboxGroup", checkboxGroupDefaults);
|
|
10
|
+
const icons = getComponentConfig("icons", iconsDefaults);
|
|
11
|
+
let { ref = $bindable(null), value = $bindable([]), onValueChange, items = [], ui, id, name, color = config.defaultVariants.color, size, variant = config.defaultVariants.variant, indicator = config.defaultVariants.indicator, orientation = config.defaultVariants.orientation, disabled = false, required = false, loading = false, loadingIcon = icons.loading, icon = icons.check, legend, legendSlot, labelSlot, descriptionSlot, class: className, ...restProps } = $props();
|
|
12
|
+
const formFieldContext = useFormField();
|
|
13
|
+
const emit = useFormFieldEmit();
|
|
14
|
+
const hasError = $derived(formFieldContext?.error !== undefined && formFieldContext?.error !== false);
|
|
15
|
+
const resolvedSize = $derived(size ?? formFieldContext?.size ?? config.defaultVariants.size);
|
|
16
|
+
const resolvedColor = $derived(hasError ? "error" : color);
|
|
17
|
+
const autoId = useId();
|
|
18
|
+
const resolvedId = $derived(id ?? formFieldContext?.ariaId ?? autoId);
|
|
19
|
+
const resolvedName = $derived(name ?? formFieldContext?.name);
|
|
20
|
+
const isDisabled = $derived(disabled || loading);
|
|
21
|
+
const ariaDescribedBy = $derived(!formFieldContext ? undefined : hasError ? `${formFieldContext.ariaId}-error` : `${formFieldContext.ariaId}-description ${formFieldContext.ariaId}-help`);
|
|
22
|
+
const slots = $derived(checkboxGroupVariants({
|
|
23
|
+
color: resolvedColor,
|
|
24
|
+
size: resolvedSize,
|
|
25
|
+
variant,
|
|
26
|
+
indicator,
|
|
27
|
+
orientation,
|
|
28
|
+
loading,
|
|
29
|
+
required,
|
|
30
|
+
disabled: isDisabled ? true : undefined
|
|
31
|
+
}));
|
|
32
|
+
const layoutClasses = $derived.by(() => ({
|
|
33
|
+
root: slots.root({ class: [
|
|
34
|
+
config.slots.root,
|
|
35
|
+
className,
|
|
36
|
+
ui?.root
|
|
37
|
+
] }),
|
|
38
|
+
fieldset: slots.fieldset({ class: [config.slots.fieldset, ui?.fieldset] }),
|
|
39
|
+
legend: slots.legend({ class: [config.slots.legend, ui?.legend] }),
|
|
40
|
+
item: slots.item({ class: [config.slots.item, ui?.item] }),
|
|
41
|
+
container: slots.container({ class: [config.slots.container, ui?.container] }),
|
|
42
|
+
wrapper: slots.wrapper({ class: [config.slots.wrapper, ui?.wrapper] })
|
|
43
|
+
}));
|
|
44
|
+
const elementClasses = $derived.by(() => ({
|
|
45
|
+
base: slots.base({ class: [config.slots.base, ui?.base] }),
|
|
46
|
+
indicator: slots.indicator({ class: [config.slots.indicator, ui?.indicator] }),
|
|
47
|
+
icon: slots.icon({ class: [config.slots.icon, ui?.icon] }),
|
|
48
|
+
label: slots.label({ class: [config.slots.label, ui?.label] }),
|
|
49
|
+
description: slots.description({ class: [config.slots.description, ui?.description] })
|
|
50
|
+
}));
|
|
51
|
+
function toggleItem(itemValue, checked) {
|
|
52
|
+
if (checked) {
|
|
53
|
+
value = [...value, itemValue];
|
|
54
|
+
} else {
|
|
55
|
+
value = value.filter((v) => v !== itemValue);
|
|
56
|
+
}
|
|
57
|
+
emit.onChange();
|
|
58
|
+
onValueChange?.(value);
|
|
59
|
+
}
|
|
60
|
+
function handleCardItemClick(e, btnId, itemDisabled) {
|
|
61
|
+
if (itemDisabled) return;
|
|
62
|
+
if (e.target.closest("button")) return;
|
|
63
|
+
document.getElementById(btnId)?.click();
|
|
64
|
+
}
|
|
110
65
|
</script>
|
|
111
66
|
|
|
112
67
|
{#snippet itemContent(checkboxItem: CheckboxGroupItem)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CheckboxGroupProps } from './checkbox-group.types.js';
|
|
2
2
|
export type Props = CheckboxGroupProps;
|
|
3
|
-
declare const CheckboxGroup: import("svelte").Component<CheckboxGroupProps, {}, "
|
|
3
|
+
declare const CheckboxGroup: import("svelte").Component<CheckboxGroupProps, {}, "ref" | "value">;
|
|
4
4
|
type CheckboxGroup = ReturnType<typeof CheckboxGroup>;
|
|
5
5
|
export default CheckboxGroup;
|
package/dist/Chip/Chip.svelte
CHANGED
|
@@ -1,39 +1,27 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { ChipProps } from './chip.types.js'
|
|
3
|
-
|
|
4
|
-
export type Props = ChipProps
|
|
1
|
+
<script lang="ts" module>export {};
|
|
5
2
|
</script>
|
|
6
3
|
|
|
7
|
-
<script lang="ts">
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}: Props = $props()
|
|
29
|
-
|
|
30
|
-
const classes = $derived.by(() => {
|
|
31
|
-
const slots = chipVariants({ color, size, position, inset, standalone })
|
|
32
|
-
return {
|
|
33
|
-
root: slots.root({ class: [config.slots.root, className, ui?.root] }),
|
|
34
|
-
base: slots.base({ class: [config.slots.base, ui?.base] })
|
|
35
|
-
}
|
|
36
|
-
})
|
|
4
|
+
<script lang="ts">import { getComponentConfig } from "../config.js";
|
|
5
|
+
import { chipDefaults, chipVariants } from "./chip.variants.js";
|
|
6
|
+
const config = getComponentConfig("chip", chipDefaults);
|
|
7
|
+
let { ref = $bindable(null), as = "div", ui, text, color = config.defaultVariants.color, size = config.defaultVariants.size, position = config.defaultVariants.position, inset = false, standalone = false, show = $bindable(true), class: className, children, content, ...restProps } = $props();
|
|
8
|
+
const classes = $derived.by(() => {
|
|
9
|
+
const slots = chipVariants({
|
|
10
|
+
color,
|
|
11
|
+
size,
|
|
12
|
+
position,
|
|
13
|
+
inset,
|
|
14
|
+
standalone
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
root: slots.root({ class: [
|
|
18
|
+
config.slots.root,
|
|
19
|
+
className,
|
|
20
|
+
ui?.root
|
|
21
|
+
] }),
|
|
22
|
+
base: slots.base({ class: [config.slots.base, ui?.base] })
|
|
23
|
+
};
|
|
24
|
+
});
|
|
37
25
|
</script>
|
|
38
26
|
|
|
39
27
|
<svelte:element this={as} bind:this={ref} class={classes.root} {...restProps}>
|
|
@@ -1,64 +1,47 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { CodeBlockProps } from './code-block.types.js'
|
|
3
|
-
|
|
4
|
-
export type Props = CodeBlockProps
|
|
1
|
+
<script lang="ts" module>export {};
|
|
5
2
|
</script>
|
|
6
3
|
|
|
7
|
-
<script lang="ts">
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
async function handleCopy(): Promise<void> {
|
|
49
|
-
if (!canCopy) return
|
|
50
|
-
if (typeof navigator === 'undefined' || !navigator.clipboard) return
|
|
51
|
-
|
|
52
|
-
const resetLabel = copyLabel
|
|
53
|
-
try {
|
|
54
|
-
await navigator.clipboard.writeText(resolvedCopyText)
|
|
55
|
-
copyLabel = 'Copied'
|
|
56
|
-
} catch {
|
|
57
|
-
copyLabel = 'Failed'
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
scheduleLabelReset(resetLabel)
|
|
61
|
-
}
|
|
4
|
+
<script lang="ts">import { getComponentConfig } from "../config.js";
|
|
5
|
+
import { codeBlockDefaults, codeBlockVariants } from "./code-block.variants.js";
|
|
6
|
+
const config = getComponentConfig("codeBlock", codeBlockDefaults);
|
|
7
|
+
let { title = "Code", code = "", copyText, copyable = true, html, variant = config.defaultVariants.variant, size = config.defaultVariants.size, class: className, ui, children } = $props();
|
|
8
|
+
let copyLabel = $state("Copy");
|
|
9
|
+
const resolvedCopyText = $derived((copyText ?? code).trim());
|
|
10
|
+
const canCopy = $derived(copyable && resolvedCopyText.length > 0);
|
|
11
|
+
const classes = $derived.by(() => {
|
|
12
|
+
const slots = codeBlockVariants({
|
|
13
|
+
variant,
|
|
14
|
+
size
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
root: slots.root({ class: [
|
|
18
|
+
config.slots.root,
|
|
19
|
+
className,
|
|
20
|
+
ui?.root
|
|
21
|
+
] }),
|
|
22
|
+
header: slots.header({ class: [config.slots.header, ui?.header] }),
|
|
23
|
+
title: slots.title({ class: [config.slots.title, ui?.title] }),
|
|
24
|
+
button: slots.button({ class: [config.slots.button, ui?.button] }),
|
|
25
|
+
body: slots.body({ class: [config.slots.body, ui?.body] })
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
function scheduleLabelReset(resetLabel) {
|
|
29
|
+
window.setTimeout(() => {
|
|
30
|
+
copyLabel = resetLabel;
|
|
31
|
+
}, 1200);
|
|
32
|
+
}
|
|
33
|
+
async function handleCopy() {
|
|
34
|
+
if (!canCopy) return;
|
|
35
|
+
if (typeof navigator === "undefined" || !navigator.clipboard) return;
|
|
36
|
+
const resetLabel = copyLabel;
|
|
37
|
+
try {
|
|
38
|
+
await navigator.clipboard.writeText(resolvedCopyText);
|
|
39
|
+
copyLabel = "Copied";
|
|
40
|
+
} catch {
|
|
41
|
+
copyLabel = "Failed";
|
|
42
|
+
}
|
|
43
|
+
scheduleLabelReset(resetLabel);
|
|
44
|
+
}
|
|
62
45
|
</script>
|
|
63
46
|
|
|
64
47
|
<div class={classes.root}>
|
|
@@ -1,43 +1,27 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { CollapsibleProps } from './collapsible.types.js'
|
|
3
|
-
|
|
4
|
-
export type Props = CollapsibleProps
|
|
1
|
+
<script lang="ts" module>export {};
|
|
5
2
|
</script>
|
|
6
3
|
|
|
7
|
-
<script lang="ts">
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const slots = $derived(collapsibleVariants({ disabled }))
|
|
29
|
-
const classes = $derived.by(() => {
|
|
30
|
-
const u = ui ?? {}
|
|
31
|
-
return {
|
|
32
|
-
root: slots.root({ class: [config.slots.root, className, u.root] }),
|
|
33
|
-
content: slots.content({ class: [config.slots.content, u.content] })
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
function handleOpenChange(value: boolean) {
|
|
38
|
-
open = value
|
|
39
|
-
onOpenChange?.(value)
|
|
40
|
-
}
|
|
4
|
+
<script lang="ts">import { Collapsible } from "bits-ui";
|
|
5
|
+
import { getComponentConfig } from "../config.js";
|
|
6
|
+
import { collapsibleDefaults, collapsibleVariants } from "./collapsible.variants.js";
|
|
7
|
+
const config = getComponentConfig("collapsible", collapsibleDefaults);
|
|
8
|
+
let { ref = $bindable(null), open = $bindable(false), onOpenChange, onOpenChangeComplete, disabled = false, trigger: triggerSlot, content: contentSlot, children, ui, class: className, ...restProps } = $props();
|
|
9
|
+
const slots = $derived(collapsibleVariants({ disabled }));
|
|
10
|
+
const classes = $derived.by(() => {
|
|
11
|
+
const u = ui ?? {};
|
|
12
|
+
return {
|
|
13
|
+
root: slots.root({ class: [
|
|
14
|
+
config.slots.root,
|
|
15
|
+
className,
|
|
16
|
+
u.root
|
|
17
|
+
] }),
|
|
18
|
+
content: slots.content({ class: [config.slots.content, u.content] })
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
function handleOpenChange(value) {
|
|
22
|
+
open = value;
|
|
23
|
+
onOpenChange?.(value);
|
|
24
|
+
}
|
|
41
25
|
</script>
|
|
42
26
|
|
|
43
27
|
<Collapsible.Root
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CollapsibleProps } from './collapsible.types.js';
|
|
2
2
|
export type Props = CollapsibleProps;
|
|
3
3
|
import { Collapsible } from 'bits-ui';
|
|
4
|
-
declare const Collapsible: import("svelte").Component<CollapsibleProps, {}, "
|
|
4
|
+
declare const Collapsible: import("svelte").Component<CollapsibleProps, {}, "open" | "ref">;
|
|
5
5
|
type Collapsible = ReturnType<typeof Collapsible>;
|
|
6
6
|
export default Collapsible;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
import type { CollapsibleProps } from './collapsible.types.js'
|
|
4
|
-
|
|
5
|
-
let { ...props }: Omit<CollapsibleProps, 'trigger' | 'content' | 'children'> = $props()
|
|
1
|
+
<script lang="ts">import Collapsible from "./Collapsible.svelte";
|
|
2
|
+
let { ...props } = $props();
|
|
6
3
|
</script>
|
|
7
4
|
|
|
8
5
|
<Collapsible {...props}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CollapsibleProps } from './collapsible.types.js';
|
|
2
|
-
declare const CollapsibleTestWrapper: import("svelte").Component<Omit<CollapsibleProps, "
|
|
2
|
+
declare const CollapsibleTestWrapper: import("svelte").Component<Omit<CollapsibleProps, "children" | "content" | "trigger">, {}, "">;
|
|
3
3
|
type CollapsibleTestWrapper = ReturnType<typeof CollapsibleTestWrapper>;
|
|
4
4
|
export default CollapsibleTestWrapper;
|