@agnos-ui/react-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.
Files changed (69) hide show
  1. package/README.md +2 -2
  2. package/{accordion-DKdL2Sr3.js → accordion-BX1iR5BO.js} +19 -22
  3. package/{accordion-CG9yl3xh.cjs → accordion-CxT3atuW.cjs} +12 -15
  4. package/{alert-0W1n8ahW.js → alert-D1FXDsJn.js} +12 -16
  5. package/{alert-DeQRFTm3.cjs → alert-LKMMYmg_.cjs} +9 -13
  6. package/collapse-BpPYsx89.cjs +18 -0
  7. package/collapse-DhsL8j2h.js +19 -0
  8. package/components/accordion/accordion.d.ts +40 -1
  9. package/components/accordion/accordion.gen.d.ts +37 -9
  10. package/components/accordion/index.cjs +2 -1
  11. package/components/accordion/index.js +7 -6
  12. package/components/alert/alert.d.ts +19 -1
  13. package/components/alert/alert.gen.d.ts +21 -2
  14. package/components/alert/index.cjs +2 -1
  15. package/components/alert/index.js +4 -3
  16. package/components/collapse/collapse.d.ts +15 -0
  17. package/components/collapse/collapse.gen.d.ts +146 -0
  18. package/components/collapse/index.cjs +6 -0
  19. package/components/collapse/index.d.ts +2 -0
  20. package/components/collapse/index.js +6 -0
  21. package/components/modal/index.cjs +3 -1
  22. package/components/modal/index.js +7 -5
  23. package/components/modal/modal.d.ts +34 -1
  24. package/components/modal/modal.gen.d.ts +35 -18
  25. package/components/pagination/index.cjs +3 -3
  26. package/components/pagination/index.js +5 -5
  27. package/components/pagination/pageItem.d.ts +35 -3
  28. package/components/pagination/pagination.d.ts +34 -2
  29. package/components/pagination/pagination.gen.d.ts +49 -29
  30. package/components/progressbar/index.cjs +2 -1
  31. package/components/progressbar/index.js +4 -3
  32. package/components/progressbar/progressbar.d.ts +16 -1
  33. package/components/progressbar/progressbar.gen.d.ts +21 -4
  34. package/components/rating/index.cjs +1 -1
  35. package/components/rating/index.js +1 -1
  36. package/components/rating/rating.d.ts +11 -0
  37. package/components/rating/rating.gen.d.ts +25 -17
  38. package/components/select/index.cjs +1 -1
  39. package/components/select/index.js +1 -1
  40. package/components/select/select.d.ts +15 -0
  41. package/components/select/select.gen.d.ts +41 -25
  42. package/components/slider/index.cjs +3 -3
  43. package/components/slider/index.js +5 -5
  44. package/components/slider/slider.d.ts +26 -2
  45. package/components/slider/slider.gen.d.ts +54 -33
  46. package/components/toast/index.cjs +2 -1
  47. package/components/toast/index.js +4 -3
  48. package/components/toast/toast.d.ts +20 -1
  49. package/components/toast/toast.gen.d.ts +22 -2
  50. package/config.d.ts +9 -2
  51. package/config.gen.d.ts +5 -0
  52. package/index.cjs +26 -16
  53. package/index.d.ts +1 -0
  54. package/index.js +51 -41
  55. package/{modal-qidZ4ghL.js → modal-CWuYx5n5.js} +23 -29
  56. package/{modal-Cyt40iyH.cjs → modal-DpMvOtL2.cjs} +17 -23
  57. package/package.json +6 -5
  58. package/{pagination-BDq1dOoH.js → pagination-5jlJWfFj.js} +19 -22
  59. package/{pagination-ChA90-py.cjs → pagination-b4pKj3Kx.cjs} +17 -20
  60. package/{progressbar-B0keLNtE.js → progressbar-DKFR5epE.js} +9 -10
  61. package/{progressbar-Fa1PDviu.cjs → progressbar-JO1ey9mx.cjs} +7 -8
  62. package/{rating-CWOEBPWs.js → rating-CTfRQGGu.js} +2 -2
  63. package/{rating-D5-3ELHv.cjs → rating-eI8T0zvS.cjs} +2 -2
  64. package/{select-DmgOBdqs.js → select-BriGqe3k.js} +15 -32
  65. package/{select-C4STYCmG.cjs → select-XHUAqTDw.cjs} +15 -32
  66. package/{slider-CxodlRoZ.js → slider--K7ri_0l.js} +18 -21
  67. package/{slider-MNZTN_vu.cjs → slider-BUQne5aJ.cjs} +16 -19
  68. package/{toast-3amUxqw1.js → toast-Dgfv5S_p.js} +16 -19
  69. package/{toast-BXMjE9E3.cjs → toast-E1DM85iZ.cjs} +13 -16
package/config.gen.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { AccordionProps } from './components/accordion';
2
2
  import type { AlertProps } from './components/alert';
3
+ import type { CollapseProps } from './components/collapse';
3
4
  import type { ModalProps } from './components/modal';
4
5
  import type { PaginationProps } from './components/pagination';
5
6
  import type { ProgressbarProps } from './components/progressbar';
