@agnos-ui/svelte-bootstrap 0.10.0-next.1 → 0.10.0-next.3

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.
@@ -8,27 +8,21 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
8
8
  import {createDrawer} from './drawer.gen';
9
9
  import DrawerDefaultStructure from './DrawerDefaultStructure.svelte';
10
10
 
11
- let {width = $bindable(), height = $bindable(), visible = $bindable(), ...props}: Partial<DrawerProps> = $props();
11
+ let {visible = $bindable(), ...props}: Partial<DrawerProps> = $props();
12
12
 
13
13
  const widget = callWidgetFactory(createDrawer, {
14
14
  get props() {
15
- return {...props, width, height, visible};
15
+ return {...props, visible};
16
16
  },
17
17
  defaultConfig: {structure},
18
18
  events: {
19
- onWidthChange: (value: number) => {
20
- width = value;
21
- },
22
- onHeightChange: (value: number) => {
23
- height = value;
24
- },
25
19
  onVisibleChange: (event) => {
26
20
  visible = event;
27
21
  },
28
22
  },
29
23
  });
30
24
  const {
31
- directives: {backdropDirective, backdropPortalDirective, drawerDirective, drawerPortalDirective, containerDirective},
25
+ directives: {backdropDirective, backdropPortalDirective, drawerDirective, drawerPortalDirective, containerDirective, splitterDirective},
32
26
  state,
33
27
  } = widget;
34
28
 
@@ -44,6 +38,10 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
44
38
  <div use:containerDirective {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(containerDirective)}>
45
39
  <Slot content={state.structure} props={widget} />
46
40
  </div>
