@skbkontur/side-menu 5.0.0-alpha.0 → 5.0.0-alpha.1

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 (38) hide show
  1. package/internal/themes/SideMenuDarkTheme.js +1 -3
  2. package/internal/themes/SideMenuTheme.d.ts +3 -25
  3. package/internal/themes/SideMenuTheme.js +13 -41
  4. package/package.json +2 -2
  5. package/src/SideMenu/SideMenu.d.ts +0 -2
  6. package/src/SideMenu/SideMenu.js +32 -63
  7. package/src/SideMenu/SideMenu.styles.d.ts +0 -4
  8. package/src/SideMenu/SideMenu.styles.js +11 -28
  9. package/src/SideMenuBody/SideMenuBody.js +0 -2
  10. package/src/SideMenuBody/SideMenuBody.styles.js +1 -1
  11. package/src/SideMenuDivider/SideMenuDivider.js +1 -4
  12. package/src/SideMenuDivider/SideMenuDivider.styles.d.ts +0 -1
  13. package/src/SideMenuDivider/SideMenuDivider.styles.js +2 -5
  14. package/src/SideMenuDropdown/SideMenuDropdown.js +7 -7
  15. package/src/SideMenuDropdown/SideMenuDropdown.styles.d.ts +0 -1
  16. package/src/SideMenuDropdown/SideMenuDropdown.styles.js +4 -8
  17. package/src/SideMenuFooter/SideMenuFooter.js +5 -41
  18. package/src/SideMenuFooter/SideMenuFooter.styles.d.ts +0 -7
  19. package/src/SideMenuFooter/SideMenuFooter.styles.js +8 -30
  20. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.js +1 -1
  21. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.d.ts +1 -1
  22. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.js +2 -2
  23. package/src/internal/ClickableElement.js +0 -1
  24. package/src/internal/ClickableElement.styles.d.ts +0 -1
  25. package/src/internal/ClickableElement.styles.js +11 -16
  26. package/src/internal/CollapseToggle.js +2 -6
  27. package/src/internal/CollapseToggle.styles.d.ts +0 -2
  28. package/src/internal/CollapseToggle.styles.js +1 -7
  29. package/src/internal/ItemContent/Caption.js +0 -1
  30. package/src/internal/ItemContent/Caption.styles.d.ts +0 -1
  31. package/src/internal/ItemContent/Caption.styles.js +13 -16
  32. package/src/internal/ItemContent/Icon.js +0 -2
  33. package/src/internal/ItemContent/Icon.styles.d.ts +0 -2
  34. package/src/internal/ItemContent/Icon.styles.js +8 -14
  35. package/src/internal/ItemContent/Marker.js +2 -8
  36. package/src/internal/ItemContent/Marker.styles.d.ts +0 -3
  37. package/src/internal/ItemContent/Marker.styles.js +5 -16
  38. package/src/internal/NarrowAccordionDropdown.js +8 -8
@@ -5,9 +5,6 @@ export declare const getStyles: import("../../../lib/theming/ThemeHelpers.js").S
5
5
  rootMultiline(t: SideMenuTheme): string;
6
6
  rootSubMenu(t: SideMenuTheme): string;
7
7
  rootSubMenuEmpty(t: SideMenuTheme): string;
8
- rootSubMenuLarge(t: SideMenuTheme): string;
9
8
  rootCollapsed(): string;
10
- rootCollapsedLarge(): string;
11
9
  rootEmptyCollapsed(): string;
12
- rootEmptyCollapsedLarge(): string;
13
10
  }>;
@@ -13,28 +13,17 @@ export var getStyles = memoizeGetStyles(function (_a) {
13
13
  return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n align-self: flex-start;\n margin-top: ", ";\n "], ["\n align-self: flex-start;\n margin-top: ", ";\n "])), t.sideMenuMarkerMultilineMarginTop);
14
14
  },
15
15
  rootSubMenu: function (t) {
16
- return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin-right: ", ";\n background: transparent;\n color: ", ";\n font-weight: ", ";\n "], ["\n margin-right: ", ";\n background: transparent;\n color: ", ";\n font-weight: ", ";\n "])), t.sideMenuMarkerSubItemMarginRight, t.sideMenuMarkerSubItemColor, t.sideMenuMarkerSubItemFontWeight);
16
+ return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n background: transparent;\n color: ", ";\n font-weight: ", ";\n "], ["\n background: transparent;\n color: ", ";\n font-weight: ", ";\n "])), t.sideMenuMarkerSubItemColor, t.sideMenuMarkerSubItemFontWeight);
17
17
  },
18
18
  rootSubMenuEmpty: function (t) {
19
- return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-right: ", ";\n background: ", ";\n "], ["\n margin-right: ", ";\n background: ", ";\n "])), t.sideMenuMarkerSubItemEmptyMarginRight, t.sideMenuMarkerBg);
19
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), t.sideMenuMarkerBg);
20
20
  },
21
- rootSubMenuLarge: function (t) {
22
- return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-size: ", ";\n line-height: ", ";\n "], ["\n font-size: ", ";\n line-height: ", ";\n "])), t.sideMenuMarkerSubItemFontSizeLarge, t.sideMenuMarkerSubItemLineHeightLarge);
23
- },
24
- // В свёрнутом меню бейдж позиционируется относительно центра пункта (т.е. иконки),
25
- // чтобы не отрываться от неё при любом размере пункта.
26
21
  rootCollapsed: function () {
27
- return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n position: absolute;\n left: calc(50% + 13px);\n top: 0;\n transform: translateX(-50%);\n margin: 0;\n "], ["\n position: absolute;\n left: calc(50% + 13px);\n top: 0;\n transform: translateX(-50%);\n margin: 0;\n "])));
28
- },
29
- rootCollapsedLarge: function () {
30
- return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n top: 3px;\n "], ["\n top: 3px;\n "])));
22
+ return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: absolute;\n right: 0;\n top: 0;\n margin: 0;\n "], ["\n position: absolute;\n right: 0;\n top: 0;\n margin: 0;\n "])));
31
23
  },
