@saasquatch/mint-components 1.14.6-9 → 1.14.7-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 (96) hide show
  1. package/dist/cjs/{ShadowViewAddon-d1dda2b0.js → ShadowViewAddon-3c344355.js} +116 -49
  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_42.cjs.entry.js → sqm-big-stat_43.cjs.entry.js} +117 -24
  5. package/dist/cjs/sqm-lead-checkbox-field.cjs.entry.js +155 -0
  6. package/dist/cjs/{sqm-lead-input-field-view-6344cd93.js → sqm-lead-input-field-view-89308aab.js} +7 -7
  7. package/dist/cjs/sqm-lead-input-field.cjs.entry.js +6 -2
  8. package/dist/cjs/sqm-stencilbook.cjs.entry.js +17 -10
  9. package/dist/collection/collection-manifest.json +2 -1
  10. package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field-view.js +1 -1
  11. package/dist/collection/components/sqm-lead-form/LeadCheckboxField.stories.js +103 -0
  12. package/dist/collection/components/sqm-lead-form/LeadForm.stories.js +5 -2
  13. package/dist/collection/components/sqm-lead-form/LeadFormDropdownField.stories.js +3 -0
  14. package/dist/collection/components/sqm-lead-form/LeadInputField.stories.js +1 -0
  15. package/dist/collection/components/sqm-lead-form/sqm-lead-checkbox-field-view.js +62 -0
  16. package/dist/collection/components/sqm-lead-form/sqm-lead-checkbox-field.js +238 -0
  17. package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field-view.js +10 -10
  18. package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field.js +57 -5
  19. package/dist/collection/components/sqm-lead-form/sqm-lead-form-view.js +55 -51
  20. package/dist/collection/components/sqm-lead-form/sqm-lead-form.js +65 -35
  21. package/dist/collection/components/sqm-lead-form/sqm-lead-input-field-view.js +7 -7
  22. package/dist/collection/components/sqm-lead-form/sqm-lead-input-field.js +28 -5
  23. package/dist/collection/components/sqm-lead-form/useCheckboxField.js +23 -0
  24. package/dist/collection/components/sqm-lead-form/useLeadForm.js +15 -10
  25. package/dist/esm/{ShadowViewAddon-81771102.js → ShadowViewAddon-64194d20.js} +117 -51
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/esm/mint-components.js +1 -1
  28. package/dist/esm/{sqm-big-stat_42.entry.js → sqm-big-stat_43.entry.js} +118 -26
  29. package/dist/esm/sqm-lead-checkbox-field.entry.js +151 -0
  30. package/dist/esm/{sqm-lead-input-field-view-f1dd4b77.js → sqm-lead-input-field-view-4ede5d7f.js} +7 -7
  31. package/dist/esm/sqm-lead-input-field.entry.js +6 -2
  32. package/dist/esm/sqm-stencilbook.entry.js +12 -5
  33. package/dist/esm-es5/ShadowViewAddon-64194d20.js +1 -0
  34. package/dist/esm-es5/loader.js +1 -1
  35. package/dist/esm-es5/mint-components.js +1 -1
  36. package/dist/esm-es5/sqm-big-stat_43.entry.js +1 -0
  37. package/dist/esm-es5/sqm-lead-checkbox-field.entry.js +1 -0
  38. package/dist/esm-es5/sqm-lead-input-field-view-4ede5d7f.js +1 -0
  39. package/dist/esm-es5/sqm-lead-input-field.entry.js +1 -1
  40. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  41. package/dist/mint-components/mint-components.esm.js +1 -1
  42. package/dist/mint-components/p-01dd541f.system.js +1 -0
  43. package/dist/mint-components/p-0d94d81a.system.js +1 -0
  44. package/dist/mint-components/p-10a8ecae.system.entry.js +1 -0
  45. package/dist/mint-components/p-12bba567.entry.js +1 -0
  46. package/dist/mint-components/p-214c7807.entry.js +1 -0
  47. package/dist/mint-components/{p-460974bf.js → p-30a11ec0.js} +24 -24
  48. package/dist/mint-components/p-37996351.system.js +1 -1
  49. package/dist/mint-components/p-589962db.system.entry.js +1 -0
  50. package/dist/mint-components/p-6ba44ca9.js +1 -0
  51. package/dist/mint-components/{p-b2ff8561.entry.js → p-851eaf57.entry.js} +21 -21
  52. package/dist/mint-components/p-8c0b7881.system.entry.js +1 -0
  53. package/dist/mint-components/p-eaf1a8a6.system.entry.js +1 -0
  54. package/dist/mint-components/{p-ba585a4b.entry.js → p-f60d1ae9.entry.js} +2 -2
  55. package/dist/types/components/sqm-lead-form/LeadCheckboxField.stories.d.ts +55 -0
  56. package/dist/types/components/sqm-lead-form/LeadFormDropdownField.stories.d.ts +1 -0
  57. package/dist/types/components/sqm-lead-form/sqm-lead-checkbox-field-view.d.ts +19 -0
  58. package/dist/types/components/sqm-lead-form/sqm-lead-checkbox-field.d.ts +46 -0
  59. package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field-view.d.ts +3 -1
  60. package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field.d.ts +11 -4
  61. package/dist/types/components/sqm-lead-form/sqm-lead-form-view.d.ts +2 -1
  62. package/dist/types/components/sqm-lead-form/sqm-lead-form.d.ts +19 -10
  63. package/dist/types/components/sqm-lead-form/sqm-lead-input-field-view.d.ts +1 -0
  64. package/dist/types/components/sqm-lead-form/sqm-lead-input-field.d.ts +4 -2
  65. package/dist/types/components/sqm-lead-form/useCheckboxField.d.ts +11 -0
  66. package/dist/types/components/sqm-lead-form/useLeadForm.d.ts +1 -0
  67. package/dist/types/components/sqm-referral-iframe/useReferralIframe.d.ts +1 -1
  68. package/dist/types/components.d.ts +143 -19
  69. package/docs/docs.docx +0 -0
  70. package/docs/raisins.json +1 -1
  71. package/grapesjs/grapesjs.js +1 -1
  72. package/package.json +1 -1
  73. package/dist/cjs/sqm-lead-dropdown-field-view-03a3e03f.js +0 -69
  74. package/dist/cjs/sqm-lead-dropdown-field.cjs.entry.js +0 -81
  75. package/dist/esm/sqm-lead-dropdown-field-view-4c85fe20.js +0 -67
  76. package/dist/esm/sqm-lead-dropdown-field.entry.js +0 -77
  77. package/dist/esm-es5/ShadowViewAddon-81771102.js +0 -1
  78. package/dist/esm-es5/sqm-big-stat_42.entry.js +0 -1
  79. package/dist/esm-es5/sqm-lead-dropdown-field-view-4c85fe20.js +0 -1
  80. package/dist/esm-es5/sqm-lead-dropdown-field.entry.js +0 -1
  81. package/dist/esm-es5/sqm-lead-input-field-view-f1dd4b77.js +0 -1
  82. package/dist/mint-components/p-15f1ff1d.system.js +0 -1
  83. package/dist/mint-components/p-26da31c6.js +0 -1
  84. package/dist/mint-components/p-4056c0ea.system.entry.js +0 -1
  85. package/dist/mint-components/p-4d5b02af.js +0 -1
  86. package/dist/mint-components/p-59970cb1.system.entry.js +0 -1
  87. package/dist/mint-components/p-6b093d8c.entry.js +0 -1
  88. package/dist/mint-components/p-7094012d.system.entry.js +0 -1
  89. package/dist/mint-components/p-87384d9e.system.js +0 -1
  90. package/dist/mint-components/p-ad128614.system.js +0 -1
  91. package/dist/mint-components/p-c5a55554.entry.js +0 -1
  92. package/dist/mint-components/p-de5356d9.system.entry.js +0 -1
  93. package/dist/types/global/android.d.ts +0 -7
  94. package/dist/types/global/demo.d.ts +0 -2
  95. package/dist/types/stories/features.d.ts +0 -4
  96. package/dist/types/stories/templates.d.ts +0 -4
