wok-ui-ext 0.1.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.
Files changed (235) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +75 -0
  3. package/README.md +75 -0
  4. package/dist/alert/index.d.ts +10 -0
  5. package/dist/alert/index.js +48 -0
  6. package/dist/alert/style.css +116 -0
  7. package/dist/avatar/index.d.ts +9 -0
  8. package/dist/avatar/index.js +30 -0
  9. package/dist/avatar/style.css +32 -0
  10. package/dist/badge/index.d.ts +32 -0
  11. package/dist/badge/index.js +61 -0
  12. package/dist/badge/style.css +68 -0
  13. package/dist/breadcrumb/index.d.ts +25 -0
  14. package/dist/breadcrumb/index.js +47 -0
  15. package/dist/breadcrumb/style.css +35 -0
  16. package/dist/button/index.d.ts +34 -0
  17. package/dist/button/index.js +57 -0
  18. package/dist/button/style.css +133 -0
  19. package/dist/card/index.d.ts +25 -0
  20. package/dist/card/index.js +29 -0
  21. package/dist/card/style.css +23 -0
  22. package/dist/collapse/index.d.ts +89 -0
  23. package/dist/collapse/index.js +213 -0
  24. package/dist/collapse/style.css +76 -0
  25. package/dist/context-menu/context-menu.d.ts +113 -0
  26. package/dist/context-menu/context-menu.js +150 -0
  27. package/dist/context-menu/index.d.ts +30 -0
  28. package/dist/context-menu/index.js +42 -0
  29. package/dist/context-menu/style.css +46 -0
  30. package/dist/date-picker/calendar-panel.d.ts +44 -0
  31. package/dist/date-picker/calendar-panel.js +180 -0
  32. package/dist/date-picker/date-picker.d.ts +29 -0
  33. package/dist/date-picker/date-picker.js +81 -0
  34. package/dist/date-picker/date-utils.d.ts +63 -0
  35. package/dist/date-picker/date-utils.js +130 -0
  36. package/dist/date-picker/index.d.ts +7 -0
  37. package/dist/date-picker/index.js +5 -0
  38. package/dist/date-picker/layer.d.ts +19 -0
  39. package/dist/date-picker/layer.js +36 -0
  40. package/dist/date-picker/range-picker.d.ts +30 -0
  41. package/dist/date-picker/range-picker.js +117 -0
  42. package/dist/date-picker/style.css +161 -0
  43. package/dist/description-list/index.d.ts +37 -0
  44. package/dist/description-list/index.js +145 -0
  45. package/dist/description-list/style.css +63 -0
  46. package/dist/divider/index.d.ts +29 -0
  47. package/dist/divider/index.js +29 -0
  48. package/dist/divider/style.css +50 -0
  49. package/dist/drawer/index.d.ts +51 -0
  50. package/dist/drawer/index.js +183 -0
  51. package/dist/drawer/style.css +100 -0
  52. package/dist/dropdown/index.d.ts +38 -0
  53. package/dist/dropdown/index.js +97 -0
  54. package/dist/dropdown/style.css +39 -0
  55. package/dist/empty/index.d.ts +11 -0
  56. package/dist/empty/index.js +20 -0
  57. package/dist/empty/style.css +19 -0
  58. package/dist/floating-layer/index.d.ts +109 -0
  59. package/dist/floating-layer/index.js +337 -0
  60. package/dist/floating-layer/style.css +5 -0
  61. package/dist/form/form-item/index.d.ts +26 -0
  62. package/dist/form/form-item/index.js +21 -0
  63. package/dist/form/form-item/style.css +33 -0
  64. package/dist/form/form-modal/index.d.ts +18 -0
  65. package/dist/form/form-modal/index.js +38 -0
  66. package/dist/form/form.d.ts +21 -0
  67. package/dist/form/form.js +28 -0
  68. package/dist/form/index.d.ts +4 -0
  69. package/dist/form/index.js +4 -0
  70. package/dist/form/select/index.d.ts +48 -0
  71. package/dist/form/select/index.js +94 -0
  72. package/dist/form/select/style.css +29 -0
  73. package/dist/global.css +71 -0
  74. package/dist/i18n/de-DE.d.ts +2 -0
  75. package/dist/i18n/de-DE.js +36 -0
  76. package/dist/i18n/en-US.d.ts +2 -0
  77. package/dist/i18n/en-US.js +36 -0
  78. package/dist/i18n/es-ES.d.ts +2 -0
  79. package/dist/i18n/es-ES.js +36 -0
  80. package/dist/i18n/fr-FR.d.ts +2 -0
  81. package/dist/i18n/fr-FR.js +36 -0
  82. package/dist/i18n/index.d.ts +12 -0
  83. package/dist/i18n/index.js +39 -0
  84. package/dist/i18n/ja-JP.d.ts +2 -0
  85. package/dist/i18n/ja-JP.js +36 -0
  86. package/dist/i18n/ko-KR.d.ts +2 -0
  87. package/dist/i18n/ko-KR.js +36 -0
  88. package/dist/i18n/messages.d.ts +40 -0
  89. package/dist/i18n/messages.js +1 -0
  90. package/dist/i18n/wok-ui/de-DE.d.ts +2 -0
  91. package/dist/i18n/wok-ui/de-DE.js +20 -0
  92. package/dist/i18n/wok-ui/es-ES.d.ts +2 -0
  93. package/dist/i18n/wok-ui/es-ES.js +20 -0
  94. package/dist/i18n/wok-ui/fr-FR.d.ts +2 -0
  95. package/dist/i18n/wok-ui/fr-FR.js +20 -0
  96. package/dist/i18n/wok-ui/ja-JP.d.ts +2 -0
  97. package/dist/i18n/wok-ui/ja-JP.js +20 -0
  98. package/dist/i18n/wok-ui/ko-KR.d.ts +2 -0
  99. package/dist/i18n/wok-ui/ko-KR.js +20 -0
  100. package/dist/i18n/wok-ui/zh-TW.d.ts +2 -0
  101. package/dist/i18n/wok-ui/zh-TW.js +20 -0
  102. package/dist/i18n/zh-CN.d.ts +2 -0
  103. package/dist/i18n/zh-CN.js +36 -0
  104. package/dist/i18n/zh-TW.d.ts +2 -0
  105. package/dist/i18n/zh-TW.js +36 -0
  106. package/dist/icons.d.ts +88 -0
  107. package/dist/icons.js +176 -0
  108. package/dist/image/index.d.ts +38 -0
  109. package/dist/image/index.js +97 -0
  110. package/dist/image/style.css +72 -0
  111. package/dist/image-preview/index.d.ts +26 -0
  112. package/dist/image-preview/index.js +134 -0
  113. package/dist/image-preview/style.css +96 -0
  114. package/dist/index.d.ts +46 -0
  115. package/dist/index.js +45 -0
  116. package/dist/list/index.d.ts +32 -0
  117. package/dist/list/index.js +42 -0
  118. package/dist/list/list-item.d.ts +27 -0
  119. package/dist/list/list-item.js +51 -0
  120. package/dist/list/style.css +20 -0
  121. package/dist/loading/index.d.ts +10 -0
  122. package/dist/loading/index.js +46 -0
  123. package/dist/loading/style.css +48 -0
  124. package/dist/menu/index.d.ts +38 -0
  125. package/dist/menu/index.js +62 -0
  126. package/dist/menu/leaf-item.d.ts +12 -0
  127. package/dist/menu/leaf-item.js +41 -0
  128. package/dist/menu/style.css +117 -0
  129. package/dist/menu/sub-menu.d.ts +21 -0
  130. package/dist/menu/sub-menu.js +85 -0
  131. package/dist/menu/types.d.ts +36 -0
  132. package/dist/menu/types.js +1 -0
  133. package/dist/menu/utils.d.ts +11 -0
  134. package/dist/menu/utils.js +24 -0
  135. package/dist/modal/index.d.ts +23 -0
  136. package/dist/modal/index.js +79 -0
  137. package/dist/modal/modal.d.ts +76 -0
  138. package/dist/modal/modal.js +188 -0
  139. package/dist/modal/style.css +90 -0
  140. package/dist/pagination/index.d.ts +31 -0
  141. package/dist/pagination/index.js +215 -0
  142. package/dist/pagination/style.css +50 -0
  143. package/dist/popconfirm/api.d.ts +43 -0
  144. package/dist/popconfirm/api.js +77 -0
  145. package/dist/popconfirm/component.d.ts +47 -0
  146. package/dist/popconfirm/component.js +48 -0
  147. package/dist/popconfirm/index.d.ts +3 -0
  148. package/dist/popconfirm/index.js +3 -0
  149. package/dist/popconfirm/style.css +22 -0
  150. package/dist/popover/api.d.ts +36 -0
  151. package/dist/popover/api.js +61 -0
  152. package/dist/popover/component.d.ts +38 -0
  153. package/dist/popover/component.js +51 -0
  154. package/dist/popover/index.d.ts +3 -0
  155. package/dist/popover/index.js +3 -0
  156. package/dist/popover/style.css +102 -0
  157. package/dist/progress/index.d.ts +34 -0
  158. package/dist/progress/index.js +70 -0
  159. package/dist/progress/style.css +37 -0
  160. package/dist/quick-input/index.d.ts +2 -0
  161. package/dist/quick-input/index.js +2 -0
  162. package/dist/quick-input/number.d.ts +35 -0
  163. package/dist/quick-input/number.js +68 -0
  164. package/dist/quick-input/text.d.ts +20 -0
  165. package/dist/quick-input/text.js +61 -0
  166. package/dist/result/index.d.ts +39 -0
  167. package/dist/result/index.js +71 -0
  168. package/dist/result/style.css +41 -0
  169. package/dist/search-box/index.d.ts +26 -0
  170. package/dist/search-box/index.js +60 -0
  171. package/dist/search-box/style.css +22 -0
  172. package/dist/segmented/index.d.ts +42 -0
  173. package/dist/segmented/index.js +61 -0
  174. package/dist/segmented/style.css +28 -0
  175. package/dist/skeleton/index.d.ts +22 -0
  176. package/dist/skeleton/index.js +68 -0
  177. package/dist/skeleton/style.css +31 -0
  178. package/dist/steps/index.d.ts +46 -0
  179. package/dist/steps/index.js +95 -0
  180. package/dist/steps/style.css +181 -0
  181. package/dist/switch/index.d.ts +32 -0
  182. package/dist/switch/index.js +74 -0
  183. package/dist/switch/style.css +52 -0
  184. package/dist/table/body.d.ts +21 -0
  185. package/dist/table/body.js +35 -0
  186. package/dist/table/column.d.ts +78 -0
  187. package/dist/table/column.js +113 -0
  188. package/dist/table/header.d.ts +13 -0
  189. package/dist/table/header.js +15 -0
  190. package/dist/table/index.d.ts +41 -0
  191. package/dist/table/index.js +84 -0
  192. package/dist/table/row.d.ts +25 -0
  193. package/dist/table/row.js +74 -0
  194. package/dist/table/style.css +98 -0
  195. package/dist/tabs/index.d.ts +49 -0
  196. package/dist/tabs/index.js +76 -0
  197. package/dist/tabs/style.css +41 -0
  198. package/dist/tag/index.d.ts +53 -0
  199. package/dist/tag/index.js +100 -0
  200. package/dist/tag/style.css +134 -0
  201. package/dist/text/index.d.ts +104 -0
  202. package/dist/text/index.js +143 -0
  203. package/dist/text/style.css +113 -0
  204. package/dist/theme/index.d.ts +14 -0
  205. package/dist/theme/index.js +94 -0
  206. package/dist/theme/themes.d.ts +3 -0
  207. package/dist/theme/themes.js +323 -0
  208. package/dist/theme/types.d.ts +58 -0
  209. package/dist/theme/types.js +1 -0
  210. package/dist/timeline/index.d.ts +28 -0
  211. package/dist/timeline/index.js +35 -0
  212. package/dist/timeline/style.css +53 -0
  213. package/dist/toast/index.d.ts +53 -0
  214. package/dist/toast/index.js +131 -0
  215. package/dist/toast/style.css +76 -0
  216. package/dist/tooltip/api.d.ts +44 -0
  217. package/dist/tooltip/api.js +103 -0
  218. package/dist/tooltip/component.d.ts +28 -0
  219. package/dist/tooltip/component.js +35 -0
  220. package/dist/tooltip/index.d.ts +3 -0
  221. package/dist/tooltip/index.js +3 -0
  222. package/dist/tooltip/style.css +46 -0
  223. package/dist/tree/dragging-img.d.ts +13 -0
  224. package/dist/tree/dragging-img.js +23 -0
  225. package/dist/tree/index.d.ts +180 -0
  226. package/dist/tree/index.js +385 -0
  227. package/dist/tree/node-info.d.ts +63 -0
  228. package/dist/tree/node-info.js +128 -0
  229. package/dist/tree/node.d.ts +132 -0
  230. package/dist/tree/node.js +264 -0
  231. package/dist/tree/style.css +99 -0
  232. package/dist/upload/index.d.ts +48 -0
  233. package/dist/upload/index.js +141 -0
  234. package/dist/upload/style.css +41 -0
  235. package/package.json +51 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Peak Tai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,75 @@
