lutra 0.0.20 → 0.1.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/README.md +4 -24
- package/dist/components/AspectRatio.svelte +26 -0
- package/dist/components/AspectRatio.svelte.d.ts +8 -0
- package/dist/components/Dialog.svelte +78 -0
- package/dist/components/Dialog.svelte.d.ts +14 -0
- package/dist/components/Layout.svelte +32 -0
- package/dist/components/Layout.svelte.d.ts +11 -0
- package/dist/components/PageContent.svelte +108 -0
- package/dist/components/PageContent.svelte.d.ts +38 -0
- package/dist/components/Theme.svelte +87 -0
- package/dist/components/Theme.svelte.d.ts +17 -0
- package/dist/{display → components}/Tooltip.svelte +37 -11
- package/dist/components/Tooltip.svelte.d.ts +12 -0
- package/dist/config.d.ts +30 -0
- package/dist/config.js +18 -0
- package/dist/css/0-layers.css +1 -0
- package/dist/css/1-props.css +775 -0
- package/dist/css/2-base.css +209 -0
- package/dist/css/3-typo.css +65 -0
- package/dist/css/4-layout.css +5 -0
- package/dist/css/5-media.css +21 -0
- package/dist/css/lutra.css +6 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -2
- package/dist/types.d.ts +39 -0
- package/dist/types.js +25 -0
- package/package.json +29 -75
- package/dist/data/Stat.svelte +0 -89
- package/dist/data/Stat.svelte.d.ts +0 -39
- package/dist/data/index.d.ts +0 -1
- package/dist/data/index.js +0 -1
- package/dist/display/Avatar.svelte +0 -61
- package/dist/display/Avatar.svelte.d.ts +0 -23
- package/dist/display/Badge.svelte +0 -93
- package/dist/display/Badge.svelte.d.ts +0 -34
- package/dist/display/Callout.svelte +0 -109
- package/dist/display/Callout.svelte.d.ts +0 -36
- package/dist/display/Close.svelte +0 -58
- package/dist/display/Close.svelte.d.ts +0 -21
- package/dist/display/Code.svelte +0 -195
- package/dist/display/Code.svelte.d.ts +0 -31
- package/dist/display/ContextTip.svelte +0 -26
- package/dist/display/ContextTip.svelte.d.ts +0 -22
- package/dist/display/Details.svelte +0 -49
- package/dist/display/Details.svelte.d.ts +0 -32
- package/dist/display/Hero.svelte +0 -50
- package/dist/display/Hero.svelte.d.ts +0 -30
- package/dist/display/Icon.svelte +0 -40
- package/dist/display/Icon.svelte.d.ts +0 -24
- package/dist/display/IconButton.svelte +0 -84
- package/dist/display/IconButton.svelte.d.ts +0 -30
- package/dist/display/Image.svelte +0 -91
- package/dist/display/Image.svelte.d.ts +0 -37
- package/dist/display/Indicator.svelte +0 -352
- package/dist/display/Indicator.svelte.d.ts +0 -24
- package/dist/display/Inset.svelte +0 -18
- package/dist/display/Inset.svelte.d.ts +0 -22
- package/dist/display/Notification.svelte +0 -104
- package/dist/display/Notification.svelte.d.ts +0 -42
- package/dist/display/Popup.svelte +0 -111
- package/dist/display/Popup.svelte.d.ts +0 -30
- package/dist/display/Table.svelte +0 -24
- package/dist/display/Table.svelte.d.ts +0 -34
- package/dist/display/Tag.svelte +0 -90
- package/dist/display/Tag.svelte.d.ts +0 -35
- package/dist/display/Tooltip.svelte.d.ts +0 -28
- package/dist/display/index.d.ts +0 -14
- package/dist/display/index.js +0 -14
- package/dist/display/notifications.svelte.d.ts +0 -21
- package/dist/display/notifications.svelte.js +0 -31
- package/dist/form/Button.svelte +0 -34
- package/dist/form/Button.svelte.d.ts +0 -36
- package/dist/form/FieldActions.svelte +0 -46
- package/dist/form/FieldActions.svelte.d.ts +0 -24
- package/dist/form/FieldContainer.svelte +0 -37
- package/dist/form/FieldContainer.svelte.d.ts +0 -24
- package/dist/form/FieldContent.svelte +0 -134
- package/dist/form/FieldContent.svelte.d.ts +0 -59
- package/dist/form/FieldError.svelte +0 -14
- package/dist/form/FieldError.svelte.d.ts +0 -21
- package/dist/form/FieldSection.svelte +0 -86
- package/dist/form/FieldSection.svelte.d.ts +0 -34
- package/dist/form/Fieldset.svelte +0 -68
- package/dist/form/Fieldset.svelte.d.ts +0 -42
- package/dist/form/Form.svelte +0 -98
- package/dist/form/Form.svelte.d.ts +0 -33
- package/dist/form/Input.svelte +0 -287
- package/dist/form/Input.svelte.d.ts +0 -142
- package/dist/form/InputLength.svelte +0 -32
- package/dist/form/InputLength.svelte.d.ts +0 -21
- package/dist/form/Label.svelte +0 -27
- package/dist/form/Label.svelte.d.ts +0 -31
- package/dist/form/Select.svelte +0 -88
- package/dist/form/Select.svelte.d.ts +0 -97
- package/dist/form/client.svelte.d.ts +0 -45
- package/dist/form/client.svelte.js +0 -90
- package/dist/form/form.d.ts +0 -52
- package/dist/form/form.js +0 -326
- package/dist/form/index.d.ts +0 -15
- package/dist/form/index.js +0 -15
- package/dist/form/types.d.ts +0 -52
- package/dist/form/types.js +0 -1
- package/dist/grid/Column.svelte +0 -11
- package/dist/grid/Column.svelte.d.ts +0 -22
- package/dist/grid/Grid.svelte +0 -19
- package/dist/grid/Grid.svelte.d.ts +0 -24
- package/dist/grid/Row.svelte +0 -44
- package/dist/grid/Row.svelte.d.ts +0 -24
- package/dist/icons/Alert.svelte +0 -3
- package/dist/icons/Alert.svelte.d.ts +0 -23
- package/dist/icons/Copy.svelte +0 -3
- package/dist/icons/Copy.svelte.d.ts +0 -23
- package/dist/icons/Done.svelte +0 -3
- package/dist/icons/Done.svelte.d.ts +0 -23
- package/dist/icons/Error.svelte +0 -3
- package/dist/icons/Error.svelte.d.ts +0 -23
- package/dist/icons/Help.svelte +0 -3
- package/dist/icons/Help.svelte.d.ts +0 -23
- package/dist/icons/Hide.svelte +0 -3
- package/dist/icons/Hide.svelte.d.ts +0 -23
- package/dist/icons/Info.svelte +0 -3
- package/dist/icons/Info.svelte.d.ts +0 -23
- package/dist/icons/Link.svelte +0 -3
- package/dist/icons/Link.svelte.d.ts +0 -23
- package/dist/icons/MenuBurger.svelte +0 -3
- package/dist/icons/MenuBurger.svelte.d.ts +0 -23
- package/dist/icons/MenuDots.svelte +0 -3
- package/dist/icons/MenuDots.svelte.d.ts +0 -23
- package/dist/icons/Show.svelte +0 -3
- package/dist/icons/Show.svelte.d.ts +0 -23
- package/dist/icons/Success.svelte +0 -3
- package/dist/icons/Success.svelte.d.ts +0 -23
- package/dist/icons/Warning.svelte +0 -3
- package/dist/icons/Warning.svelte.d.ts +0 -23
- package/dist/icons/index.d.ts +0 -11
- package/dist/icons/index.js +0 -11
- package/dist/layout/Layout.svelte +0 -45
- package/dist/layout/Layout.svelte.d.ts +0 -25
- package/dist/layout/LayoutFooter.svelte +0 -21
- package/dist/layout/LayoutFooter.svelte.d.ts +0 -19
- package/dist/layout/LayoutGrid.svelte +0 -51
- package/dist/layout/LayoutGrid.svelte.d.ts +0 -38
- package/dist/layout/LayoutHeader.svelte +0 -94
- package/dist/layout/LayoutHeader.svelte.d.ts +0 -39
- package/dist/layout/LayoutSideMenu.svelte +0 -54
- package/dist/layout/LayoutSideMenu.svelte.d.ts +0 -25
- package/dist/layout/LayoutTypes.d.ts +0 -15
- package/dist/layout/LayoutTypes.js +0 -9
- package/dist/layout/Overlay.svelte +0 -20
- package/dist/layout/Overlay.svelte.d.ts +0 -35
- package/dist/layout/OverlayContainer.svelte +0 -28
- package/dist/layout/OverlayContainer.svelte.d.ts +0 -16
- package/dist/layout/OverlayLayer.svelte +0 -145
- package/dist/layout/OverlayLayer.svelte.d.ts +0 -22
- package/dist/layout/PageContent.svelte +0 -97
- package/dist/layout/PageContent.svelte.d.ts +0 -28
- package/dist/layout/Theme.svelte +0 -228
- package/dist/layout/Theme.svelte.d.ts +0 -24
- package/dist/layout/UIContent.svelte +0 -15
- package/dist/layout/UIContent.svelte.d.ts +0 -22
- package/dist/layout/index.d.ts +0 -7
- package/dist/layout/index.js +0 -7
- package/dist/layout/overlays.svelte.d.ts +0 -34
- package/dist/layout/overlays.svelte.js +0 -44
- package/dist/nav/Breadcrumb.svelte +0 -82
- package/dist/nav/Breadcrumb.svelte.d.ts +0 -33
- package/dist/nav/Menu.svelte +0 -177
- package/dist/nav/Menu.svelte.d.ts +0 -33
- package/dist/nav/MenuItem.svelte +0 -140
- package/dist/nav/MenuItem.svelte.d.ts +0 -26
- package/dist/nav/MenuTypes.d.ts +0 -58
- package/dist/nav/MenuTypes.js +0 -1
- package/dist/nav/NavMenu.svelte +0 -183
- package/dist/nav/NavMenu.svelte.d.ts +0 -20
- package/dist/nav/TabbedContent.svelte +0 -43
- package/dist/nav/TabbedContent.svelte.d.ts +0 -24
- package/dist/nav/Tabs.svelte +0 -118
- package/dist/nav/Tabs.svelte.d.ts +0 -26
- package/dist/nav/index.d.ts +0 -6
- package/dist/nav/index.js +0 -5
- package/dist/style.css +0 -853
- package/dist/typo/Clamp.svelte +0 -25
- package/dist/typo/Clamp.svelte.d.ts +0 -28
- package/dist/typo/H.svelte +0 -52
- package/dist/typo/H.svelte.d.ts +0 -32
- package/dist/typo/H1.svelte +0 -14
- package/dist/typo/H1.svelte.d.ts +0 -30
- package/dist/typo/H2.svelte +0 -14
- package/dist/typo/H2.svelte.d.ts +0 -30
- package/dist/typo/H3.svelte +0 -14
- package/dist/typo/H3.svelte.d.ts +0 -30
- package/dist/typo/H4.svelte +0 -14
- package/dist/typo/H4.svelte.d.ts +0 -30
- package/dist/typo/H5.svelte +0 -14
- package/dist/typo/H5.svelte.d.ts +0 -30
- package/dist/typo/H6.svelte +0 -14
- package/dist/typo/H6.svelte.d.ts +0 -30
- package/dist/typo/P.svelte +0 -34
- package/dist/typo/P.svelte.d.ts +0 -30
- package/dist/typo/index.d.ts +0 -9
- package/dist/typo/index.js +0 -9
- package/dist/utils/StringOrComponentOrSnippet.svelte +0 -14
- package/dist/utils/StringOrComponentOrSnippet.svelte.d.ts +0 -24
- package/dist/utils/attr.d.ts +0 -5
- package/dist/utils/attr.js +0 -21
- package/dist/utils/color.d.ts +0 -51
- package/dist/utils/color.js +0 -97
- package/dist/utils/defaults.d.ts +0 -4
- package/dist/utils/defaults.js +0 -1
- package/dist/utils/dom.d.ts +0 -15
- package/dist/utils/dom.js +0 -74
- package/dist/utils/hooks.server.d.ts +0 -2
- package/dist/utils/hooks.server.js +0 -16
- package/dist/utils/id.d.ts +0 -1
- package/dist/utils/id.js +0 -3
- package/dist/utils/index.d.ts +0 -8
- package/dist/utils/index.js +0 -5
- package/dist/utils/isSnippet.d.ts +0 -5
- package/dist/utils/isSnippet.js +0 -6
- package/dist/utils/keyboard.svelte.d.ts +0 -22
- package/dist/utils/keyboard.svelte.js +0 -161
- /package/dist/{utils → util}/transitions.d.ts +0 -0
- /package/dist/{utils → util}/transitions.js +0 -0
@@ -1,59 +0,0 @@
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
2
|
-
import type { Snippet } from "svelte";
|
3
|
-
import type { FormField, FormIssue } from "./types.js";
|
4
|
-
declare const __propDef: {
|
5
|
-
props: {
|
6
|
-
id: string;
|
7
|
-
contained?: boolean | undefined;
|
8
|
-
prefix?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
9
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
10
|
-
}) | undefined;
|
11
|
-
suffix?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
12
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
13
|
-
}) | undefined;
|
14
|
-
type?: string | undefined;
|
15
|
-
label?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
16
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
17
|
-
}) | undefined;
|
18
|
-
labelTip?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
19
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
20
|
-
}) | undefined;
|
21
|
-
direction?: "row" | "column" | undefined;
|
22
|
-
children: Snippet;
|
23
|
-
field?: FormField | undefined;
|
24
|
-
issue?: FormIssue | undefined;
|
25
|
-
};
|
26
|
-
events: {
|
27
|
-
[evt: string]: CustomEvent<any>;
|
28
|
-
};
|
29
|
-
slots: {};
|
30
|
-
};
|
31
|
-
export type FieldContentProps = typeof __propDef.props;
|
32
|
-
export type FieldContentEvents = typeof __propDef.events;
|
33
|
-
export type FieldContentSlots = typeof __propDef.slots;
|
34
|
-
export default class FieldContent extends SvelteComponent<FieldContentProps, FieldContentEvents, FieldContentSlots> {
|
35
|
-
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
36
|
-
id: string;
|
37
|
-
contained?: boolean | undefined;
|
38
|
-
prefix?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
39
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
40
|
-
}) | undefined;
|
41
|
-
suffix?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
42
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
43
|
-
}) | undefined;
|
44
|
-
type?: string | undefined;
|
45
|
-
label?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
46
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
47
|
-
}) | undefined;
|
48
|
-
labelTip?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
49
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
50
|
-
}) | undefined;
|
51
|
-
direction?: "row" | "column" | undefined;
|
52
|
-
children: (this: void) => typeof import("svelte").SnippetReturn & {
|
53
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
54
|
-
};
|
55
|
-
field?: FormField | undefined;
|
56
|
-
issue?: FormIssue | undefined;
|
57
|
-
}>);
|
58
|
-
}
|
59
|
-
export {};
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
2
|
-
declare const __propDef: {
|
3
|
-
props: {
|
4
|
-
code: string;
|
5
|
-
message?: string | undefined;
|
6
|
-
};
|
7
|
-
events: {
|
8
|
-
[evt: string]: CustomEvent<any>;
|
9
|
-
};
|
10
|
-
slots: {};
|
11
|
-
};
|
12
|
-
export type FieldErrorProps = typeof __propDef.props;
|
13
|
-
export type FieldErrorEvents = typeof __propDef.events;
|
14
|
-
export type FieldErrorSlots = typeof __propDef.slots;
|
15
|
-
export default class FieldError extends SvelteComponent<FieldErrorProps, FieldErrorEvents, FieldErrorSlots> {
|
16
|
-
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
17
|
-
code: string;
|
18
|
-
message?: string | undefined;
|
19
|
-
}>);
|
20
|
-
}
|
21
|
-
export {};
|
@@ -1,86 +0,0 @@
|
|
1
|
-
<script lang="ts">import H5 from "../typo/H5.svelte";
|
2
|
-
import P from "../typo/P.svelte";
|
3
|
-
let {
|
4
|
-
title,
|
5
|
-
description,
|
6
|
-
children
|
7
|
-
} = $props();
|
8
|
-
</script>
|
9
|
-
|
10
|
-
<div class="FieldSection" class:noTitle={!title && !description}>
|
11
|
-
{#if title || description}
|
12
|
-
<div class="FieldSectionTitle">
|
13
|
-
{#if title}
|
14
|
-
{#if typeof title === "string"}
|
15
|
-
<H5>{title}</H5>
|
16
|
-
{:else}
|
17
|
-
{@render title()}
|
18
|
-
{/if}
|
19
|
-
{/if}
|
20
|
-
{#if description}
|
21
|
-
{#if typeof description === "string"}
|
22
|
-
<small>{description}</small>
|
23
|
-
{:else}
|
24
|
-
{@render description()}
|
25
|
-
{/if}
|
26
|
-
{/if}
|
27
|
-
</div>
|
28
|
-
{/if}
|
29
|
-
<div class="FieldSectionFields">
|
30
|
-
{@render children()}
|
31
|
-
</div>
|
32
|
-
</div>
|
33
|
-
|
34
|
-
<style>
|
35
|
-
.FieldSection {
|
36
|
-
padding: 0;
|
37
|
-
display: grid;
|
38
|
-
grid-template-columns: subgrid;
|
39
|
-
grid-column: 1 / -1;
|
40
|
-
padding: calc(var(--fcc) * 3em);
|
41
|
-
gap: 3em;
|
42
|
-
}
|
43
|
-
.FieldSectionTitle {
|
44
|
-
display: flex;
|
45
|
-
flex-direction: column;
|
46
|
-
background-color: var(--base);
|
47
|
-
gap: 1.25em;
|
48
|
-
text-wrap: balance;
|
49
|
-
}
|
50
|
-
.FieldSection:not(:first-child) {
|
51
|
-
border-top: calc(var(--fcc) * var(--border-size)) var(--border-style) var(--border-color);
|
52
|
-
}
|
53
|
-
.FieldSectionFields {
|
54
|
-
display: grid;
|
55
|
-
gap: var(--gap, 1.5em);
|
56
|
-
}
|
57
|
-
.FieldSection.noTitle .FieldSectionFields {
|
58
|
-
grid-column: 1 / -1;
|
59
|
-
}
|
60
|
-
@media(max-width: 1280px) {
|
61
|
-
.FieldSection {
|
62
|
-
padding: 2em;
|
63
|
-
gap: 1.5em;
|
64
|
-
}
|
65
|
-
.FieldSectionTitle {
|
66
|
-
gap: 0.5em;
|
67
|
-
padding-block-end: 1.5em;
|
68
|
-
}
|
69
|
-
}
|
70
|
-
@media(max-width: 640px) {
|
71
|
-
.FieldSection {
|
72
|
-
padding: 1em;
|
73
|
-
gap: 1.5em;
|
74
|
-
}
|
75
|
-
.FieldSectionTitle {
|
76
|
-
gap: 0.5em;
|
77
|
-
padding-block-end: 1.5em;
|
78
|
-
}
|
79
|
-
}
|
80
|
-
@container (max-width: 800px) {
|
81
|
-
.FieldSectionTitle,
|
82
|
-
.FieldSectionFields {
|
83
|
-
grid-column: 1 / -1;
|
84
|
-
}
|
85
|
-
}
|
86
|
-
</style>
|
@@ -1,34 +0,0 @@
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
2
|
-
import type { Snippet } from "svelte";
|
3
|
-
declare const __propDef: {
|
4
|
-
props: {
|
5
|
-
title?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
6
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
7
|
-
}) | undefined;
|
8
|
-
description?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
9
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
10
|
-
}) | undefined;
|
11
|
-
children: Snippet;
|
12
|
-
};
|
13
|
-
events: {
|
14
|
-
[evt: string]: CustomEvent<any>;
|
15
|
-
};
|
16
|
-
slots: {};
|
17
|
-
};
|
18
|
-
export type FieldSectionProps = typeof __propDef.props;
|
19
|
-
export type FieldSectionEvents = typeof __propDef.events;
|
20
|
-
export type FieldSectionSlots = typeof __propDef.slots;
|
21
|
-
export default class FieldSection extends SvelteComponent<FieldSectionProps, FieldSectionEvents, FieldSectionSlots> {
|
22
|
-
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
23
|
-
title?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
24
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
25
|
-
}) | undefined;
|
26
|
-
description?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
27
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
28
|
-
}) | undefined;
|
29
|
-
children: (this: void) => typeof import("svelte").SnippetReturn & {
|
30
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
31
|
-
};
|
32
|
-
}>);
|
33
|
-
}
|
34
|
-
export {};
|
@@ -1,68 +0,0 @@
|
|
1
|
-
<script lang="ts">let {
|
2
|
-
fullWidth,
|
3
|
-
description,
|
4
|
-
contained,
|
5
|
-
rounded,
|
6
|
-
legend,
|
7
|
-
columns = 1,
|
8
|
-
children
|
9
|
-
} = $props();
|
10
|
-
let columnsArray = Array.isArray(columns) ? columns : [columns, columns, columns];
|
11
|
-
let lgColumns = columnsArray[0];
|
12
|
-
let mdColumns = columnsArray[1] || lgColumns;
|
13
|
-
let smColumns = columnsArray[2] || mdColumns;
|
14
|
-
</script>
|
15
|
-
|
16
|
-
<div class="FieldsetContainer">
|
17
|
-
<fieldset class:fullWidth class:rounded class:contained class="cols-{columns}" style="--lg-cols: {lgColumns}; --md-cols: {mdColumns}; --sm-cols: {smColumns}">
|
18
|
-
{#if legend}
|
19
|
-
<legend>
|
20
|
-
{#if typeof legend === 'string'}
|
21
|
-
{legend}
|
22
|
-
{:else}
|
23
|
-
{@render legend()}
|
24
|
-
{/if}
|
25
|
-
</legend>
|
26
|
-
{/if}
|
27
|
-
{#if description}
|
28
|
-
{#if typeof description === 'string'}
|
29
|
-
<small>{description}</small>
|
30
|
-
{:else}
|
31
|
-
{@render description()}
|
32
|
-
{/if}
|
33
|
-
{/if}
|
34
|
-
{@render children()}
|
35
|
-
</fieldset>
|
36
|
-
</div>
|
37
|
-
|
38
|
-
<style>
|
39
|
-
.FieldsetContainer {
|
40
|
-
container-type: inline-size;
|
41
|
-
}
|
42
|
-
fieldset {
|
43
|
-
display: grid;
|
44
|
-
width: var(--width, fit-content);
|
45
|
-
grid-template-columns: repeat(var(--lg-cols), 1fr);
|
46
|
-
gap: var(--gap, 1.5em);
|
47
|
-
}
|
48
|
-
legend {
|
49
|
-
font-weight: 500;
|
50
|
-
font-size: var(--font-size, 1em);
|
51
|
-
}
|
52
|
-
fieldset.contained {
|
53
|
-
padding: 1.5em;
|
54
|
-
}
|
55
|
-
fieldset.fullWidth {
|
56
|
-
width: 100%;
|
57
|
-
}
|
58
|
-
@container(max-width: 960px) {
|
59
|
-
fieldset {
|
60
|
-
grid-template-columns: repeat(var(--md-cols), 1fr);
|
61
|
-
}
|
62
|
-
}
|
63
|
-
@container(max-width: 640px) {
|
64
|
-
fieldset {
|
65
|
-
grid-template-columns: repeat(var(--sm-cols), 1fr);
|
66
|
-
}
|
67
|
-
}
|
68
|
-
</style>
|
@@ -1,42 +0,0 @@
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
2
|
-
import type { Snippet } from "svelte";
|
3
|
-
declare const __propDef: {
|
4
|
-
props: {
|
5
|
-
fullWidth?: boolean | undefined;
|
6
|
-
description?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
7
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
8
|
-
}) | undefined;
|
9
|
-
contained?: boolean | undefined;
|
10
|
-
rounded?: boolean | undefined;
|
11
|
-
legend?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
12
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
13
|
-
}) | undefined;
|
14
|
-
columns?: number | [number] | [number, number] | [number, number, number] | undefined;
|
15
|
-
children: Snippet;
|
16
|
-
};
|
17
|
-
events: {
|
18
|
-
[evt: string]: CustomEvent<any>;
|
19
|
-
};
|
20
|
-
slots: {};
|
21
|
-
};
|
22
|
-
export type FieldsetProps = typeof __propDef.props;
|
23
|
-
export type FieldsetEvents = typeof __propDef.events;
|
24
|
-
export type FieldsetSlots = typeof __propDef.slots;
|
25
|
-
export default class Fieldset extends SvelteComponent<FieldsetProps, FieldsetEvents, FieldsetSlots> {
|
26
|
-
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
27
|
-
fullWidth?: boolean | undefined;
|
28
|
-
description?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
29
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
30
|
-
}) | undefined;
|
31
|
-
contained?: boolean | undefined;
|
32
|
-
rounded?: boolean | undefined;
|
33
|
-
legend?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
34
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
35
|
-
}) | undefined;
|
36
|
-
columns?: number | [number] | [number, number] | [number, number, number] | undefined;
|
37
|
-
children: (this: void) => typeof import("svelte").SnippetReturn & {
|
38
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
39
|
-
};
|
40
|
-
}>);
|
41
|
-
}
|
42
|
-
export {};
|
package/dist/form/Form.svelte
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
<script lang="ts">import { enhance } from "$app/forms";
|
2
|
-
import UiContent from "../layout/UIContent.svelte";
|
3
|
-
import { Bodyguard } from "@auth70/bodyguard";
|
4
|
-
import { onMount, setContext } from "svelte";
|
5
|
-
import { get } from "svelte/store";
|
6
|
-
import { dezerialize } from "@auth70/zodex-esm";
|
7
|
-
import { array } from "zod";
|
8
|
-
import { arrayPathToStringPath, getIndividualValidators, parseFormIssues } from "./form.js";
|
9
|
-
import { useForm } from "./client.svelte.js";
|
10
|
-
let {
|
11
|
-
form: _form,
|
12
|
-
action,
|
13
|
-
enctype = "multipart/form-data",
|
14
|
-
method = "POST",
|
15
|
-
fullWidth = false,
|
16
|
-
children
|
17
|
-
} = $props();
|
18
|
-
let form = $state(_form ? useForm(_form) : null);
|
19
|
-
setContext("form", form?.form);
|
20
|
-
setContext("form.validators", getIndividualValidators(form?.form));
|
21
|
-
const schema = form?.form.schema ? dezerialize(form?.form.schema) : null;
|
22
|
-
const bodyguard = new Bodyguard();
|
23
|
-
let formEl;
|
24
|
-
function setFormIssuesAndFields(issues, fields) {
|
25
|
-
if (form) {
|
26
|
-
form.form.issues = issues;
|
27
|
-
form.form.fields = fields;
|
28
|
-
}
|
29
|
-
}
|
30
|
-
async function validate() {
|
31
|
-
if (form && schema) {
|
32
|
-
form.form.tainted = true;
|
33
|
-
const req = new Request("localhost", {
|
34
|
-
method: "POST",
|
35
|
-
body: new FormData(formEl)
|
36
|
-
});
|
37
|
-
const result = await bodyguard.softForm(req, schema.parse);
|
38
|
-
if (result.success === true) {
|
39
|
-
form.form.valid = true;
|
40
|
-
form.form.issues = [];
|
41
|
-
} else {
|
42
|
-
form.form.valid = false;
|
43
|
-
form.form.issues = parseFormIssues(result.error.issues);
|
44
|
-
}
|
45
|
-
}
|
46
|
-
}
|
47
|
-
onMount(() => {
|
48
|
-
validate();
|
49
|
-
});
|
50
|
-
</script>
|
51
|
-
|
52
|
-
<UiContent>
|
53
|
-
<form
|
54
|
-
{method}
|
55
|
-
{action}
|
56
|
-
{enctype}
|
57
|
-
bind:this={formEl}
|
58
|
-
onchange={validate}
|
59
|
-
use:enhance={({ formElement, formData, action, cancel, submitter }) => {
|
60
|
-
// `formElement` is this `<form>` element
|
61
|
-
// `formData` is its `FormData` object that's about to be submitted
|
62
|
-
// `action` is the URL to which the form is posted
|
63
|
-
// calling `cancel()` will prevent the submission
|
64
|
-
// `submitter` is the `HTMLElement` that caused the form to be submitted
|
65
|
-
|
66
|
-
return async ({ result, update }) => {
|
67
|
-
// `result` is an `ActionResult` object
|
68
|
-
// `update` is a function which triggers the default logic that would be triggered if this callback wasn't set
|
69
|
-
console.log('result', result);
|
70
|
-
const resultForm = result.type !== "redirect" && result.type !== "error" ? result?.data?.form : null;
|
71
|
-
if(result.type === "success") {
|
72
|
-
if(resultForm && form) {
|
73
|
-
form.form.valid = Object.assign({ valid: false }, resultForm).valid ?? false;
|
74
|
-
}
|
75
|
-
update();
|
76
|
-
} else if(result.type === "failure") {
|
77
|
-
if(resultForm && form) {
|
78
|
-
setFormIssuesAndFields(
|
79
|
-
Object.assign({ issues: [] }, resultForm).issues, // Have to assign to avoid type error as we cant use `as` here
|
80
|
-
Object.assign({ fields: [] }, resultForm).fields,
|
81
|
-
);
|
82
|
-
}
|
83
|
-
} else if(result.type === "error") {
|
84
|
-
console.error('[lutra] Error from form enhance call', result.error);
|
85
|
-
} else if(result.type === "redirect") {
|
86
|
-
window.location.href = result.location;
|
87
|
-
}
|
88
|
-
};
|
89
|
-
}}
|
90
|
-
>
|
91
|
-
{@render children()}
|
92
|
-
</form>
|
93
|
-
</UiContent>
|
94
|
-
|
95
|
-
<style>
|
96
|
-
form {
|
97
|
-
}
|
98
|
-
</style>
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
2
|
-
import type { Snippet } from "svelte";
|
3
|
-
import type { Form } from "./types.js";
|
4
|
-
declare const __propDef: {
|
5
|
-
props: {
|
6
|
-
form?: Form<any> | undefined;
|
7
|
-
action?: string | undefined;
|
8
|
-
enctype?: "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain" | undefined;
|
9
|
-
method?: "GET" | "POST" | undefined;
|
10
|
-
fullWidth?: boolean | undefined;
|
11
|
-
children: Snippet;
|
12
|
-
};
|
13
|
-
events: {
|
14
|
-
[evt: string]: CustomEvent<any>;
|
15
|
-
};
|
16
|
-
slots: {};
|
17
|
-
};
|
18
|
-
export type FormProps = typeof __propDef.props;
|
19
|
-
export type FormEvents = typeof __propDef.events;
|
20
|
-
export type FormSlots = typeof __propDef.slots;
|
21
|
-
export default class Form extends SvelteComponent<FormProps, FormEvents, FormSlots> {
|
22
|
-
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
23
|
-
form?: Form<any> | undefined;
|
24
|
-
action?: string | undefined;
|
25
|
-
enctype?: "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain" | undefined;
|
26
|
-
method?: "GET" | "POST" | undefined;
|
27
|
-
fullWidth?: boolean | undefined;
|
28
|
-
children: (this: void) => typeof import("svelte").SnippetReturn & {
|
29
|
-
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
30
|
-
};
|
31
|
-
}>);
|
32
|
-
}
|
33
|
-
export {};
|