@saasquatch/mint-components 1.5.3-4 → 1.5.3

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 (29) hide show
  1. package/CHANGELOG.md +22 -8
  2. package/dist/cjs/sqm-big-stat_35.cjs.entry.js +24 -16
  3. package/dist/cjs/sqm-stencilbook.cjs.entry.js +4 -4
  4. package/dist/collection/components/sqm-checkbox-field/UseCheckboxField.stories.js +2 -2
  5. package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +4 -1
  6. package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field.js +5 -1
  7. package/dist/collection/components/sqm-input-field/sqm-input-field.js +13 -6
  8. package/dist/collection/components/sqm-name-fields/sqm-name-fields.js +3 -0
  9. package/dist/collection/components/sqm-referral-iframe/sqm-referral-iframe.js +1 -1
  10. package/dist/collection/utils/RequiredPropsError.js +19 -11
  11. package/dist/esm/sqm-big-stat_35.entry.js +24 -16
  12. package/dist/esm/sqm-stencilbook.entry.js +4 -4
  13. package/dist/esm-es5/sqm-big-stat_35.entry.js +1 -1
  14. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  15. package/dist/mint-components/mint-components.esm.js +1 -1
  16. package/dist/mint-components/p-062e1e78.system.entry.js +1 -0
  17. package/dist/mint-components/p-436da6b8.system.js +1 -1
  18. package/dist/mint-components/{p-58704085.entry.js → p-76702646.entry.js} +2 -2
  19. package/dist/mint-components/{p-6e3f8914.system.entry.js → p-8d9b64a3.system.entry.js} +1 -1
  20. package/dist/mint-components/{p-0284a378.entry.js → p-dfad44ee.entry.js} +8 -8
  21. package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field.d.ts +4 -1
  22. package/dist/types/components/sqm-dropdown-field/sqm-dropdown-field.d.ts +4 -1
  23. package/dist/types/components/sqm-input-field/sqm-input-field.d.ts +10 -4
  24. package/dist/types/components/sqm-name-fields/sqm-name-fields.d.ts +4 -1
  25. package/dist/types/components.d.ts +26 -14
  26. package/dist/types/utils/RequiredPropsError.d.ts +4 -1
  27. package/grapesjs/grapesjs.js +1 -1
  28. package/package.json +1 -1
  29. package/dist/mint-components/p-2e4453e2.system.entry.js +0 -1
package/CHANGELOG.md CHANGED
@@ -7,22 +7,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ## [1.5.3] - 2022-03-28
11
-
12
- ### Changed
10
+ ## [1.5.3] - 2022-03-31
13
11
 
12
+ ### Added
14
13
  - Input component added for use in \<sqm-portal-register>
15
-
16
14
  - Added Component:
17
-
18
15
  - \<sqm-input-field>
19
- - Required by default but can be optional
20
- - All text is configurable by props
21
- - Best used in `formData` slot
16
+ - Required by default but can be optional with the `field-optional` prop
17
+ - Field label and error message are configurable by prop
18
+ - Best used in `formData` slot inside \<sqm-portal-register>
22
19
  - Form field name can be customized with the `field-name` prop
20
+ - `field-name` must be a unique string and is submitted as the key to the value submitted
21
+ - For example, with `field-name` set to `businessName` the result is `{"businessName":"SaaSquatch"}`
22
+ - An error is displayed if `field-name` prop is not included
23
23
  - Input type can be customized with the `field-type` prop
24
24
  - Supports `text`, `tel`, and `date` as types
25
25
 
26
+ ### Changed
27
+
28
+ - Changed Components:
29
+ - \<sqm-dropdown-field>
30
+ - An error is now displayed if `dropdown-name` prop is not included
31
+ - `dropdown-required` prop deprecated, must use `dropdown-optional` instead
32
+ - Field is still required by default
33
+ - \<sqm-checkbox-field>
34
+ - Error is now displayed if `checkbox-name` prop is not included
35
+ - `checkbox-required` prop deprecated, must use `checkbox-optional` instead
36
+ - Field is still required by default
37
+ - \<sqm-referral-iframe>
38
+ - Updated fail fast state text
39
+
26
40
  ## [1.5.2] - 2022-03-08
27
41
 
28
42
  ### Changed
@@ -138,34 +138,41 @@ const style = {
138
138
  Heading: {
139
139
  display: "inline-block",
140
140
  },
141
- Alert: {
142
- margin: "28px",
141
+ Children: {
142
+ display: "none",
143
143
  },
144
144
  };
145
145
  const sheet = JSS.createStyleSheet(style);
146
146
  const styleString = sheet.toString();
147
- function RequiredPropsError({ missingProps }) {
147
+ function RequiredPropsError({ missingProps, heading = "There was a problem loading this section", subheading = "There was a technical problem that prevented this section from loading. Please contact us with the link to this page.", description = "Error occured while loading <{tagName}>. Values for the following attributes are missing:", }, children) {
148
148
  if (!missingProps)
149
149
  return false;
150
150
  const host = index_module.P();
151
151
  const [detailsOpen, setDetailsOpen] = stencilHooks_module.useState(false);
152
- return (index.h("sl-alert", { type: "danger", open: true, class: sheet.classes.Alert },
152
+ return (index.h("sl-alert", { type: "danger", open: true },
153
153
  index.h("style", { type: "text/css" }, styleString),
154
154
  index.h("div", { slot: "icon", class: sheet.classes.IconStyle },
155
155
  index.h("sl-icon", { name: "exclamation-octagon" })),
156
156
  index.h("div", { class: sheet.classes.DivStyle },
157
- index.h("h2", { class: sheet.classes.Heading }, "There was a problem loading this section"),
158
- index.h("p", null, "There was a technical problem that prevented this section from loading. Please contact us with the link to this page.")),
157
+ index.h("h2", { class: sheet.classes.Heading }, global.intl.formatMessage({
158
+ id: `error-heading`,
159
+ defaultMessage: heading,
160
+ })),
161
+ index.h("p", null, global.intl.formatMessage({
162
+ id: `error-subheading`,
163
+ defaultMessage: subheading,
164
+ }))),
159
165
  index.h("details", { class: sheet.classes.Details },
160
166
  index.h("summary", { onClick: () => setDetailsOpen(!detailsOpen) },
161
167
  detailsOpen ? "Less" : "More",
162
168
  " details"),
163
- index.h("p", null,
164
- "Error occured while loading ",
165
- `<${host.tagName.toLowerCase()}>`,
166
- ". Values for the following attributes are missing:"),
169
+ index.h("p", null, global.intl.formatMessage({
170
+ id: `error-description`,
171
+ defaultMessage: description,
172
+ }, { tagName: host.tagName.toLowerCase() })),
167
173
  index.h("ul", null, missingProps.map((prop) => (index.h("li", null,
168
- index.h("strong", null, prop.attribute))))))));
174
+ index.h("strong", null, prop.attribute)))))),
175
+ index.h("div", { class: sheet.classes.Children }, children)));
169
176
  }
