@salutejs/plasma-new-hope 0.138.0-canary.1406.10666365265.0 → 0.138.0-canary.1406.10670971125.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. package/cjs/components/Combobox/ComboboxNew/Combobox.css +3 -3
  2. package/cjs/components/Combobox/ComboboxNew/Combobox.js +13 -8
  3. package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
  4. package/cjs/components/Combobox/ComboboxNew/Combobox.styles.js +22 -6
  5. package/cjs/components/Combobox/ComboboxNew/Combobox.styles.js.map +1 -1
  6. package/cjs/components/Combobox/ComboboxNew/{Combobox.styles_79kgrq.css → Combobox.styles_iq2uzw.css} +1 -1
  7. package/cjs/components/Combobox/ComboboxNew/Combobox.tokens.js +25 -0
  8. package/cjs/components/Combobox/ComboboxNew/Combobox.tokens.js.map +1 -1
  9. package/cjs/components/Combobox/ComboboxNew/FloatingPopover.js +2 -2
  10. package/cjs/components/Combobox/ComboboxNew/FloatingPopover.js.map +1 -1
  11. package/cjs/components/Combobox/ComboboxNew/ui/Inner/Inner.css +3 -3
  12. package/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.css +3 -3
  13. package/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +4 -7
  14. package/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js.map +1 -1
  15. package/cjs/components/Combobox/ComboboxNew/utils/filterItems.js +2 -1
  16. package/cjs/components/Combobox/ComboboxNew/utils/filterItems.js.map +1 -1
  17. package/cjs/components/Popup/PopupContext.js +1 -1
  18. package/cjs/components/Popup/PopupContext.js.map +1 -1
  19. package/cjs/hooks/useOutsideClick.js +1 -4
  20. package/cjs/hooks/useOutsideClick.js.map +1 -1
  21. package/cjs/index.css +3 -3
  22. package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +13 -8
  23. package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.styles.js +11 -5
  24. package/emotion/cjs/components/Combobox/ComboboxNew/FloatingPopover.js +2 -2
  25. package/emotion/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +4 -7
  26. package/emotion/cjs/components/Combobox/ComboboxNew/utils/filterItems.js +2 -1
  27. package/emotion/cjs/components/Popup/PopupContext.js +1 -1
  28. package/emotion/cjs/examples/plasma_b2c/components/Combobox/ComboboxNew/Combobox.config.js +12 -14
  29. package/emotion/cjs/examples/plasma_b2c/components/Combobox/ComboboxNew/Combobox.stories.tsx +1 -9
  30. package/emotion/cjs/hooks/useOutsideClick.js +1 -4
  31. package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +13 -8
  32. package/emotion/es/components/Combobox/ComboboxNew/Combobox.styles.js +11 -5
  33. package/emotion/es/components/Combobox/ComboboxNew/FloatingPopover.js +2 -2
  34. package/emotion/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +4 -7
  35. package/emotion/es/components/Combobox/ComboboxNew/utils/filterItems.js +2 -1
  36. package/emotion/es/components/Popup/PopupContext.js +1 -1
  37. package/emotion/es/examples/plasma_b2c/components/Combobox/ComboboxNew/Combobox.config.js +12 -14
  38. package/emotion/es/examples/plasma_b2c/components/Combobox/ComboboxNew/Combobox.stories.tsx +1 -9
  39. package/emotion/es/hooks/useOutsideClick.js +1 -4
  40. package/es/components/Combobox/ComboboxNew/Combobox.css +3 -3
  41. package/es/components/Combobox/ComboboxNew/Combobox.js +13 -8
  42. package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
  43. package/es/components/Combobox/ComboboxNew/Combobox.styles.js +23 -7
  44. package/es/components/Combobox/ComboboxNew/Combobox.styles.js.map +1 -1
  45. package/es/components/Combobox/ComboboxNew/{Combobox.styles_79kgrq.css → Combobox.styles_iq2uzw.css} +1 -1
  46. package/es/components/Combobox/ComboboxNew/Combobox.tokens.js +25 -1
  47. package/es/components/Combobox/ComboboxNew/Combobox.tokens.js.map +1 -1
  48. package/es/components/Combobox/ComboboxNew/FloatingPopover.js +2 -2
  49. package/es/components/Combobox/ComboboxNew/FloatingPopover.js.map +1 -1
  50. package/es/components/Combobox/ComboboxNew/ui/Inner/Inner.css +3 -3
  51. package/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.css +3 -3
  52. package/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +4 -7
  53. package/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js.map +1 -1
  54. package/es/components/Combobox/ComboboxNew/utils/filterItems.js +2 -1
  55. package/es/components/Combobox/ComboboxNew/utils/filterItems.js.map +1 -1
  56. package/es/components/Popup/PopupContext.js +1 -1
  57. package/es/components/Popup/PopupContext.js.map +1 -1
  58. package/es/hooks/useOutsideClick.js +1 -4
  59. package/es/hooks/useOutsideClick.js.map +1 -1
  60. package/es/index.css +3 -3
  61. package/package.json +2 -2
  62. package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +13 -8
  63. package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.styles.js +7 -1
  64. package/styled-components/cjs/components/Combobox/ComboboxNew/FloatingPopover.js +2 -2
  65. package/styled-components/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +4 -7
  66. package/styled-components/cjs/components/Combobox/ComboboxNew/utils/filterItems.js +2 -1
  67. package/styled-components/cjs/components/Popup/PopupContext.js +1 -1
  68. package/styled-components/cjs/examples/plasma_b2c/components/Combobox/ComboboxNew/Combobox.config.js +0 -2
  69. package/styled-components/cjs/examples/plasma_b2c/components/Combobox/ComboboxNew/Combobox.stories.tsx +1 -9
  70. package/styled-components/cjs/hooks/useOutsideClick.js +1 -4
  71. package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +13 -8
  72. package/styled-components/es/components/Combobox/ComboboxNew/Combobox.styles.js +7 -1
  73. package/styled-components/es/components/Combobox/ComboboxNew/FloatingPopover.js +2 -2
  74. package/styled-components/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +4 -7
  75. package/styled-components/es/components/Combobox/ComboboxNew/utils/filterItems.js +2 -1
  76. package/styled-components/es/components/Popup/PopupContext.js +1 -1
  77. package/styled-components/es/examples/plasma_b2c/components/Combobox/ComboboxNew/Combobox.config.js +0 -2
  78. package/styled-components/es/examples/plasma_b2c/components/Combobox/ComboboxNew/Combobox.stories.tsx +1 -9
  79. package/styled-components/es/hooks/useOutsideClick.js +1 -4
  80. package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
  81. package/types/components/Combobox/ComboboxNew/Combobox.styles.d.ts +3 -1
  82. package/types/components/Combobox/ComboboxNew/Combobox.styles.d.ts.map +1 -1
  83. package/types/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.d.ts.map +1 -1
  84. package/types/components/Combobox/ComboboxNew/utils/filterItems.d.ts.map +1 -1
  85. package/types/examples/plasma_b2c/components/Combobox/ComboboxNew/Combobox.config.d.ts.map +1 -1
  86. package/types/hooks/useOutsideClick.d.ts.map +1 -1
@@ -31,11 +31,11 @@
31
31
 
32
32
  .IconRoot_7pl7ig_svvlqhf__32c458a1{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:var(--svvlqhf-0);height:var(--svvlqhf-0);-webkit-flex:0 0 var(--svvlqhf-0);-ms-flex:0 0 var(--svvlqhf-0);flex:0 0 var(--svvlqhf-0);}
33
33
 
34
- .Combobox_styles_79kgrq_uxiiees__26f8d1f9{box-sizing:border-box;background:var(--surface-solid-card);box-shadow:0px 4px 14px -4px rgba(8,8,8,0.08),0px 1px 4px -1px rgba(0,0,0,0.04);border-radius:var(--plasma-combobox-border-radius);width:var(--uxiiees-0);height:var(--uxiiees-1);overflow:var(--uxiiees-2);margin:var(--uxiiees-3);padding:var(--plasma-combobox-padding) 0;}.Combobox_styles_79kgrq_uxiiees__26f8d1f9 .Combobox_styles_79kgrq_comboboxEmptyStateWrapper__26f8d1f9{box-shadow:none;}
35
- .Combobox_styles_79kgrq_i1veo3wn__26f8d1f9{line-height:0;color:var(--text-secondary);cursor:pointer;}.Combobox_styles_79kgrq_i1veo3wn__26f8d1f9 .Combobox_styles_79kgrq_arrowInverse__26f8d1f9{-webkit-transform:rotate(-180deg);-ms-transform:rotate(-180deg);transform:rotate(-180deg);}
34
+ .Combobox_styles_iq2uzw_uxiiees__2edef9fc{box-sizing:border-box;background:var(--surface-solid-card);box-shadow:0px 4px 14px -4px rgba(8,8,8,0.08),0px 1px 4px -1px rgba(0,0,0,0.04);border-radius:var(--plasma-combobox-border-radius);width:var(--uxiiees-0);height:var(--uxiiees-1);overflow:var(--uxiiees-2);margin:var(--uxiiees-3);padding:var(--plasma-combobox-padding) 0;}.Combobox_styles_iq2uzw_uxiiees__2edef9fc .Combobox_styles_iq2uzw_comboboxEmptyStateWrapper__2edef9fc{box-shadow:none;}
35
+ .Combobox_styles_iq2uzw_i1veo3wn__2edef9fc{line-height:0;color:var(--text-secondary);cursor:var(--i1veo3wn-0);}.Combobox_styles_iq2uzw_i1veo3wn__2edef9fc .Combobox_styles_iq2uzw_arrowInverse__2edef9fc{-webkit-transform:rotate(-180deg);-ms-transform:rotate(-180deg);transform:rotate(-180deg);}.Combobox_styles_iq2uzw_i1veo3wn__2edef9fc:hover,.Combobox_styles_iq2uzw_i1veo3wn__2edef9fc:active{color:var(--i1veo3wn-1);}
36
36
 
37
37
 
38
- .Combobox_styles_79kgrq_s11cn92k__26f8d1f9{--plasma-emptystate-border-radius:var(--plasma-combobox-new-textfield-border-radius);--plasma-emptystate-padding:var(--plasma-combobox-new-empty-state-padding);--plasma-emptystate-font-family:var(--plasma-combobox-new-textfield-font-family);--plasma-emptystate-font-size:var(--plasma-combobox-new-textfield-font-size);--plasma-emptystate-font-style:var(--plasma-combobox-new-textfield-font-style);--plasma-emptystate-font-weight:var(--plasma-combobox-new-textfield-font-weight);--plasma-emptystate-font-letter-spacing:var(--plasma-combobox-new-textfield-letter-spacing);--plasma-emptystate-font-line-height:var(--plasma-combobox-new-textfield-line-height);}
38
+ .Combobox_styles_iq2uzw_s11cn92k__2edef9fc{--plasma-emptystate-border-radius:var(--plasma-combobox-new-textfield-border-radius);--plasma-emptystate-padding:var(--plasma-combobox-new-empty-state-padding);--plasma-emptystate-font-family:var(--plasma-combobox-new-textfield-font-family);--plasma-emptystate-font-size:var(--plasma-combobox-new-textfield-font-size);--plasma-emptystate-font-style:var(--plasma-combobox-new-textfield-font-style);--plasma-emptystate-font-weight:var(--plasma-combobox-new-textfield-font-weight);--plasma-emptystate-font-letter-spacing:var(--plasma-combobox-new-textfield-letter-spacing);--plasma-emptystate-font-line-height:var(--plasma-combobox-new-textfield-line-height);}
39
39
 
