@tekus/design-system 5.10.0 → 5.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/readme-images/badge-severity.svg +9 -0
- package/assets/readme-images/tabs-badge.svg +20 -0
- package/assets/readme-images/tabs-default.svg +16 -0
- package/assets/readme-images/tabs-multiple.svg +17 -0
- package/assets/readme-images/tabs-truncation.svg +16 -0
- package/assets/readme-images/tk-input-number-default.svg +8 -0
- package/assets/readme-images/tk-input-number-disabled.svg +9 -0
- package/assets/readme-images/tk-input-number-error.svg +10 -0
- package/assets/readme-images/tk-input-number-filled.svg +9 -0
- package/assets/readme-images/tk-input-number-focus.svg +9 -0
- package/components/badge/index.d.ts +5 -0
- package/components/badge/public-api.d.ts +1 -0
- package/components/badge/src/badge.component.d.ts +34 -0
- package/components/input-number/index.d.ts +5 -0
- package/components/input-number/public-api.d.ts +1 -0
- package/components/input-number/src/input-number.component.d.ts +102 -0
- package/components/modal/src/modal.component.d.ts +9 -3
- package/components/tabs/index.d.ts +5 -0
- package/components/tabs/public-api.d.ts +2 -0
- package/components/tabs/src/tabs.component.d.ts +52 -0
- package/components/tabs/src/tabs.interface.d.ts +11 -0
- package/fesm2022/tekus-design-system-components-badge.mjs +57 -0
- package/fesm2022/tekus-design-system-components-badge.mjs.map +1 -0
- package/fesm2022/tekus-design-system-components-input-number.mjs +171 -0
- package/fesm2022/tekus-design-system-components-input-number.mjs.map +1 -0
- package/fesm2022/tekus-design-system-components-modal.mjs +10 -4
- package/fesm2022/tekus-design-system-components-modal.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-tabs.mjs +77 -0
- package/fesm2022/tekus-design-system-components-tabs.mjs.map +1 -0
- package/package.json +21 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tekus-design-system-components-modal.mjs","sources":["../../../projects/design-system/components/modal/src/modal.component.ts","../../../projects/design-system/components/modal/src/modal.component.html","../../../projects/design-system/components/modal/src/services/modal.service.ts","../../../projects/design-system/components/modal/tekus-design-system-components-modal.ts"],"sourcesContent":["import { Component, computed, input, EventEmitter, Type, ElementRef } from '@angular/core';\nimport { NgComponentOutlet } from '@angular/common';\nimport { ButtonComponent } from '@tekus/design-system/components/button';\nimport { DialogModule } from 'primeng/dialog';\nimport { ModalFooterButton, ModalSizeType } from './modal.types';\n\n/**\n * @component ModalComponent\n * @description\n * A programmatically controlled modal dialog used for displaying dynamic content, titles, and footer actions.\n * The modal is not instantiated via template bindings, but rather opened through a service with a configuration object.\n *\n * This component supports:\n * - Configurable title and content.\n * - Optional footer buttons with callbacks and return values.\n * - Multiple sizes: `'small' | 'large' | 'full'`.\n * - Closable modal and outside-click behavior.\n * - Passing arbitrary data to the modal instance.\n *\n * @usage\n * ### Open a modal from TypeScript using the modal service\n * ```ts\n * this.modalService.open({\n * title: 'Demo Modal',\n * content: 'This modal is opened from TypeScript using the service.',\n * footerButtons: [\n * {\n * label: 'Accept',\n * severity: 'secondary',\n * action: () => console.log('Accept clicked'),\n * returnValue: true,\n * },\n * {\n * label: 'Cancel',\n * severity: 'danger',\n * action: () => console.log('Cancel clicked'),\n * returnValue: false,\n * },\n * ],\n * size: 'small',\n * closable: true,\n * closeOnOutsideClick: false,\n * }).subscribe((result) => {\n * console.log('Modal closed with value:', result);\n * });\n * ```\n */\n\n@Component({\n selector: 'tk-modal',\n standalone: true,\n imports: [DialogModule, ButtonComponent, NgComponentOutlet],\n templateUrl: './modal.component.html',\n styleUrls: ['./modal.component.scss']\n})\nexport class ModalComponent {\n\n constructor(private readonly elementRef: ElementRef) {}\n\n /** The title displayed at the top of the modal */\n title = input<string>('');\n /** The main content of the modal */\n content = input<string | Type<unknown> | null>(null);\n /** Array of footer buttons with label, callback, and return value */\n footerButtons = input<ModalFooterButton[]>([]);\n /** Modal size: 'small', 'large', or 'full' */\n size = input<ModalSizeType>('small');\n /** Whether the modal can be closed by the user */\n closable = input<boolean>(true);\n /** Whether clicking outside closes the modal */\n closeOnOutsideClick = input<boolean>(false);\n isContentString = computed(() => typeof this.content() === 'string');\n /** Computed: whether the modal has footer buttons */\n hasFooter = computed(() => (this.footerButtons() ?? []).length > 0);\n /** Computed: calculates modal width based on `size` */\n modalWidth = computed(() => {\n switch (this.size()) {\n case 'large':\n return '67.5rem'; // Large\n case 'medium':\n return '35rem'; // Medium\n case 'full':\n return '98vw'; // Full\n default:\n return '25rem'; // Small\n }\n});\n /** Whether the modal content has a scrollbar */\n hasScroll = false;\n\n /** Visibility flag */\n isOpened: boolean = false;\n\n /** Emits when the modal closes, passing the return value from footer buttons or null */\n readonly onClose = new EventEmitter<unknown>();\n private alreadyEmitted = false;\n private returnValueOnClose: unknown = null;\n\n /** Opens the modal */\n open() {\n this.isOpened = true;\n this.alreadyEmitted = false;\n this.returnValueOnClose = null;\n }\n\n /**\n * Checks if the modal content has a scrollbar and updates `hasScroll` state.\n * This is called when the modal is shown.\n */\n checkScroll() {\n const contentEl = this.elementRef.nativeElement.querySelector('.p-dialog-content');\n if (contentEl) {\n this.hasScroll = contentEl.scrollHeight > contentEl.clientHeight;\n }\n }\n\n /** Closes the modal and emits onClose with null */\n handleClose() {\n if (!this.alreadyEmitted) {\n this.onClose.emit(null);\n } else {\n this.onClose.emit(this.returnValueOnClose);\n }\n this.alreadyEmitted = false;\n this.returnValueOnClose = null;\n }\n\n /** Closes the modal without emitting an event */\n close() {\n this.isOpened = false;\n }\n\n /**\n * Handles footer button actions.\n * Executes the action callback, emits `onClose` with the provided returnValue, then closes the modal.\n * @param action Callback to execute when the button is clicked\n * @param returnValue Value emitted on modal close\n */\n handleAction(action: (() => void) | undefined, returnValue: unknown) {\n if (action) action();\n this.alreadyEmitted = true;\n this.returnValueOnClose = returnValue;\n this.isOpened = false;\n }\n}\n","<p-dialog\n [modal]=\"true\"\n [(visible)]=\"isOpened\"\n [closable]=\"closable()\"\n [dismissableMask]=\"closeOnOutsideClick()\"\n [draggable]=\"false\"\n [focusOnShow]=\"false\"\n [header]=\"title()\"\n [style]=\"{ width: modalWidth() }\"\n (onHide)=\"handleClose()\"\n (onShow)=\"checkScroll()\"\n class=\"tk-modal\"\n>\n <section class=\"tk-modal__content\">\n @if (content()) {\n @if (isContentString()) {\n <p [innerHTML]=\"content()\" ></p>\n } @else {\n <ng-container *ngComponentOutlet=\"$any(content())\"></ng-container>\n }\n }\n </section>\n\n <ng-template pTemplate=\"footer\">\n @if (hasFooter()) {\n <section class=\"tk-modal__footer\" [class.tk-modal__footer--with-content]=\"hasScroll\">\n @for (btn of footerButtons()!; track $index) {\n <tk-button\n [label]=\"btn.label\"\n [severity]=\"btn.severity\"\n [variant]=\"btn.variant\"\n (clicked)=\"handleAction(btn.action, btn.returnValue)\"\n (keydown.enter)=\"handleAction(btn.action, btn.returnValue)\"\n (keydown.space)=\"handleAction(btn.action, btn.returnValue)\"\n />\n }\n </section>\n }\n </ng-template>\n</p-dialog>","import {\n Injectable,\n ApplicationRef,\n ComponentRef,\n Injector,\n createComponent,\n EmbeddedViewRef,\n} from '@angular/core';\nimport { ModalComponent } from '../modal.component';\nimport { Observable, Subject } from 'rxjs';\nimport { ModalConfig } from '../modal.types';\n\n@Injectable({ providedIn: 'root' })\nexport class ModalService {\n private modalRef: ComponentRef<ModalComponent> | null = null;\n\n constructor(\n private readonly injector: Injector,\n private readonly appRef: ApplicationRef\n ) {}\n\n get _modalRefForTesting(): ComponentRef<ModalComponent> | null {\n return this.modalRef;\n }\n set _modalRefForTesting(ref: ComponentRef<ModalComponent> | null) {\n this.modalRef = ref;\n }\n\n open(config: ModalConfig): Observable<unknown> {\n if (this.modalRef) {\n return this.modalRef.instance.onClose.asObservable();\n }\n\n const componentRef = createComponent(ModalComponent, {\n environmentInjector: this.appRef.injector,\n });\n\n this.appRef.attachView(componentRef.hostView);\n\n const domElem = (componentRef.hostView as EmbeddedViewRef<unknown>).rootNodes[0] as HTMLElement;\n document.body.appendChild(domElem);\n\n componentRef.setInput('title', config.title);\n componentRef.setInput('content', config.content ?? null);\n componentRef.setInput('footerButtons', config.footerButtons ?? []);\n componentRef.setInput('size', config.size ?? 'small');\n componentRef.setInput('closable', config.closable ?? true);\n componentRef.setInput('closeOnOutsideClick', config.closeOnOutsideClick ?? false);\n\n const close$ = new Subject<unknown>();\n\n componentRef.instance.onClose.subscribe((value) => {\n close$.next(value);\n close$.complete();\n\n this.appRef.detachView(componentRef.hostView);\n componentRef.destroy();\n this.modalRef = null;\n });\n\n componentRef.instance.open();\n this.modalRef = componentRef;\n\n return close$.asObservable();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCG;MASU,cAAc,CAAA;AAEzB,IAAA,WAAA,CAA6B,UAAsB,EAAA;QAAtB,IAAU,CAAA,UAAA,GAAV,UAAU;;AAGvC,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAS,EAAE,CAAC;;AAEzB,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAgC,IAAI,CAAC;;AAEpD,QAAA,IAAA,CAAA,aAAa,GAAG,KAAK,CAAsB,EAAE,CAAC;;AAE9C,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAgB,OAAO,CAAC;;AAEpC,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAU,IAAI,CAAC;;AAE/B,QAAA,IAAA,CAAA,mBAAmB,GAAG,KAAK,CAAU,KAAK,CAAC;AAC3C,QAAA,IAAA,CAAA,eAAe,GAAG,QAAQ,CAAC,MAAM,OAAO,IAAI,CAAC,OAAO,EAAE,KAAK,QAAQ,CAAC;;AAEpE,QAAA,IAAA,CAAA,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;;AAEnE,QAAA,IAAA,CAAA,UAAU,GAAG,QAAQ,CAAC,MAAK;AAC3B,YA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,CAAC,QAAQ,GAAG,IAAI;AACtB,SAAC,CAAC;AAEF,QAAA,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE;AAC5B,QAAA,IAAI,CAAC,QAAQ,GAAG,YAAY;AAE5B,QAAA,OAAO,MAAM,CAAC,YAAY,EAAE;;+GAlDnB,YAAY,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,QAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,cAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAZ,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,cADC,MAAM,EAAA,CAAA,CAAA;;4FACnB,YAAY,EAAA,UAAA,EAAA,CAAA;kBADxB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACZlC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"tekus-design-system-components-modal.mjs","sources":["../../../projects/design-system/components/modal/src/modal.component.ts","../../../projects/design-system/components/modal/src/modal.component.html","../../../projects/design-system/components/modal/src/services/modal.service.ts","../../../projects/design-system/components/modal/tekus-design-system-components-modal.ts"],"sourcesContent":["import { Component, computed, input, EventEmitter, Type, ElementRef } from '@angular/core';\nimport { NgComponentOutlet } from '@angular/common';\nimport { ButtonComponent } from '@tekus/design-system/components/button';\nimport { DialogModule } from 'primeng/dialog';\nimport { ModalFooterButton, ModalSizeType } from './modal.types';\n\n/**\n * @component ModalComponent\n * @description\n * A programmatically controlled modal dialog used for displaying dynamic content, titles, and footer actions.\n * The modal is not instantiated via template bindings, but rather opened through a service with a configuration object.\n *\n * This component supports:\n * - Configurable title and content.\n * - Optional footer buttons with callbacks and return values.\n * - Multiple sizes: `'small' | 'large' | 'full'`.\n * - Closable modal and outside-click behavior.\n * - Passing arbitrary data to the modal instance.\n *\n * @usage\n * ### Open a modal from TypeScript using the modal service\n * ```ts\n * this.modalService.open({\n * title: 'Demo Modal',\n * content: 'This modal is opened from TypeScript using the service.',\n * footerButtons: [\n * {\n * label: 'Accept',\n * severity: 'secondary',\n * action: () => console.log('Accept clicked'),\n * returnValue: true,\n * },\n * {\n * label: 'Cancel',\n * severity: 'danger',\n * action: () => console.log('Cancel clicked'),\n * returnValue: false,\n * },\n * ],\n * size: 'small',\n * closable: true,\n * closeOnOutsideClick: false,\n * }).subscribe((result) => {\n * console.log('Modal closed with value:', result);\n * });\n * ```\n */\n\n@Component({\n selector: 'tk-modal',\n standalone: true,\n imports: [DialogModule, ButtonComponent, NgComponentOutlet],\n templateUrl: './modal.component.html',\n styleUrls: ['./modal.component.scss']\n})\nexport class ModalComponent {\n\n constructor(private readonly elementRef: ElementRef) {}\n\n /** The title displayed at the top of the modal */\n title = input<string>('');\n /** The main content of the modal */\n content = input<string | Type<unknown> | null>(null);\n /** Array of footer buttons with label, callback, and return value */\n footerButtons = input<ModalFooterButton[]>([]);\n /** Modal size: 'small', 'large', or 'full' */\n size = input<ModalSizeType>('small');\n /** Whether the modal can be closed by the user */\n closable = input<boolean>(true);\n /** Whether clicking outside closes the modal */\n closeOnOutsideClick = input<boolean>(false);\n isContentString = computed(() => typeof this.content() === 'string');\n /** Computed: whether the modal has footer buttons */\n hasFooter = computed(() => (this.footerButtons() ?? []).length > 0);\n\n /**\n * Whether the modal should be responsive on mobile screens.\n * If true, the modal width will adapt based on breakpoints.\n * @default true\n */\n responsive = input<boolean>(true);\n\n /** Computed: calculates modal max-width based on `size` */\n modalMaxWidth = computed(() => {\n switch (this.size()) {\n case 'large':\n return '67.5rem'; // Large\n case 'medium':\n return '35rem'; // Medium\n case 'full':\n return '98vw'; // Full\n default:\n return '25rem'; // Small\n }\n });\n /** Whether the modal content has a scrollbar */\n hasScroll = false;\n\n /** Visibility flag */\n isOpened: boolean = false;\n\n /** Emits when the modal closes, passing the return value from footer buttons or null */\n readonly onClose = new EventEmitter<unknown>();\n private alreadyEmitted = false;\n private returnValueOnClose: unknown = null;\n\n /** Opens the modal */\n open() {\n this.isOpened = true;\n this.alreadyEmitted = false;\n this.returnValueOnClose = null;\n }\n\n /**\n * Checks if the modal content has a scrollbar and updates `hasScroll` state.\n * This is called when the modal is shown.\n */\n checkScroll() {\n const contentEl = this.elementRef.nativeElement.querySelector('.p-dialog-content');\n if (contentEl) {\n this.hasScroll = contentEl.scrollHeight > contentEl.clientHeight;\n }\n }\n\n /** Closes the modal and emits onClose with null */\n handleClose() {\n if (!this.alreadyEmitted) {\n this.onClose.emit(null);\n } else {\n this.onClose.emit(this.returnValueOnClose);\n }\n this.alreadyEmitted = false;\n this.returnValueOnClose = null;\n }\n\n /** Closes the modal without emitting an event */\n close() {\n this.isOpened = false;\n }\n\n /**\n * Handles footer button actions.\n * Executes the action callback, emits `onClose` with the provided returnValue, then closes the modal.\n * @param action Callback to execute when the button is clicked\n * @param returnValue Value emitted on modal close\n */\n handleAction(action: (() => void) | undefined, returnValue: unknown) {\n if (action) action();\n this.alreadyEmitted = true;\n this.returnValueOnClose = returnValue;\n this.isOpened = false;\n }\n}","<p-dialog\n [modal]=\"true\"\n [(visible)]=\"isOpened\"\n [closable]=\"closable()\"\n [dismissableMask]=\"closeOnOutsideClick()\"\n [draggable]=\"false\"\n [focusOnShow]=\"false\"\n [header]=\"title()\"\n [style]=\"{ 'max-width': modalMaxWidth(), width: 'calc(100% - var(--tk-spacing-base-200))' }\"\n (onHide)=\"handleClose()\"\n (onShow)=\"checkScroll()\"\n class=\"tk-modal\"\n>\n <section class=\"tk-modal__content\">\n @if (content()) {\n @if (isContentString()) {\n <p [innerHTML]=\"content()\" ></p>\n } @else {\n <ng-container *ngComponentOutlet=\"$any(content())\"></ng-container>\n }\n }\n </section>\n\n <ng-template pTemplate=\"footer\">\n @if (hasFooter()) {\n <section class=\"tk-modal__footer\" [class.tk-modal__footer--with-content]=\"hasScroll\">\n @for (btn of footerButtons()!; track $index) {\n <tk-button\n [label]=\"btn.label\"\n [severity]=\"btn.severity\"\n [variant]=\"btn.variant\"\n (clicked)=\"handleAction(btn.action, btn.returnValue)\"\n (keydown.enter)=\"handleAction(btn.action, btn.returnValue)\"\n (keydown.space)=\"handleAction(btn.action, btn.returnValue)\"\n />\n }\n </section>\n }\n </ng-template>\n</p-dialog>\n","import {\n Injectable,\n ApplicationRef,\n ComponentRef,\n Injector,\n createComponent,\n EmbeddedViewRef,\n} from '@angular/core';\nimport { ModalComponent } from '../modal.component';\nimport { Observable, Subject } from 'rxjs';\nimport { ModalConfig } from '../modal.types';\n\n@Injectable({ providedIn: 'root' })\nexport class ModalService {\n private modalRef: ComponentRef<ModalComponent> | null = null;\n\n constructor(\n private readonly injector: Injector,\n private readonly appRef: ApplicationRef\n ) {}\n\n get _modalRefForTesting(): ComponentRef<ModalComponent> | null {\n return this.modalRef;\n }\n set _modalRefForTesting(ref: ComponentRef<ModalComponent> | null) {\n this.modalRef = ref;\n }\n\n open(config: ModalConfig): Observable<unknown> {\n if (this.modalRef) {\n return this.modalRef.instance.onClose.asObservable();\n }\n\n const componentRef = createComponent(ModalComponent, {\n environmentInjector: this.appRef.injector,\n });\n\n this.appRef.attachView(componentRef.hostView);\n\n const domElem = (componentRef.hostView as EmbeddedViewRef<unknown>).rootNodes[0] as HTMLElement;\n document.body.appendChild(domElem);\n\n componentRef.setInput('title', config.title);\n componentRef.setInput('content', config.content ?? null);\n componentRef.setInput('footerButtons', config.footerButtons ?? []);\n componentRef.setInput('size', config.size ?? 'small');\n componentRef.setInput('closable', config.closable ?? true);\n componentRef.setInput('closeOnOutsideClick', config.closeOnOutsideClick ?? false);\n\n const close$ = new Subject<unknown>();\n\n componentRef.instance.onClose.subscribe((value) => {\n close$.next(value);\n close$.complete();\n\n this.appRef.detachView(componentRef.hostView);\n componentRef.destroy();\n this.modalRef = null;\n });\n\n componentRef.instance.open();\n this.modalRef = componentRef;\n\n return close$.asObservable();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCG;MASU,cAAc,CAAA;AAEzB,IAAA,WAAA,CAA6B,UAAsB,EAAA;QAAtB,IAAU,CAAA,UAAA,GAAV,UAAU;;AAGvC,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAS,EAAE,CAAC;;AAEzB,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAgC,IAAI,CAAC;;AAEpD,QAAA,IAAA,CAAA,aAAa,GAAG,KAAK,CAAsB,EAAE,CAAC;;AAE9C,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAgB,OAAO,CAAC;;AAEpC,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAU,IAAI,CAAC;;AAE/B,QAAA,IAAA,CAAA,mBAAmB,GAAG,KAAK,CAAU,KAAK,CAAC;AAC3C,QAAA,IAAA,CAAA,eAAe,GAAG,QAAQ,CAAC,MAAM,OAAO,IAAI,CAAC,OAAO,EAAE,KAAK,QAAQ,CAAC;;AAEpE,QAAA,IAAA,CAAA,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;AAEnE;;;;AAIG;AACH,QAAA,IAAA,CAAA,UAAU,GAAG,KAAK,CAAU,IAAI,CAAC;;AAGjC,QAAA,IAAA,CAAA,aAAa,GAAG,QAAQ,CAAC,MAAK;AAC5B,YAAA,QAAQ,IAAI,CAAC,IAAI,EAAE;AACjB,gBAAA,KAAK,OAAO;oBACV,OAAO,SAAS,CAAC;AACnB,gBAAA,KAAK,QAAQ;oBACX,OAAO,OAAO,CAAC;AACjB,gBAAA,KAAK,MAAM;oBACT,OAAO,MAAM,CAAC;AAChB,gBAAA;o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,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,QAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,cAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAZ,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,cADC,MAAM,EAAA,CAAA,CAAA;;4FACnB,YAAY,EAAA,UAAA,EAAA,CAAA;kBADxB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACZlC;;AAEG;;;;"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, model, output, viewChild, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i2 from 'primeng/tabs';
|
|
6
|
+
import { TabsModule } from 'primeng/tabs';
|
|
7
|
+
import { TooltipComponent } from '@tekus/design-system/components/tooltip';
|
|
8
|
+
import { BadgeComponent } from '@tekus/design-system/components/badge';
|
|
9
|
+
|
|
10
|
+
class TabsComponent {
|
|
11
|
+
constructor() {
|
|
12
|
+
/**
|
|
13
|
+
* @property {InputSignal<TabData[]>} tabs
|
|
14
|
+
* @description
|
|
15
|
+
* Array of tab configurations to display.
|
|
16
|
+
*/
|
|
17
|
+
this.tabs = input([]);
|
|
18
|
+
/**
|
|
19
|
+
* @property {ModelSignal<number>} activeIndex
|
|
20
|
+
* @description
|
|
21
|
+
* The index of the currently active tab. Supports two-way binding via signals.
|
|
22
|
+
* @default 0
|
|
23
|
+
*/
|
|
24
|
+
this.activeIndex = model(0);
|
|
25
|
+
/**
|
|
26
|
+
* @event tabChange
|
|
27
|
+
* @description
|
|
28
|
+
* Emitted when the active tab changes.
|
|
29
|
+
* Payload: object containing the tab index and tab data.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* <tk-tabs (tabChange)="onTabChange($event)"></tk-tabs>
|
|
33
|
+
*/
|
|
34
|
+
this.tabChange = output();
|
|
35
|
+
/**
|
|
36
|
+
* @property {ViewChild<TabsComponent>} tkTabs
|
|
37
|
+
* @description
|
|
38
|
+
* Reference to the tabs component for programmatic access.
|
|
39
|
+
*/
|
|
40
|
+
this.tkTabs = viewChild('tkTabs');
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @method visibleTabs
|
|
44
|
+
* @description
|
|
45
|
+
* Returns only the tabs that are marked as visible.
|
|
46
|
+
* @returns {TabData[]} Array of visible tabs.
|
|
47
|
+
*/
|
|
48
|
+
get visibleTabs() {
|
|
49
|
+
return this.tabs().filter(t => t.visible !== false);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @method onTabChange
|
|
53
|
+
* @description
|
|
54
|
+
* Handles tab change events and emits the tabChange output.
|
|
55
|
+
* @param {number} index - The index of the newly selected tab.
|
|
56
|
+
*/
|
|
57
|
+
onTabChange(index) {
|
|
58
|
+
this.activeIndex.set(index);
|
|
59
|
+
this.tabChange.emit({
|
|
60
|
+
index,
|
|
61
|
+
tab: this.visibleTabs[index],
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
65
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: TabsComponent, isStandalone: true, selector: "tk-tabs", inputs: { tabs: { classPropertyName: "tabs", publicName: "tabs", isSignal: true, isRequired: false, transformFunction: null }, activeIndex: { classPropertyName: "activeIndex", publicName: "activeIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeIndex: "activeIndexChange", tabChange: "tabChange" }, viewQueries: [{ propertyName: "tkTabs", first: true, predicate: ["tkTabs"], descendants: true, isSignal: true }], ngImport: i0, template: "<p-tabs\n #tkTabs\n [value]=\"activeIndex()\"\n scrollable\n (valueChange)=\"onTabChange(+$event)\"\n class=\"tk-tabs\">\n <p-tablist>\n <p-tab\n *ngFor=\"let tab of visibleTabs; let i = index\"\n [value]=\"i\"\n [disabled]=\"tab.disabled\"\n tooltipPosition=\"top\">\n <tk-tooltip [content]=\"tab.tooltip ?? ''\" position=\"top\">\n <span\n class=\"tk-tab-label\"\n [style.max-width]=\"tab.badge ? '6rem' : '9rem'\">\n {{ tab.label }}\n </span>\n </tk-tooltip>\n @if(tab.badge){\n <tk-badge [value]=\"tab.badge\"></tk-badge>\n }\n </p-tab>\n </p-tablist>\n\n <p-tabpanels>\n @for (tab of visibleTabs; track $index) {\n <p-tabpanel [value]=\"$index\">\n @if (!tab.lazy || activeIndex() === $index) {\n <ng-container *ngTemplateOutlet=\"tab.content || null\"></ng-container>\n }\n </p-tabpanel>\n }\n </p-tabpanels>\n</p-tabs>\n", styles: [".tk-tabs{width:100%}.tk-tabs .p-tablist{display:flex;width:100%}.tk-tabs .tk-tab-label{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--tk-surface-950, #191a1b);font-size:var(--tk-font-size-sm, .875rem);font-weight:var(--tk-font-weight-regular, 400)}:host ::ng-deep .p-tab{padding:var(--tk-spacing-base-50, .5rem) var(--tk-spacing-base-100, 1rem);max-width:var(--tk-size-base-1000, 10rem)}:host ::ng-deep .p-tab-active{background-color:var(--tk-primary-100, #b7b0d2);color:var(--tk-primary-700, #10004f)}:host ::ng-deep .tk-tooltip-wrapper{display:flex!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: TabsModule }, { kind: "component", type: i2.Tabs, selector: "p-tabs", inputs: ["value", "scrollable", "lazy", "selectOnFocus", "showNavigators", "tabindex"], outputs: ["valueChange"] }, { kind: "component", type: i2.TabPanels, selector: "p-tabpanels" }, { kind: "component", type: i2.TabPanel, selector: "p-tabpanel", inputs: ["value"], outputs: ["valueChange"] }, { kind: "component", type: i2.TabList, selector: "p-tablist" }, { kind: "component", type: i2.Tab, selector: "p-tab", inputs: ["value", "disabled"], outputs: ["valueChange"] }, { kind: "component", type: TooltipComponent, selector: "tk-tooltip", inputs: ["content", "position"] }, { kind: "component", type: BadgeComponent, selector: "tk-badge", inputs: ["value", "severity"] }] }); }
|
|
66
|
+
}
|
|
67
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TabsComponent, decorators: [{
|
|
68
|
+
type: Component,
|
|
69
|
+
args: [{ selector: 'tk-tabs', imports: [CommonModule, TabsModule, TooltipComponent, BadgeComponent], template: "<p-tabs\n #tkTabs\n [value]=\"activeIndex()\"\n scrollable\n (valueChange)=\"onTabChange(+$event)\"\n class=\"tk-tabs\">\n <p-tablist>\n <p-tab\n *ngFor=\"let tab of visibleTabs; let i = index\"\n [value]=\"i\"\n [disabled]=\"tab.disabled\"\n tooltipPosition=\"top\">\n <tk-tooltip [content]=\"tab.tooltip ?? ''\" position=\"top\">\n <span\n class=\"tk-tab-label\"\n [style.max-width]=\"tab.badge ? '6rem' : '9rem'\">\n {{ tab.label }}\n </span>\n </tk-tooltip>\n @if(tab.badge){\n <tk-badge [value]=\"tab.badge\"></tk-badge>\n }\n </p-tab>\n </p-tablist>\n\n <p-tabpanels>\n @for (tab of visibleTabs; track $index) {\n <p-tabpanel [value]=\"$index\">\n @if (!tab.lazy || activeIndex() === $index) {\n <ng-container *ngTemplateOutlet=\"tab.content || null\"></ng-container>\n }\n </p-tabpanel>\n }\n </p-tabpanels>\n</p-tabs>\n", styles: [".tk-tabs{width:100%}.tk-tabs .p-tablist{display:flex;width:100%}.tk-tabs .tk-tab-label{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--tk-surface-950, #191a1b);font-size:var(--tk-font-size-sm, .875rem);font-weight:var(--tk-font-weight-regular, 400)}:host ::ng-deep .p-tab{padding:var(--tk-spacing-base-50, .5rem) var(--tk-spacing-base-100, 1rem);max-width:var(--tk-size-base-1000, 10rem)}:host ::ng-deep .p-tab-active{background-color:var(--tk-primary-100, #b7b0d2);color:var(--tk-primary-700, #10004f)}:host ::ng-deep .tk-tooltip-wrapper{display:flex!important}\n"] }]
|
|
70
|
+
}] });
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Generated bundle index. Do not edit.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
export { TabsComponent };
|
|
77
|
+
//# sourceMappingURL=tekus-design-system-components-tabs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tekus-design-system-components-tabs.mjs","sources":["../../../projects/design-system/components/tabs/src/tabs.component.ts","../../../projects/design-system/components/tabs/src/tabs.component.html","../../../projects/design-system/components/tabs/tekus-design-system-components-tabs.ts"],"sourcesContent":["import { Component, input, output, model, viewChild } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { TabsModule } from 'primeng/tabs';\nimport { TabData } from './tabs.interface';\nimport { TooltipComponent } from '@tekus/design-system/components/tooltip';\nimport { BadgeComponent } from '@tekus/design-system/components/badge';\n\n@Component({\n selector: 'tk-tabs',\n imports: [CommonModule, TabsModule, TooltipComponent, BadgeComponent],\n templateUrl: './tabs.component.html',\n styleUrl: './tabs.component.scss',\n})\nexport class TabsComponent {\n /**\n * @property {InputSignal<TabData[]>} tabs\n * @description\n * Array of tab configurations to display.\n */\n tabs = input<TabData[]>([]);\n\n /**\n * @property {ModelSignal<number>} activeIndex\n * @description\n * The index of the currently active tab. Supports two-way binding via signals.\n * @default 0\n */\n activeIndex = model<number>(0);\n\n /**\n * @event tabChange\n * @description\n * Emitted when the active tab changes.\n * Payload: object containing the tab index and tab data.\n *\n * @example\n * <tk-tabs (tabChange)=\"onTabChange($event)\"></tk-tabs>\n */\n tabChange = output<{\n index: number;\n tab: TabData;\n }>();\n\n /**\n * @property {ViewChild<TabsComponent>} tkTabs\n * @description\n * Reference to the tabs component for programmatic access.\n */\n tkTabs = viewChild('tkTabs');\n\n /**\n * @method visibleTabs\n * @description\n * Returns only the tabs that are marked as visible.\n * @returns {TabData[]} Array of visible tabs.\n */\n get visibleTabs(): TabData[] {\n return this.tabs().filter(t => t.visible !== false);\n }\n\n /**\n * @method onTabChange\n * @description\n * Handles tab change events and emits the tabChange output.\n * @param {number} index - The index of the newly selected tab.\n */\n onTabChange(index: number) {\n this.activeIndex.set(index);\n\n this.tabChange.emit({\n index,\n tab: this.visibleTabs[index],\n });\n }\n}\n","<p-tabs\n #tkTabs\n [value]=\"activeIndex()\"\n scrollable\n (valueChange)=\"onTabChange(+$event)\"\n class=\"tk-tabs\">\n <p-tablist>\n <p-tab\n *ngFor=\"let tab of visibleTabs; let i = index\"\n [value]=\"i\"\n [disabled]=\"tab.disabled\"\n tooltipPosition=\"top\">\n <tk-tooltip [content]=\"tab.tooltip ?? ''\" position=\"top\">\n <span\n class=\"tk-tab-label\"\n [style.max-width]=\"tab.badge ? '6rem' : '9rem'\">\n {{ tab.label }}\n </span>\n </tk-tooltip>\n @if(tab.badge){\n <tk-badge [value]=\"tab.badge\"></tk-badge>\n }\n </p-tab>\n </p-tablist>\n\n <p-tabpanels>\n @for (tab of visibleTabs; track $index) {\n <p-tabpanel [value]=\"$index\">\n @if (!tab.lazy || activeIndex() === $index) {\n <ng-container *ngTemplateOutlet=\"tab.content || null\"></ng-container>\n }\n </p-tabpanel>\n }\n </p-tabpanels>\n</p-tabs>\n","/**\n * Generated bundle index. Do not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aAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,gBAAgB,EAAA,QAAA,EAAA,YAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,UAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,cAAc,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,UAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;4FAIzD,aAAa,EAAA,UAAA,EAAA,CAAA;kBANzB,SAAS;+BACE,SAAS,EAAA,OAAA,EACV,CAAC,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,cAAc,CAAC,EAAA,QAAA,EAAA,67BAAA,EAAA,MAAA,EAAA,CAAA,0lBAAA,CAAA,EAAA;;;AETvE;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tekus/design-system",
|
|
3
3
|
"description": "Tekus design system library",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.16.0",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"@angular/core": "^19.2.15",
|
|
@@ -39,18 +39,14 @@
|
|
|
39
39
|
"types": "./core/index.d.ts",
|
|
40
40
|
"default": "./fesm2022/tekus-design-system-core.mjs"
|
|
41
41
|
},
|
|
42
|
-
"./directives/gird-item": {
|
|
43
|
-
"types": "./directives/gird-item/index.d.ts",
|
|
44
|
-
"default": "./fesm2022/tekus-design-system-directives-gird-item.mjs"
|
|
45
|
-
},
|
|
46
|
-
"./core/types": {
|
|
47
|
-
"types": "./core/types/index.d.ts",
|
|
48
|
-
"default": "./fesm2022/tekus-design-system-core-types.mjs"
|
|
49
|
-
},
|
|
50
42
|
"./components/autocomplete": {
|
|
51
43
|
"types": "./components/autocomplete/index.d.ts",
|
|
52
44
|
"default": "./fesm2022/tekus-design-system-components-autocomplete.mjs"
|
|
53
45
|
},
|
|
46
|
+
"./components/badge": {
|
|
47
|
+
"types": "./components/badge/index.d.ts",
|
|
48
|
+
"default": "./fesm2022/tekus-design-system-components-badge.mjs"
|
|
49
|
+
},
|
|
54
50
|
"./components/button": {
|
|
55
51
|
"types": "./components/button/index.d.ts",
|
|
56
52
|
"default": "./fesm2022/tekus-design-system-components-button.mjs"
|
|
@@ -71,6 +67,10 @@
|
|
|
71
67
|
"types": "./components/icon/index.d.ts",
|
|
72
68
|
"default": "./fesm2022/tekus-design-system-components-icon.mjs"
|
|
73
69
|
},
|
|
70
|
+
"./components/input-number": {
|
|
71
|
+
"types": "./components/input-number/index.d.ts",
|
|
72
|
+
"default": "./fesm2022/tekus-design-system-components-input-number.mjs"
|
|
73
|
+
},
|
|
74
74
|
"./components/input-text": {
|
|
75
75
|
"types": "./components/input-text/index.d.ts",
|
|
76
76
|
"default": "./fesm2022/tekus-design-system-components-input-text.mjs"
|
|
@@ -99,6 +99,10 @@
|
|
|
99
99
|
"types": "./components/table/index.d.ts",
|
|
100
100
|
"default": "./fesm2022/tekus-design-system-components-table.mjs"
|
|
101
101
|
},
|
|
102
|
+
"./components/tabs": {
|
|
103
|
+
"types": "./components/tabs/index.d.ts",
|
|
104
|
+
"default": "./fesm2022/tekus-design-system-components-tabs.mjs"
|
|
105
|
+
},
|
|
102
106
|
"./components/tag": {
|
|
103
107
|
"types": "./components/tag/index.d.ts",
|
|
104
108
|
"default": "./fesm2022/tekus-design-system-components-tag.mjs"
|
|
@@ -115,6 +119,14 @@
|
|
|
115
119
|
"types": "./components/tooltip/index.d.ts",
|
|
116
120
|
"default": "./fesm2022/tekus-design-system-components-tooltip.mjs"
|
|
117
121
|
},
|
|
122
|
+
"./core/types": {
|
|
123
|
+
"types": "./core/types/index.d.ts",
|
|
124
|
+
"default": "./fesm2022/tekus-design-system-core-types.mjs"
|
|
125
|
+
},
|
|
126
|
+
"./directives/gird-item": {
|
|
127
|
+
"types": "./directives/gird-item/index.d.ts",
|
|
128
|
+
"default": "./fesm2022/tekus-design-system-directives-gird-item.mjs"
|
|
129
|
+
},
|
|
118
130
|
"./utils/sanitizer-utils": {
|
|
119
131
|
"types": "./utils/sanitizer-utils/index.d.ts",
|
|
120
132
|
"default": "./fesm2022/tekus-design-system-utils-sanitizer-utils.mjs"
|