sv5ui 1.7.0 → 1.8.0
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/Banner/Banner.svelte +162 -0
- package/dist/Banner/Banner.svelte.d.ts +5 -0
- package/dist/Banner/banner.types.d.ts +148 -0
- package/dist/Banner/banner.types.js +1 -0
- package/dist/Banner/banner.variants.d.ts +293 -0
- package/dist/Banner/banner.variants.js +86 -0
- package/dist/Banner/index.d.ts +2 -0
- package/dist/Banner/index.js +1 -0
- package/dist/Editor/Editor.svelte +738 -0
- package/dist/Editor/Editor.svelte.d.ts +6 -0
- package/dist/Editor/EditorUrlPrompt.svelte +111 -0
- package/dist/Editor/EditorUrlPrompt.svelte.d.ts +15 -0
- package/dist/Editor/SlashPopup.svelte +67 -0
- package/dist/Editor/SlashPopup.svelte.d.ts +9 -0
- package/dist/Editor/editor.extensions.d.ts +23 -0
- package/dist/Editor/editor.extensions.js +123 -0
- package/dist/Editor/editor.schemas.d.ts +4 -0
- package/dist/Editor/editor.schemas.js +3 -0
- package/dist/Editor/editor.slash.svelte.d.ts +34 -0
- package/dist/Editor/editor.slash.svelte.js +273 -0
- package/dist/Editor/editor.suggestion.d.ts +7 -0
- package/dist/Editor/editor.suggestion.js +142 -0
- package/dist/Editor/editor.toolbar.d.ts +11 -0
- package/dist/Editor/editor.toolbar.js +212 -0
- package/dist/Editor/editor.types.d.ts +347 -0
- package/dist/Editor/editor.types.js +1 -0
- package/dist/Editor/editor.variants.d.ts +308 -0
- package/dist/Editor/editor.variants.js +150 -0
- package/dist/Editor/index.d.ts +53 -0
- package/dist/Editor/index.js +52 -0
- package/dist/Stepper/Stepper.svelte +292 -0
- package/dist/Stepper/Stepper.svelte.d.ts +5 -0
- package/dist/Stepper/index.d.ts +2 -0
- package/dist/Stepper/index.js +1 -0
- package/dist/Stepper/stepper.types.d.ts +223 -0
- package/dist/Stepper/stepper.types.js +1 -0
- package/dist/Stepper/stepper.variants.d.ts +428 -0
- package/dist/Stepper/stepper.variants.js +204 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +97 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { BannerProps } from './banner.types.js'
|
|
3
|
+
|
|
4
|
+
export type Props = BannerProps
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { useId } from 'bits-ui'
|
|
9
|
+
import { bannerVariants, bannerDefaults } from './banner.variants.js'
|
|
10
|
+
import { getComponentConfig, iconsDefaults } from '../config.js'
|
|
11
|
+
import Icon from '../Icon/Icon.svelte'
|
|
12
|
+
import Button from '../Button/Button.svelte'
|
|
13
|
+
|
|
14
|
+
const config = getComponentConfig('banner', bannerDefaults)
|
|
15
|
+
const icons = getComponentConfig('icons', iconsDefaults)
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
ref = $bindable(null),
|
|
19
|
+
as = 'div',
|
|
20
|
+
id,
|
|
21
|
+
title,
|
|
22
|
+
icon,
|
|
23
|
+
color = config.defaultVariants.color,
|
|
24
|
+
to,
|
|
25
|
+
target,
|
|
26
|
+
close = false,
|
|
27
|
+
closeIcon,
|
|
28
|
+
actions,
|
|
29
|
+
open = $bindable(true),
|
|
30
|
+
onClose,
|
|
31
|
+
class: className,
|
|
32
|
+
ui,
|
|
33
|
+
leading,
|
|
34
|
+
titleSlot,
|
|
35
|
+
actionsSlot,
|
|
36
|
+
closeSlot,
|
|
37
|
+
...restProps
|
|
38
|
+
}: Props = $props()
|
|
39
|
+
|
|
40
|
+
const fallbackId = useId('banner-')
|
|
41
|
+
const effectiveId = $derived(id ?? fallbackId)
|
|
42
|
+
|
|
43
|
+
let dismissed = $state(false)
|
|
44
|
+
|
|
45
|
+
function storageKey(rawId: string) {
|
|
46
|
+
return `sv5ui-banner-${rawId.replace(/[^\w-]/g, '-')}`
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
$effect(() => {
|
|
50
|
+
void open
|
|
51
|
+
if (!id || typeof window === 'undefined') {
|
|
52
|
+
dismissed = false
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
dismissed = localStorage.getItem(storageKey(id)) === '1'
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const visible = $derived(open && !dismissed)
|
|
59
|
+
const isClickable = $derived(!!to)
|
|
60
|
+
const resolvedCloseIcon = $derived(closeIcon ?? icons.close)
|
|
61
|
+
const closeButtonProps = $derived(!close ? null : close === true ? {} : close)
|
|
62
|
+
|
|
63
|
+
const classes = $derived.by(() => {
|
|
64
|
+
const slots = bannerVariants({ color, to: isClickable })
|
|
65
|
+
const c = config.slots
|
|
66
|
+
const u = ui ?? {}
|
|
67
|
+
return {
|
|
68
|
+
root: slots.root({ class: [c.root, className, u.root] }),
|
|
69
|
+
container: slots.container({ class: [c.container, u.container] }),
|
|
70
|
+
left: slots.left({ class: [c.left, u.left] }),
|
|
71
|
+
center: slots.center({ class: [c.center, u.center] }),
|
|
72
|
+
right: slots.right({ class: [c.right, u.right] }),
|
|
73
|
+
icon: slots.icon({ class: [c.icon, u.icon] }),
|
|
74
|
+
title: slots.title({ class: [c.title, u.title] }),
|
|
75
|
+
actions: slots.actions({ class: [c.actions, u.actions] }),
|
|
76
|
+
close: slots.close({ class: [c.close, u.close] })
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
function handleClose(event?: Event) {
|
|
81
|
+
event?.stopPropagation()
|
|
82
|
+
if (id && typeof window !== 'undefined') {
|
|
83
|
+
localStorage.setItem(storageKey(id), '1')
|
|
84
|
+
}
|
|
85
|
+
open = false
|
|
86
|
+
onClose?.()
|
|
87
|
+
}
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
{#if visible}
|
|
91
|
+
<svelte:element
|
|
92
|
+
this={as}
|
|
93
|
+
bind:this={ref}
|
|
94
|
+
class={classes.root}
|
|
95
|
+
role={isClickable ? undefined : 'region'}
|
|
96
|
+
aria-label={isClickable || titleSlot ? undefined : title}
|
|
97
|
+
data-banner-id={effectiveId}
|
|
98
|
+
{...restProps}
|
|
99
|
+
>
|
|
100
|
+
{#if isClickable}
|
|
101
|
+
<!-- eslint-disable svelte/no-navigation-without-resolve -->
|
|
102
|
+
<a
|
|
103
|
+
href={to}
|
|
104
|
+
{target}
|
|
105
|
+
class="absolute inset-0 z-0 rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-current focus-visible:ring-inset"
|
|
106
|
+
aria-label={title}
|
|
107
|
+
data-banner-link
|
|
108
|
+
></a>
|
|
109
|
+
<!-- eslint-enable svelte/no-navigation-without-resolve -->
|
|
110
|
+
{/if}
|
|
111
|
+
|
|
112
|
+
<div class={classes.container}>
|
|
113
|
+
<div class={classes.left} aria-hidden="true"></div>
|
|
114
|
+
|
|
115
|
+
<div class={classes.center}>
|
|
116
|
+
{#if leading}
|
|
117
|
+
{@render leading()}
|
|
118
|
+
{:else if icon}
|
|
119
|
+
<Icon name={icon} class={classes.icon} />
|
|
120
|
+
{/if}
|
|
121
|
+
|
|
122
|
+
{#if titleSlot}
|
|
123
|
+
{@render titleSlot()}
|
|
124
|
+
{:else if title}
|
|
125
|
+
<span class={classes.title}>{title}</span>
|
|
126
|
+
{/if}
|
|
127
|
+
|
|
128
|
+
{#if actionsSlot}
|
|
129
|
+
{@render actionsSlot()}
|
|
130
|
+
{:else if actions && actions.length > 0}
|
|
131
|
+
<div
|
|
132
|
+
class="{classes.actions} relative z-10"
|
|
133
|
+
onclick={(e) => e.stopPropagation()}
|
|
134
|
+
role="presentation"
|
|
135
|
+
>
|
|
136
|
+
{#each actions as action, i (i)}
|
|
137
|
+
<Button size="xs" variant="ghost" color="surface" {...action} />
|
|
138
|
+
{/each}
|
|
139
|
+
</div>
|
|
140
|
+
{/if}
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<div class="{classes.right} relative z-10">
|
|
144
|
+
{#if closeSlot}
|
|
145
|
+
{@render closeSlot()}
|
|
146
|
+
{:else if closeButtonProps}
|
|
147
|
+
<Button
|
|
148
|
+
size="xs"
|
|
149
|
+
variant="ghost"
|
|
150
|
+
color="surface"
|
|
151
|
+
square
|
|
152
|
+
{...closeButtonProps}
|
|
153
|
+
icon={closeButtonProps.icon ?? resolvedCloseIcon}
|
|
154
|
+
class={classes.close}
|
|
155
|
+
onclick={handleClose}
|
|
156
|
+
aria-label={closeButtonProps['aria-label'] ?? 'Dismiss banner'}
|
|
157
|
+
/>
|
|
158
|
+
{/if}
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
</svelte:element>
|
|
162
|
+
{/if}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes, HTMLAnchorAttributes } from 'svelte/elements';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
import type { BannerVariantProps, BannerSlots } from './banner.variants.js';
|
|
5
|
+
import type { ButtonProps } from '../Button/button.types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Props for the Banner component.
|
|
8
|
+
*
|
|
9
|
+
* A full-width announcement bar typically rendered at the top of a page or
|
|
10
|
+
* layout. Supports optional `localStorage` persistence — once dismissed by a
|
|
11
|
+
* given `id`, the banner stays hidden across reloads.
|
|
12
|
+
*
|
|
13
|
+
* **Hydration note:** When a banner has been previously dismissed via `id`,
|
|
14
|
+
* users will see a one-frame flicker on initial render (server renders the
|
|
15
|
+
* banner, then `$effect` reads `localStorage` and hides it). Eliminating the
|
|
16
|
+
* flicker requires a SvelteKit prehydration script the consumer injects
|
|
17
|
+
* themselves — see the demo page for a recipe.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```svelte
|
|
21
|
+
* <Banner
|
|
22
|
+
* id="announce-2026-q2"
|
|
23
|
+
* icon="lucide:megaphone"
|
|
24
|
+
* title="New features available — check the changelog!"
|
|
25
|
+
* color="primary"
|
|
26
|
+
* close
|
|
27
|
+
* to="/changelog"
|
|
28
|
+
* />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export interface BannerProps extends Omit<HTMLAttributes<HTMLElement>, 'class' | 'title' | 'id'> {
|
|
32
|
+
/**
|
|
33
|
+
* Bindable reference to the root DOM element.
|
|
34
|
+
*/
|
|
35
|
+
ref?: HTMLElement | null;
|
|
36
|
+
/**
|
|
37
|
+
* The HTML element to render as the root.
|
|
38
|
+
* @default 'div'
|
|
39
|
+
*/
|
|
40
|
+
as?: keyof HTMLElementTagNameMap;
|
|
41
|
+
/**
|
|
42
|
+
* Unique identifier used as the localStorage persistence key. When set,
|
|
43
|
+
* clicking the close button writes `sv5ui-banner-{id}` to localStorage
|
|
44
|
+
* and the banner remains hidden on subsequent loads.
|
|
45
|
+
*
|
|
46
|
+
* Without an explicit `id`, a stable per-instance id is generated via
|
|
47
|
+
* `useId()` (used for the `data-banner-id` DOM attribute), but **dismissal
|
|
48
|
+
* is session-only** — no localStorage interaction happens. Pass an
|
|
49
|
+
* explicit `id` to opt into cross-reload persistence.
|
|
50
|
+
*
|
|
51
|
+
* Allowed characters in the storage key: alphanumeric, underscore, dash.
|
|
52
|
+
* Other characters are replaced with `-`.
|
|
53
|
+
*/
|
|
54
|
+
id?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Banner text content.
|
|
57
|
+
*/
|
|
58
|
+
title?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Iconify icon name rendered before the title.
|
|
61
|
+
*/
|
|
62
|
+
icon?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Color theme. Applies background + foreground tokens.
|
|
65
|
+
* @default 'primary'
|
|
66
|
+
*/
|
|
67
|
+
color?: NonNullable<BannerVariantProps['color']>;
|
|
68
|
+
/**
|
|
69
|
+
* When provided, the entire banner becomes a clickable link via an
|
|
70
|
+
* absolute-positioned overlay anchor. The `as` element stays unchanged
|
|
71
|
+
* (so close/action buttons inside aren't nested in an `<a>` — valid HTML).
|
|
72
|
+
* Pair with `target` for new-tab links.
|
|
73
|
+
*/
|
|
74
|
+
to?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Anchor `target` (e.g. `'_blank'`). Only honored when `to` is set.
|
|
77
|
+
*/
|
|
78
|
+
target?: HTMLAnchorAttributes['target'];
|
|
79
|
+
/**
|
|
80
|
+
* Show close button. Pass `true` for default styling or a `ButtonProps`
|
|
81
|
+
* object to customize. When `id` is also set, dismissal persists across
|
|
82
|
+
* reloads via localStorage.
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
close?: boolean | ButtonProps;
|
|
86
|
+
/**
|
|
87
|
+
* Override the close button icon.
|
|
88
|
+
* @default 'lucide:x' (from global icons config)
|
|
89
|
+
*/
|
|
90
|
+
closeIcon?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Action buttons rendered inline after the title. Each entry is spread
|
|
93
|
+
* onto a `<Button>` and accepts the full `ButtonProps` shape. Banner
|
|
94
|
+
* applies `size="xs" color="surface"` as the default — override any prop
|
|
95
|
+
* (variant, color, icon, to, etc.) per item.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```svelte
|
|
99
|
+
* <Banner
|
|
100
|
+
* title="Update available"
|
|
101
|
+
* actions={[
|
|
102
|
+
* { label: 'Learn more', variant: 'outline' },
|
|
103
|
+
* { label: 'Update now', trailingIcon: 'lucide:arrow-right' }
|
|
104
|
+
* ]}
|
|
105
|
+
* />
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
actions?: ButtonProps[];
|
|
109
|
+
/**
|
|
110
|
+
* Bindable visibility. Set to `false` to hide externally without
|
|
111
|
+
* persisting (e.g. for analytics-driven banners). When the user clicks
|
|
112
|
+
* the close button, this is set to `false` automatically.
|
|
113
|
+
* @default true
|
|
114
|
+
*/
|
|
115
|
+
open?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Fired when the close button is clicked, before any localStorage
|
|
118
|
+
* write. Cannot prevent dismissal — use `open` binding if you need
|
|
119
|
+
* conditional dismissal.
|
|
120
|
+
*/
|
|
121
|
+
onClose?: () => void;
|
|
122
|
+
/**
|
|
123
|
+
* Additional CSS classes for the root element.
|
|
124
|
+
*/
|
|
125
|
+
class?: ClassNameValue;
|
|
126
|
+
/**
|
|
127
|
+
* Override classes for component slots.
|
|
128
|
+
*/
|
|
129
|
+
ui?: Partial<Record<BannerSlots, ClassNameValue>>;
|
|
130
|
+
/**
|
|
131
|
+
* Custom leading content. Replaces the default `icon` rendering.
|
|
132
|
+
*/
|
|
133
|
+
leading?: Snippet;
|
|
134
|
+
/**
|
|
135
|
+
* Custom title content. Replaces the default `title` text.
|
|
136
|
+
*/
|
|
137
|
+
titleSlot?: Snippet;
|
|
138
|
+
/**
|
|
139
|
+
* Custom actions content. Replaces the default `actions` array rendering.
|
|
140
|
+
*/
|
|
141
|
+
actionsSlot?: Snippet;
|
|
142
|
+
/**
|
|
143
|
+
* Custom close button content. When provided, the consumer is
|
|
144
|
+
* responsible for wiring up the dismiss action (typically by binding
|
|
145
|
+
* `open` externally).
|
|
146
|
+
*/
|
|
147
|
+
closeSlot?: Snippet;
|
|
148
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const bannerVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
color: {
|
|
4
|
+
primary: {
|
|
5
|
+
root: string;
|
|
6
|
+
icon: string;
|
|
7
|
+
title: string;
|
|
8
|
+
};
|
|
9
|
+
secondary: {
|
|
10
|
+
root: string;
|
|
11
|
+
icon: string;
|
|
12
|
+
title: string;
|
|
13
|
+
};
|
|
14
|
+
tertiary: {
|
|
15
|
+
root: string;
|
|
16
|
+
icon: string;
|
|
17
|
+
title: string;
|
|
18
|
+
};
|
|
19
|
+
success: {
|
|
20
|
+
root: string;
|
|
21
|
+
icon: string;
|
|
22
|
+
title: string;
|
|
23
|
+
};
|
|
24
|
+
warning: {
|
|
25
|
+
root: string;
|
|
26
|
+
icon: string;
|
|
27
|
+
title: string;
|
|
28
|
+
};
|
|
29
|
+
error: {
|
|
30
|
+
root: string;
|
|
31
|
+
icon: string;
|
|
32
|
+
title: string;
|
|
33
|
+
};
|
|
34
|
+
info: {
|
|
35
|
+
root: string;
|
|
36
|
+
icon: string;
|
|
37
|
+
title: string;
|
|
38
|
+
};
|
|
39
|
+
surface: {
|
|
40
|
+
root: string;
|
|
41
|
+
icon: string;
|
|
42
|
+
title: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
to: {
|
|
46
|
+
true: string;
|
|
47
|
+
false: string;
|
|
48
|
+
};
|
|
49
|
+
}, {
|
|
50
|
+
root: string;
|
|
51
|
+
container: string;
|
|
52
|
+
left: string;
|
|
53
|
+
center: string;
|
|
54
|
+
right: string;
|
|
55
|
+
icon: string;
|
|
56
|
+
title: string;
|
|
57
|
+
actions: string[];
|
|
58
|
+
close: string;
|
|
59
|
+
}, undefined, {
|
|
60
|
+
color: {
|
|
61
|
+
primary: {
|
|
62
|
+
root: string;
|
|
63
|
+
icon: string;
|
|
64
|
+
title: string;
|
|
65
|
+
};
|
|
66
|
+
secondary: {
|
|
67
|
+
root: string;
|
|
68
|
+
icon: string;
|
|
69
|
+
title: string;
|
|
70
|
+
};
|
|
71
|
+
tertiary: {
|
|
72
|
+
root: string;
|
|
73
|
+
icon: string;
|
|
74
|
+
title: string;
|
|
75
|
+
};
|
|
76
|
+
success: {
|
|
77
|
+
root: string;
|
|
78
|
+
icon: string;
|
|
79
|
+
title: string;
|
|
80
|
+
};
|
|
81
|
+
warning: {
|
|
82
|
+
root: string;
|
|
83
|
+
icon: string;
|
|
84
|
+
title: string;
|
|
85
|
+
};
|
|
86
|
+
error: {
|
|
87
|
+
root: string;
|
|
88
|
+
icon: string;
|
|
89
|
+
title: string;
|
|
90
|
+
};
|
|
91
|
+
info: {
|
|
92
|
+
root: string;
|
|
93
|
+
icon: string;
|
|
94
|
+
title: string;
|
|
95
|
+
};
|
|
96
|
+
surface: {
|
|
97
|
+
root: string;
|
|
98
|
+
icon: string;
|
|
99
|
+
title: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
to: {
|
|
103
|
+
true: string;
|
|
104
|
+
false: string;
|
|
105
|
+
};
|
|
106
|
+
}, {
|
|
107
|
+
root: string;
|
|
108
|
+
container: string;
|
|
109
|
+
left: string;
|
|
110
|
+
center: string;
|
|
111
|
+
right: string;
|
|
112
|
+
icon: string;
|
|
113
|
+
title: string;
|
|
114
|
+
actions: string[];
|
|
115
|
+
close: string;
|
|
116
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
117
|
+
color: {
|
|
118
|
+
primary: {
|
|
119
|
+
root: string;
|
|
120
|
+
icon: string;
|
|
121
|
+
title: string;
|
|
122
|
+
};
|
|
123
|
+
secondary: {
|
|
124
|
+
root: string;
|
|
125
|
+
icon: string;
|
|
126
|
+
title: string;
|
|
127
|
+
};
|
|
128
|
+
tertiary: {
|
|
129
|
+
root: string;
|
|
130
|
+
icon: string;
|
|
131
|
+
title: string;
|
|
132
|
+
};
|
|
133
|
+
success: {
|
|
134
|
+
root: string;
|
|
135
|
+
icon: string;
|
|
136
|
+
title: string;
|
|
137
|
+
};
|
|
138
|
+
warning: {
|
|
139
|
+
root: string;
|
|
140
|
+
icon: string;
|
|
141
|
+
title: string;
|
|
142
|
+
};
|
|
143
|
+
error: {
|
|
144
|
+
root: string;
|
|
145
|
+
icon: string;
|
|
146
|
+
title: string;
|
|
147
|
+
};
|
|
148
|
+
info: {
|
|
149
|
+
root: string;
|
|
150
|
+
icon: string;
|
|
151
|
+
title: string;
|
|
152
|
+
};
|
|
153
|
+
surface: {
|
|
154
|
+
root: string;
|
|
155
|
+
icon: string;
|
|
156
|
+
title: string;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
to: {
|
|
160
|
+
true: string;
|
|
161
|
+
false: string;
|
|
162
|
+
};
|
|
163
|
+
}, {
|
|
164
|
+
root: string;
|
|
165
|
+
container: string;
|
|
166
|
+
left: string;
|
|
167
|
+
center: string;
|
|
168
|
+
right: string;
|
|
169
|
+
icon: string;
|
|
170
|
+
title: string;
|
|
171
|
+
actions: string[];
|
|
172
|
+
close: string;
|
|
173
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
174
|
+
export type BannerVariantProps = VariantProps<typeof bannerVariants>;
|
|
175
|
+
export type BannerSlots = keyof ReturnType<typeof bannerVariants>;
|
|
176
|
+
export declare const bannerDefaults: {
|
|
177
|
+
defaultVariants: import("tailwind-variants").TVDefaultVariants<{
|
|
178
|
+
color: {
|
|
179
|
+
primary: {
|
|
180
|
+
root: string;
|
|
181
|
+
icon: string;
|
|
182
|
+
title: string;
|
|
183
|
+
};
|
|
184
|
+
secondary: {
|
|
185
|
+
root: string;
|
|
186
|
+
icon: string;
|
|
187
|
+
title: string;
|
|
188
|
+
};
|
|
189
|
+
tertiary: {
|
|
190
|
+
root: string;
|
|
191
|
+
icon: string;
|
|
192
|
+
title: string;
|
|
193
|
+
};
|
|
194
|
+
success: {
|
|
195
|
+
root: string;
|
|
196
|
+
icon: string;
|
|
197
|
+
title: string;
|
|
198
|
+
};
|
|
199
|
+
warning: {
|
|
200
|
+
root: string;
|
|
201
|
+
icon: string;
|
|
202
|
+
title: string;
|
|
203
|
+
};
|
|
204
|
+
error: {
|
|
205
|
+
root: string;
|
|
206
|
+
icon: string;
|
|
207
|
+
title: string;
|
|
208
|
+
};
|
|
209
|
+
info: {
|
|
210
|
+
root: string;
|
|
211
|
+
icon: string;
|
|
212
|
+
title: string;
|
|
213
|
+
};
|
|
214
|
+
surface: {
|
|
215
|
+
root: string;
|
|
216
|
+
icon: string;
|
|
217
|
+
title: string;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
to: {
|
|
221
|
+
true: string;
|
|
222
|
+
false: string;
|
|
223
|
+
};
|
|
224
|
+
}, {
|
|
225
|
+
root: string;
|
|
226
|
+
container: string;
|
|
227
|
+
left: string;
|
|
228
|
+
center: string;
|
|
229
|
+
right: string;
|
|
230
|
+
icon: string;
|
|
231
|
+
title: string;
|
|
232
|
+
actions: string[];
|
|
233
|
+
close: string;
|
|
234
|
+
}, {
|
|
235
|
+
color: {
|
|
236
|
+
primary: {
|
|
237
|
+
root: string;
|
|
238
|
+
icon: string;
|
|
239
|
+
title: string;
|
|
240
|
+
};
|
|
241
|
+
secondary: {
|
|
242
|
+
root: string;
|
|
243
|
+
icon: string;
|
|
244
|
+
title: string;
|
|
245
|
+
};
|
|
246
|
+
tertiary: {
|
|
247
|
+
root: string;
|
|
248
|
+
icon: string;
|
|
249
|
+
title: string;
|
|
250
|
+
};
|
|
251
|
+
success: {
|
|
252
|
+
root: string;
|
|
253
|
+
icon: string;
|
|
254
|
+
title: string;
|
|
255
|
+
};
|
|
256
|
+
warning: {
|
|
257
|
+
root: string;
|
|
258
|
+
icon: string;
|
|
259
|
+
title: string;
|
|
260
|
+
};
|
|
261
|
+
error: {
|
|
262
|
+
root: string;
|
|
263
|
+
icon: string;
|
|
264
|
+
title: string;
|
|
265
|
+
};
|
|
266
|
+
info: {
|
|
267
|
+
root: string;
|
|
268
|
+
icon: string;
|
|
269
|
+
title: string;
|
|
270
|
+
};
|
|
271
|
+
surface: {
|
|
272
|
+
root: string;
|
|
273
|
+
icon: string;
|
|
274
|
+
title: string;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
to: {
|
|
278
|
+
true: string;
|
|
279
|
+
false: string;
|
|
280
|
+
};
|
|
281
|
+
}, {
|
|
282
|
+
root: string;
|
|
283
|
+
container: string;
|
|
284
|
+
left: string;
|
|
285
|
+
center: string;
|
|
286
|
+
right: string;
|
|
287
|
+
icon: string;
|
|
288
|
+
title: string;
|
|
289
|
+
actions: string[];
|
|
290
|
+
close: string;
|
|
291
|
+
}>;
|
|
292
|
+
slots: Partial<Record<BannerSlots, string>>;
|
|
293
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const bannerVariants = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
root: 'relative z-30 w-full transition-colors',
|
|
5
|
+
container: 'flex items-center justify-between gap-3 min-h-12 px-4 py-2',
|
|
6
|
+
left: 'hidden lg:flex lg:flex-1 lg:items-center',
|
|
7
|
+
center: 'flex items-center gap-2 min-w-0',
|
|
8
|
+
right: 'flex items-center justify-end gap-2 lg:flex-1',
|
|
9
|
+
icon: 'size-5 shrink-0 pointer-events-none',
|
|
10
|
+
title: 'text-sm font-medium truncate',
|
|
11
|
+
actions: [
|
|
12
|
+
'flex items-center gap-2 ms-2',
|
|
13
|
+
'[&_button]:text-inherit [&_button]:border-current/30 [&_button]:hover:bg-current/10'
|
|
14
|
+
],
|
|
15
|
+
close: 'shrink-0 text-inherit hover:bg-current/10'
|
|
16
|
+
},
|
|
17
|
+
variants: {
|
|
18
|
+
color: {
|
|
19
|
+
primary: {
|
|
20
|
+
root: 'bg-primary text-on-primary',
|
|
21
|
+
icon: 'text-on-primary',
|
|
22
|
+
title: 'text-on-primary'
|
|
23
|
+
},
|
|
24
|
+
secondary: {
|
|
25
|
+
root: 'bg-secondary text-on-secondary',
|
|
26
|
+
icon: 'text-on-secondary',
|
|
27
|
+
title: 'text-on-secondary'
|
|
28
|
+
},
|
|
29
|
+
tertiary: {
|
|
30
|
+
root: 'bg-tertiary text-on-tertiary',
|
|
31
|
+
icon: 'text-on-tertiary',
|
|
32
|
+
title: 'text-on-tertiary'
|
|
33
|
+
},
|
|
34
|
+
success: {
|
|
35
|
+
root: 'bg-success text-on-success',
|
|
36
|
+
icon: 'text-on-success',
|
|
37
|
+
title: 'text-on-success'
|
|
38
|
+
},
|
|
39
|
+
warning: {
|
|
40
|
+
root: 'bg-warning text-on-warning',
|
|
41
|
+
icon: 'text-on-warning',
|
|
42
|
+
title: 'text-on-warning'
|
|
43
|
+
},
|
|
44
|
+
error: {
|
|
45
|
+
root: 'bg-error text-on-error',
|
|
46
|
+
icon: 'text-on-error',
|
|
47
|
+
title: 'text-on-error'
|
|
48
|
+
},
|
|
49
|
+
info: {
|
|
50
|
+
root: 'bg-info text-on-info',
|
|
51
|
+
icon: 'text-on-info',
|
|
52
|
+
title: 'text-on-info'
|
|
53
|
+
},
|
|
54
|
+
surface: {
|
|
55
|
+
root: 'bg-inverse-surface text-inverse-on-surface',
|
|
56
|
+
icon: 'text-inverse-on-surface',
|
|
57
|
+
title: 'text-inverse-on-surface'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
to: {
|
|
61
|
+
true: '',
|
|
62
|
+
false: ''
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
compoundVariants: [
|
|
66
|
+
// -------------------------------------------------------------------
|
|
67
|
+
// Hover effects when banner is clickable (`to` is set)
|
|
68
|
+
// -------------------------------------------------------------------
|
|
69
|
+
{ color: 'primary', to: true, class: { root: 'hover:bg-primary/90' } },
|
|
70
|
+
{ color: 'secondary', to: true, class: { root: 'hover:bg-secondary/90' } },
|
|
71
|
+
{ color: 'tertiary', to: true, class: { root: 'hover:bg-tertiary/90' } },
|
|
72
|
+
{ color: 'success', to: true, class: { root: 'hover:bg-success/90' } },
|
|
73
|
+
{ color: 'warning', to: true, class: { root: 'hover:bg-warning/90' } },
|
|
74
|
+
{ color: 'error', to: true, class: { root: 'hover:bg-error/90' } },
|
|
75
|
+
{ color: 'info', to: true, class: { root: 'hover:bg-info/90' } },
|
|
76
|
+
{ color: 'surface', to: true, class: { root: 'hover:bg-inverse-surface/90' } }
|
|
77
|
+
],
|
|
78
|
+
defaultVariants: {
|
|
79
|
+
color: 'primary',
|
|
80
|
+
to: false
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
export const bannerDefaults = {
|
|
84
|
+
defaultVariants: bannerVariants.defaultVariants,
|
|
85
|
+
slots: {}
|
|
86
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Banner } from './Banner.svelte';
|