40
40
  .base_orwx1f_b13ve66i__2243bf3f .base_orwx1f_io4bpie__2243bf3f{width:100%;font-family:var(--plasma-textfield-font-family);font-size:var(--plasma-textfield-font-size);font-style:var(--plasma-textfield-font-style);font-weight:var(--plasma-textfield-font-weight);-webkit-letter-spacing:var(--plasma-textfield-letter-spacing);-moz-letter-spacing:var(--plasma-textfield-letter-spacing);-ms-letter-spacing:var(--plasma-textfield-letter-spacing);letter-spacing:var(--plasma-textfield-letter-spacing);line-height:var(--plasma-textfield-line-height);}.base_orwx1f_b13ve66i__2243bf3f .base_orwx1f_iq39zt5__2243bf3f{height:var(--plasma-textfield-height);border-radius:var(--plasma-textfield-border-radius);padding:var(--plasma-textfield-padding);}.base_orwx1f_b13ve66i__2243bf3f .base_orwx1f_iq39zt5__2243bf3f.base_orwx1f_hasChips__2243bf3f{padding-top:var(--plasma-textfield-padding-with-chips);padding-bottom:var(--plasma-textfield-padding-with-chips);}.base_orwx1f_b13ve66i__2243bf3f .base_orwx1f_iq39zt5__2243bf3f.base_orwx1f_hasEmptyContentLeft__2243bf3f{padding-left:var(--plasma-textfield-padding-with-chips);}.base_orwx1f_b13ve66i__2243bf3f .base_orwx1f_iq39zt5__2243bf3f.base_orwx1f_hasEmptyContentRight__2243bf3f{padding-right:var(--plasma-textfield-padding-with-chips);}.base_orwx1f_b13ve66i__2243bf3f .base_orwx1f_l13qvwoy__2243bf3f{font-family:var(--plasma-textfield__label-font-family);font-size:var(--plasma-textfield__label-font-size);font-style:var(--plasma-textfield__label-font-style);font-weight:var(--plasma-textfield__label-font-weight);-webkit-letter-spacing:var(--plasma-textfield__label-letter-spacing);-moz-letter-spacing:var(--plasma-textfield__label-letter-spacing);-ms-letter-spacing:var(--plasma-textfield__label-letter-spacing);letter-spacing:var(--plasma-textfield__label-letter-spacing);line-height:var(--plasma-textfield__label-line-height);}.base_orwx1f_b13ve66i__2243bf3f .base_orwx1f_llv9av6__2243bf3f{margin-top:var(--plasma-textfield__left-helper-offset);font-family:var(--plasma-textfield__left-helper-font-family);font-size:var(--plasma-textfield__left-helper-font-size);font-style:var(--plasma-textfield__left-helper-font-style);font-weight:var(--plasma-textfield__left-helper-font-weight);-webkit-letter-spacing:var(--plasma-textfield__left-helper-letter-spacing);-moz-letter-spacing:var(--plasma-textfield__left-helper-letter-spacing);-ms-letter-spacing:var(--plasma-textfield__left-helper-letter-spacing);letter-spacing:var(--plasma-textfield__left-helper-letter-spacing);line-height:var(--plasma-textfield__left-helper-line-height);}.base_orwx1f_b13ve66i__2243bf3f .base_orwx1f_s600610__2243bf3f,.base_orwx1f_b13ve66i__2243bf3f .base_orwx1f_suk2zst__2243bf3f{font-family:var(--plasma-textfield-font-family);font-size:var(--plasma-textfield-font-size);font-style:var(--plasma-textfield-font-style);font-weight:var(--plasma-textfield-font-weight);-webkit-letter-spacing:var(--plasma-textfield-letter-spacing);-moz-letter-spacing:var(--plasma-textfield-letter-spacing);-ms-letter-spacing:var(--plasma-textfield-letter-spacing);letter-spacing:var(--plasma-textfield-letter-spacing);line-height:var(--plasma-textfield-line-height);}.base_orwx1f_b13ve66i__2243bf3f .base_orwx1f_s600610__2243bf3f{margin:var(--plasma-textfield__before-text-margin);}.base_orwx1f_b13ve66i__2243bf3f .base_orwx1f_suk2zst__2243bf3f{margin:var(--plasma-textfield__after-text-margin);}
41
41
 
@@ -76,11 +76,11 @@
76
76
  .EmptyState_styles_s585zf_i21aoej__64fd19b0{margin:var(--plasma-emptystate-icon-margin);line-height:0;}
77
77
  .EmptyState_styles_s585zf_d1brs29u__64fd19b0{margin:var(--plasma-emptystate-description-margin);font-family:var(--plasma-emptystate-font-family);font-size:var(--plasma-emptystate-font-size);font-style:var(--plasma-emptystate-font-style);font-weight:var(--plasma-emptystate-font-weight);-webkit-letter-spacing:var(--plasma-emptystate-font-letter-spacing);-moz-letter-spacing:var(--plasma-emptystate-font-letter-spacing);-ms-letter-spacing:var(--plasma-emptystate-font-letter-spacing);letter-spacing:var(--plasma-emptystate-font-letter-spacing);line-height:var(--plasma-emptystate-font-line-height);}
78
78
 
79
- .Combobox_styles_79kgrq_uxiiees__26f8d1f9{box-sizing:border-box;background:var(--surface-solid-card);box-shadow:0px 4px 14px -4px rgba(8,8,8,0.08),0px 1px 4px -1px rgba(0,0,0,0.04);border-radius:var(--plasma-combobox-border-radius);width:var(--uxiiees-0);height:var(--uxiiees-1);overflow:var(--uxiiees-2);margin:var(--uxiiees-3);padding:var(--plasma-combobox-padding) 0;}.Combobox_styles_79kgrq_uxiiees__26f8d1f9 .Combobox_styles_79kgrq_comboboxEmptyStateWrapper__26f8d1f9{box-shadow:none;}
80
- .Combobox_styles_79kgrq_i1veo3wn__26f8d1f9{line-height:0;color:var(--text-secondary);cursor:pointer;}.Combobox_styles_79kgrq_i1veo3wn__26f8d1f9 .Combobox_styles_79kgrq_arrowInverse__26f8d1f9{-webkit-transform:rotate(-180deg);-ms-transform:rotate(-180deg);transform:rotate(-180deg);}
79
+ .Combobox_styles_iq2uzw_uxiiees__2edef9fc{box-sizing:border-box;background:var(--surface-solid-card);box-shadow:0px 4px 14px -4px rgba(8,8,8,0.08),0px 1px 4px -1px rgba(0,0,0,0.04);border-radius:var(--plasma-combobox-border-radius);width:var(--uxiiees-0);height:var(--uxiiees-1);overflow:var(--uxiiees-2);margin:var(--uxiiees-3);padding:var(--plasma-combobox-padding) 0;}.Combobox_styles_iq2uzw_uxiiees__2edef9fc .Combobox_styles_iq2uzw_comboboxEmptyStateWrapper__2edef9fc{box-shadow:none;}
80
+ .Combobox_styles_iq2uzw_i1veo3wn__2edef9fc{line-height:0;color:var(--text-secondary);cursor:var(--i1veo3wn-0);}.Combobox_styles_iq2uzw_i1veo3wn__2edef9fc .Combobox_styles_iq2uzw_arrowInverse__2edef9fc{-webkit-transform:rotate(-180deg);-ms-transform:rotate(-180deg);transform:rotate(-180deg);}.Combobox_styles_iq2uzw_i1veo3wn__2edef9fc:hover,.Combobox_styles_iq2uzw_i1veo3wn__2edef9fc:active{color:var(--i1veo3wn-1);}
81
81
 
82
82
 
83
- .Combobox_styles_79kgrq_s11cn92k__26f8d1f9{--plasma-emptystate-border-radius:var(--plasma-combobox-new-textfield-border-radius);--plasma-emptystate-padding:var(--plasma-combobox-new-empty-state-padding);--plasma-emptystate-font-family:var(--plasma-combobox-new-textfield-font-family);--plasma-emptystate-font-size:var(--plasma-combobox-new-textfield-font-size);--plasma-emptystate-font-style:var(--plasma-combobox-new-textfield-font-style);--plasma-emptystate-font-weight:var(--plasma-combobox-new-textfield-font-weight);--plasma-emptystate-font-letter-spacing:var(--plasma-combobox-new-textfield-letter-spacing);--plasma-emptystate-font-line-height:var(--plasma-combobox-new-textfield-line-height);}
83
+ .Combobox_styles_iq2uzw_s11cn92k__2edef9fc{--plasma-emptystate-border-radius:var(--plasma-combobox-new-textfield-border-radius);--plasma-emptystate-padding:var(--plasma-combobox-new-empty-state-padding);--plasma-emptystate-font-family:var(--plasma-combobox-new-textfield-font-family);--plasma-emptystate-font-size:var(--plasma-combobox-new-textfield-font-size);--plasma-emptystate-font-style:var(--plasma-combobox-new-textfield-font-style);--plasma-emptystate-font-weight:var(--plasma-combobox-new-textfield-font-weight);--plasma-emptystate-font-letter-spacing:var(--plasma-combobox-new-textfield-letter-spacing);--plasma-emptystate-font-line-height:var(--plasma-combobox-new-textfield-line-height);}
84
84
 
85
85
  .base_x252cy_b17hdes8__856a05b7 input[type='checkbox']:indeterminate + .base_x252cy_s1u3nd7e__856a05b7 .base_x252cy_sft3zxv__856a05b7{border:none;background:var(--plasma-checkbox-fill-color);border-color:var(--plasma-checkbox-fill-color);}.base_x252cy_b17hdes8__856a05b7 input:checked + .base_x252cy_s1u3nd7e__856a05b7 .base_x252cy_sft3zxv__856a05b7{border:none;background:var(--plasma-checkbox-fill-color);border-color:var(--plasma-checkbox-fill-color);}
86
86
 
