@kahitsan/ksui 0.50.0 → 0.51.0-solid2.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.
- 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 +89 -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 +1 -1
- package/src/components/composite/resource/ResourcePage.tsx +21 -7
- 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
|
@@ -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
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// U7 — FlowRunner component tests: renders each node kind, calls advance with the
|
|
2
2
|
// node's input, handles a terminal node + an error.
|
|
3
|
+
import { flush } from "solid-js";
|
|
3
4
|
import { describe, expect, it, vi } from "vitest";
|
|
4
5
|
import { render, fireEvent, waitFor } from "@solidjs/testing-library";
|
|
5
6
|
import FlowRunner from "./FlowRunner";
|
|
@@ -26,6 +27,7 @@ describe("FlowRunner", () => {
|
|
|
26
27
|
/>
|
|
27
28
|
));
|
|
28
29
|
fireEvent.input(getByTestId("fr-field-amount"), { target: { value: "50" } });
|
|
30
|
+
flush(); // the input handler's write must commit before the click reads it
|
|
29
31
|
fireEvent.click(getByTestId("fr-submit"));
|
|
30
32
|
await waitFor(() => expect(advance).toHaveBeenCalledWith({ token: "abc" }, { amount: "50" }));
|
|
31
33
|
await waitFor(() => expect(getByTestId("fr-terminal")).toBeTruthy());
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
// error UI. Self-contained CSS (ksui-fr-* unscoped classes + CSS custom props);
|
|
10
10
|
// no Tailwind, no host-brand classes (standalone-library rule).
|
|
11
11
|
|
|
12
|
-
import type { Component
|
|
12
|
+
import type { Component } from "solid-js";
|
|
13
|
+
import type { JSX } from "@solidjs/web";
|
|
13
14
|
import { For, Match, Show, Switch, createSignal } from "solid-js";
|
|
14
15
|
import {
|
|
15
16
|
collectsInput,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// tokens. Only the body chrome the Modal does not cover (FormErrorBanner +
|
|
14
14
|
// FormActions) is promoted.
|
|
15
15
|
|
|
16
|
-
import type { JSX } from "
|
|
16
|
+
import type { JSX } from "@solidjs/web";
|
|
17
17
|
import { Show } from "solid-js";
|
|
18
18
|
import Button from "../base/Button";
|
|
19
19
|
|
|
@@ -149,8 +149,8 @@ export default function FormAdvancedSection(props: FormAdvancedSectionProps) {
|
|
|
149
149
|
</div>
|
|
150
150
|
|
|
151
151
|
<div
|
|
152
|
-
class="rounded-lg border border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_50%,transparent)] bg-[color-mix(in_srgb,var(--ks-bg,#0a0a0a)_40%,transparent)] p-4 relative"
|
|
153
|
-
|
|
152
|
+
class={["rounded-lg border border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_50%,transparent)] bg-[color-mix(in_srgb,var(--ks-bg,#0a0a0a)_40%,transparent)] p-4 relative", { "opacity-60": !props.canShare }]}
|
|
153
|
+
|
|
154
154
|
title={
|
|
155
155
|
props.canShare
|
|
156
156
|
? undefined
|
|
@@ -177,8 +177,8 @@ export default function FormAdvancedSection(props: FormAdvancedSectionProps) {
|
|
|
177
177
|
if (!props.canShare) return;
|
|
178
178
|
props.setIsPrivate(!props.isPrivate);
|
|
179
179
|
}}
|
|
180
|
-
class="ks-theme-toggle shrink-0"
|
|
181
|
-
|
|
180
|
+
class={["ks-theme-toggle shrink-0", { "cursor-not-allowed": !props.canShare }]}
|
|
181
|
+
|
|
182
182
|
>
|
|
183
183
|
<span
|
|
184
184
|
class="ks-theme-toggle-track"
|
|
@@ -238,13 +238,13 @@ export default function FormAdvancedSection(props: FormAdvancedSectionProps) {
|
|
|
238
238
|
]);
|
|
239
239
|
}
|
|
240
240
|
}}
|
|
241
|
-
class="px-3 py-2 text-xs rounded-lg border cursor-pointer min-h-[36px] capitalize transition-colors active:opacity-80"
|
|
242
|
-
classList={{
|
|
241
|
+
class={["px-3 py-2 text-xs rounded-lg border cursor-pointer min-h-[36px] capitalize transition-colors active:opacity-80", {
|
|
243
242
|
"border-[color-mix(in_srgb,var(--ks-primary,#c9a961)_40%,transparent)] bg-[color-mix(in_srgb,var(--ks-primary,#c9a961)_10%,transparent)] text-[var(--ks-accent,#fbbf24)]":
|
|
244
243
|
selected(),
|
|
245
244
|
"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)]":
|
|
246
245
|
!selected(),
|
|
247
|
-
}}
|
|
246
|
+
}]}
|
|
247
|
+
|
|
248
248
|
>
|
|
249
249
|
All {role.label}s
|
|
250
250
|
<Show when={membersInRole().length > 0}>
|
|
@@ -279,23 +279,23 @@ export default function FormAdvancedSection(props: FormAdvancedSectionProps) {
|
|
|
279
279
|
props.sharedWith.includes(m.user_id) || !!coveringRole();
|
|
280
280
|
return (
|
|
281
281
|
<label
|
|
282
|
-
class="flex items-center gap-3 text-sm py-2 px-2 rounded-lg min-h-[40px] transition-colors"
|
|
283
|
-
classList={{
|
|
282
|
+
class={["flex items-center gap-3 text-sm py-2 px-2 rounded-lg min-h-[40px] transition-colors", {
|
|
284
283
|
"text-[var(--ks-fg-muted,#a1a1aa)] cursor-pointer hover:bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_30%,transparent)] active:bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_50%,transparent)]":
|
|
285
284
|
!coveringRole(),
|
|
286
285
|
"text-[var(--ks-fg-subtle,#71717a)] cursor-not-allowed bg-[color-mix(in_srgb,var(--ks-overlay-surface,#18181b)_40%,transparent)]":
|
|
287
286
|
!!coveringRole(),
|
|
288
|
-
}}
|
|
287
|
+
}]}
|
|
288
|
+
|
|
289
289
|
>
|
|
290
290
|
<div
|
|
291
|
-
class="w-5 h-5 rounded border-2 flex items-center justify-center shrink-0 transition-colors"
|
|
292
|
-
classList={{
|
|
291
|
+
class={["w-5 h-5 rounded border-2 flex items-center justify-center shrink-0 transition-colors", {
|
|
293
292
|
"border-[var(--ks-primary,#c9a961)] bg-[var(--ks-primary,#c9a961)]":
|
|
294
293
|
checked() && !coveringRole(),
|
|
295
294
|
"border-[color-mix(in_srgb,var(--ks-primary,#c9a961)_40%,transparent)] bg-[color-mix(in_srgb,var(--ks-primary,#c9a961)_40%,transparent)]":
|
|
296
295
|
checked() && !!coveringRole(),
|
|
297
296
|
"border-[var(--ks-border-strong,#3f3f46)] bg-transparent": !checked(),
|
|
298
|
-
}}
|
|
297
|
+
}]}
|
|
298
|
+
|
|
299
299
|
>
|
|
300
300
|
<Show when={checked()}>
|
|
301
301
|
<svg
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
// N intervals when N cards are on screen — the home page session
|
|
5
5
|
// manager already proved this pattern at scale, so we lift it as-is.
|
|
6
6
|
|
|
7
|
-
import type { Component
|
|
8
|
-
import {
|
|
7
|
+
import type { Component } from "solid-js";
|
|
8
|
+
import type { JSX } from "@solidjs/web";
|
|
9
|
+
import { Show, createMemo, createSignal, onCleanup, omit, untrack } from "solid-js";
|
|
9
10
|
import Clock from "../../icons/clock";
|
|
10
11
|
import Play from "../../icons/play";
|
|
11
12
|
import AlertTriangle from "../../icons/triangle-alert";
|
|
@@ -242,16 +243,8 @@ const COLOR_AMBER = "border border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_6
|
|
|
242
243
|
const COLOR_RED = "border border-red-600/60 text-[var(--ks-danger-fg,#f87171)] hover:border-[var(--ks-danger,#ef4444)]";
|
|
243
244
|
|
|
244
245
|
const LiveTimer: Component<LiveTimerProps> = (props) => {
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
"endAt",
|
|
248
|
-
"overdue",
|
|
249
|
-
"icon",
|
|
250
|
-
"class",
|
|
251
|
-
"label",
|
|
252
|
-
"hidePercentage",
|
|
253
|
-
"totalLabel",
|
|
254
|
-
]);
|
|
246
|
+
const local = props;
|
|
247
|
+
const others = omit(props, "startAt", "endAt", "overdue", "icon", "class", "label", "hidePercentage", "totalLabel");
|
|
255
248
|
|
|
256
249
|
const timestamps = createMemo(() => {
|
|
257
250
|
const start = ensureDate(local.startAt);
|
|
@@ -264,8 +257,9 @@ const LiveTimer: Component<LiveTimerProps> = (props) => {
|
|
|
264
257
|
});
|
|
265
258
|
|
|
266
259
|
// Subscribe to the shared tickers.
|
|
267
|
-
|
|
268
|
-
const
|
|
260
|
+
// The shared ticker picks its cadence once, from the first mounted timer.
|
|
261
|
+
const { startSec, endSec, overdue } = untrack(() => ({ ...timestamps(), overdue: local.overdue ?? false }));
|
|
262
|
+
const dynamicTick = getDynamicTick(startSec, endSec, overdue);
|
|
269
263
|
const slowTick = getSlowTick();
|
|
270
264
|
|
|
271
265
|
const scenario = createMemo<Scenario>(() => {
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
// fetches the SIBLING clients plugin at /api/clients/:id and degrades to a
|
|
10
10
|
// non-hovering chip when that 404s.
|
|
11
11
|
|
|
12
|
-
import { For, Show, createMemo, createSignal, createUniqueId, onCleanup
|
|
12
|
+
import { For, Show, createMemo, createSignal, createUniqueId, onCleanup } from "solid-js";
|
|
13
|
+
import type { JSX } from "@solidjs/web";
|
|
13
14
|
import { highlightMatch } from "../../utils/highlight";
|
|
14
15
|
import { canAccess } from "../../utils/integration";
|
|
15
16
|
|
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
// /api/clients; when it 404s the popup just shows no results and the field
|
|
7
7
|
// still works as a plain notes editor.
|
|
8
8
|
|
|
9
|
-
import { Portal } from "
|
|
9
|
+
import { Portal } from "@solidjs/web";
|
|
10
10
|
import { useTopLayer } from "../../utils/top-layer";
|
|
11
11
|
import { usePopoverMount } from "../../utils/modal-layer";
|
|
12
|
-
import { createEffect, createSignal, createUniqueId, For, onCleanup,
|
|
12
|
+
import { createEffect, createSignal, createUniqueId, For, onCleanup, onSettled, Show } from "solid-js";
|
|
13
|
+
import type { JSX } from "@solidjs/web";
|
|
13
14
|
import UserRound from "../../icons/user-round";
|
|
14
15
|
import Loader2 from "../../icons/loader-2";
|
|
16
|
+
import { ariaBool } from "../../utils/aria";
|
|
15
17
|
|
|
16
18
|
const POPUP_MAX_HEIGHT = 240;
|
|
17
19
|
const POPUP_MIN_WIDTH = 280;
|
|
@@ -181,18 +183,22 @@ export default function MentionTextarea(props: MentionTextareaProps): JSX.Elemen
|
|
|
181
183
|
});
|
|
182
184
|
};
|
|
183
185
|
|
|
184
|
-
createEffect(
|
|
185
|
-
|
|
186
|
+
createEffect(
|
|
187
|
+
query,
|
|
188
|
+
(q) => {
|
|
186
189
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
187
190
|
debounceTimer = setTimeout(() => setDebouncedQuery(q), SEARCH_DEBOUNCE_MS);
|
|
188
|
-
|
|
191
|
+
return () => {
|
|
189
192
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
193
|
+
};
|
|
194
|
+
},
|
|
195
|
+
);
|
|
192
196
|
|
|
193
|
-
createEffect(
|
|
194
|
-
|
|
195
|
-
|
|
197
|
+
createEffect(
|
|
198
|
+
() => ({ isOpen: open(), debounced: debouncedQuery() }),
|
|
199
|
+
({ isOpen, debounced }) => {
|
|
200
|
+
if (!isOpen) return;
|
|
201
|
+
const q = debounced.trim();
|
|
196
202
|
const token = ++activeFetchToken;
|
|
197
203
|
setLoading(true);
|
|
198
204
|
const params = new URLSearchParams({ status: "active", limit: String(FETCH_LIMIT) });
|
|
@@ -213,10 +219,11 @@ export default function MentionTextarea(props: MentionTextareaProps): JSX.Elemen
|
|
|
213
219
|
if (token !== activeFetchToken) return;
|
|
214
220
|
setLoading(false);
|
|
215
221
|
});
|
|
216
|
-
}
|
|
222
|
+
},
|
|
223
|
+
);
|
|
217
224
|
|
|
218
|
-
createEffect(() => {
|
|
219
|
-
if (!
|
|
225
|
+
createEffect(open, (isOpen) => {
|
|
226
|
+
if (!isOpen) return;
|
|
220
227
|
updatePosition();
|
|
221
228
|
const onDocClick = (e: MouseEvent) => {
|
|
222
229
|
const t = e.target as Node;
|
|
@@ -228,15 +235,16 @@ export default function MentionTextarea(props: MentionTextareaProps): JSX.Elemen
|
|
|
228
235
|
document.addEventListener("mousedown", onDocClick);
|
|
229
236
|
window.addEventListener("resize", onReflow);
|
|
230
237
|
window.addEventListener("scroll", onReflow, true);
|
|
231
|
-
|
|
238
|
+
return () => {
|
|
232
239
|
document.removeEventListener("mousedown", onDocClick);
|
|
233
240
|
window.removeEventListener("resize", onReflow);
|
|
234
241
|
window.removeEventListener("scroll", onReflow, true);
|
|
235
|
-
}
|
|
242
|
+
};
|
|
236
243
|
});
|
|
237
244
|
|
|
238
|
-
createEffect(
|
|
239
|
-
|
|
245
|
+
createEffect(
|
|
246
|
+
() => props.value,
|
|
247
|
+
(v) => {
|
|
240
248
|
if (!editorRef) return;
|
|
241
249
|
if (isHydrating) return;
|
|
242
250
|
if (serialize(editorRef) === v) {
|
|
@@ -247,9 +255,10 @@ export default function MentionTextarea(props: MentionTextareaProps): JSX.Elemen
|
|
|
247
255
|
hydrateInto(editorRef, v);
|
|
248
256
|
isHydrating = false;
|
|
249
257
|
setIsEmpty(v.length === 0);
|
|
250
|
-
}
|
|
258
|
+
},
|
|
259
|
+
);
|
|
251
260
|
|
|
252
|
-
|
|
261
|
+
onSettled(() => {
|
|
253
262
|
if (!editorRef) return;
|
|
254
263
|
hydrateInto(editorRef, props.value);
|
|
255
264
|
setIsEmpty(props.value.length === 0);
|
|
@@ -393,7 +402,7 @@ export default function MentionTextarea(props: MentionTextareaProps): JSX.Elemen
|
|
|
393
402
|
tabindex={props.disabled ? -1 : 0}
|
|
394
403
|
role="combobox"
|
|
395
404
|
aria-haspopup="listbox"
|
|
396
|
-
aria-expanded={open()}
|
|
405
|
+
aria-expanded={ariaBool(open())}
|
|
397
406
|
aria-controls={open() ? listboxId : undefined}
|
|
398
407
|
aria-autocomplete="list"
|
|
399
408
|
aria-label={props.ariaLabel}
|
|
@@ -433,7 +442,7 @@ export default function MentionTextarea(props: MentionTextareaProps): JSX.Elemen
|
|
|
433
442
|
<div
|
|
434
443
|
ref={(el) => {
|
|
435
444
|
popupRef = el;
|
|
436
|
-
|
|
445
|
+
useTopLayer(el);
|
|
437
446
|
}}
|
|
438
447
|
data-testid="mention-popup"
|
|
439
448
|
class="z-[120] 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"
|
|
@@ -460,7 +469,7 @@ export default function MentionTextarea(props: MentionTextareaProps): JSX.Elemen
|
|
|
460
469
|
>
|
|
461
470
|
<For each={results()}>
|
|
462
471
|
{(c, idx) => (
|
|
463
|
-
<li id={optionId(c.id)} role="option" aria-selected={idx() === activeIdx()}>
|
|
472
|
+
<li id={optionId(c.id)} role="option" aria-selected={ariaBool(idx() === activeIdx())}>
|
|
464
473
|
<button
|
|
465
474
|
type="button"
|
|
466
475
|
data-testid={`mention-result-${c.id}`}
|