@revenuecat/purchases-ui-js 0.0.8
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/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/components/button/Button.svelte +33 -0
- package/dist/components/button/Button.svelte.d.ts +8 -0
- package/dist/components/button/ButtonNode.stories.svelte +204 -0
- package/dist/components/button/ButtonNode.stories.svelte.d.ts +27 -0
- package/dist/components/button/ButtonNode.svelte +15 -0
- package/dist/components/button/ButtonNode.svelte.d.ts +3 -0
- package/dist/components/footer/Footer.stories.svelte +237 -0
- package/dist/components/footer/Footer.stories.svelte.d.ts +25 -0
- package/dist/components/footer/Footer.svelte +11 -0
- package/dist/components/footer/Footer.svelte.d.ts +3 -0
- package/dist/components/image/Image.stories.svelte +165 -0
- package/dist/components/image/Image.stories.svelte.d.ts +19 -0
- package/dist/components/image/Image.svelte +45 -0
- package/dist/components/image/Image.svelte.d.ts +3 -0
- package/dist/components/image/image-utils.d.ts +20 -0
- package/dist/components/image/image-utils.js +19 -0
- package/dist/components/package/Package.stories.svelte +243 -0
- package/dist/components/package/Package.stories.svelte.d.ts +25 -0
- package/dist/components/package/Package.svelte +39 -0
- package/dist/components/package/Package.svelte.d.ts +3 -0
- package/dist/components/paywall/Node.svelte +55 -0
- package/dist/components/paywall/Node.svelte.d.ts +9 -0
- package/dist/components/paywall/Paywall.stories.svelte +24 -0
- package/dist/components/paywall/Paywall.stories.svelte.d.ts +19 -0
- package/dist/components/paywall/Paywall.svelte +122 -0
- package/dist/components/paywall/Paywall.svelte.d.ts +6 -0
- package/dist/components/paywall/global-styles.css +9 -0
- package/dist/components/purchase-button/PurchaseButton.stories.svelte +133 -0
- package/dist/components/purchase-button/PurchaseButton.stories.svelte.d.ts +24 -0
- package/dist/components/purchase-button/PurchaseButton.svelte +28 -0
- package/dist/components/purchase-button/PurchaseButton.svelte.d.ts +3 -0
- package/dist/components/stack/Stack.stories.svelte +306 -0
- package/dist/components/stack/Stack.stories.svelte.d.ts +19 -0
- package/dist/components/stack/Stack.svelte +61 -0
- package/dist/components/stack/Stack.svelte.d.ts +3 -0
- package/dist/components/stack/stack-utils.d.ts +29 -0
- package/dist/components/stack/stack-utils.js +26 -0
- package/dist/components/text/Text.stories.svelte +101 -0
- package/dist/components/text/Text.stories.svelte.d.ts +19 -0
- package/dist/components/text/Text.svelte +40 -0
- package/dist/components/text/Text.svelte.d.ts +3 -0
- package/dist/components/text/text-utils.d.ts +20 -0
- package/dist/components/text/text-utils.js +34 -0
- package/dist/data/entities.d.ts +139 -0
- package/dist/data/entities.js +1 -0
- package/dist/data/state.d.ts +3 -0
- package/dist/data/state.js +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +11 -0
- package/dist/stores/theme.d.ts +1 -0
- package/dist/stores/theme.js +17 -0
- package/dist/stories/fixtures.d.ts +12 -0
- package/dist/stories/fixtures.js +6855 -0
- package/dist/stories/meta-templates.d.ts +13 -0
- package/dist/stories/meta-templates.js +156 -0
- package/dist/types.d.ts +125 -0
- package/dist/types.js +61 -0
- package/dist/utils.d.ts +93 -0
- package/dist/utils.js +227 -0
- package/package.json +91 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Paywall from "./Paywall.svelte";
|
|
2
|
+
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> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Paywall: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Paywall = InstanceType<typeof Paywall>;
|
|
19
|
+
export default Paywall;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type {
|
|
3
|
+
Extra,
|
|
4
|
+
PaywallData,
|
|
5
|
+
SupportedActions,
|
|
6
|
+
} from "../../data/entities";
|
|
7
|
+
|
|
8
|
+
import Node from "./Node.svelte";
|
|
9
|
+
import type { PurchaseState } from "../../data/state";
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
data: PaywallData;
|
|
13
|
+
onPurchaseClicked: (selectedPackageId: string) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const findSelectedPackage = (data: PaywallData) => {
|
|
17
|
+
return undefined;
|
|
18
|
+
};
|
|
19
|
+
const { data, onPurchaseClicked }: Props = $props();
|
|
20
|
+
|
|
21
|
+
let purchaseState: PurchaseState = $state({
|
|
22
|
+
selectedPackageId: findSelectedPackage(data),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const onSelectPackageAction = (action: SupportedActions, data?: Extra) => {
|
|
26
|
+
purchaseState.selectedPackageId = data?.packageId;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const onPurchaseAction = (action: SupportedActions, data?: Extra) => {
|
|
30
|
+
if (purchaseState.selectedPackageId === undefined) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
onPurchaseClicked(purchaseState.selectedPackageId);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const onAction = (action: SupportedActions, data?: Extra) => {
|
|
37
|
+
switch (action.type) {
|
|
38
|
+
case "select_package":
|
|
39
|
+
onSelectPackageAction(action, data);
|
|
40
|
+
break;
|
|
41
|
+
case "purchase":
|
|
42
|
+
onPurchaseAction(action, data);
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
alert(action.type);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<div>
|
|
52
|
+
<Node
|
|
53
|
+
{onAction}
|
|
54
|
+
nodeData={data.components_config.base.stack}
|
|
55
|
+
labels={data.components_localizations}
|
|
56
|
+
{purchaseState}
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<style>
|
|
61
|
+
/* 1. Use a more-intuitive box-sizing model */
|
|
62
|
+
*,
|
|
63
|
+
*::before,
|
|
64
|
+
*::after {
|
|
65
|
+
box-sizing: border-box;
|
|
66
|
+
}
|
|
67
|
+
/* 2. Remove default margin */
|
|
68
|
+
* {
|
|
69
|
+
margin: 0;
|
|
70
|
+
}
|
|
71
|
+
body {
|
|
72
|
+
/* 3. Add accessible line-height */
|
|
73
|
+
line-height: 1.5;
|
|
74
|
+
/* 4. Improve text rendering */
|
|
75
|
+
-webkit-font-smoothing: antialiased;
|
|
76
|
+
}
|
|
77
|
+
/* 5. Improve media defaults */
|
|
78
|
+
img,
|
|
79
|
+
picture,
|
|
80
|
+
video,
|
|
81
|
+
canvas,
|
|
82
|
+
svg {
|
|
83
|
+
display: block;
|
|
84
|
+
max-width: 100%;
|
|
85
|
+
}
|
|
86
|
+
/* 6. Inherit fonts for form controls */
|
|
87
|
+
input,
|
|
88
|
+
button,
|
|
89
|
+
textarea,
|
|
90
|
+
select {
|
|
91
|
+
font: inherit;
|
|
92
|
+
}
|
|
93
|
+
/* 7. Avoid text overflows */
|
|
94
|
+
p,
|
|
95
|
+
h1,
|
|
96
|
+
h2,
|
|
97
|
+
h3,
|
|
98
|
+
h4,
|
|
99
|
+
h5,
|
|
100
|
+
h6 {
|
|
101
|
+
overflow-wrap: break-word;
|
|
102
|
+
}
|
|
103
|
+
/* 8. Improve line wrapping */
|
|
104
|
+
p {
|
|
105
|
+
text-wrap: pretty;
|
|
106
|
+
}
|
|
107
|
+
h1,
|
|
108
|
+
h2,
|
|
109
|
+
h3,
|
|
110
|
+
h4,
|
|
111
|
+
h5,
|
|
112
|
+
h6 {
|
|
113
|
+
text-wrap: balance;
|
|
114
|
+
}
|
|
115
|
+
/*
|
|
116
|
+
9. Create a root stacking context
|
|
117
|
+
*/
|
|
118
|
+
#root,
|
|
119
|
+
#__next {
|
|
120
|
+
isolation: isolate;
|
|
121
|
+
}
|
|
122
|
+
</style>
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import PurchaseButton from "./PurchaseButton.svelte";
|
|
4
|
+
import { colorModeStoryMeta } from "../../stories/meta-templates";
|
|
5
|
+
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
title: "Components/PurchaseButton",
|
|
8
|
+
component: PurchaseButton,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
argTypes: {
|
|
11
|
+
colorMode: colorModeStoryMeta,
|
|
12
|
+
stack: {
|
|
13
|
+
control: { type: "object" },
|
|
14
|
+
description: "Stack configuration for button content",
|
|
15
|
+
table: {
|
|
16
|
+
type: {
|
|
17
|
+
summary: "object",
|
|
18
|
+
detail: "StackProps",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const labelsData = {
|
|
26
|
+
en_US: {
|
|
27
|
+
"6gpcQ4q6T8": "Continue",
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<!-- Default button -->
|
|
33
|
+
<Story
|
|
34
|
+
name="Default button"
|
|
35
|
+
args={{
|
|
36
|
+
id: "mjaE9fOv5z",
|
|
37
|
+
name: "Purchase_button",
|
|
38
|
+
stack: {
|
|
39
|
+
background_color: {
|
|
40
|
+
light: {
|
|
41
|
+
type: "hex",
|
|
42
|
+
value: "#a229f3",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
border: null,
|
|
46
|
+
components: [
|
|
47
|
+
{
|
|
48
|
+
background_color: null,
|
|
49
|
+
color: {
|
|
50
|
+
light: {
|
|
51
|
+
type: "hex",
|
|
52
|
+
value: "#ffffff",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
labels: labelsData,
|
|
56
|
+
components: [],
|
|
57
|
+
font_name: null,
|
|
58
|
+
font_size: "heading_m",
|
|
59
|
+
font_weight: "extra_bold",
|
|
60
|
+
horizontal_alignment: "center",
|
|
61
|
+
id: "MI_dDBpD4z",
|
|
62
|
+
margin: {
|
|
63
|
+
bottom: 0,
|
|
64
|
+
leading: 0,
|
|
65
|
+
top: 0,
|
|
66
|
+
trailing: 0,
|
|
67
|
+
},
|
|
68
|
+
name: "Text",
|
|
69
|
+
padding: {
|
|
70
|
+
bottom: 0,
|
|
71
|
+
leading: 0,
|
|
72
|
+
top: 0,
|
|
73
|
+
trailing: 0,
|
|
74
|
+
},
|
|
75
|
+
size: {
|
|
76
|
+
height: {
|
|
77
|
+
type: "fit",
|
|
78
|
+
value: null,
|
|
79
|
+
},
|
|
80
|
+
width: {
|
|
81
|
+
type: "fill",
|
|
82
|
+
value: null,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
text_lid: "6gpcQ4q6T8",
|
|
86
|
+
type: "text",
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
dimension: {
|
|
90
|
+
alignment: "leading",
|
|
91
|
+
distribution: "space_between",
|
|
92
|
+
type: "vertical",
|
|
93
|
+
},
|
|
94
|
+
id: "pbvAUBvilP",
|
|
95
|
+
margin: {
|
|
96
|
+
bottom: 16,
|
|
97
|
+
leading: 16,
|
|
98
|
+
top: 16,
|
|
99
|
+
trailing: 16,
|
|
100
|
+
},
|
|
101
|
+
name: "Stack",
|
|
102
|
+
padding: {
|
|
103
|
+
bottom: 16,
|
|
104
|
+
leading: 16,
|
|
105
|
+
top: 16,
|
|
106
|
+
trailing: 16,
|
|
107
|
+
},
|
|
108
|
+
shape: {
|
|
109
|
+
corners: {
|
|
110
|
+
bottom_leading: 8,
|
|
111
|
+
bottom_trailing: 8,
|
|
112
|
+
top_leading: 8,
|
|
113
|
+
top_trailing: 8,
|
|
114
|
+
},
|
|
115
|
+
type: "rectangle",
|
|
116
|
+
},
|
|
117
|
+
size: {
|
|
118
|
+
height: {
|
|
119
|
+
type: "fit",
|
|
120
|
+
value: null,
|
|
121
|
+
},
|
|
122
|
+
width: {
|
|
123
|
+
type: "fill",
|
|
124
|
+
value: null,
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
spacing: 8,
|
|
128
|
+
type: "stack",
|
|
129
|
+
},
|
|
130
|
+
labels: labelsData,
|
|
131
|
+
type: "purchase_button",
|
|
132
|
+
}}
|
|
133
|
+
/>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import PurchaseButton from "./PurchaseButton.svelte";
|
|
2
|
+
export declare const labelsData: {
|
|
3
|
+
en_US: {
|
|
4
|
+
"6gpcQ4q6T8": string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
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> {
|
|
8
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
9
|
+
$$bindings?: Bindings;
|
|
10
|
+
} & Exports;
|
|
11
|
+
(internal: unknown, props: {
|
|
12
|
+
$$events?: Events;
|
|
13
|
+
$$slots?: Slots;
|
|
14
|
+
}): Exports & {
|
|
15
|
+
$set?: any;
|
|
16
|
+
$on?: any;
|
|
17
|
+
};
|
|
18
|
+
z_$$bindings?: Bindings;
|
|
19
|
+
}
|
|
20
|
+
declare const PurchaseButton: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
}, {}, {}, string>;
|
|
23
|
+
type PurchaseButton = InstanceType<typeof PurchaseButton>;
|
|
24
|
+
export default PurchaseButton;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { PurchaseButtonProps } from "../../data/entities";
|
|
3
|
+
import Stack from "../stack/Stack.svelte";
|
|
4
|
+
import { Button } from "../../index";
|
|
5
|
+
|
|
6
|
+
const { stack, labels, onAction, purchaseState }: PurchaseButtonProps =
|
|
7
|
+
$props();
|
|
8
|
+
const handleClick = () => {
|
|
9
|
+
onAction && onAction({ type: "purchase" });
|
|
10
|
+
};
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Button onclick={handleClick} class="purchase-button">
|
|
14
|
+
<Stack {...stack} {labels} {purchaseState} />
|
|
15
|
+
</Button>
|
|
16
|
+
|
|
17
|
+
<style>
|
|
18
|
+
.purchase-button {
|
|
19
|
+
border: none;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
background-color: transparent;
|
|
22
|
+
padding: 0;
|
|
23
|
+
width: 100%;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import Stack from "./Stack.svelte";
|
|
4
|
+
import {
|
|
5
|
+
borderStoryMeta,
|
|
6
|
+
colorModeStoryMeta,
|
|
7
|
+
getColorStoryMeta,
|
|
8
|
+
getSpacingStoryMeta,
|
|
9
|
+
shadowStoryMeta,
|
|
10
|
+
sizeStoryMeta,
|
|
11
|
+
stackDimensionStoryMeta,
|
|
12
|
+
} from "../../stories/meta-templates";
|
|
13
|
+
import { labelsData as labels } from "../../stories/fixtures";
|
|
14
|
+
|
|
15
|
+
const { Story } = defineMeta({
|
|
16
|
+
title: "Components/Stack",
|
|
17
|
+
component: Stack,
|
|
18
|
+
tags: ["autodocs"],
|
|
19
|
+
argTypes: {
|
|
20
|
+
dimension: stackDimensionStoryMeta,
|
|
21
|
+
spacing: {
|
|
22
|
+
control: { type: "number" },
|
|
23
|
+
description: "Space between stack items in pixels",
|
|
24
|
+
},
|
|
25
|
+
colorMode: colorModeStoryMeta,
|
|
26
|
+
shadow: shadowStoryMeta,
|
|
27
|
+
background_color: getColorStoryMeta("Background color object"),
|
|
28
|
+
padding: getSpacingStoryMeta("Padding values in pixels"),
|
|
29
|
+
margin: getSpacingStoryMeta("Margin values in pixels"),
|
|
30
|
+
border: borderStoryMeta,
|
|
31
|
+
size: sizeStoryMeta,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const components = [
|
|
36
|
+
{
|
|
37
|
+
type: "text",
|
|
38
|
+
size: {
|
|
39
|
+
width: { type: "fit" },
|
|
40
|
+
height: { type: "fit" },
|
|
41
|
+
},
|
|
42
|
+
horizontal_alignment: "center",
|
|
43
|
+
name: "Item 1",
|
|
44
|
+
components: [],
|
|
45
|
+
id: "1",
|
|
46
|
+
text_lid: "id1",
|
|
47
|
+
background_color: {
|
|
48
|
+
dark: { type: "alias", value: "transparent" },
|
|
49
|
+
light: { type: "alias", value: "transparent" },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: "text",
|
|
54
|
+
size: {
|
|
55
|
+
width: { type: "fit" },
|
|
56
|
+
height: { type: "fit" },
|
|
57
|
+
},
|
|
58
|
+
horizontal_alignment: "center",
|
|
59
|
+
name: "Item 2",
|
|
60
|
+
components: [],
|
|
61
|
+
id: "2",
|
|
62
|
+
text_lid: "id2",
|
|
63
|
+
background_color: {
|
|
64
|
+
dark: { type: "alias", value: "transparent" },
|
|
65
|
+
light: { type: "alias", value: "transparent" },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: "text",
|
|
70
|
+
size: {
|
|
71
|
+
width: { type: "fit" },
|
|
72
|
+
height: { type: "fit" },
|
|
73
|
+
},
|
|
74
|
+
horizontal_alignment: "center",
|
|
75
|
+
name: "Item 3",
|
|
76
|
+
components: [],
|
|
77
|
+
id: "3",
|
|
78
|
+
text_lid: "id3",
|
|
79
|
+
background_color: {
|
|
80
|
+
dark: { type: "alias", value: "transparent" },
|
|
81
|
+
light: { type: "alias", value: "transparent" },
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<!-- Vertical Stack -->
|
|
88
|
+
<Story
|
|
89
|
+
name="Vertical Stack"
|
|
90
|
+
args={{
|
|
91
|
+
type: "stack",
|
|
92
|
+
|
|
93
|
+
size: { width: { type: "fill" }, height: { type: "fill" } },
|
|
94
|
+
labels,
|
|
95
|
+
dimension: {
|
|
96
|
+
type: "vertical",
|
|
97
|
+
alignment: "center",
|
|
98
|
+
distribution: "start",
|
|
99
|
+
},
|
|
100
|
+
components,
|
|
101
|
+
spacing: 16,
|
|
102
|
+
padding: { top: 16, trailing: 16, bottom: 16, leading: 16 },
|
|
103
|
+
margin: { top: 0, trailing: 0, bottom: 0, leading: 0 },
|
|
104
|
+
id: "vertical-stack",
|
|
105
|
+
name: "Vertical Stack",
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
108
|
+
|
|
109
|
+
<!-- Horizontal Stack -->
|
|
110
|
+
<Story
|
|
111
|
+
name="Horizontal Stack"
|
|
112
|
+
args={{
|
|
113
|
+
type: "stack",
|
|
114
|
+
dimension: {
|
|
115
|
+
type: "horizontal",
|
|
116
|
+
alignment: "center",
|
|
117
|
+
distribution: "space_between",
|
|
118
|
+
},
|
|
119
|
+
labels,
|
|
120
|
+
components,
|
|
121
|
+
spacing: 16,
|
|
122
|
+
padding: { top: 16, trailing: 16, bottom: 16, leading: 16 },
|
|
123
|
+
margin: { top: 0, trailing: 0, bottom: 0, leading: 0 },
|
|
124
|
+
id: "horizontal-stack",
|
|
125
|
+
name: "Horizontal Stack",
|
|
126
|
+
size: { width: { type: "fill" }, height: { type: "fill" } },
|
|
127
|
+
}}
|
|
128
|
+
/>
|
|
129
|
+
|
|
130
|
+
<!-- Space Around -->
|
|
131
|
+
<Story
|
|
132
|
+
name="Space Around"
|
|
133
|
+
args={{
|
|
134
|
+
type: "stack",
|
|
135
|
+
dimension: {
|
|
136
|
+
type: "horizontal",
|
|
137
|
+
alignment: "center",
|
|
138
|
+
distribution: "space_around",
|
|
139
|
+
},
|
|
140
|
+
labels,
|
|
141
|
+
components,
|
|
142
|
+
spacing: 16,
|
|
143
|
+
padding: { top: 16, trailing: 16, bottom: 16, leading: 16 },
|
|
144
|
+
margin: { top: 0, trailing: 0, bottom: 0, leading: 0 },
|
|
145
|
+
id: "space-between",
|
|
146
|
+
name: "Space Between",
|
|
147
|
+
size: { width: { type: "fill" }, height: { type: "fill" } },
|
|
148
|
+
}}
|
|
149
|
+
/>
|
|
150
|
+
|
|
151
|
+
<!-- Background Color -->
|
|
152
|
+
<Story
|
|
153
|
+
name="Background Colors"
|
|
154
|
+
args={{
|
|
155
|
+
type: "stack",
|
|
156
|
+
dimension: {
|
|
157
|
+
type: "vertical",
|
|
158
|
+
alignment: "center",
|
|
159
|
+
distribution: "start",
|
|
160
|
+
},
|
|
161
|
+
components,
|
|
162
|
+
labels,
|
|
163
|
+
background_color: {
|
|
164
|
+
light: { type: "hex", value: "#C8E6FF" },
|
|
165
|
+
dark: { type: "hex", value: "#C8E6FF" },
|
|
166
|
+
},
|
|
167
|
+
spacing: 16,
|
|
168
|
+
padding: { top: 16, trailing: 16, bottom: 16, leading: 16 },
|
|
169
|
+
size: { width: { type: "fill" }, height: { type: "fill" } },
|
|
170
|
+
}}
|
|
171
|
+
/>
|
|
172
|
+
|
|
173
|
+
<!-- Border Styles -->
|
|
174
|
+
<Story
|
|
175
|
+
name="Border Styles"
|
|
176
|
+
args={{
|
|
177
|
+
type: "stack",
|
|
178
|
+
dimension: {
|
|
179
|
+
type: "vertical",
|
|
180
|
+
alignment: "center",
|
|
181
|
+
distribution: "start",
|
|
182
|
+
},
|
|
183
|
+
components,
|
|
184
|
+
labels,
|
|
185
|
+
border: {
|
|
186
|
+
width: 2,
|
|
187
|
+
color: {
|
|
188
|
+
light: { type: "hex", value: "#646464" },
|
|
189
|
+
dark: { type: "hex", value: "#646464" },
|
|
190
|
+
},
|
|
191
|
+
style: "solid",
|
|
192
|
+
},
|
|
193
|
+
shape: {
|
|
194
|
+
type: "rectangle",
|
|
195
|
+
corners: {
|
|
196
|
+
top_leading: 8,
|
|
197
|
+
top_trailing: 8,
|
|
198
|
+
bottom_leading: 8,
|
|
199
|
+
bottom_trailing: 8,
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
spacing: 16,
|
|
203
|
+
padding: { top: 16, trailing: 16, bottom: 16, leading: 16 },
|
|
204
|
+
size: { width: { type: "fill" }, height: { type: "fill" } },
|
|
205
|
+
}}
|
|
206
|
+
/>
|
|
207
|
+
|
|
208
|
+
<!-- Shapes -->
|
|
209
|
+
<Story
|
|
210
|
+
name="Rounded Corners"
|
|
211
|
+
args={{
|
|
212
|
+
type: "stack",
|
|
213
|
+
dimension: {
|
|
214
|
+
type: "vertical",
|
|
215
|
+
alignment: "center",
|
|
216
|
+
distribution: "start",
|
|
217
|
+
},
|
|
218
|
+
components,
|
|
219
|
+
labels,
|
|
220
|
+
shape: {
|
|
221
|
+
type: "rectangle",
|
|
222
|
+
corners: {
|
|
223
|
+
top_leading: 24,
|
|
224
|
+
top_trailing: 24,
|
|
225
|
+
bottom_leading: 24,
|
|
226
|
+
bottom_trailing: 24,
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
background_color: {
|
|
230
|
+
light: { type: "hex", value: "#F0F0F0" },
|
|
231
|
+
dark: { type: "hex", value: "#F0F0F0" },
|
|
232
|
+
},
|
|
233
|
+
spacing: 16,
|
|
234
|
+
padding: { top: 16, trailing: 16, bottom: 16, leading: 16 },
|
|
235
|
+
size: { width: { type: "fill" }, height: { type: "fill" } },
|
|
236
|
+
}}
|
|
237
|
+
/>
|
|
238
|
+
|
|
239
|
+
<!-- Fixed Size -->
|
|
240
|
+
<Story
|
|
241
|
+
name="Fixed Size"
|
|
242
|
+
args={{
|
|
243
|
+
type: "stack",
|
|
244
|
+
dimension: {
|
|
245
|
+
type: "vertical",
|
|
246
|
+
alignment: "center",
|
|
247
|
+
distribution: "start",
|
|
248
|
+
},
|
|
249
|
+
components,
|
|
250
|
+
labels,
|
|
251
|
+
size: {
|
|
252
|
+
width: { type: "fixed", value: 300 },
|
|
253
|
+
height: { type: "fixed", value: 200 },
|
|
254
|
+
},
|
|
255
|
+
background_color: {
|
|
256
|
+
light: { type: "hex", value: "#F0F0F0" },
|
|
257
|
+
dark: { type: "hex", value: "#F0F0F0" },
|
|
258
|
+
},
|
|
259
|
+
spacing: 16,
|
|
260
|
+
padding: { top: 16, trailing: 16, bottom: 16, leading: 16 },
|
|
261
|
+
}}
|
|
262
|
+
/>
|
|
263
|
+
|
|
264
|
+
<!-- Shadow -->
|
|
265
|
+
<Story
|
|
266
|
+
name="Shadow"
|
|
267
|
+
args={{
|
|
268
|
+
shadow: {
|
|
269
|
+
x: 16,
|
|
270
|
+
y: 16,
|
|
271
|
+
radius: 8,
|
|
272
|
+
color: {
|
|
273
|
+
dark: { type: "hex", value: "#d3d3d3" },
|
|
274
|
+
light: { type: "hex", value: "#d3d3d3" },
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
type: "stack",
|
|
278
|
+
dimension: {
|
|
279
|
+
type: "vertical",
|
|
280
|
+
alignment: "center",
|
|
281
|
+
distribution: "start",
|
|
282
|
+
},
|
|
283
|
+
components,
|
|
284
|
+
labels,
|
|
285
|
+
border: {
|
|
286
|
+
width: 2,
|
|
287
|
+
color: {
|
|
288
|
+
light: { type: "hex", value: "#646464" },
|
|
289
|
+
dark: { type: "hex", value: "#646464" },
|
|
290
|
+
},
|
|
291
|
+
style: "solid",
|
|
292
|
+
},
|
|
293
|
+
shape: {
|
|
294
|
+
type: "rectangle",
|
|
295
|
+
corners: {
|
|
296
|
+
top_leading: 8,
|
|
297
|
+
top_trailing: 8,
|
|
298
|
+
bottom_leading: 8,
|
|
299
|
+
bottom_trailing: 8,
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
spacing: 16,
|
|
303
|
+
padding: { top: 16, trailing: 16, bottom: 16, leading: 16 },
|
|
304
|
+
size: { width: { type: "fill" }, height: { type: "fill" } },
|
|
305
|
+
}}
|
|
306
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Stack from "./Stack.svelte";
|
|
2
|
+
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> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Stack: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Stack = InstanceType<typeof Stack>;
|
|
19
|
+
export default Stack;
|