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
@@ -0,0 +1,41 @@
1
+ .wok-ui-ext-tabs {
2
+ display: flex;
3
+ flex-direction: column;
4
+ }
5
+ .wok-ui-ext-tabs .wok-ui-ext-tabs-nav {
6
+ display: flex;
7
+ gap: 16px;
8
+ border-bottom: 2px solid var(--border-medium);
9
+ }
10
+ .wok-ui-ext-tabs .wok-ui-ext-tabs-nav .wok-ui-ext-tabs-tab {
11
+ padding: 12px 24px;
12
+ font-weight: 600;
13
+ color: var(--text-tertiary);
14
+ cursor: pointer;
15
+ border: none;
16
+ border-bottom: 3px solid transparent;
17
+ margin-bottom: -2px;
18
+ background: transparent;
19
+ font-size: inherit;
20
+ font-family: inherit;
21
+ line-height: inherit;
22
+ }
23
+ .wok-ui-ext-tabs .wok-ui-ext-tabs-nav .wok-ui-ext-tabs-tab:hover:not(.active):not(.disabled) {
24
+ color: var(--text-secondary);
25
+ }
26
+ .wok-ui-ext-tabs .wok-ui-ext-tabs-nav .wok-ui-ext-tabs-tab.active {
27
+ color: var(--color-primary);
28
+ border-bottom-color: var(--color-primary);
29
+ }
30
+ .wok-ui-ext-tabs .wok-ui-ext-tabs-nav .wok-ui-ext-tabs-tab.disabled {
31
+ color: var(--text-muted);
32
+ cursor: not-allowed;
33
+ opacity: 0.6;
34
+ }
35
+ .wok-ui-ext-tabs .wok-ui-ext-tabs-nav .wok-ui-ext-tabs-tab:focus-visible {
36
+ outline: 2px solid var(--color-primary);
37
+ outline-offset: 2px;
38
+ }
39
+ .wok-ui-ext-tabs .wok-ui-ext-tabs-content {
40
+ padding: 16px 0;
41
+ }
@@ -0,0 +1,53 @@
1
+ import { DivModule, SubModulesOpt } from 'wok-ui';
2
+ import { IconInput } from '../icons';
3
+ import './style.less';
4
+ export type TagType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info';
5
+ export type TagSize = 'small' | 'default' | 'large';
6
+ /**
7
+ * 标签组件
8
+ */
9
+ export declare class Tag extends DivModule {
10
+ private selected;
11
+ private readonly checkable;
12
+ private readonly disabled;
13
+ private readonly onClose?;
14
+ private readonly onChange?;
15
+ private readonly onClick?;
16
+ /**
17
+ * 标签组件,用于状态标记和分类展示。
18
+ * @param opts
19
+ * @param opts.text 标签内容
20
+ * @param opts.type 语义类型:default 默认、primary 主要、success 成功、warning 警告、danger 危险、info 信息
21
+ * @param opts.plain 是否描边样式(透明底 + 语义色边框),默认 false 为浅色底样式
22
+ * @param opts.size 标签尺寸,默认 default
23
+ * @param opts.round 是否圆角,默认 true
24
+ * @param opts.closable 是否可关闭,显示关闭图标,点击后销毁标签并触发 onClose
25
+ * @param opts.icon 标签图标,可选
26
+ * @param opts.checkable 是否可选中,开启后点击切换选中状态
27
+ * @param opts.selected 初始选中状态,仅 checkable 时生效,默认 false
28
+ * @param opts.disabled 是否禁用,禁用后不可点击、不可切换、不可关闭
29
+ * @param opts.onClick 点击回调
30
+ * @param opts.onChange 选中状态变化回调,仅 checkable 时触发,参数为最新的选中状态
31
+ * @param opts.onClose 关闭回调,点击关闭图标时触发,标签随后会被销毁
32
+ */
33
+ constructor(opts: {
34
+ text: SubModulesOpt;
35
+ type?: TagType;
36
+ plain?: boolean;
37
+ size?: TagSize;
38
+ round?: boolean;
39
+ closable?: boolean;
40
+ icon?: IconInput;
41
+ checkable?: boolean;
42
+ selected?: boolean;
43
+ disabled?: boolean;
44
+ onClick?: (evt: MouseEvent) => void;
45
+ onChange?: (selected: boolean) => void;
46
+ onClose?: (evt: MouseEvent) => void;
47
+ });
48
+ /** 设置选中状态,仅 checkable 标签生效 */
49
+ setSelected(selected: boolean): void;
50
+ /** 获取当前选中状态 */
51
+ isSelected(): boolean;
52
+ private updateSelected;
53
+ }
@@ -0,0 +1,100 @@
1
+ import { DivModule } from 'wok-ui';
2
+ import { resolveIcon, IconTimes } from '../icons';
3
+ import './style.css';
4
+ /**
5
+ * 标签组件
6
+ */
7
+ export class Tag extends DivModule {
8
+ /**
9
+ * 标签组件,用于状态标记和分类展示。
10
+ * @param opts
11
+ * @param opts.text 标签内容
12
+ * @param opts.type 语义类型:default 默认、primary 主要、success 成功、warning 警告、danger 危险、info 信息
13
+ * @param opts.plain 是否描边样式(透明底 + 语义色边框),默认 false 为浅色底样式
14
+ * @param opts.size 标签尺寸,默认 default
15
+ * @param opts.round 是否圆角,默认 true
16
+ * @param opts.closable 是否可关闭,显示关闭图标,点击后销毁标签并触发 onClose
17
+ * @param opts.icon 标签图标,可选
18
+ * @param opts.checkable 是否可选中,开启后点击切换选中状态
19
+ * @param opts.selected 初始选中状态,仅 checkable 时生效,默认 false
20
+ * @param opts.disabled 是否禁用,禁用后不可点击、不可切换、不可关闭
21
+ * @param opts.onClick 点击回调
22
+ * @param opts.onChange 选中状态变化回调,仅 checkable 时触发,参数为最新的选中状态
23
+ * @param opts.onClose 关闭回调,点击关闭图标时触发,标签随后会被销毁
24
+ */
25
+ constructor(opts) {
26
+ super('wok-ui-ext-tag');
27
+ this.selected = false;
28
+ this.checkable = !!opts.checkable;
29
+ this.disabled = !!opts.disabled;
30
+ this.selected = !!opts.selected;
31
+ this.onClick = opts.onClick;
32
+ this.onChange = opts.onChange;
33
+ this.onClose = opts.onClose;
34
+ if (opts.type && opts.type !== 'default') {
35
+ this.el.classList.add(`wok-ui-ext-tag-${opts.type}`);
36
+ }
37
+ if (opts.plain) {
38
+ this.el.classList.add('plain');
39
+ }
40
+ if (opts.size && opts.size !== 'default') {
41
+ this.el.classList.add(`wok-ui-ext-tag-${opts.size}`);
42
+ }
43
+ if (opts.round === false) {
44
+ this.el.classList.add('no-round');
45
+ }
46
+ if (this.checkable) {
47
+ this.el.classList.add('checkable');
48
+ }
49
+ if (this.selected) {
50
+ this.el.classList.add('selected');
51
+ }
52
+ if (this.disabled) {
53
+ this.el.classList.add('disabled');
54
+ }
55
+ if (opts.icon) {
56
+ this.addChild({ classNames: 'wok-ui-ext-tag-icon', children: resolveIcon(opts.icon) });
57
+ }
58
+ this.addChild({ classNames: 'wok-ui-ext-tag-text', children: opts.text });
59
+ if (opts.closable) {
60
+ this.addChild({
61
+ classNames: 'wok-ui-ext-tag-close',
62
+ children: new IconTimes(),
63
+ onClick: (evt) => {
64
+ evt.stopPropagation();
65
+ if (this.disabled) {
66
+ return;
67
+ }
68
+ this.onClose?.(evt);
69
+ this.destroy();
70
+ }
71
+ });
72
+ }
73
+ this.el.addEventListener('click', (evt) => {
74
+ if (this.disabled) {
75
+ return;
76
+ }
77
+ if (this.checkable) {
78
+ this.selected = !this.selected;
79
+ this.updateSelected();
80
+ this.onChange?.(this.selected);
81
+ }
82
+ this.onClick?.(evt);
83
+ });
84
+ }
85
+ /** 设置选中状态,仅 checkable 标签生效 */
86
+ setSelected(selected) {
87
+ if (!this.checkable || this.selected === selected) {
88
+ return;
89
+ }
90
+ this.selected = selected;
91
+ this.updateSelected();
92
+ }
93
+ /** 获取当前选中状态 */
94
+ isSelected() {
95
+ return this.selected;
96
+ }
97
+ updateSelected() {
98
+ this.el.classList.toggle('selected', this.selected);
99
+ }
100
+ }
@@ -0,0 +1,134 @@
1
+ .wok-ui-ext-tag {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ gap: 6px;
5
+ height: 24px;
6
+ padding: 0 12px;
7
+ border-radius: var(--radius-full);
8
+ border: 1px solid transparent;
9
+ background-color: var(--border-light);
10
+ color: var(--text-secondary);
11
+ font-size: var(--font-size-xs);
12
+ line-height: 1;
13
+ white-space: nowrap;
14
+ max-width: 100%;
15
+ box-sizing: border-box;
16
+ user-select: none;
17
+ transition: background-color var(--transition-speed), color var(--transition-speed), border-color var(--transition-speed);
18
+ }
19
+ .wok-ui-ext-tag > .wok-ui-ext-tag-icon {
20
+ display: inline-flex;
21
+ flex-shrink: 0;
22
+ }
23
+ .wok-ui-ext-tag > .wok-ui-ext-tag-icon > .wok-ui-svg-icon {
24
+ font-size: 12px;
25
+ }
26
+ .wok-ui-ext-tag .wok-ui-ext-tag-text {
27
+ min-width: 0;
28
+ overflow: hidden;
29
+ text-overflow: ellipsis;
30
+ }
31
+ .wok-ui-ext-tag.no-round {
32
+ border-radius: var(--radius-sm);
33
+ }
34
+ .wok-ui-ext-tag.wok-ui-ext-tag-primary {
35
+ background-color: var(--color-primary-light);
36
+ color: var(--color-primary-dark);
37
+ }
38
+ .wok-ui-ext-tag.wok-ui-ext-tag-success {
39
+ background-color: var(--color-success-light);
40
+ color: var(--color-success);
41
+ }
42
+ .wok-ui-ext-tag.wok-ui-ext-tag-warning {
43
+ background-color: var(--color-warning-light);
44
+ color: var(--color-warning);
45
+ }
46
+ .wok-ui-ext-tag.wok-ui-ext-tag-danger {
47
+ background-color: var(--color-danger-light);
48
+ color: var(--color-danger);
49
+ }
50
+ .wok-ui-ext-tag.wok-ui-ext-tag-info {
51
+ background-color: var(--color-info-light);
52
+ color: var(--color-info);
53
+ }
54
+ .wok-ui-ext-tag.plain {
55
+ background-color: transparent;
56
+ border-color: var(--border-medium);
57
+ }
58
+ .wok-ui-ext-tag.plain.wok-ui-ext-tag-primary {
59
+ border-color: var(--color-primary);
60
+ color: var(--color-primary-dark);
61
+ }
62
+ .wok-ui-ext-tag.plain.wok-ui-ext-tag-success {
63
+ border-color: var(--color-success);
64
+ color: var(--color-success);
65
+ }
66
+ .wok-ui-ext-tag.plain.wok-ui-ext-tag-warning {
67
+ border-color: var(--color-warning);
68
+ color: var(--color-warning);
69
+ }
70
+ .wok-ui-ext-tag.plain.wok-ui-ext-tag-danger {
71
+ border-color: var(--color-danger);
72
+ color: var(--color-danger);
73
+ }
74
+ .wok-ui-ext-tag.plain.wok-ui-ext-tag-info {
75
+ border-color: var(--color-info);
76
+ color: var(--color-info);
77
+ }
78
+ .wok-ui-ext-tag.wok-ui-ext-tag-small {
79
+ height: 20px;
80
+ padding: 0 8px;
81
+ }
82
+ .wok-ui-ext-tag.wok-ui-ext-tag-large {
83
+ height: 32px;
84
+ padding: 0 16px;
85
+ font-size: var(--font-size-small);
86
+ }
87
+ .wok-ui-ext-tag.checkable {
88
+ cursor: pointer;
89
+ }
90
+ .wok-ui-ext-tag.selected {
91
+ background-color: var(--color-primary);
92
+ border-color: var(--color-primary);
93
+ color: #fff;
94
+ }
95
+ .wok-ui-ext-tag.selected.wok-ui-ext-tag-success {
96
+ background-color: var(--color-success);
97
+ border-color: var(--color-success);
98
+ }
99
+ .wok-ui-ext-tag.selected.wok-ui-ext-tag-warning {
100
+ background-color: var(--color-warning);
101
+ border-color: var(--color-warning);
102
+ }
103
+ .wok-ui-ext-tag.selected.wok-ui-ext-tag-danger {
104
+ background-color: var(--color-danger);
105
+ border-color: var(--color-danger);
106
+ }
107
+ .wok-ui-ext-tag.selected.wok-ui-ext-tag-info {
108
+ background-color: var(--color-info);
109
+ border-color: var(--color-info);
110
+ }
111
+ .wok-ui-ext-tag.selected .wok-ui-ext-tag-close {
112
+ color: #fff;
113
+ }
114
+ .wok-ui-ext-tag .wok-ui-ext-tag-close {
115
+ display: inline-flex;
116
+ align-items: center;
117
+ justify-content: center;
118
+ flex-shrink: 0;
119
+ cursor: pointer;
120
+ opacity: 0.6;
121
+ margin-right: -4px;
122
+ transition: opacity var(--transition-speed);
123
+ }
124
+ .wok-ui-ext-tag .wok-ui-ext-tag-close:hover {
125
+ opacity: 1;
126
+ }
127
+ .wok-ui-ext-tag .wok-ui-ext-tag-close > .wok-ui-svg-icon {
128
+ font-size: 11px;
129
+ }
130
+ .wok-ui-ext-tag.disabled {
131
+ opacity: 0.5;
132
+ cursor: not-allowed;
133
+ pointer-events: none;
134
+ }
@@ -0,0 +1,104 @@
1
+ import { Module } from 'wok-ui';
2
+ import './style.less';
3
+ /**
4
+ * 文本对齐方式
5
+ */
6
+ export type TextAlign = 'left' | 'center' | 'right';
7
+ /**
8
+ * 文本组件基础选项
9
+ */
10
+ interface TextOptions {
11
+ text: string;
12
+ align?: TextAlign;
13
+ onClick?: (evt: MouseEvent) => void;
14
+ }
15
+ /**
16
+ * 标题组件基础类 - 使用 heading 元素 (h1-h6)
17
+ */
18
+ declare abstract class HeadingComponent extends Module {
19
+ constructor(tagName: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6', className: string, opts: string | TextOptions);
20
+ }
21
+ /**
22
+ * 内联文本组件基础类 - 使用 span 元素
23
+ */
24
+ declare abstract class SpanComponent extends Module {
25
+ constructor(className: string, opts: string | TextOptions);
26
+ }
27
+ /**
28
+ * 大标题组件 - H1
29
+ * 用于页面主标题、模块标题
30
+ */
31
+ export declare class TitleLarge extends HeadingComponent {
32
+ constructor(opts: string | TextOptions);
33
+ }
34
+ /**
35
+ * 标准标题组件 - H2
36
+ * 用于卡片标题、区域标题
37
+ */
38
+ export declare class Title extends HeadingComponent {
39
+ constructor(opts: string | TextOptions);
40
+ }
41
+ /**
42
+ * 副标题组件 - H3
43
+ * 用于标题辅助说明、分类标题
44
+ */
45
+ export declare class Subtitle extends HeadingComponent {
46
+ constructor(opts: string | TextOptions);
47
+ }
48
+ /**
49
+ * 正文文本组件 - span
50
+ * 用于主要内容、描述文字
51
+ */
52
+ export declare class BodyText extends SpanComponent {
53
+ constructor(opts: string | TextOptions);
54
+ }
55
+ /**
56
+ * 次要文本组件 - span
57
+ * 用于辅助信息、说明文字
58
+ */
59
+ export declare class SecondaryText extends SpanComponent {
60
+ constructor(opts: string | TextOptions);
61
+ }
62
+ /**
63
+ * 三级文本组件 - span
64
+ * 用于备注、附加信息
65
+ */
66
+ export declare class TertiaryText extends SpanComponent {
67
+ constructor(opts: string | TextOptions);
68
+ }
69
+ /**
70
+ * 小型文本组件 - span
71
+ * 用于标签、时间戳
72
+ */
73
+ export declare class SmallText extends SpanComponent {
74
+ constructor(opts: string | TextOptions);
75
+ }
76
+ /**
77
+ * 超小文本组件 - span
78
+ * 用于角标、提示文字
79
+ */
80
+ export declare class TinyText extends SpanComponent {
81
+ constructor(opts: string | TextOptions);
82
+ }
83
+ /**
84
+ * 弱化文本组件 - span
85
+ * 用于占位符提示、非重要信息
86
+ */
87
+ export declare class MutedText extends SpanComponent {
88
+ constructor(opts: string | TextOptions);
89
+ }
90
+ /**
91
+ * 禁用文本组件 - span
92
+ * 用于禁用状态的文字显示
93
+ */
94
+ export declare class DisabledText extends Module {
95
+ constructor(opts: string | Omit<TextOptions, 'onClick'>);
96
+ }
97
+ /**
98
+ * 强调文本组件 - span
99
+ * 用于重点内容突出显示
100
+ */
101
+ export declare class StrongText extends SpanComponent {
102
+ constructor(opts: string | TextOptions);
103
+ }
104
+ export {};
@@ -0,0 +1,143 @@
1
+ import { Module } from 'wok-ui';
2
+ import './style.css';
3
+ /**
4
+ * 标题组件基础类 - 使用 heading 元素 (h1-h6)
5
+ */
6
+ class HeadingComponent extends Module {
7
+ constructor(tagName, className, opts) {
8
+ super(document.createElement(tagName));
9
+ const options = typeof opts === 'string' ? { text: opts } : opts;
10
+ this.el.classList.add(className);
11
+ this.el.innerText = options.text;
12
+ if (options.align) {
13
+ this.el.style.textAlign = options.align;
14
+ }
15
+ if (options.onClick) {
16
+ this.el.addEventListener('click', options.onClick);
17
+ this.el.classList.add('clickable');
18
+ }
19
+ }
20
+ }
21
+ /**
22
+ * 内联文本组件基础类 - 使用 span 元素
23
+ */
24
+ class SpanComponent extends Module {
25
+ constructor(className, opts) {
26
+ super(document.createElement('span'));
27
+ const options = typeof opts === 'string' ? { text: opts } : opts;
28
+ this.el.classList.add(className);
29
+ this.el.innerText = options.text;
30
+ if (options.align) {
31
+ this.el.style.textAlign = options.align;
32
+ }
33
+ if (options.onClick) {
34
+ this.el.addEventListener('click', options.onClick);
35
+ this.el.classList.add('clickable');
36
+ }
37
+ }
38
+ }
39
+ /**
40
+ * 大标题组件 - H1
41
+ * 用于页面主标题、模块标题
42
+ */
43
+ export class TitleLarge extends HeadingComponent {
44
+ constructor(opts) {
45
+ super('h1', 'wok-ui-ext-text-title-large', opts);
46
+ }
47
+ }
48
+ /**
49
+ * 标准标题组件 - H2
50
+ * 用于卡片标题、区域标题
51
+ */
52
+ export class Title extends HeadingComponent {
53
+ constructor(opts) {
54
+ super('h2', 'wok-ui-ext-text-title', opts);
55
+ }
56
+ }
57
+ /**
58
+ * 副标题组件 - H3
59
+ * 用于标题辅助说明、分类标题
60
+ */
61
+ export class Subtitle extends HeadingComponent {
62
+ constructor(opts) {
63
+ super('h3', 'wok-ui-ext-text-subtitle', opts);
64
+ }
65
+ }
66
+ /**
67
+ * 正文文本组件 - span
68
+ * 用于主要内容、描述文字
69
+ */
70
+ export class BodyText extends SpanComponent {
71
+ constructor(opts) {
72
+ super('wok-ui-ext-text-body', opts);
73
+ }
74
+ }
75
+ /**
76
+ * 次要文本组件 - span
77
+ * 用于辅助信息、说明文字
78
+ */
79
+ export class SecondaryText extends SpanComponent {
80
+ constructor(opts) {
81
+ super('wok-ui-ext-text-secondary', opts);
82
+ }
83
+ }
84
+ /**
85
+ * 三级文本组件 - span
86
+ * 用于备注、附加信息
87
+ */
88
+ export class TertiaryText extends SpanComponent {
89
+ constructor(opts) {
90
+ super('wok-ui-ext-text-tertiary', opts);
91
+ }
92
+ }
93
+ /**
94
+ * 小型文本组件 - span
95
+ * 用于标签、时间戳
96
+ */
97
+ export class SmallText extends SpanComponent {
98
+ constructor(opts) {
99
+ super('wok-ui-ext-text-small', opts);
100
+ }
101
+ }
102
+ /**
103
+ * 超小文本组件 - span
104
+ * 用于角标、提示文字
105
+ */
106
+ export class TinyText extends SpanComponent {
107
+ constructor(opts) {
108
+ super('wok-ui-ext-text-tiny', opts);
109
+ }
110
+ }
111
+ /**
112
+ * 弱化文本组件 - span
113
+ * 用于占位符提示、非重要信息
114
+ */
115
+ export class MutedText extends SpanComponent {
116
+ constructor(opts) {
117
+ super('wok-ui-ext-text-muted', opts);
118
+ }
119
+ }
120
+ /**
121
+ * 禁用文本组件 - span
122
+ * 用于禁用状态的文字显示
123
+ */
124
+ export class DisabledText extends Module {
125
+ constructor(opts) {
126
+ super(document.createElement('span'));
127
+ const options = typeof opts === 'string' ? { text: opts } : opts;
128
+ this.el.classList.add('wok-ui-ext-text-disabled');
129
+ this.el.innerText = options.text;
130
+ if (options.align) {
131
+ this.el.style.textAlign = options.align;
132
+ }
133
+ }
134
+ }
135
+ /**
136
+ * 强调文本组件 - span
137
+ * 用于重点内容突出显示
138
+ */
139
+ export class StrongText extends SpanComponent {
140
+ constructor(opts) {
141
+ super('wok-ui-ext-text-strong', opts);
142
+ }
143
+ }
@@ -0,0 +1,113 @@
1
+ /* ===== 文本组件样式 ===== */
2
+ [class*='wok-ui-ext-text-'] {
3
+ margin: 0;
4
+ padding: 0;
5
+ display: inline-block;
6
+ }
7
+ h1.wok-ui-ext-text-title-large,
8
+ h2.wok-ui-ext-text-title,
9
+ h3.wok-ui-ext-text-subtitle {
10
+ display: block;
11
+ }
12
+ .wok-ui-ext-text-title-large {
13
+ font-size: var(--font-size-title-large);
14
+ font-weight: var(--font-weight-semibold);
15
+ color: var(--text-primary);
16
+ line-height: 1.4;
17
+ }
18
+ .wok-ui-ext-text-title {
19
+ font-size: var(--font-size-title);
20
+ font-weight: var(--font-weight-semibold);
21
+ color: var(--text-primary);
22
+ line-height: 1.4;
23
+ }
24
+ .wok-ui-ext-text-subtitle {
25
+ font-size: var(--font-size-body);
26
+ font-weight: var(--font-weight-medium);
27
+ color: var(--text-secondary);
28
+ line-height: 1.5;
29
+ }
30
+ .wok-ui-ext-text-body {
31
+ font-size: var(--font-size-body);
32
+ font-weight: var(--font-weight-normal);
33
+ color: var(--text-primary);
34
+ line-height: 1.6;
35
+ }
36
+ .wok-ui-ext-text-secondary {
37
+ font-size: var(--font-size-body);
38
+ font-weight: var(--font-weight-normal);
39
+ color: var(--text-secondary);
40
+ line-height: 1.6;
41
+ }
42
+ .wok-ui-ext-text-tertiary {
43
+ font-size: var(--font-size-small);
44
+ font-weight: var(--font-weight-normal);
45
+ color: var(--text-tertiary);
46
+ line-height: 1.5;
47
+ }
48
+ .wok-ui-ext-text-small {
49
+ font-size: var(--font-size-small);
50
+ font-weight: var(--font-weight-normal);
51
+ color: var(--text-muted);
52
+ line-height: 1.5;
53
+ }
54
+ .wok-ui-ext-text-tiny {
55
+ font-size: var(--font-size-xs);
56
+ font-weight: var(--font-weight-normal);
57
+ color: var(--text-muted);
58
+ line-height: 1.4;
59
+ }
60
+ .wok-ui-ext-text-muted {
61
+ font-weight: var(--font-weight-normal);
62
+ color: var(--text-muted);
63
+ line-height: 1.5;
64
+ }
65
+ .wok-ui-ext-text-disabled {
66
+ font-weight: var(--font-weight-normal);
67
+ color: var(--text-disabled);
68
+ line-height: 1.5;
69
+ cursor: not-allowed;
70
+ }
71
+ .wok-ui-ext-text-strong {
72
+ font-size: var(--font-size-body);
73
+ font-weight: var(--font-weight-semibold);
74
+ color: var(--text-primary);
75
+ line-height: 1.6;
76
+ }
77
+ .wok-ui-ext-text-title-large.clickable,
78
+ .wok-ui-ext-text-title.clickable,
79
+ .wok-ui-ext-text-subtitle.clickable,
80
+ .wok-ui-ext-text-body.clickable,
81
+ .wok-ui-ext-text-secondary.clickable,
82
+ .wok-ui-ext-text-tertiary.clickable,
83
+ .wok-ui-ext-text-small.clickable,
84
+ .wok-ui-ext-text-tiny.clickable,
85
+ .wok-ui-ext-text-muted.clickable,
86
+ .wok-ui-ext-text-strong.clickable {
87
+ cursor: pointer;
88
+ transition: opacity var(--transition-speed);
89
+ }
90
+ .wok-ui-ext-text-title-large.clickable:hover,
91
+ .wok-ui-ext-text-title.clickable:hover,
92
+ .wok-ui-ext-text-subtitle.clickable:hover,
93
+ .wok-ui-ext-text-body.clickable:hover,
94
+ .wok-ui-ext-text-secondary.clickable:hover,
95
+ .wok-ui-ext-text-tertiary.clickable:hover,
96
+ .wok-ui-ext-text-small.clickable:hover,
97
+ .wok-ui-ext-text-tiny.clickable:hover,
98
+ .wok-ui-ext-text-muted.clickable:hover,
99
+ .wok-ui-ext-text-strong.clickable:hover {
100
+ opacity: 0.8;
101
+ }
102
+ .wok-ui-ext-text-title-large.clickable:active,
103
+ .wok-ui-ext-text-title.clickable:active,
104
+ .wok-ui-ext-text-subtitle.clickable:active,
105
+ .wok-ui-ext-text-body.clickable:active,
106
+ .wok-ui-ext-text-secondary.clickable:active,
107
+ .wok-ui-ext-text-tertiary.clickable:active,
108
+ .wok-ui-ext-text-small.clickable:active,
109
+ .wok-ui-ext-text-tiny.clickable:active,
110
+ .wok-ui-ext-text-muted.clickable:active,
111
+ .wok-ui-ext-text-strong.clickable:active {
112
+ opacity: 0.6;
113
+ }
@@ -0,0 +1,14 @@
1
+ import type { ThemeName, ThemeConfig } from './types';
2
+ export type { ThemeName, ThemeConfig };
3
+ /** 获取所有主题名称 */
4
+ export declare function getAllThemes(): ThemeName[];
5
+ /** 获取指定主题的完整配置,不传 name 则返回当前主题 */
6
+ export declare function getTheme(name?: ThemeName): ThemeConfig;
7
+ /** 自定义主题配置,合并到指定主题中。若修改的是当前主题,自动重新应用 */
8
+ export declare function setTheme(name: ThemeName, config: Partial<ThemeConfig>): void;
9
+ /**
10
+ * 应用主题
11
+ * 1. 通过 setColor 更新 wok-ui 框架组件的颜色
12
+ * 2. 通过 style.setProperty 更新 lib CSS 变量
13
+ */
14
+ export declare function applyTheme(name: ThemeName): void;