@homecode/ui 5.7.6 → 5.8.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.
package/dist/esm/index.js CHANGED
@@ -28,6 +28,7 @@ export { LangSelector } from './src/components/LangSelector/LangSelector.js';
28
28
  export { Lazy } from './src/components/Lazy/Lazy.js';
29
29
  export { LightBox } from './src/components/LightBox/LightBox.js';
30
30
  export { Menu } from './src/components/Menu/Menu.js';
31
+ export { NestedMenu, NestedMenuItemRow, NestedMenuLabel } from './src/components/NestedMenu/NestedMenu.js';
31
32
  export { Notifications, NotificationsStore } from './src/components/Notifications/Notifications.js';
32
33
  export { Paranja } from './src/components/Paranja/Paranja.js';
33
34
  export { ANIMATION_DURATION, Popup } from './src/components/Popup/Popup.js';
@@ -59,6 +59,7 @@ import '../../services/i18n.js';
59
59
  import '../Portal/Portal.js';
60
60
  import '../Paranja/Paranja.styl.js';
61
61
  import '../LightBox/LightBox.styl.js';
62
+ import '../NestedMenu/NestedMenu.js';
62
63
  import '../Notifications/store.js';
63
64
  import '../Notifications/Notifications.styl.js';
64
65
  import '../PopupMenu/PopupMenu.styl.js';
@@ -8,8 +8,8 @@ const SCROLL_OFFSET = 300;
8
8
  const Card = forwardRef(function Card({ className, paddingSize = 'm', blur = false, ...props }, ref) {
9
9
  return (jsx("div", { ref: ref, className: cn(S.root, S[`padding-${paddingSize}`], blur && S.blur, className), ...props }));
10
10
  });
