@saasquatch/mint-components 1.14.7-5 → 1.14.7-6
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/dist/cjs/sqm-lead-checkbox-field-view-00116edf.js +84 -0
- package/dist/cjs/sqm-lead-checkbox-field.cjs.entry.js +4 -81
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +65 -2
- package/dist/collection/components/sqm-lead-form/LeadCheckboxField.stories.js +5 -55
- package/dist/collection/components/sqm-lead-form/sqm-lead-checkbox-field-view.js +0 -1
- package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +2 -0
- package/dist/esm/sqm-lead-checkbox-field-view-f2d478ad.js +82 -0
- package/dist/esm/sqm-lead-checkbox-field.entry.js +8 -85
- package/dist/esm/sqm-stencilbook.entry.js +65 -2
- package/dist/esm-es5/sqm-lead-checkbox-field-view-f2d478ad.js +1 -0
- package/dist/esm-es5/sqm-lead-checkbox-field.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-09f5f6d1.system.js +1 -0
- package/dist/mint-components/{p-f60d1ae9.entry.js → p-11de051f.entry.js} +2 -2
- package/dist/mint-components/p-1780910e.entry.js +1 -0
- package/dist/mint-components/p-37996351.system.js +1 -1
- package/dist/mint-components/p-6cb95e3c.js +1 -0
- package/dist/mint-components/p-87499562.system.entry.js +1 -0
- package/dist/mint-components/p-89926dbf.system.entry.js +1 -0
- package/dist/types/components/sqm-lead-form/LeadCheckboxField.stories.d.ts +0 -21
- package/docs/docs.docx +0 -0
- package/package.json +1 -1
- package/dist/mint-components/p-75eea63f.entry.js +0 -1
- package/dist/mint-components/p-81fbca73.system.entry.js +0 -1
- package/dist/mint-components/p-eaf1a8a6.system.entry.js +0 -1
|
@@ -16,6 +16,7 @@ import { A as AssetCardView } from './sqm-asset-card-view-fe5db3c0.js';
|
|
|
16
16
|
import { C as CloseButtonView } from './sqm-close-button-view-f9819751.js';
|
|
17
17
|
import './index-ffa26b43.js';
|
|
18
18
|
import { E as EmailRegistrationView } from './email-registration-view-a7818cf2.js';
|
|
19
|
+
import { L as LeadCheckboxFieldView } from './sqm-lead-checkbox-field-view-f2d478ad.js';
|
|
19
20
|
import { L as LeaderboardRankView } from './sqm-leaderboard-rank-view-753c8d4a.js';
|
|
20
21
|
import { L as LogoutCurrentUserView } from './sqm-logout-current-user-view-8ef8180f.js';
|
|
21
22
|
import { N as NavigationSidebarView } from './sqm-navigation-sidebar-view-9d802b78.js';
|
|
@@ -16060,6 +16061,67 @@ const LeadFormDropdownField = /*#__PURE__*/Object.freeze({
|
|
|
16060
16061
|
WithInitialValue: WithInitialValue$1
|
|
16061
16062
|
});
|
|
16062
16063
|
|
|
16064
|
+
const LeadCheckboxField_stories = {
|
|
16065
|
+
title: "Components/Lead Checkbox Field",
|
|
16066
|
+
};
|
|
16067
|
+
const defaultProps$w = {
|
|
16068
|
+
states: {
|
|
16069
|
+
leadFormState: {
|
|
16070
|
+
validationErrors: {},
|
|
16071
|
+
},
|
|
16072
|
+
checked: false,
|
|
16073
|
+
},
|
|
16074
|
+
content: {
|
|
16075
|
+
checkboxName: "terms",
|
|
16076
|
+
checkboxLabel: "By signing up you agree to the {labelLink}",
|
|
16077
|
+
checkboxLabelLink: "https://example.com",
|
|
16078
|
+
checkboxLabelLinkText: "Terms and Conditions",
|
|
16079
|
+
errorMessage: "{checkboxLabel} Must be checked",
|
|
16080
|
+
},
|
|
16081
|
+
callbacks: {
|
|
16082
|
+
setChecked: () => { },
|
|
16083
|
+
},
|
|
16084
|
+
};
|
|
16085
|
+
const Default$u = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps$w))));
|
|
16086
|
+
const DefaultChecked$1 = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps$w, { states: {
|
|
16087
|
+
...defaultProps$w.states,
|
|
16088
|
+
checked: true,
|
|
16089
|
+
} }))));
|
|
16090
|
+
const CustomLabel$3 = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps$w, { content: {
|
|
16091
|
+
...defaultProps$w.content,
|
|
16092
|
+
checkboxLabel: "I Agree",
|
|
16093
|
+
} }))));
|
|
16094
|
+
const Error$d = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps$w, { states: {
|
|
16095
|
+
...defaultProps$w.states,
|
|
16096
|
+
leadFormState: {
|
|
16097
|
+
validationErrors: {
|
|
16098
|
+
terms: "{checkboxLabel} Must be checked",
|
|
16099
|
+
},
|
|
16100
|
+
},
|
|
16101
|
+
} }))));
|
|
16102
|
+
const CustomError$3 = createHookStory(() => (h(LeadCheckboxFieldView, Object.assign({}, defaultProps$w, { states: {
|
|
16103
|
+
...defaultProps$w.states,
|
|
16104
|
+
checked: true,
|
|
16105
|
+
leadFormState: {
|
|
16106
|
+
validationErrors: {
|
|
16107
|
+
terms: "{checkboxLabel} Must be checked",
|
|
16108
|
+
},
|
|
16109
|
+
},
|
|
16110
|
+
}, content: {
|
|
16111
|
+
...defaultProps$w.content,
|
|
16112
|
+
errorMessage: "This checkbox must be checked to continue",
|
|
16113
|
+
} }))));
|
|
16114
|
+
|
|
16115
|
+
const LeadCheckboxField = /*#__PURE__*/Object.freeze({
|
|
16116
|
+
__proto__: null,
|
|
16117
|
+
'default': LeadCheckboxField_stories,
|
|
16118
|
+
Default: Default$u,
|
|
16119
|
+
DefaultChecked: DefaultChecked$1,
|
|
16120
|
+
CustomLabel: CustomLabel$3,
|
|
16121
|
+
Error: Error$d,
|
|
16122
|
+
CustomError: CustomError$3
|
|
16123
|
+
});
|
|
16124
|
+
|
|
16063
16125
|
/**
|
|
16064
16126
|
*
|
|
16065
16127
|
* Themes
|
|
@@ -16072,7 +16134,7 @@ const LeadFormDropdownField = /*#__PURE__*/Object.freeze({
|
|
|
16072
16134
|
*
|
|
16073
16135
|
*/
|
|
16074
16136
|
//
|
|
16075
|
-
const Default$
|
|
16137
|
+
const Default$v = `
|
|
16076
16138
|
// No CSS
|
|
16077
16139
|
`;
|
|
16078
16140
|
const Orangey = `
|
|
@@ -16106,7 +16168,7 @@ const Klip = `
|
|
|
16106
16168
|
|
|
16107
16169
|
const Themes = /*#__PURE__*/Object.freeze({
|
|
16108
16170
|
__proto__: null,
|
|
16109
|
-
Default: Default$
|
|
16171
|
+
Default: Default$v,
|
|
16110
16172
|
Orangey: Orangey,
|
|
16111
16173
|
Netflix: Netflix,
|
|
16112
16174
|
SaaSquatchCorporate: SaaSquatchCorporate,
|
|
@@ -18800,6 +18862,7 @@ const stories = [
|
|
|
18800
18862
|
LeadForm,
|
|
18801
18863
|
LeadInputField,
|
|
18802
18864
|
LeadFormDropdownField,
|
|
18865
|
+
LeadCheckboxField,
|
|
18803
18866
|
];
|
|
18804
18867
|
const StencilStorybook = class {
|
|
18805
18868
|
constructor(hostRef) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h}from"./index-91e7729f.js";import{i as intl}from"./global-be1f9992.js";import{j as jss,a as create}from"./JSS-67b5cff8.js";var style={ErrorStyle:{"&::part(control)":{borderColor:"var(--sl-color-danger-500)",outline:"var(--sl-color-danger-500)"},"&:host":{"--focus-ring":"0 0 0 var(--sl-focus-ring-width) red !important"}},ErrorMessageStyle:{margin:0,marginTop:"5px",color:"var(--sl-color-danger-500)",fontSize:"var(--sl-input-help-text-font-size-medium)",fontFamily:"var(--sl-font-sans)",fontWeight:"var(--sl-font-weight-normal)"},FieldContainer:{"margin-bottom":"var(--sl-spacing-large)"}};var vanillaStyle="\n:host {\n margin: 0 auto;\n width: 100%;\n display: block;\n}\nsl-checkbox::part(label){\n font-size: var(--sl-input-label-font-size-small);\n font-weight: var(--sl-font-weight-normal);\n line-height: 20px;\n}\nsl-checkbox::part(base){\n align-items: start;\n}\n";jss.setup(create());var sheet=jss.createStyleSheet(style);var styleString=sheet.toString();function LeadCheckboxFieldView(e){var a,l,t,r,o;var s=e.states,n=e.content,i=e.callbacks;var c=(a=s===null||s===void 0?void 0:s.leadFormState)===null||a===void 0?void 0:a.validationErrors;var d=function(e){var a=e.checkboxLabel;return intl.formatMessage({id:"requiredFieldErrorMessage-"+a,defaultMessage:n.errorMessage},{checkboxLabel:a})};return h("div",{class:sheet.classes.FieldContainer,part:"sqm-base"},h("style",{type:"text/css"},vanillaStyle,styleString),h("sl-checkbox",Object.assign({exportparts:"label: input-label, base: input-base",name:"/"+n.checkboxName,checked:s.checked,"onSl-change":function(e){e.target.value=e.target.checked;i.setChecked(e.target.value)}},!n.checkboxOptional?{required:false}:[],{disabled:((l=s.leadFormState)===null||l===void 0?void 0:l.loading)||((t=s.leadFormState)===null||t===void 0?void 0:t.disabled),validationError:function(e){var a=e.value;if(!a&&!n.checkboxOptional){return d({checkboxLabel:n.checkboxLabel})}}},((o=(r=s.leadFormState)===null||r===void 0?void 0:r.validationErrors)===null||o===void 0?void 0:o[n.checkboxName])?{class:sheet.classes.ErrorStyle}:[]),intl.formatMessage({id:n.checkboxName+"-message",defaultMessage:n.checkboxLabel},{labelLink:h("a",{href:n.checkboxLabelLink,target:"_blank"},n.checkboxLabelLinkText||n.checkboxLabelLink)})),(c===null||c===void 0?void 0:c[n.checkboxName])&&h("p",{class:sheet.classes.ErrorMessageStyle},d({checkboxLabel:n.checkboxLabel})))}export{LeadCheckboxFieldView as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var
|
|
1
|
+
var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var i,s=1,t=arguments.length;s<t;s++){i=arguments[s];for(var a in i)if(Object.prototype.hasOwnProperty.call(i,a))e[a]=i[a]}return e};return __assign.apply(this,arguments)};import{r as registerInstance,h as h$1}from"./index-91e7729f.js";import{i as d,k as useState,f as useEffect,n as h}from"./stencil-hooks.module-4bc38af4.js";import"./global-be1f9992.js";import{i as isDemo}from"./index.module-89a79f66.js";import{c as cjs}from"./cjs-bdfb4486.js";import{a as getMissingProps,g as getProps}from"./utils-334c1e34.js";import"./JSS-67b5cff8.js";import{L as LEAD_FORM_STATE_CONTEXT,R as RequiredPropsError}from"./useLeadFormState-9016d812.js";import{L as LeadCheckboxFieldView}from"./sqm-lead-checkbox-field-view-f2d478ad.js";function useLeadCheckboxField(e){var i;var s=d(LEAD_FORM_STATE_CONTEXT);var t=useState(false),a=t[0],o=t[1];useEffect((function(){var i,t;if((i=s===null||s===void 0?void 0:s.initialData)===null||i===void 0?void 0:i[e.checkboxName]){o(!!((t=s===null||s===void 0?void 0:s.initialData)===null||t===void 0?void 0:t[e.checkboxName]))}}),[(i=s===null||s===void 0?void 0:s.initialData)===null||i===void 0?void 0:i[e.checkboxName]]);return{states:{leadFormState:s,checked:a},callbacks:{setChecked:o}}}var LeadCheckboxField=function(){function e(e){registerInstance(this,e);this.ignored=true;this.checkboxLabel="By signing up you agree to the {labelLink}";this.checkboxLabelLink="https://example.com";this.checkboxLabelLinkText="Terms and Conditions";this.errorMessage="{checkboxLabel} must be checked";this.checkboxOptional=false;h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){var e=getMissingProps([{attribute:"checkbox-name",value:this.checkboxName}]);if(!isDemo()&&e){return h$1(RequiredPropsError,{missingProps:e,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:"})}var i=__assign({},getProps(this));var s=isDemo()?useLeadCheckboxFieldDemo(this):useLeadCheckboxField(this),t=s.states,a=s.callbacks;return h$1(LeadCheckboxFieldView,{states:t,content:i,callbacks:a})};return e}();function useLeadCheckboxFieldDemo(e){return cjs({states:{registrationFormState:{},checked:false},callbacks:{setChecked:function(){}}},e.demoData||{},{arrayMerge:function(e,i){return i}})}export{LeadCheckboxField as sqm_lead_checkbox_field};
|