@bfrs/agentic-components 0.8.6 → 0.8.8

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.
Files changed (32) hide show
  1. package/dist/components/data-display/DataTable/TableSaveView.d.ts +14 -1
  2. package/dist/components/data-display/DataTable/TableSaveView.js +164 -144
  3. package/dist/components/data-display/DataTable/TableSaveView.js.map +1 -1
  4. package/dist/components/data-display/DataTable/TableViewSelector.d.ts +15 -1
  5. package/dist/components/data-display/DataTable/TableViewSelector.js +304 -296
  6. package/dist/components/data-display/DataTable/TableViewSelector.js.map +1 -1
  7. package/dist/components/data-display/DataTable/index.d.ts +1 -0
  8. package/dist/components/data-display/DataTable/savedViewAnalytics.d.ts +109 -0
  9. package/dist/components/data-display/DataTable/savedViewAnalytics.js +140 -0
  10. package/dist/components/data-display/DataTable/savedViewAnalytics.js.map +1 -0
  11. package/dist/components/feedback/Toast/Toast.js +48 -48
  12. package/dist/components/feedback/Toast/Toast.js.map +1 -1
  13. package/dist/components/ui/feedback/warningVisual.d.ts +1 -0
  14. package/dist/components/ui/feedback/warningVisual.js +20 -16
  15. package/dist/components/ui/feedback/warningVisual.js.map +1 -1
  16. package/dist/components/ui/index.d.ts +2 -0
  17. package/dist/components/ui/providers/BfrsAnalyticsProvider/BfrsAnalyticsProvider.d.ts +18 -0
  18. package/dist/components/ui/providers/BfrsAnalyticsProvider/BfrsAnalyticsProvider.js +12 -0
  19. package/dist/components/ui/providers/BfrsAnalyticsProvider/BfrsAnalyticsProvider.js.map +1 -0
  20. package/dist/components/ui/providers/BfrsAnalyticsProvider/analyticsContext.d.ts +78 -0
  21. package/dist/components/ui/providers/BfrsAnalyticsProvider/analyticsContext.js +41 -0
  22. package/dist/components/ui/providers/BfrsAnalyticsProvider/analyticsContext.js.map +1 -0
  23. package/dist/components/ui/providers/BfrsAnalyticsProvider/index.d.ts +4 -0
  24. package/dist/components/ui/providers/BfrsProvider/BfrsProvider.d.ts +25 -0
  25. package/dist/components/ui/providers/BfrsProvider/BfrsProvider.js +42 -41
  26. package/dist/components/ui/providers/BfrsProvider/BfrsProvider.js.map +1 -1
  27. package/dist/custom-elements.js +9124 -8933
  28. package/dist/custom-elements.js.map +1 -1
  29. package/dist/index.js +224 -213
  30. package/dist/index.js.map +1 -1
  31. package/package.json +1 -1
  32. package/scripts/lint/cli.cjs +6 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"savedViewAnalytics.js","sources":["../../../../src/components/data-display/DataTable/savedViewAnalytics.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport {\n emitBfrsAnalytics,\n useBfrsAnalyticsSink,\n type BfrsAnalyticsSink\n} from \"@/components/ui/providers/BfrsAnalyticsProvider/analyticsContext\";\nimport { ViewApiError } from \"./saveViewApi\";\n\n/**\n * The saved-view cluster's instrumentation.\n *\n * One place decides which moment is which event, so the four apps that render\n * these components report the same shape instead of four hand-wired\n * approximations of it. The apps supply the registered ids; see\n * `BfrsAnalyticsProvider` for why the moments live here and the names do not.\n *\n * Deliberately NOT emitted:\n * - the selector popover opening and closing. It is a dropdown trigger, not a\n * surface with content worth a reach metric, and it would be the highest\n * volume event in the cluster for no answerable question.\n * - the primary view the selector restores on mount. It is not an action the\n * seller took, and it arrives through the same callback as a real pick —\n * which is exactly why consumers could not tell them apart.\n * - a submission blocked by an empty or reserved name. Both dialogs DISABLE\n * their submit button in those states, and a disabled default button also\n * takes implicit submission (Enter) out of play, so the submit handler's\n * guard is unreachable from the UI. `form_validation_failed` would be an\n * event no seller could fire. The reserved-name warning the dialog shows is\n * field-level feedback, which that event's own definition excludes.\n */\n\n/** Per-moment id overrides. Each defaults to a suffix on the base `id`. */\nexport type SavedViewAnalyticsIds = {\n /** The selector control. Default: `id`. */\n view?: string;\n /** The save dialog and its form. Default: `${id}_save`. */\n save?: string;\n /** The rename dialog and its form. Default: `${id}_rename`. */\n rename?: string;\n /** The delete confirmation. Default: `${id}_delete`. */\n remove?: string;\n /** \"Reset saved filters\". Default: `${id}_reset`. */\n reset?: string;\n /** \"Set as primary\". Default: `${id}_set_primary`. */\n setPrimary?: string;\n /** \"Unset primary\". Default: `${id}_unset_primary`. */\n unsetPrimary?: string;\n};\n\n/**\n * What a component accepts for `analytics`.\n *\n * The string form is the one to reach for: `analytics=\"finance_saved_view\"` is\n * the registered id, and every other id derives from it. The object form exists\n * for the cases that genuinely differ — an app keeping ids it already ships, a\n * funnel name that is not the control's id, or a per-instance sink.\n */\nexport type SavedViewAnalyticsInput = string | SavedViewAnalyticsConfig;\n\nexport type SavedViewAnalyticsConfig = {\n /**\n * Stable registered id for this saved-view control, e.g. `finance_saved_view`.\n * A code from the app's analytics vocabulary — never a label or a screen title.\n */\n id: string;\n /**\n * Registered funnel id for saving a view. Defaults to `id`, so the outcome\n * events work out of the box; pass `null` to turn them off when the app has\n * no funnel registered under that name.\n */\n flow?: string | null;\n /** Containing surface, sent as `parent_element`. */\n parentElement?: string;\n /** Where this instance sits, sent as `entry_point`. */\n entryPoint?: string;\n /** Id overrides for individual moments. */\n ids?: SavedViewAnalyticsIds;\n /** Sink override. Defaults to the nearest `BfrsProvider`/`BfrsAnalyticsProvider`. */\n emit?: BfrsAnalyticsSink;\n};\n\n/** How an overlay in this cluster was dismissed. */\nexport type SavedViewCloseMethod = \"close_icon\" | \"cancel\" | \"outside\" | \"esc\" | \"completed\";\n\nexport type SavedViewAnalytics = {\n /** A seller picked a saved view. Never the mount-time restore. */\n viewSelected: () => void;\n /** A seller picked the built-in, unsaved default view. */\n defaultViewSelected: () => void;\n setPrimary: () => void;\n unsetPrimary: () => void;\n renameOpened: () => void;\n renameDismissed: (closeMethod: SavedViewCloseMethod) => void;\n renameSubmitted: () => void;\n deleteOpened: () => void;\n deleteDismissed: (closeMethod: SavedViewCloseMethod) => void;\n deleteConfirmed: () => void;\n resetFilters: () => void;\n saveOpened: () => void;\n saveDismissed: (closeMethod: SavedViewCloseMethod) => void;\n /** The save request was dispatched. Intent — it asserts nothing about the result. */\n saveSubmitted: () => void;\n saveCompleted: () => void;\n /** The backend answered with an existing view instead of creating one. */\n saveRejectedAsDuplicate: () => void;\n saveFailed: (error: unknown) => void;\n};\n\n/**\n * Observed outcome of a failed save.\n *\n * Mirrors the platform's own classification: an answered refusal is `rejected`,\n * an answer we cannot read as a verdict (408 or 5xx) is `unknown` because the\n * view may well have been created server-side, and no readable response at all\n * is `network_error`. The distinction matters here specifically — a 504 that\n * created the view must not be counted as a confirmed failure.\n */\nfunction resultStateForError(error: unknown): \"rejected\" | \"unknown\" | \"network_error\" {\n const status = error instanceof ViewApiError ? error.status : undefined;\n\n if (status === undefined) return \"network_error\";\n if (status === 408 || status >= 500) return \"unknown\";\n if (status >= 400) return \"rejected\";\n return \"unknown\";\n}\n\nconst noop = () => {};\n\n/** An emitter that does nothing, for a component with no analytics config. */\nconst SILENT: SavedViewAnalytics = {\n viewSelected: noop,\n defaultViewSelected: noop,\n setPrimary: noop,\n unsetPrimary: noop,\n renameOpened: noop,\n renameDismissed: noop,\n renameSubmitted: noop,\n deleteOpened: noop,\n deleteDismissed: noop,\n deleteConfirmed: noop,\n resetFilters: noop,\n saveOpened: noop,\n saveDismissed: noop,\n saveSubmitted: noop,\n saveCompleted: noop,\n saveRejectedAsDuplicate: noop,\n saveFailed: noop\n};\n\n/** A code these components can use as an id: lower_snake_case, bounded. */\nconst DERIVABLE_SCREEN_NAME = /^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;\n\n/**\n * The id to report under when the app passed nothing.\n *\n * Adoption should be an `npm upgrade` and nothing else, so an app that passes\n * no `analytics` at all still reports — under an id derived from the\n * `screenName` these components already require for their store. `.` and `-`\n * become `_`, because a GA4 parameter value is a lower_snake_case code.\n *\n * screenName \"finance_invoices\" → finance_invoices_saved_view\n * screenName \"ndr_unsuccessful\" → ndr_unsuccessful_saved_view\n *\n * Two consequences worth knowing, both fixed by passing `analytics` explicitly:\n * - the id follows the screen, so a per-tab `screenName` produces a per-tab id.\n * An app that wants ONE id across its tabs passes one (`analytics=\"ndr_saved_view\"`).\n * - the derived id is not something anyone registered in the app's analytics\n * vocabulary. It reports from the moment of the upgrade; registering it (or\n * replacing it with a registered one) is the follow-up, not a blocker.\n */\nfunction deriveIdFromScreenName(screenName: string | undefined): string | undefined {\n if (!screenName) return undefined;\n const code = screenName.trim().toLowerCase();\n if (!DERIVABLE_SCREEN_NAME.test(code)) return undefined;\n const normalized = code.replace(/[.-]/g, \"_\");\n return `${normalized}_saved_view`.length <= 60 ? `${normalized}_saved_view` : undefined;\n}\n\n/**\n * `\"finance_saved_view\"` → `{ id: \"finance_saved_view\" }`, and nothing at all →\n * an id derived from `screenName` so an upgrade is the whole integration.\n */\nexport function toSavedViewAnalyticsConfig(\n input: SavedViewAnalyticsInput | undefined,\n screenName?: string\n): SavedViewAnalyticsConfig | undefined {\n if (typeof input === \"string\") return { id: input };\n if (input) return input.id ? input : { ...input, id: deriveIdFromScreenName(screenName) ?? \"\" };\n\n const derived = deriveIdFromScreenName(screenName);\n return derived ? { id: derived } : undefined;\n}\n\nexport function createSavedViewAnalytics(\n input: SavedViewAnalyticsInput | undefined,\n contextSink: BfrsAnalyticsSink | null,\n screenName?: string\n): SavedViewAnalytics {\n const config = toSavedViewAnalyticsConfig(input, screenName);\n const sink = config?.emit ?? contextSink;\n if (!config || !config.id || !sink) return SILENT;\n\n const { id, parentElement, entryPoint, ids } = config;\n // The funnel defaults to the control's own id, so the outcome events are not\n // something a caller has to remember to switch on. `flow: null` opts out.\n const flow = config.flow === null ? undefined : (config.flow ?? id);\n const viewId = ids?.view ?? id;\n const saveId = ids?.save ?? `${id}_save`;\n const renameId = ids?.rename ?? `${id}_rename`;\n const removeId = ids?.remove ?? `${id}_delete`;\n const resetId = ids?.reset ?? `${id}_reset`;\n const setPrimaryId = ids?.setPrimary ?? `${id}_set_primary`;\n const unsetPrimaryId = ids?.unsetPrimary ?? `${id}_unset_primary`;\n\n const cta = (elementName: string, ctaAction?: string) =>\n emitBfrsAnalytics(sink, \"cta_clicked\", {\n element_name: elementName,\n element_type: \"cta\",\n cta_action: ctaAction,\n parent_element: parentElement ?? viewId,\n entry_point: entryPoint\n });\n\n const overlayShown = (elementName: string) =>\n emitBfrsAnalytics(sink, \"modal_displayed\", {\n element_name: elementName,\n element_type: \"modal\",\n parent_element: parentElement ?? viewId,\n entry_point: entryPoint\n });\n\n const overlayDismissed = (elementName: string, closeMethod: SavedViewCloseMethod) =>\n emitBfrsAnalytics(sink, \"modal_dismissed\", {\n element_name: elementName,\n element_type: \"modal\",\n close_method: closeMethod\n });\n\n const formSubmitted = (elementName: string) =>\n emitBfrsAnalytics(sink, \"form_submitted\", {\n element_name: elementName,\n element_type: \"form\",\n parent_element: parentElement ?? viewId\n });\n\n const picked = (selectedOption: string) =>\n emitBfrsAnalytics(sink, \"dropdown_option_selected\", {\n element_name: viewId,\n element_type: \"dropdown\",\n selected_option: selectedOption,\n parent_element: parentElement,\n entry_point: entryPoint\n });\n\n return {\n // `selected_option` is which KIND of view was applied, never its name: a\n // saved view's name is the seller's own words.\n viewSelected: () => picked(\"saved_view\"),\n defaultViewSelected: () => picked(\"default_view\"),\n setPrimary: () => cta(setPrimaryId, \"set_primary\"),\n unsetPrimary: () => cta(unsetPrimaryId, \"unset_primary\"),\n renameOpened: () => overlayShown(renameId),\n renameDismissed: (closeMethod) => overlayDismissed(renameId, closeMethod),\n renameSubmitted: () => formSubmitted(renameId),\n deleteOpened: () => overlayShown(removeId),\n deleteDismissed: (closeMethod) => overlayDismissed(removeId, closeMethod),\n deleteConfirmed: () => cta(removeId, \"delete\"),\n resetFilters: () => cta(resetId, \"reset\"),\n saveOpened: () => overlayShown(saveId),\n saveDismissed: (closeMethod) => overlayDismissed(saveId, closeMethod),\n saveSubmitted: () => formSubmitted(saveId),\n saveCompleted: () => {\n if (!flow) return;\n emitBfrsAnalytics(sink, \"workflow_completed\", { flow_name: flow, result_state: \"success\" });\n },\n // A backend \"soft duplicate\" echoes back a pre-existing view instead of\n // creating one. It is an answered refusal, not a save — counting it as a\n // success would overstate the funnel it completes.\n saveRejectedAsDuplicate: () => {\n if (!flow) return;\n emitBfrsAnalytics(sink, \"workflow_failed\", {\n flow_name: flow,\n result_state: \"rejected\",\n error_code: \"duplicate_name\"\n });\n },\n saveFailed: (error) => {\n if (!flow) return;\n emitBfrsAnalytics(sink, \"workflow_failed\", {\n flow_name: flow,\n result_state: resultStateForError(error)\n });\n }\n };\n}\n\n/**\n * The saved-view emitter for one component instance.\n *\n * `screenName` is the component's own prop. Passing it here is what makes the\n * zero-config case work: with no `analytics` prop and a host bridge installed,\n * the id is derived from it.\n */\nexport function useSavedViewAnalytics(\n input: SavedViewAnalyticsInput | undefined,\n screenName?: string\n): SavedViewAnalytics {\n const contextSink = useBfrsAnalyticsSink();\n const config = toSavedViewAnalyticsConfig(input, screenName);\n\n return useMemo(\n () => createSavedViewAnalytics(config, contextSink),\n // The config is an inline object at every call site, so depend on its\n // fields rather than its identity: a new object each render would otherwise\n // rebuild the emitter on every keystroke in the name field.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n contextSink,\n screenName,\n config?.emit,\n config?.id,\n config?.flow,\n config?.parentElement,\n config?.entryPoint,\n config?.ids?.view,\n config?.ids?.save,\n config?.ids?.rename,\n config?.ids?.remove,\n config?.ids?.reset,\n config?.ids?.setPrimary,\n config?.ids?.unsetPrimary\n ]\n );\n}\n"],"names":["resultStateForError","error","status","ViewApiError","noop","SILENT","DERIVABLE_SCREEN_NAME","deriveIdFromScreenName","screenName","code","normalized","toSavedViewAnalyticsConfig","input","derived","createSavedViewAnalytics","contextSink","config","sink","id","parentElement","entryPoint","ids","flow","viewId","saveId","renameId","removeId","resetId","setPrimaryId","unsetPrimaryId","cta","elementName","ctaAction","emitBfrsAnalytics","overlayShown","overlayDismissed","closeMethod","formSubmitted","picked","selectedOption","useSavedViewAnalytics","useBfrsAnalyticsSink","useMemo","_a","_b","_c","_d","_e","_f","_g"],"mappings":";;;AAqHA,SAASA,EAAoBC,GAA0D;AACrF,QA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zB,IAASL,EAA2BC,GAAOJ,CAAU;AAE3D,SAAOkC;AAAA,IACL,MAAM5B,EAAyBE,GAAQD,CAAW;AAAA;AAAA;AAAA;AAAA;AAAA,IAKlD;AAAA,MACEA;AAAA,MACAP;AAAA,MACAQ,KAAA,gBAAAA,EAAQ;AAAA,MACRA,KAAA,gBAAAA,EAAQ;AAAA,MACRA,KAAA,gBAAAA,EAAQ;AAAA,MACRA,KAAA,gBAAAA,EAAQ;AAAA,MACRA,KAAA,gBAAAA,EAAQ;AAAA,OACR2B,IAAA3B,KAAA,gBAAAA,EAAQ,QAAR,gBAAA2B,EAAa;AAAA,OACbC,IAAA5B,KAAA,gBAAAA,EAAQ,QAAR,gBAAA4B,EAAa;AAAA,OACbC,IAAA7B,KAAA,gBAAAA,EAAQ,QAAR,gBAAA6B,EAAa;AAAA,OACbC,IAAA9B,KAAA,gBAAAA,EAAQ,QAAR,gBAAA8B,EAAa;AAAA,OACbC,IAAA/B,KAAA,gBAAAA,EAAQ,QAAR,gBAAA+B,EAAa;AAAA,OACbC,IAAAhC,KAAA,gBAAAA,EAAQ,QAAR,gBAAAgC,EAAa;AAAA,OACbC,IAAAjC,KAAA,gBAAAA,EAAQ,QAAR,gBAAAiC,EAAa;AAAA,IAAA;AAAA,EACf;AAEJ;"}
