@design-factory/angular 21.1.0-next.0 → 21.1.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 (191) hide show
  1. package/fesm2022/design-factory-angular-drawer.mjs +22 -29
  2. package/fesm2022/design-factory-angular-drawer.mjs.map +1 -1
  3. package/fesm2022/design-factory-angular-internals.mjs +5 -5
  4. package/fesm2022/design-factory-angular-internals.mjs.map +1 -1
  5. package/fesm2022/design-factory-angular-sidenav.mjs +139 -62
  6. package/fesm2022/design-factory-angular-sidenav.mjs.map +1 -1
  7. package/fesm2022/design-factory-angular-theme.mjs +1 -1
  8. package/fesm2022/design-factory-angular-theme.mjs.map +1 -1
  9. package/fesm2022/design-factory-angular-topnav.mjs +152 -75
  10. package/fesm2022/design-factory-angular-topnav.mjs.map +1 -1
  11. package/package.json +3 -6
  12. package/types/design-factory-angular-drawer.d.ts +13 -14
  13. package/types/design-factory-angular-internals.d.ts +3 -3
  14. package/types/design-factory-angular-sidenav.d.ts +19 -6
  15. package/types/design-factory-angular-topnav.d.ts +13 -6
  16. package/node_modules/@agnos-ui/core/README.md +0 -5
  17. package/node_modules/@agnos-ui/core/accordion-BC_9xn23.cjs +0 -314
  18. package/node_modules/@agnos-ui/core/accordion-Ca_0T8Bc.js +0 -315
  19. package/node_modules/@agnos-ui/core/alert-AhaliJ17.cjs +0 -9
  20. package/node_modules/@agnos-ui/core/alert-Cb9FhbFQ.js +0 -10
  21. package/node_modules/@agnos-ui/core/collapse-COriZO7o.cjs +0 -94
  22. package/node_modules/@agnos-ui/core/collapse-CP79atna.js +0 -95
  23. package/node_modules/@agnos-ui/core/common-B5jS-Ih_.cjs +0 -73
  24. package/node_modules/@agnos-ui/core/common-DFyZvkII.js +0 -74
  25. package/node_modules/@agnos-ui/core/components/accordion/accordion.d.ts +0 -333
  26. package/node_modules/@agnos-ui/core/components/accordion/index.cjs +0 -7
  27. package/node_modules/@agnos-ui/core/components/accordion/index.d.ts +0 -1
  28. package/node_modules/@agnos-ui/core/components/accordion/index.js +0 -7
  29. package/node_modules/@agnos-ui/core/components/alert/alert.d.ts +0 -37
  30. package/node_modules/@agnos-ui/core/components/alert/common.d.ts +0 -138
  31. package/node_modules/@agnos-ui/core/components/alert/index.cjs +0 -5
  32. package/node_modules/@agnos-ui/core/components/alert/index.d.ts +0 -1
  33. package/node_modules/@agnos-ui/core/components/alert/index.js +0 -5
  34. package/node_modules/@agnos-ui/core/components/carousel/carousel.d.ts +0 -247
  35. package/node_modules/@agnos-ui/core/components/carousel/index.cjs +0 -292
  36. package/node_modules/@agnos-ui/core/components/carousel/index.d.ts +0 -1
  37. package/node_modules/@agnos-ui/core/components/carousel/index.js +0 -292
  38. package/node_modules/@agnos-ui/core/components/collapse/collapse.d.ts +0 -135
  39. package/node_modules/@agnos-ui/core/components/collapse/index.cjs +0 -5
  40. package/node_modules/@agnos-ui/core/components/collapse/index.d.ts +0 -1
  41. package/node_modules/@agnos-ui/core/components/collapse/index.js +0 -5
  42. package/node_modules/@agnos-ui/core/components/commonProps.d.ts +0 -11
  43. package/node_modules/@agnos-ui/core/components/drawer/drawer.d.ts +0 -279
  44. package/node_modules/@agnos-ui/core/components/drawer/index.cjs +0 -5
  45. package/node_modules/@agnos-ui/core/components/drawer/index.d.ts +0 -1
  46. package/node_modules/@agnos-ui/core/components/drawer/index.js +0 -5
  47. package/node_modules/@agnos-ui/core/components/modal/index.cjs +0 -8
  48. package/node_modules/@agnos-ui/core/components/modal/index.d.ts +0 -1
  49. package/node_modules/@agnos-ui/core/components/modal/index.js +0 -8
  50. package/node_modules/@agnos-ui/core/components/modal/modal.d.ts +0 -245
  51. package/node_modules/@agnos-ui/core/components/pagination/index.cjs +0 -5
  52. package/node_modules/@agnos-ui/core/components/pagination/index.d.ts +0 -1
  53. package/node_modules/@agnos-ui/core/components/pagination/index.js +0 -5
  54. package/node_modules/@agnos-ui/core/components/pagination/pagination.d.ts +0 -313
  55. package/node_modules/@agnos-ui/core/components/progressbar/index.cjs +0 -5
  56. package/node_modules/@agnos-ui/core/components/progressbar/index.d.ts +0 -1
  57. package/node_modules/@agnos-ui/core/components/progressbar/index.js +0 -5
  58. package/node_modules/@agnos-ui/core/components/progressbar/progressbar.d.ts +0 -91
  59. package/node_modules/@agnos-ui/core/components/rating/index.cjs +0 -5
  60. package/node_modules/@agnos-ui/core/components/rating/index.d.ts +0 -1
  61. package/node_modules/@agnos-ui/core/components/rating/index.js +0 -5
  62. package/node_modules/@agnos-ui/core/components/rating/rating.d.ts +0 -191
  63. package/node_modules/@agnos-ui/core/components/slider/index.cjs +0 -5
  64. package/node_modules/@agnos-ui/core/components/slider/index.d.ts +0 -1
  65. package/node_modules/@agnos-ui/core/components/slider/index.js +0 -5
  66. package/node_modules/@agnos-ui/core/components/slider/slider-utils.d.ts +0 -25
  67. package/node_modules/@agnos-ui/core/components/slider/slider.d.ts +0 -383
  68. package/node_modules/@agnos-ui/core/components/toast/index.cjs +0 -7
  69. package/node_modules/@agnos-ui/core/components/toast/index.d.ts +0 -2
  70. package/node_modules/@agnos-ui/core/components/toast/index.js +0 -7
  71. package/node_modules/@agnos-ui/core/components/toast/toast.d.ts +0 -66
  72. package/node_modules/@agnos-ui/core/components/toast/toaster.d.ts +0 -128
  73. package/node_modules/@agnos-ui/core/components/tree/index.cjs +0 -5
  74. package/node_modules/@agnos-ui/core/components/tree/index.d.ts +0 -1
  75. package/node_modules/@agnos-ui/core/components/tree/index.js +0 -5
  76. package/node_modules/@agnos-ui/core/components/tree/tree.d.ts +0 -143
  77. package/node_modules/@agnos-ui/core/config.cjs +0 -36
  78. package/node_modules/@agnos-ui/core/config.d.ts +0 -117
  79. package/node_modules/@agnos-ui/core/config.js +0 -36
  80. package/node_modules/@agnos-ui/core/directive-Bsreu2z1.js +0 -523
  81. package/node_modules/@agnos-ui/core/directive-DCaXmRe_.cjs +0 -522
  82. package/node_modules/@agnos-ui/core/drawer-BbFAHV07.cjs +0 -328
  83. package/node_modules/@agnos-ui/core/drawer-C6Qa0xEu.js +0 -329
  84. package/node_modules/@agnos-ui/core/index.cjs +0 -134
  85. package/node_modules/@agnos-ui/core/index.d.ts +0 -29
  86. package/node_modules/@agnos-ui/core/index.js +0 -134
  87. package/node_modules/@agnos-ui/core/isFocusable-Ckwus82R.js +0 -32
  88. package/node_modules/@agnos-ui/core/isFocusable-DfzDLeAN.cjs +0 -31
  89. package/node_modules/@agnos-ui/core/modal-BsNuHhT7.cjs +0 -252
  90. package/node_modules/@agnos-ui/core/modal-CgzY8ezz.js +0 -253
  91. package/node_modules/@agnos-ui/core/package.json +0 -57
  92. package/node_modules/@agnos-ui/core/pagination-ZxGaNWZz.js +0 -255
  93. package/node_modules/@agnos-ui/core/pagination-xbcOHnhd.cjs +0 -254
  94. package/node_modules/@agnos-ui/core/progressbar-CRbMKp4b.cjs +0 -86
  95. package/node_modules/@agnos-ui/core/progressbar-CSEIFnlD.js +0 -87
  96. package/node_modules/@agnos-ui/core/promise-CxCD3NYv.cjs +0 -118
  97. package/node_modules/@agnos-ui/core/promise-D-RZVPuv.js +0 -119
  98. package/node_modules/@agnos-ui/core/rating-BIdiiPUo.js +0 -184
  99. package/node_modules/@agnos-ui/core/rating-qx1xaBmz.cjs +0 -183
  100. package/node_modules/@agnos-ui/core/scrollbars-CT87iv_6.cjs +0 -30
  101. package/node_modules/@agnos-ui/core/scrollbars-CcxSrnCx.js +0 -31
  102. package/node_modules/@agnos-ui/core/services/extendWidget.cjs +0 -41
  103. package/node_modules/@agnos-ui/core/services/extendWidget.d.ts +0 -31
  104. package/node_modules/@agnos-ui/core/services/extendWidget.js +0 -41
  105. package/node_modules/@agnos-ui/core/services/floatingUI.cjs +0 -111
  106. package/node_modules/@agnos-ui/core/services/floatingUI.d.ts +0 -76
  107. package/node_modules/@agnos-ui/core/services/floatingUI.js +0 -111
  108. package/node_modules/@agnos-ui/core/services/focusElement.cjs +0 -46
  109. package/node_modules/@agnos-ui/core/services/focusElement.d.ts +0 -9
  110. package/node_modules/@agnos-ui/core/services/focusElement.js +0 -46
  111. package/node_modules/@agnos-ui/core/services/focustrack.cjs +0 -47
  112. package/node_modules/@agnos-ui/core/services/focustrack.d.ts +0 -40
  113. package/node_modules/@agnos-ui/core/services/focustrack.js +0 -47
  114. package/node_modules/@agnos-ui/core/services/hash.cjs +0 -15
  115. package/node_modules/@agnos-ui/core/services/hash.d.ts +0 -3
  116. package/node_modules/@agnos-ui/core/services/hash.js +0 -15
  117. package/node_modules/@agnos-ui/core/services/intersection.cjs +0 -53
  118. package/node_modules/@agnos-ui/core/services/intersection.d.ts +0 -30
  119. package/node_modules/@agnos-ui/core/services/intersection.js +0 -53
  120. package/node_modules/@agnos-ui/core/services/matchMedia.cjs +0 -14
  121. package/node_modules/@agnos-ui/core/services/matchMedia.d.ts +0 -8
  122. package/node_modules/@agnos-ui/core/services/matchMedia.js +0 -14
  123. package/node_modules/@agnos-ui/core/services/navManager.cjs +0 -166
  124. package/node_modules/@agnos-ui/core/services/navManager.d.ts +0 -144
  125. package/node_modules/@agnos-ui/core/services/navManager.js +0 -166
  126. package/node_modules/@agnos-ui/core/services/pointerdownPosition.cjs +0 -60
  127. package/node_modules/@agnos-ui/core/services/pointerdownPosition.d.ts +0 -42
  128. package/node_modules/@agnos-ui/core/services/pointerdownPosition.js +0 -60
  129. package/node_modules/@agnos-ui/core/services/portal.cjs +0 -42
  130. package/node_modules/@agnos-ui/core/services/portal.d.ts +0 -16
  131. package/node_modules/@agnos-ui/core/services/portal.js +0 -42
  132. package/node_modules/@agnos-ui/core/services/resizeObserver.cjs +0 -54
  133. package/node_modules/@agnos-ui/core/services/resizeObserver.d.ts +0 -18
  134. package/node_modules/@agnos-ui/core/services/resizeObserver.js +0 -54
  135. package/node_modules/@agnos-ui/core/services/siblingsInert.cjs +0 -44
  136. package/node_modules/@agnos-ui/core/services/siblingsInert.d.ts +0 -16
  137. package/node_modules/@agnos-ui/core/services/siblingsInert.js +0 -44
  138. package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.cjs +0 -186
  139. package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.d.ts +0 -166
  140. package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.js +0 -186
  141. package/node_modules/@agnos-ui/core/services/transitions/collapse.cjs +0 -40
  142. package/node_modules/@agnos-ui/core/services/transitions/collapse.d.ts +0 -49
  143. package/node_modules/@agnos-ui/core/services/transitions/collapse.js +0 -40
  144. package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.cjs +0 -32
  145. package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.d.ts +0 -25
  146. package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.js +0 -32
  147. package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.cjs +0 -37
  148. package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.d.ts +0 -47
  149. package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.js +0 -37
  150. package/node_modules/@agnos-ui/core/slider-B93hE0ag.cjs +0 -807
  151. package/node_modules/@agnos-ui/core/slider-Cjiq9FgI.js +0 -808
  152. package/node_modules/@agnos-ui/core/textDirection-cNgt24LJ.js +0 -4
  153. package/node_modules/@agnos-ui/core/textDirection-zqcZ5-eK.cjs +0 -3
  154. package/node_modules/@agnos-ui/core/toaster-BQWqxYv-.cjs +0 -190
  155. package/node_modules/@agnos-ui/core/toaster-BzEkshT2.js +0 -191
  156. package/node_modules/@agnos-ui/core/tree-DY04XPPg.cjs +0 -228
  157. package/node_modules/@agnos-ui/core/tree-HwcvZ0_p.js +0 -229
  158. package/node_modules/@agnos-ui/core/types.cjs +0 -6
  159. package/node_modules/@agnos-ui/core/types.d.ts +0 -246
  160. package/node_modules/@agnos-ui/core/types.js +0 -6
  161. package/node_modules/@agnos-ui/core/utils/directive.cjs +0 -28
  162. package/node_modules/@agnos-ui/core/utils/directive.d.ts +0 -352
  163. package/node_modules/@agnos-ui/core/utils/directive.js +0 -28
  164. package/node_modules/@agnos-ui/core/utils/func.cjs +0 -7
  165. package/node_modules/@agnos-ui/core/utils/func.d.ts +0 -11
  166. package/node_modules/@agnos-ui/core/utils/func.js +0 -7
  167. package/node_modules/@agnos-ui/core/utils/id.cjs +0 -5
  168. package/node_modules/@agnos-ui/core/utils/id.d.ts +0 -6
  169. package/node_modules/@agnos-ui/core/utils/id.js +0 -5
  170. package/node_modules/@agnos-ui/core/utils/internal/assign.d.ts +0 -10
  171. package/node_modules/@agnos-ui/core/utils/internal/checks.d.ts +0 -57
  172. package/node_modules/@agnos-ui/core/utils/internal/dom.d.ts +0 -75
  173. package/node_modules/@agnos-ui/core/utils/internal/isFocusable.d.ts +0 -9
  174. package/node_modules/@agnos-ui/core/utils/internal/math.d.ts +0 -5
  175. package/node_modules/@agnos-ui/core/utils/internal/promise.d.ts +0 -98
  176. package/node_modules/@agnos-ui/core/utils/internal/scrollbars.d.ts +0 -8
  177. package/node_modules/@agnos-ui/core/utils/internal/sort.d.ts +0 -16
  178. package/node_modules/@agnos-ui/core/utils/internal/ssrHTMLElement.d.ts +0 -17
  179. package/node_modules/@agnos-ui/core/utils/internal/textDirection.d.ts +0 -7
  180. package/node_modules/@agnos-ui/core/utils/internal/traversal.d.ts +0 -54
  181. package/node_modules/@agnos-ui/core/utils/stores.cjs +0 -172
  182. package/node_modules/@agnos-ui/core/utils/stores.d.ts +0 -224
  183. package/node_modules/@agnos-ui/core/utils/stores.js +0 -172
  184. package/node_modules/@agnos-ui/core/utils/widget.cjs +0 -8
  185. package/node_modules/@agnos-ui/core/utils/widget.d.ts +0 -11
  186. package/node_modules/@agnos-ui/core/utils/widget.js +0 -8
  187. package/node_modules/@agnos-ui/core/utils/writables.cjs +0 -16
  188. package/node_modules/@agnos-ui/core/utils/writables.d.ts +0 -95
  189. package/node_modules/@agnos-ui/core/utils/writables.js +0 -16
  190. package/node_modules/@agnos-ui/core/writables-DYGjj5T3.js +0 -103
  191. package/node_modules/@agnos-ui/core/writables-Dt68gADJ.cjs +0 -102
