@elcrm/components 0.2.9 → 0.2.13

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/index.es.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import { L as x } from "./Layout-mi6Ghayv.js";
2
- import { H as i } from "./Header-DZQopVNy.js";
2
+ import { H as l } from "./Header-DZQopVNy.js";
3
3
  import { F as n } from "./Footer-qxUlnPR9.js";
4
4
  import { L as u } from "./List-BgKkYaGO.js";
5
5
  import { I as d } from "./Item-D4okhsfW.js";
6
6
  import { I as P } from "./ItemColumn-M7a9L8CI.js";
7
7
  import { C as T } from "./Card-hn37Opo3.js";
8
- import { A } from "./ActionGroup-ChKFW0mt.js";
9
- import { T as I, a as L, u as b } from "./Toolbar-C1zAk9ak.js";
8
+ import { A as I } from "./ActionGroup-ChKFW0mt.js";
9
+ import { T as b, a as A, u as L } from "./Toolbar-C1zAk9ak.js";
10
10
  import { T as R } from "./TextGroup-DmhuyMR1.js";
11
- import { S as H } from "./Stat-sKXJwz5L.js";
12
- import { B as k } from "./Block-Bu7NEA0g.js";
11
+ import { S as G } from "./Stat-sKXJwz5L.js";
12
+ import { B as g } from "./Block-Bu7NEA0g.js";
13
13
  import { R as N } from "./Row-DsQOVn18.js";
14
14
  import { C as M } from "./Column-BiogBDf8.js";
15
15
  import { S as Z, s as w } from "./Stack-XkmPSswj.js";
@@ -18,53 +18,61 @@ import { D as j } from "./Dropdown-DosvDR13.js";
18
18
  import { B as K } from "./Breadcrumb-CAM_e9LN.js";
19
19
  import { L as U } from "./Loading-DkkG7RcE.js";
20
20
  import { S as W } from "./Section-Crxk2J-E.js";
21
- import { N as Y } from "./NavSections-BpyZPimZ.js";
21
+ import { N as Y } from "./NavSections-D6rDEtT1.js";
22
22
  import { T as $ } from "./TabSections-DN7yVJoF.js";
23
- import { A as or, a as ar, i as er } from "./Avatar-loGgFt72.js";
24
- import { A as sr } from "./AvatarGroup-D1gnT3Od.js";
25
- import { A as mr } from "./AvatarName-0BzyfpMq.js";
26
- import { B as fr } from "./Badge-jp-9iNNL.js";
27
- import { B as lr } from "./Brand-Zq-Idks4.js";
28
- import { E as cr } from "./EmptyState-mBiWtMIM.js";
29
- import { R as Sr } from "./RadioGroup-fcXzhvMu.js";
30
- import { P as Cr } from "./PricingGroup-Czuhe81Z.js";
31
- import { P as vr } from "./PricingTable-BuLC0opK.js";
32
- import { P as yr } from "./PageHead-DgaJ1mXY.js";
33
- import { P as Br } from "./PageShell-D9EZiO8o.js";
34
- import { C as Lr, a as br } from "./ChatSplit-DNnu3TNq.js";
35
- import { C as Rr } from "./ChatFrame-BW2TmCkZ.js";
36
- import { C as Hr } from "./ChatMessages-B8rdXiK-.js";
37
- import { S as kr } from "./Sidebar-BgZiGEDH.js";
38
- import { P as Nr } from "./Popover-DWdvZTuA.js";
39
- import { H as Mr } from "./Healthmap-B6cdiLUl.js";
40
- import { P as Zr } from "./PanelInfo-A5y5ysH8.js";
41
- import { a as Dr, p as Er, r as qr } from "./overlayZ-BvHbYC1x.js";
23
+ import { A as ro, a as ao, i as eo } from "./Avatar-loGgFt72.js";
24
+ import { A as so } from "./AvatarGroup-D1gnT3Od.js";
25
+ import { A as mo } from "./AvatarName-0BzyfpMq.js";
26
+ import { B as fo } from "./Badge-jp-9iNNL.js";
27
+ import { B as io } from "./Brand-Zq-Idks4.js";
28
+ import { E as co } from "./EmptyState-mBiWtMIM.js";
29
+ import { R as So } from "./RadioGroup-fcXzhvMu.js";
30
+ import { P as Po } from "./PricingGroup-Czuhe81Z.js";
31
+ import { P as To } from "./PricingTable-BuLC0opK.js";
32
+ import { P as Io } from "./PageHead-DgaJ1mXY.js";
33
+ import { P as bo } from "./PageShell-D9EZiO8o.js";
34
+ import { C as Lo, a as ho } from "./ChatSplit-DNnu3TNq.js";
35
+ import { C as ko } from "./ChatFrame-BW2TmCkZ.js";
36
+ import { C as Ho } from "./ChatMessages-B8rdXiK-.js";
37
+ import { S as Fo } from "./Sidebar-CYFaPqdC.js";
38
+ import { P as zo } from "./Popover-DWdvZTuA.js";
39
+ import { H as Oo } from "./Healthmap-B6cdiLUl.js";
40
+ import { P as wo } from "./PanelInfo-A5y5ysH8.js";
41
+ import { T as Eo } from "./Table-BoDr3X2d.js";
42
+ import { C as jo } from "./CodeBlock-CRzVopIv.js";
43
+ import { S as Ko, c as Qo } from "./SplitPane-DR7PCZ8f.js";
44
+ import { B as Vo } from "./Banner-B72lcEMo.js";
45
+ import { I as Xo } from "./IconButton-DPjpBKJn.js";
46
+ import { a as _o, p as $o, r as or } from "./overlayZ-BvHbYC1x.js";
42
47
  import { lazy as e } from "react";
