@salutejs/plasma-new-hope 0.324.1-canary.1986.15225454757.0 → 0.324.1-canary.1986.15255471728.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/cjs/components/Calendar/hooks/useMonths.js +3 -1
  2. package/cjs/components/Calendar/hooks/useMonths.js.map +1 -1
  3. package/cjs/components/Calendar/hooks/useQuarters.js +3 -1
  4. package/cjs/components/Calendar/hooks/useQuarters.js.map +1 -1
  5. package/cjs/components/Calendar/hooks/useYears.js +3 -1
  6. package/cjs/components/Calendar/hooks/useYears.js.map +1 -1
  7. package/cjs/components/Calendar/utils/getDateWithModification.js +28 -24
  8. package/cjs/components/Calendar/utils/getDateWithModification.js.map +1 -1
  9. package/cjs/components/Note/Note.css +35 -6
  10. package/cjs/components/Note/Note.js +17 -3
  11. package/cjs/components/Note/Note.js.map +1 -1
  12. package/cjs/components/Note/Note.styles.js +25 -2
  13. package/cjs/components/Note/Note.styles.js.map +1 -1
  14. package/cjs/components/Note/{Note.styles_178qpj9.css → Note.styles_thpfhk.css} +2 -1
  15. package/cjs/components/Note/Note.tokens.js +9 -1
  16. package/cjs/components/Note/Note.tokens.js.map +1 -1
  17. package/cjs/index.css +8 -7
  18. package/emotion/cjs/components/Calendar/hooks/useMonths.js +3 -1
  19. package/emotion/cjs/components/Calendar/hooks/useQuarters.js +3 -1
  20. package/emotion/cjs/components/Calendar/hooks/useYears.js +3 -1
  21. package/emotion/cjs/components/Calendar/utils/getDateWithModification.js +28 -24
  22. package/emotion/cjs/components/Note/Note.js +17 -3
  23. package/emotion/cjs/components/Note/Note.styles.js +27 -15
  24. package/emotion/cjs/components/Note/Note.tokens.js +9 -1
  25. package/emotion/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +188 -15
  26. package/emotion/cjs/examples/plasma_b2c/components/Note/Note.config.js +9 -9
  27. package/emotion/cjs/examples/plasma_b2c/components/Note/Note.stories.tsx +1 -0
  28. package/emotion/cjs/examples/plasma_b2c/components/Select/Select.stories.tsx +188 -21
  29. package/emotion/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +187 -15
  30. package/emotion/cjs/examples/plasma_web/components/Note/Note.config.js +9 -9
  31. package/emotion/cjs/examples/plasma_web/components/Note/Note.stories.tsx +1 -0
  32. package/emotion/cjs/examples/plasma_web/components/Select/Select.stories.tsx +188 -21
  33. package/emotion/es/components/Calendar/hooks/useMonths.js +3 -1
  34. package/emotion/es/components/Calendar/hooks/useQuarters.js +3 -1
  35. package/emotion/es/components/Calendar/hooks/useYears.js +3 -1
  36. package/emotion/es/components/Calendar/utils/getDateWithModification.js +28 -24
  37. package/emotion/es/components/Note/Note.js +18 -4
  38. package/emotion/es/components/Note/Note.styles.js +26 -14
  39. package/emotion/es/components/Note/Note.tokens.js +9 -1
  40. package/emotion/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +188 -15
  41. package/emotion/es/examples/plasma_b2c/components/Note/Note.config.js +9 -9
  42. package/emotion/es/examples/plasma_b2c/components/Note/Note.stories.tsx +1 -0
  43. package/emotion/es/examples/plasma_b2c/components/Select/Select.stories.tsx +188 -21
  44. package/emotion/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +187 -15
  45. package/emotion/es/examples/plasma_web/components/Note/Note.config.js +9 -9
  46. package/emotion/es/examples/plasma_web/components/Note/Note.stories.tsx +1 -0
  47. package/emotion/es/examples/plasma_web/components/Select/Select.stories.tsx +188 -21
  48. package/es/components/Calendar/hooks/useMonths.js +3 -1
  49. package/es/components/Calendar/hooks/useMonths.js.map +1 -1
  50. package/es/components/Calendar/hooks/useQuarters.js +3 -1
  51. package/es/components/Calendar/hooks/useQuarters.js.map +1 -1
  52. package/es/components/Calendar/hooks/useYears.js +3 -1
  53. package/es/components/Calendar/hooks/useYears.js.map +1 -1
  54. package/es/components/Calendar/utils/getDateWithModification.js +28 -24
  55. package/es/components/Calendar/utils/getDateWithModification.js.map +1 -1
  56. package/es/components/Note/Note.css +35 -6
  57. package/es/components/Note/Note.js +18 -4
  58. package/es/components/Note/Note.js.map +1 -1
  59. package/es/components/Note/Note.styles.js +25 -3
  60. package/es/components/Note/Note.styles.js.map +1 -1
  61. package/es/components/Note/{Note.styles_178qpj9.css → Note.styles_thpfhk.css} +2 -1
  62. package/es/components/Note/Note.tokens.js +9 -1
  63. package/es/components/Note/Note.tokens.js.map +1 -1
  64. package/es/index.css +8 -7
  65. package/package.json +2 -2
  66. package/styled-components/cjs/components/Calendar/hooks/useMonths.js +3 -1
  67. package/styled-components/cjs/components/Calendar/hooks/useQuarters.js +3 -1
  68. package/styled-components/cjs/components/Calendar/hooks/useYears.js +3 -1
  69. package/styled-components/cjs/components/Calendar/utils/getDateWithModification.js +28 -24
  70. package/styled-components/cjs/components/Note/Note.js +17 -3
  71. package/styled-components/cjs/components/Note/Note.styles.js +14 -3
  72. package/styled-components/cjs/components/Note/Note.tokens.js +9 -1
  73. package/styled-components/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +188 -15
  74. package/styled-components/cjs/examples/plasma_b2c/components/Note/Note.config.js +4 -4
  75. package/styled-components/cjs/examples/plasma_b2c/components/Note/Note.stories.tsx +1 -0
  76. package/styled-components/cjs/examples/plasma_b2c/components/Select/Select.stories.tsx +188 -21
  77. package/styled-components/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +187 -15
  78. package/styled-components/cjs/examples/plasma_web/components/Note/Note.config.js +4 -4
  79. package/styled-components/cjs/examples/plasma_web/components/Note/Note.stories.tsx +1 -0
  80. package/styled-components/cjs/examples/plasma_web/components/Select/Select.stories.tsx +188 -21
  81. package/styled-components/es/components/Calendar/hooks/useMonths.js +3 -1
  82. package/styled-components/es/components/Calendar/hooks/useQuarters.js +3 -1
  83. package/styled-components/es/components/Calendar/hooks/useYears.js +3 -1
  84. package/styled-components/es/components/Calendar/utils/getDateWithModification.js +28 -24
  85. package/styled-components/es/components/Note/Note.js +18 -4
  86. package/styled-components/es/components/Note/Note.styles.js +13 -2
  87. package/styled-components/es/components/Note/Note.tokens.js +9 -1
  88. package/styled-components/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +188 -15
  89. package/styled-components/es/examples/plasma_b2c/components/Note/Note.config.js +4 -4
  90. package/styled-components/es/examples/plasma_b2c/components/Note/Note.stories.tsx +1 -0
  91. package/styled-components/es/examples/plasma_b2c/components/Select/Select.stories.tsx +188 -21
  92. package/styled-components/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +187 -15
  93. package/styled-components/es/examples/plasma_web/components/Note/Note.config.js +4 -4
  94. package/styled-components/es/examples/plasma_web/components/Note/Note.stories.tsx +1 -0
  95. package/styled-components/es/examples/plasma_web/components/Select/Select.stories.tsx +188 -21
  96. package/types/components/Calendar/hooks/types.d.ts +7 -2
  97. package/types/components/Calendar/hooks/types.d.ts.map +1 -1
  98. package/types/components/Calendar/hooks/useMonths.d.ts +1 -1
  99. package/types/components/Calendar/hooks/useMonths.d.ts.map +1 -1
  100. package/types/components/Calendar/hooks/useQuarters.d.ts +1 -1
  101. package/types/components/Calendar/hooks/useQuarters.d.ts.map +1 -1
  102. package/types/components/Calendar/hooks/useYears.d.ts +1 -1
  103. package/types/components/Calendar/hooks/useYears.d.ts.map +1 -1
  104. package/types/components/Calendar/utils/getDateWithModification.d.ts.map +1 -1
  105. package/types/components/Note/Note.d.ts +4 -0
  106. package/types/components/Note/Note.d.ts.map +1 -1
  107. package/types/components/Note/Note.styles.d.ts +46 -1
  108. package/types/components/Note/Note.styles.d.ts.map +1 -1
  109. package/types/components/Note/Note.tokens.d.ts +8 -0
  110. package/types/components/Note/Note.tokens.d.ts.map +1 -1
  111. package/types/components/Note/Note.types.d.ts +8 -0
  112. package/types/components/Note/Note.types.d.ts.map +1 -1
