@agnos-ui/react-bootstrap 0.8.1 → 0.9.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 (66) hide show
  1. package/{accordion-CrXiNNLE.js → accordion-Bkttdgi2.js} +3 -3
  2. package/{accordion-CKX3QpIN.cjs → accordion-DkUnHzTx.cjs} +2 -2
  3. package/{alert-BGVw_vsM.cjs → alert-56ypguOK.cjs} +1 -1
  4. package/{alert-BM4ImSpO.js → alert-D2bu7Ulu.js} +2 -2
  5. package/{carousel-CB4uoAm0.js → carousel-C6hfiwd2.js} +2 -2
  6. package/{carousel-B8b91cHo.cjs → carousel-DyA8lWos.cjs} +1 -1
  7. package/{collapse-DojQXsLN.js → collapse-D2gce6s6.js} +2 -2
  8. package/{collapse-BQNW5NFj.cjs → collapse-Dtanmp3a.cjs} +1 -1
  9. package/components/accordion/accordion.d.ts +3 -3
  10. package/components/accordion/index.cjs +1 -1
  11. package/components/accordion/index.js +1 -1
  12. package/components/alert/alert.d.ts +1 -1
  13. package/components/alert/index.cjs +1 -1
  14. package/components/alert/index.js +1 -1
  15. package/components/carousel/carousel.d.ts +1 -1
  16. package/components/carousel/carousel.gen.d.ts +14 -12
  17. package/components/carousel/index.cjs +1 -1
  18. package/components/carousel/index.js +1 -1
  19. package/components/collapse/collapse.d.ts +1 -1
  20. package/components/collapse/collapse.gen.d.ts +8 -8
  21. package/components/collapse/index.cjs +1 -1
  22. package/components/collapse/index.js +1 -1
  23. package/components/modal/index.cjs +1 -1
  24. package/components/modal/index.js +1 -1
  25. package/components/pagination/index.cjs +1 -1
  26. package/components/pagination/index.js +1 -1
  27. package/components/pagination/pagination.d.ts +1 -1
  28. package/components/progressbar/index.cjs +1 -1
  29. package/components/progressbar/index.js +1 -1
  30. package/components/progressbar/progressbar.d.ts +1 -1
  31. package/components/rating/index.cjs +1 -1
  32. package/components/rating/index.js +1 -1
  33. package/components/rating/rating.d.ts +1 -1
  34. package/components/select/index.cjs +1 -1
  35. package/components/select/index.js +1 -1
  36. package/components/slider/index.cjs +1 -1
  37. package/components/slider/index.js +1 -1
  38. package/components/slider/slider.d.ts +1 -1
  39. package/components/toast/index.cjs +1 -1
  40. package/components/toast/index.js +1 -1
  41. package/components/toast/toast.d.ts +1 -1
  42. package/components/tree/index.cjs +1 -1
  43. package/components/tree/index.js +1 -1
  44. package/components/tree/tree.d.ts +1 -1
  45. package/config.d.ts +55 -7
  46. package/generated/config.cjs +5 -2
  47. package/generated/config.js +6 -3
  48. package/index.cjs +13 -13
  49. package/index.js +15 -15
  50. package/{modal-DQLOz7TE.cjs → modal-C22MXJLV.cjs} +1 -1
  51. package/{modal-apFubipB.js → modal-CHNXwCta.js} +2 -2
  52. package/package.json +3 -3
  53. package/{pagination-B1Ho_-r4.js → pagination-60ge4D0q.js} +2 -2
  54. package/{pagination-Bq4Hvm1j.cjs → pagination-ZxTUf5Pm.cjs} +1 -1
  55. package/{progressbar-Ck20N_ee.js → progressbar-B1ZwY3G2.js} +2 -2
  56. package/{progressbar-CnbqCXqH.cjs → progressbar-CC5WyAKM.cjs} +1 -1
  57. package/{rating-BaZTCQi1.cjs → rating-B2erO56i.cjs} +1 -1
  58. package/{rating-DziC4Tsh.js → rating-Dt-vNocw.js} +2 -2
  59. package/{select-DHNspXXB.cjs → select-DgXUNQIA.cjs} +1 -1
  60. package/{select-ClQGKBMF.js → select-aWj112ds.js} +2 -2
  61. package/{slider-ZmbENVpb.js → slider-Dyr7A6pJ.js} +2 -2
  62. package/{slider-CkKKSyai.cjs → slider-Xix2FdNx.cjs} +1 -1
  63. package/{toasterProvider-DO_5lfVp.js → toasterProvider-AZi99tUa.js} +2 -2
  64. package/{toasterProvider-glQ29Go3.cjs → toasterProvider-DeTgUXN8.cjs} +1 -1
  65. package/{tree-BflF5hyD.js → tree-BNa6nXSh.js} +2 -2
  66. package/{tree-DT261j-0.cjs → tree-Djbdzlr-.cjs} +1 -1
@@ -2,7 +2,7 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { Slot } from "@agnos-ui/react-headless/slot";
3
3
  import { useDirectives, classDirective } from "@agnos-ui/react-headless/utils/directive";
4
4
  import { useContext, createContext, useId, useImperativeHandle, useEffect } from "react";
5
- import { useWidgetWithConfig } from "./generated/config.js";
5
+ import { useWidget } from "./generated/config.js";
6
6
  import { getAccordionDefaultConfig, createAccordionItem, createAccordion, factoryCreateAccordion } from "@agnos-ui/core-bootstrap/components/accordion";
7
7
  const export_getAccordionDefaultConfig = getAccordionDefaultConfig;
8
8
  const export_createAccordionItem = createAccordionItem;
@@ -22,7 +22,7 @@ const AccordionItemDefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxs(
22
22
  function AccordionItem(props) {
23
23
  const { registerItem } = useContext(AccordionDIContext);
24
24
  const id = useId();
25
- const widgetContext = useWidgetWithConfig(registerItem, props, null, {
25
+ const widgetContext = useWidget(registerItem, props, {
26
26
  structure: AccordionItemDefaultSlotStructure,
27
27
  id
28
28
  });
@@ -34,7 +34,7 @@ function AccordionItem(props) {
34
34
  return /* @__PURE__ */ jsx("div", { ...useDirectives([classDirective, `accordion-item ${state.className}`], directives.itemDirective), children: /* @__PURE__ */ jsx(Slot, { slotContent: state.structure, props: widgetContext }) });
35
35
  }
36
36
  function Accordion(props) {
37
- const widget = useWidgetWithConfig(export_createAccordion, props, "accordion");
37
+ const widget = useWidget(export_createAccordion, props);
38
38
  useImperativeHandle(props.ref, () => widget.api, [widget.api]);
39
39
  return /* @__PURE__ */ jsx(AccordionDIContext, { value: widget.api, children: /* @__PURE__ */ jsx("div", { ...useDirectives([classDirective, "accordion"], widget.directives.accordionDirective), children: props.children }) });
40
40
  }
@@ -23,7 +23,7 @@ const AccordionItemDefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxRu
23
23
  function AccordionItem(props) {
24
24
  const { registerItem } = React.useContext(AccordionDIContext);
25
25
  const id = React.useId();
26
- const widgetContext = generated_config.useWidgetWithConfig(registerItem, props, null, {
26
+ const widgetContext = generated_config.useWidget(registerItem, props, {
27
27
  structure: AccordionItemDefaultSlotStructure,
28
28
  id
29
29
  });
@@ -35,7 +35,7 @@ function AccordionItem(props) {
35
35
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirectives([directive.classDirective, `accordion-item ${state.className}`], directives.itemDirective), children: /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.structure, props: widgetContext }) });
36
36
  }
37
37
  function Accordion(props) {
38
- const widget = generated_config.useWidgetWithConfig(export_createAccordion, props, "accordion");
38
+ const widget = generated_config.useWidget(export_createAccordion, props);
39
39
  React.useImperativeHandle(props.ref, () => widget.api, [widget.api]);
40
40
  return /* @__PURE__ */ jsxRuntime.jsx(AccordionDIContext, { value: widget.api, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirectives([directive.classDirective, "accordion"], widget.directives.accordionDirective), children: props.children }) });
41
41
  }
@@ -26,7 +26,7 @@ const AlertElement = (slotContext) => /* @__PURE__ */ jsxRuntime.jsx(
26
26
  }
27
27
  );