32
24
  rootEmptyCollapsed: function () {
33
- return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n left: calc(50% + 12px);\n top: 4px;\n "], ["\n left: calc(50% + 12px);\n top: 4px;\n "])));
34
- },
35
- rootEmptyCollapsedLarge: function () {
36
- return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n top: 8px;\n "], ["\n top: 8px;\n "])));
25
+ return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n right: 4px;\n top: 4px;\n "], ["\n right: 4px;\n top: 4px;\n "])));
37
26
  },
38
27
  });
39
28
  });
40
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
29
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
@@ -9,8 +9,8 @@ import { getStyles as getSideMenuStyles } from '../SideMenu/SideMenu.styles.js';
9
9
  import { SideMenuContext } from '../SideMenuContext.js';
10
10
  import { getStyles as getDropdownStyles } from '../SideMenuDropdown/SideMenuDropdown.styles.js';
11
11
  export var NarrowAccordionDropdown = function (_a) {
12
- var _b, _c;
13
- var _d;
12
+ var _b;
13
+ var _c;
14
14
  var caption = _a.caption, children = _a.children, htmlId = _a.htmlId, ariaLabel = _a["aria-label"], childIdCounterRef = _a.childIdCounterRef, disabled = _a.disabled, onOpenChange = _a.onOpenChange;
15
15
  var context = useContext(SideMenuContext);
16
16
  var theme = getSideMenuTheme(useContext(ThemeContext));
@@ -19,17 +19,17 @@ export var NarrowAccordionDropdown = function (_a) {
19
19
  var dropdownStyles = useStyles(getDropdownStyles);
20
20
  var dropdownMenuRef = useRef(null);
21
21
  var isMenuCollapsed = !context.isOpened && (context.isDesktop || context.isNarrowDesktop);
22
- return (React.createElement("div", { className: cx(dropdownStyles.wrapper(), (_b = {}, _b[dropdownStyles.wrapperCollapsed()] = isMenuCollapsed, _b)) },
23
- React.createElement(DropdownMenu, { ref: dropdownMenuRef, caption: React.createElement("div", { className: cx(dropdownStyles.label(theme), (_c = {},
24
- _c[dropdownStyles.labelTouchScreen(theme)] = context.isTouchScreen,
25
- _c[dropdownStyles.labelCollapsed()] = isMenuCollapsed,
26
- _c)), onClick: disabled ? function (e) { return e.stopPropagation(); } : undefined }, caption), positions: ['right top', 'right middle', 'right bottom'], disableAnimations: true, popupMenuId: htmlId, "aria-label": ariaLabel, onOpen: function () {
22
+ return (React.createElement("div", { className: cx(dropdownStyles.wrapper()) },
23
+ React.createElement(DropdownMenu, { ref: dropdownMenuRef, caption: React.createElement("div", { className: cx(dropdownStyles.label(theme), (_b = {},
24
+ _b[dropdownStyles.labelTouchScreen(theme)] = context.isTouchScreen,
25
+ _b[dropdownStyles.labelCollapsed()] = isMenuCollapsed,
26
+ _b)), onClick: disabled ? function (e) { return e.stopPropagation(); } : undefined }, caption), positions: ['right top', 'right middle', 'right bottom'], disableAnimations: true, popupMenuId: htmlId, "aria-label": ariaLabel, onOpen: function () {
27
27
  if (childIdCounterRef) {
28
28
  childIdCounterRef.current = 0;
29
29
  }
30
30
  onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(true);
31
31
  }, onClose: function () { return onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(false); } },
32
32
  React.createElement("ul", { className: cx(sideMenuStyles.list()), "data-tid": SideMenuDataTids.narrowAccordionDropdown },
33
- React.createElement(SideMenuContext.Provider, { value: __assign(__assign({}, context), { hasSeparatedSubMenu: false, parentItemId: htmlId, currentItemNestingLevel: ((_d = context.currentItemNestingLevel) !== null && _d !== void 0 ? _d : 0) + 1, closeParentDropdown: function () { var _a; return (_a = dropdownMenuRef.current) === null || _a === void 0 ? void 0 : _a.close(); }, childIdCounterRef: childIdCounterRef !== null && childIdCounterRef !== void 0 ? childIdCounterRef : context.childIdCounterRef }) }, children)))));
33
+ React.createElement(SideMenuContext.Provider, { value: __assign(__assign({}, context), { hasSeparatedSubMenu: false, parentItemId: htmlId, currentItemNestingLevel: ((_c = context.currentItemNestingLevel) !== null && _c !== void 0 ? _c : 0) + 1, closeParentDropdown: function () { var _a; return (_a = dropdownMenuRef.current) === null || _a === void 0 ? void 0 : _a.close(); }, childIdCounterRef: childIdCounterRef !== null && childIdCounterRef !== void 0 ? childIdCounterRef : context.childIdCounterRef }) }, children)))));
34
34
  };
35
35
  NarrowAccordionDropdown.displayName = 'NarrowAccordionDropdown';