@duskmoon-dev/el-otp-input 1.7.4 → 1.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/register.js +1 -39
- package/dist/cjs/register.js.map +2 -2
- package/package.json +2 -2
package/dist/cjs/register.js
CHANGED
|
@@ -1,41 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
function __accessProp(key) {
|
|
6
|
-
return this[key];
|
|
7
|
-
}
|
|
8
|
-
var __toCommonJS = (from) => {
|
|
9
|
-
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
10
|
-
if (entry)
|
|
11
|
-
return entry;
|
|
12
|
-
entry = __defProp({}, "__esModule", { value: true });
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (var key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(entry, key))
|
|
16
|
-
__defProp(entry, key, {
|
|
17
|
-
get: __accessProp.bind(from, key),
|
|
18
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
__moduleCache.set(from, entry);
|
|
22
|
-
return entry;
|
|
23
|
-
};
|
|
24
|
-
var __moduleCache;
|
|
25
|
-
var __returnValue = (v) => v;
|
|
26
|
-
function __exportSetter(name, newValue) {
|
|
27
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
28
|
-
}
|
|
29
|
-
var __export = (target, all) => {
|
|
30
|
-
for (var name in all)
|
|
31
|
-
__defProp(target, name, {
|
|
32
|
-
get: all[name],
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
set: __exportSetter.bind(all, name)
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
|
|
39
1
|
// src/el-dm-otp-input.ts
|
|
40
2
|
var import_el_base = require("@duskmoon-dev/el-base");
|
|
41
3
|
var import_otp_input = require("@duskmoon-dev/core/components/otp-input");
|
|
@@ -104,5 +66,5 @@ function register() {
|
|
|
104
66
|
// src/register.ts
|
|
105
67
|
register();
|
|
106
68
|
|
|
107
|
-
//# debugId=
|
|
69
|
+
//# debugId=6C65D6E5C97158C664756E2164756E21
|
|
108
70
|
//# sourceMappingURL=register.js.map
|
package/dist/cjs/register.js.map
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"/**\n * @duskmoon-dev/el-otp-input\n *\n * A one-time password (OTP) input component for verification codes.\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\nimport { css as otpInputCSS } from '@duskmoon-dev/core/components/otp-input';\n\nconst coreStyles = otpInputCSS\n .replace(/@layer\\s+components\\s*\\{/, '')\n .replace(/\\}\\s*$/, '');\n\nexport type OtpInputColor =\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'warning'\n | 'error';\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n :host([hidden]) {\n display: none !important;\n }\n ${coreStyles}\n`;\n\nexport class ElDmOtpInput extends BaseElement {\n static properties = {\n length: { type: Number, reflect: true, default: 6 },\n color: { type: String, reflect: true, default: 'primary' },\n disabled: { type: Boolean, reflect: true },\n };\n\n declare length: number;\n declare color: OtpInputColor;\n declare disabled: boolean;\n\n #listening = false;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n override update(): void {\n super.update();\n if (!this.#listening && this.shadowRoot) {\n this.#listening = true;\n this.shadowRoot.addEventListener('input', this.#onInput.bind(this));\n this.shadowRoot.addEventListener('keydown', this.#onKeydown.bind(this) as EventListener);\n }\n }\n\n #onInput(e: Event): void {\n const input = e.target as HTMLInputElement;\n if (!input.classList.contains('otp-input-field')) return;\n if (input.value.length === 1) {\n const next = input.nextElementSibling as HTMLInputElement | null;\n next?.focus();\n }\n }\n\n #onKeydown(e: KeyboardEvent): void {\n const input = e.target as HTMLInputElement;\n if (!input.classList.contains('otp-input-field')) return;\n if (e.key === 'Backspace' && input.value === '') {\n const prev = input.previousElementSibling as HTMLInputElement | null;\n prev?.focus();\n }\n }\n\n render(): string {\n const len = this.length || 6;\n const colorClass = `otp-input-${this.color || 'primary'}`;\n const fields = Array.from(\n { length: len },\n () =>\n `<input type=\"text\" maxlength=\"1\" class=\"otp-input-field\" ${this.disabled ? 'disabled' : ''} />`\n ).join('');\n return `<div class=\"otp-input ${colorClass}\">${fields}</div>`;\n }\n}\n\nexport function register(): void {\n if (!customElements.get('el-dm-otp-input')) {\n customElements.define('el-dm-otp-input', ElDmOtpInput);\n }\n}\n",
|
|
6
6
|
"/**\n * Auto-registration entry point for el-dm-otp-input\n *\n * Import this module to automatically register the custom element:\n * import '@duskmoon-dev/el-otp-input/register';\n */\n\nimport { register } from './el-dm-otp-input.js';\n\nregister();\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": "
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mappings": ";AAMiC,IAAjC;AACmC,IAAnC;AAEA,IAAM,aAAa,qBAChB,QAAQ,4BAA4B,EAAE,EACtC,QAAQ,UAAU,EAAE;AAUvB,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQX;AAAA;AAAA;AAGG,MAAM,qBAAqB,2BAAY;AAAA,SACrC,aAAa;AAAA,IAClB,QAAQ,EAAE,MAAM,QAAQ,SAAS,MAAM,SAAS,EAAE;AAAA,IAClD,OAAO,EAAE,MAAM,QAAQ,SAAS,MAAM,SAAS,UAAU;AAAA,IACzD,UAAU,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,EAC3C;AAAA,EAMA,aAAa;AAAA,EAEb,WAAW,GAAG;AAAA,IACZ,MAAM;AAAA,IACN,KAAK,aAAa,MAAM;AAAA;AAAA,EAGjB,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names": []
|
|
11
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duskmoon-dev/el-otp-input",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.6",
|
|
4
4
|
"description": "DuskMoon OTP Input custom element for one-time password entry",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"typecheck": "tsc --noEmit"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@duskmoon-dev/el-base": "1.7.
|
|
37
|
+
"@duskmoon-dev/el-base": "1.7.6",
|
|
38
38
|
"@duskmoon-dev/core": "1.18.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|