@agnos-ui/svelte-bootstrap 0.7.1 → 0.8.0-next.1

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.
@@ -1,8 +1,9 @@
1
1
  import type { AccordionApi, AccordionProps } from './accordion';
2
2
  import type { Snippet } from 'svelte';
3
- declare const Accordion: import("svelte").Component<Partial<AccordionProps> & {
3
+ type $$ComponentProps = Partial<AccordionProps> & {
4
4
  children: Snippet;
5
- }, {
5
+ };
6
+ declare const Accordion: import("svelte").Component<$$ComponentProps, {
6
7
  api: AccordionApi;
7
8
  }, "">;
8
9
  type Accordion = ReturnType<typeof Accordion>;
@@ -1,8 +1,9 @@
1
1
  import type { CollapseProps, CollapseApi } from './collapse.gen';
2
2
  import type { Snippet } from 'svelte';
3
- declare const Collapse: import("svelte").Component<Partial<CollapseProps> & {
3
+ type $$ComponentProps = Partial<CollapseProps> & {
4
4
  children: Snippet;
5
- }, {
5
+ };
6
+ declare const Collapse: import("svelte").Component<$$ComponentProps, {
6
7
  api: CollapseApi;
7
8
  }, "visible">;
8
9
  type Collapse = ReturnType<typeof Collapse>;
@@ -134,6 +134,10 @@ export interface CollapseDirectives {
134
134
  * Directive to apply the collapse.
135
135
  */
136
136
  collapseDirective: Directive;
137
+ /**
138
+ * Directive to apply to a trigger;
139
+ */
140
+ triggerDirective: Directive;
137
141
  }
138
142
  /**
139
143
  * Represents a widget for handling collapse functionality.
@@ -28,7 +28,7 @@ export async function openModal(options, { context } = {}) {
28
28
  try {
29
29
  return await component.api.open();
30
30
  }
31
- finally {
32
- unmount(component);
31
+ catch (_error) {
32
+ await unmount(component);
33
33
  }
34
34
  }
@@ -10,7 +10,7 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
10
10
  </script>
11
11
 
12
12
  {#each state.pages as page}
13
- <li class="page-item" class:active={page === state.page} class:disabled={page === -1 || state.disabled}>
13
+ <li class={['page-item', {active: page === state.page, disabled: page === -1 || state.disabled}]}>
14
14
  {#if page === -1}
15
15
  <div class="page-link au-ellipsis" aria-hidden="true">
16
16
  <Slot content={state.ellipsisLabel} props={widget} />
@@ -13,7 +13,7 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
13
13
 
14
14
  <ul class="au-pagination pagination {sizeClass} {state.className}">
15
15
  {#if state.boundaryLinks}
16
- <li class="page-item" class:disabled={state.previousDisabled}>
16
+ <li class={['page-item', {disabled: state.previousDisabled}]}>
17
17
  <a use:__AgnosUISveltePreprocess__classDirective={"page-link"} use:directives.pageFirst {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(directives.pageFirst, [__AgnosUISveltePreprocess__classDirective, "page-link"])}>
18
18
  <span aria-hidden="true">
19
19
  <Slot content={state.firstPageLabel} props={widget} />
@@ -22,7 +22,7 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
22
22
  </li>
23
23
  {/if}
24
24
  {#if state.directionLinks}
25
- <li class="page-item" class:disabled={state.previousDisabled}>
25
+ <li class={['page-item', {disabled: state.previousDisabled}]}>
26
26
  <a use:__AgnosUISveltePreprocess__classDirective={"page-link"} use:directives.pagePrev {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(directives.pagePrev, [__AgnosUISveltePreprocess__classDirective, "page-link"])}>
27
27
  <span aria-hidden="true">
28
28
  <Slot content={state.previousPageLabel} props={widget} />
@@ -32,7 +32,7 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
32
32
  {/if}
33
33
  <Slot content={state.pagesDisplay} props={widget} />
34
34
  {#if state.directionLinks}
35
- <li class="page-item" class:disabled={state.nextDisabled}>
35
+ <li class={['page-item', {disabled: state.nextDisabled}]}>
36
36
  <a use:__AgnosUISveltePreprocess__classDirective={"page-link"} use:directives.pageNext {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(directives.pageNext, [__AgnosUISveltePreprocess__classDirective, "page-link"])}>
37
37
  <span aria-hidden="true">
38
38
  <Slot content={state.nextPageLabel} props={widget} />
@@ -41,7 +41,7 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
41
41
  </li>
42
42
  {/if}
43
43
  {#if state.boundaryLinks}
44
- <li class="page-item" class:disabled={state.nextDisabled}>
44
+ <li class={['page-item', {disabled: state.nextDisabled}]}>
45
45
  <a use:__AgnosUISveltePreprocess__classDirective={"page-link"} use:directives.pageLast {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(directives.pageLast, [__AgnosUISveltePreprocess__classDirective, "page-link"])}>
46
46
  <span aria-hidden="true">
47
47
  <Slot content={state.lastPageLabel} props={widget} />
@@ -7,9 +7,11 @@
7
7
 
8
8
  <div class="progress" style:height={state.height}>
9
9
  <div
10
- class={`progress-bar ${state.type ? `text-bg-${state.type}` : ''}`}
11
- class:progress-bar-striped={state.striped}
12
- class:progress-bar-animated={state.animated}
10
+ class={[
11
+ 'progress-bar',
12
+ state.type ? `text-bg-${state.type}` : '',
13
+ {'progress-bar-striped': state.striped, 'progress-bar-animated': state.animated},
14
+ ]}
13
15
  style:width={`${state.percentage}%`}
14
16
  >
15
17
  <Slot content={state.children} props={{state, api, directives}} />
@@ -65,7 +65,7 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
65
65
  <ul use:hasFocusDirective use:floatingDirective use:menuAttributesDirective use:__AgnosUISveltePreprocess__classDirective={"dropdown-menu show"} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(hasFocusDirective, floatingDirective, menuAttributesDirective, [__AgnosUISveltePreprocess__classDirective, "dropdown-menu show"])}>
66
66
  {#each state.visibleItems as itemContext (itemContext.id)}
67
67
  {@const isHighlighted = itemContext === state.highlighted}
68
- <li use:__AgnosUISveltePreprocess__classDirective={"dropdown-item position-relative"} class:text-bg-primary={isHighlighted} use:itemAttributesDirective={itemContext} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes([itemAttributesDirective, itemContext], [__AgnosUISveltePreprocess__classDirective, "dropdown-item position-relative"])}>
68
+ <li use:__AgnosUISveltePreprocess__classDirective={(['dropdown-item position-relative', {'text-bg-primary': isHighlighted}])} use:itemAttributesDirective={itemContext} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes([itemAttributesDirective, itemContext], [__AgnosUISveltePreprocess__classDirective, (['dropdown-item position-relative', {'text-bg-primary': isHighlighted}])])}>
69
69
  <Slot content={state.itemLabel} props={{state, directives: widget.directives, api: widget.api, itemContext}} />
70
70
  </li>
71
71
  {/each}
@@ -2,12 +2,13 @@
2
2
  import {ssrAttributes as __AgnosUISveltePreprocess__ssrAttributes} from '@agnos-ui/svelte-headless/utils/directive';
3
3
  import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
4
4
 
5
- import type {SliderContext, SliderProps, SliderSlotHandleContext, SliderSlotLabelContext} from './slider.gen';
5
+ import type {SliderContext, SliderProps, SliderSlotHandleContext, SliderSlotLabelContext, SliderSlotTickContext} from './slider.gen';
6
6
  import {createSlider} from './slider.gen';
7
7
  import {Slot} from '@agnos-ui/svelte-headless/slot';
8
8
  import {callWidgetFactory} from '../../config';
9
9
  import SliderDefaultStructure from './SliderDefaultStructure.svelte';
10
10
  import SliderDefaultHandle from './SliderDefaultHandle.svelte';
11
+ import SliderDefaultTick from './SliderDefaultTick.svelte';
11
12
 
12
13
  let {values = $bindable(), ...props}: Partial<SliderProps> = $props();
13
14
 
@@ -18,7 +19,7 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
18
19
  return {...props, values};
19
20
  },
20
21
  enablePatchChanged: true,
21
- defaultConfig: {structure, handle, label},
22
+ defaultConfig: {structure, handle, tick, label},
22
23
  events: {
23
24
  onValuesChange: function (newValues: number[]): void {
24
25
  values = newValues;
@@ -37,6 +38,9 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
37
38
  {#snippet handle(props: SliderSlotHandleContext)}
38
39
  <SliderDefaultHandle {...props} />
39
40
  {/snippet}
41
+ {#snippet tick(props: SliderSlotTickContext)}
42
+ <SliderDefaultTick {...props} />
43
+ {/snippet}
40
44
  {#snippet label({value}: SliderSlotLabelContext)}
41
45
  {value}
42
46
  {/snippet}
@@ -32,6 +32,9 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
32
32
  {/if}
33
33
  </div>
34
34
  {/if}
35
+ {#each state.ticks as tick (tick.position)}
36
+ <Slot content={state.tick} props={{tick, ...widget}} />
37
+ {/each}
35
38
  {#each state.sortedHandles as item, i (item.id)}
36
39
  <Slot content={state.handle} props={{item, ...widget}} />
37
40
  {#if state.showValueLabels && !state.combinedLabelDisplay}
@@ -0,0 +1,22 @@
1
+ <script lang="ts">
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 {SliderSlotTickContext} from './slider.gen';
6
+
7
+ let {tick, directives, state}: SliderSlotTickContext = $props();
8
+ </script>
9
+
10
+ {#if tick.displayLabel}
11
+ <span use:directives.tickLabelDirective={{tick}} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes([directives.tickLabelDirective, {tick}])}>
12
+ {tick.value}
13
+ </span>
14
+ {/if}
15
+ <span use:directives.tickDirective={{tick}} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes([directives.tickDirective, {tick}])}>
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>
22
+ </span>
@@ -0,0 +1,4 @@
1
+ import type { SliderSlotTickContext } from './slider.gen';
2
+ declare const SliderDefaultTick: import("svelte").Component<SliderSlotTickContext, {}, "">;
3
+ type SliderDefaultTick = ReturnType<typeof SliderDefaultTick>;
4
+ export default SliderDefaultTick;
@@ -31,6 +31,15 @@ export interface SliderSlotHandleContext extends SliderContext {
31
31
  */
32
32
  item: SliderHandle;
33
33
  }
34
+ /**
35
+ * Represents the context for a slider tick slot
36
+ */
37
+ export interface SliderSlotTickContext extends SliderContext {
38
+ /**
39
+ * tick context
40
+ */
41
+ tick: SliderTick;
42
+ }
34
43
  /**
35
44
  * Represents the state of a slider component.
36
45
  */
@@ -75,6 +84,10 @@ export interface SliderState {
75
84
  * Check if the slider is interactive, meaning it is not disabled or readonly
76
85
  */
77
86
  interactive: boolean;
87
+ /**
88
+ * Array of ticks to display on the slider component
89
+ */
90
+ ticks: SliderTick[];
78
91
  /**
79
92
  * Minimum value that can be assigned to the slider
80
93
  *
@@ -129,6 +142,12 @@ export interface SliderState {
129
142
  * @defaultValue `true`
130
143
  */
131
144
  showMinMaxLabels: boolean;
145
+ /**
146
+ * If `true` the ticks are displayed on the slider
147
+ *
148
+ * @defaultValue `false`
149
+ */
150
+ showTicks: boolean;
132
151
  /**
133
152
  * It `true` slider display is inversed
134
153
  *
@@ -158,6 +177,10 @@ export interface SliderState {
158
177
  * Slot to change the handlers
159
178
  */
160
179
  handle: SlotContent<SliderSlotHandleContext>;
180
+ /**
181
+ * Slot to change the ticks
182
+ */
183
+ tick: SlotContent<SliderSlotTickContext>;
161
184
  }
162
185
  /**
163
186
  * Represents the properties for the Slider component.
@@ -205,6 +228,19 @@ export interface SliderProps {
205
228
  * ```
206
229
  */
207
230
  onValuesChange: (values: number[]) => void;
231
+ /**
232
+ * Unit value between the ticks
233
+ * If value is set to `0` the {@link stepSize} is used to space the ticks
234
+ *
235
+ * @defaultValue `0`
236
+ */
237
+ tickInterval: number;
238
+ /**
239
+ * If `true` the tick values are displayed on the slider
240
+ *
241
+ * @defaultValue `true`
242
+ */
243
+ showTickValues: boolean;
208
244
  /**
209
245
  * Minimum value that can be assigned to the slider
210
246
  *
@@ -259,6 +295,12 @@ export interface SliderProps {
259
295
  * @defaultValue `true`
260
296
  */
261
297
  showMinMaxLabels: boolean;
298
+ /**
299
+ * If `true` the ticks are displayed on the slider
300
+ *
301
+ * @defaultValue `false`
302
+ */
303
+ showTicks: boolean;
262
304
  /**
263
305
  * It `true` slider display is inversed
264
306
  *
@@ -288,6 +330,10 @@ export interface SliderProps {
288
330
  * Slot to change the handlers
289
331
  */
290
332
  handle: SlotContent<SliderSlotHandleContext>;
333
+ /**
334
+ * Slot to change the ticks
335
+ */
336
+ tick: SlotContent<SliderSlotTickContext>;
291
337
  }
