@agnos-ui/react-bootstrap 0.5.0 → 0.6.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{accordion-CxT3atuW.cjs → accordion-01ch6GZW.cjs} +3 -3
- package/{accordion-BX1iR5BO.js → accordion-D3SZgVk6.js} +3 -3
- package/{alert-D1FXDsJn.js → alert-CTTuh9t9.js} +1 -1
- package/{alert-LKMMYmg_.cjs → alert-DGvp2r3W.cjs} +1 -1
- package/{collapse-DhsL8j2h.js → collapse-DNwn7xgF.js} +1 -1
- package/{collapse-BpPYsx89.cjs → collapse-Dodvr8dn.cjs} +1 -1
- package/components/accordion/accordion.d.ts +3 -3
- package/components/accordion/index.cjs +1 -1
- package/components/accordion/index.js +1 -1
- package/components/alert/index.cjs +1 -1
- package/components/alert/index.js +1 -1
- package/components/collapse/index.cjs +1 -1
- package/components/collapse/index.js +1 -1
- package/components/modal/index.cjs +1 -1
- package/components/modal/index.js +1 -1
- package/components/modal/modal.d.ts +6 -6
- package/components/pagination/pagination.d.ts +6 -6
- package/components/progressbar/progressbar.d.ts +4 -4
- package/components/rating/rating.d.ts +2 -2
- package/components/select/select.d.ts +2 -6
- package/components/select/select.gen.d.ts +6 -0
- package/components/slider/slider.d.ts +6 -6
- package/components/toast/index.cjs +1 -1
- package/components/toast/index.js +1 -1
- package/components/toast/toast.d.ts +2 -2
- package/components/tree/index.cjs +10 -0
- package/components/tree/index.d.ts +2 -0
- package/components/tree/index.js +10 -0
- package/components/tree/tree.d.ts +42 -0
- package/components/tree/tree.gen.d.ts +216 -0
- package/config.gen.d.ts +5 -0
- package/index.cjs +13 -5
- package/index.d.ts +1 -0
- package/index.js +13 -5
- package/{modal-CWuYx5n5.js → modal-DuCmvYiX.js} +1 -1
- package/{modal-DpMvOtL2.cjs → modal-_OcXelvY.cjs} +1 -1
- package/package.json +3 -3
- package/{toast-Dgfv5S_p.js → toast-CS1mMdhx.js} +3 -2
- package/{toast-E1DM85iZ.cjs → toast-Vv1dxnuA.cjs} +3 -2
- package/tree-CCmlpEPq.cjs +51 -0
- package/tree-CrXS0sFt.js +52 -0
|
@@ -27,17 +27,17 @@ const AccordionItem = React.forwardRef(
|
|
|
27
27
|
structure: AccordionItemDefaultSlotStructure
|
|
28
28
|
});
|
|
29
29
|
const { state, api, directives } = widgetContext;
|
|
30
|
-
React.useImperativeHandle(ref, () => api, []);
|
|
30
|
+
React.useImperativeHandle(ref, () => api, [api]);
|
|
31
31
|
React.useEffect(() => {
|
|
32
32
|
api.initDone();
|
|
33
|
-
}, []);
|
|
33
|
+
}, [api]);
|
|
34
34
|
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 }) });
|
|
35
35
|
}
|
|
36
36
|
);
|
|
37
37
|
const Accordion = React.forwardRef(
|
|
38
38
|
function Accordion2(props, ref) {
|
|
39
39
|
const widget = generated_config.useWidgetWithConfig(export_createAccordion, props, "accordion");
|
|
40
|
-
React.useImperativeHandle(ref, () => widget.api, []);
|
|
40
|
+
React.useImperativeHandle(ref, () => widget.api, [widget.api]);
|
|
41
41
|
return /* @__PURE__ */ jsxRuntime.jsx(AccordionDIContext.Provider, { value: widget.api, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirectives([directive.classDirective, "accordion"], widget.directives.accordionDirective), children: props.children }) });
|
|
42
42
|
}
|
|
43
43
|
);
|
|
@@ -26,17 +26,17 @@ const AccordionItem = forwardRef(
|
|
|
26
26
|
structure: AccordionItemDefaultSlotStructure
|
|
27
27
|
});
|
|
28
28
|
const { state, api, directives } = widgetContext;
|
|
29
|
-
useImperativeHandle(ref, () => api, []);
|
|
29
|
+
useImperativeHandle(ref, () => api, [api]);
|
|
30
30
|
useEffect(() => {
|
|
31
31
|
api.initDone();
|
|
32
|
-
}, []);
|
|
32
|
+
}, [api]);
|
|
33
33
|
return /* @__PURE__ */ jsx("div", { ...useDirectives([classDirective, `accordion-item ${state.className}`], directives.itemDirective), children: /* @__PURE__ */ jsx(Slot, { slotContent: state.structure, props: widgetContext }) });
|
|
34
34
|
}
|
|
35
35
|
);
|
|
36
36
|
const Accordion = forwardRef(
|
|
37
37
|
function Accordion2(props, ref) {
|
|
38
38
|
const widget = useWidgetWithConfig(export_createAccordion, props, "accordion");
|
|
39
|
-
useImperativeHandle(ref, () => widget.api, []);
|
|
39
|
+
useImperativeHandle(ref, () => widget.api, [widget.api]);
|
|
40
40
|
return /* @__PURE__ */ jsx(AccordionDIContext.Provider, { value: widget.api, children: /* @__PURE__ */ jsx("div", { ...useDirectives([classDirective, "accordion"], widget.directives.accordionDirective), children: props.children }) });
|
|
41
41
|
}
|
|
42
42
|
);
|
|
@@ -28,7 +28,7 @@ const Alert = forwardRef(function Alert2(props, ref) {
|
|
|
28
28
|
const widgetContext = useWidgetWithConfig(export_createAlert, props, "alert", {
|
|
29
29
|
structure: AlertDefaultSlotStructure
|
|
30
30
|
});
|
|
31
|
-
useImperativeHandle(ref, () => widgetContext.api, []);
|
|
31
|
+
useImperativeHandle(ref, () => widgetContext.api, [widgetContext.api]);
|
|
32
32
|
return /* @__PURE__ */ jsx(Fragment, { children: !widgetContext.state.hidden && /* @__PURE__ */ jsx(AlertElement, { ...widgetContext }) });
|
|
33
33
|
});
|
|
34
34
|
export {
|
|
@@ -29,7 +29,7 @@ const Alert = React.forwardRef(function Alert2(props, ref) {
|
|
|
29
29
|
const widgetContext = generated_config.useWidgetWithConfig(export_createAlert, props, "alert", {
|
|
30
30
|
structure: AlertDefaultSlotStructure
|
|
31
31
|
});
|
|
32
|
-
React.useImperativeHandle(ref, () => widgetContext.api, []);
|
|
32
|
+
React.useImperativeHandle(ref, () => widgetContext.api, [widgetContext.api]);
|
|
33
33
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: !widgetContext.state.hidden && /* @__PURE__ */ jsxRuntime.jsx(AlertElement, { ...widgetContext }) });
|
|
34
34
|
});
|
|
35
35
|
exports.Alert = Alert;
|
|
@@ -8,7 +8,7 @@ const export_createCollapse = createCollapse;
|
|
|
8
8
|
const Collapse = forwardRef(
|
|
9
9
|
function Collapse2(props, ref) {
|
|
10
10
|
const { api, directives } = useWidgetWithConfig(export_createCollapse, props, "collapse");
|
|
11
|
-
useImperativeHandle(ref, () => api, []);
|
|
11
|
+
useImperativeHandle(ref, () => api, [api]);
|
|
12
12
|
return /* @__PURE__ */ jsx("div", { ...useDirectives(directives.collapseDirective), children: props.children });
|
|
13
13
|
}
|
|
14
14
|
);
|
|
@@ -9,7 +9,7 @@ const export_createCollapse = collapse.createCollapse;
|
|
|
9
9
|
const Collapse = React.forwardRef(
|
|
10
10
|
function Collapse2(props, ref) {
|
|
11
11
|
const { api, directives } = generated_config.useWidgetWithConfig(export_createCollapse, props, "collapse");
|
|
12
|
-
React.useImperativeHandle(ref, () => api, []);
|
|
12
|
+
React.useImperativeHandle(ref, () => api, [api]);
|
|
13
13
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...directive.useDirectives(directives.collapseDirective), children: props.children });
|
|
14
14
|
}
|
|
15
15
|
);
|
|
@@ -3,8 +3,8 @@ import type { AccordionApi, AccordionItemApi, AccordionItemContext, AccordionIte
|
|
|
3
3
|
/**
|
|
4
4
|
* Renders the default slot structure for an accordion item.
|
|
5
5
|
*
|
|
6
|
-
* @param
|
|
7
|
-
* @returns
|
|
6
|
+
* @param slotContext - The context containing state and directives for the accordion item.
|
|
7
|
+
* @returns The JSX element representing the accordion item's default slot structure.
|
|
8
8
|
*/
|
|
9
9
|
export declare const AccordionItemDefaultSlotStructure: (slotContext: AccordionItemContext) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
/**
|
|
@@ -33,7 +33,7 @@ export declare const AccordionItem: ForwardRefExoticComponent<Partial<AccordionI
|
|
|
33
33
|
* This component uses a forward ref to expose the Accordion API to parent components.
|
|
34
34
|
* It leverages the {@link useWidgetWithConfig} hook to create the accordion widget and
|
|
35
35
|
* {@link https://react.dev/reference/react/useImperativeHandle | useImperativeHandle} to bind the widget API to the ref.
|
|
36
|
-
|
|
36
|
+
*
|
|
37
37
|
* @param {PropsWithChildren<Partial<AccordionProps>>} props - The properties for the Accordion component.
|
|
38
38
|
* @param {ForwardedRef<AccordionApi>} ref - The ref to be forwarded to the Accordion API.
|
|
39
39
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const accordion = require("../../accordion-
|
|
3
|
+
const accordion = require("../../accordion-01ch6GZW.cjs");
|
|
4
4
|
exports.Accordion = accordion.Accordion;
|
|
5
5
|
exports.AccordionItem = accordion.AccordionItem;
|
|
6
6
|
exports.AccordionItemDefaultSlotStructure = accordion.AccordionItemDefaultSlotStructure;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const alert = require("../../alert-
|
|
3
|
+
const alert = require("../../alert-DGvp2r3W.cjs");
|
|
4
4
|
exports.Alert = alert.Alert;
|
|
5
5
|
exports.AlertDefaultSlotStructure = alert.AlertDefaultSlotStructure;
|
|
6
6
|
exports.createAlert = alert.export_createAlert;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const collapse = require("../../collapse-
|
|
3
|
+
const collapse = require("../../collapse-Dodvr8dn.cjs");
|
|
4
4
|
exports.Collapse = collapse.Collapse;
|
|
5
5
|
exports.createCollapse = collapse.export_createCollapse;
|
|
6
6
|
exports.getCollapseDefaultConfig = collapse.export_getCollapseDefaultConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const modal = require("../../modal-
|
|
3
|
+
const modal = require("../../modal-_OcXelvY.cjs");
|
|
4
4
|
exports.Modal = modal.Modal;
|
|
5
5
|
exports.ModalDefaultSlotHeader = modal.ModalDefaultSlotHeader;
|
|
6
6
|
exports.ModalDefaultSlotStructure = modal.ModalDefaultSlotStructure;
|
|
@@ -4,16 +4,16 @@ import type { ModalApi, ModalContext, ModalProps } from './modal.gen';
|
|
|
4
4
|
* A default header component for the modal that displays a title and an optional close button.
|
|
5
5
|
*
|
|
6
6
|
* @template Data - The type of data used in the modal context.
|
|
7
|
-
* @param
|
|
8
|
-
* @returns
|
|
7
|
+
* @param slotContext - The context object containing the state and directives for the modal.
|
|
8
|
+
* @returns The JSX element representing the modal header.
|
|
9
9
|
*/
|
|
10
10
|
export declare const ModalDefaultSlotHeader: <Data>(slotContext: ModalContext<Data>) => import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
/**
|
|
12
12
|
* Renders the default slot structure for a modal component.
|
|
13
13
|
*
|
|
14
14
|
* @template Data - The type of the data used in the modal context.
|
|
15
|
-
* @param
|
|
16
|
-
* @returns
|
|
15
|
+
* @param slotContext - The context containing the state and props for the modal slots.
|
|
16
|
+
* @returns The JSX structure for the modal's default slots.
|
|
17
17
|
*/
|
|
18
18
|
export declare const ModalDefaultSlotStructure: <Data>(slotContext: ModalContext<Data>) => import("react/jsx-runtime").JSX.Element;
|
|
19
19
|
/**
|
|
@@ -31,7 +31,7 @@ export declare const Modal: <Data>(props: Partial<ModalProps<Data>> & RefAttribu
|
|
|
31
31
|
* Opens a modal dialog with the specified options.
|
|
32
32
|
*
|
|
33
33
|
* @template Data - The type of data that the modal will handle.
|
|
34
|
-
* @param
|
|
35
|
-
* @returns
|
|
34
|
+
* @param options - The options to configure the modal.
|
|
35
|
+
* @returns A promise that resolves when the modal is closed.
|
|
36
36
|
*/
|
|
37
37
|
export declare function openModal<Data>(options: Partial<ModalProps<Data>>): Promise<any>;
|
|
@@ -2,8 +2,8 @@ import type { PaginationContext, PaginationProps } from './pagination.gen';
|
|
|
2
2
|
/**
|
|
3
3
|
* Renders the default slot pages for the pagination component.
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
6
|
-
* @returns
|
|
5
|
+
* @param slotContext - The context containing pagination state and directives.
|
|
6
|
+
* @returns The rendered pagination items or null if there are no pages.
|
|
7
7
|
*
|
|
8
8
|
* The function iterates over the pages in the pagination state and generates JSX elements for each page.
|
|
9
9
|
* If a page is represented by -1, it renders an ellipsis item. Otherwise, it renders a page item.
|
|
@@ -17,8 +17,8 @@ export declare const PaginationDefaultSlotPages: (slotContext: PaginationContext
|
|
|
17
17
|
/**
|
|
18
18
|
* Renders the default slot structure for the pagination component.
|
|
19
19
|
*
|
|
20
|
-
* @param
|
|
21
|
-
* @returns
|
|
20
|
+
* @param slotContext - The context containing the state and directives for pagination.
|
|
21
|
+
* @returns The rendered pagination component.
|
|
22
22
|
*
|
|
23
23
|
* The function constructs the pagination structure based on the provided state and directives.
|
|
24
24
|
* It conditionally includes navigation buttons for first, previous, next, and last pages based on the state.
|
|
@@ -30,7 +30,7 @@ export declare const PaginationDefaultSlotStructure: (slotContext: PaginationCon
|
|
|
30
30
|
* Pagination component that renders a navigation element for paginated content.
|
|
31
31
|
* It uses the {@link useWidgetWithConfig} hook to create a pagination widget with the provided props.
|
|
32
32
|
*
|
|
33
|
-
* @param
|
|
34
|
-
* @returns
|
|
33
|
+
* @param props - The properties for the Pagination component.
|
|
34
|
+
* @returns The rendered pagination navigation element.
|
|
35
35
|
*/
|
|
36
36
|
export declare function Pagination(props: Partial<PaginationProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,16 +2,16 @@ import type { ProgressbarContext, ProgressbarProps } from './progressbar.gen';
|
|
|
2
2
|
/**
|
|
3
3
|
* Renders a progress bar component with customizable appearance and behavior.
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
5
|
+
* @param slotContext - The context containing the state and properties for the progress bar.
|
|
6
6
|
*
|
|
7
|
-
* @returns
|
|
7
|
+
* @returns The rendered progress bar component.
|
|
8
8
|
*/
|
|
9
9
|
export declare const ProgressbarDefaultSlotStructure: (slotContext: ProgressbarContext) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
/**
|
|
11
11
|
* Progressbar component that utilizes the {@link useWidgetWithConfig} hook to create a progress bar widget.
|
|
12
12
|
*
|
|
13
|
-
* @param
|
|
13
|
+
* @param props - The properties to configure the progress bar.
|
|
14
14
|
*
|
|
15
|
-
* @returns
|
|
15
|
+
* @returns A div element containing the progress bar with appropriate ARIA directives and slot content.
|
|
16
16
|
*/
|
|
17
17
|
export declare const Progressbar: (props: Partial<ProgressbarProps>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,8 +2,8 @@ import type { RatingProps } from './rating.gen';
|
|
|
2
2
|
/**
|
|
3
3
|
* Rating component that displays a series of stars based on the provided state.
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
6
|
-
* @returns
|
|
5
|
+
* @param props - The properties for the Rating component.
|
|
6
|
+
* @returns The rendered Rating component.
|
|
7
7
|
*
|
|
8
8
|
* @remarks
|
|
9
9
|
* This component uses the {@link useWidgetWithConfig} hook to initialize and configure the rating widget.
|
|
@@ -3,15 +3,11 @@ import type { SelectProps } from './select.gen';
|
|
|
3
3
|
* A generic Select component that provides a customizable dropdown selection interface.
|
|
4
4
|
*
|
|
5
5
|
* @template Item - The type of the items in the selection.
|
|
6
|
-
* @param
|
|
7
|
-
* @returns
|
|
6
|
+
* @param props - The properties for the Select component.
|
|
7
|
+
* @returns The rendered Select component.
|
|
8
8
|
*
|
|
9
9
|
* @remarks
|
|
10
10
|
* This component uses a widget context to manage its state and directives. It supports
|
|
11
11
|
* custom badge labels and item labels through the widget configuration.
|
|
12
|
-
*
|
|
13
|
-
* @component
|
|
14
|
-
* @param {Partial<SelectProps<Item>>} props - The properties for the Select component.
|
|
15
|
-
* @returns {JSX.Element} The rendered Select component.
|
|
16
12
|
*/
|
|
17
13
|
export declare function Select<Item>(props: Partial<SelectProps<Item>>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -306,6 +306,8 @@ declare const export_createSelect: <Item>(config?: PropsConfig<SelectProps<Item>
|
|
|
306
306
|
export { export_createSelect as createSelect };
|
|
307
307
|
/**
|
|
308
308
|
* Item representation built from the items provided in parameters
|
|
309
|
+
*
|
|
310
|
+
* @template T - The type of the Select Items
|
|
309
311
|
*/
|
|
310
312
|
export interface ItemContext<T> {
|
|
311
313
|
/**
|
|
@@ -323,6 +325,8 @@ export interface ItemContext<T> {
|
|
|
323
325
|
}
|
|
324
326
|
/**
|
|
325
327
|
* Interface representing the API for a Select component.
|
|
328
|
+
*
|
|
329
|
+
* @template Item - The type of the Select Items
|
|
326
330
|
*/
|
|
327
331
|
export interface SelectApi<Item> {
|
|
328
332
|
/**
|
|
@@ -388,6 +392,8 @@ export interface SelectApi<Item> {
|
|
|
388
392
|
}
|
|
389
393
|
/**
|
|
390
394
|
* Interface representing the directives used in the Select component.
|
|
395
|
+
*
|
|
396
|
+
* @template Item - The type of the Select Items
|
|
391
397
|
*/
|
|
392
398
|
export interface SelectDirectives<Item> {
|
|
393
399
|
/**
|
|
@@ -4,23 +4,23 @@ import type { SliderContext, SliderProps, SliderSlotHandleContext } from './slid
|
|
|
4
4
|
* A functional component that renders a button element with a directive applied to it.
|
|
5
5
|
* The directive is provided through the `slotContext` parameter.
|
|
6
6
|
*
|
|
7
|
-
* @param
|
|
8
|
-
* @returns
|
|
7
|
+
* @param slotContext - The context object containing the directives and item for the slider handle.
|
|
8
|
+
* @returns A button element with the applied directive.
|
|
9
9
|
*/
|
|
10
10
|
export declare const SliderDefaultSlotHandle: (slotContext: SliderSlotHandleContext) => import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
/**
|
|
12
12
|
* Renders the default slot structure for the Slider component.
|
|
13
13
|
*
|
|
14
|
-
* @param
|
|
15
|
-
* @returns
|
|
14
|
+
* @param slotContext - The context object containing state and directives for the slider.
|
|
15
|
+
* @returns The JSX element representing the default slot structure.
|
|
16
16
|
*
|
|
17
17
|
*/
|
|
18
18
|
export declare const SliderDefaultSlotStructure: (slotContext: SliderContext) => import("react/jsx-runtime").JSX.Element;
|
|
19
19
|
/**
|
|
20
20
|
* Slider component that integrates with a widget context and renders a slot structure.
|
|
21
21
|
*
|
|
22
|
-
* @param
|
|
23
|
-
* @returns
|
|
22
|
+
* @param props - The properties for the Slider component.
|
|
23
|
+
* @returns The rendered Slider component.
|
|
24
24
|
*
|
|
25
25
|
* The Slider component uses the {@link useWidgetWithConfig} hook to create a widget context with the provided
|
|
26
26
|
* configuration. It then applies the `sliderDirective` to a `div` element and renders the slot content
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const toast = require("../../toast-
|
|
3
|
+
const toast = require("../../toast-Vv1dxnuA.cjs");
|
|
4
4
|
exports.Toast = toast.Toast;
|
|
5
5
|
exports.ToastDefaultSlotStructure = toast.ToastDefaultSlotStructure;
|
|
6
6
|
exports.createToast = toast.export_createToast;
|
|
@@ -3,8 +3,8 @@ import type { ToastApi, ToastContext, ToastProps } from './toast.gen';
|
|
|
3
3
|
/**
|
|
4
4
|
* Renders the default slot structure for a Toast component.
|
|
5
5
|
*
|
|
6
|
-
* @param
|
|
7
|
-
* @returns
|
|
6
|
+
* @param slotContext - The context containing the state and properties for the Toast component.
|
|
7
|
+
* @returns The JSX element representing the default slot structure of the Toast.
|
|
8
8
|
*/
|
|
9
9
|
export declare const ToastDefaultSlotStructure: (slotContext: ToastContext) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
/**
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const tree = require("../../tree-CCmlpEPq.cjs");
|
|
4
|
+
exports.DefaultTreeSlotItem = tree.DefaultTreeSlotItem;
|
|
5
|
+
exports.DefaultTreeSlotItemContent = tree.DefaultTreeSlotItemContent;
|
|
6
|
+
exports.DefaultTreeSlotItemToggle = tree.DefaultTreeSlotItemToggle;
|
|
7
|
+
exports.DefaultTreeSlotStructure = tree.DefaultTreeSlotStructure;
|
|
8
|
+
exports.Tree = tree.Tree;
|
|
9
|
+
exports.createTree = tree.export_createTree;
|
|
10
|
+
exports.getTreeDefaultConfig = tree.export_getTreeDefaultConfig;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { b, a, D, c, T, d, e } from "../../tree-CrXS0sFt.js";
|
|
2
|
+
export {
|
|
3
|
+
b as DefaultTreeSlotItem,
|
|
4
|
+
a as DefaultTreeSlotItemContent,
|
|
5
|
+
D as DefaultTreeSlotItemToggle,
|
|
6
|
+
c as DefaultTreeSlotStructure,
|
|
7
|
+
T as Tree,
|
|
8
|
+
d as createTree,
|
|
9
|
+
e as getTreeDefaultConfig
|
|
10
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { TreeContext, TreeProps, TreeSlotItemContext } from './tree.gen';
|
|
2
|
+
/**
|
|
3
|
+
* A functional component that renders a toggle element with a directive applied to it.
|
|
4
|
+
* The directive is provided through the `slotContext` parameter.
|
|
5
|
+
*
|
|
6
|
+
* @param slotContext - The context object containing the directives and item the toggle.
|
|
7
|
+
* @returns A toggle element with the applied directive.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DefaultTreeSlotItemToggle: (slotContext: TreeSlotItemContext) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* A functional component that renders a tree item content element.
|
|
12
|
+
*
|
|
13
|
+
* @param slotContext - The context object containing the item content for display.
|
|
14
|
+
* @returns A tree item element.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DefaultTreeSlotItemContent: (slotContext: TreeSlotItemContext) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* A functional component that renders a tree item element with a directive applied to it.
|
|
19
|
+
* The directive is provided through the `slotContext` parameter.
|
|
20
|
+
*
|
|
21
|
+
* @param slotContext - The context object containing the directives and item for the tree item element.
|
|
22
|
+
* @returns A tree root element with the applied directive.
|
|
23
|
+
*/
|
|
24
|
+
export declare const DefaultTreeSlotItem: (slotContext: TreeSlotItemContext) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* A functional component that renders a tree structure with a directive applied to it.
|
|
27
|
+
* The directive is provided through the `slotContext` parameter.
|
|
28
|
+
*
|
|
29
|
+
* @param slotContext - The context object containing the directives and items for the tree display.
|
|
30
|
+
* @returns A tree structure with the applied directive.
|
|
31
|
+
*/
|
|
32
|
+
export declare const DefaultTreeSlotStructure: (slotContext: TreeContext) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* Tree component that integrates with a widget context and renders a slot structure.
|
|
35
|
+
*
|
|
36
|
+
* @param props - The properties for the Tree component.
|
|
37
|
+
* @returns The rendered Tree component.
|
|
38
|
+
*
|
|
39
|
+
* The Tree component uses the {@link useWidgetWithConfig} hook to create a widget context with the provided
|
|
40
|
+
* configuration. It renders the slot content using the `Slot` component.
|
|
41
|
+
*/
|
|
42
|
+
export declare function Tree(props: Partial<TreeProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import type { WidgetSlotContext, SlotContent, Widget, WidgetFactory, Directive } from '@agnos-ui/react-headless/types';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieve a shallow copy of the default Tree config
|
|
4
|
+
* @returns the default Tree config
|
|
5
|
+
*/
|
|
6
|
+
declare const export_getTreeDefaultConfig: () => TreeProps;
|
|
7
|
+
export { export_getTreeDefaultConfig as getTreeDefaultConfig };
|
|
8
|
+
/**
|
|
9
|
+
* Represents the context for a Tree widget.
|
|
10
|
+
* This interface is an alias for `WidgetSlotContext<TreeWidget>`.
|
|
11
|
+
*/
|
|
12
|
+
export type TreeContext = WidgetSlotContext<TreeWidget>;
|
|
13
|
+
/**
|
|
14
|
+
* Represents the context for a tree item, extending the base `TreeContext`
|
|
15
|
+
* with an additional `item` property.
|
|
16
|
+
*/
|
|
17
|
+
export type TreeSlotItemContext = TreeContext & {
|
|
18
|
+
item: NormalizedTreeItem;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Represents the state of a Tree component.
|
|
22
|
+
*/
|
|
23
|
+
export interface TreeState {
|
|
24
|
+
/**
|
|
25
|
+
* Array of normalized tree nodes
|
|
26
|
+
*/
|
|
27
|
+
normalizedNodes: NormalizedTreeItem[];
|
|
28
|
+
/**
|
|
29
|
+
* Getter of expanded state for each tree node
|
|
30
|
+
*/
|
|
31
|
+
expandedMap: {
|
|
32
|
+
get(item: NormalizedTreeItem): boolean | undefined;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Optional accessibility label for the tree if there is no explicit label
|
|
36
|
+
*
|
|
37
|
+
* @defaultValue `''`
|
|
38
|
+
*/
|
|
39
|
+
ariaLabel?: string;
|
|
40
|
+
/**
|
|
41
|
+
* CSS classes to be applied on the widget main container
|
|
42
|
+
*
|
|
43
|
+
* @defaultValue `''`
|
|
44
|
+
*/
|
|
45
|
+
className: string;
|
|
46
|
+
/**
|
|
47
|
+
* Slot to change the default display of the tree
|
|
48
|
+
*/
|
|
49
|
+
structure: SlotContent<TreeContext>;
|
|
50
|
+
/**
|
|
51
|
+
* Slot to change the default tree item
|
|
52
|
+
*/
|
|
53
|
+
item: SlotContent<TreeSlotItemContext>;
|
|
54
|
+
/**
|
|
55
|
+
* Slot to change the default tree item content
|
|
56
|
+
*/
|
|
57
|
+
itemContent: SlotContent<TreeSlotItemContext>;
|
|
58
|
+
/**
|
|
59
|
+
* Slot to change the default tree item toggle
|
|
60
|
+
*/
|
|
61
|
+
itemToggle: SlotContent<TreeSlotItemContext>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Represents the properties for the Tree component.
|
|
65
|
+
*/
|
|
66
|
+
export interface TreeProps {
|
|
67
|
+
/**
|
|
68
|
+
* Array of the tree nodes to display
|
|
69
|
+
*
|
|
70
|
+
* @defaultValue `[]`
|
|
71
|
+
*/
|
|
72
|
+
nodes: TreeItem[];
|
|
73
|
+
/**
|
|
74
|
+
* An event emitted when the user toggles the expand of the TreeItem.
|
|
75
|
+
*
|
|
76
|
+
* Event payload is equal to the TreeItem clicked.
|
|
77
|
+
*
|
|
78
|
+
* @defaultValue
|
|
79
|
+
* ```ts
|
|
80
|
+
* () => {}
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
onExpandToggle: (node: NormalizedTreeItem) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Retrieves expand items of the TreeItem
|
|
86
|
+
*
|
|
87
|
+
* @param node - HTML element that is representing the expand item
|
|
88
|
+
*
|
|
89
|
+
* @defaultValue
|
|
90
|
+
* ```ts
|
|
91
|
+
* (node: HTMLElement) => node.querySelectorAll('button')
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
navSelector(node: HTMLElement): NodeListOf<HTMLButtonElement>;
|
|
95
|
+
/**
|
|
96
|
+
* Return the value for the 'aria-label' attribute of the toggle
|
|
97
|
+
* @param label - tree item label
|
|
98
|
+
*
|
|
99
|
+
* @defaultValue
|
|
100
|
+
* ```ts
|
|
101
|
+
* (label: string) => `Toggle ${label}`
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
ariaLabelToggleFn: (label: string) => string;
|
|
105
|
+
/**
|
|
106
|
+
* Optional accessibility label for the tree if there is no explicit label
|
|
107
|
+
*
|
|
108
|
+
* @defaultValue `''`
|
|
109
|
+
*/
|
|
110
|
+
ariaLabel?: string;
|
|
111
|
+
/**
|
|
112
|
+
* CSS classes to be applied on the widget main container
|
|
113
|
+
*
|
|
114
|
+
* @defaultValue `''`
|
|
115
|
+
*/
|
|
116
|
+
className: string;
|
|
117
|
+
/**
|
|
118
|
+
* Slot to change the default display of the tree
|
|
119
|
+
*/
|
|
120
|
+
structure: SlotContent<TreeContext>;
|
|
121
|
+
/**
|
|
122
|
+
* Slot to change the default tree item
|
|
123
|
+
*/
|
|
124
|
+
item: SlotContent<TreeSlotItemContext>;
|
|
125
|
+
/**
|
|
126
|
+
* Slot to change the default tree item content
|
|
127
|
+
*/
|
|
128
|
+
itemContent: SlotContent<TreeSlotItemContext>;
|
|
129
|
+
/**
|
|
130
|
+
* Slot to change the default tree item toggle
|
|
131
|
+
*/
|
|
132
|
+
itemToggle: SlotContent<TreeSlotItemContext>;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Represents a Tree widget component.
|
|
136
|
+
*/
|
|
137
|
+
export type TreeWidget = Widget<TreeProps, TreeState, TreeApi, TreeDirectives>;
|
|
138
|
+
/**
|
|
139
|
+
* Create a Tree with given config props
|
|
140
|
+
* @param config - an optional tree config
|
|
141
|
+
* @returns a TreeWidget
|
|
142
|
+
*/
|
|
143
|
+
declare const export_createTree: WidgetFactory<TreeWidget>;
|
|
144
|
+
export { export_createTree as createTree };
|
|
145
|
+
/**
|
|
146
|
+
* Represents a tree item component.
|
|
147
|
+
*/
|
|
148
|
+
export interface TreeItem {
|
|
149
|
+
/**
|
|
150
|
+
* Optional accessibility label for the node
|
|
151
|
+
*/
|
|
152
|
+
ariaLabel?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Optional array of children nodes
|
|
155
|
+
*/
|
|
156
|
+
children?: TreeItem[];
|
|
157
|
+
/**
|
|
158
|
+
* If `true` the node is expanded
|
|
159
|
+
*/
|
|
160
|
+
isExpanded?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* String title of the node
|
|
163
|
+
*/
|
|
164
|
+
label: string;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Normalized TreeItem object
|
|
168
|
+
*/
|
|
169
|
+
export interface NormalizedTreeItem {
|
|
170
|
+
/**
|
|
171
|
+
* Accessibility label for the node
|
|
172
|
+
*/
|
|
173
|
+
ariaLabel: string;
|
|
174
|
+
/**
|
|
175
|
+
* Level in the hierarchy, starts with 0 for a root node
|
|
176
|
+
*/
|
|
177
|
+
level: number;
|
|
178
|
+
/**
|
|
179
|
+
* An array of children nodes
|
|
180
|
+
*/
|
|
181
|
+
children: NormalizedTreeItem[];
|
|
182
|
+
/**
|
|
183
|
+
* If `true` the node is expanded
|
|
184
|
+
*/
|
|
185
|
+
isExpanded?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* String title of the node
|
|
188
|
+
*/
|
|
189
|
+
label: string;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Interface representing the API for a Tree component.
|
|
193
|
+
*/
|
|
194
|
+
export interface TreeApi {
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Interface representing various directives used in the Tree component.
|
|
198
|
+
*/
|
|
199
|
+
export interface TreeDirectives {
|
|
200
|
+
/**
|
|
201
|
+
* Directive to attach navManager for the tree
|
|
202
|
+
*/
|
|
203
|
+
navigationDirective: Directive;
|
|
204
|
+
/**
|
|
205
|
+
* Directive to handle toggle for the tree item
|
|
206
|
+
*/
|
|
207
|
+
itemToggleDirective: Directive<{
|
|
208
|
+
item: NormalizedTreeItem;
|
|
209
|
+
}>;
|
|
210
|
+
/**
|
|
211
|
+
* Directive to handle attributes for the tree item
|
|
212
|
+
*/
|
|
213
|
+
itemAttributesDirective: Directive<{
|
|
214
|
+
item: NormalizedTreeItem;
|
|
215
|
+
}>;
|
|
216
|
+
}
|
package/config.gen.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { RatingProps } from './components/rating';
|
|
|
8
8
|
import type { SelectProps } from './components/select';
|
|
9
9
|
import type { SliderProps } from './components/slider';
|
|
10
10
|
import type { ToastProps } from './components/toast';
|
|
11
|
+
import type { TreeProps } from './components/tree';
|
|
11
12
|
export type WidgetsConfig = {
|
|
12
13
|
/**
|
|
13
14
|
* the accordion widget config
|
|
@@ -49,4 +50,8 @@ export type WidgetsConfig = {
|
|
|
49
50
|
* the toast widget config
|
|
50
51
|
*/
|
|
51
52
|
toast: ToastProps;
|
|
53
|
+
/**
|
|
54
|
+
* the tree widget config
|
|
55
|
+
*/
|
|
56
|
+
tree: TreeProps;
|
|
52
57
|
};
|
package/index.cjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const accordion = require("./accordion-
|
|
4
|
-
const alert = require("./alert-
|
|
5
|
-
const collapse = require("./collapse-
|
|
6
|
-
const modal = require("./modal-
|
|
3
|
+
const accordion = require("./accordion-01ch6GZW.cjs");
|
|
4
|
+
const alert = require("./alert-DGvp2r3W.cjs");
|
|
5
|
+
const collapse = require("./collapse-Dodvr8dn.cjs");
|
|
6
|
+
const modal = require("./modal-_OcXelvY.cjs");
|
|
7
7
|
const pagination = require("./pagination-b4pKj3Kx.cjs");
|
|
8
8
|
const progressbar = require("./progressbar-JO1ey9mx.cjs");
|
|
9
9
|
const rating = require("./rating-eI8T0zvS.cjs");
|
|
10
10
|
const select = require("./select-XHUAqTDw.cjs");
|
|
11
11
|
const slider = require("./slider-BUQne5aJ.cjs");
|
|
12
|
-
const toast = require("./toast-
|
|
12
|
+
const toast = require("./toast-Vv1dxnuA.cjs");
|
|
13
|
+
const tree = require("./tree-CCmlpEPq.cjs");
|
|
13
14
|
const types = require("@agnos-ui/react-headless/types");
|
|
14
15
|
const slot = require("@agnos-ui/react-headless/slot");
|
|
15
16
|
const config = require("@agnos-ui/react-headless/config");
|
|
@@ -82,6 +83,13 @@ exports.Toast = toast.Toast;
|
|
|
82
83
|
exports.ToastDefaultSlotStructure = toast.ToastDefaultSlotStructure;
|
|
83
84
|
exports.createToast = toast.export_createToast;
|
|
84
85
|
exports.getToastDefaultConfig = toast.export_getToastDefaultConfig;
|
|
86
|
+
exports.DefaultTreeSlotItem = tree.DefaultTreeSlotItem;
|
|
87
|
+
exports.DefaultTreeSlotItemContent = tree.DefaultTreeSlotItemContent;
|
|
88
|
+
exports.DefaultTreeSlotItemToggle = tree.DefaultTreeSlotItemToggle;
|
|
89
|
+
exports.DefaultTreeSlotStructure = tree.DefaultTreeSlotStructure;
|
|
90
|
+
exports.Tree = tree.Tree;
|
|
91
|
+
exports.createTree = tree.export_createTree;
|
|
92
|
+
exports.getTreeDefaultConfig = tree.export_getTreeDefaultConfig;
|
|
85
93
|
exports.WidgetsDefaultConfig = generated_config.WidgetsDefaultConfig;
|
|
86
94
|
exports.useWidgetContext = generated_config.useWidgetContext;
|
|
87
95
|
exports.useWidgetWithConfig = generated_config.useWidgetWithConfig;
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { b, a, A, d, c, f, e } from "./accordion-
|
|
2
|
-
import { a as a2, A as A2, b as b2, e as e2 } from "./alert-
|
|
3
|
-
import { C, a as a3, e as e3 } from "./collapse-
|
|
4
|
-
import { b as b3, M, a as a4, c as c2, e as e4, f as f2, d as d2, o } from "./modal-
|
|
1
|
+
import { b, a, A, d, c, f, e } from "./accordion-D3SZgVk6.js";
|
|
2
|
+
import { a as a2, A as A2, b as b2, e as e2 } from "./alert-CTTuh9t9.js";
|
|
3
|
+
import { C, a as a3, e as e3 } from "./collapse-DNwn7xgF.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-DuCmvYiX.js";
|
|
5
5
|
import { N, P, c as c3, a as a5, b as b4, d as d3, e as e5 } from "./pagination-5jlJWfFj.js";
|
|
6
6
|
import { a as a6, P as P2, b as b5, e as e6 } from "./progressbar-DKFR5epE.js";
|
|
7
7
|
import { R, a as a7, e as e7 } from "./rating-CTfRQGGu.js";
|
|
8
8
|
import { S, a as a8, e as e8 } from "./select-BriGqe3k.js";
|
|
9
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-
|
|
10
|
+
import { a as a10, T, b as b7, e as e10 } from "./toast-CS1mMdhx.js";
|
|
11
|
+
import { b as b8, a as a11, D, c as c5, T as T2, d as d4, e as e11 } from "./tree-CrXS0sFt.js";
|
|
11
12
|
export * from "@agnos-ui/react-headless/types";
|
|
12
13
|
export * from "@agnos-ui/react-headless/slot";
|
|
13
14
|
export * from "@agnos-ui/react-headless/config";
|
|
@@ -39,6 +40,10 @@ export {
|
|
|
39
40
|
a2 as Alert,
|
|
40
41
|
A2 as AlertDefaultSlotStructure,
|
|
41
42
|
C as Collapse,
|
|
43
|
+
b8 as DefaultTreeSlotItem,
|
|
44
|
+
a11 as DefaultTreeSlotItemContent,
|
|
45
|
+
D as DefaultTreeSlotItemToggle,
|
|
46
|
+
c5 as DefaultTreeSlotStructure,
|
|
42
47
|
b3 as Modal,
|
|
43
48
|
M as ModalDefaultSlotHeader,
|
|
44
49
|
a4 as ModalDefaultSlotStructure,
|
|
@@ -56,6 +61,7 @@ export {
|
|
|
56
61
|
a9 as SliderDefaultSlotStructure,
|
|
57
62
|
a10 as Toast,
|
|
58
63
|
T as ToastDefaultSlotStructure,
|
|
64
|
+
T2 as Tree,
|
|
59
65
|
WidgetsDefaultConfig,
|
|
60
66
|
d as createAccordion,
|
|
61
67
|
c as createAccordionItem,
|
|
@@ -68,6 +74,7 @@ export {
|
|
|
68
74
|
a8 as createSelect,
|
|
69
75
|
c4 as createSlider,
|
|
70
76
|
b7 as createToast,
|
|
77
|
+
d4 as createTree,
|
|
71
78
|
f as factoryCreateAccordion,
|
|
72
79
|
e as getAccordionDefaultConfig,
|
|
73
80
|
e2 as getAlertDefaultConfig,
|
|
@@ -79,6 +86,7 @@ export {
|
|
|
79
86
|
e8 as getSelectDefaultConfig,
|
|
80
87
|
e9 as getSliderDefaultConfig,
|
|
81
88
|
e10 as getToastDefaultConfig,
|
|
89
|
+
e11 as getTreeDefaultConfig,
|
|
82
90
|
f2 as modalCloseButtonClick,
|
|
83
91
|
d2 as modalOutsideClick,
|
|
84
92
|
o as openModal,
|
|
@@ -31,7 +31,7 @@ const Modal = forwardRef(function Modal2(props, ref) {
|
|
|
31
31
|
header: ModalDefaultSlotHeader,
|
|
32
32
|
structure: ModalDefaultSlotStructure
|
|
33
33
|
});
|
|
34
|
-
useImperativeHandle(ref, () => widgetContext.api, []);
|
|
34
|
+
useImperativeHandle(ref, () => widgetContext.api, [widgetContext.api]);
|
|
35
35
|
return /* @__PURE__ */ jsxs(Portal, { container: widgetContext.state.container, children: [
|
|
36
36
|
!widgetContext.state.backdropHidden && /* @__PURE__ */ jsx(BackdropElement, { ...widgetContext }),
|
|
37
37
|
!widgetContext.state.hidden && /* @__PURE__ */ jsx(ModalElement, { ...widgetContext })
|
|
@@ -32,7 +32,7 @@ const Modal = React.forwardRef(function Modal2(props, ref) {
|
|
|
32
32
|
header: ModalDefaultSlotHeader,
|
|
33
33
|
structure: ModalDefaultSlotStructure
|
|
34
34
|
});
|
|
35
|
-
React.useImperativeHandle(ref, () => widgetContext.api, []);
|
|
35
|
+
React.useImperativeHandle(ref, () => widgetContext.api, [widgetContext.api]);
|
|
36
36
|
return /* @__PURE__ */ jsxRuntime.jsxs(portal.Portal, { container: widgetContext.state.container, children: [
|
|
37
37
|
!widgetContext.state.backdropHidden && /* @__PURE__ */ jsxRuntime.jsx(BackdropElement, { ...widgetContext }),
|
|
38
38
|
!widgetContext.state.hidden && /* @__PURE__ */ jsxRuntime.jsx(ModalElement, { ...widgetContext })
|
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.
|
|
4
|
+
"version": "0.6.0-next.1",
|
|
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.
|
|
53
|
-
"@agnos-ui/react-headless": "0.
|
|
52
|
+
"@agnos-ui/core-bootstrap": "0.6.0-next.1",
|
|
53
|
+
"@agnos-ui/react-headless": "0.6.0-next.1",
|
|
54
54
|
"classnames": "^2.5.1"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
@@ -6,9 +6,10 @@ import { useWidgetWithConfig } from "./generated/config.js";
|
|
|
6
6
|
import { getToastDefaultConfig, createToast } from "@agnos-ui/core-bootstrap/components/toast";
|
|
7
7
|
const export_getToastDefaultConfig = getToastDefaultConfig;
|
|
8
8
|
const export_createToast = createToast;
|
|
9
|
+
const ToastHeaderContent = (slotContext) => /* @__PURE__ */ jsx("button", { ...useDirectives([classDirective, "btn-close me-0 ms-auto"], slotContext.directives.closeButtonDirective) });
|
|
9
10
|
const ToastHeader = (slotContext) => /* @__PURE__ */ jsxs("div", { className: "toast-header", children: [
|
|
10
11
|
/* @__PURE__ */ jsx(Slot, { slotContent: slotContext.state.header, props: slotContext }),
|
|
11
|
-
slotContext.state.dismissible && /* @__PURE__ */ jsx(
|
|
12
|
+
slotContext.state.dismissible && /* @__PURE__ */ jsx(ToastHeaderContent, { ...slotContext })
|
|
12
13
|
] });
|
|
13
14
|
const ToastCloseButtonNoHeader = (slotContext) => /* @__PURE__ */ jsx("button", { ...useDirectives([classDirective, "btn-close btn-close-white me-2 m-auto"], slotContext.directives.closeButtonDirective) });
|
|
14
15
|
const ToastDefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -33,7 +34,7 @@ const Toast = forwardRef(function Toast2(props, ref) {
|
|
|
33
34
|
structure: ToastDefaultSlotStructure,
|
|
34
35
|
children: props.children
|
|
35
36
|
});
|
|
36
|
-
useImperativeHandle(ref, () => widgetContext.api, []);
|
|
37
|
+
useImperativeHandle(ref, () => widgetContext.api, [widgetContext.api]);
|
|
37
38
|
return /* @__PURE__ */ jsx(Fragment, { children: !widgetContext.state.hidden && /* @__PURE__ */ jsx(ToastElement, { ...widgetContext }) });
|
|
38
39
|
});
|
|
39
40
|
export {
|
|
@@ -7,9 +7,10 @@ const generated_config = require("./generated/config.cjs");
|
|
|
7
7
|
const toast = require("@agnos-ui/core-bootstrap/components/toast");
|
|
8
8
|
const export_getToastDefaultConfig = toast.getToastDefaultConfig;
|
|
9
9
|
const export_createToast = toast.createToast;
|
|
10
|
+
const ToastHeaderContent = (slotContext) => /* @__PURE__ */ jsxRuntime.jsx("button", { ...directive.useDirectives([directive.classDirective, "btn-close me-0 ms-auto"], slotContext.directives.closeButtonDirective) });
|
|
10
11
|
const ToastHeader = (slotContext) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "toast-header", children: [
|
|
11
12
|
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: slotContext.state.header, props: slotContext }),
|
|
12
|
-
slotContext.state.dismissible && /* @__PURE__ */ jsxRuntime.jsx(
|
|
13
|
+
slotContext.state.dismissible && /* @__PURE__ */ jsxRuntime.jsx(ToastHeaderContent, { ...slotContext })
|
|
13
14
|
] });
|
|
14
15
|
const ToastCloseButtonNoHeader = (slotContext) => /* @__PURE__ */ jsxRuntime.jsx("button", { ...directive.useDirectives([directive.classDirective, "btn-close btn-close-white me-2 m-auto"], slotContext.directives.closeButtonDirective) });
|
|
15
16
|
const ToastDefaultSlotStructure = (slotContext) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -34,7 +35,7 @@ const Toast = React.forwardRef(function Toast2(props, ref) {
|
|
|
34
35
|
structure: ToastDefaultSlotStructure,
|
|
35
36
|
children: props.children
|
|
36
37
|
});
|
|
37
|
-
React.useImperativeHandle(ref, () => widgetContext.api, []);
|
|
38
|
+
React.useImperativeHandle(ref, () => widgetContext.api, [widgetContext.api]);
|
|
38
39
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: !widgetContext.state.hidden && /* @__PURE__ */ jsxRuntime.jsx(ToastElement, { ...widgetContext }) });
|
|
39
40
|
});
|
|
40
41
|
exports.Toast = Toast;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const slot = require("@agnos-ui/react-headless/slot");
|
|
4
|
+
const directive = require("@agnos-ui/react-headless/utils/directive");
|
|
5
|
+
const generated_config = require("./generated/config.cjs");
|
|
6
|
+
const tree = require("@agnos-ui/core-bootstrap/components/tree");
|
|
7
|
+
const classNames = require("classnames");
|
|
8
|
+
const export_getTreeDefaultConfig = tree.getTreeDefaultConfig;
|
|
9
|
+
const export_createTree = tree.createTree;
|
|
10
|
+
const ToggleButtonDisplay = ({ directive: directive$1, item }) => {
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx("button", { ...directive.useDirective(directive$1, { item }), children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "au-tree-expand-icon-svg" }) });
|
|
12
|
+
};
|
|
13
|
+
const DefaultTreeSlotItemToggle = (slotContext) => {
|
|
14
|
+
const { directives, item } = slotContext;
|
|
15
|
+
return item.children.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(ToggleButtonDisplay, { directive: directives.itemToggleDirective, item }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "au-tree-expand-icon-placeholder" });
|
|
16
|
+
};
|
|
17
|
+
const DefaultTreeSlotItemContent = (slotContext) => {
|
|
18
|
+
const { state, item } = slotContext;
|
|
19
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "au-tree-item", children: [
|
|
20
|
+
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.itemToggle, props: { ...slotContext } }),
|
|
21
|
+
item.label
|
|
22
|
+
] });
|
|
23
|
+
};
|
|
24
|
+
const DefaultTreeSlotItem = (slotContext) => {
|
|
25
|
+
const { state, directives, item } = slotContext;
|
|
26
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { ...directive.useDirective(directives.itemAttributesDirective, { item }), children: [
|
|
27
|
+
/* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.itemContent, props: { ...slotContext, item } }),
|
|
28
|
+
state.expandedMap.get(item) && /* @__PURE__ */ jsxRuntime.jsx("ul", { role: "group", children: item.children.map((child, index) => /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.item, props: { ...slotContext, item: child } }, child.label + child.level + index)) })
|
|
29
|
+
] });
|
|
30
|
+
};
|
|
31
|
+
const DefaultTreeSlotStructure = (slotContext) => {
|
|
32
|
+
const { state } = slotContext;
|
|
33
|
+
return /* @__PURE__ */ jsxRuntime.jsx("ul", { role: "tree", className: classNames("au-tree", state.className), ...directive.useDirective(slotContext.directives.navigationDirective), children: state.normalizedNodes.map((node, index) => /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: state.item, props: { item: node, ...slotContext } }, node.label + node.level + index)) });
|
|
34
|
+
};
|
|
35
|
+
const defaultConfig = {
|
|
36
|
+
structure: DefaultTreeSlotStructure,
|
|
37
|
+
item: DefaultTreeSlotItem,
|
|
38
|
+
itemContent: DefaultTreeSlotItemContent,
|
|
39
|
+
itemToggle: DefaultTreeSlotItemToggle
|
|
40
|
+
};
|
|
41
|
+
function Tree(props) {
|
|
42
|
+
const widgetContext = generated_config.useWidgetWithConfig(export_createTree, props, "tree", { ...defaultConfig });
|
|
43
|
+
return /* @__PURE__ */ jsxRuntime.jsx(slot.Slot, { slotContent: widgetContext.state.structure, props: widgetContext });
|
|
44
|
+
}
|
|
45
|
+
exports.DefaultTreeSlotItem = DefaultTreeSlotItem;
|
|
46
|
+
exports.DefaultTreeSlotItemContent = DefaultTreeSlotItemContent;
|
|
47
|
+
exports.DefaultTreeSlotItemToggle = DefaultTreeSlotItemToggle;
|
|
48
|
+
exports.DefaultTreeSlotStructure = DefaultTreeSlotStructure;
|
|
49
|
+
exports.Tree = Tree;
|
|
50
|
+
exports.export_createTree = export_createTree;
|
|
51
|
+
exports.export_getTreeDefaultConfig = export_getTreeDefaultConfig;
|
package/tree-CrXS0sFt.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from "@agnos-ui/react-headless/slot";
|
|
3
|
+
import { useDirective } from "@agnos-ui/react-headless/utils/directive";
|
|
4
|
+
import { useWidgetWithConfig } from "./generated/config.js";
|
|
5
|
+
import { getTreeDefaultConfig, createTree } from "@agnos-ui/core-bootstrap/components/tree";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
const export_getTreeDefaultConfig = getTreeDefaultConfig;
|
|
8
|
+
const export_createTree = createTree;
|
|
9
|
+
const ToggleButtonDisplay = ({ directive, item }) => {
|
|
10
|
+
return /* @__PURE__ */ jsx("button", { ...useDirective(directive, { item }), children: /* @__PURE__ */ jsx("span", { className: "au-tree-expand-icon-svg" }) });
|
|
11
|
+
};
|
|
12
|
+
const DefaultTreeSlotItemToggle = (slotContext) => {
|
|
13
|
+
const { directives, item } = slotContext;
|
|
14
|
+
return item.children.length > 0 ? /* @__PURE__ */ jsx(ToggleButtonDisplay, { directive: directives.itemToggleDirective, item }) : /* @__PURE__ */ jsx("span", { className: "au-tree-expand-icon-placeholder" });
|
|
15
|
+
};
|
|
16
|
+
const DefaultTreeSlotItemContent = (slotContext) => {
|
|
17
|
+
const { state, item } = slotContext;
|
|
18
|
+
return /* @__PURE__ */ jsxs("span", { className: "au-tree-item", children: [
|
|
19
|
+
/* @__PURE__ */ jsx(Slot, { slotContent: state.itemToggle, props: { ...slotContext } }),
|
|
20
|
+
item.label
|
|
21
|
+
] });
|
|
22
|
+
};
|
|
23
|
+
const DefaultTreeSlotItem = (slotContext) => {
|
|
24
|
+
const { state, directives, item } = slotContext;
|
|
25
|
+
return /* @__PURE__ */ jsxs("li", { ...useDirective(directives.itemAttributesDirective, { item }), children: [
|
|
26
|
+
/* @__PURE__ */ jsx(Slot, { slotContent: state.itemContent, props: { ...slotContext, item } }),
|
|
27
|
+
state.expandedMap.get(item) && /* @__PURE__ */ jsx("ul", { role: "group", children: item.children.map((child, index) => /* @__PURE__ */ jsx(Slot, { slotContent: state.item, props: { ...slotContext, item: child } }, child.label + child.level + index)) })
|
|
28
|
+
] });
|
|
29
|
+
};
|
|
30
|
+
const DefaultTreeSlotStructure = (slotContext) => {
|
|
31
|
+
const { state } = slotContext;
|
|
32
|
+
return /* @__PURE__ */ jsx("ul", { role: "tree", className: classNames("au-tree", state.className), ...useDirective(slotContext.directives.navigationDirective), children: state.normalizedNodes.map((node, index) => /* @__PURE__ */ jsx(Slot, { slotContent: state.item, props: { item: node, ...slotContext } }, node.label + node.level + index)) });
|
|
33
|
+
};
|
|
34
|
+
const defaultConfig = {
|
|
35
|
+
structure: DefaultTreeSlotStructure,
|
|
36
|
+
item: DefaultTreeSlotItem,
|
|
37
|
+
itemContent: DefaultTreeSlotItemContent,
|
|
38
|
+
itemToggle: DefaultTreeSlotItemToggle
|
|
39
|
+
};
|
|
40
|
+
function Tree(props) {
|
|
41
|
+
const widgetContext = useWidgetWithConfig(export_createTree, props, "tree", { ...defaultConfig });
|
|
42
|
+
return /* @__PURE__ */ jsx(Slot, { slotContent: widgetContext.state.structure, props: widgetContext });
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
DefaultTreeSlotItemToggle as D,
|
|
46
|
+
Tree as T,
|
|
47
|
+
DefaultTreeSlotItemContent as a,
|
|
48
|
+
DefaultTreeSlotItem as b,
|
|
49
|
+
DefaultTreeSlotStructure as c,
|
|
50
|
+
export_createTree as d,
|
|
51
|
+
export_getTreeDefaultConfig as e
|
|
52
|
+
};
|