@revenuecat/purchases-ui-js 0.0.17 → 0.0.19

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.
Files changed (48) hide show
  1. package/dist/components/button/Button.svelte +0 -13
  2. package/dist/components/button/ButtonNode.stories.svelte +16 -9
  3. package/dist/components/button/ButtonNode.svelte +26 -1
  4. package/dist/components/button/button-utils.d.ts +2 -0
  5. package/dist/components/button/button-utils.js +19 -0
  6. package/dist/components/footer/Footer.stories.svelte +2 -0
  7. package/dist/components/footer/Footer.svelte +14 -8
  8. package/dist/components/image/Image.stories.svelte +6 -2
  9. package/dist/components/image/Image.svelte +20 -17
  10. package/dist/components/image/image-utils.d.ts +2 -12
  11. package/dist/components/image/image-utils.js +27 -10
  12. package/dist/components/package/Package.stories.svelte +5 -3
  13. package/dist/components/package/Package.svelte +15 -6
  14. package/dist/components/paywall/Node.svelte +75 -19
  15. package/dist/components/paywall/Node.svelte.d.ts +20 -2
  16. package/dist/components/paywall/Paywall.stories.svelte +80 -5
  17. package/dist/components/paywall/Paywall.svelte +74 -71
  18. package/dist/components/paywall/paywall-utils.d.ts +1 -1
  19. package/dist/components/paywall/paywall-utils.js +11 -9
  20. package/dist/components/purchase-button/PurchaseButton.stories.svelte +13 -6
  21. package/dist/components/purchase-button/PurchaseButton.svelte +24 -10
  22. package/dist/components/purchase-button/purchase-button-utils.d.ts +2 -0
  23. package/dist/components/purchase-button/purchase-button-utils.js +20 -0
  24. package/dist/components/stack/Stack.stories.svelte +1138 -4
  25. package/dist/components/stack/Stack.svelte +162 -45
  26. package/dist/components/stack/stack-utils.d.ts +24 -24
  27. package/dist/components/stack/stack-utils.js +245 -12
  28. package/dist/components/text/Text.svelte +24 -19
  29. package/dist/components/text/TextNode.stories.svelte +12 -11
  30. package/dist/components/text/TextNode.svelte +21 -24
  31. package/dist/components/text/text-utils.d.ts +9 -15
  32. package/dist/components/text/text-utils.js +123 -8
  33. package/dist/components/timeline/Timeline.svelte +10 -10
  34. package/dist/components/timeline/TimelineItem.svelte +45 -33
  35. package/dist/components/timeline/timeline-utils.d.ts +3 -20
  36. package/dist/components/timeline/timeline-utils.js +46 -11
  37. package/dist/data/entities.d.ts +41 -11
  38. package/dist/index.d.ts +2 -2
  39. package/dist/index.js +2 -2
  40. package/dist/stories/fixtures.d.ts +3 -1
  41. package/dist/stories/fixtures.js +7581 -3120
  42. package/dist/types.d.ts +4 -3
  43. package/dist/utils/style-utils.d.ts +72 -63
  44. package/dist/utils/style-utils.js +120 -102
  45. package/dist/utils/variable-utils.d.ts +27 -0
  46. package/dist/utils/variable-utils.js +37 -0
  47. package/package.json +3 -2
  48. package/dist/components/paywall/global-styles.css +0 -9
@@ -9,6 +9,7 @@
9
9
  getTextControlStoryMeta,
10
10
  horizontalAlignmentStoryMeta,
11
11
  } from "../../stories/meta-templates";
12
+ import type { VariableDictionary } from "../../utils/variable-utils";
12
13
 
