@agnos-ui/svelte-bootstrap 0.8.0-next.0 → 0.8.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.
@@ -13,6 +13,7 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
13
13
  const accordionApi = getAccordionApi();
14
14
  const {registerItem} = accordionApi;
15
15
 
16
+ const id = $props.id();
16
17
  let {visible = $bindable(), ...props}: Partial<AccordionItemProps> = $props();
17
18
  const widget = callWidgetFactory({
18
19
  factory: registerItem as WidgetFactory<AccordionItemWidget>,
@@ -20,7 +21,7 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
20
21
  return {...props, visible};
21
22
  },
22
23
  enablePatchChanged: true,
23
- defaultConfig: {structure},
24
+ defaultConfig: {structure, id},
24
25
  events: {
25
26
  onVisibleChange: (event) => {
26
27
  visible = event;
@@ -0,0 +1,36 @@
1
+ <script lang="ts" generics="SlideData extends {id: string;}">
2
+ import {ssrAttributes as __AgnosUISveltePreprocess__ssrAttributes} from '@agnos-ui/svelte-headless/utils/directive';
3
+ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
4
+
5
+ import type {CarouselProps, CarouselApi, CarouselContext} from './carousel.gen';
6
+ import {createCarousel} from './carousel.gen';
7
+ import {callWidgetFactory} from '../../config';
8
+ import {Slot} from '@agnos-ui/svelte-headless/slot';
9
+ import CarouselDefaultNavigation from './CarouselDefaultNavigation.svelte';
10
+ import CarouselDefaultStructure from './CarouselDefaultStructure.svelte';
11
+
12
+ let props: Partial<CarouselProps<SlideData>> = $props();
13
+
14
+ const widget = callWidgetFactory({
15
+ factory: createCarousel<SlideData>,
16
+ widgetName: 'collapse',
17
+ props,
18
+ enablePatchChanged: true,
19
+ defaultConfig: {
20
+ structure,
21
+ navigation,
22
+ },
23
+ });
24
+ export const api: CarouselApi = widget.api;
25
+ </script>
26
+
27
+ {#snippet structure(props: CarouselContext<SlideData>)}
28
+ <CarouselDefaultStructure {...props} />
29
+ {/snippet}
30
+ {#snippet navigation(props: CarouselContext<SlideData>)}
31
+ <CarouselDefaultNavigation {...props} />
32
+ {/snippet}
33
+
34
+ <div use:widget.directives.root {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(widget.directives.root)}>
35
+ <Slot content={widget.state.structure} props={widget} />
36
+ </div>
@@ -0,0 +1,28 @@
1
+ import type { CarouselProps, CarouselApi } from './carousel.gen';
2
+ declare class __sveltets_Render<SlideData extends {
3
+ id: string;
4
+ }> {
5
+ props(): Partial<CarouselProps<SlideData>>;
6
+ events(): {};
7
+ slots(): {};
8
+ bindings(): "";
9
+ exports(): {
10
+ api: CarouselApi;
11
+ };
12
+ }
13
+ interface $$IsomorphicComponent {
14
+ new <SlideData extends {
15
+ id: string;
16
+ }>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<SlideData>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<SlideData>['props']>, ReturnType<__sveltets_Render<SlideData>['events']>, ReturnType<__sveltets_Render<SlideData>['slots']>> & {
17
+ $$bindings?: ReturnType<__sveltets_Render<SlideData>['bindings']>;
18
+ } & ReturnType<__sveltets_Render<SlideData>['exports']>;
19
+ <SlideData extends {
20
+ id: string;
21
+ }>(internal: unknown, props: ReturnType<__sveltets_Render<SlideData>['props']> & {}): ReturnType<__sveltets_Render<SlideData>['exports']>;
22
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
23
+ }
24
+ declare const Carousel: $$IsomorphicComponent;
25
+ type Carousel<SlideData extends {
26
+ id: string;
27
+ }> = InstanceType<typeof Carousel<SlideData>>;
28
+ export default Carousel;
@@ -0,0 +1,33 @@
1
+ <script lang="ts" generics="SlideData extends {id: string;}">
2
+ import {ssrAttributes as __AgnosUISveltePreprocess__ssrAttributes, classDirective as __AgnosUISveltePreprocess__classDirective} from '@agnos-ui/svelte-headless/utils/directive';
3
+ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
4
+
5
+ import type {CarouselContext} from './carousel.gen';
6
+
7
+ let {state, directives}: CarouselContext<SlideData> = $props();
8
+ </script>
9
+
10
+ {#if state.showNavigationArrows}
11
+ {#if state.canScrollPrev}
12
+ {@const prevBtnClassPrefix = state.direction === 'rtl' ? 'carousel-control-next' : 'carousel-control-prev'}
13
+ <!-- svelte-ignore a11y_consider_explicit_label -->
14
+ <button use:__AgnosUISveltePreprocess__classDirective={(prevBtnClassPrefix)} use:directives.scrollPrev {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(directives.scrollPrev, [__AgnosUISveltePreprocess__classDirective, (prevBtnClassPrefix)])}>
15
+ <span class="{prevBtnClassPrefix}-icon"></span>
16
+ </button>
17
+ {/if}
18
+ {#if state.canScrollNext}
19
+ {@const nextBtnClassPrefix = state.direction === 'ltr' ? 'carousel-control-next' : 'carousel-control-prev'}
20
+ <!-- svelte-ignore a11y_consider_explicit_label -->
21
+ <button use:__AgnosUISveltePreprocess__classDirective={(nextBtnClassPrefix)} use:directives.scrollNext {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(directives.scrollNext, [__AgnosUISveltePreprocess__classDirective, (nextBtnClassPrefix)])}>
22
+ <span class="{nextBtnClassPrefix}-icon"></span>
23
+ </button>
24
+ {/if}
25
+ {/if}
26
+ {#if state.showNavigationIndicators}
27
+ <div use:__AgnosUISveltePreprocess__classDirective={"carousel-indicators"} use:directives.tabList {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(directives.tabList, [__AgnosUISveltePreprocess__classDirective, "carousel-indicators"])}>
28
+ {#each state.slidesData as { id }, index (id)}
29
+ <!-- svelte-ignore a11y_consider_explicit_label -->
30
+ <button data-bs-target use:__AgnosUISveltePreprocess__classDirective={([state.selectedScrollSnap === index && 'active'])} use:directives.tabIndicator={{index, id}} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes([directives.tabIndicator, {index, id}], [__AgnosUISveltePreprocess__classDirective, ([state.selectedScrollSnap === index && 'active'])])}></button>
31
+ {/each}
32
+ </div>
33
+ {/if}
@@ -0,0 +1,25 @@
1
+ declare class __sveltets_Render<SlideData extends {
2
+ id: string;
3
+ }> {
4
+ props(): WidgetSlotContext<Widget<import("./carousel.gen").CarouselProps<SlideData_1>, import("./carousel.gen").CarouselState<SlideData_1>, import("./carousel.gen").CarouselApi, import("./carousel.gen").CarouselDirectives>>;
5
+ events(): {};
6
+ slots(): {};
7
+ bindings(): "";
8
+ exports(): {};
9
+ }
10
+ interface $$IsomorphicComponent {
11
+ new <SlideData extends {
12
+ id: string;
13
+ }>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<SlideData>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<SlideData>['props']>, ReturnType<__sveltets_Render<SlideData>['events']>, ReturnType<__sveltets_Render<SlideData>['slots']>> & {
14
+ $$bindings?: ReturnType<__sveltets_Render<SlideData>['bindings']>;
15
+ } & ReturnType<__sveltets_Render<SlideData>['exports']>;
16
+ <SlideData extends {
17
+ id: string;
18
+ }>(internal: unknown, props: ReturnType<__sveltets_Render<SlideData>['props']> & {}): ReturnType<__sveltets_Render<SlideData>['exports']>;
19
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
20
+ }
21
+ declare const CarouselDefaultNavigation: $$IsomorphicComponent;
22
+ type CarouselDefaultNavigation<SlideData extends {
23
+ id: string;
24
+ }> = InstanceType<typeof CarouselDefaultNavigation<SlideData>>;
25
+ export default CarouselDefaultNavigation;
@@ -0,0 +1,19 @@
1
+ <script lang="ts" generics="SlideData extends {id: string;}">
2
+ import {ssrAttributes as __AgnosUISveltePreprocess__ssrAttributes} from '@agnos-ui/svelte-headless/utils/directive';
3
+ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
4
+
5
+ import type {CarouselContext} from './carousel.gen';
6
+ import {Slot} from '@agnos-ui/svelte-headless/slot';
7
+
8
+ let widget: CarouselContext<SlideData> = $props();
9
+ let {state, directives} = widget;
10
+ </script>
11
+
12
+ <Slot content={state.navigation} props={widget} />
13
+ <div use:directives.container {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(directives.container)}>
14
+ {#each state.slidesData as slideData, index (slideData.id)}
15
+ <div use:directives.slide={{index, id: slideData.id}} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes([directives.slide, {index, id: slideData.id}])}>
16
+ <Slot content={state.slide} props={{...slideData, ...widget}} />
17
+ </div>
18
+ {/each}
19
+ </div>
@@ -0,0 +1,25 @@
1
+ declare class __sveltets_Render<SlideData extends {
2
+ id: string;
3
+ }> {
4
+ props(): WidgetSlotContext<Widget<import("./carousel.gen").CarouselProps<SlideData_1>, import("./carousel.gen").CarouselState<SlideData_1>, import("./carousel.gen").CarouselApi, import("./carousel.gen").CarouselDirectives>>;
5
+ events(): {};
6
+ slots(): {};
7
+ bindings(): "";
8
+ exports(): {};
9
+ }
10
+ interface $$IsomorphicComponent {
11
+ new <SlideData extends {
12
+ id: string;
13
+ }>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<SlideData>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<SlideData>['props']>, ReturnType<__sveltets_Render<SlideData>['events']>, ReturnType<__sveltets_Render<SlideData>['slots']>> & {
14
+ $$bindings?: ReturnType<__sveltets_Render<SlideData>['bindings']>;
15
+ } & ReturnType<__sveltets_Render<SlideData>['exports']>;
16
+ <SlideData extends {
17
+ id: string;
18
+ }>(internal: unknown, props: ReturnType<__sveltets_Render<SlideData>['props']> & {}): ReturnType<__sveltets_Render<SlideData>['exports']>;
19
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
20
+ }
21
+ declare const CarouselDefaultStructure: $$IsomorphicComponent;
22
+ type CarouselDefaultStructure<SlideData extends {
23
+ id: string;
24
+ }> = InstanceType<typeof CarouselDefaultStructure<SlideData>>;
25
+ export default CarouselDefaultStructure;
@@ -0,0 +1,358 @@
1
+ import type { PropsConfig, WidgetSlotContext, SlotContent, Directive, Widget } from '@agnos-ui/svelte-headless/types';
2
+ import type { EmblaPluginType, EmblaPluginsType, EmblaCarouselType } from 'embla-carousel';
3
+ /**
4
+ * Retrieve a shallow copy of the default Carousel config
5
+ * @returns the default Carousel config
6
+ */
7
+ declare const export_getCarouselDefaultConfig: () => CarouselProps<any>;
8
+ export { export_getCarouselDefaultConfig as getCarouselDefaultConfig };
9
+ /**
10
+ * Create a Carousel with given config props
11
+ *
12
+ * @template SlideData - The type of the data for each slide.
13
+ * @param config - an optional carousel config
14
+ * @returns a CarouselWidget
15
+ */
16
+ declare const export_createCarousel: <SlideData extends {
17
+ id: string;
18
+ }>(config?: PropsConfig<CarouselProps<SlideData>>) => CarouselWidget<SlideData>;
19
+ export { export_createCarousel as createCarousel };
20
+ /**
21
+ * Represents the context for a carousel.
22
+ *
23
+ * @template SlideData - The type of data used by each slide in the carousel.
24
+ */
25
+ export type CarouselContext<SlideData extends {
26
+ id: string;
27
+ }> = WidgetSlotContext<CarouselWidget<SlideData>>;
28
+ /**
29
+ * Represents the context for a carousel slide.
30
+ *
31
+ * @template SlideData - The type of data used by each slide in the carousel.
32
+ */
33
+ export type CarouselSlideContext<SlideData extends {
34
+ id: string;
35
+ }> = WidgetSlotContext<CarouselWidget<SlideData>> & SlideData;
36
+ /**
37
+ * Represents the state of a carousel component.
38
+ *
39
+ * @template SlideData - The type of data used by each slide in the carousel.
40
+ */
41
+ export interface CarouselState<SlideData extends {
42
+ id: string;
43
+ }> {
44
+ /**
45
+ * is the carousel currently scrolling
46
+ */
47
+ scrolling: boolean;
48
+ /**
49
+ * can carousel scroll to previous slide
50
+ */
51
+ canScrollPrev: boolean;
52
+ /**
53
+ * can carousel scroll to next slide
54
+ */
55
+ canScrollNext: boolean;
56
+ /**
57
+ * selected scroll snap
58
+ */
59
+ selectedScrollSnap: number;
60
+ /**
61
+ * is the carousel initialized
62
+ */
63
+ initialized: boolean;
64
+ /**
65
+ * If `true`, 'previous' and 'next' navigation arrows will be visible.
66
+ */
67
+ showNavigationArrows: boolean;
68
+ /**
69
+ * If `true`, navigation indicators at the bottom of the slide will be visible.
70
+ */
71
+ showNavigationIndicators: boolean;
72
+ /**
73
+ * Choose content direction between `ltr` and `rtl`
74
+ *
75
+ * @see {@link https://www.embla-carousel.com/api/options/#direction}
76
+ * @defaultValue `'ltr'`
77
+ */
78
+ direction: 'ltr' | 'rtl';
79
+ /**
80
+ * CSS classes to be applied on the widget main container
81
+ *
82
+ * @defaultValue `''`
83
+ */
84
+ className: string;
85
+ /**
86
+ * Class name to apply to the container of the carousel.
87
+ *
88
+ * @defaultValue `''`
89
+ */
90
+ containerClass: string;
91
+ /**
92
+ * Class name to apply to each slide in the carousel.
93
+ *
94
+ * @defaultValue `''`
95
+ */
96
+ slideClass: string | ((slideContext: {
97
+ id: string;
98
+ index: number;
99
+ active: boolean;
100
+ }) => string);
101
+ /**
102
+ * The data for each slide in the carousel.
103
+ *
104
+ * @defaultValue `[]`
105
+ */
106
+ slidesData: SlideData[];
107
+ /**
108
+ * The structure of the carousel.
109
+ *
110
+ * @defaultValue `undefined`
111
+ */
112
+ structure: SlotContent<CarouselContext<SlideData>>;
113
+ /**
114
+ * The navigation layer of the carousel.
115
+ *
116
+ * @defaultValue `undefined`
117
+ */
118
+ navigation: SlotContent<CarouselContext<SlideData>>;
119
+ /**
120
+ * The content of each slide in the carousel.
121
+ *
122
+ * @defaultValue `undefined`
123
+ */
124
+ slide: SlotContent<CarouselSlideContext<SlideData>>;
125
+ /**
126
+ * The aria-live attribute value for the carousel container.
127
+ *
128
+ * @defaultValue `'polite'`
129
+ */
130
+ ariaLive: string;
131
+ }
132
+ /**
133
+ * Interface representing the properties for a carousel component.
134
+ *
135
+ * @template SlideData - The type of data used by each slide in the carousel.
136
+ */
137
+ export interface CarouselProps<SlideData extends {
138
+ id: string;
139
+ }> {
140
+ /**
141
+ * Plugins to extend the carousel with additional features
142
+ * @defaultValue `[]`
143
+ */
144
+ plugins: EmblaPluginType[];
145
+ /**
146
+ * Aria label for navigation indicators
147
+ */
148
+ ariaIndicatorLabel: (index: number) => string;
149
+ /**
150
+ * Aria label for previous button
151
+ */
152
+ ariaPrevLabel: string;
153
+ /**
154
+ * Aria label for next button
155
+ */
156
+ ariaNextLabel: string;
157
+ /**
158
+ * Align the slides relative to the carousel viewport
159
+ *
160
+ * @see {@link https://www.embla-carousel.com/api/options/#align}
161
+ * @defaultValue `'center'`
162
+ */
163
+ align: 'start' | 'center' | 'end';
164
+ /**
165
+ * Enables choosing a custom container element which holds the slides. By default, Embla will choose the first direct child element of the root element. Provide a valid CSS selector string.
166
+ *
167
+ * @see {@link https://www.embla-carousel.com/api/options/#container}
168
+ */
169
+ container: string | null;
170
+ /**
171
+ * Clear leading and trailing empty space that causes excessive scrolling
172
+ *
173
+ * @see {@link https://www.embla-carousel.com/api/options/#containScroll}
174
+ * @defaultValue `'trimSnaps'`
175
+ */
176
+ containScroll: false | 'trimSnaps' | 'keepSnaps';
177
+ /**
178
+ * Choose content direction between `ltr` and `rtl`
179
+ *
180
+ * @see {@link https://www.embla-carousel.com/api/options/#direction}
181
+ * @defaultValue `'ltr'`
182
+ */
183
+ direction: 'ltr' | 'rtl';
184
+ /**
185
+ * Enables momentum scrolling
186
+ *
187
+ * @see {@link https://www.embla-carousel.com/api/options/#dragFree}
188
+ * @defaultValue `false`
189
+ */
190
+ dragFree: boolean;
191
+ /**
192
+ * Drag threshold in pixels
193
+ *
194
+ * @see {@link https://www.embla-carousel.com/api/options/#dragThreshold}
195
+ * @defaultValue `10`
196
+ */
197
+ dragThreshold: number;
198
+ /**
199
+ * Set scroll duration when triggered by any of the API methods
200
+ *
201
+ * @see {@link https://www.embla-carousel.com/api/options/#duration}
202
+ * @defaultValue `25`
203
+ */
204
+ duration: number;
205
+ /**
206
+ * Enables infinite looping
207
+ *
208
+ * @see {@link https://www.embla-carousel.com/api/options/#loop}
209
+ * @defaultValue `false`
210
+ */
211
+ loop: boolean;
212
+ /**
213
+ * Allow the carousel to skip scroll snaps if it's dragged vigorously
214
+ *
215
+ * @see {@link https://www.embla-carousel.com/api/options/#skipsnaps}
216
+ * @defaultValue `false`
217
+ */
218
+ skipSnaps: boolean;
219
+ /**
220
+ * If `true`, 'previous' and 'next' navigation arrows will be visible.
221
+ */
222
+ showNavigationArrows: boolean;
223
+ /**
224
+ * If `true`, navigation indicators at the bottom of the slide will be visible.
225
+ */
226
+ showNavigationIndicators: boolean;
227
+ /**
228
+ * CSS classes to be applied on the widget main container
229
+ *
230
+ * @defaultValue `''`
231
+ */
232
+ className: string;
233
+ /**
234
+ * Class name to apply to the container of the carousel.
235
+ *
236
+ * @defaultValue `''`
237
+ */
238
+ containerClass: string;
239
+ /**
240
+ * Class name to apply to each slide in the carousel.
241
+ *
242
+ * @defaultValue `''`
243
+ */
244
+ slideClass: string | ((slideContext: {
245
+ id: string;
246
+ index: number;
247
+ active: boolean;
248
+ }) => string);
249
+ /**
250
+ * The data for each slide in the carousel.
251
+ *
252
+ * @defaultValue `[]`
253
+ */
254
+ slidesData: SlideData[];
255
+ /**
256
+ * The structure of the carousel.
257
+ *
258
+ * @defaultValue `undefined`
259
+ */
260
+ structure: SlotContent<CarouselContext<SlideData>>;
261
+ /**
262
+ * The navigation layer of the carousel.
263
+ *
264
+ * @defaultValue `undefined`
265
+ */
266
+ navigation: SlotContent<CarouselContext<SlideData>>;
267
+ /**
268
+ * The content of each slide in the carousel.
269
+ *
270
+ * @defaultValue `undefined`
271
+ */
272
+ slide: SlotContent<CarouselSlideContext<SlideData>>;
273
+ /**
274
+ * The aria-live attribute value for the carousel container.
275
+ *
276
+ * @defaultValue `'polite'`
277
+ */
278
+ ariaLive: string;
279
+ }
280
+ /**
281
+ * Represents the directives for a carousel component.
282
+ */
283
+ export interface CarouselDirectives {
284
+ /**
285
+ * A directive to be applied to each slide in the carousel.
286
+ */
287
+ slide: Directive<{
288
+ id: string;
289
+ index: number;
290
+ }>;
291
+ /**
292
+ * A directive to be applied to container of the carousel.
293
+ */
294
+ container: Directive;
295
+ /**
296
+ * the root directive
297
+ */
298
+ root: Directive;
299
+ /**
300
+ * A directive to be applied to a navigation button allowing to scroll to the previous slide.
301
+ */
302
+ scrollPrev: Directive;
303
+ /**
304
+ * A directive to be applied to a navigation button allowing to scroll to the next slide.
305
+ */
306
+ scrollNext: Directive;
307
+ /**
308
+ * A directive to be applied to a tab list allowing to navigate to the corresponding slide.
309
+ * This directive adds the role `tablist` and is recommended to be used together with {@link tabIndicator}.
310
+ */
311
+ tabList: Directive;
312
+ /**
313
+ * A directive to be applied to a navigation indicator allowing to scroll to the corresponding slide.
314
+ * As this directive adds the role `tab` to the element, it is recommended to use it on a button or a link and the parent element should have the {@link tabList} directive attached.
315
+ */
316
+ tabIndicator: Directive<{
317
+ index: number;
318
+ id: string;
319
+ jump?: boolean;
320
+ }>;
321
+ }
322
+ /**
323
+ * Represents a carousel widget with specific properties, state, API, and directives.
324
+ *
325
+ * @template SlideData - The type of the data for each slide.
326
+ */
327
+ export type CarouselWidget<SlideData extends {
328
+ id: string;
329
+ }> = Widget<CarouselProps<SlideData>, CarouselState<SlideData>, CarouselApi, CarouselDirectives>;
330
+ /**
331
+ * Represents the API for a carousel component.
332
+ */
333
+ export interface CarouselApi {
334
+ /**
335
+ * Scroll to the previous snap point if possible.
336
+ * @param jump - scroll instantly
337
+ */
338
+ scrollPrev: (jump?: boolean) => void;
339
+ /**
340
+ * Scroll to the next snap point if possible.
341
+ * @param jump - scroll instantly
342
+ */
343
+ scrollNext: (jump?: boolean) => void;
344
+ /**
345
+ * Scroll to a snap point by index
346
+ * @param index - the snap point index
347
+ * @param jump - scroll instantly
348
+ */
349
+ scrollTo: (index: number, jump?: boolean) => void;
350
+ /**
351
+ * Retrieve the enabled plugins
352
+ */
353
+ plugins: () => EmblaPluginsType | undefined;
354
+ /**
355
+ * Retrieve the inner EmblaApi object
356
+ */
357
+ emblaApi: () => EmblaCarouselType | undefined;
358
+ }
@@ -0,0 +1,16 @@
1
+ import { getCarouselDefaultConfig, createCarousel } from '@agnos-ui/core-bootstrap/components/carousel';
2
+ /**
3
+ * Retrieve a shallow copy of the default Carousel config
4
+ * @returns the default Carousel config
5
+ */
6
+ const export_getCarouselDefaultConfig = getCarouselDefaultConfig;
7
+ export { export_getCarouselDefaultConfig as getCarouselDefaultConfig };
8
+ /**
9
+ * Create a Carousel with given config props
10
+ *
11
+ * @template SlideData - The type of the data for each slide.
12
+ * @param config - an optional carousel config
13
+ * @returns a CarouselWidget
14
+ */
15
+ const export_createCarousel = createCarousel;
16
+ export { export_createCarousel as createCarousel };
@@ -0,0 +1,3 @@
1
+ export * from './carousel.gen';
2
+ import Carousel from './Carousel.svelte';
3
+ export { Carousel };
@@ -0,0 +1,3 @@
1
+ export * from './carousel.gen';
2
+ import Carousel from './Carousel.svelte';
3
+ export { Carousel };
@@ -7,6 +7,7 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
7
7
  import {callWidgetFactory} from '../../config';
8
8
  import type {Snippet} from 'svelte';
9
9
 
10
+ const id = $props.id();
10
11
  let {children, visible = $bindable(), ...props}: Partial<CollapseProps> & {children: Snippet} = $props();
11
12
 
12
13
  const {
@@ -18,6 +19,9 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
18
19
  get props() {
19
20
  return {...props, visible};
20
21
  },
22
+ defaultConfig: {
23
+ id,
24
+ },
21
25
  events: {
22
26
  onVisibleChange: (event) => {
23
27
  visible = event;
@@ -44,4 +44,4 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
44
44
  </script>
45
45
 
46
46
  <!-- svelte-ignore a11y_consider_explicit_label -->
47
- <button {onkeydown} use:directives.handleDirective={{item}} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes([directives.handleDirective, {item}])}> &nbsp; </button>
47
+ <button {onkeydown} use:directives.handleDirective={{item}} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes([directives.handleDirective, {item}])}></button>
@@ -13,29 +13,10 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
13
13
  </span>
14
14
  {/if}
15
15
  <span use:directives.tickDirective={{tick}} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes([directives.tickDirective, {tick}])}>
16
- {#if tick.selected}
17
- <svg
18
- xmlns="http://www.w3.org/2000/svg"
19
- style="width: var(--bs-slider-tick-secondary-size); height: var(--bs-slider-tick-primary-size)"
20
- fill="none"
21
- >
22
- <circle cx="50%" cy="50%" r="50%" fill={state.disabled ? 'var(--bs-slider-tick-disabled-color)' : 'var(--bs-slider-tick-selected-color)'} />
23
- <circle cx="50%" cy="50%" r="25%" fill="white" />
24
- </svg>
25
- {:else}
26
- <svg
27
- xmlns="http://www.w3.org/2000/svg"
28
- style="width: var(--bs-slider-tick-secondary-size); height: var(--bs-slider-tick-primary-size)"
29
- fill="none"
30
- >
31
- <circle
32
- cx="50%"
33
- cy="50%"
34
- r="45%"
35
- fill="white"
36
- stroke={state.disabled ? 'var(--bs-slider-tick-disabled-color)' : 'var(--bs-slider-tick-neutral-color)'}
37
- stroke-width="1.5"
38
- />
39
- </svg>
40
- {/if}
16
+ <svg xmlns="http://www.w3.org/2000/svg">
17
+ <circle class="au-slider-tick-outer" class:au-slider-tick-disabled={state.disabled} class:au-slider-tick-selected={tick.selected} />
18
+ {#if tick.selected}
19
+ <circle class="au-slider-tick-inner au-slider-tick-selected" />
20
+ {/if}
21
+ </svg>
41
22
  </span>
@@ -0,0 +1,53 @@
1
+ <script lang="ts" module>
2
+ import {ssrAttributes as __AgnosUISveltePreprocess__ssrAttributes} from '@agnos-ui/svelte-headless/utils/directive';
3
+ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
4
+
5
+ const toaster = new ToasterService();
6
+ const {addToast, removeToast, closeAll, eventsDirective} = toaster;
7
+ export {addToast, removeToast, closeAll};
8
+ </script>
9
+
10
+ <script lang="ts">
11
+ import Toast from './Toast.svelte';
12
+ import {toastPositions, type ToasterProps} from './toast.gen';
13
+ import {ToasterService} from './toasterService';
14
+ let {duration, position, limit, pauseOnHover, dismissible, closeAll, closeAllLabel}: ToasterProps = $props();
15
+ $effect(() => {
16
+ toaster.options.current = {duration, position, limit, pauseOnHover, dismissible, closeAll, closeAllLabel};
17
+ });
18
+ </script>
19
+
20
+ <div class="au-toaster" aria-live="polite" aria-atomic="true">
21
+ <div class={`au-toaster-container toast-container ${toastPositions[toaster.options.current.position]}`}>
22
+ {#if toaster.options.current.closeAll && toaster.toasts.current.length > 1}
23
+ <div class="d-flex position-relative align-items-end pb-2">
24
+ <button class="au-toaster-closeAll btn btn-secondary me-0 ms-auto pe-auto" onclick={() => toaster.closeAll()}
25
+ >{toaster.options.current.closeAllLabel || 'Close all'}</button
26
+ >
27
+ </div>
28
+ {/if}
29
+ {#each toaster.toasts.current as { id, props: { className, visible, structure, children, header, dismissible, ariaCloseButtonLabel, animated, animatedOnInit, onShown, onHidden, onVisibleChange, transition } } (id)}
30
+ <div use:eventsDirective={id} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes([eventsDirective, id])}>
31
+ <Toast
32
+ {animated}
33
+ {animatedOnInit}
34
+ autoHide={false}
35
+ {className}
36
+ dismissible={dismissible ?? toaster.options.current.dismissible}
37
+ {ariaCloseButtonLabel}
38
+ {structure}
39
+ {children}
40
+ {header}
41
+ {onShown}
42
+ onHidden={() => {
43
+ removeToast(id);
44
+ onHidden?.();
45
+ }}
46
+ {onVisibleChange}
47
+ {visible}
48
+ {transition}
49
+ />
50
+ </div>
51
+ {/each}
52
+ </div>
53
+ </div>
@@ -0,0 +1,6 @@
1
+ declare const addToast: any, removeToast: any, closeAll: any;
2
+ export { addToast, removeToast, closeAll };
3
+ import { type ToasterProps } from './toast.gen';
4
+ declare const Toaster: import("svelte").Component<ToasterProps, {}, "">;
5
+ type Toaster = ReturnType<typeof Toaster>;
6
+ export default Toaster;
@@ -1,3 +1,7 @@
1
1
  import Toast from './Toast.svelte';
2
+ export * from './Toaster.svelte';
3
+ import Toaster from './Toaster.svelte';
2
4
  export * from './toast.gen';
3
5
  export { Toast };
6
+ export { Toaster };
7
+ export * from './toasterService';
@@ -1,3 +1,7 @@
1
1
  import Toast from './Toast.svelte';
2
+ export * from './Toaster.svelte';
3
+ import Toaster from './Toaster.svelte';
2
4
  export * from './toast.gen';
3
5
  export { Toast };
6
+ export { Toaster };
7
+ export * from './toasterService';
@@ -188,6 +188,21 @@ export type ToastWidget = Widget<ToastProps, ToastState, ToastApi, ToastDirectiv
188
188
  */
189
189
  declare const export_createToast: WidgetFactory<ToastWidget>;
190
190
  export { export_createToast as createToast };
191
+ /**
192
+ * A mapping of toast position keys to their corresponding CSS class strings of bootstrap.
193
+ * These classes define the positioning of toast notifications on the screen.
194
+ *
195
+ * The keys represent various positions on the screen, such as top-left, top-center,
196
+ * middle-right, etc., and the values are the CSS classes of bootstrap that apply the respective
197
+ * positioning styles.
198
+ *
199
+ * Example usage:
200
+ * ```typescript
201
+ * const positionClass = toastPositions.topLeft; // "top-0 start-0"
202
+ * ```
203
+ */
204
+ declare const export_toastPositions: Record<ToastPositions, string>;
205
+ export { export_toastPositions as toastPositions };
191
206
  /**
192
207
  * Represents the API for the toast component.
193
208
  */
@@ -222,3 +237,73 @@ export interface ToastDirectives {
222
237
  */
223
238
  closeButtonDirective: Directive;
224
239
  }
240
+ /**
241
+ * Represents the possible positions for displaying a toast notification.
242
+ *
243
+ * The positions are defined based on a grid layout with three horizontal
244
+ * alignments (left, center, right) and three vertical alignments (top, middle, bottom).
245
+ *
246
+ * Available positions:
247
+ * - `topLeft`: Top-left corner of the screen.
248
+ * - `topCenter`: Top-center of the screen.
249
+ * - `topRight`: Top-right corner of the screen.
250
+ * - `middleLeft`: Middle-left side of the screen.
251
+ * - `middleCenter`: Center of the screen.
252
+ * - `middleRight`: Middle-right side of the screen.
253
+ * - `bottomLeft`: Bottom-left corner of the screen.
254
+ * - `bottomCenter`: Bottom-center of the screen.
255
+ * - `bottomRight`: Bottom-right corner of the screen.
256
+ */
257
+ export type ToastPositions = 'topLeft' | 'topCenter' | 'topRight' | 'middleLeft' | 'middleCenter' | 'middleRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
258
+ /**
259
+ * Props of the toaster
260
+ */
261
+ export interface ToasterProps {
262
+ /** How much time (ms) a toast is displayed; 0 means it won't be removed until a manual action */
263
+ duration: number;
264
+ /** Where to position the toasts */
265
+ position: ToastPositions;
266
+ /** Maximum number of toasts displayed */
267
+ limit?: number;
268
+ /** Pause toast when hover */
269
+ pauseOnHover?: boolean;
270
+ /** Display a dismiss button on each toast. When duration = 0, this is enforced to true */
271
+ dismissible: boolean;
272
+ /** Add a button to close all the toasts at once */
273
+ closeAll?: boolean;
274
+ /** Close all label */
275
+ closeAllLabel?: string;
276
+ }
277
+ /**
278
+ * Toast object
279
+ * @template Props Type of the toast properties.
280
+ */
281
+ export interface ToasterToast<Props> {
282
+ /** Identifier of the toasts in the toaster */
283
+ id: number;
284
+ /** Properties of the toast */
285
+ props: Props;
286
+ }
287
+ /**
288
+ * Represents a timer used by the toaster service.
289
+ */
290
+ export interface ToasterTimer {
291
+ /**
292
+ * The timeout identifier returned by `setTimeout`.
293
+ */
294
+ timeout: ReturnType<typeof setTimeout> | null;
295
+ /**
296
+ * The timestamp when the timer was started.
297
+ */
298
+ started: number;
299
+ /**
300
+ * The timestamp when the timer was paused (optional).
301
+ */
302
+ paused?: number;
303
+ /**
304
+ * The duration for which the timer is set (optional). Used internally to compute the remaining time.
305
+ */
306
+ duration: number;
307
+ }
308
+ declare const export_defaultToasterProps: ToasterProps;
309
+ export { export_defaultToasterProps as defaultToasterProps };
@@ -1,4 +1,4 @@
1
- import { getToastDefaultConfig, createToast } from '@agnos-ui/core-bootstrap/components/toast';
1
+ import { getToastDefaultConfig, createToast, toastPositions, defaultToasterProps } from '@agnos-ui/core-bootstrap/components/toast';
2
2
  /**
3
3
  * Retrieve a shallow copy of the default Toast config
4
4
  * @returns the default Toast config
@@ -12,3 +12,20 @@ export { export_getToastDefaultConfig as getToastDefaultConfig };
12
12
  */
13
13
  const export_createToast = createToast;
14
14
  export { export_createToast as createToast };
15
+ /**
16
+ * A mapping of toast position keys to their corresponding CSS class strings of bootstrap.
17
+ * These classes define the positioning of toast notifications on the screen.
18
+ *
19
+ * The keys represent various positions on the screen, such as top-left, top-center,
20
+ * middle-right, etc., and the values are the CSS classes of bootstrap that apply the respective
21
+ * positioning styles.
22
+ *
23
+ * Example usage:
24
+ * ```typescript
25
+ * const positionClass = toastPositions.topLeft; // "top-0 start-0"
26
+ * ```
27
+ */
28
+ const export_toastPositions = toastPositions;
29
+ export { export_toastPositions as toastPositions };
30
+ const export_defaultToasterProps = defaultToasterProps;
31
+ export { export_defaultToasterProps as defaultToasterProps };
@@ -0,0 +1,4 @@
1
+ import type { ToastProps } from './toast.gen';
2
+ import { Toaster as headlessToaster } from '@agnos-ui/svelte-headless/components/toast';
3
+ export declare class ToasterService extends headlessToaster<Partial<ToastProps>> {
4
+ }
@@ -0,0 +1,3 @@
1
+ import { Toaster as headlessToaster } from '@agnos-ui/svelte-headless/components/toast';
2
+ export class ToasterService extends headlessToaster {
3
+ }
package/config.gen.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { AccordionProps } from './components/accordion';
2
2
  import type { AlertProps } from './components/alert';
3
+ import type { CarouselProps } from './components/carousel';
3
4
  import type { CollapseProps } from './components/collapse';
4
5
  import type { ModalProps } from './components/modal';
5
6
  import type { PaginationProps } from './components/pagination';
@@ -18,6 +19,10 @@ export type WidgetsConfig = {
18
19
  * the alert widget config
19
20
  */
20
21
  alert: AlertProps;
22
+ /**
23
+ * the carousel widget config
24
+ */
25
+ carousel: CarouselProps<any>;
21
26
  /**
22
27
  * the collapse widget config
23
28
  */
@@ -1 +1 @@
1
- export * from '@agnos-ui/svelte-headless/types';
1
+ export * from './../types';
@@ -1 +1 @@
1
- export * from '@agnos-ui/svelte-headless/types';
1
+ export * from './../types';
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './components/accordion';
2
2
  export * from './components/alert';
3
+ export * from './components/carousel';
3
4
  export * from './components/collapse';
4
5
  export * from './components/modal';
5
6
  export * from './components/pagination';
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './components/accordion';
2
2
  export * from './components/alert';
3
+ export * from './components/carousel';
3
4
  export * from './components/collapse';
4
5
  export * from './components/modal';
5
6
  export * from './components/pagination';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agnos-ui/svelte-bootstrap",
3
3
  "description": "Bootstrap-based component library for Svelte.",
4
- "version": "0.8.0-next.0",
4
+ "version": "0.8.0",
5
5
  "type": "module",
6
6
  "main": "./index.js",
7
7
  "module": "./index.js",
@@ -49,8 +49,8 @@
49
49
  }
50
50
  },
51
51
  "dependencies": {
52
- "@agnos-ui/core-bootstrap": "0.8.0-next.0",
53
- "@agnos-ui/svelte-headless": "0.8.0-next.0"
52
+ "@agnos-ui/core-bootstrap": "0.8.0",
53
+ "@agnos-ui/svelte-headless": "0.8.0"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@amadeus-it-group/tansu": "^2.0.0",
@@ -72,6 +72,7 @@
72
72
  "accordion",
73
73
  "AgnosUI",
74
74
  "alert",
75
+ "carousel",
75
76
  "collapse",
76
77
  "components",
77
78
  "modal",
@@ -80,6 +81,7 @@
80
81
  "rating",
81
82
  "slider",
82
83
  "toast",
84
+ "tree",
83
85
  "widgets"
84
86
  ]
85
87
  }
package/types.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from '@agnos-ui/svelte-headless/types';
2
+ export * from '@agnos-ui/core-bootstrap/types';
package/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from '@agnos-ui/svelte-headless/types';
2
+ export * from '@agnos-ui/core-bootstrap/types';