polpo 0.1.13 → 0.1.16

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 (204) hide show
  1. package/.turbo/cache/eslint/.cache_16wwsjl +1 -0
  2. package/.turbo/cache/eslint/.cache_rpznjo +1 -0
  3. package/.turbo/turbo-build$colon$code.log +49 -0
  4. package/.turbo/turbo-build$colon$css.log +2 -0
  5. package/.turbo/turbo-build.log +43 -0
  6. package/.turbo/turbo-lint.log +2 -0
  7. package/dist/components.cjs +1 -3655
  8. package/dist/components.css +2 -2173
  9. package/dist/components.js +1 -3576
  10. package/dist/helpers.cjs +1 -311
  11. package/dist/helpers.d.cts +4 -1
  12. package/dist/helpers.d.ts +4 -1
  13. package/dist/helpers.js +1 -276
  14. package/dist/hooks.cjs +1 -1065
  15. package/dist/hooks.js +1 -998
  16. package/dist/layouts.cjs +1 -146
  17. package/dist/layouts.css +2 -5
  18. package/dist/layouts.js +1 -119
  19. package/dist/types.cjs +1 -19
  20. package/dist/types.js +0 -1
  21. package/eslint.config.js +4 -0
  22. package/package.json +16 -11
  23. package/postcss.config.js +3 -0
  24. package/src/components/accordion/accordion-item.tsx +123 -0
  25. package/src/components/accordion/accordion.component.tsx +80 -0
  26. package/src/components/accordion/accordion.styles.css +41 -0
  27. package/src/components/accordion/index.ts +2 -0
  28. package/src/components/button/button.component.tsx +50 -0
  29. package/src/components/button/button.styles.css +317 -0
  30. package/src/components/button/index.ts +1 -0
  31. package/src/components/cards/flip-card/flip-card.component.tsx +66 -0
  32. package/src/components/cards/flip-card/flip-card.styles.css +50 -0
  33. package/src/components/cards/flip-card/index.ts +1 -0
  34. package/src/components/cards/hover-card/hover-card.component.tsx +76 -0
  35. package/src/components/cards/hover-card/hover-card.styles.css +13 -0
  36. package/src/components/cards/hover-card/index.ts +1 -0
  37. package/src/components/cards/index.ts +3 -0
  38. package/src/components/cards/slide-card/index.ts +1 -0
  39. package/src/components/cards/slide-card/slide-card.component.tsx +27 -0
  40. package/src/components/component.types.ts +31 -0
  41. package/src/components/cursor/cursor.component.tsx +49 -0
  42. package/src/components/cursor/cursor.styles.css +73 -0
  43. package/src/components/cursor/index.ts +1 -0
  44. package/src/components/form/checkbox/checkbox.component.tsx +95 -0
  45. package/src/components/form/checkbox/checkbox.styles.css +162 -0
  46. package/src/components/form/checkbox/index.ts +1 -0
  47. package/src/components/form/controller/controller.component.tsx +42 -0
  48. package/src/components/form/controller/index.ts +1 -0
  49. package/src/components/form/date-picker/date-picker.component.tsx +66 -0
  50. package/src/components/form/date-picker/index.ts +1 -0
  51. package/src/components/form/field/field.component.tsx +84 -0
  52. package/src/components/form/field/field.styles.css +98 -0
  53. package/src/components/form/field/field.types.ts +34 -0
  54. package/src/components/form/field/index.ts +2 -0
  55. package/src/components/form/form.types.ts +37 -0
  56. package/src/components/form/index.ts +14 -0
  57. package/src/components/form/input/index.ts +1 -0
  58. package/src/components/form/input/input.component.tsx +75 -0
  59. package/src/components/form/input-color/index.ts +1 -0
  60. package/src/components/form/input-color/input-color.component.tsx +170 -0
  61. package/src/components/form/input-color/input-color.styles.css +92 -0
  62. package/src/components/form/input-file/index.ts +1 -0
  63. package/src/components/form/input-file/input-file.component.tsx +221 -0
  64. package/src/components/form/input-file/input-file.styles.css +143 -0
  65. package/src/components/form/input-number/index.ts +1 -0
  66. package/src/components/form/input-number/input-number.component.tsx +144 -0
  67. package/src/components/form/input-password/index.ts +1 -0
  68. package/src/components/form/input-password/input-password.component.tsx +77 -0
  69. package/src/components/form/radio/index.ts +1 -0
  70. package/src/components/form/radio/radio.component.tsx +92 -0
  71. package/src/components/form/radio/radio.styles.css +117 -0
  72. package/src/components/form/select/index.ts +1 -0
  73. package/src/components/form/select/option.tsx +101 -0
  74. package/src/components/form/select/options.tsx +165 -0
  75. package/src/components/form/select/select.component.tsx +317 -0
  76. package/src/components/form/select/select.styles.css +115 -0
  77. package/src/components/form/select/select.types.ts +97 -0
  78. package/src/components/form/slider/index.ts +1 -0
  79. package/src/components/form/slider/slider.component.tsx +117 -0
  80. package/src/components/form/slider/slider.styles.css +94 -0
  81. package/src/components/form/switch/index.ts +1 -0
  82. package/src/components/form/switch/switch.component.tsx +166 -0
  83. package/src/components/form/switch/switch.styles.css +165 -0
  84. package/src/components/form/textarea/index.ts +1 -0
  85. package/src/components/form/textarea/textarea.component.tsx +80 -0
  86. package/src/components/form/textarea/textarea.styles.css +7 -0
  87. package/src/components/image/image.tsx +7 -0
  88. package/src/components/image/index.ts +1 -0
  89. package/src/components/index.ts +15 -0
  90. package/src/components/infinity-scroll/index.ts +1 -0
  91. package/src/components/infinity-scroll/infinity-scroll.component.tsx +51 -0
  92. package/src/components/infinity-scroll/infinity-scroll.styles.css +25 -0
  93. package/src/components/line/index.ts +1 -0
  94. package/src/components/line/line.component.tsx +77 -0
  95. package/src/components/line/line.styles.css +61 -0
  96. package/src/components/modals/action-modal/action-modal.component.tsx +150 -0
  97. package/src/components/modals/action-modal/action-modal.styles.css +115 -0
  98. package/src/components/modals/action-modal/index.ts +1 -0
  99. package/src/components/modals/aside-modal/aside-modal.component.tsx +63 -0
  100. package/src/components/modals/aside-modal/aside-modal.styles.css +86 -0
  101. package/src/components/modals/aside-modal/index.ts +1 -0
  102. package/src/components/modals/confirmation-modal/confirmation-modal.component.tsx +43 -0
  103. package/src/components/modals/confirmation-modal/confirmation-modal.styles.css +17 -0
  104. package/src/components/modals/confirmation-modal/index.ts +1 -0
  105. package/src/components/modals/index.ts +6 -0
  106. package/src/components/modals/menu/index.ts +1 -0
  107. package/src/components/modals/menu/menu.component.tsx +194 -0
  108. package/src/components/modals/menu/menu.styles.css +101 -0
  109. package/src/components/modals/modal/index.ts +2 -0
  110. package/src/components/modals/modal/modal.backdrop.tsx +67 -0
  111. package/src/components/modals/modal/modal.component.tsx +104 -0
  112. package/src/components/modals/modal/modal.styles.css +70 -0
  113. package/src/components/modals/portal/index.ts +1 -0
  114. package/src/components/modals/portal/portal.component.tsx +19 -0
  115. package/src/components/ripple/index.ts +1 -0
  116. package/src/components/ripple/ripple.component.tsx +70 -0
  117. package/src/components/ripple/ripple.styles.css +33 -0
  118. package/src/components/smart-table/index.ts +2 -0
  119. package/src/components/smart-table/smart-table.column.tsx +62 -0
  120. package/src/components/smart-table/smart-table.component.tsx +116 -0
  121. package/src/components/smart-table/smart-table.helpers.tsx +58 -0
  122. package/src/components/smart-table/smart-table.hooks.ts +27 -0
  123. package/src/components/smart-table/smart-table.row.tsx +28 -0
  124. package/src/components/smart-table/smart-table.styles.css +102 -0
  125. package/src/components/smart-table/smart-table.types.ts +42 -0
  126. package/src/components/tabs/index.ts +1 -0
  127. package/src/components/tabs/tabs-list.tsx +120 -0
  128. package/src/components/tabs/tabs.styles.css +164 -0
  129. package/src/components/tabs/tabs.tsx +119 -0
  130. package/src/components/tag/index.ts +1 -0
  131. package/src/components/tag/tag.component.tsx +34 -0
  132. package/src/components/tag/tag.styles.css +50 -0
  133. package/src/components/tooltips/click-to-copy/click-to-copy.component.tsx +41 -0
  134. package/src/components/tooltips/click-to-copy/index.ts +1 -0
  135. package/src/components/tooltips/index.ts +2 -0
  136. package/src/components/tooltips/tooltip/index.ts +1 -0
  137. package/src/components/tooltips/tooltip/tooltip.component.tsx +64 -0
  138. package/src/components/tooltips/tooltip/tooltip.styles.css +91 -0
  139. package/src/components/typography/index.ts +1 -0
  140. package/src/components/typography/typography.component.tsx +81 -0
  141. package/src/components/typography/typography.constants.ts +53 -0
  142. package/src/components/typography/typography.styles.css +122 -0
  143. package/src/helpers/cn.ts +6 -0
  144. package/src/helpers/format-bytes.ts +11 -0
  145. package/src/helpers/format-dates.ts +47 -0
  146. package/src/helpers/get-modal-position-relative-to-screen.ts +86 -0
  147. package/src/helpers/get-modal-position.ts +211 -0
  148. package/src/helpers/index.ts +6 -0
  149. package/src/helpers/text/index.ts +1 -0
  150. package/src/helpers/text/to-capitalize.ts +17 -0
  151. package/src/hooks/index.ts +30 -0
  152. package/src/hooks/use-async.ts +88 -0
  153. package/src/hooks/use-classnames.ts +13 -0
  154. package/src/hooks/use-click-outside.ts +32 -0
  155. package/src/hooks/use-constant.ts +3 -0
  156. package/src/hooks/use-cookie.ts +124 -0
  157. package/src/hooks/use-debounce-state.ts +13 -0
  158. package/src/hooks/use-debounce.ts +15 -0
  159. package/src/hooks/use-dimensions.ts +19 -0
  160. package/src/hooks/use-dom-container.ts +35 -0
  161. package/src/hooks/use-event-listener.ts +71 -0
  162. package/src/hooks/use-file-reader.ts +69 -0
  163. package/src/hooks/use-geolocation.ts +63 -0
  164. package/src/hooks/use-hover.ts +17 -0
  165. package/src/hooks/use-in-view.ts +18 -0
  166. package/src/hooks/use-input-handlers.ts +52 -0
  167. package/src/hooks/use-intersection-observer.ts +19 -0
  168. package/src/hooks/use-media-query.ts +25 -0
  169. package/src/hooks/use-modal-in-container.ts +85 -0
  170. package/src/hooks/use-modal-transition.ts +64 -0
  171. package/src/hooks/use-modal.ts +21 -0
  172. package/src/hooks/use-mouse-position.ts +64 -0
  173. package/src/hooks/use-online-status.ts +12 -0
  174. package/src/hooks/use-render-count.ts +11 -0
  175. package/src/hooks/use-resize-observer.ts +18 -0
  176. package/src/hooks/use-safe-dispatch.ts +22 -0
  177. package/src/hooks/use-scroll.ts +31 -0
  178. package/src/hooks/use-state-history.ts +22 -0
  179. package/src/hooks/use-toggle-values.ts +14 -0
  180. package/src/hooks/use-toggle.ts +11 -0
  181. package/src/hooks/use-viewport.ts +38 -0
  182. package/src/index.ts +5 -0
  183. package/src/layouts/flex/flex.component.tsx +75 -0
  184. package/src/layouts/flex/index.ts +1 -0
  185. package/src/layouts/grid/grid.component.tsx +89 -0
  186. package/src/layouts/grid/grid.styles.css +5 -0
  187. package/src/layouts/grid/index.ts +1 -0
  188. package/src/layouts/index.ts +2 -0
  189. package/src/types/generics.ts +68 -0
  190. package/src/types/index.ts +1 -0
  191. package/tsconfig.json +10 -0
  192. package/tsup.config.cjs +36 -0
  193. package/dist/components.cjs.map +0 -1
  194. package/dist/components.css.map +0 -1
  195. package/dist/components.js.map +0 -1
  196. package/dist/helpers.cjs.map +0 -1
  197. package/dist/helpers.js.map +0 -1
  198. package/dist/hooks.cjs.map +0 -1
  199. package/dist/hooks.js.map +0 -1
  200. package/dist/layouts.cjs.map +0 -1
  201. package/dist/layouts.css.map +0 -1
  202. package/dist/layouts.js.map +0 -1
  203. package/dist/types.cjs.map +0 -1
  204. package/dist/types.js.map +0 -1
