soma-kit 0.1.12 → 0.1.14
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/README.md +5 -4
- package/bin/soma-kit.mjs +31 -1
- package/bin/soma.mjs +0 -0
- package/package.json +5 -4
- package/spec/generated/kit-app.schema.json +172 -4
- package/spec/generated/kit-page.schema.json +164 -5
- package/spec/kit-grammar.json +598 -96
- package/spec/kit-grammar.schema.json +12 -6
- package/src/app/app-config.ts +92 -8
- package/src/app/component-gate.ts +271 -13
- package/src/app/define-kit-app.ts +2 -2
- package/src/app/define-kit-view.ts +9 -5
- package/src/app/dev-diagnostic.ts +5 -0
- package/src/app/index.ts +29 -5
- package/src/app/kit-view-context.ts +181 -15
- package/src/app/render-ports.ts +18 -0
- package/src/app/server-pages.ts +8 -2
- package/src/app/server.ts +55 -8
- package/src/app/theme-runtime.ts +4 -0
- package/src/base/action-busy.ts +101 -4
- package/src/base/action-slots.ts +13 -2
- package/src/base/anchored-layer.ts +50 -0
- package/src/base/button.ts +62 -15
- package/src/base/check-core.ts +8 -0
- package/src/base/checkbox.ts +2 -1
- package/src/base/choice.ts +21 -2
- package/src/base/color-picker.ts +10 -5
- package/src/base/command-palette.ts +1 -1
- package/src/base/context-menu.ts +10 -7
- package/src/base/date-range.ts +7 -7
- package/src/base/date.ts +55 -16
- package/src/base/delta.ts +72 -0
- package/src/base/end-edge.ts +61 -0
- package/src/base/fab.ts +1 -1
- package/src/base/gap-value.ts +168 -0
- package/src/base/hint-tips.ts +170 -0
- package/src/base/icons.ts +8 -0
- package/src/base/illustrations.ts +95 -0
- package/src/base/index.ts +32 -9
- package/src/base/listbox-core.ts +6 -5
- package/src/base/loading-gate.ts +140 -87
- package/src/base/mentions.ts +2 -1
- package/src/base/menu-button.ts +16 -18
- package/src/base/menu-core.ts +37 -8
- package/src/base/motion/hover-3d.ts +1 -1
- package/src/base/motion/marquee.ts +1 -1
- package/src/base/otp.ts +5 -4
- package/src/base/overlay-runtime.ts +235 -0
- package/src/base/popover.ts +10 -9
- package/src/base/popup.ts +67 -8
- package/src/base/portal-core.ts +4 -0
- package/src/base/qty-stepper.ts +5 -5
- package/src/base/radio.ts +2 -1
- package/src/base/range.ts +19 -2
- package/src/base/rating.ts +11 -6
- package/src/base/reason-tip.ts +150 -0
- package/src/base/segmented.ts +36 -24
- package/src/base/shared.ts +180 -36
- package/src/base/state-panel.ts +367 -0
- package/src/base/status-tone.ts +27 -0
- package/src/base/sticky-edge.ts +116 -0
- package/src/base/swap.ts +6 -6
- package/src/base/switch.ts +10 -5
- package/src/base/tag-input.ts +6 -6
- package/src/base/tag.ts +76 -41
- package/src/base/text.ts +43 -14
- package/src/base/time-picker.ts +7 -5
- package/src/base/tree-select.ts +6 -4
- package/src/base/trend-tone.ts +9 -0
- package/src/base/upload.ts +15 -9
- package/src/base/view-transition.ts +77 -0
- package/src/biz/approval-desk/shell.ts +15 -11
- package/src/biz/auth-panel/shell.ts +9 -7
- package/src/biz/category-crud/compile.ts +5 -4
- package/src/biz/category-crud/shell.ts +5 -3
- package/src/biz/checkout-page/compile.ts +2 -1
- package/src/biz/checkout-page/shell.ts +10 -8
- package/src/biz/compose.ts +2 -2
- package/src/biz/data-components.ts +4 -0
- package/src/biz/import-wizard/shell.ts +13 -10
- package/src/biz/landing-page/shell.ts +2 -2
- package/src/biz/link/hub.ts +23 -5
- package/src/biz/link/shared.ts +23 -12
- package/src/biz/master-sub/compile.ts +207 -16
- package/src/biz/master-sub/detail-head.ts +61 -0
- package/src/biz/master-sub/index.ts +7 -3
- package/src/biz/master-sub/shell.ts +133 -24
- package/src/biz/multi-board/compile.ts +167 -9
- package/src/biz/multi-board/composition.ts +58 -0
- package/src/biz/multi-board/index.ts +1 -1
- package/src/biz/multi-board/prose-fold.ts +143 -0
- package/src/biz/multi-board/shell.ts +94 -23
- package/src/biz/notification-center/shell.ts +10 -7
- package/src/biz/page-templates/domain-templates.ts +2 -2
- package/src/biz/page-templates/result-page/shell.ts +4 -3
- package/src/biz/page-templates/sign-in-page/shell.ts +16 -16
- package/src/biz/record-detail/compile.ts +2 -2
- package/src/biz/record-detail/shell.ts +13 -10
- package/src/biz/settings-center/compile.ts +2 -1
- package/src/biz/settings-center/shell.ts +12 -9
- package/src/biz/shared/action-host.ts +6 -0
- package/src/biz/shared/compile-helpers.ts +97 -0
- package/src/biz/shared/coordinator.ts +7 -30
- package/src/biz/shared/index.ts +5 -0
- package/src/biz/shared/object-aliases.ts +154 -0
- package/src/biz/shared/overlay-compile.ts +281 -0
- package/src/biz/shared/overlay-shell.ts +142 -11
- package/src/biz/shared/pipes.ts +11 -5
- package/src/biz/shared/remove-wire.ts +4 -19
- package/src/biz/shared/runtime-hub.ts +10 -0
- package/src/biz/single-form/compile.ts +3 -2
- package/src/biz/single-form/shell.ts +9 -6
- package/src/biz/standard-crud/compile.ts +36 -161
- package/src/biz/standard-crud/shell.ts +23 -60
- package/src/biz/standard-crud/summary.ts +40 -0
- package/src/biz/step-form/shell.ts +15 -13
- package/src/biz/types.ts +6 -1
- package/src/cli/kit-cli.ts +138 -13
- package/src/cli/kit-init.ts +6 -1
- package/src/cli/layout-cli.ts +167 -0
- package/src/cli/migrate/index.ts +10 -0
- package/src/cli/migrate/migrate.ts +248 -0
- package/src/cli/migrate/text-utils.ts +306 -0
- package/src/cli/migrate/theme-map.ts +104 -0
- package/src/cli/migrate/ts-rules.ts +235 -0
- package/src/cli/migrate/types.ts +95 -0
- package/src/cli/migrate/view-skeleton.ts +159 -0
- package/src/cli/migrate/yaml-report.ts +376 -0
- package/src/cli/migrate/yaml-rules.ts +465 -0
- package/src/cli/view-writes.ts +69 -60
- package/src/compile/access-gate-attach.ts +27 -0
- package/src/compile/closed-set.ts +65 -4
- package/src/compile/compile-page.ts +66 -11
- package/src/compile/component-candidates.ts +14 -1
- package/src/compile/fragment.ts +11 -0
- package/src/compile/layout-lint/engine.ts +82 -0
- package/src/compile/layout-lint/index.ts +55 -0
- package/src/compile/layout-lint/rules-composition.ts +267 -0
- package/src/compile/layout-lint/rules-form.ts +191 -0
- package/src/compile/layout-lint/rules-table.ts +278 -0
- package/src/compile/layout-lint/score.ts +52 -0
- package/src/compile/layout-lint/types.ts +51 -0
- package/src/compile/page-composition.ts +189 -0
- package/src/compile/parse.ts +4 -0
- package/src/compile/producer-fingerprint.ts +56 -0
- package/src/compile/remove-guard.ts +10 -7
- package/src/compile/styles.ts +46 -8
- package/src/compile/types.ts +16 -2
- package/src/compile/view-check.ts +149 -16
- package/src/data/access-gate.ts +112 -0
- package/src/data/amount-breakdown.ts +9 -2
- package/src/data/approval-flow.ts +5 -2
- package/src/data/assignment-picker.ts +59 -28
- package/src/data/async-result-panel.ts +49 -3
- package/src/data/breadcrumbs.ts +3 -2
- package/src/data/calendar.ts +8 -3
- package/src/data/carousel.ts +10 -6
- package/src/data/chart.ts +744 -46
- package/src/data/checklist.ts +22 -6
- package/src/data/code-view.ts +8 -4
- package/src/data/comment-thread.ts +3 -2
- package/src/data/confirm-dialog.ts +72 -25
- package/src/data/context-menu.ts +3 -3
- package/src/data/dock.ts +1 -1
- package/src/data/embed.ts +231 -29
- package/src/data/field-mapper.ts +7 -4
- package/src/data/flow-editor-contract.ts +7 -0
- package/src/data/flow-editor.ts +26 -9
- package/src/data/flow-node-options.ts +33 -3
- package/src/data/footer.ts +2 -0
- package/src/data/gantt.ts +192 -27
- package/src/data/hero.ts +4 -1
- package/src/data/image-viewer.ts +7 -4
- package/src/data/index.ts +16 -4
- package/src/data/item-list.ts +27 -12
- package/src/data/kanban.ts +41 -10
- package/src/data/matrix.ts +391 -0
- package/src/data/media-grid.ts +6 -1
- package/src/data/mega-menu.ts +6 -4
- package/src/data/menu-dom.ts +4 -2
- package/src/data/menu.ts +60 -16
- package/src/data/mockup.ts +5 -1
- package/src/data/modal-dialog.ts +146 -26
- package/src/data/navbar.ts +8 -6
- package/src/data/notice-list.ts +301 -0
- package/src/data/notify-renderer.ts +21 -6
- package/src/data/object-form.ts +409 -87
- package/src/data/outcome-watch.ts +61 -2
- package/src/data/pager.ts +19 -8
- package/src/data/panel-head.ts +406 -0
- package/src/data/permission-matrix.ts +36 -11
- package/src/data/permission-tree.ts +52 -23
- package/src/data/pricing-table.ts +22 -11
- package/src/data/prompt-dialog.ts +165 -0
- package/src/data/reaction-bar.ts +6 -4
- package/src/data/record-card.ts +40 -7
- package/src/data/record-picker.ts +13 -7
- package/src/data/resident.ts +8 -0
- package/src/data/result-panel.ts +4 -2
- package/src/data/rich-text.ts +17 -1
- package/src/data/row-editor.ts +77 -24
- package/src/data/rule-builder.ts +14 -9
- package/src/data/shape-util.ts +27 -12
- package/src/data/stat-group.ts +459 -74
- package/src/data/static-lazy.ts +5 -0
- package/src/data/static-registry.ts +8 -0
- package/src/data/steps.ts +8 -3
- package/src/data/survey.ts +7 -4
- package/src/data/system-switcher.ts +3 -2
- package/src/data/text-action-button.ts +17 -0
- package/src/data/timeline.ts +17 -6
- package/src/data/tour-guide.ts +3 -2
- package/src/data/transfer.ts +40 -16
- package/src/data/tree-table.ts +65 -37
- package/src/data/tree.ts +22 -2
- package/src/data/virtual-rows.ts +21 -11
- package/src/data/wrapped-candidates.ts +32 -1
- package/src/frames/index.ts +1 -0
- package/src/frames/list-summary.ts +100 -0
- package/src/frames/page-bar.ts +7 -14
- package/src/frames/page-status.ts +7 -5
- package/src/frames/shared.ts +34 -13
- package/src/frames/split-frame/shell.ts +1 -1
- package/src/frames/tabs-frame/shell.ts +9 -6
- package/src/frames/tabs-frame/wiring.ts +1 -0
- package/src/frames/top-main-frame.ts +3 -3
- package/src/frames/types.ts +3 -1
- package/src/frames/workspace-frame/extras.ts +1 -1
- package/src/frames/workspace-frame/shell.ts +4 -4
- package/src/frames/workspace-frame/tab-scroll.ts +28 -0
- package/src/frames/workspace-frame/view.ts +168 -44
- package/src/generated/kit-grammar-runtime.ts +390 -59
- package/src/i18n/kit-text.ts +90 -4
- package/src/i18n/resolve-text-refs.ts +22 -6
- package/src/object-renderer/action-group.ts +139 -0
- package/src/object-renderer/action-more.ts +144 -0
- package/src/object-renderer/arrange.ts +71 -7
- package/src/object-renderer/candidates.ts +4 -0
- package/src/object-renderer/collection-parts.ts +264 -62
- package/src/object-renderer/collection-table.ts +177 -5
- package/src/object-renderer/collection.ts +188 -37
- package/src/object-renderer/compile-data.ts +28 -3
- package/src/object-renderer/defaults.ts +27 -2
- package/src/object-renderer/display-checks.ts +1 -1
- package/src/object-renderer/emit-events.ts +43 -9
- package/src/object-renderer/emit-object.ts +4 -0
- package/src/object-renderer/emit-static.ts +434 -41
- package/src/object-renderer/filter-plan.ts +84 -0
- package/src/object-renderer/form-detail.ts +1 -2
- package/src/object-renderer/form-notify.ts +45 -0
- package/src/object-renderer/index.ts +5 -0
- package/src/object-renderer/layout-facts.ts +394 -0
- package/src/object-renderer/layout-plan.ts +225 -0
- package/src/object-renderer/layout-plan.types.ts +59 -0
- package/src/object-renderer/parts.ts +6 -7
- package/src/object-renderer/render-object.ts +107 -46
- package/src/object-renderer/request-actions.ts +4 -2
- package/src/object-renderer/skeleton.ts +58 -19
- package/src/object-renderer/table-actions.ts +172 -32
- package/src/object-renderer/table-gap.ts +37 -0
- package/src/object-renderer/table-tools.ts +62 -30
- package/src/object-renderer/types.ts +84 -13
- package/src/object-renderer/view-binding.ts +205 -8
- package/src/page-target/intent-schema.ts +11 -0
- package/src/page-target/target.ts +5 -1
- package/src/recipes/container.ts +77 -1
- package/src/recipes/control.ts +76 -116
- package/src/recipes/emphasis.ts +56 -0
- package/src/recipes/frame-bleed.ts +33 -0
- package/src/recipes/index.ts +72 -0
- package/src/recipes/nowrap.ts +16 -0
- package/src/recipes/overlay.ts +120 -17
- package/src/recipes/placeholder.ts +95 -0
- package/src/recipes/rail-grid.ts +48 -0
- package/src/recipes/slot-align.ts +56 -0
- package/src/recipes/stat-state.ts +65 -0
- package/src/recipes/state.ts +40 -21
- package/src/recipes/status.ts +147 -0
- package/src/recipes/surface-edge.ts +16 -0
- package/src/recipes/surface.ts +40 -0
- package/src/recipes/table-gap.ts +80 -0
- package/src/recipes/table-native-edit.ts +242 -0
- package/src/recipes/table-row.ts +146 -3
- package/src/recipes/tabs.ts +49 -0
- package/src/recipes/title-row.ts +37 -0
- package/src/recipes/typography.ts +30 -37
- package/src/shared/confirm-decl.ts +118 -0
- package/src/shared/envelope.ts +2 -2
- package/src/shared/paged-list-adapter.ts +15 -240
- package/src/shared/theme-runtime-shared.ts +6 -1
- package/src/theme/index.ts +1 -0
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +384 -13
- package/src/theme/kit-theme.tpl +384 -13
- package/src/theme/nine-dim-structure.ts +244 -7
- package/src/theme/surface-layers.ts +10 -1
- package/src/theme/theme-tokens.ts +63 -16
- package/src/theme/theme-types.ts +32 -0
- package/src/theme/typography.ts +21 -17
- package/src/biz/shared/remove-key.ts +0 -6
package/src/data/checklist.ts
CHANGED
|
@@ -9,7 +9,12 @@
|
|
|
9
9
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
10
10
|
import { bool, createKitController, joinClass, str } from '../base/shared';
|
|
11
11
|
import { createCheck, markInput } from '../base/check-core';
|
|
12
|
+
import { kitIcon } from '../base/icons';
|
|
13
|
+
import { mergeClass } from '../object-renderer/merge-class';
|
|
14
|
+
import { kitStateMarkRecipe } from '../recipes/state';
|
|
12
15
|
import { kitText } from '../i18n/kit-text';
|
|
16
|
+
import { markKitEdge } from '../recipes/surface-edge';
|
|
17
|
+
import { kitTypographyRecipe } from '../recipes/typography';
|
|
13
18
|
import {
|
|
14
19
|
actionButton, actionsOf, BADGE_BASE, BUTTON_CLASS_TOKENS, classTokens, emptyNode, keyMap, mk, mkProgressBar, PROGRESS_BAR_CLASS_TOKENS, recOf, setProgressBar, rowsOf, shapeToneOf, textOf,
|
|
15
20
|
TONE_SOFT,
|
|
@@ -22,23 +27,24 @@ export type KitCheckStatus = 'done' | 'blocked' | 'pending';
|
|
|
22
27
|
|
|
23
28
|
const ROOT_CLASS = 'flex flex-col gap-3 rounded-lg border border-border-subtle bg-surface p-5 text-sm text-fg';
|
|
24
29
|
const HEAD_CLASS = 'flex flex-wrap items-center gap-2';
|
|
25
|
-
const TITLE_CLASS = '
|
|
30
|
+
const TITLE_CLASS = kitTypographyRecipe('sectionTitle');
|
|
26
31
|
const COUNT_CLASS = 'ms-auto text-xs text-fg-muted';
|
|
27
32
|
const PROGRESS_CLASS = 'block w-full';
|
|
28
33
|
const LIST_CLASS = 'flex flex-col gap-1';
|
|
29
|
-
const ITEM_CLASS = 'flex items-start gap-2 rounded-md px-2 py-1.5 transition-colors hover:bg-
|
|
34
|
+
const ITEM_CLASS = 'flex items-start gap-2 rounded-md px-2 py-1.5 transition-colors hover:bg-state-layer-hover active:bg-state-layer-press';
|
|
30
35
|
const BOX_CLASS = 'mt-0.5 shrink-0';
|
|
31
36
|
const MARK_CLASS = 'mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-sm text-xs font-semibold';
|
|
32
37
|
const BODY_CLASS = 'flex flex-1 flex-col gap-0.5';
|
|
33
38
|
const LABEL_CLASS = 'text-fg';
|
|
34
|
-
|
|
39
|
+
// 只读态的状态标记(状态呈现表 readonly:不置灰、不画禁用控件、不加删除线):done = 成功软底 + 对勾,todo = 空心圆;类串取配方 kitStateMarkRecipe
|
|
40
|
+
const STATE_MARK_OFFSET = 'mt-0.5';
|
|
35
41
|
const NOTE_CLASS = 'text-xs text-fg-subtle';
|
|
36
42
|
const BLOCK_NOTE = 'rounded-md px-2 py-0.5 text-xs';
|
|
37
43
|
const FOOT_CLASS = 'flex flex-wrap items-center justify-end gap-2';
|
|
38
44
|
|
|
39
45
|
export const KIT_CHECKLIST_CLASS_CANDIDATES: readonly string[] = classTokens(
|
|
40
46
|
ROOT_CLASS, HEAD_CLASS, TITLE_CLASS, COUNT_CLASS, PROGRESS_CLASS, LIST_CLASS, ITEM_CLASS, BOX_CLASS, MARK_CLASS, BODY_CLASS,
|
|
41
|
-
LABEL_CLASS,
|
|
47
|
+
LABEL_CLASS, STATE_MARK_OFFSET, kitStateMarkRecipe('done'), kitStateMarkRecipe('todo'), NOTE_CLASS, BLOCK_NOTE, FOOT_CLASS, BADGE_BASE, BUTTON_CLASS_TOKENS, TONE_SOFT.danger, TONE_SOFT.neutral,
|
|
42
48
|
Object.values(TONE_SOFT), PROGRESS_BAR_CLASS_TOKENS,
|
|
43
49
|
);
|
|
44
50
|
|
|
@@ -154,6 +160,7 @@ export function createChecklist(): SomaComponentDefinition {
|
|
|
154
160
|
const items = checkItemsOf(data[m.items], p.item_map, noReason, st.overrides);
|
|
155
161
|
|
|
156
162
|
root.className = joinClass(ROOT_CLASS, p.class);
|
|
163
|
+
markKitEdge(root);
|
|
157
164
|
root.textContent = '';
|
|
158
165
|
|
|
159
166
|
const head = mk('div', HEAD_CLASS);
|
|
@@ -182,9 +189,18 @@ export function createChecklist(): SomaComponentDefinition {
|
|
|
182
189
|
const mark = mk('span', `${MARK_CLASS} ${TONE_SOFT.danger}`, '!');
|
|
183
190
|
mark.setAttribute('aria-hidden', 'true');
|
|
184
191
|
li.appendChild(mark);
|
|
192
|
+
} else if (readonly) {
|
|
193
|
+
// 只读:状态标记,不是禁用的复选框
|
|
194
|
+
const done = it.status === 'done';
|
|
195
|
+
const mark = mk('span', mergeClass(kitStateMarkRecipe(done ? 'done' : 'todo'), STATE_MARK_OFFSET));
|
|
196
|
+
mark.setAttribute('role', 'img');
|
|
197
|
+
mark.setAttribute('data-kit-state-mark', done ? 'done' : 'todo');
|
|
198
|
+
mark.setAttribute('aria-label', kitText(done ? 'soma.kit.checklist_done' : 'soma.kit.checklist_todo', undefined, root));
|
|
199
|
+
if (done) mark.appendChild(kitIcon('check', 'xs'));
|
|
200
|
+
li.appendChild(mark);
|
|
185
201
|
} else {
|
|
186
202
|
// 自绘勾选标记(base/check-core.ts);change 事件的 target 是它里面的原生 input,data-kit-check / aria-label 写在 input 上
|
|
187
|
-
const mark = createCheck(root.ownerDocument, 'checkbox', { checked: it.status === 'done',
|
|
203
|
+
const mark = createCheck(root.ownerDocument, 'checkbox', { checked: it.status === 'done', extra: BOX_CLASS });
|
|
188
204
|
const box = markInput(mark);
|
|
189
205
|
if (box) {
|
|
190
206
|
box.setAttribute('data-kit-check', it.key);
|
|
@@ -193,7 +209,7 @@ export function createChecklist(): SomaComponentDefinition {
|
|
|
193
209
|
li.appendChild(mark);
|
|
194
210
|
}
|
|
195
211
|
const body = mk('div', BODY_CLASS);
|
|
196
|
-
body.appendChild(mk('span',
|
|
212
|
+
body.appendChild(mk('span', LABEL_CLASS, it.label));
|
|
197
213
|
if (it.status === 'blocked') {
|
|
198
214
|
body.appendChild(mk('span', `${BLOCK_NOTE} ${TONE_SOFT.danger}`, `${str(p.blocked_text, kitText('soma.kit.flowstat_blocked', undefined, root))}${kitText('soma.kit.colon', undefined, root)}${it.note}`));
|
|
199
215
|
} else if (it.note !== '') {
|
package/src/data/code-view.ts
CHANGED
|
@@ -31,7 +31,9 @@ const EMPTY_CLASS = 'text-fg-subtle';
|
|
|
31
31
|
const CAPTION_CLASS = 'text-xs text-fg-subtle';
|
|
32
32
|
|
|
33
33
|
// variants:同一块位置按页签切换多份文本(如同一服务的多个客户端配置)
|
|
34
|
-
|
|
34
|
+
// 页签行可收缩(min-w-0 flex-1):窄容器里页签自己换行,让位给右侧「复制」钮,钮文案不折行
|
|
35
|
+
const TABS_CLASS = 'flex min-w-0 flex-1 flex-wrap gap-1 border-b border-border-subtle';
|
|
36
|
+
const HEAD_END_BUTTON = 'shrink-0';
|
|
35
37
|
const TAB_CLASS = 'h-8 -mb-px border-b-2 border-transparent bg-transparent px-3 text-sm text-fg-muted hover:text-fg motion-safe:transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
36
38
|
const TAB_ACTIVE_CLASS = 'border-primary font-medium text-fg';
|
|
37
39
|
|
|
@@ -78,7 +80,7 @@ export function codeVariantsFromProps(p: Record<string, unknown>): KitCodeVarian
|
|
|
78
80
|
|
|
79
81
|
// tree:JSON 树(自绘 disclosure:标题 button + aria-expanded / aria-controls,Enter / Space 由 button 触发点击切换)
|
|
80
82
|
const TREE_CLASS = 'm-0 rounded-md border border-border-subtle bg-surface-sunken p-3 font-mono text-xs text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
81
|
-
const TREE_SUMMARY_CLASS = 'block w-full cursor-pointer select-none rounded-sm bg-transparent p-0 text-start font-mono text-xs text-fg hover:bg-
|
|
83
|
+
const TREE_SUMMARY_CLASS = 'block w-full cursor-pointer select-none rounded-sm bg-transparent p-0 text-start font-mono text-xs text-fg hover:bg-state-layer-hover active:bg-state-layer-press focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring';
|
|
82
84
|
const TREE_CHILDREN_CLASS = 'ms-3 border-s border-border-subtle ps-3';
|
|
83
85
|
const TREE_LEAF_CLASS = 'py-0.5 break-all';
|
|
84
86
|
const TREE_KEY_CLASS = 'text-fg-muted';
|
|
@@ -93,7 +95,7 @@ let treeSeq = 0;
|
|
|
93
95
|
export const KIT_CODE_VIEW_CLASS_CANDIDATES: readonly string[] = classTokens(
|
|
94
96
|
TREE_CLASS, TREE_SUMMARY_CLASS, TREE_CHILDREN_CLASS, TREE_LEAF_CLASS, TREE_KEY_CLASS, TREE_MARK_CLASS, TREE_HIDDEN_CLASS, Object.values(TREE_VALUE_CLASS), TREE_MORE_CLASS,
|
|
95
97
|
ROOT_CLASS, HEAD_CLASS, TITLE_CLASS, KIT_CODE_PRE_CLASS, Object.values(PRE_HEIGHT), EMPTY_CLASS, CAPTION_CLASS, BUTTON_CLASS_TOKENS,
|
|
96
|
-
TABS_CLASS, TAB_CLASS, TAB_ACTIVE_CLASS,
|
|
98
|
+
TABS_CLASS, TAB_CLASS, TAB_ACTIVE_CLASS, HEAD_END_BUTTON,
|
|
97
99
|
);
|
|
98
100
|
|
|
99
101
|
/** 展示文本(纯函数,便于单测):字符串原样,其余 JSON 缩进;不可序列化回空串 */
|
|
@@ -378,7 +380,9 @@ export function createCodeView(): SomaComponentDefinition {
|
|
|
378
380
|
head.appendChild(tabs);
|
|
379
381
|
} else head.appendChild(mk('span', TITLE_CLASS, title));
|
|
380
382
|
if (copyable) {
|
|
381
|
-
|
|
383
|
+
const copyBtn = actionButton({ key: 'copy', label: str(p.copy_label, kitText('soma.kit.copy', undefined, root)), tone: 'neutral', disabled: text === '', reason: '' });
|
|
384
|
+
copyBtn.classList.add(HEAD_END_BUTTON);
|
|
385
|
+
head.appendChild(copyBtn);
|
|
382
386
|
}
|
|
383
387
|
root.appendChild(head);
|
|
384
388
|
}
|
|
@@ -11,6 +11,7 @@ import { matchSubmitKey } from 'soma-core/keyboard';
|
|
|
11
11
|
import { bool, createKitController, formatValue, joinClass, num, str } from '../base/shared';
|
|
12
12
|
import { kitText } from '../i18n/kit-text';
|
|
13
13
|
import { setKitFace } from '../recipes';
|
|
14
|
+
import { kitEmphasisButtonRecipe } from '../recipes/emphasis';
|
|
14
15
|
import { actionButton, BUTTON_CLASS_TOKENS, classTokens, emptyNode, keyMap, mk, rowsOf, textOf, TONE_SOFT } from './shape-util';
|
|
15
16
|
import { AVATAR_CLASS_TOKENS, avatarNode } from './d9-util';
|
|
16
17
|
import { CHAT_MAX_LENGTH, CHAT_MAX_MESSAGES, CHAT_STATUSES } from './d9-limits';
|
|
@@ -30,7 +31,7 @@ const CHAT_META = 'flex items-center gap-2 px-1 text-xs text-fg-subtle';
|
|
|
30
31
|
const CHAT_META_FAILED = 'flex items-center gap-2 px-1 text-xs text-danger-on-soft';
|
|
31
32
|
const CHAT_RETRY = 'rounded-md text-danger-on-soft underline transition-colors hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
32
33
|
const CHAT_LIST = 'flex flex-col gap-4 overflow-y-auto';
|
|
33
|
-
const CHAT_ATTACH = '
|
|
34
|
+
const CHAT_ATTACH = kitEmphasisButtonRecipe('button.toolbar');
|
|
34
35
|
const CHAT_CLASS_TOKENS = classTokens(
|
|
35
36
|
CHAT_MSG, CHAT_MSG_MINE, CHAT_COL, CHAT_COL_MINE, CHAT_NAME, CHAT_BUBBLE, CHAT_THEM, CHAT_ME, CHAT_META, CHAT_META_FAILED, CHAT_RETRY,
|
|
36
37
|
CHAT_LIST, CHAT_ATTACH, AVATAR_CLASS_TOKENS,
|
|
@@ -49,7 +50,7 @@ const TEXT_CLASS = 'whitespace-pre-wrap text-fg';
|
|
|
49
50
|
const ROW_ACTIONS = 'flex items-center gap-3 text-xs';
|
|
50
51
|
const LINK_BUTTON = 'rounded-md text-fg-muted transition-colors hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
51
52
|
const COMPOSER_CLASS = 'flex flex-col gap-2';
|
|
52
|
-
const INPUT_CLASS = 'w-full appearance-none autofill-clear resize-none rounded-md border border-border bg-surface px-3 py-2 text-sm text-fg transition-colors
|
|
53
|
+
const INPUT_CLASS = 'w-full appearance-none autofill-clear resize-none rounded-md border border-border bg-surface px-3 py-2 text-sm text-fg transition-colors state-layer disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
53
54
|
const COMPOSER_FOOT = 'flex items-center justify-between gap-2';
|
|
54
55
|
const COUNTER_CLASS = 'text-xs text-fg-subtle';
|
|
55
56
|
|
|
@@ -4,29 +4,29 @@
|
|
|
4
4
|
// - 返回 Promise<boolean>:确认 = true;取消 / Esc / 点遮罩 / 关闭钮 = false。调用方一律 await,不再有同步阻塞;
|
|
5
5
|
// - 文案只用 textContent 写入(含 `{name}` 之类插值后的结果),不经 innerHTML;
|
|
6
6
|
// - tone = 'danger' 时确认钮用 danger 色调,且焦点落在取消钮(误按回车不会执行危险操作);
|
|
7
|
-
// - typedPhrase:要求键入短语才允许确认(确认钮在输入一致前禁用);
|
|
7
|
+
// - typedPhrase:要求键入短语才允许确认(确认钮在输入一致前禁用);consent:要先勾选「已知晓影响并同意」才允许确认;
|
|
8
|
+
// 两者的判据都是 core 的 confirmSatisfied / confirmKeyAccepts;壳是 alertdialog(名 = 标题,描述 = 正文);
|
|
8
9
|
// - alertOnly:只有一个「确定」钮(取代 window.alert),恒 resolve true。
|
|
9
10
|
// 无 DOM 环境(SSR / 测试)时不弹,直接 resolve whenNoDom(缺省 false)。
|
|
10
11
|
|
|
12
|
+
import type { SomaConfirmSpec } from 'soma-core';
|
|
13
|
+
import { confirmKeyAccepts, confirmSatisfied } from 'soma-core/render-ports';
|
|
14
|
+
import { KIT_CHECK_CLASS_CANDIDATES, createCheck, markInput, setMarkLabel } from '../base/check-core';
|
|
15
|
+
import { nextUid } from '../base/shared';
|
|
11
16
|
import { kitText } from '../i18n/kit-text';
|
|
12
17
|
import { setKitFace } from '../recipes';
|
|
13
18
|
import { KIT_MODAL_CLASS_CANDIDATES, mountKitModal } from './modal-dialog';
|
|
14
|
-
import { BUTTON_CLASS_TOKENS, classTokens, type ActionTone } from './shape-util';
|
|
19
|
+
import { ACTION_BUTTON_TONE, BUTTON_CLASS_TOKENS, classTokens, type ActionTone } from './shape-util';
|
|
15
20
|
|
|
16
|
-
const BUTTON_BASE = 'inline-flex h-9 cursor-pointer items-center justify-center rounded-md px-4 text-sm font-medium transition-colors active:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
17
|
-
const BUTTON_TONE: Readonly<Record<ActionTone, string>> = Object.freeze({
|
|
18
|
-
primary: 'border-0 bg-primary text-primary-fg hover:opacity-90',
|
|
19
|
-
danger: 'border-0 bg-danger text-danger-fg hover:opacity-90',
|
|
20
|
-
neutral: 'border border-border bg-surface text-fg hover:bg-surface-sunken',
|
|
21
|
-
});
|
|
22
21
|
const BUTTON_DISABLED = 'opacity-60 cursor-not-allowed';
|
|
23
22
|
const MESSAGE_CLASS = 'm-0 whitespace-pre-line text-sm text-fg';
|
|
24
23
|
const IMPACT_CLASS = 'm-0 whitespace-pre-line text-xs text-fg-muted';
|
|
25
24
|
const PROMPT_CLASS = 'm-0 text-xs text-fg-muted';
|
|
26
|
-
const INPUT_CLASS = 'h-
|
|
25
|
+
const INPUT_CLASS = 'h-8 w-full rounded-md border border-border bg-surface px-3 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
27
26
|
|
|
28
27
|
export const KIT_CONFIRM_CLASS_CANDIDATES: readonly string[] = classTokens(
|
|
29
|
-
|
|
28
|
+
BUTTON_DISABLED, MESSAGE_CLASS, IMPACT_CLASS, PROMPT_CLASS, INPUT_CLASS, BUTTON_CLASS_TOKENS, KIT_MODAL_CLASS_CANDIDATES,
|
|
29
|
+
KIT_CHECK_CLASS_CANDIDATES,
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
export interface KitConfirmOptions {
|
|
@@ -40,8 +40,10 @@ export interface KitConfirmOptions {
|
|
|
40
40
|
tone?: Extract<ActionTone, 'primary' | 'danger'>;
|
|
41
41
|
confirmLabel?: string;
|
|
42
42
|
cancelLabel?: string;
|
|
43
|
-
/**
|
|
43
|
+
/** 要求键入的短语(一致才可确认;判据同 core 的 confirmSatisfied:首尾空白忽略、区分大小写) */
|
|
44
44
|
typedPhrase?: string;
|
|
45
|
+
/** consent 级:确认前必须先勾选「已知晓影响并同意」(确认钮在勾选前 aria-disabled;影响说明走 impact) */
|
|
46
|
+
consent?: boolean;
|
|
45
47
|
/** 只有「确定」钮(取代 alert) */
|
|
46
48
|
alertOnly?: boolean;
|
|
47
49
|
/** 调用方元素:取页面语言与书写方向,也是回焦参照 */
|
|
@@ -55,12 +57,18 @@ export interface KitConfirmOptions {
|
|
|
55
57
|
function btn(doc: Document, tone: ActionTone, label: string): HTMLButtonElement {
|
|
56
58
|
const b = doc.createElement('button');
|
|
57
59
|
b.type = 'button';
|
|
58
|
-
b.className =
|
|
60
|
+
b.className = ACTION_BUTTON_TONE[tone];
|
|
59
61
|
setKitFace(b, 'raised');
|
|
60
62
|
b.textContent = label;
|
|
61
63
|
return b;
|
|
62
64
|
}
|
|
63
65
|
|
|
66
|
+
/** 命令式对话框共用的按钮 / 输入框(askKitPrompt 复用同一份外观,不另写一套) */
|
|
67
|
+
export const kitDialogButton = btn;
|
|
68
|
+
export const KIT_DIALOG_INPUT_CLASS = INPUT_CLASS;
|
|
69
|
+
export const KIT_DIALOG_MESSAGE_CLASS = MESSAGE_CLASS;
|
|
70
|
+
export const KIT_DIALOG_HINT_CLASS = PROMPT_CLASS;
|
|
71
|
+
|
|
64
72
|
export function askKitConfirm(opts: KitConfirmOptions): Promise<boolean> {
|
|
65
73
|
if (opts.signal?.aborted === true) return Promise.resolve(false);
|
|
66
74
|
if (typeof document === 'undefined' || document.body === null) return Promise.resolve(opts.whenNoDom === true);
|
|
@@ -93,11 +101,21 @@ export function askKitConfirm(opts: KitConfirmOptions): Promise<boolean> {
|
|
|
93
101
|
const msg = doc.createElement('p');
|
|
94
102
|
msg.className = MESSAGE_CLASS;
|
|
95
103
|
msg.textContent = opts.message;
|
|
104
|
+
msg.id = nextUid('kit-confirm-msg');
|
|
96
105
|
modal.body.appendChild(msg);
|
|
106
|
+
// 无障碍:确认框是 alertdialog(要求用户回应),可访问名 = 标题,描述 = 正文;壳由 mountKitModal 画成 dialog,这里改角色
|
|
107
|
+
const panel = modal.body.parentElement;
|
|
108
|
+
if (panel !== null) {
|
|
109
|
+
panel.setAttribute('role', 'alertdialog');
|
|
110
|
+
panel.setAttribute('aria-describedby', msg.id);
|
|
111
|
+
}
|
|
112
|
+
let impactId = '';
|
|
97
113
|
if (opts.impact !== undefined && opts.impact !== '') {
|
|
98
114
|
const impact = doc.createElement('p');
|
|
99
115
|
impact.className = IMPACT_CLASS;
|
|
100
116
|
impact.textContent = opts.impact;
|
|
117
|
+
impact.id = nextUid('kit-confirm-impact');
|
|
118
|
+
impactId = impact.id;
|
|
101
119
|
modal.body.appendChild(impact);
|
|
102
120
|
}
|
|
103
121
|
|
|
@@ -106,9 +124,29 @@ export function askKitConfirm(opts: KitConfirmOptions): Promise<boolean> {
|
|
|
106
124
|
const ok = btn(doc, opts.alertOnly === true ? 'primary' : tone, okLabel);
|
|
107
125
|
let cancel: HTMLButtonElement | null = null;
|
|
108
126
|
let input: HTMLInputElement | null = null;
|
|
127
|
+
let consentBox: HTMLInputElement | null = null;
|
|
128
|
+
|
|
129
|
+
// 确认钮此刻能不能点的判据只有 core 的 confirmSatisfied / confirmKeyAccepts(typed 逐字相等、consent 已勾选)
|
|
130
|
+
const gate: SomaConfirmSpec | null = opts.alertOnly === true ? null
|
|
131
|
+
: opts.typedPhrase !== undefined && opts.typedPhrase !== '' ? { level: 'typed', text: opts.message, phrase: opts.typedPhrase }
|
|
132
|
+
: opts.consent === true ? { level: 'consent', text: opts.message, impact: opts.impact ?? '' }
|
|
133
|
+
: null;
|
|
134
|
+
const gateInput = (): { typed: string; consented: boolean } => ({ typed: input?.value ?? '', consented: consentBox?.checked === true });
|
|
135
|
+
// 未满足:确认钮置灰并标 aria-disabled(原生 disabled 同写,点击 / Enter 都不放行)
|
|
136
|
+
const sync = (): void => {
|
|
137
|
+
if (gate === null) return;
|
|
138
|
+
const met = confirmSatisfied(gate, gateInput());
|
|
139
|
+
ok.disabled = !met;
|
|
140
|
+
if (met) ok.removeAttribute('aria-disabled');
|
|
141
|
+
else ok.setAttribute('aria-disabled', 'true');
|
|
142
|
+
ok.className = `${ACTION_BUTTON_TONE[tone]}${met ? '' : ` ${BUTTON_DISABLED}`}`;
|
|
143
|
+
};
|
|
144
|
+
const onGateKey = (e: KeyboardEvent): void => {
|
|
145
|
+
if (gate !== null && confirmKeyAccepts(e, gate, gateInput())) { e.preventDefault(); finish(true); }
|
|
146
|
+
};
|
|
109
147
|
|
|
110
|
-
if (
|
|
111
|
-
const phrase =
|
|
148
|
+
if (gate?.level === 'typed') {
|
|
149
|
+
const phrase = gate.phrase ?? '';
|
|
112
150
|
const hint = doc.createElement('p');
|
|
113
151
|
hint.className = PROMPT_CLASS;
|
|
114
152
|
hint.textContent = kitText('soma.kit.typed_confirm', { phrase }, opts.at);
|
|
@@ -117,19 +155,28 @@ export function askKitConfirm(opts: KitConfirmOptions): Promise<boolean> {
|
|
|
117
155
|
input.className = INPUT_CLASS;
|
|
118
156
|
setKitFace(input, 'field');
|
|
119
157
|
input.setAttribute('aria-label', hint.textContent);
|
|
158
|
+
if (impactId !== '') input.setAttribute('aria-describedby', impactId);
|
|
120
159
|
input.autocomplete = 'off';
|
|
121
|
-
const sync = (): void => {
|
|
122
|
-
const match = input!.value === phrase;
|
|
123
|
-
ok.disabled = !match;
|
|
124
|
-
ok.className = `${BUTTON_BASE} ${BUTTON_TONE[tone]}${match ? '' : ` ${BUTTON_DISABLED}`}`;
|
|
125
|
-
};
|
|
126
160
|
input.addEventListener('input', sync);
|
|
127
|
-
input.addEventListener('keydown',
|
|
128
|
-
if (e.key === 'Enter' && input!.value === phrase) { e.preventDefault(); finish(true); }
|
|
129
|
-
});
|
|
161
|
+
input.addEventListener('keydown', onGateKey);
|
|
130
162
|
modal.body.append(hint, input);
|
|
131
|
-
|
|
163
|
+
} else if (gate?.level === 'consent') {
|
|
164
|
+
// 勾选框用 kit 的 check-core(原生 input 作行为载体:Space 切换、读屏语义);文案是固定词条,影响说明在上面的段落里
|
|
165
|
+
const mark = createCheck(doc, 'checkbox', { checked: false });
|
|
166
|
+
consentBox = markInput(mark);
|
|
167
|
+
const ack = doc.createElement('span');
|
|
168
|
+
ack.className = MESSAGE_CLASS;
|
|
169
|
+
ack.textContent = kitText('soma.kit.consent_ack', undefined, opts.at);
|
|
170
|
+
mark.appendChild(ack);
|
|
171
|
+
if (consentBox !== null) {
|
|
172
|
+
setMarkLabel(mark, ack.textContent);
|
|
173
|
+
if (impactId !== '') consentBox.setAttribute('aria-describedby', impactId);
|
|
174
|
+
consentBox.addEventListener('change', sync);
|
|
175
|
+
consentBox.addEventListener('keydown', onGateKey);
|
|
176
|
+
}
|
|
177
|
+
modal.body.appendChild(mark);
|
|
132
178
|
}
|
|
179
|
+
sync();
|
|
133
180
|
|
|
134
181
|
if (opts.alertOnly !== true) {
|
|
135
182
|
cancel = btn(doc, 'neutral', opts.cancelLabel ?? kitText('soma.kit.cancel', undefined, opts.at));
|
|
@@ -148,7 +195,7 @@ export function askKitConfirm(opts: KitConfirmOptions): Promise<boolean> {
|
|
|
148
195
|
}
|
|
149
196
|
// 调用方中止(如协调组件卸载):按取消收口,对话框随之关闭
|
|
150
197
|
opts.signal?.addEventListener('abort', onAbort, { once: true });
|
|
151
|
-
// 焦点:键入式 → 输入框;危险 →
|
|
152
|
-
(input ?? (tone === 'danger' && cancel !== null ? cancel : ok)).focus();
|
|
198
|
+
// 焦点:键入式 → 输入框;危险 / 要先勾选同意 → 取消钮(安全钮,误按回车不会执行);其余 → 确认钮
|
|
199
|
+
(input ?? ((tone === 'danger' || consentBox !== null) && cancel !== null ? cancel : ok)).focus();
|
|
153
200
|
});
|
|
154
201
|
}
|
package/src/data/context-menu.ts
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
CONTEXT_POINT_PANEL, CONTEXT_SHOWN, KIT_CONTEXT_MENU_CLASS_CANDIDATES, wireContextTrigger, type Corner,
|
|
23
23
|
} from '../base/context-menu';
|
|
24
24
|
import { MORE_MENU_CLASSES, emitRowAction, itemsOf } from '../object-renderer/table-actions';
|
|
25
|
-
import { rowActionState } from '../object-renderer/view-binding';
|
|
25
|
+
import { disabledReasonOf, rowActionState } from '../object-renderer/view-binding';
|
|
26
26
|
import { KIT_ACTION_SLOT_BASE, actionSlotEmits } from '../base/action-slots';
|
|
27
27
|
|
|
28
28
|
const ROOT_CLASS = 'absolute size-0';
|
|
@@ -65,7 +65,7 @@ export function createKitContextMenu(): SomaComponentDefinition {
|
|
|
65
65
|
layer: 'data',
|
|
66
66
|
props: {
|
|
67
67
|
menu: { type: 'array', default: [], desc: '菜单项 [{ id, name, tone?, builtin?, target?, permission? }],即 behavior.actions 里被 contextMenu 引用的动作;无权限的项不显示,全部不显示时不拦截系统菜单' },
|
|
68
|
-
actionState: { type: 'object', default: {}, desc: '行级动作状态 { 动作id: { hidden, disabled } }(仅 mode: row):叶子是行字段路径,core 逐行求值;hidden 为真该行菜单不含此项,disabled
|
|
68
|
+
actionState: { type: 'object', default: {}, desc: '行级动作状态 { 动作id: { hidden, disabled, disabledReason? } }(仅 mode: row):叶子是行字段路径,core 逐行求值;hidden 为真该行菜单不含此项,disabled 为真置灰且点不到;disabledReason(可选)是置灰原因文案,置灰项里多一段描述文字(aria-describedby);字面量原因写在 menu 项的 disabledReason' },
|
|
69
69
|
row: { type: 'object', default: {}, desc: '行实例的当前行数据,原样随 row_action 上抛' },
|
|
70
70
|
rows: { type: 'array', default: [], desc: 'mode: virtual 时的行数组(与 KitVirtualRows 同源,按 data-kit-index 取行)' },
|
|
71
71
|
mode: { type: 'string', default: 'row', desc: 'row(行实例,监听 [data-kit-ctx])、virtual(监听 [data-kit-vscroll],按下标取行)或 host(监听 [data-kit-ctxhost] 宿主壳,按行主键经组件登记的取行函数取行)' },
|
|
@@ -123,7 +123,7 @@ export function createKitContextMenu(): SomaComponentDefinition {
|
|
|
123
123
|
const visibleActions = (): ReturnType<typeof itemsOf> =>
|
|
124
124
|
itemsOf(api.props().menu).filter((a) => !(a.permission !== undefined && check !== null && !check(a.permission)) && !rowActionState(api.props().actionState, a.id).hidden);
|
|
125
125
|
const specs = (): MenuItemSpec[] =>
|
|
126
|
-
visibleActions().map((a) => ({ key: a.id, label: a.name, icon: '', disabled: rowActionState(api.props().actionState, a.id).disabled, danger: a.tone === 'danger', divider: false }));
|
|
126
|
+
visibleActions().map((a) => ({ key: a.id, label: a.name, icon: '', disabled: rowActionState(api.props().actionState, a.id).disabled, danger: a.tone === 'danger', divider: false, reason: disabledReasonOf(api.props().actionState, a) }));
|
|
127
127
|
|
|
128
128
|
const ensure = (): MenuHandle => {
|
|
129
129
|
if (handle !== null) return handle;
|
package/src/data/dock.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { classTokens, mk, textOf, type Rec } from './shape-util';
|
|
|
13
13
|
import { keyOfRow, listOf, rovingTabIndex, wireRovingRow } from './display-util';
|
|
14
14
|
|
|
15
15
|
const ROOT_CLASS = 'flex items-stretch justify-around gap-1 rounded-lg border border-border-subtle bg-surface p-1 shadow-sm';
|
|
16
|
-
const ITEM_CLASS = 'relative flex min-w-14 flex-1 flex-col items-center justify-center gap-0.5 rounded-md px-2 py-1.5 text-xs text-fg-muted transition-colors hover:bg-
|
|
16
|
+
const ITEM_CLASS = 'relative flex min-w-14 flex-1 flex-col items-center justify-center gap-0.5 rounded-md px-2 py-1.5 text-xs text-fg-muted transition-colors hover:bg-state-layer-hover active:bg-state-layer-press focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60 data-kit-selected:bg-primary-soft data-kit-selected:text-primary-on-soft';
|
|
17
17
|
const ICON_CLASS = 'text-lg';
|
|
18
18
|
const LABEL_CLASS = 'font-medium';
|
|
19
19
|
const BADGE_CLASS = 'absolute end-2 top-0.5 inline-flex min-w-4 items-center justify-center rounded-full bg-danger px-1 text-xs font-medium text-danger-fg';
|