@vitus-labs/elements 1.2.1 → 1.2.3-alpha.56

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 (87) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +279 -66
  3. package/lib/analysis/index.js.html +1 -1
  4. package/lib/analysis/vitus-labs-elements.native.js.html +1 -1
  5. package/lib/index.d.ts +835 -850
  6. package/lib/index.d.ts.map +1 -0
  7. package/lib/index.js +1290 -1160
  8. package/lib/index.js.map +1 -1
  9. package/lib/vitus-labs-elements.native.js +1176 -1060
  10. package/lib/vitus-labs-elements.native.js.map +1 -1
  11. package/package.json +24 -24
  12. package/lib/types/Element/component.d.ts +0 -4
  13. package/lib/types/Element/component.d.ts.map +0 -1
  14. package/lib/types/Element/constants.d.ts +0 -51
  15. package/lib/types/Element/constants.d.ts.map +0 -1
  16. package/lib/types/Element/index.d.ts +0 -7
  17. package/lib/types/Element/index.d.ts.map +0 -1
  18. package/lib/types/Element/types.d.ts +0 -423
  19. package/lib/types/Element/types.d.ts.map +0 -1
  20. package/lib/types/Element/utils.d.ts +0 -5
  21. package/lib/types/Element/utils.d.ts.map +0 -1
  22. package/lib/types/Element/withEqualSizeBeforeAfter.d.ts +0 -8
  23. package/lib/types/Element/withEqualSizeBeforeAfter.d.ts.map +0 -1
  24. package/lib/types/List/component.d.ts +0 -23
  25. package/lib/types/List/component.d.ts.map +0 -1
  26. package/lib/types/List/index.d.ts +0 -7
  27. package/lib/types/List/index.d.ts.map +0 -1
  28. package/lib/types/List/withActiveState.d.ts +0 -11
  29. package/lib/types/List/withActiveState.d.ts.map +0 -1
  30. package/lib/types/Overlay/component.d.ts +0 -52
  31. package/lib/types/Overlay/component.d.ts.map +0 -1
  32. package/lib/types/Overlay/context.d.ts +0 -12
  33. package/lib/types/Overlay/context.d.ts.map +0 -1
  34. package/lib/types/Overlay/index.d.ts +0 -7
  35. package/lib/types/Overlay/index.d.ts.map +0 -1
  36. package/lib/types/Overlay/useOverlay.d.ts +0 -109
  37. package/lib/types/Overlay/useOverlay.d.ts.map +0 -1
  38. package/lib/types/Portal/component.d.ts +0 -20
  39. package/lib/types/Portal/component.d.ts.map +0 -1
  40. package/lib/types/Portal/index.d.ts +0 -5
  41. package/lib/types/Portal/index.d.ts.map +0 -1
  42. package/lib/types/Text/component.d.ts +0 -30
  43. package/lib/types/Text/component.d.ts.map +0 -1
  44. package/lib/types/Text/index.d.ts +0 -5
  45. package/lib/types/Text/index.d.ts.map +0 -1
  46. package/lib/types/Text/styled.d.ts +0 -3
  47. package/lib/types/Text/styled.d.ts.map +0 -1
  48. package/lib/types/Util/component.d.ts +0 -19
  49. package/lib/types/Util/component.d.ts.map +0 -1
  50. package/lib/types/Util/index.d.ts +0 -5
  51. package/lib/types/Util/index.d.ts.map +0 -1
  52. package/lib/types/constants.d.ts +0 -2
  53. package/lib/types/constants.d.ts.map +0 -1
  54. package/lib/types/helpers/Content/component.d.ts +0 -5
  55. package/lib/types/helpers/Content/component.d.ts.map +0 -1
  56. package/lib/types/helpers/Content/index.d.ts +0 -3
  57. package/lib/types/helpers/Content/index.d.ts.map +0 -1
  58. package/lib/types/helpers/Content/styled.d.ts +0 -3
  59. package/lib/types/helpers/Content/styled.d.ts.map +0 -1
  60. package/lib/types/helpers/Content/types.d.ts +0 -31
  61. package/lib/types/helpers/Content/types.d.ts.map +0 -1
  62. package/lib/types/helpers/Iterator/component.d.ts +0 -10
  63. package/lib/types/helpers/Iterator/component.d.ts.map +0 -1
  64. package/lib/types/helpers/Iterator/index.d.ts +0 -5
  65. package/lib/types/helpers/Iterator/index.d.ts.map +0 -1
  66. package/lib/types/helpers/Iterator/types.d.ts +0 -60
  67. package/lib/types/helpers/Iterator/types.d.ts.map +0 -1
  68. package/lib/types/helpers/Wrapper/component.d.ts +0 -5
  69. package/lib/types/helpers/Wrapper/component.d.ts.map +0 -1
  70. package/lib/types/helpers/Wrapper/constants.d.ts +0 -6
  71. package/lib/types/helpers/Wrapper/constants.d.ts.map +0 -1
  72. package/lib/types/helpers/Wrapper/index.d.ts +0 -3
  73. package/lib/types/helpers/Wrapper/index.d.ts.map +0 -1
  74. package/lib/types/helpers/Wrapper/styled.d.ts +0 -3
  75. package/lib/types/helpers/Wrapper/styled.d.ts.map +0 -1
  76. package/lib/types/helpers/Wrapper/types.d.ts +0 -42
  77. package/lib/types/helpers/Wrapper/types.d.ts.map +0 -1
  78. package/lib/types/helpers/Wrapper/utils.d.ts +0 -4
  79. package/lib/types/helpers/Wrapper/utils.d.ts.map +0 -1
  80. package/lib/types/helpers/index.d.ts +0 -4
  81. package/lib/types/helpers/index.d.ts.map +0 -1
  82. package/lib/types/index.d.ts +0 -18
  83. package/lib/types/index.d.ts.map +0 -1
  84. package/lib/types/types.d.ts +0 -51
  85. package/lib/types/types.d.ts.map +0 -1
  86. package/lib/types/utils.d.ts +0 -2
  87. package/lib/types/utils.d.ts.map +0 -1
