@saasquatch/mint-components 1.14.7-4 → 1.14.7-6

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 (28) hide show
  1. package/dist/cjs/sqm-lead-checkbox-field-view-00116edf.js +84 -0
  2. package/dist/cjs/sqm-lead-checkbox-field.cjs.entry.js +5 -82
  3. package/dist/cjs/sqm-stencilbook.cjs.entry.js +65 -2
  4. package/dist/collection/components/sqm-lead-form/LeadCheckboxField.stories.js +5 -55
  5. package/dist/collection/components/sqm-lead-form/sqm-lead-checkbox-field-view.js +0 -1
  6. package/dist/collection/components/sqm-lead-form/sqm-lead-checkbox-field.js +2 -2
  7. package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +2 -0
  8. package/dist/esm/sqm-lead-checkbox-field-view-f2d478ad.js +82 -0
  9. package/dist/esm/sqm-lead-checkbox-field.entry.js +9 -86
  10. package/dist/esm/sqm-stencilbook.entry.js +65 -2
  11. package/dist/esm-es5/sqm-lead-checkbox-field-view-f2d478ad.js +1 -0
  12. package/dist/esm-es5/sqm-lead-checkbox-field.entry.js +1 -1
  13. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  14. package/dist/mint-components/mint-components.esm.js +1 -1
  15. package/dist/mint-components/p-09f5f6d1.system.js +1 -0
  16. package/dist/mint-components/{p-f60d1ae9.entry.js → p-11de051f.entry.js} +2 -2
  17. package/dist/mint-components/p-1780910e.entry.js +1 -0
  18. package/dist/mint-components/p-37996351.system.js +1 -1
  19. package/dist/mint-components/p-6cb95e3c.js +1 -0
  20. package/dist/mint-components/p-87499562.system.entry.js +1 -0
  21. package/dist/mint-components/p-89926dbf.system.entry.js +1 -0
  22. package/dist/types/components/sqm-lead-form/LeadCheckboxField.stories.d.ts +0 -21
  23. package/docs/docs.docx +0 -0
  24. package/docs/raisins.json +1 -1
  25. package/package.json +1 -1
  26. package/dist/mint-components/p-13ce4802.system.entry.js +0 -1
  27. package/dist/mint-components/p-3bf2b681.entry.js +0 -1
  28. package/dist/mint-components/p-eaf1a8a6.system.entry.js +0 -1
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-a29c60ef.js');
4
+ const global = require('./global-e31dc4f5.js');
5
+ const JSS = require('./JSS-8503a151.js');
6
+
7
+ const style = {
8
+ ErrorStyle: {
9
+ "&::part(control)": {
10
+ borderColor: "var(--sl-color-danger-500)",
11
+ outline: "var(--sl-color-danger-500)",
12
+ },
13
+ "&:host": {
14
+ "--focus-ring": "0 0 0 var(--sl-focus-ring-width) red !important",
15
+ },
16
+ },
17
+ ErrorMessageStyle: {
18
+ margin: 0,
19
+ marginTop: "5px",
20
+ color: "var(--sl-color-danger-500)",
21
+ fontSize: "var(--sl-input-help-text-font-size-medium)",
22
+ fontFamily: "var(--sl-font-sans)",
23
+ fontWeight: "var(--sl-font-weight-normal)",
24
+ },
25
+ FieldContainer: {
26
+ "margin-bottom": "var(--sl-spacing-large)",
27
+ },
28
+ };
29
+ const vanillaStyle = `
30
+ :host {
31
+ margin: 0 auto;
32
+ width: 100%;
33
+ display: block;
34
+ }
35
+ sl-checkbox::part(label){
36
+ font-size: var(--sl-input-label-font-size-small);
37
+ font-weight: var(--sl-font-weight-normal);
38
+ line-height: 20px;
39
+ }
40
+ sl-checkbox::part(base){
41
+ align-items: start;
42
+ }
43
+ `;
44
+ JSS.jss.setup(JSS.create());
45
+ const sheet = JSS.jss.createStyleSheet(style);
46
+ const styleString = sheet.toString();
47
+ function LeadCheckboxFieldView(props) {
48
+ var _a, _b, _c, _d, _e;
49
+ const { states, content, callbacks } = props;
50
+ const validationErrors = (_a = states === null || states === void 0 ? void 0 : states.leadFormState) === null || _a === void 0 ? void 0 : _a.validationErrors;
51
+ const getRequiredFieldErrorMessage = ({ checkboxLabel, }) => global.intl.formatMessage({
52
+ id: `requiredFieldErrorMessage-${checkboxLabel}`,
53
+ defaultMessage: content.errorMessage,
54
+ }, {
55
+ checkboxLabel,
56
+ });
57
+ return (index.h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
58
+ index.h("style", { type: "text/css" },
59
+ vanillaStyle,
60
+ styleString),
61
+ index.h("sl-checkbox", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.checkboxName}`, checked: states.checked, "onSl-change": (e) => {
62
+ e.target.value = e.target.checked;
63
+ callbacks.setChecked(e.target.value);
64
+ } }, (!content.checkboxOptional ? { required: false } : []), { disabled: ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.disabled), validationError: ({ value }) => {
65
+ if (!value && !content.checkboxOptional) {
66
+ return getRequiredFieldErrorMessage({
67
+ checkboxLabel: content.checkboxLabel,
68
+ });
69
+ }
70
+ } }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e[content.checkboxName]) ? {
71
+ class: sheet.classes.ErrorStyle,
72
+ }
73
+ : [])), global.intl.formatMessage({
74
+ id: content.checkboxName + "-message",
75
+ defaultMessage: content.checkboxLabel,
76
+ }, {
77
+ labelLink: (index.h("a", { href: content.checkboxLabelLink, target: "_blank" }, content.checkboxLabelLinkText || content.checkboxLabelLink)),
78
+ })),
79
+ (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.checkboxName]) && (index.h("p", { class: sheet.classes.ErrorMessageStyle }, getRequiredFieldErrorMessage({
80
+ checkboxLabel: content.checkboxLabel,
81
+ })))));
82
+ }
83
+
84
+ exports.LeadCheckboxFieldView = LeadCheckboxFieldView;
@@ -4,90 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-a29c60ef.js');
6
6
  const stencilHooks_module = require('./stencil-hooks.module-3a336b0f.js');
7
- const global = require('./global-e31dc4f5.js');
7
+ require('./global-e31dc4f5.js');
8
8
  const index_module = require('./index.module-ee84433d.js');
9
9
  const cjs = require('./cjs-1066ec21.js');
10
10
  const utils = require('./utils-6847bc06.js');
11
- const JSS = require('./JSS-8503a151.js');
11
+ require('./JSS-8503a151.js');
12
12
  const useLeadFormState = require('./useLeadFormState-c83d2034.js');
13
-
14
- const style = {
15
- ErrorStyle: {
16
- "&::part(control)": {
17
- background: "var(--sl-color-danger-10)",
18
- borderColor: "var(--sl-color-danger-500)",
19
- outline: "var(--sl-color-danger-500)",
20
- },
21
- "&:host": {
22
- "--focus-ring": "0 0 0 var(--sl-focus-ring-width) red !important",
23
- },
24
- },
25
- ErrorMessageStyle: {
26
- margin: 0,
27
- marginTop: "5px",
28
- color: "var(--sl-color-danger-500)",
29
- fontSize: "var(--sl-input-help-text-font-size-medium)",
30
- fontFamily: "var(--sl-font-sans)",
31
- fontWeight: "var(--sl-font-weight-normal)",
32
- },
33
- FieldContainer: {
34
- "margin-bottom": "var(--sl-spacing-large)",
35
- },
36
- };
37
- const vanillaStyle = `
38
- :host {
39
- margin: 0 auto;
40
- width: 100%;
41
- display: block;
42
- }
43
- sl-checkbox::part(label){
44
- font-size: var(--sl-input-label-font-size-small);
45
- font-weight: var(--sl-font-weight-normal);
46
- line-height: 20px;
47
- }
48
- sl-checkbox::part(base){
49
- align-items: start;
50
- }
51
- `;
52
- JSS.jss.setup(JSS.create());
53
- const sheet = JSS.jss.createStyleSheet(style);
54
- const styleString = sheet.toString();
55
- function LeadCheckboxFieldView(props) {
56
- var _a, _b, _c, _d, _e;
57
- const { states, content, callbacks } = props;
58
- const validationErrors = (_a = states === null || states === void 0 ? void 0 : states.leadFormState) === null || _a === void 0 ? void 0 : _a.validationErrors;
59
- const getRequiredFieldErrorMessage = ({ checkboxLabel, }) => global.intl.formatMessage({
60
- id: `requiredFieldErrorMessage-${checkboxLabel}`,
61
- defaultMessage: content.errorMessage,
62
- }, {
63
- checkboxLabel,
64
- });
65
- return (index.h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
66
- index.h("style", { type: "text/css" },
67
- vanillaStyle,
68
- styleString),
69
- index.h("sl-checkbox", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.checkboxName}`, checked: states.checked, "onSl-change": (e) => {
70
- e.target.value = e.target.checked;
71
- callbacks.setChecked(e.target.value);
72
- } }, (!content.checkboxOptional ? { required: false } : []), { disabled: ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.disabled), validationError: ({ value }) => {
73
- if (!value && !content.checkboxOptional) {
74
- return getRequiredFieldErrorMessage({
75
- checkboxLabel: content.checkboxLabel,
76
- });
77
- }
78
- } }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e[content.checkboxName]) ? {
79
- class: sheet.classes.ErrorStyle,
80
- }
81
- : [])), global.intl.formatMessage({
82
- id: content.checkboxName + "-message",
83
- defaultMessage: content.checkboxLabel,
84
- }, {
85
- labelLink: (index.h("a", { href: content.checkboxLabelLink, target: "_blank" }, content.checkboxLabelLinkText || content.checkboxLabelLink)),
86
- })),
87
- (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.checkboxName]) && (index.h("p", { class: sheet.classes.ErrorMessageStyle }, getRequiredFieldErrorMessage({
88
- checkboxLabel: content.checkboxLabel,
89
- })))));
90
- }
13
+ const sqmLeadCheckboxFieldView = require('./sqm-lead-checkbox-field-view-00116edf.js');
91
14
 
