@salutejs/plasma-new-hope 0.184.0-canary.1533.11640514070.0 → 0.184.0-canary.1536.11682091417.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ var base$5 = require('./variations/_pilled/base.js');
15
15
  var Chip_styles = require('./Chip.styles.js');
16
16
  var Chip_tokens = require('./Chip.tokens.js');
17
17
 
18
- var _excluded = ["children", "text", "contentLeft", "contentRight", "contentClearButton", "hasClear", "size", "className", "onClear", "onClick", "pilled", "readOnly", "disabled"];
18
+ var _excluded = ["children", "text", "contentLeft", "contentRight", "contentClearButton", "hasClear", "size", "className", "onClear", "onClick", "onClickClose", "pilled", "readOnly", "disabled"];
19
19
  var chipRoot = function chipRoot(Root) {
20
20
  return /*#__PURE__*/React.forwardRef(function (props, ref) {
21
21
  var children = props.children,
@@ -29,6 +29,7 @@ var chipRoot = function chipRoot(Root) {
29
29
  className = props.className,
30
30
  onClear = props.onClear,
31
31
  onClick = props.onClick,
32
+ onClickClose = props.onClickClose,
32
33
  _props$pilled = props.pilled,
33
34
  pilled = _props$pilled === void 0 ? false : _props$pilled,
34
35
  _props$readOnly = props.readOnly,
@@ -45,12 +46,13 @@ var chipRoot = function chipRoot(Root) {
45
46
  onClick === null || onClick === void 0 || onClick(event);
46
47
  onClear === null || onClear === void 0 || onClear();
47
48
  };
48
- var ClearContent = React.useMemo(function () {
49
- return contentClearButton || /*#__PURE__*/React.createElement(Chip_styles.StyledContentClear, null, /*#__PURE__*/React.createElement(IconClose.IconClose, {
50
- sizeCustomProperty: Chip_tokens.tokens.closeIconSize,
51
- color: "inherit"
52
- }));
53
- }, [contentClearButton, Chip_tokens.tokens.closeIconSize]);
49
+ var handleClickClose = function handleClickClose(event) {
50
+ if (disabled || readOnly || !onClickClose) {
51
+ return;
52
+ }
53
+ event.stopPropagation();
54
+ onClickClose(event);
55
+ };
54
56
  return /*#__PURE__*/React.createElement(Root, _rollupPluginBabelHelpers.extends({
55
57
  type: "button",
56
58
  ref: ref,
@@ -61,7 +63,12 @@ var chipRoot = function chipRoot(Root) {
61
63
  pilled: pilled,
62
64
  readOnly: !disabled && readOnly,
63
65
  size: size
64
- }, rest), contentLeft && /*#__PURE__*/React.createElement(Chip_styles.StyledContentLeft, null, contentLeft), txt ? /*#__PURE__*/React.createElement(Chip_styles.StyledContentMain, null, txt) : children, contentRight && /*#__PURE__*/React.createElement(Chip_styles.StyledContentRight, null, contentRight), hasClear && ClearContent);
66
+ }, rest), contentLeft && /*#__PURE__*/React.createElement(Chip_styles.StyledContentLeft, null, contentLeft), txt ? /*#__PURE__*/React.createElement(Chip_styles.StyledContentMain, null, txt) : children, contentRight && /*#__PURE__*/React.createElement(Chip_styles.StyledContentRight, null, contentRight), hasClear && /*#__PURE__*/React.createElement(Chip_styles.StyledContentClear, {
67
+ onClick: handleClickClose
68
+ }, contentClearButton || /*#__PURE__*/React.createElement(IconClose.IconClose, {
69
+ sizeCustomProperty: Chip_tokens.tokens.closeIconSize,
70
+ color: "inherit"
71
+ })));
65
72
  });
66
73
  };
