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.
- 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/package.json +16 -8
|
@@ -1,62 +1,83 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
export type Props = TimelineProps;
|
|
1
|
+
<script lang="ts" module>export {};
|
|
3
2
|
</script>
|
|
4
3
|
|
|
5
|
-
<script lang="ts">import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const config = getComponentConfig('timeline', timelineDefaults);
|
|
13
|
-
let { ref = $bindable(null), as = 'div', items = [], size = config.defaultVariants.size, color = config.defaultVariants.color, orientation = config.defaultVariants.orientation, reverse = config.defaultVariants.reverse, value, class: className, ui, indicator, dateSlot, titleSlot, descriptionSlot, content, ...restProps }: Props = $props();
|
|
14
|
-
type ItemUi = Partial<Record<string, ClassNameValue>>;
|
|
4
|
+
<script lang="ts">import Avatar from "../Avatar/Avatar.svelte";
|
|
5
|
+
import { getComponentConfig } from "../config.js";
|
|
6
|
+
import Icon from "../Icon/Icon.svelte";
|
|
7
|
+
import { timelineDefaults, timelineVariants } from "./timeline.variants.js";
|
|
8
|
+
const config = getComponentConfig("timeline", timelineDefaults);
|
|
9
|
+
let { ref = $bindable(null), as = "div", items = [], size = config.defaultVariants.size, color = config.defaultVariants.color, orientation = config.defaultVariants.orientation, reverse = config.defaultVariants.reverse, value, class: className, ui, indicator, dateSlot, titleSlot, descriptionSlot, content, ...restProps } = $props();
|
|
15
10
|
const classes = $derived.by(() => {
|
|
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
|
-
|
|
11
|
+
const slots = timelineVariants({
|
|
12
|
+
orientation,
|
|
13
|
+
color,
|
|
14
|
+
size,
|
|
15
|
+
reverse
|
|
16
|
+
});
|
|
17
|
+
const c = config.slots;
|
|
18
|
+
// Pre-compute defaults — reused for all items without per-item ui
|
|
19
|
+
const _item = slots.item({ class: [c.item, ui?.item] });
|
|
20
|
+
const _container = slots.container({ class: [c.container, ui?.container] });
|
|
21
|
+
const _indicator = slots.indicator({ class: [c.indicator, ui?.indicator] });
|
|
22
|
+
const _separator = slots.separator({ class: [c.separator, ui?.separator] });
|
|
23
|
+
const _wrapper = slots.wrapper({ class: [c.wrapper, ui?.wrapper] });
|
|
24
|
+
const _date = slots.date({ class: [c.date, ui?.date] });
|
|
25
|
+
const _title = slots.title({ class: [c.title, ui?.title] });
|
|
26
|
+
const _description = slots.description({ class: [c.description, ui?.description] });
|
|
27
|
+
return {
|
|
28
|
+
root: slots.root({ class: [
|
|
29
|
+
c.root,
|
|
30
|
+
className,
|
|
31
|
+
ui?.root
|
|
32
|
+
] }),
|
|
33
|
+
item: (itemClass, itemUi) => itemClass || itemUi ? slots.item({ class: [
|
|
34
|
+
c.item,
|
|
35
|
+
ui?.item,
|
|
36
|
+
itemUi?.item,
|
|
37
|
+
itemClass
|
|
38
|
+
] }) : _item,
|
|
39
|
+
container: (itemUi) => itemUi ? slots.container({ class: [
|
|
40
|
+
c.container,
|
|
41
|
+
ui?.container,
|
|
42
|
+
itemUi.container
|
|
43
|
+
] }) : _container,
|
|
44
|
+
indicator: (itemUi) => itemUi ? slots.indicator({ class: [
|
|
45
|
+
c.indicator,
|
|
46
|
+
ui?.indicator,
|
|
47
|
+
itemUi.indicator
|
|
48
|
+
] }) : _indicator,
|
|
49
|
+
separator: (itemUi) => itemUi ? slots.separator({ class: [
|
|
50
|
+
c.separator,
|
|
51
|
+
ui?.separator,
|
|
52
|
+
itemUi.separator
|
|
53
|
+
] }) : _separator,
|
|
54
|
+
wrapper: (itemUi) => itemUi ? slots.wrapper({ class: [
|
|
55
|
+
c.wrapper,
|
|
56
|
+
ui?.wrapper,
|
|
57
|
+
itemUi.wrapper
|
|
58
|
+
] }) : _wrapper,
|
|
59
|
+
date: (itemUi) => itemUi?.date ? slots.date({ class: [
|
|
60
|
+
c.date,
|
|
61
|
+
ui?.date,
|
|
62
|
+
itemUi.date
|
|
63
|
+
] }) : _date,
|
|
64
|
+
title: (itemUi) => itemUi?.title ? slots.title({ class: [
|
|
65
|
+
c.title,
|
|
66
|
+
ui?.title,
|
|
67
|
+
itemUi.title
|
|
68
|
+
] }) : _title,
|
|
69
|
+
description: (itemUi) => itemUi?.description ? slots.description({ class: [
|
|
70
|
+
c.description,
|
|
71
|
+
ui?.description,
|
|
72
|
+
itemUi.description
|
|
73
|
+
] }) : _description
|
|
74
|
+
};
|
|
52
75
|
});
|
|
53
76
|
const activeIndex = $derived(value !== undefined ? items.findIndex((item) => item.value === value) : -1);
|
|
54
|
-
function getState(index
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return 'active';
|
|
59
|
-
return index < activeIndex ? 'completed' : 'pending';
|
|
77
|
+
function getState(index) {
|
|
78
|
+
if (activeIndex === -1) return "pending";
|
|
79
|
+
if (index === activeIndex) return "active";
|
|
80
|
+
return index < activeIndex ? "completed" : "pending";
|
|
60
81
|
}
|
|
61
82
|
</script>
|
|
62
83
|
|
|
@@ -1,30 +1,13 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { ToasterProps } from './toast.types.js'
|
|
3
|
-
|
|
4
|
-
export type Props = ToasterProps
|
|
1
|
+
<script lang="ts" module>export {};
|
|
5
2
|
</script>
|
|
6
3
|
|
|
7
|
-
<script lang="ts"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
let {
|
|
16
|
-
variant = config.defaultVariants.variant,
|
|
17
|
-
position = 'bottom-right',
|
|
18
|
-
visibleToasts = 3,
|
|
19
|
-
duration = 5000,
|
|
20
|
-
closeButton = true,
|
|
21
|
-
expand = false,
|
|
22
|
-
gap = 14,
|
|
23
|
-
class: className,
|
|
24
|
-
...restProps
|
|
25
|
-
}: Props = $props()
|
|
26
|
-
|
|
27
|
-
const toasterClass = $derived([`ps-toast-${variant}`, className].filter(Boolean).join(' '))
|
|
4
|
+
<script lang="ts">// biome-ignore lint/correctness/noUnusedImports: used in template below
|
|
5
|
+
import { Toaster as SonnerToaster } from "svelte-sonner";
|
|
6
|
+
import { getComponentConfig } from "../config.js";
|
|
7
|
+
import { toastDefaults } from "./toast.variants.js";
|
|
8
|
+
const config = getComponentConfig("toast", toastDefaults);
|
|
9
|
+
let { variant = config.defaultVariants.variant, position = "bottom-right", visibleToasts = 3, duration = 5e3, closeButton = true, expand = false, gap = 14, class: className, ...restProps } = $props();
|
|
10
|
+
const toasterClass = $derived([`ps-toast-${variant}`, className].filter(Boolean).join(" "));
|
|
28
11
|
</script>
|
|
29
12
|
|
|
30
13
|
<SonnerToaster
|
|
@@ -1,71 +1,39 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { TooltipProps } from './tooltip.types.js'
|
|
3
|
-
|
|
4
|
-
export type Props = TooltipProps
|
|
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
|
-
ui,
|
|
41
|
-
class: className,
|
|
42
|
-
children,
|
|
43
|
-
content: contentSlot,
|
|
44
|
-
...restProps
|
|
45
|
-
}: Props = $props()
|
|
46
|
-
|
|
47
|
-
// Pre-compute booleans
|
|
48
|
-
const hasText = $derived(!!text)
|
|
49
|
-
const hasKbds = $derived(!!kbds?.length)
|
|
50
|
-
const hasContent = $derived(hasText || hasKbds || !!contentSlot)
|
|
51
|
-
|
|
52
|
-
// Compute variant classes
|
|
53
|
-
const variantSlots = $derived(tooltipVariants({ transition }))
|
|
54
|
-
const kbdsSize = (config.slots.kbdsSize ?? 'sm') as 'sm' | 'md' | 'lg'
|
|
55
|
-
const classes = $derived({
|
|
56
|
-
content: variantSlots.content({ class: [config.slots.content, ui?.content] }),
|
|
57
|
-
arrow: variantSlots.arrow({ class: [config.slots.arrow, ui?.arrow] }),
|
|
58
|
-
text: variantSlots.text({ class: [config.slots.text, ui?.text] }),
|
|
59
|
-
kbds: variantSlots.kbds({ class: [config.slots.kbds, ui?.kbds] })
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
// Arrow props
|
|
63
|
-
const arrowProps = $derived.by(() => {
|
|
64
|
-
if (typeof arrow === 'object') {
|
|
65
|
-
return { width: 12, height: 6, ...arrow }
|
|
66
|
-
}
|
|
67
|
-
return { width: 12, height: 6 }
|
|
68
|
-
})
|
|
4
|
+
<script lang="ts">import { Tooltip } from "bits-ui";
|
|
5
|
+
import { getComponentConfig } from "../config.js";
|
|
6
|
+
import Kbd from "../Kbd/Kbd.svelte";
|
|
7
|
+
import { tooltipDefaults, tooltipVariants } from "./tooltip.variants.js";
|
|
8
|
+
const config = getComponentConfig("tooltip", tooltipDefaults);
|
|
9
|
+
let { ref = $bindable(null), open = $bindable(false), onOpenChange, delayDuration, disableHoverableContent, disableCloseOnTriggerClick, ignoreNonKeyboardFocus, disabled = false, side = "bottom", sideOffset = 8, align = "center", alignOffset = 0, avoidCollisions = true, collisionBoundary, collisionPadding = 8, sticky = "partial", hideWhenDetached = false, onEscapeKeydown, forceMount, text, kbds, arrow = false, transition = config.defaultVariants.transition ?? true, portal = true, ui, class: className, children, content: contentSlot, ...restProps } = $props();
|
|
10
|
+
// Pre-compute booleans
|
|
11
|
+
const hasText = $derived(!!text);
|
|
12
|
+
const hasKbds = $derived(!!kbds?.length);
|
|
13
|
+
const hasContent = $derived(hasText || hasKbds || !!contentSlot);
|
|
14
|
+
// Compute variant classes
|
|
15
|
+
const variantSlots = $derived(tooltipVariants({ transition }));
|
|
16
|
+
const kbdsSize = config.slots.kbdsSize ?? "sm";
|
|
17
|
+
const classes = $derived({
|
|
18
|
+
content: variantSlots.content({ class: [config.slots.content, ui?.content] }),
|
|
19
|
+
arrow: variantSlots.arrow({ class: [config.slots.arrow, ui?.arrow] }),
|
|
20
|
+
text: variantSlots.text({ class: [config.slots.text, ui?.text] }),
|
|
21
|
+
kbds: variantSlots.kbds({ class: [config.slots.kbds, ui?.kbds] })
|
|
22
|
+
});
|
|
23
|
+
// Arrow props
|
|
24
|
+
const arrowProps = $derived.by(() => {
|
|
25
|
+
if (typeof arrow === "object") {
|
|
26
|
+
return {
|
|
27
|
+
width: 12,
|
|
28
|
+
height: 6,
|
|
29
|
+
...arrow
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
width: 12,
|
|
34
|
+
height: 6
|
|
35
|
+
};
|
|
36
|
+
});
|
|
69
37
|
</script>
|
|
70
38
|
|
|
71
39
|
{#snippet tooltipContent()}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TooltipProps } from './tooltip.types.js';
|
|
2
2
|
export type Props = TooltipProps;
|
|
3
3
|
import { Tooltip } from 'bits-ui';
|
|
4
|
-
declare const Tooltip: import("svelte").Component<TooltipProps, {}, "
|
|
4
|
+
declare const Tooltip: import("svelte").Component<TooltipProps, {}, "open" | "ref">;
|
|
5
5
|
type Tooltip = ReturnType<typeof Tooltip>;
|
|
6
6
|
export default Tooltip;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
import type { TooltipProps } from './tooltip.types.js'
|
|
4
|
-
|
|
5
|
-
let props: TooltipProps = $props()
|
|
1
|
+
<script lang="ts">import Tooltip from "./Tooltip.svelte";
|
|
2
|
+
let props = $props();
|
|
6
3
|
</script>
|
|
7
4
|
|
|
8
5
|
<Tooltip {...props} />
|
package/dist/User/User.svelte
CHANGED
|
@@ -1,54 +1,38 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { UserProps } from './user.types.js'
|
|
3
|
-
|
|
4
|
-
export type Props = UserProps
|
|
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
|
-
root: slots.root({ class: [config.slots.root, className, ui?.root] }),
|
|
40
|
-
wrapper: slots.wrapper({ class: [config.slots.wrapper, ui?.wrapper] }),
|
|
41
|
-
name: slots.name({ class: [config.slots.name, ui?.name] }),
|
|
42
|
-
description: slots.description({ class: [config.slots.description, ui?.description] }),
|
|
43
|
-
avatar: slots.avatar({ class: [config.slots.avatar, ui?.avatar] })
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
const mergedAvatarProps = $derived(
|
|
48
|
-
avatar ? { alt: name, size: size as typeof avatar.size, ...avatar } : undefined
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
const chipProps = $derived(chip && avatar ? (chip === true ? {} : chip) : null)
|
|
4
|
+
<script lang="ts">import Avatar from "../Avatar/Avatar.svelte";
|
|
5
|
+
import Chip from "../Chip/Chip.svelte";
|
|
6
|
+
import { getComponentConfig } from "../config.js";
|
|
7
|
+
import Link from "../Link/Link.svelte";
|
|
8
|
+
import { userDefaults, userVariants } from "./user.variants.js";
|
|
9
|
+
const config = getComponentConfig("user", userDefaults);
|
|
10
|
+
let { ref = $bindable(null), as = "div", ui, name, description, avatar, chip, size = config.defaultVariants.size, orientation = config.defaultVariants.orientation, href, class: className, avatarSlot, nameSlot, descriptionSlot, ...restProps } = $props();
|
|
11
|
+
const isClickable = $derived(!!href || !!restProps.onclick);
|
|
12
|
+
const classes = $derived.by(() => {
|
|
13
|
+
const slots = userVariants({
|
|
14
|
+
size,
|
|
15
|
+
orientation,
|
|
16
|
+
clickable: isClickable
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
root: slots.root({ class: [
|
|
20
|
+
config.slots.root,
|
|
21
|
+
className,
|
|
22
|
+
ui?.root
|
|
23
|
+
] }),
|
|
24
|
+
wrapper: slots.wrapper({ class: [config.slots.wrapper, ui?.wrapper] }),
|
|
25
|
+
name: slots.name({ class: [config.slots.name, ui?.name] }),
|
|
26
|
+
description: slots.description({ class: [config.slots.description, ui?.description] }),
|
|
27
|
+
avatar: slots.avatar({ class: [config.slots.avatar, ui?.avatar] })
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
const mergedAvatarProps = $derived(avatar ? {
|
|
31
|
+
alt: name,
|
|
32
|
+
size,
|
|
33
|
+
...avatar
|
|
34
|
+
} : undefined);
|
|
35
|
+
const chipProps = $derived(chip && avatar ? chip === true ? {} : chip : null);
|
|
52
36
|
</script>
|
|
53
37
|
|
|
54
38
|
{#snippet userContent()}
|
package/dist/docs/navigation.js
CHANGED
|
@@ -98,6 +98,12 @@ export const docsComponentGroups = [
|
|
|
98
98
|
legacyHref: '/link',
|
|
99
99
|
icon: 'lucide:link'
|
|
100
100
|
},
|
|
101
|
+
{
|
|
102
|
+
title: 'LocaleButton',
|
|
103
|
+
href: '/docs/components/locale-button',
|
|
104
|
+
legacyHref: '/locale-button',
|
|
105
|
+
icon: 'lucide:languages'
|
|
106
|
+
},
|
|
101
107
|
{
|
|
102
108
|
title: 'Kbd',
|
|
103
109
|
href: '/docs/components/kbd',
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const ctx = useFormField()
|
|
1
|
+
<script lang="ts">import { useFormField } from "./useFormField.svelte.js";
|
|
2
|
+
const ctx = useFormField();
|
|
5
3
|
</script>
|
|
6
4
|
|
|
7
5
|
<div data-name={ctx?.name ?? 'none'} data-has={String(!!ctx)}>probe</div>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">import { setContext } from "svelte";
|
|
2
|
+
import HookContextProbe from "./HookContextProbe.svelte";
|
|
3
|
+
import { FORM_FIELD_CONTEXT_KEY } from "./useFormField.svelte.js";
|
|
4
|
+
setContext(FORM_FIELD_CONTEXT_KEY, {
|
|
5
|
+
name: "email",
|
|
6
|
+
size: "md",
|
|
7
|
+
ariaId: "ff"
|
|
8
|
+
});
|
|
7
9
|
</script>
|
|
8
10
|
|
|
9
11
|
<HookContextProbe />
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
emit.onChange()
|
|
10
|
-
emit.onInput()
|
|
11
|
-
}
|
|
1
|
+
<script lang="ts">import { useFormFieldEmit } from "./useFormField.svelte.js";
|
|
2
|
+
const emit = useFormFieldEmit();
|
|
3
|
+
function fireAll() {
|
|
4
|
+
emit.onBlur();
|
|
5
|
+
emit.onFocus();
|
|
6
|
+
emit.onChange();
|
|
7
|
+
emit.onInput();
|
|
8
|
+
}
|
|
12
9
|
</script>
|
|
13
10
|
|
|
14
11
|
<button data-testid="fire" onclick={fireAll}>fire</button>
|
package/dist/i18n.d.ts
ADDED
package/dist/i18n.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { locales } from './paraglide/runtime.js';
|
|
2
|
+
const localeMeta = {
|
|
3
|
+
en: {
|
|
4
|
+
label: 'English',
|
|
5
|
+
shortLabel: 'EN'
|
|
6
|
+
},
|
|
7
|
+
th: {
|
|
8
|
+
label: 'Thai',
|
|
9
|
+
shortLabel: 'TH'
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export function buildLocaleOptions() {
|
|
13
|
+
return locales.map((locale) => ({
|
|
14
|
+
code: locale,
|
|
15
|
+
label: localeMeta[locale].label,
|
|
16
|
+
shortLabel: localeMeta[locale].shortLabel,
|
|
17
|
+
hreflang: locale
|
|
18
|
+
}));
|
|
19
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export * from './Icon/index.js';
|
|
|
34
34
|
export * from './Input/index.js';
|
|
35
35
|
export * from './Kbd/index.js';
|
|
36
36
|
export * from './Link/index.js';
|
|
37
|
+
export * from './LocaleButton/index.js';
|
|
37
38
|
export * from './Modal/index.js';
|
|
38
39
|
export * from './Pagination/index.js';
|
|
39
40
|
export * from './PinInput/index.js';
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,7 @@ export * from './Icon/index.js';
|
|
|
35
35
|
export * from './Input/index.js';
|
|
36
36
|
export * from './Kbd/index.js';
|
|
37
37
|
export * from './Link/index.js';
|
|
38
|
+
export * from './LocaleButton/index.js';
|
|
38
39
|
export * from './Modal/index.js';
|
|
39
40
|
export * from './Pagination/index.js';
|
|
40
41
|
export * from './PinInput/index.js';
|