@agnos-ui/svelte-bootstrap 0.4.3 → 0.5.0-next.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.
- package/README.md +2 -2
- package/components/accordion/Accordion.svelte +20 -18
- package/components/accordion/Accordion.svelte.d.ts +8 -23
- package/components/accordion/Item.svelte +40 -44
- package/components/accordion/Item.svelte.d.ts +5 -20
- package/components/accordion/ItemDefaultStructure.svelte +17 -27
- package/components/accordion/ItemDefaultStructure.svelte.d.ts +3 -17
- package/components/accordion/accordion.d.ts +11 -6
- package/components/accordion/accordion.gen.d.ts +37 -9
- package/components/accordion/accordion.js +10 -0
- package/components/alert/Alert.svelte +36 -40
- package/components/alert/Alert.svelte.d.ts +5 -21
- package/components/alert/AlertDefaultStructure.svelte +8 -12
- package/components/alert/AlertDefaultStructure.svelte.d.ts +3 -17
- package/components/alert/alert.gen.d.ts +21 -2
- package/components/alert/index.d.ts +1 -1
- package/components/alert/index.js +1 -1
- package/components/collapse/Collapse.svelte +33 -0
- package/components/collapse/Collapse.svelte.d.ts +8 -0
- package/components/collapse/collapse.gen.d.ts +146 -0
- package/components/collapse/collapse.gen.js +14 -0
- package/components/collapse/index.d.ts +3 -0
- package/components/collapse/index.js +3 -0
- package/components/modal/Modal.svelte +45 -47
- package/components/modal/Modal.svelte.d.ts +16 -14
- package/components/modal/ModalDefaultHeader.svelte +10 -17
- package/components/modal/ModalDefaultHeader.svelte.d.ts +15 -12
- package/components/modal/ModalDefaultStructure.svelte +10 -36
- package/components/modal/ModalDefaultStructure.svelte.d.ts +15 -12
- package/components/modal/index.d.ts +1 -1
- package/components/modal/index.js +1 -1
- package/components/modal/modal.gen.d.ts +35 -18
- package/components/modal/modalService.d.ts +19 -1
- package/components/modal/modalService.js +21 -2
- package/components/pagination/Pagination.svelte +39 -47
- package/components/pagination/Pagination.svelte.d.ts +3 -21
- package/components/pagination/PaginationDefaultPages.svelte +13 -43
- package/components/pagination/PaginationDefaultPages.svelte.d.ts +3 -17
- package/components/pagination/PaginationDefaultStructure.svelte +18 -89
- package/components/pagination/PaginationDefaultStructure.svelte.d.ts +3 -17
- package/components/pagination/index.d.ts +1 -1
- package/components/pagination/index.js +1 -1
- package/components/pagination/pagination.gen.d.ts +49 -29
- package/components/progressbar/Progressbar.svelte +28 -31
- package/components/progressbar/Progressbar.svelte.d.ts +3 -21
- package/components/progressbar/ProgressbarDefaultStructure.svelte +6 -11
- package/components/progressbar/ProgressbarDefaultStructure.svelte.d.ts +3 -17
- package/components/progressbar/index.d.ts +1 -1
- package/components/progressbar/index.js +1 -1
- package/components/progressbar/progressbar.gen.d.ts +21 -4
- package/components/rating/Rating.svelte +33 -27
- package/components/rating/Rating.svelte.d.ts +3 -18
- package/components/rating/index.d.ts +1 -1
- package/components/rating/index.js +1 -1
- package/components/rating/rating.gen.d.ts +25 -17
- package/components/select/Select.svelte +57 -81
- package/components/select/Select.svelte.d.ts +16 -14
- package/components/select/index.d.ts +1 -1
- package/components/select/index.js +1 -1
- package/components/select/select.gen.d.ts +41 -25
- package/components/slider/Slider.svelte +39 -40
- package/components/slider/Slider.svelte.d.ts +3 -21
- package/components/slider/SliderDefaultHandle.svelte +7 -4
- package/components/slider/SliderDefaultHandle.svelte.d.ts +3 -17
- package/components/slider/SliderDefaultStructure.svelte +21 -75
- package/components/slider/SliderDefaultStructure.svelte.d.ts +3 -17
- package/components/slider/index.d.ts +1 -1
- package/components/slider/index.js +1 -1
- package/components/slider/slider.gen.d.ts +54 -33
- package/components/toast/Toast.svelte +43 -40
- package/components/toast/Toast.svelte.d.ts +5 -21
- package/components/toast/ToastDefaultStructure.svelte +13 -23
- package/components/toast/ToastDefaultStructure.svelte.d.ts +3 -17
- package/components/toast/index.d.ts +1 -1
- package/components/toast/index.js +1 -1
- package/components/toast/toast.gen.d.ts +22 -2
- package/config.d.ts +1 -12
- package/config.gen.d.ts +5 -0
- package/generated/index.d.ts +1 -1
- package/generated/index.js +1 -1
- package/generated/utils/widget.svelte.d.ts +1 -0
- package/generated/utils/widget.svelte.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +8 -7
- package/components/alert/alert.d.ts +0 -5
- package/components/alert/alert.js +0 -1
- package/components/modal/modal.d.ts +0 -5
- package/components/modal/modal.js +0 -1
- package/components/pagination/pagination.d.ts +0 -5
- package/components/pagination/pagination.js +0 -1
- package/components/progressbar/progressbar.d.ts +0 -5
- package/components/progressbar/progressbar.js +0 -1
- package/components/rating/rating.d.ts +0 -5
- package/components/rating/rating.js +0 -1
- package/components/select/select.d.ts +0 -5
- package/components/select/select.js +0 -1
- package/components/slider/slider.d.ts +0 -5
- package/components/slider/slider.js +0 -1
- package/components/toast/toast.d.ts +0 -5
- package/components/toast/toast.js +0 -1
- package/generated/utils/widget.d.ts +0 -1
- package/generated/utils/widget.js +0 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@agnos-ui/svelte-bootstrap)
|
|
4
4
|
|
|
5
|
-
[Bootstrap](https://getbootstrap.com/)-based
|
|
5
|
+
[Bootstrap](https://getbootstrap.com/)-based component library for [Svelte](https://svelte.dev/).
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -12,4 +12,4 @@ npm install @agnos-ui/svelte-bootstrap
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
-
Please check [our demo site](https://
|
|
15
|
+
Please check [our demo site](https://www.agnosui.dev/latest/) to see all the available components and how to use them.
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script lang="ts">
|
|
2
2
|
import {ssrAttributes as __AgnosUISveltePreprocess__ssrAttributes, classDirective as __AgnosUISveltePreprocess__classDirective} from '@agnos-ui/svelte-headless/utils/directive';
|
|
3
3
|
import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
|
|
5
|
+
import type {AccordionApi, AccordionProps} from './accordion';
|
|
6
|
+
import type {Snippet} from 'svelte';
|
|
7
|
+
import {callWidgetFactory} from '../../config';
|
|
8
|
+
import {createAccordion, setAccordionApi} from './accordion';
|
|
9
|
+
|
|
10
|
+
let {children, ...props}: Partial<AccordionProps> & {children: Snippet} = $props();
|
|
11
|
+
|
|
12
|
+
const {directives, api: accordionApi} = callWidgetFactory({
|
|
13
|
+
factory: createAccordion,
|
|
14
|
+
widgetName: 'accordion',
|
|
15
|
+
props,
|
|
16
|
+
enablePatchChanged: true,
|
|
17
|
+
});
|
|
18
|
+
export const api: AccordionApi = accordionApi;
|
|
19
|
+
|
|
20
|
+
setAccordionApi(accordionApi);
|
|
19
21
|
</script>
|
|
20
22
|
|
|
21
|
-
<div use:__AgnosUISveltePreprocess__classDirective={"accordion"} use:accordionDirective {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(accordionDirective, [__AgnosUISveltePreprocess__classDirective, "accordion"])}>
|
|
22
|
-
|
|
23
|
+
<div use:__AgnosUISveltePreprocess__classDirective={"accordion"} use:directives.accordionDirective {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(directives.accordionDirective, [__AgnosUISveltePreprocess__classDirective, "accordion"])}>
|
|
24
|
+
{@render children()}
|
|
23
25
|
</div>
|
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
slots: {
|
|
11
|
-
default: Record<string, never>;
|
|
12
|
-
} & AccordionSlots;
|
|
13
|
-
exports?: {} | undefined;
|
|
14
|
-
bindings?: string | undefined;
|
|
15
|
-
};
|
|
16
|
-
type AccordionProps_ = typeof __propDef.props;
|
|
17
|
-
export { AccordionProps_ as AccordionProps };
|
|
18
|
-
export type AccordionEvents = typeof __propDef.events;
|
|
19
|
-
type AccordionSlots_ = typeof __propDef.slots;
|
|
20
|
-
export { AccordionSlots_ as AccordionSlots };
|
|
21
|
-
export default class Accordion extends SvelteComponent<AccordionProps_, AccordionEvents, AccordionSlots_> {
|
|
22
|
-
get api(): AccordionApi;
|
|
23
|
-
}
|
|
1
|
+
import type { AccordionApi, AccordionProps } from './accordion';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
declare const Accordion: import("svelte").Component<Partial<AccordionProps> & {
|
|
4
|
+
children: Snippet;
|
|
5
|
+
}, {
|
|
6
|
+
api: AccordionApi;
|
|
7
|
+
}, "">;
|
|
8
|
+
export default Accordion;
|
|
@@ -1,51 +1,47 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script lang="ts">
|
|
2
2
|
import {ssrAttributes as __AgnosUISveltePreprocess__ssrAttributes, classDirective as __AgnosUISveltePreprocess__classDirective} from '@agnos-ui/svelte-headless/utils/directive';
|
|
3
3
|
import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
|
|
4
|
-
import { toSlotContextWidget } from "@agnos-ui/svelte-headless/types";
|
|
5
|
-
import { Slot } from "@agnos-ui/svelte-headless/slot";
|
|
6
|
-
import { callWidgetFactory } from "../../config";
|
|
7
|
-
import { onMount } from "svelte";
|
|
8
|
-
import ItemDefaultStructure from "./ItemDefaultStructure.svelte";
|
|
9
|
-
import { getAccordionApi } from "./accordion";
|
|
10
|
-
const defaultConfig = {
|
|
11
|
-
structure: ItemDefaultStructure
|
|
12
|
-
};
|
|
13
|
-
</script>
|
|
14
4
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
5
|
+
import type {AccordionItemApi, AccordionItemContext, AccordionItemProps, AccordionItemWidget} from './accordion';
|
|
6
|
+
import type {WidgetFactory} from '@agnos-ui/svelte-headless/types';
|
|
7
|
+
import {Slot} from '@agnos-ui/svelte-headless/slot';
|
|
8
|
+
import {callWidgetFactory} from '../../config';
|
|
9
|
+
import {onMount} from 'svelte';
|
|
10
|
+
import ItemDefaultStructure from './ItemDefaultStructure.svelte';
|
|
11
|
+
import {getAccordionApi} from './accordion';
|
|
12
|
+
|
|
13
|
+
const accordionApi = getAccordionApi();
|
|
14
|
+
const {registerItem} = accordionApi;
|
|
15
|
+
|
|
16
|
+
let {visible = $bindable(), ...props}: Partial<AccordionItemProps> = $props();
|
|
17
|
+
const widget = callWidgetFactory({
|
|
18
|
+
factory: registerItem as WidgetFactory<AccordionItemWidget>,
|
|
19
|
+
get props() {
|
|
20
|
+
return {...props, visible};
|
|
21
|
+
},
|
|
22
|
+
enablePatchChanged: true,
|
|
23
|
+
defaultConfig: {structure},
|
|
24
|
+
events: {
|
|
25
|
+
onVisibleChange: (event) => {
|
|
26
|
+
visible = event;
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const {
|
|
31
|
+
state,
|
|
32
|
+
directives: {itemDirective},
|
|
33
|
+
} = widget;
|
|
34
|
+
export const api: AccordionItemApi = widget.api;
|
|
35
|
+
|
|
36
|
+
onMount(() => {
|
|
37
|
+
widget.api.initDone();
|
|
38
|
+
});
|
|
40
39
|
</script>
|
|
41
40
|
|
|
41
|
+
{#snippet structure(props: AccordionItemContext)}
|
|
42
|
+
<ItemDefaultStructure {...props} />
|
|
43
|
+
{/snippet}
|
|
44
|
+
|
|
42
45
|
<div use:__AgnosUISveltePreprocess__classDirective={"accordion-item"} use:itemDirective {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(itemDirective, [__AgnosUISveltePreprocess__classDirective, "accordion-item"])}>
|
|
43
|
-
<Slot
|
|
44
|
-
<svelte:fragment slot="slot" let:props><slot name="structure" {...props} /></svelte:fragment>
|
|
45
|
-
<svelte:component this={component} {...props}>
|
|
46
|
-
<svelte:fragment let:state let:widget><slot {state} {widget} /></svelte:fragment>
|
|
47
|
-
<svelte:fragment slot="header" let:state let:widget><slot name="header" {state} {widget} /></svelte:fragment>
|
|
48
|
-
<svelte:fragment slot="structure" let:state let:widget><slot name="structure" {state} {widget} /></svelte:fragment>
|
|
49
|
-
</svelte:component>
|
|
50
|
-
</Slot>
|
|
46
|
+
<Slot content={state.structure} props={widget} />
|
|
51
47
|
</div>
|
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} & Partial<AccordionItemProps>;
|
|
7
|
-
events: {
|
|
8
|
-
[evt: string]: CustomEvent<any>;
|
|
9
|
-
};
|
|
10
|
-
slots: AccordionItemSlots;
|
|
11
|
-
exports?: {} | undefined;
|
|
12
|
-
bindings?: string | undefined;
|
|
13
|
-
};
|
|
14
|
-
export type ItemProps = typeof __propDef.props;
|
|
15
|
-
export type ItemEvents = typeof __propDef.events;
|
|
16
|
-
export type ItemSlots = typeof __propDef.slots;
|
|
17
|
-
export default class Item extends SvelteComponent<ItemProps, ItemEvents, ItemSlots> {
|
|
18
|
-
get api(): AccordionItemApi;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
1
|
+
import type { AccordionItemApi, AccordionItemProps } from './accordion';
|
|
2
|
+
declare const Item: import("svelte").Component<Partial<AccordionItemProps>, {
|
|
3
|
+
api: AccordionItemApi;
|
|
4
|
+
}, "visible">;
|
|
5
|
+
export default Item;
|
|
@@ -1,37 +1,27 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script lang="ts">
|
|
2
2
|
import {ssrAttributes as __AgnosUISveltePreprocess__ssrAttributes, classDirective as __AgnosUISveltePreprocess__classDirective} from '@agnos-ui/svelte-headless/utils/directive';
|
|
3
3
|
import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
|
|
5
|
+
import type {AccordionItemContext} from './accordion';
|
|
6
|
+
import {Slot} from '@agnos-ui/svelte-headless/slot';
|
|
7
|
+
|
|
8
|
+
let widget: AccordionItemContext = $props();
|
|
9
|
+
const {state, directives} = widget;
|
|
10
|
+
|
|
11
|
+
const re = new RegExp('^h[1-6]$');
|
|
12
|
+
|
|
13
|
+
let headingTag = $derived(re.test(state.headingTag) ? state.headingTag : 'h2');
|
|
10
14
|
</script>
|
|
11
15
|
|
|
12
|
-
<svelte:element this={headingTag} use:__AgnosUISveltePreprocess__classDirective={"accordion-header"} use:
|
|
13
|
-
<button use:
|
|
14
|
-
<Slot
|
|
15
|
-
<svelte:fragment slot="slot" let:props><slot name="header" {...props} /></svelte:fragment>
|
|
16
|
-
<svelte:component this={component} {...props}>
|
|
17
|
-
<svelte:fragment let:state let:widget><slot {state} {widget} /></svelte:fragment>
|
|
18
|
-
<svelte:fragment slot="header" let:state let:widget><slot name="header" {state} {widget} /></svelte:fragment>
|
|
19
|
-
<svelte:fragment slot="structure" let:state let:widget><slot name="structure" {state} {widget} /></svelte:fragment>
|
|
20
|
-
</svelte:component>
|
|
21
|
-
</Slot>
|
|
16
|
+
<svelte:element this={headingTag} use:__AgnosUISveltePreprocess__classDirective={"accordion-header"} use:directives.headerDirective {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(directives.headerDirective, [__AgnosUISveltePreprocess__classDirective, "accordion-header"])}>
|
|
17
|
+
<button use:directives.buttonDirective use:__AgnosUISveltePreprocess__classDirective={"accordion-button"} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(directives.buttonDirective, [__AgnosUISveltePreprocess__classDirective, "accordion-button"])}>
|
|
18
|
+
<Slot content={state.header} props={widget} />
|
|
22
19
|
</button>
|
|
23
20
|
</svelte:element>
|
|
24
21
|
{#if state.shouldBeInDOM}
|
|
25
|
-
<div use:__AgnosUISveltePreprocess__classDirective={"accordion-collapse"} use:
|
|
26
|
-
<div use:__AgnosUISveltePreprocess__classDirective={"accordion-body"} use:
|
|
27
|
-
<Slot
|
|
28
|
-
<svelte:fragment slot="slot" let:props><slot {...props} /></svelte:fragment>
|
|
29
|
-
<svelte:component this={component} {...props}>
|
|
30
|
-
<svelte:fragment let:state let:widget><slot {state} {widget} /></svelte:fragment>
|
|
31
|
-
<svelte:fragment slot="header" let:state let:widget><slot name="header" {state} {widget} /></svelte:fragment>
|
|
32
|
-
<svelte:fragment slot="structure" let:state let:widget><slot name="structure" {state} {widget} /></svelte:fragment>
|
|
33
|
-
</svelte:component>
|
|
34
|
-
</Slot>
|
|
22
|
+
<div use:__AgnosUISveltePreprocess__classDirective={"accordion-collapse"} use:directives.bodyContainerDirective {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(directives.bodyContainerDirective, [__AgnosUISveltePreprocess__classDirective, "accordion-collapse"])}>
|
|
23
|
+
<div use:__AgnosUISveltePreprocess__classDirective={"accordion-body"} use:directives.bodyDirective {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(directives.bodyDirective, [__AgnosUISveltePreprocess__classDirective, "accordion-body"])}>
|
|
24
|
+
<Slot content={state.children} props={widget} />
|
|
35
25
|
</div>
|
|
36
26
|
</div>
|
|
37
27
|
{/if}
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
props: WidgetSlotContext<Widget<import("./accordion.gen").AccordionItemProps, import("./accordion.gen").AccordionItemState, import("./accordion.gen").AccordionItemApi, import("./accordion.gen").AccordionItemActions, import("./accordion.gen").AccordionItemDirectives>>;
|
|
5
|
-
events: {
|
|
6
|
-
[evt: string]: CustomEvent<any>;
|
|
7
|
-
};
|
|
8
|
-
slots: AccordionItemSlots;
|
|
9
|
-
exports?: {} | undefined;
|
|
10
|
-
bindings?: string | undefined;
|
|
11
|
-
};
|
|
12
|
-
export type ItemDefaultStructureProps = typeof __propDef.props;
|
|
13
|
-
export type ItemDefaultStructureEvents = typeof __propDef.events;
|
|
14
|
-
export type ItemDefaultStructureSlots = typeof __propDef.slots;
|
|
15
|
-
export default class ItemDefaultStructure extends SvelteComponent<ItemDefaultStructureProps, ItemDefaultStructureEvents, ItemDefaultStructureSlots> {
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
1
|
+
import type { AccordionItemContext } from './accordion';
|
|
2
|
+
declare const ItemDefaultStructure: import("svelte").Component<AccordionItemContext, {}, "">;
|
|
3
|
+
export default ItemDefaultStructure;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { AccordionApi, AccordionItemProps, AccordionProps } from './accordion.gen';
|
|
1
|
+
import type { AccordionApi } from './accordion.gen';
|
|
3
2
|
export * from './accordion.gen';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Sets the Accordion API in the context.
|
|
5
|
+
*
|
|
6
|
+
* @param accordionApi - The Accordion API to be set in the context.
|
|
7
|
+
*/
|
|
8
8
|
export declare function setAccordionApi(accordionApi: AccordionApi): void;
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves the Accordion API from the Svelte context.
|
|
11
|
+
*
|
|
12
|
+
* @returns {AccordionApi} The Accordion API instance.
|
|
13
|
+
*/
|
|
9
14
|
export declare function getAccordionApi(): AccordionApi;
|
|
@@ -6,7 +6,14 @@ import type { TransitionFn } from '@agnos-ui/svelte-headless/services/transition
|
|
|
6
6
|
*/
|
|
7
7
|
declare const export_getAccordionDefaultConfig: () => AccordionProps;
|
|
8
8
|
export { export_getAccordionDefaultConfig as getAccordionDefaultConfig };
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Represents the context for an accordion item within the accordion component.
|
|
11
|
+
*/
|
|
12
|
+
export interface AccordionItemContext extends WidgetSlotContext<AccordionItemWidget> {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Represents the state of an Accordion component.
|
|
16
|
+
*/
|
|
10
17
|
export interface AccordionState {
|
|
11
18
|
/**
|
|
12
19
|
* Array containing all the accordion-items contained in the accordion.
|
|
@@ -28,6 +35,9 @@ export interface AccordionState {
|
|
|
28
35
|
*/
|
|
29
36
|
itemStructure: SlotContent<AccordionItemContext>;
|
|
30
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Represents the state of an AccordionItem component.
|
|
40
|
+
*/
|
|
31
41
|
export interface AccordionProps {
|
|
32
42
|
/**
|
|
33
43
|
* The transition to use for the accordion-item body-container when the accordion-item is toggled.
|
|
@@ -131,7 +141,13 @@ export interface AccordionProps {
|
|
|
131
141
|
*/
|
|
132
142
|
itemStructure: SlotContent<AccordionItemContext>;
|
|
133
143
|
}
|
|
134
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Represents an Accordion widget type.
|
|
146
|
+
*/
|
|
147
|
+
export type AccordionWidget = Widget<AccordionProps, AccordionState, AccordionApi, AccordionDirectives>;
|
|
148
|
+
/**
|
|
149
|
+
* Represents the state of an accordion item, extending the core item state and additional properties specific to the accordion item.
|
|
150
|
+
*/
|
|
135
151
|
export interface AccordionItemState {
|
|
136
152
|
/**
|
|
137
153
|
* If `true` the content of the accordion-item collapse should be in DOM. Its value depends on the
|
|
@@ -200,6 +216,9 @@ export interface AccordionItemState {
|
|
|
200
216
|
*/
|
|
201
217
|
header: SlotContent<AccordionItemContext>;
|
|
202
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Represents the properties for an Accordion item component.
|
|
221
|
+
*/
|
|
203
222
|
export interface AccordionItemProps {
|
|
204
223
|
/**
|
|
205
224
|
* If `true`, accordion-item will be animated.
|
|
@@ -289,7 +308,10 @@ export interface AccordionItemProps {
|
|
|
289
308
|
*/
|
|
290
309
|
header: SlotContent<AccordionItemContext>;
|
|
291
310
|
}
|
|
292
|
-
|
|
311
|
+
/**
|
|
312
|
+
* Represents a widget for an accordion item.
|
|
313
|
+
*/
|
|
314
|
+
export type AccordionItemWidget = Widget<AccordionItemProps, AccordionItemState, AccordionItemApi, AccordionItemDirectives>;
|
|
293
315
|
/**
|
|
294
316
|
* Create an AccordionItemWidget with given config props
|
|
295
317
|
* @param config - an optional AccordionItem config
|
|
@@ -315,6 +337,9 @@ export { export_createAccordion as createAccordion };
|
|
|
315
337
|
*/
|
|
316
338
|
declare const export_factoryCreateAccordion: (itemFactory?: WidgetFactory<AccordionItemWidget>, accordionItemProps?: string[], accordionConfig?: AccordionProps, accordionValidator?: ConfigValidator<AccordionProps>) => WidgetFactory<AccordionWidget>;
|
|
317
339
|
export { export_factoryCreateAccordion as factoryCreateAccordion };
|
|
340
|
+
/**
|
|
341
|
+
* Interface representing the API for an accordion component.
|
|
342
|
+
*/
|
|
318
343
|
export interface AccordionApi {
|
|
319
344
|
/**
|
|
320
345
|
* Given the itemId, will expand the corresponding accordion-item.
|
|
@@ -349,18 +374,18 @@ export interface AccordionApi {
|
|
|
349
374
|
*/
|
|
350
375
|
registerItem(itemConfig?: PropsConfig<AccordionItemProps>): AccordionItemWidget;
|
|
351
376
|
}
|
|
377
|
+
/**
|
|
378
|
+
* Interface representing the directives used in the Accordion component.
|
|
379
|
+
*/
|
|
352
380
|
export interface AccordionDirectives {
|
|
353
381
|
/**
|
|
354
382
|
* Directive to put on the accordion DOM element
|
|
355
383
|
*/
|
|
356
384
|
accordionDirective: Directive;
|
|
357
385
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
*/
|
|
362
|
-
click(): void;
|
|
363
|
-
}
|
|
386
|
+
/**
|
|
387
|
+
* Interface representing the API for an accordion item.
|
|
388
|
+
*/
|
|
364
389
|
export interface AccordionItemApi {
|
|
365
390
|
/**
|
|
366
391
|
* It will collapse the accordion-item.
|
|
@@ -379,6 +404,9 @@ export interface AccordionItemApi {
|
|
|
379
404
|
*/
|
|
380
405
|
initDone(): void;
|
|
381
406
|
}
|
|
407
|
+
/**
|
|
408
|
+
* Interface representing the directives used in an accordion item.
|
|
409
|
+
*/
|
|
382
410
|
export interface AccordionItemDirectives {
|
|
383
411
|
/**
|
|
384
412
|
* Directive to use in special cases, if the accordion header does not use a button element to control the collapsing.
|
|
@@ -2,9 +2,19 @@ export * from './accordion.gen';
|
|
|
2
2
|
// context
|
|
3
3
|
import { getContext, setContext } from 'svelte';
|
|
4
4
|
const contextInjectionKey = Symbol('accordion-api');
|
|
5
|
+
/**
|
|
6
|
+
* Sets the Accordion API in the context.
|
|
7
|
+
*
|
|
8
|
+
* @param accordionApi - The Accordion API to be set in the context.
|
|
9
|
+
*/
|
|
5
10
|
export function setAccordionApi(accordionApi) {
|
|
6
11
|
setContext(contextInjectionKey, accordionApi);
|
|
7
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves the Accordion API from the Svelte context.
|
|
15
|
+
*
|
|
16
|
+
* @returns {AccordionApi} The Accordion API instance.
|
|
17
|
+
*/
|
|
8
18
|
export function getAccordionApi() {
|
|
9
19
|
return getContext(contextInjectionKey);
|
|
10
20
|
}
|
|
@@ -1,50 +1,46 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script lang="ts">
|
|
2
2
|
import {ssrAttributes as __AgnosUISveltePreprocess__ssrAttributes, classDirective as __AgnosUISveltePreprocess__classDirective} from '@agnos-ui/svelte-headless/utils/directive';
|
|
3
3
|
import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
|
|
4
|
-
import { Slot } from "@agnos-ui/svelte-headless/slot";
|
|
5
|
-
import { createAlert } from "./alert";
|
|
6
|
-
import { callWidgetFactory } from "../../config";
|
|
7
|
-
import AlertDefaultStructure from "./AlertDefaultStructure.svelte";
|
|
8
|
-
const defaultConfig = {
|
|
9
|
-
structure: AlertDefaultStructure
|
|
10
|
-
};
|
|
11
|
-
</script>
|
|
12
4
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
5
|
+
import {Slot} from '@agnos-ui/svelte-headless/slot';
|
|
6
|
+
import {type AlertContext, createAlert, type AlertApi, type AlertProps} from './alert.gen';
|
|
7
|
+
import {callWidgetFactory} from '../../config';
|
|
8
|
+
import AlertDefaultStructure from './AlertDefaultStructure.svelte';
|
|
9
|
+
|
|
10
|
+
let {visible = $bindable(), ...props}: Partial<AlertProps> = $props();
|
|
11
|
+
|
|
12
|
+
const widget = callWidgetFactory({
|
|
13
|
+
factory: createAlert,
|
|
14
|
+
widgetName: 'alert',
|
|
15
|
+
get props() {
|
|
16
|
+
return {...props, visible};
|
|
17
|
+
},
|
|
18
|
+
enablePatchChanged: true,
|
|
19
|
+
defaultConfig: {structure},
|
|
20
|
+
events: {
|
|
21
|
+
onVisibleChange: (event) => {
|
|
22
|
+
visible = event;
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
export const api: AlertApi = widget.api;
|
|
27
|
+
|
|
28
|
+
const {
|
|
29
|
+
state,
|
|
30
|
+
directives: {transitionDirective},
|
|
31
|
+
} = widget;
|
|
34
32
|
</script>
|
|
35
33
|
|
|
36
|
-
{#
|
|
34
|
+
{#snippet structure(props: AlertContext)}
|
|
35
|
+
<AlertDefaultStructure {...props} />
|
|
36
|
+
{/snippet}
|
|
37
|
+
|
|
38
|
+
{#if !state.hidden}
|
|
37
39
|
<div
|
|
38
40
|
role="alert"
|
|
39
|
-
use:__AgnosUISveltePreprocess__classDirective={"au-alert alert alert-"+(
|
|
40
|
-
use:transitionDirective {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(transitionDirective, [__AgnosUISveltePreprocess__classDirective, "au-alert alert alert-"+(
|
|
41
|
+
use:__AgnosUISveltePreprocess__classDirective={"au-alert alert alert-"+(state.type)+" "+(state.className)+" "+(state.dismissible ? 'alert-dismissible' : '')}
|
|
42
|
+
use:transitionDirective {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(transitionDirective, [__AgnosUISveltePreprocess__classDirective, "au-alert alert alert-"+(state.type)+" "+(state.className)+" "+(state.dismissible ? 'alert-dismissible' : '')])}
|
|
41
43
|
>
|
|
42
|
-
<Slot
|
|
43
|
-
<svelte:fragment slot="slot" let:props><slot name="structure" {...props} /></svelte:fragment>
|
|
44
|
-
<svelte:component this={component} {...props}>
|
|
45
|
-
<svelte:fragment let:state let:widget><slot {state} {widget} /></svelte:fragment>
|
|
46
|
-
<svelte:fragment slot="structure" let:state let:widget><slot name="structure" {state} {widget} /></svelte:fragment>
|
|
47
|
-
</svelte:component>
|
|
48
|
-
</Slot>
|
|
44
|
+
<Slot content={state.structure} props={widget} />
|
|
49
45
|
</div>
|
|
50
46
|
{/if}
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} & Partial<AlertProps>;
|
|
7
|
-
events: {
|
|
8
|
-
[evt: string]: CustomEvent<any>;
|
|
9
|
-
};
|
|
10
|
-
slots: AlertSlots;
|
|
11
|
-
exports?: {} | undefined;
|
|
12
|
-
bindings?: string | undefined;
|
|
13
|
-
};
|
|
14
|
-
type AlertProps_ = typeof __propDef.props;
|
|
15
|
-
export { AlertProps_ as AlertProps };
|
|
16
|
-
export type AlertEvents = typeof __propDef.events;
|
|
17
|
-
type AlertSlots_ = typeof __propDef.slots;
|
|
18
|
-
export { AlertSlots_ as AlertSlots };
|
|
19
|
-
export default class Alert extends SvelteComponent<AlertProps_, AlertEvents, AlertSlots_> {
|
|
20
|
-
get api(): AlertApi;
|
|
21
|
-
}
|
|
1
|
+
import { type AlertApi, type AlertProps } from './alert.gen';
|
|
2
|
+
declare const Alert: import("svelte").Component<Partial<AlertProps>, {
|
|
3
|
+
api: AlertApi;
|
|
4
|
+
}, "visible">;
|
|
5
|
+
export default Alert;
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type {AlertContext} from './alert.gen';
|
|
3
|
+
import {Slot} from '@agnos-ui/svelte-headless/slot';
|
|
4
|
+
|
|
5
|
+
let widget: AlertContext = $props();
|
|
6
|
+
let state = widget.state;
|
|
5
7
|
</script>
|
|
6
8
|
|
|
7
9
|
<div class="alert-body">
|
|
8
|
-
<Slot
|
|
9
|
-
<svelte:fragment slot="slot" let:props><slot {...props} /></svelte:fragment>
|
|
10
|
-
<svelte:component this={component} {...props}>
|
|
11
|
-
<svelte:fragment let:state let:widget><slot {state} {widget} /></svelte:fragment>
|
|
12
|
-
<svelte:fragment slot="structure" let:state let:widget><slot name="structure" {state} {widget} /></svelte:fragment>
|
|
13
|
-
</svelte:component>
|
|
14
|
-
</Slot>
|
|
10
|
+
<Slot content={state.children} props={widget} />
|
|
15
11
|
</div>
|
|
16
12
|
{#if state.dismissible}
|
|
17
|
-
<button type="button" class="btn-close"
|
|
13
|
+
<button type="button" class="btn-close" onclick={() => widget.api.close()} aria-label={state.ariaCloseButtonLabel}></button>
|
|
18
14
|
{/if}
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
props: WidgetSlotContext<Widget<import("./alert.gen").AlertProps, import("./alert.gen").AlertState, import("./alert.gen").AlertApi, object, import("./alert.gen").AlertDirectives>>;
|
|
5
|
-
events: {
|
|
6
|
-
[evt: string]: CustomEvent<any>;
|
|
7
|
-
};
|
|
8
|
-
slots: AlertSlots;
|
|
9
|
-
exports?: {} | undefined;
|
|
10
|
-
bindings?: string | undefined;
|
|
11
|
-
};
|
|
12
|
-
export type AlertDefaultStructureProps = typeof __propDef.props;
|
|
13
|
-
export type AlertDefaultStructureEvents = typeof __propDef.events;
|
|
14
|
-
export type AlertDefaultStructureSlots = typeof __propDef.slots;
|
|
15
|
-
export default class AlertDefaultStructure extends SvelteComponent<AlertDefaultStructureProps, AlertDefaultStructureEvents, AlertDefaultStructureSlots> {
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
1
|
+
import type { AlertContext } from './alert.gen';
|
|
2
|
+
declare const AlertDefaultStructure: import("svelte").Component<AlertContext, {}, "">;
|
|
3
|
+
export default AlertDefaultStructure;
|