@@ -1,1161 +1,1277 @@
1
- import { makeItResponsive, alignContent, extendCss, value } from '@vitus-labs/unistyle';
2
- export { Provider } from '@vitus-labs/unistyle';
3
- import React, { forwardRef, memo, useMemo, createRef, useCallback, Children, useState, useEffect, createContext, useContext, useRef } from 'react';
4
- import { config, render, get, isEmpty, pick, omit, context as context$1, throttle } from '@vitus-labs/core';
5
- import { isFragment } from 'react-is';
6
- import { createPortal } from 'react-dom';
1
+ import { Provider, alignContent, extendCss, makeItResponsive, value } from "@vitus-labs/unistyle";
2
+ import { config, context, isEmpty, omit, pick, render, throttle } from "@vitus-labs/core";
3
+ import { Children, createContext, forwardRef, memo, useCallback, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ import { isFragment } from "react-is";
6
+ import { createPortal } from "react-dom";
7
7
 
8
- const PKG_NAME = '@vitus-labs/elements';
8
+ //#region src/constants.ts
9
+ const PKG_NAME = "@vitus-labs/elements";
9
10
 
10
- const IS_DEVELOPMENT = process.env.NODE_ENV !== 'production';
11
+ //#endregion
12
+ //#region src/utils.ts
13
+ const IS_DEVELOPMENT = process.env.NODE_ENV !== "production";
11
14
 
12
- const { styled: styled$2, css: css$2, component: component$3 } = config;
13
- const childFixCSS = `
14
- display: flex;
15
+ //#endregion
16
+ //#region src/helpers/Content/styled.ts
17
+ /**
18
+ * Styled component for content areas (before/content/after). Applies
19
+ * responsive flex alignment, gap spacing between slots based on parent
20
+ * direction (margin-right for inline, margin-bottom for rows), and
21
+ * equalCols flex distribution. The "content" slot gets `flex: 1` to
22
+ * fill remaining space between before and after.
23
+ */
24
+ const { styled: styled$2, css: css$2, component: component$2 } = config;
25
+ const equalColsCSS = `
15
26
  flex: 1;
16
- width: 100%;
17
- height: 100%;
18
27
  `;
19
- const blockCSS = `
20
- align-self: stretch;
28
+ const typeContentCSS = `
29
+ flex: 1;
21
30
  `;
22
- const styles$2 = ({ theme: t, css, }) => css `
23
- ${false};
24
-
31
+ const gapDimensions = {
32
+ inline: {
33
+ before: "margin-right",
34
+ after: "margin-left"
35
+ },
36
+ reverseInline: {
37
+ before: "margin-right",
38
+ after: "margin-left"
39
+ },
40
+ rows: {
41
+ before: "margin-bottom",
42
+ after: "margin-top"
43
+ },
44
+ reverseRows: {
45
+ before: "margin-bottom",
46
+ after: "margin-top"
47
+ }
48
+ };
49
+ const calculateGap = ({ direction, type, value }) => {
50
+ if (!direction || !type || type === "content") return void 0;
51
+ return `${gapDimensions[direction][type]}: ${value};`;
52
+ };
53
+ const styles$2 = ({ css, theme: t, rootSize }) => css`
25
54
  ${alignContent({
26
- direction: t.direction,
27
- alignX: t.alignX,
28
- alignY: t.alignY,
55
+ direction: t.direction,
56
+ alignX: t.alignX,
57
+ alignY: t.alignY
29
58
  })};
30
59
 
31
- ${t.block && blockCSS};
60
+ ${t.equalCols && equalColsCSS};
32
61
 
33
- ${false};
34
- ${false};
35
- ${false};
62
+ ${t.gap && t.contentType && calculateGap({
63
+ direction: t.parentDirection,
64
+ type: t.contentType,
65
+ value: value(t.gap, rootSize)
66
+ })};
36
67
 
37
68
  ${t.extraStyles && extendCss(t.extraStyles)};
38
69
  `;
39
- const platformCSS$1 = `display: flex;`;
40
- var Styled$1 = styled$2(component$3) `
41
- position: relative;
42
- ${platformCSS$1};
70
+ const StyledComponent = styled$2(component$2)`
71
+ ${""};
43
72
 
44
- ${({ $childFix }) => $childFix && childFixCSS};
73
+ display: flex;
74
+ align-self: stretch;
75
+ flex-wrap: wrap;
76
+
77
+ ${({ $contentType }) => $contentType === "content" && typeContentCSS};
45
78
 
46
79
  ${makeItResponsive({
47
- key: '$element',
48
- styles: styles$2,
49
- css: css$2,
50
- normalize: true,
80
+ key: "$element",
81
+ styles: styles$2,
82
+ css: css$2,
83
+ normalize: true
51
84
  })};
52
85
  `;
53
86
 
54
- // eslint-disable-next-line react/display-name
55
- const Component$9 = forwardRef(({ children, tag, block, extendCss, direction, alignX, alignY, equalCols, isInline, ...props }, ref) => {
56
- const debugProps = IS_DEVELOPMENT
57
- ? {
58
- 'data-vl-element': 'Element',
59
- }
60
- : {};
61
- const COMMON_PROPS = {
62
- ...props,
63
- ...debugProps,
64
- ref,
65
- as: tag,
66
- };
67
- {
68
- return (React.createElement(Styled$1, { ...COMMON_PROPS, "$element": {
69
- block,
70
- direction,
71
- alignX,
72
- alignY,
73
- equalCols,
74
- extraStyles: extendCss,
75
- } }, children));
76
- }
77
- });
87
+ //#endregion
88
+ //#region src/helpers/Content/component.tsx
89
+ const Component$9 = ({ contentType, tag, parentDirection, direction, alignX, alignY, equalCols, gap, extendCss, ...props }) => {
90
+ return /* @__PURE__ */ jsx(StyledComponent, {
91
+ as: tag,
92
+ $contentType: contentType,
93
+ $element: {
94
+ contentType,
95
+ parentDirection,
96
+ direction,
97
+ alignX,
98
+ alignY,
99
+ equalCols,
100
+ gap,
101
+ extraStyles: extendCss
102
+ },
103
+ ...IS_DEVELOPMENT ? { "data-vl-element": contentType } : {},
104
+ ...props
105
+ });
106
+ };
107
+ var component_default = memo(Component$9);
78
108
 
79
- const { styled: styled$1, css: css$1, component: component$2 } = config;
80
- const equalColsCSS = `
109
+ //#endregion
110
+ //#region src/helpers/Content/index.ts
111
+ var Content_default = component_default;
112
+
113
+ //#endregion
114
+ //#region src/helpers/Wrapper/styled.ts
115
+ /**
116
+ * Styled component for the Element wrapper layer. Handles responsive
117
+ * block/inline-flex display, direction, alignment, and custom CSS injection.
118
+ * Includes special handling for the `parentFix` / `childFix` flags that
119
+ * split flex behavior across two DOM nodes for button/fieldset/legend
120
+ * elements where a single flex container is insufficient.
121
+ */
122
+ const { styled: styled$1, css: css$1, component: component$1 } = config;
123
+ const childFixCSS = `
124
+ display: flex;
81
125
  flex: 1;
126
+ width: 100%;
127
+ height: 100%;
82
128
  `;
83
- const typeContentCSS = `
84
- flex: 1;
129
+ const blockCSS = `
130
+ align-self: stretch;
85
131
  `;
86
- // --------------------------------------------------------
87
- // calculate spacing between before / content / after
88
- // --------------------------------------------------------
89
- const gapDimensions = {
90
- inline: {
91
- before: 'margin-right',
92
- after: 'margin-left',
93
- },
94
- reverseInline: {
95
- before: 'margin-right',
96
- after: 'margin-left',
97
- },
98
- rows: {
99
- before: 'margin-bottom',
100
- after: 'margin-top',
101
- },
102
- reverseRows: {
103
- before: 'margin-bottom',
104
- after: 'margin-top',
105
- },
106
- };
107
- const calculateGap = ({ direction, type, value, }) => {
108
- if (!direction || !type)
109
- return undefined;
110
- const finalStyles = `${gapDimensions[direction][type]}: ${value};`;
111
- return finalStyles;
112
- };
113
- // --------------------------------------------------------
114
- // calculations of styles to be rendered
115
- // --------------------------------------------------------
116
- const styles$1 = ({ css, theme: t, rootSize, }) => css `
132
+ const styles$1 = ({ theme: t, css }) => css`
133
+ ${false};
134
+
117
135
  ${alignContent({
118
- direction: t.direction,
119
- alignX: t.alignX,
120
- alignY: t.alignY,
136
+ direction: t.direction,
137
+ alignX: t.alignX,
138
+ alignY: t.alignY
121
139
  })};
122
140
 
123
- ${t.equalCols && equalColsCSS};
141
+ ${t.block && blockCSS};
124
142
 
125
- ${t.gap &&
126
- t.contentType &&
127
- calculateGap({
128
- direction: t.parentDirection,
129
- type: t.contentType,
130
- value: value(t.gap, rootSize),
131
- })};
143
+ ${false};
144
+ ${false};
145
+ ${false};
132
146
 
133
147
  ${t.extraStyles && extendCss(t.extraStyles)};
134
148
  `;
135
- const platformCSS = '';
136
- const StyledComponent = styled$1(component$2) `
149
+ const platformCSS = `display: flex;`;
150
+ var styled_default$1 = styled$1(component$1)`
151
+ position: relative;
137
152
  ${platformCSS};
138
153
 
139
- display: flex;
140
- align-self: stretch;
141
- flex-wrap: wrap;
142
-
143
- ${({ $contentType }) => $contentType === 'content' && typeContentCSS};
154
+ ${({ $childFix }) => $childFix && childFixCSS};
144
155
 
145
156
  ${makeItResponsive({
146
- key: '$element',
147
- styles: styles$1,
148
- css: css$1,
149
- normalize: true,
157
+ key: "$element",
158
+ styles: styles$1,
159
+ css: css$1,
160
+ normalize: true
150
161
  })};
151
162
  `;
152
163
 
153
- const Component$8 = ({ contentType, tag, parentDirection, direction, alignX, alignY, equalCols, gap, extendCss, ...props }) => {
154
- const debugProps = IS_DEVELOPMENT
155
- ? {
156
- 'data-vl-element': contentType,
157
- }
158
- : {};
159
- const stylingProps = {
160
- contentType,
161
- parentDirection,
162
- direction,
163
- alignX,
164
- alignY,
165
- equalCols,
166
- gap,
167
- extraStyles: extendCss,
168
- };
169
- return (React.createElement(StyledComponent, { as: tag, "$contentType": contentType, "$element": stylingProps, ...debugProps, ...props }));
170
- };
171
- var component$1 = memo(Component$8);
164
+ //#endregion
165
+ //#region src/helpers/Wrapper/component.tsx
166
+ /**
167
+ * Wrapper component that serves as the outermost styled container for Element.
168
+ * Uses forwardRef for ref forwarding to the underlying DOM node. On web, it
169
+ * detects button/fieldset/legend tags and applies a two-layer flex fix
170
+ * (parent + child Styled) because these HTML elements do not natively
171
+ * support `display: flex` consistently across browsers.
172
+ */
173
+ const DEV_PROPS = IS_DEVELOPMENT ? { "data-vl-element": "Element" } : {};
174
+ const Component$8 = forwardRef(({ children, tag, block, extendCss, direction, alignX, alignY, equalCols, isInline, ...props }, ref) => {
175
+ return /* @__PURE__ */ jsx(styled_default$1, {
176
+ ...props,
177
+ ...DEV_PROPS,
178
+ ref,
179
+ as: tag,
180
+ $element: {
181
+ block,
182
+ direction,
183
+ alignX,
184
+ alignY,
185
+ equalCols,
186
+ extraStyles: extendCss
187
+ },
188
+ children
189
+ });
190
+ });
191
+
192
+ //#endregion
193
+ //#region src/helpers/Wrapper/index.ts
194
+ var Wrapper_default = Component$8;
172
195
 
173
- const defaultDirection = 'inline';
174
- const defaultContentDirection = 'rows';
175
- const defaultAlignX = 'left';
176
- const defaultAlignY = 'center';
196
+ //#endregion
197
+ //#region src/Element/component.tsx
198
+ /**
199
+ * Core building block of the elements package. Renders a three-section layout
200
+ * (beforeContent / content / afterContent) inside a flex Wrapper. When only
201
+ * content is present, the Wrapper inherits content-level alignment directly
202
+ * to avoid an unnecessary nesting layer. Handles HTML-specific edge cases
203
+ * like void elements (input, img) and inline elements (span, a) by
204
+ * skipping children or switching sub-tags accordingly.
205
+ */
206
+ const defaultDirection = "inline";
207
+ const defaultContentDirection = "rows";
208
+ const defaultAlignX = "left";
209
+ const defaultAlignY = "center";
177
210
  const Component$7 = forwardRef(({ innerRef, tag, label, content, children, beforeContent, afterContent, block, equalCols, gap, direction, alignX = defaultAlignX, alignY = defaultAlignY, css, contentCss, beforeContentCss, afterContentCss, contentDirection = defaultContentDirection, contentAlignX = defaultAlignX, contentAlignY = defaultAlignY, beforeContentDirection = defaultDirection, beforeContentAlignX = defaultAlignX, beforeContentAlignY = defaultAlignY, afterContentDirection = defaultDirection, afterContentAlignX = defaultAlignX, afterContentAlignY = defaultAlignY, ...props }, ref) => {
178
- // --------------------------------------------------------
179
- // if not single element, calculate values
180
- // --------------------------------------------------------
181
- const isSimpleElement = !beforeContent && !afterContent;
182
- const CHILDREN = children ?? content ?? label;
183
- const isInline = false;
184
- const SUB_TAG = undefined;
185
- // --------------------------------------------------------
186
- // direction & alignX & alignY calculations
187
- // --------------------------------------------------------
188
- const { wrapperDirection, wrapperAlignX, wrapperAlignY } = useMemo(() => {
189
- let wrapperDirection = direction;
190
- let wrapperAlignX = alignX;
191
- let wrapperAlignY = alignY;
192
- if (isSimpleElement) {
193
- if (contentDirection)
194
- wrapperDirection = contentDirection;
195
- if (contentAlignX)
196
- wrapperAlignX = contentAlignX;
197
- if (contentAlignY)
198
- wrapperAlignY = contentAlignY;
199
- }
200
- else if (direction) {
201
- wrapperDirection = direction;
202
- }
203
- else {
204
- wrapperDirection = defaultDirection;
205
- }
206
- return { wrapperDirection, wrapperAlignX, wrapperAlignY };
207
- }, [
208
- isSimpleElement,
209
- contentDirection,
210
- contentAlignX,
211
- contentAlignY,
212
- alignX,
213
- alignY,
214
- direction,
215
- ]);
216
- // --------------------------------------------------------
217
- // common wrapper props
218
- // --------------------------------------------------------
219
- const WRAPPER_PROPS = {
220
- ref: ref ?? innerRef,
221
- extendCss: css,
222
- tag,
223
- block,
224
- direction: wrapperDirection,
225
- alignX: wrapperAlignX,
226
- alignY: wrapperAlignY,
227
- as: undefined, // reset styled-components `as` prop
228
- };
229
- const contentRenderOutput = render(CHILDREN);
230
- return (React.createElement(Component$9, { ...props, ...WRAPPER_PROPS, isInline: isInline },
231
- beforeContent && (React.createElement(component$1, { tag: SUB_TAG, contentType: "before", parentDirection: wrapperDirection, extendCss: beforeContentCss, direction: beforeContentDirection, alignX: beforeContentAlignX, alignY: beforeContentAlignY, equalCols: equalCols, gap: gap }, render(beforeContent))),
232
- isSimpleElement ? (contentRenderOutput) : (React.createElement(component$1, { tag: SUB_TAG, contentType: "content", parentDirection: wrapperDirection, extendCss: contentCss, direction: contentDirection, alignX: contentAlignX, alignY: contentAlignY, equalCols: equalCols }, contentRenderOutput)),
233
- afterContent && (React.createElement(component$1, { tag: SUB_TAG, contentType: "after", parentDirection: wrapperDirection, extendCss: afterContentCss, direction: afterContentDirection, alignX: afterContentAlignX, alignY: afterContentAlignY, equalCols: equalCols, gap: gap }, render(afterContent)))));
211
+ const isSimpleElement = !beforeContent && !afterContent;
212
+ const CHILDREN = children ?? content ?? label;
213
+ const isInline = false;
214
+ const SUB_TAG = void 0;
215
+ const { wrapperDirection, wrapperAlignX, wrapperAlignY } = useMemo(() => {
216
+ let wrapperDirection = direction;
217
+ let wrapperAlignX = alignX;
218
+ let wrapperAlignY = alignY;
219
+ if (isSimpleElement) {
220
+ if (contentDirection) wrapperDirection = contentDirection;
221
+ if (contentAlignX) wrapperAlignX = contentAlignX;
222
+ if (contentAlignY) wrapperAlignY = contentAlignY;
223
+ } else if (direction) wrapperDirection = direction;
224
+ else wrapperDirection = defaultDirection;
225
+ return {
226
+ wrapperDirection,
227
+ wrapperAlignX,
228
+ wrapperAlignY
229
+ };
230
+ }, [
231
+ isSimpleElement,
232
+ contentDirection,
233
+ contentAlignX,
234
+ contentAlignY,
235
+ alignX,
236
+ alignY,
237
+ direction
238
+ ]);
239
+ const WRAPPER_PROPS = {
240
+ ref: ref ?? innerRef,
241
+ extendCss: css,
242
+ tag,
243
+ block,
244
+ direction: wrapperDirection,
245
+ alignX: wrapperAlignX,
246
+ alignY: wrapperAlignY,
247
+ as: void 0
248
+ };
249
+ const contentRenderOutput = render(CHILDREN);
250
+ return /* @__PURE__ */ jsxs(Wrapper_default, {
251
+ ...props,
252
+ ...WRAPPER_PROPS,
253
+ isInline,
254
+ children: [
255
+ beforeContent && /* @__PURE__ */ jsx(Content_default, {
256
+ tag: SUB_TAG,
257
+ contentType: "before",
258
+ parentDirection: wrapperDirection,
259
+ extendCss: beforeContentCss,
260
+ direction: beforeContentDirection,
261
+ alignX: beforeContentAlignX,
262
+ alignY: beforeContentAlignY,
263
+ equalCols,
264
+ gap,
265
+ children: render(beforeContent)
266
+ }),
267
+ isSimpleElement ? contentRenderOutput : /* @__PURE__ */ jsx(Content_default, {
268
+ tag: SUB_TAG,
269
+ contentType: "content",
270
+ parentDirection: wrapperDirection,
271
+ extendCss: contentCss,
272
+ direction: contentDirection,
273
+ alignX: contentAlignX,
274
+ alignY: contentAlignY,
275
+ equalCols,
276
+ children: contentRenderOutput
277
+ }),
278
+ afterContent && /* @__PURE__ */ jsx(Content_default, {
279
+ tag: SUB_TAG,
280
+ contentType: "after",
281
+ parentDirection: wrapperDirection,
282
+ extendCss: afterContentCss,
283
+ direction: afterContentDirection,
284
+ alignX: afterContentAlignX,
285
+ alignY: afterContentAlignY,
286
+ equalCols,
287
+ gap,
288
+ children: render(afterContent)
289
+ })
290
+ ]
291
+ });
234
292
  });
235
293
  const name$5 = `${PKG_NAME}/Element`;
236
294
  Component$7.displayName = name$5;
237
295
  Component$7.pkgName = PKG_NAME;
238
296
  Component$7.VITUS_LABS__COMPONENT = name$5;
239
297
 
240
- const isNumber = (a, b) => Number.isInteger(a) && Number.isInteger(b);
298
+ //#endregion
299
+ //#region src/Element/withEqualSizeBeforeAfter.tsx
300
+ /**
301
+ * HOC that equalizes the dimensions of beforeContent and afterContent areas.
302
+ * After render, it measures both DOM nodes via useLayoutEffect and sets the
303
+ * larger dimension on both so they match. Uses width for inline direction
304
+ * and height for rows direction. This is useful for centering the main
305
+ * content when before/after slots have different intrinsic sizes.
306
+ */
241
307
  const types = {
242
- height: 'offsetHeight',
243
- width: 'offsetWidth',
308
+ height: "offsetHeight",
309
+ width: "offsetWidth"
244
310
  };
245
- const calculate = ({ beforeContent, afterContent }) => (type) => {
246
- const beforeContentSize = get(beforeContent, types[type]);
247
- const afterContentSize = get(afterContent, types[type]);
248
- if (isNumber(beforeContentSize, afterContentSize)) {
249
- if (beforeContentSize > afterContentSize) {
250
- beforeContent.style[type] = `${beforeContentSize}px`;
251
- afterContent.style[type] = `${beforeContentSize}px`;
252
- }
253
- else {
254
- beforeContent.style[type] = `${afterContentSize}px`;
255
- afterContent.style[type] = `${afterContentSize}px`;
256
- }
257
- }
311
+ const equalize = (beforeEl, afterEl, type) => {
312
+ const prop = types[type];
313
+ const beforeSize = beforeEl[prop];
314
+ const afterSize = afterEl[prop];
315
+ if (Number.isInteger(beforeSize) && Number.isInteger(afterSize)) {
316
+ const maxSize = `${Math.max(beforeSize, afterSize)}px`;
317
+ beforeEl.style[type] = maxSize;
318
+ afterEl.style[type] = maxSize;
319
+ }
258
320
  };
259
321
  const withEqualBeforeAfter = (WrappedComponent) => {
260
- const displayName = WrappedComponent.displayName ?? WrappedComponent.name ?? 'Component';
261
- const Enhanced = (props) => {
262
- const { equalBeforeAfter, direction, afterContent, beforeContent, ...rest } = props;
263
- const elementRef = createRef();
264
- const calculateSize = () => {
265
- const beforeContent = get(elementRef, 'current.children[0]');
266
- const afterContent = get(elementRef, 'current.children[2]');
267
- if (beforeContent && afterContent) {
268
- const updateElement = calculate({ beforeContent, afterContent });
269
- if (direction === 'rows')
270
- updateElement('height');
271
- else
272
- updateElement('width');
273
- }
274
- };
275
- if (equalBeforeAfter)
276
- calculateSize();
277
- return (React.createElement(WrappedComponent, { ...rest, afterContent: afterContent, beforeContent: beforeContent,
278
- // @ts-ignore
279
- ref: elementRef }));
280
- };
281
- Enhanced.displayName = `withEqualSizeBeforeAfter(${displayName})`;
282
- return Enhanced;
322
+ const displayName = WrappedComponent.displayName ?? WrappedComponent.name ?? "Component";
323
+ const Enhanced = ({ equalBeforeAfter, direction, afterContent, beforeContent, ref, ...rest }) => {
324
+ const internalRef = useRef(null);
325
+ useImperativeHandle(ref, () => internalRef.current);
326
+ useLayoutEffect(() => {
327
+ if (!equalBeforeAfter || !beforeContent || !afterContent) return;
328
+ if (!internalRef.current) return;
329
+ const el = internalRef.current;
330
+ const beforeEl = el.firstElementChild;
331
+ const afterEl = el.lastElementChild;
332
+ if (beforeEl && afterEl && beforeEl !== afterEl) equalize(beforeEl, afterEl, direction === "rows" ? "height" : "width");
333
+ });
334
+ return /* @__PURE__ */ jsx(WrappedComponent, {
335
+ ...rest,
336
+ afterContent,
337
+ beforeContent,
338
+ ref: internalRef
339
+ });
340
+ };
341
+ Enhanced.displayName = `withEqualSizeBeforeAfter(${displayName})`;
342
+ return Enhanced;
283
343
  };
284
344
 
345
+ //#endregion
346
+ //#region src/Element/index.ts
347
+ var Element_default = Component$7;
348
+
349
+ //#endregion
350
+ //#region src/helpers/Iterator/component.tsx
351
+ /**
352
+ * Data-driven list renderer that supports three input modes: React children
353
+ * (including fragments), an array of primitives, or an array of objects.
354
+ * Each item receives positional metadata (first, last, odd, even, position)
355
+ * and optional injected props via `itemProps`. Items can be individually
356
+ * wrapped with `wrapComponent`. Children always take priority over the
357
+ * component+data prop pattern.
358
+ */
359
+ const classifyData = (data) => {
360
+ const items = data.filter((item) => item != null && !(typeof item === "object" && isEmpty(item)));
361
+ if (items.length === 0) return null;
362
+ let isSimple = true;
363
+ let isComplex = true;
364
+ for (const item of items) if (typeof item === "string" || typeof item === "number") isComplex = false;
365
+ else if (typeof item === "object") isSimple = false;
366
+ else {
367
+ isSimple = false;
368
+ isComplex = false;
369
+ }
370
+ if (isSimple) return {
371
+ type: "simple",
372
+ data: items
373
+ };
374
+ if (isComplex) return {
375
+ type: "complex",
376
+ data: items
377
+ };
378
+ return null;
379
+ };
285
380
  const RESERVED_PROPS = [
286
- 'children',
287
- 'component',
288
- 'wrapComponent',
289
- 'data',
290
- 'itemKey',
291
- 'valueName',
292
- 'itemProps',
293
- 'wrapProps',
381
+ "children",
382
+ "component",
383
+ "wrapComponent",
384
+ "data",
385
+ "itemKey",
386
+ "valueName",
387
+ "itemProps",
388
+ "wrapProps"
294
389
  ];
295
- const attachItemProps = ({ i, length, }) => {
296
- const position = i + 1;
297
- return {
298
- index: i,
299
- first: position === 1,
300
- last: position === length,
301
- odd: position % 2 === 1,
302
- even: position % 2 === 0,
303
- position,
304
- };
390
+ const attachItemProps = ({ i, length }) => {
391
+ const position = i + 1;
392
+ return {
393
+ index: i,
394
+ first: position === 1,
395
+ last: position === length,
396
+ odd: position % 2 === 1,
397
+ even: position % 2 === 0,
398
+ position
399
+ };
305
400
  };
306
401
  const Component$6 = (props) => {
307
- const { itemKey, valueName, children, component, data, wrapComponent: Wrapper, wrapProps, itemProps, } = props;
308
- const injectItemProps = useMemo(() => (typeof itemProps === 'function' ? itemProps : () => itemProps), [itemProps]);
309
- const injectWrapItemProps = useMemo(() => (typeof wrapProps === 'function' ? wrapProps : () => wrapProps), [wrapProps]);
310
- const getKey = useCallback((item, index) => {
311
- if (typeof itemKey === 'function')
312
- return itemKey(item, index);
313
- return index;
314
- }, [itemKey]);
315
- const renderChild = (child, total = 1, i = 0) => {
316
- if (!itemProps && !Wrapper)
317
- return child;
318
- const extendedProps = attachItemProps({
319
- i,
320
- length: total,
321
- });
322
- const finalItemProps = itemProps ? injectItemProps({}, extendedProps) : {};
323
- // if no props extension is required, just return children
324
- if (Wrapper) {
325
- const finalWrapProps = wrapProps
326
- ? injectWrapItemProps({}, extendedProps)
327
- : {};
328
- return (React.createElement(Wrapper, { key: i, ...finalWrapProps }, render(child, finalItemProps)));
329
- }
330
- return render(child, {
331
- key: i,
332
- ...finalItemProps,
333
- });
334
- };
335
- // --------------------------------------------------------
336
- // render children
337
- // --------------------------------------------------------
338
- const renderChildren = () => {
339
- if (!children)
340
- return null;
341
- // if children is Array
342
- if (Array.isArray(children)) {
343
- return Children.map(children, (item, i) => renderChild(item, children.length, i));
344
- }
345
- // if children is Fragment
346
- if (isFragment(children)) {
347
- const fragmentChildren = children?.props?.children;
348
- const childrenLength = fragmentChildren.length;
349
- return fragmentChildren.map((item, i) => renderChild(item, childrenLength, i));
350
- }
351
- // if single child
352
- return renderChild(children);
353
- };
354
- // --------------------------------------------------------
355
- // render array of strings or numbers
356
- // --------------------------------------------------------
357
- const renderSimpleArray = (data) => {
358
- const { length } = data;
359
- // if the data array is empty
360
- if (length === 0)
361
- return null;
362
- return data.map((item, i) => {
363
- const key = getKey(item, i);
364
- const keyName = valueName ?? 'children';
365
- const extendedProps = attachItemProps({
366
- i,
367
- length,
368
- });
369
- const finalItemProps = {
370
- ...(itemProps
371
- ? injectItemProps({ [keyName]: item }, extendedProps)
372
- : {}),
373
- [keyName]: item,
374
- };
375
- if (Wrapper) {
376
- const finalWrapProps = wrapProps
377
- ? injectWrapItemProps({ [keyName]: item }, extendedProps)
378
- : {};
379
- return (React.createElement(Wrapper, { key: key, ...finalWrapProps }, render(component, finalItemProps)));
380
- }
381
- return render(component, { key, ...finalItemProps });
382
- });
383
- };
384
- // --------------------------------------------------------
385
- // render array of objects
386
- // --------------------------------------------------------
387
- const renderComplexArray = (data) => {
388
- const renderData = data.filter((item) => !isEmpty(item)); // remove empty objects
389
- const { length } = renderData;
390
- // if it's empty
391
- if (renderData.length === 0)
392
- return null;
393
- const getKey = (item, index) => {
394
- if (!itemKey)
395
- return item.key ?? item.id ?? item.itemId ?? index;
396
- if (typeof itemKey === 'function')
397
- return itemKey(item, index);
398
- if (typeof itemKey === 'string')
399
- return item[itemKey];
400
- return index;
401
- };
402
- return renderData.map((item, i) => {
403
- const { component: itemComponent, ...restItem } = item;
404
- const renderItem = itemComponent ?? component;
405
- const key = getKey(restItem, i);
406
- const extendedProps = attachItemProps({
407
- i,
408
- length,
409
- });
410
- const finalItemProps = {
411
- ...(itemProps ? injectItemProps(item, extendedProps) : {}),
412
- ...restItem,
413
- };
414
- if (Wrapper && !itemComponent) {
415
- const finalWrapProps = wrapProps
416
- ? injectWrapItemProps(item, extendedProps)
417
- : {};
418
- return (React.createElement(Wrapper, { key: key, ...finalWrapProps }, render(renderItem, finalItemProps)));
419
- }
420
- return render(renderItem, { key, ...finalItemProps });
421
- });
422
- };
423
- // --------------------------------------------------------
424
- // render list items
425
- // --------------------------------------------------------
426
- const renderItems = () => {
427
- // --------------------------------------------------------
428
- // children have priority over props component + data
429
- // --------------------------------------------------------
430
- if (children)
431
- return renderChildren();
432
- // --------------------------------------------------------
433
- // render props component + data
434
- // --------------------------------------------------------
435
- if (component && Array.isArray(data)) {
436
- const clearData = data.filter((item) => item !== null && item !== undefined);
437
- const isSimpleArray = clearData.every((item) => typeof item === 'string' || typeof item === 'number');
438
- if (isSimpleArray)
439
- return renderSimpleArray(clearData);
440
- const isComplexArray = clearData.every((item) => typeof item === 'object');
441
- if (isComplexArray)
442
- return renderComplexArray(clearData);
443
- return null;
444
- }
445
- // --------------------------------------------------------
446
- // if there are no children or valid react component and data as an array,
447
- // return null to prevent error
448
- // --------------------------------------------------------
449
- return null;
450
- };
451
- return renderItems();
402
+ const { itemKey, valueName, children, component, data, wrapComponent: Wrapper, wrapProps, itemProps } = props;
403
+ const injectItemProps = useMemo(() => typeof itemProps === "function" ? itemProps : () => itemProps, [itemProps]);
404
+ const injectWrapItemProps = useMemo(() => typeof wrapProps === "function" ? wrapProps : () => wrapProps, [wrapProps]);
405
+ const getKey = useCallback((item, index) => {
406
+ if (typeof itemKey === "function") return itemKey(item, index);
407
+ return index;
408
+ }, [itemKey]);
409
+ const renderChild = (child, total = 1, i = 0) => {
410
+ if (!itemProps && !Wrapper) return child;
411
+ const extendedProps = attachItemProps({
412
+ i,
413
+ length: total
414
+ });
415
+ const finalItemProps = itemProps ? injectItemProps({}, extendedProps) : {};
416
+ if (Wrapper) return /* @__PURE__ */ jsx(Wrapper, {
417
+ ...wrapProps ? injectWrapItemProps({}, extendedProps) : {},
418
+ children: render(child, finalItemProps)
419
+ }, i);
420
+ return render(child, {
421
+ key: i,
422
+ ...finalItemProps
423
+ });
424
+ };
425
+ const renderChildren = () => {
426
+ if (!children) return null;
427
+ if (Array.isArray(children)) return Children.map(children, (item, i) => renderChild(item, children.length, i));
428
+ if (isFragment(children)) {
429
+ const fragmentChildren = children.props.children;
430
+ const childrenLength = fragmentChildren.length;
431
+ return fragmentChildren.map((item, i) => renderChild(item, childrenLength, i));
432
+ }
433
+ return renderChild(children);
434
+ };
435
+ const renderSimpleArray = (data) => {
436
+ const { length } = data;
437
+ if (length === 0) return null;
438
+ return data.map((item, i) => {
439
+ const key = getKey(item, i);
440
+ const keyName = valueName ?? "children";
441
+ const extendedProps = attachItemProps({
442
+ i,
443
+ length
444
+ });
445
+ const finalItemProps = {
446
+ ...itemProps ? injectItemProps({ [keyName]: item }, extendedProps) : {},
447
+ [keyName]: item
448
+ };
449
+ if (Wrapper) return /* @__PURE__ */ jsx(Wrapper, {
450
+ ...wrapProps ? injectWrapItemProps({ [keyName]: item }, extendedProps) : {},
451
+ children: render(component, finalItemProps)
452
+ }, key);
453
+ return render(component, {
454
+ key,
455
+ ...finalItemProps
456
+ });
457
+ });
458
+ };
459
+ const getObjectKey = (item, index) => {
460
+ if (!itemKey) return item.key ?? item.id ?? item.itemId ?? index;
461
+ if (typeof itemKey === "function") return itemKey(item, index);
462
+ if (typeof itemKey === "string") return item[itemKey];
463
+ return index;
464
+ };
465
+ const renderComplexArray = (data) => {
466
+ const { length } = data;
467
+ if (length === 0) return null;
468
+ return data.map((item, i) => {
469
+ const { component: itemComponent, ...restItem } = item;
470
+ const renderItem = itemComponent ?? component;
471
+ const key = getObjectKey(restItem, i);
472
+ const extendedProps = attachItemProps({
473
+ i,
474
+ length
475
+ });
476
+ const finalItemProps = {
477
+ ...itemProps ? injectItemProps(item, extendedProps) : {},
478
+ ...restItem
479
+ };
480
+ if (Wrapper && !itemComponent) return /* @__PURE__ */ jsx(Wrapper, {
481
+ ...wrapProps ? injectWrapItemProps(item, extendedProps) : {},
482
+ children: render(renderItem, finalItemProps)
483
+ }, key);
484
+ return render(renderItem, {
485
+ key,
486
+ ...finalItemProps
487
+ });
488
+ });
489
+ };
490
+ const renderItems = () => {
491
+ if (children) return renderChildren();
492
+ if (component && Array.isArray(data)) {
493
+ const classified = classifyData(data);
494
+ if (!classified) return null;
495
+ if (classified.type === "simple") return renderSimpleArray(classified.data);
496
+ return renderComplexArray(classified.data);
497
+ }
498
+ return null;
499
+ };
500
+ return renderItems();
452
501
  };
453
502
  Component$6.isIterator = true;
454
503
  Component$6.RESERVED_PROPS = RESERVED_PROPS;
455
504
 
505
+ //#endregion
506
+ //#region src/helpers/Iterator/index.ts
507
+ var Iterator_default = Component$6;
508
+
509
+ //#endregion
510
+ //#region src/List/component.tsx
511
+ /**
512
+ * List component that combines Iterator (data-driven rendering) with an
513
+ * optional Element root wrapper. When `rootElement` is false (default),
514
+ * it renders a bare Iterator as a fragment. When true, the Iterator output
515
+ * is wrapped in an Element that receives all non-iterator props (e.g.,
516
+ * layout, alignment, css), allowing the list to be styled as a single block.
517
+ */
456
518
  const Component$5 = forwardRef(({ rootElement = false, ...props }, ref) => {
457
- const renderedList = React.createElement(Component$6, { ...pick(props, Component$6.RESERVED_PROPS) });
458
- if (!rootElement)
459
- return renderedList;
460
- return (React.createElement(Component$7, { ref: ref, ...omit(props, Component$6.RESERVED_PROPS) }, renderedList));
519
+ const renderedList = /* @__PURE__ */ jsx(Iterator_default, { ...pick(props, Iterator_default.RESERVED_PROPS) });
520
+ if (!rootElement) return renderedList;
521
+ return /* @__PURE__ */ jsx(Element_default, {
522
+ ref,
523
+ ...omit(props, Iterator_default.RESERVED_PROPS),
524
+ children: renderedList
525
+ });
461
526
  });
462
527
  const name$4 = `${PKG_NAME}/List`;
463
528
  Component$5.displayName = name$4;
464
529
  Component$5.pkgName = PKG_NAME;
465
530
  Component$5.VITUS_LABS__COMPONENT = name$4;
466
531
 
467
- // @ts-nocheck
532
+ //#endregion
533
+ //#region src/List/withActiveState.tsx
534
+ /**
535
+ * HOC that adds single or multi selection state management to a list component.
536
+ * Tracks which items are active via a scalar key (single mode) or a Map of
537
+ * key-to-boolean entries (multi mode). Injects `itemProps` callback that
538
+ * provides each item with `active`, `handleItemActive`, `toggleItemActive`,
539
+ * and other selection helpers. Supports `activeItemRequired` to prevent
540
+ * deselecting the last active item.
541
+ */
468
542
  const RESERVED_KEYS = [
469
- 'type',
470
- 'activeItems',
471
- 'itemProps',
472
- 'activeItemRequired',
543
+ "type",
544
+ "activeItems",
545
+ "itemProps",
546
+ "activeItemRequired"
473
547
  ];
474
548
  const component = (WrappedComponent) => {
475
- const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
476
- const Enhanced = (props) => {
477
- const { type = 'single', activeItemRequired, activeItems, itemProps = {}, ...rest } = props;
478
- const initActiveItems = () => {
479
- if (type === 'single') {
480
- if (Array.isArray(activeItems)) {
481
- // eslint-disable-next-line no-console
482
- console.warn('Iterator is type of single. activeItems cannot be an array.');
483
- }
484
- else {
485
- return activeItems;
486
- }
487
- }
488
- else if (type === 'multi') {
489
- const activeItemsHelper = Array.isArray(activeItems)
490
- ? activeItems
491
- : [activeItems];
492
- return new Map(activeItemsHelper.map((id) => [id, true]));
493
- }
494
- return undefined;
495
- };
496
- const [innerActiveItems, setActiveItems] = useState(initActiveItems());
497
- const countActiveItems = (data) => {
498
- let result = 0;
499
- data.forEach((value) => {
500
- if (value)
501
- result += 1;
502
- });
503
- return result;
504
- };
505
- const updateItemState = (key) => {
506
- if (type === 'single') {
507
- setActiveItems((prevState) => {
508
- if (activeItemRequired)
509
- return key;
510
- if (prevState === key)
511
- return undefined;
512
- return key;
513
- });
514
- }
515
- else if (type === 'multi') {
516
- setActiveItems((prevState) => {
517
- // TODO: add conditional type to fix this
518
- const activeItems = new Map(prevState);
519
- if (activeItemRequired &&
520
- activeItems.get(key) &&
521
- countActiveItems(activeItems) === 1) {
522
- return activeItems;
523
- }
524
- activeItems.set(key, !activeItems.get(key));
525
- return activeItems;
526
- });
527
- }
528
- else {
529
- setActiveItems(undefined);
530
- }
531
- };
532
- const handleItemActive = (key) => {
533
- updateItemState(key);
534
- };
535
- const updateAllItemsState = (status) => {
536
- {
537
- setActiveItems(new Map());
538
- }
539
- };
540
- const setItemActive = (key) => {
541
- updateItemState(key);
542
- };
543
- const unsetItemActive = (key) => {
544
- updateItemState(key);
545
- };
546
- const toggleItemActive = (key) => {
547
- updateItemState(key);
548
- };
549
- // const setAllItemsActive = () => {
550
- // updateAllItemsState(true)
551
- // }
552
- const unsetAllItemsActive = () => {
553
- updateAllItemsState();
554
- };
555
- const isItemActive = (key) => {
556
- if (!innerActiveItems)
557
- return false;
558
- if (type === 'single')
559
- return innerActiveItems === key;
560
- if (type === 'multi' && innerActiveItems instanceof Map) {
561
- return !!innerActiveItems.get(key);
562
- }
563
- return false;
564
- };
565
- const attachMultipleProps = {
566
- unsetAllItemsActive,
567
- };
568
- const attachItemProps = (props) => {
569
- const { key } = props;
570
- const defaultItemProps = typeof itemProps === 'object' ? itemProps : itemProps(props);
571
- const result = {
572
- ...defaultItemProps,
573
- active: isItemActive(key),
574
- handleItemActive: () => handleItemActive(key),
575
- setItemActive,
576
- unsetItemActive,
577
- toggleItemActive,
578
- ...(type === 'multi' ? attachMultipleProps : {}),
579
- };
580
- return result;
581
- };
582
- useEffect(() => {
583
- if (type === 'single' && Array.isArray(activeItems)) {
584
- if (process.env.NODE_ENV !== 'production') {
585
- // eslint-disable-next-line no-console
586
- console.error('When type=`single` activeItems must be a single value, not an array');
587
- }
588
- }
589
- }, [type, activeItems]);
590
- return React.createElement(WrappedComponent, { ...rest, itemProps: attachItemProps });
591
- };
592
- Enhanced.RESERVED_KEYS = RESERVED_KEYS;
593
- Enhanced.displayName = `@vitus-labs/elements/List/withActiveState(${displayName})`;
594
- return Enhanced;
549
+ const displayName = WrappedComponent.displayName || WrappedComponent.name || "Component";
550
+ const Enhanced = (props) => {
551
+ const { type = "single", activeItemRequired, activeItems, itemProps = {}, ...rest } = props;
552
+ const initActiveItems = () => {
553
+ if (type === "single") {
554
+ if (!Array.isArray(activeItems)) return activeItems;
555
+ } else if (type === "multi") {
556
+ const activeItemsHelper = Array.isArray(activeItems) ? activeItems : [activeItems];
557
+ return new Map(activeItemsHelper.map((id) => [id, true]));
558
+ }
559
+ };
560
+ const [innerActiveItems, setActiveItems] = useState(initActiveItems());
561
+ const countActiveItems = (data) => {
562
+ let result = 0;
563
+ data.forEach((value) => {
564
+ if (value) result += 1;
565
+ });
566
+ return result;
567
+ };
568
+ const updateItemState = (key) => {
569
+ if (type === "single") setActiveItems((prevState) => {
570
+ if (activeItemRequired) return key;
571
+ if (prevState === key) return void 0;
572
+ return key;
573
+ });
574
+ else if (type === "multi") setActiveItems((prevState) => {
575
+ const activeItems = new Map(prevState);
576
+ if (activeItemRequired && activeItems.get(key) && countActiveItems(activeItems) === 1) return activeItems;
577
+ activeItems.set(key, !activeItems.get(key));
578
+ return activeItems;
579
+ });
580
+ else setActiveItems(void 0);
581
+ };
582
+ const handleItemActive = (key) => {
583
+ updateItemState(key);
584
+ };
585
+ const updateAllItemsState = (status) => {
586
+ if (!status) setActiveItems(/* @__PURE__ */ new Map());
587
+ };
588
+ const setItemActive = (key) => {
589
+ updateItemState(key);
590
+ };
591
+ const unsetItemActive = (key) => {
592
+ updateItemState(key);
593
+ };
594
+ const toggleItemActive = (key) => {
595
+ updateItemState(key);
596
+ };
597
+ const unsetAllItemsActive = () => {
598
+ updateAllItemsState(false);
599
+ };
600
+ const isItemActive = (key) => {
601
+ if (!innerActiveItems) return false;
602
+ if (type === "single") return innerActiveItems === key;
603
+ if (type === "multi" && innerActiveItems instanceof Map) return !!innerActiveItems.get(key);
604
+ return false;
605
+ };
606
+ const attachMultipleProps = { unsetAllItemsActive };
607
+ const attachItemProps = (props) => {
608
+ const { key } = props;
609
+ return {
610
+ ...typeof itemProps === "object" ? itemProps : itemProps(props),
611
+ active: isItemActive(key),
612
+ handleItemActive: () => handleItemActive(key),
613
+ setItemActive,
614
+ unsetItemActive,
615
+ toggleItemActive,
616
+ ...type === "multi" ? attachMultipleProps : {}
617
+ };
618
+ };
619
+ useEffect(() => {
620
+ if (type === "single" && Array.isArray(activeItems)) {
621
+ if (process.env.NODE_ENV !== "production") console.warn("[@vitus-labs/elements] List/withActiveState: `activeItems` was passed as an array but `type` is \"single\". In single selection mode, `activeItems` should be a single key (string | number). The array value will be ignored.");
622
+ }
623
+ }, [type, activeItems]);
624
+ return /* @__PURE__ */ jsx(WrappedComponent, {
625
+ ...rest,
626
+ itemProps: attachItemProps
627
+ });
628
+ };
629
+ Enhanced.RESERVED_KEYS = RESERVED_KEYS;
630
+ Enhanced.displayName = `@vitus-labs/elements/List/withActiveState(${displayName})`;
631
+ return Enhanced;
595
632
  };
596
633
 
597
- const Component$4 = ({ DOMLocation, tag = 'div', children, }) => {
598
- const [element, setElement] = useState();
599
- useEffect(() => {
600
- if (!tag)
601
- return undefined;
602
- const position = DOMLocation ?? document.body;
603
- const element = document.createElement(tag);
604
- setElement(element);
605
- position.appendChild(element);
606
- return () => {
607
- position.removeChild(element);
608
- };
609
- }, [tag, DOMLocation]);
610
- if (!tag || !element)
611
- return null;
612
- return createPortal(children, element);
634
+ //#endregion
635
+ //#region src/List/index.ts
636
+ var List_default = Component$5;
637
+
638
+ //#endregion
639
+ //#region src/Portal/component.ts
640
+ /**
641
+ * Portal component that creates a new DOM element on mount, appends it to
642
+ * the target location (defaults to document.body), and uses React's
643
+ * createPortal to render children into it. The DOM element is cleaned up
644
+ * on unmount. Accepts a custom DOMLocation for rendering into specific
645
+ * containers (e.g., a modal root).
646
+ */
647
+ const Component$4 = ({ DOMLocation, tag = "div", children }) => {
648
+ const [element, setElement] = useState();
649
+ useEffect(() => {
650
+ if (!tag) return void 0;
651
+ const position = DOMLocation ?? document.body;
652
+ const element = document.createElement(tag);
653
+ setElement(element);
654
+ position.appendChild(element);
655
+ return () => {
656
+ position.removeChild(element);
657
+ };
658
+ }, [tag, DOMLocation]);
659
+ if (!tag || !element) return null;
660
+ return createPortal(children, element);
613
661
  };
614
- // ----------------------------------------------
615
- // DEFINE STATICS
616
- // ----------------------------------------------
617
662
  const name$3 = `${PKG_NAME}/Portal`;
618
663
  Component$4.displayName = name$3;
619
664
  Component$4.pkgName = PKG_NAME;
620
665
  Component$4.VITUS_LABS__COMPONENT = name$3;
621
666
 
622
- const context = createContext({});
623
- const { Provider } = context;
624
- const useOverlayContext = () => useContext(context);
625
- const Component$3 = ({ children, blocked, setBlocked, setUnblocked, }) => {
626
- const ctx = useMemo(() => ({
627
- blocked,
628
- setBlocked,
629
- setUnblocked,
630
- }), [blocked, setBlocked, setUnblocked]);
631
- return React.createElement(Provider, { value: ctx }, children);
667
+ //#endregion
668
+ //#region src/Portal/index.ts
669
+ var Portal_default = Component$4;
670
+
671
+ //#endregion
672
+ //#region src/Overlay/context.tsx
673
+ /**
674
+ * Context for nested overlay coordination. When a child overlay opens, it
675
+ * sets the parent's blocked state to true, preventing the parent from
676
+ * closing in response to click/hover events that belong to the child.
677
+ */
678
+ const context$1 = createContext({});
679
+ const { Provider: Provider$1 } = context$1;
680
+ const useOverlayContext = () => useContext(context$1);
681
+ const Component = ({ children, blocked, setBlocked, setUnblocked }) => {
682
+ return /* @__PURE__ */ jsx(Provider$1, {
683
+ value: useMemo(() => ({
684
+ blocked,
685
+ setBlocked,
686
+ setUnblocked
687
+ }), [
688
+ blocked,
689
+ setBlocked,
690
+ setUnblocked
691
+ ]),
692
+ children
693
+ });
632
694
  };
633
695
 
634
- /* eslint-disable no-console */
635
- const useOverlay = ({ isOpen = false, openOn = 'click', // click | hover
636
- closeOn = 'click', // click | 'clickOnTrigger' | 'clickOutsideContent' | hover | manual
637
- type = 'dropdown', // dropdown | tooltip | popover | modal
638
- position = 'fixed', // absolute | fixed | relative | static
639
- align = 'bottom', // main align prop top | left | bottom | right
640
- alignX = 'left', // left | center | right
641
- alignY = 'bottom', // top | center | bottom
642
- offsetX = 0, offsetY = 0, throttleDelay = 200, parentContainer, closeOnEsc = true, disabled, onOpen, onClose, } = {}) => {
643
- const { rootSize } = useContext(context$1);
644
- const ctx = useOverlayContext();
645
- const [isContentLoaded, setContentLoaded] = useState(false);
646
- const [innerAlignX, setInnerAlignX] = useState(alignX);
647
- const [innerAlignY, setInnerAlignY] = useState(alignY);
648
- const [blocked, handleBlocked] = useState(false);
649
- const [active, handleActive] = useState(isOpen);
650
- const triggerRef = useRef(null);
651
- const contentRef = useRef(null);
652
- const setBlocked = useCallback(() => handleBlocked(true), []);
653
- const setUnblocked = useCallback(() => handleBlocked(false), []);
654
- const showContent = useCallback(() => {
655
- handleActive(true);
656
- }, []);
657
- const hideContent = useCallback(() => {
658
- handleActive(false);
659
- }, []);
660
- const calculateContentPosition = useCallback(() => {
661
- const overlayPosition = {};
662
- if (!active || !isContentLoaded)
663
- return overlayPosition;
664
- if (type === 'modal' && !contentRef.current) {
665
- if (IS_DEVELOPMENT) {
666
- console.warn('Cannot access `ref` of `content` component.');
667
- }
668
- return overlayPosition;
669
- }
670
- if (['dropdown', 'tooltip', 'popover'].includes(type)) {
671
- // return empty object when refs are not available
672
- if (!triggerRef.current || !contentRef.current) {
673
- if (IS_DEVELOPMENT) {
674
- console.warn('Cannot access `ref` of trigger or content component.');
675
- }
676
- return overlayPosition;
677
- }
678
- const c = contentRef.current.getBoundingClientRect();
679
- const t = triggerRef.current.getBoundingClientRect();
680
- // align is top or bottom
681
- if (['top', 'bottom'].includes(align)) {
682
- // axe Y position
683
- // (assigned as top position)
684
- const top = t.top - offsetY - c.height;
685
- const bottom = t.bottom + offsetY;
686
- // axe X position
687
- // content position to trigger position
688
- // (assigned as left position)
689
- const left = t.left + offsetX;
690
- const right = t.right - offsetX - c.width;
691
- // calculate possible position
692
- const isTop = top >= 0; // represents window.height = 0
693
- const isBottom = bottom + c.height <= window.innerHeight;
694
- const isLeft = left + c.width <= window.innerWidth;
695
- const isRight = right >= 0; // represents window.width = 0
696
- if (align === 'top') {
697
- setInnerAlignY(isTop ? 'top' : 'bottom');
698
- overlayPosition.top = isTop ? top : bottom;
699
- }
700
- else if (align === 'bottom') {
701
- setInnerAlignY(isBottom ? 'bottom' : 'top');
702
- overlayPosition.top = isBottom ? bottom : top;
703
- }
704
- // left
705
- if (alignX === 'left') {
706
- setInnerAlignX(isLeft ? 'left' : 'right');
707
- overlayPosition.left = isLeft ? left : right;
708
- }
709
- // center
710
- else if (alignX === 'center') {
711
- const center = t.left + (t.right - t.left) / 2 - c.width / 2;
712
- const isCenteredLeft = center >= 0;
713
- const isCenteredRight = center + c.width <= window.innerWidth;
714
- if (isCenteredLeft && isCenteredRight) {
715
- setInnerAlignX('center');
716
- overlayPosition.left = center;
717
- }
718
- else if (isCenteredLeft) {
719
- setInnerAlignX('left');
720
- overlayPosition.left = left;
721
- }
722
- else if (isCenteredRight) {
723
- setInnerAlignX('right');
724
- overlayPosition.left = right;
725
- }
726
- }
727
- // right
728
- else if (alignX === 'right') {
729
- setInnerAlignX(isRight ? 'right' : 'left');
730
- overlayPosition.left = isRight ? right : left;
731
- }
732
- }
733
- // align is left or right
734
- else if (['left', 'right'].includes(align)) {
735
- // axe X position
736
- // (assigned as left position)
737
- const left = t.left - offsetX - c.width;
738
- const right = t.right + offsetX;
739
- // axe Y position
740
- // content position to trigger position
741
- // (assigned as top position)
742
- const top = t.top + offsetY;
743
- const bottom = t.bottom - offsetY - c.height;
744
- const isLeft = left >= 0;
745
- const isRight = right + c.width <= window.innerWidth;
746
- const isTop = top + c.height <= window.innerHeight;
747
- const isBottom = bottom >= 0;
748
- if (align === 'left') {
749
- setInnerAlignX(isLeft ? 'left' : 'right');
750
- overlayPosition.left = isLeft ? left : right;
751
- }
752
- else if (align === 'right') {
753
- setInnerAlignX(isRight ? 'right' : 'left');
754
- overlayPosition.left = isRight ? right : left;
755
- }
756
- // top
757
- if (alignY === 'top') {
758
- setInnerAlignY(isTop ? 'top' : 'bottom');
759
- overlayPosition.top = isTop ? top : bottom;
760
- }
761
- // center
762
- else if (alignY === 'center') {
763
- const center = t.top + (t.bottom - t.top) / 2 - c.height / 2;
764
- const isCenteredTop = center >= 0;
765
- const isCenteredBottom = center + c.height <= window.innerHeight;
766
- if (isCenteredTop && isCenteredBottom) {
767
- setInnerAlignY('center');
768
- overlayPosition.top = center;
769
- }
770
- else if (isCenteredTop) {
771
- setInnerAlignY('top');
772
- overlayPosition.top = top;
773
- }
774
- else if (isCenteredBottom) {
775
- setInnerAlignY('bottom');
776
- overlayPosition.top = bottom;
777
- }
778
- }
779
- // bottom
780
- else if (alignY === 'bottom') {
781
- setInnerAlignY(isBottom ? 'bottom' : 'top');
782
- overlayPosition.top = isBottom ? bottom : top;
783
- }
784
- }
785
- }
786
- // modal type
787
- else if (type === 'modal') {
788
- // return empty object when ref is not available
789
- // triggerRef is not needed in this case
790
- if (!contentRef.current) {
791
- if (IS_DEVELOPMENT) {
792
- console.warn('Cannot access `ref` of trigger or content component.');
793
- }
794
- return overlayPosition;
795
- }
796
- const c = contentRef.current.getBoundingClientRect();
797
- switch (alignX) {
798
- case 'right':
799
- overlayPosition.right = offsetX;
800
- break;
801
- case 'left':
802
- overlayPosition.left = offsetX;
803
- break;
804
- case 'center':
805
- overlayPosition.left = window.innerWidth / 2 - c.width / 2;
806
- break;
807
- default:
808
- overlayPosition.right = offsetX;
809
- }
810
- switch (alignY) {
811
- case 'top':
812
- overlayPosition.top = offsetY;
813
- break;
814
- case 'center':
815
- overlayPosition.top = window.innerHeight / 2 - c.height / 2;
816
- break;
817
- case 'bottom':
818
- overlayPosition.bottom = offsetY;
819
- break;
820
- default:
821
- overlayPosition.top = offsetY;
822
- }
823
- }
824
- return overlayPosition;
825
- }, [
826
- isContentLoaded,
827
- active,
828
- align,
829
- alignX,
830
- alignY,
831
- offsetX,
832
- offsetY,
833
- type,
834
- triggerRef,
835
- contentRef,
836
- ]);
837
- const assignContentPosition = useCallback((values = {}) => {
838
- if (!contentRef.current)
839
- return;
840
- const isValue = (value) => {
841
- if (typeof value === 'number')
842
- return true;
843
- if (Number.isFinite(value))
844
- return true;
845
- return !!value;
846
- };
847
- const setValue = (param) => value(param, rootSize);
848
- // ADD POSITION STYLES TO CONTENT
849
- // eslint-disable-next-line no-param-reassign
850
- if (isValue(position))
851
- contentRef.current.style.position = position;
852
- // eslint-disable-next-line no-param-reassign
853
- if (isValue(values.top))
854
- contentRef.current.style.top = setValue(values.top);
855
- // eslint-disable-next-line no-param-reassign
856
- if (isValue(values.bottom))
857
- contentRef.current.style.bottom = setValue(values.bottom);
858
- // eslint-disable-next-line no-param-reassign
859
- if (isValue(values.left))
860
- contentRef.current.style.left = setValue(values.left);
861
- // eslint-disable-next-line no-param-reassign
862
- if (isValue(values.right))
863
- contentRef.current.style.right = setValue(values.right);
864
- }, [position, rootSize, contentRef]);
865
- const setContentPosition = useCallback(() => {
866
- const currentPosition = calculateContentPosition();
867
- assignContentPosition(currentPosition);
868
- }, [assignContentPosition, calculateContentPosition]);
869
- const isNodeOrChild = (ref /* | typeof contentRef */) => (e) => {
870
- if (e?.target && ref.current) {
871
- return (ref.current.contains(e.target) || e.target === ref.current);
872
- }
873
- return false;
874
- };
875
- const handleVisibilityByEventType = useCallback((e) => {
876
- if (blocked || disabled)
877
- return;
878
- const isTrigger = isNodeOrChild(triggerRef);
879
- const isContent = isNodeOrChild(contentRef);
880
- // showing content observing
881
- if (!active) {
882
- if ((openOn === 'hover' && e.type === 'mousemove') ||
883
- (openOn === 'click' && e.type === 'click')) {
884
- if (isTrigger(e)) {
885
- showContent();
886
- }
887
- }
888
- }
889
- // hiding content observing
890
- if (active) {
891
- if (closeOn === 'hover' &&
892
- e.type === 'mousemove' &&
893
- !isTrigger(e) &&
894
- !isContent(e)) {
895
- hideContent();
896
- }
897
- if (closeOn === 'hover' && e.type === 'scroll') {
898
- hideContent();
899
- }
900
- if (closeOn === 'click' && e.type === 'click') {
901
- hideContent();
902
- }
903
- if (closeOn === 'clickOnTrigger' && e.type === 'click') {
904
- if (isTrigger(e)) {
905
- hideContent();
906
- }
907
- }
908
- if (closeOn === 'clickOutsideContent' && e.type === 'click') {
909
- if (!isContent(e)) {
910
- hideContent();
911
- }
912
- }
913
- }
914
- }, [
915
- active,
916
- blocked,
917
- disabled,
918
- openOn,
919
- closeOn,
920
- hideContent,
921
- showContent,
922
- triggerRef,
923
- contentRef,
924
- ]);
925
- const handleContentPosition = useCallback(throttle(setContentPosition, throttleDelay),
926
- // same deps as `setContentPosition`
927
- [assignContentPosition, calculateContentPosition]);
928
- const handleClick = handleVisibilityByEventType;
929
- const handleVisibility = useCallback(throttle(handleVisibilityByEventType, throttleDelay),
930
- // same deps as `handleVisibilityByEventType`
931
- [
932
- active,
933
- blocked,
934
- disabled,
935
- openOn,
936
- closeOn,
937
- hideContent,
938
- showContent,
939
- triggerRef,
940
- contentRef,
941
- ]);
942
- // --------------------------------------------------------------------------
943
- // useEffects
944
- // --------------------------------------------------------------------------
945
- useEffect(() => {
946
- setInnerAlignX(alignX);
947
- setInnerAlignY(alignY);
948
- if (disabled) {
949
- hideContent();
950
- }
951
- }, [disabled, alignX, alignY, hideContent]);
952
- useEffect(() => {
953
- if (!active || !isContentLoaded)
954
- return undefined;
955
- setContentPosition();
956
- setContentPosition();
957
- return undefined;
958
- }, [active, isContentLoaded, setContentPosition]);
959
- // if an Overlay has an Overlay child, this will prevent closing parent child
960
- // and calculates correct position when an Overlay is opened
961
- useEffect(() => {
962
- if (active) {
963
- if (onOpen)
964
- onOpen();
965
- if (ctx.setBlocked)
966
- ctx.setBlocked();
967
- }
968
- else {
969
- setContentLoaded(false);
970
- }
971
- return () => {
972
- if (onClose)
973
- onClose();
974
- if (ctx.setUnblocked)
975
- ctx.setUnblocked();
976
- };
977
- }, [active, showContent, ctx]);
978
- // handle closing only when content is active
979
- useEffect(() => {
980
- if (!closeOnEsc || !active || blocked)
981
- return undefined;
982
- const handleEscKey = (e) => {
983
- if (e.key === 'Escape') {
984
- hideContent();
985
- }
986
- };
987
- window.addEventListener('keydown', handleEscKey);
988
- return () => {
989
- window.removeEventListener('keydown', handleEscKey);
990
- };
991
- }, [active, blocked, closeOnEsc, hideContent]);
992
- // handles repositioning of content on document events
993
- useEffect(() => {
994
- if (!active)
995
- return undefined;
996
- const shouldSetOverflow = type === 'modal';
997
- const onScroll = (e) => {
998
- handleContentPosition();
999
- handleVisibility(e);
1000
- };
1001
- if (shouldSetOverflow)
1002
- document.body.style.overflow = 'hidden';
1003
- window.addEventListener('resize', handleContentPosition);
1004
- window.addEventListener('scroll', onScroll);
1005
- return () => {
1006
- if (shouldSetOverflow)
1007
- document.body.style.overflow = '';
1008
- window.removeEventListener('resize', handleContentPosition);
1009
- window.removeEventListener('scroll', onScroll);
1010
- };
1011
- }, [active, type, handleVisibility, handleContentPosition]);
1012
- // handles repositioning of content on a custom element if defined
1013
- useEffect(() => {
1014
- if (!active || !parentContainer)
1015
- return undefined;
1016
- // eslint-disable-next-line no-param-reassign
1017
- if (closeOn !== 'hover')
1018
- parentContainer.style.overflow = 'hidden';
1019
- const onScroll = (e) => {
1020
- handleContentPosition();
1021
- handleVisibility(e);
1022
- };
1023
- parentContainer.addEventListener('scroll', onScroll);
1024
- return () => {
1025
- // eslint-disable-next-line no-param-reassign
1026
- parentContainer.style.overflow = '';
1027
- parentContainer.removeEventListener('scroll', onScroll);
1028
- };
1029
- }, [
1030
- active,
1031
- parentContainer,
1032
- closeOn,
1033
- handleContentPosition,
1034
- handleVisibility,
1035
- ]);
1036
- // enable overlay manipulation only when the state is NOT blocked
1037
- // nor in disabled state
1038
- useEffect(() => {
1039
- if (blocked || disabled)
1040
- return undefined;
1041
- const enabledMouseMove = openOn === 'hover' || closeOn === 'hover';
1042
- const enabledClick = openOn === 'click' ||
1043
- ['click', 'clickOnTrigger', 'clickOutsideContent'].includes(closeOn);
1044
- if (enabledClick) {
1045
- window.addEventListener('click', handleClick);
1046
- }
1047
- if (enabledMouseMove) {
1048
- window.addEventListener('mousemove', handleVisibility);
1049
- }
1050
- return () => {
1051
- window.removeEventListener('click', handleClick);
1052
- window.removeEventListener('mousemove', handleVisibility);
1053
- };
1054
- }, [
1055
- openOn,
1056
- closeOn,
1057
- blocked,
1058
- disabled,
1059
- active,
1060
- handleClick,
1061
- handleVisibility,
1062
- ]);
1063
- // hack-ish way to load content correctly on the first load
1064
- // as `contentRef` is loaded dynamically
1065
- const contentRefCallback = useCallback((node) => {
1066
- if (node) {
1067
- contentRef.current = node;
1068
- setContentLoaded(true);
1069
- }
1070
- }, []);
1071
- return {
1072
- triggerRef,
1073
- contentRef: contentRefCallback,
1074
- active,
1075
- align,
1076
- alignX: innerAlignX,
1077
- alignY: innerAlignY,
1078
- showContent,
1079
- hideContent,
1080
- blocked,
1081
- setBlocked,
1082
- setUnblocked,
1083
- Provider: Component$3,
1084
- };
696
+ //#endregion
697
+ //#region src/Overlay/useOverlay.tsx
698
+ /**
699
+ * Core hook powering the Overlay component. Manages open/close state, DOM
700
+ * event listeners (click, hover, scroll, resize, ESC key), and dynamic
701
+ * positioning of overlay content relative to its trigger. Supports dropdown,
702
+ * tooltip, popover, and modal types with automatic edge-of-viewport flipping.
703
+ * Event handlers are throttled for performance, and nested overlay blocking
704
+ * is coordinated through the overlay context.
705
+ */
706
+ const sel = (cond, a, b) => cond ? a : b;
707
+ const devWarn = (msg) => {
708
+ if (!IS_DEVELOPMENT) return;
709
+ console.warn(msg);
710
+ };
711
+ const calcDropdownVertical = (c, t, align, alignX, offsetX, offsetY) => {
712
+ const pos = {};
713
+ const topPos = t.top - offsetY - c.height;
714
+ const bottomPos = t.bottom + offsetY;
715
+ const leftPos = t.left + offsetX;
716
+ const rightPos = t.right - offsetX - c.width;
717
+ const fitsTop = topPos >= 0;
718
+ const fitsBottom = bottomPos + c.height <= window.innerHeight;
719
+ const fitsLeft = leftPos + c.width <= window.innerWidth;
720
+ const fitsRight = rightPos >= 0;
721
+ const useTop = sel(align === "top", fitsTop, !fitsBottom);
722
+ pos.top = sel(useTop, topPos, bottomPos);
723
+ const resolvedAlignY = sel(useTop, "top", "bottom");
724
+ let resolvedAlignX = alignX;
725
+ if (alignX === "left") {
726
+ pos.left = sel(fitsLeft, leftPos, rightPos);
727
+ resolvedAlignX = sel(fitsLeft, "left", "right");
728
+ } else if (alignX === "right") {
729
+ pos.left = sel(fitsRight, rightPos, leftPos);
730
+ resolvedAlignX = sel(fitsRight, "right", "left");
731
+ } else {
732
+ const center = t.left + (t.right - t.left) / 2 - c.width / 2;
733
+ const fitsCL = center >= 0;
734
+ const fitsCR = center + c.width <= window.innerWidth;
735
+ if (fitsCL && fitsCR) {
736
+ resolvedAlignX = "center";
737
+ pos.left = center;
738
+ } else if (fitsCL) {
739
+ resolvedAlignX = "left";
740
+ pos.left = leftPos;
741
+ } else if (fitsCR) {
742
+ resolvedAlignX = "right";
743
+ pos.left = rightPos;
744
+ }
745
+ }
746
+ return {
747
+ pos,
748
+ resolvedAlignX,
749
+ resolvedAlignY
750
+ };
751
+ };
752
+ const calcDropdownHorizontal = (c, t, align, alignY, offsetX, offsetY) => {
753
+ const pos = {};
754
+ const leftPos = t.left - offsetX - c.width;
755
+ const rightPos = t.right + offsetX;
756
+ const topPos = t.top + offsetY;
757
+ const bottomPos = t.bottom - offsetY - c.height;
758
+ const fitsLeft = leftPos >= 0;
759
+ const fitsRight = rightPos + c.width <= window.innerWidth;
760
+ const fitsTop = topPos + c.height <= window.innerHeight;
761
+ const fitsBottom = bottomPos >= 0;
762
+ const useLeft = sel(align === "left", fitsLeft, !fitsRight);
763
+ pos.left = sel(useLeft, leftPos, rightPos);
764
+ const resolvedAlignX = sel(useLeft, "left", "right");
765
+ let resolvedAlignY = alignY;
766
+ if (alignY === "top") {
767
+ pos.top = sel(fitsTop, topPos, bottomPos);
768
+ resolvedAlignY = sel(fitsTop, "top", "bottom");
769
+ } else if (alignY === "bottom") {
770
+ pos.top = sel(fitsBottom, bottomPos, topPos);
771
+ resolvedAlignY = sel(fitsBottom, "bottom", "top");
772
+ } else {
773
+ const center = t.top + (t.bottom - t.top) / 2 - c.height / 2;
774
+ const fitsCT = center >= 0;
775
+ const fitsCB = center + c.height <= window.innerHeight;
776
+ if (fitsCT && fitsCB) {
777
+ resolvedAlignY = "center";
778
+ pos.top = center;
779
+ } else if (fitsCT) {
780
+ resolvedAlignY = "top";
781
+ pos.top = topPos;
782
+ } else if (fitsCB) {
783
+ resolvedAlignY = "bottom";
784
+ pos.top = bottomPos;
785
+ }
786
+ }
787
+ return {
788
+ pos,
789
+ resolvedAlignX,
790
+ resolvedAlignY
791
+ };
792
+ };
793
+ const calcModalPos = (c, alignX, alignY, offsetX, offsetY) => {
794
+ const pos = {};
795
+ switch (alignX) {
796
+ case "right":
797
+ pos.right = offsetX;
798
+ break;
799
+ case "left":
800
+ pos.left = offsetX;
801
+ break;
802
+ case "center":
803
+ pos.left = window.innerWidth / 2 - c.width / 2;
804
+ break;
805
+ default: pos.right = offsetX;
806
+ }
807
+ switch (alignY) {
808
+ case "top":
809
+ pos.top = offsetY;
810
+ break;
811
+ case "center":
812
+ pos.top = window.innerHeight / 2 - c.height / 2;
813
+ break;
814
+ case "bottom":
815
+ pos.bottom = offsetY;
816
+ break;
817
+ default: pos.top = offsetY;
818
+ }
819
+ return pos;
820
+ };
821
+ const adjustForAncestor = (pos, ancestor) => {
822
+ if (ancestor.top === 0 && ancestor.left === 0) return pos;
823
+ const result = { ...pos };
824
+ if (typeof result.top === "number") result.top -= ancestor.top;
825
+ if (typeof result.bottom === "number") result.bottom += ancestor.top;
826
+ if (typeof result.left === "number") result.left -= ancestor.left;
827
+ if (typeof result.right === "number") result.right += ancestor.left;
828
+ return result;
829
+ };
830
+ const computePosition = (type, align, alignX, alignY, offsetX, offsetY, triggerEl, contentEl, ancestorOffset) => {
831
+ const isDropdown = [
832
+ "dropdown",
833
+ "tooltip",
834
+ "popover"
835
+ ].includes(type);
836
+ if (isDropdown && (!triggerEl || !contentEl)) {
837
+ devWarn(`[@vitus-labs/elements] Overlay (${type}): ${triggerEl ? "contentRef" : "triggerRef"} is not attached. Position cannot be calculated without both refs.`);
838
+ return { pos: {} };
839
+ }
840
+ if (isDropdown && triggerEl && contentEl) {
841
+ const c = contentEl.getBoundingClientRect();
842
+ const t = triggerEl.getBoundingClientRect();
843
+ const result = align === "top" || align === "bottom" ? calcDropdownVertical(c, t, align, alignX, offsetX, offsetY) : calcDropdownHorizontal(c, t, align, alignY, offsetX, offsetY);
844
+ return {
845
+ pos: adjustForAncestor(result.pos, ancestorOffset),
846
+ resolvedAlignX: result.resolvedAlignX,
847
+ resolvedAlignY: result.resolvedAlignY
848
+ };
849
+ }
850
+ if (type === "modal") {
851
+ if (!contentEl) {
852
+ devWarn("[@vitus-labs/elements] Overlay (modal): contentRef is not attached. Modal position cannot be calculated without a content element.");
853
+ return { pos: {} };
854
+ }
855
+ return { pos: adjustForAncestor(calcModalPos(contentEl.getBoundingClientRect(), alignX, alignY, offsetX, offsetY), ancestorOffset) };
856
+ }
857
+ return { pos: {} };
858
+ };
859
+ const processVisibilityEvent = (e, active, openOn, closeOn, isTrigger, isContent, showContent, hideContent) => {
860
+ if (!active && openOn === "click" && e.type === "click" && isTrigger(e)) {
861
+ showContent();
862
+ return;
863
+ }
864
+ if (!active) return;
865
+ if (closeOn === "hover" && e.type === "scroll") {
866
+ hideContent();
867
+ return;
868
+ }
869
+ if (e.type !== "click") return;
870
+ if (closeOn === "click") hideContent();
871
+ else if (closeOn === "clickOnTrigger" && isTrigger(e)) hideContent();
872
+ else if (closeOn === "clickOutsideContent" && !isContent(e)) hideContent();
873
+ };
874
+ const useOverlay = ({ isOpen = false, openOn = "click", closeOn = "click", type = "dropdown", position = "fixed", align = "bottom", alignX = "left", alignY = "bottom", offsetX = 0, offsetY = 0, throttleDelay = 200, parentContainer, closeOnEsc = true, disabled, onOpen, onClose } = {}) => {
875
+ const { rootSize } = useContext(context);
876
+ const ctx = useOverlayContext();
877
+ const [isContentLoaded, setContentLoaded] = useState(false);
878
+ const [innerAlignX, setInnerAlignX] = useState(alignX);
879
+ const [innerAlignY, setInnerAlignY] = useState(alignY);
880
+ const [blocked, handleBlocked] = useState(false);
881
+ const [active, handleActive] = useState(isOpen);
882
+ const triggerRef = useRef(null);
883
+ const contentRef = useRef(null);
884
+ const setBlocked = useCallback(() => handleBlocked(true), []);
885
+ const setUnblocked = useCallback(() => handleBlocked(false), []);
886
+ const showContent = useCallback(() => {
887
+ handleActive(true);
888
+ }, []);
889
+ const hideContent = useCallback(() => {
890
+ handleActive(false);
891
+ }, []);
892
+ const getAncestorOffset = useCallback(() => {
893
+ if (position !== "absolute" || !contentRef.current) return {
894
+ top: 0,
895
+ left: 0
896
+ };
897
+ const offsetParent = contentRef.current.offsetParent;
898
+ if (!offsetParent || offsetParent === document.body) return {
899
+ top: 0,
900
+ left: 0
901
+ };
902
+ const rect = offsetParent.getBoundingClientRect();
903
+ return {
904
+ top: rect.top,
905
+ left: rect.left
906
+ };
907
+ }, [position]);
908
+ const calculateContentPosition = useCallback(() => {
909
+ if (!active || !isContentLoaded) return {};
910
+ const result = computePosition(type, align, alignX, alignY, offsetX, offsetY, triggerRef.current, contentRef.current, getAncestorOffset());
911
+ if (result.resolvedAlignX) setInnerAlignX(result.resolvedAlignX);
912
+ if (result.resolvedAlignY) setInnerAlignY(result.resolvedAlignY);
913
+ return result.pos;
914
+ }, [
915
+ isContentLoaded,
916
+ active,
917
+ align,
918
+ alignX,
919
+ alignY,
920
+ offsetX,
921
+ offsetY,
922
+ type,
923
+ getAncestorOffset
924
+ ]);
925
+ const assignContentPosition = useCallback((values = {}) => {
926
+ if (!contentRef.current) return;
927
+ const el = contentRef.current;
928
+ const setValue = (param) => value(param, rootSize);
929
+ el.style.position = position;
930
+ el.style.top = values.top != null ? setValue(values.top) : "";
931
+ el.style.bottom = values.bottom != null ? setValue(values.bottom) : "";
932
+ el.style.left = values.left != null ? setValue(values.left) : "";
933
+ el.style.right = values.right != null ? setValue(values.right) : "";
934
+ }, [position, rootSize]);
935
+ const setContentPosition = useCallback(() => {
936
+ assignContentPosition(calculateContentPosition());
937
+ }, [assignContentPosition, calculateContentPosition]);
938
+ const isNodeOrChild = useCallback((ref) => (e) => {
939
+ if (e?.target && ref.current) return ref.current.contains(e.target) || e.target === ref.current;
940
+ return false;
941
+ }, []);
942
+ const handleVisibilityByEventType = useCallback((e) => {
943
+ if (blocked || disabled) return;
944
+ processVisibilityEvent(e, active, openOn, closeOn, isNodeOrChild(triggerRef), isNodeOrChild(contentRef), showContent, hideContent);
945
+ }, [
946
+ active,
947
+ blocked,
948
+ disabled,
949
+ openOn,
950
+ closeOn,
951
+ hideContent,
952
+ showContent,
953
+ isNodeOrChild
954
+ ]);
955
+ const latestSetContentPosition = useRef(setContentPosition);
956
+ latestSetContentPosition.current = setContentPosition;
957
+ const latestHandleVisibility = useRef(handleVisibilityByEventType);
958
+ latestHandleVisibility.current = handleVisibilityByEventType;
959
+ const handleContentPosition = useMemo(() => throttle(() => latestSetContentPosition.current(), throttleDelay), [throttleDelay]);
960
+ const handleClick = handleVisibilityByEventType;
961
+ const handleVisibility = useMemo(() => throttle((e) => latestHandleVisibility.current(e), throttleDelay), [throttleDelay]);
962
+ useEffect(() => {
963
+ setInnerAlignX(alignX);
964
+ setInnerAlignY(alignY);
965
+ if (disabled) hideContent();
966
+ }, [
967
+ disabled,
968
+ alignX,
969
+ alignY,
970
+ hideContent
971
+ ]);
972
+ useEffect(() => {
973
+ if (!active || !isContentLoaded) return void 0;
974
+ setContentPosition();
975
+ const rafId = requestAnimationFrame(() => setContentPosition());
976
+ return () => cancelAnimationFrame(rafId);
977
+ }, [
978
+ active,
979
+ isContentLoaded,
980
+ setContentPosition
981
+ ]);
982
+ const prevActiveRef = useRef(false);
983
+ useEffect(() => {
984
+ const wasActive = prevActiveRef.current;
985
+ prevActiveRef.current = active;
986
+ if (active && !wasActive) {
987
+ onOpen?.();
988
+ ctx.setBlocked?.();
989
+ } else if (!active && wasActive) {
990
+ setContentLoaded(false);
991
+ onClose?.();
992
+ ctx.setUnblocked?.();
993
+ } else if (!active) setContentLoaded(false);
994
+ return () => {
995
+ if (active) {
996
+ onClose?.();
997
+ ctx.setUnblocked?.();
998
+ }
999
+ };
1000
+ }, [
1001
+ active,
1002
+ ctx,
1003
+ onClose,
1004
+ onOpen
1005
+ ]);
1006
+ useEffect(() => {
1007
+ if (!closeOnEsc || !active || blocked) return void 0;
1008
+ const handleEscKey = (e) => {
1009
+ if (e.key === "Escape") hideContent();
1010
+ };
1011
+ window.addEventListener("keydown", handleEscKey);
1012
+ return () => {
1013
+ window.removeEventListener("keydown", handleEscKey);
1014
+ };
1015
+ }, [
1016
+ active,
1017
+ blocked,
1018
+ closeOnEsc,
1019
+ hideContent
1020
+ ]);
1021
+ useEffect(() => {
1022
+ if (!active) return void 0;
1023
+ const shouldSetOverflow = type === "modal";
1024
+ const onScroll = (e) => {
1025
+ handleContentPosition();
1026
+ handleVisibility(e);
1027
+ };
1028
+ if (shouldSetOverflow) document.body.style.overflow = "hidden";
1029
+ window.addEventListener("resize", handleContentPosition);
1030
+ window.addEventListener("scroll", onScroll, { passive: true });
1031
+ return () => {
1032
+ if (shouldSetOverflow) document.body.style.overflow = "";
1033
+ window.removeEventListener("resize", handleContentPosition);
1034
+ window.removeEventListener("scroll", onScroll);
1035
+ };
1036
+ }, [
1037
+ active,
1038
+ type,
1039
+ handleVisibility,
1040
+ handleContentPosition
1041
+ ]);
1042
+ useEffect(() => {
1043
+ if (!active || !parentContainer) return void 0;
1044
+ if (closeOn !== "hover") parentContainer.style.overflow = "hidden";
1045
+ const onScroll = (e) => {
1046
+ handleContentPosition();
1047
+ handleVisibility(e);
1048
+ };
1049
+ parentContainer.addEventListener("scroll", onScroll, { passive: true });
1050
+ return () => {
1051
+ parentContainer.style.overflow = "";
1052
+ parentContainer.removeEventListener("scroll", onScroll);
1053
+ };
1054
+ }, [
1055
+ active,
1056
+ parentContainer,
1057
+ closeOn,
1058
+ handleContentPosition,
1059
+ handleVisibility
1060
+ ]);
1061
+ useEffect(() => {
1062
+ if (blocked || disabled) return void 0;
1063
+ if (openOn === "click" || [
1064
+ "click",
1065
+ "clickOnTrigger",
1066
+ "clickOutsideContent"
1067
+ ].includes(closeOn)) window.addEventListener("click", handleClick);
1068
+ return () => {
1069
+ window.removeEventListener("click", handleClick);
1070
+ };
1071
+ }, [
1072
+ openOn,
1073
+ closeOn,
1074
+ blocked,
1075
+ disabled,
1076
+ handleClick
1077
+ ]);
1078
+ const hoverTimeoutRef = useRef(null);
1079
+ useEffect(() => {
1080
+ if (blocked || disabled || !(openOn === "hover" || closeOn === "hover")) return void 0;
1081
+ const trigger = triggerRef.current;
1082
+ const content = contentRef.current;
1083
+ const clearHoverTimeout = () => {
1084
+ if (hoverTimeoutRef.current != null) {
1085
+ clearTimeout(hoverTimeoutRef.current);
1086
+ hoverTimeoutRef.current = null;
1087
+ }
1088
+ };
1089
+ const scheduleHide = () => {
1090
+ clearHoverTimeout();
1091
+ hoverTimeoutRef.current = setTimeout(hideContent, 100);
1092
+ };
1093
+ const onTriggerEnter = () => {
1094
+ clearHoverTimeout();
1095
+ if (openOn === "hover" && !active) showContent();
1096
+ };
1097
+ const onTriggerLeave = () => {
1098
+ if (closeOn === "hover" && active) scheduleHide();
1099
+ };
1100
+ const onContentEnter = () => {
1101
+ clearHoverTimeout();
1102
+ };
1103
+ const onContentLeave = () => {
1104
+ if (closeOn === "hover" && active) scheduleHide();
1105
+ };
1106
+ if (trigger) {
1107
+ trigger.addEventListener("mouseenter", onTriggerEnter);
1108
+ trigger.addEventListener("mouseleave", onTriggerLeave);
1109
+ }
1110
+ if (content) {
1111
+ content.addEventListener("mouseenter", onContentEnter);
1112
+ content.addEventListener("mouseleave", onContentLeave);
1113
+ }
1114
+ return () => {
1115
+ clearHoverTimeout();
1116
+ if (trigger) {
1117
+ trigger.removeEventListener("mouseenter", onTriggerEnter);
1118
+ trigger.removeEventListener("mouseleave", onTriggerLeave);
1119
+ }
1120
+ if (content) {
1121
+ content.removeEventListener("mouseenter", onContentEnter);
1122
+ content.removeEventListener("mouseleave", onContentLeave);
1123
+ }
1124
+ };
1125
+ }, [
1126
+ active,
1127
+ isContentLoaded,
1128
+ blocked,
1129
+ disabled,
1130
+ openOn,
1131
+ closeOn,
1132
+ showContent,
1133
+ hideContent
1134
+ ]);
1135
+ return {
1136
+ triggerRef,
1137
+ contentRef: useCallback((node) => {
1138
+ if (node) {
1139
+ contentRef.current = node;
1140
+ setContentLoaded(true);
1141
+ }
1142
+ }, []),
1143
+ active,
1144
+ align,
1145
+ alignX: innerAlignX,
1146
+ alignY: innerAlignY,
1147
+ showContent,
1148
+ hideContent,
1149
+ blocked,
1150
+ setBlocked,
1151
+ setUnblocked,
1152
+ Provider: Component
1153
+ };
1085
1154
  };
1086
1155
 
1087
- const IS_BROWSER = typeof window !== 'undefined';
1088
- const Component$2 = ({ children, trigger, DOMLocation, triggerRefName = 'ref', contentRefName = 'ref', ...props }) => {
1089
- const { active, triggerRef, contentRef, showContent, hideContent, align, alignX, alignY, Provider, ...ctx } = useOverlay(props);
1090
- const { openOn, closeOn } = props;
1091
- const passHandlers = useMemo(() => openOn === 'manual' ||
1092
- closeOn === 'manual' ||
1093
- closeOn === 'clickOutsideContent', [openOn, closeOn]);
1094
- return (React.createElement(React.Fragment, null,
1095
- render(trigger, {
1096
- [triggerRefName]: triggerRef,
1097
- active,
1098
- ...(passHandlers ? { showContent, hideContent } : {}),
1099
- }),
1100
- IS_BROWSER && active && (React.createElement(Component$4, { DOMLocation: DOMLocation },
1101
- React.createElement(Provider, { ...ctx }, render(children, {
1102
- [contentRefName]: contentRef,
1103
- active,
1104
- align,
1105
- alignX,
1106
- alignY,
1107
- ...(passHandlers ? { showContent, hideContent } : {}),
1108
- }))))));
1156
+ //#endregion
1157
+ //#region src/Overlay/component.tsx
1158
+ /**
1159
+ * Overlay component that renders a trigger element and conditionally shows
1160
+ * content via a Portal. The trigger receives a ref and optional show/hide
1161
+ * callbacks; the content is positioned and managed by the useOverlay hook.
1162
+ * A context Provider wraps the content to support nested overlays (e.g.,
1163
+ * a dropdown inside another dropdown) via blocked-state propagation.
1164
+ */
1165
+ const IS_BROWSER = typeof window !== "undefined";
1166
+ const Component$3 = ({ children, trigger, DOMLocation, triggerRefName = "ref", contentRefName = "ref", ...props }) => {
1167
+ const { active, triggerRef, contentRef, showContent, hideContent, align, alignX, alignY, Provider, ...ctx } = useOverlay(props);
1168
+ const { openOn, closeOn } = props;
1169
+ const passHandlers = useMemo(() => openOn === "manual" || closeOn === "manual" || closeOn === "clickOutsideContent", [openOn, closeOn]);
1170
+ return /* @__PURE__ */ jsxs(Fragment, { children: [render(trigger, {
1171
+ [triggerRefName]: triggerRef,
1172
+ active,
1173
+ ...passHandlers ? {
1174
+ showContent,
1175
+ hideContent
1176
+ } : {}
1177
+ }), IS_BROWSER && active && /* @__PURE__ */ jsx(Portal_default, {
1178
+ DOMLocation,
1179
+ children: /* @__PURE__ */ jsx(Provider, {
1180
+ ...ctx,
1181
+ children: render(children, {
1182
+ [contentRefName]: contentRef,
1183
+ active,
1184
+ align,
1185
+ alignX,
1186
+ alignY,
1187
+ ...passHandlers ? {
1188
+ showContent,
1189
+ hideContent
1190
+ } : {}
1191
+ })
1192
+ })
1193
+ })] });
1109
1194
  };
1110
1195
  const name$2 = `${PKG_NAME}/Overlay`;
1111
- Component$2.displayName = name$2;
1112
- Component$2.pkgName = PKG_NAME;
1113
- Component$2.VITUS_LABS__COMPONENT = name$2;
1196
+ Component$3.displayName = name$2;
1197
+ Component$3.pkgName = PKG_NAME;
1198
+ Component$3.VITUS_LABS__COMPONENT = name$2;
1114
1199
 
1200
+ //#endregion
1201
+ //#region src/Overlay/index.ts
1202
+ var Overlay_default = Component$3;
1203
+
1204
+ //#endregion
1205
+ //#region src/Text/styled.ts
1206
+ /**
1207
+ * Styled text primitive that inherits color, font-weight, and line-height
1208
+ * from its parent so it blends seamlessly into any context. Additional
1209
+ * styles can be injected via the responsive `extraStyles` prop processed
1210
+ * through makeItResponsive.
1211
+ */
1115
1212
  const { styled, css, textComponent } = config;
1116
- const styles = ({ css, theme: t }) => css `
1213
+ const styles = ({ css, theme: t }) => css`
1117
1214
  ${t.extraStyles && extendCss(t.extraStyles)};
1118
1215
  `;
1119
- var Styled = styled(textComponent) `
1216
+ var styled_default = styled(textComponent)`
1120
1217
  color: inherit;
1121
1218
  font-weight: inherit;
1122
1219
  line-height: 1;
1123
1220
 
1124
1221
  ${makeItResponsive({
1125
- key: '$text',
1126
- styles,
1127
- css,
1128
- normalize: false,
1222
+ key: "$text",
1223
+ styles,
1224
+ css,
1225
+ normalize: false
1129
1226
  })};
1130
1227
  `;
1131
1228
 
1132
- const Component$1 = forwardRef(({ paragraph, label, children, tag, css, ...props }, ref) => {
1133
- const renderContent = (as = undefined) => (React.createElement(Styled, { ref: ref, as: as, "$text": { extraStyles: css }, ...props }, children ?? label));
1134
- let finalTag;
1135
- return renderContent(finalTag);
1229
+ //#endregion
1230
+ //#region src/Text/component.tsx
1231
+ const Component$2 = forwardRef(({ paragraph, label, children, tag, css, ...props }, ref) => {
1232
+ const renderContent = (as = void 0) => /* @__PURE__ */ jsx(styled_default, {
1233
+ ref,
1234
+ as,
1235
+ $text: { extraStyles: css },
1236
+ ...props,
1237
+ children: children ?? label
1238
+ });
1239
+ let finalTag;
1240
+ return renderContent(finalTag);
1136
1241
  });
1137
- // ----------------------------------------------
1138
- // DEFINE STATICS
1139
- // ----------------------------------------------
1140
1242
  const name$1 = `${PKG_NAME}/Text`;
1141
- Component$1.displayName = name$1;
1142
- Component$1.pkgName = PKG_NAME;
1143
- Component$1.VITUS_LABS__COMPONENT = name$1;
1144
- Component$1.isText = true;
1243
+ Component$2.displayName = name$1;
1244
+ Component$2.pkgName = PKG_NAME;
1245
+ Component$2.VITUS_LABS__COMPONENT = name$1;
1246
+ Component$2.isText = true;
1247
+
1248
+ //#endregion
1249
+ //#region src/Text/index.ts
1250
+ var Text_default = Component$2;
1145
1251
 
1146
- const Component = ({ children, className, style }) => {
1147
- const mergedClasses = useMemo(() => (Array.isArray(className) ? className.join(' ') : className), [className]);
1148
- const finalProps = {};
1149
- if (style)
1150
- finalProps.style = style;
1151
- if (mergedClasses)
1152
- finalProps.className = mergedClasses;
1153
- return render(children, finalProps);
1252
+ //#endregion
1253
+ //#region src/Util/component.tsx
1254
+ /**
1255
+ * Utility wrapper that injects className and/or style props into its
1256
+ * children without adding any DOM nodes of its own. Uses the core `render`
1257
+ * helper to clone children with the merged props.
1258
+ */
1259
+ const Component$1 = ({ children, className, style }) => {
1260
+ const mergedClasses = useMemo(() => Array.isArray(className) ? className.join(" ") : className, [className]);
1261
+ const finalProps = {};
1262
+ if (style) finalProps.style = style;
1263
+ if (mergedClasses) finalProps.className = mergedClasses;
1264
+ return render(children, finalProps);
1154
1265
  };
1155
1266
  const name = `${PKG_NAME}/Util`;
1156
- Component.displayName = name;
1157
- Component.pkgName = PKG_NAME;
1158
- Component.VITUS_LABS__COMPONENT = name;
1267
+ Component$1.displayName = name;
1268
+ Component$1.pkgName = PKG_NAME;
1269
+ Component$1.VITUS_LABS__COMPONENT = name;
1270
+
1271
+ //#endregion
1272
+ //#region src/Util/index.ts
1273
+ var Util_default = Component$1;
1159
1274
 
1160
- export { Component$7 as Element, Component$5 as List, Component$2 as Overlay, Component$3 as OverlayProvider, Component$4 as Portal, Component$1 as Text, Component as Util, useOverlay, component as withActiveState, withEqualBeforeAfter as withEqualSizeBeforeAfter };
1161
- //# sourceMappingURL=vitus-labs-elements.native.js.map
1275
+ //#endregion
1276
+ export { Element_default as Element, List_default as List, Overlay_default as Overlay, Component as OverlayProvider, Portal_default as Portal, Provider, Text_default as Text, Util_default as Util, useOverlay, component as withActiveState, withEqualBeforeAfter as withEqualSizeBeforeAfter };
1277
+ //# sourceMappingURL=vitus-labs-elements.native.js.map