@saasquatch/mint-components 1.5.3-1 → 1.5.3-2
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.
- package/CHANGELOG.md +18 -1
- package/dist/cjs/{ShadowViewAddon-8665ac96.js → ShadowViewAddon-8de07cc1.js} +3 -11
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/sqm-big-stat_35.cjs.entry.js +85 -59
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +6 -21
- package/dist/collection/components/sqm-checkbox-field/UseCheckboxField.stories.js +1 -1
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field-view.js +1 -1
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +18 -8
- package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field-view.js +1 -1
- package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field.js +18 -8
- package/dist/collection/components/sqm-input-field/InputField.stories.js +1 -8
- package/dist/collection/components/sqm-input-field/UseInputField.stories.js +1 -7
- package/dist/collection/components/sqm-input-field/sqm-input-field-view.js +1 -9
- package/dist/collection/components/sqm-input-field/sqm-input-field.js +22 -12
- package/dist/collection/components/sqm-portal-register/usePortalRegister.js +0 -1
- package/dist/esm/{ShadowViewAddon-ec53d07b.js → ShadowViewAddon-63a40a95.js} +3 -11
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/sqm-big-stat_35.entry.js +87 -61
- package/dist/esm/sqm-stencilbook.entry.js +6 -21
- package/dist/esm-es5/{ShadowViewAddon-ec53d07b.js → ShadowViewAddon-63a40a95.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-big-stat_35.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-436da6b8.system.js +1 -1
- package/dist/mint-components/{p-78aa1b56.js → p-86263d7f.js} +1 -1
- package/dist/mint-components/p-9e34ff81.system.entry.js +1 -0
- package/dist/mint-components/{p-b452e612.system.entry.js → p-aa5474be.system.entry.js} +1 -1
- package/dist/mint-components/{p-36f3c053.system.js → p-d336a610.system.js} +1 -1
- package/dist/mint-components/{p-2839d9c2.entry.js → p-e218474f.entry.js} +10 -10
- package/dist/mint-components/{p-e8c39643.entry.js → p-ff22834a.entry.js} +2 -2
- package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field-view.d.ts +1 -1
- package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field.d.ts +2 -2
- package/dist/types/components/sqm-dropdown-field/sqm-dropdown-field-view.d.ts +1 -1
- package/dist/types/components/sqm-dropdown-field/sqm-dropdown-field.d.ts +2 -2
- package/dist/types/components/sqm-input-field/InputField.stories.d.ts +0 -1
- package/dist/types/components/sqm-input-field/UseInputField.stories.d.ts +0 -6
- package/dist/types/components/sqm-input-field/sqm-input-field-view.d.ts +2 -2
- package/dist/types/components/sqm-input-field/sqm-input-field.d.ts +4 -4
- package/dist/types/components.d.ts +16 -16
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/mint-components/p-54b8a4b9.system.entry.js +0 -1
- package/dist/types/global/android.d.ts +0 -7
- package/dist/types/global/demo.d.ts +0 -1
- package/dist/types/stories/features.d.ts +0 -4
- package/dist/types/stories/templates.d.ts +0 -4
|
@@ -27,7 +27,7 @@ const sqmPortalContainerView = require('./sqm-portal-container-view-2d11ed71.js'
|
|
|
27
27
|
const sqmPortalProfileView = require('./sqm-portal-profile-view-b77382f6.js');
|
|
28
28
|
const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-042073ca.js');
|
|
29
29
|
const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-cb3c9c2f.js');
|
|
30
|
-
const ShadowViewAddon = require('./ShadowViewAddon-
|
|
30
|
+
const ShadowViewAddon = require('./ShadowViewAddon-8de07cc1.js');
|
|
31
31
|
const sqmPortalSectionView = require('./sqm-portal-section-view-765aae4d.js');
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -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:\r\n Given a user is viewing the \"/register\"\r\n And the registration page 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 a checkbox inside of a \"sqm-portal-register\"\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 the user tries 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\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-
|
|
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:\r\n Given a user is viewing the \"/register\"\r\n And the registration page 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 a checkbox inside of a \"sqm-portal-register\"\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 the user tries 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\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 Given a checkbox inside of a \"sqm-portal-register\"\r\n And 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 a checkbox inside of a \"sqm-portal-register\"\r\n And 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 a checkbox inside of a \"sqm-portal-register\"\r\n And 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";
|
|
9897
9897
|
|
|
9898
9898
|
const CheckboxField_stories = {
|
|
9899
9899
|
title: "Components/Checkbox Field",
|
|
@@ -10045,7 +10045,7 @@ const OptionalCheckboxes = createHookStory(() => {
|
|
|
10045
10045
|
setupGraphQL$9();
|
|
10046
10046
|
return (index.h("sqm-portal-register", null,
|
|
10047
10047
|
index.h("sqm-name-fields", { slot: "formData" }),
|
|
10048
|
-
index.h("sqm-checkbox-field", { slot: "formData", "checkbox-label": "I am not a robot", "checkbox-
|
|
10048
|
+
index.h("sqm-checkbox-field", { slot: "formData", "checkbox-label": "I am not a robot", "checkbox-optional": "true", "checkbox-name": "isHuman" }),
|
|
10049
10049
|
index.h("div", { slot: "terms" },
|
|
10050
10050
|
index.h("sqm-checkbox-field", null))));
|
|
10051
10051
|
});
|
|
@@ -10154,7 +10154,7 @@ const UseDropdownField = /*#__PURE__*/Object.freeze({
|
|
|
10154
10154
|
Countries: Countries
|
|
10155
10155
|
});
|
|
10156
10156
|
|
|
10157
|
-
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, a number,\r\n 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
|
|
10157
|
+
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, a number,\r\n 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 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: Number type inputs are supported\r\n Given the input has prop \"field-type\" with value \"number\"\r\n When the user views the input field\r\n And the hover over it\r\n Then they see up and down arrows on the right hand side\r\n When they click the up arrow\r\n Then the number in the input field increments\r\n When they click the down arrow\r\n Then the number in the input field decrements\r\n When they click the input\r\n And try to enter text characters\r\n Then nothing happens\r\n When they click the input field\r\n Then they are able to input numbers\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 <formInput> is recorded in the form data as a string\r\n Examples:\r\n | value | formInput |\r\n | text | Hello there |\r\n | number | 123 |\r\n | date | 05/07/2021 |\r\n | tel | (250) 234-9877 |\r\n\r\n @landmine\r\n Scenario: Input fields without field names appear under \"/undefined\" in the form data\r\n Given the input does not have prop \"field-name\"\r\n When the users enters a value in the input\r\n And they register\r\n Then the value of the input is recorded under \"/undefined\" in the form data";
|
|
10158
10158
|
|
|
10159
10159
|
const InputField_stories = {
|
|
10160
10160
|
title: "Components/Input Field",
|
|
@@ -10170,7 +10170,7 @@ const defaultProps$c = {
|
|
|
10170
10170
|
fieldName: "field",
|
|
10171
10171
|
fieldLabel: "My Custom Input",
|
|
10172
10172
|
fieldType: "text",
|
|
10173
|
-
|
|
10173
|
+
fieldOptional: true,
|
|
10174
10174
|
errorMessage: "Cannot be empty",
|
|
10175
10175
|
},
|
|
10176
10176
|
};
|
|
@@ -10215,13 +10215,6 @@ const DateType = () => {
|
|
|
10215
10215
|
fieldType: "date",
|
|
10216
10216
|
} })));
|
|
10217
10217
|
};
|
|
10218
|
-
const NumberType = () => {
|
|
10219
|
-
return (index.h(ShadowViewAddon.InputFieldView, Object.assign({}, defaultProps$c, { content: {
|
|
10220
|
-
...defaultProps$c.content,
|
|
10221
|
-
fieldLabel: "Number",
|
|
10222
|
-
fieldType: "number",
|
|
10223
|
-
} })));
|
|
10224
|
-
};
|
|
10225
10218
|
const TelType = () => {
|
|
10226
10219
|
return (index.h(ShadowViewAddon.InputFieldView, Object.assign({}, defaultProps$c, { content: {
|
|
10227
10220
|
...defaultProps$c.content,
|
|
@@ -10249,7 +10242,6 @@ const InputField = /*#__PURE__*/Object.freeze({
|
|
|
10249
10242
|
Error: Error$5,
|
|
10250
10243
|
CustomError: CustomError$2,
|
|
10251
10244
|
DateType: DateType,
|
|
10252
|
-
NumberType: NumberType,
|
|
10253
10245
|
TelType: TelType,
|
|
10254
10246
|
RegistrationField: RegistrationField,
|
|
10255
10247
|
RegistrationFieldCustomLabel: RegistrationFieldCustomLabel
|
|
@@ -10307,7 +10299,7 @@ const OptionalInputs = createHookStory(() => {
|
|
|
10307
10299
|
setupGraphQL$b();
|
|
10308
10300
|
return (index.h("sqm-portal-register", null,
|
|
10309
10301
|
index.h("sqm-name-fields", { slot: "formData" }),
|
|
10310
|
-
index.h("sqm-input-field", { slot: "formData", "field-label": "Optional Field", "field-
|
|
10302
|
+
index.h("sqm-input-field", { slot: "formData", "field-label": "Optional Field", "field-optional": "true", "field-name": "optionalField" })));
|
|
10311
10303
|
});
|
|
10312
10304
|
const DateType$1 = createHookStory(() => {
|
|
10313
10305
|
setupGraphQL$b();
|
|
@@ -10315,12 +10307,6 @@ const DateType$1 = createHookStory(() => {
|
|
|
10315
10307
|
index.h("sqm-name-fields", { slot: "formData" }),
|
|
10316
10308
|
index.h("sqm-input-field", { slot: "formData", "field-label": "Date", "field-name": "date", "field-type": "date" })));
|
|
10317
10309
|
});
|
|
10318
|
-
const NumberType$1 = createHookStory(() => {
|
|
10319
|
-
setupGraphQL$b();
|
|
10320
|
-
return (index.h("sqm-portal-register", null,
|
|
10321
|
-
index.h("sqm-name-fields", { slot: "formData" }),
|
|
10322
|
-
index.h("sqm-input-field", { slot: "formData", "field-label": "Number", "field-name": "number", "field-type": "number" })));
|
|
10323
|
-
});
|
|
10324
10310
|
const TelType$1 = createHookStory(() => {
|
|
10325
10311
|
setupGraphQL$b();
|
|
10326
10312
|
return (index.h("sqm-portal-register", null,
|
|
@@ -10336,7 +10322,6 @@ const UseInputField = /*#__PURE__*/Object.freeze({
|
|
|
10336
10322
|
MultipleInputs: MultipleInputs,
|
|
10337
10323
|
OptionalInputs: OptionalInputs,
|
|
10338
10324
|
DateType: DateType$1,
|
|
10339
|
-
NumberType: NumberType$1,
|
|
10340
10325
|
TelType: TelType$1
|
|
10341
10326
|
});
|
|
10342
10327
|
|
|
@@ -56,7 +56,7 @@ export const OptionalCheckboxes = createHookStory(() => {
|
|
|
56
56
|
setupGraphQL();
|
|
57
57
|
return (h("sqm-portal-register", null,
|
|
58
58
|
h("sqm-name-fields", { slot: "formData" }),
|
|
59
|
-
h("sqm-checkbox-field", { slot: "formData", "checkbox-label": "I am not a robot", "checkbox-
|
|
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
61
|
h("sqm-checkbox-field", null))));
|
|
62
62
|
});
|
|
@@ -53,7 +53,7 @@ export function CheckboxFieldView(props) {
|
|
|
53
53
|
h("sl-checkbox", Object.assign({ exportparts: "label: input-label", name: `/${content.checkboxName}`, checked: states.checked, "onSl-change": (e) => {
|
|
54
54
|
e.target.value = e.target.checked;
|
|
55
55
|
callbacks.setChecked(e.target.value);
|
|
56
|
-
} }, (content.
|
|
56
|
+
} }, (!content.checkboxOptional ? { required: true } : []), (!states.checked && (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.checkboxName])
|
|
57
57
|
? {
|
|
58
58
|
class: sheet.classes.ErrorStyle,
|
|
59
59
|
}
|
|
@@ -2,7 +2,8 @@ import { isDemo } from "@saasquatch/component-boilerplate";
|
|
|
2
2
|
import { withHooks } from "@saasquatch/stencil-hooks";
|
|
3
3
|
import { Component, h, Prop, State } from "@stencil/core";
|
|
4
4
|
import deepmerge from "deepmerge";
|
|
5
|
-
import {
|
|
5
|
+
import { RequiredPropsError } from "../../utils/RequiredPropsError";
|
|
6
|
+
import { getMissingProps, getProps } from "../../utils/utils";
|
|
6
7
|
import { CheckboxFieldView, } from "./sqm-checkbox-field-view";
|
|
7
8
|
import { useCheckboxField } from "./useCheckboxField";
|
|
8
9
|
/**
|
|
@@ -29,13 +30,22 @@ export class CheckboxField {
|
|
|
29
30
|
*/
|
|
30
31
|
this.errorMessage = "Must be checked";
|
|
31
32
|
/**
|
|
32
|
-
* @uiName
|
|
33
|
+
* @uiName Optional
|
|
33
34
|
*/
|
|
34
|
-
this.
|
|
35
|
+
this.checkboxOptional = false;
|
|
35
36
|
withHooks(this);
|
|
36
37
|
}
|
|
37
38
|
disconnectedCallback() { }
|
|
38
39
|
render() {
|
|
40
|
+
const missingProps = getMissingProps([
|
|
41
|
+
{
|
|
42
|
+
attribute: "checkbox-name",
|
|
43
|
+
value: this.checkboxName,
|
|
44
|
+
},
|
|
45
|
+
]);
|
|
46
|
+
if (missingProps) {
|
|
47
|
+
return h(RequiredPropsError, { missingProps: missingProps });
|
|
48
|
+
}
|
|
39
49
|
const content = {
|
|
40
50
|
...getProps(this),
|
|
41
51
|
};
|
|
@@ -150,7 +160,7 @@ export class CheckboxField {
|
|
|
150
160
|
"reflect": false,
|
|
151
161
|
"defaultValue": "\"Must be checked\""
|
|
152
162
|
},
|
|
153
|
-
"
|
|
163
|
+
"checkboxOptional": {
|
|
154
164
|
"type": "boolean",
|
|
155
165
|
"mutable": false,
|
|
156
166
|
"complexType": {
|
|
@@ -162,21 +172,21 @@ export class CheckboxField {
|
|
|
162
172
|
"optional": true,
|
|
163
173
|
"docs": {
|
|
164
174
|
"tags": [{
|
|
165
|
-
"text": "
|
|
175
|
+
"text": "Optional",
|
|
166
176
|
"name": "uiName"
|
|
167
177
|
}],
|
|
168
178
|
"text": ""
|
|
169
179
|
},
|
|
170
|
-
"attribute": "checkbox-
|
|
180
|
+
"attribute": "checkbox-optional",
|
|
171
181
|
"reflect": false,
|
|
172
|
-
"defaultValue": "
|
|
182
|
+
"defaultValue": "false"
|
|
173
183
|
},
|
|
174
184
|
"demoData": {
|
|
175
185
|
"type": "unknown",
|
|
176
186
|
"mutable": false,
|
|
177
187
|
"complexType": {
|
|
178
188
|
"original": "DemoData<CheckboxFieldViewProps>",
|
|
179
|
-
"resolved": "{ states?: { validationErrors?: ValidationErrors; checked: boolean; }; content?: { checkboxName: string; checkboxLabel: string; checkboxLabelLink?: string; checkboxLabelLinkText?: string;
|
|
189
|
+
"resolved": "{ states?: { validationErrors?: ValidationErrors; checked: boolean; }; content?: { checkboxName: string; checkboxLabel: string; checkboxLabelLink?: string; checkboxLabelLinkText?: string; checkboxOptional?: boolean; errorMessage: string; }; }",
|
|
180
190
|
"references": {
|
|
181
191
|
"DemoData": {
|
|
182
192
|
"location": "import",
|
|
@@ -38,7 +38,7 @@ export function DropdownFieldView(props) {
|
|
|
38
38
|
h("style", { type: "text/css" },
|
|
39
39
|
vanillaStyle,
|
|
40
40
|
styleString),
|
|
41
|
-
h("sl-select", Object.assign({ exportparts: "label: input-label", label: content.dropdownLabel, name: `/${content.dropdownName}` }, (content.
|
|
41
|
+
h("sl-select", Object.assign({ exportparts: "label: input-label", label: content.dropdownLabel, name: `/${content.dropdownName}` }, (!content.dropdownOptional ? { required: true } : []), ((validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.dropdownName]) ? {
|
|
42
42
|
class: sheet.classes.ErrorStyle,
|
|
43
43
|
}
|
|
44
44
|
: [])), content.selectOptions),
|
|
@@ -2,7 +2,8 @@ import { isDemo } from "@saasquatch/component-boilerplate";
|
|
|
2
2
|
import { withHooks } from "@saasquatch/stencil-hooks";
|
|
3
3
|
import { Component, h, Prop, State } from "@stencil/core";
|
|
4
4
|
import deepmerge from "deepmerge";
|
|
5
|
-
import {
|
|
5
|
+
import { RequiredPropsError } from "../../utils/RequiredPropsError";
|
|
6
|
+
import { getMissingProps, getProps } from "../../utils/utils";
|
|
6
7
|
import { DropdownFieldView, } from "./sqm-dropdown-field-view";
|
|
7
8
|
import { useDropdownField } from "./useDropdownField";
|
|
8
9
|
/**
|
|
@@ -20,13 +21,22 @@ export class DropdownField {
|
|
|
20
21
|
*/
|
|
21
22
|
this.errorMessage = "Select an option";
|
|
22
23
|
/**
|
|
23
|
-
* @uiName
|
|
24
|
+
* @uiName Optional
|
|
24
25
|
*/
|
|
25
|
-
this.
|
|
26
|
+
this.dropdownOptional = false;
|
|
26
27
|
withHooks(this);
|
|
27
28
|
}
|
|
28
29
|
disconnectedCallback() { }
|
|
29
30
|
render() {
|
|
31
|
+
const missingProps = getMissingProps([
|
|
32
|
+
{
|
|
33
|
+
attribute: "dropdown-name",
|
|
34
|
+
value: this.dropdownName,
|
|
35
|
+
},
|
|
36
|
+
]);
|
|
37
|
+
if (missingProps) {
|
|
38
|
+
return h(RequiredPropsError, { missingProps: missingProps });
|
|
39
|
+
}
|
|
30
40
|
const content = {
|
|
31
41
|
...getProps(this),
|
|
32
42
|
selectOptions: h("slot", null),
|
|
@@ -100,7 +110,7 @@ export class DropdownField {
|
|
|
100
110
|
"reflect": false,
|
|
101
111
|
"defaultValue": "\"Select an option\""
|
|
102
112
|
},
|
|
103
|
-
"
|
|
113
|
+
"dropdownOptional": {
|
|
104
114
|
"type": "boolean",
|
|
105
115
|
"mutable": false,
|
|
106
116
|
"complexType": {
|
|
@@ -112,21 +122,21 @@ export class DropdownField {
|
|
|
112
122
|
"optional": true,
|
|
113
123
|
"docs": {
|
|
114
124
|
"tags": [{
|
|
115
|
-
"text": "
|
|
125
|
+
"text": "Optional",
|
|
116
126
|
"name": "uiName"
|
|
117
127
|
}],
|
|
118
128
|
"text": ""
|
|
119
129
|
},
|
|
120
|
-
"attribute": "dropdown-
|
|
130
|
+
"attribute": "dropdown-optional",
|
|
121
131
|
"reflect": false,
|
|
122
|
-
"defaultValue": "
|
|
132
|
+
"defaultValue": "false"
|
|
123
133
|
},
|
|
124
134
|
"demoData": {
|
|
125
135
|
"type": "unknown",
|
|
126
136
|
"mutable": false,
|
|
127
137
|
"complexType": {
|
|
128
138
|
"original": "DemoData<DropdownFieldViewProps>",
|
|
129
|
-
"resolved": "{ states?: { validationErrors?: ValidationErrors; }; content?: { dropdownName: string; dropdownLabel: string;
|
|
139
|
+
"resolved": "{ states?: { validationErrors?: ValidationErrors; }; content?: { dropdownName: string; dropdownLabel: string; dropdownOptional?: boolean; errorMessage: string; selectOptions?: VNode | VNode[]; }; }",
|
|
130
140
|
"references": {
|
|
131
141
|
"DemoData": {
|
|
132
142
|
"location": "import",
|
|
@@ -16,7 +16,7 @@ const defaultProps = {
|
|
|
16
16
|
fieldName: "field",
|
|
17
17
|
fieldLabel: "My Custom Input",
|
|
18
18
|
fieldType: "text",
|
|
19
|
-
|
|
19
|
+
fieldOptional: true,
|
|
20
20
|
errorMessage: "Cannot be empty",
|
|
21
21
|
},
|
|
22
22
|
};
|
|
@@ -61,13 +61,6 @@ export const DateType = () => {
|
|
|
61
61
|
fieldType: "date",
|
|
62
62
|
} })));
|
|
63
63
|
};
|
|
64
|
-
export const NumberType = () => {
|
|
65
|
-
return (h(InputFieldView, Object.assign({}, defaultProps, { content: {
|
|
66
|
-
...defaultProps.content,
|
|
67
|
-
fieldLabel: "Number",
|
|
68
|
-
fieldType: "number",
|
|
69
|
-
} })));
|
|
70
|
-
};
|
|
71
64
|
export const TelType = () => {
|
|
72
65
|
return (h(InputFieldView, Object.assign({}, defaultProps, { content: {
|
|
73
66
|
...defaultProps.content,
|
|
@@ -55,7 +55,7 @@ export const OptionalInputs = createHookStory(() => {
|
|
|
55
55
|
setupGraphQL();
|
|
56
56
|
return (h("sqm-portal-register", null,
|
|
57
57
|
h("sqm-name-fields", { slot: "formData" }),
|
|
58
|
-
h("sqm-input-field", { slot: "formData", "field-label": "Optional Field", "field-
|
|
58
|
+
h("sqm-input-field", { slot: "formData", "field-label": "Optional Field", "field-optional": "true", "field-name": "optionalField" })));
|
|
59
59
|
});
|
|
60
60
|
export const DateType = createHookStory(() => {
|
|
61
61
|
setupGraphQL();
|
|
@@ -63,12 +63,6 @@ export const DateType = createHookStory(() => {
|
|
|
63
63
|
h("sqm-name-fields", { slot: "formData" }),
|
|
64
64
|
h("sqm-input-field", { slot: "formData", "field-label": "Date", "field-name": "date", "field-type": "date" })));
|
|
65
65
|
});
|
|
66
|
-
export const NumberType = createHookStory(() => {
|
|
67
|
-
setupGraphQL();
|
|
68
|
-
return (h("sqm-portal-register", null,
|
|
69
|
-
h("sqm-name-fields", { slot: "formData" }),
|
|
70
|
-
h("sqm-input-field", { slot: "formData", "field-label": "Number", "field-name": "number", "field-type": "number" })));
|
|
71
|
-
});
|
|
72
66
|
export const TelType = createHookStory(() => {
|
|
73
67
|
setupGraphQL();
|
|
74
68
|
return (h("sqm-portal-register", null,
|
|
@@ -14,14 +14,6 @@ const vanillaStyle = `
|
|
|
14
14
|
width: 100%;
|
|
15
15
|
display: block;
|
|
16
16
|
}
|
|
17
|
-
sl-checkbox::part(label){
|
|
18
|
-
font-size: var(--sl-input-label-font-size-small);
|
|
19
|
-
font-weight: var(--sl-font-weight-normal);
|
|
20
|
-
line-height: 20px;
|
|
21
|
-
}
|
|
22
|
-
sl-checkbox::part(base){
|
|
23
|
-
align-items: start;
|
|
24
|
-
}
|
|
25
17
|
`;
|
|
26
18
|
jss.setup(preset());
|
|
27
19
|
const sheet = jss.createStyleSheet(style);
|
|
@@ -33,7 +25,7 @@ export function InputFieldView(props) {
|
|
|
33
25
|
h("style", { type: "text/css" },
|
|
34
26
|
vanillaStyle,
|
|
35
27
|
styleString),
|
|
36
|
-
h("sl-input", Object.assign({ exportparts: "label: input-label", name: `/${content.fieldName}`, type: content.fieldType, label: content.fieldLabel }, (content.
|
|
28
|
+
h("sl-input", Object.assign({ exportparts: "label: input-label", name: `/${content.fieldName}`, type: content.fieldType, label: content.fieldLabel }, (!content.fieldOptional ? { required: true } : []), ((validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.fieldName]) ? {
|
|
37
29
|
class: sheet.classes.ErrorStyle,
|
|
38
30
|
helpText: content.errorMessage || (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.fieldName]),
|
|
39
31
|
}
|
|
@@ -2,7 +2,8 @@ import { isDemo } from "@saasquatch/component-boilerplate";
|
|
|
2
2
|
import { withHooks } from "@saasquatch/stencil-hooks";
|
|
3
3
|
import { Component, h, Prop, State } from "@stencil/core";
|
|
4
4
|
import deepmerge from "deepmerge";
|
|
5
|
-
import {
|
|
5
|
+
import { RequiredPropsError } from "../../utils/RequiredPropsError";
|
|
6
|
+
import { getMissingProps, getProps } from "../../utils/utils";
|
|
6
7
|
import { InputFieldView } from "./sqm-input-field-view";
|
|
7
8
|
import { useInputField } from "./useInputField";
|
|
8
9
|
/**
|
|
@@ -14,7 +15,7 @@ export class InputField {
|
|
|
14
15
|
/**
|
|
15
16
|
* @uiName Input Type
|
|
16
17
|
* @uiType string
|
|
17
|
-
* @uiEnum ["text", "date",
|
|
18
|
+
* @uiEnum ["text", "date", "tel"]
|
|
18
19
|
*/
|
|
19
20
|
this.fieldType = "text";
|
|
20
21
|
/**
|
|
@@ -22,9 +23,9 @@ export class InputField {
|
|
|
22
23
|
*/
|
|
23
24
|
this.errorMessage = "Cannot be empty";
|
|
24
25
|
/**
|
|
25
|
-
* @uiName
|
|
26
|
+
* @uiName Optional
|
|
26
27
|
*/
|
|
27
|
-
this.
|
|
28
|
+
this.fieldOptional = false;
|
|
28
29
|
withHooks(this);
|
|
29
30
|
}
|
|
30
31
|
disconnectedCallback() { }
|
|
@@ -32,6 +33,15 @@ export class InputField {
|
|
|
32
33
|
const content = {
|
|
33
34
|
...getProps(this),
|
|
34
35
|
};
|
|
36
|
+
const missingProps = getMissingProps([
|
|
37
|
+
{
|
|
38
|
+
attribute: "field-name",
|
|
39
|
+
value: this.fieldName,
|
|
40
|
+
},
|
|
41
|
+
]);
|
|
42
|
+
if (missingProps) {
|
|
43
|
+
return h(RequiredPropsError, { missingProps: missingProps });
|
|
44
|
+
}
|
|
35
45
|
const { states } = isDemo() ? useInputFieldDemo(this) : useInputField();
|
|
36
46
|
return h(InputFieldView, { states: states, content: content });
|
|
37
47
|
}
|
|
@@ -81,8 +91,8 @@ export class InputField {
|
|
|
81
91
|
"type": "string",
|
|
82
92
|
"mutable": false,
|
|
83
93
|
"complexType": {
|
|
84
|
-
"original": "\"text\" | \"date\" | \"
|
|
85
|
-
"resolved": "\"date\" | \"
|
|
94
|
+
"original": "\"text\" | \"date\" | \"tel\"",
|
|
95
|
+
"resolved": "\"date\" | \"tel\" | \"text\"",
|
|
86
96
|
"references": {}
|
|
87
97
|
},
|
|
88
98
|
"required": false,
|
|
@@ -95,7 +105,7 @@ export class InputField {
|
|
|
95
105
|
"text": "string",
|
|
96
106
|
"name": "uiType"
|
|
97
107
|
}, {
|
|
98
|
-
"text": "[\"text\", \"date\",
|
|
108
|
+
"text": "[\"text\", \"date\", \"tel\"]",
|
|
99
109
|
"name": "uiEnum"
|
|
100
110
|
}],
|
|
101
111
|
"text": ""
|
|
@@ -125,7 +135,7 @@ export class InputField {
|
|
|
125
135
|
"reflect": false,
|
|
126
136
|
"defaultValue": "\"Cannot be empty\""
|
|
127
137
|
},
|
|
128
|
-
"
|
|
138
|
+
"fieldOptional": {
|
|
129
139
|
"type": "boolean",
|
|
130
140
|
"mutable": false,
|
|
131
141
|
"complexType": {
|
|
@@ -137,21 +147,21 @@ export class InputField {
|
|
|
137
147
|
"optional": true,
|
|
138
148
|
"docs": {
|
|
139
149
|
"tags": [{
|
|
140
|
-
"text": "
|
|
150
|
+
"text": "Optional",
|
|
141
151
|
"name": "uiName"
|
|
142
152
|
}],
|
|
143
153
|
"text": ""
|
|
144
154
|
},
|
|
145
|
-
"attribute": "field-
|
|
155
|
+
"attribute": "field-optional",
|
|
146
156
|
"reflect": false,
|
|
147
|
-
"defaultValue": "
|
|
157
|
+
"defaultValue": "false"
|
|
148
158
|
},
|
|
149
159
|
"demoData": {
|
|
150
160
|
"type": "unknown",
|
|
151
161
|
"mutable": false,
|
|
152
162
|
"complexType": {
|
|
153
163
|
"original": "DemoData<InputFieldViewProps>",
|
|
154
|
-
"resolved": "{ states?: { validationErrors?: ValidationErrors; }; content?: { fieldName: string; fieldLabel: string; fieldType: \"
|
|
164
|
+
"resolved": "{ states?: { validationErrors?: ValidationErrors; }; content?: { fieldName: string; fieldLabel: string; fieldType: \"text\" | \"date\" | \"tel\"; fieldOptional?: boolean; errorMessage: string; }; }",
|
|
155
165
|
"references": {
|
|
156
166
|
"DemoData": {
|
|
157
167
|
"location": "import",
|
|
@@ -2512,7 +2512,7 @@ function CheckboxFieldView(props) {
|
|
|
2512
2512
|
h("sl-checkbox", Object.assign({ exportparts: "label: input-label", name: `/${content.checkboxName}`, checked: states.checked, "onSl-change": (e) => {
|
|
2513
2513
|
e.target.value = e.target.checked;
|
|
2514
2514
|
callbacks.setChecked(e.target.value);
|
|
2515
|
-
} }, (content.
|
|
2515
|
+
} }, (!content.checkboxOptional ? { required: true } : []), (!states.checked && (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.checkboxName])
|
|
2516
2516
|
? {
|
|
2517
2517
|
class: sheet$a.classes.ErrorStyle,
|
|
2518
2518
|
}
|
|
@@ -2563,7 +2563,7 @@ function DropdownFieldView(props) {
|
|
|
2563
2563
|
h("style", { type: "text/css" },
|
|
2564
2564
|
vanillaStyle$5,
|
|
2565
2565
|
styleString$b),
|
|
2566
|
-
h("sl-select", Object.assign({ exportparts: "label: input-label", label: content.dropdownLabel, name: `/${content.dropdownName}` }, (content.
|
|
2566
|
+
h("sl-select", Object.assign({ exportparts: "label: input-label", label: content.dropdownLabel, name: `/${content.dropdownName}` }, (!content.dropdownOptional ? { required: true } : []), ((validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.dropdownName]) ? {
|
|
2567
2567
|
class: sheet$b.classes.ErrorStyle,
|
|
2568
2568
|
}
|
|
2569
2569
|
: [])), content.selectOptions),
|
|
@@ -2582,14 +2582,6 @@ const vanillaStyle$6 = `
|
|
|
2582
2582
|
width: 100%;
|
|
2583
2583
|
display: block;
|
|
2584
2584
|
}
|
|
2585
|
-
sl-checkbox::part(label){
|
|
2586
|
-
font-size: var(--sl-input-label-font-size-small);
|
|
2587
|
-
font-weight: var(--sl-font-weight-normal);
|
|
2588
|
-
line-height: 20px;
|
|
2589
|
-
}
|
|
2590
|
-
sl-checkbox::part(base){
|
|
2591
|
-
align-items: start;
|
|
2592
|
-
}
|
|
2593
2585
|
`;
|
|
2594
2586
|
jss.setup(create());
|
|
2595
2587
|
const sheet$c = jss.createStyleSheet(style$c);
|
|
@@ -2601,7 +2593,7 @@ function InputFieldView(props) {
|
|
|
2601
2593
|
h("style", { type: "text/css" },
|
|
2602
2594
|
vanillaStyle$6,
|
|
2603
2595
|
styleString$c),
|
|
2604
|
-
h("sl-input", Object.assign({ exportparts: "label: input-label", name: `/${content.fieldName}`, type: content.fieldType, label: content.fieldLabel }, (content.
|
|
2596
|
+
h("sl-input", Object.assign({ exportparts: "label: input-label", name: `/${content.fieldName}`, type: content.fieldType, label: content.fieldLabel }, (!content.fieldOptional ? { required: true } : []), ((validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.fieldName]) ? {
|
|
2605
2597
|
class: sheet$c.classes.ErrorStyle,
|
|
2606
2598
|
helpText: content.errorMessage || (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.fieldName]),
|
|
2607
2599
|
}
|