1
+ # wok-ui-ext
2
+
3
+ [中文](README.md) | English
4
+
5
+ The extension component library of wok-ui, providing an enterprise-level high-frequency component library with a **tech-blue style + multi-theme** design.
6
+
7
+ Based on the wok-ui framework, wok-ui-ext comes with 6 built-in themes (Tech Blue, Deep Night, Vitality Orange, Mystery Purple, Forest Green, Flame Red) and extends 40+ commonly used components, ready to use out of the box — more suitable for enterprise projects.
8
+
9
+ ## Features
10
+
11
+ - **Multi-theme**: 6 built-in themes, switch with one line of code, all component styles follow automatically
12
+ - **Common Components**: form, table, modal, drawer, date picker, upload, tree, steps, timeline and 40+ high-frequency components
13
+ - **Customizable**: deep theme customization via CSS variables and `setTheme` to meet brand visual needs
14
+ - **Internationalization**: built-in multi-language support (Chinese, English, etc.), freely extensible
15
+
16
+ ## Getting Started
17
+
18
+ ### Installation
19
+
20
+ The project is based on wok-ui, please install it first:
21
+
22
+ ```bash
23
+ npm install wok-ui --save
24
+ ```
25
+
26
+ Then install wok-ui-ext:
27
+
28
+ ```bash
29
+ npm install wok-ui-ext --save
30
+ ```
31
+
32
+ ### Initialization
33
+
34
+ Using wok-ui-ext does not change the original wok-ui project flow; you only need to add internationalization and theme initialization:
35
+
36
+ ```ts
37
+ import { initWokUiExtI18n, applyTheme } from 'wok-ui-ext'
38
+
39
+ // Initialize wok-ui-ext internationalization (the language is applied automatically, no need to call wok-ui's setLang)
40
+ await initWokUiExtI18n('zh-CN')
41
+
42
+ // Apply theme, default is tech blue, optional: 'dark' | 'orange' | 'purple' | 'green' | 'red'
43
+ applyTheme('default')
44
+ ```
45
+
46
+ ### Switching Themes
47
+
48
+ ```ts
49
+ import { applyTheme } from 'wok-ui-ext'
50
+
51
+ applyTheme('orange') // switch to vitality orange
52
+ applyTheme('dark') // switch to deep night
53
+ ```
54
+
55
+ ## Documentation
56
+
57
+ For complete component docs, examples and theme customization, see the [docs site](https://peaktai.github.io/wok-ui-ext/) or run it locally:
58
+
59
+ ```bash
60
+ npm run dev:docs
61
+ ```
62
+
63
+ ## Component List
64
+
65
+ Form, table, button, tag, card, collapse, drawer, modal, popconfirm, dropdown, date picker, timeline, steps, progress, pagination, search box, tree, upload, image preview, skeleton, empty state, result page, text, icon, descriptions, divider, avatar, badge, breadcrumb, menu, switch, segmented, list, tooltip, loading and more — 40+ components.
66
+
67
+ ## Contributing
68
+
69
+ This project is **personally maintained** by the author. For reasons of effort and design consistency, **Pull Requests are not accepted**.
70
+
71
+ If you have bug reports or good suggestions, feel free to contact the author via email at peaktai@qq.com.
72
+
73
+ ## License
74
+
75
+ [ISC](LICENSE)
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # wok-ui-ext
2
+
3
+ 中文 | [English](README.en.md)
4
+
5
+ wok-ui 的扩展组件库,提供一套**科技蓝风格 + 多主题**的企业级高频组件库。
6
+
7
+ 在 wok-ui 框架基础上,wok-ui-ext 内置了 6 套主题(科技蓝、深邃夜空、活力橙、神秘紫、森林绿、烈焰红),并扩展了 40+ 常用组件,开箱即用,更适合企业级项目开发。
8
+
9
+ ## 特性
10
+
11
+ - **多主题**:内置 6 套主题,一行代码切换,所有组件样式自动跟随
12
+ - **覆盖常用组件**:表单、表格、弹窗、抽屉、日期选择、上传、树、步骤条、时间线等 40+ 高频组件
13
+ - **可定制**:支持通过 CSS 变量和 `setTheme` 深度定制主题,满足品牌视觉需求
14
+ - **国际化**:内置中文、英文等多语言支持,可自由扩展
15
+
16
+ ## 快速上手
17
+
18
+ ### 安装
19
+
20
+ 项目需要基于 wok-ui,请先安装:
21
+
22
+ ```bash
23
+ npm install wok-ui --save
24
+ ```
25
+
26
+ 再安装 wok-ui-ext:
27
+
28
+ ```bash
29
+ npm install wok-ui-ext --save
30
+ ```
31
+
32
+ ### 初始化
33
+
34
+ 使用 wok-ui-ext 无需改变原有 wok-ui 项目的流程,只需增加国际化和主题的初始化:
35
+
36
+ ```ts
37
+ import { initWokUiExtI18n, applyTheme } from 'wok-ui-ext'
38
+
39
+ // 初始化 wok-ui-ext 国际化(会自动应用语言,无需再调用 wok-ui 的 setLang)
40
+ await initWokUiExtI18n('zh-CN')
41
+
42
+ // 应用主题,默认是科技蓝,可选:'dark' | 'orange' | 'purple' | 'green' | 'red'
43
+ applyTheme('default')
44
+ ```
45
+
46
+ ### 切换主题
47
+
48
+ ```ts
49
+ import { applyTheme } from 'wok-ui-ext'
50
+
51
+ applyTheme('orange') // 切换为活力橙
52
+ applyTheme('dark') // 切换为深邃夜空
53
+ ```
54
+
55
+ ## 文档
56
+
57
+ 完整组件文档、示例与主题定制说明,请查看 [文档站](https://peaktai.github.io/wok-ui-ext/) 或在本地运行:
58
+
59
+ ```bash
60
+ npm run dev:docs
61
+ ```
62
+
63
+ ## 组件列表
64
+
65
+ 表单、表格、按钮、标签、卡片、折叠面板、抽屉、弹窗、气泡确认框、下拉菜单、日期选择、时间线、步骤条、进度条、分页、搜索框、树、上传、图片预览、骨架屏、空状态、结果页、文字、图标、描述列表、分割线、头像、徽标、面包屑、菜单、开关、分段器、列表、提示、加载等 40+ 组件。
66
+
67
+ ## 参与贡献
68
+
69
+ 本项目由作者**个人维护**,出于精力与设计一致性考虑,**不接受 Pull Request**。
70
+
71
+ 如果你有 Bug 反馈或好的建议,欢迎发送邮件至 peaktai@qq.com 联系作者。
72
+
73
+ ## License
74
+
75
+ [ISC](LICENSE)
@@ -0,0 +1,10 @@
1
+ import { DivModule, SubModulesOpt } from 'wok-ui';
2
+ import './style.less';
3
+ export declare class Alert extends DivModule {
4
+ constructor(opts: {
5
+ type: 'info' | 'success' | 'warning' | 'danger';
6
+ title?: string;
7
+ content: SubModulesOpt;
8
+ closeable?: boolean;
9
+ });
10
+ }
@@ -0,0 +1,48 @@
1
+ import { DivModule } from 'wok-ui';
2
+ import './style.css';
3
+ import { IconInfoCircle, IconCheckCircle, IconExclamationCircle, IconTimesCircle, IconTimes } from '../icons';
4
+ export class Alert extends DivModule {
5
+ constructor(opts) {
6
+ super('wok-ui-ext-alert');
7
+ this.el.classList.add(`wok-ui-ext-alert-${opts.type}`);
8
+ let icon = new IconInfoCircle();
9
+ switch (opts.type) {
10
+ case 'success':
11
+ icon = new IconCheckCircle();
12
+ break;
13
+ case 'warning':
14
+ icon = new IconExclamationCircle();
15
+ break;
16
+ case 'danger':
17
+ icon = new IconTimesCircle();
18
+ break;
19
+ }
20
+ this.addChild({ classNames: 'wok-ui-ext-alert-icon', children: icon }, {
21
+ classNames: 'wok-ui-ext-alert-body',
22
+ children: add => {
23
+ if (opts.title) {
24
+ add({
25
+ classNames: 'wok-ui-ext-alert-title',
26
+ innerText: opts.title
27
+ });
28
+ }
29
+ add({
30
+ classNames: 'wok-ui-ext-alert-content',
31
+ children: opts.content
32
+ });
33
+ }
34
+ });
35
+ if (opts.closeable) {
36
+ this.addChild({
37
+ classNames: 'wok-ui-ext-alert-close',
38
+ children: new IconTimes(),
39
+ onClick: () => {
40
+ this.el.classList.add('wok-ui-ext-alert-dismissing');
41
+ setTimeout(() => {
42
+ this.destroy();
43
+ }, 150);
44
+ }
45
+ });
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,116 @@
1
+ .wok-ui-ext-alert {
2
+ display: flex;
3
+ align-items: flex-start;
4
+ gap: 12px;
5
+ padding: 14px 16px;
6
+ border-radius: var(--radius-md);
7
+ border: 1px solid transparent;
8
+ font-size: var(--font-size-small);
9
+ line-height: 1.6;
10
+ position: relative;
11
+ transition: opacity var(--transition-speed), transform var(--transition-speed);
12
+ }
13
+ .wok-ui-ext-alert-icon {
14
+ flex-shrink: 0;
15
+ width: 20px;
16
+ height: 20px;
17
+ display: flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ margin-top: 1px;
21
+ }
22
+ .wok-ui-ext-alert-icon svg {
23
+ width: 18px;
24
+ height: 18px;
25
+ }
26
+ .wok-ui-ext-alert-body {
27
+ flex: 1;
28
+ min-width: 0;
29
+ }
30
+ .wok-ui-ext-alert-title {
31
+ font-weight: var(--font-weight-semibold);
32
+ font-size: var(--font-size-body);
33
+ margin-bottom: 4px;
34
+ }
35
+ .wok-ui-ext-alert-content {
36
+ color: inherit;
37
+ opacity: 0.85;
38
+ }
39
+ .wok-ui-ext-alert-close {
40
+ flex-shrink: 0;
41
+ width: 24px;
42
+ height: 24px;
43
+ display: flex;
44
+ align-items: center;
45
+ justify-content: center;
46
+ border: none;
47
+ background: transparent;
48
+ cursor: pointer;
49
+ border-radius: var(--radius-sm);
50
+ opacity: 0.6;
51
+ transition: opacity var(--transition-speed), background var(--transition-speed);
52
+ padding: 0;
53
+ margin-top: -2px;
54
+ }
55
+ .wok-ui-ext-alert-close svg {
56
+ width: 16px;
57
+ height: 16px;
58
+ pointer-events: none;
59
+ }
60
+ .wok-ui-ext-alert-close:hover {
61
+ opacity: 1;
62
+ background: rgba(0, 0, 0, 0.08);
63
+ }
64
+ .wok-ui-ext-alert-close:active {
65
+ opacity: 1;
66
+ background: rgba(0, 0, 0, 0.14);
67
+ }
68
+ .wok-ui-ext-alert.wok-ui-ext-alert-success {
69
+ background-color: var(--color-success-light);
70
+ border-color: var(--color-success);
71
+ color: var(--color-success);
72
+ }
73
+ .wok-ui-ext-alert.wok-ui-ext-alert-success .wok-ui-ext-alert-icon svg {
74
+ stroke: var(--color-success);
75
+ }
76
+ .wok-ui-ext-alert.wok-ui-ext-alert-success .wok-ui-ext-alert-close {
77
+ color: var(--color-success);
78
+ }
79
+ .wok-ui-ext-alert.wok-ui-ext-alert-warning {
80
+ background-color: var(--color-warning-light);
81
+ border-color: var(--color-warning);
82
+ color: var(--color-warning);
83
+ }
84
+ .wok-ui-ext-alert.wok-ui-ext-alert-warning .wok-ui-ext-alert-icon svg {
85
+ stroke: var(--color-warning);
86
+ }
87
+ .wok-ui-ext-alert.wok-ui-ext-alert-warning .wok-ui-ext-alert-close {
88
+ color: var(--color-warning);
89
+ }
90
+ .wok-ui-ext-alert.wok-ui-ext-alert-danger {
91
+ background-color: var(--color-danger-light);
92
+ border-color: var(--color-danger);
93
+ color: var(--color-danger);
94
+ }
95
+ .wok-ui-ext-alert.wok-ui-ext-alert-danger .wok-ui-ext-alert-icon svg {
96
+ stroke: var(--color-danger);
97
+ }
98
+ .wok-ui-ext-alert.wok-ui-ext-alert-danger .wok-ui-ext-alert-close {
99
+ color: var(--color-danger);
100
+ }
101
+ .wok-ui-ext-alert.wok-ui-ext-alert-info {
102
+ background-color: var(--color-info-light);
103
+ border-color: var(--color-info);
104
+ color: var(--color-info);
105
+ }
106
+ .wok-ui-ext-alert.wok-ui-ext-alert-info .wok-ui-ext-alert-icon svg {
107
+ stroke: var(--color-info);
108
+ }
109
+ .wok-ui-ext-alert.wok-ui-ext-alert-info .wok-ui-ext-alert-close {
110
+ color: var(--color-info);
111
+ }
112
+ .wok-ui-ext-alert.wok-ui-ext-alert-dismissing {
113
+ opacity: 0;
114
+ transform: translateY(-6px);
115
+ pointer-events: none;
116
+ }
@@ -0,0 +1,9 @@
1
+ import { DivModule } from 'wok-ui';
2
+ import './style.less';
3
+ export declare class Avatar extends DivModule {
4
+ constructor(opts: {
5
+ size?: 'sm' | 'lg' | number;
6
+ src?: string;
7
+ title?: string;
8
+ });
9
+ }
@@ -0,0 +1,30 @@
1
+ import { DivModule } from 'wok-ui';
2
+ import './style.css';
3
+ import { IconUser } from '../icons';
4
+ export class Avatar extends DivModule {
5
+ constructor(opts) {
6
+ super('wok-ui-ext-avatar');
7
+ if (opts.title) {
8
+ this.el.title = opts.title;
9
+ }
10
+ if (opts.size === 'sm' || opts.size === 'lg') {
11
+ this.el.classList.add(`wok-ui-ext-avatar-${opts.size}`);
12
+ }
13
+ else if (typeof opts.size === 'number') {
14
+ this.el.style.width = `${opts.size}px`;
15
+ this.el.style.height = `${opts.size}px`;
16
+ this.el.style.fontSize = `${opts.size / 2}px`;
17
+ }
18
+ if (opts.src) {
19
+ this.addChild({
20
+ tag: 'img',
21
+ attrs: {
22
+ src: opts.src
23
+ }
24
+ });
25
+ }
26
+ else {
27
+ this.addChild(new IconUser());
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,32 @@
1
+ .wok-ui-ext-avatar {
2
+ width: 40px;
3
+ height: 40px;
4
+ font-size: 20px;
5
+ display: inline-flex;
6
+ align-items: center;
7
+ justify-content: center;
8
+ background-color: var(--color-primary-soft, #e2edff);
9
+ color: var(--color-primary, #2d7ee9);
10
+ border-radius: var(--radius-circle, 50%);
11
+ overflow: hidden;
12
+ flex-shrink: 0;
13
+ border: 2px solid white;
14
+ box-shadow: var(--shadow-sm);
15
+ transition: all var(--transition-speed, 0.15s) ease;
16
+ }
17
+ .wok-ui-ext-avatar > img {
18
+ width: 100%;
19
+ height: 100%;
20
+ object-fit: cover;
21
+ display: block;
22
+ }
23
+ .wok-ui-ext-avatar.wok-ui-ext-avatar-sm {
24
+ width: 32px;
25
+ height: 32px;
26
+ font-size: 16px;
27
+ }
28
+ .wok-ui-ext-avatar.wok-ui-ext-avatar-lg {
29
+ width: 48px;
30
+ height: 48px;
31
+ font-size: 24px;
32
+ }
@@ -0,0 +1,32 @@
1
+ import { DivModule, SubModulesOpt } from 'wok-ui';
2
+ import './style.less';
3
+ export type BadgeType = 'danger' | 'primary' | 'success' | 'warning' | 'info';
4
+ /**
5
+ * 徽标组件
6
+ */
7
+ export declare class Badge extends DivModule {
8
+ /**
9
+ * 徽标组件,用于在图标/头像等元素右上角标记数量或红点,也可以独立显示。
10
+ * @param opts
11
+ * @param opts.count 显示数量
12
+ * @param opts.max 数量封顶值,count 超过 max 时显示 `max+`,默认 99
13
+ * @param opts.dot 纯红点模式,不显示数字,默认 false
14
+ * @param opts.type 徽标颜色,默认 danger
15
+ * @param opts.showZero count 为 0 时是否显示,默认 false
16
+ * @param opts.hidden 是否隐藏徽标,默认 false
17
+ * @param opts.offset 位置偏移 [水平, 垂直],默认右上角
18
+ * @param opts.children 被包裹的内容(图标、头像等),不传时徽标独立显示
19
+ * @param opts.onClick 点击徽标回调
20
+ */
21
+ constructor(opts: {
22
+ count?: number;
23
+ max?: number;
24
+ dot?: boolean;
25
+ type?: BadgeType;
26
+ showZero?: boolean;
27
+ hidden?: boolean;
28
+ offset?: [number, number];
29
+ children?: SubModulesOpt;
30
+ onClick?: (evt: MouseEvent) => void;
31
+ });
32
+ }
@@ -0,0 +1,61 @@
1
+ import { DivModule } from 'wok-ui';
2
+ import './style.css';
3
+ /**
4
+ * 徽标组件
5
+ */
6
+ export class Badge extends DivModule {
7
+ /**
8
+ * 徽标组件,用于在图标/头像等元素右上角标记数量或红点,也可以独立显示。
9
+ * @param opts
10
+ * @param opts.count 显示数量
11
+ * @param opts.max 数量封顶值,count 超过 max 时显示 `max+`,默认 99
12
+ * @param opts.dot 纯红点模式,不显示数字,默认 false
13
+ * @param opts.type 徽标颜色,默认 danger
14
+ * @param opts.showZero count 为 0 时是否显示,默认 false
15
+ * @param opts.hidden 是否隐藏徽标,默认 false
16
+ * @param opts.offset 位置偏移 [水平, 垂直],默认右上角
17
+ * @param opts.children 被包裹的内容(图标、头像等),不传时徽标独立显示
18
+ * @param opts.onClick 点击徽标回调
19
+ */
20
+ constructor(opts) {
21
+ super('wok-ui-ext-badge');
22
+ const type = opts.type ?? 'danger';
23
+ const max = opts.max ?? 99;
24
+ const count = opts.count ?? 0;
25
+ const dot = !!opts.dot;
26
+ // 显示逻辑:未隐藏,且(红点模式无条件显示,或 showZero,或 count > 0)
27
+ const visible = !opts.hidden && (dot || opts.showZero || count > 0);
28
+ const displayText = dot ? '' : count > max ? `${max}+` : `${count}`;
29
+ if (opts.children) {
30
+ // 包裹模式:角标绝对定位在子元素右上角
31
+ this.addChild(opts.children);
32
+ if (visible) {
33
+ this.addChild({
34
+ tag: 'span',
35
+ classNames: ['wok-ui-ext-badge-sup', `wok-ui-ext-badge-${type}`, dot ? 'dot' : ''],
36
+ innerText: displayText,
37
+ onClick: opts.onClick
38
+ });
39
+ if (opts.offset) {
40
+ const supEl = this.el.querySelector('.wok-ui-ext-badge-sup');
41
+ if (supEl) {
42
+ supEl.style.transform = `translate(calc(50% + ${opts.offset[0]}px), calc(-50% + ${opts.offset[1]}px))`;
43
+ }
44
+ }
45
+ }
46
+ }
47
+ else if (visible) {
48
+ // 独立模式:徽标自身就是角标
49
+ this.el.classList.add(`wok-ui-ext-badge-${type}`, 'standalone');
50
+ if (dot) {
51
+ this.el.classList.add('dot');
52
+ }
53
+ if (displayText) {
54
+ this.el.innerText = displayText;
55
+ }
56
+ if (opts.onClick) {
57
+ this.el.addEventListener('click', opts.onClick);
58
+ }
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,68 @@
1
+ .wok-ui-ext-badge {
2
+ display: inline-flex;
3
+ position: relative;
4
+ }
5
+ .wok-ui-ext-badge .wok-ui-ext-badge-sup {
6
+ display: inline-flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ min-width: 18px;
10
+ height: 18px;
11
+ padding: 0 6px;
12
+ border-radius: var(--radius-full);
13
+ background-color: var(--color-danger);
14
+ color: #fff;
15
+ font-size: var(--font-size-xs);
16
+ font-weight: var(--font-weight-medium);
17
+ line-height: 1;
18
+ white-space: nowrap;
19
+ box-sizing: border-box;
20
+ cursor: default;
21
+ position: absolute;
22
+ top: 0;
23
+ right: 0;
24
+ transform: translate(50%, -50%);
25
+ }
26
+ .wok-ui-ext-badge .wok-ui-ext-badge-sup.dot {
27
+ min-width: 8px;
28
+ height: 8px;
29
+ padding: 0;
30
+ }
31
+ .wok-ui-ext-badge.standalone {
32
+ display: inline-flex;
33
+ align-items: center;
34
+ justify-content: center;
35
+ min-width: 18px;
36
+ height: 18px;
37
+ padding: 0 6px;
38
+ border-radius: var(--radius-full);
39
+ background-color: var(--color-danger);
40
+ color: #fff;
41
+ font-size: var(--font-size-xs);
42
+ font-weight: var(--font-weight-medium);
43
+ line-height: 1;
44
+ white-space: nowrap;
45
+ box-sizing: border-box;
46
+ cursor: default;
47
+ }
48
+ .wok-ui-ext-badge.standalone.dot {
49
+ min-width: 8px;
50
+ height: 8px;
51
+ padding: 0;
52
+ }
53
+ .wok-ui-ext-badge.wok-ui-ext-badge-primary .wok-ui-ext-badge-sup,
54
+ .wok-ui-ext-badge.wok-ui-ext-badge-primary.standalone {
55
+ background-color: var(--color-primary);
56
+ }
57
+ .wok-ui-ext-badge.wok-ui-ext-badge-success .wok-ui-ext-badge-sup,
58
+ .wok-ui-ext-badge.wok-ui-ext-badge-success.standalone {
59
+ background-color: var(--color-success);
60
+ }
61
+ .wok-ui-ext-badge.wok-ui-ext-badge-warning .wok-ui-ext-badge-sup,
62
+ .wok-ui-ext-badge.wok-ui-ext-badge-warning.standalone {
63
+ background-color: var(--color-warning);
64
+ }
65
+ .wok-ui-ext-badge.wok-ui-ext-badge-info .wok-ui-ext-badge-sup,
66
+ .wok-ui-ext-badge.wok-ui-ext-badge-info.standalone {
67
+ background-color: var(--color-info);
68
+ }
@@ -0,0 +1,25 @@
1
+ import { DivModule } from 'wok-ui';
2
+ import { IconInput } from '../icons';
3
+ import './style.less';
4
+ export interface BreadcrumbItem {
5
+ text: string;
6
+ onClick?: () => void;
7
+ icon?: IconInput;
8
+ }
9
+ /**
10
+ * 面包屑导航组件
11
+ */
12
+ export declare class Breadcrumb extends DivModule {
13
+ private readonly opts;
14
+ constructor(opts: {
15
+ /**
16
+ * 面包屑项列表
17
+ */
18
+ items: BreadcrumbItem[];
19
+ /**
20
+ * 分隔符,默认 '/'
21
+ */
22
+ separator?: string;
23
+ });
24
+ private render;
25
+ }
@@ -0,0 +1,47 @@
1
+ import { DivModule } from 'wok-ui';
2
+ import { resolveIcon } from '../icons';
3
+ import './style.css';
4
+ /**
5
+ * 面包屑导航组件
6
+ */
7
+ export class Breadcrumb extends DivModule {
8
+ constructor(opts) {
9
+ super('wok-ui-ext-breadcrumb');
10
+ this.opts = opts;
11
+ this.render();
12
+ }
13
+ render() {
14
+ const { items, separator = '/' } = this.opts;
15
+ const lastIndex = items.length - 1;
16
+ for (let i = 0; i < items.length; i++) {
17
+ const item = items[i];
18
+ const isLast = i === lastIndex;
19
+ if (isLast) {
20
+ // 当前页:纯文本,不可点击
21
+ this.addChild({
22
+ classNames: 'wok-ui-ext-breadcrumb-item wok-ui-ext-breadcrumb-item-current',
23
+ children: item.icon
24
+ ? [resolveIcon(item.icon), { children: item.text }]
25
+ : item.text
26
+ });
27
+ }
28
+ else {
29
+ // 上级页面:可点击链接
30
+ this.addChild({
31
+ tag: 'a',
32
+ classNames: 'wok-ui-ext-breadcrumb-item',
33
+ attrs: { href: 'javascript:void(0)' },
34
+ children: item.icon
35
+ ? [resolveIcon(item.icon), { children: item.text }]
36
+ : item.text,
37
+ onClick: () => item.onClick?.()
38
+ });
39
+ // 分隔符
40
+ this.addChild({
41
+ classNames: 'wok-ui-ext-breadcrumb-separator',
42
+ children: separator
43
+ });
44
+ }
45
+ }
46
+ }
47
+ }