@adam-milo/ui 1.0.32 → 1.0.34
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.
- package/dist/index.cjs +1 -1
- package/dist/index.js +58 -22
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +94 -56
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +199 -40
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +305 -105
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +260 -74
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +135 -27
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +52 -469
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +57 -111
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +101 -20
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +76 -21
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +25 -29
- package/dist/index2.cjs +1 -1
- package/dist/index2.js +6 -4
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +468 -31
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +155 -41
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +42 -12
- package/dist/index23.cjs +1 -0
- package/dist/index23.js +38 -0
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +32 -287
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +115 -13
- package/dist/index26.cjs +1 -0
- package/dist/index26.js +55 -0
- package/dist/index27.cjs +1 -0
- package/dist/index27.js +45 -0
- package/dist/index28.cjs +1 -0
- package/dist/index28.js +53 -0
- package/dist/index29.cjs +1 -0
- package/dist/index29.js +55 -0
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +33 -33
- package/dist/index30.cjs +1 -0
- package/dist/index30.js +72 -0
- package/dist/index31.cjs +1 -0
- package/dist/index31.js +14 -0
- package/dist/index32.cjs +1 -0
- package/dist/index32.js +332 -0
- package/dist/index36.cjs +1 -0
- package/dist/index36.js +386 -0
- package/dist/index37.cjs +1 -0
- package/dist/index37.js +16 -0
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +59 -11
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +19 -35
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +11 -101
- package/dist/index62.cjs +1 -0
- package/dist/index62.js +502 -0
- package/dist/index64.cjs +1 -0
- package/dist/index64.js +11 -0
- package/dist/index65.cjs +1 -0
- package/dist/index65.js +39 -0
- package/dist/index66.cjs +1 -0
- package/dist/index66.js +64 -0
- package/dist/index67.cjs +1 -0
- package/dist/index67.js +212 -0
- package/dist/index68.cjs +1 -0
- package/dist/index68.js +14 -0
- package/dist/index69.cjs +1 -0
- package/dist/index69.js +293 -0
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +46 -97
- package/dist/index70.cjs +1 -0
- package/dist/index70.js +18 -0
- package/dist/index71.cjs +1 -0
- package/dist/index71.js +129 -0
- package/dist/index72.cjs +1 -0
- package/dist/index72.js +43 -0
- package/dist/index73.cjs +1 -0
- package/dist/index73.js +99 -0
- package/dist/index74.cjs +1 -0
- package/dist/index74.js +71 -0
- package/dist/index75.cjs +1 -0
- package/dist/index75.js +36 -0
- package/dist/index76.cjs +1 -0
- package/dist/index76.js +14 -0
- package/dist/index77.cjs +1 -0
- package/dist/index77.js +17 -0
- package/dist/index78.cjs +1 -0
- package/dist/index78.js +6 -0
- package/dist/index79.cjs +1 -0
- package/dist/index79.js +297 -0
- package/dist/index8.cjs +1 -1
- package/dist/index8.js +97 -88
- package/dist/index80.cjs +1 -0
- package/dist/index80.js +25 -0
- package/dist/index81.cjs +1 -0
- package/dist/index81.js +39 -0
- package/dist/index82.cjs +1 -0
- package/dist/index82.js +625 -0
- package/dist/index83.cjs +1 -0
- package/dist/index83.js +721 -0
- package/dist/index84.cjs +1 -0
- package/dist/index84.js +154 -0
- package/dist/index85.cjs +1 -0
- package/dist/index85.js +173 -0
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +55 -197
- package/dist/src/components/core/button/Button.component.d.ts +13 -7
- package/dist/src/components/core/button/Button.component.d.ts.map +1 -1
- package/dist/src/components/core/icon/Icon.component.d.ts +1 -1
- package/dist/src/components/core/icon/Icon.component.d.ts.map +1 -1
- package/dist/src/components/core/icon-button/IconButton.component.d.ts +36 -0
- package/dist/src/components/core/icon-button/IconButton.component.d.ts.map +1 -0
- package/dist/src/components/core/menu-icon-button/MenuIconButton.component.d.ts +79 -0
- package/dist/src/components/core/menu-icon-button/MenuIconButton.component.d.ts.map +1 -0
- package/dist/src/components/feedback/spinner/Spinner.component.d.ts +62 -0
- package/dist/src/components/feedback/spinner/Spinner.component.d.ts.map +1 -0
- package/dist/src/components/forms/input/Input.component.d.ts +5 -0
- package/dist/src/components/forms/input/Input.component.d.ts.map +1 -1
- package/dist/src/components/forms/otp-input/OTPInput.component.d.ts +82 -0
- package/dist/src/components/forms/otp-input/OTPInput.component.d.ts.map +1 -0
- package/dist/src/components/forms/phone-input/PhoneInput.component.d.ts +96 -0
- package/dist/src/components/forms/phone-input/PhoneInput.component.d.ts.map +1 -0
- package/dist/src/components/forms/phone-input/countries.d.ts +93 -0
- package/dist/src/components/forms/phone-input/countries.d.ts.map +1 -0
- package/dist/src/components/forms/select/Select.component.d.ts +5 -1
- package/dist/src/components/forms/select/Select.component.d.ts.map +1 -1
- package/dist/src/components/forms/toggle/Toggle.component.d.ts +80 -0
- package/dist/src/components/forms/toggle/Toggle.component.d.ts.map +1 -0
- package/dist/src/components/layout/auth-layout/AuthLayout.component.d.ts +86 -0
- package/dist/src/components/layout/auth-layout/AuthLayout.component.d.ts.map +1 -0
- package/dist/src/components/overlays/dialog/Dialog.component.d.ts +36 -2
- package/dist/src/components/overlays/dialog/Dialog.component.d.ts.map +1 -1
- package/dist/src/components/typography/heading/Heading.component.d.ts +92 -0
- package/dist/src/components/typography/heading/Heading.component.d.ts.map +1 -0
- package/dist/src/components/typography/link/Link.component.d.ts +80 -0
- package/dist/src/components/typography/link/Link.component.d.ts.map +1 -0
- package/dist/src/index.d.ts +24 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -1
- /package/dist/{index35.cjs → index50.cjs} +0 -0
- /package/dist/{index35.js → index50.js} +0 -0
- /package/dist/{index42.cjs → index61.cjs} +0 -0
- /package/dist/{index42.js → index61.js} +0 -0
package/dist/index15.js
CHANGED
|
@@ -1,482 +1,65 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
4
|
+
import { cn } from "./index31.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
case "em":
|
|
20
|
-
return value * containerFontSize;
|
|
21
|
-
default:
|
|
22
|
-
return 0.5 * rootFontSize;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const calculateFittingChips = (items, chipWidths, containerWidth, gap, overflowChipWidth) => {
|
|
26
|
-
let totalWidth = 0;
|
|
27
|
-
let count = 0;
|
|
28
|
-
for (let i = 0; i < items.length; i++) {
|
|
29
|
-
const item = items[i];
|
|
30
|
-
const chipWidth = chipWidths.get(item.value) || 0;
|
|
31
|
-
if (chipWidth === 0) {
|
|
32
|
-
count++;
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
const gapBeforeThisChip = i > 0 ? gap : 0;
|
|
36
|
-
const widthWithThisChip = totalWidth + gapBeforeThisChip + chipWidth;
|
|
37
|
-
const hasMoreItems = i < items.length - 1;
|
|
38
|
-
if (hasMoreItems) {
|
|
39
|
-
const widthWithOverflow = widthWithThisChip + gap + overflowChipWidth;
|
|
40
|
-
if (widthWithOverflow > containerWidth && count > 0) break;
|
|
41
|
-
} else {
|
|
42
|
-
if (widthWithThisChip > containerWidth && count > 0) break;
|
|
43
|
-
}
|
|
44
|
-
totalWidth = widthWithThisChip;
|
|
45
|
-
count++;
|
|
46
|
-
}
|
|
47
|
-
return Math.max(1, count);
|
|
48
|
-
};
|
|
49
|
-
const useDebounce = (callback, delay) => {
|
|
50
|
-
const timeoutRef = useRef();
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
return () => {
|
|
53
|
-
if (timeoutRef.current) {
|
|
54
|
-
clearTimeout(timeoutRef.current);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}, []);
|
|
58
|
-
const debouncedFn = useCallback(
|
|
59
|
-
(...args) => {
|
|
60
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
61
|
-
timeoutRef.current = setTimeout(() => callback(...args), delay);
|
|
62
|
-
},
|
|
63
|
-
[callback, delay]
|
|
64
|
-
);
|
|
65
|
-
return debouncedFn;
|
|
66
|
-
};
|
|
67
|
-
const useChipOverflow = (items, containerRef, chipRefs, chipWidths, maxVisible) => {
|
|
68
|
-
const [visibleCount, setVisibleCount] = useState(items.length);
|
|
69
|
-
const calculateVisibleChips = useCallback(() => {
|
|
70
|
-
if (maxVisible !== void 0) {
|
|
71
|
-
setVisibleCount(Math.min(maxVisible, items.length));
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const container = containerRef.current;
|
|
75
|
-
if (!container) return;
|
|
76
|
-
const containerWidth = container.clientWidth;
|
|
77
|
-
const rootFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
|
|
78
|
-
const computedStyle = window.getComputedStyle(container);
|
|
79
|
-
const gapString = computedStyle.gap;
|
|
80
|
-
const containerFontSize = parseFloat(computedStyle.fontSize) || 16;
|
|
81
|
-
const gap = parseGapValue(gapString, rootFontSize, containerFontSize);
|
|
82
|
-
const OVERFLOW_CHIP_WIDTH_REM = 3.75;
|
|
83
|
-
const overflowChipWidth = OVERFLOW_CHIP_WIDTH_REM * rootFontSize;
|
|
84
|
-
for (let i = 0; i < items.length; i++) {
|
|
85
|
-
const item = items[i];
|
|
86
|
-
const chip = chipRefs.current[i];
|
|
87
|
-
if (chip) {
|
|
88
|
-
chipWidths.current.set(item.value, chip.offsetWidth);
|
|
6
|
+
const Tabs = TabsPrimitive.Root;
|
|
7
|
+
const TabsList = forwardRef(
|
|
8
|
+
({ className, "data-cy": dataCy, "data-testid": dataTestId, ...props }, ref) => {
|
|
9
|
+
const finalDataCy = dataCy || "tabs-list";
|
|
10
|
+
const finalTestId = dataTestId || "tabs-list";
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
TabsPrimitive.List,
|
|
13
|
+
{
|
|
14
|
+
ref,
|
|
15
|
+
className: cn("tabs-list", className),
|
|
16
|
+
"data-cy": finalDataCy,
|
|
17
|
+
"data-testid": finalTestId,
|
|
18
|
+
...props
|
|
89
19
|
}
|
|
90
|
-
}
|
|
91
|
-
const count = calculateFittingChips(
|
|
92
|
-
items,
|
|
93
|
-
chipWidths.current,
|
|
94
|
-
containerWidth,
|
|
95
|
-
gap,
|
|
96
|
-
overflowChipWidth
|
|
97
20
|
);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
setVisibleCount(items.length);
|
|
115
|
-
} else {
|
|
116
|
-
setTimeout(calculateVisibleChips, 0);
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
24
|
+
const TabsTrigger = forwardRef(
|
|
25
|
+
({ className, value, "data-cy": dataCy, "data-testid": dataTestId, ...props }, ref) => {
|
|
26
|
+
const finalDataCy = dataCy || (value ? `tabs-trigger-${value}` : "tabs-trigger");
|
|
27
|
+
const finalTestId = dataTestId || (value ? `tabs-trigger-${value}` : "tabs-trigger");
|
|
28
|
+
return /* @__PURE__ */ jsx(
|
|
29
|
+
TabsPrimitive.Trigger,
|
|
30
|
+
{
|
|
31
|
+
ref,
|
|
32
|
+
className: cn("tabs-trigger", className),
|
|
33
|
+
value,
|
|
34
|
+
"data-cy": finalDataCy,
|
|
35
|
+
"data-testid": finalTestId,
|
|
36
|
+
...props
|
|
117
37
|
}
|
|
118
|
-
}
|
|
119
|
-
}, [items, maxVisible, calculateVisibleChips, chipRefs, chipWidths]);
|
|
120
|
-
useEffect(() => {
|
|
121
|
-
const container = containerRef.current;
|
|
122
|
-
if (!container) return;
|
|
123
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
124
|
-
debouncedCalculate();
|
|
125
|
-
});
|
|
126
|
-
resizeObserver.observe(container);
|
|
127
|
-
setTimeout(calculateVisibleChips, 0);
|
|
128
|
-
return () => {
|
|
129
|
-
resizeObserver.disconnect();
|
|
130
|
-
};
|
|
131
|
-
}, [calculateVisibleChips, debouncedCalculate, containerRef]);
|
|
132
|
-
const visibleItems = items.slice(0, visibleCount);
|
|
133
|
-
const hiddenItems = items.slice(visibleCount);
|
|
134
|
-
const hasOverflow = hiddenItems.length > 0;
|
|
135
|
-
return { visibleCount, visibleItems, hiddenItems, hasOverflow };
|
|
136
|
-
};
|
|
137
|
-
const ChipGroup = forwardRef(
|
|
138
|
-
({
|
|
139
|
-
items,
|
|
140
|
-
selectedValue,
|
|
141
|
-
onSelectionChange,
|
|
142
|
-
removable = false,
|
|
143
|
-
onRemove,
|
|
144
|
-
variant = "primary",
|
|
145
|
-
disabled = false,
|
|
146
|
-
maxVisible,
|
|
147
|
-
className,
|
|
148
|
-
"data-testid": dataTestId,
|
|
149
|
-
"data-cy": dataCy,
|
|
150
|
-
...props
|
|
151
|
-
}, ref) => {
|
|
152
|
-
const normalizedItems = items && Array.isArray(items) ? items : [];
|
|
153
|
-
const validItems = normalizedItems.filter((item) => {
|
|
154
|
-
return item !== null && item !== void 0 && typeof item === "object";
|
|
155
|
-
});
|
|
156
|
-
const containerRef = useRef(null);
|
|
157
|
-
const chipRefs = useRef([]);
|
|
158
|
-
const chipWidths = useRef(/* @__PURE__ */ new Map());
|
|
159
|
-
const dropdownRef = useRef(null);
|
|
160
|
-
const [showTooltip, setShowTooltip] = useState(false);
|
|
161
|
-
const [showDropdown, setShowDropdown] = useState(false);
|
|
162
|
-
const dropdownItemRefs = useRef([]);
|
|
163
|
-
const { visibleItems, hiddenItems, hasOverflow } = useChipOverflow(
|
|
164
|
-
validItems,
|
|
165
|
-
containerRef,
|
|
166
|
-
chipRefs,
|
|
167
|
-
chipWidths,
|
|
168
|
-
maxVisible
|
|
169
|
-
);
|
|
170
|
-
const handleChipClick = useCallback(
|
|
171
|
-
(value, itemDisabled, event) => {
|
|
172
|
-
if (disabled || itemDisabled) return;
|
|
173
|
-
if (onSelectionChange) {
|
|
174
|
-
const newValue = selectedValue === value ? null : value;
|
|
175
|
-
onSelectionChange(newValue, event);
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
[disabled, selectedValue, onSelectionChange]
|
|
179
|
-
);
|
|
180
|
-
const handleRemove = useCallback(
|
|
181
|
-
(e, value) => {
|
|
182
|
-
e.stopPropagation();
|
|
183
|
-
if (disabled) return;
|
|
184
|
-
if (onRemove) {
|
|
185
|
-
onRemove(value, e);
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
[disabled, onRemove]
|
|
189
|
-
);
|
|
190
|
-
const handleKeyDown = useCallback(
|
|
191
|
-
(e, value, itemDisabled) => {
|
|
192
|
-
if (disabled || itemDisabled) return;
|
|
193
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
194
|
-
e.preventDefault();
|
|
195
|
-
handleChipClick(value, itemDisabled, e);
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
[disabled, handleChipClick]
|
|
199
38
|
);
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
case "ArrowDown":
|
|
210
|
-
e.preventDefault();
|
|
211
|
-
if (index < hiddenItems.length - 1) {
|
|
212
|
-
(_a = dropdownItemRefs.current[index + 1]) == null ? void 0 : _a.focus();
|
|
213
|
-
}
|
|
214
|
-
break;
|
|
215
|
-
case "ArrowUp":
|
|
216
|
-
e.preventDefault();
|
|
217
|
-
if (index > 0) {
|
|
218
|
-
(_b = dropdownItemRefs.current[index - 1]) == null ? void 0 : _b.focus();
|
|
219
|
-
}
|
|
220
|
-
break;
|
|
221
|
-
case "Home":
|
|
222
|
-
e.preventDefault();
|
|
223
|
-
(_c = dropdownItemRefs.current[0]) == null ? void 0 : _c.focus();
|
|
224
|
-
break;
|
|
225
|
-
case "End":
|
|
226
|
-
e.preventDefault();
|
|
227
|
-
(_d = dropdownItemRefs.current[hiddenItems.length - 1]) == null ? void 0 : _d.focus();
|
|
228
|
-
break;
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
[hiddenItems.length]
|
|
232
|
-
);
|
|
233
|
-
const handleClickOutsideRef = useRef();
|
|
234
|
-
const handleEscapeRef = useRef();
|
|
235
|
-
useEffect(() => {
|
|
236
|
-
handleClickOutsideRef.current = (event) => {
|
|
237
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
238
|
-
setShowDropdown(false);
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
handleEscapeRef.current = (event) => {
|
|
242
|
-
if (event.key === "Escape") {
|
|
243
|
-
setShowDropdown(false);
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
});
|
|
247
|
-
useEffect(() => {
|
|
248
|
-
if (!showDropdown) return;
|
|
249
|
-
const handleClickOutside = (e) => {
|
|
250
|
-
var _a;
|
|
251
|
-
return (_a = handleClickOutsideRef.current) == null ? void 0 : _a.call(handleClickOutsideRef, e);
|
|
252
|
-
};
|
|
253
|
-
const handleEscape = (e) => {
|
|
254
|
-
var _a;
|
|
255
|
-
return (_a = handleEscapeRef.current) == null ? void 0 : _a.call(handleEscapeRef, e);
|
|
256
|
-
};
|
|
257
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
258
|
-
document.addEventListener("keydown", handleEscape);
|
|
259
|
-
return () => {
|
|
260
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
261
|
-
document.removeEventListener("keydown", handleEscape);
|
|
262
|
-
};
|
|
263
|
-
}, [showDropdown]);
|
|
264
|
-
useEffect(() => {
|
|
265
|
-
if (process.env.NODE_ENV === "development" && validItems.length > 0) {
|
|
266
|
-
const values = validItems.map((item) => item.value);
|
|
267
|
-
const uniqueValues = new Set(values);
|
|
268
|
-
if (values.length !== uniqueValues.size) {
|
|
269
|
-
devWarn(
|
|
270
|
-
"[ChipGroup] Duplicate values detected in items array. Each item should have a unique value."
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}, [validItems]);
|
|
275
|
-
useEffect(() => {
|
|
276
|
-
if (dropdownItemRefs.current.length > hiddenItems.length) {
|
|
277
|
-
dropdownItemRefs.current = dropdownItemRefs.current.slice(0, hiddenItems.length);
|
|
278
|
-
}
|
|
279
|
-
}, [hiddenItems]);
|
|
280
|
-
if (!items || !Array.isArray(items)) {
|
|
281
|
-
return null;
|
|
282
|
-
}
|
|
283
|
-
return /* @__PURE__ */ jsxs(
|
|
284
|
-
"div",
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
42
|
+
const TabsContent = forwardRef(
|
|
43
|
+
({ className, value, "data-cy": dataCy, "data-testid": dataTestId, ...props }, ref) => {
|
|
44
|
+
const finalDataCy = dataCy || (value ? `tabs-content-${value}` : "tabs-content");
|
|
45
|
+
const finalTestId = dataTestId || (value ? `tabs-content-${value}` : "tabs-content");
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
TabsPrimitive.Content,
|
|
285
48
|
{
|
|
286
49
|
ref,
|
|
287
|
-
className: cn("
|
|
288
|
-
|
|
289
|
-
"
|
|
290
|
-
"data-testid":
|
|
291
|
-
|
|
292
|
-
...props,
|
|
293
|
-
children: [
|
|
294
|
-
hasOverflow && /* @__PURE__ */ jsxs(
|
|
295
|
-
"div",
|
|
296
|
-
{
|
|
297
|
-
className: "sr-only",
|
|
298
|
-
role: "status",
|
|
299
|
-
"aria-live": "polite",
|
|
300
|
-
"aria-atomic": "true",
|
|
301
|
-
"data-testid": "chip-group-live-region",
|
|
302
|
-
"data-cy": "chip-group-live-region",
|
|
303
|
-
children: [
|
|
304
|
-
hiddenItems.length,
|
|
305
|
-
" additional ",
|
|
306
|
-
hiddenItems.length === 1 ? "chip" : "chips",
|
|
307
|
-
" hidden"
|
|
308
|
-
]
|
|
309
|
-
}
|
|
310
|
-
),
|
|
311
|
-
/* @__PURE__ */ jsxs("div", { ref: containerRef, className: "chip-group__container", children: [
|
|
312
|
-
visibleItems.map((item) => {
|
|
313
|
-
const isSelected = selectedValue === item.value;
|
|
314
|
-
const itemVariant = item.variant || variant;
|
|
315
|
-
const itemDisabled = disabled || item.disabled || false;
|
|
316
|
-
const itemIndexInFullArray = validItems.findIndex((i) => i.value === item.value);
|
|
317
|
-
return /* @__PURE__ */ jsx(
|
|
318
|
-
"div",
|
|
319
|
-
{
|
|
320
|
-
ref: (el) => {
|
|
321
|
-
if (el) {
|
|
322
|
-
chipRefs.current[itemIndexInFullArray] = el;
|
|
323
|
-
} else {
|
|
324
|
-
chipRefs.current[itemIndexInFullArray] = null;
|
|
325
|
-
}
|
|
326
|
-
},
|
|
327
|
-
className: "chip-group__item-wrapper",
|
|
328
|
-
"data-cy": `chip-group-item-wrapper-${item.value}`,
|
|
329
|
-
"data-testid": `chip-group-item-wrapper-${item.value}`,
|
|
330
|
-
children: /* @__PURE__ */ jsxs(
|
|
331
|
-
"div",
|
|
332
|
-
{
|
|
333
|
-
className: "chip-group__item",
|
|
334
|
-
onClick: (e) => handleChipClick(item.value, itemDisabled, e),
|
|
335
|
-
onKeyDown: (e) => handleKeyDown(e, item.value, itemDisabled),
|
|
336
|
-
tabIndex: itemDisabled ? -1 : 0,
|
|
337
|
-
role: "button",
|
|
338
|
-
"aria-pressed": isSelected ? "true" : "false",
|
|
339
|
-
"aria-disabled": itemDisabled ? "true" : "false",
|
|
340
|
-
"data-cy": `chip-group-item-${item.value}`,
|
|
341
|
-
"data-testid": `chip-group-item-${item.value}`,
|
|
342
|
-
children: [
|
|
343
|
-
/* @__PURE__ */ jsx(
|
|
344
|
-
Chip,
|
|
345
|
-
{
|
|
346
|
-
variant: itemVariant,
|
|
347
|
-
selected: isSelected,
|
|
348
|
-
disabled: itemDisabled,
|
|
349
|
-
"data-cy": `chip-${item.value}`,
|
|
350
|
-
"data-testid": `chip-${item.value}`,
|
|
351
|
-
children: item.label
|
|
352
|
-
}
|
|
353
|
-
),
|
|
354
|
-
removable && !disabled && !itemDisabled && /* @__PURE__ */ jsx(
|
|
355
|
-
"button",
|
|
356
|
-
{
|
|
357
|
-
className: "chip-group__remove",
|
|
358
|
-
onClick: (e) => handleRemove(e, item.value),
|
|
359
|
-
"aria-label": `Remove ${item.label}`,
|
|
360
|
-
"data-cy": `chip-remove-${item.value}`,
|
|
361
|
-
"data-testid": `chip-remove-${item.value}`,
|
|
362
|
-
type: "button",
|
|
363
|
-
children: /* @__PURE__ */ jsx(Icon, { name: "Cross2Icon", size: "sm", decorative: true })
|
|
364
|
-
}
|
|
365
|
-
)
|
|
366
|
-
]
|
|
367
|
-
}
|
|
368
|
-
)
|
|
369
|
-
},
|
|
370
|
-
item.value
|
|
371
|
-
);
|
|
372
|
-
}),
|
|
373
|
-
hasOverflow && /* @__PURE__ */ jsxs(
|
|
374
|
-
"div",
|
|
375
|
-
{
|
|
376
|
-
ref: dropdownRef,
|
|
377
|
-
className: "chip-group__overflow",
|
|
378
|
-
role: "button",
|
|
379
|
-
tabIndex: 0,
|
|
380
|
-
"aria-expanded": showDropdown ? "true" : "false",
|
|
381
|
-
"aria-haspopup": "menu",
|
|
382
|
-
"aria-label": `Show ${hiddenItems.length} more ${hiddenItems.length === 1 ? "chip" : "chips"}`,
|
|
383
|
-
onMouseEnter: () => !showDropdown && setShowTooltip(true),
|
|
384
|
-
onMouseLeave: () => setShowTooltip(false),
|
|
385
|
-
onClick: handleOverflowClick,
|
|
386
|
-
onKeyDown: (e) => {
|
|
387
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
388
|
-
e.preventDefault();
|
|
389
|
-
e.stopPropagation();
|
|
390
|
-
setShowDropdown(!showDropdown);
|
|
391
|
-
setShowTooltip(false);
|
|
392
|
-
}
|
|
393
|
-
},
|
|
394
|
-
"data-cy": "chip-group-overflow",
|
|
395
|
-
"data-testid": "chip-group-overflow",
|
|
396
|
-
children: [
|
|
397
|
-
/* @__PURE__ */ jsxs(Chip, { variant, "data-cy": "chip-overflow", "data-testid": "chip-overflow", children: [
|
|
398
|
-
"+",
|
|
399
|
-
hiddenItems.length
|
|
400
|
-
] }),
|
|
401
|
-
showTooltip && !showDropdown && /* @__PURE__ */ jsx(
|
|
402
|
-
"div",
|
|
403
|
-
{
|
|
404
|
-
className: "chip-group__tooltip chip-group__tooltip--hover",
|
|
405
|
-
role: "tooltip",
|
|
406
|
-
"data-cy": "chip-group-tooltip",
|
|
407
|
-
"data-testid": "chip-group-tooltip",
|
|
408
|
-
children: hiddenItems.map((item) => /* @__PURE__ */ jsx(
|
|
409
|
-
"div",
|
|
410
|
-
{
|
|
411
|
-
className: "chip-group__tooltip-item",
|
|
412
|
-
"data-cy": `chip-group-tooltip-item-${item.value}`,
|
|
413
|
-
"data-testid": `chip-group-tooltip-item-${item.value}`,
|
|
414
|
-
children: item.label
|
|
415
|
-
},
|
|
416
|
-
item.value
|
|
417
|
-
))
|
|
418
|
-
}
|
|
419
|
-
),
|
|
420
|
-
showDropdown && /* @__PURE__ */ jsx(
|
|
421
|
-
"div",
|
|
422
|
-
{
|
|
423
|
-
className: "chip-group__dropdown",
|
|
424
|
-
role: "menu",
|
|
425
|
-
"data-cy": "chip-group-dropdown",
|
|
426
|
-
"data-testid": "chip-group-dropdown",
|
|
427
|
-
children: hiddenItems.map((item, index) => /* @__PURE__ */ jsx(
|
|
428
|
-
"div",
|
|
429
|
-
{
|
|
430
|
-
ref: (el) => {
|
|
431
|
-
if (el) {
|
|
432
|
-
dropdownItemRefs.current[index] = el;
|
|
433
|
-
} else {
|
|
434
|
-
dropdownItemRefs.current[index] = null;
|
|
435
|
-
}
|
|
436
|
-
},
|
|
437
|
-
className: cn(
|
|
438
|
-
"chip-group__dropdown-item",
|
|
439
|
-
item.disabled && "chip-group__dropdown-item--disabled"
|
|
440
|
-
),
|
|
441
|
-
role: "menuitem",
|
|
442
|
-
tabIndex: item.disabled ? -1 : 0,
|
|
443
|
-
"aria-disabled": item.disabled ? "true" : "false",
|
|
444
|
-
onClick: (e) => {
|
|
445
|
-
e.stopPropagation();
|
|
446
|
-
if (!item.disabled) {
|
|
447
|
-
handleChipClick(item.value, false, e);
|
|
448
|
-
setShowDropdown(false);
|
|
449
|
-
}
|
|
450
|
-
},
|
|
451
|
-
onKeyDown: (e) => {
|
|
452
|
-
handleDropdownKeyDown(e, index);
|
|
453
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
454
|
-
e.preventDefault();
|
|
455
|
-
e.stopPropagation();
|
|
456
|
-
if (!item.disabled) {
|
|
457
|
-
handleChipClick(item.value, false, e);
|
|
458
|
-
setShowDropdown(false);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
},
|
|
462
|
-
"data-cy": `chip-group-dropdown-item-${item.value}`,
|
|
463
|
-
"data-testid": `chip-group-dropdown-item-${item.value}`,
|
|
464
|
-
children: item.label
|
|
465
|
-
},
|
|
466
|
-
item.value
|
|
467
|
-
))
|
|
468
|
-
}
|
|
469
|
-
)
|
|
470
|
-
]
|
|
471
|
-
}
|
|
472
|
-
)
|
|
473
|
-
] })
|
|
474
|
-
]
|
|
50
|
+
className: cn("tabs-content", className),
|
|
51
|
+
value,
|
|
52
|
+
"data-cy": finalDataCy,
|
|
53
|
+
"data-testid": finalTestId,
|
|
54
|
+
...props
|
|
475
55
|
}
|
|
476
56
|
);
|
|
477
57
|
}
|
|
478
58
|
);
|
|
479
|
-
|
|
59
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
480
60
|
export {
|
|
481
|
-
|
|
61
|
+
Tabs,
|
|
62
|
+
TabsContent,
|
|
63
|
+
TabsList,
|
|
64
|
+
TabsTrigger
|
|
482
65
|
};
|
package/dist/index16.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("react"),a=require("./index31.cjs");;/* empty css */const r=e.forwardRef(({variant:e="info",title:r,icon:s,className:i,children:c,"data-cy":d,"data-testid":l,...n},o)=>{const u=d||`alert-${e}`,$=l||`alert-${e}`;return t.jsxs("div",{ref:o,role:{info:"status",success:"status",warning:"alert",error:"alert"}[e],className:a.cn("alert",`alert--${e}`,i),"data-cy":u,"data-testid":$,...n,children:[s&&t.jsx("div",{className:"alert__icon","data-cy":`${u}-icon`,"data-testid":`${$}-icon`,children:s}),t.jsxs("div",{className:"alert__content","data-cy":`${u}-content`,"data-testid":`${$}-content`,children:[r&&t.jsx("div",{className:"alert__title","data-cy":`${u}-title`,"data-testid":`${$}-title`,children:r}),t.jsx("div",{"data-cy":`${u}-message`,"data-testid":`${$}-message`,children:c})]})]})});r.displayName="Alert",exports.Alert=r;
|