@@ -42,7 +42,7 @@ var normalizeDate = function normalizeDate(date, type) {
42
42
  date.setMonth(0);
43
43
  }
44
44
  };
45
- var isDisabledNextDate = function isDisabledNextDate(_ref, type, max) {
45
+ var isDisabledNextDate = function isDisabledNextDate(_ref, type, max, includeEdgeDates) {
46
46
  var year = _ref.year,
47
47
  monthIndex = _ref.monthIndex,
48
48
  day = _ref.day;
@@ -54,13 +54,13 @@ var isDisabledNextDate = function isDisabledNextDate(_ref, type, max) {
54
54
  var currentDate = new Date(year, monthIndex, day);
55
55
  dateOperationHandler[type].add(currentDate);
56
56
  var isOut = true;
57
- while (isOut && currentDate <= maxDate) {
58
- isOut = maxDate <= currentDate;
57
+ while (isOut && includeEdgeDates ? currentDate < maxDate : currentDate <= maxDate) {
58
+ isOut = includeEdgeDates ? maxDate < currentDate : maxDate <= currentDate;
59
59
  dateOperationHandler[type].add(currentDate);
60
60
  }
61
61
  return isOut;
62
62
  };
63
- var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min) {
63
+ var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min, includeEdgeDates) {
64
64
  var year = _ref2.year,
65
65
  monthIndex = _ref2.monthIndex,
66
66
  day = _ref2.day;
@@ -72,54 +72,58 @@ var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min) {
72
72
  var currentDate = new Date(year, monthIndex, day);
73
73
  dateOperationHandler[type].subtract(currentDate);
74
74
  var isOut = true;
75
- while (isOut && currentDate >= minDate) {
76
- isOut = minDate >= currentDate;
75
+ while (isOut && includeEdgeDates ? currentDate > minDate : currentDate >= minDate) {
76
+ isOut = includeEdgeDates ? minDate > currentDate : minDate >= currentDate;
77
77
  dateOperationHandler[type].subtract(currentDate);
78
78
  }
79
79
  return isOut;
80
80
  };
81
- var getDisabledDates = function getDisabledDates(list, type, min, max) {
81
+ var getDisabledDates = function getDisabledDates(list, type, min, max, includeEdgeDates) {
82
82
  var disabledDate = [];
83
- if (isDisabledPreviousDate(list[0], type, min)) {
83
+ if (isDisabledPreviousDate(list[0], type, min, includeEdgeDates)) {
84
84
  disabledDate.push('previous');
85
85
  }
86
- if (isDisabledNextDate(list[list.length - 1], type, max)) {
86
+ if (isDisabledNextDate(list[list.length - 1], type, max, includeEdgeDates)) {
87
87
  disabledDate.push('next');
88
88
  }
89
89
  return disabledDate.join(',');
90
90
  };
91
- var isDisabledArrowLeft = function isDisabledArrowLeft(date, min) {
91
+ var isDisabledArrowLeft = function isDisabledArrowLeft(date, min, includeEdgeDates) {
92
92
  var currentDate = new Date(date);
93
93
  currentDate.setDate(currentDate.getDate() - 1);
94
- return min && min >= currentDate || min && min >= date;
94
+ var disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);
95
+ return disableCondition;
95
96
  };
96
- var isDisabledArrowRight = function isDisabledArrowRight(date, max) {
97
+ var isDisabledArrowRight = function isDisabledArrowRight(date, max, includeEdgeDates) {
97
98
  var currentDate = new Date(date);
98
99
  currentDate.setDate(currentDate.getDate() + 1);
99
- return max && max <= currentDate || max && max <= date;
100
+ var disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);
101
+ return disableCondition;
100
102
  };
101
- var isDisabledArrowUp = function isDisabledArrowUp(date, min) {
103
+ var isDisabledArrowUp = function isDisabledArrowUp(date, min, includeEdgeDates) {
102
104
  var currentDate = new Date(date);
103
105
  currentDate.setDate(date.getDate() - 7);
104
- return min && min >= currentDate;
106
+ var disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);
107
+ return disableCondition;
105
108
  };
106
- var isDisabledArrowDown = function isDisabledArrowDown(date, max) {
109
+ var isDisabledArrowDown = function isDisabledArrowDown(date, max, includeEdgeDates) {
107
110
  var currentDate = new Date(date);
108
111
  currentDate.setDate(date.getDate() + 7);
109
- return max && max <= currentDate;
112
+ var disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);
113
+ return disableCondition;
110
114
  };
111
- var getDisabledArrowKey = function getDisabledArrowKey(currentDate, min, max) {
115
+ var getDisabledArrowKey = function getDisabledArrowKey(currentDate, min, max, includeEdgeDates) {
112
116
  var disabledArrowKey = [];
113
- if (isDisabledArrowLeft(currentDate, min)) {
117
+ if (isDisabledArrowLeft(currentDate, min, includeEdgeDates)) {
114
118
  disabledArrowKey.push('left');
115
119
  }
116
- if (isDisabledArrowRight(currentDate, max)) {
120
+ if (isDisabledArrowRight(currentDate, max, includeEdgeDates)) {
117
121
  disabledArrowKey.push('right');
118
122
  }
119
- if (isDisabledArrowDown(currentDate, max)) {
123
+ if (isDisabledArrowDown(currentDate, max, includeEdgeDates)) {
120
124
  disabledArrowKey.push('down');
121
125
  }
122
- if (isDisabledArrowUp(currentDate, min)) {
126
+ if (isDisabledArrowUp(currentDate, min, includeEdgeDates)) {
123
127
  disabledArrowKey.push('up');
124
128
  }
125
129
  return disabledArrowKey.join(',');
@@ -148,7 +152,7 @@ export var getDatesWithModifications = function getDatesWithModifications(_ref3)
148
152
  var date = _ref5.date;
149
153
  return date;
150
154
  });
151
- var disabledDates = getDisabledDates(datesList, type, min, max);
155
+ var disabledDates = getDisabledDates(datesList, type, min, max, includeEdgeDates);
152
156
  return dates.map(function (dateItem) {
153
157
  var date = dateItem.date;
154
158
  var year = date.year,
@@ -173,7 +177,7 @@ export var getDatesWithModifications = function getDatesWithModifications(_ref3)
173
177
  dateItem.events = eventsMap.get(keyDate);
174
178
  dateItem.disabled = disabledDatesMap.has(keyDate) || isOutOfMinMaxRange;
175
179
  dateItem.isOutOfMinMaxRange = isOutOfMinMaxRange;
176
- dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max);
180
+ dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max, includeEdgeDates);
177
181
  dateItem.disabledDates = disabledDates;
178
182
  return dateItem;
179
183
  });
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["className", "style", "title", "text", "contentBefore", "contentBeforeSizing", "size", "view", "stretch", "width", "height"];
2
+ var _excluded = ["className", "style", "title", "text", "contentBefore", "contentBeforeSizing", "size", "view", "stretch", "width", "height", "hasClose", "onCloseButtonClick"];
3
3
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -17,9 +17,10 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
17
17
  import React, { forwardRef, useEffect, useLayoutEffect, useRef, useState } from 'react';
18
18
  import { useResizeObserver } from '@salutejs/plasma-core';
19
19
  import { canUseDOM, cx, getSizeValueFromProp } from "../../utils";
20
+ import { IconCrossThin } from "../_Icon/Icons/IconCrossThin";
20
21
  import { base as viewCSS } from "./variations/_view/base";
21
22
  import { base as sizeCSS } from "./variations/_size/base";
22
- import { base, ContentBefore, ContentWrapper, Text, TextHelper, Title, TitleHelper } from "./Note.styles";
23
+ import { base, CloseIconWrapper, ContentBefore, ContentWrapper, Text, TextHelper, Title, TitleHelper } from "./Note.styles";
23
24
  import { classes, privateTokens, tokens } from "./Note.tokens";
24
25
  export var noteRoot = function noteRoot(Root) {
25
26
  return /*#__PURE__*/forwardRef(function (_ref, outerRef) {
@@ -35,6 +36,8 @@ export var noteRoot = function noteRoot(Root) {
35
36
  stretch = _ref.stretch,
36
37
  width = _ref.width,
37
38
  height = _ref.height,
39
+ hasClose = _ref.hasClose,
40
+ onCloseButtonClick = _ref.onCloseButtonClick,
38
41
  rest = _objectWithoutProperties(_ref, _excluded);
39
42
  var _useState = useState(text),
40
43
  _useState2 = _slicedToArray(_useState, 2),
@@ -100,11 +103,22 @@ export var noteRoot = function noteRoot(Root) {
100
103
  ref: contentBeforeRef
101
104
  }, contentBefore), /*#__PURE__*/React.createElement(ContentWrapper, {
102
105
  ref: contentWrapperRef
103
- }, title && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Title, null, title), /*#__PURE__*/React.createElement(TitleHelper, {
106
+ }, title && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Title, {
107
+ hasClose: hasClose
108
+ }, title), /*#__PURE__*/React.createElement(TitleHelper, {
104
109
  ref: titleHelperRef
105
110
  }, "C")), innerText && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, innerText, /*#__PURE__*/React.createElement(TextHelper, {
106
111
  ref: textRenderHelperRef
107
- }, "C")))));
112
+ }, "C")))), hasClose && /*#__PURE__*/React.createElement(CloseIconWrapper, {
113
+ view: "clear",
114
+ size: "s",
115
+ onClick: onCloseButtonClick,
116
+ className: classes.closeIcon
117
+ }, /*#__PURE__*/React.createElement(IconCrossThin, {
118
+ size: "s",
119
+ sizeCustomProperty: tokens.closeIconSize,
120
+ color: "inherit"
121
+ })));
108
122
  });