@@ -16,6 +17,10 @@ export type WidgetsConfig = {
16
17
  * the alert widget config
17
18
  */
18
19
  alert: AlertProps;
20
+ /**
21
+ * the collapse widget config
22
+ */
23
+ collapse: CollapseProps;
19
24
  /**
20
25
  * the modal widget config
21
26
  */
package/index.cjs CHANGED
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const accordion = require("./accordion-CG9yl3xh.cjs");
4
- const alert = require("./alert-DeQRFTm3.cjs");
5
- const modal = require("./modal-Cyt40iyH.cjs");
6
- const pagination = require("./pagination-ChA90-py.cjs");
7
- const progressbar = require("./progressbar-Fa1PDviu.cjs");
8
- const rating = require("./rating-D5-3ELHv.cjs");
9
- const select = require("./select-C4STYCmG.cjs");
10
- const slider = require("./slider-MNZTN_vu.cjs");
11
- const toast = require("./toast-BXMjE9E3.cjs");
3
+ const accordion = require("./accordion-CxT3atuW.cjs");
4
+ const alert = require("./alert-LKMMYmg_.cjs");
5
+ const collapse = require("./collapse-BpPYsx89.cjs");
6
+ const modal = require("./modal-DpMvOtL2.cjs");
7
+ const pagination = require("./pagination-b4pKj3Kx.cjs");
8
+ const progressbar = require("./progressbar-JO1ey9mx.cjs");
9
+ const rating = require("./rating-eI8T0zvS.cjs");
10
+ const select = require("./select-XHUAqTDw.cjs");
11
+ const slider = require("./slider-BUQne5aJ.cjs");
12
+ const toast = require("./toast-E1DM85iZ.cjs");
12
13
  const types = require("@agnos-ui/react-headless/types");
13
14
  const slot = require("@agnos-ui/react-headless/slot");
14
15
  const config = require("@agnos-ui/react-headless/config");
@@ -30,32 +31,40 @@ const floatingUI = require("@agnos-ui/react-headless/services/floatingUI");
30
31
  const extendWidget = require("@agnos-ui/react-headless/services/extendWidget");
31
32
  const simpleClassTransition = require("@agnos-ui/react-headless/services/transitions/simpleClassTransition");
32
33
  const cssTransitions = require("@agnos-ui/react-headless/services/transitions/cssTransitions");
33
- const collapse = require("@agnos-ui/react-headless/services/transitions/collapse");
34
+ const collapse$1 = require("@agnos-ui/react-headless/services/transitions/collapse");
34
35
  const baseTransitions = require("@agnos-ui/react-headless/services/transitions/baseTransitions");
35
36
  const transitions = require("@agnos-ui/core-bootstrap/services/transitions");
36
37
  exports.Accordion = accordion.Accordion;
37
38
  exports.AccordionItem = accordion.AccordionItem;
39
+ exports.AccordionItemDefaultSlotStructure = accordion.AccordionItemDefaultSlotStructure;
38
40
  exports.createAccordion = accordion.export_createAccordion;
39
41
  exports.createAccordionItem = accordion.export_createAccordionItem;
40
42
  exports.factoryCreateAccordion = accordion.export_factoryCreateAccordion;
41
43
  exports.getAccordionDefaultConfig = accordion.export_getAccordionDefaultConfig;
42
44
  exports.Alert = alert.Alert;
45
+ exports.AlertDefaultSlotStructure = alert.AlertDefaultSlotStructure;
43
46
  exports.createAlert = alert.export_createAlert;
44
47
  exports.getAlertDefaultConfig = alert.export_getAlertDefaultConfig;
48
+ exports.Collapse = collapse.Collapse;
49
+ exports.createCollapse = collapse.export_createCollapse;
50
+ exports.getCollapseDefaultConfig = collapse.export_getCollapseDefaultConfig;
45
51
  exports.Modal = modal.Modal;
52
+ exports.ModalDefaultSlotHeader = modal.ModalDefaultSlotHeader;
53
+ exports.ModalDefaultSlotStructure = modal.ModalDefaultSlotStructure;
46
54
  exports.createModal = modal.export_createModal;
47
55
  exports.getModalDefaultConfig = modal.export_getModalDefaultConfig;
48
56
  exports.modalCloseButtonClick = modal.export_modalCloseButtonClick;
49
57
  exports.modalOutsideClick = modal.export_modalOutsideClick;
50
58
  exports.openModal = modal.openModal;
51
- exports.DefaultPages = pagination.DefaultPages;
52
- exports.DefaultStructure = pagination.DefaultStructure;
53
59
  exports.NavButton = pagination.NavButton;
54
60
  exports.PageItem = pagination.PageItem;
55
61
  exports.Pagination = pagination.Pagination;
62
+ exports.PaginationDefaultSlotPages = pagination.PaginationDefaultSlotPages;
63
+ exports.PaginationDefaultSlotStructure = pagination.PaginationDefaultSlotStructure;
56
64
  exports.createPagination = pagination.export_createPagination;
57
65
  exports.getPaginationDefaultConfig = pagination.export_getPaginationDefaultConfig;
58
66
  exports.Progressbar = progressbar.Progressbar;
67
+ exports.ProgressbarDefaultSlotStructure = progressbar.ProgressbarDefaultSlotStructure;
59
68
  exports.createProgressbar = progressbar.export_createProgressbar;
60
69
  exports.getProgressbarDefaultConfig = progressbar.export_getProgressbarDefaultConfig;
61
70
  exports.Rating = rating.Rating;
@@ -64,12 +73,13 @@ exports.getRatingDefaultConfig = rating.export_getRatingDefaultConfig;
64
73
  exports.Select = select.Select;
65
74
  exports.createSelect = select.export_createSelect;
66
75
  exports.getSelectDefaultConfig = select.export_getSelectDefaultConfig;
67
- exports.DefaultSlotHandle = slider.DefaultSlotHandle;
68
- exports.DefaultSlotStructure = slider.DefaultSlotStructure;
69
76
  exports.Slider = slider.Slider;
77
+ exports.SliderDefaultSlotHandle = slider.SliderDefaultSlotHandle;
78
+ exports.SliderDefaultSlotStructure = slider.SliderDefaultSlotStructure;
70
79
  exports.createSlider = slider.export_createSlider;
71
80
  exports.getSliderDefaultConfig = slider.export_getSliderDefaultConfig;
72
81
  exports.Toast = toast.Toast;
82
+ exports.ToastDefaultSlotStructure = toast.ToastDefaultSlotStructure;
73
83
  exports.createToast = toast.export_createToast;
74
84
  exports.getToastDefaultConfig = toast.export_getToastDefaultConfig;
75
85
  exports.WidgetsDefaultConfig = generated_config.WidgetsDefaultConfig;
@@ -196,10 +206,10 @@ Object.keys(cssTransitions).forEach((k) => {
196
206
  get: () => cssTransitions[k]
197
207
  });
198
208
  });