67
74
  var chipConfig = {
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.js","sources":["../../../src/components/Chip/Chip.tsx"],"sourcesContent":["import React, { forwardRef, useMemo } from 'react';\n\nimport type { RootProps } from '../../engines';\nimport { IconClose } from '../_Icon/Icons/IconClose';\nimport { cx } from '../../utils';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as readonlyCSS } from './variations/_readonly/base';\nimport { base as focusedCSS } from './variations/_focused/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport type { ChipProps } from './Chip.types';\nimport { StyledContentClear, StyledContentLeft, StyledContentMain, StyledContentRight, base } from './Chip.styles';\nimport { classes, tokens } from './Chip.tokens';\n\nexport const chipRoot = (Root: RootProps<HTMLButtonElement, ChipProps>) =>\n forwardRef<HTMLButtonElement, ChipProps>((props, ref) => {\n const {\n children,\n text,\n contentLeft,\n contentRight,\n contentClearButton,\n hasClear = true,\n size,\n className,\n onClear,\n onClick,\n pilled = false,\n readOnly = false,\n disabled = false,\n ...rest\n } = props;\n\n const txt = !text && typeof children === 'string' ? children : text;\n const pilledClass = pilled ? classes.pilled : undefined;\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled || readOnly) {\n return;\n }\n\n onClick?.(event);\n onClear?.();\n };\n\n const ClearContent = useMemo(() => {\n return (\n contentClearButton || (\n <StyledContentClear>\n <IconClose sizeCustomProperty={tokens.closeIconSize} color=\"inherit\" />\n </StyledContentClear>\n )\n );\n }, [contentClearButton, tokens.closeIconSize]);\n\n return (\n <Root\n type=\"button\"\n ref={ref}\n className={cx(pilledClass, classes.chipItem, className)}\n tabIndex={readOnly ? -1 : 0}\n onClick={handleClick}\n disabled={disabled}\n pilled={pilled}\n readOnly={!disabled && readOnly}\n size={size}\n {...rest}\n >\n {contentLeft && <StyledContentLeft>{contentLeft}</StyledContentLeft>}\n {txt ? <StyledContentMain>{txt}</StyledContentMain> : children}\n {contentRight && <StyledContentRight>{contentRight}</StyledContentRight>}\n {hasClear && ClearContent}\n </Root>\n );\n });\n\nexport const chipConfig = {\n name: 'Chip',\n tag: 'button',\n layout: chipRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n readOnly: {\n css: readonlyCSS,\n attrs: true,\n },\n focused: {\n css: focusedCSS,\n },\n pilled: {\n css: pilledCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["chipRoot","Root","forwardRef","props","ref","children","text","contentLeft","contentRight","contentClearButton","_props$hasClear","hasClear","size","className","onClear","onClick","_props$pilled","pilled","_props$readOnly","readOnly","_props$disabled","disabled","rest","_objectWithoutProperties","_excluded","txt","pilledClass","classes","undefined","handleClick","event","ClearContent","useMemo","React","createElement","StyledContentClear","IconClose","sizeCustomProperty","tokens","closeIconSize","color","_extends","type","cx","chipItem","tabIndex","StyledContentLeft","StyledContentMain","StyledContentRight","chipConfig","name","tag","layout","base","variations","view","css","viewCSS","sizeCSS","disabledCSS","attrs","readonlyCSS","focused","focusedCSS","pilledCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;IAgBaA,QAAQ,GAAG,SAAXA,QAAQA,CAAIC,IAA6C,EAAA;AAAA,EAAA,oBAClEC,gBAAU,CAA+B,UAACC,KAAK,EAAEC,GAAG,EAAK;AACrD,IAAA,IACIC,QAAQ,GAcRF,KAAK,CAdLE,QAAQ;MACRC,IAAI,GAaJH,KAAK,CAbLG,IAAI;MACJC,WAAW,GAYXJ,KAAK,CAZLI,WAAW;MACXC,YAAY,GAWZL,KAAK,CAXLK,YAAY;MACZC,kBAAkB,GAUlBN,KAAK,CAVLM,kBAAkB;MAAAC,eAAA,GAUlBP,KAAK,CATLQ,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,eAAA;MACfE,IAAI,GAQJT,KAAK,CARLS,IAAI;MACJC,SAAS,GAOTV,KAAK,CAPLU,SAAS;MACTC,OAAO,GAMPX,KAAK,CANLW,OAAO;MACPC,OAAO,GAKPZ,KAAK,CALLY,OAAO;MAAAC,aAAA,GAKPb,KAAK,CAJLc,MAAM;AAANA,MAAAA,MAAM,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA;MAAAE,eAAA,GAIdf,KAAK,CAHLgB,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,eAAA;MAAAE,eAAA,GAGhBjB,KAAK,CAFLkB,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,eAAA;AACbE,MAAAA,IAAI,GAAAC,iDAAA,CACPpB,KAAK,EAAAqB,SAAA,CAAA,CAAA;AAET,IAAA,IAA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V,IAAAA,IAAI,EAAE,SAAS;AACf3C,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
1
+ {"version":3,"file":"Chip.js","sources":["../../../src/components/Chip/Chip.tsx"],"sourcesContent":["import React, { forwardRef, MouseEvent } from 'react';\n\nimport type { RootProps } from '../../engines';\nimport { IconClose } from '../_Icon/Icons/IconClose';\nimport { cx } from '../../utils';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as readonlyCSS } from './variations/_readonly/base';\nimport { base as focusedCSS } from './variations/_focused/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport type { ChipProps } from './Chip.types';\nimport { StyledContentClear, StyledContentLeft, StyledContentMain, StyledContentRight, base } from './Chip.styles';\nimport { classes, tokens } from './Chip.tokens';\n\nexport const chipRoot = (Root: RootProps<HTMLButtonElement, ChipProps>) =>\n forwardRef<HTMLButtonElement, ChipProps>((props, ref) => {\n const {\n children,\n text,\n contentLeft,\n contentRight,\n contentClearButton,\n hasClear = true,\n size,\n className,\n onClear,\n onClick,\n onClickClose,\n pilled = false,\n readOnly = false,\n disabled = false,\n ...rest\n } = props;\n\n const txt = !text && typeof children === 'string' ? children : text;\n const pilledClass = pilled ? classes.pilled : undefined;\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (disabled || readOnly) {\n return;\n }\n\n onClick?.(event);\n onClear?.();\n };\n\n const handleClickClose = (event: MouseEvent<HTMLDivElement>) => {\n if (disabled || readOnly || !onClickClose) {\n return;\n }\n\n event.stopPropagation();\n onClickClose(event);\n };\n\n return (\n <Root\n type=\"button\"\n ref={ref}\n className={cx(pilledClass, classes.chipItem, className)}\n tabIndex={readOnly ? -1 : 0}\n onClick={handleClick}\n disabled={disabled}\n pilled={pilled}\n readOnly={!disabled && readOnly}\n size={size}\n {...rest}\n >\n {contentLeft && <StyledContentLeft>{contentLeft}</StyledContentLeft>}\n {txt ? <StyledContentMain>{txt}</StyledContentMain> : children}\n {contentRight && <StyledContentRight>{contentRight}</StyledContentRight>}\n {hasClear && (\n <StyledContentClear onClick={handleClickClose}>\n {contentClearButton || <IconClose sizeCustomProperty={tokens.closeIconSize} color=\"inherit\" />}\n </StyledContentClear>\n )}\n </Root>\n );\n });\n\nexport const chipConfig = {\n name: 'Chip',\n tag: 'button',\n layout: chipRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n readOnly: {\n css: readonlyCSS,\n attrs: true,\n },\n focused: {\n css: focusedCSS,\n },\n pilled: {\n css: pilledCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["chipRoot","Root","forwardRef","props","ref","children","text","contentLeft","contentRight","contentClearButton","_props$hasClear","hasClear","size","className","onClear","onClick","onClickClose","_props$pilled","pilled","_props$readOnly","readOnly","_props$disabled","disabled","rest","_objectWithoutProperties","_excluded","txt","pilledClass","classes","undefined","handleClick","event","handleClickClose","stopPropagation","React","createElement","_extends","type","cx","chipItem","tabIndex","StyledContentLeft","StyledContentMain","StyledContentRight","StyledContentClear","IconClose","sizeCustomProperty","tokens","closeIconSize","color","chipConfig","name","tag","layout","base","variations","view","css","viewCSS","sizeCSS","disabledCSS","attrs","readonlyCSS","focused","focusedCSS","pilledCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;IAgBaA,QAAQ,GAAG,SAAXA,QAAQA,CAAIC,IAA6C,EAAA;AAAA,EAAA,oBAClEC,gBAAU,CAA+B,UAACC,KAAK,EAAEC,GAAG,EAAK;AACrD,IAAA,IACIC,QAAQ,GAeRF,KAAK,CAfLE,QAAQ;MACRC,IAAI,GAcJH,KAAK,CAdLG,IAAI;MACJC,WAAW,GAaXJ,KAAK,CAbLI,WAAW;MACXC,YAAY,GAYZL,KAAK,CAZLK,YAAY;MACZC,kBAAkB,GAWlBN,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IyB,KAAA,CAAAC,aAAA,CAACU,mBAAS,EAAA;MAACC,kBAAkB,EAAEC,kBAAM,CAACC,aAAc;AAACC,MAAAA,KAAK,EAAC,SAAA;KAAW,CAC7E,CAEtB,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAMC,UAAU,GAAG;AACtBC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,GAAG,EAAE,QAAQ;AACbC,EAAAA,MAAM,EAAErD,QAAQ;AAChBsD,EAAAA,IAAI,EAAJA,gBAAI;AACJC,EAAAA,UAAU,EAAE;AACRC,IAAAA,IAAI,EAAE;AACFC,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACD9C,IAAAA,IAAI,EAAE;AACF6C,MAAAA,GAAG,EAAEE,WAAAA;KACR;AACDrC,IAAAA,QAAQ,EAAE;AACNmC,MAAAA,GAAG,EAAEG,WAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACDzC,IAAAA,QAAQ,EAAE;AACNqC,MAAAA,GAAG,EAAEK,WAAW;AAChBD,MAAAA,KAAK,EAAE,IAAA;KACV;AACDE,IAAAA,OAAO,EAAE;AACLN,MAAAA,GAAG,EAAEO,WAAAA;KACR;AACD9C,IAAAA,MAAM,EAAE;AACJuC,MAAAA,GAAG,EAAEQ,WAAS;AACdJ,MAAAA,KAAK,EAAE,IAAA;AACX,KAAA;GACH;AACDK,EAAAA,QAAQ,EAAE;AACNV,IAAAA,IAAI,EAAE,SAAS;AACf5C,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
@@ -16,7 +16,7 @@ var _base5 = /*#__PURE__*/require("./variations/_focused/base");
16
16
  var _base6 = /*#__PURE__*/require("./variations/_pilled/base");
17
17
  var _Chip = /*#__PURE__*/require("./Chip.styles");
18
18
  var _Chip2 = /*#__PURE__*/require("./Chip.tokens");
19
- var _excluded = ["children", "text", "contentLeft", "contentRight", "contentClearButton", "hasClear", "size", "className", "onClear", "onClick", "pilled", "readOnly", "disabled"];
19
+ var _excluded = ["children", "text", "contentLeft", "contentRight", "contentClearButton", "hasClear", "size", "className", "onClear", "onClick", "onClickClose", "pilled", "readOnly", "disabled"];
20
20
  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); }
