@desynova-digital/components 9.2.52 → 9.3.1

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.
@@ -22,7 +22,7 @@ var _excluded = ["maxLength", "defaultValue", "label", "showLengthCount", "error
22
22
  var _templateObject, _templateObject2, _templateObject3, _templateObject4;
23
23
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
24
24
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
25
- var RichTextInputDiv = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n i,\n em {\n font-style: italic;\n }\n strong {\n font-weight: bold;\n }\n .quill-editor-content {\n white-space: pre-wrap; /* Preserve whitespace and line breaks */\n }\n background: transparent;\n font-family: \"SFUIText-Medium\";\n position: relative;\n width: 92%;\n width: ", ";\n margin-bottom: ", ";\n margin-top: ", ";\n\n display: block;\n .ql-container.ql-snow {\n border: none;\n position: relative;\n }\n .ql-editor {\n padding: 0;\n position: relative;\n }\n\n // Custom placeholder styles - this will show the placeholder value from props\n .ql-editor.ql-blank::before {\n color: #999999 !important;\n font-style: normal !important;\n font-family: \"SFUIText-Medium\" !important;\n font-size: 14px !important;\n left: 0 !important;\n right: auto !important;\n opacity: 1 !important;\n visibility: visible !important;\n display: block !important;\n position: absolute !important;\n content: attr(data-placeholder) !important;\n pointer-events: none !important;\n }\n\n // Ensure placeholder is visible even when not focused\n .ql-editor.ql-blank {\n position: relative;\n\n &::before {\n display: block !important;\n opacity: 1 !important;\n visibility: visible !important;\n }\n }\n\n > label {\n color: #999999;\n font-size: 14px;\n font-family: inherit;\n position: absolute;\n pointer-events: none;\n left: 0px;\n top: 5px;\n transition: 0.2s ease all;\n -moz-transition: 0.2s ease all;\n -webkit-transition: 0.2s ease all;\n }\n > div:focus ~ label {\n top: -10px;\n left: 0px;\n font-size: 10px;\n color: #999999;\n text-transform: capitalize;\n }\n > div ~ label.floaton {\n top: -10px;\n left: 0px;\n font-size: 10px;\n color: #999999;\n text-transform: capitalize;\n }\n"])), function (props) {
25
+ var RichTextInputDiv = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n i,\n em {\n font-style: italic;\n }\n strong {\n font-weight: bold;\n }\n .quill-editor-content {\n white-space: pre-wrap; /* Preserve whitespace and line breaks */\n }\n background: transparent;\n font-family: \"SFUIText-Regular\";\n position: relative;\n width: 92%;\n width: ", ";\n margin-bottom: ", ";\n margin-top: ", ";\n\n display: block;\n .ql-container.ql-snow {\n border: none;\n position: relative;\n }\n .ql-editor {\n padding: 0;\n position: relative;\n }\n\n // Custom placeholder styles - this will show the placeholder value from props\n .ql-editor.ql-blank::before {\n color: #999999 !important;\n font-style: normal !important;\n font-family: \"SFUIText-Regular\" !important;\n font-size: 13px !important;\n left: 0 !important;\n right: auto !important;\n opacity: 1 !important;\n visibility: visible !important;\n display: block !important;\n position: absolute !important;\n content: attr(data-placeholder) !important;\n pointer-events: none !important;\n }\n\n // Ensure placeholder is visible even when not focused\n .ql-editor.ql-blank {\n position: relative;\n\n &::before {\n display: block !important;\n opacity: 1 !important;\n visibility: visible !important;\n }\n }\n\n > label {\n color: #999999;\n font-size: 14px;\n font-family: inherit;\n position: absolute;\n pointer-events: none;\n left: 0px;\n top: 5px;\n transition: 0.2s ease all;\n -moz-transition: 0.2s ease all;\n -webkit-transition: 0.2s ease all;\n }\n > div:focus ~ label {\n top: -10px;\n left: 0px;\n font-size: 10px;\n color: #999999;\n text-transform: capitalize;\n }\n > div ~ label.floaton {\n top: -10px;\n left: 0px;\n font-size: 10px;\n color: #999999;\n text-transform: capitalize;\n }\n"])), function (props) {
26
26
  return props.sleek === "sleek" ? "100%" : "92%";
27
27
  }, function (props) {
28
28
  return props.sleek === "sleek" ? "" : "10px";
@@ -112,12 +112,19 @@ var RichTextInputV2 = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
112
112
  // Initialize quill
113
113
  (0, _react.useEffect)(function () {
114
114
  if (!(quillInstance !== null && quillInstance !== void 0 && quillInstance.current)) {
115
+ // Get the keyboard module and remove list autofill binding
116
+ var Keyboard = _quill["default"]["import"]("modules/keyboard");
117
+
118
+ // Remove the list autofill binding
119
+ if (Keyboard && Keyboard.DEFAULTS && Keyboard.DEFAULTS.bindings) {
120
+ delete Keyboard.DEFAULTS.bindings["list autofill"];
121
+ }
115
122
  var quill = new _quill["default"](quillRef.current, {
116
123
  theme: "snow",
117
124
  placeholder: placeholder,
125
+ readOnly: isDisabled,
118
126
  modules: {
119
127
  toolbar: false,
120
- readOnly: isDisabled,
121
128
  keyboard: {
122
129
  bindings: {
123
130
  // This will overwrite the default binding for Tab
@@ -153,10 +160,21 @@ var RichTextInputV2 = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
153
160
  }
154
161
  });
155
162
 
156
- // Ensure plain text is pasted instead of formatted content
163
+ // quill.root.addEventListener("paste", function(e) {
164
+ // e.preventDefault();
165
+ // const text = (e.clipboardData || window.clipboardData).getData(
166
+ // "text/plain",
167
+ // );
168
+ // const range = quill.getSelection();
169
+ // if (range) {
170
+ // quill.insertText(range.index, text);
171
+ // }
172
+ // });
173
+
174
+ //prevention from double pasting of code.
157
175
  quill.clipboard.addMatcher(Node.ELEMENT_NODE, function (node, delta) {
158
176
  var plainText = node.innerText || node.textContent; // Extract plain text
159
- return new _quillDelta["default"]().insert(plainText); // Insert plain text without formatting
177
+ return new _quillDelta["default"]().insert(plainText);
160
178
  });
161
179
  quillInstance.current = quill;
162
180
  if (quill.root) {
@@ -199,6 +217,11 @@ var RichTextInputV2 = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
199
217
  quillRef.current.innerHTML = "";
200
218
  };
201
219
  }, []);
220
+ (0, _react.useEffect)(function () {
221
+ if (quillInstance.current) {
222
+ quillInstance.current.enable(!isDisabled);
223
+ }
224
+ }, [isDisabled]);
202
225
  (0, _react.useEffect)(function () {
203
226
  if (quillInstance.current) {
204
227
  var editorContainer = quillInstance.current.root;
@@ -206,7 +229,10 @@ var RichTextInputV2 = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
206
229
  handleSave(html);
207
230
  }, 0);
208
231
  var handleKeyDown = function handleKeyDown(event) {
209
- if (event.key === "Enter" && !event.altKey) {
232
+ if (event.key === "Enter") {
233
+ if (event.altKey || event.metaKey) {
234
+ return;
235
+ }
210
236
  event.preventDefault();
211
237
  event.stopPropagation();
212
238
  var html = quillInstance.current.getSemanticHTML();
@@ -300,7 +326,7 @@ var returnPadding = function returnPadding(props) {
300
326
  return "7px 0px 2px 0px";
301
327
  }
302
328
  };
303
- var RichTextEditorContainer = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 48px;\n overflow-y: scroll;\n ::-webkit-scrollbar {\n width: 0;\n background: transparent;\n }\n white-space: nowrap;\n width: 100%;\n text-wrap: wrap;\n box-sizing: border-box;\n font-family: \"SFUIText-Medium\";\n font-size: 14px;\n color: ", ";\n border-bottom: ", ";\n\n display: inline-block;\n position: relative;\n padding: ", ";\n &:hover {\n border-color: ", ";\n }\n\n &:focus-within {\n border-color: ", ";\n }\n\n &::placeholder {\n color: ", ";\n opacity: ", ";\n transition: 0.2s ease all;\n }\n\n &:focus-within::placeholder {\n color: ", ";\n opacity: ", ";\n }\n"])), function (props) {
329
+ var RichTextEditorContainer = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 48px;\n overflow-y: scroll;\n ::-webkit-scrollbar {\n width: 0;\n background: transparent;\n }\n white-space: nowrap;\n width: 100%;\n text-wrap: wrap;\n box-sizing: border-box;\n font-family: \"SFUIText-Regular\";\n font-size: 13px;\n color: ", ";\n border-bottom: ", ";\n\n display: inline-block;\n position: relative;\n padding: ", ";\n &:hover {\n border-color: ", ";\n }\n\n &:focus-within {\n border-color: ", ";\n }\n\n &::placeholder {\n color: ", ";\n opacity: ", ";\n transition: 0.2s ease all;\n }\n\n &:focus-within::placeholder {\n color: ", ";\n opacity: ", ";\n }\n"])), function (props) {
304
330
  return props.theme === "light" ? _tokens.colors.light.inputCommon.color : _tokens.colors.dark.inputCommon.color;
305
331
  }, function (props) {
306
332
  return !props.hideBorder ? props.theme === "light" ? _tokens.colors.light.inputCommon.color : _tokens.colors.dark.inputCommon.color : "none";
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@desynova-digital/components",
3
- "version": "9.2.52",
3
+ "version": "9.3.1",
4
4
  "description": "Components for Desynova Digital",
5
5
  "main": "index.js",
6
6
  "author": "desynova-digital",
7
7
  "license": "MIT",
8
8
  "repository": "desynova-digital",
9
9
  "dependencies": {
10
- "@desynova-digital/tokens": "9.2.52",
10
+ "@desynova-digital/tokens": "9.3.1",
11
11
  "prop-types": "^15.7.2",
12
12
  "styled-components": "^4.3.2"
13
13
  },