92
15
  function useLeadCheckboxField(props) {
93
16
  var _a;
@@ -132,7 +55,7 @@ const LeadCheckboxField = class {
132
55
  /**
133
56
  * @uiName Unchecked error message
134
57
  */
135
- this.errorMessage = "Must be checked";
58
+ this.errorMessage = "{checkboxLabel} must be checked";
136
59
  /**
137
60
  * @uiName Optional
138
61
  */
@@ -156,7 +79,7 @@ const LeadCheckboxField = class {
156
79
  const { states, callbacks } = index_module.isDemo()
157
80
  ? useLeadCheckboxFieldDemo(this)
158
81
  : useLeadCheckboxField(this);
159
- return (index.h(LeadCheckboxFieldView, { states: states, content: content, callbacks: callbacks }));
82
+ return (index.h(sqmLeadCheckboxFieldView.LeadCheckboxFieldView, { states: states, content: content, callbacks: callbacks }));
160
83
  }
161
84
  };
162
85
  function useLeadCheckboxFieldDemo(props) {
@@ -20,6 +20,7 @@ const sqmAssetCardView = require('./sqm-asset-card-view-21ddf04f.js');
20
20
  const sqmCloseButtonView = require('./sqm-close-button-view-ea3fa23b.js');
21
21
  require('./index-8c6255f5.js');
22
22
  const emailRegistrationView = require('./email-registration-view-55b378dc.js');
23
+ const sqmLeadCheckboxFieldView = require('./sqm-lead-checkbox-field-view-00116edf.js');
23
24
  const sqmLeaderboardRankView = require('./sqm-leaderboard-rank-view-d39a55d8.js');
24
25
  const sqmLogoutCurrentUserView = require('./sqm-logout-current-user-view-11d57c12.js');
25
26
  const sqmNavigationSidebarView = require('./sqm-navigation-sidebar-view-17111896.js');
@@ -16064,6 +16065,67 @@ const LeadFormDropdownField = /*#__PURE__*/Object.freeze({
16064
16065
  WithInitialValue: WithInitialValue$1
16065
16066
  });
16066
16067
 
16068
+ const LeadCheckboxField_stories = {
16069
+ title: "Components/Lead Checkbox Field",
16070
+ };
16071
+ const defaultProps$w = {
16072
+ states: {
16073
+ leadFormState: {
16074
+ validationErrors: {},
16075
+ },
16076
+ checked: false,
16077
+ },
16078
+ content: {
16079
+ checkboxName: "terms",
16080
+ checkboxLabel: "By signing up you agree to the {labelLink}",
16081
+ checkboxLabelLink: "https://example.com",
16082
+ checkboxLabelLinkText: "Terms and Conditions",
16083
+ errorMessage: "{checkboxLabel} Must be checked",
16084
+ },
16085
+ callbacks: {
16086
+ setChecked: () => { },
16087
+ },
16088
+ };
16089
+ const Default$u = createHookStory(() => (index.h(sqmLeadCheckboxFieldView.LeadCheckboxFieldView, Object.assign({}, defaultProps$w))));
16090
+ const DefaultChecked$1 = createHookStory(() => (index.h(sqmLeadCheckboxFieldView.LeadCheckboxFieldView, Object.assign({}, defaultProps$w, { states: {
16091
+ ...defaultProps$w.states,
16092
+ checked: true,
16093
+ } }))));
16094
+ const CustomLabel$3 = createHookStory(() => (index.h(sqmLeadCheckboxFieldView.LeadCheckboxFieldView, Object.assign({}, defaultProps$w, { content: {
16095
+ ...defaultProps$w.content,
16096
+ checkboxLabel: "I Agree",
16097
+ } }))));
16098
+ const Error$d = createHookStory(() => (index.h(sqmLeadCheckboxFieldView.LeadCheckboxFieldView, Object.assign({}, defaultProps$w, { states: {
16099
+ ...defaultProps$w.states,
16100
+ leadFormState: {
16101
+ validationErrors: {
16102
+ terms: "{checkboxLabel} Must be checked",
16103
+ },
16104
+ },
16105
+ } }))));
16106
+ const CustomError$3 = createHookStory(() => (index.h(sqmLeadCheckboxFieldView.LeadCheckboxFieldView, Object.assign({}, defaultProps$w, { states: {
16107
+ ...defaultProps$w.states,
16108
+ checked: true,
16109
+ leadFormState: {
16110
+ validationErrors: {
16111
+ terms: "{checkboxLabel} Must be checked",
16112
+ },
16113
+ },
16114
+ }, content: {
16115
+ ...defaultProps$w.content,
16116
+ errorMessage: "This checkbox must be checked to continue",
16117
+ } }))));
16118
+
16119
+ const LeadCheckboxField = /*#__PURE__*/Object.freeze({
16120
+ __proto__: null,
16121
+ 'default': LeadCheckboxField_stories,
16122
+ Default: Default$u,
16123
+ DefaultChecked: DefaultChecked$1,
16124
+ CustomLabel: CustomLabel$3,
16125
+ Error: Error$d,
16126
+ CustomError: CustomError$3
16127
+ });
16128
+
16067
16129
  /**
16068
16130
  *
16069
16131
  * Themes
@@ -16076,7 +16138,7 @@ const LeadFormDropdownField = /*#__PURE__*/Object.freeze({
16076
16138
  *
16077
16139
  */
16078
16140
  //
16079
- const Default$u = `
16141
+ const Default$v = `
16080
16142
  // No CSS
16081
16143
  `;
16082
16144
  const Orangey = `
@@ -16110,7 +16172,7 @@ const Klip = `
16110
16172
 
16111
16173
  const Themes = /*#__PURE__*/Object.freeze({
16112
16174
  __proto__: null,
16113
- Default: Default$u,
16175
+ Default: Default$v,
16114
16176
  Orangey: Orangey,
16115
16177
  Netflix: Netflix,
16116
16178
  SaaSquatchCorporate: SaaSquatchCorporate,
@@ -18804,6 +18866,7 @@ const stories = [
18804
18866
  LeadForm,
18805
18867
  LeadInputField,
18806
18868
  LeadFormDropdownField,
18869
+ LeadCheckboxField,
18807
18870
  ];
18808
18871
  const StencilStorybook = class {
18809
18872
  constructor(hostRef) {
@@ -1,13 +1,8 @@
1
1
  import { h } from "@stencil/core";
2
- import { PortalRegisterView, } from "../sqm-portal-register/sqm-portal-register-view";
3
2
  import { createHookStory } from "../sqm-stencilbook/HookStoryAddon";
4
3
  import { LeadCheckboxFieldView, } from "./sqm-lead-checkbox-field-view";
5
- import scenario from "./sqm-checkbox-field.feature";
6
4
  export default {
7
- title: "Components/Checkbox Field",
8
- parameters: {
9
- scenario,
10
- },
5
+ title: "Components/Lead Checkbox Field",
11
6
  };
12
7
  const defaultProps = {
13
8
  states: {
@@ -21,35 +16,12 @@ const defaultProps = {
21
16
  checkboxLabel: "By signing up you agree to the {labelLink}",
22
17
  checkboxLabelLink: "https://example.com",
23
18
  checkboxLabelLinkText: "Terms and Conditions",
24
- errorMessage: "Must be checked",
19
+ errorMessage: "{checkboxLabel} Must be checked",
25
20
  },
26
21
  callbacks: {
27
22
  setChecked: () => { },
28
23
  },
29
24
  };
30
- const defaultRegisterProps = {
31
- states: {
32
- registrationFormState: {},
33
- error: "",
34
- loading: false,
35
- confirmPassword: true,
36
- hideInputs: false,
37
- loginPath: "/login",
38
- },
39
- callbacks: {
40
- submit: () => console.log("Submit!"),
41
- inputFunction: () => { },
42
- },
43
- refs: {
44
- formRef: {},
45
- },
46
- content: {
47
- pageLabel: "Register",
48
- confirmPasswordLabel: "Confirm Password",
49
- requiredFieldErrorMessage: "Cannot be empty",
50
- invalidEmailErrorMessage: "Must be a valid email address",
51
- },
52
- };
53
25
  export const Default = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps))));
54
26
  export const DefaultChecked = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps, { states: {
55
27
  ...defaultProps.states,
@@ -63,41 +35,19 @@ export const Error = createHookStory(() => (h(LeadCheckboxFieldView, Object.assi
63
35
  ...defaultProps.states,
64
36
  leadFormState: {
65
37
  validationErrors: {
66
- agree: "Must be checked",
38
+ terms: "{checkboxLabel} Must be checked",
67
39
  },
68
40
  },
69
41
  } }))));
70
42
  export const CustomError = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps, { states: {
71
43
  ...defaultProps.states,
44
+ checked: true,
72
45
  leadFormState: {
73
46
  validationErrors: {
74
- agree: "Must be checked",
47
+ terms: "{checkboxLabel} Must be checked",
75
48
  },
76
49
  },
77
50
  }, content: {
78
51
  ...defaultProps.content,
79
52
  errorMessage: "This checkbox must be checked to continue",
80
53
  } }))));
81
- export const TermsAndConditions = createHookStory(() => (h(PortalRegisterView, Object.assign({}, defaultRegisterProps, {
82
- //@ts-ignore
83
- content: {
84
- ...defaultRegisterProps.content,
85
- terms: (h("p", null,
86
- h("sqm-checkbox-field", null))),
87
- } }))));
88
- export const TermsAndConditionsCustomLabel = createHookStory(() => (h(PortalRegisterView, Object.assign({}, defaultRegisterProps, {
89
- //@ts-ignore
90
- content: {
91
- ...defaultRegisterProps.content,
92
- terms: (h("p", null,
93
- "By signing up you agree to the",
94
- " ",
95
- h("a", { href: "https://example.com", target: "_blank" }, "Terms and Conditions"),
96
- h("sqm-checkbox-field", { "checkbox-label": "I agree" }))),
97
- } }))));
98
- export const TermsAndConditionsLongCustomLabel = createHookStory(() => (h(PortalRegisterView, Object.assign({}, defaultRegisterProps, {
99
- //@ts-ignore
100
- content: {
101
- ...defaultRegisterProps.content,
102
- terms: (h("sqm-checkbox-field", { "checkbox-label": "Participants must be at least 18 years of age and a legal resident of the U.S. or Canada. By signing up to participate in the rewards program, you agree to the {labelLink}.", "checkbox-label-link": "https://www.example.com", "checkbox-label-link-text": "terms", "checkbox-name": "termsAndConditions" })),
103
- } }))));
@@ -5,7 +5,6 @@ import { intl } from "../../global/global";
5
5
  const style = {
6
6
  ErrorStyle: {
7
7
  "&::part(control)": {
8
- background: "var(--sl-color-danger-10)",
9
8
  borderColor: "var(--sl-color-danger-500)",
10
9
  outline: "var(--sl-color-danger-500)",
11
10
  },
@@ -31,7 +31,7 @@ export class LeadCheckboxField {
31
31
  /**
32
32
  * @uiName Unchecked error message
33
33
  */
34
- this.errorMessage = "Must be checked";
34
+ this.errorMessage = "{checkboxLabel} must be checked";
35
35
  /**
36
36
  * @uiName Optional
37
37
  */
@@ -167,7 +167,7 @@ export class LeadCheckboxField {
167
167
  },
168
168
  "attribute": "error-message",
169
169
  "reflect": false,
170
- "defaultValue": "\"Must be checked\""
170
+ "defaultValue": "\"{checkboxLabel} must be checked\""
171
171
  },
172
172
  "checkboxOptional": {
173
173
  "type": "boolean",
@@ -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
@@ -0,0 +1,82 @@
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, callbacks } = 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}`, checked: states.checked, "onSl-change": (e) => {
60
+ e.target.value = e.target.checked;
61
+ callbacks.setChecked(e.target.value);
62
+ } }, (!content.checkboxOptional ? { required: false } : []), { disabled: ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.disabled), validationError: ({ value }) => {
63
+ if (!value && !content.checkboxOptional) {
64
+ return getRequiredFieldErrorMessage({
65
+ checkboxLabel: content.checkboxLabel,
66
+ });
67
+ }
68
+ } }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e[content.checkboxName]) ? {
69
+ class: sheet.classes.ErrorStyle,
70
+ }
71
+ : [])), intl.formatMessage({
72
+ id: content.checkboxName + "-message",
73
+ defaultMessage: content.checkboxLabel,
74
+ }, {
75
+ labelLink: (h("a", { href: content.checkboxLabelLink, target: "_blank" }, content.checkboxLabelLinkText || content.checkboxLabelLink)),
76
+ })),
77
+ (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.checkboxName]) && (h("p", { class: sheet.classes.ErrorMessageStyle }, getRequiredFieldErrorMessage({
78
+ checkboxLabel: content.checkboxLabel,
79
+ })))));
80
+ }
81
+
82
+ export { LeadCheckboxFieldView as L };
@@ -1,89 +1,12 @@
1
- import { h, r as registerInstance } from './index-91e7729f.js';
2
- import { i as d, k as useState, f as useEffect, n as h$1 } from './stencil-hooks.module-4bc38af4.js';
3
- import { i as intl } from './global-be1f9992.js';
1
+ import { r as registerInstance, h as h$1 } from './index-91e7729f.js';
2
+ import { i as d, k as useState, f as useEffect, 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 { j as jss, a as create } from './JSS-67b5cff8.js';
7
+ import './JSS-67b5cff8.js';
8
8
  import { L as LEAD_FORM_STATE_CONTEXT, R as RequiredPropsError } from './useLeadFormState-9016d812.js';
9
-
10
- const style = {
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;
53
- const { states, content, callbacks } = props;
54
- const validationErrors = (_a = states === null || states === void 0 ? void 0 : states.leadFormState) === null || _a === void 0 ? void 0 : _a.validationErrors;
55
- const getRequiredFieldErrorMessage = ({ checkboxLabel, }) => intl.formatMessage({
56
- id: `requiredFieldErrorMessage-${checkboxLabel}`,
57
- defaultMessage: content.errorMessage,
58
- }, {
59
- checkboxLabel,
60
- });
61
- return (h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
62
- h("style", { type: "text/css" },
63
- vanillaStyle,
64
- styleString),
65
- h("sl-checkbox", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.checkboxName}`, checked: states.checked, "onSl-change": (e) => {
66
- e.target.value = e.target.checked;
67
- callbacks.setChecked(e.target.value);
68
- } }, (!content.checkboxOptional ? { required: false } : []), { disabled: ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.disabled), validationError: ({ value }) => {
69
- if (!value && !content.checkboxOptional) {
70
- return getRequiredFieldErrorMessage({
71
- checkboxLabel: content.checkboxLabel,
72
- });
73
- }
74
- } }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e[content.checkboxName]) ? {
75
- class: sheet.classes.ErrorStyle,
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
- (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.checkboxName]) && (h("p", { class: sheet.classes.ErrorMessageStyle }, getRequiredFieldErrorMessage({
84
- checkboxLabel: content.checkboxLabel,
85
- })))));
86
- }
9
+ import { L as LeadCheckboxFieldView } from './sqm-lead-checkbox-field-view-f2d478ad.js';
87
10
 
88
11
  function useLeadCheckboxField(props) {
89
12
  var _a;
@@ -128,12 +51,12 @@ const LeadCheckboxField = class {
128
51
  /**
129
52
  * @uiName Unchecked error message
130
53
  */
131
- this.errorMessage = "Must be checked";
54
+ this.errorMessage = "{checkboxLabel} must be checked";
132
55
  /**
133
56
  * @uiName Optional
134
57
  */
135
58
  this.checkboxOptional = false;
136
- h$1(this);
59
+ h(this);
137
60
  }
138
61
  disconnectedCallback() { }
139
62
  render() {
@@ -144,7 +67,7 @@ const LeadCheckboxField = class {
144
67
  },
145
68
  ]);
146
69
  if (!isDemo() && missingProps) {
147
- 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:" }));
70
+ 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:" }));
148
71
  }
149
72
  const content = {
150
73
  ...getProps(this),
@@ -152,7 +75,7 @@ const LeadCheckboxField = class {
152
75
  const { states, callbacks } = isDemo()
153
76
  ? useLeadCheckboxFieldDemo(this)
154
77
  : useLeadCheckboxField(this);
155
- return (h(LeadCheckboxFieldView, { states: states, content: content, callbacks: callbacks }));
78
+ return (h$1(LeadCheckboxFieldView, { states: states, content: content, callbacks: callbacks }));
156
79
  }
157
80
  };
158
81
  function useLeadCheckboxFieldDemo(props) {