21
21
  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; }
22
22
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -35,6 +35,7 @@ var chipRoot = exports.chipRoot = function chipRoot(Root) {
35
35
  className = props.className,
36
36
  onClear = props.onClear,
37
37
  onClick = props.onClick,
38
+ onClickClose = props.onClickClose,
38
39
  _props$pilled = props.pilled,
39
40
  pilled = _props$pilled === void 0 ? false : _props$pilled,
40
41
  _props$readOnly = props.readOnly,
@@ -51,12 +52,13 @@ var chipRoot = exports.chipRoot = function chipRoot(Root) {
51
52
  onClick === null || onClick === void 0 || onClick(event);
52
53
  onClear === null || onClear === void 0 || onClear();
53
54
  };
54
- var ClearContent = (0, _react.useMemo)(function () {
55
- return contentClearButton || /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentClear, null, /*#__PURE__*/_react["default"].createElement(_IconClose.IconClose, {
56
- sizeCustomProperty: _Chip2.tokens.closeIconSize,
57
- color: "inherit"
58
- }));
59
- }, [contentClearButton, _Chip2.tokens.closeIconSize]);
55
+ var handleClickClose = function handleClickClose(event) {
56
+ if (disabled || readOnly || !onClickClose) {
57
+ return;
58
+ }
59
+ event.stopPropagation();
60
+ onClickClose(event);
61
+ };
60
62
  return /*#__PURE__*/_react["default"].createElement(Root, _extends({
61
63
  type: "button",
62
64
  ref: ref,
@@ -67,7 +69,12 @@ var chipRoot = exports.chipRoot = function chipRoot(Root) {
67
69
  pilled: pilled,
68
70
  readOnly: !disabled && readOnly,
69
71
  size: size
70
- }, rest), contentLeft && /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentLeft, null, contentLeft), txt ? /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentMain, null, txt) : children, contentRight && /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentRight, null, contentRight), hasClear && ClearContent);
72
+ }, rest), contentLeft && /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentLeft, null, contentLeft), txt ? /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentMain, null, txt) : children, contentRight && /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentRight, null, contentRight), hasClear && /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentClear, {
73
+ onClick: handleClickClose
74
+ }, contentClearButton || /*#__PURE__*/_react["default"].createElement(_IconClose.IconClose, {
75
+ sizeCustomProperty: _Chip2.tokens.closeIconSize,
76
+ color: "inherit"
77
+ })));
71
78
  });
