@ultraviolet/ui 3.0.0-beta.27 → 3.0.0-beta.28
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/components/ActionBar/index.js +19 -7
- package/dist/components/Alert/index.d.ts +2 -1
- package/dist/components/Alert/index.js +98 -20
- package/dist/components/Alert/styles.css.d.ts +10 -1
- package/dist/components/Alert/styles.css.js +7 -5
- package/dist/components/Avatar/index.d.ts +1 -1
- package/dist/components/Avatar/index.js +46 -36
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Badge/index.js +19 -8
- package/dist/components/Banner/index.d.ts +1 -1
- package/dist/components/Banner/index.js +87 -28
- package/dist/components/BarChart/Tooltip.d.ts +1 -1
- package/dist/components/BarChart/Tooltip.js +23 -10
- package/dist/components/BarChart/index.d.ts +1 -1
- package/dist/components/BarChart/index.js +51 -31
- package/dist/components/BarStack/index.d.ts +1 -1
- package/dist/components/BarStack/index.js +64 -19
- package/dist/components/Breadcrumbs/components/Item.d.ts +1 -1
- package/dist/components/Breadcrumbs/components/Item.js +48 -12
- package/dist/components/Breadcrumbs/index.js +11 -2
- package/dist/components/Bullet/index.d.ts +1 -1
- package/dist/components/Bullet/index.js +10 -7
- package/dist/components/Button/index.js +122 -72
- package/dist/components/Card/index.js +80 -20
- package/dist/components/Carousel/index.d.ts +3 -3
- package/dist/components/Carousel/index.js +72 -26
- package/dist/components/Checkbox/index.js +139 -43
- package/dist/components/CheckboxGroup/index.d.ts +3 -3
- package/dist/components/CheckboxGroup/index.js +77 -24
- package/dist/components/Chip/ChipIcon.d.ts +1 -1
- package/dist/components/Chip/ChipIcon.js +46 -12
- package/dist/components/Chip/index.d.ts +3 -3
- package/dist/components/Chip/index.js +36 -11
- package/dist/components/CopyButton/index.d.ts +1 -1
- package/dist/components/CopyButton/index.js +23 -8
- package/dist/components/DateInput/components/CalendarContent.d.ts +1 -1
- package/dist/components/DateInput/components/CalendarContent.js +61 -26
- package/dist/components/DateInput/components/CalendarDaily.d.ts +1 -1
- package/dist/components/DateInput/components/CalendarDaily.js +105 -62
- package/dist/components/DateInput/components/CalendarMonthly.d.ts +1 -1
- package/dist/components/DateInput/components/CalendarMonthly.js +62 -39
- package/dist/components/DateInput/components/Popup.d.ts +1 -1
- package/dist/components/DateInput/components/Popup.js +27 -4
- package/dist/components/DateInput/helpers.js +9 -2
- package/dist/components/DateInput/helpersLocale.js +3 -9
- package/dist/components/DateInput/index.d.ts +1 -1
- package/dist/components/DateInput/index.js +193 -62
- package/dist/components/Dialog/Context.js +3 -1
- package/dist/components/Dialog/components/Button.d.ts +1 -1
- package/dist/components/Dialog/components/Button.js +12 -2
- package/dist/components/Dialog/components/Buttons.d.ts +1 -1
- package/dist/components/Dialog/components/Buttons.js +1 -1
- package/dist/components/Dialog/components/CancelButton.d.ts +1 -1
- package/dist/components/Dialog/components/CancelButton.js +12 -2
- package/dist/components/Dialog/components/Stack.d.ts +1 -1
- package/dist/components/Dialog/components/Stack.js +2 -5
- package/dist/components/Dialog/components/Text.d.ts +1 -1
- package/dist/components/Dialog/components/Text.js +2 -5
- package/dist/components/Dialog/index.d.ts +7 -7
- package/dist/components/Dialog/index.js +43 -12
- package/dist/components/Drawer/index.d.ts +4 -4
- package/dist/components/Drawer/index.js +53 -15
- package/dist/components/EmptyState/index.d.ts +1 -1
- package/dist/components/EmptyState/index.js +63 -21
- package/dist/components/Expandable/index.d.ts +2 -2
- package/dist/components/Expandable/index.js +52 -15
- package/dist/components/ExpandableCard/components/Title.d.ts +1 -1
- package/dist/components/ExpandableCard/components/Title.js +12 -2
- package/dist/components/ExpandableCard/index.d.ts +1 -1
- package/dist/components/ExpandableCard/index.js +197 -96
- package/dist/components/GlobalAlert/GlobalAlertLink.d.ts +1 -1
- package/dist/components/GlobalAlert/GlobalAlertLink.js +21 -5
- package/dist/components/GlobalAlert/index.d.ts +2 -2
- package/dist/components/GlobalAlert/index.js +51 -11
- package/dist/components/InfiniteScroll/index.d.ts +1 -1
- package/dist/components/InfiniteScroll/index.js +40 -33
- package/dist/components/Key/index.d.ts +1 -1
- package/dist/components/Key/index.js +29 -8
- package/dist/components/Label/index.d.ts +1 -1
- package/dist/components/Label/index.js +67 -6
- package/dist/components/LineChart/CustomLegend.d.ts +1 -1
- package/dist/components/LineChart/CustomLegend.js +69 -45
- package/dist/components/LineChart/Tooltip.d.ts +1 -1
- package/dist/components/LineChart/Tooltip.js +31 -9
- package/dist/components/LineChart/helpers.js +13 -12
- package/dist/components/LineChart/index.d.ts +1 -1
- package/dist/components/LineChart/index.js +56 -40
- package/dist/components/Link/index.js +74 -57
- package/dist/components/List/Cell.js +24 -22
- package/dist/components/List/ColumnProvider.d.ts +1 -1
- package/dist/components/List/ColumnProvider.js +12 -6
- package/dist/components/List/HeaderCell.d.ts +1 -1
- package/dist/components/List/HeaderCell.js +36 -19
- package/dist/components/List/HeaderRow.d.ts +1 -1
- package/dist/components/List/HeaderRow.js +14 -12
- package/dist/components/List/ListContext.d.ts +1 -1
- package/dist/components/List/ListContext.js +128 -78
- package/dist/components/List/Row.js +166 -90
- package/dist/components/List/SelectBar.d.ts +1 -1
- package/dist/components/List/SelectBar.js +20 -10
- package/dist/components/List/SkeletonRows.d.ts +1 -1
- package/dist/components/List/SkeletonRows.js +26 -16
- package/dist/components/List/index.d.ts +1 -1
- package/dist/components/List/index.js +60 -22
- package/dist/components/Loader/index.d.ts +1 -1
- package/dist/components/Loader/index.js +47 -23
- package/dist/components/Menu/MenuContent.d.ts +1 -1
- package/dist/components/Menu/MenuContent.js +216 -162
- package/dist/components/Menu/MenuProvider.d.ts +1 -1
- package/dist/components/Menu/MenuProvider.js +26 -13
- package/dist/components/Menu/components/Group.d.ts +1 -1
- package/dist/components/Menu/components/Group.js +11 -2
- package/dist/components/Menu/components/Item.js +144 -82
- package/dist/components/Menu/helpers.js +3 -1
- package/dist/components/Menu/index.d.ts +2 -2
- package/dist/components/Menu/index.js +5 -11
- package/dist/components/Menu/types.d.ts +2 -2
- package/dist/components/Meter/index.d.ts +1 -1
- package/dist/components/Meter/index.js +43 -12
- package/dist/components/Modal/ModalContent.d.ts +1 -1
- package/dist/components/Modal/ModalContent.js +41 -11
- package/dist/components/Modal/ModalProvider.d.ts +1 -1
- package/dist/components/Modal/ModalProvider.js +14 -11
- package/dist/components/Modal/components/Dialog.js +91 -47
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/Modal/index.js +60 -3
- package/dist/components/Notice/index.d.ts +1 -1
- package/dist/components/Notice/index.js +24 -5
- package/dist/components/Notification/Notification.js +12 -2
- package/dist/components/Notification/NotificationContainer.d.ts +1 -1
- package/dist/components/Notification/NotificationContainer.js +18 -2
- package/dist/components/NumberInput/index.d.ts +1 -1
- package/dist/components/NumberInput/index.js +239 -130
- package/dist/components/Pagination/PaginationButtons.d.ts +1 -1
- package/dist/components/Pagination/PaginationButtons.js +75 -10
- package/dist/components/Pagination/PerPage.d.ts +1 -1
- package/dist/components/Pagination/PerPage.js +32 -17
- package/dist/components/Pagination/getPageNumbers.js +12 -13
- package/dist/components/Pagination/index.d.ts +1 -1
- package/dist/components/Pagination/index.js +26 -3
- package/dist/components/PasswordCheck/index.d.ts +1 -1
- package/dist/components/PasswordCheck/index.js +27 -5
- package/dist/components/PieChart/Legends.d.ts +1 -1
- package/dist/components/PieChart/Legends.js +52 -20
- package/dist/components/PieChart/Tooltip.d.ts +1 -1
- package/dist/components/PieChart/Tooltip.js +2 -4
- package/dist/components/PieChart/index.d.ts +1 -1
- package/dist/components/PieChart/index.js +80 -40
- package/dist/components/Popover/index.js +104 -46
- package/dist/components/Popup/helpers.d.ts +5 -1
- package/dist/components/Popup/helpers.js +49 -35
- package/dist/components/Popup/index.js +344 -254
- package/dist/components/Popup/styles.css.js +0 -1
- package/dist/components/Popup/variables.css.js +1 -0
- package/dist/components/ProgressBar/index.d.ts +1 -1
- package/dist/components/ProgressBar/index.js +74 -20
- package/dist/components/ProgressBar/styles.css.js +1 -0
- package/dist/components/ProgressBar/variables.css.js +0 -1
- package/dist/components/Radio/index.js +83 -51
- package/dist/components/RadioGroup/index.d.ts +2 -2
- package/dist/components/RadioGroup/index.js +74 -20
- package/dist/components/Row/index.d.ts +1 -1
- package/dist/components/Row/index.js +38 -27
- package/dist/components/SearchInput/KeyGroup.d.ts +1 -1
- package/dist/components/SearchInput/KeyGroup.js +2 -6
- package/dist/components/SearchInput/index.js +232 -164
- package/dist/components/SelectInput/SelectInputProvider.d.ts +1 -1
- package/dist/components/SelectInput/SelectInputProvider.js +91 -55
- package/dist/components/SelectInput/components/Dropdown.d.ts +1 -1
- package/dist/components/SelectInput/components/Dropdown.js +408 -95
- package/dist/components/SelectInput/components/DropdownOption.d.ts +1 -1
- package/dist/components/SelectInput/components/DropdownOption.js +176 -27
- package/dist/components/SelectInput/components/SearchBarDropdown.d.ts +1 -1
- package/dist/components/SelectInput/components/SearchBarDropdown.js +40 -14
- package/dist/components/SelectInput/components/SelectBar.d.ts +1 -1
- package/dist/components/SelectInput/components/SelectBar.js +252 -97
- package/dist/components/SelectInput/index.d.ts +1 -1
- package/dist/components/SelectInput/index.js +102 -10
- package/dist/components/SelectableCard/index.js +200 -114
- package/dist/components/SelectableCardGroup/index.d.ts +2 -2
- package/dist/components/SelectableCardGroup/index.js +67 -25
- package/dist/components/SelectableCardOptionGroup/Provider.js +3 -1
- package/dist/components/SelectableCardOptionGroup/components/Image.d.ts +1 -1
- package/dist/components/SelectableCardOptionGroup/components/Image.js +12 -8
- package/dist/components/SelectableCardOptionGroup/components/Option.d.ts +1 -1
- package/dist/components/SelectableCardOptionGroup/components/Option.js +96 -19
- package/dist/components/SelectableCardOptionGroup/index.d.ts +2 -2
- package/dist/components/SelectableCardOptionGroup/index.js +53 -17
- package/dist/components/Separator/index.d.ts +1 -1
- package/dist/components/Separator/index.js +43 -26
- package/dist/components/Skeleton/Block.d.ts +1 -1
- package/dist/components/Skeleton/Block.js +2 -6
- package/dist/components/Skeleton/Blocks.d.ts +1 -1
- package/dist/components/Skeleton/Blocks.js +14 -9
- package/dist/components/Skeleton/BoxWithIcon.d.ts +1 -1
- package/dist/components/Skeleton/BoxWithIcon.js +14 -9
- package/dist/components/Skeleton/Donut.d.ts +1 -1
- package/dist/components/Skeleton/Donut.js +10 -2
- package/dist/components/Skeleton/IconSkeleton.d.ts +1 -1
- package/dist/components/Skeleton/IconSkeleton.js +1 -1
- package/dist/components/Skeleton/Line.d.ts +1 -1
- package/dist/components/Skeleton/Line.js +10 -4
- package/dist/components/Skeleton/List.d.ts +1 -1
- package/dist/components/Skeleton/List.js +3 -9
- package/dist/components/Skeleton/Slider.d.ts +1 -1
- package/dist/components/Skeleton/Slider.js +11 -8
- package/dist/components/Skeleton/Square.d.ts +1 -1
- package/dist/components/Skeleton/Square.js +1 -1
- package/dist/components/Skeleton/index.d.ts +9 -9
- package/dist/components/Skeleton/index.js +16 -5
- package/dist/components/Slider/components/DoubleSlider.d.ts +1 -1
- package/dist/components/Slider/components/DoubleSlider.js +191 -88
- package/dist/components/Slider/components/Options.d.ts +1 -1
- package/dist/components/Slider/components/Options.js +44 -28
- package/dist/components/Slider/components/SingleSlider.d.ts +1 -1
- package/dist/components/Slider/components/SingleSlider.js +133 -53
- package/dist/components/Slider/index.d.ts +1 -1
- package/dist/components/Slider/index.js +82 -12
- package/dist/components/Snippet/index.d.ts +1 -1
- package/dist/components/Snippet/index.js +103 -19
- package/dist/components/Stack/index.d.ts +1 -1
- package/dist/components/Stack/index.js +20 -24
- package/dist/components/Status/index.d.ts +1 -1
- package/dist/components/Status/index.js +13 -11
- package/dist/components/StepList/index.d.ts +2 -2
- package/dist/components/StepList/index.js +31 -10
- package/dist/components/Stepper/Step.d.ts +1 -1
- package/dist/components/Stepper/Step.js +65 -30
- package/dist/components/Stepper/StepperProvider.d.ts +1 -1
- package/dist/components/Stepper/StepperProvider.js +13 -10
- package/dist/components/Stepper/index.d.ts +2 -2
- package/dist/components/Stepper/index.js +46 -26
- package/dist/components/SwitchButton/FocusOverlay.d.ts +1 -1
- package/dist/components/SwitchButton/FocusOverlay.js +11 -5
- package/dist/components/SwitchButton/Option.d.ts +1 -1
- package/dist/components/SwitchButton/Option.js +20 -2
- package/dist/components/SwitchButton/index.d.ts +2 -2
- package/dist/components/SwitchButton/index.js +95 -48
- package/dist/components/Table/Body.d.ts +1 -1
- package/dist/components/Table/Body.js +2 -4
- package/dist/components/Table/Cell.d.ts +1 -1
- package/dist/components/Table/Cell.js +20 -17
- package/dist/components/Table/Header.d.ts +1 -1
- package/dist/components/Table/Header.js +2 -4
- package/dist/components/Table/HeaderCell.d.ts +1 -1
- package/dist/components/Table/HeaderCell.js +46 -22
- package/dist/components/Table/HeaderRow.d.ts +1 -1
- package/dist/components/Table/HeaderRow.js +21 -12
- package/dist/components/Table/Row.d.ts +1 -1
- package/dist/components/Table/Row.js +70 -14
- package/dist/components/Table/SelectBar.d.ts +1 -1
- package/dist/components/Table/SelectBar.js +20 -10
- package/dist/components/Table/SkeletonRows.d.ts +1 -1
- package/dist/components/Table/SkeletonRows.js +17 -16
- package/dist/components/Table/TableContext.d.ts +1 -1
- package/dist/components/Table/TableContext.js +22 -13
- package/dist/components/Table/index.d.ts +6 -6
- package/dist/components/Table/index.js +64 -23
- package/dist/components/Tabs/Tab.js +79 -41
- package/dist/components/Tabs/TabMenu.js +39 -23
- package/dist/components/Tabs/TabMenuItem.d.ts +1 -1
- package/dist/components/Tabs/TabMenuItem.js +20 -11
- package/dist/components/Tabs/TabsContext.js +3 -1
- package/dist/components/Tabs/index.d.ts +3 -3
- package/dist/components/Tabs/index.js +34 -14
- package/dist/components/Tag/index.d.ts +1 -1
- package/dist/components/Tag/index.js +45 -12
- package/dist/components/TagInput/index.d.ts +1 -1
- package/dist/components/TagInput/index.js +131 -52
- package/dist/components/TagInput/styles.css.d.ts +3 -0
- package/dist/components/TagList/index.d.ts +1 -1
- package/dist/components/TagList/index.js +132 -59
- package/dist/components/Text/index.d.ts +1 -1
- package/dist/components/Text/index.js +21 -17
- package/dist/components/Text/style.css.js +0 -1
- package/dist/components/Text/variables.css.js +1 -0
- package/dist/components/TextArea/index.js +178 -103
- package/dist/components/TextInput/index.d.ts +1 -1
- package/dist/components/TextInput/index.js +286 -106
- package/dist/components/TimeInput/constants.js +1 -5
- package/dist/components/TimeInput/index.d.ts +1 -1
- package/dist/components/TimeInput/index.js +207 -118
- package/dist/components/Toaster/Toaster.js +1 -1
- package/dist/components/Toaster/ToasterContainer.d.ts +1 -1
- package/dist/components/Toaster/ToasterContainer.js +21 -2
- package/dist/components/Toaster/components/Button.d.ts +1 -1
- package/dist/components/Toaster/components/CloseButton.d.ts +1 -1
- package/dist/components/Toaster/components/CloseButton.js +12 -2
- package/dist/components/Toaster/components/Content.d.ts +1 -1
- package/dist/components/Toaster/components/Content.js +2 -4
- package/dist/components/Toaster/components/Link.d.ts +1 -1
- package/dist/components/Toaster/index.d.ts +2 -2
- package/dist/components/Toggle/index.js +101 -40
- package/dist/components/ToggleGroup/index.d.ts +3 -3
- package/dist/components/ToggleGroup/index.js +61 -22
- package/dist/components/Tooltip/index.js +42 -19
- package/dist/components/TreeMapChart/Tooltip.d.ts +1 -1
- package/dist/components/TreeMapChart/Tooltip.js +1 -1
- package/dist/components/TreeMapChart/index.d.ts +1 -1
- package/dist/components/TreeMapChart/index.js +33 -27
- package/dist/components/UnitInput/index.d.ts +1 -1
- package/dist/components/UnitInput/index.js +110 -29
- package/dist/components/VerificationCode/index.d.ts +1 -1
- package/dist/components/VerificationCode/index.js +80 -21
- package/dist/helpers/legend.js +4 -4
- package/dist/helpers/treeMap.d.ts +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -4
- package/dist/theme/ThemeProvider.d.ts +1 -1
- package/dist/theme/ThemeProvider.js +4 -2
- package/dist/theme/index.js +1 -8
- package/dist/ui.css +1 -1
- package/dist/utils/ids.js +1 -3
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/responsive/index.d.ts +0 -1
- package/dist/utils/responsive/style.css.d.ts +3 -0
- package/package.json +2 -7
- package/dist/utils/responsive/Breakpoint.d.ts +0 -9
- package/dist/utils/responsive/Breakpoint.js +0 -14
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs, jsx } from "
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
4
4
|
import { useRef, useState, useMemo, useEffect } from "react";
|
|
5
5
|
import { Popover } from "../Popover/index.js";
|
|
@@ -37,7 +37,10 @@ const TagList = ({
|
|
|
37
37
|
while (tmpThreshold2 > 1 && tags.length > 0 && tags.slice(0, tmpThreshold2).reduce((acc, tag) => acc + getTagLabel(tag), "").length > maxLength) {
|
|
38
38
|
tmpThreshold2 -= 1;
|
|
39
39
|
}
|
|
40
|
-
const potentiallyVisibleTagsLength = Math.max(
|
|
40
|
+
const potentiallyVisibleTagsLength = Math.max(
|
|
41
|
+
1,
|
|
42
|
+
tags.length > tmpThreshold2 || false ? tmpThreshold2 : tags.length
|
|
43
|
+
);
|
|
41
44
|
const potentiallyVisibleTags2 = tags.slice(0, potentiallyVisibleTagsLength);
|
|
42
45
|
const surelyHiddenTags2 = tags.slice(potentiallyVisibleTagsLength);
|
|
43
46
|
return {
|
|
@@ -46,11 +49,7 @@ const TagList = ({
|
|
|
46
49
|
tmpThreshold: tmpThreshold2
|
|
47
50
|
};
|
|
48
51
|
}, [maxLength, tags, threshold]);
|
|
49
|
-
const {
|
|
50
|
-
tmpThreshold,
|
|
51
|
-
potentiallyVisibleTags,
|
|
52
|
-
surelyHiddenTags
|
|
53
|
-
} = memoizedResult;
|
|
52
|
+
const { tmpThreshold, potentiallyVisibleTags, surelyHiddenTags } = memoizedResult;
|
|
54
53
|
useEffect(() => {
|
|
55
54
|
if (tags.length === 0 || !containerRef.current || !measureRef.current) {
|
|
56
55
|
return;
|
|
@@ -64,29 +63,42 @@ const TagList = ({
|
|
|
64
63
|
const parentWidth = containerRef.current.parentElement?.offsetWidth || 0;
|
|
65
64
|
const toMeasureElements = measureRef.current.children[0].children;
|
|
66
65
|
const [firstTag, ...restOfToMeasureElements] = [...toMeasureElements];
|
|
67
|
-
const {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
66
|
+
const { measuredVisibleTags, measuredHiddenTags } = restOfToMeasureElements.reduce(
|
|
67
|
+
(accumulator, currentValue, index) => {
|
|
68
|
+
const newAccumulatedWidth = accumulator.accumulatedWidth + currentValue.offsetWidth + Number.parseInt(TAGS_GAP, 10);
|
|
69
|
+
return {
|
|
70
|
+
accumulatedWidth: newAccumulatedWidth,
|
|
71
|
+
measuredHiddenTags: [
|
|
72
|
+
...accumulator.measuredHiddenTags,
|
|
73
|
+
newAccumulatedWidth > parentWidth && tags[index + 1]
|
|
74
|
+
].filter(Boolean),
|
|
75
|
+
measuredVisibleTags: [
|
|
76
|
+
...accumulator.measuredVisibleTags,
|
|
77
|
+
newAccumulatedWidth <= parentWidth && tags[index + 1]
|
|
78
|
+
].filter(Boolean)
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
accumulatedWidth: firstTag.offsetWidth + Number.parseInt(TAGS_GAP, 10),
|
|
83
|
+
measuredHiddenTags: [],
|
|
84
|
+
measuredVisibleTags: [tags[0]]
|
|
85
|
+
// we need to always show one tag
|
|
86
|
+
}
|
|
87
|
+
);
|
|
83
88
|
const finalHiddenTags = [...measuredHiddenTags, ...surelyHiddenTags];
|
|
84
89
|
setVisibleTags(measuredVisibleTags);
|
|
85
90
|
setHiddenTags(finalHiddenTags);
|
|
86
91
|
if (finalHiddenTags.length === 0) {
|
|
87
92
|
setIsReady(true);
|
|
88
93
|
}
|
|
89
|
-
}, [
|
|
94
|
+
}, [
|
|
95
|
+
multiline,
|
|
96
|
+
potentiallyVisibleTags,
|
|
97
|
+
surelyHiddenTags,
|
|
98
|
+
tags,
|
|
99
|
+
threshold,
|
|
100
|
+
tmpThreshold
|
|
101
|
+
]);
|
|
90
102
|
useEffect(() => {
|
|
91
103
|
if (!isReady && popoverTriggerRef.current?.offsetWidth) {
|
|
92
104
|
const newPopoverTriggerWidth = popoverTriggerRef.current.offsetWidth;
|
|
@@ -95,8 +107,10 @@ const TagList = ({
|
|
|
95
107
|
const tagsContainerWidth = containerRef.current?.offsetWidth || 0;
|
|
96
108
|
const parentWidth = tagsContainer?.parentElement?.offsetWidth || 0;
|
|
97
109
|
if (visibleTags.length > 1 && hiddenTags.length > 0 && tagsContainerWidth + newPopoverTriggerWidth > parentWidth) {
|
|
98
|
-
const visibleTagsCopy = visibleTags.filter(
|
|
99
|
-
|
|
110
|
+
const visibleTagsCopy = visibleTags.filter(
|
|
111
|
+
(_, index) => index < visibleTags.length - 1
|
|
112
|
+
);
|
|
113
|
+
const tagToMove = visibleTags.at(-1) ?? "";
|
|
100
114
|
setVisibleTags(visibleTagsCopy);
|
|
101
115
|
setHiddenTags([tagToMove, ...hiddenTags]);
|
|
102
116
|
}
|
|
@@ -124,39 +138,98 @@ const TagList = ({
|
|
|
124
138
|
]
|
|
125
139
|
},
|
|
126
140
|
`${getTagLabel(tag)}-${index}`
|
|
127
|
-
) : /* @__PURE__ */ jsx(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
141
|
+
) : /* @__PURE__ */ jsx(
|
|
142
|
+
Tag,
|
|
143
|
+
{
|
|
144
|
+
className: isEllipsis ? "ellipsed" : "",
|
|
145
|
+
copiable,
|
|
146
|
+
copiedText,
|
|
147
|
+
copyText,
|
|
148
|
+
children: getTagLabel(tag)
|
|
149
|
+
},
|
|
150
|
+
`${getTagLabel(tag)}-${index}`
|
|
151
|
+
);
|
|
152
|
+
return /* @__PURE__ */ jsxs(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
className: `${className ? `${className} ` : ""}${tagListContainer}`,
|
|
156
|
+
"data-testid": dataTestId,
|
|
157
|
+
style: { visibility: isReady ? "visible" : "hidden", ...style },
|
|
158
|
+
children: [
|
|
159
|
+
/* @__PURE__ */ jsx(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
className: `${tagContainer({
|
|
163
|
+
multiline
|
|
164
|
+
})} ${visibleTags.length === 1 && hiddenTags.length === 0 || popoverTriggerWidth ? ellipsisContainer : ""}`,
|
|
165
|
+
"data-testid": `${dataTestId ?? "taglist"}-container`,
|
|
166
|
+
ref: containerRef,
|
|
167
|
+
style: assignInlineVars({
|
|
168
|
+
[popoverTriggerWidthVar]: `${popoverTriggerWidth || 0}px`
|
|
169
|
+
}),
|
|
170
|
+
children: visibleTags.map(
|
|
171
|
+
(tag, index) => renderTag(
|
|
172
|
+
tag,
|
|
173
|
+
index,
|
|
174
|
+
// add ellipsis to last tag
|
|
175
|
+
index === visibleTags.length - 1
|
|
176
|
+
)
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
/* @__PURE__ */ jsx(
|
|
181
|
+
"div",
|
|
182
|
+
{
|
|
183
|
+
ref: measureRef,
|
|
184
|
+
style: {
|
|
185
|
+
position: "absolute",
|
|
186
|
+
visibility: "hidden",
|
|
187
|
+
whiteSpace: "nowrap"
|
|
188
|
+
},
|
|
189
|
+
children: /* @__PURE__ */ jsx(
|
|
190
|
+
"div",
|
|
191
|
+
{
|
|
192
|
+
className: tagContainer({ multiline }),
|
|
193
|
+
"data-testid": `${dataTestId ?? "taglist"}-measure-container`,
|
|
194
|
+
children: potentiallyVisibleTags.map((tag, index) => renderTag(tag, index))
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
hiddenTags.length > 0 && /* @__PURE__ */ jsx(
|
|
200
|
+
Popover,
|
|
201
|
+
{
|
|
202
|
+
content: /* @__PURE__ */ jsx("div", { className: tagContainer({ multiline: true }), children: hiddenTags.map((tag, index) => renderTag(tag, index)) }),
|
|
203
|
+
maxHeight: popoverMaxHeight,
|
|
204
|
+
onClose: () => setIsPopoverVisible(false),
|
|
205
|
+
placement: popoverPlacement,
|
|
206
|
+
size: "small",
|
|
207
|
+
title: popoverTitle,
|
|
208
|
+
visible: isPopoverVisible,
|
|
209
|
+
children: /* @__PURE__ */ jsxs(
|
|
210
|
+
"span",
|
|
211
|
+
{
|
|
212
|
+
className: tagsWrapper,
|
|
213
|
+
"data-testid": `${dataTestId ?? "taglist"}-open`,
|
|
214
|
+
onClick: () => setIsPopoverVisible(true),
|
|
215
|
+
onKeyDown: (event) => {
|
|
216
|
+
if ([" ", "Enter"].includes(event.key)) {
|
|
217
|
+
setIsPopoverVisible(true);
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
ref: popoverTriggerRef,
|
|
221
|
+
tabIndex: 0,
|
|
222
|
+
children: [
|
|
223
|
+
"+",
|
|
224
|
+
hiddenTags.length
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
);
|
|
160
233
|
};
|
|
161
234
|
export {
|
|
162
235
|
TagList
|
|
@@ -28,5 +28,5 @@ type TextProps = {
|
|
|
28
28
|
/**
|
|
29
29
|
* Text component is used to display text with different variants and sentiments.
|
|
30
30
|
*/
|
|
31
|
-
export declare const Text: ({ variant, children, as: Component, sentiment, oneLine, placement, prominence, className, disabled, italic, underline, strikeThrough, id, dir, whiteSpace, htmlFor, "data-testid": dataTestId, "aria-hidden": ariaHidden, style, }: TextProps) => import("
|
|
31
|
+
export declare const Text: ({ variant, children, as: Component, sentiment, oneLine, placement, prominence, className, disabled, italic, underline, strikeThrough, id, dir, whiteSpace, htmlFor, "data-testid": dataTestId, "aria-hidden": ariaHidden, style, }: TextProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
32
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
4
4
|
import { useRef } from "react";
|
|
5
5
|
import recursivelyGetChildrenString from "../../helpers/recursivelyGetChildrenString.js";
|
|
@@ -31,22 +31,26 @@ const Text = ({
|
|
|
31
31
|
const elementRef = useRef(null);
|
|
32
32
|
const isOverflowing = useIsOverflowing(elementRef);
|
|
33
33
|
const finalStringChildren = recursivelyGetChildrenString(children);
|
|
34
|
-
return /* @__PURE__ */ jsx(Tooltip, { text: oneLine && isOverflowing ? finalStringChildren : "", children: /* @__PURE__ */ jsx(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
return /* @__PURE__ */ jsx(Tooltip, { text: oneLine && isOverflowing ? finalStringChildren : "", children: /* @__PURE__ */ jsx(
|
|
35
|
+
Component,
|
|
36
|
+
{
|
|
37
|
+
"aria-hidden": ariaHidden,
|
|
38
|
+
className: `${className ? `${className} ` : ""}${text({ disabled, italic, oneLine, prominence, sentiment, strikeThrough, underline, variant })}`,
|
|
39
|
+
"data-testid": dataTestId,
|
|
40
|
+
dir,
|
|
41
|
+
htmlFor,
|
|
42
|
+
id,
|
|
43
|
+
ref: elementRef,
|
|
44
|
+
style: {
|
|
45
|
+
...assignInlineVars({
|
|
46
|
+
[placementText]: placement,
|
|
47
|
+
[whiteSpaceText]: whiteSpace
|
|
48
|
+
}),
|
|
49
|
+
...style
|
|
50
|
+
},
|
|
51
|
+
children
|
|
52
|
+
}
|
|
53
|
+
) });
|
|
50
54
|
};
|
|
51
55
|
export {
|
|
52
56
|
Text
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* empty css */
|
|
2
1
|
/* empty css */
|
|
3
2
|
import { createRuntimeFn } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
4
3
|
var text = createRuntimeFn({ defaultClassName: "uv_m4c9ow0", variantClassNames: { strikeThrough: { true: "uv_m4c9ow1", false: "uv_m4c9ow2" }, italic: { true: "uv_m4c9ow3", false: "uv_m4c9ow4" }, underline: { true: "uv_m4c9ow5", false: "uv_m4c9ow6" }, oneLine: { true: "uv_m4c9ow7", false: "uv_m4c9ow8" }, sentiment: { primary: "uv_m4c9ow9", secondary: "uv_m4c9owa", neutral: "uv_m4c9owb", success: "uv_m4c9owc", danger: "uv_m4c9owd", warning: "uv_m4c9owe", info: "uv_m4c9owf", black: "uv_m4c9owg", white: "uv_m4c9owh" }, prominence: { "default": "uv_m4c9owi", strong: "uv_m4c9owj", stronger: "uv_m4c9owk", weak: "uv_m4c9owl" }, variant: { body: "uv_m4c9owm", bodySmall: "uv_m4c9own", bodySmallStrong: "uv_m4c9owo", bodySmallStronger: "uv_m4c9owp", bodyStrong: "uv_m4c9owq", bodyStronger: "uv_m4c9owr", caption: "uv_m4c9ows", captionSmall: "uv_m4c9owt", captionSmallStrong: "uv_m4c9owu", captionSmallStronger: "uv_m4c9owv", captionStrong: "uv_m4c9oww", captionStronger: "uv_m4c9owx", code: "uv_m4c9owy", codeStrong: "uv_m4c9owz", codeStronger: "uv_m4c9ow10", heading: "uv_m4c9ow11", headingLarge: "uv_m4c9ow12", headingLargeStrong: "uv_m4c9ow13", headingLargeStronger: "uv_m4c9ow14", headingSmall: "uv_m4c9ow15", headingSmallStrong: "uv_m4c9ow16", headingSmallStronger: "uv_m4c9ow17", headingStrong: "uv_m4c9ow18", headingStronger: "uv_m4c9ow19" }, disabled: { true: "uv_m4c9ow1a", false: "uv_m4c9ow1b" } }, defaultVariants: { strikeThrough: false, italic: false, underline: false, oneLine: false, sentiment: void 0, prominence: "default", variant: "body", disabled: false }, compoundVariants: [[{ sentiment: "primary", prominence: "default", disabled: false }, "uv_m4c9ow1c"], [{ sentiment: "primary", prominence: "strong", disabled: false }, "uv_m4c9ow1d"], [{ sentiment: "primary", prominence: "stronger", disabled: false }, "uv_m4c9ow1e"], [{ sentiment: "primary", prominence: "weak", disabled: false }, "uv_m4c9ow1f"], [{ sentiment: "secondary", prominence: "default", disabled: false }, "uv_m4c9ow1g"], [{ sentiment: "secondary", prominence: "strong", disabled: false }, "uv_m4c9ow1h"], [{ sentiment: "secondary", prominence: "stronger", disabled: false }, "uv_m4c9ow1i"], [{ sentiment: "secondary", prominence: "weak", disabled: false }, "uv_m4c9ow1j"], [{ sentiment: "danger", prominence: "default", disabled: false }, "uv_m4c9ow1k"], [{ sentiment: "danger", prominence: "strong", disabled: false }, "uv_m4c9ow1l"], [{ sentiment: "danger", prominence: "stronger", disabled: false }, "uv_m4c9ow1m"], [{ sentiment: "danger", prominence: "weak", disabled: false }, "uv_m4c9ow1n"], [{ sentiment: "info", prominence: "default", disabled: false }, "uv_m4c9ow1o"], [{ sentiment: "info", prominence: "strong", disabled: false }, "uv_m4c9ow1p"], [{ sentiment: "info", prominence: "stronger", disabled: false }, "uv_m4c9ow1q"], [{ sentiment: "info", prominence: "weak", disabled: false }, "uv_m4c9ow1r"], [{ sentiment: "success", prominence: "default", disabled: false }, "uv_m4c9ow1s"], [{ sentiment: "success", prominence: "strong", disabled: false }, "uv_m4c9ow1t"], [{ sentiment: "success", prominence: "stronger", disabled: false }, "uv_m4c9ow1u"], [{ sentiment: "success", prominence: "weak", disabled: false }, "uv_m4c9ow1v"], [{ sentiment: "warning", prominence: "default", disabled: false }, "uv_m4c9ow1w"], [{ sentiment: "warning", prominence: "strong", disabled: false }, "uv_m4c9ow1x"], [{ sentiment: "warning", prominence: "stronger", disabled: false }, "uv_m4c9ow1y"], [{ sentiment: "warning", prominence: "weak", disabled: false }, "uv_m4c9ow1z"], [{ sentiment: "neutral", prominence: "default", disabled: false }, "uv_m4c9ow20"], [{ sentiment: "neutral", prominence: "strong", disabled: false }, "uv_m4c9ow21"], [{ sentiment: "neutral", prominence: "stronger", disabled: false }, "uv_m4c9ow22"], [{ sentiment: "neutral", prominence: "weak", disabled: false }, "uv_m4c9ow23"], [{ sentiment: "black", prominence: "default", disabled: false }, "uv_m4c9ow24"], [{ sentiment: "black", prominence: "strong", disabled: false }, "uv_m4c9ow25"], [{ sentiment: "black", prominence: "stronger", disabled: false }, "uv_m4c9ow26"], [{ sentiment: "black", prominence: "weak", disabled: false }, "uv_m4c9ow27"], [{ sentiment: "white", prominence: "default", disabled: false }, "uv_m4c9ow28"], [{ sentiment: "white", prominence: "strong", disabled: false }, "uv_m4c9ow29"], [{ sentiment: "white", prominence: "stronger", disabled: false }, "uv_m4c9ow2a"], [{ sentiment: "white", prominence: "weak", disabled: false }, "uv_m4c9ow2b"], [{ sentiment: "primary", prominence: "default", disabled: true }, "uv_m4c9ow2c"], [{ sentiment: "primary", prominence: "strong", disabled: true }, "uv_m4c9ow2d"], [{ sentiment: "primary", prominence: "stronger", disabled: true }, "uv_m4c9ow2e"], [{ sentiment: "primary", prominence: "weak", disabled: true }, "uv_m4c9ow2f"], [{ sentiment: "secondary", prominence: "default", disabled: true }, "uv_m4c9ow2g"], [{ sentiment: "secondary", prominence: "strong", disabled: true }, "uv_m4c9ow2h"], [{ sentiment: "secondary", prominence: "stronger", disabled: true }, "uv_m4c9ow2i"], [{ sentiment: "secondary", prominence: "weak", disabled: true }, "uv_m4c9ow2j"], [{ sentiment: "danger", prominence: "default", disabled: true }, "uv_m4c9ow2k"], [{ sentiment: "danger", prominence: "strong", disabled: true }, "uv_m4c9ow2l"], [{ sentiment: "danger", prominence: "stronger", disabled: true }, "uv_m4c9ow2m"], [{ sentiment: "danger", prominence: "weak", disabled: true }, "uv_m4c9ow2n"], [{ sentiment: "info", prominence: "default", disabled: true }, "uv_m4c9ow2o"], [{ sentiment: "info", prominence: "strong", disabled: true }, "uv_m4c9ow2p"], [{ sentiment: "info", prominence: "stronger", disabled: true }, "uv_m4c9ow2q"], [{ sentiment: "info", prominence: "weak", disabled: true }, "uv_m4c9ow2r"], [{ sentiment: "success", prominence: "default", disabled: true }, "uv_m4c9ow2s"], [{ sentiment: "success", prominence: "strong", disabled: true }, "uv_m4c9ow2t"], [{ sentiment: "success", prominence: "stronger", disabled: true }, "uv_m4c9ow2u"], [{ sentiment: "success", prominence: "weak", disabled: true }, "uv_m4c9ow2v"], [{ sentiment: "warning", prominence: "default", disabled: true }, "uv_m4c9ow2w"], [{ sentiment: "warning", prominence: "strong", disabled: true }, "uv_m4c9ow2x"], [{ sentiment: "warning", prominence: "stronger", disabled: true }, "uv_m4c9ow2y"], [{ sentiment: "warning", prominence: "weak", disabled: true }, "uv_m4c9ow2z"], [{ sentiment: "neutral", prominence: "default", disabled: true }, "uv_m4c9ow30"], [{ sentiment: "neutral", prominence: "strong", disabled: true }, "uv_m4c9ow31"], [{ sentiment: "neutral", prominence: "stronger", disabled: true }, "uv_m4c9ow32"], [{ sentiment: "neutral", prominence: "weak", disabled: true }, "uv_m4c9ow33"], [{ sentiment: "black", prominence: "default", disabled: true }, "uv_m4c9ow34"], [{ sentiment: "black", prominence: "strong", disabled: true }, "uv_m4c9ow35"], [{ sentiment: "black", prominence: "stronger", disabled: true }, "uv_m4c9ow36"], [{ sentiment: "black", prominence: "weak", disabled: true }, "uv_m4c9ow37"], [{ sentiment: "white", prominence: "default", disabled: true }, "uv_m4c9ow38"], [{ sentiment: "white", prominence: "strong", disabled: true }, "uv_m4c9ow39"], [{ sentiment: "white", prominence: "stronger", disabled: true }, "uv_m4c9ow3a"], [{ sentiment: "white", prominence: "weak", disabled: true }, "uv_m4c9ow3b"], [{ prominence: "default", disabled: false }, "uv_m4c9ow3c"], [{ prominence: "strong", disabled: false }, "uv_m4c9ow3d"], [{ prominence: "stronger", disabled: false }, "uv_m4c9ow3e"], [{ prominence: "weak", disabled: false }, "uv_m4c9ow3f"]] });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs, jsx } from "
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { CloseIcon, CheckCircleIcon, AlertCircleIcon } from "@ultraviolet/icons";
|
|
4
4
|
import { useTheme } from "@ultraviolet/themes";
|
|
5
5
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
@@ -13,111 +13,186 @@ import { Text } from "../Text/index.js";
|
|
|
13
13
|
import { Tooltip } from "../Tooltip/index.js";
|
|
14
14
|
import { textareaWrapper, textArea, paddingRightVar, textAreaClearableContainer } from "./styles.css.js";
|
|
15
15
|
const STATE_ICON_SIZE = "small";
|
|
16
|
-
const TextArea = forwardRef(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
textArea2
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
textArea2.style.
|
|
16
|
+
const TextArea = forwardRef(
|
|
17
|
+
({
|
|
18
|
+
id,
|
|
19
|
+
className,
|
|
20
|
+
tabIndex,
|
|
21
|
+
value,
|
|
22
|
+
onChange,
|
|
23
|
+
placeholder,
|
|
24
|
+
rows = 3,
|
|
25
|
+
maxRows,
|
|
26
|
+
disabled = false,
|
|
27
|
+
readOnly = false,
|
|
28
|
+
success,
|
|
29
|
+
error,
|
|
30
|
+
helper,
|
|
31
|
+
minLength,
|
|
32
|
+
maxLength,
|
|
33
|
+
tooltip,
|
|
34
|
+
label,
|
|
35
|
+
autoFocus,
|
|
36
|
+
required = false,
|
|
37
|
+
"data-testid": dataTestId,
|
|
38
|
+
name,
|
|
39
|
+
onFocus,
|
|
40
|
+
onBlur,
|
|
41
|
+
onKeyDown,
|
|
42
|
+
clearable = false,
|
|
43
|
+
labelDescription,
|
|
44
|
+
"aria-label": ariaLabel,
|
|
45
|
+
style
|
|
46
|
+
}, ref) => {
|
|
47
|
+
const localId = useId();
|
|
48
|
+
const theme = useTheme();
|
|
49
|
+
const textAreaRef = useRef(null);
|
|
50
|
+
useImperativeHandle(ref, () => textAreaRef.current);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const textArea2 = textAreaRef.current;
|
|
53
|
+
const padding = theme.space["1.5"];
|
|
54
|
+
if (!textArea2) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const updateHeight = () => {
|
|
58
|
+
if (textArea2 && rows === "auto" && !maxRows) {
|
|
59
|
+
textArea2.style.height = "auto";
|
|
60
|
+
textArea2.style.resize = "none";
|
|
61
|
+
textArea2.style.height = `${textArea2.scrollHeight + 2}px`;
|
|
62
|
+
} else if (textArea2 && maxRows) {
|
|
63
|
+
const lineHeight = Number.parseFloat(
|
|
64
|
+
getComputedStyle(textArea2).lineHeight
|
|
65
|
+
);
|
|
66
|
+
textArea2.style.height = "auto";
|
|
67
|
+
const maxHeight = maxRows * lineHeight;
|
|
68
|
+
textArea2.style.height = `${textArea2.scrollHeight + 2}px`;
|
|
69
|
+
textArea2.style.maxHeight = `calc(${maxHeight}px + 2*${padding})`;
|
|
70
|
+
if (typeof rows === "number") {
|
|
71
|
+
const minHeight = rows * lineHeight;
|
|
72
|
+
textArea2.style.minHeight = `calc(${minHeight}px + 2*${padding})`;
|
|
73
|
+
}
|
|
70
74
|
}
|
|
75
|
+
};
|
|
76
|
+
requestAnimationFrame(updateHeight);
|
|
77
|
+
}, [value, rows, theme, maxRows, textAreaRef.current?.value]);
|
|
78
|
+
const sentiment = useMemo(() => {
|
|
79
|
+
if (error) {
|
|
80
|
+
return "danger";
|
|
81
|
+
}
|
|
82
|
+
if (success) {
|
|
83
|
+
return "success";
|
|
71
84
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
85
|
+
return "neutral";
|
|
86
|
+
}, [error, success]);
|
|
87
|
+
const notice = success || error || helper;
|
|
88
|
+
const computedClearable = clearable && !!value;
|
|
89
|
+
return /* @__PURE__ */ jsxs(Stack, { className, gap: "0.5", children: [
|
|
90
|
+
label || labelDescription ? /* @__PURE__ */ jsx(
|
|
91
|
+
Label,
|
|
92
|
+
{
|
|
93
|
+
htmlFor: id ?? localId,
|
|
94
|
+
labelDescription,
|
|
95
|
+
required,
|
|
96
|
+
children: label
|
|
97
|
+
}
|
|
98
|
+
) : null,
|
|
99
|
+
/* @__PURE__ */ jsx(Tooltip, { text: tooltip, children: /* @__PURE__ */ jsxs("div", { className: textareaWrapper, children: [
|
|
100
|
+
/* @__PURE__ */ jsx(
|
|
101
|
+
"textarea",
|
|
102
|
+
{
|
|
103
|
+
"aria-invalid": !!error,
|
|
104
|
+
"aria-label": ariaLabel,
|
|
105
|
+
autoFocus,
|
|
106
|
+
className: textArea({
|
|
107
|
+
error: !!error,
|
|
108
|
+
success: !!success
|
|
109
|
+
}),
|
|
110
|
+
"data-testid": dataTestId,
|
|
111
|
+
disabled,
|
|
112
|
+
id: id ?? localId,
|
|
113
|
+
maxLength,
|
|
114
|
+
minLength,
|
|
115
|
+
name,
|
|
116
|
+
onBlur,
|
|
117
|
+
onChange: (event) => {
|
|
118
|
+
onChange(event.currentTarget.value);
|
|
119
|
+
},
|
|
120
|
+
onFocus,
|
|
121
|
+
onKeyDown,
|
|
122
|
+
placeholder,
|
|
123
|
+
readOnly: !!readOnly,
|
|
124
|
+
ref: textAreaRef,
|
|
125
|
+
rows: rows !== "auto" ? rows : 1,
|
|
126
|
+
style: {
|
|
127
|
+
...assignInlineVars({
|
|
128
|
+
[paddingRightVar]: `calc(${theme.space[computedClearable && (!!success || !!error) ? "4" : "3"]} + ${computedClearable ? `${SIZE_HEIGHT.xsmall}px` : "0px"} + ${!!success || !!error ? `${STATE_ICON_SIZE}px` : "0px"})`
|
|
129
|
+
}),
|
|
130
|
+
...style
|
|
131
|
+
},
|
|
132
|
+
tabIndex,
|
|
133
|
+
value
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
/* @__PURE__ */ jsxs(
|
|
137
|
+
Stack,
|
|
138
|
+
{
|
|
139
|
+
alignItems: "center",
|
|
140
|
+
className: textAreaClearableContainer,
|
|
141
|
+
direction: "row",
|
|
142
|
+
gap: "1",
|
|
143
|
+
children: [
|
|
144
|
+
computedClearable ? /* @__PURE__ */ jsx(
|
|
145
|
+
Button,
|
|
146
|
+
{
|
|
147
|
+
"aria-label": "clear value",
|
|
148
|
+
onClick: () => {
|
|
149
|
+
onChange("");
|
|
150
|
+
},
|
|
151
|
+
sentiment: "neutral",
|
|
152
|
+
size: "xsmall",
|
|
153
|
+
variant: "ghost",
|
|
154
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
155
|
+
}
|
|
156
|
+
) : null,
|
|
157
|
+
success && !error ? /* @__PURE__ */ jsx(CheckCircleIcon, { sentiment: "success", size: STATE_ICON_SIZE }) : null,
|
|
158
|
+
error ? /* @__PURE__ */ jsx(AlertCircleIcon, { sentiment: "danger" }) : null
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
] }) }),
|
|
163
|
+
notice || maxLength ? /* @__PURE__ */ jsxs(Row, { gap: "1", templateColumns: "minmax(0, 1fr) min-content", children: [
|
|
164
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
165
|
+
error || success || typeof helper === "string" ? /* @__PURE__ */ jsx(
|
|
166
|
+
Text,
|
|
167
|
+
{
|
|
168
|
+
as: "p",
|
|
169
|
+
disabled,
|
|
170
|
+
prominence: !error && !success ? "weak" : "default",
|
|
171
|
+
sentiment,
|
|
172
|
+
variant: "caption",
|
|
173
|
+
children: error || success || helper
|
|
174
|
+
}
|
|
175
|
+
) : null,
|
|
176
|
+
!error && !success && typeof helper !== "string" && helper ? helper : null
|
|
177
|
+
] }),
|
|
178
|
+
maxLength ? /* @__PURE__ */ jsxs(
|
|
179
|
+
Text,
|
|
180
|
+
{
|
|
181
|
+
as: "div",
|
|
182
|
+
prominence: "weak",
|
|
183
|
+
sentiment: "neutral",
|
|
184
|
+
variant: "caption",
|
|
185
|
+
children: [
|
|
186
|
+
value?.length ?? 0,
|
|
187
|
+
"/",
|
|
188
|
+
maxLength
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
) : null
|
|
117
192
|
] }) : null
|
|
118
|
-
] })
|
|
119
|
-
|
|
120
|
-
|
|
193
|
+
] });
|
|
194
|
+
}
|
|
195
|
+
);
|
|
121
196
|
export {
|
|
122
197
|
TextArea
|
|
123
198
|
};
|
|
@@ -26,4 +26,4 @@ export declare const TextInput: import("react").ForwardRefExoticComponent<{
|
|
|
26
26
|
value?: string;
|
|
27
27
|
defaultValue?: string;
|
|
28
28
|
onChangeValue?: (value: string) => void;
|
|
29
|
-
} & Pick<InputHTMLAttributes<HTMLInputElement>, "style" | "disabled" | "id" | "
|
|
29
|
+
} & Pick<InputHTMLAttributes<HTMLInputElement>, "style" | "disabled" | "id" | "autoComplete" | "role" | "autoFocus" | "tabIndex" | "aria-atomic" | "aria-label" | "aria-labelledby" | "aria-live" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "onKeyUp" | "name" | "placeholder" | "readOnly" | "required"> & import("react").RefAttributes<HTMLInputElement>>;
|