@uniqbit/mate-core 0.20.0 → 0.21.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/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
- package/claude-capability-plugins/companion-mentions/hooks/register.ts +1 -1
- package/claude-plugin/hooks/hooks.json +10 -1
- package/claude-plugin/hooks/rtk-worktree-git.mjs +58 -0
- package/opencode-plugin/src/server.ts +9 -2
- package/package.json +2 -1
- package/src/cli/commands/artifact/delivery/environment.ts +28 -8
- package/src/cli/commands/artifact/delivery/link.ts +28 -9
- package/src/cli/commands/artifact/delivery/output.ts +7 -0
- package/src/cli/commands/companion/update.ts +2 -19
- package/src/cli/commands/factory/factory.ts +11 -1
- package/src/cli/commands/install.ts +47 -36
- package/src/cli/commands/launch/claude.ts +2 -0
- package/src/cli/commands/launch/shared.ts +33 -6
- package/src/cli/commands/plugin/install.ts +27 -11
- package/src/cli/commands/report/index.ts +180 -184
- package/src/cli/commands/report/markdown.ts +67 -72
- package/src/cli/commands/shared/companion-selection.ts +3 -1
- package/src/cli/commands/studio/access.ts +6 -14
- package/src/cli/commands/studio/areas.ts +112 -33
- package/src/cli/commands/studio/companion-add.ts +87 -0
- package/src/cli/commands/studio/companion-removal.ts +15 -8
- package/src/cli/commands/studio/factory-credential.ts +1 -15
- package/src/cli/commands/studio/factory-git-tokens.ts +40 -0
- package/src/cli/commands/studio/factory-relay.ts +18 -0
- package/src/cli/commands/studio/graph-model.ts +61 -0
- package/src/cli/commands/studio/graph.ts +336 -0
- package/src/cli/commands/studio/index.ts +4 -4
- package/src/cli/commands/studio/payload.ts +42 -15
- package/src/cli/commands/studio/repository-add.ts +116 -0
- package/src/cli/commands/studio/routes.ts +6 -0
- package/src/cli/commands/studio/selection.ts +12 -3
- package/src/cli/commands/studio/server.ts +127 -5
- package/src/cli/commands/studio/services.ts +40 -0
- package/src/cli/commands/studio/terminal.ts +45 -3
- package/src/cli/commands/studio/views/vault/markdown-tree.ts +84 -3
- package/src/cli/commands/studio/workset-session.ts +47 -14
- package/src/cli/commands/unwrap.ts +3 -0
- package/src/cli/commands/update.ts +2 -0
- package/src/cli/commands/vscode/release-vsix.json +4 -0
- package/src/cli/commands/vscode/setup.ts +71 -13
- package/src/cli/commands/vscode/vsix.ts +48 -7
- package/src/cli/commands/working/cleanup.ts +40 -8
- package/src/cli/commands/working/worktree.ts +176 -35
- package/src/cli/main.ts +17 -2
- package/src/cli/usage.ts +1 -1
- package/src/hooks/rtk-worktree-git.ts +48 -0
- package/src/hooks/validate-artifact-path.ts +38 -7
- package/src/lib/delivery/branch-template.ts +122 -0
- package/src/lib/delivery/branches.ts +21 -16
- package/src/lib/delivery/checkout.ts +102 -0
- package/src/lib/delivery/environment.ts +2 -0
- package/src/lib/delivery/merge-git.ts +13 -1
- package/src/lib/delivery/record-delivery.ts +83 -29
- package/src/lib/delivery/record.ts +15 -3
- package/src/lib/delivery/resolve-branch.ts +157 -110
- package/src/lib/factory/attach-client.ts +11 -1
- package/src/lib/factory/broker.ts +37 -40
- package/src/lib/factory/client.ts +22 -1
- package/src/lib/factory/clone-url.ts +39 -0
- package/src/lib/factory/command.ts +21 -5
- package/src/lib/factory/git-auth.ts +61 -0
- package/src/lib/factory/git-credential-store.ts +181 -0
- package/src/lib/factory/ids.ts +12 -2
- package/src/lib/factory/outcomes/actions.ts +20 -4
- package/src/lib/factory/outcomes/index.ts +77 -11
- package/src/lib/factory/outcomes/lifecycle.ts +9 -2
- package/src/lib/factory/outcomes/sessions.ts +23 -1
- package/src/lib/factory/prepare.ts +9 -3
- package/src/lib/factory/runner/scheduler.ts +96 -14
- package/src/lib/factory/runner/workflow.ts +5 -1
- package/src/lib/factory/runtime.ts +143 -43
- package/src/lib/orchestrator/companion-hub.ts +6 -1
- package/src/lib/orchestrator/engine-floor.ts +48 -0
- package/src/lib/orchestrator/launcher.ts +34 -1
- package/src/lib/orchestrator/projection-claude-commands.ts +2 -2
- package/src/lib/orchestrator/projection-claude-entry.ts +42 -21
- package/src/lib/orchestrator/projection-claude-links.ts +32 -8
- package/src/lib/orchestrator/projection-claude-skills.ts +2 -2
- package/src/lib/orchestrator/projection-entries.ts +22 -18
- package/src/lib/orchestrator/projection-opencode-copies.ts +65 -21
- package/src/lib/orchestrator/projection-runtime-documents.ts +66 -43
- package/src/lib/orchestrator/projection-types.ts +28 -1
- package/src/lib/orchestrator/refresh-working-claude-links.ts +3 -1
- package/src/lib/orchestrator/session-prepare.ts +6 -1
- package/src/lib/orchestrator/setup-compatibilities.ts +1 -1
- package/src/lib/orchestrator/types.ts +4 -0
- package/src/lib/orchestrator/umbrella-checkouts.ts +102 -0
- package/src/lib/orchestrator/working-repo-projection.ts +24 -4
- package/src/lib/orchestrator/wrap-pass.ts +1 -0
- package/src/lib/public-npm.ts +95 -50
- package/src/lib/session-state.ts +72 -2
- package/src/lib/update-checker.ts +7 -1
- package/src/lib/usage/aggregate.ts +202 -0
- package/src/lib/usage/cache.ts +87 -0
- package/src/lib/usage/claude-pricing.ts +71 -0
- package/src/lib/usage/claude.ts +189 -0
- package/src/lib/usage/collect.ts +56 -0
- package/src/lib/usage/opencode.ts +188 -0
- package/src/lib/usage/records.ts +80 -0
- package/src/lib/usage/rtk-database.ts +72 -0
- package/src/lib/usage/savings.ts +209 -0
- package/src/lib/usage/scope.ts +182 -0
- package/src/lib/usage/source.ts +102 -0
- package/src/lib/usage/types.ts +143 -0
- package/src/lib/usage/window.ts +37 -0
- package/src/lib/workset/factory-local.ts +157 -0
- package/src/lib/workset/record.ts +25 -11
- package/src/lib/workset/repositories.ts +118 -25
- package/src/lib/workset/worktree-include.ts +161 -0
- package/src/lib/workset/worktree-index.ts +6 -2
- package/src/lib/workset/worktree.ts +591 -101
- package/src/opencode/companion-hooks.ts +46 -8
- package/src/opencode/companion-policy.ts +18 -5
- package/src/opencode/enter-worktree.ts +254 -6
- package/src/opencode/session-register.ts +2 -2
- package/src/runtime/claude-bg-isolation.ts +138 -0
- package/src/runtime/companion-git.ts +10 -2
- package/src/runtime/companion-guidance.ts +17 -4
- package/src/runtime/current-branch.ts +16 -2
- package/src/runtime/entered-worktree.ts +24 -0
- package/src/runtime/git-tracked.ts +60 -0
- package/src/runtime/repo-destination.ts +72 -0
- package/src/runtime/repo-local.ts +25 -3
- package/src/runtime/rtk-git-guard.ts +66 -0
- package/src/runtime/runtime-document-manifest.ts +229 -19
- package/src/runtime/runtime-document-manifest.typecheck.ts +10 -0
- package/src/runtime/secret-guard.ts +9 -2
- package/src/runtime/secret-policy-weakening.ts +122 -0
- package/src/runtime/serving-claude-wrap.ts +15 -2
- package/src/runtime/umbrella-folder.ts +56 -0
- package/src/runtime/wrap-state.ts +5 -13
- package/src/studio.ts +37 -0
- package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +61 -6
- package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +8 -4
- package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +9 -5
- package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +5 -4
- package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +10 -4
- package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +5 -1
- package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +61 -6
- package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +8 -4
- package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +9 -5
- package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +5 -4
- package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +10 -4
- package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +5 -1
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +305 -42
- package/src/tools/setup/capabilities/rtk.ts +93 -1
- package/src/tools/setup/dynamic-plugins/audiences.ts +65 -21
- package/src/tools/setup/dynamic-plugins/frozen.ts +32 -13
- package/src/tools/setup/dynamic-plugins/hydrate.ts +4 -4
- package/src/tools/setup/dynamic-plugins/install.ts +24 -22
- package/src/tools/setup/dynamic-plugins/loader.ts +11 -7
- package/src/tools/setup/dynamic-plugins/paths.ts +30 -10
- package/src/tools/setup/dynamic-plugins/verify.ts +10 -7
- package/src/tools/setup/dynamic-plugins/workspaces.ts +153 -0
- package/src/tools/setup/mate.ts +3 -3
- package/src/tools/setup/plugins/gitignore.ts +15 -9
- package/src/tools/setup/providers/claude-plugin-hooks.ts +12 -0
- package/src/tools/setup/providers/claude.ts +25 -3
- package/src/tools/setup/utils.ts +4 -2
- package/src/tools/setup/working-repo-cleanup.ts +2 -2
- package/src/tools/setup.ts +25 -14
- package/studio-dist/client/assets/app-D9cw6szy.css +2 -0
- package/studio-dist/client/assets/artifacts-WD2ZXYrx.js +1 -0
- package/studio-dist/client/assets/button-Br0O1sXw.js +1 -0
- package/studio-dist/client/assets/combobox-DA7RAUUZ.js +1 -0
- package/studio-dist/client/assets/companion-view-CrabvxS8.js +1 -0
- package/studio-dist/client/assets/factory-DGS0E16C.js +6 -0
- package/studio-dist/client/assets/fields-6aXBpFhJ.js +1 -0
- package/studio-dist/client/assets/getting-started-Clde4w6P.js +1 -0
- package/studio-dist/client/assets/getting-started-D6kgWwWZ.js +1 -0
- package/studio-dist/client/assets/getting-started._topic-BiunccbT.js +1 -0
- package/studio-dist/client/assets/getting-started.index-DpiNoGw8.js +1 -0
- package/studio-dist/client/assets/graph-B_TCBVbu.js +2 -0
- package/studio-dist/client/assets/graph-canvas-Ba37Y5AE.js +3242 -0
- package/studio-dist/client/assets/guides-Du_RtJxP.js +1 -0
- package/studio-dist/client/assets/index-Df8L1LQa.js +40 -0
- package/studio-dist/client/assets/jsx-runtime-MZURdZre.js +1 -0
- package/studio-dist/client/assets/markdown-view-BOX6x0rL.js +1 -0
- package/studio-dist/client/assets/panel-dbmCx7Mx.js +1 -0
- package/studio-dist/client/assets/queries-RvHeXY12.js +1 -0
- package/studio-dist/client/assets/react-3QStrcDO.js +27 -0
- package/studio-dist/client/assets/report-url-XRL0x1SY.js +1 -0
- package/studio-dist/client/assets/reports-r3IK7Doz.js +1 -0
- package/studio-dist/client/assets/routes-C0A5LTFc.js +1 -0
- package/studio-dist/client/assets/select-CnaMd617.js +1 -0
- package/studio-dist/client/assets/skills-CzjzHpBT.js +1 -0
- package/studio-dist/client/assets/specs-B0ldF_6J.js +1 -0
- package/studio-dist/client/assets/specs-view-BnCLA0gW.js +1 -0
- package/studio-dist/client/assets/spinner-Dcm3fqK1.js +1 -0
- package/studio-dist/client/assets/steps-C0p2N1Pb.js +1 -0
- package/studio-dist/client/assets/store-Dw34catY.js +1 -0
- package/studio-dist/client/assets/studio-Cpz_HRHp.js +100 -0
- package/studio-dist/client/assets/studio-queries-ibmpFo6R.js +2 -0
- package/studio-dist/client/assets/usage-C2QJ_0IZ.js +55 -0
- package/studio-dist/client/assets/useAnchoredPopupScrollLock-Bj-FWb8z.js +1 -0
- package/studio-dist/client/assets/useMutation-aAr2uiay.js +1 -0
- package/studio-dist/client/assets/useSelector-AYcH7lB0.js +2 -0
- package/studio-dist/client/assets/vault-BGcxkSIY.js +1 -0
- package/studio-dist/client/assets/warnings-R1cE1rLf.js +1 -0
- package/studio-dist/client/assets/workflow-C2qTrMDH.js +1 -0
- package/studio-dist/server/assets/__23tanstack-start-server-fn-resolver-Bn896ZYj.js +122 -0
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +102 -35
- package/studio-dist/server/assets/{actions-Bvgj9eb8.js → actions-DYSv-9VV.js} +10 -4
- package/studio-dist/server/assets/artifacts-DnF9L3dZ.js +216 -0
- package/studio-dist/server/assets/{button-CIJqAhni.js → button-CgOIVdmD.js} +13 -1702
- package/studio-dist/server/assets/combobox-DV_s9W0s.js +483 -0
- package/studio-dist/server/assets/{companion-view-DISASvdJ.js → companion-view-BKVXD3TO.js} +3 -3
- package/studio-dist/server/assets/companions-C7fctnU9.js +31 -0
- package/studio-dist/server/assets/{createServerRpc-tK2lE9R2.js → createServerRpc-bFKFpGFG.js} +1 -1
- package/studio-dist/server/assets/{factory-DUTa0eDs.js → factory-C7Ybg0xG.js} +1256 -353
- package/studio-dist/server/assets/{factory-DGPmNGbo.js → factory-Df5uAHjb.js} +53 -6
- package/studio-dist/server/assets/fields-BbieQTD0.js +1190 -0
- package/studio-dist/server/assets/getting-started-B136TP57.js +4 -0
- package/studio-dist/server/assets/getting-started-CRxMWorQ.js +67 -0
- package/studio-dist/server/assets/getting-started._topic-DJKQAzYl.js +13 -0
- package/studio-dist/server/assets/getting-started.index-D84gec1t.js +13 -0
- package/studio-dist/server/assets/graph-CSje3029.js +801 -0
- package/studio-dist/server/assets/graph-DDZzXM1L.js +16 -0
- package/studio-dist/server/assets/graph-canvas-22bWB5-2.js +21066 -0
- package/studio-dist/server/assets/graph-wire-BdSUx0G5.js +58 -0
- package/studio-dist/server/assets/guides-D9dk1Frq.js +13 -0
- package/studio-dist/server/assets/guides-IE-19POz.js +5 -0
- package/studio-dist/server/assets/guides.server-vcYRY5wx.js +66 -0
- package/studio-dist/server/assets/jsx-runtime-Bt0s0YKS.js +451 -0
- package/studio-dist/server/assets/{markdown-view-Bn7xPdks.js → markdown-view-BR8dJ7aR.js} +28 -9
- package/studio-dist/server/assets/{panel-3Jmn4awF.js → panel-BR_t9iMM.js} +4 -4
- package/studio-dist/server/assets/queries-DWoTin-q.js +32 -0
- package/studio-dist/server/assets/react-CdqSUhaL.js +89 -0
- package/studio-dist/server/assets/redirect-BaZ_QyqF.js +39 -0
- package/studio-dist/server/assets/report-url-BUXPcE_8.js +9 -0
- package/studio-dist/server/assets/{reports-D6YMqhnO.js → reports-CQ9qQ1-n.js} +9 -10
- package/studio-dist/server/assets/{reports-C06RXVE2.js → reports-dYDEoBeq.js} +3 -3
- package/studio-dist/server/assets/{router-C8MGqlAY.js → router-DkRHNTpE.js} +787 -2862
- package/studio-dist/server/assets/{routes-BcFgvqf7.js → routes-B6GfOew4.js} +22 -171
- package/studio-dist/server/assets/{search-JAKurDNh.js → search-BJnWLfkG.js} +21 -2
- package/studio-dist/server/assets/select-Af7Wibii.js +1609 -0
- package/studio-dist/server/assets/{shell-DS3wUexh.js → shell-Hq-hXgnT.js} +6 -5
- package/studio-dist/server/assets/{skills-BEnOxiDl.js → skills-B7nEuVbx.js} +9 -8
- package/studio-dist/server/assets/{skills-CtrBAtX3.js → skills-B_YYL7q8.js} +3 -3
- package/studio-dist/server/assets/specs-BpLUFntA.js +51 -0
- package/studio-dist/server/assets/specs-view-0peMVd22.js +426 -0
- package/studio-dist/server/assets/spinner-CdwJW4VB.js +20 -0
- package/studio-dist/server/assets/{steps-Dq_CwY_s.js → steps-D56DApvK.js} +1 -1
- package/studio-dist/server/assets/store-Cs17okNG.js +280 -0
- package/studio-dist/server/assets/studio-CAcKp3bM.js +10340 -0
- package/studio-dist/server/assets/studio-queries-BtRGzDdh.js +1451 -0
- package/studio-dist/server/assets/usage-COdjd1gD.js +25570 -0
- package/studio-dist/server/assets/usage-f6pqE1tm.js +24 -0
- package/studio-dist/server/assets/useAnchoredPopupScrollLock-DlBKHRw7.js +756 -0
- package/studio-dist/server/assets/useMutation-DzTZGenE.js +690 -0
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-M2GBs8s3.js → useSelector-DUmCUXAs.js} +4 -668
- package/studio-dist/server/assets/{vault-Fvxt2Tzl.js → vault-BDuIUq0F.js} +8 -5
- package/studio-dist/server/assets/{vault-BmWnryh3.js → vault-BVLp6zu3.js} +3 -3
- package/studio-dist/server/assets/{views-BgYa-za2.js → views-flRUr21z.js} +4 -4
- package/studio-dist/server/assets/{warnings-DzR6fyZh.js → warnings-CDy9pdgL.js} +3 -2
- package/studio-dist/server/assets/{delivery-path-C29fBynY.js → workflow-D9GKI2EV.js} +132 -106
- package/studio-dist/server/server.js +582 -8
- package/src/cli/commands/report/collector.ts +0 -288
- package/studio-dist/client/assets/app-CdPiFv59.css +0 -2
- package/studio-dist/client/assets/button-BIIHE0EQ.js +0 -3
- package/studio-dist/client/assets/companion-view-DM6YyXaR.js +0 -1
- package/studio-dist/client/assets/delivery-path-DELxj0Av.js +0 -1
- package/studio-dist/client/assets/factory-BZy0E8ty.js +0 -4
- package/studio-dist/client/assets/index-B3wkMzjA.js +0 -40
- package/studio-dist/client/assets/markdown-view-pQ2Qp_i5.js +0 -1
- package/studio-dist/client/assets/panel-CbajlC3p.js +0 -1
- package/studio-dist/client/assets/prepaint-CwSrpdFA.js +0 -27
- package/studio-dist/client/assets/react-CN2GSx7x.js +0 -1
- package/studio-dist/client/assets/reports-DllhYQ5_.js +0 -1
- package/studio-dist/client/assets/rolldown-runtime-WkwZ5CU-.js +0 -1
- package/studio-dist/client/assets/routes-COm-G3mK.js +0 -1
- package/studio-dist/client/assets/skills-DmWAy-jZ.js +0 -1
- package/studio-dist/client/assets/specs-BG3Wi3ln.js +0 -1
- package/studio-dist/client/assets/steps-DFsH3Neu.js +0 -1
- package/studio-dist/client/assets/vault-B2q1nBY5.js +0 -1
- package/studio-dist/client/assets/warnings-BSXIyuSQ.js +0 -1
- package/studio-dist/client/assets/workflow-DlsQD6Hc.js +0 -1
- package/studio-dist/server/assets/companions-BYbHWKOZ.js +0 -15
- package/studio-dist/server/assets/createServerFn-F5sAOF8V.js +0 -459
- package/studio-dist/server/assets/prepaint-DJfTQ_VH.js +0 -45
- package/studio-dist/server/assets/react-Ce6dj15C.js +0 -46
- package/studio-dist/server/assets/rolldown-runtime-DYf_mQCB.js +0 -34
- package/studio-dist/server/assets/specs-C8rv34-5.js +0 -211
- package/studio-dist/server/assets/studio-BeltxxKt.js +0 -216
- package/studio-dist/server/assets/workflow-liRYecHk.js +0 -73
|
@@ -0,0 +1,1190 @@
|
|
|
1
|
+
import { n as require_react, o as __toESM, t as require_jsx_runtime } from "./jsx-runtime-Bt0s0YKS.js";
|
|
2
|
+
import { B as FocusGuard, Bt as stopEvent, Dn as focusOut, E as resolveRef, Fn as none, G as useValueAsRef, Hn as createChangeEventDetails, Ht as getNodeChildren, J as Timeout, Jn as useIsoLayoutEffect, K as mergeCleanups, Kn as ownerDocument, Kt as isTypeableCombobox, P as usePortalContext, Rt as isVirtualClick, Sr as useBaseUiId, Tr as cn, U as AnimationFrame, Ut as getFloatingFocusElement, Vt as getNodeAncestors, W as useAnimationFrame, Y as useTimeout, Yn as useStableCallback, _n as webkit, _r as EMPTY_OBJECT, at as getNextTabbable, br as useMergedRefs, ct as isOutsideEvent, dn as activeElement, er as getNodeName, fn as closest, ht as isElementVisible, ir as getWindow, it as focusable, j as useFloatingTree, lr as isOverflowElement, lt as isTabbable, mn as getTarget, mr as useRenderElement, ot as getPreviousTabbable, pn as contains, q as addEventListener, qn as formatErrorMessage, qt as isTypeableElement, sr as isHTMLElement, ur as isShadowRoot, ut as tabbable, vr as NOOP, xr as useRefWithInit, yn as ios, yr as isReactVersionAtLeast, z as createAttribute, zt as isVirtualPointerEvent } from "./button-CgOIVdmD.js";
|
|
3
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/utils/enqueueFocus.mjs
|
|
4
|
+
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
5
|
+
var rafId = 0;
|
|
6
|
+
function enqueueFocus(el, options = {}) {
|
|
7
|
+
const { preventScroll = false, sync = false, shouldFocus } = options;
|
|
8
|
+
cancelAnimationFrame(rafId);
|
|
9
|
+
function exec() {
|
|
10
|
+
if (shouldFocus && !shouldFocus()) return;
|
|
11
|
+
el?.focus({ preventScroll });
|
|
12
|
+
}
|
|
13
|
+
if (sync) {
|
|
14
|
+
exec();
|
|
15
|
+
return NOOP;
|
|
16
|
+
}
|
|
17
|
+
const currentRafId = requestAnimationFrame(exec);
|
|
18
|
+
rafId = currentRafId;
|
|
19
|
+
return () => {
|
|
20
|
+
if (rafId === currentRafId) {
|
|
21
|
+
cancelAnimationFrame(currentRafId);
|
|
22
|
+
rafId = 0;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/utils/markOthers.mjs
|
|
27
|
+
var markerName = "data-base-ui-inert";
|
|
28
|
+
var ariaHiddenCounterMap = /* @__PURE__ */ new WeakMap();
|
|
29
|
+
var uncontrolledElementsSet = /* @__PURE__ */ new WeakSet();
|
|
30
|
+
var markerCounterMap = /* @__PURE__ */ new WeakMap();
|
|
31
|
+
var lockCount = 0;
|
|
32
|
+
function unwrapHost(node) {
|
|
33
|
+
if (!node) return null;
|
|
34
|
+
return isShadowRoot(node) ? node.host : unwrapHost(node.parentNode);
|
|
35
|
+
}
|
|
36
|
+
var correctElements = (parent, targets) => targets.map((target) => {
|
|
37
|
+
if (parent.contains(target)) return target;
|
|
38
|
+
const correctedTarget = unwrapHost(target);
|
|
39
|
+
if (parent.contains(correctedTarget)) return correctedTarget;
|
|
40
|
+
return null;
|
|
41
|
+
}).filter((x) => x != null);
|
|
42
|
+
var buildKeepSet = (targets) => {
|
|
43
|
+
const keep = /* @__PURE__ */ new Set();
|
|
44
|
+
targets.forEach((target) => {
|
|
45
|
+
let node = target;
|
|
46
|
+
while (node && !keep.has(node)) {
|
|
47
|
+
keep.add(node);
|
|
48
|
+
node = node.parentNode;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return keep;
|
|
52
|
+
};
|
|
53
|
+
var collectOutsideElements = (root, keepElements, stopElements) => {
|
|
54
|
+
const outside = [];
|
|
55
|
+
const walk = (parent) => {
|
|
56
|
+
if (!parent || stopElements.has(parent)) return;
|
|
57
|
+
Array.from(parent.children).forEach((node) => {
|
|
58
|
+
if (getNodeName(node) === "script") return;
|
|
59
|
+
if (keepElements.has(node)) walk(node);
|
|
60
|
+
else outside.push(node);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
walk(root);
|
|
64
|
+
return outside;
|
|
65
|
+
};
|
|
66
|
+
function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, { mark = true }) {
|
|
67
|
+
const avoidElements = correctElements(body, uncorrectedAvoidElements);
|
|
68
|
+
const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)) : [];
|
|
69
|
+
const hiddenElements = [];
|
|
70
|
+
const markedElements = [];
|
|
71
|
+
if (ariaHidden) {
|
|
72
|
+
const ariaLiveElements = correctElements(body, Array.from(body.querySelectorAll("[aria-live]")));
|
|
73
|
+
const controlElements = avoidElements.concat(ariaLiveElements);
|
|
74
|
+
collectOutsideElements(body, buildKeepSet(controlElements), new Set(controlElements)).forEach((node) => {
|
|
75
|
+
const attr = node.getAttribute("aria-hidden");
|
|
76
|
+
const alreadyHidden = attr !== null && attr !== "false";
|
|
77
|
+
const counterValue = (ariaHiddenCounterMap.get(node) || 0) + 1;
|
|
78
|
+
ariaHiddenCounterMap.set(node, counterValue);
|
|
79
|
+
hiddenElements.push(node);
|
|
80
|
+
if (counterValue === 1 && alreadyHidden) uncontrolledElementsSet.add(node);
|
|
81
|
+
if (!alreadyHidden) node.setAttribute("aria-hidden", "true");
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (mark) markerTargets.forEach((node) => {
|
|
85
|
+
const markerValue = (markerCounterMap.get(node) || 0) + 1;
|
|
86
|
+
markerCounterMap.set(node, markerValue);
|
|
87
|
+
markedElements.push(node);
|
|
88
|
+
if (markerValue === 1) node.setAttribute(markerName, "");
|
|
89
|
+
});
|
|
90
|
+
lockCount += 1;
|
|
91
|
+
return () => {
|
|
92
|
+
hiddenElements.forEach((element) => {
|
|
93
|
+
const counterValue = (ariaHiddenCounterMap.get(element) || 0) - 1;
|
|
94
|
+
ariaHiddenCounterMap.set(element, counterValue);
|
|
95
|
+
if (!counterValue) {
|
|
96
|
+
if (!uncontrolledElementsSet.has(element)) element.removeAttribute("aria-hidden");
|
|
97
|
+
uncontrolledElementsSet.delete(element);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
if (mark) markedElements.forEach((element) => {
|
|
101
|
+
const markerValue = (markerCounterMap.get(element) || 0) - 1;
|
|
102
|
+
markerCounterMap.set(element, markerValue);
|
|
103
|
+
if (!markerValue) element.removeAttribute(markerName);
|
|
104
|
+
});
|
|
105
|
+
lockCount -= 1;
|
|
106
|
+
if (!lockCount) {
|
|
107
|
+
ariaHiddenCounterMap = /* @__PURE__ */ new WeakMap();
|
|
108
|
+
uncontrolledElementsSet = /* @__PURE__ */ new WeakSet();
|
|
109
|
+
markerCounterMap = /* @__PURE__ */ new WeakMap();
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function markOthers(avoidElements, options = {}) {
|
|
114
|
+
const { ariaHidden = false, mark = true } = options;
|
|
115
|
+
const body = ownerDocument(avoidElements[0]).body;
|
|
116
|
+
return applyAttributeToOthers(avoidElements, body, ariaHidden, { mark });
|
|
117
|
+
}
|
|
118
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/components/FloatingFocusManager.mjs
|
|
119
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
120
|
+
function getEventType(event, lastInteractionType) {
|
|
121
|
+
const win = getWindow(getTarget(event));
|
|
122
|
+
if (event instanceof win.KeyboardEvent) return "keyboard";
|
|
123
|
+
if (event instanceof win.FocusEvent) return lastInteractionType || "keyboard";
|
|
124
|
+
if ("pointerType" in event) return event.pointerType || (isVirtualClick(event) ? "keyboard" : lastInteractionType || "mouse");
|
|
125
|
+
if ("touches" in event) return "touch";
|
|
126
|
+
if (event instanceof win.MouseEvent) return lastInteractionType || (event.detail === 0 ? "keyboard" : "mouse");
|
|
127
|
+
return "";
|
|
128
|
+
}
|
|
129
|
+
var LIST_LIMIT = 20;
|
|
130
|
+
var previouslyFocusedElements = [];
|
|
131
|
+
function clearDisconnectedPreviouslyFocusedElements() {
|
|
132
|
+
previouslyFocusedElements = previouslyFocusedElements.filter((entry) => {
|
|
133
|
+
return entry.deref()?.isConnected;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function addPreviouslyFocusedElement(element) {
|
|
137
|
+
clearDisconnectedPreviouslyFocusedElements();
|
|
138
|
+
if (element && getNodeName(element) !== "body") {
|
|
139
|
+
previouslyFocusedElements.push(new WeakRef(element));
|
|
140
|
+
if (previouslyFocusedElements.length > LIST_LIMIT) previouslyFocusedElements = previouslyFocusedElements.slice(-20);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function getPreviouslyFocusedElement() {
|
|
144
|
+
clearDisconnectedPreviouslyFocusedElements();
|
|
145
|
+
return previouslyFocusedElements[previouslyFocusedElements.length - 1]?.deref();
|
|
146
|
+
}
|
|
147
|
+
function getFirstTabbableElement(container) {
|
|
148
|
+
if (!container) return null;
|
|
149
|
+
if (isTabbable(container)) return container;
|
|
150
|
+
return tabbable(container)[0] || container;
|
|
151
|
+
}
|
|
152
|
+
function handleTabIndex(floatingFocusElement) {
|
|
153
|
+
if (floatingFocusElement.hasAttribute("tabindex") && !floatingFocusElement.hasAttribute("data-tabindex")) return;
|
|
154
|
+
if (!floatingFocusElement.getAttribute("role")?.includes("dialog")) return;
|
|
155
|
+
const tabbableContent = focusable(floatingFocusElement).filter((element) => {
|
|
156
|
+
const dataTabIndex = element.getAttribute("data-tabindex") || "";
|
|
157
|
+
return isTabbable(element) || element.hasAttribute("data-tabindex") && !dataTabIndex.startsWith("-");
|
|
158
|
+
});
|
|
159
|
+
const tabIndex = floatingFocusElement.getAttribute("tabindex");
|
|
160
|
+
if (tabbableContent.length === 0) {
|
|
161
|
+
if (tabIndex !== "0") {
|
|
162
|
+
floatingFocusElement.setAttribute("tabindex", "0");
|
|
163
|
+
floatingFocusElement.setAttribute("data-tabindex", "0");
|
|
164
|
+
}
|
|
165
|
+
} else if (tabIndex !== "-1" || floatingFocusElement.hasAttribute("data-tabindex") && floatingFocusElement.getAttribute("data-tabindex") !== "-1") {
|
|
166
|
+
floatingFocusElement.setAttribute("tabindex", "-1");
|
|
167
|
+
floatingFocusElement.setAttribute("data-tabindex", "-1");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Provides focus management for the floating element.
|
|
172
|
+
* @see https://floating-ui.com/docs/FloatingFocusManager
|
|
173
|
+
* @internal
|
|
174
|
+
*/
|
|
175
|
+
function FloatingFocusManager(props) {
|
|
176
|
+
const { context: store, children, disabled = false, initialFocus = true, returnFocus = true, explicitReturnFocus, restoreFocus = false, modal = true, closeOnFocusOut = true, openInteractionType = "", nextFocusableElement, previousFocusableElement, beforeContentFocusGuardRef, externalTree, getInsideElements } = props;
|
|
177
|
+
const open = store.useState("open");
|
|
178
|
+
const domReference = store.useState("domReferenceElement");
|
|
179
|
+
const floating = store.useState("floatingElement");
|
|
180
|
+
const { events, dataRef } = store.context;
|
|
181
|
+
const getNodeId = useStableCallback(() => dataRef.current.floatingContext?.nodeId);
|
|
182
|
+
const ignoreInitialFocus = initialFocus === false;
|
|
183
|
+
const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus;
|
|
184
|
+
const initialFocusRef = useValueAsRef(initialFocus);
|
|
185
|
+
const returnFocusRef = useValueAsRef(returnFocus);
|
|
186
|
+
const explicitReturnFocusRef = useValueAsRef(explicitReturnFocus);
|
|
187
|
+
const openInteractionTypeRef = useValueAsRef(openInteractionType);
|
|
188
|
+
const openRef = useValueAsRef(open);
|
|
189
|
+
const tree = useFloatingTree(externalTree);
|
|
190
|
+
const portalContext = usePortalContext();
|
|
191
|
+
const preventReturnFocusRef = import_react.useRef(false);
|
|
192
|
+
const isPointerDownRef = import_react.useRef(false);
|
|
193
|
+
const pointerDownOutsideRef = import_react.useRef(false);
|
|
194
|
+
const lastFocusedTabbableRef = import_react.useRef(null);
|
|
195
|
+
const closeTypeRef = import_react.useRef("");
|
|
196
|
+
const lastInteractionTypeRef = import_react.useRef("");
|
|
197
|
+
const beforeGuardRef = import_react.useRef(null);
|
|
198
|
+
const afterGuardRef = import_react.useRef(null);
|
|
199
|
+
const mergedBeforeGuardRef = useMergedRefs(beforeGuardRef, beforeContentFocusGuardRef, portalContext?.beforeInsideRef);
|
|
200
|
+
const mergedAfterGuardRef = useMergedRefs(afterGuardRef, portalContext?.afterInsideRef);
|
|
201
|
+
const blurTimeout = useTimeout();
|
|
202
|
+
const pointerDownTimeout = useTimeout();
|
|
203
|
+
const restoreFocusFrame = useAnimationFrame();
|
|
204
|
+
const isInsidePortal = portalContext != null;
|
|
205
|
+
const floatingFocusElement = getFloatingFocusElement(floating);
|
|
206
|
+
const getTabbableContent = useStableCallback((container = floatingFocusElement) => {
|
|
207
|
+
return container ? tabbable(container) : [];
|
|
208
|
+
});
|
|
209
|
+
const getResolvedInsideElements = useStableCallback(() => getInsideElements?.().filter((element) => element != null) ?? []);
|
|
210
|
+
import_react.useEffect(() => {
|
|
211
|
+
if (disabled || !modal) return;
|
|
212
|
+
function onKeyDown(event) {
|
|
213
|
+
if (event.key === "Tab") {
|
|
214
|
+
if (contains(floatingFocusElement, activeElement(ownerDocument(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) stopEvent(event);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
const doc = ownerDocument(floatingFocusElement);
|
|
218
|
+
return addEventListener(doc, "keydown", onKeyDown);
|
|
219
|
+
}, [
|
|
220
|
+
disabled,
|
|
221
|
+
floatingFocusElement,
|
|
222
|
+
modal,
|
|
223
|
+
isUntrappedTypeableCombobox,
|
|
224
|
+
getTabbableContent
|
|
225
|
+
]);
|
|
226
|
+
import_react.useEffect(() => {
|
|
227
|
+
if (disabled || !open) return;
|
|
228
|
+
const doc = ownerDocument(floatingFocusElement);
|
|
229
|
+
function clearPointerDownOutside() {
|
|
230
|
+
pointerDownOutsideRef.current = false;
|
|
231
|
+
}
|
|
232
|
+
function onPointerDown(event) {
|
|
233
|
+
const target = getTarget(event);
|
|
234
|
+
const insideElements = getResolvedInsideElements();
|
|
235
|
+
const pointerTargetInside = contains(floating, target) || contains(domReference, target) || contains(portalContext?.portalNode, target) || insideElements.some((element) => element === target || contains(element, target));
|
|
236
|
+
pointerDownOutsideRef.current = !pointerTargetInside;
|
|
237
|
+
lastInteractionTypeRef.current = event.pointerType || "keyboard";
|
|
238
|
+
if (closest(target, `[data-base-ui-click-trigger]`)) {
|
|
239
|
+
isPointerDownRef.current = true;
|
|
240
|
+
pointerDownTimeout.start(0, () => {
|
|
241
|
+
isPointerDownRef.current = false;
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function onKeyDown() {
|
|
246
|
+
lastInteractionTypeRef.current = "keyboard";
|
|
247
|
+
}
|
|
248
|
+
return mergeCleanups(addEventListener(doc, "pointerdown", onPointerDown, true), addEventListener(doc, "pointerup", clearPointerDownOutside, true), addEventListener(doc, "pointercancel", clearPointerDownOutside, true), addEventListener(doc, "keydown", onKeyDown, true), clearPointerDownOutside);
|
|
249
|
+
}, [
|
|
250
|
+
disabled,
|
|
251
|
+
floating,
|
|
252
|
+
domReference,
|
|
253
|
+
floatingFocusElement,
|
|
254
|
+
open,
|
|
255
|
+
portalContext,
|
|
256
|
+
pointerDownTimeout,
|
|
257
|
+
getResolvedInsideElements
|
|
258
|
+
]);
|
|
259
|
+
import_react.useEffect(() => {
|
|
260
|
+
if (disabled || !closeOnFocusOut) return;
|
|
261
|
+
const doc = ownerDocument(floatingFocusElement);
|
|
262
|
+
function handlePointerDown() {
|
|
263
|
+
isPointerDownRef.current = true;
|
|
264
|
+
pointerDownTimeout.start(0, () => {
|
|
265
|
+
isPointerDownRef.current = false;
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function handleFocusIn(event) {
|
|
269
|
+
const target = getTarget(event);
|
|
270
|
+
if (isTabbable(target)) lastFocusedTabbableRef.current = target;
|
|
271
|
+
}
|
|
272
|
+
function handleFocusOutside(event) {
|
|
273
|
+
const relatedTarget = event.relatedTarget;
|
|
274
|
+
const currentTarget = event.currentTarget;
|
|
275
|
+
const target = getTarget(event);
|
|
276
|
+
if (modal && relatedTarget == null && target != null && contains(floating, target)) addPreviouslyFocusedElement(target);
|
|
277
|
+
queueMicrotask(() => {
|
|
278
|
+
const nodeId = getNodeId();
|
|
279
|
+
const triggers = store.context.triggerElements;
|
|
280
|
+
const insideElements = getResolvedInsideElements();
|
|
281
|
+
const isRelatedFocusGuard = relatedTarget?.hasAttribute(createAttribute("focus-guard")) && [
|
|
282
|
+
beforeGuardRef.current,
|
|
283
|
+
afterGuardRef.current,
|
|
284
|
+
portalContext?.beforeInsideRef.current,
|
|
285
|
+
portalContext?.afterInsideRef.current,
|
|
286
|
+
portalContext?.beforeOutsideRef.current,
|
|
287
|
+
portalContext?.afterOutsideRef.current,
|
|
288
|
+
resolveRef(previousFocusableElement),
|
|
289
|
+
resolveRef(nextFocusableElement)
|
|
290
|
+
].includes(relatedTarget);
|
|
291
|
+
const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some((element) => element === relatedTarget || contains(element, relatedTarget)) || triggers.hasMatchingElement((trigger) => contains(trigger, relatedTarget)) || isRelatedFocusGuard || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find((node) => contains(node.context?.elements.floating, relatedTarget) || contains(node.context?.elements.domReference, relatedTarget)) || getNodeAncestors(tree.nodesRef.current, nodeId).find((node) => [node.context?.elements.floating, getFloatingFocusElement(node.context?.elements.floating)].includes(relatedTarget) || node.context?.elements.domReference === relatedTarget)));
|
|
292
|
+
if (currentTarget === domReference && floatingFocusElement) handleTabIndex(floatingFocusElement);
|
|
293
|
+
if (restoreFocus && currentTarget !== domReference && !isElementVisible(target) && activeElement(doc) === doc.body) {
|
|
294
|
+
if (isHTMLElement(floatingFocusElement)) {
|
|
295
|
+
floatingFocusElement.focus();
|
|
296
|
+
if (restoreFocus === "popup") {
|
|
297
|
+
restoreFocusFrame.request(() => {
|
|
298
|
+
floatingFocusElement.focus();
|
|
299
|
+
});
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
const tabbableContent = getTabbableContent();
|
|
304
|
+
const prevTabbable = lastFocusedTabbableRef.current;
|
|
305
|
+
const nodeToFocus = (prevTabbable && tabbableContent.includes(prevTabbable) ? prevTabbable : null) || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;
|
|
306
|
+
if (isHTMLElement(nodeToFocus)) nodeToFocus.focus();
|
|
307
|
+
}
|
|
308
|
+
if (dataRef.current.insideReactTree) {
|
|
309
|
+
dataRef.current.insideReactTree = false;
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && (isUntrappedTypeableCombobox || relatedTarget !== getPreviouslyFocusedElement())) {
|
|
313
|
+
preventReturnFocusRef.current = true;
|
|
314
|
+
store.setOpen(false, createChangeEventDetails(focusOut, event));
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
function markInsideReactTree() {
|
|
319
|
+
if (pointerDownOutsideRef.current) return;
|
|
320
|
+
dataRef.current.insideReactTree = true;
|
|
321
|
+
blurTimeout.start(0, () => {
|
|
322
|
+
dataRef.current.insideReactTree = false;
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
const domReferenceElement = isHTMLElement(domReference) ? domReference : null;
|
|
326
|
+
if (!floating && !domReferenceElement) return;
|
|
327
|
+
return mergeCleanups(domReferenceElement && addEventListener(domReferenceElement, "focusout", handleFocusOutside), domReferenceElement && addEventListener(domReferenceElement, "pointerdown", handlePointerDown), floating && addEventListener(floating, "focusin", handleFocusIn), floating && addEventListener(floating, "focusout", handleFocusOutside), floating && portalContext && addEventListener(floating, "focusout", markInsideReactTree, true));
|
|
328
|
+
}, [
|
|
329
|
+
disabled,
|
|
330
|
+
domReference,
|
|
331
|
+
floating,
|
|
332
|
+
floatingFocusElement,
|
|
333
|
+
modal,
|
|
334
|
+
tree,
|
|
335
|
+
portalContext,
|
|
336
|
+
store,
|
|
337
|
+
closeOnFocusOut,
|
|
338
|
+
restoreFocus,
|
|
339
|
+
getTabbableContent,
|
|
340
|
+
isUntrappedTypeableCombobox,
|
|
341
|
+
getNodeId,
|
|
342
|
+
dataRef,
|
|
343
|
+
blurTimeout,
|
|
344
|
+
pointerDownTimeout,
|
|
345
|
+
restoreFocusFrame,
|
|
346
|
+
nextFocusableElement,
|
|
347
|
+
previousFocusableElement,
|
|
348
|
+
getResolvedInsideElements
|
|
349
|
+
]);
|
|
350
|
+
import_react.useEffect(() => {
|
|
351
|
+
if (disabled || !floating || !open) return;
|
|
352
|
+
const portalNodes = Array.from(portalContext?.portalNode?.querySelectorAll(`[${createAttribute("portal")}]`) || []);
|
|
353
|
+
const rootAncestorComboboxDomReference = (tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : []).find((node) => isTypeableCombobox(node.context?.elements.domReference || null))?.context?.elements.domReference;
|
|
354
|
+
const ariaHiddenCleanup = markOthers([
|
|
355
|
+
...[
|
|
356
|
+
floating,
|
|
357
|
+
...portalNodes,
|
|
358
|
+
beforeGuardRef.current,
|
|
359
|
+
afterGuardRef.current,
|
|
360
|
+
portalContext?.beforeOutsideRef.current,
|
|
361
|
+
portalContext?.afterOutsideRef.current,
|
|
362
|
+
...getResolvedInsideElements()
|
|
363
|
+
],
|
|
364
|
+
rootAncestorComboboxDomReference,
|
|
365
|
+
resolveRef(previousFocusableElement),
|
|
366
|
+
resolveRef(nextFocusableElement),
|
|
367
|
+
isUntrappedTypeableCombobox ? domReference : null
|
|
368
|
+
].filter((x) => x != null), {
|
|
369
|
+
ariaHidden: modal || isUntrappedTypeableCombobox,
|
|
370
|
+
mark: false
|
|
371
|
+
});
|
|
372
|
+
const markerCleanup = markOthers([floating, ...portalNodes].filter((x) => x != null));
|
|
373
|
+
return () => {
|
|
374
|
+
markerCleanup();
|
|
375
|
+
ariaHiddenCleanup();
|
|
376
|
+
};
|
|
377
|
+
}, [
|
|
378
|
+
open,
|
|
379
|
+
disabled,
|
|
380
|
+
domReference,
|
|
381
|
+
floating,
|
|
382
|
+
modal,
|
|
383
|
+
portalContext,
|
|
384
|
+
isUntrappedTypeableCombobox,
|
|
385
|
+
tree,
|
|
386
|
+
getNodeId,
|
|
387
|
+
nextFocusableElement,
|
|
388
|
+
previousFocusableElement,
|
|
389
|
+
getResolvedInsideElements
|
|
390
|
+
]);
|
|
391
|
+
useIsoLayoutEffect(() => {
|
|
392
|
+
if (!open || disabled || !isHTMLElement(floatingFocusElement)) return;
|
|
393
|
+
closeTypeRef.current = "";
|
|
394
|
+
lastInteractionTypeRef.current = "";
|
|
395
|
+
const doc = ownerDocument(floatingFocusElement);
|
|
396
|
+
const previouslyFocusedElement = activeElement(doc);
|
|
397
|
+
queueMicrotask(() => {
|
|
398
|
+
const initialFocusValueOrFn = initialFocusRef.current;
|
|
399
|
+
const resolvedInitialFocus = typeof initialFocusValueOrFn === "function" ? initialFocusValueOrFn(openInteractionTypeRef.current || "") : initialFocusValueOrFn;
|
|
400
|
+
if (resolvedInitialFocus === void 0 || resolvedInitialFocus === false) return;
|
|
401
|
+
if (contains(floatingFocusElement, previouslyFocusedElement)) return;
|
|
402
|
+
let focusableElements = null;
|
|
403
|
+
const getDefaultFocusElement = () => {
|
|
404
|
+
if (focusableElements == null) focusableElements = getTabbableContent(floatingFocusElement);
|
|
405
|
+
return focusableElements[0] || floatingFocusElement;
|
|
406
|
+
};
|
|
407
|
+
let elToFocus;
|
|
408
|
+
if (resolvedInitialFocus === true || resolvedInitialFocus === null) elToFocus = getDefaultFocusElement();
|
|
409
|
+
else elToFocus = resolveRef(resolvedInitialFocus);
|
|
410
|
+
elToFocus = elToFocus || getDefaultFocusElement();
|
|
411
|
+
const hadFocusInside = contains(floatingFocusElement, activeElement(doc));
|
|
412
|
+
const openEvent = dataRef.current.openEvent;
|
|
413
|
+
const openedByVirtualPress = openEvent?.type === "mousedown" && isVirtualClick(openEvent);
|
|
414
|
+
enqueueFocus(elToFocus, {
|
|
415
|
+
sync: openedByVirtualPress,
|
|
416
|
+
preventScroll: elToFocus === floatingFocusElement,
|
|
417
|
+
shouldFocus() {
|
|
418
|
+
if (!openRef.current) return false;
|
|
419
|
+
if (hadFocusInside) return true;
|
|
420
|
+
const currentActiveElement = activeElement(doc);
|
|
421
|
+
return !(currentActiveElement !== elToFocus && contains(floatingFocusElement, currentActiveElement));
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
}, [
|
|
426
|
+
disabled,
|
|
427
|
+
open,
|
|
428
|
+
floatingFocusElement,
|
|
429
|
+
getTabbableContent,
|
|
430
|
+
initialFocusRef,
|
|
431
|
+
openInteractionTypeRef,
|
|
432
|
+
openRef,
|
|
433
|
+
dataRef
|
|
434
|
+
]);
|
|
435
|
+
const pendingReturnFocusRef = import_react.useRef(null);
|
|
436
|
+
useIsoLayoutEffect(() => {
|
|
437
|
+
if (disabled || !floatingFocusElement) {
|
|
438
|
+
pendingReturnFocusRef.current = null;
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
if (pendingReturnFocusRef.current) {
|
|
442
|
+
pendingReturnFocusRef.current.cancelled = true;
|
|
443
|
+
pendingReturnFocusRef.current = null;
|
|
444
|
+
}
|
|
445
|
+
const doc = ownerDocument(floatingFocusElement);
|
|
446
|
+
const elementFocusedBeforeOpen = activeElement(doc);
|
|
447
|
+
const preferPreviousFocus = openInteractionTypeRef.current == null;
|
|
448
|
+
addPreviouslyFocusedElement(elementFocusedBeforeOpen);
|
|
449
|
+
function onOpenChangeLocal(details) {
|
|
450
|
+
if (!details.open) closeTypeRef.current = getEventType(details.nativeEvent, lastInteractionTypeRef.current);
|
|
451
|
+
if (details.reason === "focus-out" && details.triggerElement?.hasAttribute(createAttribute("focus-guard")) || details.reason === "trigger-hover" && details.nativeEvent.type === "mouseleave") preventReturnFocusRef.current = true;
|
|
452
|
+
if (details.reason !== "outside-press") return;
|
|
453
|
+
if (details.nested) preventReturnFocusRef.current = false;
|
|
454
|
+
else if (isVirtualClick(details.nativeEvent) || isVirtualPointerEvent(details.nativeEvent)) preventReturnFocusRef.current = false;
|
|
455
|
+
else {
|
|
456
|
+
let isPreventScrollSupported = false;
|
|
457
|
+
ownerDocument(floatingFocusElement).createElement("div").focus({ get preventScroll() {
|
|
458
|
+
isPreventScrollSupported = true;
|
|
459
|
+
return false;
|
|
460
|
+
} });
|
|
461
|
+
if (isPreventScrollSupported) preventReturnFocusRef.current = false;
|
|
462
|
+
else preventReturnFocusRef.current = true;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
events.on("openchange", onOpenChangeLocal);
|
|
466
|
+
function getReturnElement(closeType) {
|
|
467
|
+
const returnFocusValueOrFn = returnFocusRef.current;
|
|
468
|
+
let resolvedReturnFocusValue = typeof returnFocusValueOrFn === "function" ? returnFocusValueOrFn(closeType) : returnFocusValueOrFn;
|
|
469
|
+
if (resolvedReturnFocusValue === void 0 || resolvedReturnFocusValue === false) return null;
|
|
470
|
+
if (resolvedReturnFocusValue === null) resolvedReturnFocusValue = true;
|
|
471
|
+
const referenceReturnElement = domReference?.isConnected ? domReference : null;
|
|
472
|
+
const previousReturnElement = elementFocusedBeforeOpen?.isConnected && getNodeName(elementFocusedBeforeOpen) !== "body" ? elementFocusedBeforeOpen : null;
|
|
473
|
+
let defaultReturnElement = preferPreviousFocus ? previousReturnElement || referenceReturnElement : referenceReturnElement || previousReturnElement;
|
|
474
|
+
if (!defaultReturnElement) defaultReturnElement = getPreviouslyFocusedElement() || null;
|
|
475
|
+
if (typeof resolvedReturnFocusValue === "boolean") return defaultReturnElement;
|
|
476
|
+
return resolveRef(resolvedReturnFocusValue) || defaultReturnElement || null;
|
|
477
|
+
}
|
|
478
|
+
return () => {
|
|
479
|
+
events.off("openchange", onOpenChangeLocal);
|
|
480
|
+
const activeEl = activeElement(doc);
|
|
481
|
+
const insideElements = getResolvedInsideElements();
|
|
482
|
+
const isFocusInsideFloatingTree = contains(floating, activeEl) || insideElements.some((element) => element === activeEl || contains(element, activeEl)) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some((node) => contains(node.context?.elements.floating, activeEl));
|
|
483
|
+
const returnFocusValueOrFn = returnFocusRef.current;
|
|
484
|
+
const closeType = closeTypeRef.current;
|
|
485
|
+
const returnElement = getReturnElement(closeType);
|
|
486
|
+
const job = { cancelled: false };
|
|
487
|
+
pendingReturnFocusRef.current = job;
|
|
488
|
+
queueMicrotask(() => {
|
|
489
|
+
if (pendingReturnFocusRef.current === job) pendingReturnFocusRef.current = null;
|
|
490
|
+
const tabbableReturnElement = getFirstTabbableElement(returnElement);
|
|
491
|
+
const hasExplicitReturnFocus = explicitReturnFocusRef.current ?? typeof returnFocusValueOrFn !== "boolean";
|
|
492
|
+
if (!job.cancelled && returnFocusValueOrFn && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && (!hasExplicitReturnFocus && tabbableReturnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) {
|
|
493
|
+
const focusOptions = { preventScroll: true };
|
|
494
|
+
if (closeType === "keyboard") focusOptions.focusVisible = true;
|
|
495
|
+
tabbableReturnElement.focus(focusOptions);
|
|
496
|
+
}
|
|
497
|
+
preventReturnFocusRef.current = false;
|
|
498
|
+
});
|
|
499
|
+
};
|
|
500
|
+
}, [
|
|
501
|
+
disabled,
|
|
502
|
+
floating,
|
|
503
|
+
floatingFocusElement,
|
|
504
|
+
returnFocusRef,
|
|
505
|
+
explicitReturnFocusRef,
|
|
506
|
+
openInteractionTypeRef,
|
|
507
|
+
events,
|
|
508
|
+
tree,
|
|
509
|
+
domReference,
|
|
510
|
+
getNodeId,
|
|
511
|
+
getResolvedInsideElements
|
|
512
|
+
]);
|
|
513
|
+
useIsoLayoutEffect(() => {
|
|
514
|
+
if (!webkit || open || !floating) return;
|
|
515
|
+
const activeEl = activeElement(ownerDocument(floating));
|
|
516
|
+
if (!isHTMLElement(activeEl) || !isTypeableElement(activeEl)) return;
|
|
517
|
+
if (contains(floating, activeEl)) activeEl.blur();
|
|
518
|
+
}, [open, floating]);
|
|
519
|
+
useIsoLayoutEffect(() => {
|
|
520
|
+
if (disabled || !portalContext) return;
|
|
521
|
+
portalContext.setFocusManagerState({
|
|
522
|
+
modal,
|
|
523
|
+
closeOnFocusOut,
|
|
524
|
+
open,
|
|
525
|
+
onOpenChange: store.setOpen,
|
|
526
|
+
domReference
|
|
527
|
+
});
|
|
528
|
+
return () => {
|
|
529
|
+
portalContext.setFocusManagerState(null);
|
|
530
|
+
};
|
|
531
|
+
}, [
|
|
532
|
+
disabled,
|
|
533
|
+
portalContext,
|
|
534
|
+
modal,
|
|
535
|
+
open,
|
|
536
|
+
store,
|
|
537
|
+
closeOnFocusOut,
|
|
538
|
+
domReference
|
|
539
|
+
]);
|
|
540
|
+
useIsoLayoutEffect(() => {
|
|
541
|
+
if (disabled || !floatingFocusElement) return;
|
|
542
|
+
handleTabIndex(floatingFocusElement);
|
|
543
|
+
return () => {
|
|
544
|
+
queueMicrotask(clearDisconnectedPreviouslyFocusedElements);
|
|
545
|
+
};
|
|
546
|
+
}, [disabled, floatingFocusElement]);
|
|
547
|
+
const shouldRenderGuards = !disabled && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal);
|
|
548
|
+
return /*#__PURE__*/ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
549
|
+
shouldRenderGuards && /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FocusGuard, {
|
|
550
|
+
"data-type": "inside",
|
|
551
|
+
ref: mergedBeforeGuardRef,
|
|
552
|
+
onFocus: (event) => {
|
|
553
|
+
if (modal) {
|
|
554
|
+
const els = getTabbableContent();
|
|
555
|
+
enqueueFocus(els[els.length - 1]);
|
|
556
|
+
} else if (portalContext?.portalNode) {
|
|
557
|
+
preventReturnFocusRef.current = false;
|
|
558
|
+
if (isOutsideEvent(event, portalContext.portalNode)) getNextTabbable(domReference)?.focus();
|
|
559
|
+
else resolveRef(previousFocusableElement ?? portalContext.beforeOutsideRef)?.focus();
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}),
|
|
563
|
+
children,
|
|
564
|
+
shouldRenderGuards && /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FocusGuard, {
|
|
565
|
+
"data-type": "inside",
|
|
566
|
+
ref: mergedAfterGuardRef,
|
|
567
|
+
onFocus: (event) => {
|
|
568
|
+
if (modal) enqueueFocus(getTabbableContent()[0]);
|
|
569
|
+
else if (portalContext?.portalNode) {
|
|
570
|
+
if (closeOnFocusOut) preventReturnFocusRef.current = true;
|
|
571
|
+
if (isOutsideEvent(event, portalContext.portalNode)) getPreviousTabbable(domReference)?.focus();
|
|
572
|
+
else resolveRef(nextFocusableElement ?? portalContext.afterOutsideRef)?.focus();
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
})
|
|
576
|
+
] });
|
|
577
|
+
}
|
|
578
|
+
// ../../node_modules/.bun/@base-ui+utils@0.5.0+9e489665888c9e4a/node_modules/@base-ui/utils/inertValue.mjs
|
|
579
|
+
function inertValue(value) {
|
|
580
|
+
if (isReactVersionAtLeast(19)) return value;
|
|
581
|
+
return value ? "true" : void 0;
|
|
582
|
+
}
|
|
583
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/field/control/FieldControlDataAttributes.mjs
|
|
584
|
+
/**
|
|
585
|
+
* Present when the field is in a valid state.
|
|
586
|
+
*/
|
|
587
|
+
var valid = "data-valid";
|
|
588
|
+
/**
|
|
589
|
+
* Present when the field is in an invalid state.
|
|
590
|
+
*/
|
|
591
|
+
var invalid = "data-invalid";
|
|
592
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/field-constants/constants.mjs
|
|
593
|
+
var DEFAULT_VALIDITY_STATE = {
|
|
594
|
+
badInput: false,
|
|
595
|
+
customError: false,
|
|
596
|
+
patternMismatch: false,
|
|
597
|
+
rangeOverflow: false,
|
|
598
|
+
rangeUnderflow: false,
|
|
599
|
+
stepMismatch: false,
|
|
600
|
+
tooLong: false,
|
|
601
|
+
tooShort: false,
|
|
602
|
+
typeMismatch: false,
|
|
603
|
+
valid: null,
|
|
604
|
+
valueMissing: false
|
|
605
|
+
};
|
|
606
|
+
var DEFAULT_FIELD_STATE_ATTRIBUTES = {
|
|
607
|
+
valid: null,
|
|
608
|
+
touched: false,
|
|
609
|
+
dirty: false,
|
|
610
|
+
filled: false,
|
|
611
|
+
focused: false
|
|
612
|
+
};
|
|
613
|
+
var DEFAULT_FIELD_ROOT_STATE = {
|
|
614
|
+
disabled: false,
|
|
615
|
+
...DEFAULT_FIELD_STATE_ATTRIBUTES
|
|
616
|
+
};
|
|
617
|
+
var fieldValidityMapping = { valid(value) {
|
|
618
|
+
if (value === null) return null;
|
|
619
|
+
if (value) return { [valid]: "" };
|
|
620
|
+
return { [invalid]: "" };
|
|
621
|
+
} };
|
|
622
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs
|
|
623
|
+
var DEFAULT_FIELD_ROOT_CONTEXT = {
|
|
624
|
+
invalid: void 0,
|
|
625
|
+
name: void 0,
|
|
626
|
+
validityData: {
|
|
627
|
+
state: DEFAULT_VALIDITY_STATE,
|
|
628
|
+
errors: [],
|
|
629
|
+
error: "",
|
|
630
|
+
value: "",
|
|
631
|
+
initialValue: null
|
|
632
|
+
},
|
|
633
|
+
setValidityData: NOOP,
|
|
634
|
+
disabled: void 0,
|
|
635
|
+
setTouched: NOOP,
|
|
636
|
+
setDirty: NOOP,
|
|
637
|
+
setFilled: NOOP,
|
|
638
|
+
setFocused: NOOP,
|
|
639
|
+
focusOwnerRef: { current: void 0 },
|
|
640
|
+
validationMode: "onSubmit",
|
|
641
|
+
shouldValidateOnChange: () => false,
|
|
642
|
+
state: DEFAULT_FIELD_ROOT_STATE,
|
|
643
|
+
registerFieldControl: NOOP,
|
|
644
|
+
validation: {
|
|
645
|
+
getValidationProps: (_disabled, props = EMPTY_OBJECT) => props,
|
|
646
|
+
inputRef: { current: null },
|
|
647
|
+
registeredInputs: /* @__PURE__ */ new Map(),
|
|
648
|
+
registerInput: NOOP,
|
|
649
|
+
getInputControl: () => null,
|
|
650
|
+
commit: async () => {},
|
|
651
|
+
change: NOOP
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
var FieldRootContext = /*#__PURE__*/ import_react.createContext(DEFAULT_FIELD_ROOT_CONTEXT);
|
|
655
|
+
function useFieldRootContext(optional = true) {
|
|
656
|
+
const context = import_react.useContext(FieldRootContext);
|
|
657
|
+
if (context.setValidityData === NOOP && !optional) throw new Error(formatErrorMessage(28));
|
|
658
|
+
return context;
|
|
659
|
+
}
|
|
660
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/field-register-control/useRegisterFieldControl.mjs
|
|
661
|
+
function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true, name) {
|
|
662
|
+
const { registerFieldControl } = useFieldRootContext();
|
|
663
|
+
const sourceRef = useRefWithInit(() => Symbol());
|
|
664
|
+
useIsoLayoutEffect(() => {
|
|
665
|
+
const source = sourceRef.current;
|
|
666
|
+
if (!enabled) {
|
|
667
|
+
registerFieldControl(source, void 0);
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
registerFieldControl(source, {
|
|
671
|
+
controlRef,
|
|
672
|
+
getValue: getFormValueOverride,
|
|
673
|
+
id,
|
|
674
|
+
name,
|
|
675
|
+
value
|
|
676
|
+
});
|
|
677
|
+
}, [
|
|
678
|
+
controlRef,
|
|
679
|
+
enabled,
|
|
680
|
+
getFormValueOverride,
|
|
681
|
+
id,
|
|
682
|
+
name,
|
|
683
|
+
registerFieldControl,
|
|
684
|
+
sourceRef,
|
|
685
|
+
value
|
|
686
|
+
]);
|
|
687
|
+
useIsoLayoutEffect(() => {
|
|
688
|
+
const source = sourceRef.current;
|
|
689
|
+
return () => {
|
|
690
|
+
registerFieldControl(source, void 0);
|
|
691
|
+
};
|
|
692
|
+
}, [registerFieldControl, sourceRef]);
|
|
693
|
+
}
|
|
694
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/form-context/FormContext.mjs
|
|
695
|
+
var FormContext = /*#__PURE__*/ import_react.createContext({
|
|
696
|
+
elementRef: { current: null },
|
|
697
|
+
formRef: { current: { fields: /* @__PURE__ */ new Map() } },
|
|
698
|
+
errors: {},
|
|
699
|
+
clearErrors: NOOP,
|
|
700
|
+
validationMode: "onSubmit",
|
|
701
|
+
submitCountRef: { current: 0 }
|
|
702
|
+
});
|
|
703
|
+
function useFormContext() {
|
|
704
|
+
return import_react.useContext(FormContext);
|
|
705
|
+
}
|
|
706
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/labelable-provider/LabelableContext.mjs
|
|
707
|
+
/**
|
|
708
|
+
* A context for providing [labelable elements](https://html.spec.whatwg.org/multipage/forms.html#category-label)\
|
|
709
|
+
* with an accessible name (label) and description.
|
|
710
|
+
*/
|
|
711
|
+
var LabelableContext = /*#__PURE__*/ import_react.createContext({
|
|
712
|
+
controlId: void 0,
|
|
713
|
+
registerControlId: NOOP,
|
|
714
|
+
resetControlId: NOOP,
|
|
715
|
+
labelId: void 0,
|
|
716
|
+
setLabelId: NOOP,
|
|
717
|
+
messageIds: [],
|
|
718
|
+
setMessageIds: NOOP,
|
|
719
|
+
getDescriptionProps: (externalProps) => externalProps
|
|
720
|
+
});
|
|
721
|
+
function useLabelableContext() {
|
|
722
|
+
return import_react.useContext(LabelableContext);
|
|
723
|
+
}
|
|
724
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs
|
|
725
|
+
function useLabelableId(params = {}) {
|
|
726
|
+
const { id, enabled = true } = params;
|
|
727
|
+
const { controlId, registerControlId, resetControlId } = useLabelableContext();
|
|
728
|
+
const defaultId = useBaseUiId();
|
|
729
|
+
const controlSourceRef = useRefWithInit(() => Symbol());
|
|
730
|
+
const hasRegisteredRef = import_react.useRef(false);
|
|
731
|
+
const hadExplicitIdRef = import_react.useRef(false);
|
|
732
|
+
const unregisterControlId = useStableCallback(() => {
|
|
733
|
+
if (!hasRegisteredRef.current || registerControlId === NOOP) return;
|
|
734
|
+
hasRegisteredRef.current = false;
|
|
735
|
+
registerControlId(controlSourceRef.current, void 0);
|
|
736
|
+
});
|
|
737
|
+
useIsoLayoutEffect(() => {
|
|
738
|
+
if (!enabled || registerControlId === NOOP) {
|
|
739
|
+
unregisterControlId();
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
let nextId;
|
|
743
|
+
if (id !== void 0) {
|
|
744
|
+
hadExplicitIdRef.current = true;
|
|
745
|
+
nextId = id;
|
|
746
|
+
} else if (hadExplicitIdRef.current) nextId = defaultId;
|
|
747
|
+
else {
|
|
748
|
+
resetControlId();
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
if (nextId === void 0) {
|
|
752
|
+
unregisterControlId();
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
hasRegisteredRef.current = true;
|
|
756
|
+
registerControlId(controlSourceRef.current, nextId);
|
|
757
|
+
}, [
|
|
758
|
+
id,
|
|
759
|
+
enabled,
|
|
760
|
+
registerControlId,
|
|
761
|
+
resetControlId,
|
|
762
|
+
defaultId,
|
|
763
|
+
controlSourceRef,
|
|
764
|
+
unregisterControlId
|
|
765
|
+
]);
|
|
766
|
+
useIsoLayoutEffect(() => {
|
|
767
|
+
return unregisterControlId;
|
|
768
|
+
}, [unregisterControlId]);
|
|
769
|
+
return (enabled ? controlId : void 0) ?? id ?? defaultId;
|
|
770
|
+
}
|
|
771
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/useValueChanged.mjs
|
|
772
|
+
function useValueChanged(value, onChange) {
|
|
773
|
+
const valueRef = import_react.useRef(value);
|
|
774
|
+
const onChangeCallback = useStableCallback(onChange);
|
|
775
|
+
useIsoLayoutEffect(() => {
|
|
776
|
+
if (valueRef.current !== value) onChangeCallback(valueRef.current);
|
|
777
|
+
valueRef.current = value;
|
|
778
|
+
}, [value, onChangeCallback]);
|
|
779
|
+
}
|
|
780
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/field-root-context/useSetFieldFocused.mjs
|
|
781
|
+
/**
|
|
782
|
+
* Returns the field's `setFocused`, recording which control the focused state belongs to.
|
|
783
|
+
*
|
|
784
|
+
* Disabling or unmounting a focused control moves focus away without firing `blur`, so the focused
|
|
785
|
+
* state would otherwise stay latched. A field can have several focus targets, so a control only
|
|
786
|
+
* clears the shared state when focus last landed on itself. The stable callback doubles as that
|
|
787
|
+
* identity.
|
|
788
|
+
*/
|
|
789
|
+
function useSetFieldFocused(disabled, focusTargetRef, onFocusedChange) {
|
|
790
|
+
const { setFocused, focusOwnerRef } = useFieldRootContext();
|
|
791
|
+
const setFieldFocused = useStableCallback((focused) => {
|
|
792
|
+
if (focused ? !disabled : focusOwnerRef.current === setFieldFocused) {
|
|
793
|
+
focusOwnerRef.current = focused && setFieldFocused;
|
|
794
|
+
onFocusedChange?.(focused);
|
|
795
|
+
setFocused(focused);
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
useIsoLayoutEffect(() => {
|
|
799
|
+
const el = focusTargetRef.current;
|
|
800
|
+
if ((el?.getRootNode())?.activeElement === el) setFieldFocused(true);
|
|
801
|
+
return () => setFieldFocused(false);
|
|
802
|
+
}, [
|
|
803
|
+
disabled,
|
|
804
|
+
focusTargetRef,
|
|
805
|
+
setFieldFocused
|
|
806
|
+
]);
|
|
807
|
+
return setFieldFocused;
|
|
808
|
+
}
|
|
809
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/utils/InternalBackdrop.mjs
|
|
810
|
+
/**
|
|
811
|
+
* @internal
|
|
812
|
+
*/
|
|
813
|
+
var InternalBackdrop = /*#__PURE__*/ import_react.forwardRef(function InternalBackdrop(props, ref) {
|
|
814
|
+
const { cutout, ...otherProps } = props;
|
|
815
|
+
let clipPath;
|
|
816
|
+
if (cutout) {
|
|
817
|
+
const rect = cutout.getBoundingClientRect();
|
|
818
|
+
clipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${rect.left}px ${rect.top}px,${rect.left}px ${rect.bottom}px,${rect.right}px ${rect.bottom}px,${rect.right}px ${rect.top}px,${rect.left}px ${rect.top}px)`;
|
|
819
|
+
}
|
|
820
|
+
return /*#__PURE__*/ (0, import_jsx_runtime.jsx)("div", {
|
|
821
|
+
ref,
|
|
822
|
+
role: "presentation",
|
|
823
|
+
"data-base-ui-inert": "",
|
|
824
|
+
...otherProps,
|
|
825
|
+
style: {
|
|
826
|
+
position: "fixed",
|
|
827
|
+
inset: 0,
|
|
828
|
+
userSelect: "none",
|
|
829
|
+
WebkitUserSelect: "none",
|
|
830
|
+
clipPath
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
});
|
|
834
|
+
// ../../node_modules/.bun/@base-ui+utils@0.5.0+9e489665888c9e4a/node_modules/@base-ui/utils/useScrollLock.mjs
|
|
835
|
+
var originalHtmlStyles = {};
|
|
836
|
+
var originalBodyStyles = {};
|
|
837
|
+
var originalHtmlScrollBehavior = "";
|
|
838
|
+
function getViewportScroller(html, body) {
|
|
839
|
+
return isOverflowElement(html) ? html : body;
|
|
840
|
+
}
|
|
841
|
+
function isPageScrollLocked(win, html, body) {
|
|
842
|
+
return /hidden|clip/.test(win.getComputedStyle(getViewportScroller(html, body)).overflowY);
|
|
843
|
+
}
|
|
844
|
+
function hasInsetScrollbars(referenceElement) {
|
|
845
|
+
if (typeof document === "undefined") return false;
|
|
846
|
+
const doc = ownerDocument(referenceElement);
|
|
847
|
+
return getWindow(doc).innerWidth - doc.documentElement.clientWidth > 0;
|
|
848
|
+
}
|
|
849
|
+
function supportsStableScrollbarGutter(referenceElement) {
|
|
850
|
+
if (!(typeof CSS !== "undefined" && CSS.supports && CSS.supports("scrollbar-gutter", "stable")) || typeof document === "undefined") return false;
|
|
851
|
+
const doc = ownerDocument(referenceElement);
|
|
852
|
+
const html = doc.documentElement;
|
|
853
|
+
const body = doc.body;
|
|
854
|
+
const scrollContainer = getViewportScroller(html, body);
|
|
855
|
+
const originalScrollContainerOverflowY = scrollContainer.style.overflowY;
|
|
856
|
+
const originalHtmlStyleGutter = html.style.scrollbarGutter;
|
|
857
|
+
html.style.scrollbarGutter = "stable";
|
|
858
|
+
scrollContainer.style.overflowY = "scroll";
|
|
859
|
+
const before = scrollContainer.offsetWidth;
|
|
860
|
+
scrollContainer.style.overflowY = "hidden";
|
|
861
|
+
const after = scrollContainer.offsetWidth;
|
|
862
|
+
scrollContainer.style.overflowY = originalScrollContainerOverflowY;
|
|
863
|
+
html.style.scrollbarGutter = originalHtmlStyleGutter;
|
|
864
|
+
return before === after;
|
|
865
|
+
}
|
|
866
|
+
function preventScrollOverlayScrollbars(referenceElement) {
|
|
867
|
+
const doc = ownerDocument(referenceElement);
|
|
868
|
+
const html = doc.documentElement;
|
|
869
|
+
const body = doc.body;
|
|
870
|
+
const elementToLock = getViewportScroller(html, body);
|
|
871
|
+
const originalElementToLockStyles = {
|
|
872
|
+
overflowY: elementToLock.style.overflowY,
|
|
873
|
+
overflowX: elementToLock.style.overflowX
|
|
874
|
+
};
|
|
875
|
+
Object.assign(elementToLock.style, {
|
|
876
|
+
overflowY: "hidden",
|
|
877
|
+
overflowX: "hidden"
|
|
878
|
+
});
|
|
879
|
+
return () => {
|
|
880
|
+
Object.assign(elementToLock.style, originalElementToLockStyles);
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
function preventScrollInsetScrollbars(referenceElement) {
|
|
884
|
+
const doc = ownerDocument(referenceElement);
|
|
885
|
+
const html = doc.documentElement;
|
|
886
|
+
const body = doc.body;
|
|
887
|
+
const win = getWindow(html);
|
|
888
|
+
let scrollTop = 0;
|
|
889
|
+
let scrollLeft = 0;
|
|
890
|
+
let updateGutterOnly = false;
|
|
891
|
+
const resizeFrame = AnimationFrame.create();
|
|
892
|
+
if (webkit && (win.visualViewport?.scale ?? 1) !== 1) return () => {};
|
|
893
|
+
function lockScroll() {
|
|
894
|
+
const htmlStyles = win.getComputedStyle(html);
|
|
895
|
+
const bodyStyles = win.getComputedStyle(body);
|
|
896
|
+
const scrollbarGutterValue = (htmlStyles.scrollbarGutter || "").includes("both-edges") ? "stable both-edges" : "stable";
|
|
897
|
+
scrollTop = html.scrollTop;
|
|
898
|
+
scrollLeft = html.scrollLeft;
|
|
899
|
+
originalHtmlStyles = {
|
|
900
|
+
scrollbarGutter: html.style.scrollbarGutter,
|
|
901
|
+
overflowY: html.style.overflowY,
|
|
902
|
+
overflowX: html.style.overflowX
|
|
903
|
+
};
|
|
904
|
+
originalHtmlScrollBehavior = html.style.scrollBehavior;
|
|
905
|
+
originalBodyStyles = {
|
|
906
|
+
position: body.style.position,
|
|
907
|
+
height: body.style.height,
|
|
908
|
+
width: body.style.width,
|
|
909
|
+
boxSizing: body.style.boxSizing,
|
|
910
|
+
overflowY: body.style.overflowY,
|
|
911
|
+
overflowX: body.style.overflowX,
|
|
912
|
+
scrollBehavior: body.style.scrollBehavior
|
|
913
|
+
};
|
|
914
|
+
const isScrollableY = html.scrollHeight > html.clientHeight;
|
|
915
|
+
const isScrollableX = html.scrollWidth > html.clientWidth;
|
|
916
|
+
const hasConstantOverflowY = htmlStyles.overflowY === "scroll" || bodyStyles.overflowY === "scroll";
|
|
917
|
+
const hasConstantOverflowX = htmlStyles.overflowX === "scroll" || bodyStyles.overflowX === "scroll";
|
|
918
|
+
const scrollbarWidth = Math.max(0, win.innerWidth - body.clientWidth);
|
|
919
|
+
const scrollbarHeight = Math.max(0, win.innerHeight - body.clientHeight);
|
|
920
|
+
const marginY = parseFloat(bodyStyles.marginTop) + parseFloat(bodyStyles.marginBottom);
|
|
921
|
+
const marginX = parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight);
|
|
922
|
+
const elementToLock = getViewportScroller(html, body);
|
|
923
|
+
updateGutterOnly = supportsStableScrollbarGutter(referenceElement);
|
|
924
|
+
if (updateGutterOnly) {
|
|
925
|
+
html.style.scrollbarGutter = scrollbarGutterValue;
|
|
926
|
+
elementToLock.style.overflowY = "hidden";
|
|
927
|
+
elementToLock.style.overflowX = "hidden";
|
|
928
|
+
return;
|
|
929
|
+
}
|
|
930
|
+
Object.assign(html.style, {
|
|
931
|
+
scrollbarGutter: scrollbarGutterValue,
|
|
932
|
+
overflowY: "hidden",
|
|
933
|
+
overflowX: "hidden"
|
|
934
|
+
});
|
|
935
|
+
if (isScrollableY || hasConstantOverflowY) html.style.overflowY = "scroll";
|
|
936
|
+
if (isScrollableX || hasConstantOverflowX) html.style.overflowX = "scroll";
|
|
937
|
+
Object.assign(body.style, {
|
|
938
|
+
position: "relative",
|
|
939
|
+
height: marginY || scrollbarHeight ? `calc(100dvh - ${marginY + scrollbarHeight}px)` : "100dvh",
|
|
940
|
+
width: marginX || scrollbarWidth ? `calc(100vw - ${marginX + scrollbarWidth}px)` : "100vw",
|
|
941
|
+
boxSizing: "border-box",
|
|
942
|
+
overflowY: "hidden",
|
|
943
|
+
overflowX: "hidden",
|
|
944
|
+
scrollBehavior: "unset"
|
|
945
|
+
});
|
|
946
|
+
body.scrollTop = scrollTop;
|
|
947
|
+
body.scrollLeft = scrollLeft;
|
|
948
|
+
html.setAttribute("data-base-ui-scroll-locked", "");
|
|
949
|
+
html.style.scrollBehavior = "unset";
|
|
950
|
+
}
|
|
951
|
+
function cleanup() {
|
|
952
|
+
Object.assign(html.style, originalHtmlStyles);
|
|
953
|
+
Object.assign(body.style, originalBodyStyles);
|
|
954
|
+
if (!updateGutterOnly) {
|
|
955
|
+
html.scrollTop = scrollTop;
|
|
956
|
+
html.scrollLeft = scrollLeft;
|
|
957
|
+
html.removeAttribute("data-base-ui-scroll-locked");
|
|
958
|
+
html.style.scrollBehavior = originalHtmlScrollBehavior;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
function handleResize() {
|
|
962
|
+
cleanup();
|
|
963
|
+
resizeFrame.request(lockScroll);
|
|
964
|
+
}
|
|
965
|
+
lockScroll();
|
|
966
|
+
const unsubscribeResize = addEventListener(win, "resize", handleResize);
|
|
967
|
+
return () => {
|
|
968
|
+
resizeFrame.cancel();
|
|
969
|
+
cleanup();
|
|
970
|
+
if (typeof win.removeEventListener === "function") unsubscribeResize();
|
|
971
|
+
};
|
|
972
|
+
}
|
|
973
|
+
var ScrollLocker = class {
|
|
974
|
+
lockCount = 0;
|
|
975
|
+
restore = null;
|
|
976
|
+
timeoutLock = Timeout.create();
|
|
977
|
+
timeoutUnlock = Timeout.create();
|
|
978
|
+
acquire(referenceElement) {
|
|
979
|
+
this.lockCount += 1;
|
|
980
|
+
if (this.lockCount === 1 && this.restore === null) this.timeoutLock.start(0, () => this.lock(referenceElement));
|
|
981
|
+
return this.release;
|
|
982
|
+
}
|
|
983
|
+
release = () => {
|
|
984
|
+
this.lockCount -= 1;
|
|
985
|
+
if (this.lockCount === 0 && this.restore) this.timeoutUnlock.start(0, this.unlock);
|
|
986
|
+
};
|
|
987
|
+
unlock = () => {
|
|
988
|
+
if (this.lockCount === 0 && this.restore) {
|
|
989
|
+
this.restore?.();
|
|
990
|
+
this.restore = null;
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
lock(referenceElement) {
|
|
994
|
+
if (this.lockCount === 0 || this.restore !== null) return;
|
|
995
|
+
const doc = ownerDocument(referenceElement);
|
|
996
|
+
const html = doc.documentElement;
|
|
997
|
+
const body = doc.body;
|
|
998
|
+
const win = getWindow(html);
|
|
999
|
+
if (isPageScrollLocked(win, html, body)) {
|
|
1000
|
+
const observer = new win.MutationObserver(() => {
|
|
1001
|
+
if (isPageScrollLocked(win, html, body)) return;
|
|
1002
|
+
observer.disconnect();
|
|
1003
|
+
this.restore = null;
|
|
1004
|
+
this.lock(referenceElement);
|
|
1005
|
+
});
|
|
1006
|
+
const options = { attributes: true };
|
|
1007
|
+
observer.observe(html, options);
|
|
1008
|
+
observer.observe(body, options);
|
|
1009
|
+
this.restore = () => observer.disconnect();
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
const hasOverlayScrollbars = ios || !hasInsetScrollbars(referenceElement);
|
|
1013
|
+
this.restore = hasOverlayScrollbars ? preventScrollOverlayScrollbars(referenceElement) : preventScrollInsetScrollbars(referenceElement);
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
var SCROLL_LOCKER = new ScrollLocker();
|
|
1017
|
+
/**
|
|
1018
|
+
* Locks the scroll of the document when enabled.
|
|
1019
|
+
*
|
|
1020
|
+
* @param enabled - Whether to enable the scroll lock.
|
|
1021
|
+
* @param referenceElement - Element to use as a reference for lock calculations.
|
|
1022
|
+
*/
|
|
1023
|
+
function useScrollLock(enabled = true, referenceElement = null) {
|
|
1024
|
+
useIsoLayoutEffect(() => {
|
|
1025
|
+
if (!enabled) return;
|
|
1026
|
+
return SCROLL_LOCKER.acquire(referenceElement);
|
|
1027
|
+
}, [enabled, referenceElement]);
|
|
1028
|
+
}
|
|
1029
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/field/control/FieldControl.mjs
|
|
1030
|
+
/**
|
|
1031
|
+
* The form control to label and validate.
|
|
1032
|
+
* Renders an `<input>` element.
|
|
1033
|
+
*
|
|
1034
|
+
* You can omit this part and use any Base UI input component instead. For example,
|
|
1035
|
+
* [Input](https://base-ui.com/react/components/input), [Checkbox](https://base-ui.com/react/components/checkbox),
|
|
1036
|
+
* or [Select](https://base-ui.com/react/components/select), among others, will work with Field out of the box.
|
|
1037
|
+
*
|
|
1038
|
+
* Documentation: [Base UI Field](https://base-ui.com/react/components/field)
|
|
1039
|
+
*/
|
|
1040
|
+
var FieldControl = /*#__PURE__*/ import_react.forwardRef(function FieldControl(componentProps, forwardedRef) {
|
|
1041
|
+
const { render, className, id: idProp, name: nameProp, value, disabled: disabledProp = false, onValueChange, defaultValue, autoFocus = false, style, ...elementProps } = componentProps;
|
|
1042
|
+
const { state: fieldState, name: fieldName, disabled: fieldDisabled, setTouched, setDirty, validityData, setFilled, validationMode, validation } = useFieldRootContext();
|
|
1043
|
+
const { clearErrors, elementRef: formElementRef, submitCountRef } = useFormContext();
|
|
1044
|
+
const disabled = fieldDisabled || disabledProp;
|
|
1045
|
+
const name = fieldName ?? nameProp;
|
|
1046
|
+
const state = {
|
|
1047
|
+
...fieldState,
|
|
1048
|
+
disabled
|
|
1049
|
+
};
|
|
1050
|
+
const { labelId } = useLabelableContext();
|
|
1051
|
+
const id = useLabelableId({ id: idProp });
|
|
1052
|
+
const isControlled = value !== void 0;
|
|
1053
|
+
const serializedValue = value == null ? void 0 : String(value);
|
|
1054
|
+
const getValueFromInput = useStableCallback(() => validation.inputRef.current?.value);
|
|
1055
|
+
useRegisterFieldControl(validation.inputRef, id, serializedValue, getValueFromInput, !disabled, nameProp);
|
|
1056
|
+
useIsoLayoutEffect(() => {
|
|
1057
|
+
const currentValue = serializedValue ?? validation.inputRef.current?.value;
|
|
1058
|
+
if (currentValue !== void 0) setFilled(currentValue !== "");
|
|
1059
|
+
}, [
|
|
1060
|
+
serializedValue,
|
|
1061
|
+
defaultValue,
|
|
1062
|
+
validation.inputRef,
|
|
1063
|
+
setFilled
|
|
1064
|
+
]);
|
|
1065
|
+
useValueChanged(serializedValue, () => {
|
|
1066
|
+
if (serializedValue === void 0) return;
|
|
1067
|
+
clearErrors(name);
|
|
1068
|
+
setDirty(serializedValue !== (validityData.initialValue ?? ""));
|
|
1069
|
+
validation.change(serializedValue);
|
|
1070
|
+
});
|
|
1071
|
+
const inputRef = import_react.useRef(null);
|
|
1072
|
+
const setFocused = useSetFieldFocused(disabled, inputRef);
|
|
1073
|
+
const enterValidationTimeout = useTimeout();
|
|
1074
|
+
return useRenderElement("input", componentProps, {
|
|
1075
|
+
ref: [forwardedRef, inputRef],
|
|
1076
|
+
state,
|
|
1077
|
+
props: [
|
|
1078
|
+
{
|
|
1079
|
+
id,
|
|
1080
|
+
disabled,
|
|
1081
|
+
name,
|
|
1082
|
+
ref: validation.inputRef,
|
|
1083
|
+
"aria-labelledby": labelId,
|
|
1084
|
+
autoFocus,
|
|
1085
|
+
...isControlled ? { value } : { defaultValue },
|
|
1086
|
+
onChange(event) {
|
|
1087
|
+
const inputValue = event.currentTarget.value;
|
|
1088
|
+
const details = createChangeEventDetails(none, event.nativeEvent);
|
|
1089
|
+
onValueChange?.(inputValue, details);
|
|
1090
|
+
if (isControlled) return;
|
|
1091
|
+
setDirty(inputValue !== (validityData.initialValue ?? ""));
|
|
1092
|
+
setFilled(inputValue !== "");
|
|
1093
|
+
if (!event.nativeEvent.defaultPrevented && !details.isCanceled) {
|
|
1094
|
+
clearErrors(name);
|
|
1095
|
+
validation.change(inputValue);
|
|
1096
|
+
}
|
|
1097
|
+
},
|
|
1098
|
+
onFocus() {
|
|
1099
|
+
setFocused(true);
|
|
1100
|
+
},
|
|
1101
|
+
onBlur(event) {
|
|
1102
|
+
setTouched(true);
|
|
1103
|
+
setFocused(false);
|
|
1104
|
+
if (validationMode === "onBlur") {
|
|
1105
|
+
const inputValue = event.currentTarget.value;
|
|
1106
|
+
validation.commit(inputValue);
|
|
1107
|
+
if (isControlled) queueMicrotask(() => {
|
|
1108
|
+
const nextValue = validation.inputRef.current?.value;
|
|
1109
|
+
if (nextValue !== void 0 && nextValue !== inputValue && nextValue !== (validityData.initialValue ?? "")) validation.commit(nextValue);
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
},
|
|
1113
|
+
onKeyDown(event) {
|
|
1114
|
+
if (event.currentTarget.tagName === "INPUT" && event.key === "Enter") {
|
|
1115
|
+
setTouched(true);
|
|
1116
|
+
const value = event.currentTarget.value;
|
|
1117
|
+
const form = event.currentTarget.form;
|
|
1118
|
+
if (form && form === formElementRef.current && !event.defaultPrevented) {
|
|
1119
|
+
const input = event.currentTarget;
|
|
1120
|
+
const submitCount = submitCountRef.current;
|
|
1121
|
+
enterValidationTimeout.start(0, () => {
|
|
1122
|
+
if (submitCountRef.current === submitCount) validation.commit(input.value);
|
|
1123
|
+
});
|
|
1124
|
+
} else validation.commit(value);
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
},
|
|
1128
|
+
elementProps,
|
|
1129
|
+
(props) => validation.getValidationProps(disabled, props)
|
|
1130
|
+
],
|
|
1131
|
+
stateAttributesMapping: fieldValidityMapping
|
|
1132
|
+
});
|
|
1133
|
+
});
|
|
1134
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/input/Input.mjs
|
|
1135
|
+
/**
|
|
1136
|
+
* A native input element that automatically works with [Field](https://base-ui.com/react/components/field).
|
|
1137
|
+
* Renders an `<input>` element.
|
|
1138
|
+
*
|
|
1139
|
+
* Documentation: [Base UI Input](https://base-ui.com/react/components/input)
|
|
1140
|
+
*/
|
|
1141
|
+
var Input$1 = /*#__PURE__*/ import_react.forwardRef(function Input(props, forwardedRef) {
|
|
1142
|
+
return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FieldControl, {
|
|
1143
|
+
ref: forwardedRef,
|
|
1144
|
+
...props
|
|
1145
|
+
});
|
|
1146
|
+
});
|
|
1147
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/separator/Separator.mjs
|
|
1148
|
+
/**
|
|
1149
|
+
* A separator element accessible to screen readers.
|
|
1150
|
+
* Renders a `<div>` element.
|
|
1151
|
+
*
|
|
1152
|
+
* Documentation: [Base UI Separator](https://base-ui.com/react/components/separator)
|
|
1153
|
+
*/
|
|
1154
|
+
var Separator$1 = /*#__PURE__*/ import_react.forwardRef(function SeparatorComponent(componentProps, forwardedRef) {
|
|
1155
|
+
const { className, render, orientation = "horizontal", style, ...elementProps } = componentProps;
|
|
1156
|
+
return useRenderElement("div", componentProps, {
|
|
1157
|
+
state: { orientation },
|
|
1158
|
+
ref: forwardedRef,
|
|
1159
|
+
props: [{
|
|
1160
|
+
role: "separator",
|
|
1161
|
+
"aria-orientation": orientation
|
|
1162
|
+
}, elementProps]
|
|
1163
|
+
});
|
|
1164
|
+
});
|
|
1165
|
+
// src/components/ui/fields.tsx
|
|
1166
|
+
/** A key name, as the viewer presses it. */
|
|
1167
|
+
function Kbd({ className, ...props }) {
|
|
1168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", {
|
|
1169
|
+
"data-slot": "kbd",
|
|
1170
|
+
className: cn("inline-grid h-[18px] min-w-[18px] place-items-center rounded-[4px] border border-b-2 border-rule bg-page px-1 font-mono text-[0.66rem] leading-none font-semibold text-muted select-none", className),
|
|
1171
|
+
...props
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
var FIELD = "w-full min-w-0 rounded-control border border-rule bg-page px-3 text-sm text-text outline-none transition-colors placeholder:text-muted focus:border-accent disabled:cursor-not-allowed disabled:opacity-60";
|
|
1175
|
+
function Input({ className, ...props }) {
|
|
1176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input$1, {
|
|
1177
|
+
"data-slot": "input",
|
|
1178
|
+
className: cn(FIELD, "h-9", className),
|
|
1179
|
+
...props
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
function Separator({ className, orientation = "horizontal", ...props }) {
|
|
1183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Separator$1, {
|
|
1184
|
+
"data-slot": "separator",
|
|
1185
|
+
orientation,
|
|
1186
|
+
className: cn("shrink-0 bg-rule-soft data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch", className),
|
|
1187
|
+
...props
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
export { inertValue as _, InternalBackdrop as a, useLabelableId as c, useRegisterFieldControl as d, DEFAULT_FIELD_ROOT_CONTEXT as f, fieldValidityMapping as g, DEFAULT_FIELD_STATE_ATTRIBUTES as h, useScrollLock as i, useLabelableContext as l, useFieldRootContext as m, Kbd as n, useSetFieldFocused as o, FieldRootContext as p, Separator as r, useValueChanged as s, Input as t, useFormContext as u, FloatingFocusManager as v, enqueueFocus as y };
|