72
79
  };
73
80
  var chipConfig = exports.chipConfig = {
@@ -1,8 +1,8 @@
1
- var _excluded = ["children", "text", "contentLeft", "contentRight", "contentClearButton", "hasClear", "size", "className", "onClear", "onClick", "pilled", "readOnly", "disabled"];
1
+ var _excluded = ["children", "text", "contentLeft", "contentRight", "contentClearButton", "hasClear", "size", "className", "onClear", "onClick", "onClickClose", "pilled", "readOnly", "disabled"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
- import React, { forwardRef, useMemo } from 'react';
5
+ import React, { forwardRef } from 'react';
6
6
  import { IconClose } from '../_Icon/Icons/IconClose';
7
7
  import { cx } from '../../utils';
8
8
  import { base as viewCSS } from './variations/_view/base';
@@ -26,6 +26,7 @@ export var chipRoot = function chipRoot(Root) {
26
26
  className = props.className,
27
27
  onClear = props.onClear,
28
28
  onClick = props.onClick,
29
+ onClickClose = props.onClickClose,
29
30
  _props$pilled = props.pilled,
30
31
  pilled = _props$pilled === void 0 ? false : _props$pilled,
31
32
  _props$readOnly = props.readOnly,
@@ -42,12 +43,13 @@ export var chipRoot = function chipRoot(Root) {
42
43
  onClick === null || onClick === void 0 || onClick(event);
43
44
  onClear === null || onClear === void 0 || onClear();
44
45
  };
45
- var ClearContent = useMemo(function () {
46
- return contentClearButton || /*#__PURE__*/React.createElement(StyledContentClear, null, /*#__PURE__*/React.createElement(IconClose, {
47
- sizeCustomProperty: tokens.closeIconSize,
48
- color: "inherit"
49
- }));
50
- }, [contentClearButton, tokens.closeIconSize]);
46
+ var handleClickClose = function handleClickClose(event) {
47
+ if (disabled || readOnly || !onClickClose) {
48
+ return;
49
+ }
50
+ event.stopPropagation();
51
+ onClickClose(event);
52
+ };
51
53
  return /*#__PURE__*/React.createElement(Root, _extends({
52
54
  type: "button",
53
55
  ref: ref,
@@ -58,7 +60,12 @@ export var chipRoot = function chipRoot(Root) {
58
60
  pilled: pilled,
59
61
  readOnly: !disabled && readOnly,
60
62
  size: size
61
- }, rest), contentLeft && /*#__PURE__*/React.createElement(StyledContentLeft, null, contentLeft), txt ? /*#__PURE__*/React.createElement(StyledContentMain, null, txt) : children, contentRight && /*#__PURE__*/React.createElement(StyledContentRight, null, contentRight), hasClear && ClearContent);
63
+ }, rest), contentLeft && /*#__PURE__*/React.createElement(StyledContentLeft, null, contentLeft), txt ? /*#__PURE__*/React.createElement(StyledContentMain, null, txt) : children, contentRight && /*#__PURE__*/React.createElement(StyledContentRight, null, contentRight), hasClear && /*#__PURE__*/React.createElement(StyledContentClear, {
64
+ onClick: handleClickClose
65
+ }, contentClearButton || /*#__PURE__*/React.createElement(IconClose, {
66
+ sizeCustomProperty: tokens.closeIconSize,
67
+ color: "inherit"
68
+ })));
62
69
  });
63
70
  };
64
71
  export var chipConfig = {
@@ -1,5 +1,5 @@
1
1
  import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
- import React, { forwardRef, useMemo } from 'react';
2
+ import React, { forwardRef } from 'react';
3
3
  import { IconClose } from '../_Icon/Icons/IconClose.js';
4
4
  import { cx } from '../../utils/index.js';
5
5
  import { base as base$1 } from './variations/_view/base.js';
@@ -8,10 +8,10 @@ import { base as base$3 } from './variations/_disabled/base.js';
8
8
  import { base as base$4 } from './variations/_readonly/base.js';
9
9
  import { base as base$5 } from './variations/_focused/base.js';
10
10
  import { base as base$6 } from './variations/_pilled/base.js';
11
- import { StyledContentClear, StyledContentLeft, StyledContentMain, StyledContentRight, base } from './Chip.styles.js';
12
- import { tokens, classes } from './Chip.tokens.js';
11
+ import { StyledContentLeft, StyledContentMain, StyledContentRight, StyledContentClear, base } from './Chip.styles.js';
12
+ import { classes, tokens } from './Chip.tokens.js';
13
13
 
14
- var _excluded = ["children", "text", "contentLeft", "contentRight", "contentClearButton", "hasClear", "size", "className", "onClear", "onClick", "pilled", "readOnly", "disabled"];
14
+ var _excluded = ["children", "text", "contentLeft", "contentRight", "contentClearButton", "hasClear", "size", "className", "onClear", "onClick", "onClickClose", "pilled", "readOnly", "disabled"];
15
15
  var chipRoot = function chipRoot(Root) {
16
16
  return /*#__PURE__*/forwardRef(function (props, ref) {
17
17
  var children = props.children,
@@ -25,6 +25,7 @@ var chipRoot = function chipRoot(Root) {
25
25
  className = props.className,
26
26
  onClear = props.onClear,
27
27
  onClick = props.onClick,
28
+ onClickClose = props.onClickClose,
28
29
  _props$pilled = props.pilled,
29
30
  pilled = _props$pilled === void 0 ? false : _props$pilled,
30
31
  _props$readOnly = props.readOnly,
@@ -41,12 +42,13 @@ var chipRoot = function chipRoot(Root) {
41
42
  onClick === null || onClick === void 0 || onClick(event);
42
43
  onClear === null || onClear === void 0 || onClear();
43
44
  };
44
- var ClearContent = useMemo(function () {
45
- return contentClearButton || /*#__PURE__*/React.createElement(StyledContentClear, null, /*#__PURE__*/React.createElement(IconClose, {
46
- sizeCustomProperty: tokens.closeIconSize,
47
- color: "inherit"
48
- }));
49
- }, [contentClearButton, tokens.closeIconSize]);
45
+ var handleClickClose = function handleClickClose(event) {
46
+ if (disabled || readOnly || !onClickClose) {
47
+ return;
48
+ }
49
+ event.stopPropagation();
50
+ onClickClose(event);
51
+ };
50
52
  return /*#__PURE__*/React.createElement(Root, _extends({
51
53
  type: "button",
52
54
  ref: ref,
@@ -57,7 +59,12 @@ var chipRoot = function chipRoot(Root) {
57
59
  pilled: pilled,
58
60
  readOnly: !disabled && readOnly,
59
61
  size: size
60
- }, rest), contentLeft && /*#__PURE__*/React.createElement(StyledContentLeft, null, contentLeft), txt ? /*#__PURE__*/React.createElement(StyledContentMain, null, txt) : children, contentRight && /*#__PURE__*/React.createElement(StyledContentRight, null, contentRight), hasClear && ClearContent);
62
+ }, rest), contentLeft && /*#__PURE__*/React.createElement(StyledContentLeft, null, contentLeft), txt ? /*#__PURE__*/React.createElement(StyledContentMain, null, txt) : children, contentRight && /*#__PURE__*/React.createElement(StyledContentRight, null, contentRight), hasClear && /*#__PURE__*/React.createElement(StyledContentClear, {
63
+ onClick: handleClickClose
64
+ }, contentClearButton || /*#__PURE__*/React.createElement(IconClose, {
65
+ sizeCustomProperty: tokens.closeIconSize,
66
+ color: "inherit"
67
+ })));
61
68
  });
62
69
  };