11
- function LinkCard({ className, ...props }) {
12
- return (jsx("a", { target: "_blank", rel: "noopener noreferrer", "data-slot": "link-card", className: cn(S.root, className), ...props }));
11
+ function LinkCard({ className, paddingSize = 'm', blur = false, ...props }) {
12
+ return (jsx("a", { target: "_blank", rel: "noopener noreferrer", "data-slot": "link-card", className: cn(S.root, S[`padding-${paddingSize}`], blur && S.blur, className), ...props }));
13
13
  }
14
14
  function CardHeader({ className, icon, iconWithBackground = false, textsClassName, title, titleClassName, titleId, description, descriptionClassName, descriptionId, children, ...props }) {
15
15
  return (jsxs("div", { "data-slot": "card-header", className: cn(S.header, className), ...props, children: [icon && (jsx("div", { className: cn(S.icon, iconWithBackground && S.withBackground), children: icon })), children, (title || description) && (jsxs("div", { className: cn(S.headerText, textsClassName), children: [title && (jsx(CardTitle, { id: titleId, className: titleClassName, children: title })), description && (jsx(CardDescription, { id: descriptionId, className: descriptionClassName, children: description }))] }))] }));
@@ -1,6 +1,6 @@
1
1
  import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
2
2
 
3
- var css_248z = ".Card_root__khJ4u{background-color:var(--surface-color);border-radius:var(--border-radius-l);display:flex;flex-direction:column;gap:var(--p-5);max-height:100%;position:relative}.Card_root__khJ4u.Card_blur__VbZXN{-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);background-color:var(--decent-color-alpha-500)}.Card_root__khJ4u.Card_padding-xs__dd13Q{border-radius:var(--p-3);padding:var(--p-2)}.Card_root__khJ4u.Card_padding-s__S7iiZ{border-radius:var(--p-4);padding:var(--p-3)}.Card_root__khJ4u.Card_padding-m__thC3O{border-radius:var(--p-6);padding:var(--p-5)}.Card_root__khJ4u.Card_padding-l__gtTEF{border-radius:var(--p-8);padding:var(--p-8)}.Card_root__khJ4u.Card_padding-xl__y01o1{border-radius:var(--p-11);padding:var(--p-10)}.Card_header__LDTGV{align-items:flex-start;display:flex;gap:var(--p-5);justify-content:space-between}.Card_header__LDTGV:has([data-slot=card-action]){grid-template-columns:1fr auto}.Card_icon__aRlE5{align-items:center;border-radius:var(--p-2);box-shadow:inset 0 0 0 1px var(--decent-color-alpha-200);display:flex;flex-shrink:0;height:48px;justify-content:center;width:48px}.Card_icon__aRlE5.Card_withBackground__lIrjx{background-color:var(--accent-color-alpha-100);box-shadow:none}.Card_icon__aRlE5>img,.Card_icon__aRlE5>svg{height:20px;width:20px}.Card_headerText__hawuL{flex-grow:1;overflow:hidden}.Card_scroll__uDcXL{max-height:100%;overflow:hidden;padding-right:var(--p-5);width:calc(100% + var(--p-5))}.Card_scroll__uDcXL [data-slot=card-content]{padding-right:1px}.Card_centered__0YX4F,.Card_fullHeight__i3n8e{display:flex;flex-direction:column}.Card_centered__0YX4F{align-items:center;justify-content:center}.Card_fullHeight__i3n8e{flex-grow:1}.Card_description__RTQTR,.Card_title__Z1SQz{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.Card_title__Z1SQz{font-size:120%;font-weight:500;line-height:1}.Card_description__RTQTR{color:var(--accent-color-alpha-500);max-width:100%;word-break:break-word}.Card_action__viIuL{grid-row-span:2;align-self:start;grid-column-start:2;grid-row-start:1;justify-self:end}.Card_footer__T0DXA{align-items:center;display:flex;flex-shrink:0;justify-content:space-between;overflow:hidden}";
3
+ var css_248z = ".Card_root__khJ4u{background-color:var(--surface-color);border-radius:var(--border-radius-l);display:flex;flex-direction:column;gap:var(--p-5);max-height:100%;position:relative}.Card_root__khJ4u.Card_blur__VbZXN{-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);background-color:var(--decent-color-alpha-500)}.Card_root__khJ4u.Card_padding-xs__dd13Q{border-radius:var(--p-3);padding:var(--p-2)}.Card_root__khJ4u.Card_padding-s__S7iiZ{border-radius:var(--p-4);padding:var(--p-3)}.Card_root__khJ4u.Card_padding-m__thC3O{border-radius:var(--p-6);padding:var(--p-5)}.Card_root__khJ4u.Card_padding-l__gtTEF{border-radius:var(--p-8);padding:var(--p-8)}.Card_root__khJ4u.Card_padding-xl__y01o1{border-radius:var(--p-11);padding:var(--p-10)}.Card_header__LDTGV{align-items:flex-start;display:flex;gap:var(--p-5);justify-content:space-between}.Card_header__LDTGV:has([data-slot=card-action]){grid-template-columns:1fr auto}.Card_icon__aRlE5{align-items:center;border-radius:var(--p-2);box-shadow:inset 0 0 0 1px var(--decent-color-alpha-200);display:flex;flex-shrink:0;height:48px;justify-content:center;width:48px}.Card_icon__aRlE5.Card_withBackground__lIrjx{background-color:var(--accent-color-alpha-100);box-shadow:none}.Card_icon__aRlE5>img,.Card_icon__aRlE5>svg{height:20px;width:20px}.Card_headerText__hawuL{flex-grow:1;overflow:hidden}.Card_scroll__uDcXL{max-height:100%;overflow:hidden;padding-right:var(--p-5);width:calc(100% + var(--p-5))}.Card_scroll__uDcXL [data-slot=card-content]{padding-right:1px}.Card_centered__0YX4F,.Card_fullHeight__i3n8e{display:flex;flex-direction:column}.Card_centered__0YX4F{align-items:center;justify-content:center}.Card_fullHeight__i3n8e{flex-grow:1}.Card_description__RTQTR,.Card_title__Z1SQz{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.Card_title__Z1SQz{font-size:120%;font-weight:500;line-height:1.2}.Card_description__RTQTR{color:var(--accent-color-alpha-500);max-width:100%;word-break:break-word}.Card_action__viIuL{grid-row-span:2;align-self:start;grid-column-start:2;grid-row-start:1;justify-self:end}.Card_footer__T0DXA{align-items:center;display:flex;flex-shrink:0;justify-content:space-between;overflow:hidden}";
4
4
  var S = {"root":"Card_root__khJ4u","blur":"Card_blur__VbZXN","padding-xs":"Card_padding-xs__dd13Q","padding-s":"Card_padding-s__S7iiZ","padding-m":"Card_padding-m__thC3O","padding-l":"Card_padding-l__gtTEF","padding-xl":"Card_padding-xl__y01o1","header":"Card_header__LDTGV","icon":"Card_icon__aRlE5","withBackground":"Card_withBackground__lIrjx","headerText":"Card_headerText__hawuL","scroll":"Card_scroll__uDcXL","centered":"Card_centered__0YX4F","fullHeight":"Card_fullHeight__i3n8e","title":"Card_title__Z1SQz","description":"Card_description__RTQTR","action":"Card_action__viIuL","footer":"Card_footer__T0DXA"};
5
5
  styleInject(css_248z);
6
6
 
@@ -1,7 +1,7 @@
1
1
  import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
2
2
 
3
- var css_248z = ".Chip_chip__DXD0C{align-items:center;background:var(--accent-color-alpha-100);cursor:pointer;display:inline-flex;gap:2px;transition:background .2s ease}.Chip_chip__DXD0C:hover{background:var(--accent-color-alpha-200)}.Chip_size_xs__IbN1f{border-radius:var(--p-1);font-size:14px;padding-left:var(--p-1)}.Chip_size_s__ERE3z{border-radius:var(--p-3);font-size:18px;padding-left:var(--p-3)}.Chip_size_m__F2Bbw{border-radius:var(--p-5);font-size:22px;padding-left:var(--p-5)}.Chip_size_l__YgtcF{border-radius:var(--p-8);font-size:26px;padding-left:var(--p-8)}.Chip_size_xl__-sKg7{border-radius:var(--p-10);font-size:26px;padding-left:var(--p-10)}.Chip_selected__UcBat,.Chip_selected__UcBat:hover{background:var(--accent-color-alpha-300)}.Chip_content__2xloA,.Chip_remove__vqyOL{align-items:center;display:flex}.Chip_remove__vqyOL{justify-content:center;opacity:.3;transform:scale(.6);transition:opacity .2s ease,transform .1s ease}.Chip_remove__vqyOL:hover{background-color:var(--danger-color-alpha-300);transform:scale(.8)}.Chip_remove__vqyOL svg{transform:scale(.8)}.Chip_chip__DXD0C:hover .Chip_remove__vqyOL{opacity:1}";
4
- var S = {"chip":"Chip_chip__DXD0C","size_xs":"Chip_size_xs__IbN1f","size_s":"Chip_size_s__ERE3z","size_m":"Chip_size_m__F2Bbw","size_l":"Chip_size_l__YgtcF","size_xl":"Chip_size_xl__-sKg7","selected":"Chip_selected__UcBat","content":"Chip_content__2xloA","remove":"Chip_remove__vqyOL"};
3
+ var css_248z = ".Chip_chip__DXD0C{align-items:center;background:var(--accent-color-alpha-100);cursor:pointer;display:inline-flex;gap:2px;transition:background .2s ease}.Chip_chip__DXD0C:hover{background:var(--accent-color-alpha-200)}.Chip_chip__DXD0C:not(:has(.Chip_remove__vqyOL)){padding-right:var(--chip-pad)}.Chip_size_xs__IbN1f{--chip-pad:var(--p-1);border-radius:var(--p-1);font-size:14px;padding-left:var(--chip-pad)}.Chip_size_s__ERE3z{--chip-pad:var(--p-3);border-radius:var(--p-3);font-size:18px;padding-left:var(--chip-pad)}.Chip_size_m__F2Bbw{--chip-pad:var(--p-5);border-radius:var(--p-5);font-size:22px;padding-left:var(--chip-pad)}.Chip_size_l__YgtcF{--chip-pad:var(--p-8);border-radius:var(--p-8)}.Chip_size_l__YgtcF,.Chip_size_xl__-sKg7{font-size:26px;padding-left:var(--chip-pad)}.Chip_size_xl__-sKg7{--chip-pad:var(--p-10);border-radius:var(--p-10)}.Chip_selected__UcBat,.Chip_selected__UcBat:hover{background:var(--accent-color-alpha-300)}.Chip_content__2xloA,.Chip_remove__vqyOL{align-items:center;display:flex}.Chip_remove__vqyOL{justify-content:center;opacity:.3;transform:scale(.6);transition:opacity .2s ease,transform .1s ease}.Chip_remove__vqyOL:hover{background-color:var(--danger-color-alpha-300);transform:scale(.8)}.Chip_remove__vqyOL svg{transform:scale(.8)}.Chip_chip__DXD0C:hover .Chip_remove__vqyOL{opacity:1}";
4
+ var S = {"chip":"Chip_chip__DXD0C","remove":"Chip_remove__vqyOL","size_xs":"Chip_size_xs__IbN1f","size_s":"Chip_size_s__ERE3z","size_m":"Chip_size_m__F2Bbw","size_l":"Chip_size_l__YgtcF","size_xl":"Chip_size_xl__-sKg7","selected":"Chip_selected__UcBat","content":"Chip_content__2xloA"};
5
5
  styleInject(css_248z);
6
6
 
7
7
  export { S as default };
@@ -1,7 +1,7 @@
1
1
  import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
2
2
 
3
- var css_248z = ".Dialogue_dialogOverlay__jjBIa{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background-color:var(--decent-color-alpha-900);inset:0;opacity:0;position:fixed;transition:opacity .2s ease-out;z-index:50}.Dialogue_dialogOverlay__jjBIa.Dialogue_isOpen__gISMb{animation-duration:.2s;animation-fill-mode:forwards;animation-name:Dialogue_fadeIn__RSEB2;animation-timing-function:ease-out;opacity:1}.Dialogue_dialogContent__-Lxde{border-radius:var(--border-radius-l);box-shadow:0 10px 20px rgba(0,0,0,.3),0 0 0 2px var(--decent-color-alpha-800);display:flex;flex-direction:column;left:50%;max-height:calc(100% - var(--p-5));opacity:0;position:fixed;top:50%;transform:translateX(-50%) translateY(-50%) scale(.95);transition:opacity .2s ease-out,transform .2s ease-out;width:-moz-fit-content;width:fit-content;z-index:50}.Dialogue_dialogContent__-Lxde.Dialogue_isOpen__gISMb{animation-duration:.2s;animation-fill-mode:forwards;animation-name:Dialogue_dialogueIn__M0tLL;animation-timing-function:ease-out;opacity:1;transform:translateX(-50%) translateY(-50%) scale(1)}.Dialogue_dialogContent__-Lxde.Dialogue_isClosed__lHYyZ{animation-duration:.2s;animation-fill-mode:forwards;animation-name:Dialogue_dialogueOut__6bLTY;animation-timing-function:ease-in;opacity:0;pointer-events:none;transform:translateX(-50%) translateY(-50%) scale(.95)}@media (max-width:700px){.Dialogue_dialogContent__-Lxde{max-width:calc(100% - var(--p-5));width:calc(100% - var(--p-5))}}.Dialogue_size-default__X1sdB{max-width:40rem}.Dialogue_size-login__GyixB{max-width:24rem}.Dialogue_size-wide__HQbiX{max-width:calc(100% - var(--p-5))}@media (min-width:700px){.Dialogue_size-wide__HQbiX{max-width:80rem}}.Dialogue_dialogClose__5q12n{align-items:center;background-color:transparent;border:none;border-radius:var(--border-radius-s);box-shadow:inset 0 0 0 2px none;color:var(--accent-color);cursor:pointer;display:flex;height:2rem;justify-content:center;opacity:.7;position:absolute;right:var(--p-3);top:var(--p-3);transform-origin:center;transition:opacity .2s ease,transform .2s ease;width:2rem;z-index:10}.Dialogue_dialogClose__5q12n:hover{opacity:1;transform:scale(1.1)}.Dialogue_dialogClose__5q12n:focus-visible{box-shadow:0 0 0 2px var(--active-color)}.Dialogue_dialogClose__5q12n:disabled{pointer-events:none}.Dialogue_footerAlignLeft__xQUD8{justify-content:flex-start}.Dialogue_footerAlignCenter__yq9Mu{justify-content:center}.Dialogue_footerAlignRight__Yo7hG{justify-content:flex-end}@keyframes Dialogue_fadeIn__RSEB2{0%{opacity:0}to{opacity:1}}@keyframes Dialogue_dialogueIn__M0tLL{0%{opacity:0;transform:translateX(-50%) translateY(-50%) scale(.95)}to{opacity:1;transform:translateX(-50%) translateY(-50%) scale(1)}}@keyframes Dialogue_dialogueOut__6bLTY{0%{opacity:1;transform:translateX(-50%) translateY(-50%) scale(1)}to{opacity:0;transform:translateX(-50%) translateY(-50%) scale(.95)}}";
4
- var S = {"dialogOverlay":"Dialogue_dialogOverlay__jjBIa","isOpen":"Dialogue_isOpen__gISMb","fadeIn":"Dialogue_fadeIn__RSEB2","dialogContent":"Dialogue_dialogContent__-Lxde","dialogueIn":"Dialogue_dialogueIn__M0tLL","isClosed":"Dialogue_isClosed__lHYyZ","dialogueOut":"Dialogue_dialogueOut__6bLTY","size-default":"Dialogue_size-default__X1sdB","size-login":"Dialogue_size-login__GyixB","size-wide":"Dialogue_size-wide__HQbiX","dialogClose":"Dialogue_dialogClose__5q12n","footerAlignLeft":"Dialogue_footerAlignLeft__xQUD8","footerAlignCenter":"Dialogue_footerAlignCenter__yq9Mu","footerAlignRight":"Dialogue_footerAlignRight__Yo7hG"};
3
+ var css_248z = ".Dialogue_dialogOverlay__jjBIa{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background-color:var(--decent-color-alpha-900);inset:0;opacity:0;position:fixed;transition:opacity .2s ease-out;z-index:50}.Dialogue_dialogOverlay__jjBIa.Dialogue_isOpen__gISMb{animation-duration:.2s;animation-fill-mode:forwards;animation-name:Dialogue_fadeIn__RSEB2;animation-timing-function:ease-out;opacity:1}.Dialogue_dialogContent__-Lxde{border-radius:var(--border-radius-l);box-shadow:0 10px 20px rgba(0,0,0,.3),0 0 0 2px var(--decent-color-alpha-800);display:flex;flex-direction:column;left:50%;max-height:calc(100% - var(--p-5));opacity:0;position:fixed;top:50%;transform:translateX(-50%) translateY(-50%) scale(.95);transition:opacity .2s ease-out,transform .2s ease-out;width:-moz-fit-content;width:fit-content;z-index:50}.Dialogue_dialogContent__-Lxde.Dialogue_isOpen__gISMb{animation-duration:.2s;animation-fill-mode:forwards;animation-name:Dialogue_dialogueIn__M0tLL;animation-timing-function:ease-out;opacity:1;transform:translateX(-50%) translateY(-50%) scale(1)}.Dialogue_dialogContent__-Lxde.Dialogue_isClosed__lHYyZ{animation-duration:.2s;animation-fill-mode:forwards;animation-name:Dialogue_dialogueOut__6bLTY;animation-timing-function:ease-in;opacity:0;pointer-events:none;transform:translateX(-50%) translateY(-50%) scale(.95)}@media (max-width:700px){.Dialogue_dialogContent__-Lxde{max-width:calc(100% - var(--p-5));width:calc(100% - var(--p-5))}}.Dialogue_dialogContent__-Lxde:has(.Dialogue_dialogClose__5q12n) [data-slot=card-header]{padding-right:calc(2rem + var(--p-3))}.Dialogue_size-default__X1sdB{max-width:40rem}.Dialogue_size-login__GyixB{max-width:24rem}.Dialogue_size-wide__HQbiX{max-width:calc(100% - var(--p-5))}@media (min-width:700px){.Dialogue_size-wide__HQbiX{max-width:80rem}}.Dialogue_dialogClose__5q12n{align-items:center;background-color:transparent;border:none;border-radius:var(--border-radius-s);box-shadow:inset 0 0 0 2px none;color:var(--accent-color);cursor:pointer;display:flex;height:2rem;justify-content:center;opacity:.7;position:absolute;right:var(--p-3);top:var(--p-3);transform-origin:center;transition:opacity .2s ease,transform .2s ease;width:2rem;z-index:10}.Dialogue_dialogClose__5q12n:hover{opacity:1;transform:scale(1.1)}.Dialogue_dialogClose__5q12n:focus-visible{box-shadow:0 0 0 2px var(--active-color)}.Dialogue_dialogClose__5q12n:disabled{pointer-events:none}.Dialogue_footerAlignLeft__xQUD8{justify-content:flex-start}.Dialogue_footerAlignCenter__yq9Mu{justify-content:center}.Dialogue_footerAlignRight__Yo7hG{justify-content:flex-end}@keyframes Dialogue_fadeIn__RSEB2{0%{opacity:0}to{opacity:1}}@keyframes Dialogue_dialogueIn__M0tLL{0%{opacity:0;transform:translateX(-50%) translateY(-50%) scale(.95)}to{opacity:1;transform:translateX(-50%) translateY(-50%) scale(1)}}@keyframes Dialogue_dialogueOut__6bLTY{0%{opacity:1;transform:translateX(-50%) translateY(-50%) scale(1)}to{opacity:0;transform:translateX(-50%) translateY(-50%) scale(.95)}}";
4
+ var S = {"dialogOverlay":"Dialogue_dialogOverlay__jjBIa","isOpen":"Dialogue_isOpen__gISMb","fadeIn":"Dialogue_fadeIn__RSEB2","dialogContent":"Dialogue_dialogContent__-Lxde","dialogueIn":"Dialogue_dialogueIn__M0tLL","isClosed":"Dialogue_isClosed__lHYyZ","dialogueOut":"Dialogue_dialogueOut__6bLTY","dialogClose":"Dialogue_dialogClose__5q12n","size-default":"Dialogue_size-default__X1sdB","size-login":"Dialogue_size-login__GyixB","size-wide":"Dialogue_size-wide__HQbiX","footerAlignLeft":"Dialogue_footerAlignLeft__xQUD8","footerAlignCenter":"Dialogue_footerAlignCenter__yq9Mu","footerAlignRight":"Dialogue_footerAlignRight__Yo7hG"};
5
5
  styleInject(css_248z);
6
6
 
7
7
  export { S as default };
@@ -54,6 +54,7 @@ export { default as layers } from './layers.svg.js';
54
54
  export { default as link } from './link.svg.js';
55
55
  export { default as linkedin } from './linkedin.svg.js';
56
56
  export { default as loader } from './loader.svg.js';
57
+ export { default as logout } from './logout.svg.js';
57
58
  export { default as lock } from './lock.svg.js';
58
59
  export { default as lockOpen } from './lockOpen.svg.js';
59
60
  export { default as map } from './map.svg.js';
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+
3
+ var _path;
4
+ 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); }
5
+ var SvgLogout = function SvgLogout(props) {
6
+ return /*#__PURE__*/React.createElement("svg", _extends({
7
+ xmlns: "http://www.w3.org/2000/svg",
8
+ fill: "currentColor",
9
+ viewBox: "0 0 24 24"
10
+ }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
11
+ d: "m17 7-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z"
12
+ })));
13
+ };
14
+
15
+ export { SvgLogout as default };
@@ -54,6 +54,7 @@ import '../Heading/Heading.js';
54
54
  import '../../services/i18n.js';
