@agnos-ui/react-bootstrap 0.4.0-next.1 → 0.4.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.
Files changed (67) hide show
  1. package/{accordion-DnlQmoOX.cjs → accordion-CG9yl3xh.cjs} +10 -8
  2. package/{accordion-CMbgQzoG.js → accordion-DKdL2Sr3.js} +12 -10
  3. package/{alert-DKl7HLhb.js → alert-0W1n8ahW.js} +7 -7
  4. package/{alert-Bn5ooyqK.cjs → alert-DeQRFTm3.cjs} +6 -6
  5. package/components/accordion/accordion.d.ts +1 -6
  6. package/components/accordion/accordion.gen.d.ts +77 -5
  7. package/components/accordion/index.cjs +5 -4
  8. package/components/accordion/index.d.ts +1 -0
  9. package/components/accordion/index.js +5 -4
  10. package/components/alert/alert.d.ts +1 -5
  11. package/components/alert/alert.gen.d.ts +61 -7
  12. package/components/alert/index.cjs +3 -3
  13. package/components/alert/index.d.ts +1 -0
  14. package/components/alert/index.js +3 -3
  15. package/components/modal/index.cjs +5 -12
  16. package/components/modal/index.d.ts +1 -0
  17. package/components/modal/index.js +5 -6
  18. package/components/modal/modal.d.ts +1 -6
  19. package/components/modal/modal.gen.d.ts +123 -23
  20. package/components/pagination/index.cjs +3 -3
  21. package/components/pagination/index.d.ts +2 -0
  22. package/components/pagination/index.js +4 -4
  23. package/components/pagination/pagination.d.ts +1 -6
  24. package/components/pagination/pagination.gen.d.ts +188 -18
  25. package/components/progressbar/index.cjs +3 -3
  26. package/components/progressbar/index.d.ts +1 -0
  27. package/components/progressbar/index.js +3 -3
  28. package/components/progressbar/progressbar.d.ts +1 -5
  29. package/components/progressbar/progressbar.gen.d.ts +54 -1
  30. package/components/rating/index.cjs +3 -3
  31. package/components/rating/index.d.ts +1 -0
  32. package/components/rating/index.js +3 -3
  33. package/components/rating/rating.d.ts +1 -5
  34. package/components/rating/rating.gen.d.ts +84 -1
  35. package/components/select/index.cjs +3 -3
  36. package/components/select/index.d.ts +1 -0
  37. package/components/select/index.js +3 -3
  38. package/components/select/select.d.ts +1 -5
  39. package/components/select/select.gen.d.ts +121 -1
  40. package/components/slider/index.cjs +3 -3
  41. package/components/slider/index.d.ts +1 -0
  42. package/components/slider/index.js +3 -3
  43. package/components/slider/slider.d.ts +1 -5
  44. package/components/slider/slider.gen.d.ts +98 -3
  45. package/components/toast/index.cjs +3 -3
  46. package/components/toast/index.d.ts +1 -0
  47. package/components/toast/index.js +3 -3
  48. package/components/toast/toast.d.ts +1 -5
  49. package/components/toast/toast.gen.d.ts +65 -7
  50. package/config.d.ts +1 -1
  51. package/index.cjs +31 -37
  52. package/index.js +35 -35
  53. package/{modal-1m6cSYmZ.cjs → modal-Cyt40iyH.cjs} +14 -11
  54. package/{modal-BJy1upw0.js → modal-qidZ4ghL.js} +15 -12
  55. package/package.json +4 -4
  56. package/{pagination-B76wbKhG.js → pagination-BDq1dOoH.js} +9 -9
  57. package/{pagination-DeZ2Eb3e.cjs → pagination-ChA90-py.cjs} +6 -6
  58. package/{progressbar-UDs4TPtQ.js → progressbar-B0keLNtE.js} +8 -8
  59. package/{progressbar-DKshX5DJ.cjs → progressbar-Fa1PDviu.cjs} +7 -7
  60. package/{rating-DRAx20tg.js → rating-CWOEBPWs.js} +7 -7
  61. package/{rating-DB4Ze-r4.cjs → rating-D5-3ELHv.cjs} +6 -6
  62. package/{select-CxX_TdVh.cjs → select-C4STYCmG.cjs} +6 -6
  63. package/{select-CEXxOyRB.js → select-DmgOBdqs.js} +6 -6
  64. package/{slider-CnK847iw.js → slider-CxodlRoZ.js} +9 -9
  65. package/{slider-Du37lWVJ.cjs → slider-MNZTN_vu.cjs} +8 -8
  66. package/{toast-Bvz7Uyrd.js → toast-3amUxqw1.js} +7 -7
  67. package/{toast-cd5__9Rl.cjs → toast-BXMjE9E3.cjs} +6 -6