170
177
 
171
178
  const FORM_VALIDATION_CONTEXT = "sq:validation-state";
@@ -225,7 +232,7 @@ const CheckboxField = class {
225
232
  },
226
233
  ]);
227
234
  if (!index_module.jn() && missingProps) {
228
- return index.h(RequiredPropsError, { missingProps: missingProps });
235
+ return (index.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:" }));
229
236
  }
230
237
  const content = {
231
238
  ...utils.getProps(this),
@@ -351,7 +358,7 @@ const DropdownField = class {
351
358
  },
352
359
  ]);
353
360
  if (!index_module.jn() && missingProps) {
354
- return index.h(RequiredPropsError, { missingProps: missingProps });
361
+ return (index.h(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this drop down field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }, index.h("slot", null)));
355
362
  }
356
363
  const content = {
357
364
  ...utils.getProps(this),
@@ -821,10 +828,11 @@ const InputField = class {
821
828
  * @uiName Input Type
822
829
  * @uiType string
823
830
  * @uiEnum ["text", "date", "tel"]
831
+ * @uiEnumNames ["Text", "Date", "Phone Number"]
824
832
  */
825
833
  this.fieldType = "text";
826
834
  /**
827
- * @uiName Empty error message
835
+ * @uiName Required Error Message
828
836
  */
829
837
  this.errorMessage = "Cannot be empty";
830
838
  /**
@@ -845,7 +853,7 @@ const InputField = class {
845
853
  },
846
854
  ]);
847
855
  if (!index_module.jn() && missingProps) {
848
- return index.h(RequiredPropsError, { missingProps: missingProps });
856
+ return (index.h(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this input field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
849
857
  }
850
858
  const { states } = index_module.jn() ? useInputFieldDemo(this) : useInputField();
851
859
  return index.h(ShadowViewAddon.InputFieldView, { states: states, content: content });
@@ -5840,7 +5848,7 @@ const SqmReferralIframe = class {
5840
5848
  },
5841
5849
  ]);
5842
5850
  if (missingProps) {
5843
- return index.h(RequiredPropsError, { missingProps: missingProps });
5851
+ return (index.h(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this page", subheading: "A technical problem prevented this iframe from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
5844
5852
  }
5845
5853
  const { states, data } = index_module.jn()
5846
5854
  ? useReferralIframeDemo(utils.getProps(this))
@@ -9893,7 +9893,7 @@ const NameFields$1 = /*#__PURE__*/Object.freeze({
9893
9893
  NameFieldsWithErrors: NameFieldsWithErrors
9894
9894
  });
9895
9895
 
9896
- const scenario$i = "@owner:sam\r\n@author:sam\r\nFeature: Checkbox Field\r\n\r\n Field to be used to be used as a checkbox during registration. A motivating use case is to use this component as a terms\r\n and conditions field, to sastisfy legal requirements that a customer might have for their end users.\r\n\r\n Background: A user is on the portal registration page\r\n Given a user is viewing the \"/register\"\r\n And \"/register\" contains the registration form\r\n And the registration form has the following fields\r\n | fields |\r\n | first name |\r\n | last name |\r\n | email |\r\n | password |\r\n | checkbox |\r\n\r\n @motivating\r\n Scenario: Checkbox is required by default\r\n Given the user is filling out the registration form\r\n And the name fields have valid input\r\n And the email field has valid input\r\n And the password field has valid input\r\n And the checkbox is not checked\r\n When they try to register\r\n Then the checkbox is highlighted in red\r\n And the error message says \"Must be checked\"\r\n\r\n @landmine\r\n Scenario: Checkboxes with the same \"checkbox-name\" are not submitted in the form data\r\n Given the register form has the following html\r\n \"\"\"\r\n <sqm-portal-register>\r\n <sqm-name-fields slot=\"formData\"></sqm-name-fields>\r\n <sqm-checkbox-field\r\n slot=\"formData\"\r\n checkbox-label=\"I am not a robot\"\r\n error-message=\"Cannot be a robot\"\r\n checkbox-name=\"isHuman\"\r\n ></sqm-checkbox-field>\r\n <div slot=\"terms\">\r\n <sqm-checkbox-field checkbox-name=\"isHuman\"></sqm-checkbox-field>\r\n </div>\r\n </sqm-portal-register>\r\n \"\"\"\r\n And the checkboxes are checked\r\n When the user tries to register\r\n Then the form is submitted\r\n But no field with key \"isHuman\" is included in the form data\r\n\r\n @motivating\r\n Scenario: Multiple checkboxes need different \"checkbox-name\" values\r\n Given the register form has the following html\r\n \"\"\"\r\n <sqm-portal-register>\r\n <sqm-name-fields slot=\"formData\"></sqm-name-fields>\r\n <sqm-checkbox-field\r\n slot=\"formData\"\r\n checkbox-label=\"I am not a robot\"\r\n error-message=\"Cannot be a robot\"\r\n checkbox-name=\"isHuman\"\r\n ></sqm-checkbox-field>\r\n <div slot=\"terms\">\r\n <sqm-checkbox-field checkbox-name=\"myCheckbox\"></sqm-checkbox-field>\r\n </div>\r\n </sqm-portal-register>\r\n \"\"\"\r\n And the checkboxes are not checked\r\n When the user tries to register\r\n Then both checkboxes are bordered in red\r\n And the checkboxes have different error messages\r\n When the user checks the boxes\r\n And tries to register\r\n Then the form is submitted\r\n And the following fields are included in the form data\r\n | feilds |\r\n | isHuman |\r\n | myCheckbox |\r\n\r\n @motivating\r\n Scenario: Checkboxes can be optional\r\n Given the register form has the following html\r\n \"\"\"\r\n <sqm-portal-register>\r\n <sqm-name-fields slot=\"formData\"></sqm-name-fields>\r\n <sqm-checkbox-field\r\n slot=\"formData\"\r\n checkbox-label=\"I am not a robot\"\r\n checkbox-optional=\"true\"\r\n checkbox-name=\"isHuman\"\r\n />\r\n </sqm-portal-register>\r\n \"\"\"\r\n And the checkbox is not checked\r\n When the user tries to register\r\n Then there is no error for the checkbox\r\n\r\n @minutae\r\n Scenario Outline: Validation error message is configurable\r\n The error message string is evaluated as an ICU string, but currently is provided no context\r\n Given the checkbox is required\r\n And the checkbox has prop \"error-message\" with <propValue>\r\n When the user tries to register\r\n But they havent checked the checkbox\r\n Then they see <errorMessage> below\r\n Examples:\r\n | propValue | errorMessage |\r\n | | Must be checked |\r\n | My Custom Message | My Custom Message |\r\n\r\n @motivating\r\n Scenario Outline: Checkbox text and link are configurable\r\n Given the checkbox has the following prop values\r\n | prop | value |\r\n | checkbox-label | <labelText> |\r\n | checkbox-label-link | <labelLink> |\r\n | checkbox-label-link-text | <labelLinkText> |\r\n When the user views the checkbox\r\n Then they see <text>\r\n And when they click <labelLinkText> they are redirected to <labelLink>\r\n #First example below is the defaults set by the controller\r\n Examples:\r\n | labelText | labelLinkText | labelLink | text |\r\n | By signing up you agree to the {labelLink} | Terms and Conditions | https://example.com | By signing up you agree to the Terms and Conditions |\r\n | Read our {labelLink} before registration | Terms of Service | https://example.com/terms | Read our Terms of Service before registration |\r\n | By registering you agree to our terms and conditions | N/A | N/A | By registering you agree to our terms and conditions |\r\n\r\n @motivating\r\n Scenario: The form field name attribute is configurable\r\n Given the checkbox has prop \"checkbox-name\" with value \"myCheckBox\"\r\n When the user checks the box\r\n And they register\r\n Then the value of the checkbox is submitted under \"myCheckBox\" field\r\n\r\n @minutae\r\n Scenario Outline: The checkbox field component fails fast if a checkbox name isn't provided\r\n Given the checkbox <mayHave> prop \"checkbox-name\"\r\n And it <mayHavePropValue>\r\n When a user views the checkbox\r\n Then an alert with an error message is displayed in place of the checkbox\r\n And it has a details section\r\n When \"More details\" is clicked\r\n Then the following information will be displayed\r\n | component being used |\r\n | missing attribute(s) |\r\n Examples:\r\n | mayBeAnAttribute | mayHavePropValue |\r\n | doesn't have | N/A |\r\n | has | \"\" |\r\n | has | |";
9896
+ const scenario$i = "@owner:sam\r\n@author:sam\r\nFeature: Checkbox Field\r\n\r\n Field to be used to be used as a checkbox during registration. A motivating use case is to use this component as a terms\r\n and conditions field, to sastisfy legal requirements that a customer might have for their end users.\r\n\r\n Background: A user is on the portal registration page\r\n Given a user is viewing the \"/register\"\r\n And \"/register\" contains the registration form\r\n And the registration form has the following fields\r\n | fields |\r\n | first name |\r\n | last name |\r\n | email |\r\n | password |\r\n | checkbox |\r\n\r\n @motivating\r\n Scenario: Checkbox is required by default\r\n Given the user is filling out the registration form\r\n And the name fields have valid input\r\n And the email field has valid input\r\n And the password field has valid input\r\n And the checkbox is not checked\r\n When they try to register\r\n Then the checkbox is highlighted in red\r\n And the error message says \"Must be checked\"\r\n\r\n @landmine\r\n Scenario: Checkboxes with the same \"checkbox-name\" are not submitted in the form data\r\n Given the register form has the following html\r\n \"\"\"\r\n <sqm-portal-register>\r\n <sqm-name-fields slot=\"formData\"></sqm-name-fields>\r\n <sqm-checkbox-field\r\n slot=\"formData\"\r\n checkbox-label=\"I am not a robot\"\r\n error-message=\"Cannot be a robot\"\r\n checkbox-name=\"isHuman\"\r\n ></sqm-checkbox-field>\r\n <div slot=\"terms\">\r\n <sqm-checkbox-field checkbox-name=\"isHuman\"></sqm-checkbox-field>\r\n </div>\r\n </sqm-portal-register>\r\n \"\"\"\r\n And the checkboxes are checked\r\n When the user tries to register\r\n Then the form is submitted\r\n But no field with key \"isHuman\" is included in the form data\r\n\r\n @motivating\r\n Scenario: Multiple checkboxes need different \"checkbox-name\" values\r\n Given the register form has the following html\r\n \"\"\"\r\n <sqm-portal-register>\r\n <sqm-name-fields slot=\"formData\"></sqm-name-fields>\r\n <sqm-checkbox-field\r\n slot=\"formData\"\r\n checkbox-label=\"I am not a robot\"\r\n error-message=\"Cannot be a robot\"\r\n checkbox-name=\"isHuman\"\r\n ></sqm-checkbox-field>\r\n <div slot=\"terms\">\r\n <sqm-checkbox-field checkbox-name=\"myCheckbox\"></sqm-checkbox-field>\r\n </div>\r\n </sqm-portal-register>\r\n \"\"\"\r\n And the checkboxes are not checked\r\n When the user tries to register\r\n Then both checkboxes are bordered in red\r\n And the checkboxes have different error messages\r\n When the user checks the boxes\r\n And tries to register\r\n Then the form is submitted\r\n And the following fields are included in the form data\r\n | feilds |\r\n | isHuman |\r\n | myCheckbox |\r\n\r\n @motivating\r\n Scenario: Checkboxes can be optional\r\n Given the register form has the following html\r\n \"\"\"\r\n <sqm-portal-register>\r\n <sqm-name-fields slot=\"formData\"></sqm-name-fields>\r\n <sqm-checkbox-field\r\n slot=\"formData\"\r\n checkbox-label=\"I am not a robot\"\r\n checkbox-optional=\"true\"\r\n checkbox-name=\"isHuman\"\r\n />\r\n </sqm-portal-register>\r\n \"\"\"\r\n And the checkbox is not checked\r\n When the user tries to register\r\n Then there is no error for the checkbox\r\n\r\n @minutae\r\n Scenario Outline: Validation error message is configurable\r\n The error message string is evaluated as an ICU string, but currently is provided no context\r\n Given the checkbox is required\r\n And the checkbox has prop \"error-message\" with <propValue>\r\n When the user tries to register\r\n But they havent checked the checkbox\r\n Then they see <errorMessage> below\r\n Examples:\r\n | propValue | errorMessage |\r\n | | Must be checked |\r\n | My Custom Message | My Custom Message |\r\n\r\n @motivating\r\n Scenario Outline: Checkbox text and link are configurable\r\n Given the checkbox has the following prop values\r\n | prop | value |\r\n | checkbox-label | <labelText> |\r\n | checkbox-label-link | <labelLink> |\r\n | checkbox-label-link-text | <labelLinkText> |\r\n When the user views the checkbox\r\n Then they see <text>\r\n And when they click <labelLinkText> they are redirected to <labelLink>\r\n #First example below is the defaults set by the controller\r\n Examples:\r\n | labelText | labelLinkText | labelLink | text |\r\n | By signing up you agree to the {labelLink} | Terms and Conditions | https://example.com | By signing up you agree to the Terms and Conditions |\r\n | Read our {labelLink} before registration | Terms of Service | https://example.com/terms | Read our Terms of Service before registration |\r\n | By registering you agree to our terms and conditions | N/A | N/A | By registering you agree to our terms and conditions |\r\n\r\n @motivating\r\n Scenario: The form field name attribute is configurable\r\n Given the checkbox has prop \"checkbox-name\" with value \"myCheckBox\"\r\n When the user checks the box\r\n And they register\r\n Then the boolean value of the checkbox is submitted under \"myCheckBox\" field\r\n\r\n @minutae\r\n Scenario Outline: The checkbox field component fails fast if a checkbox name isn't provided\r\n Given the checkbox <mayHave> prop \"checkbox-name\"\r\n And it <mayHavePropValue>\r\n When a user views the checkbox\r\n Then an alert with an error message is displayed in place of the checkbox\r\n And it has a details section\r\n When \"More details\" is clicked\r\n Then the following information is displayed\r\n | information |\r\n | component being used |\r\n | missing attribute(s) |\r\n Examples:\r\n | mayBeAnAttribute | mayHavePropValue |\r\n | doesn't have | N/A |\r\n | has | \"\" |\r\n | has | |";
9897
9897
 
9898
9898
  const CheckboxField_stories = {
9899
9899
  title: "Components/Checkbox Field",
@@ -10042,7 +10042,7 @@ const MultipleCheckboxes = createHookStory(() => {
10042
10042
  index.h("sqm-name-fields", { slot: "formData" }),
10043
10043
  index.h("sqm-checkbox-field", { slot: "formData", "checkbox-label": "I am not a robot", "error-message": "Cannot be a robot", "checkbox-name": "isHuman" }),
10044
10044
  index.h("div", { slot: "terms" },
10045
- index.h("sqm-checkbox-field", null))));
10045
+ index.h("sqm-checkbox-field", { "checkbox-name": "otherCheckbox" }))));
10046
10046
  });
