@design-factory/angular 21.0.3 → 21.1.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/drawer/README.md +54 -0
  2. package/fesm2022/design-factory-angular-drawer.mjs +202 -67
  3. package/fesm2022/design-factory-angular-drawer.mjs.map +1 -1
  4. package/fesm2022/design-factory-angular-internals.mjs +439 -17
  5. package/fesm2022/design-factory-angular-internals.mjs.map +1 -1
  6. package/fesm2022/design-factory-angular-sidenav.mjs +223 -210
  7. package/fesm2022/design-factory-angular-sidenav.mjs.map +1 -1
  8. package/fesm2022/design-factory-angular-theme.mjs +198 -0
  9. package/fesm2022/design-factory-angular-theme.mjs.map +1 -0
  10. package/fesm2022/design-factory-angular-topnav.mjs +1538 -0
  11. package/fesm2022/design-factory-angular-topnav.mjs.map +1 -0
  12. package/node_modules/@agnos-ui/core/README.md +5 -0
  13. package/node_modules/@agnos-ui/core/accordion-BC_9xn23.cjs +314 -0
  14. package/node_modules/@agnos-ui/core/accordion-Ca_0T8Bc.js +315 -0
  15. package/node_modules/@agnos-ui/core/alert-AhaliJ17.cjs +9 -0
  16. package/node_modules/@agnos-ui/core/alert-Cb9FhbFQ.js +10 -0
  17. package/node_modules/@agnos-ui/core/collapse-COriZO7o.cjs +94 -0
  18. package/node_modules/@agnos-ui/core/collapse-CP79atna.js +95 -0
  19. package/node_modules/@agnos-ui/core/common-B5jS-Ih_.cjs +73 -0
  20. package/node_modules/@agnos-ui/core/common-DFyZvkII.js +74 -0
  21. package/node_modules/@agnos-ui/core/components/accordion/accordion.d.ts +333 -0
  22. package/node_modules/@agnos-ui/core/components/accordion/index.cjs +7 -0
  23. package/node_modules/@agnos-ui/core/components/accordion/index.d.ts +1 -0
  24. package/node_modules/@agnos-ui/core/components/accordion/index.js +7 -0
  25. package/node_modules/@agnos-ui/core/components/alert/alert.d.ts +37 -0
  26. package/node_modules/@agnos-ui/core/components/alert/common.d.ts +138 -0
  27. package/node_modules/@agnos-ui/core/components/alert/index.cjs +5 -0
  28. package/node_modules/@agnos-ui/core/components/alert/index.d.ts +1 -0
  29. package/node_modules/@agnos-ui/core/components/alert/index.js +5 -0
  30. package/node_modules/@agnos-ui/core/components/carousel/carousel.d.ts +247 -0
  31. package/node_modules/@agnos-ui/core/components/carousel/index.cjs +292 -0
  32. package/node_modules/@agnos-ui/core/components/carousel/index.d.ts +1 -0
  33. package/node_modules/@agnos-ui/core/components/carousel/index.js +292 -0
  34. package/node_modules/@agnos-ui/core/components/collapse/collapse.d.ts +135 -0
  35. package/node_modules/@agnos-ui/core/components/collapse/index.cjs +5 -0
  36. package/node_modules/@agnos-ui/core/components/collapse/index.d.ts +1 -0
  37. package/node_modules/@agnos-ui/core/components/collapse/index.js +5 -0
  38. package/node_modules/@agnos-ui/core/components/commonProps.d.ts +11 -0
  39. package/node_modules/@agnos-ui/core/components/drawer/drawer.d.ts +279 -0
  40. package/node_modules/@agnos-ui/core/components/drawer/index.cjs +5 -0
  41. package/node_modules/@agnos-ui/core/components/drawer/index.d.ts +1 -0
  42. package/node_modules/@agnos-ui/core/components/drawer/index.js +5 -0
  43. package/node_modules/@agnos-ui/core/components/modal/index.cjs +8 -0
  44. package/node_modules/@agnos-ui/core/components/modal/index.d.ts +1 -0
  45. package/node_modules/@agnos-ui/core/components/modal/index.js +8 -0
  46. package/node_modules/@agnos-ui/core/components/modal/modal.d.ts +245 -0
  47. package/node_modules/@agnos-ui/core/components/pagination/index.cjs +5 -0
  48. package/node_modules/@agnos-ui/core/components/pagination/index.d.ts +1 -0
  49. package/node_modules/@agnos-ui/core/components/pagination/index.js +5 -0
  50. package/node_modules/@agnos-ui/core/components/pagination/pagination.d.ts +313 -0
  51. package/node_modules/@agnos-ui/core/components/progressbar/index.cjs +5 -0
  52. package/node_modules/@agnos-ui/core/components/progressbar/index.d.ts +1 -0
  53. package/node_modules/@agnos-ui/core/components/progressbar/index.js +5 -0
  54. package/node_modules/@agnos-ui/core/components/progressbar/progressbar.d.ts +91 -0
  55. package/node_modules/@agnos-ui/core/components/rating/index.cjs +5 -0
  56. package/node_modules/@agnos-ui/core/components/rating/index.d.ts +1 -0
  57. package/node_modules/@agnos-ui/core/components/rating/index.js +5 -0
  58. package/node_modules/@agnos-ui/core/components/rating/rating.d.ts +191 -0
  59. package/node_modules/@agnos-ui/core/components/slider/index.cjs +5 -0
  60. package/node_modules/@agnos-ui/core/components/slider/index.d.ts +1 -0
  61. package/node_modules/@agnos-ui/core/components/slider/index.js +5 -0
  62. package/node_modules/@agnos-ui/core/components/slider/slider-utils.d.ts +25 -0
  63. package/node_modules/@agnos-ui/core/components/slider/slider.d.ts +383 -0
  64. package/node_modules/@agnos-ui/core/components/toast/index.cjs +7 -0
  65. package/node_modules/@agnos-ui/core/components/toast/index.d.ts +2 -0
  66. package/node_modules/@agnos-ui/core/components/toast/index.js +7 -0
  67. package/node_modules/@agnos-ui/core/components/toast/toast.d.ts +66 -0
  68. package/node_modules/@agnos-ui/core/components/toast/toaster.d.ts +128 -0
  69. package/node_modules/@agnos-ui/core/components/tree/index.cjs +5 -0
  70. package/node_modules/@agnos-ui/core/components/tree/index.d.ts +1 -0
  71. package/node_modules/@agnos-ui/core/components/tree/index.js +5 -0
  72. package/node_modules/@agnos-ui/core/components/tree/tree.d.ts +143 -0
  73. package/node_modules/@agnos-ui/core/config.cjs +36 -0
  74. package/node_modules/@agnos-ui/core/config.d.ts +117 -0
  75. package/node_modules/@agnos-ui/core/config.js +36 -0
  76. package/node_modules/@agnos-ui/core/directive-Bsreu2z1.js +523 -0
  77. package/node_modules/@agnos-ui/core/directive-DCaXmRe_.cjs +522 -0
  78. package/node_modules/@agnos-ui/core/drawer-BbFAHV07.cjs +328 -0
  79. package/node_modules/@agnos-ui/core/drawer-C6Qa0xEu.js +329 -0
  80. package/node_modules/@agnos-ui/core/index.cjs +134 -0
  81. package/node_modules/@agnos-ui/core/index.d.ts +29 -0
  82. package/node_modules/@agnos-ui/core/index.js +134 -0
  83. package/node_modules/@agnos-ui/core/isFocusable-Ckwus82R.js +32 -0
  84. package/node_modules/@agnos-ui/core/isFocusable-DfzDLeAN.cjs +31 -0
  85. package/node_modules/@agnos-ui/core/modal-BsNuHhT7.cjs +252 -0
  86. package/node_modules/@agnos-ui/core/modal-CgzY8ezz.js +253 -0
  87. package/node_modules/@agnos-ui/core/package.json +57 -0
  88. package/node_modules/@agnos-ui/core/pagination-ZxGaNWZz.js +255 -0
  89. package/node_modules/@agnos-ui/core/pagination-xbcOHnhd.cjs +254 -0
  90. package/node_modules/@agnos-ui/core/progressbar-CRbMKp4b.cjs +86 -0
  91. package/node_modules/@agnos-ui/core/progressbar-CSEIFnlD.js +87 -0
  92. package/node_modules/@agnos-ui/core/promise-CxCD3NYv.cjs +118 -0
  93. package/node_modules/@agnos-ui/core/promise-D-RZVPuv.js +119 -0
  94. package/node_modules/@agnos-ui/core/rating-BIdiiPUo.js +184 -0
  95. package/node_modules/@agnos-ui/core/rating-qx1xaBmz.cjs +183 -0
  96. package/node_modules/@agnos-ui/core/scrollbars-CT87iv_6.cjs +30 -0
  97. package/node_modules/@agnos-ui/core/scrollbars-CcxSrnCx.js +31 -0
  98. package/node_modules/@agnos-ui/core/services/extendWidget.cjs +41 -0
  99. package/node_modules/@agnos-ui/core/services/extendWidget.d.ts +31 -0
  100. package/node_modules/@agnos-ui/core/services/extendWidget.js +41 -0
  101. package/node_modules/@agnos-ui/core/services/floatingUI.cjs +111 -0
  102. package/node_modules/@agnos-ui/core/services/floatingUI.d.ts +76 -0
  103. package/node_modules/@agnos-ui/core/services/floatingUI.js +111 -0
  104. package/node_modules/@agnos-ui/core/services/focusElement.cjs +46 -0
  105. package/node_modules/@agnos-ui/core/services/focusElement.d.ts +9 -0
  106. package/node_modules/@agnos-ui/core/services/focusElement.js +46 -0
  107. package/node_modules/@agnos-ui/core/services/focustrack.cjs +47 -0
  108. package/node_modules/@agnos-ui/core/services/focustrack.d.ts +40 -0
  109. package/node_modules/@agnos-ui/core/services/focustrack.js +47 -0
  110. package/node_modules/@agnos-ui/core/services/hash.cjs +15 -0
  111. package/node_modules/@agnos-ui/core/services/hash.d.ts +3 -0
  112. package/node_modules/@agnos-ui/core/services/hash.js +15 -0
  113. package/node_modules/@agnos-ui/core/services/intersection.cjs +53 -0
  114. package/node_modules/@agnos-ui/core/services/intersection.d.ts +30 -0
  115. package/node_modules/@agnos-ui/core/services/intersection.js +53 -0
  116. package/node_modules/@agnos-ui/core/services/matchMedia.cjs +14 -0
  117. package/node_modules/@agnos-ui/core/services/matchMedia.d.ts +8 -0
  118. package/node_modules/@agnos-ui/core/services/matchMedia.js +14 -0
  119. package/node_modules/@agnos-ui/core/services/navManager.cjs +166 -0
  120. package/node_modules/@agnos-ui/core/services/navManager.d.ts +144 -0
  121. package/node_modules/@agnos-ui/core/services/navManager.js +166 -0
  122. package/node_modules/@agnos-ui/core/services/pointerdownPosition.cjs +60 -0
  123. package/node_modules/@agnos-ui/core/services/pointerdownPosition.d.ts +42 -0
  124. package/node_modules/@agnos-ui/core/services/pointerdownPosition.js +60 -0
  125. package/node_modules/@agnos-ui/core/services/portal.cjs +42 -0
  126. package/node_modules/@agnos-ui/core/services/portal.d.ts +16 -0
  127. package/node_modules/@agnos-ui/core/services/portal.js +42 -0
  128. package/node_modules/@agnos-ui/core/services/resizeObserver.cjs +54 -0
  129. package/node_modules/@agnos-ui/core/services/resizeObserver.d.ts +18 -0
  130. package/node_modules/@agnos-ui/core/services/resizeObserver.js +54 -0
  131. package/node_modules/@agnos-ui/core/services/siblingsInert.cjs +44 -0
  132. package/node_modules/@agnos-ui/core/services/siblingsInert.d.ts +16 -0
  133. package/node_modules/@agnos-ui/core/services/siblingsInert.js +44 -0
  134. package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.cjs +186 -0
  135. package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.d.ts +166 -0
  136. package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.js +186 -0
  137. package/node_modules/@agnos-ui/core/services/transitions/collapse.cjs +40 -0
  138. package/node_modules/@agnos-ui/core/services/transitions/collapse.d.ts +49 -0
  139. package/node_modules/@agnos-ui/core/services/transitions/collapse.js +40 -0
  140. package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.cjs +32 -0
  141. package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.d.ts +25 -0
  142. package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.js +32 -0
  143. package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.cjs +37 -0
  144. package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.d.ts +47 -0
  145. package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.js +37 -0
  146. package/node_modules/@agnos-ui/core/slider-B93hE0ag.cjs +807 -0
  147. package/node_modules/@agnos-ui/core/slider-Cjiq9FgI.js +808 -0
  148. package/node_modules/@agnos-ui/core/textDirection-cNgt24LJ.js +4 -0
  149. package/node_modules/@agnos-ui/core/textDirection-zqcZ5-eK.cjs +3 -0
  150. package/node_modules/@agnos-ui/core/toaster-BQWqxYv-.cjs +190 -0
  151. package/node_modules/@agnos-ui/core/toaster-BzEkshT2.js +191 -0
  152. package/node_modules/@agnos-ui/core/tree-DY04XPPg.cjs +228 -0
  153. package/node_modules/@agnos-ui/core/tree-HwcvZ0_p.js +229 -0
  154. package/node_modules/@agnos-ui/core/types.cjs +6 -0
  155. package/node_modules/@agnos-ui/core/types.d.ts +246 -0
  156. package/node_modules/@agnos-ui/core/types.js +6 -0
  157. package/node_modules/@agnos-ui/core/utils/directive.cjs +28 -0
  158. package/node_modules/@agnos-ui/core/utils/directive.d.ts +352 -0
  159. package/node_modules/@agnos-ui/core/utils/directive.js +28 -0
  160. package/node_modules/@agnos-ui/core/utils/func.cjs +7 -0
  161. package/node_modules/@agnos-ui/core/utils/func.d.ts +11 -0
  162. package/node_modules/@agnos-ui/core/utils/func.js +7 -0
  163. package/node_modules/@agnos-ui/core/utils/id.cjs +5 -0
  164. package/node_modules/@agnos-ui/core/utils/id.d.ts +6 -0
  165. package/node_modules/@agnos-ui/core/utils/id.js +5 -0
  166. package/node_modules/@agnos-ui/core/utils/internal/assign.d.ts +10 -0
  167. package/node_modules/@agnos-ui/core/utils/internal/checks.d.ts +57 -0
  168. package/node_modules/@agnos-ui/core/utils/internal/dom.d.ts +75 -0
  169. package/node_modules/@agnos-ui/core/utils/internal/isFocusable.d.ts +9 -0
  170. package/node_modules/@agnos-ui/core/utils/internal/math.d.ts +5 -0
  171. package/node_modules/@agnos-ui/core/utils/internal/promise.d.ts +98 -0
  172. package/node_modules/@agnos-ui/core/utils/internal/scrollbars.d.ts +8 -0
  173. package/node_modules/@agnos-ui/core/utils/internal/sort.d.ts +16 -0
  174. package/node_modules/@agnos-ui/core/utils/internal/ssrHTMLElement.d.ts +17 -0
  175. package/node_modules/@agnos-ui/core/utils/internal/textDirection.d.ts +7 -0
  176. package/node_modules/@agnos-ui/core/utils/internal/traversal.d.ts +54 -0
  177. package/node_modules/@agnos-ui/core/utils/stores.cjs +172 -0
  178. package/node_modules/@agnos-ui/core/utils/stores.d.ts +224 -0
  179. package/node_modules/@agnos-ui/core/utils/stores.js +172 -0
  180. package/node_modules/@agnos-ui/core/utils/widget.cjs +8 -0
  181. package/node_modules/@agnos-ui/core/utils/widget.d.ts +11 -0
  182. package/node_modules/@agnos-ui/core/utils/widget.js +8 -0
  183. package/node_modules/@agnos-ui/core/utils/writables.cjs +16 -0
  184. package/node_modules/@agnos-ui/core/utils/writables.d.ts +95 -0
  185. package/node_modules/@agnos-ui/core/utils/writables.js +16 -0
  186. package/node_modules/@agnos-ui/core/writables-DYGjj5T3.js +103 -0
  187. package/node_modules/@agnos-ui/core/writables-Dt68gADJ.cjs +102 -0
  188. package/package.json +25 -6
  189. package/schematics/collection.json +1 -1
  190. package/types/design-factory-angular-drawer.d.ts +71 -13
  191. package/types/design-factory-angular-internals.d.ts +220 -31
  192. package/types/design-factory-angular-sidenav.d.ts +15 -7
  193. package/types/design-factory-angular-theme.d.ts +122 -0
  194. package/types/design-factory-angular-topnav.d.ts +435 -0
