@spartan-ng/brain 0.0.1-alpha.707 → 0.0.1-alpha.708
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/fesm2022/spartan-ng-brain-accordion.mjs +30 -30
- package/fesm2022/spartan-ng-brain-accordion.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-alert-dialog.mjs +19 -19
- package/fesm2022/spartan-ng-brain-alert-dialog.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-autocomplete.mjs +89 -102
- package/fesm2022/spartan-ng-brain-autocomplete.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-avatar.mjs +15 -15
- package/fesm2022/spartan-ng-brain-avatar.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-button.mjs +4 -4
- package/fesm2022/spartan-ng-brain-button.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-calendar.mjs +120 -127
- package/fesm2022/spartan-ng-brain-calendar.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-checkbox.mjs +24 -24
- package/fesm2022/spartan-ng-brain-checkbox.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-collapsible.mjs +17 -17
- package/fesm2022/spartan-ng-brain-collapsible.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-combobox.mjs +151 -178
- package/fesm2022/spartan-ng-brain-combobox.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-command.mjs +43 -52
- package/fesm2022/spartan-ng-brain-command.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-core.mjs +5 -5
- package/fesm2022/spartan-ng-brain-core.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-date-time-luxon.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-date-time.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-dialog.mjs +72 -86
- package/fesm2022/spartan-ng-brain-dialog.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-field.mjs +38 -43
- package/fesm2022/spartan-ng-brain-field.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-forms.mjs +20 -20
- package/fesm2022/spartan-ng-brain-forms.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-hover-card.mjs +24 -32
- package/fesm2022/spartan-ng-brain-hover-card.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-input-otp.mjs +23 -25
- package/fesm2022/spartan-ng-brain-input-otp.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-input.mjs +6 -6
- package/fesm2022/spartan-ng-brain-input.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-label.mjs +6 -6
- package/fesm2022/spartan-ng-brain-label.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-navigation-menu.mjs +49 -53
- package/fesm2022/spartan-ng-brain-navigation-menu.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-popover.mjs +13 -15
- package/fesm2022/spartan-ng-brain-popover.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-progress.mjs +11 -13
- package/fesm2022/spartan-ng-brain-progress.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-radio-group.mjs +28 -34
- package/fesm2022/spartan-ng-brain-radio-group.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-resizable.mjs +23 -23
- package/fesm2022/spartan-ng-brain-resizable.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-select.mjs +102 -105
- package/fesm2022/spartan-ng-brain-select.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-separator.mjs +7 -7
- package/fesm2022/spartan-ng-brain-separator.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-sheet.mjs +24 -24
- package/fesm2022/spartan-ng-brain-sheet.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-slider.mjs +52 -76
- package/fesm2022/spartan-ng-brain-slider.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-sonner.mjs +108 -132
- package/fesm2022/spartan-ng-brain-sonner.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-switch.mjs +21 -23
- package/fesm2022/spartan-ng-brain-switch.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-tabs.mjs +36 -39
- package/fesm2022/spartan-ng-brain-tabs.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-textarea.mjs +6 -6
- package/fesm2022/spartan-ng-brain-textarea.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-toggle-group.mjs +21 -27
- package/fesm2022/spartan-ng-brain-toggle-group.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-toggle.mjs +10 -12
- package/fesm2022/spartan-ng-brain-toggle.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-tooltip.mjs +27 -27
- package/fesm2022/spartan-ng-brain-tooltip.mjs.map +1 -1
- package/hlm-tailwind-preset.css +6 -6
- package/package.json +44 -43
- package/{autocomplete/index.d.ts → types/spartan-ng-brain-autocomplete.d.ts} +10 -10
- package/{calendar/index.d.ts → types/spartan-ng-brain-calendar.d.ts} +2 -2
- package/{combobox/index.d.ts → types/spartan-ng-brain-combobox.d.ts} +10 -10
- package/{dialog/index.d.ts → types/spartan-ng-brain-dialog.d.ts} +1 -1
- package/{hover-card/index.d.ts → types/spartan-ng-brain-hover-card.d.ts} +1 -1
- package/{select/index.d.ts → types/spartan-ng-brain-select.d.ts} +11 -11
- /package/{accordion/index.d.ts → types/spartan-ng-brain-accordion.d.ts} +0 -0
- /package/{alert-dialog/index.d.ts → types/spartan-ng-brain-alert-dialog.d.ts} +0 -0
- /package/{avatar/index.d.ts → types/spartan-ng-brain-avatar.d.ts} +0 -0
- /package/{button/index.d.ts → types/spartan-ng-brain-button.d.ts} +0 -0
- /package/{checkbox/index.d.ts → types/spartan-ng-brain-checkbox.d.ts} +0 -0
- /package/{collapsible/index.d.ts → types/spartan-ng-brain-collapsible.d.ts} +0 -0
- /package/{command/index.d.ts → types/spartan-ng-brain-command.d.ts} +0 -0
- /package/{core/index.d.ts → types/spartan-ng-brain-core.d.ts} +0 -0
- /package/{date-time-luxon/index.d.ts → types/spartan-ng-brain-date-time-luxon.d.ts} +0 -0
- /package/{date-time/index.d.ts → types/spartan-ng-brain-date-time.d.ts} +0 -0
- /package/{field/index.d.ts → types/spartan-ng-brain-field.d.ts} +0 -0
- /package/{forms/index.d.ts → types/spartan-ng-brain-forms.d.ts} +0 -0
- /package/{input-otp/index.d.ts → types/spartan-ng-brain-input-otp.d.ts} +0 -0
- /package/{input/index.d.ts → types/spartan-ng-brain-input.d.ts} +0 -0
- /package/{label/index.d.ts → types/spartan-ng-brain-label.d.ts} +0 -0
- /package/{navigation-menu/index.d.ts → types/spartan-ng-brain-navigation-menu.d.ts} +0 -0
- /package/{popover/index.d.ts → types/spartan-ng-brain-popover.d.ts} +0 -0
- /package/{progress/index.d.ts → types/spartan-ng-brain-progress.d.ts} +0 -0
- /package/{radio-group/index.d.ts → types/spartan-ng-brain-radio-group.d.ts} +0 -0
- /package/{resizable/index.d.ts → types/spartan-ng-brain-resizable.d.ts} +0 -0
- /package/{separator/index.d.ts → types/spartan-ng-brain-separator.d.ts} +0 -0
- /package/{sheet/index.d.ts → types/spartan-ng-brain-sheet.d.ts} +0 -0
- /package/{slider/index.d.ts → types/spartan-ng-brain-slider.d.ts} +0 -0
- /package/{sonner/index.d.ts → types/spartan-ng-brain-sonner.d.ts} +0 -0
- /package/{switch/index.d.ts → types/spartan-ng-brain-switch.d.ts} +0 -0
- /package/{tabs/index.d.ts → types/spartan-ng-brain-tabs.d.ts} +0 -0
- /package/{textarea/index.d.ts → types/spartan-ng-brain-textarea.d.ts} +0 -0
- /package/{toggle-group/index.d.ts → types/spartan-ng-brain-toggle-group.d.ts} +0 -0
- /package/{toggle/index.d.ts → types/spartan-ng-brain-toggle.d.ts} +0 -0
- /package/{tooltip/index.d.ts → types/spartan-ng-brain-tooltip.d.ts} +0 -0
- /package/{index.d.ts → types/spartan-ng-brain.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spartan-ng-brain-input-otp.mjs","sources":["../../../../libs/brain/input-otp/src/lib/brn-input-otp.token.ts","../../../../libs/brain/input-otp/src/lib/brn-input-otp.ts","../../../../libs/brain/input-otp/src/lib/brn-input-otp-slot.ts","../../../../libs/brain/input-otp/src/index.ts","../../../../libs/brain/input-otp/src/spartan-ng-brain-input-otp.ts"],"sourcesContent":["import { type ExistingProvider, inject, InjectionToken, type Type } from '@angular/core';\nimport type { BrnInputOtp } from './brn-input-otp';\n\nexport const BrnInputOtpToken = new InjectionToken<BrnInputOtp>('BrnInputOtpToken');\n\nexport function injectBrnInputOtp(): BrnInputOtp {\n\treturn inject(BrnInputOtpToken) as BrnInputOtp;\n}\n\nexport function provideBrnInputOtp(inputOtp: Type<BrnInputOtp>): ExistingProvider {\n\treturn { provide: BrnInputOtpToken, useExisting: inputOtp };\n}\n","import type { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n\tafterNextRender,\n\tbooleanAttribute,\n\tChangeDetectionStrategy,\n\tComponent,\n\tcomputed,\n\tElementRef,\n\tforwardRef,\n\tinput,\n\tlinkedSignal,\n\tmodel,\n\tnumberAttribute,\n\toutput,\n\tsignal,\n\tviewChild,\n} from '@angular/core';\nimport { type ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport type { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';\nimport type { ClassValue } from 'clsx';\nimport { provideBrnInputOtp } from './brn-input-otp.token';\n\nexport const BRN_INPUT_OTP_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnInputOtp),\n\tmulti: true,\n};\n\nexport type InputMode = 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\n@Component({\n\tselector: 'brn-input-otp',\n\timports: [FormsModule],\n\tproviders: [BRN_INPUT_OTP_VALUE_ACCESSOR, provideBrnInputOtp(BrnInputOtp)],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\thost: {\n\t\t'[style]': 'hostStyles()',\n\t\t'data-input-otp-container': 'true',\n\t},\n\ttemplate: `\n\t\t<ng-content />\n\t\t<div [style]=\"containerStyles()\">\n\t\t\t<input\n\t\t\t\t#otpInput\n\t\t\t\t[id]=\"inputId()\"\n\t\t\t\t[class]=\"inputClass()\"\n\t\t\t\t[autocomplete]=\"inputAutocomplete()\"\n\t\t\t\tdata-slot=\"input-otp\"\n\t\t\t\t[style]=\"inputStyles()\"\n\t\t\t\t[disabled]=\"_disabled()\"\n\t\t\t\t[inputMode]=\"inputMode()\"\n\t\t\t\t[ngModel]=\"value()\"\n\t\t\t\t(input)=\"onInputChange($event)\"\n\t\t\t\t(paste)=\"onPaste($event)\"\n\t\t\t\t(focus)=\"_focused.set(true)\"\n\t\t\t\t(blur)=\"_focused.set(false)\"\n\t\t\t/>\n\t\t</div>\n\t`,\n})\nexport class BrnInputOtp implements ControlValueAccessor {\n\tprivate static _id = 0;\n\n\t/** Whether the input has focus. */\n\tprotected readonly _focused = signal<boolean>(false);\n\n\t/** Styles applied to the host element. */\n\tpublic readonly hostStyles = input<string>(\n\t\t'position: relative; cursor: text; user-select: none; pointer-events: none;',\n\t);\n\n\t/** Custom id applied to the input element */\n\tpublic readonly inputId = input<string>(`brn-input-otp-${++BrnInputOtp._id}`);\n\n\t/** Custom autocomplete attribute applied to the input element */\n\tpublic readonly inputAutocomplete = input<'one-time-code' | 'off'>('one-time-code');\n\n\t/** Styles applied to the input element to make it invisible and clickable. */\n\tpublic readonly inputStyles = input<string>(\n\t\t'position: absolute; inset: 0; width: 100%; height: 100%; display: flex; textAlign: left; opacity: 1; color: transparent; pointerEvents: all; background: transparent; caret-color: transparent; border: 0px solid transparent; outline: transparent solid 0px; box-shadow: none; line-height: 1; letter-spacing: -0.5em; font-family: monospace; font-variant-numeric: tabular-nums;',\n\t);\n\n\t/** Styles applied to the container element. */\n\tpublic readonly containerStyles = input<string>('position: absolute; inset: 0; pointer-events: none;');\n\n\t/** Determine if the date picker is disabled. */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\tprotected readonly _disabled = linkedSignal(this.disabled);\n\n\t/** The number of slots. */\n\tpublic readonly maxLength = input.required<number, NumberInput>({ transform: numberAttribute });\n\n\t/** Virtual keyboard appearance on mobile */\n\tpublic readonly inputMode = input<InputMode>('numeric');\n\n\tpublic readonly inputClass = input<ClassValue>('');\n\n\t/** If true, the element is focused automatically on init **/\n\tpublic readonly autofocus = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Defines how the pasted text should be transformed before saving to model/form.\n\t * Allows pasting text which contains extra characters like spaces, dashes, etc. and are longer than the maxLength.\n\t *\n\t * \"XXX-XXX\": (pastedText) => pastedText.replaceAll('-', '')\n\t * \"XXX XXX\": (pastedText) => pastedText.replaceAll(/\\s+/g, '')\n\t */\n\tpublic readonly transformPaste = input<(pastedText: string, maxLength: number) => string>((text) => text);\n\n\t/** The value controlling the input */\n\tpublic readonly value = model<string | null>(null);\n\n\t/** Emits when the value changes. */\n\tpublic readonly valueChange = output<string>();\n\n\tpublic readonly context = computed(() => {\n\t\tconst value = this.value() ?? '';\n\t\tconst focused = this._focused();\n\t\tconst maxLength = this.maxLength();\n\t\tconst slots = Array.from({ length: this.maxLength() }).map((_, slotIndex) => {\n\t\t\tconst char = value[slotIndex] !== undefined ? value[slotIndex] : null;\n\n\t\t\tconst isActive =\n\t\t\t\tfocused && (value.length === slotIndex || (value.length === maxLength && slotIndex === maxLength - 1));\n\n\t\t\treturn {\n\t\t\t\tchar,\n\t\t\t\tisActive,\n\t\t\t\thasFakeCaret: isActive && value.length === slotIndex,\n\t\t\t};\n\t\t});\n\n\t\treturn slots;\n\t});\n\n\t/** Emitted when the input is complete, triggered through input or paste. */\n\tpublic readonly completed = output<string>();\n\n\tprotected _onChange?: ChangeFn<string>;\n\tprotected _onTouched?: TouchFn;\n\n\tprotected readonly _inputComponentRef = viewChild.required<ElementRef>('otpInput');\n\n\tconstructor() {\n\t\tafterNextRender(() => {\n\t\t\tif (this.autofocus()) {\n\t\t\t\tthis._inputComponentRef().nativeElement.focus();\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected onInputChange(event: Event) {\n\t\tlet newValue = (event.target as HTMLInputElement).value;\n\t\tconst maxLength = this.maxLength();\n\n\t\tif (newValue.length > maxLength) {\n\t\t\t// Replace the last character when max length is exceeded\n\t\t\tnewValue = newValue.slice(0, maxLength - 1) + newValue.slice(-1);\n\t\t}\n\n\t\tthis.updateValue(newValue, maxLength);\n\t}\n\n\tprotected onPaste(event: ClipboardEvent) {\n\t\tevent.preventDefault();\n\t\tconst clipboardData = event.clipboardData?.getData('text/plain') || '';\n\n\t\tconst maxLength = this.maxLength();\n\n\t\tconst content = this.transformPaste()(clipboardData, maxLength);\n\t\tconst newValue = content.slice(0, maxLength);\n\n\t\tthis.updateValue(newValue, maxLength);\n\t}\n\n\t/** CONTROL VALUE ACCESSOR */\n\twriteValue(value: string | null): void {\n\t\tthis.value.set(value);\n\t\tif (value?.length === this.maxLength()) {\n\t\t\tthis.completed.emit(value ?? '');\n\t\t}\n\t}\n\n\tregisterOnChange(fn: ChangeFn<string>): void {\n\t\tthis._onChange = fn;\n\t}\n\n\tregisterOnTouched(fn: TouchFn): void {\n\t\tthis._onTouched = fn;\n\t}\n\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis._disabled.set(isDisabled);\n\t}\n\n\tprivate isCompleted(newValue: string, previousValue: string, maxLength: number) {\n\t\treturn newValue !== previousValue && previousValue.length < maxLength && newValue.length === maxLength;\n\t}\n\n\tprivate updateValue(newValue: string, maxLength: number) {\n\t\tconst previousValue = this.value() ?? '';\n\n\t\tthis.value.set(newValue);\n\t\tthis._onChange?.(newValue);\n\n\t\tif (this.isCompleted(newValue, previousValue, maxLength)) {\n\t\t\tthis.completed.emit(newValue);\n\t\t}\n\t}\n}\n","import type { NumberInput } from '@angular/cdk/coercion';\nimport { ChangeDetectionStrategy, Component, computed, input, numberAttribute } from '@angular/core';\nimport { injectBrnInputOtp } from './brn-input-otp.token';\n\n@Component({\n\tselector: 'brn-input-otp-slot',\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\thost: {\n\t\t'[attr.data-active]': '_slot().isActive',\n\t},\n\ttemplate: `\n\t\t{{ _slot().char }}\n\n\t\t@if (_slot().hasFakeCaret) {\n\t\t\t<ng-content />\n\t\t}\n\t`,\n})\nexport class BrnInputOtpSlot {\n\t/** Access the input-otp component */\n\tprotected readonly _inputOtp = injectBrnInputOtp();\n\n\t/** The index of the slot to render the char or a fake caret */\n\tpublic readonly index = input.required<number, NumberInput>({ transform: numberAttribute });\n\n\tprotected readonly _slot = computed(() => this._inputOtp.context()[this.index()]);\n}\n","import { BrnInputOtp } from './lib/brn-input-otp';\nimport { BrnInputOtpSlot } from './lib/brn-input-otp-slot';\n\nexport * from './lib/brn-input-otp';\nexport * from './lib/brn-input-otp-slot';\n\nexport const BrnInputOtpImports = [BrnInputOtp, BrnInputOtpSlot] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAGO,MAAM,gBAAgB,GAAG,IAAI,cAAc,CAAc,kBAAkB,CAAC;SAEnE,iBAAiB,GAAA;AAChC,IAAA,OAAO,MAAM,CAAC,gBAAgB,CAAgB;AAC/C;AAEM,SAAU,kBAAkB,CAAC,QAA2B,EAAA;IAC7D,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE;AAC5D;;ACWO,MAAM,4BAA4B,GAAG;AAC3C,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,WAAW,CAAC;AAC1C,IAAA,KAAK,EAAE,IAAI;;MAmCC,WAAW,CAAA;AACf,IAAA,OAAO,GAAG,GAAG,CAAC;;AAGH,IAAA,QAAQ,GAAG,MAAM,CAAU,KAAK,oDAAC;;AAGpC,IAAA,UAAU,GAAG,KAAK,CACjC,4EAA4E,sDAC5E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AA,EAAA,kBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EARjB;;;;;;AAMT,CAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAEW,eAAe,EAAA,UAAA,EAAA,CAAA;kBAd3B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,oBAAoB;oBAC9B,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,IAAI,EAAE;AACL,wBAAA,oBAAoB,EAAE,kBAAkB;AACxC,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;AAMT,CAAA,CAAA;AACD,iBAAA;;;MCXY,kBAAkB,GAAG,CAAC,WAAW,EAAE,eAAe;;ACN/D;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"spartan-ng-brain-input-otp.mjs","sources":["../../../../libs/brain/input-otp/src/lib/brn-input-otp.token.ts","../../../../libs/brain/input-otp/src/lib/brn-input-otp.ts","../../../../libs/brain/input-otp/src/lib/brn-input-otp-slot.ts","../../../../libs/brain/input-otp/src/index.ts","../../../../libs/brain/input-otp/src/spartan-ng-brain-input-otp.ts"],"sourcesContent":["import { type ExistingProvider, inject, InjectionToken, type Type } from '@angular/core';\nimport type { BrnInputOtp } from './brn-input-otp';\n\nexport const BrnInputOtpToken = new InjectionToken<BrnInputOtp>('BrnInputOtpToken');\n\nexport function injectBrnInputOtp(): BrnInputOtp {\n\treturn inject(BrnInputOtpToken) as BrnInputOtp;\n}\n\nexport function provideBrnInputOtp(inputOtp: Type<BrnInputOtp>): ExistingProvider {\n\treturn { provide: BrnInputOtpToken, useExisting: inputOtp };\n}\n","import type { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n\tafterNextRender,\n\tbooleanAttribute,\n\tChangeDetectionStrategy,\n\tComponent,\n\tcomputed,\n\tElementRef,\n\tforwardRef,\n\tinput,\n\tlinkedSignal,\n\tmodel,\n\tnumberAttribute,\n\toutput,\n\tsignal,\n\tviewChild,\n} from '@angular/core';\nimport { type ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport type { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';\nimport type { ClassValue } from 'clsx';\nimport { provideBrnInputOtp } from './brn-input-otp.token';\n\nexport const BRN_INPUT_OTP_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnInputOtp),\n\tmulti: true,\n};\n\nexport type InputMode = 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\n@Component({\n\tselector: 'brn-input-otp',\n\timports: [FormsModule],\n\tproviders: [BRN_INPUT_OTP_VALUE_ACCESSOR, provideBrnInputOtp(BrnInputOtp)],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\thost: {\n\t\t'[style]': 'hostStyles()',\n\t\t'data-input-otp-container': 'true',\n\t},\n\ttemplate: `\n\t\t<ng-content />\n\t\t<div [style]=\"containerStyles()\">\n\t\t\t<input\n\t\t\t\t#otpInput\n\t\t\t\t[id]=\"inputId()\"\n\t\t\t\t[class]=\"inputClass()\"\n\t\t\t\t[autocomplete]=\"inputAutocomplete()\"\n\t\t\t\tdata-slot=\"input-otp\"\n\t\t\t\t[style]=\"inputStyles()\"\n\t\t\t\t[disabled]=\"_disabled()\"\n\t\t\t\t[inputMode]=\"inputMode()\"\n\t\t\t\t[ngModel]=\"value()\"\n\t\t\t\t(input)=\"onInputChange($event)\"\n\t\t\t\t(paste)=\"onPaste($event)\"\n\t\t\t\t(focus)=\"_focused.set(true)\"\n\t\t\t\t(blur)=\"_focused.set(false)\"\n\t\t\t/>\n\t\t</div>\n\t`,\n})\nexport class BrnInputOtp implements ControlValueAccessor {\n\tprivate static _id = 0;\n\n\t/** Whether the input has focus. */\n\tprotected readonly _focused = signal<boolean>(false);\n\n\t/** Styles applied to the host element. */\n\tpublic readonly hostStyles = input<string>(\n\t\t'position: relative; cursor: text; user-select: none; pointer-events: none;',\n\t);\n\n\t/** Custom id applied to the input element */\n\tpublic readonly inputId = input<string>(`brn-input-otp-${++BrnInputOtp._id}`);\n\n\t/** Custom autocomplete attribute applied to the input element */\n\tpublic readonly inputAutocomplete = input<'one-time-code' | 'off'>('one-time-code');\n\n\t/** Styles applied to the input element to make it invisible and clickable. */\n\tpublic readonly inputStyles = input<string>(\n\t\t'position: absolute; inset: 0; width: 100%; height: 100%; display: flex; textAlign: left; opacity: 1; color: transparent; pointerEvents: all; background: transparent; caret-color: transparent; border: 0px solid transparent; outline: transparent solid 0px; box-shadow: none; line-height: 1; letter-spacing: -0.5em; font-family: monospace; font-variant-numeric: tabular-nums;',\n\t);\n\n\t/** Styles applied to the container element. */\n\tpublic readonly containerStyles = input<string>('position: absolute; inset: 0; pointer-events: none;');\n\n\t/** Determine if the date picker is disabled. */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\tprotected readonly _disabled = linkedSignal(this.disabled);\n\n\t/** The number of slots. */\n\tpublic readonly maxLength = input.required<number, NumberInput>({ transform: numberAttribute });\n\n\t/** Virtual keyboard appearance on mobile */\n\tpublic readonly inputMode = input<InputMode>('numeric');\n\n\tpublic readonly inputClass = input<ClassValue>('');\n\n\t/** If true, the element is focused automatically on init **/\n\tpublic readonly autofocus = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Defines how the pasted text should be transformed before saving to model/form.\n\t * Allows pasting text which contains extra characters like spaces, dashes, etc. and are longer than the maxLength.\n\t *\n\t * \"XXX-XXX\": (pastedText) => pastedText.replaceAll('-', '')\n\t * \"XXX XXX\": (pastedText) => pastedText.replaceAll(/\\s+/g, '')\n\t */\n\tpublic readonly transformPaste = input<(pastedText: string, maxLength: number) => string>((text) => text);\n\n\t/** The value controlling the input */\n\tpublic readonly value = model<string | null>(null);\n\n\t/** Emits when the value changes. */\n\tpublic readonly valueChange = output<string>();\n\n\tpublic readonly context = computed(() => {\n\t\tconst value = this.value() ?? '';\n\t\tconst focused = this._focused();\n\t\tconst maxLength = this.maxLength();\n\t\tconst slots = Array.from({ length: this.maxLength() }).map((_, slotIndex) => {\n\t\t\tconst char = value[slotIndex] !== undefined ? value[slotIndex] : null;\n\n\t\t\tconst isActive =\n\t\t\t\tfocused && (value.length === slotIndex || (value.length === maxLength && slotIndex === maxLength - 1));\n\n\t\t\treturn {\n\t\t\t\tchar,\n\t\t\t\tisActive,\n\t\t\t\thasFakeCaret: isActive && value.length === slotIndex,\n\t\t\t};\n\t\t});\n\n\t\treturn slots;\n\t});\n\n\t/** Emitted when the input is complete, triggered through input or paste. */\n\tpublic readonly completed = output<string>();\n\n\tprotected _onChange?: ChangeFn<string>;\n\tprotected _onTouched?: TouchFn;\n\n\tprotected readonly _inputComponentRef = viewChild.required<ElementRef>('otpInput');\n\n\tconstructor() {\n\t\tafterNextRender(() => {\n\t\t\tif (this.autofocus()) {\n\t\t\t\tthis._inputComponentRef().nativeElement.focus();\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected onInputChange(event: Event) {\n\t\tlet newValue = (event.target as HTMLInputElement).value;\n\t\tconst maxLength = this.maxLength();\n\n\t\tif (newValue.length > maxLength) {\n\t\t\t// Replace the last character when max length is exceeded\n\t\t\tnewValue = newValue.slice(0, maxLength - 1) + newValue.slice(-1);\n\t\t}\n\n\t\tthis.updateValue(newValue, maxLength);\n\t}\n\n\tprotected onPaste(event: ClipboardEvent) {\n\t\tevent.preventDefault();\n\t\tconst clipboardData = event.clipboardData?.getData('text/plain') || '';\n\n\t\tconst maxLength = this.maxLength();\n\n\t\tconst content = this.transformPaste()(clipboardData, maxLength);\n\t\tconst newValue = content.slice(0, maxLength);\n\n\t\tthis.updateValue(newValue, maxLength);\n\t}\n\n\t/** CONTROL VALUE ACCESSOR */\n\twriteValue(value: string | null): void {\n\t\tthis.value.set(value);\n\t\tif (value?.length === this.maxLength()) {\n\t\t\tthis.completed.emit(value ?? '');\n\t\t}\n\t}\n\n\tregisterOnChange(fn: ChangeFn<string>): void {\n\t\tthis._onChange = fn;\n\t}\n\n\tregisterOnTouched(fn: TouchFn): void {\n\t\tthis._onTouched = fn;\n\t}\n\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis._disabled.set(isDisabled);\n\t}\n\n\tprivate isCompleted(newValue: string, previousValue: string, maxLength: number) {\n\t\treturn newValue !== previousValue && previousValue.length < maxLength && newValue.length === maxLength;\n\t}\n\n\tprivate updateValue(newValue: string, maxLength: number) {\n\t\tconst previousValue = this.value() ?? '';\n\n\t\tthis.value.set(newValue);\n\t\tthis._onChange?.(newValue);\n\n\t\tif (this.isCompleted(newValue, previousValue, maxLength)) {\n\t\t\tthis.completed.emit(newValue);\n\t\t}\n\t}\n}\n","import type { NumberInput } from '@angular/cdk/coercion';\nimport { ChangeDetectionStrategy, Component, computed, input, numberAttribute } from '@angular/core';\nimport { injectBrnInputOtp } from './brn-input-otp.token';\n\n@Component({\n\tselector: 'brn-input-otp-slot',\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\thost: {\n\t\t'[attr.data-active]': '_slot().isActive',\n\t},\n\ttemplate: `\n\t\t{{ _slot().char }}\n\n\t\t@if (_slot().hasFakeCaret) {\n\t\t\t<ng-content />\n\t\t}\n\t`,\n})\nexport class BrnInputOtpSlot {\n\t/** Access the input-otp component */\n\tprotected readonly _inputOtp = injectBrnInputOtp();\n\n\t/** The index of the slot to render the char or a fake caret */\n\tpublic readonly index = input.required<number, NumberInput>({ transform: numberAttribute });\n\n\tprotected readonly _slot = computed(() => this._inputOtp.context()[this.index()]);\n}\n","import { BrnInputOtp } from './lib/brn-input-otp';\nimport { BrnInputOtpSlot } from './lib/brn-input-otp-slot';\n\nexport * from './lib/brn-input-otp';\nexport * from './lib/brn-input-otp-slot';\n\nexport const BrnInputOtpImports = [BrnInputOtp, BrnInputOtpSlot] as const;\n","/**\n * Generated bundle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A,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAf,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,eAAe,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,kBAAA,EAAA,kBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EARjB;;;;;;AAMT,CAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAEW,eAAe,EAAA,UAAA,EAAA,CAAA;kBAd3B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,oBAAoB;oBAC9B,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,IAAI,EAAE;AACL,wBAAA,oBAAoB,EAAE,kBAAkB;AACxC,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;AAMT,CAAA,CAAA;AACD,iBAAA;;;MCXY,kBAAkB,GAAG,CAAC,WAAW,EAAE,eAAe;;ACN/D;;AAEG;;;;"}
|
|
@@ -7,18 +7,18 @@ class BrnInput {
|
|
|
7
7
|
static _id = 0;
|
|
8
8
|
_fieldControl = inject(BrnFieldControl, { optional: true });
|
|
9
9
|
/** The id of the input. */
|
|
10
|
-
id = input(`brn-input-${++BrnInput._id}`, ...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
10
|
+
id = input(`brn-input-${++BrnInput._id}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
11
11
|
/** Whether to force the input into an invalid state. */
|
|
12
|
-
forceInvalid = input(false, ...(ngDevMode ?
|
|
12
|
+
forceInvalid = input(false, { ...(ngDevMode ? { debugName: "forceInvalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
13
13
|
labelableId = this.id;
|
|
14
14
|
_ariaInvalid = this._fieldControl?.invalid;
|
|
15
15
|
_touched = this._fieldControl?.touched;
|
|
16
16
|
_dirty = this._fieldControl?.dirty;
|
|
17
|
-
_spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid(), ...(ngDevMode ? [{ debugName: "_spartanInvalid" }] : []));
|
|
18
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
19
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
17
|
+
_spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid(), ...(ngDevMode ? [{ debugName: "_spartanInvalid" }] : /* istanbul ignore next */ []));
|
|
18
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
19
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.16", type: BrnInput, isStandalone: true, selector: "[brnInput]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, forceInvalid: { classPropertyName: "forceInvalid", publicName: "forceInvalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "id()", "attr.aria-invalid": "_ariaInvalid?.() ? \"true\" : null", "attr.data-invalid": "_ariaInvalid?.() ? \"true\" : null", "attr.data-touched": "_touched?.() ? \"true\" : null", "attr.data-dirty": "_dirty?.() ? \"true\" : null", "attr.data-matches-spartan-invalid": "_spartanInvalid() ? \"true\" : null" } }, providers: [provideBrnLabelable(BrnInput)], hostDirectives: [{ directive: i1.BrnFieldControl }], ngImport: i0 });
|
|
20
20
|
}
|
|
21
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
21
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnInput, decorators: [{
|
|
22
22
|
type: Directive,
|
|
23
23
|
args: [{
|
|
24
24
|
selector: '[brnInput]',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spartan-ng-brain-input.mjs","sources":["../../../../libs/brain/input/src/lib/brn-input.ts","../../../../libs/brain/input/src/index.ts","../../../../libs/brain/input/src/spartan-ng-brain-input.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, inject, input } from '@angular/core';\nimport { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';\n\n@Directive({\n\tselector: '[brnInput]',\n\tproviders: [provideBrnLabelable(BrnInput)],\n\thostDirectives: [BrnFieldControl],\n\thost: {\n\t\t'[id]': 'id()',\n\t\t'[attr.aria-invalid]': '_ariaInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-invalid]': '_ariaInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-touched]': '_touched?.() ? \"true\" : null',\n\t\t'[attr.data-dirty]': '_dirty?.() ? \"true\" : null',\n\t\t'[attr.data-matches-spartan-invalid]': '_spartanInvalid() ? \"true\" : null',\n\t},\n})\nexport class BrnInput {\n\tprivate static _id = 0;\n\n\tprivate readonly _fieldControl = inject(BrnFieldControl, { optional: true });\n\n\t/** The id of the input. */\n\tpublic readonly id = input<string | undefined>(`brn-input-${++BrnInput._id}`);\n\n\t/** Whether to force the input into an invalid state. */\n\tpublic readonly forceInvalid = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\tpublic readonly labelableId = this.id;\n\n\tprotected readonly _ariaInvalid = this._fieldControl?.invalid;\n\tprotected readonly _touched = this._fieldControl?.touched;\n\tprotected readonly _dirty = this._fieldControl?.dirty;\n\tprotected readonly _spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid());\n}\n","import { BrnInput } from './lib/brn-input';\n\nexport * from './lib/brn-input';\n\nexport const BrnInputImports = [BrnInput] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAiBa,QAAQ,CAAA;AACZ,IAAA,OAAO,GAAG,GAAG,CAAC;IAEL,aAAa,GAAG,MAAM,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;IAG5D,EAAE,GAAG,KAAK,CAAqB,CAAA,UAAA,EAAa,EAAE,QAAQ,CAAC,GAAG,CAAA,CAAE,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,IAAA,EAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"spartan-ng-brain-input.mjs","sources":["../../../../libs/brain/input/src/lib/brn-input.ts","../../../../libs/brain/input/src/index.ts","../../../../libs/brain/input/src/spartan-ng-brain-input.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, inject, input } from '@angular/core';\nimport { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';\n\n@Directive({\n\tselector: '[brnInput]',\n\tproviders: [provideBrnLabelable(BrnInput)],\n\thostDirectives: [BrnFieldControl],\n\thost: {\n\t\t'[id]': 'id()',\n\t\t'[attr.aria-invalid]': '_ariaInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-invalid]': '_ariaInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-touched]': '_touched?.() ? \"true\" : null',\n\t\t'[attr.data-dirty]': '_dirty?.() ? \"true\" : null',\n\t\t'[attr.data-matches-spartan-invalid]': '_spartanInvalid() ? \"true\" : null',\n\t},\n})\nexport class BrnInput {\n\tprivate static _id = 0;\n\n\tprivate readonly _fieldControl = inject(BrnFieldControl, { optional: true });\n\n\t/** The id of the input. */\n\tpublic readonly id = input<string | undefined>(`brn-input-${++BrnInput._id}`);\n\n\t/** Whether to force the input into an invalid state. */\n\tpublic readonly forceInvalid = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\tpublic readonly labelableId = this.id;\n\n\tprotected readonly _ariaInvalid = this._fieldControl?.invalid;\n\tprotected readonly _touched = this._fieldControl?.touched;\n\tprotected readonly _dirty = this._fieldControl?.dirty;\n\tprotected readonly _spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid());\n}\n","import { BrnInput } from './lib/brn-input';\n\nexport * from './lib/brn-input';\n\nexport const BrnInputImports = [BrnInput] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAiBa,QAAQ,CAAA;AACZ,IAAA,OAAO,GAAG,GAAG,CAAC;IAEL,aAAa,GAAG,MAAM,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;IAG5D,EAAE,GAAG,KAAK,CAAqB,CAAA,UAAA,EAAa,EAAE,QAAQ,CAAC,GAAG,CAAA,CAAE,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,IAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAC;;IAG7D,YAAY,GAAG,KAAK,CAAwB,KAAK,oFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;AAEnF,IAAA,WAAW,GAAG,IAAI,CAAC,EAAE;AAElB,IAAA,YAAY,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO;AAC1C,IAAA,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO;AACtC,IAAA,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,KAAK;AAClC,IAAA,eAAe,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,EAAE,IAAI,IAAI,CAAC,aAAa,EAAE,cAAc,EAAE,sFAAC;2HAhBpG,QAAQ,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAR,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,QAAQ,qpBAXT,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,eAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAW9B,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAbpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,YAAY;AACtB,oBAAA,SAAS,EAAE,CAAC,mBAAmB,CAAA,QAAA,CAAU,CAAC;oBAC1C,cAAc,EAAE,CAAC,eAAe,CAAC;AACjC,oBAAA,IAAI,EAAE;AACL,wBAAA,MAAM,EAAE,MAAM;AACd,wBAAA,qBAAqB,EAAE,kCAAkC;AACzD,wBAAA,qBAAqB,EAAE,kCAAkC;AACzD,wBAAA,qBAAqB,EAAE,8BAA8B;AACrD,wBAAA,mBAAmB,EAAE,4BAA4B;AACjD,wBAAA,qCAAqC,EAAE,mCAAmC;AAC1E,qBAAA;AACD,iBAAA;;;ACZM,MAAM,eAAe,GAAG,CAAC,QAAQ;;ACJxC;;AAEG;;;;"}
|
|
@@ -6,19 +6,19 @@ class BrnLabel {
|
|
|
6
6
|
static _id = 0;
|
|
7
7
|
_brnField = inject(BrnField, { optional: true });
|
|
8
8
|
/** The id of the label. */
|
|
9
|
-
id = input(`brn-label-${++BrnLabel._id}`, ...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
9
|
+
id = input(`brn-label-${++BrnLabel._id}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
10
10
|
/** The id of the form control this label is associated with. */
|
|
11
|
-
for = input(...(ngDevMode ? [undefined, { debugName: "for" }] : []));
|
|
11
|
+
for = input(...(ngDevMode ? [undefined, { debugName: "for" }] : /* istanbul ignore next */ []));
|
|
12
12
|
_for = computed(() => {
|
|
13
13
|
const forValue = this.for();
|
|
14
14
|
if (forValue)
|
|
15
15
|
return forValue;
|
|
16
16
|
return this._brnField?.labelableId();
|
|
17
|
-
}, ...(ngDevMode ? [{ debugName: "_for" }] : []));
|
|
18
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
19
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
17
|
+
}, ...(ngDevMode ? [{ debugName: "_for" }] : /* istanbul ignore next */ []));
|
|
18
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
19
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.16", type: BrnLabel, isStandalone: true, selector: "[brnLabel]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, for: { classPropertyName: "for", publicName: "for", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "id()", "attr.for": "_for()" } }, ngImport: i0 });
|
|
20
20
|
}
|
|
21
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
21
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnLabel, decorators: [{
|
|
22
22
|
type: Directive,
|
|
23
23
|
args: [{
|
|
24
24
|
selector: '[brnLabel]',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spartan-ng-brain-label.mjs","sources":["../../../../libs/brain/label/src/lib/brn-label.ts","../../../../libs/brain/label/src/index.ts","../../../../libs/brain/label/src/spartan-ng-brain-label.ts"],"sourcesContent":["import { computed, Directive, inject, input } from '@angular/core';\nimport { BrnField } from '@spartan-ng/brain/field';\n\n@Directive({\n\tselector: '[brnLabel]',\n\thost: {\n\t\t'[id]': 'id()',\n\t\t'[attr.for]': '_for()',\n\t},\n})\nexport class BrnLabel {\n\tprivate static _id = 0;\n\n\tprivate readonly _brnField = inject(BrnField, { optional: true });\n\n\t/** The id of the label. */\n\tpublic readonly id = input<string>(`brn-label-${++BrnLabel._id}`);\n\n\t/** The id of the form control this label is associated with. */\n\tpublic readonly for = input<string>();\n\n\tprotected readonly _for = computed(() => {\n\t\tconst forValue = this.for();\n\t\tif (forValue) return forValue;\n\n\t\treturn this._brnField?.labelableId();\n\t});\n}\n","import { BrnLabel } from './lib/brn-label';\n\nexport * from './lib/brn-label';\n\nexport const BrnLabelImports = [BrnLabel] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAUa,QAAQ,CAAA;AACZ,IAAA,OAAO,GAAG,GAAG,CAAC;IAEL,SAAS,GAAG,MAAM,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;IAGjD,EAAE,GAAG,KAAK,CAAS,CAAA,UAAA,EAAa,EAAE,QAAQ,CAAC,GAAG,CAAA,CAAE,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,IAAA,EAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"spartan-ng-brain-label.mjs","sources":["../../../../libs/brain/label/src/lib/brn-label.ts","../../../../libs/brain/label/src/index.ts","../../../../libs/brain/label/src/spartan-ng-brain-label.ts"],"sourcesContent":["import { computed, Directive, inject, input } from '@angular/core';\nimport { BrnField } from '@spartan-ng/brain/field';\n\n@Directive({\n\tselector: '[brnLabel]',\n\thost: {\n\t\t'[id]': 'id()',\n\t\t'[attr.for]': '_for()',\n\t},\n})\nexport class BrnLabel {\n\tprivate static _id = 0;\n\n\tprivate readonly _brnField = inject(BrnField, { optional: true });\n\n\t/** The id of the label. */\n\tpublic readonly id = input<string>(`brn-label-${++BrnLabel._id}`);\n\n\t/** The id of the form control this label is associated with. */\n\tpublic readonly for = input<string>();\n\n\tprotected readonly _for = computed(() => {\n\t\tconst forValue = this.for();\n\t\tif (forValue) return forValue;\n\n\t\treturn this._brnField?.labelableId();\n\t});\n}\n","import { BrnLabel } from './lib/brn-label';\n\nexport * from './lib/brn-label';\n\nexport const BrnLabelImports = [BrnLabel] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAUa,QAAQ,CAAA;AACZ,IAAA,OAAO,GAAG,GAAG,CAAC;IAEL,SAAS,GAAG,MAAM,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;IAGjD,EAAE,GAAG,KAAK,CAAS,CAAA,UAAA,EAAa,EAAE,QAAQ,CAAC,GAAG,CAAA,CAAE,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,IAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAC;;IAGjD,GAAG,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,KAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;AAElB,IAAA,IAAI,GAAG,QAAQ,CAAC,MAAK;AACvC,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE;AAC3B,QAAA,IAAI,QAAQ;AAAE,YAAA,OAAO,QAAQ;AAE7B,QAAA,OAAO,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE;AACrC,IAAA,CAAC,2EAAC;2HAhBU,QAAQ,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;+GAAR,QAAQ,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,YAAA,EAAA,MAAA,EAAA,EAAA,EAAA,EAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,GAAA,EAAA,EAAA,iBAAA,EAAA,KAAA,EAAA,UAAA,EAAA,KAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,UAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAAR,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAPpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,YAAY;AACtB,oBAAA,IAAI,EAAE;AACL,wBAAA,MAAM,EAAE,MAAM;AACd,wBAAA,YAAY,EAAE,QAAQ;AACtB,qBAAA;AACD,iBAAA;;;ACLM,MAAM,eAAe,GAAG,CAAC,QAAQ;;ACJxC;;AAEG;;;;"}
|
|
@@ -41,14 +41,14 @@ class BrnNavigationMenuContentService {
|
|
|
41
41
|
_zone = inject(NgZone);
|
|
42
42
|
_psBuilder = inject(OverlayPositionBuilder);
|
|
43
43
|
_renderer = inject(Renderer2);
|
|
44
|
-
_content = signal(null, ...(ngDevMode ? [{ debugName: "_content" }] : []));
|
|
44
|
+
_content = signal(null, ...(ngDevMode ? [{ debugName: "_content" }] : /* istanbul ignore next */ []));
|
|
45
45
|
id = `brn-navigation-menu-content-${++BrnNavigationMenuContentService._id}`;
|
|
46
46
|
_shouldDetach = false;
|
|
47
47
|
_config = {};
|
|
48
48
|
_overlayRef;
|
|
49
49
|
_positionStrategy;
|
|
50
50
|
_destroyed$ = new Subject();
|
|
51
|
-
_contentEl = signal(undefined, ...(ngDevMode ? [{ debugName: "_contentEl" }] : []));
|
|
51
|
+
_contentEl = signal(undefined, ...(ngDevMode ? [{ debugName: "_contentEl" }] : /* istanbul ignore next */ []));
|
|
52
52
|
contentEl = this._contentEl.asReadonly();
|
|
53
53
|
_overlayHoveredObservables$ = new BehaviorSubject(undefined);
|
|
54
54
|
_overlayShiftTabObservables$ = new BehaviorSubject(undefined);
|
|
@@ -154,10 +154,10 @@ class BrnNavigationMenuContentService {
|
|
|
154
154
|
.withDefaultOffsetX(0)
|
|
155
155
|
.withPush(false);
|
|
156
156
|
}
|
|
157
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
158
|
-
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
157
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnNavigationMenuContentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
158
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnNavigationMenuContentService });
|
|
159
159
|
}
|
|
160
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
160
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnNavigationMenuContentService, decorators: [{
|
|
161
161
|
type: Injectable
|
|
162
162
|
}], ctorParameters: () => [] });
|
|
163
163
|
|
|
@@ -189,20 +189,20 @@ class BrnNavigationMenuItem {
|
|
|
189
189
|
el = inject(ElementRef);
|
|
190
190
|
navMenuElRef = this._navigationMenu.el;
|
|
191
191
|
/** The id of the navigation menu item */
|
|
192
|
-
id = input(`brn-navigation-menu-item-${++BrnNavigationMenuItem._id}`, ...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
193
|
-
isActive = computed(() => this.id() === this._navigationMenu.value(), ...(ngDevMode ? [{ debugName: "isActive" }] : []));
|
|
194
|
-
wasActive = computed(() => this.id() === this._navigationMenu.previousValue(), ...(ngDevMode ? [{ debugName: "wasActive" }] : []));
|
|
195
|
-
state = computed(() => (this.isActive() ? 'open' : 'closed'), ...(ngDevMode ? [{ debugName: "state" }] : []));
|
|
196
|
-
contentTemplate = signal(null, ...(ngDevMode ? [{ debugName: "contentTemplate" }] : []));
|
|
192
|
+
id = input(`brn-navigation-menu-item-${++BrnNavigationMenuItem._id}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
193
|
+
isActive = computed(() => this.id() === this._navigationMenu.value(), ...(ngDevMode ? [{ debugName: "isActive" }] : /* istanbul ignore next */ []));
|
|
194
|
+
wasActive = computed(() => this.id() === this._navigationMenu.previousValue(), ...(ngDevMode ? [{ debugName: "wasActive" }] : /* istanbul ignore next */ []));
|
|
195
|
+
state = computed(() => (this.isActive() ? 'open' : 'closed'), ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
196
|
+
contentTemplate = signal(null, ...(ngDevMode ? [{ debugName: "contentTemplate" }] : /* istanbul ignore next */ []));
|
|
197
197
|
contentHovered$ = this._contentService.hovered$;
|
|
198
198
|
subNavVisible$ = new Subject();
|
|
199
199
|
focusable = contentChild.required(BrnNavigationMenuFocusable);
|
|
200
200
|
_triggerOrLinkBtn = contentChild.required(BrnNavigationMenuFocusable, { read: BrnButton });
|
|
201
|
-
disabled = computed(() => this._triggerOrLinkBtn().disabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
202
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
203
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "
|
|
201
|
+
disabled = computed(() => this._triggerOrLinkBtn().disabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
202
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnNavigationMenuItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
203
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.16", type: BrnNavigationMenuItem, isStandalone: true, selector: "li[brnNavigationMenuItem]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "navigation-menu-item" }, properties: { "id": "id()", "attr.data-disabled": "disabled() || null" } }, providers: [provideBrnNavigationMenuItem(BrnNavigationMenuItem), BrnNavigationMenuContentService], queries: [{ propertyName: "focusable", first: true, predicate: BrnNavigationMenuFocusable, descendants: true, isSignal: true }, { propertyName: "_triggerOrLinkBtn", first: true, predicate: BrnNavigationMenuFocusable, descendants: true, read: BrnButton, isSignal: true }], ngImport: i0 });
|
|
204
204
|
}
|
|
205
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
205
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnNavigationMenuItem, decorators: [{
|
|
206
206
|
type: Directive,
|
|
207
207
|
args: [{
|
|
208
208
|
selector: 'li[brnNavigationMenuItem]',
|
|
@@ -224,9 +224,7 @@ class BrnNavigationMenuLink {
|
|
|
224
224
|
/**
|
|
225
225
|
* Used to identify the link as the currently active page.
|
|
226
226
|
*/
|
|
227
|
-
active = input(undefined, ...(ngDevMode ?
|
|
228
|
-
transform: booleanAttribute,
|
|
229
|
-
}]));
|
|
227
|
+
active = input(undefined, { ...(ngDevMode ? { debugName: "active" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
230
228
|
_isActive = computed(() => {
|
|
231
229
|
const active = this.active();
|
|
232
230
|
if (active !== undefined)
|
|
@@ -234,7 +232,7 @@ class BrnNavigationMenuLink {
|
|
|
234
232
|
if (!this._hasParentNavMenuItem)
|
|
235
233
|
return false;
|
|
236
234
|
return this._navigationMenuItem.isActive();
|
|
237
|
-
}, ...(ngDevMode ? [{ debugName: "_isActive" }] : []));
|
|
235
|
+
}, ...(ngDevMode ? [{ debugName: "_isActive" }] : /* istanbul ignore next */ []));
|
|
238
236
|
get disabled() {
|
|
239
237
|
return this._navigationMenuItem.disabled();
|
|
240
238
|
}
|
|
@@ -263,10 +261,10 @@ class BrnNavigationMenuLink {
|
|
|
263
261
|
return;
|
|
264
262
|
this._navigationMenu.value.set(this._navigationMenuItem.id());
|
|
265
263
|
}
|
|
266
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
267
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
264
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnNavigationMenuLink, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
265
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.16", type: BrnNavigationMenuLink, isStandalone: true, selector: "a[brnNavigationMenuLink]", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "navigation-menu-link" }, listeners: { "click": "onClick()", "mouseenter": "activate()", "focus": "handleFocus()" }, properties: { "attr.data-active": "_isActive() ? \"true\" : undefined", "attr.aria-current": "_isActive() ? \"page\" : undefined" } }, providers: [provideBrnNavigationMenuFocusable(BrnNavigationMenuLink)], hostDirectives: [{ directive: i1.BrnButton, inputs: ["disabled", "disabled"] }], ngImport: i0 });
|
|
268
266
|
}
|
|
269
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
267
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnNavigationMenuLink, decorators: [{
|
|
270
268
|
type: Directive,
|
|
271
269
|
args: [{
|
|
272
270
|
selector: 'a[brnNavigationMenuLink]',
|
|
@@ -311,36 +309,34 @@ class BrnNavigationMenu {
|
|
|
311
309
|
/**
|
|
312
310
|
* The controlled value of the menu item to activate.
|
|
313
311
|
*/
|
|
314
|
-
value = model(...(ngDevMode ? [undefined, { debugName: "value" }] : []));
|
|
312
|
+
value = model(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
315
313
|
/**
|
|
316
314
|
* The duration from when the mouse enters a trigger until the content opens.
|
|
317
315
|
*/
|
|
318
|
-
delayDuration = input(200, ...(ngDevMode ? [{ debugName: "delayDuration" }] : []));
|
|
316
|
+
delayDuration = input(200, ...(ngDevMode ? [{ debugName: "delayDuration" }] : /* istanbul ignore next */ []));
|
|
319
317
|
/**
|
|
320
318
|
* How much time a user has to enter another trigger without incurring a delay again.
|
|
321
319
|
*/
|
|
322
|
-
skipDelayDuration = input(300, ...(ngDevMode ? [{ debugName: "skipDelayDuration" }] : []));
|
|
320
|
+
skipDelayDuration = input(300, ...(ngDevMode ? [{ debugName: "skipDelayDuration" }] : /* istanbul ignore next */ []));
|
|
323
321
|
/**
|
|
324
322
|
* Controls whether the menu opens on hover or click.
|
|
325
323
|
* When 'click', initial open requires a click, but hover still switches between items once open.
|
|
326
324
|
*/
|
|
327
|
-
openOn = input('hover', ...(ngDevMode ? [{ debugName: "openOn" }] : []));
|
|
325
|
+
openOn = input('hover', ...(ngDevMode ? [{ debugName: "openOn" }] : /* istanbul ignore next */ []));
|
|
328
326
|
/** internal **/
|
|
329
327
|
direction = this._dir.valueSignal;
|
|
330
328
|
/**
|
|
331
329
|
* The orientation of the menu.
|
|
332
330
|
*/
|
|
333
|
-
orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : []));
|
|
334
|
-
_isOpenDelayed = signal(true, ...(ngDevMode ? [{ debugName: "_isOpenDelayed" }] : []));
|
|
331
|
+
orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
332
|
+
_isOpenDelayed = signal(true, ...(ngDevMode ? [{ debugName: "_isOpenDelayed" }] : /* istanbul ignore next */ []));
|
|
335
333
|
isOpenDelayed = this._isOpenDelayed.asReadonly();
|
|
336
334
|
_skipDelayTimerRef;
|
|
337
|
-
_navAndSubnavMenuItems = contentChildren(BrnNavigationMenuItem, ...(ngDevMode ?
|
|
338
|
-
menuItems = computed(() => this._navAndSubnavMenuItems().filter((mi) => mi.navMenuElRef === this.el), ...(ngDevMode ?
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
_triggersAndLinks = computed(() => this.menuItems().map((mi) => mi.focusable()), ...(ngDevMode ? [{ debugName: "_triggersAndLinks" }] : []));
|
|
343
|
-
_linkMenuItems = computed(() => this.menuItems().filter((i) => i.focusable() instanceof BrnNavigationMenuLink), ...(ngDevMode ? [{ debugName: "_linkMenuItems" }] : []));
|
|
335
|
+
_navAndSubnavMenuItems = contentChildren(BrnNavigationMenuItem, { ...(ngDevMode ? { debugName: "_navAndSubnavMenuItems" } : /* istanbul ignore next */ {}), descendants: true });
|
|
336
|
+
menuItems = computed(() => this._navAndSubnavMenuItems().filter((mi) => mi.navMenuElRef === this.el), { ...(ngDevMode ? { debugName: "menuItems" } : /* istanbul ignore next */ {}), equal: areArraysSameByElRef });
|
|
337
|
+
menuItemIds = computed(() => this.menuItems().map((mi) => mi.id()), ...(ngDevMode ? [{ debugName: "menuItemIds" }] : /* istanbul ignore next */ []));
|
|
338
|
+
_triggersAndLinks = computed(() => this.menuItems().map((mi) => mi.focusable()), ...(ngDevMode ? [{ debugName: "_triggersAndLinks" }] : /* istanbul ignore next */ []));
|
|
339
|
+
_linkMenuItems = computed(() => this.menuItems().filter((i) => i.focusable() instanceof BrnNavigationMenuLink), ...(ngDevMode ? [{ debugName: "_linkMenuItems" }] : /* istanbul ignore next */ []));
|
|
344
340
|
_keyManager = computed(() => {
|
|
345
341
|
return new FocusKeyManager(this._triggersAndLinks())
|
|
346
342
|
.withHorizontalOrientation(this.direction())
|
|
@@ -348,12 +344,12 @@ class BrnNavigationMenu {
|
|
|
348
344
|
.withPageUpDown()
|
|
349
345
|
.withWrap()
|
|
350
346
|
.skipPredicate((e) => !!e.disabled);
|
|
351
|
-
}, ...(ngDevMode ? [{ debugName: "_keyManager" }] : []));
|
|
347
|
+
}, ...(ngDevMode ? [{ debugName: "_keyManager" }] : /* istanbul ignore next */ []));
|
|
352
348
|
_reset$ = toObservable(this.value).pipe(pairwise(), filter(([prev, curr]) => curr === undefined && curr !== prev), map(() => undefined));
|
|
353
349
|
_hovered$ = merge(createHoverObservable(this.el.nativeElement, this._zone, this._destroy$).pipe(map((e) => e.hover)), this._reset$).pipe(startWith(undefined));
|
|
354
350
|
_contentHovered$ = merge(toObservable(this._navAndSubnavMenuItems).pipe(switchMap((menuItems) => merge(...menuItems.map((mi) => mi.contentHovered$)))), this._reset$).pipe(startWith(undefined));
|
|
355
351
|
previousValue = computedPrevious(this.value);
|
|
356
|
-
context = computed(() => ({ orientation: this.orientation(), dir: this.direction() }), ...(ngDevMode ? [{ debugName: "context" }] : []));
|
|
352
|
+
context = computed(() => ({ orientation: this.orientation(), dir: this.direction() }), ...(ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []));
|
|
357
353
|
constructor() {
|
|
358
354
|
effect(() => {
|
|
359
355
|
const isOpen = this.value() !== undefined;
|
|
@@ -406,10 +402,10 @@ class BrnNavigationMenu {
|
|
|
406
402
|
this._destroy$.complete();
|
|
407
403
|
clearTimeout(this._skipDelayTimerRef);
|
|
408
404
|
}
|
|
409
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
410
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "
|
|
405
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnNavigationMenu, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
406
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.16", type: BrnNavigationMenu, isStandalone: true, selector: "nav[brnNavigationMenu]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, delayDuration: { classPropertyName: "delayDuration", publicName: "delayDuration", isSignal: true, isRequired: false, transformFunction: null }, skipDelayDuration: { classPropertyName: "skipDelayDuration", publicName: "skipDelayDuration", isSignal: true, isRequired: false, transformFunction: null }, openOn: { classPropertyName: "openOn", publicName: "openOn", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "aria-label": "Main", "data-slot": "navigation-menu" }, listeners: { "keydown": "handleKeydown($event)" }, properties: { "attr.data-orientation": "orientation()", "attr.dir": "direction()" } }, providers: [provideBrnNavigationMenu(BrnNavigationMenu)], queries: [{ propertyName: "_navAndSubnavMenuItems", predicate: BrnNavigationMenuItem, descendants: true, isSignal: true }], ngImport: i0 });
|
|
411
407
|
}
|
|
412
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
408
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnNavigationMenu, decorators: [{
|
|
413
409
|
type: Directive,
|
|
414
410
|
args: [{
|
|
415
411
|
selector: 'nav[brnNavigationMenu]',
|
|
@@ -439,8 +435,8 @@ class BrnNavigationMenuContent {
|
|
|
439
435
|
_state = this._navigationMenuItem.state;
|
|
440
436
|
_contentEl = this._contentService.contentEl;
|
|
441
437
|
_menuItemsIds = this._navigationMenu.menuItemIds;
|
|
442
|
-
_orientation = computed(() => this._navigationMenu.context().orientation, ...(ngDevMode ? [{ debugName: "_orientation" }] : []));
|
|
443
|
-
_dir = computed(() => this._navigationMenu.context().dir, ...(ngDevMode ? [{ debugName: "_dir" }] : []));
|
|
438
|
+
_orientation = computed(() => this._navigationMenu.context().orientation, ...(ngDevMode ? [{ debugName: "_orientation" }] : /* istanbul ignore next */ []));
|
|
439
|
+
_dir = computed(() => this._navigationMenu.context().dir, ...(ngDevMode ? [{ debugName: "_dir" }] : /* istanbul ignore next */ []));
|
|
444
440
|
constructor() {
|
|
445
441
|
if (!this._tpl)
|
|
446
442
|
return;
|
|
@@ -493,10 +489,10 @@ class BrnNavigationMenuContent {
|
|
|
493
489
|
}
|
|
494
490
|
});
|
|
495
491
|
}
|
|
496
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
497
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
492
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnNavigationMenuContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
493
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.16", type: BrnNavigationMenuContent, isStandalone: true, selector: "[brnNavigationMenuContent]", providers: [provideBrnParentNavMenu((() => ({ subNavVisible$: new Subject() })))], ngImport: i0 });
|
|
498
494
|
}
|
|
499
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
495
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnNavigationMenuContent, decorators: [{
|
|
500
496
|
type: Directive,
|
|
501
497
|
args: [{
|
|
502
498
|
selector: '[brnNavigationMenuContent]',
|
|
@@ -506,11 +502,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
|
|
|
506
502
|
|
|
507
503
|
class BrnNavigationMenuList {
|
|
508
504
|
_navigationMenu = injectBrnNavigationMenu();
|
|
509
|
-
_orientation = computed(() => this._navigationMenu.context().orientation, ...(ngDevMode ? [{ debugName: "_orientation" }] : []));
|
|
510
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
511
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
505
|
+
_orientation = computed(() => this._navigationMenu.context().orientation, ...(ngDevMode ? [{ debugName: "_orientation" }] : /* istanbul ignore next */ []));
|
|
506
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnNavigationMenuList, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
507
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.16", type: BrnNavigationMenuList, isStandalone: true, selector: "ul[brnNavigationMenuList]", host: { attributes: { "data-slot": "navigation-menu-list" }, properties: { "attr.data-orientation": "_orientation()" } }, ngImport: i0 });
|
|
512
508
|
}
|
|
513
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
509
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnNavigationMenuList, decorators: [{
|
|
514
510
|
type: Directive,
|
|
515
511
|
args: [{
|
|
516
512
|
selector: 'ul[brnNavigationMenuList]',
|
|
@@ -536,8 +532,8 @@ class BrnNavigationMenuTrigger {
|
|
|
536
532
|
_isActive = this._navigationMenuItem.isActive;
|
|
537
533
|
_contentId = this._contentService.id;
|
|
538
534
|
_state = this._navigationMenuItem.state;
|
|
539
|
-
_dir = computed(() => this._navigationMenu.context().dir, ...(ngDevMode ? [{ debugName: "_dir" }] : []));
|
|
540
|
-
_orientation = computed(() => this._navigationMenu.context().orientation, ...(ngDevMode ? [{ debugName: "_orientation" }] : []));
|
|
535
|
+
_dir = computed(() => this._navigationMenu.context().dir, ...(ngDevMode ? [{ debugName: "_dir" }] : /* istanbul ignore next */ []));
|
|
536
|
+
_orientation = computed(() => this._navigationMenu.context().orientation, ...(ngDevMode ? [{ debugName: "_orientation" }] : /* istanbul ignore next */ []));
|
|
541
537
|
_isOpenDelayed = this._navigationMenu.isOpenDelayed;
|
|
542
538
|
_delayDuration = this._navigationMenu.delayDuration;
|
|
543
539
|
_contentTemplate = this._navigationMenuItem.contentTemplate;
|
|
@@ -668,10 +664,10 @@ class BrnNavigationMenuTrigger {
|
|
|
668
664
|
.menuItems()
|
|
669
665
|
.find((ref) => ref.el.nativeElement === node || ref.el.nativeElement.contains(node));
|
|
670
666
|
}
|
|
671
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
672
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
667
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnNavigationMenuTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
668
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.16", type: BrnNavigationMenuTrigger, isStandalone: true, selector: "button[brnNavigationMenuTrigger]", host: { attributes: { "data-slot": "navigation-menu-trigger" }, listeners: { "keydown.escape": "onEscape($event)", "keydown.tab": "onTab($event)", "focus": "handleFocus()" }, properties: { "id": "_id", "attr.data-state": "_state()", "attr.aria-expanded": "_isActive()", "attr.aria-controls": "_contentId" } }, providers: [provideBrnNavigationMenuFocusable(BrnNavigationMenuTrigger)], hostDirectives: [{ directive: i1.BrnButton, inputs: ["disabled", "disabled"] }], ngImport: i0 });
|
|
673
669
|
}
|
|
674
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
670
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnNavigationMenuTrigger, decorators: [{
|
|
675
671
|
type: Directive,
|
|
676
672
|
args: [{
|
|
677
673
|
selector: 'button[brnNavigationMenuTrigger]',
|