109
123
  };
110
124
  export var noteConfig = {
@@ -1,5 +1,10 @@
1
1
  import styled from 'styled-components';
2
2
  import { css } from 'styled-components';
3
+ import { component, mergeConfig } from "../../engines";
4
+ import { buttonConfig } from "../Button";
5
+ import { tokens } from "./Note.tokens";
6
+ var mergedButtonConfig = /*#__PURE__*/mergeConfig(buttonConfig);
7
+ var Button = /*#__PURE__*/component(mergedButtonConfig);
3
8
  export var base = /*#__PURE__*/css(["position:relative;display:flex;box-sizing:border-box;"]);
4
9
  export var ContentBefore = /*#__PURE__*/styled.div.withConfig({
5
10
  componentId: "plasma-new-hope__sc-2xk8rv-0"
@@ -9,7 +14,10 @@ export var ContentWrapper = /*#__PURE__*/styled.div.withConfig({
9
14
  })(["display:flex;flex-direction:column;box-sizing:border-box;"]);
10
15
  export var Title = /*#__PURE__*/styled.div.withConfig({
11
16
  componentId: "plasma-new-hope__sc-2xk8rv-2"
12
- })([""]);
17
+ })(["padding-right:", ";box-sizing:border-box;"], function (_ref) {
18
+ var hasClose = _ref.hasClose;
19
+ return hasClose ? "var(".concat(tokens.titlePaddingRight, ")") : 0;
20
+ });
13
21
  export var TitleHelper = /*#__PURE__*/styled.div.withConfig({
14
22
  componentId: "plasma-new-hope__sc-2xk8rv-3"
15
23
  })(["visibility:hidden;position:absolute;z-index:-9999;opacity:0;"]);
@@ -18,4 +26,7 @@ export var Text = /*#__PURE__*/styled.span.withConfig({
18
26
  })(["display:block;position:relative;"]);
19
27
  export var TextHelper = /*#__PURE__*/styled.span.withConfig({
20
28
  componentId: "plasma-new-hope__sc-2xk8rv-5"
21
- })(["visibility:hidden;position:absolute;z-index:-9999;opacity:0;top:0;left:0;"]);
29
+ })(["visibility:hidden;position:absolute;z-index:-9999;opacity:0;top:0;left:0;"]);
30
+ export var CloseIconWrapper = /*#__PURE__*/styled(Button).withConfig({
31
+ componentId: "plasma-new-hope__sc-2xk8rv-6"
32
+ })(["position:absolute;right:var(", ");top:var(", ");width:var(", ");height:var(", ");color:var(", ");:hover{color:var(", ");}"], tokens.closeIconRight, tokens.closeIconTop, tokens.closeIconButtonSize, tokens.closeIconButtonSize, tokens.closeIconColor, tokens.closeIconColorOnHover);
@@ -1,5 +1,6 @@
1
1
  export var classes = {
2
2
  stretch: 'note-stretch',
3
+ closeIcon: 'note-close-icon',
3
4
  contentAlignCenter: 'note-content-align-center'
4
5
  };