292
338
  /**
293
339
  * Represents a slider widget component.
@@ -371,6 +417,35 @@ export interface SliderHandle {
371
417
  */
372
418
  ariaLabelledBy: string | undefined;
373
419
  }
420
+ /**
421
+ * Represents a tick in a slider component.
422
+ */
423
+ export interface SliderTick {
424
+ /**
425
+ * CSS classes to be applied on the tick
426
+ */
427
+ className?: string | null;
428
+ /**
429
+ * Visualized optional explanation of the label
430
+ */
431
+ legend?: string | null;
432
+ /**
433
+ * Position of the tick in percent
434
+ */
435
+ position: number;
436
+ /**
437
+ * If `true` the tick has selected style
438
+ */
439
+ selected: boolean;
440
+ /**
441
+ * Value of the tick
442
+ */
443
+ value: number;
444
+ /**
445
+ * If `true` the tick label is displayed
446
+ */
447
+ displayLabel: boolean;
448
+ }
374
449
  /**
375
450
  * Interface representing various directives used in the slider component.
376
451
  */
@@ -421,4 +496,16 @@ export interface SliderDirectives {
421
496
  handleLabelDisplayDirective: Directive<{
422
497
  index: number;
423
498
  }>;
499
+ /**
500
+ * Directive to apply to the slider tick
501
+ */
502
+ tickDirective: Directive<{
503
+ tick: SliderTick;
504
+ }>;
505
+ /**
506
+ * Directive to apply to the slider tick label
507
+ */
508
+ tickLabelDirective: Directive<{
509
+ tick: SliderTick;
510
+ }>;
424
511
  }