43
- import { c as Jr } from "./cx-CcykAxZN.js";
48
+ import { c as ar } from "./cx-CcykAxZN.js";
44
49
  function s(a) {
45
- const o = {};
46
- return (r) => (o[r] || (o[r] = e(() => a(r))), o[r]);
50
+ const r = {};
51
+ return (o) => (r[o] || (r[o] = e(() => a(o))), r[o]);
47
52
  }
48
53
  export {
49
- A as ActionGroup,
50
- or as Avatar,
51
- sr as AvatarGroup,
52
- mr as AvatarName,
53
- fr as Badge,
54
- k as Block,
55
- lr as Brand,
54
+ I as ActionGroup,
55
+ ro as Avatar,
56
+ so as AvatarGroup,
57
+ mo as AvatarName,
58
+ fo as Badge,
59
+ Vo as Banner,
60
+ g as Block,
61
+ io as Brand,
56
62
  K as Breadcrumb,
57
63
  T as Card,
58
- Rr as ChatFrame,
59
- Lr as ChatList,
60
- Hr as ChatMessages,
61
- br as ChatSplit,
64
+ ko as ChatFrame,
65
+ Lo as ChatList,
66
+ Ho as ChatMessages,
67
+ ho as ChatSplit,
68
+ jo as CodeBlock,
62
69
  M as Column,
63
70
  j as Dropdown,
64
- cr as EmptyState,
71
+ co as EmptyState,
65
72
  n as Footer,
66
- i as Header,
67
- Mr as Healthmap,
73
+ l as Header,
74
+ Oo as Healthmap,
75
+ Xo as IconButton,
68
76
  d as Item,
69
77
  P as ItemColumn,
70
78
  x as Layout,
@@ -72,29 +80,32 @@ export {
72
80
  U as Loading,
73
81
  E as Menu,
74
82
  Y as NavSections,
75
- yr as PageHead,
76
- Br as PageShell,
77
- Zr as PanelInfo,
78
- Nr as Popover,
79
- Cr as PricingGroup,
80
- vr as PricingTable,
81
- Sr as RadioGroup,
83
+ Io as PageHead,
84
+ bo as PageShell,
85
+ wo as PanelInfo,
86
+ zo as Popover,
87
+ Po as PricingGroup,
88
+ To as PricingTable,
89
+ So as RadioGroup,
82
90
  N as Row,
83
91
  W as Section,
84
- kr as Sidebar,
92
+ Fo as Sidebar,
93
+ Ko as SplitPane,
85
94
  Z as Stack,
86
- H as Stat,
95
+ G as Stat,
87
96
  $ as TabSections,
97
+ Eo as Table,
88
98
  R as TextGroup,
89
- I as Toolbar,
90
- Dr as acquireOverlayZIndex,
91
- L as applyToolbarSize,
92
- ar as avatarRadiusStyle,
99
+ b as Toolbar,
100
+ _o as acquireOverlayZIndex,
101
+ A as applyToolbarSize,
102
+ ao as avatarRadiusStyle,
103
+ Qo as clampSplitRatio,
93
104
  s as createLazyResolver,
94
- Jr as cx,
95
- er as initialsFromName,
96
- Er as peekOverlayZIndex,
97
- qr as releaseOverlayZIndex,
105
+ ar as cx,
106
+ eo as initialsFromName,
107
+ $o as peekOverlayZIndex,
108
+ or as releaseOverlayZIndex,
98
109
  w as stackColumnsTemplate,
99
- b as useToolbar
110
+ L as useToolbar
100
111
  };
@@ -0,0 +1,57 @@
1
+ function o(e, n, t = []) {
2
+ var u;
3
+ for (const a of e ?? [])
4
+ n(a, t), (u = a.items) != null && u.length && o(a.items, n, [...t, a.value]);
5
+ }
6
+ function f(e, n) {
7
+ for (const t of e)
8
+ o(t.items, n);
9
+ }
10
+ function r(e, n) {
11
+ if (n == null) return [];
12
+ let t = null;
13
+ return f(e, (u, a) => {
14
+ u.value === n && (t = a);
15
+ }), t ?? [];
16
+ }
17
+ function i(e, n, t) {
18
+ const u = new Set(n ?? []);
19
+ f(e, (a) => {
20
+ var l;
21
+ a.defaultOpen && ((l = a.items) != null && l.length) && u.add(a.value);
22
+ });
23
+ for (const a of r(e, t)) u.add(a);
24
+ return [...u];
25
+ }
26
+ function c(e, n) {
27
+ if (n == null) return !1;
28
+ let t = !1;
29
+ return f(e, (u) => {
30
+ var a;
31
+ u.value === n && ((a = u.items) != null && a.length) && (t = !0);
32
+ }), t;
33
+ }
34
+ function s(e) {
35
+ const n = [];
36
+ return f(e, (t) => {
37
+ var u;
38
+ !((u = t.items) != null && u.length) && !t.disabled && n.push(t);
39
+ }), n;
40
+ }
41
+ function d(e) {
42
+ var n;
43
+ return ((n = s(e)[0]) == null ? void 0 : n.value) ?? "";
44
+ }
45
+ function v(e) {
46
+ const n = [];
47
+ return f(e, (t) => {
48
+ t.disabled || n.push(t);
49
+ }), n;
50
+ }
51
+ export {
52
+ v as a,
53
+ r as b,
54
+ i as c,
55
+ d as f,
56
+ c as i
57
+ };
@@ -0,0 +1,33 @@
1
+ /** Узел дерева меню (Sidebar / NavSections). */
2
+ export type NavTreeNode = {
3
+ value: string;
4
+ items?: NavTreeNode[];
5
+ defaultOpen?: boolean;
6
+ disabled?: boolean;
7
+ };
8
+ export declare function walkNavTree<T extends NavTreeNode>(items: T[] | undefined, fn: (item: T, ancestors: string[]) => void, ancestors?: string[]): void;
9
+ export declare function walkNavGroups<T extends NavTreeNode>(groups: {
10
+ items?: T[];
11
+ }[], fn: (item: T, ancestors: string[]) => void): void;
12
+ /** Предки выбранного листа — ветку нужно раскрыть. */
13
+ export declare function findNavAncestors<T extends NavTreeNode>(groups: {
14
+ items?: T[];
15
+ }[], selected: string | undefined): string[];
16
+ /** Стартовый набор раскрытых: defaultOpen + extra + предки selected. */
17
+ export declare function collectNavDefaultOpen<T extends NavTreeNode>(groups: {
18
+ items?: T[];
19
+ }[], extra: string[] | undefined, selected: string | undefined): string[];
20
+ export declare function isNavParent<T extends NavTreeNode>(groups: {
21
+ items?: T[];
22
+ }[], value: string | undefined): boolean;
23
+ /** Листья без `items` (для панели / firstValue). */
24
+ export declare function flattenNavLeaves<T extends NavTreeNode>(groups: {
25
+ items?: T[];
26
+ }[]): T[];
27
+ export declare function firstNavLeafValue<T extends NavTreeNode>(groups: {
28
+ items?: T[];
29
+ }[]): string;
30
+ /** Все доступные пункты (родители + листья) — для клавиатуры. */
31
+ export declare function flattenNavEnabled<T extends NavTreeNode>(groups: {
32
+ items?: T[];
33
+ }[]): T[];
package/dist/tokens.css CHANGED
@@ -113,6 +113,7 @@
113
113
  --sidebar-item-padding: 6px 10px;
114
114
  --sidebar-icon-size: 16px;
115
115
  --sidebar-group-font-size: 11px;
116
+ --sidebar-indent: 14px;
116
117
 
117
118
  /* —— chat —— */
118
119
  --chat-list-width: 340px;
@@ -124,4 +125,32 @@
124
125
  --chat-messages-header-padding: 14px 16px;
125
126
  --chat-messages-body-padding: 16px 16px 20px;
126
127
  --chat-messages-footer-padding: 10px 12px 12px;
128
+
129
+ /* —— table —— */
130
+ --table-font-size: 0.9rem;
131
+ --table-cell-padding: 0.55rem 0.7rem;
132
+ --table-head-font-size: 0.75rem;
133
+ --table-code-font-size: 0.8rem;
134
+
135
+ /* —— code-block —— */
136
+ --code-block-bg: var(--shell-background);
137
+ --code-block-bar-padding: 0.4rem 0.75rem;
138
+ --code-block-padding: 0.85rem 1rem;
139
+ --code-block-font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
140
+ --code-block-font-size: 0.8rem;
141
+ --code-block-line-height: 1.55;
142
+
143
+ /* —— split-pane —— */
144
+ --split-handle-size: 6px;
145
+ --split-handle-bg: var(--shell-border);
146
+ --split-handle-bg-hover: color-mix(
147
+ in srgb,
148
+ var(--shell-color-accent) 25%,
149
+ var(--shell-border)
150
+ );
151
+
152
+ /* —— banner —— */
153
+ --banner-padding: 0.55rem 0.85rem;
154
+ --banner-bg: color-mix(in srgb, var(--shell-color-accent) 8%, var(--shell-bg));
155
+ --banner-border: color-mix(in srgb, var(--shell-color-accent) 35%, var(--shell-border));
127
156
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elcrm/components",
3
- "version": "0.2.9",
3
+ "version": "0.2.13",
4
4
  "description": "Shell UI elCRM: Layout, Header, Sidebar, Popover, Healthmap, PanelInfo, PageHead, PageShell, Section, Stack, Stat и др.",
5
5
  "type": "module",
6
6
  "author": "MaSkal <dev@elcrm.online>",
@@ -85,6 +85,9 @@
85
85
  "./package.json": "./package.json"
86
86
  },
