@saasquatch/mint-components 1.5.1-1 → 1.5.1
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 -6
- package/dist/cjs/{ShadowViewAddon-16dae1bc.js → ShadowViewAddon-8151e5d3.js} +2 -1
- 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 → sqm-big-stat_34.cjs.entry.js} +43 -164
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +7 -107
- package/dist/collection/collection-manifest.json +0 -1
- package/dist/collection/components/sqm-checkbox-field/CheckboxField.stories.js +1 -1
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field-view.js +2 -1
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +1 -1
- package/dist/collection/components/sqm-checkbox-field/useCheckboxField.js +2 -2
- package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field.js +3 -3
- package/dist/collection/components/sqm-dropdown-field/useDropdownField.js +2 -2
- package/dist/collection/components/sqm-name-fields/sqm-name-fields.js +1 -1
- package/dist/collection/components/sqm-name-fields/useNameFields.js +2 -2
- package/dist/collection/components/sqm-portal-register/sqm-portal-register.js +1 -1
- package/dist/collection/components/sqm-portal-register/useValidationState.js +2 -2
- package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +0 -2
- package/dist/esm/{ShadowViewAddon-3908b50d.js → ShadowViewAddon-e42c07c6.js} +2 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/{sqm-big-stat_35.entry.js → sqm-big-stat_34.entry.js} +47 -167
- package/dist/esm/sqm-stencilbook.entry.js +7 -107
- package/dist/esm-es5/{ShadowViewAddon-3908b50d.js → ShadowViewAddon-e42c07c6.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_34.entry.js +1 -0
- 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-fc6c07a7.entry.js → p-23259e4c.entry.js} +12 -21
- package/dist/mint-components/p-436da6b8.system.js +1 -1
- package/dist/mint-components/{p-268d0240.js → p-55358561.js} +1 -1
- package/dist/mint-components/{p-9d83a0b3.system.entry.js → p-5bc9f6f4.system.entry.js} +1 -1
- package/dist/mint-components/{p-c648f983.system.js → p-6c9bd397.system.js} +1 -1
- package/dist/mint-components/{p-aa6292e7.entry.js → p-6cb9eed6.entry.js} +2 -2
- package/dist/mint-components/p-b2770bdb.system.entry.js +1 -0
- package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field-view.d.ts +2 -1
- package/dist/types/components/sqm-checkbox-field/useCheckboxField.d.ts +1 -5
- package/dist/types/components/sqm-dropdown-field/sqm-dropdown-field-view.d.ts +2 -1
- package/dist/types/components/sqm-dropdown-field/useDropdownField.d.ts +1 -5
- package/dist/types/components/sqm-name-fields/sqm-name-fields-view.d.ts +2 -1
- package/dist/types/components/sqm-name-fields/useNameFields.d.ts +1 -5
- package/dist/types/components/sqm-portal-register/useValidationState.d.ts +1 -0
- package/dist/types/components.d.ts +0 -62
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/collection/components/sqm-country-field/UseCountryField.stories.js +0 -91
- package/dist/collection/components/sqm-country-field/sqm-country-field-view.js +0 -47
- package/dist/collection/components/sqm-country-field/sqm-country-field.js +0 -197
- package/dist/collection/components/sqm-country-field/useCountryField.js +0 -23
- package/dist/esm-es5/sqm-big-stat_35.entry.js +0 -1
- package/dist/mint-components/p-29e6a994.system.entry.js +0 -1
- package/dist/types/components/sqm-country-field/UseCountryField.stories.d.ts +0 -40
- package/dist/types/components/sqm-country-field/sqm-country-field-view.d.ts +0 -18
- package/dist/types/components/sqm-country-field/sqm-country-field.d.ts +0 -33
- package/dist/types/components/sqm-country-field/useCountryField.d.ts +0 -10
package/package.json
CHANGED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { setUserIdentity } from "@saasquatch/component-boilerplate";
|
|
2
|
-
import { useEffect } from "@saasquatch/universal-hooks";
|
|
3
|
-
import { h } from "@stencil/core";
|
|
4
|
-
import { createHookStory } from "../sqm-stencilbook/HookStoryAddon";
|
|
5
|
-
export default {
|
|
6
|
-
title: "Hooks / useCountryField",
|
|
7
|
-
};
|
|
8
|
-
function setupGraphQL({ token, id }) {
|
|
9
|
-
const accountId = id;
|
|
10
|
-
//@ts-ignore
|
|
11
|
-
window.widgetIdent = {
|
|
12
|
-
tenantAlias: "test_a74miwdpofztj",
|
|
13
|
-
appDomain: "https://staging.referralsaasquatch.com",
|
|
14
|
-
};
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
setUserIdentity({
|
|
17
|
-
accountId,
|
|
18
|
-
id,
|
|
19
|
-
jwt: token,
|
|
20
|
-
});
|
|
21
|
-
return () => {
|
|
22
|
-
window.widgetIdent = undefined;
|
|
23
|
-
setUserIdentity(undefined);
|
|
24
|
-
};
|
|
25
|
-
}, []);
|
|
26
|
-
return { id, accountId };
|
|
27
|
-
}
|
|
28
|
-
export const Default = createHookStory(() => {
|
|
29
|
-
setupGraphQL({
|
|
30
|
-
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoibm9sb2NhbGUiLCJhY2NvdW50SWQiOiJub2xvY2FsZSJ9fQ.ACri_gO_eIdNfh3ifMmbbDp7gZz3yjT_8mfiQ96T-BY",
|
|
31
|
-
id: "nolocale",
|
|
32
|
-
});
|
|
33
|
-
return (h("sqm-portal-register", null,
|
|
34
|
-
h("sqm-country-field", { slot: "formData" })));
|
|
35
|
-
});
|
|
36
|
-
export const English = createHookStory(() => {
|
|
37
|
-
setupGraphQL({
|
|
38
|
-
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImFjY291bnRJZCI6InNhbWVuZ2xpc2giLCJpZCI6InNhbWVuZ2xpc2gifX0._6OTVF3gcipu_ibgthUNr5UHwC-2E_lhCENI5HpYvcw",
|
|
39
|
-
id: "samenglish",
|
|
40
|
-
});
|
|
41
|
-
return (h("sqm-portal-register", null,
|
|
42
|
-
h("sqm-country-field", { slot: "formData" })));
|
|
43
|
-
});
|
|
44
|
-
export const French = createHookStory(() => {
|
|
45
|
-
setupGraphQL({
|
|
46
|
-
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImFjY291bnRJZCI6InNhbWZyZW5jaCIsImlkIjoic2FtZnJlbmNoIn19.cwhasHpfU5MLV4vGbCQcazb6p19iSw5pD2zyrVHgePg",
|
|
47
|
-
id: "samfrench",
|
|
48
|
-
});
|
|
49
|
-
return (h("sqm-portal-register", null,
|
|
50
|
-
h("sqm-country-field", { slot: "formData" })));
|
|
51
|
-
});
|
|
52
|
-
export const Turkish = createHookStory(() => {
|
|
53
|
-
setupGraphQL({
|
|
54
|
-
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImFjY291bnRJZCI6InNhbXR1cmtleSIsImlkIjoic2FtdHVya2V5In19.usSMe0RWg8W5FtwcvJayvAlxTw6vMxjTyWXaP8jI8_U",
|
|
55
|
-
id: "samturkey",
|
|
56
|
-
});
|
|
57
|
-
return (h("sqm-portal-register", null,
|
|
58
|
-
h("sqm-country-field", { slot: "formData" })));
|
|
59
|
-
});
|
|
60
|
-
export const NoUser = createHookStory(() => {
|
|
61
|
-
//@ts-ignore
|
|
62
|
-
window.widgetIdent = {
|
|
63
|
-
tenantAlias: "test_a74miwdpofztj",
|
|
64
|
-
appDomain: "https://staging.referralsaasquatch.com",
|
|
65
|
-
};
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
setUserIdentity(undefined);
|
|
68
|
-
return () => {
|
|
69
|
-
window.widgetIdent = undefined;
|
|
70
|
-
setUserIdentity(undefined);
|
|
71
|
-
};
|
|
72
|
-
}, []);
|
|
73
|
-
return (h("sqm-portal-register", null,
|
|
74
|
-
h("sqm-country-field", { slot: "formData" })));
|
|
75
|
-
});
|
|
76
|
-
export const NoUserFrench = createHookStory(() => {
|
|
77
|
-
//@ts-ignore
|
|
78
|
-
window.widgetIdent = {
|
|
79
|
-
tenantAlias: "test_a74miwdpofztj",
|
|
80
|
-
appDomain: "https://staging.referralsaasquatch.com",
|
|
81
|
-
};
|
|
82
|
-
useEffect(() => {
|
|
83
|
-
setUserIdentity(undefined);
|
|
84
|
-
return () => {
|
|
85
|
-
window.widgetIdent = undefined;
|
|
86
|
-
setUserIdentity(undefined);
|
|
87
|
-
};
|
|
88
|
-
}, []);
|
|
89
|
-
return (h("sqm-portal-register", null,
|
|
90
|
-
h("sqm-country-field", { slot: "formData", locale: "fr" })));
|
|
91
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { h } from "@stencil/core";
|
|
2
|
-
import jss from "jss";
|
|
3
|
-
import preset from "jss-preset-default";
|
|
4
|
-
const style = {
|
|
5
|
-
ErrorStyle: {
|
|
6
|
-
"--sl-input-border-color": "var(--sl-color-danger-500)",
|
|
7
|
-
"--sl-input-background-color": "var(--sl-color-danger-10)",
|
|
8
|
-
"--sl-input-border-color-focus": "var(--sl-color-danger-500)",
|
|
9
|
-
"--sl-input-border-color-hover": "var(--sl-color-danger-500)",
|
|
10
|
-
},
|
|
11
|
-
ErrorMessageStyle: {
|
|
12
|
-
margin: 0,
|
|
13
|
-
color: "var(--sl-color-danger-500)",
|
|
14
|
-
fontSize: "var(--sl-input-help-text-font-size-medium)",
|
|
15
|
-
},
|
|
16
|
-
FieldContainer: {
|
|
17
|
-
"margin-bottom": "var(--sl-spacing-large)",
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
const vanillaStyle = `
|
|
21
|
-
:host {
|
|
22
|
-
margin: 0 auto;
|
|
23
|
-
width: 100%;
|
|
24
|
-
display: block;
|
|
25
|
-
}
|
|
26
|
-
sl-select::part(label){
|
|
27
|
-
font-size: var(--sl-input-label-font-size-small);
|
|
28
|
-
font-weight: var(--sl-font-weight-semibold);
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
jss.setup(preset());
|
|
32
|
-
const sheet = jss.createStyleSheet(style);
|
|
33
|
-
const styleString = sheet.toString();
|
|
34
|
-
export function CountryFieldView(props) {
|
|
35
|
-
var _a;
|
|
36
|
-
const { states, content, data } = props;
|
|
37
|
-
const validationErrors = states === null || states === void 0 ? void 0 : states.validationErrors;
|
|
38
|
-
return (h("div", { class: sheet.classes.FieldContainer },
|
|
39
|
-
h("style", { type: "text/css" },
|
|
40
|
-
vanillaStyle,
|
|
41
|
-
styleString),
|
|
42
|
-
h("sl-select", Object.assign({ exportparts: "label: input-label", label: content.dropdownLabel, name: `/${content.dropdownName}` }, (content.dropdownRequired ? { required: true } : []), ((validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.dropdownName]) ? {
|
|
43
|
-
class: sheet.classes.ErrorStyle,
|
|
44
|
-
}
|
|
45
|
-
: [])), (_a = data.countries) === null || _a === void 0 ? void 0 : _a.map((country) => (h("sl-menu-item", { value: country.displayName }, country.displayName)))),
|
|
46
|
-
(validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.dropdownName]) && (h("p", { class: sheet.classes.ErrorMessageStyle }, content.errorMessage))));
|
|
47
|
-
}
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { isDemo } from "@saasquatch/component-boilerplate";
|
|
2
|
-
import { withHooks } from "@saasquatch/stencil-hooks";
|
|
3
|
-
import { Component, h, Prop, State } from "@stencil/core";
|
|
4
|
-
import deepmerge from "deepmerge";
|
|
5
|
-
import { getProps } from "../../utils/utils";
|
|
6
|
-
import { useDropdownField } from "../sqm-dropdown-field/useDropdownField";
|
|
7
|
-
import { CountryFieldView, } from "./sqm-country-field-view";
|
|
8
|
-
import { useCountryField } from "./useCountryField";
|
|
9
|
-
/**
|
|
10
|
-
* @uiName Country Field
|
|
11
|
-
*/
|
|
12
|
-
export class CountryField {
|
|
13
|
-
constructor() {
|
|
14
|
-
this.ignored = true;
|
|
15
|
-
/**
|
|
16
|
-
* @uiName Country name attribute
|
|
17
|
-
*/
|
|
18
|
-
this.dropdownName = "countryCode";
|
|
19
|
-
/**
|
|
20
|
-
* @uiName Country Dropdown label
|
|
21
|
-
*/
|
|
22
|
-
this.dropdownLabel = "Country";
|
|
23
|
-
/**
|
|
24
|
-
* @uiName Unselected error message
|
|
25
|
-
*/
|
|
26
|
-
this.errorMessage = "Must select a country";
|
|
27
|
-
/**
|
|
28
|
-
* @uiName Required
|
|
29
|
-
*/
|
|
30
|
-
this.dropdownRequired = true;
|
|
31
|
-
/**
|
|
32
|
-
* @uiName Country name locale override
|
|
33
|
-
*/
|
|
34
|
-
this.locale = null;
|
|
35
|
-
withHooks(this);
|
|
36
|
-
}
|
|
37
|
-
disconnectedCallback() { }
|
|
38
|
-
render() {
|
|
39
|
-
const content = {
|
|
40
|
-
...getProps(this),
|
|
41
|
-
selectOptions: h("slot", null),
|
|
42
|
-
};
|
|
43
|
-
const { states } = useDropdownField();
|
|
44
|
-
const { data } = isDemo()
|
|
45
|
-
? useCountryFieldDemo(this)
|
|
46
|
-
: useCountryField(this);
|
|
47
|
-
return (h(CountryFieldView, { states: states, content: content, data: data }));
|
|
48
|
-
}
|
|
49
|
-
static get is() { return "sqm-country-field"; }
|
|
50
|
-
static get properties() { return {
|
|
51
|
-
"dropdownName": {
|
|
52
|
-
"type": "string",
|
|
53
|
-
"mutable": false,
|
|
54
|
-
"complexType": {
|
|
55
|
-
"original": "string",
|
|
56
|
-
"resolved": "string",
|
|
57
|
-
"references": {}
|
|
58
|
-
},
|
|
59
|
-
"required": false,
|
|
60
|
-
"optional": false,
|
|
61
|
-
"docs": {
|
|
62
|
-
"tags": [{
|
|
63
|
-
"text": "Country name attribute",
|
|
64
|
-
"name": "uiName"
|
|
65
|
-
}],
|
|
66
|
-
"text": ""
|
|
67
|
-
},
|
|
68
|
-
"attribute": "dropdown-name",
|
|
69
|
-
"reflect": false,
|
|
70
|
-
"defaultValue": "\"countryCode\""
|
|
71
|
-
},
|
|
72
|
-
"dropdownLabel": {
|
|
73
|
-
"type": "string",
|
|
74
|
-
"mutable": false,
|
|
75
|
-
"complexType": {
|
|
76
|
-
"original": "string",
|
|
77
|
-
"resolved": "string",
|
|
78
|
-
"references": {}
|
|
79
|
-
},
|
|
80
|
-
"required": false,
|
|
81
|
-
"optional": false,
|
|
82
|
-
"docs": {
|
|
83
|
-
"tags": [{
|
|
84
|
-
"text": "Country Dropdown label",
|
|
85
|
-
"name": "uiName"
|
|
86
|
-
}],
|
|
87
|
-
"text": ""
|
|
88
|
-
},
|
|
89
|
-
"attribute": "dropdown-label",
|
|
90
|
-
"reflect": false,
|
|
91
|
-
"defaultValue": "\"Country\""
|
|
92
|
-
},
|
|
93
|
-
"errorMessage": {
|
|
94
|
-
"type": "string",
|
|
95
|
-
"mutable": false,
|
|
96
|
-
"complexType": {
|
|
97
|
-
"original": "string",
|
|
98
|
-
"resolved": "string",
|
|
99
|
-
"references": {}
|
|
100
|
-
},
|
|
101
|
-
"required": false,
|
|
102
|
-
"optional": false,
|
|
103
|
-
"docs": {
|
|
104
|
-
"tags": [{
|
|
105
|
-
"text": "Unselected error message",
|
|
106
|
-
"name": "uiName"
|
|
107
|
-
}],
|
|
108
|
-
"text": ""
|
|
109
|
-
},
|
|
110
|
-
"attribute": "error-message",
|
|
111
|
-
"reflect": false,
|
|
112
|
-
"defaultValue": "\"Must select a country\""
|
|
113
|
-
},
|
|
114
|
-
"dropdownRequired": {
|
|
115
|
-
"type": "boolean",
|
|
116
|
-
"mutable": false,
|
|
117
|
-
"complexType": {
|
|
118
|
-
"original": "boolean",
|
|
119
|
-
"resolved": "boolean",
|
|
120
|
-
"references": {}
|
|
121
|
-
},
|
|
122
|
-
"required": false,
|
|
123
|
-
"optional": true,
|
|
124
|
-
"docs": {
|
|
125
|
-
"tags": [{
|
|
126
|
-
"text": "Required",
|
|
127
|
-
"name": "uiName"
|
|
128
|
-
}],
|
|
129
|
-
"text": ""
|
|
130
|
-
},
|
|
131
|
-
"attribute": "dropdown-required",
|
|
132
|
-
"reflect": false,
|
|
133
|
-
"defaultValue": "true"
|
|
134
|
-
},
|
|
135
|
-
"locale": {
|
|
136
|
-
"type": "string",
|
|
137
|
-
"mutable": false,
|
|
138
|
-
"complexType": {
|
|
139
|
-
"original": "string | null",
|
|
140
|
-
"resolved": "string",
|
|
141
|
-
"references": {}
|
|
142
|
-
},
|
|
143
|
-
"required": false,
|
|
144
|
-
"optional": false,
|
|
145
|
-
"docs": {
|
|
146
|
-
"tags": [{
|
|
147
|
-
"text": "Country name locale override",
|
|
148
|
-
"name": "uiName"
|
|
149
|
-
}],
|
|
150
|
-
"text": ""
|
|
151
|
-
},
|
|
152
|
-
"attribute": "locale",
|
|
153
|
-
"reflect": false,
|
|
154
|
-
"defaultValue": "null"
|
|
155
|
-
},
|
|
156
|
-
"demoData": {
|
|
157
|
-
"type": "unknown",
|
|
158
|
-
"mutable": false,
|
|
159
|
-
"complexType": {
|
|
160
|
-
"original": "DemoData<CountryFieldViewProps>",
|
|
161
|
-
"resolved": "{ states?: { validationErrors?: Record<string, string>; }; content?: { dropdownName: string; dropdownLabel: string; dropdownRequired?: boolean; errorMessage: string; selectOptions?: VNode | VNode[]; }; data?: { countries: Country[]; }; }",
|
|
162
|
-
"references": {
|
|
163
|
-
"DemoData": {
|
|
164
|
-
"location": "import",
|
|
165
|
-
"path": "../../global/demo"
|
|
166
|
-
},
|
|
167
|
-
"CountryFieldViewProps": {
|
|
168
|
-
"location": "import",
|
|
169
|
-
"path": "./sqm-country-field-view"
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
"required": false,
|
|
174
|
-
"optional": true,
|
|
175
|
-
"docs": {
|
|
176
|
-
"tags": [{
|
|
177
|
-
"text": undefined,
|
|
178
|
-
"name": "undocumented"
|
|
179
|
-
}],
|
|
180
|
-
"text": ""
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}; }
|
|
184
|
-
static get states() { return {
|
|
185
|
-
"ignored": {}
|
|
186
|
-
}; }
|
|
187
|
-
}
|
|
188
|
-
function useCountryFieldDemo(props) {
|
|
189
|
-
return deepmerge({
|
|
190
|
-
states: {
|
|
191
|
-
validationErrors: [],
|
|
192
|
-
},
|
|
193
|
-
data: {
|
|
194
|
-
countries: [],
|
|
195
|
-
},
|
|
196
|
-
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
197
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { useLocale, useQuery, useUserIdentity, } from "@saasquatch/component-boilerplate";
|
|
2
|
-
import { gql } from "graphql-request";
|
|
3
|
-
const GET_COUNTRIES = gql `
|
|
4
|
-
query countryList($locale: RSLocale) {
|
|
5
|
-
countries(limit: 250) {
|
|
6
|
-
data {
|
|
7
|
-
countryCode
|
|
8
|
-
displayName(locale: $locale)
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
13
|
-
export function useCountryField(props) {
|
|
14
|
-
var _a;
|
|
15
|
-
const user = useUserIdentity();
|
|
16
|
-
const locale = props.locale || useLocale();
|
|
17
|
-
const { data: res } = useQuery(GET_COUNTRIES, { locale }, user && locale === undefined);
|
|
18
|
-
return {
|
|
19
|
-
data: {
|
|
20
|
-
countries: (_a = res === null || res === void 0 ? void 0 : res.countries) === null || _a === void 0 ? void 0 : _a.data,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
}
|