13
14
  /*
14
15
  * Documentation for this component can be found in https://www.notion.so/revenuecat/Text-e257cb046e104351861f8364ede617be?pvs=4
@@ -72,7 +73,7 @@
72
73
  args={{
73
74
  font_weight: "bold",
74
75
  text_style: "normal",
75
- horizontal_alignment: "start",
76
+ horizontal_alignment: "leading",
76
77
  name: "hello world!",
77
78
  }}
78
79
  />
@@ -94,7 +95,7 @@
94
95
  args={{
95
96
  font_weight: "regular",
96
97
  text_style: "normal",
97
- horizontal_alignment: "start",
98
+ horizontal_alignment: "leading",
98
99
  color: {
99
100
  dark: { type: "hex", value: "#3471eb" },
100
101
  light: { type: "hex", value: "#3471eb" },
@@ -113,8 +114,8 @@
113
114
  args={{
114
115
  font_weight: "regular",
115
116
  text_style: "normal",
116
- horizontal_alignment: "start",
117
- size: { width: { type: "fixed", value: 200 }, height: { type: "fixed" } },
117
+ horizontal_alignment: "leading",
118
+ size: { width: { type: "fixed", value: 200 }, height: { type: "fit" } },
118
119
  padding: { top: 20, trailing: 20, bottom: 20, leading: 20 },
119
120
  color: {
120
121
  dark: {
@@ -169,8 +170,8 @@
169
170
  args={{
170
171
  font_weight: "regular",
171
172
  text_style: "normal",
172
- horizontal_alignment: "start",
173
- size: { width: { type: "fixed", value: 200 }, height: { type: "fixed" } },
173
+ horizontal_alignment: "leading",
174
+ size: { width: { type: "fixed", value: 200 }, height: { type: "fit" } },
174
175
  padding: { top: 20, trailing: 20, bottom: 20, leading: 20 },
175
176
  color: {
176
177
  dark: {
@@ -224,7 +225,7 @@
224
225
  args={{
225
226
  font_weight: "regular",
226
227
  text_style: "normal",
227
- horizontal_alignment: "start",
228
+ horizontal_alignment: "leading",
228
229
  padding: { top: 16, trailing: 24, bottom: 16, leading: 24 },
229
230
  margin: { top: 8, trailing: 0, bottom: 8, leading: 0 },
230
231
  name: "hello world!",
@@ -237,11 +238,11 @@
237
238
  args={{
238
239
  font_weight: "regular",
239
240
  text_style: "normal",
240
- horizontal_alignment: "start",
241
+ horizontal_alignment: "leading",
241
242
  padding: { top: 16, trailing: 24, bottom: 16, leading: 24 },
242
243
  margin: { top: 8, trailing: 0, bottom: 8, leading: 0 },
243
244
  name: "hello world!",
244
- variableDictionary: mockVariableDictionary,
245
+ variableDictionary: mockVariableDictionary as VariableDictionary,
245
246
  labels: {
246
247
  en_US: {
247
248
  lb123:
@@ -257,11 +258,11 @@
257
258
  args={{
258
259
  font_weight: "regular",
259
260
  text_style: "normal",
260
- horizontal_alignment: "start",
261
+ horizontal_alignment: "leading",
261
262
  padding: { top: 16, trailing: 24, bottom: 16, leading: 24 },
262
263
  margin: { top: 8, trailing: 0, bottom: 8, leading: 0 },
263
264
  name: "hello world!",
264
- variableDictionary: mockVariableDictionary,
265
+ variableDictionary: mockVariableDictionary as VariableDictionary,
265
266
  labels: {
266
267
  en_US: {
267
268
  lb123:
@@ -1,13 +1,12 @@
1
1
  <script lang="ts">
2
- import { getTextComponentStyles } from "./text-utils";
2
+ import {
3
+ getHtmlFromMarkdown,
4
+ getTextNodeStyles,
5
+ getTextWrapperStyles,
6
+ } from "./text-utils";
3
7
  import Text from "./Text.svelte";
4
8
  import type { TextNodeProps } from "../../data/entities";
5
- import {
6
- getComponentStyles,
7
- getLabelAndReplaceVariables,
8
- getSizeStyle,
9
- stringifyStyles,
10
- } from "../../utils/style-utils";
9
+ import { getLabelAndReplaceVariables } from "../../utils/variable-utils";
11
10
 
12
11
  const {
13
12
  id,
@@ -19,8 +18,9 @@
19
18
  size,
20
19
  ...restProps
21
20
  }: TextNodeProps = $props();
21
+
22
22
  const { tagToRender, textStyles } = $derived(
23
- getTextComponentStyles({
23
+ getTextNodeStyles({
24
24
  id,
25
25
  labels,
26
26
  text_lid,
@@ -30,16 +30,10 @@
30
30
  ...restProps,
31
31
  }),
32
32
  );
33
+
33
34
  const wrapperStyles = $derived(
34
- stringifyStyles({
35
- ...getComponentStyles({
36
- backgroundColor: background_color,
37
- ...restProps,
38
- }),
39
- ...getSizeStyle(size),
40
- }),
35
+ getTextWrapperStyles(restProps, size, background_color),
41
36
  );
42
- const styles = $derived(stringifyStyles(textStyles));
43
37
 
44
38
  const parsedLabel = $derived(
45
39
  getLabelAndReplaceVariables({
@@ -50,20 +44,23 @@
50
44
  variableDictionary,
51
45
  }),
52
46
  );
47
+ const markdownParsed = $derived(getHtmlFromMarkdown(parsedLabel));
53
48
  </script>
54
49
 
55
- <span style={wrapperStyles} class="text-wrapper">
56
- <Text styleVariables={styles} component={tagToRender} {id}>
57
- {parsedLabel}
50
+ <span style={wrapperStyles} class="rc-pw-text-wrapper">
51
+ <Text styleVariables={textStyles} component={tagToRender} {id}>
52
+ {@html markdownParsed}
58
53
  </Text>
59
54
  </span>
60
55
 
61
56
  <style>
62
- .text-wrapper {
57
+ .rc-pw-text-wrapper {
63
58
  display: block;
64
-
65
- height: var(--height, unset);
66
- width: var(--width, unset);
67
- background: var(--background, none);
59
+ height: var(--text-height, initial);
60
+ width: var(--text-width, initial);
61
+ background: var(--text-background, none);
62
+ position: var(--text-position, relative);
63
+ inset: var(--text-inset, 0);
64
+ transform: var(--text-transform, initial);
68
65
  }
69
66
  </style>
@@ -1,16 +1,5 @@
1
- import { type TextComponentTags } from "../../utils/style-utils";
2
1
  import type { TextNodeProps } from "../../data/entities";
3
- import type { ColorType } from "../../types";
4
- type TextStyleVariables = {
5
- "--width": string;
6
- "--height": string;
7
- "--text-align": string;
8
- "--font-weight": number | string;
9
- "--font-size": string;
10
- "--font-family": string;
11
- "--background-clip": string;
12
- "--text-fill-color": string;
13
- };
2
+ import type { ColorType, SizeType } from "../../types";
14
3
  export declare const defaultColor: ColorType;
15
4
  export declare const defaultBackgroundColor: ColorType;
16
5
  /**
@@ -19,7 +8,12 @@ export declare const defaultBackgroundColor: ColorType;
19
8
  * @returns Object containing text style variables and the appropriate HTML tag to render
20
9
  */
