@alfadocs/ui-kit-debug 0.50.1 → 0.51.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/dist/_chunks/{agenda-card-BaSfVfrL.js → agenda-card-Bl-SBiCh.js} +55 -45
- package/dist/_chunks/agenda-card-Bl-SBiCh.js.map +1 -0
- package/dist/_chunks/agenda-tray-DA6qj8BL.js +203 -0
- package/dist/_chunks/agenda-tray-DA6qj8BL.js.map +1 -0
- package/dist/_chunks/{ai-consent-banner-F2md5JD3.js → ai-consent-banner-DBKV27je.js} +2 -2
- package/dist/_chunks/{ai-consent-banner-F2md5JD3.js.map → ai-consent-banner-DBKV27je.js.map} +1 -1
- package/dist/_chunks/ai-tools-rail-7tC3GT4h.js +340 -0
- package/dist/_chunks/ai-tools-rail-7tC3GT4h.js.map +1 -0
- package/dist/_chunks/{alert-CUTxnym2.js → alert-_mUKLmwA.js} +54 -44
- package/dist/_chunks/alert-_mUKLmwA.js.map +1 -0
- package/dist/_chunks/{audio-recorder-DVJXV7_k.js → audio-recorder-D6OVfNiZ.js} +2 -2
- package/dist/_chunks/{audio-recorder-DVJXV7_k.js.map → audio-recorder-D6OVfNiZ.js.map} +1 -1
- package/dist/_chunks/{booking-DljH0JkS.js → booking-BUV9fspj.js} +2 -2
- package/dist/_chunks/{booking-DljH0JkS.js.map → booking-BUV9fspj.js.map} +1 -1
- package/dist/_chunks/{document-scanner-Cxqvq7GR.js → document-scanner-biBS_f6c.js} +2 -2
- package/dist/_chunks/{document-scanner-Cxqvq7GR.js.map → document-scanner-biBS_f6c.js.map} +1 -1
- package/dist/_chunks/dropdown-menu-DwwPovMZ.js +354 -0
- package/dist/_chunks/dropdown-menu-DwwPovMZ.js.map +1 -0
- package/dist/_chunks/{editable-currency-cell-renderer-Bh48OHRv.js → editable-currency-cell-renderer-D5C5tCfu.js} +3 -3
- package/dist/_chunks/{editable-currency-cell-renderer-Bh48OHRv.js.map → editable-currency-cell-renderer-D5C5tCfu.js.map} +1 -1
- package/dist/_chunks/{freemium-paywall-BWaLWje-.js → freemium-paywall-gHGA44dW.js} +2 -2
- package/dist/_chunks/{freemium-paywall-BWaLWje-.js.map → freemium-paywall-gHGA44dW.js.map} +1 -1
- package/dist/_chunks/{header-settings-Bx0Biimh.js → header-settings-D5Z2B_Yz.js} +3 -3
- package/dist/_chunks/{header-settings-Bx0Biimh.js.map → header-settings-D5Z2B_Yz.js.map} +1 -1
- package/dist/_chunks/{marketplace-app-shell-UKSLx9K_.js → marketplace-app-shell-Dmo1S9av.js} +6 -6
- package/dist/_chunks/{marketplace-app-shell-UKSLx9K_.js.map → marketplace-app-shell-Dmo1S9av.js.map} +1 -1
- package/dist/_chunks/{patient-search-BJOmTmDA.js → patient-search-CArmRKeg.js} +3 -3
- package/dist/_chunks/{patient-search-BJOmTmDA.js.map → patient-search-CArmRKeg.js.map} +1 -1
- package/dist/_chunks/{patient-shell-DUmhXnFq.js → patient-shell-c2YixkQw.js} +4 -4
- package/dist/_chunks/{patient-shell-DUmhXnFq.js.map → patient-shell-c2YixkQw.js.map} +1 -1
- package/dist/_chunks/{payment-form-xmeCkxas.js → payment-form-DJ9vnzrT.js} +2 -2
- package/dist/_chunks/{payment-form-xmeCkxas.js.map → payment-form-DJ9vnzrT.js.map} +1 -1
- package/dist/_chunks/{pdf-viewer-q1D3Uion.js → pdf-viewer-4odMFuFW.js} +2 -2
- package/dist/_chunks/{pdf-viewer-q1D3Uion.js.map → pdf-viewer-4odMFuFW.js.map} +1 -1
- package/dist/_chunks/{practice-results-Cq1y8JFD.js → practice-results-CtfciF2v.js} +3 -3
- package/dist/_chunks/{practice-results-Cq1y8JFD.js.map → practice-results-CtfciF2v.js.map} +1 -1
- package/dist/_chunks/{pregnancy-dating-DT_244bG.js → pregnancy-dating-BA37LSkF.js} +15 -15
- package/dist/_chunks/{pregnancy-dating-DT_244bG.js.map → pregnancy-dating-BA37LSkF.js.map} +1 -1
- package/dist/_chunks/{recaptcha-widget-CFYyLSEX.js → recaptcha-widget-BCNHsgqt.js} +2 -2
- package/dist/_chunks/{recaptcha-widget-CFYyLSEX.js.map → recaptcha-widget-BCNHsgqt.js.map} +1 -1
- package/dist/_chunks/{sidebar-h78cTNLh.js → sidebar-DPEHzxLZ.js} +397 -346
- package/dist/_chunks/sidebar-DPEHzxLZ.js.map +1 -0
- package/dist/_chunks/{sign-document-CZkAf28g.js → sign-document-Bzld9jVM.js} +2 -2
- package/dist/_chunks/{sign-document-CZkAf28g.js.map → sign-document-Bzld9jVM.js.map} +1 -1
- package/dist/_chunks/{task-card-CPyQ5AXC.js → task-card-BwY9jaV1.js} +48 -42
- package/dist/_chunks/task-card-BwY9jaV1.js.map +1 -0
- package/dist/_chunks/task-tray-Cb_hK4yb.js +234 -0
- package/dist/_chunks/task-tray-Cb_hK4yb.js.map +1 -0
- package/dist/_chunks/{theme-toggle-ClATnY4Q.js → theme-toggle-DAW7uC0B.js} +3 -3
- package/dist/_chunks/{theme-toggle-ClATnY4Q.js.map → theme-toggle-DAW7uC0B.js.map} +1 -1
- package/dist/_chunks/use-edge-resize-ZnGG7gyO.js +139 -0
- package/dist/_chunks/use-edge-resize-ZnGG7gyO.js.map +1 -0
- package/dist/_chunks/use-theme-CAuo6EYT.js +159 -0
- package/dist/_chunks/use-theme-CAuo6EYT.js.map +1 -0
- package/dist/_chunks/{warning-stack-CXfoAT-_.js → warning-stack-Cv4fr5zo.js} +2 -2
- package/dist/_chunks/{warning-stack-CXfoAT-_.js.map → warning-stack-Cv4fr5zo.js.map} +1 -1
- package/dist/_chunks/{workflow-map-DzX_LI4y.js → workflow-map-BJDUNYlX.js} +3 -3
- package/dist/_chunks/{workflow-map-DzX_LI4y.js.map → workflow-map-BJDUNYlX.js.map} +1 -1
- package/dist/agent-catalog.json +1 -1
- package/dist/components/agenda-card/agenda-card.d.ts +19 -2
- package/dist/components/agenda-card/agenda-card.d.ts.map +1 -1
- package/dist/components/agenda-card/index.js +1 -1
- package/dist/components/agenda-tray/agenda-tray.d.ts +24 -1
- package/dist/components/agenda-tray/agenda-tray.d.ts.map +1 -1
- package/dist/components/agenda-tray/index.js +1 -1
- package/dist/components/ai-consent-banner/index.js +1 -1
- package/dist/components/ai-tools-rail/ai-tools-rail.d.ts +8 -0
- package/dist/components/ai-tools-rail/ai-tools-rail.d.ts.map +1 -1
- package/dist/components/ai-tools-rail/index.js +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/audio-recorder/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/button-group/button-group.d.ts +1 -1
- package/dist/components/checkbox-group/checkbox-group.d.ts +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/document-scanner/index.js +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +2 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts.map +1 -1
- package/dist/components/dropdown-menu/index.js +1 -1
- package/dist/components/form-field/form-field.d.ts +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/header-settings/index.js +1 -1
- package/dist/components/icon-button-group/icon-button-group.d.ts +15 -15
- package/dist/components/key-value-pair/key-value-pair.d.ts +1 -1
- package/dist/components/patient-search/index.js +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/pregnancy-dating/pregnancy-dating.d.ts.map +1 -1
- package/dist/components/radio-group/radio-group.d.ts +1 -1
- package/dist/components/recaptcha-widget/index.js +1 -1
- package/dist/components/separator/separator.d.ts +1 -1
- package/dist/components/sidebar/index.js +1 -1
- package/dist/components/sidebar/sidebar.d.ts +8 -0
- package/dist/components/sidebar/sidebar.d.ts.map +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/tabs/tabs.d.ts +2 -2
- package/dist/components/task-card/index.js +1 -1
- package/dist/components/task-card/task-card.d.ts +15 -1
- package/dist/components/task-card/task-card.d.ts.map +1 -1
- package/dist/components/task-tray/index.js +1 -1
- package/dist/components/task-tray/task-tray.d.ts +24 -1
- package/dist/components/task-tray/task-tray.d.ts.map +1 -1
- package/dist/components/theme-toggle/index.js +1 -1
- package/dist/components/warning-stack/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/components/workflow/workflow-map.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +12 -10
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/use-edge-resize.d.ts +78 -0
- package/dist/hooks/use-edge-resize.d.ts.map +1 -0
- package/dist/hooks/use-theme.d.ts.map +1 -1
- package/dist/i18n/locales/ar.d.ts +4 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +7 -3
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +4 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +7 -3
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +4 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +7 -3
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +4 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +7 -3
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +4 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +7 -3
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +4 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +7 -3
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +4 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +7 -3
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +4 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +7 -3
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +4 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +7 -3
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +4 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +7 -3
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +4 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +7 -3
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +4 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +7 -3
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +4 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +7 -3
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +4 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +7 -3
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +4 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +7 -3
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +4 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +7 -3
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +4 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +7 -3
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +4 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +7 -3
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +27 -27
- package/dist/locales/ar.json +7 -3
- package/dist/locales/de.json +7 -3
- package/dist/locales/el.json +7 -3
- package/dist/locales/en.json +7 -3
- package/dist/locales/es.json +7 -3
- package/dist/locales/fr.json +7 -3
- package/dist/locales/hi.json +7 -3
- package/dist/locales/it.json +7 -3
- package/dist/locales/ja.json +7 -3
- package/dist/locales/nl.json +7 -3
- package/dist/locales/pl.json +7 -3
- package/dist/locales/pt.json +7 -3
- package/dist/locales/ro.json +7 -3
- package/dist/locales/ru.json +7 -3
- package/dist/locales/sq.json +7 -3
- package/dist/locales/sv.json +7 -3
- package/dist/locales/tr.json +7 -3
- package/dist/locales/zh.json +7 -3
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/patient-shell/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/agenda-card-BaSfVfrL.js.map +0 -1
- package/dist/_chunks/agenda-tray-DQayYmQ0.js +0 -165
- package/dist/_chunks/agenda-tray-DQayYmQ0.js.map +0 -1
- package/dist/_chunks/ai-tools-rail-CYLWrRmm.js +0 -280
- package/dist/_chunks/ai-tools-rail-CYLWrRmm.js.map +0 -1
- package/dist/_chunks/alert-CUTxnym2.js.map +0 -1
- package/dist/_chunks/circle-arrow-up-CC_85SuH.js +0 -16
- package/dist/_chunks/circle-arrow-up-CC_85SuH.js.map +0 -1
- package/dist/_chunks/dropdown-menu-CUEXqKis.js +0 -299
- package/dist/_chunks/dropdown-menu-CUEXqKis.js.map +0 -1
- package/dist/_chunks/sidebar-h78cTNLh.js.map +0 -1
- package/dist/_chunks/task-card-CPyQ5AXC.js.map +0 -1
- package/dist/_chunks/task-tray-B8jFv5FV.js +0 -196
- package/dist/_chunks/task-tray-B8jFv5FV.js.map +0 -1
- package/dist/_chunks/use-theme-C2dHKUAN.js +0 -145
- package/dist/_chunks/use-theme-C2dHKUAN.js.map +0 -1
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { jsxs as z, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Q, useRef as v, useState as ee, useMemo as A, useCallback as B, useEffect as se, useImperativeHandle as ae } from "react";
|
|
3
|
+
import { c as m } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as ie } from "react-i18next";
|
|
5
|
+
import { I as ne } from "./icon-button-CKEOrN37.js";
|
|
6
|
+
import { S as te } from "./scroll-area-BWqCkEGz.js";
|
|
7
|
+
import { a as oe } from "./tooltip-DvmfrNvB.js";
|
|
8
|
+
import { u as re } from "./use-controllable-state-BiY4xTzM.js";
|
|
9
|
+
import { u as le } from "./use-edge-resize-ZnGG7gyO.js";
|
|
10
|
+
import { u as H } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
|
|
11
|
+
import { u as de } from "./registry-nPAVE19X.js";
|
|
12
|
+
const ce = {
|
|
13
|
+
id: "ai-tools-rail",
|
|
14
|
+
capabilities: ["open", "close", "select_single"],
|
|
15
|
+
state: {
|
|
16
|
+
activeToolId: {
|
|
17
|
+
type: "string | null",
|
|
18
|
+
descriptionKey: "ui.aiToolsRail.agent.state.activeToolId",
|
|
19
|
+
description: "Id of the tool whose panel is currently open, or null when the rail is collapsed to its strip. No panel content is ever exposed.",
|
|
20
|
+
read: (n) => n.getActiveToolId()
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
actions: {
|
|
24
|
+
open: {
|
|
25
|
+
safety: "read",
|
|
26
|
+
argsType: "{ id: string }",
|
|
27
|
+
descriptionKey: "ui.aiToolsRail.agent.actions.open",
|
|
28
|
+
description: "Open the given tool's panel.",
|
|
29
|
+
invoke: (n, s) => {
|
|
30
|
+
n.open(s.id);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
close: {
|
|
34
|
+
safety: "read",
|
|
35
|
+
descriptionKey: "ui.aiToolsRail.agent.actions.close",
|
|
36
|
+
description: "Collapse the rail to its strip (no active tool).",
|
|
37
|
+
invoke: (n) => {
|
|
38
|
+
n.close();
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
select_tool: {
|
|
42
|
+
safety: "read",
|
|
43
|
+
argsType: "{ id: string | null }",
|
|
44
|
+
descriptionKey: "ui.aiToolsRail.agent.actions.selectTool",
|
|
45
|
+
description: "Set the active tool by id (opens its panel), or pass null to collapse.",
|
|
46
|
+
invoke: (n, s) => {
|
|
47
|
+
n.setActiveTool(s.id);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
domHooks: {
|
|
52
|
+
root: {
|
|
53
|
+
attr: "data-component",
|
|
54
|
+
value: "ai-tools-rail",
|
|
55
|
+
description: "Marks the AiToolsRail wrapper."
|
|
56
|
+
},
|
|
57
|
+
instanceId: {
|
|
58
|
+
attr: "data-component-id",
|
|
59
|
+
sourceProp: "id",
|
|
60
|
+
description: "Sourced from the id prop. Required to address a specific rail from the agent."
|
|
61
|
+
},
|
|
62
|
+
item: {
|
|
63
|
+
attr: "data-tool-id",
|
|
64
|
+
description: "Stable tool id emitted on each strip IconButton. The active icon also carries data-active set to its id."
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, ue = "ds:[inline-size:3rem]", fe = "ds:[inline-size:var(--ai-tools-rail-panel-inline-size,22rem)]", F = "--ai-tools-rail-panel-inline-size", pe = 288, ve = 640, ge = 352, me = m(
|
|
68
|
+
["ds:flex ds:shrink-0 ds:h-full", "ds:bg-[var(--background)]"].join(" "),
|
|
69
|
+
{
|
|
70
|
+
variants: {
|
|
71
|
+
side: {
|
|
72
|
+
// Strip docks inline-end; the panel mounts inline-start of it
|
|
73
|
+
// (flex-row, panel rendered first). Shadow faces the main area.
|
|
74
|
+
end: "ds:flex-row ds:shadow-[var(--shadow-chrome-start)]",
|
|
75
|
+
// Strip docks inline-start; the panel mounts inline-end of it.
|
|
76
|
+
start: "ds:flex-row-reverse ds:shadow-[var(--shadow-chrome-end)]"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
defaultVariants: { side: "end" }
|
|
80
|
+
}
|
|
81
|
+
), be = m(
|
|
82
|
+
[
|
|
83
|
+
"ds:flex ds:shrink-0 ds:flex-col ds:items-center",
|
|
84
|
+
"ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]",
|
|
85
|
+
"ds:gap-[var(--spacing-xs)]",
|
|
86
|
+
ue
|
|
87
|
+
].join(" ")
|
|
88
|
+
), he = m(
|
|
89
|
+
[
|
|
90
|
+
"ds:relative ds:flex ds:min-h-0 ds:flex-col ds:h-full",
|
|
91
|
+
"ds:bg-[var(--background)]",
|
|
92
|
+
fe,
|
|
93
|
+
// Defensive: the panel doesn't animate its width today, but if a
|
|
94
|
+
// consumer adds a transition on the var, suppress it mid-drag.
|
|
95
|
+
"ds:data-[resizing]:transition-none"
|
|
96
|
+
].join(" ")
|
|
97
|
+
), ye = m(
|
|
98
|
+
[
|
|
99
|
+
"ds:absolute ds:[inset-block:0] ds:z-[1] ds:select-none ds:touch-none",
|
|
100
|
+
"ds:[inline-size:var(--resizable-handle-size)] ds:cursor-col-resize",
|
|
101
|
+
"ds:bg-[var(--border)]",
|
|
102
|
+
"ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
|
|
103
|
+
"ds:hover:bg-[var(--accent)] ds:data-[resizing]:bg-[var(--accent)]",
|
|
104
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
|
|
105
|
+
"ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
106
|
+
"ds:forced-colors:focus-visible:outline-[CanvasText]",
|
|
107
|
+
"ds:before:absolute ds:before:content-['']",
|
|
108
|
+
"ds:before:[block-size:100%]",
|
|
109
|
+
"ds:before:[inline-size:var(--min-target-size)]",
|
|
110
|
+
"ds:before:[inset-block:0]",
|
|
111
|
+
"ds:before:[inset-inline:calc(0px_-_(var(--min-target-size)_-_var(--resizable-handle-size))_/_2)]"
|
|
112
|
+
],
|
|
113
|
+
{
|
|
114
|
+
variants: {
|
|
115
|
+
edge: {
|
|
116
|
+
"inline-start": "ds:start-0",
|
|
117
|
+
"inline-end": "ds:end-0"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
defaultVariants: { edge: "inline-start" }
|
|
121
|
+
}
|
|
122
|
+
), xe = m(
|
|
123
|
+
[
|
|
124
|
+
"ds:absolute ds:-top-[var(--spacing-xs)] ds:-end-[var(--spacing-xs)]",
|
|
125
|
+
"ds:inline-flex ds:items-center ds:justify-center",
|
|
126
|
+
"ds:min-w-[calc(var(--spacing-md)+var(--spacing-xs))]",
|
|
127
|
+
"ds:h-[calc(var(--spacing-md)+var(--spacing-xs))]",
|
|
128
|
+
"ds:ps-[calc(var(--spacing-xs)/1.5)] ds:pe-[calc(var(--spacing-xs)/1.5)]",
|
|
129
|
+
"ds:rounded-[var(--radius-full)]",
|
|
130
|
+
"ds:bg-[color:var(--destructive)] ds:text-[color:var(--destructive-foreground)]",
|
|
131
|
+
"ds:text-[length:var(--font-size-xs)] ds:font-semibold ds:leading-none",
|
|
132
|
+
"ds:pointer-events-none ds:select-none",
|
|
133
|
+
"ds:forced-colors:outline ds:forced-colors:outline-1 ds:forced-colors:outline-[CanvasText]"
|
|
134
|
+
].join(" ")
|
|
135
|
+
);
|
|
136
|
+
function Re(n, s) {
|
|
137
|
+
return n > 99 ? s : String(n);
|
|
138
|
+
}
|
|
139
|
+
const Te = Q(
|
|
140
|
+
({
|
|
141
|
+
id: n,
|
|
142
|
+
tools: s,
|
|
143
|
+
activeToolId: M,
|
|
144
|
+
defaultActiveToolId: U = null,
|
|
145
|
+
onActiveToolChange: W,
|
|
146
|
+
side: x = "end",
|
|
147
|
+
railLabel: Z,
|
|
148
|
+
resizablePanel: b = !1,
|
|
149
|
+
className: O
|
|
150
|
+
}, q) => {
|
|
151
|
+
var P;
|
|
152
|
+
const { t: g } = ie(), [X, l] = re({
|
|
153
|
+
value: M,
|
|
154
|
+
defaultValue: U,
|
|
155
|
+
onChange: W
|
|
156
|
+
}), c = X ?? null, R = v([]), h = v(null), [T, k] = ee(0), f = v(!1), w = v(!1), u = A(
|
|
157
|
+
() => s.findIndex((e) => e.id === c),
|
|
158
|
+
[s, c]
|
|
159
|
+
), d = u >= 0 ? s[u] : null, Y = A(
|
|
160
|
+
() => s.findIndex((e) => !e.disabled),
|
|
161
|
+
[s]
|
|
162
|
+
), y = u >= 0 ? u : T >= 0 && !((P = s[T]) != null && P.disabled) ? T : Y, $ = B(
|
|
163
|
+
(e, a) => {
|
|
164
|
+
const i = s.find((r) => r.id === e);
|
|
165
|
+
!i || i.disabled || (f.current = a, l(c === e ? null : e));
|
|
166
|
+
},
|
|
167
|
+
[s, c, l]
|
|
168
|
+
), G = B(
|
|
169
|
+
(e) => {
|
|
170
|
+
var D, K, j;
|
|
171
|
+
const a = s.length;
|
|
172
|
+
if (a === 0) return;
|
|
173
|
+
let i = null;
|
|
174
|
+
if (e.key === "ArrowDown" ? i = (y + 1) % a : e.key === "ArrowUp" ? i = (y - 1 + a) % a : e.key === "Home" ? i = 0 : e.key === "End" && (i = a - 1), i === null) return;
|
|
175
|
+
const r = e.key === "ArrowUp" || e.key === "End";
|
|
176
|
+
let t = i, o = 0;
|
|
177
|
+
for (; o < a && ((D = s[t]) != null && D.disabled); )
|
|
178
|
+
t = r ? (t - 1 + a) % a : (t + 1) % a, o += 1;
|
|
179
|
+
(K = s[t]) != null && K.disabled || (e.preventDefault(), k(t), (j = R.current[t]) == null || j.focus());
|
|
180
|
+
},
|
|
181
|
+
[s, y]
|
|
182
|
+
), E = v(null);
|
|
183
|
+
se(() => {
|
|
184
|
+
const e = E.current;
|
|
185
|
+
if (!e) return;
|
|
186
|
+
const a = (i) => {
|
|
187
|
+
if (i.key !== "Escape" || u < 0) return;
|
|
188
|
+
i.preventDefault();
|
|
189
|
+
const r = u;
|
|
190
|
+
l(null), k(r), requestAnimationFrame(() => {
|
|
191
|
+
var t;
|
|
192
|
+
(t = R.current[r]) == null || t.focus();
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
return e.addEventListener("keydown", a), () => e.removeEventListener("keydown", a);
|
|
196
|
+
}, [u, l]), H(() => {
|
|
197
|
+
var e;
|
|
198
|
+
d && f.current && ((e = h.current) == null || e.focus()), f.current = !1;
|
|
199
|
+
}, [d]);
|
|
200
|
+
const _ = x === "end" ? "inline-start" : "inline-end", { separatorProps: N, isResizing: S, isResized: C } = le({
|
|
201
|
+
edge: _,
|
|
202
|
+
targetRef: h,
|
|
203
|
+
cssProperty: F,
|
|
204
|
+
minSize: pe,
|
|
205
|
+
maxSize: ve,
|
|
206
|
+
defaultSize: ge,
|
|
207
|
+
disabled: !b
|
|
208
|
+
}), L = N["aria-valuenow"];
|
|
209
|
+
H(() => {
|
|
210
|
+
var e;
|
|
211
|
+
!b || !C || !d || (e = h.current) == null || e.style.setProperty(
|
|
212
|
+
F,
|
|
213
|
+
`${L}px`
|
|
214
|
+
);
|
|
215
|
+
}, [d, b, C, L]);
|
|
216
|
+
const V = v(c);
|
|
217
|
+
V.current = c;
|
|
218
|
+
const I = A(
|
|
219
|
+
() => ({
|
|
220
|
+
getActiveToolId: () => V.current,
|
|
221
|
+
setActiveTool: (e) => {
|
|
222
|
+
f.current = !1, l(e);
|
|
223
|
+
},
|
|
224
|
+
open: (e) => {
|
|
225
|
+
const a = s.find((i) => i.id === e);
|
|
226
|
+
!a || a.disabled || (f.current = !1, l(e));
|
|
227
|
+
},
|
|
228
|
+
close: () => {
|
|
229
|
+
f.current = !1, l(null);
|
|
230
|
+
}
|
|
231
|
+
}),
|
|
232
|
+
[s, l]
|
|
233
|
+
);
|
|
234
|
+
ae(q, () => I, [I]), de(ce, I, n);
|
|
235
|
+
const J = g("aiToolsRail.badgeCountOverflow", {
|
|
236
|
+
defaultValue: "99+"
|
|
237
|
+
});
|
|
238
|
+
return /* @__PURE__ */ z(
|
|
239
|
+
"div",
|
|
240
|
+
{
|
|
241
|
+
ref: E,
|
|
242
|
+
"data-component": "ai-tools-rail",
|
|
243
|
+
"data-component-id": n,
|
|
244
|
+
"data-side": x,
|
|
245
|
+
className: [me({ side: x }), O].filter(Boolean).join(" "),
|
|
246
|
+
children: [
|
|
247
|
+
d ? /* @__PURE__ */ z(
|
|
248
|
+
"aside",
|
|
249
|
+
{
|
|
250
|
+
ref: h,
|
|
251
|
+
tabIndex: -1,
|
|
252
|
+
"aria-label": g("aiToolsRail.panelLabel", {
|
|
253
|
+
tool: d.label,
|
|
254
|
+
defaultValue: "{{tool}} panel"
|
|
255
|
+
}),
|
|
256
|
+
"data-ai-tools-rail-state": "expanded",
|
|
257
|
+
"data-active-tool": d.id,
|
|
258
|
+
"data-resizing": S ? "" : void 0,
|
|
259
|
+
className: [he(), "ds:focus-visible:outline-none"].join(
|
|
260
|
+
" "
|
|
261
|
+
),
|
|
262
|
+
children: [
|
|
263
|
+
/* @__PURE__ */ p(te, { orientation: "vertical", className: "ds:flex-1 ds:min-h-0", children: d.panel }),
|
|
264
|
+
b ? /* @__PURE__ */ p(
|
|
265
|
+
"div",
|
|
266
|
+
{
|
|
267
|
+
...N,
|
|
268
|
+
"aria-label": g("aiToolsRail.resizePanel", {
|
|
269
|
+
defaultValue: "Resize tool panel"
|
|
270
|
+
}),
|
|
271
|
+
"data-resizing": S ? "" : void 0,
|
|
272
|
+
className: ye({ edge: _ })
|
|
273
|
+
}
|
|
274
|
+
) : null
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
) : null,
|
|
278
|
+
/* @__PURE__ */ p(oe, { children: /* @__PURE__ */ p(
|
|
279
|
+
"div",
|
|
280
|
+
{
|
|
281
|
+
role: "toolbar",
|
|
282
|
+
"aria-orientation": "vertical",
|
|
283
|
+
"aria-label": Z ?? g("aiToolsRail.railLabel", { defaultValue: "AI tools" }),
|
|
284
|
+
className: be(),
|
|
285
|
+
onKeyDown: G,
|
|
286
|
+
children: s.map((e, a) => {
|
|
287
|
+
const i = e.id === c, r = typeof e.badgeCount == "number" && e.badgeCount > 0, t = r ? g("aiToolsRail.toolWithCount", {
|
|
288
|
+
tool: e.label,
|
|
289
|
+
count: e.badgeCount,
|
|
290
|
+
defaultValue: "{{tool}}, {{count}} updates"
|
|
291
|
+
}) : e.label;
|
|
292
|
+
return /* @__PURE__ */ z("div", { className: "ds:relative", children: [
|
|
293
|
+
/* @__PURE__ */ p(
|
|
294
|
+
ne,
|
|
295
|
+
{
|
|
296
|
+
ref: (o) => {
|
|
297
|
+
R.current[a] = o;
|
|
298
|
+
},
|
|
299
|
+
icon: e.icon,
|
|
300
|
+
tooltip: e.label,
|
|
301
|
+
"aria-label": t,
|
|
302
|
+
intent: "ghost",
|
|
303
|
+
size: "sm",
|
|
304
|
+
disabled: e.disabled,
|
|
305
|
+
"aria-pressed": i,
|
|
306
|
+
"aria-expanded": i,
|
|
307
|
+
"data-active": i ? e.id : void 0,
|
|
308
|
+
"data-tool-id": e.id,
|
|
309
|
+
tabIndex: a === y ? 0 : -1,
|
|
310
|
+
onFocus: () => {
|
|
311
|
+
e.disabled || k(a);
|
|
312
|
+
},
|
|
313
|
+
onClick: () => $(e.id, w.current),
|
|
314
|
+
onKeyDown: (o) => {
|
|
315
|
+
(o.key === "Enter" || o.key === " ") && (w.current = !0);
|
|
316
|
+
},
|
|
317
|
+
onKeyUp: (o) => {
|
|
318
|
+
(o.key === "Enter" || o.key === " ") && (w.current = !1);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
),
|
|
322
|
+
r ? /* @__PURE__ */ p("span", { "aria-hidden": "true", className: xe(), children: Re(
|
|
323
|
+
e.badgeCount,
|
|
324
|
+
J
|
|
325
|
+
) }) : null
|
|
326
|
+
] }, e.id);
|
|
327
|
+
})
|
|
328
|
+
}
|
|
329
|
+
) })
|
|
330
|
+
]
|
|
331
|
+
}
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
);
|
|
335
|
+
Te.displayName = "AiToolsRail";
|
|
336
|
+
export {
|
|
337
|
+
Te as A,
|
|
338
|
+
ce as a
|
|
339
|
+
};
|
|
340
|
+
//# sourceMappingURL=ai-tools-rail-7tC3GT4h.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-tools-rail-7tC3GT4h.js","sources":["../../src/components/ai-tools-rail/ai-tools-rail.agent.ts","../../src/components/ai-tools-rail/ai-tools-rail.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — AiToolsRail. */\n/* */\n/* Rail-level surface: open / close a tool's panel and read which tool */\n/* is active. State is strictly the active tool id — never any tool's */\n/* panel CONTENT (which may carry PHI). Tool ids + badge counts are */\n/* supplied by the host via props, not derived from panel bodies. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { AiToolsRailHandle } from './ai-tools-rail';\n\nexport const aiToolsRailAgent: AgentAdapter<AiToolsRailHandle> = {\n id: 'ai-tools-rail',\n capabilities: ['open', 'close', 'select_single'],\n state: {\n activeToolId: {\n type: 'string | null',\n descriptionKey: 'ui.aiToolsRail.agent.state.activeToolId',\n description:\n 'Id of the tool whose panel is currently open, or null when the rail is collapsed to its strip. No panel content is ever exposed.',\n read: (handle) => handle.getActiveToolId(),\n },\n },\n actions: {\n open: {\n safety: 'read',\n argsType: '{ id: string }',\n descriptionKey: 'ui.aiToolsRail.agent.actions.open',\n description: \"Open the given tool's panel.\",\n invoke: (handle, args: { id: string }) => {\n handle.open(args.id);\n },\n },\n close: {\n safety: 'read',\n descriptionKey: 'ui.aiToolsRail.agent.actions.close',\n description: 'Collapse the rail to its strip (no active tool).',\n invoke: (handle) => {\n handle.close();\n },\n },\n select_tool: {\n safety: 'read',\n argsType: '{ id: string | null }',\n descriptionKey: 'ui.aiToolsRail.agent.actions.selectTool',\n description:\n 'Set the active tool by id (opens its panel), or pass null to collapse.',\n invoke: (handle, args: { id: string | null }) => {\n handle.setActiveTool(args.id);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'ai-tools-rail',\n description: 'Marks the AiToolsRail wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific rail from the agent.',\n },\n item: {\n attr: 'data-tool-id',\n description:\n 'Stable tool id emitted on each strip IconButton. The active icon also carries data-active set to its id.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { IconButton } from '../button/icon-button';\nimport { ScrollArea } from '../scroll-area/scroll-area';\nimport { TooltipProvider } from '../tooltip/tooltip';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useEdgeResize } from '../../hooks/use-edge-resize';\nimport { useIsomorphicLayoutEffect } from '../../hooks/use-isomorphic-layout-effect';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { aiToolsRailAgent } from './ai-tools-rail.agent';\n\n/* ------------------------------------------------------------------ */\n/* Tokenised widths */\n/* */\n/* Fixed + tokenised so the rail stays constraint-compliant — no */\n/* prop-driven inline styles. Bare `[inline-size:…]` is NOT a */\n/* recognised utility under the `ds:` prefix; it must carry the */\n/* prefix or Tailwind emits no rule. Consumers needing a different */\n/* size wrap the rail and override via CSS. */\n/* ------------------------------------------------------------------ */\nconst RAIL_WIDTH = 'ds:[inline-size:3rem]';\n// Panel width rides a consumer-overridable custom property (set\n// `--ai-tools-rail-panel-inline-size` on the rail or a wrapper) so\n// content-heavy tools (e.g. an inbox feed) can widen their panel\n// without inline styles. Defaults to the 22rem tray-family width.\nconst PANEL_WIDTH =\n 'ds:[inline-size:var(--ai-tools-rail-panel-inline-size,22rem)]';\n// The custom property PANEL_WIDTH reads. The resize hook writes the\n// committed px width here (on the panel element, so it beats consumer\n// class overrides on the root) and removes it on reset.\nconst PANEL_SIZE_PROPERTY = '--ai-tools-rail-panel-inline-size';\n// Resize clamp + nominal default, px (352px = the 22rem token default).\nconst PANEL_MIN_SIZE = 288;\nconst PANEL_MAX_SIZE = 640;\nconst PANEL_DEFAULT_SIZE = 352;\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport interface AiToolsRailTool {\n /** Stable tool id — used in `data-active`, the imperative handle, and\n * to label the open panel region. */\n id: string;\n /** Accessible name for the strip icon + tooltip, and the open panel's\n * region label. Never rendered as visible body text. */\n label: string;\n /** lucide-react glyph (rendered `aria-hidden` inside the IconButton). */\n icon: ReactNode;\n /** Panel body for this tool. Rendered inline-start of the strip when\n * `side='end'` (mirrored for `'start'`). The consumer composes it. */\n panel: ReactNode;\n /** Optional unseen / notification count shown on the strip icon. */\n badgeCount?: number;\n /** When true the icon is non-interactive and skipped by roving focus. */\n disabled?: boolean;\n}\n\n/**\n * Curated imperative handle for AiToolsRail. Exposed as the forwardRef\n * target so a future agent / MCP UI bridge can drive the rail without\n * touching the DOM. See `ai-tools-rail.agent.ts`.\n *\n * State surfaced here is strictly identifiers + counts — never any\n * tool's panel content (which may carry PHI).\n */\nexport interface AiToolsRailHandle {\n /** Currently-active tool id, or null when collapsed to strip-only. */\n getActiveToolId: () => string | null;\n /** Activate a tool by id (opens its panel), or null to collapse. */\n setActiveTool: (id: string | null) => void;\n /** Activate a tool by id (opens its panel). */\n open: (id: string) => void;\n /** Collapse to strip-only (no active tool). */\n close: () => void;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA — `side` drives the dock edge + which shadow faces main content */\n/* ------------------------------------------------------------------ */\n\nconst railVariants = cva(\n ['ds:flex ds:shrink-0 ds:h-full', 'ds:bg-[var(--background)]'].join(' '),\n {\n variants: {\n side: {\n // Strip docks inline-end; the panel mounts inline-start of it\n // (flex-row, panel rendered first). Shadow faces the main area.\n end: 'ds:flex-row ds:shadow-[var(--shadow-chrome-start)]',\n // Strip docks inline-start; the panel mounts inline-end of it.\n start: 'ds:flex-row-reverse ds:shadow-[var(--shadow-chrome-end)]',\n },\n },\n defaultVariants: { side: 'end' },\n },\n);\n\nconst stripVariants = cva(\n [\n 'ds:flex ds:shrink-0 ds:flex-col ds:items-center',\n 'ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]',\n 'ds:gap-[var(--spacing-xs)]',\n RAIL_WIDTH,\n ].join(' '),\n);\n\nconst panelVariants = cva(\n [\n 'ds:relative ds:flex ds:min-h-0 ds:flex-col ds:h-full',\n 'ds:bg-[var(--background)]',\n PANEL_WIDTH,\n // Defensive: the panel doesn't animate its width today, but if a\n // consumer adds a transition on the var, suppress it mid-drag.\n 'ds:data-[resizing]:transition-none',\n ].join(' '),\n);\n\n// Resize handle on the panel's inner edge — mirrors Resizable's Handle\n// (hairline, ::before hit area to --min-target-size, hover/drag accent,\n// token focus ring) but absolutely positioned over the panel edge.\nconst panelResizeHandleVariants = cva(\n [\n 'ds:absolute ds:[inset-block:0] ds:z-[1] ds:select-none ds:touch-none',\n 'ds:[inline-size:var(--resizable-handle-size)] ds:cursor-col-resize',\n 'ds:bg-[var(--border)]',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:hover:bg-[var(--accent)] ds:data-[resizing]:bg-[var(--accent)]',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n \"ds:before:absolute ds:before:content-['']\",\n 'ds:before:[block-size:100%]',\n 'ds:before:[inline-size:var(--min-target-size)]',\n 'ds:before:[inset-block:0]',\n 'ds:before:[inset-inline:calc(0px_-_(var(--min-target-size)_-_var(--resizable-handle-size))_/_2)]',\n ],\n {\n variants: {\n edge: {\n 'inline-start': 'ds:start-0',\n 'inline-end': 'ds:end-0',\n },\n },\n defaultVariants: { edge: 'inline-start' },\n },\n);\n\n// Hand-rolled overlay count chip — mirrors the AliaSidebar / MessageTray\n// badge markup. A <Badge> would re-introduce its own landmark/role; the\n// strip icon already carries the count in its accessible name, so this\n// span is purely decorative (`aria-hidden`).\nconst badgeVariants = cva(\n [\n 'ds:absolute ds:-top-[var(--spacing-xs)] ds:-end-[var(--spacing-xs)]',\n 'ds:inline-flex ds:items-center ds:justify-center',\n 'ds:min-w-[calc(var(--spacing-md)+var(--spacing-xs))]',\n 'ds:h-[calc(var(--spacing-md)+var(--spacing-xs))]',\n 'ds:ps-[calc(var(--spacing-xs)/1.5)] ds:pe-[calc(var(--spacing-xs)/1.5)]',\n 'ds:rounded-[var(--radius-full)]',\n 'ds:bg-[color:var(--destructive)] ds:text-[color:var(--destructive-foreground)]',\n 'ds:text-[length:var(--font-size-xs)] ds:font-semibold ds:leading-none',\n 'ds:pointer-events-none ds:select-none',\n 'ds:forced-colors:outline ds:forced-colors:outline-1 ds:forced-colors:outline-[CanvasText]',\n ].join(' '),\n);\n\n/* ------------------------------------------------------------------ */\n/* Props */\n/* ------------------------------------------------------------------ */\n\nexport interface AiToolsRailProps extends VariantProps<typeof railVariants> {\n /** Stable instance id, surfaced on the root as `data-component-id`. */\n id?: string;\n /** The tools shown as icons on the strip. */\n tools: AiToolsRailTool[];\n /** Controlled active tool id (null = collapsed / strip-only). */\n activeToolId?: string | null;\n /** Uncontrolled initial active tool id (default null). */\n defaultActiveToolId?: string | null;\n /** Fires whenever the active tool changes (incl. → null on collapse). */\n onActiveToolChange?: (id: string | null) => void;\n /** Which edge the rail docks to. Default `'end'` (inline-end). */\n side?: 'start' | 'end';\n /** Accessible label for the toolbar strip. */\n railLabel?: string;\n /**\n * Opt-in resize affordance for the open tool panel. Renders a\n * `role=\"separator\"` drag handle on the panel's inner edge (the edge\n * facing the main content). The committed width is written to\n * `--ai-tools-rail-panel-inline-size` on the panel element (288–640px);\n * Enter / double-click resets to the token-driven default. Default `false`.\n */\n resizablePanel?: boolean;\n className?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction formatBadgeCount(count: number, overflowLabel: string): string {\n return count > 99 ? overflowLabel : String(count);\n}\n\n/* ------------------------------------------------------------------ */\n/* Root */\n/* ------------------------------------------------------------------ */\n\nexport const AiToolsRail = forwardRef<AiToolsRailHandle, AiToolsRailProps>(\n (\n {\n id,\n tools,\n activeToolId,\n defaultActiveToolId = null,\n onActiveToolChange,\n side = 'end',\n railLabel,\n resizablePanel = false,\n className,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n\n // Controlled / uncontrolled bridge — the same hook MessageTray uses.\n const [activeRaw, setActiveRaw] = useControllableState<string | null>({\n value: activeToolId,\n defaultValue: defaultActiveToolId,\n onChange: onActiveToolChange,\n });\n const activeId = activeRaw ?? null;\n\n // Roving-tabindex bookkeeping for the vertical toolbar strip.\n const buttonsRef = useRef<Array<HTMLButtonElement | null>>([]);\n const panelRef = useRef<HTMLElement | null>(null);\n const [focusIndex, setFocusIndex] = useState(0);\n // Distinguishes keyboard activation (auto-focus into the panel) from\n // pointer activation (focus stays on the icon — less jarring).\n const activatedByKeyboardRef = useRef(false);\n // Set on Enter/Space keydown, read by the click handler that follows,\n // cleared on keyup — so a subsequent mouse click never inherits it.\n const keyboardActivateRef = useRef(false);\n\n const activeIndex = useMemo(\n () => tools.findIndex((tl) => tl.id === activeId),\n [tools, activeId],\n );\n const activeTool = activeIndex >= 0 ? tools[activeIndex] : null;\n\n // First non-disabled index — the resting roving stop when none active.\n const firstEnabledIndex = useMemo(\n () => tools.findIndex((tl) => !tl.disabled),\n [tools],\n );\n\n // The roving tab stop: the active icon when a tool is open, else the\n // index the user last focused, else the first enabled icon.\n const rovingIndex =\n activeIndex >= 0\n ? activeIndex\n : focusIndex >= 0 && !tools[focusIndex]?.disabled\n ? focusIndex\n : firstEnabledIndex;\n\n const selectTool = useCallback(\n (toolId: string, fromKeyboard: boolean) => {\n const tool = tools.find((tl) => tl.id === toolId);\n if (!tool || tool.disabled) return;\n activatedByKeyboardRef.current = fromKeyboard;\n // Clicking / activating the active tool collapses to strip-only.\n setActiveRaw(activeId === toolId ? null : toolId);\n },\n [tools, activeId, setActiveRaw],\n );\n\n /* ---- Roving arrow-key navigation (vertical toolbar) ----------- */\n const handleStripKeyDown = useCallback(\n (event: ReactKeyboardEvent<HTMLDivElement>) => {\n const count = tools.length;\n if (count === 0) return;\n\n let next: number | null = null;\n if (event.key === 'ArrowDown') next = (rovingIndex + 1) % count;\n else if (event.key === 'ArrowUp')\n next = (rovingIndex - 1 + count) % count;\n else if (event.key === 'Home') next = 0;\n else if (event.key === 'End') next = count - 1;\n if (next === null) return;\n\n // Skip disabled icons in the travel direction.\n const goingBack = event.key === 'ArrowUp' || event.key === 'End';\n let candidate = next;\n let attempts = 0;\n while (attempts < count && tools[candidate]?.disabled) {\n candidate = goingBack\n ? (candidate - 1 + count) % count\n : (candidate + 1) % count;\n attempts += 1;\n }\n if (tools[candidate]?.disabled) return;\n\n event.preventDefault();\n setFocusIndex(candidate);\n buttonsRef.current[candidate]?.focus();\n },\n [tools, rovingIndex],\n );\n\n /* ---- Esc collapses + returns focus to the active tool's icon -- */\n // Attached imperatively via the root ref (not a JSX onKeyDown on the\n // static container) so the Escape shortcut works from anywhere inside the\n // open panel without an interaction handler on a non-interactive element.\n const rootRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n const node = rootRef.current;\n if (!node) return undefined;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return;\n if (activeIndex < 0) return;\n event.preventDefault();\n const returnIndex = activeIndex;\n setActiveRaw(null);\n setFocusIndex(returnIndex);\n // Defer until after the panel unmounts so focus lands cleanly.\n requestAnimationFrame(() => {\n buttonsRef.current[returnIndex]?.focus();\n });\n };\n node.addEventListener('keydown', onKeyDown);\n return () => node.removeEventListener('keydown', onKeyDown);\n }, [activeIndex, setActiveRaw]);\n\n /* ---- Move focus into the panel when opened by keyboard -------- */\n useIsomorphicLayoutEffect(() => {\n if (activeTool && activatedByKeyboardRef.current) {\n panelRef.current?.focus();\n }\n activatedByKeyboardRef.current = false;\n }, [activeTool]);\n\n /* ---- Opt-in panel resize (inner edge) -------------------------- */\n // The handle sits on the edge facing the main content: the panel's\n // inline-start edge for an end-docked rail, inline-end for start.\n const panelEdge = side === 'end' ? 'inline-start' : 'inline-end';\n const { separatorProps, isResizing, isResized } = useEdgeResize({\n edge: panelEdge,\n targetRef: panelRef,\n cssProperty: PANEL_SIZE_PROPERTY,\n minSize: PANEL_MIN_SIZE,\n maxSize: PANEL_MAX_SIZE,\n defaultSize: PANEL_DEFAULT_SIZE,\n disabled: !resizablePanel,\n });\n\n // The aside unmounts on collapse, dropping the hook's inline override.\n // Re-assert the committed width when a panel (re)mounts so a reopened\n // panel keeps the user's chosen size.\n const committedPanelWidth = separatorProps['aria-valuenow'];\n useIsomorphicLayoutEffect(() => {\n if (!resizablePanel || !isResized || !activeTool) return;\n panelRef.current?.style.setProperty(\n PANEL_SIZE_PROPERTY,\n `${committedPanelWidth}px`,\n );\n }, [activeTool, resizablePanel, isResized, committedPanelWidth]);\n\n /* ---- Curated imperative handle for agent integration ---------- */\n const activeIdRef = useRef<string | null>(activeId);\n activeIdRef.current = activeId;\n\n const handle = useMemo<AiToolsRailHandle>(\n () => ({\n getActiveToolId: () => activeIdRef.current,\n setActiveTool: (toolId) => {\n activatedByKeyboardRef.current = false;\n setActiveRaw(toolId);\n },\n open: (toolId) => {\n const tool = tools.find((tl) => tl.id === toolId);\n if (!tool || tool.disabled) return;\n activatedByKeyboardRef.current = false;\n setActiveRaw(toolId);\n },\n close: () => {\n activatedByKeyboardRef.current = false;\n setActiveRaw(null);\n },\n }),\n [tools, setActiveRaw],\n );\n\n useImperativeHandle(ref, () => handle, [handle]);\n useAgentRegistration(aiToolsRailAgent, handle, id);\n\n const overflowLabel = t('aiToolsRail.badgeCountOverflow', {\n defaultValue: '99+',\n });\n\n return (\n <div\n ref={rootRef}\n data-component=\"ai-tools-rail\"\n data-component-id={id}\n data-side={side}\n className={[railVariants({ side }), className]\n .filter(Boolean)\n .join(' ')}\n >\n {/* The OPEN panel is the single complementary landmark, named by\n the active tool. Rendered only while a tool is active so two\n unnamed regions never coexist. */}\n {activeTool ? (\n <aside\n ref={panelRef}\n tabIndex={-1}\n aria-label={t('aiToolsRail.panelLabel', {\n tool: activeTool.label,\n defaultValue: '{{tool}} panel',\n })}\n data-ai-tools-rail-state=\"expanded\"\n data-active-tool={activeTool.id}\n data-resizing={isResizing ? '' : undefined}\n className={[panelVariants(), 'ds:focus-visible:outline-none'].join(\n ' ',\n )}\n >\n <ScrollArea orientation=\"vertical\" className=\"ds:flex-1 ds:min-h-0\">\n {activeTool.panel}\n </ScrollArea>\n {/* Inside the aside (so it belongs to the complementary\n landmark) and outside the toolbar strip — the strip's\n roving handlers never see its key events, and Escape\n still bubbles to the root to collapse, as everywhere\n else in the panel. No stopPropagation needed. */}\n {resizablePanel ? (\n <div\n {...separatorProps}\n aria-label={t('aiToolsRail.resizePanel', {\n defaultValue: 'Resize tool panel',\n })}\n data-resizing={isResizing ? '' : undefined}\n className={panelResizeHandleVariants({ edge: panelEdge })}\n />\n ) : null}\n </aside>\n ) : null}\n\n {/* The 3rem icon strip — a vertical toolbar with roving tabindex.\n Self-contained TooltipProvider so consumers needn't mount one;\n Radix providers compose, so a host-level provider still works. */}\n <TooltipProvider>\n <div\n role=\"toolbar\"\n aria-orientation=\"vertical\"\n aria-label={\n railLabel ??\n t('aiToolsRail.railLabel', { defaultValue: 'AI tools' })\n }\n className={stripVariants()}\n onKeyDown={handleStripKeyDown}\n >\n {tools.map((tool, index) => {\n const isActive = tool.id === activeId;\n const showBadge =\n typeof tool.badgeCount === 'number' && tool.badgeCount > 0;\n // Fold the count into the accessible name so SR users hear it\n // without relying on the decorative chip.\n const accessibleName = showBadge\n ? t('aiToolsRail.toolWithCount', {\n tool: tool.label,\n count: tool.badgeCount,\n defaultValue: '{{tool}}, {{count}} updates',\n })\n : tool.label;\n return (\n <div key={tool.id} className=\"ds:relative\">\n <IconButton\n ref={(el) => {\n buttonsRef.current[index] = el;\n }}\n icon={tool.icon}\n tooltip={tool.label}\n aria-label={accessibleName}\n intent=\"ghost\"\n size=\"sm\"\n disabled={tool.disabled}\n aria-pressed={isActive}\n aria-expanded={isActive}\n data-active={isActive ? tool.id : undefined}\n data-tool-id={tool.id}\n tabIndex={index === rovingIndex ? 0 : -1}\n onFocus={() => {\n if (!tool.disabled) setFocusIndex(index);\n }}\n onClick={() =>\n selectTool(tool.id, keyboardActivateRef.current)\n }\n onKeyDown={(event) => {\n // Enter/Space activate via the native button's click,\n // which fires AFTER this keydown. Flag the upcoming\n // click as keyboard-driven so focus moves into the\n // panel; reset on keyup so a later mouse click doesn't\n // inherit the flag.\n if (event.key === 'Enter' || event.key === ' ') {\n keyboardActivateRef.current = true;\n }\n }}\n onKeyUp={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n keyboardActivateRef.current = false;\n }\n }}\n />\n {showBadge ? (\n <span aria-hidden=\"true\" className={badgeVariants()}>\n {formatBadgeCount(\n tool.badgeCount as number,\n overflowLabel,\n )}\n </span>\n ) : null}\n </div>\n );\n })}\n </div>\n </TooltipProvider>\n </div>\n );\n },\n);\n\nAiToolsRail.displayName = 'AiToolsRail';\n"],"names":["aiToolsRailAgent","handle","args","RAIL_WIDTH","PANEL_WIDTH","PANEL_SIZE_PROPERTY","PANEL_MIN_SIZE","PANEL_MAX_SIZE","PANEL_DEFAULT_SIZE","railVariants","cva","stripVariants","panelVariants","panelResizeHandleVariants","badgeVariants","formatBadgeCount","count","overflowLabel","AiToolsRail","forwardRef","id","tools","activeToolId","defaultActiveToolId","onActiveToolChange","side","railLabel","resizablePanel","className","ref","t","useTranslation","activeRaw","setActiveRaw","useControllableState","activeId","buttonsRef","useRef","panelRef","focusIndex","setFocusIndex","useState","activatedByKeyboardRef","keyboardActivateRef","activeIndex","useMemo","tl","activeTool","firstEnabledIndex","rovingIndex","_a","selectTool","useCallback","toolId","fromKeyboard","tool","handleStripKeyDown","event","next","goingBack","candidate","attempts","_b","_c","rootRef","useEffect","node","onKeyDown","returnIndex","useIsomorphicLayoutEffect","panelEdge","separatorProps","isResizing","isResized","useEdgeResize","committedPanelWidth","activeIdRef","useImperativeHandle","useAgentRegistration","jsxs","jsx","ScrollArea","TooltipProvider","index","isActive","showBadge","accessibleName","IconButton","el"],"mappings":";;;;;;;;;;;AAYO,MAAMA,KAAoD;AAAA,EAC/D,IAAI;AAAA,EACJ,cAAc,CAAC,QAAQ,SAAS,eAAe;AAAA,EAC/C,OAAO;AAAA,IACL,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,gBAAA;AAAA,IAAgB;AAAA,EAC3C;AAAA,EAEF,SAAS;AAAA,IACP,MAAM;AAAA,MACJ,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,QAAQ,CAACA,GAAQC,MAAyB;AACxC,QAAAD,EAAO,KAAKC,EAAK,EAAE;AAAA,MACrB;AAAA,IAAA;AAAA,IAEF,OAAO;AAAA,MACL,QAAQ;AAAA,MACR,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,QAAQ,CAACD,MAAW;AAClB,QAAAA,EAAO,MAAA;AAAA,MACT;AAAA,IAAA;AAAA,IAEF,aAAa;AAAA,MACX,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,QAAQ,CAACA,GAAQC,MAAgC;AAC/C,QAAAD,EAAO,cAAcC,EAAK,EAAE;AAAA,MAC9B;AAAA,IAAA;AAAA,EACF;AAAA,EAEF,UAAU;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,SAAS,MAAM;AACb,wBAAKM,EAAK,YAAUf,EAAc2C,CAAK;AAAA,sBACzC;AAAA,sBACA,SAAS,MACPhC,EAAWI,EAAK,IAAIZ,EAAoB,OAAO;AAAA,sBAEjD,WAAW,CAACc,MAAU;AAMpB,yBAAIA,EAAM,QAAQ,WAAWA,EAAM,QAAQ,SACzCd,EAAoB,UAAU;AAAA,sBAElC;AAAA,sBACA,SAAS,CAACc,MAAU;AAClB,yBAAIA,EAAM,QAAQ,WAAWA,EAAM,QAAQ,SACzCd,EAAoB,UAAU;AAAA,sBAElC;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAED0C,IACC,gBAAAL,EAAC,QAAA,EAAK,eAAY,QAAO,WAAWlE,MACjC,UAAAC;AAAA,oBACCwC,EAAK;AAAA,oBACLtC;AAAA,kBAAA,GAEJ,IACE;AAAA,gBAAA,EAAA,GA7CIsC,EAAK,EA8Cf;AAAA,cAEJ,CAAC;AAAA,YAAA;AAAA,UAAA,EACH,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEArC,GAAY,cAAc;"}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as a, useState as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { u as
|
|
6
|
-
import { X as
|
|
7
|
-
import {
|
|
8
|
-
import { C as
|
|
9
|
-
import { T as
|
|
10
|
-
import { C as
|
|
1
|
+
import { jsxs as V, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as a, useState as E, useRef as R, useCallback as z, Children as B, isValidElement as D } from "react";
|
|
3
|
+
import { c as L } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as F } from "react-i18next";
|
|
5
|
+
import { u as M } from "./use-controllable-state-BiY4xTzM.js";
|
|
6
|
+
import { X as U } from "./x-CCcI3eJp.js";
|
|
7
|
+
import { c as W } from "./createLucideIcon-CrFbzy84.js";
|
|
8
|
+
import { C as X } from "./circle-x-Du2CmjaU.js";
|
|
9
|
+
import { T as G } from "./triangle-alert-CBPUIzQo.js";
|
|
10
|
+
import { C as H } from "./circle-check-9AeSgJD_.js";
|
|
11
11
|
import { I as P } from "./info-B9XNKn05.js";
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @license lucide-react v1.8.0 - ISC
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the ISC license.
|
|
16
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/
|
|
18
|
+
const $ = [
|
|
19
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
20
|
+
["path", { d: "m16 12-4-4-4 4", key: "177agl" }],
|
|
21
|
+
["path", { d: "M12 16V8", key: "1sbj14" }]
|
|
22
|
+
], q = W("circle-arrow-up", $), J = L(
|
|
13
23
|
[
|
|
14
24
|
// Default `items-center` keeps the icon + dismiss optically aligned
|
|
15
25
|
// with a single-line description. The `data-[has-title=true]`
|
|
@@ -79,7 +89,7 @@ const $ = F(
|
|
|
79
89
|
variant: "info"
|
|
80
90
|
}
|
|
81
91
|
}
|
|
82
|
-
), h = "ds:shrink-0 ds:size-5",
|
|
92
|
+
), h = "ds:shrink-0 ds:size-5", K = `${h} ds:mt-0.5`, Q = [
|
|
83
93
|
// Default (no title): the alert root uses `items-center` and the
|
|
84
94
|
// button centres in the cross-axis. A centred 16×16 glyph inside a
|
|
85
95
|
// 44×44 button aligns optically with a single-line description.
|
|
@@ -103,26 +113,26 @@ const $ = F(
|
|
|
103
113
|
"ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
|
|
104
114
|
"ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
105
115
|
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
106
|
-
].join(" "),
|
|
116
|
+
].join(" "), Y = {
|
|
107
117
|
info: { icon: /* @__PURE__ */ t(P, { "aria-hidden": "true" }), role: "status", live: "polite" },
|
|
108
118
|
success: {
|
|
109
|
-
icon: /* @__PURE__ */ t(
|
|
119
|
+
icon: /* @__PURE__ */ t(H, { "aria-hidden": "true" }),
|
|
110
120
|
role: "status",
|
|
111
121
|
live: "polite"
|
|
112
122
|
},
|
|
113
123
|
warning: {
|
|
114
|
-
icon: /* @__PURE__ */ t(
|
|
124
|
+
icon: /* @__PURE__ */ t(G, { "aria-hidden": "true" }),
|
|
115
125
|
role: "alert",
|
|
116
126
|
live: "assertive"
|
|
117
127
|
},
|
|
118
128
|
error: {
|
|
119
|
-
icon: /* @__PURE__ */ t(
|
|
129
|
+
icon: /* @__PURE__ */ t(X, { "aria-hidden": "true" }),
|
|
120
130
|
role: "alert",
|
|
121
131
|
live: "assertive"
|
|
122
132
|
},
|
|
123
133
|
// Promotions never interrupt — same polite semantics as info.
|
|
124
134
|
promo: {
|
|
125
|
-
icon: /* @__PURE__ */ t(
|
|
135
|
+
icon: /* @__PURE__ */ t(q, { "aria-hidden": "true" }),
|
|
126
136
|
role: "status",
|
|
127
137
|
live: "polite"
|
|
128
138
|
}
|
|
@@ -137,7 +147,7 @@ const $ = F(
|
|
|
137
147
|
)
|
|
138
148
|
);
|
|
139
149
|
c.displayName = "Alert.Title";
|
|
140
|
-
const
|
|
150
|
+
const _ = a(({ className: e, ...o }, r) => /* @__PURE__ */ t(
|
|
141
151
|
"p",
|
|
142
152
|
{
|
|
143
153
|
ref: r,
|
|
@@ -148,8 +158,8 @@ const x = a(({ className: e, ...o }, r) => /* @__PURE__ */ t(
|
|
|
148
158
|
...o
|
|
149
159
|
}
|
|
150
160
|
));
|
|
151
|
-
|
|
152
|
-
const
|
|
161
|
+
_.displayName = "Alert.Description";
|
|
162
|
+
const x = a(
|
|
153
163
|
({ className: e, ...o }, r) => /* @__PURE__ */ t(
|
|
154
164
|
"div",
|
|
155
165
|
{
|
|
@@ -162,24 +172,24 @@ const _ = a(
|
|
|
162
172
|
}
|
|
163
173
|
)
|
|
164
174
|
);
|
|
165
|
-
|
|
166
|
-
const
|
|
175
|
+
x.displayName = "Alert.Action";
|
|
176
|
+
const w = a(
|
|
167
177
|
({
|
|
168
178
|
variant: e = "info",
|
|
169
179
|
dismissible: o = !1,
|
|
170
180
|
open: r,
|
|
171
181
|
onOpenChange: n,
|
|
172
182
|
icon: m,
|
|
173
|
-
live:
|
|
174
|
-
className:
|
|
183
|
+
live: y,
|
|
184
|
+
className: C,
|
|
175
185
|
children: u,
|
|
176
|
-
...
|
|
177
|
-
},
|
|
178
|
-
const { t: T } =
|
|
186
|
+
...A
|
|
187
|
+
}, N) => {
|
|
188
|
+
const { t: T } = F(), [j, k] = M({
|
|
179
189
|
value: r,
|
|
180
190
|
defaultValue: !0,
|
|
181
191
|
onChange: n
|
|
182
|
-
}), I = j ?? !0, [f, g] =
|
|
192
|
+
}), I = j ?? !0, [f, g] = E(!1), i = R(null), O = z(() => {
|
|
183
193
|
if (typeof window > "u") return 200;
|
|
184
194
|
const s = window.getComputedStyle(document.documentElement).getPropertyValue("--animation-duration");
|
|
185
195
|
if (!s) return 200;
|
|
@@ -187,24 +197,24 @@ const C = a(
|
|
|
187
197
|
return Number.isFinite(l) ? b.endsWith("ms") ? l : l * 1e3 : 200;
|
|
188
198
|
}, []);
|
|
189
199
|
if (!I) return null;
|
|
190
|
-
const d =
|
|
200
|
+
const d = Y[e], p = m !== void 0 ? m : d.icon, v = B.toArray(u).some(
|
|
191
201
|
(s) => D(s) && s.type === c
|
|
192
202
|
), S = () => {
|
|
193
203
|
f || (g(!0), i.current && clearTimeout(i.current), i.current = setTimeout(() => {
|
|
194
204
|
g(!1), k(!1);
|
|
195
205
|
}, O()));
|
|
196
206
|
};
|
|
197
|
-
return /* @__PURE__ */
|
|
207
|
+
return /* @__PURE__ */ V(
|
|
198
208
|
"div",
|
|
199
209
|
{
|
|
200
|
-
ref:
|
|
210
|
+
ref: N,
|
|
201
211
|
role: d.role,
|
|
202
|
-
"aria-live":
|
|
212
|
+
"aria-live": y ?? d.live,
|
|
203
213
|
"data-component": "alert",
|
|
204
|
-
"data-has-title":
|
|
214
|
+
"data-has-title": v ? "true" : "false",
|
|
205
215
|
"data-state": f ? "closing" : "open",
|
|
206
216
|
className: [
|
|
207
|
-
|
|
217
|
+
J({ variant: e, className: C }),
|
|
208
218
|
// Entry: fade + slide-down on mount. Exit: fade + slide-up + slight
|
|
209
219
|
// scale when dismissed. Driven by `tw-animate-css`. Respects
|
|
210
220
|
// `prefers-reduced-motion` via `motion-safe:` and zeroes under the
|
|
@@ -218,9 +228,9 @@ const C = a(
|
|
|
218
228
|
"ds:motion-safe:data-[state=closing]:fill-mode-forwards",
|
|
219
229
|
"ds:motion-safe:duration-[var(--animation-duration)]"
|
|
220
230
|
].join(" "),
|
|
221
|
-
...
|
|
231
|
+
...A,
|
|
222
232
|
children: [
|
|
223
|
-
|
|
233
|
+
p ? /* @__PURE__ */ t("span", { className: v ? K : h, children: p }) : null,
|
|
224
234
|
/* @__PURE__ */ t("div", { className: "ds:flex-1 ds:min-w-0", children: u }),
|
|
225
235
|
o ? /* @__PURE__ */ t(
|
|
226
236
|
"button",
|
|
@@ -229,8 +239,8 @@ const C = a(
|
|
|
229
239
|
"aria-label": T("common.close", "Close"),
|
|
230
240
|
onClick: S,
|
|
231
241
|
"data-alert-dismiss": "",
|
|
232
|
-
className:
|
|
233
|
-
children: /* @__PURE__ */ t(
|
|
242
|
+
className: Q,
|
|
243
|
+
children: /* @__PURE__ */ t(U, { "aria-hidden": "true", className: "ds:size-4" })
|
|
234
244
|
}
|
|
235
245
|
) : null
|
|
236
246
|
]
|
|
@@ -238,13 +248,13 @@ const C = a(
|
|
|
238
248
|
);
|
|
239
249
|
}
|
|
240
250
|
);
|
|
241
|
-
|
|
242
|
-
const
|
|
251
|
+
w.displayName = "Alert";
|
|
252
|
+
const ct = Object.assign(w, {
|
|
243
253
|
Title: c,
|
|
244
|
-
Description:
|
|
245
|
-
Action:
|
|
254
|
+
Description: _,
|
|
255
|
+
Action: x
|
|
246
256
|
});
|
|
247
257
|
export {
|
|
248
|
-
|
|
258
|
+
ct as A
|
|
249
259
|
};
|
|
250
|
-
//# sourceMappingURL=alert-
|
|
260
|
+
//# sourceMappingURL=alert-_mUKLmwA.js.map
|