package/dist/helpers.cjs CHANGED
@@ -1,312 +1,2 @@
1
1
  "use client";
2
- "use strict";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/helpers/index.ts
22
- var helpers_exports = {};
23
- __export(helpers_exports, {
24
- PositionContainer: () => PositionContainer,
25
- fixModalPosition: () => fixModalPosition,
26
- formatBytes: () => formatBytes,
27
- formatDate: () => formatDate,
28
- getModalPosition: () => getModalPosition,
29
- getModalPositionRelativeToContainer: () => getModalPositionRelativeToContainer,
30
- getModalPositionRelativeToScreen: () => getModalPositionRelativeToScreen,
31
- getOppositePosition: () => getOppositePosition,
32
- timeBetween: () => timeBetween,
33
- toCapitalize: () => toCapitalize
34
- });
35
- module.exports = __toCommonJS(helpers_exports);
36
-
37
- // src/helpers/format-bytes.ts
38
- var formatBytes = (bytes, decimals = 2) => {
39
- if (bytes === 0) return "0 Bytes";
40
- const k = 1e3;
41
- const dm = decimals < 0 ? 0 : decimals;
42
- const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
43
- const i = Math.floor(Math.log(bytes) / Math.log(k));
44
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
45
- };
46
-
47
- // src/helpers/format-dates.ts
48
- var MONTHS_SHORT = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
49
- var formatDate = (date) => {
50
- const parsedDate = new Date(date);
51
- if (Number.isNaN(parsedDate.getTime())) {
52
- return date;
53
- }
54
- return `${MONTHS_SHORT[parsedDate.getMonth()]} ${parsedDate.getFullYear()}`;
55
- };
56
- var timeBetween = (date_start, date_end) => {
57
- const start = new Date(date_start);
58
- if (Number.isNaN(start.getTime())) {
59
- return "";
60
- }
61
- const end = Date.parse(date_end) ? new Date(date_end) : /* @__PURE__ */ new Date();
62
- const diffMs = Math.abs(end.getTime() - start.getTime());
63
- const minutes = Math.floor(diffMs / (1e3 * 60));
64
- const hours = Math.floor(diffMs / (1e3 * 60 * 60));
65
- const days = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
66
- const months = Math.floor(days / 30);
67
- const years = Math.floor(days / 365);
68
- if (years > 0) {
69
- return `${years} year${years > 1 ? "s" : ""}`;
70
- }
71
- if (months > 0) {
72
- return `${months} month${months > 1 ? "s" : ""}`;
73
- }
74
- if (days > 0) {
75
- return `${days} day${days > 1 ? "s" : ""}`;
76
- }
77
- if (hours > 0) {
78
- return `${hours} hour${hours > 1 ? "s" : ""}`;
79
- }
80
- return `${minutes} minute${minutes !== 1 ? "s" : ""}`;
81
- };
82
-
83
- // src/helpers/get-modal-position.ts
84
- var PositionContainer = /* @__PURE__ */ ((PositionContainer2) => {
85
- PositionContainer2["CENTER"] = "center";
86
- PositionContainer2["TOP"] = "top";
87
- PositionContainer2["TOP_LEFT"] = "top left";
88
- PositionContainer2["TOP_RIGHT"] = "top right";
89
- PositionContainer2["TOP_CENTER"] = "top center";
90
- PositionContainer2["LEFT"] = "left";
91
- PositionContainer2["LEFT_TOP"] = "left top";
92
- PositionContainer2["LEFT_BOTTOM"] = "left bottom";
93
- PositionContainer2["LEFT_CENTER"] = "left center";
94
- PositionContainer2["RIGHT"] = "right";
95
- PositionContainer2["RIGHT_TOP"] = "right top";
96
- PositionContainer2["RIGHT_BOTTOM"] = "right bottom";
97
- PositionContainer2["RIGHT_CENTER"] = "right center";
98
- PositionContainer2["BOTTOM"] = "bottom";
99
- PositionContainer2["BOTTOM_LEFT"] = "bottom left";
100
- PositionContainer2["BOTTOM_RIGHT"] = "bottom right";
101
- PositionContainer2["BOTTOM_CENTER"] = "bottom center";
102
- return PositionContainer2;
103
- })(PositionContainer || {});
104
- var getModalPosition = ({ c, m, offset, position }) => {
105
- let top = c.y + c.h + offset;
106
- let left = c.x - (m.w - c.w) * (50 / 100);
107
- switch (position) {
108
- case "top" /* TOP */:
109
- case "top center" /* TOP_CENTER */:
110
- top = c.y - m.h - offset;
111
- left = c.x - (m.w - c.w) / 2;
112
- break;
113
- case "top left" /* TOP_LEFT */:
114
- top = c.y - m.h - offset;
115
- left = c.x - m.w + c.w;
116
- break;
117
- case "top right" /* TOP_RIGHT */:
118
- top = c.y - m.h - offset;
119
- left = c.x;
120
- break;
121
- case "bottom" /* BOTTOM */:
122
- case "bottom center" /* BOTTOM_CENTER */:
123
- top = c.y + c.h + offset;
124
- left = c.x - (m.w - c.w) / 2;
125
- break;
126
- case "bottom left" /* BOTTOM_LEFT */:
127
- top = c.y + c.h + offset;
128
- left = c.x - m.w + c.w;
129
- break;
130
- case "bottom right" /* BOTTOM_RIGHT */:
131
- top = c.y + c.h + offset;
132
- left = c.x;
133
- break;
134
- case "left" /* LEFT */:
135
- case "left center" /* LEFT_CENTER */:
136
- top = c.y - (m.h - c.h) / 2;
137
- left = c.x - m.w - offset;
138
- break;
139
- case "left top" /* LEFT_TOP */:
140
- top = c.y - m.h + c.h;
141
- left = c.x - m.w - offset;
142
- break;
143
- case "left bottom" /* LEFT_BOTTOM */:
144
- top = c.y;
145
- left = c.x - m.w - offset;
146
- break;
147
- case "right" /* RIGHT */:
148
- case "right center" /* RIGHT_CENTER */:
149
- top = c.y - (m.h - c.h) / 2;
150
- left = c.x + c.w + offset;
151
- break;
152
- case "right top" /* RIGHT_TOP */:
153
- top = c.y - m.h + c.h;
154
- left = c.x + c.w + offset;
155
- break;
156
- case "right bottom" /* RIGHT_BOTTOM */:
157
- top = c.y;
158
- left = c.x + c.w + offset;
159
- break;
160
- }
161
- return {
162
- left: Math.round(left),
163
- top: Math.round(top)
164
- };
165
- };
166
- var getOppositePosition = ({ top, left }, position, windowOffset, m) => {
167
- const positions = position.split(" ");
168
- const newPosition = [];
169
- const rightOffset = left + m.w + windowOffset - window.innerWidth;
170
- const bottomOffset = top + m.h + windowOffset - window.innerHeight;
171
- for (const p of positions) {
172
- if (p === "top" /* TOP */ && top < windowOffset) {
173
- newPosition.push("bottom" /* BOTTOM */);
174
- } else if (p === "left" /* LEFT */ && left < windowOffset) {
175
- newPosition.push("right" /* RIGHT */);
176
- } else if (p === "bottom" /* BOTTOM */ && bottomOffset > 0) {
177
- newPosition.push("top" /* TOP */);
178
- } else if (p === "right" /* RIGHT */ && rightOffset > 0) {
179
- newPosition.push("left" /* LEFT */);
180
- } else {
181
- newPosition.push(p);
182
- }
183
- }
184
- return newPosition.join(" ");
185
- };
186
- var fixModalPosition = ({ top, left }, m, windowOffset) => {
187
- const rightOffset = left + m.w + windowOffset - window.innerWidth;
188
- const bottomOffset = top + m.h + windowOffset - window.innerHeight;
189
- left = rightOffset > 0 ? left - rightOffset : left;
190
- top = bottomOffset > 0 ? top - bottomOffset : top;
191
- left = left < windowOffset ? windowOffset : left;
192
- top = top < windowOffset ? windowOffset : top;
193
- return { top, left };
194
- };
195
- var getModalPositionRelativeToContainer = ({
196
- c,
197
- m,
198
- offset,
199
- windowOffset,
200
- position
201
- }) => {
202
- const params = { c, m, offset, position };
203
- let modalContainerStyle = getModalPosition(params);
204
- const oppositePosition = getOppositePosition(modalContainerStyle, position, windowOffset, m);
205
- if (oppositePosition !== position) {
206
- modalContainerStyle = getModalPosition({
207
- ...params,
208
- position: oppositePosition
209
- });
210
- }
211
- const fixedPosition = fixModalPosition(modalContainerStyle, m, windowOffset);
212
- return {
213
- left: `${fixedPosition.left}px`,
214
- top: `${fixedPosition.top}px`
215
- };
216
- };
217
-
218
- // src/helpers/get-modal-position-relative-to-screen.ts
219
- var getModalPositionRelativeToScreen = ({
220
- position,
221
- windowOffset
222
- }) => {
223
- switch (position) {
224
- case "center" /* CENTER */:
225
- return {
226
- top: "50%",
227
- left: "50%",
228
- transform: "translate(-50%, -50%)"
229
- };
230
- case "top" /* TOP */:
231
- case "top center" /* TOP_CENTER */:
232
- return {
233
- top: `${windowOffset}px`,
234
- left: "50%",
235
- transform: "translateX(-50%)"
236
- };
237
- case "top left" /* TOP_LEFT */:
238
- case "left top" /* LEFT_TOP */:
239
- return {
240
- top: `${windowOffset}px`,
241
- left: `${windowOffset}px`
242
- };
243
- case "top right" /* TOP_RIGHT */:
244
- case "right top" /* RIGHT_TOP */:
245
- return {
246
- top: `${windowOffset}px`,
247
- right: `${windowOffset}px`
248
- };
249
- case "bottom" /* BOTTOM */:
250
- case "bottom center" /* BOTTOM_CENTER */:
251
- return {
252
- bottom: `${windowOffset}px`,
253
- left: "50%",
254
- transform: "translateX(-50%)"
255
- };
256
- case "left bottom" /* LEFT_BOTTOM */:
257
- case "bottom left" /* BOTTOM_LEFT */:
258
- return {
259
- bottom: `${windowOffset}px`,
260
- left: `${windowOffset}px`
261
- };
262
- case "right bottom" /* RIGHT_BOTTOM */:
263
- case "bottom right" /* BOTTOM_RIGHT */:
264
- return {
265
- bottom: `${windowOffset}px`,
266
- right: `${windowOffset}px`
267
- };
268
- case "left" /* LEFT */:
269
- case "left center" /* LEFT_CENTER */:
270
- return {
271
- top: "50%",
272
- left: `${windowOffset}px`,
273
- transform: "translateY(-50%)"
274
- };
275
- case "right" /* RIGHT */:
276
- case "right center" /* RIGHT_CENTER */:
277
- return {
278
- top: "50%",
279
- right: `${windowOffset}px`,
280
- transform: "translateY(-50%)"
281
- };
282
- }
283
- return {
284
- top: "50%",
285
- left: "50%",
286
- transform: "translate(-50%, -50%)"
287
- };
288
- };
289
-
290
- // src/helpers/text/to-capitalize.ts
291
- var toCapitalize = (text, options = {}) => {
292
- const { separator = " ", variant = "each-word", join = separator } = options;
293
- if (variant === "first-word") {
294
- return text[0].toUpperCase() + text.slice(1);
295
- }
296
- const words = text.split(separator);
297
- return words.map((word) => word[0].toUpperCase() + word.slice(1)).join(join);
298
- };
299
- // Annotate the CommonJS export names for ESM import in node:
300
- 0 && (module.exports = {
301
- PositionContainer,
302
- fixModalPosition,
303
- formatBytes,
304
- formatDate,
305
- getModalPosition,
306
- getModalPositionRelativeToContainer,
307
- getModalPositionRelativeToScreen,
308
- getOppositePosition,
309
- timeBetween,
310
- toCapitalize
311
- });
312
- //# sourceMappingURL=helpers.cjs.map
2
+ "use strict";var P=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var R=(t,o)=>{for(var r in o)P(t,r,{get:o[r],enumerable:!0})},g=(t,o,r,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of E(o))!b.call(t,e)&&e!==r&&P(t,e,{get:()=>o[e],enumerable:!(a=m(o,e))||a.enumerable});return t};var C=t=>g(P({},"__esModule",{value:!0}),t);var I={};R(I,{PositionContainer:()=>h,cn:()=>_,fixModalPosition:()=>x,formatBytes:()=>B,formatDate:()=>G,getModalPosition:()=>u,getModalPositionRelativeToContainer:()=>F,getModalPositionRelativeToScreen:()=>H,getOppositePosition:()=>c,timeBetween:()=>$,toCapitalize:()=>N});module.exports=C(I);var O=require("clsx"),M=require("tailwind-merge"),_=(...t)=>(0,M.twMerge)((0,O.clsx)(t));var B=(t,o=2)=>{if(t===0)return"0 Bytes";let r=1e3,a=o<0?0:o,e=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],n=Math.floor(Math.log(t)/Math.log(r));return parseFloat((t/Math.pow(r,n)).toFixed(a))+" "+e[n]};var y=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],G=t=>{let o=new Date(t);return Number.isNaN(o.getTime())?t:`${y[o.getMonth()]} ${o.getFullYear()}`},$=(t,o)=>{let r=new Date(t);if(Number.isNaN(r.getTime()))return"";let a=Date.parse(o)?new Date(o):new Date,e=Math.abs(a.getTime()-r.getTime()),n=Math.floor(e/(1e3*60)),i=Math.floor(e/(1e3*60*60)),T=Math.floor(e/(1e3*60*60*24)),l=Math.floor(T/30),p=Math.floor(T/365);return p>0?`${p} year${p>1?"s":""}`:l>0?`${l} month${l>1?"s":""}`:T>0?`${T} day${T>1?"s":""}`:i>0?`${i} hour${i>1?"s":""}`:`${n} minute${n!==1?"s":""}`};var h=(s=>(s.CENTER="center",s.TOP="top",s.TOP_LEFT="top left",s.TOP_RIGHT="top right",s.TOP_CENTER="top center",s.LEFT="left",s.LEFT_TOP="left top",s.LEFT_BOTTOM="left bottom",s.LEFT_CENTER="left center",s.RIGHT="right",s.RIGHT_TOP="right top",s.RIGHT_BOTTOM="right bottom",s.RIGHT_CENTER="right center",s.BOTTOM="bottom",s.BOTTOM_LEFT="bottom left",s.BOTTOM_RIGHT="bottom right",s.BOTTOM_CENTER="bottom center",s))(h||{}),u=({c:t,m:o,offset:r,position:a})=>{let e=t.y+t.h+r,n=t.x-(o.w-t.w)*(50/100);switch(a){case"top":case"top center":e=t.y-o.h-r,n=t.x-(o.w-t.w)/2;break;case"top left":e=t.y-o.h-r,n=t.x-o.w+t.w;break;case"top right":e=t.y-o.h-r,n=t.x;break;case"bottom":case"bottom center":e=t.y+t.h+r,n=t.x-(o.w-t.w)/2;break;case"bottom left":e=t.y+t.h+r,n=t.x-o.w+t.w;break;case"bottom right":e=t.y+t.h+r,n=t.x;break;case"left":case"left center":e=t.y-(o.h-t.h)/2,n=t.x-o.w-r;break;case"left top":e=t.y-o.h+t.h,n=t.x-o.w-r;break;case"left bottom":e=t.y,n=t.x-o.w-r;break;case"right":case"right center":e=t.y-(o.h-t.h)/2,n=t.x+t.w+r;break;case"right top":e=t.y-o.h+t.h,n=t.x+t.w+r;break;case"right bottom":e=t.y,n=t.x+t.w+r;break}return{left:Math.round(n),top:Math.round(e)}},c=({top:t,left:o},r,a,e)=>{let n=r.split(" "),i=[],T=o+e.w+a-window.innerWidth,l=t+e.h+a-window.innerHeight;for(let p of n)p==="top"&&t<a?i.push("bottom"):p==="left"&&o<a?i.push("right"):p==="bottom"&&l>0?i.push("top"):p==="right"&&T>0?i.push("left"):i.push(p);return i.join(" ")},x=({top:t,left:o},r,a)=>{let e=o+r.w+a-window.innerWidth,n=t+r.h+a-window.innerHeight;return o=e>0?o-e:o,t=n>0?t-n:t,o=o<a?a:o,t=t<a?a:t,{top:t,left:o}},F=({c:t,m:o,offset:r,windowOffset:a,position:e})=>{let n={c:t,m:o,offset:r,position:e},i=u(n),T=c(i,e,a,o);T!==e&&(i=u({...n,position:T}));let l=x(i,o,a);return{left:`${l.left}px`,top:`${l.top}px`}};var H=({position:t,windowOffset:o})=>{switch(t){case"center":return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case"top":case"top center":return{top:`${o}px`,left:"50%",transform:"translateX(-50%)"};case"top left":case"left top":return{top:`${o}px`,left:`${o}px`};case"top right":case"right top":return{top:`${o}px`,right:`${o}px`};case"bottom":case"bottom center":return{bottom:`${o}px`,left:"50%",transform:"translateX(-50%)"};case"left bottom":case"bottom left":return{bottom:`${o}px`,left:`${o}px`};case"right bottom":case"bottom right":return{bottom:`${o}px`,right:`${o}px`};case"left":case"left center":return{top:"50%",left:`${o}px`,transform:"translateY(-50%)"};case"right":case"right center":return{top:"50%",right:`${o}px`,transform:"translateY(-50%)"}}return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}};var N=(t,o={})=>{let{separator:r=" ",variant:a="each-word",join:e=r}=o;return a==="first-word"?t[0].toUpperCase()+t.slice(1):t.split(r).map(i=>i[0].toUpperCase()+i.slice(1)).join(e)};0&&(module.exports={PositionContainer,cn,fixModalPosition,formatBytes,formatDate,getModalPosition,getModalPositionRelativeToContainer,getModalPositionRelativeToScreen,getOppositePosition,timeBetween,toCapitalize});
@@ -1,6 +1,9 @@
1
+ import { ClassValue } from 'clsx';
1
2
  import { P as PositionContainer } from './get-modal-position-C5jQsaGx.cjs';
