@revenuecat/purchases-ui-js 2.0.1 → 2.0.3
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/components/button/ButtonNode.stories.svelte +66 -108
- package/dist/components/button/ButtonNode.svelte +3 -31
- package/dist/components/footer/Footer.stories.svelte +112 -106
- package/dist/components/footer/Footer.svelte +10 -6
- package/dist/components/icon/Icon.stories.svelte +100 -0
- package/dist/components/icon/Icon.stories.svelte.d.ts +19 -0
- package/dist/components/icon/Icon.svelte +73 -0
- package/dist/components/icon/Icon.svelte.d.ts +4 -0
- package/dist/components/image/ClipPath.svelte +49 -0
- package/dist/components/image/ClipPath.svelte.d.ts +9 -0
- package/dist/components/image/Image.stories.svelte +83 -199
- package/dist/components/image/Image.svelte +152 -137
- package/dist/components/image/Image.svelte.d.ts +1 -1
- package/dist/components/image/Overlay.svelte +36 -0
- package/dist/components/image/Overlay.svelte.d.ts +8 -0
- package/dist/components/package/Package.stories.svelte +12 -27
- package/dist/components/package/Package.svelte +10 -44
- package/dist/components/paywall/Node.svelte +45 -43
- package/dist/components/paywall/Node.svelte.d.ts +10 -12
- package/dist/components/paywall/Paywall.stories.svelte +36 -140
- package/dist/components/paywall/Paywall.svelte +38 -20
- package/dist/components/paywall/Paywall.svelte.d.ts +3 -2
- package/dist/components/paywall/fixtures/override-paywall.d.ts +2 -0
- package/dist/components/paywall/fixtures/override-paywall.js +1310 -0
- package/dist/components/paywall/fixtures/stack-paywall.d.ts +2 -0
- package/dist/components/paywall/fixtures/stack-paywall.js +5223 -0
- package/dist/components/paywall/fixtures/variables.d.ts +261 -0
- package/dist/components/paywall/fixtures/variables.js +262 -0
- package/dist/components/purchase-button/PurchaseButton.stories.svelte +10 -29
- package/dist/components/purchase-button/PurchaseButton.svelte +2 -34
- package/dist/components/stack/Stack.stories.svelte +2364 -1020
- package/dist/components/stack/Stack.svelte +108 -151
- package/dist/components/stack/Stack.svelte.d.ts +6 -2
- package/dist/components/stack/stack-utils.d.ts +10 -30
- package/dist/components/stack/stack-utils.js +77 -257
- package/dist/components/text/Text.svelte +3 -37
- package/dist/components/text/Text.svelte.d.ts +1 -2
- package/dist/components/text/TextNode.stories.svelte +10 -48
- package/dist/components/text/TextNode.svelte +25 -37
- package/dist/components/text/TextNode.svelte.d.ts +1 -1
- package/dist/components/text/text-utils.d.ts +4 -9
- package/dist/components/text/text-utils.js +32 -117
- package/dist/components/timeline/Timeline.stories.svelte +640 -256
- package/dist/components/timeline/Timeline.svelte +42 -30
- package/dist/components/timeline/Timeline.svelte.d.ts +1 -1
- package/dist/components/timeline/TimelineItem.svelte +80 -112
- package/dist/components/timeline/TimelineItem.svelte.d.ts +6 -2
- package/dist/components/timeline/timeline-utils.d.ts +24 -6
- package/dist/components/timeline/timeline-utils.js +21 -114
- package/dist/data/entities.d.ts +23 -169
- package/dist/index.d.ts +11 -10
- package/dist/index.js +11 -10
- package/dist/stores/color-mode.d.ts +1 -1
- package/dist/stores/localization.d.ts +1 -1
- package/dist/stores/localization.js +3 -2
- package/dist/stores/paywall.d.ts +7 -3
- package/dist/stores/selected.d.ts +5 -0
- package/dist/stores/selected.js +12 -0
- package/dist/stores/variables.d.ts +2 -3
- package/dist/stores/variables.js +0 -1
- package/dist/stories/component-decorator.d.ts +2 -0
- package/dist/stories/component-decorator.js +12 -0
- package/dist/stories/fixtures.d.ts +6 -4
- package/dist/stories/fixtures.js +6241 -5485
- package/dist/stories/localization-decorator.js +1 -1
- package/dist/stories/paywall-decorator.js +8 -1
- package/dist/stories/variables-decorator.d.ts +1 -1
- package/dist/stories/viewport-decorator.d.ts +2 -0
- package/dist/stories/viewport-decorator.js +8 -0
- package/dist/stories/viewport-wrapper.svelte +53 -0
- package/dist/stories/viewport-wrapper.svelte.d.ts +10 -0
- package/dist/stories/with-layout.d.ts +2 -10
- package/dist/stories/with-layout.js +3 -5
- package/dist/stories/with-layout.svelte +3 -3
- package/dist/types/alignment.d.ts +5 -3
- package/dist/types/background.d.ts +6 -5
- package/dist/types/base.d.ts +7 -0
- package/dist/types/colors.d.ts +4 -4
- package/dist/types/component.d.ts +10 -0
- package/dist/types/component.js +1 -0
- package/dist/types/components/button.d.ts +5 -2
- package/dist/types/components/footer.d.ts +3 -2
- package/dist/types/components/icon.d.ts +28 -0
- package/dist/types/components/icon.js +1 -0
- package/dist/types/components/image.d.ts +20 -0
- package/dist/types/components/image.js +1 -0
- package/dist/types/components/package.d.ts +3 -2
- package/dist/types/components/purchase-button.d.ts +3 -2
- package/dist/types/components/stack.d.ts +32 -0
- package/dist/types/components/stack.js +1 -0
- package/dist/types/components/text.d.ts +20 -0
- package/dist/types/components/text.js +1 -0
- package/dist/types/components/timeline.d.ts +35 -0
- package/dist/types/components/timeline.js +1 -0
- package/dist/types/localization.d.ts +2 -1
- package/dist/types/media.d.ts +4 -3
- package/dist/types/overrides.d.ts +48 -0
- package/dist/types/overrides.js +1 -0
- package/dist/types/variables.d.ts +13 -0
- package/dist/types/variables.js +10 -0
- package/dist/types.d.ts +17 -9
- package/dist/ui/atoms/typography.stories.svelte +3 -29
- package/dist/ui/atoms/typography.stories.svelte.d.ts +1 -1
- package/dist/ui/layout/main-block.svelte +2 -2
- package/dist/ui/molecules/button.stories.svelte +5 -10
- package/dist/ui/molecules/button.svelte +1 -1
- package/dist/ui/theme/colors.d.ts +0 -6
- package/dist/ui/theme/colors.js +1 -1
- package/dist/ui/theme/text.d.ts +3 -4
- package/dist/ui/theme/theme.d.ts +2 -2
- package/dist/ui/theme/theme.js +2 -2
- package/dist/ui/theme/utils.d.ts +2 -12
- package/dist/ui/theme/utils.js +5 -5
- package/dist/utils/background-utils.d.ts +4 -0
- package/dist/utils/background-utils.js +39 -0
- package/dist/utils/base-utils.d.ts +18 -0
- package/dist/utils/base-utils.js +124 -0
- package/dist/utils/constants.d.ts +2 -2
- package/dist/utils/constants.js +6 -1
- package/dist/utils/font-utils.d.ts +4 -0
- package/dist/utils/font-utils.js +47 -0
- package/dist/utils/style-utils.d.ts +7 -120
- package/dist/utils/style-utils.js +35 -314
- package/dist/utils/variable-utils.d.ts +1 -22
- package/dist/utils/variable-utils.js +28 -24
- package/dist/web-components/index.css +1 -1
- package/dist/web-components/index.js +1415 -987
- package/package.json +34 -24
- package/dist/components/button/button-utils.d.ts +0 -2
- package/dist/components/button/button-utils.js +0 -19
- package/dist/components/image/image-utils.d.ts +0 -19
- package/dist/components/image/image-utils.js +0 -33
- package/dist/components/purchase-button/purchase-button-utils.d.ts +0 -2
- package/dist/components/purchase-button/purchase-button-utils.js +0 -20
- package/dist/data/state.d.ts +0 -4
- package/dist/stories/meta-templates.d.ts +0 -12
- package/dist/stories/meta-templates.js +0 -155
- /package/dist/{data/state.js → types/base.js} +0 -0
|
@@ -1,40 +1,52 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { getTimelineInlineStyles } from "./timeline-utils";
|
|
3
3
|
import TimelineItem from "./TimelineItem.svelte";
|
|
4
|
-
import type { TimelineProps } from "../../
|
|
4
|
+
import type { TimelineProps } from "../../types/components/timeline";
|
|
5
|
+
import { css } from "../../utils/base-utils";
|
|
6
|
+
import { getActiveStateProps } from "../../utils/style-utils";
|
|
7
|
+
import { getSelectedStateContext } from "../../stores/selected";
|
|
5
8
|
|
|
6
|
-
const
|
|
9
|
+
const props: TimelineProps = $props();
|
|
10
|
+
const selectedState = getSelectedStateContext();
|
|
7
11
|
|
|
8
|
-
const
|
|
12
|
+
const {
|
|
13
|
+
items,
|
|
14
|
+
text_spacing,
|
|
15
|
+
item_spacing,
|
|
16
|
+
column_gutter,
|
|
17
|
+
icon_alignment,
|
|
18
|
+
size,
|
|
19
|
+
padding,
|
|
20
|
+
margin,
|
|
21
|
+
...restProps
|
|
22
|
+
} = $derived.by(() => {
|
|
23
|
+
return {
|
|
24
|
+
...props,
|
|
25
|
+
...getActiveStateProps($selectedState, props.overrides),
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const timelineStyles = $derived(
|
|
30
|
+
css(
|
|
31
|
+
getTimelineInlineStyles({
|
|
32
|
+
items,
|
|
33
|
+
text_spacing,
|
|
34
|
+
item_spacing,
|
|
35
|
+
column_gutter,
|
|
36
|
+
icon_alignment,
|
|
37
|
+
size,
|
|
38
|
+
padding,
|
|
39
|
+
margin,
|
|
40
|
+
...restProps,
|
|
41
|
+
}),
|
|
42
|
+
),
|
|
43
|
+
);
|
|
9
44
|
</script>
|
|
10
45
|
|
|
11
46
|
{#if items.length}
|
|
12
|
-
<div
|
|
13
|
-
{#each items as item
|
|
14
|
-
<TimelineItem
|
|
15
|
-
{...item}
|
|
16
|
-
labels={restProps.labels}
|
|
17
|
-
id={`${restProps.id}-${index}`}
|
|
18
|
-
name={`${restProps.name}-${index}`}
|
|
19
|
-
type="timeline"
|
|
20
|
-
purchaseState={restProps.purchaseState}
|
|
21
|
-
text_spacing={restProps.text_spacing}
|
|
22
|
-
item_spacing={restProps.item_spacing}
|
|
23
|
-
/>
|
|
47
|
+
<div style={timelineStyles}>
|
|
48
|
+
{#each items as item (item.id)}
|
|
49
|
+
<TimelineItem {...item} {text_spacing} {item_spacing} />
|
|
24
50
|
{/each}
|
|
25
51
|
</div>
|
|
26
52
|
{/if}
|
|
27
|
-
|
|
28
|
-
<style>
|
|
29
|
-
.rc-pw-timeline-container {
|
|
30
|
-
display: flex;
|
|
31
|
-
flex: var(--timeline-flex, 0 1 auto);
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
gap: var(--timeline-item-spacing, 0);
|
|
34
|
-
width: var(--timeline-width, initial);
|
|
35
|
-
height: var(--timeline-height, initial);
|
|
36
|
-
position: var(--timeline-position, relative);
|
|
37
|
-
inset: var(--timeline-inset, 0);
|
|
38
|
-
transform: var(--timeline-transform, initial);
|
|
39
|
-
}
|
|
40
|
-
</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TimelineProps } from "../../
|
|
1
|
+
import type { TimelineProps } from "../../types/components/timeline";
|
|
2
2
|
declare const Timeline: import("svelte").Component<TimelineProps, {}, "">;
|
|
3
3
|
type Timeline = ReturnType<typeof Timeline>;
|
|
4
4
|
export default Timeline;
|
|
@@ -1,129 +1,97 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
getTimelineItemTextStyles,
|
|
5
|
-
} from "./timeline-utils";
|
|
6
|
-
import type { TimelineItemProps } from "../../data/entities";
|
|
2
|
+
import { getTimelineItemContentInlineStyles } from "./timeline-utils";
|
|
3
|
+
import type { TimelineItemProps } from "../../types/components/timeline";
|
|
7
4
|
import { getColorModeContext } from "../../stores/color-mode";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
5
|
+
import { getColor, getActiveStateProps } from "../../utils/style-utils";
|
|
6
|
+
import { getSelectedStateContext } from "../../stores/selected";
|
|
7
|
+
import Icon from "../icon/Icon.svelte";
|
|
8
|
+
import { css } from "../../utils/base-utils";
|
|
9
|
+
import TextNode from "../text/TextNode.svelte";
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
interface Props extends TimelineItemProps {
|
|
12
|
+
text_spacing: number;
|
|
13
|
+
item_spacing: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const props: Props = $props();
|
|
17
|
+
const selectedState = getSelectedStateContext();
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
icon,
|
|
21
|
+
title,
|
|
22
|
+
description,
|
|
23
|
+
connector,
|
|
24
|
+
text_spacing,
|
|
25
|
+
item_spacing,
|
|
26
|
+
...restProps
|
|
27
|
+
} = $derived.by(() => {
|
|
28
|
+
return {
|
|
29
|
+
...props,
|
|
30
|
+
...getActiveStateProps($selectedState, props.overrides as any),
|
|
31
|
+
};
|
|
32
|
+
});
|
|
13
33
|
|
|
14
34
|
const getColorMode = getColorModeContext();
|
|
15
35
|
const colorMode = $derived(getColorMode());
|
|
16
36
|
|
|
17
|
-
const
|
|
37
|
+
const iconContainerStyles = css({ position: "relative" });
|
|
38
|
+
const iconStyles = css({ position: "relative", "z-index": "2" });
|
|
39
|
+
const contentStyles = $derived(
|
|
40
|
+
css(
|
|
41
|
+
getTimelineItemContentInlineStyles(colorMode, {
|
|
42
|
+
text_spacing,
|
|
43
|
+
item_spacing,
|
|
44
|
+
}),
|
|
45
|
+
),
|
|
46
|
+
);
|
|
18
47
|
|
|
19
|
-
const
|
|
48
|
+
const connectorStyles = $derived.by(() => {
|
|
49
|
+
if (!connector) return "";
|
|
20
50
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
51
|
+
return css({
|
|
52
|
+
position: "absolute",
|
|
53
|
+
left: "50%",
|
|
54
|
+
top: `${(icon?.size.width.value ?? 24) / 2}px`,
|
|
55
|
+
transform: "translateX(-50%)",
|
|
56
|
+
"z-index": "1",
|
|
57
|
+
width: `${connector.width}px`,
|
|
58
|
+
height: `100%`, // Extend beyond icon
|
|
59
|
+
"padding-top": `${connector.margin.top}px`,
|
|
60
|
+
"padding-bottom": `${connector.margin.bottom}px`,
|
|
61
|
+
});
|
|
62
|
+
});
|
|
25
63
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
getLocalizedString(props.description?.text_lid),
|
|
29
|
-
$variables,
|
|
30
|
-
),
|
|
31
|
-
);
|
|
64
|
+
const connectorBarStyles = $derived.by(() => {
|
|
65
|
+
if (!connector) return "";
|
|
32
66
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
67
|
+
const background = getColor({
|
|
68
|
+
colorMap: connector.color,
|
|
69
|
+
colorMode,
|
|
70
|
+
fallback: "#000000",
|
|
71
|
+
});
|
|
36
72
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
73
|
+
return css({
|
|
74
|
+
width: "100%",
|
|
75
|
+
height: "100%",
|
|
76
|
+
background,
|
|
77
|
+
});
|
|
78
|
+
});
|
|
40
79
|
</script>
|
|
41
80
|
|
|
42
|
-
<div
|
|
43
|
-
|
|
44
|
-
<div
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
style={titleStyles}>{titleLabel}</svelte:element
|
|
51
|
-
>
|
|
52
|
-
{#if descriptionLabel}
|
|
53
|
-
<svelte:element
|
|
54
|
-
this={descriptionTagToRender}
|
|
55
|
-
class="rc-pw-timeline-item-content-description"
|
|
56
|
-
style={descriptionStyles}>{descriptionLabel}</svelte:element
|
|
57
|
-
>
|
|
58
|
-
{/if}
|
|
81
|
+
<div style={iconContainerStyles}>
|
|
82
|
+
{#if connector}
|
|
83
|
+
<div style={connectorStyles}>
|
|
84
|
+
<div style={connectorBarStyles}></div>
|
|
85
|
+
</div>
|
|
86
|
+
{/if}
|
|
87
|
+
<div style={iconStyles}>
|
|
88
|
+
<Icon {...icon} />
|
|
59
89
|
</div>
|
|
60
90
|
</div>
|
|
61
91
|
|
|
62
|
-
<style>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
.rc-pw-timeline-item-icon-container {
|
|
70
|
-
position: relative;
|
|
71
|
-
border-end-start-radius: var(--timeline-item-border-end-start-radius, 0px);
|
|
72
|
-
border-end-end-radius: var(--timeline-item-border-end-end-radius, 0px);
|
|
73
|
-
border-start-start-radius: var(
|
|
74
|
-
--timeline-item-border-start-start-radius,
|
|
75
|
-
0px
|
|
76
|
-
);
|
|
77
|
-
border-start-end-radius: var(--timeline-item-border-start-end-radius, 0px);
|
|
78
|
-
width: var(--timeline-item-icon-size, 16px);
|
|
79
|
-
height: var(--timeline-item-icon-size, 16px);
|
|
80
|
-
flex-shrink: 0;
|
|
81
|
-
background-color: var(--timeline-item-icon-background-color, #ffffff);
|
|
82
|
-
border: var(--timeline-item-icon-border, initial);
|
|
83
|
-
display: flex;
|
|
84
|
-
align-items: center;
|
|
85
|
-
justify-content: center;
|
|
86
|
-
padding: var(--timeline-item-icon-padding, 0px);
|
|
87
|
-
box-sizing: content-box;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.rc-pw-timeline-item-icon-container::before {
|
|
91
|
-
position: absolute;
|
|
92
|
-
content: "";
|
|
93
|
-
z-index: -1;
|
|
94
|
-
top: var(--timeline-item-connector-top, 0px);
|
|
95
|
-
height: var(--timeline-item-connector-height, 0px);
|
|
96
|
-
width: var(--timeline-item-connector-width, 0px);
|
|
97
|
-
background: var(--timeline-item-connector-color, transparent);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.rc-pw-timeline-item-icon {
|
|
101
|
-
width: var(--timeline-item-icon-size, 10px);
|
|
102
|
-
height: var(--timeline-item-icon-size, 10px);
|
|
103
|
-
color: var(--timeline-item-icon-color, #ffffff);
|
|
104
|
-
display: flex;
|
|
105
|
-
align-items: center;
|
|
106
|
-
justify-content: center;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.rc-pw-timeline-item-content {
|
|
110
|
-
display: flex;
|
|
111
|
-
flex-direction: column;
|
|
112
|
-
justify-content: flex-start;
|
|
113
|
-
align-items: flex-start;
|
|
114
|
-
gap: var(--timeline-item-text-spacing, 0px);
|
|
115
|
-
height: fit-content;
|
|
116
|
-
}
|
|
117
|
-
.rc-pw-timeline-item-content-title,
|
|
118
|
-
.rc-pw-timeline-item-content-description {
|
|
119
|
-
margin-block-start: var(--timeline-item-text-margin-block-start, 0px);
|
|
120
|
-
margin-inline-end: var(--timeline-item-text-margin-inline-end, 0px);
|
|
121
|
-
margin-block-end: var(--timeline-item-text-margin-block-end, 0px);
|
|
122
|
-
margin-inline-start: var(--timeline-item-text-margin-inline-start, 0px);
|
|
123
|
-
padding-block-start: var(--timeline-item-text-padding-block-start, 0);
|
|
124
|
-
padding-inline-end: var(--timeline-item-text-padding-inline-end, 0);
|
|
125
|
-
padding-block-end: var(--timeline-item-text-padding-block-end, 0);
|
|
126
|
-
padding-inline-start: var(--timeline-item-text-padding-inline-start, 0);
|
|
127
|
-
font-family: var(--timeline-item-text-font-family, sans-serif);
|
|
128
|
-
}
|
|
129
|
-
</style>
|
|
92
|
+
<div style={contentStyles}>
|
|
93
|
+
<TextNode {...title} />
|
|
94
|
+
{#if description}
|
|
95
|
+
<TextNode {...description} />
|
|
96
|
+
{/if}
|
|
97
|
+
</div>
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type { TimelineItemProps } from "../../
|
|
2
|
-
|
|
1
|
+
import type { TimelineItemProps } from "../../types/components/timeline";
|
|
2
|
+
interface Props extends TimelineItemProps {
|
|
3
|
+
text_spacing: number;
|
|
4
|
+
item_spacing: number;
|
|
5
|
+
}
|
|
6
|
+
declare const TimelineItem: import("svelte").Component<Props, {}, "">;
|
|
3
7
|
type TimelineItem = ReturnType<typeof TimelineItem>;
|
|
4
8
|
export default TimelineItem;
|
|
@@ -1,8 +1,26 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TimelineProps } from "../../types/components/timeline";
|
|
2
2
|
import type { ColorMode } from "../../types";
|
|
3
|
-
export declare function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export declare function getTimelineInlineStyles(props: TimelineProps): {
|
|
4
|
+
display: string;
|
|
5
|
+
"grid-template-columns": string;
|
|
6
|
+
"column-gap": string;
|
|
7
|
+
"align-items": string;
|
|
8
|
+
position: string;
|
|
9
|
+
flex: string;
|
|
10
|
+
width: string;
|
|
11
|
+
height: string;
|
|
12
|
+
padding: string;
|
|
13
|
+
margin: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function getTimelineItemContentInlineStyles(_colorMode: ColorMode, timelineSpacing: {
|
|
16
|
+
text_spacing: number;
|
|
17
|
+
item_spacing: number;
|
|
18
|
+
}): {
|
|
19
|
+
display: string;
|
|
20
|
+
"flex-direction": string;
|
|
21
|
+
"justify-content": string;
|
|
22
|
+
"align-items": string;
|
|
23
|
+
gap: string;
|
|
24
|
+
height: string;
|
|
25
|
+
"margin-bottom": string;
|
|
8
26
|
};
|
|
@@ -1,119 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Object.assign(styles, props.zStackChildStyles);
|
|
15
|
-
const prefixedStyles = prefixObject(styles, "timeline");
|
|
16
|
-
return stringifyStyles(prefixedStyles);
|
|
17
|
-
}
|
|
18
|
-
export function getTimelineItemStyles(colorMode, props) {
|
|
19
|
-
const styles = {
|
|
20
|
-
"--icon-size": `${props.icon.width_and_height}px`,
|
|
21
|
-
"--icon-padding": `${props.icon.padding}px`,
|
|
22
|
-
"--icon-color": getColor({
|
|
23
|
-
colorMap: props.icon.color,
|
|
24
|
-
colorMode,
|
|
25
|
-
}),
|
|
26
|
-
"--icon-background-color": getColor({
|
|
27
|
-
colorMap: props.icon_background?.color,
|
|
28
|
-
colorMode,
|
|
29
|
-
}),
|
|
30
|
-
"--icon-border": getBorderStyle(props.icon_background?.border, colorMode),
|
|
31
|
-
"--text-spacing": `${props.text_spacing}px`,
|
|
32
|
-
"--border-start-start-radius": `0px`,
|
|
33
|
-
"--border-start-end-radius": `0px`,
|
|
34
|
-
"--border-end-start-radius": `0px`,
|
|
35
|
-
"--border-end-end-radius": `0px`,
|
|
36
|
-
"--connector-color": getColor({
|
|
37
|
-
colorMap: props.connector?.color,
|
|
38
|
-
colorMode,
|
|
39
|
-
}),
|
|
40
|
-
"--connector-width": `${props.connector?.width || 0}px`,
|
|
41
|
-
"--connector-top": "0px",
|
|
42
|
-
"--connector-height": `${props.item_spacing}px`,
|
|
1
|
+
import { mapSize, mapSpacing } from "../../utils/base-utils";
|
|
2
|
+
export function getTimelineInlineStyles(props) {
|
|
3
|
+
return {
|
|
4
|
+
display: "grid",
|
|
5
|
+
"grid-template-columns": "auto 1fr",
|
|
6
|
+
"column-gap": `${props.column_gutter}px`,
|
|
7
|
+
"align-items": "stretch",
|
|
8
|
+
position: "relative",
|
|
9
|
+
flex: "0 1 auto",
|
|
10
|
+
width: mapSize(props.size.width),
|
|
11
|
+
height: mapSize(props.size.height),
|
|
12
|
+
padding: mapSpacing(props.padding),
|
|
13
|
+
margin: mapSpacing(props.margin),
|
|
43
14
|
};
|
|
44
|
-
Object.assign(styles, props.icon_background?.shape?.type === "rectangle"
|
|
45
|
-
? getCornerRadiusStyle(props.icon_background?.shape?.corners)
|
|
46
|
-
: {
|
|
47
|
-
"--border-start-start-radius": "50%",
|
|
48
|
-
"--border-start-end-radius": "50%",
|
|
49
|
-
"--border-end-start-radius": "50%",
|
|
50
|
-
"--border-end-end-radius": "50%",
|
|
51
|
-
});
|
|
52
|
-
if (props.connector) {
|
|
53
|
-
const hasMarginTop = props.connector.margin.top !== 0;
|
|
54
|
-
const hasMarginBottom = props.connector.margin.bottom !== 0;
|
|
55
|
-
const itemBackgroundSize = props.icon.padding + props.icon.width_and_height / 2;
|
|
56
|
-
if (!hasMarginTop && !hasMarginBottom) {
|
|
57
|
-
styles["--connector-height"] =
|
|
58
|
-
`${props.item_spacing + itemBackgroundSize * 2}px`;
|
|
59
|
-
styles["--connector-top"] = `50%`;
|
|
60
|
-
}
|
|
61
|
-
if (hasMarginTop && hasMarginBottom) {
|
|
62
|
-
styles["--connector-height"] =
|
|
63
|
-
`${props.item_spacing - props.connector.margin.top - props.connector.margin.bottom}px`;
|
|
64
|
-
styles["--connector-top"] =
|
|
65
|
-
`calc(100% + ${props.connector.margin.top}px)`;
|
|
66
|
-
}
|
|
67
|
-
if (!hasMarginTop && hasMarginBottom) {
|
|
68
|
-
styles["--connector-height"] =
|
|
69
|
-
`${props.item_spacing - props.connector.margin.bottom + itemBackgroundSize}px`;
|
|
70
|
-
styles["--connector-top"] = `50%`;
|
|
71
|
-
}
|
|
72
|
-
if (hasMarginTop && !hasMarginBottom) {
|
|
73
|
-
styles["--connector-height"] =
|
|
74
|
-
`${props.item_spacing + itemBackgroundSize}px`;
|
|
75
|
-
styles["--connector-top"] =
|
|
76
|
-
`calc(100% + ${props.connector.margin.top}px)`;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const prefixedStyles = prefixObject(styles, "timeline-item");
|
|
80
|
-
return stringifyStyles(prefixedStyles);
|
|
81
15
|
}
|
|
82
|
-
export function
|
|
83
|
-
const styles = {
|
|
84
|
-
"--text-color": "inherit",
|
|
85
|
-
"--text-font-size": "initial",
|
|
86
|
-
"--text-font-weight": "initial",
|
|
87
|
-
"--text-horizontal-alignment": "initial",
|
|
88
|
-
"--text-margin-block-start": "0px",
|
|
89
|
-
"--text-margin-inline-end": "0px",
|
|
90
|
-
"--text-margin-block-end": "0px",
|
|
91
|
-
"--text-margin-inline-start": "0px",
|
|
92
|
-
"--text-padding-block-start": "0px",
|
|
93
|
-
"--text-padding-inline-end": "0px",
|
|
94
|
-
"--text-padding-block-end": "0px",
|
|
95
|
-
"--text-padding-inline-start": "0px",
|
|
96
|
-
};
|
|
97
|
-
const textProps = {
|
|
98
|
-
color: props[kind]?.color || defaultColor,
|
|
99
|
-
font_size: props[kind]?.font_size || "body_m",
|
|
100
|
-
font_weight: props[kind]?.font_weight || "regular",
|
|
101
|
-
horizontal_alignment: props[kind]?.horizontal_alignment || "leading",
|
|
102
|
-
};
|
|
103
|
-
const { tagToRender, textStyles } = getTextComponentStyles(colorMode, {
|
|
104
|
-
...props,
|
|
105
|
-
components: [],
|
|
106
|
-
...textProps,
|
|
107
|
-
size: { width: { type: "fit" }, height: { type: "fit" } },
|
|
108
|
-
type: "text",
|
|
109
|
-
margin: { top: 0, bottom: 0, leading: 0, trailing: 0 },
|
|
110
|
-
padding: { top: 0, bottom: 0, leading: 0, trailing: 0 },
|
|
111
|
-
text_lid: "",
|
|
112
|
-
});
|
|
113
|
-
Object.assign(styles, textStyles);
|
|
114
|
-
const stringifiedStyles = stringifyStyles(prefixObject(styles, "timeline-item"));
|
|
16
|
+
export function getTimelineItemContentInlineStyles(_colorMode, timelineSpacing) {
|
|
115
17
|
return {
|
|
116
|
-
|
|
117
|
-
|
|
18
|
+
display: "flex",
|
|
19
|
+
"flex-direction": "column",
|
|
20
|
+
"justify-content": "flex-start",
|
|
21
|
+
"align-items": "flex-start",
|
|
22
|
+
gap: `${timelineSpacing.text_spacing}px`,
|
|
23
|
+
height: "fit-content",
|
|
24
|
+
"margin-bottom": `${timelineSpacing.item_spacing}px`,
|
|
118
25
|
};
|
|
119
26
|
}
|