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.
Files changed (108) 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/dist/theme.css +2 -0
  108. package/package.json +16 -8
@@ -1,57 +1,62 @@
1
- <script lang="ts" module>import type { BannerProps } from './banner.types.js';
2
- export type Props = BannerProps;
1
+ <script lang="ts" module>export {};
3
2
  </script>
4
3
 
5
- <script lang="ts">import { useId } from 'bits-ui';
6
- import Button from '../Button/Button.svelte';
7
- import { getComponentConfig, iconsDefaults } from '../config.js';
8
- import Icon from '../Icon/Icon.svelte';
9
- import { bannerDefaults, bannerVariants } from './banner.variants.js';
10
-
11
- const config = getComponentConfig('banner', bannerDefaults);
12
- const icons = getComponentConfig('icons', iconsDefaults);
13
- let { ref = $bindable(null), as = 'div', id, title, icon, color = config.defaultVariants.color, to, target, close = false, closeIcon, actions, open = $bindable(true), onClose, class: className, ui, leading, titleSlot, actionsSlot, closeSlot, ...restProps }: Props = $props();
14
- const fallbackId = useId('banner-');
4
+ <script lang="ts">import { useId } from "bits-ui";
5
+ import Button from "../Button/Button.svelte";
6
+ import { getComponentConfig, iconsDefaults } from "../config.js";
7
+ import Icon from "../Icon/Icon.svelte";
8
+ import { bannerDefaults, bannerVariants } from "./banner.variants.js";
9
+ const config = getComponentConfig("banner", bannerDefaults);
10
+ const icons = getComponentConfig("icons", iconsDefaults);
11
+ let { ref = $bindable(null), as = "div", id, title, icon, color = config.defaultVariants.color, to, target, close = false, closeIcon, actions, open = $bindable(true), onClose, class: className, ui, leading, titleSlot, actionsSlot, closeSlot, ...restProps } = $props();
12
+ const fallbackId = useId("banner-");
15
13
  const effectiveId = $derived(id ?? fallbackId);
16
14
  let dismissed = $state(false);