41
+ {#if state.resizable}
42
+ <!-- svelte-ignore a11y_no_noninteractive_tabindex -->
43
+ <div use:splitterDirective tabindex="0" {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(splitterDirective)}></div>
44
+ {/if}
47
45
  </div>
48
46
  {/if}
49
47
  {#if !state.backdropHidden}
@@ -1,6 +1,6 @@
1
1
  import type { DrawerApi, DrawerProps } from './drawer.gen';
2
2
  declare const Drawer: import("svelte").Component<Partial<DrawerProps>, {
3
3
  api: DrawerApi;
4
- }, "visible" | "width" | "height">;
4
+ }, "visible">;
5
5
  type Drawer = ReturnType<typeof Drawer>;
6
6
  export default Drawer;
@@ -1,20 +1,16 @@
1
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
2
  import {Slot} from '@agnos-ui/svelte-headless/slot';
6
3
  import type {DrawerContext} from './drawer.gen';
7
4
 
8
5
  let widget: DrawerContext = $props();
9
- let {state, directives} = widget;
6
+ let {state} = widget;
10
7
  </script>
11
8
 
12
- <div class="au-drawer-header">
13
- <Slot content={state.header} props={widget} />
14
- </div>
15
- <div class="au-drawer-body">
16
- <Slot content={state.children} props={widget} />
9
+ <div class="au-drawer-content">
10
+ <div class="au-drawer-header">
11
+ <Slot content={state.header} props={widget} />
12
+ </div>
13
+ <div class="au-drawer-body">
14
+ <Slot content={state.children} props={widget} />
15
+ </div>
17
16
  </div>
18
- {#if state.resizable}
19
- <div use:directives.splitterDirective {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(directives.splitterDirective)}></div>
20
- {/if}
@@ -1,3 +1,4 @@
1
- declare const DrawerDefaultStructure: import("svelte").Component<WidgetSlotContext<Widget<import("./drawer.gen").DrawerProps, import("./drawer.gen").DrawerState, import("./drawer.gen").DrawerApi, import("./drawer.gen").DrawerDirectives>>, {}, "">;
1
+ import type { DrawerContext } from './drawer.gen';
2
+ declare const DrawerDefaultStructure: import("svelte").Component<DrawerContext, {}, "">;
2
3
  type DrawerDefaultStructure = ReturnType<typeof DrawerDefaultStructure>;
3
4
  export default DrawerDefaultStructure;
@@ -59,6 +59,13 @@ export interface DrawerState {
59
59
  * @defaultValue `false`
60
60
  */
61
61
  resizable: boolean;
62
+ /**
63
+ * Size of the drawer in pixel once the user start interacting.
64
+ * It corresponds to the height or the width depending on the drawer orientation
65
+ *
66
+ * @defaultValue `null`
67
+ */
68
+ size: number | null;
62
69
  /**
63
70
  * Global template for the drawer component
64
71
  */
@@ -118,18 +125,6 @@ export interface DrawerProps {
118
125
  * @defaultValue `''`
119
126
  */
120
127
  ariaDescribedBy: string;
121
- /**
122
- * The width of the drawer in pixels.
123
- *
124
- * @defaultValue `200`
125
- */
126
- width: number;
127
- /**
128
- * The height of the drawer in pixels.
129
- *
130
- * @defaultValue `200`
131
- */
132
- height: number;
133
128
  /**
134
129
  * If `true` displays the backdrop element and disables the body scrolling, otherwise the body of the document is navigable
135
130
  *
@@ -161,38 +156,54 @@ export interface DrawerProps {
161
156
  */
162
157
  onShown: () => void;
163
158
  /**
164
- * An event emitted when the width is changed.
159
+ * An event emitted when the drawer size changes (width or height depending on the orientation).
165
160
  *
166
- * Event payload is equal to the newly selected width.
161
+ * Event payload is equal to the newly selected width or height.
167
162
  *
168
163
  * @defaultValue
169
164
  * ```ts
170
165
  * () => {}
171
166
  * ```
172
167
  */
173
- onWidthChange: (width: number) => void;
168
+ onSizeChange: (size: number | null) => void;
174
169
  /**
175
- * An event emitted when the height is changed.
170
+ * Event to be triggered when the visible property changes.
176
171
  *
177
- * Event payload is equal to the newly selected height.
172
+ * @param visible - new value of the visible propery
178
173
  *
179
174
  * @defaultValue
180
175
  * ```ts
181
176
  * () => {}
182
177
  * ```
183
178
  */
184
- onHeightChange: (width: number) => void;
179
+ onVisibleChange: (visible: boolean) => void;
185
180
  /**
186
- * Event to be triggered when the visible property changes.
181
+ * Event to be triggered when the minimized state changes.
187
182
  *
188
- * @param visible - new value of the visible propery
183
+ * @defaultValue
184
+ * ```ts
185
+ * () => {}
186
+ * ```
187
+ */
188
+ onMinimizedChange: (isMinimized: boolean) => void;
189
+ /**
190
+ * Event to be triggered when the maximized state changes.
189
191
  *
190
192
  * @defaultValue
191
193
  * ```ts
192
194
  * () => {}
193
195
  * ```
194
196
  */
195
- onVisibleChange: (visible: boolean) => void;
197
+ onMaximizedChange: (isMaximized: boolean) => void;
198
+ /**
199
+ * Event to be triggered when the user starts or stops resizing the drawer.
200
+ *
201
+ * @defaultValue
202
+ * ```ts
203
+ * () => {}
204
+ * ```
205
+ */
206
+ onResizingChange: (isResizing: boolean) => void;
196
207
  /**
197
208
  * CSS classes to be applied on the widget main container
198
209
  *
@@ -228,6 +239,13 @@ export interface DrawerProps {
228
239
  * @defaultValue `false`
229
240
  */
230
241
  resizable: boolean;
242
+ /**
243
+ * Size of the drawer in pixel once the user start interacting.
244
+ * It corresponds to the height or the width depending on the drawer orientation
245
+ *
246
+ * @defaultValue `null`
247
+ */
248
+ size: number | null;
231
249
  /**
232
250
  * Global template for the drawer component
233
251
  */
@@ -7,7 +7,7 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
7
7
  let {item, directives}: SliderSlotHandleContext = $props();
8
8
 
9
9
  let refocusElement: HTMLElement | undefined = $state(undefined);
10
- let updateTimeout: NodeJS.Timeout;
10
+ let updateTimeout: ReturnType<typeof setTimeout>;
11
11
 
12
12
  // Manually keep focus as scheduling goal elements are re-ordered.
13
13
  // Svelte currently does not retain focus as elements are moved, even when keyed.
@@ -37,7 +37,7 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
37
37
  {/each}
38
38
  {#each state.sortedHandles as item, i (item.id)}
39
39
  <Slot content={state.handle} props={{item, ...widget}} />
40
- {#if state.showValueLabels && !state.combinedLabelDisplay}
40
+ {#if state.showValueLabels}
41
41
  <div use:directives.handleLabelDisplayDirective={{index: i}} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes([directives.handleLabelDisplayDirective, {index: i}])}>
42
42
  <Slot content={state.label} props={{value: state.values[i], ...widget}} />
43
43
  </div>
@@ -1,4 +1,4 @@
1
- declare const addToast: any, removeToast: any, closeAll: any;
1
+ declare const addToast: (props: Partial<import("./toast.gen").ToastProps>) => number, removeToast: (id: number) => void, closeAll: () => void;
2
2
  export { addToast, removeToast, closeAll };
3
3
  import { type ToasterProps } from './toast.gen';
4
4
  declare const Toaster: import("svelte").Component<ToasterProps, {}, "">;
@@ -1,3 +1,4 @@
1
- declare const TreeDefaultItem: import("svelte").Component<any, {}, "">;
1
+ import type { TreeSlotItemContext } from './tree.gen';
2
+ declare const TreeDefaultItem: import("svelte").Component<TreeSlotItemContext, {}, "">;
2
3
  type TreeDefaultItem = ReturnType<typeof TreeDefaultItem>;
3
4
  export default TreeDefaultItem;
@@ -1,3 +1,4 @@
1
- declare const TreeDefaultItemContent: import("svelte").Component<any, {}, "">;
1
+ import type { TreeSlotItemContext } from './tree.gen';
2
+ declare const TreeDefaultItemContent: import("svelte").Component<TreeSlotItemContext, {}, "">;
2
3
  type TreeDefaultItemContent = ReturnType<typeof TreeDefaultItemContent>;
3
4
  export default TreeDefaultItemContent;
@@ -1,3 +1,4 @@
1
- declare const TreeDefaultItemToggle: import("svelte").Component<any, {}, "">;
1
+ import type { TreeSlotItemContext } from './tree.gen';
2
+ declare const TreeDefaultItemToggle: import("svelte").Component<TreeSlotItemContext, {}, "">;
2
3
  type TreeDefaultItemToggle = ReturnType<typeof TreeDefaultItemToggle>;
3
4
  export default TreeDefaultItemToggle;
@@ -1,3 +1,4 @@
1
- declare const TreeDefaultStructure: import("svelte").Component<WidgetSlotContext<Widget<import("./tree.gen").TreeProps, import("./tree.gen").TreeState, import("./tree.gen").TreeApi, import("./tree.gen").TreeDirectives>>, {}, "">;
1
+ import type { TreeContext } from './tree.gen';
2
+ declare const TreeDefaultStructure: import("svelte").Component<TreeContext, {}, "">;
2
3
  type TreeDefaultStructure = ReturnType<typeof TreeDefaultStructure>;
3
4
  export default TreeDefaultStructure;
@@ -11,6 +11,7 @@ export * from './utils/directive';
11
11
  export * from './services/siblingsInert';
12
12
  export * from './services/resizeObserver';
13
13
  export * from './services/portal';
14
+ export * from './services/pointerdownPosition';
14
15
  export * from './services/navManager';
15
16
  export * from './services/matchMedia';
16
17
  export * from './services/intersection';
@@ -11,6 +11,7 @@ export * from './utils/directive';
11
11
  export * from './services/siblingsInert';
12
12
  export * from './services/resizeObserver';
13
13
  export * from './services/portal';
14
+ export * from './services/pointerdownPosition';
14
15
  export * from './services/navManager';
15
16
  export * from './services/matchMedia';
16
17
  export * from './services/intersection';
@@ -0,0 +1 @@
1
+ export * from '@agnos-ui/svelte-headless/services/pointerdownPosition';
@@ -0,0 +1 @@
1
+ export * from '@agnos-ui/svelte-headless/services/pointerdownPosition';
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.10.0-next.1",
4
+ "version": "0.10.0-next.3",
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.10.0-next.1",
53
- "@agnos-ui/svelte-headless": "0.10.0-next.1"
52
+ "@agnos-ui/core-bootstrap": "0.10.0-next.3",
53
+ "@agnos-ui/svelte-headless": "0.10.0-next.3"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@amadeus-it-group/tansu": "^2.0.0",