199
- Object.keys(collapse).forEach((k) => {
209
+ Object.keys(collapse$1).forEach((k) => {
200
210
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
201
211
  enumerable: true,
202
- get: () => collapse[k]
212
+ get: () => collapse$1[k]
203
213
  });
204
214
  });
205
215
  Object.keys(baseTransitions).forEach((k) => {
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './components/accordion';
2
2
  export * from './components/alert';
3
+ export * from './components/collapse';
3
4
  export * from './components/modal';
4
5
  export * from './components/pagination';
5
6
  export * from './components/progressbar';
package/index.js CHANGED
@@ -1,12 +1,13 @@
1
- import { a, A, c, b, d, e } from "./accordion-DKdL2Sr3.js";
2
- import { A as A2, a as a2, e as e2 } from "./alert-0W1n8ahW.js";
3
- import { M, a as a3, e as e3, c as c2, b as b2, o } from "./modal-qidZ4ghL.js";
4
- import { D, a as a4, N, P, b as b3, c as c3, e as e4 } from "./pagination-BDq1dOoH.js";
5
- import { P as P2, a as a5, e as e5 } from "./progressbar-B0keLNtE.js";
6
- import { R, a as a6, e as e6 } from "./rating-CWOEBPWs.js";
7
- import { S, a as a7, e as e7 } from "./select-DmgOBdqs.js";
8
- import { D as D2, a as a8, S as S2, b as b4, e as e8 } from "./slider-CxodlRoZ.js";
9
- import { T, a as a9, e as e9 } from "./toast-3amUxqw1.js";
1
+ import { b, a, A, d, c, f, e } from "./accordion-BX1iR5BO.js";
2
+ import { a as a2, A as A2, b as b2, e as e2 } from "./alert-D1FXDsJn.js";
3
+ import { C, a as a3, e as e3 } from "./collapse-DhsL8j2h.js";
4
+ import { b as b3, M, a as a4, c as c2, e as e4, f as f2, d as d2, o } from "./modal-CWuYx5n5.js";
5
+ import { N, P, c as c3, a as a5, b as b4, d as d3, e as e5 } from "./pagination-5jlJWfFj.js";
6
+ import { a as a6, P as P2, b as b5, e as e6 } from "./progressbar-DKFR5epE.js";
7
+ import { R, a as a7, e as e7 } from "./rating-CTfRQGGu.js";
8
+ import { S, a as a8, e as e8 } from "./select-BriGqe3k.js";
9
+ import { b as b6, S as S2, a as a9, c as c4, e as e9 } from "./slider--K7ri_0l.js";
10
+ import { a as a10, T, b as b7, e as e10 } from "./toast-Dgfv5S_p.js";
10
11
  export * from "@agnos-ui/react-headless/types";
11
12
  export * from "@agnos-ui/react-headless/slot";
12
13
  export * from "@agnos-ui/react-headless/config";
@@ -32,45 +33,54 @@ export * from "@agnos-ui/react-headless/services/transitions/collapse";
32
33
  export * from "@agnos-ui/react-headless/services/transitions/baseTransitions";
33
34
  export * from "@agnos-ui/core-bootstrap/services/transitions";
34
35
  export {
35
- a as Accordion,
36
- A as AccordionItem,
37
- A2 as Alert,
38
- D as DefaultPages,
39
- D2 as DefaultSlotHandle,
40
- a8 as DefaultSlotStructure,
41
- a4 as DefaultStructure,
42
- M as Modal,
36
+ b as Accordion,
37
+ a as AccordionItem,
38
+ A as AccordionItemDefaultSlotStructure,
39
+ a2 as Alert,
40
+ A2 as AlertDefaultSlotStructure,
41
+ C as Collapse,
42
+ b3 as Modal,
43
+ M as ModalDefaultSlotHeader,
44
+ a4 as ModalDefaultSlotStructure,
43
45
  N as NavButton,
44
46
  P as PageItem,
45
- b3 as Pagination,
46
- P2 as Progressbar,
47
+ c3 as Pagination,
48
+ a5 as PaginationDefaultSlotPages,
49
+ b4 as PaginationDefaultSlotStructure,
50
+ a6 as Progressbar,
51
+ P2 as ProgressbarDefaultSlotStructure,
47
52
  R as Rating,
48
53
  S as Select,
49
- S2 as Slider,
50
- T as Toast,
54
+ b6 as Slider,
55
+ S2 as SliderDefaultSlotHandle,
56
+ a9 as SliderDefaultSlotStructure,
57
+ a10 as Toast,
58
+ T as ToastDefaultSlotStructure,
51
59
  WidgetsDefaultConfig,
52
- c as createAccordion,
53
- b as createAccordionItem,
54
- a2 as createAlert,
55
- a3 as createModal,
56
- c3 as createPagination,
57
- a5 as createProgressbar,
58
- a6 as createRating,
59
- a7 as createSelect,
60
- b4 as createSlider,
61
- a9 as createToast,
62
- d as factoryCreateAccordion,
60
+ d as createAccordion,
61
+ c as createAccordionItem,
62
+ b2 as createAlert,
63
+ a3 as createCollapse,
64
+ c2 as createModal,
65
+ d3 as createPagination,
66
+ b5 as createProgressbar,
67
+ a7 as createRating,
68
+ a8 as createSelect,
69
+ c4 as createSlider,
70
+ b7 as createToast,
71
+ f as factoryCreateAccordion,
63
72
  e as getAccordionDefaultConfig,
64
73
  e2 as getAlertDefaultConfig,
65
- e3 as getModalDefaultConfig,
66
- e4 as getPaginationDefaultConfig,
67
- e5 as getProgressbarDefaultConfig,
68
- e6 as getRatingDefaultConfig,
69
- e7 as getSelectDefaultConfig,
70
- e8 as getSliderDefaultConfig,
71
- e9 as getToastDefaultConfig,
72
- c2 as modalCloseButtonClick,
73
- b2 as modalOutsideClick,
74
+ e3 as getCollapseDefaultConfig,
75
+ e4 as getModalDefaultConfig,
76
+ e5 as getPaginationDefaultConfig,
77
+ e6 as getProgressbarDefaultConfig,
78
+ e7 as getRatingDefaultConfig,
79
+ e8 as getSelectDefaultConfig,
80
+ e9 as getSliderDefaultConfig,
81
+ e10 as getToastDefaultConfig,
82
+ f2 as modalCloseButtonClick,
83
+ d2 as modalOutsideClick,
74
84
  o as openModal,
75
85
  useWidgetContext,
76
86
  useWidgetWithConfig,
@@ -1,7 +1,6 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { Slot } from "@agnos-ui/react-headless/slot";
3
- import { toSlotContextWidget } from "@agnos-ui/react-headless/types";
4
- import { useDirectives, classDirective, useDirective } from "@agnos-ui/react-headless/utils/directive";
3
+ import { useDirective, useDirectives, classDirective } from "@agnos-ui/react-headless/utils/directive";
5
4
  import { Portal } from "@agnos-ui/react-headless/utils/portal";
6
5
  import classNames from "classnames";
7
6
  import { forwardRef, useImperativeHandle } from "react";
@@ -13,36 +12,29 @@ const export_createModal = createModal;
13
12
  const export_modalOutsideClick = modalOutsideClick;
14
13
  const export_modalCloseButtonClick = modalCloseButtonClick;
15
14
  const CloseButton = ({ directive }) => /* @__PURE__ */ jsx("button", { className: "btn-close", ...useDirective(directive) });
16
- const DefaultSlotHeader = (slotContext) => {
17
- return /* @__PURE__ */ jsxs(Fragment, { children: [
18
- /* @__PURE__ */ jsx("h5", { className: "modal-title", children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.title, props: slotContext }) }),
19
- slotContext.state.closeButton && /* @__PURE__ */ jsx(CloseButton, { directive: slotContext.widget.directives.closeButtonDirective })
20
- ] });
21
- };
22
- const DefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxs(Fragment, { children: [
15
+ const ModalDefaultSlotHeader = (slotContext) => /* @__PURE__ */ jsxs(Fragment, { children: [
16
+ /* @__PURE__ */ jsx("h5", { className: "modal-title", children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.title, props: slotContext }) }),
17
+ slotContext.state.closeButton && /* @__PURE__ */ jsx(CloseButton, { directive: slotContext.directives.closeButtonDirective })
18
+ ] });
19
+ const ModalDefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxs(Fragment, { children: [
23
20
  slotContext.state.title && /* @__PURE__ */ jsx("div", { className: "modal-header", children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.header, props: slotContext }) }),
24
21
  /* @__PURE__ */ jsx("div", { className: "modal-body", children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.children, props: slotContext }) }),
25
22
  slotContext.state.footer && /* @__PURE__ */ jsx("div", { className: "modal-footer", children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.footer, props: slotContext }) })