55
55
  import '../LightBox/LightBox.styl.js';
56
56
  import '../Menu/Menu.js';
57
+ import '../NestedMenu/NestedMenu.js';
57
58
  import '../Notifications/store.js';
58
59
  import '../Notifications/Notifications.styl.js';
59
60
  import '../PopupMenu/PopupMenu.styl.js';
@@ -0,0 +1,118 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import cn from 'classnames';
3
+ import { useRef, useState, useEffect, useLayoutEffect } from 'react';
4
+ import { Icon } from '../Icon/Icon.js';
5
+ import S from './NestedMenu.styl.js';
6
+
7
+ const MOBILE_MQ = '(max-width: 720px)';
8
+ const HOVER_MQ = '(hover: hover) and (pointer: fine)';
9
+ function useMedia(query) {
10
+ const [matches, setMatches] = useState(() => typeof window !== 'undefined' && window.matchMedia(query).matches);
11
+ useEffect(() => {
12
+ const mq = window.matchMedia(query);
13
+ const sync = () => setMatches(mq.matches);
14
+ sync();
15
+ mq.addEventListener('change', sync);
16
+ return () => mq.removeEventListener('change', sync);
17
+ }, [query]);
18
+ return matches;
19
+ }
20
+ function NestedMenuLabel({ children, className }) {
21
+ return jsx("span", { className: cn(S.label, className), children: children });
22
+ }
23
+ function NestedMenuItemRow({ children, className, danger, disabled, href, target, rel, onClick, }) {
24
+ const classes = cn(S.row, danger && S.itemDanger, className);
25
+ if (href) {
26
+ return (jsx("a", { className: classes, href: href, target: target, rel: rel, onClick: onClick, children: children }));
27
+ }
28
+ return (jsx("button", { type: "button", className: classes, disabled: disabled, onClick: onClick, children: children }));
29
+ }
30
+ function NestedMenuComponent({ trigger, items, open, onOpenChange, align = 'end', className, }) {
31
+ const rootRef = useRef(null);
32
+ const [activeId, setActiveId] = useState(null);
33
+ const [flipLeft, setFlipLeft] = useState(false);
34
+ const hoverTimer = useRef(0);
35
+ const stacked = useMedia(MOBILE_MQ);
36
+ const canHover = useMedia(HOVER_MQ);
37
+ const active = items.find(item => item.id === activeId);
38
+ function close() {
39
+ onOpenChange(false);
40
+ setActiveId(null);
41
+ }
42
+ function openSub(id, announce = false) {
43
+ setActiveId(id);
44
+ if (announce) {
45
+ items.find(item => item.id === id)?.onSubmenuOpen?.();
46
+ }
47
+ }
48
+ useEffect(() => {
49
+ if (!open) {
50
+ setActiveId(null);
51
+ return undefined;
52
+ }
53
+ const onKey = (e) => {
54
+ if (e.key === 'Escape')
55
+ close();
56
+ };
57
+ const onPointer = (e) => {
58
+ if (!rootRef.current?.contains(e.target))
59
+ close();
60
+ };
61
+ document.addEventListener('keydown', onKey);
62
+ document.addEventListener('pointerdown', onPointer);
63
+ return () => {
64
+ document.removeEventListener('keydown', onKey);
65
+ document.removeEventListener('pointerdown', onPointer);
66
+ };
67
+ }, [open]);
68
+ useLayoutEffect(() => {
69
+ if (!open || !rootRef.current)
70
+ return;
71
+ const rect = rootRef.current.getBoundingClientRect();
72
+ setFlipLeft(window.innerWidth - rect.right < 280);
73
+ }, [open, activeId]);
74
+ useEffect(() => () => window.clearTimeout(hoverTimer.current), []);
75
+ function onItemEnter(id) {
76
+ if (!canHover || stacked)
77
+ return;
78
+ window.clearTimeout(hoverTimer.current);
79
+ const item = items.find(entry => entry.id === id);
80
+ if (item?.disabled || !item?.submenu) {
81
+ setActiveId(null);
82
+ return;
83
+ }
84
+ openSub(id, false);
85
+ }
86
+ function onItemLeave() {
87
+ if (!canHover || stacked)
88
+ return;
89
+ hoverTimer.current = window.setTimeout(() => setActiveId(null), 160);
90
+ }
91
+ function onItemClick(id) {
92
+ const item = items.find(entry => entry.id === id);
93
+ if (!item || item.disabled)
94
+ return;
95
+ if (item.onClick && !item.submenu) {
96
+ item.onClick();
97
+ close();
98
+ return;
99
+ }
100
+ if (activeId === id && !stacked) {
101
+ setActiveId(null);
102
+ return;
103
+ }
104
+ openSub(id, true);
105
+ }
106
+ function renderItems() {
107
+ return items.map(item => (jsxs("div", { className: S.itemWrap, onMouseEnter: () => onItemEnter(item.id), onMouseLeave: onItemLeave, children: [jsxs("button", { type: "button", className: cn(S.item, activeId === item.id && S.itemActive, item.danger && S.itemDanger, item.disabled && S.itemDisabled, item.className), role: "menuitem", disabled: item.disabled, "aria-haspopup": item.submenu ? 'menu' : undefined, "aria-expanded": item.submenu ? activeId === item.id : undefined, onClick: () => onItemClick(item.id), children: [item.icon && (jsx("span", { className: S.icon, "aria-hidden": true, children: item.icon })), jsx("span", { className: S.label, children: item.label }), item.hint != null && item.hint !== '' && (jsx("span", { className: S.hint, children: item.hint })), item.submenu && (jsx(Icon, { className: S.chevron, type: "chevronRight", size: "xs" }))] }), !stacked && activeId === item.id && item.submenu && (jsx("div", { className: cn(S.submenu, flipLeft && S.submenuLeft), role: "menu", onMouseEnter: () => {
108
+ window.clearTimeout(hoverTimer.current);
109
+ }, children: item.submenu }))] }, item.id)));
110
+ }
111
+ return (jsxs("div", { ref: rootRef, className: cn(S.root, className), children: [jsx("div", { className: S.trigger, onClick: () => onOpenChange(!open), children: trigger }), open && (jsxs("div", { className: cn(S.popup, align === 'end' && S.alignEnd), role: "menu", children: [stacked && active && (jsxs("div", { className: S.stacked, children: [jsxs("button", { type: "button", className: S.back, onClick: () => setActiveId(null), children: [jsx(Icon, { type: "chevronLeft", size: "xs" }), jsx("span", { className: S.label, children: active.label })] }), jsx("div", { className: S.stackedBody, children: active.submenu })] })), (!stacked || !active) && renderItems()] }))] }));
112
+ }
113
+ const NestedMenu = Object.assign(NestedMenuComponent, {
114
+ Item: NestedMenuItemRow,
115
+ Label: NestedMenuLabel,
116
+ });
117
+
118
+ export { NestedMenu, NestedMenuItemRow, NestedMenuLabel };
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
2
+
3
+ var css_248z = ".NestedMenu_root__ybyGA{display:inline-flex;position:relative}.NestedMenu_trigger__zBeNI{display:inline-flex}.NestedMenu_popup__q0uYO{background:var(--decent-color);border:1px solid var(--accent-color-alpha-200);border-radius:10px;box-shadow:0 8px 28px rgba(0,0,0,.45);left:0;max-width:260px;min-width:200px;padding:4px;position:absolute;top:calc(100% + 6px);z-index:20}.NestedMenu_alignEnd__L4AZi{left:auto;right:0}.NestedMenu_itemWrap__Qmc0B{position:relative}.NestedMenu_back__dNsDV,.NestedMenu_item__tgbZm,.NestedMenu_row__48g5c{align-items:center;background:none;border:none;border-radius:6px;color:inherit;cursor:pointer;display:flex;font:inherit;font-size:13px;font-weight:500;gap:8px;letter-spacing:.01em;line-height:1.3;padding:6px 10px;text-align:left;text-decoration:none;width:100%}.NestedMenu_back__dNsDV.NestedMenu_itemActive__RfPZH,.NestedMenu_back__dNsDV:hover,.NestedMenu_item__tgbZm.NestedMenu_itemActive__RfPZH,.NestedMenu_item__tgbZm:hover,.NestedMenu_row__48g5c.NestedMenu_itemActive__RfPZH,.NestedMenu_row__48g5c:hover{background:var(--accent-color-alpha-100)}.NestedMenu_back__dNsDV.NestedMenu_itemDisabled__evVk1,.NestedMenu_back__dNsDV:disabled,.NestedMenu_item__tgbZm.NestedMenu_itemDisabled__evVk1,.NestedMenu_item__tgbZm:disabled,.NestedMenu_row__48g5c.NestedMenu_itemDisabled__evVk1,.NestedMenu_row__48g5c:disabled{cursor:default;opacity:.55;pointer-events:none}.NestedMenu_itemDanger__oAJbP{color:var(--active-color)}.NestedMenu_itemDanger__oAJbP .NestedMenu_icon__4g2Yp{color:inherit;opacity:1}.NestedMenu_icon__4g2Yp{display:inline-flex;flex-shrink:0;opacity:.55}.NestedMenu_icon__4g2Yp svg{display:block}.NestedMenu_label__Jnm6l{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.NestedMenu_hint__hotNP{flex-shrink:0;font-weight:400;opacity:.5}.NestedMenu_chevron__8i-Po{flex-shrink:0;opacity:.45}.NestedMenu_row__48g5c svg{color:var(--active-color);flex-shrink:0}.NestedMenu_submenu__Tx1Ll{background:var(--decent-color);border:1px solid var(--accent-color-alpha-200);border-radius:10px;box-shadow:0 8px 28px rgba(0,0,0,.45);left:calc(100% + 6px);max-height:min(360px,calc(100vh - 24px));max-width:280px;min-width:220px;overflow-x:hidden;overflow-y:auto;padding:4px;position:absolute;top:-4px;z-index:21}.NestedMenu_submenu__Tx1Ll:before{bottom:0;content:\"\";left:-6px;position:absolute;top:0;width:6px}.NestedMenu_submenuLeft__y18Nb{left:auto;right:calc(100% + 6px)}.NestedMenu_submenuLeft__y18Nb:before{left:auto;right:-6px}.NestedMenu_stacked__rMiOi{display:flex;flex-direction:column;max-height:min(360px,calc(100vh - 24px));overflow-y:auto}.NestedMenu_back__dNsDV{font-weight:650;margin-bottom:2px}.NestedMenu_stackedBody__Fbkma{min-width:0}";
4
+ var S = {"root":"NestedMenu_root__ybyGA","trigger":"NestedMenu_trigger__zBeNI","popup":"NestedMenu_popup__q0uYO","alignEnd":"NestedMenu_alignEnd__L4AZi","itemWrap":"NestedMenu_itemWrap__Qmc0B","item":"NestedMenu_item__tgbZm","row":"NestedMenu_row__48g5c","back":"NestedMenu_back__dNsDV","itemActive":"NestedMenu_itemActive__RfPZH","itemDisabled":"NestedMenu_itemDisabled__evVk1","itemDanger":"NestedMenu_itemDanger__oAJbP","icon":"NestedMenu_icon__4g2Yp","label":"NestedMenu_label__Jnm6l","hint":"NestedMenu_hint__hotNP","chevron":"NestedMenu_chevron__8i-Po","submenu":"NestedMenu_submenu__Tx1Ll","submenuLeft":"NestedMenu_submenuLeft__y18Nb","stacked":"NestedMenu_stacked__rMiOi","stackedBody":"NestedMenu_stackedBody__Fbkma"};
5
+ styleInject(css_248z);
6
+
7
+ export { S as default };
@@ -1,5 +1,6 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { useState, useEffect, useCallback, useImperativeHandle } from 'react';
3
+ import { Icon } from '../../components/Icon/Icon.js';
3
4
  import { Menu } from '../../components/Menu/Menu.js';
