@saasquatch/mint-components 1.14.6-3 → 1.14.6-31

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 (79) hide show
  1. package/dist/cjs/{ShadowViewAddon-40f0bc74.js → ShadowViewAddon-cfd0e201.js} +115 -48
  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} +136 -22
  5. package/dist/cjs/{sqm-lead-input-field-view-6344cd93.js → sqm-lead-input-field-view-89308aab.js} +7 -7
  6. package/dist/cjs/sqm-lead-input-field.cjs.entry.js +12 -2
  7. package/dist/cjs/sqm-stencilbook.cjs.entry.js +17 -10
  8. package/dist/collection/collection-manifest.json +1 -1
  9. package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field-view.js +1 -1
  10. package/dist/collection/components/sqm-lead-form/LeadForm.stories.js +5 -2
  11. package/dist/collection/components/sqm-lead-form/LeadFormDropdownField.stories.js +3 -0
  12. package/dist/collection/components/sqm-lead-form/LeadInputField.stories.js +1 -0
  13. package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field-view.js +8 -10
  14. package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field.js +62 -2
  15. package/dist/collection/components/sqm-lead-form/sqm-lead-form-view.js +56 -50
  16. package/dist/collection/components/sqm-lead-form/sqm-lead-form.js +64 -34
  17. package/dist/collection/components/sqm-lead-form/sqm-lead-input-field-view.js +7 -7
  18. package/dist/collection/components/sqm-lead-form/sqm-lead-input-field.js +34 -3
  19. package/dist/collection/components/sqm-lead-form/useLeadForm.js +32 -6
  20. package/dist/esm/{ShadowViewAddon-8a0d9e83.js → ShadowViewAddon-00515b50.js} +116 -50
  21. package/dist/esm/loader.js +1 -1
  22. package/dist/esm/mint-components.js +1 -1
  23. package/dist/esm/{sqm-big-stat_42.entry.js → sqm-big-stat_43.entry.js} +136 -23
  24. package/dist/esm/{sqm-lead-input-field-view-f1dd4b77.js → sqm-lead-input-field-view-4ede5d7f.js} +7 -7
  25. package/dist/esm/sqm-lead-input-field.entry.js +12 -2
  26. package/dist/esm/sqm-stencilbook.entry.js +12 -5
  27. package/dist/esm-es5/ShadowViewAddon-00515b50.js +1 -0
  28. package/dist/esm-es5/loader.js +1 -1
  29. package/dist/esm-es5/mint-components.js +1 -1
  30. package/dist/esm-es5/sqm-big-stat_43.entry.js +1 -0
  31. package/dist/esm-es5/sqm-lead-input-field-view-4ede5d7f.js +1 -0
  32. package/dist/esm-es5/sqm-lead-input-field.entry.js +1 -1
  33. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  34. package/dist/mint-components/mint-components.esm.js +1 -1
  35. package/dist/mint-components/p-01dd541f.system.js +1 -0
  36. package/dist/mint-components/p-37996351.system.js +1 -1
  37. package/dist/mint-components/p-6544656d.system.js +1 -0
  38. package/dist/mint-components/p-6ba44ca9.js +1 -0
  39. package/dist/mint-components/{p-cd1c6113.entry.js → p-ad24132a.entry.js} +2 -2
  40. package/dist/mint-components/p-c2375fad.system.entry.js +1 -0
  41. package/dist/mint-components/{p-e358f0c1.entry.js → p-cc9ec01e.entry.js} +28 -20
  42. package/dist/mint-components/p-d3144467.system.entry.js +1 -0
  43. package/dist/mint-components/p-d3e72503.entry.js +1 -0
  44. package/dist/mint-components/{p-4139feb5.js → p-eb9ecf25.js} +24 -24
  45. package/dist/mint-components/p-fbbb85f0.system.entry.js +1 -0
  46. package/dist/types/components/sqm-lead-form/LeadFormDropdownField.stories.d.ts +1 -0
  47. package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field-view.d.ts +3 -1
  48. package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field.d.ts +10 -1
  49. package/dist/types/components/sqm-lead-form/sqm-lead-form-view.d.ts +2 -1
  50. package/dist/types/components/sqm-lead-form/sqm-lead-form.d.ts +18 -9
  51. package/dist/types/components/sqm-lead-form/sqm-lead-input-field-view.d.ts +1 -0
  52. package/dist/types/components/sqm-lead-form/sqm-lead-input-field.d.ts +4 -0
  53. package/dist/types/components/sqm-lead-form/useLeadForm.d.ts +2 -1
  54. package/dist/types/components/sqm-referral-iframe/useReferralIframe.d.ts +1 -1
  55. package/dist/types/components.d.ts +63 -19
  56. package/docs/docs.docx +0 -0
  57. package/docs/raisins.json +1 -1
  58. package/grapesjs/grapesjs.js +1 -1
  59. package/package.json +1 -1
  60. package/dist/cjs/sqm-lead-dropdown-field-view-03a3e03f.js +0 -69
  61. package/dist/cjs/sqm-lead-dropdown-field.cjs.entry.js +0 -75
  62. package/dist/esm/sqm-lead-dropdown-field-view-4c85fe20.js +0 -67
  63. package/dist/esm/sqm-lead-dropdown-field.entry.js +0 -71
  64. package/dist/esm-es5/ShadowViewAddon-8a0d9e83.js +0 -1
  65. package/dist/esm-es5/sqm-big-stat_42.entry.js +0 -1
  66. package/dist/esm-es5/sqm-lead-dropdown-field-view-4c85fe20.js +0 -1
  67. package/dist/esm-es5/sqm-lead-dropdown-field.entry.js +0 -1
  68. package/dist/esm-es5/sqm-lead-input-field-view-f1dd4b77.js +0 -1
  69. package/dist/mint-components/p-13c67985.system.entry.js +0 -1
  70. package/dist/mint-components/p-15f1ff1d.system.js +0 -1
  71. package/dist/mint-components/p-26da31c6.js +0 -1
  72. package/dist/mint-components/p-4d5b02af.js +0 -1
  73. package/dist/mint-components/p-87384d9e.system.js +0 -1
  74. package/dist/mint-components/p-875861d7.system.entry.js +0 -1
  75. package/dist/mint-components/p-8af8ab01.system.entry.js +0 -1
  76. package/dist/mint-components/p-9e1570bf.system.entry.js +0 -1
  77. package/dist/mint-components/p-ad6420a2.system.js +0 -1
  78. package/dist/mint-components/p-b8c15858.entry.js +0 -1
  79. package/dist/mint-components/p-f59d6012.entry.js +0 -1
