@icen.ai/ui 0.3.0 → 0.5.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 (78) hide show
  1. package/dist/behaviors/back-top.mjs +84 -0
  2. package/dist/behaviors/charts.mjs +188 -0
  3. package/dist/behaviors/command-palette.mjs +177 -0
  4. package/dist/behaviors/datatable.mjs +244 -24
  5. package/dist/behaviors/date-picker.mjs +228 -0
  6. package/dist/behaviors/input.mjs +170 -1
  7. package/dist/behaviors/notification.mjs +754 -0
  8. package/dist/behaviors/select.mjs +151 -22
  9. package/dist/behaviors/split-pane.mjs +102 -0
  10. package/dist/behaviors/upload.mjs +165 -14
  11. package/dist/components/back-top.css +88 -0
  12. package/dist/components/back-top.mjs +3 -0
  13. package/dist/components/badge.css +131 -0
  14. package/dist/components/badge.mjs +2 -0
  15. package/dist/components/breadcrumb.css +57 -0
  16. package/dist/components/card.css +68 -0
  17. package/dist/components/chart-area.css +15 -0
  18. package/dist/components/chart-area.mjs +4 -0
  19. package/dist/components/chart-bar.css +79 -0
  20. package/dist/components/chart-bar.mjs +4 -0
  21. package/dist/components/chart-gauge.css +38 -0
  22. package/dist/components/chart-gauge.mjs +4 -0
  23. package/dist/components/chart-heatmap.css +52 -0
  24. package/dist/components/chart-heatmap.mjs +4 -0
  25. package/dist/components/chart-line.css +15 -0
  26. package/dist/components/chart-line.mjs +4 -0
  27. package/dist/components/chart-pie.css +26 -0
  28. package/dist/components/chart-pie.mjs +4 -0
  29. package/dist/components/chart-radar.css +19 -0
  30. package/dist/components/chart-radar.mjs +4 -0
  31. package/dist/components/chart-sparkline.css +14 -0
  32. package/dist/components/chart-sparkline.mjs +4 -0
  33. package/dist/components/chart-stack.css +30 -0
  34. package/dist/components/chart-stack.mjs +4 -0
  35. package/dist/components/charts.css +7 -207
  36. package/dist/components/charts.mjs +9 -0
  37. package/dist/components/command-palette.css +246 -0
  38. package/dist/components/command-palette.mjs +3 -0
  39. package/dist/components/content.css +214 -0
  40. package/dist/components/copy.css +93 -0
  41. package/dist/components/copy.mjs +3 -0
  42. package/dist/components/datatable.css +86 -0
  43. package/dist/components/date-picker.css +244 -0
  44. package/dist/components/date-picker.mjs +3 -0
  45. package/dist/components/empty.css +73 -3
  46. package/dist/components/feedback.css +239 -1
  47. package/dist/components/form.css +119 -0
  48. package/dist/components/form.mjs +2 -0
  49. package/dist/components/input.css +24 -1
  50. package/dist/components/media.css +144 -1
  51. package/dist/components/nav.css +99 -0
  52. package/dist/components/notification.css +387 -0
  53. package/dist/components/notification.mjs +3 -0
  54. package/dist/components/panel.css +100 -5
  55. package/dist/components/pill.css +70 -0
  56. package/dist/components/scroll-area.css +112 -0
  57. package/dist/components/scroll-area.mjs +2 -0
  58. package/dist/components/segmented.css +75 -0
  59. package/dist/components/select.css +97 -2
  60. package/dist/components/sidebar.css +118 -0
  61. package/dist/components/slider.css +113 -0
  62. package/dist/components/split-pane.css +112 -0
  63. package/dist/components/split-pane.mjs +3 -0
  64. package/dist/components/stat.css +129 -6
  65. package/dist/components/steps.css +97 -0
  66. package/dist/components/switch.css +142 -0
  67. package/dist/components/table.css +86 -3
  68. package/dist/components/tabs.css +122 -1
  69. package/dist/components/tag.css +164 -0
  70. package/dist/components/tag.mjs +2 -0
  71. package/dist/components/toast.css +114 -0
  72. package/dist/components/toolbar.css +101 -0
  73. package/dist/components/toolbar.mjs +2 -0
  74. package/dist/components/upload.css +61 -4
  75. package/dist/index.mjs +2039 -62
  76. package/dist/registry.json +200 -24
  77. package/dist/ui.css +4865 -622
  78. package/package.json +1 -1