@@ -1,10 +1,17 @@
1
- import type { WidgetSlotContext, SlotContent, Widget, Directive } from '@agnos-ui/react-headless/types';
1
+ import { modalOutsideClick, modalCloseButtonClick } from '@agnos-ui/core-bootstrap/components/modal';
2
+ import type { WidgetSlotContext, SlotContent, Widget, PropsConfig, Directive } from '@agnos-ui/react-headless/types';
2
3
  import type { TransitionFn } from '@agnos-ui/react-headless/services/transitions/baseTransitions';
4
+ /**
5
+ * Retrieve a shallow copy of the default modal config
6
+ * @returns the default modal config
7
+ */
8
+ declare const export_getModalDefaultConfig: () => ModalProps<any>;
9
+ export { export_getModalDefaultConfig as getModalDefaultConfig };
3
10
  export type ModalContext<Data> = WidgetSlotContext<ModalWidget<Data>>;
4
11
  export interface ModalState<Data> {
5
12
  /**
6
- * Whether the backdrop is fully hidden. This can be true either because {@link ModalProps.backdropbackdrop} is false or
7
- * because {@link ModalCommonPropsAndState.visiblevisible} is false and there is no current transition.
13
+ * Whether the backdrop is fully hidden. This can be true either because {@link ModalProps.backdrop|backdrop} is false or
14
+ * because {@link ModalProps.visible|visible} is false and there is no current transition.
8
15
  */
9
16
  backdropHidden: boolean;
10
17
  /**
@@ -21,28 +28,43 @@ export interface ModalState<Data> {
21
28
  modalElement: HTMLElement | null;
22
29
  /**
23
30
  * Value of the aria-label attribute to put on the close button.
31
+ *
32
+ * @defaultValue `'Close'`
24
33
  */
25
34
  ariaCloseButtonLabel: string;
26
35
  /**
27
36
  * Classes to add on the backdrop DOM element.
37
+ *
38
+ * @defaultValue `''`
28
39
  */
29
40
  backdropClass: string;
30
41
  /**
31
42
  * Whether to display the close button.
43
+ *
44
+ * @defaultValue `true`
32
45
  */
33
46
  closeButton: boolean;
34
47
  /**
35
48
  * Which element should contain the modal and backdrop DOM elements.
36
49
  * If it is not null, the modal and backdrop DOM elements are moved to the specified container.
37
50
  * Otherwise, they stay where the widget is located.
51
+ *
52
+ * @defaultValue
53
+ * ```ts
54
+ * typeof window !== 'undefined' ? document.body : null
55
+ * ```
38
56
  */
39
57
  container: HTMLElement | null;
40
58
  /**
41
59
  * Whether the modal should be visible when the transition is completed.
60
+ *
61
+ * @defaultValue `false`
42
62
  */
43
63
  visible: boolean;
44
64
  /**
45
65
  * CSS classes to be applied on the widget main container
66
+ *
67
+ * @defaultValue `''`
46
68
  */
47
69
  className: string;
48
70
  /**
@@ -58,12 +80,12 @@ export interface ModalState<Data> {
58
80
  */
59
81
  footer: SlotContent<ModalContext<Data>>;
60
82
  /**
61
- * Header of the modal. The default header includes {@link ModalCommonPropsAndState.title title}.
83
+ * Header of the modal. The default header includes {@link ModalProps.title|title}.
62
84
  */
63
85
  header: SlotContent<ModalContext<Data>>;
64
86
  /**
65
87
  * Structure of the modal.
66
- * The default structure uses {@link ModalCommonPropsAndState.header header}, {@link ModalCommonPropsAndState.children children} and {@link ModalCommonPropsAndState.footer footer}.
88
+ * The default structure uses {@link ModalProps.header|header}, {@link ModalProps.children|children} and {@link ModalProps.footer|footer}.
67
89
  */
68
90
  structure: SlotContent<ModalContext<Data>>;
69
91
  /**
@@ -72,70 +94,122 @@ export interface ModalState<Data> {
72
94
  title: SlotContent<ModalContext<Data>>;
73
95
  /**
74
96
  * Option to create a fullscreen modal, according to the bootstrap documentation.
97
+ *
98
+ * @defaultValue `false`
75
99
  */
76
100
  fullscreen: boolean;
77
101
  }
