@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.
Files changed (138) hide show
  1. package/dist/components/button/ButtonNode.stories.svelte +66 -108
  2. package/dist/components/button/ButtonNode.svelte +3 -31
  3. package/dist/components/footer/Footer.stories.svelte +112 -106
  4. package/dist/components/footer/Footer.svelte +10 -6
  5. package/dist/components/icon/Icon.stories.svelte +100 -0
  6. package/dist/components/icon/Icon.stories.svelte.d.ts +19 -0
  7. package/dist/components/icon/Icon.svelte +73 -0
  8. package/dist/components/icon/Icon.svelte.d.ts +4 -0
  9. package/dist/components/image/ClipPath.svelte +49 -0
  10. package/dist/components/image/ClipPath.svelte.d.ts +9 -0
  11. package/dist/components/image/Image.stories.svelte +83 -199
  12. package/dist/components/image/Image.svelte +152 -137
  13. package/dist/components/image/Image.svelte.d.ts +1 -1
  14. package/dist/components/image/Overlay.svelte +36 -0
  15. package/dist/components/image/Overlay.svelte.d.ts +8 -0
  16. package/dist/components/package/Package.stories.svelte +12 -27
  17. package/dist/components/package/Package.svelte +10 -44
  18. package/dist/components/paywall/Node.svelte +45 -43
  19. package/dist/components/paywall/Node.svelte.d.ts +10 -12
  20. package/dist/components/paywall/Paywall.stories.svelte +36 -140
  21. package/dist/components/paywall/Paywall.svelte +38 -20
  22. package/dist/components/paywall/Paywall.svelte.d.ts +3 -2
  23. package/dist/components/paywall/fixtures/override-paywall.d.ts +2 -0
  24. package/dist/components/paywall/fixtures/override-paywall.js +1310 -0
  25. package/dist/components/paywall/fixtures/stack-paywall.d.ts +2 -0
  26. package/dist/components/paywall/fixtures/stack-paywall.js +5223 -0
  27. package/dist/components/paywall/fixtures/variables.d.ts +261 -0
  28. package/dist/components/paywall/fixtures/variables.js +262 -0
  29. package/dist/components/purchase-button/PurchaseButton.stories.svelte +10 -29
  30. package/dist/components/purchase-button/PurchaseButton.svelte +2 -34
  31. package/dist/components/stack/Stack.stories.svelte +2364 -1020
  32. package/dist/components/stack/Stack.svelte +108 -151
  33. package/dist/components/stack/Stack.svelte.d.ts +6 -2
  34. package/dist/components/stack/stack-utils.d.ts +10 -30
  35. package/dist/components/stack/stack-utils.js +77 -257
  36. package/dist/components/text/Text.svelte +3 -37
  37. package/dist/components/text/Text.svelte.d.ts +1 -2
  38. package/dist/components/text/TextNode.stories.svelte +10 -48
  39. package/dist/components/text/TextNode.svelte +25 -37
  40. package/dist/components/text/TextNode.svelte.d.ts +1 -1
  41. package/dist/components/text/text-utils.d.ts +4 -9
  42. package/dist/components/text/text-utils.js +32 -117
  43. package/dist/components/timeline/Timeline.stories.svelte +640 -256
  44. package/dist/components/timeline/Timeline.svelte +42 -30
  45. package/dist/components/timeline/Timeline.svelte.d.ts +1 -1
  46. package/dist/components/timeline/TimelineItem.svelte +80 -112
  47. package/dist/components/timeline/TimelineItem.svelte.d.ts +6 -2
  48. package/dist/components/timeline/timeline-utils.d.ts +24 -6
  49. package/dist/components/timeline/timeline-utils.js +21 -114
  50. package/dist/data/entities.d.ts +23 -169
  51. package/dist/index.d.ts +11 -10
  52. package/dist/index.js +11 -10
  53. package/dist/stores/color-mode.d.ts +1 -1
  54. package/dist/stores/localization.d.ts +1 -1
  55. package/dist/stores/localization.js +3 -2
  56. package/dist/stores/paywall.d.ts +7 -3
  57. package/dist/stores/selected.d.ts +5 -0
  58. package/dist/stores/selected.js +12 -0
  59. package/dist/stores/variables.d.ts +2 -3
  60. package/dist/stores/variables.js +0 -1
  61. package/dist/stories/component-decorator.d.ts +2 -0
  62. package/dist/stories/component-decorator.js +12 -0
  63. package/dist/stories/fixtures.d.ts +6 -4
  64. package/dist/stories/fixtures.js +6241 -5485
  65. package/dist/stories/localization-decorator.js +1 -1
  66. package/dist/stories/paywall-decorator.js +8 -1
  67. package/dist/stories/variables-decorator.d.ts +1 -1
  68. package/dist/stories/viewport-decorator.d.ts +2 -0
  69. package/dist/stories/viewport-decorator.js +8 -0
  70. package/dist/stories/viewport-wrapper.svelte +53 -0
  71. package/dist/stories/viewport-wrapper.svelte.d.ts +10 -0
  72. package/dist/stories/with-layout.d.ts +2 -10
  73. package/dist/stories/with-layout.js +3 -5
  74. package/dist/stories/with-layout.svelte +3 -3
  75. package/dist/types/alignment.d.ts +5 -3
  76. package/dist/types/background.d.ts +6 -5
  77. package/dist/types/base.d.ts +7 -0
  78. package/dist/types/colors.d.ts +4 -4
  79. package/dist/types/component.d.ts +10 -0
  80. package/dist/types/component.js +1 -0
  81. package/dist/types/components/button.d.ts +5 -2
  82. package/dist/types/components/footer.d.ts +3 -2
  83. package/dist/types/components/icon.d.ts +28 -0
  84. package/dist/types/components/icon.js +1 -0
  85. package/dist/types/components/image.d.ts +20 -0
  86. package/dist/types/components/image.js +1 -0
  87. package/dist/types/components/package.d.ts +3 -2
  88. package/dist/types/components/purchase-button.d.ts +3 -2
  89. package/dist/types/components/stack.d.ts +32 -0
  90. package/dist/types/components/stack.js +1 -0
  91. package/dist/types/components/text.d.ts +20 -0
  92. package/dist/types/components/text.js +1 -0
  93. package/dist/types/components/timeline.d.ts +35 -0
  94. package/dist/types/components/timeline.js +1 -0
  95. package/dist/types/localization.d.ts +2 -1
  96. package/dist/types/media.d.ts +4 -3
  97. package/dist/types/overrides.d.ts +48 -0
  98. package/dist/types/overrides.js +1 -0
  99. package/dist/types/variables.d.ts +13 -0
  100. package/dist/types/variables.js +10 -0
  101. package/dist/types.d.ts +17 -9
  102. package/dist/ui/atoms/typography.stories.svelte +3 -29
  103. package/dist/ui/atoms/typography.stories.svelte.d.ts +1 -1
  104. package/dist/ui/layout/main-block.svelte +2 -2
  105. package/dist/ui/molecules/button.stories.svelte +5 -10
  106. package/dist/ui/molecules/button.svelte +1 -1
  107. package/dist/ui/theme/colors.d.ts +0 -6
  108. package/dist/ui/theme/colors.js +1 -1
  109. package/dist/ui/theme/text.d.ts +3 -4
  110. package/dist/ui/theme/theme.d.ts +2 -2
  111. package/dist/ui/theme/theme.js +2 -2
  112. package/dist/ui/theme/utils.d.ts +2 -12
  113. package/dist/ui/theme/utils.js +5 -5
  114. package/dist/utils/background-utils.d.ts +4 -0
  115. package/dist/utils/background-utils.js +39 -0
  116. package/dist/utils/base-utils.d.ts +18 -0
  117. package/dist/utils/base-utils.js +124 -0
  118. package/dist/utils/constants.d.ts +2 -2
  119. package/dist/utils/constants.js +6 -1
  120. package/dist/utils/font-utils.d.ts +4 -0
  121. package/dist/utils/font-utils.js +47 -0
  122. package/dist/utils/style-utils.d.ts +7 -120
  123. package/dist/utils/style-utils.js +35 -314
  124. package/dist/utils/variable-utils.d.ts +1 -22
  125. package/dist/utils/variable-utils.js +28 -24
  126. package/dist/web-components/index.css +1 -1
  127. package/dist/web-components/index.js +1415 -987
  128. package/package.json +34 -24
  129. package/dist/components/button/button-utils.d.ts +0 -2
  130. package/dist/components/button/button-utils.js +0 -19
  131. package/dist/components/image/image-utils.d.ts +0 -19
  132. package/dist/components/image/image-utils.js +0 -33
  133. package/dist/components/purchase-button/purchase-button-utils.d.ts +0 -2
  134. package/dist/components/purchase-button/purchase-button-utils.js +0 -20
  135. package/dist/data/state.d.ts +0 -4
  136. package/dist/stories/meta-templates.d.ts +0 -12
  137. package/dist/stories/meta-templates.js +0 -155
  138. /package/dist/{data/state.js → types/base.js} +0 -0