@@ -38,8 +38,7 @@ var Item = function Item(_ref) {
38
38
  renderItem = _useContext.renderItem,
39
39
  valueToItemMap = _useContext.valueToItemMap,
40
40
  treeId = _useContext.treeId;
41
- var itemDisabled = Boolean(disabled);
42
- var isDisabledClassName = itemDisabled ? classes.dropdownItemIsDisabled : undefined;
41
+ var isDisabledClassName = disabled ? classes.dropdownItemIsDisabled : undefined;
43
42
  var focusedClass = currentLevel === focusedPath.length - 1 && index === (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[currentLevel]) ? classes.dropdownItemIsFocused : undefined;
44
43
  var activeClass = value === (path === null || path === void 0 ? void 0 : path[currentLevel + 1]) ? classes.dropdownItemIsActive : undefined;
45
44
  useDidMountEffect(function () {
@@ -52,12 +51,12 @@ var Item = function Item(_ref) {
52
51
  }
53
52
  }, [focusedClass]);
54
53
  var handleChange = function handleChange(e) {
55
- if (itemDisabled) return;
54
+ if (disabled) return;
56
55
  e.stopPropagation();
57
56
  handleCheckboxChange(item);
58
57
  };
59
58
  var handleClick = function handleClick(e) {
60
- if (itemDisabled) {
59
+ if (disabled) {
61
60
  e.stopPropagation();
62
61
  return;
63
62
  }
@@ -92,9 +91,7 @@ var Item = function Item(_ref) {
92
91
  }))), !multiple && checked.get(item.value) === 'done' && /*#__PURE__*/React.createElement(IconDone, {
93
92
  size: sizeToIconSize(size, variant),
94
93
  color: "inherit"
95
- })), renderItem ? /*#__PURE__*/React.createElement(StyledText, null, renderItem(valueToItemMap.get(value))) : /*#__PURE__*/React.createElement(StyledWrapper, {
96
- className: "dima"
97
- }, /*#__PURE__*/React.createElement(StyledCell, {
94
+ })), renderItem ? /*#__PURE__*/React.createElement(StyledText, null, renderItem(valueToItemMap.get(value))) : /*#__PURE__*/React.createElement(StyledWrapper, null, /*#__PURE__*/React.createElement(StyledCell, {
98
95
  view: "default",
99
96
  size: "l",
100
97
  contentLeft: contentLeft,
@@ -1 +1 @@
1
- {"version":3,"file":"Item.js","sources":["../../../../../../../../src/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.tsx"],"sourcesContent":["import React, { useRef, FC, useContext } from 'react';\n\nimport { sizeToIconSize, getItemId } from '../../../../utils';\nimport { classes } from '../../../../Combobox.tokens';\nimport { cx, isEmpty } from '../../../../../../../utils';\nimport { IconDisclosureRightCentered, IconDone } from '../../../../../../_Icon';\nimport { Context } from '../../../../Combobox';\nimport { useDidMountEffect } from '../../../../../../../hooks';\n\nimport { ItemProps } from './Item.types';\nimport {\n StyledWrapper,\n StyledText,\n Wrapper,\n DisclosureIconWrapper,\n StyledCheckbox,\n IconWrapper,\n StyledIndicator,\n StyledCheckboxWrapper,\n StyledCell,\n} from './Item.styles';\n\nexport const Item: FC<ItemProps> = ({\n item,\n path,\n currentLevel,\n index,\n ariaControls,\n ariaExpanded,\n ariaLevel,\n ariaLabel,\n}) => {\n const { value, label, disabled, contentLeft, contentRight } = item;\n const ref = useRef<HTMLLIElement | null>(null);\n\n const {\n focusedPath,\n checked,\n multiple,\n size,\n handleCheckboxChange,\n handleItemClick,\n variant,\n renderItem,\n valueToItemMap,\n treeId,\n } = useContext(Context);\n\n const itemDisabled = Boolean(disabled);\n\n const isDisabledClassName = itemDisabled ? classes.dropdownItemIsDisabled : undefined;\n\n const focusedClass =\n currentLevel === focusedPath.length - 1 && index === focusedPath?.[currentLevel]\n ? classes.dropdownItemIsFocused\n : undefined;\n const activeClass = value === path?.[currentLevel + 1] ? classes.dropdownItemIsActive : undefined;\n\n useDidMountEffect(() => {\n if (focusedClass && ref?.current) {\n ref.current.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n }, [focusedClass]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (itemDisabled) return;\n\n e.stopPropagation();\n\n handleCheckboxChange(item);\n };\n\n const handleClick = (e: React.MouseEvent<HTMLElement>) => {\n if (itemDisabled) {\n e.stopPropagation();\n return;\n }\n\n handleItemClick(item, e);\n };\n\n return (\n <Wrapper\n className={cx(isDisabledClassName, focusedClass, activeClass)}\n id={getItemId(treeId, value)}\n ref={ref}\n onClick={handleClick}\n variant={variant}\n role=\"treeitem\"\n aria-controls={ariaControls}\n aria-expanded={ariaExpanded}\n aria-level={ariaLevel}\n aria-label={ariaLabel}\n aria-selected={Boolean(checked.get(item.value))}\n >\n <IconWrapper variant={variant}>\n {multiple && (\n <StyledCheckboxWrapper onClick={(e) => e.stopPropagation()}>\n <StyledCheckbox\n checked={Boolean(checked.get(item.value))}\n indeterminate={checked.get(item.value) === 'indeterminate'}\n onChange={handleChange}\n className={classes.selectItemCheckbox}\n />\n </StyledCheckboxWrapper>\n )}\n\n {!multiple && checked.get(item.value) === 'dot' && <StyledIndicator size=\"s\" view=\"default\" />}\n\n {!multiple && checked.get(item.value) === 'done' && (\n <IconDone size={sizeToIconSize(size, variant)} color=\"inherit\" />\n )}\n </IconWrapper>\n\n {renderItem ? (\n <StyledText>{renderItem(valueToItemMap.get(value)!)}</StyledText>\n ) : (\n <StyledWrapper className=\"dima\">\n <StyledCell\n view=\"default\"\n size=\"l\"\n contentLeft={contentLeft}\n contentRight={contentRight}\n alignContentLeft=\"center\"\n alignContentRight=\"center\"\n title={label}\n />\n </StyledWrapper>\n )}\n\n {!isEmpty(item.items) && (\n <DisclosureIconWrapper>\n <IconDisclosureRightCentered size={sizeToIconSize(size, variant)} color=\"inherit\" />\n </DisclosureIconWrapper>\n )}\n </Wrapper>\n );\n};\n"],"names":["Item","_ref","item","path","currentLevel","index","ariaControls","ariaExpanded","ariaLevel","ariaLabel","value","label","disabled","contentLeft","contentRight","ref","useRef","_useContext","useContext","Context","focusedPath","checked","multiple","size","handleCheckboxChange","handleItemClick","variant","renderItem","valueToItemMap","treeId","itemDisabled","Boolean","isDisabledClassName","classes","dropdownItemIsDisabled","undefined","focusedClass","length","dropdownItemIsFocused","activeClass","dropdownItemIsActive","useDidMountEffect","current","scrollIntoView","behavior","block","inline","handleChange","e","stopPropagation","handleClick","React","createElement","Wrapper","className","cx","id","getItemId","onClick","role","get","IconWrapper","StyledCheckboxWrapper","StyledCheckbox","indeterminate","onChange","selectItemCheckbox","_StyledIndicator","StyledIndicator","view","IconDone","sizeToIconSize","color","StyledText","StyledWrapper","StyledCell","alignContentLeft","alignContentRight","title","isEmpty","items","DisclosureIconWrapper","IconDisclosureRightCentered"],"mappings":";;;;;;;;;;;;;;IAsBaA,IAAmB,GAAG,SAAtBA,IAAmBA,CAAAC,IAAA,EAS1B;AAAA,EAAA,IARFC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IACLC,YAAY,GAAAL,IAAA,CAAZK,YAAY;IACZC,YAAY,GAAAN,IAAA,CAAZM,YAAY;IACZC,SAAS,GAAAP,IAAA,CAATO,SAAS;IACTC,SAAS,GAAAR,IAAA,CAATQ,SAAS,CAAA;AAET,EAAA,IAAQC,KAAK,GAAiDR,IAAI,CAA1DQ,KAAK;IAAEC,KAAK,GAA0CT,IAAI,CAAnDS,KAAK;IAAEC,QAAQ,GAAgCV,IAAI,CAA5CU,QAAQ;IAAEC,WAAW,GAAmBX,IAAI,CAAlCW,WAAW;IAAEC,YAAY,GAAKZ,IAAI,CAArBY,YAAY,CAAA;AACzD,EAAA,IAAMC,GAAG,GAAGC,MAAM,CAAuB,IAAI,CAAC,CAAA;AAE9C,EAAA,IAAAC,WAAA,GAWIC,UAAU,CAACC,OAAO,CAAC;IAVnBC,WAAW,GAAAH,WAAA,CA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ACsB,aAAa,EAAA;AAACpB,IAAAA,SAAS,EAAC,MAAA;AAAM,GAAA,eAC3BH,KAAA,CAAAC,aAAA,CAACuB,UAAU,EAAA;AACPN,IAAAA,IAAI,EAAC,SAAS;AACd9C,IAAAA,IAAI,EAAC,GAAG;AACRV,IAAAA,WAAW,EAAEA,WAAY;AACzBC,IAAAA,YAAY,EAAEA,YAAa;AAC3B8D,IAAAA,gBAAgB,EAAC,QAAQ;AACzBC,IAAAA,iBAAiB,EAAC,QAAQ;AAC1BC,IAAAA,KAAK,EAAEnE,KAAAA;GACV,CACU,CAClB,EAEA,CAACoE,OAAO,CAAC7E,IAAI,CAAC8E,KAAK,CAAC,iBACjB7B,KAAA,CAAAC,aAAA,CAAC6B,qBAAqB,qBAClB9B,KAAA,CAAAC,aAAA,CAAC8B,2BAA2B,EAAA;AAAC3D,IAAAA,IAAI,EAAEgD,cAAc,CAAChD,IAAI,EAAEG,OAAO,CAAE;AAAC8C,IAAAA,KAAK,EAAC,SAAA;GAAW,CAChE,CAEtB,CAAC,CAAA;AAElB;;;;"}
1
+ {"version":3,"file":"Item.js","sources":["../../../../../../../../src/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.tsx"],"sourcesContent":["import React, { useRef, FC, useContext } from 'react';\n\nimport { sizeToIconSize, getItemId } from '../../../../utils';\nimport { classes } from '../../../../Combobox.tokens';\nimport { cx, isEmpty } from '../../../../../../../utils';\nimport { IconDisclosureRightCentered, IconDone } from '../../../../../../_Icon';\nimport { Context } from '../../../../Combobox';\nimport { useDidMountEffect } from '../../../../../../../hooks';\n\nimport { ItemProps } from './Item.types';\nimport {\n StyledWrapper,\n StyledText,\n Wrapper,\n DisclosureIconWrapper,\n StyledCheckbox,\n IconWrapper,\n StyledIndicator,\n StyledCheckboxWrapper,\n StyledCell,\n} from './Item.styles';\n\nexport const Item: FC<ItemProps> = ({\n item,\n path,\n currentLevel,\n index,\n ariaControls,\n ariaExpanded,\n ariaLevel,\n ariaLabel,\n}) => {\n const { value, label, disabled, contentLeft, contentRight } = item;\n const ref = useRef<HTMLLIElement | null>(null);\n\n const {\n focusedPath,\n checked,\n multiple,\n size,\n handleCheckboxChange,\n handleItemClick,\n variant,\n renderItem,\n valueToItemMap,\n treeId,\n } = useContext(Context);\n\n const isDisabledClassName = disabled ? classes.dropdownItemIsDisabled : undefined;\n\n const focusedClass =\n currentLevel === focusedPath.length - 1 && index === focusedPath?.[currentLevel]\n ? classes.dropdownItemIsFocused\n : undefined;\n const activeClass = value === path?.[currentLevel + 1] ? classes.dropdownItemIsActive : undefined;\n\n useDidMountEffect(() => {\n if (focusedClass && ref?.current) {\n ref.current.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n }, [focusedClass]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (disabled) return;\n\n e.stopPropagation();\n\n handleCheckboxChange(item);\n };\n\n const handleClick = (e: React.MouseEvent<HTMLElement>) => {\n if (disabled) {\n e.stopPropagation();\n return;\n }\n\n handleItemClick(item, e);\n };\n\n return (\n <Wrapper\n className={cx(isDisabledClassName, focusedClass, activeClass)}\n id={getItemId(treeId, value)}\n ref={ref}\n onClick={handleClick}\n variant={variant}\n role=\"treeitem\"\n aria-controls={ariaControls}\n aria-expanded={ariaExpanded}\n aria-level={ariaLevel}\n aria-label={ariaLabel}\n aria-selected={Boolean(checked.get(item.value))}\n >\n <IconWrapper variant={variant}>\n {multiple && (\n <StyledCheckboxWrapper onClick={(e) => e.stopPropagation()}>\n <StyledCheckbox\n checked={Boolean(checked.get(item.value))}\n indeterminate={checked.get(item.value) === 'indeterminate'}\n onChange={handleChange}\n className={classes.selectItemCheckbox}\n />\n </StyledCheckboxWrapper>\n )}\n\n {!multiple && checked.get(item.value) === 'dot' && <StyledIndicator size=\"s\" view=\"default\" />}\n\n {!multiple && checked.get(item.value) === 'done' && (\n <IconDone size={sizeToIconSize(size, variant)} color=\"inherit\" />\n )}\n </IconWrapper>\n\n {renderItem ? (\n <StyledText>{renderItem(valueToItemMap.get(value)!)}</StyledText>\n ) : (\n <StyledWrapper>\n <StyledCell\n view=\"default\"\n size=\"l\"\n contentLeft={contentLeft}\n contentRight={contentRight}\n alignContentLeft=\"center\"\n alignContentRight=\"center\"\n title={label}\n />\n </StyledWrapper>\n )}\n\n {!isEmpty(item.items) && (\n <DisclosureIconWrapper>\n <IconDisclosureRightCentered size={sizeToIconSize(size, variant)} color=\"inherit\" />\n </DisclosureIconWrapper>\n )}\n </Wrapper>\n );\n};\n"],"names":["Item","_ref","item","path","currentLevel","index","ariaControls","ariaExpanded","ariaLevel","ariaLabel","value","label","disabled","contentLeft","contentRight","ref","useRef","_useContext","useContext","Context","focusedPath","checked","multiple","size","handleCheckboxChange","handleItemClick","variant","renderItem","valueToItemMap","treeId","isDisabledClassName","classes","dropdownItemIsDisabled","undefined","focusedClass","length","dropdownItemIsFocused","activeClass","dropdownItemIsActive","useDidMountEffect","current","scrollIntoView","behavior","block","inline","handleChange","e","stopPropagation","handleClick","React","createElement","Wrapper","className","cx","id","getItemId","onClick","role","Boolean","get","IconWrapper","StyledCheckboxWrapper","StyledCheckbox","indeterminate","onChange","selectItemCheckbox","_StyledIndicator","StyledIndicator","view","IconDone","sizeToIconSize","color","StyledText","StyledWrapper","StyledCell","alignContentLeft","alignContentRight","title","isEmpty","items","DisclosureIconWrapper","IconDisclosureRightCentered"],"mappings":";;;;;;;;;;;;;;IAsBaA,IAAmB,GAAG,SAAtBA,IAAmBA,CAAAC,IAAA,EAS1B;AAAA,EAAA,IARFC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IACLC,YAAY,GAAAL,IAAA,CAAZK,YAAY;IACZC,YAAY,GAAAN,IAAA,CAAZM,YAAY;IACZC,SAAS,GAAAP,IAAA,CAATO,SAAS;IACTC,SA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AK,MAAM,iBAC5CuC,KAAA,CAAAC,aAAA,CAACmB,QAAQ,EAAA;AAAC9C,IAAAA,IAAI,EAAE+C,cAAc,CAAC/C,IAAI,EAAEG,OAAO,CAAE;AAAC6C,IAAAA,KAAK,EAAC,SAAA;AAAS,GAAE,CAE3D,CAAC,EAEb5C,UAAU,gBACPsB,KAAA,CAAAC,aAAA,CAACsB,UAAU,EAAA,IAAA,EAAE7C,UAAU,CAACC,cAAc,CAAC+B,GAAG,CAACjD,KAAK,CAAE,CAAc,CAAC,gBAEjEuC,KAAA,CAAAC,aAAA,CAACuB,aAAa,EACVxB,IAAAA,eAAAA,KAAA,CAAAC,aAAA,CAACwB,UAAU,EAAA;AACPN,IAAAA,IAAI,EAAC,SAAS;AACd7C,IAAAA,IAAI,EAAC,GAAG;AACRV,IAAAA,WAAW,EAAEA,WAAY;AACzBC,IAAAA,YAAY,EAAEA,YAAa;AAC3B6D,IAAAA,gBAAgB,EAAC,QAAQ;AACzBC,IAAAA,iBAAiB,EAAC,QAAQ;AAC1BC,IAAAA,KAAK,EAAElE,KAAAA;GACV,CACU,CAClB,EAEA,CAACmE,OAAO,CAAC5E,IAAI,CAAC6E,KAAK,CAAC,iBACjB9B,KAAA,CAAAC,aAAA,CAAC8B,qBAAqB,qBAClB/B,KAAA,CAAAC,aAAA,CAAC+B,2BAA2B,EAAA;AAAC1D,IAAAA,IAAI,EAAE+C,cAAc,CAAC/C,IAAI,EAAEG,OAAO,CAAE;AAAC6C,IAAAA,KAAK,EAAC,SAAA;GAAW,CAChE,CAEtB,CAAC,CAAA;AAElB;;;;"}
@@ -9,9 +9,10 @@ import { objectSpread2 as _objectSpread2 } from '../../../../_virtual/_rollupPlu
9
9
  // Не мутирует исходные данные.
10
10
  var filterItems = function filterItems(items, textValue, currentLabel, customFilter) {
11
11
  if (!textValue || textValue === currentLabel) return items;
12
- var filter = customFilter || function (label, value) {
12
+ var defaultFilter = function defaultFilter(label, value) {
13
13
  return label.toLowerCase().includes(value.toLowerCase());
14
14
  };
15
+ var filter = customFilter || defaultFilter;
15
16
  var dfs = function dfs(items) {
16
17
  var newItems = [];
17
18
  items.forEach(function (item) {
@@ -1 +1 @@
1
- {"version":3,"file":"filterItems.js","sources":["../../../../../src/components/Combobox/ComboboxNew/utils/filterItems.ts"],"sourcesContent":["import { ItemOptionTransformed } from '../ui/Inner/ui/Item/Item.types';\n\n// Утилита, возвращающая отфильтрованное дерево items.\n// Фильтрация происходит как по названиям категорий, так и по названиям конечных элементов.\n// По дефолту регистр игнорируется. Но можно прокинуть свою функцию для кастомной фильтрации.\n// Фильтрация отключается в 2 случаях:\n// 1) При пустом инпуте (юзер пока еще не ввел значение или уже очистил);\n// 2) Если значение инпута совпадает с выбранным элементом (когда юзер выбрал айтем, но потом решил снова открыть);\n// Не мутирует исходные данные.\nexport const filterItems = (\n items: Array<ItemOptionTransformed>,\n textValue: string,\n currentLabel: string,\n customFilter?: (label: string, value: string) => boolean,\n): Array<ItemOptionTransformed> => {\n if (!textValue || textValue === currentLabel) return items;\n\n const filter =\n customFilter || ((label: string, value: string) => label.toLowerCase().includes(value.toLowerCase()));\n\n const dfs = (items: Array<ItemOptionTransformed>) => {\n const newItems: Array<ItemOptionTransformed> = [];\n\n items.forEach((item) => {\n if (item.items) {\n if (filter(item.label, textValue)) {\n newItems.push(item);\n return;\n }\n\n const res = dfs(item.items);\n\n if (res.length > 0) {\n newItems.push({ ...item, items: res });\n }\n } else if (filter(item.label, textValue)) {\n newItems.push(item);\n }\n });\n\n return newItems;\n };\n dfs(items);\n\n return dfs(items);\n};\n"],"names":["filterItems","items","textValue","currentLabel","customFilter","filter","label","value","toLowerCase","includes","dfs","newItems","forEach","item","push","res","length","_objectSpread"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACaA,IAAAA,WAAW,GAAG,SAAdA,WAAWA,CACpBC,KAAmC,EACnCC,SAAiB,EACjBC,YAAoB,EACpBC,YAAwD,EACzB;EAC/B,IAAI,CAACF,SAAS,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Items.js","sources":["../../../../../src/components/Combobox/ComboboxNew/utils/filterItems.ts"],"sourcesContent":["import { ItemOptionTransformed } from '../ui/Inner/ui/Item/Item.types';\n\n// Утилита, возвращающая отфильтрованное дерево items.\n// Фильтрация происходит как по названиям категорий, так и по названиям конечных элементов.\n// По дефолту регистр игнорируется. Но можно прокинуть свою функцию для кастомной фильтрации.\n// Фильтрация отключается в 2 случаях:\n// 1) При пустом инпуте (юзер пока еще не ввел значение или уже очистил);\n// 2) Если значение инпута совпадает с выбранным элементом (когда юзер выбрал айтем, но потом решил снова открыть);\n// Не мутирует исходные данные.\nexport const filterItems = (\n items: Array<ItemOptionTransformed>,\n textValue: string,\n currentLabel: string,\n customFilter?: (label: string, value: string) => boolean,\n): Array<ItemOptionTransformed> => {\n if (!textValue || textValue === currentLabel) return items;\n\n const defaultFilter = (label: string, value: string) => label.toLowerCase().includes(value.toLowerCase());\n\n const filter = customFilter || defaultFilter;\n\n const dfs = (items: Array<ItemOptionTransformed>) => {\n const newItems: Array<ItemOptionTransformed> = [];\n\n items.forEach((item) => {\n if (item.items) {\n if (filter(item.label, textValue)) {\n newItems.push(item);\n return;\n }\n\n const res = dfs(item.items);\n\n if (res.length > 0) {\n newItems.push({ ...item, items: res });\n }\n } else if (filter(item.label, textValue)) {\n newItems.push(item);\n }\n });\n\n return newItems;\n };\n dfs(items);\n\n return dfs(items);\n};\n"],"names":["filterItems","items","textValue","currentLabel","customFilter","defaultFilter","label","value","toLowerCase","includes","filter","dfs","newItems","forEach","item","push","res","length","_objectSpread"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACaA,IAAAA,WAAW,GAAG,SAAdA,WAAWA,CACpBC,KAAmC,EACnCC,SAAiB,EACjBC,YAAoB,EACpBC,YAAwD,EACzB;EAC/B,IAAI,CAACF,SAAS,IAAIA,SAAS,KAAKC,YAAY,EAAE,OAAOF,KAAK,CAAA;AAE1D,EAAA,IAAMI,aAAa,GAAG,SAAhBA,aAAaA,CAAIC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Provider = function PopupProvider(_ref) {
20
20
  var children = _ref.children;
21
- var prevBodyOverflowY = useRef(document.body.style.overflowY);
21
+ var prevBodyOverflowY = useRef(typeof document !== 'undefined' ? document.body.style.overflowY : '');
22
22
  var _useState = useState([]),
23
23
  _useState2 = _slicedToArray(_useState, 2),
24
24
  items = _useState2[0],
@@ -1 +1 @@
1
- {"version":3,"file":"PopupContext.js","sources":["../../../src/components/Popup/PopupContext.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState, useContext, FC, PropsWithChildren, useRef } from 'react';\n\nimport { hasModals } from '../Modal/ModalContext';\n\nimport type { PopupContextType, PopupInfo } from './Popup.types';\n\nexport const POPUP_PORTAL_ID = 'plasma-popup-root';\n\nconst items: PopupInfo[] = [];\n\nconst PopupContext = createContext<PopupContextType>({\n items,\n register(_info: PopupInfo): void {\n throw new Error('Function not implemented. Add PopupProvider');\n },\n unregister(_id: string): void {\n throw new Error('Function not implemented. Add PopupProvider');\n },\n});\n\nexport const usePopupContext = () => useContext(PopupContext);\n\nexport const PopupProvider: FC<PropsWithChildren> = ({ children }) => {\n const prevBodyOverflowY = useRef(document.body.style.overflowY);\n const [items, setItems] = useState<PopupInfo[]>([]);\n\n const register = (info: PopupInfo) => {\n setItems((prevItems) => {\n if (info.info?.isModal && !hasModals(prevItems)) {\n prevBodyOverflowY.current = document.body.style.overflowY;\n document.body.style.overflowY = 'hidden';\n }\n\n return [...prevItems, info];\n });\n };\n\n const unregister = (id: string) => {\n setItems((prevItems) => {\n const index = prevItems.findIndex((item: PopupInfo) => id === item.id);\n\n if (index === -1) {\n return prevItems;\n }\n\n const prevHasModals = hasModals(prevItems);\n prevItems.splice(index, 1);\n\n if (prevHasModals && !hasModals(prevItems)) {\n document.body.style.overflowY = prevBodyOverflowY.current;\n }\n\n // при return prevItems не обновится контекст\n return [...prevItems];\n });\n };\n\n const context = {\n items,\n register,\n unregister,\n };\n\n useEffect(() => {\n return () => {\n const portal = document.createElement('div');\n if (portal && document.body.contains(portal)) {\n document.body.removeChild(portal);\n }\n };\n }, []);\n\n return <PopupContext.Provider value={context}>{children}</PopupContext.Provider>;\n};\n"],"names":["POPUP_PORTAL_ID","items","PopupContext","createContext","register","_info","Error","unregister","_id","usePopupContext","useContext","PopupProvider","_ref","children","prevBodyOverflowY","useRef","document","body","style","overflowY","_useState","useState","_useState2","_slicedToArray","setItems","info","prevItems","_info$info","isModal","hasModals","current","concat","_toConsumableArray","id","index","findIndex","item","prevHasModals","splice","context","useEffect","portal","createElement","contains","removeChild","React","Provider","value"],"mappings":";;;;AAMO,IAAMA,eAAe,GAAG,oBAAmB;AAElD,IAAMC,KAAkB,GAAG,EAAE,CAAA;AAE7B,IAAMC,YAAY,gBAAGC,aAAa,CAAmB;AACjDF,EAAAA,KAAK,EAALA,KAAK;EACLG,QAAQ,EAAA,SAAAA,QAACC,CAAAA,KAAgB,EAAQ;AAC7B,IAAA,MAAM,IAAIC,KAAK,CAAC,6CAA6C,CAAC,CAAA;GACjE;EACDC,UAAU,EAAA,SAAAA,UAACC,CAAAA,GAAW,EAAQ;AAC1B,IAAA,MAAM,IAAIF,KAAK,CAAC,6CAA6C,CAAC,CAAA;AAClE,GAAA;AACJ,CAAC,CAAC,CAAA;AAEWG,IAAAA,eAAe,GAAG,SAAlBA,eAAeA,GAAA;EAAA,OAASC,UAAU,CAACR,YAAY,CAAC,CAAA;AAAA,EAAA;IAEhDS,aAAoC,GAAG,SAAvCA,aAAoCA,CAAAC,IAAA,EAAqB;AAAA,EAAA,IAAfC,QAAQ,GAAAD,IAAA,CAARC,QAAQ,CAAA;EAC3D,IAAMC,iBAAiB,GAAGC,MAAM,CAACC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAACC,SAAS,CAAC,CAAA;AAC/D,EAAA,IAAAC,SAAA,GAA0BC,QAAQ,CAAc,EAAE,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAA5CnB,IAAAA,KAAK,GAAAqB,UAAA,CAA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CV,QAAQ,CAACC,IAAI,CAACC,KAAK,CAACC,SAAS,GAAGL,iBAAiB,CAACgB,OAAO,CAAA;AAC7D,OAAA;;AAEA;MACA,OAAAE,kBAAA,CAAWN,SAAS,CAAA,CAAA;AACxB,KAAC,CAAC,CAAA;GACL,CAAA;AAED,EAAA,IAAMa,OAAO,GAAG;AACZtC,IAAAA,KAAK,EAALA,KAAK;AACLG,IAAAA,QAAQ,EAARA,QAAQ;AACRG,IAAAA,UAAU,EAAVA,UAAAA;GACH,CAAA;AAEDiC,EAAAA,SAAS,CAAC,YAAM;AACZ,IAAA,OAAO,YAAM;AACT,MAAA,IAAMC,MAAM,GAAGzB,QAAQ,CAAC0B,aAAa,CAAC,KAAK,CAAC,CAAA;MAC5C,IAAID,MAAM,IAAIzB,QAAQ,CAACC,IAAI,CAAC0B,QAAQ,CAACF,MAAM,CAAC,EAAE;AAC1CzB,QAAAA,QAAQ,CAACC,IAAI,CAAC2B,WAAW,CAACH,MAAM,CAAC,CAAA;AACrC,OAAA;KACH,CAAA;GACJ,EAAE,EAAE,CAAC,CAAA;AAEN,EAAA,oBAAOI,KAAA,CAAAH,aAAA,CAACxC,YAAY,CAAC4C,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAER,OAAAA;AAAQ,GAAA,EAAE1B,QAAgC,CAAC,CAAA;AACpF;;;;"}
1
+ {"version":3,"file":"PopupContext.js","sources":["../../../src/components/Popup/PopupContext.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState, useContext, FC, PropsWithChildren, useRef } from 'react';\n\nimport { hasModals } from '../Modal/ModalContext';\n\nimport type { PopupContextType, PopupInfo } from './Popup.types';\n\nexport const POPUP_PORTAL_ID = 'plasma-popup-root';\n\nconst items: PopupInfo[] = [];\n\nconst PopupContext = createContext<PopupContextType>({\n items,\n register(_info: PopupInfo): void {\n throw new Error('Function not implemented. Add PopupProvider');\n },\n unregister(_id: string): void {\n throw new Error('Function not implemented. Add PopupProvider');\n },\n});\n\nexport const usePopupContext = () => useContext(PopupContext);\n\nexport const PopupProvider: FC<PropsWithChildren> = ({ children }) => {\n const prevBodyOverflowY = useRef(typeof document !== 'undefined' ? document.body.style.overflowY : '');\n const [items, setItems] = useState<PopupInfo[]>([]);\n\n const register = (info: PopupInfo) => {\n setItems((prevItems) => {\n if (info.info?.isModal && !hasModals(prevItems)) {\n prevBodyOverflowY.current = document.body.style.overflowY;\n document.body.style.overflowY = 'hidden';\n }\n\n return [...prevItems, info];\n });\n };\n\n const unregister = (id: string) => {\n setItems((prevItems) => {\n const index = prevItems.findIndex((item: PopupInfo) => id === item.id);\n\n if (index === -1) {\n return prevItems;\n }\n\n const prevHasModals = hasModals(prevItems);\n prevItems.splice(index, 1);\n\n if (prevHasModals && !hasModals(prevItems)) {\n document.body.style.overflowY = prevBodyOverflowY.current;\n }\n\n // при return prevItems не обновится контекст\n return [...prevItems];\n });\n };\n\n const context = {\n items,\n register,\n unregister,\n };\n\n useEffect(() => {\n return () => {\n const portal = document.createElement('div');\n if (portal && document.body.contains(portal)) {\n document.body.removeChild(portal);\n }\n };\n }, []);\n\n return <PopupContext.Provider value={context}>{children}</PopupContext.Provider>;\n};\n"],"names":["POPUP_PORTAL_ID","items","PopupContext","createContext","register","_info","Error","unregister","_id","usePopupContext","useContext","PopupProvider","_ref","children","prevBodyOverflowY","useRef","document","body","style","overflowY","_useState","useState","_useState2","_slicedToArray","setItems","info","prevItems","_info$info","isModal","hasModals","current","concat","_toConsumableArray","id","index","findIndex","item","prevHasModals","splice","context","useEffect","portal","createElement","contains","removeChild","React","Provider","value"],"mappings":";;;;AAMO,IAAMA,eAAe,GAAG,oBAAmB;AAElD,IAAMC,KAAkB,GAAG,EAAE,CAAA;AAE7B,IAAMC,YAAY,gBAAGC,aAAa,CAAmB;AACjDF,EAAAA,KAAK,EAALA,KAAK;EACLG,QAAQ,EAAA,SAAAA,QAACC,CAAAA,KAAgB,EAAQ;AAC7B,IAAA,MAAM,IAAIC,KAAK,CAAC,6CAA6C,CAAC,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AC1CzB,QAAAA,QAAQ,CAACC,IAAI,CAAC2B,WAAW,CAACH,MAAM,CAAC,CAAA;AACrC,OAAA;KACH,CAAA;GACJ,EAAE,EAAE,CAAC,CAAA;AAEN,EAAA,oBAAOI,KAAA,CAAAH,aAAA,CAACxC,YAAY,CAAC4C,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAER,OAAAA;AAAQ,GAAA,EAAE1B,QAAgC,CAAC,CAAA;AACpF;;;;"}
@@ -4,10 +4,7 @@ var useOutsideClick = function useOutsideClick(callback, secondaryRef) {
4
4
  var ref = useRef(null);
5
5
  useEffect(function () {
6
6
  var handleClickOutside = function handleClickOutside(event) {
7
- if (ref.current && !ref.current.contains(event.target)
8
- // secondaryRef.current &&
9
- // !secondaryRef.current.contains(event.target as Node)
10
- ) {
7
+ if (ref.current && !ref.current.contains(event.target)) {
11
8
  if (!(secondaryRef !== null && secondaryRef !== void 0 && secondaryRef.current) || secondaryRef.current && !secondaryRef.current.contains(event.target)) {
12
9
  callback();
13
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useOutsideClick.js","sources":["../../src/hooks/useOutsideClick.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { RefObject } from 'react';\n\nexport const useOutsideClick = <T extends HTMLElement = HTMLElement>(\n callback: () => void,\n secondaryRef?: RefObject<HTMLElement | null> | null,\n) => {\n const ref = useRef<T | null>(null);\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent | TouchEvent) => {\n if (\n ref.current &&\n !ref.current.contains(event.target as Node)\n // secondaryRef.current &&\n // !secondaryRef.current.contains(event.target as Node)\n ) {\n if (\n !secondaryRef?.current ||\n (secondaryRef.current && !secondaryRef.current.contains(event.target as Node))\n ) {\n callback();\n }\n }\n };\n\n document.addEventListener('mouseup', handleClickOutside);\n document.addEventListener('touchend', handleClickOutside);\n\n return () => {\n document.removeEventListener('mouseup', handleClickOutside);\n document.removeEventListener('touchend', handleClickOutside);\n };\n }, [callback]);\n\n return ref;\n};\n"],"names":["useOutsideClick","callback","secondaryRef","ref","useRef","useEffect","handleClickOutside","event","current","contains","target","document","addEventListener","removeEventListener"],"mappings":";;AAGO,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CACxBC,QAAoB,EACpBC,YAAmD,EAClD;AACD,EAAA,IAAMC,GAAG,GAAGC,MAAM,CAAW,IAAI,CAAC,CAAA;AAClCC,EAAAA,SAAS,CAAC,YAAM;AACZ,IAAA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,KAA8B,EAAK;AAC3D,MAAA,IACIJ,GAAG,CAACK,OAAO,IACX,CAACL,GAAG,CAACK,OAAO,CAACC,QAAQ,CAACF,KAAK,CAACG,MAAc,CAAA;AAC1C;AACA;QACF;QACE,IACI,EAACR,YAAY,KAAA,IAAA,IAAZA,YAAY,KAAA,KAAA,CAAA,IAAZA,YAAY,CAAEM,OAAO,CACrBN,IAAAA,YAAY,CAACM,OAAO,IAAI,CAACN,YAAY,CAACM,OAAO,CAACC,QAAQ,CAACF,KAAK,CAACG,MAAc,CAAE,EAChF;AACET,UAAAA,QAAQ,EAAE,CAAA;AACd,SAAA;AACJ,OAAA;KACH,CAAA;AAEDU,IAAAA,QAAQ,CAACC,gBAAgB,CAAC,SAAS,EAAEN,kBAAkB,CAAC,CAAA;AACxDK,IAAAA,QAAQ,CAACC,gBAAgB,CAAC,UAAU,EAAEN,kBAAkB,CAAC,CAAA;AAEzD,IAAA,OAAO,YAAM;AACTK,MAAAA,QAAQ,CAACE,mBAAmB,CAAC,SAAS,EAAEP,kBAAkB,CAAC,CAAA;AAC3DK,MAAAA,QAAQ,CAACE,mBAAmB,CAAC,UAAU,EAAEP,kBAAkB,CAAC,CAAA;KAC/D,CAAA;AACL,GAAC,EAAE,CAACL,QAAQ,CAAC,CAAC,CAAA;AAEd,EAAA,OAAOE,GAAG,CAAA;AACd;;;;"}
1
+ {"version":3,"file":"useOutsideClick.js","sources":["../../src/hooks/useOutsideClick.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { RefObject } from 'react';\n\nexport const useOutsideClick = <T extends HTMLElement = HTMLElement>(\n callback: () => void,\n secondaryRef?: RefObject<HTMLElement | null> | null,\n) => {\n const ref = useRef<T | null>(null);\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent | TouchEvent) => {\n if (ref.current && !ref.current.contains(event.target as Node)) {\n if (\n !secondaryRef?.current ||\n (secondaryRef.current && !secondaryRef.current.contains(event.target as Node))\n ) {\n callback();\n }\n }\n };\n\n document.addEventListener('mouseup', handleClickOutside);\n document.addEventListener('touchend', handleClickOutside);\n\n return () => {\n document.removeEventListener('mouseup', handleClickOutside);\n document.removeEventListener('touchend', handleClickOutside);\n };\n }, [callback]);\n\n return ref;\n};\n"],"names":["useOutsideClick","callback","secondaryRef","ref","useRef","useEffect","handleClickOutside","event","current","contains","target","document","addEventListener","removeEventListener"],"mappings":";;AAGO,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CACxBC,QAAoB,EACpBC,YAAmD,EAClD;AACD,EAAA,IAAMC,GAAG,GAAGC,MAAM,CAAW,IAAI,CAAC,CAAA;AAClCC,EAAAA,SAAS,CAAC,YAAM;AACZ,IAAA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,KAA8B,EAAK;AAC3D,MAAA,IAAIJ,GAAG,CAACK,OAAO,IAAI,CAACL,GAAG,CAACK,OAAO,CAACC,QAAQ,CAACF,KAAK,CAACG,MAAc,CAAC,EAAE;QAC5D,IACI,EAACR,YAAY,KAAA,IAAA,IAAZA,YAAY,KAAA,KAAA,CAAA,IAAZA,YAAY,CAAEM,OAAO,CACrBN,IAAAA,YAAY,CAACM,OAAO,IAAI,CAACN,YAAY,CAACM,OAAO,CAACC,QAAQ,CAACF,KAAK,CAACG,MAAc,CAAE,EAChF;AACET,UAAAA,QAAQ,EAAE,CAAA;AACd,SAAA;AACJ,OAAA;KACH,CAAA;AAEDU,IAAAA,QAAQ,CAACC,gBAAgB,CAAC,SAAS,EAAEN,kBAAkB,CAAC,CAAA;AACxDK,IAAAA,QAAQ,CAACC,gBAAgB,CAAC,UAAU,EAAEN,kBAAkB,CAAC,CAAA;AAEzD,IAAA,OAAO,YAAM;AACTK,MAAAA,QAAQ,CAACE,mBAAmB,CAAC,SAAS,EAAEP,kBAAkB,CAAC,CAAA;AAC3DK,MAAAA,QAAQ,CAACE,mBAAmB,CAAC,UAAU,EAAEP,kBAAkB,CAAC,CAAA;KAC/D,CAAA;AACL,GAAC,EAAE,CAACL,QAAQ,CAAC,CAAC,CAAA;AAEd,EAAA,OAAOE,GAAG,CAAA;AACd;;;;"}
package/es/index.css CHANGED
@@ -474,11 +474,11 @@
474
474
 
475
475
  .Target_styles_1y5ups3_s1wiuml6__7a46cf8a{--plasma-textfield-color:var(--plasma-combobox-new-textfield-color);--plasma-textfield-bg-color:var(--plasma-combobox-new-textfield-background-color);--plasma-textfield-bg-color-hover:var(--plasma-combobox-new-textfield-background-color-hover);--plasma-textfield-bg-color-focus:var(--plasma-combobox-new-textfield-background-color-focus);--plasma-textfield-border-color:var(--plasma-combobox-new-textfield-border-color);--plasma-textfield-border-color-hover:var(--plasma-combobox-new-textfield-border-color-hover);--plasma-textfield-border-color-focus:var(--plasma-combobox-new-textfield-border-color-focus);--plasma-textfield-color-readonly:var(--plasma-combobox-new-textfield-color-readonly);--plasma-textfield-bg-color-readonly:var(--plasma-combobox-new-textfield-bg-color-readonly);--plasma-textfield-border-color-readonly:var(--plasma-combobox-new-textfield-border-color-readonly);--plasma-textfield__placeholder-color-readonly:var(--plasma-combobox-new-textfield__placeholder-color-readonly);--plasma-textfield__caret-color:var(--plasma-combobox-new-textfield-caret-color);--plasma-textfield__placeholder-color:var(--plasma-combobox-new-textfield-placeholder-color);--plasma-textfield-height:var(--plasma-combobox-new-textfield-height);--plasma-textfield-border-width:var(--plasma-combobox-new-textfield-border-width);--plasma-textfield-border-radius:var(--plasma-combobox-new-textfield-border-radius);--plasma-textfield-padding:var(--plasma-combobox-new-textfield-padding);--plasma-textfield__left-content-margin:var(--plasma-combobox-new-textfield__left-content-margin);--plasma-textfield__right-content-margin:var(--plasma-combobox-new-textfield__right-content-margin);--plasma-textfield-font-family:var(--plasma-combobox-new-textfield-font-family);--plasma-textfield-font-style:var(--plasma-combobox-new-textfield-font-style);--plasma-textfield-font-size:var(--plasma-combobox-new-textfield-font-size);--plasma-textfield-font-weight:var(--plasma-combobox-new-textfield-font-weight);--plasma-textfield-letter-spacing:var(--plasma-combobox-new-textfield-letter-spacing);--plasma-textfield-line-height:var(--plasma-combobox-new-textfield-line-height);--plasma-textfield__label-color:var(--plasma-combobox-new-textfield-label-color);--plasma-textfield__label-color-readonly:var(--plasma-combobox-new-textfield__label-color-readonly);--plasma-textfield__label-offset:var(--plasma-combobox-new-textfield__label-offset);--plasma-textfield__label-font-family:var(--plasma-combobox-new-textfield__label-font-family);--plasma-textfield__label-font-style:var(--plasma-combobox-new-textfield__label-font-style);--plasma-textfield__label-font-size:var(--plasma-combobox-new-textfield__label-font-size);--plasma-textfield__label-font-weight:var(--plasma-combobox-new-textfield__label-font-weight);--plasma-textfield__label-letter-spacing:var(--plasma-combobox-new-textfield__label-letter-spacing);--plasma-textfield__label-line-height:var(--plasma-combobox-new-textfield__label-line-height);--plasma-textfield-placement_inner__label-font-family:var(--plasma-combobox-new-textfield-placement_inner__label-font-family);--plasma-textfield-placement_inner__label-font-style:var(--plasma-combobox-new-textfield-placement_inner__label-font-style);--plasma-textfield-placement_inner__label-font-size:var(--plasma-combobox-new-textfield-placement_inner__label-font-size);--plasma-textfield-placement_inner__label-font-weight:var(--plasma-combobox-new-textfield-placement_inner__label-font-weight);--plasma-textfield-placement_inner__label-letter-spacing:var(--plasma-combobox-new-textfield-placement_inner__label-letter-spacing);--plasma-textfield-placement_inner__label-line-height:var(--plasma-combobox-new-textfield-placement_inner__label-line-height);--plasma-textfield-placement_inner__label-padding:var(--plasma-combobox-new-textfield-placement_inner__label-padding);--plasma-textfield-placement_inner__content-padding:var(--plasma-combobox-new-textfield-placement_inner__content-padding);--plasma-textfield__left-helper-color:var(--plasma-combobox-new-textfield__left-helper-color);--plasma-textfield__left-helper-color-readonly:var(--plasma-combobox-new-textfield__left-helper-color-readonly);--plasma-textfield__left-helper-offset:var(--plasma-combobox-new-textfield__left-helper-offset);--plasma-textfield__left-helper-font-family:var(--plasma-combobox-new-textfield__left-helper-font-family);--plasma-textfield__left-helper-font-style:var(--plasma-combobox-new-textfield__left-helper-font-style);--plasma-textfield__left-helper-font-size:var(--plasma-combobox-new-textfield__left-helper-font-size);--plasma-textfield__left-helper-font-weight:var(--plasma-combobox-new-textfield__left-helper-font-weight);--plasma-textfield__left-helper-letter-spacing:var(--plasma-combobox-new-textfield__left-helper-letter-spacing);--plasma-textfield__left-helper-line-height:var(--plasma-combobox-new-textfield__left-helper-line-height);--plasma-textfield__before-text-color:var(--plasma-combobox-new-textfield__before-text-color);--plasma-textfield__after-text-color:var(--plasma-combobox-new-textfield__after-text-color);--plasma-textfield__before-text-margin:var(--plasma-combobox-new-textfield__before-text-margin);--plasma-textfield__after-text-margin:var(--plasma-combobox-new-textfield__after-text-margin);--plasma-textfield-disabled-opacity:var(--plasma-combobox-new-textfield-disabled-opacity);--plasma-textfield-focus-color:var(--plasma-combobox-new-textfield-focus-color);--plasma-textfield__chip-close-icon-color:var(--plasma-combobox-new-textfield-chip-close-icons-color);--plasma-textfield__chip-color:var(--plasma-combobox-new-textfield-chip-color);--plasma-textfield__chip-background:var(--plasma-combobox-new-textfield--chip-background);--plasma-textfield__chip-color-hover:var(--plasma-combobox-new-textfield-chip-color-hover);--plasma-textfield__chip-background-hover:var(--plasma-combobox-new-textfield-chip-background-hover);--plasma-textfield__chip-color-active:var(--plasma-combobox-new-textfield-chip-color-active);--plasma-textfield__chip-background-active:var(--plasma-combobox-new-textfield-chip-background-active);--plasma-textfield__chip-background-readonly:var(--plasma-combobox-new-textfield-chip-background-read-only);--plasma-textfield__chip-color-readonly:var(--plasma-combobox-new-textfield-chip-color-read-only);--plasma-textfield__chip-background-readonly-hover:var(--plasma-combobox-new-textfield-chip-background-read-only-hover);--plasma-textfield__chip-color-readonly-hover:var(--plasma-combobox-new-textfield-chip-color-read-only-hover);--plasma-textfield__chip-opacity-readonly:var(--plasma-combobox-new-textfield-chip-opacity-read-only);--plasma-textfield__chip-gap:var(--plasma-combobox-new-textfield-chip-gap);--plasma-textfield__chip-border-radius:var(--plasma-combobox-new-textfield-chip-border-radius);--plasma-textfield__chip-width:var(--plasma-combobox-new-textfield-chip-width);--plasma-textfield__chip-height:var(--plasma-combobox-new-textfield-chip-height);--plasma-textfield__chip-padding-right:var(--plasma-combobox-new-textfield-chip-padding-right);--plasma-textfield__chip-padding-left:var(--plasma-combobox-new-textfield-chip-padding-left);--plasma-textfield__chip-clear-content-margin-left:var(--plasma-combobox-new-textfield-chip-clear-content-margin-left);--plasma-textfield__chip-clear-content-margin-right:var(--plasma-combobox-new-textfield-chip-clear-content-margin-right);--plasma-textfield__chip-close-icon-size:var(--plasma-combobox-new-textfield-chip-close-icon-size);--plasma-textfield__chip-font-family:var(--plasma-combobox-new-textfield-chip-font-family);--plasma-textfield__chip-font-size:var(--plasma-combobox-new-textfield-chip-font-size);--plasma-textfield__chip-font-style:var(--plasma-combobox-new-textfield-chip-font-style);--plasma-textfield__chip-font-weight:var(--plasma-combobox-new-textfield-chip-font-weight);--plasma-textfield__chip-letter-spacing:var(--plasma-combobox-new-textfield-chip-letter-spacing);--plasma-textfield__chip-line-height:var(--plasma-combobox-new-textfield-chip-line-height);--plasma-textfield-padding-with-chips:var(--plasma-combobox-new-textfield-padding-with-chips);}
476
476
 
477
- .Combobox_styles_79kgrq_uxiiees__26f8d1f9{box-sizing:border-box;background:var(--surface-solid-card);box-shadow:0px 4px 14px -4px rgba(8,8,8,0.08),0px 1px 4px -1px rgba(0,0,0,0.04);border-radius:var(--plasma-combobox-border-radius);width:var(--uxiiees-0);height:var(--uxiiees-1);overflow:var(--uxiiees-2);margin:var(--uxiiees-3);padding:var(--plasma-combobox-padding) 0;}.Combobox_styles_79kgrq_uxiiees__26f8d1f9 .Combobox_styles_79kgrq_comboboxEmptyStateWrapper__26f8d1f9{box-shadow:none;}
478
- .Combobox_styles_79kgrq_i1veo3wn__26f8d1f9{line-height:0;color:var(--text-secondary);cursor:pointer;}.Combobox_styles_79kgrq_i1veo3wn__26f8d1f9 .Combobox_styles_79kgrq_arrowInverse__26f8d1f9{-webkit-transform:rotate(-180deg);-ms-transform:rotate(-180deg);transform:rotate(-180deg);}
477
+ .Combobox_styles_iq2uzw_uxiiees__2edef9fc{box-sizing:border-box;background:var(--surface-solid-card);box-shadow:0px 4px 14px -4px rgba(8,8,8,0.08),0px 1px 4px -1px rgba(0,0,0,0.04);border-radius:var(--plasma-combobox-border-radius);width:var(--uxiiees-0);height:var(--uxiiees-1);overflow:var(--uxiiees-2);margin:var(--uxiiees-3);padding:var(--plasma-combobox-padding) 0;}.Combobox_styles_iq2uzw_uxiiees__2edef9fc .Combobox_styles_iq2uzw_comboboxEmptyStateWrapper__2edef9fc{box-shadow:none;}
478
+ .Combobox_styles_iq2uzw_i1veo3wn__2edef9fc{line-height:0;color:var(--text-secondary);cursor:var(--i1veo3wn-0);}.Combobox_styles_iq2uzw_i1veo3wn__2edef9fc .Combobox_styles_iq2uzw_arrowInverse__2edef9fc{-webkit-transform:rotate(-180deg);-ms-transform:rotate(-180deg);transform:rotate(-180deg);}.Combobox_styles_iq2uzw_i1veo3wn__2edef9fc:hover,.Combobox_styles_iq2uzw_i1veo3wn__2edef9fc:active{color:var(--i1veo3wn-1);}
479
479
 
480
480
 
481
- .Combobox_styles_79kgrq_s11cn92k__26f8d1f9{--plasma-emptystate-border-radius:var(--plasma-combobox-new-textfield-border-radius);--plasma-emptystate-padding:var(--plasma-combobox-new-empty-state-padding);--plasma-emptystate-font-family:var(--plasma-combobox-new-textfield-font-family);--plasma-emptystate-font-size:var(--plasma-combobox-new-textfield-font-size);--plasma-emptystate-font-style:var(--plasma-combobox-new-textfield-font-style);--plasma-emptystate-font-weight:var(--plasma-combobox-new-textfield-font-weight);--plasma-emptystate-font-letter-spacing:var(--plasma-combobox-new-textfield-letter-spacing);--plasma-emptystate-font-line-height:var(--plasma-combobox-new-textfield-line-height);}
481
+ .Combobox_styles_iq2uzw_s11cn92k__2edef9fc{--plasma-emptystate-border-radius:var(--plasma-combobox-new-textfield-border-radius);--plasma-emptystate-padding:var(--plasma-combobox-new-empty-state-padding);--plasma-emptystate-font-family:var(--plasma-combobox-new-textfield-font-family);--plasma-emptystate-font-size:var(--plasma-combobox-new-textfield-font-size);--plasma-emptystate-font-style:var(--plasma-combobox-new-textfield-font-style);--plasma-emptystate-font-weight:var(--plasma-combobox-new-textfield-font-weight);--plasma-emptystate-font-letter-spacing:var(--plasma-combobox-new-textfield-letter-spacing);--plasma-emptystate-font-line-height:var(--plasma-combobox-new-textfield-line-height);}
482
482
 
483
483
  .Indicator_styles_v8giip_b5hgwnm__ffd4472f{border-radius:100%;}
484
484
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salutejs/plasma-new-hope",
3
- "version": "0.138.0-canary.1406.10666365265.0",
3
+ "version": "0.138.0-canary.1406.10670971125.0",
4
4
  "description": "Salute Design System blueprint",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",
@@ -121,5 +121,5 @@
121
121
  "react-popper": "2.3.0",
122
122
  "storeon": "3.1.5"
123
123
  },
124
- "gitHead": "d09b771e9a611e74ad8bb99f086edf157a7221bb"
124
+ "gitHead": "ef5540a09b231cc141ab597dc0ba8c4786c68ecc"
125
125
  }
@@ -145,13 +145,16 @@ var comboboxRoot = exports.comboboxRoot = function comboboxRoot(Root) {
145
145
  }
146
146
  }
147
147
  }, floatingPopoverRef);
148
- var onChange = function onChange(e) {
148
+ var onChange = function onChange(newValue) {
149
149
  if (outerOnChange) {
150
- outerOnChange(e);
150
+ outerOnChange(newValue);
151
151
  }
152
- setInternalValue(e);
152
+ setInternalValue(newValue);
153
153
  };
154
154
  var handleClickArrow = function handleClickArrow() {
155
+ if (disabled) {
156
+ return;
157
+ }
155
158
  if (isCurrentListOpen) {
156
159
  dispatchPath({
157
160
  type: 'reset'
@@ -178,14 +181,17 @@ var comboboxRoot = exports.comboboxRoot = function comboboxRoot(Root) {
178
181
  };
179
182
 
180
183
  // Обработчик чипов
181
- var handleChangeChips = function handleChangeChips(chipsAsLabel) {
182
- onChange(chipsAsLabel.map(function (chipLabel) {
184
+ var handleChipsChange = function handleChipsChange(chipLabels) {
185
+ onChange(chipLabels.map(function (chipLabel) {
183
186
  return labelToItemMap.get(chipLabel).value;
184
187
  }));
185
188
  };
186
189
 
187
190
  // Обработчик открытия/закрытия выпадающего списка
188
191
  var handleToggle = function handleToggle(opened) {
192
+ if (disabled) {
193
+ return;
194
+ }
189
195
  if (opened) {
190
196
  dispatchPath({
191
197
  type: 'opened_first_level'
@@ -372,6 +378,7 @@ var comboboxRoot = exports.comboboxRoot = function comboboxRoot(Root) {
372
378
  placeholder: placeholder,
373
379
  contentLeft: contentLeft,
374
380
  contentRight: /*#__PURE__*/_react["default"].createElement(_Combobox2.IconArrowWrapper, {
381
+ disabled: disabled,
375
382
  onClick: handleClickArrow
376
383
  }, /*#__PURE__*/_react["default"].createElement(_Combobox2.StyledArrow, {
377
384
  color: "inherit",
@@ -390,7 +397,7 @@ var comboboxRoot = exports.comboboxRoot = function comboboxRoot(Root) {
390
397
  }, multiple ? {
391
398
  enumerationType: 'chip',
392
399
  chips: getChips(),
393
- onChangeChips: handleChangeChips
400
+ onChangeChips: handleChipsChange
394
401
  } : {
395
402
  enumerationType: 'plain'
396
403
  }, rest, {
@@ -447,8 +454,6 @@ var comboboxConfig = exports.comboboxConfig = {
447
454
  defaults: {
448
455
  view: 'default',
449
456
  size: 'm',
450
- // readOnly: false,
451
- // disabled: false,
452
457
  labelPlacement: 'outer'
453
458
  }
454
459
  };
@@ -31,7 +31,13 @@ var Ul = exports.Ul = /*#__PURE__*/_styledComponents["default"].ul.withConfig({
31
31
  }, _Combobox.tokens.padding, _Combobox.classes.emptyStateWrapper);
32
32
  var IconArrowWrapper = exports.IconArrowWrapper = /*#__PURE__*/_styledComponents["default"].div.withConfig({
33
33
  componentId: "plasma-new-hope__sc-2kddkg-1"
34
- })(["line-height:0;color:var(", ");cursor:pointer;.", "{transform:rotate(-180deg);}"], _Combobox.constants.disclosureIconColor, _Combobox.classes.arrowInverse);
34
+ })(["line-height:0;color:var(", ");cursor:", ";.", "{transform:rotate(-180deg);}&:hover,&:active{color:", ";}"], _Combobox.constants.disclosureIconColor, function (_ref5) {
35
+ var disabled = _ref5.disabled;
36
+ return disabled ? 'inherit' : 'pointer';
37
+ }, _Combobox.classes.arrowInverse, function (_ref6) {
38
+ var disabled = _ref6.disabled;
39
+ return disabled ? "var(".concat(_Combobox.constants.disclosureIconColor, ")") : "var(".concat(_Combobox.constants.disclosureIconColorHover, ")");
40
+ });
35
41
  var StyledArrow = exports.StyledArrow = /*#__PURE__*/(0, _styledComponents["default"])(_Icon.IconDisclosureDownCentered).withConfig({
36
42
  componentId: "plasma-new-hope__sc-2kddkg-2"
37
43
  })([""]);
@@ -52,12 +52,12 @@ var FloatingPopover = exports.FloatingPopover = /*#__PURE__*/(0, _react2.forward
52
52
  // Это нужно для более тонкой настройки reference-элемента, вокруг которого и будет позиционироваться выпадашка.
53
53
  // Пример: когда в Textfield под инпутом находится helperText (или еще что-либо),
54
54
  // но выпадающий список должен позиционироваться непосредственно возле самого инпута.
55
- var isTargetFunction = typeof target === 'function';
55
+ var isTargetAsFunction = typeof target === 'function';
56
56
  return /*#__PURE__*/_react2["default"].createElement("div", {
57
57
  ref: ref,
58
58
  id: wrappedId
59
59
  }, /*#__PURE__*/_react2["default"].createElement("div", {
60
- ref: isTargetFunction ? undefined : refs.setReference,
60
+ ref: isTargetAsFunction ? undefined : refs.setReference,
61
61
  onClick: handleClick
62
62
  }, typeof target === 'function' ? target(refs.setReference) : target), opened &&
63
63
  /*#__PURE__*/
@@ -42,8 +42,7 @@ var Item = exports.Item = function Item(_ref) {
42
42
  renderItem = _useContext.renderItem,
43
43
  valueToItemMap = _useContext.valueToItemMap,
44
44
  treeId = _useContext.treeId;
45
- var itemDisabled = Boolean(disabled);
46
- var isDisabledClassName = itemDisabled ? _Combobox.classes.dropdownItemIsDisabled : undefined;
45
+ var isDisabledClassName = disabled ? _Combobox.classes.dropdownItemIsDisabled : undefined;
47
46
  var focusedClass = currentLevel === focusedPath.length - 1 && index === (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[currentLevel]) ? _Combobox.classes.dropdownItemIsFocused : undefined;
48
47
  var activeClass = value === (path === null || path === void 0 ? void 0 : path[currentLevel + 1]) ? _Combobox.classes.dropdownItemIsActive : undefined;
49
48
  (0, _hooks.useDidMountEffect)(function () {
@@ -56,12 +55,12 @@ var Item = exports.Item = function Item(_ref) {
56
55
  }
57
56
  }, [focusedClass]);
58
57
  var handleChange = function handleChange(e) {
59
- if (itemDisabled) return;
58
+ if (disabled) return;
60
59
  e.stopPropagation();
61
60
  handleCheckboxChange(item);
62
61
  };
63
62
  var handleClick = function handleClick(e) {
64
- if (itemDisabled) {
63
+ if (disabled) {
65
64
  e.stopPropagation();
66
65
  return;
67
66
  }
@@ -96,9 +95,7 @@ var Item = exports.Item = function Item(_ref) {
96
95
  }))), !multiple && checked.get(item.value) === 'done' && /*#__PURE__*/_react["default"].createElement(_Icon.IconDone, {
97
96
  size: (0, _utils.sizeToIconSize)(size, variant),
98
97
  color: "inherit"
99
- })), renderItem ? /*#__PURE__*/_react["default"].createElement(_Item.StyledText, null, renderItem(valueToItemMap.get(value))) : /*#__PURE__*/_react["default"].createElement(_Item.StyledWrapper, {
100
- className: "dima"
101
- }, /*#__PURE__*/_react["default"].createElement(_Item.StyledCell, {
98
+ })), renderItem ? /*#__PURE__*/_react["default"].createElement(_Item.StyledText, null, renderItem(valueToItemMap.get(value))) : /*#__PURE__*/_react["default"].createElement(_Item.StyledWrapper, null, /*#__PURE__*/_react["default"].createElement(_Item.StyledCell, {
102
99
  view: "default",
103
100
  size: "l",
104
101
  contentLeft: contentLeft,
@@ -19,9 +19,10 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
19
19
  // Не мутирует исходные данные.
20
20
  var filterItems = exports.filterItems = function filterItems(items, textValue, currentLabel, customFilter) {
21
21
  if (!textValue || textValue === currentLabel) return items;
22
- var filter = customFilter || function (label, value) {
22
+ var defaultFilter = function defaultFilter(label, value) {
23
23
  return label.toLowerCase().includes(value.toLowerCase());
24
24
  };
25
+ var filter = customFilter || defaultFilter;
25
26
  var dfs = function dfs(items) {
26
27
  var newItems = [];
27
28
  items.forEach(function (item) {
@@ -35,7 +35,7 @@ var usePopupContext = exports.usePopupContext = function usePopupContext() {
35
35
  };
36
36
  var PopupProvider = exports.PopupProvider = function PopupProvider(_ref) {
37
37
  var children = _ref.children;
38
- var prevBodyOverflowY = (0, _react.useRef)(document.body.style.overflowY);
38
+ var prevBodyOverflowY = (0, _react.useRef)(typeof document !== 'undefined' ? document.body.style.overflowY : '');
39
39
  var _useState = (0, _react.useState)([]),
40
40
  _useState2 = _slicedToArray(_useState, 2),
41
41
  items = _useState2[0],
@@ -10,8 +10,6 @@ var config = exports.config = {
10
10
  defaults: {
11
11
  view: 'default',
12
12
  size: 'm',
13
- // readOnly: false,
14
- // disabled: false,
15
13
  labelPlacement: 'outer'
16
14
  },
17
15
  variations: {
@@ -40,12 +40,6 @@ const meta: Meta<StorySelectProps> = {
40
40
  type: 'select',
41
41
  },
42
42
  },
43
- chipView: {
44
- options: chip,
45
- control: {
46
- type: 'select',
47
- },
48
- },
49
43
  variant: {
50
44
  options: variant,
51
45
  control: {
@@ -75,7 +69,6 @@ const meta: Meta<StorySelectProps> = {
75
69
  helperText: 'Helper text',
76
70
  size: 'm',
77
71
  view: 'default',
78
- chipView: 'default',
79
72
  enableContentLeft: false,
80
73
  isTargetAmount: false,
81
74
  variant: 'normal',
@@ -87,7 +80,6 @@ const meta: Meta<StorySelectProps> = {
87
80
  include: [
88
81
  'size',
89
82
  'view',
90
- 'chipView',
91
83
  'enableContentLeft',
92
84
  'label',
93
85
  'labelPlacement',
@@ -316,7 +308,7 @@ const items = [
316
308
  {
317
309
  value: 'africa',
318
310
  label: 'Африка',
319
- isDisabled: true,
311
+ disabled: true,
320
312
  },
321
313
  ];
322
314
 
@@ -9,10 +9,7 @@ var useOutsideClick = exports.useOutsideClick = function useOutsideClick(callbac
9
9
  var ref = (0, _react.useRef)(null);
10
10
  (0, _react.useEffect)(function () {
11
11
  var handleClickOutside = function handleClickOutside(event) {
12
- if (ref.current && !ref.current.contains(event.target)
13
- // secondaryRef.current &&
14
- // !secondaryRef.current.contains(event.target as Node)
15
- ) {
12
+ if (ref.current && !ref.current.contains(event.target)) {
16
13
  if (!(secondaryRef !== null && secondaryRef !== void 0 && secondaryRef.current) || secondaryRef.current && !secondaryRef.current.contains(event.target)) {
17
14
  callback();
18
15
  }
@@ -136,13 +136,16 @@ export var comboboxRoot = function comboboxRoot(Root) {
136
136
  }
137
137
  }
138
138
  }, floatingPopoverRef);
139
- var onChange = function onChange(e) {
139
+ var onChange = function onChange(newValue) {
140
140
  if (outerOnChange) {
141
- outerOnChange(e);
141
+ outerOnChange(newValue);
142
142
  }
143
- setInternalValue(e);
143
+ setInternalValue(newValue);
144
144
  };
145
145
  var handleClickArrow = function handleClickArrow() {
146
+ if (disabled) {
147
+ return;
148
+ }
146
149
  if (isCurrentListOpen) {
147
150
  dispatchPath({
148
151
  type: 'reset'
@@ -169,14 +172,17 @@ export var comboboxRoot = function comboboxRoot(Root) {
169
172
  };
170
173
 
171
174
  // Обработчик чипов
172
- var handleChangeChips = function handleChangeChips(chipsAsLabel) {
173
- onChange(chipsAsLabel.map(function (chipLabel) {
175
+ var handleChipsChange = function handleChipsChange(chipLabels) {
176
+ onChange(chipLabels.map(function (chipLabel) {
174
177
  return labelToItemMap.get(chipLabel).value;
175
178
  }));
176
179
  };
177
180
 
178
181
  // Обработчик открытия/закрытия выпадающего списка
179
182
  var handleToggle = function handleToggle(opened) {
183
+ if (disabled) {
184
+ return;
185
+ }
180
186
  if (opened) {
181
187
  dispatchPath({
182
188
  type: 'opened_first_level'
@@ -363,6 +369,7 @@ export var comboboxRoot = function comboboxRoot(Root) {
363
369
  placeholder: placeholder,
364
370
  contentLeft: contentLeft,
365
371
  contentRight: /*#__PURE__*/React.createElement(IconArrowWrapper, {
372
+ disabled: disabled,
366
373
  onClick: handleClickArrow
367
374
  }, /*#__PURE__*/React.createElement(StyledArrow, {
368
375
  color: "inherit",
@@ -381,7 +388,7 @@ export var comboboxRoot = function comboboxRoot(Root) {
381
388
  }, multiple ? {
382
389
  enumerationType: 'chip',
383
390
  chips: getChips(),
384
- onChangeChips: handleChangeChips
391
+ onChangeChips: handleChipsChange
385
392
  } : {
386
393
  enumerationType: 'plain'
387
394
  }, rest, {
@@ -438,8 +445,6 @@ export var comboboxConfig = {
438
445
  defaults: {
439
446
  view: 'default',
440
447
  size: 'm',
441
- // readOnly: false,
442
- // disabled: false,
443
448
  labelPlacement: 'outer'
444
449
  }
445
450
  };
@@ -23,7 +23,13 @@ export var Ul = /*#__PURE__*/styled.ul.withConfig({
23
23
  }, tokens.padding, classes.emptyStateWrapper);
24
24
  export var IconArrowWrapper = /*#__PURE__*/styled.div.withConfig({
25
25
  componentId: "plasma-new-hope__sc-2kddkg-1"
26
- })(["line-height:0;color:var(", ");cursor:pointer;.", "{transform:rotate(-180deg);}"], constants.disclosureIconColor, classes.arrowInverse);
26
+ })(["line-height:0;color:var(", ");cursor:", ";.", "{transform:rotate(-180deg);}&:hover,&:active{color:", ";}"], constants.disclosureIconColor, function (_ref5) {
27
+ var disabled = _ref5.disabled;
28
+ return disabled ? 'inherit' : 'pointer';
29
+ }, classes.arrowInverse, function (_ref6) {
30
+ var disabled = _ref6.disabled;
31
+ return disabled ? "var(".concat(constants.disclosureIconColor, ")") : "var(".concat(constants.disclosureIconColorHover, ")");
32
+ });
27
33
  export var StyledArrow = /*#__PURE__*/styled(IconDisclosureDownCentered).withConfig({
28
34
  componentId: "plasma-new-hope__sc-2kddkg-2"
29
35
  })([""]);