@@ -27,11 +27,20 @@ export class LeadDropdownField {
27
27
  * @uiWidget textArea
28
28
  */
29
29
  this.requiredFieldErrorMessage = "Please select a {dropdownLabel}";
30
+ /**
31
+ * @uiName Optional label
32
+ */
33
+ this.optionalLabel = "(optional)";
30
34
  /**
31
35
  * @uiName Optional
32
36
  * @default
33
37
  */
34
38
  this.dropdownOptional = false;
39
+ /**
40
+ * @uiName Multiple selection
41
+ * @default
42
+ */
43
+ this.multiple = false;
35
44
  withHooks(this);
36
45
  }
37
46
  disconnectedCallback() { }
@@ -125,6 +134,27 @@ export class LeadDropdownField {
125
134
  "reflect": false,
126
135
  "defaultValue": "\"Please select a {dropdownLabel}\""
127
136
  },
137
+ "optionalLabel": {
138
+ "type": "string",
139
+ "mutable": false,
140
+ "complexType": {
141
+ "original": "string",
142
+ "resolved": "string",
143
+ "references": {}
144
+ },
145
+ "required": false,
146
+ "optional": false,
147
+ "docs": {
148
+ "tags": [{
149
+ "text": "Optional label",
150
+ "name": "uiName"
151
+ }],
152
+ "text": ""
153
+ },
154
+ "attribute": "optional-label",
155
+ "reflect": false,
156
+ "defaultValue": "\"(optional)\""
157
+ },
128
158
  "dropdownOptional": {
129
159
  "type": "boolean",
130
160
  "mutable": false,
@@ -134,7 +164,7 @@ export class LeadDropdownField {
134
164
  "references": {}
135
165
  },
136
166
  "required": false,
137
- "optional": true,
167
+ "optional": false,
138
168
  "docs": {
139
169
  "tags": [{
140
170
  "text": "Optional",
@@ -149,12 +179,36 @@ export class LeadDropdownField {
149
179
  "reflect": false,
150
180
  "defaultValue": "false"
151
181
  },
182
+ "multiple": {
183
+ "type": "boolean",
184
+ "mutable": false,
185
+ "complexType": {
186
+ "original": "boolean",
187
+ "resolved": "boolean",
188
+ "references": {}
189
+ },
190
+ "required": false,
191
+ "optional": false,
192
+ "docs": {
193
+ "tags": [{
194
+ "text": "Multiple selection",
195
+ "name": "uiName"
196
+ }, {
197
+ "text": undefined,
198
+ "name": "default"
199
+ }],
200
+ "text": ""
201
+ },
202
+ "attribute": "multiple",
203
+ "reflect": false,
204
+ "defaultValue": "false"
205
+ },
152
206
  "demoData": {
153
207
  "type": "unknown",
154
208
  "mutable": false,
155
209
  "complexType": {
156
210
  "original": "DemoData<DropdownFieldViewProps>",
157
- "resolved": "{ states?: { leadFormState?: LeadFormState; }; content?: { dropdownName: string; dropdownLabel: string; dropdownOptional?: boolean; requiredFieldErrorMessage?: string; selectOptions?: VNode | VNode[]; }; }",
211
+ "resolved": "{ states?: { leadFormState?: LeadFormState; }; content?: { dropdownName: string; dropdownLabel: string; dropdownOptional: boolean; optionalLabel: string; multiple: boolean; requiredFieldErrorMessage?: string; selectOptions?: VNode | VNode[]; }; }",
158
212
  "references": {
159
213
  "DemoData": {
160
214
  "location": "import",
@@ -189,5 +243,11 @@ function useLeadDropdownFieldDemo(props) {
189
243
  states: {
190
244
  leadFormState: {},
191
245
  },
246
+ content: {
247
+ dropdownName: props.dropdownName,
248
+ dropdownLabel: props.dropdownLabel,
249
+ requiredFieldErrorMessage: props.requiredFieldErrorMessage,
250
+ dropdownOptional: props.dropdownOptional,
251
+ },
192
252
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
193
253
  }
@@ -1,10 +1,15 @@
1
- import { h } from "@stencil/core";
1
+ import { Fragment, h } from "@stencil/core";
2
+ import { intl } from "../../global/global";
2
3
  import { AuthButtonsContainer, AuthColumn, AuthWrapper, ErrorStyles, HostBlock, } from "../../global/mixins";
3
4
  import { createStyleSheet } from "../../styling/JSS";
4
5
  import { TextSpanView } from "../sqm-text-span/sqm-text-span-view";
5
- import { intl } from "../../global/global";
6
6
  const style = {
7
- Wrapper: { ...AuthWrapper, "max-width": "600px" },
7
+ Wrapper: {
8
+ ...AuthWrapper,
9
+ "max-width": "600px",
10
+ border: "none",
11
+ margin: "0",
12
+ },
8
13
  Column: AuthColumn,
9
14
  HostBlock: HostBlock,
10
15
  ":host": {
@@ -14,6 +19,7 @@ const style = {
14
19
  NameFieldWrapper: {
15
20
  display: "flex",
16
21
  gap: "var(--sl-spacing-medium)",
22
+ marginBottom: "0 !important",
17
23
  },
18
24
  ContinueButton: { maxWidth: "169px" },
19
25
  ButtonsContainer: AuthButtonsContainer,
@@ -29,6 +35,10 @@ const style = {
29
35
  borderTop: "none",
30
36
  },
31
37
  },
38
+ NameInput: {
39
+ marginBottom: "0",
40
+ width: "50%",
41
+ },
32
42
  ErrorStyle: ErrorStyles,
33
43
  };
34
44
  const vanillaStyle = `
@@ -51,6 +61,7 @@ const styleString = sheet.toString();
51
61
  export function LeadFormView(props) {
52
62
  var _a, _b, _c, _d;
53
63
  const { states, refs, callbacks, content } = props;
64
+ console.log({ states });
54
65
  if (states.error) {
55
66
  window.scrollTo({ top: 0, left: 0, behavior: "smooth" });
56
67
  }
@@ -60,8 +71,8 @@ export function LeadFormView(props) {
60
71
  }, {
61
72
  fieldLabel,
62
73
  });
63
- if (states.success) {
64
- return (h("div", { class: sheet.classes.Wrapper, part: "sqm-base" },
74
+ return (h(Fragment, null,
75
+ states.success && (h("div", { class: sheet.classes.Wrapper, part: "sqm-base" },
65
76
  h("style", { type: "text/css" },
66
77
  vanillaStyle,
67
78
  styleString),
@@ -70,49 +81,44 @@ export function LeadFormView(props) {
70
81
  h("b", null, content.submitSuccessHeader),
71
82
  h("br", null),
72
83
  h("div", { part: "successalert-text" }, content.submitSuccessDescription)),
73
- h("sl-button", {
74
- // AL: TODO add button to allow user to submit another form
75
- class: sheet.classes.ContinueButton,
76
- // onClick={callbacks.submitAnotherForm}
77
- loading: states.loading, exportparts: "base: primarybutton-base", type: "default" }, content.resubmitFormLabel)));
78
- }
79
- return (h("div", { class: sheet.classes.Wrapper, part: "sqm-base" },
80
- h("style", { type: "text/css" },
81
- vanillaStyle,
82
- styleString),
83
- h(TextSpanView, { type: "h3" }, content.pageLabel),
84
- h("sl-form", { class: sheet.classes.Column, "onSl-submit": callbacks.submit, ref: (el) => (refs.formRef.current = el), novalidate: true },
85
- states.error && (h("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: "danger", class: sheet.classes.ErrorAlertContainer, open: true },
86
- h("sl-icon", { slot: "icon", name: "exclamation-octagon" }),
87
- h("b", null, content.submitErrorHeader),
88
- h("br", null),
89
- intl.formatMessage({
90
- id: "submitErrorDescription",
91
- defaultMessage: content.submitErrorDescription,
92
- }, {
93
- supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, content.supportLink)),
94
- }))),
95
- h("div", { class: sheet.classes.NameFieldWrapper },
96
- h("sqm-lead-input-field", { style: { width: "50%" }, "field-label": "First Name", "field-name": "firstName" }),
97
- h("sqm-lead-input-field", { style: { width: "50%" }, "field-label": "Last Name", "field-name": "lastName" })),
98
- h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", type: "email", name: "/email", label: content.emailLabel || "Email", disabled: states.loading, required: true, validationError: ({ value }) => {
99
- if (!value) {
100
- return getRequiredFieldErrorMessage({
101
- fieldLabel: content.emailLabel || "Email",
102
- });
103
- }
104
- // this matches shoelace validation, but could be better
105
- if (!value.includes("@")) {
106
- return content.invalidEmailErrorMessage;
107
- }
108
- } }, (((_b = (_a = states.leadFormState) === null || _a === void 0 ? void 0 : _a.validationErrors) === null || _b === void 0 ? void 0 : _b.email) ? {
109
- class: sheet.classes.ErrorStyle,
110
- helpText: ((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d.email) ||
111
- content.requiredFieldErrorMessage,
112
- }
113
- : []))),
114
- h("input", { type: "hidden", hidden: true, name: "/rsReferralCode", value: states.referralCode }),
115
- content.formData,
116
- h("div", { class: sheet.classes.ButtonsContainer },
117
- h("sl-button", { submit: true, loading: states.loading, exportparts: "base: primarybutton-base", type: "primary" }, content.submitLabel || "Register")))));
84
+ h("sl-button", { class: sheet.classes.ContinueButton, onClick: callbacks.resetForm, loading: states.loading, exportparts: "base: primarybutton-base", type: "default" }, content.resubmitFormLabel))),
85
+ h("div", { class: sheet.classes.Wrapper, part: "sqm-base", style: { display: states.success ? "none" : "block" } },
86
+ h("style", { type: "text/css" },
87
+ vanillaStyle,
88
+ styleString),
89
+ h(TextSpanView, { type: "h3" }, content.pageLabel),
90
+ h("sl-form", { class: sheet.classes.Column, "onSl-submit": callbacks.submit, ref: (el) => (refs.formRef.current = el), novalidate: true },
91
+ states.error && (h("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: "danger", class: sheet.classes.ErrorAlertContainer, open: true },
92
+ h("sl-icon", { slot: "icon", name: "exclamation-octagon" }),
93
+ h("b", null, content.submitErrorHeader),
94
+ h("br", null),
95
+ intl.formatMessage({
96
+ id: "submitErrorDescription",
97
+ defaultMessage: content.submitErrorDescription,
98
+ }, {
99
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, content.supportLinkText)),
100
+ }))),
101
+ h("div", { class: sheet.classes.NameFieldWrapper },
102
+ h("sqm-lead-input-field", { class: sheet.classes.NameInput, "field-label": content.firstNameLabel || "First Name", "field-name": "firstName" }),
103
+ h("sqm-lead-input-field", { class: sheet.classes.NameInput, "field-label": content.lastNameLabel || "Last Name", "field-name": "lastName" })),
104
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", type: "email", name: "/email", label: content.emailLabel || "Email", disabled: states.loading, required: true, validationError: ({ value }) => {
105
+ if (!value) {
106
+ return getRequiredFieldErrorMessage({
107
+ fieldLabel: content.emailLabel || "Email",
108
+ });
109
+ }
110
+ // this matches shoelace validation, but could be better
111
+ if (!value.includes("@")) {
112
+ return content.invalidEmailErrorMessage;
113
+ }
114
+ } }, (((_b = (_a = states.leadFormState) === null || _a === void 0 ? void 0 : _a.validationErrors) === null || _b === void 0 ? void 0 : _b.email) ? {
115
+ class: sheet.classes.ErrorStyle,
116
+ helpText: ((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d.email) ||
117
+ content.requiredFieldErrorMessage,
118
+ }
119
+ : []))),
120
+ h("input", { type: "hidden", hidden: true, name: "/referralCode", value: states.referralCode }),
121
+ content.formData,
122
+ h("div", { class: sheet.classes.ButtonsContainer },
123
+ h("sl-button", { submit: true, loading: states.loading, exportparts: "base: primarybutton-base", type: "primary" }, content.submitLabel || "Register"))))));
118
124
  }
@@ -18,11 +18,11 @@ export class LeadForm {
18
18
  /**
19
19
  * @uiName First Name field label
20
20
  */
21
- this.firstNameLabel = "First Name";
21
+ this.firstNameLabel = "First name";
22
22
  /**
23
23
  * @uiName Last Name field label
24
24
  */
25
- this.lastNameLabel = "Last Name";
25
+ this.lastNameLabel = "Last name";
26
26
  /**
27
27
  * @uiName Submit button text
28
28
  */
@@ -35,43 +35,52 @@ export class LeadForm {
35
35
  * @uiName Header text
36
36
  */
37
37
  this.pageLabel = "Refer your friend";
38
+ /**
39
+ * Key of the form to connect to. Create and manage forms in the /advocate dashboard under Data > Forms.
40
+ * @uiName Form key
41
+ */
38
42
  this.formKey = "lead-form";
39
43
  /**
40
- * Optional support link for error messages.
44
+ * Optional support link text for error messages.
45
+ * @uiName Support link text
41
46
  */
42
- this.supportLink = "Support";
47
+ this.supportLinkText = "Support";
43
48
  /**
44
- * Header text shown on successful submission.
49
+ * Header text shown on successful lead submission.
50
+ * @uiName Submit success header
45
51
  */
46
- this.submitSuccessHeader = "Referral submitted";
52
+ this.submitSuccessHeader = "Lead submitted";
47
53
  /**
48
- * Description text shown on successful submission.
54
+ * Description text shown on successful lead submission.
55
+ * @uiName Submit success description
49
56
  */
50
57
  this.submitSuccessDescription = "Our team will contact your friend to see if they’re a good fit. In the meantime, you can track this referral on Activity page.";
51
58
  /**
52
- * Header text shown when an error occurs.
59
+ * Header text shown if an error occurs.
60
+ * @uiName Submit error header
53
61
  */
54
62
  this.submitErrorHeader = "An error occurred while submitting";
55
63
  /**
56
- * Description text shown when an error occurs.
64
+ * Description text shown if an error occurs.
65
+ * @uiName Submit error description
57
66
  */
58
67
  this.submitErrorDescription = "Please try again later. If the problem continues, contact {supportLink}";
59
68
  /**
60
- * The message to be displayed when a required field is not filled.
69
+ * The message to be displayed if a required field is not filled.
61
70
  *
62
71
  * @uiName Required field message
63
72
  * @uiWidget textArea
64
73
  */
65
74
  this.requiredFieldErrorMessage = "Please enter a valid {fieldLabel}";
66
75
  /**
67
- * The message to be displayed when a the form submission fails unexpectedly.
76
+ * The message to be displayed if a the form submission fails unexpectedly.
68
77
  *
69
78
  * @uiName Network error message
70
79
  * @uiWidget textArea
71
80
  */
72
81
  this.networkErrorMessage = "Network request failed.";
73
82
  /**
74
- * The message to be displayed when the email used is invalid or blocked.
83
+ * The message to be displayed if the email used is invalid.
75
84
  *
76
85
  * @uiName Invalid email message
77
86
  * @uiWidget textArea
@@ -90,13 +99,15 @@ export class LeadForm {
90
99
  submitLabel: this.submitLabel,
91
100
  resubmitFormLabel: this.resubmitFormLabel,
92
101
  pageLabel: this.pageLabel,
93
- supportLink: this.supportLink,
102
+ supportLinkText: this.supportLinkText,
94
103
  submitSuccessHeader: this.submitSuccessHeader,
95
104
  submitSuccessDescription: this.submitSuccessDescription,
96
105
  submitErrorHeader: this.submitErrorHeader,
97
106
  submitErrorDescription: this.submitErrorDescription,
98
107
  invalidEmailErrorMessage: this.invalidEmailErrorMessage,
99
108
  requiredFieldErrorMessage: this.requiredFieldErrorMessage,
109
+ firstNameLabel: this.firstNameLabel,
110
+ lastNameLabel: this.lastNameLabel,
100
111
  };
101
112
  return (h(LeadFormView, { states: states, callbacks: callbacks, content: content, refs: refs }));
102
113
  }
@@ -143,7 +154,7 @@ export class LeadForm {
143
154
  },
144
155
  "attribute": "first-name-label",
145
156
  "reflect": false,
146
- "defaultValue": "\"First Name\""
157
+ "defaultValue": "\"First name\""
147
158
  },
148
159
  "lastNameLabel": {
149
160
  "type": "string",
@@ -164,7 +175,7 @@ export class LeadForm {
164
175
  },
165
176
  "attribute": "last-name-label",
166
177
  "reflect": false,
167
- "defaultValue": "\"Last Name\""
178
+ "defaultValue": "\"Last name\""
168
179
  },
169
180
  "submitLabel": {
170
181
  "type": "string",
@@ -240,14 +251,17 @@ export class LeadForm {
240
251
  "required": false,
241
252
  "optional": false,
242
253
  "docs": {
243
- "tags": [],
244
- "text": ""
254
+ "tags": [{
255
+ "text": "Form key",
256
+ "name": "uiName"
257
+ }],
258
+ "text": "Key of the form to connect to. Create and manage forms in the /advocate dashboard under Data > Forms."
245
259
  },
246
260
  "attribute": "form-key",
247
261
  "reflect": false,
248
262
  "defaultValue": "\"lead-form\""
249
263
  },
250
- "supportLink": {
264
+ "supportLinkText": {
251
265
  "type": "string",
252
266
  "mutable": false,
253
267
  "complexType": {
@@ -258,10 +272,13 @@ export class LeadForm {
258
272
  "required": false,
259
273
  "optional": false,
260
274
  "docs": {
261
- "tags": [],
262
- "text": "Optional support link for error messages."
275
+ "tags": [{
276
+ "text": "Support link text",
277
+ "name": "uiName"
278
+ }],
279
+ "text": "Optional support link text for error messages."
263
280
  },
264
- "attribute": "support-link",
281
+ "attribute": "support-link-text",
265
282
  "reflect": false,
266
283
  "defaultValue": "\"Support\""
267
284
  },
@@ -276,12 +293,15 @@ export class LeadForm {
276
293
  "required": false,
277
294
  "optional": false,
278
295
  "docs": {
279
- "tags": [],
280
- "text": "Header text shown on successful submission."
296
+ "tags": [{
297
+ "text": "Submit success header",
298
+ "name": "uiName"
299
+ }],
300
+ "text": "Header text shown on successful lead submission."
281
301
  },
282
302
  "attribute": "submit-success-header",
283
303
  "reflect": false,
284
- "defaultValue": "\"Referral submitted\""
304
+ "defaultValue": "\"Lead submitted\""
285
305
  },
286
306
  "submitSuccessDescription": {
287
307
  "type": "string",
@@ -294,8 +314,11 @@ export class LeadForm {
294
314
  "required": false,
295
315
  "optional": false,
296
316
  "docs": {
297
- "tags": [],
298
- "text": "Description text shown on successful submission."
317
+ "tags": [{
318
+ "text": "Submit success description",
319
+ "name": "uiName"
320
+ }],
321
+ "text": "Description text shown on successful lead submission."
299
322
  },
300
323
  "attribute": "submit-success-description",
301
324
  "reflect": false,
@@ -312,8 +335,11 @@ export class LeadForm {
312
335
  "required": false,
313
336
  "optional": false,
314
337
  "docs": {
315
- "tags": [],
316
- "text": "Header text shown when an error occurs."
338
+ "tags": [{
339
+ "text": "Submit error header",
340
+ "name": "uiName"
341
+ }],
342
+ "text": "Header text shown if an error occurs."
317
343
  },
318
344
  "attribute": "submit-error-header",
319
345
  "reflect": false,
@@ -330,8 +356,11 @@ export class LeadForm {
330
356
  "required": false,
331
357
  "optional": false,
332
358
  "docs": {
333
- "tags": [],
334
- "text": "Description text shown when an error occurs."
359
+ "tags": [{
360
+ "text": "Submit error description",
361
+ "name": "uiName"
362
+ }],
363
+ "text": "Description text shown if an error occurs."
335
364
  },
336
365
  "attribute": "submit-error-description",
337
366
  "reflect": false,
@@ -355,7 +384,7 @@ export class LeadForm {
355
384
  "text": "textArea",
356
385
  "name": "uiWidget"
357
386
  }],
358
- "text": "The message to be displayed when a required field is not filled."
387
+ "text": "The message to be displayed if a required field is not filled."
359
388
  },
360
389
  "attribute": "required-field-error-message",
361
390
  "reflect": false,
@@ -379,7 +408,7 @@ export class LeadForm {
379
408
  "text": "textArea",
380
409
  "name": "uiWidget"
381
410
  }],
382
- "text": "The message to be displayed when a the form submission fails unexpectedly."
411
+ "text": "The message to be displayed if a the form submission fails unexpectedly."
383
412
  },
384
413
  "attribute": "network-error-message",
385
414
  "reflect": false,
@@ -403,7 +432,7 @@ export class LeadForm {
403
432
  "text": "textArea",
404
433
  "name": "uiWidget"
405
434
  }],
406
- "text": "The message to be displayed when the email used is invalid or blocked."
435
+ "text": "The message to be displayed if the email used is invalid."
407
436
  },
408
437
  "attribute": "invalid-email-error-message",
409
438
  "reflect": false,
@@ -414,7 +443,7 @@ export class LeadForm {
414
443
  "mutable": false,
415
444
  "complexType": {
416
445
  "original": "DemoData<LeadFormViewProps>",
417
- "resolved": "{ states?: { error: string; success: boolean; loading: boolean; leadFormState: LeadFormState; referralCode: string; }; refs?: { formRef: any; }; content?: { formData?: VNode; emailLabel?: string; firstNameLabel?: string; lastNameLabel?: string; submitLabel?: string; resubmitFormLabel?: string; pageLabel?: string; supportLink?: string; submitSuccessHeader?: string; submitSuccessDescription?: string; submitErrorHeader?: string; submitErrorDescription?: string; requiredFieldErrorMessage: string; invalidEmailErrorMessage: string; }; }",
446
+ "resolved": "{ states?: { error: string; success: boolean; loading: boolean; leadFormState: LeadFormState; referralCode: string; }; refs?: { formRef: any; }; content?: { formData?: VNode; emailLabel?: string; firstNameLabel?: string; lastNameLabel?: string; submitLabel?: string; resubmitFormLabel?: string; pageLabel?: string; supportLinkText?: string; submitSuccessHeader?: string; submitSuccessDescription?: string; submitErrorHeader?: string; submitErrorDescription?: string; requiredFieldErrorMessage: string; invalidEmailErrorMessage: string; }; }",
418
447
  "references": {
419
448
  "DemoData": {
420
449
  "location": "import",
@@ -456,6 +485,7 @@ function useRegisterDemo(props) {
456
485
  console.log("submit");
457
486
  },
458
487
  inputFunction: () => { },
488
+ resetForm: () => { },
459
489
  },
460
490
  refs: {
461
491
  formRef: {},
@@ -6,7 +6,7 @@ import { ErrorStyles } from "../../global/mixins";
6
6
  const style = {
7
7
  ErrorStyle: ErrorStyles,
8
8
  FieldContainer: {
9
- "margin-bottom": "var(--sl-spacing-large)",
9
+ "margin-bottom": "var(--sl-spacing-medium)",
10
10
  },
11
11
  };
12
12
  const vanillaStyle = `
@@ -23,24 +23,24 @@ export function LeadInputFieldView(props) {
23
23
  var _a, _b, _c, _d, _e, _f;
24
24
  const { states, content } = props;
25
25
  const getRequiredFieldErrorMessage = ({ fieldLabel, }) => intl.formatMessage({
26
- id: "requiredFieldErrorMessage",
26
+ id: `requiredFieldErrorMessage-${fieldLabel}`,
27
27
  defaultMessage: content.requiredFieldErrorMessage,
28
28
  }, {
29
29
  fieldLabel,
30
30
  });
31
- return (h("div", { part: "sqm-base" },
31
+ return (h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
32
32
  h("style", { type: "text/css" },
33
33
  vanillaStyle,
34
34
  styleString),
35
- h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.fieldName}`, type: content.fieldType, label: content.fieldLabel }, (!content.fieldOptional ? { required: true } : []), { 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 }) => {
36
- if (!value) {
35
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.fieldName}`, type: content.fieldType, label: `${content.fieldLabel}${content.fieldOptional ? ` ${content.optionalLabel}` : ""}` }, (!content.fieldOptional ? { required: true } : []), { 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 }) => {
36
+ if (!value && !content.fieldOptional) {
37
37
  return getRequiredFieldErrorMessage({
38
38
  fieldLabel: content.fieldLabel,
39
39
  });
40
40
  }
41
- } }, (((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d.firstName) ? {
41
+ } }, (((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d[content.fieldName]) ? {
42
42
  class: sheet.classes.ErrorStyle,
43
- helpText: ((_f = (_e = states.leadFormState) === null || _e === void 0 ? void 0 : _e.validationErrors) === null || _f === void 0 ? void 0 : _f.firstName) ||
43
+ helpText: ((_f = (_e = states.leadFormState) === null || _e === void 0 ? void 0 : _e.validationErrors) === null || _f === void 0 ? void 0 : _f[content.fieldName]) ||
44
44
  content.requiredFieldErrorMessage,
45
45
  }
46
46
  : [])))));
@@ -15,6 +15,10 @@ import { useLeadInputField } from "./useLeadInputField";
15
15
  export class LeadInputField {
16
16
  constructor() {
17
17
  this.ignored = true;
18
+ /**
19
+ * @uiName Optional label
20
+ */
21
+ this.optionalLabel = "(optional)";
18
22
  /**
19
23
  * @uiName Input type
20
24
  * @uiType string
@@ -28,7 +32,7 @@ export class LeadInputField {
28
32
  * @uiName Required field message
29
33
  * @uiWidget textArea
30
34
  */
31
- this.requiredFieldErrorMessage = "Please enter a {fieldName}";
35
+ this.requiredFieldErrorMessage = "Please enter a {fieldLabel}";
32
36
  /**
33
37
  * @uiName Optional
34
38
  * @default
@@ -100,6 +104,27 @@ export class LeadInputField {
100
104
  "attribute": "field-label",
101
105
  "reflect": false
102
106
  },
107
+ "optionalLabel": {
108
+ "type": "string",
109
+ "mutable": false,
110
+ "complexType": {
111
+ "original": "string",
112
+ "resolved": "string",
113
+ "references": {}
114
+ },
115
+ "required": false,
116
+ "optional": false,
117
+ "docs": {
118
+ "tags": [{
119
+ "text": "Optional label",
120
+ "name": "uiName"
121
+ }],
122
+ "text": ""
123
+ },
124
+ "attribute": "optional-label",
125
+ "reflect": false,
126
+ "defaultValue": "\"(optional)\""
127
+ },
103
128
  "fieldType": {
104
129
  "type": "string",
105
130
  "mutable": false,
@@ -152,7 +177,7 @@ export class LeadInputField {
152
177
  },
153
178
  "attribute": "required-field-error-message",
154
179
  "reflect": false,
155
- "defaultValue": "\"Please enter a {fieldName}\""
180
+ "defaultValue": "\"Please enter a {fieldLabel}\""
156
181
  },
157
182
  "fieldOptional": {
158
183
  "type": "boolean",
@@ -183,7 +208,7 @@ export class LeadInputField {
183
208
  "mutable": false,
184
209
  "complexType": {
185
210
  "original": "DemoData<LeadInputFieldViewProps>",
186
- "resolved": "{ states?: { leadFormState?: LeadFormState; }; content?: { fieldName: string; fieldLabel: string; fieldType: \"text\" | \"date\" | \"tel\"; fieldOptional?: boolean; requiredFieldErrorMessage: string; }; }",
211
+ "resolved": "{ states?: { leadFormState?: LeadFormState; }; content?: { fieldName: string; fieldLabel: string; optionalLabel: string; fieldType: \"text\" | \"date\" | \"tel\"; fieldOptional?: boolean; requiredFieldErrorMessage: string; }; }",
187
212
  "references": {
188
213
  "DemoData": {
189
214
  "location": "import",
@@ -218,5 +243,11 @@ function useLeadInputFieldDemo(props) {
218
243
  states: {
219
244
  leadForState: {},
220
245
  },
246
+ content: {
247
+ fieldName: props.fieldName,
248
+ fieldLabel: props.fieldLabel,
249
+ fieldType: props.fieldType,
250
+ requiredFieldErrorMessage: props.requiredFieldErrorMessage,
251
+ },
221
252
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
222
253
  }