@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,184 +0,0 @@
1
- import { computed, writable, readable } from "@amadeus-it-group/tansu";
2
- import { INVALID_VALUE } from "./types.js";
3
- import { g as createAttributesDirective } from "./directive-Bsreu2z1.js";
4
- import { j as typeString, e as typeFunction, b as typeBoolean, g as typeNumber, l as clamp, m as isNumber } from "./writables-DYGjj5T3.js";
5
- import { noop } from "./utils/func.js";
6
- import { writablesForProps, bindableProp, stateStores, true$ } from "./utils/stores.js";
7
- import { createWidgetFactory } from "./utils/widget.js";
8
- const defaultConfig = {
9
- rating: 0,
10
- tabindex: 0,
11
- maxRating: 10,
12
- disabled: false,
13
- readonly: false,
14
- resettable: true,
15
- ariaValueTextFn: (rating, maxRating) => `${rating} out of ${maxRating}`,
16
- onHover: noop,
17
- onLeave: noop,
18
- onRatingChange: noop,
19
- className: "",
20
- ariaLabel: "Rating",
21
- ariaLabelledBy: ""
22
- };
23
- function getRatingDefaultConfig() {
24
- return { ...defaultConfig };
25
- }
26
- const configValidator = {
27
- rating: typeNumber,
28
- tabindex: typeNumber,
29
- maxRating: { normalizeValue: (value) => isNumber(value) ? Math.max(0, value) : INVALID_VALUE },
30
- disabled: typeBoolean,
31
- readonly: typeBoolean,
32
- resettable: typeBoolean,
33
- ariaValueTextFn: typeFunction,
34
- onHover: typeFunction,
35
- onLeave: typeFunction,
36
- onRatingChange: typeFunction,
37
- className: typeString,
38
- ariaLabel: typeString,
39
- ariaLabelledBy: typeString
40
- };
41
- const createRating = createWidgetFactory(
42
- "rating",
43
- (config) => {
44
- const [
45
- {
46
- // dirty inputs that need adjustment:
47
- rating$: _dirtyRating$,
48
- tabindex$: _dirtyTabindex$,
49
- ariaValueTextFn$,
50
- onHover$,
51
- onLeave$,
52
- onRatingChange$,
53
- ...stateProps
54
- },
55
- patch
56
- ] = writablesForProps(defaultConfig, config, configValidator);
57
- const { ariaLabel$, ariaLabelledBy$, className$, disabled$, maxRating$, readonly$, resettable$ } = stateProps;
58
- const tabindex$ = computed(() => disabled$() ? -1 : _dirtyTabindex$());
59
- const rating$ = bindableProp(_dirtyRating$, onRatingChange$, (dirtyRating) => clamp(dirtyRating, maxRating$(), 0));
60
- const _hoveredRating$ = writable(0);
61
- const interactive$ = computed(() => !disabled$() && !readonly$());
62
- const visibleRating$ = computed(() => {
63
- const hoveredRating = _hoveredRating$();
64
- return hoveredRating !== 0 ? hoveredRating : rating$();
65
- });
66
- const ariaValueText$ = computed(() => ariaValueTextFn$()(visibleRating$(), maxRating$()));
67
- const stars$ = computed(() => {
68
- const visibleRating = visibleRating$();
69
- return Array.from({ length: maxRating$() }, (_v, i) => ({
70
- fill: Math.round(Math.max(Math.min(visibleRating - i, 1), 0) * 100),
71
- index: i
72
- }));
73
- });
74
- const widget = {
75
- ...stateStores({
76
- ariaValueText$,
77
- interactive$,
78
- rating$,
79
- stars$,
80
- tabindex$,
81
- visibleRating$,
82
- ...stateProps
83
- }),
84
- patch,
85
- directives: {
86
- containerDirective: createAttributesDirective(() => ({
87
- events: {
88
- keydown: (event) => {
89
- if (interactive$()) {
90
- const { key } = event;
91
- switch (key) {
92
- case "ArrowLeft":
93
- case "ArrowDown":
94
- rating$.update((rating) => rating - 1);
95
- break;
96
- case "ArrowRight":
97
- case "ArrowUp":
98
- rating$.update((rating) => rating + 1);
99
- break;
100
- case "Home":
101
- case "PageDown":
102
- rating$.set(0);
103
- break;
104
- case "End":
105
- case "PageUp":
106
- rating$.set(maxRating$());
107
- break;
108
- default:
109
- return;
110
- }
111
- event.preventDefault();
112
- event.stopPropagation();
113
- }
114
- },
115
- mouseleave: () => {
116
- if (interactive$()) {
117
- widget.api.leave();
118
- }
119
- }
120
- },
121
- attributes: {
122
- role: readable("slider"),
123
- class: className$,
124
- "aria-valuemin": readable(0),
125
- tabindex: tabindex$,
126
- "aria-valuemax": maxRating$,
127
- "aria-valuenow": visibleRating$,
128
- "aria-valuetext": ariaValueText$,
129
- "aria-readonly": computed(() => readonly$() ? "true" : void 0),
130
- "aria-disabled": computed(() => disabled$() ? "true" : void 0),
131
- "aria-label": ariaLabel$,
132
- "aria-labelledby": computed(() => ariaLabelledBy$() || void 0)
133
- },
134
- classNames: {
135
- "au-rating": true$
136
- }
137
- })),
138
- starDirective: createAttributesDirective((starContext$) => {
139
- return {
140
- events: {
141
- mouseenter: () => {
142
- const index = starContext$().index + 1;
143
- if (interactive$() && index > 0 && index <= maxRating$()) {
144
- _hoveredRating$.set(index);
145
- onHover$()(index);
146
- }
147
- },
148
- click: () => {
149
- const index = starContext$().index + 1;
150
- if (interactive$() && index > 0 && index <= maxRating$()) {
151
- rating$.update((rating) => rating === index && resettable$() ? 0 : index);
152
- }
153
- }
154
- },
155
- styles: {
156
- cursor: computed(() => interactive$() ? "pointer" : "default")
157
- },
158
- classNames: {
159
- "au-rating-star": true$
160
- }
161
- };
162
- })
163
- },
164
- api: {
165
- setRating(index) {
166
- rating$.set(index);
167
- },
168
- setHoveredRating(index) {
169
- onHover$()(index);
170
- _hoveredRating$.set(index);
171
- },
172
- leave() {
173
- onLeave$()(visibleRating$());
174
- _hoveredRating$.set(0);
175
- }
176
- }
177
- };
178
- return widget;
179
- }
180
- );
181
- export {
182
- createRating as c,
183
- getRatingDefaultConfig as g
184
- };
@@ -1,183 +0,0 @@
1
- "use strict";
2
- const tansu = require("@amadeus-it-group/tansu");
3
- const types = require("./types.cjs");
4
- const utils_directive = require("./directive-DCaXmRe_.cjs");
5
- const utils_writables = require("./writables-Dt68gADJ.cjs");
6
- const utils_func = require("./utils/func.cjs");
7
- const utils_stores = require("./utils/stores.cjs");
8
- const utils_widget = require("./utils/widget.cjs");
9
- const defaultConfig = {
10
- rating: 0,
11
- tabindex: 0,
12
- maxRating: 10,
13
- disabled: false,
14
- readonly: false,
15
- resettable: true,
16
- ariaValueTextFn: (rating, maxRating) => `${rating} out of ${maxRating}`,
17
- onHover: utils_func.noop,
18
- onLeave: utils_func.noop,
19
- onRatingChange: utils_func.noop,
20
- className: "",
21
- ariaLabel: "Rating",
22
- ariaLabelledBy: ""
23
- };
24
- function getRatingDefaultConfig() {
25
- return { ...defaultConfig };
26
- }
27
- const configValidator = {
28
- rating: utils_writables.typeNumber,
29
- tabindex: utils_writables.typeNumber,
30
- maxRating: { normalizeValue: (value) => utils_writables.isNumber(value) ? Math.max(0, value) : types.INVALID_VALUE },
31
- disabled: utils_writables.typeBoolean,
32
- readonly: utils_writables.typeBoolean,
33
- resettable: utils_writables.typeBoolean,
34
- ariaValueTextFn: utils_writables.typeFunction,
35
- onHover: utils_writables.typeFunction,
36
- onLeave: utils_writables.typeFunction,
37
- onRatingChange: utils_writables.typeFunction,
38
- className: utils_writables.typeString,
39
- ariaLabel: utils_writables.typeString,
40
- ariaLabelledBy: utils_writables.typeString
41
- };
42
- const createRating = utils_widget.createWidgetFactory(
43
- "rating",
44
- (config) => {
45
- const [
46
- {
47
- // dirty inputs that need adjustment:
48
- rating$: _dirtyRating$,
49
- tabindex$: _dirtyTabindex$,
50
- ariaValueTextFn$,
51
- onHover$,
52
- onLeave$,
53
- onRatingChange$,
54
- ...stateProps
55
- },
56
- patch
57
- ] = utils_stores.writablesForProps(defaultConfig, config, configValidator);
58
- const { ariaLabel$, ariaLabelledBy$, className$, disabled$, maxRating$, readonly$, resettable$ } = stateProps;
59
- const tabindex$ = tansu.computed(() => disabled$() ? -1 : _dirtyTabindex$());
60
- const rating$ = utils_stores.bindableProp(_dirtyRating$, onRatingChange$, (dirtyRating) => utils_writables.clamp(dirtyRating, maxRating$(), 0));
61
- const _hoveredRating$ = tansu.writable(0);
62
- const interactive$ = tansu.computed(() => !disabled$() && !readonly$());
63
- const visibleRating$ = tansu.computed(() => {
64
- const hoveredRating = _hoveredRating$();
65
- return hoveredRating !== 0 ? hoveredRating : rating$();
66
- });
67
- const ariaValueText$ = tansu.computed(() => ariaValueTextFn$()(visibleRating$(), maxRating$()));
68
- const stars$ = tansu.computed(() => {
69
- const visibleRating = visibleRating$();
70
- return Array.from({ length: maxRating$() }, (_v, i) => ({
71
- fill: Math.round(Math.max(Math.min(visibleRating - i, 1), 0) * 100),
72
- index: i
73
- }));
74
- });
75
- const widget = {
76
- ...utils_stores.stateStores({
77
- ariaValueText$,
78
- interactive$,
79
- rating$,
80
- stars$,
81
- tabindex$,
82
- visibleRating$,
83
- ...stateProps
84
- }),
85
- patch,
86
- directives: {
87
- containerDirective: utils_directive.createAttributesDirective(() => ({
88
- events: {
89
- keydown: (event) => {
90
- if (interactive$()) {
91
- const { key } = event;
92
- switch (key) {
93
- case "ArrowLeft":
94
- case "ArrowDown":
95
- rating$.update((rating) => rating - 1);
96
- break;
97
- case "ArrowRight":
98
- case "ArrowUp":
99
- rating$.update((rating) => rating + 1);
100
- break;
101
- case "Home":
102
- case "PageDown":
103
- rating$.set(0);
104
- break;
105
- case "End":
106
- case "PageUp":
107
- rating$.set(maxRating$());
108
- break;
109
- default:
110
- return;
111
- }
112
- event.preventDefault();
113
- event.stopPropagation();
114
- }
115
- },
116
- mouseleave: () => {
117
- if (interactive$()) {
118
- widget.api.leave();
119
- }
120
- }
121
- },
122
- attributes: {
123
- role: tansu.readable("slider"),
124
- class: className$,
125
- "aria-valuemin": tansu.readable(0),
126
- tabindex: tabindex$,
127
- "aria-valuemax": maxRating$,
128
- "aria-valuenow": visibleRating$,
129
- "aria-valuetext": ariaValueText$,
130
- "aria-readonly": tansu.computed(() => readonly$() ? "true" : void 0),
131
- "aria-disabled": tansu.computed(() => disabled$() ? "true" : void 0),
132
- "aria-label": ariaLabel$,
133
- "aria-labelledby": tansu.computed(() => ariaLabelledBy$() || void 0)
134
- },
135
- classNames: {
136
- "au-rating": utils_stores.true$
137
- }
138
- })),
139
- starDirective: utils_directive.createAttributesDirective((starContext$) => {
140
- return {
141
- events: {
142
- mouseenter: () => {
143
- const index = starContext$().index + 1;
144
- if (interactive$() && index > 0 && index <= maxRating$()) {
145
- _hoveredRating$.set(index);
146
- onHover$()(index);
147
- }
148
- },
149
- click: () => {
150
- const index = starContext$().index + 1;
151
- if (interactive$() && index > 0 && index <= maxRating$()) {
152
- rating$.update((rating) => rating === index && resettable$() ? 0 : index);
153
- }
154
- }
155
- },
156
- styles: {
157
- cursor: tansu.computed(() => interactive$() ? "pointer" : "default")
158
- },
159
- classNames: {
160
- "au-rating-star": utils_stores.true$
161
- }
162
- };
163
- })
164
- },
165
- api: {
166
- setRating(index) {
167
- rating$.set(index);
168
- },
169
- setHoveredRating(index) {
170
- onHover$()(index);
171
- _hoveredRating$.set(index);
172
- },
173
- leave() {
174
- onLeave$()(visibleRating$());
175
- _hoveredRating$.set(0);
176
- }
177
- }
178
- };
179
- return widget;
180
- }
181
- );
182
- exports.createRating = createRating;
183
- exports.getRatingDefaultConfig = getRatingDefaultConfig;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- const utils_func = require("./utils/func.cjs");
3
- const internalRemoveScrollbars = () => {
4
- const scrollbarWidth = Math.abs(window.innerWidth - document.documentElement.clientWidth);
5
- const body = document.body;
6
- const bodyStyle = body.style;
7
- const { overflow, paddingRight } = bodyStyle;
8
- if (scrollbarWidth > 0) {
9
- const actualPadding = parseFloat(window.getComputedStyle(body).paddingRight);
10
- bodyStyle.paddingRight = `${actualPadding + scrollbarWidth}px`;
11
- }
12
- bodyStyle.overflow = "hidden";
13
- return () => {
14
- if (scrollbarWidth > 0) {
15
- bodyStyle.paddingRight = paddingRight;
16
- }
17
- bodyStyle.overflow = overflow;
18
- };
19
- };
20
- let internalRevert = utils_func.noop;
21
- const removeScrollbars = () => {
22
- internalRevert();
23
- internalRevert = internalRemoveScrollbars();
24
- };
25
- const revertScrollbars = () => {
26
- internalRevert();
27
- internalRevert = utils_func.noop;
28
- };
29
- exports.removeScrollbars = removeScrollbars;
30
- exports.revertScrollbars = revertScrollbars;
@@ -1,31 +0,0 @@
1
- import { noop } from "./utils/func.js";
2
- const internalRemoveScrollbars = () => {
3
- const scrollbarWidth = Math.abs(window.innerWidth - document.documentElement.clientWidth);
4
- const body = document.body;
5
- const bodyStyle = body.style;
6
- const { overflow, paddingRight } = bodyStyle;
7
- if (scrollbarWidth > 0) {
8
- const actualPadding = parseFloat(window.getComputedStyle(body).paddingRight);
9
- bodyStyle.paddingRight = `${actualPadding + scrollbarWidth}px`;
10
- }
11
- bodyStyle.overflow = "hidden";
12
- return () => {
13
- if (scrollbarWidth > 0) {
14
- bodyStyle.paddingRight = paddingRight;
15
- }
16
- bodyStyle.overflow = overflow;
17
- };
18
- };
19
- let internalRevert = noop;
20
- const removeScrollbars = () => {
21
- internalRevert();
22
- internalRevert = internalRemoveScrollbars();
23
- };
24
- const revertScrollbars = () => {
25
- internalRevert();
26
- internalRevert = noop;
27
- };
28
- export {
29
- revertScrollbars as a,
30
- removeScrollbars as r
31
- };
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const tansu = require("@amadeus-it-group/tansu");
4
- const utils_stores = require("../utils/stores.cjs");
5
- const types = require("../types.cjs");
6
- const extendWidgetProps = (factory, extraPropsDefaults, extraPropsConfig, overrideDefaults) => {
7
- const extendedFactory = (propsConfig) => {
8
- const extraPropsWritables = utils_stores.writablesWithDefault(
9
- extraPropsDefaults,
10
- propsConfig,
11
- extraPropsConfig
12
- );
13
- const propsConfigConfig = propsConfig?.config;
14
- const config = utils_stores.isStore(propsConfigConfig) ? tansu.computed(() => ({ ...overrideDefaults, ...propsConfigConfig() })) : { ...overrideDefaults, ...propsConfigConfig ?? {} };
15
- const widget = factory({ props: propsConfig?.props, config });
16
- return {
17
- ...widget,
18
- ...utils_stores.stateStores({ ...widget.stores, ...extraPropsWritables }),
19
- patch: (storesValues) => tansu.batch(() => {
20
- let widgetProps;
21
- for (const [name, value] of Object.entries(storesValues ?? {})) {
22
- const extraPropsStore = extraPropsWritables[`${name}$`];
23
- if (extraPropsStore) {
24
- extraPropsStore.set(value);
25
- } else {
26
- if (!widgetProps) {
27
- widgetProps = {};
28
- }
29
- widgetProps[name] = value;
30
- }
31
- }
32
- if (widgetProps) {
33
- widget.patch(widgetProps);
34
- }
35
- })
36
- };
37
- };
38
- extendedFactory[types.FACTORY_WIDGET_NAME] = factory[types.FACTORY_WIDGET_NAME];
39
- return extendedFactory;
40
- };
41
- exports.extendWidgetProps = extendWidgetProps;
@@ -1,31 +0,0 @@
1
- import type { ConfigValidator, Widget, WidgetFactory, WidgetProps, WidgetState } from '../types';
2
- /**
3
- * Type extending the original Widget props and state with ExtraProps
4
- *
5
- * @template W - The base widget type to be extended.
6
- * @template ExtraProps - Additional properties to be added to the widget.
7
- * @template ExtraDirectives - Additional directives to be added to the widget. Defaults to an empty object.
8
- */
9
- export type ExtendWidgetProps<W extends Widget, ExtraProps extends object, ExtraDirectives extends object = object> = Widget<WidgetProps<W> & ExtraProps, WidgetState<W> & ExtraProps, W['api'], ExtendWidgetInterfaces<W['directives'], ExtraDirectives>>;
10
- /**
11
- * Combines two interface types into a single type.
12
- *
13
- * @template Interfaces - The base interface type.
14
- * @template ExtraInterfaces - The additional interface type to extend the base interface.
15
- * @typedef {Interfaces & ExtraInterfaces} ExtendWidgetInterfaces - The resulting type that includes properties from both Interfaces and ExtraInterfaces.
16
- */
17
- export type ExtendWidgetInterfaces<Interfaces, ExtraInterfaces> = Interfaces & ExtraInterfaces;
18
- /**
19
- * Method to extend the original widget with extra props with validator
20
- *
21
- * @template W - The type of the widget.
22
- * @template ExtraProps - The type of the additional properties.
23
- * @template ExtraDirectives - The type of the additional directives (default is an empty object).
24
- *
25
- * @param factory - original widget factory
26
- * @param extraPropsDefaults - object containing default value for each extra prop
27
- * @param extraPropsConfig - object verifying the type of each extra prop
28
- * @param overrideDefaults - object overriding some default props of the widget to extend
29
- * @returns widget factory with the extra props
30
- */
31
- export declare const extendWidgetProps: <W extends Widget, ExtraProps extends object, ExtraDirectives extends object = object>(factory: WidgetFactory<W>, extraPropsDefaults: ExtraProps, extraPropsConfig?: ConfigValidator<ExtraProps>, overrideDefaults?: Partial<WidgetState<W>>) => WidgetFactory<ExtendWidgetProps<W, ExtraProps, ExtraDirectives>>;
@@ -1,41 +0,0 @@
1
- import { computed, batch } from "@amadeus-it-group/tansu";
2
- import { writablesWithDefault, isStore, stateStores } from "../utils/stores.js";
3
- import { FACTORY_WIDGET_NAME } from "../types.js";
4
- const extendWidgetProps = (factory, extraPropsDefaults, extraPropsConfig, overrideDefaults) => {
5
- const extendedFactory = (propsConfig) => {
6
- const extraPropsWritables = writablesWithDefault(
7
- extraPropsDefaults,
8
- propsConfig,
9
- extraPropsConfig
10
- );
11
- const propsConfigConfig = propsConfig?.config;
12
- const config = isStore(propsConfigConfig) ? computed(() => ({ ...overrideDefaults, ...propsConfigConfig() })) : { ...overrideDefaults, ...propsConfigConfig ?? {} };
13
- const widget = factory({ props: propsConfig?.props, config });
14
- return {
15
- ...widget,
16
- ...stateStores({ ...widget.stores, ...extraPropsWritables }),
17
- patch: (storesValues) => batch(() => {
18
- let widgetProps;
19
- for (const [name, value] of Object.entries(storesValues ?? {})) {
20
- const extraPropsStore = extraPropsWritables[`${name}$`];
21
- if (extraPropsStore) {
22
- extraPropsStore.set(value);
23
- } else {
24
- if (!widgetProps) {
25
- widgetProps = {};
26
- }
27
- widgetProps[name] = value;
28
- }
29
- }
30
- if (widgetProps) {
31
- widget.patch(widgetProps);
32
- }
33
- })
34
- };
35
- };
36
- extendedFactory[FACTORY_WIDGET_NAME] = factory[FACTORY_WIDGET_NAME];
37
- return extendedFactory;
38
- };
39
- export {
40
- extendWidgetProps
41
- };
@@ -1,111 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const tansu = require("@amadeus-it-group/tansu");
4
- const dom = require("@floating-ui/dom");
5
- const utils_directive = require("../directive-DCaXmRe_.cjs");
6
- const promise = require("../promise-CxCD3NYv.cjs");
7
- const utils_stores = require("../utils/stores.cjs");
8
- const defaultConfig = {
9
- computePositionOptions: {},
10
- autoUpdateOptions: {},
11
- arrowOptions: {}
12
- };
13
- const createFloatingUI = (propsConfig) => {
14
- const [
15
- { autoUpdateOptions$, computePositionOptions$: computePositionInputOptions$, arrowOptions$: arrowInputOptions$ },
16
- patch
17
- ] = utils_stores.writablesForProps(defaultConfig, propsConfig);
18
- const { directive: floatingDirective, element$: floatingElement$ } = utils_directive.createBrowserStoreDirective();
19
- const { directive: referenceDirective, element$: referenceElement$ } = utils_directive.createBrowserStoreDirective();
20
- const { directive: arrowDirective, element$: arrowElement$ } = utils_directive.createBrowserStoreDirective();
21
- const arrowOptions$ = tansu.computed(() => {
22
- const arrowElement = arrowElement$();
23
- if (!arrowElement) {
24
- return null;
25
- }
26
- const arrowInputOptions = arrowInputOptions$();
27
- return typeof arrowInputOptions === "function" ? (state) => ({ ...arrowInputOptions(state), element: arrowElement }) : { ...arrowInputOptions, element: arrowElement };
28
- });
29
- const computePositionOptions$ = tansu.computed(() => {
30
- let options = computePositionInputOptions$();
31
- const arrowOptions = arrowOptions$();
32
- if (arrowOptions) {
33
- options = {
34
- ...options,
35
- middleware: [...options.middleware ?? [], dom.arrow(arrowOptions)]
36
- };
37
- }
38
- return options;
39
- });
40
- const promisePosition$ = tansu.derived(
41
- [floatingElement$, referenceElement$, computePositionOptions$, autoUpdateOptions$],
42
- ([floatingElement, referenceElement, computePositionOptions, autoUpdateOptions], set) => {
43
- if (floatingElement && referenceElement) {
44
- const clean = dom.autoUpdate(
45
- referenceElement,
46
- floatingElement,
47
- () => {
48
- set(dom.computePosition(referenceElement, floatingElement, computePositionOptions));
49
- },
50
- autoUpdateOptions
51
- );
52
- return () => {
53
- set(null);
54
- clean();
55
- };
56
- }
57
- return void 0;
58
- },
59
- null
60
- );
61
- const position$ = promise.promiseStoreToValueStore(promisePosition$, null);
62
- const placement$ = tansu.computed(() => position$()?.placement);
63
- const middlewareData$ = tansu.computed(() => position$()?.middlewareData);
64
- const x$ = tansu.computed(() => position$()?.x);
65
- const y$ = tansu.computed(() => position$()?.y);
66
- const strategy$ = tansu.computed(() => position$()?.strategy);
67
- const arrowX$ = tansu.computed(() => middlewareData$()?.arrow?.x);
68
- const arrowY$ = tansu.computed(() => middlewareData$()?.arrow?.y);
69
- const floatingStyleApplyAction$ = tansu.computed(() => {
70
- const floatingElement = floatingElement$();
71
- if (floatingElement) {
72
- floatingElement.style.left = `${x$() ?? 0}px`;
73
- floatingElement.style.top = `${y$() ?? 0}px`;
74
- }
75
- });
76
- const arrowStyleApplyAction$ = tansu.computed(() => {
77
- const arrowElement = arrowElement$();
78
- if (arrowElement) {
79
- const arrowX = arrowX$();
80
- const arrowY = arrowY$();
81
- arrowElement.style.left = arrowX != null ? `${arrowX}px` : "";
82
- arrowElement.style.top = arrowY != null ? `${arrowY}px` : "";
83
- }
84
- });
85
- return {
86
- patch,
87
- ...utils_stores.stateStores({
88
- x$,
89
- y$,
90
- strategy$,
91
- placement$,
92
- middlewareData$
93
- }),
94
- directives: {
95
- /**
96
- * Directive to be used on the reference element from where the floating element will be positioned
97
- */
98
- referenceDirective,
99
- /**
100
- * Directive to be used on the floating element
101
- */
102
- floatingDirective: utils_directive.mergeDirectives(floatingDirective, utils_directive.directiveSubscribe(floatingStyleApplyAction$)),
103
- /**
104
- * Directive to be used on the arrow element, if any
105
- */
106
- arrowDirective: utils_directive.mergeDirectives(arrowDirective, utils_directive.directiveSubscribe(arrowStyleApplyAction$))
107
- },
108
- api: {}
109
- };
110
- };
111
- exports.createFloatingUI = createFloatingUI;