@agnos-ui/react-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/{accordion-Bpx0new2.js → accordion-CMbgQzoG.js} +12 -10
- package/{accordion-BaQCaLLI.cjs → accordion-DnlQmoOX.cjs} +9 -7
- package/{alert-DOBOL4nD.cjs → alert-Bn5ooyqK.cjs} +9 -17
- package/{alert-DWq65Emo.js → alert-DKl7HLhb.js} +11 -19
- package/components/accordion/accordion.d.ts +6 -12
- package/components/accordion/accordion.gen.d.ts +343 -0
- package/components/accordion/index.cjs +3 -9
- package/components/accordion/index.js +5 -4
- package/components/alert/alert.d.ts +6 -9
- package/components/alert/alert.gen.d.ts +119 -0
- package/components/alert/index.cjs +2 -9
- package/components/alert/index.js +3 -3
- package/components/modal/index.cjs +10 -8
- package/components/modal/index.js +5 -2
- package/components/modal/modal.d.ts +7 -9
- package/components/modal/modal.gen.d.ts +239 -0
- package/components/pagination/index.cjs +2 -9
- package/components/pagination/index.js +3 -3
- package/components/pagination/pagination.d.ts +4 -7
- package/components/pagination/pagination.gen.d.ts +394 -0
- package/components/progressbar/index.cjs +2 -9
- package/components/progressbar/index.js +3 -3
- package/components/progressbar/progressbar.d.ts +5 -8
- package/components/progressbar/progressbar.gen.d.ts +126 -0
- package/components/rating/index.cjs +2 -9
- package/components/rating/index.js +3 -3
- package/components/rating/rating.d.ts +4 -5
- package/components/rating/rating.gen.d.ts +179 -0
- package/components/select/index.cjs +2 -9
- package/components/select/index.js +3 -3
- package/components/select/select.d.ts +4 -7
- package/components/select/select.gen.d.ts +293 -0
- package/components/slider/index.cjs +2 -9
- package/components/slider/index.js +3 -3
- package/components/slider/slider.d.ts +4 -8
- package/components/slider/slider.gen.d.ts +293 -0
- package/components/toast/index.cjs +2 -9
- package/components/toast/index.js +3 -3
- package/components/toast/toast.d.ts +6 -9
- package/components/toast/toast.gen.d.ts +146 -0
- package/config.d.ts +3 -4
- package/config.gen.d.ts +47 -0
- package/generated/config.cjs +4 -5
- package/generated/services/extendWidget.cjs +4 -5
- package/generated/services/floatingUI.cjs +4 -5
- package/generated/services/focustrack.cjs +4 -5
- package/generated/services/hash.cjs +4 -5
- package/generated/services/intersection.cjs +4 -5
- package/generated/services/matchMedia.cjs +4 -5
- package/generated/services/navManager.cjs +4 -5
- package/generated/services/portal.cjs +4 -5
- package/generated/services/resizeObserver.cjs +4 -5
- package/generated/services/siblingsInert.cjs +4 -5
- package/generated/services/transitions/baseTransitions.cjs +4 -5
- package/generated/services/transitions/bootstrap.cjs +4 -5
- package/generated/services/transitions/collapse.cjs +4 -5
- package/generated/services/transitions/cssTransitions.cjs +4 -5
- package/generated/services/transitions/simpleClassTransition.cjs +4 -5
- package/generated/slot.cjs +4 -5
- package/generated/types.cjs +4 -5
- package/generated/utils/directive.cjs +4 -5
- package/generated/utils/portal.cjs +4 -5
- package/generated/utils/stores.cjs +4 -5
- package/generated/utils/widget.cjs +4 -5
- package/generated/utils/writables.cjs +4 -5
- package/index.cjs +120 -196
- package/index.js +24 -20
- package/{modal-2qAV4Hjl.cjs → modal-1m6cSYmZ.cjs} +13 -10
- package/{modal-B6rJgzVm.js → modal-BJy1upw0.js} +14 -11
- package/package.json +6 -6
- package/{pagination-X2bugeX-.js → pagination-B76wbKhG.js} +15 -13
- package/{pagination-CKUbq-OI.cjs → pagination-DeZ2Eb3e.cjs} +13 -11
- package/{progressbar-D-yo9AHH.cjs → progressbar-DKshX5DJ.cjs} +6 -4
- package/{progressbar-D1-6Dzrf.js → progressbar-UDs4TPtQ.js} +8 -6
- package/{rating-D2Ajh4vg.cjs → rating-DB4Ze-r4.cjs} +3 -2
- package/{rating-Cvad2Z2H.js → rating-DRAx20tg.js} +5 -4
- package/{select-B_Thv-qd.js → select-CEXxOyRB.js} +8 -6
- package/{select-DHik5ocI.cjs → select-CxX_TdVh.cjs} +6 -4
- package/{slider-DLdA-y4u.js → slider-CnK847iw.js} +15 -13
- package/{slider-DUv6gRI9.cjs → slider-Du37lWVJ.cjs} +13 -11
- package/{toast-BUiyh5r_.js → toast-Bvz7Uyrd.js} +12 -10
- package/{toast-Dp_zjIff.cjs → toast-cd5__9Rl.cjs} +10 -8
|
@@ -4,8 +4,9 @@ import { useWidgetWithConfig } from "./generated/config.js";
|
|
|
4
4
|
import { toSlotContextWidget } from "@agnos-ui/react-headless/types";
|
|
5
5
|
import React__default from "react";
|
|
6
6
|
import { Slot } from "@agnos-ui/react-headless/slot";
|
|
7
|
-
import { createSlider as createSlider$1 } from "@agnos-ui/core-bootstrap/components/slider";
|
|
7
|
+
import { createSlider as createSlider$1, getSliderDefaultConfig as getSliderDefaultConfig$1 } from "@agnos-ui/core-bootstrap/components/slider";
|
|
8
8
|
const createSlider = createSlider$1;
|
|
9
|
+
const getSliderDefaultConfig = getSliderDefaultConfig$1;
|
|
9
10
|
const DefaultSlotHandle = (slotContext) => {
|
|
10
11
|
return /* @__PURE__ */ jsx("button", { ...useDirective(slotContext.widget.directives.handleDirective, { item: slotContext.item }), children: " " });
|
|
11
12
|
};
|
|
@@ -20,17 +21,17 @@ const HandleLabelDisplay = ({
|
|
|
20
21
|
return /* @__PURE__ */ jsx("div", { ...useDirective(directive, { index }), children });
|
|
21
22
|
};
|
|
22
23
|
const MinMaxLabels = (slotContext) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23
|
-
/* @__PURE__ */ jsx("div", { ...useDirective(slotContext.widget.directives.minLabelDirective), children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.
|
|
24
|
-
/* @__PURE__ */ jsx("div", { ...useDirective(slotContext.widget.directives.maxLabelDirective), children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.
|
|
24
|
+
/* @__PURE__ */ jsx("div", { ...useDirective(slotContext.widget.directives.minLabelDirective), children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.label, props: { value: slotContext.state.min, ...slotContext } }) }),
|
|
25
|
+
/* @__PURE__ */ jsx("div", { ...useDirective(slotContext.widget.directives.maxLabelDirective), children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.label, props: { value: slotContext.state.max, ...slotContext } }) })
|
|
25
26
|
] });
|
|
26
27
|
const CombinedLabel = (slotContext) => /* @__PURE__ */ jsx("div", { ...useDirective(slotContext.widget.directives.combinedHandleLabelDisplayDirective), children: slotContext.state.rtl ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27
|
-
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.
|
|
28
|
+
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.label, props: { value: slotContext.state.sortedValues[1], ...slotContext } }),
|
|
28
29
|
" - ",
|
|
29
|
-
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.
|
|
30
|
+
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.label, props: { value: slotContext.state.sortedValues[0], ...slotContext } })
|
|
30
31
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
31
|
-
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.
|
|
32
|
+
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.label, props: { value: slotContext.state.sortedValues[0], ...slotContext } }),
|
|
32
33
|
" - ",
|
|
33
|
-
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.
|
|
34
|
+
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.label, props: { value: slotContext.state.sortedValues[1], ...slotContext } })
|
|
34
35
|
] }) });
|
|
35
36
|
const DefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
37
|
slotContext.state.progressDisplayOptions.map((option, index) => /* @__PURE__ */ jsx(ProgressDisplay, { directive: slotContext.widget.directives.progressDisplayDirective, option }, index)),
|
|
@@ -38,22 +39,23 @@ const DefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxs(Fragment, { c
|
|
|
38
39
|
slotContext.state.showMinMaxLabels && /* @__PURE__ */ jsx(MinMaxLabels, { ...slotContext }),
|
|
39
40
|
slotContext.state.showValueLabels && slotContext.state.combinedLabelDisplay && /* @__PURE__ */ jsx(CombinedLabel, { ...slotContext }),
|
|
40
41
|
slotContext.state.sortedHandles.map((item, i) => /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
|
|
41
|
-
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.
|
|
42
|
-
slotContext.state.showValueLabels && !slotContext.state.combinedLabelDisplay && /* @__PURE__ */ jsx(HandleLabelDisplay, { directive: slotContext.widget.directives.handleLabelDisplayDirective, index: i, children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.
|
|
42
|
+
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.handle, props: { item, ...slotContext } }),
|
|
43
|
+
slotContext.state.showValueLabels && !slotContext.state.combinedLabelDisplay && /* @__PURE__ */ jsx(HandleLabelDisplay, { directive: slotContext.widget.directives.handleLabelDisplayDirective, index: i, children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.label, props: { value: slotContext.state.values[i], ...slotContext } }) })
|
|
43
44
|
] }, item.id))
|
|
44
45
|
] });
|
|
45
46
|
const defaultConfig = {
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
structure: DefaultSlotStructure,
|
|
48
|
+
handle: DefaultSlotHandle
|
|
48
49
|
};
|
|
49
50
|
function Slider(props) {
|
|
50
51
|
const [state, widget] = useWidgetWithConfig(createSlider, props, "slider", { ...defaultConfig });
|
|
51
52
|
const slotContext = { state, widget: toSlotContextWidget(widget) };
|
|
52
|
-
return /* @__PURE__ */ jsx("div", { ...useDirective(widget.directives.sliderDirective), children: /* @__PURE__ */ jsx(Slot, { slotContent: state.
|
|
53
|
+
return /* @__PURE__ */ jsx("div", { ...useDirective(widget.directives.sliderDirective), children: /* @__PURE__ */ jsx(Slot, { slotContent: state.structure, props: slotContext }) });
|
|
53
54
|
}
|
|
54
55
|
export {
|
|
55
56
|
DefaultSlotHandle as D,
|
|
56
57
|
Slider as S,
|
|
57
58
|
DefaultSlotStructure as a,
|
|
58
|
-
createSlider as c
|
|
59
|
+
createSlider as c,
|
|
60
|
+
getSliderDefaultConfig as g
|
|
59
61
|
};
|
|
@@ -7,6 +7,7 @@ const React = require("react");
|
|
|
7
7
|
const slot = require("@agnos-ui/react-headless/slot");
|
|
8
8
|
const slider = require("@agnos-ui/core-bootstrap/components/slider");
|
|
9
9
|
const createSlider = slider.createSlider;
|
|
10
|
+
const getSliderDefaultConfig = slider.getSliderDefaultConfig;
|
|
10
11
|
const DefaultSlotHandle = (slotContext) => {
|
|
11
12
|
return /* @__PURE__ */ jsxRuntime.jsx("button", { ...directive.useDirective(slotContext.widget.directives.handleDirective, { item: slotContext.item }), children: " " });
|
|
12
13
|
};
|
|
@@ -21,17 +22,17 @@ const HandleLabelDisplay = ({
|
|
|
21
22
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(directive$1, { index }), children });
|
|
22
23
|
};
|
|
23
24
|
const MinMaxLabels = (slotContext) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
24
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(slotContext.widget.directives.minLabelDirective), children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.
|
|
25
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(slotContext.widget.directives.maxLabelDirective), children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.
|
|
25
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(slotContext.widget.directives.minLabelDirective), children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.label, props: { value: slotContext.state.min, ...slotContext } }) }),
|
|
26
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(slotContext.widget.directives.maxLabelDirective), children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.label, props: { value: slotContext.state.max, ...slotContext } }) })
|
|
26
27
|
] });
|
|
27
28
|
const CombinedLabel = (slotContext) => /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(slotContext.widget.directives.combinedHandleLabelDisplayDirective), children: slotContext.state.rtl ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
28
|
-
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.
|
|
29
|
+
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.label, props: { value: slotContext.state.sortedValues[1], ...slotContext } }),
|
|
29
30
|
" - ",
|
|
30
|
-
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.
|
|
31
|
+
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.label, props: { value: slotContext.state.sortedValues[0], ...slotContext } })
|
|
31
32
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
32
|
-
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.
|
|
33
|
+
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.label, props: { value: slotContext.state.sortedValues[0], ...slotContext } }),
|
|
33
34
|
" - ",
|
|
34
|
-
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.
|
|
35
|
+
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.label, props: { value: slotContext.state.sortedValues[1], ...slotContext } })
|
|
35
36
|
] }) });
|
|
36
37
|
const DefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
37
38
|
slotContext.state.progressDisplayOptions.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(ProgressDisplay, { directive: slotContext.widget.directives.progressDisplayDirective, option }, index)),
|
|
@@ -39,20 +40,21 @@ const DefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxRuntime.jsxs(js
|
|
|
39
40
|
slotContext.state.showMinMaxLabels && /* @__PURE__ */ jsxRuntime.jsx(MinMaxLabels, { ...slotContext }),
|
|
40
41
|
slotContext.state.showValueLabels && slotContext.state.combinedLabelDisplay && /* @__PURE__ */ jsxRuntime.jsx(CombinedLabel, { ...slotContext }),
|
|
41
42
|
slotContext.state.sortedHandles.map((item, i) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
42
|
-
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.
|
|
43
|
-
slotContext.state.showValueLabels && !slotContext.state.combinedLabelDisplay && /* @__PURE__ */ jsxRuntime.jsx(HandleLabelDisplay, { directive: slotContext.widget.directives.handleLabelDisplayDirective, index: i, children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.
|
|
43
|
+
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.handle, props: { item, ...slotContext } }),
|
|
44
|
+
slotContext.state.showValueLabels && !slotContext.state.combinedLabelDisplay && /* @__PURE__ */ jsxRuntime.jsx(HandleLabelDisplay, { directive: slotContext.widget.directives.handleLabelDisplayDirective, index: i, children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.label, props: { value: slotContext.state.values[i], ...slotContext } }) })
|
|
44
45
|
] }, item.id))
|
|
45
46
|
] });
|
|
46
47
|
const defaultConfig = {
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
structure: DefaultSlotStructure,
|
|
49
|
+
handle: DefaultSlotHandle
|
|
49
50
|
};
|
|
50
51
|
function Slider(props) {
|
|
51
52
|
const [state, widget] = generated_config.useWidgetWithConfig(createSlider, props, "slider", { ...defaultConfig });
|
|
52
53
|
const slotContext = { state, widget: types.toSlotContextWidget(widget) };
|
|
53
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(widget.directives.sliderDirective), children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.
|
|
54
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(widget.directives.sliderDirective), children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.structure, props: slotContext }) });
|
|
54
55
|
}
|
|
55
56
|
exports.DefaultSlotHandle = DefaultSlotHandle;
|
|
56
57
|
exports.DefaultSlotStructure = DefaultSlotStructure;
|
|
57
58
|
exports.Slider = Slider;
|
|
58
59
|
exports.createSlider = createSlider;
|
|
60
|
+
exports.getSliderDefaultConfig = getSliderDefaultConfig;
|
|
@@ -3,35 +3,36 @@ import { useWidgetWithConfig } from "./generated/config.js";
|
|
|
3
3
|
import { Slot } from "@agnos-ui/react-headless/slot";
|
|
4
4
|
import { useDirectives, classDirective } from "@agnos-ui/react-headless/utils/directive";
|
|
5
5
|
import { forwardRef, useImperativeHandle } from "react";
|
|
6
|
-
import { createToast as createToast$1 } from "@agnos-ui/core-bootstrap/components/toast";
|
|
6
|
+
import { createToast as createToast$1, getToastDefaultConfig as getToastDefaultConfig$1 } from "@agnos-ui/core-bootstrap/components/toast";
|
|
7
7
|
const createToast = createToast$1;
|
|
8
|
+
const getToastDefaultConfig = getToastDefaultConfig$1;
|
|
8
9
|
const ToastHeader = (slotContext) => /* @__PURE__ */ jsxs("div", { className: "toast-header", children: [
|
|
9
|
-
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.
|
|
10
|
+
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.header, props: slotContext }),
|
|
10
11
|
slotContext.state.dismissible && /* @__PURE__ */ jsx("button", { ...useDirectives([classDirective, "btn-close me-0 ms-auto"], slotContext.widget.directives.closeButtonDirective) })
|
|
11
12
|
] });
|
|
12
13
|
const ToastCloseButtonNoHeader = (slotContext) => /* @__PURE__ */ jsx("button", { ...useDirectives([classDirective, "btn-close btn-close-white me-2 m-auto"], slotContext.widget.directives.closeButtonDirective) });
|
|
13
14
|
const DefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
-
slotContext.state.
|
|
15
|
-
/* @__PURE__ */ jsx("div", { className: "toast-body", children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.
|
|
16
|
-
slotContext.state.dismissible && !slotContext.state.
|
|
15
|
+
slotContext.state.header && /* @__PURE__ */ jsx(ToastHeader, { ...slotContext }),
|
|
16
|
+
/* @__PURE__ */ jsx("div", { className: "toast-body", children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.children, props: slotContext }) }),
|
|
17
|
+
slotContext.state.dismissible && !slotContext.state.header && /* @__PURE__ */ jsx(ToastCloseButtonNoHeader, { ...slotContext })
|
|
17
18
|
] });
|
|
18
19
|
const defaultConfig = {
|
|
19
|
-
|
|
20
|
+
structure: DefaultSlotStructure
|
|
20
21
|
};
|
|
21
22
|
const ToastElement = (slotContext) => /* @__PURE__ */ jsx(
|
|
22
23
|
"div",
|
|
23
24
|
{
|
|
24
25
|
...useDirectives(
|
|
25
|
-
[classDirective, `toast ${slotContext.state.dismissible ? "toast-dismissible" : ""} ${!slotContext.state.
|
|
26
|
+
[classDirective, `toast ${slotContext.state.dismissible ? "toast-dismissible" : ""} ${!slotContext.state.header ? "d-flex" : ""}`],
|
|
26
27
|
slotContext.widget.directives.transitionDirective,
|
|
27
28
|
slotContext.widget.directives.autoHideDirective,
|
|
28
29
|
slotContext.widget.directives.bodyDirective
|
|
29
30
|
),
|
|
30
|
-
children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.
|
|
31
|
+
children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.structure, props: slotContext })
|
|
31
32
|
}
|
|
32
33
|
);
|
|
33
34
|
const Toast = forwardRef(function Toast2(props, ref) {
|
|
34
|
-
const [state, widget] = useWidgetWithConfig(createToast, props, "toast", { ...defaultConfig,
|
|
35
|
+
const [state, widget] = useWidgetWithConfig(createToast, props, "toast", { ...defaultConfig, children: props.children });
|
|
35
36
|
useImperativeHandle(ref, () => widget.api, []);
|
|
36
37
|
const slotContext = {
|
|
37
38
|
state,
|
|
@@ -41,5 +42,6 @@ const Toast = forwardRef(function Toast2(props, ref) {
|
|
|
41
42
|
});
|
|
42
43
|
export {
|
|
43
44
|
Toast as T,
|
|
44
|
-
createToast as c
|
|
45
|
+
createToast as c,
|
|
46
|
+
getToastDefaultConfig as g
|
|
45
47
|
};
|
|
@@ -6,33 +6,34 @@ const directive = require("@agnos-ui/react-headless/utils/directive");
|
|
|
6
6
|
const React = require("react");
|
|
7
7
|
const toast = require("@agnos-ui/core-bootstrap/components/toast");
|
|
8
8
|
const createToast = toast.createToast;
|
|
9
|
+
const getToastDefaultConfig = toast.getToastDefaultConfig;
|
|
9
10
|
const ToastHeader = (slotContext) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "toast-header", children: [
|
|
10
|
-
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.
|
|
11
|
+
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.header, props: slotContext }),
|
|
11
12
|
slotContext.state.dismissible && /* @__PURE__ */ jsxRuntime.jsx("button", { ...directive.useDirectives([directive.classDirective, "btn-close me-0 ms-auto"], slotContext.widget.directives.closeButtonDirective) })
|
|
12
13
|
] });
|
|
13
14
|
const ToastCloseButtonNoHeader = (slotContext) => /* @__PURE__ */ jsxRuntime.jsx("button", { ...directive.useDirectives([directive.classDirective, "btn-close btn-close-white me-2 m-auto"], slotContext.widget.directives.closeButtonDirective) });
|
|
14
15
|
const DefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
15
|
-
slotContext.state.
|
|
16
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "toast-body", children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.
|
|
17
|
-
slotContext.state.dismissible && !slotContext.state.
|
|
16
|
+
slotContext.state.header && /* @__PURE__ */ jsxRuntime.jsx(ToastHeader, { ...slotContext }),
|
|
17
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "toast-body", children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.children, props: slotContext }) }),
|
|
18
|
+
slotContext.state.dismissible && !slotContext.state.header && /* @__PURE__ */ jsxRuntime.jsx(ToastCloseButtonNoHeader, { ...slotContext })
|
|
18
19
|
] });
|
|
19
20
|
const defaultConfig = {
|
|
20
|
-
|
|
21
|
+
structure: DefaultSlotStructure
|
|
21
22
|
};
|
|
22
23
|
const ToastElement = (slotContext) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
23
24
|
"div",
|
|
24
25
|
{
|
|
25
26
|
...directive.useDirectives(
|
|
26
|
-
[directive.classDirective, `toast ${slotContext.state.dismissible ? "toast-dismissible" : ""} ${!slotContext.state.
|
|
27
|
+
[directive.classDirective, `toast ${slotContext.state.dismissible ? "toast-dismissible" : ""} ${!slotContext.state.header ? "d-flex" : ""}`],
|
|
27
28
|
slotContext.widget.directives.transitionDirective,
|
|
28
29
|
slotContext.widget.directives.autoHideDirective,
|
|
29
30
|
slotContext.widget.directives.bodyDirective
|
|
30
31
|
),
|
|
31
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.
|
|
32
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.structure, props: slotContext })
|
|
32
33
|
}
|
|
33
34
|
);
|
|
34
35
|
const Toast = React.forwardRef(function Toast2(props, ref) {
|
|
35
|
-
const [state, widget] = generated_config.useWidgetWithConfig(createToast, props, "toast", { ...defaultConfig,
|
|
36
|
+
const [state, widget] = generated_config.useWidgetWithConfig(createToast, props, "toast", { ...defaultConfig, children: props.children });
|
|
36
37
|
React.useImperativeHandle(ref, () => widget.api, []);
|
|
37
38
|
const slotContext = {
|
|
38
39
|
state,
|
|
@@ -42,3 +43,4 @@ const Toast = React.forwardRef(function Toast2(props, ref) {
|
|
|
42
43
|
});
|
|
43
44
|
exports.Toast = Toast;
|
|
44
45
|
exports.createToast = createToast;
|
|
46
|
+
exports.getToastDefaultConfig = getToastDefaultConfig;
|