@@ -0,0 +1,247 @@
1
+ import type { Directive, Widget, WidgetFactory } from '../../types';
2
+ import type { EmblaCarouselType, EmblaPluginsType, EmblaPluginType } from 'embla-carousel';
3
+ import type { ReadableSignal } from '@amadeus-it-group/tansu';
4
+ /**
5
+ * Represents the Embla carousel options
6
+ */
7
+ interface EmblaOptions {
8
+ /**
9
+ * Align the slides relative to the carousel viewport
10
+ *
11
+ * @see {@link https://www.embla-carousel.com/api/options/#align}
12
+ * @defaultValue `'center'`
13
+ */
14
+ align: 'start' | 'center' | 'end';
15
+ /**
16
+ * Enables choosing a custom container element which holds the slides. By default, Embla will choose the first direct child element of the root element. Provide a valid CSS selector string.
17
+ *
18
+ * @see {@link https://www.embla-carousel.com/api/options/#container}
19
+ *
20
+ * @defaultValue `null`
21
+ */
22
+ container: string | null;
23
+ /**
24
+ * Clear leading and trailing empty space that causes excessive scrolling
25
+ *
26
+ * @see {@link https://www.embla-carousel.com/api/options/#containScroll}
27
+ * @defaultValue `'trimSnaps'`
28
+ */
29
+ containScroll: false | 'trimSnaps' | 'keepSnaps';
30
+ /**
31
+ * Choose content direction between `ltr` and `rtl`
32
+ *
33
+ * @see {@link https://www.embla-carousel.com/api/options/#direction}
34
+ * @defaultValue `'ltr'`
35
+ */
36
+ direction: 'ltr' | 'rtl';
37
+ /**
38
+ * Enables momentum scrolling
39
+ *
40
+ * @see {@link https://www.embla-carousel.com/api/options/#dragFree}
41
+ * @defaultValue `false`
42
+ */
43
+ dragFree: boolean;
44
+ /**
45
+ * Drag threshold in pixels
46
+ *
47
+ * @see {@link https://www.embla-carousel.com/api/options/#dragThreshold}
48
+ * @defaultValue `10`
49
+ */
50
+ dragThreshold: number;
51
+ /**
52
+ * Set scroll duration when triggered by any of the API methods
53
+ *
54
+ * @see {@link https://www.embla-carousel.com/api/options/#duration}
55
+ * @defaultValue `25`
56
+ */
57
+ duration: number;
58
+ /**
59
+ * Enables infinite looping
60
+ *
61
+ * @see {@link https://www.embla-carousel.com/api/options/#loop}
62
+ * @defaultValue `false`
63
+ */
64
+ loop: boolean;
65
+ /**
66
+ * Allow the carousel to skip scroll snaps if it's dragged vigorously
67
+ *
68
+ * @see {@link https://www.embla-carousel.com/api/options/#skipsnaps}
69
+ * @defaultValue `false`
70
+ */
71
+ skipSnaps: boolean;
72
+ }
73
+ interface CarouselCommonPropsState extends Pick<EmblaOptions, 'direction'> {
74
+ /**
75
+ * If `true`, 'previous' and 'next' navigation arrows will be visible.
76
+ *
77
+ * @defaultValue `true`
78
+ */
79
+ showNavigationArrows: boolean;
80
+ /**
81
+ * If `true`, navigation indicators at the bottom of the slide will be visible.
82
+ *
83
+ * @defaultValue `true`
84
+ */
85
+ showNavigationIndicators: boolean;
86
+ }
87
+ /**
88
+ * Represents the properties for the carousel component.
89
+ */
90
+ export interface CarouselProps extends EmblaOptions, CarouselCommonPropsState {
91
+ /**
92
+ * Plugins to extend the carousel with additional features
93
+ * @defaultValue `[]`
94
+ */
95
+ plugins: EmblaPluginType[];
96
+ /**
97
+ * Aria label for navigation indicators
98
+ *
99
+ * @defaultValue
100
+ * ```ts
101
+ * (index: number) => `Select slide ${index + 1}`
102
+ * ```
103
+ */
104
+ ariaIndicatorLabel: (index: number) => string;
105
+ /**
106
+ * Aria label for previous button
107
+ *
108
+ * @defaultValue `'Select previous slide'`
109
+ */
110
+ ariaPrevLabel: string;
111
+ /**
112
+ * Aria label for next button
113
+ *
114
+ * @defaultValue `'Select next slide'`
115
+ */
116
+ ariaNextLabel: string;
117
+ }
118
+ /**
119
+ * Represents the state of a carousel component.
120
+ */
121
+ export interface CarouselState extends CarouselCommonPropsState {
122
+ /**
123
+ * is the carousel currently scrolling
124
+ */
125
+ scrolling: boolean;
126
+ /**
127
+ * can carousel scroll to previous slide
128
+ */
129
+ canScrollPrev: boolean;
130
+ /**
131
+ * can carousel scroll to next slide
132
+ */
133
+ canScrollNext: boolean;
134
+ /**
135
+ * selected scroll snap
136
+ */
137
+ selectedScrollSnap: number;
138
+ /**
139
+ * is the carousel initialized
140
+ */
141
+ initialized: boolean;
142
+ }
143
+ /**
144
+ * Represents the API for a carousel component.
145
+ */
146
+ export interface CarouselApi {
147
+ /**
148
+ * Scroll to the previous snap point if possible.
149
+ * @param jump - scroll instantly
150
+ */
151
+ scrollPrev: (jump?: boolean) => void;
152
+ /**
153
+ * Scroll to the next snap point if possible.
154
+ * @param jump - scroll instantly
155
+ */
156
+ scrollNext: (jump?: boolean) => void;
157
+ /**
158
+ * Scroll to a snap point by index
159
+ * @param index - the snap point index
160
+ * @param jump - scroll instantly
161
+ */
162
+ scrollTo: (index: number, jump?: boolean) => void;
163
+ /**
164
+ * Retrieve the enabled plugins
165
+ */
166
+ plugins: () => EmblaPluginsType | undefined;
167
+ /**
168
+ * Retrieve the inner EmblaApi object
169
+ */
170
+ emblaApi: () => EmblaCarouselType | undefined;
171
+ }
172
+ /**
173
+ * Represents the directives for a carousel component.
174
+ */
175
+ export interface CarouselDirectives {
176
+ /**
177
+ * the root directive
178
+ */
179
+ root: Directive;
180
+ /**
181
+ * A directive to be applied to a navigation button allowing to scroll to the previous slide.
182
+ */
183
+ scrollPrev: Directive;
184
+ /**
185
+ * A directive to be applied to a navigation button allowing to scroll to the next slide.
186
+ */
187
+ scrollNext: Directive;
188
+ /**
189
+ * A directive to be applied to each slide in the carousel.
190
+ */
191
+ slide: Directive<{
192
+ id: string;
193
+ index: number;
194
+ }>;
195
+ /**
196
+ * A directive to be applied to a tab list allowing to navigate to the corresponding slide.
197
+ * This directive adds the role `tablist` and is recommended to be used together with {@link tabIndicator}.
198
+ */
199
+ tabList: Directive;
200
+ /**
201
+ * A directive to be applied to a navigation indicator allowing to scroll to the corresponding slide.
202
+ * As this directive adds the role `tab` to the element, it is recommended to use it on a button or a link and the parent element should have the {@link tabList} directive attached.
203
+ */
204
+ tabIndicator: Directive<{
205
+ index: number;
206
+ id: string;
207
+ jump?: boolean;
208
+ }>;
209
+ }
210
+ /**
211
+ * Represents a carousel widget with specific properties, state, API, and directives.
212
+ */
213
+ export type CarouselWidget = Widget<CarouselProps, CarouselState, CarouselApi, CarouselDirectives>;
214
+ /**
215
+ * Retrieve a shallow copy of the default Carousel config
216
+ * @returns the default Carousel config
217
+ */
218
+ export declare function getCarouselDefaultConfig(): CarouselProps;
219
+ /**
220
+ * An Embla Carousel widget factory.
221
+ *
222
+ * @internal
223
+ * @param options$ - the store of Embla options
224
+ * @param plugins$ - the store of Embla plugins
225
+ * @returns the Embla carousel widget
226
+ */
227
+ export declare function createEmblaCarousel(options$: ReadableSignal<Partial<EmblaOptions>>, plugins$?: ReadableSignal<EmblaPluginType[]>): {
228
+ directive: Directive;
229
+ stores: {
230
+ scrolling$: ReadableSignal<boolean>;
231
+ canScrollPrev$: ReadableSignal<boolean>;
232
+ canScrollNext$: ReadableSignal<boolean>;
233
+ selectedScrollSnap$: ReadableSignal<number>;
234
+ initialized$: ReadableSignal<boolean>;
235
+ slideNodes$: ReadableSignal<HTMLElement[]>;
236
+ };
237
+ api: EmblaCarouselType | undefined;
238
+ };
239
+ /**
240
+ * Create an CarouselWidget with given config props
241
+ *
242
+ * @template SlideData - The type of data used by each slide in the carousel.
243
+ * @param config - an optional carousel config
244
+ * @returns a CarouselWidget
245
+ */
246
+ export declare const createCarousel: WidgetFactory<CarouselWidget>;
247
+ export {};
@@ -0,0 +1,292 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const utils_stores = require("../../utils/stores.cjs");
4
+ const utils_directive = require("../../directive-DCaXmRe_.cjs");
5
+ const EmblaCarousel = require("embla-carousel");
6
+ const tansu = require("@amadeus-it-group/tansu");
7
+ const utils_writables = require("../../writables-Dt68gADJ.cjs");
8
+ const services_navManager = require("../../services/navManager.cjs");
9
+ const utils_widget = require("../../utils/widget.cjs");
10
+ const defaultConfig = {
11
+ align: "center",
12
+ container: null,
13
+ containScroll: "trimSnaps",
14
+ direction: "ltr",
15
+ dragFree: false,
16
+ dragThreshold: 10,
17
+ duration: 25,
18
+ loop: false,
19
+ skipSnaps: false,
20
+ plugins: [],
21
+ showNavigationArrows: true,
22
+ showNavigationIndicators: true,
23
+ ariaPrevLabel: "Select previous slide",
24
+ ariaNextLabel: "Select next slide",
25
+ ariaIndicatorLabel: (index) => `Select slide ${index + 1}`
26
+ };
27
+ function getCarouselDefaultConfig() {
28
+ return { ...defaultConfig };
29
+ }
30
+ const configValidator = {
31
+ dragFree: utils_writables.typeBoolean,
32
+ plugins: utils_writables.typeArray,
33
+ align: utils_writables.createTypeEnum(["start", "center", "end"]),
34
+ container: utils_writables.typeStringOrNull,
35
+ containScroll: utils_writables.createTypeEnum([false, "trimSnaps", "keepSnaps"]),
36
+ direction: utils_writables.createTypeEnum(["ltr", "rtl"]),
37
+ dragThreshold: utils_writables.typeNumber,
38
+ duration: utils_writables.typeNumber,
39
+ loop: utils_writables.typeBoolean,
40
+ skipSnaps: utils_writables.typeBoolean,
41
+ showNavigationArrows: utils_writables.typeBoolean,
42
+ showNavigationIndicators: utils_writables.typeBoolean,
43
+ ariaPrevLabel: utils_writables.typeString,
44
+ ariaNextLabel: utils_writables.typeString,
45
+ ariaIndicatorLabel: utils_writables.typeFunction
46
+ };
47
+ function createEmblaCarousel(options$, plugins$) {
48
+ let emblaApi;
49
+ const scrolling$ = tansu.writable(false);
50
+ const canScrollPrev$ = tansu.writable(false);
51
+ const canScrollNext$ = tansu.writable(true);
52
+ const selectedScrollSnap$ = tansu.writable(0);
53
+ const initialized$ = tansu.writable(false);
54
+ const slideNodes$ = tansu.writable([]);
55
+ const directiveArgs$ = tansu.computed(() => ({
56
+ options: options$(),
57
+ plugins: plugins$ ? plugins$() : []
58
+ }));
59
+ return {
60
+ directive: utils_directive.bindDirective(
61
+ utils_directive.browserDirective(
62
+ (element, { options, plugins }) => {
63
+ if (emblaApi) {
64
+ throw new Error("Only one Embla directive can be attached per carousel widget !");
65
+ }
66
+ emblaApi = EmblaCarousel(element, options, plugins);
67
+ emblaApi.on("scroll", () => {
68
+ scrolling$.set(true);
69
+ });
70
+ emblaApi.on("settle", () => {
71
+ scrolling$.set(false);
72
+ });
73
+ emblaApi.on("select", (api) => {
74
+ canScrollNext$.set(api.canScrollNext());
75
+ canScrollPrev$.set(api.canScrollPrev());
76
+ selectedScrollSnap$.set(api.selectedScrollSnap());
77
+ });
78
+ emblaApi.on("init", () => {
79
+ initialized$.set(true);
80
+ });
81
+ emblaApi.on("reInit", (api) => {
82
+ canScrollNext$.set(api.canScrollNext());
83
+ canScrollPrev$.set(api.canScrollPrev());
84
+ scrolling$.set(false);
85
+ selectedScrollSnap$.set(api.selectedScrollSnap());
86
+ });
87
+ emblaApi.on("slidesChanged", (api) => {
88
+ slideNodes$.set(api.slideNodes());
89
+ });
90
+ canScrollNext$.set(emblaApi.canScrollNext());
91
+ canScrollPrev$.set(emblaApi.canScrollPrev());
92
+ slideNodes$.set(emblaApi.slideNodes());
93
+ return {
94
+ update: ({ options: options2, plugins: plugins2 }) => {
95
+ emblaApi.reInit(options2, plugins2);
96
+ },
97
+ destroy: () => {
98
+ emblaApi?.destroy();
99
+ emblaApi = void 0;
100
+ initialized$.set(false);
101
+ scrolling$.set(false);
102
+ canScrollPrev$.set(false);
103
+ canScrollNext$.set(true);
104
+ selectedScrollSnap$.set(0);
105
+ slideNodes$.set([]);
106
+ }
107
+ };
108
+ }
109
+ ),
110
+ directiveArgs$
111
+ ),
112
+ stores: {
113
+ scrolling$: tansu.asReadable(scrolling$),
114
+ canScrollPrev$: tansu.asReadable(canScrollPrev$),
115
+ canScrollNext$: tansu.asReadable(canScrollNext$),
116
+ selectedScrollSnap$: tansu.asReadable(selectedScrollSnap$),
117
+ initialized$: tansu.asReadable(initialized$),
118
+ slideNodes$: tansu.asReadable(slideNodes$)
119
+ },
120
+ get api() {
121
+ return emblaApi;
122
+ }
123
+ };
124
+ }
125
+ const createCarousel = utils_widget.createWidgetFactory(
126
+ "carousel",
127
+ (config) => {
128
+ const [
129
+ {
130
+ align$,
131
+ container$,
132
+ containScroll$,
133
+ direction$,
134
+ dragFree$,
135
+ dragThreshold$,
136
+ duration$,
137
+ loop$,
138
+ skipSnaps$,
139
+ plugins$,
140
+ ariaPrevLabel$,
141
+ ariaNextLabel$,
142
+ ariaIndicatorLabel$,
143
+ showNavigationIndicators$,
144
+ ...stateProps
145
+ },
146
+ patch
147
+ ] = utils_stores.writablesForProps(defaultConfig, config, configValidator);
148
+ const emblaOptions$ = tansu.computed(() => ({
149
+ align: align$(),
150
+ container: container$(),
151
+ containScroll: containScroll$(),
152
+ direction: direction$(),
153
+ dragFree: dragFree$(),
154
+ dragThreshold: dragThreshold$(),
155
+ duration: duration$(),
156
+ loop: loop$(),
157
+ skipSnaps: skipSnaps$()
158
+ }));
159
+ const emblaCarousel = createEmblaCarousel(emblaOptions$, plugins$);
160
+ const {
161
+ stores: { slideNodes$, ...emblaStores }
162
+ } = emblaCarousel;
163
+ const {
164
+ directive: navDirective,
165
+ refreshElements,
166
+ focusLeft,
167
+ focusRight,
168
+ focusFirst,
169
+ focusLast
170
+ } = services_navManager.createNavManager();
171
+ const navManagerConfig = {
172
+ keys: {
173
+ ArrowLeft: focusLeft,
174
+ ArrowRight: focusRight,
175
+ Home: focusFirst,
176
+ End: focusLast
177
+ },
178
+ selector: (node) => node.querySelectorAll("[role='tab']")
179
+ };
180
+ return {
181
+ ...utils_stores.stateStores({
182
+ ...emblaStores,
183
+ ...stateProps,
184
+ direction$,
185
+ showNavigationIndicators$
186
+ }),
187
+ patch,
188
+ api: {
189
+ scrollPrev: (jump) => {
190
+ emblaCarousel.api?.scrollPrev?.(jump);
191
+ },
192
+ scrollNext: (jump) => {
193
+ emblaCarousel.api?.scrollNext?.(jump);
194
+ },
195
+ scrollTo: (index, jump) => {
196
+ emblaCarousel.api?.scrollTo?.(index, jump);
197
+ },
198
+ plugins: () => emblaCarousel.api?.plugins?.(),
199
+ emblaApi: () => emblaCarousel.api
200
+ },
201
+ directives: {
202
+ root: utils_directive.mergeDirectives(
203
+ emblaCarousel.directive,
204
+ utils_directive.createAttributesDirective(() => ({
205
+ classNames: {
206
+ "au-carousel": utils_stores.true$
207
+ },
208
+ attributes: {
209
+ role: tansu.readable("region"),
210
+ "aria-roledescription": tansu.readable("carousel"),
211
+ dir: direction$
212
+ }
213
+ }))
214
+ ),
215
+ scrollPrev: utils_directive.createAttributesDirective(() => ({
216
+ attributes: {
217
+ "aria-label": ariaPrevLabel$,
218
+ disabled: tansu.computed(() => !emblaCarousel.stores.canScrollPrev$() || void 0)
219
+ },
220
+ events: {
221
+ click: () => emblaCarousel.api?.scrollPrev(),
222
+ pointerdown: (event) => event.preventDefault(),
223
+ touchstart: (event) => event.stopPropagation()
224
+ }
225
+ })),
226
+ scrollNext: utils_directive.createAttributesDirective(() => ({
227
+ attributes: {
228
+ "aria-label": ariaNextLabel$,
229
+ disabled: tansu.computed(() => !emblaCarousel.stores.canScrollNext$() || void 0)
230
+ },
231
+ events: {
232
+ click: () => emblaCarousel.api?.scrollNext(),
233
+ pointerdown: (event) => event.preventDefault(),
234
+ touchstart: (event) => event.stopPropagation()
235
+ }
236
+ })),
237
+ tabList: utils_directive.mergeDirectives(
238
+ utils_directive.bindDirective(navDirective, tansu.readable(navManagerConfig)),
239
+ utils_directive.browserDirective(() => {
240
+ const unsubscribe = slideNodes$.subscribe(() => {
241
+ refreshElements();
242
+ });
243
+ return {
244
+ destroy: unsubscribe
245
+ };
246
+ }),
247
+ utils_directive.createAttributesDirective(() => ({
248
+ attributes: {
249
+ role: tansu.readable("tablist")
250
+ }
251
+ }))
252
+ ),
253
+ tabIndicator: utils_directive.createAttributesDirective(
254
+ (slide$) => ({
255
+ events: {
256
+ click: () => {
257
+ emblaCarousel.api?.scrollTo(slide$().index, slide$().jump ?? true);
258
+ }
259
+ },
260
+ attributes: {
261
+ "aria-label": tansu.computed(() => ariaIndicatorLabel$()(slide$().index)),
262
+ "aria-selected": tansu.computed(
263
+ () => slide$().index === emblaCarousel.stores.selectedScrollSnap$() ? "true" : void 0
264
+ ),
265
+ "aria-controls": tansu.computed(() => slide$().id),
266
+ role: tansu.readable("tab"),
267
+ tabindex: tansu.computed(() => slide$().index === emblaCarousel.stores.selectedScrollSnap$() ? "0" : "-1")
268
+ }
269
+ })
270
+ ),
271
+ slide: utils_directive.createAttributesDirective((slide$) => {
272
+ const selected$ = tansu.computed(() => slide$().index === emblaCarousel.stores.selectedScrollSnap$());
273
+ return {
274
+ attributes: {
275
+ id: tansu.computed(() => slide$().id),
276
+ "aria-hidden": tansu.computed(() => selected$() ? void 0 : "true"),
277
+ role: tansu.computed(() => showNavigationIndicators$() ? "tabpanel" : "group"),
278
+ "aria-roledescription": tansu.computed(() => showNavigationIndicators$() ? void 0 : "slide"),
279
+ tabindex: tansu.computed(() => showNavigationIndicators$() && selected$() ? "0" : void 0)
280
+ },
281
+ classNames: {
282
+ "au-carousel-slide": utils_stores.true$
283
+ }
284
+ };
285
+ })
286
+ }
287
+ };
288
+ }
289
+ );
290
+ exports.createCarousel = createCarousel;
291
+ exports.createEmblaCarousel = createEmblaCarousel;
292
+ exports.getCarouselDefaultConfig = getCarouselDefaultConfig;
@@ -0,0 +1 @@
1
+ export * from './carousel';