@saasquatch/mint-components 1.14.8 → 1.14.9-0

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 (74) hide show
  1. package/dist/cjs/{ShadowViewAddon-28865623.js → ShadowViewAddon-3c344355.js} +4 -12
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mint-components.cjs.js +1 -1
  4. package/dist/cjs/sqm-big-stat_43.cjs.entry.js +3 -10
  5. package/dist/cjs/sqm-lead-input-field.cjs.entry.js +1 -1
  6. package/dist/cjs/sqm-qr-code.cjs.entry.js +1 -13
  7. package/dist/cjs/sqm-stencilbook.cjs.entry.js +3 -56
  8. package/dist/collection/collection-manifest.json +0 -1
  9. package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field-view.js +4 -11
  10. package/dist/collection/components/sqm-lead-form/sqm-lead-form.js +0 -1
  11. package/dist/collection/components/sqm-lead-form/useLeadForm.js +1 -8
  12. package/dist/collection/components/sqm-portal-register/sqm-portal-register.js +0 -1
  13. package/dist/collection/components/sqm-portal-registration-form/sqm-portal-registration-form.js +0 -1
  14. package/dist/collection/components/sqm-qr-code/useQRCode.js +1 -13
  15. package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +0 -2
  16. package/dist/esm/{ShadowViewAddon-f2176779.js → ShadowViewAddon-64194d20.js} +4 -12
  17. package/dist/esm/loader.js +1 -1
  18. package/dist/esm/mint-components.js +1 -1
  19. package/dist/esm/sqm-big-stat_43.entry.js +3 -10
  20. package/dist/esm/sqm-lead-input-field.entry.js +1 -1
  21. package/dist/esm/sqm-qr-code.entry.js +1 -13
  22. package/dist/esm/sqm-stencilbook.entry.js +3 -56
  23. package/dist/esm-es5/ShadowViewAddon-64194d20.js +1 -0
  24. package/dist/esm-es5/loader.js +1 -1
  25. package/dist/esm-es5/mint-components.js +1 -1
  26. package/dist/esm-es5/sqm-big-stat_43.entry.js +1 -1
  27. package/dist/esm-es5/sqm-lead-input-field.entry.js +1 -1
  28. package/dist/esm-es5/sqm-qr-code.entry.js +1 -1
  29. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  30. package/dist/mint-components/mint-components.esm.js +1 -1
  31. package/dist/mint-components/{p-653a8a7b.entry.js → p-0a4f1306.entry.js} +10 -10
  32. package/dist/mint-components/p-0d94d81a.system.js +1 -0
  33. package/dist/mint-components/p-30a11ec0.js +394 -0
  34. package/dist/mint-components/p-37996351.system.js +1 -1
  35. package/dist/mint-components/p-74fdf750.system.entry.js +1 -0
  36. package/dist/mint-components/p-8b584c46.system.entry.js +1 -0
  37. package/dist/mint-components/p-c9b08184.entry.js +17 -0
  38. package/dist/mint-components/{p-12bba567.entry.js → p-d3e72503.entry.js} +1 -1
  39. package/dist/mint-components/p-eaf1a8a6.system.entry.js +1 -0
  40. package/dist/mint-components/{p-c4ce8578.entry.js → p-f60d1ae9.entry.js} +2 -2
  41. package/dist/mint-components/{p-8c0b7881.system.entry.js → p-fbbb85f0.system.entry.js} +1 -1
  42. package/dist/types/components/sqm-lead-form/sqm-lead-form.d.ts +0 -1
  43. package/dist/types/components/sqm-portal-register/sqm-portal-register.d.ts +0 -1
  44. package/dist/types/components/sqm-portal-registration-form/sqm-portal-registration-form.d.ts +0 -1
  45. package/dist/types/components.d.ts +0 -80
  46. package/docs/docs.docx +0 -0
  47. package/docs/raisins.json +1 -1
  48. package/grapesjs/grapesjs.js +1 -1
  49. package/package.json +1 -1
  50. package/dist/cjs/sqm-lead-checkbox-field-view-34d94919.js +0 -83
  51. package/dist/cjs/sqm-lead-checkbox-field.cjs.entry.js +0 -81
  52. package/dist/collection/components/sqm-lead-form/LeadCheckboxField.stories.js +0 -44
  53. package/dist/collection/components/sqm-lead-form/sqm-lead-checkbox-field-view.js +0 -79
  54. package/dist/collection/components/sqm-lead-form/sqm-lead-checkbox-field.js +0 -234
  55. package/dist/collection/components/sqm-lead-form/useCheckboxField.js +0 -10
  56. package/dist/esm/sqm-lead-checkbox-field-view-a8c1c78e.js +0 -81
  57. package/dist/esm/sqm-lead-checkbox-field.entry.js +0 -77
  58. package/dist/esm-es5/ShadowViewAddon-f2176779.js +0 -1
  59. package/dist/esm-es5/sqm-lead-checkbox-field-view-a8c1c78e.js +0 -1
  60. package/dist/esm-es5/sqm-lead-checkbox-field.entry.js +0 -1
  61. package/dist/mint-components/p-00df0cac.js +0 -1
  62. package/dist/mint-components/p-0b4cac9f.system.entry.js +0 -1
  63. package/dist/mint-components/p-0c78815e.system.entry.js +0 -1
  64. package/dist/mint-components/p-0d939b73.system.js +0 -1
  65. package/dist/mint-components/p-48c69c2d.entry.js +0 -1
  66. package/dist/mint-components/p-4cff3345.system.entry.js +0 -1
  67. package/dist/mint-components/p-53730ffe.entry.js +0 -17
  68. package/dist/mint-components/p-95b88eb6.system.js +0 -1
  69. package/dist/mint-components/p-a01e3c3d.system.entry.js +0 -1
  70. package/dist/mint-components/p-c1b074b6.js +0 -394
  71. package/dist/types/components/sqm-lead-form/LeadCheckboxField.stories.d.ts +0 -28
  72. package/dist/types/components/sqm-lead-form/sqm-lead-checkbox-field-view.d.ts +0 -15
  73. package/dist/types/components/sqm-lead-form/sqm-lead-checkbox-field.d.ts +0 -46
  74. package/dist/types/components/sqm-lead-form/useCheckboxField.d.ts +0 -6
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@saasquatch/mint-components",
3
3
  "title": "Mint Components",