21
10
  export declare const getTextComponentStyles: (props: TextNodeProps) => {
22
- textStyles: Partial<TextStyleVariables>;
23
- tagToRender: Partial<TextComponentTags>;
11
+ textStyles: Record<string, string | number>;
12
+ tagToRender: import("../../utils/style-utils").TextComponentTags;
13
+ };
14
+ export declare function getTextWrapperStyles(restProps: Partial<TextNodeProps>, size: SizeType, background_color?: ColorType): string;
15
+ export declare function getTextNodeStyles(props: TextNodeProps): {
16
+ tagToRender: import("../../utils/style-utils").TextComponentTags;
17
+ textStyles: string;
24
18
  };
25
- export {};
19
+ export declare function getHtmlFromMarkdown(text?: string): string;
@@ -1,4 +1,4 @@
1
- import { getActiveStateProps, getComponentStyles, getSizeStyle, getTextComponentTag, getTextStyles, } from "../../utils/style-utils";
1
+ import { getActiveStateProps, getComponentStyles, getSizeStyle, getTextComponentTag, getTextStyles, prefixObject, stringifyStyles, } from "../../utils/style-utils";
2
2
  export const defaultColor = {
3
3
  light: { type: "hex", value: "#000000" },
4
4
  };
@@ -12,24 +12,139 @@ export const defaultBackgroundColor = {
12
12
  */
13
13
  export const getTextComponentStyles = (props) => {
14
14
  const { font_size = "body_m", color = defaultColor, background_color = defaultBackgroundColor, padding, margin, size, purchaseState, } = props;
15
+ const styles = {
16
+ "--width": "unset",
17
+ "--height": "unset",
18
+ "--text-align": "initial",
19
+ "--font-weight": "initial",
20
+ "--font-size": "initial",
21
+ "--font-family": "sans-serif",
22
+ "--background-clip": "unset",
23
+ "--text-fill-color": "unset",
24
+ "--margin-block-start": "0px",
25
+ "--margin-inline-end": "0px",
26
+ "--margin-block-end": "0px",
27
+ "--margin-inline-start": "0px",
28
+ "--padding-block-start": "0px",
29
+ "--padding-inline-end": "0px",
30
+ "--padding-block-end": "0px",
31
+ "--padding-inline-start": "0px",
32
+ "--background": "transparent",
33
+ "--text-color": "inherit",
34
+ "--border": "none",
35
+ "--border-end-start-radius": "0px",
36
+ "--border-end-end-radius": "0px",
37
+ "--border-start-start-radius": "0px",
38
+ "--border-start-end-radius": "0px",
39
+ "--shadow": "none",
40
+ "--flex": "0 1 auto",
41
+ };
15
42
  const activeStateProps = getActiveStateProps(props.overrides, props.componentState);
16
43
  const tagToRender = getTextComponentTag(font_size);
17
44
  const textStyles = getTextStyles({ ...props, ...activeStateProps }, purchaseState.colorMode);
18
45
  const componentStyles = getComponentStyles({
19
- backgroundColor: background_color,
20
- textColor: color,
46
+ background_color,
47
+ color,
21
48
  margin,
22
49
  padding,
23
50
  colorMode: purchaseState.colorMode,
24
51
  ...activeStateProps,
25
52
  });
26
53
  const sizeStyles = getSizeStyle({ ...size, ...activeStateProps });
54
+ const stylesObject = {
55
+ ...styles,
56
+ ...componentStyles,
57
+ ...textStyles,
58
+ ...sizeStyles,
59
+ };
27
60
  return {
28
- textStyles: {
29
- ...componentStyles,
30
- ...textStyles,
31
- ...sizeStyles,
32
- },
61
+ textStyles: prefixObject(stylesObject, "text"),
33
62
  tagToRender,
34
63
  };
35
64
  };
65
+ export function getTextWrapperStyles(restProps, size, background_color) {
66
+ const styles = {
67
+ "--width": "unset",
68
+ "--height": "unset",
69
+ "--flex": "0 1 auto",
70
+ "--margin-block-start": "0px",
71
+ "--margin-inline-end": "0px",
72
+ "--margin-block-end": "0px",
73
+ "--margin-inline-start": "0px",
74
+ "--padding-block-start": "0px",
75
+ "--padding-inline-end": "0px",
76
+ "--padding-block-end": "0px",
77
+ "--padding-inline-start": "0px",
78
+ "--background": "transparent",
79
+ "--text-color": "inherit",
80
+ "--border": "none",
81
+ "--border-end-start-radius": "0px",
82
+ "--border-end-end-radius": "0px",
83
+ "--border-start-start-radius": "0px",
84
+ "--border-start-end-radius": "0px",
85
+ "--shadow": "none",
86
+ "--position": "relative",
87
+ "--inset": "0",
88
+ "--transform": "initial",
89
+ };
90
+ Object.assign(styles, getComponentStyles({
91
+ background_color,
92
+ ...restProps,
93
+ }), getSizeStyle(size));
94
+ Object.assign(styles, restProps.zStackChildStyles);
95
+ const prefixedStyles = prefixObject(styles, "text");
96
+ return stringifyStyles(prefixedStyles);
97
+ }
98
+ export function getTextNodeStyles(props) {
99
+ const styles = {
100
+ "--text-margin-block-start": "0px",
101
+ "--text-margin-inline-end": "0px",
102
+ "--text-margin-block-end": "0px",
103
+ "--text-margin-inline-start": "0px",
104
+ "--text-padding-block-start": "0px",
105
+ "--text-padding-inline-end": "0px",
106
+ "--text-padding-block-end": "0px",
107
+ "--text-padding-inline-start": "0px",
108
+ "--text-background": "transparent",
109
+ "--text-text-color": "inherit",
110
+ "--text-border": "none",
111
+ "--text-border-end-start-radius": "0px",
112
+ "--text-border-end-end-radius": "0px",
113
+ "--text-border-start-start-radius": "0px",
114
+ "--text-border-start-end-radius": "0px",
115
+ "--text-shadow": "none",
116
+ "--text-text-align": "initial",
117
+ "--text-font-weight": "initial",
118
+ "--text-font-size": "initial",
119
+ "--text-font-family": "sans-serif",
120
+ "--text-background-clip": "initial",
121
+ "--text-text-fill-color": "initial",
122
+ "--text-width": "unset",
123
+ "--text-height": "unset",
124
+ "--text-flex": "0 1 auto",
125
+ };
126
+ const { tagToRender, textStyles } = getTextComponentStyles(props);
127
+ Object.assign(styles, textStyles);
128
+ return { tagToRender, textStyles: stringifyStyles(styles) };
129
+ }
130
+ export function getHtmlFromMarkdown(text) {
131
+ if (!text)
132
+ return "";
133
+ const regexpDictionary = {
134
+ newLine: { regexp: /\\\n/g, output: "<br/>" },
135
+ bold: { regexp: /\*\*(.*?)\*\*/g, output: "<b>$1</b>" },
136
+ italic: { regexp: /\*(.*?)\*/g, output: "<i>$1</i>" },
137
+ strikethrough: { regexp: /~(.*?)~/g, output: "<s>$1</s>" },
138
+ code: {
139
+ regexp: /`(.*?)`/g,
140
+ output: "<span style='font-family: monospace'>$1</span>",
141
+ },
142
+ link: {
143
+ regexp: /\[(.*?)\]\((.*?)\)/g,
144
+ output: "<a href=$2 target='_blank' rel='noopener noreferrer'>$1</a>",
145
+ },
146
+ };
147
+ return Object.values(regexpDictionary).reduce((parsedText, { regexp, output }) => {
148
+ return parsedText.replaceAll(regexp, output);
149
+ }, text);
150
+ }
@@ -2,17 +2,14 @@
2
2
  import { getTimelineStyles } from "./timeline-utils";
3
3
  import TimelineItem from "./TimelineItem.svelte";
4
4
  import type { TimelineProps } from "../../data/entities";
5
- import { stringifyStyles } from "../../utils/style-utils";
6
5
 
7
6
  const { items, ...restProps }: TimelineProps = $props();
8
7
 
9
- const timelineStyles = $derived(
10
- stringifyStyles(getTimelineStyles({ items, ...restProps })),
11
- );
8
+ const timelineStyles = $derived(getTimelineStyles({ items, ...restProps }));
12
9
  </script>
13
10
 
14
11
  {#if items.length}
15
- <div class="timeline-container" style={timelineStyles}>
12
+ <div class="rc-pw-timeline-container" style={timelineStyles}>
16
13
  {#each items as item, index}
17
14
  <TimelineItem
18
15
  {...item}
@@ -29,12 +26,15 @@
29
26
  {/if}
30
27
 
31
28
  <style>
32
- .timeline-container {
29
+ .rc-pw-timeline-container {
33
30
  display: flex;
34
- flex: var(--flex, 0 1 auto);
31
+ flex: var(--timeline-flex, 0 1 auto);
35
32
  flex-direction: column;
36
- gap: var(--item-spacing, 0);
37
- width: var(--width, unset);
38
- height: var(--height, unset);
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
39
  }
40
40
  </style>
@@ -4,10 +4,9 @@
4
4
  getTimelineItemTextStyles,
5
5
  } from "./timeline-utils";
6
6
  import type { TimelineItemProps } from "../../data/entities";
7
- import { stringifyStyles } from "../../utils/style-utils";
8
7
 
9
8
  const props: TimelineItemProps = $props();
10
- const styles = $derived(stringifyStyles(getTimelineItemStyles(props)));
9
+ const styles = $derived(getTimelineItemStyles(props));
11
10
 
12
11
  const {
13
12
  tagToRender: titleTagToRender,
@@ -23,20 +22,20 @@
23
22
  // TODO: Object mapping icon name to icon component
24
23
  </script>
25
24
 
26
- <div class="timeline-item" style={styles}>
27
- <div class="timeline-item-icon-container">
28
- <div class="timeline-item-icon"></div>
25
+ <div class="rc-pw-timeline-item" style={styles}>
26
+ <div class="rc-pw-timeline-item-icon-container">
27
+ <div class="rc-pw-timeline-item-icon"></div>
29
28
  </div>
30
- <div class="timeline-item-content">
29
+ <div class="rc-pw-timeline-item-content">
31
30
  <svelte:element
32
31
  this={titleTagToRender}
33
- class="timeline-item-content-title"
32
+ class="rc-pw-timeline-item-content-title"
34
33
  style={titleStyles}>{titleLabel}</svelte:element
35
34
  >
36
35
  {#if descriptionLabel}
37
36
  <svelte:element
38
37
  this={descriptionTagToRender}
39
- class="timeline-item-content-description"
38
+ class="rc-pw-timeline-item-content-description"
40
39
  style={descriptionStyles}>{descriptionLabel}</svelte:element
41
40
  >
42
41
  {/if}
@@ -44,57 +43,70 @@
44
43
  </div>
45
44
 
46
45
  <style>
47
- .timeline-item {
46
+ .rc-pw-timeline-item {
48
47
  display: flex;
49
48
  align-items: center;
50
- gap: var(--item-spacing, 0px);
49
+ gap: var(--timeline-item-spacing, 0px);
51
50
  }
52
51
 
53
- .timeline-item-icon-container {
52
+ .rc-pw-timeline-item-icon-container {
54
53
  position: relative;
55
- border-radius: var(--icon-border-radius, 0px);
56
- width: var(--icon-size, 16px);
57
- height: var(--icon-size, 16px);
54
+ border-end-start-radius: var(--timeline-item-border-end-start-radius, 0px);
55
+ border-end-end-radius: var(--timeline-item-border-end-end-radius, 0px);
56
+ border-start-start-radius: var(
57
+ --timeline-item-border-start-start-radius,
58
+ 0px
59
+ );
60
+ border-start-end-radius: var(--timeline-item-border-start-end-radius, 0px);
61
+ width: var(--timeline-item-icon-size, 16px);
62
+ height: var(--timeline-item-icon-size, 16px);
58
63
  flex-shrink: 0;
59
- background-color: var(--icon-background-color, #ffffff);
60
- border: var(--icon-border, unset);
64
+ background-color: var(--timeline-item-icon-background-color, #ffffff);
65
+ border: var(--timeline-item-icon-border, initial);
61
66
  display: flex;
62
67
  align-items: center;
63
68
  justify-content: center;
64
- padding: var(--icon-padding, 0px);
69
+ padding: var(--timeline-item-icon-padding, 0px);
70
+ box-sizing: content-box;
65
71
  }
66
72
 
67
- .timeline-item-icon-container::before {
73
+ .rc-pw-timeline-item-icon-container::before {
68
74
  position: absolute;
69
75
  content: "";
70
76
  z-index: -1;
71
- top: var(--connector-top, 0px);
72
- height: var(--connector-height, 0px);
73
- width: var(--connector-width, 0px);
74
- background: var(--connector-color, transparent);
77
+ top: var(--timeline-item-connector-top, 0px);
78
+ height: var(--timeline-item-connector-height, 0px);
79
+ width: var(--timeline-item-connector-width, 0px);
80
+ background: var(--timeline-item-connector-color, transparent);
75
81
  }
76
82
 
77
- .timeline-item-icon {
78
- width: var(--icon-width, 10px);
79
- height: var(--icon-height, 10px);
80
- color: var(--icon-color, #ffffff);
83
+ .rc-pw-timeline-item-icon {
84
+ width: var(--timeline-item-icon-size, 10px);
85
+ height: var(--timeline-item-icon-size, 10px);
86
+ color: var(--timeline-item-icon-color, #ffffff);
81
87
  display: flex;
82
88
  align-items: center;
83
89
  justify-content: center;
84
90
  }
85
91
 
86
- .timeline-item-content {
92
+ .rc-pw-timeline-item-content {
87
93
  display: flex;
88
94
  flex-direction: column;
89
95
  justify-content: flex-start;
90
96
  align-items: flex-start;
91
- gap: var(--text-spacing, 0px);
97
+ gap: var(--timeline-item-text-spacing, 0px);
92
98
  height: fit-content;
93
99
  }
94
- .timeline-item-content-title,
95
- .timeline-item-content-description {
96
- margin: var(--text-margin, 0px);
97
- padding: var(--text-padding, 0px);
98
- font-family: var(--font-family, sans-serif);
100
+ .rc-pw-timeline-item-content-title,
101
+ .rc-pw-timeline-item-content-description {
102
+ margin-block-start: var(--timeline-item-text-margin-block-start, 0px);
103
+ margin-inline-end: var(--timeline-item-text-margin-inline-end, 0px);
104
+ margin-block-end: var(--timeline-item-text-margin-block-end, 0px);
105
+ margin-inline-start: var(--timeline-item-text-margin-inline-start, 0px);
106
+ padding-block-start: var(--timeline-item-text-padding-block-start, 0);
107
+ padding-inline-end: var(--timeline-item-text-padding-inline-end, 0);
108
+ padding-block-end: var(--timeline-item-text-padding-block-end, 0);
109
+ padding-inline-start: var(--timeline-item-text-padding-inline-start, 0);
110
+ font-family: var(--timeline-item-text-font-family, sans-serif);
99
111
  }
100
112
  </style>
@@ -1,25 +1,8 @@
1
1
  import type { TimelineItemProps, TimelineProps } from "../../data/entities";
2
- export declare function getTimelineStyles(props: TimelineProps): {
3
- "--item-spacing": string;
4
- "--width": string;
5
- "--height": string;
6
- "--flex": string;
7
- };
8
- export declare function getTimelineItemStyles(props: TimelineItemProps): {
9
- "--icon-size": string;
10
- "--icon-padding": string;
11
- "--icon-color": string;
12
- "--text-spacing": string;
13
- "--icon-background-color": string;
14
- "--icon-border": string;
15
- "--icon-border-radius": string;
16
- "--connector-color": string;
17
- "--connector-width": string;
18
- "--connector-top": string;
19
- "--connector-height": string;
20
- };
2
+ export declare function getTimelineStyles(props: TimelineProps): string;
3
+ export declare function getTimelineItemStyles(props: TimelineItemProps): string;
21
4
  export declare function getTimelineItemTextStyles(props: TimelineItemProps, kind?: "title" | "description"): {
22
5
  textStyles: string;
23
- tagToRender: Partial<import("../../utils/style-utils").TextComponentTags>;
6
+ tagToRender: import("../../utils/style-utils").TextComponentTags;
24
7
  textLabel: string | undefined;
25
8
  };
@@ -1,14 +1,20 @@
1
1
  import { defaultColor, getTextComponentStyles, } from "../text/text-utils";
2
- import { getBorderStyle, getColor, getCornerRadiusStyle, getLabelAndReplaceVariables, getSizeStyle, stringifyStyles, } from "../../utils/style-utils";
2
+ import { getBorderStyle, getColor, getCornerRadiusStyle, getSizeStyle, prefixObject, stringifyStyles, } from "../../utils/style-utils";
3
+ import { getLabelAndReplaceVariables } from "../../utils/variable-utils";
3
4
  export function getTimelineStyles(props) {
4
5
  const styles = {
5
6
  "--item-spacing": `${props.item_spacing}px`,
6
- "--width": "unset",
7
- "--height": "unset",
7
+ "--width": "initial",
8
+ "--height": "initial",
8
9
  "--flex": "0 1 auto",
10
+ "--position": "relative",
11
+ "--inset": "0",
12
+ "--transform": "initial",
9
13
  };
10
14
  Object.assign(styles, getSizeStyle(props.size));
11
- return styles;
15
+ Object.assign(styles, props.zStackChildStyles);
16
+ const prefixedStyles = prefixObject(styles, "timeline");
17
+ return stringifyStyles(prefixedStyles);
12
18
  }
13
19
  export function getTimelineItemStyles(props) {
14
20
  const styles = {
@@ -18,15 +24,16 @@ export function getTimelineItemStyles(props) {
18
24
  colorMap: props.icon.color,
19
25
  colorMode: props.purchaseState?.colorMode,
20
26
  }),
21
- "--text-spacing": `${props.text_spacing}px`,
22
27
  "--icon-background-color": getColor({
23
28
  colorMap: props.icon_background?.color,
24
29
  colorMode: props.purchaseState.colorMode,
25
30
  }),
26
31
  "--icon-border": getBorderStyle(props.icon_background?.border, props.purchaseState?.colorMode),
27
- "--icon-border-radius": props.icon_background?.shape?.type === "rectangle"
28
- ? getCornerRadiusStyle(props.icon_background.shape.corners)
29
- : "50%",
32
+ "--text-spacing": `${props.text_spacing}px`,
33
+ "--border-start-start-radius": `0px`,
34
+ "--border-start-end-radius": `0px`,
35
+ "--border-end-start-radius": `0px`,
36
+ "--border-end-end-radius": `0px`,
30
37
  "--connector-color": getColor({
31
38
  colorMap: props.connector?.color,
32
39
  colorMode: props.purchaseState.colorMode,
@@ -35,6 +42,14 @@ export function getTimelineItemStyles(props) {
35
42
  "--connector-top": "0px",
36
43
  "--connector-height": `${props.item_spacing}px`,
37
44
  };
45
+ Object.assign(styles, props.icon_background?.shape?.type === "rectangle"
46
+ ? getCornerRadiusStyle(props.icon_background?.shape?.corners)
47
+ : {
48
+ "--border-start-start-radius": "50%",
49
+ "--border-start-end-radius": "50%",
50
+ "--border-end-start-radius": "50%",
51
+ "--border-end-end-radius": "50%",
52
+ });
38
53
  if (props.connector) {
39
54
  const hasMarginTop = props.connector.margin.top !== 0;
40
55
  const hasMarginBottom = props.connector.margin.bottom !== 0;
@@ -62,9 +77,24 @@ export function getTimelineItemStyles(props) {
62
77
  `calc(100% + ${props.connector.margin.top}px)`;
63
78
  }
64
79
  }
65
- return styles;
80
+ const prefixedStyles = prefixObject(styles, "timeline-item");
81
+ return stringifyStyles(prefixedStyles);
66
82
  }
67
83
  export function getTimelineItemTextStyles(props, kind = "title") {
84
+ const styles = {
85
+ "--text-color": "inherit",
86
+ "--text-font-size": "initial",
87
+ "--text-font-weight": "initial",
88
+ "--text-horizontal-alignment": "initial",
89
+ "--text-margin-block-start": "0px",
90
+ "--text-margin-inline-end": "0px",
91
+ "--text-margin-block-end": "0px",
92
+ "--text-margin-inline-start": "0px",
93
+ "--text-padding-block-start": "0px",
94
+ "--text-padding-inline-end": "0px",
95
+ "--text-padding-block-end": "0px",
96
+ "--text-padding-inline-start": "0px",
97
+ };
68
98
  const textProps = {
69
99
  color: props[kind]?.color || defaultColor,
70
100
  font_size: props[kind]?.font_size || "body_m",
@@ -81,7 +111,8 @@ export function getTimelineItemTextStyles(props, kind = "title") {
81
111
  padding: { top: 0, bottom: 0, leading: 0, trailing: 0 },
82
112
  text_lid: "",
83
113
  });
84
- const stringifiedStyles = stringifyStyles(textStyles);
114
+ Object.assign(styles, textStyles);
115
+ const stringifiedStyles = stringifyStyles(prefixObject(styles, "timeline-item"));
85
116
  const textLabel = getLabelAndReplaceVariables({
86
117
  text_lid: props[kind]?.text_lid,
87
118
  locale: props.purchaseState.locale,
@@ -89,5 +120,9 @@ export function getTimelineItemTextStyles(props, kind = "title") {
89
120
  labels: props.labels,
90
121
  variableDictionary: props.variableDictionary,
91
122
  });
92
- return { textStyles: stringifiedStyles, tagToRender, textLabel };
123
+ return {
124
+ textStyles: stringifiedStyles,
125
+ tagToRender,
126
+ textLabel,
127
+ };
93
128
  }