26
23
  ] });
27
- const defaultConfig = {
28
- header: DefaultSlotHeader,
29
- structure: DefaultSlotStructure
30
- };
31
- const BackdropElement = ({ widget }) => /* @__PURE__ */ jsx("div", { ...useDirectives([classDirective, "modal-backdrop"], widget.directives.backdropDirective) });
24
+ const BackdropElement = ({ directives }) => /* @__PURE__ */ jsx("div", { ...useDirectives([classDirective, "modal-backdrop"], directives.backdropDirective) });
32
25
  const ModalElement = (slotContext) => {
33
26
  const { fullscreen } = slotContext.state;
34
- return /* @__PURE__ */ jsx("div", { ...useDirectives([classDirective, "modal d-block"], slotContext.widget.directives.modalDirective), children: /* @__PURE__ */ jsx("div", { className: classNames("modal-dialog", { "modal-fullscreen": fullscreen }), children: /* @__PURE__ */ jsx("div", { className: "modal-content", children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.structure, props: slotContext }) }) }) });
27
+ return /* @__PURE__ */ jsx("div", { ...useDirectives([classDirective, "modal d-block"], slotContext.directives.modalDirective), children: /* @__PURE__ */ jsx("div", { className: classNames("modal-dialog", { "modal-fullscreen": fullscreen }), children: /* @__PURE__ */ jsx("div", { className: "modal-content", children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.structure, props: slotContext }) }) }) });
35
28
  };
