@saasquatch/mint-components 1.5.2 → 1.5.3-0
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/{ShadowViewAddon-9b256c28.js → ShadowViewAddon-8665ac96.js} +64 -25
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/{sqm-big-stat_34.cjs.entry.js → sqm-big-stat_35.cjs.entry.js} +52 -1
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +229 -41
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/sqm-hero/Hero.stories.js +1 -1
- package/dist/collection/components/sqm-input-field/InputField.stories.js +88 -0
- package/dist/collection/components/sqm-input-field/UseInputField.stories.js +77 -0
- package/dist/collection/components/sqm-input-field/sqm-input-field-view.js +41 -0
- package/dist/collection/components/sqm-input-field/sqm-input-field.js +192 -0
- package/dist/collection/components/sqm-input-field/useInputField.js +10 -0
- package/dist/collection/components/sqm-name-fields/NameFields.stories.js +2 -2
- package/dist/collection/components/sqm-portal-footer/PortalFooter.stories.js +1 -1
- package/dist/collection/components/sqm-program-menu/ProgramMenu.stories.js +1 -1
- package/dist/collection/components/sqm-referral-iframe/ReferralIframe.stories.js +1 -1
- package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +4 -0
- package/dist/esm/{ShadowViewAddon-b98faaf1.js → ShadowViewAddon-ec53d07b.js} +64 -26
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/{sqm-big-stat_34.entry.js → sqm-big-stat_35.entry.js} +52 -2
- package/dist/esm/sqm-stencilbook.entry.js +229 -41
- package/dist/esm-es5/{ShadowViewAddon-b98faaf1.js → ShadowViewAddon-ec53d07b.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 -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-0b9784a6.entry.js +9 -0
- package/dist/mint-components/p-2c098d2a.system.entry.js +1 -0
- package/dist/mint-components/p-36f3c053.system.js +1 -0
- package/dist/mint-components/{p-52ca31c9.entry.js → p-38858049.entry.js} +12 -12
- package/dist/mint-components/p-436da6b8.system.js +1 -1
- package/dist/mint-components/{p-f702ffef.js → p-78aa1b56.js} +1 -1
- package/dist/mint-components/p-d1cad711.system.entry.js +1 -0
- package/dist/types/components/sqm-input-field/InputField.stories.d.ts +16 -0
- package/dist/types/components/sqm-input-field/UseInputField.stories.d.ts +49 -0
- package/dist/types/components/sqm-input-field/sqm-input-field-view.d.ts +14 -0
- package/dist/types/components/sqm-input-field/sqm-input-field.d.ts +35 -0
- package/dist/types/components/sqm-input-field/useInputField.d.ts +5 -0
- package/dist/types/components.d.ts +66 -0
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/shoelace/assets/icons/123.svg +3 -0
- package/shoelace/assets/icons/activity.svg +3 -0
- package/shoelace/assets/icons/apple.svg +4 -0
- package/shoelace/assets/icons/bandaid-fill.svg +3 -0
- package/shoelace/assets/icons/bandaid.svg +4 -0
- package/shoelace/assets/icons/bank.svg +3 -0
- package/shoelace/assets/icons/bank2.svg +3 -0
- package/shoelace/assets/icons/behance.svg +3 -0
- package/shoelace/assets/icons/bell-slash-fill.svg +3 -0
- package/shoelace/assets/icons/bell-slash.svg +3 -0
- package/shoelace/assets/icons/bluetooth.svg +3 -0
- package/shoelace/assets/icons/body-text.svg +3 -0
- package/shoelace/assets/icons/boombox-fill.svg +4 -0
- package/shoelace/assets/icons/boombox.svg +6 -0
- package/shoelace/assets/icons/boxes.svg +3 -0
- package/shoelace/assets/icons/cash-coin.svg +6 -0
- package/shoelace/assets/icons/check-lg.svg +3 -0
- package/shoelace/assets/icons/cloud-haze2.svg +3 -0
- package/shoelace/assets/icons/coin.svg +5 -0
- package/shoelace/assets/icons/currency-bitcoin.svg +3 -0
- package/shoelace/assets/icons/currency-dollar.svg +3 -0
- package/shoelace/assets/icons/currency-euro.svg +3 -0
- package/shoelace/assets/icons/currency-exchange.svg +3 -0
- package/shoelace/assets/icons/currency-pound.svg +3 -0
- package/shoelace/assets/icons/currency-yen.svg +3 -0
- package/shoelace/assets/icons/dash-lg.svg +3 -0
- package/shoelace/assets/icons/device-hdd-fill.svg +4 -0
- package/shoelace/assets/icons/device-hdd.svg +5 -0
- package/shoelace/assets/icons/device-ssd-fill.svg +4 -0
- package/shoelace/assets/icons/device-ssd.svg +4 -0
- package/shoelace/assets/icons/displayport-fill.svg +3 -0
- package/shoelace/assets/icons/displayport.svg +4 -0
- package/shoelace/assets/icons/dpad-fill.svg +3 -0
- package/shoelace/assets/icons/dpad.svg +4 -0
- package/shoelace/assets/icons/dribbble.svg +3 -0
- package/shoelace/assets/icons/ear-fill.svg +3 -0
- package/shoelace/assets/icons/ear.svg +3 -0
- package/shoelace/assets/icons/easel2-fill.svg +4 -0
- package/shoelace/assets/icons/easel2.svg +3 -0
- package/shoelace/assets/icons/easel3-fill.svg +3 -0
- package/shoelace/assets/icons/easel3.svg +3 -0
- package/shoelace/assets/icons/envelope-check-fill.svg +4 -0
- package/shoelace/assets/icons/envelope-check.svg +4 -0
- package/shoelace/assets/icons/envelope-dash-fill.svg +4 -0
- package/shoelace/assets/icons/envelope-dash.svg +4 -0
- package/shoelace/assets/icons/envelope-exclamation-fill.svg +4 -0
- package/shoelace/assets/icons/envelope-exclamation.svg +4 -0
- package/shoelace/assets/icons/envelope-plus-fill.svg +4 -0
- package/shoelace/assets/icons/envelope-plus.svg +4 -0
- package/shoelace/assets/icons/envelope-slash-fill.svg +4 -0
- package/shoelace/assets/icons/envelope-slash.svg +4 -0
- package/shoelace/assets/icons/envelope-x-fill.svg +4 -0
- package/shoelace/assets/icons/envelope-x.svg +4 -0
- package/shoelace/assets/icons/ethernet.svg +4 -0
- package/shoelace/assets/icons/exclamation-lg.svg +3 -0
- package/shoelace/assets/icons/explicit-fill.svg +3 -0
- package/shoelace/assets/icons/explicit.svg +4 -0
- package/shoelace/assets/icons/fan.svg +4 -0
- package/shoelace/assets/icons/file-earmark-pdf-fill.svg +4 -0
- package/shoelace/assets/icons/file-earmark-pdf.svg +4 -0
- package/shoelace/assets/icons/file-pdf-fill.svg +4 -0
- package/shoelace/assets/icons/file-pdf.svg +4 -0
- package/shoelace/assets/icons/fingerprint.svg +7 -0
- package/shoelace/assets/icons/gender-ambiguous.svg +3 -0
- package/shoelace/assets/icons/gender-female.svg +3 -0
- package/shoelace/assets/icons/gender-male.svg +3 -0
- package/shoelace/assets/icons/gender-trans.svg +3 -0
- package/shoelace/assets/icons/git.svg +3 -0
- package/shoelace/assets/icons/gpu-card.svg +5 -0
- package/shoelace/assets/icons/graph-down-arrow.svg +3 -0
- package/shoelace/assets/icons/graph-up-arrow.svg +3 -0
- package/shoelace/assets/icons/hdmi-fill.svg +3 -0
- package/shoelace/assets/icons/hdmi.svg +4 -0
- package/shoelace/assets/icons/headset-vr.svg +4 -0
- package/shoelace/assets/icons/hypnotize.svg +4 -0
- package/shoelace/assets/icons/infinity.svg +3 -0
- package/shoelace/assets/icons/info-lg.svg +3 -0
- package/shoelace/assets/icons/line.svg +3 -0
- package/shoelace/assets/icons/list-columns-reverse.svg +3 -0
- package/shoelace/assets/icons/list-columns.svg +3 -0
- package/shoelace/assets/icons/magic.svg +3 -0
- package/shoelace/assets/icons/mastodon.svg +3 -0
- package/shoelace/assets/icons/medium.svg +3 -0
- package/shoelace/assets/icons/memory.svg +3 -0
- package/shoelace/assets/icons/messenger.svg +3 -0
- package/shoelace/assets/icons/meta.svg +3 -0
- package/shoelace/assets/icons/microsoft.svg +3 -0
- package/shoelace/assets/icons/modem-fill.svg +3 -0
- package/shoelace/assets/icons/modem.svg +4 -0
- package/shoelace/assets/icons/mortarboard-fill.svg +4 -0
- package/shoelace/assets/icons/mortarboard.svg +4 -0
- package/shoelace/assets/icons/motherboard-fill.svg +4 -0
- package/shoelace/assets/icons/motherboard.svg +4 -0
- package/shoelace/assets/icons/nintendo-switch.svg +4 -0
- package/shoelace/assets/icons/optical-audio-fill.svg +4 -0
- package/shoelace/assets/icons/optical-audio.svg +5 -0
- package/shoelace/assets/icons/paypal.svg +3 -0
- package/shoelace/assets/icons/pc-display-horizontal.svg +3 -0
- package/shoelace/assets/icons/pc-display.svg +3 -0
- package/shoelace/assets/icons/pc-horizontal.svg +3 -0
- package/shoelace/assets/icons/pc.svg +3 -0
- package/shoelace/assets/icons/pci-card.svg +4 -0
- package/shoelace/assets/icons/person-rolodex.svg +4 -0
- package/shoelace/assets/icons/person-video.svg +4 -0
- package/shoelace/assets/icons/person-video2.svg +4 -0
- package/shoelace/assets/icons/person-video3.svg +4 -0
- package/shoelace/assets/icons/person-workspace.svg +4 -0
- package/shoelace/assets/icons/piggy-bank-fill.svg +3 -0
- package/shoelace/assets/icons/piggy-bank.svg +4 -0
- package/shoelace/assets/icons/pin-map-fill.svg +4 -0
- package/shoelace/assets/icons/pin-map.svg +4 -0
- package/shoelace/assets/icons/pinterest.svg +3 -0
- package/shoelace/assets/icons/playstation.svg +3 -0
- package/shoelace/assets/icons/plus-lg.svg +3 -0
- package/shoelace/assets/icons/plus-slash-minus.svg +3 -0
- package/shoelace/assets/icons/projector-fill.svg +3 -0
- package/shoelace/assets/icons/projector.svg +4 -0
- package/shoelace/assets/icons/qr-code-scan.svg +7 -0
- package/shoelace/assets/icons/qr-code.svg +7 -0
- package/shoelace/assets/icons/question-lg.svg +3 -0
- package/shoelace/assets/icons/quora.svg +3 -0
- package/shoelace/assets/icons/quote.svg +3 -0
- package/shoelace/assets/icons/radioactive.svg +4 -0
- package/shoelace/assets/icons/recycle.svg +3 -0
- package/shoelace/assets/icons/reddit.svg +4 -0
- package/shoelace/assets/icons/robot.svg +4 -0
- package/shoelace/assets/icons/router-fill.svg +6 -0
- package/shoelace/assets/icons/router.svg +6 -0
- package/shoelace/assets/icons/safe-fill.svg +4 -0
- package/shoelace/assets/icons/safe.svg +4 -0
- package/shoelace/assets/icons/safe2-fill.svg +4 -0
- package/shoelace/assets/icons/safe2.svg +4 -0
- package/shoelace/assets/icons/sd-card-fill.svg +3 -0
- package/shoelace/assets/icons/sd-card.svg +4 -0
- package/shoelace/assets/icons/send-check-fill.svg +4 -0
- package/shoelace/assets/icons/send-check.svg +4 -0
- package/shoelace/assets/icons/send-dash-fill.svg +4 -0
- package/shoelace/assets/icons/send-dash.svg +4 -0
- package/shoelace/assets/icons/send-exclamation-fill.svg +4 -0
- package/shoelace/assets/icons/send-exclamation.svg +4 -0
- package/shoelace/assets/icons/send-fill.svg +3 -0
- package/shoelace/assets/icons/send-plus-fill.svg +4 -0
- package/shoelace/assets/icons/send-plus.svg +4 -0
- package/shoelace/assets/icons/send-slash-fill.svg +4 -0
- package/shoelace/assets/icons/send-slash.svg +4 -0
- package/shoelace/assets/icons/send-x-fill.svg +4 -0
- package/shoelace/assets/icons/send-x.svg +4 -0
- package/shoelace/assets/icons/send.svg +3 -0
- package/shoelace/assets/icons/signal.svg +3 -0
- package/shoelace/assets/icons/skype.svg +3 -0
- package/shoelace/assets/icons/slash-lg.svg +3 -0
- package/shoelace/assets/icons/snapchat.svg +3 -0
- package/shoelace/assets/icons/spotify.svg +3 -0
- package/shoelace/assets/icons/stack-overflow.svg +4 -0
- package/shoelace/assets/icons/steam.svg +4 -0
- package/shoelace/assets/icons/strava.svg +3 -0
- package/shoelace/assets/icons/terminal-dash.svg +4 -0
- package/shoelace/assets/icons/terminal-plus.svg +4 -0
- package/shoelace/assets/icons/terminal-split.svg +4 -0
- package/shoelace/assets/icons/terminal-x.svg +4 -0
- package/shoelace/assets/icons/thunderbolt-fill.svg +3 -0
- package/shoelace/assets/icons/thunderbolt.svg +4 -0
- package/shoelace/assets/icons/ticket-detailed-fill.svg +3 -0
- package/shoelace/assets/icons/ticket-detailed.svg +4 -0
- package/shoelace/assets/icons/ticket-fill.svg +3 -0
- package/shoelace/assets/icons/ticket-perforated-fill.svg +3 -0
- package/shoelace/assets/icons/ticket-perforated.svg +4 -0
- package/shoelace/assets/icons/ticket.svg +3 -0
- package/shoelace/assets/icons/tiktok.svg +3 -0
- package/shoelace/assets/icons/translate.svg +4 -0
- package/shoelace/assets/icons/usb-c-fill.svg +3 -0
- package/shoelace/assets/icons/usb-c.svg +4 -0
- package/shoelace/assets/icons/usb-drive-fill.svg +3 -0
- package/shoelace/assets/icons/usb-drive.svg +3 -0
- package/shoelace/assets/icons/usb-fill.svg +3 -0
- package/shoelace/assets/icons/usb-micro-fill.svg +3 -0
- package/shoelace/assets/icons/usb-micro.svg +4 -0
- package/shoelace/assets/icons/usb-mini-fill.svg +3 -0
- package/shoelace/assets/icons/usb-mini.svg +4 -0
- package/shoelace/assets/icons/usb-plug-fill.svg +3 -0
- package/shoelace/assets/icons/usb-plug.svg +3 -0
- package/shoelace/assets/icons/usb-symbol.svg +3 -0
- package/shoelace/assets/icons/usb.svg +4 -0
- package/shoelace/assets/icons/vimeo.svg +3 -0
- package/shoelace/assets/icons/webcam-fill.svg +4 -0
- package/shoelace/assets/icons/webcam.svg +4 -0
- package/shoelace/assets/icons/window-dash.svg +5 -0
- package/shoelace/assets/icons/window-desktop.svg +4 -0
- package/shoelace/assets/icons/window-fullscreen.svg +4 -0
- package/shoelace/assets/icons/window-plus.svg +5 -0
- package/shoelace/assets/icons/window-split.svg +4 -0
- package/shoelace/assets/icons/window-stack.svg +4 -0
- package/shoelace/assets/icons/window-x.svg +5 -0
- package/shoelace/assets/icons/windows.svg +3 -0
- package/shoelace/assets/icons/wordpress.svg +5 -0
- package/shoelace/assets/icons/x-lg.svg +4 -0
- package/shoelace/assets/icons/xbox.svg +3 -0
- package/shoelace/assets/icons/yin-yang.svg +4 -0
- package/shoelace/themes/themes/dark.styles.d.ts +2 -0
- package/shoelace/themes/themes/dark.styles.js +531 -0
- package/shoelace/themes/themes/light.css +439 -0
- package/shoelace/themes/themes/light.styles.d.ts +2 -0
- package/shoelace/themes/themes/light.styles.js +531 -0
- package/dist/esm-es5/sqm-big-stat_34.entry.js +0 -1
- package/dist/mint-components/p-842aa194.system.js +0 -1
- package/dist/mint-components/p-8a1a1fb4.system.entry.js +0 -1
- package/dist/mint-components/p-a624b8d7.system.entry.js +0 -1
- package/dist/mint-components/p-b176c55c.entry.js +0 -9
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"./components/sqm-hero-image/sqm-hero-image.js",
|
|
19
19
|
"./components/sqm-hook-story-container/sqm-hook-story-container.js",
|
|
20
20
|
"./components/sqm-image/sqm-image.js",
|
|
21
|
+
"./components/sqm-input-field/sqm-input-field.js",
|
|
21
22
|
"./components/sqm-leaderboard/sqm-leaderboard.js",
|
|
22
23
|
"./components/sqm-leaderboard-rank/sqm-leaderboard-rank.js",
|
|
23
24
|
"./components/sqm-name-fields/sqm-name-fields.js",
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { PortalRegisterView, } from "../sqm-portal-register/sqm-portal-register-view";
|
|
3
|
+
import { InputFieldView } from "./sqm-input-field-view";
|
|
4
|
+
import scenario from "./sqm-input-field.feature";
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/Input Field",
|
|
7
|
+
parameters: {
|
|
8
|
+
scenario,
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
const defaultProps = {
|
|
12
|
+
states: {
|
|
13
|
+
validationErrors: {},
|
|
14
|
+
},
|
|
15
|
+
content: {
|
|
16
|
+
fieldName: "field",
|
|
17
|
+
fieldLabel: "My Custom Input",
|
|
18
|
+
fieldType: "text",
|
|
19
|
+
fieldRequired: true,
|
|
20
|
+
errorMessage: "Cannot be empty",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
const defaultRegisterProps = {
|
|
24
|
+
states: {
|
|
25
|
+
error: "",
|
|
26
|
+
loading: false,
|
|
27
|
+
confirmPassword: true,
|
|
28
|
+
hideInputs: false,
|
|
29
|
+
loginPath: "/login",
|
|
30
|
+
},
|
|
31
|
+
callbacks: {
|
|
32
|
+
submit: () => console.log("Submit!"),
|
|
33
|
+
inputFunction: () => { },
|
|
34
|
+
},
|
|
35
|
+
refs: {
|
|
36
|
+
formRef: {},
|
|
37
|
+
},
|
|
38
|
+
content: { pageLabel: "Register", confirmPasswordLabel: "Confirm Password" },
|
|
39
|
+
};
|
|
40
|
+
export const Default = () => h(InputFieldView, Object.assign({}, defaultProps));
|
|
41
|
+
export const CustomLabel = () => (h(InputFieldView, Object.assign({}, defaultProps, { content: { ...defaultProps.content, fieldLabel: "My Label" } })));
|
|
42
|
+
export const Error = () => (h(InputFieldView, Object.assign({}, defaultProps, { states: {
|
|
43
|
+
...defaultProps.states,
|
|
44
|
+
validationErrors: {
|
|
45
|
+
field: "Cannot be empty",
|
|
46
|
+
},
|
|
47
|
+
} })));
|
|
48
|
+
export const CustomError = () => (h(InputFieldView, Object.assign({}, defaultProps, { content: {
|
|
49
|
+
...defaultProps.content,
|
|
50
|
+
errorMessage: "A value must be entered to continue",
|
|
51
|
+
}, states: {
|
|
52
|
+
...defaultProps.states,
|
|
53
|
+
validationErrors: {
|
|
54
|
+
field: "Cannot be empty",
|
|
55
|
+
},
|
|
56
|
+
} })));
|
|
57
|
+
export const DateType = () => {
|
|
58
|
+
return (h(InputFieldView, Object.assign({}, defaultProps, { content: {
|
|
59
|
+
...defaultProps.content,
|
|
60
|
+
fieldLabel: "Date",
|
|
61
|
+
fieldType: "date",
|
|
62
|
+
} })));
|
|
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
|
+
export const TelType = () => {
|
|
72
|
+
return (h(InputFieldView, Object.assign({}, defaultProps, { content: {
|
|
73
|
+
...defaultProps.content,
|
|
74
|
+
fieldLabel: "Phone Number",
|
|
75
|
+
fieldType: "tel",
|
|
76
|
+
} })));
|
|
77
|
+
};
|
|
78
|
+
export const RegistrationField = () => (h(PortalRegisterView, Object.assign({}, defaultRegisterProps, { content: {
|
|
79
|
+
...defaultRegisterProps.content,
|
|
80
|
+
formData: h(InputFieldView, Object.assign({}, defaultProps)),
|
|
81
|
+
} })));
|
|
82
|
+
export const RegistrationFieldCustomLabel = () => (h(PortalRegisterView, Object.assign({}, defaultRegisterProps, { content: {
|
|
83
|
+
...defaultRegisterProps.content,
|
|
84
|
+
formData: (h(InputFieldView, Object.assign({}, defaultProps, { content: {
|
|
85
|
+
...defaultProps.content,
|
|
86
|
+
fieldLabel: "Data",
|
|
87
|
+
} }))),
|
|
88
|
+
} })));
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
import scenario from "./sqm-input-field.feature";
|
|
6
|
+
export default {
|
|
7
|
+
title: "Hooks / useInputField",
|
|
8
|
+
parameters: {
|
|
9
|
+
scenario,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
function setupGraphQL() {
|
|
13
|
+
const id = "testestest";
|
|
14
|
+
const accountId = id;
|
|
15
|
+
const programId = "sam-partner-test-2";
|
|
16
|
+
//@ts-ignore
|
|
17
|
+
window.widgetIdent = {
|
|
18
|
+
tenantAlias: "test_a8b41jotf8a1v",
|
|
19
|
+
appDomain: "https://staging.referralsaasquatch.com",
|
|
20
|
+
programId,
|
|
21
|
+
};
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
setUserIdentity({
|
|
24
|
+
accountId,
|
|
25
|
+
id,
|
|
26
|
+
jwt: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImFjY291bnRJZCI6InRlc3Rlc3Rlc3QiLCJpZCI6InRlc3Rlc3Rlc3QifX0.qYnU5hNeIj9C_G3NogfG7btgCPGZC7JRXY0MG6a63zs",
|
|
27
|
+
});
|
|
28
|
+
return () => {
|
|
29
|
+
window.widgetIdent = undefined;
|
|
30
|
+
setUserIdentity(undefined);
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
return { id, accountId };
|
|
34
|
+
}
|
|
35
|
+
export const FormData = createHookStory(() => {
|
|
36
|
+
setupGraphQL();
|
|
37
|
+
return (h("sqm-portal-register", null,
|
|
38
|
+
h("div", { slot: "formData" },
|
|
39
|
+
h("sqm-input-field", { "field-name": "myData" }))));
|
|
40
|
+
});
|
|
41
|
+
export const FormDataWithLabel = createHookStory(() => {
|
|
42
|
+
setupGraphQL();
|
|
43
|
+
return (h("sqm-portal-register", null,
|
|
44
|
+
h("div", { slot: "formData" },
|
|
45
|
+
h("sqm-input-field", { "field-label": "Custom Label", "field-name": "myData" }))));
|
|
46
|
+
});
|
|
47
|
+
export const MultipleInputs = createHookStory(() => {
|
|
48
|
+
setupGraphQL();
|
|
49
|
+
return (h("sqm-portal-register", null,
|
|
50
|
+
h("sqm-name-fields", { slot: "formData" }),
|
|
51
|
+
h("sqm-input-field", { slot: "formData", "field-label": "Field One", "field-name": "fieldOne" }),
|
|
52
|
+
h("sqm-input-field", { slot: "formData", "field-label": "Field Two", "field-name": "fieldTwo" })));
|
|
53
|
+
});
|
|
54
|
+
export const OptionalInputs = createHookStory(() => {
|
|
55
|
+
setupGraphQL();
|
|
56
|
+
return (h("sqm-portal-register", null,
|
|
57
|
+
h("sqm-name-fields", { slot: "formData" }),
|
|
58
|
+
h("sqm-input-field", { slot: "formData", "field-label": "Optional Field", "field-required": "false", "field-name": "optionalField" })));
|
|
59
|
+
});
|
|
60
|
+
export const DateType = createHookStory(() => {
|
|
61
|
+
setupGraphQL();
|
|
62
|
+
return (h("sqm-portal-register", null,
|
|
63
|
+
h("sqm-name-fields", { slot: "formData" }),
|
|
64
|
+
h("sqm-input-field", { slot: "formData", "field-label": "Date", "field-name": "date", "field-type": "date" })));
|
|
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
|
+
export const TelType = createHookStory(() => {
|
|
73
|
+
setupGraphQL();
|
|
74
|
+
return (h("sqm-portal-register", null,
|
|
75
|
+
h("sqm-name-fields", { slot: "formData" }),
|
|
76
|
+
h("sqm-input-field", { slot: "formData", "field-label": "Phone Number", "field-name": "tel", "field-type": "tel" })));
|
|
77
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import jss from "jss";
|
|
3
|
+
import preset from "jss-preset-default";
|
|
4
|
+
import { ErrorStyles } from "../../global/mixins";
|
|
5
|
+
const style = {
|
|
6
|
+
ErrorStyle: ErrorStyles,
|
|
7
|
+
FieldContainer: {
|
|
8
|
+
"margin-bottom": "var(--sl-spacing-large)",
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
const vanillaStyle = `
|
|
12
|
+
:host {
|
|
13
|
+
margin: 0 auto;
|
|
14
|
+
width: 100%;
|
|
15
|
+
display: block;
|
|
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
|
+
`;
|
|
26
|
+
jss.setup(preset());
|
|
27
|
+
const sheet = jss.createStyleSheet(style);
|
|
28
|
+
const styleString = sheet.toString();
|
|
29
|
+
export function InputFieldView(props) {
|
|
30
|
+
const { states, content } = props;
|
|
31
|
+
const validationErrors = states === null || states === void 0 ? void 0 : states.validationErrors;
|
|
32
|
+
return (h("div", { class: sheet.classes.FieldContainer },
|
|
33
|
+
h("style", { type: "text/css" },
|
|
34
|
+
vanillaStyle,
|
|
35
|
+
styleString),
|
|
36
|
+
h("sl-input", Object.assign({ exportparts: "label: input-label", name: `/${content.fieldName}`, type: content.fieldType, label: content.fieldLabel }, (content.fieldRequired ? { required: true } : []), ((validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.fieldName]) ? {
|
|
37
|
+
class: sheet.classes.ErrorStyle,
|
|
38
|
+
helpText: content.errorMessage || (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.fieldName]),
|
|
39
|
+
}
|
|
40
|
+
: [])))));
|
|
41
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
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 { InputFieldView } from "./sqm-input-field-view";
|
|
7
|
+
import { useInputField } from "./useInputField";
|
|
8
|
+
/**
|
|
9
|
+
* @uiName Input Field
|
|
10
|
+
*/
|
|
11
|
+
export class InputField {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.ignored = true;
|
|
14
|
+
/**
|
|
15
|
+
* @uiName Input label
|
|
16
|
+
*/
|
|
17
|
+
this.fieldLabel = "My Custom Input";
|
|
18
|
+
/**
|
|
19
|
+
* @uiName Input Type
|
|
20
|
+
* @uiType string
|
|
21
|
+
* @uiEnum ["text", "date", "number", "tel"]
|
|
22
|
+
*/
|
|
23
|
+
this.fieldType = "text";
|
|
24
|
+
/**
|
|
25
|
+
* @uiName Empty error message
|
|
26
|
+
*/
|
|
27
|
+
this.errorMessage = "Cannot be empty";
|
|
28
|
+
/**
|
|
29
|
+
* @uiName Required
|
|
30
|
+
*/
|
|
31
|
+
this.fieldRequired = true;
|
|
32
|
+
withHooks(this);
|
|
33
|
+
}
|
|
34
|
+
disconnectedCallback() { }
|
|
35
|
+
render() {
|
|
36
|
+
const content = {
|
|
37
|
+
...getProps(this),
|
|
38
|
+
};
|
|
39
|
+
const { states } = isDemo() ? useInputFieldDemo(this) : useInputField();
|
|
40
|
+
return h(InputFieldView, { states: states, content: content });
|
|
41
|
+
}
|
|
42
|
+
static get is() { return "sqm-input-field"; }
|
|
43
|
+
static get properties() { return {
|
|
44
|
+
"fieldName": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"mutable": false,
|
|
47
|
+
"complexType": {
|
|
48
|
+
"original": "string",
|
|
49
|
+
"resolved": "string",
|
|
50
|
+
"references": {}
|
|
51
|
+
},
|
|
52
|
+
"required": false,
|
|
53
|
+
"optional": false,
|
|
54
|
+
"docs": {
|
|
55
|
+
"tags": [{
|
|
56
|
+
"text": "Input name attribute",
|
|
57
|
+
"name": "uiName"
|
|
58
|
+
}],
|
|
59
|
+
"text": ""
|
|
60
|
+
},
|
|
61
|
+
"attribute": "field-name",
|
|
62
|
+
"reflect": false
|
|
63
|
+
},
|
|
64
|
+
"fieldLabel": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"mutable": false,
|
|
67
|
+
"complexType": {
|
|
68
|
+
"original": "string",
|
|
69
|
+
"resolved": "string",
|
|
70
|
+
"references": {}
|
|
71
|
+
},
|
|
72
|
+
"required": false,
|
|
73
|
+
"optional": false,
|
|
74
|
+
"docs": {
|
|
75
|
+
"tags": [{
|
|
76
|
+
"text": "Input label",
|
|
77
|
+
"name": "uiName"
|
|
78
|
+
}],
|
|
79
|
+
"text": ""
|
|
80
|
+
},
|
|
81
|
+
"attribute": "field-label",
|
|
82
|
+
"reflect": false,
|
|
83
|
+
"defaultValue": "\"My Custom Input\""
|
|
84
|
+
},
|
|
85
|
+
"fieldType": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"mutable": false,
|
|
88
|
+
"complexType": {
|
|
89
|
+
"original": "\"text\" | \"date\" | \"number\" | \"tel\"",
|
|
90
|
+
"resolved": "\"date\" | \"number\" | \"tel\" | \"text\"",
|
|
91
|
+
"references": {}
|
|
92
|
+
},
|
|
93
|
+
"required": false,
|
|
94
|
+
"optional": false,
|
|
95
|
+
"docs": {
|
|
96
|
+
"tags": [{
|
|
97
|
+
"text": "Input Type",
|
|
98
|
+
"name": "uiName"
|
|
99
|
+
}, {
|
|
100
|
+
"text": "string",
|
|
101
|
+
"name": "uiType"
|
|
102
|
+
}, {
|
|
103
|
+
"text": "[\"text\", \"date\", \"number\", \"tel\"]",
|
|
104
|
+
"name": "uiEnum"
|
|
105
|
+
}],
|
|
106
|
+
"text": ""
|
|
107
|
+
},
|
|
108
|
+
"attribute": "field-type",
|
|
109
|
+
"reflect": false,
|
|
110
|
+
"defaultValue": "\"text\""
|
|
111
|
+
},
|
|
112
|
+
"errorMessage": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"mutable": false,
|
|
115
|
+
"complexType": {
|
|
116
|
+
"original": "string",
|
|
117
|
+
"resolved": "string",
|
|
118
|
+
"references": {}
|
|
119
|
+
},
|
|
120
|
+
"required": false,
|
|
121
|
+
"optional": false,
|
|
122
|
+
"docs": {
|
|
123
|
+
"tags": [{
|
|
124
|
+
"text": "Empty error message",
|
|
125
|
+
"name": "uiName"
|
|
126
|
+
}],
|
|
127
|
+
"text": ""
|
|
128
|
+
},
|
|
129
|
+
"attribute": "error-message",
|
|
130
|
+
"reflect": false,
|
|
131
|
+
"defaultValue": "\"Cannot be empty\""
|
|
132
|
+
},
|
|
133
|
+
"fieldRequired": {
|
|
134
|
+
"type": "boolean",
|
|
135
|
+
"mutable": false,
|
|
136
|
+
"complexType": {
|
|
137
|
+
"original": "boolean",
|
|
138
|
+
"resolved": "boolean",
|
|
139
|
+
"references": {}
|
|
140
|
+
},
|
|
141
|
+
"required": false,
|
|
142
|
+
"optional": true,
|
|
143
|
+
"docs": {
|
|
144
|
+
"tags": [{
|
|
145
|
+
"text": "Required",
|
|
146
|
+
"name": "uiName"
|
|
147
|
+
}],
|
|
148
|
+
"text": ""
|
|
149
|
+
},
|
|
150
|
+
"attribute": "field-required",
|
|
151
|
+
"reflect": false,
|
|
152
|
+
"defaultValue": "true"
|
|
153
|
+
},
|
|
154
|
+
"demoData": {
|
|
155
|
+
"type": "unknown",
|
|
156
|
+
"mutable": false,
|
|
157
|
+
"complexType": {
|
|
158
|
+
"original": "DemoData<InputFieldViewProps>",
|
|
159
|
+
"resolved": "{ states?: { validationErrors?: ValidationErrors; }; content?: { fieldName: string; fieldLabel: string; fieldType: \"number\" | \"text\" | \"date\" | \"tel\"; fieldRequired?: boolean; errorMessage: string; }; }",
|
|
160
|
+
"references": {
|
|
161
|
+
"DemoData": {
|
|
162
|
+
"location": "import",
|
|
163
|
+
"path": "../../global/demo"
|
|
164
|
+
},
|
|
165
|
+
"InputFieldViewProps": {
|
|
166
|
+
"location": "import",
|
|
167
|
+
"path": "./sqm-input-field-view"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"required": false,
|
|
172
|
+
"optional": true,
|
|
173
|
+
"docs": {
|
|
174
|
+
"tags": [{
|
|
175
|
+
"text": undefined,
|
|
176
|
+
"name": "undocumented"
|
|
177
|
+
}],
|
|
178
|
+
"text": ""
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}; }
|
|
182
|
+
static get states() { return {
|
|
183
|
+
"ignored": {}
|
|
184
|
+
}; }
|
|
185
|
+
}
|
|
186
|
+
function useInputFieldDemo(props) {
|
|
187
|
+
return deepmerge({
|
|
188
|
+
states: {
|
|
189
|
+
validationErrors: [],
|
|
190
|
+
},
|
|
191
|
+
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
192
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useDomContext } from "@saasquatch/stencil-hooks";
|
|
2
|
+
import { FORM_VALIDATION_CONTEXT, } from "../sqm-portal-register/useValidationState";
|
|
3
|
+
export function useInputField() {
|
|
4
|
+
const validationState = useDomContext(FORM_VALIDATION_CONTEXT);
|
|
5
|
+
return {
|
|
6
|
+
states: {
|
|
7
|
+
validationErrors: validationState === null || validationState === void 0 ? void 0 : validationState.validationErrors,
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
import { NameFieldsView
|
|
2
|
+
import { NameFieldsView } from "./sqm-name-fields-view";
|
|
3
3
|
import scenario from "../sqm-name-fields/sqm-name-fields.feature";
|
|
4
4
|
export default {
|
|
5
|
-
title: "Name Fields",
|
|
5
|
+
title: "Components/Name Fields",
|
|
6
6
|
parameters: {
|
|
7
7
|
scenario,
|
|
8
8
|
},
|
|
@@ -2,7 +2,7 @@ import { h } from "@stencil/core";
|
|
|
2
2
|
import { PortalFooterView } from "./sqm-portal-footer-view";
|
|
3
3
|
import scenario from "../sqm-portal-footer/sqm-portal-footer.feature";
|
|
4
4
|
export default {
|
|
5
|
-
title: "Portal Footer",
|
|
5
|
+
title: "Components/Portal Footer",
|
|
6
6
|
parameters: {
|
|
7
7
|
scenario,
|
|
8
8
|
},
|
|
@@ -2,7 +2,7 @@ import { h } from "@stencil/core";
|
|
|
2
2
|
import { createHookStory } from "../sqm-stencilbook/HookStoryAddon";
|
|
3
3
|
import dashboardTemplate from "../../templates/Dashboard.html";
|
|
4
4
|
export default {
|
|
5
|
-
title: "Program Menu",
|
|
5
|
+
title: "Components/Program Menu",
|
|
6
6
|
};
|
|
7
7
|
export const OneProgram = createHookStory(() => {
|
|
8
8
|
return (h("sqm-program-menu", null,
|
|
@@ -2,7 +2,7 @@ import { h } from "@stencil/core";
|
|
|
2
2
|
import { ReferralIframeView, } from "./sqm-referral-iframe-view";
|
|
3
3
|
import scenario from "../sqm-referral-iframe/sqm-referral-iframe.feature";
|
|
4
4
|
export default {
|
|
5
|
-
title: "Referral Iframe",
|
|
5
|
+
title: "Components/Referral Iframe",
|
|
6
6
|
parameters: {
|
|
7
7
|
scenario,
|
|
8
8
|
},
|
|
@@ -50,6 +50,8 @@ import * as CheckboxField from "../sqm-checkbox-field/CheckboxField.stories";
|
|
|
50
50
|
import * as UseCheckboxField from "../sqm-checkbox-field/UseCheckboxField.stories";
|
|
51
51
|
import * as DropdownField from "../sqm-dropdown-field/DropdownField.stories";
|
|
52
52
|
import * as UseDropdownField from "../sqm-dropdown-field/UseDropdownField.stories";
|
|
53
|
+
import * as InputField from "../sqm-input-field/InputField.stories";
|
|
54
|
+
import * as UseInputField from "../sqm-input-field/UseInputField.stories";
|
|
53
55
|
import * as RewardExchangeList from "../sqm-reward-exchange-list/RewardExchangeList.stories";
|
|
54
56
|
import * as ProgramExplainer from "../sqm-program-explainer/ProgramExplainer.stories";
|
|
55
57
|
import * as ProgramExplainerStep from "../sqm-program-explainer-step/ProgramExplainerStep.stories";
|
|
@@ -86,6 +88,7 @@ const stories = [
|
|
|
86
88
|
UseLeaderboard,
|
|
87
89
|
UseCheckboxField,
|
|
88
90
|
UseDropdownField,
|
|
91
|
+
UseInputField,
|
|
89
92
|
Router,
|
|
90
93
|
PortalFrame,
|
|
91
94
|
EditProfile,
|
|
@@ -119,6 +122,7 @@ const stories = [
|
|
|
119
122
|
NameFields,
|
|
120
123
|
CheckboxField,
|
|
121
124
|
DropdownField,
|
|
125
|
+
InputField,
|
|
122
126
|
RewardExchangeList,
|
|
123
127
|
UseRewardExchangeList,
|
|
124
128
|
UseTaskCard,
|