4
5
  import S from './SlashSuggestionList.styl.js';
5
6
  import cn from 'classnames';
@@ -47,7 +48,7 @@ function SlashSuggestionListInner({ items, command, listHandleRef, }) {
47
48
  useImperativeHandle(listHandleRef, () => ({ onKeyboardEvent }), [
48
49
  onKeyboardEvent,
49
50
  ]);
50
- return (jsx("div", { className: S.root, children: jsx(Menu, { className: S.menu, role: "listbox", "aria-label": "Slash commands", children: items.map((item, idx) => (jsxs(Menu.Item, { role: "option", "aria-selected": idx === safeSel, className: cn(S.item, idx === safeSel && S.itemHighlighted, item.className), onMouseDown: e => e.preventDefault(), onMouseEnter: () => setSelected(idx), onClick: () => onPick(idx), textOverflow: true, children: [jsx("span", { className: S.itemLabel, children: item.label }), item.description ? (jsx("span", { className: S.itemDesc, children: item.description })) : null] }, `${item.id}-${idx}`))) }) }));
51
+ return (jsx("div", { className: S.root, children: jsx(Menu, { className: S.menu, role: "listbox", "aria-label": "Slash commands", children: items.map((item, idx) => (jsxs(Menu.Item, { role: "option", "aria-selected": idx === safeSel, className: cn(S.item, idx === safeSel && S.itemHighlighted, item.className), onMouseDown: e => e.preventDefault(), onMouseEnter: () => setSelected(idx), onClick: () => onPick(idx), textOverflow: true, children: [item.icon && (jsx(Icon, { type: item.icon, size: "s", className: S.itemIcon })), jsxs("span", { className: S.itemText, children: [jsx("span", { className: S.itemLabel, children: item.label }), item.description && (jsx("span", { className: S.itemDesc, children: item.description }))] })] }, `${item.id}-${idx}`))) }) }));
51
52
  }