@@ -1,254 +0,0 @@
1
- "use strict";
2
- const tansu = require("@amadeus-it-group/tansu");
3
- const utils_stores = require("./utils/stores.cjs");
4
- const utils_writables = require("./writables-Dt68gADJ.cjs");
5
- const utils_func = require("./utils/func.cjs");
6
- const utils_directive = require("./directive-DCaXmRe_.cjs");
7
- const utils_widget = require("./utils/widget.cjs");
8
- const PAGE_LINK_DEFAULT = "#";
9
- const defaultConfig = {
10
- page: 1,
11
- collectionSize: 0,
12
- pageSize: 10,
13
- disabled: false,
14
- directionLinks: true,
15
- boundaryLinks: false,
16
- onPageChange: utils_func.noop,
17
- pagesFactory: (_page, pageCount) => {
18
- const pages = [];
19
- for (let i = 1; i <= pageCount; i++) {
20
- pages.push(i);
21
- }
22
- return pages;
23
- },
24
- ariaLabel: "Page navigation",
25
- activeLabel: "(current)",
26
- ariaPageLabel: (processPage, pageCount) => `Page ${processPage} of ${pageCount}`,
27
- ariaFirstLabel: "Action link for first page",
28
- ariaPreviousLabel: "Action link for previous page",
29
- ariaNextLabel: "Action link for next page",
30
- ariaLastLabel: "Action link for last page",
31
- ariaEllipsisLabel: "Ellipsis page element",
32
- ariaLiveLabel: (currentPage) => `Current page is ${currentPage}`,
33
- className: "",
34
- pageLink: (_page) => PAGE_LINK_DEFAULT
35
- };
36
- function getPaginationDefaultConfig() {
37
- return { ...defaultConfig };
38
- }
39
- const configValidator = {
40
- page: utils_writables.typeNumber,
41
- collectionSize: utils_writables.typeNumber,
42
- pageSize: utils_writables.typeNumber,
43
- disabled: utils_writables.typeBoolean,
44
- directionLinks: utils_writables.typeBoolean,
45
- boundaryLinks: utils_writables.typeBoolean,
46
- onPageChange: utils_writables.typeFunction,
47
- pagesFactory: utils_writables.typeFunction,
48
- ariaLabel: utils_writables.typeString,
49
- activeLabel: utils_writables.typeString,
50
- ariaPageLabel: utils_writables.typeFunction,
51
- ariaFirstLabel: utils_writables.typeString,
52
- ariaPreviousLabel: utils_writables.typeString,
53
- ariaNextLabel: utils_writables.typeString,
54
- ariaLastLabel: utils_writables.typeString,
55
- ariaLiveLabel: utils_writables.typeFunction,
56
- className: utils_writables.typeString,
57
- pageLink: utils_writables.typeFunction,
58
- ariaEllipsisLabel: utils_writables.typeString
59
- };
60
- const createPagination = utils_widget.createWidgetFactory(
61
- "pagination",
62
- (config) => {
63
- const [
64
- {
65
- // dirty inputs that need adjustment:
66
- page$: _dirtyPage$,
67
- // clean inputs with value validation:
68
- collectionSize$,
69
- pageSize$,
70
- onPageChange$,
71
- pagesFactory$,
72
- ariaPageLabel$,
73
- ariaLiveLabel$,
74
- pageLink$,
75
- disabled$,
76
- ariaFirstLabel$,
77
- ariaLastLabel$,
78
- ariaNextLabel$,
79
- ariaPreviousLabel$,
80
- ...stateProps
81
- },
82
- patch
83
- ] = utils_stores.writablesForProps(defaultConfig, config, configValidator);
84
- const pageCount$ = tansu.computed(() => {
85
- let pageCount = Math.ceil(collectionSize$() / pageSize$());
86
- if (!utils_writables.isNumber(pageCount) || pageCount < 1) {
87
- pageCount = 1;
88
- }
89
- return pageCount;
90
- });
91
- const page$ = utils_stores.bindableProp(_dirtyPage$, onPageChange$, (dirtyPage) => utils_writables.clamp(dirtyPage, pageCount$(), 1));
92
- const pages$ = tansu.computed(() => pagesFactory$()(page$(), pageCount$()));
93
- const nextDisabled$ = tansu.computed(() => page$() === pageCount$() || disabled$());
94
- const previousDisabled$ = tansu.computed(() => page$() === 1 || disabled$());
95
- const pagesLabel$ = tansu.computed(() => {
96
- const ariaPageLabel = ariaPageLabel$();
97
- const pageCount = pageCount$();
98
- return pages$().map((page) => ariaPageLabel(page, pageCount));
99
- });
100
- const pagesHrefs$ = tansu.computed(() => {
101
- const pageLinkFactory = pageLink$();
102
- const pageCount = pageCount$();
103
- return Array.from({ length: pageCount }, (_, index) => pageLinkFactory(index + 1));
104
- });
105
- const directionsHrefs$ = tansu.computed(() => {
106
- const pagesHrefs = pagesHrefs$();
107
- const pageIndex = page$() - 1;
108
- return {
109
- previous: pagesHrefs.at(pageIndex > 0 ? pageIndex - 1 : 0),
110
- next: pagesHrefs.at(pageIndex + 1) ?? pagesHrefs.at(-1)
111
- };
112
- });
113
- const ariaLiveLabelText$ = tansu.computed(() => ariaLiveLabel$()(page$(), pageCount$()));
114
- function handleNavigation(pageNumber, event) {
115
- if (pagesHrefs$()[pageNumber - 1] === PAGE_LINK_DEFAULT) {
116
- event?.preventDefault();
117
- }
118
- if (!event || !(event.ctrlKey || event.metaKey)) {
119
- event?.preventDefault();
120
- page$.set(pageNumber);
121
- }
122
- }
123
- const widget = {
124
- ...utils_stores.stateStores({
125
- pageCount$,
126
- page$,
127
- pages$,
128
- nextDisabled$,
129
- previousDisabled$,
130
- pagesLabel$,
131
- pagesHrefs$,
132
- directionsHrefs$,
133
- disabled$,
134
- ariaFirstLabel$,
135
- ariaLastLabel$,
136
- ariaNextLabel$,
137
- ariaPreviousLabel$,
138
- ariaLiveLabelText$,
139
- ...stateProps
140
- }),
141
- patch,
142
- api: {
143
- /**
144
- * Set the current page pageNumber (starting from 1)
145
- * @param pageNumber - Current page number to set.
146
- * Value is normalized between 1 and the number of page
147
- */
148
- select(pageNumber) {
149
- page$.set(pageNumber);
150
- },
151
- /**
152
- * Select the first page
153
- */
154
- first() {
155
- page$.set(1);
156
- },
157
- /**
158
- * Select the previous page
159
- */
160
- previous() {
161
- page$.update((p) => p - 1);
162
- },
163
- /**
164
- * Select the next page
165
- */
166
- next() {
167
- page$.update((p) => p + 1);
168
- },
169
- /**
170
- * Select the last page
171
- */
172
- last() {
173
- page$.set(pageCount$());
174
- }
175
- },
176
- directives: {
177
- pageLink: utils_directive.createAttributesDirective((pageLinkContext$) => ({
178
- events: {
179
- click: (e) => handleNavigation(pageLinkContext$().page, e)
180
- },
181
- attributes: {
182
- "aria-current": tansu.computed(() => page$() === pageLinkContext$().page ? "page" : void 0),
183
- "aria-label": tansu.computed(() => pagesLabel$()[pageLinkContext$().page - 1]),
184
- href: tansu.computed(() => pagesHrefs$()[pageLinkContext$().page - 1]),
185
- tabindex: tansu.computed(() => disabled$() ? "-1" : void 0),
186
- "aria-disabled": tansu.computed(() => disabled$() ? "true" : void 0)
187
- },
188
- classNames: {
189
- "au-page": utils_stores.true$
190
- }
191
- })),
192
- pageFirst: utils_directive.createAttributesDirective(() => ({
193
- events: {
194
- click: (e) => handleNavigation(1, e)
195
- },
196
- attributes: {
197
- "aria-label": ariaFirstLabel$,
198
- href: tansu.computed(() => pagesHrefs$()[0]),
199
- tabindex: tansu.computed(() => previousDisabled$() ? "-1" : void 0),
200
- "aria-disabled": tansu.computed(() => previousDisabled$() ? "true" : void 0)
201
- },
202
- classNames: {
203
- "au-first": utils_stores.true$
204
- }
205
- })),
206
- pagePrev: utils_directive.createAttributesDirective(() => ({
207
- events: {
208
- click: (e) => handleNavigation(page$() - 1, e)
209
- },
210
- attributes: {
211
- "aria-label": ariaPreviousLabel$,
212
- href: tansu.computed(() => directionsHrefs$().previous),
213
- tabindex: tansu.computed(() => previousDisabled$() ? "-1" : void 0),
214
- "aria-disabled": tansu.computed(() => previousDisabled$() ? "true" : void 0)
215
- },
216
- classNames: {
217
- "au-previous": utils_stores.true$
218
- }
219
- })),
220
- pageNext: utils_directive.createAttributesDirective(() => ({
221
- events: {
222
- click: (e) => handleNavigation(page$() + 1, e)
223
- },
224
- attributes: {
225
- "aria-label": ariaNextLabel$,
226
- href: tansu.computed(() => directionsHrefs$().next),
227
- tabindex: tansu.computed(() => nextDisabled$() ? "-1" : void 0),
228
- "aria-disabled": tansu.computed(() => nextDisabled$() ? "true" : void 0)
229
- },
230
- classNames: {
231
- "au-next": utils_stores.true$
232
- }
233
- })),
234
- pageLast: utils_directive.createAttributesDirective(() => ({
235
- events: {
236
- click: (e) => handleNavigation(pageCount$(), e)
237
- },
238
- attributes: {
239
- "aria-label": ariaLastLabel$,
240
- href: tansu.computed(() => pagesHrefs$().at(-1)),
241
- tabindex: tansu.computed(() => nextDisabled$() ? "-1" : void 0),
242
- "aria-disabled": tansu.computed(() => nextDisabled$() ? "true" : void 0)
243
- },
244
- classNames: {
245
- "au-last": utils_stores.true$
246
- }
247
- }))
248
- }
249
- };
250
- return widget;
251
- }
252
- );
253
- exports.createPagination = createPagination;
254
- exports.getPaginationDefaultConfig = getPaginationDefaultConfig;
@@ -1,86 +0,0 @@
1
- "use strict";
2
- const utils_writables = require("./writables-Dt68gADJ.cjs");
3
- const utils_stores = require("./utils/stores.cjs");
4
- const tansu = require("@amadeus-it-group/tansu");
5
- const utils_directive = require("./directive-DCaXmRe_.cjs");
6
- const utils_widget = require("./utils/widget.cjs");
7
- const defaultConfig = {
8
- min: 0,
9
- max: 100,
10
- value: 0,
11
- ariaLabel: "Progressbar",
12
- className: "",
13
- ariaValueTextFn: () => void 0
14
- };
15
- function getProgressbarDefaultConfig() {
16
- return { ...defaultConfig };
17
- }
18
- const configValidator = {
19
- min: utils_writables.typeNumber,
20
- max: utils_writables.typeNumber,
21
- value: utils_writables.typeNumber,
22
- ariaLabel: utils_writables.typeString,
23
- className: utils_writables.typeString,
24
- ariaValueTextFn: utils_writables.typeFunction
25
- };
26
- const createProgressbar = utils_widget.createWidgetFactory(
27
- "progressbar",
28
- (config) => {
29
- const [
30
- {
31
- // dirty inputs that need adjustment:
32
- max$: _dirtyMaximum$,
33
- value$: _dirtyValue$,
34
- // clean inputs
35
- min$,
36
- ariaValueTextFn$,
37
- ariaLabel$,
38
- ...stateProps
39
- },
40
- patch
41
- ] = utils_stores.writablesForProps(defaultConfig, config, configValidator);
42
- const max$ = tansu.computed(() => Math.max(min$(), _dirtyMaximum$()));
43
- const value$ = tansu.computed(() => utils_writables.clamp(_dirtyValue$(), max$(), min$()));
44
- const percentage$ = tansu.computed(() => {
45
- const max = max$();
46
- const min = min$();
47
- if (max > min) {
48
- return utils_writables.clamp((value$() - min) * 100 / (max - min), 100, 0);
49
- } else {
50
- return 0;
51
- }
52
- });
53
- const started$ = tansu.computed(() => value$() > min$());
54
- const finished$ = tansu.computed(() => value$() === max$());
55
- const ariaValueText$ = tansu.computed(() => ariaValueTextFn$()(value$(), min$(), max$()));
56
- return {
57
- ...utils_stores.stateStores({
58
- min$,
59
- max$,
60
- value$,
61
- percentage$,
62
- started$,
63
- finished$,
64
- ariaValueText$,
65
- ariaLabel$,
66
- ...stateProps
67
- }),
68
- patch,
69
- api: {},
70
- directives: {
71
- ariaDirective: utils_directive.createAttributesDirective(() => ({
72
- attributes: {
73
- role: tansu.readable("progressbar"),
74
- "aria-label": ariaLabel$,
75
- "aria-valuenow": value$,
76
- "aria-valuemin": min$,
77
- "aria-valuemax": max$,
78
- "aria-valuetext": ariaValueText$
79
- }
80
- }))
81
- }
82
- };
83
- }
84
- );
85
- exports.createProgressbar = createProgressbar;
86
- exports.getProgressbarDefaultConfig = getProgressbarDefaultConfig;
@@ -1,87 +0,0 @@
1
- import { e as typeFunction, j as typeString, g as typeNumber, l as clamp } from "./writables-DYGjj5T3.js";
2
- import { writablesForProps, stateStores } from "./utils/stores.js";
3
- import { computed, readable } from "@amadeus-it-group/tansu";
4
- import { g as createAttributesDirective } from "./directive-Bsreu2z1.js";
5
- import { createWidgetFactory } from "./utils/widget.js";
6
- const defaultConfig = {
7
- min: 0,
8
- max: 100,
9
- value: 0,
10
- ariaLabel: "Progressbar",
11
- className: "",
12
- ariaValueTextFn: () => void 0
13
- };
14
- function getProgressbarDefaultConfig() {
15
- return { ...defaultConfig };
16
- }
17
- const configValidator = {
18
- min: typeNumber,
19
- max: typeNumber,
20
- value: typeNumber,
21
- ariaLabel: typeString,
22
- className: typeString,
23
- ariaValueTextFn: typeFunction
24
- };
25
- const createProgressbar = createWidgetFactory(
26
- "progressbar",
27
- (config) => {
28
- const [
29
- {
30
- // dirty inputs that need adjustment:
31
- max$: _dirtyMaximum$,
32
- value$: _dirtyValue$,
33
- // clean inputs
34
- min$,
35
- ariaValueTextFn$,
36
- ariaLabel$,
37
- ...stateProps
38
- },
39
- patch
40
- ] = writablesForProps(defaultConfig, config, configValidator);
41
- const max$ = computed(() => Math.max(min$(), _dirtyMaximum$()));
42
- const value$ = computed(() => clamp(_dirtyValue$(), max$(), min$()));
43
- const percentage$ = computed(() => {
44
- const max = max$();
45
- const min = min$();
46
- if (max > min) {
47
- return clamp((value$() - min) * 100 / (max - min), 100, 0);
48
- } else {
49
- return 0;
50
- }
51
- });
52
- const started$ = computed(() => value$() > min$());
53
- const finished$ = computed(() => value$() === max$());
54
- const ariaValueText$ = computed(() => ariaValueTextFn$()(value$(), min$(), max$()));
55
- return {
56
- ...stateStores({
57
- min$,
58
- max$,
59
- value$,
60
- percentage$,
61
- started$,
62
- finished$,
63
- ariaValueText$,
64
- ariaLabel$,
65
- ...stateProps
66
- }),
67
- patch,
68
- api: {},
69
- directives: {
70
- ariaDirective: createAttributesDirective(() => ({
71
- attributes: {
72
- role: readable("progressbar"),
73
- "aria-label": ariaLabel$,
74
- "aria-valuenow": value$,
75
- "aria-valuemin": min$,
76
- "aria-valuemax": max$,
77
- "aria-valuetext": ariaValueText$
78
- }
79
- }))
80
- }
81
- };
82
- }
83
- );
84
- export {
85
- createProgressbar as c,
86
- getProgressbarDefaultConfig as g
87
- };
@@ -1,118 +0,0 @@
1
- "use strict";
2
- const tansu = require("@amadeus-it-group/tansu");
3
- const utils_func = require("./utils/func.cjs");
4
- const promisePending = { status: "pending" };
5
- const isThenable = (value) => {
6
- const type = typeof value;
7
- return type === "object" && value !== null || type === "function" ? typeof value.then === "function" : false;
8
- };
9
- const createPromiseStateStore = (promise) => {
10
- const store = tansu.writable(promisePending);
11
- Promise.resolve(promise).then(
12
- (value) => store.set({ status: "fulfilled", value }),
13
- (reason) => store.set({ status: "rejected", reason })
14
- );
15
- return tansu.asReadable(store);
16
- };
17
- const promiseWeakMap = /* @__PURE__ */ new WeakMap();
18
- const promiseStateStore = (value) => {
19
- if (!isThenable(value)) {
20
- return tansu.readable({ status: "fulfilled", value });
21
- }
22
- let response = promiseWeakMap.get(value);
23
- if (!response) {
24
- response = createPromiseStateStore(value);
25
- promiseWeakMap.set(value, response);
26
- }
27
- return response;
28
- };
29
- const promiseStateStoreEqual = (a, b) => Object.is(a, b) || a.status === b.status && (a.status !== "fulfilled" || tansu.equal(a.value, b.value)) && (a.status !== "rejected" || tansu.equal(a.reason, b.reason));
30
- const promiseStoreToPromiseStateStore = (promiseStore$) => tansu.computed(() => promiseStateStore(promiseStore$())(), { equal: promiseStateStoreEqual });
31
- const promiseStateStoreToValueStore = (store$, initialValue, equal2) => tansu.derived(
32
- store$,
33
- {
34
- derive: (state, set) => {
35
- if (state.status === "fulfilled") {
36
- set(state.value);
37
- }
38
- },
39
- equal: equal2
40
- },
41
- initialValue
42
- );
43
- const promiseStoreToValueStore = (promiseStore$, initialValue, equal2) => promiseStateStoreToValueStore(promiseStoreToPromiseStateStore(promiseStore$), initialValue, equal2);
44
- const truthyValue = (value) => !!value;
45
- const promiseFromStore = (store, condition = truthyValue) => {
46
- let resolve;
47
- const promise = new Promise((r) => resolve = r);
48
- let unsubscribe = () => {
49
- storeUnsubscribe();
50
- unsubscribe = utils_func.noop;
51
- };
52
- let storeUnsubscribe = utils_func.noop;
53
- storeUnsubscribe = store.subscribe((value) => {
54
- if (condition(value)) {
55
- resolve(value);
56
- unsubscribe();
57
- }
58
- });
59
- if (unsubscribe === utils_func.noop) {
60
- storeUnsubscribe();
61
- }
62
- return {
63
- promise,
64
- unsubscribe() {
65
- unsubscribe();
66
- }
67
- };
68
- };
69
- const promiseFromEvent = (element, event) => {
70
- let resolve;
71
- const promise = new Promise((r) => resolve = r);
72
- let unsubscribe = () => {
73
- element.removeEventListener(event, eventListener);
74
- unsubscribe = utils_func.noop;
75
- };
76
- const eventListener = (event2) => {
77
- if (event2.target === element) {
78
- resolve(event2);
79
- unsubscribe();
80
- }
81
- };
82
- element.addEventListener(event, eventListener);
83
- return {
84
- promise,
85
- unsubscribe() {
86
- unsubscribe();
87
- }
88
- };
89
- };
90
- const promiseFromTimeout = (delay) => {
91
- let timeout;
92
- return {
93
- promise: new Promise((r) => {
94
- timeout = setTimeout(() => {
95
- timeout = void 0;
96
- r();
97
- }, delay);
98
- }),
99
- unsubscribe() {
100
- if (timeout) {
101
- clearTimeout(timeout);
102
- timeout = void 0;
103
- }
104
- }
105
- };
106
- };
107
- const promiseWithResolve = () => {
108
- let resolve;
109
- const promise = new Promise((r) => {
110
- resolve = r;
111
- });
112
- return { promise, resolve };
113
- };
114
- exports.promiseFromEvent = promiseFromEvent;
115
- exports.promiseFromStore = promiseFromStore;
116
- exports.promiseFromTimeout = promiseFromTimeout;
117
- exports.promiseStoreToValueStore = promiseStoreToValueStore;
118
- exports.promiseWithResolve = promiseWithResolve;
@@ -1,119 +0,0 @@
1
- import { derived, computed, readable, equal, writable, asReadable } from "@amadeus-it-group/tansu";
2
- import { noop } from "./utils/func.js";
3
- const promisePending = { status: "pending" };
4
- const isThenable = (value) => {
5
- const type = typeof value;
6
- return type === "object" && value !== null || type === "function" ? typeof value.then === "function" : false;
7
- };
8
- const createPromiseStateStore = (promise) => {
9
- const store = writable(promisePending);
10
- Promise.resolve(promise).then(
11
- (value) => store.set({ status: "fulfilled", value }),
12
- (reason) => store.set({ status: "rejected", reason })
13
- );
14
- return asReadable(store);
15
- };
16
- const promiseWeakMap = /* @__PURE__ */ new WeakMap();
17
- const promiseStateStore = (value) => {
18
- if (!isThenable(value)) {
19
- return readable({ status: "fulfilled", value });
20
- }
21
- let response = promiseWeakMap.get(value);
22
- if (!response) {
23
- response = createPromiseStateStore(value);
24
- promiseWeakMap.set(value, response);
25
- }
26
- return response;
27
- };
28
- const promiseStateStoreEqual = (a, b) => Object.is(a, b) || a.status === b.status && (a.status !== "fulfilled" || equal(a.value, b.value)) && (a.status !== "rejected" || equal(a.reason, b.reason));
29
- const promiseStoreToPromiseStateStore = (promiseStore$) => computed(() => promiseStateStore(promiseStore$())(), { equal: promiseStateStoreEqual });
30
- const promiseStateStoreToValueStore = (store$, initialValue, equal2) => derived(
31
- store$,
32
- {
33
- derive: (state, set) => {
34
- if (state.status === "fulfilled") {
35
- set(state.value);
36
- }
37
- },
38
- equal: equal2
39
- },
40
- initialValue
41
- );
42
- const promiseStoreToValueStore = (promiseStore$, initialValue, equal2) => promiseStateStoreToValueStore(promiseStoreToPromiseStateStore(promiseStore$), initialValue, equal2);
43
- const truthyValue = (value) => !!value;
44
- const promiseFromStore = (store, condition = truthyValue) => {
45
- let resolve;
46
- const promise = new Promise((r) => resolve = r);
47
- let unsubscribe = () => {
48
- storeUnsubscribe();
49
- unsubscribe = noop;
50
- };
51
- let storeUnsubscribe = noop;
52
- storeUnsubscribe = store.subscribe((value) => {
53
- if (condition(value)) {
54
- resolve(value);
55
- unsubscribe();
56
- }
57
- });
58
- if (unsubscribe === noop) {
59
- storeUnsubscribe();
60
- }
61
- return {
62
- promise,
63
- unsubscribe() {
64
- unsubscribe();
65
- }
66
- };
67
- };
68
- const promiseFromEvent = (element, event) => {
69
- let resolve;
70
- const promise = new Promise((r) => resolve = r);
71
- let unsubscribe = () => {
72
- element.removeEventListener(event, eventListener);
73
- unsubscribe = noop;
74
- };
75
- const eventListener = (event2) => {
76
- if (event2.target === element) {
77
- resolve(event2);
78
- unsubscribe();
79
- }
80
- };
81
- element.addEventListener(event, eventListener);
82
- return {
83
- promise,
84
- unsubscribe() {
85
- unsubscribe();
86
- }
87
- };
88
- };
89
- const promiseFromTimeout = (delay) => {
90
- let timeout;
91
- return {
92
- promise: new Promise((r) => {
93
- timeout = setTimeout(() => {
94
- timeout = void 0;
95
- r();
96
- }, delay);
97
- }),
98
- unsubscribe() {
99
- if (timeout) {
100
- clearTimeout(timeout);
101
- timeout = void 0;
102
- }
103
- }
104
- };
105
- };
106
- const promiseWithResolve = () => {
107
- let resolve;
108
- const promise = new Promise((r) => {
109
- resolve = r;
110
- });
111
- return { promise, resolve };
112
- };
113
- export {
114
- promiseStoreToValueStore as a,
115
- promiseFromEvent as b,
116
- promiseFromTimeout as c,
117
- promiseWithResolve as d,
118
- promiseFromStore as p
119
- };