@onesy/ui-react 1.0.126 → 1.0.128
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/BottomAppBar/BottomAppBar.js +17 -155
- package/NavigationItem/NavigationItem.d.ts +3 -2
- package/NavigationItem/NavigationItem.js +12 -35
- package/TextField/TextField.js +8 -5
- package/esm/BottomAppBar/BottomAppBar.js +25 -164
- package/esm/NavigationItem/NavigationItem.js +14 -35
- package/esm/TextField/TextField.js +6 -3
- package/esm/index.js +1 -1
- package/package.json +1 -1
|
@@ -19,81 +19,27 @@ const react_1 = __importDefault(require("react"));
|
|
|
19
19
|
const style_react_1 = require("@onesy/style-react");
|
|
20
20
|
const Line_1 = __importDefault(require("../Line"));
|
|
21
21
|
const Surface_1 = __importDefault(require("../Surface"));
|
|
22
|
-
const Transition_1 = __importDefault(require("../Transition"));
|
|
23
22
|
const utils_1 = require("../utils");
|
|
24
23
|
const useStyle = (0, style_react_1.style)(theme => ({
|
|
25
24
|
root: {
|
|
25
|
+
background: theme.palette.color.primary[theme.palette.light ? 100 : 5],
|
|
26
|
+
boxShadow: '0px 8px 10px 1px rgb(0 0 0 / 1%), 0px 3px 14px 2px rgb(0 0 0 / 1%), 0px 5px 5px -3px rgb(0 0 0 / 4%)',
|
|
27
|
+
borderRadius: '500px',
|
|
26
28
|
zIndex: theme.z_index.app_bar,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
overflow: 'auto hidden',
|
|
30
|
+
'&::-webkit-scrollbar': {
|
|
31
|
+
width: '0px',
|
|
32
|
+
height: '0px'
|
|
33
|
+
}
|
|
31
34
|
},
|
|
32
|
-
size_small: {
|
|
33
|
-
size_regular: {
|
|
34
|
-
size_large: {
|
|
35
|
+
size_small: { padding: '6px 10px' },
|
|
36
|
+
size_regular: { padding: '12px 20px' },
|
|
37
|
+
size_large: { padding: '18px 30px' },
|
|
35
38
|
fixed: {
|
|
36
39
|
position: 'fixed',
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
item: {
|
|
41
|
-
opacity: '0',
|
|
42
|
-
transform: 'translateY(100%)',
|
|
43
|
-
transition: theme === null || theme === void 0 ? void 0 : theme.methods.transitions.make(['opacity', 'transform'], { duration: 'rg', timing_function: 'standard' }),
|
|
44
|
-
'&.enter': {
|
|
45
|
-
opacity: '0',
|
|
46
|
-
transform: 'translateY(100%)'
|
|
47
|
-
},
|
|
48
|
-
'&.entering': {
|
|
49
|
-
opacity: '1',
|
|
50
|
-
transform: 'translateY(0%)'
|
|
51
|
-
},
|
|
52
|
-
'&.entered': {
|
|
53
|
-
opacity: '1',
|
|
54
|
-
transform: 'translateY(0%)'
|
|
55
|
-
},
|
|
56
|
-
'&.exit': {
|
|
57
|
-
opacity: '1',
|
|
58
|
-
transform: 'translateY(0%)'
|
|
59
|
-
},
|
|
60
|
-
'&.exiting': {
|
|
61
|
-
opacity: '0',
|
|
62
|
-
transform: 'translateY(0%)'
|
|
63
|
-
},
|
|
64
|
-
'&.exited': {
|
|
65
|
-
opacity: '0',
|
|
66
|
-
transform: 'translateY(0%)'
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
mainItem: {
|
|
70
|
-
opacity: '0',
|
|
71
|
-
transform: 'scale(0.75)',
|
|
72
|
-
transition: theme === null || theme === void 0 ? void 0 : theme.methods.transitions.make(['opacity', 'transform'], { duration: 'rg', timing_function: 'standard' }),
|
|
73
|
-
'&.enter': {
|
|
74
|
-
opacity: '0',
|
|
75
|
-
transform: 'scale(0.75)'
|
|
76
|
-
},
|
|
77
|
-
'&.entering': {
|
|
78
|
-
opacity: '1',
|
|
79
|
-
transform: 'scale(1)'
|
|
80
|
-
},
|
|
81
|
-
'&.entered': {
|
|
82
|
-
opacity: '1',
|
|
83
|
-
transform: 'scale(1)'
|
|
84
|
-
},
|
|
85
|
-
'&.exit': {
|
|
86
|
-
opacity: '1',
|
|
87
|
-
transform: 'scale(1)'
|
|
88
|
-
},
|
|
89
|
-
'&.exiting': {
|
|
90
|
-
opacity: '0',
|
|
91
|
-
transform: 'scale(1)'
|
|
92
|
-
},
|
|
93
|
-
'&.exited': {
|
|
94
|
-
opacity: '0',
|
|
95
|
-
transform: 'scale(1)'
|
|
96
|
-
}
|
|
40
|
+
bottom: '12px',
|
|
41
|
+
left: '50%',
|
|
42
|
+
transform: 'translateX(-50%)'
|
|
97
43
|
}
|
|
98
44
|
}), { name: 'onesy-BottomAppBar' });
|
|
99
45
|
const BottomAppBar = react_1.default.forwardRef((props_, ref) => {
|
|
@@ -101,89 +47,9 @@ const BottomAppBar = react_1.default.forwardRef((props_, ref) => {
|
|
|
101
47
|
const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyBottomAppBar) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
|
|
102
48
|
const Line = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Line) || Line_1.default; }, [theme]);
|
|
103
49
|
const Surface = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Surface) || Surface_1.default; }, [theme]);
|
|
104
|
-
const
|
|
105
|
-
const { tonal = true, color = 'primary', size = 'regular', main: main_, fixed, noTransition, className, children: children_ } = props, other = __rest(props, ["tonal", "color", "size", "main", "fixed", "noTransition", "className", "children"]);
|
|
50
|
+
const { tonal = true, color = 'default', size = 'regular', fixed = true, className, children, style } = props, other = __rest(props, ["tonal", "color", "size", "fixed", "className", "children", "style"]);
|
|
106
51
|
const { classes } = useStyle();
|
|
107
|
-
|
|
108
|
-
return react_1.default.Children
|
|
109
|
-
.toArray(values)
|
|
110
|
-
.map((item, index) => ((0, jsx_runtime_1.jsx)(Transition, Object.assign({ onRemoved: () => {
|
|
111
|
-
if (index === 0)
|
|
112
|
-
reAddChildren();
|
|
113
|
-
}, removeOnExited: true }, { children: (status) => (react_1.default.cloneElement(item, {
|
|
114
|
-
className: (0, style_react_1.classNames)([
|
|
115
|
-
classes.item,
|
|
116
|
-
status
|
|
117
|
-
]),
|
|
118
|
-
elevation: item.props.elevation !== undefined ? item.props.elevation : false,
|
|
119
|
-
version: item.props.version !== undefined ? item.props.version : 'filled',
|
|
120
|
-
color: item.props.color !== undefined ? item.props.color : color,
|
|
121
|
-
tonal: item.props.tonal !== undefined ? item.props.tonal : tonal,
|
|
122
|
-
style: Object.assign(Object.assign({}, item.props.style), (status.includes('enter') && {
|
|
123
|
-
transitionDelay: `${index * 70}ms`
|
|
124
|
-
}))
|
|
125
|
-
})) }), index)));
|
|
126
|
-
};
|
|
127
|
-
const makeMain = (values) => {
|
|
128
|
-
return react_1.default.Children
|
|
129
|
-
.toArray(values)
|
|
130
|
-
.map((item, index) => ((0, jsx_runtime_1.jsx)(Transition, Object.assign({ onRemoved: () => {
|
|
131
|
-
if (index === 0)
|
|
132
|
-
reAddMain();
|
|
133
|
-
}, removeOnExited: true }, { children: (status) => {
|
|
134
|
-
var _a;
|
|
135
|
-
return (react_1.default.cloneElement(item, {
|
|
136
|
-
className: (0, style_react_1.classNames)([
|
|
137
|
-
classes.mainItem,
|
|
138
|
-
status
|
|
139
|
-
]),
|
|
140
|
-
color: item.props.color !== undefined ? item.props.color : color,
|
|
141
|
-
tonal: item.props.tonal !== undefined ? item.props.tonal : tonal && ['onesy-Fab'].includes((_a = item.type) === null || _a === void 0 ? void 0 : _a.displayName) ? 'secondary' : tonal
|
|
142
|
-
}));
|
|
143
|
-
} }), index)));
|
|
144
|
-
};
|
|
145
|
-
const [init, setInit] = react_1.default.useState(false);
|
|
146
|
-
const [children, setChildren] = react_1.default.useState(() => makeChildren(children_));
|
|
147
|
-
const [main, setMain] = react_1.default.useState(() => makeMain(main_));
|
|
148
|
-
const [inProp, setInProp] = react_1.default.useState(true);
|
|
149
|
-
const refs = {
|
|
150
|
-
preChildren: react_1.default.useRef(undefined),
|
|
151
|
-
preMain: react_1.default.useRef(undefined)
|
|
152
|
-
};
|
|
153
|
-
react_1.default.useEffect(() => {
|
|
154
|
-
setInit(true);
|
|
155
|
-
}, []);
|
|
156
|
-
const reAddChildren = () => {
|
|
157
|
-
setChildren(makeChildren(refs.preChildren.current));
|
|
158
|
-
setInProp(true);
|
|
159
|
-
refs.preChildren.current = undefined;
|
|
160
|
-
};
|
|
161
|
-
const reAddMain = () => {
|
|
162
|
-
setMain(makeMain(refs.preMain.current));
|
|
163
|
-
setInProp(true);
|
|
164
|
-
refs.preMain.current = undefined;
|
|
165
|
-
};
|
|
166
|
-
react_1.default.useEffect(() => {
|
|
167
|
-
if (init) {
|
|
168
|
-
if (!noTransition) {
|
|
169
|
-
refs.preChildren.current = children_;
|
|
170
|
-
setInProp(false);
|
|
171
|
-
}
|
|
172
|
-
else
|
|
173
|
-
setChildren(makeChildren(children_));
|
|
174
|
-
}
|
|
175
|
-
}, [react_1.default.Children.toArray(children_).map((item) => item.key).join('')]);
|
|
176
|
-
react_1.default.useEffect(() => {
|
|
177
|
-
if (init) {
|
|
178
|
-
if (!noTransition) {
|
|
179
|
-
refs.preMain.current = main_;
|
|
180
|
-
setInProp(false);
|
|
181
|
-
}
|
|
182
|
-
else
|
|
183
|
-
setMain(makeMain(main_));
|
|
184
|
-
}
|
|
185
|
-
}, [react_1.default.Children.toArray(main_).map((item) => item.key).join('')]);
|
|
186
|
-
return ((0, jsx_runtime_1.jsxs)(Surface, Object.assign({ ref: ref, color: color, tonal: tonal, gap: 4, direction: 'row', align: 'center', justify: 'space-between', Component: Line, className: (0, style_react_1.classNames)([
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(Surface, Object.assign({ ref: ref, color: color, tonal: tonal, gap: 4, direction: 'row', align: 'center', justify: 'space-between', fullWidth: true, Component: Line, className: (0, style_react_1.classNames)([
|
|
187
53
|
(0, utils_1.staticClassName)('BottomAppBar', theme) && [
|
|
188
54
|
'onesy-BottomAppBar-root',
|
|
189
55
|
`onesy-BottomAppBar-size-${size}`
|
|
@@ -192,11 +58,7 @@ const BottomAppBar = react_1.default.forwardRef((props_, ref) => {
|
|
|
192
58
|
classes.root,
|
|
193
59
|
classes[`size_${size}`],
|
|
194
60
|
fixed && classes.fixed
|
|
195
|
-
])
|
|
196
|
-
in: inProp
|
|
197
|
-
}))) }))), !!main.length && ((0, jsx_runtime_1.jsx)(Line, Object.assign({ direction: 'row', align: 'center', justify: 'flex-end' }, { children: main.map((item) => (react_1.default.cloneElement(item, {
|
|
198
|
-
in: inProp
|
|
199
|
-
}))) })))] })));
|
|
61
|
+
]), style: Object.assign({ minWidth: `clamp(100px, ${((children === null || children === void 0 ? void 0 : children.length) || 3) * 110}px, calc(100vw - 24px))` }, style) }, other, { children: children })));
|
|
200
62
|
});
|
|
201
63
|
BottomAppBar.displayName = 'onesy-BottomAppBar';
|
|
202
64
|
exports.default = BottomAppBar;
|
|
@@ -5,9 +5,9 @@ export declare type INavigationItemVersion = 'regular' | 'auto';
|
|
|
5
5
|
export declare type INavigationItem = ITooltip & {
|
|
6
6
|
version?: 'regular' | 'auto';
|
|
7
7
|
value?: any;
|
|
8
|
-
vertical?: boolean;
|
|
9
8
|
name?: IElement;
|
|
10
|
-
|
|
9
|
+
nameTooltip?: any;
|
|
10
|
+
vertical?: boolean;
|
|
11
11
|
icon?: IElement;
|
|
12
12
|
iconSelected?: IElement;
|
|
13
13
|
selected?: boolean;
|
|
@@ -21,6 +21,7 @@ export declare type INavigationItem = ITooltip & {
|
|
|
21
21
|
onMouseLeave?: (event: React.MouseEvent<any>) => any;
|
|
22
22
|
onTouchStart?: (event: React.TouchEvent<any>) => any;
|
|
23
23
|
TooltipProps?: IPropsAny;
|
|
24
|
+
LabelProps?: IPropsAny;
|
|
24
25
|
IconWrapperProps?: IPropsAny;
|
|
25
26
|
};
|
|
26
27
|
declare const NavigationItem: React.FC<INavigationItem>;
|
|
@@ -19,7 +19,6 @@ const react_1 = __importDefault(require("react"));
|
|
|
19
19
|
const utils_1 = require("@onesy/utils");
|
|
20
20
|
const style_react_1 = require("@onesy/style-react");
|
|
21
21
|
const Type_1 = __importDefault(require("../Type"));
|
|
22
|
-
const Fade_1 = __importDefault(require("../Fade"));
|
|
23
22
|
const Line_1 = __importDefault(require("../Line"));
|
|
24
23
|
const Tooltip_1 = __importDefault(require("../Tooltip"));
|
|
25
24
|
const Transition_1 = __importDefault(require("../Transition"));
|
|
@@ -41,8 +40,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
|
41
40
|
width: '100%'
|
|
42
41
|
},
|
|
43
42
|
iconWrapper: {
|
|
44
|
-
position: '
|
|
45
|
-
top: '0',
|
|
43
|
+
position: 'relative',
|
|
46
44
|
height: '32px',
|
|
47
45
|
width: '64px'
|
|
48
46
|
},
|
|
@@ -58,14 +56,6 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
|
58
56
|
icon: {
|
|
59
57
|
lineHeight: '0'
|
|
60
58
|
},
|
|
61
|
-
labelWrapper: {
|
|
62
|
-
position: 'absolute',
|
|
63
|
-
bottom: '0'
|
|
64
|
-
},
|
|
65
|
-
label: {
|
|
66
|
-
position: 'absolute',
|
|
67
|
-
bottom: '0'
|
|
68
|
-
},
|
|
69
59
|
indicator: {
|
|
70
60
|
position: 'absolute',
|
|
71
61
|
inset: '0',
|
|
@@ -114,15 +104,14 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
|
114
104
|
}
|
|
115
105
|
}), { name: 'onesy-NavigationItem' });
|
|
116
106
|
const NavigationItem = react_1.default.forwardRef((props_, ref) => {
|
|
117
|
-
var _a;
|
|
107
|
+
var _a, _b;
|
|
118
108
|
const theme = (0, style_react_1.useOnesyTheme)();
|
|
119
109
|
const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyNavigationItem) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
|
|
120
110
|
const Line = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Line) || Line_1.default; }, [theme]);
|
|
121
111
|
const Type = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Type) || Type_1.default; }, [theme]);
|
|
122
|
-
const Fade = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Fade) || Fade_1.default; }, [theme]);
|
|
123
112
|
const Tooltip = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Tooltip) || Tooltip_1.default; }, [theme]);
|
|
124
113
|
const Transition = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Transition) || Transition_1.default; }, [theme]);
|
|
125
|
-
const { tonal = true, color = 'primary', version = 'regular', value,
|
|
114
|
+
const { tonal = true, color = 'primary', version = 'regular', value, name, nameTooltip, vertical, icon, iconSelected, selected, disabled, IconWrapperComponent = 'span', onFocus: onFocus_, onBlur: onBlur_, onKeyDown: onKeyDown_, onMouseDown: onMouseDown_, onMouseEnter: onMouseEnter_, onMouseLeave: onMouseLeave_, onTouchStart: onTouchStart_, TooltipProps, LabelProps, IconWrapperProps, className, style, children: children_ } = props, other = __rest(props, ["tonal", "color", "version", "value", "name", "nameTooltip", "vertical", "icon", "iconSelected", "selected", "disabled", "IconWrapperComponent", "onFocus", "onBlur", "onKeyDown", "onMouseDown", "onMouseEnter", "onMouseLeave", "onTouchStart", "TooltipProps", "LabelProps", "IconWrapperProps", "className", "style", "children"]);
|
|
126
115
|
const { classes } = useStyle();
|
|
127
116
|
const [focus, setFocus] = react_1.default.useState(false);
|
|
128
117
|
const [hover, setHover] = react_1.default.useState(false);
|
|
@@ -133,7 +122,6 @@ const NavigationItem = react_1.default.forwardRef((props_, ref) => {
|
|
|
133
122
|
hover: react_1.default.useRef(undefined)
|
|
134
123
|
};
|
|
135
124
|
const styles = {
|
|
136
|
-
root: {},
|
|
137
125
|
icon: {},
|
|
138
126
|
label: {},
|
|
139
127
|
indicator: {}
|
|
@@ -220,19 +208,8 @@ const NavigationItem = react_1.default.forwardRef((props_, ref) => {
|
|
|
220
208
|
styles.indicator.color = (palette === null || palette === void 0 ? void 0 : palette.main) || (color === 'default' ? theme.palette.text.default.primary : theme.palette.color[color].main);
|
|
221
209
|
styles.icon.color = styles.label.color = theme.methods.palette.color.value(color, 5, true, palette);
|
|
222
210
|
}
|
|
223
|
-
const LabelWrapper = version === 'auto' ? Fade : react_1.default.Fragment;
|
|
224
|
-
const LabelWrapperProps = {};
|
|
225
|
-
if (version === 'auto') {
|
|
226
|
-
LabelWrapperProps.in = selected;
|
|
227
|
-
LabelWrapperProps.className = (0, style_react_1.classNames)([
|
|
228
|
-
(0, utils_2.staticClassName)('NavigationItem', theme) && [
|
|
229
|
-
'onesy-NavigationItem-label'
|
|
230
|
-
],
|
|
231
|
-
classes.labelWrapper
|
|
232
|
-
]);
|
|
233
|
-
}
|
|
234
211
|
const Icon = (selected && iconSelected) || icon;
|
|
235
|
-
return ((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name:
|
|
212
|
+
return ((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: (_b = nameTooltip !== null && nameTooltip !== void 0 ? nameTooltip : name) !== null && _b !== void 0 ? _b : value, position: 'top', alignment: 'center', longPress: true, touch: false, hover: false, focus: false }, TooltipProps, { children: (0, jsx_runtime_1.jsx)("span", Object.assign({ tabIndex: !disabled ? 0 : undefined, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onTouchStart: onTouchStart, onMouseDown: onMouseDown, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, className: (0, style_react_1.classNames)([
|
|
236
213
|
(0, utils_2.staticClassName)('NavigationItem', theme) && [
|
|
237
214
|
'onesy-NavigationItem-root',
|
|
238
215
|
selected && 'onesy-NavigationItem-selected',
|
|
@@ -245,7 +222,7 @@ const NavigationItem = react_1.default.forwardRef((props_, ref) => {
|
|
|
245
222
|
classes.root,
|
|
246
223
|
vertical && classes.vertical,
|
|
247
224
|
disabled && classes.disabled
|
|
248
|
-
]), style: Object.assign(
|
|
225
|
+
]), style: Object.assign({}, style) }, other, { children: (0, jsx_runtime_1.jsxs)(Line, Object.assign({ ref: item => {
|
|
249
226
|
if (ref) {
|
|
250
227
|
if ((0, utils_1.is)('function', ref))
|
|
251
228
|
ref(item);
|
|
@@ -253,7 +230,7 @@ const NavigationItem = react_1.default.forwardRef((props_, ref) => {
|
|
|
253
230
|
ref.current = item;
|
|
254
231
|
}
|
|
255
232
|
refs.root.current = item;
|
|
256
|
-
}, direction: 'column', align: 'center', justify: 'center', gap: 0.
|
|
233
|
+
}, direction: 'column', align: 'center', justify: 'center', gap: 0.25, className: (0, style_react_1.classNames)([
|
|
257
234
|
(0, utils_2.staticClassName)('NavigationItem', theme) && [
|
|
258
235
|
'onesy-NavigationItem-item'
|
|
259
236
|
],
|
|
@@ -283,12 +260,12 @@ const NavigationItem = react_1.default.forwardRef((props_, ref) => {
|
|
|
283
260
|
classes.icon
|
|
284
261
|
]) }, { children: react_1.default.cloneElement(Icon, {
|
|
285
262
|
style: Object.assign(Object.assign({}, Icon.props.style), styles.icon)
|
|
286
|
-
}) }))] }))),
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
263
|
+
}) }))] }))), (version === 'regular' || (version === 'auto' && selected)) && ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, LabelProps, { className: (0, style_react_1.classNames)([
|
|
264
|
+
(0, utils_2.staticClassName)('NavigationItem', theme) && [
|
|
265
|
+
'onesy-NavigationItem-label',
|
|
266
|
+
LabelProps === null || LabelProps === void 0 ? void 0 : LabelProps.className
|
|
267
|
+
]
|
|
268
|
+
]), style: Object.assign(Object.assign({}, styles.label), LabelProps === null || LabelProps === void 0 ? void 0 : LabelProps.style) }, { children: name })))] })) })) })));
|
|
292
269
|
});
|
|
293
270
|
NavigationItem.displayName = 'onesy-NavigationItem';
|
|
294
271
|
exports.default = NavigationItem;
|
package/TextField/TextField.js
CHANGED
|
@@ -401,7 +401,7 @@ const TextField = react_1.default.forwardRef((props_, ref) => {
|
|
|
401
401
|
const Type = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Type) || Type_1.default; }, [theme]);
|
|
402
402
|
const Tooltip = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Tooltip) || Tooltip_1.default; }, [theme]);
|
|
403
403
|
const IconButton = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.IconButton) || IconButton_1.default; }, [theme]);
|
|
404
|
-
const { tonal = true, color = 'primary', version = 'filled', size = 'regular', rootRef, valueDefault, value: value_, onChange, name, label: label_, align, start, startVerticalAlign = 'start', end: end_, endVerticalAlign: endVerticalAlign_ = 'start', placeholder, fullWidth: fullWidth_, helperText, counter, prefix, sufix, noPrefixMargin, noSufixMargin, enabled, autoFocus, autoComplete, type: type_ = 'text', required, optional, optionalText = 'optional', error, multiline, rows: rows_, minRows = 1, maxRows, clear, focus: focus_, footer: footer_, subscription, controlled, minimal, restoreSelection = false, minWidth, readOnly, disabled, onInput: onInput_, onFocus: onFocus_, onBlur: onBlur_, onMouseEnter: onMouseEnter_, onMouseLeave: onMouseLeave_, inputProps = {}, InputWrapperProps = {}, HelperTextProps, IconProps, IconClear = IconMaterialCloseW100_1.default, InputComponent: InputComponent_, WrapperComponent = 'div', Component = 'div', className, style, children,
|
|
404
|
+
const { tonal = true, color = 'primary', version = 'filled', size = 'regular', rootRef, valueDefault, value: value_, onChange, name, label: label_, align, start, startVerticalAlign: startVerticalAlign_ = 'start', end: end_, endVerticalAlign: endVerticalAlign_ = 'start', placeholder, fullWidth: fullWidth_, helperText, counter, prefix, sufix, noPrefixMargin, noSufixMargin, enabled, autoFocus, autoComplete, type: type_ = 'text', required, optional, optionalText = 'optional', error, multiline, rows: rows_, minRows = 1, maxRows, clear, focus: focus_, footer: footer_, subscription, controlled, minimal, restoreSelection = false, minWidth, readOnly, disabled, onInput: onInput_, onFocus: onFocus_, onBlur: onBlur_, onMouseEnter: onMouseEnter_, onMouseLeave: onMouseLeave_, inputProps = {}, InputWrapperProps = {}, HelperTextProps, IconProps, IconClear = IconMaterialCloseW100_1.default, InputComponent: InputComponent_, WrapperComponent = 'div', Component = 'div', className, style, children,
|
|
405
405
|
// Other
|
|
406
406
|
colorUnchecked } = props, other = __rest(props, ["tonal", "color", "version", "size", "rootRef", "valueDefault", "value", "onChange", "name", "label", "align", "start", "startVerticalAlign", "end", "endVerticalAlign", "placeholder", "fullWidth", "helperText", "counter", "prefix", "sufix", "noPrefixMargin", "noSufixMargin", "enabled", "autoFocus", "autoComplete", "type", "required", "optional", "optionalText", "error", "multiline", "rows", "minRows", "maxRows", "clear", "focus", "footer", "subscription", "controlled", "minimal", "restoreSelection", "minWidth", "readOnly", "disabled", "onInput", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "inputProps", "InputWrapperProps", "HelperTextProps", "IconProps", "IconClear", "InputComponent", "WrapperComponent", "Component", "className", "style", "children", "colorUnchecked"]);
|
|
407
407
|
const { classes } = useStyle();
|
|
@@ -431,6 +431,7 @@ const TextField = react_1.default.forwardRef((props_, ref) => {
|
|
|
431
431
|
breakpoints[key] = (0, useMediaQuery_1.default)(theme.breakpoints.media[key], { element: refs.root.current });
|
|
432
432
|
});
|
|
433
433
|
const label = name !== undefined ? name : label_;
|
|
434
|
+
let startVerticalAlign = startVerticalAlign_;
|
|
434
435
|
let endVerticalAlign = endVerticalAlign_;
|
|
435
436
|
const fullWidth = (0, utils_2.valueBreakpoints)(fullWidth_, undefined, breakpoints, theme);
|
|
436
437
|
const rowValue = () => {
|
|
@@ -690,8 +691,6 @@ const TextField = react_1.default.forwardRef((props_, ref) => {
|
|
|
690
691
|
if (value && clear) {
|
|
691
692
|
const exists = end === null || end === void 0 ? void 0 : end.find(item => item.key === refs.ids.clear);
|
|
692
693
|
if (!exists) {
|
|
693
|
-
if (props.endVerticalAlign === undefined)
|
|
694
|
-
endVerticalAlign = 'center';
|
|
695
694
|
end.push((0, jsx_runtime_1.jsx)(IconClear, Object.assign({ color: 'inherit', onClick: onClear }, IconProps, { className: (0, style_react_1.classNames)([
|
|
696
695
|
IconProps === null || IconProps === void 0 ? void 0 : IconProps.className,
|
|
697
696
|
classes.clear
|
|
@@ -699,10 +698,14 @@ const TextField = react_1.default.forwardRef((props_, ref) => {
|
|
|
699
698
|
}
|
|
700
699
|
}
|
|
701
700
|
if (value && isTypePassword) {
|
|
702
|
-
if (!multiline && props.endVerticalAlign === undefined)
|
|
703
|
-
endVerticalAlign = version === 'text' ? 'end' : 'center';
|
|
704
701
|
end.unshift((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: visible ? l('Hide password') : l('View password'), color: 'inverted' }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onToggleVisible, color: 'default', size: size === 'large' ? 'regular' : 'small' }, { children: visible ? (0, jsx_runtime_1.jsx)(IconMaterialPassword2OffW100_1.default, Object.assign({}, iconProps)) : (0, jsx_runtime_1.jsx)(IconMaterialPassword2W100_1.default, Object.assign({}, iconProps)) })) })));
|
|
705
702
|
}
|
|
703
|
+
if (!multiline) {
|
|
704
|
+
if (props.startVerticalAlign === undefined)
|
|
705
|
+
startVerticalAlign = version === 'text' ? 'end' : 'center';
|
|
706
|
+
if (props.endVerticalAlign === undefined)
|
|
707
|
+
endVerticalAlign = version === 'text' ? 'end' : 'center';
|
|
708
|
+
}
|
|
706
709
|
const valueWithData = value !== undefined && String(value);
|
|
707
710
|
return ((0, jsx_runtime_1.jsxs)(Wrapper, Object.assign({}, WrapperProps, { children: [(0, jsx_runtime_1.jsxs)(Component, Object.assign({ onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onTouchStart: onMouseEnter, onTouchEnd: onMouseLeave, role: 'textbox', "aria-multiline": multiline, "aria-labelledby": refs.ids.label }, ComponentProps, { className: (0, style_react_1.classNames)([
|
|
708
711
|
(0, utils_2.staticClassName)('TextField', theme) && [
|
|
@@ -1,100 +1,40 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
const _excluded = ["tonal", "color", "size", "
|
|
4
|
+
const _excluded = ["tonal", "color", "size", "fixed", "className", "children", "style"];
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { classNames, style as styleMethod, useOnesyTheme } from '@onesy/style-react';
|
|
9
9
|
import LineElement from '../Line';
|
|
10
10
|
import SurfaceElement from '../Surface';
|
|
11
|
-
import TransitionElement from '../Transition';
|
|
12
11
|
import { staticClassName } from '../utils';
|
|
13
12
|
const useStyle = styleMethod(theme => ({
|
|
14
13
|
root: {
|
|
14
|
+
background: theme.palette.color.primary[theme.palette.light ? 100 : 5],
|
|
15
|
+
boxShadow: '0px 8px 10px 1px rgb(0 0 0 / 1%), 0px 3px 14px 2px rgb(0 0 0 / 1%), 0px 5px 5px -3px rgb(0 0 0 / 4%)',
|
|
16
|
+
borderRadius: '500px',
|
|
15
17
|
zIndex: theme.z_index.app_bar,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
overflow: 'auto hidden',
|
|
19
|
+
'&::-webkit-scrollbar': {
|
|
20
|
+
width: '0px',
|
|
21
|
+
height: '0px'
|
|
22
|
+
}
|
|
20
23
|
},
|
|
21
24
|
size_small: {
|
|
22
|
-
|
|
25
|
+
padding: '6px 10px'
|
|
23
26
|
},
|
|
24
27
|
size_regular: {
|
|
25
|
-
|
|
28
|
+
padding: '12px 20px'
|
|
26
29
|
},
|
|
27
30
|
size_large: {
|
|
28
|
-
|
|
31
|
+
padding: '18px 30px'
|
|
29
32
|
},
|
|
30
33
|
fixed: {
|
|
31
34
|
position: 'fixed',
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
item: {
|
|
36
|
-
opacity: '0',
|
|
37
|
-
transform: 'translateY(100%)',
|
|
38
|
-
transition: theme?.methods.transitions.make(['opacity', 'transform'], {
|
|
39
|
-
duration: 'rg',
|
|
40
|
-
timing_function: 'standard'
|
|
41
|
-
}),
|
|
42
|
-
'&.enter': {
|
|
43
|
-
opacity: '0',
|
|
44
|
-
transform: 'translateY(100%)'
|
|
45
|
-
},
|
|
46
|
-
'&.entering': {
|
|
47
|
-
opacity: '1',
|
|
48
|
-
transform: 'translateY(0%)'
|
|
49
|
-
},
|
|
50
|
-
'&.entered': {
|
|
51
|
-
opacity: '1',
|
|
52
|
-
transform: 'translateY(0%)'
|
|
53
|
-
},
|
|
54
|
-
'&.exit': {
|
|
55
|
-
opacity: '1',
|
|
56
|
-
transform: 'translateY(0%)'
|
|
57
|
-
},
|
|
58
|
-
'&.exiting': {
|
|
59
|
-
opacity: '0',
|
|
60
|
-
transform: 'translateY(0%)'
|
|
61
|
-
},
|
|
62
|
-
'&.exited': {
|
|
63
|
-
opacity: '0',
|
|
64
|
-
transform: 'translateY(0%)'
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
mainItem: {
|
|
68
|
-
opacity: '0',
|
|
69
|
-
transform: 'scale(0.75)',
|
|
70
|
-
transition: theme?.methods.transitions.make(['opacity', 'transform'], {
|
|
71
|
-
duration: 'rg',
|
|
72
|
-
timing_function: 'standard'
|
|
73
|
-
}),
|
|
74
|
-
'&.enter': {
|
|
75
|
-
opacity: '0',
|
|
76
|
-
transform: 'scale(0.75)'
|
|
77
|
-
},
|
|
78
|
-
'&.entering': {
|
|
79
|
-
opacity: '1',
|
|
80
|
-
transform: 'scale(1)'
|
|
81
|
-
},
|
|
82
|
-
'&.entered': {
|
|
83
|
-
opacity: '1',
|
|
84
|
-
transform: 'scale(1)'
|
|
85
|
-
},
|
|
86
|
-
'&.exit': {
|
|
87
|
-
opacity: '1',
|
|
88
|
-
transform: 'scale(1)'
|
|
89
|
-
},
|
|
90
|
-
'&.exiting': {
|
|
91
|
-
opacity: '0',
|
|
92
|
-
transform: 'scale(1)'
|
|
93
|
-
},
|
|
94
|
-
'&.exited': {
|
|
95
|
-
opacity: '0',
|
|
96
|
-
transform: 'scale(1)'
|
|
97
|
-
}
|
|
35
|
+
bottom: '12px',
|
|
36
|
+
left: '50%',
|
|
37
|
+
transform: 'translateX(-50%)'
|
|
98
38
|
}
|
|
99
39
|
}), {
|
|
100
40
|
name: 'onesy-BottomAppBar'
|
|
@@ -104,89 +44,19 @@ const BottomAppBar = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
104
44
|
const props = React.useMemo(() => _objectSpread(_objectSpread(_objectSpread({}, theme?.ui?.elements?.all?.props?.default), theme?.ui?.elements?.onesyBottomAppBar?.props?.default), props_), [props_]);
|
|
105
45
|
const Line = React.useMemo(() => theme?.elements?.Line || LineElement, [theme]);
|
|
106
46
|
const Surface = React.useMemo(() => theme?.elements?.Surface || SurfaceElement, [theme]);
|
|
107
|
-
const Transition = React.useMemo(() => theme?.elements?.Transition || TransitionElement, [theme]);
|
|
108
47
|
const {
|
|
109
48
|
tonal = true,
|
|
110
|
-
color = '
|
|
49
|
+
color = 'default',
|
|
111
50
|
size = 'regular',
|
|
112
|
-
|
|
113
|
-
fixed,
|
|
114
|
-
noTransition,
|
|
51
|
+
fixed = true,
|
|
115
52
|
className,
|
|
116
|
-
children
|
|
53
|
+
children,
|
|
54
|
+
style
|
|
117
55
|
} = props,
|
|
118
56
|
other = _objectWithoutProperties(props, _excluded);
|
|
119
57
|
const {
|
|
120
58
|
classes
|
|
121
59
|
} = useStyle();
|
|
122
|
-
const makeChildren = values => {
|
|
123
|
-
return React.Children.toArray(values).map((item, index) => /*#__PURE__*/React.createElement(Transition, {
|
|
124
|
-
key: index,
|
|
125
|
-
onRemoved: () => {
|
|
126
|
-
if (index === 0) reAddChildren();
|
|
127
|
-
},
|
|
128
|
-
removeOnExited: true
|
|
129
|
-
}, status => (/*#__PURE__*/React.cloneElement(item, {
|
|
130
|
-
className: classNames([classes.item, status]),
|
|
131
|
-
elevation: item.props.elevation !== undefined ? item.props.elevation : false,
|
|
132
|
-
version: item.props.version !== undefined ? item.props.version : 'filled',
|
|
133
|
-
color: item.props.color !== undefined ? item.props.color : color,
|
|
134
|
-
tonal: item.props.tonal !== undefined ? item.props.tonal : tonal,
|
|
135
|
-
style: _objectSpread(_objectSpread({}, item.props.style), status.includes('enter') && {
|
|
136
|
-
transitionDelay: `${index * 70}ms`
|
|
137
|
-
})
|
|
138
|
-
}))));
|
|
139
|
-
};
|
|
140
|
-
const makeMain = values => {
|
|
141
|
-
return React.Children.toArray(values).map((item, index) => /*#__PURE__*/React.createElement(Transition, {
|
|
142
|
-
key: index,
|
|
143
|
-
onRemoved: () => {
|
|
144
|
-
if (index === 0) reAddMain();
|
|
145
|
-
},
|
|
146
|
-
removeOnExited: true
|
|
147
|
-
}, status => (/*#__PURE__*/React.cloneElement(item, {
|
|
148
|
-
className: classNames([classes.mainItem, status]),
|
|
149
|
-
color: item.props.color !== undefined ? item.props.color : color,
|
|
150
|
-
tonal: item.props.tonal !== undefined ? item.props.tonal : tonal && ['onesy-Fab'].includes(item.type?.displayName) ? 'secondary' : tonal
|
|
151
|
-
}))));
|
|
152
|
-
};
|
|
153
|
-
const [init, setInit] = React.useState(false);
|
|
154
|
-
const [children, setChildren] = React.useState(() => makeChildren(children_));
|
|
155
|
-
const [main, setMain] = React.useState(() => makeMain(main_));
|
|
156
|
-
const [inProp, setInProp] = React.useState(true);
|
|
157
|
-
const refs = {
|
|
158
|
-
preChildren: React.useRef(undefined),
|
|
159
|
-
preMain: React.useRef(undefined)
|
|
160
|
-
};
|
|
161
|
-
React.useEffect(() => {
|
|
162
|
-
setInit(true);
|
|
163
|
-
}, []);
|
|
164
|
-
const reAddChildren = () => {
|
|
165
|
-
setChildren(makeChildren(refs.preChildren.current));
|
|
166
|
-
setInProp(true);
|
|
167
|
-
refs.preChildren.current = undefined;
|
|
168
|
-
};
|
|
169
|
-
const reAddMain = () => {
|
|
170
|
-
setMain(makeMain(refs.preMain.current));
|
|
171
|
-
setInProp(true);
|
|
172
|
-
refs.preMain.current = undefined;
|
|
173
|
-
};
|
|
174
|
-
React.useEffect(() => {
|
|
175
|
-
if (init) {
|
|
176
|
-
if (!noTransition) {
|
|
177
|
-
refs.preChildren.current = children_;
|
|
178
|
-
setInProp(false);
|
|
179
|
-
} else setChildren(makeChildren(children_));
|
|
180
|
-
}
|
|
181
|
-
}, [React.Children.toArray(children_).map(item => item.key).join('')]);
|
|
182
|
-
React.useEffect(() => {
|
|
183
|
-
if (init) {
|
|
184
|
-
if (!noTransition) {
|
|
185
|
-
refs.preMain.current = main_;
|
|
186
|
-
setInProp(false);
|
|
187
|
-
} else setMain(makeMain(main_));
|
|
188
|
-
}
|
|
189
|
-
}, [React.Children.toArray(main_).map(item => item.key).join('')]);
|
|
190
60
|
return /*#__PURE__*/React.createElement(Surface, _extends({
|
|
191
61
|
ref: ref,
|
|
192
62
|
color: color,
|
|
@@ -195,22 +65,13 @@ const BottomAppBar = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
195
65
|
direction: "row",
|
|
196
66
|
align: "center",
|
|
197
67
|
justify: "space-between",
|
|
68
|
+
fullWidth: true,
|
|
198
69
|
Component: Line,
|
|
199
|
-
className: classNames([staticClassName('BottomAppBar', theme) && ['onesy-BottomAppBar-root', `onesy-BottomAppBar-size-${size}`], className, classes.root, classes[`size_${size}`], fixed && classes.fixed])
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
gap: 0
|
|
205
|
-
}, children.map(item => (/*#__PURE__*/React.cloneElement(item, {
|
|
206
|
-
in: inProp
|
|
207
|
-
})))), !!main.length && /*#__PURE__*/React.createElement(Line, {
|
|
208
|
-
direction: "row",
|
|
209
|
-
align: "center",
|
|
210
|
-
justify: "flex-end"
|
|
211
|
-
}, main.map(item => (/*#__PURE__*/React.cloneElement(item, {
|
|
212
|
-
in: inProp
|
|
213
|
-
})))));
|
|
70
|
+
className: classNames([staticClassName('BottomAppBar', theme) && ['onesy-BottomAppBar-root', `onesy-BottomAppBar-size-${size}`], className, classes.root, classes[`size_${size}`], fixed && classes.fixed]),
|
|
71
|
+
style: _objectSpread({
|
|
72
|
+
minWidth: `clamp(100px, ${(children?.length || 3) * 110}px, calc(100vw - 24px))`
|
|
73
|
+
}, style)
|
|
74
|
+
}, other), children);
|
|
214
75
|
});
|
|
215
76
|
BottomAppBar.displayName = 'onesy-BottomAppBar';
|
|
216
77
|
export default BottomAppBar;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
const _excluded = ["tonal", "color", "version", "value", "
|
|
4
|
+
const _excluded = ["tonal", "color", "version", "value", "name", "nameTooltip", "vertical", "icon", "iconSelected", "selected", "disabled", "IconWrapperComponent", "onFocus", "onBlur", "onKeyDown", "onMouseDown", "onMouseEnter", "onMouseLeave", "onTouchStart", "TooltipProps", "LabelProps", "IconWrapperProps", "className", "style", "children"];
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { is, isEnvironment } from '@onesy/utils';
|
|
9
9
|
import { classNames, style as styleMethod, useOnesyTheme } from '@onesy/style-react';
|
|
10
10
|
import TypeElement from '../Type';
|
|
11
|
-
import FadeElement from '../Fade';
|
|
12
11
|
import LineElement from '../Line';
|
|
13
12
|
import TooltipElement from '../Tooltip';
|
|
14
13
|
import TransitionElement from '../Transition';
|
|
@@ -30,8 +29,7 @@ const useStyle = styleMethod(theme => ({
|
|
|
30
29
|
width: '100%'
|
|
31
30
|
},
|
|
32
31
|
iconWrapper: {
|
|
33
|
-
position: '
|
|
34
|
-
top: '0',
|
|
32
|
+
position: 'relative',
|
|
35
33
|
height: '32px',
|
|
36
34
|
width: '64px'
|
|
37
35
|
},
|
|
@@ -47,14 +45,6 @@ const useStyle = styleMethod(theme => ({
|
|
|
47
45
|
icon: {
|
|
48
46
|
lineHeight: '0'
|
|
49
47
|
},
|
|
50
|
-
labelWrapper: {
|
|
51
|
-
position: 'absolute',
|
|
52
|
-
bottom: '0'
|
|
53
|
-
},
|
|
54
|
-
label: {
|
|
55
|
-
position: 'absolute',
|
|
56
|
-
bottom: '0'
|
|
57
|
-
},
|
|
58
48
|
indicator: {
|
|
59
49
|
position: 'absolute',
|
|
60
50
|
inset: '0',
|
|
@@ -114,17 +104,11 @@ const useStyle = styleMethod(theme => ({
|
|
|
114
104
|
}), {
|
|
115
105
|
name: 'onesy-NavigationItem'
|
|
116
106
|
});
|
|
117
|
-
|
|
118
|
-
// To do
|
|
119
|
-
|
|
120
|
-
// Long press label in tooltip
|
|
121
|
-
|
|
122
107
|
const NavigationItem = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
123
108
|
const theme = useOnesyTheme();
|
|
124
109
|
const props = React.useMemo(() => _objectSpread(_objectSpread(_objectSpread({}, theme?.ui?.elements?.all?.props?.default), theme?.ui?.elements?.onesyNavigationItem?.props?.default), props_), [props_]);
|
|
125
110
|
const Line = React.useMemo(() => theme?.elements?.Line || LineElement, [theme]);
|
|
126
111
|
const Type = React.useMemo(() => theme?.elements?.Type || TypeElement, [theme]);
|
|
127
|
-
const Fade = React.useMemo(() => theme?.elements?.Fade || FadeElement, [theme]);
|
|
128
112
|
const Tooltip = React.useMemo(() => theme?.elements?.Tooltip || TooltipElement, [theme]);
|
|
129
113
|
const Transition = React.useMemo(() => theme?.elements?.Transition || TransitionElement, [theme]);
|
|
130
114
|
const {
|
|
@@ -132,9 +116,9 @@ const NavigationItem = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
132
116
|
color = 'primary',
|
|
133
117
|
version = 'regular',
|
|
134
118
|
value,
|
|
135
|
-
vertical,
|
|
136
119
|
name,
|
|
137
|
-
|
|
120
|
+
nameTooltip,
|
|
121
|
+
vertical,
|
|
138
122
|
icon,
|
|
139
123
|
iconSelected,
|
|
140
124
|
selected,
|
|
@@ -148,6 +132,7 @@ const NavigationItem = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
148
132
|
onMouseLeave: onMouseLeave_,
|
|
149
133
|
onTouchStart: onTouchStart_,
|
|
150
134
|
TooltipProps,
|
|
135
|
+
LabelProps,
|
|
151
136
|
IconWrapperProps,
|
|
152
137
|
className,
|
|
153
138
|
style,
|
|
@@ -166,7 +151,6 @@ const NavigationItem = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
166
151
|
hover: React.useRef(undefined)
|
|
167
152
|
};
|
|
168
153
|
const styles = {
|
|
169
|
-
root: {},
|
|
170
154
|
icon: {},
|
|
171
155
|
label: {},
|
|
172
156
|
indicator: {}
|
|
@@ -235,15 +219,9 @@ const NavigationItem = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
235
219
|
styles.indicator.color = palette?.main || (color === 'default' ? theme.palette.text.default.primary : theme.palette.color[color].main);
|
|
236
220
|
styles.icon.color = styles.label.color = theme.methods.palette.color.value(color, 5, true, palette);
|
|
237
221
|
}
|
|
238
|
-
const LabelWrapper = version === 'auto' ? Fade : React.Fragment;
|
|
239
|
-
const LabelWrapperProps = {};
|
|
240
|
-
if (version === 'auto') {
|
|
241
|
-
LabelWrapperProps.in = selected;
|
|
242
|
-
LabelWrapperProps.className = classNames([staticClassName('NavigationItem', theme) && ['onesy-NavigationItem-label'], classes.labelWrapper]);
|
|
243
|
-
}
|
|
244
222
|
const Icon = selected && iconSelected || icon;
|
|
245
223
|
return /*#__PURE__*/React.createElement(Tooltip, _extends({
|
|
246
|
-
name:
|
|
224
|
+
name: nameTooltip ?? name ?? value,
|
|
247
225
|
position: "top",
|
|
248
226
|
alignment: "center",
|
|
249
227
|
longPress: true,
|
|
@@ -260,7 +238,7 @@ const NavigationItem = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
260
238
|
onMouseEnter: onMouseEnter,
|
|
261
239
|
onMouseLeave: onMouseLeave,
|
|
262
240
|
className: classNames([staticClassName('NavigationItem', theme) && ['onesy-NavigationItem-root', selected && 'onesy-NavigationItem-selected', hover && `onesy-NavigationItem-hover`, mouseDown && `onesy-NavigationItem-mouse-down`, focus && `onesy-NavigationItem-focus`, disabled && `onesy-NavigationItem-disabled`], className, classes.root, vertical && classes.vertical, disabled && classes.disabled]),
|
|
263
|
-
style: _objectSpread(
|
|
241
|
+
style: _objectSpread({}, style)
|
|
264
242
|
}, other), /*#__PURE__*/React.createElement(Line, {
|
|
265
243
|
ref: item => {
|
|
266
244
|
if (ref) {
|
|
@@ -271,7 +249,7 @@ const NavigationItem = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
271
249
|
direction: "column",
|
|
272
250
|
align: "center",
|
|
273
251
|
justify: "center",
|
|
274
|
-
gap: 0.
|
|
252
|
+
gap: 0.25,
|
|
275
253
|
className: classNames([staticClassName('NavigationItem', theme) && ['onesy-NavigationItem-item'], classes.item])
|
|
276
254
|
}, Icon && /*#__PURE__*/React.createElement(Line, {
|
|
277
255
|
Component: "span",
|
|
@@ -287,11 +265,12 @@ const NavigationItem = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
287
265
|
className: classNames([staticClassName('NavigationItem', theme) && ['onesy-NavigationItem-icon'], IconWrapperProps?.className, classes.icon])
|
|
288
266
|
}), /*#__PURE__*/React.cloneElement(Icon, {
|
|
289
267
|
style: _objectSpread(_objectSpread({}, Icon.props.style), styles.icon)
|
|
290
|
-
}))),
|
|
291
|
-
version: "b3"
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
268
|
+
}))), (version === 'regular' || version === 'auto' && selected) && /*#__PURE__*/React.createElement(Type, _extends({
|
|
269
|
+
version: "b3"
|
|
270
|
+
}, LabelProps, {
|
|
271
|
+
className: classNames([staticClassName('NavigationItem', theme) && ['onesy-NavigationItem-label', LabelProps?.className]]),
|
|
272
|
+
style: _objectSpread(_objectSpread({}, styles.label), LabelProps?.style)
|
|
273
|
+
}), name))));
|
|
295
274
|
});
|
|
296
275
|
NavigationItem.displayName = 'onesy-NavigationItem';
|
|
297
276
|
export default NavigationItem;
|
|
@@ -496,7 +496,7 @@ const TextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
496
496
|
label: label_,
|
|
497
497
|
align,
|
|
498
498
|
start,
|
|
499
|
-
startVerticalAlign = 'start',
|
|
499
|
+
startVerticalAlign: startVerticalAlign_ = 'start',
|
|
500
500
|
end: end_,
|
|
501
501
|
endVerticalAlign: endVerticalAlign_ = 'start',
|
|
502
502
|
placeholder,
|
|
@@ -579,6 +579,7 @@ const TextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
579
579
|
});
|
|
580
580
|
});
|
|
581
581
|
const label = name !== undefined ? name : label_;
|
|
582
|
+
let startVerticalAlign = startVerticalAlign_;
|
|
582
583
|
let endVerticalAlign = endVerticalAlign_;
|
|
583
584
|
const fullWidth = valueBreakpoints(fullWidth_, undefined, breakpoints, theme);
|
|
584
585
|
const rowValue = () => {
|
|
@@ -808,7 +809,6 @@ const TextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
808
809
|
if (value && clear) {
|
|
809
810
|
const exists = end?.find(item => item.key === refs.ids.clear);
|
|
810
811
|
if (!exists) {
|
|
811
|
-
if (props.endVerticalAlign === undefined) endVerticalAlign = 'center';
|
|
812
812
|
end.push(/*#__PURE__*/React.createElement(IconClear, _extends({
|
|
813
813
|
key: refs.ids.clear,
|
|
814
814
|
color: "inherit",
|
|
@@ -819,7 +819,6 @@ const TextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
819
819
|
}
|
|
820
820
|
}
|
|
821
821
|
if (value && isTypePassword) {
|
|
822
|
-
if (!multiline && props.endVerticalAlign === undefined) endVerticalAlign = version === 'text' ? 'end' : 'center';
|
|
823
822
|
end.unshift(/*#__PURE__*/React.createElement(Tooltip, {
|
|
824
823
|
name: visible ? l('Hide password') : l('View password'),
|
|
825
824
|
color: "inverted"
|
|
@@ -829,6 +828,10 @@ const TextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
829
828
|
size: size === 'large' ? 'regular' : 'small'
|
|
830
829
|
}, visible ? /*#__PURE__*/React.createElement(IconMaterialPassword2Off, iconProps) : /*#__PURE__*/React.createElement(IconMaterialPassword2, iconProps))));
|
|
831
830
|
}
|
|
831
|
+
if (!multiline) {
|
|
832
|
+
if (props.startVerticalAlign === undefined) startVerticalAlign = version === 'text' ? 'end' : 'center';
|
|
833
|
+
if (props.endVerticalAlign === undefined) endVerticalAlign = version === 'text' ? 'end' : 'center';
|
|
834
|
+
}
|
|
832
835
|
const valueWithData = value !== undefined && String(value);
|
|
833
836
|
return /*#__PURE__*/React.createElement(Wrapper, WrapperProps, /*#__PURE__*/React.createElement(Component, _extends({
|
|
834
837
|
onMouseEnter: onMouseEnter,
|
package/esm/index.js
CHANGED