78
102
  export interface ModalProps<Data> {
103
+ /**
104
+ * The transition to use for the backdrop behind the modal (if present).
105
+ *
106
+ * @defaultValue `fadeTransition`
107
+ */
108
+ backdropTransition: TransitionFn;
109
+ /**
110
+ * The transition to use for the modal.
111
+ *
112
+ * @defaultValue `fadeTransition`
113
+ */
114
+ modalTransition: TransitionFn;
79
115
  /**
80
116
  * Whether the modal and its backdrop (if present) should be animated when shown or hidden.
117
+ *
118
+ * @defaultValue `true`
81
119
  */
82
120
  animated: boolean;
83
121
  /**
84
122
  * Whether a backdrop should be created behind the modal.
123
+ *
124
+ * @defaultValue `true`
85
125
  */
86
126
  backdrop: boolean;
87
- /**
88
- * The transition to use for the backdrop behind the modal (if present).
89
- */
90
- backdropTransition: TransitionFn;
91
127
  /**
92
128
  * Whether the modal should be closed when clicking on the viewport outside the modal.
129
+ *
130
+ * @defaultValue `true`
93
131
  */
94
132
  closeOnOutsideClick: boolean;
95
133
  /**
96
- * The transition to use for the modal.
97
- */
98
- modalTransition: TransitionFn;
99
- /**
100
- * Event to be triggered when the modal is about to be closed (i.e. the {@link ModalApi.closeclose} method was called).
134
+ * Event to be triggered when the modal is about to be closed (i.e. the {@link ModalApi.close|close} method was called).
135
+ *
136
+ * @param event - event giving access to the argument given to the {@link ModalApi.close|close} method and allowing
137
+ * to cancel the close process.
138
+ *
139
+ * @defaultValue
140
+ * ```ts
141
+ * () => {}
142
+ * ```
101
143
  */
102
144
  onBeforeClose: (event: ModalBeforeCloseEvent) => void;
103
145
  /**
104
146
  * Event to be triggered when the visible property changes.
147
+ *
148
+ * @param visible - new value of the visible propery
149
+ *
150
+ * @defaultValue
151
+ * ```ts
152
+ * () => {}
153
+ * ```
105
154
  */
106
155
  onVisibleChange: (visible: boolean) => void;
107
156
  /**
108
157
  * Event to be triggered when the transition is completed and the modal is not visible.
158
+ *
159
+ * @defaultValue
160
+ * ```ts
161
+ * () => {}
162
+ * ```
109
163
  */
110
164
  onHidden: () => void;
111
165
  /**
112
166
  * Event to be triggered when the transition is completed and the modal is visible.
167
+ *
168
+ * @defaultValue
169
+ * ```ts
170
+ * () => {}
171
+ * ```
113
172
  */
114
173
  onShown: () => void;
115
174
  /**
116
175
  * Value of the aria-label attribute to put on the close button.
176
+ *
177
+ * @defaultValue `'Close'`
117
178
  */
118
179
  ariaCloseButtonLabel: string;
119
180
  /**
120
181
  * Classes to add on the backdrop DOM element.
182
+ *
183
+ * @defaultValue `''`
121
184
  */
122
185
  backdropClass: string;
123
186
  /**
124
187
  * Whether to display the close button.
188
+ *
189
+ * @defaultValue `true`
125
190
  */
126
191
  closeButton: boolean;
127
192
  /**
128
193
  * Which element should contain the modal and backdrop DOM elements.
129
194
  * If it is not null, the modal and backdrop DOM elements are moved to the specified container.
130
195
  * Otherwise, they stay where the widget is located.
196
+ *
197
+ * @defaultValue
198
+ * ```ts
199
+ * typeof window !== 'undefined' ? document.body : null
200
+ * ```
131
201
  */
132
202
  container: HTMLElement | null;
133
203
  /**
134
204
  * Whether the modal should be visible when the transition is completed.
205
+ *
206
+ * @defaultValue `false`
135
207
  */
136
208
  visible: boolean;
137
209
  /**
138
210
  * CSS classes to be applied on the widget main container
211
+ *
212
+ * @defaultValue `''`
139
213
  */
140
214
  className: string;
141
215
  /**
@@ -151,12 +225,12 @@ export interface ModalProps<Data> {
151
225
  */
152
226
  footer: SlotContent<ModalContext<Data>>;
153
227
  /**
154
- * Header of the modal. The default header includes {@link ModalCommonPropsAndState.title title}.
228
+ * Header of the modal. The default header includes {@link ModalProps.title|title}.
155
229
  */
156
230
  header: SlotContent<ModalContext<Data>>;
157
231
  /**
158
232
  * Structure of the modal.
159
- * The default structure uses {@link ModalCommonPropsAndState.header header}, {@link ModalCommonPropsAndState.children children} and {@link ModalCommonPropsAndState.footer footer}.
233
+ * The default structure uses {@link ModalProps.header|header}, {@link ModalProps.children|children} and {@link ModalProps.footer|footer}.
160
234
  */
161
235
  structure: SlotContent<ModalContext<Data>>;
162
236
  /**
@@ -165,6 +239,8 @@ export interface ModalProps<Data> {
165
239
  title: SlotContent<ModalContext<Data>>;
166
240
  /**
167
241
  * Option to create a fullscreen modal, according to the bootstrap documentation.
242
+ *
243
+ * @defaultValue `false`
168
244
  */
169
245
  fullscreen: boolean;
170
246
  }
