botframework-webchat-fluent-theme 4.17.0-main.20240425.edca85d → 4.17.0-main.20240501.533c151

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/index.mjs DELETED
@@ -1,1115 +0,0 @@
1
- // src/index.ts
2
- import { injectMetaTag } from "inject-meta-tag";
3
-
4
- // src/private/FluentThemeProvider.tsx
5
- import { Components as Components2 } from "botframework-webchat-component";
6
- import React22, { memo as memo16 } from "react";
7
-
8
- // src/components/telephoneKeypad/Provider.tsx
9
- import React, { memo, useMemo, useState } from "react";
10
-
11
- // src/components/telephoneKeypad/private/Context.ts
12
- import { createContext } from "react";
13
- var Context = createContext(
14
- new Proxy({}, {
15
- get() {
16
- throw new Error("botframework-webchat: This hook can only used under its corresponding <Provider>.");
17
- }
18
- })
19
- );
20
- Context.displayName = "TelephoneKeypad.Context";
21
- var Context_default = Context;
22
-
23
- // src/components/telephoneKeypad/Provider.tsx
24
- var Provider = memo(({ children }) => {
25
- const [shown, setShown] = useState(false);
26
- const context = useMemo(
27
- () => Object.freeze({
28
- setShown,
29
- shown
30
- }),
31
- [setShown, shown]
32
- );
33
- return /* @__PURE__ */ React.createElement(Context_default.Provider, { value: context }, children);
34
- });
35
- var Provider_default = Provider;
36
-
37
- // src/components/telephoneKeypad/Surrogate.tsx
38
- import React5, { memo as memo5 } from "react";
39
-
40
- // src/components/telephoneKeypad/private/TelephoneKeypad.tsx
41
- import React4, { memo as memo4, useCallback as useCallback2, useEffect, useRef } from "react";
42
- import cx from "classnames";
43
- import { useRefFrom as useRefFrom2 } from "use-ref-from";
44
- import { Components } from "botframework-webchat-component";
45
-
46
- // src/components/telephoneKeypad/private/Button.tsx
47
- import React2, { forwardRef, memo as memo2, useCallback } from "react";
48
- import { useRefFrom } from "use-ref-from";
49
-
50
- // src/components/telephoneKeypad/private/Button.module.css
51
- var Button_default = {
52
- "telephone-keypad__button": "Button_telephone-keypad__button",
53
- "telephone-keypad__button__ruby": "Button_telephone-keypad__button__ruby",
54
- "telephone-keypad__button__text": "Button_telephone-keypad__button__text",
55
- "telephone-keypad--horizontal": "Button_telephone-keypad--horizontal"
56
- };
57
-
58
- // src/styles/injectStyle.ts
59
- var injectedStyles = "/* src/components/telephoneKeypad/private/Button.module.css */\n.webchat-fluent .Button_telephone-keypad__button {\n -webkit-user-select: none;\n align-items: center;\n appearance: none;\n background-color: White;\n border-radius: 100%;\n border: solid 1px var(--webchat-colorNeutralStroke1);\n color: var(--webchat-colorGray200);\n font-weight: var(--webchat-fontWeightSemibold);\n cursor: pointer;\n display: flex;\n flex-direction: column;\n height: 60px;\n opacity: 0.7;\n padding: 0;\n position: relative;\n touch-action: none;\n user-select: none;\n width: 60px;\n}\n.webchat-fluent .Button_telephone-keypad__button:hover {\n background-color: var(--webchat-colorGray30);\n}\n.webchat-fluent .Button_telephone-keypad__button__ruby {\n color: var(--webchat-colorGray190);\n font-size: 10px;\n}\n.webchat-fluent .Button_telephone-keypad__button__text {\n font-size: 24px;\n margin-top: 8px;\n}\n.webchat-fluent .Button_telephone-keypad--horizontal .Button_telephone-keypad__button {\n height: 32px;\n justify-content: center;\n margin: 8px 4px;\n width: 32px;\n}\n.webchat-fluent .Button_telephone-keypad--horizontal .Button_telephone-keypad__button__ruby {\n display: none;\n}\n.webchat-fluent .Button_telephone-keypad--horizontal .Button_telephone-keypad__button__text {\n font-size: 20px;\n margin-top: 0;\n}\n\n/* src/components/telephoneKeypad/private/TelephoneKeypad.module.css */\n.webchat-fluent .TelephoneKeypad_telephone-keypad {\n align-items: center;\n background: var(--webchat-colorNeutralBackground1);\n border: none;\n border-radius: var(--webchat-borderRadiusXLarge);\n display: flex;\n flex-direction: column;\n font-family: var(--webchat-fontFamilyBase);\n justify-content: center;\n}\n.webchat-fluent .TelephoneKeypad_telephone-keypad__box {\n box-sizing: border-box;\n display: grid;\n gap: 16px;\n grid-template-columns: repeat(3, 1fr);\n grid-template-rows: repeat(4, 1fr);\n justify-items: center;\n padding: 16px;\n width: 100%;\n}\n.webchat-fluent .TelephoneKeypad_telephone-keypad__info-message {\n align-items: center;\n color: var(--webchat-colorNeutralForeground4);\n display: flex;\n font-size: 12px;\n gap: 6px;\n margin-block-end: 6px;\n}\n.webchat-fluent .TelephoneKeypad_telephone-keypad__info-message-link {\n color: var(--webchat-colorBrandForegroundLink);\n text-decoration-color: transparent;\n}\n.webchat-fluent .TelephoneKeypad_telephone-keypad__info-message-link:target {\n color: var(--webchat-colorBrandForegroundLinkSelected);\n}\n.webchat-fluent .TelephoneKeypad_telephone-keypad__info-message-link:hover {\n color: var(--webchat-colorBrandForegroundLinkHover);\n text-decoration: underline 1px currentColor;\n}\n.webchat-fluent .TelephoneKeypad_telephone-keypad__info-message-link:active {\n color: var(--webchat-colorBrandForegroundLinkPressed);\n}\n.webchat-fluent .TelephoneKeypad_telephone-keypad__info-message-link:focus-visible {\n outline: none;\n text-decoration: underline 1px double var(--webchat-colorStrokeFocus2);\n}\n\n/* src/components/Theme.module.css */\n.webchat-fluent.Theme_theme {\n display: contents;\n --webchat-colorNeutralForeground1: var(--colorNeutralForeground1, #242424);\n --webchat-colorNeutralForeground2: var(--colorNeutralForeground2, #424242);\n --webchat-colorNeutralForeground4: var(--colorNeutralForeground4, #707070);\n --webchat-colorNeutralForeground2BrandHover: var(--colorNeutralForeground2BrandHover, #02729c);\n --webchat-colorNeutralForeground2BrandPressed: var(--colorNeutralForeground2BrandPressed, #01678c);\n --webchat-colorNeutralForeground2BrandSelected: var(--colorNeutralForeground2BrandSelected, #067191);\n --webchat-colorNeutralForegroundDisabled: var(--colorNeutralForegroundDisabled, #bdbdbd);\n --webchat-colorNeutralBackground1: var(--colorNeutralBackground1, #ffffff);\n --webchat-colorNeutralBackground4: var(--colorNeutralBackground4, #f0f0f0);\n --webchat-colorNeutralBackground5: var(--colorNeutralBackground5, #ebebeb);\n --webchat-colorNeutralStroke1: var(--colorNeutralStroke1, #d1d1d1);\n --webchat-colorNeutralStroke2: var(--colorNeutralStroke2, #e0e0e0);\n --webchat-colorNeutralStroke1Selected: var(--colorNeutralStroke1Selected, #bdbdbd);\n --webchat-colorStrokeFocus2: var(--colorStrokeFocus2, #000000);\n --webchat-colorBrandStroke2: var(--colorBrandStroke2, #9edcf7);\n --webchat-colorBrandForeground2Hover: var(--colorBrandForeground2Hover, #015a7a);\n --webchat-colorBrandForeground2Pressed: var(--colorBrandForeground2Pressed, #01384d);\n --webchat-colorBrandForegroundLink: var(--colorBrandForegroundLink, #01678c);\n --webchat-colorBrandForegroundLinkHover: var(--colorBrandForegroundLinkHover, #015a7a);\n --webchat-colorBrandForegroundLinkPressed: var(--colorBrandForegroundLinkPressed, #014259);\n --webchat-colorBrandForegroundLinkSelected: var(--colorBrandForegroundLinkSelected, #01678c);\n --webchat-colorBrandBackground2Hover: var(--colorBrandBackground2Hover, #bee7fa);\n --webchat-colorBrandBackground2Pressed: var(--colorBrandBackground2Pressed, #7fd2f5);\n --webchat-colorCompoundBrandForeground1Hover: var(--colorCompoundBrandForeground1Hover, #02729c);\n --webchat-colorStatusDangerForeground1: var(--colorStatusDangerForeground1, #b10e1c);\n --webchat-colorGray30: var(--colorGray30, #edebe9);\n --webchat-colorGray160: var(--colorGray160, #323130);\n --webchat-colorGray190: var(--colorGray190, #201f1e);\n --webchat-colorGray200: var(--colorGray200, #1b1a19);\n --webchat-borderRadiusSmall: var(--borderRadiusSmall, 2px);\n --webchat-borderRadiusLarge: var(--borderRadiusLarge, 6px);\n --webchat-borderRadiusXLarge: var(--borderRadiusXLarge, 8px);\n --webchat-shadow16: var(--shadow16, 0 6.4px 14.4px 0 rgba(0, 0, 0, 0.132), 0 1.2px 3.6px 0 rgba(0, 0, 0, 0.108));\n --webchat-spacingHorizontalMNudge: var(--spacingHorizontalMNudge, 10px);\n --webchat-fontFamilyBase: var(--fontFamilyBase, \"Segoe UI\", \"Segoe UI Web (West European)\", -apple-system, BlinkMacSystemFont, Roboto, \"Helvetica Neue\", sans-serif);\n --webchat-fontFamilyNumeric: var(--fontFamilyNumeric, Bahnschrift, \"Segoe UI\", \"Segoe UI Web (West European)\", -apple-system, BlinkMacSystemFont, Roboto, \"Helvetica Neue\", sans-serif);\n --webchat-fontWeightSemibold: var(--fontWeightSemibold, 600);\n --webchat-strokeWidthThicker: var(--strokeWidthThicker, 3px);\n --webchat-durationUltraFast: var(--durationUltraFast, 0);\n --webchat-durationNormal: var(--durationNormal, 200ms);\n --webchat-curveAccelerateMid: var(--curveAccelerateMid, cubic-bezier(1,0,1,1));\n --webchat-curveDecelerateMid: var(--curveDecelerateMid, cubic-bezier(0,0,0,1));\n}\n@media (prefers-reduced-motion) {\n .webchat-fluent.Theme_theme {\n --webchat-durationUltraFast: 0.01ms;\n --webchat-durationNormal: 0.01ms;\n }\n}\n\n/* src/components/dropZone/index.module.css */\n.webchat-fluent .dropZone_sendbox__attachment-drop-zone {\n background-color: var(--webchat-colorNeutralBackground4);\n border-radius: inherit;\n cursor: copy;\n display: grid;\n gap: 8px;\n inset: 0;\n place-content: center;\n place-items: center;\n position: absolute;\n}\n.webchat-fluent .dropZone_sendbox__attachment-drop-zone--droppable {\n background-color: #e00;\n color: White;\n}\n.webchat-fluent .dropZone_sendbox__attachment-drop-zone-icon {\n height: 36px;\n pointer-events: none;\n width: 36px;\n}\n\n/* src/components/suggestedActions/SuggestedAction.module.css */\n.webchat-fluent .SuggestedAction_suggested-action {\n align-items: center;\n background: transparent;\n border-radius: 8px;\n border: 1px solid var(--webchat-colorBrandStroke2);\n color: currentColor;\n cursor: pointer;\n display: flex;\n font-size: 12px;\n gap: 4px;\n padding: 4px 8px 4px;\n text-align: start;\n transition: all .15s ease-out;\n}\n@media (hover: hover) {\n .webchat-fluent .SuggestedAction_suggested-action:not([aria-disabled=true]):hover {\n background-color: var(--webchat-colorBrandBackground2Hover);\n color: var(--webchat-colorBrandForeground2Hover);\n }\n}\n.webchat-fluent .SuggestedAction_suggested-action:not([aria-disabled=true]):active {\n background-color: var(--webchat-colorBrandBackground2Pressed);\n color: var(--webchat-colorBrandForeground2Pressed);\n}\n.webchat-fluent .SuggestedAction_suggested-action[aria-disabled=true] {\n color: var(--webchat-colorNeutralForegroundDisabled);\n cursor: not-allowed;\n}\n.webchat-fluent .SuggestedAction_suggested-action__image {\n font-size: 12px;\n height: 1em;\n width: 1em;\n}\n\n/* src/components/suggestedActions/index.module.css */\n.webchat-fluent .suggestedActions_suggested-actions {\n align-items: flex-end;\n align-self: flex-end;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.webchat-fluent .suggestedActions_suggested-actions:not(:empty) {\n padding-block-end: 8px;\n padding-inline-start: 4px;\n}\n.webchat-fluent .suggestedActions_suggested-actions.suggestedActions_suggested-actions--flow {\n flex-direction: row;\n flex-wrap: wrap;\n justify-content: flex-end;\n}\n.webchat-fluent .suggestedActions_suggested-actions.suggestedActions_suggested-actions--stacked {\n flex-direction: column;\n}\n\n/* src/components/sendbox/Toolbar.module.css */\n.webchat-fluent .Toolbar_sendbox__toolbar {\n display: flex;\n gap: 4px;\n margin-inline-start: auto;\n}\n.webchat-fluent .Toolbar_sendbox__toolbar-button {\n align-items: center;\n appearance: none;\n aspect-ratio: 1;\n background: transparent;\n border-radius: var(--webchat-borderRadiusSmall);\n border: none;\n color: currentColor;\n cursor: pointer;\n display: flex;\n justify-content: center;\n padding: 3px;\n width: 32px;\n}\n.webchat-fluent .Toolbar_sendbox__toolbar-button > svg {\n font-size: 20px;\n pointer-events: none;\n}\n.webchat-fluent .Toolbar_sendbox__toolbar-button.Toolbar_sendbox__toolbar-button--selected {\n color: var(--webchat-colorNeutralForeground2BrandSelected);\n}\n@media (hover: hover) {\n .webchat-fluent .Toolbar_sendbox__toolbar-button:not([aria-disabled=true]):hover {\n color: var(--webchat-colorNeutralForeground2BrandHover);\n }\n}\n.webchat-fluent .Toolbar_sendbox__toolbar-button:not([aria-disabled=true]):active {\n color: var(--webchat-colorNeutralForeground2BrandPressed);\n}\n.webchat-fluent .Toolbar_sendbox__toolbar-button[aria-disabled=true] {\n color: var(--webchat-colorNeutralForegroundDisabled);\n cursor: not-allowed;\n}\n.webchat-fluent .Toolbar_sendbox__toolbar-separator {\n align-self: center;\n border-inline-end: 1px solid var(--webchat-colorNeutralStroke2);\n height: 28px;\n}\n.webchat-fluent .Toolbar_sendbox__toolbar-separator:is(:first-child, :last-child, :only-child) {\n display: none;\n}\n\n/* src/components/sendbox/AddAttachmentButton.module.css */\n.webchat-fluent .AddAttachmentButton_sendbox__add-attachment {\n display: grid;\n}\n.webchat-fluent .AddAttachmentButton_sendbox__add-attachment-input {\n font-size: 0;\n height: 0;\n opacity: 0;\n width: 0;\n}\n\n/* src/components/sendbox/Attachments.module.css */\n.webchat-fluent .Attachments_sendbox__attachment {\n border-radius: var(--webchat-borderRadiusLarge);\n border: 1px solid var(--webchat-colorNeutralStroke1);\n cursor: default;\n padding: 6px 8px;\n width: fit-content;\n}\n\n/* src/components/sendbox/ErrorMessage.module.css */\n.webchat-fluent .ErrorMessage_sendbox__error-message {\n color: transparent;\n font-size: 0;\n height: 0;\n left: 0;\n position: absolute;\n top: 0;\n width: 0;\n}\n\n/* src/components/sendbox/TextArea.module.css */\n.webchat-fluent .TextArea_sendbox__text-area {\n display: grid;\n grid-template-areas: \"main\";\n max-height: 200px;\n overflow: hidden;\n}\n.webchat-fluent .TextArea_sendbox__text-area--hidden {\n height: 0;\n visibility: collapse;\n}\n.webchat-fluent .TextArea_sendbox__text-area-shared {\n border: none;\n font: inherit;\n grid-area: main;\n outline: inherit;\n overflow-wrap: anywhere;\n resize: inherit;\n scrollbar-gutter: stable;\n}\n.webchat-fluent .TextArea_sendbox__text-area-doppelganger {\n overflow: hidden;\n visibility: hidden;\n white-space: pre-wrap;\n}\n.webchat-fluent .TextArea_sendbox__text-area-input {\n background-color: inherit;\n color: currentColor;\n height: 100%;\n padding: 0;\n}\n.webchat-fluent .TextArea_sendbox__text-area-input--scroll {\n scrollbar-color: unset;\n scrollbar-width: unset;\n -moz-scrollbar-color: var(--webchat-colorNeutralBackground5) var(--webchat-colorNeutralForeground2);\n -moz-scrollbar-width: thin;\n}\n.webchat-fluent .TextArea_sendbox__text-area-input--scroll::-webkit-scrollbar {\n width: 8px;\n}\n.webchat-fluent .TextArea_sendbox__text-area-input--scroll::-webkit-scrollbar-track {\n background-color: var(--webchat-colorNeutralBackground5);\n border-radius: 16px;\n}\n.webchat-fluent .TextArea_sendbox__text-area-input--scroll::-webkit-scrollbar-thumb {\n background-color: var(--webchat-colorNeutralForeground2);\n border-radius: 16px;\n}\n.webchat-fluent .TextArea_sendbox__text-area-input--scroll::-webkit-scrollbar-corner {\n background-color: var(--webchat-colorNeutralBackground5);\n}\n\n/* src/components/sendbox/index.module.css */\n.webchat-fluent .sendbox_sendbox {\n color: var(--webchat-colorNeutralForeground1);\n font-family: var(--webchat-fontFamilyBase);\n padding: 0 10px 10px;\n text-rendering: optimizeLegibility;\n --webchat-sendbox-attachment-area-active: ;\n --webchat-sendbox-border-radius: var(--webchat-borderRadiusLarge);\n}\n.webchat-fluent .sendbox_sendbox__sendbox {\n background-color: var(--webchat-colorNeutralBackground1);\n border-radius: var(--webchat-sendbox-border-radius);\n border: 1px solid var(--webchat-colorNeutralStroke1);\n display: grid;\n font-family: var(--webchat-fontFamilyBase);\n font-size: 14px;\n gap: 6px;\n grid-template: [telephone-keypad-start] \"text-area\" [telephone-keypad-end] var(--webchat-sendbox-attachment-area-active) \"controls\" / [telephone-keypad] 1fr;\n line-height: 20px;\n padding: 8px;\n position: relative;\n}\n.webchat-fluent .sendbox_sendbox__sendbox:has(.sendbox_sendbox__attachment--in-grid) {\n --webchat-sendbox-attachment-area-active: \"attachment\" ;\n}\n.webchat-fluent .sendbox_sendbox__sendbox:focus-within {\n border-color: var(--webchat-colorNeutralStroke1Selected);\n}\n.webchat-fluent .sendbox_sendbox__sendbox::after {\n border-bottom-left-radius: var(--webchat-sendbox-border-radius);\n border-bottom-right-radius: var(--webchat-sendbox-border-radius);\n border-bottom: var(--webchat-strokeWidthThicker) solid var(--webchat-colorCompoundBrandForeground1Hover);\n bottom: -1px;\n clip-path: inset(calc(100% - var(--webchat-strokeWidthThicker)) 50% 0 50%);\n content: \"\";\n height: var(--webchat-sendbox-border-radius);\n left: -1px;\n position: absolute;\n right: -1px;\n transition: clip-path var(--webchat-durationUltraFast) var(--webchat-curveAccelerateMid);\n}\n.webchat-fluent .sendbox_sendbox__sendbox:focus-within::after {\n clip-path: inset(calc(100% - var(--webchat-strokeWidthThicker)) 0 0 0);\n transition: clip-path var(--webchat-durationNormal) var(--webchat-curveDecelerateMid);\n}\n.webchat-fluent .sendbox_sendbox__sendbox > .sendbox_sendbox__text-area--in-grid {\n grid-area: text-area;\n}\n.webchat-fluent .sendbox_sendbox__sendbox > .sendbox_sendbox__attachment--in-grid {\n grid-area: attachment;\n}\n.webchat-fluent .sendbox_sendbox__sendbox > .sendbox_sendbox__sendbox-controls--in-grid {\n grid-area: controls;\n}\n.webchat-fluent .sendbox_sendbox__sendbox > .sendbox_sendbox__telephone-keypad--in-grid {\n grid-area: telephone-keypad;\n}\n.webchat-fluent .sendbox_sendbox__sendbox-text {\n background-color: transparent;\n border: none;\n flex: auto;\n font-family: var(--webchat-fontFamilyBase);\n font-size: 14px;\n line-height: 20px;\n outline: none;\n padding: 4px 4px 0;\n resize: none;\n}\n.webchat-fluent .sendbox_sendbox__sendbox-controls {\n align-items: center;\n display: flex;\n padding-inline-start: 4px;\n}\n.webchat-fluent .sendbox_sendbox__text-counter {\n color: var(--webchat-colorNeutralForeground4);\n cursor: default;\n font-family: var(--webchat-fontFamilyNumeric);\n font-size: 10px;\n line-height: 14px;\n margin-inline-end: 4px;\n}\n.webchat-fluent .sendbox_sendbox__text-counter--error {\n color: var(--webchat-colorStatusDangerForeground1);\n}\n";
60
- function injectStyles() {
61
- if (globalThis.document) {
62
- const style = document.createElement("style");
63
- style.append(document.createTextNode(injectedStyles));
64
- document.head.appendChild(style);
65
- }
66
- }
67
-
68
- // src/styles/useStyles.ts
69
- import { useMemo as useMemo2 } from "react";
70
- function useStyles(styles) {
71
- return useMemo2(
72
- () => Object.freeze(
73
- Object.fromEntries(
74
- Object.entries(styles).map(([baseClassName, resultClassName]) => [
75
- baseClassName,
76
- `${baseClassName} ${resultClassName}`
77
- ])
78
- )
79
- ),
80
- [styles]
81
- );
82
- }
83
- var useStyles_default = useStyles;
84
-
85
- // src/components/telephoneKeypad/private/Button.tsx
86
- var Button = memo2(
87
- // As we are all TypeScript, internal components do not need propTypes.
88
- // eslint-disable-next-line react/prop-types
89
- forwardRef(({ button, "data-testid": dataTestId, onClick, ruby }, ref) => {
90
- const classNames = useStyles_default(Button_default);
91
- const onClickRef = useRefFrom(onClick);
92
- const handleClick = useCallback(() => onClickRef.current?.(), [onClickRef]);
93
- return /* @__PURE__ */ React2.createElement(
94
- "button",
95
- {
96
- className: classNames["telephone-keypad__button"],
97
- "data-testid": dataTestId,
98
- onClick: handleClick,
99
- ref,
100
- type: "button"
101
- },
102
- /* @__PURE__ */ React2.createElement("span", { className: classNames["telephone-keypad__button__text"] }, button === "star" ? "\u2217" : button === "pound" ? "#" : button),
103
- !!ruby && /* @__PURE__ */ React2.createElement("ruby", { className: classNames["telephone-keypad__button__ruby"] }, ruby)
104
- );
105
- })
106
- );
107
- Button.displayName = "TelephoneKeypad.Button";
108
- var Button_default2 = Button;
109
-
110
- // src/testIds.ts
111
- var testIds = {
112
- sendBoxDropZone: "send box drop zone",
113
- sendBoxSendButton: "send box send button",
114
- sendBoxTextBox: "send box text area",
115
- sendBoxTelephoneKeypadButton1: `send box telephone keypad button 1`,
116
- sendBoxTelephoneKeypadButton2: `send box telephone keypad button 2`,
117
- sendBoxTelephoneKeypadButton3: `send box telephone keypad button 3`,
118
- sendBoxTelephoneKeypadButton4: `send box telephone keypad button 4`,
119
- sendBoxTelephoneKeypadButton5: `send box telephone keypad button 5`,
120
- sendBoxTelephoneKeypadButton6: `send box telephone keypad button 6`,
121
- sendBoxTelephoneKeypadButton7: `send box telephone keypad button 7`,
122
- sendBoxTelephoneKeypadButton8: `send box telephone keypad button 8`,
123
- sendBoxTelephoneKeypadButton9: `send box telephone keypad button 9`,
124
- sendBoxTelephoneKeypadButton0: `send box telephone keypad button 0`,
125
- sendBoxTelephoneKeypadButtonStar: `send box telephone keypad button star`,
126
- sendBoxTelephoneKeypadButtonPound: `send box telephone keypad button pound`,
127
- sendBoxTelephoneKeypadToolbarButton: "send box telephone keypad toolbar button",
128
- sendBoxUploadButton: "send box upload button"
129
- };
130
- var testIds_default = testIds;
131
-
132
- // src/components/telephoneKeypad/useShown.ts
133
- import { useContext, useMemo as useMemo3 } from "react";
134
- function useShown() {
135
- const { setShown, shown } = useContext(Context_default);
136
- return useMemo3(() => Object.freeze([shown, setShown]), [shown, setShown]);
137
- }
138
-
139
- // src/components/telephoneKeypad/private/TelephoneKeypad.module.css
140
- var TelephoneKeypad_default = {
141
- "telephone-keypad": "TelephoneKeypad_telephone-keypad",
142
- "telephone-keypad__box": "TelephoneKeypad_telephone-keypad__box",
143
- "telephone-keypad__info-message": "TelephoneKeypad_telephone-keypad__info-message",
144
- "telephone-keypad__info-message-link": "TelephoneKeypad_telephone-keypad__info-message-link"
145
- };
146
-
147
- // src/icons/InfoSmallIcon.tsx
148
- import React3, { memo as memo3 } from "react";
149
- var InfoSmallIcon_default = memo3((props) => /* @__PURE__ */ React3.createElement(
150
- "svg",
151
- {
152
- "aria-hidden": "true",
153
- className: props.className,
154
- height: "1em",
155
- viewBox: "0 0 16 16",
156
- width: "1em",
157
- xmlns: "http://www.w3.org/2000/svg"
158
- },
159
- /* @__PURE__ */ React3.createElement(
160
- "path",
161
- {
162
- d: "M8.5 7.5a.5.5 0 1 0-1 0v3a.5.5 0 0 0 1 0v-3Zm.25-2a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1ZM2 8a6 6 0 1 1 12 0A6 6 0 0 1 2 8Z",
163
- fill: "currentColor"
164
- }
165
- )
166
- ));
167
-
168
- // src/components/telephoneKeypad/private/TelephoneKeypad.tsx
169
- var { LocalizedString } = Components;
170
- var Orientation = memo4(
171
- ({ children, isHorizontal }) => {
172
- const classNames = useStyles_default(TelephoneKeypad_default);
173
- return isHorizontal ? (
174
- // <HorizontalDialPadController>{children}</HorizontalDialPadController>
175
- false
176
- ) : /* @__PURE__ */ React4.createElement("div", { className: classNames["telephone-keypad__box"] }, children);
177
- }
178
- );
179
- Orientation.displayName = "TelephoneKeypad:Orientation";
180
- var TelephoneKeypad = memo4(({ autoFocus, className, onButtonClick, isHorizontal }) => {
181
- const autoFocusRef = useRefFrom2(autoFocus);
182
- const classNames = useStyles_default(TelephoneKeypad_default);
183
- const firstButtonRef = useRef(null);
184
- const onButtonClickRef = useRefFrom2(onButtonClick);
185
- const [, setShown] = useShown();
186
- const handleButton1Click = useCallback2(() => onButtonClickRef.current?.("1"), [onButtonClickRef]);
187
- const handleButton2Click = useCallback2(() => onButtonClickRef.current?.("2"), [onButtonClickRef]);
188
- const handleButton3Click = useCallback2(() => onButtonClickRef.current?.("3"), [onButtonClickRef]);
189
- const handleButton4Click = useCallback2(() => onButtonClickRef.current?.("4"), [onButtonClickRef]);
190
- const handleButton5Click = useCallback2(() => onButtonClickRef.current?.("5"), [onButtonClickRef]);
191
- const handleButton6Click = useCallback2(() => onButtonClickRef.current?.("6"), [onButtonClickRef]);
192
- const handleButton7Click = useCallback2(() => onButtonClickRef.current?.("7"), [onButtonClickRef]);
193
- const handleButton8Click = useCallback2(() => onButtonClickRef.current?.("8"), [onButtonClickRef]);
194
- const handleButton9Click = useCallback2(() => onButtonClickRef.current?.("9"), [onButtonClickRef]);
195
- const handleButton0Click = useCallback2(() => onButtonClickRef.current?.("0"), [onButtonClickRef]);
196
- const handleButtonStarClick = useCallback2(() => onButtonClickRef.current?.("star"), [onButtonClickRef]);
197
- const handleButtonPoundClick = useCallback2(() => onButtonClickRef.current?.("pound"), [onButtonClickRef]);
198
- const handleKeyDown = useCallback2(
199
- (event) => {
200
- if (event.key === "Escape") {
201
- setShown(false);
202
- }
203
- },
204
- [setShown]
205
- );
206
- useEffect(() => {
207
- autoFocusRef.current && firstButtonRef.current?.focus();
208
- }, [autoFocusRef, firstButtonRef]);
209
- return /* @__PURE__ */ React4.createElement("div", { className: cx(classNames["telephone-keypad"], className), onKeyDown: handleKeyDown }, /* @__PURE__ */ React4.createElement(Orientation, { isHorizontal }, /* @__PURE__ */ React4.createElement(
210
- Button_default2,
211
- {
212
- button: "1",
213
- "data-testid": testIds_default.sendBoxTelephoneKeypadButton1,
214
- onClick: handleButton1Click,
215
- ref: firstButtonRef
216
- }
217
- ), /* @__PURE__ */ React4.createElement(
218
- Button_default2,
219
- {
220
- button: "2",
221
- "data-testid": testIds_default.sendBoxTelephoneKeypadButton2,
222
- onClick: handleButton2Click,
223
- ruby: "ABC"
224
- }
225
- ), /* @__PURE__ */ React4.createElement(
226
- Button_default2,
227
- {
228
- button: "3",
229
- "data-testid": testIds_default.sendBoxTelephoneKeypadButton3,
230
- onClick: handleButton3Click,
231
- ruby: "DEF"
232
- }
233
- ), /* @__PURE__ */ React4.createElement(
234
- Button_default2,
235
- {
236
- button: "4",
237
- "data-testid": testIds_default.sendBoxTelephoneKeypadButton4,
238
- onClick: handleButton4Click,
239
- ruby: "GHI"
240
- }
241
- ), /* @__PURE__ */ React4.createElement(
242
- Button_default2,
243
- {
244
- button: "5",
245
- "data-testid": testIds_default.sendBoxTelephoneKeypadButton5,
246
- onClick: handleButton5Click,
247
- ruby: "JKL"
248
- }
249
- ), /* @__PURE__ */ React4.createElement(
250
- Button_default2,
251
- {
252
- button: "6",
253
- "data-testid": testIds_default.sendBoxTelephoneKeypadButton6,
254
- onClick: handleButton6Click,
255
- ruby: "MNO"
256
- }
257
- ), /* @__PURE__ */ React4.createElement(
258
- Button_default2,
259
- {
260
- button: "7",
261
- "data-testid": testIds_default.sendBoxTelephoneKeypadButton7,
262
- onClick: handleButton7Click,
263
- ruby: "PQRS"
264
- }
265
- ), /* @__PURE__ */ React4.createElement(
266
- Button_default2,
267
- {
268
- button: "8",
269
- "data-testid": testIds_default.sendBoxTelephoneKeypadButton8,
270
- onClick: handleButton8Click,
271
- ruby: "TUV"
272
- }
273
- ), /* @__PURE__ */ React4.createElement(
274
- Button_default2,
275
- {
276
- button: "9",
277
- "data-testid": testIds_default.sendBoxTelephoneKeypadButton9,
278
- onClick: handleButton9Click,
279
- ruby: "WXYZ"
280
- }
281
- ), /* @__PURE__ */ React4.createElement(Button_default2, { button: "star", "data-testid": testIds_default.sendBoxTelephoneKeypadButtonStar, onClick: handleButtonStarClick }), /* @__PURE__ */ React4.createElement(Button_default2, { button: "0", "data-testid": testIds_default.sendBoxTelephoneKeypadButton0, onClick: handleButton0Click, ruby: "+" }), /* @__PURE__ */ React4.createElement(
282
- Button_default2,
283
- {
284
- button: "pound",
285
- "data-testid": testIds_default.sendBoxTelephoneKeypadButtonPound,
286
- onClick: handleButtonPoundClick
287
- }
288
- )), /* @__PURE__ */ React4.createElement("div", { className: classNames["telephone-keypad__info-message"] }, /* @__PURE__ */ React4.createElement(InfoSmallIcon_default, null), /* @__PURE__ */ React4.createElement(
289
- LocalizedString,
290
- {
291
- linkClassName: classNames["telephone-keypad__info-message-link"],
292
- stringIds: "TELEPHONE_KEYPAD_INPUT_MESSAGE"
293
- }
294
- )));
295
- });
296
- TelephoneKeypad.displayName = "TelephoneKeypad";
297
- var TelephoneKeypad_default2 = TelephoneKeypad;
298
-
299
- // src/components/telephoneKeypad/Surrogate.tsx
300
- var TelephoneKeypadSurrogate = memo5((props) => useShown()[0] ? /* @__PURE__ */ React5.createElement(TelephoneKeypad_default2, { ...props }) : false);
301
- TelephoneKeypadSurrogate.displayName = "TelephoneKeypad.Surrogate";
302
- var Surrogate_default = TelephoneKeypadSurrogate;
303
-
304
- // src/components/Theme.tsx
305
- import React6 from "react";
306
- import cx2 from "classnames";
307
-
308
- // src/components/Theme.module.css
309
- var Theme_default = {
310
- theme: "Theme_theme"
311
- };
312
-
313
- // src/components/Theme.tsx
314
- var rootClassName = "webchat-fluent";
315
- function WebchatTheme(props) {
316
- const classNames = useStyles_default(Theme_default);
317
- return /* @__PURE__ */ React6.createElement("div", { className: cx2(rootClassName, classNames["theme"]) }, props.children);
318
- }
319
-
320
- // src/components/sendbox/index.tsx
321
- import { hooks as hooks8 } from "botframework-webchat-component";
322
- import cx9 from "classnames";
323
- import React21, { memo as memo15, useCallback as useCallback8, useRef as useRef6, useState as useState3 } from "react";
324
- import { useRefFrom as useRefFrom6 } from "use-ref-from";
325
-
326
- // src/icons/SendIcon.tsx
327
- import React7 from "react";
328
- function SendIcon(props) {
329
- return /* @__PURE__ */ React7.createElement(
330
- "svg",
331
- {
332
- "aria-hidden": "true",
333
- className: props.className,
334
- height: "1em",
335
- viewBox: "0 0 20 20",
336
- width: "1em",
337
- xmlns: "http://www.w3.org/2000/svg"
338
- },
339
- /* @__PURE__ */ React7.createElement(
340
- "path",
341
- {
342
- d: "M2.18 2.11a.5.5 0 0 1 .54-.06l15 7.5a.5.5 0 0 1 0 .9l-15 7.5a.5.5 0 0 1-.7-.58L3.98 10 2.02 2.63a.5.5 0 0 1 .16-.52Zm2.7 8.39-1.61 6.06L16.38 10 3.27 3.44 4.88 9.5h6.62a.5.5 0 1 1 0 1H4.88Z",
343
- fill: "currentColor"
344
- }
345
- )
346
- );
347
- }
348
-
349
- // src/components/dropZone/index.tsx
350
- import { hooks } from "botframework-webchat-component";
351
- import cx3 from "classnames";
352
- import React9, { memo as memo6, useCallback as useCallback3, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
353
- import { useRefFrom as useRefFrom3 } from "use-ref-from";
354
-
355
- // src/icons/AddDocumentIcon.tsx
356
- import React8 from "react";
357
- function AddDocumentIcon(props) {
358
- return /* @__PURE__ */ React8.createElement(
359
- "svg",
360
- {
361
- "aria-hidden": "true",
362
- className: props.className,
363
- height: "1em",
364
- viewBox: "0 0 20 20",
365
- width: "1em",
366
- xmlns: "http://www.w3.org/2000/svg"
367
- },
368
- /* @__PURE__ */ React8.createElement(
369
- "path",
370
- {
371
- d: "M6 2a2 2 0 0 0-2 2v5.2c.32-.08.66-.15 1-.18V4a1 1 0 0 1 1-1h4v3.5c0 .83.67 1.5 1.5 1.5H15v8a1 1 0 0 1-1 1h-3.6c-.18.36-.4.7-.66 1H14a2 2 0 0 0 2-2V7.41c0-.4-.16-.78-.44-1.06l-3.91-3.91A1.5 1.5 0 0 0 10.59 2H6Zm8.8 5h-3.3a.5.5 0 0 1-.5-.5V3.2L14.8 7ZM10 14.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0Zm-4-2a.5.5 0 0 0-1 0V14H3.5a.5.5 0 0 0 0 1H5v1.5a.5.5 0 0 0 1 0V15h1.5a.5.5 0 0 0 0-1H6v-1.5Z",
372
- fill: "currentColor"
373
- }
374
- )
375
- );
376
- }
377
-
378
- // src/components/dropZone/index.module.css
379
- var dropZone_default = {
380
- "sendbox__attachment-drop-zone": "dropZone_sendbox__attachment-drop-zone",
381
- "sendbox__attachment-drop-zone--droppable": "dropZone_sendbox__attachment-drop-zone--droppable",
382
- "sendbox__attachment-drop-zone-icon": "dropZone_sendbox__attachment-drop-zone-icon"
383
- };
384
-
385
- // src/components/dropZone/index.tsx
386
- var { useLocalizer } = hooks;
387
- var handleDragOver = (event) => {
388
- event.preventDefault();
389
- };
390
- var isFilesTransferEvent = (event) => !!event.dataTransfer?.types?.some((type) => type.toLowerCase() === "files");
391
- function isDescendantOf(target, ancestor) {
392
- let current = target.parentNode;
393
- while (current) {
394
- if (current === ancestor) {
395
- return true;
396
- }
397
- current = current.parentNode;
398
- }
399
- return false;
400
- }
401
- var DropZone = (props) => {
402
- const [dropZoneState, setDropZoneState] = useState2(false);
403
- const classNames = useStyles_default(dropZone_default);
404
- const dropZoneRef = useRef2(null);
405
- const localize = useLocalizer();
406
- const onFilesAddedRef = useRefFrom3(props.onFilesAdded);
407
- useEffect2(() => {
408
- let entranceCounter = 0;
409
- const handleDragEnter = (event) => {
410
- entranceCounter++;
411
- if (isFilesTransferEvent(event)) {
412
- setDropZoneState(
413
- dropZoneRef.current && (event.target === dropZoneRef.current || event.target instanceof HTMLElement && isDescendantOf(event.target, dropZoneRef.current)) ? "droppable" : "visible"
414
- );
415
- }
416
- };
417
- const handleDragLeave = () => --entranceCounter <= 0 && setDropZoneState(false);
418
- document.addEventListener("dragenter", handleDragEnter, false);
419
- document.addEventListener("dragleave", handleDragLeave, false);
420
- return () => {
421
- document.removeEventListener("dragenter", handleDragEnter);
422
- document.removeEventListener("dragleave", handleDragLeave);
423
- };
424
- }, [setDropZoneState]);
425
- const handleDrop = useCallback3(
426
- (event) => {
427
- event.preventDefault();
428
- setDropZoneState(false);
429
- if (!isFilesTransferEvent(event.nativeEvent)) {
430
- return;
431
- }
432
- onFilesAddedRef.current([...event.dataTransfer.files]);
433
- },
434
- [onFilesAddedRef, setDropZoneState]
435
- );
436
- return dropZoneState ? /* @__PURE__ */ React9.createElement(
437
- "div",
438
- {
439
- className: cx3(classNames["sendbox__attachment-drop-zone"], {
440
- [classNames["sendbox__attachment-drop-zone--droppable"]]: dropZoneState === "droppable"
441
- }),
442
- "data-testid": testIds_default.sendBoxDropZone,
443
- onDragOver: handleDragOver,
444
- onDrop: handleDrop,
445
- ref: dropZoneRef
446
- },
447
- /* @__PURE__ */ React9.createElement(AddDocumentIcon, { className: classNames["sendbox__attachment-drop-zone-icon"] }),
448
- localize("TEXT_INPUT_DROP_ZONE")
449
- ) : null;
450
- };
451
- DropZone.displayName = "DropZone";
452
- var dropZone_default2 = memo6(DropZone);
453
-
454
- // src/components/DropZone.tsx
455
- var DropZone_default = dropZone_default2;
456
-
457
- // src/components/suggestedActions/index.tsx
458
- import { hooks as hooks3 } from "botframework-webchat-component";
459
- import cx5 from "classnames";
460
- import React12, { memo as memo9 } from "react";
461
-
462
- // src/components/suggestedActions/SuggestedAction.tsx
463
- import { hooks as hooks2 } from "botframework-webchat-component";
464
- import cx4 from "classnames";
465
- import React11, { memo as memo8, useCallback as useCallback4, useRef as useRef4 } from "react";
466
-
467
- // src/components/suggestedActions/SuggestedAction.module.css
468
- var SuggestedAction_default = {
469
- "suggested-action": "SuggestedAction_suggested-action",
470
- "suggested-action__image": "SuggestedAction_suggested-action__image"
471
- };
472
-
473
- // src/components/suggestedActions/AccessibleButton.tsx
474
- import React10, { forwardRef as forwardRef2, memo as memo7, useRef as useRef3 } from "react";
475
- var preventDefaultHandler = (event) => event.preventDefault();
476
- var AccessibleButton = forwardRef2(
477
- ({ "aria-hidden": ariaHidden, children, disabled, onClick, tabIndex, ...props }, forwardedRef) => {
478
- const targetRef = useRef3(null);
479
- const ref = forwardedRef || targetRef;
480
- return /* @__PURE__ */ React10.createElement(
481
- "button",
482
- {
483
- "aria-disabled": disabled ? "true" : "false",
484
- "aria-hidden": ariaHidden,
485
- onClick: disabled ? preventDefaultHandler : onClick,
486
- ref,
487
- tabIndex,
488
- ...disabled && {
489
- "aria-disabled": "true",
490
- tabIndex: -1
491
- },
492
- ...props,
493
- type: "button"
494
- },
495
- children
496
- );
497
- }
498
- );
499
- var AccessibleButton_default = memo7(AccessibleButton);
500
-
501
- // src/components/suggestedActions/SuggestedAction.tsx
502
- var { useDisabled, useFocus, usePerformCardAction, useScrollToEnd, useStyleSet, useSuggestedActions } = hooks2;
503
- function SuggestedAction({
504
- buttonText,
505
- className,
506
- displayText,
507
- image,
508
- imageAlt,
509
- text,
510
- type,
511
- value
512
- }) {
513
- const [_, setSuggestedActions] = useSuggestedActions();
514
- const [{ suggestedAction: suggestedActionStyleSet }] = useStyleSet();
515
- const [disabled] = useDisabled();
516
- const focus = useFocus();
517
- const focusRef = useRef4(null);
518
- const performCardAction = usePerformCardAction();
519
- const classNames = useStyles_default(SuggestedAction_default);
520
- const scrollToEnd = useScrollToEnd();
521
- const handleClick = useCallback4(
522
- ({ target }) => {
523
- (async function() {
524
- await focus("sendBoxWithoutKeyboard");
525
- performCardAction({ displayText, text, type, value }, { target });
526
- type === "openUrl" && setSuggestedActions([]);
527
- scrollToEnd();
528
- })();
529
- },
530
- [displayText, focus, performCardAction, scrollToEnd, setSuggestedActions, text, type, value]
531
- );
532
- return /* @__PURE__ */ React11.createElement(
533
- AccessibleButton_default,
534
- {
535
- className: cx4(classNames["suggested-action"], suggestedActionStyleSet + "", (className || "") + ""),
536
- disabled,
537
- onClick: handleClick,
538
- ref: focusRef,
539
- type: "button"
540
- },
541
- image && /* @__PURE__ */ React11.createElement("img", { alt: imageAlt, className: classNames["suggested-action__image"], src: image }),
542
- /* @__PURE__ */ React11.createElement("span", null, buttonText)
543
- );
544
- }
545
- var SuggestedAction_default2 = memo8(SuggestedAction);
546
-
547
- // src/components/suggestedActions/private/computeSuggestedActionText.ts
548
- function computeSuggestedActionText(cardAction) {
549
- const { title } = cardAction;
550
- const { type, value } = cardAction;
551
- if (type === "messageBack") {
552
- return title || cardAction.displayText;
553
- } else if (title) {
554
- return title;
555
- } else if (typeof value === "string") {
556
- return value;
557
- }
558
- return JSON.stringify(value);
559
- }
560
-
561
- // src/components/suggestedActions/index.module.css
562
- var suggestedActions_default = {
563
- "suggested-actions": "suggestedActions_suggested-actions",
564
- "suggested-actions--flow": "suggestedActions_suggested-actions--flow",
565
- "suggested-actions--stacked": "suggestedActions_suggested-actions--stacked"
566
- };
567
-
568
- // src/components/suggestedActions/index.tsx
569
- var { useLocalizer: useLocalizer2, useStyleOptions, useStyleSet: useStyleSet2, useSuggestedActions: useSuggestedActions2 } = hooks3;
570
- function SuggestedActionStackedOrFlowContainer(props) {
571
- const [{ suggestedActionLayout }] = useStyleOptions();
572
- const [{ suggestedActions: suggestedActionsStyleSet }] = useStyleSet2();
573
- const classNames = useStyles_default(suggestedActions_default);
574
- return /* @__PURE__ */ React12.createElement(
575
- "div",
576
- {
577
- "aria-label": props["aria-label"],
578
- "aria-live": "polite",
579
- "aria-orientation": "vertical",
580
- className: cx5(
581
- classNames["suggested-actions"],
582
- suggestedActionsStyleSet + "",
583
- {
584
- [classNames["suggested-actions--flow"]]: suggestedActionLayout === "flow",
585
- [classNames["suggested-actions--stacked"]]: suggestedActionLayout !== "flow"
586
- },
587
- props.className
588
- ),
589
- role: "toolbar"
590
- },
591
- !!props.children && !!React12.Children.count(props.children) && props.children
592
- );
593
- }
594
- function SuggestedActions() {
595
- const classNames = useStyles_default(suggestedActions_default);
596
- const localize = useLocalizer2();
597
- const [suggestedActions] = useSuggestedActions2();
598
- const children = suggestedActions.map((cardAction, index) => {
599
- const { displayText, image, imageAltText, text, type, value } = cardAction;
600
- if (!suggestedActions?.length) {
601
- return null;
602
- }
603
- return /* @__PURE__ */ React12.createElement(
604
- SuggestedAction_default2,
605
- {
606
- buttonText: computeSuggestedActionText(cardAction),
607
- displayText,
608
- image,
609
- imageAlt: image && (imageAltText || text),
610
- itemIndex: index,
611
- key: index,
612
- text,
613
- type,
614
- value
615
- }
616
- );
617
- });
618
- return /* @__PURE__ */ React12.createElement(
619
- SuggestedActionStackedOrFlowContainer,
620
- {
621
- "aria-label": localize("SUGGESTED_ACTIONS_LABEL_ALT"),
622
- className: classNames["suggested-actions"]
623
- },
624
- children
625
- );
626
- }
627
- var suggestedActions_default2 = memo9(SuggestedActions);
628
-
629
- // src/components/SuggestedActions.tsx
630
- var SuggestedActions_default = suggestedActions_default2;
631
-
632
- // src/components/sendbox/AddAttachmentButton.tsx
633
- import { hooks as hooks4 } from "botframework-webchat-component";
634
- import React15, { useCallback as useCallback5, useRef as useRef5, memo as memo11 } from "react";
635
- import { useRefFrom as useRefFrom4 } from "use-ref-from";
636
-
637
- // src/icons/AttachmentIcon.tsx
638
- import React13 from "react";
639
- function AttachmentIcon(props) {
640
- return /* @__PURE__ */ React13.createElement(
641
- "svg",
642
- {
643
- "aria-hidden": "true",
644
- className: props.className,
645
- height: "1em",
646
- viewBox: "0 0 20 20",
647
- width: "1em",
648
- xmlns: "http://www.w3.org/2000/svg"
649
- },
650
- /* @__PURE__ */ React13.createElement(
651
- "path",
652
- {
653
- d: "m4.83 10.48 5.65-5.65a3 3 0 0 1 4.25 4.24L8 15.8a1.5 1.5 0 0 1-2.12-2.12l6-6.01a.5.5 0 1 0-.7-.71l-6 6.01a2.5 2.5 0 0 0 3.53 3.54l6.71-6.72a4 4 0 1 0-5.65-5.66L4.12 9.78a.5.5 0 0 0 .7.7Z",
654
- fill: "currentColor"
655
- }
656
- )
657
- );
658
- }
659
-
660
- // src/components/sendbox/Toolbar.tsx
661
- import cx6 from "classnames";
662
- import React14, { memo as memo10 } from "react";
663
-
664
- // src/components/sendbox/Toolbar.module.css
665
- var Toolbar_default = {
666
- sendbox__toolbar: "Toolbar_sendbox__toolbar",
667
- "sendbox__toolbar-button": "Toolbar_sendbox__toolbar-button",
668
- "sendbox__toolbar-button--selected": "Toolbar_sendbox__toolbar-button--selected",
669
- "sendbox__toolbar-separator": "Toolbar_sendbox__toolbar-separator"
670
- };
671
-
672
- // src/components/sendbox/Toolbar.tsx
673
- var preventDefaultHandler2 = (event) => event.preventDefault();
674
- var ToolbarButton = memo10(
675
- (props) => {
676
- const classNames = useStyles_default(Toolbar_default);
677
- return /* @__PURE__ */ React14.createElement(
678
- "button",
679
- {
680
- "aria-label": props["aria-label"],
681
- className: cx6(classNames["sendbox__toolbar-button"], props.className, {
682
- [classNames["sendbox__toolbar-button--selected"]]: props.selected
683
- }),
684
- "data-testid": props["data-testid"],
685
- onClick: props.disabled ? preventDefaultHandler2 : props.onClick,
686
- type: props.type === "submit" ? "submit" : "button",
687
- ...props.disabled && {
688
- "aria-disabled": "true",
689
- tabIndex: -1
690
- }
691
- },
692
- props.children
693
- );
694
- }
695
- );
696
- ToolbarButton.displayName = "ToolbarButton";
697
- var Toolbar = memo10((props) => {
698
- const classNames = useStyles_default(Toolbar_default);
699
- return /* @__PURE__ */ React14.createElement("div", { className: cx6(classNames["sendbox__toolbar"], props.className) }, props.children);
700
- });
701
- Toolbar.displayName = "Toolbar";
702
- var ToolbarSeparator = memo10(
703
- (props) => {
704
- const classNames = useStyles_default(Toolbar_default);
705
- return /* @__PURE__ */ React14.createElement(
706
- "div",
707
- {
708
- "aria-orientation": "vertical",
709
- className: cx6(classNames["sendbox__toolbar-separator"], props.className),
710
- role: "separator"
711
- }
712
- );
713
- }
714
- );
715
- ToolbarSeparator.displayName = "ToolbarSeparator";
716
-
717
- // src/components/sendbox/AddAttachmentButton.module.css
718
- var AddAttachmentButton_default = {
719
- "sendbox__add-attachment": "AddAttachmentButton_sendbox__add-attachment",
720
- "sendbox__add-attachment-input": "AddAttachmentButton_sendbox__add-attachment-input"
721
- };
722
-
723
- // src/components/sendbox/AddAttachmentButton.tsx
724
- var { useLocalizer: useLocalizer3, useStyleOptions: useStyleOptions2 } = hooks4;
725
- function AddAttachmentButton(props) {
726
- const inputRef = useRef5(null);
727
- const classNames = useStyles_default(AddAttachmentButton_default);
728
- const localize = useLocalizer3();
729
- const [{ uploadAccept, uploadMultiple }] = useStyleOptions2();
730
- const onFilesAddedRef = useRefFrom4(props.onFilesAdded);
731
- const handleClick = useCallback5(() => inputRef.current?.click(), [inputRef]);
732
- const handleFileChange = useCallback5(
733
- ({ target: { files } }) => {
734
- if (files) {
735
- onFilesAddedRef.current?.([...files]);
736
- if (inputRef.current) {
737
- inputRef.current.value = "";
738
- }
739
- }
740
- },
741
- [inputRef, onFilesAddedRef]
742
- );
743
- return /* @__PURE__ */ React15.createElement("div", { className: classNames["sendbox__add-attachment"] }, /* @__PURE__ */ React15.createElement(
744
- "input",
745
- {
746
- accept: uploadAccept,
747
- "aria-disabled": props.disabled,
748
- "aria-hidden": "true",
749
- className: classNames["sendbox__add-attachment-input"],
750
- multiple: uploadMultiple,
751
- onInput: props.disabled ? void 0 : handleFileChange,
752
- readOnly: props.disabled,
753
- ref: inputRef,
754
- role: "button",
755
- tabIndex: -1,
756
- type: "file"
757
- }
758
- ), /* @__PURE__ */ React15.createElement(
759
- ToolbarButton,
760
- {
761
- "aria-label": localize("TEXT_INPUT_UPLOAD_BUTTON_ALT"),
762
- "data-testid": testIds_default.sendBoxUploadButton,
763
- onClick: handleClick
764
- },
765
- /* @__PURE__ */ React15.createElement(AttachmentIcon, null)
766
- ));
767
- }
768
- var AddAttachmentButton_default2 = memo11(AddAttachmentButton);
769
-
770
- // src/components/sendbox/Attachments.tsx
771
- import { hooks as hooks5 } from "botframework-webchat-component";
772
- import React16, { memo as memo12 } from "react";
773
- import cx7 from "classnames";
774
-
775
- // src/components/sendbox/Attachments.module.css
776
- var Attachments_default = {
777
- sendbox__attachment: "Attachments_sendbox__attachment"
778
- };
779
-
780
- // src/components/sendbox/Attachments.tsx
781
- var { useLocalizer: useLocalizer4 } = hooks5;
782
- var attachmentsPluralStringIds = {
783
- one: "TEXT_INPUT_ATTACHMENTS_ONE",
784
- two: "TEXT_INPUT_ATTACHMENTS_TWO",
785
- few: "TEXT_INPUT_ATTACHMENTS_FEW",
786
- many: "TEXT_INPUT_ATTACHMENTS_MANY",
787
- other: "TEXT_INPUT_ATTACHMENTS_OTHER"
788
- };
789
- function Attachments({
790
- attachments,
791
- className
792
- }) {
793
- const classNames = useStyles_default(Attachments_default);
794
- const localizeWithPlural = useLocalizer4({ plural: true });
795
- return attachments.length ? /* @__PURE__ */ React16.createElement("div", { className: cx7(classNames["sendbox__attachment"], className) }, localizeWithPlural(attachmentsPluralStringIds, attachments.length)) : null;
796
- }
797
- var Attachments_default2 = memo12(Attachments);
798
-
799
- // src/components/sendbox/ErrorMessage.tsx
800
- import React17, { memo as memo13 } from "react";
801
-
802
- // src/components/sendbox/ErrorMessage.module.css
803
- var ErrorMessage_default = {
804
- "sendbox__error-message": "ErrorMessage_sendbox__error-message"
805
- };
806
-
807
- // src/components/sendbox/ErrorMessage.tsx
808
- function ErrorMessage(props) {
809
- const classNames = useStyles_default(ErrorMessage_default);
810
- return (
811
- // eslint-disable-next-line react/forbid-dom-props
812
- /* @__PURE__ */ React17.createElement("span", { className: classNames["sendbox__error-message"], id: props.id, role: "alert" }, props.error)
813
- );
814
- }
815
- var ErrorMessage_default2 = memo13(ErrorMessage);
816
-
817
- // src/components/sendbox/TelephoneKeypadToolbarButton.tsx
818
- import React19, { memo as memo14, useCallback as useCallback6 } from "react";
819
- import { hooks as hooks6 } from "botframework-webchat-component";
820
-
821
- // src/icons/TelephoneKeypad.tsx
822
- import React18 from "react";
823
- function TelephoneKeypadIcon(props) {
824
- return /* @__PURE__ */ React18.createElement(
825
- "svg",
826
- {
827
- "aria-hidden": "true",
828
- className: props.className,
829
- height: "1em",
830
- viewBox: "0 0 20 20",
831
- width: "1em",
832
- xmlns: "http://www.w3.org/2000/svg"
833
- },
834
- /* @__PURE__ */ React18.createElement(
835
- "path",
836
- {
837
- d: "M6 5.25a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm0 4a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5ZM7.25 12a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0ZM10 5.25a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5ZM11.25 8a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0ZM10 13.25a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5ZM11.25 16a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0ZM14 5.25a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5ZM15.25 8a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0ZM14 13.25a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z",
838
- fill: "currentColor"
839
- }
840
- )
841
- );
842
- }
843
-
844
- // src/components/sendbox/TelephoneKeypadToolbarButton.tsx
845
- var { useLocalizer: useLocalizer5 } = hooks6;
846
- var TelephoneKeypadToolbarButton = memo14(() => {
847
- const [telephoneKeypadShown, setTelephoneKeypadShown] = useShown();
848
- const localize = useLocalizer5();
849
- const handleClick = useCallback6(() => setTelephoneKeypadShown((shown) => !shown), [setTelephoneKeypadShown]);
850
- return /* @__PURE__ */ React19.createElement(
851
- ToolbarButton,
852
- {
853
- "aria-label": localize("TEXT_INPUT_TELEPHONE_KEYPAD_BUTTON_ALT"),
854
- "data-testid": testIds_default.sendBoxTelephoneKeypadToolbarButton,
855
- onClick: handleClick,
856
- selected: telephoneKeypadShown
857
- },
858
- /* @__PURE__ */ React19.createElement(TelephoneKeypadIcon, null)
859
- );
860
- });
861
- TelephoneKeypadToolbarButton.displayName = "SendBox.TelephoneKeypadToolbarButton";
862
- var TelephoneKeypadToolbarButton_default = TelephoneKeypadToolbarButton;
863
-
864
- // src/components/sendbox/TextArea.tsx
865
- import cx8 from "classnames";
866
- import React20, { forwardRef as forwardRef3, useCallback as useCallback7 } from "react";
867
-
868
- // src/components/sendbox/TextArea.module.css
869
- var TextArea_default = {
870
- "sendbox__text-area": "TextArea_sendbox__text-area",
871
- "sendbox__text-area--hidden": "TextArea_sendbox__text-area--hidden",
872
- "sendbox__text-area-shared": "TextArea_sendbox__text-area-shared",
873
- "sendbox__text-area-doppelganger": "TextArea_sendbox__text-area-doppelganger",
874
- "sendbox__text-area-input": "TextArea_sendbox__text-area-input",
875
- "sendbox__text-area-input--scroll": "TextArea_sendbox__text-area-input--scroll"
876
- };
877
-
878
- // src/components/sendbox/TextArea.tsx
879
- var TextArea = forwardRef3((props, ref) => {
880
- const classNames = useStyles_default(TextArea_default);
881
- const handleKeyDown = useCallback7((event) => {
882
- if (!event.shiftKey && event.key === "Enter") {
883
- event.preventDefault();
884
- if ("form" in event.target && event.target.form instanceof HTMLFormElement) {
885
- event.target?.form?.requestSubmit();
886
- }
887
- }
888
- }, []);
889
- return /* @__PURE__ */ React20.createElement(
890
- "div",
891
- {
892
- className: cx8(
893
- classNames["sendbox__text-area"],
894
- {
895
- [classNames["sendbox__text-area--hidden"]]: props.hidden
896
- },
897
- props.className
898
- ),
899
- role: props.hidden ? "hidden" : void 0
900
- },
901
- /* @__PURE__ */ React20.createElement(
902
- "div",
903
- {
904
- className: cx8(
905
- classNames["sendbox__text-area-doppelganger"],
906
- classNames["sendbox__text-area-shared"],
907
- classNames["sendbox__text-area-input--scroll"]
908
- )
909
- },
910
- props.value || props.placeholder,
911
- " "
912
- ),
913
- /* @__PURE__ */ React20.createElement(
914
- "textarea",
915
- {
916
- "aria-label": props["aria-label"],
917
- className: cx8(
918
- classNames["sendbox__text-area-input"],
919
- classNames["sendbox__text-area-shared"],
920
- classNames["sendbox__text-area-input--scroll"]
921
- ),
922
- "data-testid": props["data-testid"],
923
- onInput: props.onInput,
924
- onKeyDown: handleKeyDown,
925
- placeholder: props.placeholder,
926
- ref,
927
- rows: props.startRows ?? 1,
928
- tabIndex: props.hidden ? -1 : void 0,
929
- value: props.value
930
- }
931
- )
932
- );
933
- });
934
- TextArea.displayName = "TextArea";
935
- var TextArea_default2 = TextArea;
936
-
937
- // src/components/sendbox/private/useSubmitError.ts
938
- import { hooks as hooks7 } from "botframework-webchat-component";
939
- import { useMemo as useMemo4 } from "react";
940
- import { useRefFrom as useRefFrom5 } from "use-ref-from";
941
- var { useConnectivityStatus, useLocalizer: useLocalizer6 } = hooks7;
942
- var useSubmitError = ({
943
- attachments,
944
- message
945
- }) => {
946
- const [connectivityStatus] = useConnectivityStatus();
947
- const localize = useLocalizer6();
948
- const submitErrorRef = useRefFrom5(
949
- connectivityStatus !== "connected" && connectivityStatus !== "reconnected" ? "offline" : !message && !attachments.length ? "empty" : void 0
950
- );
951
- const errorMessageStringMap = useMemo4(
952
- () => Object.freeze(
953
- (/* @__PURE__ */ new Map()).set("empty", localize("SEND_BOX_IS_EMPTY_TOOLTIP_ALT")).set("offline", localize("CONNECTIVITY_STATUS_ALT_FATAL"))
954
- ),
955
- [localize]
956
- );
957
- return useMemo4(
958
- () => Object.freeze([submitErrorRef, submitErrorRef.current && errorMessageStringMap.get(submitErrorRef.current)]),
959
- [errorMessageStringMap, submitErrorRef]
960
- );
961
- };
962
- var useSubmitError_default = useSubmitError;
963
-
964
- // src/components/sendbox/private/useUniqueId.ts
965
- import { useMemo as useMemo5 } from "react";
966
- function useUniqueId(prefix) {
967
- const id = useMemo5(() => Math.random().toString(36).substr(2, 5), []);
968
- prefix = prefix ? `${prefix}--` : "";
969
- return `${prefix}${id}`;
970
- }
971
-
972
- // src/components/sendbox/index.module.css
973
- var sendbox_default = {
974
- sendbox: "sendbox_sendbox",
975
- sendbox__sendbox: "sendbox_sendbox__sendbox",
976
- "sendbox__attachment--in-grid": "sendbox_sendbox__attachment--in-grid",
977
- "sendbox__text-area--in-grid": "sendbox_sendbox__text-area--in-grid",
978
- "sendbox__sendbox-controls--in-grid": "sendbox_sendbox__sendbox-controls--in-grid",
979
- "sendbox__telephone-keypad--in-grid": "sendbox_sendbox__telephone-keypad--in-grid",
980
- "sendbox__sendbox-text": "sendbox_sendbox__sendbox-text",
981
- "sendbox__sendbox-controls": "sendbox_sendbox__sendbox-controls",
982
- "sendbox__text-counter": "sendbox_sendbox__text-counter",
983
- "sendbox__text-counter--error": "sendbox_sendbox__text-counter--error"
984
- };
985
-
986
- // src/components/sendbox/index.tsx
987
- var { useStyleOptions: useStyleOptions3, useMakeThumbnail, useLocalizer: useLocalizer7, useSendBoxAttachments, useSendMessage } = hooks8;
988
- function SendBox(props) {
989
- const inputRef = useRef6(null);
990
- const [message, setMessage] = useState3("");
991
- const [attachments, setAttachments] = useSendBoxAttachments();
992
- const [{ hideTelephoneKeypadButton, hideUploadButton, maxMessageLength }] = useStyleOptions3();
993
- const isMessageLengthExceeded = !!maxMessageLength && message.length > maxMessageLength;
994
- const classNames = useStyles_default(sendbox_default);
995
- const localize = useLocalizer7();
996
- const sendMessage = useSendMessage();
997
- const makeThumbnail = useMakeThumbnail();
998
- const errorMessageId = useUniqueId("sendbox__error-message-id");
999
- const [errorRef, errorMessage] = useSubmitError_default({ message, attachments });
1000
- const [telephoneKeypadShown] = useShown();
1001
- const attachmentsRef = useRefFrom6(attachments);
1002
- const messageRef = useRefFrom6(message);
1003
- const handleSendBoxClick = useCallback8(
1004
- (event) => {
1005
- if ("tabIndex" in event.target && typeof event.target.tabIndex === "number" && event.target.tabIndex >= 0) {
1006
- return;
1007
- }
1008
- inputRef.current?.focus();
1009
- },
1010
- [inputRef]
1011
- );
1012
- const handleMessageChange = useCallback8(
1013
- (event) => setMessage(event.currentTarget.value),
1014
- [setMessage]
1015
- );
1016
- const handleAddFiles = useCallback8(
1017
- async (inputFiles) => {
1018
- const newAttachments = Object.freeze(
1019
- await Promise.all(
1020
- inputFiles.map(
1021
- (file) => makeThumbnail(file).then(
1022
- (thumbnailURL) => Object.freeze({
1023
- blob: file,
1024
- ...thumbnailURL && { thumbnailURL }
1025
- })
1026
- )
1027
- )
1028
- )
1029
- );
1030
- setAttachments(newAttachments);
1031
- },
1032
- [makeThumbnail, setAttachments]
1033
- );
1034
- const handleFormSubmit = useCallback8(
1035
- (event) => {
1036
- event.preventDefault();
1037
- if (errorRef.current !== "empty" && !isMessageLengthExceeded) {
1038
- sendMessage(messageRef.current, void 0, { attachments: attachmentsRef.current });
1039
- setMessage("");
1040
- setAttachments([]);
1041
- }
1042
- inputRef.current?.focus();
1043
- },
1044
- [attachmentsRef, messageRef, sendMessage, setAttachments, setMessage, isMessageLengthExceeded, errorRef, inputRef]
1045
- );
1046
- const handleTelephoneKeypadButtonClick = useCallback8(
1047
- // TODO: We need more official way of sending DTMF.
1048
- (dtmf) => sendMessage(`/DTMF ${dtmf}`),
1049
- [sendMessage]
1050
- );
1051
- const aria = {
1052
- "aria-invalid": "false",
1053
- ...errorMessage && {
1054
- "aria-invalid": "true",
1055
- "aria-errormessage": errorMessageId
1056
- }
1057
- };
1058
- return /* @__PURE__ */ React21.createElement("form", { ...aria, className: cx9(classNames["sendbox"], props.className), onSubmit: handleFormSubmit }, /* @__PURE__ */ React21.createElement(SuggestedActions_default, null), /* @__PURE__ */ React21.createElement("div", { className: cx9(classNames["sendbox__sendbox"]), onClickCapture: handleSendBoxClick }, /* @__PURE__ */ React21.createElement(
1059
- TextArea_default2,
1060
- {
1061
- "aria-label": isMessageLengthExceeded ? localize("TEXT_INPUT_LENGTH_EXCEEDED_ALT") : localize("TEXT_INPUT_ALT"),
1062
- className: cx9(classNames["sendbox__sendbox-text"], classNames["sendbox__text-area--in-grid"]),
1063
- "data-testid": testIds_default.sendBoxTextBox,
1064
- hidden: telephoneKeypadShown,
1065
- onInput: handleMessageChange,
1066
- placeholder: props.placeholder ?? localize("TEXT_INPUT_PLACEHOLDER"),
1067
- ref: inputRef,
1068
- value: message
1069
- }
1070
- ), /* @__PURE__ */ React21.createElement(
1071
- Surrogate_default,
1072
- {
1073
- autoFocus: true,
1074
- className: classNames["sendbox__telephone-keypad--in-grid"],
1075
- isHorizontal: false,
1076
- onButtonClick: handleTelephoneKeypadButtonClick
1077
- }
1078
- ), /* @__PURE__ */ React21.createElement(Attachments_default2, { attachments, className: classNames["sendbox__attachment--in-grid"] }), /* @__PURE__ */ React21.createElement("div", { className: cx9(classNames["sendbox__sendbox-controls"], classNames["sendbox__sendbox-controls--in-grid"]) }, !telephoneKeypadShown && maxMessageLength && /* @__PURE__ */ React21.createElement(
1079
- "div",
1080
- {
1081
- className: cx9(classNames["sendbox__text-counter"], {
1082
- [classNames["sendbox__text-counter--error"]]: isMessageLengthExceeded
1083
- })
1084
- },
1085
- `${message.length}/${maxMessageLength}`
1086
- ), /* @__PURE__ */ React21.createElement(Toolbar, null, !hideTelephoneKeypadButton && /* @__PURE__ */ React21.createElement(TelephoneKeypadToolbarButton_default, null), !hideUploadButton && /* @__PURE__ */ React21.createElement(AddAttachmentButton_default2, { onFilesAdded: handleAddFiles }), /* @__PURE__ */ React21.createElement(ToolbarSeparator, null), /* @__PURE__ */ React21.createElement(
1087
- ToolbarButton,
1088
- {
1089
- "aria-label": localize("TEXT_INPUT_SEND_BUTTON_ALT"),
1090
- "data-testid": testIds_default.sendBoxSendButton,
1091
- disabled: isMessageLengthExceeded || telephoneKeypadShown,
1092
- type: "submit"
1093
- },
1094
- /* @__PURE__ */ React21.createElement(SendIcon, null)
1095
- ))), /* @__PURE__ */ React21.createElement(DropZone_default, { onFilesAdded: handleAddFiles }), /* @__PURE__ */ React21.createElement(ErrorMessage_default2, { error: errorMessage, id: errorMessageId })));
1096
- }
1097
- var sendbox_default2 = memo15(SendBox);
1098
-
1099
- // src/components/SendBox.tsx
1100
- var SendBox_default = sendbox_default2;
1101
-
1102
- // src/private/FluentThemeProvider.tsx
1103
- var { ThemeProvider } = Components2;
1104
- var sendBoxMiddleware = [() => () => () => SendBox_default];
1105
- var FluentThemeProvider = ({ children }) => /* @__PURE__ */ React22.createElement(WebchatTheme, null, /* @__PURE__ */ React22.createElement(Provider_default, null, /* @__PURE__ */ React22.createElement(ThemeProvider, { sendBoxMiddleware }, children)));
1106
- var FluentThemeProvider_default = memo16(FluentThemeProvider);
1107
-
1108
- // src/index.ts
1109
- injectMetaTag("botframework-webchat-fluent-theme:version", "4.17.0-main.20240425.edca85d");
1110
- injectStyles();
1111
- export {
1112
- FluentThemeProvider_default as FluentThemeProvider,
1113
- testIds_default as testIds
1114
- };
1115
- //# sourceMappingURL=index.mjs.map