52
53
  function SlashSuggestionList(props) {
53
54
  if (props.items.length === 0)
@@ -1,7 +1,7 @@
1
1
  import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
2
2
 
3
- var css_248z = ".SlashSuggestionList_root__9KCb1{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background-color:var(--decent-color-alpha-700);border-radius:8px;border-radius:var(--radius-lg,8px);box-shadow:inset 0 0 0 1px var(--accent-color-alpha-50),0 8px 24px rgba(0,0,0,.2);color:var(--foreground);max-width:90vw;min-width:220px;overflow:hidden;position:relative}.SlashSuggestionList_root__9KCb1:before{background-color:var(--accent-color-alpha-50);bottom:0;content:\"\";left:0;pointer-events:none;position:absolute;right:0;top:0}.dark .SlashSuggestionList_root__9KCb1{box-shadow:inset 0 0 0 1px var(--accent-color-alpha-50),0 8px 24px rgba(0,0,0,.5)}.SlashSuggestionList_menu__s-jK3{margin:0;max-height:40vh}.SlashSuggestionList_item__9JBeY{align-items:flex-start;border-radius:var(--p-2);display:flex;flex-direction:column;height:auto!important;justify-content:center;min-height:0;overflow:visible!important;padding:var(--p-1) var(--p-2)!important;position:relative;text-overflow:clip!important;white-space:normal!important;width:100%}.SlashSuggestionList_item__9JBeY:hover{background-color:var(--accent-color-alpha-50)}.SlashSuggestionList_itemHighlighted__cStZr,.SlashSuggestionList_item__9JBeY:hover{box-shadow:inset 100vw 0 0 0 var(--accent-color-alpha-200)}.SlashSuggestionList_itemLabel__OMaov{font-weight:600}.SlashSuggestionList_itemDesc__fAdcA{color:var(--accent-color-alpha-600);font-size:80%;white-space:normal}.SlashSuggestionList_mention__aT45p{align-items:center;background:var(--muted);border-radius:var(--p-1);display:inline-flex;line-height:1.4;margin:0 var(--p-1);padding:0 var(--p-1);-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:baseline;white-space:nowrap}";
4
- var S = {"root":"SlashSuggestionList_root__9KCb1","menu":"SlashSuggestionList_menu__s-jK3","item":"SlashSuggestionList_item__9JBeY","itemHighlighted":"SlashSuggestionList_itemHighlighted__cStZr","itemLabel":"SlashSuggestionList_itemLabel__OMaov","itemDesc":"SlashSuggestionList_itemDesc__fAdcA","mention":"SlashSuggestionList_mention__aT45p"};
3
+ var css_248z = ".SlashSuggestionList_root__9KCb1{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background-color:var(--decent-color-alpha-700);border-radius:8px;border-radius:var(--radius-lg,8px);box-shadow:inset 0 0 0 1px var(--accent-color-alpha-50),0 8px 24px rgba(0,0,0,.2);color:var(--foreground);max-width:90vw;min-width:220px;overflow:hidden;position:relative}.SlashSuggestionList_root__9KCb1:before{background-color:var(--accent-color-alpha-50);bottom:0;content:\"\";left:0;pointer-events:none;position:absolute;right:0;top:0}.dark .SlashSuggestionList_root__9KCb1{box-shadow:inset 0 0 0 1px var(--accent-color-alpha-50),0 8px 24px rgba(0,0,0,.5)}.SlashSuggestionList_menu__s-jK3{margin:0;max-height:40vh}.SlashSuggestionList_item__9JBeY{align-items:center;border-radius:var(--p-2);display:flex;flex-direction:row;gap:var(--p-2);height:auto!important;justify-content:flex-start;min-height:0;overflow:visible!important;padding:var(--p-1) var(--p-2)!important;position:relative;text-overflow:clip!important;white-space:normal!important;width:100%}.SlashSuggestionList_itemHighlighted__cStZr{box-shadow:inset 100vw 0 0 0 var(--accent-color-alpha-200)}.SlashSuggestionList_itemIcon__hTtxe{color:var(--accent-color-alpha-800);flex-shrink:0}.SlashSuggestionList_itemText__uwNbZ{align-items:flex-start;display:flex;flex-direction:column;min-width:0}.SlashSuggestionList_itemLabel__OMaov{font-weight:600}.SlashSuggestionList_itemDesc__fAdcA{color:var(--accent-color-alpha-600);font-size:80%;white-space:normal}.SlashSuggestionList_mention__aT45p{align-items:center;background:var(--muted);border-radius:var(--p-1);display:inline-flex;line-height:1.4;margin:0 var(--p-1);padding:0 var(--p-1);transition:background-color .1s ease-in-out;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:baseline;white-space:nowrap}.SlashSuggestionList_mention__aT45p:hover{background-color:var(--accent-color-alpha-200)}";
4
+ var S = {"root":"SlashSuggestionList_root__9KCb1","menu":"SlashSuggestionList_menu__s-jK3","item":"SlashSuggestionList_item__9JBeY","itemHighlighted":"SlashSuggestionList_itemHighlighted__cStZr","itemIcon":"SlashSuggestionList_itemIcon__hTtxe","itemText":"SlashSuggestionList_itemText__uwNbZ","itemLabel":"SlashSuggestionList_itemLabel__OMaov","itemDesc":"SlashSuggestionList_itemDesc__fAdcA","mention":"SlashSuggestionList_mention__aT45p"};
5
5
  styleInject(css_248z);
6
6
 
7
7
  export { S as default };
@@ -3,7 +3,7 @@ declare const Card: import("react").ForwardRefExoticComponent<Omit<import("react
3
3
  paddingSize?: "s" | "xs" | "m" | "l" | "xl";
4
4
  blur?: boolean;
5
5
  } & import("react").RefAttributes<HTMLDivElement>>;
6
- declare function LinkCard({ className, ...props }: LinkCardProps): import("react").JSX.Element;
6
+ declare function LinkCard({ className, paddingSize, blur, ...props }: LinkCardProps): import("react").JSX.Element;
7
7
  declare function CardHeader({ className, icon, iconWithBackground, textsClassName, title, titleClassName, titleId, description, descriptionClassName, descriptionId, children, ...props }: CardHeaderProps): import("react").JSX.Element;
8
8
  declare function CardTitle({ className, ...props }: CardTitleProps): import("react").JSX.Element;
9
9
  declare function CardDescription({ className, ...props }: CardDescriptionProps): import("react").JSX.Element;
@@ -54,6 +54,7 @@ export { default as layers } from './layers.svg';
54
54
  export { default as link } from './link.svg';
55
55
  export { default as linkedin } from './linkedin.svg';
56
56
  export { default as loader } from './loader.svg';
57
+ export { default as logout } from './logout.svg';
57
58
  export { default as lock } from './lock.svg';
58
59
  export { default as lockOpen } from './lockOpen.svg';
59
60
  export { default as map } from './map.svg';
@@ -0,0 +1,9 @@
1
+ import * as T from './NestedMenu.types';
2
+ export type { NestedMenuItem, Props as NestedMenuProps, } from './NestedMenu.types';
3
+ export declare function NestedMenuLabel({ children, className }: T.NestedMenuLabelProps): import("react").JSX.Element;
4
+ export declare function NestedMenuItemRow({ children, className, danger, disabled, href, target, rel, onClick, }: T.NestedMenuRowProps): import("react").JSX.Element;
5
+ declare function NestedMenuComponent({ trigger, items, open, onOpenChange, align, className, }: T.Props): import("react").JSX.Element;
6
+ export declare const NestedMenu: typeof NestedMenuComponent & {
7
+ Item: typeof NestedMenuItemRow;
8
+ Label: typeof NestedMenuLabel;
9
+ };
@@ -0,0 +1,35 @@
1
+ import { ReactNode } from 'react';
2
+ export type NestedMenuItem = {
3
+ id: string;
4
+ label: ReactNode;
5
+ icon?: ReactNode;
6
+ hint?: ReactNode;
7
+ submenu?: ReactNode;
8
+ onSubmenuOpen?: () => void;
9
+ onClick?: () => void;
10
+ danger?: boolean;
11
+ disabled?: boolean;
12
+ className?: string;
13
+ };
14
+ export type Props = {
15
+ trigger: ReactNode;
16
+ items: NestedMenuItem[];
17
+ open: boolean;
18
+ onOpenChange: (open: boolean) => void;
19
+ align?: 'start' | 'end';
20
+ className?: string;
21
+ };
22
+ export type NestedMenuRowProps = {
23
+ children: ReactNode;
24
+ className?: string;
25
+ danger?: boolean;
26
+ disabled?: boolean;
27
+ href?: string;
28
+ target?: string;
29
+ rel?: string;
30
+ onClick?: () => void;
31
+ };
32
+ export type NestedMenuLabelProps = {
33
+ children: ReactNode;
34
+ className?: string;
35
+ };
@@ -28,6 +28,7 @@ export * from './LangSelector/LangSelector';
28
28
  export * from './Lazy/Lazy';
29
29
  export * from './LightBox/LightBox';
30
30
  export * from './Menu/Menu';
31
+ export * from './NestedMenu/NestedMenu';
31
32
  export * from './Notifications/Notifications';
32
33
  export * from './Paranja/Paranja';
33
34
  export * from './Popup/Popup';
@@ -1,8 +1,11 @@
1
1
  import type { Editor, Range } from '@tiptap/core';
2
+ import type { IconType } from '../../components/Icon/Icon.types';
2
3
  export type SlashCommandItem = {
3
4
  id: string;
4
5
  label: string;
5
6
  description?: string;
7
+ /** Left icon in the slash suggestion list (`<Icon type={icon} />`). */
8
+ icon?: IconType;
6
9
  /** Extra class on inserted mention chip (merged with `slash-mention`). */
7
10
  className?: string;
8
11
  /** CSS color for chip text; background uses 30% color blend. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homecode/ui",
3
- "version": "5.7.6",
3
+ "version": "5.8.0",
4
4
  "description": "React UI components library",
5
5
  "scripts": {
6
6
  "tests": "jest",