@ultraviolet/ui 3.23.0 → 3.24.1
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/_virtual/{_@oxc-project_runtime@0.142.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/asyncToGenerator.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.142.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/defineProperty.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.142.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/extends.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.142.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/objectDestructuringEmpty.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.142.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/objectSpread2.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.142.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/objectWithoutProperties.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.142.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.142.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/toPrimitive.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.142.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/toPropertyKey.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.142.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/typeof.js +1 -1
- package/dist/components/ActionBar/index.js +1 -1
- package/dist/components/Alert/index.js +0 -1
- package/dist/components/Alert/styles.css.d.ts +0 -40
- package/dist/components/Alert/styles.css.d.ts.map +1 -1
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/Badge/index.d.ts +5 -2
- package/dist/components/Badge/index.d.ts.map +1 -1
- package/dist/components/Badge/styles.css.d.ts +0 -45
- package/dist/components/Badge/styles.css.d.ts.map +1 -1
- package/dist/components/Banner/index.d.ts +3 -2
- package/dist/components/Banner/index.d.ts.map +1 -1
- package/dist/components/Banner/styles.css.d.ts +0 -17
- package/dist/components/Banner/styles.css.d.ts.map +1 -1
- package/dist/components/BarChart/index.js +1 -1
- package/dist/components/Breadcrumbs/components/Item.js +1 -1
- package/dist/components/Button/index.d.ts +6 -2
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/styles.css.d.ts +0 -83
- package/dist/components/Button/styles.css.d.ts.map +1 -1
- package/dist/components/Carousel/Item.js +1 -1
- package/dist/components/Chip/index.js +4 -2
- package/dist/components/DateInput/components/CalendarContent.js +14 -10
- package/dist/components/DateInput/components/CalendarDaily.js +37 -35
- package/dist/components/DateInput/components/CalendarMonthly.js +46 -42
- package/dist/components/DateInput/index.js +8 -6
- package/dist/components/DateInput/styles.css.d.ts.map +1 -1
- package/dist/components/Dialog/index.js +1 -1
- package/dist/components/Expandable/AnimatedExpandable.js +1 -1
- package/dist/components/Expandable/NonAnimatedExpandable.js +1 -1
- package/dist/components/FileInput/components/Button.js +2 -2
- package/dist/components/FileInput/helpers.js +1 -1
- package/dist/components/FileInput/index.js +2 -2
- package/dist/components/InfiniteScroll/index.js +1 -1
- package/dist/components/KeyValueInput/index.js +1 -1
- package/dist/components/LineChart/index.js +1 -1
- package/dist/components/List/Cell.js +1 -1
- package/dist/components/List/ListContext.js +3 -3
- package/dist/components/Loader/index.js +1 -1
- package/dist/components/Menu/MenuContent.js +1 -1
- package/dist/components/Menu/index.js +2 -2
- package/dist/components/Modal/components/Dialog.js +1 -1
- package/dist/components/Notification/Notification.js +1 -1
- package/dist/components/NumberInput/components/Controls.d.ts.map +1 -1
- package/dist/components/NumberInput/components/Controls.js +1 -0
- package/dist/components/Pagination/PaginationButtons.d.ts +2 -1
- package/dist/components/Pagination/PaginationButtons.d.ts.map +1 -1
- package/dist/components/Pagination/PaginationButtons.js +19 -15
- package/dist/components/Pagination/getPageItems.d.ts +8 -0
- package/dist/components/Pagination/getPageItems.d.ts.map +1 -0
- package/dist/components/Pagination/getPageItems.js +35 -0
- package/dist/components/Pagination/getPageNumbers.d.ts +2 -1
- package/dist/components/Pagination/getPageNumbers.d.ts.map +1 -1
- package/dist/components/Pagination/getPageNumbers.js +3 -4
- package/dist/components/Pagination/index.d.ts.map +1 -1
- package/dist/components/Pagination/index.js +15 -3
- package/dist/components/Pagination/styles.css.d.ts +1 -0
- package/dist/components/Pagination/styles.css.d.ts.map +1 -1
- package/dist/components/Pagination/styles.css.js +6 -5
- package/dist/components/PieChart/index.js +1 -1
- package/dist/components/Popup/index.js +1 -1
- package/dist/components/Popup/styles.css.d.ts.map +1 -1
- package/dist/components/Popup/styles.css.js +1 -7
- package/dist/components/Row/index.js +1 -1
- package/dist/components/SearchInput/styles.css.d.ts.map +1 -1
- package/dist/components/SelectInput/components/Dropdown/Dropdown.js +1 -1
- package/dist/components/SelectInput/components/Dropdown/Group.js +9 -7
- package/dist/components/SelectInput/components/Dropdown/Item.d.ts.map +1 -1
- package/dist/components/SelectInput/components/Dropdown/Item.js +49 -43
- package/dist/components/SelectInput/components/Dropdown/Option.d.ts.map +1 -1
- package/dist/components/SelectInput/components/Dropdown/Option.js +71 -89
- package/dist/components/SelectInput/components/Dropdown/SearchBar.js +36 -31
- package/dist/components/SelectInput/components/Dropdown/dropdown.css.d.ts.map +1 -1
- package/dist/components/SelectInput/components/SelectBar/SelectBar.js +6 -4
- package/dist/components/SelectableCard/MultiStateInput.js +1 -1
- package/dist/components/SelectableCard/SelectableCard.js +1 -1
- package/dist/components/SelectableCardOptionGroup/components/Option.js +1 -1
- package/dist/components/Separator/index.d.ts +3 -2
- package/dist/components/Separator/index.d.ts.map +1 -1
- package/dist/components/Separator/styles.css.d.ts +0 -60
- package/dist/components/Separator/styles.css.d.ts.map +1 -1
- package/dist/components/Separator/styles.css.js +6 -4
- package/dist/components/Slider/components/DoubleSlider.d.ts.map +1 -1
- package/dist/components/Slider/components/DoubleSlider.js +103 -114
- package/dist/components/Slider/components/SingleSlider.js +2 -5
- package/dist/components/Slider/styles.css.d.ts +0 -37
- package/dist/components/Slider/styles.css.d.ts.map +1 -1
- package/dist/components/Slider/styles.css.js +27 -44
- package/dist/components/Stack/index.js +2 -2
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/SwitchButton/index.js +1 -0
- package/dist/components/Table/Cell.js +1 -1
- package/dist/components/Table/TableContext.js +2 -2
- package/dist/components/Tabs/Tab.js +2 -2
- package/dist/components/Tabs/TabMenu.js +2 -2
- package/dist/components/Tabs/TabMenuItem.js +2 -2
- package/dist/components/Tabs/index.js +2 -2
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +28 -23
- package/dist/components/Tag/styles.css.d.ts.map +1 -1
- package/dist/components/Tag/styles.css.js +43 -41
- package/dist/components/Tag/type.d.ts +1 -2
- package/dist/components/Tag/type.d.ts.map +1 -1
- package/dist/components/TagInput/index.js +2 -1
- package/dist/components/TagList/constant.d.ts +2 -2
- package/dist/components/TagList/constant.d.ts.map +1 -1
- package/dist/components/TagList/constant.js +2 -4
- package/dist/components/TagList/index.d.ts +6 -6
- package/dist/components/TagList/index.d.ts.map +1 -1
- package/dist/components/TagList/index.js +77 -115
- package/dist/components/TagList/styles.css.d.ts +3 -3
- package/dist/components/TagList/styles.css.d.ts.map +1 -1
- package/dist/components/TagList/styles.css.js +7 -8
- package/dist/components/Text/index.d.ts.map +1 -1
- package/dist/components/Text/index.js +4 -6
- package/dist/components/Text/style.css.d.ts +0 -47
- package/dist/components/Text/style.css.d.ts.map +1 -1
- package/dist/components/TextArea/index.js +1 -1
- package/dist/components/TimeInput/index.js +1 -1
- package/dist/components/Toaster/Toaster.js +1 -1
- package/dist/components/Toaster/components/Button.js +2 -2
- package/dist/components/Toaster/components/Link.js +3 -3
- package/dist/components/Tooltip/TooltipChildren.d.ts +10 -0
- package/dist/components/Tooltip/TooltipChildren.d.ts.map +1 -0
- package/dist/components/Tooltip/TooltipChildren.js +71 -0
- package/dist/components/Tooltip/TooltipElement.d.ts +8 -0
- package/dist/components/Tooltip/TooltipElement.d.ts.map +1 -0
- package/dist/components/Tooltip/TooltipElement.js +39 -0
- package/dist/components/Tooltip/index.d.ts +92 -34
- package/dist/components/Tooltip/index.d.ts.map +1 -1
- package/dist/components/Tooltip/index.js +51 -29
- package/dist/components/Tooltip/styles.css.d.ts +17 -0
- package/dist/components/Tooltip/styles.css.d.ts.map +1 -1
- package/dist/components/Tooltip/styles.css.js +23 -1
- package/dist/components/Tooltip/types.d.ts +7 -0
- package/dist/components/Tooltip/types.d.ts.map +1 -0
- package/dist/components/Tooltip/useTooltip.d.ts +25 -0
- package/dist/components/Tooltip/useTooltip.d.ts.map +1 -0
- package/dist/components/Tooltip/useTooltip.js +75 -0
- package/dist/components/TreeMapChart/index.js +1 -1
- package/dist/components/VisuallyHidden/index.js +2 -2
- package/dist/composition.js +3 -3
- package/dist/compositions/EstimateCost/Components/Item.js +1 -1
- package/dist/compositions/EstimateCost/Components/LineThrough.js +2 -2
- package/dist/compositions/EstimateCost/Components/Unit.js +1 -1
- package/dist/compositions/EstimateCost/EstimateCostProvider.js +1 -1
- package/dist/compositions/EstimateCost/Image.js +1 -1
- package/dist/compositions/Filters/filterTypes/FilterSlider.js +1 -1
- package/dist/compositions/Filters/filterTypes/FilterText.d.ts.map +1 -1
- package/dist/compositions/Filters/filterTypes/FilterText.js +1 -0
- package/dist/compositions/Filters/parts/AbstractFilter.js +1 -1
- package/dist/compositions/Filters/parts/FiltersDrawer.d.ts +1 -0
- package/dist/compositions/Filters/parts/FiltersDrawer.d.ts.map +1 -1
- package/dist/compositions/Filters/parts/FiltersDrawer.js +15 -4
- package/dist/compositions/Filters/parts/FiltersMainRow.js +1 -0
- package/dist/compositions/Filters/parts/helpers.d.ts.map +1 -1
- package/dist/compositions/Filters/parts/helpers.js +3 -1
- package/dist/compositions/Filters/parts/reducer.js +1 -1
- package/dist/compositions/Filters/parts/useFilters.js +1 -1
- package/dist/compositions/Filters/types.d.ts +1 -0
- package/dist/compositions/Filters/types.d.ts.map +1 -1
- package/dist/compositions/InfoTable/components/Row.js +1 -1
- package/dist/compositions/InfoTable/styles.css.d.ts.map +1 -1
- package/dist/compositions/InfoTable/styles.css.js +30 -30
- package/dist/compositions/Navigation/NavigationProvider.js +1 -1
- package/dist/compositions/Navigation/components/items.css.d.ts.map +1 -1
- package/dist/compositions/Navigation/components/styles.css.d.ts.map +1 -1
- package/dist/compositions/OfferList/components/Row.js +4 -2
- package/dist/compositions/OptionSelector/styles.css.js +30 -30
- package/dist/compositions/OrderSummary/helpers.js +1 -1
- package/dist/compositions/RichTextInput/index.js +1 -1
- package/dist/hooks/useBreakpoint.d.ts +15 -0
- package/dist/hooks/useBreakpoint.d.ts.map +1 -0
- package/dist/hooks/useBreakpoint.js +46 -0
- package/dist/hooks/useIsOverflowing.d.ts +7 -3
- package/dist/hooks/useIsOverflowing.d.ts.map +1 -1
- package/dist/hooks/useIsOverflowing.js +13 -10
- package/dist/index.js +13 -13
- package/dist/ui.css +1 -1
- package/package.json +5 -4
- package/dist/components/Pagination/PaginationButton.d.ts +0 -11
- package/dist/components/Pagination/PaginationButton.d.ts.map +0 -1
- package/dist/components/Pagination/PaginationButton.js +0 -34
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { __esmMin, __name } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import _objectSpread2, { init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.
|
|
4
|
-
import { init_styles_css,
|
|
3
|
+
import _objectSpread2, { init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/objectSpread2.js";
|
|
4
|
+
import { init_styles_css, tagListStyle } from "./styles.css.js";
|
|
5
5
|
import { Tag, init_Tag } from "../Tag/index.js";
|
|
6
6
|
import { Popover, init_Popover } from "../Popover/index.js";
|
|
7
|
-
import { DEFAULT_POPOVER_MAX_HEIGHT,
|
|
8
|
-
import { useEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
import { DEFAULT_POPOVER_MAX_HEIGHT, init_constant } from "./constant.js";
|
|
8
|
+
import { createElement, useEffect, useMemo, useRef, useState } from "react";
|
|
9
9
|
import { cn } from "@ultraviolet/utils";
|
|
10
|
-
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
11
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
11
|
|
|
13
12
|
//#region src/components/TagList/index.tsx
|
|
@@ -28,142 +27,93 @@ function init_TagList() {
|
|
|
28
27
|
return tag;
|
|
29
28
|
};
|
|
30
29
|
TagList = ({ maxLength = 600, tags = DEFAULT_TAGS, threshold = 1, multiline = false, popoverTitle, popoverPlacement, popoverMaxHeight = DEFAULT_POPOVER_MAX_HEIGHT, copiable, copyText, copiedText, sentiment = "neutral", variant = "default", className, "data-testid": dataTestId, style }) => {
|
|
31
|
-
var _containerRef$current3;
|
|
32
|
-
var _containerRef$current6;
|
|
33
30
|
const containerRef = useRef(null);
|
|
34
31
|
const measureRef = useRef(null);
|
|
35
32
|
const popoverTriggerRef = useRef(null);
|
|
36
|
-
const [isReady, setIsReady] = useState(false);
|
|
37
33
|
const [isPopoverVisible, setIsPopoverVisible] = useState(false);
|
|
38
|
-
const [
|
|
39
|
-
const [visibleTags, setVisibleTags] = useState([]);
|
|
34
|
+
const [visibleTags, setVisibleTags] = useState([tags[0]]);
|
|
40
35
|
const [hiddenTags, setHiddenTags] = useState([]);
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
const [potentiallyVisibleTags, surelyHiddenTags] = useMemo(() => {
|
|
37
|
+
if (tags.length === 0) return [[], []];
|
|
38
|
+
const limit = Math.min(threshold, tags.length);
|
|
39
|
+
let visibleCount = 0;
|
|
40
|
+
let currentLength = 0;
|
|
41
|
+
for (let i = 0; i < limit; i++) {
|
|
42
|
+
currentLength += getTagLabel(tags[i]).length;
|
|
43
|
+
if (currentLength > maxLength) break;
|
|
44
|
+
visibleCount++;
|
|
45
|
+
}
|
|
46
|
+
visibleCount = Math.max(visibleCount, 1);
|
|
47
|
+
return [tags.slice(0, visibleCount), tags.slice(visibleCount)];
|
|
50
48
|
}, [
|
|
51
49
|
maxLength,
|
|
52
50
|
tags,
|
|
53
51
|
threshold
|
|
54
52
|
]);
|
|
55
53
|
useEffect(() => {
|
|
56
|
-
var _containerRef$current;
|
|
57
|
-
var _containerRef$current2;
|
|
58
54
|
if (tags.length === 0 || !containerRef.current || !measureRef.current) return;
|
|
59
|
-
if (multiline) {
|
|
55
|
+
if (multiline || typeof ResizeObserver === "undefined") {
|
|
60
56
|
setVisibleTags(potentiallyVisibleTags);
|
|
61
57
|
setHiddenTags(surelyHiddenTags);
|
|
62
|
-
setIsReady(true);
|
|
63
58
|
return;
|
|
64
59
|
}
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
60
|
+
const handleResize = (entries) => {
|
|
61
|
+
if (!containerRef.current || !measureRef.current || !popoverTriggerRef.current) return;
|
|
62
|
+
const totalAvailableWidth = entries[0].contentBoxSize[0].inlineSize;
|
|
63
|
+
if (measureRef.current.offsetWidth < totalAvailableWidth) {
|
|
64
|
+
setVisibleTags(potentiallyVisibleTags);
|
|
65
|
+
setHiddenTags(surelyHiddenTags);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const elementsToMeasure = [...measureRef.current.children[0].children];
|
|
69
|
+
const counterWidth = popoverTriggerRef.current.offsetWidth;
|
|
70
|
+
let visibleTagsCount = 0;
|
|
71
|
+
let visibleTagsWidth = 0;
|
|
72
|
+
for (let i = 0; i < potentiallyVisibleTags.length; i++) {
|
|
73
|
+
if (i > 0) visibleTagsWidth += 4;
|
|
74
|
+
visibleTagsWidth += elementsToMeasure[i].offsetWidth;
|
|
75
|
+
const availableWidth = i < tags.length - 1 ? totalAvailableWidth - counterWidth : totalAvailableWidth;
|
|
76
|
+
if (visibleTagsWidth > availableWidth) break;
|
|
77
|
+
visibleTagsCount++;
|
|
78
|
+
}
|
|
79
|
+
if (visibleTagsCount === 0) visibleTagsCount = 1;
|
|
80
|
+
setVisibleTags(tags.slice(0, visibleTagsCount));
|
|
81
|
+
setHiddenTags(tags.slice(visibleTagsCount));
|
|
82
|
+
};
|
|
83
|
+
const resizeObserver = new ResizeObserver(handleResize);
|
|
84
|
+
resizeObserver.observe(containerRef.current);
|
|
85
|
+
return () => {
|
|
86
|
+
resizeObserver.disconnect();
|
|
87
|
+
};
|
|
89
88
|
}, [
|
|
90
89
|
multiline,
|
|
91
90
|
potentiallyVisibleTags,
|
|
92
91
|
surelyHiddenTags,
|
|
93
|
-
tags
|
|
94
|
-
threshold,
|
|
95
|
-
tmpThreshold,
|
|
96
|
-
(_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 || (_containerRef$current3 = _containerRef$current3.parentElement) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.offsetWidth
|
|
92
|
+
tags
|
|
97
93
|
]);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if ((_popoverTriggerRef$cu = popoverTriggerRef.current) === null || _popoverTriggerRef$cu === void 0 ? void 0 : _popoverTriggerRef$cu.offsetWidth) {
|
|
101
|
-
var _containerRef$current4;
|
|
102
|
-
var _containerRef$current5;
|
|
103
|
-
var _tagsContainer$parent;
|
|
104
|
-
var _tagsContainer$parent2;
|
|
105
|
-
const newPopoverTriggerWidth = popoverTriggerRef.current.offsetWidth;
|
|
106
|
-
setPopoverTriggerWidth(newPopoverTriggerWidth);
|
|
107
|
-
const tagsContainer = containerRef.current;
|
|
108
|
-
const tagsContainerWidth = (_containerRef$current4 = (_containerRef$current5 = containerRef.current) === null || _containerRef$current5 === void 0 ? void 0 : _containerRef$current5.offsetWidth) !== null && _containerRef$current4 !== void 0 ? _containerRef$current4 : 0;
|
|
109
|
-
const parentWidth = (_tagsContainer$parent = tagsContainer === null || tagsContainer === void 0 || (_tagsContainer$parent2 = tagsContainer.parentElement) === null || _tagsContainer$parent2 === void 0 ? void 0 : _tagsContainer$parent2.offsetWidth) !== null && _tagsContainer$parent !== void 0 ? _tagsContainer$parent : 0;
|
|
110
|
-
if (visibleTags.length > 1 && hiddenTags.length > 0 && tagsContainerWidth + newPopoverTriggerWidth > parentWidth) {
|
|
111
|
-
var _visibleTags$at;
|
|
112
|
-
const visibleTagsCopy = visibleTags.filter((_, index) => index < visibleTags.length - 1);
|
|
113
|
-
const tagToMove = (_visibleTags$at = visibleTags.at(-1)) !== null && _visibleTags$at !== void 0 ? _visibleTags$at : "";
|
|
114
|
-
setVisibleTags(visibleTagsCopy);
|
|
115
|
-
setHiddenTags([tagToMove, ...hiddenTags]);
|
|
116
|
-
}
|
|
117
|
-
setIsReady(true);
|
|
118
|
-
}
|
|
119
|
-
}, [
|
|
120
|
-
hiddenTags,
|
|
121
|
-
threshold,
|
|
122
|
-
visibleTags,
|
|
123
|
-
visibleTags.length,
|
|
124
|
-
(_containerRef$current6 = containerRef.current) === null || _containerRef$current6 === void 0 || (_containerRef$current6 = _containerRef$current6.parentElement) === null || _containerRef$current6 === void 0 ? void 0 : _containerRef$current6.offsetWidth
|
|
125
|
-
]);
|
|
126
|
-
const renderTag = (tag, index, isEllipsis = false, hidden) => {
|
|
94
|
+
const renderTag = (tag, index, hidden) => {
|
|
95
|
+
const tagLabel = getTagLabel(tag);
|
|
127
96
|
const commonProps = {
|
|
128
|
-
className:
|
|
97
|
+
className: tagListStyle.tag,
|
|
129
98
|
copiable,
|
|
130
99
|
copiedText,
|
|
131
100
|
copyText,
|
|
132
|
-
|
|
133
|
-
"data-testid": hidden ? "" : getTagLabel(tag),
|
|
101
|
+
"data-testid": hidden ? "" : tagLabel,
|
|
134
102
|
variant,
|
|
135
103
|
sentiment
|
|
136
104
|
};
|
|
137
|
-
if (isKeyValueTag(tag)) return /* @__PURE__ */
|
|
138
|
-
return /* @__PURE__ */
|
|
105
|
+
if (isKeyValueTag(tag)) return /* @__PURE__ */ createElement(Tag, _objectSpread2(_objectSpread2({ keyValue: tag }, commonProps), {}, { key: `${tagLabel}-${index}` }));
|
|
106
|
+
return /* @__PURE__ */ createElement(Tag, _objectSpread2(_objectSpread2({}, commonProps), {}, { key: `${tagLabel}-${index}` }), isLabelIconTag(tag) ? tag.icon : void 0, tagLabel);
|
|
139
107
|
};
|
|
140
108
|
return /* @__PURE__ */ jsxs("div", {
|
|
141
109
|
className: cn(className, tagListStyle.container),
|
|
142
110
|
"data-testid": dataTestId,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
style: assignInlineVars({ [popoverTriggerWidthVar]: `${popoverTriggerWidth || 0}px` }),
|
|
150
|
-
children: visibleTags.map((tag, index) => renderTag(tag, index, index === visibleTags.length - 1, true))
|
|
151
|
-
}),
|
|
152
|
-
/* @__PURE__ */ jsx("div", {
|
|
153
|
-
ref: measureRef,
|
|
154
|
-
style: {
|
|
155
|
-
position: "absolute",
|
|
156
|
-
visibility: "hidden",
|
|
157
|
-
whiteSpace: "nowrap",
|
|
158
|
-
pointerEvents: "none"
|
|
159
|
-
},
|
|
160
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
161
|
-
className: tagListStyle.tagContainer({ multiline }),
|
|
162
|
-
"data-testid": `${dataTestId !== null && dataTestId !== void 0 ? dataTestId : "taglist"}-measure-container`,
|
|
163
|
-
children: potentiallyVisibleTags.map((tag, index) => renderTag(tag, index))
|
|
164
|
-
})
|
|
165
|
-
}),
|
|
166
|
-
hiddenTags.length > 0 && /* @__PURE__ */ jsx(Popover, {
|
|
111
|
+
ref: containerRef,
|
|
112
|
+
style,
|
|
113
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
114
|
+
className: cn(tagListStyle.tagContainer({ multiline })),
|
|
115
|
+
"data-testid": `${dataTestId !== null && dataTestId !== void 0 ? dataTestId : "taglist"}-container`,
|
|
116
|
+
children: [visibleTags.map((tag, index) => renderTag(tag, index, true)), hiddenTags.length > 0 && /* @__PURE__ */ jsx(Popover, {
|
|
167
117
|
content: /* @__PURE__ */ jsx("div", {
|
|
168
118
|
className: tagListStyle.tagContainer({ multiline: true }),
|
|
169
119
|
children: hiddenTags.map((tag, index) => renderTag(tag, index))
|
|
@@ -174,19 +124,31 @@ function init_TagList() {
|
|
|
174
124
|
size: "small",
|
|
175
125
|
title: popoverTitle,
|
|
176
126
|
visible: isPopoverVisible,
|
|
177
|
-
children: /* @__PURE__ */ jsxs("
|
|
178
|
-
|
|
127
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
128
|
+
type: "button",
|
|
129
|
+
className: tagListStyle.counter,
|
|
179
130
|
"data-testid": `${dataTestId !== null && dataTestId !== void 0 ? dataTestId : "taglist"}-open`,
|
|
180
131
|
onClick: () => setIsPopoverVisible(true),
|
|
181
132
|
onKeyDown: (event) => {
|
|
182
133
|
if ([" ", "Enter"].includes(event.key)) setIsPopoverVisible(true);
|
|
183
134
|
},
|
|
184
|
-
ref: popoverTriggerRef,
|
|
185
|
-
tabIndex: 0,
|
|
186
135
|
children: ["+", hiddenTags.length]
|
|
187
136
|
})
|
|
188
|
-
})
|
|
189
|
-
|
|
137
|
+
})]
|
|
138
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
139
|
+
"aria-hidden": "true",
|
|
140
|
+
ref: measureRef,
|
|
141
|
+
className: tagListStyle.measurementContainer,
|
|
142
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
143
|
+
className: tagListStyle.tagContainer({ multiline }),
|
|
144
|
+
children: potentiallyVisibleTags.map((tag, index) => renderTag(tag, index))
|
|
145
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
146
|
+
type: "button",
|
|
147
|
+
className: tagListStyle.counter,
|
|
148
|
+
ref: popoverTriggerRef,
|
|
149
|
+
children: ["+", surelyHiddenTags.length]
|
|
150
|
+
})]
|
|
151
|
+
})]
|
|
190
152
|
});
|
|
191
153
|
};
|
|
192
154
|
TagList.displayName = "TagList";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../../src/components/TagList/styles.css.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB,oBAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../../src/components/TagList/styles.css.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB,oBAAc,CAAA;AAuDjD,eAAO,MAAM,YAAY;;;;;;;;;;;;CAMxB,CAAA"}
|
|
@@ -3,26 +3,25 @@ import { init_styles_css_ts_vanilla } from "./styles.css.ts.vanilla.js";
|
|
|
3
3
|
import { createRuntimeFn } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
4
4
|
|
|
5
5
|
//#region src/components/TagList/styles.css.ts
|
|
6
|
-
var
|
|
6
|
+
var tagListStyle;
|
|
7
7
|
function init_styles_css() {
|
|
8
8
|
return (init_styles_css = __esmMin(() => {
|
|
9
9
|
/* @__PURE__ */ init_styles_css_ts_vanilla();
|
|
10
|
-
popoverTriggerWidthVar = "var(--uv_1f9zr5y0)";
|
|
11
10
|
tagListStyle = {
|
|
12
11
|
container: "uv_1f9zr5y1",
|
|
13
12
|
tagContainer: createRuntimeFn({
|
|
14
|
-
defaultClassName: "
|
|
15
|
-
variantClassNames: { multiline: { true: "
|
|
13
|
+
defaultClassName: "uv_1f9zr5y3",
|
|
14
|
+
variantClassNames: { multiline: { true: "uv_1f9zr5y4" } },
|
|
16
15
|
defaultVariants: {},
|
|
17
16
|
compoundVariants: []
|
|
18
17
|
}),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
tag: "uv_1f9zr5y5",
|
|
19
|
+
counter: "uv_1f9zr5y6",
|
|
20
|
+
measurementContainer: "uv_1f9zr5y2"
|
|
22
21
|
};
|
|
23
22
|
}))();
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
//#endregion
|
|
27
26
|
init_styles_css();
|
|
28
|
-
export { init_styles_css,
|
|
27
|
+
export { init_styles_css, tagListStyle };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Text/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Text/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAGtD,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAG5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAI9C,KAAK,eAAe,GAAG,MAAM,OAAO,WAAW,CAAA;AAC/C,KAAK,cAAc,GAAG,aAAa,CAAC,WAAW,CAAC,CAAA;AAChD,KAAK,eAAe,GAAG,aAAa,CAAC,YAAY,CAAC,CAAA;AAElD,KAAK,SAAS,GAAG;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,cAAc,CAAA;IAC1B,OAAO,EAAE,WAAW,CAAA;IACpB,SAAS,CAAC,EAAE,aAAa,CAAA;IACzB,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,EAAE,EAAE,WAAW,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,CAAA;IAC5C,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,CAAA;6BAKoB,EACnB,OAAO,EACP,QAAQ,EACR,EAAE,EAAE,SAAiB,EACrB,SAAS,EACT,OAAe,EACf,SAAS,EACT,UAAsB,EACtB,SAAS,EACT,QAAgB,EAChB,MAAc,EACd,SAAiB,EACjB,aAAqB,EACrB,EAAE,EACF,GAAG,EACH,UAAU,EACV,OAAO,EACP,IAAI,EACJ,aAAa,EAAE,UAAU,EACzB,aAAa,EAAE,UAAU,EACzB,KAAK,GACN,EAAE,SAAS"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { __esmMin, __name } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import _objectSpread2, { init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
+
import _objectSpread2, { init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/objectSpread2.js";
|
|
4
4
|
import recursivelyGetChildrenString, { init_recursivelyGetChildrenString } from "../../helpers/recursivelyGetChildrenString.js";
|
|
5
5
|
import { init_useIsOverflowing, useIsOverflowing } from "../../hooks/useIsOverflowing.js";
|
|
6
6
|
import { Tooltip, init_Tooltip } from "../Tooltip/index.js";
|
|
7
7
|
import { init_style_css, textStyle } from "./style.css.js";
|
|
8
8
|
import { init_variables_css, textVars } from "./variables.css.js";
|
|
9
|
-
import { useRef } from "react";
|
|
10
9
|
import { cn } from "@ultraviolet/utils";
|
|
11
10
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
12
11
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -22,11 +21,10 @@ function init_Text() {
|
|
|
22
21
|
init_variables_css();
|
|
23
22
|
init_objectSpread2();
|
|
24
23
|
Text = ({ variant, children, as: Component = "div", sentiment, oneLine = false, placement, prominence = "default", className, disabled = false, italic = false, underline = false, strikeThrough = false, id, dir, whiteSpace, htmlFor, role, "data-testid": dataTestId, "aria-hidden": ariaHidden, style }) => {
|
|
25
|
-
const
|
|
26
|
-
const isOverflowing = useIsOverflowing(elementRef);
|
|
24
|
+
const [setElement, isOverflowing] = useIsOverflowing({ enabled: oneLine === true });
|
|
27
25
|
const finalStringChildren = recursivelyGetChildrenString(children);
|
|
28
26
|
return /* @__PURE__ */ jsx(Tooltip, {
|
|
29
|
-
text:
|
|
27
|
+
text: isOverflowing ? finalStringChildren : "",
|
|
30
28
|
children: /* @__PURE__ */ jsx(Component, {
|
|
31
29
|
role,
|
|
32
30
|
"aria-hidden": ariaHidden,
|
|
@@ -44,7 +42,7 @@ function init_Text() {
|
|
|
44
42
|
dir,
|
|
45
43
|
htmlFor,
|
|
46
44
|
id,
|
|
47
|
-
ref:
|
|
45
|
+
ref: setElement,
|
|
48
46
|
style: _objectSpread2(_objectSpread2({}, assignInlineVars(textVars, {
|
|
49
47
|
textAlign: placement !== null && placement !== void 0 ? placement : "",
|
|
50
48
|
whiteSpace: whiteSpace !== null && whiteSpace !== void 0 ? whiteSpace : ""
|
|
@@ -1,54 +1,7 @@
|
|
|
1
1
|
import type { TextStyleObject } from '@ultraviolet/themes';
|
|
2
|
-
import type { RecipeVariants } from '@vanilla-extract/recipes';
|
|
3
2
|
type StyleText = Omit<TextStyleObject, 'paragraphSpacing' | 'textCase' | 'textDecoration' | 'weight'> & {
|
|
4
3
|
textTransform: string;
|
|
5
4
|
};
|
|
6
|
-
declare const text: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
7
|
-
disabled: {
|
|
8
|
-
true: {};
|
|
9
|
-
};
|
|
10
|
-
italic: {
|
|
11
|
-
true: {
|
|
12
|
-
fontStyle: "italic";
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
oneLine: {
|
|
16
|
-
true: {
|
|
17
|
-
overflow: "hidden";
|
|
18
|
-
textOverflow: "ellipsis";
|
|
19
|
-
whiteSpace: "nowrap";
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
prominence: {
|
|
23
|
-
default: {};
|
|
24
|
-
strong: {};
|
|
25
|
-
stronger: {};
|
|
26
|
-
weak: {};
|
|
27
|
-
};
|
|
28
|
-
sentiment: {
|
|
29
|
-
black: {};
|
|
30
|
-
danger: {};
|
|
31
|
-
info: {};
|
|
32
|
-
neutral: {};
|
|
33
|
-
primary: {};
|
|
34
|
-
secondary: {};
|
|
35
|
-
success: {};
|
|
36
|
-
warning: {};
|
|
37
|
-
white: {};
|
|
38
|
-
};
|
|
39
|
-
strikeThrough: {
|
|
40
|
-
true: {
|
|
41
|
-
textDecoration: "line-through";
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
underline: {
|
|
45
|
-
true: {
|
|
46
|
-
textDecoration: "underline";
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
variant: Record<"body" | "bodySmall" | "bodySmallStrong" | "bodySmallStronger" | "bodyStrong" | "bodyStronger" | "caption" | "captionSmall" | "captionSmallStrong" | "captionSmallStronger" | "captionStrong" | "captionStronger" | "code" | "codeSmall" | "codeSmallStrong" | "codeSmallStronger" | "codeStrong" | "codeStronger" | "heading" | "headingLarge" | "headingLargeStrong" | "headingLargeStronger" | "headingSmall" | "headingSmallStrong" | "headingSmallStronger" | "headingStrong" | "headingStronger", StyleText>;
|
|
50
|
-
}>;
|
|
51
|
-
export type TextVariants = NonNullable<RecipeVariants<typeof text>>;
|
|
52
5
|
export declare const textStyle: {
|
|
53
6
|
text: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
54
7
|
disabled: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.css.d.ts","sourceRoot":"","sources":["../../../src/components/Text/style.css.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,eAAe,EAAe,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"style.css.d.ts","sourceRoot":"","sources":["../../../src/components/Text/style.css.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,eAAe,EAAe,MAAM,qBAAqB,CAAA;AAyBtF,KAAK,SAAS,GAAG,IAAI,CAAC,eAAe,EAAE,kBAAkB,GAAG,UAAU,GAAG,gBAAgB,GAAG,QAAQ,CAAC,GAAG;IACtG,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAoJD,eAAO,MAAM,SAAS;;;YA/ChB,IAAI;;;;;;;;;;;;;;;YAeJ,OAAO;YACP,MAAM;YACN,QAAQ;YACR,IAAI;;;YAGJ,KAAK;YACL,MAAM;YACN,IAAI;YACJ,OAAO;YACP,OAAO;YACP,SAAS;YACT,OAAO;YACP,OAAO;YACP,KAAK;;;;;;;;;;;;;;;CAkB+B,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { __esmMin, __name } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import _objectSpread2, { init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
+
import _objectSpread2, { init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/objectSpread2.js";
|
|
4
4
|
import { Stack, init_Stack } from "../Stack/index.js";
|
|
5
5
|
import { Tooltip, init_Tooltip } from "../Tooltip/index.js";
|
|
6
6
|
import { Button, init_Button } from "../Button/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { __esmMin, __name } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import _objectSpread2, { init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
+
import _objectSpread2, { init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/objectSpread2.js";
|
|
4
4
|
import { Stack, init_Stack } from "../Stack/index.js";
|
|
5
5
|
import { Text, init_Text } from "../Text/index.js";
|
|
6
6
|
import { hasHelperText, init_hasHelperText } from "../../helpers/hasHelperText.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { __esmMin, __name } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import _objectSpread2, { init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
+
import _objectSpread2, { init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/objectSpread2.js";
|
|
4
4
|
import { CloseButton, init_CloseButton } from "./components/CloseButton.js";
|
|
5
5
|
import { Content, init_Content } from "./components/Content.js";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { __esmMin, __name } from "../../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import _objectSpread2, { init_objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.
|
|
4
|
-
import _objectWithoutProperties, { init_objectWithoutProperties } from "../../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
+
import _objectSpread2, { init_objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/objectSpread2.js";
|
|
4
|
+
import _objectWithoutProperties, { init_objectWithoutProperties } from "../../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/objectWithoutProperties.js";
|
|
5
5
|
import { Button, init_Button as init_Button$1 } from "../../Button/index.js";
|
|
6
6
|
import { init_styles_css, toasterStyle } from "../styles.css.js";
|
|
7
7
|
import { cn } from "@ultraviolet/utils";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { __esmMin, __name } from "../../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import _objectSpread2, { init_objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
+
import _objectSpread2, { init_objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/objectSpread2.js";
|
|
4
4
|
import { Link, init_Link as init_Link$1 } from "../../Link/index.js";
|
|
5
|
-
import _objectDestructuringEmpty, { init_objectDestructuringEmpty } from "../../../_virtual/_@oxc-project_runtime@0.
|
|
6
|
-
import _extends, { init_extends } from "../../../_virtual/_@oxc-project_runtime@0.
|
|
5
|
+
import _objectDestructuringEmpty, { init_objectDestructuringEmpty } from "../../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/objectDestructuringEmpty.js";
|
|
6
|
+
import _extends, { init_extends } from "../../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/extends.js";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
|
|
9
9
|
//#region src/components/Toaster/components/Link.tsx
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TooltipProps } from '.';
|
|
2
|
+
import type { useTooltip } from './useTooltip';
|
|
3
|
+
type TooltipChildrenProps = {
|
|
4
|
+
tooltip: ReturnType<typeof useTooltip>;
|
|
5
|
+
tooltipId: string;
|
|
6
|
+
isTooltipVisible: boolean;
|
|
7
|
+
} & Pick<TooltipProps, 'children' | 'tabIndex' | 'relation' | 'containerFullHeight' | 'containerFullWidth'>;
|
|
8
|
+
export declare const TooltipChildren: ({ children, tooltip, tooltipId, tabIndex, relation, isTooltipVisible, containerFullHeight, containerFullWidth, }: TooltipChildrenProps) => string | number | bigint | boolean | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | Iterable<import("react").ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=TooltipChildren.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TooltipChildren.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/TooltipChildren.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,GAAG,CAAA;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAqB9C,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAA;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,OAAO,CAAA;CAC1B,GAAG,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,qBAAqB,GAAG,oBAAoB,CAAC,CAAA;AAE3G,eAAO,MAAM,eAAe,qHASzB,oBAAoB,gWA4DtB,CAAA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { __esmMin, __name } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import _objectSpread2, { init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/objectSpread2.js";
|
|
3
|
+
import { init_styles_css, tooltipStyle } from "./styles.css.js";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/Tooltip/TooltipChildren.tsx
|
|
8
|
+
var FOCUSABLE_ELEMENTS, TooltipChildren;
|
|
9
|
+
function init_TooltipChildren() {
|
|
10
|
+
return (init_TooltipChildren = __esmMin(() => {
|
|
11
|
+
init_styles_css();
|
|
12
|
+
init_objectSpread2();
|
|
13
|
+
FOCUSABLE_ELEMENTS = `
|
|
14
|
+
:is(
|
|
15
|
+
a[href],
|
|
16
|
+
button,
|
|
17
|
+
input:not([type="hidden"]),
|
|
18
|
+
select,
|
|
19
|
+
textarea,
|
|
20
|
+
[tabindex],
|
|
21
|
+
[contenteditable="true"],
|
|
22
|
+
details,
|
|
23
|
+
summary,
|
|
24
|
+
audio[controls],
|
|
25
|
+
video[controls]
|
|
26
|
+
)
|
|
27
|
+
:not([disabled])
|
|
28
|
+
:not([tabindex="-1"])
|
|
29
|
+
`.replace(/\s+/g, "");
|
|
30
|
+
TooltipChildren = ({ children, tooltip, tooltipId, tabIndex = 0, relation, isTooltipVisible, containerFullHeight, containerFullWidth }) => {
|
|
31
|
+
const eventHandlers = tooltip.getReferenceProps();
|
|
32
|
+
const ariaAttributeName = relation === "label" ? "aria-labelledby" : "aria-describedby";
|
|
33
|
+
const ariaAttributeValue = isTooltipVisible ? tooltipId : null;
|
|
34
|
+
const tooltipWrapperRef = useRef(null);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!tooltipWrapperRef.current) return;
|
|
37
|
+
const reference = tooltipWrapperRef.current.querySelector(FOCUSABLE_ELEMENTS) || tooltipWrapperRef.current;
|
|
38
|
+
const existingAriaValue = reference.getAttribute(ariaAttributeName);
|
|
39
|
+
tooltip.refs.setReference(reference);
|
|
40
|
+
const clearAriaAttribute = () => {
|
|
41
|
+
if (existingAriaValue) reference.setAttribute(ariaAttributeName, existingAriaValue);
|
|
42
|
+
else reference.removeAttribute(ariaAttributeName);
|
|
43
|
+
};
|
|
44
|
+
if (ariaAttributeValue) reference.setAttribute(ariaAttributeName, [existingAriaValue, ariaAttributeValue].join(" ").trim());
|
|
45
|
+
else clearAriaAttribute();
|
|
46
|
+
if (reference === tooltipWrapperRef.current && tooltipWrapperRef.current.tabIndex !== tabIndex) tooltipWrapperRef.current.tabIndex = tabIndex;
|
|
47
|
+
return clearAriaAttribute;
|
|
48
|
+
}, [
|
|
49
|
+
tooltip,
|
|
50
|
+
tabIndex,
|
|
51
|
+
ariaAttributeName,
|
|
52
|
+
ariaAttributeValue
|
|
53
|
+
]);
|
|
54
|
+
if (typeof children === "function") return children(_objectSpread2(_objectSpread2({}, eventHandlers), {}, {
|
|
55
|
+
[ariaAttributeName]: ariaAttributeValue,
|
|
56
|
+
ref: tooltip.refs.setReference
|
|
57
|
+
}));
|
|
58
|
+
return /* @__PURE__ */ jsx("div", _objectSpread2(_objectSpread2({
|
|
59
|
+
ref: tooltipWrapperRef,
|
|
60
|
+
className: tooltipStyle.childrenContainer({
|
|
61
|
+
fullHeight: containerFullHeight,
|
|
62
|
+
fullWidth: containerFullWidth
|
|
63
|
+
})
|
|
64
|
+
}, eventHandlers), {}, { children }));
|
|
65
|
+
};
|
|
66
|
+
}))();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
init_TooltipChildren();
|
|
71
|
+
export { TooltipChildren, init_TooltipChildren };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TooltipProps } from '.';
|
|
2
|
+
import type { useTooltip } from './useTooltip';
|
|
3
|
+
type TooltipElementProps = Pick<TooltipProps, 'id' | 'className' | 'style' | 'data-testid' | 'maxWidth' | 'text'> & {
|
|
4
|
+
tooltip: ReturnType<typeof useTooltip>;
|
|
5
|
+
};
|
|
6
|
+
export declare const TooltipElement: ({ tooltip, id, className, style, 'data-testid': dataTestId, maxWidth, text, }: TooltipElementProps) => import("react").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=TooltipElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TooltipElement.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/TooltipElement.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,GAAG,CAAA;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAI9C,KAAK,mBAAmB,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,WAAW,GAAG,OAAO,GAAG,aAAa,GAAG,UAAU,GAAG,MAAM,CAAC,GAAG;IAClH,OAAO,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAA;CACvC,CAAA;AAED,eAAO,MAAM,cAAc,kFAQxB,mBAAmB,gCAyBrB,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { __esmMin, __name } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import _objectSpread2, { init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/objectSpread2.js";
|
|
3
|
+
import { init_styles_css, tooltipStyle } from "./styles.css.js";
|
|
4
|
+
import { init_styles_css as init_styles_css$1, visuallyHiddenStyle } from "../VisuallyHidden/styles.css.js";
|
|
5
|
+
import { cn } from "@ultraviolet/utils";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/components/Tooltip/TooltipElement.tsx
|
|
9
|
+
var TooltipElement;
|
|
10
|
+
function init_TooltipElement() {
|
|
11
|
+
return (init_TooltipElement = __esmMin(() => {
|
|
12
|
+
init_styles_css$1();
|
|
13
|
+
init_styles_css();
|
|
14
|
+
init_objectSpread2();
|
|
15
|
+
TooltipElement = ({ tooltip, id, className, style, "data-testid": dataTestId, maxWidth, text }) => {
|
|
16
|
+
return /* @__PURE__ */ jsxs("div", _objectSpread2(_objectSpread2({}, tooltip.getFloatingProps()), {}, {
|
|
17
|
+
id,
|
|
18
|
+
className: cn(className, tooltipStyle.tooltip, tooltip.isMounted ? null : visuallyHiddenStyle.visuallyHidden, tooltip.status === "open" || tooltip.status === "close" ? tooltipStyle.animation[tooltip.status] : null),
|
|
19
|
+
"data-placement": tooltip.finalPlacement,
|
|
20
|
+
"data-testid": dataTestId,
|
|
21
|
+
ref: tooltip.refs.setFloating,
|
|
22
|
+
role: "tooltip",
|
|
23
|
+
style: _objectSpread2(_objectSpread2({}, tooltip.floatingStyles), {}, { maxWidth: typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth }, style),
|
|
24
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
25
|
+
className: tooltipStyle.arrow,
|
|
26
|
+
ref: tooltip.arrowRef,
|
|
27
|
+
style: tooltip.arrowStyle
|
|
28
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
29
|
+
className: tooltipStyle.content,
|
|
30
|
+
children: text
|
|
31
|
+
})]
|
|
32
|
+
}));
|
|
33
|
+
};
|
|
34
|
+
}))();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
init_TooltipElement();
|
|
39
|
+
export { TooltipElement, init_TooltipElement };
|