@agnos-ui/svelte-bootstrap 0.3.1 → 0.4.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.
- package/components/accordion/Accordion.svelte +2 -8
- package/components/accordion/Accordion.svelte.d.ts +4 -2
- package/components/accordion/Item.svelte +14 -16
- package/components/accordion/Item.svelte.d.ts +6 -4
- package/components/accordion/ItemDefaultStructure.svelte +12 -14
- package/components/accordion/ItemDefaultStructure.svelte.d.ts +7 -5
- package/components/accordion/accordion.d.ts +7 -21
- package/components/accordion/accordion.gen.d.ts +343 -0
- package/components/accordion/accordion.gen.js +1 -0
- package/components/accordion/accordion.js +3 -3
- package/components/alert/Alert.svelte +5 -7
- package/components/alert/Alert.svelte.d.ts +4 -2
- package/components/alert/AlertDefaultStructure.svelte +2 -3
- package/components/alert/AlertDefaultStructure.svelte.d.ts +6 -4
- package/components/alert/alert.d.ts +5 -14
- package/components/alert/alert.gen.d.ts +119 -0
- package/components/alert/alert.gen.js +1 -0
- package/components/alert/alert.js +2 -3
- package/components/modal/Modal.svelte +6 -8
- package/components/modal/Modal.svelte.d.ts +3 -3
- package/components/modal/ModalDefaultHeader.svelte +2 -3
- package/components/modal/ModalDefaultHeader.svelte.d.ts +5 -5
- package/components/modal/ModalDefaultStructure.svelte +6 -7
- package/components/modal/ModalDefaultStructure.svelte.d.ts +5 -5
- package/components/modal/modal.d.ts +7 -15
- package/components/modal/modal.gen.d.ts +239 -0
- package/components/modal/modal.gen.js +1 -0
- package/components/modal/modal.js +3 -3
- package/components/pagination/Pagination.svelte +12 -14
- package/components/pagination/Pagination.svelte.d.ts +4 -2
- package/components/pagination/PaginationDefaultPages.svelte +15 -15
- package/components/pagination/PaginationDefaultPages.svelte.d.ts +6 -4
- package/components/pagination/PaginationDefaultStructure.svelte +42 -44
- package/components/pagination/PaginationDefaultStructure.svelte.d.ts +6 -4
- package/components/pagination/pagination.d.ts +5 -16
- package/components/pagination/pagination.gen.d.ts +394 -0
- package/components/pagination/pagination.gen.js +1 -0
- package/components/pagination/pagination.js +2 -3
- package/components/progressbar/Progressbar.svelte +5 -7
- package/components/progressbar/Progressbar.svelte.d.ts +4 -2
- package/components/progressbar/ProgressbarDefaultStructure.svelte +2 -3
- package/components/progressbar/ProgressbarDefaultStructure.svelte.d.ts +6 -4
- package/components/progressbar/progressbar.d.ts +5 -14
- package/components/progressbar/progressbar.gen.d.ts +126 -0
- package/components/progressbar/progressbar.gen.js +1 -0
- package/components/progressbar/progressbar.js +2 -3
- package/components/rating/Rating.svelte +3 -5
- package/components/rating/Rating.svelte.d.ts +6 -7
- package/components/rating/rating.d.ts +5 -12
- package/components/rating/rating.gen.d.ts +179 -0
- package/components/rating/rating.gen.js +1 -0
- package/components/rating/rating.js +2 -3
- package/components/select/Select.svelte +11 -8
- package/components/select/Select.svelte.d.ts +2 -2
- package/components/select/select.d.ts +5 -16
- package/components/select/select.gen.d.ts +293 -0
- package/components/select/select.gen.js +1 -0
- package/components/select/select.js +2 -3
- package/components/slider/Slider.svelte +6 -8
- package/components/slider/Slider.svelte.d.ts +4 -2
- package/components/slider/SliderDefaultHandle.svelte.d.ts +6 -4
- package/components/slider/SliderDefaultStructure.svelte +9 -10
- package/components/slider/SliderDefaultStructure.svelte.d.ts +6 -4
- package/components/slider/slider.d.ts +5 -18
- package/components/slider/slider.gen.d.ts +293 -0
- package/components/slider/slider.gen.js +1 -0
- package/components/slider/slider.js +2 -3
- package/components/toast/Toast.svelte +6 -15
- package/components/toast/Toast.svelte.d.ts +4 -2
- package/components/toast/ToastDefaultStructure.svelte +5 -6
- package/components/toast/ToastDefaultStructure.svelte.d.ts +6 -4
- package/components/toast/toast.d.ts +5 -14
- package/components/toast/toast.gen.d.ts +146 -0
- package/components/toast/toast.gen.js +1 -0
- package/components/toast/toast.js +2 -3
- package/config.d.ts +4 -6
- package/config.gen.d.ts +47 -0
- package/config.gen.js +1 -0
- package/package.json +6 -6
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<script>import { Slot } from "@agnos-ui/svelte-headless/slot";
|
|
2
2
|
export let state;
|
|
3
3
|
export let widget;
|
|
4
|
-
$:
|
|
5
|
-
slotContext = { widget, state };
|
|
4
|
+
$: slotContext = { widget, state };
|
|
6
5
|
</script>
|
|
7
6
|
|
|
8
7
|
<div class="alert-body">
|
|
9
|
-
<Slot slotContent={state.
|
|
8
|
+
<Slot slotContent={state.children} props={slotContext} let:component let:props>
|
|
10
9
|
<svelte:fragment slot="slot" let:props><slot {...props} /></svelte:fragment>
|
|
11
10
|
<svelte:component this={component} {...props}>
|
|
12
11
|
<svelte:fragment let:state let:widget><slot {state} {widget} /></svelte:fragment>
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { AlertSlots } from './alert';
|
|
3
3
|
declare const __propDef: {
|
|
4
|
-
props:
|
|
4
|
+
props: WidgetSlotContext<Widget<import("./alert.gen").AlertProps, import("./alert.gen").AlertState, import("./alert.gen").AlertApi, object, import("./alert.gen").AlertDirectives>>;
|
|
5
5
|
events: {
|
|
6
6
|
[evt: string]: CustomEvent<any>;
|
|
7
7
|
};
|
|
8
8
|
slots: AlertSlots;
|
|
9
|
+
exports?: {} | undefined;
|
|
10
|
+
bindings?: string | undefined;
|
|
9
11
|
};
|
|
10
12
|
export type AlertDefaultStructureProps = typeof __propDef.props;
|
|
11
13
|
export type AlertDefaultStructureEvents = typeof __propDef.events;
|
|
12
14
|
export type AlertDefaultStructureSlots = typeof __propDef.slots;
|
|
13
|
-
export default class AlertDefaultStructure extends
|
|
15
|
+
export default class AlertDefaultStructure extends SvelteComponent<AlertDefaultStructureProps, AlertDefaultStructureEvents, AlertDefaultStructureSlots> {
|
|
14
16
|
}
|
|
15
17
|
export {};
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
export interface AlertProps extends WidgetProps<AlertWidget> {
|
|
7
|
-
}
|
|
8
|
-
export interface AlertState extends WidgetState<AlertWidget> {
|
|
9
|
-
}
|
|
10
|
-
export interface AlertApi extends PropType<AlertWidget, 'api'> {
|
|
11
|
-
}
|
|
1
|
+
import type { WidgetPropsSlots, WidgetFactory } from '@agnos-ui/svelte-headless/types';
|
|
2
|
+
import type { AlertProps, AlertWidget } from './alert.gen';
|
|
3
|
+
export type * from './alert.gen';
|
|
4
|
+
export declare const createAlert: WidgetFactory<AlertWidget>;
|
|
5
|
+
export declare const getAlertDefaultConfig: () => AlertProps;
|
|
12
6
|
export interface AlertSlots extends WidgetPropsSlots<AlertProps> {
|
|
13
7
|
}
|
|
14
|
-
export interface AlertContext extends AdaptSlotContentProps<CoreContext> {
|
|
15
|
-
}
|
|
16
|
-
export declare const createAlert: WidgetFactory<AlertWidget>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { WidgetSlotContext, SlotContent, Widget, Directive } from '@agnos-ui/svelte-headless/types';
|
|
2
|
+
import type { BSContextualClass } from '@agnos-ui/core-bootstrap/types';
|
|
3
|
+
import type { TransitionFn } from '@agnos-ui/svelte-headless/services/transitions/baseTransitions';
|
|
4
|
+
export type AlertContext = WidgetSlotContext<AlertWidget>;
|
|
5
|
+
export interface AlertState {
|
|
6
|
+
/**
|
|
7
|
+
* Is `true` when the alert is hidden. Compared to `visible`, this is updated after the transition is executed.
|
|
8
|
+
*/
|
|
9
|
+
hidden: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* If `true`, alert can be dismissed by the user.
|
|
12
|
+
* The close button (×) will be displayed and you can be notified of the event with the (close) output.
|
|
13
|
+
*/
|
|
14
|
+
dismissible: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* If `true` the alert is visible to the user
|
|
17
|
+
*/
|
|
18
|
+
visible: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Accessibility close button label
|
|
21
|
+
*/
|
|
22
|
+
ariaCloseButtonLabel: string;
|
|
23
|
+
/**
|
|
24
|
+
* CSS classes to be applied on the widget main container
|
|
25
|
+
*/
|
|
26
|
+
className: string;
|
|
27
|
+
/**
|
|
28
|
+
* Global template for the alert component
|
|
29
|
+
*/
|
|
30
|
+
structure: SlotContent<AlertContext>;
|
|
31
|
+
/**
|
|
32
|
+
* Template for the alert content
|
|
33
|
+
*/
|
|
34
|
+
children: SlotContent<AlertContext>;
|
|
35
|
+
/**
|
|
36
|
+
* Type of the alert, following bootstrap types.
|
|
37
|
+
*/
|
|
38
|
+
type: BSContextualClass;
|
|
39
|
+
}
|
|
40
|
+
export interface AlertProps {
|
|
41
|
+
/**
|
|
42
|
+
* Callback called when the alert visibility changed.
|
|
43
|
+
*/
|
|
44
|
+
onVisibleChange: (visible: boolean) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Callback called when the alert is hidden.
|
|
47
|
+
*/
|
|
48
|
+
onHidden: () => void;
|
|
49
|
+
/**
|
|
50
|
+
* Callback called when the alert is shown.
|
|
51
|
+
*/
|
|
52
|
+
onShown: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* The transition function will be executed when the alert is displayed or hidden.
|
|
55
|
+
*
|
|
56
|
+
* Depending on the value of `animatedOnInit`, the animation can be optionally skipped during the showing process.
|
|
57
|
+
*/
|
|
58
|
+
transition: TransitionFn;
|
|
59
|
+
/**
|
|
60
|
+
* If `true`, alert opening will be animated.
|
|
61
|
+
*
|
|
62
|
+
* Animation is triggered when the `.open()` function is called
|
|
63
|
+
* or the visible prop is changed
|
|
64
|
+
*/
|
|
65
|
+
animatedOnInit: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* If `true`, alert closing will be animated.
|
|
68
|
+
*
|
|
69
|
+
* Animation is triggered when clicked on the close button (×),
|
|
70
|
+
* via the `.close()` function or the visible prop is changed
|
|
71
|
+
*/
|
|
72
|
+
animated: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* If `true`, alert can be dismissed by the user.
|
|
75
|
+
* The close button (×) will be displayed and you can be notified of the event with the (close) output.
|
|
76
|
+
*/
|
|
77
|
+
dismissible: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* If `true` the alert is visible to the user
|
|
80
|
+
*/
|
|
81
|
+
visible: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Accessibility close button label
|
|
84
|
+
*/
|
|
85
|
+
ariaCloseButtonLabel: string;
|
|
86
|
+
/**
|
|
87
|
+
* CSS classes to be applied on the widget main container
|
|
88
|
+
*/
|
|
89
|
+
className: string;
|
|
90
|
+
/**
|
|
91
|
+
* Global template for the alert component
|
|
92
|
+
*/
|
|
93
|
+
structure: SlotContent<AlertContext>;
|
|
94
|
+
/**
|
|
95
|
+
* Template for the alert content
|
|
96
|
+
*/
|
|
97
|
+
children: SlotContent<AlertContext>;
|
|
98
|
+
/**
|
|
99
|
+
* Type of the alert, following bootstrap types.
|
|
100
|
+
*/
|
|
101
|
+
type: BSContextualClass;
|
|
102
|
+
}
|
|
103
|
+
export type AlertWidget = Widget<AlertProps, AlertState, AlertApi, object, AlertDirectives>;
|
|
104
|
+
export interface AlertApi {
|
|
105
|
+
/**
|
|
106
|
+
* Triggers alert closing programmatically (same as clicking on the close button (×)).
|
|
107
|
+
*/
|
|
108
|
+
close(): void;
|
|
109
|
+
/**
|
|
110
|
+
* Triggers the alert to be displayed for the user.
|
|
111
|
+
*/
|
|
112
|
+
open(): void;
|
|
113
|
+
}
|
|
114
|
+
export interface AlertDirectives {
|
|
115
|
+
/**
|
|
116
|
+
* the transition directive, piloting what is the visual effect of going from hidden to visible
|
|
117
|
+
*/
|
|
118
|
+
transitionDirective: Directive;
|
|
119
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import { createAlert as coreCreateAlert } from '@agnos-ui/core-bootstrap/components/alert';
|
|
3
|
-
// factory
|
|
1
|
+
import { createAlert as coreCreateAlert, getAlertDefaultConfig as coreGetAlertDefaultConfig } from '@agnos-ui/core-bootstrap/components/alert';
|
|
4
2
|
export const createAlert = coreCreateAlert;
|
|
3
|
+
export const getAlertDefaultConfig = coreGetAlertDefaultConfig;
|
|
@@ -8,8 +8,8 @@ import { callWidgetFactory } from "../../config";
|
|
|
8
8
|
import ModalDefaultHeader from "./ModalDefaultHeader.svelte";
|
|
9
9
|
import ModalDefaultStructure from "./ModalDefaultStructure.svelte";
|
|
10
10
|
const defaultConfig = {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
structure: ModalDefaultStructure,
|
|
12
|
+
header: ModalDefaultHeader
|
|
13
13
|
};
|
|
14
14
|
</script>
|
|
15
15
|
|
|
@@ -28,14 +28,12 @@ const widget = callWidgetFactory({
|
|
|
28
28
|
});
|
|
29
29
|
export const api = widget.api;
|
|
30
30
|
const {
|
|
31
|
-
stores: { backdropHidden$, hidden$,
|
|
31
|
+
stores: { backdropHidden$, hidden$, structure$ },
|
|
32
32
|
directives: { backdropDirective, backdropPortalDirective, modalDirective, modalPortalDirective },
|
|
33
33
|
state$
|
|
34
34
|
} = widget;
|
|
35
|
-
$:
|
|
36
|
-
|
|
37
|
-
$:
|
|
38
|
-
slotContext = { widget: toSlotContextWidget(widget), state: $state$ };
|
|
35
|
+
$: widget.patchChangedProps($$props);
|
|
36
|
+
$: slotContext = { widget: toSlotContextWidget(widget), state: $state$ };
|
|
39
37
|
</script>
|
|
40
38
|
|
|
41
39
|
{#if !$backdropHidden$}
|
|
@@ -46,7 +44,7 @@ $:
|
|
|
46
44
|
<div use:__AgnosUISveltePreprocess__classDirective={"modal d-block"} use:modalPortalDirective use:modalDirective {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(modalPortalDirective, modalDirective, [__AgnosUISveltePreprocess__classDirective, "modal d-block"])}>
|
|
47
45
|
<div class="modal-dialog {$state$.fullscreen ? 'modal-fullscreen' : ''}">
|
|
48
46
|
<div class="modal-content">
|
|
49
|
-
<Slot slotContent={$
|
|
47
|
+
<Slot slotContent={$structure$} props={slotContext} let:component let:props>
|
|
50
48
|
<svelte:fragment slot="slot" let:props><slot name="structure" {...props} /></svelte:fragment>
|
|
51
49
|
<svelte:component this={component} {...props}>
|
|
52
50
|
<svelte:fragment let:state let:widget><slot {state} {widget} /></svelte:fragment>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { ModalProps, ModalSlots, ModalApi } from './modal';
|
|
3
3
|
declare class __sveltets_Render<Data> {
|
|
4
4
|
props(): {
|
|
@@ -7,12 +7,12 @@ declare class __sveltets_Render<Data> {
|
|
|
7
7
|
events(): {} & {
|
|
8
8
|
[evt: string]: CustomEvent<any>;
|
|
9
9
|
};
|
|
10
|
-
slots(): ModalSlots
|
|
10
|
+
slots(): ModalSlots;
|
|
11
11
|
}
|
|
12
12
|
export type ModalProps_<Data> = ReturnType<__sveltets_Render<Data>['props']>;
|
|
13
13
|
export type ModalEvents<Data> = ReturnType<__sveltets_Render<Data>['events']>;
|
|
14
14
|
export type ModalSlots_<Data> = ReturnType<__sveltets_Render<Data>['slots']>;
|
|
15
|
-
export default class Modal<Data> extends
|
|
15
|
+
export default class Modal<Data> extends SvelteComponent<ModalProps_<Data>, ModalEvents<Data>, ModalSlots_<Data>> {
|
|
16
16
|
get api(): ModalApi<Data>;
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -4,12 +4,11 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
|
|
|
4
4
|
import { Slot } from "@agnos-ui/svelte-headless/slot";
|
|
5
5
|
export let state;
|
|
6
6
|
export let widget;
|
|
7
|
-
$:
|
|
8
|
-
slotContext = { widget, state };
|
|
7
|
+
$: slotContext = { widget, state };
|
|
9
8
|
</script>
|
|
10
9
|
|
|
11
10
|
<h5 class="modal-title">
|
|
12
|
-
<Slot slotContent={state.
|
|
11
|
+
<Slot slotContent={state.title} props={slotContext} let:component let:props>
|
|
13
12
|
<svelte:fragment slot="slot" let:props><slot name="title" {...props} /></svelte:fragment>
|
|
14
13
|
<svelte:component this={component} {...props}>
|
|
15
14
|
<svelte:fragment let:state let:widget><slot {state} {widget} /></svelte:fragment>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ModalSlots } from './modal';
|
|
3
3
|
declare class __sveltets_Render<Data> {
|
|
4
|
-
props():
|
|
4
|
+
props(): WidgetSlotContext<Widget<import("./modal.gen").ModalProps<Data_1>, import("./modal.gen").ModalState<Data_1>, import("./modal.gen").ModalApi<Data_1>, import("./modal.gen").ModalActions, import("./modal.gen").ModalDirectives>>;
|
|
5
5
|
events(): {} & {
|
|
6
6
|
[evt: string]: CustomEvent<any>;
|
|
7
7
|
};
|
|
8
|
-
slots(): ModalSlots
|
|
8
|
+
slots(): ModalSlots;
|
|
9
9
|
}
|
|
10
10
|
export type ModalDefaultHeaderProps<Data> = ReturnType<__sveltets_Render<Data>['props']>;
|
|
11
11
|
export type ModalDefaultHeaderEvents<Data> = ReturnType<__sveltets_Render<Data>['events']>;
|
|
12
12
|
export type ModalDefaultHeaderSlots<Data> = ReturnType<__sveltets_Render<Data>['slots']>;
|
|
13
|
-
export default class ModalDefaultHeader<Data> extends
|
|
13
|
+
export default class ModalDefaultHeader<Data> extends SvelteComponent<ModalDefaultHeaderProps<Data>, ModalDefaultHeaderEvents<Data>, ModalDefaultHeaderSlots<Data>> {
|
|
14
14
|
}
|
|
15
15
|
export {};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
<script>import { Slot } from "@agnos-ui/svelte-headless/slot";
|
|
2
2
|
export let state;
|
|
3
3
|
export let widget;
|
|
4
|
-
$:
|
|
5
|
-
slotContext = { widget, state };
|
|
4
|
+
$: slotContext = { widget, state };
|
|
6
5
|
</script>
|
|
7
6
|
|
|
8
|
-
{#if state.
|
|
7
|
+
{#if state.title}
|
|
9
8
|
<div class="modal-header">
|
|
10
|
-
<Slot slotContent={state.
|
|
9
|
+
<Slot slotContent={state.header} props={slotContext} let:component let:props>
|
|
11
10
|
<svelte:fragment slot="slot" let:props><slot name="header" {...props} /></svelte:fragment>
|
|
12
11
|
<svelte:component this={component} {...props}>
|
|
13
12
|
<svelte:fragment let:state let:widget><slot {state} {widget} /></svelte:fragment>
|
|
@@ -21,7 +20,7 @@ $:
|
|
|
21
20
|
{/if}
|
|
22
21
|
|
|
23
22
|
<div class="modal-body">
|
|
24
|
-
<Slot slotContent={state.
|
|
23
|
+
<Slot slotContent={state.children} props={slotContext} let:component let:props>
|
|
25
24
|
<svelte:fragment slot="slot" let:props><slot {...props} /></svelte:fragment>
|
|
26
25
|
<svelte:component this={component} {...props}>
|
|
27
26
|
<svelte:fragment let:state let:widget><slot {state} {widget} /></svelte:fragment>
|
|
@@ -32,9 +31,9 @@ $:
|
|
|
32
31
|
</svelte:component>
|
|
33
32
|
</Slot>
|
|
34
33
|
</div>
|
|
35
|
-
{#if state.
|
|
34
|
+
{#if state.footer}
|
|
36
35
|
<div class="modal-footer">
|
|
37
|
-
<Slot slotContent={state.
|
|
36
|
+
<Slot slotContent={state.footer} props={slotContext} let:component let:props>
|
|
38
37
|
<svelte:fragment slot="slot" let:props><slot name="footer" {...props} /></svelte:fragment>
|
|
39
38
|
<svelte:component this={component} {...props}>
|
|
40
39
|
<svelte:fragment let:state let:widget><slot {state} {widget} /></svelte:fragment>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ModalSlots } from './modal';
|
|
3
3
|
declare class __sveltets_Render<Data> {
|
|
4
|
-
props():
|
|
4
|
+
props(): WidgetSlotContext<Widget<import("./modal.gen").ModalProps<Data_1>, import("./modal.gen").ModalState<Data_1>, import("./modal.gen").ModalApi<Data_1>, import("./modal.gen").ModalActions, import("./modal.gen").ModalDirectives>>;
|
|
5
5
|
events(): {} & {
|
|
6
6
|
[evt: string]: CustomEvent<any>;
|
|
7
7
|
};
|
|
8
|
-
slots(): ModalSlots
|
|
8
|
+
slots(): ModalSlots;
|
|
9
9
|
}
|
|
10
10
|
export type ModalDefaultStructureProps<Data> = ReturnType<__sveltets_Render<Data>['props']>;
|
|
11
11
|
export type ModalDefaultStructureEvents<Data> = ReturnType<__sveltets_Render<Data>['events']>;
|
|
12
12
|
export type ModalDefaultStructureSlots<Data> = ReturnType<__sveltets_Render<Data>['slots']>;
|
|
13
|
-
export default class ModalDefaultStructure<Data> extends
|
|
13
|
+
export default class ModalDefaultStructure<Data> extends SvelteComponent<ModalDefaultStructureProps<Data>, ModalDefaultStructureEvents<Data>, ModalDefaultStructureSlots<Data>> {
|
|
14
14
|
}
|
|
15
15
|
export {};
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export interface ModalWidget<Data> extends AdaptWidgetSlots<CoreWidget<Data>> {
|
|
5
|
-
}
|
|
6
|
-
export interface ModalProps<Data> extends WidgetProps<ModalWidget<Data>> {
|
|
7
|
-
}
|
|
8
|
-
export interface ModalState<Data> extends WidgetState<ModalWidget<Data>> {
|
|
9
|
-
}
|
|
10
|
-
export interface ModalApi<Data> extends PropType<ModalWidget<Data>, 'api'> {
|
|
11
|
-
}
|
|
12
|
-
export interface ModalSlots<Data> extends WidgetPropsSlots<ModalProps<Data>> {
|
|
13
|
-
}
|
|
14
|
-
export interface ModalContext<Data> extends AdaptSlotContentProps<CoreContext<Data>> {
|
|
15
|
-
}
|
|
1
|
+
import type { WidgetPropsSlots, PropsConfig } from '@agnos-ui/svelte-headless/types';
|
|
2
|
+
import type { ModalProps, ModalWidget } from './modal.gen';
|
|
3
|
+
export type * from './modal.gen';
|
|
16
4
|
export declare const createModal: <Data>(propsConfig?: PropsConfig<ModalProps<Data>>) => ModalWidget<Data>;
|
|
5
|
+
export { modalCloseButtonClick, modalOutsideClick } from '@agnos-ui/core-bootstrap/components/modal';
|
|
6
|
+
export declare const getModalDefaultConfig: () => ModalProps<any>;
|
|
7
|
+
export interface ModalSlots extends WidgetPropsSlots<ModalProps<any>> {
|
|
8
|
+
}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import type { WidgetSlotContext, SlotContent, Widget, Directive } from '@agnos-ui/svelte-headless/types';
|
|
2
|
+
import type { TransitionFn } from '@agnos-ui/svelte-headless/services/transitions/baseTransitions';
|
|
3
|
+
export type ModalContext<Data> = WidgetSlotContext<ModalWidget<Data>>;
|
|
4
|
+
export interface ModalState<Data> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the backdrop is fully hidden. This can be true either because {@link ModalProps.backdropbackdrop} is false or
|
|
7
|
+
* because {@link ModalCommonPropsAndState.visiblevisible} is false and there is no current transition.
|
|
8
|
+
*/
|
|
9
|
+
backdropHidden: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the modal is fully hidden.
|
|
12
|
+
*/
|
|
13
|
+
hidden: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether there is an active transition to either display or hide the modal.
|
|
16
|
+
*/
|
|
17
|
+
transitioning: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* DOM element of the modal.
|
|
20
|
+
*/
|
|
21
|
+
modalElement: HTMLElement | null;
|
|
22
|
+
/**
|
|
23
|
+
* Value of the aria-label attribute to put on the close button.
|
|
24
|
+
*/
|
|
25
|
+
ariaCloseButtonLabel: string;
|
|
26
|
+
/**
|
|
27
|
+
* Classes to add on the backdrop DOM element.
|
|
28
|
+
*/
|
|
29
|
+
backdropClass: string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether to display the close button.
|
|
32
|
+
*/
|
|
33
|
+
closeButton: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Which element should contain the modal and backdrop DOM elements.
|
|
36
|
+
* If it is not null, the modal and backdrop DOM elements are moved to the specified container.
|
|
37
|
+
* Otherwise, they stay where the widget is located.
|
|
38
|
+
*/
|
|
39
|
+
container: HTMLElement | null;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the modal should be visible when the transition is completed.
|
|
42
|
+
*/
|
|
43
|
+
visible: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* CSS classes to be applied on the widget main container
|
|
46
|
+
*/
|
|
47
|
+
className: string;
|
|
48
|
+
/**
|
|
49
|
+
* Data to use in content slots
|
|
50
|
+
*/
|
|
51
|
+
contentData: Data;
|
|
52
|
+
/**
|
|
53
|
+
* Body of the modal.
|
|
54
|
+
*/
|
|
55
|
+
children: SlotContent<ModalContext<Data>>;
|
|
56
|
+
/**
|
|
57
|
+
* Footer of the modal.
|
|
58
|
+
*/
|
|
59
|
+
footer: SlotContent<ModalContext<Data>>;
|
|
60
|
+
/**
|
|
61
|
+
* Header of the modal. The default header includes {@link ModalCommonPropsAndState.title title}.
|
|
62
|
+
*/
|
|
63
|
+
header: SlotContent<ModalContext<Data>>;
|
|
64
|
+
/**
|
|
65
|
+
* Structure of the modal.
|
|
66
|
+
* The default structure uses {@link ModalCommonPropsAndState.header header}, {@link ModalCommonPropsAndState.children children} and {@link ModalCommonPropsAndState.footer footer}.
|
|
67
|
+
*/
|
|
68
|
+
structure: SlotContent<ModalContext<Data>>;
|
|
69
|
+
/**
|
|
70
|
+
* Title of the modal.
|
|
71
|
+
*/
|
|
72
|
+
title: SlotContent<ModalContext<Data>>;
|
|
73
|
+
/**
|
|
74
|
+
* Option to create a fullscreen modal, according to the bootstrap documentation.
|
|
75
|
+
*/
|
|
76
|
+
fullscreen: boolean;
|
|
77
|
+
}
|
|
78
|
+
export interface ModalProps<Data> {
|
|
79
|
+
/**
|
|
80
|
+
* Whether the modal and its backdrop (if present) should be animated when shown or hidden.
|
|
81
|
+
*/
|
|
82
|
+
animated: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Whether a backdrop should be created behind the modal.
|
|
85
|
+
*/
|
|
86
|
+
backdrop: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* The transition to use for the backdrop behind the modal (if present).
|
|
89
|
+
*/
|
|
90
|
+
backdropTransition: TransitionFn;
|
|
91
|
+
/**
|
|
92
|
+
* Whether the modal should be closed when clicking on the viewport outside the modal.
|
|
93
|
+
*/
|
|
94
|
+
closeOnOutsideClick: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* The transition to use for the modal.
|
|
97
|
+
*/
|
|
98
|
+
modalTransition: TransitionFn;
|
|
99
|
+
/**
|
|
100
|
+
* Event to be triggered when the modal is about to be closed (i.e. the {@link ModalApi.closeclose} method was called).
|
|
101
|
+
*/
|
|
102
|
+
onBeforeClose: (event: ModalBeforeCloseEvent) => void;
|
|
103
|
+
/**
|
|
104
|
+
* Event to be triggered when the visible property changes.
|
|
105
|
+
*/
|
|
106
|
+
onVisibleChange: (visible: boolean) => void;
|
|
107
|
+
/**
|
|
108
|
+
* Event to be triggered when the transition is completed and the modal is not visible.
|
|
109
|
+
*/
|
|
110
|
+
onHidden: () => void;
|
|
111
|
+
/**
|
|
112
|
+
* Event to be triggered when the transition is completed and the modal is visible.
|
|
113
|
+
*/
|
|
114
|
+
onShown: () => void;
|
|
115
|
+
/**
|
|
116
|
+
* Value of the aria-label attribute to put on the close button.
|
|
117
|
+
*/
|
|
118
|
+
ariaCloseButtonLabel: string;
|
|
119
|
+
/**
|
|
120
|
+
* Classes to add on the backdrop DOM element.
|
|
121
|
+
*/
|
|
122
|
+
backdropClass: string;
|
|
123
|
+
/**
|
|
124
|
+
* Whether to display the close button.
|
|
125
|
+
*/
|
|
126
|
+
closeButton: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Which element should contain the modal and backdrop DOM elements.
|
|
129
|
+
* If it is not null, the modal and backdrop DOM elements are moved to the specified container.
|
|
130
|
+
* Otherwise, they stay where the widget is located.
|
|
131
|
+
*/
|
|
132
|
+
container: HTMLElement | null;
|
|
133
|
+
/**
|
|
134
|
+
* Whether the modal should be visible when the transition is completed.
|
|
135
|
+
*/
|
|
136
|
+
visible: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* CSS classes to be applied on the widget main container
|
|
139
|
+
*/
|
|
140
|
+
className: string;
|
|
141
|
+
/**
|
|
142
|
+
* Data to use in content slots
|
|
143
|
+
*/
|
|
144
|
+
contentData: Data;
|
|
145
|
+
/**
|
|
146
|
+
* Body of the modal.
|
|
147
|
+
*/
|
|
148
|
+
children: SlotContent<ModalContext<Data>>;
|
|
149
|
+
/**
|
|
150
|
+
* Footer of the modal.
|
|
151
|
+
*/
|
|
152
|
+
footer: SlotContent<ModalContext<Data>>;
|
|
153
|
+
/**
|
|
154
|
+
* Header of the modal. The default header includes {@link ModalCommonPropsAndState.title title}.
|
|
155
|
+
*/
|
|
156
|
+
header: SlotContent<ModalContext<Data>>;
|
|
157
|
+
/**
|
|
158
|
+
* Structure of the modal.
|
|
159
|
+
* The default structure uses {@link ModalCommonPropsAndState.header header}, {@link ModalCommonPropsAndState.children children} and {@link ModalCommonPropsAndState.footer footer}.
|
|
160
|
+
*/
|
|
161
|
+
structure: SlotContent<ModalContext<Data>>;
|
|
162
|
+
/**
|
|
163
|
+
* Title of the modal.
|
|
164
|
+
*/
|
|
165
|
+
title: SlotContent<ModalContext<Data>>;
|
|
166
|
+
/**
|
|
167
|
+
* Option to create a fullscreen modal, according to the bootstrap documentation.
|
|
168
|
+
*/
|
|
169
|
+
fullscreen: boolean;
|
|
170
|
+
}
|
|
171
|
+
export interface ModalApi<Data> {
|
|
172
|
+
/**
|
|
173
|
+
* Method to change some modal properties.
|
|
174
|
+
*/
|
|
175
|
+
patch: ModalWidget<Data>['patch'];
|
|
176
|
+
/**
|
|
177
|
+
* Closes the modal with the given result.
|
|
178
|
+
*/
|
|
179
|
+
close(result?: any): void;
|
|
180
|
+
/**
|
|
181
|
+
* Opens the modal and returns a promise that is resolved when the modal is closed.
|
|
182
|
+
* The resolved value is the result passed to the {@link ModalApi.closeclose} method and possibly changed by the
|
|
183
|
+
* {@link ModalProps.onBeforeCloseonBeforeClose} event handler
|
|
184
|
+
*/
|
|
185
|
+
open(): Promise<any>;
|
|
186
|
+
}
|
|
187
|
+
export type ModalWidget<Data> = Widget<ModalProps<Data>, ModalState<Data>, ModalApi<Data>, ModalActions, ModalDirectives>;
|
|
188
|
+
export interface ModalBeforeCloseEvent {
|
|
189
|
+
/**
|
|
190
|
+
* Result of the modal, which is the value passed to the {@link ModalApi.closeclose} method
|
|
191
|
+
* and later resolved by the promise returned by the {@link ModalApi.openopen} method.
|
|
192
|
+
* If needed, it can be changed from the {@link ModalProps.onBeforeCloseonBeforeClose} event handler.
|
|
193
|
+
*/
|
|
194
|
+
result: any;
|
|
195
|
+
/**
|
|
196
|
+
* Whether to cancel the close of the modal.
|
|
197
|
+
* It can be changed from the {@link ModalProps.onBeforeCloseonBeforeClose} event handler.
|
|
198
|
+
*/
|
|
199
|
+
cancel: boolean;
|
|
200
|
+
}
|
|
201
|
+
export interface ModalActions {
|
|
202
|
+
/**
|
|
203
|
+
* Action to be called when the user clicks on the close button. It closes the modal with the {@link modalCloseButtonClick} result.
|
|
204
|
+
*/
|
|
205
|
+
closeButtonClick(event: Pick<MouseEvent, never>): void;
|
|
206
|
+
/**
|
|
207
|
+
* Action to be called when the user clicks on the modal DOM element (which is supposed to have the size of the full viewport).
|
|
208
|
+
* If the click is not done on a descendant of the modal DOM element, it is considered to be done outside the modal
|
|
209
|
+
* and, depending on the value of the {@link ModalProps.closeOnOutsideClickcloseOnOutsideClick} prop, the modal is or isn't closed
|
|
210
|
+
* (with the {@link modalOutsideClick} result).
|
|
211
|
+
*/
|
|
212
|
+
modalClick(event: Pick<MouseEvent, 'target' | 'currentTarget'>): void;
|
|
213
|
+
}
|
|
214
|
+
export interface ModalDirectives {
|
|
215
|
+
/**
|
|
216
|
+
* Directive to put on the modal DOM element.
|
|
217
|
+
*/
|
|
218
|
+
modalDirective: Directive;
|
|
219
|
+
/**
|
|
220
|
+
* Directive to put on the backdrop DOM element.
|
|
221
|
+
*/
|
|
222
|
+
backdropDirective: Directive;
|
|
223
|
+
/**
|
|
224
|
+
* Portal directive to put on the modal DOM element.
|
|
225
|
+
*/
|
|
226
|
+
modalPortalDirective: Directive;
|
|
227
|
+
/**
|
|
228
|
+
* Portal directive to put on the backdrop DOM element.
|
|
229
|
+
*/
|
|
230
|
+
backdropPortalDirective: Directive;
|
|
231
|
+
/**
|
|
232
|
+
* Directive that adds all the necessary attributes to the close button
|
|
233
|
+
*/
|
|
234
|
+
closeButtonDirective: Directive;
|
|
235
|
+
/**
|
|
236
|
+
* Directive to apply to the dialog element when using the native [HTMLDialogElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement)
|
|
237
|
+
*/
|
|
238
|
+
dialogDirective: Directive;
|
|
239
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { createModal as coreCreateModal } from '@agnos-ui/core-bootstrap/components/modal';
|
|
3
|
-
// factory
|
|
1
|
+
import { createModal as coreCreateModal, getModalDefaultConfig as coreGetModalDefaultConfig } from '@agnos-ui/core-bootstrap/components/modal';
|
|
4
2
|
export const createModal = coreCreateModal;
|
|
3
|
+
export { modalCloseButtonClick, modalOutsideClick } from '@agnos-ui/core-bootstrap/components/modal';
|
|
4
|
+
export const getModalDefaultConfig = coreGetModalDefaultConfig;
|