svelora 3.0.1 → 3.0.2

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