63
70
  var chipConfig = {
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.js","sources":["../../../src/components/Chip/Chip.tsx"],"sourcesContent":["import React, { forwardRef, useMemo } from 'react';\n\nimport type { RootProps } from '../../engines';\nimport { IconClose } from '../_Icon/Icons/IconClose';\nimport { cx } from '../../utils';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as readonlyCSS } from './variations/_readonly/base';\nimport { base as focusedCSS } from './variations/_focused/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport type { ChipProps } from './Chip.types';\nimport { StyledContentClear, StyledContentLeft, StyledContentMain, StyledContentRight, base } from './Chip.styles';\nimport { classes, tokens } from './Chip.tokens';\n\nexport const chipRoot = (Root: RootProps<HTMLButtonElement, ChipProps>) =>\n forwardRef<HTMLButtonElement, ChipProps>((props, ref) => {\n const {\n children,\n text,\n contentLeft,\n contentRight,\n contentClearButton,\n hasClear = true,\n size,\n className,\n onClear,\n onClick,\n pilled = false,\n readOnly = false,\n disabled = false,\n ...rest\n } = props;\n\n const txt = !text && typeof children === 'string' ? children : text;\n const pilledClass = pilled ? classes.pilled : undefined;\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled || readOnly) {\n return;\n }\n\n onClick?.(event);\n onClear?.();\n };\n\n const ClearContent = useMemo(() => {\n return (\n contentClearButton || (\n <StyledContentClear>\n <IconClose sizeCustomProperty={tokens.closeIconSize} color=\"inherit\" />\n </StyledContentClear>\n )\n );\n }, [contentClearButton, tokens.closeIconSize]);\n\n return (\n <Root\n type=\"button\"\n ref={ref}\n className={cx(pilledClass, classes.chipItem, className)}\n tabIndex={readOnly ? -1 : 0}\n onClick={handleClick}\n disabled={disabled}\n pilled={pilled}\n readOnly={!disabled && readOnly}\n size={size}\n {...rest}\n >\n {contentLeft && <StyledContentLeft>{contentLeft}</StyledContentLeft>}\n {txt ? <StyledContentMain>{txt}</StyledContentMain> : children}\n {contentRight && <StyledContentRight>{contentRight}</StyledContentRight>}\n {hasClear && ClearContent}\n </Root>\n );\n });\n\nexport const chipConfig = {\n name: 'Chip',\n tag: 'button',\n layout: chipRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n readOnly: {\n css: readonlyCSS,\n attrs: true,\n },\n focused: {\n css: focusedCSS,\n },\n pilled: {\n css: pilledCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["chipRoot","Root","forwardRef","props","ref","children","text","contentLeft","contentRight","contentClearButton","_props$hasClear","hasClear","size","className","onClear","onClick","_props$pilled","pilled","_props$readOnly","readOnly","_props$disabled","disabled","rest","_objectWithoutProperties","_excluded","txt","pilledClass","classes","undefined","handleClick","event","ClearContent","useMemo","React","createElement","StyledContentClear","IconClose","sizeCustomProperty","tokens","closeIconSize","color","_extends","type","cx","chipItem","tabIndex","StyledContentLeft","StyledContentMain","StyledContentRight","chipConfig","name","tag","layout","base","variations","view","css","viewCSS","sizeCSS","disabledCSS","attrs","readonlyCSS","focused","focusedCSS","pilledCSS","defaults"],"mappings":";;;;;;;;;;;;;;IAgBaA,QAAQ,GAAG,SAAXA,QAAQA,CAAIC,IAA6C,EAAA;AAAA,EAAA,oBAClEC,UAAU,CAA+B,UAACC,KAAK,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A,CAACa,iBAAiB,EAAEtB,IAAAA,EAAAA,GAAuB,CAAC,GAAGpB,QAAQ,EAC7DG,YAAY,iBAAIyB,KAAA,CAAAC,aAAA,CAACc,kBAAkB,QAAExC,YAAiC,CAAC,EACvEG,QAAQ,IAAIoB,YACX,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAMkB,UAAU,GAAG;AACtBC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,GAAG,EAAE,QAAQ;AACbC,EAAAA,MAAM,EAAEpD,QAAQ;AAChBqD,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,UAAU,EAAE;AACRC,IAAAA,IAAI,EAAE;AACFC,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACD7C,IAAAA,IAAI,EAAE;AACF4C,MAAAA,GAAG,EAAEE,MAAAA;KACR;AACDrC,IAAAA,QAAQ,EAAE;AACNmC,MAAAA,GAAG,EAAEG,MAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACDzC,IAAAA,QAAQ,EAAE;AACNqC,MAAAA,GAAG,EAAEK,MAAW;AAChBD,MAAAA,KAAK,EAAE,IAAA;KACV;AACDE,IAAAA,OAAO,EAAE;AACLN,MAAAA,GAAG,EAAEO,MAAAA;KACR;AACD9C,IAAAA,MAAM,EAAE;AACJuC,MAAAA,GAAG,EAAEQ,MAAS;AACdJ,MAAAA,KAAK,EAAE,IAAA;AACX,KAAA;GACH;AACDK,EAAAA,QAAQ,EAAE;AACNV,IAAAA,IAAI,EAAE,SAAS;AACf3C,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
1
+ {"version":3,"file":"Chip.js","sources":["../../../src/components/Chip/Chip.tsx"],"sourcesContent":["import React, { forwardRef, MouseEvent } from 'react';\n\nimport type { RootProps } from '../../engines';\nimport { IconClose } from '../_Icon/Icons/IconClose';\nimport { cx } from '../../utils';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as readonlyCSS } from './variations/_readonly/base';\nimport { base as focusedCSS } from './variations/_focused/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport type { ChipProps } from './Chip.types';\nimport { StyledContentClear, StyledContentLeft, StyledContentMain, StyledContentRight, base } from './Chip.styles';\nimport { classes, tokens } from './Chip.tokens';\n\nexport const chipRoot = (Root: RootProps<HTMLButtonElement, ChipProps>) =>\n forwardRef<HTMLButtonElement, ChipProps>((props, ref) => {\n const {\n children,\n text,\n contentLeft,\n contentRight,\n contentClearButton,\n hasClear = true,\n size,\n className,\n onClear,\n onClick,\n onClickClose,\n pilled = false,\n readOnly = false,\n disabled = false,\n ...rest\n } = props;\n\n const txt = !text && typeof children === 'string' ? children : text;\n const pilledClass = pilled ? classes.pilled : undefined;\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (disabled || readOnly) {\n return;\n }\n\n onClick?.(event);\n onClear?.();\n };\n\n const handleClickClose = (event: MouseEvent<HTMLDivElement>) => {\n if (disabled || readOnly || !onClickClose) {\n return;\n }\n\n event.stopPropagation();\n onClickClose(event);\n };\n\n return (\n <Root\n type=\"button\"\n ref={ref}\n className={cx(pilledClass, classes.chipItem, className)}\n tabIndex={readOnly ? -1 : 0}\n onClick={handleClick}\n disabled={disabled}\n pilled={pilled}\n readOnly={!disabled && readOnly}\n size={size}\n {...rest}\n >\n {contentLeft && <StyledContentLeft>{contentLeft}</StyledContentLeft>}\n {txt ? <StyledContentMain>{txt}</StyledContentMain> : children}\n {contentRight && <StyledContentRight>{contentRight}</StyledContentRight>}\n {hasClear && (\n <StyledContentClear onClick={handleClickClose}>\n {contentClearButton || <IconClose sizeCustomProperty={tokens.closeIconSize} color=\"inherit\" />}\n </StyledContentClear>\n )}\n </Root>\n );\n });\n\nexport const chipConfig = {\n name: 'Chip',\n tag: 'button',\n layout: chipRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n readOnly: {\n css: readonlyCSS,\n attrs: true,\n },\n focused: {\n css: focusedCSS,\n },\n pilled: {\n css: pilledCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["chipRoot","Root","forwardRef","props","ref","children","text","contentLeft","contentRight","contentClearButton","_props$hasClear","hasClear","size","className","onClear","onClick","onClickClose","_props$pilled","pilled","_props$readOnly","readOnly","_props$disabled","disabled","rest","_objectWithoutProperties","_excluded","txt","pilledClass","classes","undefined","handleClick","event","handleClickClose","stopPropagation","React","createElement","_extends","type","cx","chipItem","tabIndex","StyledContentLeft","StyledContentMain","StyledContentRight","StyledContentClear","IconClose","sizeCustomProperty","tokens","closeIconSize","color","chipConfig","name","tag","layout","base","variations","view","css","viewCSS","sizeCSS","disabledCSS","attrs","readonlyCSS","focused","focusedCSS","pilledCSS","defaults"],"mappings":";;;;;;;;;;;;;;IAgBaA,QAAQ,GAAG,SAAXA,QAAQA,CAAIC,IAA6C,EAAA;AAAA,EAAA,oBAClEC,UAAU,CAA+B,UAACC,KAAK,EAAEC,GAAG,EAAK;AACrD,IAAA,IACIC,QAAQ,GAeRF,KAAK,CAfLE,QAAQ;MACRC,IAAI,GAcJH,KAAK,CAdLG,IAAI;MACJC,WAAW,GAaXJ,KAAK,CAbLI,WAAW;MACXC,YAAY,GAYZL,KAAK,CAZLK,YAAY;MACZC,kBAAkB,GAWlBN,KAAK,CAXLM,kBAAkB;MAAAC,eAAA,GAWlBP,KAAK,CAVLQ,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,eAAA;MACfE,IAAI,GASJT,KAAK,CATLS,IAAI;MACJC,SAAS,GAQTV,KAAK,CARLU,SAAS;MACTC,OAAO,GAOPX,KAAK,CAPLW,OAAO;MACPC,OAAO,GAMPZ,KAAK,CANLY,OAAO;MACPC,Y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;AAChBsD,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,UAAU,EAAE;AACRC,IAAAA,IAAI,EAAE;AACFC,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACD9C,IAAAA,IAAI,EAAE;AACF6C,MAAAA,GAAG,EAAEE,MAAAA;KACR;AACDrC,IAAAA,QAAQ,EAAE;AACNmC,MAAAA,GAAG,EAAEG,MAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACDzC,IAAAA,QAAQ,EAAE;AACNqC,MAAAA,GAAG,EAAEK,MAAW;AAChBD,MAAAA,KAAK,EAAE,IAAA;KACV;AACDE,IAAAA,OAAO,EAAE;AACLN,MAAAA,GAAG,EAAEO,MAAAA;KACR;AACD9C,IAAAA,MAAM,EAAE;AACJuC,MAAAA,GAAG,EAAEQ,MAAS;AACdJ,MAAAA,KAAK,EAAE,IAAA;AACX,KAAA;GACH;AACDK,EAAAA,QAAQ,EAAE;AACNV,IAAAA,IAAI,EAAE,SAAS;AACf5C,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salutejs/plasma-new-hope",
3
- "version": "0.184.0-canary.1533.11640514070.0",
3
+ "version": "0.184.0-canary.1536.11682091417.0",
4
4
  "description": "Salute Design System blueprint",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",
@@ -80,7 +80,7 @@
80
80
  "@rollup/plugin-babel": "^6.0.4",
81
81
  "@rollup/plugin-commonjs": "^25.0.4",
82
82
  "@rollup/plugin-node-resolve": "^15.1.0",
83
- "@salutejs/plasma-sb-utils": "0.184.0-canary.1533.11640514070.0",
83
+ "@salutejs/plasma-sb-utils": "0.183.0-dev.0",
84
84
  "@salutejs/plasma-themes": "0.22.0",
85
85
  "@storybook/addon-docs": "^7.6.17",
86
86
  "@storybook/addon-essentials": "^7.6.17",
@@ -115,7 +115,7 @@
115
115
  "@linaria/react": "5.0.3",
116
116
  "@popperjs/core": "2.11.8",
117
117
  "@salutejs/input-core": "2.1.2",
118
- "@salutejs/plasma-core": "1.186.0-canary.1533.11640514070.0",
118
+ "@salutejs/plasma-core": "1.185.0-dev.0",
119
119
  "@salutejs/react-maskinput": "3.2.6",
120
120
  "classnames": "2.5.1",
121
121
  "dayjs": "1.11.11",
@@ -128,5 +128,5 @@
128
128
  "sideEffects": [
129
129
  "*.css"
130
130
  ],
131
- "gitHead": "0d5b2ac14ae200a0ebfdcd20a3e8d1ddaa492175"
131
+ "gitHead": "b5f4ad90ab9c002fb9d20b139692d4ba23c6f384"
132
132
  }
@@ -16,7 +16,7 @@ var _base5 = /*#__PURE__*/require("./variations/_focused/base");
16
16
  var _base6 = /*#__PURE__*/require("./variations/_pilled/base");
17
17
  var _Chip = /*#__PURE__*/require("./Chip.styles");
18
18
  var _Chip2 = /*#__PURE__*/require("./Chip.tokens");
19
- var _excluded = ["children", "text", "contentLeft", "contentRight", "contentClearButton", "hasClear", "size", "className", "onClear", "onClick", "pilled", "readOnly", "disabled"];
19
+ var _excluded = ["children", "text", "contentLeft", "contentRight", "contentClearButton", "hasClear", "size", "className", "onClear", "onClick", "onClickClose", "pilled", "readOnly", "disabled"];
20
20
  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); }
