@kahitsan/ksui 0.49.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 +10 -7
- 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 +10 -4
- package/src/icons/arrow-down-left.tsx +2 -2
- package/src/icons/arrow-left.tsx +2 -2
- package/src/icons/arrow-right-left.tsx +1 -1
- package/src/icons/arrow-right.tsx +2 -2
- package/src/icons/arrow-up-down.tsx +2 -2
- package/src/icons/arrow-up-right.tsx +2 -2
- package/src/icons/arrow-up.tsx +2 -2
- package/src/icons/artwork/activity.ts +1 -1
- package/src/icons/artwork/app-window.png +0 -0
- package/src/icons/artwork/app-window.ts +2 -1
- package/src/icons/artwork/archive-restore.ts +1 -1
- package/src/icons/artwork/archive.ts +1 -1
- package/src/icons/artwork/arrow-down.ts +1 -1
- package/src/icons/artwork/arrow-left-right.ts +1 -1
- package/src/icons/artwork/at-sign.png +0 -0
- package/src/icons/artwork/at-sign.ts +2 -1
- package/src/icons/artwork/ban.png +0 -0
- package/src/icons/artwork/ban.ts +2 -1
- package/src/icons/artwork/banknote.ts +1 -1
- package/src/icons/artwork/bell.ts +1 -1
- package/src/icons/artwork/bir-form-0619-e.png +0 -0
- package/src/icons/artwork/bir-form-0619-e.ts +3 -0
- package/src/icons/artwork/bir-form-1601-eq.png +0 -0
- package/src/icons/artwork/bir-form-1601-eq.ts +3 -0
- package/src/icons/artwork/bir-form-2307.png +0 -0
- package/src/icons/artwork/bir-form-2307.ts +3 -0
- package/src/icons/artwork/bir-office.ts +2 -0
- package/src/icons/artwork/blocks.png +0 -0
- package/src/icons/artwork/blocks.ts +2 -1
- package/src/icons/artwork/book-open.ts +1 -1
- package/src/icons/artwork/boxes.ts +1 -1
- package/src/icons/artwork/briefcase.png +0 -0
- package/src/icons/artwork/briefcase.ts +2 -1
- package/src/icons/artwork/building-2.ts +1 -1
- package/src/icons/artwork/building.png +0 -0
- package/src/icons/artwork/building.ts +2 -1
- package/src/icons/artwork/calculator.png +0 -0
- package/src/icons/artwork/calculator.ts +2 -1
- package/src/icons/artwork/calendar-clock.png +0 -0
- package/src/icons/artwork/calendar-clock.ts +2 -1
- package/src/icons/artwork/calendar.png +0 -0
- package/src/icons/artwork/calendar.ts +2 -1
- package/src/icons/artwork/camera.ts +1 -1
- package/src/icons/artwork/chart-bar.ts +1 -1
- package/src/icons/artwork/check-bold.ts +1 -1
- package/src/icons/artwork/check-check.ts +1 -1
- package/src/icons/artwork/check.ts +1 -1
- package/src/icons/artwork/chevron-right.ts +1 -1
- package/src/icons/artwork/chevrons-up-down.ts +1 -1
- package/src/icons/artwork/circle-alert.ts +1 -1
- package/src/icons/artwork/circle-check-bold.png +0 -0
- package/src/icons/artwork/circle-check-bold.ts +2 -1
- package/src/icons/artwork/circle-check.png +0 -0
- package/src/icons/artwork/circle-check.ts +2 -1
- package/src/icons/artwork/circle-dot.ts +1 -1
- package/src/icons/artwork/circle-question-mark.png +0 -0
- package/src/icons/artwork/circle-question-mark.ts +2 -1
- package/src/icons/artwork/circle-x.ts +1 -1
- package/src/icons/artwork/circle.ts +1 -1
- package/src/icons/artwork/clipboard-list.ts +1 -1
- package/src/icons/artwork/clock.png +0 -0
- package/src/icons/artwork/clock.ts +2 -1
- package/src/icons/artwork/coins.ts +1 -1
- package/src/icons/artwork/compass.png +0 -0
- package/src/icons/artwork/compass.ts +2 -1
- package/src/icons/artwork/copy.png +0 -0
- package/src/icons/artwork/copy.ts +2 -1
- package/src/icons/artwork/corner-down-right.ts +1 -1
- package/src/icons/artwork/credit-card.png +0 -0
- package/src/icons/artwork/credit-card.ts +2 -1
- package/src/icons/artwork/crown.ts +1 -1
- package/src/icons/artwork/database.png +0 -0
- package/src/icons/artwork/database.ts +2 -1
- package/src/icons/artwork/dollar-sign.ts +1 -1
- package/src/icons/artwork/door-open.png +0 -0
- package/src/icons/artwork/door-open.ts +2 -1
- package/src/icons/artwork/download.ts +1 -1
- package/src/icons/artwork/ellipsis.ts +1 -1
- package/src/icons/artwork/equal.ts +1 -1
- package/src/icons/artwork/external-link.ts +1 -1
- package/src/icons/artwork/eye.ts +1 -1
- package/src/icons/artwork/file-spreadsheet.png +0 -0
- package/src/icons/artwork/file-spreadsheet.ts +2 -1
- package/src/icons/artwork/file-text.png +0 -0
- package/src/icons/artwork/file-text.ts +2 -1
- package/src/icons/artwork/file.ts +1 -1
- package/src/icons/artwork/funnel.ts +1 -1
- package/src/icons/artwork/globe.png +0 -0
- package/src/icons/artwork/globe.ts +2 -1
- package/src/icons/artwork/grip-vertical.ts +1 -1
- package/src/icons/artwork/history.png +0 -0
- package/src/icons/artwork/history.ts +2 -1
- package/src/icons/artwork/house.ts +1 -1
- package/src/icons/artwork/image-off.png +0 -0
- package/src/icons/artwork/image-off.ts +2 -1
- package/src/icons/artwork/inbox.ts +1 -1
- package/src/icons/artwork/info.ts +1 -1
- package/src/icons/artwork/key.ts +1 -1
- package/src/icons/artwork/landmark.ts +1 -1
- package/src/icons/artwork/layers.png +0 -0
- package/src/icons/artwork/layers.ts +2 -1
- package/src/icons/artwork/layout-dashboard.ts +1 -1
- package/src/icons/artwork/layout-grid.ts +1 -1
- package/src/icons/artwork/layout-list.png +0 -0
- package/src/icons/artwork/layout-list.ts +2 -1
- package/src/icons/artwork/link-2.ts +1 -1
- package/src/icons/artwork/list.ts +1 -1
- package/src/icons/artwork/loader-circle.ts +1 -1
- package/src/icons/artwork/lock.ts +1 -1
- package/src/icons/artwork/log-in.ts +1 -1
- package/src/icons/artwork/log-out.ts +1 -1
- package/src/icons/artwork/mail-open.ts +1 -1
- package/src/icons/artwork/mail.ts +1 -1
- package/src/icons/artwork/megaphone.ts +1 -1
- package/src/icons/artwork/message-square.ts +1 -1
- package/src/icons/artwork/minus.ts +1 -1
- package/src/icons/artwork/moon.ts +1 -1
- package/src/icons/artwork/mouse-pointer-click.ts +1 -1
- package/src/icons/artwork/move.ts +1 -1
- package/src/icons/artwork/package.ts +1 -1
- package/src/icons/artwork/palette.png +0 -0
- package/src/icons/artwork/palette.ts +2 -1
- package/src/icons/artwork/panel-left-close.ts +1 -1
- package/src/icons/artwork/panel-left.png +0 -0
- package/src/icons/artwork/panel-left.ts +2 -1
- package/src/icons/artwork/paperclip.png +0 -0
- package/src/icons/artwork/paperclip.ts +2 -1
- package/src/icons/artwork/pencil.ts +1 -1
- package/src/icons/artwork/phone-call.png +0 -0
- package/src/icons/artwork/phone-call.ts +2 -1
- package/src/icons/artwork/phone.ts +1 -1
- package/src/icons/artwork/piggy-bank.ts +1 -1
- package/src/icons/artwork/play.ts +1 -1
- package/src/icons/artwork/plus.ts +1 -1
- package/src/icons/artwork/power.ts +1 -1
- package/src/icons/artwork/radio.png +0 -0
- package/src/icons/artwork/radio.ts +2 -1
- package/src/icons/artwork/receipt.ts +1 -1
- package/src/icons/artwork/refresh-cw.ts +1 -1
- package/src/icons/artwork/rotate-ccw.ts +1 -1
- package/src/icons/artwork/sales.ts +2 -0
- package/src/icons/artwork/save.ts +1 -1
- package/src/icons/artwork/search.ts +1 -1
- package/src/icons/artwork/settings.ts +1 -1
- package/src/icons/artwork/shield-alert.ts +1 -1
- package/src/icons/artwork/shield-check.ts +1 -1
- package/src/icons/artwork/shield-off.ts +1 -1
- package/src/icons/artwork/shield.ts +1 -1
- package/src/icons/artwork/shopping-bag.png +0 -0
- package/src/icons/artwork/shopping-bag.ts +2 -1
- package/src/icons/artwork/shopping-cart.ts +1 -1
- package/src/icons/artwork/shuffle.ts +1 -1
- package/src/icons/artwork/sliders-horizontal.ts +1 -1
- package/src/icons/artwork/smartphone.ts +1 -1
- package/src/icons/artwork/sparkles.ts +1 -1
- package/src/icons/artwork/square.ts +1 -1
- package/src/icons/artwork/star-filled.ts +1 -1
- package/src/icons/artwork/star.ts +1 -1
- package/src/icons/artwork/sticky-note.png +0 -0
- package/src/icons/artwork/sticky-note.ts +2 -1
- package/src/icons/artwork/store.png +0 -0
- package/src/icons/artwork/store.ts +2 -1
- package/src/icons/artwork/sun.ts +1 -1
- package/src/icons/artwork/tag.ts +1 -1
- package/src/icons/artwork/target.png +0 -0
- package/src/icons/artwork/target.ts +2 -1
- package/src/icons/artwork/ticket.png +0 -0
- package/src/icons/artwork/ticket.ts +2 -1
- package/src/icons/artwork/trash-2.png +0 -0
- package/src/icons/artwork/trash-2.ts +2 -1
- package/src/icons/artwork/trending-up.ts +1 -1
- package/src/icons/artwork/triangle-alert.ts +1 -1
- package/src/icons/artwork/trophy.ts +1 -1
- package/src/icons/artwork/undo-2.ts +1 -1
- package/src/icons/artwork/upload.ts +1 -1
- package/src/icons/artwork/user-check.png +0 -0
- package/src/icons/artwork/user-check.ts +2 -1
- package/src/icons/artwork/user-plus.ts +1 -1
- package/src/icons/artwork/user.ts +1 -1
- package/src/icons/artwork/users.ts +1 -1
- package/src/icons/artwork/volume-2.ts +1 -1
- package/src/icons/artwork/volume-x.ts +1 -1
- package/src/icons/artwork/wallet.ts +1 -1
- package/src/icons/artwork/x.ts +1 -1
- package/src/icons/artwork/zap.ts +1 -1
- package/src/icons/artwork/zoom-in.png +0 -0
- package/src/icons/artwork/zoom-in.ts +2 -1
- package/src/icons/asset-modules.d.ts +4 -0
- package/src/icons/bir-form-0619-e.tsx +4 -0
- package/src/icons/bir-form-1601-eq.tsx +4 -0
- package/src/icons/bir-form-2307.tsx +4 -0
- package/src/icons/bir-office.tsx +4 -0
- package/src/icons/calendar-days.tsx +1 -1
- package/src/icons/check.tsx +2 -2
- package/src/icons/chevron-down.tsx +2 -2
- package/src/icons/chevron-left.tsx +2 -2
- package/src/icons/chevron-up.tsx +2 -2
- package/src/icons/circle-check-big.tsx +3 -2
- package/src/icons/circle-check.tsx +2 -2
- package/src/icons/circle-slash.tsx +1 -1
- package/src/icons/cloud-upload.tsx +1 -1
- package/src/icons/create-artwork-icon.test.tsx +33 -1
- package/src/icons/create-artwork-icon.tsx +35 -40
- package/src/icons/ellipsis-vertical.tsx +2 -2
- package/src/icons/index.ts +5 -0
- package/src/icons/key-round.tsx +1 -1
- package/src/icons/registry.ts +8 -3
- package/src/icons/sales.tsx +4 -0
- package/src/icons/settings-2.tsx +1 -1
- package/src/icons/star.tsx +2 -2
- package/src/icons/user-round.tsx +1 -1
- package/src/icons/users-round.tsx +1 -1
- 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
- package/src/icons/artwork/arrow-down-left.ts +0 -2
- package/src/icons/artwork/arrow-left.ts +0 -2
- package/src/icons/artwork/arrow-right-left.ts +0 -2
- package/src/icons/artwork/arrow-right.ts +0 -2
- package/src/icons/artwork/arrow-up-down.ts +0 -2
- package/src/icons/artwork/arrow-up-right.ts +0 -2
- package/src/icons/artwork/arrow-up.ts +0 -2
- package/src/icons/artwork/calendar-days.ts +0 -2
- package/src/icons/artwork/chevron-down.ts +0 -2
- package/src/icons/artwork/chevron-left.ts +0 -2
- package/src/icons/artwork/chevron-up.ts +0 -2
- package/src/icons/artwork/circle-check-big.ts +0 -2
- package/src/icons/artwork/circle-slash.ts +0 -2
- package/src/icons/artwork/cloud-upload.ts +0 -2
- package/src/icons/artwork/ellipsis-vertical.ts +0 -2
- package/src/icons/artwork/key-round.ts +0 -2
- package/src/icons/artwork/settings-2.ts +0 -2
- package/src/icons/artwork/user-round.ts +0 -2
- package/src/icons/artwork/users-round.ts +0 -2
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { createMemo, createSignal, For, Show
|
|
2
|
-
import {
|
|
1
|
+
import { createMemo, createSignal, For, Show } from "solid-js";
|
|
2
|
+
import type { JSX } from "@solidjs/web";
|
|
3
|
+
import { Portal } from "@solidjs/web";
|
|
3
4
|
import CalendarDays from "../../icons/calendar-days";
|
|
4
5
|
import ChevronDown from "../../icons/chevron-down";
|
|
5
6
|
import ChevronLeft from "../../icons/chevron-left";
|
|
6
7
|
import ChevronRight from "../../icons/chevron-right";
|
|
7
8
|
import X from "../../icons/x";
|
|
8
9
|
import { injectCSS } from "../../utils/inject-css";
|
|
10
|
+
import { ariaBool, ariaTri } from "../../utils/aria";
|
|
9
11
|
|
|
10
12
|
export type MultiPeriodGranularity = "day" | "week" | "month" | "year";
|
|
11
13
|
|
|
@@ -218,11 +220,11 @@ export default function MultiPeriodPicker(props: MultiPeriodPickerProps): JSX.El
|
|
|
218
220
|
<div class={`ksui-mpp ${props.class ?? ""}`} data-testid="multi-period-picker">
|
|
219
221
|
<div class="ksui-mpp-tabs" role="tablist" aria-label={labels().period ?? "Period"}>
|
|
220
222
|
<For each={tabOptions}>{(granularity) => (
|
|
221
|
-
<button type="button" role="tab" aria-selected={props.granularity === granularity}
|
|
223
|
+
<button type="button" role="tab" aria-selected={ariaBool(props.granularity === granularity)} class={["ksui-mpp-tab", { "ksui-mpp-selected": props.granularity === granularity }]} onClick={() => { props.onGranularityChange(granularity); setViewYear(current.year); setViewMonth(current.month); }}>
|
|
222
224
|
{defaultLabel(granularity, labels())}
|
|
223
225
|
</button>
|
|
224
226
|
)}</For>
|
|
225
|
-
<button ref={triggerRef} type="button" class="ksui-mpp-trigger" disabled={props.disabled} aria-haspopup="dialog" aria-expanded={open()} onClick={openPicker}>
|
|
227
|
+
<button ref={triggerRef} type="button" class="ksui-mpp-trigger" disabled={props.disabled} aria-haspopup="dialog" aria-expanded={ariaBool(open())} onClick={openPicker}>
|
|
226
228
|
<CalendarDays size={14} aria-hidden="true" /> <span>{summary()}</span><ChevronDown size={14} aria-hidden="true" />
|
|
227
229
|
</button>
|
|
228
230
|
</div>
|
|
@@ -231,18 +233,18 @@ export default function MultiPeriodPicker(props: MultiPeriodPickerProps): JSX.El
|
|
|
231
233
|
<div ref={popupRef} class="ksui-mpp-popover" style={popupStyle()} role="dialog" aria-label={labels().period ?? "Pick periods"} tabindex={-1}>
|
|
232
234
|
<Show when={props.granularity === "day"}>
|
|
233
235
|
<div class="ksui-mpp-heading"><button class="ksui-mpp-nav" type="button" aria-label="Previous month" onClick={() => shiftMonth(-1)}><ChevronLeft size={14} /></button><span>{new Date(Date.UTC(viewYear(), viewMonth() - 1, 1)).toLocaleDateString("en-US", { month: "long", year: "numeric", timeZone: "UTC" })}</span><button class="ksui-mpp-nav" type="button" aria-label="Next month" onClick={() => shiftMonth(1)}><ChevronRight size={14} /></button></div>
|
|
234
|
-
<div class="ksui-mpp-grid ksui-mpp-grid-days"><For each={["S", "M", "T", "W", "T", "F", "S"]}>{(label) => <span class="ksui-mpp-token">{label}</span>}</For><For each={days()}>{(item) => <button type="button"
|
|
236
|
+
<div class="ksui-mpp-grid ksui-mpp-grid-days"><For each={["S", "M", "T", "W", "T", "F", "S"]}>{(label) => <span class="ksui-mpp-token">{label}</span>}</For><For each={days()}>{(item) => <button type="button" class={["ksui-mpp-token", { "ksui-mpp-selected": props.selected.includes(item.token) }]} aria-pressed={ariaTri(props.selected.includes(item.token))} onClick={() => toggle(item.token)}>{tokenContent(item)}</button>}</For></div>
|
|
235
237
|
</Show>
|
|
236
238
|
<Show when={props.granularity === "week"}>
|
|
237
239
|
<div class="ksui-mpp-heading"><button class="ksui-mpp-nav" type="button" aria-label="Previous year" onClick={() => setViewYear((year) => year - 1)}><ChevronLeft size={14} /></button><span>{viewYear()}</span><button class="ksui-mpp-nav" type="button" aria-label="Next year" onClick={() => setViewYear((year) => year + 1)}><ChevronRight size={14} /></button></div>
|
|
238
|
-
<div class="ksui-mpp-months"><For each={Array.from({ length: 12 }, (_, index) => index + 1)}>{(month) => <button type="button" class="ksui-mpp-month"
|
|
239
|
-
<div class="ksui-mpp-week-label">Weeks</div><div class="ksui-mpp-grid"><For each={weekOptions()}>{(item) => <button type="button"
|
|
240
|
+
<div class="ksui-mpp-months"><For each={Array.from({ length: 12 }, (_, index) => index + 1)}>{(month) => <button type="button" class={["ksui-mpp-month", { "ksui-mpp-selected": month === viewMonth() }]} onClick={() => setViewMonth(month)}>{new Date(Date.UTC(2000, month - 1, 1)).toLocaleDateString("en-US", { month: "short", timeZone: "UTC" })}</button>}</For></div>
|
|
241
|
+
<div class="ksui-mpp-week-label">Weeks</div><div class="ksui-mpp-grid"><For each={weekOptions()}>{(item) => <button type="button" class={["ksui-mpp-token", { "ksui-mpp-selected": props.selected.includes(item.token) }]} aria-pressed={ariaTri(props.selected.includes(item.token))} onClick={() => toggle(item.token)}>{tokenContent(item)}</button>}</For></div>
|
|
240
242
|
</Show>
|
|
241
243
|
<Show when={props.granularity === "month"}>
|
|
242
244
|
<div class="ksui-mpp-heading"><button class="ksui-mpp-nav" type="button" aria-label="Previous year" onClick={() => setViewYear((year) => year - 1)}><ChevronLeft size={14} /></button><span>{viewYear()}</span><button class="ksui-mpp-nav" type="button" aria-label="Next year" onClick={() => setViewYear((year) => year + 1)}><ChevronRight size={14} /></button></div>
|
|
243
|
-
<div class="ksui-mpp-grid ksui-mpp-grid-months"><For each={monthOptions()}>{(item) => <button type="button"
|
|
245
|
+
<div class="ksui-mpp-grid ksui-mpp-grid-months"><For each={monthOptions()}>{(item) => <button type="button" class={["ksui-mpp-token", { "ksui-mpp-selected": props.selected.includes(item.token) }]} aria-pressed={ariaTri(props.selected.includes(item.token))} onClick={() => toggle(item.token)}>{tokenContent(item)}</button>}</For></div>
|
|
244
246
|
</Show>
|
|
245
|
-
<Show when={props.granularity === "year"}><div class="ksui-mpp-grid ksui-mpp-grid-years"><For each={yearOptions()}>{(item) => <button type="button"
|
|
247
|
+
<Show when={props.granularity === "year"}><div class="ksui-mpp-grid ksui-mpp-grid-years"><For each={yearOptions()}>{(item) => <button type="button" class={["ksui-mpp-token", { "ksui-mpp-selected": props.selected.includes(item.token) }]} aria-pressed={ariaTri(props.selected.includes(item.token))} onClick={() => toggle(item.token)}>{tokenContent(item)}</button>}</For></div></Show>
|
|
246
248
|
<Show when={props.selected.length > 0}><div class="ksui-mpp-chips"><For each={props.selected}>{(token) => <button type="button" class="ksui-mpp-chip ksui-mpp-selected" aria-label={`Remove ${selectedLabel(token)}`} onClick={() => toggle(token)}><span>{selectedLabel(token)}</span><X size={11} aria-hidden="true" /></button>}</For></div></Show>
|
|
247
249
|
</div>
|
|
248
250
|
</Portal>
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
// want the host Button can pass it through the `action` slot, which fully
|
|
12
12
|
// replaces the built-in button.
|
|
13
13
|
|
|
14
|
-
import type { JSX } from "
|
|
15
|
-
import { Show,
|
|
14
|
+
import type { JSX } from "@solidjs/web";
|
|
15
|
+
import { Show, omit } from "solid-js";
|
|
16
16
|
import { ArrowLeft } from "../../icons/index";
|
|
17
17
|
|
|
18
18
|
export interface NotFoundProps
|
|
@@ -46,19 +46,8 @@ export interface NotFoundProps
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
export default function NotFound(props: NotFoundProps): JSX.Element {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
"heading",
|
|
52
|
-
"message",
|
|
53
|
-
"buttonText",
|
|
54
|
-
"href",
|
|
55
|
-
"onButtonClick",
|
|
56
|
-
"logo",
|
|
57
|
-
"hideButton",
|
|
58
|
-
"action",
|
|
59
|
-
"testId",
|
|
60
|
-
"class",
|
|
61
|
-
]);
|
|
49
|
+
const local = props;
|
|
50
|
+
const others = omit(props, "title", "heading", "message", "buttonText", "href", "onButtonClick", "logo", "hideButton", "action", "testId", "class");
|
|
62
51
|
|
|
63
52
|
const showTitle = () => local.title !== "";
|
|
64
53
|
const buttonClass =
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import { Portal } from "
|
|
1
|
+
import { Portal } from "@solidjs/web";
|
|
2
2
|
import { useTopLayer } from "../../utils/top-layer";
|
|
3
3
|
import { usePopoverMount } from "../../utils/modal-layer";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
createMemo,
|
|
7
|
-
createSignal,
|
|
8
|
-
For,
|
|
9
|
-
onCleanup,
|
|
10
|
-
onMount,
|
|
11
|
-
Show,
|
|
12
|
-
type JSX,
|
|
13
|
-
} from "solid-js";
|
|
4
|
+
import { createEffect, createMemo, createSignal, For, onCleanup, onSettled, Show } from "solid-js";
|
|
5
|
+
import type { JSX } from "@solidjs/web";
|
|
14
6
|
import Banknote from "../../icons/banknote";
|
|
15
7
|
import Loader2 from "../../icons/loader-2";
|
|
16
8
|
import AccountAvatar from "../base/AccountAvatar";
|
|
9
|
+
import { ariaBool } from "../../utils/aria";
|
|
17
10
|
|
|
18
11
|
export interface PaymentAccountOption {
|
|
19
12
|
id: number;
|
|
@@ -109,19 +102,21 @@ export default function PaymentAccountPicker(props: PaymentAccountPickerProps):
|
|
|
109
102
|
// and Charge gating already depends on the count it reports up via
|
|
110
103
|
// onCountChange. If the picker ever needs to refetch on org switch,
|
|
111
104
|
// swap this for a createEffect tracking the active-org signal.
|
|
112
|
-
|
|
105
|
+
onSettled(() => {
|
|
113
106
|
void fetchAccounts();
|
|
114
107
|
});
|
|
115
108
|
|
|
116
109
|
// Auto-select the first account once the list loads, so a single-account
|
|
117
110
|
// org doesn't have to tap to charge. Skips when something is already
|
|
118
111
|
// selected (preserves an explicit reset to null).
|
|
119
|
-
createEffect(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
createEffect(
|
|
113
|
+
() => ({ selected: props.selected, isLoading: loading(), first: accounts()[0] }),
|
|
114
|
+
({ selected, isLoading, first }) => {
|
|
115
|
+
if (selected) return;
|
|
116
|
+
if (isLoading) return;
|
|
123
117
|
if (first) props.onChange(first);
|
|
124
|
-
}
|
|
118
|
+
},
|
|
119
|
+
);
|
|
125
120
|
|
|
126
121
|
const sections = createMemo(() => groupAndSort(accounts()));
|
|
127
122
|
const noAccounts = () => !loading() && accounts().length === 0;
|
|
@@ -150,8 +145,8 @@ export default function PaymentAccountPicker(props: PaymentAccountPickerProps):
|
|
|
150
145
|
});
|
|
151
146
|
};
|
|
152
147
|
|
|
153
|
-
createEffect(() => {
|
|
154
|
-
if (!
|
|
148
|
+
createEffect(open, (isOpen) => {
|
|
149
|
+
if (!isOpen) return;
|
|
155
150
|
updatePosition();
|
|
156
151
|
|
|
157
152
|
const onDocClick = (e: MouseEvent) => {
|
|
@@ -172,12 +167,12 @@ export default function PaymentAccountPicker(props: PaymentAccountPickerProps):
|
|
|
172
167
|
document.addEventListener("keydown", onEsc, true);
|
|
173
168
|
window.addEventListener("resize", onReflow);
|
|
174
169
|
window.addEventListener("scroll", onReflow, true);
|
|
175
|
-
|
|
170
|
+
return () => {
|
|
176
171
|
document.removeEventListener("mousedown", onDocClick);
|
|
177
172
|
document.removeEventListener("keydown", onEsc, true);
|
|
178
173
|
window.removeEventListener("resize", onReflow);
|
|
179
174
|
window.removeEventListener("scroll", onReflow, true);
|
|
180
|
-
}
|
|
175
|
+
};
|
|
181
176
|
});
|
|
182
177
|
|
|
183
178
|
const select = (a: PaymentAccountOption) => {
|
|
@@ -202,7 +197,7 @@ export default function PaymentAccountPicker(props: PaymentAccountPickerProps):
|
|
|
202
197
|
}
|
|
203
198
|
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-accent,#fbbf24)_40%,transparent)] hover:bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_5%,transparent)] transition-colors text-sm text-left cursor-pointer disabled:cursor-not-allowed disabled:opacity-60"
|
|
204
199
|
aria-haspopup="listbox"
|
|
205
|
-
aria-expanded={open()}
|
|
200
|
+
aria-expanded={ariaBool(open())}
|
|
206
201
|
>
|
|
207
202
|
<Show when={loading()} fallback={null}>
|
|
208
203
|
<Loader2 size={14} class="animate-spin text-[var(--ks-fg-subtle,#71717a)] shrink-0" aria-hidden="true" />
|
|
@@ -245,7 +240,7 @@ export default function PaymentAccountPicker(props: PaymentAccountPickerProps):
|
|
|
245
240
|
<div
|
|
246
241
|
ref={(el) => {
|
|
247
242
|
popupRef = el;
|
|
248
|
-
|
|
243
|
+
useTopLayer(el);
|
|
249
244
|
}}
|
|
250
245
|
data-testid="payment-account-picker-popup"
|
|
251
246
|
class="z-[100] rounded-md border border-[var(--ks-border-strong,#3f3f46)] bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_95%,transparent)] backdrop-blur shadow-xl overflow-hidden flex flex-col"
|
|
@@ -286,7 +281,7 @@ export default function PaymentAccountPicker(props: PaymentAccountPickerProps):
|
|
|
286
281
|
{(a) => {
|
|
287
282
|
const selected = () => props.selected?.id === a.id;
|
|
288
283
|
return (
|
|
289
|
-
<li role="option" aria-selected={selected()}>
|
|
284
|
+
<li role="option" aria-selected={ariaBool(selected())}>
|
|
290
285
|
<button
|
|
291
286
|
type="button"
|
|
292
287
|
data-testid={`payment-account-picker-result-${a.id}`}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
createEffect,
|
|
13
13
|
For,
|
|
14
14
|
Show,
|
|
15
|
-
|
|
15
|
+
onSettled,
|
|
16
16
|
} from "solid-js";
|
|
17
17
|
import ComboBox from "./ComboBox";
|
|
18
18
|
import type { ClientOption } from "./picker-types";
|
|
@@ -123,7 +123,8 @@ export default function SalesBodyEditor(props: SalesBodyEditorProps) {
|
|
|
123
123
|
const [loadError, setLoadError] = createSignal<string | null>(null);
|
|
124
124
|
const [pickerOpen, setPickerOpen] = createSignal(false);
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
onSettled(() => {
|
|
127
|
+
void (async () => {
|
|
127
128
|
try {
|
|
128
129
|
const res = await fetch("/api/packages", { credentials: "include" });
|
|
129
130
|
if (!res.ok)
|
|
@@ -139,6 +140,8 @@ export default function SalesBodyEditor(props: SalesBodyEditorProps) {
|
|
|
139
140
|
} finally {
|
|
140
141
|
setLoading(false);
|
|
141
142
|
}
|
|
143
|
+
|
|
144
|
+
})();
|
|
142
145
|
});
|
|
143
146
|
|
|
144
147
|
function addVariant(pkg: Package, variant: Variant) {
|
|
@@ -207,19 +210,19 @@ export default function SalesBodyEditor(props: SalesBodyEditorProps) {
|
|
|
207
210
|
const total = createMemo(() => Math.max(0, subtotal() - effectiveDiscount()));
|
|
208
211
|
const cartPackageIds = createMemo(() => props.items.map((l) => l.package_id));
|
|
209
212
|
|
|
210
|
-
createEffect(
|
|
211
|
-
|
|
213
|
+
createEffect(
|
|
214
|
+
() => ({ voucher: props.voucher, subtotal: subtotal(), cartIds: cartPackageIds() }),
|
|
215
|
+
({ voucher: v, subtotal: sub, cartIds }) => {
|
|
212
216
|
if (!v) return;
|
|
213
|
-
const sub = subtotal();
|
|
214
217
|
const minOk = sub >= Number(v.minimum_purchase ?? 0);
|
|
215
218
|
const allowed = v.applicable_packages;
|
|
216
|
-
const cartIds = cartPackageIds();
|
|
217
219
|
const pkgsOk =
|
|
218
220
|
!allowed ||
|
|
219
221
|
allowed.length === 0 ||
|
|
220
222
|
(cartIds.length > 0 && cartIds.every((id) => allowed.includes(id)));
|
|
221
223
|
if (!minOk || !pkgsOk) props.setVoucher(null);
|
|
222
|
-
}
|
|
224
|
+
},
|
|
225
|
+
);
|
|
223
226
|
|
|
224
227
|
return (
|
|
225
228
|
<div class="rounded-lg border border-[color-mix(in_srgb,var(--ks-success,#10b981)_20%,transparent)] bg-[color-mix(in_srgb,var(--ks-success,#10b981)_5%,transparent)] p-3 space-y-3">
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { createEffect, createMemo, createSignal, For, onCleanup, Show
|
|
2
|
-
import {
|
|
1
|
+
import { createEffect, createMemo, createSignal, For, onCleanup, Show } from "solid-js";
|
|
2
|
+
import type { JSX } from "@solidjs/web";
|
|
3
|
+
import { Portal } from "@solidjs/web";
|
|
3
4
|
import { useTopLayer } from "../../utils/top-layer";
|
|
4
5
|
import { usePopoverMount } from "../../utils/modal-layer";
|
|
5
6
|
import ChevronsUpDown from "../../icons/chevrons-up-down";
|
|
@@ -93,8 +94,8 @@ export default function SearchableSelect(props: SearchableSelectProps): JSX.Elem
|
|
|
93
94
|
});
|
|
94
95
|
};
|
|
95
96
|
|
|
96
|
-
createEffect(() => {
|
|
97
|
-
if (!
|
|
97
|
+
createEffect(open, (isOpen) => {
|
|
98
|
+
if (!isOpen) return;
|
|
98
99
|
// Initial measurement + focus + listeners.
|
|
99
100
|
updatePosition();
|
|
100
101
|
queueMicrotask(() => inputRef?.focus());
|
|
@@ -119,12 +120,12 @@ export default function SearchableSelect(props: SearchableSelectProps): JSX.Elem
|
|
|
119
120
|
window.addEventListener("resize", onReflow);
|
|
120
121
|
// Capture phase so we catch scrolls in every ancestor.
|
|
121
122
|
window.addEventListener("scroll", onReflow, true);
|
|
122
|
-
|
|
123
|
+
return () => {
|
|
123
124
|
document.removeEventListener("mousedown", onDocClick);
|
|
124
125
|
document.removeEventListener("keydown", onEsc);
|
|
125
126
|
window.removeEventListener("resize", onReflow);
|
|
126
127
|
window.removeEventListener("scroll", onReflow, true);
|
|
127
|
-
}
|
|
128
|
+
};
|
|
128
129
|
});
|
|
129
130
|
|
|
130
131
|
const emptyStateLabel = () => {
|
|
@@ -152,11 +153,11 @@ export default function SearchableSelect(props: SearchableSelectProps): JSX.Elem
|
|
|
152
153
|
data-testid={props.triggerTestId}
|
|
153
154
|
disabled={props.disabled || busy()}
|
|
154
155
|
onClick={() => !props.disabled && setOpen((o) => !o)}
|
|
155
|
-
class={
|
|
156
|
+
class={[
|
|
156
157
|
props.triggerClass ??
|
|
157
158
|
"inline-flex items-center gap-1.5 text-xs text-[var(--ks-fg,#ffffff)] bg-[color-mix(in_srgb,var(--ks-border,rgba(39,39,42,0.5))_60%,transparent)] hover:bg-[var(--ks-surface-raised,#1a1a1a)] border border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_60%,transparent)] rounded px-2 py-1 cursor-pointer transition-colors"
|
|
158
|
-
}
|
|
159
|
-
|
|
159
|
+
, { "cursor-not-allowed opacity-60": props.disabled }]}
|
|
160
|
+
|
|
160
161
|
title={props.disabled ? undefined : "Click to select"}
|
|
161
162
|
>
|
|
162
163
|
<span class={props.triggerLabelClass ?? "truncate max-w-[180px]"}>
|
|
@@ -173,7 +174,7 @@ export default function SearchableSelect(props: SearchableSelectProps): JSX.Elem
|
|
|
173
174
|
<div
|
|
174
175
|
ref={(el) => {
|
|
175
176
|
popupRef = el;
|
|
176
|
-
|
|
177
|
+
useTopLayer(el);
|
|
177
178
|
}}
|
|
178
179
|
class="z-[10000] rounded-md border border-[var(--ks-input-border,#3f3f46)] bg-[color-mix(in_srgb,var(--ks-overlay-surface,#18181b)_95%,transparent)] backdrop-blur shadow-xl overflow-hidden flex flex-col"
|
|
179
180
|
style={popupStyle()}
|
|
@@ -202,11 +203,11 @@ export default function SearchableSelect(props: SearchableSelectProps): JSX.Elem
|
|
|
202
203
|
<button
|
|
203
204
|
type="button"
|
|
204
205
|
onClick={() => select(opt)}
|
|
205
|
-
class="w-full text-left px-3 py-2 text-xs hover:bg-[color-mix(in_srgb,var(--ks-primary,#c9a961)_10%,transparent)] transition-colors flex items-center justify-between gap-2"
|
|
206
|
-
classList={{
|
|
206
|
+
class={["w-full text-left px-3 py-2 text-xs hover:bg-[color-mix(in_srgb,var(--ks-primary,#c9a961)_10%,transparent)] transition-colors flex items-center justify-between gap-2", {
|
|
207
207
|
"text-[var(--ks-accent,#fbbf24)]": selected(),
|
|
208
208
|
"text-[var(--ks-fg,#ffffff)]": !selected(),
|
|
209
|
-
}}
|
|
209
|
+
}]}
|
|
210
|
+
|
|
210
211
|
>
|
|
211
212
|
<span class="flex flex-col min-w-0">
|
|
212
213
|
<span class="font-medium truncate">{opt.label}</span>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// <Show when={revealed()}>); this component holds no fetch, no plugin state.
|
|
7
7
|
|
|
8
8
|
import type { Component } from "solid-js";
|
|
9
|
-
import { Show, createSignal,
|
|
9
|
+
import { Show, createSignal, omit } from "solid-js";
|
|
10
10
|
import Copy from "../../icons/copy";
|
|
11
11
|
|
|
12
12
|
export interface SecretRevealProps {
|
|
@@ -23,7 +23,7 @@ export interface SecretRevealProps {
|
|
|
23
23
|
const DEFAULT_WARNING = "Save this now - it will not be shown again.";
|
|
24
24
|
|
|
25
25
|
const SecretReveal: Component<SecretRevealProps> = (props) => {
|
|
26
|
-
const
|
|
26
|
+
const local = props;
|
|
27
27
|
const [copied, setCopied] = createSignal(false);
|
|
28
28
|
|
|
29
29
|
const copy = () => {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// advanced-fields toggle entirely, for a caller that locks `category` to one
|
|
8
8
|
// value and never needs EWT/sharing (e.g. a "record my own expense" surface).
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { createEffect, createSignal, Show, For } from "solid-js";
|
|
11
11
|
import X from "../../icons/x";
|
|
12
12
|
import Upload from "../../icons/upload";
|
|
13
13
|
import FileIcon from "../../icons/file";
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
createPendingFile,
|
|
45
45
|
revokePendingFile,
|
|
46
46
|
} from "../../utils/pending-file";
|
|
47
|
+
import { ariaBool } from "../../utils/aria";
|
|
47
48
|
|
|
48
49
|
export type TransactionAccount = PaymentAccountOption & {
|
|
49
50
|
balance?: number | string | null;
|
|
@@ -122,7 +123,7 @@ function payeeSecondary(p: PayeeOption): string | null {
|
|
|
122
123
|
);
|
|
123
124
|
}
|
|
124
125
|
|
|
125
|
-
type IconComponent = (props: { size?: number; class?: string }) => import("
|
|
126
|
+
type IconComponent = (props: { size?: number; class?: string }) => import("@solidjs/web").JSX.Element;
|
|
126
127
|
|
|
127
128
|
const CATEGORY_TONE: Record<
|
|
128
129
|
string,
|
|
@@ -363,10 +364,9 @@ export default function TransactionForm(props: TransactionFormProps) {
|
|
|
363
364
|
const [selectedPayee, setSelectedPayee] = createSignal<PayeeOption | null>(
|
|
364
365
|
null
|
|
365
366
|
);
|
|
366
|
-
createEffect(
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
const sel = selectedPayee();
|
|
367
|
+
createEffect(
|
|
368
|
+
() => ({ name: props.payee, id: props.payeeId, sel: selectedPayee() }),
|
|
369
|
+
({ name, id, sel }) => {
|
|
370
370
|
if (id != null && name && !sel) {
|
|
371
371
|
setSelectedPayee({ id, name, kind: "vendor" });
|
|
372
372
|
} else if (sel && sel.name !== name) {
|
|
@@ -374,12 +374,14 @@ export default function TransactionForm(props: TransactionFormProps) {
|
|
|
374
374
|
} else if (!name && sel) {
|
|
375
375
|
setSelectedPayee(null);
|
|
376
376
|
}
|
|
377
|
-
}
|
|
377
|
+
},
|
|
378
|
+
);
|
|
378
379
|
// A payee picked from search already carries its tax ID; one restored from a
|
|
379
380
|
// saved row does not, so load it before deciding what to show.
|
|
380
|
-
createEffect(
|
|
381
|
-
|
|
382
|
-
|
|
381
|
+
createEffect(
|
|
382
|
+
() => ({ sel: selectedPayee(), enabled: !!props.setPayeeTin }),
|
|
383
|
+
({ sel, enabled }) => {
|
|
384
|
+
if (!enabled || !sel || sel.tin !== undefined) return;
|
|
383
385
|
const id = sel.id;
|
|
384
386
|
loadPayee(id)
|
|
385
387
|
.then((rec) => {
|
|
@@ -388,7 +390,8 @@ export default function TransactionForm(props: TransactionFormProps) {
|
|
|
388
390
|
setSelectedPayee({ ...cur, tin: rec.tin ?? null, address: rec.address ?? null });
|
|
389
391
|
})
|
|
390
392
|
.catch(() => {});
|
|
391
|
-
}
|
|
393
|
+
},
|
|
394
|
+
);
|
|
392
395
|
const taxPayee = () =>
|
|
393
396
|
props.setPayeeTin && props.category !== "sale" && catConfig().showPayee
|
|
394
397
|
? selectedPayee()
|
|
@@ -413,8 +416,9 @@ export default function TransactionForm(props: TransactionFormProps) {
|
|
|
413
416
|
{ id: number; name: string }[]
|
|
414
417
|
>();
|
|
415
418
|
let subcategoryRequestId = 0;
|
|
416
|
-
createEffect(
|
|
417
|
-
|
|
419
|
+
createEffect(
|
|
420
|
+
subcategoryAppliesTo,
|
|
421
|
+
(appliesTo) => {
|
|
418
422
|
const requestId = ++subcategoryRequestId;
|
|
419
423
|
if (!appliesTo) {
|
|
420
424
|
setSubcategoryOptions(undefined);
|
|
@@ -441,7 +445,8 @@ export default function TransactionForm(props: TransactionFormProps) {
|
|
|
441
445
|
subcategoryCache.set(appliesTo, options);
|
|
442
446
|
if (requestId === subcategoryRequestId) setSubcategoryOptions(options);
|
|
443
447
|
});
|
|
444
|
-
}
|
|
448
|
+
},
|
|
449
|
+
);
|
|
445
450
|
|
|
446
451
|
// True once the async resource has resolved at least once. Gates the
|
|
447
452
|
// SearchableSelect mount so the loading-state placeholder shows while the
|
|
@@ -453,12 +458,20 @@ export default function TransactionForm(props: TransactionFormProps) {
|
|
|
453
458
|
return props.allowPayable === false ? base : [...base, "payable"];
|
|
454
459
|
};
|
|
455
460
|
|
|
456
|
-
createEffect(
|
|
457
|
-
|
|
458
|
-
props.
|
|
459
|
-
props.
|
|
461
|
+
createEffect(
|
|
462
|
+
() => ({
|
|
463
|
+
category: props.category,
|
|
464
|
+
enabled: props.transferFeeEnabled,
|
|
465
|
+
setEnabled: props.setTransferFeeEnabled,
|
|
466
|
+
setAmount: props.setTransferFeeAmount,
|
|
467
|
+
}),
|
|
468
|
+
({ category, enabled, setEnabled, setAmount }) => {
|
|
469
|
+
if (category !== "business" && enabled) {
|
|
470
|
+
setEnabled(false);
|
|
471
|
+
setAmount("");
|
|
460
472
|
}
|
|
461
|
-
}
|
|
473
|
+
},
|
|
474
|
+
);
|
|
462
475
|
|
|
463
476
|
function addFiles(files: File[]) {
|
|
464
477
|
const existing = new Set(
|
|
@@ -519,8 +532,8 @@ export default function TransactionForm(props: TransactionFormProps) {
|
|
|
519
532
|
|
|
520
533
|
return (
|
|
521
534
|
<div
|
|
522
|
-
class="relative flex flex-col flex-1 min-h-0"
|
|
523
|
-
|
|
535
|
+
class={["relative flex flex-col flex-1 min-h-0", { "ks-transaction-compact": compact(), "ks-transaction-compact-details": compact() && viewMode() === "advanced" }]}
|
|
536
|
+
|
|
524
537
|
onDragEnter={handleDragEnter}
|
|
525
538
|
onDragLeave={handleDragLeave}
|
|
526
539
|
onDragOver={handleDragOver}
|
|
@@ -544,7 +557,7 @@ export default function TransactionForm(props: TransactionFormProps) {
|
|
|
544
557
|
<Button
|
|
545
558
|
type="button"
|
|
546
559
|
role="tab"
|
|
547
|
-
aria-selected={props.category === cat}
|
|
560
|
+
aria-selected={ariaBool(props.category === cat)}
|
|
548
561
|
data-testid={`transactions-form-category-${cat}`}
|
|
549
562
|
intent="secondary"
|
|
550
563
|
variant="ghost"
|
|
@@ -552,8 +565,7 @@ export default function TransactionForm(props: TransactionFormProps) {
|
|
|
552
565
|
noGlow
|
|
553
566
|
noRipple
|
|
554
567
|
noScanline
|
|
555
|
-
class={`ks-transaction-type-button ks-transaction-type-${cat}`}
|
|
556
|
-
classList={{ "ks-transaction-type-active": props.category === cat }}
|
|
568
|
+
class={`ks-transaction-type-button ks-transaction-type-${cat}${props.category === cat ? " ks-transaction-type-active" : ""}`}
|
|
557
569
|
onClick={() => {
|
|
558
570
|
props.setCategory(cat);
|
|
559
571
|
props.setSourceAccount("");
|
|
@@ -587,8 +599,8 @@ export default function TransactionForm(props: TransactionFormProps) {
|
|
|
587
599
|
}}
|
|
588
600
|
class="flex flex-col flex-1 min-h-0"
|
|
589
601
|
>
|
|
590
|
-
<div class="flex-1 overflow-x-hidden overflow-y-auto px-5 sm:px-6 py-5 space-y-4"
|
|
591
|
-
|
|
602
|
+
<div class={["flex-1 overflow-x-hidden overflow-y-auto px-5 sm:px-6 py-5 space-y-4", { "ks-transaction-compact-body": compact() }]}
|
|
603
|
+
>
|
|
592
604
|
<Show when={props.error}>
|
|
593
605
|
<div
|
|
594
606
|
class="rounded-lg border border-[color-mix(in_srgb,var(--ks-danger,#ef4444)_30%,transparent)] bg-[color-mix(in_srgb,var(--ks-danger,#ef4444)_10%,transparent)] px-3 py-2 text-sm text-[var(--ks-danger-fg,#f87171)]"
|
|
@@ -788,16 +800,14 @@ export default function TransactionForm(props: TransactionFormProps) {
|
|
|
788
800
|
icon={Store}
|
|
789
801
|
noun="payee"
|
|
790
802
|
placeholder={catConfig().payeePlaceholder!}
|
|
791
|
-
onChange={(p) =>
|
|
792
|
-
//
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
})
|
|
800
|
-
}
|
|
803
|
+
onChange={(p) => {
|
|
804
|
+
// Writes flush together, so the sync effect never sees the new name with the old id.
|
|
805
|
+
setSelectedPayee(p);
|
|
806
|
+
props.setPayee(p ? p.name : "");
|
|
807
|
+
props.setPayeeId(p ? p.id : null);
|
|
808
|
+
props.setPayeeTin?.("");
|
|
809
|
+
props.setPayeeAddress?.("");
|
|
810
|
+
}}
|
|
801
811
|
/>
|
|
802
812
|
</FormField>
|
|
803
813
|
<FormField label={props.category === "sale" ? "Invoice ID" : "Receipt / Ref #"}>
|
|
@@ -1064,7 +1074,7 @@ export default function TransactionForm(props: TransactionFormProps) {
|
|
|
1064
1074
|
</div>
|
|
1065
1075
|
|
|
1066
1076
|
<Show when={!props.simpleMode}>
|
|
1067
|
-
<div class="flex justify-center pt-2"
|
|
1077
|
+
<div class={["flex justify-center pt-2", { "ks-transaction-compact-details-toggle": compact() }]} >
|
|
1068
1078
|
<button
|
|
1069
1079
|
type="button"
|
|
1070
1080
|
onClick={() =>
|
|
@@ -1100,18 +1110,18 @@ export default function TransactionForm(props: TransactionFormProps) {
|
|
|
1100
1110
|
</Show>
|
|
1101
1111
|
</div>
|
|
1102
1112
|
|
|
1103
|
-
<div class="px-5 sm:px-6 py-4 border-t border-[color-mix(in_srgb,var(--ks-border,rgba(39,39,42,0.5))_60%,transparent)] bg-[var(--ks-bg,#0a0a0a)] flex flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-3 shrink-0"
|
|
1104
|
-
|
|
1113
|
+
<div class={["px-5 sm:px-6 py-4 border-t border-[color-mix(in_srgb,var(--ks-border,rgba(39,39,42,0.5))_60%,transparent)] bg-[var(--ks-bg,#0a0a0a)] flex flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-3 shrink-0", { "ks-transaction-compact-footer": compact() }]}
|
|
1114
|
+
>
|
|
1105
1115
|
<div class="text-xs text-[var(--ks-fg-subtle,#71717a)]">
|
|
1106
1116
|
<span class="text-[var(--ks-fg-subtle,#71717a)]">Will record as </span>
|
|
1107
1117
|
<span
|
|
1108
|
-
class="font-bold"
|
|
1109
|
-
classList={{
|
|
1118
|
+
class={["font-bold", {
|
|
1110
1119
|
"text-[var(--ks-success-fg,#34d399)]": props.category === "sale",
|
|
1111
1120
|
"text-[var(--ks-danger-fg,#f87171)]": props.category === "expense",
|
|
1112
1121
|
"text-[var(--ks-accent,#fbbf24)]": props.category === "payable",
|
|
1113
1122
|
"text-[var(--ks-info,#38bdf8)]": props.category === "business",
|
|
1114
|
-
}}
|
|
1123
|
+
}]}
|
|
1124
|
+
|
|
1115
1125
|
>
|
|
1116
1126
|
{(CATEGORY_FORM[props.category] || CATEGORY_FORM.expense).label}
|
|
1117
1127
|
</span>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Show
|
|
1
|
+
import { Show } from "solid-js";
|
|
2
|
+
import type { JSX } from "@solidjs/web";
|
|
2
3
|
import ArrowRightLeft from "../../icons/arrow-right-left";
|
|
3
4
|
import Plus from "../../icons/plus";
|
|
4
5
|
import AccountAvatar from "../base/AccountAvatar";
|
|
@@ -38,15 +39,15 @@ function AccountTile(p: AccountTileProps): JSX.Element {
|
|
|
38
39
|
type="button"
|
|
39
40
|
data-testid={p.tileTestId}
|
|
40
41
|
onClick={p.onEditRequest}
|
|
41
|
-
class={`group flex flex-1 min-w-0 items-center gap-3 border px-4 py-3 text-left transition-colors cursor-pointer ${p.clipClass}
|
|
42
|
-
classList={{
|
|
42
|
+
class={[`group flex flex-1 min-w-0 items-center gap-3 border px-4 py-3 text-left transition-colors cursor-pointer ${p.clipClass}`, {
|
|
43
43
|
"border-[color-mix(in_srgb,var(--ks-info,#38bdf8)_40%,transparent)] bg-[color-mix(in_srgb,var(--ks-info,#38bdf8)_5%,transparent)] hover:bg-[color-mix(in_srgb,var(--ks-info,#38bdf8)_10%,transparent)]":
|
|
44
44
|
isFilled() && isFrom(),
|
|
45
45
|
"border-[color-mix(in_srgb,var(--ks-warning,#f59e0b)_40%,transparent)] bg-[color-mix(in_srgb,var(--ks-warning,#f59e0b)_5%,transparent)] hover:bg-[color-mix(in_srgb,var(--ks-warning,#f59e0b)_10%,transparent)]":
|
|
46
46
|
isFilled() && !isFrom(),
|
|
47
47
|
"border-dashed border-[var(--ks-input-border,#3f3f46)] bg-[color-mix(in_srgb,var(--ks-overlay-surface,#18181b)_40%,transparent)] hover:border-[color-mix(in_srgb,var(--ks-warning,#f59e0b)_50%,transparent)] hover:bg-[color-mix(in_srgb,var(--ks-overlay-surface,#18181b)_60%,transparent)]":
|
|
48
48
|
!isFilled(),
|
|
49
|
-
}}
|
|
49
|
+
}]}
|
|
50
|
+
|
|
50
51
|
aria-label={
|
|
51
52
|
isFilled()
|
|
52
53
|
? `${isFrom() ? "Source" : "Destination"}: ${p.account!.name} — tap to change`
|
|
@@ -72,12 +73,12 @@ function AccountTile(p: AccountTileProps): JSX.Element {
|
|
|
72
73
|
</Show>
|
|
73
74
|
<div class="flex min-w-0 flex-col">
|
|
74
75
|
<span
|
|
75
|
-
class="text-[10px] font-semibold uppercase tracking-widest"
|
|
76
|
-
classList={{
|
|
76
|
+
class={["text-[10px] font-semibold uppercase tracking-widest", {
|
|
77
77
|
"text-[var(--ks-info,#38bdf8)]": isFilled() && isFrom(),
|
|
78
78
|
"text-[var(--ks-accent-hover,#fcd34d)]": isFilled() && !isFrom(),
|
|
79
79
|
"text-[var(--ks-fg-subtle,#71717a)]": !isFilled(),
|
|
80
|
-
}}
|
|
80
|
+
}]}
|
|
81
|
+
|
|
81
82
|
>
|
|
82
83
|
{isFrom() ? "From" : "To"}
|
|
83
84
|
</span>
|
|
@@ -98,11 +99,11 @@ function AccountTile(p: AccountTileProps): JSX.Element {
|
|
|
98
99
|
<span class="truncate">{formatPHP(a.balance!)}</span>
|
|
99
100
|
<Show when={p.delta !== 0}>
|
|
100
101
|
<span
|
|
101
|
-
class="whitespace-nowrap font-semibold"
|
|
102
|
-
classList={{
|
|
102
|
+
class={["whitespace-nowrap font-semibold", {
|
|
103
103
|
"text-[var(--ks-danger-fg,#f87171)]": p.delta < 0,
|
|
104
104
|
"text-[var(--ks-success-fg,#34d399)]": p.delta > 0,
|
|
105
|
-
}}
|
|
105
|
+
}]}
|
|
106
|
+
|
|
106
107
|
data-testid={`transactions-form-transfer-delta-${p.role}`}
|
|
107
108
|
>
|
|
108
109
|
({p.delta > 0 ? "+" : ""}
|