@agnos-ui/react-bootstrap 0.3.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 +15 -0
- package/accordion-BaQCaLLI.cjs +49 -0
- package/accordion-Bpx0new2.js +50 -0
- package/alert-DOBOL4nD.cjs +50 -0
- package/alert-DWq65Emo.js +51 -0
- package/components/accordion/accordion.d.ts +15 -0
- package/components/accordion/index.cjs +14 -0
- package/components/accordion/index.d.ts +1 -0
- package/components/accordion/index.js +7 -0
- package/components/alert/alert.d.ts +10 -0
- package/components/alert/index.cjs +13 -0
- package/components/alert/index.d.ts +1 -0
- package/components/alert/index.js +6 -0
- package/components/modal/index.cjs +14 -0
- package/components/modal/index.d.ts +1 -0
- package/components/modal/index.js +7 -0
- package/components/modal/modal.d.ts +11 -0
- package/components/pagination/index.cjs +17 -0
- package/components/pagination/index.d.ts +1 -0
- package/components/pagination/index.js +10 -0
- package/components/pagination/pageItem.d.ts +20 -0
- package/components/pagination/pagination.d.ts +12 -0
- package/components/progressbar/index.cjs +13 -0
- package/components/progressbar/index.d.ts +1 -0
- package/components/progressbar/index.js +6 -0
- package/components/progressbar/progressbar.d.ts +9 -0
- package/components/rating/index.cjs +13 -0
- package/components/rating/index.d.ts +1 -0
- package/components/rating/index.js +6 -0
- package/components/rating/rating.d.ts +7 -0
- package/components/select/index.cjs +13 -0
- package/components/select/index.d.ts +1 -0
- package/components/select/index.js +6 -0
- package/components/select/select.d.ts +9 -0
- package/components/slider/index.cjs +15 -0
- package/components/slider/index.d.ts +1 -0
- package/components/slider/index.js +8 -0
- package/components/slider/slider.d.ts +13 -0
- package/components/toast/index.cjs +13 -0
- package/components/toast/index.d.ts +1 -0
- package/components/toast/index.js +6 -0
- package/components/toast/toast.d.ts +10 -0
- package/config.d.ts +13 -0
- package/generated/config.cjs +16 -0
- package/generated/config.d.ts +1 -0
- package/generated/config.js +10 -0
- package/generated/index.d.ts +24 -0
- package/generated/services/extendWidget.cjs +10 -0
- package/generated/services/extendWidget.d.ts +1 -0
- package/generated/services/extendWidget.js +1 -0
- package/generated/services/floatingUI.cjs +10 -0
- package/generated/services/floatingUI.d.ts +1 -0
- package/generated/services/floatingUI.js +1 -0
- package/generated/services/focustrack.cjs +10 -0
- package/generated/services/focustrack.d.ts +1 -0
- package/generated/services/focustrack.js +1 -0
- package/generated/services/hash.cjs +10 -0
- package/generated/services/hash.d.ts +1 -0
- package/generated/services/hash.js +1 -0
- package/generated/services/intersection.cjs +10 -0
- package/generated/services/intersection.d.ts +1 -0
- package/generated/services/intersection.js +1 -0
- package/generated/services/matchMedia.cjs +10 -0
- package/generated/services/matchMedia.d.ts +1 -0
- package/generated/services/matchMedia.js +1 -0
- package/generated/services/navManager.cjs +10 -0
- package/generated/services/navManager.d.ts +1 -0
- package/generated/services/navManager.js +1 -0
- package/generated/services/portal.cjs +10 -0
- package/generated/services/portal.d.ts +1 -0
- package/generated/services/portal.js +1 -0
- package/generated/services/resizeObserver.cjs +10 -0
- package/generated/services/resizeObserver.d.ts +1 -0
- package/generated/services/resizeObserver.js +1 -0
- package/generated/services/siblingsInert.cjs +10 -0
- package/generated/services/siblingsInert.d.ts +1 -0
- package/generated/services/siblingsInert.js +1 -0
- package/generated/services/transitions/baseTransitions.cjs +10 -0
- package/generated/services/transitions/baseTransitions.d.ts +1 -0
- package/generated/services/transitions/baseTransitions.js +1 -0
- package/generated/services/transitions/bootstrap.cjs +10 -0
- package/generated/services/transitions/bootstrap.d.ts +1 -0
- package/generated/services/transitions/bootstrap.js +1 -0
- package/generated/services/transitions/collapse.cjs +10 -0
- package/generated/services/transitions/collapse.d.ts +1 -0
- package/generated/services/transitions/collapse.js +1 -0
- package/generated/services/transitions/cssTransitions.cjs +10 -0
- package/generated/services/transitions/cssTransitions.d.ts +1 -0
- package/generated/services/transitions/cssTransitions.js +1 -0
- package/generated/services/transitions/simpleClassTransition.cjs +10 -0
- package/generated/services/transitions/simpleClassTransition.d.ts +1 -0
- package/generated/services/transitions/simpleClassTransition.js +1 -0
- package/generated/slot.cjs +10 -0
- package/generated/slot.d.ts +1 -0
- package/generated/slot.js +1 -0
- package/generated/types.cjs +10 -0
- package/generated/types.d.ts +1 -0
- package/generated/types.js +1 -0
- package/generated/utils/directive.cjs +10 -0
- package/generated/utils/directive.d.ts +1 -0
- package/generated/utils/directive.js +1 -0
- package/generated/utils/portal.cjs +10 -0
- package/generated/utils/portal.d.ts +1 -0
- package/generated/utils/portal.js +1 -0
- package/generated/utils/stores.cjs +10 -0
- package/generated/utils/stores.d.ts +1 -0
- package/generated/utils/stores.js +1 -0
- package/generated/utils/widget.cjs +10 -0
- package/generated/utils/widget.d.ts +1 -0
- package/generated/utils/widget.js +1 -0
- package/generated/utils/writables.cjs +10 -0
- package/generated/utils/writables.d.ts +1 -0
- package/generated/utils/writables.js +1 -0
- package/index.cjs +298 -0
- package/index.d.ts +10 -0
- package/index.js +74 -0
- package/modal-2qAV4Hjl.cjs +59 -0
- package/modal-B6rJgzVm.js +60 -0
- package/package.json +85 -0
- package/pagination-CKUbq-OI.cjs +118 -0
- package/pagination-X2bugeX-.js +102 -0
- package/progressbar-D-yo9AHH.cjs +24 -0
- package/progressbar-D1-6Dzrf.js +25 -0
- package/rating-Cvad2Z2H.js +30 -0
- package/rating-D2Ajh4vg.cjs +29 -0
- package/select-B_Thv-qd.js +75 -0
- package/select-DHik5ocI.cjs +74 -0
- package/services/transitions/bootstrap.d.ts +1 -0
- package/slider-DLdA-y4u.js +59 -0
- package/slider-DUv6gRI9.cjs +58 -0
- package/toast-BUiyh5r_.js +45 -0
- package/toast-Dp_zjIff.cjs +44 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const generated_config = require("./generated/config.cjs");
|
|
4
|
+
const slot = require("@agnos-ui/react-headless/slot");
|
|
5
|
+
const types = require("@agnos-ui/react-headless/types");
|
|
6
|
+
const classNames = require("classnames");
|
|
7
|
+
const React = require("react");
|
|
8
|
+
const directive = require("@agnos-ui/react-headless/utils/directive");
|
|
9
|
+
const pagination = require("@agnos-ui/core-bootstrap/components/pagination");
|
|
10
|
+
function _interopNamespaceDefault(e) {
|
|
11
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
12
|
+
if (e) {
|
|
13
|
+
for (const k in e) {
|
|
14
|
+
if (k !== "default") {
|
|
15
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: () => e[k]
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
27
|
+
const PageItem = React__namespace.forwardRef(
|
|
28
|
+
({ disabled, active, activeLabel, className, children, directive: directive$1, page }, ref) => {
|
|
29
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", { ref, className: classNames("page-item", { active, disabled }), children: /* @__PURE__ */ jsxRuntime.jsxs("a", { ...directive.useDirectives([directive$1, { page }], [directive.classDirective, classNames("page-link", className)]), children: [
|
|
30
|
+
children,
|
|
31
|
+
active && activeLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "visually-hidden", children: activeLabel })
|
|
32
|
+
] }) });
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
PageItem.displayName = "PageItem";
|
|
36
|
+
const NavButton = React__namespace.forwardRef(({ disabled, className, children, directive: directive$1 }, ref) => {
|
|
37
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", { ref, className: classNames("page-item", { disabled }), children: /* @__PURE__ */ jsxRuntime.jsx("a", { ...directive.useDirectives(directive$1, [directive.classDirective, classNames("page-link", className)]), children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children }) }) });
|
|
38
|
+
});
|
|
39
|
+
NavButton.displayName = "NavButton";
|
|
40
|
+
const createPagination = pagination.createPagination;
|
|
41
|
+
function DefaultPages(slotContext) {
|
|
42
|
+
const { widget, state } = slotContext;
|
|
43
|
+
const jsxPages = [];
|
|
44
|
+
for (let i = 0; i < state.pages.length; i++) {
|
|
45
|
+
if (state.pages[i] === -1) {
|
|
46
|
+
jsxPages.push(
|
|
47
|
+
/* @__PURE__ */ jsxRuntime.jsxs("li", { className: "page-item disabled", children: [
|
|
48
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "page-link au-ellipsis", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.slotEllipsis, props: slotContext }) }),
|
|
49
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "visually-hidden", children: state.ariaEllipsisLabel })
|
|
50
|
+
] }, "Ellipsis" + i)
|
|
51
|
+
);
|
|
52
|
+
} else {
|
|
53
|
+
jsxPages.push(
|
|
54
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
55
|
+
PageItem,
|
|
56
|
+
{
|
|
57
|
+
disabled: state.disabled,
|
|
58
|
+
active: state.pages[i] === state.page,
|
|
59
|
+
activeLabel: state.activeLabel,
|
|
60
|
+
directive: widget.directives["pageLink"],
|
|
61
|
+
page: state.pages[i],
|
|
62
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.slotNumberLabel, props: { ...slotContext, displayedPage: state.pages[i] } })
|
|
63
|
+
},
|
|
64
|
+
state.pages[i]
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return jsxPages.length ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxPages }) : null;
|
|
70
|
+
}
|
|
71
|
+
const defaultConfig = {
|
|
72
|
+
slotPages: DefaultPages,
|
|
73
|
+
slotStructure: DefaultStructure
|
|
74
|
+
};
|
|
75
|
+
function DefaultStructure(slotContext) {
|
|
76
|
+
const { widget, state } = slotContext;
|
|
77
|
+
const ItemsBefore = [];
|
|
78
|
+
const ItemsAfter = [];
|
|
79
|
+
if (state.boundaryLinks) {
|
|
80
|
+
ItemsBefore.push(
|
|
81
|
+
/* @__PURE__ */ jsxRuntime.jsx(NavButton, { disabled: state.previousDisabled, directive: widget.directives["pageFirst"], children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.slotFirst, props: slotContext }) }, "first")
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
if (state.directionLinks) {
|
|
85
|
+
ItemsBefore.push(
|
|
86
|
+
/* @__PURE__ */ jsxRuntime.jsx(NavButton, { disabled: state.previousDisabled, directive: widget.directives["pagePrev"], children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.slotPrevious, props: slotContext }) }, "prev")
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
if (state.directionLinks) {
|
|
90
|
+
ItemsAfter.push(
|
|
91
|
+
/* @__PURE__ */ jsxRuntime.jsx(NavButton, { disabled: state.nextDisabled, directive: widget.directives["pageNext"], children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.slotNext, props: slotContext }) }, "next")
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
if (state.boundaryLinks) {
|
|
95
|
+
ItemsAfter.push(
|
|
96
|
+
/* @__PURE__ */ jsxRuntime.jsx(NavButton, { disabled: state.nextDisabled, directive: widget.directives["pageLast"], children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.slotLast, props: slotContext }) }, "last")
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
100
|
+
/* @__PURE__ */ jsxRuntime.jsxs("ul", { className: classNames("au-pagination", "pagination", state.size ? `pagination-${state.size}` : "", state.className), children: [
|
|
101
|
+
ItemsBefore,
|
|
102
|
+
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.slotPages, props: slotContext }),
|
|
103
|
+
ItemsAfter
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { "aria-live": "polite", className: "visually-hidden", children: `${state.ariaLiveLabelText}` })
|
|
106
|
+
] });
|
|
107
|
+
}
|
|
108
|
+
function Pagination(props) {
|
|
109
|
+
const [state, widget] = generated_config.useWidgetWithConfig(createPagination, props, "pagination", defaultConfig);
|
|
110
|
+
const slotContext = { state, widget: types.toSlotContextWidget(widget) };
|
|
111
|
+
return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": state.ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.slotStructure, props: slotContext }) });
|
|
112
|
+
}
|
|
113
|
+
exports.DefaultPages = DefaultPages;
|
|
114
|
+
exports.DefaultStructure = DefaultStructure;
|
|
115
|
+
exports.NavButton = NavButton;
|
|
116
|
+
exports.PageItem = PageItem;
|
|
117
|
+
exports.Pagination = Pagination;
|
|
118
|
+
exports.createPagination = createPagination;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useWidgetWithConfig } from "./generated/config.js";
|
|
3
|
+
import { Slot } from "@agnos-ui/react-headless/slot";
|
|
4
|
+
import { toSlotContextWidget } from "@agnos-ui/react-headless/types";
|
|
5
|
+
import classNames from "classnames";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { useDirectives, classDirective } from "@agnos-ui/react-headless/utils/directive";
|
|
8
|
+
import { createPagination as createPagination$1 } from "@agnos-ui/core-bootstrap/components/pagination";
|
|
9
|
+
const PageItem = React.forwardRef(
|
|
10
|
+
({ disabled, active, activeLabel, className, children, directive, page }, ref) => {
|
|
11
|
+
return /* @__PURE__ */ jsx("li", { ref, className: classNames("page-item", { active, disabled }), children: /* @__PURE__ */ jsxs("a", { ...useDirectives([directive, { page }], [classDirective, classNames("page-link", className)]), children: [
|
|
12
|
+
children,
|
|
13
|
+
active && activeLabel && /* @__PURE__ */ jsx("span", { className: "visually-hidden", children: activeLabel })
|
|
14
|
+
] }) });
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
PageItem.displayName = "PageItem";
|
|
18
|
+
const NavButton = React.forwardRef(({ disabled, className, children, directive }, ref) => {
|
|
19
|
+
return /* @__PURE__ */ jsx("li", { ref, className: classNames("page-item", { disabled }), children: /* @__PURE__ */ jsx("a", { ...useDirectives(directive, [classDirective, classNames("page-link", className)]), children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children }) }) });
|
|
20
|
+
});
|
|
21
|
+
NavButton.displayName = "NavButton";
|
|
22
|
+
const createPagination = createPagination$1;
|
|
23
|
+
function DefaultPages(slotContext) {
|
|
24
|
+
const { widget, state } = slotContext;
|
|
25
|
+
const jsxPages = [];
|
|
26
|
+
for (let i = 0; i < state.pages.length; i++) {
|
|
27
|
+
if (state.pages[i] === -1) {
|
|
28
|
+
jsxPages.push(
|
|
29
|
+
/* @__PURE__ */ jsxs("li", { className: "page-item disabled", children: [
|
|
30
|
+
/* @__PURE__ */ jsx("div", { className: "page-link au-ellipsis", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Slot, { slotContent: state.slotEllipsis, props: slotContext }) }),
|
|
31
|
+
/* @__PURE__ */ jsx("span", { className: "visually-hidden", children: state.ariaEllipsisLabel })
|
|
32
|
+
] }, "Ellipsis" + i)
|
|
33
|
+
);
|
|
34
|
+
} else {
|
|
35
|
+
jsxPages.push(
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
PageItem,
|
|
38
|
+
{
|
|
39
|
+
disabled: state.disabled,
|
|
40
|
+
active: state.pages[i] === state.page,
|
|
41
|
+
activeLabel: state.activeLabel,
|
|
42
|
+
directive: widget.directives["pageLink"],
|
|
43
|
+
page: state.pages[i],
|
|
44
|
+
children: /* @__PURE__ */ jsx(Slot, { slotContent: state.slotNumberLabel, props: { ...slotContext, displayedPage: state.pages[i] } })
|
|
45
|
+
},
|
|
46
|
+
state.pages[i]
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return jsxPages.length ? /* @__PURE__ */ jsx(Fragment, { children: jsxPages }) : null;
|
|
52
|
+
}
|
|
53
|
+
const defaultConfig = {
|
|
54
|
+
slotPages: DefaultPages,
|
|
55
|
+
slotStructure: DefaultStructure
|
|
56
|
+
};
|
|
57
|
+
function DefaultStructure(slotContext) {
|
|
58
|
+
const { widget, state } = slotContext;
|
|
59
|
+
const ItemsBefore = [];
|
|
60
|
+
const ItemsAfter = [];
|
|
61
|
+
if (state.boundaryLinks) {
|
|
62
|
+
ItemsBefore.push(
|
|
63
|
+
/* @__PURE__ */ jsx(NavButton, { disabled: state.previousDisabled, directive: widget.directives["pageFirst"], children: /* @__PURE__ */ jsx(Slot, { slotContent: state.slotFirst, props: slotContext }) }, "first")
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
if (state.directionLinks) {
|
|
67
|
+
ItemsBefore.push(
|
|
68
|
+
/* @__PURE__ */ jsx(NavButton, { disabled: state.previousDisabled, directive: widget.directives["pagePrev"], children: /* @__PURE__ */ jsx(Slot, { slotContent: state.slotPrevious, props: slotContext }) }, "prev")
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
if (state.directionLinks) {
|
|
72
|
+
ItemsAfter.push(
|
|
73
|
+
/* @__PURE__ */ jsx(NavButton, { disabled: state.nextDisabled, directive: widget.directives["pageNext"], children: /* @__PURE__ */ jsx(Slot, { slotContent: state.slotNext, props: slotContext }) }, "next")
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
if (state.boundaryLinks) {
|
|
77
|
+
ItemsAfter.push(
|
|
78
|
+
/* @__PURE__ */ jsx(NavButton, { disabled: state.nextDisabled, directive: widget.directives["pageLast"], children: /* @__PURE__ */ jsx(Slot, { slotContent: state.slotLast, props: slotContext }) }, "last")
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
82
|
+
/* @__PURE__ */ jsxs("ul", { className: classNames("au-pagination", "pagination", state.size ? `pagination-${state.size}` : "", state.className), children: [
|
|
83
|
+
ItemsBefore,
|
|
84
|
+
/* @__PURE__ */ jsx(Slot, { slotContent: state.slotPages, props: slotContext }),
|
|
85
|
+
ItemsAfter
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ jsx("div", { "aria-live": "polite", className: "visually-hidden", children: `${state.ariaLiveLabelText}` })
|
|
88
|
+
] });
|
|
89
|
+
}
|
|
90
|
+
function Pagination(props) {
|
|
91
|
+
const [state, widget] = useWidgetWithConfig(createPagination, props, "pagination", defaultConfig);
|
|
92
|
+
const slotContext = { state, widget: toSlotContextWidget(widget) };
|
|
93
|
+
return /* @__PURE__ */ jsx("nav", { "aria-label": state.ariaLabel, children: /* @__PURE__ */ jsx(Slot, { slotContent: state.slotStructure, props: slotContext }) });
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
DefaultPages as D,
|
|
97
|
+
NavButton as N,
|
|
98
|
+
Pagination as P,
|
|
99
|
+
DefaultStructure as a,
|
|
100
|
+
PageItem as b,
|
|
101
|
+
createPagination as c
|
|
102
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const generated_config = require("./generated/config.cjs");
|
|
4
|
+
const types = require("@agnos-ui/react-headless/types");
|
|
5
|
+
const slot = require("@agnos-ui/react-headless/slot");
|
|
6
|
+
const directive = require("@agnos-ui/react-headless/utils/directive");
|
|
7
|
+
const classNames = require("classnames");
|
|
8
|
+
const progressbar = require("@agnos-ui/core-bootstrap/components/progressbar");
|
|
9
|
+
const createProgressbar = progressbar.createProgressbar;
|
|
10
|
+
function DefaultSlotContent(slotContext) {
|
|
11
|
+
const { striped, animated, type } = slotContext.state;
|
|
12
|
+
const classes = classNames("progress-bar", { "progress-bar-striped": striped }, { "progress-bar-animated": animated }, { [`text-bg-${type}`]: !!type });
|
|
13
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "progress", style: { height: slotContext.state.height || void 0 }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes, style: { width: `${slotContext.state.percentage}%` }, children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.slotDefault, props: slotContext }) }) });
|
|
14
|
+
}
|
|
15
|
+
const defaultConfig = {
|
|
16
|
+
slotStructure: DefaultSlotContent
|
|
17
|
+
};
|
|
18
|
+
const Progressbar = (props) => {
|
|
19
|
+
const [state, widget] = generated_config.useWidgetWithConfig(createProgressbar, props, "progressbar", { ...defaultConfig, slotDefault: props.children });
|
|
20
|
+
const slotContext = { state, widget: types.toSlotContextWidget(widget) };
|
|
21
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(widget.directives.ariaDirective), className: state.className || void 0, children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.slotStructure, props: slotContext }) });
|
|
22
|
+
};
|
|
23
|
+
exports.Progressbar = Progressbar;
|
|
24
|
+
exports.createProgressbar = createProgressbar;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useWidgetWithConfig } from "./generated/config.js";
|
|
3
|
+
import { toSlotContextWidget } from "@agnos-ui/react-headless/types";
|
|
4
|
+
import { Slot } from "@agnos-ui/react-headless/slot";
|
|
5
|
+
import { useDirective } from "@agnos-ui/react-headless/utils/directive";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
import { createProgressbar as createProgressbar$1 } from "@agnos-ui/core-bootstrap/components/progressbar";
|
|
8
|
+
const createProgressbar = createProgressbar$1;
|
|
9
|
+
function DefaultSlotContent(slotContext) {
|
|
10
|
+
const { striped, animated, type } = slotContext.state;
|
|
11
|
+
const classes = classNames("progress-bar", { "progress-bar-striped": striped }, { "progress-bar-animated": animated }, { [`text-bg-${type}`]: !!type });
|
|
12
|
+
return /* @__PURE__ */ jsx("div", { className: "progress", style: { height: slotContext.state.height || void 0 }, children: /* @__PURE__ */ jsx("div", { className: classes, style: { width: `${slotContext.state.percentage}%` }, children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.slotDefault, props: slotContext }) }) });
|
|
13
|
+
}
|
|
14
|
+
const defaultConfig = {
|
|
15
|
+
slotStructure: DefaultSlotContent
|
|
16
|
+
};
|
|
17
|
+
const Progressbar = (props) => {
|
|
18
|
+
const [state, widget] = useWidgetWithConfig(createProgressbar, props, "progressbar", { ...defaultConfig, slotDefault: props.children });
|
|
19
|
+
const slotContext = { state, widget: toSlotContextWidget(widget) };
|
|
20
|
+
return /* @__PURE__ */ jsx("div", { ...useDirective(widget.directives.ariaDirective), className: state.className || void 0, children: /* @__PURE__ */ jsx(Slot, { slotContent: state.slotStructure, props: slotContext }) });
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
Progressbar as P,
|
|
24
|
+
createProgressbar as c
|
|
25
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from "@agnos-ui/react-headless/slot";
|
|
3
|
+
import { useWidgetWithConfig } from "./generated/config.js";
|
|
4
|
+
import { useDirectives, classDirective, useDirective } from "@agnos-ui/react-headless/utils/directive";
|
|
5
|
+
import React__default from "react";
|
|
6
|
+
import { createRating as createRating$1 } from "@agnos-ui/core-bootstrap/components/rating";
|
|
7
|
+
import "@agnos-ui/react-headless/components/rating";
|
|
8
|
+
const createRating = createRating$1;
|
|
9
|
+
function Star({ star, state, directive }) {
|
|
10
|
+
const arg = { index: star.index };
|
|
11
|
+
return /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
|
|
12
|
+
/* @__PURE__ */ jsxs("span", { className: "visually-hidden", children: [
|
|
13
|
+
"(",
|
|
14
|
+
star.index < state.visibleRating ? "*" : " ",
|
|
15
|
+
")"
|
|
16
|
+
] }),
|
|
17
|
+
/* @__PURE__ */ jsx("span", { ...useDirective(directive, arg), children: /* @__PURE__ */ jsx(Slot, { slotContent: state.slotStar, props: star }) })
|
|
18
|
+
] }, star.index);
|
|
19
|
+
}
|
|
20
|
+
function Rating(props) {
|
|
21
|
+
const [state, widget] = useWidgetWithConfig(createRating, props, "rating");
|
|
22
|
+
const {
|
|
23
|
+
directives: { containerDirective, starDirective }
|
|
24
|
+
} = widget;
|
|
25
|
+
return /* @__PURE__ */ jsx("div", { ...useDirectives([classDirective, "d-inline-flex"], containerDirective), children: state.stars.map((star) => /* @__PURE__ */ jsx(Star, { star, state, directive: starDirective }, star.index)) });
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
Rating as R,
|
|
29
|
+
createRating as c
|
|
30
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const slot = require("@agnos-ui/react-headless/slot");
|
|
4
|
+
const generated_config = require("./generated/config.cjs");
|
|
5
|
+
const directive = require("@agnos-ui/react-headless/utils/directive");
|
|
6
|
+
const React = require("react");
|
|
7
|
+
const rating = require("@agnos-ui/core-bootstrap/components/rating");
|
|
8
|
+
require("@agnos-ui/react-headless/components/rating");
|
|
9
|
+
const createRating = rating.createRating;
|
|
10
|
+
function Star({ star, state, directive: directive$1 }) {
|
|
11
|
+
const arg = { index: star.index };
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
13
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "visually-hidden", children: [
|
|
14
|
+
"(",
|
|
15
|
+
star.index < state.visibleRating ? "*" : " ",
|
|
16
|
+
")"
|
|
17
|
+
] }),
|
|
18
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { ...directive.useDirective(directive$1, arg), children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.slotStar, props: star }) })
|
|
19
|
+
] }, star.index);
|
|
20
|
+
}
|
|
21
|
+
function Rating(props) {
|
|
22
|
+
const [state, widget] = generated_config.useWidgetWithConfig(createRating, props, "rating");
|
|
23
|
+
const {
|
|
24
|
+
directives: { containerDirective, starDirective }
|
|
25
|
+
} = widget;
|
|
26
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirectives([directive.classDirective, "d-inline-flex"], containerDirective), children: state.stars.map((star) => /* @__PURE__ */ jsxRuntime.jsx(Star, { star, state, directive: starDirective }, star.index)) });
|
|
27
|
+
}
|
|
28
|
+
exports.Rating = Rating;
|
|
29
|
+
exports.createRating = createRating;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { createSelect as createSelect$1 } from "@agnos-ui/core-bootstrap/components/select";
|
|
3
|
+
import { Slot } from "@agnos-ui/react-headless/slot";
|
|
4
|
+
import { toSlotContextWidget } from "@agnos-ui/react-headless/types";
|
|
5
|
+
import { useDirectives, classDirective, useDirective } from "@agnos-ui/react-headless/utils/directive";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
import { useWidgetWithConfig } from "./generated/config.js";
|
|
8
|
+
const createSelect = createSelect$1;
|
|
9
|
+
function DefaultBadge(slotContext) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "" + slotContext.itemContext.item });
|
|
11
|
+
}
|
|
12
|
+
function DefaultItem(slotContext) {
|
|
13
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "" + slotContext.itemContext.item });
|
|
14
|
+
}
|
|
15
|
+
function BadgeContainer({ itemContext, slotContext }) {
|
|
16
|
+
return /* @__PURE__ */ jsx("div", { ...useDirective(slotContext.widget.directives.badgeAttributesDirective, itemContext), children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.slotBadgeLabel, props: { ...slotContext, itemContext } }) });
|
|
17
|
+
}
|
|
18
|
+
function Badges({ slotContext }) {
|
|
19
|
+
const badges = [];
|
|
20
|
+
for (const itemContext of slotContext.state.selectedContexts) {
|
|
21
|
+
badges.push(/* @__PURE__ */ jsx(BadgeContainer, { itemContext, slotContext }, itemContext.id));
|
|
22
|
+
}
|
|
23
|
+
return badges.length ? /* @__PURE__ */ jsx(Fragment, { children: badges }) : null;
|
|
24
|
+
}
|
|
25
|
+
function SelectItem({ itemContext, slotContext }) {
|
|
26
|
+
const classname = classNames("dropdown-item", "position-relative", { "text-bg-primary": itemContext === slotContext.state.highlighted });
|
|
27
|
+
return /* @__PURE__ */ jsx("li", { className: classname, ...useDirective(slotContext.widget.directives.itemAttributesDirective, itemContext), children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.slotItem, props: { ...slotContext, itemContext } }) });
|
|
28
|
+
}
|
|
29
|
+
function Rows({ slotContext }) {
|
|
30
|
+
const {
|
|
31
|
+
directives: { hasFocusDirective, floatingDirective, menuAttributesDirective }
|
|
32
|
+
} = slotContext.widget;
|
|
33
|
+
return /* @__PURE__ */ jsx("ul", { ...useDirectives([classDirective, "dropdown-menu show"], hasFocusDirective, floatingDirective, menuAttributesDirective), children: slotContext.state.visibleItems.map((itemContext) => {
|
|
34
|
+
return /* @__PURE__ */ jsx(SelectItem, { slotContext, itemContext }, itemContext.id);
|
|
35
|
+
}) });
|
|
36
|
+
}
|
|
37
|
+
const defaultConfig = {
|
|
38
|
+
slotBadgeLabel: DefaultBadge,
|
|
39
|
+
slotItem: DefaultItem
|
|
40
|
+
};
|
|
41
|
+
function Select(props) {
|
|
42
|
+
const [state, widget] = useWidgetWithConfig(createSelect, props, "select", defaultConfig);
|
|
43
|
+
const slotContext = { state, widget: toSlotContextWidget(widget) };
|
|
44
|
+
const { id, ariaLabel, visibleItems, filterText, open, className } = state;
|
|
45
|
+
const menuId = `${id}-menu`;
|
|
46
|
+
const {
|
|
47
|
+
directives: { hasFocusDirective, referenceDirective, inputContainerDirective }
|
|
48
|
+
} = widget;
|
|
49
|
+
return /* @__PURE__ */ jsxs("div", { ...useDirectives([classDirective, `au-select dropdown border border-1 p-1 mb-3 d-block ${className}`], referenceDirective), children: [
|
|
50
|
+
/* @__PURE__ */ jsxs("div", { ...useDirectives([classDirective, "d-flex align-items-center flex-wrap gap-1"], hasFocusDirective, inputContainerDirective), children: [
|
|
51
|
+
/* @__PURE__ */ jsx(Badges, { slotContext }),
|
|
52
|
+
/* @__PURE__ */ jsx(
|
|
53
|
+
"input",
|
|
54
|
+
{
|
|
55
|
+
id,
|
|
56
|
+
"aria-label": ariaLabel,
|
|
57
|
+
className: "au-select-input flex-grow-1 border-0",
|
|
58
|
+
type: "text",
|
|
59
|
+
value: filterText,
|
|
60
|
+
"aria-autocomplete": "list",
|
|
61
|
+
autoCorrect: "off",
|
|
62
|
+
autoCapitalize: "none",
|
|
63
|
+
autoComplete: "off",
|
|
64
|
+
onInput: widget.actions.onInput,
|
|
65
|
+
onKeyDown: (e) => widget.actions.onInputKeydown(e.nativeEvent)
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] }),
|
|
69
|
+
open && visibleItems.length > 0 && /* @__PURE__ */ jsx(Rows, { slotContext, menuId })
|
|
70
|
+
] });
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
Select as S,
|
|
74
|
+
createSelect as c
|
|
75
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const select = require("@agnos-ui/core-bootstrap/components/select");
|
|
4
|
+
const slot = require("@agnos-ui/react-headless/slot");
|
|
5
|
+
const types = require("@agnos-ui/react-headless/types");
|
|
6
|
+
const directive = require("@agnos-ui/react-headless/utils/directive");
|
|
7
|
+
const classNames = require("classnames");
|
|
8
|
+
const generated_config = require("./generated/config.cjs");
|
|
9
|
+
const createSelect = select.createSelect;
|
|
10
|
+
function DefaultBadge(slotContext) {
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "" + slotContext.itemContext.item });
|
|
12
|
+
}
|
|
13
|
+
function DefaultItem(slotContext) {
|
|
14
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "" + slotContext.itemContext.item });
|
|
15
|
+
}
|
|
16
|
+
function BadgeContainer({ itemContext, slotContext }) {
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(slotContext.widget.directives.badgeAttributesDirective, itemContext), children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.slotBadgeLabel, props: { ...slotContext, itemContext } }) });
|
|
18
|
+
}
|
|
19
|
+
function Badges({ slotContext }) {
|
|
20
|
+
const badges = [];
|
|
21
|
+
for (const itemContext of slotContext.state.selectedContexts) {
|
|
22
|
+
badges.push(/* @__PURE__ */ jsxRuntime.jsx(BadgeContainer, { itemContext, slotContext }, itemContext.id));
|
|
23
|
+
}
|
|
24
|
+
return badges.length ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: badges }) : null;
|
|
25
|
+
}
|
|
26
|
+
function SelectItem({ itemContext, slotContext }) {
|
|
27
|
+
const classname = classNames("dropdown-item", "position-relative", { "text-bg-primary": itemContext === slotContext.state.highlighted });
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", { className: classname, ...directive.useDirective(slotContext.widget.directives.itemAttributesDirective, itemContext), children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.slotItem, props: { ...slotContext, itemContext } }) });
|
|
29
|
+
}
|
|
30
|
+
function Rows({ slotContext }) {
|
|
31
|
+
const {
|
|
32
|
+
directives: { hasFocusDirective, floatingDirective, menuAttributesDirective }
|
|
33
|
+
} = slotContext.widget;
|
|
34
|
+
return /* @__PURE__ */ jsxRuntime.jsx("ul", { ...directive.useDirectives([directive.classDirective, "dropdown-menu show"], hasFocusDirective, floatingDirective, menuAttributesDirective), children: slotContext.state.visibleItems.map((itemContext) => {
|
|
35
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { slotContext, itemContext }, itemContext.id);
|
|
36
|
+
}) });
|
|
37
|
+
}
|
|
38
|
+
const defaultConfig = {
|
|
39
|
+
slotBadgeLabel: DefaultBadge,
|
|
40
|
+
slotItem: DefaultItem
|
|
41
|
+
};
|
|
42
|
+
function Select(props) {
|
|
43
|
+
const [state, widget] = generated_config.useWidgetWithConfig(createSelect, props, "select", defaultConfig);
|
|
44
|
+
const slotContext = { state, widget: types.toSlotContextWidget(widget) };
|
|
45
|
+
const { id, ariaLabel, visibleItems, filterText, open, className } = state;
|
|
46
|
+
const menuId = `${id}-menu`;
|
|
47
|
+
const {
|
|
48
|
+
directives: { hasFocusDirective, referenceDirective, inputContainerDirective }
|
|
49
|
+
} = widget;
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...directive.useDirectives([directive.classDirective, `au-select dropdown border border-1 p-1 mb-3 d-block ${className}`], referenceDirective), children: [
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { ...directive.useDirectives([directive.classDirective, "d-flex align-items-center flex-wrap gap-1"], hasFocusDirective, inputContainerDirective), children: [
|
|
52
|
+
/* @__PURE__ */ jsxRuntime.jsx(Badges, { slotContext }),
|
|
53
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
+
"input",
|
|
55
|
+
{
|
|
56
|
+
id,
|
|
57
|
+
"aria-label": ariaLabel,
|
|
58
|
+
className: "au-select-input flex-grow-1 border-0",
|
|
59
|
+
type: "text",
|
|
60
|
+
value: filterText,
|
|
61
|
+
"aria-autocomplete": "list",
|
|
62
|
+
autoCorrect: "off",
|
|
63
|
+
autoCapitalize: "none",
|
|
64
|
+
autoComplete: "off",
|
|
65
|
+
onInput: widget.actions.onInput,
|
|
66
|
+
onKeyDown: (e) => widget.actions.onInputKeydown(e.nativeEvent)
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
] }),
|
|
70
|
+
open && visibleItems.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Rows, { slotContext, menuId })
|
|
71
|
+
] });
|
|
72
|
+
}
|
|
73
|
+
exports.Select = Select;
|
|
74
|
+
exports.createSelect = createSelect;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core-bootstrap/services/transitions';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useDirective } from "@agnos-ui/react-headless/utils/directive";
|
|
3
|
+
import { useWidgetWithConfig } from "./generated/config.js";
|
|
4
|
+
import { toSlotContextWidget } from "@agnos-ui/react-headless/types";
|
|
5
|
+
import React__default from "react";
|
|
6
|
+
import { Slot } from "@agnos-ui/react-headless/slot";
|
|
7
|
+
import { createSlider as createSlider$1 } from "@agnos-ui/core-bootstrap/components/slider";
|
|
8
|
+
const createSlider = createSlider$1;
|
|
9
|
+
const DefaultSlotHandle = (slotContext) => {
|
|
10
|
+
return /* @__PURE__ */ jsx("button", { ...useDirective(slotContext.widget.directives.handleDirective, { item: slotContext.item }), children: " " });
|
|
11
|
+
};
|
|
12
|
+
const ProgressDisplay = ({ directive, option }) => {
|
|
13
|
+
return /* @__PURE__ */ jsx("div", { ...useDirective(directive, { option }) });
|
|
14
|
+
};
|
|
15
|
+
const HandleLabelDisplay = ({
|
|
16
|
+
directive,
|
|
17
|
+
index,
|
|
18
|
+
children
|
|
19
|
+
}) => {
|
|
20
|
+
return /* @__PURE__ */ jsx("div", { ...useDirective(directive, { index }), children });
|
|
21
|
+
};
|
|
22
|
+
const MinMaxLabels = (slotContext) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23
|
+
/* @__PURE__ */ jsx("div", { ...useDirective(slotContext.widget.directives.minLabelDirective), children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.slotLabel, props: { value: slotContext.state.min, ...slotContext } }) }),
|
|
24
|
+
/* @__PURE__ */ jsx("div", { ...useDirective(slotContext.widget.directives.maxLabelDirective), children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.slotLabel, props: { value: slotContext.state.max, ...slotContext } }) })
|
|
25
|
+
] });
|
|
26
|
+
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.slotLabel, props: { value: slotContext.state.sortedValues[1], ...slotContext } }),
|
|
28
|
+
" - ",
|
|
29
|
+
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.slotLabel, props: { value: slotContext.state.sortedValues[0], ...slotContext } })
|
|
30
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
31
|
+
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.slotLabel, props: { value: slotContext.state.sortedValues[0], ...slotContext } }),
|
|
32
|
+
" - ",
|
|
33
|
+
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.slotLabel, props: { value: slotContext.state.sortedValues[1], ...slotContext } })
|
|
34
|
+
] }) });
|
|
35
|
+
const DefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
|
+
slotContext.state.progressDisplayOptions.map((option, index) => /* @__PURE__ */ jsx(ProgressDisplay, { directive: slotContext.widget.directives.progressDisplayDirective, option }, index)),
|
|
37
|
+
/* @__PURE__ */ jsx("div", { ...useDirective(slotContext.widget.directives.clickableAreaDirective) }),
|
|
38
|
+
slotContext.state.showMinMaxLabels && /* @__PURE__ */ jsx(MinMaxLabels, { ...slotContext }),
|
|
39
|
+
slotContext.state.showValueLabels && slotContext.state.combinedLabelDisplay && /* @__PURE__ */ jsx(CombinedLabel, { ...slotContext }),
|
|
40
|
+
slotContext.state.sortedHandles.map((item, i) => /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.slotHandle, props: { item, ...slotContext } }),
|
|
42
|
+
slotContext.state.showValueLabels && !slotContext.state.combinedLabelDisplay && /* @__PURE__ */ jsx(HandleLabelDisplay, { directive: slotContext.widget.directives.handleLabelDisplayDirective, index: i, children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.slotLabel, props: { value: slotContext.state.values[i], ...slotContext } }) })
|
|
43
|
+
] }, item.id))
|
|
44
|
+
] });
|
|
45
|
+
const defaultConfig = {
|
|
46
|
+
slotStructure: DefaultSlotStructure,
|
|
47
|
+
slotHandle: DefaultSlotHandle
|
|
48
|
+
};
|
|
49
|
+
function Slider(props) {
|
|
50
|
+
const [state, widget] = useWidgetWithConfig(createSlider, props, "slider", { ...defaultConfig });
|
|
51
|
+
const slotContext = { state, widget: toSlotContextWidget(widget) };
|
|
52
|
+
return /* @__PURE__ */ jsx("div", { ...useDirective(widget.directives.sliderDirective), children: /* @__PURE__ */ jsx(Slot, { slotContent: state.slotStructure, props: slotContext }) });
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
DefaultSlotHandle as D,
|
|
56
|
+
Slider as S,
|
|
57
|
+
DefaultSlotStructure as a,
|
|
58
|
+
createSlider as c
|
|
59
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const directive = require("@agnos-ui/react-headless/utils/directive");
|
|
4
|
+
const generated_config = require("./generated/config.cjs");
|
|
5
|
+
const types = require("@agnos-ui/react-headless/types");
|
|
6
|
+
const React = require("react");
|
|
7
|
+
const slot = require("@agnos-ui/react-headless/slot");
|
|
8
|
+
const slider = require("@agnos-ui/core-bootstrap/components/slider");
|
|
9
|
+
const createSlider = slider.createSlider;
|
|
10
|
+
const DefaultSlotHandle = (slotContext) => {
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx("button", { ...directive.useDirective(slotContext.widget.directives.handleDirective, { item: slotContext.item }), children: " " });
|
|
12
|
+
};
|
|
13
|
+
const ProgressDisplay = ({ directive: directive$1, option }) => {
|
|
14
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(directive$1, { option }) });
|
|
15
|
+
};
|
|
16
|
+
const HandleLabelDisplay = ({
|
|
17
|
+
directive: directive$1,
|
|
18
|
+
index,
|
|
19
|
+
children
|
|
20
|
+
}) => {
|
|
21
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(directive$1, { index }), children });
|
|
22
|
+
};
|
|
23
|
+
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.slotLabel, props: { value: slotContext.state.min, ...slotContext } }) }),
|
|
25
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(slotContext.widget.directives.maxLabelDirective), children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.slotLabel, props: { value: slotContext.state.max, ...slotContext } }) })
|
|
26
|
+
] });
|
|
27
|
+
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.slotLabel, props: { value: slotContext.state.sortedValues[1], ...slotContext } }),
|
|
29
|
+
" - ",
|
|
30
|
+
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.slotLabel, props: { value: slotContext.state.sortedValues[0], ...slotContext } })
|
|
31
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
32
|
+
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.slotLabel, props: { value: slotContext.state.sortedValues[0], ...slotContext } }),
|
|
33
|
+
" - ",
|
|
34
|
+
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.slotLabel, props: { value: slotContext.state.sortedValues[1], ...slotContext } })
|
|
35
|
+
] }) });
|
|
36
|
+
const DefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
37
|
+
slotContext.state.progressDisplayOptions.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(ProgressDisplay, { directive: slotContext.widget.directives.progressDisplayDirective, option }, index)),
|
|
38
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(slotContext.widget.directives.clickableAreaDirective) }),
|
|
39
|
+
slotContext.state.showMinMaxLabels && /* @__PURE__ */ jsxRuntime.jsx(MinMaxLabels, { ...slotContext }),
|
|
40
|
+
slotContext.state.showValueLabels && slotContext.state.combinedLabelDisplay && /* @__PURE__ */ jsxRuntime.jsx(CombinedLabel, { ...slotContext }),
|
|
41
|
+
slotContext.state.sortedHandles.map((item, i) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
42
|
+
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.slotHandle, props: { item, ...slotContext } }),
|
|
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.slotLabel, props: { value: slotContext.state.values[i], ...slotContext } }) })
|
|
44
|
+
] }, item.id))
|
|
45
|
+
] });
|
|
46
|
+
const defaultConfig = {
|
|
47
|
+
slotStructure: DefaultSlotStructure,
|
|
48
|
+
slotHandle: DefaultSlotHandle
|
|
49
|
+
};
|
|
50
|
+
function Slider(props) {
|
|
51
|
+
const [state, widget] = generated_config.useWidgetWithConfig(createSlider, props, "slider", { ...defaultConfig });
|
|
52
|
+
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.slotStructure, props: slotContext }) });
|
|
54
|
+
}
|
|
55
|
+
exports.DefaultSlotHandle = DefaultSlotHandle;
|
|
56
|
+
exports.DefaultSlotStructure = DefaultSlotStructure;
|
|
57
|
+
exports.Slider = Slider;
|
|
58
|
+
exports.createSlider = createSlider;
|