@kahitsan/ksui 0.50.0 → 0.51.0-solid2.1
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 +10 -0
- package/package.json +8 -6
- package/src/components/base/AccountAvatar.tsx +1 -1
- package/src/components/base/ActionMenu.tsx +7 -5
- package/src/components/base/AddAttachmentTile.tsx +6 -6
- package/src/components/base/BadgeSelect.tsx +11 -9
- package/src/components/base/Button.test.tsx +23 -0
- package/src/components/base/Button.tsx +35 -41
- package/src/components/base/CameraCapture.tsx +5 -2
- package/src/components/base/CopyButton.tsx +2 -1
- package/src/components/base/DataTable.tsx +91 -112
- package/src/components/base/DatePicker.tsx +15 -17
- package/src/components/base/DateTile.tsx +14 -12
- package/src/components/base/Dropdown.tsx +6 -5
- package/src/components/base/ExistingAttachmentTile.test.tsx +3 -3
- package/src/components/base/ExistingAttachmentTile.tsx +6 -4
- package/src/components/base/EyebrowBadge.tsx +2 -1
- package/src/components/base/FormErrorBanner.tsx +2 -1
- package/src/components/base/FormField.tsx +1 -1
- package/src/components/base/ImageCropper.tsx +3 -3
- package/src/components/base/ImageViewer.test.tsx +2 -0
- package/src/components/base/ImageViewer.tsx +4 -3
- package/src/components/base/KpiCard.tsx +3 -2
- package/src/components/base/Modal.test.tsx +3 -2
- package/src/components/base/Modal.tsx +11 -12
- package/src/components/base/ModalHeader.tsx +2 -1
- package/src/components/base/MonthCalendar.tsx +2 -1
- package/src/components/base/MultiSelectGroup.tsx +7 -5
- package/src/components/base/ProgressBar.tsx +8 -17
- package/src/components/base/RadioCardGroup.tsx +14 -12
- package/src/components/base/SectionHeading.tsx +2 -1
- package/src/components/base/SegmentedFilter.tsx +10 -8
- package/src/components/base/SocialLinksBar.tsx +2 -1
- package/src/components/base/StatusIndicator.tsx +2 -1
- package/src/components/base/StatusPill.tsx +1 -1
- package/src/components/base/TagPill.tsx +1 -1
- package/src/components/base/ThemeToggle.tsx +5 -11
- package/src/components/base/Tooltip.tsx +2 -1
- package/src/components/composite/AccountRadioPicker.tsx +14 -11
- package/src/components/composite/ComboBox.tsx +18 -13
- package/src/components/composite/CustomRenderer.tsx +1 -1
- package/src/components/composite/FileField.tsx +6 -3
- package/src/components/composite/FlowGraph.tsx +15 -12
- package/src/components/composite/FlowRunner.test.tsx +2 -0
- package/src/components/composite/FlowRunner.tsx +2 -1
- package/src/components/composite/FormActions.tsx +1 -1
- package/src/components/composite/FormAdvancedSection.tsx +13 -13
- package/src/components/composite/LiveTimer.tsx +8 -14
- package/src/components/composite/MarkdownNotes.tsx +2 -1
- package/src/components/composite/MentionTextarea.tsx +31 -22
- package/src/components/composite/MultiPeriodPicker.tsx +11 -9
- package/src/components/composite/NotFound.tsx +4 -15
- package/src/components/composite/PaymentAccountPicker.tsx +19 -24
- package/src/components/composite/SalesBodyEditor.tsx +10 -7
- package/src/components/composite/SearchableSelect.tsx +14 -13
- package/src/components/composite/SecretReveal.tsx +2 -2
- package/src/components/composite/TransactionForm.tsx +52 -42
- package/src/components/composite/TransferAccountsPicker.tsx +11 -10
- package/src/components/composite/TransferFeeChip.tsx +7 -6
- package/src/components/composite/VoucherPicker.test.tsx +55 -48
- package/src/components/composite/VoucherPicker.tsx +36 -27
- package/src/components/composite/picker-engine.ts +20 -14
- package/src/components/composite/resource/ResourcePage.test.tsx +21 -1
- package/src/components/composite/resource/ResourcePage.tsx +23 -8
- package/src/components/composite/resource/cells.tsx +1 -1
- package/src/icons/README.md +1 -1
- package/src/icons/create-artwork-icon.test.tsx +4 -1
- package/src/icons/create-artwork-icon.tsx +10 -24
- package/src/utils/account-icons.ts +2 -1
- package/src/utils/accounts-index.tsx +8 -5
- package/src/utils/aria.ts +13 -0
- package/src/utils/confirm.tsx +1 -1
- package/src/utils/dom.ts +7 -6
- package/src/utils/fetch-resource.ts +59 -0
- package/src/utils/highlight.tsx +1 -1
- package/src/utils/modal-layer.ts +3 -3
- package/src/utils/object-url-resource.ts +11 -8
- package/src/utils/top-layer.ts +9 -8
|
@@ -97,7 +97,7 @@ describe("Modal", () => {
|
|
|
97
97
|
expect(onClose).toHaveBeenCalledOnce();
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
it("leaves Escape to a dialog opened on top of it", () => {
|
|
100
|
+
it("leaves Escape to a dialog opened on top of it", async () => {
|
|
101
101
|
const onSheetClose = vi.fn();
|
|
102
102
|
const onDialogClose = vi.fn();
|
|
103
103
|
const { container } = render(() => (
|
|
@@ -108,7 +108,8 @@ describe("Modal", () => {
|
|
|
108
108
|
</Modal>
|
|
109
109
|
));
|
|
110
110
|
const dialog = container.querySelector("dialog")!;
|
|
111
|
-
|
|
111
|
+
// The dialog opens once the render settles, not during it.
|
|
112
|
+
await vi.waitFor(() => expect(dialog.open).toBe(true));
|
|
112
113
|
|
|
113
114
|
// A browser delivers Escape as keydown (bubbling to window) and then
|
|
114
115
|
// fires cancel on the topmost modal dialog.
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
// sheet variant uses a <div> overlay so child popovers Portaled into
|
|
16
16
|
// document.body still compose above the backdrop via z-index.
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import { onCleanup, onSettled, omit } from "solid-js";
|
|
19
|
+
import type { JSX } from "@solidjs/web";
|
|
19
20
|
import { autoFocusOnMount, lockPullToRefresh, unlockPullToRefresh, useFocusTrap } from "../../utils/dom";
|
|
20
21
|
import { injectCSS } from "../../utils/inject-css";
|
|
21
22
|
import { ModalLayerProvider } from "../../utils/modal-layer";
|
|
@@ -72,14 +73,7 @@ type LocalProps = Omit<ModalProps, "variant">;
|
|
|
72
73
|
|
|
73
74
|
export function Modal(props: ModalProps): JSX.Element {
|
|
74
75
|
injectCSS(STYLE_ID, STYLE_CSS);
|
|
75
|
-
const
|
|
76
|
-
"onClose",
|
|
77
|
-
"dismissable",
|
|
78
|
-
"size",
|
|
79
|
-
"tone",
|
|
80
|
-
"ariaLabel",
|
|
81
|
-
"children",
|
|
82
|
-
]);
|
|
76
|
+
const local = props;
|
|
83
77
|
// Variant is read once at mount; call sites pick it statically.
|
|
84
78
|
if (props.variant === "sheet") return SheetModal(local, props.size);
|
|
85
79
|
return DialogModal(local);
|
|
@@ -87,11 +81,14 @@ export function Modal(props: ModalProps): JSX.Element {
|
|
|
87
81
|
|
|
88
82
|
function DialogModal(local: LocalProps): JSX.Element {
|
|
89
83
|
let dialogEl: HTMLDialogElement | undefined;
|
|
84
|
+
// onCleanup is not allowed in the ref callback that creates the trap.
|
|
85
|
+
let releaseTrap: (() => void) | undefined;
|
|
86
|
+
onCleanup(() => releaseTrap?.());
|
|
90
87
|
|
|
91
88
|
lockPullToRefresh();
|
|
92
89
|
onCleanup(unlockPullToRefresh);
|
|
93
90
|
|
|
94
|
-
|
|
91
|
+
onSettled(() => {
|
|
95
92
|
if (!dialogEl) return;
|
|
96
93
|
if (!dialogEl.open) {
|
|
97
94
|
try {
|
|
@@ -141,7 +138,7 @@ function DialogModal(local: LocalProps): JSX.Element {
|
|
|
141
138
|
<div
|
|
142
139
|
ref={(el) => {
|
|
143
140
|
autoFocusOnMount(el);
|
|
144
|
-
|
|
141
|
+
releaseTrap = useFocusTrap(el);
|
|
145
142
|
}}
|
|
146
143
|
class={`ksui-modal-card${local.tone === "danger" ? " danger" : ""}`}
|
|
147
144
|
style={{ "max-width": SIZE_MAX_WIDTH[local.size ?? "lg"] }}
|
|
@@ -167,6 +164,8 @@ function openModalDialogs(): HTMLDialogElement[] {
|
|
|
167
164
|
|
|
168
165
|
function SheetModal(local: LocalProps, size?: ModalSize): JSX.Element {
|
|
169
166
|
let overlayEl: HTMLDivElement | undefined;
|
|
167
|
+
let releaseTrap: (() => void) | undefined;
|
|
168
|
+
onCleanup(() => releaseTrap?.());
|
|
170
169
|
|
|
171
170
|
lockPullToRefresh();
|
|
172
171
|
onCleanup(unlockPullToRefresh);
|
|
@@ -200,7 +199,7 @@ function SheetModal(local: LocalProps, size?: ModalSize): JSX.Element {
|
|
|
200
199
|
<div
|
|
201
200
|
ref={(el) => {
|
|
202
201
|
autoFocusOnMount(el);
|
|
203
|
-
|
|
202
|
+
releaseTrap = useFocusTrap(el);
|
|
204
203
|
}}
|
|
205
204
|
role="dialog"
|
|
206
205
|
aria-modal="true"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { For, createMemo, createUniqueId
|
|
1
|
+
import { For, createMemo, createUniqueId } from "solid-js";
|
|
2
|
+
import type { JSX } from "@solidjs/web";
|
|
2
3
|
import ChevronLeft from "../../icons/chevron-left";
|
|
3
4
|
import ChevronRight from "../../icons/chevron-right";
|
|
4
5
|
import { injectCSS } from "../../utils/inject-css";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { For
|
|
1
|
+
import { For } from "solid-js";
|
|
2
|
+
import type { JSX } from "@solidjs/web";
|
|
3
|
+
import { ariaTri } from "../../utils/aria";
|
|
2
4
|
|
|
3
5
|
export interface MultiSelectOption {
|
|
4
6
|
value: string;
|
|
@@ -36,17 +38,17 @@ export default function MultiSelectGroup(props: MultiSelectGroupProps): JSX.Elem
|
|
|
36
38
|
{(option) => (
|
|
37
39
|
<button
|
|
38
40
|
type="button"
|
|
39
|
-
aria-pressed={selected(option.value)}
|
|
41
|
+
aria-pressed={ariaTri(selected(option.value))}
|
|
40
42
|
disabled={props.disabled || option.disabled}
|
|
41
43
|
title={option.disabledNote}
|
|
42
44
|
onClick={() => toggle(option)}
|
|
43
|
-
class={`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${props.itemClass ?? ""}
|
|
44
|
-
classList={{
|
|
45
|
+
class={[`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${props.itemClass ?? ""}`, {
|
|
45
46
|
"border-[var(--ks-info,#38bdf8)] bg-[var(--ks-info,#38bdf8)] text-[var(--ks-info-fg,#7dd3fc)]": selected(option.value) && (props.variant ?? "info") === "info",
|
|
46
47
|
"border-[var(--ks-accent,#fbbf24)] bg-[var(--ks-accent,#fbbf24)] font-semibold text-[var(--ks-fg-on-accent,#0a0a0a)]": selected(option.value) && props.variant === "accent",
|
|
47
48
|
"border-[var(--ks-border,rgba(39,39,42,0.5))] bg-[var(--ks-surface,#0f0f0f)] text-[var(--ks-fg-muted,#a1a1aa)] hover:border-[var(--ks-border-strong,#3f3f46)] hover:text-[var(--ks-fg,#ffffff)]": !selected(option.value),
|
|
48
49
|
"cursor-not-allowed opacity-50": !!props.disabled || !!option.disabled,
|
|
49
|
-
}}
|
|
50
|
+
}]}
|
|
51
|
+
|
|
50
52
|
>
|
|
51
53
|
{option.label}
|
|
52
54
|
</button>
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
// progress visualization the session manager uses on the home page.
|
|
4
4
|
// Adapted to the library's TS + shared icon conventions.
|
|
5
5
|
|
|
6
|
-
import type { Component
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import type { Component } from "solid-js";
|
|
7
|
+
import type { JSX } from "@solidjs/web";
|
|
8
|
+
import { createMemo, omit, Show } from "solid-js";
|
|
9
|
+
import { Dynamic } from "@solidjs/web";
|
|
9
10
|
import { injectCSS } from "../../utils/inject-css";
|
|
10
11
|
|
|
11
12
|
// The monolith ships these as a CSS module (ProgressBar.module.css). The
|
|
@@ -164,19 +165,8 @@ function extractTextSize(className: string): number {
|
|
|
164
165
|
|
|
165
166
|
const DefaultProgressBar: Component<ProgressBarProps> = (props) => {
|
|
166
167
|
injectCSS(PROGRESS_STYLE_ID, PROGRESS_CSS);
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
"icon",
|
|
170
|
-
"label",
|
|
171
|
-
"statusLabel",
|
|
172
|
-
"shimmer",
|
|
173
|
-
"position",
|
|
174
|
-
"hidePercentage",
|
|
175
|
-
"rightLabel",
|
|
176
|
-
"color",
|
|
177
|
-
"variant",
|
|
178
|
-
"class",
|
|
179
|
-
]);
|
|
168
|
+
const local = props;
|
|
169
|
+
const others = omit(props, "progress", "icon", "label", "statusLabel", "shimmer", "position", "hidePercentage", "rightLabel", "color", "variant", "class");
|
|
180
170
|
|
|
181
171
|
const progressVal = createMemo(() => {
|
|
182
172
|
const value = local.progress;
|
|
@@ -350,7 +340,8 @@ type CompactProgressBarProps = ProgressBarProps;
|
|
|
350
340
|
|
|
351
341
|
const CompactProgressBar: Component<CompactProgressBarProps> = (props) => {
|
|
352
342
|
injectCSS(PROGRESS_STYLE_ID, PROGRESS_CSS);
|
|
353
|
-
const
|
|
343
|
+
const local = props;
|
|
344
|
+
const others = omit(props, "progress", "icon", "label", "statusLabel", "shimmer", "position", "hidePercentage", "rightLabel", "color", "variant", "class");
|
|
354
345
|
const value = createMemo(() => {
|
|
355
346
|
if (typeof local.progress !== "number" || Number.isNaN(local.progress)) return 0;
|
|
356
347
|
return Math.min(100, Math.max(0, Math.round(local.progress)));
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { For
|
|
1
|
+
import { For } from "solid-js";
|
|
2
|
+
import type { JSX } from "@solidjs/web";
|
|
3
|
+
import { ariaBool, ariaTri } from "../../utils/aria";
|
|
2
4
|
|
|
3
5
|
interface RadioCardGroupProps<T> {
|
|
4
6
|
/** The selectable options. */
|
|
@@ -101,11 +103,11 @@ export default function RadioCardGroup<T>(props: RadioCardGroupProps<T>): JSX.El
|
|
|
101
103
|
const defaultRender = (option: T, selected: boolean) => (
|
|
102
104
|
<>
|
|
103
105
|
<span
|
|
104
|
-
class="h-2 w-2 rounded-full shrink-0"
|
|
105
|
-
classList={{
|
|
106
|
+
class={["h-2 w-2 rounded-full shrink-0", {
|
|
106
107
|
"bg-[var(--ks-accent,#fbbf24)]": selected,
|
|
107
108
|
"bg-[var(--ks-fg-subtle,#71717a)] group-hover:bg-[var(--ks-fg-muted,#a1a1aa)]": !selected,
|
|
108
|
-
}}
|
|
109
|
+
}]}
|
|
110
|
+
|
|
109
111
|
/>
|
|
110
112
|
<span class="truncate">{label(option)}</span>
|
|
111
113
|
</>
|
|
@@ -115,8 +117,8 @@ export default function RadioCardGroup<T>(props: RadioCardGroupProps<T>): JSX.El
|
|
|
115
117
|
<div
|
|
116
118
|
role="radiogroup"
|
|
117
119
|
aria-label={props.ariaLabel}
|
|
118
|
-
aria-disabled={props.disabled}
|
|
119
|
-
|
|
120
|
+
aria-disabled={ariaBool(props.disabled)}
|
|
121
|
+
tabindex={-1}
|
|
120
122
|
class={`${gridClass()} ${props.class ?? ""}`}
|
|
121
123
|
onKeyDown={onKeyDown}
|
|
122
124
|
>
|
|
@@ -130,18 +132,18 @@ export default function RadioCardGroup<T>(props: RadioCardGroupProps<T>): JSX.El
|
|
|
130
132
|
ref={(el) => (buttonRefs[i()] = el)}
|
|
131
133
|
type="button"
|
|
132
134
|
role="radio"
|
|
133
|
-
aria-checked={selected()}
|
|
134
|
-
aria-disabled={props.disabled}
|
|
135
|
-
|
|
135
|
+
aria-checked={ariaTri(selected())}
|
|
136
|
+
aria-disabled={ariaBool(props.disabled)}
|
|
137
|
+
tabindex={isTabStop() ? 0 : -1}
|
|
136
138
|
onClick={() => !props.disabled && props.onChange(k)}
|
|
137
|
-
class={`group flex items-center gap-2 rounded-lg border px-3 py-3 text-left text-sm transition-colors cursor-pointer ${props.itemClass ?? ""}
|
|
138
|
-
classList={{
|
|
139
|
+
class={[`group flex items-center gap-2 rounded-lg border px-3 py-3 text-left text-sm transition-colors cursor-pointer ${props.itemClass ?? ""}`, {
|
|
139
140
|
"opacity-50 pointer-events-none cursor-not-allowed": !!props.disabled,
|
|
140
141
|
"border-[var(--ks-accent,#fbbf24)]/50 bg-[var(--ks-accent,#fbbf24)]/10 text-[var(--ks-accent,#fbbf24)]":
|
|
141
142
|
selected(),
|
|
142
143
|
"border-[var(--ks-border-strong,#3f3f46)] bg-[var(--ks-surface-raised,#1a1a1a)] text-[var(--ks-fg-muted,#a1a1aa)] hover:border-[var(--ks-fg-subtle,#71717a)] hover:bg-[var(--ks-surface-sunken,#141414)]":
|
|
143
144
|
!selected(),
|
|
144
|
-
}}
|
|
145
|
+
}]}
|
|
146
|
+
|
|
145
147
|
>
|
|
146
148
|
{(props.renderOption ?? defaultRender)(option, selected())}
|
|
147
149
|
</button>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { For, type Component
|
|
2
|
-
import {
|
|
1
|
+
import { For, type Component } from "solid-js";
|
|
2
|
+
import type { JSX } from "@solidjs/web";
|
|
3
|
+
import { Dynamic } from "@solidjs/web";
|
|
4
|
+
import { ariaBool, ariaTri } from "../../utils/aria";
|
|
3
5
|
export type SegmentedFilterIcon = Component<{ size?: number; class?: string }>;
|
|
4
6
|
|
|
5
7
|
/** One choice in the segmented row. A bare string uses the value as the label
|
|
@@ -109,18 +111,17 @@ export default function SegmentedFilter(props: SegmentedFilterProps): JSX.Elemen
|
|
|
109
111
|
ref={(el) => (buttonRefs[i()] = el)}
|
|
110
112
|
type="button"
|
|
111
113
|
role="radio"
|
|
112
|
-
aria-checked={selected()}
|
|
113
|
-
aria-disabled={opt.disabled}
|
|
114
|
+
aria-checked={ariaTri(selected())}
|
|
115
|
+
aria-disabled={ariaBool(opt.disabled)}
|
|
114
116
|
aria-describedby={opt.disabled && opt.disabledNote ? noteId : undefined}
|
|
115
117
|
title={opt.disabled ? opt.disabledNote : undefined}
|
|
116
|
-
|
|
118
|
+
tabindex={opt.disabled ? -1 : isTabStop() ? 0 : -1}
|
|
117
119
|
data-testid={props.testIdPrefix ? `${props.testIdPrefix}-${opt.value}` : undefined}
|
|
118
120
|
onClick={() => {
|
|
119
121
|
if (opt.disabled) return;
|
|
120
122
|
props.onChange(opt.value);
|
|
121
123
|
}}
|
|
122
|
-
class="inline-flex shrink-0 items-center justify-center gap-1.5 px-3 py-1.5 text-xs transition-colors"
|
|
123
|
-
classList={{
|
|
124
|
+
class={["inline-flex shrink-0 items-center justify-center gap-1.5 px-3 py-1.5 text-xs transition-colors", {
|
|
124
125
|
capitalize: opt.capitalize,
|
|
125
126
|
"cursor-not-allowed": opt.disabled,
|
|
126
127
|
"cursor-pointer": !opt.disabled,
|
|
@@ -128,7 +129,8 @@ export default function SegmentedFilter(props: SegmentedFilterProps): JSX.Elemen
|
|
|
128
129
|
"text-[var(--ks-fg-subtle,#71717a)]": opt.disabled,
|
|
129
130
|
"text-[var(--ks-fg-muted,#a1a1aa)] hover:text-[var(--ks-fg,#ffffff)] hover:bg-[var(--ks-surface-raised,#1a1a1a)]":
|
|
130
131
|
!selected() && !opt.disabled,
|
|
131
|
-
}}
|
|
132
|
+
}]}
|
|
133
|
+
|
|
132
134
|
>
|
|
133
135
|
{opt.icon ? <Dynamic component={opt.icon} size={14} aria-hidden="true" /> : null}
|
|
134
136
|
{opt.label}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { For, type Component
|
|
1
|
+
import { For, type Component } from "solid-js";
|
|
2
|
+
import type { JSX } from "@solidjs/web";
|
|
2
3
|
import { injectCSS } from "../../utils/inject-css";
|
|
3
4
|
|
|
4
5
|
/** Icon component shape: any component that accepts a numeric `size`
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
// are injected once at runtime via a <style> tag — the same pattern ProgressBar
|
|
10
10
|
// uses — and referenced by plain, unscoped class names.
|
|
11
11
|
|
|
12
|
-
import type { JSX } from "
|
|
13
|
-
import {
|
|
12
|
+
import type { JSX } from "@solidjs/web";
|
|
13
|
+
import { omit } from "solid-js";
|
|
14
14
|
import Sun from "../../icons/sun";
|
|
15
15
|
import Moon from "../../icons/moon";
|
|
16
16
|
import { injectCSS } from "../../utils/inject-css";
|
|
@@ -63,14 +63,8 @@ const defaultAriaLabel = (next: ThemeToggleValue): string => `Switch to ${next}
|
|
|
63
63
|
export default function ThemeToggle(props: ThemeToggleProps): JSX.Element {
|
|
64
64
|
injectCSS(THEME_TOGGLE_STYLE_ID, THEME_TOGGLE_CSS);
|
|
65
65
|
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
"onToggle",
|
|
69
|
-
"ariaLabel",
|
|
70
|
-
"testId",
|
|
71
|
-
"class",
|
|
72
|
-
"onClick",
|
|
73
|
-
]);
|
|
66
|
+
const local = props;
|
|
67
|
+
const rest = omit(props, "value", "onToggle", "ariaLabel", "testId", "class", "onClick");
|
|
74
68
|
|
|
75
69
|
const isLight = (): boolean => local.value === "light";
|
|
76
70
|
const next = (): ThemeToggleValue => (isLight() ? "dark" : "light");
|
|
@@ -84,7 +78,7 @@ export default function ThemeToggle(props: ThemeToggleProps): JSX.Element {
|
|
|
84
78
|
return (
|
|
85
79
|
<button
|
|
86
80
|
type="button"
|
|
87
|
-
class={
|
|
81
|
+
class={["ks-theme-toggle", local.class]}
|
|
88
82
|
aria-label={label()}
|
|
89
83
|
title={label()}
|
|
90
84
|
data-testid={local.testId}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createEffect, Show, For } from "solid-js";
|
|
2
2
|
import AccountAvatar from "../base/AccountAvatar";
|
|
3
3
|
import type { PaymentAccountOption } from "./PaymentAccountPicker";
|
|
4
|
+
import { ariaTri } from "../../utils/aria";
|
|
4
5
|
|
|
5
6
|
export interface AccountRadioPickerProps {
|
|
6
7
|
accounts: PaymentAccountOption[];
|
|
@@ -17,12 +18,14 @@ export default function AccountRadioPicker(props: AccountRadioPickerProps) {
|
|
|
17
18
|
(a) => !props.excludeId || a.id.toString() !== props.excludeId
|
|
18
19
|
);
|
|
19
20
|
|
|
20
|
-
createEffect(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
createEffect(
|
|
22
|
+
() => ({ auto: props.autoDefault, value: props.value, first: visible()[0] }),
|
|
23
|
+
({ auto, value, first }) => {
|
|
24
|
+
if (auto === false) return;
|
|
25
|
+
if (value) return;
|
|
24
26
|
if (first) props.onChange(first.id.toString());
|
|
25
|
-
}
|
|
27
|
+
},
|
|
28
|
+
);
|
|
26
29
|
|
|
27
30
|
const buttonRefs: (HTMLButtonElement | undefined)[] = [];
|
|
28
31
|
|
|
@@ -80,7 +83,7 @@ export default function AccountRadioPicker(props: AccountRadioPickerProps) {
|
|
|
80
83
|
<div
|
|
81
84
|
role="radiogroup"
|
|
82
85
|
aria-label={props.ariaLabel}
|
|
83
|
-
|
|
86
|
+
tabindex={-1}
|
|
84
87
|
class="grid max-sm:grid-cols-2 sm:grid-cols-3 gap-2"
|
|
85
88
|
onKeyDown={onKeyDown}
|
|
86
89
|
>
|
|
@@ -93,16 +96,16 @@ export default function AccountRadioPicker(props: AccountRadioPickerProps) {
|
|
|
93
96
|
ref={(el) => (buttonRefs[i()] = el)}
|
|
94
97
|
type="button"
|
|
95
98
|
role="radio"
|
|
96
|
-
aria-checked={selected()}
|
|
97
|
-
|
|
99
|
+
aria-checked={ariaTri(selected())}
|
|
100
|
+
tabindex={isTabStop() ? 0 : -1}
|
|
98
101
|
onClick={() => props.onChange(a.id.toString())}
|
|
99
|
-
class="group flex items-center gap-2 rounded-lg border px-3 py-3 text-left text-sm transition-colors cursor-pointer ks-hud-clip-top-left-bottom-right"
|
|
100
|
-
classList={{
|
|
102
|
+
class={["group flex items-center gap-2 rounded-lg border px-3 py-3 text-left text-sm transition-colors cursor-pointer ks-hud-clip-top-left-bottom-right", {
|
|
101
103
|
"border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_50%,transparent)] bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_10%,transparent)] text-[var(--ks-accent-hover,#fcd34d)]":
|
|
102
104
|
selected(),
|
|
103
105
|
"border-[var(--ks-border-strong,#3f3f46)] bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_50%,transparent)] text-[var(--ks-fg-muted,#a1a1aa)] hover:border-[var(--ks-border-strong,#3f3f46)] hover:bg-[var(--ks-surface-raised,#1a1a1a)]":
|
|
104
106
|
!selected(),
|
|
105
|
-
}}
|
|
107
|
+
}]}
|
|
108
|
+
|
|
106
109
|
>
|
|
107
110
|
<AccountAvatar
|
|
108
111
|
account={a}
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
// (star) with click-to-promote, `invalid` paints the required/empty tone,
|
|
20
20
|
// and `lockedIds` anchors specific chips.
|
|
21
21
|
|
|
22
|
-
import { Portal } from "
|
|
23
|
-
import { createEffect, createSignal, For, onCleanup,
|
|
22
|
+
import { Portal } from "@solidjs/web";
|
|
23
|
+
import { createEffect, createSignal, For, onCleanup, onSettled, Show } from "solid-js";
|
|
24
|
+
import type { JSX } from "@solidjs/web";
|
|
24
25
|
import { useTopLayer } from "../../utils/top-layer";
|
|
25
26
|
import { usePopoverMount } from "../../utils/modal-layer";
|
|
26
27
|
import { highlightMatch } from "../../utils/highlight";
|
|
@@ -30,6 +31,7 @@ import Star from "../../icons/star";
|
|
|
30
31
|
import X from "../../icons/x";
|
|
31
32
|
import Loader2 from "../../icons/loader-2";
|
|
32
33
|
import { createPickerPopup } from "./picker-engine";
|
|
34
|
+
import { ariaBool } from "../../utils/aria";
|
|
33
35
|
|
|
34
36
|
interface ComboBoxCommonProps<T> {
|
|
35
37
|
/** Search the backing list. Receives the trimmed query (may be empty for the
|
|
@@ -129,9 +131,12 @@ function SingleComboBox<T>(props: ComboBoxSingleProps<T>): JSX.Element {
|
|
|
129
131
|
if (props.defaultOpen) queueMicrotask(() => eng.setOpen(true));
|
|
130
132
|
|
|
131
133
|
// Focus the popup's search input whenever it opens.
|
|
132
|
-
createEffect(
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
createEffect(
|
|
135
|
+
eng.open,
|
|
136
|
+
(isOpen) => {
|
|
137
|
+
if (isOpen) queueMicrotask(() => inputRef?.focus());
|
|
138
|
+
},
|
|
139
|
+
);
|
|
135
140
|
|
|
136
141
|
const hasExactMatch = () => {
|
|
137
142
|
const q = eng.trimmedQuery().toLowerCase();
|
|
@@ -186,7 +191,7 @@ function SingleComboBox<T>(props: ComboBoxSingleProps<T>): JSX.Element {
|
|
|
186
191
|
onClick={() => !props.disabled && eng.setOpen((o) => !o)}
|
|
187
192
|
class="w-full flex items-center gap-2 px-3 py-2.5 rounded-lg bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_30%,transparent)] border border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_50%,transparent)] hover:border-[color-mix(in_srgb,var(--ks-primary,#c9a961)_40%,transparent)] hover:bg-[color-mix(in_srgb,var(--ks-primary,#c9a961)_5%,transparent)] transition-colors text-sm text-left cursor-pointer disabled:cursor-not-allowed disabled:opacity-60"
|
|
188
193
|
aria-haspopup="listbox"
|
|
189
|
-
aria-expanded={eng.open()}
|
|
194
|
+
aria-expanded={ariaBool(eng.open())}
|
|
190
195
|
>
|
|
191
196
|
<Icon size={16} class="shrink-0 text-[var(--ks-fg-muted,#a1a1aa)]" />
|
|
192
197
|
<Show when={triggerLabel()} fallback={<span class="text-[var(--ks-fg-subtle,#71717a)] italic">{placeholder()}</span>}>
|
|
@@ -211,7 +216,7 @@ function SingleComboBox<T>(props: ComboBoxSingleProps<T>): JSX.Element {
|
|
|
211
216
|
<div
|
|
212
217
|
ref={(el) => {
|
|
213
218
|
popupRef = el;
|
|
214
|
-
|
|
219
|
+
useTopLayer(el);
|
|
215
220
|
}}
|
|
216
221
|
data-testid={tid("popup")}
|
|
217
222
|
class="z-[10000] rounded-md border border-[var(--ks-border-strong,#3f3f46)] bg-[color-mix(in_srgb,var(--ks-overlay-surface,#18181b)_95%,transparent)] backdrop-blur shadow-xl overflow-hidden flex flex-col"
|
|
@@ -224,7 +229,7 @@ function SingleComboBox<T>(props: ComboBoxSingleProps<T>): JSX.Element {
|
|
|
224
229
|
type="text"
|
|
225
230
|
data-testid={tid("input")}
|
|
226
231
|
role="combobox"
|
|
227
|
-
aria-expanded={eng.open()}
|
|
232
|
+
aria-expanded={ariaBool(eng.open())}
|
|
228
233
|
aria-controls={`${tid("listbox")}`}
|
|
229
234
|
aria-autocomplete="list"
|
|
230
235
|
aria-label={`Search ${props.noun}s`}
|
|
@@ -262,7 +267,7 @@ function SingleComboBox<T>(props: ComboBoxSingleProps<T>): JSX.Element {
|
|
|
262
267
|
const isSel = () =>
|
|
263
268
|
props.selected != null && props.idOf(props.selected) === props.idOf(item);
|
|
264
269
|
return (
|
|
265
|
-
<li role="option" aria-selected={isSel()}>
|
|
270
|
+
<li role="option" aria-selected={ariaBool(isSel())}>
|
|
266
271
|
<button
|
|
267
272
|
type="button"
|
|
268
273
|
data-testid={`${tid("result")}-${props.idOf(item)}`}
|
|
@@ -442,7 +447,7 @@ function MultiComboBox<T>(props: ComboBoxMultiProps<T>): JSX.Element {
|
|
|
442
447
|
}
|
|
443
448
|
};
|
|
444
449
|
|
|
445
|
-
|
|
450
|
+
onSettled(() => {
|
|
446
451
|
if (props.autoFocusOnMount) queueMicrotask(() => inputRef?.focus());
|
|
447
452
|
});
|
|
448
453
|
|
|
@@ -564,7 +569,7 @@ function MultiComboBox<T>(props: ComboBoxMultiProps<T>): JSX.Element {
|
|
|
564
569
|
<div
|
|
565
570
|
ref={(el) => {
|
|
566
571
|
popupRef = el;
|
|
567
|
-
|
|
572
|
+
useTopLayer(el);
|
|
568
573
|
}}
|
|
569
574
|
data-testid={tid("popup")}
|
|
570
575
|
role="listbox"
|
|
@@ -596,7 +601,7 @@ function MultiComboBox<T>(props: ComboBoxMultiProps<T>): JSX.Element {
|
|
|
596
601
|
<button
|
|
597
602
|
type="button"
|
|
598
603
|
role="option"
|
|
599
|
-
aria-selected={focusedIdx() === 0}
|
|
604
|
+
aria-selected={ariaBool(focusedIdx() === 0)}
|
|
600
605
|
data-testid={tid("create")}
|
|
601
606
|
onMouseEnter={() => setFocusedIdx(0)}
|
|
602
607
|
onClick={() => void createAndAdd()}
|
|
@@ -632,7 +637,7 @@ function MultiComboBox<T>(props: ComboBoxMultiProps<T>): JSX.Element {
|
|
|
632
637
|
<button
|
|
633
638
|
type="button"
|
|
634
639
|
role="option"
|
|
635
|
-
aria-selected={isFocused()}
|
|
640
|
+
aria-selected={ariaBool(isFocused())}
|
|
636
641
|
data-testid={`${tid("result")}-${idOf(item)}`}
|
|
637
642
|
onMouseEnter={() => setFocusedIdx(displayIdx())}
|
|
638
643
|
onClick={() => addToPool(item)}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import type { Component } from "solid-js";
|
|
11
11
|
import { Show, createMemo } from "solid-js";
|
|
12
|
-
import { Dynamic } from "
|
|
12
|
+
import { Dynamic } from "@solidjs/web";
|
|
13
13
|
import AlertTriangle from "../../icons/triangle-alert";
|
|
14
14
|
import {
|
|
15
15
|
getRenderer,
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
// its CSS (ksui-ff-* unscoped classes + CSS custom props); no Tailwind, no
|
|
14
14
|
// host-brand classes (standalone-library rule).
|
|
15
15
|
|
|
16
|
-
import type { Component
|
|
17
|
-
import {
|
|
16
|
+
import type { Component } from "solid-js";
|
|
17
|
+
import type { JSX } from "@solidjs/web";
|
|
18
|
+
import { Match, Show, Switch, createSignal, onSettled } from "solid-js";
|
|
18
19
|
import UploadCloud from "../../icons/cloud-upload";
|
|
19
20
|
import FileIcon from "../../icons/file";
|
|
20
21
|
import ImageOff from "../../icons/image-off";
|
|
@@ -136,7 +137,9 @@ export const FileField: Component<FileFieldProps> = (props) => {
|
|
|
136
137
|
};
|
|
137
138
|
|
|
138
139
|
// If a value handle is supplied at mount, load its preview eagerly.
|
|
139
|
-
|
|
140
|
+
onSettled(() => {
|
|
141
|
+
if (props.value) loadPreview(props.value);
|
|
142
|
+
});
|
|
140
143
|
|
|
141
144
|
const pick = () => {
|
|
142
145
|
if (props.disabled) return;
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
// layoutGraph. Connectors are drawn BEHIND the opaque cards so an edge never
|
|
12
12
|
// visibly crosses a node block.
|
|
13
13
|
|
|
14
|
-
import type { Component
|
|
15
|
-
import {
|
|
14
|
+
import type { Component } from "solid-js";
|
|
15
|
+
import type { JSX } from "@solidjs/web";
|
|
16
|
+
import { Dynamic } from "@solidjs/web";
|
|
16
17
|
import { For, Show, createEffect, createMemo, createSignal } from "solid-js";
|
|
17
18
|
import Database from "../../icons/database";
|
|
18
19
|
import MousePointerClick from "../../icons/mouse-pointer-click";
|
|
@@ -261,9 +262,10 @@ export const FlowGraph: Component<FlowGraphProps> = (props) => {
|
|
|
261
262
|
// instead of leaving the view on the previous flow's now-empty region.
|
|
262
263
|
const nodeSig = createMemo(() => props.nodes.map((n) => n.id).join("|"));
|
|
263
264
|
let lastSig: string | null = null;
|
|
264
|
-
createEffect(
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
createEffect(
|
|
266
|
+
() => ({ sig: nodeSig(), canvas: canvas(), count: laid().nodes.length }),
|
|
267
|
+
({ sig, canvas: hasCanvas, count }) => {
|
|
268
|
+
if (hasCanvas && sig !== lastSig && count > 0 && svgRef) {
|
|
267
269
|
lastSig = sig;
|
|
268
270
|
setOffsets({});
|
|
269
271
|
requestAnimationFrame(() => {
|
|
@@ -278,7 +280,8 @@ export const FlowGraph: Component<FlowGraphProps> = (props) => {
|
|
|
278
280
|
setView({ x: vw / 2 - (minX + maxX) / 2, y: pad - minY, k: 1 });
|
|
279
281
|
});
|
|
280
282
|
}
|
|
281
|
-
}
|
|
283
|
+
},
|
|
284
|
+
);
|
|
282
285
|
|
|
283
286
|
const clampK = (k: number) => Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, k));
|
|
284
287
|
const zoomBy = (factor: number, cx?: number, cy?: number) => {
|
|
@@ -380,8 +383,8 @@ export const FlowGraph: Component<FlowGraphProps> = (props) => {
|
|
|
380
383
|
|
|
381
384
|
return (
|
|
382
385
|
<div
|
|
383
|
-
class="ksui-fg-wrap"
|
|
384
|
-
|
|
386
|
+
class={["ksui-fg-wrap", { interactive: canvas(), scroll: vertical(), grabbing: grabbing() }]}
|
|
387
|
+
|
|
385
388
|
style={
|
|
386
389
|
canvas()
|
|
387
390
|
? { height: `${props.height ?? 360}px` }
|
|
@@ -450,7 +453,7 @@ export const FlowGraph: Component<FlowGraphProps> = (props) => {
|
|
|
450
453
|
const m = () => mid(a(), b());
|
|
451
454
|
const lbl = () => clip(e.label ?? "", 18);
|
|
452
455
|
return (
|
|
453
|
-
<g
|
|
456
|
+
<g class={{ "ksui-fg-dim": edgeDim(e) }}>
|
|
454
457
|
<path
|
|
455
458
|
class={`ksui-fg-edge ${e.accent ?? ""} ${e.dashed ? "dashed" : ""} ${
|
|
456
459
|
props.animated ? "flow" : ""
|
|
@@ -490,8 +493,8 @@ export const FlowGraph: Component<FlowGraphProps> = (props) => {
|
|
|
490
493
|
y={n().y}
|
|
491
494
|
width={nodeW}
|
|
492
495
|
height={nodeH}
|
|
493
|
-
class="ksui-fg-node"
|
|
494
|
-
|
|
496
|
+
class={["ksui-fg-node", { clickable: clickable(), "ksui-fg-dim": nodeDim(base.id) }]}
|
|
497
|
+
|
|
495
498
|
data-testid={tid(`node-${base.id}`)}
|
|
496
499
|
role={clickable() ? "button" : undefined}
|
|
497
500
|
tabindex={clickable() ? 0 : undefined}
|
|
@@ -532,7 +535,7 @@ export const FlowGraph: Component<FlowGraphProps> = (props) => {
|
|
|
532
535
|
const outs = () => ports().outBySource.get(base.id) ?? [];
|
|
533
536
|
const hasIn = () => ports().incoming.has(base.id);
|
|
534
537
|
return (
|
|
535
|
-
<g
|
|
538
|
+
<g class={{ "ksui-fg-dim": nodeDim(base.id) }}>
|
|
536
539
|
{/* cx/cy are accessor-driven so handles follow a dragged node. */}
|
|
537
540
|
<Show when={hasIn()}>
|
|
538
541
|
<circle
|