botframework-webchat-fluent-theme 4.17.0-main.20240411.ff34969 → 4.17.0-main.20240416.e3f5401

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.
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+
3
+ declare const _default: React.MemoExoticComponent<({ children }: Readonly<{
4
+ children?: React.ReactNode;
5
+ }>) => React.JSX.Element>;
6
+
7
+ declare const testIds: {
8
+ sendBoxDropZone: string;
9
+ sendBoxSendButton: string;
10
+ sendBoxTextBox: string;
11
+ sendBoxTelephoneKeypadButton1: string;
12
+ sendBoxTelephoneKeypadButton2: string;
13
+ sendBoxTelephoneKeypadButton3: string;
14
+ sendBoxTelephoneKeypadButton4: string;
15
+ sendBoxTelephoneKeypadButton5: string;
16
+ sendBoxTelephoneKeypadButton6: string;
17
+ sendBoxTelephoneKeypadButton7: string;
18
+ sendBoxTelephoneKeypadButton8: string;
19
+ sendBoxTelephoneKeypadButton9: string;
20
+ sendBoxTelephoneKeypadButton0: string;
21
+ sendBoxTelephoneKeypadButtonStar: string;
22
+ sendBoxTelephoneKeypadButtonPound: string;
23
+ sendBoxTelephoneKeypadToolbarButton: string;
24
+ sendBoxUploadButton: string;
25
+ };
26
+
27
+ export { _default as FluentThemeProvider, testIds };
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+
3
+ declare const _default: React.MemoExoticComponent<({ children }: Readonly<{
4
+ children?: React.ReactNode;
5
+ }>) => React.JSX.Element>;
6
+
7
+ declare const testIds: {
8
+ sendBoxDropZone: string;
9
+ sendBoxSendButton: string;
10
+ sendBoxTextBox: string;
11
+ sendBoxTelephoneKeypadButton1: string;
12
+ sendBoxTelephoneKeypadButton2: string;
13
+ sendBoxTelephoneKeypadButton3: string;
14
+ sendBoxTelephoneKeypadButton4: string;
15
+ sendBoxTelephoneKeypadButton5: string;
16
+ sendBoxTelephoneKeypadButton6: string;
17
+ sendBoxTelephoneKeypadButton7: string;
18
+ sendBoxTelephoneKeypadButton8: string;
19
+ sendBoxTelephoneKeypadButton9: string;
20
+ sendBoxTelephoneKeypadButton0: string;
21
+ sendBoxTelephoneKeypadButtonStar: string;
22
+ sendBoxTelephoneKeypadButtonPound: string;
23
+ sendBoxTelephoneKeypadToolbarButton: string;
24
+ sendBoxUploadButton: string;
25
+ };
26
+
27
+ export { _default as FluentThemeProvider, testIds };
package/dist/index.js CHANGED
@@ -124,7 +124,7 @@ var styles = {
124
124
  // border: `solid 1px ${isHighContrastTheme() ? white : isDarkTheme() ? gray160 : gray40}`,
125
125
  // color: 'inherit',
126
126
  border: "solid 1px var(--webchat-colorNeutralStroke1)",
127
- color: "var(--webchat-colorNeutralForeground1)",
127
+ color: "var(--webchat-colorGray200)",
128
128
  fontWeight: "var(--webchat-fontWeightSemibold)",
129
129
  cursor: "pointer",
130
130
  display: "flex",
@@ -143,7 +143,7 @@ var styles = {
143
143
  },
144
144
  "webchat__telephone-keypad__button__ruby": {
145
145
  // color: isHighContrastTheme() ? white : isDarkTheme() ? gray40 : gray160,
146
- color: "var(--webchat-colorGray160)",
146
+ color: "var(--webchat-colorGray190)",
147
147
  fontSize: 10
148
148
  },
149
149
  "webchat__telephone-keypad__button__text": {
@@ -403,9 +403,10 @@ var styles3 = {
403
403
  "--webchat-colorCompoundBrandForeground1Hover": "var(--colorCompoundBrandForeground1Hover, #02729c)",
404
404
  "--webchat-colorCompoundBrandForeground1Pressed": "var(--colorCompoundBrandForeground1Pressed, #01678c)",
405
405
  "--webchat-colorStatusDangerForeground1": "var(--colorStatusDangerForeground1, #b10e1c)",
406
- // https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/global/colors.ts
406
+ // https://github.com/microsoft/fluentui/blob/master/packages/theme/src/colors/FluentColors.ts
407
407
  "--webchat-colorGray30": "var(--colorGray30, #edebe9)",
408
408
  "--webchat-colorGray160": "var(--colorGray160, #323130)",
409
+ "--webchat-colorGray190": "var(--colorGray190, #201f1e)",
409
410
  "--webchat-colorGray200": "var(--colorGray200, #1b1a19)",
410
411
  // https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/global/borderRadius.ts
411
412
  "--webchat-borderRadiusSmall": "var(--borderRadiusSmall, 2px)",
@@ -589,20 +590,6 @@ var import_botframework_webchat_component2 = require("botframework-webchat-compo
589
590
  var import_classnames3 = __toESM(require("classnames"));
590
591
  var import_react15 = __toESM(require("react"));
591
592
 
592
- // src/components/suggestedActions/private/computeSuggestedActionText.ts
593
- function computeSuggestedActionText(cardAction) {
594
- const { title } = cardAction;
595
- const { type, value } = cardAction;
596
- if (type === "messageBack") {
597
- return title || cardAction.displayText;
598
- } else if (title) {
599
- return title;
600
- } else if (typeof value === "string") {
601
- return value;
602
- }
603
- return JSON.stringify(value);
604
- }
605
-
606
593
  // src/components/suggestedActions/SuggestedAction.tsx
607
594
  var import_botframework_webchat_component = require("botframework-webchat-component");
608
595
  var import_classnames2 = __toESM(require("classnames"));
@@ -637,20 +624,19 @@ var AccessibleButton = (0, import_react13.forwardRef)(
637
624
  var AccessibleButton_default = (0, import_react13.memo)(AccessibleButton);
638
625
 
639
626
  // src/components/suggestedActions/SuggestedAction.tsx
640
- var { useScrollToEnd, useStyleSet, usePerformCardAction, useFocus, useSuggestedActions, useDisabled } = import_botframework_webchat_component.hooks;
627
+ var { useDisabled, useFocus, usePerformCardAction, useScrollToEnd, useStyleSet, useSuggestedActions } = import_botframework_webchat_component.hooks;
641
628
  var styles5 = {
642
629
  "webchat-fluent__suggested-action": {
630
+ alignItems: "center",
643
631
  background: "transparent",
644
632
  border: "1px solid var(--webchat-colorBrandStroke2)",
645
633
  borderRadius: "8px",
646
634
  cursor: "pointer",
647
- fontSize: "12px",
648
- lineHeight: "14px",
649
- padding: "6px 8px 4px",
650
- textAlign: "start",
651
635
  display: "flex",
636
+ fontSize: "12px",
652
637
  gap: "4px",
653
- alignItems: "center",
638
+ padding: "4px 8px 4px",
639
+ textAlign: "start",
654
640
  transition: "all .15s ease-out",
655
641
  "@media (hover: hover)": {
656
642
  '&:not([aria-disabled="true"]):hover': {
@@ -663,15 +649,12 @@ var styles5 = {
663
649
  color: "var(--webchat-colorBrandForeground2Pressed)"
664
650
  },
665
651
  '&[aria-disabled="true"]': {
666
- color: " var(--webchat-colorNeutralForegroundDisabled)",
652
+ color: "var(--webchat-colorNeutralForegroundDisabled)",
667
653
  cursor: "not-allowed"
668
654
  }
669
655
  },
670
656
  "webchat-fluent__suggested-action__image": {
671
- width: "1em",
672
- height: "1em",
673
- fontSize: "20px",
674
- translate: "0 -1px"
657
+ height: "12px"
675
658
  }
676
659
  };
677
660
  function SuggestedAction({
@@ -722,22 +705,44 @@ function SuggestedAction({
722
705
  }
723
706
  var SuggestedAction_default = (0, import_react14.memo)(SuggestedAction);
724
707
 
708
+ // src/components/suggestedActions/private/computeSuggestedActionText.ts
709
+ function computeSuggestedActionText(cardAction) {
710
+ const { title } = cardAction;
711
+ const { type, value } = cardAction;
712
+ if (type === "messageBack") {
713
+ return title || cardAction.displayText;
714
+ } else if (title) {
715
+ return title;
716
+ } else if (typeof value === "string") {
717
+ return value;
718
+ }
719
+ return JSON.stringify(value);
720
+ }
721
+
725
722
  // src/components/suggestedActions/index.tsx
726
- var { useLocalizer: useLocalizer2, useStyleSet: useStyleSet2, useSuggestedActions: useSuggestedActions2 } = import_botframework_webchat_component2.hooks;
723
+ var { useLocalizer: useLocalizer2, useStyleOptions, useStyleSet: useStyleSet2, useSuggestedActions: useSuggestedActions2 } = import_botframework_webchat_component2.hooks;
727
724
  var styles6 = {
728
725
  "webchat-fluent__suggested-actions": {
729
726
  alignItems: "flex-end",
730
727
  alignSelf: "flex-end",
731
728
  display: "flex",
732
- flexDirection: "column",
733
729
  gap: "8px",
734
730
  "&:not(:empty)": {
735
731
  paddingBlockEnd: "8px",
736
732
  paddingInlineStart: "4px"
733
+ },
734
+ "&.webchat-fluent__suggested-actions--flow": {
735
+ flexDirection: "row",
736
+ flexWrap: "wrap",
737
+ justifyContent: "flex-end"
738
+ },
739
+ "&.webchat-fluent__suggested-actions--stacked": {
740
+ flexDirection: "column"
737
741
  }
738
742
  }
739
743
  };
740
- function SuggestedActionStackedContainer(props) {
744
+ function SuggestedActionStackedOrFlowContainer(props) {
745
+ const [{ suggestedActionLayout }] = useStyleOptions();
741
746
  const [{ suggestedActions: suggestedActionsStyleSet }] = useStyleSet2();
742
747
  const classNames = useStyles(styles6);
743
748
  return /* @__PURE__ */ import_react15.default.createElement(
@@ -746,7 +751,15 @@ function SuggestedActionStackedContainer(props) {
746
751
  "aria-label": props["aria-label"],
747
752
  "aria-live": "polite",
748
753
  "aria-orientation": "vertical",
749
- className: (0, import_classnames3.default)(classNames["webchat-fluent__suggested-actions"], suggestedActionsStyleSet + "", props.className),
754
+ className: (0, import_classnames3.default)(
755
+ classNames["webchat-fluent__suggested-actions"],
756
+ suggestedActionsStyleSet + "",
757
+ {
758
+ "webchat-fluent__suggested-actions--flow": suggestedActionLayout === "flow",
759
+ "webchat-fluent__suggested-actions--stacked": suggestedActionLayout !== "flow"
760
+ },
761
+ props.className
762
+ ),
750
763
  role: "toolbar"
751
764
  },
752
765
  !!props.children && !!import_react15.default.Children.count(props.children) && props.children
@@ -777,7 +790,7 @@ function SuggestedActions() {
777
790
  );
778
791
  });
779
792
  return /* @__PURE__ */ import_react15.default.createElement(
780
- SuggestedActionStackedContainer,
793
+ SuggestedActionStackedOrFlowContainer,
781
794
  {
782
795
  "aria-label": localize("SUGGESTED_ACTIONS_LABEL_ALT"),
783
796
  className: classNames["webchat-fluent__suggested-actions"]
@@ -855,7 +868,7 @@ var styles7 = {
855
868
  color: "var(--webchat-colorCompoundBrandForeground1Pressed)"
856
869
  },
857
870
  '&[aria-disabled="true"]': {
858
- color: " var(--webchat-colorNeutralForegroundDisabled)",
871
+ color: "var(--webchat-colorNeutralForegroundDisabled)",
859
872
  cursor: "not-allowed"
860
873
  }
861
874
  },
@@ -911,7 +924,7 @@ var ToolbarSeparator = (0, import_react17.memo)(
911
924
  ToolbarSeparator.displayName = "ToolbarSeparator";
912
925
 
913
926
  // src/components/sendbox/AddAttachmentButton.tsx
914
- var { useLocalizer: useLocalizer3, useStyleOptions } = import_botframework_webchat_api2.hooks;
927
+ var { useLocalizer: useLocalizer3, useStyleOptions: useStyleOptions2 } = import_botframework_webchat_api2.hooks;
915
928
  var styles8 = {
916
929
  "webchat-fluent__sendbox__add-attachment": {
917
930
  display: "grid"
@@ -927,7 +940,7 @@ function AddAttachmentButton(props) {
927
940
  const inputRef = (0, import_react18.useRef)(null);
928
941
  const classNames = useStyles(styles8);
929
942
  const localize = useLocalizer3();
930
- const [{ uploadAccept, uploadMultiple }] = useStyleOptions();
943
+ const [{ uploadAccept, uploadMultiple }] = useStyleOptions2();
931
944
  const onFilesAddedRef = (0, import_use_ref_from4.useRefFrom)(props.onFilesAdded);
932
945
  const handleClick = (0, import_react18.useCallback)(() => inputRef.current?.click(), [inputRef]);
933
946
  const handleFileChange = (0, import_react18.useCallback)(
@@ -1108,7 +1121,7 @@ var styles11 = {
1108
1121
  width: "8px"
1109
1122
  },
1110
1123
  "&::-webkit-scrollbar-track": {
1111
- backgroundColor: " var(--webchat-colorNeutralBackground5)",
1124
+ backgroundColor: "var(--webchat-colorNeutralBackground5)",
1112
1125
  borderRadius: "16px"
1113
1126
  },
1114
1127
  "&::-webkit-scrollbar-thumb": {
@@ -1214,7 +1227,7 @@ function useUniqueId(prefix) {
1214
1227
  }
1215
1228
 
1216
1229
  // src/components/sendbox/index.tsx
1217
- var { useStyleOptions: useStyleOptions2, useMakeThumbnail, useLocalizer: useLocalizer7, useSendBoxAttachments, useSendMessage } = import_botframework_webchat_component4.hooks;
1230
+ var { useStyleOptions: useStyleOptions3, useMakeThumbnail, useLocalizer: useLocalizer7, useSendBoxAttachments, useSendMessage } = import_botframework_webchat_component4.hooks;
1218
1231
  var styles12 = {
1219
1232
  "webchat-fluent__sendbox": {
1220
1233
  color: "var(--webchat-colorNeutralForeground1)",
@@ -1273,7 +1286,7 @@ function SendBox(props) {
1273
1286
  const inputRef = (0, import_react26.useRef)(null);
1274
1287
  const [message, setMessage] = (0, import_react26.useState)("");
1275
1288
  const [attachments, setAttachments] = useSendBoxAttachments();
1276
- const [{ maxMessageLength }] = useStyleOptions2();
1289
+ const [{ hideTelephoneKeypadButton, hideUploadButton, maxMessageLength }] = useStyleOptions3();
1277
1290
  const isMessageLengthExceeded = !!maxMessageLength && message.length > maxMessageLength;
1278
1291
  const classNames = useStyles(styles12);
1279
1292
  const localize = useLocalizer7();
@@ -1281,7 +1294,7 @@ function SendBox(props) {
1281
1294
  const makeThumbnail = useMakeThumbnail();
1282
1295
  const errorMessageId = useUniqueId("webchat-fluent__sendbox__error-message-id");
1283
1296
  const [errorRef, errorMessage] = useSubmitError_default({ message, attachments });
1284
- const [telephoneKeypadShown, setTelephoneKeypadShown] = useShown();
1297
+ const [telephoneKeypadShown] = useShown();
1285
1298
  const attachmentsRef = (0, import_use_ref_from6.useRefFrom)(attachments);
1286
1299
  const messageRef = (0, import_use_ref_from6.useRefFrom)(message);
1287
1300
  const handleSendBoxClick = (0, import_react26.useCallback)(
@@ -1328,11 +1341,9 @@ function SendBox(props) {
1328
1341
  [attachmentsRef, messageRef, sendMessage, setAttachments, setMessage, isMessageLengthExceeded, errorRef, inputRef]
1329
1342
  );
1330
1343
  const handleTelephoneKeypadButtonClick = (0, import_react26.useCallback)(
1331
- (dtmf) => {
1332
- sendMessage(`/DTMF ${dtmf}`);
1333
- setTelephoneKeypadShown(false);
1334
- },
1335
- [sendMessage, setTelephoneKeypadShown]
1344
+ // TODO: We need more official way of sending DTMF.
1345
+ (dtmf) => sendMessage(`/DTMF ${dtmf}`),
1346
+ [sendMessage]
1336
1347
  );
1337
1348
  const aria = {
1338
1349
  "aria-invalid": "false",
@@ -1368,7 +1379,7 @@ function SendBox(props) {
1368
1379
  })
1369
1380
  },
1370
1381
  `${message.length}/${maxMessageLength}`
1371
- ), /* @__PURE__ */ import_react26.default.createElement(Toolbar, null, /* @__PURE__ */ import_react26.default.createElement(TelephoneKeypadToolbarButton_default, null), /* @__PURE__ */ import_react26.default.createElement(AddAttachmentButton_default, { onFilesAdded: handleAddFiles }), /* @__PURE__ */ import_react26.default.createElement(ToolbarSeparator, null), /* @__PURE__ */ import_react26.default.createElement(
1382
+ ), /* @__PURE__ */ import_react26.default.createElement(Toolbar, null, !hideTelephoneKeypadButton && /* @__PURE__ */ import_react26.default.createElement(TelephoneKeypadToolbarButton_default, null), !hideUploadButton && /* @__PURE__ */ import_react26.default.createElement(AddAttachmentButton_default, { onFilesAdded: handleAddFiles }), /* @__PURE__ */ import_react26.default.createElement(ToolbarSeparator, null), /* @__PURE__ */ import_react26.default.createElement(
1372
1383
  ToolbarButton,
1373
1384
  {
1374
1385
  "aria-label": localize("TEXT_INPUT_SEND_BUTTON_ALT"),
@@ -1391,7 +1402,7 @@ var FluentThemeProvider = ({ children }) => /* @__PURE__ */ import_react27.defau
1391
1402
  var FluentThemeProvider_default = (0, import_react27.memo)(FluentThemeProvider);
1392
1403
 
1393
1404
  // src/index.ts
1394
- (0, import_inject_meta_tag.injectMetaTag)("botframework-webchat-fluent-theme:version", "4.17.0-main.20240411.ff34969");
1405
+ (0, import_inject_meta_tag.injectMetaTag)("botframework-webchat-fluent-theme:version", "4.17.0-main.20240416.e3f5401");
1395
1406
  // Annotate the CommonJS export names for ESM import in node:
1396
1407
  0 && (module.exports = {
1397
1408
  FluentThemeProvider,