From 0d2bf88f82ba2be232afc7805eb951718cfe663c Mon Sep 17 00:00:00 2001 From: ATS - Elhakim Cool Date: Sun, 22 Dec 2024 02:10:12 +0700 Subject: [PATCH 1/2] fix: add utilities for accoridon root --- .github/workflows/dependency-review.yml | 2 +- .github/workflows/greetings.yml | 10 ++-- apps/playground/src/app/app.component.html | 6 +++ .../accordion-content.component.html | 4 +- .../accordion-content.component.ts | 6 +-- .../accordion-item.component.html | 3 +- .../accordion-item.component.ts | 19 ++++---- .../accordion-root.component.html | 3 +- .../accordion-root.component.spec.ts | 2 +- .../accordion-root.component.ts | 48 +++++++++++-------- .../accordion-trigger.component.html | 3 +- .../accordion-trigger.component.ts | 10 ++-- .../accordion/src/components/index.ts | 2 +- .../src/configs/accordion-config.spec.ts | 24 +++++++--- .../accordion/src/configs/accordion-config.ts | 23 ++++++--- .../accordion-content.context.spec.ts | 8 ++-- .../accordion-item.context.spec.ts | 6 +-- .../accordion-root.context.spec.ts | 6 +-- .../accordion-trigger.context.spec.ts | 6 +-- ...ollapse-expand-animation.directive.spec.ts | 20 ++------ .../accordion-root/accordion-root.css.ts | 26 +++++----- .../primitives/accordion/src/themes/index.ts | 2 +- .../src/tokens/accordion-component.token.ts | 8 ++-- .../primitives/slot/src/components/index.ts | 2 +- .../src/components/slot/slot.component.html | 14 +++--- .../primitives/slot/src/directives/index.ts | 2 +- packages/primitives/slot/src/index.ts | 2 +- .../mouse-event/mouse-event.directive.spec.ts | 6 +-- 28 files changed, 149 insertions(+), 124 deletions(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index d19e21b..0c38d1d 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -10,7 +10,7 @@ name: 'Dependency review' on: pull_request: - branches: [ "main" ] + branches: ['main'] # If using a dependency submission action in this workflow this permission will need to be set to: # diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index 4677434..95acb51 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -9,8 +9,8 @@ jobs: issues: write pull-requests: write steps: - - uses: actions/first-interaction@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: "Message that will be displayed on users' first issue" - pr-message: "Message that will be displayed on users' first pull request" + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: "Message that will be displayed on users' first issue" + pr-message: "Message that will be displayed on users' first pull request" diff --git a/apps/playground/src/app/app.component.html b/apps/playground/src/app/app.component.html index 35f1a2f..16da5b8 100644 --- a/apps/playground/src/app/app.component.html +++ b/apps/playground/src/app/app.component.html @@ -13,6 +13,12 @@ > Collapse All + - - \ No newline at end of file + diff --git a/packages/primitives/accordion/src/components/accordion-content/accordion-content.component.ts b/packages/primitives/accordion/src/components/accordion-content/accordion-content.component.ts index b181a17..8ff0945 100644 --- a/packages/primitives/accordion/src/components/accordion-content/accordion-content.component.ts +++ b/packages/primitives/accordion/src/components/accordion-content/accordion-content.component.ts @@ -37,8 +37,8 @@ import { NgxPrimerIdGeneratorDirective } from '@ngx-primer/primitive/utilities'; inputs: ['ngxPrimerIdAttr'], }, { - directive: NgxPrimerAccordionContentContextDirective - } + directive: NgxPrimerAccordionContentContextDirective, + }, ], }) export class NgxPrimerAccordionContentComponent implements OnInit { @@ -95,7 +95,7 @@ export class NgxPrimerAccordionContentComponent implements OnInit { protected runInitializationFn(doneFn?:

(args?: P) => void): void { if (doneFn) { doneFn({ - context: this.accordionContentContext + context: this.accordionContentContext, }); } } diff --git a/packages/primitives/accordion/src/components/accordion-item/accordion-item.component.html b/packages/primitives/accordion/src/components/accordion-item/accordion-item.component.html index d7b4509..5f359ea 100644 --- a/packages/primitives/accordion/src/components/accordion-item/accordion-item.component.html +++ b/packages/primitives/accordion/src/components/accordion-item/accordion-item.component.html @@ -1,2 +1 @@ - - \ No newline at end of file + diff --git a/packages/primitives/accordion/src/components/accordion-item/accordion-item.component.ts b/packages/primitives/accordion/src/components/accordion-item/accordion-item.component.ts index d6d644e..6006290 100644 --- a/packages/primitives/accordion/src/components/accordion-item/accordion-item.component.ts +++ b/packages/primitives/accordion/src/components/accordion-item/accordion-item.component.ts @@ -47,8 +47,8 @@ import { NgxPrimerIdGeneratorDirective } from '@ngx-primer/primitive/utilities'; inputs: ['ngxPrimerIdAttr'], }, { - directive: NgxPrimerAccordionItemContextDirective - } + directive: NgxPrimerAccordionItemContextDirective, + }, ], }) export class NgxPrimerAccordionItemComponent implements OnInit { @@ -91,16 +91,15 @@ export class NgxPrimerAccordionItemComponent implements OnInit { } ); - public readonly value = model(null, { + public readonly value = model(null, { alias: 'ngxPrimerAccordionItemValue', }); - /** * Whether the accordion item is disabled. */ public readonly disabled = model(false, { - alias: 'ngxPrimerAccordionItemDisabled' + alias: 'ngxPrimerAccordionItemDisabled', }); public readonly isOpen = computed(() => @@ -168,9 +167,11 @@ export class NgxPrimerAccordionItemComponent implements OnInit { protected runInitializationFn(doneFn?:

(args?: P) => void): void { if (doneFn) { // ensure context being initalized - setTimeout(() => doneFn({ - context: this.accordionItemContext - })); + setTimeout(() => + doneFn({ + context: this.accordionItemContext, + }) + ); } } @@ -184,7 +185,7 @@ export class NgxPrimerAccordionItemComponent implements OnInit { ?.instance as NgxPrimerAccordionRootComponent; } - focus(){ + focus() { this.accordionTrigger()?.focus(); } } diff --git a/packages/primitives/accordion/src/components/accordion-root/accordion-root.component.html b/packages/primitives/accordion/src/components/accordion-root/accordion-root.component.html index d7b4509..5f359ea 100644 --- a/packages/primitives/accordion/src/components/accordion-root/accordion-root.component.html +++ b/packages/primitives/accordion/src/components/accordion-root/accordion-root.component.html @@ -1,2 +1 @@ - - \ No newline at end of file + diff --git a/packages/primitives/accordion/src/components/accordion-root/accordion-root.component.spec.ts b/packages/primitives/accordion/src/components/accordion-root/accordion-root.component.spec.ts index 63c59d8..0ff8bd6 100644 --- a/packages/primitives/accordion/src/components/accordion-root/accordion-root.component.spec.ts +++ b/packages/primitives/accordion/src/components/accordion-root/accordion-root.component.spec.ts @@ -58,7 +58,7 @@ describe('NgxPrimerAccordionRootComponent', () => { for (const key in config) { const keyName = key as keyof typeof config; - if(typeof config[keyName] === 'function') return; // skip function; + if (typeof config[keyName] === 'function') return; // skip function; expect(component.accordionConfig[keyName]).toEqual(config[keyName]); } }); diff --git a/packages/primitives/accordion/src/components/accordion-root/accordion-root.component.ts b/packages/primitives/accordion/src/components/accordion-root/accordion-root.component.ts index b2e5a0a..f24712a 100644 --- a/packages/primitives/accordion/src/components/accordion-root/accordion-root.component.ts +++ b/packages/primitives/accordion/src/components/accordion-root/accordion-root.component.ts @@ -569,6 +569,10 @@ export class NgxPrimerAccordionRootComponent implements OnInit { this.toggleAll(false); } + public toogleAllValue() { + this.toggleAll(); + } + /** * Toggles the open/closed state of all accordion items based on the provided `isOpen` value. * @@ -583,20 +587,18 @@ export class NgxPrimerAccordionRootComponent implements OnInit { * - `false`: Collapses all accordion items. * @returns {void} This method does not return anything. It only updates the open/closed state of all items. */ - private toggleAll(isOpen: boolean) { + private toggleAll(isOpen?: boolean) { if (this.type() === 'Single' || this.disabled()) return; this.accordionItems().forEach(({ disabled, value }) => { - const isItemDisabled = disabled(); - if (isItemDisabled) return; - this.toogleMultiple(value(), !isOpen); + if (disabled()) return; + this.toogleMultiple(value(), isOpen ?? this.isOpen(value())); }); } - /** * Expands the accordion with the given value(s). - * + * * If the value is currently collapsed, it will be expanded. * If the value is currently expanded, it will remain expanded. * @@ -608,7 +610,7 @@ export class NgxPrimerAccordionRootComponent implements OnInit { /** * Collapses the specified value(s) in the accordion. - * + * * If the value is currently expanded, it will be collapsed. * If the value is currently collapsed, it will remain collapsed. * @@ -618,13 +620,12 @@ export class NgxPrimerAccordionRootComponent implements OnInit { this.toggleValue(value, false); } - /** * Toggles the expansion state of the given value(s). - * + * * If the value is currently collapsed, it will be expanded. * If the value is currently expanded, it will be collapsed. - * + * * @protected * @param {T | T[]} value - The value or array of values to toggle. * @param {boolean} isExpanding - A flag indicating whether to expand (true) or collapse (false) the value(s). @@ -649,7 +650,7 @@ export class NgxPrimerAccordionRootComponent implements OnInit { /** * Enables the specified value(s) by updating their disable state. - * + * * If the value is currently disabled, it will be enabled. * If the value is currently enabled, it will remain enabled. * @@ -663,10 +664,10 @@ export class NgxPrimerAccordionRootComponent implements OnInit { /** * Disables the specified value(s) by updating their disable state. - * + * * If the value is currently enabled, it will be disabled. * If the value is currently disabled, it will remain disabled. - * + * * @public * @method * @param value - The value or array of values to be disabled. @@ -678,28 +679,33 @@ export class NgxPrimerAccordionRootComponent implements OnInit { /** * Updates the disable state of the specified value(s). - * + * * If the value is currently disabled, it will be enabled. * If the value is currently enabled, it will be disabled. - * + * * @protected * @param {T | T[]} value - The value or array of values to update. * @param {boolean} enable - A flag indicating whether to enable (true) or disable (false) the value(s). */ protected updateDisableState(value: T | T[], enable: boolean) { const values = Array.isArray(value) ? value : [value]; - - const accordionItems = this.accordionItems().filter((item) => values.includes(item.value())); - - const update = (item: NgxPrimerAccordionItemComponent, enable: boolean) => { + + const accordionItems = this.accordionItems().filter((item) => + values.includes(item.value()) + ); + + const update = ( + item: NgxPrimerAccordionItemComponent, + enable: boolean + ) => { const isDisabled = item.disabled(); const shouldDisable = !enable; - + if (isDisabled !== shouldDisable) { item.disabled.set(shouldDisable ? true : false); } }; - + accordionItems.forEach((item) => update(item, enable)); } } diff --git a/packages/primitives/accordion/src/components/accordion-trigger/accordion-trigger.component.html b/packages/primitives/accordion/src/components/accordion-trigger/accordion-trigger.component.html index d7b4509..5f359ea 100644 --- a/packages/primitives/accordion/src/components/accordion-trigger/accordion-trigger.component.html +++ b/packages/primitives/accordion/src/components/accordion-trigger/accordion-trigger.component.html @@ -1,2 +1 @@ - - \ No newline at end of file + diff --git a/packages/primitives/accordion/src/components/accordion-trigger/accordion-trigger.component.ts b/packages/primitives/accordion/src/components/accordion-trigger/accordion-trigger.component.ts index ca5f10b..bb8a8d4 100644 --- a/packages/primitives/accordion/src/components/accordion-trigger/accordion-trigger.component.ts +++ b/packages/primitives/accordion/src/components/accordion-trigger/accordion-trigger.component.ts @@ -235,8 +235,9 @@ export class NgxPrimerAccordionTriggerComponent implements OnInit { } @HostListener('click') - toogle() { - if (this.accordionRoot?.disabled() || this.accordionItem?.disabled()) return; + public toogle() { + if (this.accordionRoot?.disabled() || this.accordionItem?.disabled()) + return; this.accordionRoot?.toggle(this.accordionItem?.value() as T); } @@ -326,8 +327,9 @@ export class NgxPrimerAccordionTriggerComponent implements OnInit { ?.instance as NgxPrimerAccordionContentComponent; } - focus() { - if(this.accordionRoot?.disabled() || this.accordionItem?.disabled()) return; + public focus() { + if (this.accordionRoot?.disabled() || this.accordionItem?.disabled()) + return; (this.viewContainerRef.element.nativeElement as HTMLElement).focus({ preventScroll: false, }); diff --git a/packages/primitives/accordion/src/components/index.ts b/packages/primitives/accordion/src/components/index.ts index 7405547..1d0cdc7 100644 --- a/packages/primitives/accordion/src/components/index.ts +++ b/packages/primitives/accordion/src/components/index.ts @@ -1,4 +1,4 @@ export * from './accordion-root/accordion-root.component'; export * from './accordion-item/accordion-item.component'; export * from './accordion-content/accordion-content.component'; -export * from './accordion-trigger/accordion-trigger.component'; \ No newline at end of file +export * from './accordion-trigger/accordion-trigger.component'; diff --git a/packages/primitives/accordion/src/configs/accordion-config.spec.ts b/packages/primitives/accordion/src/configs/accordion-config.spec.ts index 9e15abb..f07f75b 100644 --- a/packages/primitives/accordion/src/configs/accordion-config.spec.ts +++ b/packages/primitives/accordion/src/configs/accordion-config.spec.ts @@ -1,4 +1,10 @@ -import { NgxPrimerAccordionConfig, NgxPrimerAccordionOrientation, NgxPrimerAccordionType, defaultAccordionConfig, provideAccordionConfig } from './accordion-config'; +import { + NgxPrimerAccordionConfig, + NgxPrimerAccordionOrientation, + NgxPrimerAccordionType, + defaultAccordionConfig, + provideAccordionConfig, +} from './accordion-config'; import { NgxPrimerAccordionConfigToken } from '../tokens/accordion-config.token'; import { TestBed } from '@angular/core/testing'; @@ -52,10 +58,12 @@ describe('AccordionConfig', () => { it('should provide custom config', () => { TestBed.configureTestingModule({ - providers: [provideAccordionConfig({ - type: NgxPrimerAccordionType.Single, - collapsible: false, - })], + providers: [ + provideAccordionConfig({ + type: NgxPrimerAccordionType.Single, + collapsible: false, + }), + ], }); const injectedConfig = TestBed.inject(NgxPrimerAccordionConfigToken); expect(injectedConfig.type).toBe(NgxPrimerAccordionType.Single); @@ -69,7 +77,9 @@ describe('AccordionConfig', () => { const injectedConfig = TestBed.inject(NgxPrimerAccordionConfigToken); expect(injectedConfig.type).toBe(NgxPrimerAccordionType.Multiple); expect(injectedConfig.collapsible).toBe(true); - expect(injectedConfig.orientation).toBe(NgxPrimerAccordionOrientation.Vertical); + expect(injectedConfig.orientation).toBe( + NgxPrimerAccordionOrientation.Vertical + ); expect(injectedConfig.theme.builtIn).toBe(true); }); -}); \ No newline at end of file +}); diff --git a/packages/primitives/accordion/src/configs/accordion-config.ts b/packages/primitives/accordion/src/configs/accordion-config.ts index ee1ddd1..2e31271 100644 --- a/packages/primitives/accordion/src/configs/accordion-config.ts +++ b/packages/primitives/accordion/src/configs/accordion-config.ts @@ -20,9 +20,13 @@ export interface NgxPrimerAccordionConfig { builtIn: boolean; }; // Overloaded method signatures - updateConfig(callbackFn: (config: NgxPrimerAccordionConfig) => Partial): void; + updateConfig( + callbackFn: ( + config: NgxPrimerAccordionConfig + ) => Partial + ): void; updateConfig(newConfig: Partial): void; - resetConfig(target: NgxPrimerAccordionConfig): void + resetConfig(target: NgxPrimerAccordionConfig): void; } export const defaultAccordionConfig: () => NgxPrimerAccordionConfig = () => ({ type: 'Multiple', @@ -31,13 +35,20 @@ export const defaultAccordionConfig: () => NgxPrimerAccordionConfig = () => ({ theme: { builtIn: true, }, - updateConfig(callbackFn: Partial | ((config: NgxPrimerAccordionConfig) => Partial)): void { - const updatedConfig = typeof callbackFn === 'function' ? callbackFn(this) : {...callbackFn}; - Object.assign(this, {...updatedConfig}); + updateConfig( + callbackFn: + | Partial + | (( + config: NgxPrimerAccordionConfig + ) => Partial) + ): void { + const updatedConfig = + typeof callbackFn === 'function' ? callbackFn(this) : { ...callbackFn }; + Object.assign(this, { ...updatedConfig }); }, resetConfig(target: NgxPrimerAccordionConfig): void { Object.assign(target, defaultAccordionConfig()); - } + }, }); export function provideAccordionConfig( config: Partial diff --git a/packages/primitives/accordion/src/contexts/accordion-content/accordion-content.context.spec.ts b/packages/primitives/accordion/src/contexts/accordion-content/accordion-content.context.spec.ts index 3b05a59..051bca1 100644 --- a/packages/primitives/accordion/src/contexts/accordion-content/accordion-content.context.spec.ts +++ b/packages/primitives/accordion/src/contexts/accordion-content/accordion-content.context.spec.ts @@ -5,7 +5,7 @@ import { TestBed } from '@angular/core/testing'; @Component({ selector: 'ngx-primer-accordion-content', - template: '

Accordion Content
' + template: '
Accordion Content
', }) class MockAccordionContentComponent {} @@ -16,8 +16,8 @@ describe('NgxPrimerAccordionContentContext', () => { TestBed.configureTestingModule({ providers: [ NgxPrimerAccordionContentContext, - { provide: Component, useClass: MockAccordionContentComponent } - ] + { provide: Component, useClass: MockAccordionContentComponent }, + ], }); context = TestBed.inject(NgxPrimerAccordionContentContext); @@ -30,4 +30,4 @@ describe('NgxPrimerAccordionContentContext', () => { it('should extend Context', () => { expect(context instanceof Context).toBe(true); }); -}); \ No newline at end of file +}); diff --git a/packages/primitives/accordion/src/contexts/accordion-item/accordion-item.context.spec.ts b/packages/primitives/accordion/src/contexts/accordion-item/accordion-item.context.spec.ts index 2f7007e..2267d77 100644 --- a/packages/primitives/accordion/src/contexts/accordion-item/accordion-item.context.spec.ts +++ b/packages/primitives/accordion/src/contexts/accordion-item/accordion-item.context.spec.ts @@ -4,7 +4,7 @@ import { TestBed } from '@angular/core/testing'; @Component({ selector: 'ngx-primer-accordion-item', - template: '
Accordion Item
' + template: '
Accordion Item
', }) class MockAccordionItemComponent {} describe('NgxPrimerAccordionItemContext', () => { @@ -12,7 +12,7 @@ describe('NgxPrimerAccordionItemContext', () => { beforeEach(() => { TestBed.configureTestingModule({ - providers: [NgxPrimerAccordionItemContext] + providers: [NgxPrimerAccordionItemContext], }); context = TestBed.inject(NgxPrimerAccordionItemContext); @@ -23,4 +23,4 @@ describe('NgxPrimerAccordionItemContext', () => { }); // Add more tests here -}); \ No newline at end of file +}); diff --git a/packages/primitives/accordion/src/contexts/accordion-root/accordion-root.context.spec.ts b/packages/primitives/accordion/src/contexts/accordion-root/accordion-root.context.spec.ts index 56e2204..ce137bd 100644 --- a/packages/primitives/accordion/src/contexts/accordion-root/accordion-root.context.spec.ts +++ b/packages/primitives/accordion/src/contexts/accordion-root/accordion-root.context.spec.ts @@ -5,7 +5,7 @@ import { TestBed } from '@angular/core/testing'; @Component({ selector: 'ngx-primer-accordion-root', - template: '
' + template: '
', }) class MockAccordionRootComponent {} @@ -14,7 +14,7 @@ describe('NgxPrimerAccordionRootContext', () => { beforeEach(() => { TestBed.configureTestingModule({ - providers: [NgxPrimerAccordionRootContext] + providers: [NgxPrimerAccordionRootContext], }); service = TestBed.inject(NgxPrimerAccordionRootContext); }); @@ -26,4 +26,4 @@ describe('NgxPrimerAccordionRootContext', () => { it('should extend Context', () => { expect(service instanceof Context).toBe(true); }); -}); \ No newline at end of file +}); diff --git a/packages/primitives/accordion/src/contexts/accordion-trigger/accordion-trigger.context.spec.ts b/packages/primitives/accordion/src/contexts/accordion-trigger/accordion-trigger.context.spec.ts index 46b5bbb..f9a933b 100644 --- a/packages/primitives/accordion/src/contexts/accordion-trigger/accordion-trigger.context.spec.ts +++ b/packages/primitives/accordion/src/contexts/accordion-trigger/accordion-trigger.context.spec.ts @@ -5,7 +5,7 @@ import { TestBed } from '@angular/core/testing'; @Component({ selector: 'ngx-primer-accordion-trigger', - template: '
' + template: '
', }) class MockAccordionTriggerComponent {} @@ -14,7 +14,7 @@ describe('NgxPrimerAccordionTriggerContext', () => { beforeEach(() => { TestBed.configureTestingModule({ - providers: [NgxPrimerAccordionTriggerContext] + providers: [NgxPrimerAccordionTriggerContext], }); context = TestBed.inject(NgxPrimerAccordionTriggerContext); @@ -27,4 +27,4 @@ describe('NgxPrimerAccordionTriggerContext', () => { it('should extend Context', () => { expect(context instanceof Context).toBe(true); }); -}); \ No newline at end of file +}); diff --git a/packages/primitives/accordion/src/directives/animations/collapse-expand-animation/collapse-expand-animation.directive.spec.ts b/packages/primitives/accordion/src/directives/animations/collapse-expand-animation/collapse-expand-animation.directive.spec.ts index c707fdc..934cf2b 100644 --- a/packages/primitives/accordion/src/directives/animations/collapse-expand-animation/collapse-expand-animation.directive.spec.ts +++ b/packages/primitives/accordion/src/directives/animations/collapse-expand-animation/collapse-expand-animation.directive.spec.ts @@ -8,13 +8,8 @@ import { provideAnimations } from '@angular/platform-browser/animations'; @Component({ standalone: true, - imports: [ - CommonModule, - NgxPrimerCollapseExpandAnimationDirective - ], - providers: [ - provideAnimations() - ], + imports: [CommonModule, NgxPrimerCollapseExpandAnimationDirective], + providers: [provideAnimations()], template: `
{ beforeEach(() => { TestBed.configureTestingModule({ - imports: [ - TestComponent, - NgxPrimerCollapseExpandAnimationDirective, - ], - providers: [ - provideAnimations() - ] + imports: [TestComponent, NgxPrimerCollapseExpandAnimationDirective], + providers: [provideAnimations()], }).compileComponents(); }); @@ -49,4 +39,4 @@ describe('NgxPrimerCollapseExpandAnimationDirective', () => { ); expect(directiveEl).toBeTruthy(); }); -}); \ No newline at end of file +}); diff --git a/packages/primitives/accordion/src/themes/accordion-root/accordion-root.css.ts b/packages/primitives/accordion/src/themes/accordion-root/accordion-root.css.ts index 31a4251..5fb3aee 100644 --- a/packages/primitives/accordion/src/themes/accordion-root/accordion-root.css.ts +++ b/packages/primitives/accordion/src/themes/accordion-root/accordion-root.css.ts @@ -1,7 +1,7 @@ -import { cva, type VariantProps } from "class-variance-authority"; +import { cva, type VariantProps } from 'class-variance-authority'; // Define the accordion root theme variant -export const accordionRootThemeVariant = cva("accordion-root-base h-full", { +export const accordionRootThemeVariant = cva('accordion-root-base h-full', { variants: { // Theme mode variants variant: { @@ -18,23 +18,25 @@ export const accordionRootThemeVariant = cva("accordion-root-base h-full", { }, // Size variants size: { - sm: "max-w-[16rem]", - md: "max-w-[24rem]", - lg: "max-w-[32rem]", + sm: 'max-w-[16rem]', + md: 'max-w-[24rem]', + lg: 'max-w-[32rem]', }, // Border Radius (optional customization) borderRadius: { - sm: "rounded-md", - md: "rounded-lg", - lg: "rounded-xl", + sm: 'rounded-md', + md: 'rounded-lg', + lg: 'rounded-xl', }, }, defaultVariants: { - variant: "light", - size: "md", - borderRadius: "md", + variant: 'light', + size: 'md', + borderRadius: 'md', }, }); // Define the type for props based on the variants -export type AccordionRootThemeVariant = VariantProps; +export type AccordionRootThemeVariant = VariantProps< + typeof accordionRootThemeVariant +>; diff --git a/packages/primitives/accordion/src/themes/index.ts b/packages/primitives/accordion/src/themes/index.ts index 2e9b086..9f3a393 100644 --- a/packages/primitives/accordion/src/themes/index.ts +++ b/packages/primitives/accordion/src/themes/index.ts @@ -1 +1 @@ -export * from "./accordion-root/accordion-root.css"; \ No newline at end of file +export * from './accordion-root/accordion-root.css'; diff --git a/packages/primitives/accordion/src/tokens/accordion-component.token.ts b/packages/primitives/accordion/src/tokens/accordion-component.token.ts index 877c6da..e70193c 100644 --- a/packages/primitives/accordion/src/tokens/accordion-component.token.ts +++ b/packages/primitives/accordion/src/tokens/accordion-component.token.ts @@ -9,10 +9,10 @@ import { InjectionToken } from '@angular/core'; /** * Injection token for the root component of the NgxPrimerAccordion. - * + * * This token is used to inject the root component of the accordion, which is * of type `NgxPrimerAccordionRootComponent`. - * + * * @constant * @type {InjectionToken>} */ @@ -22,10 +22,10 @@ export const NgxPrimerAccordionRootComponentToken = new InjectionToken< /** * Injection token for the NgxPrimerAccordionItemComponent. - * + * * This token is used to inject the NgxPrimerAccordionItemComponent * into other components or services. - * + * * @type {InjectionToken>} */ export const NgxPrimerAccordionItemComponentToken = new InjectionToken< diff --git a/packages/primitives/slot/src/components/index.ts b/packages/primitives/slot/src/components/index.ts index 93dc1e8..9df6d79 100644 --- a/packages/primitives/slot/src/components/index.ts +++ b/packages/primitives/slot/src/components/index.ts @@ -1 +1 @@ -export * from './slot/slot.component'; \ No newline at end of file +export * from './slot/slot.component'; diff --git a/packages/primitives/slot/src/components/slot/slot.component.html b/packages/primitives/slot/src/components/slot/slot.component.html index 9e20b5e..808a09e 100644 --- a/packages/primitives/slot/src/components/slot/slot.component.html +++ b/packages/primitives/slot/src/components/slot/slot.component.html @@ -1,11 +1,13 @@ - - \ No newline at end of file + diff --git a/packages/primitives/slot/src/directives/index.ts b/packages/primitives/slot/src/directives/index.ts index 20c7dd4..bccfed9 100644 --- a/packages/primitives/slot/src/directives/index.ts +++ b/packages/primitives/slot/src/directives/index.ts @@ -1 +1 @@ -export * from './slot-context/slot-context.directive'; \ No newline at end of file +export * from './slot-context/slot-context.directive'; diff --git a/packages/primitives/slot/src/index.ts b/packages/primitives/slot/src/index.ts index cd77f48..27ab7d2 100644 --- a/packages/primitives/slot/src/index.ts +++ b/packages/primitives/slot/src/index.ts @@ -1,2 +1,2 @@ export * from './components'; -export * from './directives'; \ No newline at end of file +export * from './directives'; diff --git a/packages/primitives/utilities/src/directives/event-listeners/mouse-event/mouse-event.directive.spec.ts b/packages/primitives/utilities/src/directives/event-listeners/mouse-event/mouse-event.directive.spec.ts index b546db3..14303c2 100644 --- a/packages/primitives/utilities/src/directives/event-listeners/mouse-event/mouse-event.directive.spec.ts +++ b/packages/primitives/utilities/src/directives/event-listeners/mouse-event/mouse-event.directive.spec.ts @@ -9,8 +9,8 @@ describe('MouseEventDirective', () => { TestBed.configureTestingModule({ providers: [ NgxPrimerMouseEventDirective, - { provide: ElementRef, useValue: new ElementRef(null) } - ] + { provide: ElementRef, useValue: new ElementRef(null) }, + ], }); directive = TestBed.inject(NgxPrimerMouseEventDirective); @@ -19,4 +19,4 @@ describe('MouseEventDirective', () => { it('should create an instance', () => { expect(directive).toBeTruthy(); }); -}); \ No newline at end of file +}); From ff8394118d46dc6b92bb06540480da22b9c7214f Mon Sep 17 00:00:00 2001 From: ATS - Elhakim Cool Date: Sun, 22 Dec 2024 02:24:08 +0700 Subject: [PATCH 2/2] fix: fixing all --- .github/workflows/nx-ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/nx-ci.yml b/.github/workflows/nx-ci.yml index b4128d5..94a6cc4 100644 --- a/.github/workflows/nx-ci.yml +++ b/.github/workflows/nx-ci.yml @@ -43,3 +43,20 @@ jobs: # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected # When you enable task distribution, run the e2e-ci task instead of e2e - run: pnpm exec nx affected -t lint test build e2e + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Publish to npm + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + pnpm publish --access public