10047
10047
  const OptionalCheckboxes = createHookStory(() => {
10048
10048
  setupGraphQL$9();
@@ -10050,7 +10050,7 @@ const OptionalCheckboxes = createHookStory(() => {
10050
10050
  index.h("sqm-name-fields", { slot: "formData" }),
10051
10051
  index.h("sqm-checkbox-field", { slot: "formData", "checkbox-label": "I am not a robot", "checkbox-optional": "true", "checkbox-name": "isHuman" }),
10052
10052
  index.h("div", { slot: "terms" },
10053
- index.h("sqm-checkbox-field", null))));
10053
+ index.h("sqm-checkbox-field", { "checkbox-name": "required" }))));
10054
10054
  });
10055
10055
  const MissingName = createHookStory(() => {
10056
10056
  setupGraphQL$9();
@@ -10173,7 +10173,7 @@ const UseDropdownField = /*#__PURE__*/Object.freeze({
10173
10173
  MissingName: MissingName$1
10174
10174
  });
10175
10175
 
10176
- const scenario$j = "@author:derek\r\n@owner:derek\r\nFeature: Form Input Field\r\n\r\n This component is used as a custom registration field during registration. The field can be text,\r\n a date or phone number. A motivating use case is to ask for a users company name, this value would then be mapped\r\n through the Managed Identity Service and upserted on the user after registration.\r\n\r\n Background: A user exists and is viewing the hosted portal registration\r\n Given a user is viewing \"/register\"\r\n And \"/register\" contains the registration form\r\n And the registration form has a custom input field\r\n\r\n @motivating\r\n Scenario Outline: Input fields are required by default but can be optional\r\n Given the input has prop \"field-optional\" with <value>\r\n And the input is empty\r\n When the user tries to register\r\n Then the input <mayBe> highlighted in red\r\n And an error message <mayAppear> in red below\r\n And form submission <mayBe> blocked\r\n Examples:\r\n | value | mayBe | mayAppear |\r\n | false | is | appears |\r\n | | is | appears |\r\n | true | isn't | doesn't appear |\r\n\r\n @motivating\r\n Scenario: Input field labels are configurable\r\n Given the input has prop \"field-label\" with value \"My Custom Input\"\r\n When the user views the registration form\r\n Then they see the input field\r\n And it has label \"My Custom Input\" above the input\r\n\r\n @minutae\r\n Scenario Outline: The validation error message is configurable\r\n The error message string is evaluated as an ICU string, but currently is provided no context\r\n Given the input is required\r\n And it has prop \"error-message\" with <value>\r\n When the user tries to register\r\n But they haven't filled in the input\r\n Then they see <errorMessage> below\r\n Examples:\r\n | value | errorMessage |\r\n | | Cannot be empty |\r\n | My Custom Message | My Custom Message |\r\n\r\n @motivating\r\n Scenario: Form data attribute name is configurable\r\n Given the input has prop \"field-name\" with value \"myCustomField\"\r\n When the user types \"testing testing\" into the input\r\n And they register\r\n Then \"testing testing\" is submitted under \"myCustomField\" in the form data\r\n\r\n @motivating\r\n Scenario Outline: The input field is a text input by default\r\n Given the input <mayHave> prop \"field-type\" with <value>\r\n When the user views the input field\r\n Then it is a text input\r\n Examples:\r\n | mayHave | value |\r\n | has | text |\r\n | doesn't have | |\r\n\r\n @motivating\r\n Scenario: Date type inputs are supported\r\n Given the input has prop \"field-type\" \"date\"\r\n When the user views the input field\r\n Then they see \"mm/dd/yyyy\" as a placeholder\r\n And they see a calendar icon on the right\r\n When they start typing a date\r\n Then it maintains the \"mm/dd/yyyy\" format\r\n When they click the calendar icon\r\n Then a dropdown appears\r\n And they see a calendar\r\n When they select a date\r\n Then it is applied to the input\r\n\r\n @motivating\r\n Scenario: Phone number type inputs are supported\r\n Given the input has prop \"field-type\" with value \"tel\"\r\n When the user starts typing a phone number in the input\r\n Then it is formatted into the following form \"(XXX) XXX-XXXX\"\r\n When they pre-fix their phone number with a \"1\"\r\n Then it is formatted into the following form \"1 (XXX) XXX-XXXX\"\r\n\r\n @landmine\r\n Scenario: Telephone formatting is removed after 10 numbers\r\n Given a user using a phone number input field\r\n And they entered their 10 character phone number\r\n And it was not prefixed with a 1\r\n When they add another character\r\n Then the formatting is removed\r\n\r\n @landmine\r\n Scenario Outline: Input values are always recorded as strings in the form data\r\n Given the input has prop \"field-type\" with <value>\r\n And it has a \"field-name\"\r\n When the user inputs <formInput>\r\n And they register\r\n Then <formData> is recorded in the form data as a string\r\n Examples:\r\n | value | formInput | formData |\r\n | text | Hello there | Hello there |\r\n | date | 05/07/2021 | 2021-05-07 |\r\n | tel | (250) 234-9877 | (250) 234-9877 |\r\n\r\n @minutae\r\n Scenario Outline: The input field component fails fast if a field name isn't provided\r\n Given the input <mayHave> prop \"field-name\"\r\n And it <mayHavePropValue>\r\n When a user views the input\r\n Then an alert with an error message is displayed in place of the input\r\n And it has a details section\r\n When \"More details\" is clicked\r\n Then the following information will be displayed\r\n | component being used |\r\n | missing attribute(s) |\r\n Examples:\r\n | mayBeAnAttribute | mayHavePropValue |\r\n | doesn't have | N/A |\r\n | has | \"\" |\r\n | has | |";
10176
+ const scenario$j = "@author:derek\r\n@owner:derek\r\nFeature: Form Input Field\r\n\r\n This component is used as a custom registration field during registration. The field can be text,\r\n a date or phone number. A motivating use case is to ask for a users company name, this value would then be mapped\r\n through the Managed Identity Service and upserted on the user after registration.\r\n\r\n Background: A user exists and is viewing the hosted portal registration\r\n Given a user is viewing \"/register\"\r\n And \"/register\" contains the registration form\r\n And the registration form has a custom input field\r\n\r\n @motivating\r\n Scenario Outline: Input fields are required by default but can be optional\r\n Given the input has prop \"field-optional\" with <value>\r\n And the input is empty\r\n When the user tries to register\r\n Then the input <mayBe> highlighted in red\r\n And an error message <mayAppear> in red below\r\n And form submission <mayBe> blocked\r\n Examples:\r\n | value | mayBe | mayAppear |\r\n | false | is | appears |\r\n | | is | appears |\r\n | true | isn't | doesn't appear |\r\n\r\n @motivating\r\n Scenario: Input field labels are configurable\r\n Given the input has prop \"field-label\" with value \"My Custom Input\"\r\n When the user views the registration form\r\n Then they see the input field\r\n And it has label \"My Custom Input\" above the input\r\n\r\n @minutae\r\n Scenario Outline: The validation error message is configurable\r\n The error message string is evaluated as an ICU string, but currently is provided no context\r\n Given the input is required\r\n And it has prop \"error-message\" with <value>\r\n When the user tries to register\r\n But they haven't filled in the input\r\n Then they see <errorMessage> below\r\n Examples:\r\n | value | errorMessage |\r\n | | Cannot be empty |\r\n | My Custom Message | My Custom Message |\r\n\r\n @motivating\r\n Scenario: Form data attribute name is configurable\r\n Given the input has prop \"field-name\" with value \"myCustomField\"\r\n When the user types \"testing testing\" into the input\r\n And they register\r\n Then \"testing testing\" is submitted under \"myCustomField\" in the form data\r\n\r\n @motivating\r\n Scenario Outline: The input field is a text input by default\r\n Given the input <mayHave> prop \"field-type\" with <value>\r\n When the user views the input field\r\n Then it is a text input\r\n Examples:\r\n | mayHave | value |\r\n | has | text |\r\n | doesn't have | |\r\n\r\n @motivating\r\n Scenario: Date type inputs are supported\r\n Given the input has prop \"field-type\" \"date\"\r\n When the user views the input field\r\n Then they see \"mm/dd/yyyy\" as a placeholder\r\n And they see a calendar icon on the right\r\n When they start typing a date\r\n Then it maintains the \"mm/dd/yyyy\" format\r\n When they click the calendar icon\r\n Then a dropdown appears\r\n And they see a calendar\r\n When they select a date\r\n Then it is applied to the input\r\n\r\n @landmine\r\n Scenario: The clear text button in the date picker does not clear the date\r\n Due to an incompatibility between our shoelace version and the browser, the clear funtionality is not supported currently\r\n Given the input has prop \"field-type\" \"date\"\r\n And the user has entered a date\r\n When they click the calendar icon\r\n And click the 'clear' text button\r\n Then their selected date is not cleared\r\n\r\n @motivating\r\n Scenario: Phone number type inputs are supported\r\n Given the input has prop \"field-type\" with value \"tel\"\r\n When the user starts typing a phone number in the input\r\n Then it is formatted into the following form \"(XXX) XXX-XXXX\"\r\n When they pre-fix their phone number with a \"1\"\r\n Then it is formatted into the following form \"1 (XXX) XXX-XXXX\"\r\n\r\n @landmine\r\n Scenario: Telephone formatting is removed after 10 numbers\r\n Given a user using a phone number input field\r\n And they entered their 10 character phone number\r\n And it was not prefixed with a 1\r\n When they add another character\r\n Then the formatting is removed\r\n\r\n @landmine\r\n Scenario Outline: Input values are always recorded as strings in the form data\r\n Given the input has prop \"field-type\" with <value>\r\n And it has a \"field-name\"\r\n When the user inputs <formInput>\r\n And they register\r\n Then <formData> is recorded in the form data as a string\r\n Examples:\r\n | value | formInput | formData |\r\n | text | Hello there | Hello there |\r\n | date | 05/07/2021 | 2021-05-07 |\r\n | tel | (250) 234-9877 | (250) 234-9877 |\r\n\r\n @minutae\r\n Scenario Outline: The input field component fails fast if a field name isn't provided\r\n Given the input <mayHave> prop \"field-name\"\r\n And it <mayHavePropValue>\r\n When a user views the input\r\n Then an alert with an error message is displayed in place of the input\r\n And it has a details section\r\n When \"More details\" is clicked\r\n Then the following information is displayed\r\n | information |\r\n | component being used |\r\n | missing attribute(s) |\r\n Examples:\r\n | mayBeAnAttribute | mayHavePropValue |\r\n | doesn't have | N/A |\r\n | has | \"\" |\r\n | has | |";
10177
10177
 
10178
10178
  const InputField_stories = {
10179
10179
  title: "Components/Input Field",
@@ -50,7 +50,7 @@ export const MultipleCheckboxes = createHookStory(() => {
50
50
  h("sqm-name-fields", { slot: "formData" }),
51
51
  h("sqm-checkbox-field", { slot: "formData", "checkbox-label": "I am not a robot", "error-message": "Cannot be a robot", "checkbox-name": "isHuman" }),
52
52
  h("div", { slot: "terms" },
53
- h("sqm-checkbox-field", null))));
53
+ h("sqm-checkbox-field", { "checkbox-name": "otherCheckbox" }))));
54
54
  });