21
21
  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; }
22
22
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -35,6 +35,7 @@ var chipRoot = exports.chipRoot = function chipRoot(Root) {
35
35
  className = props.className,
36
36
  onClear = props.onClear,
37
37
  onClick = props.onClick,
38
+ onClickClose = props.onClickClose,
38
39
  _props$pilled = props.pilled,
39
40
  pilled = _props$pilled === void 0 ? false : _props$pilled,
40
41
  _props$readOnly = props.readOnly,
@@ -51,12 +52,13 @@ var chipRoot = exports.chipRoot = function chipRoot(Root) {
51
52
  onClick === null || onClick === void 0 || onClick(event);
52
53
  onClear === null || onClear === void 0 || onClear();
53
54
  };
54
- var ClearContent = (0, _react.useMemo)(function () {
55
- return contentClearButton || /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentClear, null, /*#__PURE__*/_react["default"].createElement(_IconClose.IconClose, {
56
- sizeCustomProperty: _Chip2.tokens.closeIconSize,
57
- color: "inherit"
58
- }));
59
- }, [contentClearButton, _Chip2.tokens.closeIconSize]);
55
+ var handleClickClose = function handleClickClose(event) {
56
+ if (disabled || readOnly || !onClickClose) {
57
+ return;
58
+ }
59
+ event.stopPropagation();
60
+ onClickClose(event);
61
+ };
60
62
  return /*#__PURE__*/_react["default"].createElement(Root, _extends({
61
63
  type: "button",
62
64
  ref: ref,
@@ -67,7 +69,12 @@ var chipRoot = exports.chipRoot = function chipRoot(Root) {
67
69
  pilled: pilled,
68
70
  readOnly: !disabled && readOnly,
69
71
  size: size
70
- }, rest), contentLeft && /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentLeft, null, contentLeft), txt ? /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentMain, null, txt) : children, contentRight && /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentRight, null, contentRight), hasClear && ClearContent);
72
+ }, rest), contentLeft && /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentLeft, null, contentLeft), txt ? /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentMain, null, txt) : children, contentRight && /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentRight, null, contentRight), hasClear && /*#__PURE__*/_react["default"].createElement(_Chip.StyledContentClear, {
73
+ onClick: handleClickClose
74
+ }, contentClearButton || /*#__PURE__*/_react["default"].createElement(_IconClose.IconClose, {
75
+ sizeCustomProperty: _Chip2.tokens.closeIconSize,
76
+ color: "inherit"
77
+ })));
71
78
  });