@@ -0,0 +1,103 @@
1
+ import { h } from "@stencil/core";
2
+ import { PortalRegisterView, } from "../sqm-portal-register/sqm-portal-register-view";
3
+ import { createHookStory } from "../sqm-stencilbook/HookStoryAddon";
4
+ import { LeadCheckboxFieldView, } from "./sqm-lead-checkbox-field-view";
5
+ import scenario from "./sqm-checkbox-field.feature";
6
+ export default {
7
+ title: "Components/Checkbox Field",
8
+ parameters: {
9
+ scenario,
10
+ },
11
+ };
12
+ const defaultProps = {
13
+ states: {
14
+ leadFormState: {
15
+ validationErrors: {},
16
+ },
17
+ checked: false,
18
+ },
19
+ content: {
20
+ checkboxName: "terms",
21
+ checkboxLabel: "By signing up you agree to the {labelLink}",
22
+ checkboxLabelLink: "https://example.com",
23
+ checkboxLabelLinkText: "Terms and Conditions",
24
+ errorMessage: "Must be checked",
25
+ },
26
+ callbacks: {
27
+ setChecked: () => { },
28
+ },
29
+ };
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
+ export const Default = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps))));
54
+ export const DefaultChecked = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps, { states: {
55
+ ...defaultProps.states,
56
+ checked: true,
57
+ } }))));
58
+ export const CustomLabel = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps, { content: {
59
+ ...defaultProps.content,
60
+ checkboxLabel: "I Agree",
61
+ } }))));
62
+ export const Error = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps, { states: {
63
+ ...defaultProps.states,
64
+ leadFormState: {
65
+ validationErrors: {
66
+ agree: "Must be checked",
67
+ },
68
+ },
69
+ } }))));
70
+ export const CustomError = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps, { states: {
71
+ ...defaultProps.states,
72
+ leadFormState: {
73
+ validationErrors: {
74
+ agree: "Must be checked",
75
+ },
76
+ },
77
+ }, content: {
78
+ ...defaultProps.content,
79
+ errorMessage: "This checkbox must be checked to continue",
80
+ } }))));
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
+ } }))));
@@ -14,6 +14,7 @@ const defaultProps = {
14
14
  callbacks: {
15
15
  submit: () => console.log("Submit!"),
16
16
  inputFunction: () => { },
17
+ resetForm: () => { },
17
18
  },
18
19
  refs: {
19
20
  formRef: {},
@@ -68,8 +69,10 @@ const slottedProps = {
68
69
  content: {
69
70
  ...defaultProps.content,
70
71
  formData: (h("div", null,
71
- h("sl-input", { style: { marginBottom: "var(--sl-spacing-x-large)" }, exportparts: "label: input-label, base: input-base", label: "Slotted Input", required: true }),
72
- h("sl-input", { exportparts: "label: input-label, base: input-base", label: "Slotted Input 2", required: true }))),
72
+ h("sqm-lead-input-field", { "field-name": "firstName", "field-label": "First Name", "field-type": "text", "required-field-error-message": "Please enter a first name" }),
73
+ h("sqm-lead-input-field", { "field-name": "lastName", "field-label": "Last Name", "field-type": "text", "required-field-error-message": "Please enter a last name" }),
74
+ h("sqm-lead-input-field", { "field-name": "email", "field-label": "Email", "field-type": "email", "required-field-error-message": "Please enter a valid email address" }),
75
+ h("sqm-lead-dropdown-field", null))),
73
76
  },
74
77
  };