55
55
  export const OptionalCheckboxes = createHookStory(() => {
56
56
  setupGraphQL();
@@ -58,7 +58,7 @@ export const OptionalCheckboxes = createHookStory(() => {
58
58
  h("sqm-name-fields", { slot: "formData" }),
59
59
  h("sqm-checkbox-field", { slot: "formData", "checkbox-label": "I am not a robot", "checkbox-optional": "true", "checkbox-name": "isHuman" }),
60
60
  h("div", { slot: "terms" },
61
- h("sqm-checkbox-field", null))));
61
+ h("sqm-checkbox-field", { "checkbox-name": "required" }))));
62
62
  });
63
63
  export const MissingName = createHookStory(() => {
64
64
  setupGraphQL();
@@ -44,7 +44,7 @@ export class CheckboxField {
44
44
  },
45
45
  ]);
46
46
  if (!isDemo() && missingProps) {
47
- return h(RequiredPropsError, { missingProps: missingProps });
47
+ 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:" }));
48
48
  }
49
49
  const content = {
50
50
  ...getProps(this),
@@ -204,6 +204,9 @@ export class CheckboxField {
204
204
  "tags": [{
205
205
  "text": undefined,
206
206
  "name": "undocumented"
207
+ }, {
208
+ "text": "object",
209
+ "name": "uiType"
207
210
  }],
208
211
  "text": ""
209
212
  }
@@ -35,7 +35,8 @@ export class DropdownField {
35
35
  },
36
36
  ]);