28
28
  function Alert(props) {
29
- const widgetContext = generated_config.useWidgetWithConfig(export_createAlert, props, "alert", {
29
+ const widgetContext = generated_config.useWidget(export_createAlert, props, {
30
30
  structure: AlertDefaultSlotStructure
31
31
  });
32
32
  React.useImperativeHandle(props.ref, () => widgetContext.api, [widgetContext.api]);
@@ -2,7 +2,7 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { Slot } from "@agnos-ui/react-headless/slot";
3
3
  import { useDirectives, classDirective } from "@agnos-ui/react-headless/utils/directive";
4
4
  import { useImperativeHandle } from "react";
5
- import { useWidgetWithConfig } from "./generated/config.js";
5
+ import { useWidget } from "./generated/config.js";
6
6
  import { getAlertDefaultConfig, createAlert } from "@agnos-ui/core-bootstrap/components/alert";
7
7
  const export_getAlertDefaultConfig = getAlertDefaultConfig;
8
8
  const export_createAlert = createAlert;
@@ -25,7 +25,7 @@ const AlertElement = (slotContext) => /* @__PURE__ */ jsx(
25
25
  }
26
26
  );
27
27
  function Alert(props) {
28
- const widgetContext = useWidgetWithConfig(export_createAlert, props, "alert", {
28
+ const widgetContext = useWidget(export_createAlert, props, {
29
29
  structure: AlertDefaultSlotStructure
30
30
  });
31
31
  useImperativeHandle(props.ref, () => widgetContext.api, [widgetContext.api]);
@@ -1,6 +1,6 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { getCarouselDefaultConfig, createCarousel } from "@agnos-ui/core-bootstrap/components/carousel";
3
- import { useWidgetWithConfig } from "@agnos-ui/react-headless/config";
3
+ import { useWidget } from "@agnos-ui/react-headless/config";
4
4
  import { Slot } from "@agnos-ui/react-headless/slot";
5
5
  import { useDirective } from "@agnos-ui/react-headless/utils/directive";
6
6
  import { useImperativeHandle } from "react";
@@ -57,7 +57,7 @@ const CarouselDefaultStructure = (widget) => /* @__PURE__ */ jsxs(Fragment, { ch
57
57
  /* @__PURE__ */ jsx("div", { ...useDirective(widget.directives.container), children: widget.state.slidesData.map((slideData, index) => /* @__PURE__ */ jsx(CarouselSlide, { slideData, widget, index }, slideData.id)) })
58
58
  ] });
59
59
  function Carousel({ ref, ...props }) {
60
- const widget = useWidgetWithConfig(export_createCarousel, props, "carousel", {
60
+ const widget = useWidget(export_createCarousel, props, {
61
61
  structure: CarouselDefaultStructure,
62
62
  navigation: CarouselDefaultNavigation
63
63
  });
@@ -58,7 +58,7 @@ const CarouselDefaultStructure = (widget) => /* @__PURE__ */ jsxRuntime.jsxs(jsx
58
58
  /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirective(widget.directives.container), children: widget.state.slidesData.map((slideData, index) => /* @__PURE__ */ jsxRuntime.jsx(CarouselSlide, { slideData, widget, index }, slideData.id)) })
59
59
  ] });
60
60
  function Carousel({ ref, ...props }) {
61
- const widget = config.useWidgetWithConfig(export_createCarousel, props, "carousel", {
61
+ const widget = config.useWidget(export_createCarousel, props, {
62
62
  structure: CarouselDefaultStructure,
63
63
  navigation: CarouselDefaultNavigation
64
64
  });
@@ -1,13 +1,13 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useId, useImperativeHandle } from "react";
3
- import { useWidgetWithConfig } from "./generated/config.js";
3
+ import { useWidget } from "./generated/config.js";
4
4
  import { getCollapseDefaultConfig, createCollapse } from "@agnos-ui/core-bootstrap/components/collapse";
5
5
  import { useDirectives } from "@agnos-ui/react-headless/utils/directive";
6
6
  const export_getCollapseDefaultConfig = getCollapseDefaultConfig;
7
7
  const export_createCollapse = createCollapse;
8
8
  function Collapse(props) {
9
9
  const id = useId();
10
- const { api, directives } = useWidgetWithConfig(export_createCollapse, props, "collapse", { id });
10
+ const { api, directives } = useWidget(export_createCollapse, props, { id });
11
11
  useImperativeHandle(props.ref, () => api, [api]);
12
12
  return /* @__PURE__ */ jsx("div", { ...useDirectives(directives.collapseDirective), children: props.children });
13
13
  }
@@ -8,7 +8,7 @@ const export_getCollapseDefaultConfig = collapse.getCollapseDefaultConfig;
8
8
  const export_createCollapse = collapse.createCollapse;
9
9
  function Collapse(props) {
10
10
  const id = React.useId();
11
- const { api, directives } = generated_config.useWidgetWithConfig(export_createCollapse, props, "collapse", { id });
11
+ const { api, directives } = generated_config.useWidget(export_createCollapse, props, { id });
12
12
  React.useImperativeHandle(props.ref, () => api, [api]);
13
13
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirectives(directives.collapseDirective), children: props.children });
14
14
  }
@@ -17,13 +17,13 @@ export declare const AccordionItemDefaultSlotStructure: (slotContext: AccordionI
17
17
  * @remarks
18
18
  * This component uses several hooks:
19
19
  * - {@link https://react.dev/reference/react/useContext | useContext} to get the `registerItem` function from {@link AccordionDIContext}.
20
- * - {@link useWidgetWithConfig} to initialize the widget context.
20
+ * - {@link useWidget} to initialize the widget context.
21
21
  * - {@link https://react.dev/reference/react/useImperativeHandle | useImperativeHandle} to expose the `api` to the parent component.
22
22
  * - {@link https://react.dev/reference/react/useEffect | useEffect} to call `api.initDone()` after the component mounts.
23
23
  *
24
24
  * The component also uses {@link useDirectives} to apply directives to the rendered `div` element.
25
25
  *
26
- * @see {@link useWidgetWithConfig}
26
+ * @see {@link useWidget}
27
27
  * @see {@link useDirectives}
28
28
  */
29
29
  export declare function AccordionItem(props: Partial<AccordionItemProps> & {
@@ -33,7 +33,7 @@ export declare function AccordionItem(props: Partial<AccordionItemProps> & {
33
33
  * Accordion component that provides a collapsible content container.
34
34
  *
35
35
  * This component uses a forward ref to expose the Accordion API to parent components.
36
- * It leverages the {@link useWidgetWithConfig} hook to create the accordion widget and
36
+ * It leverages the {@link useWidget} hook to create the accordion widget and
37
37
  * {@link https://react.dev/reference/react/useImperativeHandle | useImperativeHandle} to bind the widget API to the ref.
38
38
  *
39
39
  * @param props - The properties for the Accordion component.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const accordion = require("../../accordion-CKX3QpIN.cjs");
3
+ const accordion = require("../../accordion-DkUnHzTx.cjs");
4
4
  exports.Accordion = accordion.Accordion;
5
5
  exports.AccordionItem = accordion.AccordionItem;
6
6
  exports.AccordionItemDefaultSlotStructure = accordion.AccordionItemDefaultSlotStructure;
@@ -1,4 +1,4 @@
1
- import { b, a, A, d, c, f, e } from "../../accordion-CrXiNNLE.js";
1
+ import { b, a, A, d, c, f, e } from "../../accordion-Bkttdgi2.js";
2
2
  export {
3
3
  b as Accordion,
4
4
  a as AccordionItem,
@@ -10,7 +10,7 @@ export declare const AlertDefaultSlotStructure: (slotContext: AlertContext) => i
10
10
  /**
11
11
  * Alert component that uses a forward ref to expose an API.
12
12
  *
13
- * This component utilizes the {@link useWidgetWithConfig} hook to create an alert widget context
13
+ * This component utilizes the {@link useWidget} hook to create an alert widget context
14
14
  * and the {@link https://react.dev/reference/react/useImperativeHandle | useImperativeHandle} hook to expose the widget's API via the ref.
15
15
  *
16
16
  * @param props - Partial properties of the AlertProps interface.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const alert = require("../../alert-BGVw_vsM.cjs");
3
+ const alert = require("../../alert-56ypguOK.cjs");
4
4
  exports.Alert = alert.Alert;
5
5
  exports.AlertDefaultSlotStructure = alert.AlertDefaultSlotStructure;
6
6
  exports.createAlert = alert.export_createAlert;
@@ -1,4 +1,4 @@
1
- import { a, A, b, e } from "../../alert-BM4ImSpO.js";
1
+ import { a, A, b, e } from "../../alert-D2bu7Ulu.js";
2
2
  export {
3
3
  a as Alert,
4
4
  A as AlertDefaultSlotStructure,
@@ -21,7 +21,7 @@ export declare const CarouselDefaultStructure: <SlideData extends {
21
21
  /**
22
22
  * Carousel component that uses a forward ref to expose an API.
23
23
  *
24
- * This component utilizes the {@link useWidgetWithConfig} hook to create a carousel widget
24
+ * This component utilizes the {@link useWidget} hook to create a carousel widget
25
25
  * and the {@link https://react.dev/reference/react/useImperativeHandle | useImperativeHandle} hook to expose the widget's API via the ref.
26
26
  *
27
27
  * @template SlideData - The type of data used by each slide in the carousel.
@@ -1,4 +1,4 @@
1
- import type { PropsConfig, WidgetSlotContext, SlotContent, Directive, Widget } from '@agnos-ui/react-headless/types';
1
+ import type { WidgetSlotContext, SlotContent, Directive, Widget, WidgetFactory, PropsConfig } from '@agnos-ui/react-headless/types';
2
2
  import type { EmblaPluginType, EmblaPluginsType, EmblaCarouselType } from 'embla-carousel';
3
3
  /**
4
4
  * Retrieve a shallow copy of the default Carousel config
@@ -6,17 +6,6 @@ import type { EmblaPluginType, EmblaPluginsType, EmblaCarouselType } from 'embla
6
6
  */
7
7
  declare const export_getCarouselDefaultConfig: () => CarouselProps<any>;
8
8
  export { export_getCarouselDefaultConfig as getCarouselDefaultConfig };
9
- /**
10
- * Create a Carousel with given config props
11
- *
12
- * @template SlideData - The type of the data for each slide.
13
- * @param config - an optional carousel config
14
- * @returns a CarouselWidget
15
- */
16
- declare const export_createCarousel: <SlideData extends {
17
- id: string;
18
- }>(config?: PropsConfig<CarouselProps<SlideData>>) => CarouselWidget<SlideData>;
19
- export { export_createCarousel as createCarousel };
20
9
  /**
21
10
  * Represents the context for a carousel.
22
11
  *
@@ -327,6 +316,19 @@ export interface CarouselDirectives {
327
316
  export type CarouselWidget<SlideData extends {
328
317
  id: string;
329
318
  }> = Widget<CarouselProps<SlideData>, CarouselState<SlideData>, CarouselApi, CarouselDirectives>;
319
+ /**
320
+ * Create a Carousel with given config props
321
+ *
322
+ * @template SlideData - The type of the data for each slide.
323
+ * @param config - an optional carousel config
324
+ * @returns a CarouselWidget
325
+ */
326
+ declare const export_createCarousel: WidgetFactory<CarouselWidget<{
327
+ id: string;
328
+ }>, <SlideData extends {
329
+ id: string;
330
+ }>(config?: PropsConfig<CarouselProps<SlideData>>) => CarouselWidget<SlideData>>;
331
+ export { export_createCarousel as createCarousel };
330
332
  /**
331
333
  * Represents the API for a carousel component.
332
334
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const carousel = require("../../carousel-B8b91cHo.cjs");
3
+ const carousel = require("../../carousel-DyA8lWos.cjs");
4
4
  exports.Carousel = carousel.Carousel;
5
5
  exports.CarouselDefaultNavigation = carousel.CarouselDefaultNavigation;
6
6
  exports.CarouselDefaultStructure = carousel.CarouselDefaultStructure;
@@ -1,4 +1,4 @@
1
- import { c, C, b, a, e } from "../../carousel-CB4uoAm0.js";
1
+ import { c, C, b, a, e } from "../../carousel-C6hfiwd2.js";
2
2
  export {
3
3
  c as Carousel,
4
4
  C as CarouselDefaultNavigation,
@@ -3,7 +3,7 @@ import type { CollapseApi, CollapseProps } from './collapse.gen';
3
3
  /**
4
4
  * Collapse component that provides a collapsible container.
5
5
  *
6
- * This component uses the {@link useWidgetWithConfig} hook to create a collapse widget
6
+ * This component uses the {@link useWidget} hook to create a collapse widget
7
7
  * and applies transition directives to the container.
8
8
  *
9
9
  * @param props - The properties for the Collapse component.
@@ -1,17 +1,10 @@
1
- import type { PropsConfig, Directive, Widget } from '@agnos-ui/react-headless/types';
1
+ import type { Directive, Widget, WidgetFactory } from '@agnos-ui/react-headless/types';
2
2
  /**
3
3
  * Retrieve a shallow copy of the default collapse config
4
4
  * @returns the default collapse config
5
5
  */
6
6
  declare const export_getCollapseDefaultConfig: () => CollapseProps;
7
7
  export { export_getCollapseDefaultConfig as getCollapseDefaultConfig };
8
- /**
9
- * Create an CollapseWidget with given config props
10
- * @param config - an optional collapse config
11
- * @returns an CollapseWidget
12
- */
13
- declare const export_createCollapse: (config?: PropsConfig<CollapseProps>) => CollapseWidget;
14
- export { export_createCollapse as createCollapse };
15
8
  /**
16
9
  * Represents the state of a collapse component.
17
10
  * Extends the properties and state from `CollapseCommonPropsAndState`.
@@ -148,3 +141,10 @@ export interface CollapseDirectives {
148
141
  * @type {Widget<CollapseProps, CollapseState, CollapseApi, CollapseDirectives>}
149
142
  */
150
143
  export type CollapseWidget = Widget<CollapseProps, CollapseState, CollapseApi, CollapseDirectives>;
144
+ /**
145
+ * Create an CollapseWidget with given config props
146
+ * @param config - an optional collapse config
147
+ * @returns an CollapseWidget
148
+ */
149
+ declare const export_createCollapse: WidgetFactory<CollapseWidget>;
150
+ export { export_createCollapse as createCollapse };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const collapse = require("../../collapse-BQNW5NFj.cjs");
3
+ const collapse = require("../../collapse-Dtanmp3a.cjs");
4
4
  exports.Collapse = collapse.Collapse;
5
5
  exports.createCollapse = collapse.export_createCollapse;
6
6
  exports.getCollapseDefaultConfig = collapse.export_getCollapseDefaultConfig;
@@ -1,4 +1,4 @@
1
- import { C, a, e } from "../../collapse-DojQXsLN.js";
1
+ import { C, a, e } from "../../collapse-D2gce6s6.js";
2
2
  export {
3
3
  C as Collapse,
4
4
  a as createCollapse,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const modal = require("../../modal-DQLOz7TE.cjs");
3
+ const modal = require("../../modal-C22MXJLV.cjs");
4
4
  exports.Modal = modal.Modal;
5
5
  exports.ModalDefaultSlotHeader = modal.ModalDefaultSlotHeader;
6
6
  exports.ModalDefaultSlotStructure = modal.ModalDefaultSlotStructure;
@@ -1,4 +1,4 @@
1
- import { b, M, a, c, e, f, d, o } from "../../modal-apFubipB.js";
1
+ import { b, M, a, c, e, f, d, o } from "../../modal-CHNXwCta.js";
2
2
  export {
3
3
  b as Modal,
4
4
  M as ModalDefaultSlotHeader,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const pagination = require("../../pagination-Bq4Hvm1j.cjs");
3
+ const pagination = require("../../pagination-ZxTUf5Pm.cjs");
4
4
  exports.NavButton = pagination.NavButton;
5
5
  exports.PageItem = pagination.PageItem;
6
6
  exports.Pagination = pagination.Pagination;
@@ -1,4 +1,4 @@
1
- import { N, P, c, a, b, d, e } from "../../pagination-B1Ho_-r4.js";
1
+ import { N, P, c, a, b, d, e } from "../../pagination-60ge4D0q.js";
2
2
  export {
3
3
  N as NavButton,
4
4
  P as PageItem,
@@ -29,7 +29,7 @@ export declare const PaginationDefaultSlotPages: (slotContext: PaginationContext
29
29
  export declare const PaginationDefaultSlotStructure: (slotContext: PaginationContext) => import("react/jsx-runtime").JSX.Element;
30
30
  /**
31
31
  * Pagination component that renders a navigation element for paginated content.
32
- * It uses the {@link useWidgetWithConfig} hook to create a pagination widget with the provided props.
32
+ * It uses the {@link useWidget} hook to create a pagination widget with the provided props.
33
33
  *
34
34
  * @param props - The properties for the Pagination component.
35
35
  * @param props.ref - Forwarded reference to the PaginationApi.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const progressbar = require("../../progressbar-CnbqCXqH.cjs");
3
+ const progressbar = require("../../progressbar-CC5WyAKM.cjs");
4
4
  exports.Progressbar = progressbar.Progressbar;
5
5
  exports.ProgressbarDefaultSlotStructure = progressbar.ProgressbarDefaultSlotStructure;
6
6
  exports.createProgressbar = progressbar.export_createProgressbar;
@@ -1,4 +1,4 @@
1
- import { a, P, b, e } from "../../progressbar-Ck20N_ee.js";
1
+ import { a, P, b, e } from "../../progressbar-B1ZwY3G2.js";
2
2
  export {
3
3
  a as Progressbar,
4
4
  P as ProgressbarDefaultSlotStructure,
@@ -8,7 +8,7 @@ import type { ProgressbarContext, ProgressbarProps } from './progressbar.gen';
8
8
  */
9
9
  export declare const ProgressbarDefaultSlotStructure: (slotContext: ProgressbarContext) => import("react/jsx-runtime").JSX.Element;
10
10
  /**
11
- * Progressbar component that utilizes the {@link useWidgetWithConfig} hook to create a progress bar widget.
11
+ * Progressbar component that utilizes the {@link useWidget} hook to create a progress bar widget.
12
12
  *
13
13
  * @param props - The properties to configure the progress bar.
14
14
  *
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const rating = require("../../rating-BaZTCQi1.cjs");
3
+ const rating = require("../../rating-B2erO56i.cjs");
4
4
  exports.Rating = rating.Rating;
5
5
  exports.createRating = rating.export_createRating;
6
6
  exports.getRatingDefaultConfig = rating.export_getRatingDefaultConfig;
@@ -1,4 +1,4 @@
1
- import { R, a, e } from "../../rating-DziC4Tsh.js";
1
+ import { R, a, e } from "../../rating-Dt-vNocw.js";
2
2
  export {
3
3
  R as Rating,
4
4
  a as createRating,
@@ -7,7 +7,7 @@ import type { RatingApi, RatingProps } from './rating.gen';
7
7
  * @returns The rendered Rating component.
8
8
  *
9
9
  * @remarks
10
- * This component uses the {@link useWidgetWithConfig} hook to initialize and configure the rating widget.
10
+ * This component uses the {@link useWidget} hook to initialize and configure the rating widget.
11
11
  * It applies directives to the container and individual stars for styling and behavior.
12
12
  *
13
13
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const select = require("../../select-DHNspXXB.cjs");
3
+ const select = require("../../select-DgXUNQIA.cjs");
4
4
  exports.Select = select.Select;
5
5
  exports.createSelect = select.export_createSelect;
6
6
  exports.getSelectDefaultConfig = select.export_getSelectDefaultConfig;
@@ -1,4 +1,4 @@
1
- import { S, a, e } from "../../select-ClQGKBMF.js";
1
+ import { S, a, e } from "../../select-aWj112ds.js";
2
2
  export {
3
3
  S as Select,
4
4
  a as createSelect,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const slider = require("../../slider-CkKKSyai.cjs");
3
+ const slider = require("../../slider-Xix2FdNx.cjs");
4
4
  exports.Slider = slider.Slider;
5
5
  exports.SliderDefaultSlotHandle = slider.SliderDefaultSlotHandle;
6
6
  exports.SliderDefaultSlotStructure = slider.SliderDefaultSlotStructure;
@@ -1,4 +1,4 @@
1
- import { c, S, b, a, d, e } from "../../slider-ZmbENVpb.js";
1
+ import { c, S, b, a, d, e } from "../../slider-Dyr7A6pJ.js";
2
2
  export {
3
3
  c as Slider,
4
4
  S as SliderDefaultSlotHandle,
@@ -30,7 +30,7 @@ export declare const SliderDefaultSlotStructure: (slotContext: SliderContext) =>
30
30
  * @param props - The properties for the Slider component.
31
31
  * @returns The rendered Slider component.
32
32
  *
33
- * The Slider component uses the {@link useWidgetWithConfig} hook to create a widget context with the provided
33
+ * The Slider component uses the {@link useWidget} hook to create a widget context with the provided
34
34
  * configuration. It then applies the `sliderDirective` to a `div` element and renders the slot content
35
35
  * using the `Slot` component.
36
36
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const toasterProvider = require("../../toasterProvider-glQ29Go3.cjs");
3
+ const toasterProvider = require("../../toasterProvider-DeTgUXN8.cjs");
4
4
  exports.Toast = toasterProvider.Toast;
5
5
  exports.ToastDefaultSlotStructure = toasterProvider.ToastDefaultSlotStructure;
6
6
  exports.ToasterContainer = toasterProvider.ToasterContainer;
@@ -1,4 +1,4 @@
1
- import { a, T, f, g, b, d, e, c, u } from "../../toasterProvider-DO_5lfVp.js";
1
+ import { a, T, f, g, b, d, e, c, u } from "../../toasterProvider-AZi99tUa.js";
2
2
  export {
3
3
  a as Toast,
4
4
  T as ToastDefaultSlotStructure,
@@ -10,7 +10,7 @@ export declare const ToastDefaultSlotStructure: (slotContext: ToastContext) => i
10
10
  /**
11
11
  * Toast component that uses a forward ref to expose the Toast API.
12
12
  *
13
- * This component utilizes the {@link useWidgetWithConfig} hook to create a toast widget
13
+ * This component utilizes the {@link useWidget} hook to create a toast widget
14
14
  * with the provided properties and configuration. It also uses {@link https://react.dev/reference/react/useImperativeHandle | useImperativeHandle}
15
15
  * to expose the widget's API through the forwarded ref.
16
16
  *
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const tree = require("../../tree-DT261j-0.cjs");
3
+ const tree = require("../../tree-Djbdzlr-.cjs");
4
4
  exports.DefaultTreeSlotItem = tree.DefaultTreeSlotItem;
5
5
  exports.DefaultTreeSlotItemContent = tree.DefaultTreeSlotItemContent;
6
6
  exports.DefaultTreeSlotItemToggle = tree.DefaultTreeSlotItemToggle;
@@ -1,4 +1,4 @@
1
- import { b, a, D, c, T, d, e } from "../../tree-BflF5hyD.js";
1
+ import { b, a, D, c, T, d, e } from "../../tree-BNa6nXSh.js";
2
2
  export {
3
3
  b as DefaultTreeSlotItem,
4
4
  a as DefaultTreeSlotItemContent,
@@ -36,7 +36,7 @@ export declare const DefaultTreeSlotStructure: (slotContext: TreeContext) => imp
36
36
  * @param props - The properties for the Tree component.
37
37
  * @returns The rendered Tree component.
38
38
  *
39
- * The Tree component uses the {@link useWidgetWithConfig} hook to create a widget context with the provided
39
+ * The Tree component uses the {@link useWidget} hook to create a widget context with the provided
40
40
  * configuration. It renders the slot content using the `Slot` component.
41
41
  */
42
42
  export declare function Tree(props: Partial<TreeProps>): import("react/jsx-runtime").JSX.Element;
package/config.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import type { Partial2Levels, WidgetsConfigStore } from '@agnos-ui/react-headless/config';
2
2
  import type { Widget, WidgetFactory, WidgetProps, WidgetSlotContext } from '@agnos-ui/react-headless/types';
3
- import type { BootstrapWidgetsConfig } from '@agnos-ui/core-bootstrap/config';
4
3
  import type { ReactNode, Context } from 'react';
5
4
  export * from '@agnos-ui/react-headless/config';
6
5
  import type { WidgetsConfig } from './config.gen';
@@ -10,10 +9,59 @@ type DefaultConfigInput = Partial2Levels<WidgetsConfig> & {
10
9
  children?: ReactNode | undefined;
11
10
  };
12
11
  /**
13
- * Destructures and exports the following from `widgetFactories`:
14
- * - `WidgetsConfigContext`: The context for widget configurations.
15
- * - `WidgetsDefaultConfig`: The default configuration for widgets.
16
- * - `useWidgetContext`: A hook to use the widget context.
17
- * - `useWidgetWithConfig`: A hook to use a widget with a specific configuration.
12
+ * React context which can be used to provide or consume the widgets default configuration store.
18
13
  */
19
- export declare const WidgetsConfigContext: Context<WidgetsConfigStore<WidgetsConfig> | undefined>, WidgetsDefaultConfig: ({ children, adaptParentConfig, ...props }: DefaultConfigInput) => import("react/jsx-runtime").JSX.Element, useWidgetContext: <Props extends object>(widgetName: keyof BootstrapWidgetsConfig | null, defaultConfig?: Partial<Props>) => import("@amadeus-it-group/tansu").ReadableSignal<Partial<Props>>, useWidgetWithConfig: <W extends Widget<object, object, object, object>>(factory: WidgetFactory<W>, props: Partial<WidgetProps<W>> | undefined, widgetName: keyof BootstrapWidgetsConfig | null, defaultProps?: Partial<WidgetProps<W>>) => WidgetSlotContext<W>;
14
+ export declare const WidgetsConfigContext: Context<WidgetsConfigStore<WidgetsConfig> | undefined>;
15
+ /**
16
+ * React component that provides in the React context (for all AgnosUI descendant widgets) a new widgets default configuration
17
+ * store that inherits from any widgets default configuration store already defined at an upper level in the React context hierarchy.
18
+ * It contains its own set of widgets configuration properties that override the same properties form the parent configuration.
19
+ *
20
+ * @remarks
21
+ * The configuration is computed from the parent configuration in two steps:
22
+ * - first step: the parent configuration is transformed by the adaptParentConfig function (if specified).
23
+ * If adaptParentConfig is not specified, this step is skipped.
24
+ * - second step: the configuration from step 1 is merged (2-levels deep) with the properties of the component.
25
+ *
26
+ * @param componentInputs - the react component inputs
27
+ * @param componentInputs.children - the react component children
28
+ * @param componentInputs.adaptParentConfig - optional function that receives a 2-levels copy of the widgets default configuration
29
+ * defined at an upper level in the Svelte context hierarchy (or an empty object if there is none) and returns the widgets
30
+ * default configuration to be used.
31
+ * It is called only if the configuration is needed, and was not yet computed for the current value of the parent configuration.
32
+ * It is called in a tansu reactive context, so it can use any tansu store and will be called again if those stores change.
33
+ *
34
+ * @returns the resulting widgets default configuration store, which contains 3 additional properties that are stores:
35
+ * parent$, adaptedParent$ (containing the value computed after the first step), and own$ (that contains only overridding properties).
36
+ * The resulting store is writable, its set function is actually the set function of the own$ store.
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * <WidgetsDefaultConfig
41
+ * adaptParentConfig={(parentConfig) => {
42
+ * parentConfig.rating = parentConfig.rating ?? {};
43
+ * parentConfig.rating.className = `${parentConfig.rating.className ?? ''} my-rating-extra-class`
44
+ * return parentConfig;
45
+ * }}
46
+ * rating={{slotStar: MyCustomSlotStar}}
47
+ * />
48
+ * ```
49
+ */
50
+ export declare const WidgetsDefaultConfig: ({ children, adaptParentConfig, ...props }: DefaultConfigInput) => import("react/jsx-runtime").JSX.Element;
51
+ /**
52
+ * React hook that returns the widgets default configuration store.
53
+ *
54
+ * @param widgetName - the name of the widget to get the configuration for
55
+ * @param defaultConfig - the default configuration of the widget
56
+ * @returns the widgets default configuration store
57
+ */
58
+ export declare const useWidgetContext: <Props extends object>(widgetName?: string, defaultConfig?: Partial<Props>) => import("@amadeus-it-group/tansu").ReadableSignal<Partial<Props>>;
59
+ /**
60
+ * Allows to create and attach an agnos-ui/core widget to the current react component.
61
+ *
62
+ * @param factory - the widget factory
63
+ * @param props - the widget props
64
+ * @param defaultProps - the default widget props
65
+ * @returns the state, api and directives to track and interact with the widget
66
+ */
67
+ export declare const useWidget: <W extends Widget<object, object, object, object>>(factory: WidgetFactory<W>, props: Partial<WidgetProps<W>> | undefined, defaultProps?: Partial<WidgetProps<W>>) => WidgetSlotContext<W>;
@@ -2,11 +2,14 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const config = require("@agnos-ui/react-headless/config");
4
4
  const widgetFactories = config.widgetsConfigFactory();
5
- const { WidgetsConfigContext, WidgetsDefaultConfig, useWidgetContext, useWidgetWithConfig } = widgetFactories;
5
+ const WidgetsConfigContext = widgetFactories.WidgetsConfigContext;
6
+ const WidgetsDefaultConfig = widgetFactories.WidgetsDefaultConfig;
7
+ const useWidgetContext = widgetFactories.useWidgetContext;
8
+ const useWidget = widgetFactories.useWidget;
6
9
  exports.WidgetsConfigContext = WidgetsConfigContext;
7
10
  exports.WidgetsDefaultConfig = WidgetsDefaultConfig;
11
+ exports.useWidget = useWidget;
8
12
  exports.useWidgetContext = useWidgetContext;
9
- exports.useWidgetWithConfig = useWidgetWithConfig;
10
13
  Object.keys(config).forEach((k) => {
11
14
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
12
15
  enumerable: true,
@@ -1,10 +1,13 @@
1
1
  import { widgetsConfigFactory } from "@agnos-ui/react-headless/config";
2
2
  export * from "@agnos-ui/react-headless/config";
3
3
  const widgetFactories = widgetsConfigFactory();
4
- const { WidgetsConfigContext, WidgetsDefaultConfig, useWidgetContext, useWidgetWithConfig } = widgetFactories;
4
+ const WidgetsConfigContext = widgetFactories.WidgetsConfigContext;
5
+ const WidgetsDefaultConfig = widgetFactories.WidgetsDefaultConfig;
6
+ const useWidgetContext = widgetFactories.useWidgetContext;
7
+ const useWidget = widgetFactories.useWidget;
5
8
  export {
6
9
  WidgetsConfigContext,
7
10
  WidgetsDefaultConfig,
8
- useWidgetContext,
9
- useWidgetWithConfig
11
+ useWidget,
12
+ useWidgetContext
10
13
  };
package/index.cjs CHANGED
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const accordion = require("./accordion-CKX3QpIN.cjs");
4
- const alert = require("./alert-BGVw_vsM.cjs");
5
- const carousel = require("./carousel-B8b91cHo.cjs");
6
- const collapse = require("./collapse-BQNW5NFj.cjs");
7
- const modal = require("./modal-DQLOz7TE.cjs");
8
- const pagination = require("./pagination-Bq4Hvm1j.cjs");
9
- const progressbar = require("./progressbar-CnbqCXqH.cjs");
10
- const rating = require("./rating-BaZTCQi1.cjs");
11
- const select = require("./select-DHNspXXB.cjs");
12
- const slider = require("./slider-CkKKSyai.cjs");
13
- const toasterProvider = require("./toasterProvider-glQ29Go3.cjs");
14
- const tree = require("./tree-DT261j-0.cjs");
3
+ const accordion = require("./accordion-DkUnHzTx.cjs");
4
+ const alert = require("./alert-56ypguOK.cjs");
5
+ const carousel = require("./carousel-DyA8lWos.cjs");
6
+ const collapse = require("./collapse-Dtanmp3a.cjs");
7
+ const modal = require("./modal-C22MXJLV.cjs");
8
+ const pagination = require("./pagination-ZxTUf5Pm.cjs");
9
+ const progressbar = require("./progressbar-CC5WyAKM.cjs");
10
+ const rating = require("./rating-B2erO56i.cjs");
11
+ const select = require("./select-DgXUNQIA.cjs");
12
+ const slider = require("./slider-Xix2FdNx.cjs");
13
+ const toasterProvider = require("./toasterProvider-DeTgUXN8.cjs");
14
+ const tree = require("./tree-Djbdzlr-.cjs");
15
15
  const types = require("@agnos-ui/react-headless/types");
16
16
  const types$1 = require("@agnos-ui/core-bootstrap/types");
17
17
  const slot = require("@agnos-ui/react-headless/slot");
@@ -106,8 +106,8 @@ exports.createTree = tree.export_createTree;
106
106
  exports.getTreeDefaultConfig = tree.export_getTreeDefaultConfig;
107
107
  exports.WidgetsConfigContext = generated_config.WidgetsConfigContext;
108
108
  exports.WidgetsDefaultConfig = generated_config.WidgetsDefaultConfig;
109
+ exports.useWidget = generated_config.useWidget;
109
110
  exports.useWidgetContext = generated_config.useWidgetContext;
110
- exports.useWidgetWithConfig = generated_config.useWidgetWithConfig;
111
111
  Object.keys(types).forEach((k) => {
112
112
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
113
113
  enumerable: true,
package/index.js CHANGED
@@ -1,20 +1,20 @@
1
- import { b, a, A, d, c, f, e } from "./accordion-CrXiNNLE.js";
2
- import { a as a2, A as A2, b as b2, e as e2 } from "./alert-BM4ImSpO.js";
3
- import { c as c2, C, b as b3, a as a3, e as e3 } from "./carousel-CB4uoAm0.js";
4
- import { C as C2, a as a4, e as e4 } from "./collapse-DojQXsLN.js";
5
- import { b as b4, M, a as a5, c as c3, e as e5, f as f2, d as d2, o } from "./modal-apFubipB.js";
6
- import { N, P, c as c4, a as a6, b as b5, d as d3, e as e6 } from "./pagination-B1Ho_-r4.js";
7
- import { a as a7, P as P2, b as b6, e as e7 } from "./progressbar-Ck20N_ee.js";
8
- import { R, a as a8, e as e8 } from "./rating-DziC4Tsh.js";
9
- import { S, a as a9, e as e9 } from "./select-ClQGKBMF.js";
10
- import { c as c5, S as S2, b as b7, a as a10, d as d4, e as e10 } from "./slider-ZmbENVpb.js";
11
- import { a as a11, T, f as f3, g, b as b8, d as d5, e as e11, c as c6, u } from "./toasterProvider-DO_5lfVp.js";
12
- import { b as b9, a as a12, D, c as c7, T as T2, d as d6, e as e12 } from "./tree-BflF5hyD.js";
1
+ import { b, a, A, d, c, f, e } from "./accordion-Bkttdgi2.js";
2
+ import { a as a2, A as A2, b as b2, e as e2 } from "./alert-D2bu7Ulu.js";
3
+ import { c as c2, C, b as b3, a as a3, e as e3 } from "./carousel-C6hfiwd2.js";
4
+ import { C as C2, a as a4, e as e4 } from "./collapse-D2gce6s6.js";
5
+ import { b as b4, M, a as a5, c as c3, e as e5, f as f2, d as d2, o } from "./modal-CHNXwCta.js";
6
+ import { N, P, c as c4, a as a6, b as b5, d as d3, e as e6 } from "./pagination-60ge4D0q.js";
7
+ import { a as a7, P as P2, b as b6, e as e7 } from "./progressbar-B1ZwY3G2.js";
8
+ import { R, a as a8, e as e8 } from "./rating-Dt-vNocw.js";
9
+ import { S, a as a9, e as e9 } from "./select-aWj112ds.js";
10
+ import { c as c5, S as S2, b as b7, a as a10, d as d4, e as e10 } from "./slider-Dyr7A6pJ.js";
11
+ import { a as a11, T, f as f3, g, b as b8, d as d5, e as e11, c as c6, u } from "./toasterProvider-AZi99tUa.js";
12
+ import { b as b9, a as a12, D, c as c7, T as T2, d as d6, e as e12 } from "./tree-BNa6nXSh.js";
13
13
  export * from "@agnos-ui/react-headless/types";
14
14
  export * from "@agnos-ui/core-bootstrap/types";
15
15
  export * from "@agnos-ui/react-headless/slot";
16
16
  export * from "@agnos-ui/react-headless/config";
17
- import { WidgetsConfigContext, WidgetsDefaultConfig, useWidgetContext, useWidgetWithConfig } from "./generated/config.js";
17
+ import { WidgetsConfigContext, WidgetsDefaultConfig, useWidget, useWidgetContext } from "./generated/config.js";
18
18
  export * from "@agnos-ui/react-headless/utils/widget";
19
19
  export * from "@agnos-ui/react-headless/utils/stores";
20
20
  export * from "@agnos-ui/react-headless/utils/portal";
@@ -105,6 +105,6 @@ export {
105
105
  o as openModal,
106
106
  c6 as toastPositions,
107
107
  u as useToaster,
108
- useWidgetContext,
109
- useWidgetWithConfig
108
+ useWidget,
109
+ useWidgetContext
110
110
  };
@@ -28,7 +28,7 @@ const ModalElement = (slotContext) => {
28
28
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirectives([directive.classDirective, "modal d-block"], slotContext.directives.modalDirective), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx("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 }) }) }) });
29
29
  };
30
30
  function Modal(props) {
31
- const widgetContext = generated_config.useWidgetWithConfig(export_createModal, props, "modal", {
31
+ const widgetContext = generated_config.useWidget(export_createModal, props, {
32
32
  header: ModalDefaultSlotHeader,
33
33
  structure: ModalDefaultSlotStructure
34
34
  });
@@ -5,7 +5,7 @@ import { Portal } from "@agnos-ui/react-headless/utils/portal";
5
5
  import clsx from "clsx";
6
6
  import { useImperativeHandle } from "react";
7
7
  import ReactDOM from "react-dom/client";
8
- import { useWidgetWithConfig } from "./generated/config.js";
8
+ import { useWidget } from "./generated/config.js";
9
9
  import { getModalDefaultConfig, createModal, modalOutsideClick, modalCloseButtonClick } from "@agnos-ui/core-bootstrap/components/modal";
10
10
  const export_getModalDefaultConfig = getModalDefaultConfig;
11
11
  const export_createModal = createModal;
@@ -27,7 +27,7 @@ const ModalElement = (slotContext) => {
27
27
  return /* @__PURE__ */ jsx("div", { ...useDirectives([classDirective, "modal d-block"], slotContext.directives.modalDirective), children: /* @__PURE__ */ jsx("div", { className: clsx("modal-dialog", { "modal-fullscreen": fullscreen }), children: /* @__PURE__ */ jsx("div", { className: "modal-content", children: /* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.structure, props: slotContext }) }) }) });
28
28
  };
29
29
  function Modal(props) {
30
- const widgetContext = useWidgetWithConfig(export_createModal, props, "modal", {
30
+ const widgetContext = useWidget(export_createModal, props, {
31
31
  header: ModalDefaultSlotHeader,
32
32
  structure: ModalDefaultSlotStructure
33
33
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agnos-ui/react-bootstrap",
3
3
  "description": "Bootstrap-based component library for React.",
4
- "version": "0.8.1",
4
+ "version": "0.9.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.8.1",
53
- "@agnos-ui/react-headless": "0.8.1",
52
+ "@agnos-ui/core-bootstrap": "0.9.0",
53
+ "@agnos-ui/react-headless": "0.9.0",
54
54
  "clsx": "^2.1.1"
55
55
  },
56
56
  "peerDependencies": {
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { Slot } from "@agnos-ui/react-headless/slot";
3
3
  import clsx from "clsx";
4
- import { useWidgetWithConfig } from "./generated/config.js";
4
+ import { useWidget } from "./generated/config.js";
5
5
  import * as React from "react";
6
6
  import { useImperativeHandle } from "react";
7
7
  import { useDirectives, classDirective } from "@agnos-ui/react-headless/utils/directive";
@@ -85,7 +85,7 @@ const PaginationDefaultSlotStructure = (slotContext) => {
85
85
  ] });
86
86
  };
87
87
  function Pagination(props) {
88
- const widgetContext = useWidgetWithConfig(export_createPagination, props, "pagination", {
88
+ const widgetContext = useWidget(export_createPagination, props, {
89
89
  pagesDisplay: PaginationDefaultSlotPages,
90
90
  structure: PaginationDefaultSlotStructure
91
91
  });
@@ -102,7 +102,7 @@ const PaginationDefaultSlotStructure = (slotContext) => {
102
102
  ] });
103
103
  };
104
104
  function Pagination(props) {
105
- const widgetContext = generated_config.useWidgetWithConfig(export_createPagination, props, "pagination", {
105
+ const widgetContext = generated_config.useWidget(export_createPagination, props, {
106
106
  pagesDisplay: PaginationDefaultSlotPages,
107
107
  structure: PaginationDefaultSlotStructure
108
108
  });
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { Slot } from "@agnos-ui/react-headless/slot";
3
3
  import { useDirective } from "@agnos-ui/react-headless/utils/directive";
4
4
  import clsx from "clsx";
5
- import { useWidgetWithConfig } from "./generated/config.js";
5
+ import { useWidget } from "./generated/config.js";
6
6
  import { getProgressbarDefaultConfig, createProgressbar } from "@agnos-ui/core-bootstrap/components/progressbar";
7
7
  const export_getProgressbarDefaultConfig = getProgressbarDefaultConfig;
8
8
  const export_createProgressbar = createProgressbar;
@@ -12,7 +12,7 @@ const ProgressbarDefaultSlotStructure = (slotContext) => {
12
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.children, props: slotContext }) }) });
13
13
  };
14
14
  const Progressbar = (props) => {
15
- const widgetContext = useWidgetWithConfig(export_createProgressbar, props, "progressbar", {
15
+ const widgetContext = useWidget(export_createProgressbar, props, {
16
16
  structure: ProgressbarDefaultSlotStructure
17
17
  });
18
18
  const { state, directives } = widgetContext;
@@ -13,7 +13,7 @@ const ProgressbarDefaultSlotStructure = (slotContext) => {
13
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.children, props: slotContext }) }) });
14
14
  };
15
15
  const Progressbar = (props) => {
16
- const widgetContext = generated_config.useWidgetWithConfig(export_createProgressbar, props, "progressbar", {
16
+ const widgetContext = generated_config.useWidget(export_createProgressbar, props, {
17
17
  structure: ProgressbarDefaultSlotStructure
18
18
  });
19
19
  const { state, directives } = widgetContext;
@@ -22,7 +22,7 @@ function Rating(props) {
22
22
  state,
23
23
  directives: { containerDirective, starDirective },
24
24
  api
25
- } = generated_config.useWidgetWithConfig(export_createRating, props, "rating");
25
+ } = generated_config.useWidget(export_createRating, props);
26
26
  React.useImperativeHandle(props.ref, () => api, [api]);
27
27
  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)) });
28
28
  }
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Slot } from "@agnos-ui/react-headless/slot";
3
3
  import { useDirectives, classDirective, useDirective } from "@agnos-ui/react-headless/utils/directive";
4
4
  import { useImperativeHandle, Fragment } from "react";
5
- import { useWidgetWithConfig } from "./generated/config.js";
5
+ import { useWidget } from "./generated/config.js";
6
6
  import { getRatingDefaultConfig, createRating } from "@agnos-ui/core-bootstrap/components/rating";
7
7
  const export_getRatingDefaultConfig = getRatingDefaultConfig;
8
8
  const export_createRating = createRating;
@@ -21,7 +21,7 @@ function Rating(props) {
21
21
  state,
22
22
  directives: { containerDirective, starDirective },
23
23
  api
24
- } = useWidgetWithConfig(export_createRating, props, "rating");
24
+ } = useWidget(export_createRating, props);
25
25
  useImperativeHandle(props.ref, () => api, [api]);
26
26
  return /* @__PURE__ */ jsx("div", { ...useDirectives([classDirective, "d-inline-flex"], containerDirective), children: state.stars.map((star) => /* @__PURE__ */ jsx(Star, { star, state, directive: starDirective }, star.index)) });
27
27
  }
@@ -37,7 +37,7 @@ function Rows({ slotContext }) {
37
37
  }) });
38
38
  }
39
39
  function Select(props) {
40
- const widgetContext = generated_config.useWidgetWithConfig(export_createSelect, props, "select", {
40
+ const widgetContext = generated_config.useWidget(export_createSelect, props, {
41
41
  badgeLabel: DefaultBadge,
42
42
  itemLabel: DefaultItem
43
43
  });
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { Slot } from "@agnos-ui/react-headless/slot";
3
3
  import { useDirectives, useDirective, classDirective } from "@agnos-ui/react-headless/utils/directive";
4
4
  import clsx from "clsx";
5
- import { useWidgetWithConfig } from "./generated/config.js";
5
+ import { useWidget } from "./generated/config.js";
6
6
  import { getSelectDefaultConfig, createSelect } from "@agnos-ui/core-bootstrap/components/select";
7
7
  import { useImperativeHandle } from "react";
8
8
  const export_getSelectDefaultConfig = getSelectDefaultConfig;
@@ -36,7 +36,7 @@ function Rows({ slotContext }) {
36
36
  }) });
37
37
  }
38
38
  function Select(props) {
39
- const widgetContext = useWidgetWithConfig(export_createSelect, props, "select", {
39
+ const widgetContext = useWidget(export_createSelect, props, {
40
40
  badgeLabel: DefaultBadge,
41
41
  itemLabel: DefaultItem
42
42
  });
@@ -3,7 +3,7 @@ import { Slot } from "@agnos-ui/react-headless/slot";
3
3
  import { useDirective } from "@agnos-ui/react-headless/utils/directive";
4
4
  import clsx from "clsx";
5
5
  import React__default from "react";
6
- import { useWidgetWithConfig } from "./generated/config.js";
6
+ import { useWidget } from "./generated/config.js";
7
7
  import { getSliderDefaultConfig, createSlider } from "@agnos-ui/core-bootstrap/components/slider";
8
8
  const export_getSliderDefaultConfig = getSliderDefaultConfig;
9
9
  const export_createSlider = createSlider;
@@ -64,7 +64,7 @@ const SliderDefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxs(Fragmen
64
64
  ] }, item.id))
65
65
  ] });
66
66
  function Slider(props) {
67
- const widgetContext = useWidgetWithConfig(export_createSlider, props, "slider", {
67
+ const widgetContext = useWidget(export_createSlider, props, {
68
68
  structure: SliderDefaultSlotStructure,
69
69
  handle: SliderDefaultSlotHandle,
70
70
  tick: SliderDefaultTick
@@ -65,7 +65,7 @@ const SliderDefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxRuntime.j
65
65
  ] }, item.id))
66
66
  ] });
67
67
  function Slider(props) {
68
- const widgetContext = generated_config.useWidgetWithConfig(export_createSlider, props, "slider", {
68
+ const widgetContext = generated_config.useWidget(export_createSlider, props, {
69
69
  structure: SliderDefaultSlotStructure,
70
70
  handle: SliderDefaultSlotHandle,
71
71
  tick: SliderDefaultTick
@@ -4,7 +4,7 @@ import { useToaster as useToaster$1, ToasterProvider as ToasterProvider$1 } from
4
4
  import { getToastDefaultConfig, createToast, toastPositions, defaultToasterProps } from "@agnos-ui/core-bootstrap/components/toast";
5
5
  import { Slot } from "@agnos-ui/react-headless/slot";
6
6
  import { useImperativeHandle } from "react";
7
- import { useWidgetWithConfig } from "./generated/config.js";
7
+ import { useWidget } from "./generated/config.js";
8
8
  const export_getToastDefaultConfig = getToastDefaultConfig;
9
9
  const export_createToast = createToast;
10
10
  const export_toastPositions = toastPositions;
@@ -33,7 +33,7 @@ const ToastElement = (slotContext) => /* @__PURE__ */ jsx(
33
33
  }
34
34
  );
35
35
  function Toast(props) {
36
- const widgetContext = useWidgetWithConfig(export_createToast, props, "toast", {
36
+ const widgetContext = useWidget(export_createToast, props, {
37
37
  structure: ToastDefaultSlotStructure,
38
38
  children: props.children
39
39
  });
@@ -34,7 +34,7 @@ const ToastElement = (slotContext) => /* @__PURE__ */ jsxRuntime.jsx(
34
34
  }
35
35
  );
36
36
  function Toast(props) {
37
- const widgetContext = generated_config.useWidgetWithConfig(export_createToast, props, "toast", {
37
+ const widgetContext = generated_config.useWidget(export_createToast, props, {
38
38
  structure: ToastDefaultSlotStructure,
39
39
  children: props.children
40
40
  });
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Slot } from "@agnos-ui/react-headless/slot";
3
3
  import { useDirective } from "@agnos-ui/react-headless/utils/directive";
4
- import { useWidgetWithConfig } from "./generated/config.js";
4
+ import { useWidget } from "./generated/config.js";
5
5
  import { getTreeDefaultConfig, createTree } from "@agnos-ui/core-bootstrap/components/tree";
6
6
  import clsx from "clsx";
7
7
  const export_getTreeDefaultConfig = getTreeDefaultConfig;
@@ -38,7 +38,7 @@ const defaultConfig = {
38
38
  itemToggle: DefaultTreeSlotItemToggle
39
39
  };
40
40
  function Tree(props) {
41
- const widgetContext = useWidgetWithConfig(export_createTree, props, "tree", { ...defaultConfig });
41
+ const widgetContext = useWidget(export_createTree, props, { ...defaultConfig });
42
42
  return /* @__PURE__ */ jsx(Slot, { slotContent: widgetContext.state.structure, props: widgetContext });
43
43
  }
44
44
  export {
@@ -39,7 +39,7 @@ const defaultConfig = {
39
39
  itemToggle: DefaultTreeSlotItemToggle
40
40
  };
41
41
  function Tree(props) {
42
- const widgetContext = generated_config.useWidgetWithConfig(export_createTree, props, "tree", { ...defaultConfig });
42
+ const widgetContext = generated_config.useWidget(export_createTree, props, { ...defaultConfig });
43
43
  return /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: widgetContext.state.structure, props: widgetContext });
44
44
  }
45
45
  exports.DefaultTreeSlotItem = DefaultTreeSlotItem;