@bikdotai/bik-component-library 0.0.853-beta.0 → 0.0.854
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/cjs/components/agent-builder/AgentBuilder.js +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js +1 -1
- package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js +1 -1
- package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +11 -11
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +5 -5
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/GoLiveModal.js +1 -1
- package/dist/cjs/components/agent-builder/components/GoLiveModal.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js +1 -7
- package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionField.js +1 -1
- package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionPicker.js +26 -53
- package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/RequireVerificationModal.js +1 -1
- package/dist/cjs/components/agent-builder/components/RequireVerificationModal.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +5 -6
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js +1 -1
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js +2 -2
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
- package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
- package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +4 -4
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/sourceIcons.js +1 -1
- package/dist/cjs/components/agent-builder/utils/sourceIcons.js.map +1 -1
- package/dist/cjs/components/agent-listing/AgentTableRow.js +1 -1
- package/dist/cjs/components/agent-listing/AgentTableRow.js.map +1 -1
- package/dist/cjs/components/agent-listing/AiAgentsEmptyState.js +1 -1
- package/dist/cjs/components/agent-listing/AiAgentsEmptyState.js.map +1 -1
- package/dist/cjs/components/toaster/Toaster.js +1 -1
- package/dist/cjs/components/toaster/Toaster.js.map +1 -1
- package/dist/cjs/components/toaster/Toaster.styled.js +7 -7
- package/dist/cjs/components/toaster/Toaster.styled.js.map +1 -1
- package/dist/cjs/components/variable-picker-v3/Content.js +1 -1
- package/dist/cjs/components/variable-picker-v3/Content.js.map +1 -1
- package/dist/cjs/components/zeroState/ZeroState.js +3 -3
- package/dist/cjs/components/zeroState/ZeroState.js.map +1 -1
- package/dist/cjs/editor/BikEditor.js +1 -1
- package/dist/cjs/editor/BikEditor.js.map +1 -1
- package/dist/cjs/editor/BikEditor.styles.js +21 -23
- package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
- package/dist/cjs/editor/BikEditor.types.js.map +1 -1
- package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js +3 -3
- package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
- package/dist/cjs/editor/extensions/mention/MentionDropdown.js +1 -1
- package/dist/cjs/editor/extensions/mention/MentionDropdown.js.map +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.js +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/add-variableV2/index.d.ts +0 -1
- package/dist/esm/components/agent-builder/AgentBuilder.js +127 -119
- package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +7 -10
- package/dist/esm/components/agent-builder/components/AgentBuilderFooter.d.ts +2 -0
- package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js +29 -26
- package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
- package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js +30 -29
- package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.d.ts +0 -8
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +136 -182
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +9 -3
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +230 -222
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/GoLiveModal.js +11 -13
- package/dist/esm/components/agent-builder/components/GoLiveModal.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +0 -12
- package/dist/esm/components/agent-builder/components/MentionEditor.js +103 -144
- package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionField.js +45 -48
- package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +1 -14
- package/dist/esm/components/agent-builder/components/MentionPicker.js +248 -292
- package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/esm/components/agent-builder/components/RequireVerificationModal.js +8 -8
- package/dist/esm/components/agent-builder/components/RequireVerificationModal.js.map +1 -1
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +0 -8
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +172 -185
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/SelectableListSection.js +73 -69
- package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.d.ts +0 -9
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js +48 -67
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
- package/dist/esm/components/agent-builder/constants/tools.d.ts +21 -1
- package/dist/esm/components/agent-builder/constants/tools.js +33 -23
- package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +0 -7
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +96 -99
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +272 -261
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +4 -14
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js +36 -54
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/sourceIcons.d.ts +6 -6
- package/dist/esm/components/agent-builder/utils/sourceIcons.js +21 -19
- package/dist/esm/components/agent-builder/utils/sourceIcons.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentTableRow.js +26 -23
- package/dist/esm/components/agent-listing/AgentTableRow.js.map +1 -1
- package/dist/esm/components/agent-listing/AiAgentsEmptyState.js +3 -2
- package/dist/esm/components/agent-listing/AiAgentsEmptyState.js.map +1 -1
- package/dist/esm/components/toaster/Toaster.js +30 -25
- package/dist/esm/components/toaster/Toaster.js.map +1 -1
- package/dist/esm/components/toaster/Toaster.styled.js +5 -5
- package/dist/esm/components/toaster/Toaster.styled.js.map +1 -1
- package/dist/esm/components/variable-picker-v3/Content.js +15 -16
- package/dist/esm/components/variable-picker-v3/Content.js.map +1 -1
- package/dist/esm/components/zeroState/ZeroState.d.ts +2 -0
- package/dist/esm/components/zeroState/ZeroState.js +18 -17
- package/dist/esm/components/zeroState/ZeroState.js.map +1 -1
- package/dist/esm/editor/BikEditor.js +229 -222
- package/dist/esm/editor/BikEditor.js.map +1 -1
- package/dist/esm/editor/BikEditor.styles.js +14 -16
- package/dist/esm/editor/BikEditor.styles.js.map +1 -1
- package/dist/esm/editor/BikEditor.types.d.ts +0 -9
- package/dist/esm/editor/BikEditor.types.js.map +1 -1
- package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js +62 -60
- package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
- package/dist/esm/editor/extensions/mention/MentionDropdown.js +28 -28
- package/dist/esm/editor/extensions/mention/MentionDropdown.js.map +1 -1
- package/dist/esm/editor/extensions/mention/MentionExtension.js +19 -23
- package/dist/esm/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/esm/icons/index.d.ts +25 -25
- package/dist/esm/index.js +541 -543
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/add-variableV2/AddDataPill.js +0 -10
- package/dist/cjs/components/add-variableV2/AddDataPill.js.map +0 -1
- package/dist/cjs/components/agent-builder/components/VariableInlineField.js +0 -65
- package/dist/cjs/components/agent-builder/components/VariableInlineField.js.map +0 -1
- package/dist/cjs/components/agent-builder/components/VariableTriggerArea.js +0 -10
- package/dist/cjs/components/agent-builder/components/VariableTriggerArea.js.map +0 -1
- package/dist/esm/components/add-variableV2/AddDataPill.d.ts +0 -24
- package/dist/esm/components/add-variableV2/AddDataPill.js +0 -33
- package/dist/esm/components/add-variableV2/AddDataPill.js.map +0 -1
- package/dist/esm/components/agent-builder/components/VariableInlineField.d.ts +0 -26
- package/dist/esm/components/agent-builder/components/VariableInlineField.js +0 -149
- package/dist/esm/components/agent-builder/components/VariableInlineField.js.map +0 -1
- package/dist/esm/components/agent-builder/components/VariableTriggerArea.d.ts +0 -46
- package/dist/esm/components/agent-builder/components/VariableTriggerArea.js +0 -118
- package/dist/esm/components/agent-builder/components/VariableTriggerArea.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sourceIcons.js","sources":["../../../../../src/components/agent-builder/utils/sourceIcons.ts"],"sourcesContent":["import BigCommerce from '@src/assets/icons/BigCommerce.svg';\nimport Gorgias from '@src/assets/icons/Gorgias.svg';\nimport ManifestGlass from '@src/assets/icons/ManifestGlass.svg';\nimport ShipStation from '@src/assets/icons/ShipStation.svg';\nimport Shopify from '@src/assets/icons/Shopify.svg';\nimport Skio from '@src/assets/icons/Skio.svg';\nimport {
|
|
1
|
+
{"version":3,"file":"sourceIcons.js","sources":["../../../../../src/components/agent-builder/utils/sourceIcons.ts"],"sourcesContent":["import BigCommerce from '@src/assets/icons/BigCommerce.svg';\nimport Gorgias from '@src/assets/icons/Gorgias.svg';\nimport ManifestGlass from '@src/assets/icons/ManifestGlass.svg';\nimport ShipStation from '@src/assets/icons/ShipStation.svg';\nimport Shopify from '@src/assets/icons/Shopify.svg';\nimport Skio from '@src/assets/icons/Skio.svg';\nimport {\n\tEmail,\n\tLinkSimpleHorizontal,\n\tPuzzlePiece,\n\tSlackIcon,\n\tWebhook,\n} from '@src/icons';\nimport React from 'react';\nimport { ToolSource } from '../constants/tools';\nimport type { IconComp, SourceIcon } from '../constants/tools';\n\n// The icon types live with the source enum (constants/tools) to keep the\n// dependency one-directional (util → constants); re-exported here so existing\n// `from '../utils/sourceIcons'` importers keep resolving them.\nexport type { IconComp, SourceIcon };\n\n/**\n * Per-source brand glyph — shared by the `@` picker and the Tools source\n * buttons. Partial: not every source has a glyph, and the render path\n * null-guards. Look up with {@link sourceIcon} when the key is a dynamic /\n * unknown string rather than a {@link ToolSource}.\n */\nexport const SOURCE_ICONS: Partial<Record<ToolSource, SourceIcon>> = {\n\t[ToolSource.Manifest]: { Icon: ManifestGlass, w: 24, h: 24 },\n\t[ToolSource.Shopify]: { Icon: Shopify, w: 21, h: 24 },\n\t[ToolSource.Bigcommerce]: { Icon: BigCommerce, w: 20, h: 20 },\n\t[ToolSource.Shipstation]: { Icon: ShipStation, w: 22, h: 21 },\n\t[ToolSource.Skio]: { Icon: Skio, w: 20, h: 20 },\n\t[ToolSource.Gorgias]: { Icon: Gorgias, w: 20, h: 20 },\n\t[ToolSource.Integration]: { Icon: PuzzlePiece as IconComp, w: 20, h: 20 },\n\t[ToolSource.RestApi]: { Icon: Webhook as IconComp, w: 20, h: 20 },\n\t[ToolSource.EmailHandover]: { Icon: Email as IconComp, w: 20, h: 20 },\n\t[ToolSource.Slack]: { Icon: SlackIcon as IconComp, w: 20, h: 20 },\n};\n\n/**\n * Generic glyph for a tool whose source has no dedicated brand icon (any custom\n * / future integration the FE doesn't bundle a logo for). Ensures EVERY tool\n * chip still leads with an icon.\n */\nexport const GENERIC_SOURCE_ICON: SourceIcon = {\n\tIcon: LinkSimpleHorizontal as IconComp,\n\tw: 20,\n\th: 20,\n};\n\n/**\n * Lenient icon lookup for a source that may be a raw/dynamic string (a\n * bik-models tool source, an integration key, or the picker's `'other'`\n * fallback). A known source returns its brand glyph; any other NON-EMPTY source\n * falls back to {@link GENERIC_SOURCE_ICON} so no tool renders iconless. An\n * empty/undefined source (e.g. a sub-agent reference) returns `undefined`.\n */\nexport const sourceIcon = (\n\tsource: string | undefined,\n): SourceIcon | undefined =>\n\tsource\n\t\t? SOURCE_ICONS[source as ToolSource] ?? GENERIC_SOURCE_ICON\n\t\t: undefined;\n\n/**\n * Render a {@link SourceIcon} at its own aspect ratio. `sizeDelta` nudges both\n * dimensions (e.g. `-4` for the smaller source-button glyph). Returns `null` when\n * no icon is supplied, so callers can drop their own `icon &&` guard.\n */\nexport const renderSourceIcon = (\n\ticon: SourceIcon | undefined,\n\tsizeDelta = 0,\n): React.ReactElement | null =>\n\ticon\n\t\t? React.createElement(icon.Icon, {\n\t\t\t\twidth: icon.w + sizeDelta,\n\t\t\t\theight: icon.h + sizeDelta,\n\t\t })\n\t\t: null;\n"],"names":["SOURCE_ICONS","ToolSource","ManifestGlass","Shopify","BigCommerce","ShipStation","Skio","Gorgias","PuzzlePiece","Webhook","Email","SlackIcon","GENERIC_SOURCE_ICON","LinkSimpleHorizontal","sourceIcon","source","renderSourceIcon","icon","sizeDelta","React"],"mappings":";;;;;;;;;;;;;AA4BO,MAAMA,IAAwD;AAAA,EACpE,CAACC,EAAW,QAAQ,GAAG,EAAE,MAAMC,GAAe,GAAG,IAAI,GAAG,GAAA;AAAA,EACxD,CAACD,EAAW,OAAO,GAAG,EAAE,MAAME,GAAS,GAAG,IAAI,GAAG,GAAA;AAAA,EACjD,CAACF,EAAW,WAAW,GAAG,EAAE,MAAMG,GAAa,GAAG,IAAI,GAAG,GAAA;AAAA,EACzD,CAACH,EAAW,WAAW,GAAG,EAAE,MAAMI,GAAa,GAAG,IAAI,GAAG,GAAA;AAAA,EACzD,CAACJ,EAAW,IAAI,GAAG,EAAE,MAAMK,GAAM,GAAG,IAAI,GAAG,GAAA;AAAA,EAC3C,CAACL,EAAW,OAAO,GAAG,EAAE,MAAMM,GAAS,GAAG,IAAI,GAAG,GAAA;AAAA,EACjD,CAACN,EAAW,WAAW,GAAG,EAAE,MAAMO,GAAyB,GAAG,IAAI,GAAG,GAAA;AAAA,EACrE,CAACP,EAAW,OAAO,GAAG,EAAE,MAAMQ,GAAqB,GAAG,IAAI,GAAG,GAAA;AAAA,EAC7D,CAACR,EAAW,aAAa,GAAG,EAAE,MAAMS,GAAmB,GAAG,IAAI,GAAG,GAAA;AAAA,EACjE,CAACT,EAAW,KAAK,GAAG,EAAE,MAAMU,GAAuB,GAAG,IAAI,GAAG,GAAA;AAC9D,GAOaC,IAAkC;AAAA,EAC9C,MAAMC;AAAAA,EACN,GAAG;AAAA,EACH,GAAG;AACJ,GASaC,IAAa,CACzBC,MAEAA,IACGf,EAAae,CAAoB,KAAKH,IACtC,QAOSI,IAAmB,CAC/BC,GACAC,IAAY,MAEZD,IACGE,EAAM,cAAcF,EAAK,MAAM;AAAA,EAC/B,OAAOA,EAAK,IAAIC;AAAA,EAChB,QAAQD,EAAK,IAAIC;AACjB,CAAC,IACD;"}
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import { jsx as t, jsxs as r } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { DropdownPopover as
|
|
2
|
+
import w from "../../assets/icons/delete.svg.js";
|
|
3
|
+
import x from "../../assets/icons/edit.svg.js";
|
|
4
|
+
import S from "../../assets/icons/playOutline.svg.js";
|
|
5
|
+
import T from "../../assets/icons/vertical_dots.svg.js";
|
|
6
|
+
import { DropdownPopover as D } from "../dropdown/DropdownPopover/index.js";
|
|
7
7
|
import { BikShimmer as C } from "../shimmer/ShimmerComponent/BikShimmer.js";
|
|
8
8
|
import { TitleSmall as L, BodyCaption as O, BodySecondary as p } from "../TypographyStyle.js";
|
|
9
|
+
import R from "../../utils/StringUtils.js";
|
|
9
10
|
import { COLORS as o } from "../../constants/Theme.js";
|
|
10
|
-
import { ActionButton as m, BodyGridRow as
|
|
11
|
+
import { ActionButton as m, BodyGridRow as B, Cell as n, ActionGroup as P } from "./AgentListing.styled.js";
|
|
11
12
|
import { Tooltip as h } from "../tooltips/Tooltip.js";
|
|
12
|
-
import { Tag as
|
|
13
|
-
import { unwrapDropdownValue as
|
|
14
|
-
const
|
|
13
|
+
import { Tag as $ } from "../tag/Tag.js";
|
|
14
|
+
import { unwrapDropdownValue as k } from "../dropdown/utils.js";
|
|
15
|
+
const j = (e) => {
|
|
15
16
|
switch (e.kind) {
|
|
16
17
|
case "topic":
|
|
17
|
-
return `Topic: ${
|
|
18
|
+
return `Topic: ${R.capitalize(
|
|
19
|
+
(e.label ?? "").replace(/_/g, " ")
|
|
20
|
+
)}`;
|
|
18
21
|
case "phrases":
|
|
19
22
|
return e.items?.length ? `Phrases: ${e.items.join(", ")}` : "Phrases";
|
|
20
23
|
default:
|
|
21
24
|
return e.label ?? "";
|
|
22
25
|
}
|
|
23
|
-
},
|
|
26
|
+
}, N = ({
|
|
24
27
|
agent: e,
|
|
25
28
|
onRunAgent: u,
|
|
26
29
|
onEditAgent: f,
|
|
@@ -28,13 +31,13 @@ const k = (e) => {
|
|
|
28
31
|
onRowClick: l,
|
|
29
32
|
triggerCountLoading: b
|
|
30
33
|
}) => {
|
|
31
|
-
const c = e.status === "live", d =
|
|
34
|
+
const c = e.status === "live", d = j(e.trigger), y = (i) => {
|
|
32
35
|
i.stopPropagation(), !e.isRunDisabled && u(e);
|
|
33
36
|
}, v = [
|
|
34
37
|
{
|
|
35
38
|
label: "Edit",
|
|
36
39
|
value: "edit",
|
|
37
|
-
leadingIcon: /* @__PURE__ */ t(
|
|
40
|
+
leadingIcon: /* @__PURE__ */ t(x, { width: 16, height: 16, color: o.content.secondary })
|
|
38
41
|
},
|
|
39
42
|
...a ? [
|
|
40
43
|
{
|
|
@@ -54,7 +57,7 @@ const k = (e) => {
|
|
|
54
57
|
},
|
|
55
58
|
children: [
|
|
56
59
|
/* @__PURE__ */ t(
|
|
57
|
-
|
|
60
|
+
w,
|
|
58
61
|
{
|
|
59
62
|
width: 16,
|
|
60
63
|
height: 16,
|
|
@@ -67,7 +70,7 @@ const k = (e) => {
|
|
|
67
70
|
)
|
|
68
71
|
}
|
|
69
72
|
] : []
|
|
70
|
-
],
|
|
73
|
+
], g = (i) => {
|
|
71
74
|
i === "edit" ? f(e) : i === "delete" && a?.(e);
|
|
72
75
|
}, s = /* @__PURE__ */ t(
|
|
73
76
|
m,
|
|
@@ -77,7 +80,7 @@ const k = (e) => {
|
|
|
77
80
|
onClick: y,
|
|
78
81
|
"aria-label": "Run agent",
|
|
79
82
|
children: /* @__PURE__ */ t(
|
|
80
|
-
|
|
83
|
+
S,
|
|
81
84
|
{
|
|
82
85
|
width: 20,
|
|
83
86
|
height: 20,
|
|
@@ -87,7 +90,7 @@ const k = (e) => {
|
|
|
87
90
|
}
|
|
88
91
|
);
|
|
89
92
|
return /* @__PURE__ */ r(
|
|
90
|
-
|
|
93
|
+
B,
|
|
91
94
|
{
|
|
92
95
|
"data-test": `agent-row-${e.id}`,
|
|
93
96
|
clickable: !!l,
|
|
@@ -115,14 +118,14 @@ const k = (e) => {
|
|
|
115
118
|
}
|
|
116
119
|
) : /* @__PURE__ */ t(p, { color: o.content.primary, children: e.triggerCount }) }),
|
|
117
120
|
/* @__PURE__ */ t(n, { children: /* @__PURE__ */ t(
|
|
118
|
-
|
|
121
|
+
$,
|
|
119
122
|
{
|
|
120
123
|
tagText: c ? "Live" : "Draft",
|
|
121
124
|
type: c ? "positive" : "neutral",
|
|
122
125
|
variant: "regular"
|
|
123
126
|
}
|
|
124
127
|
) }),
|
|
125
|
-
/* @__PURE__ */ t(n, { align: "center", children: /* @__PURE__ */ r(
|
|
128
|
+
/* @__PURE__ */ t(n, { align: "center", children: /* @__PURE__ */ r(P, { children: [
|
|
126
129
|
e.isRunDisabled && e.runDisabledTooltip ? /* @__PURE__ */ t(h, { body: e.runDisabledTooltip, placement: "top", children: /* @__PURE__ */ t("span", { style: { display: "flex" }, children: s }) }) : s,
|
|
127
130
|
/* @__PURE__ */ t(
|
|
128
131
|
"span",
|
|
@@ -130,20 +133,20 @@ const k = (e) => {
|
|
|
130
133
|
style: { display: "flex" },
|
|
131
134
|
onClick: (i) => i.stopPropagation(),
|
|
132
135
|
children: /* @__PURE__ */ t(
|
|
133
|
-
|
|
136
|
+
D,
|
|
134
137
|
{
|
|
135
138
|
"data-test": `agent-row-menu-${e.id}`,
|
|
136
139
|
options: v,
|
|
137
140
|
placement: "bottom-end",
|
|
138
141
|
width: "160px",
|
|
139
|
-
onSelect: (i) =>
|
|
142
|
+
onSelect: (i) => g(k(i)),
|
|
140
143
|
children: /* @__PURE__ */ t(
|
|
141
144
|
m,
|
|
142
145
|
{
|
|
143
146
|
"data-test": `agent-row-menu-button-${e.id}`,
|
|
144
147
|
"aria-label": "More actions",
|
|
145
148
|
children: /* @__PURE__ */ t(
|
|
146
|
-
|
|
149
|
+
T,
|
|
147
150
|
{
|
|
148
151
|
width: 20,
|
|
149
152
|
height: 20,
|
|
@@ -162,6 +165,6 @@ const k = (e) => {
|
|
|
162
165
|
);
|
|
163
166
|
};
|
|
164
167
|
export {
|
|
165
|
-
|
|
168
|
+
N as AgentTableRow
|
|
166
169
|
};
|
|
167
170
|
//# sourceMappingURL=AgentTableRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentTableRow.js","sources":["../../../../src/components/agent-listing/AgentTableRow.tsx"],"sourcesContent":["import DeleteIcon from '@src/assets/icons/delete.svg';\nimport EditIcon from '@src/assets/icons/edit.svg';\nimport PlayOutlineIcon from '@src/assets/icons/playOutline.svg';\nimport MoreIcon from '@src/assets/icons/vertical_dots.svg';\nimport React from 'react';\nimport { unwrapDropdownValue } from '@src/components/dropdown';\nimport { DropdownPopover } from '@src/components/dropdown/DropdownPopover';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport BikShimmer from '@src/components/shimmer/ShimmerComponent/BikShimmer';\nimport { Tag } from '@src/components/tag';\nimport { Tooltip } from '@src/components/tooltips';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { AgentListItem, AgentTriggerSummary } from './AgentListing.model';\nimport {\n\tActionButton,\n\tActionGroup,\n\tBodyGridRow,\n\tCell,\n} from './AgentListing.styled';\n\nconst triggerToText = (trigger: AgentTriggerSummary): string => {\n\tswitch (trigger.kind) {\n\t\tcase 'topic':\n\t\t\t// Intent keys arrive snake_cased (e.g. \"order_cancellation\"); show them\n\t\t\t// space-separated and lowercased so the trigger reads as plain words,\n\t\t\t// not a raw key.\n\t\t\treturn `Topic: ${(trigger.label ?? '').replace(/_/g, ' ').toLowerCase()}`;\n\t\tcase 'phrases':\n\t\t\t// No enumerable phrase list (free-text trigger) → just the word.\n\t\t\treturn trigger.items?.length\n\t\t\t\t? `Phrases: ${trigger.items.join(', ')}`\n\t\t\t\t: 'Phrases';\n\t\tcase 'custom':\n\t\tdefault:\n\t\t\treturn trigger.label ?? '';\n\t}\n};\n\ninterface AgentTableRowProps {\n\tagent: AgentListItem;\n\tonRunAgent: (agent: AgentListItem) => void;\n\tonEditAgent: (agent: AgentListItem) => void;\n\t/** When set, render a delete action (the listing handles confirmation). */\n\tonDeleteAgent?: (agent: AgentListItem) => void;\n\tonRowClick?: (agent: AgentListItem) => void;\n\t/** Shimmer the trigger-count cell while the analytics count is still loading. */\n\ttriggerCountLoading?: boolean;\n}\n\nexport const AgentTableRow: React.FC<AgentTableRowProps> = ({\n\tagent,\n\tonRunAgent,\n\tonEditAgent,\n\tonDeleteAgent,\n\tonRowClick,\n\ttriggerCountLoading,\n}) => {\n\tconst isLive = agent.status === 'live';\n\tconst triggerText = triggerToText(agent.trigger);\n\n\tconst handleRun = (e: React.MouseEvent) => {\n\t\te.stopPropagation();\n\t\tif (agent.isRunDisabled) {\n\t\t\treturn;\n\t\t}\n\t\tonRunAgent(agent);\n\t};\n\n\t// Edit + Delete live in the \"⋮\" menu beside the run button.\n\tconst menuOptions: SingleOption[] = [\n\t\t{\n\t\t\tlabel: 'Edit',\n\t\t\tvalue: 'edit',\n\t\t\tleadingIcon: (\n\t\t\t\t<EditIcon width={16} height={16} color={COLORS.content.secondary} />\n\t\t\t),\n\t\t},\n\t\t...(onDeleteAgent\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: 'Delete',\n\t\t\t\t\t\tvalue: 'delete',\n\t\t\t\t\t\t// Rendered red (icon + label) via customComponent.\n\t\t\t\t\t\tcustomComponent: (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tgap: 8,\n\t\t\t\t\t\t\t\t\tcolor: COLORS.content.negative,\n\t\t\t\t\t\t\t\t\tfontFamily: 'Inter',\n\t\t\t\t\t\t\t\t\tfontSize: 14,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DeleteIcon\n\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\tcolor={COLORS.content.negative}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\tDelete\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: []),\n\t];\n\n\tconst handleMenuSelect = (value: string | undefined) => {\n\t\tif (value === 'edit') {\n\t\t\tonEditAgent(agent);\n\t\t} else if (value === 'delete') {\n\t\t\tonDeleteAgent?.(agent);\n\t\t}\n\t};\n\n\tconst playButton = (\n\t\t<ActionButton\n\t\t\tdata-test={`agent-row-run-${agent.id}`}\n\t\t\tdisabled={agent.isRunDisabled}\n\t\t\tonClick={handleRun}\n\t\t\taria-label=\"Run agent\"\n\t\t>\n\t\t\t<PlayOutlineIcon\n\t\t\t\twidth={20}\n\t\t\t\theight={20}\n\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t/>\n\t\t</ActionButton>\n\t);\n\n\treturn (\n\t\t<BodyGridRow\n\t\t\tdata-test={`agent-row-${agent.id}`}\n\t\t\tclickable={!!onRowClick}\n\t\t\tonClick={onRowClick ? () => onRowClick(agent) : undefined}\n\t\t>\n\t\t\t<Cell>\n\t\t\t\t<TitleSmall numberOfLines={1} color={COLORS.content.primary}>\n\t\t\t\t\t{agent.name}\n\t\t\t\t</TitleSmall>\n\t\t\t\t<BodyCaption numberOfLines={1} color={COLORS.content.secondary}>\n\t\t\t\t\tCreated: {agent.createdAtLabel}\n\t\t\t\t</BodyCaption>\n\t\t\t</Cell>\n\n\t\t\t<Cell>\n\t\t\t\t{/* Cell truncates to 2 lines; the tooltip reveals the full trigger. */}\n\t\t\t\t<Tooltip body={triggerText} placement=\"top\">\n\t\t\t\t\t<BodySecondary numberOfLines={2} color={COLORS.content.primary}>\n\t\t\t\t\t\t{triggerText}\n\t\t\t\t\t</BodySecondary>\n\t\t\t\t</Tooltip>\n\t\t\t</Cell>\n\n\t\t\t<Cell align=\"right\">\n\t\t\t\t{triggerCountLoading ? (\n\t\t\t\t\t<BikShimmer\n\t\t\t\t\t\tboxes={[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\twidth: '48px',\n\t\t\t\t\t\t\t\theight: '16px',\n\t\t\t\t\t\t\t\tborderRadius: '4px',\n\t\t\t\t\t\t\t\tmarginTop: '0',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t{agent.triggerCount}\n\t\t\t\t\t</BodySecondary>\n\t\t\t\t)}\n\t\t\t</Cell>\n\n\t\t\t<Cell>\n\t\t\t\t<Tag\n\t\t\t\t\ttagText={isLive ? 'Live' : 'Draft'}\n\t\t\t\t\ttype={isLive ? 'positive' : 'neutral'}\n\t\t\t\t\tvariant=\"regular\"\n\t\t\t\t/>\n\t\t\t</Cell>\n\n\t\t\t<Cell align=\"center\">\n\t\t\t\t<ActionGroup>\n\t\t\t\t\t{agent.isRunDisabled && agent.runDisabledTooltip ? (\n\t\t\t\t\t\t<Tooltip body={agent.runDisabledTooltip} placement=\"top\">\n\t\t\t\t\t\t\t<span style={{ display: 'flex' }}>{playButton}</span>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tplayButton\n\t\t\t\t\t)}\n\t\t\t\t\t{/* Stop the row's onClick from firing when interacting with the menu. */}\n\t\t\t\t\t<span\n\t\t\t\t\t\tstyle={{ display: 'flex' }}\n\t\t\t\t\t\tonClick={(e) => e.stopPropagation()}\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownPopover\n\t\t\t\t\t\t\tdata-test={`agent-row-menu-${agent.id}`}\n\t\t\t\t\t\t\toptions={menuOptions}\n\t\t\t\t\t\t\tplacement=\"bottom-end\"\n\t\t\t\t\t\t\twidth=\"160px\"\n\t\t\t\t\t\t\tonSelect={(opt) => handleMenuSelect(unwrapDropdownValue(opt))}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ActionButton\n\t\t\t\t\t\t\t\tdata-test={`agent-row-menu-button-${agent.id}`}\n\t\t\t\t\t\t\t\taria-label=\"More actions\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<MoreIcon\n\t\t\t\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ActionButton>\n\t\t\t\t\t\t</DropdownPopover>\n\t\t\t\t\t</span>\n\t\t\t\t</ActionGroup>\n\t\t\t</Cell>\n\t\t</BodyGridRow>\n\t);\n};\n"],"names":["triggerToText","trigger","AgentTableRow","agent","onRunAgent","onEditAgent","onDeleteAgent","onRowClick","triggerCountLoading","isLive","triggerText","handleRun","e","menuOptions","jsx","EditIcon","COLORS","jsxs","DeleteIcon","handleMenuSelect","value","playButton","ActionButton","PlayOutlineIcon","BodyGridRow","Cell","TitleSmall","BodyCaption","Tooltip","BodySecondary","BikShimmer","Tag","ActionGroup","DropdownPopover","opt","unwrapDropdownValue","MoreIcon"],"mappings":";;;;;;;;;;;;;AAyBA,MAAMA,IAAgB,CAACC,MAA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O,QAAQ;AAAA,wBAAA;AAAA,sBAAA;AAAA,oBACvB;AAAA,kBAAA;AAAA,gBACD;AAAA,cAAA;AAAA,YACD;AAAA,UAAA;AAAA,QACD,EAAA,CACD,EAAA,CACD;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGH;"}
|
|
1
|
+
{"version":3,"file":"AgentTableRow.js","sources":["../../../../src/components/agent-listing/AgentTableRow.tsx"],"sourcesContent":["import DeleteIcon from '@src/assets/icons/delete.svg';\nimport EditIcon from '@src/assets/icons/edit.svg';\nimport PlayOutlineIcon from '@src/assets/icons/playOutline.svg';\nimport MoreIcon from '@src/assets/icons/vertical_dots.svg';\nimport React from 'react';\nimport { unwrapDropdownValue } from '@src/components/dropdown';\nimport { DropdownPopover } from '@src/components/dropdown/DropdownPopover';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport BikShimmer from '@src/components/shimmer/ShimmerComponent/BikShimmer';\nimport { Tag } from '@src/components/tag';\nimport { Tooltip } from '@src/components/tooltips';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport StringUtils from '@src/utils/StringUtils';\nimport { COLORS } from '@src/constants/Theme';\nimport { AgentListItem, AgentTriggerSummary } from './AgentListing.model';\nimport {\n\tActionButton,\n\tActionGroup,\n\tBodyGridRow,\n\tCell,\n} from './AgentListing.styled';\n\nconst triggerToText = (trigger: AgentTriggerSummary): string => {\n\tswitch (trigger.kind) {\n\t\tcase 'topic':\n\t\t\t// Intent keys arrive snake_cased (e.g. \"order_cancellation\"); show them\n\t\t\t// space-separated and sentence-cased (first letter capital) so the\n\t\t\t// trigger reads as plain words, not a raw key.\n\t\t\treturn `Topic: ${StringUtils.capitalize(\n\t\t\t\t(trigger.label ?? '').replace(/_/g, ' '),\n\t\t\t)}`;\n\t\tcase 'phrases':\n\t\t\t// No enumerable phrase list (free-text trigger) → just the word.\n\t\t\treturn trigger.items?.length\n\t\t\t\t? `Phrases: ${trigger.items.join(', ')}`\n\t\t\t\t: 'Phrases';\n\t\tcase 'custom':\n\t\tdefault:\n\t\t\treturn trigger.label ?? '';\n\t}\n};\n\ninterface AgentTableRowProps {\n\tagent: AgentListItem;\n\tonRunAgent: (agent: AgentListItem) => void;\n\tonEditAgent: (agent: AgentListItem) => void;\n\t/** When set, render a delete action (the listing handles confirmation). */\n\tonDeleteAgent?: (agent: AgentListItem) => void;\n\tonRowClick?: (agent: AgentListItem) => void;\n\t/** Shimmer the trigger-count cell while the analytics count is still loading. */\n\ttriggerCountLoading?: boolean;\n}\n\nexport const AgentTableRow: React.FC<AgentTableRowProps> = ({\n\tagent,\n\tonRunAgent,\n\tonEditAgent,\n\tonDeleteAgent,\n\tonRowClick,\n\ttriggerCountLoading,\n}) => {\n\tconst isLive = agent.status === 'live';\n\tconst triggerText = triggerToText(agent.trigger);\n\n\tconst handleRun = (e: React.MouseEvent) => {\n\t\te.stopPropagation();\n\t\tif (agent.isRunDisabled) {\n\t\t\treturn;\n\t\t}\n\t\tonRunAgent(agent);\n\t};\n\n\t// Edit + Delete live in the \"⋮\" menu beside the run button.\n\tconst menuOptions: SingleOption[] = [\n\t\t{\n\t\t\tlabel: 'Edit',\n\t\t\tvalue: 'edit',\n\t\t\tleadingIcon: (\n\t\t\t\t<EditIcon width={16} height={16} color={COLORS.content.secondary} />\n\t\t\t),\n\t\t},\n\t\t...(onDeleteAgent\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: 'Delete',\n\t\t\t\t\t\tvalue: 'delete',\n\t\t\t\t\t\t// Rendered red (icon + label) via customComponent.\n\t\t\t\t\t\tcustomComponent: (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tgap: 8,\n\t\t\t\t\t\t\t\t\tcolor: COLORS.content.negative,\n\t\t\t\t\t\t\t\t\tfontFamily: 'Inter',\n\t\t\t\t\t\t\t\t\tfontSize: 14,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DeleteIcon\n\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\tcolor={COLORS.content.negative}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\tDelete\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: []),\n\t];\n\n\tconst handleMenuSelect = (value: string | undefined) => {\n\t\tif (value === 'edit') {\n\t\t\tonEditAgent(agent);\n\t\t} else if (value === 'delete') {\n\t\t\tonDeleteAgent?.(agent);\n\t\t}\n\t};\n\n\tconst playButton = (\n\t\t<ActionButton\n\t\t\tdata-test={`agent-row-run-${agent.id}`}\n\t\t\tdisabled={agent.isRunDisabled}\n\t\t\tonClick={handleRun}\n\t\t\taria-label=\"Run agent\"\n\t\t>\n\t\t\t<PlayOutlineIcon\n\t\t\t\twidth={20}\n\t\t\t\theight={20}\n\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t/>\n\t\t</ActionButton>\n\t);\n\n\treturn (\n\t\t<BodyGridRow\n\t\t\tdata-test={`agent-row-${agent.id}`}\n\t\t\tclickable={!!onRowClick}\n\t\t\tonClick={onRowClick ? () => onRowClick(agent) : undefined}\n\t\t>\n\t\t\t<Cell>\n\t\t\t\t<TitleSmall numberOfLines={1} color={COLORS.content.primary}>\n\t\t\t\t\t{agent.name}\n\t\t\t\t</TitleSmall>\n\t\t\t\t<BodyCaption numberOfLines={1} color={COLORS.content.secondary}>\n\t\t\t\t\tCreated: {agent.createdAtLabel}\n\t\t\t\t</BodyCaption>\n\t\t\t</Cell>\n\n\t\t\t<Cell>\n\t\t\t\t{/* Cell truncates to 2 lines; the tooltip reveals the full trigger. */}\n\t\t\t\t<Tooltip body={triggerText} placement=\"top\">\n\t\t\t\t\t<BodySecondary numberOfLines={2} color={COLORS.content.primary}>\n\t\t\t\t\t\t{triggerText}\n\t\t\t\t\t</BodySecondary>\n\t\t\t\t</Tooltip>\n\t\t\t</Cell>\n\n\t\t\t<Cell align=\"right\">\n\t\t\t\t{triggerCountLoading ? (\n\t\t\t\t\t<BikShimmer\n\t\t\t\t\t\tboxes={[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\twidth: '48px',\n\t\t\t\t\t\t\t\theight: '16px',\n\t\t\t\t\t\t\t\tborderRadius: '4px',\n\t\t\t\t\t\t\t\tmarginTop: '0',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t{agent.triggerCount}\n\t\t\t\t\t</BodySecondary>\n\t\t\t\t)}\n\t\t\t</Cell>\n\n\t\t\t<Cell>\n\t\t\t\t<Tag\n\t\t\t\t\ttagText={isLive ? 'Live' : 'Draft'}\n\t\t\t\t\ttype={isLive ? 'positive' : 'neutral'}\n\t\t\t\t\tvariant=\"regular\"\n\t\t\t\t/>\n\t\t\t</Cell>\n\n\t\t\t<Cell align=\"center\">\n\t\t\t\t<ActionGroup>\n\t\t\t\t\t{agent.isRunDisabled && agent.runDisabledTooltip ? (\n\t\t\t\t\t\t<Tooltip body={agent.runDisabledTooltip} placement=\"top\">\n\t\t\t\t\t\t\t<span style={{ display: 'flex' }}>{playButton}</span>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tplayButton\n\t\t\t\t\t)}\n\t\t\t\t\t{/* Stop the row's onClick from firing when interacting with the menu. */}\n\t\t\t\t\t<span\n\t\t\t\t\t\tstyle={{ display: 'flex' }}\n\t\t\t\t\t\tonClick={(e) => e.stopPropagation()}\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownPopover\n\t\t\t\t\t\t\tdata-test={`agent-row-menu-${agent.id}`}\n\t\t\t\t\t\t\toptions={menuOptions}\n\t\t\t\t\t\t\tplacement=\"bottom-end\"\n\t\t\t\t\t\t\twidth=\"160px\"\n\t\t\t\t\t\t\tonSelect={(opt) => handleMenuSelect(unwrapDropdownValue(opt))}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ActionButton\n\t\t\t\t\t\t\t\tdata-test={`agent-row-menu-button-${agent.id}`}\n\t\t\t\t\t\t\t\taria-label=\"More actions\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<MoreIcon\n\t\t\t\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ActionButton>\n\t\t\t\t\t\t</DropdownPopover>\n\t\t\t\t\t</span>\n\t\t\t\t</ActionGroup>\n\t\t\t</Cell>\n\t\t</BodyGridRow>\n\t);\n};\n"],"names":["triggerToText","trigger","StringUtils","AgentTableRow","agent","onRunAgent","onEditAgent","onDeleteAgent","onRowClick","triggerCountLoading","isLive","triggerText","handleRun","e","menuOptions","jsx","EditIcon","COLORS","jsxs","DeleteIcon","handleMenuSelect","value","playButton","ActionButton","PlayOutlineIcon","BodyGridRow","Cell","TitleSmall","BodyCaption","Tooltip","BodySecondary","BikShimmer","Tag","ActionGroup","DropdownPopover","opt","unwrapDropdownValue","MoreIcon"],"mappings":";;;;;;;;;;;;;;AA0BA,MAAMA,IAAgB,CAACC,MAAyC;AAC/D,UAAQA,EAAQ,MAAA;AAAA,IACf,KAAK;AAIJ,aAAO,UAAUC,EAAY;AAAA,SAC3BD,EAAQ,SAAS,IAAI,QAAQ,MAAM,GAAG;AAAA,MAAA,CACvC;AAAA,IACF,KAAK;AAEJ,aAAOA,EAAQ,OAAO,SACnB,YAAYA,EAAQ,MAAM,KAAK,IAAI,CAAC,KACpC;AAAA,IAEJ;AACC,aAAOA,EAAQ,SAAS;AAA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import { ZeroState as i } from "../zeroState/ZeroState.js";
|
|
3
|
-
const
|
|
3
|
+
const r = ({
|
|
4
4
|
emptyState: t,
|
|
5
5
|
onNewAgent: o
|
|
6
6
|
}) => /* @__PURE__ */ e(
|
|
7
7
|
i,
|
|
8
8
|
{
|
|
9
9
|
title: t?.title ?? "No agents yet",
|
|
10
|
+
subTitleMaxWidth: 580,
|
|
10
11
|
subTitle: t?.subTitle ?? "Create your first AI agent to start automating conversations.",
|
|
11
12
|
actionButton: t?.actionButton ?? {
|
|
12
13
|
buttonText: "New AI agent",
|
|
@@ -17,6 +18,6 @@ const a = ({
|
|
|
17
18
|
}
|
|
18
19
|
);
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
+
r as AiAgentsEmptyState
|
|
21
22
|
};
|
|
22
23
|
//# sourceMappingURL=AiAgentsEmptyState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiAgentsEmptyState.js","sources":["../../../../src/components/agent-listing/AiAgentsEmptyState.tsx"],"sourcesContent":["import React from 'react';\nimport { ButtonProps } from '@src/components/button/model';\nimport { ZeroState } from '@src/components/zeroState/ZeroState';\n\nexport interface AiAgentsEmptyStateProps {\n\t/**\n\t * Overrides for the default copy / CTA — e.g. the search-miss variant passes\n\t * \"No results found …\". Any omitted field falls back to the \"no agents yet\"\n\t * defaults below.\n\t */\n\temptyState?: {\n\t\ttitle?: string;\n\t\tsubTitle?: string;\n\t\tactionButton?: ButtonProps;\n\t};\n\t/** Runs the default \"New AI agent\" CTA when no override button is supplied. */\n\tonNewAgent: () => void;\n}\n\n/**\n * Zero state for the AI Agents listing — shown when there are no agents yet or a\n * search returns no hits. Renders the shared {@link ZeroState} with AI-agents\n * defaults; a consumer-supplied `emptyState` overrides any of the copy / CTA.\n */\nexport const AiAgentsEmptyState: React.FC<AiAgentsEmptyStateProps> = ({\n\temptyState,\n\tonNewAgent,\n}) => (\n\t<ZeroState\n\t\ttitle={emptyState?.title ?? 'No agents yet'}\n\t\tsubTitle={\n\t\t\temptyState?.subTitle ??\n\t\t\t'Create your first AI agent to start automating conversations.'\n\t\t}\n\t\tactionButton={\n\t\t\temptyState?.actionButton ?? {\n\t\t\t\tbuttonText: 'New AI agent',\n\t\t\t\tbuttonType: 'primary',\n\t\t\t\tsize: 'small',\n\t\t\t\tonClick: onNewAgent,\n\t\t\t}\n\t\t}\n\t/>\n);\n"],"names":["AiAgentsEmptyState","emptyState","onNewAgent","jsx","ZeroState"],"mappings":";;AAwBO,MAAMA,IAAwD,CAAC;AAAA,EACrE,YAAAC;AAAA,EACA,YAAAC;AACD,MACC,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACA,OAAOH,GAAY,SAAS;AAAA,
|
|
1
|
+
{"version":3,"file":"AiAgentsEmptyState.js","sources":["../../../../src/components/agent-listing/AiAgentsEmptyState.tsx"],"sourcesContent":["import React from 'react';\nimport { ButtonProps } from '@src/components/button/model';\nimport { ZeroState } from '@src/components/zeroState/ZeroState';\n\nexport interface AiAgentsEmptyStateProps {\n\t/**\n\t * Overrides for the default copy / CTA — e.g. the search-miss variant passes\n\t * \"No results found …\". Any omitted field falls back to the \"no agents yet\"\n\t * defaults below.\n\t */\n\temptyState?: {\n\t\ttitle?: string;\n\t\tsubTitle?: string;\n\t\tactionButton?: ButtonProps;\n\t};\n\t/** Runs the default \"New AI agent\" CTA when no override button is supplied. */\n\tonNewAgent: () => void;\n}\n\n/**\n * Zero state for the AI Agents listing — shown when there are no agents yet or a\n * search returns no hits. Renders the shared {@link ZeroState} with AI-agents\n * defaults; a consumer-supplied `emptyState` overrides any of the copy / CTA.\n */\nexport const AiAgentsEmptyState: React.FC<AiAgentsEmptyStateProps> = ({\n\temptyState,\n\tonNewAgent,\n}) => (\n\t<ZeroState\n\t\ttitle={emptyState?.title ?? 'No agents yet'}\n\t\t// Wider than the default so the search-miss copy sits on fewer lines.\n\t\tsubTitleMaxWidth={580}\n\t\tsubTitle={\n\t\t\temptyState?.subTitle ??\n\t\t\t'Create your first AI agent to start automating conversations.'\n\t\t}\n\t\tactionButton={\n\t\t\temptyState?.actionButton ?? {\n\t\t\t\tbuttonText: 'New AI agent',\n\t\t\t\tbuttonType: 'primary',\n\t\t\t\tsize: 'small',\n\t\t\t\tonClick: onNewAgent,\n\t\t\t}\n\t\t}\n\t/>\n);\n"],"names":["AiAgentsEmptyState","emptyState","onNewAgent","jsx","ZeroState"],"mappings":";;AAwBO,MAAMA,IAAwD,CAAC;AAAA,EACrE,YAAAC;AAAA,EACA,YAAAC;AACD,MACC,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACA,OAAOH,GAAY,SAAS;AAAA,IAE5B,kBAAkB;AAAA,IAClB,UACCA,GAAY,YACZ;AAAA,IAED,cACCA,GAAY,gBAAgB;AAAA,MAC3B,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,MAAM;AAAA,MACN,SAASC;AAAA,IAAA;AAAA,EACV;AAEF;"}
|
|
@@ -4,9 +4,9 @@ import k from "../../assets/icons/check.svg.js";
|
|
|
4
4
|
import v from "../../assets/icons/cross.svg.js";
|
|
5
5
|
import I from "../../assets/icons/errorInfo.svg.js";
|
|
6
6
|
import S from "../../assets/icons/info.svg.js";
|
|
7
|
-
import P, { useRef as R, useState as
|
|
8
|
-
import
|
|
9
|
-
import { cssTransition as
|
|
7
|
+
import P, { useRef as R, useState as T, useEffect as h, useContext as D } from "react";
|
|
8
|
+
import L from "react-dom";
|
|
9
|
+
import { cssTransition as W, toast as r, ToastContainer as E } from "react-toastify";
|
|
10
10
|
import { ToasterStyled as _ } from "./Toaster.styled.js";
|
|
11
11
|
import { TitleSmall as O, BodySecondary as b, BodyCaption as G } from "../TypographyStyle.js";
|
|
12
12
|
import { COLORS as n } from "../../constants/Theme.js";
|
|
@@ -26,25 +26,25 @@ const z = (t) => /* @__PURE__ */ s(
|
|
|
26
26
|
]
|
|
27
27
|
}
|
|
28
28
|
), y = (t) => {
|
|
29
|
-
const o = t.type === "default" ? n.content.primary : t.type === "success" ? n.content.positive : t.type === "error" ? n.content.negative : t.type === "warning" ? n.content.warning : n.content.brand, [i,
|
|
29
|
+
const o = t.type === "default" ? n.content.primary : t.type === "success" ? n.content.positive : t.type === "error" ? n.content.negative : t.type === "warning" ? n.content.warning : n.content.brand, [i, c] = T(t.duration || -1);
|
|
30
30
|
h(() => {
|
|
31
31
|
if (!t.duration || t.duration <= 0) {
|
|
32
|
-
|
|
32
|
+
c(-1);
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
35
|
+
c(t.duration);
|
|
36
|
+
const a = setInterval(() => {
|
|
37
|
+
c((B) => {
|
|
38
38
|
const f = B - 1;
|
|
39
|
-
return f <= 0 ? (clearInterval(
|
|
39
|
+
return f <= 0 ? (clearInterval(a), -1) : f;
|
|
40
40
|
});
|
|
41
41
|
}, 1e3);
|
|
42
|
-
return () => clearInterval(
|
|
42
|
+
return () => clearInterval(a);
|
|
43
43
|
}, [t.duration]);
|
|
44
44
|
const l = t.blocking && i === -1 ? !1 : t.blocking && i > 0, d = () => {
|
|
45
45
|
!l && t.closeToast && t.closeToast();
|
|
46
|
-
}, u = (
|
|
47
|
-
|
|
46
|
+
}, u = (a) => {
|
|
47
|
+
a.key === "Enter" && !l && t.closeToast && t.closeToast();
|
|
48
48
|
};
|
|
49
49
|
return /* @__PURE__ */ e(
|
|
50
50
|
"div",
|
|
@@ -56,14 +56,19 @@ const z = (t) => /* @__PURE__ */ s(
|
|
|
56
56
|
display: "flex",
|
|
57
57
|
cursor: l ? "not-allowed" : "pointer",
|
|
58
58
|
alignSelf: `${t.alignTop ? "flex-start" : "center"}`,
|
|
59
|
-
opacity: l ? 0.5 : 1
|
|
59
|
+
opacity: l ? 0.5 : 1,
|
|
60
|
+
// Pin to the toast's right edge. react-toastify clones this element
|
|
61
|
+
// without adding the `Toastify__close-button` class, so the toast's
|
|
62
|
+
// own stylesheet cannot position it.
|
|
63
|
+
marginLeft: "auto",
|
|
64
|
+
flexShrink: 0
|
|
60
65
|
},
|
|
61
66
|
onClick: d,
|
|
62
67
|
onKeyDown: u,
|
|
63
68
|
children: i > 0 ? /* @__PURE__ */ e(z, { duration: i }) : /* @__PURE__ */ e(v, { height: 20, width: 20, color: o })
|
|
64
69
|
}
|
|
65
70
|
);
|
|
66
|
-
},
|
|
71
|
+
}, g = (t) => {
|
|
67
72
|
const o = n.content.placeholder, { toasterText: i } = D(m);
|
|
68
73
|
return /* @__PURE__ */ e(w, { children: /* @__PURE__ */ s(
|
|
69
74
|
"div",
|
|
@@ -162,21 +167,21 @@ const z = (t) => /* @__PURE__ */ s(
|
|
|
162
167
|
}
|
|
163
168
|
) });
|
|
164
169
|
}, X = (t) => {
|
|
165
|
-
const o = R(t.toastId || "default-toast"), [i,
|
|
170
|
+
const o = R(t.toastId || "default-toast"), [i, c] = T(t.text), l = W({
|
|
166
171
|
enter: "Toastify__slide-enter",
|
|
167
172
|
exit: "Toastify__slide-exit"
|
|
168
173
|
}), d = t.type === "default" ? null : t.type === "success" ? /* @__PURE__ */ e(k, { width: 20, height: 20, color: n.content.positive }) : t.type === "error" ? /* @__PURE__ */ e(I, { width: 20, height: 20, color: n.content.negative }) : t.type === "warning" ? /* @__PURE__ */ e(C, { width: 20, height: 20, color: n.content.warning }) : /* @__PURE__ */ e(S, { width: 20, height: 20, color: n.content.brand });
|
|
169
174
|
h(() => {
|
|
170
|
-
o.current && o.current === t.toastId ? (
|
|
175
|
+
o.current && o.current === t.toastId ? (c(t.text), r.update(o.current, {
|
|
171
176
|
autoClose: t.autoClose
|
|
172
177
|
})) : o.current && o.current !== t.toastId && u(t.text);
|
|
173
178
|
}, [t.toastId, t.text]);
|
|
174
|
-
const u = (
|
|
179
|
+
const u = (a) => {
|
|
175
180
|
t.hideLeftIcon !== void 0 || t.leftIcon ? r(
|
|
176
181
|
/* @__PURE__ */ e(
|
|
177
|
-
|
|
182
|
+
g,
|
|
178
183
|
{
|
|
179
|
-
toastText:
|
|
184
|
+
toastText: a,
|
|
180
185
|
type: t.type || "info",
|
|
181
186
|
buttonText: t.buttonProps?.buttonText,
|
|
182
187
|
secondButtonText: t.secondButtonProps?.buttonText,
|
|
@@ -191,7 +196,7 @@ const z = (t) => /* @__PURE__ */ s(
|
|
|
191
196
|
onClose: t.onCloseToast ? t.onCloseToast : () => ({}),
|
|
192
197
|
icon: t.hideLeftIcon === !0 ? !1 : t.leftIcon ? t.leftIcon : t.type === "default" ? !1 : /* @__PURE__ */ e("div", { style: { display: "flex", alignItems: "flex-start" }, children: d }),
|
|
193
198
|
type: t.type,
|
|
194
|
-
closeButton: /* @__PURE__ */ e(
|
|
199
|
+
closeButton: t.hideCloseButton ? !1 : /* @__PURE__ */ e(
|
|
195
200
|
y,
|
|
196
201
|
{
|
|
197
202
|
type: t.type || "default",
|
|
@@ -205,9 +210,9 @@ const z = (t) => /* @__PURE__ */ s(
|
|
|
205
210
|
}
|
|
206
211
|
) : o.current = r(
|
|
207
212
|
/* @__PURE__ */ e(
|
|
208
|
-
|
|
213
|
+
g,
|
|
209
214
|
{
|
|
210
|
-
toastText:
|
|
215
|
+
toastText: a,
|
|
211
216
|
type: t.type || "info",
|
|
212
217
|
buttonText: t.buttonProps?.buttonText,
|
|
213
218
|
secondButtonText: t.secondButtonProps?.buttonText,
|
|
@@ -222,7 +227,7 @@ const z = (t) => /* @__PURE__ */ s(
|
|
|
222
227
|
onClose: t.onCloseToast ? t.onCloseToast : () => ({}),
|
|
223
228
|
type: t.type,
|
|
224
229
|
icon: t.type === "default" ? !1 : /* @__PURE__ */ e("div", { style: { display: "flex", alignItems: "flex-start" }, children: d }),
|
|
225
|
-
closeButton: /* @__PURE__ */ e(
|
|
230
|
+
closeButton: t.hideCloseButton ? !1 : /* @__PURE__ */ e(
|
|
226
231
|
y,
|
|
227
232
|
{
|
|
228
233
|
type: t.type || "default",
|
|
@@ -238,7 +243,7 @@ const z = (t) => /* @__PURE__ */ s(
|
|
|
238
243
|
};
|
|
239
244
|
return h(() => {
|
|
240
245
|
u();
|
|
241
|
-
}, []),
|
|
246
|
+
}, []), L.createPortal(
|
|
242
247
|
/* @__PURE__ */ e(
|
|
243
248
|
_,
|
|
244
249
|
{
|
|
@@ -248,7 +253,7 @@ const z = (t) => /* @__PURE__ */ s(
|
|
|
248
253
|
isSubTextIncluded: !!t.subText,
|
|
249
254
|
type: t.type,
|
|
250
255
|
children: /* @__PURE__ */ e(m.Provider, { value: { toasterText: i }, children: /* @__PURE__ */ e(
|
|
251
|
-
|
|
256
|
+
E,
|
|
252
257
|
{
|
|
253
258
|
position: t.position || "top-right",
|
|
254
259
|
closeOnClick: t.closeOnClick || !1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toaster.js","sources":["../../../../src/components/toaster/Toaster.tsx"],"sourcesContent":["import AlertTriangle from '@src/assets/icons/alert_triangle.svg';\nimport Check from '@src/assets/icons/check.svg';\nimport Cross from '@src/assets/icons/cross.svg';\nimport Error from '@src/assets/icons/errorInfo.svg';\nimport Info from '@src/assets/icons/info.svg';\nimport React, {\n\tFunctionComponent,\n\tuseContext,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport ReactDOM from 'react-dom';\nimport {\n\tcssTransition,\n\tId,\n\ttoast,\n\tToastContainer,\n\tToastPosition,\n\tTypeOptions,\n} from 'react-toastify';\nimport { IconProps } from 'react-toastify/dist/components';\nimport { Button } from '@src/components/button';\nimport { ToasterStyled } from '@src/components/toaster/Toaster.styled';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\n\nexport type ToasterButtonProps = {\n\tshowButton?: boolean;\n\tonButtonClick?: () => Record<string, never>;\n\tbuttonText?: string;\n};\nexport type ToasterProps = {\n\ttext: string;\n\tsubText?: string;\n\tposition?: ToastPosition;\n\ttype?: 'info' | 'success' | 'error' | 'default' | 'warning';\n\tduration?: number;\n\tblocking?: boolean;\n\tcloseOnClick?: boolean;\n\thideProgressBar?: boolean;\n\tautoClose?: number | false | undefined;\n\tleftIcon?: React.ReactElement<IconProps>;\n\thideLeftIcon?: boolean;\n\tbuttonProps?: ToasterButtonProps;\n\tsecondButtonProps?: ToasterButtonProps;\n\tonCloseToast?: <T>(props: T) => void;\n\twidth?: string;\n\theight?: string;\n\thideCloseButton?: boolean;\n\tzIndex?: number;\n\ttoastId?: string;\n};\n\nconst CountDownBar: React.FC<{ duration: number }> = (props) => {\n\treturn (\n\t\t<BodySecondary\n\t\t\tcolor={`#9E9E9E`}\n\t\t\tcustomStyles={{\n\t\t\t\tfontWeight: 600,\n\t\t\t\tfontSize: 14,\n\t\t\t\twidth: 25,\n\t\t\t}}\n\t\t>\n\t\t\t{props.duration}s\n\t\t</BodySecondary>\n\t);\n};\n\nconst CloseButton: React.FC<{\n\ttype: string;\n\tcloseToast?: () => Record<string, never>;\n\talignTop?: boolean;\n\tblocking?: boolean;\n\tduration?: number;\n}> = (props) => {\n\tconst iconColor =\n\t\tprops.type === 'default'\n\t\t\t? COLORS.content.primary\n\t\t\t: props.type === 'success'\n\t\t\t? COLORS.content.positive\n\t\t\t: props.type === 'error'\n\t\t\t? COLORS.content.negative\n\t\t\t: props.type === 'warning'\n\t\t\t? COLORS.content.warning\n\t\t\t: COLORS.content.brand;\n\n\t// Each CloseButton has its own independent timer\n\tconst [timerValue, setTimerValue] = useState<number>(props.duration || -1);\n\n\tuseEffect(() => {\n\t\tif (!props.duration || props.duration <= 0) {\n\t\t\tsetTimerValue(-1);\n\t\t\treturn;\n\t\t}\n\n\t\tsetTimerValue(props.duration);\n\n\t\tconst interval = setInterval(() => {\n\t\t\tsetTimerValue((prev) => {\n\t\t\t\tconst next = prev - 1;\n\t\t\t\tif (next <= 0) {\n\t\t\t\t\tclearInterval(interval);\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\treturn next;\n\t\t\t});\n\t\t}, 1000);\n\n\t\treturn () => clearInterval(interval);\n\t}, [props.duration]);\n\n\t// Enable button when timerValue is -1, otherwise check blocking and timer\n\tconst isDisabled =\n\t\tprops.blocking && timerValue === -1\n\t\t\t? false\n\t\t\t: props.blocking && timerValue > 0;\n\n\tconst handleClick = () => {\n\t\tif (!isDisabled && props.closeToast) {\n\t\t\tprops.closeToast();\n\t\t}\n\t};\n\n\tconst handleKeyDown = (e: React.KeyboardEvent) => {\n\t\tif (e.key === 'Enter' && !isDisabled && props.closeToast) {\n\t\t\tprops.closeToast();\n\t\t}\n\t};\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={isDisabled ? -1 : 0}\n\t\t\trole={'button'}\n\t\t\tstyle={{\n\t\t\t\twidth: timerValue > 0 ? 25 : 20,\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tcursor: isDisabled ? 'not-allowed' : 'pointer',\n\t\t\t\talignSelf: `${props.alignTop ? 'flex-start' : 'center'}`,\n\t\t\t\topacity: isDisabled ? 0.5 : 1,\n\t\t\t}}\n\t\t\tonClick={handleClick}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t>\n\t\t\t{timerValue > 0 ? (\n\t\t\t\t<CountDownBar duration={timerValue} />\n\t\t\t) : (\n\t\t\t\t<Cross height={20} width={20} color={iconColor} />\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nconst RenderContent: React.FC<{\n\ttoastText?: string;\n\ttype: TypeOptions;\n\tshowButton?: boolean;\n\tshowSecondButton?: boolean;\n\tonButtonClick?: () => Record<string, never>;\n\tonSecondButtonClick?: () => Record<string, never>;\n\tbuttonText?: string;\n\tsecondButtonText?: string;\n\tsubText?: string;\n}> = (props) => {\n\tconst strokeColor = COLORS.content.placeholder;\n\n\tconst { toasterText: toasterTextContext } = useContext(ToastContext);\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tflexGrow: 1,\n\t\t\t\t\tmaxWidth: '100%',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tflexGrow: 1,\n\t\t\t\t\t\tmarginRight: 16,\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\tminWidth: 0,\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\tminWidth: 0,\n\t\t\t\t\t\t\twordBreak: 'break-word',\n\t\t\t\t\t\t\toverflowWrap: 'break-word',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{props.subText ? (\n\t\t\t\t\t\t\t<TitleSmall color={'inherit'}>\n\t\t\t\t\t\t\t\t{/* In normal scenarios, we use the text from prop. As a special case, when we need to change the text in already rendered toast, we change the text in context and let this component render on its own */}\n\t\t\t\t\t\t\t\t{props.toastText ?? toasterTextContext}\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<BodySecondary color={'inherit'}>\n\t\t\t\t\t\t\t\t{/* In normal scenarios, we use the text from prop. As a special case, when we need to change the text in already rendered toast, we change the text in context and let this component render on its own */}\n\t\t\t\t\t\t\t\t{props.toastText ?? toasterTextContext}\n\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{props.subText && (\n\t\t\t\t\t\t\t<div style={{ marginTop: 2 }}>\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\t\t{props.subText}\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t{props.showButton && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\t\t\talignSelf: 'center',\n\t\t\t\t\t\t\tpadding: '6px 0px',\n\t\t\t\t\t\t\tminWidth: props.subText ? 'fit-content' : 'auto',\n\t\t\t\t\t\t\tmarginRight: props.showSecondButton ? 4 : 0,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tbuttonText={props.buttonText}\n\t\t\t\t\t\t\tbuttonType={'tertiaryGray'}\n\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\tonClick={props.onButtonClick}\n\t\t\t\t\t\t></Button>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t{props.showSecondButton && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\t\t\talignSelf: 'center',\n\t\t\t\t\t\t\tpadding: '6px 0px',\n\t\t\t\t\t\t\tminWidth: props.subText ? 'fit-content' : 'auto',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tbuttonText={props.secondButtonText}\n\t\t\t\t\t\t\tbuttonType={'tertiaryGray'}\n\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\tonClick={props.onSecondButtonClick}\n\t\t\t\t\t\t></Button>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t{!(props.showButton || props.showSecondButton) ? null : (\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\theight: 28,\n\t\t\t\t\t\t\talignSelf: 'center',\n\t\t\t\t\t\t\tmarginLeft: 8,\n\t\t\t\t\t\t\tmarginRight: 8,\n\t\t\t\t\t\t\tborderRight: `1px solid ${strokeColor}`,\n\t\t\t\t\t\t\tborderRadius: 1,\n\t\t\t\t\t\t}}\n\t\t\t\t\t></div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</>\n\t);\n};\n\ntype Props = ToasterProps;\n\nexport const Toaster: FunctionComponent<Props> = (props) => {\n\tconst toastId = useRef<Id>(props.toastId || 'default-toast');\n\tconst [toastLocal, setToastLocal] = useState(props.text);\n\tconst bounce = cssTransition({\n\t\tenter: 'Toastify__slide-enter',\n\t\texit: 'Toastify__slide-exit',\n\t});\n\n\tconst leftIcon =\n\t\tprops.type === 'default' ? null : props.type === 'success' ? (\n\t\t\t<Check width={20} height={20} color={COLORS.content.positive} />\n\t\t) : props.type === 'error' ? (\n\t\t\t<Error width={20} height={20} color={COLORS.content.negative} />\n\t\t) : props.type === 'warning' ? (\n\t\t\t<AlertTriangle width={20} height={20} color={COLORS.content.warning} />\n\t\t) : (\n\t\t\t<Info width={20} height={20} color={COLORS.content.brand} />\n\t\t);\n\n\tuseEffect(() => {\n\t\t// When toast id is same but text needed to change, we change the text in context and let the toast re-render on its own.\n\t\tif (toastId.current && toastId.current === props.toastId) {\n\t\t\tsetToastLocal(props.text);\n\t\t\ttoast.update(toastId.current, {\n\t\t\t\tautoClose: props.autoClose,\n\t\t\t});\n\t\t\t// If toast ids are different, we call notify again which will stack the toasts up\n\t\t} else if (toastId.current && toastId.current !== props.toastId) {\n\t\t\tnotify(props.text);\n\t\t}\n\t}, [props.toastId, props.text]);\n\n\tconst notify = (toastText?: string) => {\n\t\tif (props.hideLeftIcon !== undefined || props.leftIcon) {\n\t\t\ttoast(\n\t\t\t\t<RenderContent\n\t\t\t\t\ttoastText={toastText}\n\t\t\t\t\ttype={props.type || 'info'}\n\t\t\t\t\tbuttonText={props.buttonProps?.buttonText}\n\t\t\t\t\tsecondButtonText={props.secondButtonProps?.buttonText}\n\t\t\t\t\tshowButton={props.buttonProps?.showButton}\n\t\t\t\t\tshowSecondButton={props.secondButtonProps?.showButton}\n\t\t\t\t\tonButtonClick={props.buttonProps?.onButtonClick}\n\t\t\t\t\tonSecondButtonClick={props.secondButtonProps?.onButtonClick}\n\t\t\t\t\tsubText={props.subText}\n\t\t\t\t/>,\n\t\t\t\t{\n\t\t\t\t\tonClose: props.onCloseToast ? props.onCloseToast : () => ({}),\n\t\t\t\t\ticon:\n\t\t\t\t\t\tprops.hideLeftIcon === true ? (\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t) : props.leftIcon ? (\n\t\t\t\t\t\t\tprops.leftIcon\n\t\t\t\t\t\t) : props.type === 'default' ? (\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div style={{ display: 'flex', alignItems: 'flex-start' }}>\n\t\t\t\t\t\t\t\t{leftIcon}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\ttype: props.type,\n\t\t\t\t\tcloseButton: (\n\t\t\t\t\t\t<CloseButton\n\t\t\t\t\t\t\ttype={props.type || 'default'}\n\t\t\t\t\t\t\talignTop={\n\t\t\t\t\t\t\t\t!!(\n\t\t\t\t\t\t\t\t\tprops.subText &&\n\t\t\t\t\t\t\t\t\t!(\n\t\t\t\t\t\t\t\t\t\tprops.buttonProps?.showButton ||\n\t\t\t\t\t\t\t\t\t\tprops.secondButtonProps?.showButton\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tblocking={props.blocking}\n\t\t\t\t\t\t\tduration={props.duration}\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\ttoastId: props.toastId || 'default-toast',\n\t\t\t\t\ttransition: bounce,\n\t\t\t\t},\n\t\t\t);\n\t\t} else {\n\t\t\ttoastId.current = toast(\n\t\t\t\t<RenderContent\n\t\t\t\t\ttoastText={toastText}\n\t\t\t\t\ttype={props.type || 'info'}\n\t\t\t\t\tbuttonText={props.buttonProps?.buttonText}\n\t\t\t\t\tsecondButtonText={props.secondButtonProps?.buttonText}\n\t\t\t\t\tshowButton={props.buttonProps?.showButton}\n\t\t\t\t\tshowSecondButton={props.secondButtonProps?.showButton}\n\t\t\t\t\tonButtonClick={props.buttonProps?.onButtonClick}\n\t\t\t\t\tonSecondButtonClick={props.secondButtonProps?.onButtonClick}\n\t\t\t\t\tsubText={props.subText}\n\t\t\t\t/>,\n\t\t\t\t{\n\t\t\t\t\tonClose: props.onCloseToast ? props.onCloseToast : () => ({}),\n\t\t\t\t\ttype: props.type,\n\t\t\t\t\ticon:\n\t\t\t\t\t\tprops.type === 'default' ? (\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div style={{ display: 'flex', alignItems: 'flex-start' }}>\n\t\t\t\t\t\t\t\t{leftIcon}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\tcloseButton: (\n\t\t\t\t\t\t<CloseButton\n\t\t\t\t\t\t\ttype={props.type || 'default'}\n\t\t\t\t\t\t\talignTop={\n\t\t\t\t\t\t\t\t!!(\n\t\t\t\t\t\t\t\t\tprops.subText &&\n\t\t\t\t\t\t\t\t\t!(\n\t\t\t\t\t\t\t\t\t\tprops.buttonProps?.showButton ||\n\t\t\t\t\t\t\t\t\t\tprops.secondButtonProps?.showButton\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tblocking={props.blocking}\n\t\t\t\t\t\t\tduration={props.duration}\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\ttoastId: props.toastId || 'default-toast',\n\t\t\t\t\ttransition: bounce,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t};\n\n\tuseEffect(() => {\n\t\tnotify();\n\t}, []);\n\n\treturn ReactDOM.createPortal(\n\t\t<ToasterStyled\n\t\t\twidth={props.width}\n\t\t\theight={props.height}\n\t\t\tzIndex={props.zIndex}\n\t\t\tisSubTextIncluded={!!props.subText}\n\t\t\ttype={props.type}\n\t\t>\n\t\t\t<ToastContext.Provider value={{ toasterText: toastLocal }}>\n\t\t\t\t<ToastContainer\n\t\t\t\t\tposition={props.position || 'top-right'}\n\t\t\t\t\tcloseOnClick={props.closeOnClick || false}\n\t\t\t\t\thideProgressBar={props.hideProgressBar || false}\n\t\t\t\t\tdraggable={false}\n\t\t\t\t\tautoClose={props.autoClose || false}\n\t\t\t\t\ttheme={'colored'}\n\t\t\t\t/>\n\t\t\t</ToastContext.Provider>\n\t\t</ToasterStyled>,\n\t\tdocument.body,\n\t);\n};\n\nconst ToastContext = React.createContext({\n\ttoasterText: '',\n});\n"],"names":["CountDownBar","props","jsxs","BodySecondary","CloseButton","iconColor","COLORS","timerValue","setTimerValue","useState","useEffect","interval","prev","next","isDisabled","handleClick","handleKeyDown","e","jsx","Cross","RenderContent","strokeColor","toasterTextContext","useContext","ToastContext","Fragment","TitleSmall","BodyCaption","Button","Toaster","toastId","useRef","toastLocal","setToastLocal","bounce","cssTransition","leftIcon","Check","Error","AlertTriangle","Info","toast","notify","toastText","ReactDOM","ToasterStyled","ToastContainer","React"],"mappings":";;;;;;;;;;;;;AA0DA,MAAMA,IAA+C,CAACC,MAEpD,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACA,OAAO;AAAA,IACP,cAAc;AAAA,MACb,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,OAAO;AAAA,IAAA;AAAA,IAGP,UAAA;AAAA,MAAAF,EAAM;AAAA,MAAS;AAAA,IAAA;AAAA,EAAA;AAAA,GAKbG,IAMD,CAACH,MAAU;AACf,QAAMI,IACLJ,EAAM,SAAS,YACZK,EAAO,QAAQ,UACfL,EAAM,SAAS,YACfK,EAAO,QAAQ,WACfL,EAAM,SAAS,UACfK,EAAO,QAAQ,WACfL,EAAM,SAAS,YACfK,EAAO,QAAQ,UACfA,EAAO,QAAQ,OAGb,CAACC,GAAYC,CAAa,IAAIC,EAAiBR,EAAM,YAAY,EAAE;AAEzE,EAAAS,EAAU,MAAM;AACf,QAAI,CAACT,EAAM,YA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A,EAAM,WAAW;AAAA,QAC1B,YAAYiC;AAAA,MAAA;AAAA,IACb;AAAA,EAGH;AAEA,SAAAxB,EAAU,MAAM;AACf,IAAAgC,EAAA;AAAA,EACD,GAAG,CAAA,CAAE,GAEEE,EAAS;AAAA,IACf,gBAAA1B;AAAA,MAAC2B;AAAA,MAAA;AAAA,QACA,OAAO5C,EAAM;AAAA,QACb,QAAQA,EAAM;AAAA,QACd,QAAQA,EAAM;AAAA,QACd,mBAAmB,CAAC,CAACA,EAAM;AAAA,QAC3B,MAAMA,EAAM;AAAA,QAEZ,UAAA,gBAAAiB,EAACM,EAAa,UAAb,EAAsB,OAAO,EAAE,aAAaQ,KAC5C,UAAA,gBAAAd;AAAA,UAAC4B;AAAA,UAAA;AAAA,YACA,UAAU7C,EAAM,YAAY;AAAA,YAC5B,cAAcA,EAAM,gBAAgB;AAAA,YACpC,iBAAiBA,EAAM,mBAAmB;AAAA,YAC1C,WAAW;AAAA,YACX,WAAWA,EAAM,aAAa;AAAA,YAC9B,OAAO;AAAA,UAAA;AAAA,QAAA,EACR,CACD;AAAA,MAAA;AAAA,IAAA;AAAA,IAED,SAAS;AAAA,EAAA;AAEX,GAEMuB,IAAeuB,EAAM,cAAc;AAAA,EACxC,aAAa;AACd,CAAC;"}
|
|
1
|
+
{"version":3,"file":"Toaster.js","sources":["../../../../src/components/toaster/Toaster.tsx"],"sourcesContent":["import AlertTriangle from '@src/assets/icons/alert_triangle.svg';\nimport Check from '@src/assets/icons/check.svg';\nimport Cross from '@src/assets/icons/cross.svg';\nimport Error from '@src/assets/icons/errorInfo.svg';\nimport Info from '@src/assets/icons/info.svg';\nimport React, {\n\tFunctionComponent,\n\tuseContext,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport ReactDOM from 'react-dom';\nimport {\n\tcssTransition,\n\tId,\n\ttoast,\n\tToastContainer,\n\tToastPosition,\n\tTypeOptions,\n} from 'react-toastify';\nimport { IconProps } from 'react-toastify/dist/components';\nimport { Button } from '@src/components/button';\nimport { ToasterStyled } from '@src/components/toaster/Toaster.styled';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\n\nexport type ToasterButtonProps = {\n\tshowButton?: boolean;\n\tonButtonClick?: () => Record<string, never>;\n\tbuttonText?: string;\n};\nexport type ToasterProps = {\n\ttext: string;\n\tsubText?: string;\n\tposition?: ToastPosition;\n\ttype?: 'info' | 'success' | 'error' | 'default' | 'warning';\n\tduration?: number;\n\tblocking?: boolean;\n\tcloseOnClick?: boolean;\n\thideProgressBar?: boolean;\n\tautoClose?: number | false | undefined;\n\tleftIcon?: React.ReactElement<IconProps>;\n\thideLeftIcon?: boolean;\n\tbuttonProps?: ToasterButtonProps;\n\tsecondButtonProps?: ToasterButtonProps;\n\tonCloseToast?: <T>(props: T) => void;\n\twidth?: string;\n\theight?: string;\n\thideCloseButton?: boolean;\n\tzIndex?: number;\n\ttoastId?: string;\n};\n\nconst CountDownBar: React.FC<{ duration: number }> = (props) => {\n\treturn (\n\t\t<BodySecondary\n\t\t\tcolor={`#9E9E9E`}\n\t\t\tcustomStyles={{\n\t\t\t\tfontWeight: 600,\n\t\t\t\tfontSize: 14,\n\t\t\t\twidth: 25,\n\t\t\t}}\n\t\t>\n\t\t\t{props.duration}s\n\t\t</BodySecondary>\n\t);\n};\n\nconst CloseButton: React.FC<{\n\ttype: string;\n\tcloseToast?: () => Record<string, never>;\n\talignTop?: boolean;\n\tblocking?: boolean;\n\tduration?: number;\n}> = (props) => {\n\tconst iconColor =\n\t\tprops.type === 'default'\n\t\t\t? COLORS.content.primary\n\t\t\t: props.type === 'success'\n\t\t\t? COLORS.content.positive\n\t\t\t: props.type === 'error'\n\t\t\t? COLORS.content.negative\n\t\t\t: props.type === 'warning'\n\t\t\t? COLORS.content.warning\n\t\t\t: COLORS.content.brand;\n\n\t// Each CloseButton has its own independent timer\n\tconst [timerValue, setTimerValue] = useState<number>(props.duration || -1);\n\n\tuseEffect(() => {\n\t\tif (!props.duration || props.duration <= 0) {\n\t\t\tsetTimerValue(-1);\n\t\t\treturn;\n\t\t}\n\n\t\tsetTimerValue(props.duration);\n\n\t\tconst interval = setInterval(() => {\n\t\t\tsetTimerValue((prev) => {\n\t\t\t\tconst next = prev - 1;\n\t\t\t\tif (next <= 0) {\n\t\t\t\t\tclearInterval(interval);\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\treturn next;\n\t\t\t});\n\t\t}, 1000);\n\n\t\treturn () => clearInterval(interval);\n\t}, [props.duration]);\n\n\t// Enable button when timerValue is -1, otherwise check blocking and timer\n\tconst isDisabled =\n\t\tprops.blocking && timerValue === -1\n\t\t\t? false\n\t\t\t: props.blocking && timerValue > 0;\n\n\tconst handleClick = () => {\n\t\tif (!isDisabled && props.closeToast) {\n\t\t\tprops.closeToast();\n\t\t}\n\t};\n\n\tconst handleKeyDown = (e: React.KeyboardEvent) => {\n\t\tif (e.key === 'Enter' && !isDisabled && props.closeToast) {\n\t\t\tprops.closeToast();\n\t\t}\n\t};\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={isDisabled ? -1 : 0}\n\t\t\trole={'button'}\n\t\t\tstyle={{\n\t\t\t\twidth: timerValue > 0 ? 25 : 20,\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tcursor: isDisabled ? 'not-allowed' : 'pointer',\n\t\t\t\talignSelf: `${props.alignTop ? 'flex-start' : 'center'}`,\n\t\t\t\topacity: isDisabled ? 0.5 : 1,\n\t\t\t\t// Pin to the toast's right edge. react-toastify clones this element\n\t\t\t\t// without adding the `Toastify__close-button` class, so the toast's\n\t\t\t\t// own stylesheet cannot position it.\n\t\t\t\tmarginLeft: 'auto',\n\t\t\t\tflexShrink: 0,\n\t\t\t}}\n\t\t\tonClick={handleClick}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t>\n\t\t\t{timerValue > 0 ? (\n\t\t\t\t<CountDownBar duration={timerValue} />\n\t\t\t) : (\n\t\t\t\t<Cross height={20} width={20} color={iconColor} />\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nconst RenderContent: React.FC<{\n\ttoastText?: string;\n\ttype: TypeOptions;\n\tshowButton?: boolean;\n\tshowSecondButton?: boolean;\n\tonButtonClick?: () => Record<string, never>;\n\tonSecondButtonClick?: () => Record<string, never>;\n\tbuttonText?: string;\n\tsecondButtonText?: string;\n\tsubText?: string;\n}> = (props) => {\n\tconst strokeColor = COLORS.content.placeholder;\n\n\tconst { toasterText: toasterTextContext } = useContext(ToastContext);\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tflexGrow: 1,\n\t\t\t\t\tmaxWidth: '100%',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tflexGrow: 1,\n\t\t\t\t\t\tmarginRight: 16,\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\tminWidth: 0,\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\tminWidth: 0,\n\t\t\t\t\t\t\twordBreak: 'break-word',\n\t\t\t\t\t\t\toverflowWrap: 'break-word',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{props.subText ? (\n\t\t\t\t\t\t\t<TitleSmall color={'inherit'}>\n\t\t\t\t\t\t\t\t{/* In normal scenarios, we use the text from prop. As a special case, when we need to change the text in already rendered toast, we change the text in context and let this component render on its own */}\n\t\t\t\t\t\t\t\t{props.toastText ?? toasterTextContext}\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<BodySecondary color={'inherit'}>\n\t\t\t\t\t\t\t\t{/* In normal scenarios, we use the text from prop. As a special case, when we need to change the text in already rendered toast, we change the text in context and let this component render on its own */}\n\t\t\t\t\t\t\t\t{props.toastText ?? toasterTextContext}\n\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{props.subText && (\n\t\t\t\t\t\t\t<div style={{ marginTop: 2 }}>\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\t\t{props.subText}\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t{props.showButton && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\t\t\talignSelf: 'center',\n\t\t\t\t\t\t\tpadding: '6px 0px',\n\t\t\t\t\t\t\tminWidth: props.subText ? 'fit-content' : 'auto',\n\t\t\t\t\t\t\tmarginRight: props.showSecondButton ? 4 : 0,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tbuttonText={props.buttonText}\n\t\t\t\t\t\t\tbuttonType={'tertiaryGray'}\n\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\tonClick={props.onButtonClick}\n\t\t\t\t\t\t></Button>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t{props.showSecondButton && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\t\t\talignSelf: 'center',\n\t\t\t\t\t\t\tpadding: '6px 0px',\n\t\t\t\t\t\t\tminWidth: props.subText ? 'fit-content' : 'auto',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tbuttonText={props.secondButtonText}\n\t\t\t\t\t\t\tbuttonType={'tertiaryGray'}\n\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\tonClick={props.onSecondButtonClick}\n\t\t\t\t\t\t></Button>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t{!(props.showButton || props.showSecondButton) ? null : (\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\theight: 28,\n\t\t\t\t\t\t\talignSelf: 'center',\n\t\t\t\t\t\t\tmarginLeft: 8,\n\t\t\t\t\t\t\tmarginRight: 8,\n\t\t\t\t\t\t\tborderRight: `1px solid ${strokeColor}`,\n\t\t\t\t\t\t\tborderRadius: 1,\n\t\t\t\t\t\t}}\n\t\t\t\t\t></div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</>\n\t);\n};\n\ntype Props = ToasterProps;\n\nexport const Toaster: FunctionComponent<Props> = (props) => {\n\tconst toastId = useRef<Id>(props.toastId || 'default-toast');\n\tconst [toastLocal, setToastLocal] = useState(props.text);\n\tconst bounce = cssTransition({\n\t\tenter: 'Toastify__slide-enter',\n\t\texit: 'Toastify__slide-exit',\n\t});\n\n\tconst leftIcon =\n\t\tprops.type === 'default' ? null : props.type === 'success' ? (\n\t\t\t<Check width={20} height={20} color={COLORS.content.positive} />\n\t\t) : props.type === 'error' ? (\n\t\t\t<Error width={20} height={20} color={COLORS.content.negative} />\n\t\t) : props.type === 'warning' ? (\n\t\t\t<AlertTriangle width={20} height={20} color={COLORS.content.warning} />\n\t\t) : (\n\t\t\t<Info width={20} height={20} color={COLORS.content.brand} />\n\t\t);\n\n\tuseEffect(() => {\n\t\t// When toast id is same but text needed to change, we change the text in context and let the toast re-render on its own.\n\t\tif (toastId.current && toastId.current === props.toastId) {\n\t\t\tsetToastLocal(props.text);\n\t\t\ttoast.update(toastId.current, {\n\t\t\t\tautoClose: props.autoClose,\n\t\t\t});\n\t\t\t// If toast ids are different, we call notify again which will stack the toasts up\n\t\t} else if (toastId.current && toastId.current !== props.toastId) {\n\t\t\tnotify(props.text);\n\t\t}\n\t}, [props.toastId, props.text]);\n\n\tconst notify = (toastText?: string) => {\n\t\tif (props.hideLeftIcon !== undefined || props.leftIcon) {\n\t\t\ttoast(\n\t\t\t\t<RenderContent\n\t\t\t\t\ttoastText={toastText}\n\t\t\t\t\ttype={props.type || 'info'}\n\t\t\t\t\tbuttonText={props.buttonProps?.buttonText}\n\t\t\t\t\tsecondButtonText={props.secondButtonProps?.buttonText}\n\t\t\t\t\tshowButton={props.buttonProps?.showButton}\n\t\t\t\t\tshowSecondButton={props.secondButtonProps?.showButton}\n\t\t\t\t\tonButtonClick={props.buttonProps?.onButtonClick}\n\t\t\t\t\tonSecondButtonClick={props.secondButtonProps?.onButtonClick}\n\t\t\t\t\tsubText={props.subText}\n\t\t\t\t/>,\n\t\t\t\t{\n\t\t\t\t\tonClose: props.onCloseToast ? props.onCloseToast : () => ({}),\n\t\t\t\t\ticon:\n\t\t\t\t\t\tprops.hideLeftIcon === true ? (\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t) : props.leftIcon ? (\n\t\t\t\t\t\t\tprops.leftIcon\n\t\t\t\t\t\t) : props.type === 'default' ? (\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div style={{ display: 'flex', alignItems: 'flex-start' }}>\n\t\t\t\t\t\t\t\t{leftIcon}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\ttype: props.type,\n\t\t\t\t\tcloseButton: props.hideCloseButton ? (\n\t\t\t\t\t\tfalse\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<CloseButton\n\t\t\t\t\t\t\ttype={props.type || 'default'}\n\t\t\t\t\t\t\talignTop={\n\t\t\t\t\t\t\t\t!!(\n\t\t\t\t\t\t\t\t\tprops.subText &&\n\t\t\t\t\t\t\t\t\t!(\n\t\t\t\t\t\t\t\t\t\tprops.buttonProps?.showButton ||\n\t\t\t\t\t\t\t\t\t\tprops.secondButtonProps?.showButton\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tblocking={props.blocking}\n\t\t\t\t\t\t\tduration={props.duration}\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\ttoastId: props.toastId || 'default-toast',\n\t\t\t\t\ttransition: bounce,\n\t\t\t\t},\n\t\t\t);\n\t\t} else {\n\t\t\ttoastId.current = toast(\n\t\t\t\t<RenderContent\n\t\t\t\t\ttoastText={toastText}\n\t\t\t\t\ttype={props.type || 'info'}\n\t\t\t\t\tbuttonText={props.buttonProps?.buttonText}\n\t\t\t\t\tsecondButtonText={props.secondButtonProps?.buttonText}\n\t\t\t\t\tshowButton={props.buttonProps?.showButton}\n\t\t\t\t\tshowSecondButton={props.secondButtonProps?.showButton}\n\t\t\t\t\tonButtonClick={props.buttonProps?.onButtonClick}\n\t\t\t\t\tonSecondButtonClick={props.secondButtonProps?.onButtonClick}\n\t\t\t\t\tsubText={props.subText}\n\t\t\t\t/>,\n\t\t\t\t{\n\t\t\t\t\tonClose: props.onCloseToast ? props.onCloseToast : () => ({}),\n\t\t\t\t\ttype: props.type,\n\t\t\t\t\ticon:\n\t\t\t\t\t\tprops.type === 'default' ? (\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div style={{ display: 'flex', alignItems: 'flex-start' }}>\n\t\t\t\t\t\t\t\t{leftIcon}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\tcloseButton: props.hideCloseButton ? (\n\t\t\t\t\t\tfalse\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<CloseButton\n\t\t\t\t\t\t\ttype={props.type || 'default'}\n\t\t\t\t\t\t\talignTop={\n\t\t\t\t\t\t\t\t!!(\n\t\t\t\t\t\t\t\t\tprops.subText &&\n\t\t\t\t\t\t\t\t\t!(\n\t\t\t\t\t\t\t\t\t\tprops.buttonProps?.showButton ||\n\t\t\t\t\t\t\t\t\t\tprops.secondButtonProps?.showButton\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tblocking={props.blocking}\n\t\t\t\t\t\t\tduration={props.duration}\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\ttoastId: props.toastId || 'default-toast',\n\t\t\t\t\ttransition: bounce,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t};\n\n\tuseEffect(() => {\n\t\tnotify();\n\t}, []);\n\n\treturn ReactDOM.createPortal(\n\t\t<ToasterStyled\n\t\t\twidth={props.width}\n\t\t\theight={props.height}\n\t\t\tzIndex={props.zIndex}\n\t\t\tisSubTextIncluded={!!props.subText}\n\t\t\ttype={props.type}\n\t\t>\n\t\t\t<ToastContext.Provider value={{ toasterText: toastLocal }}>\n\t\t\t\t<ToastContainer\n\t\t\t\t\tposition={props.position || 'top-right'}\n\t\t\t\t\tcloseOnClick={props.closeOnClick || false}\n\t\t\t\t\thideProgressBar={props.hideProgressBar || false}\n\t\t\t\t\tdraggable={false}\n\t\t\t\t\tautoClose={props.autoClose || false}\n\t\t\t\t\ttheme={'colored'}\n\t\t\t\t/>\n\t\t\t</ToastContext.Provider>\n\t\t</ToasterStyled>,\n\t\tdocument.body,\n\t);\n};\n\nconst ToastContext = React.createContext({\n\ttoasterText: '',\n});\n"],"names":["CountDownBar","props","jsxs","BodySecondary","CloseButton","iconColor","COLORS","timerValue","setTimerValue","useState","useEffect","interval","prev","next","isDisabled","handleClick","handleKeyDown","e","jsx","Cross","RenderContent","strokeColor","toasterTextContext","useContext","ToastContext","Fragment","TitleSmall","BodyCaption","Button","Toaster","toastId","useRef","toastLocal","setToastLocal","bounce","cssTransition","leftIcon","Check","Error","AlertTriangle","Info","toast","notify","toastText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AM,gBAAgB;AAAA,YACpC,iBAAiBA,EAAM,mBAAmB;AAAA,YAC1C,WAAW;AAAA,YACX,WAAWA,EAAM,aAAa;AAAA,YAC9B,OAAO;AAAA,UAAA;AAAA,QAAA,EACR,CACD;AAAA,MAAA;AAAA,IAAA;AAAA,IAED,SAAS;AAAA,EAAA;AAEX,GAEMuB,IAAeuB,EAAM,cAAc;AAAA,EACxC,aAAa;AACd,CAAC;"}
|
|
@@ -98,7 +98,8 @@ const n = i.div`
|
|
|
98
98
|
border-radius: 8px;
|
|
99
99
|
word-wrap: break-word;
|
|
100
100
|
overflow-wrap: break-word;
|
|
101
|
-
|
|
101
|
+
/* Clips the absolutely positioned progress bar to the 8px radius */
|
|
102
|
+
overflow: hidden;
|
|
102
103
|
|
|
103
104
|
@media (max-width: 768px) {
|
|
104
105
|
min-width: 80vw;
|
|
@@ -111,10 +112,9 @@ const n = i.div`
|
|
|
111
112
|
height: 4px;
|
|
112
113
|
}
|
|
113
114
|
|
|
114
|
-
.Toastify__close-button
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
115
|
+
/* NOTE: no .Toastify__close-button rule here — the close button is always a
|
|
116
|
+
custom element passed via the closeButton option, and react-toastify
|
|
117
|
+
clones it without adding that class. It is positioned inline instead. */
|
|
118
118
|
|
|
119
119
|
.Toastify__toast-icon {
|
|
120
120
|
align-self: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toaster.styled.js","sources":["../../../../src/components/toaster/Toaster.styled.tsx"],"sourcesContent":["import { TypeOptions } from 'react-toastify';\nimport styled from 'styled-components';\nimport { COLORS } from '@src/constants/Theme';\nimport { ComponentZindex } from '@src/constants/zindex';\n\nexport const ToasterStyled = styled.div<{\n\twidth?: string;\n\theight?: string;\n\tzIndex?: number;\n\tisSubTextIncluded?: boolean;\n\ttype?: TypeOptions;\n}>`\n\t--toastify-color-light: #fff;\n\t--toastify-color-dark: #121212;\n\t--toastify-text-color-success: ${COLORS.content.primary};\n\t--toastify-text-color-error: ${COLORS.content.primary};\n\t--toastify-text-color-warning: ${COLORS.content.primary};\n\t--toastify-text-color-info: ${COLORS.content.primary};\n\t--toastify-color-info: ${COLORS.background.brandLight};\n\t--toastify-color-success: ${COLORS.background.positive.light};\n\t--toastify-color-error: ${COLORS.background.negative.light};\n\t--toastify-color-warning: ${COLORS.background.warning.light};\n\t--toastify-text-color-light: ${COLORS.content.primary};\n\t--toastify-toast-width: fit-content;\n\t--toastify-toast-min-height: ${(props) =>\n\t\tprops.height || (props.isSubTextIncluded ? '70px' : '56px')};\n\t--toastify-toast-max-height: ${(props) => props.height || 'fit-content'};\n\tfont-family: inherit;\n\tz-index: ${(props) => props.zIndex || ComponentZindex.TOASTER};\n\n\t.custom-position {\n\t\tposition: relative;\n\t}\n\t.Toastify__toast-container {\n\t\tpadding: 0;\n\t\twidth: auto;\n\t\tmax-width: 90vw;\n\t\toverflow: visible;\n\n\t\t@media (max-width: 768px) {\n\t\t\tmax-width: calc(100vw - 64px);\n\t\t\tmargin: 0 32px;\n\t\t}\n\t}\n\n\t/* Mobile positioning - only for top-right (default) */\n\t.Toastify__toast-container--top-right {\n\t\t@media (max-width: 768px) {\n\t\t\ttop: 2%;\n\t\t\tleft: 35%;\n\t\t\ttransform: translateX(-50%);\n\t\t}\n\t}\n\n\t/* Mobile positioning - for top-left */\n\t.Toastify__toast-container--top-left {\n\t\t@media (max-width: 768px) {\n\t\t\ttop: 2%;\n\t\t\tleft: 50%;\n\t\t\ttransform: translateX(-50%);\n\t\t}\n\t}\n\n\t/* Mobile positioning - for bottom positions */\n\t.Toastify__toast-container--bottom-right,\n\t.Toastify__toast-container--bottom-left,\n\t.Toastify__toast-container--bottom-center {\n\t\t@media (max-width: 768px) {\n\t\t\tleft: 50%;\n\t\t\ttransform: translateX(-50%);\n\t\t}\n\t}\n\n\t/* Mobile positioning - for top-center */\n\t.Toastify__toast-container--top-center {\n\t\t@media (max-width: 768px) {\n\t\t\ttop: 2%;\n\t\t\tleft: 50%;\n\t\t\ttransform: translateX(-50%);\n\t\t}\n\t}\n\n\t.Toastify__toast--success {\n\t\tborder: 1px solid ${COLORS.stroke.positive.lightAlt};\n\t}\n\n\t.Toastify__toast--info {\n\t\tborder: 1px solid ${COLORS.stroke.brandLightAlt};\n\t}\n\n\t.Toastify__toast--default {\n\t\tborder: 1px solid ${COLORS.stroke.primary};\n\t}\n\n\t.Toastify__toast--error {\n\t\tborder: 1px solid ${COLORS.stroke.negative.lightAlt};\n\t}\n\n\t.Toastify__toast--warning {\n\t\tborder: 1px solid ${COLORS.stroke.warning.lightAlt};\n\t}\n\n\t.Toastify__toast {\n\t\tpadding: ${(props) => (props.isSubTextIncluded ? '16px 8px' : '12px 8px')};\n\t\tmax-width: ${(props) => props.width || '600px'};\n\t\tmin-width: 320px;\n\t\tborder-radius: 8px;\n\t\tword-wrap: break-word;\n\t\toverflow-wrap: break-word;\n\t\toverflow:
|
|
1
|
+
{"version":3,"file":"Toaster.styled.js","sources":["../../../../src/components/toaster/Toaster.styled.tsx"],"sourcesContent":["import { TypeOptions } from 'react-toastify';\nimport styled from 'styled-components';\nimport { COLORS } from '@src/constants/Theme';\nimport { ComponentZindex } from '@src/constants/zindex';\n\nexport const ToasterStyled = styled.div<{\n\twidth?: string;\n\theight?: string;\n\tzIndex?: number;\n\tisSubTextIncluded?: boolean;\n\ttype?: TypeOptions;\n}>`\n\t--toastify-color-light: #fff;\n\t--toastify-color-dark: #121212;\n\t--toastify-text-color-success: ${COLORS.content.primary};\n\t--toastify-text-color-error: ${COLORS.content.primary};\n\t--toastify-text-color-warning: ${COLORS.content.primary};\n\t--toastify-text-color-info: ${COLORS.content.primary};\n\t--toastify-color-info: ${COLORS.background.brandLight};\n\t--toastify-color-success: ${COLORS.background.positive.light};\n\t--toastify-color-error: ${COLORS.background.negative.light};\n\t--toastify-color-warning: ${COLORS.background.warning.light};\n\t--toastify-text-color-light: ${COLORS.content.primary};\n\t--toastify-toast-width: fit-content;\n\t--toastify-toast-min-height: ${(props) =>\n\t\tprops.height || (props.isSubTextIncluded ? '70px' : '56px')};\n\t--toastify-toast-max-height: ${(props) => props.height || 'fit-content'};\n\tfont-family: inherit;\n\tz-index: ${(props) => props.zIndex || ComponentZindex.TOASTER};\n\n\t.custom-position {\n\t\tposition: relative;\n\t}\n\t.Toastify__toast-container {\n\t\tpadding: 0;\n\t\twidth: auto;\n\t\tmax-width: 90vw;\n\t\toverflow: visible;\n\n\t\t@media (max-width: 768px) {\n\t\t\tmax-width: calc(100vw - 64px);\n\t\t\tmargin: 0 32px;\n\t\t}\n\t}\n\n\t/* Mobile positioning - only for top-right (default) */\n\t.Toastify__toast-container--top-right {\n\t\t@media (max-width: 768px) {\n\t\t\ttop: 2%;\n\t\t\tleft: 35%;\n\t\t\ttransform: translateX(-50%);\n\t\t}\n\t}\n\n\t/* Mobile positioning - for top-left */\n\t.Toastify__toast-container--top-left {\n\t\t@media (max-width: 768px) {\n\t\t\ttop: 2%;\n\t\t\tleft: 50%;\n\t\t\ttransform: translateX(-50%);\n\t\t}\n\t}\n\n\t/* Mobile positioning - for bottom positions */\n\t.Toastify__toast-container--bottom-right,\n\t.Toastify__toast-container--bottom-left,\n\t.Toastify__toast-container--bottom-center {\n\t\t@media (max-width: 768px) {\n\t\t\tleft: 50%;\n\t\t\ttransform: translateX(-50%);\n\t\t}\n\t}\n\n\t/* Mobile positioning - for top-center */\n\t.Toastify__toast-container--top-center {\n\t\t@media (max-width: 768px) {\n\t\t\ttop: 2%;\n\t\t\tleft: 50%;\n\t\t\ttransform: translateX(-50%);\n\t\t}\n\t}\n\n\t.Toastify__toast--success {\n\t\tborder: 1px solid ${COLORS.stroke.positive.lightAlt};\n\t}\n\n\t.Toastify__toast--info {\n\t\tborder: 1px solid ${COLORS.stroke.brandLightAlt};\n\t}\n\n\t.Toastify__toast--default {\n\t\tborder: 1px solid ${COLORS.stroke.primary};\n\t}\n\n\t.Toastify__toast--error {\n\t\tborder: 1px solid ${COLORS.stroke.negative.lightAlt};\n\t}\n\n\t.Toastify__toast--warning {\n\t\tborder: 1px solid ${COLORS.stroke.warning.lightAlt};\n\t}\n\n\t.Toastify__toast {\n\t\tpadding: ${(props) => (props.isSubTextIncluded ? '16px 8px' : '12px 8px')};\n\t\tmax-width: ${(props) => props.width || '600px'};\n\t\tmin-width: 320px;\n\t\tborder-radius: 8px;\n\t\tword-wrap: break-word;\n\t\toverflow-wrap: break-word;\n\t\t/* Clips the absolutely positioned progress bar to the 8px radius */\n\t\toverflow: hidden;\n\n\t\t@media (max-width: 768px) {\n\t\t\tmin-width: 80vw;\n\t\t\tmax-width: calc(100vw - 64px);\n\t\t\tpadding: ${(props) =>\n\t\t\t\tprops.isSubTextIncluded ? '16px 16px' : '12px 16px'};\n\t\t}\n\t}\n\n\t.Toastify__progress-bar {\n\t\theight: 4px;\n\t}\n\n\t/* NOTE: no .Toastify__close-button rule here — the close button is always a\n\t custom element passed via the closeButton option, and react-toastify\n\t clones it without adding that class. It is positioned inline instead. */\n\n\t.Toastify__toast-icon {\n\t\talign-self: center;\n\t\tmargin-inline-end: 12px;\n\t\theight: ${(props) => (props.isSubTextIncluded ? '38px' : '20px')};\n\t}\n\n\t.Toastify__toast-body {\n\t\tpadding: 0;\n\t\tdisplay: flex;\n\t}\n\n\t.Toastify__progress-bar-theme--colored.Toastify__progress-bar--default {\n\t\tbackground: ${COLORS.content.brand};\n\t}\n\n\t.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info {\n\t\tbackground: ${COLORS.content.brand};\n\t}\n\n\t.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning {\n\t\tbackground: ${COLORS.content.warning};\n\t}\n\n\t.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success {\n\t\tbackground: ${COLORS.content.positive};\n\t}\n\n\t.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error {\n\t\tbackground: ${COLORS.content.negative};\n\t}\n\n\t.Toastify__toast-body > div:last-child {\n\t\tdisplay: flex;\n\t}\n\n\t.Toastify__slide-enter {\n\t\tanimation: slideIn 1s ease forwards,\n\t\t\tbounce cubic-bezier(0.68, -0.55, 0.27, 1.55) 0.5s both;\n\t}\n\t.Toastify__slide-exit {\n\t\tanimation: slideOut 0.5s ease-in-out forwards;\n\t}\n\t@keyframes bounce {\n\t\t0%,\n\t\t20%,\n\t\t50%,\n\t\t80%,\n\t\t100% {\n\t\t\ttransform: translateY(0); /* Start and end at the original position */\n\t\t}\n\t\t40% {\n\t\t\ttransform: translateX(-20px); /* Bouncing up */\n\t\t}\n\t\t60% {\n\t\t\ttransform: translateX(20px); /* Small bounce before settling */\n\t\t}\n\t}\n\t@keyframes slideIn {\n\t\t0% {\n\t\t\ttransform: translateX(-100%); /* Start off-screen to the left */\n\t\t\topacity: 0;\n\t\t}\n\t\t100% {\n\t\t\ttransform: translateX(0); /* End at the original position */\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes slideOut {\n\t\t0% {\n\t\t\ttransform: translateX(0); /* Start from the original position */\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\ttransform: translateX(100%); /* Slide out to the right */\n\t\t\topacity: 0;\n\t\t}\n\t}\n`;\n"],"names":["ToasterStyled","styled","COLORS","props","ComponentZindex"],"mappings":";;;AAKO,MAAMA,IAAgBC,EAAO;AAAA;AAAA;AAAA,kCASFC,EAAO,QAAQ,OAAO;AAAA,gCACxBA,EAAO,QAAQ,OAAO;AAAA,kCACpBA,EAAO,QAAQ,OAAO;AAAA,+BACzBA,EAAO,QAAQ,OAAO;AAAA,0BAC3BA,EAAO,WAAW,UAAU;AAAA,6BACzBA,EAAO,WAAW,SAAS,KAAK;AAAA,2BAClCA,EAAO,WAAW,SAAS,KAAK;AAAA,6BAC9BA,EAAO,WAAW,QAAQ,KAAK;AAAA,gCAC5BA,EAAO,QAAQ,OAAO;AAAA;AAAA,gCAEtB,CAACC,MAC/BA,EAAM,WAAWA,EAAM,oBAAoB,SAAS,OAAO;AAAA,gCAC7B,CAACA,MAA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