@carbon/react 1.99.0-rc.0 → 1.100.0-rc.0
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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +942 -942
- package/es/components/BadgeIndicator/index.d.ts +1 -1
- package/es/components/BadgeIndicator/index.js +8 -6
- package/es/components/Breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/es/components/Breadcrumb/BreadcrumbItem.js +6 -7
- package/es/components/Button/Button.Skeleton.d.ts +28 -2
- package/es/components/Button/Button.js +3 -2
- package/es/components/ChatButton/ChatButton.d.ts +3 -2
- package/es/components/CheckboxGroup/CheckboxGroup.d.ts +60 -2
- package/es/components/ComboBox/ComboBox.d.ts +4 -4
- package/es/components/ComboBox/ComboBox.js +21 -3
- package/es/components/ComposedModal/ComposedModal.d.ts +2 -2
- package/es/components/ContainedList/ContainedList.d.ts +35 -6
- package/es/components/ContainedList/ContainedList.js +3 -1
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +32 -3
- package/es/components/ContainedList/index.d.ts +1 -1
- package/es/components/ContainedList/index.js +4 -1
- package/es/components/DangerButton/DangerButton.d.ts +1 -1
- package/es/components/DataTable/DataTable.d.ts +22 -5
- package/es/components/DataTable/DataTable.js +1 -1
- package/es/components/DataTable/TableExpandRow.d.ts +1 -1
- package/es/components/DataTable/TableExpandRow.js +2 -2
- package/es/components/DataTable/TableHeader.d.ts +1 -1
- package/es/components/DataTable/TableHeader.js +18 -16
- package/es/components/DataTable/TableToolbar.d.ts +25 -1
- package/es/components/DataTable/TableToolbarMenu.d.ts +25 -5
- package/es/components/DataTable/TableToolbarMenu.js +0 -3
- package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +51 -2
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +6 -0
- package/es/components/DatePicker/DatePicker.d.ts +2 -2
- package/es/components/DatePicker/DatePicker.js +38 -53
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +28 -2
- package/es/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/es/components/DatePickerInput/DatePickerInput.js +3 -2
- package/es/components/Dialog/Dialog.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.Skeleton.d.ts +19 -2
- package/es/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
- package/es/components/ExpandableSearch/ExpandableSearch.js +14 -12
- package/es/components/FileUploader/FileUploader.d.ts +1 -1
- package/es/components/FileUploader/FileUploader.js +2 -2
- package/es/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +28 -10
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.d.ts +11 -3
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.d.ts +15 -3
- package/es/components/FluidDatePicker/FluidDatePicker.d.ts +2 -2
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +11 -3
- package/es/components/FluidForm/FluidForm.d.ts +15 -2
- package/es/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +2 -2
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.d.ts +11 -3
- package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.d.ts +11 -3
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +1 -1
- package/es/components/FluidSearch/FluidSearch.Skeleton.d.ts +11 -3
- package/es/components/FluidSearch/FluidSearch.d.ts +1 -1
- package/es/components/FluidSearch/FluidSearch.js +3 -3
- package/es/components/FluidSelect/FluidSelect.Skeleton.d.ts +11 -3
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +11 -3
- package/es/components/FluidTextArea/FluidTextArea.d.ts +95 -1
- package/es/components/FluidTextInput/FluidPasswordInput.d.ts +83 -2
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.d.ts +11 -3
- package/es/components/Grid/GridContext.d.ts +19 -1
- package/es/components/IconButton/index.d.ts +1 -1
- package/es/components/IconButton/index.js +2 -2
- package/es/components/Link/Link.js +3 -0
- package/es/components/ListBox/ListBoxField.d.ts +35 -2
- package/es/components/ListBox/ListBoxMenuIcon.d.ts +16 -3
- package/es/components/ListBox/ListBoxMenuItem.d.ts +1 -1
- package/es/components/ListBox/ListBoxSelection.d.ts +34 -3
- package/es/components/Menu/MenuItem.d.ts +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +22 -13
- package/es/components/MultiSelect/MultiSelect.js +22 -13
- package/es/components/Notification/Notification.d.ts +8 -7
- package/es/components/Notification/Notification.js +0 -1
- package/es/components/NumberInput/NumberInput.d.ts +9 -0
- package/es/components/NumberInput/NumberInput.js +206 -38
- package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +0 -1
- package/es/components/OverflowMenu/index.d.ts +1 -1
- package/es/components/PageHeader/PageHeader.d.ts +3 -3
- package/es/components/Popover/index.js +21 -12
- package/es/components/Search/Search.d.ts +2 -2
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/Select/Select.js +2 -2
- package/es/components/SkeletonIcon/SkeletonIcon.d.ts +16 -2
- package/es/components/SkeletonText/SkeletonText.d.ts +1 -1
- package/es/components/Tag/Tag.d.ts +1 -1
- package/es/components/Tag/Tag.js +2 -0
- package/es/components/Text/Text.d.ts +1 -1
- package/es/components/Text/Text.js +4 -3
- package/es/components/Text/TextDirection.d.ts +1 -1
- package/es/components/Text/TextDirection.js +1 -3
- package/es/components/Text/TextDirectionContext.d.ts +3 -3
- package/es/components/TextInput/ControlledPasswordInput.d.ts +1 -1
- package/es/components/TextInput/ControlledPasswordInput.js +2 -2
- package/es/components/TextInput/PasswordInput.d.ts +1 -1
- package/es/components/TextInput/PasswordInput.js +2 -2
- package/es/components/TextInput/TextInput.d.ts +1 -1
- package/es/components/TextInput/TextInput.js +2 -2
- package/es/components/Toggle/Toggle.Skeleton.d.ts +9 -3
- package/es/components/Toggletip/index.d.ts +1 -1
- package/es/components/Toggletip/index.js +9 -7
- package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -1
- package/es/components/Tooltip/Tooltip.js +2 -0
- package/es/components/TreeView/TreeNode.d.ts +4 -4
- package/es/components/UIShell/Header.d.ts +20 -3
- package/es/components/UIShell/HeaderGlobalAction.d.ts +2 -2
- package/es/components/UIShell/HeaderName.js +1 -1
- package/es/components/UIShell/Link.d.ts +1 -1
- package/es/components/UIShell/Link.js +14 -14
- package/es/components/UIShell/SideNav.d.ts +3 -3
- package/es/components/UIShell/SideNav.js +26 -25
- package/es/components/UIShell/SideNavDivider.d.ts +11 -3
- package/es/components/UIShell/SideNavHeader.d.ts +24 -1
- package/es/components/UIShell/SideNavIcon.d.ts +20 -2
- package/es/components/UIShell/SideNavItem.d.ts +20 -2
- package/es/components/UIShell/SideNavItems.d.ts +22 -2
- package/es/components/UIShell/SideNavLink.d.ts +1 -1
- package/es/components/UIShell/SideNavLink.js +14 -14
- package/es/components/UIShell/SideNavMenu.d.ts +1 -1
- package/es/components/UIShell/SideNavMenu.js +2 -2
- package/es/components/UIShell/SideNavMenuItem.d.ts +2 -2
- package/es/components/UIShell/SideNavMenuItem.js +2 -2
- package/es/components/UIShell/SwitcherDivider.d.ts +10 -2
- package/es/internal/FloatingMenu.d.ts +1 -1
- package/es/internal/FloatingMenu.js +0 -2
- package/es/internal/PolymorphicProps.d.ts +3 -3
- package/es/internal/useNoInteractiveChildren.d.ts +1 -1
- package/es/internal/useNoInteractiveChildren.js +8 -10
- package/es/internal/useOutsideClick.d.ts +1 -1
- package/es/internal/useOutsideClick.js +0 -4
- package/lib/components/BadgeIndicator/index.d.ts +1 -1
- package/lib/components/BadgeIndicator/index.js +7 -5
- package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/lib/components/Breadcrumb/BreadcrumbItem.js +5 -6
- package/lib/components/Button/Button.Skeleton.d.ts +28 -2
- package/lib/components/Button/Button.js +3 -2
- package/lib/components/ChatButton/ChatButton.d.ts +3 -2
- package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +60 -2
- package/lib/components/ComboBox/ComboBox.d.ts +4 -4
- package/lib/components/ComboBox/ComboBox.js +21 -3
- package/lib/components/ComposedModal/ComposedModal.d.ts +2 -2
- package/lib/components/ContainedList/ContainedList.d.ts +35 -6
- package/lib/components/ContainedList/ContainedList.js +3 -1
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +32 -3
- package/lib/components/ContainedList/index.d.ts +1 -1
- package/lib/components/ContainedList/index.js +4 -1
- package/lib/components/DangerButton/DangerButton.d.ts +1 -1
- package/lib/components/DataTable/DataTable.d.ts +22 -5
- package/lib/components/DataTable/DataTable.js +1 -1
- package/lib/components/DataTable/TableExpandRow.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.js +17 -15
- package/lib/components/DataTable/TableToolbar.d.ts +25 -1
- package/lib/components/DataTable/TableToolbarMenu.d.ts +25 -5
- package/lib/components/DataTable/TableToolbarMenu.js +0 -3
- package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +51 -2
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +6 -0
- package/lib/components/DatePicker/DatePicker.d.ts +2 -2
- package/lib/components/DatePicker/DatePicker.js +37 -52
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +28 -2
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/lib/components/DatePickerInput/DatePickerInput.js +2 -1
- package/lib/components/Dialog/Dialog.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +19 -2
- package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
- package/lib/components/ExpandableSearch/ExpandableSearch.js +13 -11
- package/lib/components/FileUploader/FileUploader.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +28 -10
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.d.ts +11 -3
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.d.ts +15 -3
- package/lib/components/FluidDatePicker/FluidDatePicker.d.ts +2 -2
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +11 -3
- package/lib/components/FluidForm/FluidForm.d.ts +15 -2
- package/lib/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +2 -2
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.d.ts +11 -3
- package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.d.ts +11 -3
- package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +1 -1
- package/lib/components/FluidSearch/FluidSearch.Skeleton.d.ts +11 -3
- package/lib/components/FluidSearch/FluidSearch.d.ts +1 -1
- package/lib/components/FluidSearch/FluidSearch.js +2 -2
- package/lib/components/FluidSelect/FluidSelect.Skeleton.d.ts +11 -3
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +11 -3
- package/lib/components/FluidTextArea/FluidTextArea.d.ts +95 -1
- package/lib/components/FluidTextInput/FluidPasswordInput.d.ts +83 -2
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.d.ts +11 -3
- package/lib/components/Grid/GridContext.d.ts +19 -1
- package/lib/components/IconButton/index.d.ts +1 -1
- package/lib/components/Link/Link.js +3 -0
- package/lib/components/ListBox/ListBoxField.d.ts +35 -2
- package/lib/components/ListBox/ListBoxMenuIcon.d.ts +16 -3
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +1 -1
- package/lib/components/ListBox/ListBoxSelection.d.ts +34 -3
- package/lib/components/Menu/MenuItem.d.ts +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +22 -13
- package/lib/components/MultiSelect/MultiSelect.js +22 -13
- package/lib/components/Notification/Notification.d.ts +8 -7
- package/lib/components/Notification/Notification.js +0 -1
- package/lib/components/NumberInput/NumberInput.d.ts +9 -0
- package/lib/components/NumberInput/NumberInput.js +206 -37
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +0 -1
- package/lib/components/OverflowMenu/index.d.ts +1 -1
- package/lib/components/PageHeader/PageHeader.d.ts +3 -3
- package/lib/components/Popover/index.js +19 -10
- package/lib/components/Search/Search.d.ts +2 -2
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/SkeletonIcon/SkeletonIcon.d.ts +16 -2
- package/lib/components/SkeletonText/SkeletonText.d.ts +1 -1
- package/lib/components/Tag/Tag.d.ts +1 -1
- package/lib/components/Tag/Tag.js +2 -0
- package/lib/components/Text/Text.d.ts +1 -1
- package/lib/components/Text/Text.js +3 -2
- package/lib/components/Text/TextDirection.d.ts +1 -1
- package/lib/components/Text/TextDirection.js +1 -3
- package/lib/components/Text/TextDirectionContext.d.ts +3 -3
- package/lib/components/TextInput/ControlledPasswordInput.d.ts +1 -1
- package/lib/components/TextInput/PasswordInput.d.ts +1 -1
- package/lib/components/TextInput/TextInput.d.ts +1 -1
- package/lib/components/Toggle/Toggle.Skeleton.d.ts +9 -3
- package/lib/components/Toggletip/index.d.ts +1 -1
- package/lib/components/Toggletip/index.js +7 -5
- package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -1
- package/lib/components/Tooltip/Tooltip.js +2 -0
- package/lib/components/TreeView/TreeNode.d.ts +4 -4
- package/lib/components/UIShell/Header.d.ts +20 -3
- package/lib/components/UIShell/HeaderGlobalAction.d.ts +2 -2
- package/lib/components/UIShell/HeaderName.js +1 -1
- package/lib/components/UIShell/Link.d.ts +1 -1
- package/lib/components/UIShell/Link.js +13 -13
- package/lib/components/UIShell/SideNav.d.ts +3 -3
- package/lib/components/UIShell/SideNav.js +25 -24
- package/lib/components/UIShell/SideNavDivider.d.ts +11 -3
- package/lib/components/UIShell/SideNavHeader.d.ts +24 -1
- package/lib/components/UIShell/SideNavIcon.d.ts +20 -2
- package/lib/components/UIShell/SideNavItem.d.ts +20 -2
- package/lib/components/UIShell/SideNavItems.d.ts +22 -2
- package/lib/components/UIShell/SideNavLink.d.ts +1 -1
- package/lib/components/UIShell/SideNavLink.js +14 -14
- package/lib/components/UIShell/SideNavMenu.d.ts +1 -1
- package/lib/components/UIShell/SideNavMenuItem.d.ts +2 -2
- package/lib/components/UIShell/SwitcherDivider.d.ts +10 -2
- package/lib/internal/FloatingMenu.d.ts +1 -1
- package/lib/internal/FloatingMenu.js +0 -2
- package/lib/internal/PolymorphicProps.d.ts +3 -3
- package/lib/internal/useNoInteractiveChildren.d.ts +1 -1
- package/lib/internal/useNoInteractiveChildren.js +8 -10
- package/lib/internal/useOutsideClick.d.ts +1 -1
- package/lib/internal/useOutsideClick.js +0 -4
- package/package.json +8 -8
- package/scss/_carbon-utilities.scss +9 -0
- package/telemetry.yml +0 -1
- package/es/internal/createClassWrapper.d.ts +0 -12
- package/lib/internal/createClassWrapper.d.ts +0 -12
|
@@ -43,8 +43,41 @@ const getSeparators = locale => {
|
|
|
43
43
|
const numberWithGroupAndDecimal = 1234567.89;
|
|
44
44
|
const formatted = new Intl.NumberFormat(locale).format(numberWithGroupAndDecimal);
|
|
45
45
|
|
|
46
|
-
//
|
|
47
|
-
|
|
46
|
+
// Comprehensive Unicode digit pattern that includes all common numeral systems
|
|
47
|
+
// supported by Intl.NumberFormat across different locales
|
|
48
|
+
const digitPattern = '[' + '\\u0030-\\u0039' +
|
|
49
|
+
// Western
|
|
50
|
+
'\\u0660-\\u0669' +
|
|
51
|
+
// Eastern Arabic
|
|
52
|
+
'\\u0966-\\u096F' +
|
|
53
|
+
// Devanagari
|
|
54
|
+
'\\u09E6-\\u09EF' +
|
|
55
|
+
// Bengali
|
|
56
|
+
'\\uFF10-\\uFF19' +
|
|
57
|
+
// Fullwidth Japanese 0-9
|
|
58
|
+
'一二三四五六七八九〇零' +
|
|
59
|
+
// Kanji digits
|
|
60
|
+
']';
|
|
61
|
+
|
|
62
|
+
// Non-digit pattern that excludes ALL digit types (not just ASCII 0-9)
|
|
63
|
+
const nonDigitPattern = '[^' + '\\u0030-\\u0039' +
|
|
64
|
+
// Western
|
|
65
|
+
'\\u0660-\\u0669' +
|
|
66
|
+
// Eastern Arabic
|
|
67
|
+
'\\u0966-\\u096F' +
|
|
68
|
+
// Devanagari
|
|
69
|
+
'\\u09E6-\\u09EF' +
|
|
70
|
+
// Bengali
|
|
71
|
+
'\\uFF10-\\uFF19' +
|
|
72
|
+
// Fullwidth Japanese 0-9
|
|
73
|
+
'一二三四五六七八九〇零' +
|
|
74
|
+
// Kanji digits
|
|
75
|
+
']+';
|
|
76
|
+
|
|
77
|
+
// Extract separators using regex that handles all numeral systems
|
|
78
|
+
// Use nonDigitPattern instead of \D+ to correctly identify separators
|
|
79
|
+
const regex = new RegExp(`(${nonDigitPattern})${digitPattern}{3}(${nonDigitPattern})${digitPattern}{2}$`);
|
|
80
|
+
const match = formatted.match(regex);
|
|
48
81
|
if (match) {
|
|
49
82
|
const groupSeparator = match[1];
|
|
50
83
|
const decimalSeparator = match[2];
|
|
@@ -59,11 +92,116 @@ const getSeparators = locale => {
|
|
|
59
92
|
};
|
|
60
93
|
}
|
|
61
94
|
};
|
|
95
|
+
|
|
96
|
+
// Normalizes all Unicode minus variants to ASCII hyphen-minus (-)
|
|
97
|
+
const normalizeMinus = value => value.replace(/[\u2212\u2012\u2013\u2014\uFE63\uFF0D]/g, '-');
|
|
98
|
+
const normalizeNumericInput = value => value
|
|
99
|
+
// Remove bidi / direction control characters (Arabic keyboards)
|
|
100
|
+
.replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g, '')
|
|
101
|
+
// Normalize Unicode minus variants to ASCII "-"
|
|
102
|
+
.replace(/[\u2212\u2012\u2013\u2014\uFE63\uFF0D]/g, '-');
|
|
103
|
+
/**
|
|
104
|
+
* Converts a string with any Unicode numeral system to a JavaScript number.
|
|
105
|
+
* Handles all numeral systems supported by Intl.NumberFormat.
|
|
106
|
+
*
|
|
107
|
+
* @param {string} input - The input string with numerals in any Unicode system
|
|
108
|
+
* @param {string} locale - The locale for parsing separators
|
|
109
|
+
* @returns {number} The parsed number, or NaN if invalid
|
|
110
|
+
*/
|
|
111
|
+
const parseNumberWithLocale = (input, locale) => {
|
|
112
|
+
// Handle empty, null, or undefined inputs
|
|
113
|
+
if (input === '' || input === undefined || input === null) {
|
|
114
|
+
return NaN;
|
|
115
|
+
}
|
|
116
|
+
input = normalizeNumericInput(input);
|
|
117
|
+
const {
|
|
118
|
+
groupSeparator,
|
|
119
|
+
decimalSeparator
|
|
120
|
+
} = getSeparators(locale);
|
|
121
|
+
|
|
122
|
+
// Kanji digit map
|
|
123
|
+
const kanjiMap = {
|
|
124
|
+
零: '0',
|
|
125
|
+
〇: '0',
|
|
126
|
+
一: '1',
|
|
127
|
+
二: '2',
|
|
128
|
+
三: '3',
|
|
129
|
+
四: '4',
|
|
130
|
+
五: '5',
|
|
131
|
+
六: '6',
|
|
132
|
+
七: '7',
|
|
133
|
+
八: '8',
|
|
134
|
+
九: '9'
|
|
135
|
+
};
|
|
136
|
+
const digitRanges = [{
|
|
137
|
+
start: 0x0030,
|
|
138
|
+
end: 0x0039,
|
|
139
|
+
base: 0x0030
|
|
140
|
+
}, {
|
|
141
|
+
start: 0x0660,
|
|
142
|
+
end: 0x0669,
|
|
143
|
+
base: 0x0660
|
|
144
|
+
}, {
|
|
145
|
+
start: 0x0966,
|
|
146
|
+
end: 0x096f,
|
|
147
|
+
base: 0x0966
|
|
148
|
+
}, {
|
|
149
|
+
start: 0x09e6,
|
|
150
|
+
end: 0x09ef,
|
|
151
|
+
base: 0x09e6
|
|
152
|
+
}, {
|
|
153
|
+
start: 0xff10,
|
|
154
|
+
end: 0xff19,
|
|
155
|
+
base: 0xff10
|
|
156
|
+
}];
|
|
157
|
+
let normalized = Array.from(input).map(char => {
|
|
158
|
+
// Preserve scientific notation characters
|
|
159
|
+
if (char === 'e' || char === 'E' || char === '+' || char === '-') {
|
|
160
|
+
return char;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Check Kanji first
|
|
164
|
+
if (kanjiMap[char] !== undefined) {
|
|
165
|
+
return kanjiMap[char];
|
|
166
|
+
}
|
|
167
|
+
const code = char.charCodeAt(0);
|
|
168
|
+
for (const range of digitRanges) {
|
|
169
|
+
if (code >= range.start && code <= range.end) {
|
|
170
|
+
return String(code - range.start);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return char;
|
|
174
|
+
}).join('');
|
|
175
|
+
|
|
176
|
+
// Remove grouping separators
|
|
177
|
+
if (groupSeparator) {
|
|
178
|
+
if (groupSeparator?.trim() === '') {
|
|
179
|
+
normalized = normalized?.replace(/[\u00A0\u202F\s]/g, '');
|
|
180
|
+
} else {
|
|
181
|
+
if (decimalSeparator !== ',' && decimalSeparator !== '٬') {
|
|
182
|
+
normalized = normalized?.replace(/[,٬]/g, '');
|
|
183
|
+
}
|
|
184
|
+
if (groupSeparator !== ',' && groupSeparator !== '٬') {
|
|
185
|
+
const escaped = groupSeparator?.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
186
|
+
normalized = normalized?.replace(new RegExp(escaped, 'g'), '');
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
normalized = normalized.replace(/٫/g, '.');
|
|
191
|
+
if (decimalSeparator && decimalSeparator !== '.' && decimalSeparator !== '٫') {
|
|
192
|
+
const escaped = decimalSeparator.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
193
|
+
normalized = normalized.replace(new RegExp(escaped, 'g'), '.');
|
|
194
|
+
}
|
|
195
|
+
normalized = normalizeMinus(normalized);
|
|
196
|
+
return Number(normalized);
|
|
197
|
+
};
|
|
62
198
|
const validateNumberSeparators = (input, locale) => {
|
|
63
|
-
|
|
64
|
-
if (input === '' || Number.isNaN(input)) {
|
|
199
|
+
if (input === '') {
|
|
65
200
|
return true;
|
|
66
201
|
}
|
|
202
|
+
|
|
203
|
+
// Normalize bidi marks + minus signs FIRST
|
|
204
|
+
input = normalizeNumericInput(input);
|
|
67
205
|
const {
|
|
68
206
|
groupSeparator,
|
|
69
207
|
decimalSeparator
|
|
@@ -72,35 +210,54 @@ const validateNumberSeparators = (input, locale) => {
|
|
|
72
210
|
return !isNaN(Number(input));
|
|
73
211
|
}
|
|
74
212
|
const esc = s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
213
|
+
const digit = '[' + '\\u0030-\\u0039' + '\\u0660-\\u0669' + '\\u0966-\\u096F' + '\\u09E6-\\u09EF' + '\\uFF10-\\uFF19' + '一二三四五六七八九〇零' + ']';
|
|
214
|
+
|
|
215
|
+
// Group separator regex
|
|
75
216
|
let group = '';
|
|
76
217
|
if (groupSeparator) {
|
|
77
|
-
if (groupSeparator
|
|
78
|
-
group = '[\\u00A0\\u202F\\s]';
|
|
218
|
+
if (groupSeparator?.trim() === '') {
|
|
219
|
+
group = '[\\u00A0\\u202F\\s]';
|
|
220
|
+
} else if (groupSeparator === ',' || groupSeparator === '٬') {
|
|
221
|
+
group = '[,٬]';
|
|
79
222
|
} else {
|
|
80
223
|
group = esc(groupSeparator);
|
|
81
224
|
}
|
|
82
225
|
}
|
|
83
|
-
const decimal = esc(decimalSeparator);
|
|
84
226
|
|
|
85
|
-
//
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (!regex.test(input)) {
|
|
90
|
-
return false;
|
|
227
|
+
// Decimal separator regex
|
|
228
|
+
let decimal = esc(decimalSeparator);
|
|
229
|
+
if (decimalSeparator === '.' || decimalSeparator === '٫') {
|
|
230
|
+
decimal = '[.٫]';
|
|
91
231
|
}
|
|
232
|
+
const sign = '[\\-\\u2212]?';
|
|
233
|
+
const scientific = `([eE][+-]?${digit}+)?`;
|
|
92
234
|
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
235
|
+
// Detect if grouping is used AT ALL
|
|
236
|
+
const usesGrouping = group && (groupSeparator?.trim() === '' ? /[\u00A0\u202F\s]/.test(input) : groupSeparator === ',' || groupSeparator === '٬' ? /[,٬]/.test(input) : groupSeparator ? input.includes(groupSeparator) : false);
|
|
237
|
+
const scientificMatch = input?.match(/^([^eE]+)([eE][+-]?.*)?$/);
|
|
238
|
+
const baseNumber = scientificMatch ? scientificMatch[1] : input;
|
|
239
|
+
|
|
240
|
+
// Split integer part from the base number - handle both decimal separator variants
|
|
241
|
+
let integerPart;
|
|
242
|
+
if (decimalSeparator === '.' || decimalSeparator === '٫') {
|
|
243
|
+
// Split by either . or ٫
|
|
244
|
+
integerPart = baseNumber?.split(/[.,]/)[0];
|
|
245
|
+
} else {
|
|
246
|
+
integerPart = baseNumber?.split(decimalSeparator)[0];
|
|
101
247
|
}
|
|
102
|
-
|
|
103
|
-
|
|
248
|
+
|
|
249
|
+
// STEP 1: strict integer validation
|
|
250
|
+
// When grouping is used, we need to handle two cases:
|
|
251
|
+
// 1. Numbers with 1-3 digits (no separator required): 1, 12, 123
|
|
252
|
+
// 2. Numbers with 4+ digits (separator required): 1,234 or 12,345 or 123,456
|
|
253
|
+
const integerRegex = usesGrouping ? new RegExp(`^${sign}(${digit}{1,3}|${digit}{1,3}(${group}${digit}{3})+)$`) : new RegExp(`^${sign}${digit}+$`);
|
|
254
|
+
if (!integerRegex.test(integerPart)) {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// STEP 2: full number validation
|
|
259
|
+
const fullRegex = new RegExp(`^${sign}${digit}+` + (usesGrouping ? `(${group}${digit}{3})*` : '') + `(${decimal}${digit}+)?${scientific}$`);
|
|
260
|
+
return fullRegex.test(input);
|
|
104
261
|
};
|
|
105
262
|
|
|
106
263
|
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
@@ -292,8 +449,9 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
|
292
449
|
}
|
|
293
450
|
};
|
|
294
451
|
const outerElementClasses = cx(`${prefix}--form-item`, {
|
|
295
|
-
|
|
296
|
-
|
|
452
|
+
...(customClassName ? {
|
|
453
|
+
[customClassName]: true
|
|
454
|
+
} : {}),
|
|
297
455
|
[`${prefix}--number-input--fluid--invalid`]: isFluid && normalizedProps.invalid,
|
|
298
456
|
[`${prefix}--number-input--fluid--focus`]: isFluid && isFocused,
|
|
299
457
|
[`${prefix}--number-input--fluid--disabled`]: isFluid && disabled
|
|
@@ -764,23 +922,33 @@ function getInputValidity({
|
|
|
764
922
|
validate,
|
|
765
923
|
locale
|
|
766
924
|
}) {
|
|
767
|
-
if (typeof validate === 'function') {
|
|
768
|
-
const result = validate(value, locale);
|
|
769
|
-
if (result === false) {
|
|
770
|
-
return false; // immediate invalid
|
|
771
|
-
}
|
|
772
|
-
// If true or undefined, continue to further validations
|
|
773
|
-
}
|
|
774
925
|
if (invalid) {
|
|
775
926
|
return false;
|
|
776
927
|
}
|
|
777
|
-
|
|
778
|
-
|
|
928
|
+
|
|
929
|
+
// Skip validation if value is empty and allowEmpty
|
|
930
|
+
if (value === '') return allowEmpty;
|
|
931
|
+
|
|
932
|
+
// Normalize the value
|
|
933
|
+
let numericValue;
|
|
934
|
+
if (typeof value === 'string') {
|
|
935
|
+
numericValue = parseNumberWithLocale(value, locale); // safe: handles Arabic, Kanji, etc.
|
|
936
|
+
} else {
|
|
937
|
+
numericValue = value;
|
|
779
938
|
}
|
|
780
|
-
|
|
781
|
-
|
|
939
|
+
|
|
940
|
+
// Use custom validate ONLY for formatting, not numeric comparison
|
|
941
|
+
if (validate && typeof value === 'string') {
|
|
942
|
+
const isFormatValid = validate(value, locale);
|
|
943
|
+
if (isFormatValid === false) {
|
|
944
|
+
return false; // invalid format
|
|
945
|
+
}
|
|
782
946
|
}
|
|
783
|
-
|
|
947
|
+
|
|
948
|
+
// Check min/max bounds
|
|
949
|
+
if (max !== undefined && numericValue > max) return false;
|
|
950
|
+
if (min !== undefined && numericValue < min) return false;
|
|
951
|
+
return true; // valid
|
|
784
952
|
}
|
|
785
953
|
|
|
786
954
|
/**
|
|
@@ -801,4 +969,4 @@ function disableWheel(e) {
|
|
|
801
969
|
e.preventDefault();
|
|
802
970
|
}
|
|
803
971
|
|
|
804
|
-
export { NumberInput, validateNumberSeparators };
|
|
972
|
+
export { NumberInput, parseNumberWithLocale, validateNumberSeparators };
|
|
@@ -75,7 +75,6 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
|
|
|
75
75
|
case 'top':
|
|
76
76
|
case 'bottom':
|
|
77
77
|
{
|
|
78
|
-
// TODO: Ensure `trigger` is there for `<OverflowMenu open>`
|
|
79
78
|
const triggerWidth = !trigger ? 0 : trigger.offsetWidth;
|
|
80
79
|
return {
|
|
81
80
|
left: (!flip ? 1 : -1) * (menuWidth / 2 - triggerWidth / 2),
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React, { type
|
|
7
|
+
import React, { type ElementType } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { TYPES } from '../Tag/Tag';
|
|
10
10
|
/**
|
|
@@ -32,7 +32,7 @@ interface PageHeaderBreadcrumbBarProps {
|
|
|
32
32
|
/**
|
|
33
33
|
* Provide an optional icon to render in front of the PageHeaderContent's title.
|
|
34
34
|
*/
|
|
35
|
-
renderIcon?:
|
|
35
|
+
renderIcon?: ElementType;
|
|
36
36
|
/**
|
|
37
37
|
* The PageHeaderBreadcrumbBar's content actions
|
|
38
38
|
*/
|
|
@@ -68,7 +68,7 @@ interface PageHeaderContentProps {
|
|
|
68
68
|
/**
|
|
69
69
|
* Provide an optional icon to render in front of the PageHeaderContent's title.
|
|
70
70
|
*/
|
|
71
|
-
renderIcon?:
|
|
71
|
+
renderIcon?: ElementType;
|
|
72
72
|
/**
|
|
73
73
|
* The PageHeaderContent's title
|
|
74
74
|
*/
|
|
@@ -9,13 +9,13 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
|
|
12
|
-
import React, {
|
|
12
|
+
import React, { forwardRef, useRef, useEffect, useMemo } from 'react';
|
|
13
13
|
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
14
14
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
15
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
16
|
import { useEvent, useWindowEvent } from '../../internal/useEvent.js';
|
|
17
17
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
18
|
-
import { useFloating,
|
|
18
|
+
import { useFloating, offset, flip, arrow, hide, autoUpdate } from '@floating-ui/react';
|
|
19
19
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
20
20
|
|
|
21
21
|
const PopoverContext = /*#__PURE__*/React.createContext({
|
|
@@ -147,7 +147,9 @@ forwardRef) {
|
|
|
147
147
|
refs,
|
|
148
148
|
floatingStyles,
|
|
149
149
|
placement,
|
|
150
|
-
middlewareData
|
|
150
|
+
middlewareData,
|
|
151
|
+
elements,
|
|
152
|
+
update
|
|
151
153
|
} = useFloating(enableFloatingStyles ? {
|
|
152
154
|
placement: align,
|
|
153
155
|
// The floating element is positioned relative to its nearest
|
|
@@ -167,12 +169,18 @@ forwardRef) {
|
|
|
167
169
|
}), arrow({
|
|
168
170
|
element: caretRef,
|
|
169
171
|
padding: 16
|
|
170
|
-
}), autoAlign && hide()]
|
|
171
|
-
whileElementsMounted: autoUpdate
|
|
172
|
+
}), autoAlign && hide()]
|
|
172
173
|
} : {}
|
|
173
174
|
// When autoAlign is turned off & the `enable-v12-dynamic-floating-styles` feature flag is not
|
|
174
175
|
// enabled, floating-ui will not be used
|
|
175
176
|
);
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
if (!enableFloatingStyles) return;
|
|
179
|
+
if (open && elements.reference && elements.floating) {
|
|
180
|
+
const cleanup = autoUpdate(elements.reference, elements.floating, update);
|
|
181
|
+
return cleanup;
|
|
182
|
+
}
|
|
183
|
+
}, [enableFloatingStyles, open, elements, update]);
|
|
176
184
|
const value = useMemo(() => {
|
|
177
185
|
return {
|
|
178
186
|
floating,
|
|
@@ -397,11 +405,13 @@ Popover.propTypes = {
|
|
|
397
405
|
*/
|
|
398
406
|
open: PropTypes.bool.isRequired
|
|
399
407
|
};
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
408
|
+
const frFn = forwardRef;
|
|
409
|
+
const PopoverContent = frFn((props, forwardRef) => {
|
|
410
|
+
const {
|
|
411
|
+
className,
|
|
412
|
+
children,
|
|
413
|
+
...rest
|
|
414
|
+
} = props;
|
|
405
415
|
const prefix = usePrefix();
|
|
406
416
|
const {
|
|
407
417
|
setFloating,
|
|
@@ -427,8 +437,7 @@ function PopoverContentRenderFunction({
|
|
|
427
437
|
}),
|
|
428
438
|
ref: caretRef
|
|
429
439
|
}));
|
|
430
|
-
}
|
|
431
|
-
const PopoverContent = /*#__PURE__*/React.forwardRef(PopoverContentRenderFunction);
|
|
440
|
+
});
|
|
432
441
|
PopoverContent.displayName = 'PopoverContent';
|
|
433
442
|
PopoverContent.propTypes = {
|
|
434
443
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React, { type ChangeEvent, type
|
|
7
|
+
import React, { type ChangeEvent, type ElementType, type HTMLAttributes, type KeyboardEvent, type MouseEvent, type ReactNode } from 'react';
|
|
8
8
|
type InputPropsBase = Omit<HTMLAttributes<HTMLInputElement>, 'onChange'>;
|
|
9
9
|
export interface SearchProps extends InputPropsBase {
|
|
10
10
|
/**
|
|
@@ -61,7 +61,7 @@ export interface SearchProps extends InputPropsBase {
|
|
|
61
61
|
/**
|
|
62
62
|
* A component used to render an icon.
|
|
63
63
|
*/
|
|
64
|
-
renderIcon?:
|
|
64
|
+
renderIcon?: ElementType;
|
|
65
65
|
/**
|
|
66
66
|
* @deprecated Specify the role for the underlying `<input>`.
|
|
67
67
|
* No longer needed since `<input type="search">` already provides the correct semantics.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React, { useContext, useState, cloneElement } from 'react';
|
|
10
|
+
import React, { forwardRef, useContext, useState, cloneElement } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { ChevronDown, WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
13
13
|
import { deprecate } from '../../prop-types/deprecate.js';
|
|
@@ -21,7 +21,7 @@ import { AILabel } from '../AILabel/index.js';
|
|
|
21
21
|
import { isComponentElement } from '../../internal/utils.js';
|
|
22
22
|
import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.js';
|
|
23
23
|
|
|
24
|
-
const Select = /*#__PURE__*/
|
|
24
|
+
const Select = /*#__PURE__*/forwardRef(({
|
|
25
25
|
className,
|
|
26
26
|
decorator,
|
|
27
27
|
id,
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
2
8
|
export interface SkeletonIconProps {
|
|
3
9
|
/**
|
|
4
10
|
* Specify an optional className to add.
|
|
5
11
|
*/
|
|
6
12
|
className?: string;
|
|
7
13
|
}
|
|
8
|
-
declare const SkeletonIcon:
|
|
14
|
+
declare const SkeletonIcon: {
|
|
15
|
+
({ className, ...other }: SkeletonIconProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
propTypes: {
|
|
17
|
+
/**
|
|
18
|
+
* Specify an optional className to add.
|
|
19
|
+
*/
|
|
20
|
+
className: PropTypes.Requireable<string>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
9
23
|
export default SkeletonIcon;
|
|
@@ -72,7 +72,7 @@ export interface TagBaseProps {
|
|
|
72
72
|
*/
|
|
73
73
|
slug?: ReactNode;
|
|
74
74
|
/**
|
|
75
|
-
* @deprecated The `title` prop has been deprecated and will be removed in the next major version. Use
|
|
75
|
+
* @deprecated The `title` prop has been deprecated and will be removed in the next major version. Use `children` instead.
|
|
76
76
|
*/
|
|
77
77
|
title?: string;
|
|
78
78
|
/**
|
package/es/components/Tag/Tag.js
CHANGED
|
@@ -152,6 +152,8 @@ const TagBase = /*#__PURE__*/React.forwardRef(({
|
|
|
152
152
|
}, normalizedDecorator) : '');
|
|
153
153
|
});
|
|
154
154
|
const Tag = TagBase;
|
|
155
|
+
|
|
156
|
+
// @ts-expect-error - `propTypes` isn't typed.
|
|
155
157
|
Tag.propTypes = {
|
|
156
158
|
/**
|
|
157
159
|
* Provide an alternative tag or component to use instead of the default
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React, { useContext, Children } from 'react';
|
|
10
|
+
import React, { forwardRef, useContext, Children } from 'react';
|
|
11
11
|
import { TextDirectionContext } from './TextDirectionContext.js';
|
|
12
12
|
|
|
13
13
|
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
14
|
-
const
|
|
14
|
+
const Text = /*#__PURE__*/forwardRef(({
|
|
15
15
|
as,
|
|
16
16
|
children,
|
|
17
17
|
dir = 'auto',
|
|
@@ -53,7 +53,8 @@ const TextBase = /*#__PURE__*/React.forwardRef(({
|
|
|
53
53
|
ref: ref
|
|
54
54
|
}, rest, textProps), children));
|
|
55
55
|
});
|
|
56
|
-
|
|
56
|
+
|
|
57
|
+
// @ts-expect-error - `propTypes` isn't typed.
|
|
57
58
|
Text.propTypes = {
|
|
58
59
|
/**
|
|
59
60
|
* Provide a custom element type used to render the outermost node
|
|
@@ -23,9 +23,7 @@ const TextDirection = ({
|
|
|
23
23
|
}, [dir]);
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
savedCallback.current = getTextDirection;
|
|
26
|
-
|
|
27
|
-
// `getTextDirection`?
|
|
28
|
-
});
|
|
26
|
+
}, [getTextDirection]);
|
|
29
27
|
return /*#__PURE__*/React.createElement(TextDirectionContext.Provider, {
|
|
30
28
|
value: value
|
|
31
29
|
}, children);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import { type
|
|
7
|
+
import { type RefObject } from 'react';
|
|
8
8
|
export type TextDir = 'ltr' | 'rtl' | 'auto' | string;
|
|
9
9
|
export type GetTextDirection = (text: string | string[] | undefined) => TextDir;
|
|
10
10
|
export interface TextDirectionContextType {
|
|
11
11
|
direction: TextDir;
|
|
12
|
-
getTextDirection:
|
|
12
|
+
getTextDirection: RefObject<GetTextDirection | undefined>;
|
|
13
13
|
}
|
|
14
14
|
export declare const TextDirectionContext: import("react").Context<TextDirectionContextType>;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React from 'react';
|
|
9
|
+
import React, { forwardRef } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import { WarningFilled, ViewOff, View } from '@carbon/icons-react';
|
|
@@ -16,7 +16,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
16
16
|
import { useId } from '../../internal/useId.js';
|
|
17
17
|
import { noopFn } from '../../internal/noopFn.js';
|
|
18
18
|
|
|
19
|
-
const ControlledPasswordInput = /*#__PURE__*/
|
|
19
|
+
const ControlledPasswordInput = /*#__PURE__*/forwardRef(({
|
|
20
20
|
labelText,
|
|
21
21
|
className,
|
|
22
22
|
id,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React, { useState, useContext, useEffect } from 'react';
|
|
9
|
+
import React, { forwardRef, useState, useContext, useEffect } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import { ViewOff, View } from '@carbon/icons-react';
|
|
@@ -19,7 +19,7 @@ import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
|
19
19
|
import { deprecate } from '../../prop-types/deprecate.js';
|
|
20
20
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
21
21
|
|
|
22
|
-
const PasswordInput = /*#__PURE__*/
|
|
22
|
+
const PasswordInput = /*#__PURE__*/forwardRef(({
|
|
23
23
|
className,
|
|
24
24
|
disabled = false,
|
|
25
25
|
helperText,
|