@@ -0,0 +1,164 @@
1
+ /*
2
+ * @icen.ai/ui — Component: tag(展示标签 / Chip)
3
+ *
4
+ * 与 pill 的差异(各司其职,不互相替代):
5
+ * - pill = 状态语义徽章(绿/黄/红/信息/accent),小尺寸,行内只读
6
+ * - tag = 中性展示标签,可选关闭按钮、可选中态、可带图标
7
+ * 常用于:分类、筛选条件、属性标记、邮件标签、文件 tag
8
+ *
9
+ * 完整契约:
10
+ * <span class="tag [.tag--sm|.tag--lg] [.is-selected] [.is-disabled]
11
+ * [.tag--accent|.tag--success|.tag--warning|.tag--error|.tag--info]">
12
+ * <span class="tag-icon">…svg…</span> <!-- 可选左图标 -->
13
+ * <span class="tag-label">标签文本</span>
14
+ * <button class="tag-close" type="button" aria-label="移除">×</button> <!-- 可选 -->
15
+ * </span>
16
+ *
17
+ * 选中态 .is-selected 由消费方驱动(用于筛选条件等);
18
+ * .tag-close 点击后消费方决定是否从 DOM 移除本节点(本组件不自动删除)。
19
+ */
20
+
21
+ .tag {
22
+ display: inline-flex;
23
+ align-items: center;
24
+ gap: 4px;
25
+ padding: 0 var(--density-space-sm);
26
+ height: 24px;
27
+ background: var(--token-fill-1);
28
+ color: var(--token-text-muted);
29
+ border: 1px solid var(--token-line-soft);
30
+ border-radius: var(--radius-sm);
31
+ font: inherit;
32
+ font-size: var(--density-font-size-sm);
33
+ letter-spacing: 0.01em;
34
+ white-space: nowrap;
35
+ vertical-align: middle;
36
+ transition:
37
+ background-color var(--icen-tx-fast),
38
+ border-color var(--icen-tx-fast),
39
+ color var(--icen-tx-fast);
40
+ }
41
+ .tag:hover {
42
+ background: var(--token-fill-2);
43
+ color: var(--token-text);
44
+ }
45
+
46
+ /* 尺寸变体 */
47
+ .tag--sm {
48
+ height: 20px;
49
+ padding: 0 6px;
50
+ font-size: var(--density-font-size-xs);
51
+ gap: 3px;
52
+ }
53
+ .tag--lg {
54
+ height: 28px;
55
+ padding: 0 10px;
56
+ font-size: var(--density-font-size-md);
57
+ gap: 6px;
58
+ }
59
+
60
+ /* ── 图标 ── */
61
+ .tag-icon {
62
+ display: inline-flex;
63
+ align-items: center;
64
+ justify-content: center;
65
+ flex-shrink: 0;
66
+ color: var(--token-text-faint);
67
+ }
68
+ .tag-icon svg { width: 12px; height: 12px; }
69
+ .tag--sm .tag-icon svg { width: 10px; height: 10px; }
70
+ .tag--lg .tag-icon svg { width: 14px; height: 14px; }
71
+ .tag-label {
72
+ overflow: hidden;
73
+ text-overflow: ellipsis;
74
+ max-width: 240px;
75
+ }
76
+
77
+ /* ── 关闭按钮(消费方点击后自行决定是否从 DOM 移除) ── */
78
+ .tag-close {
79
+ display: inline-flex;
80
+ align-items: center;
81
+ justify-content: center;
82
+ width: 16px;
83
+ height: 16px;
84
+ padding: 0;
85
+ margin-right: -4px;
86
+ margin-left: 2px;
87
+ border: 0;
88
+ border-radius: var(--radius-xs);
89
+ background: transparent;
90
+ color: inherit;
91
+ opacity: 0.6;
92
+ cursor: pointer;
93
+ -webkit-tap-highlight-color: transparent;
94
+ transition: opacity var(--icen-tx-fast), background-color var(--icen-tx-fast);
95
+ }
96
+ .tag-close:hover {
97
+ opacity: 1;
98
+ background: color-mix(in srgb, var(--token-text-faint) 22%, transparent);
99
+ }
100
+ .tag-close:focus-visible {
101
+ outline: none;
102
+ box-shadow: var(--icen-ring);
103
+ }
104
+ .tag-close svg { width: 10px; height: 10px; }
105
+ .tag--sm .tag-close { width: 14px; height: 14px; margin-right: -2px; }
106
+ .tag--lg .tag-close { width: 18px; height: 18px; margin-right: -6px; }
107
+
108
+ /* ── 选中态(用于筛选条件等)── */
109
+ .tag.is-selected {
110
+ background: var(--token-accent-subtle);
111
+ color: var(--token-accent-deep, var(--token-accent));
112
+ border-color: color-mix(in srgb, var(--token-accent) 40%, transparent);
113
+ }
114
+ .tag.is-selected .tag-icon { color: var(--token-accent); }
115
+
116
+ /* ── 语义色变体(与 pill 对齐,但底色更淡,作分类着色用)── */
117
+ .tag--accent {
118
+ background: color-mix(in srgb, var(--token-accent) 10%, transparent);
119
+ color: var(--token-accent-deep, var(--token-accent));
120
+ border-color: color-mix(in srgb, var(--token-accent) 30%, transparent);
121
+ }
122
+ .tag--success {
123
+ background: color-mix(in srgb, var(--token-success) 10%, transparent);
124
+ color: var(--token-success);
125
+ border-color: color-mix(in srgb, var(--token-success) 30%, transparent);
126
+ }
127
+ .tag--warning {
128
+ background: color-mix(in srgb, var(--token-warning) 10%, transparent);
129
+ color: var(--token-warning);
130
+ border-color: color-mix(in srgb, var(--token-warning) 30%, transparent);
131
+ }
132
+ .tag--error {
133
+ background: color-mix(in srgb, var(--token-error) 10%, transparent);
134
+ color: var(--token-error);
135
+ border-color: color-mix(in srgb, var(--token-error) 30%, transparent);
136
+ }
137
+ .tag--info {
138
+ background: color-mix(in srgb, var(--token-info) 10%, transparent);
139
+ color: var(--token-info);
140
+ border-color: color-mix(in srgb, var(--token-info) 30%, transparent);
141
+ }
142
+
143
+ /* ── 禁用态 ── */
144
+ .tag.is-disabled,
145
+ .tag[aria-disabled='true'] {
146
+ opacity: var(--icen-disabled-opacity);
147
+ cursor: not-allowed;
148
+ pointer-events: none;
149
+ }
150
+
151
+ /* ── 可点击(用于可筛选 tag) ── */
152
+ button.tag,
153
+ .tag[role='button'] {
154
+ cursor: pointer;
155
+ -webkit-tap-highlight-color: transparent;
156
+ }
157
+ .tag:where(button, [role='button']):focus-visible {
158
+ outline: none;
159
+ box-shadow: var(--icen-ring);
160
+ }
161
+
162
+ @media (prefers-reduced-motion: reduce) {
163
+ .tag, .tag-close { transition: none; }
164
+ }
@@ -0,0 +1,2 @@
1
+ // @icen.ai/ui — kit: tag(CSS + behavior 一行入口;构建产物,勿手改)
2
+ import './tag.css';
@@ -77,6 +77,120 @@
77
77
  box-shadow: var(--icen-ring);