36
29
  const Modal = forwardRef(function Modal2(props, ref) {
37
- const [state, widget] = useWidgetWithConfig(export_createModal, props, "modal", defaultConfig);
38
- useImperativeHandle(ref, () => widget.api, []);
39
- const slotContext = {
40
- state,
41
- widget: toSlotContextWidget(widget)
42
- };
43
- return /* @__PURE__ */ jsxs(Portal, { container: state.container, children: [
44
- !state.backdropHidden && /* @__PURE__ */ jsx(BackdropElement, { ...slotContext }),
45
- !state.hidden && /* @__PURE__ */ jsx(ModalElement, { ...slotContext })
30
+ const widgetContext = useWidgetWithConfig(export_createModal, props, "modal", {
31
+ header: ModalDefaultSlotHeader,
32
+ structure: ModalDefaultSlotStructure
33
+ });
34
+ useImperativeHandle(ref, () => widgetContext.api, []);
35
+ return /* @__PURE__ */ jsxs(Portal, { container: widgetContext.state.container, children: [
36
+ !widgetContext.state.backdropHidden && /* @__PURE__ */ jsx(BackdropElement, { ...widgetContext }),
37
+ !widgetContext.state.hidden && /* @__PURE__ */ jsx(ModalElement, { ...widgetContext })
46
38
  ] });
47
39
  });
48
40
  async function openModal(options) {
@@ -57,10 +49,12 @@ async function openModal(options) {
57
49
  }
58
50
  }
59
51
  export {
60
- Modal as M,
61
- export_createModal as a,
62
- export_modalOutsideClick as b,
63
- export_modalCloseButtonClick as c,
52
+ ModalDefaultSlotHeader as M,
53
+ ModalDefaultSlotStructure as a,
54
+ Modal as b,
55
+ export_createModal as c,
56
+ export_modalOutsideClick as d,
64
57
  export_getModalDefaultConfig as e,
58
+ export_modalCloseButtonClick as f,
65
59
  openModal as o
66
60
  };
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
3
  const slot = require("@agnos-ui/react-headless/slot");
4
- const types = require("@agnos-ui/react-headless/types");
5
4
  const directive = require("@agnos-ui/react-headless/utils/directive");
6
5
  const portal = require("@agnos-ui/react-headless/utils/portal");
7
6
  const classNames = require("classnames");
@@ -14,36 +13,29 @@ const export_createModal = modal.createModal;
14
13
  const export_modalOutsideClick = modal.modalOutsideClick;
15
14
  const export_modalCloseButtonClick = modal.modalCloseButtonClick;
16
15
  const CloseButton = ({ directive: directive$1 }) => /* @__PURE__ */ jsxRuntime.jsx("button", { className: "btn-close", ...directive.useDirective(directive$1) });
17
- const DefaultSlotHeader = (slotContext) => {
18
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
19
- /* @__PURE__ */ jsxRuntime.jsx("h5", { className: "modal-title", children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.title, props: slotContext }) }),
20
- slotContext.state.closeButton && /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { directive: slotContext.widget.directives.closeButtonDirective })
21
- ] });
22
- };
23
- const DefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16
+ const ModalDefaultSlotHeader = (slotContext) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17
+ /* @__PURE__ */ jsxRuntime.jsx("h5", { className: "modal-title", children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.title, props: slotContext }) }),
18
+ slotContext.state.closeButton && /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { directive: slotContext.directives.closeButtonDirective })
19
+ ] });
20
+ const ModalDefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
24
21
  slotContext.state.title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "modal-header", children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.header, props: slotContext }) }),
25
22
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "modal-body", children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.children, props: slotContext }) }),
26
23
  slotContext.state.footer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "modal-footer", children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.footer, props: slotContext }) })
27
24
  ] });
28
- const defaultConfig = {
29
- header: DefaultSlotHeader,
30
- structure: DefaultSlotStructure
31
- };
32
- const BackdropElement = ({ widget }) => /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirectives([directive.classDirective, "modal-backdrop"], widget.directives.backdropDirective) });
25
+ const BackdropElement = ({ directives }) => /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirectives([directive.classDirective, "modal-backdrop"], directives.backdropDirective) });
33
26
  const ModalElement = (slotContext) => {
34
27
  const { fullscreen } = slotContext.state;
35
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirectives([directive.classDirective, "modal d-block"], slotContext.widget.directives.modalDirective), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames("modal-dialog", { "modal-fullscreen": fullscreen }), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "modal-content", children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.structure, props: slotContext }) }) }) });
28
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirectives([directive.classDirective, "modal d-block"], slotContext.directives.modalDirective), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames("modal-dialog", { "modal-fullscreen": fullscreen }), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "modal-content", children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.structure, props: slotContext }) }) }) });
36
29
  };