@@ -37,14 +37,7 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
37
37
  {/snippet}
38
38
 
39
39
  {#if !state.hidden}
40
- <div
41
- use:__AgnosUISveltePreprocess__classDirective={"toast"}
42
- class:toast-dismissible={state.dismissible}
43
- class:d-flex={!state.header}
44
- use:transitionDirective
45
- use:autoHideDirective
46
- use:bodyDirective {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(transitionDirective, autoHideDirective, bodyDirective, [__AgnosUISveltePreprocess__classDirective, "toast"])}
47
- >
40
+ <div use:__AgnosUISveltePreprocess__classDirective={({'toast-dismissible': state.dismissible, 'd-flex': !state.header})} use:transitionDirective use:autoHideDirective use:bodyDirective {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(transitionDirective, autoHideDirective, bodyDirective, [__AgnosUISveltePreprocess__classDirective, ({'toast-dismissible': state.dismissible, 'd-flex': !state.header})])}>
48
41
  <Slot content={state.structure} props={widget} />
49
42
  </div>
50
43
  {/if}
@@ -5,6 +5,7 @@ export * from './config';
5
5
  export * from './utils/widget.svelte';
6
6
  export * from './utils/writables';
7
7
  export * from './utils/stores';
8
+ export * from './utils/func';
8
9
  export * from './utils/directive';
9
10
  export * from './services/siblingsInert';
10
11
  export * from './services/resizeObserver';
@@ -5,6 +5,7 @@ export * from './config';
5
5
  export * from './utils/widget.svelte';
6
6
  export * from './utils/writables';
7
7
  export * from './utils/stores';
8
+ export * from './utils/func';
8
9
  export * from './utils/directive';
9
10
  export * from './services/siblingsInert';
10
11
  export * from './services/resizeObserver';
@@ -0,0 +1 @@
1
+ export * from '@agnos-ui/svelte-headless/utils/func';
@@ -0,0 +1 @@
1
+ export * from '@agnos-ui/svelte-headless/utils/func';
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.7.1",
4
+ "version": "0.8.0-next.1",
5
5
  "type": "module",
6
6
  "main": "./index.js",
7
7
  "module": "./index.js",
@@ -49,13 +49,13 @@
49
49
  }
50
50
  },
51
51
  "dependencies": {
52
- "@agnos-ui/core-bootstrap": "0.7.1",
53
- "@agnos-ui/svelte-headless": "0.7.1"
52
+ "@agnos-ui/core-bootstrap": "0.8.0-next.1",
53
+ "@agnos-ui/svelte-headless": "0.8.0-next.1"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@amadeus-it-group/tansu": "^2.0.0",
57
57
  "esm-env": "^1.2.1",
58
- "svelte": "^5.0.0"
58
+ "svelte": "^5.16.0"
59
59
  },
60
60
  "sideEffects": false,
61
61
  "homepage": "https://www.agnosui.dev/latest/",