2
3
  export { G as GetModalPositionParams, M as ModalPosition, a as PositionObject, f as fixModalPosition, g as getModalPosition, b as getModalPositionRelativeToContainer, c as getOppositePosition } from './get-modal-position-C5jQsaGx.cjs';
3
4
 
5
+ declare const cn: (...inputs: Array<ClassValue>) => string;
6
+
4
7
  declare const formatBytes: (bytes: number, decimals?: number) => string;
5
8
 
6
9
  declare const formatDate: (date: string) => string;
@@ -19,4 +22,4 @@ type ToCapitalizeOptions = Partial<{
19
22
  }>;
20
23
  declare const toCapitalize: (text: string, options?: ToCapitalizeOptions) => string;
21
24
 
22
- export { type GetModalPositionRelativeToScreenParams, PositionContainer, type ToCapitalizeOptions, formatBytes, formatDate, getModalPositionRelativeToScreen, timeBetween, toCapitalize };
25
+ export { type GetModalPositionRelativeToScreenParams, PositionContainer, type ToCapitalizeOptions, cn, formatBytes, formatDate, getModalPositionRelativeToScreen, timeBetween, toCapitalize };
package/dist/helpers.d.ts CHANGED
@@ -1,6 +1,9 @@
1
+ import { ClassValue } from 'clsx';
1
2
  import { P as PositionContainer } from './get-modal-position-C5jQsaGx.js';
