@saasquatch/mint-components 1.3.2-1 → 1.3.2-5

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 (76) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mint-components.cjs.js +1 -1
  3. package/dist/cjs/sqm-big-stat.cjs.entry.js +1 -1
  4. package/dist/cjs/{sqm-divided-layout_27.cjs.entry.js → sqm-divided-layout_28.cjs.entry.js} +976 -395
  5. package/dist/cjs/{useDemoBigStat-17e61803.js → useDemoBigStat-ade0e873.js} +90 -20
  6. package/dist/collection/components/sqm-big-stat/BigStat.stories.js +8 -1
  7. package/dist/collection/components/sqm-big-stat/sqm-big-stat.js +1 -1
  8. package/dist/collection/components/sqm-big-stat/useBigStat.js +89 -20
  9. package/dist/collection/components/sqm-big-stat/useDemoBigStat.js +1 -0
  10. package/dist/collection/components/sqm-reward-exchange-list/SVGs.js +5 -14
  11. package/dist/collection/components/sqm-reward-exchange-list/progressBar.js +27 -40
  12. package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list-view.js +68 -47
  13. package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list.js +2 -1
  14. package/dist/collection/components/sqm-reward-exchange-list/useRewardExchangeList.js +3 -1
  15. package/dist/collection/components/sqm-stencilbook/CucumberAddon.js +3 -1
  16. package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +4 -0
  17. package/dist/collection/components/sqm-task-card/SVGs.js +0 -6
  18. package/dist/collection/components/sqm-task-card/TaskCard.stories.js +74 -243
  19. package/dist/collection/components/sqm-task-card/UseTaskCard.stories.js +41 -0
  20. package/dist/collection/components/sqm-task-card/progress-bar/SVGs.js +7 -0
  21. package/dist/collection/components/sqm-task-card/progress-bar/progress-bar-view.js +311 -0
  22. package/dist/collection/components/sqm-task-card/progress-bar/progress-bar.stories.js +53 -0
  23. package/dist/collection/components/sqm-task-card/sqm-task-card-view.js +15 -309
  24. package/dist/collection/components/sqm-task-card/sqm-task-card.js +108 -48
  25. package/dist/collection/stories/NewPortal.stories.js +15 -15
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/esm/mint-components.js +1 -1
  28. package/dist/esm/sqm-big-stat.entry.js +1 -1
  29. package/dist/esm/{sqm-divided-layout_27.entry.js → sqm-divided-layout_28.entry.js} +940 -360
  30. package/dist/esm/{useDemoBigStat-b71fe122.js → useDemoBigStat-256c096f.js} +90 -20
  31. package/dist/esm-es5/loader.js +1 -1
  32. package/dist/esm-es5/mint-components.js +1 -1
  33. package/dist/esm-es5/sqm-big-stat.entry.js +1 -1
  34. package/dist/esm-es5/sqm-divided-layout_28.entry.js +1 -0
  35. package/dist/esm-es5/useDemoBigStat-256c096f.js +1 -0
  36. package/dist/mint-components/mint-components.esm.js +1 -1
  37. package/dist/mint-components/p-29523e7f.entry.js +288 -0
  38. package/dist/mint-components/{p-e22eed7b.entry.js → p-52f23baa.entry.js} +1 -1
  39. package/dist/mint-components/p-7766f602.system.js +1 -0
  40. package/dist/mint-components/p-7d486e02.system.entry.js +1 -0
  41. package/dist/mint-components/p-917488e5.js +227 -0
  42. package/dist/mint-components/p-91d39961.system.js +1 -1
  43. package/dist/mint-components/p-a6156ea3.system.entry.js +1 -0
  44. package/dist/types/components/sqm-big-stat/sqm-big-stat-view.d.ts +1 -0
  45. package/dist/types/components/sqm-big-stat/useBigStat.d.ts +4 -1
  46. package/dist/types/components/sqm-reward-exchange-list/SVGs.d.ts +1 -0
  47. package/dist/types/components/sqm-reward-exchange-list/progressBar.d.ts +3 -2
  48. package/dist/types/components/sqm-reward-exchange-list/sqm-reward-exchange-list-view.d.ts +1 -0
  49. package/dist/types/components/sqm-task-card/SVGs.d.ts +0 -1
  50. package/dist/types/components/sqm-task-card/TaskCard.stories.d.ts +3 -1
  51. package/dist/types/components/sqm-task-card/UseTaskCard.stories.d.ts +10 -0
  52. package/dist/types/components/sqm-task-card/progress-bar/SVGs.d.ts +1 -0
  53. package/dist/types/components/sqm-task-card/progress-bar/progress-bar-view.d.ts +9 -0
  54. package/dist/types/components/sqm-task-card/progress-bar/progress-bar.stories.d.ts +12 -0
  55. package/dist/types/components/sqm-task-card/sqm-task-card-view.d.ts +13 -22
  56. package/dist/types/components/sqm-task-card/sqm-task-card.d.ts +25 -13
  57. package/dist/types/components.d.ts +48 -34
  58. package/grapesjs/grapesjs.js +1 -1
  59. package/package.json +1 -1
  60. package/dist/cjs/sqm-task-card-view-57066e67.js +0 -476
  61. package/dist/cjs/sqm-task-card.cjs.entry.js +0 -56
  62. package/dist/esm/sqm-task-card-view-2ee495af.js +0 -474
  63. package/dist/esm/sqm-task-card.entry.js +0 -52
  64. package/dist/esm-es5/sqm-divided-layout_27.entry.js +0 -1
  65. package/dist/esm-es5/sqm-task-card-view-2ee495af.js +0 -1
  66. package/dist/esm-es5/sqm-task-card.entry.js +0 -1
  67. package/dist/esm-es5/useDemoBigStat-b71fe122.js +0 -1
  68. package/dist/mint-components/p-1e248afc.system.entry.js +0 -1
  69. package/dist/mint-components/p-353b4413.system.js +0 -1
  70. package/dist/mint-components/p-405a9253.js +0 -227
  71. package/dist/mint-components/p-684850a7.entry.js +0 -287
  72. package/dist/mint-components/p-81dbda90.system.entry.js +0 -1
  73. package/dist/mint-components/p-8f5e2af4.entry.js +0 -1
  74. package/dist/mint-components/p-c9c4f31b.system.entry.js +0 -1
  75. package/dist/mint-components/p-e78a5a91.js +0 -1
  76. package/dist/mint-components/p-f87d8f53.system.js +0 -1