@@ -175,39 +251,63 @@ export interface ModalApi<Data> {
175
251
  patch: ModalWidget<Data>['patch'];
176
252
  /**
177
253
  * Closes the modal with the given result.
254
+ *
255
+ * @param result - result of the modal, as passed in the {@link ModalBeforeCloseEvent.result|result} property of the event passed to the
256
+ * {@link ModalProps.onBeforeClose|onBeforeClose} event handler (and possibly changed by it) and resolved by the promise returned by the {@link ModalApi.open|open} method.
178
257
  */
179
258
  close(result?: any): void;
180
259
  /**
181
260
  * Opens the modal and returns a promise that is resolved when the modal is closed.
182
- * The resolved value is the result passed to the {@link ModalApi.closeclose} method and possibly changed by the
183
- * {@link ModalProps.onBeforeCloseonBeforeClose} event handler
261
+ * The resolved value is the result passed to the {@link ModalApi.close|close} method and possibly changed by the
262
+ * {@link ModalProps.onBeforeClose|onBeforeClose} event handler
184
263
  */
185
264
  open(): Promise<any>;
186
265
  }
187
266
  export type ModalWidget<Data> = Widget<ModalProps<Data>, ModalState<Data>, ModalApi<Data>, ModalActions, ModalDirectives>;
267
+ /**
268
+ * Creates a new modal widget instance.
269
+ * @param config - config of the modal, either as a store or as an object containing values or stores.
270
+ * @returns a new modal widget instance
271
+ */
272
+ declare const export_createModal: <Data>(config?: PropsConfig<ModalProps<Data>>) => ModalWidget<Data>;
273
+ export { export_createModal as createModal };
274
+ /**
275
+ * Value present in the {@link ModalBeforeCloseEvent.result|result} property of the {@link ModalProps.onBeforeClose|onBeforeClose} event
276
+ * and returned by the {@link ModalApi.open|open} method, when the modal is closed by a click inside the viewport but outside the modal.
277
+ */
278
+ declare const export_modalOutsideClick: typeof modalOutsideClick;
279
+ export { export_modalOutsideClick as modalOutsideClick };
280
+ /**
281
+ * Value present in the {@link ModalBeforeCloseEvent.result|result} property of the {@link ModalProps.onBeforeClose|onBeforeClose} event
282
+ * and returned by the {@link ModalApi.open|open} method, when the modal is closed by a click on the close button.
283
+ */
284
+ declare const export_modalCloseButtonClick: typeof modalCloseButtonClick;
285
+ export { export_modalCloseButtonClick as modalCloseButtonClick };
188
286
  export interface ModalBeforeCloseEvent {
189
287
  /**
190
- * Result of the modal, which is the value passed to the {@link ModalApi.closeclose} method
191
- * and later resolved by the promise returned by the {@link ModalApi.openopen} method.
192
- * If needed, it can be changed from the {@link ModalProps.onBeforeCloseonBeforeClose} event handler.
288
+ * Result of the modal, which is the value passed to the {@link ModalApi.close|close} method
289
+ * and later resolved by the promise returned by the {@link ModalApi.open|open} method.
290
+ * If needed, it can be changed from the {@link ModalProps.onBeforeClose|onBeforeClose} event handler.
193
291
  */
194
292
  result: any;
195
293
  /**
196
294
  * Whether to cancel the close of the modal.
197
- * It can be changed from the {@link ModalProps.onBeforeCloseonBeforeClose} event handler.
295
+ * It can be changed from the {@link ModalProps.onBeforeClose|onBeforeClose} event handler.
198
296
  */
199
297
  cancel: boolean;
200
298
  }