72
79
  };
73
80
  var chipConfig = exports.chipConfig = {
@@ -1,8 +1,8 @@
1
- var _excluded = ["children", "text", "contentLeft", "contentRight", "contentClearButton", "hasClear", "size", "className", "onClear", "onClick", "pilled", "readOnly", "disabled"];
1
+ var _excluded = ["children", "text", "contentLeft", "contentRight", "contentClearButton", "hasClear", "size", "className", "onClear", "onClick", "onClickClose", "pilled", "readOnly", "disabled"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
- import React, { forwardRef, useMemo } from 'react';
5
+ import React, { forwardRef } from 'react';
6
6
  import { IconClose } from '../_Icon/Icons/IconClose';
7
7
  import { cx } from '../../utils';
8
8
  import { base as viewCSS } from './variations/_view/base';
@@ -26,6 +26,7 @@ export var chipRoot = function chipRoot(Root) {
26
26
  className = props.className,
27
27
  onClear = props.onClear,
28
28
  onClick = props.onClick,
29
+ onClickClose = props.onClickClose,
29
30
  _props$pilled = props.pilled,
30
31
  pilled = _props$pilled === void 0 ? false : _props$pilled,
31
32
  _props$readOnly = props.readOnly,
@@ -42,12 +43,13 @@ export var chipRoot = function chipRoot(Root) {
42
43
  onClick === null || onClick === void 0 || onClick(event);
43
44
  onClear === null || onClear === void 0 || onClear();
44
45
  };
45
- var ClearContent = useMemo(function () {
46
- return contentClearButton || /*#__PURE__*/React.createElement(StyledContentClear, null, /*#__PURE__*/React.createElement(IconClose, {
47
- sizeCustomProperty: tokens.closeIconSize,
48
- color: "inherit"
49
- }));
50
- }, [contentClearButton, tokens.closeIconSize]);
46
+ var handleClickClose = function handleClickClose(event) {
47
+ if (disabled || readOnly || !onClickClose) {
48
+ return;
49
+ }
50
+ event.stopPropagation();
51
+ onClickClose(event);
52
+ };
51
53
  return /*#__PURE__*/React.createElement(Root, _extends({
52
54
  type: "button",
53
55
  ref: ref,
@@ -58,7 +60,12 @@ export var chipRoot = function chipRoot(Root) {
58
60
  pilled: pilled,
59
61
  readOnly: !disabled && readOnly,
60
62
  size: size
61
- }, rest), contentLeft && /*#__PURE__*/React.createElement(StyledContentLeft, null, contentLeft), txt ? /*#__PURE__*/React.createElement(StyledContentMain, null, txt) : children, contentRight && /*#__PURE__*/React.createElement(StyledContentRight, null, contentRight), hasClear && ClearContent);
63
+ }, rest), contentLeft && /*#__PURE__*/React.createElement(StyledContentLeft, null, contentLeft), txt ? /*#__PURE__*/React.createElement(StyledContentMain, null, txt) : children, contentRight && /*#__PURE__*/React.createElement(StyledContentRight, null, contentRight), hasClear && /*#__PURE__*/React.createElement(StyledContentClear, {
64
+ onClick: handleClickClose
65
+ }, contentClearButton || /*#__PURE__*/React.createElement(IconClose, {
66
+ sizeCustomProperty: tokens.closeIconSize,
67
+ color: "inherit"
68
+ })));
62
69
  });