87
87
  "peerDependencies": {
88
+ "@elcrm/button": "1.2.0",
89
+ "@elcrm/icons": "0.1.5",
90
+ "@elcrm/tooltip": "0.1.2",
88
91
  "@types/react": ">=18.0.0",
89
92
  "react": ">=18.0.0",
90
93
  "react-dom": ">=18.0.0"
@@ -1,79 +0,0 @@
1
- import a, { useMemo as h, Suspense as S } from "react";
2
- import { c as d } from "./cx-CcykAxZN.js";
3
- import { I as g } from "./Item-D4okhsfW.js";
4
- import { h as x } from "./rovingKeys-CGlfTtNQ.js";
5
- import { u as C } from "./useControllableValue-CWqH1kpM.js";
6
- import './NavSections.css';const I = "cvr", K = "cvn", M = "cvg", R = "cvl", V = "cvi", w = "cva", D = "cvc", P = "cvt", j = "cvf", q = "cvm", l = {
7
- r: I,
8
- n: K,
9
- g: M,
10
- l: R,
11
- i: V,
12
- a: w,
13
- c: D,
14
- t: P,
15
- f: j,
16
- m: q
17
- };
18
- function z(n) {
19
- for (const m of n) {
20
- const c = m.items.find((s) => !s.disabled);
21
- if (c) return c.value;
22
- }
23
- return "";
24
- }
25
- function J({
26
- groups: n,
27
- resolveSection: m,
28
- value: c,
29
- defaultValue: s,
30
- onValueChange: f,
31
- loading: b = null,
32
- footer: i,
33
- className: E,
34
- navLabel: N = "Разделы"
35
- }) {
36
- const p = h(
37
- () => s || z(n),
38
- [s, n]
39
- ), [r, v] = C(
40
- c,
41
- p,
42
- f
43
- ), k = n.flatMap((e) => e.items).filter((e) => !e.disabled).map((e) => e.value), u = r ? m(r) : null;
44
- return /* @__PURE__ */ a.createElement("div", { className: d(l.r, E) }, /* @__PURE__ */ a.createElement(
45
- "nav",
46
- {
47
- className: l.n,
48
- "aria-label": N,
49
- onKeyDown: (e) => x(e, {
50
- values: k,
51
- value: r,
52
- onSelect: v,
53
- vertical: !0
54
- })
55
- },
56
- n.map((e, y) => /* @__PURE__ */ a.createElement("div", { key: y, className: l.g }, e.label != null ? /* @__PURE__ */ a.createElement("div", { className: l.l }, e.label) : null, e.items.map((t) => {
57
- const o = t.value === r;
58
- return /* @__PURE__ */ a.createElement(
59
- g,
60
- {
61
- key: t.value,
62
- as: "button",
63
- active: o,
64
- className: d(l.i, o && l.a),
65
- "data-active": o ? "true" : void 0,
66
- "aria-current": o ? "page" : void 0,
67
- disabled: t.disabled,
68
- onClick: () => v(t.value)
69
- },
70
- t.icon != null ? /* @__PURE__ */ a.createElement("span", { className: l.c, "aria-hidden": !0 }, t.icon) : null,
71
- /* @__PURE__ */ a.createElement("span", { className: l.t }, t.label)
72
- );
73
- }))),
74
- i != null ? /* @__PURE__ */ a.createElement("div", { className: l.f }, i) : null
75
- ), /* @__PURE__ */ a.createElement("div", { className: l.m }, u ? /* @__PURE__ */ a.createElement(S, { fallback: b }, a.createElement(u)) : null));
76
- }
77
- export {
78
- J as N
79
- };
@@ -1,108 +0,0 @@
1
- import e from "react";
2
- import { B as h } from "./Badge-jp-9iNNL.js";
3
- import { D as w } from "./Dropdown-DosvDR13.js";
4
- import { I as y } from "./Item-D4okhsfW.js";
5
- import { b as C } from "./badgeText-CRzlIzi3.js";
6
- import { c as u } from "./cx-CcykAxZN.js";
7
- import './Sidebar.css';const q = "c2r", B = "c2b", D = "c2x", T = "c2g", z = "c2s", F = "c2p", I = "c2h", M = "c2n", R = "c2i", V = "c2a", $ = "c2o", j = "c2l", A = "c2d", G = "c2f", H = "c2q", J = "c2w", K = "c2u", L = "c2k", O = "c2v", l = {
8
- r: q,
9
- b: B,
10
- x: D,
11
- g: T,
12
- s: z,
13
- p: F,
14
- h: I,
15
- n: M,
16
- i: R,
17
- a: V,
18
- o: $,
19
- l: j,
20
- d: A,
21
- f: G,
22
- q: H,
23
- w: J,
24
- u: K,
25
- k: L,
26
- v: O
27
- };
28
- function P({ className: c }) {
29
- return /* @__PURE__ */ e.createElement("svg", { className: c, viewBox: "0 0 16 16", "aria-hidden": !0 }, /* @__PURE__ */ e.createElement("circle", { cx: "8", cy: "3", r: "1.3", fill: "currentColor" }), /* @__PURE__ */ e.createElement("circle", { cx: "8", cy: "8", r: "1.3", fill: "currentColor" }), /* @__PURE__ */ e.createElement("circle", { cx: "8", cy: "13", r: "1.3", fill: "currentColor" }));
30
- }
31
- function Q({
32
- footer: c,
33
- className: E,
34
- ...a
35
- }) {
36
- const r = /* @__PURE__ */ e.createElement(P, { className: l.k });
37
- if (e.isValidElement(c) && typeof c.type != "string") {
38
- const n = c.props;
39
- return e.cloneElement(c, {
40
- as: "button",
41
- extra: n.extra ?? r,
42
- className: u(n.className, E),
43
- ...a,
44
- onClick: (i) => {
45
- var m, t;
46
- (m = n.onClick) == null || m.call(n, i), (t = a.onClick) == null || t.call(a, i);
47
- }
48
- });
49
- }
50
- return /* @__PURE__ */ e.createElement("button", { type: "button", className: u(l.u, E), ...a }, /* @__PURE__ */ e.createElement("span", { className: l.w }, c), r);
51
- }
52
- function S({
53
- groups: c,
54
- items: E,
55
- value: a,
56
- onSelect: r,
57
- variant: n = "cards",
58
- brand: i,
59
- extra: m,
60
- footer: t,
61
- footerItems: d,
62
- onFooterSelect: v,
63
- footerMenuLabel: g = "Меню аккаунта",
64
- version: p,
65
- className: k,
66
- "aria-label": x = "Основное меню"
67
- }) {
68
- const f = c ?? E ?? [];
69
- return /* @__PURE__ */ e.createElement(
70
- "aside",
71
- {
72
- className: u(l.r, n === "plain" && l.p, k),
73
- "aria-label": x
74
- },
75
- i != null || m != null ? /* @__PURE__ */ e.createElement("div", { className: l.b }, i, m != null ? /* @__PURE__ */ e.createElement("div", { className: l.x }, m) : null) : null,
76
- /* @__PURE__ */ e.createElement("div", { className: l.g }, f.map((o) => /* @__PURE__ */ e.createElement("nav", { key: o.value, className: l.s, "aria-label": o.title ?? "Навигация" }, o.title ? /* @__PURE__ */ e.createElement("div", { className: l.h }, o.title) : null, /* @__PURE__ */ e.createElement("ul", { className: l.n }, (o.items ?? []).map((s) => {
77
- const b = C(s.badge), N = a === s.value;
78
- return /* @__PURE__ */ e.createElement("li", { key: s.value }, /* @__PURE__ */ e.createElement(
79
- y,
80
- {
81
- as: "button",
82
- active: N,
83
- className: u(l.i, N && l.a),
84
- "aria-current": N ? "page" : void 0,
85
- onClick: () => r == null ? void 0 : r(s.value)
86
- },
87
- s.icon != null ? /* @__PURE__ */ e.createElement("span", { className: l.o, "aria-hidden": !0 }, s.icon) : null,
88
- /* @__PURE__ */ e.createElement("span", { className: l.l }, s.label),
89
- b != null ? /* @__PURE__ */ e.createElement(h, { className: l.d, tone: "accent", size: "s" }, b) : null
90
- ));
91
- }))))),
92
- t != null || p != null ? /* @__PURE__ */ e.createElement("div", { className: u(l.s, l.f) }, t != null && d != null && d.length > 0 ? /* @__PURE__ */ e.createElement(
93
- w,
94
- {
95
- className: l.q,
96
- align: "start",
97
- placement: "top",
98
- label: g,
99
- trigger: /* @__PURE__ */ e.createElement(Q, { footer: t, className: l.w }),
100
- items: d,
101
- onSelect: v
102
- }
103
- ) : t, p != null ? /* @__PURE__ */ e.createElement("div", { className: l.v }, p) : null) : null
104
- );
105
- }
106
- export {
107
- S
108
- };