@@ -1,109 +1,52 @@
1
1
  <script module lang="ts">
2
2
  import ButtonNode from "./ButtonNode.svelte";
3
- import type { StackProps, TextNodeProps } from "../../data/entities";
4
- import type { PurchaseState } from "../../data/state";
3
+ import type { TextNodeProps } from "../../types/components/text";
4
+ import { componentDecorator } from "../../stories/component-decorator";
5
5
  import { localizationDecorator } from "../../stories/localization-decorator";
6
+ import type { ButtonProps } from "../../types/components/button";
7
+ import type { StackProps } from "../../types/components/stack";
6
8
  import { DEFAULT_TEXT_COLOR } from "../../utils/constants";
7
9
  import { defineMeta } from "@storybook/addon-svelte-csf";
8
10
 
9
- const defaultLocale = "en_US";
10
-
11
- const purchaseState: PurchaseState = {};
12
-
13
- const { Story } = defineMeta({
14
- title: "Components/Button",
15
- component: ButtonNode,
16
- tags: ["autodocs"],
17
- decorators: [
18
- localizationDecorator({
19
- defaultLocale,
20
- localizations: {
21
- [defaultLocale]: {
22
- id1: "Restore purchases",
23
- id2: "Navigate back",
24
- id3: "Navigate to",
25
- id4: "URL navigation",
26
- },
27
- },
28
- }),
29
- ],
30
- args: { purchaseState },
31
- argTypes: {
32
- action: {
33
- control: { type: "object" },
34
- description: "Action configuration for the button",
35
- table: {
36
- type: {
37
- summary: "object",
38
- detail: `{
39
- type: "restore_purchases" | "navigate_back" | "navigate_to",
40
- destination?: "customer_center" | "privacy_policy" | "terms" | "url",
41
- url?: {
42
- url_lid: string,
43
- method: "in_app_browser" | "external_browser" | "deep_link"
44
- }
45
- }`,
46
- },
47
- },
48
- },
49
- stack: {
50
- control: { type: "object" },
51
- description: "Stack configuration for button content",
52
- table: {
53
- type: {
54
- summary: "object",
55
- detail: "StackProps",
56
- },
57
- },
58
- },
11
+ const textProps = (id: number): TextNodeProps => ({
12
+ type: "text",
13
+ id: `button-text-${id}`,
14
+ name: `button-text-${id}`,
15
+ text_lid: `id${id}`,
16
+ font_size: "body_m",
17
+ font_weight: "medium",
18
+ horizontal_alignment: "center",
19
+ size: {
20
+ width: { type: "fit" },
21
+ height: { type: "fit" },
22
+ },
23
+ margin: { top: 0, trailing: 0, bottom: 0, leading: 0 },
24
+ padding: { top: 0, trailing: 0, bottom: 0, leading: 0 },
25
+ color: {
26
+ dark: { type: "hex", value: DEFAULT_TEXT_COLOR },
27
+ light: { type: "hex", value: "#ffffff" },
28
+ },
29
+ background_color: {
30
+ dark: { type: "hex", value: "transparent" },
31
+ light: { type: "hex", value: "transparent" },
59
32
  },
60
33
  });
61
34
 
62
- const textProps = (id: number) =>
63
- ({
64
- type: "text",
65
- name: "Button Text",
66
- components: [],
67
- id: "button-text-1",
68
- text_lid: `id${id}`,
69
- font_weight: "medium",
70
- horizontal_alignment: "center",
71
- background_color: {
72
- dark: { type: "hex", value: "transparent" },
73
- light: { type: "hex", value: "transparent" },
74
- },
75
- color: {
76
- dark: { type: "hex", value: DEFAULT_TEXT_COLOR },
77
- light: { type: "hex", value: "#ffffff" },
78
- },
79
- font_size: "body_m",
80
- margin: { top: 0, trailing: 0, bottom: 0, leading: 0 },
81
- padding: { top: 0, trailing: 0, bottom: 0, leading: 0 },
82
- size: {
83
- width: { type: "fit" },
84
- height: { type: "fit" },
85
- },
86
- }) satisfies Partial<TextNodeProps>;
87
-
88
- const baseStackProps = {
35
+ const stackProps = (id: number): StackProps => ({
89
36
  type: "stack",
37
+ id: `stack-${id}`,
38
+ name: `Stack ${id}`,
39
+ components: [textProps(id)],
90
40
  size: { width: { type: "fill" }, height: { type: "fill" } },
91
41
  dimension: {
92
42
  type: "horizontal",
93
43
  alignment: "center",
94
44
  distribution: "center",
95
45
  },
96
- components: [],
97
46
  spacing: 16,
98
- padding: { top: 16, trailing: 16, bottom: 16, leading: 16 },
99
47
  margin: { top: 0, trailing: 0, bottom: 0, leading: 0 },
100
- shape: { type: "pill" },
101
- id: "vertical-stack",
102
- name: "Vertical Stack",
103
- background_color: {
104
- dark: { type: "hex", value: "#3471eb" },
105
- light: { type: "hex", value: "#3471eb" },
106
- },
48
+ padding: { top: 16, trailing: 16, bottom: 16, leading: 16 },
49
+ background_color: null,
107
50
  background: {
108
51
  type: "color",
109
52
  value: {
@@ -112,32 +55,54 @@
112
55
  },
113
56
  },
114
57
  border: null,
58
+ shape: { type: "pill" },
115
59
  shadow: null,
116
- purchaseState,
117
- } satisfies Partial<StackProps>;
60
+ badge: null,
61
+ });
62
+
63
+ const defaultLocale = "en_US";
64
+
65
+ const { Story } = defineMeta({
66
+ title: "Components/Button",
67
+ component: ButtonNode,
68
+ decorators: [
69
+ componentDecorator(),
70
+ localizationDecorator({
71
+ defaultLocale,
72
+ localizations: {
73
+ [defaultLocale]: {
74
+ id1: "Restore purchases",
75
+ id2: "Navigate back",
76
+ id3: "Navigate to",
77
+ id4: "URL navigation",
78
+ },
79
+ },
80
+ }),
81
+ ],
82
+ args: {
83
+ type: "button",
84
+ id: "button",
85
+ name: "Button",
86
+ action: { type: "navigate_back" },
87
+ stack: stackProps(1),
88
+ } satisfies ButtonProps,
89
+ });
118
90
  </script>
119
91
 
120
- <!-- Restore purchases -->
121
92
  <Story
122
93
  name="Restore purchases"
123
94
  args={{
124
- type: "button",
125
95
  action: { type: "restore_purchases" },
126
- stack: {
127
- ...baseStackProps,
128
- components: [textProps(1)],
129
- },
96
+ stack: stackProps(1),
130
97
  }}
131
98
  />
132
99
 
133
- <!-- Navigate Back story -->
134
100
  <Story
135
101
  name="Navigate Back"
136
102
  args={{
137
- type: "button",
138
103
  action: { type: "navigate_back" },
139
104
  stack: {
140
- ...baseStackProps,
105
+ ...stackProps(2),
141
106
  shape: {
142
107
  type: "rectangle",
143
108
  corners: {
@@ -151,22 +116,19 @@
151
116
  dark: { type: "hex", value: "#2E7D32" },
152
117
  light: { type: "hex", value: "#2E7D32" },
153
118
  },
154
- components: [textProps(2)],
155
119
  },
156
120
  }}
157
121
  />
158
122
 
159
- <!-- Navigate To story -->
160
123
  <Story
161
124
  name="Navigate To"
162
125
  args={{
163
- type: "button",
164
126
  action: {
165
127
  type: "navigate_to",
166
128
  destination: "customer_center",
167
129
  },
168
130
  stack: {
169
- ...baseStackProps,
131
+ ...stackProps(3),
170
132
  shape: {
171
133
  type: "rectangle",
172
134
  corners: {
@@ -180,16 +142,13 @@
180
142
  dark: { type: "hex", value: "#D32F2F" },
181
143
  light: { type: "hex", value: "#D32F2F" },
182
144
  },
183
- components: [textProps(3)],
184
145
  },
185
146
  }}
186
147
  />
187
148
 
188
- <!-- URL Navigation story -->
189
149
  <Story
190
150
  name="URL Navigation"
191
151
  args={{
192
- type: "button",
193
152
  action: {
194
153
  type: "navigate_to",
195
154
  destination: "url",
@@ -199,12 +158,11 @@
199
158
  },
200
159
  },
201
160
  stack: {
202
- ...baseStackProps,
161
+ ...stackProps(4),
203
162
  background_color: {
204
163
  dark: { type: "hex", value: "#4A90E2" },
205
164
  light: { type: "hex", value: "#4A90E2" },
206
165
  },
207
- components: [textProps(4)],
208
166
  },
209
167
  }}
210
168
  />
@@ -1,40 +1,12 @@
1
1
  <script lang="ts">
2
- import { getButtonStyles } from "./button-utils";
3
2
  import Stack from "../stack/Stack.svelte";
4
- import type { ButtonProps } from "../../types/components/button";
5
- import { ButtonDeprecated } from "../../index";
6
3
  import { getPaywallContext } from "../../stores/paywall";
4
+ import type { ButtonProps } from "../../types/components/button";
7
5
 
8
- const { stack, action, labels, purchaseState, ...restProps }: ButtonProps =
9
- $props();
6
+ const { stack, action }: ButtonProps = $props();
10
7
  const { onButtonAction } = getPaywallContext();
11
8
 
12
9
  const onclick = () => onButtonAction(action);
13
-
14
- const buttonStyles = $derived(
15
- getButtonStyles({
16
- stack,
17
- action,
18
- labels,
19
- purchaseState,
20
- ...restProps,
21
- }),
22
- );
23
10
  </script>
24
11
 
25
- <ButtonDeprecated {onclick} style={buttonStyles} class={"rc-pw-button"}>
26
- <Stack {...stack} {labels} {purchaseState} />
27
- </ButtonDeprecated>
28
-
29
- <style>
30
- .rc-pw-button {
31
- display: flex;
32
- margin: 0;
33
- padding: 0;
34
- text-align: initial;
35
- border: none;
36
- cursor: pointer;
37
- background: transparent;
38
- width: fit-content;
39
- }
40
- </style>
12
+ <Stack {...stack} {onclick} />
@@ -1,18 +1,18 @@
1
1
  <script module lang="ts">
2
2
  import Footer from "./Footer.svelte";
3
- import type { PurchaseState } from "../../data/state";
3
+ import { componentDecorator } from "../../stories/component-decorator";
4
4
  import { localizationDecorator } from "../../stories/localization-decorator";
5
+ import { viewportDecorator } from "../../stories/viewport-decorator";
6
+ import type { FooterProps } from "../../types/components/footer";
5
7
  import { defineMeta } from "@storybook/addon-svelte-csf";
6
8
 
7
9
  const defaultLocale = "en_US";
8
- const purchaseState: PurchaseState = {};
9
10
 
10
11
  const { Story } = defineMeta({
11
12
  title: "Components/Footer",
12
13
  component: Footer,
13
- tags: ["autodocs"],
14
- args: { purchaseState },
15
14
  decorators: [
15
+ componentDecorator(),
16
16
  localizationDecorator({
17
17
  defaultLocale,
18
18
  localizations: {
@@ -22,124 +22,130 @@
22
22
  },
23
23
  }),
24
24
  ],
25
- });
26
- </script>
27
-
28
- <!-- Default -->
29
- <Story
30
- name="Footer component"
31
- args={{
32
- id: "kHhCWlo9au",
33
- name: "",
34
- stack: {
35
- purchaseState,
36
- background_color: {
37
- light: {
38
- type: "hex",
39
- value: "#6c6c6cFF",
40
- },
41
- },
42
- background: {
43
- type: "color",
44
- value: {
25
+ args: {
26
+ type: "footer",
27
+ id: "footer",
28
+ name: "Footer",
29
+ stack: {
30
+ background_color: {
45
31
  light: {
46
32
  type: "hex",
47
33
  value: "#6c6c6cFF",
48
34
  },
49
35
  },
50
- },
51
- border: null,
52
- components: [
53
- {
54
- background_color: null,
55
- color: {
36
+ background: {
37
+ type: "color",
38
+ value: {
56
39
  light: {
57
40
  type: "hex",
58
- value: "#ffffffFF",
41
+ value: "#6c6c6cFF",
59
42
  },
60
43
  },
61
- font_name: null,
62
- font_size: "body_m",
63
- font_weight: "extra_bold",
64
- horizontal_alignment: "center",
65
- id: "pFC3qrx4-c",
66
- margin: {
67
- bottom: 0,
68
- leading: 0,
69
- top: 0,
70
- trailing: 0,
71
- },
72
- name: "",
73
- padding: {
74
- bottom: 10,
75
- leading: 10,
76
- top: 10,
77
- trailing: 10,
78
- },
79
- size: {
80
- height: {
81
- type: "fit",
82
- value: null,
44
+ },
45
+ border: null,
46
+ components: [
47
+ {
48
+ background_color: null,
49
+ color: {
50
+ light: {
51
+ type: "hex",
52
+ value: "#ffffffFF",
53
+ },
54
+ },
55
+ font_name: null,
56
+ font_size: "body_m",
57
+ font_weight: "extra_bold",
58
+ horizontal_alignment: "center",
59
+ id: "pFC3qrx4-c",
60
+ margin: {
61
+ bottom: 0,
62
+ leading: 0,
63
+ top: 0,
64
+ trailing: 0,
83
65
  },
84
- width: {
85
- type: "fit",
86
- value: null,
66
+ name: "",
67
+ padding: {
68
+ bottom: 10,
69
+ leading: 10,
70
+ top: 10,
71
+ trailing: 10,
87
72
  },
73
+ size: {
74
+ height: {
75
+ type: "fit",
76
+ value: null,
77
+ },
78
+ width: {
79
+ type: "fit",
80
+ value: null,
81
+ },
82
+ },
83
+ text_lid: "GM2Sytqd5p",
84
+ type: "text",
88
85
  },
89
- text_lid: "GM2Sytqd5p",
90
- type: "text",
86
+ ],
87
+ dimension: {
88
+ type: "vertical",
89
+ alignment: "center",
90
+ distribution: "center",
91
91
  },
92
- ],
93
- dimension: {
94
- type: "vertical",
95
- alignment: "center",
96
- distribution: "center",
97
- },
98
- id: "yI_0xF4hlJ",
99
- margin: {
100
- bottom: 0,
101
- leading: 0,
102
- top: 0,
103
- trailing: 0,
104
- },
105
- name: "Footer",
106
- padding: {
107
- bottom: 0,
108
- leading: 0,
109
- top: 0,
110
- trailing: 0,
111
- },
112
- shadow: {
113
- color: {
114
- light: {
115
- type: "hex",
116
- value: "#00000033",
117
- },
92
+ id: "yI_0xF4hlJ",
93
+ margin: {
94
+ bottom: 0,
95
+ leading: 0,
96
+ top: 0,
97
+ trailing: 0,
118
98
  },
119
- radius: 16,
120
- x: 0,
121
- y: -4,
122
- },
123
- shape: {
124
- corners: {
125
- bottom_leading: 0,
126
- bottom_trailing: 0,
127
- top_leading: 8,
128
- top_trailing: 8,
99
+ name: "Footer",
100
+ padding: {
101
+ bottom: 0,
102
+ leading: 0,
103
+ top: 0,
104
+ trailing: 0,
129
105
  },
130
- type: "rectangle",
131
- },
132
- size: {
133
- height: {
134
- type: "fit",
106
+ shadow: {
107
+ color: {
108
+ light: {
109
+ type: "hex",
110
+ value: "#00FF007F",
111
+ },
112
+ },
113
+ radius: 16,
114
+ x: 0,
115
+ y: -8,
116
+ },
117
+ shape: {
118
+ corners: {
119
+ bottom_leading: 0,
120
+ bottom_trailing: 0,
121
+ top_leading: 8,
122
+ top_trailing: 8,
123
+ },
124
+ type: "rectangle",
135
125
  },
136
- width: {
137
- type: "fill",
126
+ size: {
127
+ height: {
128
+ type: "fit",
129
+ },
130
+ width: {
131
+ type: "fill",
132
+ },
138
133
  },
134
+ spacing: 0,
135
+ type: "stack",
139
136
  },
140
- spacing: 0,
141
- type: "stack",
142
- },
143
- type: "footer",
144
- }}
137
+ } satisfies FooterProps,
138
+ });
139
+ </script>
140
+
141
+ <Story name="Footer component" />
142
+
143
+ <Story
144
+ name="Footer - no overflow"
145
+ decorators={[viewportDecorator(300, 600, 3)]}
146
+ />
147
+
148
+ <Story
149
+ name="Footer - overflow"
150
+ decorators={[viewportDecorator(300, 600, 50)]}
145
151
  />
@@ -1,19 +1,23 @@
1
1
  <script lang="ts">
2
- import type { FooterProps } from "../../types/components/footer";
3
2
  import Stack from "../stack/Stack.svelte";
3
+ import type { FooterProps } from "../../types/components/footer";
4
4
 
5
- const { stack, id, labels, purchaseState, onAction }: FooterProps = $props();
5
+ const { stack }: FooterProps = $props();
6
6
  </script>
7
7
 
8
- <div class="rc-pw-footer" {id}>
9
- <Stack {...stack} {labels} {purchaseState} {onAction} />
8
+ <div>
9
+ <Stack {...stack} />
10
10
  </div>
11
11
 
12
12
  <style>
13
- .rc-pw-footer {
13
+ div {
14
14
  position: sticky;
15
15
  bottom: 0;
16
- transform: translateY(50%);
17
16
  width: 100%;
17
+ z-index: 1000;
18
+
19
+ display: flex;
20
+ flex-direction: row;
21
+ justify-content: center;
18
22
  }
19
23
  </style>
@@ -0,0 +1,100 @@
1
+ <script module lang="ts">
2
+ import { componentDecorator } from "../../stories/component-decorator";
3
+ import type { IconBackground, IconProps } from "../../types/components/icon";
4
+ import { defineMeta } from "@storybook/addon-svelte-csf";
5
+ import Icon from "./Icon.svelte";
6
+
7
+ const icon_background = {
8
+ color: {
9
+ light: { type: "hex", value: "#345e0aFF" },
10
+ },
11
+ shape: {
12
+ type: "rectangle",
13
+ corners: {
14
+ top_leading: 0,
15
+ top_trailing: 8,
16
+ bottom_trailing: 16,
17
+ bottom_leading: 32,
18
+ },
19
+ },
20
+ border: {
21
+ width: 4,
22
+ color: {
23
+ light: { type: "hex", value: "#8fb43fff" },
24
+ },
25
+ },
26
+ shadow: {
27
+ x: 4,
28
+ y: 4,
29
+ radius: 8,
30
+ color: {
31
+ light: { type: "hex", value: "#00000040" },
32
+ },
33
+ },
34
+ } satisfies IconBackground;
35
+
36
+ const { Story } = defineMeta({
37
+ title: "Components/Icon",
38
+ component: Icon,
39
+ decorators: [componentDecorator()],
40
+ args: {
41
+ type: "icon",
42
+ id: "icon",
43
+ name: "Icon",
44
+ icon_name: "filled-star",
45
+ base_url: "https://icons.pawwalls.com/icons",
46
+ formats: {
47
+ heic: "filled-star.heic",
48
+ png: "filled-star.png",
49
+ svg: "filled-star.svg",
50
+ webp: "filled-star.webp",
51
+ },
52
+ size: {
53
+ width: { type: "fixed", value: 64 },
54
+ height: { type: "fixed", value: 64 },
55
+ },
56
+ margin: { top: 16, trailing: 16, bottom: 16, leading: 16 },
57
+ padding: { top: 8, trailing: 8, bottom: 8, leading: 8 },
58
+ color: {
59
+ light: { type: "hex", value: "#92c91bFF" },
60
+ },
61
+ icon_background,
62
+ } satisfies IconProps,
63
+ });
64
+ </script>
65
+
66
+ <Story name="Square" />
67
+
68
+ <Story
69
+ name="Rectangle"
70
+ args={{
71
+ size: {
72
+ width: { type: "fixed", value: 128 },
73
+ height: { type: "fixed", value: 64 },
74
+ },
75
+ }}
76
+ />
77
+
78
+ <Story
79
+ name="Circle"
80
+ args={{
81
+ icon_background: {
82
+ ...icon_background,
83
+ shape: { type: "circle" },
84
+ },
85
+ }}
86
+ />
87
+
88
+ <Story
89
+ name="Pill"
90
+ args={{
91
+ size: {
92
+ width: { type: "fixed", value: 128 },
93
+ height: { type: "fixed", value: 64 },
94
+ },
95
+ icon_background: {
96
+ ...icon_background,
97
+ shape: { type: "circle" },
98
+ },
99
+ }}
100
+ />