@@ -0,0 +1,311 @@
1
+ import { h } from "@stencil/core";
2
+ import jss from "jss";
3
+ import preset from "jss-preset-default";
4
+ import * as SVGs from "./SVGs";
5
+ export function ProgressBarView(props) {
6
+ const { progress = 0, goal = 1, steps = false, progressBarUnit = "", repeatable = false, } = props;
7
+ console.log("progress bar props", props);
8
+ const gift1 = SVGs.gift();
9
+ const gift2 = SVGs.gift();
10
+ const gift3 = SVGs.gift();
11
+ var items = [];
12
+ var columns = "";
13
+ var repetitions = Math.floor(progress / goal);
14
+ if (repeatable) {
15
+ if (steps) {
16
+ addStepsRepeatable();
17
+ }
18
+ else {
19
+ addLinearRepeatable();
20
+ }
21
+ }
22
+ // non repeatable
23
+ else {
24
+ if (steps) {
25
+ addSteps();
26
+ }
27
+ else {
28
+ addLinear();
29
+ }
30
+ }
31
+ const style = {
32
+ ProgressBar: {
33
+ "& .progress-bar": {
34
+ height: "15px",
35
+ marginTop: "var(--sl-spacing-xx-large)",
36
+ marginBottom: "var(--sl-spacing-xx-large)",
37
+ marginRight: "var(--sl-spacing-x-small)",
38
+ fontSize: "var(--sl-font-size-x-small)",
39
+ display: "grid",
40
+ gridTemplateColumns: columns,
41
+ lineHeight: "45px",
42
+ userSelect: "none",
43
+ },
44
+ "& .progress-bar.repeatable-steps": {
45
+ marginLeft: "var(--sl-spacing-x-small)",
46
+ },
47
+ "& .filled:after": {
48
+ content: '""',
49
+ display: "flex",
50
+ width: "100%",
51
+ height: "4px",
52
+ borderRadius: "4px",
53
+ backgroundColor: "var(--sl-color-primary-500)",
54
+ },
55
+ "& .progress": {
56
+ display: "block",
57
+ textAlign: "center",
58
+ marginLeft: "-100px",
59
+ marginRight: "-100px",
60
+ },
61
+ "& .progress::after": {
62
+ content: '""',
63
+ width: "12px",
64
+ height: "12px",
65
+ display: "flex",
66
+ backgroundColor: "var(--sl-color-primary-500)",
67
+ borderRadius: "50%",
68
+ position: "relative",
69
+ left: "47%",
70
+ top: "-85%",
71
+ },
72
+ "& .progress.bg:after": {
73
+ width: "0",
74
+ height: "0",
75
+ border: "none",
76
+ },
77
+ "& .progress.top": {
78
+ position: "relative",
79
+ top: "-40px",
80
+ },
81
+ "& .progress.top:after": {
82
+ top: "-16%",
83
+ },
84
+ "& .empty": {
85
+ display: "block",
86
+ textAlign: "center",
87
+ marginLeft: "-100px",
88
+ marginRight: "-100px",
89
+ },
90
+ "& .empty::after": {
91
+ content: '""',
92
+ width: "12px",
93
+ height: "12px",
94
+ border: "2px solid #E0E0E0",
95
+ margin: "-2px",
96
+ display: "flex",
97
+ backgroundColor: "white",
98
+ borderRadius: "50%",
99
+ position: "relative",
100
+ left: "47%",
101
+ top: "-85%",
102
+ },
103
+ "& .empty.bg:after": {
104
+ width: "0",
105
+ height: "0",
106
+ border: "none",
107
+ },
108
+ "& .remain:after": {
109
+ content: '""',
110
+ display: "flex",
111
+ width: "100%",
112
+ height: "4px",
113
+ borderRadius: "4px",
114
+ backgroundColor: "#E0E0E0",
115
+ },
116
+ "& .gift.bw": {
117
+ filter: "grayscale(100%)",
118
+ },
119
+ "& .gift.start": {
120
+ transform: "scale(80%)",
121
+ top: "-20px",
122
+ },
123
+ "& .gift": {
124
+ textAlign: "center",
125
+ marginLeft: "-100px",
126
+ marginRight: "-100px",
127
+ position: "relative",
128
+ display: "list-item",
129
+ listStyleType: "none",
130
+ top: "-18px",
131
+ filter: goal <= progress ? "" : "grayscale(100%)",
132
+ zIndex: "1",
133
+ },
134
+ },
135
+ };
136
+ jss.setup(preset());
137
+ const sheet = jss.createStyleSheet(style);
138
+ const styleString = sheet.toString();
139
+ return (h("div", { class: sheet.classes.ProgressBar },
140
+ h("style", { type: "text/css" }, styleString),
141
+ h("div", { class: repetitions > 1 ? "progress-bar repeatable-steps" : "progress-bar" }, items)));
142
+ function clamp(x, min, max) {
143
+ return Math.min(Math.max(x, min), max);
144
+ }
145
+ function addLinear() {
146
+ const ratio = progress / goal;
147
+ columns =
148
+ clamp(ratio, 0, 1) + "fr 0fr " + clamp(1 - ratio, 0, 1) + "fr 0fr 0fr";
149
+ items.push(h("div", { class: "filled" }));
150
+ items.push(h("div", { class: clamp(progress, 0, goal) == goal ? "progress top bg" : "progress top" }, clamp(progress, 0, goal) == goal
151
+ ? ""
152
+ : progressBarUnit + clamp(progress, 0, goal)));
153
+ items.push(h("div", { class: "remain" }));
154
+ items.push(h("div", { class: "progress bg" }, goal));
155
+ items.push(h("div", { class: "gift" }, gift1));
156
+ }
157
+ function addSteps() {
158
+ let ratio = 1 / goal;
159
+ for (let i = 1; i < goal; i++) {
160
+ columns += ratio + "fr 0fr ";
161
+ if (i > progress) {
162
+ items.push(h("div", { class: "remain" }));
163
+ items.push(h("div", { class: "empty" }, i));
164
+ }
165
+ else {
166
+ items.push(h("div", { class: "filled" }));
167
+ items.push(h("div", { class: "progress" }, i));
168
+ }
169
+ }
170
+ columns += ratio + "fr 0fr ";
171
+ // reward success
172
+ if (goal <= progress) {
173
+ columns += "0fr ";
174
+ items.push(h("div", { class: "filled" }));
175
+ items.push(h("div", { class: "progress bg" }, goal));
176
+ items.push(h("div", { class: "gift" }, gift1));
177
+ }
178
+ // reward fail
179
+ else {
180
+ columns += "0fr ";
181
+ items.push(h("div", { class: "remain" }));
182
+ items.push(h("div", { class: "empty bg" }, goal));
183
+ items.push(h("div", { class: "gift" }, gift1));
184
+ }
185
+ }
186
+ function addLinearRepeatable() {
187
+ let repetitions = Math.floor(progress / goal);
188
+ let ratio = ((progress % goal) / goal) * 0.5;
189
+ // 0 repetition
190
+ if (repetitions == 0) {
191
+ columns = ratio + "fr 0fr " + (0.5 - ratio) + "fr 0fr 0fr 0.5fr 0fr 0fr";
192
+ items.push(h("div", { class: "filled" }));
193
+ items.push(h("div", { class: progress == goal ? "progress top bg" : "progress top" }, progressBarUnit + progress));
194
+ items.push(h("div", { class: "remain" }));
195
+ items.push(h("div", { class: "progress bg" }, progressBarUnit + goal));
196
+ items.push(h("div", { class: "gift" }, gift1));
197
+ items.push(h("div", { class: "remain" }));
198
+ items.push(h("div", { class: "progress bg" }, progressBarUnit + goal * 2));
199
+ items.push(h("div", { class: "gift bw" }, gift2));
200
+ }
201
+ // single repetition
202
+ else if (repetitions == 1) {
203
+ columns =
204
+ "0.5fr 0fr 0fr " + ratio + "fr 0fr " + (0.5 - ratio) + "fr 0fr 0fr";
205
+ items.push(h("div", { class: "filled" }));
206
+ items.push(h("div", { class: "progress bg" }, progressBarUnit + goal));
207
+ items.push(h("div", { class: "gift" }, gift1));
208
+ items.push(h("div", { class: "filled" }));
209
+ items.push(h("div", { class: progress == goal ? "progress top bg" : "progress top" }, progress == goal ? "" : progressBarUnit + progress));
210
+ items.push(h("div", { class: "remain" }));
211
+ items.push(h("div", { class: "progress bg" }, progressBarUnit + goal * 2));
212
+ items.push(h("div", { class: "gift bw" }, gift2));
213
+ }
214
+ // multiple repetitions
215
+ else {
216
+ columns =
217
+ "0fr 0fr 0.5fr 0fr 0fr " +
218
+ ratio +
219
+ "fr 0fr " +
220
+ (0.5 - ratio) +
221
+ "fr 0fr 0fr";
222
+ items.push(h("div", { class: "progress bg" }, progressBarUnit + goal * (repetitions - 1)));
223
+ items.push(h("div", { class: "gift start" }, gift1));
224
+ items.push(h("div", { class: "filled" }));
225
+ items.push(h("div", { class: "progress bg" }, progressBarUnit + goal * repetitions));
226
+ items.push(h("div", { class: "gift" }, gift2));
227
+ items.push(h("div", { class: "filled" }));
228
+ items.push(h("div", { class: progress == goal * repetitions ? "progress top bg" : "progress top" }, progress == goal * repetitions ? "" : progressBarUnit + progress));
229
+ items.push(h("div", { class: "remain" }));
230
+ items.push(h("div", { class: "progress bg" }, progressBarUnit + goal * (repetitions + 1)));
231
+ items.push(h("div", { class: "gift bw" }, gift3));
232
+ }
233
+ }
234
+ function addStepsRepeatable() {
235
+ let repetitions = Math.floor(progress / goal);
236
+ // no or single repetition
237
+ if (repetitions < 2) {
238
+ let ratio = 1 / goal;
239
+ for (let i = 1; i < goal * 2 + 1; i++) {
240
+ columns += ratio + "fr 0fr ";
241
+ if (i > progress) {
242
+ if (i == goal) {
243
+ columns += "0fr ";
244
+ items.push(h("div", { class: "remain" }));
245
+ items.push(h("div", { class: "empty bg" }, goal));
246
+ items.push(h("div", { class: "gift bw" }, gift1));
247
+ }
248
+ else if (i == goal * 2) {
249
+ columns += "0fr 0fr";
250
+ items.push(h("div", { class: "remain" }));
251
+ items.push(h("div", { class: "empty bg" }, goal * 2));
252
+ items.push(h("div", { class: "gift bw" }, gift2));
253
+ }
254
+ else {
255
+ items.push(h("div", { class: "remain" }));
256
+ items.push(h("div", { class: "empty" }, progressBarUnit + i));
257
+ }
258
+ }
259
+ else if (i == goal) {
260
+ columns += "0fr ";
261
+ items.push(h("div", { class: "filled" }));
262
+ items.push(h("div", { class: "progress bg" }, i));
263
+ items.push(h("div", { class: "gift" }, gift3));
264
+ }
265
+ else {
266
+ items.push(h("div", { class: "filled" }));
267
+ items.push(h("div", { class: "progress" }, i));
268
+ }
269
+ }
270
+ }
271
+ // case repetition many
272
+ else {
273
+ let position = (progress % goal) + goal;
274
+ let ratio = 1 / goal;
275
+ columns += "0fr 0fr ";
276
+ items.push(h("div", { class: "progress bg" }, goal * (repetitions - 1)));
277
+ items.push(h("div", { class: "gift start" }, gift1));
278
+ for (let i = 1; i < goal * 2 + 1; i++) {
279
+ columns += ratio + "fr 0fr ";
280
+ if (i <= goal) {
281
+ if (i == goal) {
282
+ columns += "0fr ";
283
+ items.push(h("div", { class: "filled" }));
284
+ items.push(h("div", { class: "progress bg" }, i + goal * (repetitions - 1)));
285
+ items.push(h("div", { class: "gift" }, gift2));
286
+ }
287
+ else {
288
+ items.push(h("div", { class: "filled" }));
289
+ items.push(h("div", { class: "progress" }, i + goal * (repetitions - 1)));
290
+ }
291
+ }
292
+ else if (i > position) {
293
+ if (i == goal * 2) {
294
+ columns += "0fr 0fr";
295
+ items.push(h("div", { class: "remain" }));
296
+ items.push(h("div", { class: "empty bg" }, i + goal * (repetitions - 1)));
297
+ items.push(h("div", { class: "gift bw" }, gift3));
298
+ }
299
+ else {
300
+ items.push(h("div", { class: "remain" }));
301
+ items.push(h("div", { class: "empty" }, i + goal * (repetitions - 1)));
302
+ }
303
+ }
304
+ else {
305
+ items.push(h("div", { class: "filled" }));
306
+ items.push(h("div", { class: "progress" }, i + goal * (repetitions - 1)));
307
+ }
308
+ }
309
+ }
310
+ }
311
+ }
@@ -0,0 +1,53 @@
1
+ import { h } from "@stencil/core";
2
+ import { MatrixStory } from "../Matrix";
3
+ import { ProgressBarView } from "./progress-bar-view";
4
+ import scenario from "./progress-bar.feature";
5
+ export default {
6
+ title: "Components/Task Card Progress Bar",
7
+ parameters: {
8
+ scenario,
9
+ },
10
+ };
11
+ export const Default = () => {
12
+ return h(ProgressBarView, null);
13
+ };
14
+ export const ProgressBar = () => {
15
+ const props = {
16
+ progress: 0,
17
+ goal: 500,
18
+ progressBarUnit: "$",
19
+ };
20
+ return (h("div", null,
21
+ h(MatrixStory, { matrix: { progress: [-100, 0, 100, 500, 1000] }, props: props, Component: ProgressBarView })));
22
+ };
23
+ export const ProgressBarSteps = () => {
24
+ const props = {
25
+ progress: 0,
26
+ steps: true,
27
+ goal: 5,
28
+ progressBarUnit: "$",
29
+ };
30
+ return (h("div", null,
31
+ h(MatrixStory, { matrix: { progress: [-1, 0, 1, 5, 7] }, props: props, Component: ProgressBarView })));
32
+ };
33
+ export const ProgressBarRepeatable = () => {
34
+ const props = {
35
+ progress: 0,
36
+ goal: 500,
37
+ progressBarUnit: "$",
38
+ repeatable: true,
39
+ };
40
+ return (h("div", null,
41
+ h(MatrixStory, { matrix: { progress: [100, 500, 650, 1200] }, props: props, Component: ProgressBarView })));
42
+ };
43
+ export const ProgressBarStepsRepeatable = () => {
44
+ const props = {
45
+ progress: 0,
46
+ steps: true,
47
+ goal: 5,
48
+ progressBarUnit: "$",
49
+ repeatable: true,
50
+ };
51
+ return (h("div", null,
52
+ h(MatrixStory, { matrix: { progress: [1, 5, 7, 12] }, props: props, Component: ProgressBarView })));
53
+ };