@design-factory/angular 21.0.4 → 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,328 @@
1
+ "use strict";
2
+ const tansu = require("@amadeus-it-group/tansu");
3
+ const services_focusElement = require("./services/focusElement.cjs");
4
+ const services_pointerdownPosition = require("./services/pointerdownPosition.cjs");
5
+ const services_portal = require("./services/portal.cjs");
6
+ const services_siblingsInert = require("./services/siblingsInert.cjs");
7
+ const services_transitions_baseTransitions = require("./services/transitions/baseTransitions.cjs");
8
+ const utils_directive = require("./directive-DCaXmRe_.cjs");
9
+ const utils_func = require("./utils/func.cjs");
10
+ const scrollbars = require("./scrollbars-CT87iv_6.cjs");
11
+ const utils_stores = require("./utils/stores.cjs");
12
+ const utils_widget = require("./utils/widget.cjs");
13
+ const utils_writables = require("./writables-Dt68gADJ.cjs");
14
+ const textDirection = require("./textDirection-zqcZ5-eK.cjs");
15
+ function getDrawerDefaultConfig() {
16
+ return {
17
+ ...defaultDrawerConfig
18
+ };
19
+ }
20
+ const defaultDrawerConfig = {
21
+ animated: true,
22
+ ariaDescribedBy: "",
23
+ ariaLabelledBy: "",
24
+ backdropClass: "",
25
+ backdropTransition: utils_func.noop,
26
+ className: "",
27
+ visible: false,
28
+ container: typeof window !== "undefined" ? document.body : null,
29
+ transition: utils_func.noop,
30
+ verticalTransition: utils_func.noop,
31
+ onHidden: utils_func.noop,
32
+ onShown: utils_func.noop,
33
+ onSizeChange: utils_func.noop,
34
+ onVisibleChange: utils_func.noop,
35
+ onMinimizedChange: utils_func.noop,
36
+ onMaximizedChange: utils_func.noop,
37
+ onResizingChange: utils_func.noop,
38
+ resizable: false,
39
+ backdrop: true,
40
+ bodyScroll: false,
41
+ size: null,
42
+ focusOnInit: true,
43
+ configuration: "overlay",
44
+ position: "inline-start"
45
+ };
46
+ const configValidator = {
47
+ animated: utils_writables.typeBoolean,
48
+ ariaDescribedBy: utils_writables.typeString,
49
+ ariaLabelledBy: utils_writables.typeString,
50
+ backdropClass: utils_writables.typeString,
51
+ backdropTransition: utils_writables.typeFunction,
52
+ className: utils_writables.typeString,
53
+ visible: utils_writables.typeBoolean,
54
+ transition: utils_writables.typeFunction,
55
+ verticalTransition: utils_writables.typeFunction,
56
+ container: utils_writables.typeHTMLElementOrNull,
57
+ onHidden: utils_writables.typeFunction,
58
+ onShown: utils_writables.typeFunction,
59
+ onSizeChange: utils_writables.typeFunction,
60
+ onVisibleChange: utils_writables.typeFunction,
61
+ onMinimizedChange: utils_writables.typeFunction,
62
+ onMaximizedChange: utils_writables.typeFunction,
63
+ onResizingChange: utils_writables.typeFunction,
64
+ resizable: utils_writables.typeBoolean,
65
+ backdrop: utils_writables.typeBoolean,
66
+ bodyScroll: utils_writables.typeBoolean,
67
+ size: utils_writables.typeNumberOrNull,
68
+ focusOnInit: utils_writables.typeBoolean,
69
+ configuration: utils_writables.createTypeEnum(["inline", "overlay"]),
70
+ position: utils_writables.createTypeEnum(["inline-start", "inline-end", "block-start", "block-end"])
71
+ };
72
+ const createDrawer = utils_widget.createWidgetFactory(
73
+ "drawer",
74
+ (config) => {
75
+ const [
76
+ {
77
+ backdrop$: _backdrop$,
78
+ backdropTransition$,
79
+ backdropClass$,
80
+ bodyScroll$: _bodyScroll$,
81
+ transition$,
82
+ verticalTransition$,
83
+ visible$: requestedVisible$,
84
+ container$: _container$,
85
+ className$,
86
+ size$: _dirtySize$,
87
+ animated$,
88
+ ariaDescribedBy$,
89
+ ariaLabelledBy$,
90
+ onHidden$,
91
+ onShown$,
92
+ onSizeChange$,
93
+ onVisibleChange$,
94
+ onMinimizedChange$,
95
+ onMaximizedChange$,
96
+ onResizingChange$,
97
+ focusOnInit$,
98
+ configuration$,
99
+ position$,
100
+ ...stateProps
101
+ },
102
+ patch
103
+ ] = utils_stores.writablesForProps(defaultDrawerConfig, config, configValidator);
104
+ const inline$ = tansu.computed(() => configuration$() === "inline");
105
+ const backdrop$ = tansu.computed(() => inline$() ? false : _backdrop$());
106
+ const bodyScroll$ = tansu.computed(() => inline$() ? true : _bodyScroll$());
107
+ const container$ = tansu.computed(() => inline$() ? null : _container$());
108
+ const size$ = utils_stores.bindableProp(_dirtySize$, onSizeChange$, (value) => value ? Math.round(value) : value);
109
+ const isVertical$ = tansu.computed(() => {
110
+ const position = position$();
111
+ return position === "block-start" || position === "block-end";
112
+ });
113
+ const combinedClass$ = tansu.computed(() => `df-${position$()} ${className$()}`);
114
+ const transition = services_transitions_baseTransitions.createTransition({
115
+ props: {
116
+ animated: animated$,
117
+ animatedOnInit: animated$,
118
+ transition: tansu.asWritable(tansu.computed(() => isVertical$() ? verticalTransition$() : transition$())),
119
+ visible: requestedVisible$,
120
+ onVisibleChange: onVisibleChange$,
121
+ onHidden: onHidden$,
122
+ onShown: onShown$
123
+ }
124
+ });
125
+ const drawerPortalDirective = utils_directive.bindDirective(
126
+ services_portal.portal,
127
+ tansu.computed(() => ({ container: container$() }))
128
+ );
129
+ const { directive: drawerElementDirective, element$: drawerElement$ } = utils_directive.createBrowserStoreDirective();
130
+ const drawerAttributeDirective = utils_directive.mergeDirectives(
131
+ drawerElementDirective,
132
+ utils_directive.createAttributesDirective(() => ({
133
+ attributes: {
134
+ class: combinedClass$,
135
+ role: tansu.computed(() => inline$() ? "complementary" : "dialog"),
136
+ "aria-describedby": tansu.computed(() => ariaDescribedBy$() || void 0),
137
+ "aria-labelledby": tansu.computed(() => ariaLabelledBy$() || void 0),
138
+ "aria-modal": tansu.computed(() => inline$() ? void 0 : "true"),
139
+ tabIndex: tansu.readable("-1")
140
+ },
141
+ styles: {
142
+ position: tansu.computed(() => {
143
+ if (inline$()) {
144
+ return "relative";
145
+ }
146
+ const container = container$();
147
+ return container && utils_directive.isBrowserHTMLElement(container) && container !== document.body ? "relative" : "fixed";
148
+ }),
149
+ outline: tansu.readable("none")
150
+ },
151
+ events: {
152
+ keydown: (e) => {
153
+ if (e.key === "Escape") {
154
+ void transition.api.hide();
155
+ }
156
+ }
157
+ }
158
+ }))
159
+ );
160
+ const backdropTransition = services_transitions_baseTransitions.createTransition({
161
+ props: {
162
+ animated: animated$,
163
+ transition: backdropTransition$
164
+ }
165
+ });
166
+ const backdropPortalDirective = utils_directive.bindDirective(
167
+ services_portal.portal,
168
+ tansu.computed(() => {
169
+ const container = container$();
170
+ const element = container ? transition.stores.element$() : void 0;
171
+ return {
172
+ container,
173
+ insertBefore: element?.parentElement === container ? element : void 0
174
+ };
175
+ })
176
+ );
177
+ const backdropHidden$ = tansu.computed(() => {
178
+ if (!bodyScroll$()) {
179
+ if (hidden$()) {
180
+ scrollbars.revertScrollbars();
181
+ } else {
182
+ scrollbars.removeScrollbars();
183
+ }
184
+ }
185
+ return !backdrop$() || hidden$();
186
+ });
187
+ const backdropAttributeDirective = utils_directive.createAttributesDirective(() => ({
188
+ attributes: {
189
+ class: backdropClass$,
190
+ "data-agnos-ignore-inert": utils_stores.true$
191
+ },
192
+ events: {
193
+ click: () => void transition.api.hide()
194
+ }
195
+ }));
196
+ const direction$ = tansu.computed(() => {
197
+ const position = position$();
198
+ return position === "inline-start" || position === "block-start" ? 1 : -1;
199
+ });
200
+ const isMinimized$ = tansu.writable(void 0);
201
+ const isMaximized$ = tansu.writable(void 0);
202
+ function setSize(size) {
203
+ const drawerElement = drawerElement$();
204
+ const isVertical = isVertical$();
205
+ size = Math.round(Math.max(0, size));
206
+ drawerElement.style[isVertical ? "height" : "width"] = `${size}px`;
207
+ const elementSize = Math.round(drawerElement[isVertical ? "offsetHeight" : "offsetWidth"]);
208
+ size$.set(elementSize);
209
+ isMinimized$.set(size != null && (size < elementSize || size === 0));
210
+ isMaximized$.set(!!size && size > elementSize);
211
+ return elementSize;
212
+ }
213
+ const splitterDirective = utils_directive.mergeDirectives(
214
+ services_pointerdownPosition.createPointerdownPositionDirective((event) => {
215
+ const drawerElement = drawerElement$();
216
+ const isVertical = isVertical$();
217
+ const documentDirection = textDirection.getTextDirection(drawerElement) === "ltr" ? 1 : -1;
218
+ const directionFactor = isVertical ? 1 : documentDirection;
219
+ const startSize = drawerElement[isVertical ? "offsetHeight" : "offsetWidth"];
220
+ const clientXorY = isVertical ? "clientY" : "clientX";
221
+ const startPos = event[clientXorY];
222
+ const direction = direction$();
223
+ let isResizing = false;
224
+ return {
225
+ onMove(event2) {
226
+ setSize(startSize + directionFactor * direction * (event2[clientXorY] - startPos));
227
+ if (!isResizing) {
228
+ isResizing = true;
229
+ onResizingChange$()(true);
230
+ }
231
+ },
232
+ onEnd() {
233
+ drawerElement.style[isVertical ? "height" : "width"] = "";
234
+ if (isResizing) {
235
+ onResizingChange$()(false);
236
+ isResizing = false;
237
+ }
238
+ }
239
+ };
240
+ }),
241
+ utils_directive.createAttributesDirective(() => ({
242
+ events: {
243
+ keydown: (e) => {
244
+ const { key } = e;
245
+ const size = size$() || drawerElement$()?.[isVertical$() ? "offsetHeight" : "offsetWidth"];
246
+ if (size != null) {
247
+ switch (key) {
248
+ case "ArrowLeft":
249
+ case "ArrowDown":
250
+ onResizingChange$()(true);
251
+ setSize(size - 10);
252
+ onResizingChange$()(false);
253
+ break;
254
+ case "ArrowRight":
255
+ case "ArrowUp":
256
+ onResizingChange$()(true);
257
+ setSize(size + 10);
258
+ onResizingChange$()(false);
259
+ break;
260
+ }
261
+ }
262
+ }
263
+ }
264
+ }))
265
+ );
266
+ const visible$ = transition.stores.visible$;
267
+ const transitioning$ = tansu.computed(
268
+ () => transition.stores.transitioning$() || backdropTransition.stores.transitioning$()
269
+ );
270
+ const hidden$ = tansu.computed(() => !transitioning$() && !visible$());
271
+ const minSizeAction$ = tansu.computed(() => {
272
+ const isMinimized = isMinimized$();
273
+ if (isMinimized != null) {
274
+ tansu.untrack(() => onMinimizedChange$()(isMinimized));
275
+ }
276
+ });
277
+ const maxSizeAction$ = tansu.computed(() => {
278
+ const isMaximized = isMaximized$();
279
+ if (isMaximized != null) {
280
+ tansu.untrack(() => onMaximizedChange$()(isMaximized));
281
+ }
282
+ });
283
+ const action$ = tansu.computed(() => {
284
+ minSizeAction$();
285
+ maxSizeAction$();
286
+ });
287
+ const widget = {
288
+ ...utils_stores.stateStores({
289
+ ...stateProps,
290
+ backdropClass$,
291
+ className$,
292
+ position$,
293
+ container$,
294
+ size$,
295
+ visible$,
296
+ backdropHidden$,
297
+ hidden$,
298
+ isVertical$,
299
+ configuration$
300
+ }),
301
+ patch,
302
+ api: {
303
+ open: transition.api.show,
304
+ close: transition.api.hide
305
+ },
306
+ directives: {
307
+ drawerPortalDirective,
308
+ drawerDirective: utils_directive.mergeDirectives(
309
+ utils_directive.directiveSubscribe(action$),
310
+ drawerAttributeDirective,
311
+ utils_directive.bindDirective(
312
+ services_siblingsInert.siblingsInert,
313
+ tansu.computed(() => !bodyScroll$())
314
+ ),
315
+ // This directive must come after the attribute directive, to ensure that all the classes and attributes are applied for the transition
316
+ transition.directives.directive,
317
+ utils_directive.conditionalDirective(services_focusElement.focusElement, focusOnInit$)
318
+ ),
319
+ backdropPortalDirective,
320
+ backdropDirective: utils_directive.mergeDirectives(backdropTransition.directives.directive, backdropAttributeDirective),
321
+ splitterDirective
322
+ }
323
+ };
324
+ return widget;
325
+ }
326
+ );
327
+ exports.createDrawer = createDrawer;
328
+ exports.getDrawerDefaultConfig = getDrawerDefaultConfig;
@@ -0,0 +1,329 @@
1
+ import { computed, asWritable, readable, writable, untrack } from "@amadeus-it-group/tansu";
2
+ import { focusElement } from "./services/focusElement.js";
3
+ import { createPointerdownPositionDirective } from "./services/pointerdownPosition.js";
4
+ import { portal } from "./services/portal.js";
5
+ import { siblingsInert } from "./services/siblingsInert.js";
6
+ import { createTransition } from "./services/transitions/baseTransitions.js";
7
+ import { b as bindDirective, i as createBrowserStoreDirective, s as mergeDirectives, g as createAttributesDirective, q as isBrowserHTMLElement, f as conditionalDirective, o as directiveSubscribe } from "./directive-Bsreu2z1.js";
8
+ import { noop } from "./utils/func.js";
9
+ import { a as revertScrollbars, r as removeScrollbars } from "./scrollbars-CcxSrnCx.js";
10
+ import { writablesForProps, bindableProp, stateStores, true$ } from "./utils/stores.js";
11
+ import { createWidgetFactory } from "./utils/widget.js";
12
+ import { b as typeBoolean, i as typeNumberOrNull, e as typeFunction, f as typeHTMLElementOrNull, j as typeString, c as createTypeEnum } from "./writables-DYGjj5T3.js";
13
+ import { g as getTextDirection } from "./textDirection-cNgt24LJ.js";
14
+ function getDrawerDefaultConfig() {
15
+ return {
16
+ ...defaultDrawerConfig
17
+ };
18
+ }
19
+ const defaultDrawerConfig = {
20
+ animated: true,
21
+ ariaDescribedBy: "",
22
+ ariaLabelledBy: "",
23
+ backdropClass: "",
24
+ backdropTransition: noop,
25
+ className: "",
26
+ visible: false,
27
+ container: typeof window !== "undefined" ? document.body : null,
28
+ transition: noop,
29
+ verticalTransition: noop,
30
+ onHidden: noop,
31
+ onShown: noop,
32
+ onSizeChange: noop,
33
+ onVisibleChange: noop,
34
+ onMinimizedChange: noop,
35
+ onMaximizedChange: noop,
36
+ onResizingChange: noop,
37
+ resizable: false,
38
+ backdrop: true,
39
+ bodyScroll: false,
40
+ size: null,
41
+ focusOnInit: true,
42
+ configuration: "overlay",
43
+ position: "inline-start"
44
+ };
45
+ const configValidator = {
46
+ animated: typeBoolean,
47
+ ariaDescribedBy: typeString,
48
+ ariaLabelledBy: typeString,
49
+ backdropClass: typeString,
50
+ backdropTransition: typeFunction,
51
+ className: typeString,
52
+ visible: typeBoolean,
53
+ transition: typeFunction,
54
+ verticalTransition: typeFunction,
55
+ container: typeHTMLElementOrNull,
56
+ onHidden: typeFunction,
57
+ onShown: typeFunction,
58
+ onSizeChange: typeFunction,
59
+ onVisibleChange: typeFunction,
60
+ onMinimizedChange: typeFunction,
61
+ onMaximizedChange: typeFunction,
62
+ onResizingChange: typeFunction,
63
+ resizable: typeBoolean,
64
+ backdrop: typeBoolean,
65
+ bodyScroll: typeBoolean,
66
+ size: typeNumberOrNull,
67
+ focusOnInit: typeBoolean,
68
+ configuration: createTypeEnum(["inline", "overlay"]),
69
+ position: createTypeEnum(["inline-start", "inline-end", "block-start", "block-end"])
70
+ };
71
+ const createDrawer = createWidgetFactory(
72
+ "drawer",
73
+ (config) => {
74
+ const [
75
+ {
76
+ backdrop$: _backdrop$,
77
+ backdropTransition$,
78
+ backdropClass$,
79
+ bodyScroll$: _bodyScroll$,
80
+ transition$,
81
+ verticalTransition$,
82
+ visible$: requestedVisible$,
83
+ container$: _container$,
84
+ className$,
85
+ size$: _dirtySize$,
86
+ animated$,
87
+ ariaDescribedBy$,
88
+ ariaLabelledBy$,
89
+ onHidden$,
90
+ onShown$,
91
+ onSizeChange$,
92
+ onVisibleChange$,
93
+ onMinimizedChange$,
94
+ onMaximizedChange$,
95
+ onResizingChange$,
96
+ focusOnInit$,
97
+ configuration$,
98
+ position$,
99
+ ...stateProps
100
+ },
101
+ patch
102
+ ] = writablesForProps(defaultDrawerConfig, config, configValidator);
103
+ const inline$ = computed(() => configuration$() === "inline");
104
+ const backdrop$ = computed(() => inline$() ? false : _backdrop$());
105
+ const bodyScroll$ = computed(() => inline$() ? true : _bodyScroll$());
106
+ const container$ = computed(() => inline$() ? null : _container$());
107
+ const size$ = bindableProp(_dirtySize$, onSizeChange$, (value) => value ? Math.round(value) : value);
108
+ const isVertical$ = computed(() => {
109
+ const position = position$();
110
+ return position === "block-start" || position === "block-end";
111
+ });
112
+ const combinedClass$ = computed(() => `df-${position$()} ${className$()}`);
113
+ const transition = createTransition({
114
+ props: {
115
+ animated: animated$,
116
+ animatedOnInit: animated$,
117
+ transition: asWritable(computed(() => isVertical$() ? verticalTransition$() : transition$())),
118
+ visible: requestedVisible$,
119
+ onVisibleChange: onVisibleChange$,
120
+ onHidden: onHidden$,
121
+ onShown: onShown$
122
+ }
123
+ });
124
+ const drawerPortalDirective = bindDirective(
125
+ portal,
126
+ computed(() => ({ container: container$() }))
127
+ );
128
+ const { directive: drawerElementDirective, element$: drawerElement$ } = createBrowserStoreDirective();
129
+ const drawerAttributeDirective = mergeDirectives(
130
+ drawerElementDirective,
131
+ createAttributesDirective(() => ({
132
+ attributes: {
133
+ class: combinedClass$,
134
+ role: computed(() => inline$() ? "complementary" : "dialog"),
135
+ "aria-describedby": computed(() => ariaDescribedBy$() || void 0),
136
+ "aria-labelledby": computed(() => ariaLabelledBy$() || void 0),
137
+ "aria-modal": computed(() => inline$() ? void 0 : "true"),
138
+ tabIndex: readable("-1")
139
+ },
140
+ styles: {
141
+ position: computed(() => {
142
+ if (inline$()) {
143
+ return "relative";
144
+ }
145
+ const container = container$();
146
+ return container && isBrowserHTMLElement(container) && container !== document.body ? "relative" : "fixed";
147
+ }),
148
+ outline: readable("none")
149
+ },
150
+ events: {
151
+ keydown: (e) => {
152
+ if (e.key === "Escape") {
153
+ void transition.api.hide();
154
+ }
155
+ }
156
+ }
157
+ }))
158
+ );
159
+ const backdropTransition = createTransition({
160
+ props: {
161
+ animated: animated$,
162
+ transition: backdropTransition$
163
+ }
164
+ });
165
+ const backdropPortalDirective = bindDirective(
166
+ portal,
167
+ computed(() => {
168
+ const container = container$();
169
+ const element = container ? transition.stores.element$() : void 0;
170
+ return {
171
+ container,
172
+ insertBefore: element?.parentElement === container ? element : void 0
173
+ };
174
+ })
175
+ );
176
+ const backdropHidden$ = computed(() => {
177
+ if (!bodyScroll$()) {
178
+ if (hidden$()) {
179
+ revertScrollbars();
180
+ } else {
181
+ removeScrollbars();
182
+ }
183
+ }
184
+ return !backdrop$() || hidden$();
185
+ });
186
+ const backdropAttributeDirective = createAttributesDirective(() => ({
187
+ attributes: {
188
+ class: backdropClass$,
189
+ "data-agnos-ignore-inert": true$
190
+ },
191
+ events: {
192
+ click: () => void transition.api.hide()
193
+ }
194
+ }));
195
+ const direction$ = computed(() => {
196
+ const position = position$();
197
+ return position === "inline-start" || position === "block-start" ? 1 : -1;
198
+ });
199
+ const isMinimized$ = writable(void 0);
200
+ const isMaximized$ = writable(void 0);
201
+ function setSize(size) {
202
+ const drawerElement = drawerElement$();
203
+ const isVertical = isVertical$();
204
+ size = Math.round(Math.max(0, size));
205
+ drawerElement.style[isVertical ? "height" : "width"] = `${size}px`;
206
+ const elementSize = Math.round(drawerElement[isVertical ? "offsetHeight" : "offsetWidth"]);
207
+ size$.set(elementSize);
208
+ isMinimized$.set(size != null && (size < elementSize || size === 0));
209
+ isMaximized$.set(!!size && size > elementSize);
210
+ return elementSize;
211
+ }
212
+ const splitterDirective = mergeDirectives(
213
+ createPointerdownPositionDirective((event) => {
214
+ const drawerElement = drawerElement$();
215
+ const isVertical = isVertical$();
216
+ const documentDirection = getTextDirection(drawerElement) === "ltr" ? 1 : -1;
217
+ const directionFactor = isVertical ? 1 : documentDirection;
218
+ const startSize = drawerElement[isVertical ? "offsetHeight" : "offsetWidth"];
219
+ const clientXorY = isVertical ? "clientY" : "clientX";
220
+ const startPos = event[clientXorY];
221
+ const direction = direction$();
222
+ let isResizing = false;
223
+ return {
224
+ onMove(event2) {
225
+ setSize(startSize + directionFactor * direction * (event2[clientXorY] - startPos));
226
+ if (!isResizing) {
227
+ isResizing = true;
228
+ onResizingChange$()(true);
229
+ }
230
+ },
231
+ onEnd() {
232
+ drawerElement.style[isVertical ? "height" : "width"] = "";
233
+ if (isResizing) {
234
+ onResizingChange$()(false);
235
+ isResizing = false;
236
+ }
237
+ }
238
+ };
239
+ }),
240
+ createAttributesDirective(() => ({
241
+ events: {
242
+ keydown: (e) => {
243
+ const { key } = e;
244
+ const size = size$() || drawerElement$()?.[isVertical$() ? "offsetHeight" : "offsetWidth"];
245
+ if (size != null) {
246
+ switch (key) {
247
+ case "ArrowLeft":
248
+ case "ArrowDown":
249
+ onResizingChange$()(true);
250
+ setSize(size - 10);
251
+ onResizingChange$()(false);
252
+ break;
253
+ case "ArrowRight":
254
+ case "ArrowUp":
255
+ onResizingChange$()(true);
256
+ setSize(size + 10);
257
+ onResizingChange$()(false);
258
+ break;
259
+ }
260
+ }
261
+ }
262
+ }
263
+ }))
264
+ );
265
+ const visible$ = transition.stores.visible$;
266
+ const transitioning$ = computed(
267
+ () => transition.stores.transitioning$() || backdropTransition.stores.transitioning$()
268
+ );
269
+ const hidden$ = computed(() => !transitioning$() && !visible$());
270
+ const minSizeAction$ = computed(() => {
271
+ const isMinimized = isMinimized$();
272
+ if (isMinimized != null) {
273
+ untrack(() => onMinimizedChange$()(isMinimized));
274
+ }
275
+ });
276
+ const maxSizeAction$ = computed(() => {
277
+ const isMaximized = isMaximized$();
278
+ if (isMaximized != null) {
279
+ untrack(() => onMaximizedChange$()(isMaximized));
280
+ }
281
+ });
282
+ const action$ = computed(() => {
283
+ minSizeAction$();
284
+ maxSizeAction$();
285
+ });
286
+ const widget = {
287
+ ...stateStores({
288
+ ...stateProps,
289
+ backdropClass$,
290
+ className$,
291
+ position$,
292
+ container$,
293
+ size$,
294
+ visible$,
295
+ backdropHidden$,
296
+ hidden$,
297
+ isVertical$,
298
+ configuration$
299
+ }),
300
+ patch,
301
+ api: {
302
+ open: transition.api.show,
303
+ close: transition.api.hide
304
+ },
305
+ directives: {
306
+ drawerPortalDirective,
307
+ drawerDirective: mergeDirectives(
308
+ directiveSubscribe(action$),
309
+ drawerAttributeDirective,
310
+ bindDirective(
311
+ siblingsInert,
312
+ computed(() => !bodyScroll$())
313
+ ),
314
+ // This directive must come after the attribute directive, to ensure that all the classes and attributes are applied for the transition
315
+ transition.directives.directive,
316
+ conditionalDirective(focusElement, focusOnInit$)
317
+ ),
318
+ backdropPortalDirective,
319
+ backdropDirective: mergeDirectives(backdropTransition.directives.directive, backdropAttributeDirective),
320
+ splitterDirective
321
+ }
322
+ };
323
+ return widget;
324
+ }
325
+ );
326
+ export {
327
+ createDrawer as c,
328
+ getDrawerDefaultConfig as g
329
+ };