37
30
  const Modal = React.forwardRef(function Modal2(props, ref) {
38
- const [state, widget] = generated_config.useWidgetWithConfig(export_createModal, props, "modal", defaultConfig);
39
- React.useImperativeHandle(ref, () => widget.api, []);
40
- const slotContext = {
41
- state,
42
- widget: types.toSlotContextWidget(widget)
43
- };
44
- return /* @__PURE__ */ jsxRuntime.jsxs(portal.Portal, { container: state.container, children: [
45
- !state.backdropHidden && /* @__PURE__ */ jsxRuntime.jsx(BackdropElement, { ...slotContext }),
46
- !state.hidden && /* @__PURE__ */ jsxRuntime.jsx(ModalElement, { ...slotContext })
31
+ const widgetContext = generated_config.useWidgetWithConfig(export_createModal, props, "modal", {
32
+ header: ModalDefaultSlotHeader,
33
+ structure: ModalDefaultSlotStructure
34
+ });
35
+ React.useImperativeHandle(ref, () => widgetContext.api, []);
36
+ return /* @__PURE__ */ jsxRuntime.jsxs(portal.Portal, { container: widgetContext.state.container, children: [
37
+ !widgetContext.state.backdropHidden && /* @__PURE__ */ jsxRuntime.jsx(BackdropElement, { ...widgetContext }),
38
+ !widgetContext.state.hidden && /* @__PURE__ */ jsxRuntime.jsx(ModalElement, { ...widgetContext })
47
39
  ] });
48
40
  });
49
41
  async function openModal(options) {
@@ -58,6 +50,8 @@ async function openModal(options) {
58
50
  }
59
51
  }
60
52
  exports.Modal = Modal;
53
+ exports.ModalDefaultSlotHeader = ModalDefaultSlotHeader;
54
+ exports.ModalDefaultSlotStructure = ModalDefaultSlotStructure;
61
55
  exports.export_createModal = export_createModal;
62
56
  exports.export_getModalDefaultConfig = export_getModalDefaultConfig;
63
57
  exports.export_modalCloseButtonClick = export_modalCloseButtonClick;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agnos-ui/react-bootstrap",
3
- "description": "Bootstrap-based widget library for React.",
4
- "version": "0.4.3",
3
+ "description": "Bootstrap-based component library for React.",
4
+ "version": "0.5.0-next.0",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",
7
7
  "module": "./index.js",
@@ -49,8 +49,8 @@
49
49
  }
50
50
  },
51
51
  "dependencies": {
52
- "@agnos-ui/core-bootstrap": "0.4.3",
53
- "@agnos-ui/react-headless": "0.4.3",
52
+ "@agnos-ui/core-bootstrap": "0.5.0-next.0",
53
+ "@agnos-ui/react-headless": "0.5.0-next.0",
54
54
  "classnames": "^2.5.1"
55
55
  },
56
56
  "peerDependencies": {
@@ -59,7 +59,7 @@
59
59
  "react-dom": "^18.3.1"
60
60
  },
61
61
  "sideEffects": false,
62
- "homepage": "https://amadeusitgroup.github.io/AgnosUI/latest/",
62
+ "homepage": "https://www.agnosui.dev/latest/",
63
63
  "bugs": "https://github.com/AmadeusITGroup/AgnosUI/issues",
64
64
  "license": "MIT",
65
65
  "repository": {
@@ -73,6 +73,7 @@
73
73
  "accordion",
74
74
  "AgnosUI",
75
75
  "alert",
76
+ "collapse",
76
77
  "components",
77
78
  "modal",
78
79
  "pagination",
@@ -1,6 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { Slot } from "@agnos-ui/react-headless/slot";
3
- import { toSlotContextWidget } from "@agnos-ui/react-headless/types";
4
3
  import classNames from "classnames";
5
4
  import { useWidgetWithConfig } from "./generated/config.js";
6
5
  import * as React from "react";
@@ -21,8 +20,8 @@ const NavButton = React.forwardRef(({ disabled, className, children, directive }
21
20
  NavButton.displayName = "NavButton";
22
21
  const export_getPaginationDefaultConfig = getPaginationDefaultConfig;
23
22
  const export_createPagination = createPagination;
24
- function DefaultPages(slotContext) {
25
- const { widget, state } = slotContext;
23
+ const PaginationDefaultSlotPages = (slotContext) => {
24
+ const { state, directives } = slotContext;
26
25
  const jsxPages = [];
27
26
  for (let i = 0; i < state.pages.length; i++) {
28
27
  if (state.pages[i] === -1) {
@@ -40,7 +39,7 @@ function DefaultPages(slotContext) {
40
39
  disabled: state.disabled,
41
40
  active: state.pages[i] === state.page,
42
41
  activeLabel: state.activeLabel,
43
- directive: widget.directives["pageLink"],
42
+ directive: directives["pageLink"],
44
43
  page: state.pages[i],
45
44
  children: /* @__PURE__ */ jsx(Slot, { slotContent: state.numberLabel, props: { ...slotContext, displayedPage: state.pages[i] } })
46
45
  },
@@ -50,33 +49,29 @@ function DefaultPages(slotContext) {
50
49
  }
51
50
  }
52
51
  return jsxPages.length ? /* @__PURE__ */ jsx(Fragment, { children: jsxPages }) : null;
53
- }
54
- const defaultConfig = {
55
- pagesDisplay: DefaultPages,
56
- structure: DefaultStructure
57
52
  };
58
- function DefaultStructure(slotContext) {
59
- const { widget, state } = slotContext;
53
+ const PaginationDefaultSlotStructure = (slotContext) => {
54
+ const { state, directives } = slotContext;
60
55
  const ItemsBefore = [];
61
56
  const ItemsAfter = [];
62
57
  if (state.boundaryLinks) {
63
58
  ItemsBefore.push(
64
- /* @__PURE__ */ jsx(NavButton, { disabled: state.previousDisabled, directive: widget.directives["pageFirst"], children: /* @__PURE__ */ jsx(Slot, { slotContent: state.firstPageLabel, props: slotContext }) }, "first")
59
+ /* @__PURE__ */ jsx(NavButton, { disabled: state.previousDisabled, directive: directives.pageFirst, children: /* @__PURE__ */ jsx(Slot, { slotContent: state.firstPageLabel, props: slotContext }) }, "first")
65
60
  );
66
61
  }
67
62
  if (state.directionLinks) {
68
63
  ItemsBefore.push(
69
- /* @__PURE__ */ jsx(NavButton, { disabled: state.previousDisabled, directive: widget.directives["pagePrev"], children: /* @__PURE__ */ jsx(Slot, { slotContent: state.previousPageLabel, props: slotContext }) }, "prev")
64
+ /* @__PURE__ */ jsx(NavButton, { disabled: state.previousDisabled, directive: directives.pagePrev, children: /* @__PURE__ */ jsx(Slot, { slotContent: state.previousPageLabel, props: slotContext }) }, "prev")
70
65
  );
71
66
  }
72
67
  if (state.directionLinks) {
73
68
  ItemsAfter.push(
74
- /* @__PURE__ */ jsx(NavButton, { disabled: state.nextDisabled, directive: widget.directives["pageNext"], children: /* @__PURE__ */ jsx(Slot, { slotContent: state.nextPageLabel, props: slotContext }) }, "next")
69
+ /* @__PURE__ */ jsx(NavButton, { disabled: state.nextDisabled, directive: directives.pageNext, children: /* @__PURE__ */ jsx(Slot, { slotContent: state.nextPageLabel, props: slotContext }) }, "next")
75
70
  );
76
71
  }
77
72
  if (state.boundaryLinks) {
78
73
  ItemsAfter.push(
79
- /* @__PURE__ */ jsx(NavButton, { disabled: state.nextDisabled, directive: widget.directives["pageLast"], children: /* @__PURE__ */ jsx(Slot, { slotContent: state.lastPageLabel, props: slotContext }) }, "last")
74
+ /* @__PURE__ */ jsx(NavButton, { disabled: state.nextDisabled, directive: directives["pageLast"], children: /* @__PURE__ */ jsx(Slot, { slotContent: state.lastPageLabel, props: slotContext }) }, "last")
80
75
  );
81
76
  }
82
77
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -87,18 +82,20 @@ function DefaultStructure(slotContext) {
87
82
  ] }),
88
83
  /* @__PURE__ */ jsx("div", { "aria-live": "polite", className: "visually-hidden", children: `${state.ariaLiveLabelText}` })
89
84
  ] });
90
- }
85
+ };
91
86
  function Pagination(props) {
92
- const [state, widget] = useWidgetWithConfig(export_createPagination, props, "pagination", defaultConfig);
93
- const slotContext = { state, widget: toSlotContextWidget(widget) };
94
- return /* @__PURE__ */ jsx("nav", { "aria-label": state.ariaLabel, children: /* @__PURE__ */ jsx(Slot, { slotContent: state.structure, props: slotContext }) });
87
+ const widgetContext = useWidgetWithConfig(export_createPagination, props, "pagination", {
88
+ pagesDisplay: PaginationDefaultSlotPages,
89
+ structure: PaginationDefaultSlotStructure
90
+ });
91
+ return /* @__PURE__ */ jsx("nav", { "aria-label": widgetContext.state.ariaLabel, children: /* @__PURE__ */ jsx(Slot, { slotContent: widgetContext.state.structure, props: widgetContext }) });
95
92
  }
96
93
  export {
97
- DefaultPages as D,
98
94
  NavButton as N,
99
95
  PageItem as P,
100
- DefaultStructure as a,
101
- Pagination as b,
102
- export_createPagination as c,
96
+ PaginationDefaultSlotPages as a,
97
+ PaginationDefaultSlotStructure as b,
98
+ Pagination as c,
99
+ export_createPagination as d,
103
100
  export_getPaginationDefaultConfig as e
104
101
  };
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
3
  const slot = require("@agnos-ui/react-headless/slot");
4
- const types = require("@agnos-ui/react-headless/types");
5
4
  const classNames = require("classnames");
6
5
  const generated_config = require("./generated/config.cjs");
7
6
  const React = require("react");
@@ -39,8 +38,8 @@ const NavButton = React__namespace.forwardRef(({ disabled, className, children,
39
38
  NavButton.displayName = "NavButton";
40
39
  const export_getPaginationDefaultConfig = pagination.getPaginationDefaultConfig;
41
40
  const export_createPagination = pagination.createPagination;
42
- function DefaultPages(slotContext) {
43
- const { widget, state } = slotContext;
41
+ const PaginationDefaultSlotPages = (slotContext) => {
42
+ const { state, directives } = slotContext;
44
43
  const jsxPages = [];
45
44
  for (let i = 0; i < state.pages.length; i++) {
46
45
  if (state.pages[i] === -1) {
@@ -58,7 +57,7 @@ function DefaultPages(slotContext) {
58
57
  disabled: state.disabled,
59
58
  active: state.pages[i] === state.page,
60
59
  activeLabel: state.activeLabel,
61
- directive: widget.directives["pageLink"],
60
+ directive: directives["pageLink"],
62
61
  page: state.pages[i],
63
62
  children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.numberLabel, props: { ...slotContext, displayedPage: state.pages[i] } })
64
63
  },
@@ -68,33 +67,29 @@ function DefaultPages(slotContext) {
68
67
  }
69
68
  }
70
69
  return jsxPages.length ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxPages }) : null;
71
- }
72
- const defaultConfig = {
73
- pagesDisplay: DefaultPages,
74
- structure: DefaultStructure
75
70
  };
76
- function DefaultStructure(slotContext) {
77
- const { widget, state } = slotContext;
71
+ const PaginationDefaultSlotStructure = (slotContext) => {
72
+ const { state, directives } = slotContext;
78
73
  const ItemsBefore = [];
79
74
  const ItemsAfter = [];
80
75
  if (state.boundaryLinks) {
81
76
  ItemsBefore.push(
82
- /* @__PURE__ */ jsxRuntime.jsx(NavButton, { disabled: state.previousDisabled, directive: widget.directives["pageFirst"], children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.firstPageLabel, props: slotContext }) }, "first")
77
+ /* @__PURE__ */ jsxRuntime.jsx(NavButton, { disabled: state.previousDisabled, directive: directives.pageFirst, children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.firstPageLabel, props: slotContext }) }, "first")
83
78
  );
84
79
  }
