@ringcentral/juno 1.12.2 → 1.12.4-beta.5835-b8c3da57
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/components/Buttons/Button/Button.d.ts +3 -3
- package/components/Buttons/Button/styles/StyledButton.js +4 -2
- package/components/Buttons/IconButton/IconButton.d.ts +1 -1
- package/components/Buttons/ToggleButton/ToggleButton.d.ts +1 -1
- package/components/Card/Card/Card.d.ts +2 -2
- package/components/Chip/Chip.d.ts +10 -3
- package/components/Chip/Chip.js +5 -3
- package/components/Chip/styles/ChipStyle.js +5 -4
- package/components/Chip/utils/ChipUtils.d.ts +1 -1
- package/components/Chip/utils/ChipUtils.js +1 -1
- package/components/Dialer/DialTextField/DialTextField.d.ts +1 -1
- package/components/Downshift/Downshift.d.ts +20 -9
- package/components/Downshift/Downshift.js +15 -5
- package/components/Downshift/SuggestionList/SuggestionList.d.ts +2 -2
- package/components/Downshift/SuggestionList/SuggestionList.js +12 -6
- package/components/Downshift/SuggestionList/utils/index.d.ts +1 -0
- package/components/Downshift/SuggestionList/utils/index.js +1 -0
- package/components/Downshift/SuggestionList/utils/useSuggestionList.d.ts +298 -0
- package/components/Downshift/SuggestionList/utils/useSuggestionList.js +239 -0
- package/components/Downshift/styles/DownshiftStyle.d.ts +1 -1
- package/components/Downshift/styles/StyledTextField.d.ts +1 -1
- package/components/Downshift/utils/DownshiftUtils.d.ts +12 -0
- package/components/Downshift/utils/DownshiftUtils.js +19 -1
- package/components/Downshift/utils/SelectItem.d.ts +19 -0
- package/components/Downshift/utils/useDownshift.d.ts +5 -2
- package/components/Downshift/utils/useDownshift.interface.d.ts +5 -0
- package/components/Downshift/utils/useDownshift.js +31 -13
- package/components/Downshift/utils/useDownshiftGroup.d.ts +7 -7
- package/components/Downshift/utils/useDownshiftGroup.js +45 -19
- package/components/Forms/Checkbox/Checkbox.d.ts +1 -1
- package/components/Forms/Picker/DatePicker/styles/StyledDatePickerHeader.d.ts +1 -1
- package/components/Forms/Picker/TimePicker/NumberPicker.js +1 -3
- package/components/Forms/Picker/TimePicker/utils/TimePickerHelper.js +1 -1
- package/components/Forms/Picker/styles/StyledPickerTextField.d.ts +1 -1
- package/components/Forms/Radio/Radio.d.ts +1 -1
- package/components/Forms/Select/PlainSelect/PlainSelect.d.ts +1 -1
- package/components/Forms/Select/PlainSelect/PlainSelect.js +5 -4
- package/components/Forms/Select/PlainSelect/styles/StyledSelect.js +4 -3
- package/components/Forms/Select/Select.d.ts +2 -2
- package/components/Forms/Select/Select.js +2 -2
- package/components/Forms/Select/styles/StyledSelect.js +22 -18
- package/components/Forms/TextField/TextField.d.ts +4 -2
- package/components/Forms/TextField/TextField.js +2 -2
- package/components/Forms/TextField/styles/ClearIconButton.d.ts +2 -2
- package/components/Forms/TextField/styles/OutlineTextFieldStyle.js +4 -2
- package/components/Forms/TextField/styles/TextFieldStyle.js +8 -4
- package/components/Forms/Textarea/Textarea.d.ts +1 -1
- package/components/List/ListItem/ListItem.d.ts +1 -1
- package/components/Menu/MenuItem/MenuItem.d.ts +13 -5
- package/components/Menu/SubMenu/SubMenu.js +1 -1
- package/components/PortalHost/PortalManager/PortalManager.d.ts +2 -2
- package/components/PortalHost/PortalManager/PortalManager.js +9 -3
- package/components/PortalHost/PortalManager/types.d.ts +2 -1
- package/components/TablePagination/styles/TablePaginationStyle.d.ts +13 -5
- package/components/Tooltip/withTooltip/withTooltip.d.ts +6 -4
- package/components/Typography/Typography.d.ts +1 -1
- package/components/Virtuoso/utils/useHighlightScroll.d.ts +1 -1
- package/es6/components/Buttons/Button/styles/StyledButton.js +4 -2
- package/es6/components/Chip/Chip.js +6 -4
- package/es6/components/Chip/styles/ChipStyle.js +6 -5
- package/es6/components/Chip/utils/ChipUtils.js +1 -1
- package/es6/components/Downshift/Downshift.js +16 -7
- package/es6/components/Downshift/SuggestionList/SuggestionList.js +13 -7
- package/es6/components/Downshift/SuggestionList/utils/index.js +1 -0
- package/es6/components/Downshift/SuggestionList/utils/useSuggestionList.js +237 -0
- package/es6/components/Downshift/utils/DownshiftUtils.js +19 -1
- package/es6/components/Downshift/utils/useDownshift.js +31 -13
- package/es6/components/Downshift/utils/useDownshiftGroup.js +46 -20
- package/es6/components/Forms/Picker/TimePicker/NumberPicker.js +1 -3
- package/es6/components/Forms/Picker/TimePicker/utils/TimePickerHelper.js +1 -1
- package/es6/components/Forms/Select/PlainSelect/PlainSelect.js +5 -4
- package/es6/components/Forms/Select/PlainSelect/styles/StyledSelect.js +4 -3
- package/es6/components/Forms/Select/Select.js +2 -2
- package/es6/components/Forms/Select/styles/StyledSelect.js +24 -20
- package/es6/components/Forms/TextField/TextField.js +2 -2
- package/es6/components/Forms/TextField/styles/OutlineTextFieldStyle.js +5 -3
- package/es6/components/Forms/TextField/styles/TextFieldStyle.js +9 -5
- package/es6/components/Menu/SubMenu/SubMenu.js +1 -1
- package/es6/components/PortalHost/PortalManager/PortalManager.js +9 -3
- package/es6/foundation/config.js +8 -5
- package/es6/foundation/contexts/PortalWindowContext.js +3 -1
- package/es6/foundation/hooks/useAnnouncer/useAnnouncer.js +7 -0
- package/es6/foundation/hooks/useKeyboardMoveFocus/useKeyboardMoveFocus.js +2 -1
- package/foundation/config.js +8 -5
- package/foundation/contexts/PortalWindowContext.js +3 -1
- package/foundation/hooks/useAnnouncer/useAnnouncer.d.ts +7 -0
- package/foundation/hooks/useAnnouncer/useAnnouncer.js +7 -0
- package/foundation/hooks/useKeyboardMoveFocus/useKeyboardMoveFocus.js +2 -1
- package/package.json +3 -3
|
@@ -1,33 +1,28 @@
|
|
|
1
1
|
import { __assign, __read, __spread } from "tslib";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { combineProps, logInDev, omit,
|
|
3
|
+
import { combineProps, logInDev, omit, useDepsChange, useEventCallback, useRefState, } from '../../../foundation';
|
|
4
4
|
export var useDownshiftGroup = function (_a) {
|
|
5
|
-
var groupBy = _a.groupBy, options = _a.options, filteredResult = _a.filteredResult, getExpandIconProps = _a.getExpandIconProps, groupExpanded = _a.groupExpanded, onGroupExpanded = _a.onGroupExpanded, groupVariant = _a.groupVariant, id = _a.id;
|
|
5
|
+
var groupBy = _a.groupBy, options = _a.options, filteredResult = _a.filteredResult, getExpandIconProps = _a.getExpandIconProps, groupExpanded = _a.groupExpanded, groupDefaultExpanded = _a.groupDefaultExpanded, onGroupExpanded = _a.onGroupExpanded, groupVariant = _a.groupVariant, getOptionDisabled = _a.getOptionDisabled, id = _a.id;
|
|
6
6
|
var _b = __read(useRefState({}), 2), groupExpandedMapRef = _b[0], setGroupExpandedMap = _b[1];
|
|
7
7
|
var isTitleGroup = groupVariant === 'normal';
|
|
8
|
-
|
|
9
|
-
if (typeof groupExpanded === 'object') {
|
|
10
|
-
setGroupExpandedMap(groupExpanded, false);
|
|
11
|
-
}
|
|
12
|
-
}, function () { return groupExpanded; });
|
|
13
|
-
var handleGroupExpandedChange = function (key) {
|
|
8
|
+
var handleGroupExpandedChange = function (groupName) {
|
|
14
9
|
var _a;
|
|
15
10
|
var groupExpandedMap = groupExpandedMapRef.current;
|
|
16
11
|
if (typeof groupExpanded === 'boolean') {
|
|
17
12
|
return;
|
|
18
13
|
}
|
|
19
|
-
var toExpandedState = !groupExpandedMap[
|
|
20
|
-
var newExpandedMap = __assign(__assign({}, groupExpandedMap), (_a = {}, _a[
|
|
14
|
+
var toExpandedState = !groupExpandedMap[groupName];
|
|
15
|
+
var newExpandedMap = __assign(__assign({}, groupExpandedMap), (_a = {}, _a[groupName] = toExpandedState, _a));
|
|
21
16
|
setGroupExpandedMap(newExpandedMap);
|
|
22
17
|
if (onGroupExpanded) {
|
|
23
|
-
var group = optionsGroupList.find(function (x) { return x.group ===
|
|
18
|
+
var group = optionsGroupList.find(function (x) { return x.group === groupName; });
|
|
24
19
|
if (group) {
|
|
25
20
|
onGroupExpanded(__assign(__assign({}, omit(group, ['getExpandIconProps'])), { expanded: toExpandedState }), newExpandedMap);
|
|
26
21
|
}
|
|
27
22
|
}
|
|
28
23
|
};
|
|
29
|
-
var handleExpandIconClick = useEventCallback(function (e,
|
|
30
|
-
handleGroupExpandedChange(
|
|
24
|
+
var handleExpandIconClick = useEventCallback(function (e, groupName) {
|
|
25
|
+
handleGroupExpandedChange(groupName);
|
|
31
26
|
e.preventDefault();
|
|
32
27
|
e.stopPropagation();
|
|
33
28
|
});
|
|
@@ -37,7 +32,8 @@ export var useDownshiftGroup = function (_a) {
|
|
|
37
32
|
// used to keep track of key and indexes in the result array
|
|
38
33
|
var indexBy_1 = new Map();
|
|
39
34
|
var warn_1 = false;
|
|
40
|
-
|
|
35
|
+
var afterGroupFn_1 = [];
|
|
36
|
+
var result = filteredResult.reduce(function (acc, option, index) {
|
|
41
37
|
var group = groupBy(option);
|
|
42
38
|
if (acc.length > 0 && acc[acc.length - 1].group === group) {
|
|
43
39
|
acc[acc.length - 1].options.push(__assign(__assign({}, option), { group: acc[acc.length - 1] }));
|
|
@@ -76,41 +72,71 @@ export var useDownshiftGroup = function (_a) {
|
|
|
76
72
|
};
|
|
77
73
|
newGroup_1.options[0].group = newGroup_1;
|
|
78
74
|
if (isTitleGroup) {
|
|
79
|
-
|
|
75
|
+
var groupTitleOption_1 = {
|
|
80
76
|
id: id + "-" + group,
|
|
81
77
|
label: group,
|
|
82
78
|
disabled: true,
|
|
79
|
+
// * here cause by self Type reference
|
|
83
80
|
group: newGroup_1,
|
|
84
|
-
}
|
|
81
|
+
};
|
|
82
|
+
// push fn to array, do that after all options be add into group
|
|
83
|
+
if (getOptionDisabled) {
|
|
84
|
+
afterGroupFn_1.push(function () {
|
|
85
|
+
groupTitleOption_1.disabled =
|
|
86
|
+
getOptionDisabled(groupTitleOption_1);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
newGroup_1.options.unshift(groupTitleOption_1);
|
|
85
90
|
}
|
|
86
91
|
acc.push(newGroup_1);
|
|
87
92
|
}
|
|
88
93
|
return acc;
|
|
89
94
|
}, []);
|
|
95
|
+
afterGroupFn_1.forEach(function (fn) {
|
|
96
|
+
fn();
|
|
97
|
+
});
|
|
98
|
+
return result;
|
|
90
99
|
}
|
|
91
100
|
return [];
|
|
92
101
|
}, [
|
|
93
102
|
filteredResult,
|
|
94
103
|
getExpandIconProps,
|
|
104
|
+
getOptionDisabled,
|
|
95
105
|
groupBy,
|
|
96
106
|
handleExpandIconClick,
|
|
97
107
|
id,
|
|
98
108
|
isTitleGroup,
|
|
99
109
|
options,
|
|
100
110
|
]);
|
|
111
|
+
var initGroupExpandedState = function (expandedState) {
|
|
112
|
+
if (typeof expandedState === 'object') {
|
|
113
|
+
setGroupExpandedMap(expandedState, false);
|
|
114
|
+
}
|
|
115
|
+
else if (typeof expandedState === 'boolean') {
|
|
116
|
+
setGroupExpandedMap(optionsGroupList.reduce(function (prev, curr) {
|
|
117
|
+
prev[curr.group] = expandedState;
|
|
118
|
+
return prev;
|
|
119
|
+
}, {}), false);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
useDepsChange(function () {
|
|
123
|
+
initGroupExpandedState(groupDefaultExpanded);
|
|
124
|
+
}, []);
|
|
125
|
+
useDepsChange(function () {
|
|
126
|
+
initGroupExpandedState(groupExpanded);
|
|
127
|
+
}, [groupExpanded]);
|
|
101
128
|
var groupExpandedMap = groupExpandedMapRef.current;
|
|
102
129
|
// * speared logic with group, prevent calculate every time.
|
|
103
130
|
var groupedResult = useMemo(function () {
|
|
104
131
|
var addExpandedResult = Object.entries(groupExpandedMap).reduce(function (prev, _a) {
|
|
105
132
|
var _b = __read(_a, 2), key = _b[0], expended = _b[1];
|
|
106
133
|
var group = prev.find(function (x) { return x.group === key; });
|
|
107
|
-
if (group)
|
|
134
|
+
if (group)
|
|
108
135
|
group.expanded = expended;
|
|
109
|
-
}
|
|
110
136
|
return prev;
|
|
111
137
|
}, __spread(optionsGroupList));
|
|
112
138
|
return addExpandedResult.reduce(function (prev, curr) {
|
|
113
|
-
if (
|
|
139
|
+
if (curr.expanded) {
|
|
114
140
|
prev.push.apply(prev, __spread(curr.options));
|
|
115
141
|
}
|
|
116
142
|
else {
|
|
@@ -118,7 +144,7 @@ export var useDownshiftGroup = function (_a) {
|
|
|
118
144
|
}
|
|
119
145
|
return prev;
|
|
120
146
|
}, []);
|
|
121
|
-
}, [groupExpandedMap, optionsGroupList
|
|
147
|
+
}, [groupExpandedMap, optionsGroupList]);
|
|
122
148
|
return {
|
|
123
149
|
optionsGroupList: optionsGroupList,
|
|
124
150
|
groupedResult: groupedResult,
|
|
@@ -105,9 +105,7 @@ var _NumberPicker = forwardRef(function (props, ref) {
|
|
|
105
105
|
React.createElement(StyledTimeIconButton, { tabIndex: -1, size: iconSize, color: "neutral.f04", wrapperSize: size, disabled: increaseDisabled, onClick: function () {
|
|
106
106
|
onUpdateValue(increaseValue);
|
|
107
107
|
}, symbol: ArrowUpIcon, "data-test-automation-id": automationId && automationId + "-prev-pagination", "aria-label": "Arrow Up" }),
|
|
108
|
-
React.createElement(StyledTimeIconButton, { wrapperSize: size, tabIndex: -1, onClick: onClick,
|
|
109
|
-
// * when both disabled that icon can't click into selection view
|
|
110
|
-
disabled: increaseDisabled && decreaseDisabled, "data-test-automation-id": automationId && automationId + "-text" },
|
|
108
|
+
React.createElement(StyledTimeIconButton, { wrapperSize: size, tabIndex: -1, onClick: onClick, "data-test-automation-id": automationId && automationId + "-text" },
|
|
111
109
|
React.createElement(React.Fragment, null,
|
|
112
110
|
// TODO: that <></> will fix when `RcIconButton` ready
|
|
113
111
|
showValue)),
|
|
@@ -17,9 +17,9 @@ var plainAnchorOrigin = {
|
|
|
17
17
|
vertical: 'bottom',
|
|
18
18
|
};
|
|
19
19
|
var _RcPlainSelect = forwardRef(function (_a, ref) {
|
|
20
|
-
var children = _a.children, className = _a.className, classes = _a.classes, value = _a.value, renderValue = _a.renderValue, variant = _a.variant, ButtonProps = _a.ButtonProps, innerRef = _a.innerRef, SelectInputProps = _a.SelectInputProps, InputProps = _a.InputProps, disabled = _a.disabled, autoFocus = _a.autoFocus, size = _a.size, virtualize = _a.virtualize, fullWidth = _a.fullWidth,
|
|
20
|
+
var children = _a.children, className = _a.className, classes = _a.classes, value = _a.value, renderValue = _a.renderValue, variant = _a.variant, ButtonProps = _a.ButtonProps, innerRef = _a.innerRef, SelectInputProps = _a.SelectInputProps, InputProps = _a.InputProps, disabled = _a.disabled, autoFocus = _a.autoFocus, size = _a.size, virtualize = _a.virtualize, fullWidth = _a.fullWidth, color = _a.color,
|
|
21
21
|
//
|
|
22
|
-
IconComponent = _a.IconComponent, onOpenProp = _a.onOpen, onCloseProp = _a.onClose, rest = __rest(_a, ["children", "className", "classes", "value", "renderValue", "variant", "ButtonProps", "innerRef", "SelectInputProps", "InputProps", "disabled", "autoFocus", "size", "virtualize", "fullWidth", "IconComponent", "onOpen", "onClose"]);
|
|
22
|
+
IconComponent = _a.IconComponent, onOpenProp = _a.onOpen, onCloseProp = _a.onClose, rest = __rest(_a, ["children", "className", "classes", "value", "renderValue", "variant", "ButtonProps", "innerRef", "SelectInputProps", "InputProps", "disabled", "autoFocus", "size", "virtualize", "fullWidth", "color", "IconComponent", "onOpen", "onClose"]);
|
|
23
23
|
var _b = __read(useState(false), 2), open = _b[0], setOpen = _b[1];
|
|
24
24
|
var display = useMemo(function () {
|
|
25
25
|
var item = children.find(function (child) {
|
|
@@ -29,7 +29,7 @@ var _RcPlainSelect = forwardRef(function (_a, ref) {
|
|
|
29
29
|
}, [children, value]);
|
|
30
30
|
var _renderValue = useCallback(function (value) {
|
|
31
31
|
var _variant = switchVariantToButtonVariant(variant);
|
|
32
|
-
return (React.createElement(RcButton, __assign({ ref: ref, innerRef: innerRef, disabled: disabled, size: size, fullWidth: fullWidth, autoFocus: autoFocus, variant: _variant, "aria-label": "open menu", "aria-haspopup": "listbox" }, combineProps(defaultButtonProps, ButtonProps)),
|
|
32
|
+
return (React.createElement(RcButton, __assign({ ref: ref, innerRef: innerRef, disabled: disabled, size: size, color: color, fullWidth: fullWidth, autoFocus: autoFocus, variant: _variant, "aria-label": "open menu", "aria-haspopup": "listbox" }, combineProps(defaultButtonProps, ButtonProps)),
|
|
33
33
|
renderValue ? renderValue(value) : display,
|
|
34
34
|
(IconComponent && React.createElement(IconComponent, { open: open })) || (React.createElement(SelectArrowDownIcon
|
|
35
35
|
// * reset default color
|
|
@@ -42,6 +42,7 @@ var _RcPlainSelect = forwardRef(function (_a, ref) {
|
|
|
42
42
|
ButtonProps,
|
|
43
43
|
IconComponent,
|
|
44
44
|
autoFocus,
|
|
45
|
+
color,
|
|
45
46
|
disabled,
|
|
46
47
|
display,
|
|
47
48
|
fullWidth,
|
|
@@ -81,7 +82,7 @@ var _RcPlainSelect = forwardRef(function (_a, ref) {
|
|
|
81
82
|
}, onClose: function (e) {
|
|
82
83
|
setOpen(false);
|
|
83
84
|
onCloseProp === null || onCloseProp === void 0 ? void 0 : onCloseProp(e);
|
|
84
|
-
}, SelectInputProps: _SelectInputProps, InputProps: _InputProps, renderValue: _renderValue, fullWidth: fullWidth }, rest), children));
|
|
85
|
+
}, SelectInputProps: _SelectInputProps, InputProps: _InputProps, renderValue: _renderValue, fullWidth: fullWidth, color: color }, rest), children));
|
|
85
86
|
});
|
|
86
87
|
/** @release */
|
|
87
88
|
var RcPlainSelect = styled(_RcPlainSelect)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), plainSelectStyle);
|
|
@@ -11,9 +11,10 @@ export var plainSelectStyle = function (_a) {
|
|
|
11
11
|
var variant = _a.variant, disabled = _a.disabled;
|
|
12
12
|
var isText = variant === 'text';
|
|
13
13
|
var isRound = roundVariant.includes(variant);
|
|
14
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: auto;\n\n ", " {\n ", " {\n margin-right: 0;\n }\n }\n\n ", " {\n margin-right: 0;\n }\n\n .", " {\n margin-bottom: 0;\n }\n\n .", " {\n width: auto;\n pointer-events: none;\n }\n\n .", " {\n padding: 0;\n height: auto;\n }\n\n ", " {\n pointer-events: ", ";\n min-width: unset;\n padding-left: ", ";\n padding-right: ", ";\n border-radius: ", ";\n\n ", " {\n margin: ", ";\n }\n\n ", "\n }\n "], ["\n width: auto;\n\n ",
|
|
15
|
+
" {\n ", " {\n margin-right: 0;\n }\n }\n\n ", " {\n margin-right: 0;\n }\n\n .", " {\n margin-bottom: 0;\n }\n\n .", " {\n width: auto;\n pointer-events: none;\n }\n\n .", " {\n padding: 0;\n height: auto;\n }\n\n ", " {\n pointer-events: ", ";\n min-width: unset;\n padding-left: ", ";\n padding-right: ", ";\n border-radius: ", ";\n\n ", " {\n margin: ", ";\n }\n\n ",
|
|
16
|
+
"\n }\n "])), RcButton /**
|
|
14
17
|
// TODO: cancel button bellow icon margin issue,
|
|
15
|
-
|
|
16
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", " {\n ", " {\n margin-right: 0;\n }\n }\n\n ", " {\n margin-right: 0;\n }\n\n .", " {\n margin-bottom: 0;\n }\n\n .", " {\n width: auto;\n pointer-events: none;\n }\n\n .", " {\n padding: 0;\n height: auto;\n }\n\n ", " {\n pointer-events: ", ";\n min-width: unset;\n padding-left: ", ";\n padding-right: ", ";\n border-radius: ", ";\n\n ", " {\n margin: ", ";\n }\n\n ", "\n }\n "], ["\n ", " {\n ", " {\n margin-right: 0;\n }\n }\n\n ", " {\n margin-right: 0;\n }\n\n .", " {\n margin-bottom: 0;\n }\n\n .", " {\n width: auto;\n pointer-events: none;\n }\n\n .", " {\n padding: 0;\n height: auto;\n }\n\n ", " {\n pointer-events: ", ";\n min-width: unset;\n padding-left: ", ";\n padding-right: ", ";\n border-radius: ", ";\n\n ", " {\n margin: ", ";\n }\n\n ",
|
|
17
|
-
"\n }\n "])), RcButton, RcIcon, RcListItemText, RcTextFieldClasses.root, RcPlainSelectInputClasses.root, RcPlainSelectInputClasses.input, RcButton, !disabled && 'auto', spacing(isText ? 4 : 1), spacing(isText ? 1 : 0), isRound && radius('xxl'), SelectArrowDownIcon, spacing(0, 0, 0, isRound ? 0 : 1), isRound && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n\n ", ", &.Mui-focusVisible {\n .", " {\n background-color: currentColor;\n opacity: ", ";\n }\n .", " {\n display: none;\n }\n }\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n\n ", ", &.Mui-focusVisible {\n .", " {\n background-color: currentColor;\n opacity: ", ";\n }\n .", " {\n display: none;\n }\n }\n "])), spacing(1.5), spacing(1.5), focusVisible, RcPlainSelectTouchRippleClasses.root, opacity('32'), RcPlainSelectTouchRippleClasses.child));
|
|
18
|
+
*/, RcIcon, RcListItemText, RcTextFieldClasses.root, RcPlainSelectInputClasses.root, RcPlainSelectInputClasses.input, RcButton, !disabled && 'auto', spacing(isText ? 4 : 1), spacing(isText ? 1 : 0), isRound && radius('xxl'), SelectArrowDownIcon, spacing(0, 0, 0, isRound ? 0 : 1), isRound && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n\n ", ", &.Mui-focusVisible {\n .", " {\n background-color: currentColor;\n opacity: ", ";\n }\n .", " {\n display: none;\n }\n }\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n\n ", ", &.Mui-focusVisible {\n .", " {\n background-color: currentColor;\n opacity: ", ";\n }\n .", " {\n display: none;\n }\n }\n "])), spacing(1.5), spacing(1.5), focusVisible, RcPlainSelectTouchRippleClasses.root, opacity('32'), RcPlainSelectTouchRippleClasses.child));
|
|
18
19
|
};
|
|
19
20
|
var templateObject_1, templateObject_2;
|
|
@@ -14,7 +14,7 @@ var _RcSelect = forwardRef(function (inProps, ref) {
|
|
|
14
14
|
var props = useThemeProps({ props: inProps, name: 'RcSelect' });
|
|
15
15
|
var children = props.children, onChange = props.onChange, SelectInputPropsProp = props.SelectInputProps, textVariant = props.textVariant, placeholder = props.placeholder, renderValue = props.renderValue, displayEmpty = props.displayEmpty, variant = props.variant, size = props.size, value = props.value, virtualize = props.virtualize,
|
|
16
16
|
// * below is should pick into TextField props
|
|
17
|
-
focused = props.focused, gutterBottom = props.gutterBottom, helperText = props.helperText, label = props.label, id = props.id, className = props.className, validate = props.validate, InputProps = props.InputProps, required = props.required, fullWidth = props.fullWidth, disabled = props.disabled, error = props.error, rest = __rest(props, ["children", "onChange", "SelectInputProps", "textVariant", "placeholder", "renderValue", "displayEmpty", "variant", "size", "value", "virtualize", "focused", "gutterBottom", "helperText", "label", "id", "className", "validate", "InputProps", "required", "fullWidth", "disabled", "error"]);
|
|
17
|
+
focused = props.focused, gutterBottom = props.gutterBottom, helperText = props.helperText, color = props.color, label = props.label, id = props.id, className = props.className, validate = props.validate, InputProps = props.InputProps, required = props.required, fullWidth = props.fullWidth, disabled = props.disabled, error = props.error, rest = __rest(props, ["children", "onChange", "SelectInputProps", "textVariant", "placeholder", "renderValue", "displayEmpty", "variant", "size", "value", "virtualize", "focused", "gutterBottom", "helperText", "color", "label", "id", "className", "validate", "InputProps", "required", "fullWidth", "disabled", "error"]);
|
|
18
18
|
var nonValue = value === undefined ||
|
|
19
19
|
value === null ||
|
|
20
20
|
// * if that can't displayEmpty, and that value === '', same as no value
|
|
@@ -62,7 +62,7 @@ var _RcSelect = forwardRef(function (inProps, ref) {
|
|
|
62
62
|
var valueIsNumber = typeof value === 'number';
|
|
63
63
|
return (React.createElement(RcSelectTextField, { ref: ref, id: id, className: className,
|
|
64
64
|
// for when that is select type that type will be select onChange, just any for ignore that
|
|
65
|
-
onChange: onChange, select: true, focused: focused, gutterBottom: gutterBottom, helperText: helperText, label: label, value: valueIsNumber ? value : value || '', validate: validate, required: required, fullWidth: fullWidth, disabled: disabled, error: error, InputProps: _InputProps, clearBtn: false, placeholder: placeholder, SelectProps: _SelectProps }, children));
|
|
65
|
+
onChange: onChange, color: color, select: true, focused: focused, gutterBottom: gutterBottom, helperText: helperText, label: label, value: valueIsNumber ? value : value || '', validate: validate, required: required, fullWidth: fullWidth, disabled: disabled, error: error, InputProps: _InputProps, clearBtn: false, placeholder: placeholder, SelectProps: _SelectProps }, children));
|
|
66
66
|
});
|
|
67
67
|
var RcSelect = styled(_RcSelect)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), selectStyle);
|
|
68
68
|
RcSelect.displayName = 'RcSelect';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { css, fakeBorder, palette2, px, radius, setOpacity, spacing, typography, } from '../../../../foundation';
|
|
1
|
+
import { __assign, __makeTemplateObject } from "tslib";
|
|
2
|
+
import { css, fakeBorder, getParsePaletteColor, palette2, px, radius, setOpacity, spacing, typography, } from '../../../../foundation';
|
|
3
3
|
import { disabledColor, placeholderColor } from '../../TextField/styles';
|
|
4
4
|
import { RcBoxSelectInputClasses, RcBoxSelectInputHeights, RcLineSelectInputClasses, RcSelectClasses, RcSelectInputClasses, RcSelectInputWhenPlaceholderClasses, } from '../utils';
|
|
5
5
|
var boxBackgroundColor = palette2('neutral', 'b03');
|
|
@@ -8,23 +8,27 @@ var lineSelectStyle = css(templateObject_1 || (templateObject_1 = __makeTemplate
|
|
|
8
8
|
var textVariant = _a.textVariant;
|
|
9
9
|
return typography(textVariant || 'subheading1');
|
|
10
10
|
}, setOpacity(palette2('action', 'grayDark'), '08'));
|
|
11
|
-
var boxSelectStyle =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
var boxSelectStyle = function (_a) {
|
|
12
|
+
var color = _a.color;
|
|
13
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n > .", " {\n margin-top: ", ";\n box-sizing: border-box;\n height: ", ";\n border-radius: ", ";\n background-color: ", ";\n\n &:not(.", "):hover {\n background-color: ", ";\n }\n\n &:before {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-radius: ", ";\n\n transition: none;\n border-bottom: none !important;\n pointer-events: none;\n ", ";\n }\n\n &:after {\n display: none;\n }\n }\n\n > .", " {\n background-color: ", ";\n\n &:before {\n ", ";\n }\n }\n\n > .", " {\n &:before {\n ", ";\n }\n }\n\n > .", " {\n background-color: ", ";\n &:before {\n ", ";\n }\n }\n\n .", " {\n padding: ", ";\n ", ";\n line-height: ", ";\n\n &:focus {\n background: transparent;\n }\n }\n"], ["\n > .", " {\n margin-top: ", ";\n box-sizing: border-box;\n height: ", ";\n border-radius: ", ";\n background-color: ", ";\n\n &:not(.", "):hover {\n background-color: ", ";\n }\n\n &:before {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-radius: ", ";\n\n transition: none;\n border-bottom: none !important;\n pointer-events: none;\n ", ";\n }\n\n &:after {\n display: none;\n }\n }\n\n > .", " {\n background-color: ", ";\n\n &:before {\n ", ";\n }\n }\n\n > .", " {\n &:before {\n ", ";\n }\n }\n\n > .", " {\n background-color: ", ";\n &:before {\n ", ";\n }\n }\n\n .", " {\n padding: ", ";\n ", ";\n line-height: ",
|
|
14
|
+
";\n\n &:focus {\n background: transparent;\n }\n }\n"])), RcBoxSelectInputClasses.root, function (_a) {
|
|
15
|
+
var label = _a.label;
|
|
16
|
+
return label && spacing(5);
|
|
17
|
+
}, function (_a) {
|
|
18
|
+
var size = _a.size;
|
|
19
|
+
return px(RcBoxSelectInputHeights[size]);
|
|
20
|
+
}, radius('lg'), boxBackgroundColor, RcBoxSelectInputClasses.disabled, setOpacity(boxActionBackgroundColor, '12'), radius('lg'), fakeBorder({ color: palette2('highContrast') }), RcBoxSelectInputClasses.focused, setOpacity(boxActionBackgroundColor, '16'), fakeBorder({ color: color }), RcBoxSelectInputClasses.error, fakeBorder({ color: palette2('danger', 'f02') }), RcBoxSelectInputClasses.disabled, setOpacity(palette2('action', 'grayLight'), '12'), fakeBorder({ color: 'transparent', allowTransparent: true }), RcBoxSelectInputClasses.input, spacing(1.5, 6, 1.5, 2), function (_a) {
|
|
21
|
+
var textVariant = _a.textVariant;
|
|
22
|
+
return typography(textVariant || 'body1');
|
|
23
|
+
}, function (_a) {
|
|
24
|
+
var size = _a.size;
|
|
25
|
+
// here -12 for make this input height same as container
|
|
26
|
+
return px(RcBoxSelectInputHeights[size] - 12);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
export var selectStyle = function (props) {
|
|
30
|
+
var variant = props.variant, placeholder = props.placeholder, colorProp = props.color;
|
|
31
|
+
var color = getParsePaletteColor(colorProp, palette2('interactive', 'f01'));
|
|
32
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n .", " {\n color: ", ";\n }\n\n .", " {\n .", " {\n color: ", ";\n }\n }\n\n .", " {\n .", " {\n color: ", ";\n }\n }\n\n .", " {\n color: ", ";\n &:before {\n content: ", ";\n border: none;\n }\n }\n\n .", " {\n color: ", ";\n .", " {\n color: ", ";\n }\n }\n\n ", ";\n ", ";\n "], ["\n .", " {\n color: ", ";\n }\n\n .", " {\n .", " {\n color: ", ";\n }\n }\n\n .", " {\n .", " {\n color: ", ";\n }\n }\n\n .", " {\n color: ", ";\n &:before {\n content: ", ";\n border: none;\n }\n }\n\n .", " {\n color: ", ";\n .", " {\n color: ", ";\n }\n }\n\n ", ";\n ", ";\n "])), RcSelectClasses.icon, palette2('neutral', 'f04'), RcSelectInputClasses.focused, RcSelectClasses.icon, color, RcSelectInputClasses.error, RcSelectClasses.icon, palette2('danger', 'f02'), RcSelectInputWhenPlaceholderClasses.input, placeholderColor, "'" + placeholder + "'", RcSelectInputClasses.disabled, disabledColor, RcSelectClasses.icon, disabledColor, variant === 'line' && lineSelectStyle, variant === 'box' && boxSelectStyle(__assign(__assign({}, props), { color: color })));
|
|
29
33
|
};
|
|
30
34
|
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -15,9 +15,9 @@ var _RcTextField = forwardRef(function (inProps, ref) {
|
|
|
15
15
|
// TODO: remove when remove focusOnMount
|
|
16
16
|
autoFocusProp = _a === void 0 ? focusOnMount : _a, InputPropsProp = props.InputProps, error = props.error, helperText = props.helperText, defaultValue = props.defaultValue, inputRefProp = props.inputRef, _b = props.autoSelect, autoSelect = _b === void 0 ? selectOnMount : _b, autoFocusDelay = props.autoFocusDelay, clearLabel = props.clearLabel, clearButtonProps = props.clearButtonProps, clearBtn = props.clearBtn, validate = props.validate, onChange = props.onChange, onBlur = props.onBlur, onFocus = props.onFocus, onClear = props.onClear, id = props.id,
|
|
17
17
|
// #region outline pick props
|
|
18
|
-
variant = props.variant, radius = props.radius, size = props.size, align = props.align, textVariant = props.textVariant, gutterBottom = props.gutterBottom,
|
|
18
|
+
variant = props.variant, radius = props.radius, size = props.size, align = props.align, textVariant = props.textVariant, gutterBottom = props.gutterBottom, color = props.color,
|
|
19
19
|
// #endregion
|
|
20
|
-
rest = __rest(props, ["classes", "InputLabelProps", "FormHelperTextProps", "value", "focusOnMount", "selectOnMount", "clearAriaLabel", "autoFocus", "InputProps", "error", "helperText", "defaultValue", "inputRef", "autoSelect", "autoFocusDelay", "clearLabel", "clearButtonProps", "clearBtn", "validate", "onChange", "onBlur", "onFocus", "onClear", "id", "variant", "radius", "size", "align", "textVariant", "gutterBottom"]);
|
|
20
|
+
rest = __rest(props, ["classes", "InputLabelProps", "FormHelperTextProps", "value", "focusOnMount", "selectOnMount", "clearAriaLabel", "autoFocus", "InputProps", "error", "helperText", "defaultValue", "inputRef", "autoSelect", "autoFocusDelay", "clearLabel", "clearButtonProps", "clearBtn", "validate", "onChange", "onBlur", "onFocus", "onClear", "id", "variant", "radius", "size", "align", "textVariant", "gutterBottom", "color"]);
|
|
21
21
|
var formContext = useRcFormContext();
|
|
22
22
|
var innerRef = useRef();
|
|
23
23
|
var inputRef = useForkRef(inputRefProp, innerRef);
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { css, fakeBorder, palette2, px, radius as radiusFn, spacing, typography, } from '../../../../foundation';
|
|
2
|
+
import { css, fakeBorder, getParsePaletteColor, palette2, px, radius as radiusFn, spacing, typography, } from '../../../../foundation';
|
|
3
3
|
import { belowIconButtonSpacing, RcOutlineTextFieldFontStyles, RcOutlineTextFieldHeights, RcOutlineTextFieldInputClasses, RcOutlineTextFieldLabelMargins, RcOutlineTextFieldSpaces, RcTextFieldClasses, } from '../utils';
|
|
4
4
|
export var OutlineTextFieldStyle = function (_a) {
|
|
5
|
-
var radius = _a.radius, size = _a.size;
|
|
5
|
+
var radius = _a.radius, size = _a.size, colorProp = _a.color;
|
|
6
6
|
var height = px(RcOutlineTextFieldHeights[size]);
|
|
7
7
|
var _b = RcOutlineTextFieldSpaces[size], inside = _b.inside, outside = _b.outside, insideLeft = _b.insideLeft;
|
|
8
8
|
var labelMargin = RcOutlineTextFieldLabelMargins[size];
|
|
9
9
|
var typographyToken = RcOutlineTextFieldFontStyles[size];
|
|
10
10
|
var currRadius = radiusFn(radius);
|
|
11
|
+
var borderColor = getParsePaletteColor(colorProp, palette2('neutral', 'l03'));
|
|
12
|
+
var focusBorderColor = getParsePaletteColor(colorProp, palette2('interactive', 'f01'));
|
|
11
13
|
// `-webkit-tap-highlight-color` for cover background color, prevent color be cover by browser
|
|
12
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .", " {\n ", ";\n }\n\n ", ";\n\n * + .", " {\n margin-left: ", ";\n }\n\n &.", " {\n label + .", " {\n margin-top: ", ";\n }\n }\n\n .", " {\n -webkit-tap-highlight-color: transparent;\n height: ", ";\n min-height: ", ";\n background: ", ";\n padding: ", ";\n border-radius: ", ";\n\n &:before {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-radius: ", ";\n transition: none;\n border-bottom: none !important;\n pointer-events: none;\n ", ";\n }\n\n &:not(.", "):not(.", "):hover {\n background: ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n background: ", ";\n &:before {\n ", ";\n }\n }\n "], ["\n .", " {\n ", ";\n }\n\n ", ";\n\n * + .", " {\n margin-left: ", ";\n }\n\n &.", " {\n label + .", " {\n margin-top: ", ";\n }\n }\n\n .", " {\n -webkit-tap-highlight-color: transparent;\n height: ", ";\n min-height: ", ";\n background: ", ";\n padding: ", ";\n border-radius: ", ";\n\n &:before {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-radius: ", ";\n transition: none;\n border-bottom: none !important;\n pointer-events: none;\n ", ";\n }\n\n &:not(.", "):not(.", "):hover {\n background: ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n background: ", ";\n &:before {\n ", ";\n }\n }\n "])), RcOutlineTextFieldInputClasses.input, typography(typographyToken), belowIconButtonSpacing(spacing(inside)), RcOutlineTextFieldInputClasses.input, spacing(insideLeft || inside), RcTextFieldClasses.root, RcOutlineTextFieldInputClasses.root, spacing(labelMargin), RcOutlineTextFieldInputClasses.root, height, height, palette2('neutral', 'b01'), spacing(outside), currRadius, currRadius, fakeBorder({ color:
|
|
14
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .", " {\n ", ";\n }\n\n ", ";\n\n * + .", " {\n margin-left: ", ";\n }\n\n &.", " {\n label + .", " {\n margin-top: ", ";\n }\n }\n\n .", " {\n -webkit-tap-highlight-color: transparent;\n height: ", ";\n min-height: ", ";\n background: ", ";\n padding: ", ";\n border-radius: ", ";\n\n &:before {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-radius: ", ";\n transition: none;\n border-bottom: none !important;\n pointer-events: none;\n ", ";\n }\n\n &:not(.", "):not(.", "):hover {\n background: ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n background: ", ";\n &:before {\n ", ";\n }\n }\n "], ["\n .", " {\n ", ";\n }\n\n ", ";\n\n * + .", " {\n margin-left: ", ";\n }\n\n &.", " {\n label + .", " {\n margin-top: ", ";\n }\n }\n\n .", " {\n -webkit-tap-highlight-color: transparent;\n height: ", ";\n min-height: ", ";\n background: ", ";\n padding: ", ";\n border-radius: ", ";\n\n &:before {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-radius: ", ";\n transition: none;\n border-bottom: none !important;\n pointer-events: none;\n ", ";\n }\n\n &:not(.", "):not(.", "):hover {\n background: ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n background: ", ";\n &:before {\n ", ";\n }\n }\n "])), RcOutlineTextFieldInputClasses.input, typography(typographyToken), belowIconButtonSpacing(spacing(inside)), RcOutlineTextFieldInputClasses.input, spacing(insideLeft || inside), RcTextFieldClasses.root, RcOutlineTextFieldInputClasses.root, spacing(labelMargin), RcOutlineTextFieldInputClasses.root, height, height, palette2('neutral', 'b01'), spacing(outside), currRadius, currRadius, fakeBorder({ color: borderColor }), RcOutlineTextFieldInputClasses.focused, RcOutlineTextFieldInputClasses.disabled, palette2('neutral', 'b02'), RcOutlineTextFieldInputClasses.focused, fakeBorder({ color: focusBorderColor }), RcOutlineTextFieldInputClasses.error, fakeBorder({ color: palette2('danger', 'f02') }), RcOutlineTextFieldInputClasses.disabled, palette2('neutral', 'b03'), fakeBorder({ color: palette2('disabled', 'f02') }));
|
|
13
15
|
};
|
|
14
16
|
var templateObject_1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { css, isFilled, nonTouchHoverMedia, palette2, px, spacing, typography, } from '../../../../foundation';
|
|
2
|
+
import { css, getParsePaletteColor, isFilled, nonTouchHoverMedia, palette2, px, spacing, typography, } from '../../../../foundation';
|
|
3
3
|
import { RcIconButtonSizes } from '../../../Buttons/IconButton/utils';
|
|
4
4
|
import { belowIconButtonSpacing, RcTextFieldClasses, RcTextFieldFormHelperTextClasses, RcTextFieldInputClasses, RcTextFieldInputLabelClasses, } from '../utils';
|
|
5
5
|
import { ClearIconButton } from './ClearIconButton';
|
|
@@ -14,13 +14,17 @@ export var RcDefaultTextFieldWidth = '168px';
|
|
|
14
14
|
var focusWithNotDisabled = "." + RcTextFieldInputClasses.root + ":hover:not(." + RcTextFieldInputClasses.disabled + ")";
|
|
15
15
|
var TextFieldInputHoverFocusStyle = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", " {\n display: inline-flex;\n }\n"], ["\n ", " {\n display: inline-flex;\n }\n"])), ClearIconButton);
|
|
16
16
|
export var clearBtnInactiveStyle = css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", " {\n ", " {\n ", "\n }\n }\n\n .", " {\n ", "\n }\n"], ["\n ", " {\n ", " {\n ", "\n }\n }\n\n .", " {\n ", "\n }\n"])), nonTouchHoverMedia, focusWithNotDisabled, TextFieldInputHoverFocusStyle, RcTextFieldInputClasses.focused, TextFieldInputHoverFocusStyle);
|
|
17
|
-
export var TextFieldStyle = function (
|
|
18
|
-
var value =
|
|
17
|
+
export var TextFieldStyle = function (props) {
|
|
18
|
+
var value = props.value, variant = props.variant, fullWidth = props.fullWidth, clearBtn = props.clearBtn, size = props.size, textVariant = props.textVariant, gutterBottom = props.gutterBottom, align = props.align, colorProp = props.color;
|
|
19
19
|
var showClean = isFilled({ value: value });
|
|
20
|
+
var color = getParsePaletteColor(colorProp, palette2('interactive', 'f01'));
|
|
21
|
+
var labelRootColor = getParsePaletteColor(colorProp, idleColor);
|
|
22
|
+
var underlineColor = getParsePaletteColor(colorProp, palette2('neutral', 'f02'));
|
|
23
|
+
var underlineFocusColor = getParsePaletteColor(colorProp, palette2('neutral', 'f06'));
|
|
20
24
|
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", ";\n\n width: ", ";\n\n ", ";\n\n .", " {\n ", ";\n color: ", ";\n transform: scale(1);\n }\n\n .", " {\n color: ", ";\n }\n\n .", " {\n color: ", ";\n\n ", " {\n display: none;\n }\n }\n\n ", ";\n\n .", " {\n ", ";\n text-align: ", ";\n\n ::placeholder {\n color: ", ";\n opacity: 1;\n }\n\n ", ";\n }\n\n .", " {\n &:before {\n border-bottom-color: ", ";\n }\n\n ", " {\n &:hover:not(.", ") {\n &:before {\n border-bottom-color: ", ";\n }\n }\n }\n\n &:after {\n border-bottom-color: ", ";\n }\n }\n\n .", " {\n &:after {\n border-bottom-color: ", ";\n }\n }\n\n .", " {\n color: ", ";\n // * safari need that in disabled input\n -webkit-text-fill-color: ", ";\n ::placeholder {\n color: ", ";\n }\n &:before {\n border-bottom-style: solid;\n border-bottom-color: ", ";\n }\n &:after {\n border-bottom-style: none;\n }\n }\n\n .", " {\n ", ";\n color: ", ";\n }\n\n .", ",\n .", " {\n color: ", ";\n }\n\n .", ",\n .", " {\n color: ", ";\n }\n\n /* clears the 'X' from Internet Explorer */\n input[type='search']::-ms-clear,\n input[type='search']::-ms-reveal {\n display: none;\n width: 0;\n height: 0;\n }\n\n /* clears the 'X' from Chrome */\n input[type='search']::-webkit-search-decoration,\n input[type='search']::-webkit-search-cancel-button,\n input[type='search']::-webkit-search-results-button,\n input[type='search']::-webkit-search-results-decoration {\n display: none;\n }\n\n ", "\n "], ["\n ", ";\n\n width: ", ";\n\n ",
|
|
21
25
|
";\n\n .", " {\n ", ";\n color: ", ";\n transform: scale(1);\n }\n\n .", " {\n color: ", ";\n }\n\n .", " {\n color: ", ";\n\n ", " {\n display: none;\n }\n }\n\n ", ";\n\n .", " {\n ", ";\n text-align: ", ";\n\n ::placeholder {\n color: ", ";\n opacity: 1;\n }\n\n ",
|
|
22
|
-
";\n }\n\n .", " {\n &:before {\n border-bottom-color: ", ";\n }\n\n ", " {\n &:hover:not(.", ") {\n &:before {\n border-bottom-color: ", ";\n }\n }\n }\n\n &:after {\n border-bottom-color: ", ";\n }\n }\n\n .", " {\n &:after {\n border-bottom-color: ", ";\n }\n }\n\n .", " {\n color: ", ";\n // * safari need that in disabled input\n -webkit-text-fill-color: ", ";\n ::placeholder {\n color: ", ";\n }\n &:before {\n border-bottom-style: solid;\n border-bottom-color: ", ";\n }\n &:after {\n border-bottom-style: none;\n }\n }\n\n .", " {\n ", ";\n color: ", ";\n }\n\n .", ",\n .", " {\n color: ", ";\n }\n\n .", ",\n .", " {\n color: ", ";\n }\n\n /* clears the 'X' from Internet Explorer */\n input[type='search']::-ms-clear,\n input[type='search']::-ms-reveal {\n display: none;\n width: 0;\n height: 0;\n }\n\n /* clears the 'X' from Chrome */\n input[type='search']::-webkit-search-decoration,\n input[type='search']::-webkit-search-cancel-button,\n input[type='search']::-webkit-search-results-button,\n input[type='search']::-webkit-search-results-decoration {\n display: none;\n }\n\n ", "\n "])), belowIconButtonSpacing(spacing(3)), !fullWidth && RcDefaultTextFieldWidth, gutterBottom && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n &.", " {\n margin: 0 0 ", " 0;\n }\n "], ["\n &.", " {\n margin: 0 0 ", " 0;\n }\n "])), RcTextFieldClasses.root, spacing(4)), RcTextFieldInputLabelClasses.root, typography('caption2'),
|
|
26
|
+
";\n }\n\n .", " {\n &:before {\n border-bottom-color: ", ";\n }\n\n ", " {\n &:hover:not(.", ") {\n &:before {\n border-bottom-color: ", ";\n }\n }\n }\n\n &:after {\n border-bottom-color: ", ";\n }\n }\n\n .", " {\n &:after {\n border-bottom-color: ", ";\n }\n }\n\n .", " {\n color: ", ";\n // * safari need that in disabled input\n -webkit-text-fill-color: ", ";\n ::placeholder {\n color: ", ";\n }\n &:before {\n border-bottom-style: solid;\n border-bottom-color: ", ";\n }\n &:after {\n border-bottom-style: none;\n }\n }\n\n .", " {\n ", ";\n color: ", ";\n }\n\n .", ",\n .", " {\n color: ", ";\n }\n\n .", ",\n .", " {\n color: ", ";\n }\n\n /* clears the 'X' from Internet Explorer */\n input[type='search']::-ms-clear,\n input[type='search']::-ms-reveal {\n display: none;\n width: 0;\n height: 0;\n }\n\n /* clears the 'X' from Chrome */\n input[type='search']::-webkit-search-decoration,\n input[type='search']::-webkit-search-cancel-button,\n input[type='search']::-webkit-search-results-button,\n input[type='search']::-webkit-search-results-decoration {\n display: none;\n }\n\n ", "\n "])), belowIconButtonSpacing(spacing(3)), !fullWidth && RcDefaultTextFieldWidth, gutterBottom && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n &.", " {\n margin: 0 0 ", " 0;\n }\n "], ["\n &.", " {\n margin: 0 0 ", " 0;\n }\n "])), RcTextFieldClasses.root, spacing(4)), RcTextFieldInputLabelClasses.root, typography('caption2'), labelRootColor, RcTextFieldInputLabelClasses.focused, color, RcTextFieldInputClasses.root, textColor, ClearIconButton, showClean && clearBtnInactiveStyle, RcTextFieldInputClasses.input, typography(variant === 'borderLess' ? textVariant : 'subheading1'), align, placeholderColor, clearBtn &&
|
|
23
27
|
align &&
|
|
24
|
-
align !== 'left' && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: calc(100% - ", ");\n "], ["\n width: calc(100% - ", ");\n "])), px(RcIconButtonSizes[size])), RcTextFieldInputClasses.underline,
|
|
28
|
+
align !== 'left' && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: calc(100% - ", ");\n "], ["\n width: calc(100% - ", ");\n "])), px(RcIconButtonSizes[size])), RcTextFieldInputClasses.underline, underlineColor, nonTouchHoverMedia, RcTextFieldInputClasses.disabled, underlineFocusColor, color, RcTextFieldInputClasses.error, errorColor, RcTextFieldInputClasses.disabled, disabledColor, disabledColor, disabledColor, disabledColor, RcTextFieldFormHelperTextClasses.root, typography('caption1'), idleColor, RcTextFieldFormHelperTextClasses.error, RcTextFieldInputLabelClasses.error, errorTextColor, RcTextFieldFormHelperTextClasses.disabled, RcTextFieldInputLabelClasses.disabled, disabledColor, variant === 'outline' && OutlineTextFieldStyle);
|
|
25
29
|
};
|
|
26
30
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -178,7 +178,7 @@ var _RcSubMenu = forwardRef(function (inProps, ref) {
|
|
|
178
178
|
title,
|
|
179
179
|
React.createElement(StyledListItemSecondaryAction, null,
|
|
180
180
|
React.createElement(RcIcon, { size: "medium", color: "neutral.f04", symbol: ArrowRight }))),
|
|
181
|
-
React.createElement(RcPopper, __assign({ role: "menu", id: popperId, container: externalWindow === null || externalWindow === void 0 ? void 0 : externalWindow.document.body }, restPopperProps, { ref: popperRef, open: open, anchorEl: anchorEl, transition: true,
|
|
181
|
+
React.createElement(RcPopper, __assign({ role: "menu", id: popperId, container: externalWindow === null || externalWindow === void 0 ? void 0 : externalWindow.document.body, placement: "right-start" }, restPopperProps, { ref: popperRef, open: open, anchorEl: anchorEl, transition: true, modifiers: modifiers, onKeyDown: handlePopperKeyDown, onMouseLeave: handlePopperMouseLeave }), function (_a) {
|
|
182
182
|
var TransitionProps = _a.TransitionProps;
|
|
183
183
|
return (React.createElement(StyledGrow, __assign({}, TransitionProps, { timeout: "auto" }),
|
|
184
184
|
React.createElement(RcPaper, null,
|
|
@@ -148,7 +148,7 @@ var PortalManager = /** @class */ (function (_super) {
|
|
|
148
148
|
/**
|
|
149
149
|
* update props by id, equal 'portalController.updateProps(newProps)'
|
|
150
150
|
*/
|
|
151
|
-
PortalManager.prototype.updatePropsByID = function (id,
|
|
151
|
+
PortalManager.prototype.updatePropsByID = function (id, propsOrHandler) {
|
|
152
152
|
var portal = this.portalStore.get(id);
|
|
153
153
|
if (!(portal === null || portal === void 0 ? void 0 : portal.open)) {
|
|
154
154
|
logInDev({
|
|
@@ -157,6 +157,12 @@ var PortalManager = /** @class */ (function (_super) {
|
|
|
157
157
|
});
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
+
var props = (function () {
|
|
161
|
+
if (typeof propsOrHandler === 'function') {
|
|
162
|
+
return propsOrHandler(portal.props);
|
|
163
|
+
}
|
|
164
|
+
return propsOrHandler;
|
|
165
|
+
})();
|
|
160
166
|
this.portalStore.addOrUpdate(__assign(__assign({}, portal), { props: props }));
|
|
161
167
|
};
|
|
162
168
|
PortalManager.prototype.onConnected = function () {
|
|
@@ -187,8 +193,8 @@ var PortalManager = /** @class */ (function (_super) {
|
|
|
187
193
|
close: function (feedback) {
|
|
188
194
|
_this.closeByID(id, feedback);
|
|
189
195
|
},
|
|
190
|
-
updateProps: function (
|
|
191
|
-
_this.updatePropsByID(id,
|
|
196
|
+
updateProps: function (propsOrHandler) {
|
|
197
|
+
_this.updatePropsByID(id, propsOrHandler);
|
|
192
198
|
},
|
|
193
199
|
data: data,
|
|
194
200
|
get isOpened() {
|
package/es6/foundation/config.js
CHANGED
|
@@ -7,11 +7,14 @@ var RcConfig = /** @class */ (function () {
|
|
|
7
7
|
this._WARNING_FUNCTION = function (message, options) {
|
|
8
8
|
console[(options === null || options === void 0 ? void 0 : options.level) || 'warn'](message);
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
if (typeof window !== 'undefined') {
|
|
11
|
+
// SSR support
|
|
12
|
+
// * get value once when init
|
|
13
|
+
this._WARNING_IGNORE =
|
|
14
|
+
((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.getItem(JUNO_WARNING_IGNORE_KEY)) === 'true';
|
|
15
|
+
// * also provide user to set variable from window
|
|
16
|
+
window.__JUNO__ = this;
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
Object.defineProperty(RcConfig.prototype, "WARNING_IGNORE", {
|
|
17
20
|
get: function () {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createContext, useContext } from 'react';
|
|
2
2
|
var RcPortalWindowContext = createContext({
|
|
3
|
-
document:
|
|
3
|
+
document:
|
|
4
|
+
// directly access `document` will cause error in next.js
|
|
5
|
+
typeof globalThis !== 'undefined' ? globalThis.document : window.document,
|
|
4
6
|
});
|
|
5
7
|
var useRcPortalWindowContext = function () { return useContext(RcPortalWindowContext); };
|
|
6
8
|
export { RcPortalWindowContext, useRcPortalWindowContext };
|
|
@@ -3,6 +3,13 @@ import { useId } from '../useId';
|
|
|
3
3
|
export var visuallyHiddenStyles = "\n clip-path: inset(100%);\n clip: rect(1px, 1px, 1px, 1px);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n";
|
|
4
4
|
/**
|
|
5
5
|
* read announce when need read message.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const announce = useAnnouncer('simpleId');
|
|
10
|
+
*
|
|
11
|
+
* announce(`You click "Announce" button`);
|
|
12
|
+
* ```
|
|
6
13
|
*/
|
|
7
14
|
export var useAnnouncer = function (id) {
|
|
8
15
|
var _id = useId(id ? "rc-announcer-" + id : 'rc-announcer', !id);
|
|
@@ -56,7 +56,8 @@ export var useKeyboardMoveFocus = function (_a) {
|
|
|
56
56
|
// * mean that item is disabled, use same direction find next
|
|
57
57
|
else {
|
|
58
58
|
// * find toIndex is same as current, mean that already find all
|
|
59
|
-
if (
|
|
59
|
+
if (focusedIndexRef.current !== -1 &&
|
|
60
|
+
toIndex === Math.max(focusedIndexRef.current, 0)) {
|
|
60
61
|
break;
|
|
61
62
|
}
|
|
62
63
|
currIndex = toIndex;
|
package/foundation/config.js
CHANGED
|
@@ -9,11 +9,14 @@ var RcConfig = /** @class */ (function () {
|
|
|
9
9
|
this._WARNING_FUNCTION = function (message, options) {
|
|
10
10
|
console[(options === null || options === void 0 ? void 0 : options.level) || 'warn'](message);
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
if (typeof window !== 'undefined') {
|
|
13
|
+
// SSR support
|
|
14
|
+
// * get value once when init
|
|
15
|
+
this._WARNING_IGNORE =
|
|
16
|
+
((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.getItem(JUNO_WARNING_IGNORE_KEY)) === 'true';
|
|
17
|
+
// * also provide user to set variable from window
|
|
18
|
+
window.__JUNO__ = this;
|
|
19
|
+
}
|
|
17
20
|
}
|
|
18
21
|
Object.defineProperty(RcConfig.prototype, "WARNING_IGNORE", {
|
|
19
22
|
get: function () {
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var react_1 = require("react");
|
|
4
4
|
var RcPortalWindowContext = react_1.createContext({
|
|
5
|
-
document:
|
|
5
|
+
document:
|
|
6
|
+
// directly access `document` will cause error in next.js
|
|
7
|
+
typeof globalThis !== 'undefined' ? globalThis.document : window.document,
|
|
6
8
|
});
|
|
7
9
|
exports.RcPortalWindowContext = RcPortalWindowContext;
|
|
8
10
|
var useRcPortalWindowContext = function () { return react_1.useContext(RcPortalWindowContext); };
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
export declare const visuallyHiddenStyles = "\n clip-path: inset(100%);\n clip: rect(1px, 1px, 1px, 1px);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n";
|
|
2
2
|
/**
|
|
3
3
|
* read announce when need read message.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const announce = useAnnouncer('simpleId');
|
|
8
|
+
*
|
|
9
|
+
* announce(`You click "Announce" button`);
|
|
10
|
+
* ```
|
|
4
11
|
*/
|
|
5
12
|
export declare const useAnnouncer: (id?: string | undefined) => (message?: string | undefined) => void;
|
|
@@ -5,6 +5,13 @@ var useId_1 = require("../useId");
|
|
|
5
5
|
exports.visuallyHiddenStyles = "\n clip-path: inset(100%);\n clip: rect(1px, 1px, 1px, 1px);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n";
|
|
6
6
|
/**
|
|
7
7
|
* read announce when need read message.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const announce = useAnnouncer('simpleId');
|
|
12
|
+
*
|
|
13
|
+
* announce(`You click "Announce" button`);
|
|
14
|
+
* ```
|
|
8
15
|
*/
|
|
9
16
|
exports.useAnnouncer = function (id) {
|
|
10
17
|
var _id = useId_1.useId(id ? "rc-announcer-" + id : 'rc-announcer', !id);
|
|
@@ -58,7 +58,8 @@ exports.useKeyboardMoveFocus = function (_a) {
|
|
|
58
58
|
// * mean that item is disabled, use same direction find next
|
|
59
59
|
else {
|
|
60
60
|
// * find toIndex is same as current, mean that already find all
|
|
61
|
-
if (
|
|
61
|
+
if (focusedIndexRef.current !== -1 &&
|
|
62
|
+
toIndex === Math.max(focusedIndexRef.current, 0)) {
|
|
62
63
|
break;
|
|
63
64
|
}
|
|
64
65
|
currIndex = toIndex;
|