2
3
  export { G as GetModalPositionParams, M as ModalPosition, a as PositionObject, f as fixModalPosition, g as getModalPosition, b as getModalPositionRelativeToContainer, c as getOppositePosition } from './get-modal-position-C5jQsaGx.js';
3
4
 
5
+ declare const cn: (...inputs: Array<ClassValue>) => string;
6
+
4
7
  declare const formatBytes: (bytes: number, decimals?: number) => string;
5
8
 
6
9
  declare const formatDate: (date: string) => string;
@@ -19,4 +22,4 @@ type ToCapitalizeOptions = Partial<{
19
22
  }>;
20
23
  declare const toCapitalize: (text: string, options?: ToCapitalizeOptions) => string;
21
24
 
22
- export { type GetModalPositionRelativeToScreenParams, PositionContainer, type ToCapitalizeOptions, formatBytes, formatDate, getModalPositionRelativeToScreen, timeBetween, toCapitalize };
25
+ export { type GetModalPositionRelativeToScreenParams, PositionContainer, type ToCapitalizeOptions, cn, formatBytes, formatDate, getModalPositionRelativeToScreen, timeBetween, toCapitalize };
package/dist/helpers.js CHANGED
@@ -1,277 +1,2 @@
1
1
  "use client";
2
-
3
- // src/helpers/format-bytes.ts
4
- var formatBytes = (bytes, decimals = 2) => {
5
- if (bytes === 0) return "0 Bytes";
6
- const k = 1e3;
7
- const dm = decimals < 0 ? 0 : decimals;
8
- const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
9
- const i = Math.floor(Math.log(bytes) / Math.log(k));
10
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
11
- };
12
-
13
- // src/helpers/format-dates.ts
14
- var MONTHS_SHORT = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
15
- var formatDate = (date) => {
16
- const parsedDate = new Date(date);
17
- if (Number.isNaN(parsedDate.getTime())) {
18
- return date;
19
- }
20
- return `${MONTHS_SHORT[parsedDate.getMonth()]} ${parsedDate.getFullYear()}`;
21
- };
22
- var timeBetween = (date_start, date_end) => {
23
- const start = new Date(date_start);
24
- if (Number.isNaN(start.getTime())) {
25
- return "";
26
- }
27
- const end = Date.parse(date_end) ? new Date(date_end) : /* @__PURE__ */ new Date();
28
- const diffMs = Math.abs(end.getTime() - start.getTime());
29
- const minutes = Math.floor(diffMs / (1e3 * 60));
30
- const hours = Math.floor(diffMs / (1e3 * 60 * 60));
31
- const days = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
32
- const months = Math.floor(days / 30);
33
- const years = Math.floor(days / 365);
34
- if (years > 0) {
35
- return `${years} year${years > 1 ? "s" : ""}`;
36
- }
37
- if (months > 0) {
38
- return `${months} month${months > 1 ? "s" : ""}`;
39
- }
40
- if (days > 0) {
41
- return `${days} day${days > 1 ? "s" : ""}`;
42
- }
43
- if (hours > 0) {
44
- return `${hours} hour${hours > 1 ? "s" : ""}`;
45
- }
46
- return `${minutes} minute${minutes !== 1 ? "s" : ""}`;
47
- };
48
-
49
- // src/helpers/get-modal-position.ts
50
- var PositionContainer = /* @__PURE__ */ ((PositionContainer2) => {
51
- PositionContainer2["CENTER"] = "center";
52
- PositionContainer2["TOP"] = "top";
53
- PositionContainer2["TOP_LEFT"] = "top left";
54
- PositionContainer2["TOP_RIGHT"] = "top right";
55
- PositionContainer2["TOP_CENTER"] = "top center";
56
- PositionContainer2["LEFT"] = "left";
57
- PositionContainer2["LEFT_TOP"] = "left top";
58
- PositionContainer2["LEFT_BOTTOM"] = "left bottom";
59
- PositionContainer2["LEFT_CENTER"] = "left center";
60
- PositionContainer2["RIGHT"] = "right";
61
- PositionContainer2["RIGHT_TOP"] = "right top";
62
- PositionContainer2["RIGHT_BOTTOM"] = "right bottom";
63
- PositionContainer2["RIGHT_CENTER"] = "right center";
64
- PositionContainer2["BOTTOM"] = "bottom";
65
- PositionContainer2["BOTTOM_LEFT"] = "bottom left";
66
- PositionContainer2["BOTTOM_RIGHT"] = "bottom right";
67
- PositionContainer2["BOTTOM_CENTER"] = "bottom center";
68
- return PositionContainer2;
69
- })(PositionContainer || {});
70
- var getModalPosition = ({ c, m, offset, position }) => {
71
- let top = c.y + c.h + offset;
72
- let left = c.x - (m.w - c.w) * (50 / 100);
73
- switch (position) {
74
- case "top" /* TOP */:
75
- case "top center" /* TOP_CENTER */:
76
- top = c.y - m.h - offset;
77
- left = c.x - (m.w - c.w) / 2;
78
- break;
79
- case "top left" /* TOP_LEFT */:
80
- top = c.y - m.h - offset;
81
- left = c.x - m.w + c.w;
82
- break;
83
- case "top right" /* TOP_RIGHT */:
84
- top = c.y - m.h - offset;
85
- left = c.x;
86
- break;
87
- case "bottom" /* BOTTOM */:
88
- case "bottom center" /* BOTTOM_CENTER */:
89
- top = c.y + c.h + offset;
90
- left = c.x - (m.w - c.w) / 2;
91
- break;
92
- case "bottom left" /* BOTTOM_LEFT */:
93
- top = c.y + c.h + offset;
94
- left = c.x - m.w + c.w;
95
- break;
96
- case "bottom right" /* BOTTOM_RIGHT */:
97
- top = c.y + c.h + offset;
98
- left = c.x;
99
- break;
100
- case "left" /* LEFT */:
101
- case "left center" /* LEFT_CENTER */:
102
- top = c.y - (m.h - c.h) / 2;
103
- left = c.x - m.w - offset;
104
- break;
105
- case "left top" /* LEFT_TOP */:
106
- top = c.y - m.h + c.h;
107
- left = c.x - m.w - offset;
108
- break;
109
- case "left bottom" /* LEFT_BOTTOM */:
110
- top = c.y;
111
- left = c.x - m.w - offset;
112
- break;
113
- case "right" /* RIGHT */:
114
- case "right center" /* RIGHT_CENTER */:
115
- top = c.y - (m.h - c.h) / 2;
116
- left = c.x + c.w + offset;
117
- break;
118
- case "right top" /* RIGHT_TOP */:
119
- top = c.y - m.h + c.h;
120
- left = c.x + c.w + offset;
121
- break;
122
- case "right bottom" /* RIGHT_BOTTOM */:
123
- top = c.y;
124
- left = c.x + c.w + offset;
125
- break;
126
- }
127
- return {
128
- left: Math.round(left),
129
- top: Math.round(top)
130
- };
131
- };
132
- var getOppositePosition = ({ top, left }, position, windowOffset, m) => {
133
- const positions = position.split(" ");
134
- const newPosition = [];
135
- const rightOffset = left + m.w + windowOffset - window.innerWidth;
136
- const bottomOffset = top + m.h + windowOffset - window.innerHeight;
137
- for (const p of positions) {
138
- if (p === "top" /* TOP */ && top < windowOffset) {
139
- newPosition.push("bottom" /* BOTTOM */);
140
- } else if (p === "left" /* LEFT */ && left < windowOffset) {
141
- newPosition.push("right" /* RIGHT */);
142
- } else if (p === "bottom" /* BOTTOM */ && bottomOffset > 0) {
143
- newPosition.push("top" /* TOP */);
144
- } else if (p === "right" /* RIGHT */ && rightOffset > 0) {
145
- newPosition.push("left" /* LEFT */);
146
- } else {
147
- newPosition.push(p);
148
- }
149
- }
150
- return newPosition.join(" ");
151
- };
152
- var fixModalPosition = ({ top, left }, m, windowOffset) => {
153
- const rightOffset = left + m.w + windowOffset - window.innerWidth;
154
- const bottomOffset = top + m.h + windowOffset - window.innerHeight;
155
- left = rightOffset > 0 ? left - rightOffset : left;
156
- top = bottomOffset > 0 ? top - bottomOffset : top;
157
- left = left < windowOffset ? windowOffset : left;
158
- top = top < windowOffset ? windowOffset : top;
159
- return { top, left };
160
- };
161
- var getModalPositionRelativeToContainer = ({
162
- c,
163
- m,
164
- offset,
165
- windowOffset,
166
- position
167
- }) => {
168
- const params = { c, m, offset, position };
169
- let modalContainerStyle = getModalPosition(params);
170
- const oppositePosition = getOppositePosition(modalContainerStyle, position, windowOffset, m);
171
- if (oppositePosition !== position) {
172
- modalContainerStyle = getModalPosition({
173
- ...params,
174
- position: oppositePosition
175
- });
176
- }
177
- const fixedPosition = fixModalPosition(modalContainerStyle, m, windowOffset);
178
- return {
179
- left: `${fixedPosition.left}px`,
180
- top: `${fixedPosition.top}px`
181
- };
182
- };
183
-
184
- // src/helpers/get-modal-position-relative-to-screen.ts
185
- var getModalPositionRelativeToScreen = ({
186
- position,
187
- windowOffset
188
- }) => {
189
- switch (position) {
190
- case "center" /* CENTER */:
191
- return {
192
- top: "50%",
193
- left: "50%",
194
- transform: "translate(-50%, -50%)"
195
- };
196
- case "top" /* TOP */:
197
- case "top center" /* TOP_CENTER */:
198
- return {
199
- top: `${windowOffset}px`,
200
- left: "50%",
201
- transform: "translateX(-50%)"
202
- };
203
- case "top left" /* TOP_LEFT */:
204
- case "left top" /* LEFT_TOP */:
205
- return {
206
- top: `${windowOffset}px`,
207
- left: `${windowOffset}px`
208
- };
209
- case "top right" /* TOP_RIGHT */:
210
- case "right top" /* RIGHT_TOP */:
211
- return {
212
- top: `${windowOffset}px`,
213
- right: `${windowOffset}px`
214
- };
215
- case "bottom" /* BOTTOM */:
216
- case "bottom center" /* BOTTOM_CENTER */:
217
- return {
218
- bottom: `${windowOffset}px`,
219
- left: "50%",
220
- transform: "translateX(-50%)"
221
- };
222
- case "left bottom" /* LEFT_BOTTOM */:
223
- case "bottom left" /* BOTTOM_LEFT */:
224
- return {
225
- bottom: `${windowOffset}px`,
226
- left: `${windowOffset}px`
227
- };
228
- case "right bottom" /* RIGHT_BOTTOM */:
229
- case "bottom right" /* BOTTOM_RIGHT */:
230
- return {
231
- bottom: `${windowOffset}px`,
232
- right: `${windowOffset}px`
233
- };
234
- case "left" /* LEFT */:
235
- case "left center" /* LEFT_CENTER */:
236
- return {
237
- top: "50%",
238
- left: `${windowOffset}px`,
239
- transform: "translateY(-50%)"
240
- };
241
- case "right" /* RIGHT */:
242
- case "right center" /* RIGHT_CENTER */:
243
- return {
244
- top: "50%",
245
- right: `${windowOffset}px`,
246
- transform: "translateY(-50%)"
247
- };
248
- }
249
- return {
250
- top: "50%",
251
- left: "50%",
252
- transform: "translate(-50%, -50%)"
253
- };
254
- };
255
-
256
- // src/helpers/text/to-capitalize.ts
257
- var toCapitalize = (text, options = {}) => {
258
- const { separator = " ", variant = "each-word", join = separator } = options;
259
- if (variant === "first-word") {
260
- return text[0].toUpperCase() + text.slice(1);
261
- }
262
- const words = text.split(separator);
263
- return words.map((word) => word[0].toUpperCase() + word.slice(1)).join(join);
264
- };
265
- export {
266
- PositionContainer,
267
- fixModalPosition,
268
- formatBytes,
269
- formatDate,
270
- getModalPosition,
271
- getModalPositionRelativeToContainer,
272
- getModalPositionRelativeToScreen,
273
- getOppositePosition,
274
- timeBetween,
275
- toCapitalize
276
- };
277
- //# sourceMappingURL=helpers.js.map
2
+ import{clsx as h}from"clsx";import{twMerge as O}from"tailwind-merge";var b=(...t)=>O(h(t));var g=(t,o=2)=>{if(t===0)return"0 Bytes";let r=1e3,a=o<0?0:o,e=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],n=Math.floor(Math.log(t)/Math.log(r));return parseFloat((t/Math.pow(r,n)).toFixed(a))+" "+e[n]};var M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],_=t=>{let o=new Date(t);return Number.isNaN(o.getTime())?t:`${M[o.getMonth()]} ${o.getFullYear()}`},B=(t,o)=>{let r=new Date(t);if(Number.isNaN(r.getTime()))return"";let a=Date.parse(o)?new Date(o):new Date,e=Math.abs(a.getTime()-r.getTime()),n=Math.floor(e/(1e3*60)),i=Math.floor(e/(1e3*60*60)),T=Math.floor(e/(1e3*60*60*24)),l=Math.floor(T/30),p=Math.floor(T/365);return p>0?`${p} year${p>1?"s":""}`:l>0?`${l} month${l>1?"s":""}`:T>0?`${T} day${T>1?"s":""}`:i>0?`${i} hour${i>1?"s":""}`:`${n} minute${n!==1?"s":""}`};var u=(s=>(s.CENTER="center",s.TOP="top",s.TOP_LEFT="top left",s.TOP_RIGHT="top right",s.TOP_CENTER="top center",s.LEFT="left",s.LEFT_TOP="left top",s.LEFT_BOTTOM="left bottom",s.LEFT_CENTER="left center",s.RIGHT="right",s.RIGHT_TOP="right top",s.RIGHT_BOTTOM="right bottom",s.RIGHT_CENTER="right center",s.BOTTOM="bottom",s.BOTTOM_LEFT="bottom left",s.BOTTOM_RIGHT="bottom right",s.BOTTOM_CENTER="bottom center",s))(u||{}),P=({c:t,m:o,offset:r,position:a})=>{let e=t.y+t.h+r,n=t.x-(o.w-t.w)*(50/100);switch(a){case"top":case"top center":e=t.y-o.h-r,n=t.x-(o.w-t.w)/2;break;case"top left":e=t.y-o.h-r,n=t.x-o.w+t.w;break;case"top right":e=t.y-o.h-r,n=t.x;break;case"bottom":case"bottom center":e=t.y+t.h+r,n=t.x-(o.w-t.w)/2;break;case"bottom left":e=t.y+t.h+r,n=t.x-o.w+t.w;break;case"bottom right":e=t.y+t.h+r,n=t.x;break;case"left":case"left center":e=t.y-(o.h-t.h)/2,n=t.x-o.w-r;break;case"left top":e=t.y-o.h+t.h,n=t.x-o.w-r;break;case"left bottom":e=t.y,n=t.x-o.w-r;break;case"right":case"right center":e=t.y-(o.h-t.h)/2,n=t.x+t.w+r;break;case"right top":e=t.y-o.h+t.h,n=t.x+t.w+r;break;case"right bottom":e=t.y,n=t.x+t.w+r;break}return{left:Math.round(n),top:Math.round(e)}},c=({top:t,left:o},r,a,e)=>{let n=r.split(" "),i=[],T=o+e.w+a-window.innerWidth,l=t+e.h+a-window.innerHeight;for(let p of n)p==="top"&&t<a?i.push("bottom"):p==="left"&&o<a?i.push("right"):p==="bottom"&&l>0?i.push("top"):p==="right"&&T>0?i.push("left"):i.push(p);return i.join(" ")},x=({top:t,left:o},r,a)=>{let e=o+r.w+a-window.innerWidth,n=t+r.h+a-window.innerHeight;return o=e>0?o-e:o,t=n>0?t-n:t,o=o<a?a:o,t=t<a?a:t,{top:t,left:o}},G=({c:t,m:o,offset:r,windowOffset:a,position:e})=>{let n={c:t,m:o,offset:r,position:e},i=P(n),T=c(i,e,a,o);T!==e&&(i=P({...n,position:T}));let l=x(i,o,a);return{left:`${l.left}px`,top:`${l.top}px`}};var H=({position:t,windowOffset:o})=>{switch(t){case"center":return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case"top":case"top center":return{top:`${o}px`,left:"50%",transform:"translateX(-50%)"};case"top left":case"left top":return{top:`${o}px`,left:`${o}px`};case"top right":case"right top":return{top:`${o}px`,right:`${o}px`};case"bottom":case"bottom center":return{bottom:`${o}px`,left:"50%",transform:"translateX(-50%)"};case"left bottom":case"bottom left":return{bottom:`${o}px`,left:`${o}px`};case"right bottom":case"bottom right":return{bottom:`${o}px`,right:`${o}px`};case"left":case"left center":return{top:"50%",left:`${o}px`,transform:"translateY(-50%)"};case"right":case"right center":return{top:"50%",right:`${o}px`,transform:"translateY(-50%)"}}return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}};var I=(t,o={})=>{let{separator:r=" ",variant:a="each-word",join:e=r}=o;return a==="first-word"?t[0].toUpperCase()+t.slice(1):t.split(r).map(i=>i[0].toUpperCase()+i.slice(1)).join(e)};export{u as PositionContainer,b as cn,x as fixModalPosition,g as formatBytes,_ as formatDate,P as getModalPosition,G as getModalPositionRelativeToContainer,H as getModalPositionRelativeToScreen,c as getOppositePosition,B as timeBetween,I as toCapitalize};