85
80
  if (state.directionLinks) {
86
81
  ItemsBefore.push(
87
- /* @__PURE__ */ jsxRuntime.jsx(NavButton, { disabled: state.previousDisabled, directive: widget.directives["pagePrev"], children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.previousPageLabel, props: slotContext }) }, "prev")
82
+ /* @__PURE__ */ jsxRuntime.jsx(NavButton, { disabled: state.previousDisabled, directive: directives.pagePrev, children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.previousPageLabel, props: slotContext }) }, "prev")
88
83
  );
89
84
  }
90
85
  if (state.directionLinks) {
91
86
  ItemsAfter.push(
92
- /* @__PURE__ */ jsxRuntime.jsx(NavButton, { disabled: state.nextDisabled, directive: widget.directives["pageNext"], children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.nextPageLabel, props: slotContext }) }, "next")
87
+ /* @__PURE__ */ jsxRuntime.jsx(NavButton, { disabled: state.nextDisabled, directive: directives.pageNext, children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.nextPageLabel, props: slotContext }) }, "next")
93
88
  );
94
89
  }
95
90
  if (state.boundaryLinks) {
96
91
  ItemsAfter.push(
97
- /* @__PURE__ */ jsxRuntime.jsx(NavButton, { disabled: state.nextDisabled, directive: widget.directives["pageLast"], children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.lastPageLabel, props: slotContext }) }, "last")
92
+ /* @__PURE__ */ jsxRuntime.jsx(NavButton, { disabled: state.nextDisabled, directive: directives["pageLast"], children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.lastPageLabel, props: slotContext }) }, "last")
98
93
  );
