@saasquatch/mint-components 1.14.7-1 → 1.14.7-10

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 (46) hide show
  1. package/dist/cjs/{ShadowViewAddon-3c344355.js → ShadowViewAddon-d79686c7.js} +1 -1
  2. package/dist/cjs/sqm-big-stat_43.cjs.entry.js +9 -2
  3. package/dist/cjs/sqm-lead-checkbox-field-view-34d94919.js +83 -0
  4. package/dist/cjs/sqm-lead-checkbox-field.cjs.entry.js +8 -98
  5. package/dist/cjs/sqm-stencilbook.cjs.entry.js +56 -3
  6. package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field-view.js +1 -1
  7. package/dist/collection/components/sqm-lead-form/LeadCheckboxField.stories.js +4 -63
  8. package/dist/collection/components/sqm-lead-form/sqm-lead-checkbox-field-view.js +11 -10
  9. package/dist/collection/components/sqm-lead-form/sqm-lead-checkbox-field.js +5 -9
  10. package/dist/collection/components/sqm-lead-form/useCheckboxField.js +1 -14
  11. package/dist/collection/components/sqm-lead-form/useLeadForm.js +8 -1
  12. package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +2 -0
  13. package/dist/esm/{ShadowViewAddon-64194d20.js → ShadowViewAddon-88ca6579.js} +1 -1
  14. package/dist/esm/sqm-big-stat_43.entry.js +9 -2
  15. package/dist/esm/sqm-lead-checkbox-field-view-a8c1c78e.js +81 -0
  16. package/dist/esm/sqm-lead-checkbox-field.entry.js +12 -102
  17. package/dist/esm/sqm-stencilbook.entry.js +56 -3
  18. package/dist/esm-es5/ShadowViewAddon-88ca6579.js +1 -0
  19. package/dist/esm-es5/sqm-big-stat_43.entry.js +1 -1
  20. package/dist/esm-es5/sqm-lead-checkbox-field-view-a8c1c78e.js +1 -0
  21. package/dist/esm-es5/sqm-lead-checkbox-field.entry.js +1 -1
  22. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  23. package/dist/mint-components/mint-components.esm.js +1 -1
  24. package/dist/mint-components/p-00df0cac.js +1 -0
  25. package/dist/mint-components/p-0a6dd9ce.system.entry.js +1 -0
  26. package/dist/mint-components/p-0b4cac9f.system.entry.js +1 -0
  27. package/dist/mint-components/p-2011095e.js +394 -0
  28. package/dist/mint-components/p-2ad84d3e.system.entry.js +1 -0
  29. package/dist/mint-components/p-37996351.system.js +1 -1
  30. package/dist/mint-components/p-48c69c2d.entry.js +1 -0
  31. package/dist/mint-components/p-8a8750b2.system.js +1 -0
  32. package/dist/mint-components/p-95b88eb6.system.js +1 -0
  33. package/dist/mint-components/{p-f60d1ae9.entry.js → p-9743b3d1.entry.js} +2 -2
  34. package/dist/mint-components/{p-851eaf57.entry.js → p-c45a40b0.entry.js} +2 -2
  35. package/dist/types/components/sqm-lead-form/LeadCheckboxField.stories.d.ts +0 -27
  36. package/dist/types/components/sqm-lead-form/sqm-lead-checkbox-field-view.d.ts +0 -5
  37. package/dist/types/components/sqm-lead-form/useCheckboxField.d.ts +1 -6
  38. package/docs/docs.docx +0 -0
  39. package/package.json +1 -1
  40. package/dist/esm-es5/ShadowViewAddon-64194d20.js +0 -1
  41. package/dist/mint-components/p-0d94d81a.system.js +0 -1
  42. package/dist/mint-components/p-10a8ecae.system.entry.js +0 -1
  43. package/dist/mint-components/p-30a11ec0.js +0 -394
  44. package/dist/mint-components/p-48ad59a8.system.entry.js +0 -1
  45. package/dist/mint-components/p-550346bd.entry.js +0 -1
  46. 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,104 +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, _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$1(this);
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, callbacks } = isDemo()
63
+ const { states } = isDemo()
150
64
  ? useLeadCheckboxFieldDemo(this)
151
- : useLeadCheckboxField(this);
152
- return (h(LeadCheckboxFieldView, { states: states, content: content, callbacks: callbacks }));
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
- registrationFormState: {},
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-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';
@@ -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-64194d20.js';
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-88ca6579.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$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) {