@magmonium/one 0.4.30 → 0.4.32
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/assets/button_groups/nav_user_actions.json +1 -0
- package/assets/button_groups/notification_filter.json +2 -13
- package/assets/buttons/nav_user_edit_profile.json +5 -0
- package/assets/docs/en/app-release.md +0 -11
- package/assets/i18n/af.json +10 -2
- package/assets/i18n/am.json +10 -1
- package/assets/i18n/ar.json +10 -2
- package/assets/i18n/as.json +11 -2
- package/assets/i18n/az.json +11 -2
- package/assets/i18n/ba.json +8 -0
- package/assets/i18n/be.json +11 -2
- package/assets/i18n/bg.json +11 -2
- package/assets/i18n/bn.json +11 -2
- package/assets/i18n/br.json +7 -0
- package/assets/i18n/bs.json +10 -2
- package/assets/i18n/ca.json +10 -2
- package/assets/i18n/ceb.json +9 -2
- package/assets/i18n/cnr.json +8 -0
- package/assets/i18n/co.json +7 -1
- package/assets/i18n/cs.json +9 -2
- package/assets/i18n/cy.json +11 -2
- package/assets/i18n/da.json +7 -1
- package/assets/i18n/de.json +8 -2
- package/assets/i18n/doi.json +9 -0
- package/assets/i18n/el.json +10 -2
- package/assets/i18n/en.json +21 -4
- package/assets/i18n/eo.json +9 -2
- package/assets/i18n/es.json +9 -2
- package/assets/i18n/et.json +8 -2
- package/assets/i18n/eu.json +9 -2
- package/assets/i18n/fa.json +10 -2
- package/assets/i18n/fi.json +9 -2
- package/assets/i18n/fr.json +9 -2
- package/assets/i18n/fy.json +6 -2
- package/assets/i18n/ga.json +10 -2
- package/assets/i18n/gd.json +9 -2
- package/assets/i18n/gl.json +8 -1
- package/assets/i18n/gu.json +11 -2
- package/assets/i18n/ha.json +7 -1
- package/assets/i18n/haw.json +8 -2
- package/assets/i18n/he.json +8 -0
- package/assets/i18n/hi.json +10 -2
- package/assets/i18n/hmn.json +6 -2
- package/assets/i18n/hr.json +10 -2
- package/assets/i18n/hu.json +10 -2
- package/assets/i18n/hy.json +11 -2
- package/assets/i18n/id.json +10 -2
- package/assets/i18n/ig.json +8 -1
- package/assets/i18n/ilo.json +6 -0
- package/assets/i18n/is.json +10 -2
- package/assets/i18n/it.json +9 -2
- package/assets/i18n/iw.json +9 -1
- package/assets/i18n/ja.json +8 -1
- package/assets/i18n/jw.json +8 -2
- package/assets/i18n/ka.json +10 -2
- package/assets/i18n/kk.json +10 -2
- package/assets/i18n/km.json +10 -2
- package/assets/i18n/kn.json +11 -2
- package/assets/i18n/ko.json +8 -1
- package/assets/i18n/kok.json +9 -0
- package/assets/i18n/ku.json +10 -2
- package/assets/i18n/ky.json +9 -1
- package/assets/i18n/la.json +6 -1
- package/assets/i18n/lb.json +6 -2
- package/assets/i18n/lo.json +10 -2
- package/assets/i18n/lt.json +10 -2
- package/assets/i18n/lv.json +10 -2
- package/assets/i18n/mai.json +9 -0
- package/assets/i18n/mg.json +8 -2
- package/assets/i18n/mi.json +8 -2
- package/assets/i18n/mk.json +10 -2
- package/assets/i18n/ml.json +11 -2
- package/assets/i18n/mn.json +10 -2
- package/assets/i18n/mr.json +11 -2
- package/assets/i18n/ms.json +9 -2
- package/assets/i18n/mt.json +9 -2
- package/assets/i18n/my.json +10 -2
- package/assets/i18n/ne.json +10 -2
- package/assets/i18n/nl.json +6 -2
- package/assets/i18n/no.json +8 -2
- package/assets/i18n/ny.json +9 -2
- package/assets/i18n/or.json +10 -1
- package/assets/i18n/pa.json +11 -2
- package/assets/i18n/pl.json +8 -2
- package/assets/i18n/ps.json +8 -1
- package/assets/i18n/pt.json +9 -2
- package/assets/i18n/ro.json +9 -2
- package/assets/i18n/ru.json +9 -2
- package/assets/i18n/sa.json +9 -0
- package/assets/i18n/sat.json +9 -0
- package/assets/i18n/sd.json +11 -2
- package/assets/i18n/si.json +10 -2
- package/assets/i18n/sk.json +6 -1
- package/assets/i18n/sl.json +10 -2
- package/assets/i18n/sm.json +7 -1
- package/assets/i18n/sn.json +6 -2
- package/assets/i18n/so.json +8 -1
- package/assets/i18n/sq.json +10 -2
- package/assets/i18n/sr.json +10 -2
- package/assets/i18n/st.json +8 -2
- package/assets/i18n/su.json +8 -2
- package/assets/i18n/sv.json +8 -2
- package/assets/i18n/sw.json +10 -2
- package/assets/i18n/ta.json +11 -2
- package/assets/i18n/te.json +11 -2
- package/assets/i18n/tg.json +11 -2
- package/assets/i18n/th.json +10 -1
- package/assets/i18n/tl.json +8 -2
- package/assets/i18n/tr.json +10 -2
- package/assets/i18n/uk.json +11 -2
- package/assets/i18n/ur.json +11 -2
- package/assets/i18n/uz.json +10 -2
- package/assets/i18n/vi.json +10 -1
- package/assets/i18n/xh.json +11 -2
- package/assets/i18n/yi.json +10 -1
- package/assets/i18n/yo.json +9 -1
- package/assets/i18n/zh.json +9 -1
- package/assets/i18n/zu.json +11 -2
- package/assets/index.json +1 -1
- package/fesm2022/magmonium-one-attribute-value-DMI0yJpL.mjs +255 -0
- package/fesm2022/magmonium-one-attribute-value-DMI0yJpL.mjs.map +1 -0
- package/fesm2022/magmonium-one-base-checkbox-C9dvZ2IH.mjs +77 -0
- package/fesm2022/magmonium-one-base-checkbox-C9dvZ2IH.mjs.map +1 -0
- package/fesm2022/magmonium-one-base-dropdown-U-cWl3p9.mjs +604 -0
- package/fesm2022/magmonium-one-base-dropdown-U-cWl3p9.mjs.map +1 -0
- package/fesm2022/magmonium-one-base-input-CLBOTOUs.mjs +183 -0
- package/fesm2022/magmonium-one-base-input-CLBOTOUs.mjs.map +1 -0
- package/fesm2022/magmonium-one-base-text-Zb0oLNRX.mjs +94 -0
- package/fesm2022/magmonium-one-base-text-Zb0oLNRX.mjs.map +1 -0
- package/fesm2022/magmonium-one-button-Bwzaxxn3.mjs +1281 -0
- package/fesm2022/magmonium-one-button-Bwzaxxn3.mjs.map +1 -0
- package/fesm2022/magmonium-one-checkbox-CPQ9m291.mjs +365 -0
- package/fesm2022/magmonium-one-checkbox-CPQ9m291.mjs.map +1 -0
- package/fesm2022/magmonium-one-color-utl-CAbZLKB5.mjs +449 -0
- package/fesm2022/magmonium-one-color-utl-CAbZLKB5.mjs.map +1 -0
- package/fesm2022/magmonium-one-directives-BVKX77zM.mjs +1285 -0
- package/fesm2022/magmonium-one-directives-BVKX77zM.mjs.map +1 -0
- package/fesm2022/magmonium-one-file.service-Bo06pU3_.mjs +65 -0
- package/fesm2022/magmonium-one-file.service-Bo06pU3_.mjs.map +1 -0
- package/fesm2022/magmonium-one-group-D4yYrVP3.mjs +428 -0
- package/fesm2022/magmonium-one-group-D4yYrVP3.mjs.map +1 -0
- package/fesm2022/magmonium-one-header-DmN8M1a3.mjs +380 -0
- package/fesm2022/magmonium-one-header-DmN8M1a3.mjs.map +1 -0
- package/fesm2022/magmonium-one-icon-Ep14YeRY.mjs +833 -0
- package/fesm2022/magmonium-one-icon-Ep14YeRY.mjs.map +1 -0
- package/fesm2022/magmonium-one-image-editor-BX4eNd4u.mjs +438 -0
- package/fesm2022/magmonium-one-image-editor-BX4eNd4u.mjs.map +1 -0
- package/fesm2022/magmonium-one-image-frame-BTSaUSAi.mjs +116 -0
- package/fesm2022/magmonium-one-image-frame-BTSaUSAi.mjs.map +1 -0
- package/fesm2022/magmonium-one-input-DqHPorA1.mjs +39 -0
- package/fesm2022/magmonium-one-input-DqHPorA1.mjs.map +1 -0
- package/fesm2022/magmonium-one-label-D2gjTbKX.mjs +574 -0
- package/fesm2022/magmonium-one-label-D2gjTbKX.mjs.map +1 -0
- package/fesm2022/magmonium-one-m-ref-Bq0gQbKE.mjs +147 -0
- package/fesm2022/magmonium-one-m-ref-Bq0gQbKE.mjs.map +1 -0
- package/fesm2022/magmonium-one-menu-BM9f2knw.mjs +887 -0
- package/fesm2022/magmonium-one-menu-BM9f2knw.mjs.map +1 -0
- package/fesm2022/magmonium-one-multi-range-a3ZVTy7i.mjs +458 -0
- package/fesm2022/magmonium-one-multi-range-a3ZVTy7i.mjs.map +1 -0
- package/fesm2022/magmonium-one-options-asset-CDEXIif6.mjs +97 -0
- package/fesm2022/magmonium-one-options-asset-CDEXIif6.mjs.map +1 -0
- package/fesm2022/magmonium-one-otp-DO4oTeSK.mjs +261 -0
- package/fesm2022/magmonium-one-otp-DO4oTeSK.mjs.map +1 -0
- package/fesm2022/magmonium-one-password-D3oTo41c.mjs +217 -0
- package/fesm2022/magmonium-one-password-D3oTo41c.mjs.map +1 -0
- package/fesm2022/magmonium-one-radio-CkaWESS3.mjs +111 -0
- package/fesm2022/magmonium-one-radio-CkaWESS3.mjs.map +1 -0
- package/fesm2022/magmonium-one-range-D_WEKrli.mjs +216 -0
- package/fesm2022/magmonium-one-range-D_WEKrli.mjs.map +1 -0
- package/fesm2022/magmonium-one-rolldown-runtime-DpJrqANO.mjs +11 -0
- package/fesm2022/magmonium-one-selector-BowevmOd.mjs +1065 -0
- package/fesm2022/magmonium-one-selector-BowevmOd.mjs.map +1 -0
- package/fesm2022/magmonium-one-size-converter-BfT0Aw0g.mjs +1060 -0
- package/fesm2022/magmonium-one-size-converter-BfT0Aw0g.mjs.map +1 -0
- package/fesm2022/magmonium-one-text-B4xKn-EQ.mjs +406 -0
- package/fesm2022/magmonium-one-text-B4xKn-EQ.mjs.map +1 -0
- package/fesm2022/magmonium-one-text-output-CfVeqYM7.mjs +296 -0
- package/fesm2022/magmonium-one-text-output-CfVeqYM7.mjs.map +1 -0
- package/fesm2022/magmonium-one-theme-Xgsx8bJs.mjs +1 -0
- package/fesm2022/magmonium-one-toggle-D2XEbN-b.mjs +231 -0
- package/fesm2022/magmonium-one-toggle-D2XEbN-b.mjs.map +1 -0
- package/fesm2022/magmonium-one.mjs +49250 -2
- package/fesm2022/magmonium-one.mjs.map +1 -1
- package/package.json +8 -8
- package/types/magmonium-one.d.ts +13909 -9533
- package/assets/menu/user_header.json +0 -27
- package/fesm2022/magmonium-one-image-editor-QPOy7XQt.mjs +0 -290
- package/fesm2022/magmonium-one-image-editor-QPOy7XQt.mjs.map +0 -1
- package/fesm2022/magmonium-one-magmonium-one-BTi-rHpF.mjs +0 -41583
- package/fesm2022/magmonium-one-magmonium-one-BTi-rHpF.mjs.map +0 -1
- package/fesm2022/magmonium-one-otp-BcNCgGpz.mjs +0 -201
- package/fesm2022/magmonium-one-otp-BcNCgGpz.mjs.map +0 -1
- package/fesm2022/magmonium-one-password-BDcSzmV_.mjs +0 -105
- package/fesm2022/magmonium-one-password-BDcSzmV_.mjs.map +0 -1
- package/fesm2022/magmonium-one-toggle-bLWTwEHE.mjs +0 -62
- package/fesm2022/magmonium-one-toggle-bLWTwEHE.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"magmonium-one-options-asset-CDEXIif6.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/form/directive/options-source.directive.ts","../../../../libs/one/src/lib/shared/ui/input/lib/options-asset.ts"],"sourcesContent":["import { Directive, input } from '@angular/core';\n\n/**\n * Names the AssetOptions list a Field chooses from (CONTEXT.md OptionsSource).\n * The markup spelling of the `optionsAsset:` config key, added beside it rather\n * than in place of it (ADR 0010) — a Field still described by a file keeps\n * declaring the key inside that file.\n *\n * Carries the name and nothing else. Resolution stays where it already lives,\n * in the inputs that read `config.optionsAsset` — the SectionFormItem folds\n * this name into its config, so a Dropdown or a SelectableCard cannot tell\n * which of the two spellings it came from, and there is no second resolver to\n * drift from the first.\n */\n@Directive({\n selector: '[mOptions]',\n})\nexport class OptionsSourceDirective {\n readonly name = input<string | undefined>(undefined, { alias: 'mOptions' });\n}\n","import { computed, effect, inject, Signal, untracked } from '@angular/core';\nimport { rxResource } from '@angular/core/rxjs-interop';\nimport { of } from 'rxjs';\nimport { DropdownOption, DropdownValue } from '../model/input';\nimport { AssetStore } from '../../../stores/asset.store';\nimport { OPTIONS_SOURCE } from '../../../config/tokens';\n// Direct path rather than the form barrel: the barrel pulls in the form's\n// components, which import these inputs back.\nimport { OptionsSourceDirective } from '../../form/directive/options-source.directive';\n\n// One row of a `mag_assets/options/<name>.yml` asset. `id` is accepted\n// alongside `value` because option assets predate the field types that read\n// them, and several were written with `id`.\nexport type AssetOption = {\n id?: string;\n value?: string;\n label: string;\n icon?: string;\n disabled?: boolean;\n default?: boolean;\n};\n\n// Option assets are written either flat or as rows of rows (the same shape a\n// form's `inputs` uses), so both are flattened before mapping.\nexport function normalizeAssetOptions(\n data: AssetOption[] | AssetOption[][] | undefined\n): DropdownOption[] {\n if (!data?.length) return [];\n const flat: AssetOption[] = Array.isArray(data[0])\n ? (data as AssetOption[][]).flat()\n : (data as AssetOption[]);\n return flat.map((option) => ({\n value: option.value ?? option.id ?? '',\n label: option.label,\n icon: option.icon,\n disabled: option.disabled,\n ...(option.default === true ? { default: true } : {}),\n }));\n}\n\n/**\n * The choices an OptionsSource resolves to, for whichever Field reads it —\n * Dropdown, SelectableCard, ToggleRadio. One resolver rather than one per\n * Field: the name means the same list wherever it is written, and a second\n * copy of this would be a second answer that could drift.\n *\n * The name comes from the `mOptions` directive on the Field's tag, which is\n * the spelling of the list key (ADR 0010). An `optionsAsset:` written in a\n * field asset is passed in by the Fields that still read one, and outranks the\n * directive — the nearer declaration wins, same order every other key follows.\n * The directive is injected rather than passed because an input created inside\n * a `m-section-form-item` sits under that item's host, where the directive is.\n *\n * OPTIONS_SOURCE is read ahead of the fetch, so a list held only in memory (a\n * visual editor's unsaved OptionSets) fills the Field without ever being a\n * file. Must be called from an injection context.\n */\nexport function assetOptions(\n name?: () => string | undefined\n): Signal<DropdownOption[]> {\n const assetStore = inject(AssetStore);\n const optionsSource = inject(OPTIONS_SOURCE, { optional: true });\n const directive = inject(OptionsSourceDirective, { optional: true });\n\n const assetName = computed(\n () => name?.()?.trim() || directive?.name()?.trim() || undefined\n );\n\n const suppliedRows = computed(() => {\n const key = assetName();\n if (!key) return undefined;\n const rows = optionsSource?.()?.[key];\n return Array.isArray(rows)\n ? (rows as AssetOption[] | AssetOption[][])\n : undefined;\n });\n\n const resource = rxResource({\n // A supplied list is the answer, so the fetch never starts — asking for a\n // file that exists only in memory would 404 on every keystroke that edits it.\n params: () => (suppliedRows() ? undefined : assetName()),\n stream: ({ params }) => {\n if (!params) return of(undefined);\n return assetStore.resolve<AssetOption[] | AssetOption[][]>(\n 'options',\n params,\n true\n );\n },\n });\n\n return computed(() =>\n normalizeAssetOptions(suppliedRows() ?? resource.value())\n );\n}\n\n/** Whether a Field holds nothing yet — no scalar, an empty string or list. */\nconst isEmptyValue = (value: unknown): boolean =>\n value === undefined ||\n value === null ||\n value === '' ||\n (Array.isArray(value) && value.length === 0);\n\n/**\n * Starts a Field on its list's `default` row when it holds no value of its own\n * (m-one-ui CONTEXT.md OptionSet). The Field's own value — its config, its form\n * data — outranks the row, so a value already held is kept.\n *\n * Each marked row is consulted once: a User who clears the pick is not handed\n * it back, and only a list that moves its mark offers the new row. A disabled\n * row is never preset — the User could not have picked it either. Must be\n * called from an injection context.\n */\nexport function presetDefaultOption(\n options: () => readonly DropdownOption<DropdownValue>[],\n current: () => unknown,\n apply: (value: DropdownValue) => void\n): void {\n let consulted: DropdownValue | undefined;\n effect(() => {\n const row = options().find((option) => option.default && !option.disabled);\n if (!row || row.value === consulted) return;\n consulted = row.value;\n untracked(() => {\n if (isEmptyValue(current())) apply(row.value);\n });\n });\n}\n"],"mappings":";;;;;AAiBA,IAAa,yBAAb,MAAa,uBAAsB;CACxB,OAAO,MAA0B,QAAS;EAAA,GAAA,YAAA,EAAA,WAAA,OAAA,+BAAA,CAAA;EAAI,OAAO;CAAU,CAAA;CAD7D,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAsB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAtB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAsB,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,MAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,UAAA;CAAA,CAAA;;AAAtB,GAAA,yBAAA;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AY,KAAM,SAAS,MAAK,CAAE,CAAC;AAE7D;AAGA,MAAM,gBAAgB,UACpB,UAAU,UACV,UAAU,QACV,UAAU,MACT,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW;AAY5C,SAAgB,oBACd,SACA,SACA,OAAqC;CAErC,IAAI;CACJ,aAAY;EACV,MAAM,MAAM,QAAO,CAAE,CAAC,MAAM,WAAW,OAAO,WAAW,CAAC,OAAO,QAAQ;EACzE,IAAI,CAAC,OAAO,IAAI,UAAU,WAAW;EACrC,YAAY,IAAI;EAChB,gBAAe;GACb,IAAI,aAAa,QAAO,CAAE,GAAG,MAAM,IAAI,KAAK;EAC9C,CAAC;CACH,CAAC;AACH"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { B as IS_DESIGN_MODE } from "./magmonium-one-size-converter-BfT0Aw0g.mjs";
|
|
2
|
+
import { t as LabelComponent } from "./magmonium-one-label-D2gjTbKX.mjs";
|
|
3
|
+
import { t as TextOutputComponent } from "./magmonium-one-text-output-CfVeqYM7.mjs";
|
|
4
|
+
import { t as BaseTextInputComponent } from "./magmonium-one-base-text-Zb0oLNRX.mjs";
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
import { ChangeDetectionStrategy, Component, afterRenderEffect, computed, effect, inject, signal, untracked, viewChildren } from "@angular/core";
|
|
7
|
+
import { CommonModule } from "@angular/common";
|
|
8
|
+
var OtpInputComponent = class OtpInputComponent extends BaseTextInputComponent {
|
|
9
|
+
otpValues = signal([], ...ngDevMode ? [{ debugName: "otpValues" }] : /* istanbul ignore next */ []);
|
|
10
|
+
otpInputs = viewChildren("otpInput", ...ngDevMode ? [{ debugName: "otpInputs" }] : /* istanbul ignore next */ []);
|
|
11
|
+
otpConfig = computed(() => this.config(), ...ngDevMode ? [{ debugName: "otpConfig" }] : /* istanbul ignore next */ []);
|
|
12
|
+
otpArray = computed(() => {
|
|
13
|
+
const length = this.otpConfig()?.length || 6;
|
|
14
|
+
return Array(length).fill(0);
|
|
15
|
+
}, ...ngDevMode ? [{ debugName: "otpArray" }] : /* istanbul ignore next */ []);
|
|
16
|
+
isDesignMode = !!inject(IS_DESIGN_MODE, { optional: true });
|
|
17
|
+
isDisabled = computed(() => this.isDesignMode || this.disabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
18
|
+
hasAutofocused = false;
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
effect(() => {
|
|
22
|
+
const length = this.otpConfig()?.length || 6;
|
|
23
|
+
this.otpValues.set(Array(length).fill(""));
|
|
24
|
+
});
|
|
25
|
+
afterRenderEffect(() => {
|
|
26
|
+
const inputs = this.otpInputs();
|
|
27
|
+
if (!this.focused() || !inputs.length || this.hasAutofocused) return;
|
|
28
|
+
this.hasAutofocused = true;
|
|
29
|
+
untracked(() => this.focusInput(0));
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
onInput = (event, index) => {
|
|
33
|
+
if (this.isDisabled()) return;
|
|
34
|
+
const input = event.target;
|
|
35
|
+
let value = input.value;
|
|
36
|
+
value = value.replace(/[^a-zA-Z0-9]/g, "");
|
|
37
|
+
if (value.length > 1) value = value.slice(-1);
|
|
38
|
+
input.value = value.toUpperCase();
|
|
39
|
+
const newValues = [...this.otpValues()];
|
|
40
|
+
newValues[index] = value.toUpperCase();
|
|
41
|
+
this.otpValues.set(newValues);
|
|
42
|
+
const length = this.otpConfig()?.length || 6;
|
|
43
|
+
if (value && index < length - 1) this.focusInput(index + 1);
|
|
44
|
+
this.updateValue();
|
|
45
|
+
};
|
|
46
|
+
onKeyDown = (event, index) => {
|
|
47
|
+
if (this.isDisabled()) return;
|
|
48
|
+
const input = event.target;
|
|
49
|
+
const length = this.otpConfig()?.length || 6;
|
|
50
|
+
const isAlphaNumeric = /^[a-zA-Z0-9]$/.test(event.key);
|
|
51
|
+
const isControlKey = [
|
|
52
|
+
"Backspace",
|
|
53
|
+
"Delete",
|
|
54
|
+
"ArrowLeft",
|
|
55
|
+
"ArrowRight",
|
|
56
|
+
"Tab"
|
|
57
|
+
].includes(event.key);
|
|
58
|
+
if (!isAlphaNumeric && !isControlKey) {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (event.key === "Backspace") {
|
|
63
|
+
if (!input.value && index > 0) this.focusInput(index - 1);
|
|
64
|
+
}
|
|
65
|
+
if (event.key === "ArrowLeft" && index > 0) {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
this.focusInput(index - 1);
|
|
68
|
+
}
|
|
69
|
+
if (event.key === "ArrowRight" && index < length - 1) {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
this.focusInput(index + 1);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
onPaste = (event) => {
|
|
75
|
+
if (this.isDisabled()) return;
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
event.stopPropagation();
|
|
78
|
+
const length = this.otpConfig()?.length || 6;
|
|
79
|
+
const alphanumeric = (event.clipboardData?.getData("text") || "").replace(/[^a-zA-Z0-9]/g, "").slice(0, length);
|
|
80
|
+
if (alphanumeric.length > 0) {
|
|
81
|
+
const newValues = Array(length).fill("");
|
|
82
|
+
alphanumeric.split("").forEach((char, index) => {
|
|
83
|
+
if (index < length) newValues[index] = char.toUpperCase();
|
|
84
|
+
});
|
|
85
|
+
this.otpValues.set(newValues);
|
|
86
|
+
this.updateValue();
|
|
87
|
+
const focusIndex = Math.min(alphanumeric.length, length - 1);
|
|
88
|
+
setTimeout(() => this.focusInput(focusIndex), 0);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
focusInput(index) {
|
|
92
|
+
if (this.isDisabled()) return;
|
|
93
|
+
const inputs = this.otpInputs();
|
|
94
|
+
if (inputs[index]) inputs[index].nativeElement.focus();
|
|
95
|
+
}
|
|
96
|
+
updateValue() {
|
|
97
|
+
const otpValue = this.otpValues().join("");
|
|
98
|
+
this.setValue(otpValue);
|
|
99
|
+
}
|
|
100
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
101
|
+
minVersion: "12.0.0",
|
|
102
|
+
version: "22.2.1",
|
|
103
|
+
ngImport: i0,
|
|
104
|
+
type: OtpInputComponent,
|
|
105
|
+
deps: [],
|
|
106
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
107
|
+
});
|
|
108
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
109
|
+
minVersion: "17.0.0",
|
|
110
|
+
version: "22.2.1",
|
|
111
|
+
type: OtpInputComponent,
|
|
112
|
+
isStandalone: true,
|
|
113
|
+
selector: "m-otp-input",
|
|
114
|
+
viewQueries: [{
|
|
115
|
+
propertyName: "otpInputs",
|
|
116
|
+
predicate: ["otpInput"],
|
|
117
|
+
descendants: true,
|
|
118
|
+
isSignal: true
|
|
119
|
+
}],
|
|
120
|
+
usesInheritance: true,
|
|
121
|
+
ngImport: i0,
|
|
122
|
+
template: `
|
|
123
|
+
@if (otpConfig(); as otp) {
|
|
124
|
+
<m-label
|
|
125
|
+
[for]="otp.name"
|
|
126
|
+
[placeholder]="otp.label"
|
|
127
|
+
[params]="otp.params"
|
|
128
|
+
[required]="required()"
|
|
129
|
+
[disabled]="isDisabled()"
|
|
130
|
+
/>
|
|
131
|
+
<div class="otp-container">
|
|
132
|
+
@for (item of otpArray(); track $index) {
|
|
133
|
+
<input
|
|
134
|
+
[id]="$index === 0 ? (otp.name ?? '') : ''"
|
|
135
|
+
#otpInput
|
|
136
|
+
type="text"
|
|
137
|
+
maxlength="1"
|
|
138
|
+
[class.error]="showErrors()"
|
|
139
|
+
[disabled]="isDisabled()"
|
|
140
|
+
[value]="otpValues()[$index] || ''"
|
|
141
|
+
(input)="onInput($event, $index)"
|
|
142
|
+
(keydown)="onKeyDown($event, $index)"
|
|
143
|
+
(paste)="onPaste($event)"
|
|
144
|
+
/>
|
|
145
|
+
}
|
|
146
|
+
</div>
|
|
147
|
+
@if (showErrors()) {
|
|
148
|
+
@for (error of errors(); track $index) {
|
|
149
|
+
<m-text-output
|
|
150
|
+
variant="footer"
|
|
151
|
+
color="error"
|
|
152
|
+
[label]="error.message"
|
|
153
|
+
/>
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
`,
|
|
158
|
+
isInline: true,
|
|
159
|
+
styles: ["@keyframes toggle-pulse{0%,to{transform:scale(1)}50%{transform:scale(1.02)}}@keyframes thumb-slide{0%{transform:translate(0) scale(1)}50%{transform:translate(.3em) scale(.9)}to{transform:translate(.6em) scale(1)}}:host{display:block;width:100%}.otp-container{display:flex;width:100%;justify-content:space-between;gap:var(--m-otp-input-gap, .375em )}.otp-container input{appearance:none;box-sizing:border-box;flex:0 0 auto;width:calc(var(--input-size, 1em) * 2.25);height:calc(var(--input-size, 1em) * 2.25);min-height:calc(var(--input-size, 1em) * 2.25);text-align:center;font-size:var(--input-size, 1em);font-weight:var(--m-otp-input-font-weight, 600);font-family:inherit;color:var(--m-otp-input-color, var(--m-text-input-color, var(--m-text)));background:var(--m-otp-input-background, var(--m-text-input-background, var(--m-background)));border-width:var(--m-otp-input-border-width, var(--m-input-border-width, 2px));border-style:solid;border-color:var(--m-otp-input-border, var(--m-text-input-border, var(--m-input-color, var(--m-mm))));border-radius:var(--m-otp-input-radius, var(--m-input-radius, 4px));transition:var(--m-otp-input-transition, var(--m-text-input-transition, border-color .2s ease, box-shadow .2s ease));text-transform:uppercase;box-shadow:var(--m-text-input-shadow, none)}.otp-container input:hover:not(:disabled):not(.error){border-color:var(--m-otp-input-hover-border, var(--m-text-input-hover-border, color-mix(in srgb, var(--m-input-color, var(--m-mm)) 45%, rgba(0, 0, 0, .12))));background:var(--m-otp-input-hover-background, var(--m-text-input-hover-background, var(--m-text-input-background, var(--m-background))))}.otp-container input:focus{outline:none;border-color:var(--m-otp-input-focus-border, var(--m-text-input-focus-border, color-mix(in srgb, var(--m-focus) 45%, transparent)));box-shadow:var(--m-text-input-shadow, none);background:var(--m-otp-input-focus-background, var(--m-text-input-focus-background, var(--m-text-input-background, var(--m-background))))}.otp-container input.error{border-color:var(--m-error);box-shadow:none}.otp-container input:disabled{background-color:var(--m-frame);cursor:not-allowed;color:var(--m-text-tertiary);border-color:var(--m-border);opacity:.6}\n"],
|
|
160
|
+
dependencies: [
|
|
161
|
+
{
|
|
162
|
+
kind: "component",
|
|
163
|
+
type: LabelComponent,
|
|
164
|
+
selector: "m-label",
|
|
165
|
+
inputs: [
|
|
166
|
+
"for",
|
|
167
|
+
"placeholder",
|
|
168
|
+
"params",
|
|
169
|
+
"required",
|
|
170
|
+
"disabled",
|
|
171
|
+
"color",
|
|
172
|
+
"noTranslate"
|
|
173
|
+
]
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
kind: "component",
|
|
177
|
+
type: TextOutputComponent,
|
|
178
|
+
selector: "m-text-output",
|
|
179
|
+
inputs: [
|
|
180
|
+
"config",
|
|
181
|
+
"align",
|
|
182
|
+
"variant",
|
|
183
|
+
"color",
|
|
184
|
+
"fontWeight",
|
|
185
|
+
"label",
|
|
186
|
+
"noTranslate",
|
|
187
|
+
"params"
|
|
188
|
+
],
|
|
189
|
+
outputs: ["configChange", "clicked"]
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
kind: "ngmodule",
|
|
193
|
+
type: CommonModule
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
200
|
+
minVersion: "12.0.0",
|
|
201
|
+
version: "22.2.1",
|
|
202
|
+
ngImport: i0,
|
|
203
|
+
type: OtpInputComponent,
|
|
204
|
+
decorators: [{
|
|
205
|
+
type: Component,
|
|
206
|
+
args: [{
|
|
207
|
+
selector: "m-otp-input",
|
|
208
|
+
template: `
|
|
209
|
+
@if (otpConfig(); as otp) {
|
|
210
|
+
<m-label
|
|
211
|
+
[for]="otp.name"
|
|
212
|
+
[placeholder]="otp.label"
|
|
213
|
+
[params]="otp.params"
|
|
214
|
+
[required]="required()"
|
|
215
|
+
[disabled]="isDisabled()"
|
|
216
|
+
/>
|
|
217
|
+
<div class="otp-container">
|
|
218
|
+
@for (item of otpArray(); track $index) {
|
|
219
|
+
<input
|
|
220
|
+
[id]="$index === 0 ? (otp.name ?? '') : ''"
|
|
221
|
+
#otpInput
|
|
222
|
+
type="text"
|
|
223
|
+
maxlength="1"
|
|
224
|
+
[class.error]="showErrors()"
|
|
225
|
+
[disabled]="isDisabled()"
|
|
226
|
+
[value]="otpValues()[$index] || ''"
|
|
227
|
+
(input)="onInput($event, $index)"
|
|
228
|
+
(keydown)="onKeyDown($event, $index)"
|
|
229
|
+
(paste)="onPaste($event)"
|
|
230
|
+
/>
|
|
231
|
+
}
|
|
232
|
+
</div>
|
|
233
|
+
@if (showErrors()) {
|
|
234
|
+
@for (error of errors(); track $index) {
|
|
235
|
+
<m-text-output
|
|
236
|
+
variant="footer"
|
|
237
|
+
color="error"
|
|
238
|
+
[label]="error.message"
|
|
239
|
+
/>
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
`,
|
|
244
|
+
imports: [
|
|
245
|
+
LabelComponent,
|
|
246
|
+
TextOutputComponent,
|
|
247
|
+
CommonModule
|
|
248
|
+
],
|
|
249
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
250
|
+
styles: ["@keyframes toggle-pulse{0%,to{transform:scale(1)}50%{transform:scale(1.02)}}@keyframes thumb-slide{0%{transform:translate(0) scale(1)}50%{transform:translate(.3em) scale(.9)}to{transform:translate(.6em) scale(1)}}:host{display:block;width:100%}.otp-container{display:flex;width:100%;justify-content:space-between;gap:var(--m-otp-input-gap, .375em )}.otp-container input{appearance:none;box-sizing:border-box;flex:0 0 auto;width:calc(var(--input-size, 1em) * 2.25);height:calc(var(--input-size, 1em) * 2.25);min-height:calc(var(--input-size, 1em) * 2.25);text-align:center;font-size:var(--input-size, 1em);font-weight:var(--m-otp-input-font-weight, 600);font-family:inherit;color:var(--m-otp-input-color, var(--m-text-input-color, var(--m-text)));background:var(--m-otp-input-background, var(--m-text-input-background, var(--m-background)));border-width:var(--m-otp-input-border-width, var(--m-input-border-width, 2px));border-style:solid;border-color:var(--m-otp-input-border, var(--m-text-input-border, var(--m-input-color, var(--m-mm))));border-radius:var(--m-otp-input-radius, var(--m-input-radius, 4px));transition:var(--m-otp-input-transition, var(--m-text-input-transition, border-color .2s ease, box-shadow .2s ease));text-transform:uppercase;box-shadow:var(--m-text-input-shadow, none)}.otp-container input:hover:not(:disabled):not(.error){border-color:var(--m-otp-input-hover-border, var(--m-text-input-hover-border, color-mix(in srgb, var(--m-input-color, var(--m-mm)) 45%, rgba(0, 0, 0, .12))));background:var(--m-otp-input-hover-background, var(--m-text-input-hover-background, var(--m-text-input-background, var(--m-background))))}.otp-container input:focus{outline:none;border-color:var(--m-otp-input-focus-border, var(--m-text-input-focus-border, color-mix(in srgb, var(--m-focus) 45%, transparent)));box-shadow:var(--m-text-input-shadow, none);background:var(--m-otp-input-focus-background, var(--m-text-input-focus-background, var(--m-text-input-background, var(--m-background))))}.otp-container input.error{border-color:var(--m-error);box-shadow:none}.otp-container input:disabled{background-color:var(--m-frame);cursor:not-allowed;color:var(--m-text-tertiary);border-color:var(--m-border);opacity:.6}\n"]
|
|
251
|
+
}]
|
|
252
|
+
}],
|
|
253
|
+
ctorParameters: () => [],
|
|
254
|
+
propDecorators: { otpInputs: [{
|
|
255
|
+
type: i0.ViewChildren,
|
|
256
|
+
args: ["otpInput", { isSignal: true }]
|
|
257
|
+
}] }
|
|
258
|
+
});
|
|
259
|
+
export { OtpInputComponent };
|
|
260
|
+
|
|
261
|
+
//# sourceMappingURL=magmonium-one-otp-DO4oTeSK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"magmonium-one-otp-DO4oTeSK.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/ui/text/otp.ts"],"sourcesContent":["import {\n afterRenderEffect,\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n ElementRef,\n inject,\n signal,\n untracked,\n viewChildren,\n} from '@angular/core';\nimport { LabelComponent } from '../label';\nimport { TextOutputComponent } from '../../../text-output';\nimport { BaseTextInputComponent } from './base-text';\nimport { CommonModule } from '@angular/common';\nimport { OtpInput } from '../../model/input';\nimport { IS_DESIGN_MODE } from '../../../../config/tokens';\n\n@Component({\n selector: 'm-otp-input',\n template: `\n @if (otpConfig(); as otp) {\n <m-label\n [for]=\"otp.name\"\n [placeholder]=\"otp.label\"\n [params]=\"otp.params\"\n [required]=\"required()\"\n [disabled]=\"isDisabled()\"\n />\n <div class=\"otp-container\">\n @for (item of otpArray(); track $index) {\n <input\n [id]=\"$index === 0 ? (otp.name ?? '') : ''\"\n #otpInput\n type=\"text\"\n maxlength=\"1\"\n [class.error]=\"showErrors()\"\n [disabled]=\"isDisabled()\"\n [value]=\"otpValues()[$index] || ''\"\n (input)=\"onInput($event, $index)\"\n (keydown)=\"onKeyDown($event, $index)\"\n (paste)=\"onPaste($event)\"\n />\n }\n </div>\n @if (showErrors()) {\n @for (error of errors(); track $index) {\n <m-text-output\n variant=\"footer\"\n color=\"error\"\n [label]=\"error.message\"\n />\n }\n }\n }\n `,\n styleUrl: './otp.sass',\n imports: [LabelComponent, TextOutputComponent, CommonModule],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class OtpInputComponent extends BaseTextInputComponent<OtpInput> {\n otpValues = signal<string[]>([]);\n otpInputs = viewChildren<ElementRef<HTMLInputElement>>('otpInput');\n protected readonly otpConfig = computed(() => this.config() as OtpInput);\n otpArray = computed(() => {\n const length = this.otpConfig()?.length || 6;\n return Array(length).fill(0);\n });\n\n // Inert on the Canvas — other inputs stay idle because they never autofocus;\n // OTP used to steal focus and look live while composing (DesignMode).\n private readonly isDesignMode = !!inject(IS_DESIGN_MODE, { optional: true });\n protected readonly isDisabled = computed(\n () => this.isDesignMode || this.disabled()\n );\n\n // BaseText answers `focused` by focusing its `#inputElement`, and an OTP has\n // none — it has a row of boxes. Without this the caret never lands on an OTP\n // field, so the form that opens on one (login's verification step) reads as\n // dead until the User clicks it.\n private hasAutofocused = false;\n\n constructor() {\n super();\n effect(() => {\n const length = this.otpConfig()?.length || 6;\n this.otpValues.set(Array(length).fill(''));\n });\n\n afterRenderEffect(() => {\n const inputs = this.otpInputs();\n if (!this.focused() || !inputs.length || this.hasAutofocused) return;\n this.hasAutofocused = true;\n untracked(() => this.focusInput(0));\n });\n }\n\n onInput = (event: Event, index: number): void => {\n if (this.isDisabled()) return;\n const input = event.target as HTMLInputElement;\n let value = input.value;\n\n value = value.replace(/[^a-zA-Z0-9]/g, '');\n\n if (value.length > 1) {\n value = value.slice(-1);\n }\n\n input.value = value.toUpperCase();\n\n const newValues = [...this.otpValues()];\n newValues[index] = value.toUpperCase();\n this.otpValues.set(newValues);\n\n const length = this.otpConfig()?.length || 6;\n if (value && index < length - 1) {\n this.focusInput(index + 1);\n }\n this.updateValue();\n };\n\n onKeyDown = (event: KeyboardEvent, index: number): void => {\n if (this.isDisabled()) return;\n const input = event.target as HTMLInputElement;\n const length = this.otpConfig()?.length || 6;\n\n const isAlphaNumeric = /^[a-zA-Z0-9]$/.test(event.key);\n const isControlKey = [\n 'Backspace',\n 'Delete',\n 'ArrowLeft',\n 'ArrowRight',\n 'Tab',\n ].includes(event.key);\n\n if (!isAlphaNumeric && !isControlKey) {\n event.preventDefault();\n return;\n }\n\n if (event.key === 'Backspace') {\n if (!input.value && index > 0) {\n this.focusInput(index - 1);\n }\n }\n if (event.key === 'ArrowLeft' && index > 0) {\n event.preventDefault();\n this.focusInput(index - 1);\n }\n if (event.key === 'ArrowRight' && index < length - 1) {\n event.preventDefault();\n this.focusInput(index + 1);\n }\n };\n\n onPaste = (event: ClipboardEvent): void => {\n if (this.isDisabled()) return;\n event.preventDefault();\n event.stopPropagation();\n\n const length = this.otpConfig()?.length || 6;\n const pastedData = event.clipboardData?.getData('text') || '';\n\n const alphanumeric = pastedData\n .replace(/[^a-zA-Z0-9]/g, '')\n .slice(0, length);\n\n if (alphanumeric.length > 0) {\n const newValues = Array(length).fill('');\n alphanumeric.split('').forEach((char, index) => {\n if (index < length) {\n newValues[index] = char.toUpperCase();\n }\n });\n\n this.otpValues.set(newValues);\n this.updateValue();\n\n const focusIndex = Math.min(alphanumeric.length, length - 1);\n setTimeout(() => this.focusInput(focusIndex), 0);\n }\n };\n\n private focusInput(index: number): void {\n if (this.isDisabled()) return;\n const inputs = this.otpInputs();\n if (inputs[index]) {\n inputs[index].nativeElement.focus();\n }\n }\n\n private updateValue(): void {\n const otpValue = this.otpValues().join('');\n this.setValue(otpValue);\n }\n}\n"],"mappings":";;;;;;;AA6DA,IAAa,oBAAb,MAAa,0BAA0B,uBAAgC;CACrE,YAAY,OAAiB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,YAAY,aAA2C,YAAW,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAC/C,YAAY,eAAe,KAAK,OAAM,GAAe,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CACxE,WAAW,eAAc;EACvB,MAAM,SAAS,KAAK,UAAS,CAAE,EAAE,UAAU;EAC3C,OAAO,MAAM,MAAM,CAAC,CAAC,KAAK,CAAC;CAC7B,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAIe,eAAe,CAAC,CAAC,OAAO,gBAAgB,EAAE,UAAU,KAAI,CAAE;CACxD,aAAa,eACxB,KAAK,gBAAgB,KAAK,SAAQ,GACzC,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAMO,iBAAiB;CAEzB,cAAA;EACE,MAAK;EACL,aAAY;GACV,MAAM,SAAS,KA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EAAA,SAAA;EAAA,MAAA;EAAiB,cAAA;EAAA,UAAA;EAAA,aAAA,CAAA;GAAA,cAAA;GAAA,WAAA,CAAA,UAAA;GAAA,aAAA;GAAA,UAAA;EAAA,CAAA;EAAA,iBAAA;EAAA,UAAA;EAAA,UAxClB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCT,UAAA;EAAA,QAAA,CAAA,+qEAAA;EAAA,cAAA;GAAA;IAAA,MAAA;IAAA,MAES;IAAc,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAmB,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,gBAAA,SAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;GAAY;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAGhD,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAiB,YAAA,CAAA;EA1C7B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAa,UACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCT,SAEQ;IAAC;IAAgB;IAAqB;GAAY;GAAC,iBAC3C,wBAAwB;GAAM,QAAA,CAAA,+qEAAA;EAAA,CAAA;CAIQ,CAAA;CAAA,sBAAA,CAAA;CAAA,gBAAA,EAAA,WAAA,CAAA;EAAA,MAAA,GAAA;EAAA,MAAA,CAAA,YAAU,EAAA,UAAA,KAAA,CAAA;CAAA,CAAA,EAAA;AAAA,CAAA"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { c as TranslatePipe } from "./magmonium-one-size-converter-BfT0Aw0g.mjs";
|
|
2
|
+
import { t as LabelComponent } from "./magmonium-one-label-D2gjTbKX.mjs";
|
|
3
|
+
import { t as ButtonComponent } from "./magmonium-one-button-Bwzaxxn3.mjs";
|
|
4
|
+
import { t as TextOutputComponent } from "./magmonium-one-text-output-CfVeqYM7.mjs";
|
|
5
|
+
import { t as BaseTextInputComponent } from "./magmonium-one-base-text-Zb0oLNRX.mjs";
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
import { ChangeDetectionStrategy, Component, computed, signal } from "@angular/core";
|
|
8
|
+
var PasswordInputComponent = class PasswordInputComponent extends BaseTextInputComponent {
|
|
9
|
+
isPassword = signal(true, ...ngDevMode ? [{ debugName: "isPassword" }] : /* istanbul ignore next */ []);
|
|
10
|
+
type = computed(() => this.isPassword() ? "password" : "text", ...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
|
|
11
|
+
button = computed(() => !this.isPassword() ? "eye" : "eye_close", ...ngDevMode ? [{ debugName: "button" }] : /* istanbul ignore next */ []);
|
|
12
|
+
toggleType() {
|
|
13
|
+
this.isPassword.update((now) => !now);
|
|
14
|
+
}
|
|
15
|
+
onInput(event) {
|
|
16
|
+
const target = event.target;
|
|
17
|
+
this.setValue(target?.value ?? "");
|
|
18
|
+
}
|
|
19
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
20
|
+
minVersion: "12.0.0",
|
|
21
|
+
version: "22.2.1",
|
|
22
|
+
ngImport: i0,
|
|
23
|
+
type: PasswordInputComponent,
|
|
24
|
+
deps: null,
|
|
25
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
26
|
+
});
|
|
27
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
28
|
+
minVersion: "17.0.0",
|
|
29
|
+
version: "22.2.1",
|
|
30
|
+
type: PasswordInputComponent,
|
|
31
|
+
isStandalone: true,
|
|
32
|
+
selector: "m-password-input",
|
|
33
|
+
usesInheritance: true,
|
|
34
|
+
ngImport: i0,
|
|
35
|
+
template: `
|
|
36
|
+
@if (config(); as text) {
|
|
37
|
+
<m-label
|
|
38
|
+
[for]="text.name"
|
|
39
|
+
[placeholder]="text.label"
|
|
40
|
+
[params]="text.params"
|
|
41
|
+
[required]="required()"
|
|
42
|
+
[disabled]="disabled()"
|
|
43
|
+
/>
|
|
44
|
+
<div class="input-wrapper">
|
|
45
|
+
<input
|
|
46
|
+
[id]="text.name ?? ''"
|
|
47
|
+
[attr.data-testid]="text.testid ?? (text.name ? text.name + '-input' : null)"
|
|
48
|
+
[value]="value()"
|
|
49
|
+
#inputElement
|
|
50
|
+
[class.error]="showErrors()"
|
|
51
|
+
[disabled]="disabled()"
|
|
52
|
+
[placeholder]="(text.placeholder ?? '') | translate: text.params"
|
|
53
|
+
(input)="onInput($event)"
|
|
54
|
+
(focus)="isFocused.set(true)"
|
|
55
|
+
(blur)="isFocused.set(false); touched.set(true)"
|
|
56
|
+
[type]="type()"
|
|
57
|
+
/>
|
|
58
|
+
<m-one-button
|
|
59
|
+
type="button"
|
|
60
|
+
[disabled]="disabled()"
|
|
61
|
+
[name]="button()"
|
|
62
|
+
[color]="iconColor()"
|
|
63
|
+
(clicked)="toggleType()"
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
@if (showErrors()) {
|
|
67
|
+
@for (error of errors(); track $index) {
|
|
68
|
+
<m-text-output
|
|
69
|
+
variant="footer"
|
|
70
|
+
color="error"
|
|
71
|
+
[label]="error.message"
|
|
72
|
+
/>
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`,
|
|
77
|
+
isInline: true,
|
|
78
|
+
styles: ["@keyframes toggle-pulse{0%,to{transform:scale(1)}50%{transform:scale(1.02)}}@keyframes thumb-slide{0%{transform:translate(0) scale(1)}50%{transform:translate(.3em) scale(.9)}to{transform:translate(.6em) scale(1)}}:host{display:block;width:100%}.input-wrapper{display:flex;align-items:center;background:var(--m-background);overflow:hidden;height:calc(var(--input-size, 1em) * 2);min-height:calc(var(--input-size, 1em) * 2);border-width:max(1px,var(--input-size, 1em) * .0625);border-radius:calc(var(--input-size, 1em) * .4);padding:calc(var(--input-size, 1em) * .5) calc(var(--input-size, 1em) * .5);gap:calc(var(--input-size, 1em) * .375);font-size:var(--input-size, 1em);border-width:var(--m-input-border-width, 1px);border-radius:var(--m-input-radius, calc(var(--input-size, 1em) * .5));height:calc(var(--input-size, 1em) * 2.25);min-height:calc(var(--input-size, 1em) * 2.25);padding-top:0;padding-bottom:0;border-color:var(--m-input-color, var(--m-mm));transition:border-color .2s ease,box-shadow .2s ease,background-color .2s ease,opacity .2s ease}.input-wrapper:hover:not(:disabled){background-color:color-mix(in srgb,var(--m-input-color, var(--m-mm)) 6%,transparent)}.input-wrapper:disabled{opacity:.6;cursor:not-allowed}.input-wrapper{border-style:solid;backdrop-filter:var(--m-text-input-backdrop-filter, none);-webkit-backdrop-filter:var(--m-text-input-backdrop-filter, none);box-shadow:var(--m-text-input-shadow, none)}.input-wrapper:has(>m-one-button,>m-button,>.input-indicator,>.input-suffix,>m-icon:last-child){padding-right:0}.input-wrapper:focus-visible:not(:disabled),.input-wrapper:focus-within:not(:disabled){border-color:var(--m-text-input-focus-border, var(--m-focus));box-shadow:none}.input-wrapper:has(.warning){border-color:var(--m-input-warning-border, var(--m-warning));background:var(--m-input-warning-background, color-mix(in srgb, var(--m-warning) 6%, var(--m-background)));box-shadow:none}.input-wrapper:has(.warning):focus-within{border-color:var(--m-input-warning-border, var(--m-warning));background:var(--m-input-warning-background, color-mix(in srgb, var(--m-warning) 6%, var(--m-background)))}.input-wrapper:has(.warning) input::placeholder,.input-wrapper:has(.warning) textarea::placeholder{color:var(--m-warning, var(--m-warning))}.input-wrapper:has(.error){border-color:var(--m-error);background:var(--m-input-error-background, color-mix(in srgb, var(--m-error) 5%, var(--m-background)));box-shadow:none}.input-wrapper:has(.error):focus-within{border-color:var(--m-error);background:var(--m-input-error-background, color-mix(in srgb, var(--m-error) 5%, var(--m-background)));box-shadow:none}.input-wrapper input::placeholder,.input-wrapper textarea::placeholder{color:var(--m-border, var(--m-border))}.input-wrapper:focus-within input::placeholder,.input-wrapper:focus-visible input::placeholder,.input-wrapper:focus-within textarea::placeholder,.input-wrapper:focus-visible textarea::placeholder{color:var(--m-focus, var(--m-focus))}.input-wrapper:has(.error) input::placeholder,.input-wrapper:has(.error) textarea::placeholder{color:var(--m-error, var(--m-error))}.input-wrapper input,.input-wrapper textarea{flex:1;border:none;outline:none;background:transparent;color:var(--m-text);font-family:inherit;font-size:inherit;padding:0}.input-wrapper input:focus,.input-wrapper textarea:focus{border-color:transparent;box-shadow:none}.input-wrapper{width:100%;padding-left:var(--m-password-input-padding-left, var(--m-label-required-space, .75em));background:var(--m-password-input-background, var(--m-background));border-color:var(--m-password-input-border, var(--m-input-color, var(--m-mm)))}.input-wrapper:hover:not(:has(.error)){border-color:var(--m-password-input-hover-border, color-mix(in srgb, var(--m-input-color, var(--m-mm)) 45%, rgba(0, 0, 0, .12)))}.input-wrapper .m-icon{--m-icon-size: 1.1em !important}.input-wrapper input{appearance:none;font-size:1em}.input-wrapper .m-one-button{height:100%;display:flex;align-items:center;justify-content:center;--m-button-size: 1em !important}\n"],
|
|
79
|
+
dependencies: [
|
|
80
|
+
{
|
|
81
|
+
kind: "component",
|
|
82
|
+
type: LabelComponent,
|
|
83
|
+
selector: "m-label",
|
|
84
|
+
inputs: [
|
|
85
|
+
"for",
|
|
86
|
+
"placeholder",
|
|
87
|
+
"params",
|
|
88
|
+
"required",
|
|
89
|
+
"disabled",
|
|
90
|
+
"color",
|
|
91
|
+
"noTranslate"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
kind: "component",
|
|
96
|
+
type: TextOutputComponent,
|
|
97
|
+
selector: "m-text-output",
|
|
98
|
+
inputs: [
|
|
99
|
+
"config",
|
|
100
|
+
"align",
|
|
101
|
+
"variant",
|
|
102
|
+
"color",
|
|
103
|
+
"fontWeight",
|
|
104
|
+
"label",
|
|
105
|
+
"noTranslate",
|
|
106
|
+
"params"
|
|
107
|
+
],
|
|
108
|
+
outputs: ["configChange", "clicked"]
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
kind: "component",
|
|
112
|
+
type: ButtonComponent,
|
|
113
|
+
selector: "m-button,m-one-button",
|
|
114
|
+
inputs: [
|
|
115
|
+
"config",
|
|
116
|
+
"color",
|
|
117
|
+
"labelClass",
|
|
118
|
+
"fullWidth",
|
|
119
|
+
"nav",
|
|
120
|
+
"navParams",
|
|
121
|
+
"href",
|
|
122
|
+
"disabled",
|
|
123
|
+
"variant",
|
|
124
|
+
"name",
|
|
125
|
+
"baseUrl",
|
|
126
|
+
"one",
|
|
127
|
+
"remote",
|
|
128
|
+
"label",
|
|
129
|
+
"noTranslate",
|
|
130
|
+
"params",
|
|
131
|
+
"noNative",
|
|
132
|
+
"icon",
|
|
133
|
+
"isRightIcon",
|
|
134
|
+
"iconOnly",
|
|
135
|
+
"stacked",
|
|
136
|
+
"imgSrc",
|
|
137
|
+
"nonClickable",
|
|
138
|
+
"inverted",
|
|
139
|
+
"isSubmit",
|
|
140
|
+
"tabindex"
|
|
141
|
+
],
|
|
142
|
+
outputs: ["configChange", "clicked"]
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
kind: "pipe",
|
|
146
|
+
type: TranslatePipe,
|
|
147
|
+
name: "translate"
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
154
|
+
minVersion: "12.0.0",
|
|
155
|
+
version: "22.2.1",
|
|
156
|
+
ngImport: i0,
|
|
157
|
+
type: PasswordInputComponent,
|
|
158
|
+
decorators: [{
|
|
159
|
+
type: Component,
|
|
160
|
+
args: [{
|
|
161
|
+
selector: "m-password-input",
|
|
162
|
+
template: `
|
|
163
|
+
@if (config(); as text) {
|
|
164
|
+
<m-label
|
|
165
|
+
[for]="text.name"
|
|
166
|
+
[placeholder]="text.label"
|
|
167
|
+
[params]="text.params"
|
|
168
|
+
[required]="required()"
|
|
169
|
+
[disabled]="disabled()"
|
|
170
|
+
/>
|
|
171
|
+
<div class="input-wrapper">
|
|
172
|
+
<input
|
|
173
|
+
[id]="text.name ?? ''"
|
|
174
|
+
[attr.data-testid]="text.testid ?? (text.name ? text.name + '-input' : null)"
|
|
175
|
+
[value]="value()"
|
|
176
|
+
#inputElement
|
|
177
|
+
[class.error]="showErrors()"
|
|
178
|
+
[disabled]="disabled()"
|
|
179
|
+
[placeholder]="(text.placeholder ?? '') | translate: text.params"
|
|
180
|
+
(input)="onInput($event)"
|
|
181
|
+
(focus)="isFocused.set(true)"
|
|
182
|
+
(blur)="isFocused.set(false); touched.set(true)"
|
|
183
|
+
[type]="type()"
|
|
184
|
+
/>
|
|
185
|
+
<m-one-button
|
|
186
|
+
type="button"
|
|
187
|
+
[disabled]="disabled()"
|
|
188
|
+
[name]="button()"
|
|
189
|
+
[color]="iconColor()"
|
|
190
|
+
(clicked)="toggleType()"
|
|
191
|
+
/>
|
|
192
|
+
</div>
|
|
193
|
+
@if (showErrors()) {
|
|
194
|
+
@for (error of errors(); track $index) {
|
|
195
|
+
<m-text-output
|
|
196
|
+
variant="footer"
|
|
197
|
+
color="error"
|
|
198
|
+
[label]="error.message"
|
|
199
|
+
/>
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
`,
|
|
204
|
+
imports: [
|
|
205
|
+
LabelComponent,
|
|
206
|
+
TextOutputComponent,
|
|
207
|
+
ButtonComponent,
|
|
208
|
+
TranslatePipe
|
|
209
|
+
],
|
|
210
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
211
|
+
styles: ["@keyframes toggle-pulse{0%,to{transform:scale(1)}50%{transform:scale(1.02)}}@keyframes thumb-slide{0%{transform:translate(0) scale(1)}50%{transform:translate(.3em) scale(.9)}to{transform:translate(.6em) scale(1)}}:host{display:block;width:100%}.input-wrapper{display:flex;align-items:center;background:var(--m-background);overflow:hidden;height:calc(var(--input-size, 1em) * 2);min-height:calc(var(--input-size, 1em) * 2);border-width:max(1px,var(--input-size, 1em) * .0625);border-radius:calc(var(--input-size, 1em) * .4);padding:calc(var(--input-size, 1em) * .5) calc(var(--input-size, 1em) * .5);gap:calc(var(--input-size, 1em) * .375);font-size:var(--input-size, 1em);border-width:var(--m-input-border-width, 1px);border-radius:var(--m-input-radius, calc(var(--input-size, 1em) * .5));height:calc(var(--input-size, 1em) * 2.25);min-height:calc(var(--input-size, 1em) * 2.25);padding-top:0;padding-bottom:0;border-color:var(--m-input-color, var(--m-mm));transition:border-color .2s ease,box-shadow .2s ease,background-color .2s ease,opacity .2s ease}.input-wrapper:hover:not(:disabled){background-color:color-mix(in srgb,var(--m-input-color, var(--m-mm)) 6%,transparent)}.input-wrapper:disabled{opacity:.6;cursor:not-allowed}.input-wrapper{border-style:solid;backdrop-filter:var(--m-text-input-backdrop-filter, none);-webkit-backdrop-filter:var(--m-text-input-backdrop-filter, none);box-shadow:var(--m-text-input-shadow, none)}.input-wrapper:has(>m-one-button,>m-button,>.input-indicator,>.input-suffix,>m-icon:last-child){padding-right:0}.input-wrapper:focus-visible:not(:disabled),.input-wrapper:focus-within:not(:disabled){border-color:var(--m-text-input-focus-border, var(--m-focus));box-shadow:none}.input-wrapper:has(.warning){border-color:var(--m-input-warning-border, var(--m-warning));background:var(--m-input-warning-background, color-mix(in srgb, var(--m-warning) 6%, var(--m-background)));box-shadow:none}.input-wrapper:has(.warning):focus-within{border-color:var(--m-input-warning-border, var(--m-warning));background:var(--m-input-warning-background, color-mix(in srgb, var(--m-warning) 6%, var(--m-background)))}.input-wrapper:has(.warning) input::placeholder,.input-wrapper:has(.warning) textarea::placeholder{color:var(--m-warning, var(--m-warning))}.input-wrapper:has(.error){border-color:var(--m-error);background:var(--m-input-error-background, color-mix(in srgb, var(--m-error) 5%, var(--m-background)));box-shadow:none}.input-wrapper:has(.error):focus-within{border-color:var(--m-error);background:var(--m-input-error-background, color-mix(in srgb, var(--m-error) 5%, var(--m-background)));box-shadow:none}.input-wrapper input::placeholder,.input-wrapper textarea::placeholder{color:var(--m-border, var(--m-border))}.input-wrapper:focus-within input::placeholder,.input-wrapper:focus-visible input::placeholder,.input-wrapper:focus-within textarea::placeholder,.input-wrapper:focus-visible textarea::placeholder{color:var(--m-focus, var(--m-focus))}.input-wrapper:has(.error) input::placeholder,.input-wrapper:has(.error) textarea::placeholder{color:var(--m-error, var(--m-error))}.input-wrapper input,.input-wrapper textarea{flex:1;border:none;outline:none;background:transparent;color:var(--m-text);font-family:inherit;font-size:inherit;padding:0}.input-wrapper input:focus,.input-wrapper textarea:focus{border-color:transparent;box-shadow:none}.input-wrapper{width:100%;padding-left:var(--m-password-input-padding-left, var(--m-label-required-space, .75em));background:var(--m-password-input-background, var(--m-background));border-color:var(--m-password-input-border, var(--m-input-color, var(--m-mm)))}.input-wrapper:hover:not(:has(.error)){border-color:var(--m-password-input-hover-border, color-mix(in srgb, var(--m-input-color, var(--m-mm)) 45%, rgba(0, 0, 0, .12)))}.input-wrapper .m-icon{--m-icon-size: 1.1em !important}.input-wrapper input{appearance:none;font-size:1em}.input-wrapper .m-one-button{height:100%;display:flex;align-items:center;justify-content:center;--m-button-size: 1em !important}\n"]
|
|
212
|
+
}]
|
|
213
|
+
}]
|
|
214
|
+
});
|
|
215
|
+
export { PasswordInputComponent };
|
|
216
|
+
|
|
217
|
+
//# sourceMappingURL=magmonium-one-password-D3oTo41c.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"magmonium-one-password-D3oTo41c.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/ui/text/password.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n signal,\n} from '@angular/core';\nimport { LabelComponent } from '../label';\nimport { TextOutputComponent } from '../../../text-output';\nimport { BaseTextInputComponent } from './base-text';\nimport { ButtonComponent } from '../../../button/ui/button';\nimport { TranslatePipe } from '../../../../pipe';\n\n@Component({\n selector: 'm-password-input',\n template: `\n @if (config(); as text) {\n <m-label\n [for]=\"text.name\"\n [placeholder]=\"text.label\"\n [params]=\"text.params\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n />\n <div class=\"input-wrapper\">\n <input\n [id]=\"text.name ?? ''\"\n [attr.data-testid]=\"text.testid ?? (text.name ? text.name + '-input' : null)\"\n [value]=\"value()\"\n #inputElement\n [class.error]=\"showErrors()\"\n [disabled]=\"disabled()\"\n [placeholder]=\"(text.placeholder ?? '') | translate: text.params\"\n (input)=\"onInput($event)\"\n (focus)=\"isFocused.set(true)\"\n (blur)=\"isFocused.set(false); touched.set(true)\"\n [type]=\"type()\"\n />\n <m-one-button\n type=\"button\"\n [disabled]=\"disabled()\"\n [name]=\"button()\"\n [color]=\"iconColor()\"\n (clicked)=\"toggleType()\"\n />\n </div>\n @if (showErrors()) {\n @for (error of errors(); track $index) {\n <m-text-output\n variant=\"footer\"\n color=\"error\"\n [label]=\"error.message\"\n />\n }\n }\n }\n `,\n imports: [LabelComponent, TextOutputComponent, ButtonComponent, TranslatePipe],\n styleUrl: './password.sass',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class PasswordInputComponent extends BaseTextInputComponent {\n isPassword = signal<boolean>(true);\n type = computed(() => (this.isPassword() ? 'password' : 'text'));\n button = computed(() => (!this.isPassword() ? 'eye' : 'eye_close'));\n\n protected toggleType() {\n this.isPassword.update((now) => !now);\n }\n\n protected onInput(event: Event): void {\n const target = event.target as HTMLInputElement;\n this.setValue(target?.value ?? '');\n }\n}\n"],"mappings":";;;;;;;AA4DA,IAAa,yBAAb,MAAa,+BAA+B,uBAAsB;CAChE,aAAa,OAAgB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAClC,OAAO,eAAgB,KAAK,WAAU,IAAK,aAAa,QAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAChE,SAAS,eAAgB,CAAC,KAAK,WAA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