@functionalcms/svelte-components 4.36.10 → 5.0.0-beta2
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/css/functional.css +48 -1
- package/dist/auth/getMachineAccessToken.d.ts +1 -1
- package/dist/auth/getMachineAccessToken.js +1 -2
- package/dist/auth/machineAuthenticationProvider.d.ts +1 -1
- package/dist/auth/machineAuthenticationProvider.js +1 -2
- package/dist/auth/tokenRefresh.d.ts +1 -1
- package/dist/auth/tokenRefresh.js +4 -5
- package/dist/auth/types.js +4 -8
- package/dist/auth/userAuthenticationProvider.d.ts +1 -1
- package/dist/auth/userAuthenticationProvider.js +1 -2
- package/dist/components/Icon.svelte +16 -0
- package/dist/components/Icon.svelte.d.ts +9 -0
- package/dist/components/content/Markdown.svelte +2 -2
- package/dist/components/content/Markdown.svelte.d.ts +17 -4
- package/dist/components/form/Dropzone.svelte +2 -5
- package/dist/components/form/SmartForm.svelte +206 -60
- package/dist/components/form/SmartForm.svelte.d.ts +2 -2
- package/dist/components/form/form.d.ts +87 -17
- package/dist/components/form/form.js +86 -6
- package/dist/components/icons.d.ts +763 -0
- package/dist/components/icons.js +765 -0
- package/dist/components/integrations/EasyTools.svelte +1 -1
- package/dist/components/layouts/DefaultLayout.svelte +92 -41
- package/dist/components/layouts/DefaultLayout.svelte.d.ts +17 -8
- package/dist/components/layouts/FlexBox.svelte +73 -0
- package/dist/components/layouts/FlexBox.svelte.d.ts +17 -0
- package/dist/components/layouts/MenuLayout.svelte +39 -201
- package/dist/components/layouts/MenuLayout.svelte.d.ts +2 -10
- package/dist/components/layouts/StyleBox.svelte +17 -0
- package/dist/components/layouts/StyleBox.svelte.d.ts +7 -0
- package/dist/components/layouts/Well.svelte +8 -34
- package/dist/components/layouts/Well.svelte.d.ts +4 -8
- package/dist/components/layouts/menuItems.d.ts +29 -0
- package/dist/components/layouts/menuItems.js +28 -0
- package/dist/index-server.d.ts +2 -1
- package/dist/index-server.js +2 -1
- package/dist/index.d.ts +9 -47
- package/dist/index.js +8 -59
- package/dist/server-side/getServices.d.ts +8 -8
- package/dist/server-side/getServices.js +16 -27
- package/dist/server-side/handlers/paraglideHandler.d.ts +2 -0
- package/dist/server-side/handlers/paraglideHandler.js +13 -0
- package/dist/server-side/handlers/redirectPipelineHandler.d.ts +5 -0
- package/dist/server-side/{getRedirectPipeline.js → handlers/redirectPipelineHandler.js} +1 -2
- package/dist/utils/stringHash.d.ts +1 -0
- package/dist/utils/stringHash.js +7 -0
- package/package.json +28 -39
- package/css/functional.css.map +0 -1
- package/dist/components/MaterialIconSet.d.ts +0 -3819
- package/dist/components/MaterialIconSet.js +0 -3823
- package/dist/components/Styling.d.ts +0 -59
- package/dist/components/Styling.js +0 -66
- package/dist/components/blog/blog.d.ts +0 -20
- package/dist/components/blog/blog.js +0 -29
- package/dist/components/dynamic/CopyToClipboard.svelte +0 -16
- package/dist/components/dynamic/CopyToClipboard.svelte.d.ts +0 -36
- package/dist/components/dynamic/DynamicButton.d.ts +0 -1
- package/dist/components/dynamic/DynamicButton.js +0 -10
- package/dist/components/dynamic/DynamicButton.svelte +0 -33
- package/dist/components/dynamic/DynamicButton.svelte.d.ts +0 -9
- package/dist/components/form/Button.svelte +0 -389
- package/dist/components/form/Button.svelte.d.ts +0 -30
- package/dist/components/form/ChoiceInput.svelte +0 -375
- package/dist/components/form/ChoiceInput.svelte.d.ts +0 -3
- package/dist/components/form/Input.svelte +0 -461
- package/dist/components/form/Input.svelte.d.ts +0 -30
- package/dist/components/form/Select.svelte +0 -163
- package/dist/components/form/Select.svelte.d.ts +0 -21
- package/dist/components/form/Switch.svelte +0 -293
- package/dist/components/form/Switch.svelte.d.ts +0 -14
- package/dist/components/indicators/Loader.svelte +0 -114
- package/dist/components/indicators/Loader.svelte.d.ts +0 -30
- package/dist/components/indicators/Spinner.svelte +0 -109
- package/dist/components/indicators/Spinner.svelte.d.ts +0 -28
- package/dist/components/layouts/Banner.svelte +0 -26
- package/dist/components/layouts/Banner.svelte.d.ts +0 -8
- package/dist/components/layouts/FoldablePanel.svelte +0 -16
- package/dist/components/layouts/FoldablePanel.svelte.d.ts +0 -7
- package/dist/components/layouts/SimpleFooter.svelte +0 -23
- package/dist/components/layouts/SimpleFooter.svelte.d.ts +0 -8
- package/dist/components/layouts/Tabs.svelte +0 -362
- package/dist/components/layouts/Tabs.svelte.d.ts +0 -11
- package/dist/components/layouts/TwoColumnsLayout.svelte +0 -44
- package/dist/components/layouts/TwoColumnsLayout.svelte.d.ts +0 -13
- package/dist/components/layouts/menuLayout.d.ts +0 -12
- package/dist/components/layouts/menuLayout.js +0 -1
- package/dist/components/layouts/tabs.d.ts +0 -21
- package/dist/components/layouts/tabs.js +0 -13
- package/dist/components/menu/CollapsibleMenu.svelte +0 -66
- package/dist/components/menu/CollapsibleMenu.svelte.d.ts +0 -18
- package/dist/components/menu/DynamicMenu.svelte +0 -55
- package/dist/components/menu/DynamicMenu.svelte.d.ts +0 -13
- package/dist/components/menu/HamburgerMenu.svelte +0 -62
- package/dist/components/menu/HamburgerMenu.svelte.d.ts +0 -14
- package/dist/components/menu/ListMenu.svelte +0 -61
- package/dist/components/menu/ListMenu.svelte.d.ts +0 -17
- package/dist/components/menu/NavigationDrawer.svelte +0 -53
- package/dist/components/menu/NavigationDrawer.svelte.d.ts +0 -18
- package/dist/components/menu/types.d.ts +0 -23
- package/dist/components/menu/types.js +0 -35
- package/dist/components/presentation/Accordion.svelte +0 -82
- package/dist/components/presentation/Accordion.svelte.d.ts +0 -11
- package/dist/components/presentation/Card.svelte +0 -147
- package/dist/components/presentation/Card.svelte.d.ts +0 -15
- package/dist/components/presentation/Carousel.d.ts +0 -5
- package/dist/components/presentation/Carousel.js +0 -1
- package/dist/components/presentation/Carousel.svelte +0 -119
- package/dist/components/presentation/Carousel.svelte.d.ts +0 -17
- package/dist/components/presentation/Dialog.svelte +0 -75
- package/dist/components/presentation/Dialog.svelte.d.ts +0 -22
- package/dist/components/presentation/Disclose.svelte +0 -116
- package/dist/components/presentation/Disclose.svelte.d.ts +0 -11
- package/dist/components/presentation/Drawer.svelte +0 -118
- package/dist/components/presentation/Drawer.svelte.d.ts +0 -13
- package/dist/components/presentation/EmptyState.svelte +0 -67
- package/dist/components/presentation/EmptyState.svelte.d.ts +0 -10
- package/dist/components/presentation/Gallery.svelte +0 -35
- package/dist/components/presentation/Gallery.svelte.d.ts +0 -14
- package/dist/components/presentation/Link.svelte +0 -362
- package/dist/components/presentation/Link.svelte.d.ts +0 -27
- package/dist/components/utils.d.ts +0 -3
- package/dist/components/utils.js +0 -1
- package/dist/index.server.d.ts +0 -11
- package/dist/index.server.js +0 -10
- package/dist/server-side/getRedirectPipeline.d.ts +0 -6
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +0 -3
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export declare enum Justify {
|
|
2
|
-
Start = "justify-start",
|
|
3
|
-
End = "justify-end",
|
|
4
|
-
Center = "justify-center",
|
|
5
|
-
Between = "justify-between",
|
|
6
|
-
Around = "justify-around"
|
|
7
|
-
}
|
|
8
|
-
export declare enum AlignItmes {
|
|
9
|
-
Start = "items-start ",
|
|
10
|
-
End = "items-end",
|
|
11
|
-
Center = "items-center",
|
|
12
|
-
Baseline = "items-baseline",
|
|
13
|
-
Stretch = "items-stretch"
|
|
14
|
-
}
|
|
15
|
-
export declare enum Placement {
|
|
16
|
-
Start = "start",
|
|
17
|
-
End = "end",
|
|
18
|
-
Top = "top",
|
|
19
|
-
Up = "up",
|
|
20
|
-
Bottom = "bottom",
|
|
21
|
-
Content = "content"
|
|
22
|
-
}
|
|
23
|
-
export declare enum Orientation {
|
|
24
|
-
Row = "flex-row",
|
|
25
|
-
Column = "flex-column",
|
|
26
|
-
DynamicRow = "flex-row-dynamic"
|
|
27
|
-
}
|
|
28
|
-
export declare enum Position {
|
|
29
|
-
Left = 0,
|
|
30
|
-
Middle = 1,
|
|
31
|
-
Right = 2
|
|
32
|
-
}
|
|
33
|
-
export declare enum Sizes {
|
|
34
|
-
V0 = 0,
|
|
35
|
-
V2 = 2,
|
|
36
|
-
V4 = 4,
|
|
37
|
-
V6 = 6,
|
|
38
|
-
V8 = 8,
|
|
39
|
-
V10 = 10,
|
|
40
|
-
V12 = 12,
|
|
41
|
-
V14 = 14,
|
|
42
|
-
V16 = 16,
|
|
43
|
-
V18 = 18,
|
|
44
|
-
V20 = 20,
|
|
45
|
-
V24 = 24,
|
|
46
|
-
V32 = 32,
|
|
47
|
-
V36 = 36,
|
|
48
|
-
V40 = 40,
|
|
49
|
-
V48 = 48,
|
|
50
|
-
V56 = 56,
|
|
51
|
-
V64 = 64,
|
|
52
|
-
V72 = 72,
|
|
53
|
-
V80 = 80
|
|
54
|
-
}
|
|
55
|
-
export declare enum ComponentSize {
|
|
56
|
-
Small = "small",
|
|
57
|
-
Normal = "",
|
|
58
|
-
Large = "large"
|
|
59
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
export var Justify;
|
|
2
|
-
(function (Justify) {
|
|
3
|
-
Justify["Start"] = "justify-start";
|
|
4
|
-
Justify["End"] = "justify-end";
|
|
5
|
-
Justify["Center"] = "justify-center";
|
|
6
|
-
Justify["Between"] = "justify-between";
|
|
7
|
-
Justify["Around"] = "justify-around";
|
|
8
|
-
})(Justify || (Justify = {}));
|
|
9
|
-
export var AlignItmes;
|
|
10
|
-
(function (AlignItmes) {
|
|
11
|
-
AlignItmes["Start"] = "items-start ";
|
|
12
|
-
AlignItmes["End"] = "items-end";
|
|
13
|
-
AlignItmes["Center"] = "items-center";
|
|
14
|
-
AlignItmes["Baseline"] = "items-baseline";
|
|
15
|
-
AlignItmes["Stretch"] = "items-stretch";
|
|
16
|
-
})(AlignItmes || (AlignItmes = {}));
|
|
17
|
-
export var Placement;
|
|
18
|
-
(function (Placement) {
|
|
19
|
-
Placement["Start"] = "start";
|
|
20
|
-
Placement["End"] = "end";
|
|
21
|
-
Placement["Top"] = "top";
|
|
22
|
-
Placement["Up"] = "up";
|
|
23
|
-
Placement["Bottom"] = "bottom";
|
|
24
|
-
Placement["Content"] = "content";
|
|
25
|
-
})(Placement || (Placement = {}));
|
|
26
|
-
export var Orientation;
|
|
27
|
-
(function (Orientation) {
|
|
28
|
-
Orientation["Row"] = "flex-row";
|
|
29
|
-
Orientation["Column"] = "flex-column";
|
|
30
|
-
Orientation["DynamicRow"] = "flex-row-dynamic";
|
|
31
|
-
})(Orientation || (Orientation = {}));
|
|
32
|
-
export var Position;
|
|
33
|
-
(function (Position) {
|
|
34
|
-
Position[Position["Left"] = 0] = "Left";
|
|
35
|
-
Position[Position["Middle"] = 1] = "Middle";
|
|
36
|
-
Position[Position["Right"] = 2] = "Right";
|
|
37
|
-
})(Position || (Position = {}));
|
|
38
|
-
export var Sizes;
|
|
39
|
-
(function (Sizes) {
|
|
40
|
-
Sizes[Sizes["V0"] = 0] = "V0";
|
|
41
|
-
Sizes[Sizes["V2"] = 2] = "V2";
|
|
42
|
-
Sizes[Sizes["V4"] = 4] = "V4";
|
|
43
|
-
Sizes[Sizes["V6"] = 6] = "V6";
|
|
44
|
-
Sizes[Sizes["V8"] = 8] = "V8";
|
|
45
|
-
Sizes[Sizes["V10"] = 10] = "V10";
|
|
46
|
-
Sizes[Sizes["V12"] = 12] = "V12";
|
|
47
|
-
Sizes[Sizes["V14"] = 14] = "V14";
|
|
48
|
-
Sizes[Sizes["V16"] = 16] = "V16";
|
|
49
|
-
Sizes[Sizes["V18"] = 18] = "V18";
|
|
50
|
-
Sizes[Sizes["V20"] = 20] = "V20";
|
|
51
|
-
Sizes[Sizes["V24"] = 24] = "V24";
|
|
52
|
-
Sizes[Sizes["V32"] = 32] = "V32";
|
|
53
|
-
Sizes[Sizes["V36"] = 36] = "V36";
|
|
54
|
-
Sizes[Sizes["V40"] = 40] = "V40";
|
|
55
|
-
Sizes[Sizes["V48"] = 48] = "V48";
|
|
56
|
-
Sizes[Sizes["V56"] = 56] = "V56";
|
|
57
|
-
Sizes[Sizes["V64"] = 64] = "V64";
|
|
58
|
-
Sizes[Sizes["V72"] = 72] = "V72";
|
|
59
|
-
Sizes[Sizes["V80"] = 80] = "V80";
|
|
60
|
-
})(Sizes || (Sizes = {}));
|
|
61
|
-
export var ComponentSize;
|
|
62
|
-
(function (ComponentSize) {
|
|
63
|
-
ComponentSize["Small"] = "small";
|
|
64
|
-
ComponentSize["Normal"] = "";
|
|
65
|
-
ComponentSize["Large"] = "large";
|
|
66
|
-
})(ComponentSize || (ComponentSize = {}));
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export interface BlogPost {
|
|
2
|
-
slug: string;
|
|
3
|
-
title: string;
|
|
4
|
-
author: string;
|
|
5
|
-
description: string;
|
|
6
|
-
date: string;
|
|
7
|
-
published: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface MdsvexFile {
|
|
10
|
-
default: any;
|
|
11
|
-
metadata: Record<string, string>;
|
|
12
|
-
}
|
|
13
|
-
export type MdsvexResolver = () => Promise<MdsvexFile>;
|
|
14
|
-
export declare function listAllPosts(page?: number, postCount?: number): Promise<{
|
|
15
|
-
posts: BlogPost[];
|
|
16
|
-
}>;
|
|
17
|
-
export declare function importPost(loadEvent: any): Promise<{
|
|
18
|
-
component: any;
|
|
19
|
-
frontmatter: Record<string, string> | undefined;
|
|
20
|
-
}>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const MAX_POSTS = 25;
|
|
2
|
-
const slugFromPath = (path) => path.match(/([\w-]+)\.(svelte\.md|md|svx)/i)?.[1] ?? null;
|
|
3
|
-
export async function listAllPosts(page = 0, postCount = MAX_POSTS) {
|
|
4
|
-
const modules = import.meta.glob(`/src/posts/*.{md,svx,svelte.md}`);
|
|
5
|
-
const postPromises = Object.entries(modules).map(([path, resolver]) => resolver().then((post) => ({
|
|
6
|
-
slug: slugFromPath(path),
|
|
7
|
-
...post.metadata
|
|
8
|
-
})));
|
|
9
|
-
const posts = await Promise.all(postPromises);
|
|
10
|
-
const publishedPosts = posts.filter((post) => post.published).slice(page, postCount);
|
|
11
|
-
publishedPosts.sort((a, b) => (new Date(a.date) > new Date(b.date) ? -1 : 1));
|
|
12
|
-
return { posts: publishedPosts };
|
|
13
|
-
}
|
|
14
|
-
export async function importPost(loadEvent) {
|
|
15
|
-
const modules = import.meta.glob(`/src/posts/*.{md,svx,svelte.md}`);
|
|
16
|
-
let match = {};
|
|
17
|
-
for (const [path, resolver] of Object.entries(modules)) {
|
|
18
|
-
if (slugFromPath(path) === loadEvent.params.slug) {
|
|
19
|
-
match = { path, resolver: resolver };
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
const post = await match?.resolver?.();
|
|
24
|
-
return {
|
|
25
|
-
component: post?.default,
|
|
26
|
-
frontmatter: post?.metadata
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { createEventDispatcher } from "svelte";
|
|
3
|
-
|
|
4
|
-
export let text: string;
|
|
5
|
-
|
|
6
|
-
const dispatch = createEventDispatcher<{ copy: string; fail: never }>();
|
|
7
|
-
|
|
8
|
-
const copy = () => {
|
|
9
|
-
navigator.clipboard.writeText(text).then(
|
|
10
|
-
() => dispatch("copy", text),
|
|
11
|
-
(e) => dispatch("fail")
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<slot {copy} />
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
15
|
-
default: any;
|
|
16
|
-
} ? Props extends Record<string, never> ? any : {
|
|
17
|
-
children?: any;
|
|
18
|
-
} : {});
|
|
19
|
-
declare const CopyToClipboard: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
20
|
-
text: string;
|
|
21
|
-
}, {
|
|
22
|
-
default: {
|
|
23
|
-
copy: () => void;
|
|
24
|
-
};
|
|
25
|
-
}>, {
|
|
26
|
-
copy: CustomEvent<string>;
|
|
27
|
-
fail: CustomEvent<never>;
|
|
28
|
-
} & {
|
|
29
|
-
[evt: string]: CustomEvent<any>;
|
|
30
|
-
}, {
|
|
31
|
-
default: {
|
|
32
|
-
copy: () => void;
|
|
33
|
-
};
|
|
34
|
-
}, {}, string>;
|
|
35
|
-
type CopyToClipboard = InstanceType<typeof CopyToClipboard>;
|
|
36
|
-
export default CopyToClipboard;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const executeRest: (url: string, method?: "POST" | "GET" | "PUT" | "DELETE") => Promise<boolean>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export const executeRest = async (url, method = "GET") => {
|
|
2
|
-
let fetchUrl = url;
|
|
3
|
-
if (!fetchUrl.startsWith('http')) {
|
|
4
|
-
fetchUrl = window.location.origin + fetchUrl;
|
|
5
|
-
}
|
|
6
|
-
const response = await fetch(fetchUrl, {
|
|
7
|
-
method: method,
|
|
8
|
-
});
|
|
9
|
-
return response.status === 200;
|
|
10
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Button, Loader } from "@functionalcms/svelte-components";
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
label: string;
|
|
6
|
-
click: () => Promise<boolean>;
|
|
7
|
-
|
|
8
|
-
success?: () => void;
|
|
9
|
-
failure?: () => void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
let { label, click, success, failure }: Props = $props();
|
|
13
|
-
let isLoading = $derived(false);
|
|
14
|
-
|
|
15
|
-
const whenButtonIsclicked = async () => {
|
|
16
|
-
if (isLoading === false) {
|
|
17
|
-
isLoading = true;
|
|
18
|
-
|
|
19
|
-
const response = await click();
|
|
20
|
-
|
|
21
|
-
response ? success?.() : failure?.();
|
|
22
|
-
|
|
23
|
-
isLoading = false;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<Button type="button" click={whenButtonIsclicked}>
|
|
29
|
-
{#if isLoading}
|
|
30
|
-
<Loader size="small" />
|
|
31
|
-
{/if}
|
|
32
|
-
{label}
|
|
33
|
-
</Button>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
interface Props {
|
|
2
|
-
label: string;
|
|
3
|
-
click: () => Promise<boolean>;
|
|
4
|
-
success?: () => void;
|
|
5
|
-
failure?: () => void;
|
|
6
|
-
}
|
|
7
|
-
declare const DynamicButton: import("svelte").Component<Props, {}, "">;
|
|
8
|
-
type DynamicButton = ReturnType<typeof DynamicButton>;
|
|
9
|
-
export default DynamicButton;
|
|
@@ -1,389 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { cn } from '../../utils.js';
|
|
3
|
-
import type { Snippet } from 'svelte';
|
|
4
|
-
import type { EventHandler } from 'svelte/elements';
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
children: Snippet;
|
|
8
|
-
css: string;
|
|
9
|
-
style: string;
|
|
10
|
-
type?: 'submit' | 'reset' | 'button' | 'link';
|
|
11
|
-
href: string;
|
|
12
|
-
mode?: string;
|
|
13
|
-
size?: string;
|
|
14
|
-
isPrimary: boolean;
|
|
15
|
-
isBordered?: boolean;
|
|
16
|
-
isCapsule?: boolean;
|
|
17
|
-
isGrouped?: boolean;
|
|
18
|
-
isBlock?: boolean;
|
|
19
|
-
isLink?: boolean;
|
|
20
|
-
isBlank?: boolean;
|
|
21
|
-
isDisabled?: boolean;
|
|
22
|
-
role?: string;
|
|
23
|
-
isCircle?: boolean;
|
|
24
|
-
isRounded?: boolean;
|
|
25
|
-
isSkinned?: boolean;
|
|
26
|
-
ariaSelected?: boolean;
|
|
27
|
-
ariaControls?: string;
|
|
28
|
-
tabIndex?: number;
|
|
29
|
-
ariaLabel: string;
|
|
30
|
-
click?: (event: MouseEvent) => void;
|
|
31
|
-
keydown?: (event: KeyboardEvent) => void;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
let {
|
|
35
|
-
children,
|
|
36
|
-
css = '',
|
|
37
|
-
style = '',
|
|
38
|
-
href = '',
|
|
39
|
-
mode = undefined,
|
|
40
|
-
size = undefined,
|
|
41
|
-
type = 'button',
|
|
42
|
-
isPrimary = false,
|
|
43
|
-
isBordered = false,
|
|
44
|
-
isCapsule = false,
|
|
45
|
-
isGrouped = false,
|
|
46
|
-
isBlock = false,
|
|
47
|
-
isLink = false,
|
|
48
|
-
isBlank = false,
|
|
49
|
-
isDisabled = false,
|
|
50
|
-
role = undefined,
|
|
51
|
-
isCircle = false,
|
|
52
|
-
isRounded = false,
|
|
53
|
-
isSkinned = true,
|
|
54
|
-
ariaSelected = undefined,
|
|
55
|
-
ariaControls = undefined,
|
|
56
|
-
tabIndex = 0,
|
|
57
|
-
click = undefined,
|
|
58
|
-
keydown = undefined,
|
|
59
|
-
ariaLabel = '',
|
|
60
|
-
...restProps
|
|
61
|
-
}: Partial<Props> = $props();
|
|
62
|
-
|
|
63
|
-
let klasses = $derived(
|
|
64
|
-
cn(
|
|
65
|
-
isSkinned ? 'btn' : 'btn-base',
|
|
66
|
-
mode ? `btn-${mode}` : '',
|
|
67
|
-
size ? `btn-${size}` : '',
|
|
68
|
-
isBordered ? 'btn-bordered' : '',
|
|
69
|
-
isCapsule ? 'btn-capsule ' : '',
|
|
70
|
-
isGrouped ? 'btn-grouped' : '',
|
|
71
|
-
isBlock ? 'btn-block' : '',
|
|
72
|
-
isCircle ? 'btn-circle' : '',
|
|
73
|
-
isRounded ? 'btn-rounded' : '',
|
|
74
|
-
isDisabled ? 'disabled' : '',
|
|
75
|
-
isBlank ? 'btn-blank' : '',
|
|
76
|
-
isLink ? 'btn-link' : '',
|
|
77
|
-
css ? `${css}` : ''
|
|
78
|
-
)
|
|
79
|
-
);
|
|
80
|
-
</script>
|
|
81
|
-
|
|
82
|
-
{#if type == 'link'}
|
|
83
|
-
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
84
|
-
<a
|
|
85
|
-
class={klasses}
|
|
86
|
-
{href}
|
|
87
|
-
{style}
|
|
88
|
-
{role}
|
|
89
|
-
aria-selected={ariaSelected}
|
|
90
|
-
aria-controls={ariaControls}
|
|
91
|
-
aria-label={ariaLabel}
|
|
92
|
-
tabindex={tabIndex}
|
|
93
|
-
onclick={click}
|
|
94
|
-
onkeydown={keydown}
|
|
95
|
-
{...restProps}
|
|
96
|
-
>
|
|
97
|
-
{@render children?.()}
|
|
98
|
-
</a>
|
|
99
|
-
{:else}
|
|
100
|
-
<button
|
|
101
|
-
{type}
|
|
102
|
-
class={klasses}
|
|
103
|
-
{style}
|
|
104
|
-
{role}
|
|
105
|
-
aria-selected={ariaSelected}
|
|
106
|
-
aria-controls={ariaControls}
|
|
107
|
-
aria-label={ariaLabel}
|
|
108
|
-
tabindex={tabIndex}
|
|
109
|
-
disabled={isDisabled}
|
|
110
|
-
onclick={click}
|
|
111
|
-
onkeydown={keydown}
|
|
112
|
-
{...restProps}
|
|
113
|
-
>
|
|
114
|
-
{@render children?.()}
|
|
115
|
-
</button>
|
|
116
|
-
{/if}
|
|
117
|
-
|
|
118
|
-
<style>.btn-base {
|
|
119
|
-
display: inline-flex;
|
|
120
|
-
align-items: center;
|
|
121
|
-
justify-content: center;
|
|
122
|
-
white-space: nowrap;
|
|
123
|
-
user-select: none;
|
|
124
|
-
appearance: none;
|
|
125
|
-
cursor: pointer;
|
|
126
|
-
box-sizing: border-box;
|
|
127
|
-
transition-property: all;
|
|
128
|
-
transition-duration: var(--timing-medium);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.btn {
|
|
132
|
-
/* TODO test this fallback override syntax is correct */
|
|
133
|
-
display: inline-flex;
|
|
134
|
-
align-items: center;
|
|
135
|
-
justify-content: center;
|
|
136
|
-
white-space: nowrap;
|
|
137
|
-
user-select: none;
|
|
138
|
-
appearance: none;
|
|
139
|
-
cursor: pointer;
|
|
140
|
-
box-sizing: border-box;
|
|
141
|
-
transition-property: all;
|
|
142
|
-
transition-duration: var(--timing-medium);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.btn-skin,
|
|
146
|
-
.btn {
|
|
147
|
-
color: var(--btn-font-color, var(--dark));
|
|
148
|
-
background-color: var(--btn-bgcolor, var(--gray-light));
|
|
149
|
-
border-color: var(--btn-bgcolor, var(--gray-light));
|
|
150
|
-
/* seems like a reasonable default as chrome picks `outset` which results in a weird 3d effect */
|
|
151
|
-
border-style: solid;
|
|
152
|
-
border-width: var(--btn-border-size, 1px);
|
|
153
|
-
font-family: var(--btn-font-family, var(--font-family-body));
|
|
154
|
-
font-weight: var(--btn-font-weight, 400);
|
|
155
|
-
font-size: var(--btn-font-size, 1rem);
|
|
156
|
-
/* this can be overriden, but it might mess with the balance of the button heights across variants */
|
|
157
|
-
line-height: var(--line-height, var(--fluid-20, 1.25rem));
|
|
158
|
-
padding-block-start: var(--vertical-pad, 0.5rem);
|
|
159
|
-
padding-block-end: var(--vertical-pad, 0.5rem);
|
|
160
|
-
padding-inline-start: var(--side-padding, 0.75rem);
|
|
161
|
-
padding-inline-end: var(--side-padding, 0.75rem);
|
|
162
|
-
text-decoration: none;
|
|
163
|
-
text-align: center;
|
|
164
|
-
outline: none;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.btn:visited {
|
|
168
|
-
color: var(--btn-font-color, var(--dark));
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.btn:hover {
|
|
172
|
-
opacity: 85%;
|
|
173
|
-
text-decoration: none;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.btn:active {
|
|
177
|
-
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
|
|
178
|
-
text-decoration: none;
|
|
179
|
-
transition-duration: 0s;
|
|
180
|
-
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.btn:focus {
|
|
184
|
-
box-shadow: 0 0 0 var(--focus-ring-outline-width) var(--focus-ring-color);
|
|
185
|
-
/* Needed for High Contrast mode */
|
|
186
|
-
outline: var(--focus-ring-outline-width) var(--focus-ring-outline-style) var(--focus-ring-outline-color);
|
|
187
|
-
transition: box-shadow var(--timing-fast) ease-out;
|
|
188
|
-
/* In order for the focused element's box-shadow to appear above its siblings we need to
|
|
189
|
-
establish a new stacking context: https://stackoverflow.com/a/28042700 */
|
|
190
|
-
isolation: isolate;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/*
|
|
194
|
-
* Disabled State
|
|
195
|
-
*
|
|
196
|
-
* The disabled state uses the class .disabled, is-disabled,
|
|
197
|
-
* and the form attribute disabled="disabled".
|
|
198
|
-
* The use of !important is only added because this is a state
|
|
199
|
-
* that must be applied to all buttons when in a disabled state.
|
|
200
|
-
*/
|
|
201
|
-
.btn.disabled,
|
|
202
|
-
.btn:disabled {
|
|
203
|
-
top: 0 !important;
|
|
204
|
-
background: var(--btn-disabled-bg, var(--gray-mid-dark)) !important;
|
|
205
|
-
text-shadow: 0 1px 1px rgb(255, 255, 255) !important;
|
|
206
|
-
/* primary, secondary, natural, all look same when disabled; and we don't want to
|
|
207
|
-
have an inadvertant looking blue primary border when disabled so it's transparent */
|
|
208
|
-
border-color: transparent;
|
|
209
|
-
color: var(--btn-disabled-color, var(--gray-dark)) !important;
|
|
210
|
-
cursor: default !important;
|
|
211
|
-
appearance: none !important;
|
|
212
|
-
box-shadow: none !important;
|
|
213
|
-
opacity: 80% !important;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.btn-primary {
|
|
217
|
-
background-color: var(--btn-primary, var(--primary));
|
|
218
|
-
border-color: var(--btn-primary, var(--primary));
|
|
219
|
-
color: var(--btn-primary-color, var(--light));
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/* Border and font is primary. When hovered, we invert with primary background and white font */
|
|
223
|
-
.btn-primary.btn-bordered {
|
|
224
|
-
color: var(--btn-primary, var(--primary));
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
.btn-primary.btn-bordered:hover,
|
|
228
|
-
.btn-primary.btn-bordered:focus {
|
|
229
|
-
background-color: var(--btn-primary, var(--primary));
|
|
230
|
-
color: var(--btn-primary-color, var(--light));
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.btn-primary:visited {
|
|
234
|
-
color: var(--btn-primary-color, var(--light));
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.btn-secondary {
|
|
238
|
-
background-color: var(--btn-secondary, var(--secondary));
|
|
239
|
-
border-color: var(--btn-secondary, var(--secondary));
|
|
240
|
-
color: var(--btn-secondary-color, var(--light));
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/* Border and font is secondary. When hovered, we invert with secondary background and white font */
|
|
244
|
-
.btn-secondary.btn-bordered {
|
|
245
|
-
color: var(--btn-secondary, var(--secondary));
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.btn-secondary.btn-bordered:hover,
|
|
249
|
-
.btn-secondary.btn-bordered:focus {
|
|
250
|
-
background-color: var(--btn-secondary, var(--secondary));
|
|
251
|
-
color: var(--btn-secondary-color, var(--light));
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
.btn-secondary:visited {
|
|
255
|
-
color: var(--btn-secondary-color, var(--light));
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/*
|
|
259
|
-
/**
|
|
260
|
-
* Border Buttons
|
|
261
|
-
*/
|
|
262
|
-
.btn-bordered {
|
|
263
|
-
border-width: 1px;
|
|
264
|
-
background: transparent;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Sizes
|
|
269
|
-
*/
|
|
270
|
-
.btn-large {
|
|
271
|
-
font-size: calc(var(--btn-font-size, 1rem) + 0.25rem);
|
|
272
|
-
height: 3rem;
|
|
273
|
-
line-height: 3rem;
|
|
274
|
-
padding: 0 3rem;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
.btn-small {
|
|
278
|
-
font-size: calc(var(--btn-font-size, 1rem) - 0.25rem);
|
|
279
|
-
height: 2rem;
|
|
280
|
-
line-height: 2rem;
|
|
281
|
-
padding: 0 2rem;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Rounded
|
|
286
|
-
*/
|
|
287
|
-
.btn-rounded {
|
|
288
|
-
border-radius: var(--btn-radius, var(--radius, 0.25rem));
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
.btn-pill {
|
|
292
|
-
border-radius: 200px;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
/*
|
|
296
|
-
* Size Adjustment for equal height & width buttons
|
|
297
|
-
*
|
|
298
|
-
* Remove padding
|
|
299
|
-
*/
|
|
300
|
-
.btn-circle {
|
|
301
|
-
border-radius: 100%;
|
|
302
|
-
width: 2.5rem;
|
|
303
|
-
height: 2.5rem;
|
|
304
|
-
padding: 0 !important;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
.btn-circle-large {
|
|
308
|
-
font-size: calc(var(--btn-font-size, 1rem) + 0.25rem);
|
|
309
|
-
width: 3rem;
|
|
310
|
-
height: 3rem;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.btn-circle-small {
|
|
314
|
-
font-size: calc(var(--btn-font-size, 1rem) - 0.25rem);
|
|
315
|
-
width: 2rem;
|
|
316
|
-
height: 2rem;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Button Block (stacked)
|
|
321
|
-
*/
|
|
322
|
-
.btn-block {
|
|
323
|
-
width: 100%;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
/* This is a utility class used if you literally want to stack block buttons one after another.
|
|
327
|
-
Apply this class to the nth-of-type(2) onwards to ensure the borders line up properly. */
|
|
328
|
-
.btn-block-following {
|
|
329
|
-
margin-block-start: -1px;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
.btn-grouped {
|
|
333
|
-
border-radius: var(--btn-radius, var(--radius, 0.25rem));
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
.btn-grouped:not(:last-child) {
|
|
337
|
-
border-top-right-radius: 0;
|
|
338
|
-
border-bottom-right-radius: 0;
|
|
339
|
-
margin-inline-end: -1px;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
.btn-grouped:not(:first-child) {
|
|
343
|
-
border-top-left-radius: 0;
|
|
344
|
-
border-bottom-left-radius: 0;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
.btn-capsule {
|
|
348
|
-
--padding-side: calc(var(--side-padding, 0.75rem) * 1.5);
|
|
349
|
-
border-radius: var(--radius-capsule);
|
|
350
|
-
padding-inline-start: var(--padding-side);
|
|
351
|
-
padding-inline-end: var(--padding-side);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
@media (prefers-reduced-motion), (update: slow) {
|
|
355
|
-
.btn,
|
|
356
|
-
.btn:focus {
|
|
357
|
-
transition-duration: 0.001ms !important;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Invisible buttons. Generally used for a Cancel or icon button that behaves like a button,
|
|
362
|
-
* semantically and for a11y, but, does so without all the typical "button chrome" behind it.
|
|
363
|
-
*/
|
|
364
|
-
:is(.btn-link, .btn-blank) {
|
|
365
|
-
font-family: var(--btn-font-family, var(--font-family-body));
|
|
366
|
-
font-size: var(--btn-font-size, 1rem);
|
|
367
|
-
background-color: transparent;
|
|
368
|
-
border: 0;
|
|
369
|
-
border-radius: 0;
|
|
370
|
-
box-shadow: none;
|
|
371
|
-
transition: none;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
/* Since blank buttons can be used for things like input addons we don't want to go crazy
|
|
375
|
-
on the side padding. As such, these have a good bit less then regular buttons. */
|
|
376
|
-
.btn-blank {
|
|
377
|
-
--btn-blank-side-padding: var(--btn-blank-side-padding, 0.25rem);
|
|
378
|
-
padding-inline-start: var(--btn-blank-side-padding);
|
|
379
|
-
padding-inline-end: var(--btn-blank-side-padding);
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
/* A button blank with link color text */
|
|
383
|
-
.btn-link {
|
|
384
|
-
color: var(--btn-primary, var(--primary));
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
.btn-link:hover {
|
|
388
|
-
cursor: pointer;
|
|
389
|
-
}</style>
|