@onesy/ui-react 1.0.98 → 1.0.99

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.
@@ -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_.anchorNode &&
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
- width: 'clamp(140px, 90%, 250px)',
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
- inputLink: {
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
- flex: '1 1 auto'
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 }, { children: [(0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0.5, direction: 'row', style: {
810
+ ]) }, other_, { children: [(0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0.5, onMouseUp: onMouseUp, onMouseDown: onMouseDown, style: {
811
+ maxHeight: 136,
812
+ padding: 10,
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');
@@ -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,7 +909,7 @@ 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.inputLink }) }))) }, { 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)) })) })) }))),
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
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: textMethod('font-color') }) }))) }, { 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
915
  '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)) })) })) }))),
@@ -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
- width: 'clamp(140px, 90%, 250px)',
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
- inputLink: {
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
- flex: '1 1 auto'
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: 10,
825
+ overflow: 'hidden auto'
826
+ }
815
827
  }, /*#__PURE__*/React.createElement(Line, {
816
828
  gap: 0.5,
817
829
  direction: "row",
@@ -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.inputLink
1060
+ className: classes.input
1046
1061
  }))
1047
1062
  }, /*#__PURE__*/React.createElement(WrapperToggleButton, {
1048
1063
  name: l('Insert Link'),
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license UiReact v1.0.98
1
+ /** @license UiReact v1.0.99
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onesy/ui-react",
3
- "version": "1.0.98",
3
+ "version": "1.0.99",
4
4
  "description": "UI for React",
5
5
  "repository": "https://github.com/onesy-me/onesy.git",
6
6
  "author": "Lazar <lazareric2@gmail.com>",