@salutejs/plasma-new-hope 0.174.0-canary.1505.11518120718.0 → 0.174.0-dev.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -27
- package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -9
- package/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js.map +1 -1
- package/cjs/components/Drawer/Drawer.js +2 -1
- package/cjs/components/Drawer/Drawer.js.map +1 -1
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
- package/cjs/components/Select/Select.js +25 -13
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/cjs/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
- package/cjs/components/Select/utils/getButtonLabel.js +1 -1
- package/cjs/components/Select/utils/getButtonLabel.js.map +1 -1
- package/cjs/components/Select/utils/initialItemsTransform.js +6 -9
- package/cjs/components/Select/utils/initialItemsTransform.js.map +1 -1
- package/cjs/components/ViewContainer/ViewContainer.js +38 -0
- package/cjs/components/ViewContainer/ViewContainer.js.map +1 -0
- package/cjs/components/ViewContainer/ViewContainer_yiqfcb.css +1 -0
- package/cjs/components/ViewContainer/_view/base.js +9 -0
- package/cjs/components/ViewContainer/_view/base.js.map +1 -0
- package/cjs/components/ViewContainer/_view/base_x642ct.css +1 -0
- package/cjs/index.css +2 -0
- package/cjs/index.js +3 -0
- package/cjs/index.js.map +1 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -26
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/index.js +1 -8
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
- package/emotion/cjs/components/Drawer/Drawer.js +4 -3
- package/emotion/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/emotion/cjs/components/Select/Select.js +25 -12
- package/emotion/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
- package/emotion/cjs/components/Select/utils/getButtonLabel.js +1 -1
- package/emotion/cjs/components/Select/utils/index.js +1 -8
- package/emotion/cjs/components/Select/utils/initialItemsTransform.js +6 -19
- package/emotion/cjs/components/ViewContainer/ViewContainer.js +49 -0
- package/emotion/cjs/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
- package/emotion/cjs/components/ViewContainer/_view/base.js +8 -0
- package/emotion/cjs/components/ViewContainer/_view/tokens.json +1 -0
- package/emotion/cjs/components/ViewContainer/index.js +18 -0
- package/emotion/cjs/examples/_helpers.js +3 -14
- package/emotion/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
- package/emotion/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +16 -0
- package/emotion/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +11 -0
- package/emotion/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/emotion/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
- package/emotion/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +16 -0
- package/emotion/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.js +11 -0
- package/emotion/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/emotion/cjs/index.js +11 -0
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +23 -27
- package/emotion/es/components/Combobox/ComboboxNew/utils/index.js +1 -2
- package/emotion/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
- package/emotion/es/components/Drawer/Drawer.js +2 -1
- package/emotion/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/emotion/es/components/Select/Select.js +26 -13
- package/emotion/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
- package/emotion/es/components/Select/utils/getButtonLabel.js +1 -1
- package/emotion/es/components/Select/utils/index.js +1 -2
- package/emotion/es/components/Select/utils/initialItemsTransform.js +6 -19
- package/emotion/es/components/ViewContainer/ViewContainer.js +40 -0
- package/emotion/es/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
- package/emotion/es/components/ViewContainer/_view/base.js +2 -0
- package/emotion/es/components/ViewContainer/_view/tokens.json +1 -0
- package/emotion/es/components/ViewContainer/index.js +1 -0
- package/emotion/es/examples/_helpers.js +3 -14
- package/emotion/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
- package/emotion/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +10 -0
- package/emotion/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +5 -0
- package/emotion/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/emotion/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
- package/emotion/es/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +10 -0
- package/emotion/es/examples/plasma_web/components/ViewContainer/ViewContainer.js +5 -0
- package/emotion/es/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/emotion/es/index.js +2 -1
- package/es/components/Combobox/ComboboxNew/Combobox.js +22 -27
- package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -9
- package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js.map +1 -1
- package/es/components/Drawer/Drawer.js +2 -1
- package/es/components/Drawer/Drawer.js.map +1 -1
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
- package/es/components/Select/Select.js +26 -14
- package/es/components/Select/Select.js.map +1 -1
- package/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/es/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
- package/es/components/Select/utils/getButtonLabel.js +1 -1
- package/es/components/Select/utils/getButtonLabel.js.map +1 -1
- package/es/components/Select/utils/initialItemsTransform.js +6 -9
- package/es/components/Select/utils/initialItemsTransform.js.map +1 -1
- package/es/components/ViewContainer/ViewContainer.js +33 -0
- package/es/components/ViewContainer/ViewContainer.js.map +1 -0
- package/es/components/ViewContainer/ViewContainer_yiqfcb.css +1 -0
- package/es/components/ViewContainer/_view/base.js +5 -0
- package/es/components/ViewContainer/_view/base.js.map +1 -0
- package/es/components/ViewContainer/_view/base_x642ct.css +1 -0
- package/es/index.css +2 -0
- package/es/index.js +1 -0
- package/es/index.js.map +1 -1
- package/package.json +3 -2
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -26
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/index.js +1 -8
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
- package/styled-components/cjs/components/Drawer/Drawer.js +4 -3
- package/styled-components/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/styled-components/cjs/components/Select/Select.js +25 -12
- package/styled-components/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/styled-components/cjs/components/Select/utils/getButtonLabel.js +1 -1
- package/styled-components/cjs/components/Select/utils/index.js +1 -8
- package/styled-components/cjs/components/Select/utils/initialItemsTransform.js +6 -19
- package/styled-components/cjs/components/ViewContainer/ViewContainer.js +40 -0
- package/styled-components/cjs/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
- package/styled-components/cjs/components/ViewContainer/_view/base.js +8 -0
- package/styled-components/cjs/components/ViewContainer/_view/tokens.json +1 -0
- package/styled-components/cjs/components/ViewContainer/index.js +18 -0
- package/styled-components/cjs/examples/_helpers.js +3 -14
- package/styled-components/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
- package/styled-components/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +16 -0
- package/styled-components/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +11 -0
- package/styled-components/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/styled-components/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
- package/styled-components/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +16 -0
- package/styled-components/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.js +11 -0
- package/styled-components/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +23 -27
- package/styled-components/es/components/Combobox/ComboboxNew/utils/index.js +1 -2
- package/styled-components/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
- package/styled-components/es/components/Drawer/Drawer.js +2 -1
- package/styled-components/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/styled-components/es/components/Select/Select.js +26 -13
- package/styled-components/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/styled-components/es/components/Select/utils/getButtonLabel.js +1 -1
- package/styled-components/es/components/Select/utils/index.js +1 -2
- package/styled-components/es/components/Select/utils/initialItemsTransform.js +6 -19
- package/styled-components/es/components/ViewContainer/ViewContainer.js +31 -0
- package/styled-components/es/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
- package/styled-components/es/components/ViewContainer/_view/base.js +2 -0
- package/styled-components/es/components/ViewContainer/_view/tokens.json +1 -0
- package/styled-components/es/components/ViewContainer/index.js +1 -0
- package/styled-components/es/examples/_helpers.js +3 -14
- package/styled-components/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
- package/styled-components/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +10 -0
- package/styled-components/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +5 -0
- package/styled-components/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/styled-components/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
- package/styled-components/es/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +10 -0
- package/styled-components/es/examples/plasma_web/components/ViewContainer/ViewContainer.js +5 -0
- package/styled-components/es/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/styled-components/es/index.js +2 -1
- package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts +3 -14
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/utils/index.d.ts +0 -1
- package/types/components/Combobox/ComboboxNew/utils/index.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/utils/initialItemsTransform.d.ts.map +1 -1
- package/types/components/Drawer/Drawer.d.ts.map +1 -1
- package/types/components/Select/Select.d.ts.map +1 -1
- package/types/components/Select/Select.types.d.ts +0 -1
- package/types/components/Select/Select.types.d.ts.map +1 -1
- package/types/components/Select/hooks/useKeyboardNavigation.d.ts +2 -2
- package/types/components/Select/hooks/useKeyboardNavigation.d.ts.map +1 -1
- package/types/components/Select/ui/Target/Target.types.d.ts +2 -2
- package/types/components/Select/ui/Target/Target.types.d.ts.map +1 -1
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts +4 -4
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts.map +1 -1
- package/types/components/Select/utils/index.d.ts +0 -1
- package/types/components/Select/utils/index.d.ts.map +1 -1
- package/types/components/Select/utils/initialItemsTransform.d.ts.map +1 -1
- package/types/components/ViewContainer/ViewContainer.d.ts +26 -0
- package/types/components/ViewContainer/ViewContainer.d.ts.map +1 -0
- package/types/components/ViewContainer/_view/base.d.ts +2 -0
- package/types/components/ViewContainer/_view/base.d.ts.map +1 -0
- package/types/components/ViewContainer/index.d.ts +2 -0
- package/types/components/ViewContainer/index.d.ts.map +1 -0
- package/types/examples/_helpers.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts +6 -30
- package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.d.ts +9 -0
- package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.d.ts +8 -0
- package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Combobox/Combobox.d.ts +6 -30
- package/types/examples/plasma_web/components/Combobox/Combobox.d.ts.map +1 -1
- package/types/examples/plasma_web/components/ViewContainer/ViewContainer.config.d.ts +9 -0
- package/types/examples/plasma_web/components/ViewContainer/ViewContainer.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/ViewContainer/ViewContainer.d.ts +8 -0
- package/types/examples/plasma_web/components/ViewContainer/ViewContainer.d.ts.map +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -21
- package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +0 -1
- package/cjs/components/Select/utils/getInitialValue.js +0 -21
- package/cjs/components/Select/utils/getInitialValue.js.map +0 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -20
- package/emotion/cjs/components/Select/utils/getInitialValue.js +0 -20
- package/emotion/cjs/examples/themes/declaration.d.ts +0 -4
- package/emotion/cjs/examples/themes/index.js +0 -15
- package/emotion/cjs/examples/themes/plasma_b2c.module.css +0 -984
- package/emotion/cjs/examples/themes/plasma_web.module.css +0 -984
- package/emotion/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -14
- package/emotion/es/components/Select/utils/getInitialValue.js +0 -14
- package/emotion/es/examples/themes/declaration.d.ts +0 -4
- package/emotion/es/examples/themes/index.js +0 -7
- package/emotion/es/examples/themes/plasma_b2c.module.css +0 -984
- package/emotion/es/examples/themes/plasma_web.module.css +0 -984
- package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -17
- package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +0 -1
- package/es/components/Select/utils/getInitialValue.js +0 -17
- package/es/components/Select/utils/getInitialValue.js.map +0 -1
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -20
- package/styled-components/cjs/components/Select/utils/getInitialValue.js +0 -20
- package/styled-components/cjs/examples/themes/declaration.d.ts +0 -4
- package/styled-components/cjs/examples/themes/index.js +0 -15
- package/styled-components/cjs/examples/themes/plasma_b2c.module.css +0 -984
- package/styled-components/cjs/examples/themes/plasma_web.module.css +0 -984
- package/styled-components/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -14
- package/styled-components/es/components/Select/utils/getInitialValue.js +0 -14
- package/styled-components/es/examples/themes/declaration.d.ts +0 -4
- package/styled-components/es/examples/themes/index.js +0 -7
- package/styled-components/es/examples/themes/plasma_b2c.module.css +0 -984
- package/styled-components/es/examples/themes/plasma_web.module.css +0 -984
- package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts +0 -4
- package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts.map +0 -1
- package/types/components/Select/utils/getInitialValue.d.ts +0 -4
- package/types/components/Select/utils/getInitialValue.d.ts.map +0 -1
- package/types/examples/themes/index.d.ts +0 -6
- package/types/examples/themes/index.d.ts.map +0 -1
@@ -16,7 +16,7 @@ export var getButtonLabel = function getButtonLabel(_ref3) {
|
|
16
16
|
if (isEmpty(value) && typeof value !== 'number') {
|
17
17
|
return label || '';
|
18
18
|
}
|
19
|
-
if (selectProps.multiselect &&
|
19
|
+
if (selectProps.multiselect && selectProps.isTargetAmount) {
|
20
20
|
return "\u0412\u044B\u0431\u0440\u0430\u043D\u043E: ".concat(value.length);
|
21
21
|
}
|
22
22
|
if (selectProps.multiselect && Array.isArray(value)) {
|
@@ -5,5 +5,4 @@ export { updateSingleAncestors } from './updateSingleAncestors';
|
|
5
5
|
export { sizeToIconSize } from './sizeToIconSize';
|
6
6
|
export { getCorrectHeight } from './getCorrectHeight';
|
7
7
|
export { getButtonLabel } from './getButtonLabel';
|
8
|
-
export { getView } from './getView';
|
9
|
-
export { getInitialValue } from './getInitialValue';
|
8
|
+
export { getView } from './getView';
|
@@ -1,25 +1,12 @@
|
|
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
|
-
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; }
|
3
|
-
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; }
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
6
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
7
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
8
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
9
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
10
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
11
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
12
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
13
1
|
// Проходимся по массиву items и добавляем в каждый item ключ parent, который ссылается на item родителя.
|
14
2
|
// Дает возможность прохода к корневому элементу (снизу вверх).
|
15
|
-
|
3
|
+
|
16
4
|
export var initialItemsTransform = function initialItemsTransform(items, parent) {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
itemCopy.items = initialItemsTransform(itemCopy.items, itemCopy);
|
5
|
+
items.forEach(function (item) {
|
6
|
+
item.parent = parent;
|
7
|
+
if (item.items) {
|
8
|
+
item.items = initialItemsTransform(item.items, item);
|
22
9
|
}
|
23
|
-
return itemCopy;
|
24
10
|
});
|
11
|
+
return items;
|
25
12
|
};
|
@@ -0,0 +1,40 @@
|
|
1
|
+
var _excluded = ["children"];
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
5
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
6
|
+
import React, { forwardRef } from 'react';
|
7
|
+
import { css } from '@emotion/react';
|
8
|
+
import { base as viewCSS } from './_view/base';
|
9
|
+
var base = process.env.NODE_ENV === "production" ? {
|
10
|
+
name: "y6axm9-plasma-new-hope__base",
|
11
|
+
styles: "position:relative;label:plasma-new-hope__base;"
|
12
|
+
} : {
|
13
|
+
name: "y6axm9-plasma-new-hope__base",
|
14
|
+
styles: "position:relative;label:plasma-new-hope__base;",
|
15
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvVmlld0NvbnRhaW5lci9WaWV3Q29udGFpbmVyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPZ0IiLCJmaWxlIjoiLi4vLi4vLi4vLi4vc3JjLWVtb3Rpb24vY29tcG9uZW50cy9WaWV3Q29udGFpbmVyL1ZpZXdDb250YWluZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0LCB7IGZvcndhcmRSZWYgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmltcG9ydCB0eXBlIHsgUm9vdFByb3BzIH0gZnJvbSAnLi4vLi4vZW5naW5lcy90eXBlcyc7XG5cbmltcG9ydCB7IGJhc2UgYXMgdmlld0NTUyB9IGZyb20gJy4vX3ZpZXcvYmFzZSc7XG5cbmNvbnN0IGJhc2UgPSBjc3NgXG4gICAgcG9zaXRpb246IHJlbGF0aXZlO1xuYDtcblxuZXhwb3J0IHR5cGUgVmlld0NvbnRhaW5lckN1c3RvbVByb3BzID0ge1xuICAgIC8qKlxuICAgICAqINCS0LjQtCDQutC+0LzQv9C+0L3QtdC90YLQsFxuICAgICAqL1xuICAgIHZpZXc/OiBzdHJpbmc7XG59O1xuXG50eXBlIFZpZXdDb250YWluZXJQcm9wcyA9IFJlYWN0LkhUTUxBdHRyaWJ1dGVzPEhUTUxEaXZFbGVtZW50PiAmIFZpZXdDb250YWluZXJDdXN0b21Qcm9wcztcblxuZXhwb3J0IGNvbnN0IHZpZXdDb250YWluZXJSb290ID0gKFJvb3Q6IFJvb3RQcm9wczxIVE1MQW5jaG9yRWxlbWVudCwgVmlld0NvbnRhaW5lclByb3BzPikgPT5cbiAgICBmb3J3YXJkUmVmPEhUTUxBbmNob3JFbGVtZW50LCBWaWV3Q29udGFpbmVyUHJvcHM+KChwcm9wcywgcmVmKSA9PiB7XG4gICAgICAgIGNvbnN0IHsgY2hpbGRyZW4sIC4uLnJlc3QgfSA9IHByb3BzO1xuXG4gICAgICAgIHJldHVybiAoXG4gICAgICAgICAgICA8Um9vdCByZWY9e3JlZn0gey4uLnJlc3R9PlxuICAgICAgICAgICAgICAgIHtjaGlsZHJlbn1cbiAgICAgICAgICAgIDwvUm9vdD5cbiAgICAgICAgKTtcbiAgICB9KTtcblxuZXhwb3J0IGNvbnN0IHZpZXdDb250YWluZXJDb25maWcgPSB7XG4gICAgbmFtZTogJ1ZpZXdDb250YWluZXInLFxuICAgIHRhZzogJ2RpdicsXG4gICAgbGF5b3V0OiB2aWV3Q29udGFpbmVyUm9vdCxcbiAgICBiYXNlLFxuICAgIHZhcmlhdGlvbnM6IHtcbiAgICAgICAgdmlldzoge1xuICAgICAgICAgICAgY3NzOiB2aWV3Q1NTLFxuICAgICAgICB9LFxuICAgIH0sXG4gICAgZGVmYXVsdHM6IHtcbiAgICAgICAgdmlldzogdW5kZWZpbmVkLFxuICAgIH0sXG59O1xuIl19 */",
|
16
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
17
|
+
};
|
18
|
+
export var viewContainerRoot = function viewContainerRoot(Root) {
|
19
|
+
return /*#__PURE__*/forwardRef(function (props, ref) {
|
20
|
+
var children = props.children,
|
21
|
+
rest = _objectWithoutProperties(props, _excluded);
|
22
|
+
return /*#__PURE__*/React.createElement(Root, _extends({
|
23
|
+
ref: ref
|
24
|
+
}, rest), children);
|
25
|
+
});
|
26
|
+
};
|
27
|
+
export var viewContainerConfig = {
|
28
|
+
name: 'ViewContainer',
|
29
|
+
tag: 'div',
|
30
|
+
layout: viewContainerRoot,
|
31
|
+
base: base,
|
32
|
+
variations: {
|
33
|
+
view: {
|
34
|
+
css: viewCSS
|
35
|
+
}
|
36
|
+
},
|
37
|
+
defaults: {
|
38
|
+
view: undefined
|
39
|
+
}
|
40
|
+
};
|
@@ -0,0 +1,82 @@
|
|
1
|
+
---
|
2
|
+
id: viewContainer
|
3
|
+
title: ViewContainer
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable, Description } from '@site/src/components';
|
7
|
+
|
8
|
+
# ViewContainer
|
9
|
+
<Description name="ViewContainer" />
|
10
|
+
<PropsTable name="ViewContainer" exclude={['css']} />
|
11
|
+
|
12
|
+
# Описание
|
13
|
+
|
14
|
+
Данный компонент представляет собой обёртку, которая инвертирует токены компонент, которые в неё помещены, в зависимости от выбранного значения свойства view - `onDark` или `onLight`.
|
15
|
+
|
16
|
+
При этом, независимо от режима темы (тёмный или светлый) для всего приложения, токены внутри не будут меняться.
|
17
|
+
|
18
|
+
Этот механизм необходим для случаев, когда требуется отобразить компонент на специфичном бэкграунде, чтобы избежать наложение цветов.
|
19
|
+
|
20
|
+
# Пример использования
|
21
|
+
|
22
|
+
```tsx live
|
23
|
+
import React from 'react';
|
24
|
+
import { ViewContainer, Button, Checkbox, TextField } from '@salutejs/{{ package }}';
|
25
|
+
|
26
|
+
export function App() {
|
27
|
+
return (
|
28
|
+
<div>
|
29
|
+
<ViewContainer
|
30
|
+
style=\{{
|
31
|
+
padding: '1rem',
|
32
|
+
borderRadius: '1rem',
|
33
|
+
display: 'flex',
|
34
|
+
flexDirection: 'column',
|
35
|
+
gap: '1rem',
|
36
|
+
}}
|
37
|
+
>
|
38
|
+
<h3 style=\{{ margin: 0 }}>Inside default ViewContainer</h3>
|
39
|
+
<Button text="default Button" />
|
40
|
+
<Checkbox checked label="Label" />
|
41
|
+
<TextField value="Example Value" label="Label" labelPlacement="inner" />
|
42
|
+
</ViewContainer>
|
43
|
+
<br />
|
44
|
+
<ViewContainer
|
45
|
+
view="onDark"
|
46
|
+
style=\{{
|
47
|
+
background: '#1a1a1a',
|
48
|
+
color: 'white',
|
49
|
+
padding: '1rem',
|
50
|
+
borderRadius: '1rem',
|
51
|
+
display: 'flex',
|
52
|
+
flexDirection: 'column',
|
53
|
+
gap: '1rem',
|
54
|
+
}}
|
55
|
+
>
|
56
|
+
<h3 style=\{{ margin: 0 }}>Inside onDark ViewContainer</h3>
|
57
|
+
<Button text="default Button" />
|
58
|
+
<Checkbox checked label="Label" />
|
59
|
+
<TextField value="Example Value" label="Label" labelPlacement="inner" />
|
60
|
+
</ViewContainer>
|
61
|
+
<br />
|
62
|
+
<ViewContainer
|
63
|
+
view="onLight"
|
64
|
+
style=\{{
|
65
|
+
background: '#ededed',
|
66
|
+
color: 'black',
|
67
|
+
padding: '1rem',
|
68
|
+
borderRadius: '1rem',
|
69
|
+
display: 'flex',
|
70
|
+
flexDirection: 'column',
|
71
|
+
gap: '1rem',
|
72
|
+
}}
|
73
|
+
>
|
74
|
+
<h3 style=\{{ margin: 0 }}>Inside onLight ViewContainer</h3>
|
75
|
+
<Button text="default Button" />
|
76
|
+
<Checkbox checked label="Label" />
|
77
|
+
<TextField value="Example Value" label="Label" labelPlacement="inner" />
|
78
|
+
</ViewContainer>
|
79
|
+
</div>
|
80
|
+
);
|
81
|
+
}
|
82
|
+
```
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import { css } from '@emotion/react';
|
2
|
+
export var base = /*#__PURE__*/css(";label:plasma-new-hope__base;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvVmlld0NvbnRhaW5lci9fdmlldy9iYXNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUV1QiIsImZpbGUiOiIuLi8uLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL1ZpZXdDb250YWluZXIvX3ZpZXcvYmFzZS50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuZXhwb3J0IGNvbnN0IGJhc2UgPSBjc3NgYDtcbiJdfQ== */"));
|
@@ -0,0 +1 @@
|
|
1
|
+
[]
|
@@ -0,0 +1 @@
|
|
1
|
+
export { viewContainerRoot, viewContainerConfig } from './ViewContainer';
|
@@ -6,20 +6,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
6
6
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
8
8
|
import React from 'react';
|
9
|
-
|
10
|
-
export var WithTheme = function WithTheme(Story
|
11
|
-
|
12
|
-
var themeType = context.globals.theme;
|
13
|
-
var themeName = context.title.split('/')[0];
|
14
|
-
return /*#__PURE__*/React.createElement("div", {
|
15
|
-
id: "theme-root",
|
16
|
-
className: themes === null || themes === void 0 || (_themes$themeName = themes[themeName]) === null || _themes$themeName === void 0 ? void 0 : _themes$themeName[themeType],
|
17
|
-
style: {
|
18
|
-
padding: '1rem',
|
19
|
-
minHeight: '100vh',
|
20
|
-
boxSizing: 'border-box'
|
21
|
-
}
|
22
|
-
}, /*#__PURE__*/React.createElement(Story, null));
|
9
|
+
// TODO: Удалить в отдельном пр из всех компонент
|
10
|
+
export var WithTheme = function WithTheme(Story) {
|
11
|
+
return /*#__PURE__*/React.createElement(Story, null);
|
23
12
|
};
|
24
13
|
export function argTypesFromConfig(config) {
|
25
14
|
var exclude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
@@ -68,10 +68,6 @@ const meta: Meta<StorySelectProps> = {
|
|
68
68
|
control: { type: 'boolean' },
|
69
69
|
if: { arg: 'alwaysOpened', truthy: false },
|
70
70
|
},
|
71
|
-
targetAmount: {
|
72
|
-
control: { type: 'number' },
|
73
|
-
if: { arg: 'isTargetAmount', truthy: true },
|
74
|
-
},
|
75
71
|
},
|
76
72
|
args: {
|
77
73
|
label: 'Label',
|
@@ -82,7 +78,6 @@ const meta: Meta<StorySelectProps> = {
|
|
82
78
|
view: 'default',
|
83
79
|
enableContentLeft: false,
|
84
80
|
isTargetAmount: false,
|
85
|
-
targetAmount: undefined,
|
86
81
|
variant: 'normal',
|
87
82
|
alwaysOpened: false,
|
88
83
|
disabled: false,
|
@@ -99,7 +94,6 @@ const meta: Meta<StorySelectProps> = {
|
|
99
94
|
'placeholder',
|
100
95
|
'helperText',
|
101
96
|
'isTargetAmount',
|
102
|
-
'targetAmount',
|
103
97
|
'closeAfterSelect',
|
104
98
|
'alwaysOpened',
|
105
99
|
'variant',
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { css } from '@emotion/react';
|
2
|
+
import { viewContainer } from '@salutejs/plasma-themes/tokens/plasma_b2c';
|
3
|
+
export var config = {
|
4
|
+
variations: {
|
5
|
+
view: {
|
6
|
+
onDark: /*#__PURE__*/css(viewContainer.dark, ";;label:plasma-new-hope__onDark;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2V4YW1wbGVzL3BsYXNtYV9iMmMvY29tcG9uZW50cy9WaWV3Q29udGFpbmVyL1ZpZXdDb250YWluZXIuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU11QiIsImZpbGUiOiIuLi8uLi8uLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9leGFtcGxlcy9wbGFzbWFfYjJjL2NvbXBvbmVudHMvVmlld0NvbnRhaW5lci9WaWV3Q29udGFpbmVyLmNvbmZpZy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcbmltcG9ydCB7IHZpZXdDb250YWluZXIgfSBmcm9tICdAc2FsdXRlanMvcGxhc21hLXRoZW1lcy90b2tlbnMvcGxhc21hX2IyYyc7XG5cbmV4cG9ydCBjb25zdCBjb25maWcgPSB7XG4gICAgdmFyaWF0aW9uczoge1xuICAgICAgICB2aWV3OiB7XG4gICAgICAgICAgICBvbkRhcms6IGNzc2BcbiAgICAgICAgICAgICAgICAke3ZpZXdDb250YWluZXIuZGFya31cbiAgICAgICAgICAgIGAsXG4gICAgICAgICAgICBvbkxpZ2h0OiBjc3NgXG4gICAgICAgICAgICAgICAgJHt2aWV3Q29udGFpbmVyLmxpZ2h0fVxuICAgICAgICAgICAgYCxcbiAgICAgICAgfSxcbiAgICB9LFxufTtcbiJdfQ== */")),
|
7
|
+
onLight: /*#__PURE__*/css(viewContainer.light, ";;label:plasma-new-hope__onLight;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2V4YW1wbGVzL3BsYXNtYV9iMmMvY29tcG9uZW50cy9WaWV3Q29udGFpbmVyL1ZpZXdDb250YWluZXIuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVN3QiIsImZpbGUiOiIuLi8uLi8uLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9leGFtcGxlcy9wbGFzbWFfYjJjL2NvbXBvbmVudHMvVmlld0NvbnRhaW5lci9WaWV3Q29udGFpbmVyLmNvbmZpZy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcbmltcG9ydCB7IHZpZXdDb250YWluZXIgfSBmcm9tICdAc2FsdXRlanMvcGxhc21hLXRoZW1lcy90b2tlbnMvcGxhc21hX2IyYyc7XG5cbmV4cG9ydCBjb25zdCBjb25maWcgPSB7XG4gICAgdmFyaWF0aW9uczoge1xuICAgICAgICB2aWV3OiB7XG4gICAgICAgICAgICBvbkRhcms6IGNzc2BcbiAgICAgICAgICAgICAgICAke3ZpZXdDb250YWluZXIuZGFya31cbiAgICAgICAgICAgIGAsXG4gICAgICAgICAgICBvbkxpZ2h0OiBjc3NgXG4gICAgICAgICAgICAgICAgJHt2aWV3Q29udGFpbmVyLmxpZ2h0fVxuICAgICAgICAgICAgYCxcbiAgICAgICAgfSxcbiAgICB9LFxufTtcbiJdfQ== */"))
|
8
|
+
}
|
9
|
+
}
|
10
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { viewContainerConfig } from '../../../../components/ViewContainer';
|
2
|
+
import { component, mergeConfig } from '../../../../engines';
|
3
|
+
import { config } from './ViewContainer.config';
|
4
|
+
var mergedConfig = /*#__PURE__*/mergeConfig(viewContainerConfig, config);
|
5
|
+
export var ViewContainer = /*#__PURE__*/component(mergedConfig);
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
2
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
3
|
+
|
4
|
+
import { Button } from '../Button/Button';
|
5
|
+
import { TextField } from '../TextField/TextField';
|
6
|
+
import { Checkbox } from '../Checkbox/Checkbox';
|
7
|
+
|
8
|
+
import { ViewContainer } from './ViewContainer';
|
9
|
+
|
10
|
+
type StoryViewProps = ComponentProps<typeof ViewContainer>;
|
11
|
+
|
12
|
+
const meta: Meta<StoryViewProps> = {
|
13
|
+
title: 'plasma_b2c/ViewContainer',
|
14
|
+
};
|
15
|
+
|
16
|
+
export default meta;
|
17
|
+
|
18
|
+
type Story = StoryObj<StoryViewProps>;
|
19
|
+
|
20
|
+
const ViewExample = ({ view }: StoryViewProps) => {
|
21
|
+
const style = view
|
22
|
+
? {
|
23
|
+
background: view === 'onDark' ? '#1a1a1a' : '#ededed',
|
24
|
+
color: view === 'onDark' ? 'white' : 'black',
|
25
|
+
}
|
26
|
+
: undefined;
|
27
|
+
|
28
|
+
return (
|
29
|
+
<>
|
30
|
+
<h4>view: {view ?? 'default'}</h4>
|
31
|
+
<div>
|
32
|
+
<ViewContainer
|
33
|
+
view={view}
|
34
|
+
style={{
|
35
|
+
...style,
|
36
|
+
padding: '1rem',
|
37
|
+
borderRadius: '1rem',
|
38
|
+
display: 'flex',
|
39
|
+
flexDirection: 'column',
|
40
|
+
gap: '1rem',
|
41
|
+
}}
|
42
|
+
>
|
43
|
+
<h3 style={{ margin: 0 }}>Inside ViewContainer</h3>
|
44
|
+
<Button text="default Button" />
|
45
|
+
<Checkbox checked label="Label" />
|
46
|
+
<TextField value="Example Value" label="Label" labelPlacement="inner" />
|
47
|
+
</ViewContainer>
|
48
|
+
</div>
|
49
|
+
</>
|
50
|
+
);
|
51
|
+
};
|
52
|
+
|
53
|
+
export const Default: Story = {
|
54
|
+
render: () => {
|
55
|
+
return (
|
56
|
+
<>
|
57
|
+
<ViewExample />
|
58
|
+
<br />
|
59
|
+
<ViewExample view="onDark" />
|
60
|
+
<br />
|
61
|
+
<ViewExample view="onLight" />
|
62
|
+
</>
|
63
|
+
);
|
64
|
+
},
|
65
|
+
};
|
@@ -68,10 +68,6 @@ const meta: Meta<StorySelectProps> = {
|
|
68
68
|
control: { type: 'boolean' },
|
69
69
|
if: { arg: 'alwaysOpened', truthy: false },
|
70
70
|
},
|
71
|
-
targetAmount: {
|
72
|
-
control: { type: 'number' },
|
73
|
-
if: { arg: 'isTargetAmount', truthy: true },
|
74
|
-
},
|
75
71
|
},
|
76
72
|
args: {
|
77
73
|
label: 'Label',
|
@@ -82,7 +78,6 @@ const meta: Meta<StorySelectProps> = {
|
|
82
78
|
view: 'default',
|
83
79
|
enableContentLeft: false,
|
84
80
|
isTargetAmount: false,
|
85
|
-
targetAmount: undefined,
|
86
81
|
variant: 'normal',
|
87
82
|
alwaysOpened: false,
|
88
83
|
disabled: false,
|
@@ -99,7 +94,6 @@ const meta: Meta<StorySelectProps> = {
|
|
99
94
|
'placeholder',
|
100
95
|
'helperText',
|
101
96
|
'isTargetAmount',
|
102
|
-
'targetAmount',
|
103
97
|
'closeAfterSelect',
|
104
98
|
'alwaysOpened',
|
105
99
|
'variant',
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { css } from '@emotion/react';
|
2
|
+
import { viewContainer } from '@salutejs/plasma-themes/tokens/plasma_b2c';
|
3
|
+
export var config = {
|
4
|
+
variations: {
|
5
|
+
view: {
|
6
|
+
onDark: /*#__PURE__*/css(viewContainer.dark, ";;label:plasma-new-hope__onDark;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2V4YW1wbGVzL3BsYXNtYV93ZWIvY29tcG9uZW50cy9WaWV3Q29udGFpbmVyL1ZpZXdDb250YWluZXIuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU11QiIsImZpbGUiOiIuLi8uLi8uLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9leGFtcGxlcy9wbGFzbWFfd2ViL2NvbXBvbmVudHMvVmlld0NvbnRhaW5lci9WaWV3Q29udGFpbmVyLmNvbmZpZy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcbmltcG9ydCB7IHZpZXdDb250YWluZXIgfSBmcm9tICdAc2FsdXRlanMvcGxhc21hLXRoZW1lcy90b2tlbnMvcGxhc21hX2IyYyc7XG5cbmV4cG9ydCBjb25zdCBjb25maWcgPSB7XG4gICAgdmFyaWF0aW9uczoge1xuICAgICAgICB2aWV3OiB7XG4gICAgICAgICAgICBvbkRhcms6IGNzc2BcbiAgICAgICAgICAgICAgICAke3ZpZXdDb250YWluZXIuZGFya31cbiAgICAgICAgICAgIGAsXG4gICAgICAgICAgICBvbkxpZ2h0OiBjc3NgXG4gICAgICAgICAgICAgICAgJHt2aWV3Q29udGFpbmVyLmxpZ2h0fVxuICAgICAgICAgICAgYCxcbiAgICAgICAgfSxcbiAgICB9LFxufTtcbiJdfQ== */")),
|
7
|
+
onLight: /*#__PURE__*/css(viewContainer.light, ";;label:plasma-new-hope__onLight;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2V4YW1wbGVzL3BsYXNtYV93ZWIvY29tcG9uZW50cy9WaWV3Q29udGFpbmVyL1ZpZXdDb250YWluZXIuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVN3QiIsImZpbGUiOiIuLi8uLi8uLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9leGFtcGxlcy9wbGFzbWFfd2ViL2NvbXBvbmVudHMvVmlld0NvbnRhaW5lci9WaWV3Q29udGFpbmVyLmNvbmZpZy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcbmltcG9ydCB7IHZpZXdDb250YWluZXIgfSBmcm9tICdAc2FsdXRlanMvcGxhc21hLXRoZW1lcy90b2tlbnMvcGxhc21hX2IyYyc7XG5cbmV4cG9ydCBjb25zdCBjb25maWcgPSB7XG4gICAgdmFyaWF0aW9uczoge1xuICAgICAgICB2aWV3OiB7XG4gICAgICAgICAgICBvbkRhcms6IGNzc2BcbiAgICAgICAgICAgICAgICAke3ZpZXdDb250YWluZXIuZGFya31cbiAgICAgICAgICAgIGAsXG4gICAgICAgICAgICBvbkxpZ2h0OiBjc3NgXG4gICAgICAgICAgICAgICAgJHt2aWV3Q29udGFpbmVyLmxpZ2h0fVxuICAgICAgICAgICAgYCxcbiAgICAgICAgfSxcbiAgICB9LFxufTtcbiJdfQ== */"))
|
8
|
+
}
|
9
|
+
}
|
10
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { viewContainerConfig } from '../../../../components/ViewContainer';
|
2
|
+
import { component, mergeConfig } from '../../../../engines';
|
3
|
+
import { config } from './ViewContainer.config';
|
4
|
+
var mergedConfig = /*#__PURE__*/mergeConfig(viewContainerConfig, config);
|
5
|
+
export var ViewContainer = /*#__PURE__*/component(mergedConfig);
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
2
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
3
|
+
|
4
|
+
import { Button } from '../Button/Button';
|
5
|
+
import { TextField } from '../TextField/TextField';
|
6
|
+
import { Checkbox } from '../Checkbox/Checkbox';
|
7
|
+
|
8
|
+
import { ViewContainer } from './ViewContainer';
|
9
|
+
|
10
|
+
type StoryViewProps = ComponentProps<typeof ViewContainer>;
|
11
|
+
|
12
|
+
const meta: Meta<StoryViewProps> = {
|
13
|
+
title: 'plasma_web/ViewContainer',
|
14
|
+
};
|
15
|
+
|
16
|
+
export default meta;
|
17
|
+
|
18
|
+
type Story = StoryObj<StoryViewProps>;
|
19
|
+
|
20
|
+
const ViewExample = ({ view }: StoryViewProps) => {
|
21
|
+
const style = view
|
22
|
+
? {
|
23
|
+
background: view === 'onDark' ? '#1a1a1a' : '#ededed',
|
24
|
+
color: view === 'onDark' ? 'white' : 'black',
|
25
|
+
}
|
26
|
+
: undefined;
|
27
|
+
|
28
|
+
return (
|
29
|
+
<>
|
30
|
+
<h4>view: {view ?? 'default'}</h4>
|
31
|
+
<div>
|
32
|
+
<ViewContainer
|
33
|
+
view={view}
|
34
|
+
style={{
|
35
|
+
...style,
|
36
|
+
padding: '1rem',
|
37
|
+
borderRadius: '1rem',
|
38
|
+
display: 'flex',
|
39
|
+
flexDirection: 'column',
|
40
|
+
gap: '1rem',
|
41
|
+
}}
|
42
|
+
>
|
43
|
+
<h3 style={{ margin: 0 }}>Inside ViewContainer</h3>
|
44
|
+
<Button text="default Button" />
|
45
|
+
<Checkbox checked label="Label" />
|
46
|
+
<TextField value="Example Value" label="Label" labelPlacement="inner" />
|
47
|
+
</ViewContainer>
|
48
|
+
</div>
|
49
|
+
</>
|
50
|
+
);
|
51
|
+
};
|
52
|
+
|
53
|
+
export const Default: Story = {
|
54
|
+
render: () => {
|
55
|
+
return (
|
56
|
+
<>
|
57
|
+
<ViewExample />
|
58
|
+
<br />
|
59
|
+
<ViewExample view="onDark" />
|
60
|
+
<br />
|
61
|
+
<ViewExample view="onLight" />
|
62
|
+
</>
|
63
|
+
);
|
64
|
+
},
|
65
|
+
};
|
package/emotion/es/index.js
CHANGED
@@ -60,4 +60,5 @@ export * from './components/Autocomplete';
|
|
60
60
|
export * from './components/EmptyState';
|
61
61
|
export * from './components/Editable';
|
62
62
|
export * from './components/Mask';
|
63
|
-
export * from './components/Attach';
|
63
|
+
export * from './components/Attach';
|
64
|
+
export * from './components/ViewContainer';
|
@@ -9,7 +9,6 @@ import { IconArrowWrapper, StyledArrow, Ul, StyledEmptyState, base } from './Com
|
|
9
9
|
import { base as base$1 } from './variations/_view/base.js';
|
10
10
|
import { base as base$2 } from './variations/_size/base.js';
|
11
11
|
import { initialItemsTransform } from './utils/initialItemsTransform.js';
|
12
|
-
import { getInitialValue } from './utils/getInitialValue.js';
|
13
12
|
import { filterItems } from './utils/filterItems.js';
|
14
13
|
import { pathReducer } from './reducers/pathReducer.js';
|
15
14
|
import { focusedPathReducer } from './reducers/focusedPathReducer.js';
|
@@ -23,7 +22,7 @@ import { sizeToIconSize } from '../../Select/utils/sizeToIconSize.js';
|
|
23
22
|
import { getItemId } from './utils/getItemId.js';
|
24
23
|
import { Inner } from './ui/Inner/Inner.js';
|
25
24
|
|
26
|
-
var _excluded = ["multiple", "value", "onChange", "isTargetAmount", "
|
25
|
+
var _excluded = ["multiple", "value", "onChange", "isTargetAmount", "items", "placement", "label", "placeholder", "helperText", "contentLeft", "textBefore", "textAfter", "variant", "listOverflow", "listHeight", "listWidth", "portal", "renderItem", "view", "size", "labelPlacement", "readOnly", "disabled", "alwaysOpened", "filter", "closeAfterSelect"];
|
27
26
|
var Context = /*#__PURE__*/createContext({});
|
28
27
|
|
29
28
|
/**
|
@@ -36,7 +35,6 @@ var comboboxRoot = function comboboxRoot(Root) {
|
|
36
35
|
outerValue = props.value,
|
37
36
|
outerOnChange = props.onChange,
|
38
37
|
isTargetAmount = props.isTargetAmount,
|
39
|
-
targetAmount = props.targetAmount,
|
40
38
|
items = props.items,
|
41
39
|
_props$placement = props.placement,
|
42
40
|
placement = _props$placement === void 0 ? 'bottom-start' : _props$placement,
|
@@ -64,15 +62,10 @@ var comboboxRoot = function comboboxRoot(Root) {
|
|
64
62
|
alwaysOpened = _props$alwaysOpened === void 0 ? false : _props$alwaysOpened,
|
65
63
|
filter = props.filter,
|
66
64
|
outerCloseAfterSelect = props.closeAfterSelect,
|
67
|
-
renderValue = props.renderValue,
|
68
65
|
rest = _objectWithoutProperties(props, _excluded);
|
69
|
-
var transformedItems = useMemo(function () {
|
70
|
-
return initialItemsTransform(items || []);
|
71
|
-
}, [items]);
|
72
|
-
|
73
66
|
// Создаем структуры для быстрой работы с деревом
|
74
67
|
var _useMemo = useMemo(function () {
|
75
|
-
return getTreeMaps(
|
68
|
+
return getTreeMaps(items);
|
76
69
|
}, [items]),
|
77
70
|
_useMemo2 = _slicedToArray(_useMemo, 3),
|
78
71
|
valueToCheckedMap = _useMemo2[0],
|
@@ -86,11 +79,14 @@ var comboboxRoot = function comboboxRoot(Root) {
|
|
86
79
|
_useState4 = _slicedToArray(_useState3, 2),
|
87
80
|
internalValue = _useState4[0],
|
88
81
|
setInternalValue = _useState4[1];
|
89
|
-
var value = outerValue
|
82
|
+
var value = outerValue || internalValue;
|
90
83
|
var inputRef = useRef(null);
|
91
84
|
var floatingPopoverRef = useRef(null);
|
92
85
|
var inputForkRef = useForkRef(inputRef, ref);
|
93
86
|
var treeId = safeUseId();
|
87
|
+
var transformedItems = useMemo(function () {
|
88
|
+
return initialItemsTransform(items || []);
|
89
|
+
}, [items]);
|
94
90
|
var filteredItems = filterItems(transformedItems, textValue, (_valueToItemMap$get2 = valueToItemMap.get(value)) === null || _valueToItemMap$get2 === void 0 ? void 0 : _valueToItemMap$get2.label, filter);
|
95
91
|
var _useMemo3 = useMemo(function () {
|
96
92
|
return getPathMap(filteredItems);
|
@@ -257,7 +253,16 @@ var comboboxRoot = function comboboxRoot(Root) {
|
|
257
253
|
if (e) {
|
258
254
|
e.stopPropagation();
|
259
255
|
}
|
260
|
-
var
|
256
|
+
var checkedCopy = new Map(checked);
|
257
|
+
var isCurrentChecked = checkedCopy.get(item.value);
|
258
|
+
checkedCopy.forEach(function (_, key) {
|
259
|
+
checkedCopy.set(key, false);
|
260
|
+
});
|
261
|
+
if (!isCurrentChecked) {
|
262
|
+
checkedCopy.set(item.value, 'done');
|
263
|
+
updateSingleAncestors(item, checkedCopy, 'dot');
|
264
|
+
}
|
265
|
+
setTextValue(isCurrentChecked ? '' : item.label);
|
261
266
|
if (!alwaysOpened && closeAfterSelect) {
|
262
267
|
dispatchPath({
|
263
268
|
type: 'reset'
|
@@ -271,18 +276,14 @@ var comboboxRoot = function comboboxRoot(Root) {
|
|
271
276
|
}
|
272
277
|
};
|
273
278
|
var getChips = function getChips() {
|
274
|
-
if (multiple
|
279
|
+
if (multiple) {
|
275
280
|
if (value.length === 0) return [];
|
276
281
|
if (isTargetAmount) {
|
277
|
-
return ["\u0412\u044B\u0431\u0440\u0430\u043D\u043E ".concat(
|
282
|
+
return ["\u0412\u044B\u0431\u0440\u0430\u043D\u043E ".concat(value.length)];
|
278
283
|
}
|
279
|
-
|
280
|
-
return
|
281
|
-
};
|
282
|
-
var valueToItemMapper = function valueToItemMapper(stringValue) {
|
283
|
-
return valueToItemMap.get(stringValue).label;
|
284
|
-
};
|
285
|
-
return value.map(renderValueMapper || valueToItemMapper);
|
284
|
+
return value.map(function (value) {
|
285
|
+
return valueToItemMap.get(value).label;
|
286
|
+
});
|
286
287
|
}
|
287
288
|
return [];
|
288
289
|
};
|
@@ -310,7 +311,6 @@ var comboboxRoot = function comboboxRoot(Root) {
|
|
310
311
|
// В данном эффекте мы следим за изменениями value снаружи и вносим коррективы в дерево чекбоксов.
|
311
312
|
// Пример: когда юзер очистил value извне, тогда нужно пройтись по элементам и выключить все чекбоксы.
|
312
313
|
useLayoutEffect(function () {
|
313
|
-
var _valueToItemMap$get4;
|
314
314
|
var checkedCopy = new Map(checked);
|
315
315
|
checkedCopy.forEach(function (_, key) {
|
316
316
|
checkedCopy.set(key, false);
|
@@ -328,12 +328,7 @@ var comboboxRoot = function comboboxRoot(Root) {
|
|
328
328
|
}
|
329
329
|
}
|
330
330
|
setChecked(checkedCopy);
|
331
|
-
|
332
|
-
|
333
|
-
// В deps мы кладем именно outerValue и internalValue, а не просто value.
|
334
|
-
// Т.к. вначале нужно отфильтровать и провалидировать outerValue и результат положить в переменную.
|
335
|
-
// А переменную, содержащую сложные типы данных, нельзя помещать в deps.
|
336
|
-
}, [outerValue, internalValue, items]);
|
331
|
+
}, [value]);
|
337
332
|
return /*#__PURE__*/React.createElement(Root, {
|
338
333
|
size: size,
|
339
334
|
view: view,
|