@saasquatch/mint-components 2.5.1-1 → 2.5.1-2
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/cjs/sqm-big-stat_47.cjs.entry.js +4 -0
- package/dist/cjs/sqm-pagination_3.cjs.entry.js +21 -12
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +44 -1
- package/dist/collection/components/sqm-pagination/sqm-pagination-view.js +8 -4
- package/dist/collection/components/sqm-referral-codes/ReferralCodes.stories.js +43 -0
- package/dist/collection/components/sqm-referral-codes/sqm-referral-codes-view.js +13 -1
- package/dist/collection/components/sqm-referral-codes/sqm-referral-codes.js +1 -12
- package/dist/collection/components/sqm-widget-verification/sqm-widget-verification.js +6 -2
- package/dist/esm/sqm-big-stat_47.entry.js +4 -0
- package/dist/esm/sqm-pagination_3.entry.js +21 -12
- package/dist/esm/sqm-stencilbook.entry.js +44 -1
- package/dist/esm-es5/sqm-big-stat_47.entry.js +1 -1
- package/dist/esm-es5/sqm-pagination_3.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-1d0e6fd8.entry.js +13 -0
- package/dist/mint-components/{p-aad907a4.system.entry.js → p-1d66ac7a.system.entry.js} +1 -1
- package/dist/mint-components/{p-1fa0187d.entry.js → p-70a1e190.entry.js} +1 -1
- package/dist/mint-components/p-b55e06b8.system.entry.js +1 -0
- package/dist/mint-components/p-bfb00685.system.js +1 -1
- package/dist/mint-components/{p-f8a006f8.entry.js → p-c21c2e8c.entry.js} +2 -2
- package/dist/mint-components/{p-81e7d1b8.system.entry.js → p-e716fbad.system.entry.js} +1 -1
- package/dist/types/components/sqm-referral-codes/ReferralCodes.stories.d.ts +7 -0
- package/dist/types/components/sqm-referral-codes/sqm-referral-codes-view.d.ts +0 -1
- package/dist/types/components/sqm-widget-verification/useWidgetVerification.d.ts +4 -2
- package/docs/docs.docx +0 -0
- package/package.json +1 -1
- package/dist/mint-components/p-4d3846cc.entry.js +0 -13
- package/dist/mint-components/p-6b8236b3.system.entry.js +0 -1
|
@@ -8697,6 +8697,9 @@ const WidgetVerification = class {
|
|
|
8697
8697
|
if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.tagName) === "SL-DIALOG") {
|
|
8698
8698
|
e.preventDefault();
|
|
8699
8699
|
}
|
|
8700
|
+
}, "onSl-initial-focus": (e) => {
|
|
8701
|
+
var _a;
|
|
8702
|
+
(_a = props.onInitialFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
8700
8703
|
} }, index.h("h2", { class: sheet$3.classes.DialogTitle }, dialogLabel), renderStepContent())));
|
|
8701
8704
|
}
|
|
8702
8705
|
};
|
|
@@ -8722,6 +8725,7 @@ function useDemoWidgetVerificationInternal(props) {
|
|
|
8722
8725
|
showPartnerModal: false,
|
|
8723
8726
|
onVerification,
|
|
8724
8727
|
onPartnerModalComplete: () => { },
|
|
8728
|
+
onInitialFocus: (e) => e.preventDefault(),
|
|
8725
8729
|
loading: false,
|
|
8726
8730
|
}, formatted || {}, { arrayMerge: (_, a) => a });
|
|
8727
8731
|
}
|
|
@@ -21,6 +21,9 @@ const style = {
|
|
|
21
21
|
gap: "var(--sl-spacing-small)",
|
|
22
22
|
width: "100%",
|
|
23
23
|
},
|
|
24
|
+
SkeletonContainer: {
|
|
25
|
+
width: "100px",
|
|
26
|
+
},
|
|
24
27
|
TextContainer: {
|
|
25
28
|
display: "flex",
|
|
26
29
|
gap: "var(--sl-spacing-xx-small)",
|
|
@@ -36,12 +39,13 @@ function PaginationView(props) {
|
|
|
36
39
|
return index.h(index.Fragment, null);
|
|
37
40
|
return (index.h("span", { class: sheet.classes.Container, part: "sqm-base" },
|
|
38
41
|
index.h("style", { type: "text/css" }, styleString),
|
|
39
|
-
!loading
|
|
42
|
+
!loading ? (index.h(index.Fragment, null,
|
|
40
43
|
index.h("sl-button", { exportparts: `base: ${buttonType}button-base`, onClick: onPrev, part: "sqm-pagination-button", circle: true, disabled: currentPage === 1 },
|
|
41
44
|
index.h("sl-icon", { name: "chevron-left", label: "Previous Page" })),
|
|
42
|
-
index.h("div", { class: sheet.classes.TextContainer }, text.paginationText)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
index.h("div", { class: sheet.classes.TextContainer }, text.paginationText),
|
|
46
|
+
index.h("sl-button", { exportparts: `base: ${buttonType}button-base`, onClick: onNext, part: "sqm-pagination-button", circle: true, disabled: currentPage === totalPages },
|
|
47
|
+
index.h("sl-icon", { name: "chevron-right", label: "Previous Page" })))) : (index.h("div", { class: sheet.classes.SkeletonContainer },
|
|
48
|
+
index.h("sl-skeleton", { width: "100px", height: "16px" })))));
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
function usePagination(props) {
|
|
@@ -316,6 +320,16 @@ function ReferralCodesView(props) {
|
|
|
316
320
|
justifyContent: "center",
|
|
317
321
|
flexDirection: "column",
|
|
318
322
|
},
|
|
323
|
+
SkeletonContainer: {
|
|
324
|
+
display: "flex",
|
|
325
|
+
flexDirection: "column",
|
|
326
|
+
gap: "var(--sl-spacing-small)",
|
|
327
|
+
width: "50%",
|
|
328
|
+
},
|
|
329
|
+
SkeletonOne: {
|
|
330
|
+
height: "16px",
|
|
331
|
+
width: "50%",
|
|
332
|
+
},
|
|
319
333
|
TitleText: {
|
|
320
334
|
fontSize: "var(--sl-font-size-large)",
|
|
321
335
|
margin: "0",
|
|
@@ -336,7 +350,9 @@ function ReferralCodesView(props) {
|
|
|
336
350
|
return slots.empty;
|
|
337
351
|
}
|
|
338
352
|
if (states.loading) {
|
|
339
|
-
return
|
|
353
|
+
return (index.h("div", { class: sheet.classes.SkeletonContainer },
|
|
354
|
+
index.h("sl-skeleton", { class: sheet.classes.SkeletonOne }),
|
|
355
|
+
index.h("sl-skeleton", { class: sheet.classes.SkeletonOne })));
|
|
340
356
|
}
|
|
341
357
|
return (index.h("div", { class: sheet.classes.Wrapper },
|
|
342
358
|
index.h("div", { class: sheet.classes.ShareCodeContainer }, slots.shareCodes),
|
|
@@ -384,7 +400,6 @@ const ReferralCodes = class {
|
|
|
384
400
|
shareCodes: index.h("slot", { name: "shareCodes" }),
|
|
385
401
|
pagination: index.h("slot", { name: "pagination" }),
|
|
386
402
|
empty: (index.h(EmptySlot, { headerText: this.emptyStateHeaderText, descriptionText: this.emptyStateDescriptionText, imageUrl: this.emptyStateImageUrl })),
|
|
387
|
-
loading: index.h(LoadingSlot, null),
|
|
388
403
|
};
|
|
389
404
|
const viewProps = {
|
|
390
405
|
slots,
|
|
@@ -398,12 +413,6 @@ const ReferralCodes = class {
|
|
|
398
413
|
function EmptySlot({ headerText, descriptionText, imageUrl, }) {
|
|
399
414
|
return (index.h("slot", { name: "empty" }, index.h("sqm-empty", { emptyStateHeader: headerText, emptyStateText: descriptionText, emptyStateImage: imageUrl })));
|
|
400
415
|
}
|
|
401
|
-
function LoadingSlot() {
|
|
402
|
-
return (index.h("slot", { name: "loading" }, index.h(LoadingRow, null), index.h(LoadingRow, null), index.h(LoadingRow, null), index.h(LoadingRow, null)));
|
|
403
|
-
}
|
|
404
|
-
function LoadingRow() {
|
|
405
|
-
return index.h("sqm-skeleton", null);
|
|
406
|
-
}
|
|
407
416
|
function useDemoReferralCodes(props) {
|
|
408
417
|
return cjs.cjs({
|
|
409
418
|
titleText: props.titleText,
|
|
@@ -10678,6 +10678,47 @@ const Loading$8 = () => {
|
|
|
10678
10678
|
shareCodes("shareCodes"),
|
|
10679
10679
|
shareButtons("shareButtons")));
|
|
10680
10680
|
};
|
|
10681
|
+
const loadingPagination = (slot) => {
|
|
10682
|
+
return (index.h("sqm-pagination", { slot: slot, demoData: { states: { loading: true } } }));
|
|
10683
|
+
};
|
|
10684
|
+
const WithLoadingPagination = () => {
|
|
10685
|
+
return (index.h("sqm-referral-codes", null,
|
|
10686
|
+
loadingPagination("pagination"),
|
|
10687
|
+
shareCodes("shareCodes"),
|
|
10688
|
+
shareButtons("shareButtons")));
|
|
10689
|
+
};
|
|
10690
|
+
const TOTAL_PAGES = 5;
|
|
10691
|
+
const LOADING_MS = 800;
|
|
10692
|
+
const FunctionalPaginationDemo = () => {
|
|
10693
|
+
const [currentPage, setCurrentPage] = domContextHooks_module.useState(1);
|
|
10694
|
+
const [loading, setLoading] = domContextHooks_module.useState(false);
|
|
10695
|
+
const goTo = (nextPage) => {
|
|
10696
|
+
setLoading(true);
|
|
10697
|
+
setTimeout(() => {
|
|
10698
|
+
setCurrentPage(nextPage);
|
|
10699
|
+
setLoading(false);
|
|
10700
|
+
}, LOADING_MS);
|
|
10701
|
+
};
|
|
10702
|
+
const paginationSlot = (index.h("sqm-pagination", { slot: "pagination", demoData: {
|
|
10703
|
+
states: {
|
|
10704
|
+
currentPage,
|
|
10705
|
+
totalPages: TOTAL_PAGES,
|
|
10706
|
+
loading,
|
|
10707
|
+
},
|
|
10708
|
+
callbacks: {
|
|
10709
|
+
onNext: () => goTo(currentPage + 1),
|
|
10710
|
+
onPrev: () => goTo(currentPage - 1),
|
|
10711
|
+
},
|
|
10712
|
+
text: {
|
|
10713
|
+
paginationText: `${currentPage} of ${TOTAL_PAGES}`,
|
|
10714
|
+
},
|
|
10715
|
+
} }));
|
|
10716
|
+
return (index.h("sqm-referral-codes", { demoData: { states: { noCodes: false, loading } } },
|
|
10717
|
+
paginationSlot,
|
|
10718
|
+
shareCodes("shareCodes"),
|
|
10719
|
+
shareButtons("shareButtons")));
|
|
10720
|
+
};
|
|
10721
|
+
const FunctionalPagination = createHookStory(FunctionalPaginationDemo);
|
|
10681
10722
|
|
|
10682
10723
|
const ReferralCodes$1 = /*#__PURE__*/Object.freeze({
|
|
10683
10724
|
__proto__: null,
|
|
@@ -10687,7 +10728,9 @@ const ReferralCodes$1 = /*#__PURE__*/Object.freeze({
|
|
|
10687
10728
|
WithPreviouslyCopiedCodeAndCustomColor: WithPreviouslyCopiedCodeAndCustomColor,
|
|
10688
10729
|
Empty: Empty$2,
|
|
10689
10730
|
EmptyWithCustomTextAndImage: EmptyWithCustomTextAndImage,
|
|
10690
|
-
Loading: Loading$8
|
|
10731
|
+
Loading: Loading$8,
|
|
10732
|
+
WithLoadingPagination: WithLoadingPagination,
|
|
10733
|
+
FunctionalPagination: FunctionalPagination
|
|
10691
10734
|
});
|
|
10692
10735
|
|
|
10693
10736
|
const scenario$s = "@owner:sam\n@author:sam\n\nFeature: Referral Iframe\n\n\tUsed to provide an external form for submitting referral leads using the current user's referral code\n\n\tBackground: A user is logged in\n\t\tGiven there is a logged in user\n\n\t@motivating\n\tScenario: Referral code is passed to the iframe as a query parameter\n\t\tGiven the \"iframe-src\" is \"https://example.com\"\n\t\tAnd the user has navigated to \"/refer\"\n\t\tAnd the user's referral code is \"BOBBYREFER\"\n\t\tWhen the iframe content is loaded\n\t\tThen the iframe url will be \"https://example.com?rsCode=BOBBYREFER\"\n\n\t@ui\n\tScenario Outline: The height and width of the iFrame can be controlled via props\n\t\tGiven the \"iframe-src\" is \"https://example.com\"\n\t\tAnd the iframe content is 1000x1000\n\t\tAnd the \"iframe-height\" is set to <heightValue>\n\t\tAnd the \"iframe-width\" is set to <widthValue>\n\t\tThen the content of the iframe will be displayed with scrollbars\n\t\tAnd the dimension of the iFrame displayed will be 500x500\n\t\tWhen the \"iframe-height\" is set to <heightValue>\n\t\tAnd the \"iframe-width\" is set to <widthValue>\n\t\tThen the full content of the iframe will be displayed on the page\n\t\tAnd the dimension of the iFrame displayed will be 1000x1000\n\t\tExamples:\n\t\t| heightValue | widthValue |\n\t\t| 500px | 500px |\n\t\t| 50% | 50% |\n\n\t@minutia\n\tScenario Outline: The iFrame will fail fast if a iFrame source isn't provided\n\t\tGiven \"iframe-src\" <mayBeAnAttribute>\n\t\tAnd it <mayHaveValue>\n\t\tWhen a user views the referral iFrame component\n\t\tThen an alert with an error message is displayed in place of the iFrame\n\t\tAnd it has a details section\n\t\tWhen \"More details\" is clicked\n\t\tThen the following information will be displayed\n\t\t| component being used |\n\t\t| missing attribute(s) |\n\n\tExamples:\n\t\t| mayBeAnAttribute | mayHaveValue |\n\t\t| is not an attribute | N/A |\n\t\t| is an attribute | \"\" |\n\t\t| is an attribute | |";
|
|
@@ -8,6 +8,9 @@ const style = {
|
|
|
8
8
|
gap: "var(--sl-spacing-small)",
|
|
9
9
|
width: "100%",
|
|
10
10
|
},
|
|
11
|
+
SkeletonContainer: {
|
|
12
|
+
width: "100px",
|
|
13
|
+
},
|
|
11
14
|
TextContainer: {
|
|
12
15
|
display: "flex",
|
|
13
16
|
gap: "var(--sl-spacing-xx-small)",
|
|
@@ -23,10 +26,11 @@ export function PaginationView(props) {
|
|
|
23
26
|
return h(Fragment, null);
|
|
24
27
|
return (h("span", { class: sheet.classes.Container, part: "sqm-base" },
|
|
25
28
|
h("style", { type: "text/css" }, styleString),
|
|
26
|
-
!loading
|
|
29
|
+
!loading ? (h(Fragment, null,
|
|
27
30
|
h("sl-button", { exportparts: `base: ${buttonType}button-base`, onClick: onPrev, part: "sqm-pagination-button", circle: true, disabled: currentPage === 1 },
|
|
28
31
|
h("sl-icon", { name: "chevron-left", label: "Previous Page" })),
|
|
29
|
-
h("div", { class: sheet.classes.TextContainer }, text.paginationText)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
h("div", { class: sheet.classes.TextContainer }, text.paginationText),
|
|
33
|
+
h("sl-button", { exportparts: `base: ${buttonType}button-base`, onClick: onNext, part: "sqm-pagination-button", circle: true, disabled: currentPage === totalPages },
|
|
34
|
+
h("sl-icon", { name: "chevron-right", label: "Previous Page" })))) : (h("div", { class: sheet.classes.SkeletonContainer },
|
|
35
|
+
h("sl-skeleton", { width: "100px", height: "16px" })))));
|
|
32
36
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
+
import { useState } from "@saasquatch/stencil-hooks";
|
|
2
3
|
import scenario from "./ReferralCodes.feature";
|
|
4
|
+
import { createHookStory } from "../sqm-stencilbook/HookStoryAddon";
|
|
3
5
|
export default {
|
|
4
6
|
title: "Components/Referral Codes",
|
|
5
7
|
parameters: {
|
|
@@ -69,3 +71,44 @@ export const Loading = () => {
|
|
|
69
71
|
shareCodes("shareCodes"),
|
|
70
72
|
shareButtons("shareButtons")));
|
|
71
73
|
};
|
|
74
|
+
const loadingPagination = (slot) => {
|
|
75
|
+
return (h("sqm-pagination", { slot: slot, demoData: { states: { loading: true } } }));
|
|
76
|
+
};
|
|
77
|
+
export const WithLoadingPagination = () => {
|
|
78
|
+
return (h("sqm-referral-codes", null,
|
|
79
|
+
loadingPagination("pagination"),
|
|
80
|
+
shareCodes("shareCodes"),
|
|
81
|
+
shareButtons("shareButtons")));
|
|
82
|
+
};
|
|
83
|
+
const TOTAL_PAGES = 5;
|
|
84
|
+
const LOADING_MS = 800;
|
|
85
|
+
const FunctionalPaginationDemo = () => {
|
|
86
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
87
|
+
const [loading, setLoading] = useState(false);
|
|
88
|
+
const goTo = (nextPage) => {
|
|
89
|
+
setLoading(true);
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
setCurrentPage(nextPage);
|
|
92
|
+
setLoading(false);
|
|
93
|
+
}, LOADING_MS);
|
|
94
|
+
};
|
|
95
|
+
const paginationSlot = (h("sqm-pagination", { slot: "pagination", demoData: {
|
|
96
|
+
states: {
|
|
97
|
+
currentPage,
|
|
98
|
+
totalPages: TOTAL_PAGES,
|
|
99
|
+
loading,
|
|
100
|
+
},
|
|
101
|
+
callbacks: {
|
|
102
|
+
onNext: () => goTo(currentPage + 1),
|
|
103
|
+
onPrev: () => goTo(currentPage - 1),
|
|
104
|
+
},
|
|
105
|
+
text: {
|
|
106
|
+
paginationText: `${currentPage} of ${TOTAL_PAGES}`,
|
|
107
|
+
},
|
|
108
|
+
} }));
|
|
109
|
+
return (h("sqm-referral-codes", { demoData: { states: { noCodes: false, loading } } },
|
|
110
|
+
paginationSlot,
|
|
111
|
+
shareCodes("shareCodes"),
|
|
112
|
+
shareButtons("shareButtons")));
|
|
113
|
+
};
|
|
114
|
+
export const FunctionalPagination = createHookStory(FunctionalPaginationDemo);
|
|
@@ -32,6 +32,16 @@ export function ReferralCodesView(props) {
|
|
|
32
32
|
justifyContent: "center",
|
|
33
33
|
flexDirection: "column",
|
|
34
34
|
},
|
|
35
|
+
SkeletonContainer: {
|
|
36
|
+
display: "flex",
|
|
37
|
+
flexDirection: "column",
|
|
38
|
+
gap: "var(--sl-spacing-small)",
|
|
39
|
+
width: "50%",
|
|
40
|
+
},
|
|
41
|
+
SkeletonOne: {
|
|
42
|
+
height: "16px",
|
|
43
|
+
width: "50%",
|
|
44
|
+
},
|
|
35
45
|
TitleText: {
|
|
36
46
|
fontSize: "var(--sl-font-size-large)",
|
|
37
47
|
margin: "0",
|
|
@@ -52,7 +62,9 @@ export function ReferralCodesView(props) {
|
|
|
52
62
|
return slots.empty;
|
|
53
63
|
}
|
|
54
64
|
if (states.loading) {
|
|
55
|
-
return
|
|
65
|
+
return (h("div", { class: sheet.classes.SkeletonContainer },
|
|
66
|
+
h("sl-skeleton", { class: sheet.classes.SkeletonOne }),
|
|
67
|
+
h("sl-skeleton", { class: sheet.classes.SkeletonOne })));
|
|
56
68
|
}
|
|
57
69
|
return (h("div", { class: sheet.classes.Wrapper },
|
|
58
70
|
h("div", { class: sheet.classes.ShareCodeContainer }, slots.shareCodes),
|
|
@@ -44,7 +44,6 @@ export class ReferralCodes {
|
|
|
44
44
|
shareCodes: h("slot", { name: "shareCodes" }),
|
|
45
45
|
pagination: h("slot", { name: "pagination" }),
|
|
46
46
|
empty: (h(EmptySlot, { headerText: this.emptyStateHeaderText, descriptionText: this.emptyStateDescriptionText, imageUrl: this.emptyStateImageUrl })),
|
|
47
|
-
loading: h(LoadingSlot, null),
|
|
48
47
|
};
|
|
49
48
|
const viewProps = {
|
|
50
49
|
slots,
|
|
@@ -195,7 +194,7 @@ export class ReferralCodes {
|
|
|
195
194
|
"mutable": false,
|
|
196
195
|
"complexType": {
|
|
197
196
|
"original": "DemoData<ReferralCodesViewProps>",
|
|
198
|
-
"resolved": "{ states?: { noCodes: boolean; loading: boolean; }; slots?: { shareButtons: VNode; shareCodes: VNode; pagination: VNode; empty: VNode;
|
|
197
|
+
"resolved": "{ states?: { noCodes: boolean; loading: boolean; }; slots?: { shareButtons: VNode; shareCodes: VNode; pagination: VNode; empty: VNode; }; titleText?: string; textColor?: string; }",
|
|
199
198
|
"references": {
|
|
200
199
|
"DemoData": {
|
|
201
200
|
"location": "import",
|
|
@@ -226,16 +225,6 @@ function EmptySlot({ headerText, descriptionText, imageUrl, }) {
|
|
|
226
225
|
return (h("slot", { name: "empty" },
|
|
227
226
|
h("sqm-empty", { emptyStateHeader: headerText, emptyStateText: descriptionText, emptyStateImage: imageUrl })));
|
|
228
227
|
}
|
|
229
|
-
function LoadingSlot() {
|
|
230
|
-
return (h("slot", { name: "loading" },
|
|
231
|
-
h(LoadingRow, null),
|
|
232
|
-
h(LoadingRow, null),
|
|
233
|
-
h(LoadingRow, null),
|
|
234
|
-
h(LoadingRow, null)));
|
|
235
|
-
}
|
|
236
|
-
function LoadingRow() {
|
|
237
|
-
return h("sqm-skeleton", null);
|
|
238
|
-
}
|
|
239
228
|
function useDemoReferralCodes(props) {
|
|
240
229
|
return deepmerge({
|
|
241
230
|
titleText: props.titleText,
|
|
@@ -2,12 +2,12 @@ import { isDemo, useParentState, useSetParent, } from "@saasquatch/component-boi
|
|
|
2
2
|
import { withHooks } from "@saasquatch/stencil-hooks";
|
|
3
3
|
import { Component, h, Prop } from "@stencil/core";
|
|
4
4
|
import deepmerge from "deepmerge";
|
|
5
|
+
import { createStyleSheet } from "../../styling/JSS";
|
|
5
6
|
import { parseStates } from "../../utils/parseStates";
|
|
6
7
|
import { getProps } from "../../utils/utils";
|
|
7
8
|
import { extractProps } from "../tax-and-cash/sqm-tax-and-cash/extractProps";
|
|
8
9
|
import { SHOW_CODE_NAMESPACE, VERIFICATION_EMAIL_NAMESPACE, VERIFICATION_PARENT_NAMESPACE, } from "./keys";
|
|
9
|
-
import { useWidgetVerification } from "./useWidgetVerification";
|
|
10
|
-
import { createStyleSheet } from "../../styling/JSS";
|
|
10
|
+
import { useWidgetVerification, } from "./useWidgetVerification";
|
|
11
11
|
const style = {
|
|
12
12
|
Dialog: {
|
|
13
13
|
"&::part(panel)": {
|
|
@@ -264,6 +264,9 @@ export class WidgetVerification {
|
|
|
264
264
|
if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.tagName) === "SL-DIALOG") {
|
|
265
265
|
e.preventDefault();
|
|
266
266
|
}
|
|
267
|
+
}, "onSl-initial-focus": (e) => {
|
|
268
|
+
var _a;
|
|
269
|
+
(_a = props.onInitialFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
267
270
|
} },
|
|
268
271
|
h("h2", { class: sheet.classes.DialogTitle }, dialogLabel),
|
|
269
272
|
renderStepContent())));
|
|
@@ -1045,6 +1048,7 @@ function useDemoWidgetVerificationInternal(props) {
|
|
|
1045
1048
|
showPartnerModal: false,
|
|
1046
1049
|
onVerification,
|
|
1047
1050
|
onPartnerModalComplete: () => { },
|
|
1051
|
+
onInitialFocus: (e) => e.preventDefault(),
|
|
1048
1052
|
loading: false,
|
|
1049
1053
|
}, formatted || {}, { arrayMerge: (_, a) => a });
|
|
1050
1054
|
}
|
|
@@ -8693,6 +8693,9 @@ const WidgetVerification = class {
|
|
|
8693
8693
|
if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.tagName) === "SL-DIALOG") {
|
|
8694
8694
|
e.preventDefault();
|
|
8695
8695
|
}
|
|
8696
|
+
}, "onSl-initial-focus": (e) => {
|
|
8697
|
+
var _a;
|
|
8698
|
+
(_a = props.onInitialFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
8696
8699
|
} }, h$1("h2", { class: sheet$3.classes.DialogTitle }, dialogLabel), renderStepContent())));
|
|
8697
8700
|
}
|
|
8698
8701
|
};
|
|
@@ -8718,6 +8721,7 @@ function useDemoWidgetVerificationInternal(props) {
|
|
|
8718
8721
|
showPartnerModal: false,
|
|
8719
8722
|
onVerification,
|
|
8720
8723
|
onPartnerModalComplete: () => { },
|
|
8724
|
+
onInitialFocus: (e) => e.preventDefault(),
|
|
8721
8725
|
loading: false,
|
|
8722
8726
|
}, formatted || {}, { arrayMerge: (_, a) => a });
|
|
8723
8727
|
}
|
|
@@ -17,6 +17,9 @@ const style = {
|
|
|
17
17
|
gap: "var(--sl-spacing-small)",
|
|
18
18
|
width: "100%",
|
|
19
19
|
},
|
|
20
|
+
SkeletonContainer: {
|
|
21
|
+
width: "100px",
|
|
22
|
+
},
|
|
20
23
|
TextContainer: {
|
|
21
24
|
display: "flex",
|
|
22
25
|
gap: "var(--sl-spacing-xx-small)",
|
|
@@ -32,12 +35,13 @@ function PaginationView(props) {
|
|
|
32
35
|
return h(Fragment, null);
|
|
33
36
|
return (h("span", { class: sheet.classes.Container, part: "sqm-base" },
|
|
34
37
|
h("style", { type: "text/css" }, styleString),
|
|
35
|
-
!loading
|
|
38
|
+
!loading ? (h(Fragment, null,
|
|
36
39
|
h("sl-button", { exportparts: `base: ${buttonType}button-base`, onClick: onPrev, part: "sqm-pagination-button", circle: true, disabled: currentPage === 1 },
|
|
37
40
|
h("sl-icon", { name: "chevron-left", label: "Previous Page" })),
|
|
38
|
-
h("div", { class: sheet.classes.TextContainer }, text.paginationText)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
h("div", { class: sheet.classes.TextContainer }, text.paginationText),
|
|
42
|
+
h("sl-button", { exportparts: `base: ${buttonType}button-base`, onClick: onNext, part: "sqm-pagination-button", circle: true, disabled: currentPage === totalPages },
|
|
43
|
+
h("sl-icon", { name: "chevron-right", label: "Previous Page" })))) : (h("div", { class: sheet.classes.SkeletonContainer },
|
|
44
|
+
h("sl-skeleton", { width: "100px", height: "16px" })))));
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
function usePagination(props) {
|
|
@@ -312,6 +316,16 @@ function ReferralCodesView(props) {
|
|
|
312
316
|
justifyContent: "center",
|
|
313
317
|
flexDirection: "column",
|
|
314
318
|
},
|
|
319
|
+
SkeletonContainer: {
|
|
320
|
+
display: "flex",
|
|
321
|
+
flexDirection: "column",
|
|
322
|
+
gap: "var(--sl-spacing-small)",
|
|
323
|
+
width: "50%",
|
|
324
|
+
},
|
|
325
|
+
SkeletonOne: {
|
|
326
|
+
height: "16px",
|
|
327
|
+
width: "50%",
|
|
328
|
+
},
|
|
315
329
|
TitleText: {
|
|
316
330
|
fontSize: "var(--sl-font-size-large)",
|
|
317
331
|
margin: "0",
|
|
@@ -332,7 +346,9 @@ function ReferralCodesView(props) {
|
|
|
332
346
|
return slots.empty;
|
|
333
347
|
}
|
|
334
348
|
if (states.loading) {
|
|
335
|
-
return
|
|
349
|
+
return (h("div", { class: sheet.classes.SkeletonContainer },
|
|
350
|
+
h("sl-skeleton", { class: sheet.classes.SkeletonOne }),
|
|
351
|
+
h("sl-skeleton", { class: sheet.classes.SkeletonOne })));
|
|
336
352
|
}
|
|
337
353
|
return (h("div", { class: sheet.classes.Wrapper },
|
|
338
354
|
h("div", { class: sheet.classes.ShareCodeContainer }, slots.shareCodes),
|
|
@@ -380,7 +396,6 @@ const ReferralCodes = class {
|
|
|
380
396
|
shareCodes: h("slot", { name: "shareCodes" }),
|
|
381
397
|
pagination: h("slot", { name: "pagination" }),
|
|
382
398
|
empty: (h(EmptySlot, { headerText: this.emptyStateHeaderText, descriptionText: this.emptyStateDescriptionText, imageUrl: this.emptyStateImageUrl })),
|
|
383
|
-
loading: h(LoadingSlot, null),
|
|
384
399
|
};
|
|
385
400
|
const viewProps = {
|
|
386
401
|
slots,
|
|
@@ -394,12 +409,6 @@ const ReferralCodes = class {
|
|
|
394
409
|
function EmptySlot({ headerText, descriptionText, imageUrl, }) {
|
|
395
410
|
return (h("slot", { name: "empty" }, h("sqm-empty", { emptyStateHeader: headerText, emptyStateText: descriptionText, emptyStateImage: imageUrl })));
|
|
396
411
|
}
|
|
397
|
-
function LoadingSlot() {
|
|
398
|
-
return (h("slot", { name: "loading" }, h(LoadingRow, null), h(LoadingRow, null), h(LoadingRow, null), h(LoadingRow, null)));
|
|
399
|
-
}
|
|
400
|
-
function LoadingRow() {
|
|
401
|
-
return h("sqm-skeleton", null);
|
|
402
|
-
}
|
|
403
412
|
function useDemoReferralCodes(props) {
|
|
404
413
|
return cjs({
|
|
405
414
|
titleText: props.titleText,
|
|
@@ -10674,6 +10674,47 @@ const Loading$8 = () => {
|
|
|
10674
10674
|
shareCodes("shareCodes"),
|
|
10675
10675
|
shareButtons("shareButtons")));
|
|
10676
10676
|
};
|
|
10677
|
+
const loadingPagination = (slot) => {
|
|
10678
|
+
return (h("sqm-pagination", { slot: slot, demoData: { states: { loading: true } } }));
|
|
10679
|
+
};
|
|
10680
|
+
const WithLoadingPagination = () => {
|
|
10681
|
+
return (h("sqm-referral-codes", null,
|
|
10682
|
+
loadingPagination("pagination"),
|
|
10683
|
+
shareCodes("shareCodes"),
|
|
10684
|
+
shareButtons("shareButtons")));
|
|
10685
|
+
};
|
|
10686
|
+
const TOTAL_PAGES = 5;
|
|
10687
|
+
const LOADING_MS = 800;
|
|
10688
|
+
const FunctionalPaginationDemo = () => {
|
|
10689
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
10690
|
+
const [loading, setLoading] = useState(false);
|
|
10691
|
+
const goTo = (nextPage) => {
|
|
10692
|
+
setLoading(true);
|
|
10693
|
+
setTimeout(() => {
|
|
10694
|
+
setCurrentPage(nextPage);
|
|
10695
|
+
setLoading(false);
|
|
10696
|
+
}, LOADING_MS);
|
|
10697
|
+
};
|
|
10698
|
+
const paginationSlot = (h("sqm-pagination", { slot: "pagination", demoData: {
|
|
10699
|
+
states: {
|
|
10700
|
+
currentPage,
|
|
10701
|
+
totalPages: TOTAL_PAGES,
|
|
10702
|
+
loading,
|
|
10703
|
+
},
|
|
10704
|
+
callbacks: {
|
|
10705
|
+
onNext: () => goTo(currentPage + 1),
|
|
10706
|
+
onPrev: () => goTo(currentPage - 1),
|
|
10707
|
+
},
|
|
10708
|
+
text: {
|
|
10709
|
+
paginationText: `${currentPage} of ${TOTAL_PAGES}`,
|
|
10710
|
+
},
|
|
10711
|
+
} }));
|
|
10712
|
+
return (h("sqm-referral-codes", { demoData: { states: { noCodes: false, loading } } },
|
|
10713
|
+
paginationSlot,
|
|
10714
|
+
shareCodes("shareCodes"),
|
|
10715
|
+
shareButtons("shareButtons")));
|
|
10716
|
+
};
|
|
10717
|
+
const FunctionalPagination = createHookStory(FunctionalPaginationDemo);
|
|
10677
10718
|
|
|
10678
10719
|
const ReferralCodes$1 = /*#__PURE__*/Object.freeze({
|
|
10679
10720
|
__proto__: null,
|
|
@@ -10683,7 +10724,9 @@ const ReferralCodes$1 = /*#__PURE__*/Object.freeze({
|
|
|
10683
10724
|
WithPreviouslyCopiedCodeAndCustomColor: WithPreviouslyCopiedCodeAndCustomColor,
|
|
10684
10725
|
Empty: Empty$2,
|
|
10685
10726
|
EmptyWithCustomTextAndImage: EmptyWithCustomTextAndImage,
|
|
10686
|
-
Loading: Loading$8
|
|
10727
|
+
Loading: Loading$8,
|
|
10728
|
+
WithLoadingPagination: WithLoadingPagination,
|
|
10729
|
+
FunctionalPagination: FunctionalPagination
|
|
10687
10730
|
});
|
|
10688
10731
|
|
|
10689
10732
|
const scenario$s = "@owner:sam\n@author:sam\n\nFeature: Referral Iframe\n\n\tUsed to provide an external form for submitting referral leads using the current user's referral code\n\n\tBackground: A user is logged in\n\t\tGiven there is a logged in user\n\n\t@motivating\n\tScenario: Referral code is passed to the iframe as a query parameter\n\t\tGiven the \"iframe-src\" is \"https://example.com\"\n\t\tAnd the user has navigated to \"/refer\"\n\t\tAnd the user's referral code is \"BOBBYREFER\"\n\t\tWhen the iframe content is loaded\n\t\tThen the iframe url will be \"https://example.com?rsCode=BOBBYREFER\"\n\n\t@ui\n\tScenario Outline: The height and width of the iFrame can be controlled via props\n\t\tGiven the \"iframe-src\" is \"https://example.com\"\n\t\tAnd the iframe content is 1000x1000\n\t\tAnd the \"iframe-height\" is set to <heightValue>\n\t\tAnd the \"iframe-width\" is set to <widthValue>\n\t\tThen the content of the iframe will be displayed with scrollbars\n\t\tAnd the dimension of the iFrame displayed will be 500x500\n\t\tWhen the \"iframe-height\" is set to <heightValue>\n\t\tAnd the \"iframe-width\" is set to <widthValue>\n\t\tThen the full content of the iframe will be displayed on the page\n\t\tAnd the dimension of the iFrame displayed will be 1000x1000\n\t\tExamples:\n\t\t| heightValue | widthValue |\n\t\t| 500px | 500px |\n\t\t| 50% | 50% |\n\n\t@minutia\n\tScenario Outline: The iFrame will fail fast if a iFrame source isn't provided\n\t\tGiven \"iframe-src\" <mayBeAnAttribute>\n\t\tAnd it <mayHaveValue>\n\t\tWhen a user views the referral iFrame component\n\t\tThen an alert with an error message is displayed in place of the iFrame\n\t\tAnd it has a details section\n\t\tWhen \"More details\" is clicked\n\t\tThen the following information will be displayed\n\t\t| component being used |\n\t\t| missing attribute(s) |\n\n\tExamples:\n\t\t| mayBeAnAttribute | mayHaveValue |\n\t\t| is not an attribute | N/A |\n\t\t| is an attribute | \"\" |\n\t\t| is an attribute | |";
|