78
78
  }
79
79
 
80
+ /* ── 增强 ── */
81
+
82
+ /* 语义图标 */
83
+ .toast-icon {
84
+ flex-shrink: 0;
85
+ display: inline-flex;
86
+ align-items: center;
87
+ justify-content: center;
88
+ color: var(--token-text-faint);
89
+ }
90
+ .toast-icon svg { width: 16px; height: 16px; }
91
+ .toast.ok .toast-icon { color: var(--token-success); }
92
+ .toast.err .toast-icon { color: var(--token-error); }
93
+ .toast.warn .toast-icon { color: var(--token-warning); }
94
+
95
+ /* 关闭按钮 */
96
+ .toast-close {
97
+ flex-shrink: 0;
98
+ display: inline-flex;
99
+ align-items: center;
100
+ justify-content: center;
101
+ width: 20px;
102
+ height: 20px;
103
+ padding: 0;
104
+ border: 0;
105
+ border-radius: var(--radius-xs);
106
+ background: transparent;
107
+ color: var(--token-text-faint);
108
+ cursor: pointer;
109
+ transition: color var(--icen-tx-fast), background-color var(--icen-tx-fast);
110
+ }
111
+ .toast-close:hover {
112
+ color: var(--token-text);
113
+ background: var(--token-fill-1);
114
+ }
115
+ .toast-close svg { width: 12px; height: 12px; }
116
+
117
+ /* 富内容(标题 + 正文) */
118
+ .toast-content {
119
+ flex: 1;
120
+ min-width: 0;
121
+ }
122
+ .toast-title {
123
+ font-size: var(--density-font-size-md);
124
+ font-weight: 500;
125
+ color: var(--token-text);
126
+ line-height: 1.4;
127
+ }
128
+ .toast-body {
129
+ font-size: var(--density-font-size-sm);
130
+ color: var(--token-text-muted);
131
+ margin-top: 2px;
132
+ line-height: 1.5;
133
+ }
134
+
135
+ /* 超时进度条 */
136
+ .toast-progress {
137
+ position: absolute;
138
+ bottom: 0;
139
+ left: 0;
140
+ right: 0;
141
+ height: 2px;
142
+ background: transparent;
143
+ overflow: hidden;
144
+ border-radius: 0 0 var(--radius-sm) var(--radius-sm);
145
+ }
146
+ .toast-progress-fill {
147
+ height: 100%;
148
+ background: var(--token-accent);
149
+ transform-origin: left;
150
+ animation: toast-countdown linear forwards;
151
+ }
152
+ .toast.ok .toast-progress-fill { background: var(--token-success); }
153
+ .toast.err .toast-progress-fill { background: var(--token-error); }
154
+ .toast.warn .toast-progress-fill { background: var(--token-warning); }
155
+ @keyframes toast-countdown {
156
+ from { transform: scaleX(1); }
157
+ to { transform: scaleX(0); }
158
+ }
159
+
160
+ .toast { position: relative; overflow: hidden; }
161
+
162
+ /* 容器定位变体 */
163
+ .toast-container[data-position='top-left'] {
164
+ right: auto;
165
+ bottom: auto;
166
+ top: var(--density-space-md);
167
+ left: var(--density-space-md);
168
+ align-items: flex-start;
169
+ }
170
+ .toast-container[data-position='top-right'] {
171
+ bottom: auto;
172
+ top: var(--density-space-md);
173
+ }
174
+ .toast-container[data-position='top-center'] {
175
+ right: auto;
176
+ bottom: auto;
177
+ top: var(--density-space-md);
178
+ left: 50%;
179
+ transform: translateX(-50%);
180
+ align-items: center;
181
+ }
182
+ .toast-container[data-position='bottom-left'] {
183
+ right: auto;
184
+ left: var(--density-space-md);
185
+ align-items: flex-start;
186
+ }
187
+ .toast-container[data-position='bottom-center'] {
188
+ right: auto;
189
+ left: 50%;
190
+ transform: translateX(-50%);
191
+ align-items: center;
192
+ }
193
+
80
194
  .toast.leaving {
81
195
  opacity: 0;
82
196
  transform: translateY(8px);
@@ -0,0 +1,101 @@
1
+ /*
2
+ * @icen.ai/ui — Component: toolbar(工具条)
3
+ *
4
+ * 横向承载按钮 / 控件的容器,常用于编辑器顶栏、列表上方操作行、表格批量操作条。
5
+ * 与 segmented 的区别:
6
+ * - segmented = 紧贴的互斥分段选择
7
+ * - toolbar = 宽松的按钮/控件容器,可分组、可分隔、可换行
8
+ *
9
+ * 完整契约:
10
+ * <div class="toolbar [--sm|--lg] [--wrap] [--borderless]">
11
+ * <button class="btn btn-sm">…</button>
12
+ * <div class="toolbar-group">
13
+ * <button class="btn btn-sm">…</button>
14
+ * <button class="btn btn-sm">…</button>
15
+ * </div>
16
+ * <span class="toolbar-separator"></span>
17
+ * <div class="toolbar-spacer"></div> ← 弹性占位,把右侧元素推到末尾
18
+ * <span class="toolbar-label">3 项</span>
19
+ * </div>
20
+ *
21
+ * 编辑器顶栏(与 fixed 子项配套):
22
+ * <div class="toolbar toolbar--elevated">
23
+ * …
24
+ * </div>
25
+ */
26
+
27
+ .toolbar {
28
+ display: flex;
29
+ align-items: center;
30
+ gap: var(--density-space-sm);
31
+ flex-wrap: nowrap;
32
+ padding: var(--density-space-sm);
33
+ background: var(--token-bg-soft);
34
+ border: 1px solid var(--token-line-soft);
35
+ border-radius: var(--radius-md);
36
+ }
37
+ .toolbar--wrap { flex-wrap: wrap; }
38
+ .toolbar--borderless {
39
+ background: transparent;
40
+ border-color: transparent;
41
+ padding: 0;
42
+ }
43
+ .toolbar--elevated {
44
+ background: var(--token-card-strong);
45
+ border-color: var(--token-outline-soft);
46
+ box-shadow: var(--token-shadow-elevated);
47
+ }
48
+
49
+ /* ── 尺寸 ── */
50
+ .toolbar--sm { padding: 4px var(--density-space-xs); gap: var(--density-space-xs); }
51
+ .toolbar--lg { padding: var(--density-space-md); gap: var(--density-space-md); }
52
+
53
+ /* ── 分组(紧贴一组按钮) ── */
54
+ .toolbar-group {
55
+ display: inline-flex;
56
+ align-items: center;
57
+ gap: 2px;
58
+ padding: 2px;
59
+ background: var(--token-fill-1);
60
+ border-radius: var(--radius-sm);
61
+ }
62
+ .toolbar-group > .btn { border-color: transparent; background: transparent; }
63
+ .toolbar-group > .btn:hover { background: var(--token-fill-2); }
64
+
65
+ /* ── 分隔符 ── */
66
+ .toolbar-separator {
67
+ width: 1px;
68
+ height: 20px;
69
+ background: var(--token-line-soft);
70
+ flex-shrink: 0;
71
+ }
72
+ .toolbar--sm .toolbar-separator { height: 16px; }
73
+ .toolbar--lg .toolbar-separator { height: 24px; }
74
+
75
+ /* 水平工具条里的垂直分隔(用于纵向 toolbar) */
76
+ .toolbar--vertical { flex-direction: column; align-items: stretch; }
77
+ .toolbar--vertical .toolbar-separator {
78
+ width: auto;
79
+ height: 1px;
80
+ margin: var(--density-space-xs) 0;
81
+ }
82
+
83
+ /* ── 弹性占位 ── */
84
+ .toolbar-spacer { flex: 1 1 auto; min-width: var(--density-space-xs); }
85
+
86
+ /* ── 内嵌文字(计数 / 状态) ── */
87
+ .toolbar-label {
88
+ font-size: var(--density-font-size-sm);
89
+ color: var(--token-text-muted);
90
+ font-variant-numeric: tabular-nums;
91
+ white-space: nowrap;
92
+ }
93
+ .toolbar-label.accent { color: var(--token-accent); }
94
+
95
+ @media (max-width: 480px) {
96
+ .toolbar { flex-wrap: wrap; }
97
+ }
98
+
99
+ @media (prefers-reduced-motion: reduce) {
100
+ .toolbar * { transition: none !important; }
101
+ }
@@ -0,0 +1,2 @@
1
+ // @icen.ai/ui — kit: toolbar(CSS + behavior 一行入口;构建产物,勿手改)
2
+ import './toolbar.css';
@@ -130,12 +130,43 @@
130
130
  border-radius: var(--radius-sm);
131
131
  font-size: var(--density-font-size-sm);
132
132
  animation: upload-item-in var(--icen-tx-fast);
133
+ transition: border-color var(--icen-tx-fast);
133
134
  }
