@octohirono/stitch-design-system 0.2.0 → 0.3.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/components/ChatFile/ChatFile.d.ts +34 -0
- package/dist/components/ChatFile/ChatFile.js +71 -0
- package/dist/components/ChatFile/chat-file.module.js +12 -0
- package/dist/components/ChatFile/index.d.ts +2 -0
- package/dist/components/ChatImage/ChatImage.d.ts +31 -0
- package/dist/components/ChatImage/ChatImage.js +88 -0
- package/dist/components/ChatImage/chat-image.module.js +12 -0
- package/dist/components/ChatImage/index.d.ts +2 -0
- package/dist/components/ChatInput/ChatInput.d.ts +77 -0
- package/dist/components/ChatInput/ChatInput.js +88 -0
- package/dist/components/ChatInput/chat-input.module.js +11 -0
- package/dist/components/ChatInput/index.d.ts +2 -0
- package/dist/components/ChatList/ChatList.d.ts +58 -0
- package/dist/components/ChatList/ChatList.js +49 -0
- package/dist/components/ChatList/chat-list.module.js +7 -0
- package/dist/components/ChatList/index.d.ts +2 -0
- package/dist/components/ChatMessage/ChatMessage.d.ts +52 -0
- package/dist/components/ChatMessage/ChatMessage.js +71 -0
- package/dist/components/ChatMessage/chat-message.module.js +21 -0
- package/dist/components/ChatMessage/index.d.ts +2 -0
- package/dist/components/ChatMessageActions/ChatMessageActions.d.ts +40 -0
- package/dist/components/ChatMessageActions/ChatMessageActions.js +34 -0
- package/dist/components/ChatMessageActions/chat-message-actions.module.js +7 -0
- package/dist/components/ChatMessageActions/index.d.ts +2 -0
- package/dist/components/ChatVoice/ChatVoice.d.ts +39 -0
- package/dist/components/ChatVoice/ChatVoice.js +44 -0
- package/dist/components/ChatVoice/chat-voice.module.js +12 -0
- package/dist/components/ChatVoice/index.d.ts +2 -0
- package/dist/components/ContextMenu/ContextMenu.js +41 -34
- package/dist/components/ContextMenu/context-menu.module.js +10 -9
- package/dist/components/DropdownMenu/DropdownMenu.js +45 -38
- package/dist/components/DropdownMenu/dropdown-menu.module.js +10 -9
- package/dist/components/Icon/Icon.d.ts +20 -0
- package/dist/components/Icon/Icon.js +35 -2
- package/dist/components/Image/Image.js +1 -1
- package/dist/components/Image/image.module.js +14 -14
- package/dist/components/Select/Select.js +87 -83
- package/dist/components/Select/select.module.js +10 -9
- package/dist/components/TypingIndicator/TypingIndicator.d.ts +24 -0
- package/dist/components/TypingIndicator/TypingIndicator.js +29 -0
- package/dist/components/TypingIndicator/index.d.ts +2 -0
- package/dist/components/TypingIndicator/typing-indicator.module.js +8 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +36 -28
- package/dist/style.css +873 -411
- package/package.json +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Icon as e } from "../Icon/Icon.js";
|
|
2
|
+
import t from "./chat-message.module.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import n from "clsx";
|
|
5
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
//#region packages/react/src/components/ChatMessage/ChatMessage.tsx
|
|
7
|
+
var o = {
|
|
8
|
+
sent: "已发送",
|
|
9
|
+
delivered: "已送达",
|
|
10
|
+
read: "已读"
|
|
11
|
+
}, s = /(\p{Extended_Pictographic}(️||[\u{1F3FB}-\u{1F3FF}])*)/gu;
|
|
12
|
+
function c(e) {
|
|
13
|
+
if (typeof e != "string") return !1;
|
|
14
|
+
let t = e.trim();
|
|
15
|
+
if (!t) return !1;
|
|
16
|
+
let n = t.match(s);
|
|
17
|
+
return n ? t.replace(s, "").trim() === "" && n.length <= 3 : !1;
|
|
18
|
+
}
|
|
19
|
+
var l = ({ variant: s = "received", content: l, children: u, avatar: d, time: f, status: p, grouped: m = !1, className: h, style: g }) => {
|
|
20
|
+
let _ = l ?? u, v = s === "system", y = !v && c(_), b = n(t.message, t[`variant-${s}`], m && t["is-grouped"], y && t["is-emoji"], h);
|
|
21
|
+
if (v) return /* @__PURE__ */ a("div", {
|
|
22
|
+
className: b,
|
|
23
|
+
style: g,
|
|
24
|
+
children: [/* @__PURE__ */ i("div", {
|
|
25
|
+
className: t.system,
|
|
26
|
+
children: _
|
|
27
|
+
}), f != null && /* @__PURE__ */ i("div", {
|
|
28
|
+
className: t.time,
|
|
29
|
+
children: f
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
let x = s === "sent" && p != null, S = p === "sent" ? 1 : 2, C = d != null, w = f != null || x ? /* @__PURE__ */ a(r, { children: [f != null && /* @__PURE__ */ i("span", {
|
|
33
|
+
className: t.time,
|
|
34
|
+
children: f
|
|
35
|
+
}), x && p != null && /* @__PURE__ */ i("span", {
|
|
36
|
+
className: n(t.ticks, p === "read" && t["ticks-read"]),
|
|
37
|
+
role: "img",
|
|
38
|
+
"aria-label": o[p],
|
|
39
|
+
children: Array.from({ length: S }).map((n, r) => /* @__PURE__ */ i(e, {
|
|
40
|
+
name: "check",
|
|
41
|
+
size: "1em",
|
|
42
|
+
className: t.tick
|
|
43
|
+
}, r))
|
|
44
|
+
})] }) : null;
|
|
45
|
+
return /* @__PURE__ */ a("div", {
|
|
46
|
+
className: b,
|
|
47
|
+
style: g,
|
|
48
|
+
children: [C && /* @__PURE__ */ i("div", {
|
|
49
|
+
className: t["avatar-slot"],
|
|
50
|
+
children: !m && d
|
|
51
|
+
}), /* @__PURE__ */ i("div", {
|
|
52
|
+
className: t.body,
|
|
53
|
+
children: y ? /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i("div", {
|
|
54
|
+
className: t.emoji,
|
|
55
|
+
children: _
|
|
56
|
+
}), w && /* @__PURE__ */ i("div", {
|
|
57
|
+
className: t["meta-below"],
|
|
58
|
+
children: w
|
|
59
|
+
})] }) : /* @__PURE__ */ a("div", {
|
|
60
|
+
className: t.bubble,
|
|
61
|
+
children: [_, w && /* @__PURE__ */ i("span", {
|
|
62
|
+
className: t.meta,
|
|
63
|
+
children: w
|
|
64
|
+
})]
|
|
65
|
+
})
|
|
66
|
+
})]
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
l.displayName = "ChatMessage";
|
|
70
|
+
//#endregion
|
|
71
|
+
export { l as ChatMessage };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region packages/react/src/components/ChatMessage/chat-message.module.less
|
|
2
|
+
var e = "_message_di477_1", t = "_body_di477_30", n = "_bubble_di477_39", r = "_emoji_di477_63", i = "_system_di477_67", a = "_meta_di477_75", o = "_time_di477_94", s = "_ticks_di477_97", c = "_tick_di477_97", l = {
|
|
3
|
+
message: e,
|
|
4
|
+
"variant-received": "_variant-received_di477_10",
|
|
5
|
+
"variant-sent": "_variant-sent_di477_14",
|
|
6
|
+
"variant-system": "_variant-system_di477_18",
|
|
7
|
+
"avatar-slot": "_avatar-slot_di477_24",
|
|
8
|
+
body: t,
|
|
9
|
+
bubble: n,
|
|
10
|
+
emoji: r,
|
|
11
|
+
system: i,
|
|
12
|
+
meta: a,
|
|
13
|
+
"meta-below": "_meta-below_di477_76",
|
|
14
|
+
time: o,
|
|
15
|
+
ticks: s,
|
|
16
|
+
tick: c,
|
|
17
|
+
"ticks-read": "_ticks-read_di477_105",
|
|
18
|
+
"is-grouped": "_is-grouped_di477_108"
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { t as body, n as bubble, l as default, r as emoji, e as message, a as meta, i as system, c as tick, s as ticks, o as time };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type DropdownMenuItem } from '../DropdownMenu';
|
|
3
|
+
/**
|
|
4
|
+
* 一条消息操作项。结构与 `DropdownMenuItem` / `ContextMenuItem` 完全一致(同一心智,
|
|
5
|
+
* 同 Ant v5 `items` 形态),因为它原样喂给这两个复用件。
|
|
6
|
+
*/
|
|
7
|
+
export type ChatMessageAction = DropdownMenuItem;
|
|
8
|
+
/**
|
|
9
|
+
* 消息操作菜单:把一条消息(`children`,通常是 `<ChatMessage>`)包成「右键 / 长按出操作」。
|
|
10
|
+
* 本组件只出**触发 + 菜单壳**——动作项(回复 / 撤回 / 转发…)与回调全由 app 经 `actions` 传入。
|
|
11
|
+
* 不另造浮层:**指针路**用 `ContextMenu`——桌面右键、触屏长按目标区弹出(即时通讯惯例,无常驻按钮);
|
|
12
|
+
* **键盘路**用 `DropdownMenu`——尾角触发钮仅在键盘聚焦时显形、Enter 打开。两路喂同一份 `actions`。
|
|
13
|
+
*
|
|
14
|
+
* 跨-prop 注意事项:
|
|
15
|
+
* - **两路触发、一份动作**:`actions` 同时喂给 `ContextMenu`(右键 / 长按,指针主入口)与
|
|
16
|
+
* `DropdownMenu`(键盘聚焦露钮点开);app 只需配一份。每项 `{ label, icon?, onClick?, danger?,
|
|
17
|
+
* disabled?, children? }` 取 Ant v5 `items` 惯例,点项触发 `item.onClick`(动作语义、无选中态)。
|
|
18
|
+
* - **组件只出壳**:不持菜单开合 state、不判相邻、不接业务——回调交 app(`actions[].onClick`);
|
|
19
|
+
* 图标走 `<Icon>`(项 `icon` 由底层复用件经 `<Icon>` 渲染,禁裸 svg / emoji / Unicode 符号)。
|
|
20
|
+
* - **无常驻 hover 按钮**:指针用户走右键 / 长按,尾角触发钮**只在键盘聚焦(`:focus-visible`)**时显形、
|
|
21
|
+
* 不随 hover 出现(避免气泡上常驻钮),仅为保证键盘可达;无可见文字 → 走 `triggerLabel` 给可及名
|
|
22
|
+
* (默认「消息操作」)。
|
|
23
|
+
* - **键盘 / 焦点 / ARIA**(方向键走项、Enter 选中、Esc 关、焦点归还、`role="menu"`)由复用件
|
|
24
|
+
* (ContextMenu / DropdownMenu → 底层)保证,本组件不重复实现。
|
|
25
|
+
*/
|
|
26
|
+
export interface ChatMessageActionsProps {
|
|
27
|
+
/** 被包裹的消息(通常是 `<ChatMessage>`):hover / 长按此区出操作入口 */
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
/** 动作项数组(Ant v5 `items` 风格,原样喂给 DropdownMenu / ContextMenu) */
|
|
30
|
+
actions: ChatMessageAction[];
|
|
31
|
+
/** 触发钮的无障碍标签(无可见文字时的可及名) @default '消息操作' */
|
|
32
|
+
triggerLabel?: string;
|
|
33
|
+
/** 菜单显隐变化回调(两路共用) */
|
|
34
|
+
onOpenChange?: (open: boolean) => void;
|
|
35
|
+
/** 自定义类名(挂到根容器) */
|
|
36
|
+
className?: string;
|
|
37
|
+
/** 行内样式(挂到根容器) */
|
|
38
|
+
style?: React.CSSProperties;
|
|
39
|
+
}
|
|
40
|
+
export declare const ChatMessageActions: React.FC<ChatMessageActionsProps>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Icon as e } from "../Icon/Icon.js";
|
|
2
|
+
import { DropdownMenu as t } from "../DropdownMenu/DropdownMenu.js";
|
|
3
|
+
import { ContextMenu as n } from "../ContextMenu/ContextMenu.js";
|
|
4
|
+
import r from "./chat-message-actions.module.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import i from "clsx";
|
|
7
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
8
|
+
//#region packages/react/src/components/ChatMessageActions/ChatMessageActions.tsx
|
|
9
|
+
var s = ({ children: s, actions: c, triggerLabel: l = "消息操作", onOpenChange: u, className: d, style: f }) => /* @__PURE__ */ a(n, {
|
|
10
|
+
items: c,
|
|
11
|
+
onOpenChange: u,
|
|
12
|
+
children: /* @__PURE__ */ o("div", {
|
|
13
|
+
className: i(r.wrap, d),
|
|
14
|
+
style: f,
|
|
15
|
+
children: [s, /* @__PURE__ */ a(t, {
|
|
16
|
+
items: c,
|
|
17
|
+
onOpenChange: u,
|
|
18
|
+
"aria-label": l,
|
|
19
|
+
trigger: /* @__PURE__ */ a("button", {
|
|
20
|
+
type: "button",
|
|
21
|
+
className: r.trigger,
|
|
22
|
+
"aria-label": l,
|
|
23
|
+
children: /* @__PURE__ */ a(e, {
|
|
24
|
+
name: "chevron-down",
|
|
25
|
+
size: "1em",
|
|
26
|
+
"aria-hidden": !0
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
})]
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
s.displayName = "ChatMessageActions";
|
|
33
|
+
//#endregion
|
|
34
|
+
export { s as ChatMessageActions };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 语音消息(手绘静态波形):播放按钮(`<Button>` + `<Icon play/pause>`)+ 一排高低不等的
|
|
4
|
+
* 波形小条 + 时长;作为 `<ChatMessage>` 的 `content` 塞入(sent / received 两侧皆可)。
|
|
5
|
+
* 组件**不解码音频**——波形振幅数组 `waveform` 由 app 传入。无 Ant 对应件 → 播放态取
|
|
6
|
+
* Ant v5 `open` / `onOpenChange` 惯例(`playing` / `onPlayingChange`)、播放进度取 Ant
|
|
7
|
+
* `percent` 惯例,均不自创。
|
|
8
|
+
*
|
|
9
|
+
* 跨-prop 注意事项:
|
|
10
|
+
* - **波形柱是角色变量小元素、非内联 `<svg>`**:每根柱一个 `<div>`,高度按 `waveform` 振幅
|
|
11
|
+
* (`0…1`)由内联 `height` 百分比驱动(几何数据、非颜色);颜色只走角色变量类——已播段
|
|
12
|
+
* `--stitch-accent`、未播段 `--stitch-border`,切站换肤跟随。
|
|
13
|
+
* - **`percent` 划已播 / 未播**:`0…100`,按柱序比例染色(前 `percent%` 的柱 = 已播 accent)。
|
|
14
|
+
* - **`playing` 切图标、`onPlayingChange` 交 app**:受控播放态(app 翻转 `playing`);播放按钮
|
|
15
|
+
* 带可访问名(播放语音 / 暂停语音),波形本体装饰性 `aria-hidden`。
|
|
16
|
+
*/
|
|
17
|
+
export interface ChatVoiceProps {
|
|
18
|
+
/** 波形振幅数组(`0…1`,由 app 传入;组件不解码音频) */
|
|
19
|
+
waveform: number[];
|
|
20
|
+
/** 时长文本(如 `0:12`) */
|
|
21
|
+
duration?: React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* 已播进度(`0…100`):前 `percent%` 的波形柱染为已播色(accent)
|
|
24
|
+
* @default 0
|
|
25
|
+
*/
|
|
26
|
+
percent?: number;
|
|
27
|
+
/**
|
|
28
|
+
* 是否播放中:切换播放 / 暂停图标
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
playing?: boolean;
|
|
32
|
+
/** 点击播放按钮的回调(播放 / 暂停交 app) */
|
|
33
|
+
onPlayingChange?: (playing: boolean) => void;
|
|
34
|
+
/** 自定义类名(挂到根容器) */
|
|
35
|
+
className?: string;
|
|
36
|
+
/** 行内样式(挂到根容器) */
|
|
37
|
+
style?: React.CSSProperties;
|
|
38
|
+
}
|
|
39
|
+
export declare const ChatVoice: React.FC<ChatVoiceProps>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Button as e } from "../Button/Button.js";
|
|
2
|
+
import { Icon as t } from "../Icon/Icon.js";
|
|
3
|
+
import n from "./chat-voice.module.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import r from "clsx";
|
|
6
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
+
//#region packages/react/src/components/ChatVoice/ChatVoice.tsx
|
|
8
|
+
var o = ({ waveform: o, duration: s, percent: c = 0, playing: l = !1, onPlayingChange: u, className: d, style: f }) => {
|
|
9
|
+
let p = o.length, m = Math.round(Math.min(100, Math.max(0, c)) / 100 * p);
|
|
10
|
+
return /* @__PURE__ */ a("div", {
|
|
11
|
+
className: r(n.voice, d),
|
|
12
|
+
style: f,
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ i(e, {
|
|
15
|
+
type: "primary",
|
|
16
|
+
className: n.play,
|
|
17
|
+
onClick: () => u?.(!l),
|
|
18
|
+
"aria-label": l ? "暂停语音" : "播放语音",
|
|
19
|
+
icon: /* @__PURE__ */ i(t, {
|
|
20
|
+
name: l ? "pause" : "play",
|
|
21
|
+
size: "1.125em"
|
|
22
|
+
})
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ i("div", {
|
|
25
|
+
className: n.wave,
|
|
26
|
+
"aria-hidden": "true",
|
|
27
|
+
children: o.map((e, t) => {
|
|
28
|
+
let a = Math.max(.15, Math.min(1, e)) * 100;
|
|
29
|
+
return /* @__PURE__ */ i("div", {
|
|
30
|
+
className: r(n.bar, t < m ? n["bar-played"] : n["bar-idle"]),
|
|
31
|
+
style: { height: `${a}%` }
|
|
32
|
+
}, t);
|
|
33
|
+
})
|
|
34
|
+
}),
|
|
35
|
+
s != null && /* @__PURE__ */ i("span", {
|
|
36
|
+
className: n.duration,
|
|
37
|
+
children: s
|
|
38
|
+
})
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
o.displayName = "ChatVoice";
|
|
43
|
+
//#endregion
|
|
44
|
+
export { o as ChatVoice };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region packages/react/src/components/ChatVoice/chat-voice.module.less
|
|
2
|
+
var e = "_voice_16mxc_1", t = "_play_16mxc_7", n = "_wave_16mxc_14", r = "_bar_16mxc_22", i = "_duration_16mxc_34", a = {
|
|
3
|
+
voice: e,
|
|
4
|
+
play: t,
|
|
5
|
+
wave: n,
|
|
6
|
+
bar: r,
|
|
7
|
+
"bar-played": "_bar-played_16mxc_28",
|
|
8
|
+
"bar-idle": "_bar-idle_16mxc_31",
|
|
9
|
+
duration: i
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { r as bar, a as default, i as duration, t as play, e as voice, n as wave };
|
|
@@ -1,50 +1,57 @@
|
|
|
1
1
|
import { Icon as e } from "../Icon/Icon.js";
|
|
2
|
-
import t from "
|
|
2
|
+
import { ScrollArea as t } from "../ScrollArea/ScrollArea.js";
|
|
3
|
+
import n from "./context-menu.module.js";
|
|
3
4
|
import "react";
|
|
4
|
-
import
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { ContextMenu as
|
|
5
|
+
import r from "clsx";
|
|
6
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
import { ContextMenu as s } from "radix-ui";
|
|
7
8
|
//#region packages/react/src/components/ContextMenu/ContextMenu.tsx
|
|
8
|
-
function
|
|
9
|
-
return
|
|
10
|
-
let
|
|
11
|
-
name:
|
|
9
|
+
function c(l, u = "") {
|
|
10
|
+
return l.map((l, d) => {
|
|
11
|
+
let f = `${u}${d}`, p = /* @__PURE__ */ o(i, { children: [l.icon && /* @__PURE__ */ a(e, {
|
|
12
|
+
name: l.icon,
|
|
12
13
|
size: "1em",
|
|
13
|
-
className:
|
|
14
|
-
}), /* @__PURE__ */
|
|
15
|
-
className:
|
|
16
|
-
children:
|
|
14
|
+
className: n.itemIcon
|
|
15
|
+
}), /* @__PURE__ */ a("span", {
|
|
16
|
+
className: n.itemLabel,
|
|
17
|
+
children: l.label
|
|
17
18
|
})] });
|
|
18
|
-
return
|
|
19
|
-
className: n
|
|
20
|
-
disabled:
|
|
21
|
-
children: [
|
|
19
|
+
return l.children && l.children.length > 0 ? /* @__PURE__ */ o(s.Sub, { children: [/* @__PURE__ */ o(s.SubTrigger, {
|
|
20
|
+
className: r(n.item, l.danger && n.danger),
|
|
21
|
+
disabled: l.disabled,
|
|
22
|
+
children: [p, /* @__PURE__ */ a(e, {
|
|
22
23
|
name: "chevron-right",
|
|
23
24
|
size: "1em",
|
|
24
|
-
className:
|
|
25
|
+
className: n.subArrow
|
|
25
26
|
})]
|
|
26
|
-
}), /* @__PURE__ */
|
|
27
|
-
className:
|
|
27
|
+
}), /* @__PURE__ */ a(s.Portal, { children: /* @__PURE__ */ a(s.SubContent, {
|
|
28
|
+
className: n.content,
|
|
28
29
|
sideOffset: 8,
|
|
29
|
-
children:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
children: /* @__PURE__ */ a(t, {
|
|
31
|
+
className: n.scroll,
|
|
32
|
+
children: c(l.children, `${f}-`)
|
|
33
|
+
})
|
|
34
|
+
}) })] }, f) : /* @__PURE__ */ a(s.Item, {
|
|
35
|
+
className: r(n.item, l.danger && n.danger),
|
|
36
|
+
disabled: l.disabled,
|
|
37
|
+
onSelect: l.onClick,
|
|
38
|
+
children: p
|
|
39
|
+
}, f);
|
|
36
40
|
});
|
|
37
41
|
}
|
|
38
|
-
var
|
|
39
|
-
onOpenChange:
|
|
40
|
-
children: [/* @__PURE__ */
|
|
42
|
+
var l = ({ children: e, items: i, onOpenChange: l, className: u }) => /* @__PURE__ */ o(s.Root, {
|
|
43
|
+
onOpenChange: l,
|
|
44
|
+
children: [/* @__PURE__ */ a(s.Trigger, {
|
|
41
45
|
asChild: !0,
|
|
42
46
|
children: e
|
|
43
|
-
}), /* @__PURE__ */
|
|
44
|
-
className: n
|
|
45
|
-
children:
|
|
47
|
+
}), /* @__PURE__ */ a(s.Portal, { children: /* @__PURE__ */ a(s.Content, {
|
|
48
|
+
className: r(n.content, u),
|
|
49
|
+
children: /* @__PURE__ */ a(t, {
|
|
50
|
+
className: n.scroll,
|
|
51
|
+
children: c(i)
|
|
52
|
+
})
|
|
46
53
|
}) })]
|
|
47
54
|
});
|
|
48
|
-
|
|
55
|
+
l.displayName = "ContextMenu";
|
|
49
56
|
//#endregion
|
|
50
|
-
export {
|
|
57
|
+
export { l as ContextMenu };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
//#region packages/react/src/components/ContextMenu/context-menu.module.less
|
|
2
|
-
var e = "
|
|
2
|
+
var e = "_content_1dpag_1", t = "_scroll_1dpag_21", n = "_item_1dpag_27", r = "_danger_1dpag_47", i = "_itemIcon_1dpag_54", a = "_itemLabel_1dpag_58", o = "_subArrow_1dpag_61", s = {
|
|
3
3
|
content: e,
|
|
4
|
-
"stitch-context-menu-in": "_stitch-context-menu-
|
|
5
|
-
"stitch-context-menu-out": "_stitch-context-menu-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
"stitch-context-menu-in": "_stitch-context-menu-in_1dpag_1",
|
|
5
|
+
"stitch-context-menu-out": "_stitch-context-menu-out_1dpag_1",
|
|
6
|
+
scroll: t,
|
|
7
|
+
item: n,
|
|
8
|
+
danger: r,
|
|
9
|
+
itemIcon: i,
|
|
10
|
+
itemLabel: a,
|
|
11
|
+
subArrow: o
|
|
11
12
|
};
|
|
12
13
|
//#endregion
|
|
13
|
-
export { e as content,
|
|
14
|
+
export { e as content, r as danger, s as default, n as item, i as itemIcon, a as itemLabel, t as scroll, o as subArrow };
|
|
@@ -1,54 +1,61 @@
|
|
|
1
1
|
import { Icon as e } from "../Icon/Icon.js";
|
|
2
|
-
import t from "
|
|
2
|
+
import { ScrollArea as t } from "../ScrollArea/ScrollArea.js";
|
|
3
|
+
import n from "./dropdown-menu.module.js";
|
|
3
4
|
import "react";
|
|
4
|
-
import
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { DropdownMenu as
|
|
5
|
+
import r from "clsx";
|
|
6
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
import { DropdownMenu as s } from "radix-ui";
|
|
7
8
|
//#region packages/react/src/components/DropdownMenu/DropdownMenu.tsx
|
|
8
|
-
function
|
|
9
|
-
return
|
|
10
|
-
let
|
|
11
|
-
name:
|
|
9
|
+
function c(l, u = "") {
|
|
10
|
+
return l.map((l, d) => {
|
|
11
|
+
let f = `${u}${d}`, p = /* @__PURE__ */ o(i, { children: [l.icon && /* @__PURE__ */ a(e, {
|
|
12
|
+
name: l.icon,
|
|
12
13
|
size: "1em",
|
|
13
|
-
className:
|
|
14
|
-
}), /* @__PURE__ */
|
|
15
|
-
className:
|
|
16
|
-
children:
|
|
14
|
+
className: n.itemIcon
|
|
15
|
+
}), /* @__PURE__ */ a("span", {
|
|
16
|
+
className: n.itemLabel,
|
|
17
|
+
children: l.label
|
|
17
18
|
})] });
|
|
18
|
-
return
|
|
19
|
-
className: n
|
|
20
|
-
disabled:
|
|
21
|
-
children: [
|
|
19
|
+
return l.children && l.children.length > 0 ? /* @__PURE__ */ o(s.Sub, { children: [/* @__PURE__ */ o(s.SubTrigger, {
|
|
20
|
+
className: r(n.item, l.danger && n.danger),
|
|
21
|
+
disabled: l.disabled,
|
|
22
|
+
children: [p, /* @__PURE__ */ a(e, {
|
|
22
23
|
name: "chevron-right",
|
|
23
24
|
size: "1em",
|
|
24
|
-
className:
|
|
25
|
+
className: n.subArrow
|
|
25
26
|
})]
|
|
26
|
-
}), /* @__PURE__ */
|
|
27
|
-
className:
|
|
27
|
+
}), /* @__PURE__ */ a(s.Portal, { children: /* @__PURE__ */ a(s.SubContent, {
|
|
28
|
+
className: n.content,
|
|
28
29
|
sideOffset: 8,
|
|
29
|
-
children:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
children: /* @__PURE__ */ a(t, {
|
|
31
|
+
className: n.scroll,
|
|
32
|
+
children: c(l.children, `${f}-`)
|
|
33
|
+
})
|
|
34
|
+
}) })] }, f) : /* @__PURE__ */ a(s.Item, {
|
|
35
|
+
className: r(n.item, l.danger && n.danger),
|
|
36
|
+
disabled: l.disabled,
|
|
37
|
+
onSelect: l.onClick,
|
|
38
|
+
children: p
|
|
39
|
+
}, f);
|
|
36
40
|
});
|
|
37
41
|
}
|
|
38
|
-
var
|
|
39
|
-
open:
|
|
40
|
-
defaultOpen:
|
|
41
|
-
onOpenChange:
|
|
42
|
-
children: [/* @__PURE__ */
|
|
42
|
+
var l = ({ trigger: e, items: i, open: l, defaultOpen: u, onOpenChange: d, sideOffset: f = 8, className: p, "aria-label": m }) => /* @__PURE__ */ o(s.Root, {
|
|
43
|
+
open: l,
|
|
44
|
+
defaultOpen: u,
|
|
45
|
+
onOpenChange: d,
|
|
46
|
+
children: [/* @__PURE__ */ a(s.Trigger, {
|
|
43
47
|
asChild: !0,
|
|
44
|
-
"aria-label":
|
|
48
|
+
"aria-label": m,
|
|
45
49
|
children: e
|
|
46
|
-
}), /* @__PURE__ */
|
|
47
|
-
className: n
|
|
48
|
-
sideOffset:
|
|
49
|
-
children:
|
|
50
|
+
}), /* @__PURE__ */ a(s.Portal, { children: /* @__PURE__ */ a(s.Content, {
|
|
51
|
+
className: r(n.content, p),
|
|
52
|
+
sideOffset: f,
|
|
53
|
+
children: /* @__PURE__ */ a(t, {
|
|
54
|
+
className: n.scroll,
|
|
55
|
+
children: c(i)
|
|
56
|
+
})
|
|
50
57
|
}) })]
|
|
51
58
|
});
|
|
52
|
-
|
|
59
|
+
l.displayName = "DropdownMenu";
|
|
53
60
|
//#endregion
|
|
54
|
-
export {
|
|
61
|
+
export { l as DropdownMenu };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
//#region packages/react/src/components/DropdownMenu/dropdown-menu.module.less
|
|
2
|
-
var e = "
|
|
2
|
+
var e = "_content_6jxoc_1", t = "_scroll_6jxoc_21", n = "_item_6jxoc_27", r = "_danger_6jxoc_47", i = "_itemIcon_6jxoc_54", a = "_itemLabel_6jxoc_58", o = "_subArrow_6jxoc_61", s = {
|
|
3
3
|
content: e,
|
|
4
|
-
"stitch-dropdown-in": "_stitch-dropdown-
|
|
5
|
-
"stitch-dropdown-out": "_stitch-dropdown-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
"stitch-dropdown-in": "_stitch-dropdown-in_6jxoc_1",
|
|
5
|
+
"stitch-dropdown-out": "_stitch-dropdown-out_6jxoc_1",
|
|
6
|
+
scroll: t,
|
|
7
|
+
item: n,
|
|
8
|
+
danger: r,
|
|
9
|
+
itemIcon: i,
|
|
10
|
+
itemLabel: a,
|
|
11
|
+
subArrow: o
|
|
11
12
|
};
|
|
12
13
|
//#endregion
|
|
13
|
-
export { e as content,
|
|
14
|
+
export { e as content, r as danger, s as default, n as item, i as itemIcon, a as itemLabel, t as scroll, o as subArrow };
|
|
@@ -23,6 +23,11 @@ declare const ICON_PATHS: {
|
|
|
23
23
|
readonly 'align-right': readonly ["M4 6h16", "M10 12h10", "M7 18h13"];
|
|
24
24
|
readonly 'arrow-up-right': readonly ["M7 17L17 7", "M8 7h9v9"];
|
|
25
25
|
readonly 'arrow-down-right': readonly ["M7 7L17 17", "M17 8v9H8"];
|
|
26
|
+
readonly send: readonly ["M22 2L11 13", "M22 2L15 22 11 13 2 9z"];
|
|
27
|
+
readonly play: readonly ["M8 5v14l11-7z"];
|
|
28
|
+
readonly pause: readonly ["M8 5h3v14H8z", "M13 5h3v14h-3z"];
|
|
29
|
+
readonly file: readonly ["M13 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9z", "M13 3v6h6"];
|
|
30
|
+
readonly download: readonly ["M12 4v11", "M8 11l4 4 4-4", "M5 20h14"];
|
|
26
31
|
};
|
|
27
32
|
export type IconName = keyof typeof ICON_PATHS;
|
|
28
33
|
/**
|
|
@@ -112,5 +117,20 @@ export declare const ICON_LIST: readonly [{
|
|
|
112
117
|
}, {
|
|
113
118
|
readonly name: 'arrow-down-right';
|
|
114
119
|
readonly label: 'Trend down';
|
|
120
|
+
}, {
|
|
121
|
+
readonly name: 'send';
|
|
122
|
+
readonly label: 'Send';
|
|
123
|
+
}, {
|
|
124
|
+
readonly name: 'play';
|
|
125
|
+
readonly label: 'Play';
|
|
126
|
+
}, {
|
|
127
|
+
readonly name: 'pause';
|
|
128
|
+
readonly label: 'Pause';
|
|
129
|
+
}, {
|
|
130
|
+
readonly name: 'file';
|
|
131
|
+
readonly label: 'File';
|
|
132
|
+
}, {
|
|
133
|
+
readonly name: 'download';
|
|
134
|
+
readonly label: 'Download';
|
|
115
135
|
}];
|
|
116
136
|
export {};
|
|
@@ -68,8 +68,21 @@ var r = {
|
|
|
68
68
|
"M7 18h13"
|
|
69
69
|
],
|
|
70
70
|
"arrow-up-right": ["M7 17L17 7", "M8 7h9v9"],
|
|
71
|
-
"arrow-down-right": ["M7 7L17 17", "M17 8v9H8"]
|
|
72
|
-
|
|
71
|
+
"arrow-down-right": ["M7 7L17 17", "M17 8v9H8"],
|
|
72
|
+
send: ["M22 2L11 13", "M22 2L15 22 11 13 2 9z"],
|
|
73
|
+
play: ["M8 5v14l11-7z"],
|
|
74
|
+
pause: ["M8 5h3v14H8z", "M13 5h3v14h-3z"],
|
|
75
|
+
file: ["M13 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9z", "M13 3v6h6"],
|
|
76
|
+
download: [
|
|
77
|
+
"M12 4v11",
|
|
78
|
+
"M8 11l4 4 4-4",
|
|
79
|
+
"M5 20h14"
|
|
80
|
+
]
|
|
81
|
+
}, i = /* @__PURE__ */ new Set([
|
|
82
|
+
"dot",
|
|
83
|
+
"play",
|
|
84
|
+
"pause"
|
|
85
|
+
]), a = ({ name: a, src: o, size: s = 24, label: c, strokeWidth: l, className: u, style: d, ...f }) => {
|
|
73
86
|
let p = t(e.icon, u), m = c == null ? { "aria-hidden": !0 } : {
|
|
74
87
|
role: "img",
|
|
75
88
|
"aria-label": c
|
|
@@ -169,6 +182,26 @@ var o = [
|
|
|
169
182
|
{
|
|
170
183
|
name: "arrow-down-right",
|
|
171
184
|
label: "Trend down"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: "send",
|
|
188
|
+
label: "Send"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "play",
|
|
192
|
+
label: "Play"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "pause",
|
|
196
|
+
label: "Pause"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: "file",
|
|
200
|
+
label: "File"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: "download",
|
|
204
|
+
label: "Download"
|
|
172
205
|
}
|
|
173
206
|
];
|
|
174
207
|
//#endregion
|