17
- function storageKey(rawId: string) {
18
- return `ps-banner-${rawId.replace(/[^\w-]/g, '-')}`;
15
+ function storageKey(rawId) {
16
+ return `ps-banner-${rawId.replace(/[^\w-]/g, "-")}`;
19
17
  }
20
18
  $effect(() => {
21
- void open;
22
- if (!id || typeof window === 'undefined') {
23
- dismissed = false;
24
- return;
25
- }
26
- dismissed = localStorage.getItem(storageKey(id)) === '1';
19
+ void open;
20
+ if (!id || typeof window === "undefined") {
21
+ dismissed = false;
22
+ return;
23
+ }
24
+ dismissed = localStorage.getItem(storageKey(id)) === "1";
27
25
  });
28
26
  const visible = $derived(open && !dismissed);
29
27
  const isClickable = $derived(!!to);
30
28
  const resolvedCloseIcon = $derived(closeIcon ?? icons.close);
31
29
  const closeButtonProps = $derived(!close ? null : close === true ? {} : close);
32
30
  const classes = $derived.by(() => {
33
- const slots = bannerVariants({ color, to: isClickable });
34
- const c = config.slots;
35
- const u = ui ?? {};
36
- return {
37
- root: slots.root({ class: [c.root, className, u.root] }),
38
- container: slots.container({ class: [c.container, u.container] }),
39
- left: slots.left({ class: [c.left, u.left] }),
40
- center: slots.center({ class: [c.center, u.center] }),
41
- right: slots.right({ class: [c.right, u.right] }),
42
- icon: slots.icon({ class: [c.icon, u.icon] }),
43
- title: slots.title({ class: [c.title, u.title] }),
44
- actions: slots.actions({ class: [c.actions, u.actions] }),
45
- close: slots.close({ class: [c.close, u.close] })
46
- };
31
+ const slots = bannerVariants({
32
+ color,
33
+ to: isClickable
34
+ });
35
+ const c = config.slots;
36
+ const u = ui ?? {};
37
+ return {
38
+ root: slots.root({ class: [
39
+ c.root,
40
+ className,
41
+ u.root
42
+ ] }),
43
+ container: slots.container({ class: [c.container, u.container] }),
44
+ left: slots.left({ class: [c.left, u.left] }),
45
+ center: slots.center({ class: [c.center, u.center] }),
46
+ right: slots.right({ class: [c.right, u.right] }),
47
+ icon: slots.icon({ class: [c.icon, u.icon] }),
48
+ title: slots.title({ class: [c.title, u.title] }),
49
+ actions: slots.actions({ class: [c.actions, u.actions] }),
50
+ close: slots.close({ class: [c.close, u.close] })
51
+ };
47
52
  });
48
- function handleClose(event: Event | undefined) {
49
- event?.stopPropagation();
50
- if (id && typeof window !== 'undefined') {
51
- localStorage.setItem(storageKey(id), '1');
52
- }
53
- open = false;
54
- onClose?.();
53
+ function handleClose(event) {
54
+ event?.stopPropagation();
55
+ if (id && typeof window !== "undefined") {
56
+ localStorage.setItem(storageKey(id), "1");
57
+ }
58
+ open = false;
59
+ onClose?.();
55
60
  }
56
61
  </script>
57
62
 
@@ -1,5 +1,5 @@
1
1
  import type { BannerProps } from './banner.types.js';
2
2
  export type Props = BannerProps;
3
- declare const Banner: import("svelte").Component<BannerProps, {}, "ref" | "open">;
3
+ declare const Banner: import("svelte").Component<BannerProps, {}, "open" | "ref">;
4
4
  type Banner = ReturnType<typeof Banner>;
5
5
  export default Banner;
@@ -1,34 +1,40 @@
1
- <script lang="ts" module>import type { BreadcrumbProps } from './breadcrumb.types.js';
2
- export type Props = BreadcrumbProps;
1
+ <script lang="ts" module>export {};
3
2
  </script>
4
3
 
5
- <script lang="ts">import type { ClassNameValue } from 'tailwind-merge';
6
- import { getComponentConfig } from '../config.js';
7
- import Icon from '../Icon/Icon.svelte';
8
- import Link from '../Link/Link.svelte';
9
- import { breadcrumbDefaults, breadcrumbVariants } from './breadcrumb.variants.js';
10
-
11
- const config = getComponentConfig('breadcrumb', breadcrumbDefaults);
12
- let { ref = $bindable(null), as = 'nav', items, separatorIcon = 'lucide:chevron-right', class: className, ui, item: itemSnippet, separator: separatorSnippet, ...restProps }: Props = $props();
4
+ <script lang="ts">import { getComponentConfig } from "../config.js";
5
+ import Icon from "../Icon/Icon.svelte";
6
+ import Link from "../Link/Link.svelte";
7
+ import { breadcrumbDefaults, breadcrumbVariants } from "./breadcrumb.variants.js";
8
+ const config = getComponentConfig("breadcrumb", breadcrumbDefaults);
9
+ let { ref = $bindable(null), as = "nav", items, separatorIcon = "lucide:chevron-right", class: className, ui, item: itemSnippet, separator: separatorSnippet, ...restProps } = $props();
13
10
  const variantSlots = $derived(breadcrumbVariants(config.defaultVariants));
14
11
  const classes = $derived({
15
- root: variantSlots.root({ class: [config.slots.root, className, ui?.root] }),
16
- list: variantSlots.list({ class: [config.slots.list, ui?.list] }),
17
- separator: variantSlots.separator({ class: [config.slots.separator, ui?.separator] }),
18
- separatorIcon: variantSlots.separatorIcon({
19
- class: [config.slots.separatorIcon, ui?.separatorIcon]
20
- })
12
+ root: variantSlots.root({ class: [
13
+ config.slots.root,
14
+ className,
15
+ ui?.root
16
+ ] }),
17
+ list: variantSlots.list({ class: [config.slots.list, ui?.list] }),
18
+ separator: variantSlots.separator({ class: [config.slots.separator, ui?.separator] }),
19
+ separatorIcon: variantSlots.separatorIcon({ class: [config.slots.separatorIcon, ui?.separatorIcon] })
21
20
  });
22
- function getLinkClasses(active: boolean, disabled: boolean, to: boolean, itemClass: ClassNameValue | undefined) {
23
- const slots = breadcrumbVariants({ ...config.defaultVariants, active, disabled, to });
24
- return {
25
- item: slots.item({ class: [config.slots.item, ui?.item] }),
26
- link: slots.link({ class: [config.slots.link, itemClass, ui?.link] }),
27
- linkLeadingIcon: slots.linkLeadingIcon({
28
- class: [config.slots.linkLeadingIcon, ui?.linkLeadingIcon]
29
- }),
30
- linkLabel: slots.linkLabel({ class: [config.slots.linkLabel, ui?.linkLabel] })
31
- };
21
+ function getLinkClasses(active, disabled, to, itemClass) {
22
+ const slots = breadcrumbVariants({
23
+ ...config.defaultVariants,
24
+ active,
25
+ disabled,
26
+ to
27
+ });
28
+ return {
29
+ item: slots.item({ class: [config.slots.item, ui?.item] }),
30
+ link: slots.link({ class: [
31
+ config.slots.link,
32
+ itemClass,
33
+ ui?.link
34
+ ] }),
35
+ linkLeadingIcon: slots.linkLeadingIcon({ class: [config.slots.linkLeadingIcon, ui?.linkLeadingIcon] }),
36
+ linkLabel: slots.linkLabel({ class: [config.slots.linkLabel, ui?.linkLabel] })
37
+ };
32
38
  }
33
39
  </script>
34
40
 
@@ -1,143 +1,75 @@
1
- <script lang="ts" module>
2
- import type { ButtonProps } from './button.types.js'
3
-
4
- export type Props = ButtonProps
1
+ <script lang="ts" module>export {};
5
2
  </script>
6
3
 
7
- <script lang="ts">
8
- import { getContext } from 'svelte'
9
- import Avatar from '../Avatar/Avatar.svelte'
10
- import type { AvatarSize } from '../Avatar/avatar.types.js'
11
- import { getComponentConfig, iconsDefaults } from '../config.js'
12
- import type { FieldGroupVariantProps } from '../FieldGroup/field-group.variants.js'
13
- import { fieldGroupVariant } from '../FieldGroup/field-group.variants.js'
14
- import Icon from '../Icon/Icon.svelte'
15
- import Link from '../Link/Link.svelte'
16
- import { buttonDefaults, buttonVariants } from './button.variants.js'
17
-
18
- const config = getComponentConfig('button', buttonDefaults)
19
- const icons = getComponentConfig('icons', iconsDefaults)
20
-
21
- let {
22
- ref = $bindable(null),
23
- ui,
24
- color = config.defaultVariants.color,
25
- variant = config.defaultVariants.variant,
26
- size,
27
- label,
28
- loading = false,
29
- loadingAuto = false,
30
- loadingIcon = icons.loading,
31
- disabled = false,
32
- block = false,
33
- square = false,
34
- icon,
35
- leadingIcon,
36
- trailingIcon,
37
- trailing = false,
38
- avatar,
39
- href,
40
- type,
41
- external,
42
- active,
43
- exact = false,
44
- activeColor,
45
- activeVariant,
46
- activeClass,
47
- inactiveClass,
48
- leadingSlot,
49
- trailingSlot,
50
- children,
51
- class: className,
52
- onclick,
53
- ...restProps
54
- }: Props = $props()
55
-
56
- const fieldGroupContext = getContext<
57
- | {
58
- orientation: NonNullable<FieldGroupVariantProps['orientation']>
59
- size: NonNullable<FieldGroupVariantProps['size']>
60
- }
61
- | undefined
62
- >('fieldGroup')
63
-
64
- const resolvedSize = $derived(size ?? fieldGroupContext?.size ?? config.defaultVariants.size)
65
- const fieldGroupClass = $derived(
66
- fieldGroupContext
67
- ? fieldGroupVariant.fieldGroup[fieldGroupContext.orientation ?? 'horizontal']
68
- : undefined
69
- )
70
-
71
- let autoLoading = $state(false)
72
- let pendingPromise: Promise<unknown> | null = null
73
- const isLoading = $derived(loading || autoLoading)
74
-
75
- const isIconOnly = $derived(square || (!label && !children))
76
- const isLeading = $derived((!!icon && !trailing) || (isLoading && !trailing) || !!leadingIcon)
77
- const isTrailing = $derived((!!icon && trailing) || (isLoading && trailing) || !!trailingIcon)
78
-
79
- const spinLeading = $derived(isLoading && !trailing)
80
- const spinTrailing = $derived(isLoading && trailing)
81
-
82
- const leadingIconName = $derived(
83
- spinLeading ? loadingIcon : leadingIcon || (!trailing ? icon : undefined)
84
- )
85
- const trailingIconName = $derived(
86
- spinTrailing ? loadingIcon : trailingIcon || (trailing ? icon : undefined)
87
- )
88
-
89
- const resolvedColor = $derived(active && activeColor ? activeColor : color)
90
- const resolvedVariant = $derived(active && activeVariant ? activeVariant : variant)
91
-
92
- const classes = $derived.by(() => {
93
- const slots = buttonVariants({
94
- variant: resolvedVariant,
95
- color: resolvedColor,
96
- size: resolvedSize,
97
- block,
98
- square: isIconOnly,
99
- loading: isLoading,
100
- leading: spinLeading,
101
- trailing: spinTrailing
102
- })
103
- return {
104
- base: slots.base({ class: [config.slots.base, fieldGroupClass, className, ui?.base] }),
105
- label: slots.label({ class: [config.slots.label, ui?.label] }),
106
- leadingIcon: slots.leadingIcon({ class: [config.slots.leadingIcon, ui?.leadingIcon] }),
107
- trailingIcon: slots.trailingIcon({
108
- class: [config.slots.trailingIcon, ui?.trailingIcon]
109
- }),
110
- leadingAvatar: slots.leadingAvatar({
111
- class: [config.slots.leadingAvatar, ui?.leadingAvatar]
112
- }),
113
- leadingAvatarSize: slots.leadingAvatarSize() as AvatarSize
114
- }
115
- })
116
-
117
- function handleClick(e: MouseEvent) {
118
- if (disabled || isLoading) {
119
- e.preventDefault()
120
- e.stopPropagation()
121
- return
122
- }
123
-
124
- if (typeof onclick === 'function') {
125
- const result = (onclick as (e: MouseEvent) => unknown)(e)
126
-
127
- if (loadingAuto && result instanceof Promise) {
128
- autoLoading = true
129
- pendingPromise = result
130
- result.then(
131
- () => {
132
- if (pendingPromise === result) autoLoading = false
133
- },
134
- () => {
135
- if (pendingPromise === result) autoLoading = false
136
- }
137
- )
138
- }
139
- }
140
- }
4
+ <script lang="ts">import { getContext } from "svelte";
5
+ import Avatar from "../Avatar/Avatar.svelte";
6
+ import { getComponentConfig, iconsDefaults } from "../config.js";
7
+ import { fieldGroupVariant } from "../FieldGroup/field-group.variants.js";
8
+ import Icon from "../Icon/Icon.svelte";
9
+ import Link from "../Link/Link.svelte";
10
+ import { buttonDefaults, buttonVariants } from "./button.variants.js";
11
+ const config = getComponentConfig("button", buttonDefaults);
12
+ const icons = getComponentConfig("icons", iconsDefaults);
13
+ let { ref = $bindable(null), ui, color = config.defaultVariants.color, variant = config.defaultVariants.variant, size, label, loading = false, loadingAuto = false, loadingIcon = icons.loading, disabled = false, block = false, square = false, icon, leadingIcon, trailingIcon, trailing = false, avatar, href, type, external, active, exact = false, activeColor, activeVariant, activeClass, inactiveClass, leadingSlot, trailingSlot, children, class: className, onclick, ...restProps } = $props();
14
+ const fieldGroupContext = getContext("fieldGroup");
15
+ const resolvedSize = $derived(size ?? fieldGroupContext?.size ?? config.defaultVariants.size);
16
+ const fieldGroupClass = $derived(fieldGroupContext ? fieldGroupVariant.fieldGroup[fieldGroupContext.orientation ?? "horizontal"] : undefined);
17
+ let autoLoading = $state(false);
18
+ let pendingPromise = null;
19
+ const isLoading = $derived(loading || autoLoading);
20
+ const isIconOnly = $derived(square || !label && !children);
21
+ const isLeading = $derived(!!icon && !trailing || isLoading && !trailing || !!leadingIcon);
22
+ const isTrailing = $derived(!!icon && trailing || isLoading && trailing || !!trailingIcon);
23
+ const spinLeading = $derived(isLoading && !trailing);
24
+ const spinTrailing = $derived(isLoading && trailing);
25
+ const leadingIconName = $derived(spinLeading ? loadingIcon : leadingIcon || (!trailing ? icon : undefined));
26
+ const trailingIconName = $derived(spinTrailing ? loadingIcon : trailingIcon || (trailing ? icon : undefined));
27
+ const resolvedColor = $derived(active && activeColor ? activeColor : color);
28
+ const resolvedVariant = $derived(active && activeVariant ? activeVariant : variant);
29
+ const classes = $derived.by(() => {
30
+ const slots = buttonVariants({
31
+ variant: resolvedVariant,
32
+ color: resolvedColor,
33
+ size: resolvedSize,
34
+ block,
35
+ square: isIconOnly,
36
+ loading: isLoading,
37
+ leading: spinLeading,
38
+ trailing: spinTrailing
39
+ });
40
+ return {
41
+ base: slots.base({ class: [
42
+ config.slots.base,
43
+ fieldGroupClass,
44
+ className,
45
+ ui?.base
46
+ ] }),
47
+ label: slots.label({ class: [config.slots.label, ui?.label] }),
48
+ leadingIcon: slots.leadingIcon({ class: [config.slots.leadingIcon, ui?.leadingIcon] }),
49
+ trailingIcon: slots.trailingIcon({ class: [config.slots.trailingIcon, ui?.trailingIcon] }),
50
+ leadingAvatar: slots.leadingAvatar({ class: [config.slots.leadingAvatar, ui?.leadingAvatar] }),
51
+ leadingAvatarSize: slots.leadingAvatarSize()
52
+ };
53
+ });
54
+ function handleClick(e) {
55
+ if (disabled || isLoading) {
56
+ e.preventDefault();
57
+ e.stopPropagation();
58
+ return;
59
+ }
60
+ if (typeof onclick === "function") {
61
+ const result = onclick(e);
62
+ if (loadingAuto && result instanceof Promise) {
63
+ autoLoading = true;
64
+ pendingPromise = result;
65
+ result.then(() => {
66
+ if (pendingPromise === result) autoLoading = false;
67
+ }, () => {
68
+ if (pendingPromise === result) autoLoading = false;
69
+ });
70
+ }
71
+ }
72
+ }
141
73
  </script>
142
74
 
143
75
  <Link