@@ -1,13 +1,13 @@
1
1
  import { jsx as r, jsxs as w } from "react/jsx-runtime";
2
- import { X as B } from "../../../node_modules/@phosphor-icons/react/dist/csr/X.es.js";
3
- import { useState as F, useRef as L, useCallback as s, useMemo as j, useEffect as D } from "react";
4
- import { createPortal as H } from "react-dom";
2
+ import { X as W } from "../../../node_modules/@phosphor-icons/react/dist/csr/X.es.js";
3
+ import { useState as B, useRef as F, useCallback as s, useMemo as L, useEffect as j } from "react";
4
+ import { createPortal as D } from "react-dom";
5
5
  import i from "@emotion/styled";
6
- import { twTransform as I, kfContentIn as $, twRing as E } from "../../../lib/emotionTw.js";
7
- import { warningSurfaceStyle as C, WarningAlertIcon as N } from "../../ui/feedback/warningVisual.js";
8
- import { ToastContext as M } from "./Toast.context.js";
9
- import { BfrsPortalScope as O } from "../../ui/providers/BfrsProvider/BfrsProvider.js";
10
- const G = {
6
+ import { twTransform as I, kfContentIn as H, twRing as $ } from "../../../lib/emotionTw.js";
7
+ import { warningToastSurfaceStyle as E, warningSurfaceStyle as N, WarningAlertIcon as M } from "../../ui/feedback/warningVisual.js";
8
+ import { ToastContext as O } from "./Toast.context.js";
9
+ import { BfrsPortalScope as G } from "../../ui/providers/BfrsProvider/BfrsProvider.js";
10
+ const V = {
11
11
  "top-left": { left: "1rem", top: "1rem", alignItems: "flex-start" },
12
12
  "top-center": { left: "50%", top: "1rem", ...I({ "--tw-translate-x": "-50%" }), alignItems: "center" },
13
13
  "top-right": { right: "1rem", top: "1rem", alignItems: "flex-end" },
@@ -17,7 +17,7 @@ const G = {
17
17
  }, p = (t) => ({
18
18
  "--tw-border-opacity": "1",
19
19
  borderLeftColor: `hsl(var(--bfrs-color-${t}) / var(--tw-border-opacity, 1))`
20
- }), V = {
20
+ }), X = {
21
21
  neutral: p("primary"),
22
22
  success: p("success"),
23
23
  warning: {},
@@ -26,7 +26,7 @@ const G = {
26
26
  }, u = (t) => ({
27
27
  "--tw-bg-opacity": "1",
28
28
  backgroundColor: `hsl(var(--bfrs-color-${t}) / var(--tw-bg-opacity, 1))`
29
- }), X = {
29
+ }), q = {
30
30
  neutral: u("primary"),
31
31
  success: u("success"),
32
32
  warning: {},
@@ -52,8 +52,8 @@ const G = {
52
52
  "--tw-text-opacity": "1",
53
53
  color: "rgb(255 255 255 / var(--tw-text-opacity, 1))"
54
54
  },
55
- !t.plain && X[t.tone]
56
- ]), q = /* @__PURE__ */ i("div", {
55
+ !t.plain && q[t.tone]
56
+ ]), J = /* @__PURE__ */ i("div", {
57
57
  label: "AgenticToast-item",
58
58
  shouldForwardProp: (t) => t !== "ownerState"
59
59
  })(({ ownerState: t }) => [
@@ -85,16 +85,16 @@ const G = {
85
85
  boxShadow: "var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)",
86
86
  outline: "2px solid transparent",
87
87
  outlineOffset: "2px",
88
- ...$,
88
+ ...H,
89
89
  animation: "bfrs-bfrs-content-in var(--bfrs-motion-normal) var(--bfrs-ease-out)"
90
90
  },
91
- V[t.tone]
92
- ]), J = /* @__PURE__ */ i("div", {
91
+ X[t.tone]
92
+ ]), K = /* @__PURE__ */ i("div", {
93
93
  label: "AgenticToast-content"
94
94
  })({
95
95
  minWidth: "0px",
96
96
  flex: "1 1 0%"
97
- }), K = /* @__PURE__ */ i("div", {
97
+ }), Q = /* @__PURE__ */ i("div", {
98
98
  label: "AgenticToast-title"
99
99
  })({
100
100
  fontSize: "13px",
@@ -102,7 +102,7 @@ const G = {
102
102
  lineHeight: "1.25rem",
103
103
  "--tw-text-opacity": "1",
104
104
  color: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))"
105
- }), Q = /* @__PURE__ */ i("div", {
105
+ }), U = /* @__PURE__ */ i("div", {
106
106
  label: "AgenticToast-description"
107
107
  })({
108
108
  marginTop: ".125rem",
@@ -110,12 +110,12 @@ const G = {
110
110
  lineHeight: "1.25rem",
111
111
  "--tw-text-opacity": "1",
112
112
  color: "hsl(var(--bfrs-color-text-secondary) / var(--tw-text-opacity, 1))"
113
- }), U = /* @__PURE__ */ i("div", {
113
+ }), Y = /* @__PURE__ */ i("div", {
114
114
  label: "AgenticToast-action"
115
115
  })({
116
116
  marginLeft: ".25rem",
117
117
  flexShrink: 0
118
- }), Y = /* @__PURE__ */ i("button", {
118
+ }), Z = /* @__PURE__ */ i("button", {
119
119
  label: "AgenticToast-dismissButton"
120
120
  })({
121
121
  marginRight: "-.25rem",
@@ -139,8 +139,8 @@ const G = {
139
139
  "--tw-text-opacity": "1",
140
140
  color: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))"
141
141
  },
142
- "&:focus-visible": E("2px", "hsl(var(--bfrs-color-border-focus) / .5)")
143
- }), Z = /* @__PURE__ */ i("div", {
142
+ "&:focus-visible": $("2px", "hsl(var(--bfrs-color-border-focus) / .5)")
143
+ }), _ = /* @__PURE__ */ i("div", {
144
144
  label: "AgenticToast-stack",
145
145
  shouldForwardProp: (t) => t !== "ownerState"
146
146
  })(({ ownerState: t }) => [
@@ -154,15 +154,15 @@ const G = {
154
154
  flexDirection: "column",
155
155
  gap: ".625rem"
156
156
  },
157
- G[t.placement]
158
- ]), _ = {
157
+ V[t.placement]
158
+ ]), tt = {
159
159
  neutral: "i",
160
160
  success: "✓",
161
161
  warning: "",
162
162
  danger: "!",
163
163
  info: "i"
164
164
  };
