rsuite 6.0.0-canary-20250622 → 6.0.0-canary-20250702
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/AutoComplete/styles/index.css +156 -161
- package/AvatarGroup/styles/index.css +1 -10
- package/Badge/styles/index.css +21 -21
- package/Button/styles/index.css +78 -63
- package/ButtonGroup/styles/index.css +15 -12
- package/ButtonToolbar/styles/index.css +1 -10
- package/CHANGELOG.md +9 -0
- package/Calendar/styles/index.css +92 -67
- package/Card/styles/index.css +7 -7
- package/CascadeTree/styles/index.css +8 -9
- package/Cascader/styles/index.css +160 -164
- package/CheckPicker/styles/index.css +173 -178
- package/CheckTree/styles/index.css +175 -180
- package/CheckTreePicker/styles/index.css +175 -180
- package/Checkbox/styles/index.css +21 -28
- package/CheckboxGroup/styles/index.css +1 -1
- package/DateInput/styles/index.css +8 -18
- package/DatePicker/styles/index.css +173 -168
- package/DateRangeInput/styles/index.css +8 -18
- package/DateRangePicker/styles/index.css +173 -168
- package/Dropdown/styles/index.css +110 -94
- package/IconButton/styles/index.css +95 -79
- package/InlineEdit/styles/index.css +12 -19
- package/Input/styles/index.css +8 -18
- package/InputGroup/styles/index.css +31 -38
- package/InputNumber/styles/index.css +115 -100
- package/InputPicker/styles/index.css +156 -161
- package/List/styles/index.css +10 -10
- package/Loader/styles/index.css +16 -16
- package/Menu/styles/index.css +2 -2
- package/Message/styles/index.css +2 -2
- package/MultiCascadeTree/styles/index.css +178 -191
- package/MultiCascader/styles/index.css +178 -200
- package/Nav/styles/index.css +162 -146
- package/Navbar/styles/index.css +140 -124
- package/NumberInput/styles/index.css +115 -100
- package/Pagination/styles/index.css +177 -200
- package/PasswordInput/styles/index.css +36 -43
- package/PinInput/styles/index.css +12 -22
- package/Radio/styles/index.css +22 -29
- package/RadioGroup/styles/index.css +11 -11
- package/SelectPicker/styles/index.css +156 -161
- package/Sidenav/styles/index.css +122 -129
- package/Stack/styles/index.css +1 -10
- package/Stat/styles/index.css +95 -79
- package/Steps/styles/index.css +26 -25
- package/Table/styles/index.css +11 -0
- package/Tabs/styles/index.css +162 -146
- package/Tag/styles/index.css +112 -96
- package/TagInput/styles/index.css +174 -179
- package/TagPicker/styles/index.css +174 -179
- package/TimePicker/styles/index.css +173 -168
- package/TimeRangePicker/styles/index.css +173 -168
- package/Toggle/styles/index.css +27 -30
- package/Tree/styles/index.css +157 -162
- package/TreePicker/styles/index.css +157 -162
- package/Uploader/styles/index.css +94 -65
- package/cjs/AutoComplete/AutoComplete.d.ts +1 -1
- package/cjs/AutoComplete/AutoComplete.js +1 -0
- package/cjs/Badge/Badge.js +16 -11
- package/cjs/Breadcrumb/Breadcrumb.d.ts +2 -2
- package/cjs/Button/Button.js +9 -7
- package/cjs/ButtonGroup/ButtonGroup.js +7 -7
- package/cjs/Card/Card.js +6 -6
- package/cjs/Checkbox/Checkbox.js +6 -7
- package/cjs/CheckboxGroup/CheckboxGroup.js +3 -4
- package/cjs/Dropdown/Dropdown.js +3 -4
- package/cjs/Dropdown/DropdownItem.js +4 -4
- package/cjs/Dropdown/DropdownMenu.js +9 -10
- package/cjs/FormControl/FormControl.d.ts +1 -1
- package/cjs/FormControlLabel/FormControlLabel.d.ts +1 -1
- package/cjs/FormHelpText/FormHelpText.d.ts +1 -1
- package/cjs/FormStack/FormStack.d.ts +0 -5
- package/cjs/FormStack/FormStack.js +1 -6
- package/cjs/IconButton/IconButton.d.ts +1 -1
- package/cjs/IconButton/IconButton.js +9 -9
- package/cjs/Image/Image.d.ts +1 -1
- package/cjs/InlineEdit/InlineEdit.js +3 -2
- package/cjs/InputGroup/InputGroup.js +12 -14
- package/cjs/InputGroup/InputGroupAddon.d.ts +2 -2
- package/cjs/InputPicker/InputAutosize.js +4 -6
- package/cjs/List/List.d.ts +1 -1
- package/cjs/List/List.js +7 -8
- package/cjs/List/ListItem.d.ts +2 -2
- package/cjs/List/ListItem.js +4 -4
- package/cjs/Loader/Loader.js +8 -7
- package/cjs/Menu/MenuSeparator.d.ts +2 -2
- package/cjs/Nav/Nav.d.ts +2 -2
- package/cjs/Nav/Nav.js +12 -13
- package/cjs/Nav/NavDropdownItem.js +4 -4
- package/cjs/Nav/NavDropdownMenu.js +10 -13
- package/cjs/Nav/NavItem.d.ts +2 -2
- package/cjs/Nav/NavItem.js +6 -8
- package/cjs/Navbar/Navbar.js +6 -6
- package/cjs/Navbar/NavbarDropdown.d.ts +1 -1
- package/cjs/Navbar/NavbarDropdown.js +3 -4
- package/cjs/Navbar/NavbarDropdownItem.js +4 -4
- package/cjs/Navbar/NavbarDropdownMenu.js +8 -11
- package/cjs/NumberInput/NumberInput.d.ts +1 -1
- package/cjs/Pagination/Pagination.js +3 -2
- package/cjs/Pagination/PaginationButton.d.ts +3 -3
- package/cjs/Pagination/PaginationButton.js +9 -17
- package/cjs/Pagination/PaginationGroup.js +2 -1
- package/cjs/Panel/PanelHeader.d.ts +1 -1
- package/cjs/Progress/index.d.ts +1 -2
- package/cjs/Progress/index.js +0 -2
- package/cjs/Radio/Radio.js +6 -6
- package/cjs/RadioGroup/RadioGroup.js +4 -4
- package/cjs/Sidenav/ExpandedSidenavDropdown.d.ts +1 -1
- package/cjs/Sidenav/Sidenav.js +3 -2
- package/cjs/Sidenav/SidenavDropdown.js +3 -5
- package/cjs/Sidenav/SidenavDropdownItem.js +4 -4
- package/cjs/Sidenav/SidenavDropdownMenu.js +10 -13
- package/cjs/Sidenav/SidenavItem.d.ts +2 -2
- package/cjs/Sidenav/SidenavItem.js +4 -5
- package/cjs/Slider/Handle.d.ts +1 -1
- package/cjs/Stack/Stack.d.ts +3 -21
- package/cjs/Stack/Stack.js +3 -28
- package/cjs/Stack/StackItem.d.ts +4 -5
- package/cjs/Stack/StackItem.js +4 -10
- package/cjs/Steps/StepItem.js +7 -8
- package/cjs/Steps/Steps.d.ts +2 -1
- package/cjs/Steps/Steps.js +32 -34
- package/cjs/Tabs/Tabs.js +1 -1
- package/cjs/Tag/Tag.js +5 -2
- package/cjs/Toggle/Toggle.d.ts +1 -1
- package/cjs/Toggle/Toggle.js +7 -6
- package/cjs/Tree/types.d.ts +2 -2
- package/cjs/Uploader/Uploader.d.ts +2 -2
- package/cjs/internals/Box/Box.d.ts +4 -38
- package/cjs/internals/Box/Box.js +3 -3
- package/cjs/internals/Box/index.d.ts +1 -1
- package/cjs/internals/Box/utils.d.ts +0 -9
- package/cjs/internals/Box/utils.js +22 -226
- package/cjs/internals/InputBase/InputBase.d.ts +1 -1
- package/cjs/internals/InputBase/InputBase.js +3 -2
- package/cjs/internals/Menu/MenuItem.js +1 -1
- package/cjs/internals/Overlay/Modal.d.ts +1 -1
- package/cjs/internals/Picker/PickerToggle.js +2 -4
- package/cjs/internals/SafeAnchor/SafeAnchor.d.ts +2 -2
- package/cjs/internals/Tree/TreeView.d.ts +2 -2
- package/cjs/internals/hooks/useCustom.js +24 -7
- package/cjs/internals/styled-system/css-alias.d.ts +7 -0
- package/cjs/internals/styled-system/css-alias.js +391 -0
- package/cjs/internals/styled-system/css-properties.d.ts +6 -0
- package/cjs/internals/styled-system/css-properties.js +30 -0
- package/cjs/internals/styled-system/index.d.ts +5 -0
- package/cjs/internals/styled-system/index.js +34 -0
- package/cjs/internals/styled-system/responsive.d.ts +26 -0
- package/cjs/internals/styled-system/responsive.js +118 -0
- package/cjs/internals/styled-system/types.d.ts +208 -0
- package/cjs/internals/styled-system/types.js +4 -0
- package/cjs/internals/{hooks → styled-system}/useStyled.d.ts +2 -6
- package/cjs/internals/{hooks → styled-system}/useStyled.js +24 -84
- package/cjs/internals/types/html.d.ts +6 -6
- package/cjs/internals/types/picker.d.ts +2 -2
- package/cjs/internals/types/sizes.d.ts +2 -1
- package/cjs/internals/utils/colours.d.ts +1 -1
- package/cjs/internals/utils/colours.js +4 -4
- package/cjs/internals/utils/sizes.d.ts +1 -0
- package/cjs/internals/utils/sizes.js +8 -1
- package/cjs/internals/utils/style-sheet/css.d.ts +6 -0
- package/cjs/internals/utils/style-sheet/css.js +35 -0
- package/cjs/internals/utils/style-sheet/index.d.ts +0 -1
- package/cjs/internals/utils/style-sheet/index.js +0 -6
- package/cjs/internals/utils/style-sheet/responsive.d.ts +15 -0
- package/cjs/internals/utils/style-sheet/responsive.js +19 -0
- package/cjs/useMediaQuery/breakpoints.d.ts +6 -6
- package/cjs/useMediaQuery/breakpoints.js +27 -31
- package/cjs/useMediaQuery/types.d.ts +2 -2
- package/cjs/useMediaQuery/useMediaQuery.js +3 -13
- package/dist/rsuite-no-reset.css +641 -655
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite.css +641 -655
- package/dist/rsuite.js +128 -95
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/AutoComplete/AutoComplete.d.ts +1 -1
- package/esm/AutoComplete/AutoComplete.js +1 -0
- package/esm/Badge/Badge.js +16 -11
- package/esm/Breadcrumb/Breadcrumb.d.ts +2 -2
- package/esm/Button/Button.js +9 -7
- package/esm/ButtonGroup/ButtonGroup.js +7 -7
- package/esm/Card/Card.js +6 -6
- package/esm/Checkbox/Checkbox.js +6 -7
- package/esm/CheckboxGroup/CheckboxGroup.js +3 -4
- package/esm/Dropdown/Dropdown.js +3 -4
- package/esm/Dropdown/DropdownItem.js +4 -4
- package/esm/Dropdown/DropdownMenu.js +9 -10
- package/esm/FormControl/FormControl.d.ts +1 -1
- package/esm/FormControlLabel/FormControlLabel.d.ts +1 -1
- package/esm/FormHelpText/FormHelpText.d.ts +1 -1
- package/esm/FormStack/FormStack.d.ts +0 -5
- package/esm/FormStack/FormStack.js +2 -7
- package/esm/IconButton/IconButton.d.ts +1 -1
- package/esm/IconButton/IconButton.js +9 -9
- package/esm/Image/Image.d.ts +1 -1
- package/esm/InlineEdit/InlineEdit.js +3 -2
- package/esm/InputGroup/InputGroup.js +12 -14
- package/esm/InputGroup/InputGroupAddon.d.ts +2 -2
- package/esm/InputPicker/InputAutosize.js +4 -6
- package/esm/List/List.d.ts +1 -1
- package/esm/List/List.js +7 -8
- package/esm/List/ListItem.d.ts +2 -2
- package/esm/List/ListItem.js +4 -4
- package/esm/Loader/Loader.js +8 -7
- package/esm/Menu/MenuSeparator.d.ts +2 -2
- package/esm/Nav/Nav.d.ts +2 -2
- package/esm/Nav/Nav.js +12 -13
- package/esm/Nav/NavDropdownItem.js +4 -4
- package/esm/Nav/NavDropdownMenu.js +10 -13
- package/esm/Nav/NavItem.d.ts +2 -2
- package/esm/Nav/NavItem.js +6 -8
- package/esm/Navbar/Navbar.js +7 -7
- package/esm/Navbar/NavbarDropdown.d.ts +1 -1
- package/esm/Navbar/NavbarDropdown.js +3 -4
- package/esm/Navbar/NavbarDropdownItem.js +4 -4
- package/esm/Navbar/NavbarDropdownMenu.js +8 -11
- package/esm/NumberInput/NumberInput.d.ts +1 -1
- package/esm/Pagination/Pagination.js +3 -2
- package/esm/Pagination/PaginationButton.d.ts +3 -3
- package/esm/Pagination/PaginationButton.js +9 -16
- package/esm/Pagination/PaginationGroup.js +2 -1
- package/esm/Panel/PanelHeader.d.ts +1 -1
- package/esm/Progress/index.d.ts +1 -2
- package/esm/Progress/index.js +1 -2
- package/esm/Radio/Radio.js +6 -6
- package/esm/RadioGroup/RadioGroup.js +4 -4
- package/esm/Sidenav/ExpandedSidenavDropdown.d.ts +1 -1
- package/esm/Sidenav/Sidenav.js +3 -2
- package/esm/Sidenav/SidenavDropdown.js +3 -5
- package/esm/Sidenav/SidenavDropdownItem.js +4 -4
- package/esm/Sidenav/SidenavDropdownMenu.js +10 -13
- package/esm/Sidenav/SidenavItem.d.ts +2 -2
- package/esm/Sidenav/SidenavItem.js +4 -5
- package/esm/Slider/Handle.d.ts +1 -1
- package/esm/Stack/Stack.d.ts +3 -21
- package/esm/Stack/Stack.js +3 -28
- package/esm/Stack/StackItem.d.ts +4 -5
- package/esm/Stack/StackItem.js +5 -11
- package/esm/Steps/StepItem.js +7 -8
- package/esm/Steps/Steps.d.ts +2 -1
- package/esm/Steps/Steps.js +31 -34
- package/esm/Tabs/Tabs.js +1 -1
- package/esm/Tag/Tag.js +5 -2
- package/esm/Toggle/Toggle.d.ts +1 -1
- package/esm/Toggle/Toggle.js +7 -6
- package/esm/Tree/types.d.ts +2 -2
- package/esm/Uploader/Uploader.d.ts +2 -2
- package/esm/internals/Box/Box.d.ts +4 -38
- package/esm/internals/Box/Box.js +3 -3
- package/esm/internals/Box/index.d.ts +1 -1
- package/esm/internals/Box/utils.d.ts +0 -9
- package/esm/internals/Box/utils.js +20 -224
- package/esm/internals/InputBase/InputBase.d.ts +1 -1
- package/esm/internals/InputBase/InputBase.js +3 -2
- package/esm/internals/Menu/MenuItem.js +1 -1
- package/esm/internals/Overlay/Modal.d.ts +1 -1
- package/esm/internals/Picker/PickerToggle.js +2 -4
- package/esm/internals/SafeAnchor/SafeAnchor.d.ts +2 -2
- package/esm/internals/Tree/TreeView.d.ts +2 -2
- package/esm/internals/hooks/useCustom.js +24 -7
- package/esm/internals/styled-system/css-alias.d.ts +7 -0
- package/esm/internals/styled-system/css-alias.js +387 -0
- package/esm/internals/styled-system/css-properties.d.ts +6 -0
- package/esm/internals/styled-system/css-properties.js +26 -0
- package/esm/internals/styled-system/index.d.ts +5 -0
- package/esm/internals/styled-system/index.js +6 -0
- package/esm/internals/styled-system/responsive.d.ts +26 -0
- package/esm/internals/styled-system/responsive.js +110 -0
- package/esm/internals/styled-system/types.d.ts +208 -0
- package/esm/internals/styled-system/types.js +2 -0
- package/esm/internals/{hooks → styled-system}/useStyled.d.ts +2 -6
- package/esm/internals/{hooks → styled-system}/useStyled.js +20 -79
- package/esm/internals/types/html.d.ts +6 -6
- package/esm/internals/types/picker.d.ts +2 -2
- package/esm/internals/types/sizes.d.ts +2 -1
- package/esm/internals/utils/colours.d.ts +1 -1
- package/esm/internals/utils/colours.js +2 -2
- package/esm/internals/utils/sizes.d.ts +1 -0
- package/esm/internals/utils/sizes.js +6 -0
- package/esm/internals/utils/style-sheet/css.d.ts +6 -0
- package/esm/internals/utils/style-sheet/css.js +34 -0
- package/esm/internals/utils/style-sheet/index.d.ts +0 -1
- package/esm/internals/utils/style-sheet/index.js +1 -2
- package/esm/internals/utils/style-sheet/responsive.d.ts +15 -0
- package/esm/internals/utils/style-sheet/responsive.js +19 -0
- package/esm/useMediaQuery/breakpoints.d.ts +6 -6
- package/esm/useMediaQuery/breakpoints.js +27 -31
- package/esm/useMediaQuery/types.d.ts +2 -2
- package/esm/useMediaQuery/useMediaQuery.js +2 -12
- package/package.json +1 -1
- /package/cjs/internals/{utils/style-sheet → styled-system}/style-manager.d.ts +0 -0
- /package/cjs/internals/{utils/style-sheet → styled-system}/style-manager.js +0 -0
- /package/esm/internals/{utils/style-sheet → styled-system}/style-manager.d.ts +0 -0
- /package/esm/internals/{utils/style-sheet → styled-system}/style-manager.js +0 -0
|
@@ -1,52 +1,34 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const marginStyleMap = {
|
|
17
|
-
m: 'margin',
|
|
18
|
-
mt: 'marginTop',
|
|
19
|
-
mb: 'marginBottom',
|
|
20
|
-
ml: 'marginLeft',
|
|
21
|
-
mr: 'marginRight',
|
|
22
|
-
mx: 'marginInline',
|
|
23
|
-
my: 'marginBlock'
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// Mapping for size properties to their CSS style equivalents
|
|
27
|
-
const sizeStyleMap = {
|
|
28
|
-
w: 'width',
|
|
29
|
-
h: 'height',
|
|
30
|
-
minw: 'minWidth',
|
|
31
|
-
maxw: 'maxWidth',
|
|
32
|
-
minh: 'minHeight',
|
|
33
|
-
maxh: 'maxHeight'
|
|
2
|
+
import camelCase from 'lodash/camelCase';
|
|
3
|
+
import { cssSystemPropAlias } from "../styled-system/index.js";
|
|
4
|
+
import { isCSSProperty } from "../utils/index.js";
|
|
5
|
+
const getUsedPropKeys = () => {
|
|
6
|
+
const propSet = new Set();
|
|
7
|
+
Object.entries(cssSystemPropAlias).forEach(([key, prop]) => {
|
|
8
|
+
const {
|
|
9
|
+
property
|
|
10
|
+
} = prop;
|
|
11
|
+
const propName = camelCase(property);
|
|
12
|
+
propSet.add(key);
|
|
13
|
+
propSet.add(propName);
|
|
14
|
+
});
|
|
15
|
+
return Array.from(propSet);
|
|
34
16
|
};
|
|
35
17
|
|
|
36
|
-
// Derive box property keys from style mappings
|
|
37
|
-
const boxPropKeys = [...Object.keys(paddingStyleMap), ...Object.keys(marginStyleMap), ...Object.keys(sizeStyleMap), 'bd', 'bg', 'c', 'display', 'rounded', 'shadow'];
|
|
38
|
-
|
|
39
18
|
/**
|
|
40
19
|
* Extract box properties from props
|
|
41
20
|
* @param props Original props object
|
|
42
21
|
* @returns Object containing only box properties
|
|
43
22
|
*/
|
|
44
23
|
export const extractBoxProps = props => {
|
|
24
|
+
const boxPropKeys = getUsedPropKeys();
|
|
45
25
|
const boxProps = {};
|
|
46
26
|
|
|
47
27
|
// Extract only box related properties
|
|
48
|
-
|
|
49
|
-
if (key
|
|
28
|
+
Object.keys(props).forEach(key => {
|
|
29
|
+
if (boxPropKeys.includes(key) && props[key] !== undefined) {
|
|
30
|
+
boxProps[key] = props[key];
|
|
31
|
+
} else if (isCSSProperty(key)) {
|
|
50
32
|
boxProps[key] = props[key];
|
|
51
33
|
}
|
|
52
34
|
});
|
|
@@ -59,6 +41,7 @@ export const extractBoxProps = props => {
|
|
|
59
41
|
* @returns New object without layout properties
|
|
60
42
|
*/
|
|
61
43
|
export const omitBoxProps = props => {
|
|
44
|
+
const boxPropKeys = getUsedPropKeys();
|
|
62
45
|
const filteredProps = {};
|
|
63
46
|
|
|
64
47
|
// Copy all properties except box related ones
|
|
@@ -68,191 +51,4 @@ export const omitBoxProps = props => {
|
|
|
68
51
|
}
|
|
69
52
|
});
|
|
70
53
|
return filteredProps;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Checks if a value is a responsive value object
|
|
75
|
-
* @param value - Value to check
|
|
76
|
-
* @returns True if the value is a responsive value object
|
|
77
|
-
*/
|
|
78
|
-
function isResponsiveValue(value) {
|
|
79
|
-
return value !== null && typeof value === 'object' && !Array.isArray(value) && Object.keys(value).some(key => BREAKPOINTS.includes(key));
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Process a value that might be a responsive value
|
|
84
|
-
* @param value - Value to process
|
|
85
|
-
* @param processor - Function to process non-responsive values
|
|
86
|
-
* @returns Processed value or responsive object with processed values
|
|
87
|
-
*/
|
|
88
|
-
function processResponsiveValue(value, processor) {
|
|
89
|
-
if (value === undefined) {
|
|
90
|
-
return undefined;
|
|
91
|
-
}
|
|
92
|
-
if (isResponsiveValue(value)) {
|
|
93
|
-
const result = {};
|
|
94
|
-
Object.entries(value).forEach(([breakpoint, val]) => {
|
|
95
|
-
if (val !== undefined) {
|
|
96
|
-
const processed = processor(val);
|
|
97
|
-
if (processed !== undefined) {
|
|
98
|
-
result[breakpoint] = processed;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
return Object.keys(result).length > 0 ? result : undefined;
|
|
103
|
-
}
|
|
104
|
-
return processor(value);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Type for CSS variable values that can be string, number, or responsive values
|
|
108
|
-
|
|
109
|
-
// Silence ESLint warnings for unused parameters in forEach callbacks
|
|
110
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Converts layout properties to CSS variables with abbreviated names
|
|
114
|
-
* @param props Object containing layout properties
|
|
115
|
-
* @returns Object with CSS variables
|
|
116
|
-
*/
|
|
117
|
-
export const getBoxCSSVariables = props => {
|
|
118
|
-
const cssVars = {};
|
|
119
|
-
const prefix = `--rs-box-`;
|
|
120
|
-
|
|
121
|
-
// Process padding properties
|
|
122
|
-
Object.keys(paddingStyleMap).forEach(propKey => {
|
|
123
|
-
if (props[propKey] !== undefined) {
|
|
124
|
-
cssVars[`${prefix}${propKey}`] = processResponsiveValue(props[propKey], val => getCssValue(val));
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
// Process margin properties
|
|
129
|
-
Object.keys(marginStyleMap).forEach(propKey => {
|
|
130
|
-
if (props[propKey] !== undefined) {
|
|
131
|
-
cssVars[`${prefix}${propKey}`] = processResponsiveValue(props[propKey], val => getCssValue(val));
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
// Process size properties
|
|
136
|
-
Object.keys(sizeStyleMap).forEach(propKey => {
|
|
137
|
-
if (props[propKey] !== undefined) {
|
|
138
|
-
cssVars[`${prefix}${propKey}`] = processResponsiveValue(props[propKey], val => getCssValue(val));
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
if (props.bd !== undefined) {
|
|
142
|
-
cssVars[`${prefix}bd`] = processResponsiveValue(props.bd, val => getCssValue(val));
|
|
143
|
-
}
|
|
144
|
-
if (props.display !== undefined) {
|
|
145
|
-
cssVars[`${prefix}display`] = processResponsiveValue(props.display, val => val);
|
|
146
|
-
}
|
|
147
|
-
if (props.c !== undefined) {
|
|
148
|
-
cssVars[`${prefix}c`] = processResponsiveValue(props.c, val => getColorVar(val));
|
|
149
|
-
}
|
|
150
|
-
if (props.bg !== undefined) {
|
|
151
|
-
cssVars[`${prefix}bg`] = processResponsiveValue(props.bg, val => getColorVar(val));
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Handle special cases for rounded and shadow
|
|
155
|
-
if (props.rounded !== undefined) {
|
|
156
|
-
const processRounded = val => {
|
|
157
|
-
const result = getSizeStyle(val, 'box', 'rounded');
|
|
158
|
-
return result ? result : undefined;
|
|
159
|
-
};
|
|
160
|
-
if (isResponsiveValue(props.rounded)) {
|
|
161
|
-
// Handle responsive rounded values
|
|
162
|
-
const responsiveRounded = {};
|
|
163
|
-
Object.entries(props.rounded).forEach(([breakpoint, val]) => {
|
|
164
|
-
if (val !== undefined) {
|
|
165
|
-
const styleObj = processRounded(val);
|
|
166
|
-
if (styleObj) {
|
|
167
|
-
responsiveRounded[breakpoint] = styleObj;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
// For each CSS variable key in the rounded styles, create a responsive value
|
|
173
|
-
const processedKeys = new Set();
|
|
174
|
-
Object.entries(responsiveRounded).forEach(([_breakpoint, styleObj]) => {
|
|
175
|
-
if (styleObj) {
|
|
176
|
-
Object.entries(styleObj).forEach(([key, _value]) => {
|
|
177
|
-
processedKeys.add(key);
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
processedKeys.forEach(key => {
|
|
182
|
-
const responsiveValue = {};
|
|
183
|
-
Object.entries(responsiveRounded).forEach(([breakpoint, styleObj]) => {
|
|
184
|
-
if (styleObj && styleObj[key] !== undefined) {
|
|
185
|
-
// Ensure we're only using string values for CSS variables
|
|
186
|
-
const value = styleObj[key];
|
|
187
|
-
if (typeof value === 'string' || typeof value === 'number') {
|
|
188
|
-
responsiveValue[breakpoint] = value;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
if (Object.keys(responsiveValue).length > 0) {
|
|
193
|
-
cssVars[key] = responsiveValue;
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
} else {
|
|
197
|
-
// Handle non-responsive rounded value
|
|
198
|
-
const styleObj = processRounded(props.rounded);
|
|
199
|
-
if (styleObj) {
|
|
200
|
-
Object.entries(styleObj).forEach(([key, value]) => {
|
|
201
|
-
cssVars[key] = value;
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
if (props.shadow !== undefined) {
|
|
207
|
-
const processShadow = val => {
|
|
208
|
-
const result = getSizeStyle(val, 'box', 'shadow');
|
|
209
|
-
return result ? result : undefined;
|
|
210
|
-
};
|
|
211
|
-
if (isResponsiveValue(props.shadow)) {
|
|
212
|
-
// Handle responsive shadow values
|
|
213
|
-
const responsiveShadow = {};
|
|
214
|
-
Object.entries(props.shadow).forEach(([breakpoint, val]) => {
|
|
215
|
-
if (val !== undefined) {
|
|
216
|
-
const styleObj = processShadow(val);
|
|
217
|
-
if (styleObj) {
|
|
218
|
-
responsiveShadow[breakpoint] = styleObj;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
// For each CSS variable key in the shadow styles, create a responsive value
|
|
224
|
-
const processedKeys = new Set();
|
|
225
|
-
Object.entries(responsiveShadow).forEach(([_breakpoint, styleObj]) => {
|
|
226
|
-
if (styleObj) {
|
|
227
|
-
Object.entries(styleObj).forEach(([key, _value]) => {
|
|
228
|
-
processedKeys.add(key);
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
processedKeys.forEach(key => {
|
|
233
|
-
const responsiveValue = {};
|
|
234
|
-
Object.entries(responsiveShadow).forEach(([breakpoint, styleObj]) => {
|
|
235
|
-
if (styleObj && styleObj[key] !== undefined) {
|
|
236
|
-
// Ensure we're only using string values for CSS variables
|
|
237
|
-
const value = styleObj[key];
|
|
238
|
-
if (typeof value === 'string' || typeof value === 'number') {
|
|
239
|
-
responsiveValue[breakpoint] = value;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
if (Object.keys(responsiveValue).length > 0) {
|
|
244
|
-
cssVars[key] = responsiveValue;
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
} else {
|
|
248
|
-
// Handle non-responsive shadow value
|
|
249
|
-
const styleObj = processShadow(props.shadow);
|
|
250
|
-
if (styleObj) {
|
|
251
|
-
Object.entries(styleObj).forEach(([key, value]) => {
|
|
252
|
-
cssVars[key] = value;
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return cssVars;
|
|
258
54
|
};
|
|
@@ -5,7 +5,7 @@ import type { PropsWithoutChange, FormControlBaseProps, Size } from '../types';
|
|
|
5
5
|
export interface InputBaseLocaleType {
|
|
6
6
|
unfilled: string;
|
|
7
7
|
}
|
|
8
|
-
export interface InputBaseCommonProps extends BoxProps, PropsWithoutChange<FormControlBaseProps> {
|
|
8
|
+
export interface InputBaseCommonProps extends Omit<BoxProps, 'height' | 'width'>, PropsWithoutChange<FormControlBaseProps> {
|
|
9
9
|
/** A component can have different sizes */
|
|
10
10
|
size?: Size;
|
|
11
11
|
/** The HTML input id */
|
|
@@ -52,7 +52,7 @@ const InputBase = forwardRef((props, ref) => {
|
|
|
52
52
|
withPrefix,
|
|
53
53
|
merge
|
|
54
54
|
} = useStyles(classPrefix || 'input');
|
|
55
|
-
const classes = merge(className, withPrefix(
|
|
55
|
+
const classes = merge(className, withPrefix({
|
|
56
56
|
plaintext
|
|
57
57
|
}));
|
|
58
58
|
|
|
@@ -82,7 +82,8 @@ const InputBase = forwardRef((props, ref) => {
|
|
|
82
82
|
defaultValue: defaultValue,
|
|
83
83
|
disabled: disabled,
|
|
84
84
|
readOnly: readOnly,
|
|
85
|
-
placeholder: placeholder
|
|
85
|
+
placeholder: placeholder,
|
|
86
|
+
"data-size": size
|
|
86
87
|
}, inputProps, eventProps, rest));
|
|
87
88
|
});
|
|
88
89
|
InputBase.displayName = 'InputBase';
|
|
@@ -83,7 +83,7 @@ function MenuItem(props) {
|
|
|
83
83
|
role: 'menuitem',
|
|
84
84
|
// fixme Only use `aria-checked` on menuitemradio and menuitemcheckbox
|
|
85
85
|
'aria-checked': selected || undefined,
|
|
86
|
-
'aria-disabled': disabled,
|
|
86
|
+
'aria-disabled': disabled || undefined,
|
|
87
87
|
tabIndex: -1,
|
|
88
88
|
onClick: handleClick,
|
|
89
89
|
// render props
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BoxProps } from '../Box';
|
|
3
3
|
import type { AnimationEventProps } from '../types';
|
|
4
|
-
export interface BaseModalProps extends Omit<BoxProps, 'children'>, AnimationEventProps {
|
|
4
|
+
export interface BaseModalProps extends Omit<BoxProps, 'children' | 'transition' | 'color' | 'overflow'>, AnimationEventProps {
|
|
5
5
|
/** Animation-related properties */
|
|
6
6
|
animationProps?: any;
|
|
7
7
|
/** Primary content */
|
|
@@ -103,9 +103,7 @@ const PickerToggle = forwardRef((props, ref) => {
|
|
|
103
103
|
id: labelId
|
|
104
104
|
}, label)), /*#__PURE__*/React.createElement(Stack.Item, {
|
|
105
105
|
grow: 1,
|
|
106
|
-
|
|
107
|
-
overflow: 'hidden'
|
|
108
|
-
}
|
|
106
|
+
overflow: "hidden"
|
|
109
107
|
}, /*#__PURE__*/React.createElement("input", {
|
|
110
108
|
readOnly: true,
|
|
111
109
|
"aria-hidden": true,
|
|
@@ -113,7 +111,7 @@ const PickerToggle = forwardRef((props, ref) => {
|
|
|
113
111
|
"data-testid": "picker-toggle-input",
|
|
114
112
|
name: name,
|
|
115
113
|
value: inputValue,
|
|
116
|
-
className: prefix('textbox'
|
|
114
|
+
className: prefix('textbox'),
|
|
117
115
|
style: {
|
|
118
116
|
pointerEvents: 'none'
|
|
119
117
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export interface SafeAnchorProps extends
|
|
2
|
+
import { BaseBoxProps } from '../Box';
|
|
3
|
+
export interface SafeAnchorProps extends BaseBoxProps, React.HTMLAttributes<HTMLElement> {
|
|
4
4
|
/** Link specified url */
|
|
5
5
|
href?: string;
|
|
6
6
|
/** A link can show it is currently unable to be interacted with */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
interface TreeViewProps extends
|
|
2
|
+
import { BaseBoxProps } from '../Box';
|
|
3
|
+
interface TreeViewProps extends BaseBoxProps, React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
treeRootClassName: string;
|
|
5
5
|
multiselectable?: boolean;
|
|
6
6
|
height?: number;
|
|
@@ -7,12 +7,29 @@ import { CustomContext } from "../Provider/CustomContext.js";
|
|
|
7
7
|
function getDefaultRTL() {
|
|
8
8
|
return typeof document !== 'undefined' && (document.body.getAttribute('dir') || document.dir) === 'rtl';
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Maps a component name to its corresponding locale key
|
|
13
|
+
* @param componentName - The name of the component
|
|
14
|
+
* @returns The locale key for the component
|
|
15
|
+
*/
|
|
16
|
+
function getComponentLocaleKey(componentName) {
|
|
17
|
+
// Define mappings for components that share locale keys
|
|
18
|
+
const localeKeyMappings = {
|
|
19
|
+
// All picker components use the Combobox locale
|
|
20
|
+
Cascader: 'Combobox',
|
|
21
|
+
CheckTreePicker: 'Combobox',
|
|
22
|
+
MultiCascader: 'Combobox',
|
|
23
|
+
SelectPicker: 'Combobox',
|
|
24
|
+
TreePicker: 'Combobox',
|
|
25
|
+
CheckPicker: 'Combobox',
|
|
26
|
+
// Time components use date components locales
|
|
27
|
+
TimePicker: 'DatePicker',
|
|
28
|
+
TimeRangePicker: 'DateRangePicker'
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Return the mapped locale key or the component name itself if no mapping exists
|
|
32
|
+
return localeKeyMappings[componentName] || componentName;
|
|
16
33
|
}
|
|
17
34
|
|
|
18
35
|
/**
|
|
@@ -57,7 +74,7 @@ export function useCustom(componentName, componentProps) {
|
|
|
57
74
|
//Memoize the global default props based on component name
|
|
58
75
|
const globalDefaultProps = ((_components$component = components[componentName]) === null || _components$component === void 0 ? void 0 : _components$component.defaultProps) || {};
|
|
59
76
|
const mergedProps = assign({}, globalDefaultProps, restProps);
|
|
60
|
-
const localeKey =
|
|
77
|
+
const localeKey = getComponentLocaleKey(componentName);
|
|
61
78
|
|
|
62
79
|
// If the default locale has the component name, then merge the locale.
|
|
63
80
|
if (Object.keys(enGB).includes(localeKey)) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CSSSystemProps, CSSProperty } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* CSS Property Alias
|
|
4
|
+
* This type maps all the CSS properties defined in cssSystemPropAlias to their corresponding React CSS types
|
|
5
|
+
*/
|
|
6
|
+
export declare const cssSystemPropAlias: Partial<Record<keyof CSSSystemProps, CSSProperty>>;
|
|
7
|
+
export type CSSSystemPropKey = keyof typeof cssSystemPropAlias;
|