4
- "version": "1.14.8",
4
+ "version": "1.14.9-0",
5
5
  "description": "A minimal design library with components for referral and loyalty experiences. Built with Shoelace components by Saasquatch.",
6
6
  "icon": "https://res.cloudinary.com/saasquatch/image/upload/v1652219900/squatch-assets/For_Mint.svg",
7
7
  "raisins": "docs/raisins.json",
@@ -1,83 +0,0 @@
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 } = 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}`, "onSl-change": (e) => {
62
- e.target.value = e.target.checked;
63
- } }, (!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 }) => {
64
- if (!value && !content.checkboxOptional) {
65
- return getRequiredFieldErrorMessage({
66
- checkboxLabel: content.checkboxLabel,
67
- });
68
- }
69
- } }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e[content.checkboxName]) ? {
70
- class: sheet.classes.ErrorStyle,
71
- }
72
- : [])), global.intl.formatMessage({
73
- id: content.checkboxName + "-message",
74
- defaultMessage: content.checkboxLabel,
75
- }, {
76
- labelLink: (index.h("a", { href: content.checkboxLabelLink, target: "_blank" }, content.checkboxLabelLinkText || content.checkboxLabelLink)),
77
- })),
78
- (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.checkboxName]) && (index.h("p", { class: sheet.classes.ErrorMessageStyle }, getRequiredFieldErrorMessage({
79
- checkboxLabel: content.checkboxLabel,
80
- })))));
81
- }
82
-
83
- exports.LeadCheckboxFieldView = LeadCheckboxFieldView;
@@ -1,81 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-a29c60ef.js');
6
- const stencilHooks_module = require('./stencil-hooks.module-3a336b0f.js');
7
- require('./global-e31dc4f5.js');
8
- const index_module = require('./index.module-ee84433d.js');
9
- const cjs = require('./cjs-1066ec21.js');
10
- const utils = require('./utils-6847bc06.js');
11
- require('./JSS-8503a151.js');
12
- const useLeadFormState = require('./useLeadFormState-c83d2034.js');
13
- const sqmLeadCheckboxFieldView = require('./sqm-lead-checkbox-field-view-34d94919.js');
14
-
15
- function useLeadCheckboxField() {
16
- const leadFormState = stencilHooks_module.d(useLeadFormState.LEAD_FORM_STATE_CONTEXT);
17
- return {
18
- states: {
19
- leadFormState,
20
- },
21
- };
22
- }
23
-
24
- const LeadCheckboxField = class {
25
- constructor(hostRef) {
26
- index.registerInstance(this, hostRef);
27
- this.ignored = true;
28
- /**
29
- * @uiName Checkbox label
30
- * @uiWidget textArea
31
- */
32
- this.checkboxLabel = "By signing up you agree to the {labelLink}";
33
- /**
34
- * Used with link text if the checkbox label contains {labelLink}
35
- *
36
- * @uiName Checkbox label link
37
- */
38
- this.checkboxLabelLink = "https://example.com";
39
- /**
40
- * @uiName Checkbox label link lext
41
- */
42
- this.checkboxLabelLinkText = "Terms and Conditions";
43
- /**
44
- * @uiName Unchecked error message
45
- */
46
- this.errorMessage = "Must be checked";
47
- /**
48
- * @uiName Optional
49
- */
50
- this.checkboxOptional = false;
51
- stencilHooks_module.h$1(this);
52
- }
53
- disconnectedCallback() { }
54
- render() {
55
- const missingProps = utils.getMissingProps([
56
- {
57
- attribute: "checkbox-name",
58
- value: this.checkboxName,
59
- },
60
- ]);
61
- if (!index_module.isDemo() && missingProps) {
62
- return (index.h(useLeadFormState.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:" }));
63
- }
64
- const content = {
65
- ...utils.getProps(this),
66
- };
67
- const { states } = index_module.isDemo()
68
- ? useLeadCheckboxFieldDemo(this)
69
- : useLeadCheckboxField();
70
- return (index.h(sqmLeadCheckboxFieldView.LeadCheckboxFieldView, { states: states, content: content }));
71
- }
72
- };
73
- function useLeadCheckboxFieldDemo(props) {
74
- return cjs.cjs({
75
- states: {
76
- leadFormState: {},
77
- },
78
- }, props.demoData || {}, { arrayMerge: (_, a) => a });
79
- }
80
-
81
- exports.sqm_lead_checkbox_field = LeadCheckboxField;
@@ -1,44 +0,0 @@
1
- import { h } from "@stencil/core";
2
- import { createHookStory } from "../sqm-stencilbook/HookStoryAddon";
3
- import { LeadCheckboxFieldView, } from "./sqm-lead-checkbox-field-view";
4
- export default {
5
- title: "Components/Lead Checkbox Field",
6
- };
7
- const defaultProps = {
8
- states: {
9
- leadFormState: {
10
- validationErrors: {},
11
- },
12
- },
13
- content: {
14
- checkboxName: "terms",
15
- checkboxLabel: "By signing up you agree to the {labelLink}",
16
- checkboxLabelLink: "https://example.com",
17
- checkboxLabelLinkText: "Terms and Conditions",
18
- errorMessage: "{checkboxLabel} Must be checked",
19
- },
20
- };
21
- export const Default = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps))));
22
- export const CustomLabel = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps, { content: {
23
- ...defaultProps.content,
24
- checkboxLabel: "I Agree",
25
- } }))));
26
- export const Error = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps, { states: {
27
- ...defaultProps.states,
28
- leadFormState: {
29
- validationErrors: {
30
- terms: "{checkboxLabel} Must be checked",
31
- },
32
- },
33
- } }))));
34
- export const CustomError = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps, { states: {
35
- ...defaultProps.states,
36
- leadFormState: {
37
- validationErrors: {
38
- terms: "{checkboxLabel} Must be checked",
39
- },
40
- },
41
- }, content: {
42
- ...defaultProps.content,
43
- errorMessage: "This checkbox must be checked to continue",
44
- } }))));
@@ -1,79 +0,0 @@
1
- import { h } from "@stencil/core";
2
- import jss from "jss";
3
- import preset from "jss-preset-default";
4
- import { intl } from "../../global/global";
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(preset());
43
- const sheet = jss.createStyleSheet(style);
44
- const styleString = sheet.toString();
45
- export 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
- }
@@ -1,234 +0,0 @@
1
- import { isDemo } from "@saasquatch/component-boilerplate";
2
- import { withHooks } from "@saasquatch/stencil-hooks";
3
- import { Component, h, Prop, State } from "@stencil/core";
4
- import deepmerge from "deepmerge";
5
- import { RequiredPropsError } from "../../utils/RequiredPropsError";
6
- import { getMissingProps, getProps } from "../../utils/utils";
7
- import { LeadCheckboxFieldView, } from "./sqm-lead-checkbox-field-view";
8
- import { useLeadCheckboxField } from "./useCheckboxField";
9
- /**
10
- * @uiName Lead Form Checkbox Field
11
- * @validParents ["sqm-lead-form"]
12
- */
13
- export class LeadCheckboxField {
14
- constructor() {
15
- this.ignored = true;
16
- /**
17
- * @uiName Checkbox label
18
- * @uiWidget textArea
19
- */
20
- this.checkboxLabel = "By signing up you agree to the {labelLink}";
21
- /**
22
- * Used with link text if the checkbox label contains {labelLink}
23
- *
24
- * @uiName Checkbox label link
25
- */
26
- this.checkboxLabelLink = "https://example.com";
27
- /**
28
- * @uiName Checkbox label link lext
29
- */
30
- this.checkboxLabelLinkText = "Terms and Conditions";
31
- /**
32
- * @uiName Unchecked error message
33
- */
34
- this.errorMessage = "Must be checked";
35
- /**
36
- * @uiName Optional
37
- */
38
- this.checkboxOptional = false;
39
- withHooks(this);
40
- }
41
- disconnectedCallback() { }
42
- render() {
43
- const missingProps = getMissingProps([
44
- {
45
- attribute: "checkbox-name",
46
- value: this.checkboxName,
47
- },
48
- ]);
49
- if (!isDemo() && missingProps) {
50
- 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:" }));
51
- }
52
- const content = {
53
- ...getProps(this),
54
- };
55
- const { states } = isDemo()
56
- ? useLeadCheckboxFieldDemo(this)
57
- : useLeadCheckboxField();
58
- return (h(LeadCheckboxFieldView, { states: states, content: content }));
59
- }
60
- static get is() { return "sqm-lead-checkbox-field"; }
61
- static get properties() { return {
62
- "checkboxName": {
63
- "type": "string",
64
- "mutable": false,
65
- "complexType": {
66
- "original": "string",
67
- "resolved": "string",
68
- "references": {}
69
- },
70
- "required": false,
71
- "optional": false,
72
- "docs": {
73
- "tags": [{
74
- "text": "Checkbox name attribute",
75
- "name": "uiName"
76
- }, {
77
- "text": undefined,
78
- "name": "required"
79
- }],
80
- "text": "This name is used as the key for this form field on submission. The name must be unique within this specific form."
81
- },
82
- "attribute": "checkbox-name",
83
- "reflect": false
84
- },
85
- "checkboxLabel": {
86
- "type": "string",
87
- "mutable": false,
88
- "complexType": {
89
- "original": "string",
90
- "resolved": "string",
91
- "references": {}
92
- },
93
- "required": false,
94
- "optional": false,
95
- "docs": {
96
- "tags": [{
97
- "text": "Checkbox label",
98
- "name": "uiName"
99
- }, {
100
- "text": "textArea",
101
- "name": "uiWidget"
102
- }],
103
- "text": ""
104
- },
105
- "attribute": "checkbox-label",
106
- "reflect": false,
107
- "defaultValue": "\"By signing up you agree to the {labelLink}\""
108
- },
109
- "checkboxLabelLink": {
110
- "type": "string",
111
- "mutable": false,
112
- "complexType": {
113
- "original": "string",
114
- "resolved": "string",
115
- "references": {}
116
- },
117
- "required": false,
118
- "optional": true,
119
- "docs": {
120
- "tags": [{
121
- "text": "Checkbox label link",
122
- "name": "uiName"
123
- }],
124
- "text": "Used with link text if the checkbox label contains {labelLink}"
125
- },
126
- "attribute": "checkbox-label-link",
127
- "reflect": false,
128
- "defaultValue": "\"https://example.com\""
129
- },
130
- "checkboxLabelLinkText": {
131
- "type": "string",
132
- "mutable": false,
133
- "complexType": {
134
- "original": "string",
135
- "resolved": "string",
136
- "references": {}
137
- },
138
- "required": false,
139
- "optional": true,
140
- "docs": {
141
- "tags": [{
142
- "text": "Checkbox label link lext",
143
- "name": "uiName"
144
- }],
145
- "text": ""
146
- },
147
- "attribute": "checkbox-label-link-text",
148
- "reflect": false,
149
- "defaultValue": "\"Terms and Conditions\""
150
- },
151
- "errorMessage": {
152
- "type": "string",
153
- "mutable": false,
154
- "complexType": {
155
- "original": "string",
156
- "resolved": "string",
157
- "references": {}
158
- },
159
- "required": false,
160
- "optional": true,
161
- "docs": {
162
- "tags": [{
163
- "text": "Unchecked error message",
164
- "name": "uiName"
165
- }],
166
- "text": ""
167
- },
168
- "attribute": "error-message",
169
- "reflect": false,
170
- "defaultValue": "\"Must be checked\""
171
- },
172
- "checkboxOptional": {
173
- "type": "boolean",
174
- "mutable": false,
175
- "complexType": {
176
- "original": "boolean",
177
- "resolved": "boolean",
178
- "references": {}
179
- },
180
- "required": false,
181
- "optional": true,
182
- "docs": {
183
- "tags": [{
184
- "text": "Optional",
185
- "name": "uiName"
186
- }],
187
- "text": ""
188
- },
189
- "attribute": "checkbox-optional",
190
- "reflect": false,
191
- "defaultValue": "false"
192
- },
193
- "demoData": {
194
- "type": "unknown",
195
- "mutable": false,
196
- "complexType": {
197
- "original": "DemoData<LeadCheckboxFieldViewProps>",
198
- "resolved": "{ states?: { leadFormState?: LeadFormState; }; content?: { checkboxName: string; checkboxLabel: string; checkboxLabelLink?: string; checkboxLabelLinkText?: string; checkboxOptional?: boolean; errorMessage?: string; }; }",
199
- "references": {
200
- "DemoData": {
201
- "location": "import",
202
- "path": "../../global/demo"
203
- },
204
- "LeadCheckboxFieldViewProps": {
205
- "location": "import",
206
- "path": "./sqm-lead-checkbox-field-view"
207
- }
208
- }
209
- },
210
- "required": false,
211
- "optional": true,
212
- "docs": {
213
- "tags": [{
214
- "text": undefined,
215
- "name": "undocumented"
216
- }, {
217
- "text": "object",
218
- "name": "uiType"
219
- }],
220
- "text": ""
221
- }
222
- }
223
- }; }
224
- static get states() { return {
225
- "ignored": {}
226
- }; }
227
- }
228
- function useLeadCheckboxFieldDemo(props) {
229
- return deepmerge({
230
- states: {
231
- leadFormState: {},
232
- },
233
- }, props.demoData || {}, { arrayMerge: (_, a) => a });
234
- }
@@ -1,10 +0,0 @@
1
- import { useDomContext } from "@saasquatch/stencil-hooks";
2
- import { LEAD_FORM_STATE_CONTEXT } from "./useLeadFormState";
3
- export function useLeadCheckboxField() {
4
- const leadFormState = useDomContext(LEAD_FORM_STATE_CONTEXT);
5
- return {
6
- states: {
7
- leadFormState,
8
- },
9
- };
10
- }
@@ -1,81 +0,0 @@
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 };