5
6
  export var privateTokens = {
@@ -26,10 +27,17 @@ export var tokens = {
26
27
  titleFontWeight: '--plasma-note-title-font-weight',
27
28
  titleLetterSpacing: '--plasma-note-title-letter-spacing',
28
29
  titleLineHeight: '--plasma-note-title-line-height',
30
+ titlePaddingRight: '--plasma-note-title-padding-right',
29
31
  textFontFamily: '--plasma-note-text-font-family',
30
32
  textFontSize: '--plasma-note-text-font-size',
31
33
  textFontStyle: '--plasma-note-text-font-style',
32
34
  textFontWeight: '--plasma-note-text-font-weight',
33
35
  textLetterSpacing: '--plasma-note-text-letter-spacing',
34
- textLineHeight: '--plasma-note-text-line-height'
36
+ textLineHeight: '--plasma-note-text-line-height',
37
+ closeIconTop: '--plasma-note-close-icon-top',
38
+ closeIconRight: '--plasma-note-close-icon-right',
39
+ closeIconColor: '--plasma-note-close-icon-color',
40
+ closeIconColorOnHover: '--plasma-note-close-icon-color-on-hover',
41
+ closeIconSize: '--plasma-note-close-icon-size',
42
+ closeIconButtonSize: '--plasma-note-close-icon-button-size'
35
43
  };
@@ -11,7 +11,7 @@ import { Combobox } from './Combobox';
11
11
  type StorySelectProps = ComponentProps<typeof Combobox> & {
12
12
  enableContentLeft?: boolean;
13
13
  hasHint?: boolean;
14
- enableSelectAll?: boolean;
14
+ selectAllLabel?: string;
15
15
  selectAllSticky?: boolean;
16
16
  };
17
17
 
@@ -175,13 +175,6 @@ const meta: Meta<StorySelectProps> = {
175
175
  emptyStateDescription: {
176
176
  control: { type: 'text' },
177
177
  },
178
- enableSelectAll: {
179
- control: 'boolean',
180
- },
181
- selectAllSticky: {
182
- control: 'boolean',
183
- if: { arg: 'enableSelectAll', truthy: true },
184
- },
185
178
  },
186
179
  args: {
187
180
  label: 'Label',
@@ -211,8 +204,6 @@ const meta: Meta<StorySelectProps> = {
211
204
  hintWidth: '10rem',
212
205
  hintHasArrow: true,
213
206
  emptyStateDescription: '',
214
- enableSelectAll: false,
215
- selectAllSticky: false,
216
207
  },
217
208
  parameters: {
218
209
  controls: {
@@ -248,8 +239,6 @@ const meta: Meta<StorySelectProps> = {
248
239
  'hintWidth',
249
240
  'hintHasArrow',
250
241
  'emptyStateDescription',
251
- 'enableSelectAll',
252
- 'selectAllSticky',
253
242
  ],
254
243
  },
255
244
  },
@@ -472,6 +461,7 @@ const items = [
472
461
 
473
462
  const SingleStory = (args: StorySelectProps) => {
474
463
  const [value, setValue] = useState('');
464
+
475
465
  return (
476
466
  <div style={{ width: '400px' }}>
477
467
  <Combobox
@@ -492,12 +482,12 @@ export const Single: StoryObj<StorySelectProps> = {
492
482
  },
493
483
  parameters: {
494
484
  controls: {
495
- exclude: ['isTargetAmount', 'enableSelectAll'],
485
+ exclude: ['isTargetAmount'],
496
486
  },
497
487
  },
498
488
  };
499
489
 
500
- const MultipleStory = ({ enableSelectAll, selectAllSticky, ...args }: StorySelectProps) => {
490
+ const MultipleStory = (args: StorySelectProps) => {
501
491
  const [value, setValue] = useState([]);
502
492
 
503
493
  return (
@@ -509,7 +499,6 @@ const MultipleStory = ({ enableSelectAll, selectAllSticky, ...args }: StorySelec
509
499
  value={value}
510
500
  onChange={setValue}
511
501
  contentLeft={args.enableContentLeft ? <IconDone size="s" /> : undefined}
512
- selectAllOptions={enableSelectAll ? { sticky: selectAllSticky || false } : undefined}
513
502
  />
514
503
  </div>
515
504
  );
@@ -521,3 +510,187 @@ export const Multiple: StoryObj<StorySelectProps> = {
521
510
  closeAfterSelect: false,
522
511
  },
523
512
  };
513
+
514
+ const flatItems = [
515
+ {
516
+ value: 'north_america',
517
+ label: 'Северная Америка',
518
+ },
519
+ {
520
+ value: 'rio_de_janeiro',
521
+ label: 'Рио-де-Жанейро',
522
+ },
523
+ {
524
+ value: 'sao_paulo',
525
+ label: 'Сан-Паулу',
526
+ },
527
+ {
528
+ value: 'buenos_aires',
529
+ label: 'Буэнос-Айрес',
530
+ },
531
+ {
532
+ value: 'cordoba',
533
+ label: 'Кордова',
534
+ },
535
+ {
536
+ value: 'bogota',
537
+ label: 'Богота',
538
+ },
539
+ {
540
+ value: 'medellin',
541
+ label: 'Медельин',
542
+ },
543
+ {
544
+ value: 'paris',
545
+ label: 'Париж',
546
+ },
547
+ {
548
+ value: 'lyon',
549
+ label: 'Лион',
550
+ },
551
+ {
552
+ value: 'berlin',
553
+ label: 'Берлин',
554
+ },
555
+ {
556
+ value: 'munich',
557
+ label: 'Мюнхен',
558
+ },
559
+ {
560
+ value: 'rome',
561
+ label: 'Рим',
562
+ },
563
+ {
564
+ value: 'milan',
565
+ label: 'Милан',
566
+ },
567
+ {
568
+ value: 'madrid',
569
+ label: 'Мадрид',
570
+ },
571
+ {
572
+ value: 'barcelona',
573
+ label: 'Барселона',
574
+ },
575
+ {
576
+ value: 'london',
577
+ label: 'Лондон',
578
+ },
579
+ {
580
+ value: 'manchester',
581
+ label: 'Манчестер',
582
+ },
583
+ {
584
+ value: 'beijing',
585
+ label: 'Пекин',
586
+ },
587
+ {
588
+ value: 'shanghai',
589
+ label: 'Шанхай',
590
+ },
591
+ {
592
+ value: 'tokyo',
593
+ label: 'Токио',
594
+ },
595
+ {
596
+ value: 'osaka',
597
+ label: 'Осака',
598
+ },
599
+ {
600
+ value: 'delhi',
601
+ label: 'Дели',
602
+ },
603
+ {
604
+ value: 'mumbai',
605
+ label: 'Мумбаи',
606
+ },
607
+ {
608
+ value: 'seoul',
609
+ label: 'Сеул',
610
+ },
611
+ {
612
+ value: 'busan',
613
+ label: 'Пусан',
614
+ },
615
+ {
616
+ value: 'bangkok',
617
+ label: 'Бангкок',
618
+ },
619
+ {
620
+ value: 'phuket',
621
+ label: 'Пхукет',
622
+ },
623
+ {
624
+ value: 'africa',
625
+ label: 'Африка',
626
+ },
627
+ ];
628
+
629
+ const SelectAllStory = (args: StorySelectProps) => {
630
+ const [value, setValue] = useState([]);
631
+ const [checked, setChecked] = useState(false);
632
+ const [indeterminate, setIndeterminate] = useState(false);
633
+
634
+ const handleClick = () => {
635
+ if (checked && !indeterminate) {
636
+ setValue([]);
637
+ } else {
638
+ setValue(flatItems.map((item) => item.value));
639
+ }
640
+ };
641
+
642
+ React.useEffect(() => {
643
+ if (value.length === 0) {
644
+ setChecked(false);
645
+ setIndeterminate(false);
646
+ } else if (value.length === flatItems.length) {
647
+ setChecked(true);
648
+ setIndeterminate(false);
649
+ } else {
650
+ setChecked(true);
651
+ setIndeterminate(true);
652
+ }
653
+ }, [value]);
654
+
655
+ return (
656
+ <div style={{ width: '400px' }}>
657
+ <Combobox
658
+ placeholder="Placeholder"
659
+ multiple
660
+ items={flatItems}
661
+ value={value}
662
+ onChange={setValue}
663
+ listOverflow="auto"
664
+ listMaxHeight="300px"
665
+ selectAllOptions={{
666
+ sticky: args?.selectAllSticky || false,
667
+ label: args?.selectAllLabel,
668
+ checked,
669
+ indeterminate,
670
+ onClick: handleClick,
671
+ }}
672
+ />
673
+ </div>
674
+ );
675
+ };
676
+
677
+ export const SelectAll: StoryObj<StorySelectProps> = {
678
+ render: (args) => <SelectAllStory {...args} />,
679
+ argTypes: {
680
+ selectAllSticky: {
681
+ control: 'boolean',
682
+ },
683
+ selectAllLabel: {
684
+ control: 'text',
685
+ },
686
+ },
687
+ args: {
688
+ selectAllSticky: false,
689
+ selectAllLabel: 'Выбрать все',
690
+ },
691
+ parameters: {
692
+ controls: {
693
+ include: ['selectAllSticky', 'selectAllLabel'],
694
+ },
695
+ },
696
+ };
@@ -14,10 +14,10 @@ export var config = {
14
14
  info: /*#__PURE__*/css(["", ":var(--surface-transparent-info);", ":var(--text-primary);", ":var(--text-info);"], tokens.background, tokens.color, tokens.contentBeforeColor)
15
15
  },
16
16
  size: {
17
- l: /*#__PURE__*/css(["", ":1.5rem 1.875rem;", ":1.5rem 1.75rem;", ":0.875rem;", ":0.75rem;", ":1rem;", ":0.25rem;", ":1.5rem;", ":2rem;", ":0.25rem 0;", ":var(--plasma-typo-text-l-font-family);", ":var(--plasma-typo-text-l-font-size);", ":var(--plasma-typo-text-l-font-style);", ":var(--plasma-typo-text-l-bold-font-weight);", ":var(--plasma-typo-text-l-letter-spacing);", ":var(--plasma-typo-text-l-line-height);", ":var(--plasma-typo-text-l-font-family);", ":var(--plasma-typo-text-l-font-size);", ":var(--plasma-typo-text-l-font-style);", ":var(--plasma-typo-text-l-font-weight);", ":var(--plasma-typo-text-l-letter-spacing);", ":var(--plasma-typo-text-l-line-height);"], tokens.padding, tokens.paddingScalable, tokens.borderRadius, tokens.gap, tokens.gapScalable, tokens.contentGap, tokens.fixedContentBeforeWidth, tokens.fixedContentBeforeHeight, tokens.fixedContentBeforePadding, tokens.titleFontFamily, tokens.titleFontSize, tokens.titleFontStyle, tokens.titleFontWeight, tokens.titleLetterSpacing, tokens.titleLineHeight, tokens.textFontFamily, tokens.textFontSize, tokens.textFontStyle, tokens.textFontWeight, tokens.textLetterSpacing, tokens.textLineHeight),
18
- m: /*#__PURE__*/css(["", ":1.25rem 1.5rem;", ":1.25rem;", ":0.75rem;", ":0.625rem;", ":0.75rem;", ":0.125rem;", ":1.5rem;", ":1.5rem;", ":0;", ":var(--plasma-typo-text-m-font-family);", ":var(--plasma-typo-text-m-font-size);", ":var(--plasma-typo-text-m-font-style);", ":var(--plasma-typo-text-m-bold-font-weight);", ":var(--plasma-typo-text-m-letter-spacing);", ":var(--plasma-typo-text-m-line-height);", ":var(--plasma-typo-text-m-font-family);", ":var(--plasma-typo-text-m-font-size);", ":var(--plasma-typo-text-m-font-style);", ":var(--plasma-typo-text-m-font-weight);", ":var(--plasma-typo-text-m-letter-spacing);", ":var(--plasma-typo-text-m-line-height);"], tokens.padding, tokens.paddingScalable, tokens.borderRadius, tokens.gap, tokens.gapScalable, tokens.contentGap, tokens.fixedContentBeforeWidth, tokens.fixedContentBeforeHeight, tokens.fixedContentBeforePadding, tokens.titleFontFamily, tokens.titleFontSize, tokens.titleFontStyle, tokens.titleFontWeight, tokens.titleLetterSpacing, tokens.titleLineHeight, tokens.textFontFamily, tokens.textFontSize, tokens.textFontStyle, tokens.textFontWeight, tokens.textLetterSpacing, tokens.textLineHeight),
19
- s: /*#__PURE__*/css(["", ":1rem 1.25rem;", ":1rem;", ":0.625rem;", ":0.5rem;", ":0.75rem;", ":0.125rem;", ":1rem;", ":1.125rem;", ":0.063rem 0;", ":var(--plasma-typo-text-s-font-family);", ":var(--plasma-typo-text-s-font-size);", ":var(--plasma-typo-text-s-font-style);", ":var(--plasma-typo-text-s-bold-font-weight);", ":var(--plasma-typo-text-s-letter-spacing);", ":var(--plasma-typo-text-s-line-height);", ":var(--plasma-typo-text-s-font-family);", ":var(--plasma-typo-text-s-font-size);", ":var(--plasma-typo-text-s-font-style);", ":var(--plasma-typo-text-s-font-weight);", ":var(--plasma-typo-text-s-letter-spacing);", ":var(--plasma-typo-text-s-line-height);"], tokens.padding, tokens.paddingScalable, tokens.borderRadius, tokens.gap, tokens.gapScalable, tokens.contentGap, tokens.fixedContentBeforeWidth, tokens.fixedContentBeforeHeight, tokens.fixedContentBeforePadding, tokens.titleFontFamily, tokens.titleFontSize, tokens.titleFontStyle, tokens.titleFontWeight, tokens.titleLetterSpacing, tokens.titleLineHeight, tokens.textFontFamily, tokens.textFontSize, tokens.textFontStyle, tokens.textFontWeight, tokens.textLetterSpacing, tokens.textLineHeight),
20
- xs: /*#__PURE__*/css(["", ":0.75rem 1rem;", ":0.75rem;", ":0.5rem;", ":0.375rem;", ":0.5rem;", ":0.125rem;", ":1rem;", ":1rem;", ":0;", ":var(--plasma-typo-text-xs-font-family);", ":var(--plasma-typo-text-xs-font-size);", ":var(--plasma-typo-text-xs-font-style);", ":var(--plasma-typo-text-xs-bold-font-weight);", ":var(--plasma-typo-text-xs-letter-spacing);", ":var(--plasma-typo-text-xs-line-height);", ":var(--plasma-typo-text-xs-font-family);", ":var(--plasma-typo-text-xs-font-size);", ":var(--plasma-typo-text-xs-font-style);", ":var(--plasma-typo-text-xs-font-weight);", ":var(--plasma-typo-text-xs-letter-spacing);", ":var(--plasma-typo-text-xs-line-height);"], tokens.padding, tokens.paddingScalable, tokens.borderRadius, tokens.gap, tokens.gapScalable, tokens.contentGap, tokens.fixedContentBeforeWidth, tokens.fixedContentBeforeHeight, tokens.fixedContentBeforePadding, tokens.titleFontFamily, tokens.titleFontSize, tokens.titleFontStyle, tokens.titleFontWeight, tokens.titleLetterSpacing, tokens.titleLineHeight, tokens.textFontFamily, tokens.textFontSize, tokens.textFontStyle, tokens.textFontWeight, tokens.textLetterSpacing, tokens.textLineHeight)
17
+ l: /*#__PURE__*/css(["", ":1.5rem 1.875rem;", ":1.5rem 1.75rem;", ":0.875rem;", ":0.75rem;", ":1rem;", ":0.25rem;", ":1rem;", ":1rem;", ":var(--text-secondary);", ":var(--text-secondary-hover);", ":1.5rem;", ":1.5rem;", ":1.5rem;", ":2rem;", ":0.25rem 0;", ":var(--plasma-typo-text-l-font-family);", ":var(--plasma-typo-text-l-font-size);", ":var(--plasma-typo-text-l-font-style);", ":var(--plasma-typo-text-l-bold-font-weight);", ":var(--plasma-typo-text-l-letter-spacing);", ":var(--plasma-typo-text-l-line-height);", ":1.875rem;", ":var(--plasma-typo-text-l-font-family);", ":var(--plasma-typo-text-l-font-size);", ":var(--plasma-typo-text-l-font-style);", ":var(--plasma-typo-text-l-font-weight);", ":var(--plasma-typo-text-l-letter-spacing);", ":var(--plasma-typo-text-l-line-height);"], tokens.padding, tokens.paddingScalable, tokens.borderRadius, tokens.gap, tokens.gapScalable, tokens.contentGap, tokens.closeIconTop, tokens.closeIconRight, tokens.closeIconColor, tokens.closeIconColorOnHover, tokens.closeIconSize, tokens.closeIconButtonSize, tokens.fixedContentBeforeWidth, tokens.fixedContentBeforeHeight, tokens.fixedContentBeforePadding, tokens.titleFontFamily, tokens.titleFontSize, tokens.titleFontStyle, tokens.titleFontWeight, tokens.titleLetterSpacing, tokens.titleLineHeight, tokens.titlePaddingRight, tokens.textFontFamily, tokens.textFontSize, tokens.textFontStyle, tokens.textFontWeight, tokens.textLetterSpacing, tokens.textLineHeight),
18
+ m: /*#__PURE__*/css(["", ":1.25rem 1.5rem;", ":1.25rem;", ":0.75rem;", ":0.625rem;", ":0.75rem;", ":0.125rem;", ":0.75rem;", ":0.75rem;", ":var(--text-secondary);", ":var(--text-secondary-hover);", ":1.5rem;", ":1.5rem;", ":1.5rem;", ":1.5rem;", ":0;", ":var(--plasma-typo-text-m-font-family);", ":var(--plasma-typo-text-m-font-size);", ":var(--plasma-typo-text-m-font-style);", ":var(--plasma-typo-text-m-bold-font-weight);", ":var(--plasma-typo-text-m-letter-spacing);", ":var(--plasma-typo-text-m-line-height);", ":1.75rem;", ":var(--plasma-typo-text-m-font-family);", ":var(--plasma-typo-text-m-font-size);", ":var(--plasma-typo-text-m-font-style);", ":var(--plasma-typo-text-m-font-weight);", ":var(--plasma-typo-text-m-letter-spacing);", ":var(--plasma-typo-text-m-line-height);"], tokens.padding, tokens.paddingScalable, tokens.borderRadius, tokens.gap, tokens.gapScalable, tokens.contentGap, tokens.closeIconTop, tokens.closeIconRight, tokens.closeIconColor, tokens.closeIconColorOnHover, tokens.closeIconSize, tokens.closeIconButtonSize, tokens.fixedContentBeforeWidth, tokens.fixedContentBeforeHeight, tokens.fixedContentBeforePadding, tokens.titleFontFamily, tokens.titleFontSize, tokens.titleFontStyle, tokens.titleFontWeight, tokens.titleLetterSpacing, tokens.titleLineHeight, tokens.titlePaddingRight, tokens.textFontFamily, tokens.textFontSize, tokens.textFontStyle, tokens.textFontWeight, tokens.textLetterSpacing, tokens.textLineHeight),
19
+ s: /*#__PURE__*/css(["", ":1rem 1.25rem;", ":1rem;", ":0.625rem;", ":0.5rem;", ":0.75rem;", ":0.125rem;", ":0.625rem;", ":0.625rem;", ":var(--text-secondary);", ":var(--text-secondary-hover);", ":1.5rem;", ":1.5rem;", ":1rem;", ":1.125rem;", ":0.063rem 0;", ":var(--plasma-typo-text-s-font-family);", ":var(--plasma-typo-text-s-font-size);", ":var(--plasma-typo-text-s-font-style);", ":var(--plasma-typo-text-s-bold-font-weight);", ":var(--plasma-typo-text-s-letter-spacing);", ":var(--plasma-typo-text-s-line-height);", ":1.625rem;", ":var(--plasma-typo-text-s-font-family);", ":var(--plasma-typo-text-s-font-size);", ":var(--plasma-typo-text-s-font-style);", ":var(--plasma-typo-text-s-font-weight);", ":var(--plasma-typo-text-s-letter-spacing);", ":var(--plasma-typo-text-s-line-height);"], tokens.padding, tokens.paddingScalable, tokens.borderRadius, tokens.gap, tokens.gapScalable, tokens.contentGap, tokens.closeIconTop, tokens.closeIconRight, tokens.closeIconColor, tokens.closeIconColorOnHover, tokens.closeIconSize, tokens.closeIconButtonSize, tokens.fixedContentBeforeWidth, tokens.fixedContentBeforeHeight, tokens.fixedContentBeforePadding, tokens.titleFontFamily, tokens.titleFontSize, tokens.titleFontStyle, tokens.titleFontWeight, tokens.titleLetterSpacing, tokens.titleLineHeight, tokens.titlePaddingRight, tokens.textFontFamily, tokens.textFontSize, tokens.textFontStyle, tokens.textFontWeight, tokens.textLetterSpacing, tokens.textLineHeight),
20
+ xs: /*#__PURE__*/css(["", ":0.75rem 1rem;", ":0.75rem;", ":0.5rem;", ":0.375rem;", ":0.5rem;", ":0.125rem;", ":0.625rem;", ":0.625rem;", ":var(--text-secondary);", ":var(--text-secondary-hover);", ":1rem;", ":1rem;", ":1rem;", ":1rem;", ":0;", ":var(--plasma-typo-text-xs-font-family);", ":var(--plasma-typo-text-xs-font-size);", ":var(--plasma-typo-text-xs-font-style);", ":var(--plasma-typo-text-xs-bold-font-weight);", ":var(--plasma-typo-text-xs-letter-spacing);", ":var(--plasma-typo-text-xs-line-height);", ":1.5rem;", ":var(--plasma-typo-text-xs-font-family);", ":var(--plasma-typo-text-xs-font-size);", ":var(--plasma-typo-text-xs-font-style);", ":var(--plasma-typo-text-xs-font-weight);", ":var(--plasma-typo-text-xs-letter-spacing);", ":var(--plasma-typo-text-xs-line-height);"], tokens.padding, tokens.paddingScalable, tokens.borderRadius, tokens.gap, tokens.gapScalable, tokens.contentGap, tokens.closeIconTop, tokens.closeIconRight, tokens.closeIconColor, tokens.closeIconColorOnHover, tokens.closeIconSize, tokens.closeIconButtonSize, tokens.fixedContentBeforeWidth, tokens.fixedContentBeforeHeight, tokens.fixedContentBeforePadding, tokens.titleFontFamily, tokens.titleFontSize, tokens.titleFontStyle, tokens.titleFontWeight, tokens.titleLetterSpacing, tokens.titleLineHeight, tokens.titlePaddingRight, tokens.textFontFamily, tokens.textFontSize, tokens.textFontStyle, tokens.textFontWeight, tokens.textLetterSpacing, tokens.textLineHeight)
21
21
  }
22
22
  }
23
23
  };
@@ -67,6 +67,7 @@ export const Default: StoryObj<StoryPropsDefault> = {
67
67
  text: 'Text',
68
68
  enableContentBefore: true,
69
69
  contentBeforeSizing: 'fixed',
70
+ hasClose: true,
70
71
  },
71
72
  render: ({ enableContentBefore, ...args }) => (
72
73
  <div style={{ height: '100vh' }}>