@saasquatch/mint-components 1.14.7-5 → 1.14.7-7

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 (38) hide show
  1. package/dist/cjs/sqm-big-stat_43.cjs.entry.js +7 -1
  2. package/dist/cjs/sqm-lead-checkbox-field-view-34d94919.js +83 -0
  3. package/dist/cjs/sqm-lead-checkbox-field.cjs.entry.js +9 -102
  4. package/dist/cjs/sqm-stencilbook.cjs.entry.js +55 -2
  5. package/dist/collection/components/sqm-lead-form/LeadCheckboxField.stories.js +4 -63
  6. package/dist/collection/components/sqm-lead-form/sqm-lead-checkbox-field-view.js +2 -4
  7. package/dist/collection/components/sqm-lead-form/sqm-lead-checkbox-field.js +7 -11
  8. package/dist/collection/components/sqm-lead-form/useCheckboxField.js +1 -14
  9. package/dist/collection/components/sqm-lead-form/useLeadForm.js +7 -1
  10. package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +2 -0
  11. package/dist/esm/sqm-big-stat_43.entry.js +7 -1
  12. package/dist/esm/sqm-lead-checkbox-field-view-a8c1c78e.js +81 -0
  13. package/dist/esm/sqm-lead-checkbox-field.entry.js +13 -106
  14. package/dist/esm/sqm-stencilbook.entry.js +55 -2
  15. package/dist/esm-es5/sqm-big-stat_43.entry.js +1 -1
  16. package/dist/esm-es5/sqm-lead-checkbox-field-view-a8c1c78e.js +1 -0
  17. package/dist/esm-es5/sqm-lead-checkbox-field.entry.js +1 -1
  18. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  19. package/dist/mint-components/mint-components.esm.js +1 -1
  20. package/dist/mint-components/p-00df0cac.js +1 -0
  21. package/dist/mint-components/p-0b4cac9f.system.entry.js +1 -0
  22. package/dist/mint-components/p-1d8c24d9.system.entry.js +1 -0
  23. package/dist/mint-components/p-37996351.system.js +1 -1
  24. package/dist/mint-components/p-48c69c2d.entry.js +1 -0
  25. package/dist/mint-components/p-95b88eb6.system.js +1 -0
  26. package/dist/mint-components/{p-f60d1ae9.entry.js → p-a94b5fc6.entry.js} +2 -2
  27. package/dist/mint-components/p-bddf7783.system.entry.js +1 -0
  28. package/dist/mint-components/{p-851eaf57.entry.js → p-fb0c586d.entry.js} +1 -1
  29. package/dist/types/components/sqm-lead-form/LeadCheckboxField.stories.d.ts +0 -27
  30. package/dist/types/components/sqm-lead-form/sqm-lead-checkbox-field-view.d.ts +0 -4
  31. package/dist/types/components/sqm-lead-form/useCheckboxField.d.ts +1 -6
  32. package/docs/docs.docx +0 -0
  33. package/docs/raisins.json +1 -1
  34. package/package.json +1 -1
  35. package/dist/mint-components/p-10a8ecae.system.entry.js +0 -1
  36. package/dist/mint-components/p-75eea63f.entry.js +0 -1
  37. package/dist/mint-components/p-81fbca73.system.entry.js +0 -1
  38. package/dist/mint-components/p-eaf1a8a6.system.entry.js +0 -1
@@ -0,0 +1,81 @@
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 ? { 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 }) => {
62
+ if (!value && !content.checkboxOptional) {
63
+ return getRequiredFieldErrorMessage({
64
+ checkboxLabel: content.checkboxLabel,
65
+ });
66
+ }
67
+ } }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e[content.checkboxName]) ? {
68
+ class: sheet.classes.ErrorStyle,
69
+ }
70
+ : [])), intl.formatMessage({
71
+ id: content.checkboxName + "-message",
72
+ defaultMessage: content.checkboxLabel,
73
+ }, {
74
+ labelLink: (h("a", { href: content.checkboxLabelLink, target: "_blank" }, content.checkboxLabelLinkText || content.checkboxLabelLink)),
75
+ })),
76
+ (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.checkboxName]) && (h("p", { class: sheet.classes.ErrorMessageStyle }, getRequiredFieldErrorMessage({
77
+ checkboxLabel: content.checkboxLabel,
78
+ })))));
79
+ }
80
+
81
+ export { LeadCheckboxFieldView as L };
@@ -1,107 +1,18 @@
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, 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
+ import { L as LeadCheckboxFieldView } from './sqm-lead-checkbox-field-view-a8c1c78e.js';
9
10
 
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
- }
87
-
88
- function useLeadCheckboxField(props) {
89
- var _a;
11
+ function useLeadCheckboxField() {
90
12
  const leadFormState = d(LEAD_FORM_STATE_CONTEXT);
91
- const [checked, setChecked] = useState(false);
92
- useEffect(() => {
93
- var _a, _b;
94
- if ((_a = leadFormState === null || leadFormState === void 0 ? void 0 : leadFormState.initialData) === null || _a === void 0 ? void 0 : _a[props.checkboxName]) {
95
- setChecked(!!((_b = leadFormState === null || leadFormState === void 0 ? void 0 : leadFormState.initialData) === null || _b === void 0 ? void 0 : _b[props.checkboxName]));
96
- }
97
- }, [(_a = leadFormState === null || leadFormState === void 0 ? void 0 : leadFormState.initialData) === null || _a === void 0 ? void 0 : _a[props.checkboxName]]);
98
13
  return {
99
14
  states: {
100
15
  leadFormState,
101
- checked,
102
- },
103
- callbacks: {
104
- setChecked,
105
16
  },
106
17
  };
107
18
  }
@@ -128,12 +39,12 @@ const LeadCheckboxField = class {
128
39
  /**
129
40
  * @uiName Unchecked error message
130
41
  */
131
- this.errorMessage = "{checkboxLabel} must be checked";
42
+ this.errorMessage = "Must be checked";
132
43
  /**
133
44
  * @uiName Optional
134
45
  */
135
46
  this.checkboxOptional = false;
136
- h$1(this);
47
+ h(this);
137
48
  }
138
49
  disconnectedCallback() { }
139
50
  render() {
@@ -144,25 +55,21 @@ const LeadCheckboxField = class {
144
55
  },
145
56
  ]);
146
57
  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:" }));
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:" }));
148
59
  }
149
60
  const content = {
150
61
  ...getProps(this),
151
62
  };
152
- const { states, callbacks } = isDemo()
63
+ const { states } = isDemo()
153
64
  ? useLeadCheckboxFieldDemo(this)
154
- : useLeadCheckboxField(this);
155
- return (h(LeadCheckboxFieldView, { states: states, content: content, callbacks: callbacks }));
65
+ : useLeadCheckboxField();
66
+ return (h$1(LeadCheckboxFieldView, { states: states, content: content }));
156
67
  }
157
68
  };
158
69
  function useLeadCheckboxFieldDemo(props) {
159
70
  return cjs({
160
71
  states: {
161
- registrationFormState: {},
162
- checked: false,
163
- },
164
- callbacks: {
165
- setChecked: () => { },
72
+ leadFormState: {},
166
73
  },
167
74
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
168
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-a8c1c78e.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';
@@ -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$u = `
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$u,
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) {