diff --git a/dist/react.tagify.js b/dist/react.tagify.js index cde2d08f..ca375a0b 100644 --- a/dist/react.tagify.js +++ b/dist/react.tagify.js @@ -89,6 +89,7 @@ const TagifyWrapper = ({ onDropdownNoMatch = noop, onDropdownUpdated = noop, readOnly, + disabled, children, settings = {}, InputMode = "input", @@ -112,6 +113,7 @@ const TagifyWrapper = ({ defaultValue: children || typeof _value == 'string' ? _value : JSON.stringify(_value), className, readOnly, + disabled, autoFocus, placeholder }), []); @@ -166,9 +168,9 @@ const TagifyWrapper = ({ }, [loading]); (0, _react.useEffect)(() => { if (mountedRef.current) { - tagify.current.setReadonly(readOnly); + tagify.current.setReadonly(readOnly || disabled); } - }, [readOnly]); + }, [readOnly, disabled]); (0, _react.useEffect)(() => { const t = tagify.current; diff --git a/dist/tagify.min.js b/dist/tagify.min.js index f360c0ce..fff16ce7 100644 --- a/dist/tagify.min.js +++ b/dist/tagify.min.js @@ -1819,7 +1819,7 @@ var _s = this.settings = extend({}, DEFAULTS, settings); - _s.readonly = input.hasAttribute('readonly'); // if "readonly" do not include an "input" element inside the Tags component + _s.readonly = input.hasAttribute('readonly') || input.hasAttribute('disabled'); // if "readonly" do not include an "input" element inside the Tags component _s.placeholder = input.getAttribute('placeholder') || _s.placeholder || ""; _s.required = input.hasAttribute('required'); diff --git a/src/react.tagify.js b/src/react.tagify.js index 8de89fd0..2965bee0 100644 --- a/src/react.tagify.js +++ b/src/react.tagify.js @@ -49,6 +49,7 @@ const TagifyWrapper = ({ onDropdownNoMatch = noop, onDropdownUpdated = noop, readOnly, + disabled, children, settings = {}, InputMode = "input", @@ -71,6 +72,7 @@ const TagifyWrapper = ({ defaultValue: children || typeof _value == 'string' ? _value : JSON.stringify(_value), className, readOnly, + disabled, autoFocus, placeholder, }), []) @@ -164,9 +166,9 @@ const TagifyWrapper = ({ useEffect(() => { if (mountedRef.current) { - tagify.current.setReadonly(readOnly) + tagify.current.setReadonly(readOnly || disabled) } - }, [readOnly]) + }, [readOnly, disabled]) useEffect(() => { const t = tagify.current diff --git a/src/tagify.js b/src/tagify.js index 840e90a4..c894b171 100644 --- a/src/tagify.js +++ b/src/tagify.js @@ -97,7 +97,7 @@ Tagify.prototype = { var _s = this.settings = extend({}, DEFAULTS, settings) - _s.readonly = input.hasAttribute('readonly') // if "readonly" do not include an "input" element inside the Tags component + _s.readonly = input.hasAttribute('readonly') || input.hasAttribute('disabled') // if "readonly" do not include an "input" element inside the Tags component _s.placeholder = input.getAttribute('placeholder') || _s.placeholder || "" _s.required = input.hasAttribute('required')