99
94
  }
100
95
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -105,16 +100,18 @@ function DefaultStructure(slotContext) {
105
100
  ] }),
106
101
  /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-live": "polite", className: "visually-hidden", children: `${state.ariaLiveLabelText}` })
107
102
  ] });
108
- }
103
+ };
109
104
  function Pagination(props) {
110
- const [state, widget] = generated_config.useWidgetWithConfig(export_createPagination, props, "pagination", defaultConfig);
111
- const slotContext = { state, widget: types.toSlotContextWidget(widget) };
112
- return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": state.ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.structure, props: slotContext }) });
105
+ const widgetContext = generated_config.useWidgetWithConfig(export_createPagination, props, "pagination", {
106
+ pagesDisplay: PaginationDefaultSlotPages,
107
+ structure: PaginationDefaultSlotStructure
108
+ });
109
+ return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": widgetContext.state.ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: widgetContext.state.structure, props: widgetContext }) });
113
110
  }
114
- exports.DefaultPages = DefaultPages;
115
- exports.DefaultStructure = DefaultStructure;
116
111
  exports.NavButton = NavButton;
117
112
  exports.PageItem = PageItem;
118
113
  exports.Pagination = Pagination;
114
+ exports.PaginationDefaultSlotPages = PaginationDefaultSlotPages;
115
+ exports.PaginationDefaultSlotStructure = PaginationDefaultSlotStructure;
119
116
  exports.export_createPagination = export_createPagination;
120
117
  exports.export_getPaginationDefaultConfig = export_getPaginationDefaultConfig;