165
- function tt(t, e) {
165
+ function et(t, e) {
166
166
  return typeof t == "string" ? {
167
167
  title: t,
168
168
  tone: "neutral",
@@ -178,69 +178,69 @@ function tt(t, e) {
178
178
  function b(t, e) {
179
179
  return typeof e == "string" ? { title: e, tone: t } : { ...e, tone: t };
180
180
  }
181
- function et({ tone: t }) {
182
- return t === "warning" ? /* @__PURE__ */ r(k, { ownerState: { tone: t, plain: !0 }, style: C, "aria-hidden": "true", children: /* @__PURE__ */ r(N, {}) }) : /* @__PURE__ */ r(k, { ownerState: { tone: t }, "aria-hidden": "true", children: _[t] });
181
+ function rt({ tone: t }) {
182
+ return t === "warning" ? /* @__PURE__ */ r(k, { ownerState: { tone: t, plain: !0 }, style: N, "aria-hidden": "true", children: /* @__PURE__ */ r(M, {}) }) : /* @__PURE__ */ r(k, { ownerState: { tone: t }, "aria-hidden": "true", children: tt[t] });
183
183
  }
184
- function rt({ toast: t, onDismiss: e }) {
185
- D(() => {
184
+ function ot({ toast: t, onDismiss: e }) {
185
+ j(() => {
186
186
  if (t.duration <= 0 || !Number.isFinite(t.duration)) return;
187
187
  const c = window.setTimeout(() => e(t.id), t.duration);
188
188
  return () => window.clearTimeout(c);
189
189
  }, [e, t.duration, t.id]);
190
190
  const a = t.tone === "danger" ? "alert" : "status";
191
191
  return /* @__PURE__ */ w(
192
- q,
192
+ J,
193
193
  {
194
194
  role: a,
195
195
  "aria-live": a === "alert" ? "assertive" : "polite",
196
196
  ownerState: { tone: t.tone },
197
197
  className: t.className,
198
- style: t.tone === "warning" ? C : void 0,
198
+ style: t.tone === "warning" ? E : void 0,
199
199
  children: [
200
- t.icon ?? /* @__PURE__ */ r(et, { tone: t.tone }),
201
- /* @__PURE__ */ w(J, { children: [
202
- /* @__PURE__ */ r(K, { children: t.title }),
203
- t.description && /* @__PURE__ */ r(Q, { children: t.description })
200
+ t.icon ?? /* @__PURE__ */ r(rt, { tone: t.tone }),
201
+ /* @__PURE__ */ w(K, { children: [
202
+ /* @__PURE__ */ r(Q, { children: t.title }),
203
+ t.description && /* @__PURE__ */ r(U, { children: t.description })
204
204
  ] }),
205
- t.action && /* @__PURE__ */ r(U, { children: t.action }),
206
- t.dismissible && /* @__PURE__ */ r(Y, { type: "button", onClick: () => e(t.id), "aria-label": "Dismiss notification", children: /* @__PURE__ */ r(B, { size: 13, weight: "bold" }) })
205
+ t.action && /* @__PURE__ */ r(Y, { children: t.action }),
206
+ t.dismissible && /* @__PURE__ */ r(Z, { type: "button", onClick: () => e(t.id), "aria-label": "Dismiss notification", children: /* @__PURE__ */ r(W, { size: 13, weight: "bold" }) })
207
207
  ]
208
208
  }
209
209
  );
210
210
  }
211
- function ot({ toasts: t, onDismiss: e, placement: a = "bottom-center", className: c }) {
211
+ function nt({ toasts: t, onDismiss: e, placement: a = "bottom-center", className: c }) {
212
212
  if (t.length === 0) return null;
213
213
  const f = (
214
214
  // Portaled to <body> so the fixed, z-[9999] stack escapes any ancestor
215
215
  // stacking context (a transformed/opacity/filtered parent would otherwise
216
216
  // trap it and let page content paint over the toasts). BfrsPortalScope
217
217
  // re-applies the .bfrs token scope at the portal root.
218
- /* @__PURE__ */ r(O, { children: /* @__PURE__ */ r(Z, { ownerState: { placement: a }, className: c, children: t.map((l) => /* @__PURE__ */ r(rt, { toast: l, onDismiss: e }, l.id)) }) })
218
+ /* @__PURE__ */ r(G, { children: /* @__PURE__ */ r(_, { ownerState: { placement: a }, className: c, children: t.map((l) => /* @__PURE__ */ r(ot, { toast: l, onDismiss: e }, l.id)) }) })
219
219
  );
220
- return typeof document > "u" ? f : H(f, document.body);
220
+ return typeof document > "u" ? f : D(f, document.body);
221
221
  }
222
- function pt({ children: t, placement: e = "bottom-center", maxToasts: a = 4, defaultDuration: c = 2600, className: f }) {
223
- const [l, g] = F([]), A = L(0), h = s((o) => {
222
+ function ut({ children: t, placement: e = "bottom-center", maxToasts: a = 4, defaultDuration: c = 2600, className: f }) {
223
+ const [l, g] = B([]), C = F(0), h = s((o) => {
224
224
  g((m) => m.filter((d) => d.id !== o));
225
225
  }, []), x = s(() => {
226
226
  g([]);
227
227
  }, []), n = s(
228
228
  (o) => {
229
- const m = tt(o, c), d = m.id ?? `toast-${Date.now()}-${A.current++}`, P = { ...m, id: d };
230
- return g((R) => [...R.filter((W) => W.id !== d), P].slice(-a)), d;
229
+ const m = et(o, c), d = m.id ?? `toast-${Date.now()}-${C.current++}`, z = { ...m, id: d };
230
+ return g((P) => [...P.filter((R) => R.id !== d), z].slice(-a)), d;
231
231
  },
232
232
  [c, a]
233
- ), v = s((o) => n(b("success", o)), [n]), y = s((o) => n(b("warning", o)), [n]), T = s((o) => n(b("danger", o)), [n]), S = s((o) => n(b("info", o)), [n]), z = j(
233
+ ), v = s((o) => n(b("success", o)), [n]), y = s((o) => n(b("warning", o)), [n]), T = s((o) => n(b("danger", o)), [n]), S = s((o) => n(b("info", o)), [n]), A = L(
234
234
  () => ({ toasts: l, toast: n, success: v, warning: y, danger: T, info: S, dismiss: h, clear: x }),
235
235
  [x, T, h, S, v, n, l, y]
236
236
  );
237
- return /* @__PURE__ */ w(M.Provider, { value: z, children: [
237
+ return /* @__PURE__ */ w(O.Provider, { value: A, children: [
238
238
  t,
239
- /* @__PURE__ */ r(ot, { toasts: l, onDismiss: h, placement: e, className: f })
239
+ /* @__PURE__ */ r(nt, { toasts: l, onDismiss: h, placement: e, className: f })
240
240
  ] });
241
241
  }
242
242
  export {
243
- ot as ToastManager,
244
- pt as ToastProvider
243
+ nt as ToastManager,
244
+ ut as ToastProvider
245
245
  };
246
246
  //# sourceMappingURL=Toast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.js","sources":["../../../../src/components/feedback/Toast/Toast.tsx"],"sourcesContent":["import { X } from \"@phosphor-icons/react\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport styled from \"@emotion/styled\";\nimport type { CSSObject } from \"@emotion/react\";\nimport { kfContentIn, twRing, twTransform } from \"@/lib/emotionTw\";\nimport { BfrsPortalScope } from \"@/components/ui/providers/BfrsProvider\";\nimport { WarningAlertIcon, warningSurfaceStyle } from \"@/components/ui/feedback/warningVisual\";\nimport { ToastContext } from \"./Toast.context\";\nimport type { ToastContextValue, ToastInput, ToastManagerProps, ToastPlacement, ToastProviderProps, ToastRecord, ToastTone } from \"./Toast.types\";\n\n/* Exact compiled output of the pre-migration Tailwind utilities. */\n\nconst toastPlacementStyles: Record<ToastPlacement, CSSObject> = {\n \"top-left\": { left: \"1rem\", top: \"1rem\", alignItems: \"flex-start\" },\n \"top-center\": { left: \"50%\", top: \"1rem\", ...twTransform({ \"--tw-translate-x\": \"-50%\" }), alignItems: \"center\" },\n \"top-right\": { right: \"1rem\", top: \"1rem\", alignItems: \"flex-end\" },\n \"bottom-left\": { bottom: \"1rem\", left: \"1rem\", alignItems: \"flex-start\" },\n \"bottom-center\": { bottom: \"1.25rem\", left: \"50%\", ...twTransform({ \"--tw-translate-x\": \"-50%\" }), alignItems: \"center\" },\n \"bottom-right\": { bottom: \"1rem\", right: \"1rem\", alignItems: \"flex-end\" }\n};\n\nconst borderL = (token: string): CSSObject => ({\n \"--tw-border-opacity\": \"1\",\n borderLeftColor: `hsl(var(--bfrs-color-${token}) / var(--tw-border-opacity, 1))`\n});\n\nconst toastToneBorderStyles: Record<ToastTone, CSSObject> = {\n neutral: borderL(\"primary\"),\n success: borderL(\"success\"),\n warning: {},\n danger: borderL(\"danger\"),\n info: borderL(\"info\")\n};\n\nconst bgTone = (token: string): CSSObject => ({\n \"--tw-bg-opacity\": \"1\",\n backgroundColor: `hsl(var(--bfrs-color-${token}) / var(--tw-bg-opacity, 1))`\n});\n\nconst toastToneIconStyles: Record<ToastTone, CSSObject> = {\n neutral: bgTone(\"primary\"),\n success: bgTone(\"success\"),\n warning: {},\n danger: bgTone(\"danger\"),\n info: bgTone(\"info\")\n};\n\nconst ToastIconBubble = /*#__PURE__*/ styled(\"span\", {\n label: \"AgenticToast-iconBubble\",\n shouldForwardProp: (propName) => propName !== \"ownerState\"\n})<{ ownerState: { tone: ToastTone; plain?: boolean } }>(({ ownerState }) => [\n {\n display: \"flex\",\n width: \"1.25rem\",\n height: \"1.25rem\",\n flexShrink: 0,\n alignItems: \"center\",\n justifyContent: \"center\",\n borderRadius: \"var(--bfrs-radius-pill)\"\n },\n !ownerState.plain && {\n fontSize: \"12px\",\n fontWeight: 700,\n lineHeight: 1,\n \"--tw-text-opacity\": \"1\",\n color: \"rgb(255 255 255 / var(--tw-text-opacity, 1))\"\n },\n !ownerState.plain && toastToneIconStyles[ownerState.tone]\n]);\n\nconst ToastItemRoot = /*#__PURE__*/ styled(\"div\", {\n label: \"AgenticToast-item\",\n shouldForwardProp: (propName) => propName !== \"ownerState\"\n})<{ ownerState: { tone: ToastTone } }>(({ ownerState }) => [\n {\n pointerEvents: \"auto\",\n display: \"flex\",\n width: \"100%\",\n minWidth: \"300px\",\n maxWidth: \"400px\",\n alignItems: \"flex-start\",\n gap: \".625rem\",\n borderRadius: \"10px\",\n borderWidth: \"1px\",\n borderLeftWidth: \"3px\",\n \"--tw-border-opacity\": \"1\",\n borderColor: \"hsl(var(--bfrs-color-border) / var(--tw-border-opacity, 1))\",\n \"--tw-bg-opacity\": \"1\",\n backgroundColor: \"hsl(var(--bfrs-color-surface-card) / var(--tw-bg-opacity, 1))\",\n paddingLeft: \"14px\",\n paddingRight: \"14px\",\n paddingTop: \".75rem\",\n paddingBottom: \".75rem\",\n fontSize: \".875rem\",\n lineHeight: \"1.25rem\",\n \"--tw-text-opacity\": \"1\",\n color: \"hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))\",\n \"--tw-shadow\": \"var(--bfrs-shadow-elevated)\",\n \"--tw-shadow-colored\": \"var(--bfrs-shadow-elevated)\",\n boxShadow: \"var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)\",\n outline: \"2px solid transparent\",\n outlineOffset: \"2px\",\n ...kfContentIn,\n animation: \"bfrs-bfrs-content-in var(--bfrs-motion-normal) var(--bfrs-ease-out)\"\n },\n toastToneBorderStyles[ownerState.tone]\n]);\n\nconst ToastContent = /*#__PURE__*/ styled(\"div\", {\n label: \"AgenticToast-content\"\n})({\n minWidth: \"0px\",\n flex: \"1 1 0%\"\n});\n\nconst ToastTitle = /*#__PURE__*/ styled(\"div\", {\n label: \"AgenticToast-title\"\n})({\n fontSize: \"13px\",\n fontWeight: 600,\n lineHeight: \"1.25rem\",\n \"--tw-text-opacity\": \"1\",\n color: \"hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))\"\n});\n\nconst ToastDescription = /*#__PURE__*/ styled(\"div\", {\n label: \"AgenticToast-description\"\n})({\n marginTop: \".125rem\",\n fontSize: \".75rem\",\n lineHeight: \"1.25rem\",\n \"--tw-text-opacity\": \"1\",\n color: \"hsl(var(--bfrs-color-text-secondary) / var(--tw-text-opacity, 1))\"\n});\n\nconst ToastAction = /*#__PURE__*/ styled(\"div\", {\n label: \"AgenticToast-action\"\n})({\n marginLeft: \".25rem\",\n flexShrink: 0\n});\n\nconst ToastDismissButton = /*#__PURE__*/ styled(\"button\", {\n label: \"AgenticToast-dismissButton\"\n})({\n marginRight: \"-.25rem\",\n display: \"flex\",\n width: \"1.5rem\",\n height: \"1.5rem\",\n flexShrink: 0,\n alignItems: \"center\",\n justifyContent: \"center\",\n borderRadius: \"var(--bfrs-radius-md)\",\n \"--tw-text-opacity\": \"1\",\n color: \"hsl(var(--bfrs-color-text-secondary) / var(--tw-text-opacity, 1))\",\n outline: \"2px solid transparent\",\n outlineOffset: \"2px\",\n transitionProperty:\n \"color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter\",\n transitionTimingFunction: \"cubic-bezier(.4,0,.2,1)\",\n transitionDuration: \".15s\",\n \"&:hover\": {\n \"--tw-bg-opacity\": \"1\",\n backgroundColor: \"hsl(var(--bfrs-color-surface-muted) / var(--tw-bg-opacity, 1))\",\n \"--tw-text-opacity\": \"1\",\n color: \"hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))\"\n },\n \"&:focus-visible\": twRing(\"2px\", \"hsl(var(--bfrs-color-border-focus) / .5)\")\n});\n\nconst ToastStack = /*#__PURE__*/ styled(\"div\", {\n label: \"AgenticToast-stack\",\n shouldForwardProp: (propName) => propName !== \"ownerState\"\n})<{ ownerState: { placement: ToastPlacement } }>(({ ownerState }) => [\n {\n pointerEvents: \"none\",\n position: \"fixed\",\n zIndex: 2147483646,\n display: \"flex\",\n width: \"calc(100vw - 2rem)\",\n maxWidth: \"400px\",\n flexDirection: \"column\",\n gap: \".625rem\"\n },\n toastPlacementStyles[ownerState.placement]\n]);\n\nconst toneIconGlyph: Record<ToastTone, string> = {\n neutral: \"i\",\n success: \"✓\",\n warning: \"\",\n danger: \"!\",\n info: \"i\"\n};\n\nfunction normalizeToast(input: ToastInput, defaultDuration: number): Omit<ToastRecord, \"id\"> & { id?: string } {\n if (typeof input === \"string\") {\n return {\n title: input,\n tone: \"neutral\",\n duration: defaultDuration,\n dismissible: true\n };\n }\n\n return {\n tone: \"neutral\",\n duration: defaultDuration,\n dismissible: true,\n ...input\n };\n}\n\nfunction withTone(tone: ToastTone, input: string | Omit<Extract<ToastInput, object>, \"tone\">): ToastInput {\n return typeof input === \"string\" ? { title: input, tone } : { ...input, tone };\n}\n\nfunction DefaultToastIcon({ tone }: { tone: ToastTone }) {\n if (tone === \"warning\") {\n return (\n <ToastIconBubble ownerState={{ tone, plain: true }} style={warningSurfaceStyle} aria-hidden=\"true\">\n <WarningAlertIcon />\n </ToastIconBubble>\n );\n }\n\n return (\n <ToastIconBubble ownerState={{ tone }} aria-hidden=\"true\">\n {toneIconGlyph[tone]}\n </ToastIconBubble>\n );\n}\n\nfunction ToastItem({ toast, onDismiss }: { toast: ToastRecord; onDismiss: (id: string) => void }) {\n useEffect(() => {\n if (toast.duration <= 0 || !Number.isFinite(toast.duration)) return undefined;\n\n const timeout = window.setTimeout(() => onDismiss(toast.id), toast.duration);\n return () => window.clearTimeout(timeout);\n }, [onDismiss, toast.duration, toast.id]);\n\n const role = toast.tone === \"danger\" ? \"alert\" : \"status\";\n\n return (\n <ToastItemRoot\n role={role}\n aria-live={role === \"alert\" ? \"assertive\" : \"polite\"}\n ownerState={{ tone: toast.tone }}\n className={toast.className}\n style={toast.tone === \"warning\" ? warningSurfaceStyle : undefined}\n >\n {toast.icon ?? <DefaultToastIcon tone={toast.tone} />}\n <ToastContent>\n <ToastTitle>{toast.title}</ToastTitle>\n {toast.description && <ToastDescription>{toast.description}</ToastDescription>}\n </ToastContent>\n {toast.action && <ToastAction>{toast.action}</ToastAction>}\n {toast.dismissible && (\n <ToastDismissButton type=\"button\" onClick={() => onDismiss(toast.id)} aria-label=\"Dismiss notification\">\n <X size={13} weight=\"bold\" />\n </ToastDismissButton>\n )}\n </ToastItemRoot>\n );\n}\n\nexport function ToastManager({ toasts, onDismiss, placement = \"bottom-center\", className }: ToastManagerProps) {\n if (toasts.length === 0) return null;\n\n const stack = (\n // Portaled to <body> so the fixed, z-[9999] stack escapes any ancestor\n // stacking context (a transformed/opacity/filtered parent would otherwise\n // trap it and let page content paint over the toasts). BfrsPortalScope\n // re-applies the .bfrs token scope at the portal root.\n <BfrsPortalScope>\n <ToastStack ownerState={{ placement }} className={className}>\n {toasts.map((toast) => (\n <ToastItem key={toast.id} toast={toast} onDismiss={onDismiss} />\n ))}\n </ToastStack>\n </BfrsPortalScope>\n );\n\n if (typeof document === \"undefined\") return stack;\n return createPortal(stack, document.body);\n}\n\nexport function ToastProvider({ children, placement = \"bottom-center\", maxToasts = 4, defaultDuration = 2600, className }: ToastProviderProps) {\n const [toasts, setToasts] = useState<ToastRecord[]>([]);\n const idCounterRef = useRef(0);\n\n const dismiss = useCallback((id: string) => {\n setToasts((current) => current.filter((toast) => toast.id !== id));\n }, []);\n\n const clear = useCallback(() => {\n setToasts([]);\n }, []);\n\n const toast = useCallback(\n (input: ToastInput) => {\n const normalized = normalizeToast(input, defaultDuration);\n const id = normalized.id ?? `toast-${Date.now()}-${idCounterRef.current++}`;\n const nextToast: ToastRecord = { ...normalized, id };\n\n setToasts((current) => [...current.filter((item) => item.id !== id), nextToast].slice(-maxToasts));\n return id;\n },\n [defaultDuration, maxToasts]\n );\n\n const success = useCallback((input: string | Omit<Extract<ToastInput, object>, \"tone\">) => toast(withTone(\"success\", input)), [toast]);\n const warning = useCallback((input: string | Omit<Extract<ToastInput, object>, \"tone\">) => toast(withTone(\"warning\", input)), [toast]);\n const danger = useCallback((input: string | Omit<Extract<ToastInput, object>, \"tone\">) => toast(withTone(\"danger\", input)), [toast]);\n const info = useCallback((input: string | Omit<Extract<ToastInput, object>, \"tone\">) => toast(withTone(\"info\", input)), [toast]);\n\n const contextValue = useMemo<ToastContextValue>(\n () => ({ toasts, toast, success, warning, danger, info, dismiss, clear }),\n [clear, danger, dismiss, info, success, toast, toasts, warning]\n );\n\n return (\n <ToastContext.Provider value={contextValue}>\n {children}\n <ToastManager toasts={toasts} onDismiss={dismiss} placement={placement} className={className} />\n </ToastContext.Provider>\n );\n}\n"],"names":["toastPlacementStyles","twTransform","borderL","token","toastToneBorderStyles","bgTone","toastToneIconStyles","ToastIconBubble","propName","ownerState","ToastItemRoot","kfContentIn","ToastContent","ToastTitle","ToastDescription","ToastAction","ToastDismissButton","twRing","ToastStack","toneIconGlyph","normalizeToast","input","defaultDuration","withTone","tone","DefaultToastIcon","jsx","warningSurfaceStyle","WarningAlertIcon","ToastItem","toast","onDismiss","useEffect","timeout","role","jsxs","X","ToastManager","toasts","placement","className","stack","BfrsPortalScope","createPortal","ToastProvider","children","maxToasts","setToasts","useState","idCounterRef","useRef","dismiss","useCallback","id","current","clear","normalized","nextToast","item","success","warning","danger","info","contextValue","useMemo","ToastContext"],"mappings":";;;;;;;;;AAaA,MAAMA,IAA0D;AAAA,EAC9D,YAAY,EAAE,MAAM,QAAQ,KAAK,QAAQ,YAAY,aAAA;AAAA,EACrD,cAAc,EAAE,MAAM,OAAO,KAAK,QAAQ,GAAGC,EAAY,EAAE,oBAAoB,OAAA,CAAQ,GAAG,YAAY,SAAA;AAAA,EACtG,aAAa,EAAE,OAAO,QAAQ,KAAK,QAAQ,YAAY,WAAA;AAAA,EACvD,eAAe,EAAE,QAAQ,QAAQ,MAAM,QAAQ,YAAY,aAAA;AAAA,EAC3D,iBAAiB,EAAE,QAAQ,WAAW,MAAM,OAAO,GAAGA,EAAY,EAAE,oBAAoB,OAAA,CAAQ,GAAG,YAAY,SAAA;AAAA,EAC/G,gBAAgB,EAAE,QAAQ,QAAQ,OAAO,QAAQ,YAAY,WAAA;AAC/D,GAEMC,IAAU,CAACC,OAA8B;AAAA,EAC7C,uBAAuB;AAAA,EACvB,iBAAiB,wBAAwBA,CAAK;AAChD,IAEMC,IAAsD;AAAA,EAC1D,SAASF,EAAQ,SAAS;AAAA,EAC1B,SAASA,EAAQ,SAAS;AAAA,EAC1B,SAAS,CAAA;AAAA,EACT,QAAQA,EAAQ,QAAQ;AAAA,EACxB,MAAMA,EAAQ,MAAM;AACtB,GAEMG,IAAS,CAACF,OAA8B;AAAA,EAC5C,mBAAmB;AAAA,EACnB,iBAAiB,wBAAwBA,CAAK;AAChD,IAEMG,IAAoD;AAAA,EACxD,SAASD,EAAO,SAAS;AAAA,EACzB,SAASA,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AUF,CAAK,CAAC,GAAG,CAACS,CAAK,CAAC,GAC7HgC,IAAOV,EAAY,CAAC/B,MAA8DS,EAAMP,EAAS,QAAQF,CAAK,CAAC,GAAG,CAACS,CAAK,CAAC,GAEzHiC,IAAeC;AAAA,IACnB,OAAO,EAAE,QAAA1B,GAAQ,OAAAR,GAAO,SAAA6B,GAAS,SAAAC,GAAS,QAAAC,GAAQ,MAAAC,GAAM,SAAAX,GAAS,OAAAI;IACjE,CAACA,GAAOM,GAAQV,GAASW,GAAMH,GAAS7B,GAAOQ,GAAQsB,CAAO;AAAA,EAAA;AAGhE,SACE,gBAAAzB,EAAC8B,EAAa,UAAb,EAAsB,OAAOF,GAC3B,UAAA;AAAA,IAAAlB;AAAA,sBACAR,IAAA,EAAa,QAAAC,GAAgB,WAAWa,GAAS,WAAAZ,GAAsB,WAAAC,EAAA,CAAsB;AAAA,EAAA,GAChG;AAEJ;"}
1
+ {"version":3,"file":"Toast.js","sources":["../../../../src/components/feedback/Toast/Toast.tsx"],"sourcesContent":["import { X } from \"@phosphor-icons/react\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport styled from \"@emotion/styled\";\nimport type { CSSObject } from \"@emotion/react\";\nimport { kfContentIn, twRing, twTransform } from \"@/lib/emotionTw\";\nimport { BfrsPortalScope } from \"@/components/ui/providers/BfrsProvider\";\nimport { WarningAlertIcon, warningSurfaceStyle, warningToastSurfaceStyle } from \"@/components/ui/feedback/warningVisual\";\nimport { ToastContext } from \"./Toast.context\";\nimport type { ToastContextValue, ToastInput, ToastManagerProps, ToastPlacement, ToastProviderProps, ToastRecord, ToastTone } from \"./Toast.types\";\n\n/* Exact compiled output of the pre-migration Tailwind utilities. */\n\nconst toastPlacementStyles: Record<ToastPlacement, CSSObject> = {\n \"top-left\": { left: \"1rem\", top: \"1rem\", alignItems: \"flex-start\" },\n \"top-center\": { left: \"50%\", top: \"1rem\", ...twTransform({ \"--tw-translate-x\": \"-50%\" }), alignItems: \"center\" },\n \"top-right\": { right: \"1rem\", top: \"1rem\", alignItems: \"flex-end\" },\n \"bottom-left\": { bottom: \"1rem\", left: \"1rem\", alignItems: \"flex-start\" },\n \"bottom-center\": { bottom: \"1.25rem\", left: \"50%\", ...twTransform({ \"--tw-translate-x\": \"-50%\" }), alignItems: \"center\" },\n \"bottom-right\": { bottom: \"1rem\", right: \"1rem\", alignItems: \"flex-end\" }\n};\n\nconst borderL = (token: string): CSSObject => ({\n \"--tw-border-opacity\": \"1\",\n borderLeftColor: `hsl(var(--bfrs-color-${token}) / var(--tw-border-opacity, 1))`\n});\n\nconst toastToneBorderStyles: Record<ToastTone, CSSObject> = {\n neutral: borderL(\"primary\"),\n success: borderL(\"success\"),\n warning: {},\n danger: borderL(\"danger\"),\n info: borderL(\"info\")\n};\n\nconst bgTone = (token: string): CSSObject => ({\n \"--tw-bg-opacity\": \"1\",\n backgroundColor: `hsl(var(--bfrs-color-${token}) / var(--tw-bg-opacity, 1))`\n});\n\nconst toastToneIconStyles: Record<ToastTone, CSSObject> = {\n neutral: bgTone(\"primary\"),\n success: bgTone(\"success\"),\n warning: {},\n danger: bgTone(\"danger\"),\n info: bgTone(\"info\")\n};\n\nconst ToastIconBubble = /*#__PURE__*/ styled(\"span\", {\n label: \"AgenticToast-iconBubble\",\n shouldForwardProp: (propName) => propName !== \"ownerState\"\n})<{ ownerState: { tone: ToastTone; plain?: boolean } }>(({ ownerState }) => [\n {\n display: \"flex\",\n width: \"1.25rem\",\n height: \"1.25rem\",\n flexShrink: 0,\n alignItems: \"center\",\n justifyContent: \"center\",\n borderRadius: \"var(--bfrs-radius-pill)\"\n },\n !ownerState.plain && {\n fontSize: \"12px\",\n fontWeight: 700,\n lineHeight: 1,\n \"--tw-text-opacity\": \"1\",\n color: \"rgb(255 255 255 / var(--tw-text-opacity, 1))\"\n },\n !ownerState.plain && toastToneIconStyles[ownerState.tone]\n]);\n\nconst ToastItemRoot = /*#__PURE__*/ styled(\"div\", {\n label: \"AgenticToast-item\",\n shouldForwardProp: (propName) => propName !== \"ownerState\"\n})<{ ownerState: { tone: ToastTone } }>(({ ownerState }) => [\n {\n pointerEvents: \"auto\",\n display: \"flex\",\n width: \"100%\",\n minWidth: \"300px\",\n maxWidth: \"400px\",\n alignItems: \"flex-start\",\n gap: \".625rem\",\n borderRadius: \"10px\",\n borderWidth: \"1px\",\n borderLeftWidth: \"3px\",\n \"--tw-border-opacity\": \"1\",\n borderColor: \"hsl(var(--bfrs-color-border) / var(--tw-border-opacity, 1))\",\n \"--tw-bg-opacity\": \"1\",\n backgroundColor: \"hsl(var(--bfrs-color-surface-card) / var(--tw-bg-opacity, 1))\",\n paddingLeft: \"14px\",\n paddingRight: \"14px\",\n paddingTop: \".75rem\",\n paddingBottom: \".75rem\",\n fontSize: \".875rem\",\n lineHeight: \"1.25rem\",\n \"--tw-text-opacity\": \"1\",\n color: \"hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))\",\n \"--tw-shadow\": \"var(--bfrs-shadow-elevated)\",\n \"--tw-shadow-colored\": \"var(--bfrs-shadow-elevated)\",\n boxShadow: \"var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)\",\n outline: \"2px solid transparent\",\n outlineOffset: \"2px\",\n ...kfContentIn,\n animation: \"bfrs-bfrs-content-in var(--bfrs-motion-normal) var(--bfrs-ease-out)\"\n },\n toastToneBorderStyles[ownerState.tone]\n]);\n\nconst ToastContent = /*#__PURE__*/ styled(\"div\", {\n label: \"AgenticToast-content\"\n})({\n minWidth: \"0px\",\n flex: \"1 1 0%\"\n});\n\nconst ToastTitle = /*#__PURE__*/ styled(\"div\", {\n label: \"AgenticToast-title\"\n})({\n fontSize: \"13px\",\n fontWeight: 600,\n lineHeight: \"1.25rem\",\n \"--tw-text-opacity\": \"1\",\n color: \"hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))\"\n});\n\nconst ToastDescription = /*#__PURE__*/ styled(\"div\", {\n label: \"AgenticToast-description\"\n})({\n marginTop: \".125rem\",\n fontSize: \".75rem\",\n lineHeight: \"1.25rem\",\n \"--tw-text-opacity\": \"1\",\n color: \"hsl(var(--bfrs-color-text-secondary) / var(--tw-text-opacity, 1))\"\n});\n\nconst ToastAction = /*#__PURE__*/ styled(\"div\", {\n label: \"AgenticToast-action\"\n})({\n marginLeft: \".25rem\",\n flexShrink: 0\n});\n\nconst ToastDismissButton = /*#__PURE__*/ styled(\"button\", {\n label: \"AgenticToast-dismissButton\"\n})({\n marginRight: \"-.25rem\",\n display: \"flex\",\n width: \"1.5rem\",\n height: \"1.5rem\",\n flexShrink: 0,\n alignItems: \"center\",\n justifyContent: \"center\",\n borderRadius: \"var(--bfrs-radius-md)\",\n \"--tw-text-opacity\": \"1\",\n color: \"hsl(var(--bfrs-color-text-secondary) / var(--tw-text-opacity, 1))\",\n outline: \"2px solid transparent\",\n outlineOffset: \"2px\",\n transitionProperty:\n \"color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter\",\n transitionTimingFunction: \"cubic-bezier(.4,0,.2,1)\",\n transitionDuration: \".15s\",\n \"&:hover\": {\n \"--tw-bg-opacity\": \"1\",\n backgroundColor: \"hsl(var(--bfrs-color-surface-muted) / var(--tw-bg-opacity, 1))\",\n \"--tw-text-opacity\": \"1\",\n color: \"hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))\"\n },\n \"&:focus-visible\": twRing(\"2px\", \"hsl(var(--bfrs-color-border-focus) / .5)\")\n});\n\nconst ToastStack = /*#__PURE__*/ styled(\"div\", {\n label: \"AgenticToast-stack\",\n shouldForwardProp: (propName) => propName !== \"ownerState\"\n})<{ ownerState: { placement: ToastPlacement } }>(({ ownerState }) => [\n {\n pointerEvents: \"none\",\n position: \"fixed\",\n zIndex: 2147483646,\n display: \"flex\",\n width: \"calc(100vw - 2rem)\",\n maxWidth: \"400px\",\n flexDirection: \"column\",\n gap: \".625rem\"\n },\n toastPlacementStyles[ownerState.placement]\n]);\n\nconst toneIconGlyph: Record<ToastTone, string> = {\n neutral: \"i\",\n success: \"✓\",\n warning: \"\",\n danger: \"!\",\n info: \"i\"\n};\n\nfunction normalizeToast(input: ToastInput, defaultDuration: number): Omit<ToastRecord, \"id\"> & { id?: string } {\n if (typeof input === \"string\") {\n return {\n title: input,\n tone: \"neutral\",\n duration: defaultDuration,\n dismissible: true\n };\n }\n\n return {\n tone: \"neutral\",\n duration: defaultDuration,\n dismissible: true,\n ...input\n };\n}\n\nfunction withTone(tone: ToastTone, input: string | Omit<Extract<ToastInput, object>, \"tone\">): ToastInput {\n return typeof input === \"string\" ? { title: input, tone } : { ...input, tone };\n}\n\nfunction DefaultToastIcon({ tone }: { tone: ToastTone }) {\n if (tone === \"warning\") {\n return (\n <ToastIconBubble ownerState={{ tone, plain: true }} style={warningSurfaceStyle} aria-hidden=\"true\">\n <WarningAlertIcon />\n </ToastIconBubble>\n );\n }\n\n return (\n <ToastIconBubble ownerState={{ tone }} aria-hidden=\"true\">\n {toneIconGlyph[tone]}\n </ToastIconBubble>\n );\n}\n\nfunction ToastItem({ toast, onDismiss }: { toast: ToastRecord; onDismiss: (id: string) => void }) {\n useEffect(() => {\n if (toast.duration <= 0 || !Number.isFinite(toast.duration)) return undefined;\n\n const timeout = window.setTimeout(() => onDismiss(toast.id), toast.duration);\n return () => window.clearTimeout(timeout);\n }, [onDismiss, toast.duration, toast.id]);\n\n const role = toast.tone === \"danger\" ? \"alert\" : \"status\";\n\n return (\n <ToastItemRoot\n role={role}\n aria-live={role === \"alert\" ? \"assertive\" : \"polite\"}\n ownerState={{ tone: toast.tone }}\n className={toast.className}\n style={toast.tone === \"warning\" ? warningToastSurfaceStyle : undefined}\n >\n {toast.icon ?? <DefaultToastIcon tone={toast.tone} />}\n <ToastContent>\n <ToastTitle>{toast.title}</ToastTitle>\n {toast.description && <ToastDescription>{toast.description}</ToastDescription>}\n </ToastContent>\n {toast.action && <ToastAction>{toast.action}</ToastAction>}\n {toast.dismissible && (\n <ToastDismissButton type=\"button\" onClick={() => onDismiss(toast.id)} aria-label=\"Dismiss notification\">\n <X size={13} weight=\"bold\" />\n </ToastDismissButton>\n )}\n </ToastItemRoot>\n );\n}\n\nexport function ToastManager({ toasts, onDismiss, placement = \"bottom-center\", className }: ToastManagerProps) {\n if (toasts.length === 0) return null;\n\n const stack = (\n // Portaled to <body> so the fixed, z-[9999] stack escapes any ancestor\n // stacking context (a transformed/opacity/filtered parent would otherwise\n // trap it and let page content paint over the toasts). BfrsPortalScope\n // re-applies the .bfrs token scope at the portal root.\n <BfrsPortalScope>\n <ToastStack ownerState={{ placement }} className={className}>\n {toasts.map((toast) => (\n <ToastItem key={toast.id} toast={toast} onDismiss={onDismiss} />\n ))}\n </ToastStack>\n </BfrsPortalScope>\n );\n\n if (typeof document === \"undefined\") return stack;\n return createPortal(stack, document.body);\n}\n\nexport function ToastProvider({ children, placement = \"bottom-center\", maxToasts = 4, defaultDuration = 2600, className }: ToastProviderProps) {\n const [toasts, setToasts] = useState<ToastRecord[]>([]);\n const idCounterRef = useRef(0);\n\n const dismiss = useCallback((id: string) => {\n setToasts((current) => current.filter((toast) => toast.id !== id));\n }, []);\n\n const clear = useCallback(() => {\n setToasts([]);\n }, []);\n\n const toast = useCallback(\n (input: ToastInput) => {\n const normalized = normalizeToast(input, defaultDuration);\n const id = normalized.id ?? `toast-${Date.now()}-${idCounterRef.current++}`;\n const nextToast: ToastRecord = { ...normalized, id };\n\n setToasts((current) => [...current.filter((item) => item.id !== id), nextToast].slice(-maxToasts));\n return id;\n },\n [defaultDuration, maxToasts]\n );\n\n const success = useCallback((input: string | Omit<Extract<ToastInput, object>, \"tone\">) => toast(withTone(\"success\", input)), [toast]);\n const warning = useCallback((input: string | Omit<Extract<ToastInput, object>, \"tone\">) => toast(withTone(\"warning\", input)), [toast]);\n const danger = useCallback((input: string | Omit<Extract<ToastInput, object>, \"tone\">) => toast(withTone(\"danger\", input)), [toast]);\n const info = useCallback((input: string | Omit<Extract<ToastInput, object>, \"tone\">) => toast(withTone(\"info\", input)), [toast]);\n\n const contextValue = useMemo<ToastContextValue>(\n () => ({ toasts, toast, success, warning, danger, info, dismiss, clear }),\n [clear, danger, dismiss, info, success, toast, toasts, warning]\n );\n\n return (\n <ToastContext.Provider value={contextValue}>\n {children}\n <ToastManager toasts={toasts} onDismiss={dismiss} placement={placement} className={className} />\n </ToastContext.Provider>\n );\n}\n"],"names":["toastPlacementStyles","twTransform","borderL","token","toastToneBorderStyles","bgTone","toastToneIconStyles","ToastIconBubble","propName","ownerState","ToastItemRoot","kfContentIn","ToastContent","ToastTitle","ToastDescription","ToastAction","ToastDismissButton","twRing","ToastStack","toneIconGlyph","normalizeToast","input","defaultDuration","withTone","tone","DefaultToastIcon","jsx","warningSurfaceStyle","WarningAlertIcon","ToastItem","toast","onDismiss","useEffect","timeout","role","jsxs","warningToastSurfaceStyle","X","ToastManager","toasts","placement","className","stack","BfrsPortalScope","createPortal","ToastProvider","children","maxToasts","setToasts","useState","idCounterRef","useRef","dismiss","useCallback","id","current","clear","normalized","nextToast","item","success","warning","danger","info","contextValue","useMemo","ToastContext"],"mappings":";;;;;;;;;AAaA,MAAMA,IAA0D;AAAA,EAC9D,YAAY,EAAE,MAAM,QAAQ,KAAK,QAAQ,YAAY,aAAA;AAAA,EACrD,cAAc,EAAE,MAAM,OAAO,KAAK,QAAQ,GAAGC,EAAY,EAAE,oBAAoB,OAAA,CAAQ,GAAG,YAAY,SAAA;AAAA,EACtG,aAAa,EAAE,OAAO,QAAQ,KAAK,QAAQ,YAAY,WAAA;AAAA,EACvD,eAAe,EAAE,QAAQ,QAAQ,MAAM,QAAQ,YAAY,aAAA;AAAA,EAC3D,iBAAiB,EAAE,QAAQ,WAAW,MAAM,OAAO,GAAGA,EAAY,EAAE,oBAAoB,OAAA,CAAQ,GAAG,YAAY,SAAA;AAAA,EAC/G,gBAAgB,EAAE,QAAQ,QAAQ,OAAO,QAAQ,Y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AAN,EAAU,CAACO,MAAY,CAAC,GAAGA,EAAQ,OAAO,CAACI,MAASA,EAAK,OAAOL,CAAE,GAAGI,CAAS,EAAE,MAAM,CAACX,CAAS,CAAC,GAC1FO;AAAA,IACT;AAAA,IACA,CAAChC,GAAiByB,CAAS;AAAA,EAAA,GAGvBa,IAAUP,EAAY,CAAChC,MAA8DS,EAAMP,EAAS,WAAWF,CAAK,CAAC,GAAG,CAACS,CAAK,CAAC,GAC/H+B,IAAUR,EAAY,CAAChC,MAA8DS,EAAMP,EAAS,WAAWF,CAAK,CAAC,GAAG,CAACS,CAAK,CAAC,GAC/HgC,IAAST,EAAY,CAAChC,MAA8DS,EAAMP,EAAS,UAAUF,CAAK,CAAC,GAAG,CAACS,CAAK,CAAC,GAC7HiC,IAAOV,EAAY,CAAChC,MAA8DS,EAAMP,EAAS,QAAQF,CAAK,CAAC,GAAG,CAACS,CAAK,CAAC,GAEzHkC,IAAeC;AAAA,IACnB,OAAO,EAAE,QAAA1B,GAAQ,OAAAT,GAAO,SAAA8B,GAAS,SAAAC,GAAS,QAAAC,GAAQ,MAAAC,GAAM,SAAAX,GAAS,OAAAI;IACjE,CAACA,GAAOM,GAAQV,GAASW,GAAMH,GAAS9B,GAAOS,GAAQsB,CAAO;AAAA,EAAA;AAGhE,SACE,gBAAA1B,EAAC+B,EAAa,UAAb,EAAsB,OAAOF,GAC3B,UAAA;AAAA,IAAAlB;AAAA,sBACAR,IAAA,EAAa,QAAAC,GAAgB,WAAWa,GAAS,WAAAZ,GAAsB,WAAAC,EAAA,CAAsB;AAAA,EAAA,GAChG;AAEJ;"}
@@ -4,6 +4,7 @@ export declare const warningSurfaceBackground = "rgba(217, 119, 6, 0.08)";
4
4
  export declare const warningSurfaceBorder = "1px solid rgba(217, 119, 6, 0.2)";
5
5
  export declare const warningSurfaceBorderColor = "rgba(217, 119, 6, 0.2)";
6
6
  export declare const warningSurfaceStyle: CSSProperties;
7
+ export declare const warningToastSurfaceStyle: CSSProperties;
7
8
  export declare const warningSurfaceTextStyle: CSSProperties;
8
9
  export declare const warningTextStyle: CSSProperties;
9
10
  export declare const warningAccentBackgroundStyle: CSSProperties;
@@ -1,7 +1,10 @@
1
- import { jsxs as n, jsx as o } from "react/jsx-runtime";
2
- const r = "#D97706", e = "rgba(217, 119, 6, 0.08)", t = "1px solid rgba(217, 119, 6, 0.2)", c = "rgba(217, 119, 6, 0.2)", a = {
3
- backgroundColor: e,
4
- border: t
1
+ import { jsxs as t, jsx as n } from "react/jsx-runtime";
2
+ const r = "#D97706", o = "rgba(217, 119, 6, 0.08)", e = "1px solid rgba(217, 119, 6, 0.2)", c = "rgba(217, 119, 6, 0.2)", a = {
3
+ backgroundColor: o,
4
+ border: e
5
+ }, g = {
6
+ backgroundImage: `linear-gradient(${o}, ${o})`,
7
+ border: e
5
8
  }, l = {
6
9
  ...a,
7
10
  color: r
@@ -9,28 +12,29 @@ const r = "#D97706", e = "rgba(217, 119, 6, 0.08)", t = "1px solid rgba(217, 119
9
12
  color: r
10
13
  }, d = {
11
14
  backgroundColor: r
12
- }, g = {
13
- borderColor: r
14
15
  }, u = {
16
+ borderColor: r
17
+ }, S = {
15
18
  borderColor: c
16
19
  };
17
- function S() {
18
- return /* @__PURE__ */ n("svg", { width: "11", height: "11", viewBox: "0 0 16 16", fill: "none", style: { flexShrink: 0 }, children: [
19
- /* @__PURE__ */ o("path", { d: "M8 1.5l6.5 11.5h-13L8 1.5z", stroke: "#D97706", strokeWidth: "1.4", strokeLinejoin: "round" }),
20
- /* @__PURE__ */ o("path", { d: "M8 6v3M8 11h.01", stroke: "#D97706", strokeWidth: "1.4", strokeLinecap: "round" })
20
+ function w() {
21
+ return /* @__PURE__ */ t("svg", { width: "11", height: "11", viewBox: "0 0 16 16", fill: "none", style: { flexShrink: 0 }, children: [
22
+ /* @__PURE__ */ n("path", { d: "M8 1.5l6.5 11.5h-13L8 1.5z", stroke: "#D97706", strokeWidth: "1.4", strokeLinejoin: "round" }),
23
+ /* @__PURE__ */ n("path", { d: "M8 6v3M8 11h.01", stroke: "#D97706", strokeWidth: "1.4", strokeLinecap: "round" })
21
24
  ] });
22
25
  }
23
26
  export {
24
- S as WarningAlertIcon,
27
+ w as WarningAlertIcon,
25
28
  d as warningAccentBackgroundStyle,
26
- g as warningAccentBorderStyle,
29
+ u as warningAccentBorderStyle,
27
30
  r as warningAccentColor,
28
- u as warningSoftBorderStyle,
29
- e as warningSurfaceBackground,
30
- t as warningSurfaceBorder,
31
+ S as warningSoftBorderStyle,
32
+ o as warningSurfaceBackground,
33
+ e as warningSurfaceBorder,
31
34
  c as warningSurfaceBorderColor,
32
35
  a as warningSurfaceStyle,
33
36
  l as warningSurfaceTextStyle,
34
- s as warningTextStyle
37
+ s as warningTextStyle,
38
+ g as warningToastSurfaceStyle
35
39
  };
36
40
  //# sourceMappingURL=warningVisual.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"warningVisual.js","sources":["../../../../src/components/ui/feedback/warningVisual.tsx"],"sourcesContent":["import type { CSSProperties } from \"react\";\n\nexport const warningAccentColor = \"#D97706\";\nexport const warningSurfaceBackground = \"rgba(217, 119, 6, 0.08)\";\nexport const warningSurfaceBorder = \"1px solid rgba(217, 119, 6, 0.2)\";\nexport const warningSurfaceBorderColor = \"rgba(217, 119, 6, 0.2)\";\n\nexport const warningSurfaceStyle: CSSProperties = {\n backgroundColor: warningSurfaceBackground,\n border: warningSurfaceBorder\n};\n\nexport const warningSurfaceTextStyle: CSSProperties = {\n ...warningSurfaceStyle,\n color: warningAccentColor\n};\n\nexport const warningTextStyle: CSSProperties = {\n color: warningAccentColor\n};\n\nexport const warningAccentBackgroundStyle: CSSProperties = {\n backgroundColor: warningAccentColor\n};\n\nexport const warningAccentBorderStyle: CSSProperties = {\n borderColor: warningAccentColor\n};\n\nexport const warningSoftBorderStyle: CSSProperties = {\n borderColor: warningSurfaceBorderColor\n};\n\nexport function WarningAlertIcon() {\n return (\n <svg width=\"11\" height=\"11\" viewBox=\"0 0 16 16\" fill=\"none\" style={{ flexShrink: 0 }}>\n <path d=\"M8 1.5l6.5 11.5h-13L8 1.5z\" stroke=\"#D97706\" strokeWidth=\"1.4\" strokeLinejoin=\"round\" />\n <path d=\"M8 6v3M8 11h.01\" stroke=\"#D97706\" strokeWidth=\"1.4\" strokeLinecap=\"round\" />\n </svg>\n );\n}\n"],"names":["warningAccentColor","warningSurfaceBackground","warningSurfaceBorder","warningSurfaceBorderColor","warningSurfaceStyle","warningSurfaceTextStyle","warningTextStyle","warningAccentBackgroundStyle","warningAccentBorderStyle","warningSoftBorderStyle","WarningAlertIcon","jsxs","jsx"],"mappings":";AAEO,MAAMA,IAAqB,WACrBC,IAA2B,2BAC3BC,IAAuB,oCACvBC,IAA4B,0BAE5BC,IAAqC;AAAA,EAChD,iBAAiBH;AAAA,EACjB,QAAQC;AACV,GAEaG,IAAyC;AAAA,EACpD,GAAGD;AAAA,EACH,OAAOJ;AACT,GAEaM,IAAkC;AAAA,EAC7C,OAAON;AACT,GAEaO,IAA8C;AAAA,EACzD,iBAAiBP;AACnB,GAEaQ,IAA0C;AAAA,EACrD,aAAaR;AACf,GAEaS,IAAwC;AAAA,EACnD,aAAaN;AACf;AAEO,SAASO,IAAmB;AACjC,SACE,gBAAAC,EAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,OAAO,EAAE,YAAY,KAC/E,UAAA;AAAA,IAAA,gBAAAC,EAAC,QAAA,EAAK,GAAE,8BAA6B,QAAO,WAAU,aAAY,OAAM,gBAAe,QAAA,CAAQ;AAAA,IAC/F,gBAAAA,EAAC,UAAK,GAAE,mBAAkB,QAAO,WAAU,aAAY,OAAM,eAAc,QAAA,CAAQ;AAAA,EAAA,GACrF;AAEJ;"}
1
+ {"version":3,"file":"warningVisual.js","sources":["../../../../src/components/ui/feedback/warningVisual.tsx"],"sourcesContent":["import type { CSSProperties } from \"react\";\n\nexport const warningAccentColor = \"#D97706\";\nexport const warningSurfaceBackground = \"rgba(217, 119, 6, 0.08)\";\nexport const warningSurfaceBorder = \"1px solid rgba(217, 119, 6, 0.2)\";\nexport const warningSurfaceBorderColor = \"rgba(217, 119, 6, 0.2)\";\n\nexport const warningSurfaceStyle: CSSProperties = {\n backgroundColor: warningSurfaceBackground,\n border: warningSurfaceBorder\n};\n\n// A toast is a FLOATING overlay (portaled to <body>) with nothing opaque behind it — unlike an\n// inline warning surface, which sits over the opaque page. So the warning tint must sit OVER the\n// toast's own opaque surface, not REPLACE it: using `warningSurfaceStyle` (a translucent\n// backgroundColor) on the toast made the whole toast see-through. Apply the tint as a\n// background-image instead, so the toast item's opaque `surface-card` backgroundColor still shows\n// through beneath it.\nexport const warningToastSurfaceStyle: CSSProperties = {\n backgroundImage: `linear-gradient(${warningSurfaceBackground}, ${warningSurfaceBackground})`,\n border: warningSurfaceBorder\n};\n\nexport const warningSurfaceTextStyle: CSSProperties = {\n ...warningSurfaceStyle,\n color: warningAccentColor\n};\n\nexport const warningTextStyle: CSSProperties = {\n color: warningAccentColor\n};\n\nexport const warningAccentBackgroundStyle: CSSProperties = {\n backgroundColor: warningAccentColor\n};\n\nexport const warningAccentBorderStyle: CSSProperties = {\n borderColor: warningAccentColor\n};\n\nexport const warningSoftBorderStyle: CSSProperties = {\n borderColor: warningSurfaceBorderColor\n};\n\nexport function WarningAlertIcon() {\n return (\n <svg width=\"11\" height=\"11\" viewBox=\"0 0 16 16\" fill=\"none\" style={{ flexShrink: 0 }}>\n <path d=\"M8 1.5l6.5 11.5h-13L8 1.5z\" stroke=\"#D97706\" strokeWidth=\"1.4\" strokeLinejoin=\"round\" />\n <path d=\"M8 6v3M8 11h.01\" stroke=\"#D97706\" strokeWidth=\"1.4\" strokeLinecap=\"round\" />\n </svg>\n );\n}\n"],"names":["warningAccentColor","warningSurfaceBackground","warningSurfaceBorder","warningSurfaceBorderColor","warningSurfaceStyle","warningToastSurfaceStyle","warningSurfaceTextStyle","warningTextStyle","warningAccentBackgroundStyle","warningAccentBorderStyle","warningSoftBorderStyle","WarningAlertIcon","jsxs","jsx"],"mappings":";AAEO,MAAMA,IAAqB,WACrBC,IAA2B,2BAC3BC,IAAuB,oCACvBC,IAA4B,0BAE5BC,IAAqC;AAAA,EAChD,iBAAiBH;AAAA,EACjB,QAAQC;AACV,GAQaG,IAA0C;AAAA,EACrD,iBAAiB,mBAAmBJ,CAAwB,KAAKA,CAAwB;AAAA,EACzF,QAAQC;AACV,GAEaI,IAAyC;AAAA,EACpD,GAAGF;AAAA,EACH,OAAOJ;AACT,GAEaO,IAAkC;AAAA,EAC7C,OAAOP;AACT,GAEaQ,IAA8C;AAAA,EACzD,iBAAiBR;AACnB,GAEaS,IAA0C;AAAA,EACrD,aAAaT;AACf,GAEaU,IAAwC;AAAA,EACnD,aAAaP;AACf;AAEO,SAASQ,IAAmB;AACjC,SACE,gBAAAC,EAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,OAAO,EAAE,YAAY,KAC/E,UAAA;AAAA,IAAA,gBAAAC,EAAC,QAAA,EAAK,GAAE,8BAA6B,QAAO,WAAU,aAAY,OAAM,gBAAe,QAAA,CAAQ;AAAA,IAC/F,gBAAAA,EAAC,UAAK,GAAE,mBAAkB,QAAO,WAAU,aAAY,OAAM,eAAc,QAAA,CAAQ;AAAA,EAAA,GACrF;AAEJ;"}
@@ -1,5 +1,7 @@
1
1
  export { BfrsProvider } from './providers/BfrsProvider';
2
2
  export type { BfrsColorScheme, BfrsProviderProps } from './providers/BfrsProvider';
3
+ export { BfrsAnalyticsProvider, emitBfrsAnalytics, getBfrsAnalyticsSink, setBfrsAnalyticsSink, useBfrsAnalyticsSink } from './providers/BfrsAnalyticsProvider';
4
+ export type { BfrsAnalyticsEvent, BfrsAnalyticsEventName, BfrsAnalyticsProperties, BfrsAnalyticsProviderProps, BfrsAnalyticsSink } from './providers/BfrsAnalyticsProvider';
3
5
  export * from './primitives/Box';
4
6
  export * from './primitives/Container';
5
7
  export * from './primitives/Paper';
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from 'react';
2
+ import { BfrsAnalyticsSink } from './analyticsContext';
3
+ export type BfrsAnalyticsProviderProps = {
4
+ /** Where to send library events. Omitted or null inherits the nearest provider. */
5
+ emit?: BfrsAnalyticsSink | null;
6
+ children: ReactNode;
7
+ };
8
+ /**
9
+ * Makes a sink available to every library component below it.
10
+ *
11
+ * `BfrsProvider` renders this for its `analytics` prop, so an app that already
12
+ * has a provider wires reporting in one place. See `analyticsContext.ts` for
13
+ * why library components emit at all.
14
+ */
15
+ export declare function BfrsAnalyticsProvider({ emit, children }: BfrsAnalyticsProviderProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare namespace BfrsAnalyticsProvider {
17
+ var displayName: string;
18
+ }
@@ -0,0 +1,12 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { useContext as n, useMemo as f } from "react";
3
+ import { BfrsAnalyticsContext as t } from "./analyticsContext.js";
4
+ function m({ emit: r, children: e }) {
5
+ const o = n(t), i = f(() => r ?? o, [r, o]);
6
+ return /* @__PURE__ */ s(t.Provider, { value: i, children: e });
7
+ }
8
+ m.displayName = "BfrsAnalyticsProvider";
9
+ export {
10
+ m as BfrsAnalyticsProvider
11
+ };
12
+ //# sourceMappingURL=BfrsAnalyticsProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BfrsAnalyticsProvider.js","sources":["../../../../../src/components/ui/providers/BfrsAnalyticsProvider/BfrsAnalyticsProvider.tsx"],"sourcesContent":["import { useContext, useMemo, type ReactNode } from \"react\";\nimport { BfrsAnalyticsContext, type BfrsAnalyticsSink } from \"./analyticsContext\";\n\nexport type BfrsAnalyticsProviderProps = {\n /** Where to send library events. Omitted or null inherits the nearest provider. */\n emit?: BfrsAnalyticsSink | null;\n children: ReactNode;\n};\n\n/**\n * Makes a sink available to every library component below it.\n *\n * `BfrsProvider` renders this for its `analytics` prop, so an app that already\n * has a provider wires reporting in one place. See `analyticsContext.ts` for\n * why library components emit at all.\n */\nexport function BfrsAnalyticsProvider({ emit, children }: BfrsAnalyticsProviderProps) {\n const inherited = useContext(BfrsAnalyticsContext);\n // An omitted `emit` inherits rather than blanking the sink, so nesting a\n // provider for theming cannot silently switch reporting off.\n const value = useMemo(() => emit ?? inherited, [emit, inherited]);\n\n return <BfrsAnalyticsContext.Provider value={value}>{children}</BfrsAnalyticsContext.Provider>;\n}\n\nBfrsAnalyticsProvider.displayName = \"BfrsAnalyticsProvider\";\n"],"names":["BfrsAnalyticsProvider","emit","children","inherited","useContext","BfrsAnalyticsContext","value","useMemo","jsx"],"mappings":";;;AAgBO,SAASA,EAAsB,EAAE,MAAAC,GAAM,UAAAC,KAAwC;AACpF,QAAMC,IAAYC,EAAWC,CAAoB,GAG3CC,IAAQC,EAAQ,MAAMN,KAAQE,GAAW,CAACF,GAAME,CAAS,CAAC;AAEhE,SAAO,gBAAAK,EAACH,EAAqB,UAArB,EAA8B,OAAAC,GAAe,UAAAJ,EAAA,CAAS;AAChE;AAEAF,EAAsB,cAAc;"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Analytics for library-owned interactions.
3
+ *
4
+ * ## Why the library emits at all
5
+ *
6
+ * The usage guide's rule — "the library should not know analytics events" —
7
+ * holds for anything the consumer can observe for itself. Saved views are the
8
+ * case where it cannot:
9
+ *
10
+ * - `TableSaveView` dispatches the request through its own store when
11
+ * `screenName` is supplied, so `onSave` never fires and the consumer cannot
12
+ * see the submit at all. Reporting a submission from `onSaved` would be a
13
+ * different fact (an outcome) wearing the submit's name.
14
+ * - A submission blocked by the component's own validation (empty or reserved
15
+ * name) produces no callback at all, so nobody could count it.
16
+ * - `TableViewSelector` calls `onValueChange` for BOTH a seller's pick and its
17
+ * own mount-time restore of the primary view, in an identical shape. Every
18
+ * consumer had to guess with a heuristic; the component knows for certain.
19
+ *
20
+ * So the component owns the MOMENTS, which only it can observe correctly, and
21
+ * the consumer owns the VOCABULARY: it passes the registered element ids and a
22
+ * sink, and nothing here ever touches `gtag`, `dataLayer` or a provider SDK.
23
+ * There is exactly one GA4 tag in the platform and it belongs to the host; this
24
+ * module hands the host an event and is finished.
25
+ */
26
+ /**
27
+ * The canonical event names the library may emit — a closed set, matching the
28
+ * platform registry. The host validates every name and property it receives, so
29
+ * an unknown name here would be dropped there with a diagnostic rather than
30
+ * silently reported.
31
+ *
32
+ * `form_validation_failed` is deliberately absent: the only validation these
33
+ * components apply disables the submit control, so no blocked attempt can
34
+ * occur. Add it when a component can actually observe one.
35
+ */
36
+ export type BfrsAnalyticsEventName = "cta_clicked" | "element_clicked" | "modal_displayed" | "modal_dismissed" | "dropdown_option_selected" | "form_submitted" | "workflow_completed" | "workflow_failed";
37
+ /**
38
+ * Event properties. Values are codes, counts and booleans only.
39
+ *
40
+ * Nothing in this file may pass a view NAME, a seller's typed text, a label, a
41
+ * URL or an identifier from an unbounded list: the ids are registered codes the
42
+ * consumer supplies, and a saved view's name is the seller's own words.
43
+ */
44
+ export type BfrsAnalyticsProperties = Record<string, string | number | boolean | undefined>;
45
+ export type BfrsAnalyticsEvent = {
46
+ name: BfrsAnalyticsEventName;
47
+ properties: BfrsAnalyticsProperties;
48
+ };
49
+ /**
50
+ * Where library events go. A consumer wires this once:
51
+ *
52
+ * ```tsx
53
+ * <BfrsProvider analytics={(event) => analytics.track(event.name, event.properties)}>
54
+ * ```
55
+ */
56
+ export type BfrsAnalyticsSink = (event: BfrsAnalyticsEvent) => void;
57
+ export declare const BfrsAnalyticsContext: import('react').Context<BfrsAnalyticsSink | null>;
58
+ export declare function setBfrsAnalyticsSink(sink: BfrsAnalyticsSink | null): void;
59
+ export declare function getBfrsAnalyticsSink(): BfrsAnalyticsSink | null;
60
+ /**
61
+ * The sink to use, most specific first:
62
+ *
63
+ * 1. the nearest `BfrsProvider`/`BfrsAnalyticsProvider`
64
+ * 2. `setBfrsAnalyticsSink`, if an app chose to set one
65
+ * 3. the host bridge, discovered — which is why a platform app needs neither
66
+ * of the above
67
+ *
68
+ * Null when none of them is present, and then nothing is emitted.
69
+ */
70
+ export declare function useBfrsAnalyticsSink(): BfrsAnalyticsSink | null;
71
+ /**
72
+ * Send one event, swallowing anything the sink throws.
73
+ *
74
+ * Reporting is never allowed to break the interaction it is reporting: a sink
75
+ * that throws (a mis-wired host, a consent gate, a provider SDK that is not
76
+ * loaded yet) must not take the save dialog down with it.
77
+ */
78
+ export declare function emitBfrsAnalytics(sink: BfrsAnalyticsSink | null | undefined, name: BfrsAnalyticsEventName, properties: BfrsAnalyticsProperties): void;
@@ -0,0 +1,41 @@
1
+ import { useContext as s, createContext as f } from "react";
2
+ const l = f(null), u = ["__shiprocketAnalyticsBridge", "__bfrsAnalytics"];
3
+ function a() {
4
+ if (typeof globalThis > "u") return null;
5
+ for (const t of u) {
6
+ const n = globalThis[t], e = n == null ? void 0 : n.trackLibraryEvent;
7
+ if (typeof e == "function")
8
+ return (r) => {
9
+ e.call(n, r.name, r.properties);
10
+ };
11
+ }
12
+ return null;
13
+ }
14
+ let o = null;
15
+ function p(t) {
16
+ o = t;
17
+ }
18
+ function k() {
19
+ return o;
20
+ }
21
+ function A() {
22
+ return s(l) ?? o ?? a();
23
+ }
24
+ function B(t, n, e) {
25
+ if (!t) return;
26
+ const r = {};
27
+ for (const [c, i] of Object.entries(e))
28
+ i !== void 0 && (r[c] = i);
29
+ try {
30
+ t({ name: n, properties: r });
31
+ } catch {
32
+ }
33
+ }
34
+ export {
35
+ l as BfrsAnalyticsContext,
36
+ B as emitBfrsAnalytics,
37
+ k as getBfrsAnalyticsSink,
38
+ p as setBfrsAnalyticsSink,
39
+ A as useBfrsAnalyticsSink
40
+ };
41
+ //# sourceMappingURL=analyticsContext.js.map