@saasquatch/mint-components 1.14.7-1 → 1.14.7-11
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/{ShadowViewAddon-3c344355.js → ShadowViewAddon-f86d2739.js} +3 -1
- package/dist/cjs/sqm-big-stat_43.cjs.entry.js +9 -2
- package/dist/cjs/sqm-lead-checkbox-field-view-47675f42.js +79 -0
- package/dist/cjs/sqm-lead-checkbox-field-view-bb9b7c6c.js +79 -0
- package/dist/cjs/sqm-lead-checkbox-field.cjs.entry.js +8 -98
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +56 -3
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field-view.js +3 -1
- package/dist/collection/components/sqm-lead-form/LeadCheckboxField.stories.js +4 -63
- package/dist/collection/components/sqm-lead-form/sqm-lead-checkbox-field-view.js +12 -15
- package/dist/collection/components/sqm-lead-form/sqm-lead-checkbox-field.js +5 -9
- package/dist/collection/components/sqm-lead-form/useCheckboxField.js +1 -14
- package/dist/collection/components/sqm-lead-form/useLeadForm.js +8 -1
- package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +2 -0
- package/dist/esm/{ShadowViewAddon-64194d20.js → ShadowViewAddon-fea70c8c.js} +3 -1
- package/dist/esm/sqm-big-stat_43.entry.js +9 -2
- package/dist/esm/sqm-lead-checkbox-field-view-05823885.js +77 -0
- package/dist/esm/sqm-lead-checkbox-field-view-269af7ba.js +77 -0
- package/dist/esm/sqm-lead-checkbox-field.entry.js +12 -102
- package/dist/esm/sqm-stencilbook.entry.js +56 -3
- package/dist/esm-es5/ShadowViewAddon-fea70c8c.js +1 -0
- package/dist/esm-es5/sqm-big-stat_43.entry.js +1 -1
- package/dist/esm-es5/sqm-lead-checkbox-field-view-05823885.js +1 -0
- package/dist/esm-es5/sqm-lead-checkbox-field-view-269af7ba.js +1 -0
- package/dist/esm-es5/sqm-lead-checkbox-field.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-f60d1ae9.entry.js → p-06180ec8.entry.js} +2 -2
- package/dist/mint-components/p-14f86024.system.js +1 -0
- package/dist/mint-components/p-20fb7d34.system.js +1 -0
- package/dist/mint-components/{p-851eaf57.entry.js → p-268363a8.entry.js} +2 -2
- package/dist/mint-components/p-37996351.system.js +1 -1
- package/dist/mint-components/p-5640d160.system.entry.js +1 -0
- package/dist/mint-components/p-9def94f6.js +394 -0
- package/dist/mint-components/p-c1a65f6e.system.entry.js +1 -0
- package/dist/mint-components/p-ccddb56d.entry.js +1 -0
- package/dist/mint-components/p-d450ee65.system.entry.js +1 -0
- package/dist/mint-components/p-dddeeff2.js +1 -0
- package/dist/mint-components/sqm-lead-checkbox-field-view-17027655.system.js +1 -0
- package/dist/mint-components/sqm-lead-checkbox-field-view-269af7ba.js +77 -0
- package/dist/types/components/sqm-lead-form/LeadCheckboxField.stories.d.ts +0 -27
- package/dist/types/components/sqm-lead-form/sqm-lead-checkbox-field-view.d.ts +0 -5
- package/dist/types/components/sqm-lead-form/useCheckboxField.d.ts +1 -6
- package/docs/docs.docx +0 -0
- package/package.json +1 -1
- package/dist/esm-es5/ShadowViewAddon-64194d20.js +0 -1
- package/dist/mint-components/p-0d94d81a.system.js +0 -1
- package/dist/mint-components/p-10a8ecae.system.entry.js +0 -1
- package/dist/mint-components/p-30a11ec0.js +0 -394
- package/dist/mint-components/p-48ad59a8.system.entry.js +0 -1
- package/dist/mint-components/p-550346bd.entry.js +0 -1
- package/dist/mint-components/p-eaf1a8a6.system.entry.js +0 -1
|
@@ -113,7 +113,14 @@ export function useLeadForm(props) {
|
|
|
113
113
|
validationErrors: {},
|
|
114
114
|
});
|
|
115
115
|
(_b = (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.getFormControls()) === null || _b === void 0 ? void 0 : _b.forEach((c) => {
|
|
116
|
-
|
|
116
|
+
var _a;
|
|
117
|
+
if (((_a = c.input) === null || _a === void 0 ? void 0 : _a.type) === "checkbox") {
|
|
118
|
+
c.checked = false;
|
|
119
|
+
c.value = false;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
c.value = "";
|
|
123
|
+
}
|
|
117
124
|
});
|
|
118
125
|
setSuccess(false);
|
|
119
126
|
}
|
|
@@ -100,6 +100,7 @@ import * as QRCode from "../sqm-qr-code/QRCode.stories";
|
|
|
100
100
|
import * as LeadForm from "../sqm-lead-form/LeadForm.stories";
|
|
101
101
|
import * as LeadInputField from "../sqm-lead-form/LeadInputField.stories";
|
|
102
102
|
import * as LeadFormDropdownField from "../sqm-lead-form/LeadFormDropdownField.stories";
|
|
103
|
+
import * as LeadCheckboxField from "../sqm-lead-form/LeadCheckboxField.stories";
|
|
103
104
|
import * as Themes from "./Themes";
|
|
104
105
|
import { CucumberAddon } from "./CucumberAddon";
|
|
105
106
|
import { HookStoryAddon } from "./HookStoryAddon";
|
|
@@ -205,6 +206,7 @@ const stories = [
|
|
|
205
206
|
LeadForm,
|
|
206
207
|
LeadInputField,
|
|
207
208
|
LeadFormDropdownField,
|
|
209
|
+
LeadCheckboxField,
|
|
208
210
|
];
|
|
209
211
|
/**
|
|
210
212
|
* For internal documentation
|
|
@@ -1711,7 +1711,9 @@ function CheckboxFieldView(props) {
|
|
|
1711
1711
|
h("sl-checkbox", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.checkboxName}`, checked: states.checked, "onSl-change": (e) => {
|
|
1712
1712
|
e.target.value = e.target.checked;
|
|
1713
1713
|
callbacks.setChecked(e.target.value);
|
|
1714
|
-
} }, (!content.checkboxOptional
|
|
1714
|
+
} }, (!content.checkboxOptional
|
|
1715
|
+
? { required: false }
|
|
1716
|
+
: { required: true }), { disabled: ((_b = states.registrationFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.registrationFormState) === null || _c === void 0 ? void 0 : _c.disabled) }), intl.formatMessage({
|
|
1715
1717
|
id: content.checkboxName + "-message",
|
|
1716
1718
|
defaultMessage: content.checkboxLabel,
|
|
1717
1719
|
}, {
|
|
@@ -20,7 +20,7 @@ import { P as PortalLoginView } from './sqm-portal-login-view-7e49609a.js';
|
|
|
20
20
|
import { u as usePortalLogin } from './usePortalLogin-ef647a50.js';
|
|
21
21
|
import { A as AsYouType } from './AsYouType-46f67d0d.js';
|
|
22
22
|
import { i as isEmpty } from './utilities-5b0ca040.js';
|
|
23
|
-
import { b as useDemoBigStat, W as useBigStat, B as BigStatView, U as autoColorScaleCss, J as CardFeedView, i as CheckboxFieldView, K as CouponCodeView, D as DropdownFieldView, E as EditProfileView, H as HeroView, I as InputFieldView, Q as LeadDropdownFieldView, O as LeadFormView, X as withShadowView, L as LeaderboardView, N as NameFieldsView, C as ChangeMarktingView, d as PortalChangePasswordView, h as PortalFooterView, P as PortalFrameView, e as PortalRegisterView, R as ReferralIframeView, Y as demoRewardExchange, j as RewardExchangeView, a as useShareButton, S as ShareButtonView, u as useShareLink, c as StatContainerView, T as TaskCardView } from './ShadowViewAddon-
|
|
23
|
+
import { b as useDemoBigStat, W as useBigStat, B as BigStatView, U as autoColorScaleCss, J as CardFeedView, i as CheckboxFieldView, K as CouponCodeView, D as DropdownFieldView, E as EditProfileView, H as HeroView, I as InputFieldView, Q as LeadDropdownFieldView, O as LeadFormView, X as withShadowView, L as LeaderboardView, N as NameFieldsView, C as ChangeMarktingView, d as PortalChangePasswordView, h as PortalFooterView, P as PortalFrameView, e as PortalRegisterView, R as ReferralIframeView, Y as demoRewardExchange, j as RewardExchangeView, a as useShareButton, S as ShareButtonView, u as useShareLink, c as StatContainerView, T as TaskCardView } from './ShadowViewAddon-fea70c8c.js';
|
|
24
24
|
import './sqm-portal-container-view-1683ae32.js';
|
|
25
25
|
import { u as usePayoutStatus } from './usePayoutStatus-fed17fc9.js';
|
|
26
26
|
|
|
@@ -1473,7 +1473,14 @@ function useLeadForm(props) {
|
|
|
1473
1473
|
validationErrors: {},
|
|
1474
1474
|
});
|
|
1475
1475
|
(_b = (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.getFormControls()) === null || _b === void 0 ? void 0 : _b.forEach((c) => {
|
|
1476
|
-
|
|
1476
|
+
var _a;
|
|
1477
|
+
if (((_a = c.input) === null || _a === void 0 ? void 0 : _a.type) === "checkbox") {
|
|
1478
|
+
c.checked = false;
|
|
1479
|
+
c.value = false;
|
|
1480
|
+
}
|
|
1481
|
+
else {
|
|
1482
|
+
c.value = "";
|
|
1483
|
+
}
|
|
1477
1484
|
});
|
|
1478
1485
|
setSuccess(false);
|
|
1479
1486
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { h } from './index-91e7729f.js';
|
|
2
|
+
import { i as intl } from './global-be1f9992.js';
|
|
3
|
+
import { j as jss, a as create } from './JSS-67b5cff8.js';
|
|
4
|
+
|
|
5
|
+
const style = {
|
|
6
|
+
ErrorStyle: {
|
|
7
|
+
"&::part(control)": {
|
|
8
|
+
borderColor: "var(--sl-color-danger-500)",
|
|
9
|
+
outline: "var(--sl-color-danger-500)",
|
|
10
|
+
},
|
|
11
|
+
"&:host": {
|
|
12
|
+
"--focus-ring": "0 0 0 var(--sl-focus-ring-width) red !important",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
ErrorMessageStyle: {
|
|
16
|
+
margin: 0,
|
|
17
|
+
marginTop: "5px",
|
|
18
|
+
color: "var(--sl-color-danger-500)",
|
|
19
|
+
fontSize: "var(--sl-input-help-text-font-size-medium)",
|
|
20
|
+
fontFamily: "var(--sl-font-sans)",
|
|
21
|
+
fontWeight: "var(--sl-font-weight-normal)",
|
|
22
|
+
},
|
|
23
|
+
FieldContainer: {
|
|
24
|
+
"margin-bottom": "var(--sl-spacing-large)",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
const vanillaStyle = `
|
|
28
|
+
:host {
|
|
29
|
+
margin: 0 auto;
|
|
30
|
+
width: 100%;
|
|
31
|
+
display: block;
|
|
32
|
+
}
|
|
33
|
+
sl-checkbox::part(label){
|
|
34
|
+
font-size: var(--sl-input-label-font-size-small);
|
|
35
|
+
font-weight: var(--sl-font-weight-normal);
|
|
36
|
+
line-height: 20px;
|
|
37
|
+
}
|
|
38
|
+
sl-checkbox::part(base){
|
|
39
|
+
align-items: start;
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
jss.setup(create());
|
|
43
|
+
const sheet = jss.createStyleSheet(style);
|
|
44
|
+
const styleString = sheet.toString();
|
|
45
|
+
function LeadCheckboxFieldView(props) {
|
|
46
|
+
var _a, _b, _c, _d, _e;
|
|
47
|
+
const { states, content } = props;
|
|
48
|
+
const validationErrors = (_a = states === null || states === void 0 ? void 0 : states.leadFormState) === null || _a === void 0 ? void 0 : _a.validationErrors;
|
|
49
|
+
const getRequiredFieldErrorMessage = ({ checkboxLabel, }) => intl.formatMessage({
|
|
50
|
+
id: `requiredFieldErrorMessage-${checkboxLabel}`,
|
|
51
|
+
defaultMessage: content.errorMessage,
|
|
52
|
+
}, {
|
|
53
|
+
checkboxLabel,
|
|
54
|
+
});
|
|
55
|
+
return (h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
|
|
56
|
+
h("style", { type: "text/css" },
|
|
57
|
+
vanillaStyle,
|
|
58
|
+
styleString),
|
|
59
|
+
h("sl-checkbox", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.checkboxName}`, "onSl-change": (e) => {
|
|
60
|
+
e.target.value = e.target.checked;
|
|
61
|
+
} }, (!content.checkboxOptional
|
|
62
|
+
? { required: false }
|
|
63
|
+
: { required: true }), { disabled: ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.disabled) }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e[content.checkboxName]) ? {
|
|
64
|
+
class: sheet.classes.ErrorStyle,
|
|
65
|
+
}
|
|
66
|
+
: [])), intl.formatMessage({
|
|
67
|
+
id: content.checkboxName + "-message",
|
|
68
|
+
defaultMessage: content.checkboxLabel,
|
|
69
|
+
}, {
|
|
70
|
+
labelLink: (h("a", { href: content.checkboxLabelLink, target: "_blank" }, content.checkboxLabelLinkText || content.checkboxLabelLink)),
|
|
71
|
+
})),
|
|
72
|
+
(validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.checkboxName]) && (h("p", { class: sheet.classes.ErrorMessageStyle }, getRequiredFieldErrorMessage({
|
|
73
|
+
checkboxLabel: content.checkboxLabel,
|
|
74
|
+
})))));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { LeadCheckboxFieldView as L };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { h } from './index-9c0e3f6c.js';
|
|
2
|
+
import { i as intl } from './global-74148d5d.js';
|
|
3
|
+
import { j as jss, a as create } from './jss-preset-default.esm-c36417f8.js';
|
|
4
|
+
|
|
5
|
+
const style = {
|
|
6
|
+
ErrorStyle: {
|
|
7
|
+
"&::part(control)": {
|
|
8
|
+
borderColor: "var(--sl-color-danger-500)",
|
|
9
|
+
outline: "var(--sl-color-danger-500)",
|
|
10
|
+
},
|
|
11
|
+
"&:host": {
|
|
12
|
+
"--focus-ring": "0 0 0 var(--sl-focus-ring-width) red !important",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
ErrorMessageStyle: {
|
|
16
|
+
margin: 0,
|
|
17
|
+
marginTop: "5px",
|
|
18
|
+
color: "var(--sl-color-danger-500)",
|
|
19
|
+
fontSize: "var(--sl-input-help-text-font-size-medium)",
|
|
20
|
+
fontFamily: "var(--sl-font-sans)",
|
|
21
|
+
fontWeight: "var(--sl-font-weight-normal)",
|
|
22
|
+
},
|
|
23
|
+
FieldContainer: {
|
|
24
|
+
"margin-bottom": "var(--sl-spacing-large)",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
const vanillaStyle = `
|
|
28
|
+
:host {
|
|
29
|
+
margin: 0 auto;
|
|
30
|
+
width: 100%;
|
|
31
|
+
display: block;
|
|
32
|
+
}
|
|
33
|
+
sl-checkbox::part(label){
|
|
34
|
+
font-size: var(--sl-input-label-font-size-small);
|
|
35
|
+
font-weight: var(--sl-font-weight-normal);
|
|
36
|
+
line-height: 20px;
|
|
37
|
+
}
|
|
38
|
+
sl-checkbox::part(base){
|
|
39
|
+
align-items: start;
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
jss.setup(create());
|
|
43
|
+
const sheet = jss.createStyleSheet(style);
|
|
44
|
+
const styleString = sheet.toString();
|
|
45
|
+
function LeadCheckboxFieldView(props) {
|
|
46
|
+
var _a, _b, _c, _d, _e;
|
|
47
|
+
const { states, content } = props;
|
|
48
|
+
const validationErrors = (_a = states === null || states === void 0 ? void 0 : states.leadFormState) === null || _a === void 0 ? void 0 : _a.validationErrors;
|
|
49
|
+
const getRequiredFieldErrorMessage = ({ checkboxLabel, }) => intl.formatMessage({
|
|
50
|
+
id: `requiredFieldErrorMessage-${checkboxLabel}`,
|
|
51
|
+
defaultMessage: content.errorMessage,
|
|
52
|
+
}, {
|
|
53
|
+
checkboxLabel,
|
|
54
|
+
});
|
|
55
|
+
return (h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
|
|
56
|
+
h("style", { type: "text/css" },
|
|
57
|
+
vanillaStyle,
|
|
58
|
+
styleString),
|
|
59
|
+
h("sl-checkbox", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.checkboxName}`, "onSl-change": (e) => {
|
|
60
|
+
e.target.value = e.target.checked;
|
|
61
|
+
} }, (!content.checkboxOptional
|
|
62
|
+
? { required: false }
|
|
63
|
+
: { required: true }), { disabled: ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.disabled) }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e[content.checkboxName]) ? {
|
|
64
|
+
class: sheet.classes.ErrorStyle,
|
|
65
|
+
}
|
|
66
|
+
: [])), intl.formatMessage({
|
|
67
|
+
id: content.checkboxName + "-message",
|
|
68
|
+
defaultMessage: content.checkboxLabel,
|
|
69
|
+
}, {
|
|
70
|
+
labelLink: (h("a", { href: content.checkboxLabelLink, target: "_blank" }, content.checkboxLabelLinkText || content.checkboxLabelLink)),
|
|
71
|
+
})),
|
|
72
|
+
(validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.checkboxName]) && (h("p", { class: sheet.classes.ErrorMessageStyle }, getRequiredFieldErrorMessage({
|
|
73
|
+
checkboxLabel: content.checkboxLabel,
|
|
74
|
+
})))));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { LeadCheckboxFieldView as L };
|
|
@@ -1,104 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as d,
|
|
3
|
-
import
|
|
1
|
+
import { r as registerInstance, h as h$1 } from './index-91e7729f.js';
|
|
2
|
+
import { i as d, n as h } from './stencil-hooks.module-4bc38af4.js';
|
|
3
|
+
import './global-be1f9992.js';
|
|
4
4
|
import { i as isDemo } from './index.module-89a79f66.js';
|
|
5
5
|
import { c as cjs } from './cjs-bdfb4486.js';
|
|
6
6
|
import { a as getMissingProps, g as getProps } from './utils-334c1e34.js';
|
|
7
|
-
import
|
|
7
|
+
import './JSS-67b5cff8.js';
|
|
8
8
|
import { L as LEAD_FORM_STATE_CONTEXT, R as RequiredPropsError } from './useLeadFormState-9016d812.js';
|
|
9
|
+
import { L as LeadCheckboxFieldView } from './sqm-lead-checkbox-field-view-05823885.js';
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
ErrorStyle: {
|
|
12
|
-
"&::part(control)": {
|
|
13
|
-
background: "var(--sl-color-danger-10)",
|
|
14
|
-
borderColor: "var(--sl-color-danger-500)",
|
|
15
|
-
outline: "var(--sl-color-danger-500)",
|
|
16
|
-
},
|
|
17
|
-
"&:host": {
|
|
18
|
-
"--focus-ring": "0 0 0 var(--sl-focus-ring-width) red !important",
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
ErrorMessageStyle: {
|
|
22
|
-
margin: 0,
|
|
23
|
-
marginTop: "5px",
|
|
24
|
-
color: "var(--sl-color-danger-500)",
|
|
25
|
-
fontSize: "var(--sl-input-help-text-font-size-medium)",
|
|
26
|
-
fontFamily: "var(--sl-font-sans)",
|
|
27
|
-
fontWeight: "var(--sl-font-weight-normal)",
|
|
28
|
-
},
|
|
29
|
-
FieldContainer: {
|
|
30
|
-
"margin-bottom": "var(--sl-spacing-large)",
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
const vanillaStyle = `
|
|
34
|
-
:host {
|
|
35
|
-
margin: 0 auto;
|
|
36
|
-
width: 100%;
|
|
37
|
-
display: block;
|
|
38
|
-
}
|
|
39
|
-
sl-checkbox::part(label){
|
|
40
|
-
font-size: var(--sl-input-label-font-size-small);
|
|
41
|
-
font-weight: var(--sl-font-weight-normal);
|
|
42
|
-
line-height: 20px;
|
|
43
|
-
}
|
|
44
|
-
sl-checkbox::part(base){
|
|
45
|
-
align-items: start;
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
jss.setup(create());
|
|
49
|
-
const sheet = jss.createStyleSheet(style);
|
|
50
|
-
const styleString = sheet.toString();
|
|
51
|
-
function LeadCheckboxFieldView(props) {
|
|
52
|
-
var _a, _b, _c, _d, _e, _f;
|
|
53
|
-
const { states, content, callbacks } = props;
|
|
54
|
-
const getRequiredFieldErrorMessage = ({ checkboxLabel, }) => intl.formatMessage({
|
|
55
|
-
id: `requiredFieldErrorMessage-${checkboxLabel}`,
|
|
56
|
-
defaultMessage: content.requiredFieldErrorMessage,
|
|
57
|
-
}, {
|
|
58
|
-
checkboxLabel,
|
|
59
|
-
});
|
|
60
|
-
return (h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
|
|
61
|
-
h("style", { type: "text/css" },
|
|
62
|
-
vanillaStyle,
|
|
63
|
-
styleString),
|
|
64
|
-
h("sl-checkbox", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.checkboxName}`, checked: states.checked, "onSl-change": (e) => {
|
|
65
|
-
e.target.value = e.target.checked;
|
|
66
|
-
callbacks.setChecked(e.target.value);
|
|
67
|
-
} }, (!content.checkboxOptional ? { required: false } : []), { disabled: ((_a = states.leadFormState) === null || _a === void 0 ? void 0 : _a.loading) || ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.disabled), validationError: ({ value }) => {
|
|
68
|
-
if (!value && !content.checkboxOptional) {
|
|
69
|
-
return getRequiredFieldErrorMessage({
|
|
70
|
-
checkboxLabel: content.checkboxLabel,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
} }, (((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d[content.checkboxName]) ? {
|
|
74
|
-
class: sheet.classes.ErrorStyle,
|
|
75
|
-
helpText: ((_f = (_e = states.leadFormState) === null || _e === void 0 ? void 0 : _e.validationErrors) === null || _f === void 0 ? void 0 : _f[content.checkboxName]) || content.requiredFieldErrorMessage,
|
|
76
|
-
}
|
|
77
|
-
: [])), intl.formatMessage({
|
|
78
|
-
id: content.checkboxName + "-message",
|
|
79
|
-
defaultMessage: content.checkboxLabel,
|
|
80
|
-
}, {
|
|
81
|
-
labelLink: (h("a", { href: content.checkboxLabelLink, target: "_blank" }, content.checkboxLabelLinkText || content.checkboxLabelLink)),
|
|
82
|
-
}))));
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function useLeadCheckboxField(props) {
|
|
86
|
-
var _a;
|
|
11
|
+
function useLeadCheckboxField() {
|
|
87
12
|
const leadFormState = d(LEAD_FORM_STATE_CONTEXT);
|
|
88
|
-
const [checked, setChecked] = useState(false);
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
var _a, _b;
|
|
91
|
-
if ((_a = leadFormState === null || leadFormState === void 0 ? void 0 : leadFormState.initialData) === null || _a === void 0 ? void 0 : _a[props.checkboxName]) {
|
|
92
|
-
setChecked(!!((_b = leadFormState === null || leadFormState === void 0 ? void 0 : leadFormState.initialData) === null || _b === void 0 ? void 0 : _b[props.checkboxName]));
|
|
93
|
-
}
|
|
94
|
-
}, [(_a = leadFormState === null || leadFormState === void 0 ? void 0 : leadFormState.initialData) === null || _a === void 0 ? void 0 : _a[props.checkboxName]]);
|
|
95
13
|
return {
|
|
96
14
|
states: {
|
|
97
15
|
leadFormState,
|
|
98
|
-
checked,
|
|
99
|
-
},
|
|
100
|
-
callbacks: {
|
|
101
|
-
setChecked,
|
|
102
16
|
},
|
|
103
17
|
};
|
|
104
18
|
}
|
|
@@ -130,7 +44,7 @@ const LeadCheckboxField = class {
|
|
|
130
44
|
* @uiName Optional
|
|
131
45
|
*/
|
|
132
46
|
this.checkboxOptional = false;
|
|
133
|
-
h
|
|
47
|
+
h(this);
|
|
134
48
|
}
|
|
135
49
|
disconnectedCallback() { }
|
|
136
50
|
render() {
|
|
@@ -141,25 +55,21 @@ const LeadCheckboxField = class {
|
|
|
141
55
|
},
|
|
142
56
|
]);
|
|
143
57
|
if (!isDemo() && missingProps) {
|
|
144
|
-
return (h(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this checkbox field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
|
|
58
|
+
return (h$1(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this checkbox field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
|
|
145
59
|
}
|
|
146
60
|
const content = {
|
|
147
61
|
...getProps(this),
|
|
148
62
|
};
|
|
149
|
-
const { states
|
|
63
|
+
const { states } = isDemo()
|
|
150
64
|
? useLeadCheckboxFieldDemo(this)
|
|
151
|
-
: useLeadCheckboxField(
|
|
152
|
-
return (h(LeadCheckboxFieldView, { states: states, content: content
|
|
65
|
+
: useLeadCheckboxField();
|
|
66
|
+
return (h$1(LeadCheckboxFieldView, { states: states, content: content }));
|
|
153
67
|
}
|
|
154
68
|
};
|
|
155
69
|
function useLeadCheckboxFieldDemo(props) {
|
|
156
70
|
return cjs({
|
|
157
71
|
states: {
|
|
158
|
-
|
|
159
|
-
checked: false,
|
|
160
|
-
},
|
|
161
|
-
callbacks: {
|
|
162
|
-
setChecked: () => { },
|
|
72
|
+
leadFormState: {},
|
|
163
73
|
},
|
|
164
74
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
165
75
|
}
|
|
@@ -16,6 +16,7 @@ import { A as AssetCardView } from './sqm-asset-card-view-fe5db3c0.js';
|
|
|
16
16
|
import { C as CloseButtonView } from './sqm-close-button-view-f9819751.js';
|
|
17
17
|
import './index-ffa26b43.js';
|
|
18
18
|
import { E as EmailRegistrationView } from './email-registration-view-a7818cf2.js';
|
|
19
|
+
import { L as LeadCheckboxFieldView } from './sqm-lead-checkbox-field-view-05823885.js';
|
|
19
20
|
import { L as LeaderboardRankView } from './sqm-leaderboard-rank-view-753c8d4a.js';
|
|
20
21
|
import { L as LogoutCurrentUserView } from './sqm-logout-current-user-view-8ef8180f.js';
|
|
21
22
|
import { N as NavigationSidebarView } from './sqm-navigation-sidebar-view-9d802b78.js';
|
|
@@ -31,7 +32,7 @@ import { P as PortalResetPasswordView } from './sqm-portal-reset-password-view-5
|
|
|
31
32
|
import { P as PortalVerifyEmailView } from './sqm-portal-verify-email-view-b12cb894.js';
|
|
32
33
|
import './ErrorView-48e2b969.js';
|
|
33
34
|
import { Q as QrCodeView } from './sqm-qr-code-view-f1d0763b.js';
|
|
34
|
-
import { S as ShareButtonView, L as LeaderboardView, B as BigStatView, P as PortalFrameView, E as EditProfileView, u as useShareLink, a as useShareButton, b as useDemoBigStat, c as StatContainerView, d as PortalChangePasswordView, e as PortalRegisterView, C as ChangeMarktingView, T as TaskCardView, f as ProgressBarView, g as PoweredByImg$1, h as PortalFooterView, H as HeroView, R as ReferralIframeView, N as NameFieldsView, i as CheckboxFieldView, D as DropdownFieldView, I as InputFieldView, j as RewardExchangeView, r as rewardExchangeCustomErrorMsg, k as rewardExchangeLongText, l as rewardExchangeSelected, m as chooseAmountFixed, n as chooseAmountFixedNoDescription, o as chooseAmountVariable, p as chooseAmountVariableNoDescription, q as chooseAmountVariableDisabled, s as chooseAmountVariableUnavailable, t as confirmFixed, v as confirmVariable, w as redemptionError, x as queryError, y as success, z as successVariable, A as loading, F as empty$1, G as rewardExchange, J as CardFeedView, K as CouponCodeView, M as ProgressBar$2, O as LeadFormView, Q as LeadDropdownFieldView, U as autoColorScaleCss, V as ShadowViewAddon } from './ShadowViewAddon-
|
|
35
|
+
import { S as ShareButtonView, L as LeaderboardView, B as BigStatView, P as PortalFrameView, E as EditProfileView, u as useShareLink, a as useShareButton, b as useDemoBigStat, c as StatContainerView, d as PortalChangePasswordView, e as PortalRegisterView, C as ChangeMarktingView, T as TaskCardView, f as ProgressBarView, g as PoweredByImg$1, h as PortalFooterView, H as HeroView, R as ReferralIframeView, N as NameFieldsView, i as CheckboxFieldView, D as DropdownFieldView, I as InputFieldView, j as RewardExchangeView, r as rewardExchangeCustomErrorMsg, k as rewardExchangeLongText, l as rewardExchangeSelected, m as chooseAmountFixed, n as chooseAmountFixedNoDescription, o as chooseAmountVariable, p as chooseAmountVariableNoDescription, q as chooseAmountVariableDisabled, s as chooseAmountVariableUnavailable, t as confirmFixed, v as confirmVariable, w as redemptionError, x as queryError, y as success, z as successVariable, A as loading, F as empty$1, G as rewardExchange, J as CardFeedView, K as CouponCodeView, M as ProgressBar$2, O as LeadFormView, Q as LeadDropdownFieldView, U as autoColorScaleCss, V as ShadowViewAddon } from './ShadowViewAddon-fea70c8c.js';
|
|
35
36
|
import { P as PortalContainerView, a as PortalSectionView } from './sqm-portal-container-view-1683ae32.js';
|
|
36
37
|
import { O as OtherRegionSlotView, I as InvoiceTableView, T as TaxForm } from './sqm-invoice-table-view-7f376a75.js';
|
|
37
38
|
import { L as LeadInputFieldView } from './sqm-lead-input-field-view-4ede5d7f.js';
|
|
@@ -16060,6 +16061,57 @@ const LeadFormDropdownField = /*#__PURE__*/Object.freeze({
|
|
|
16060
16061
|
WithInitialValue: WithInitialValue$1
|
|
16061
16062
|
});
|
|
16062
16063
|
|
|
16064
|
+
const LeadCheckboxField_stories = {
|
|
16065
|
+
title: "Components/Lead Checkbox Field",
|
|
16066
|
+
};
|
|
16067
|
+
const defaultProps$w = {
|
|
16068
|
+
states: {
|
|
16069
|
+
leadFormState: {
|
|
16070
|
+
validationErrors: {},
|
|
16071
|
+
},
|
|
16072
|
+
},
|
|
16073
|
+
content: {
|
|
16074
|
+
checkboxName: "terms",
|
|
16075
|
+
checkboxLabel: "By signing up you agree to the {labelLink}",
|
|
16076
|
+
checkboxLabelLink: "https://example.com",
|
|
16077
|
+
checkboxLabelLinkText: "Terms and Conditions",
|
|
16078
|
+
errorMessage: "{checkboxLabel} Must be checked",
|
|
16079
|
+
},
|
|
16080
|
+
};
|
|
16081
|
+
const Default$u = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps$w))));
|
|
16082
|
+
const CustomLabel$3 = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps$w, { content: {
|
|
16083
|
+
...defaultProps$w.content,
|
|
16084
|
+
checkboxLabel: "I Agree",
|
|
16085
|
+
} }))));
|
|
16086
|
+
const Error$d = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps$w, { states: {
|
|
16087
|
+
...defaultProps$w.states,
|
|
16088
|
+
leadFormState: {
|
|
16089
|
+
validationErrors: {
|
|
16090
|
+
terms: "{checkboxLabel} Must be checked",
|
|
16091
|
+
},
|
|
16092
|
+
},
|
|
16093
|
+
} }))));
|
|
16094
|
+
const CustomError$3 = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps$w, { states: {
|
|
16095
|
+
...defaultProps$w.states,
|
|
16096
|
+
leadFormState: {
|
|
16097
|
+
validationErrors: {
|
|
16098
|
+
terms: "{checkboxLabel} Must be checked",
|
|
16099
|
+
},
|
|
16100
|
+
},
|
|
16101
|
+
}, content: {
|
|
16102
|
+
...defaultProps$w.content,
|
|
16103
|
+
errorMessage: "This checkbox must be checked to continue",
|
|
16104
|
+
} }))));
|
|
16105
|
+
|
|
16106
|
+
const LeadCheckboxField = /*#__PURE__*/Object.freeze({
|
|
16107
|
+
__proto__: null,
|
|
16108
|
+
'default': LeadCheckboxField_stories,
|
|
16109
|
+
Default: Default$u,
|
|
16110
|
+
CustomLabel: CustomLabel$3,
|
|
16111
|
+
Error: Error$d,
|
|
16112
|
+
CustomError: CustomError$3
|
|
16113
|
+
});
|
|
16114
|
+
|
|
16063
16115
|
/**
|
|
16064
16116
|
*
|
|
16065
16117
|
* Themes
|
|
@@ -16072,7 +16124,7 @@ const LeadFormDropdownField = /*#__PURE__*/Object.freeze({
|
|
|
16072
16124
|
*
|
|
16073
16125
|
*/
|
|
16074
16126
|
//
|
|
16075
|
-
const Default$
|
|
16127
|
+
const Default$v = `
|
|
16076
16128
|
// No CSS
|
|
16077
16129
|
`;
|
|
16078
16130
|
const Orangey = `
|
|
@@ -16106,7 +16158,7 @@ const Klip = `
|
|
|
16106
16158
|
|
|
16107
16159
|
const Themes = /*#__PURE__*/Object.freeze({
|
|
16108
16160
|
__proto__: null,
|
|
16109
|
-
Default: Default$
|
|
16161
|
+
Default: Default$v,
|
|
16110
16162
|
Orangey: Orangey,
|
|
16111
16163
|
Netflix: Netflix,
|
|
16112
16164
|
SaaSquatchCorporate: SaaSquatchCorporate,
|
|
@@ -18800,6 +18852,7 @@ const stories = [
|
|
|
18800
18852
|
LeadForm,
|
|
18801
18853
|
LeadInputField,
|
|
18802
18854
|
LeadFormDropdownField,
|
|
18855
|
+
LeadCheckboxField,
|
|
18803
18856
|
];
|
|
18804
18857
|
const StencilStorybook = class {
|
|
18805
18858
|
constructor(hostRef) {
|