@revenuecat/purchases-ui-js 0.1.21 → 1.0.1
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/ui/globals.d.ts +9 -0
- package/dist/ui/globals.js +3 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +4 -0
- package/dist/ui/molecules/button.stories.svelte +10 -6
- package/dist/ui/molecules/button.svelte +21 -14
- package/dist/ui/molecules/button.svelte.d.ts +27 -12
- package/dist/ui/molecules/types.d.ts +13 -0
- package/dist/ui/molecules/types.js +1 -0
- package/dist/web-components/index.js +2264 -0
- package/package.json +10 -4
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/ui/index.js
ADDED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script module>
|
|
2
|
+
import { brandingAppearances } from "../../stories/fixtures";
|
|
2
3
|
import { default as Button } from "./button.svelte";
|
|
3
4
|
import {
|
|
4
5
|
type Args,
|
|
5
6
|
defineMeta,
|
|
6
7
|
setTemplate,
|
|
8
|
+
type StoryContext,
|
|
7
9
|
} from "@storybook/addon-svelte-csf";
|
|
8
10
|
import { withLayout } from "../../stories/with-layout";
|
|
9
11
|
|
|
@@ -32,12 +34,14 @@
|
|
|
32
34
|
setTemplate(template);
|
|
33
35
|
</script>
|
|
34
36
|
|
|
35
|
-
{#snippet template(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
{#snippet template(
|
|
38
|
+
{ ...args }: Args<typeof Story>,
|
|
39
|
+
context: StoryContext<typeof Story>,
|
|
40
|
+
)}
|
|
41
|
+
{@const brandingInfo = brandingAppearances[context.globals.brandingName]}
|
|
42
|
+
<Button {...args} brandingAppearance={brandingInfo ?? undefined}
|
|
43
|
+
>Click Me</Button
|
|
44
|
+
>
|
|
41
45
|
{/snippet}
|
|
42
46
|
|
|
43
47
|
<Story name="Default" {args} />
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
+
<svelte:options customElement="ui-button" />
|
|
2
|
+
|
|
1
3
|
<script lang="ts">
|
|
2
|
-
import { type Snippet } from "svelte";
|
|
3
4
|
import ProcessingAnimation from "../utils/processing-animation.svelte";
|
|
4
5
|
import Typography from "../atoms/typography.svelte";
|
|
5
|
-
|
|
6
|
-
type
|
|
7
|
-
onclick?: () => void;
|
|
8
|
-
intent?: "primary";
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
testId?: string | undefined;
|
|
11
|
-
type?: "reset" | "submit" | "button" | null | undefined;
|
|
12
|
-
loading?: boolean;
|
|
13
|
-
children: Snippet | undefined;
|
|
14
|
-
};
|
|
6
|
+
import { Theme } from "../theme/theme";
|
|
7
|
+
import type { UIButtonProps } from "./types";
|
|
15
8
|
|
|
16
9
|
const {
|
|
17
10
|
onclick,
|
|
@@ -20,8 +13,21 @@
|
|
|
20
13
|
testId,
|
|
21
14
|
type,
|
|
22
15
|
loading = false,
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
brandingAppearance,
|
|
17
|
+
styleOverrides,
|
|
18
|
+
}: UIButtonProps = $props();
|
|
19
|
+
|
|
20
|
+
const theme = $derived(new Theme(brandingAppearance));
|
|
21
|
+
const textStyle = $derived(theme.textStyleVars);
|
|
22
|
+
const spacingStyle = $derived(theme.spacingStyleVars);
|
|
23
|
+
const productInfoStyle = $derived(theme.productInfoStyleVars);
|
|
24
|
+
const formStyle = $derived(theme.formStyleVars);
|
|
25
|
+
|
|
26
|
+
const combinedStyle = $derived(
|
|
27
|
+
[styleOverrides, textStyle, spacingStyle, productInfoStyle, formStyle].join(
|
|
28
|
+
"; ",
|
|
29
|
+
),
|
|
30
|
+
);
|
|
25
31
|
</script>
|
|
26
32
|
|
|
27
33
|
<button
|
|
@@ -30,11 +36,12 @@
|
|
|
30
36
|
{disabled}
|
|
31
37
|
data-testid={testId}
|
|
32
38
|
{type}
|
|
39
|
+
style={combinedStyle}
|
|
33
40
|
>
|
|
34
41
|
{#if loading}
|
|
35
42
|
<ProcessingAnimation size="small" />
|
|
36
43
|
{:else}
|
|
37
|
-
<Typography size="body-base"
|
|
44
|
+
<Typography size="body-base"><slot></slot></Typography>
|
|
38
45
|
{/if}
|
|
39
46
|
</button>
|
|
40
47
|
|
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import type { UIButtonProps } from "./types";
|
|
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: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
16
|
+
default: any;
|
|
17
|
+
} ? Props extends Record<string, never> ? any : {
|
|
18
|
+
children?: any;
|
|
19
|
+
} : {});
|
|
20
|
+
declare const Button: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<UIButtonProps, {
|
|
21
|
+
default: {};
|
|
22
|
+
}>, {
|
|
23
|
+
[evt: string]: CustomEvent<any>;
|
|
24
|
+
}, {
|
|
25
|
+
default: {};
|
|
26
|
+
}, {}, "">;
|
|
27
|
+
type Button = InstanceType<typeof Button>;
|
|
13
28
|
export default Button;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BrandingAppearance } from "../utils/branding";
|
|
2
|
+
export interface UIButtonProps {
|
|
3
|
+
onclick?: (event: any) => void;
|
|
4
|
+
children?: unknown;
|
|
5
|
+
intent?: "primary";
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
testId?: string | undefined;
|
|
8
|
+
type?: "reset" | "submit" | "button" | null | undefined;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
brandingAppearance?: BrandingAppearance;
|
|
11
|
+
styleOverrides?: string;
|
|
12
|
+
style?: Record<string, string> | string | undefined;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|