@onesy/ui-react 1.0.98 → 1.0.100
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/ColorTextField/ColorTextField.d.ts +1 -0
- package/ColorTextField/ColorTextField.js +5 -7
- package/RichTextEditor/RichTextEditor.js +2 -1
- package/SmartTextField/SmartTextField.js +31 -10
- package/esm/ColorTextField/ColorTextField.js +9 -7
- package/esm/RichTextEditor/RichTextEditor.js +1 -1
- package/esm/SmartTextField/SmartTextField.js +32 -10
- package/esm/index.js +1 -1
- package/package.json +1 -1
@@ -7,6 +7,7 @@ export declare type IColorTextField = ITextField & {
|
|
7
7
|
onChangeColor?: (valueNew: string) => any;
|
8
8
|
onChangeOpacity?: (valueNew: string | number) => any;
|
9
9
|
opacity?: boolean;
|
10
|
+
WrapperProps?: any;
|
10
11
|
};
|
11
12
|
declare const ColorTextField: React.FC<IColorTextField>;
|
12
13
|
export default ColorTextField;
|
@@ -52,7 +52,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
52
52
|
fontSize: '100%',
|
53
53
|
background: 'transparent',
|
54
54
|
boxSizing: 'border-box',
|
55
|
-
touchAction: 'manipulation'
|
55
|
+
touchAction: 'manipulation'
|
56
56
|
},
|
57
57
|
inputColor: {
|
58
58
|
// Reset
|
@@ -82,7 +82,7 @@ const ColorTextField = react_1.default.forwardRef((props_, ref) => {
|
|
82
82
|
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.onesyColorTextField) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
|
83
83
|
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]);
|
84
84
|
const TextField = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.TextField) || TextField_1.default; }, [theme]);
|
85
|
-
const { name, version = 'outlined', size = 'regular', valueDefault, value: value_, valueColor: valueColor_, valueOpacity: valueOpacity_, onChange: onChange_, onChangeColor: onChangeColor_, onChangeOpacity: onChangeOpacity_, opacity, className } = props, other = __rest(props, ["name", "version", "size", "valueDefault", "value", "valueColor", "valueOpacity", "onChange", "onChangeColor", "onChangeOpacity", "opacity", "className"]);
|
85
|
+
const { name, version = 'outlined', size = 'regular', valueDefault, value: value_, valueColor: valueColor_, valueOpacity: valueOpacity_, onChange: onChange_, onChangeColor: onChangeColor_, onChangeOpacity: onChangeOpacity_, WrapperProps, opacity, className, style } = props, other = __rest(props, ["name", "version", "size", "valueDefault", "value", "valueColor", "valueOpacity", "onChange", "onChangeColor", "onChangeOpacity", "WrapperProps", "opacity", "className", "style"]);
|
86
86
|
const { classes } = useStyle();
|
87
87
|
const [value, setValue] = react_1.default.useState((valueDefault !== undefined ? valueDefault : value_) || '');
|
88
88
|
const [valueColor, setValueColor] = react_1.default.useState(valueColor_ !== undefined ? valueColor_ : '');
|
@@ -167,13 +167,11 @@ const ColorTextField = react_1.default.forwardRef((props_, ref) => {
|
|
167
167
|
`onesy-ColorTextField-version-${version}`,
|
168
168
|
`onesy-ColorTextField-size-${size}`
|
169
169
|
],
|
170
|
+
className,
|
170
171
|
classes.root
|
171
|
-
]), fullWidth: opacity }, (!opacity && other))));
|
172
|
+
]), fullWidth: opacity, style: style }, (!opacity && other))));
|
172
173
|
if (opacity) {
|
173
|
-
return ((0, jsx_runtime_1.jsxs)(Line, Object.assign({ ref: ref, gap: 1, fullWidth: true,
|
174
|
-
className,
|
175
|
-
classes.root
|
176
|
-
]) }, other, { children: [root, (0, jsx_runtime_1.jsx)(SliderInput, { name: l('Opacity'), value: valueOpacity, onChange: onChangeOpacity, min: 0, max: 100 })] })));
|
174
|
+
return ((0, jsx_runtime_1.jsxs)(Line, Object.assign({ ref: ref, gap: 1, fullWidth: true }, WrapperProps, { children: [root, (0, jsx_runtime_1.jsx)(SliderInput, { name: l('Opacity'), value: valueOpacity, onChange: onChangeOpacity, min: 0, max: 100 })] })));
|
177
175
|
}
|
178
176
|
return root;
|
179
177
|
});
|
@@ -314,7 +314,8 @@ const RichTextEditor = react_1.default.forwardRef((props__, ref) => {
|
|
314
314
|
react_1.default.useEffect(() => {
|
315
315
|
var _a, _b;
|
316
316
|
const selection_ = refs.rootWindow.current.getSelection();
|
317
|
-
if (selection_
|
317
|
+
if (selection_ &&
|
318
|
+
selection_.anchorNode &&
|
318
319
|
!((_b = (_a = selection_.anchorNode) === null || _a === void 0 ? void 0 : _a.className) === null || _b === void 0 ? void 0 : _b.includes('TextField')))
|
319
320
|
refs.range.current = selection_.getRangeAt(0);
|
320
321
|
}, [open]);
|
@@ -57,7 +57,10 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
57
57
|
root: {
|
58
58
|
minHeight: '20px',
|
59
59
|
width: '100%',
|
60
|
-
'& .onesy-TextField-input': Object.assign({ wordBreak: 'break-word', color: theme.methods.palette.color.value('primary', 10) }, theme.typography.values.b2)
|
60
|
+
'& .onesy-TextField-input': Object.assign({ wordBreak: 'break-word', color: theme.methods.palette.color.value('primary', 10) }, theme.typography.values.b2),
|
61
|
+
'& ul, ol': {
|
62
|
+
listStylePosition: 'inside'
|
63
|
+
}
|
61
64
|
},
|
62
65
|
root_type: {
|
63
66
|
minHeight: '20px',
|
@@ -85,7 +88,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
85
88
|
boxShadow: theme.shadows.values.default[2]
|
86
89
|
},
|
87
90
|
textMiniMenuAdditionalMenu: {
|
88
|
-
|
91
|
+
minWidth: 'clamp(140px, 90%, 250px)',
|
89
92
|
zIndex: '1514'
|
90
93
|
},
|
91
94
|
inputWrapper: {
|
@@ -97,7 +100,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
97
100
|
whiteSpace: 'nowrap',
|
98
101
|
overflow: 'hidden'
|
99
102
|
},
|
100
|
-
|
103
|
+
input: {
|
101
104
|
'&.onesy-TextField-root': {
|
102
105
|
flex: '1 1 auto !important'
|
103
106
|
}
|
@@ -120,7 +123,9 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
120
123
|
}
|
121
124
|
},
|
122
125
|
textFieldColor: {
|
123
|
-
|
126
|
+
'&.onesy-ColorTextField-root': {
|
127
|
+
flex: '1 1 auto'
|
128
|
+
}
|
124
129
|
},
|
125
130
|
helperText: {
|
126
131
|
display: 'inline-flex',
|
@@ -595,9 +600,14 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
595
600
|
}, 140);
|
596
601
|
}, []);
|
597
602
|
const onMouseDown = react_1.default.useCallback(() => {
|
603
|
+
var _a, _b;
|
598
604
|
if (!refs.edit.current)
|
599
605
|
return;
|
600
606
|
textQueryUpdate();
|
607
|
+
const selection_ = refs.rootWindow.current.getSelection();
|
608
|
+
if (selection_.anchorNode &&
|
609
|
+
!((_b = (_a = selection_.anchorNode) === null || _a === void 0 ? void 0 : _a.className) === null || _b === void 0 ? void 0 : _b.includes('TextField')))
|
610
|
+
refs.range.current = selection_.getRangeAt(0);
|
601
611
|
}, []);
|
602
612
|
const onKeyUp = react_1.default.useCallback(() => {
|
603
613
|
if (!refs.edit.current)
|
@@ -797,7 +807,11 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
797
807
|
'onesy-RichTextEditor-palette'
|
798
808
|
],
|
799
809
|
classes.palette
|
800
|
-
]) }, other_, { children: [(0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0.5, onMouseUp: onMouseUp, onMouseDown: onMouseDown
|
810
|
+
]) }, other_, { children: [(0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0.5, onMouseUp: onMouseUp, onMouseDown: onMouseDown, style: {
|
811
|
+
maxHeight: 136,
|
812
|
+
padding: '10px 10px 0',
|
813
|
+
overflow: 'hidden auto'
|
814
|
+
} }, { children: [(0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0.5, direction: 'row', style: {
|
801
815
|
width: '100%'
|
802
816
|
} }, { children: [(0, jsx_runtime_1.jsx)(PaletteItem, { color: '#000000', onClick: () => {
|
803
817
|
onUpdate_('#000000');
|
@@ -816,7 +830,7 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
816
830
|
onUpdate_(style_react_1.colors[item][item_]);
|
817
831
|
onClose();
|
818
832
|
} }, index_))) }), index)))] })), (0, jsx_runtime_1.jsx)(Divider, {}), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0.5, direction: 'row', align: 'center', fullWidth: true, style: {
|
819
|
-
padding:
|
833
|
+
padding: '0px 10px 10px'
|
820
834
|
} }, { children: [(0, jsx_runtime_1.jsx)(ColorTextField, Object.assign({ tonal: tonal, color: color, name: l('Custom color'), version: 'outlined', size: 'small', value: refs.inputValues.current[version_], onChange: valueNew => updateInputValues(version_, valueNew) }, ColorTextFieldProps, { className: (0, style_react_1.classNames)([
|
821
835
|
(0, utils_2.staticClassName)('RichTextEditor', theme) && [
|
822
836
|
'onesy-RichTextEditor-text-field-color'
|
@@ -853,13 +867,13 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
853
867
|
size: 'small'
|
854
868
|
};
|
855
869
|
const Input = react_1.default.useCallback(react_1.default.forwardRef((propsInput, ref_) => {
|
856
|
-
const { label: labelInput, labelButton, value: value__, onChange: onChange__, onClick, InputComponent = TextField, InputProps } = propsInput, other_ = __rest(propsInput, ["label", "labelButton", "value", "onChange", "onClick", "InputComponent", "InputProps"]);
|
870
|
+
const { label: labelInput, labelButton, value: value__, onChange: onChange__, onClick, placeholder: placeholderInputProps, InputComponent = TextField, InputProps } = propsInput, other_ = __rest(propsInput, ["label", "labelButton", "value", "onChange", "onClick", "placeholder", "InputComponent", "InputProps"]);
|
857
871
|
return ((0, jsx_runtime_1.jsx)(Line, Object.assign({ ref: ref_, gap: 1, direction: 'column', color: 'themed', Component: Surface }, other_, { className: (0, style_react_1.classNames)([
|
858
872
|
other_ === null || other_ === void 0 ? void 0 : other_.className,
|
859
873
|
classes.inputWrapper
|
860
874
|
]) }, { children: (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0.5, direction: 'row', align: 'center', style: {
|
861
875
|
width: '100%'
|
862
|
-
} }, { children: [(0, jsx_runtime_1.jsx)(InputComponent, Object.assign({ name: labelInput, version: 'outlined', size: 'small', valueDefault: value__, onChange: onChange__ }, InputProps, { style: {
|
876
|
+
} }, { children: [(0, jsx_runtime_1.jsx)(InputComponent, Object.assign({ name: labelInput, version: 'outlined', size: 'small', valueDefault: value__, onChange: onChange__, placeholder: placeholderInputProps, flex: true }, InputProps, { style: {
|
863
877
|
width: 'unset',
|
864
878
|
flex: '1 1 auto'
|
865
879
|
} })), (0, jsx_runtime_1.jsx)(Button, Object.assign({ color: 'inherit', version: 'text', size: 'small', onClick: onClick }, { children: labelButton }))] })) })));
|
@@ -895,9 +909,16 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
895
909
|
textMethod('link-add')(refs.inputValues.current.link);
|
896
910
|
updateOpen('linkMiniMenu', false);
|
897
911
|
updateInputValues('link', '');
|
898
|
-
}, className: classes.
|
912
|
+
}, className: classes.input }) }))) }, { children: (0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Insert Link'), open: refs.open.current.linkMiniMenu ? false : undefined }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({ ref: refs.miniMenuElements.linkAdd }, ToggleButtonProps, { selected: refs.open.current.linkMiniMenu, onClick: () => updateOpen('linkMiniMenu', !refs.open.current.linkMiniMenu) }, { children: (0, jsx_runtime_1.jsx)(IconMaterialAddLinkW100_1.default, Object.assign({}, IconProps)) })) })) }))),
|
899
913
|
'link-remove': ((0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Remove Link') }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({}, ToggleButtonProps, { onClick: textMethod('link-remove') }, { children: (0, jsx_runtime_1.jsx)(IconMaterialLinkOffW100_1.default, Object.assign({}, IconProps)) })) }))),
|
900
|
-
'font-color': ((0, jsx_runtime_1.jsx)(WrapperAppend, Object.assign({ open: refs.open.current.color, anchorElement: refs.elements.color.current, element: ((0, jsx_runtime_1.jsx)(ClickListener, Object.assign({ onClickOutside: () => updateOpen('color', false), include: [refs.elements.color.current] }, { children: (0, jsx_runtime_1.jsx)(Palette, { version: 'font-color', onClose: () => updateOpen('color', false), onUpdate:
|
914
|
+
'font-color': ((0, jsx_runtime_1.jsx)(WrapperAppend, Object.assign({ open: refs.open.current.color, anchorElement: refs.elements.color.current, element: ((0, jsx_runtime_1.jsx)(ClickListener, Object.assign({ onClickOutside: () => updateOpen('color', false), include: [refs.elements.color.current] }, { children: (0, jsx_runtime_1.jsx)(Palette, { version: 'font-color', onClose: () => updateOpen('color', false), onUpdate: () => {
|
915
|
+
if (refs.range.current) {
|
916
|
+
const selection_ = refs.rootWindow.current.getSelection();
|
917
|
+
selection_.removeAllRanges();
|
918
|
+
selection_.addRange(refs.range.current);
|
919
|
+
}
|
920
|
+
textMethod('font-color');
|
921
|
+
} }) }))) }, { children: (0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Text Color'), open: refs.open.current.color ? false : undefined }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({ ref: refs.elements.color }, ToggleButtonProps, { selected: refs.open.current.color, onClick: () => updateOpen('color', !refs.open.current.color) }, { children: (0, jsx_runtime_1.jsx)(IconMaterialFormatColorTextW100_1.default, Object.assign({}, IconProps)) })) })) }))),
|
901
922
|
'font-color-mini-menu': ((0, jsx_runtime_1.jsx)(WrapperAppend, Object.assign({ open: refs.open.current.colorMiniMenu, anchorElement: refs.miniMenuElements.color, element: ((0, jsx_runtime_1.jsx)(ClickListener, Object.assign({ onClickOutside: () => updateOpen('colorMiniMenu', false), include: [refs.miniMenuElements.color] }, { children: (0, jsx_runtime_1.jsx)(Palette, { ref: refs.miniMenuElements.colorPalette, version: 'font-color', onClose: () => updateOpen('colorMiniMenu', false), onUpdate: textMethod('font-color') }) }))) }, { children: (0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Text Color'), open: refs.open.current.colorMiniMenu ? false : undefined }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({ ref: refs.miniMenuElements.color }, ToggleButtonProps, { selected: refs.open.current.colorMiniMenu, onClick: () => updateOpen('colorMiniMenu', !refs.open.current.colorMiniMenu) }, { children: (0, jsx_runtime_1.jsx)(IconMaterialFormatColorTextW100_1.default, Object.assign({}, IconProps)) })) })) }))),
|
902
923
|
'font-background': ((0, jsx_runtime_1.jsx)(WrapperAppend, Object.assign({ open: refs.open.current.background, anchorElement: refs.elements.background.current, element: ((0, jsx_runtime_1.jsx)(ClickListener, Object.assign({ onClickOutside: () => updateOpen('background', false), include: [refs.elements.background.current] }, { children: (0, jsx_runtime_1.jsx)(Palette, { version: 'font-background', onClose: () => updateOpen('background', false), onUpdate: textMethod('font-background') }) }))) }, { children: (0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Background Color'), open: refs.open.current.background ? false : undefined }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({ ref: refs.elements.background }, ToggleButtonProps, { selected: refs.open.current.background, onClick: () => updateOpen('background', !refs.open.current.background) }, { children: (0, jsx_runtime_1.jsx)(IconMaterialFormatColorFillW100_1.default, Object.assign({}, IconProps)) })) })) }))),
|
903
924
|
'font-background-mini-menu': ((0, jsx_runtime_1.jsx)(WrapperAppend, Object.assign({ open: refs.open.current.backgroundMiniMenu, anchorElement: refs.miniMenuElements.background, element: ((0, jsx_runtime_1.jsx)(ClickListener, Object.assign({ onClickOutside: () => updateOpen('backgroundMiniMenu', false), include: [refs.miniMenuElements.background] }, { children: (0, jsx_runtime_1.jsx)(Palette, { ref: refs.miniMenuElements.backgroundPalette, version: 'font-background', onClose: () => updateOpen('backgroundMiniMenu', false), onUpdate: textMethod('font-background') }) }))) }, { children: (0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Text Color'), open: refs.open.current.backgroundMiniMenu ? false : undefined }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({ ref: refs.miniMenuElements.background }, ToggleButtonProps, { selected: refs.open.current.backgroundMiniMenu, onClick: () => updateOpen('backgroundMiniMenu', !refs.open.current.backgroundMiniMenu) }, { children: (0, jsx_runtime_1.jsx)(IconMaterialFormatColorFillW100_1.default, Object.assign({}, IconProps)) })) })) }))),
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
4
|
const _excluded = ["name", "value", "onChange", "min", "max", "children", "className"],
|
5
|
-
_excluded2 = ["name", "version", "size", "valueDefault", "value", "valueColor", "valueOpacity", "onChange", "onChangeColor", "onChangeOpacity", "opacity", "className"];
|
5
|
+
_excluded2 = ["name", "version", "size", "valueDefault", "value", "valueColor", "valueOpacity", "onChange", "onChangeColor", "onChangeOpacity", "WrapperProps", "opacity", "className", "style"];
|
6
6
|
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; }
|
7
7
|
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; }
|
8
8
|
import React from 'react';
|
@@ -114,8 +114,10 @@ const ColorTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
114
114
|
onChange: onChange_,
|
115
115
|
onChangeColor: onChangeColor_,
|
116
116
|
onChangeOpacity: onChangeOpacity_,
|
117
|
+
WrapperProps,
|
117
118
|
opacity,
|
118
|
-
className
|
119
|
+
className,
|
120
|
+
style
|
119
121
|
} = props,
|
120
122
|
other = _objectWithoutProperties(props, _excluded2);
|
121
123
|
const {
|
@@ -192,16 +194,16 @@ const ColorTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
192
194
|
onChange: event => opacity ? onChangeColor(event.target.value) : onChange(event.target.value),
|
193
195
|
className: classNames([staticClassName('ColorTextField', theme) && ['onesy-ColorTextField-input-color'], classes.inputColor])
|
194
196
|
}),
|
195
|
-
className: classNames([staticClassName('ColorTextField', theme) && ['onesy-ColorTextField-root', `onesy-ColorTextField-version-${version}`, `onesy-ColorTextField-size-${size}`], classes.root]),
|
196
|
-
fullWidth: opacity
|
197
|
+
className: classNames([staticClassName('ColorTextField', theme) && ['onesy-ColorTextField-root', `onesy-ColorTextField-version-${version}`, `onesy-ColorTextField-size-${size}`], className, classes.root]),
|
198
|
+
fullWidth: opacity,
|
199
|
+
style: style
|
197
200
|
}, !opacity && other));
|
198
201
|
if (opacity) {
|
199
202
|
return /*#__PURE__*/React.createElement(Line, _extends({
|
200
203
|
ref: ref,
|
201
204
|
gap: 1,
|
202
|
-
fullWidth: true
|
203
|
-
|
204
|
-
}, other), root, /*#__PURE__*/React.createElement(SliderInput, {
|
205
|
+
fullWidth: true
|
206
|
+
}, WrapperProps), root, /*#__PURE__*/React.createElement(SliderInput, {
|
205
207
|
name: l('Opacity'),
|
206
208
|
value: valueOpacity,
|
207
209
|
onChange: onChangeOpacity,
|
@@ -380,7 +380,7 @@ const RichTextEditor = /*#__PURE__*/React.forwardRef((props__, ref) => {
|
|
380
380
|
}, [value]);
|
381
381
|
React.useEffect(() => {
|
382
382
|
const selection_ = refs.rootWindow.current.getSelection();
|
383
|
-
if (selection_.anchorNode && !selection_.anchorNode?.className?.includes('TextField')) refs.range.current = selection_.getRangeAt(0);
|
383
|
+
if (selection_ && selection_.anchorNode && !selection_.anchorNode?.className?.includes('TextField')) refs.range.current = selection_.getRangeAt(0);
|
384
384
|
}, [open]);
|
385
385
|
React.useEffect(() => {
|
386
386
|
if (!selection) {
|
@@ -4,7 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
const _excluded = ["tonal", "color", "version", "size", "valueDefault", "value", "inputProps", "onChange", "error", "name", "placeholder", "edit", "mention", "multiline", "onChangeMention", "optionsMention", "error", "helperText", "mentionLabel", "onKeyDown", "pasteText", "readOnly", "additional", "miniMenuExtended", "HelperTextProps", "ColorTextFieldProps", "className"],
|
5
5
|
_excluded2 = ["color"],
|
6
6
|
_excluded3 = ["version", "onUpdate", "onClose"],
|
7
|
-
_excluded4 = ["label", "labelButton", "value", "onChange", "onClick", "InputComponent", "InputProps"],
|
7
|
+
_excluded4 = ["label", "labelButton", "value", "onChange", "onClick", "placeholder", "InputComponent", "InputProps"],
|
8
8
|
_excluded5 = ["open", "element", "anchorElement", "onClose", "children"],
|
9
9
|
_excluded6 = ["open", "name", "children"];
|
10
10
|
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; }
|
@@ -54,7 +54,10 @@ const useStyle = styleMethod(theme => ({
|
|
54
54
|
'& .onesy-TextField-input': _objectSpread({
|
55
55
|
wordBreak: 'break-word',
|
56
56
|
color: theme.methods.palette.color.value('primary', 10)
|
57
|
-
}, theme.typography.values.b2)
|
57
|
+
}, theme.typography.values.b2),
|
58
|
+
'& ul, ol': {
|
59
|
+
listStylePosition: 'inside'
|
60
|
+
}
|
58
61
|
},
|
59
62
|
root_type: {
|
60
63
|
minHeight: '20px',
|
@@ -85,7 +88,7 @@ const useStyle = styleMethod(theme => ({
|
|
85
88
|
boxShadow: theme.shadows.values.default[2]
|
86
89
|
},
|
87
90
|
textMiniMenuAdditionalMenu: {
|
88
|
-
|
91
|
+
minWidth: 'clamp(140px, 90%, 250px)',
|
89
92
|
zIndex: '1514'
|
90
93
|
},
|
91
94
|
inputWrapper: {
|
@@ -97,7 +100,7 @@ const useStyle = styleMethod(theme => ({
|
|
97
100
|
whiteSpace: 'nowrap',
|
98
101
|
overflow: 'hidden'
|
99
102
|
},
|
100
|
-
|
103
|
+
input: {
|
101
104
|
'&.onesy-TextField-root': {
|
102
105
|
flex: '1 1 auto !important'
|
103
106
|
}
|
@@ -120,7 +123,9 @@ const useStyle = styleMethod(theme => ({
|
|
120
123
|
}
|
121
124
|
},
|
122
125
|
textFieldColor: {
|
123
|
-
|
126
|
+
'&.onesy-ColorTextField-root': {
|
127
|
+
flex: '1 1 auto'
|
128
|
+
}
|
124
129
|
},
|
125
130
|
helperText: {
|
126
131
|
display: 'inline-flex',
|
@@ -641,6 +646,8 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
641
646
|
const onMouseDown = React.useCallback(() => {
|
642
647
|
if (!refs.edit.current) return;
|
643
648
|
textQueryUpdate();
|
649
|
+
const selection_ = refs.rootWindow.current.getSelection();
|
650
|
+
if (selection_.anchorNode && !selection_.anchorNode?.className?.includes('TextField')) refs.range.current = selection_.getRangeAt(0);
|
644
651
|
}, []);
|
645
652
|
const onKeyUp = React.useCallback(() => {
|
646
653
|
if (!refs.edit.current) return;
|
@@ -811,7 +818,12 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
811
818
|
}, other_), /*#__PURE__*/React.createElement(Line, {
|
812
819
|
gap: 0.5,
|
813
820
|
onMouseUp: onMouseUp,
|
814
|
-
onMouseDown: onMouseDown
|
821
|
+
onMouseDown: onMouseDown,
|
822
|
+
style: {
|
823
|
+
maxHeight: 136,
|
824
|
+
padding: '10px 10px 0',
|
825
|
+
overflow: 'hidden auto'
|
826
|
+
}
|
815
827
|
}, /*#__PURE__*/React.createElement(Line, {
|
816
828
|
gap: 0.5,
|
817
829
|
direction: "row",
|
@@ -855,7 +867,7 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
855
867
|
align: "center",
|
856
868
|
fullWidth: true,
|
857
869
|
style: {
|
858
|
-
padding:
|
870
|
+
padding: '0px 10px 10px'
|
859
871
|
}
|
860
872
|
}, /*#__PURE__*/React.createElement(ColorTextField, _extends({
|
861
873
|
tonal: tonal,
|
@@ -909,6 +921,7 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
909
921
|
value: value__,
|
910
922
|
onChange: onChange__,
|
911
923
|
onClick,
|
924
|
+
placeholder: placeholderInputProps,
|
912
925
|
InputComponent = TextField,
|
913
926
|
InputProps
|
914
927
|
} = propsInput,
|
@@ -933,7 +946,9 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
933
946
|
version: "outlined",
|
934
947
|
size: "small",
|
935
948
|
valueDefault: value__,
|
936
|
-
onChange: onChange__
|
949
|
+
onChange: onChange__,
|
950
|
+
placeholder: placeholderInputProps,
|
951
|
+
flex: true
|
937
952
|
}, InputProps, {
|
938
953
|
style: {
|
939
954
|
width: 'unset',
|
@@ -1042,7 +1057,7 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
1042
1057
|
updateOpen('linkMiniMenu', false);
|
1043
1058
|
updateInputValues('link', '');
|
1044
1059
|
},
|
1045
|
-
className: classes.
|
1060
|
+
className: classes.input
|
1046
1061
|
}))
|
1047
1062
|
}, /*#__PURE__*/React.createElement(WrapperToggleButton, {
|
1048
1063
|
name: l('Insert Link'),
|
@@ -1067,7 +1082,14 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
1067
1082
|
}, /*#__PURE__*/React.createElement(Palette, {
|
1068
1083
|
version: "font-color",
|
1069
1084
|
onClose: () => updateOpen('color', false),
|
1070
|
-
onUpdate:
|
1085
|
+
onUpdate: () => {
|
1086
|
+
if (refs.range.current) {
|
1087
|
+
const selection_ = refs.rootWindow.current.getSelection();
|
1088
|
+
selection_.removeAllRanges();
|
1089
|
+
selection_.addRange(refs.range.current);
|
1090
|
+
}
|
1091
|
+
textMethod('font-color');
|
1092
|
+
}
|
1071
1093
|
}))
|
1072
1094
|
}, /*#__PURE__*/React.createElement(WrapperToggleButton, {
|
1073
1095
|
name: l('Text Color'),
|
package/esm/index.js
CHANGED