@invoicebox/ui 0.1.0-alpha.236 → 0.1.0-alpha.239

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.
@@ -75,6 +75,16 @@ var TagsInput = exports.TagsInput = function TagsInput(_ref) {
75
75
  clearNewValueAutofillInterval();
76
76
  acceptNewValue(target.value);
77
77
  }
78
+ if (event.key === 'Backspace' && inputValue === '' && value !== null && value !== void 0 && value.length) {
79
+ // нужно чтобы после выполнения кода ниже - в handleChange не передалось значение и автоматически ч-з backspace не стёрся крайний символ
80
+ event.preventDefault();
81
+ var lastTagValue = value[value.length - 1];
82
+ setInputValue(lastTagValue);
83
+ handleTagRemove(lastTagValue);
84
+ newValueAutofillIntervalRef.current = setTimeout(function () {
85
+ acceptNewValue(lastTagValue);
86
+ }, 3000);
87
+ }
78
88
  };
79
89
  var handleTagRemove = function handleTagRemove(tagRemoved) {
80
90
  var valueWithoutRemovedTag = value === null || value === void 0 ? void 0 : value.filter(function (tagItem) {
@@ -93,6 +103,13 @@ var TagsInput = exports.TagsInput = function TagsInput(_ref) {
93
103
  acceptNewValue(event.target.value);
94
104
  }
95
105
  };
106
+ var handleChipClick = function handleChipClick(chipValue) {
107
+ setInputValue(chipValue);
108
+ handleTagRemove(chipValue);
109
+ newValueAutofillIntervalRef.current = setTimeout(function () {
110
+ acceptNewValue(chipValue);
111
+ }, 3000);
112
+ };
96
113
  return /*#__PURE__*/_react["default"].createElement(_InputLabel.InputLabel, {
97
114
  label: label
98
115
  }, /*#__PURE__*/_react["default"].createElement(S.PureInputStyledWrapper, {
@@ -110,7 +127,10 @@ var TagsInput = exports.TagsInput = function TagsInput(_ref) {
110
127
  return /*#__PURE__*/_react["default"].createElement(_Chip.Chip, {
111
128
  key: tagItem + index,
112
129
  label: /*#__PURE__*/_react["default"].createElement(S.ChipLabel, null, /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
113
- variant: 'labelsHintsBold'
130
+ variant: 'labelsHintsBold',
131
+ onClick: function onClick() {
132
+ return handleChipClick(tagItem);
133
+ }
114
134
  }, tagItem), /*#__PURE__*/_react["default"].createElement(S.ChipRemoveButton, {
115
135
  type: 'button',
116
136
  onClick: function onClick() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invoicebox/ui",
3
- "version": "0.1.0-alpha.236",
3
+ "version": "0.1.0-alpha.239",
4
4
  "description": "Invoicebox UI",
5
5
  "license": "Apache License 2.0",
6
6
  "scripts": {