37
37
  if (!isDemo() && missingProps) {
38
- return h(RequiredPropsError, { missingProps: missingProps });
38
+ return (h(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this drop down field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" },
39
+ h("slot", null)));
39
40
  }
40
41
  const content = {
41
42
  ...getProps(this),
@@ -154,6 +155,9 @@ export class DropdownField {
154
155
  "tags": [{
155
156
  "text": undefined,
156
157
  "name": "undocumented"
158
+ }, {
159
+ "text": "object",
160
+ "name": "uiType"
157
161
  }],
158
162
  "text": ""
159
163
  }
@@ -16,10 +16,11 @@ export class InputField {
16
16
  * @uiName Input Type
17
17
  * @uiType string
18
18
  * @uiEnum ["text", "date", "tel"]
19
+ * @uiEnumNames ["Text", "Date", "Phone Number"]
19
20
  */
20
21
  this.fieldType = "text";
21
22
  /**
22
- * @uiName Empty error message
23
+ * @uiName Required Error Message
23
24
  */
24
25
  this.errorMessage = "Cannot be empty";
25
26
  /**
@@ -40,7 +41,7 @@ export class InputField {
40
41
  },
41
42
  ]);
42
43
  if (!isDemo() && missingProps) {
43
- return h(RequiredPropsError, { missingProps: missingProps });
44
+ return (h(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this input field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
44
45
  }
45
46
  const { states } = isDemo() ? useInputFieldDemo(this) : useInputField();
46
47
  return h(InputFieldView, { states: states, content: content });
@@ -59,10 +60,10 @@ export class InputField {
59
60
  "optional": false,
60
61
  "docs": {
61
62
  "tags": [{
62
- "text": "Input name attribute",
63
+ "text": "Input Name Attribute",
63
64
  "name": "uiName"
64
65
  }],
65
- "text": ""
66
+ "text": "Used as the key of the inputs value in form data."
66
67
  },
67
68
  "attribute": "field-name",
68
69
  "reflect": false
@@ -79,7 +80,7 @@ export class InputField {
79
80
  "optional": false,
80
81
  "docs": {
81
82
  "tags": [{
82
- "text": "Input label",
83
+ "text": "Input Label",
83
84
  "name": "uiName"
84
85
  }],
85
86
  "text": ""
@@ -107,6 +108,9 @@ export class InputField {
107
108
  }, {
108
109
  "text": "[\"text\", \"date\", \"tel\"]",
109
110
  "name": "uiEnum"
111
+ }, {
112
+ "text": "[\"Text\", \"Date\", \"Phone Number\"]",
113
+ "name": "uiEnumNames"
110
114
  }],
111
115
  "text": ""
112
116
  },
@@ -126,7 +130,7 @@ export class InputField {
126
130
  "optional": false,
127
131
  "docs": {
128
132
  "tags": [{
129
- "text": "Empty error message",
133
+ "text": "Required Error Message",
130
134
  "name": "uiName"
131
135
  }],
132
136
  "text": ""
@@ -179,6 +183,9 @@ export class InputField {
179
183
  "tags": [{
180
184
  "text": undefined,
181
185
  "name": "undocumented"
186
+ }, {
187
+ "text": "object",
188
+ "name": "uiType"
182
189
  }],
183
190
  "text": ""
184
191
  }
@@ -92,6 +92,9 @@ export class NameFields {
92
92
  "tags": [{
93
93
  "text": undefined,
94
94
  "name": "undocumented"
95
+ }, {
96
+ "text": "object",
97
+ "name": "uiType"
95
98
  }],
96
99
  "text": ""
97
100
  }
@@ -31,7 +31,7 @@ export class SqmReferralIframe {
31
31
  },
32
32
  ]);
33
33
  if (missingProps) {
34
- return h(RequiredPropsError, { missingProps: missingProps });
34
+ return (h(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this page", subheading: "A technical problem prevented this iframe from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
35
35
  }
36
36
  const { states, data } = isDemo()
37
37
  ? useReferralIframeDemo(getProps(this))
@@ -1,6 +1,7 @@
1
1
  import { useHost } from "@saasquatch/component-boilerplate";
2
2
  import { useState } from "@saasquatch/universal-hooks";
3
3
  import { h } from "@stencil/core";
4
+ import { intl } from "../global/global";
4
5
  import { createStyleSheet } from "../styling/JSS";
5
6
  const style = {
6
7
  IconStyle: {
@@ -17,32 +18,39 @@ const style = {
17
18
  Heading: {
18
19
  display: "inline-block",
19
20
  },
20
- Alert: {
21
- margin: "28px",
21
+ Children: {
22
+ display: "none",
22
23
  },
23
24
  };
24
25
  const sheet = createStyleSheet(style);
25
26
  const styleString = sheet.toString();
26
- export function RequiredPropsError({ missingProps }) {
27
+ export function RequiredPropsError({ missingProps, heading = "There was a problem loading this section", subheading = "There was a technical problem that prevented this section from loading. Please contact us with the link to this page.", description = "Error occured while loading <{tagName}>. Values for the following attributes are missing:", }, children) {
27
28
  if (!missingProps)
28
29
  return false;
29
30
  const host = useHost();
30
31
  const [detailsOpen, setDetailsOpen] = useState(false);
31
- return (h("sl-alert", { type: "danger", open: true, class: sheet.classes.Alert },
32
+ return (h("sl-alert", { type: "danger", open: true },
32
33
  h("style", { type: "text/css" }, styleString),
33
34
  h("div", { slot: "icon", class: sheet.classes.IconStyle },
34
35
  h("sl-icon", { name: "exclamation-octagon" })),
35
36
  h("div", { class: sheet.classes.DivStyle },
36
- h("h2", { class: sheet.classes.Heading }, "There was a problem loading this section"),
37
- h("p", null, "There was a technical problem that prevented this section from loading. Please contact us with the link to this page.")),
37
+ h("h2", { class: sheet.classes.Heading }, intl.formatMessage({
38
+ id: `error-heading`,
39
+ defaultMessage: heading,
40
+ })),
41
+ h("p", null, intl.formatMessage({
42
+ id: `error-subheading`,
43
+ defaultMessage: subheading,
44
+ }))),
38
45
  h("details", { class: sheet.classes.Details },
39
46
  h("summary", { onClick: () => setDetailsOpen(!detailsOpen) },
40
47
  detailsOpen ? "Less" : "More",
41
48
  " details"),
42
- h("p", null,
43
- "Error occured while loading ",
44
- `<${host.tagName.toLowerCase()}>`,
45
- ". Values for the following attributes are missing:"),
49
+ h("p", null, intl.formatMessage({
50
+ id: `error-description`,
51
+ defaultMessage: description,
52
+ }, { tagName: host.tagName.toLowerCase() })),
46
53
  h("ul", null, missingProps.map((prop) => (h("li", null,
47
- h("strong", null, prop.attribute))))))));
54
+ h("strong", null, prop.attribute)))))),
55
+ h("div", { class: sheet.classes.Children }, children)));
48
56
  }
@@ -134,34 +134,41 @@ const style = {
134
134
  Heading: {
135
135
  display: "inline-block",
136
136
  },
137
- Alert: {
138
- margin: "28px",
137
+ Children: {
138
+ display: "none",
139
139
  },
140
140
  };
141
141
  const sheet = createStyleSheet(style);
142
142
  const styleString = sheet.toString();
143
- function RequiredPropsError({ missingProps }) {
143
+ function RequiredPropsError({ missingProps, heading = "There was a problem loading this section", subheading = "There was a technical problem that prevented this section from loading. Please contact us with the link to this page.", description = "Error occured while loading <{tagName}>. Values for the following attributes are missing:", }, children) {
144
144
  if (!missingProps)
145
145
  return false;
146
146
  const host = P();
147
147
  const [detailsOpen, setDetailsOpen] = useState(false);
148
- return (h$1("sl-alert", { type: "danger", open: true, class: sheet.classes.Alert },
148
+ return (h$1("sl-alert", { type: "danger", open: true },
149
149
  h$1("style", { type: "text/css" }, styleString),
150
150
  h$1("div", { slot: "icon", class: sheet.classes.IconStyle },
151
151
  h$1("sl-icon", { name: "exclamation-octagon" })),
152
152
  h$1("div", { class: sheet.classes.DivStyle },
153
- h$1("h2", { class: sheet.classes.Heading }, "There was a problem loading this section"),
154
- h$1("p", null, "There was a technical problem that prevented this section from loading. Please contact us with the link to this page.")),
153
+ h$1("h2", { class: sheet.classes.Heading }, intl.formatMessage({
154
+ id: `error-heading`,
155
+ defaultMessage: heading,
156
+ })),
157
+ h$1("p", null, intl.formatMessage({
158
+ id: `error-subheading`,
159
+ defaultMessage: subheading,
160
+ }))),
155
161
  h$1("details", { class: sheet.classes.Details },
156
162
  h$1("summary", { onClick: () => setDetailsOpen(!detailsOpen) },
157
163
  detailsOpen ? "Less" : "More",
158
164
  " details"),
159
- h$1("p", null,
160
- "Error occured while loading ",
161
- `<${host.tagName.toLowerCase()}>`,
162
- ". Values for the following attributes are missing:"),
165
+ h$1("p", null, intl.formatMessage({
166
+ id: `error-description`,
167
+ defaultMessage: description,
168
+ }, { tagName: host.tagName.toLowerCase() })),
163
169
  h$1("ul", null, missingProps.map((prop) => (h$1("li", null,
164
- h$1("strong", null, prop.attribute))))))));
170
+ h$1("strong", null, prop.attribute)))))),
171
+ h$1("div", { class: sheet.classes.Children }, children)));
165
172
  }
166
173
 
167
174
  const FORM_VALIDATION_CONTEXT = "sq:validation-state";
@@ -221,7 +228,7 @@ const CheckboxField = class {
221
228
  },
222
229
  ]);
223
230
  if (!jn() && missingProps) {
224
- return h$1(RequiredPropsError, { missingProps: missingProps });
231
+ 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:" }));
225
232
  }
226
233
  const content = {
227
234
  ...getProps(this),
@@ -347,7 +354,7 @@ const DropdownField = class {
347
354
  },
348
355
  ]);
349
356
  if (!jn() && missingProps) {
350
- return h$1(RequiredPropsError, { missingProps: missingProps });
357
+ return (h$1(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this drop down field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }, h$1("slot", null)));
351
358
  }
352
359
  const content = {
353
360
  ...getProps(this),
@@ -817,10 +824,11 @@ const InputField = class {
817
824
  * @uiName Input Type
818
825
  * @uiType string
819
826
  * @uiEnum ["text", "date", "tel"]
827
+ * @uiEnumNames ["Text", "Date", "Phone Number"]
820
828
  */
821
829
  this.fieldType = "text";
822
830
  /**
823
- * @uiName Empty error message
831
+ * @uiName Required Error Message
824
832
  */
825
833
  this.errorMessage = "Cannot be empty";
826
834
  /**
@@ -841,7 +849,7 @@ const InputField = class {
841
849
  },
842
850
  ]);
843
851
  if (!jn() && missingProps) {
844
- return h$1(RequiredPropsError, { missingProps: missingProps });
852
+ return (h$1(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this input field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
845
853
  }
846
854
  const { states } = jn() ? useInputFieldDemo(this) : useInputField();
847
855
  return h$1(InputFieldView, { states: states, content: content });
@@ -5836,7 +5844,7 @@ const SqmReferralIframe = class {
5836
5844
  },
5837
5845
  ]);
5838
5846
  if (missingProps) {
5839
- return h$1(RequiredPropsError, { missingProps: missingProps });
5847
+ return (h$1(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this page", subheading: "A technical problem prevented this iframe from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
5840
5848
  }
5841
5849
  const { states, data } = jn()
5842
5850
  ? useReferralIframeDemo(getProps(this))