75
78
  export const Default = () => h(LeadFormView, Object.assign({}, defaultProps));
@@ -16,7 +16,9 @@ const defaultProps = {
16
16
  dropdownName: "country",
17
17
  dropdownLabel: "Country",
18
18
  requiredFieldErrorMessage: "Please select a country",
19
+ optionalLabel: "(Optional)",
19
20
  dropdownOptional: false,
21
+ multiple: false,
20
22
  selectOptions: [
21
23
  h("sl-menu-item", { value: "red" }, "Canada"),
22
24
  h("sl-menu-item", { value: "blue" }, "United States"),
@@ -25,6 +27,7 @@ const defaultProps = {
25
27
  },
26
28
  };
27
29
  export const Default = () => h(LeadDropdownFieldView, Object.assign({}, defaultProps));
30
+ export const Multiple = () => (h(LeadDropdownFieldView, Object.assign({}, defaultProps, { content: { ...defaultProps.content, multiple: true } })));
28
31
  export const WithError = () => (h(LeadDropdownFieldView, Object.assign({}, defaultProps, { states: {
29
32
  ...defaultProps.states,
30
33
  leadFormState: {
@@ -16,6 +16,7 @@ const defaultProps = {
16
16
  fieldName: "firstName",
17
17
  fieldLabel: "First Name",
18
18
  fieldType: "text",
19
+ optionalLabel: "(Optional)",
19
20
  requiredFieldErrorMessage: "Please {fieldAction} a {fieldLabel}",
20
21
  fieldOptional: false,
21
22
  },
@@ -0,0 +1,62 @@
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
+ background: "var(--sl-color-danger-10)",
9
+ borderColor: "var(--sl-color-danger-500)",
10
+ outline: "var(--sl-color-danger-500)",
11
+ },
12
+ "&:host": {
13
+ "--focus-ring": "0 0 0 var(--sl-focus-ring-width) red !important",
14
+ },
15
+ },
16
+ ErrorMessageStyle: {
17
+ margin: 0,
18
+ marginTop: "5px",
19
+ color: "var(--sl-color-danger-500)",
20
+ fontSize: "var(--sl-input-help-text-font-size-medium)",
21
+ fontFamily: "var(--sl-font-sans)",
22
+ fontWeight: "var(--sl-font-weight-normal)",
23
+ },
24
+ FieldContainer: {
25
+ "margin-bottom": "var(--sl-spacing-large)",
26
+ },
27
+ };
28
+ const vanillaStyle = `
29
+ :host {
30
+ margin: 0 auto;
31
+ width: 100%;
32
+ display: block;
33
+ }
34
+ sl-checkbox::part(label){
35
+ font-size: var(--sl-input-label-font-size-small);
36
+ font-weight: var(--sl-font-weight-normal);
37
+ line-height: 20px;
38
+ }
39
+ sl-checkbox::part(base){
40
+ align-items: start;
41
+ }
42
+ `;
43
+ jss.setup(preset());
44
+ const sheet = jss.createStyleSheet(style);
45
+ const styleString = sheet.toString();
46
+ export function LeadCheckboxFieldView(props) {
47
+ var _a, _b;
48
+ const { states, content, callbacks } = props;
49
+ return (h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
50
+ h("style", { type: "text/css" },
51
+ vanillaStyle,
52
+ styleString),
53
+ h("sl-checkbox", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.checkboxName}`, checked: states.checked, "onSl-change": (e) => {
54
+ e.target.value = e.target.checked;
55
+ callbacks.setChecked(e.target.value);
56
+ } }, (!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), required: false }), intl.formatMessage({
57
+ id: content.checkboxName + "-message",
58
+ defaultMessage: content.checkboxLabel,
59
+ }, {
60
+ labelLink: (h("a", { href: content.checkboxLabelLink, target: "_blank" }, content.checkboxLabelLinkText || content.checkboxLabelLink)),
61
+ }))));
62
+ }
@@ -0,0 +1,238 @@
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, callbacks } = isDemo()
56
+ ? useLeadCheckboxFieldDemo(this)
57
+ : useLeadCheckboxField(this);
58
+ return (h(LeadCheckboxFieldView, { states: states, content: content, callbacks: callbacks }));
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; checked: boolean; }; 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
+ registrationFormState: {},
232
+ checked: false,
233
+ },
234
+ callbacks: {
235
+ setChecked: () => { },
236
+ },
237
+ }, props.demoData || {}, { arrayMerge: (_, a) => a });
238
+ }
@@ -28,16 +28,19 @@ sl-select::part(label){
28
28
  font-size: var(--sl-input-label-font-size-small);
29
29
  font-weight: var(--sl-font-weight-semibold);
30
30
  }
31
+ sl-select::part(menu){
32
+ max-height: 300px;
33
+ }
31
34
  `;
32
35
  jss.setup(preset());
33
36
  const sheet = jss.createStyleSheet(style);
34
37
  const styleString = sheet.toString();
35
38
  export function LeadDropdownFieldView(props) {
36
- var _a, _b, _c, _d, _e, _f, _g;
39
+ var _a, _b, _c, _d, _e;
37
40
  const { states, content } = props;
38
41
  const validationErrors = (_a = states === null || states === void 0 ? void 0 : states.leadFormState) === null || _a === void 0 ? void 0 : _a.validationErrors;
39
42
  const getRequiredFieldErrorMessage = ({ dropdownLabel, }) => intl.formatMessage({
40
- id: "requiredFieldErrorMessage",
43
+ id: `requiredFieldErrorMessage-${dropdownLabel}`,
41
44
  defaultMessage: content.requiredFieldErrorMessage,
42
45
  }, {
43
46
  dropdownLabel,
@@ -46,20 +49,17 @@ export function LeadDropdownFieldView(props) {
46
49
  h("style", { type: "text/css" },
47
50
  vanillaStyle,
48
51
  styleString),
49
- h("sl-select", Object.assign({ exportparts: "label: input-label, base: input-base", label: content.dropdownLabel, name: `/${content.dropdownName}` }, (!content.dropdownOptional ? { required: true } : []), { disabled: ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.disabled), validationError: ({ value }) => {
50
- if (!value) {
52
+ h("sl-select", Object.assign({ style: { maxHeight: "100px" }, exportparts: "label: input-label, base: input-base", label: `${content.dropdownLabel}${content.dropdownOptional ? ` ${content.optionalLabel}` : ""}`, name: `/${content.dropdownName}`, multiple: content.multiple }, (!content.dropdownOptional ? { required: true } : []), { disabled: ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.disabled), validationError: ({ value }) => {
53
+ if (!value && !content.dropdownOptional) {
51
54
  return getRequiredFieldErrorMessage({
52
55
  dropdownLabel: content.dropdownLabel,
53
56
  });
54
57
  }
55
- } }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e.firstName) ? {
58
+ } }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e[content.dropdownName]) ? {
56
59
  class: sheet.classes.ErrorStyle,
57
- helpText: ((_g = (_f = states.leadFormState) === null || _f === void 0 ? void 0 : _f.validationErrors) === null || _g === void 0 ? void 0 : _g.firstName) ||
58
- content.requiredFieldErrorMessage,
59
60
  }
60
61
  : [])), content.selectOptions),
61
- (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.dropdownName]) && (h("p", { class: sheet.classes.ErrorMessageStyle }, intl.formatMessage({
62
- id: `errorMessage-${content.dropdownName}`,
63
- defaultMessage: content.requiredFieldErrorMessage,
62
+ (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.dropdownName]) && (h("p", { class: sheet.classes.ErrorMessageStyle }, getRequiredFieldErrorMessage({
63
+ dropdownLabel: content.dropdownLabel,
64
64
  })))));
65
65
  }
@@ -9,9 +9,7 @@ import { useLeadDropdownField } from "./useLeadDropdownField";
9
9
  /**
10
10
  * @uiName Lead Form Dropdown Field
11
11
  * @validParents ["sqm-lead-form"]
12
- * @slots [{"name":"", "title":"Drop Down Option"}]
13
- * @exampleGroup Microsite Components
14
- * @example Lead Form Dropdown Field - <sqm-lead-dropdown-field dropdown-label="Select an option" required-field-error-message="Please select an option"><sl-menu-item value="option-1">Option 1</sl-menu-item><sl-menu-item value="option-2">Option 2</sl-menu-item><sl-menu-item value="option-3">Option 3</sl-menu-item></sqm-lead-dropdown-field>
12
+ * @slots [{"name":"", "title":"Dropdown Option"}]
15
13
  */
16
14
  export class LeadDropdownField {
17
15
  constructor() {
@@ -27,11 +25,20 @@ export class LeadDropdownField {
27
25
  * @uiWidget textArea
28
26
  */
29
27
  this.requiredFieldErrorMessage = "Please select a {dropdownLabel}";
28
+ /**
29
+ * @uiName Optional label
30
+ */
31
+ this.optionalLabel = "(optional)";
30
32
  /**
31
33
  * @uiName Optional
32
34
  * @default
33
35
  */
34
36
  this.dropdownOptional = false;
37
+ /**
38
+ * @uiName Multiple selection
39
+ * @default
40
+ */
41
+ this.multiple = false;
35
42
  withHooks(this);
36
43
  }
37
44
  disconnectedCallback() { }
@@ -125,6 +132,27 @@ export class LeadDropdownField {
125
132
  "reflect": false,
126
133
  "defaultValue": "\"Please select a {dropdownLabel}\""
127
134
  },
135
+ "optionalLabel": {
136
+ "type": "string",
137
+ "mutable": false,
138
+ "complexType": {
139
+ "original": "string",
140
+ "resolved": "string",
141
+ "references": {}
142
+ },
143
+ "required": false,
144
+ "optional": false,
145
+ "docs": {
146
+ "tags": [{
147
+ "text": "Optional label",
148
+ "name": "uiName"
149
+ }],
150
+ "text": ""
151
+ },
152
+ "attribute": "optional-label",
153
+ "reflect": false,
154
+ "defaultValue": "\"(optional)\""
155
+ },
128
156
  "dropdownOptional": {
129
157
  "type": "boolean",
130
158
  "mutable": false,
@@ -134,7 +162,7 @@ export class LeadDropdownField {
134
162
  "references": {}
135
163
  },
136
164
  "required": false,
137
- "optional": true,
165
+ "optional": false,
138
166
  "docs": {
139
167
  "tags": [{
140
168
  "text": "Optional",
@@ -149,12 +177,36 @@ export class LeadDropdownField {
149
177
  "reflect": false,
150
178
  "defaultValue": "false"
151
179
  },
180
+ "multiple": {
181
+ "type": "boolean",
182
+ "mutable": false,
183
+ "complexType": {
184
+ "original": "boolean",
185
+ "resolved": "boolean",
186
+ "references": {}
187
+ },
188
+ "required": false,
189
+ "optional": false,
190
+ "docs": {
191
+ "tags": [{
192
+ "text": "Multiple selection",
193
+ "name": "uiName"
194
+ }, {
195
+ "text": undefined,
196
+ "name": "default"
197
+ }],
198
+ "text": ""
199
+ },
200
+ "attribute": "multiple",
201
+ "reflect": false,
202
+ "defaultValue": "false"
203
+ },
152
204
  "demoData": {
153
205
  "type": "unknown",
154
206
  "mutable": false,
155
207
  "complexType": {
156
208
  "original": "DemoData<DropdownFieldViewProps>",
157
- "resolved": "{ states?: { leadFormState?: LeadFormState; }; content?: { dropdownName: string; dropdownLabel: string; dropdownOptional?: boolean; requiredFieldErrorMessage?: string; selectOptions?: VNode | VNode[]; }; }",
209
+ "resolved": "{ states?: { leadFormState?: LeadFormState; }; content?: { dropdownName: string; dropdownLabel: string; dropdownOptional: boolean; optionalLabel: string; multiple: boolean; requiredFieldErrorMessage?: string; selectOptions?: VNode | VNode[]; }; }",
158
210
  "references": {
159
211
  "DemoData": {
160
212
  "location": "import",