diff --git a/angular/headless/src/public-api.ts b/angular/headless/src/public-api.ts index 0a9c5312b6..f0b8a2aeea 100644 --- a/angular/headless/src/public-api.ts +++ b/angular/headless/src/public-api.ts @@ -43,3 +43,8 @@ export type RatingState = WidgetState; export type SelectWidget = AdaptWidgetSlots>; export type SelectProps = WidgetProps>; export type SelectState = WidgetState>; + +export type ProgressbarWidget = AdaptWidgetSlots; +export type ProgressbarProps = WidgetProps; +export type ProgressbarState = WidgetState; +export type ProgressbarContext = AdaptSlotContentProps; diff --git a/angular/lib/src/lib/progressbar/progressbar.component.ts b/angular/lib/src/lib/progressbar/progressbar.component.ts index 499484aa75..91cfe01566 100644 --- a/angular/lib/src/lib/progressbar/progressbar.component.ts +++ b/angular/lib/src/lib/progressbar/progressbar.component.ts @@ -1,25 +1,23 @@ -import type {AdaptSlotContentProps, AdaptWidgetSlots, SlotContent} from '../slot.directive'; -import {ComponentTemplate, SlotDirective, callWidgetFactory} from '../slot.directive'; +import type {ProgressbarContext, ProgressbarProps, ProgressbarState, SlotContent} from '@agnos-ui/angular-headless'; +import { + ComponentTemplate, + SlotDirective, + callWidgetFactory, + createProgressbar, + patchSimpleChanges, + toSlotContextWidget, + SlotDefaultDirective, +} from '@agnos-ui/angular-headless'; import type {AfterContentChecked, OnChanges, Signal, SimpleChanges} from '@angular/core'; import {NgClass, NgIf} from '@angular/common'; import {ChangeDetectionStrategy, Component, ContentChild, Directive, Input, TemplateRef, ViewChild, inject} from '@angular/core'; -import type {ProgressbarContext as ProgressbarCoreContext, WidgetProps, WidgetState} from '@agnos-ui/core'; -import {createProgressbar, toSlotContextWidget} from '@agnos-ui/core'; import {writable} from '@amadeus-it-group/tansu'; import {toSignal} from '@angular/core/rxjs-interop'; -import {patchSimpleChanges} from '../utils'; -import {SlotDefaultDirective} from '../slotDefault.directive'; - -export type ProgressbarWidget = AdaptWidgetSlots>; -export type ProgressbarState = WidgetState; -export type ProgressbarProps = WidgetProps; - -export type ProgressbarContext = AdaptSlotContentProps; @Directive({selector: 'ng-template[auProgressbarContent]', standalone: true}) export class ProgressbarContentDirective { public templateRef = inject(TemplateRef); - static ngTemplateContextGuard(_dir: ProgressbarContentDirective, context: unknown): context is ProgressbarCoreContext { + static ngTemplateContextGuard(_dir: ProgressbarContentDirective, context: unknown): context is ProgressbarContext { return true; } } @@ -46,7 +44,7 @@ export class ProgressbarContentDirective { `, }) export class ProgressbarDefaultSlotsComponent { - @ViewChild('content', {static: true}) content: TemplateRef; + @ViewChild('content', {static: true}) content: TemplateRef; } export const progressbarDefaultSlotContent = new ComponentTemplate(ProgressbarDefaultSlotsComponent, 'content'); @@ -102,8 +100,8 @@ export class ProgressbarComponent implements AfterContentChecked, OnChanges { */ @Input() className: string | undefined; - @Input() slotDefault: SlotContent>; - @Input() slotContent: SlotContent>; + @Input() slotDefault: SlotContent; + @Input() slotContent: SlotContent; @ContentChild(ProgressbarContentDirective, {static: false}) slotContentFromContent: ProgressbarContentDirective | undefined; /** diff --git a/angular/lib/src/public-api.ts b/angular/lib/src/public-api.ts index eda337c514..9ef369afff 100644 --- a/angular/lib/src/public-api.ts +++ b/angular/lib/src/public-api.ts @@ -12,4 +12,4 @@ export * from './lib/modal/modal.service'; export * from './lib/pagination/pagination.component'; export * from './lib/rating/rating.component'; export * from './lib/select/select.component'; -export * from './lib/progressbar/progressbar.component'; \ No newline at end of file +export * from './lib/progressbar/progressbar.component'; diff --git a/react/headless/index.ts b/react/headless/index.ts index ac545409fa..33586f4eec 100644 --- a/react/headless/index.ts +++ b/react/headless/index.ts @@ -40,3 +40,8 @@ export type RatingState = WidgetState; export type SelectWidget = AdaptWidgetSlots>; export type SelectProps = WidgetProps>; export type SelectState = WidgetState>; + +export type ProgressbarWidget = AdaptWidgetSlots; +export type ProgressbarProps = WidgetProps; +export type ProgressbarState = WidgetState; +export type ProgressbarContext = AdaptSlotContentProps; diff --git a/react/lib/Progressbar.tsx b/react/lib/Progressbar.tsx index 35e57b9a38..53dcb02ff9 100644 --- a/react/lib/Progressbar.tsx +++ b/react/lib/Progressbar.tsx @@ -1,14 +1,6 @@ -import type {ProgressbarContext as ProgressbarCoreContext, WidgetProps, WidgetState} from '@agnos-ui/core'; -import {createProgressbar, toSlotContextWidget} from '@agnos-ui/core'; import {type PropsWithChildren} from 'react'; -import type {AdaptSlotContentProps, AdaptWidgetSlots} from './Slot'; -import {Slot} from './Slot'; -import {useWidgetWithConfig} from './utils'; - -export type ProgressbarContext = AdaptSlotContentProps; -export type ProgressbarWidget = AdaptWidgetSlots>; -export type ProgressbarProps = WidgetProps; -export type ProgressbarState = WidgetState; +import type {ProgressbarContext, ProgressbarProps} from '@agnos-ui/react-headless'; +import {Slot, createProgressbar, toSlotContextWidget, useWidgetWithConfig} from '@agnos-ui/react-headless'; function DefaultSlotContent(slotContext: ProgressbarContext) { const classList = ['progress-bar']; diff --git a/react/lib/index.ts b/react/lib/index.ts index e6ac0b69a9..2682970f88 100644 --- a/react/lib/index.ts +++ b/react/lib/index.ts @@ -8,4 +8,4 @@ export * from './modal/Modal'; export * from './modal/modalService'; export * from './pagination/PageItem'; export * from './pagination/Pagination'; -export * from './Progressbar'; \ No newline at end of file +export * from './Progressbar'; diff --git a/svelte/headless/index.ts b/svelte/headless/index.ts index 29fa40a2f8..22bcf0121a 100644 --- a/svelte/headless/index.ts +++ b/svelte/headless/index.ts @@ -45,3 +45,8 @@ export type SelectWidget = AdaptWidgetSlots = WidgetProps>; export type SelectState = WidgetState>; export type SelectSlots = WidgetPropsSlots>; + +export type ProgressbarWidget = AdaptWidgetSlots; +export type ProgressbarProps = WidgetProps; +export type ProgressbarState = WidgetState; +export type ProgressbarSlots = WidgetPropsSlots; diff --git a/svelte/lib/index.ts b/svelte/lib/index.ts index 127c9e830d..5d3a8957ee 100644 --- a/svelte/lib/index.ts +++ b/svelte/lib/index.ts @@ -14,6 +14,17 @@ import Progressbar from './progressbar/Progressbar.svelte'; export * from './modal/modalService'; export * from './accordion/accordion'; -export * from './progressbar/progressbar'; -export {Select, Rating, Pagination, PaginationDefaultPages, Modal, ModalDefaultHeader, ModalDefaultStructure, Alert, Accordion, AccordionItem}; +export { + Select, + Rating, + Pagination, + PaginationDefaultPages, + Modal, + ModalDefaultHeader, + ModalDefaultStructure, + Alert, + Accordion, + AccordionItem, + Progressbar, +}; diff --git a/svelte/lib/progressbar/Progressbar.svelte b/svelte/lib/progressbar/Progressbar.svelte index 4e673ec93e..9e8dfa44e0 100644 --- a/svelte/lib/progressbar/Progressbar.svelte +++ b/svelte/lib/progressbar/Progressbar.svelte @@ -1,12 +1,7 @@