63
70
  };
64
71
  export var chipConfig = {
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAU/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,eAAO,MAAM,QAAQ,SAAU,UAAU,iBAAiB,EAAE,SAAS,CAAC,wFA4DhE,CAAC;AAEP,eAAO,MAAM,UAAU;;;mBA9DQ,UAAU,iBAAiB,EAAE,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8FrE,CAAC"}
1
+ {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAU/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,eAAO,MAAM,QAAQ,SAAU,UAAU,iBAAiB,EAAE,SAAS,CAAC,wFAgEhE,CAAC;AAEP,eAAO,MAAM,UAAU;;;mBAlEQ,UAAU,iBAAiB,EAAE,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkGrE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ButtonHTMLAttributes, PropsWithChildren, ReactNode } from 'react';
1
+ import type { ButtonHTMLAttributes, PropsWithChildren, ReactNode, MouseEvent } from 'react';
2
2
  declare type CustomChipProps = {
3
3
  /**
4
4
  * Текстовая надпись
@@ -49,8 +49,14 @@ declare type CustomChipProps = {
49
49
  view?: string;
50
50
  /**
51
51
  * Коллбек при взаимодействии с элементом
52
+ * @deprecated
53
+ * Использовать onClick для закрытия
52
54
  */
53
55
  onClear?: () => void;
56
+ /**
57
+ * Коллбек при нажатии на крестик
58
+ */
59
+ onClickClose?: (event: MouseEvent<HTMLDivElement>) => void;
54
60
  } & PropsWithChildren;
55
61
  export interface ChipProps extends ButtonHTMLAttributes<HTMLButtonElement>, CustomChipProps {
56
62
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.types.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/Chip.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhF,aAAK,eAAe,GAAG;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,GAAG,iBAAiB,CAAC;AAEtB,MAAM,WAAW,SAAU,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,eAAe;CAAG"}
1
+ {"version":3,"file":"Chip.types.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/Chip.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,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