134
- .upload-list-item-name {
135
+ .upload-list-item:hover {
136
+ border-color: var(--token-outline);
137
+ }
138
+ .upload-list-item-thumb {
139
+ width: 32px;
140
+ height: 32px;
141
+ object-fit: cover;
142
+ border-radius: var(--radius-xs);
143
+ flex-shrink: 0;
144
+ background: var(--token-bg-soft);
145
+ }
146
+ .upload-list-item-icon {
147
+ display: inline-flex;
148
+ align-items: center;
149
+ justify-content: center;
150
+ width: 32px;
151
+ height: 32px;
152
+ flex-shrink: 0;
153
+ border-radius: var(--radius-xs);
154
+ background: var(--token-fill-1);
155
+ color: var(--token-text-faint);
156
+ }
157
+ .upload-list-item-icon svg { width: 16px; height: 16px; }
158
+ .upload-list-item-info {
135
159
  flex: 1;
160
+ min-width: 0;
161
+ display: flex;
162
+ flex-direction: column;
163
+ gap: 1px;
164
+ }
165
+ .upload-list-item-name {
136
166
  overflow: hidden;
137
167
  text-overflow: ellipsis;
138
168
  white-space: nowrap;
169
+ color: var(--token-text);
139
170
  }
140
171
  .upload-list-item-size {
141
172
  color: var(--token-text-faint);
@@ -147,20 +178,46 @@
147
178
  background: transparent;
148
179
  cursor: pointer;
149
180
  color: var(--token-text-faint);
150
- padding: 2px;
181
+ padding: 4px;
151
182
  border-radius: var(--radius-full);
152
183
  display: inline-flex;
184
+ align-items: center;
185
+ justify-content: center;
186
+ flex-shrink: 0;
153
187
  transition: color var(--icen-tx-fast), background-color var(--icen-tx-fast);
154
188
  }
155
189
  .upload-list-item-x:hover {
156
- color: var(--token-text);
157
- background: var(--token-fill-2);
190
+ color: var(--token-error);
191
+ background: var(--token-error-muted);
158
192
  }
159
193
  .upload-list-item-x:focus-visible {
160
194
  outline: none;
161
195
  box-shadow: var(--icen-ring);
162
196
  }
163
197
 
198
+ /* 进度条(behavior 可选注入 .upload-list-item-progress) */
199
+ .upload-list-item-progress {
200
+ height: 2px;
201
+ width: 100%;
202
+ background: var(--token-fill-2);
203
+ border-radius: var(--radius-full);
204
+ overflow: hidden;
205
+ margin-top: 2px;
206
+ }
207
+ .upload-list-item-progress-bar {
208
+ height: 100%;
209
+ background: var(--token-accent);
210
+ border-radius: var(--radius-full);
211
+ transition: width var(--icen-tx-normal) var(--ease-out);
212
+ }
213
+ .upload-list-item.is-error {
214
+ border-color: var(--token-error);
215
+ }
216
+ .upload-list-item.is-error .upload-list-item-icon {
217
+ background: var(--token-error-muted);
218
+ color: var(--token-error);
219
+ }
220
+
164
221
  @keyframes upload-item-in {
165
222
  from { opacity: 0; transform: translateY(-4px); }
166
223
  to { opacity: 1; transform: translateY(0); }