201
299
  export interface ModalActions {
202
300
  /**
203
301
  * Action to be called when the user clicks on the close button. It closes the modal with the {@link modalCloseButtonClick} result.
302
+ * @param event - mouse event
204
303
  */
205
304
  closeButtonClick(event: Pick<MouseEvent, never>): void;
206
305
  /**
207
306
  * Action to be called when the user clicks on the modal DOM element (which is supposed to have the size of the full viewport).
208
307
  * If the click is not done on a descendant of the modal DOM element, it is considered to be done outside the modal
209
- * and, depending on the value of the {@link ModalProps.closeOnOutsideClickcloseOnOutsideClick} prop, the modal is or isn't closed
308
+ * and, depending on the value of the {@link ModalProps.closeOnOutsideClick|closeOnOutsideClick} prop, the modal is or isn't closed
210
309
  * (with the {@link modalOutsideClick} result).
310
+ * @param event - mouse event
211
311
  */
212
312
  modalClick(event: Pick<MouseEvent, 'target' | 'currentTarget'>): void;
213
313
  }
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const pagination = require("../../pagination-DeZ2Eb3e.cjs");
3
+ const pagination = require("../../pagination-ChA90-py.cjs");
4
4
  exports.DefaultPages = pagination.DefaultPages;
5
5
  exports.DefaultStructure = pagination.DefaultStructure;
6
6
  exports.NavButton = pagination.NavButton;
7
7
  exports.PageItem = pagination.PageItem;
8
8
  exports.Pagination = pagination.Pagination;
9
- exports.createPagination = pagination.createPagination;
10
- exports.getPaginationDefaultConfig = pagination.getPaginationDefaultConfig;
9
+ exports.createPagination = pagination.export_createPagination;
10
+ exports.getPaginationDefaultConfig = pagination.export_getPaginationDefaultConfig;
@@ -1 +1,3 @@
1
+ export * from './pageItem';
1
2
  export * from './pagination';
3
+ export * from './pagination.gen';
@@ -1,10 +1,10 @@
1
- import { D, a, N, b, P, c, g } from "../../pagination-B76wbKhG.js";
1
+ import { D, a, N, P, b, c, e } from "../../pagination-BDq1dOoH.js";
2
2
  export {
3
3
  D as DefaultPages,
4
4
  a as DefaultStructure,
5
5
  N as NavButton,
6
- b as PageItem,
7
- P as Pagination,
6
+ P as PageItem,
7
+ b as Pagination,
8
8
  c as createPagination,
9
- g as getPaginationDefaultConfig
9
+ e as getPaginationDefaultConfig
10
10
  };
@@ -1,9 +1,4 @@
1
- import type { WidgetFactory } from '@agnos-ui/react-headless/types';
2
- import type { PaginationContext, PaginationProps, PaginationWidget } from './pagination.gen';
3
- export type * from './pagination.gen';
4
- export declare const createPagination: WidgetFactory<PaginationWidget>;
5
- export declare const getPaginationDefaultConfig: () => PaginationProps;
6
- export * from './pageItem';
1
+ import type { PaginationContext, PaginationProps } from './pagination.gen';
7
2
  export declare function DefaultPages(slotContext: PaginationContext): import("react/jsx-runtime").JSX.Element | null;
8
3
  export declare function DefaultStructure(slotContext: PaginationContext): import("react/jsx-runtime").JSX.Element;
9
4
  export declare function Pagination(props: Partial<PaginationProps>): import("react/jsx-runtime").JSX.Element;