@smileid/web-components 11.0.0 → 11.0.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/README.md +15 -15
- package/dist/README.md +15 -0
- package/dist/components/README.md +14 -0
- package/dist/components/document/src/README.md +111 -0
- package/dist/components/document/src/document-capture/README.md +90 -0
- package/dist/components/document/src/document-capture-instructions/README.md +56 -0
- package/dist/components/document/src/document-capture-review/README.md +79 -0
- package/dist/components/selfie/README.md +225 -0
- package/dist/components/smart-camera-web/src/README.md +207 -0
- package/dist/domain/camera/src/README.md +38 -0
- package/dist/domain/file-upload/README.md +35 -0
- package/dist/esm/{DocumentCaptureScreens-RECPb0wH.js → DocumentCaptureScreens-CRx5ymqY.js} +2 -2
- package/dist/esm/DocumentCaptureScreens-CRx5ymqY.js.map +1 -0
- package/dist/esm/EndUserConsent-D4fd1ovG.js.map +1 -1
- package/dist/esm/Navigation-CTjK6tLU.js.map +1 -1
- package/dist/esm/PoweredBySmileId-CxbaihMu.js.map +1 -1
- package/dist/esm/{SelfieCaptureScreens-CqBVGEJk.js → SelfieCaptureScreens-DuQjKt_K.js} +274 -257
- package/dist/esm/SelfieCaptureScreens-DuQjKt_K.js.map +1 -0
- package/dist/esm/SignaturePad-C7MtmT8m.js.map +1 -1
- package/dist/esm/TotpConsent-CQU5jQi4.js.map +1 -1
- package/dist/esm/combobox.js.map +1 -1
- package/dist/esm/document.js +1 -1
- package/dist/esm/main.js +2 -2
- package/dist/esm/{package-BDJnoIAU.js → package-C_cKNrUu.js} +2 -2
- package/dist/esm/package-C_cKNrUu.js.map +1 -0
- package/dist/esm/selfie.js +1 -1
- package/dist/esm/smart-camera-web.js +3 -3
- package/dist/esm/smart-camera-web.js.map +1 -1
- package/dist/esm/styles-BOEZtbuc.js.map +1 -1
- package/dist/package-lock.json +4948 -0
- package/dist/package.json +59 -0
- package/dist/smart-camera-web.js +23 -23
- package/dist/smart-camera-web.js.gz +0 -0
- package/dist/smart-camera-web.js.map +1 -1
- package/dist/src/components/combobox/src/index.js +2 -0
- package/dist/src/components/combobox/src/index.js.map +7 -0
- package/dist/src/components/document/src/index.js +2 -0
- package/dist/src/components/document/src/index.js.map +7 -0
- package/dist/src/components/end-user-consent/src/index.js +14 -0
- package/dist/src/components/end-user-consent/src/index.js.map +7 -0
- package/dist/src/components/selfie/src/index.js +2 -0
- package/dist/src/components/selfie/src/index.js.map +7 -0
- package/dist/src/components/signature-pad/src/index.js +10 -0
- package/dist/src/components/signature-pad/src/index.js.map +7 -0
- package/dist/src/components/smart-camera-web/src/SmartCameraWeb.js +2 -0
- package/dist/src/components/smart-camera-web/src/SmartCameraWeb.js.map +7 -0
- package/dist/src/components/totp-consent/src/index.js +14 -0
- package/dist/src/components/totp-consent/src/index.js.map +7 -0
- package/dist/src/index.js.map +7 -0
- package/dist/styles/README.md +3 -0
- package/dist/types/combobox.d.ts +19 -19
- package/dist/types/document.d.ts +19 -19
- package/dist/types/end-user-consent.d.ts +19 -19
- package/dist/types/main.d.ts +24 -20
- package/dist/types/navigation.d.ts +19 -19
- package/dist/types/selfie.d.ts +19 -19
- package/dist/types/signature-pad.d.ts +19 -19
- package/dist/types/smart-camera-web.d.ts +19 -19
- package/dist/types/totp-consent.d.ts +19 -19
- package/lib/components/README.md +14 -14
- package/lib/components/attribution/PoweredBySmileId.js +42 -42
- package/lib/components/camera-permission/CameraPermission.js +139 -139
- package/lib/components/camera-permission/CameraPermission.stories.js +27 -27
- package/lib/components/combobox/src/Combobox.js +589 -589
- package/lib/components/combobox/src/index.js +1 -1
- package/lib/components/document/src/DocumentCaptureScreens.js +410 -410
- package/lib/components/document/src/DocumentCaptureScreens.stories.js +57 -57
- package/lib/components/document/src/README.md +111 -111
- package/lib/components/document/src/document-capture/DocumentCapture.js +760 -760
- package/lib/components/document/src/document-capture/DocumentCapture.stories.js +78 -78
- package/lib/components/document/src/document-capture/README.md +90 -90
- package/lib/components/document/src/document-capture/index.js +3 -3
- package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.js +545 -545
- package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.stories.js +24 -24
- package/lib/components/document/src/document-capture-instructions/README.md +56 -56
- package/lib/components/document/src/document-capture-instructions/index.js +3 -3
- package/lib/components/document/src/document-capture-review/DocumentCaptureReview.js +360 -360
- package/lib/components/document/src/document-capture-review/DocumentCaptureReview.stories.js +24 -24
- package/lib/components/document/src/document-capture-review/README.md +79 -79
- package/lib/components/document/src/document-capture-review/index.js +3 -3
- package/lib/components/document/src/index.js +3 -3
- package/lib/components/end-user-consent/src/EndUserConsent.js +795 -795
- package/lib/components/end-user-consent/src/EndUserConsent.stories.js +29 -29
- package/lib/components/end-user-consent/src/index.js +4 -4
- package/lib/components/navigation/src/Navigation.js +171 -171
- package/lib/components/navigation/src/Navigation.stories.js +24 -24
- package/lib/components/navigation/src/index.js +3 -3
- package/lib/components/selfie/README.md +225 -225
- package/lib/components/selfie/src/SelfieCaptureScreens.js +420 -420
- package/lib/components/selfie/src/SelfieCaptureScreens.stories.js +29 -29
- package/lib/components/selfie/src/index.js +3 -3
- package/lib/components/selfie/src/selfie-capture/SelfieCapture.js +1099 -1099
- package/lib/components/selfie/src/selfie-capture/SelfieCapture.stories.js +36 -36
- package/lib/components/selfie/src/selfie-capture/index.js +3 -3
- package/lib/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.js +689 -689
- package/lib/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.stories.js +23 -23
- package/lib/components/selfie/src/selfie-capture-instructions/index.js +3 -3
- package/lib/components/selfie/src/selfie-capture-review/SelfieCaptureReview.js +209 -209
- package/lib/components/selfie/src/selfie-capture-review/SelfieCaptureReview.stories.js +24 -24
- package/lib/components/selfie/src/selfie-capture-review/index.js +3 -3
- package/lib/components/selfie/src/selfie-capture-wrapper/SelfieCaptureWrapper.tsx +281 -256
- package/lib/components/selfie/src/selfie-capture-wrapper/index.ts +1 -1
- package/lib/components/selfie/src/smartselfie-capture/OvalProgress.tsx +81 -81
- package/lib/components/selfie/src/smartselfie-capture/SmartSelfieCapture.tsx +265 -265
- package/lib/components/selfie/src/smartselfie-capture/components/AlertDisplay.tsx +34 -34
- package/lib/components/selfie/src/smartselfie-capture/components/CameraPreview.tsx +97 -97
- package/lib/components/selfie/src/smartselfie-capture/components/CaptureControls.tsx +78 -78
- package/lib/components/selfie/src/smartselfie-capture/components/index.ts +3 -3
- package/lib/components/selfie/src/smartselfie-capture/constants.ts +23 -23
- package/lib/components/selfie/src/smartselfie-capture/hooks/index.ts +2 -2
- package/lib/components/selfie/src/smartselfie-capture/hooks/useCamera.ts +238 -238
- package/lib/components/selfie/src/smartselfie-capture/hooks/useFaceCapture.ts +618 -618
- package/lib/components/selfie/src/smartselfie-capture/index.ts +1 -1
- package/lib/components/selfie/src/smartselfie-capture/utils/alertMessages.ts +13 -13
- package/lib/components/selfie/src/smartselfie-capture/utils/canvas.ts +105 -105
- package/lib/components/selfie/src/smartselfie-capture/utils/faceDetection.ts +129 -129
- package/lib/components/selfie/src/smartselfie-capture/utils/imageCapture.ts +64 -64
- package/lib/components/selfie/src/smartselfie-capture/utils/index.ts +4 -4
- package/lib/components/selfie/src/smartselfie-capture/utils/mediapipeManager.ts +118 -77
- package/lib/components/signature-pad/package-lock.json +3009 -3009
- package/lib/components/signature-pad/package.json +30 -30
- package/lib/components/signature-pad/src/SignaturePad.js +484 -484
- package/lib/components/signature-pad/src/SignaturePad.stories.js +32 -32
- package/lib/components/signature-pad/src/index.js +3 -3
- package/lib/components/smart-camera-web/src/README.md +206 -206
- package/lib/components/smart-camera-web/src/SmartCameraWeb.js +305 -305
- package/lib/components/smart-camera-web/src/SmartCameraWeb.stories.js +57 -57
- package/lib/components/totp-consent/src/TotpConsent.js +949 -949
- package/lib/components/totp-consent/src/index.js +4 -4
- package/lib/domain/camera/src/README.md +38 -38
- package/lib/domain/camera/src/SmartCamera.js +109 -109
- package/lib/domain/constants/src/Constants.js +27 -27
- package/lib/domain/file-upload/README.md +35 -35
- package/lib/domain/file-upload/src/SmartFileUpload.js +65 -65
- package/lib/styles/README.md +3 -3
- package/lib/styles/src/styles.js +372 -372
- package/lib/styles/src/typography.js +52 -52
- package/package.json +111 -112
- package/dist/esm/DocumentCaptureScreens-RECPb0wH.js.map +0 -1
- package/dist/esm/SelfieCaptureScreens-CqBVGEJk.js.map +0 -1
- package/dist/esm/package-BDJnoIAU.js.map +0 -1
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import './EndUserConsent';
|
|
2
|
-
|
|
3
|
-
const meta = {
|
|
4
|
-
args: {
|
|
5
|
-
'theme-color': '#001096',
|
|
6
|
-
},
|
|
7
|
-
argTypes: {
|
|
8
|
-
'theme-color': { control: 'color' },
|
|
9
|
-
},
|
|
10
|
-
component: 'end-user-consent',
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default meta;
|
|
14
|
-
|
|
15
|
-
export const EndUserConsent = {
|
|
16
|
-
render: (args) => `
|
|
17
|
-
<end-user-consent
|
|
18
|
-
country="NG"
|
|
19
|
-
id-type="NATIONAL_ID"
|
|
20
|
-
id-type-label="National ID"
|
|
21
|
-
partner-id="007"
|
|
22
|
-
partner-name="SmileID Stories"
|
|
23
|
-
policy-url="https://usesmileid.com/privacy-policy"
|
|
24
|
-
theme-color="${args['theme-color']}"
|
|
25
|
-
partner-logo="https://portal.usesmileid.com/favicon.ico"
|
|
26
|
-
>
|
|
27
|
-
</end-user-consent>
|
|
28
|
-
`,
|
|
29
|
-
};
|
|
1
|
+
import './EndUserConsent';
|
|
2
|
+
|
|
3
|
+
const meta = {
|
|
4
|
+
args: {
|
|
5
|
+
'theme-color': '#001096',
|
|
6
|
+
},
|
|
7
|
+
argTypes: {
|
|
8
|
+
'theme-color': { control: 'color' },
|
|
9
|
+
},
|
|
10
|
+
component: 'end-user-consent',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
|
|
15
|
+
export const EndUserConsent = {
|
|
16
|
+
render: (args) => `
|
|
17
|
+
<end-user-consent
|
|
18
|
+
country="NG"
|
|
19
|
+
id-type="NATIONAL_ID"
|
|
20
|
+
id-type-label="National ID"
|
|
21
|
+
partner-id="007"
|
|
22
|
+
partner-name="SmileID Stories"
|
|
23
|
+
policy-url="https://usesmileid.com/privacy-policy"
|
|
24
|
+
theme-color="${args['theme-color']}"
|
|
25
|
+
partner-logo="https://portal.usesmileid.com/favicon.ico"
|
|
26
|
+
>
|
|
27
|
+
</end-user-consent>
|
|
28
|
+
`,
|
|
29
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
3
|
-
EndUserConsent,
|
|
4
|
-
} from './EndUserConsent';
|
|
1
|
+
export {
|
|
2
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
3
|
+
EndUserConsent,
|
|
4
|
+
} from './EndUserConsent';
|
|
@@ -1,171 +1,171 @@
|
|
|
1
|
-
class Navigation extends HTMLElement {
|
|
2
|
-
connectedCallback() {
|
|
3
|
-
const shadow = this.attachShadow({ mode: 'open' });
|
|
4
|
-
|
|
5
|
-
const style = document.createElement('style');
|
|
6
|
-
style.textContent = `
|
|
7
|
-
:host {
|
|
8
|
-
display: flex;
|
|
9
|
-
max-inline-size: 100%;
|
|
10
|
-
justify-content: ${this.showBackButton ? 'space-between' : 'flex-end'};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
button {
|
|
14
|
-
--button-color: var(--color-default);
|
|
15
|
-
--flow-space: 3rem;
|
|
16
|
-
-webkit-appearance: none;
|
|
17
|
-
-moz-appearance: none;
|
|
18
|
-
align-items: center;
|
|
19
|
-
appearance: none;
|
|
20
|
-
background-color: transparent;
|
|
21
|
-
border-radius: 2.5rem;
|
|
22
|
-
border: none;
|
|
23
|
-
color: #ffffff;
|
|
24
|
-
cursor: pointer;
|
|
25
|
-
display: inline-flex;
|
|
26
|
-
font-size: 1rem;
|
|
27
|
-
font-weight: 500;
|
|
28
|
-
inline-size: 100%;
|
|
29
|
-
justify-content: center;
|
|
30
|
-
letter-spacing: 0.05ch;
|
|
31
|
-
line-height: 1;
|
|
32
|
-
padding: 1rem 2.5rem;
|
|
33
|
-
text-align: center;
|
|
34
|
-
text-decoration: none;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
button[data-type="icon"] {
|
|
38
|
-
align-items: center;
|
|
39
|
-
background-color: transparent;
|
|
40
|
-
border: 0;
|
|
41
|
-
cursor: pointer;
|
|
42
|
-
display: flex;
|
|
43
|
-
padding: 0;
|
|
44
|
-
width: auto;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
:host::part(back-button) {
|
|
48
|
-
display: flex;
|
|
49
|
-
align-items: center;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
:host::part(back-button-text) {
|
|
53
|
-
line-height: 1;
|
|
54
|
-
color: ${this.hasThemeColor ? this.themeColor : 'rgb(21, 31, 114)'} !important;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
:host::part(close-button) {
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.visually-hidden {
|
|
61
|
-
clip: rect(0 0 0 0);
|
|
62
|
-
clip-path: inset(50%);
|
|
63
|
-
block-size: 1px;
|
|
64
|
-
overflow: hidden;
|
|
65
|
-
position: absolute;
|
|
66
|
-
white-space: nowrap;
|
|
67
|
-
inline-size: 1px;
|
|
68
|
-
}
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
const backButton = document.createElement('button');
|
|
72
|
-
backButton.setAttribute('class', 'back-button');
|
|
73
|
-
backButton.setAttribute('data-type', 'icon');
|
|
74
|
-
backButton.setAttribute('part', 'back-button');
|
|
75
|
-
backButton.setAttribute('type', 'button');
|
|
76
|
-
backButton.innerHTML = `
|
|
77
|
-
<svg
|
|
78
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
79
|
-
width="24"
|
|
80
|
-
height="24"
|
|
81
|
-
viewBox="0 0 24 24"
|
|
82
|
-
fill="none"
|
|
83
|
-
>
|
|
84
|
-
<path
|
|
85
|
-
fill="#DBDBC4"
|
|
86
|
-
d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"
|
|
87
|
-
opacity=".4"
|
|
88
|
-
/>
|
|
89
|
-
<path
|
|
90
|
-
fill="${this.themeColor}"
|
|
91
|
-
d="M15.5 11.25h-5.19l1.72-1.72c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-3 3c-.29.29-.29.77 0 1.06l3 3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-1.72-1.72h5.19c.41 0 .75-.34.75-.75s-.34-.75-.75-.75Z"
|
|
92
|
-
/>
|
|
93
|
-
</svg>
|
|
94
|
-
<span part="back-button-text">Back</span>
|
|
95
|
-
`;
|
|
96
|
-
|
|
97
|
-
const closeButton = document.createElement('button');
|
|
98
|
-
closeButton.setAttribute('class', 'close-button');
|
|
99
|
-
closeButton.setAttribute('data-type', 'icon');
|
|
100
|
-
closeButton.setAttribute('part', 'close-button');
|
|
101
|
-
closeButton.setAttribute('type', 'button');
|
|
102
|
-
closeButton.innerHTML = `
|
|
103
|
-
<svg
|
|
104
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
105
|
-
viewBox="0 0 24 24"
|
|
106
|
-
width="24"
|
|
107
|
-
height="24"
|
|
108
|
-
fill="none"
|
|
109
|
-
>
|
|
110
|
-
<path
|
|
111
|
-
fill="#DBDBC4"
|
|
112
|
-
d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"
|
|
113
|
-
opacity=".4"
|
|
114
|
-
/>
|
|
115
|
-
<path
|
|
116
|
-
fill="#91190F"
|
|
117
|
-
d="m13.06 12 2.3-2.3c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-2.3 2.3-2.3-2.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l2.3 2.3-2.3 2.3c-.29.29-.29.77 0 1.06.15.15.34.22.53.22s.38-.07.53-.22l2.3-2.3 2.3 2.3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-2.3-2.3Z"
|
|
118
|
-
/>
|
|
119
|
-
</svg>
|
|
120
|
-
<span class="visually-hidden"
|
|
121
|
-
>Close SmileIdentity Verification frame</span
|
|
122
|
-
>
|
|
123
|
-
`;
|
|
124
|
-
|
|
125
|
-
shadow.appendChild(style);
|
|
126
|
-
if (this.showBackButton) shadow.appendChild(backButton);
|
|
127
|
-
shadow.appendChild(closeButton);
|
|
128
|
-
|
|
129
|
-
// Back Button Controls
|
|
130
|
-
this.backButton = backButton;
|
|
131
|
-
this.backButton.addEventListener('click', () => this.handleBack());
|
|
132
|
-
|
|
133
|
-
// Close Button Controls
|
|
134
|
-
this.closeButton = closeButton;
|
|
135
|
-
this.closeButton.addEventListener('click', () => this.handleClose());
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
disconnectedCallback() {
|
|
139
|
-
this.backButton.removeEventListener('click', () => this.handleBack());
|
|
140
|
-
this.closeButton.removeEventListener('click', () => this.handleClose());
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
handleBack() {
|
|
144
|
-
this.dispatchEvent(new CustomEvent('navigation.back'));
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
handleClose() {
|
|
148
|
-
this.dispatchEvent(new CustomEvent('navigation.close'));
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
get showBackButton() {
|
|
152
|
-
return !this.hasAttribute('hide-back');
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
get themeColor() {
|
|
156
|
-
return this.getAttribute('theme-color') || '#001096';
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
get hasThemeColor() {
|
|
160
|
-
return this.getAttribute('theme-color')?.trim();
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if (
|
|
165
|
-
'customElements' in window &&
|
|
166
|
-
!window.customElements.get('smileid-navigation')
|
|
167
|
-
) {
|
|
168
|
-
window.customElements.define('smileid-navigation', Navigation);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export default Navigation;
|
|
1
|
+
class Navigation extends HTMLElement {
|
|
2
|
+
connectedCallback() {
|
|
3
|
+
const shadow = this.attachShadow({ mode: 'open' });
|
|
4
|
+
|
|
5
|
+
const style = document.createElement('style');
|
|
6
|
+
style.textContent = `
|
|
7
|
+
:host {
|
|
8
|
+
display: flex;
|
|
9
|
+
max-inline-size: 100%;
|
|
10
|
+
justify-content: ${this.showBackButton ? 'space-between' : 'flex-end'};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
button {
|
|
14
|
+
--button-color: var(--color-default);
|
|
15
|
+
--flow-space: 3rem;
|
|
16
|
+
-webkit-appearance: none;
|
|
17
|
+
-moz-appearance: none;
|
|
18
|
+
align-items: center;
|
|
19
|
+
appearance: none;
|
|
20
|
+
background-color: transparent;
|
|
21
|
+
border-radius: 2.5rem;
|
|
22
|
+
border: none;
|
|
23
|
+
color: #ffffff;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
font-size: 1rem;
|
|
27
|
+
font-weight: 500;
|
|
28
|
+
inline-size: 100%;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
letter-spacing: 0.05ch;
|
|
31
|
+
line-height: 1;
|
|
32
|
+
padding: 1rem 2.5rem;
|
|
33
|
+
text-align: center;
|
|
34
|
+
text-decoration: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
button[data-type="icon"] {
|
|
38
|
+
align-items: center;
|
|
39
|
+
background-color: transparent;
|
|
40
|
+
border: 0;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
display: flex;
|
|
43
|
+
padding: 0;
|
|
44
|
+
width: auto;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:host::part(back-button) {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
:host::part(back-button-text) {
|
|
53
|
+
line-height: 1;
|
|
54
|
+
color: ${this.hasThemeColor ? this.themeColor : 'rgb(21, 31, 114)'} !important;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:host::part(close-button) {
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.visually-hidden {
|
|
61
|
+
clip: rect(0 0 0 0);
|
|
62
|
+
clip-path: inset(50%);
|
|
63
|
+
block-size: 1px;
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
position: absolute;
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
inline-size: 1px;
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
const backButton = document.createElement('button');
|
|
72
|
+
backButton.setAttribute('class', 'back-button');
|
|
73
|
+
backButton.setAttribute('data-type', 'icon');
|
|
74
|
+
backButton.setAttribute('part', 'back-button');
|
|
75
|
+
backButton.setAttribute('type', 'button');
|
|
76
|
+
backButton.innerHTML = `
|
|
77
|
+
<svg
|
|
78
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
79
|
+
width="24"
|
|
80
|
+
height="24"
|
|
81
|
+
viewBox="0 0 24 24"
|
|
82
|
+
fill="none"
|
|
83
|
+
>
|
|
84
|
+
<path
|
|
85
|
+
fill="#DBDBC4"
|
|
86
|
+
d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"
|
|
87
|
+
opacity=".4"
|
|
88
|
+
/>
|
|
89
|
+
<path
|
|
90
|
+
fill="${this.themeColor}"
|
|
91
|
+
d="M15.5 11.25h-5.19l1.72-1.72c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-3 3c-.29.29-.29.77 0 1.06l3 3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-1.72-1.72h5.19c.41 0 .75-.34.75-.75s-.34-.75-.75-.75Z"
|
|
92
|
+
/>
|
|
93
|
+
</svg>
|
|
94
|
+
<span part="back-button-text">Back</span>
|
|
95
|
+
`;
|
|
96
|
+
|
|
97
|
+
const closeButton = document.createElement('button');
|
|
98
|
+
closeButton.setAttribute('class', 'close-button');
|
|
99
|
+
closeButton.setAttribute('data-type', 'icon');
|
|
100
|
+
closeButton.setAttribute('part', 'close-button');
|
|
101
|
+
closeButton.setAttribute('type', 'button');
|
|
102
|
+
closeButton.innerHTML = `
|
|
103
|
+
<svg
|
|
104
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
105
|
+
viewBox="0 0 24 24"
|
|
106
|
+
width="24"
|
|
107
|
+
height="24"
|
|
108
|
+
fill="none"
|
|
109
|
+
>
|
|
110
|
+
<path
|
|
111
|
+
fill="#DBDBC4"
|
|
112
|
+
d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"
|
|
113
|
+
opacity=".4"
|
|
114
|
+
/>
|
|
115
|
+
<path
|
|
116
|
+
fill="#91190F"
|
|
117
|
+
d="m13.06 12 2.3-2.3c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-2.3 2.3-2.3-2.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l2.3 2.3-2.3 2.3c-.29.29-.29.77 0 1.06.15.15.34.22.53.22s.38-.07.53-.22l2.3-2.3 2.3 2.3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-2.3-2.3Z"
|
|
118
|
+
/>
|
|
119
|
+
</svg>
|
|
120
|
+
<span class="visually-hidden"
|
|
121
|
+
>Close SmileIdentity Verification frame</span
|
|
122
|
+
>
|
|
123
|
+
`;
|
|
124
|
+
|
|
125
|
+
shadow.appendChild(style);
|
|
126
|
+
if (this.showBackButton) shadow.appendChild(backButton);
|
|
127
|
+
shadow.appendChild(closeButton);
|
|
128
|
+
|
|
129
|
+
// Back Button Controls
|
|
130
|
+
this.backButton = backButton;
|
|
131
|
+
this.backButton.addEventListener('click', () => this.handleBack());
|
|
132
|
+
|
|
133
|
+
// Close Button Controls
|
|
134
|
+
this.closeButton = closeButton;
|
|
135
|
+
this.closeButton.addEventListener('click', () => this.handleClose());
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
disconnectedCallback() {
|
|
139
|
+
this.backButton.removeEventListener('click', () => this.handleBack());
|
|
140
|
+
this.closeButton.removeEventListener('click', () => this.handleClose());
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
handleBack() {
|
|
144
|
+
this.dispatchEvent(new CustomEvent('navigation.back'));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
handleClose() {
|
|
148
|
+
this.dispatchEvent(new CustomEvent('navigation.close'));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
get showBackButton() {
|
|
152
|
+
return !this.hasAttribute('hide-back');
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
get themeColor() {
|
|
156
|
+
return this.getAttribute('theme-color') || '#001096';
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
get hasThemeColor() {
|
|
160
|
+
return this.getAttribute('theme-color')?.trim();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (
|
|
165
|
+
'customElements' in window &&
|
|
166
|
+
!window.customElements.get('smileid-navigation')
|
|
167
|
+
) {
|
|
168
|
+
window.customElements.define('smileid-navigation', Navigation);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export default Navigation;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import './Navigation';
|
|
2
|
-
|
|
3
|
-
const meta = {
|
|
4
|
-
component: 'smileid-navigation',
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export default meta;
|
|
8
|
-
|
|
9
|
-
export const Navigation = {
|
|
10
|
-
render: () => `
|
|
11
|
-
<smileid-navigation
|
|
12
|
-
>
|
|
13
|
-
</smileid-navigation>
|
|
14
|
-
`,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const NavigationWithBackHidden = {
|
|
18
|
-
render: () => `
|
|
19
|
-
<smileid-navigation
|
|
20
|
-
hide-back
|
|
21
|
-
>
|
|
22
|
-
</smileid-navigation>
|
|
23
|
-
`,
|
|
24
|
-
};
|
|
1
|
+
import './Navigation';
|
|
2
|
+
|
|
3
|
+
const meta = {
|
|
4
|
+
component: 'smileid-navigation',
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export default meta;
|
|
8
|
+
|
|
9
|
+
export const Navigation = {
|
|
10
|
+
render: () => `
|
|
11
|
+
<smileid-navigation
|
|
12
|
+
>
|
|
13
|
+
</smileid-navigation>
|
|
14
|
+
`,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const NavigationWithBackHidden = {
|
|
18
|
+
render: () => `
|
|
19
|
+
<smileid-navigation
|
|
20
|
+
hide-back
|
|
21
|
+
>
|
|
22
|
+
</smileid-navigation>
|
|
23
|
+
`,
|
|
24
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import Navigation from './Navigation';
|
|
2
|
-
|
|
3
|
-
export default Navigation;
|
|
1
|
+
import Navigation from './Navigation';
|
|
2
|
+
|
|
3
|
+
export default Navigation;
|